dejagnu
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RFA: libgloss.exp: Only use -isystem to include system header files.


From: Nick Clifton
Subject: RFA: libgloss.exp: Only use -isystem to include system header files.
Date: Thu, 11 Nov 2004 18:12:04 +0000

Hi Rob,

  Please may I have permission to apply the attached patch ?  It
  implements a change you suggested here:

    http://lists.gnu.org/archive/html/dejagnu/2004-05/msg00006.html

  So that only the header files in newlib are included via the
  -isystem switch.  Other header files, eg for libstdc++-v3, are
  included via -I.  This appears to pacify the GCC and G++ tests that
  include <limits.h> and barf if they encounter a #include_next
  directive whilst not penalising targets which do not define
  NO_IMPLICIT_EXTERN_C.

Cheers
  Nick

dejagnu/ChangeLog
2004-11-11  Nick Clifton  <address@hidden>

        * lib/libgloss.exp (libio_include_flags, g++_include_flags,
        winsup_include_flags): Restore the use of -I to set the
        include paths for all libraries except newlib.  Newlib needs
        -isystem to avoid the problems with <limits.h> but the C++ and
        winsup libraries need -I because -isystem generates an
        implicit 'extern "C"' which may not be appropriate for certain
        targets.

Index: dejagnu/lib/libgloss.exp
===================================================================
RCS file: /cvsroot/dejagnu/dejagnu/lib/libgloss.exp,v
retrieving revision 1.16
diff -c -3 -p -r1.16 libgloss.exp
*** dejagnu/lib/libgloss.exp    7 Jun 2004 01:39:49 -0000       1.16
--- dejagnu/lib/libgloss.exp    11 Nov 2004 18:07:19 -0000
***************
*** 1,5 ****
  # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
! # 2001, 2002, 2003 Free Software Foundation, Inc.
  #
  # This file is part of DejaGnu.
  #
--- 1,5 ----
  # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
! # 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
  #
  # This file is part of DejaGnu.
  #
*************** proc newlib_include_flags { args } {
*** 158,163 ****
--- 158,169 ----
        if { ${newlib_dir} != "" } {
            set newlib_dir [file dirname ${newlib_dir}]
        }
+       # Note - we use -isystem rather than -I because newlib contains
+       # system header files.  This is especially important for the
+       # limits.h header which makes use of the #include_next directive.
+       # #include_next will generate error messages from GCC if compiling
+       # in strict ANSI mode or if another limits.h header cannot be found.
+       # When it is included via -isystem these things do not happen.
        return " -isystem $gccpath/newlib/targ-include -isystem ${newlib_dir}"
      } else {
        verbose "No newlib support for this target"
*************** proc libio_include_flags { args } {
*** 190,196 ****
      if { $libio_bin_dir != "" && $libio_src_dir != "" } {
        set libio_src_dir [file dirname ${libio_src_dir}]
        set libio_bin_dir [file dirname ${libio_bin_dir}]
!       return " -isystem ${libio_src_dir} -isystem ${libio_bin_dir}"
      } else {
        return ""
      }
--- 196,207 ----
      if { $libio_bin_dir != "" && $libio_src_dir != "" } {
        set libio_src_dir [file dirname ${libio_src_dir}]
        set libio_bin_dir [file dirname ${libio_bin_dir}]
!       # Note - unlike the newlib_include_flags proc above we use the -I
!       # switch to specify the include paths.  This is because these headers
!       # are not system headers, and if -isystem were to be used GCC would
!       # generate an implicit extern "C" { ... } surrounding them.  This
!       # will break targets which do not define NO_IMPLICIT_EXTERN_C.
!       return " -I${libio_src_dir} -I${libio_bin_dir}"
      } else {
        return ""
      }
*************** proc g++_include_flags { args } {
*** 225,247 ****
  
      set dir [lookfor_file ${srcdir} libg++]
      if { ${dir} != "" } {
!       append flags " -isystem ${dir} -isystem ${dir}/src"
      }
  
      set dir [lookfor_file ${srcdir} libstdc++-v3]
      if { ${dir} != "" } {
!       append flags " -isystem ${dir}/include -isystem ${dir}/include/std"
!       append flags " -isystem ${dir}/include/c_std -isystem ${dir}/libsupc++"
      }
  
      set dir [lookfor_file ${gccpath} libstdc++-v3]
      if { ${dir} != "" } {
!       append flags " -isystem ${dir}/include -isystem 
${dir}/include/${target_alias}"
      }
  
      set dir [lookfor_file ${srcdir} libstdc++]
      if { ${dir} != "" } {
!       append flags " -isystem ${dir} -isystem ${dir}/stl"
      }
  
      return "$flags"
--- 236,259 ----
  
      set dir [lookfor_file ${srcdir} libg++]
      if { ${dir} != "" } {
!       # See comment in libio_include_flags about using -I.
!       append flags " -I${dir} -I${dir}/src"
      }
  
      set dir [lookfor_file ${srcdir} libstdc++-v3]
      if { ${dir} != "" } {
!       append flags " -I${dir}/include -I${dir}/include/std"
!       append flags " -I${dir}/include/c_std -I${dir}/libsupc++"
      }
  
      set dir [lookfor_file ${gccpath} libstdc++-v3]
      if { ${dir} != "" } {
!       append flags " -I${dir}/include -I${dir}/include/${target_alias}"
      }
  
      set dir [lookfor_file ${srcdir} libstdc++]
      if { ${dir} != "" } {
!       append flags " -I${dir} -I${dir}/stl"
      }
  
      return "$flags"
*************** proc libstdc++_include_flags { args } {
*** 317,336 ****
  
      set dir [lookfor_file ${srcdir} libstdc++-v3]
      if { ${dir} != "" } {
!       append flags " -isystem ${dir}/include -isystem ${dir}/include/std"
!       append flags " -isystem ${dir}/include/c_std -isystem ${dir}/libsupc++"
      }
  
      set gccpath [get_multilibs]
  
      set dir [lookfor_file ${gccpath} libstdc++-v3]
      if { ${dir} != "" } {
!       append flags " -isystem ${dir}/include -isystem 
${dir}/include/${target_alias}"
      }
  
      set dir [lookfor_file ${srcdir} libstdc++]
      if { ${dir} != "" } {
!       append flags " -isystem ${dir} -isystem ${dir}/stl"
      }
  
      return "$flags"
--- 329,349 ----
  
      set dir [lookfor_file ${srcdir} libstdc++-v3]
      if { ${dir} != "" } {
!       # See comment in libio_include_flags about using -I.
!       append flags " -I${dir}/include -I${dir}/include/std"
!       append flags " -I${dir}/include/c_std -I${dir}/libsupc++"
      }
  
      set gccpath [get_multilibs]
  
      set dir [lookfor_file ${gccpath} libstdc++-v3]
      if { ${dir} != "" } {
!       append flags " -I${dir}/include -I${dir}/include/${target_alias}"
      }
  
      set dir [lookfor_file ${srcdir} libstdc++]
      if { ${dir} != "" } {
!       append flags " -I${dir} -I${dir}/stl"
      }
  
      return "$flags"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]