FreeBSD 10 clang port

This commit is contained in:
Ulrich Wilkens
2014-07-27 16:48:57 +02:00
committed by Jon Trulson
parent 8d0551bfda
commit c3f74eec17
99 changed files with 510 additions and 366 deletions

View File

@@ -40,26 +40,26 @@ XCOMM $TOG: DtInfo.rules /main/21 1997/09/05 11:31:01 samborn $
# define makelibT(libname) @@\
makelib(libname) @@\
@@\
libname/lib/**/libname/**/T.a: FRC @@\
Concat3(libname/lib,libname,T.a): FRC @@\
@(cd libname ; \ @@\
echo "### Making lib libname Templates ###" ; \ @@\
$(MAKE) lib/**/libname/**/T.a ; \ @@\
echo STR(*** Making lib libname Templates ***) ; \ @@\
$(MAKE) Concat3(lib,libname,T.a) ; \ @@\
)
# define makelibsubsubdir(subdir,libname) @@\
@@\
subdir/libname/lib/**/libname.a: FRC @@\
Concat(subdir/libname/lib,libname.a): FRC @@\
@(cd subdir ; \ @@\
echo "### Making lib libname ###" ; \ @@\
$(MAKE) libname/lib/**/libname.a ; \ @@\
echo STR(*** Making lib libname ***) ; \ @@\
$(MAKE) Concat(libname/lib,libname.a) ; \ @@\
)
# define makelibTsubsubdir(subdir,libname) @@\
@@\
subdir/libname/lib/**/libname/**/T.a: FRC @@\
Concat3(subdir/libname/lib,libname,T.a): FRC @@\
@(cd subdir ; \ @@\
echo "### Making lib libname Templates ###" ; \ @@\
$(MAKE) libname/lib/**/libname/**/T.a ; \ @@\
echo STR(*** Making lib libname Templates ***) ; \ @@\
$(MAKE) Concat3(libname/lib,libname,T.a) ; \ @@\
)
#else /* not defined(SunArchitecture) && CplusplusCompilerMajorVersion > 3 */
# define makelibT(libname) @@\
@@ -70,28 +70,28 @@ subdir/libname/lib/**/libname/**/T.a: FRC @@\
makelibd(libname,)
#define makelibd(libname, deps) @@\
libname/lib/**/libname.a: deps FRC @@\
Concat(libname/lib,libname.a): deps FRC @@\
@(cd libname; \ @@\
echo "### Making lib libname ###" ; \ @@\
$(MAKE) lib/**/libname.a ; \ @@\
if [ -d "$(TEMPLATE_DB)" ]; then \ @@\
$(MAKE) lib/**/libname/**/T.a ; \ @@\
fi \ @@\
echo STR(*** Making lib libname ***) ; \ @@\
$(MAKE) Concat(lib,libname.a) ; \ @@\
if [ -d "$(TEMPLATE_DB)" ]; then \ @@\
$(MAKE) Concat3(lib,libname,T.a) ; \ @@\
fi \ @@\
) @@\
libname/libname.d: libname/Classlist.mk @@\
@(cd libname; \ @@\
echo "### Making dfiles in libname ###" ; \ @@\
$(MAKE) libname.d ;\ @@\
echo STR(*** Making dfiles in libname ***) ; \ @@\
$(MAKE) libname.d ;\ @@\
) @@\
libname/libname.h: libname/Classlist.mk @@\
@(cd libname; \ @@\
echo "### Making dfiles in libname ###" ; \ @@\
$(MAKE) libname.h ;\ @@\
echo STR(*** Making dfiles in libname ***) ; \ @@\
$(MAKE) libname.h ;\ @@\
) @@\
libname/libname.msg: libname/Classlist.mk @@\
@(cd libname; \ @@\
echo "### Making msgs in libname ###" ; \ @@\
$(MAKE) libname.msg ;\ @@\
echo STR(*** Making msgs in libname ***) ; \ @@\
$(MAKE) libname.msg ;\ @@\
) @@\
@@\
FRC: @@\
@@ -149,7 +149,7 @@ AllTarget(Concat(lib,libname.a)) @@\
@@\
Concat(lib,libname.a): objlist @@\
$(RM) $@ @@\
@echo "### Making SimpleLibrary libname.a" @@\
@echo STR(*** Making SimpleLibrary libname.a) @@\
$(LD) -r -o $@ objlist
@@ -157,11 +157,11 @@ Concat(lib,libname.a): objlist @@\
#define SimpleLibraryT(libname,objlist,libdir) @@\
SimpleLibrary(libname,objlist,libdir) @@\
@@\
AllTarget(Concat(lib,libname/**/T.a)) @@\
AllTarget(Concat3(lib,libname,T.a)) @@\
@@\
Concat(lib,libname/**/T.a): @@\
Concat3(lib,libname,T.a): @@\
$(RM) $@ @@\
@echo "### Making SimpleLibraryT libname Templates" @@\
@echo STR(*** Making SimpleLibraryT libname Templates) @@\
find ./Templates.DB -name '*.o' -type f -print | xargs -n4 ar cq $@ @@\
@@\
clean:: @@\
@@ -170,11 +170,11 @@ clean:: @@\
#define SimpleLibraryT(libname,objlist,libdir) @@\
SimpleLibrary(libname,objlist,libdir) @@\
@@\
AllTarget(Concat(lib,libname/**/T.a)) @@\
AllTarget(Concat3(lib,libname,T.a)) @@\
@@\
Concat(lib,libname/**/T.a): TemplateObjs @@\
Concat3(lib,libname,T.a): TemplateObjs @@\
$(RM) $@ @@\
@echo "### Making SimpleLibraryT libname Templates" @@\
@echo STR(*** Making SimpleLibraryT libname Templates) @@\
$(AR) $@ TemplateObjs @@\
@@\
clean:: @@\
@@ -186,7 +186,7 @@ AllTarget(Concat(lib,libname.a)) @@\
@@\
Concat(lib,libname.a): objlist @@\
$(RM) $@ @@\
@echo "### Making RealLibrary libname.a" @@\
@echo STR(*** Making RealLibrary libname.a) @@\
ar cq $@ objlist @@\
RanLibrary($@)
@@ -195,18 +195,18 @@ AllTarget(Concat(lib,libname.a)) @@\
@@\
Concat(lib,libname.a): objlist otherdeps @@\
$(RM) $@ @@\
@echo "### Making NotSoSimpleLibrary libname.a" @@\
@echo STR(*** Making NotSoSimpleLibrary libname.a) @@\
$(LD) -r -o $@ objlist
#if defined(SunArchitecture) && CplusplusCompilerMajorVersion > 3
#define NotSoSimpleLibraryT(libname,objlist,libdir,otherdeps) @@\
NotSoSimpleLibrary(libname,objlist,libdir,otherdeps) @@\
@@\
AllTarget(Concat(lib,libname/**/T.a)) @@\
AllTarget(Concat3(lib,libname,T.a)) @@\
@@\
Concat(lib,libname/**/T.a): @@\
Concat3(lib,libname,T.a): @@\
$(RM) $@ @@\
@echo "### Making NotSoSimpleLibraryT libname Templates"@@\
@echo STR(*** Making NotSoSimpleLibraryT libname Templates) @@\
find ./Templates.DB -name '*.o' -type f -print | xargs -n4 ar cq $@ @@\
@@\
clean:: @@\
@@ -215,11 +215,11 @@ clean:: @@\
#define NotSoSimpleLibraryT(libname,objlist,libdir,otherdeps) @@\
NotSoSimpleLibrary(libname,objlist,libdir,otherdeps) @@\
@@\
AllTarget(Concat(lib,libname/**/T.a)) @@\
AllTarget(Concat3(lib,libname,T.a)) @@\
@@\
Concat(lib,libname/**/T.a): @@\
Concat3(lib,libname,T.a): @@\
$(RM) $@ @@\
@echo "### Making NotSoSimpleLibraryT libname Templates"@@\
@echo STR(*** Making NotSoSimpleLibraryT libname Templates) @@\
$(AR) $@ TemplateObjs @@\
@@\
clean:: @@\

