[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison-1.875: build feedback
From: |
Nelson H. F. Beebe |
Subject: |
Re: bison-1.875: build feedback |
Date: |
Fri, 3 Jan 2003 13:20:23 -0700 (MST) |
Paul Eggert <address@hidden> reponds to my bison-1.875 bug report:
------------------------------------------------------------------------
>> ...
>> > c89 -mips3 -O2 -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I../src -I../lib
>> > -I/usr/local/include -g -c `test -f 'bitset.c' || echo './'`bitset.c
>> > cc-1116 c89: WARNING File = bitset.c, Line = 87
>> > Non-void function "bitset_init" (declared at line 68) should return a
>> value.
>>
>> It seems that your compiler does not know that abort () cannot return.
>> Or perhaps abort () can return on that platform, in some circumstances?
>> If so, is it possible that this would happen with Bison?
>> Otherwise I don't think it's worth worrying about.
>>
>> ...
Because library functions, including abort() and exit(), can be
redefined by users in the C and C++ programming languages, compilers
cannot strictly assume anything about them, unless they have been
remapped into compiler-specific intrinsic names (a practice used
extensively by gcc with its __attribute__ ((noreturn)) annotations).
For the function in question in bitset.c, one might rewrite it to
something like the immediately-preceding bitset_bytes() function that
avoids the question of whether abort() returns by moving the return
statements outside the switch statement.
>> ...
>> > cc-1515 c89: WARNING File = bitset.c, Line = 149
>> > A value of type "char *" cannot be assigned to an entity of type
>> > "bitset".
>>
>> Does the following patch fix this class of warnings?
>>
>> --- lib/obstack.h.~1.6.~ 2002-12-13 03:24:16.000000000 -0800
>> +++ lib/obstack.h 2003-01-03 06:47:53.263321000 -0800
>> @@ -123,8 +123,12 @@ extern "C" {
>> #endif
>>
>> #ifndef __INT_TO_PTR
>> +#if defined __STDC__ && __STDC__
>> +# define __INT_TO_PTR(P) ((void *) ((P) + (char *) 0))
>> +#else
>> # define __INT_TO_PTR(P) ((P) + (char *) 0)
>> #endif
>> +#endif
>>
>> ...
Yes, that patch did indeed remove that particular compiler warning.
> cc-1185 c89: WARNING File = location.h, Line = 43
> An enumerated type is mixed with another type.
>> ...
>>
>> I installed this patch to work around this class of problems.
>>
>> 2003-01-03 Paul Eggert <address@hidden>
>>
>> * lib/hash.c (_Bool, bool, false, true, __bool_true_false_are_defined):
>> Use the pattern recommended by Autoconf 2.57, except also protect
>> against double-definition.
>> * src/system.h: Likewise.
>>
>> --- lib/hash.c 28 Nov 2002 00:42:28 -0000 1.9
>> +++ lib/hash.c 3 Jan 2003 14:14:24 -0000 1.10
>> ...
>> ...
I applied that one too, and restarted the make again. The build is
now free of all of the "enumerated type is mixed with another type"
warnings.
The only warning remaining now is this one:
c89 -DHAVE_CONFIG_H -DPKGDATADIR=\"/usr/local/share/bison\"
-DLOCALEDIR=\"/usr/local/share/locale\" -I. -I. -I.. -I.. -I../lib
-I/usr/local/include -g -c `test -f 'state.c' || echo './'`state.c
cc-1116 c89: WARNING File = state.c, Line = 65
Non-void function "transitions_to" (declared at line 58) should return a
value.
}
^
That is another case where abort() is the last thing called.
If abort() is used a lot this way, then a wrapper function, e.g.,
bison_abort(), could be used to reduce the warning instances to just
one, with an echo statement before the compilation output to notify
the user that any such complaint is harmless.
-------------------------------------------------------------------------------
- Nelson H. F. Beebe Tel: +1 801 581 5254 -
- Center for Scientific Computing FAX: +1 801 581 4148 -
- University of Utah Internet e-mail: address@hidden -
- Department of Mathematics, 110 LCB address@hidden address@hidden -
- 155 S 1400 E RM 233 address@hidden -
- Salt Lake City, UT 84112-0090, USA URL: http://www.math.utah.edu/~beebe -
-------------------------------------------------------------------------------