diff options
| author | ab196087 <none@none> | 2008-06-24 12:23:35 -0700 |
|---|---|---|
| committer | ab196087 <none@none> | 2008-06-24 12:23:35 -0700 |
| commit | 1dd08564e4a3aafe66b00aee6f222b0885346fe8 (patch) | |
| tree | 8dd08acb0caf6ffc7181c901aaff2a29ae462c3e /usr/src/cmd | |
| parent | 82da9f6027f9bba5379e821f9331f18c4b0ffb15 (diff) | |
| download | illumos-joyent-1dd08564e4a3aafe66b00aee6f222b0885346fe8.tar.gz | |
6716350 usr/src/cmd/sgs should be linted by nightly builds
Diffstat (limited to 'usr/src/cmd')
59 files changed, 929 insertions, 601 deletions
diff --git a/usr/src/cmd/sgs/0@0/Makefile.targ b/usr/src/cmd/sgs/0@0/Makefile.targ index d3dd54884e..07f3bdd901 100644 --- a/usr/src/cmd/sgs/0@0/Makefile.targ +++ b/usr/src/cmd/sgs/0@0/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -22,7 +21,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # @@ -44,4 +43,5 @@ delete: $(RM) $(DYNLIB) lint: - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl 0@0.so.1 > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) diff --git a/usr/src/cmd/sgs/Makefile b/usr/src/cmd/sgs/Makefile index bab4d6e139..ca1a8805bf 100644 --- a/usr/src/cmd/sgs/Makefile +++ b/usr/src/cmd/sgs/Makefile @@ -27,6 +27,13 @@ include $(SRC)/cmd/Makefile.cmd +# Note: Why SUBDIRS-common isn't sorted alphabetically +# +# The items under SGS are not independent of each other. +# They must be built in an order that ensures that +# all dependencies of an item have been built before the +# item itself. +# SUBDIRS-common= libconv \ .WAIT \ libdl \ diff --git a/usr/src/cmd/sgs/Makefile.com b/usr/src/cmd/sgs/Makefile.com index 4807a53dd1..3bd825db96 100644 --- a/usr/src/cmd/sgs/Makefile.com +++ b/usr/src/cmd/sgs/Makefile.com @@ -19,7 +19,7 @@ # 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" @@ -120,8 +120,6 @@ USE_PROTO = -Yl,$(SGSPROTO) # lint-related stuff # -DASHES = "------------------------------------------------------------" - LIBNAME32 = $(LIBNAME:%=%32) LIBNAME64 = $(LIBNAME:%=%64) LIBNAMES = $(LIBNAME32) $(LIBNAME64) diff --git a/usr/src/cmd/sgs/Makefile.targ b/usr/src/cmd/sgs/Makefile.targ index 08d8a79f8f..6e6e5d39ca 100644 --- a/usr/src/cmd/sgs/Makefile.targ +++ b/usr/src/cmd/sgs/Makefile.targ @@ -20,7 +20,7 @@ # # -# 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" @@ -156,36 +156,63 @@ $(LINTOUT64): $(LINTSRCS) $(LINTSRCS64) $(LINT.c) -D_ELF64 $(LINTSRCS) $(LINTSRCS64) \ $(LDLIBS) > $(LINTOUT64) 2>&1 +# +# A couple of macros used in the SGSLINTOUT rule below +# +# LINT_HDR - Use sgs/tools/lint_hdr.pl to generate lint output headers +# LINT_TEE - Use tee to write output to stdout and also capture it +# in the SGSLINT output file. +# +# An additional complexity: We produce headers for all the lint +# output so that we can tell what came from where when we look +# at the resulting file. We also cat these headers to stdout so that +# the user of make will see them. However, we don't want the headers +# to go to stdout if there is only one of LINTOUT32 and LINTOUT64. To +# the interactive user, the headers are only interesting as a way to +# separate the two ELF classes. We only bother with this for the +# non-DYNLIB and non-RTLD case, because at the current time, both of these +# cases always have both 32 and 64-bit ELFCLASS support. +# +LINT_HDR= perl $(SGSTOOLS)/lint_hdr.pl +LINT_TEE= tee -a $(SGSLINTOUT) + $(SGSLINTOUT): FRC @ rm -f $(SGSLINTOUT) @ if [ -r $(LINTOUT1) ]; then \ - echo "\n"$(LINTLIB) >> $(SGSLINTOUT); \ - echo $(DASHES) >> $(SGSLINTOUT); \ - cat $(LINTOUT1) >> $(SGSLINTOUT); \ + $(LINT_HDR) $(LINTLIB) | $(LINT_TEE); \ + cat $(LINTOUT1) | $(LINT_TEE); \ fi @ if [ -r $(LINTOUT32) ]; then \ if [ -n "$(DYNLIB)" ] ; then \ - echo "\nElf32 - $(DYNLIB)" >> $(SGSLINTOUT); \ + $(LINT_HDR) $(DYNLIB) 32 | $(LINT_TEE); \ elif [ -n "$(RTLD)" ] ; then \ - echo "\nElf32 - $(RTLD)" >> $(SGSLINTOUT); \ - else echo "\nElf32 - $(PROG)" >> $(SGSLINTOUT); \ + $(LINT_HDR) $(RTLD) 32 | $(LINT_TEE); \ + else \ + if [ -r $(LINTOUT64) ]; then \ + $(LINT_HDR) $(PROG) 32 | $(LINT_TEE); \ + else \ + $(LINT_HDR) $(PROG) 32 >> $(SGSLINTOUT); \ + fi; \ fi; \ - echo $(DASHES) >> $(SGSLINTOUT); \ - cat $(LINTOUT32) >> $(SGSLINTOUT); \ + cat $(LINTOUT32) | $(LINT_TEE); \ fi @ if [ -r $(LINTOUT64) ]; then \ if [ -n "$(DYNLIB)" ] ; then \ if [ $(DYNLIB) = "libld.so.2" ] ; then \ - echo "\nElf64 - libld.so.3" >> $(SGSLINTOUT); \ + $(LINT_HDR) libld.so.3 64 | $(LINT_TEE); \ else \ - echo "\nElf64 - $(DYNLIB)" >> $(SGSLINTOUT); \ + $(LINT_HDR) $(DYNLIB) 64 | $(LINT_TEE); \ fi; \ elif [ -n "$(RTLD)" ] ; then \ - echo "\nElf64 - $(RTLD)" >> $(SGSLINTOUT); \ - else echo "\nElf64 - $(PROG)" >> $(SGSLINTOUT); \ + $(LINT_HDR) $(RTLD) 64 | $(LINT_TEE); \ + else \ + if [ -r $(LINTOUT32) ]; then \ + $(LINT_HDR) $(PROG) 64 | $(LINT_TEE); \ + else \ + $(LINT_HDR) $(PROG) 64 >> $(SGSLINTOUT); \ + fi; \ fi; \ - echo $(DASHES) >> $(SGSLINTOUT); \ - cat $(LINTOUT64) >> $(SGSLINTOUT); \ + cat $(LINTOUT64) | $(LINT_TEE); \ fi @ rm -f $(LINTOUT1) $(LINTOUT32) $(LINTOUT64) diff --git a/usr/src/cmd/sgs/ar/Makefile.targ b/usr/src/cmd/sgs/ar/Makefile.targ index 99d04310f9..9a272b0de2 100644 --- a/usr/src/cmd/sgs/ar/Makefile.targ +++ b/usr/src/cmd/sgs/ar/Makefile.targ @@ -21,7 +21,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. objs/%.o \ @@ -68,6 +68,7 @@ objs objs.xpg4: -@ mkdir -p $@ $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) $(LDLIBS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) $(LDLIBS) 2>&1 | tee -a $(LINTOUT) include $(SRC)/cmd/Makefile.targ diff --git a/usr/src/cmd/sgs/elfedit/modules/Makefile.targ b/usr/src/cmd/sgs/elfedit/modules/Makefile.targ index 2e8e303499..231a6a083c 100644 --- a/usr/src/cmd/sgs/elfedit/modules/Makefile.targ +++ b/usr/src/cmd/sgs/elfedit/modules/Makefile.targ @@ -19,7 +19,7 @@ # 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" @@ -125,30 +125,33 @@ chkmsg: $(SRCS) sh $(CHKMSG) -m ../common/sym.msg ../common/sym.c sh $(CHKMSG) -m ../common/syminfo.msg ../common/syminfo.c + +LINT_HDR= perl $(SGSTOOLS)/lint_hdr.pl + lint: - @echo "\nLint of: cap.so" > $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/cap.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: dyn.so" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/dyn.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: ehdr.so" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/ehdr.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: phdr.so" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/phdr.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: shdr.so" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/shdr.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: str.so" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/str.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: sym.so" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/sym.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: syminfo.so" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/syminfo.c >> $(LINTOUT) 2>&1 + $(LINT_HDR) "elfedit modules" > $(LINTOUT) + $(LINT_HDR) -s "cap.so" >> $(LINTOUT) + $(LINT.c) ../common/cap.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "dyn.so" >> $(LINTOUT) + $(LINT.c) ../common/dyn.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "ehdr.so" >> $(LINTOUT) + $(LINT.c) ../common/ehdr.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "phdr.so" >> $(LINTOUT) + $(LINT.c) ../common/phdr.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "shdr.so" >> $(LINTOUT) + $(LINT.c) ../common/shdr.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "str.so" >> $(LINTOUT) + $(LINT.c) ../common/str.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "sym.so" >> $(LINTOUT) + $(LINT.c) ../common/sym.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "syminfo.so" >> $(LINTOUT) + $(LINT.c) ../common/syminfo.c 2>&1 | tee -a $(LINTOUT) include $(SRC)/lib/Makefile.targ diff --git a/usr/src/cmd/sgs/error/i386/Makefile b/usr/src/cmd/sgs/error/i386/Makefile index 6eea425308..a76c0ceb52 100644 --- a/usr/src/cmd/sgs/error/i386/Makefile +++ b/usr/src/cmd/sgs/error/i386/Makefile @@ -21,7 +21,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/error/i386/Makefile @@ -62,6 +62,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/error/sparc/Makefile b/usr/src/cmd/sgs/error/sparc/Makefile index c23aa20069..daa0de73e0 100644 --- a/usr/src/cmd/sgs/error/sparc/Makefile +++ b/usr/src/cmd/sgs/error/sparc/Makefile @@ -21,7 +21,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/error/sparc/Makefile @@ -62,6 +62,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/gprof/Makefile.com b/usr/src/cmd/sgs/gprof/Makefile.com index ea7ef91f28..053d3d8551 100644 --- a/usr/src/cmd/sgs/gprof/Makefile.com +++ b/usr/src/cmd/sgs/gprof/Makefile.com @@ -21,7 +21,7 @@ # # ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/gprof/Makefile.com @@ -41,7 +41,7 @@ DEFLIST= -DELF_OBJ -DELF CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) C99MODE= $(C99_ENABLE) -LDLIBS += ../../sgsdemangler/`mach`/libdemangle.a +LDLIBS += -L../../sgsdemangler/$(MACH) -ldemangle LINTFLAGS += $(LDLIBS) CLEANFILES += $(LINTOUT) diff --git a/usr/src/cmd/sgs/gprof/Makefile.targ b/usr/src/cmd/sgs/gprof/Makefile.targ index fc6d01f8f1..c58dc5a0a4 100644 --- a/usr/src/cmd/sgs/gprof/Makefile.targ +++ b/usr/src/cmd/sgs/gprof/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -22,7 +21,8 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright (c) 1993 by Sun Microsystems, Inc. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # # cmd/sgs/gprof/Makefile.targ # @@ -38,6 +38,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/gprof/common/gprof.c b/usr/src/cmd/sgs/gprof/common/gprof.c index b8e33ece1d..9bdd429183 100644 --- a/usr/src/cmd/sgs/gprof/common/gprof.c +++ b/usr/src/cmd/sgs/gprof/common/gprof.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -173,7 +172,9 @@ asgnsamples(void) ccnt = samples[i]; if (ccnt == 0) continue; + /*LINTED: E_ASSIGMENT_CAUSE_LOSS_PREC*/ pcl = lowpc + scale * i; + /*LINTED: E_ASSIGMENT_CAUSE_LOSS_PREC*/ pch = lowpc + scale * (i + 1); time = ccnt; #ifdef DEBUG @@ -264,7 +265,7 @@ dump_callgraph(FILE *fp, char *filename, unsigned long tarcs, prof_func.next_to = 0; else { prof_func.next_to = cur_offset + - nlp->ncallers * PROFFUNC_SZ; + nlp->ncallers * PROFFUNC_SZ; } /* @@ -273,7 +274,7 @@ dump_callgraph(FILE *fp, char *filename, unsigned long tarcs, */ caller_id = 1; for (arcp = nlp->parents; arcp; - arcp = arcp->arc_parentlist) { + arcp = arcp->arc_parentlist) { /* * If no more callers for this callee, set * next_from to 0 @@ -282,21 +283,20 @@ dump_callgraph(FILE *fp, char *filename, unsigned long tarcs, prof_func.next_from = 0; else { prof_func.next_from = cur_offset + - PROFFUNC_SZ; + PROFFUNC_SZ; } prof_func.frompc = - arcp->arc_parentp->module->load_base + - (arcp->arc_parentp->value - - arcp->arc_parentp->module->txt_origin); - prof_func.topc = - mi->load_base + - (nlp->value - mi->txt_origin); + arcp->arc_parentp->module->load_base + + (arcp->arc_parentp->value - + arcp->arc_parentp->module->txt_origin); + prof_func.topc = mi->load_base + + (nlp->value - mi->txt_origin); prof_func.count = arcp->arc_count; if (fwrite(&prof_func, sizeof (ProfFunction), - 1, fp) != 1) { + 1, fp) != 1) { perror(filename); exit(EX_IOERR); } @@ -330,7 +330,7 @@ dump_hits(FILE *fp, char *filename, nltype *nlp) if ((p = (Address *) calloc(nelem, sizeof (Address))) == NULL) { (void) fprintf(stderr, "%s: no room for %d pcsamples\n", - whoami, nelem); + whoami, nelem); exit(EX_OSERR); } @@ -389,7 +389,7 @@ dump_pcsamples(FILE *fp, char *filename, unsigned long *tarcs, nlp->ncallers = 0; for (arcp = nlp->parents; arcp; - arcp = arcp->arc_parentlist) { + arcp = arcp->arc_parentlist) { (nlp->ncallers)++; } @@ -416,7 +416,7 @@ dump_modules(FILE *fp, char *filename, size_t pbuf_sz) pbuf_sz = CEIL(pbuf_sz, STRUCT_ALIGN); if ((p = pbuf = calloc(pbuf_sz, sizeof (char))) == NULL) { (void) fprintf(stderr, "%s: no room for %d bytes\n", - whoami, pbuf_sz * sizeof (char)); + whoami, pbuf_sz * sizeof (char)); exit(EX_OSERR); } @@ -425,7 +425,7 @@ dump_modules(FILE *fp, char *filename, size_t pbuf_sz) prof_modlist.version = PROF_MODULES_VER; prof_modlist.modules = PROFMODLIST_SZ; prof_modlist.size = PROFMODLIST_SZ + (n_modules - 1) * PROFMOD_SZ + - pbuf_sz; + pbuf_sz; if (fwrite(&prof_modlist, sizeof (ProfModuleList), 1, fp) != 1) { perror(filename); exit(EX_IOERR); @@ -577,19 +577,19 @@ dumpsum_ostyle(char *sumfile) * dump the header; use the last header read in */ if (Bflag) { - if (fwrite(&h, sizeof (h), 1, sfile) != 1) { - perror(sumfile); - exit(EX_IOERR); - } + if (fwrite(&h, sizeof (h), 1, sfile) != 1) { + perror(sumfile); + exit(EX_IOERR); + } } else { - struct hdr32 hdr; - hdr.lowpc = (pctype32)h.lowpc; - hdr.highpc = (pctype32)h.highpc; - hdr.ncnt = (pctype32)h.ncnt; - if (fwrite(&hdr, sizeof (hdr), 1, sfile) != 1) { - perror(sumfile); - exit(EX_IOERR); - } + struct hdr32 hdr; + hdr.lowpc = (pctype32)h.lowpc; + hdr.highpc = (pctype32)h.highpc; + hdr.ncnt = (pctype32)h.ncnt; + if (fwrite(&hdr, sizeof (hdr), 1, sfile) != 1) { + perror(sumfile); + exit(EX_IOERR); + } } /* * dump the samples @@ -607,23 +607,24 @@ dumpsum_ostyle(char *sumfile) for (arcp = nlp->children; arcp; arcp = arcp->arc_childlist) { if (Bflag) { - arc.raw_frompc = arcp->arc_parentp->value; - arc.raw_selfpc = arcp->arc_childp->value; - arc.raw_count = arcp->arc_count; - if (fwrite(&arc, sizeof (arc), 1, sfile) != 1) { - perror(sumfile); - exit(EX_IOERR); - } + arc.raw_frompc = arcp->arc_parentp->value; + arc.raw_selfpc = arcp->arc_childp->value; + arc.raw_count = arcp->arc_count; + if (fwrite(&arc, sizeof (arc), 1, sfile) != 1) { + perror(sumfile); + exit(EX_IOERR); + } } else { - arc32.raw_frompc = - (pctype32)arcp->arc_parentp->value; - arc32.raw_selfpc = - (pctype32)arcp->arc_childp->value; - arc32.raw_count = (actype32)arcp->arc_count; - if (fwrite(&arc32, sizeof (arc32), 1, sfile) != 1) { - perror(sumfile); - exit(EX_IOERR); - } + arc32.raw_frompc = + (pctype32)arcp->arc_parentp->value; + arc32.raw_selfpc = + (pctype32)arcp->arc_childp->value; + arc32.raw_count = (actype32)arcp->arc_count; + if (fwrite(&arc32, sizeof (arc32), 1, sfile) != + 1) { + perror(sumfile); + exit(EX_IOERR); + } } #ifdef DEBUG if (debug & SAMPLEDEBUG) { @@ -885,7 +886,7 @@ process_pcsamples(ProfBuffer *bufp) pc_samples = (Address *) calloc(chunk_size, sizeof (Address)); if (pc_samples == NULL) { (void) fprintf(stderr, "%s: no room for %d sample pc's\n", - whoami, chunk_size); + whoami, chunk_size); exit(EX_OSERR); } @@ -955,7 +956,7 @@ process_cgraph(ProfCallGraph *cgp) * the loop body is executed atleast once, so this should be ok. */ for (callee_off = cgp->functions; callee_off; - callee_off = calleep->next_to) { + callee_off = calleep->next_to) { /* LINTED: pointer cast */ calleep = (ProfFunction *)((char *)cgp + callee_off); @@ -985,12 +986,12 @@ process_cgraph(ProfCallGraph *cgp) arc.raw_selfpc = calleep->topc; for (caller_off = callee_off; caller_off; - caller_off = callerp->next_from) { + caller_off = callerp->next_from) { /* LINTED: pointer cast */ callerp = (ProfFunction *)((char *)cgp + caller_off); if ((caller_mi = find_module(callerp->frompc)) == - NULL) { + NULL) { #ifdef DEBUG if (debug & CGRAPHDEBUG) { (void) printf( @@ -1045,7 +1046,7 @@ is_same_as_aout(char *modpath, struct stat *buf) { if (stat(modpath, buf) == -1) { (void) fprintf(stderr, "%s: can't get info on `%s'\n", - whoami, modpath); + whoami, modpath); exit(EX_NOINPUT); } @@ -1067,14 +1068,14 @@ process_modules(ProfModuleList *modlp) #ifdef DEBUG if (debug & MODULEDEBUG) { (void) printf("[process_modules] module obj version %u\n", - modlp->version); + modlp->version); } #endif /* DEBUG */ /* Check version of module type object */ if (modlp->version > PROF_MODULES_VER) { (void) fprintf(stderr, "%s: version %d for module type objects" - "is not supported\n", whoami, modlp->version); + "is not supported\n", whoami, modlp->version); exit(EX_SOFTWARE); } @@ -1094,8 +1095,8 @@ process_modules(ProfModuleList *modlp) */ so_path = (caddr_t)modlp + newmodp->path; if (does_overlap(newmodp, &modules) || - is_same_as_aout(so_path, &so_statbuf) || - (!is_shared_obj(so_path))) { + is_same_as_aout(so_path, &so_statbuf) || + (!is_shared_obj(so_path))) { if (!newmodp->next) more_modules = FALSE; @@ -1174,8 +1175,7 @@ process_modules(ProfModuleList *modlp) #ifdef DEBUG if (debug & MODULEDEBUG) { (void) printf("[process_modules] base=%#llx, " - "end=%#llx\n", mi->load_base, - mi->load_end); + "end=%#llx\n", mi->load_base, mi->load_end); } #endif /* DEBUG */ continue; @@ -1196,7 +1196,7 @@ process_modules(ProfModuleList *modlp) new_module = malloc(sizeof (mod_info_t)); if (new_module == NULL) { (void) fprintf(stderr, "%s: no room for %d bytes\n", - whoami, sizeof (mod_info_t)); + whoami, sizeof (mod_info_t)); exit(EX_OSERR); } @@ -1207,7 +1207,7 @@ process_modules(ProfModuleList *modlp) new_module->name = malloc(strlen(so_path) + 1); if (new_module->name == NULL) { (void) fprintf(stderr, "%s: no room for %d bytes\n", - whoami, strlen(so_path) + 1); + whoami, strlen(so_path) + 1); exit(EX_OSERR); } (void) strcpy(new_module->name, so_path); @@ -1287,7 +1287,7 @@ getpfiledata(caddr_t memp, size_t fsz) (void) printf( "\n[getpfiledata] object %s [%#lx]\n", - objname[type], objp->type); + objname[type], objp->type); } } #endif /* DEBUG */ @@ -1308,8 +1308,8 @@ getpfiledata(caddr_t memp, size_t fsz) default : (void) fprintf(stderr, - "%s: unknown prof object type=%d\n", - whoami, objp->type); + "%s: unknown prof object type=%d\n", + whoami, objp->type); exit(EX_SOFTWARE); } /* LINTED: pointer cast */ @@ -1318,7 +1318,7 @@ getpfiledata(caddr_t memp, size_t fsz) if (!found_cgraph || !found_pcsamples) { (void) fprintf(stderr, - "%s: missing callgraph/pcsamples object\n", whoami); + "%s: missing callgraph/pcsamples object\n", whoami); exit(EX_SOFTWARE); } @@ -1352,7 +1352,7 @@ readarcs(FILE *pfile) * 'converted' to the standard data format. */ if (fread(&rtld_arc64, - sizeof (L_cgarc64), 1, pfile) != 1) + sizeof (L_cgarc64), 1, pfile) != 1) break; if (rtld_arc64.cg_from == PRF_OUTADDR64) @@ -1371,7 +1371,7 @@ readarcs(FILE *pfile) * 'converted' to the standard data format. */ if (fread(&rtld_arc, - sizeof (L_cgarc), 1, pfile) != 1) + sizeof (L_cgarc), 1, pfile) != 1) break; if (rtld_arc.cg_from == PRF_OUTADDR) @@ -1481,7 +1481,7 @@ handle_versioned(FILE *pfile, char *filename, size_t *fsz) if (invalid_version) { (void) fprintf(stderr, "%s: version %d.%d not supported\n", - whoami, prof_hdr.h_major_ver, prof_hdr.h_minor_ver); + whoami, prof_hdr.h_major_ver, prof_hdr.h_minor_ver); exit(EX_SOFTWARE); } @@ -1502,8 +1502,8 @@ handle_versioned(FILE *pfile, char *filename, size_t *fsz) fmem = mmap(0, *fsz, PROT_READ, MAP_PRIVATE, fd, 0); if (fmem == MAP_FAILED) { - (void) fprintf(stderr, "%s: can't map %s\n", whoami, filename); - exit(EX_IOERR); + (void) fprintf(stderr, "%s: can't map %s\n", whoami, filename); + exit(EX_IOERR); } /* @@ -1513,7 +1513,7 @@ handle_versioned(FILE *pfile, char *filename, size_t *fsz) */ if (fstat(fd, &buf) == -1) { (void) fprintf(stderr, "%s: can't get info on `%s'\n", - whoami, filename); + whoami, filename); exit(EX_NOINPUT); } gmonout_info.dev = buf.st_dev; @@ -1559,7 +1559,7 @@ openpfile(char *filename, size_t *fsz) if (magic_num == (unsigned int)PROF_MAGIC) { if ((!first_time) && (old_style == TRUE)) { (void) fprintf(stderr, "%s: can't mix old & new format " - "profiled files\n", whoami); + "profiled files\n", whoami); exit(EX_SOFTWARE); } first_time = FALSE; @@ -1569,7 +1569,7 @@ openpfile(char *filename, size_t *fsz) if ((!first_time) && (old_style == FALSE)) { (void) fprintf(stderr, "%s: can't mix old & new format " - "profiled files\n", whoami); + "profiled files\n", whoami); exit(EX_SOFTWARE); } diff --git a/usr/src/cmd/sgs/lex/Makefile.com b/usr/src/cmd/sgs/lex/Makefile.com index 3969587e2c..d39bdbd037 100644 --- a/usr/src/cmd/sgs/lex/Makefile.com +++ b/usr/src/cmd/sgs/lex/Makefile.com @@ -19,12 +19,14 @@ # 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" # +PROG= lex + MACHOBJS= main.o sub1.o sub2.o sub3.o header.o parser.o POBJECTS= $(MACHOBJS) POBJS= $(POBJECTS:%=objs/%) @@ -48,8 +50,10 @@ C99MODE= $(C99_ENABLE) # Override default source file derivation rule (in Makefile.lib) # from objects # -SRCS= $(MACHOBJS:%.o=../common/%.c) \ - $(LIBOBJS:%.o=../common/%.c) +MACHSRCS= $(MACHOBJS:%.o=../common/%.c) +LIBSRCS = $(LIBOBJS:%.o=../common/%.c) +SRCS= $(MACHSRCS) $(LIBSRCS) + LIBS = $(DYNLIB) $(LINTLIB) @@ -71,8 +75,8 @@ pics/%_e.o:= DEFLIST = -DEUC -DJLSLEX -DEOPTION -D$*=$*_e CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) BUILD.AR= $(AR) $(ARFLAGS) $@ `$(LORDER) $(OBJS) | $(TSORT)` -LINTFLAGS= -ax -LINTPOUT= lintp.out +LINTFLAGS= -amux +LINTPOUT= lint.out $(LINTLIB):= LINTFLAGS = -nvx $(ROOTPROG):= FILEMODE = 0555 @@ -91,5 +95,5 @@ $(DYNLIB) := CFLAGS64 += $(CCVERBOSE) $(DYNLIB) := LDLIBS += -lc -CLEANFILES += ../common/parser.c $(LINTPOUT) $(LINTOUT) +CLEANFILES += ../common/parser.c $(LINTPOUT) CLOBBERFILES += $(LIBS) $(LIBRARY) diff --git a/usr/src/cmd/sgs/lex/Makefile.targ b/usr/src/cmd/sgs/lex/Makefile.targ index 9948d78dc0..ea1bee3a62 100644 --- a/usr/src/cmd/sgs/lex/Makefile.targ +++ b/usr/src/cmd/sgs/lex/Makefile.targ @@ -19,7 +19,7 @@ # 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" @@ -91,8 +91,15 @@ clean: lint: $(LINTPOUT) $(LINTLIB) +LINT_HDR= perl ../../tools/lint_hdr.pl + $(LINTPOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTPOUT) 2>&1 + $(LINT_HDR) $(PROG) > $(LINTPOUT) + $(LINT_HDR) -s lex >> $(LINTPOUT) + $(LINT.c) $(MACHSRCS) $(LDLIBS) 2>&1 | tee -a $(LINTPOUT) + + $(LINT_HDR) -s libl.so.1 >> $(LINTPOUT) + $(LINT.c) $(LIBSRCS) $(LDLIBS) 2>&1 | tee -a $(LINTPOUT) $(LINTLIB): $(LINTSRCS) - $(LINT.c) -o $(LIBNAME) $(LINTSRCS) > $(LINTOUT) 2>&1 + $(LINT.c) -o $(LIBNAME) $(LINTSRCS) diff --git a/usr/src/cmd/sgs/lex/common/allprint.c b/usr/src/cmd/sgs/lex/common/allprint.c index bfe3ff16ee..a4857b8389 100644 --- a/usr/src/cmd/sgs/lex/common/allprint.c +++ b/usr/src/cmd/sgs/lex/common/allprint.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -57,22 +56,22 @@ allprint(CHR c) { switch (c) { case '\n': - fprintf(yyout, "\\n"); + (void) fprintf(yyout, "\\n"); break; case '\t': - fprintf(yyout, "\\t"); + (void) fprintf(yyout, "\\t"); break; case '\b': - fprintf(yyout, "\\b"); + (void) fprintf(yyout, "\\b"); break; case ' ': - fprintf(yyout, "\\_"); + (void) fprintf(yyout, "\\_"); break; default: if (!iswprint(c)) - fprintf(yyout, "\\x%-2x", c); + (void) fprintf(yyout, "\\x%-2x", c); else - putwc(c, yyout); + (void) putwc(c, yyout); break; } } diff --git a/usr/src/cmd/sgs/lex/common/header.c b/usr/src/cmd/sgs/lex/common/header.c index 4430f7b4ea..422e296656 100644 --- a/usr/src/cmd/sgs/lex/common/header.c +++ b/usr/src/cmd/sgs/lex/common/header.c @@ -19,7 +19,7 @@ * 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. */ @@ -46,41 +46,41 @@ static void chd1(void) { if (*v_stmp == 'y') - (void) fprintf(fout, "#ident\t\"lex: %s %s\"\n", + (void) fprintf(fout, "#ident\t\"lex: %s %s\"\n", (const char *)SGU_PKG, (const char *)SGU_REL); if (handleeuc) { - fprintf(fout, "#ifndef EUC\n"); - fprintf(fout, "#define EUC\n"); - fprintf(fout, "#endif\n"); - fprintf(fout, "#include <stdio.h>\n"); - fprintf(fout, "#include <stdlib.h>\n"); - fprintf(fout, "#include <inttypes.h>\n"); - fprintf(fout, "#include <widec.h>\n"); + (void) fprintf(fout, "#ifndef EUC\n"); + (void) fprintf(fout, "#define EUC\n"); + (void) fprintf(fout, "#endif\n"); + (void) fprintf(fout, "#include <stdio.h>\n"); + (void) fprintf(fout, "#include <stdlib.h>\n"); + (void) fprintf(fout, "#include <inttypes.h>\n"); + (void) fprintf(fout, "#include <widec.h>\n"); if (widecio) { /* -w option */ - fprintf(fout, "#define YYTEXT yytext\n"); - fprintf(fout, "#define YYLENG yyleng\n"); - fprintf(fout, "#ifndef __cplusplus\n"); - fprintf(fout, "#define YYINPUT input\n"); - fprintf(fout, "#define YYOUTPUT output\n"); - fprintf(fout, "#else\n"); - fprintf(fout, "#define YYINPUT lex_input\n"); - fprintf(fout, "#define YYOUTPUT lex_output\n"); - fprintf(fout, "#endif\n"); - fprintf(fout, "#define YYUNPUT unput\n"); + (void) fprintf(fout, "#define YYTEXT yytext\n"); + (void) fprintf(fout, "#define YYLENG yyleng\n"); + (void) fprintf(fout, "#ifndef __cplusplus\n"); + (void) fprintf(fout, "#define YYINPUT input\n"); + (void) fprintf(fout, "#define YYOUTPUT output\n"); + (void) fprintf(fout, "#else\n"); + (void) fprintf(fout, "#define YYINPUT lex_input\n"); + (void) fprintf(fout, "#define YYOUTPUT lex_output\n"); + (void) fprintf(fout, "#endif\n"); + (void) fprintf(fout, "#define YYUNPUT unput\n"); } else { /* -e option */ - fprintf(fout, "#include <limits.h>\n"); - fprintf(fout, "#include <sys/euc.h>\n"); - fprintf(fout, "#define YYLEX_E 1\n"); - fprintf(fout, "#define YYTEXT yywtext\n"); - fprintf(fout, "#define YYLENG yywleng\n"); - fprintf(fout, "#define YYINPUT yywinput\n"); - fprintf(fout, "#define YYOUTPUT yywoutput\n"); - fprintf(fout, "#define YYUNPUT yywunput\n"); + (void) fprintf(fout, "#include <limits.h>\n"); + (void) fprintf(fout, "#include <sys/euc.h>\n"); + (void) fprintf(fout, "#define YYLEX_E 1\n"); + (void) fprintf(fout, "#define YYTEXT yywtext\n"); + (void) fprintf(fout, "#define YYLENG yywleng\n"); + (void) fprintf(fout, "#define YYINPUT yywinput\n"); + (void) fprintf(fout, "#define YYOUTPUT yywoutput\n"); + (void) fprintf(fout, "#define YYUNPUT yywunput\n"); } } else { /* ASCII compatibility mode. */ - fprintf(fout, "#include <stdio.h>\n"); - fprintf(fout, "#include <stdlib.h>\n"); - fprintf(fout, "#include <inttypes.h>\n"); + (void) fprintf(fout, "#include <stdio.h>\n"); + (void) fprintf(fout, "#include <stdlib.h>\n"); + (void) fprintf(fout, "#include <inttypes.h>\n"); } if (ZCH > NCH) (void) fprintf(fout, "# define U(x) ((x)&0377)\n"); @@ -209,7 +209,8 @@ chd1(void) ctable['\n'], "?(yylineno++,yytchar):yytchar)==EOF?0:yytchar)"); (void) fprintf(fout, "#endif\n"); - fprintf(fout, "#define ECHO fprintf(yyout, \"%%s\",yytext)\n"); + (void) fprintf(fout, + "#define ECHO fprintf(yyout, \"%%s\",yytext)\n"); if (handleeuc) { (void) fprintf(fout, "# define REJECT { nstr = yyreject_e(); goto yyfussy;}\n"); @@ -370,10 +371,10 @@ statistics(void) { (void) fprintf(errorf, "%d/%d nodes(%%e), %d/%d positions(%%p), %d/%d (%%n), %ld transitions,\n", - tptr, treesize, nxtpos-positions, maxpos, stnum + 1, nstates, - rcount); + tptr, treesize, (int)(nxtpos-positions), maxpos, stnum + 1, + nstates, rcount); (void) fprintf(errorf, - "%d/%d packed char classes(%%k), ", pcptr-pchar, pchlen); + "%d/%d packed char classes(%%k), ", (int)(pcptr-pchar), pchlen); if (optim) (void) fprintf(errorf, " %d/%d packed transitions(%%a), ", nptr, ntrans); diff --git a/usr/src/cmd/sgs/lex/common/libmain.c b/usr/src/cmd/sgs/lex/common/libmain.c index 6da7bd3c6f..0b1dc02cb5 100644 --- a/usr/src/cmd/sgs/lex/common/libmain.c +++ b/usr/src/cmd/sgs/lex/common/libmain.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -24,7 +23,7 @@ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -37,8 +36,9 @@ extern void exit(); #pragma weak yylex extern int yylex(); +/* ARGSUSED */ int -main() +main(int argc, char **argv) { yylex(); exit(0); diff --git a/usr/src/cmd/sgs/lex/common/main.c b/usr/src/cmd/sgs/lex/common/main.c index ec62d9f93a..975827996a 100644 --- a/usr/src/cmd/sgs/lex/common/main.c +++ b/usr/src/cmd/sgs/lex/common/main.c @@ -19,7 +19,7 @@ * 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. */ @@ -56,7 +56,7 @@ main(int argc, char **argv) sargv = argv; sargc = argc; - setlocale(LC_ALL, ""); + (void) setlocale(LC_ALL, ""); #ifdef DEBUG while ((c = getopt(argc, argv, "dyctvnewVQ:Y:")) != EOF) { #else @@ -243,14 +243,22 @@ main(int argc, char **argv) static void get1core(void) { + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ ccptr = ccl = (CHR *)myalloc(CCLSIZE, sizeof (*ccl)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ pcptr = pchar = (CHR *)myalloc(pchlen, sizeof (*pchar)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ def = (CHR **)myalloc(DEFSIZE, sizeof (*def)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ subs = (CHR **)myalloc(DEFSIZE, sizeof (*subs)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ dp = dchar = (CHR *)myalloc(DEFCHAR, sizeof (*dchar)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ sname = (CHR **)myalloc(STARTSIZE, sizeof (*sname)); /* XCU4: exclusive start array */ + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ exclusive = (int *)myalloc(STARTSIZE, sizeof (*exclusive)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ sp = schar = (CHR *)myalloc(STARTCHAR, sizeof (*schar)); if (ccl == 0 || def == 0 || pchar == 0 || subs == 0 || dchar == 0 || @@ -270,15 +278,24 @@ static void get2core(void) { int i; + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ gotof = (int *)myalloc(nstates, sizeof (*gotof)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ nexts = (int *)myalloc(ntrans, sizeof (*nexts)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ nchar = (CHR *)myalloc(ntrans, sizeof (*nchar)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ state = (int **)myalloc(nstates, sizeof (*state)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ atable = (int *)myalloc(nstates, sizeof (*atable)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ sfall = (int *)myalloc(nstates, sizeof (*sfall)); cpackflg = (Boolean *)myalloc(nstates, sizeof (*cpackflg)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ tmpstat = (CHR *)myalloc(tptr+1, sizeof (*tmpstat)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ foll = (int **)myalloc(tptr+1, sizeof (*foll)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ nxtpos = positions = (int *)myalloc(maxpos, sizeof (*positions)); if (tmpstat == 0 || foll == 0 || positions == 0 || gotof == 0 || nexts == 0 || nchar == 0 || @@ -310,8 +327,11 @@ free2core(void) static void get3core(void) { + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ verify = (int *)myalloc(outsize, sizeof (*verify)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ advance = (int *)myalloc(outsize, sizeof (*advance)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ stoff = (int *)myalloc(stnum+2, sizeof (*stoff)); if (verify == 0 || advance == 0 || stoff == 0) error("Too little core for final packing"); diff --git a/usr/src/cmd/sgs/lex/common/parser.y b/usr/src/cmd/sgs/lex/common/parser.y index c1d73ad796..00465f4522 100644 --- a/usr/src/cmd/sgs/lex/common/parser.y +++ b/usr/src/cmd/sgs/lex/common/parser.y @@ -21,7 +21,7 @@ */ %} /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,6 +32,24 @@ %{ #pragma ident "%Z%%M% %I% %E% SMI" +/* + * Lint is unable to properly handle formats with wide strings + * (e.g. %ws) and misdiagnoses them as being malformed. + * This macro is used to work around that, by substituting + * a pointer to a null string when compiled by lint. This + * trick works because lint is not able to evaluate the + * variable. + * + * When lint is able to handle %ws, it would be appropriate + * to come back through and remove the use of this macro. + */ +#if defined(__lint) +static const char *lint_ws_fmt = ""; +#define WSFMT(_fmt) lint_ws_fmt +#else +#define WSFMT(_fmt) _fmt +#endif + void yyerror(char *); %} @@ -303,6 +321,7 @@ yylex(void) case '%': switch(c= *(p+1)){ case '%': + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ if(scomp(p, (CHR *)"%%")) { p++; while(*(++p)) @@ -323,10 +342,14 @@ yylex(void) error("Too little core for parse tree"); p = (CHR *)c; free(p); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ name = (int *)myalloc(treesize,sizeof(*name)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ left = (int *)myalloc(treesize,sizeof(*left)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ right = (int *)myalloc(treesize,sizeof(*right)); nullstr = myalloc(treesize,sizeof(*nullstr)); + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ parent = (int *)myalloc(treesize,sizeof(*parent)); if(name == 0 || left == 0 || right == 0 || parent == 0 || nullstr == 0) error("Too little core for parse tree"); @@ -403,6 +426,7 @@ yylex(void) # ifdef DEBUG if (debug) (void) printf( "Size classes (%%k) now %d\n",pchlen); # endif + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ pchar=pcptr=(CHR *)myalloc(pchlen, sizeof(*pchar)); if (report==2) report=1; continue; @@ -470,7 +494,7 @@ Character table (%t) is supported only in ASCII compatibility mode.\n"); if(p[0]=='/' && p[1]=='*') cpycom(p); else - (void) fprintf(fout,"%ws\n",p); + (void) fprintf(fout,WSFMT("%ws\n"),p); if(p[0] == '%') continue; if (*p) error("EOF before %%%%"); else error("EOF before %%}"); @@ -500,7 +524,7 @@ start: if (*t == 0) continue; i = sptr*2; if(!ratfor)(void) fprintf(fout,"# "); - fprintf(fout,"define %ws %d\n",t,i); + (void) fprintf(fout,WSFMT("define %ws %d\n"),t,i); scopy(t,sp); sname[sptr] = sp; /* XCU4: save exclusive flag with start name */ @@ -521,7 +545,7 @@ start: case ' ': case '\t': /* must be code */ lgate(); if( p[1]=='/' && p[2]=='*' ) cpycom(p); - else (void) fprintf(fout, "%ws\n",p); + else (void) fprintf(fout, WSFMT("%ws\n"),p); continue; case '/': /* look for comments */ lgate(); @@ -571,6 +595,7 @@ start: if(sectbegin == TRUE){ (void)cpyact(); copy_line = FALSE; + /*LINTED: E_EQUALITY_NOT_ASSIGNMENT*/ while((c=gch()) && c != '\n'); continue; } @@ -582,6 +607,7 @@ start: if(ratfor)(void) fprintf(fout,"goto 30997\n"); else (void) fprintf(fout,"break;\n"); } + /*LINTED: E_EQUALITY_NOT_ASSIGNMENT*/ while((c=gch()) && c != '\n') { if (c=='/') { if((c=gch())=='*') { @@ -617,7 +643,7 @@ start: if(buf[0]=='/' && buf[1]=='*') cpycom(buf); else - (void) fprintf(fout,"%ws\n",buf); + (void) fprintf(fout,WSFMT("%ws\n"),buf); continue; } if(peek == '%'){ @@ -767,6 +793,7 @@ start: break; case '"': i = 0; + /*LINTED: E_EQUALITY_NOT_ASSIGNMENT*/ while((c=gch()) && c != '"' && c != '\n'){ if(c == '\\') c = usescape(c=gch()); remch(c); @@ -928,9 +955,9 @@ Character range specified between different codesets."); else (void) fprintf(fout, "\n# line %d \"%s\"\n", yyline-1, sargv[optind]); - (void) fprintf(fout,"%ws\n",buf); + (void) fprintf(fout,WSFMT("%ws\n"),buf); while(getl(buf) && !eof) - (void) fprintf(fout,"%ws\n",buf); + (void) fprintf(fout,WSFMT("%ws\n"),buf); } return(freturn(0)); diff --git a/usr/src/cmd/sgs/lex/common/sub1.c b/usr/src/cmd/sgs/lex/common/sub1.c index 60e8fa9a0c..69eb0b545c 100644 --- a/usr/src/cmd/sgs/lex/common/sub1.c +++ b/usr/src/cmd/sgs/lex/common/sub1.c @@ -19,7 +19,7 @@ * 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. */ @@ -103,6 +103,7 @@ int p, d; (void) fprintf(errorf, "line %d: ", yyline); } (void) fprintf(errorf, "Error: "); + /*LINTED: E_SEC_PRINTF_VAR_FMT*/ (void) fprintf(errorf, s, p, d); (void) putc('\n', errorf); if (fatal) @@ -141,6 +142,7 @@ int p, d; "line %d: ", yyline); } (void) fprintf(errorf, "Warning: "); + /*LINTED: E_SEC_PRINTF_VAR_FMT*/ (void) fprintf(errorf, s, p, d); (void) putc('\n', errorf); (void) fflush(errorf); @@ -149,6 +151,12 @@ int p, d; (void) fflush(stdout); } +/* + * This function is apparently unused, but lint flags the fact + * that it does not have the same signature as the libc function + * of the same name. So, take it out of view for lint. + */ +#if !defined(__lint) int index(int a, CHR *s) { @@ -158,6 +166,7 @@ index(int a, CHR *s) return (k); return (-1); } +#endif int alpha(int c) @@ -201,7 +210,7 @@ scopy(CHR *s, CHR *t) CHR *i; i = t; while (*i++ = *s++) - /* EMPTY */; + ; } /* @@ -241,7 +250,7 @@ slength(CHR *s) CHR *t; t = s; for (n = 0; *t++; n++) - /* EMPTY */; + ; return (n); } @@ -437,7 +446,7 @@ usescape(int c) if (handleeuc && !isascii(c)) { char tmpchar = c & 0x00ff; - mbtowc((wchar_t *)&c, &tmpchar, sizeof (tmpchar)); + (void) mbtowc((wchar_t *)&c, &tmpchar, sizeof (tmpchar)); } return (c); } @@ -490,7 +499,7 @@ cpycom(CHR *p) (void) putc((char)c, fout); if ((c = gch()) == '/') { while ((c = gch()) == ' ' || c == '\t') - /* EMPTY */; + ; if (!space(c)) error("unacceptable statement"); prev = '\n'; diff --git a/usr/src/cmd/sgs/lex/common/sub2.c b/usr/src/cmd/sgs/lex/common/sub2.c index 4f7ea0aa0b..07de3f834d 100644 --- a/usr/src/cmd/sgs/lex/common/sub2.c +++ b/usr/src/cmd/sgs/lex/common/sub2.c @@ -19,7 +19,7 @@ * 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. */ @@ -444,7 +444,7 @@ cgoto(void) else gotof[s] = -1; } - ratfor ? fprintf(fout, "end\n") : fprintf(fout, "0};\n"); + (void) (ratfor ? fprintf(fout, "end\n") : fprintf(fout, "0};\n")); } /* @@ -547,9 +547,9 @@ packtrans(int st, CHR *tch, int *tst, int cnt, int tryit) go[index] = tst[i]; symbol[index] = 0; } else { - fprintf(stderr, + (void) fprintf(stderr, "lex`sub2`packtran: tch[%d] out of bounds (%d)\n", - i, tch[i]); + i, (int)tch[i]); } } for (i = 0; i < cnt; i++) { @@ -840,10 +840,10 @@ acompute(int s) (void) putc('\n', fout); for (i = 0; i < k; i++) if (temp[i] != 0) { - ratfor ? + (void) (ratfor ? fprintf(fout, "data vstop(%d)/%d/\n", aptr, temp[i]) : - fprintf(fout, "%d,\n", temp[i]); + fprintf(fout, "%d,\n", temp[i])); #ifdef DEBUG if (debug) (void) printf("%d ", temp[i]); @@ -852,8 +852,8 @@ acompute(int s) } for (i = 0; i < n; i++) { /* copy fall back actions - all neg */ ratfor ? - fprintf(fout, "data vstop(%d)/%d/\n", aptr, neg[i]) : - fprintf(fout, "%d,\n", neg[i]); + (void) fprintf(fout, "data vstop(%d)/%d/\n", aptr, neg[i]) : + (void) fprintf(fout, "%d,\n", neg[i]); aptr++; #ifdef DEBUG if (debug) @@ -864,8 +864,8 @@ acompute(int s) if (debug) (void) putchar('\n'); #endif - ratfor ? fprintf(fout, "data vstop (%d)/0/\n", aptr) : - fprintf(fout, "0, \n"); + (void) (ratfor ? fprintf(fout, "data vstop (%d)/0/\n", aptr) : + fprintf(fout, "0, \n")); aptr++; } @@ -980,7 +980,7 @@ layout(void) if (ctable[nchar[j]] <= 0) (void) printf( "j %d nchar %d ctable.nch %d\n", - j, nchar[j], ctable[nchar[k]]); + j, (int)nchar[j], ctable[nchar[k]]); verify[k] = i + 1; /* state number + 1 */ advance[k] = nexts[j+1]+1; if (yytop < k) @@ -1085,12 +1085,13 @@ layout(void) for (j = 0; j < 8; j++) { int fbch; fbch = match[i+j]; - fprintf(fout, "%3d, ", fbch); + (void) fprintf(fout, "%3d, ", fbch); } (void) putc('\n', fout); } } else { int *fbarr; + /*LINTED: E_BAD_PTR_CAST_ALIGN*/ fbarr = (int *)myalloc(2*MAXNCG, sizeof (*fbarr)); if (fbarr == 0) error("No space for char table reverse", 0); @@ -1100,8 +1101,9 @@ layout(void) fbarr[ctable[i]] = ctable[match[i]]; for (i = 0; i < ncg; i += 8) { for (j = 0; j < 8; j++) - fprintf(fout, "0%-3o,", fbarr[i+j]); - putc('\n', fout); + (void) fprintf(fout, "0%-3o,", + fbarr[i+j]); + (void) putc('\n', fout); } free(fbarr); } @@ -1118,18 +1120,18 @@ layout(void) (void) fprintf(fout, "0};\n"); if (handleeuc) { /* Put out yycgidtbl */ - fprintf(fout, "#define YYNCGIDTBL %d\n", ncgidtbl); - fprintf(fout, "\tunsigned long yycgidtbl[]={"); + (void) fprintf(fout, "#define YYNCGIDTBL %d\n", ncgidtbl); + (void) fprintf(fout, "\tunsigned long yycgidtbl[]={"); /* * Use "unsigned long" instead of "lchar" to minimize * the name-space polution for the application program. */ for (i = 0; i < ncgidtbl; ++i) { if (i%8 == 0) - fprintf(fout, "\n\t\t"); - fprintf(fout, "0x%08x, ", yycgidtbl[i]); + (void) fprintf(fout, "\n\t\t"); + (void) fprintf(fout, "0x%08x, ", (int)yycgidtbl[i]); } - fprintf(fout, "\n\t0};\n"); + (void) fprintf(fout, "\n\t0};\n"); } } diff --git a/usr/src/cmd/sgs/lex/common/sub3.c b/usr/src/cmd/sgs/lex/common/sub3.c index 652b4dc71b..4202902bbf 100644 --- a/usr/src/cmd/sgs/lex/common/sub3.c +++ b/usr/src/cmd/sgs/lex/common/sub3.c @@ -19,7 +19,7 @@ * 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. */ @@ -129,6 +129,7 @@ void remch(wchar_t c) { lchar lc = linearize(c); + size_t local_ncgidtbl; /* * User-friendliness consideration: @@ -145,8 +146,14 @@ remch(wchar_t c) return; } - lsearch(&lc, yycgidtbl, - (size_t *)&ncgidtbl, sizeof (lchar), cmplc); + /* + * lsearch wants ncgidtbl to be size_t, but it is int. Hence, + * the use of local_ncgidtbl to satisfy the calling interface. + */ + local_ncgidtbl = ncgidtbl; + (void) lsearch(&lc, yycgidtbl, + &local_ncgidtbl, sizeof (lchar), cmplc); + ncgidtbl = (int)local_ncgidtbl; } void diff --git a/usr/src/cmd/sgs/lex/i386/Makefile b/usr/src/cmd/sgs/lex/i386/Makefile index c8f395edfa..23cf9b00cf 100644 --- a/usr/src/cmd/sgs/lex/i386/Makefile +++ b/usr/src/cmd/sgs/lex/i386/Makefile @@ -19,7 +19,7 @@ # 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" @@ -27,7 +27,6 @@ # cmd/sgs/lex/i386/Makefile # -PROG= lex INCLIST_i386= -I. include ../../../Makefile.cmd diff --git a/usr/src/cmd/sgs/lex/sparc/Makefile b/usr/src/cmd/sgs/lex/sparc/Makefile index 6d8f3eb2ed..73f492b1e9 100644 --- a/usr/src/cmd/sgs/lex/sparc/Makefile +++ b/usr/src/cmd/sgs/lex/sparc/Makefile @@ -19,7 +19,7 @@ # 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" @@ -27,7 +27,6 @@ # cmd/sgs/lex/sparc/Makefile # -PROG= lex INCLIST_sparc= -I../common include ../../../Makefile.cmd diff --git a/usr/src/cmd/sgs/link_audit/Makefile.targ b/usr/src/cmd/sgs/link_audit/Makefile.targ index 621d5a9e85..497be808a8 100644 --- a/usr/src/cmd/sgs/link_audit/Makefile.targ +++ b/usr/src/cmd/sgs/link_audit/Makefile.targ @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 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" @@ -94,30 +94,32 @@ $(ROOTCCSLIB): $(ROOTCCSLIB64): $(INS.dir) +LINT_HDR= perl ../../tools/lint_hdr.pl + lint: - @echo "\nLint of: truss.so.1" > $(LINTOUT) - @echo "========================" >> $(LINTOUT) + $(LINT_HDR) link_audit > $(LINTOUT) + $(LINT_HDR) -s truss.so.1 >> $(LINTOUT) $(LINT.c) ../common/truss.c \ - ../common/env.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: symbindrep.so.1" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) + ../common/env.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s symbindrep.so.1 >> $(LINTOUT) $(LINT.c) ../common/symbindrep.c \ - ../common/env.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: perfcnt.so.1" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) + ../common/env.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s perfcnt.so.1 >> $(LINTOUT) $(LINT.c) ../common/perfcnt.c \ ../common/hash.c \ - ../common/env.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: who.so.1" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) + ../common/env.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s who.so.1 >> $(LINTOUT) $(LINT.c) ../common/who.c \ - ../common/env.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: dumpbind" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) - $(LINT.c) ../common/dumpbind.c >> $(LINTOUT) 2>&1 - @echo "\nLint of: bindings.so.1" >> $(LINTOUT) - @echo "========================" >> $(LINTOUT) + ../common/env.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s dumpbind >> $(LINTOUT) + $(LINT.c) ../common/dumpbind.c 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s bindings.so.1 >> $(LINTOUT) $(LINT.c) ../common/bindings.c \ - ../common/env.c >> $(LINTOUT) 2>&1 + ../common/env.c 2>&1 | tee -a $(LINTOUT) include ../../../../lib/Makefile.targ diff --git a/usr/src/cmd/sgs/m4/common/m4.c b/usr/src/cmd/sgs/m4/common/m4.c index 6e5a65e6b5..7fe98b06b7 100644 --- a/usr/src/cmd/sgs/m4/common/m4.c +++ b/usr/src/cmd/sgs/m4/common/m4.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,10 @@ #include <fcntl.h> #include "m4.h" +#if defined(__lint) +extern int yydebug; +#endif + #define match(c, s) (c == *s && (!s[1] || inpmatch(s+1))) static char tmp_name[] = "/tmp/m4aXXXXX"; @@ -49,6 +52,7 @@ static void fpath(FILE *); static void puttok(wchar_t *); static void error3(void); static wchar_t itochr(int); +/*LINTED: E_STATIC_UNUSED*/ static wchar_t *chkbltin(wchar_t *); static wchar_t *inpmatch(wchar_t *); static void chkspace(char **, int *, char ***); @@ -69,6 +73,10 @@ main(int argc, char **argv) int i, opt_end = 0; int sigs[] = {SIGHUP, SIGINT, SIGPIPE, 0}; +#if defined(__lint) + yydebug = 0; +#endif + for (i = 0; sigs[i]; ++i) { if (signal(sigs[i], SIG_IGN) != SIG_IGN) (void) signal(sigs[i], catchsig); @@ -150,12 +158,12 @@ main(int argc, char **argv) struct nlist *macadd; /* temp variable */ while ((*tp = getchr()) != WEOF && - (is_alnum(*tp) || *tp == '_')) { + (is_alnum(*tp) || *tp == '_')) { tp++; if (--tlim <= 0) error2(gettext( - "more than %d chars in word"), - toksize); + "more than %d chars in word"), + toksize); } putbak(*tp); *tp = EOS; @@ -166,8 +174,9 @@ main(int argc, char **argv) if ((wchar_t *)(++Ap) >= astklm) { --Ap; error2(gettext( - "more than %d items on argument stack"), - stksize); + "more than %d items on " + "argument stack"), + stksize); } if (Cp++ == NULL) @@ -212,8 +221,8 @@ main(int argc, char **argv) } } } else if (match(t, lcom) && - ((lcom[0] != L'#' || lcom[1] != L'\0') || - prev_char != '$')) { + ((lcom[0] != L'#' || lcom[1] != L'\0') || + prev_char != '$')) { /* * Don't expand commented macro (between lcom and @@ -272,8 +281,8 @@ main(int argc, char **argv) if ((wchar_t *)(++Ap) >= astklm) { --Ap; error2(gettext( - "more than %d items on argument stack"), - stksize); + "more than %d items on argument stack"), + stksize); } while ((t = getchr()) != WEOF && is_space(t)) @@ -507,15 +516,19 @@ expand(wchar_t **a1, int c) sp = (struct nlist *)a1[-1]; if (sp->tflag || trace) { +#if !defined(__lint) /* lint doesn't grok "%ws" */ int i; (void) fprintf(stderr, "Trace(%d): %ws", Cp-callst, a1[0]); +#endif if (c > 0) { +#if !defined(__lint) /* lint doesn't grok "%ws" */ (void) fprintf(stderr, "(%ws", chkbltin(a1[1])); for (i = 2; i <= c; ++i) (void) fprintf(stderr, ",%ws", chkbltin(a1[i])); +#endif (void) fprintf(stderr, ")"); } (void) fprintf(stderr, "\n"); diff --git a/usr/src/cmd/sgs/m4/common/m4macs.c b/usr/src/cmd/sgs/m4/common/m4macs.c index 48f3a00d53..70e13d77d3 100644 --- a/usr/src/cmd/sgs/m4/common/m4macs.c +++ b/usr/src/cmd/sgs/m4/common/m4macs.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -177,33 +176,42 @@ dodump(wchar_t **ap, int c) dump(np->name, np->def); } +/*ARGSUSED*/ static void dump(wchar_t *name, wchar_t *defnn) { wchar_t *s = defnn; +#if !defined(__lint) /* lint doesn't grok "%ws" */ (void) fprintf(stderr, "%ws:\t", name); +#endif - while (*s++); + while (*s++) + ; --s; while (s > defnn) { --s; - if (is_builtin(*s)) + if (is_builtin(*s)) { +#if !defined(__lint) /* lint doesn't grok "%ws" */ (void) fprintf(stderr, "<%ws>", - barray[builtin_idx(*s)].bname); - else { + barray[builtin_idx(*s)].bname); + } else { +#endif (void) fputwc(*s, stderr); } } (void) fputc('\n', stderr); } +/*ARGSUSED*/ static void doerrp(wchar_t **ap, int c) { +#if !defined(__lint) /* lint doesn't grok "%ws" */ if (c > 0) (void) fprintf(stderr, "%ws", ap[1]); +#endif } long evalval; /* return value from yacc stuff */ @@ -423,8 +431,8 @@ static void dosysval(wchar_t **ap, int c) { pbnum((long)(sysrval < 0 ? sysrval : - (sysrval >> 8) & ((1 << 8) - 1)) | - ((sysrval & ((1 << 8) - 1)) << 8)); + (sysrval >> 8) & ((1 << 8) - 1)) | + ((sysrval & ((1 << 8) - 1)) << 8)); } static void diff --git a/usr/src/cmd/sgs/m4/i386/Makefile b/usr/src/cmd/sgs/m4/i386/Makefile index 2e71ec1a26..eb9d756285 100644 --- a/usr/src/cmd/sgs/m4/i386/Makefile +++ b/usr/src/cmd/sgs/m4/i386/Makefile @@ -19,7 +19,7 @@ # 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" @@ -42,8 +42,12 @@ OBJS= $(COBJS:%=m4objs/%) $(YOBJS) XPG4OBJS= $(COBJS:%=m4objs.xpg4/%) $(XPG4YOBJS) ALLOBJS= $(OBJS) $(XPG4OBJS) -BLTSRCS= ../common/m4y.c ../common/m4y_xpg4.c +YBLTSRCS= ../common/m4y.c +XPG4BLTSRCS= ../common/m4y_xpg4.c +BLTSRCS= $(YBLTSRCS) $(XPG4BLTSRCS) +YSRCS= $(COBJS:%.o=../common/%.c) $(YBLTSRCS) +XPG4SRCS= $(COBJS:%.o=../common/%.c) $(XPG4BLTSRCS) SRCS= $(COBJS:%.o=../common/%.c) $(BLTSRCS) INCLIST= -I../common @@ -52,6 +56,7 @@ CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) C99MODE= $(C99_ENABLE) +LINTFLAGS += $(LDLIBS) CLEANFILES += $(LINTOUT) $(BLTSRCS) m4objs.xpg4/%.o := CPPFLAGS += -DXPG4 @@ -85,7 +90,14 @@ clean: lint: $(LINTOUT) +LINT_HDR= perl ../../tools/lint_hdr.pl + $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + $(LINT_HDR) $(PROG) > $(LINTOUT) + $(LINT_HDR) -s m4 >> $(LINTOUT) + $(LINT.c) $(YSRCS) 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "XPG m4" >> $(LINTOUT) + $(LINT.c) $(XPG4SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/m4/sparc/Makefile b/usr/src/cmd/sgs/m4/sparc/Makefile index 8673dd163a..99a71f05ca 100644 --- a/usr/src/cmd/sgs/m4/sparc/Makefile +++ b/usr/src/cmd/sgs/m4/sparc/Makefile @@ -19,7 +19,7 @@ # 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" @@ -42,8 +42,12 @@ OBJS= $(COBJS:%=m4objs/%) $(YOBJS) XPG4OBJS= $(COBJS:%=m4objs.xpg4/%) $(XPG4YOBJS) ALLOBJS= $(OBJS) $(XPG4OBJS) -BLTSRCS= ../common/m4y.c ../common/m4y_xpg4.c +YBLTSRCS= ../common/m4y.c +XPG4BLTSRCS= ../common/m4y_xpg4.c +BLTSRCS= $(YBLTSRCS) $(XPG4BLTSRCS) +YSRCS= $(COBJS:%.o=../common/%.c) $(YBLTSRCS) +XPG4SRCS= $(COBJS:%.o=../common/%.c) $(XPG4BLTSRCS) SRCS= $(COBJS:%.o=../common/%.c) $(BLTSRCS) INCLIST= -I../common @@ -52,6 +56,7 @@ CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) C99MODE= $(C99_ENABLE) +LINTFLAGS += $(LDLIBS) CLEANFILES += $(LINTOUT) $(BLTSRCS) m4objs.xpg4/%.o := CPPFLAGS += -DXPG4 @@ -84,7 +89,14 @@ clean: lint: $(LINTOUT) +LINT_HDR= perl ../../tools/lint_hdr.pl + $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + $(LINT_HDR) $(PROG) > $(LINTOUT) + $(LINT_HDR) -s m4 >> $(LINTOUT) + $(LINT.c) $(YSRCS) 2>&1 | tee -a $(LINTOUT) + + $(LINT_HDR) -s "XPG m4" >> $(LINTOUT) + $(LINT.c) $(XPG4SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 15a6bfa0f7..3e3d8d695d 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1362,3 +1362,4 @@ Bugid Risk Synopsis 6599700 librtld_db needs better plugin support (link-editor components only) 6713830 mdb dumped core reading a gcore 6712292 ld.so.1 should fall back to an interposer for failed direct bindings +6716350 usr/src/cmd/sgs should be linted by nightly builds diff --git a/usr/src/cmd/sgs/prof/common/prof.c b/usr/src/cmd/sgs/prof/common/prof.c index 90ce3ae23d..8b6dc1e660 100644 --- a/usr/src/cmd/sgs/prof/common/prof.c +++ b/usr/src/cmd/sgs/prof/common/prof.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -281,7 +281,8 @@ printSnymNames(struct slist *slp, struct snymEntry *snymp) /* for the others: find each, print each. */ while (--i >= 0) { - while ((++slp)->sl_addr != sharedaddr); + while ((++slp)->sl_addr != sharedaddr) + ; Print(", %s", slp->sl_name); } /* finally.. the trailing newline */ @@ -495,7 +496,7 @@ main(int argc, char **argv) /* Compute the file address of symbol table. Machine-dependent. */ DEBUG_EXP(printf("number of symbols (pf_nsyms) = %d\n", - filhdr.pf_nsyms)); + filhdr.pf_nsyms)); /* Number of symbols in file symbol table. */ symttl = filhdr.pf_nsyms; @@ -585,11 +586,14 @@ main(int argc, char **argv) pc_h = head.hpc; /* First address past range of profiling. */ pc_m = pc_h - pc_l; /* Range of profiled addresses. */ + /* BEGIN CSTYLED */ OLD_DEBUG(if (debug_value) Fprint(stderr, "low pc = %#o, high pc = %#o, range = %#o = %u\n\ call counts: %u, %u used; pc counters: %u\n", pc_l, pc_h, pc_m, pc_m, head.nfns, n_cc, n_pc)); + /* END CSTYLED */ + /*LINTED: E_ASSIGMENT_CAUSE_LOSS_PREC*/ sf = (BIAS * (double)n_pc)/pc_m; /* * Now adjust bias and sf so that there is no overflow @@ -603,6 +607,7 @@ pc_l, pc_h, pc_m, pc_m, head.nfns, n_cc, n_pc)); } s_inv = pc_m/n_pc; /* Range of PCs mapped into one index. */ + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value) { Fprint( @@ -611,6 +616,7 @@ OLD_DEBUG( (long)sf, s_inv, bias); } ); + /* END CSTYLED */ /* Prepare to read symbols from "a.out" (or whatever). */ n_syms = 0; /* Init count of qualified symbols. */ @@ -619,11 +625,13 @@ OLD_DEBUG( if (readnl(n)) /* Read and examine symbol, count qualifiers */ n_syms++; + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value) { Fprint(stderr, "%u symbols, %u qualify\n", symttl, n_syms); } ); + /* END CSTYLED */ /* Allocate space for qualified symbols. */ @@ -637,8 +645,8 @@ OLD_DEBUG( */ snymCapacity = n_syms/2; - snymList = snymp = _prof_Malloc(snymCapacity, - sizeof (struct snymEntry)); + snymList = snymp = + _prof_Malloc(snymCapacity, sizeof (struct snymEntry)); n_snyms = 0; /* OLD_DEBUG(debug_value &= ~020); */ @@ -656,10 +664,12 @@ OLD_DEBUG( /* set other slist fields to zero. */ slp->sl_time = 0.0; slp->sl_count = 0; + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value & 02) Fprint(stderr, "%-8.8s: %#8o\n", slp->sl_name, slp->sl_addr) ); + /* END CSTYLED */ slp++; --n; @@ -700,7 +710,7 @@ OLD_DEBUG( int sz = slp->sl_size; if (sz == 0) - sz = slp[ 1 ].sl_addr - slp->sl_addr; + sz = slp[ 1 ].sl_addr - slp->sl_addr; if (slp->sl_addr < ccp->fnpc && ccp->fnpc <= slp->sl_addr + sz) { /* got a candidate: find Closest. */ @@ -711,6 +721,7 @@ OLD_DEBUG( --n; } while (n > 0 && slp->sl_addr < ccp->fnpc); + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value & 04) { Fprint(stderr, @@ -721,6 +732,7 @@ if (debug_value & 04) { ccp->fnpc); } ); + /* END CSTYLED */ closest_symp->sl_count = ccp->mcnt; /* Copy count. */ ++ccp; --vn_cc; @@ -803,10 +815,12 @@ if (debug_value & 04) { /* Lowest addr for which count maps to pcounts[i1]. */ pc10 = pc_l + (unsigned long)((bias * i1)/sf); + /* BEGIN CSTYLED */ OLD_DEBUG(if (debug_value & 010) Fprint(stderr, "%-8.8s\ti0 = %4d, pc00 = %#6o, pc0 = %#6o\n\ \t\ti1 = %4d, pc10 = %#6o, pc1 = %#6o\n\t\t", slp[n].sl_name, i0, pc00, pc0, i1, pc10, pc1)); + /* END CSTYLED */ t = 0; /* Init time for this symbol. */ if (i0 == i1) { /* Counter overlaps two areas? (unlikely */ @@ -817,13 +831,16 @@ OLD_DEBUG(if (debug_value & 010) fprintf(stderr, "ticks = %d\n", ticks)); /* Time less that which overlaps adjacent areas */ t += PROFSEC(ticks * ((double)(pc1 - pc0) * sf)/bias); + /* BEGIN CSTYLED */ OLD_DEBUG(if (debug_value & 010) Fprint(stderr, "%ld/(%.1f)", (pc1 - pc0) * ticks, DBL_ADDRPERCELL) ); + /* END CSTYLED */ } else { /* Overlap with previous region? */ if (pc00 < pc0) { ticks = pcp[i0]; + /* BEGIN CSTYLED */ OLD_DEBUG(if (debug_value & 010) fprintf(stderr, "pc00 < pc0 ticks = %d\n", ticks)); @@ -835,9 +852,11 @@ OLD_DEBUG(if (debug_value & 010) /* Do not count this time when summing times */ /* wholly within the region. */ i0++; + /* BEGIN CSTYLED */ OLD_DEBUG(if (debug_value & 010) Fprint(stderr, "%ld/(%.1f) + ", (pc0 - pc00) * ticks, DBL_ADDRPERCELL)); + /* END CSTYLED */ } /* Init sum of counts for PCs not shared w/other */ @@ -859,11 +878,13 @@ OLD_DEBUG(if (debug_value & 010) Fprint(stderr, "%ld", ticks)); /* and accumulate proportion for addresses in */ /* range of this routine */ t += PROFSEC(((double)ticks * - (pc1 - pc10)*sf)/bias); + (pc1 - pc10)*sf)/bias); + /* BEGIN CSTYLED */ OLD_DEBUG(if (debug_value & 010) fprintf(stderr, "ticks = %d\n", ticks)); OLD_DEBUG(if (debug_value & 010) Fprint(stderr, " + %ld/(%.1f)", (pc1 - pc10) * ticks, DBL_ADDRPERCELL) ); + /* END CSTYLED */ } } /* End if (i0 == i1) ... else ... */ @@ -875,7 +896,8 @@ OLD_DEBUG(if (debug_value & 010) Fprint(stderr, " ticks = %.2f msec\n", t)); /* Final pass to total up time. */ /* Sum ticks, then convert to seconds. */ - for (n = n_pc, temp = 0; --n >= 0; temp += *(pcp++)); + for (n = n_pc, temp = 0; --n >= 0; temp += *(pcp++)) + ; t_tot = PROFSEC(temp); @@ -913,9 +935,11 @@ OLD_DEBUG(if (debug_value & 010) Fprint(stderr, " ticks = %.2f msec\n", t)); int lastWasSnym = 0; /* 1st can't be snym yet-no aliases seen! */ int thisIsSnym; + /* BEGIN CSTYLED */ OLD_DEBUG( int totsnyms = 0; int totseries = 0; struct slist *lastslp = slist; ); + /* END CSTYLED */ /* NB loop starts with 2nd symbol, loops over n_syms-1 symbols! */ for (n = n_syms-1, slp = slist+1; --n >= 0; slp++) { @@ -925,6 +949,7 @@ int totsnyms = 0; int totseries = 0; struct slist *lastslp = slist; if (thisIsSnym) { /* gotta synonym */ if (!lastWasSnym) { + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value) { Fprint(stderr, @@ -935,6 +960,7 @@ if (debug_value) { totsnyms++; } ); + /* END CSTYLED */ /* this is the Second! of a series */ snymp = (n_snyms++ == 0 ? snymList : snymp+1); snymp->howMany = 1; /* gotta count 1st one!! */ @@ -945,6 +971,7 @@ if (debug_value) { /* Offen the Reported flag */ snymp->snymReported = 0; } + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value) { Fprint(stderr, @@ -956,6 +983,7 @@ if (debug_value) { totsnyms++; } ); + /* END CSTYLED */ /* ok - bump count for snym, and note its Finding */ snymp->howMany++; /* and update the summary statistics */ @@ -965,16 +993,20 @@ if (debug_value) { callTotal += slp->sl_count; lastaddr = thisaddr; lastWasSnym = thisIsSnym; + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value) lastslp = slp; ); + /* END CSTYLED */ } + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value) { Fprint(stderr, "Total #series %d, #synonyms %d\n", totseries, totsnyms); } ); + /* END CSTYLED */ } /* * Most of the heavy work is done now. Only minor stuff remains. @@ -993,7 +1025,7 @@ OLD_DEBUG(if (debug_value) Fprint(stderr, if (sort) /* If comparison routine given then use it. */ qsort((char *)slist, (unsigned)n_syms, - sizeof (struct slist), sort); + sizeof (struct slist), sort); if (!(flags & F_NHEAD)) { if (flags & F_PADDR) @@ -1026,7 +1058,7 @@ OLD_DEBUG(if (debug_value) Fprint(stderr, continue; if ((strcmp(slp->sl_name, "_mcount") == 0) || (strcmp(slp->sl_name, "mcount") == 0)) { - count = callTotal; + count = callTotal; } /* count number of entries (i.e. symbols) printed */ @@ -1076,7 +1108,7 @@ OLD_DEBUG(if (debug_value) Fprint(stderr, _symintClose(ldptr); } else { - Fprint(stderr, "prof: no call counts captured\n"); + Fprint(stderr, "prof: no call counts captured\n"); } return (0); } @@ -1099,6 +1131,7 @@ readnl(int symindex) { nl = ldptr->pf_symarr_p[symindex]; + /* BEGIN CSTYLED */ OLD_DEBUG( if (debug_value & 020) { Fprint(stderr, @@ -1108,15 +1141,16 @@ OLD_DEBUG( nl.ps_sym.st_value); } ); + /* END CSTYLED */ + /* * TXTSYM accepts global (and local, if "-g" given) T-type symbols. * Only those in the profiling range are useful. */ return (nl.ps_sym.st_shndx < SHN_LORESERVE && - TXTSYM(nl.ps_sym.st_shndx, - nl.ps_sym.st_info) && - (pc_l <= (char *)nl.ps_sym.st_value) && - ((char *)nl.ps_sym.st_value < pc_h)); + TXTSYM(nl.ps_sym.st_shndx, nl.ps_sym.st_info) && + (pc_l <= (char *)nl.ps_sym.st_value) && + ((char *)nl.ps_sym.st_value < pc_h)); } /* * Error-checking memory allocators - @@ -1166,7 +1200,8 @@ basename(char *s) while (p > s && *--p == '/') /* Trim trailing '/'s. */ *p = '\0'; p++; /* New end (+1) of string. */ - while (p > s && *--p != '/'); /* Break backward on '/'. */ + while (p > s && *--p != '/') /* Break backward on '/'. */ + ; if (*p == '/') /* If found '/', point to 1st following. */ p++; if (*p == '\0') @@ -1282,7 +1317,7 @@ demangled_name(char *s) char *name; size_t len; - name = (char *)sgs_demangle(s); + name = sgs_demangle(s); if (strcmp(name, s) == 0) return (s); diff --git a/usr/src/cmd/sgs/prof/common/symintLoad.c b/usr/src/cmd/sgs/prof/common/symintLoad.c index e29683936a..b852f84321 100644 --- a/usr/src/cmd/sgs/prof/common/symintLoad.c +++ b/usr/src/cmd/sgs/prof/common/symintLoad.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -120,7 +120,6 @@ _symintLoad(PROF_FILE *proffilePtr) { Elf_Data *symdat_pri_p; Elf_Data *symdat_aux_p; - size_t nsyms_pri; PROF_SYMBOL *symlist; DEBUG_LOC("_symintLoad: top"); @@ -141,7 +140,6 @@ _symintLoad(PROF_FILE *proffilePtr) symdat_pri_p = profPtr->pf_symdat_pri_p; symdat_aux_p = profPtr->pf_symdat_aux_p; - nsyms_pri = profPtr->pf_nstsyms - profPtr->pf_nstsyms_aux; DEBUG_EXP(printf("symdat_pri_p->d_size = %x\n", symdat_pri_p->d_size)); prstsym_size = (symdat_pri_p->d_size / profPtr->pf_nstsyms); diff --git a/usr/src/cmd/sgs/prof/common/symintOpen.c b/usr/src/cmd/sgs/prof/common/symintOpen.c index 97ba51c6a8..5d12f5a012 100644 --- a/usr/src/cmd/sgs/prof/common/symintOpen.c +++ b/usr/src/cmd/sgs/prof/common/symintOpen.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -184,10 +184,10 @@ _symintOpen(char *aout_name) if (elf32_getshdr(tscn_p) == NULL) _err_exit("%s %s in %s.", fail_shd_s, "header names", - aout_name); + aout_name); if ((pfile_p->pf_snmdat_p = elf_getdata(tscn_p, NULL)) == NULL) _err_exit("%s %s in %s.", fail_dat_s, "header names", - aout_name); + aout_name); DEBUG_EXP(printf("Address of data header = 0x%lx\n", pfile_p->pf_snmdat_p)); @@ -214,12 +214,13 @@ _symintOpen(char *aout_name) pfile_p->pf_elfhd_p->e_shnum); { +#ifdef DEBUG char *shdnms_p = (char *)pfile_p->pf_snmdat_p->d_buf; +#endif char *dest_p = (char *)pfile_p->pf_shdarr_p; int shdsize = pfile_p->pf_elfhd_p->e_shentsize; - int i; - char *s; + int i = 0; int symtab_found = 0; tscn_p = 0; @@ -237,14 +238,15 @@ _symintOpen(char *aout_name) while ((tscn_p = elf_nextscn(telf_p, tscn_p)) != NULL) { if ((tshd_p = elf32_getshdr(tscn_p)) == NULL) _err_exit("%s %d in %s.", fail_shd_s, i, aout_name); + i++; (void) memcpy(dest_p, tshd_p, shdsize); dest_p += shdsize; - s = &shdnms_p[tshd_p->sh_name]; DEBUG_EXP(printf("index of section name = %d\n", tshd_p->sh_name)); - DEBUG_EXP(printf("_symintOpen: reading section %s\n", s)); + DEBUG_EXP(printf("_symintOpen: reading section %s\n", + &shdnms_p[tshd_p->sh_name])); if (symtab_found) continue; diff --git a/usr/src/cmd/sgs/prof/i386/Makefile b/usr/src/cmd/sgs/prof/i386/Makefile index 47ecdbdc3f..9e27b8ee4c 100644 --- a/usr/src/cmd/sgs/prof/i386/Makefile +++ b/usr/src/cmd/sgs/prof/i386/Makefile @@ -21,7 +21,7 @@ # # ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/prof/i386/Makefile @@ -37,14 +37,14 @@ COMOBJS= prof.o profv.o lookup.o rdelf.o \ OBJS= $(COMOBJS) SRCS= $(COMOBJS:%.o=../common/%.c) - + INCLIST= -I../common -I../../include -I../../include/i386 DEFLIST= -DI386 -DELF CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) C99MODE= $(C99_ENABLE) -LDLIBS += ../../sgsdemangler/$(MACH)/libdemangle.a -lelf +LDLIBS += -L../../sgsdemangler/$(MACH) -ldemangle -lelf LINTFLAGS += $(LDLIBS) CLEANFILES += $(LINTOUT) @@ -67,6 +67,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/prof/sparc/Makefile b/usr/src/cmd/sgs/prof/sparc/Makefile index c0d3e5f517..da8dc6b58b 100644 --- a/usr/src/cmd/sgs/prof/sparc/Makefile +++ b/usr/src/cmd/sgs/prof/sparc/Makefile @@ -21,7 +21,7 @@ # # ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/prof/sparc/Makefile @@ -37,14 +37,14 @@ COMOBJS= prof.o profv.o lookup.o rdelf.o \ OBJS= $(COMOBJS) SRCS= $(COMOBJS:%.o=../common/%.c) - + INCLIST= -I../common -I../../include -I../../include/sparc DEFLIST= -DSPARC -DELF CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) C99MODE= $(C99_ENABLE) -LDLIBS += ../../sgsdemangler/$(MACH)/libdemangle.a -lelf +LDLIBS += -L../../sgsdemangler/$(MACH) -ldemangle -lelf LINTFLAGS += $(LDLIBS) CLEANFILES += $(LINTOUT) @@ -67,6 +67,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) >> $(LINTOUT) 2>&1 include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/sgsdemangler/Makefile.targ b/usr/src/cmd/sgs/sgsdemangler/Makefile.targ index e6c1070b7d..cafe981fee 100644 --- a/usr/src/cmd/sgs/sgsdemangler/Makefile.targ +++ b/usr/src/cmd/sgs/sgsdemangler/Makefile.targ @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2006 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" @@ -32,6 +32,8 @@ objs/demangle.o: \ lint: $(LINTOUT) $(LINTOUT): ../common/llib-ldemangle - $(LINT.c) -odemangle ../common/llib-ldemangle > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(LIBRARY) > $(LINTOUT) + $(LINT.c) -odemangle ../common/llib-ldemangle \ + 2>&1 | tee -a $(LINTOUT) include $(SRC)/lib/Makefile.targ diff --git a/usr/src/cmd/sgs/size/Makefile.com b/usr/src/cmd/sgs/size/Makefile.com new file mode 100644 index 0000000000..e28c593b0a --- /dev/null +++ b/usr/src/cmd/sgs/size/Makefile.com @@ -0,0 +1,49 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +PROG= size + +include $(SRC)/cmd/Makefile.cmd +include $(SRC)/cmd/sgs/Makefile.com + +COMOBJS= main.o process.o fcns.o + +SRCS= $(COMOBJS:%.o=../common/%.c) + +OBJS = $(COMOBJS) +.PARALLEL: $(OBJS) + +LLDFLAGS = '$(LDPASS)-R$$ORIGIN/../../lib' +LLDFLAGS64 = '$(LDPASS)-R$$ORIGIN/../../../lib/$(MACH64)' +LDFLAGS += $(LLDFLAGS) + +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf + +LINTSRCS = $(SRCS) + +CLEANFILES += $(OBJS) $(LINTOUTS) diff --git a/usr/src/cmd/sgs/size/Makefile.targ b/usr/src/cmd/sgs/size/Makefile.targ new file mode 100644 index 0000000000..0e21458b68 --- /dev/null +++ b/usr/src/cmd/sgs/size/Makefile.targ @@ -0,0 +1,48 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +%.o: ../common/%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + +$(PROG): $(OBJS) + $(LINK.c) $(OBJS) -o $@ $(LDLIBS) + $(POST_PROCESS) + +all: $(PROG) + +package \ +install: all $(VAR_SGSBINPROG) $(VAR_SGSCCSLINK) + +clean: + $(RM) $(CLEANFILES) + +delete: + $(RM) $(PROG) + +include $(SRC)/cmd/Makefile.targ +include $(SRC)/cmd/sgs/Makefile.targ diff --git a/usr/src/cmd/sgs/size/amd64/Makefile b/usr/src/cmd/sgs/size/amd64/Makefile index 15f835c026..f3bc731fb9 100644 --- a/usr/src/cmd/sgs/size/amd64/Makefile +++ b/usr/src/cmd/sgs/size/amd64/Makefile @@ -19,52 +19,30 @@ # 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" # -PROG= size +include ../Makefile.com -include ../../../Makefile.cmd -include ../../Makefile.com - -OBJS= main.o process.o fcns.o - -SRCS= $(OBJS:%.o=../common/%.c) - -LDFLAGS += '-R$$ORIGIN/../../../lib/$(MACH64)' -INCLIST= -I../common -I../../include -I../../include/i386 \ - -I$(SRCBASE)/uts/$(ARCH)/sys -DEFLIST= -DSPARC -DELF -CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L../../libconv/amd64 -lconv -lelf -LINTFLAGS64= -mx -D__amd64 -errchk=longptr64 $(LDLIBS) - -CLEANFILES += $(LINTOUT) - -%.o: ../common/%.c - $(COMPILE.c) $< +DEFLIST= -DAMD64 -DELF .KEEP_STATE: -all: $(PROG) +LLDFLAGS = $(LLDFLAGS64) +ELFLIBDIR = $(ELFLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) + +VAR_SGSBINPROG= $(VAR_SGSBINPROG64) +VAR_SGSCCSLINK= $(VAR_SGSCCSLINK64) -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) package \ install: all $(ROOTPROG64) $(ROOTCCSBINLINK64) -clean: - $(RM) $(OBJS) $(CLEANFILES) - -lint: $(LINTOUT) - -$(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 +lint: $(LINTOUT64) $(SGSLINTOUT) -include ../../../Makefile.targ +include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/size/common/main.c b/usr/src/cmd/sgs/size/common/main.c index da6a54af99..486dc34f63 100644 --- a/usr/src/cmd/sgs/size/common/main.c +++ b/usr/src/cmd/sgs/size/common/main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -25,7 +24,7 @@ * All Rights Reserved * * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -119,7 +118,7 @@ main(int argc, char ** argv, char ** envp) /* * Check for a binary that better fits this architecture. */ - conv_check_native(argv, envp); + (void) conv_check_native(argv, envp); tool_name = argv[0]; @@ -201,35 +200,39 @@ main(int argc, char ** argv, char ** envp) if (elf_kind(arf) == ELF_K_AR) { archive = argv[optind]; } else { - archive = ""; + archive = ""; } while ((elf = elf_begin(fd, cmd, arf)) != 0) { - if ((arhdr = elf_getarhdr(elf)) == 0) { - if (elf_kind(arf) == ELF_K_NONE) { - (void) fprintf(stderr, - "%s: %s: invalid file type\n", - tool_name, fname); - exitcode++; - break; - } else { - process(elf); + if ((arhdr = elf_getarhdr(elf)) == 0) { + if (elf_kind(arf) == ELF_K_NONE) { + /* BEGIN CSTYLED */ + (void) fprintf(stderr, + "%s: %s: invalid file type\n", + tool_name, fname); + /* END CSTYLED */ + exitcode++; + break; + } else { + process(elf); + } + } else if (arhdr->ar_name[0] != '/') { + fname = arhdr->ar_name; + if (elf_kind(arf) == ELF_K_NONE) { + /* BEGIN CSTYLED */ + (void) fprintf(stderr, + "%s: %s[%s]: invalid file type\n", + tool_name, archive, fname); + /* END CSTYLED */ + exitcode++; + break; + } else { + is_archive++; + process(elf); + } } - } else if (arhdr->ar_name[0] != '/') { - fname = arhdr->ar_name; - if (elf_kind(arf) == ELF_K_NONE) { - (void) fprintf(stderr, - "%s: %s[%s]: invalid file type\n", - tool_name, archive, fname); - exitcode++; - break; - } else { - is_archive++; - process(elf); - } - } - cmd = elf_next(elf); - (void) elf_end(elf); + cmd = elf_next(elf); + (void) elf_end(elf); } (void) elf_end(arf); (void) close(fd); diff --git a/usr/src/cmd/sgs/size/i386/Makefile b/usr/src/cmd/sgs/size/i386/Makefile index 678a3680ac..7ec19dfd55 100644 --- a/usr/src/cmd/sgs/size/i386/Makefile +++ b/usr/src/cmd/sgs/size/i386/Makefile @@ -21,57 +21,21 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/size/i386/Makefile # -PROG= size +include ../Makefile.com -include ../../../Makefile.cmd -include ../../Makefile.com - -OBJS= main.o process.o fcns.o - -SRCS= $(OBJS:%.o=../common/%.c) - -LDFLAGS += '-R$$ORIGIN/../../lib' -INCLIST= -I../common -I../../include -I../../include/i386 \ - -I$(SRCBASE)/uts/$(ARCH)/sys DEFLIST= -DI386 -DELF -CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L../../libconv/i386 -lconv -lelf -LINTFLAGS += $(LDLIBS) - -CLEANFILES += $(LINTOUT) - -# Building SUNWonld results in a call to the `package' target. Requirements -# needed to run this application on older releases are established: -# i18n support requires libintl.so.1 prior to 2.6 - -package := LDLIBS += /usr/lib/libintl.so.1 - -%.o: ../common/%.c - $(COMPILE.c) $< .KEEP_STATE: -all: $(PROG) - -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) - package \ install: all $(ROOTPROG) $(ROOTCCSBINLINK) -clean: - $(RM) $(OBJS) $(CLEANFILES) - -lint: $(LINTOUT) - -$(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 +lint: $(LINTOUT32) $(SGSLINTOUT) -include ../../../Makefile.targ +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/size/sparc/Makefile b/usr/src/cmd/sgs/size/sparc/Makefile index b4c7bad0b8..633e2a4978 100644 --- a/usr/src/cmd/sgs/size/sparc/Makefile +++ b/usr/src/cmd/sgs/size/sparc/Makefile @@ -21,59 +21,21 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/size/sparc/Makefile # -PROG= size +include ../Makefile.com -include ../../../Makefile.cmd -include ../../Makefile.com - -OBJS= main.o process.o fcns.o - -SRCS= $(OBJS:%.o=../common/%.c) - -LDFLAGS += '-R$$ORIGIN/../../lib' -INCLIST= -I../common -I../../include -I../../include/sparc \ - -I$(SRCBASE)/uts/$(ARCH)/sys DEFLIST= -DSPARC -DELF -CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L../../libconv/sparc -lconv -lelf -LINTFLAGS= -mx $(LDLIBS) - -CLEANFILES += $(LINTOUT) - - -# Building SUNWonld results in a call to the `package' target. Requirements -# needed to run this application on older releases are established: -# i18n support requires libintl.so.1 prior to 2.6 - -package := LDLIBS += /usr/lib/libintl.so.1 - - -%.o: ../common/%.c - $(COMPILE.c) $< .KEEP_STATE: -all: $(PROG) - -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) - package \ install: all $(ROOTPROG) $(ROOTCCSBINLINK) -clean: - $(RM) $(OBJS) $(CLEANFILES) - -lint: $(LINTOUT) - -$(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 +lint: $(LINTOUT32) $(SGSLINTOUT) -include ../../../Makefile.targ +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/size/sparcv9/Makefile b/usr/src/cmd/sgs/size/sparcv9/Makefile index 1fa04a3271..2232f6c414 100644 --- a/usr/src/cmd/sgs/size/sparcv9/Makefile +++ b/usr/src/cmd/sgs/size/sparcv9/Makefile @@ -19,7 +19,7 @@ # 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" @@ -27,46 +27,23 @@ # cmd/sgs/size/sparcv9/Makefile # -PROG= size +include ../Makefile.com -include ../../../Makefile.cmd -include ../../Makefile.com - -OBJS= main.o process.o fcns.o - -SRCS= $(OBJS:%.o=../common/%.c) - -LDFLAGS += '-R$$ORIGIN/../../../lib/$(MACH64)' -INCLIST= -I../common -I../../include -I../../include/sparc \ - -I$(SRCBASE)/uts/$(ARCH)/sys DEFLIST= -DSPARC -DELF -CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L../../libconv/sparcv9 -lconv -lelf -LINTFLAGS64= -mx -Xarch=v9 $(LDLIBS) - -CLEANFILES += $(LINTOUT) - -%.o: ../common/%.c - $(COMPILE.c) $< .KEEP_STATE: -all: $(PROG) +LLDFLAGS = $(LLDFLAGS64) +ELFLIBDIR = $(ELFLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) +VAR_SGSBINPROG= $(VAR_SGSBINPROG64) +VAR_SGSCCSLINK= $(VAR_SGSCCSLINK64) package \ install: all $(ROOTPROG64) $(ROOTCCSBINLINK64) -clean: - $(RM) $(OBJS) $(CLEANFILES) - -lint: $(LINTOUT) - -$(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 +lint: $(LINTOUT64) $(SGSLINTOUT) -include ../../../Makefile.targ +include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/tools/bld_lint.sh b/usr/src/cmd/sgs/tools/bld_lint.sh index 826d164ac6..730a3fb9ee 100644 --- a/usr/src/cmd/sgs/tools/bld_lint.sh +++ b/usr/src/cmd/sgs/tools/bld_lint.sh @@ -21,7 +21,7 @@ # # -# Copyright 2006 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" @@ -67,7 +67,7 @@ do fi # Concatinate the lint.out to our log file. - echo $ii/$MACH >> $LOG +# echo $ii/$MACH >> $LOG echo $DASHES >> $LOG cat $ii/$MACH/lint.out >> $LOG echo "\n" >> $LOG @@ -75,7 +75,7 @@ do # If there is a 64-bit directory, tack that on as well. if [ -f $ii/$MACH64/lint.out ] then - echo $ii/$MACH64 >> $LOG +# echo $ii/$MACH64 >> $LOG echo $DASHES >> $LOG cat $ii/$MACH64/lint.out >> $LOG echo "\n" >> $LOG diff --git a/usr/src/cmd/sgs/tools/lint_hdr.pl b/usr/src/cmd/sgs/tools/lint_hdr.pl new file mode 100644 index 0000000000..078a6c2a8c --- /dev/null +++ b/usr/src/cmd/sgs/tools/lint_hdr.pl @@ -0,0 +1,110 @@ +#!/usr/bin/perl + +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# +#ident "%Z%%M% %I% %E% SMI" + + +# +# Generate a header for lint output for subdirectories of +# usr/src/cmd/sgs, of the form: +# +# lint_hdr [-s] target_file [elfclass] +# +# where: +# target - Name of main target (library or program name) +# elfclass - If present, 32 or 64, giving the ELFCLASS of +# the code being linted. +# +# The resulting header looks like the following: +# +# [elfclass - ]target [sgssubdir] +# ---------------------------------------------------- +# +# If the elfclass is omitted, then the header does not include +# it. If the target matches 'dirname sgssubdir', then sgssubdir +# is displayed without the target and without the square brackets. +# +# The -s option specifies that this is a sub-header, used when +# multiple lints are done within a single target. If -s is specified, +# the sgssubdir is not shown (presumably it was already shown in an earlier +# call to link_hdr), and a shorter dashed line is used: +# +# [elfclass - ]target +# ======================== +# + +use warnings; +use strict; +use Cwd; + +use vars qw($script $usage $dir $argc $target $elfclass); +use vars qw($sub); + +$script = 'lint_hdr'; +$usage = "usage: $script target [elfclass]\n"; + +$sub = 0; +while ($_ = $ARGV[0],/^-/) { + ARG: { + if (/^-s$/) { + $sub = 1; + last ARG; + } + + # If it gets here, it's an unknown option + die $usage; + } + shift; +} + +$argc = scalar(@ARGV); +die $usage if (($argc < 1) || ($argc > 2)); +$target = $ARGV[0]; +$elfclass = ($argc == 2) ? "Elf$ARGV[1] - " : ''; + +if ($sub) { + print "\n$elfclass$target\n========================\n"; + exit 0; +} + +# Clip the path up through ..sgs/, leaving the path from sgs to current dir +$dir = getcwd(); +$dir = "$1" if $dir =~ /\/sgs\/(.*)$/; + +# Normally, we format the target and directory like this: +# target [dir] +# However, if this is the special case where $dir is equal to +# prog/mach +# and prog matches our target name, then just show dir without brackets. +if (($dir =~ /^([^\/]+)\/[^\/]+$/) && ($1 eq $target)) { + $target = ''; +} else { + $dir = " [$dir]"; +} + +print "\n$elfclass$target$dir\n"; +print "------------------------------------------------------------\n"; + +exit 0; diff --git a/usr/src/cmd/sgs/tsort/i386/Makefile b/usr/src/cmd/sgs/tsort/i386/Makefile index decaae7b87..a01e70f078 100644 --- a/usr/src/cmd/sgs/tsort/i386/Makefile +++ b/usr/src/cmd/sgs/tsort/i386/Makefile @@ -22,7 +22,7 @@ #ident "%Z%%M% %I% %E% SMI" # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/tsort/i386/Makefile @@ -64,6 +64,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/tsort/sparc/Makefile b/usr/src/cmd/sgs/tsort/sparc/Makefile index 0708d4ef15..289a26aa1d 100644 --- a/usr/src/cmd/sgs/tsort/sparc/Makefile +++ b/usr/src/cmd/sgs/tsort/sparc/Makefile @@ -22,7 +22,7 @@ #ident "%Z%%M% %I% %E% SMI" # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/tsort/sparc/Makefile @@ -64,6 +64,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/unifdef/i386/Makefile b/usr/src/cmd/sgs/unifdef/i386/Makefile index cda2605807..8c61cd7c65 100644 --- a/usr/src/cmd/sgs/unifdef/i386/Makefile +++ b/usr/src/cmd/sgs/unifdef/i386/Makefile @@ -21,7 +21,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/unifdef/i386/Makefile @@ -62,6 +62,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/unifdef/sparc/Makefile b/usr/src/cmd/sgs/unifdef/sparc/Makefile index cdcd2d38f5..55b099b227 100644 --- a/usr/src/cmd/sgs/unifdef/sparc/Makefile +++ b/usr/src/cmd/sgs/unifdef/sparc/Makefile @@ -21,7 +21,7 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/unifdef/sparc/Makefile @@ -62,6 +62,7 @@ clean: lint: $(LINTOUT) $(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 + perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) + $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/yacc/Makefile.com b/usr/src/cmd/sgs/yacc/Makefile.com index 6b70a103ec..009a2d41fa 100644 --- a/usr/src/cmd/sgs/yacc/Makefile.com +++ b/usr/src/cmd/sgs/yacc/Makefile.com @@ -19,12 +19,14 @@ # 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" # +PROG= yacc + COMOBJS= y1.o y2.o y3.o y4.o POBJECTS= $(COMOBJS) POBJS= $(POBJECTS:%=objs/%) @@ -42,8 +44,9 @@ SRCDIR = ../common # Override default source file derivation rule (in Makefile.lib) # from objects # -SRCS= $(COMOBJS:%.o=../common/%.c) \ - $(OBJECTS:%.o=../common/%.c) +COMSRCS= $(COMOBJS:%.o=../common/%.c) +LIBSRCS= $(OBJECTS:%.o=../common/%.c) +SRCS= $(COMSRCS) $(LIBSRCS) LIBS = $(DYNLIB) $(LINTLIB) @@ -58,8 +61,8 @@ INCLIST= -I../../include -I../../include/$(MACH) CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) LDLIBS= $(LDLIBS.cmd) BUILD.AR= $(AR) $(ARFLAGS) $@ `$(LORDER) $(OBJS) | $(TSORT)` -LINTFLAGS= -ax -LINTPOUT= lintp.out +LINTFLAGS= -amux +LINTPOUT= lint.out C99MODE= $(C99_ENABLE) CFLAGS += $(CCVERBOSE) @@ -78,5 +81,5 @@ DYNLINKLIB= $(LIBLINKS:%=$(DYNLINKLIBDIR)/%) $(DYNLIB) := LDLIBS += -lc -CLEANFILES += $(LINTPOUT) $(LINTOUT) +CLEANFILES += $(LINTPOUT) CLOBBERFILES += $(LIBS) $(LIBRARY) diff --git a/usr/src/cmd/sgs/yacc/Makefile.targ b/usr/src/cmd/sgs/yacc/Makefile.targ index 10d3374c24..87f8c5221e 100644 --- a/usr/src/cmd/sgs/yacc/Makefile.targ +++ b/usr/src/cmd/sgs/yacc/Makefile.targ @@ -19,7 +19,7 @@ # 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" @@ -87,8 +87,17 @@ clean: lint: $(LINTPOUT) $(LINTLIB) + +LINT_HDR= perl ../../tools/lint_hdr.pl + $(LINTPOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTPOUT) 2>&1 + $(LINT_HDR) $(PROG) > $(LINTPOUT) + $(LINT_HDR) -s yacc >> $(LINTPOUT) + $(LINT.c) $(COMSRCS) $(LDLIBS) 2>&1 | tee -a $(LINTPOUT) + + $(LINT_HDR) -s liby.so.1 >> $(LINTPOUT) + $(LINT.c) $(LIBSRCS) $(LDLIBS) 2>&1 | tee -a $(LINTPOUT) + $(LINTLIB): $(LINTSRCS) - $(LINT.c) -o $(LIBNAME) $(LINTSRCS) > $(LINTOUT) 2>&1 + $(LINT.c) -o $(LIBNAME) $(LINTSRCS) diff --git a/usr/src/cmd/sgs/yacc/common/dextern.h b/usr/src/cmd/sgs/yacc/common/dextern.h index 20d44fea43..e90aa60468 100644 --- a/usr/src/cmd/sgs/yacc/common/dextern.h +++ b/usr/src/cmd/sgs/yacc/common/dextern.h @@ -19,7 +19,7 @@ * 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. */ @@ -327,6 +327,24 @@ extern char *parser; #define PARSER "/usr/share/lib/ccs/yaccpar" #endif +/* + * Lint is unable to properly handle formats with wide strings + * (e.g. %ws) and misdiagnoses them as being malformed. + * This macro is used to work around that, by substituting + * a pointer to a null string when compiled by lint. This + * trick works because lint is not able to evaluate the + * variable. + * + * When lint is able to handle %ws, it would be appropriate + * to come back through and remove the use of this macro. + */ +#if defined(__lint) +static const char *lint_ws_fmt = ""; +#define WSFMT(_fmt) lint_ws_fmt +#else +#define WSFMT(_fmt) _fmt +#endif + #ifdef __cplusplus } #endif diff --git a/usr/src/cmd/sgs/yacc/common/libmai.c b/usr/src/cmd/sgs/yacc/common/libmai.c index dc089d5698..cf969f0f50 100644 --- a/usr/src/cmd/sgs/yacc/common/libmai.c +++ b/usr/src/cmd/sgs/yacc/common/libmai.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -39,7 +38,7 @@ extern int yyparse(void); int main(int argc, char **argv) { - setlocale(LC_ALL, ""); + (void) setlocale(LC_ALL, ""); yyparse(); return (0); } diff --git a/usr/src/cmd/sgs/yacc/common/libzer.c b/usr/src/cmd/sgs/yacc/common/libzer.c index 3cdee7811d..01ba9e29bd 100644 --- a/usr/src/cmd/sgs/yacc/common/libzer.c +++ b/usr/src/cmd/sgs/yacc/common/libzer.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -24,7 +23,7 @@ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -41,5 +40,5 @@ yyerror(s) char *s; #endif { - fprintf(stderr, "%s\n", s); + (void) fprintf(stderr, "%s\n", s); } diff --git a/usr/src/cmd/sgs/yacc/common/y1.c b/usr/src/cmd/sgs/yacc/common/y1.c index 78bf9eb4c6..845f82d367 100644 --- a/usr/src/cmd/sgs/yacc/common/y1.c +++ b/usr/src/cmd/sgs/yacc/common/y1.c @@ -19,7 +19,7 @@ * 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. */ @@ -110,7 +110,7 @@ extern int nprodsz; int main(int argc, char *argv[]) { - setlocale(LC_ALL, ""); + (void) setlocale(LC_ALL, ""); #if !defined(TEXT_DOMAIN) /* Should be defined by cc -D */ #define TEXT_DOMAIN "SYS_TEST" /* Use this only if it weren't */ #endif @@ -283,7 +283,7 @@ others() ZAPFILE(DEBUGNAME); if (gen_lines) - fprintf(ftable, "# line\t1 \"%s\"\n", parser); + (void) fprintf(ftable, "# line\t1 \"%s\"\n", parser); tmpline = 1; /* copy parser text */ while ((c = getwc(finput)) != EOF) { @@ -310,7 +310,7 @@ others() (void) putwc(c, ftable); (void) fclose(faction); if (gen_lines) - fprintf(ftable, + (void) fprintf(ftable, "\n# line\t%d \"%s\"", tmpline, parser); @@ -483,6 +483,7 @@ summary() } /* write out error comment */ +/*PRINTFLIKE1*/ void error(char *s, ...) { @@ -523,6 +524,7 @@ error(char *s, ...) /* * Print out a warning message. */ +/*PRINTFLIKE2*/ void warning(int flag, char *s, ...) { @@ -595,7 +597,8 @@ LOOKSETS *p; (void) fprintf(foutput, " { "); TLOOP(j) { if (BIT(pp, j)) - (void) fprintf(foutput, "%ws ", symnam(j)); + (void) fprintf(foutput, WSFMT("%ws "), + symnam(j)); } (void) fprintf(foutput, "}"); } @@ -728,7 +731,8 @@ cpfir() return; if ((foutput != NULL)) { NTLOOP(i) { - (void) fprintf(foutput, "\n%ws: ", nontrst[i].name); + (void) fprintf(foutput, WSFMT("\n%ws: "), + nontrst[i].name); prlook(pfirst[i]); (void) fprintf(foutput, " %d\n", pempty[i]); } @@ -830,7 +834,7 @@ LOOKSETS *lptr; if (pidebug && (foutput != NULL)) (void) fprintf(foutput, - "putitem(%ws), state %d\n", writem(ptr), nstate); + WSFMT("putitem(%ws), state %d\n"), writem(ptr), nstate); j = pstate[nstate+1]; j->pitem = ptr; if (!nolook) @@ -927,7 +931,7 @@ again: if (pempty[*prdptr[i]-NTBASE] == WHOKNOWS) { for (p = prdptr[i]+1; *p >= NTBASE && pempty[*p-NTBASE] == EMPTY; ++p) - /* EMPTY */; + ; /* we have a nontrivially empty nonterminal */ if (*p < 0) { pempty[*prdptr[i]-NTBASE] = EMPTY; @@ -996,7 +1000,7 @@ stagen() NTLOOP(j) { if (temp1[j]) (void) fprintf(foutput, - "%ws %d, ", nontrst[j].name, + WSFMT("%ws %d, "), nontrst[j].name, temp1[j]); } (void) fprintf(foutput, "\n"); @@ -1130,7 +1134,8 @@ closure(int i) if (u->flag) (void) fprintf(foutput, "flag set!\n"); u->flag = 0; - (void) fprintf(foutput, "\t%ws", writem(u->pitem)); + (void) fprintf(foutput, WSFMT("\t%ws"), + writem(u->pitem)); prlook(&u->ws); (void) fprintf(foutput, "\n"); } diff --git a/usr/src/cmd/sgs/yacc/common/y2.c b/usr/src/cmd/sgs/yacc/common/y2.c index d8dfe019a1..3599d40904 100644 --- a/usr/src/cmd/sgs/yacc/common/y2.c +++ b/usr/src/cmd/sgs/yacc/common/y2.c @@ -272,10 +272,10 @@ char *argv[]; * Open y.output if -v is specified */ if (options & v_FLAG) { - strncpy(fname, + (void) strncpy(fname, file_prefix, F_NAME_LENGTH-strlen(".output")); - strcat(fname, ".output"); + (void) strcat(fname, ".output"); foutput = fopen(fname, "w"); if (foutput == NULL) error(gettext( @@ -286,10 +286,10 @@ char *argv[]; * Open y.tab.h if -d is specified */ if (options & d_FLAG) { - strncpy(fname, + (void) strncpy(fname, file_prefix, F_NAME_LENGTH-strlen(".tab.h")); - strcat(fname, ".tab.h"); + (void) strcat(fname, ".tab.h"); fdefine = fopen(fname, "w"); if (fdefine == NULL) error(gettext( @@ -308,10 +308,10 @@ char *argv[]; /* * Open y.tab.c */ - strncpy(fname, + (void) strncpy(fname, file_prefix, F_NAME_LENGTH-strlen(".tab.c")); - strcat(fname, ".tab.c"); + (void) strcat(fname, ".tab.c"); ftable = fopen(fname, "w"); if (ftable == NULL) error(gettext( @@ -1064,7 +1064,7 @@ defout() cp = tokset[i].name; if (*cp == L' ') /* literals */ { - (void) fprintf(fdebug, "\t\"%ws\",\t%d,\n", + (void) fprintf(fdebug, WSFMT("\t\"%ws\",\t%d,\n"), tokset[i].name + 1, tokset[i].value); continue; /* was cp++ */ } @@ -1078,14 +1078,14 @@ defout() } (void) fprintf(fdebug, - "\t\"%ws\",\t%d,\n", tokset[i].name, + WSFMT("\t\"%ws\",\t%d,\n"), tokset[i].name, tokset[i].value); (void) fprintf(ftable, - "# define %ws %d\n", tokset[i].name, + WSFMT("# define %ws %d\n"), tokset[i].name, tokset[i].value); if (fdefine != NULL) (void) fprintf(fdefine, - "# define %ws %d\n", + WSFMT("# define %ws %d\n"), tokset[i].name, tokset[i].value); @@ -1488,7 +1488,7 @@ swt: if (tok < 0) tok = fdtype(*prdptr[nprod]); (void) fprintf(faction, - ".%ws", typeset[tok]); + WSFMT(".%ws"), typeset[tok]); } goto loop; } @@ -1553,7 +1553,8 @@ swt: /* CSTYLED */ fdtype(prdptr[nprod][i]); (void) fprintf(faction, - ".%ws", typeset[tok]); + WSFMT(".%ws"), + typeset[tok]); } goto swt; } @@ -1563,7 +1564,7 @@ swt: * (Likely id with $ in.) * If non-terminal is added, remove it from the list. */ - fprintf(faction, "$%ws", tokname); + (void) fprintf(faction, WSFMT("$%ws"), tokname); /* * TRANSLATION_NOTE -- This is a message from yacc. * This message is passed to warning() function. @@ -1612,7 +1613,7 @@ swt: if (tok < 0) tok = fdtype(prdptr[nprod][j+offset]); (void) fprintf(faction, - ".%ws", typeset[tok]); + WSFMT(".%ws"), typeset[tok]); } goto swt; } @@ -1857,7 +1858,7 @@ lrprnt() /* print out the left and right hand sides */ else rhs = m_rhs; } - (void) fprintf(fdebug, "\t\"%ws :%ws\",\n", lhstext, rhs); + (void) fprintf(fdebug, WSFMT("\t\"%ws :%ws\",\n"), lhstext, rhs); if (m_rhs) free(m_rhs); } @@ -2090,6 +2091,6 @@ put_prefix_define(char *pre) int i; for (i = 0; syms[i]; i++) - fprintf(ftable, "#define\tyy%s\t%s%s\n", + (void) fprintf(ftable, "#define\tyy%s\t%s%s\n", syms[i], pre, syms[i]); } diff --git a/usr/src/cmd/sgs/yacc/common/y3.c b/usr/src/cmd/sgs/yacc/common/y3.c index 6213c9fe01..6cb3016370 100644 --- a/usr/src/cmd/sgs/yacc/common/y3.c +++ b/usr/src/cmd/sgs/yacc/common/y3.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -64,11 +63,11 @@ output() WSLOOP(u, v) { if (c == *(v->pitem)) putitem(v->pitem + 1, - (LOOKSETS *)0); + (LOOKSETS *)0); } temp1[c] = state(c); } else if (c > NTBASE && - temp1[(c -= NTBASE) + ntokens] == 0) { + temp1[(c -= NTBASE) + ntokens] == 0) { temp1[c + ntokens] = amem[indgo[i] + c]; } } @@ -89,15 +88,17 @@ output() * reduce/reduce * conflict */ + /* BEGIN CSTYLED */ if (foutput != NULL) (void) fprintf(foutput, - "\n%d: reduce/reduce conflict" - " (red'ns %d and %d ) on %ws", + WSFMT("\n%d: reduce/reduce conflict" + " (red'ns %d and %d ) on %ws"), i, -temp1[k], lastred, symnam(k)); if (-temp1[k] > lastred) temp1[k] = -lastred; ++zzrrconf; + /* END CSTYLED */ } else /* * potentia @@ -281,9 +282,10 @@ static void go2gen(int c) /* now, we have temp1[c] = 1 if a goto on c in closure of cc */ if (g2debug && foutput != NULL) { - (void) fprintf(foutput, "%ws: gotos on ", nontrst[c].name); + (void) fprintf(foutput, WSFMT("%ws: gotos on "), + nontrst[c].name); NTLOOP(i) if (temp1[i]) - (void) fprintf(foutput, "%ws ", nontrst[i].name); + (void) fprintf(foutput, WSFMT("%ws "), nontrst[i].name); (void) fprintf(foutput, "\n"); } @@ -321,9 +323,9 @@ precftn(int r, int t, int s) /* conflict */ if (foutput != NULL) (void) fprintf(foutput, - "\n%d: shift/reduce conflict" - " (shift %d, red'n %d) on %ws", - s, temp1[t], r, symnam(t)); + WSFMT("\n%d: shift/reduce conflict" + " (shift %d, red'n %d) on %ws"), + s, temp1[t], r, symnam(t)); ++zzsrconf; return; } @@ -408,11 +410,11 @@ wract(int i) if (flag++ == 0) (void) fprintf(ftable, "-1, %d,\n", i); (void) fprintf(ftable, - "\t%d, %d,\n", tokset[p0].value, p1); + "\t%d, %d,\n", tokset[p0].value, p1); ++zzexcp; } else { (void) fprintf(ftemp, - "%d,%d,", tokset[p0].value, p1); + "%d,%d,", tokset[p0].value, p1); ++zzacent; } } @@ -436,20 +438,20 @@ wrstate(int i) return; (void) fprintf(foutput, "\nstate %d\n", i); ITMLOOP(i, pp, qq) { - (void) fprintf(foutput, "\t%ws\n", writem(pp->pitem)); + (void) fprintf(foutput, WSFMT("\t%ws\n"), writem(pp->pitem)); } if (tystate[i] == MUSTLOOKAHEAD) { /* print out empty productions in closure */ WSLOOP(wsets + (pstate[i + 1] - pstate[i]), u) { if (*(u->pitem) < 0) (void) fprintf(foutput, - "\t%ws\n", writem(u->pitem)); + WSFMT("\t%ws\n"), writem(u->pitem)); } } /* check for state equal to another */ TLOOP(j0) if ((j1 = temp1[j0]) != 0) { - (void) fprintf(foutput, "\n\t%ws ", symnam(j0)); + (void) fprintf(foutput, WSFMT("\n\t%ws "), symnam(j0)); if (j1 > 0) { /* shift, error, or accept */ if (j1 == ACCEPTCODE) (void) fprintf(foutput, "accept"); @@ -473,8 +475,8 @@ wrstate(int i) for (j0 = 1; j0 <= nnonter; ++j0) { if (temp1[++j1]) (void) fprintf(foutput, - "\t%ws goto %d\n", - symnam(j0 + NTBASE), temp1[j1]); + WSFMT("\t%ws goto %d\n"), + symnam(j0 + NTBASE), temp1[j1]); } } @@ -482,7 +484,7 @@ static void wdef(wchar_t *s, int n) { /* output a definition of s to the value n */ - (void) fprintf(ftable, "# define %ws %d\n", s, n); + (void) fprintf(ftable, WSFMT("# define %ws %d\n"), s, n); } void @@ -491,7 +493,7 @@ wchar_t *s; int *v, n; { int i; - (void) fprintf(ftable, "static YYCONST yytabelem %ws[]={\n", s); + (void) fprintf(ftable, WSFMT("static YYCONST yytabelem %ws[]={\n"), s); for (i = 0; i < n; ) { if (i % 10 == 0) (void) fprintf(ftable, "\n"); @@ -522,8 +524,8 @@ hideprod() ++j; if (foutput != NULL) { (void) fprintf(foutput, - "Rule not reduced: %ws\n", - writem(prdptr[i])); + WSFMT("Rule not reduced: %ws\n"), + writem(prdptr[i])); } } levprd[i] = *prdptr[i] - NTBASE; @@ -533,9 +535,9 @@ hideprod() * TRANSLATION_NOTE -- This is a message from yacc. * Check how 'reduced' is translated in yacc man page/document. */ - (void) fprintf(stderr, gettext( - "%d rules never reduced\n"), - j); + (void) fprintf(stderr, + gettext("%d rules never reduced\n"), + j); } @@ -553,13 +555,13 @@ wrmbchars() int i; wdef(L"YYNMBCHARS", nmbchars); qsort(mbchars, nmbchars, sizeof (*mbchars), - (int (*)(const void *, const void *))cmpmbchars); + (int (*)(const void *, const void *))cmpmbchars); (void) fprintf(ftable, - "static struct{\n\twchar_t character;" - "\n\tint tvalue;\n}yymbchars[YYNMBCHARS]={\n"); + "static struct{\n\twchar_t character;" + "\n\tint tvalue;\n}yymbchars[YYNMBCHARS]={\n"); for (i = 0; i < nmbchars; ++i) { (void) fprintf(ftable, "\t{%#x,%d}", - (int)mbchars[i].character, mbchars[i].tvalue); + (int)mbchars[i].character, mbchars[i].tvalue); if (i < nmbchars - 1) { /* Not the last. */ (void) fprintf(ftable, ",\n"); diff --git a/usr/src/cmd/sgs/yacc/common/y4.c b/usr/src/cmd/sgs/yacc/common/y4.c index d6e967ab26..e9c6b60a62 100644 --- a/usr/src/cmd/sgs/yacc/common/y4.c +++ b/usr/src/cmd/sgs/yacc/common/y4.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -70,7 +69,7 @@ callopt() * tempfile can be translated as temporary file. */ error(gettext( - "optimizer cannot open tempfile")); + "optimizer cannot open tempfile")); optimmem = tracemem; pgo[0] = 0; @@ -260,7 +259,7 @@ gin(int i) pgo[i] = p - amem; if (adb > 1) (void) fprintf(ftable, - "Nonterminal %d, entry at %d\n", i, pgo[i]); + "Nonterminal %d, entry at %d\n", i, pgo[i]); goto nextgi; nextgp: @@ -319,14 +318,14 @@ stin(int i) */ goto nextn; if (temp1[j+1] + temp1[i] == - temp1[j] + temp1[i+1]) { + temp1[j] + temp1[i+1]) { /* states are equal */ indgo[i] = n; if (adb > 1) (void) fprintf(ftable, - "State %d: entry at" - " %d equals state %d\n", - i, n, j); + "State %d: entry at" + " %d equals state %d\n", + i, n, j); return; } goto nextn; /* we have some disagreement */ @@ -349,14 +348,14 @@ stin(int i) * Leave this untrasnlated. Yacc internal error. */ error(gettext( - "clobber of amem array, pos'n %d, by %d"), - s-amem, r[1]); + "clobber of amem array, pos'n %d, by %d"), + s-amem, r[1]); *s = r[1]; } indgo[i] = n; if (adb > 1) (void) fprintf(ftable, - "State %d: entry at %d\n", i, indgo[i]); + "State %d: entry at %d\n", i, indgo[i]); return; nextn:; } @@ -409,13 +408,13 @@ osummary() } (void) fprintf(foutput, - "Optimizer space used: input %" PRIdPTR - "/%d, output %" PRIdPTR "/%d\n", - optimmem-tracemem + 1, new_memsize, maxa-amem + 1, new_actsize); + "Optimizer space used: input %" PRIdPTR + "/%d, output %" PRIdPTR "/%d\n", + optimmem-tracemem + 1, new_memsize, maxa-amem + 1, new_actsize); (void) fprintf(foutput, - "%" PRIdPTR " table entries, %d zero\n", (maxa-amem) + 1, i); + "%" PRIdPTR " table entries, %d zero\n", (maxa-amem) + 1, i); (void) fprintf(foutput, - "maximum spread: %d, maximum offset: %d\n", maxspr, maxoff); + "maximum spread: %d, maximum offset: %d\n", maxspr, maxoff); } @@ -438,7 +437,7 @@ int *v, n; { int i; - (void) fprintf(ftable, "static YYCONST yytabelem %ws[]={\n", s); + (void) fprintf(ftable, WSFMT("static YYCONST yytabelem %ws[]={\n"), s); for (i = 0; i < n; ) { if (i % 10 == 0) (void) fprintf(ftable, "\n"); diff --git a/usr/src/cmd/sgs/yacc/i386/Makefile b/usr/src/cmd/sgs/yacc/i386/Makefile index 492f4ed3b2..dde531bc69 100644 --- a/usr/src/cmd/sgs/yacc/i386/Makefile +++ b/usr/src/cmd/sgs/yacc/i386/Makefile @@ -26,7 +26,6 @@ # # cmd/sgs/yacc/i386/Makefile -PROG= yacc DEFLIST= -DELF include ../../../Makefile.cmd diff --git a/usr/src/cmd/sgs/yacc/sparc/Makefile b/usr/src/cmd/sgs/yacc/sparc/Makefile index f36fbf97c4..86713f6617 100644 --- a/usr/src/cmd/sgs/yacc/sparc/Makefile +++ b/usr/src/cmd/sgs/yacc/sparc/Makefile @@ -27,7 +27,6 @@ # cmd/sgs/yacc/sparc/Makefile # -PROG= yacc DEFLIST= -DELF include ../../../Makefile.cmd |
