public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/30439]  New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory
@ 2007-01-11 17:27 andersin at freenet dot de
  2007-01-11 17:29 ` [Bug c/30439] " andersin at freenet dot de
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: andersin at freenet dot de @ 2007-01-11 17:27 UTC (permalink / raw)
  To: gcc-bugs

Problem:
#include<signal.h> does not include /usr/include/signal.h (the library header)
if ./signal.h exists.

Expected Behavior:
If a file ./signal.h exists, #include<signal.h> includes /usr/include/signal.h
and #include "signal.h" includes ./signal.h

As far as I know, ANSI C states that #include<signal.h> includes only library
files and not user files (e.g. in the local directory).

Steps to Reproduce:
try to compile attached testcase

Additional Information:
gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /var/tmp/portage/gcc-4.1.1-r1/work/gcc-4.1.1/configure
--prefix=/usr --bindir=/usr/i686-pc-linux-gnu/gcc-bin/4.1.1
--includedir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
--datadir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1
--mandir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/man
--infodir=/usr/share/gcc-data/i686-pc-linux-gnu/4.1.1/info
--with-gxx-include-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include/g++-v4
--host=i686-pc-linux-gnu --build=i686-pc-linux-gnu --disable-altivec
--enable-nls --without-included-gettext --with-system-zlib --disable-checking
--disable-werror --disable-libunwind-exceptions --disable-multilib
--disable-libmudflap --disable-libssp --disable-libgcj --enable-languages=c,c++
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu
Thread model: posix
gcc version 4.1.1 (Gentoo 4.1.1-r1)


-- 
           Summary: Intended Behaviour? #include <signal.h> searches for
                    signal.h in local directory
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: andersin at freenet dot de
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
@ 2007-01-11 17:29 ` andersin at freenet dot de
  2007-01-11 17:31 ` andersin at freenet dot de
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andersin at freenet dot de @ 2007-01-11 17:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from andersin at freenet dot de  2007-01-11 17:29 -------
Created an attachment (id=12884)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12884&action=view)
testcase

Testcase:
if ./signal.h exists, it fails to compile, since sig_atomic_t is not defined.
If ./signal.h does not exist it works fine, since /usr/include/signal.h is
included.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
  2007-01-11 17:29 ` [Bug c/30439] " andersin at freenet dot de
@ 2007-01-11 17:31 ` andersin at freenet dot de
  2007-01-11 17:32 ` andersin at freenet dot de
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andersin at freenet dot de @ 2007-01-11 17:31 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from andersin at freenet dot de  2007-01-11 17:31 -------
Created an attachment (id=12885)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12885&action=view)
output on failure

output of gcc -v source.c if ./signal.h exists


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
  2007-01-11 17:29 ` [Bug c/30439] " andersin at freenet dot de
  2007-01-11 17:31 ` andersin at freenet dot de
@ 2007-01-11 17:32 ` andersin at freenet dot de
  2007-01-11 17:33 ` andersin at freenet dot de
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andersin at freenet dot de @ 2007-01-11 17:32 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from andersin at freenet dot de  2007-01-11 17:32 -------
Created an attachment (id=12886)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12886&action=view)
preprossesed source on error

Preprocessed source when ./signal.h exists and compiling fails


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
                   ` (2 preceding siblings ...)
  2007-01-11 17:32 ` andersin at freenet dot de
@ 2007-01-11 17:33 ` andersin at freenet dot de
  2007-01-11 17:33 ` andersin at freenet dot de
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andersin at freenet dot de @ 2007-01-11 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from andersin at freenet dot de  2007-01-11 17:33 -------
Created an attachment (id=12887)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12887&action=view)
output on success

Output when running gcc -v signal.c when ./signal.h is not present


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
                   ` (3 preceding siblings ...)
  2007-01-11 17:33 ` andersin at freenet dot de
@ 2007-01-11 17:33 ` andersin at freenet dot de
  2007-01-14  4:56 ` pinskia at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: andersin at freenet dot de @ 2007-01-11 17:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from andersin at freenet dot de  2007-01-11 17:33 -------
Created an attachment (id=12888)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12888&action=view)
preprossesed source on success

Preprocessed source when ./source.h is not present


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
                   ` (4 preceding siblings ...)
  2007-01-11 17:33 ` andersin at freenet dot de
@ 2007-01-14  4:56 ` pinskia at gcc dot gnu dot org
  2007-01-14 14:29 ` andersin at freenet dot de
  2007-01-14 18:21 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-14  4:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from pinskia at gcc dot gnu dot org  2007-01-14 04:56 -------
#include <...> search starts here:
 /home/cbs/local/include
 .
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/4.1.1/include
 /usr/include


----

Are you sure you don't have any of the following env variables set
(see http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Environment-Variables.html) :
CPATH
C_INCLUDE_PATH
CPLUS_INCLUDE_PATH
OBJC_INCLUDE_PATH


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
                   ` (5 preceding siblings ...)
  2007-01-14  4:56 ` pinskia at gcc dot gnu dot org
@ 2007-01-14 14:29 ` andersin at freenet dot de
  2007-01-14 18:21 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: andersin at freenet dot de @ 2007-01-14 14:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from andersin at freenet dot de  2007-01-14 14:28 -------
Your are correct, I have C_INCLUDE_PATH set (sorry I forgot to mention it). I
did not think it important, but it is. If C_INCLUDE_PATH ends with a colon,
compilation fails. Removing the colon is not a problem in general, but in my
special case it is happening because it is set up in my .bashrc like so:
export C_INCLUDE_PATH=/home/cbs/local/include:$C_INCLUDE_PATH, so I do  not see
a way of properly doing it save for checking if C_INCLUDE_PATH is empty before
adding to it.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

* [Bug c/30439] Intended Behaviour? #include <signal.h> searches for signal.h in local directory
  2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
                   ` (6 preceding siblings ...)
  2007-01-14 14:29 ` andersin at freenet dot de
@ 2007-01-14 18:21 ` pinskia at gcc dot gnu dot org
  7 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-01-14 18:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #8 from pinskia at gcc dot gnu dot org  2007-01-14 18:21 -------
"a:" means have a and the current directory.

So this is not a bug, C_INCLUDE_PATH acts just like PATH in that an empty
argument after the colon means the current directory.

>export C_INCLUDE_PATH=/home/cbs/local/include:$C_INCLUDE_PATH, so I do  not see
> a way of properly doing it save for checking if C_INCLUDE_PATH is empty before
> adding to it.

There are a bunches of way of checking if C_INCLUDE_PATH is set, like
$(?C_INCLUDE_PATH) I think will tell you if it is set or not.  This is not the
right forum to ask about shell programming really.


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30439


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-01-14 18:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-11 17:27 [Bug c/30439] New: Intended Behaviour? #include <signal.h> searches for signal.h in local directory andersin at freenet dot de
2007-01-11 17:29 ` [Bug c/30439] " andersin at freenet dot de
2007-01-11 17:31 ` andersin at freenet dot de
2007-01-11 17:32 ` andersin at freenet dot de
2007-01-11 17:33 ` andersin at freenet dot de
2007-01-11 17:33 ` andersin at freenet dot de
2007-01-14  4:56 ` pinskia at gcc dot gnu dot org
2007-01-14 14:29 ` andersin at freenet dot de
2007-01-14 18:21 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).