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

Reply via email to