Consider these two minimal files:
p1.c:
#define _GNU_SOURCE
#include <sys/select.h>

p2.c:
#include <sys/types.h>

They compile just fine by themselves.

Now trying --combine:
$ gcc --combine -c p1.c p2.c
In file included from /usr/include/sys/types.h:220,
                 from p2.c:1:
/usr/include/sys/select.h:109: error: conflicting types for ‘select’
/usr/include/sys/select.h:109: error: previous declaration of ‘select’ was here
/usr/include/sys/select.h:121: error: conflicting types for ‘pselect’
/usr/include/sys/select.h:121: error: previous declaration of ‘pselect’ was
here

Of course the prototype is different with _GNU_SOURCE vs. non _GNU_SOURCE, but
why does --combine care?

$ gcc -v
Using built-in specs.
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.1-9'
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.3.1 (Debian 4.3.1-9)


-- 
           Summary: --combine problems with one source defining _GNU_SOURCE
                    and the other one doesn't
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: edwintorok at gmail dot com
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


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

Reply via email to