<< Back to previous view

[PCC-61] Include dir order not right Created: 07/Jun/09  Updated: 01/May/14

Status: Closed
Project: pcc
Component/s: C frontend
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: Mattias Pantzare Assignee: Unassigned
Resolution: Fixed Votes: 0


 Description   
The system include dir will be searched before the compiler include dir.

On OS X the system stdarg.h will not work with PCC, but the one provided with pcc will. But the default is to use the system stdarg.h.

Changing the order from:

av[na++] = "-S", av[na++] = altincdir;
av[na++] = "-S", av[na++] = incdir;
av[na++] = "-S", av[na++] = pccincdir;

to:

av[na++] = "-S", av[na++] = altincdir;
av[na++] = "-S", av[na++] = pccincdir;
av[na++] = "-S", av[na++] = incdir;

fixed the problem for me.

 Comments   
Comment by Anders Magnusson [ 07/Jun/09 01:55 PM ]
Sounds sane from my POV, but I don't know side effects on other OSes. Greg?
Comment by Gregory McGarry [ 09/Jun/09 01:53 PM ]
The current behaviour is correct. The current order is:

/usr/local/include/pcc
/usr/include
/usr/local/lib/pcc/powerpc-apple-darwin8.11.0/0.9.9/include/

It's impossible to design headers which will work on all operating systems. stddef.h is a particular problem. The libpcc headers are for systems which don't provide them. For systems which provide broken headers, then they have to be modified and placed in /usr/local/include/pcc to override the system headers.

I know that OS X mostly works okay with the include path order reversed. But it's not true on most of the other systems.

Maybe one day there will be a fixincludes script which can correctly merge the system headers with libpcc headers.
Comment by Anders Magnusson [ 08/Aug/09 09:49 AM ]
Hm, would it make sense to have something like
#ifdef OSX
  include other way
#else
  include as always
#endif

??
Comment by Gregory McGarry [ 08/Aug/09 12:24 PM ]
We could have include directories like this:

/usr/local/lib/pcc/powerpc-apple-darwin8.11.0/0.9.9/include/pre
/usr/include
/usr/local/lib/pcc/powerpc-apple-darwin8.11.0/0.9.9/include/post

We could use symlinks to ensure that some headers override the systems headers and other headers are available as default headers.

But I don't think we should make the behaviour different on different systems.
Comment by Anders Magnusson [ 01/May/14 03:59 PM ]
This seems to have been fixed in the time being.
Generated at Thu Jul 10 11:41:35 CEST 2014 using JIRA Enterprise Edition, Version: 3.13.1-#333.