Issue Details (XML | Word | Printable)

Key: PCC-419
Type: Bug Bug
Status: Closed Closed
Resolution: Won't Fix
Priority: Major Major
Assignee: Iain Hibbert
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

files included from system-include files, need to be treated as system-include files

Created: 26/Mar/13 11:40 PM   Updated: 21/Apr/14 05:06 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386 (current sources as of March 2013)


 Description  « Hide
I found a problem compiling in NetBSD, where some symbols were being reported as duplicately defined, but gcc did not complain about this. I have narrowed this down to the following (somewhat environment dependent) example

#include <machine/limits.h>
#include <float.h>

and compiling this produces

% pcc -E -I/usr/src/sys foo.c | grep float
/usr/src/sys/sys/float_ieee754.h:78: warning: FLT_DIG redefined (previously defined at "/usr/include//machine/limits.h" line 86)
# 1 "/usr/include//float.h" 3
/usr/src/sys/sys/float_ieee754.h:80: warning: FLT_MIN redefined (previously defined at "/usr/include//machine/limits.h" line 88)
/usr/src/sys/sys/float_ieee754.h:83: warning: FLT_MAX redefined (previously defined at "/usr/include//machine/limits.h" line 87)
/usr/src/sys/sys/float_ieee754.h:88: warning: DBL_DIG redefined (previously defined at "/usr/include//machine/limits.h" line 82)
/usr/src/sys/sys/float_ieee754.h:90: warning: DBL_MIN redefined (previously defined at "/usr/include//machine/limits.h" line 84)
/usr/src/sys/sys/float_ieee754.h:93: warning: DBL_MAX redefined (previously defined at "/usr/include//machine/limits.h" line 83)
# 1 "/usr/include//x86/float.h" 3
# 1 "/usr/src/sys/sys/float_ieee754.h"
# 42 "/usr/src/sys/sys/float_ieee754.h"
# 43 "/usr/src/sys/sys/float_ieee754.h"
# 51 "/usr/src/sys/sys/float_ieee754.h"
# 53 "/usr/src/sys/sys/float_ieee754.h"
# 16 "/usr/include//x86/float.h" 3
# 3 "/usr/include//float.h" 3

and with gcc

% gcc -I /usr/src/sys/ -E foo.c | grep float
# 1 "/usr/include/float.h" 1 3 4
# 1 "/usr/include/x86/float.h" 1 3 4
# 16 "/usr/include/x86/float.h" 3 4
# 1 "/usr/src/sys/sys/float_ieee754.h" 1 3 4
# 42 "/usr/src/sys/sys/float_ieee754.h" 3 4
# 43 "/usr/src/sys/sys/float_ieee754.h" 2 3 4
# 44 "/usr/src/sys/sys/float_ieee754.h" 2 3 4
# 51 "/usr/src/sys/sys/float_ieee754.h" 3 4
# 51 "/usr/src/sys/sys/float_ieee754.h" 3 4
# 53 "/usr/src/sys/sys/float_ieee754.h" 3 4
# 53 "/usr/src/sys/sys/float_ieee754.h" 3 4
# 17 "/usr/include/x86/float.h" 2 3 4
# 3 "/usr/include/float.h" 2 3 4

as you can see, pcc produces an error but also the flags on the output indicate that the /usr/src/sys/sys/float_ieee754.h file which was included from /usr/include/float.h is treated by gcc as a system-include file (even though it was not in the system-include directories), therefore no error about duplicate symbols is produced, whereas with pcc the file is not treated that way, and a diagnostic is produced

I think this may have always been the case, but since I changed the front end to pass -Werror to cpp, this results in an error.

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Iain Hibbert made changes - 21/Apr/14 05:06 PM
Field Original Value New Value
Status Open [ 1 ] Closed [ 6 ]
Assignee Iain Hibbert [ plunky ]
Resolution Won't Fix [ 2 ]