Problem with "" vs <> headers and fixincludes

Douglas B Rupp rupp@adacore.com
Thu Jun 1 14:24:00 GMT 2017


This is a reproducer for a problem we have with fixincludes on 
vxworks6.6.  The desired output is
FOO= 1

The problem is the rules for handling headers enclosed in quotes can 
cause gcc to #include the original header not the patched header.

It seems like a problem that could theoretically occur on any target, so 
what is the solution (other than copying each and every header into 
include-fixed)?

--Douglas Rupp
AdaCore
=======================================================

test1.c:
-----------------
#include <stdio.h>
#include <foo.h>
void
main ()
{
    printf ("FOO= %d\n", FOO);
}


Header subdirs:
--------

h/foo.h:
#include "arch/x86.h"

h/arch/x86.h
#define FOO 0

include-fixed/h/

include-fixed/h/arch/x86.h
#define FOO 1


Execution
----------
$ gcc -c -Iinclude-fixed/h -Ih test1.c
$ gcc -o test1 test1.o
$ ./test1
FOO= 0



More information about the Gcc mailing list