chip@tct.UUCP (Chip Salzenberg) (08/14/90)
I like to include the stanard system header files from /usr/include in
my C++ programs. However, I get tired of having to bracket them with
'extern "C" {}' every time. I thus applied the following, very simple
change to cplus-lex.c. With this change, all filenames that begin
with the string STANDARD_INCLUDE ("/usr/include/" on my system) are
implicitly bracketed with 'extern "C"'.
Note that you must include an appropriate definition of STANDARD_INCLUDE
in your Makefile or in your configuration header file.
*** cplus-lex.c.Q Thu Jul 26 11:02:07 1990
--- cplus-lex.c Thu Aug 9 12:50:10 1990
***************
*** 2053,2056 ****
--- 2053,2061 ----
input_file_stack = p;
input_file_stack_tick++;
+ #ifdef STANDARD_INCLUDE
+ if (strncmp(p->name, STANDARD_INCLUDE,
+ sizeof(STANDARD_INCLUDE) - 1) == 0)
+ push_lang_context(lang_name_c);
+ #endif
}
else if (input_file_stack->next)
***************
*** 2057,2060 ****
--- 2062,2070 ----
{
struct file_stack *p = input_file_stack;
+ #ifdef STANDARD_INCLUDE
+ if (strncmp(p->name, STANDARD_INCLUDE,
+ sizeof(STANDARD_INCLUDE) - 1) == 0)
+ pop_lang_context();
+ #endif
input_file_stack = p->next;
free (p);