From 05e34102d4949a7992f836db13085a85dea7c82c Mon Sep 17 00:00:00 2001 From: Zeex Date: Tue, 7 Jan 2014 02:00:46 +0700 Subject: [PATCH] Don't generate automatic include guards They are useful most of the time but also a pain in the ass if you have multiple files with the same name but in different directories (e.g. YSI). Even worse, they didn't work with non-native directory separators in #include directives, but that actually turned out to be useful and helped defeat the first bug! See issue #6. --- source/compiler/sc2.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/source/compiler/sc2.c b/source/compiler/sc2.c index ee61984..0d5668d 100644 --- a/source/compiler/sc2.c +++ b/source/compiler/sc2.c @@ -231,7 +231,6 @@ static void check_empty(const unsigned char *lptr) static void doinclude(int silent) { char name[_MAX_PATH]; - char symname[sNAMEMAX]; char *ptr; char c; int i, result; @@ -262,27 +261,9 @@ static void doinclude(int silent) if (c!='\0') check_empty(lptr+1); /* verify that the rest of the line is whitespace */ - /* create a symbol from the name of the include file; this allows the system - * to test for multiple inclusions - */ - strcpy(symname,"_inc_"); - if ((ptr=strrchr(name,DIRSEP_CHAR))!=NULL) - strlcat(symname,ptr+1,sizeof symname); - else - strlcat(symname,name,sizeof symname); - if (find_symbol(&glbtab,symname,fcurrent,-1,NULL)==NULL) { - /* constant is not present, so this file has not been included yet */ - - /* Include files between "..." or without quotes are read from the current - * directory, or from a list of "include directories". Include files - * between <...> are only read from the list of include directories. - */ - result=plungefile(name,(c!='>'),TRUE); - if (result) - add_constant(symname,1,sGLOBAL,0); - else if (!silent) - error(100,name); /* cannot read from ... (fatal error) */ - } /* if */ + result=plungefile(name,(c!='>'),TRUE); + if (!result && !silent) + error(100,name); /* cannot read from ... (fatal error) */ } /* readline