scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit a05cda6f2efb61fe4b42e43a2ee76f80492a4e27
parent 57ed804790202655d6ab2ee8f2dd3a6aac75b9b5
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Tue, 26 May 2015 09:30:09 +0200

Add predefined macros

C standard defines some predefined macros that are always
present in any implementation of the language. This version
of the compiler support:
	- __STDC__
	- __DATE__
	- __TIME__
	- __STDC_HOSTED__
	- __STDC_VERSION__
	- __LINE__
	- __FILE__

At this moment __STDC__ is 1, even when we are not 100%
compatible with the standard (and we don't want to be),
but in the majority of cases the small differencies are
not signigficatives, so it is more or less safe to
declare it. In the same way, __STDC_VERSION__ is set
to 199409L, that is the value for C90 with 94
ammendents.

Diffstat:
Mcc1/cpp.c | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/cc1/cpp.c b/cc1/cpp.c @@ -193,7 +193,7 @@ parsepars(char *buffer, char **listp, int nargs) * is the macro definition, where @dd@ indicates the * parameter number dd */ -#define BUFSIZE ((INPUTSIZ > FILENAME_MAX+5) ? INPUTSIZ : FILENAME_MAX+5) +#define BUFSIZE ((INPUTSIZ > FILENAME_MAX+2) ? INPUTSIZ : FILENAME_MAX+5) bool expand(Symbol *sym) { @@ -202,14 +202,14 @@ expand(Symbol *sym) char c, *bp, *arg, *s = sym->u.s; if (sym == symfile) { - sprintf(buffer, "-1#\"%s\"", getfname()); + sprintf(buffer, "\"%s\"", getfname()); strcpy(addinput(NULL, symfile), buffer); - return 0; + return 1; } if (sym == symline) { - sprintf(buffer, "-1#%d", getfline()); + sprintf(buffer, "%d", getfline()); strcpy(addinput(NULL, symline), buffer); - return 0; + return 1; } lastmacro = sym;