Subject: Re: bin/14779: usr.sbin/config generates bogus flags on
To: None <itojun@itojun.org>
From: None <cgd@broadcom.com>
List: netbsd-bugs
Date: 11/29/2001 19:10:35
itojun@itojun.org writes:
> usr.sbin/config generates bogus flags (NFOO) when "needs-flag" is
> specified on a line in sys/conf/files, and there are conditionals
> used on the kernel configuration file.
Whether or not that's the way it 'should' work, that _is_ the way
config has historically worked...
> if you run usr.sbin/config, faith.h and stf.h will contain the
> following:
>
> #define NFAITH 1
> #define NINET 1
> #define NINET6 1
>
> #define NSTF 1
> #define NINET 1
> #define NINET6 1
>
> it should have generated the first line only.
>
> the "NINET" and "NINET6" symbols will lead to duplicated symbol
> definitions when compiling kernels.
Why?
As long as you #define a macro to the same exact value, you don't get
a warning about duplicated macro definitions.
If you're defining them to _different_ values in the same kernel, uh,
something really is probably wrong.
6 [nb15] tmp % cat > bar.c
#define FOO 1
7 [nb15] tmp % cat bar.c bar.c > baz.c
8 [nb15] tmp % gcc -v
Using builtin specs.
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
9 [nb15] tmp % gcc baz.c
/usr/lib/crt0.o: In function `___start':
/usr/lib/crt0.o(.text+0xc1): undefined reference to `main'
collect2: ld returned 1 exit status
(i.e., no compiler warning or error), and same for later version of
gcc up to and including 3.0.1 AFAICT.
Note that if you do:
10 [nb15] tmp % cat > lose.c
#define FOO 1
#define FOO 2
11 [nb15] tmp % gcc !$
gcc lose.c
lose.c:2: warning: `FOO' redefined
lose.c:1: warning: this is the location of the previous definition
/usr/lib/crt0.o: In function `___start':
/usr/lib/crt0.o(.text+0xc1): undefined reference to `main'
collect2: ld returned 1 exit status
you do get your warning.
cgd