View File

@@ -15,20 +15,33 @@ XCOMM platform: $TOG: FreeBSD.cf /main/21 1997/10/05 20:42:34 kaleb $
#ifndef OSTeenyVersion
#define OSTeenyVersion DefaultOSTeenyVersion
#endif
XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVersion)
XCOMM operating system: OSName (OSMajorVersion/**/./**/OSMinorVersion/**/./**/OSTeenyVersion)
#define HasPutenv YES
#define HasBSD44Sockets YES
#define HasZlib YES
#ifndef CppCmd
#if OSMajorVersion >= 5
#define CppCmd /usr/bin/cpp -traditional
#define PreProcessCmd /usr/bin/cpp -traditional
#else
#define CppCmd /usr/libexec/cpp -traditional
#define PreProcessCmd /usr/libexec/cpp -traditional
#if OSMajorVersion >= 10 && defined(UseGcc)
USE_GCC = UseGcc
#endif
#ifndef CppCmd
#if OSMajorVersion >= 10 && defined(UseGcc)
# define CppCmd /usr/local/bin/cpp$(USE_GCC)
#else
# define CppCmd /usr/bin/cpp
#endif
#endif
#define PreProcessCmd CppCmd
#if OSMajorVersion >= 10
#define CppArgs -Wno-invalid-pp-token
#else
#define CppArgs /**/
#endif
#ifndef StandardCppDefines
#define StandardCppDefines -traditional CppArgs
#endif
#undef InstallCmd
@@ -71,19 +84,33 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe
#define MkdirHierCmd mkdir -p
#ifndef CcCmd
#define CcCmd gcc
#ifndef DefaultCCOptions
#define DefaultCCOptions -pipe
#if OSMajorVersion >= 10
# if defined(UseGcc)
# define CcCmd /usr/local/bin/gcc$(USE_GCC)
# define CplusplusCmd /usr/local/bin/g++$(USE_GCC)
# else
# define CcCmd cc
# define CplusplusCmd c++
# endif
#else
# define CcCmd gcc
# define CplusplusCmd g++
#endif
#endif
#ifndef DefaultCCOptions
#define DefaultCCOptions -pipe
#endif
#ifndef CplusplusLibC
#define CplusplusLibC -lstdc++
#endif
#if OSMajorVersion > 1
#define ServerOSDefines XFree86ServerOSDefines -DDDXTIME
#define XawI18nDefines -DUSE_XWCHAR_STRING
#define HasMakefileSafeInclude YES
#define IncludeMakefile(file) @@# dependencies are in .depend
#define IncludeMakefile(file) HASH_SIGN dependencies are in .depend
#define DependFileName .depend
#if OSMajorVersion < 3
#if OSMinorVersion < 2
@@ -148,7 +175,7 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe
#endif
#ifndef OptimizedCDebugFlags
# ifdef i386Architecture
# if defined(i386Architecture) || defined(AMD64Architecture)
# define OptimizedCDebugFlags DefaultGcc2i386Opt
# else
# define OptimizedCDebugFlags -O2 -fno-strict-aliasing
@@ -156,11 +183,16 @@ XCOMM operating system: OSName (OSMajorVersion./**/OSMinorVersion./**/OSTeenyVe
#endif
#ifdef HasGcc2
CXXDEPENDINCLUDE != CppCmd -x c++ -Wp,-v < /dev/null \
2>&1 | sed -n 's/ \(.*[cg]++.*\)/-I\1/p'
CXXDEPENDINCLUDE != CcCmd -v -x c++ /dev/null -fsyntax-only \
2>&1 | sed -n 's/^ \(\/.*[cg]++.*\)/-I\1/p'
#define CplusplusDependIncludes $(CXXDEPENDINCLUDE)
#endif
/* beginning with svn version 254273 iconv functions are moved to libc */
#if (OSMajorVersion >= 10)
ICONVSYSLIB != if test -f /usr/local/include/iconv.h; then echo -liconv; else echo; fi
#endif
#define ServerExtraDefines GccGasOption XFree86ServerDefines
#define StandardDefines -DCSRG_BASED

View File

@@ -162,6 +162,9 @@ XCOMM rules: $TOG: Imake.rules /main/227 1998/02/02 12:07:57 kaleb $
* CppSourceFile (dst,src,defs,deplist)
* MakeDirectories (step,dirs)
* AllTarget (depends)
* MakeImakeDir ()
* DoUDB_SCRIPT3 (target, file, script, build)
* DoUDB_SCRIPT4 (target, file, script, build)
*
*
* The following are in specific <os>Lib.rules:
@@ -175,6 +178,16 @@ XCOMM rules: $TOG: Imake.rules /main/227 1998/02/02 12:07:57 kaleb $
#define NullParameter
/* stringify macro */
#ifndef STR
# if defined(__llvm__)
# define STR2(x) #x
# else
# define STR2(x) "x"
# endif
#define STR(x) STR2(x)
#endif
/* if [ -d ] or [ ! -d ] causes make to fail, define this as - */
#ifndef DirFailPrefix
#define DirFailPrefix
@@ -210,7 +223,7 @@ XCOMM special target for clearmake @@\
* Concat - concatenates two strings.
*/
#ifndef Concat
#if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
#if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
#define Concat(a,b)a##b
#else
#define Concat(a,b)a/**/b
@@ -221,7 +234,7 @@ XCOMM special target for clearmake @@\
* Concat3 - concatenates three strings.
*/
#ifndef Concat3
#if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
#if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
#define Concat3(a,b,c)a##b##c
#else
#define Concat3(a,b,c)a/**/b/**/c
@@ -232,7 +245,7 @@ XCOMM special target for clearmake @@\
* Concat4 - concatenates four strings.
*/
#ifndef Concat4
#if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
#if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
#define Concat4(a,b,c,d)a##b##c##d
#else
#define Concat4(a,b,c,d)a/**/b/**/c/**/d
@@ -262,7 +275,7 @@ XCOMM special target for clearmake @@\
* exists to avoid problems with some preprocessors
*/
#ifndef _XUseCat
# if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp)
# if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
# if defined(UseInstalled) || UseInstalledX11
# define _XUseCat(a,b,c) a##c
# else
@@ -2486,6 +2499,44 @@ step:: @@\
all:: depends
#endif /* AllTarget */
/*
* MakeImakeDir - call make in imake directory.
*/
#ifndef MakeImakeDir
#define MakeImakeDir() cd $(IMAKESRC) && \ @@\
if [ -f Makefile ]; then \ @@\
$(MAKE) $(MFLAGS) BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \ @@\
else \ @@\
$(MAKE) $(MFLAGS) -f Makefile.ini BOOTSTRAPCFLAGS="$(BOOTSTRAPCFLAGS)"; \ @@\
fi
#endif /* MakeImakeDir */
/*
* DoUDB_SCRIPT3 - macro for creation of udb scripts for installation
*/
#ifndef DoUDB_SCRIPT3
#define DoUDB_SCRIPT3(target, file, script, build) @@\
target:: $(DATABASE_DIR)/file.udb @@\
script -toLst -ReleaseStream $(PLATFORM) \ @@\
$(DATABASE_DIR)/file.udb > file.lst @@\
build file ../../..
#endif
/*
* DoUDB_SCRIPT4 - macro for creation of udb scripts for installation
*/
#ifndef DoUDB_SCRIPT4
#define DoUDB_SCRIPT4(target, file, script, build) @@\
target:: $(DATABASE_DIR)/file.udb @@\
script -toLst -ReleaseStream $(PLATFORM) \ @@\
$(DATABASE_DIR)/file.udb > file.lst @@\
build file ../../../..
#endif
#ifdef DefineOldLibraryRules
#include <oldlib.rules>
#endif

View File

@@ -22,6 +22,8 @@ XCOMM
#define YES 1
#define NO 0
#define HASH_SIGN #
/* Ensure that "all" is the default target in the Makefile. */
all::

View File

@@ -57,7 +57,7 @@ XCOMM $TOG: Motif.tmpl /main/6 1999/05/19 17:00:05 mgreess $
#endif
#ifndef _MUseCat
# if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
# if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
# if UseInstalledMotif
# define _MUseCat(a,b,c) a##c
# else

View File

@@ -305,6 +305,10 @@ CXXDEPENDINCLUDE != CppCmd -x c++ -Wp,-v < /dev/null \
# define SharedDtSvcReqs $(LDPRELIBS) SharedXReqs $(CXXLIB) -Wl,-rpath,$(USRLIBDIRPATH)
#endif
#ifndef SharedDtHelpReqs
# define SharedDtHelpReqs $(LDPRELIBS) $(ICONVSYSLIB) SharedXReqs -Wl,-rpath,$(USRLIBDIRPATH)
#endif
#ifndef SharedCsaReqs
# define SharedCsaReqs -lXt $(LDPOSTLIBS) -Wl,-rpath,$(USRLIBDIRPATH)
#endif

View File

@@ -30,6 +30,10 @@ XCOMM $XConsortium: bsdLib.tmpl /main/3 1996/09/28 16:09:25 rws $
# define SharedDtSvcReqs $(LDPRELIBS) SharedXReqs $(CXXLIB)
#endif
#ifndef SharedDtHelpReqs
# define SharedDtHelpReqs $(LDPRELIBS) $(ICONVSYSLIB) SharedXReqs
#endif
#ifndef SharedCsaReqs
# define SharedCsaReqs -lXt $(LDPOSTLIBS)
#endif

View File

@@ -12,7 +12,7 @@ XCOMM $XConsortium: cde.tmpl /main/2 1996/12/04 10:13:09 swick $
#endif
#ifndef _CUseCat
# if (defined(__STDC__) && !defined(UnixCpp)) || defined(AnsiCpp)
# if (__STDC__ && !defined(UnixCpp)) || defined(AnsiCpp) || defined(__llvm__)
# if UseInstalledCDE
# define _CUseCat(a,b,c) a##c
# else

View File

@@ -227,7 +227,7 @@ in this Software without prior written authorization from The Open Group.
* all colons). One way to tell if you need this is to see whether or not
* your Makefiles have no tabs in them and lots of @@ strings.
*/
#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || defined(sco) || (defined(AMOEBA) && defined(CROSS_COMPILE))
#if defined(sun) || defined(SYSV) || defined(SVR4) || defined(hcx) || defined(WIN32) || defined(sco) || defined(__llvm__) || (defined(AMOEBA) && defined(CROSS_COMPILE))
#define FIXUP_CPP_WHITESPACE
#endif
#ifdef WIN32
@@ -275,6 +275,9 @@ in this Software without prior written authorization from The Open Group.
|| (defined(__FreeBSD__) && defined(CPP_IN_LIBEXEC))
#define DEFAULT_CPP "/usr/libexec/cpp"
#endif
#if defined(__FreeBSD__) && (__FreeBSD__ >= 10) && !defined(__llvm__)
#undef DEFAULT_CPP
#endif
#if defined(__sgi) && defined(__ANSI_CPP__)
#define USE_CC_E
#endif
@@ -354,6 +357,11 @@ char *cpp_argv[ARGUMENTS] = {
# ifdef __GNUC__
"-traditional",
# endif
# ifdef __llvm__
"-fms-extensions",
"-Wno-invalid-token-paste",
"-Wno-invalid-pp-token",
# endif
#endif
#ifdef M4330
@@ -643,12 +651,18 @@ char *cpp_argv[ARGUMENTS] = {
# define DEFAULT_OS_MAJOR_REV "v V%[0-9]"
# define DEFAULT_OS_MINOR_REV "v V%*dL%[0-9]"
# define DEFAULT_OS_NAME "srvm %[^\n]"
#elif defined(__FreeBSD__) || defined(__NetBSD__)
#elif defined(__FreeBSD__)
/* uname -r returns "x.y[.z]-mumble", e.g. "9.0-RELEASE" or "11.0-CURRENT" */
# define DEFAULT_OS_MAJOR_REV "r %[0-9]"
# define DEFAULT_OS_MINOR_REV "r %*d.%[0-9]"
# define DEFAULT_OS_TEENY_REV "v %*s %*s %*s r%[0-9]"
# define DEFAULT_OS_NAME "srm %[^\n]"
#elif defined(__NetBSD__)
/* 386BSD, and BSD/OS too? */
/* uname -r returns "x.y[.z]-mumble", e.g. "2.1.5-RELEASE" or "2.2-0801SNAP" */
# define DEFAULT_OS_MAJOR_REV "r %[0-9]"
# define DEFAULT_OS_MINOR_REV "r %*d.%[0-9]"
# define DEFAULT_OS_TEENY_REV "r %*d.%*d.%[0-9]"
# define DEFAULT_OS_TEENY_REV "r %*d.%*d.%[0-9]"
# define DEFAULT_OS_NAME "srm %[^\n]"
#elif defined(__OpenBSD__)
# define DEFAULT_OS_MAJOR_REV "r %[0-9]"
@@ -747,9 +761,12 @@ struct symtab predefs[] = {
#ifdef mc68020
{"mc68020", "1"},
#endif
#ifdef __GNUC__
#if defined(__GNUC__) && !defined(linux)
{"__GNUC__", DEF_STRINGIFY(__GNUC__)},
#endif
#ifdef __GNUC_MINOR__
{"__GNUC_MINOR__", DEF_STRINGIFY(__GNUC_MINOR__)},
#endif
#if __STDC__
{"__STDC__", "1"},
#endif

View File

@@ -216,6 +216,7 @@ my_eval_variable (ip, var, len)
const char *var;
int len;
{
long val;
struct symtab **s;
s = lookup_variable (ip, var, len);
@@ -223,12 +224,14 @@ my_eval_variable (ip, var, len)
return 0;
do {
var = (*s)->s_value;
if (!isvarfirstletter(*var))
if (!isvarfirstletter(*var) || !strcmp((*s)->s_name, var))
break;
s = lookup_variable (ip, var, strlen(var));
} while (s);
return strtol(var, NULL, 0);
var = ParseIfExpression(ip, var, &val);
if (var && *var) debug(4, ("extraneous: '%s'\n", var));
return val;
}

View File

@@ -81,6 +81,7 @@
#include "ifparser.h"
#include <ctype.h>
#include <limits.h>
/****************************************************************************
Internal Macros and Utilities for Parser
@@ -116,19 +117,48 @@ parse_number (g, cp, valp)
const char *cp;
long *valp;
{
long base = 10;
SKIPSPACE (cp);
if (!isdigit(*cp))
return CALLFUNC(g, handle_error) (g, cp, "number");
*valp = strtol(cp, &cp, 0);
/* skip trailing qualifiers */
*valp = 0;
if (*cp == '0') {
cp++;
if ((*cp == 'x') || (*cp == 'X')) {
base = 16;
cp++;
} else {
base = 8;
}
}
/* Ignore overflows and assume ASCII, what source is usually written in */
while (1) {
int increment = -1;
if (base == 8) {
if ((*cp >= '0') && (*cp <= '7'))
increment = *cp++ - '0';
} else if (base == 16) {
if ((*cp >= '0') && (*cp <= '9'))
increment = *cp++ - '0';
else if ((*cp >= 'A') && (*cp <= 'F'))
increment = *cp++ - ('A' - 10);
else if ((*cp >= 'a') && (*cp <= 'f'))
increment = *cp++ - ('a' - 10);
} else { /* Decimal */
if ((*cp >= '0') && (*cp <= '9'))
increment = *cp++ - '0';
}
if (increment < 0)
break;
*valp = (*valp * base) + increment;
}
/* Skip trailing qualifiers */
while (*cp == 'U' || *cp == 'u' || *cp == 'L' || *cp == 'l') cp++;
#if 0
*valp = atoi (cp);
/* EMPTY */
for (cp++; isdigit(*cp); cp++) ;
#endif
return cp;
}
@@ -272,7 +302,10 @@ parse_product (g, cp, valp)
case '/':
DO (cp = parse_product (g, cp + 1, &rightval));
*valp = (*valp / rightval);
if (rightval)
*valp = (*valp / rightval);
else
*valp = LONG_MAX;
break;
case '%':

View File

@@ -255,6 +255,17 @@ main(argc, argv)
argc--;
}
break;
case 'i':
if (strncmp(argv[0]+2, "system", 6) == 0) {
if (incp >= includedirs + MAXDIRS)
fatalerr("Too many -I flags.\n");
*incp++ = argv[0]+8;
if (**(incp-1) == '\0') {
*(incp-1) = *(++argv);
argc--;
}
}
break;
case 'Y':
defincdir = argv[0]+2;
break;

View File

@@ -110,7 +110,7 @@ int deftype (line, filep, file_red, file, parse_it)
int parse_it;
{
register char *p;
char *directive, savechar;
char *directive, savechar, *q;
register int ret;
/*
@@ -167,6 +167,11 @@ int deftype (line, filep, file_red, file, parse_it)
*/
while (*p == ' ' || *p == '\t')
p++;
q = p + strlen(p);
do {
q--;
} while (*q == ' ' || *q == '\t');
q[1] = '\0';
switch (ret) {
case IF:
/*
@@ -227,7 +232,7 @@ int deftype (line, filep, file_red, file, parse_it)
/*
* copy the definition back to the beginning of the line.
*/
strcpy (line, p);
memmove (line, p, strlen(p) + 1);
break;
case ELSE:
case ENDIF: