diff options
Diffstat (limited to 'usr/src/lib/libpp')
38 files changed, 179 insertions, 141 deletions
diff --git a/usr/src/lib/libpp/Makefile b/usr/src/lib/libpp/Makefile index 4091cfcbbf..30cbb5e49f 100644 --- a/usr/src/lib/libpp/Makefile +++ b/usr/src/lib/libpp/Makefile @@ -19,13 +19,11 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -SHELL=/usr/bin/ksh +SHELL=/usr/bin/ksh93 include ../Makefile.lib diff --git a/usr/src/lib/libpp/Makefile.com b/usr/src/lib/libpp/Makefile.com index f9a16b9af1..8ed741ebdf 100644 --- a/usr/src/lib/libpp/Makefile.com +++ b/usr/src/lib/libpp/Makefile.com @@ -19,13 +19,11 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# -SHELL=/usr/bin/ksh +SHELL=/usr/bin/ksh93 LIBRARY= libpp.a VERS= .1 @@ -64,11 +62,15 @@ include ../../Makefile.lib # automated code updates easier. MAPFILES= ../mapfile-vers -# Set common AST build flags (e.g., needed to support the math stuff). +# Set common AST build flags (e.g. C99/XPG6, needed to support the math stuff) include ../../../Makefile.ast LIBS = $(DYNLIB) $(LINTLIB) -LDLIBS += -last -lc + +LDLIBS += \ + -last \ + -lc + $(LINTLIB) := SRCS = $(SRCDIR)/$(LINTSRC) SRCDIR = ../common @@ -85,16 +87,15 @@ CPPFLAGS = \ -D_PACKAGE_ast \ '-DUSAGE_LICENSE=\ "[-author?Glenn Fowler <gsf@research.att.com>]"\ - "[-copyright?Copyright (c) 1986-2007 AT&T Knowledge Ventures]"\ + "[-copyright?Copyright (c) 1986-2008 AT&T Intellectual Property]"\ "[-license?http://www.opensource.org/licenses/cpl1.0.txt]"\ "[--catalog?libpp]"' + CFLAGS += \ - $(CCVERBOSE) \ - -xstrconst + $(ASTCFLAGS) CFLAGS64 += \ - $(CCVERBOSE) \ - -xstrconst + $(ASTCFLAGS64) pics/ppcall.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED pics/ppcontrol.o := CERRWARN += -erroff=E_INTEGER_OVERFLOW_DETECTED @@ -116,6 +117,5 @@ all: $(LIBS) # lint: @ print "usr/src/lib/libpp is not lint-clean: skipping" - @ $(TRUE) include ../../Makefile.targ diff --git a/usr/src/lib/libpp/common/RELEASE b/usr/src/lib/libpp/common/RELEASE index 179930e147..80a3c89a48 100644 --- a/usr/src/lib/libpp/common/RELEASE +++ b/usr/src/lib/libpp/common/RELEASE @@ -1,3 +1,11 @@ +08-05-11 ppproto.c: fix proto test 10 regression +07-09-21 ppproto.c: add "Public Domain" to the noticed list +07-08-11 probe.win32: add cl.exe setuid workaround, CC.VERSION[.STRING] +07-06-12 pplex.c: finish -D:preserve logic update for imake +07-06-07 pplex.c: handle -D:preserve S_CHRB splices +07-06-04 ppsearch.c: only apply pp:chop ?old?new? if original not found +07-03-11 add -D-Y pp:pedantic, PP_WARN macro formal parenthesis checks +07-01-26 pp.def,probe.win32: add _WCHAR_T_DEFINED 06-09-23 ppop.c: check -I <dev,ino> for c and TYPE_HOSTED|TYPE_VENDOR attrs 06-09-23 pplex.c: add HOSTED check for "/* appears in // comment" -- doh 06-09-05 pp.probe: add version stamp comment diff --git a/usr/src/lib/libpp/common/gentab.sh b/usr/src/lib/libpp/common/gentab.sh index 0234ce6c93..d843868970 100644 --- a/usr/src/lib/libpp/common/gentab.sh +++ b/usr/src/lib/libpp/common/gentab.sh @@ -1,10 +1,10 @@ ######################################################################## # # # This software is part of the ast package # -# Copyright (c) 1986-2007 AT&T Knowledge Ventures # +# Copyright (c) 1986-2008 AT&T Intellectual Property # # and is licensed under the # # Common Public License, Version 1.0 # -# by AT&T Knowledge Ventures # +# by AT&T Intellectual Property # # # # A copy of the License is available at # # http://www.opensource.org/licenses/cpl1.0.txt # diff --git a/usr/src/lib/libpp/common/llib-lpp b/usr/src/lib/libpp/common/llib-lpp index d3df1ce176..5d49fc1b83 100644 --- a/usr/src/lib/libpp/common/llib-lpp +++ b/usr/src/lib/libpp/common/llib-lpp @@ -18,36 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * lib/libpp/common/llib-lpp - * */ -#pragma ident "%Z%%M% %I% %E% SMI" - /*LINTLIBRARY*/ /*PROTOLIB1*/ #include "pp.h" - -/* automatically generated data start here */ -extern struct ppglobals pp; -extern char ppctype[]; -extern int ppargs(char**, int); -extern void ppcpp(void); -extern void ppcomment(char*, char*, char*, int); -extern void* ppcontext(void*, int); -extern void pperror(int, ...); -extern void ppincref(char*, char*, int, int); -extern void ppinput(char*, char*, int); -extern int pplex(void); -extern void ppline(int, char*); -extern void ppmacref(struct ppsymbol*, char*, int, int, unsigned long); -extern void ppop(int, ...); -extern void pppragma(char*, char*, char*, char*, int); -extern int ppprintf(char*, ...); -extern int ppsync(void); -/* end of automatically generated data */ diff --git a/usr/src/lib/libpp/common/pp.def b/usr/src/lib/libpp/common/pp.def index f2d679f3af..f44dac94a5 100644 --- a/usr/src/lib/libpp/common/pp.def +++ b/usr/src/lib/libpp/common/pp.def @@ -1,7 +1,7 @@ # # list of known old cpp predefined symbols # -# @(#)pp.def (gsf@research.att.com) 2002-11-26 +# @(#)pp.def (gsf@research.att.com) 2007-01-26 # # symbols will be tested for the common `_' permutations # qualifiers may be combinations of @@ -160,6 +160,7 @@ VAX :architecture: VAX11C :vendor: VAXC :vendor: VMS :system: +WCHAR_T_DEFINED WCHAR_TYPE WIN32 :release: X86 :architecture: diff --git a/usr/src/lib/libpp/common/pp.h b/usr/src/lib/libpp/common/pp.h index 2b91c8e435..08eee17b16 100644 --- a/usr/src/lib/libpp/common/pp.h +++ b/usr/src/lib/libpp/common/pp.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -68,7 +68,7 @@ #define PPBUFSIZ (32*PPBLKSIZ) /* io buffer size */ #define PPTOKSIZ ((PPBUFSIZ/2)-1) /* max token size */ -#define PPWRITE(n) do{if(write(1,pp.outbuf,n)!=(n))pperror(ERROR_SYSTEM|3,"%s: write error",pp.outfile);pp.offset+=(n);pp.lastout=pp.outbuf[n-1];}while(0) +#define PPWRITE(n) do{if(write(1,pp.outbuf,n)!=(n))pperror(ERROR_SYSTEM|3,"%s: write error",pp.outfile);pp.offset+=(n);pp.lastout=pp.outbuf[(n)-1];}while(0) #define pplastout() ((pp.outp>pp.outbuf)?*(pp.outp-1):pp.lastout) #define ppoffset() (pp.offset+pppendout()) diff --git a/usr/src/lib/libpp/common/ppargs.c b/usr/src/lib/libpp/common/ppargs.c index 0aaff3905e..52da340da3 100644 --- a/usr/src/lib/libpp/common/ppargs.c +++ b/usr/src/lib/libpp/common/ppargs.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -27,7 +27,7 @@ */ static const char usage[] = -"[-?\n@(#)$Id: cpp (AT&T Research) 2006-01-11 $\n]" +"[-?\n@(#)$Id: cpp (AT&T Research) 2007-03-11 $\n]" USAGE_LICENSE "[+NAME?cpp - C language preprocessor]" "[+DESCRIPTION?\bcpp\b is the preprocessor for all C language dialects. It is" @@ -80,9 +80,11 @@ USAGE_LICENSE " or the default ISO).]" " [+-D-T\atest\a, \bpp::test\b \atest\a?Enable implementation specific" " test code according to \atest\a.]" -" [+-D-W, pp::warn?Enable pedantic warnings in non-hosted files.]" +" [+-D-W, pp::warn?Enable warnings in non-hosted files.]" " [+-D-X\b[\acc\a]]?Preprocess for the compiler \acc\a which must be" " an executable path or an executable on \b$PATH\b.]" +" [+-D-Y, pp::pedantic?Enable pedantic \bpp::warn\b warnings in" +" non-hosted files.]" " [+-D-Z, pp::pool?Enable pool mode. See \blibpp\b(3).]" " [+-D-d?List canonicalized \b#define\b statements for non-predefined" " macros in the output. ]" @@ -271,6 +273,9 @@ ppargs(char** argv, int last) case 'X': ppop(PP_PROBE, n && *s ? s : 0); goto hasarg; + case 'Y': + ppop(PP_PEDANTIC, n); + break; case 'Z': ppop(PP_POOL, n); break; diff --git a/usr/src/lib/libpp/common/ppbuiltin.c b/usr/src/lib/libpp/common/ppbuiltin.c index b9a906f657..4e58af0251 100644 --- a/usr/src/lib/libpp/common/ppbuiltin.c +++ b/usr/src/lib/libpp/common/ppbuiltin.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -46,6 +46,7 @@ ppbuiltin(void) char* token; char* t; long number; + long onumber; struct ppinstk* in; struct pplist* list; struct ppsymbol* sym; @@ -279,7 +280,7 @@ ppbuiltin(void) #define BACK(a,p) ((a>p)?*--a:(number++?0:((p=pp.outbuf+PPBUFSIZ),(a=pp.outbuf+2*PPBUFSIZ),*--a))) #define PEEK(a,p) ((a>p)?*(a-1):(number?0:*(pp.outbuf+2*PPBUFSIZ-1))) - number = pp.outbuf == pp.outb; + number = pp.outbuf != pp.outb; a = pp.outp; p = pp.outb; op = 0; @@ -327,14 +328,21 @@ ppbuiltin(void) { if (ppisidig(c)) { - for (t = p, token = a; ppisidig(PEEK(a, p)); a--); - for (p = pp.valbuf + 1; a <= token; *p++ = *a++); + for (t = p, token = a, onumber = number; ppisidig(PEEK(a, p)) && a >= p; BACK(a, p)); + p = pp.valbuf + 1; + if (a > token) + { + for (; a < pp.outbuf+2*PPBUFSIZ; *p++ = *a++); + a = pp.outbuf; + } + for (; a <= token; *p++ = *a++); *p = 0; p = pp.valbuf + 1; if (streq(p, "for") || streq(p, "if") || streq(p, "switch") || streq(p, "while")) { op = 0; p = t; + number = onumber; continue; } } @@ -344,7 +352,7 @@ ppbuiltin(void) } } if (op == 3) - strncpy(pp.funbuf, p, sizeof(pp.funbuf) - 1); + p = strncpy(pp.funbuf, p, sizeof(pp.funbuf) - 1); else if (*pp.funbuf) p = pp.funbuf; else diff --git a/usr/src/lib/libpp/common/ppcall.c b/usr/src/lib/libpp/common/ppcall.c index 8e273dc92f..b06a5961f9 100644 --- a/usr/src/lib/libpp/common/ppcall.c +++ b/usr/src/lib/libpp/common/ppcall.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppcomment.c b/usr/src/lib/libpp/common/ppcomment.c index c938bc2e67..75e5f1e843 100644 --- a/usr/src/lib/libpp/common/ppcomment.c +++ b/usr/src/lib/libpp/common/ppcomment.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppcontext.c b/usr/src/lib/libpp/common/ppcontext.c index 220481ab87..7bba261a5f 100644 --- a/usr/src/lib/libpp/common/ppcontext.c +++ b/usr/src/lib/libpp/common/ppcontext.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppcontrol.c b/usr/src/lib/libpp/common/ppcontrol.c index a5d9974927..fff96641f3 100644 --- a/usr/src/lib/libpp/common/ppcontrol.c +++ b/usr/src/lib/libpp/common/ppcontrol.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -907,6 +907,24 @@ ppcontrol(void) #endif *p++ = (n1 || var.type == TOK_TOKCAT) ? 'C' : 'A'; *p++ = c + ARGOFFSET; + if ((pp.state & WARN) && !(pp.mode & (HOSTED|RELAX)) && var.type != TOK_TOKCAT && !(var.type & TOK_ID)) + { + s = pp.in->nextchr; + while ((c = *s++) && (c == ' ' || c == '\t')); + if (c == '\n') + c = 0; + else if (c == '*' && *s == ')') + c = ')'; + else if (c == '=' || ppisidig(c) || c == *s || *s == '=') + c = 0; + if (o != '.' && o != T_PTRMEM) + { + if ((var.type & TOK_ID) || o == ' ' || ppisseparate(o)) + o = 0; + if (!((o == 0 || o == '(' || o == ')' || o == '[' || o == ']' || o == ',' || o == '|' || o == ';' || o == '{' || o == '}') && (c == '(' || c == ')' || c == '[' || c == ']' || c == ',' || c == '|' || c == ';' || c == '}' || c == 0)) && !(o == '*' && c == ')')) + error(1, "%s: %s: formal should be parenthesized in macro value (t=%x o=%#c c=%#c)", sym->name, pp.token, var.type, o, c); + } + } var.type = TOK_FORMAL|TOK_ID; c = '>'; goto checkvalue; @@ -1621,7 +1639,7 @@ ppcontrol(void) } if (!p1 && p3 && (p4 - p3) == 4 && strneq(p3, "STDC", 4)) goto pass; - if ((pp.state & WARN) && !(pp.mode & (HOSTED|RELAX))) + if ((pp.state & WARN) && (pp.mode & (HOSTED|RELAX|PEDANTIC)) == PEDANTIC) error(1, "#%s: non-standard directive", dirname(PRAGMA)); i0 = !p3 || *p3 != 'n' || *(p3 + 1) != 'o'; if (!p3) diff --git a/usr/src/lib/libpp/common/ppcpp.c b/usr/src/lib/libpp/common/ppcpp.c index 23e3fe7541..e9bdae545a 100644 --- a/usr/src/lib/libpp/common/ppcpp.c +++ b/usr/src/lib/libpp/common/ppcpp.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppdata.c b/usr/src/lib/libpp/common/ppdata.c index 4c15eaf940..555773e334 100644 --- a/usr/src/lib/libpp/common/ppdata.c +++ b/usr/src/lib/libpp/common/ppdata.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -48,7 +48,7 @@ * only within macro bodies */ -static const char id[] = "\n@(#)$Id: libpp (AT&T Research) 2006-11-23 $\0\n"; +static const char id[] = "\n@(#)$Id: libpp (AT&T Research) 2007-06-12 $\0\n"; #include "pplib.h" diff --git a/usr/src/lib/libpp/common/pperror.c b/usr/src/lib/libpp/common/pperror.c index 46f7442ec7..e7f575a908 100644 --- a/usr/src/lib/libpp/common/pperror.c +++ b/usr/src/lib/libpp/common/pperror.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppexpr.c b/usr/src/lib/libpp/common/ppexpr.c index 5fd93afde5..219b707cb5 100644 --- a/usr/src/lib/libpp/common/ppexpr.c +++ b/usr/src/lib/libpp/common/ppexpr.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppfsm.c b/usr/src/lib/libpp/common/ppfsm.c index 5cef65db2a..42a7f4ef1a 100644 --- a/usr/src/lib/libpp/common/ppfsm.c +++ b/usr/src/lib/libpp/common/ppfsm.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppfsm.h b/usr/src/lib/libpp/common/ppfsm.h index 1aff931d2b..ac471e0e80 100644 --- a/usr/src/lib/libpp/common/ppfsm.h +++ b/usr/src/lib/libpp/common/ppfsm.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppincref.c b/usr/src/lib/libpp/common/ppincref.c index 336940bb12..5d4362cb9d 100644 --- a/usr/src/lib/libpp/common/ppincref.c +++ b/usr/src/lib/libpp/common/ppincref.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppinput.c b/usr/src/lib/libpp/common/ppinput.c index 170e5f5dca..0fac34d9e1 100644 --- a/usr/src/lib/libpp/common/ppinput.c +++ b/usr/src/lib/libpp/common/ppinput.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppkey.c b/usr/src/lib/libpp/common/ppkey.c index 6dfe481cc4..8bb10531fd 100644 --- a/usr/src/lib/libpp/common/ppkey.c +++ b/usr/src/lib/libpp/common/ppkey.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppkey.h b/usr/src/lib/libpp/common/ppkey.h index 95f89e52c1..d87543fed2 100644 --- a/usr/src/lib/libpp/common/ppkey.h +++ b/usr/src/lib/libpp/common/ppkey.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/pplex.c b/usr/src/lib/libpp/common/pplex.c index 364854d8ae..a421393b60 100644 --- a/usr/src/lib/libpp/common/pplex.c +++ b/usr/src/lib/libpp/common/pplex.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -234,7 +234,7 @@ ppcpp(void) { ip = bp; #if CPP - if (op == tp && (st & (ADD|HIDDEN)) && !(st & PASSTHROUGH)) + if (op == tp && (st & (ADD|HIDDEN)) && !(st & PASSTHROUGH) && !(pp.option & PRESERVE)) switch (TERM(state)) { case S_SHARP: @@ -245,6 +245,8 @@ ppcpp(void) break; /*FALLTHROUGH*/ default: + if ((pp.option & PRESERVE) && !(st & NEWLINE) && c != '\n') + break; PPSYNCLINE(); tp = op; break; @@ -918,7 +920,7 @@ ppcpp(void) goto fsm_get; } #if CPP - if (st & PASSTHROUGH) + if ((st & PASSTHROUGH) || (pp.option & PRESERVE)) { if (c == '\n') goto fsm_newline; bp = ip; @@ -1121,7 +1123,10 @@ ppcpp(void) #if CPP if (n && !(st & (PASSTHROUGH|SKIPCONTROL|NOTEXT)) && c == '\'' && (op - tp) <= 2 && !(pp.mode & (HOSTED|RELAX))) error(1, "empty character constant"); - st &= ~(ESCAPE|NEWLINE); + if (pp.option & PRESERVE) + st &= ~ESCAPE; + else + st &= ~(ESCAPE|NEWLINE); pp.in->flags |= IN_tokens; count(token); goto fsm_start; @@ -1787,7 +1792,7 @@ ppcpp(void) case S_NL: #if CPP - if (op == tp && !(st & JOINING) && pp.in->type == IN_FILE) + if (op == tp && !(st & JOINING) && pp.in->type == IN_FILE && !(pp.option & PRESERVE)) { st |= NEWLINE|HIDDEN; pp.hidden++; diff --git a/usr/src/lib/libpp/common/pplib.h b/usr/src/lib/libpp/common/pplib.h index 3428b4d55f..a450eb63a9 100644 --- a/usr/src/lib/libpp/common/pplib.h +++ b/usr/src/lib/libpp/common/pplib.h @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppline.c b/usr/src/lib/libpp/common/ppline.c index 8ff7c23339..62e56c3a73 100644 --- a/usr/src/lib/libpp/common/ppline.c +++ b/usr/src/lib/libpp/common/ppline.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppmacref.c b/usr/src/lib/libpp/common/ppmacref.c index d744f99803..efe97e63ce 100644 --- a/usr/src/lib/libpp/common/ppmacref.c +++ b/usr/src/lib/libpp/common/ppmacref.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppmisc.c b/usr/src/lib/libpp/common/ppmisc.c index d7b5d3730e..22a989ada4 100644 --- a/usr/src/lib/libpp/common/ppmisc.c +++ b/usr/src/lib/libpp/common/ppmisc.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppop.c b/usr/src/lib/libpp/common/ppop.c index 86e3651864..61f9983469 100644 --- a/usr/src/lib/libpp/common/ppop.c +++ b/usr/src/lib/libpp/common/ppop.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -736,7 +736,7 @@ ppop(int op, ...) ppop(PP_TRANSITION, 1); break; } - if (!(pp.arg_style & STYLE_gnu)) + if (!(pp.state & WARN) && !(pp.arg_style & STYLE_gnu)) ppop(PP_PEDANTIC, 1); if (pp.state & PASSTHROUGH) { diff --git a/usr/src/lib/libpp/common/pppragma.c b/usr/src/lib/libpp/common/pppragma.c index 875a17e5eb..bb442471e3 100644 --- a/usr/src/lib/libpp/common/pppragma.c +++ b/usr/src/lib/libpp/common/pppragma.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppprintf.c b/usr/src/lib/libpp/common/ppprintf.c index b8c6c77a07..d1c1f9707a 100644 --- a/usr/src/lib/libpp/common/ppprintf.c +++ b/usr/src/lib/libpp/common/ppprintf.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/ppproto.c b/usr/src/lib/libpp/common/ppproto.c index f03b2535bc..b3e6794921 100644 --- a/usr/src/lib/libpp/common/ppproto.c +++ b/usr/src/lib/libpp/common/ppproto.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -29,7 +29,7 @@ * PROTOMAIN is coded for minimal library support */ -static const char id[] = "\n@(#)$Id: proto (AT&T Research) 2006-06-28 $\0\n"; +static const char id[] = "\n@(#)$Id: proto (AT&T Research) 2008-05-11 $\0\n"; #if PROTOMAIN @@ -55,6 +55,7 @@ static const char id[] = "\n@(#)$Id: proto (AT&T Research) 2006-06-28 $\0\n"; #define MAGICOFF "noticed" /* no notice if found in pragma */ #define MAGICTOP 64 /* must be in these top lines */ #define NOTICED "Copyright" /* no notice if found in magic */ +#define PUBLICDOMAIN "Public Domain" /* no notice if found in magic */ struct proto /* proto buffer state */ { @@ -1633,7 +1634,11 @@ if !defined(va_start)\n\ break; case '=': if (last == '?') flags |= DIRECTIVE; - else if (paren == 0 && (flags & (INIT|MATCH|SKIP)) == MATCH) goto fsm_statement; + else if (paren == 0 && (flags & (INIT|MATCH|SKIP)) == MATCH) + { + if (last == ')' && proto->brace && (group != 2 || call != 2)) flags |= SKIP; + else goto fsm_statement; + } goto fsm_other; case ',': #if PROTOMAIN @@ -2286,6 +2291,11 @@ pppopen(char* file, int fd, char* notice, char* options, char* package, char* co break; } } + if (*s == *PUBLICDOMAIN && !strncmp(s, PUBLICDOMAIN, sizeof(PUBLICDOMAIN) - 1)) + { + notice = options = 0; + break; + } else if (*s++ == '\n') { s--; diff --git a/usr/src/lib/libpp/common/ppsearch.c b/usr/src/lib/libpp/common/ppsearch.c index f9bf29fe01..83b956bca9 100644 --- a/usr/src/lib/libpp/common/ppsearch.c +++ b/usr/src/lib/libpp/common/ppsearch.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * @@ -86,7 +86,7 @@ ppmultiple(register struct ppfile* fp, register struct ppsymbol* test) { if ((pp.mode & (ALLMULTIPLE|LOADING)) == LOADING) fp->guard = INC_IGNORE; - if (pp.state & WARN) + if ((pp.state & WARN) && (pp.mode & (HOSTED|MARKHOSTED|RELAX|PEDANTIC)) == PEDANTIC) error(1, "%s: ignored -- already included", fp->name); else message((-3, "%s: ignored -- already included", fp->name)); @@ -530,7 +530,7 @@ if (pp.test & 0x0010) error(1, "SEARCH#%d file=%s path=%s index=%d data=<%lu,%lu xp->guard = INC_TEST; else { - if (pp.state & WARN) + if ((pp.state & WARN) && (pp.mode & (HOSTED|MARKHOSTED|RELAX|PEDANTIC)) == PEDANTIC) error(1, "%s: ignored -- already included", xp->name); else message((-3, "%s: ignored -- already included", xp->name)); @@ -598,6 +598,7 @@ ppsearch(char* file, int type, int flags) struct oplist* cp; struct ppfile* xp; int dospath; + int chop; int fd; int index; char name[MAXTOKEN + 1]; @@ -605,24 +606,26 @@ ppsearch(char* file, int type, int flags) pp.include = 0; fd = -1; dospath = 0; + chop = 0; again: pathcanon(file, 0); - for (cp = pp.chop; cp; cp = cp->next) - if (strneq(file, cp->value, cp->op)) - { - if (cp->value[cp->op + 1]) - { - sfsprintf(name, sizeof(name) - 1, "%s%s", cp->value + cp->op + 1, file + cp->op); - message((-3, "chop: %s -> %s", file, name)); - file = name; - } - else if (strchr(file + cp->op, '/')) + if (chop) + for (cp = pp.chop; cp; cp = cp->next) + if (strneq(file, cp->value, cp->op)) { - message((-3, "chop: %s -> %s", file, file + cp->op)); - file += cp->op; + if (cp->value[cp->op + 1]) + { + sfsprintf(name, sizeof(name) - 1, "%s%s", cp->value + cp->op + 1, file + cp->op); + message((-2, "search: %s -> %s", file, name)); + file = name; + } + else if (strchr(file + cp->op, '/')) + { + message((-2, "search: %s -> %s", file, file + cp->op)); + file += cp->op; + } + break; } - break; - } fp = ppsetfile(file); while ((fp->flags & INC_MAPALL) || (fp->flags & INC_MAPHOSTED) && (pp.mode & HOSTED) || (fp->flags & INC_MAPNOHOSTED) && !(pp.mode & HOSTED)) { @@ -779,6 +782,12 @@ ppsearch(char* file, int type, int flags) } if ((flags & (SEARCH_INCLUDE|SEARCH_NEXT)) == SEARCH_INCLUDE) { + if (!chop && pp.chop) + { + chop = 1; + type = T_STRING; + goto again; + } if (!(pp.mode & GENDEPS)) { if (!(pp.option & ALLPOSSIBLE) || pp.in->prev->prev) diff --git a/usr/src/lib/libpp/common/ppsym.c b/usr/src/lib/libpp/common/ppsym.c index 081f1bcd94..5fa4d7ff23 100644 --- a/usr/src/lib/libpp/common/ppsym.c +++ b/usr/src/lib/libpp/common/ppsym.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/common/pptrace.c b/usr/src/lib/libpp/common/pptrace.c index d1b1204817..a10117f4bd 100644 --- a/usr/src/lib/libpp/common/pptrace.c +++ b/usr/src/lib/libpp/common/pptrace.c @@ -1,10 +1,10 @@ /*********************************************************************** * * * This software is part of the ast package * -* Copyright (c) 1986-2007 AT&T Knowledge Ventures * +* Copyright (c) 1986-2008 AT&T Intellectual Property * * and is licensed under the * * Common Public License, Version 1.0 * -* by AT&T Knowledge Ventures * +* by AT&T Intellectual Property * * * * A copy of the License is available at * * http://www.opensource.org/licenses/cpl1.0.txt * diff --git a/usr/src/lib/libpp/i386/Makefile b/usr/src/lib/libpp/i386/Makefile index f91f0270e9..34cbd52eb3 100644 --- a/usr/src/lib/libpp/i386/Makefile +++ b/usr/src/lib/libpp/i386/Makefile @@ -18,12 +18,12 @@ # # CDDL HEADER END # + # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# + include ../Makefile.com diff --git a/usr/src/lib/libpp/mapfile-vers b/usr/src/lib/libpp/mapfile-vers index 43e4584b85..cd8b20bfc6 100644 --- a/usr/src/lib/libpp/mapfile-vers +++ b/usr/src/lib/libpp/mapfile-vers @@ -20,11 +20,9 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# SUNWprivate_1.1 { global: diff --git a/usr/src/lib/libpp/sparc/Makefile b/usr/src/lib/libpp/sparc/Makefile index f91f0270e9..79cb51eae6 100644 --- a/usr/src/lib/libpp/sparc/Makefile +++ b/usr/src/lib/libpp/sparc/Makefile @@ -18,12 +18,11 @@ # # CDDL HEADER END # + # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# ident "%Z%%M% %I% %E% SMI" -# include ../Makefile.com |
