splint-3.1.2.dfsg1/0000755021234200000250000000000010654217055011450 5ustar faxsplint-3.1.2.dfsg1/bin/0000755021234200000250000000000010645776223012227 5ustar faxsplint-3.1.2.dfsg1/bin/Makefile.am0000644021234200000250000000103707630455435014263 0ustar fax## Note: starting comments with ## means they don't end up in Makefile AUTOMAKE_OPTIONS = 1.6.3 foreign no-dependencies SUFFIXES = .h .c .o .l .check binaryDir = bin ## We only build Splint bin_PROGRAMS = splint .PHONY: all EXTRA_DIST = splint DIST_SOURCES = #chessy hack so it doesn't try to build splint splint$(EXEEXT): ; install-exec-hook: $(top_builddir)/src/splint$(EXEEXT) $(top_builddir)/src/splint$(EXEEXT): splint$(EXEEXT) ln -s ../$(binaryDir)/splint $(top_builddir)/src/splint$(EXEEXT) #don't delete ./splint clean: ; splint-3.1.2.dfsg1/bin/Makefile.in0000644021234200000250000002136310645764240014275 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.6.3 foreign no-dependencies SUFFIXES = .h .c .o .l .check binaryDir = bin bin_PROGRAMS = splint EXTRA_DIST = splint DIST_SOURCES = subdir = bin mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = bin_PROGRAMS = splint$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) splint_SOURCES = splint.c splint_OBJECTS = splint.$(OBJEXT) splint_LDADD = $(LDADD) splint_DEPENDENCIES = splint_LDFLAGS = DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = am__depfiles_maybe = COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_COMMON = Makefile.am Makefile.in SOURCES = splint.c all: all-am .SUFFIXES: .SUFFIXES: .h .c .o .l .check .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign bin/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c .c.o: $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$< .c.obj: $(COMPILE) -c `cygpath -w $<` uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-binPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-binPROGRAMS uninstall-info-am .PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic distclean distclean-compile distclean-generic \ distclean-tags distdir dvi dvi-am info info-am install \ install-am install-binPROGRAMS install-data install-data-am \ install-exec install-exec-am install-info install-info-am \ install-man install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic tags \ uninstall uninstall-am uninstall-binPROGRAMS uninstall-info-am .PHONY: all #chessy hack so it doesn't try to build splint splint$(EXEEXT): ; install-exec-hook: $(top_builddir)/src/splint$(EXEEXT) $(top_builddir)/src/splint$(EXEEXT): splint$(EXEEXT) ln -s ../$(binaryDir)/splint $(top_builddir)/src/splint$(EXEEXT) #don't delete ./splint clean: ; # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/config/0000755021234200000250000000000010645776223012724 5ustar faxsplint-3.1.2.dfsg1/config/config.guess0000755021234200000250000011302007363122457015236 0ustar fax#! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-08-21' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Written by Per Bothner . # Please send patches to . # # This script attempts to guess a canonical system name similar to # config.sub. If it succeeds, it prints the system name on stdout, and # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you # don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi dummy=dummy-$$ trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. set_cc_for_build='case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int dummy(){}" > $dummy.c ; for c in cc gcc c89 ; do ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 ; if test $? = 0 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; rm -f $dummy.c $dummy.o $dummy.rel ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:NetBSD:*:*) # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # Determine the machine/vendor (is the vendor relevant). case "${UNAME_MACHINE}" in amiga) machine=m68k-unknown ;; arm32) machine=arm-unknown ;; atari*) machine=m68k-atari ;; sun3*) machine=m68k-sun ;; mac68k) machine=m68k-apple ;; macppc) machine=powerpc-apple ;; hp3[0-9][05]) machine=m68k-hp ;; ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE}" in i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep __ELF__ >/dev/null then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit 0 ;; alpha:OSF1:*:*) if test $UNAME_RELEASE = "V4.0"; then UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` fi # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. cat <$dummy.s .data \$Lformat: .byte 37,100,45,37,120,10,0 # "%d-%x\n" .text .globl main .align 4 .ent main main: .frame \$30,16,\$26,0 ldgp \$29,0(\$27) .prologue 1 .long 0x47e03d80 # implver \$0 lda \$2,-1 .long 0x47e20c21 # amask \$2,\$1 lda \$16,\$Lformat mov \$0,\$17 not \$1,\$18 jsr \$26,printf ldgp \$29,0(\$26) mov 0,\$16 jsr \$26,exit .end main EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in 0-0) UNAME_MACHINE="alpha" ;; 1-0) UNAME_MACHINE="alphaev5" ;; 1-1) UNAME_MACHINE="alphaev56" ;; 1-101) UNAME_MACHINE="alphapca56" ;; 2-303) UNAME_MACHINE="alphaev6" ;; 2-307) UNAME_MACHINE="alphaev67" ;; 2-1307) UNAME_MACHINE="alphaev68" ;; esac fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` exit 0 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit 0 ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit 0 ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 exit 0;; amiga:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos exit 0 ;; arc64:OpenBSD:*:*) echo mips64el-unknown-openbsd${UNAME_RELEASE} exit 0 ;; arc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; hkmips:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; pmax:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; sgi:OpenBSD:*:*) echo mips-unknown-openbsd${UNAME_RELEASE} exit 0 ;; wgrisc:OpenBSD:*:*) echo mipsel-unknown-openbsd${UNAME_RELEASE} exit 0 ;; *:OS/390:*:*) echo i370-ibm-openedition exit 0 ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit 0 ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit 0 ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) UNAME_RELEASE=`uname -v` ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` exit 0 ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} exit 0 ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(head -1 /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} ;; sun4) echo sparc-sun-sunos${UNAME_RELEASE} ;; esac exit 0 ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} exit 0 ;; sparc*:NetBSD:*) echo `uname -p`-unknown-netbsd${UNAME_RELEASE} exit 0 ;; atari*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} exit 0 ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} exit 0 ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} exit 0 ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} exit 0 ;; sun3*:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mac68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme68k:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; mvme88k:OpenBSD:*:*) echo m88k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} exit 0 ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit 0 ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} exit 0 ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} exit 0 ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} exit 0 ;; mips:*:*:UMIPS | mips:*:*:RISCos) sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy \ && ./$dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo mips-mips-riscos${UNAME_RELEASE} exit 0 ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit 0 ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit 0 ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit 0 ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit 0 ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit 0 ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit 0 ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit 0 ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit 0 ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit 0 ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit 0 ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` exit 0 ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit 0 ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo rs6000-ibm-aix3.2.5 elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit 0 ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; *:AIX:*:*) echo rs6000-ibm-aix exit 0 ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 exit 0 ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to exit 0 ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit 0 ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit 0 ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit 0 ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) case "${HPUX_REV}" in 11.[0-9][0-9]) if [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; esac ;; esac fi ;; esac if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF eval $set_cc_for_build (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy fi ;; esac echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy echo unknown-hitachi-hiuxwe2 exit 0 ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd exit 0 ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit 0 ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit 0 ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf exit 0 ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit 0 ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi exit 0 ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit 0 ;; hppa*:OpenBSD:*:*) echo hppa-unknown-openbsd exit 0 ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit 0 ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit 0 ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit 0 ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit 0 ;; CRAY*X-MP:*:*:*) echo xmp-cray-unicos exit 0 ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} exit 0 ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} exit 0 ;; *:FreeBSD:*:*) echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit 0 ;; *:OpenBSD:*:*) echo ${UNAME_MACHINE}-unknown-openbsd`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` exit 0 ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit 0 ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit 0 ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit 0 ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i386-pc-interix exit 0 ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit 0 ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin exit 0 ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit 0 ;; *:GNU:*:*) echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit 0 ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux exit 0 ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; mips:Linux:*:*) case `sed -n '/^byte/s/^.*: \(.*\) endian/\1/p' < /proc/cpuinfo` in big) echo mips-unknown-linux-gnu && exit 0 ;; little) echo mipsel-unknown-linux-gnu && exit 0 ;; esac ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu exit 0 ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu exit 0 ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} exit 0 ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in PA7*) echo hppa1.1-unknown-linux-gnu ;; PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac exit 0 ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu exit 0 ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux exit 0 ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu exit 0 ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu exit 0 ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. ld_supported_targets=`cd /; ld --help 2>&1 \ | sed -ne '/supported targets:/!d s/[ ][ ]*/ /g s/.*supported targets: *// s/ .*// p'` case "$ld_supported_targets" in elf32-i386) TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu" ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" exit 0 ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" exit 0 ;; esac # Determine whether the default compiler is a.out or elf cat >$dummy.c < #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #ifdef __ELF__ # ifdef __GLIBC__ # if __GLIBC__ >= 2 printf ("%s-pc-linux-gnu\n", argv[1]); # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif # else printf ("%s-pc-linux-gnulibc1\n", argv[1]); # endif #else printf ("%s-pc-linux-gnuaout\n", argv[1]); #endif return 0; } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit 0 ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} exit 0 ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit 0 ;; i*86:*:5:[78]*) case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} exit 0 ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=`(/bin/uname -X|egrep Release|sed -e 's/.*= //')` (/bin/uname -X|egrep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|egrep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|egrep '^Machine.*Pent ?II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|egrep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo ${UNAME_MACHINE}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-sysv32 fi exit 0 ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit 0 ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i386. echo i386-pc-msdosdjgpp exit 0 ;; Intel:Mach:3*:*) echo i386-pc-mach3 exit 0 ;; paragon:*:*:*) echo i860-intel-osf1 exit 0 ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi exit 0 ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit 0 ;; M68*:*:R3V[567]*:*) test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; 3[34]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 4850:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4.3${OS_REL} && exit 0 /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && echo i486-ncr-sysv4 && exit 0 ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} exit 0 ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit 0 ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} exit 0 ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit 0 ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` echo ${UNAME_MACHINE}-sni-sysv4 else echo ns32k-sni-sysv fi exit 0 ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit 0 ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit 0 ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit 0 ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit 0 ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} exit 0 ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit 0 ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi exit 0 ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit 0 ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit 0 ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos exit 0 ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} exit 0 ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} exit 0 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit 0 ;; *:Darwin:*:*) echo `uname -p`-apple-darwin${UNAME_RELEASE} exit 0 ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) if test "${UNAME_MACHINE}" = "x86pc"; then UNAME_MACHINE=pc fi echo `uname -p`-${UNAME_MACHINE}-nto-qnx exit 0 ;; *:QNX:*:4*) echo i386-pc-qnx exit 0 ;; NSR-[KW]:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit 0 ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit 0 ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit 0 ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} exit 0 ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. if test "$cputype" = "386"; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx exit 0 ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 exit 0 ;; *:TENEX:*:*) echo pdp10-unknown-tenex exit 0 ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit 0 ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit 0 ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 exit 0 ;; *:ITS:*:*) echo pdp10-unknown-its exit 0 ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 #echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF eval $set_cc_for_build $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy && rm -f $dummy.c $dummy && exit 0 rm -f $dummy.c $dummy # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit 0 ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit 0 ;; c34*) echo c34-convex-bsd exit 0 ;; c38*) echo c38-convex-bsd exit 0 ;; c4*) echo c4-convex-bsd exit 0 ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: splint-3.1.2.dfsg1/config/config.sub0000755021234200000250000006700507363122457014714 0ustar fax#! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. timestamp='2001-08-13' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software # can handle that machine. It does not imply ALL GNU software can. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, # Boston, MA 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit 0 ;; --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" exit 1 ;; *local*) # First pass through any local machine types. echo $1 exit 0;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | storm-chaos* | os2-emx* | windows32-*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis) os= basic_machine=$1 ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ | c4x | clipper \ | d10v | d30v | dsp16xx \ | fr30 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | m32r | m68000 | m68k | m88k | mcore \ | mips16 | mips64 | mips64el | mips64orion | mips64orionel \ | mips64vr4100 | mips64vr4100el | mips64vr4300 \ | mips64vr4300el | mips64vr5000 | mips64vr5000el \ | mipsbe | mipsel | mipsle | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | ns16k | ns32k \ | openrisc \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ | s390 | s390x \ | sh | sh[34] | sh[34]eb | shbe | shle \ | sparc | sparc64 | sparclet | sparclite | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic80 | tron \ | v850 \ | we32k \ | x86 | xscale \ | z8k) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alphapca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armv*-* \ | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c54x-* \ | clipper-* | cray2-* | cydra-* \ | d10v-* | d30v-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | m32r-* \ | m68000-* | m680[01234]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | mcore-* \ | mips-* | mips16-* | mips64-* | mips64el-* | mips64orion-* \ | mips64orionel-* | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* | mipsbe-* | mipsel-* \ | mipsle-* | mipstx39-* | mipstx39el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ | s390-* | s390x-* \ | sh-* | sh[34]-* | sh[34]eb-* | shbe-* | shle-* \ | sparc-* | sparc64-* | sparc86x-* | sparclite-* \ | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* \ | t3e-* | tahoe-* | thumb-* | tic30-* | tic54x-* | tic80-* | tron-* \ | v850-* | vax-* \ | we32k-* \ | x86-* | x86_64-* | xmp-* | xps100-* | xscale-* \ | ymp-* \ | z8k-*) ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | ymp) basic_machine=ymp-cray os=-unicos ;; cray2) basic_machine=cray2-cray os=-unicos ;; [cjt]90) basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) basic_machine=m68k-crds ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; # I'm not sure what "Sysv32" means. Should this be sysv3.2? i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mipsel*-linux*) basic_machine=mipsel-unknown os=-linux-gnu ;; mips*-linux*) basic_machine=mips-unknown os=-linux-gnu ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; mmix*) basic_machine=mmix-knuth os=-mmixware ;; monitor) basic_machine=m68k-rom68k os=-coff ;; msdos) basic_machine=i386-pc os=-msdos ;; mvs) basic_machine=i370-ibm os=-mvs ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pentium | p5 | k5 | k6 | nexgen) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon) basic_machine=i686-pc ;; pentiumii | pentium2) basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sparclite-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=t3e-cray os=-unicos ;; tic54x | c54x*) basic_machine=tic54x-unknown os=-coff ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; tower | tower-32) basic_machine=m68k-ncr ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; windows32) basic_machine=i386-pc os=-windows32-msvcrt ;; xmp) basic_machine=xmp-cray os=-unicos ;; xps | xps100) basic_machine=xps100-honeywell ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; mips) if [ x$os = x-linux-gnu ]; then basic_machine=mips-unknown else basic_machine=mips-mips fi ;; romp) basic_machine=romp-ibm ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh3 | sh4 | sh3eb | sh4eb) basic_machine=sh-unknown ;; sparc | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; c4x*) basic_machine=c4x-none os=-coff ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -netbsd* | -openbsd* | -freebsd* | -riscix* \ | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto*) os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 # This also exists in the configure program, but was not the # default. # os=-sunos4 ;; m68*-cisco) os=-aout ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-ibm) os=-aix ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -aix*) vendor=ibm ;; -beos*) vendor=be ;; -hpux*) vendor=hp ;; -mpeix*) vendor=hp ;; -hiux*) vendor=hitachi ;; -unos*) vendor=crds ;; -dgux*) vendor=dg ;; -luna*) vendor=omron ;; -genix*) vendor=ns ;; -mvs* | -opened*) vendor=ibm ;; -ptx*) vendor=sequent ;; -vxsim* | -vxworks*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: splint-3.1.2.dfsg1/config/depcomp0000755021234200000250000002752507363122457014311 0ustar fax#! /bin/sh # depcomp - compile a program generating dependencies as side-effects # Copyright 1999, 2000 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # `libtool' can also be set to `yes' or `no'. depfile=${depfile-`echo "$object" | sed 's,\([^/]*\)$,.deps/\1,;s/\.\([^.]*\)$/.P\1/'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. This file always lives in the current directory. # Also, the AIX compiler puts `$object:' at the start of each line; # $object doesn't have directory information. stripped=`echo "$object" | sed -e 's,^.*/,,' -e 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" outname="$stripped.o" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; tru64) # The Tru64 AIX compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. tmpdepfile1="$object.d" tmpdepfile2=`echo "$object" | sed -e 's/.o$/.d/'` if test "$libtool" = yes; then "$@" -Wc,-MD else "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi if test -f "$tmpdepfile1"; then tmpdepfile="$tmpdepfile1" else tmpdepfile="$tmpdepfile2" fi if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a space and a tab in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. test -z "$dashmflag" && dashmflag=-M ( IFS=" " case " $* " in *" --mode=compile "*) # this is libtool, let us make it quiet for arg do # cycle over the arguments case "$arg" in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" $dashmflag | sed 's:^[^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) # X makedepend ( shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift;; -*) ;; *) set fnord "$@" "$arg"; shift;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} 2>/dev/null -o"$obj_suffix" -f"$tmpdepfile" "$@" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tail +3 "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the proprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. ( IFS=" " case " $* " in *" --mode=compile "*) for arg do # cycle over the arguments case $arg in "--mode=compile") # insert --quiet before "--mode=compile" set fnord "$@" --quiet shift # fnord ;; esac set fnord "$@" "$arg" shift # fnord shift # "$arg" done ;; esac "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" ) & proc=$! "$@" stat=$? wait "$proc" if test "$stat" != 0; then exit $stat; fi rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 splint-3.1.2.dfsg1/config/install-sh0000755021234200000250000001273607363122457014736 0ustar fax#!/bin/sh # # install - install a program, script, or datafile # This comes from X11R5 (mit/util/scripts/install.sh). # # Copyright 1991 by the Massachusetts Institute of Technology # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that # the above copyright notice appear in all copies and that both that # copyright notice and this permission notice appear in supporting # documentation, and that the name of M.I.T. not be used in advertising or # publicity pertaining to distribution of the software without specific, # written prior permission. M.I.T. makes no representations about the # suitability of this software for any purpose. It is provided "as is" # without express or implied warranty. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. It can only install one file at a time, a restriction # shared with many OS's install programs. # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" # put in absolute paths if you don't have them in your path; or use env. vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" transformbasename="" transform_arg="" instcmd="$mvprog" chmodcmd="$chmodprog 0755" chowncmd="" chgrpcmd="" stripcmd="" rmcmd="$rmprog -f" mvcmd="$mvprog" src="" dst="" dir_arg="" while [ x"$1" != x ]; do case $1 in -c) instcmd="$cpprog" shift continue;; -d) dir_arg=true shift continue;; -m) chmodcmd="$chmodprog $2" shift shift continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; -s) stripcmd="$stripprog" shift continue;; -t=*) transformarg=`echo $1 | sed 's/-t=//'` shift continue;; -b=*) transformbasename=`echo $1 | sed 's/-b=//'` shift continue;; *) if [ x"$src" = x ] then src=$1 else # this colon is to work around a 386BSD /bin/sh bug : dst=$1 fi shift continue;; esac done if [ x"$src" = x ] then echo "install: no input file specified" exit 1 else true fi if [ x"$dir_arg" != x ]; then dst=$src src="" if [ -d $dst ]; then instcmd=: chmodcmd="" else instcmd=mkdir fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then true else echo "install: $src does not exist" exit 1 fi if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else true fi # If destination is a directory, append the input filename; if your system # does not like double slashes in filenames, you may need to add some logic if [ -d $dst ] then dst="$dst"/`basename $src` else true fi fi ## this sed command emulates the dirname command dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Make sure that the destination directory exists. # this part is taken from Noah Friedman's mkinstalldirs script # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then defaultIFS=' ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" # Some sh's can't handle IFS=/ for some reason. IFS='%' set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` IFS="${oIFS}" pathcomp='' while [ $# -ne 0 ] ; do pathcomp="${pathcomp}${1}" shift if [ ! -d "${pathcomp}" ] ; then $mkdirprog "${pathcomp}" else true fi pathcomp="${pathcomp}/" done fi if [ x"$dir_arg" != x ] then $doit $instcmd $dst && if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi else # If we're going to rename the final executable, determine the name now. if [ x"$transformarg" = x ] then dstfile=`basename $dst` else dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename if [ x"$dstfile" = x ] then dstfile=`basename $dst` else true fi # Make a temp file name in the proper directory. dsttmp=$dstdir/#inst.$$# # Move or copy the file name to the temp name $doit $instcmd $src $dsttmp && trap "rm -f ${dsttmp}" 0 && # and set any options; do chmod last to preserve setuid bits # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && $doit $mvcmd $dsttmp $dstdir/$dstfile fi && exit 0 splint-3.1.2.dfsg1/config/missing0000755021234200000250000002123107363122457014317 0ustar fax#! /bin/sh # Common stub for a few missing GNU programs while installing. # Copyright 1996, 1997, 1999, 2000 Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi case "$1" in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case "$1" in -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch]" ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing 0.3 - GNU automake" ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; aclocal) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case "$f" in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" y.tab.h fi ;; esac fi if [ ! -f y.tab.h ]; then echo >y.tab.h fi if [ ! -f y.tab.c ]; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if [ $# -ne 1 ]; then eval LASTARG="\${$#}" case "$LASTARG" in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if [ -f "$SRCFILE" ]; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if [ ! -f lex.yy.c ]; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` fi if [ -f "$file" ]; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then # We have makeinfo, but it failed. exit 1 fi echo 1>&2 "\ WARNING: \`$1' is missing on your system. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` if test -z "$file"; then file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` fi touch $file ;; tar) shift if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 fi # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar ${1+"$@"} && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar ${1+"$@"} && exit 0 fi firstarg="$1" if shift; then case "$firstarg" in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac case "$firstarg" in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" ${1+"$@"} && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and you do not seem to have it handy on your system. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequirements for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 splint-3.1.2.dfsg1/config/mkinstalldirs0000755021234200000250000000132707363122457015532 0ustar fax#! /bin/sh # mkinstalldirs --- make directory hierarchy # Author: Noah Friedman # Created: 1993-05-16 # Public domain # $Id: mkinstalldirs,v 1.1 2001/10/16 21:22:55 evans1629 Exp $ errstatus=0 for file do set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` shift pathcomp= for d do pathcomp="$pathcomp$d" case "$pathcomp" in -* ) pathcomp=./$pathcomp ;; esac if test ! -d "$pathcomp"; then echo "mkdir $pathcomp" mkdir "$pathcomp" || lasterr=$? if test ! -d "$pathcomp"; then errstatus=$lasterr fi fi pathcomp="$pathcomp/" done done exit $errstatus # mkinstalldirs ends here splint-3.1.2.dfsg1/README0000644021234200000250000000071310654217017012327 0ustar fax Splint - annotation-assisted static program checker http://www.splint.org Copyright (C) 1994-2007 University of Virginia, Massachusetts Institute of Technology Version 3.1.2 1 August 2007 Splint Documentation ==================== Installation instructions are found with this distribution in install.html (or at http://www.splint.org/source.html). For documentation on Splint, please see http://www.splint.org splint-3.1.2.dfsg1/Makefile.am0000644021234200000250000000504710645764104013514 0ustar fax## Process this file with automake to create Makefile.in. -*-Makefile-*- ## ## Makefile for Splint 3.0 ## For more information: http://www.splint.org ## ## Copyright (C) 2001-2 University of Virginia, ## Massachusetts Institute of Technology ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## The GNU General Public License is available from http://www.gnu.org/ or ## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ## MA 02111-1307, USA. ## ## For information on spint: info@splint.org ## To report a bug: splint-bug@splint.org ## .PHONY: test AUTOMAKE_OPTIONS = 1.5 foreign binaryfixscript = ./fixBinaryDist.sh SUBDIRS = src lib imports test doc binaryDir = bin binaryDirFiles = $(binaryDir)/Makefile.am $(binaryDir)/Makefile.in binaryBuiltFiles = Makefile.binary.am configure.binary.ac #include these in case we're trying to build on a systems #without the bleeding edge versions of automake and autoconf binaryDerivedFiles = Makefile.binary.in configure.binary #try to remake these but don't stop if it fails. configure.binary:configure.binary.ac -autoconf -oconfigure.binary configure.binary.ac Makefile.binary.in:Makefile.binary.am -automake Makefile.binary $(SED) -e s/Makefile\.binary/Makefile/ Makefile.binary.in > tMakefile.binary.in # $(RM) Makefile.binary.in $(CP) tMakefile.binary.in Makefile.binary.in #drl add this hack 3/1/2003 #make the generated makefile depend on Makefile not Makefile.binary $(binaryDir)/Makefile.in: $(binaryDir)/Makefile.am -automake $(binaryDir)/Makefile EXTRA_DIST = $(binaryfixscript) $(binaryBuiltFiles) $(binaryDerivedFiles) $(binaryDirFiles) install.html preDist: $(binaryDir)/Makefile.in $(binaryDerivedFiles) bindist: $(binaryDerivedFiles) $(MAKE) $(RM) -f $(binaryDir)/splint $(CP) src/splint $(binaryDir)/splint $(MV) install.html installSource.html $(CP) doc/` uname | tr [A-Z] [a-z]`.html install.html $(MAKE) -e dist dh_script=$(binaryfixscript) SUBDIRS="$(binaryDir) lib imports doc" $(MV) $(distdir).tar.gz $(distdir).`uname`.tgz $(MV) installSource.html install.html dist-hook: cd $(distdir); pwd; $(dh_script) splint-3.1.2.dfsg1/Makefile.in0000644021234200000250000003550510645776033013533 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.5 foreign binaryfixscript = ./fixBinaryDist.sh SUBDIRS = src lib imports test doc binaryDir = bin binaryDirFiles = $(binaryDir)/Makefile.am $(binaryDir)/Makefile.in binaryBuiltFiles = Makefile.binary.am configure.binary.ac #include these in case we're trying to build on a systems #without the bleeding edge versions of automake and autoconf binaryDerivedFiles = Makefile.binary.in configure.binary EXTRA_DIST = $(binaryfixscript) $(binaryBuiltFiles) $(binaryDerivedFiles) $(binaryDirFiles) install.html subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = DIST_SOURCES = RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = README Makefile.am Makefile.in acinclude.m4 aclocal.m4 \ config.hin config/config.guess config/config.sub config/depcomp \ config/install-sh config/missing config/mkinstalldirs configure \ configure.ac DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): configure.ac acinclude.m4 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.hin: $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.hin distclean-hdr: -rm -f config.h stamp-h1 uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = . distdir = $(PACKAGE)-$(VERSION) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } GZIP_ENV = --best distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkinstalldirs) $(distdir)/$(binaryDir) $(distdir)/config @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="${top_distdir}" distdir="$(distdir)" \ dist-hook -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist $(am__remove_distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/=build mkdir $(distdir)/=inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ && cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ find $$dc_install_base -type f -print ; \ exit 1; } >&2 ) \ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ && rm -f $(distdir).tar.gz \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' distcleancheck: distclean if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf autom4te.cache maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-recursive dist dist-all dist-gzip distcheck \ distclean distclean-generic distclean-hdr distclean-recursive \ distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \ info info-am info-recursive install install-am install-data \ install-data-am install-data-recursive install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive tags tags-recursive uninstall \ uninstall-am uninstall-info-am uninstall-info-recursive \ uninstall-recursive .PHONY: test #try to remake these but don't stop if it fails. configure.binary:configure.binary.ac -autoconf -oconfigure.binary configure.binary.ac Makefile.binary.in:Makefile.binary.am -automake Makefile.binary $(SED) -e s/Makefile\.binary/Makefile/ Makefile.binary.in > tMakefile.binary.in # $(RM) Makefile.binary.in $(CP) tMakefile.binary.in Makefile.binary.in #drl add this hack 3/1/2003 #make the generated makefile depend on Makefile not Makefile.binary $(binaryDir)/Makefile.in: $(binaryDir)/Makefile.am -automake $(binaryDir)/Makefile preDist: $(binaryDir)/Makefile.in $(binaryDerivedFiles) bindist: $(binaryDerivedFiles) $(MAKE) $(RM) -f $(binaryDir)/splint $(CP) src/splint $(binaryDir)/splint $(MV) install.html installSource.html $(CP) doc/` uname | tr [A-Z] [a-z]`.html install.html $(MAKE) -e dist dh_script=$(binaryfixscript) SUBDIRS="$(binaryDir) lib imports doc" $(MV) $(distdir).tar.gz $(distdir).`uname`.tgz $(MV) installSource.html install.html dist-hook: cd $(distdir); pwd; $(dh_script) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/acinclude.m40000644021234200000250000000047707362163523013653 0ustar faxm4_define([AH_LCLINT_TEMPLATE], [AH_VERBATIM([$1], m4_text_wrap([$2 */], [ ], [/* ]) m4_text_wrap([$3@*/], [ ], [/*@])[ #undef $1])]) m4_define([AC_DEFINE_LCLINT], [AC_DEFINE_TRACE([$1])dnl AH_LCLINT_TEMPLATE([$1], [$3], [$4])dnl cat >>confdefs.h <<\_ACEOF [@%:@define] $1 [$2] _ACEOF ]) splint-3.1.2.dfsg1/aclocal.m40000644021234200000250000007701010645764664013332 0ustar fax# aclocal.m4 generated automatically by aclocal 1.6.3 -*- Autoconf -*- # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_define([AH_LCLINT_TEMPLATE], [AH_VERBATIM([$1], m4_text_wrap([$2 */], [ ], [/* ]) m4_text_wrap([$3@*/], [ ], [/*@])[ #undef $1])]) m4_define([AC_DEFINE_LCLINT], [AC_DEFINE_TRACE([$1])dnl AH_LCLINT_TEMPLATE([$1], [$3], [$4])dnl cat >>confdefs.h <<\_ACEOF [@%:@define] $1 [$2] _ACEOF ]) # Do all the work for Automake. -*- Autoconf -*- # This macro actually does too much some checks are only needed if # your package does certain things. But this isn't really a big deal. # Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 8 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... AC_PREREQ([2.52]) # Autoconf 2.50 wants to disallow AM_ names. We explicitly allow # the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl AC_SUBST([PACKAGE], [AC_PACKAGE_TARNAME])dnl AC_SUBST([VERSION], [AC_PACKAGE_VERSION])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_MISSING_PROG(AMTAR, tar) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_][CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_][CC], defn([AC_PROG_][CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_][CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_][CXX], defn([AC_PROG_][CXX])[_AM_DEPENDENCIES(CXX)])])dnl ]) ]) # Copyright 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. AC_DEFUN([AM_AUTOMAKE_VERSION],[am__api_version="1.6"]) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION so it can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.6.3])]) # Helper functions for option handling. -*- Autoconf -*- # Copyright 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # # Check to make sure that the build environment is sane. # # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # -*- Autoconf -*- # Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # AM_AUX_DIR_EXPAND # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. # Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50]) AC_DEFUN([AM_AUX_DIR_EXPAND], [ # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"$am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # AM_PROG_INSTALL_STRIP # Copyright 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # serial 4 -*- Autoconf -*- # Copyright 1999, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_$1_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null AC_SUBST([DEPDIR]) ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH]) ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. #serial 2 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi grep '^DEP_FILES *= *[[^ @%:@]]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Copyright 2001 Free Software Foundation, Inc. -*- Autoconf -*- # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 2 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST(am__include) AC_SUBST(am__quote) AC_MSG_RESULT($_am_result) rm -f confinc confmf ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 5 AC_PREREQ(2.52) # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE]) AC_SUBST([$1_FALSE]) if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([conditional \"$1\" was never defined. Usually this means the macro was only invoked conditionally.]) fi])]) # Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*- # Copyright 1996, 1997, 2000, 2001 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. AC_PREREQ([2.52]) # serial 6 # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. We must strip everything past the first ":", # and everything past the last "/". # _AM_DIRNAME(PATH) # ----------------- # Like AS_DIRNAME, only do it during macro expansion AC_DEFUN([_AM_DIRNAME], [m4_if(regexp([$1], [^.*[^/]//*[^/][^/]*/*$]), -1, m4_if(regexp([$1], [^//\([^/]\|$\)]), -1, m4_if(regexp([$1], [^/.*]), -1, [.], patsubst([$1], [^\(/\).*], [\1])), patsubst([$1], [^\(//\)\([^/].*\|$\)], [\1])), patsubst([$1], [^\(.*[^/]\)//*[^/][^/]*/*$], [\1]))[]dnl ])# _AM_DIRNAME # The stamp files are numbered to have different names. # We could number them on a directory basis, but that's additional # complications, let's have a unique counter. m4_define([_AM_STAMP_Count], [0]) # _AM_STAMP(HEADER) # ----------------- # The name of the stamp file for HEADER. AC_DEFUN([_AM_STAMP], [m4_define([_AM_STAMP_Count], m4_incr(_AM_STAMP_Count))dnl AS_ESCAPE(_AM_DIRNAME(patsubst([$1], [:.*])))/stamp-h[]_AM_STAMP_Count]) # _AM_CONFIG_HEADER(HEADER[:SOURCES], COMMANDS, INIT-COMMANDS) # ------------------------------------------------------------ # We used to try to get a real timestamp in stamp-h. But the fear is that # that will cause unnecessary cvs conflicts. AC_DEFUN([_AM_CONFIG_HEADER], [# Add the stamp file to the list of files AC keeps track of, # along with our hook. AC_CONFIG_HEADERS([$1], [# update the timestamp echo 'timestamp for $1' >"_AM_STAMP([$1])" $2], [$3]) ])# _AM_CONFIG_HEADER # AM_CONFIG_HEADER(HEADER[:SOURCES]..., COMMANDS, INIT-COMMANDS) # -------------------------------------------------------------- AC_DEFUN([AM_CONFIG_HEADER], [AC_FOREACH([_AM_File], [$1], [_AM_CONFIG_HEADER(_AM_File, [$2], [$3])]) ])# AM_CONFIG_HEADER # Copyright 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # serial 3 AC_PREREQ(2.50) # AM_PROG_LEX # ----------- # Autoconf leaves LEX=: if lex or flex can't be found. Change that to a # "missing" invocation, for better error output. AC_DEFUN([AM_PROG_LEX], [AC_REQUIRE([AM_MISSING_HAS_RUN])dnl AC_REQUIRE([AC_PROG_LEX])dnl if test "$LEX" = :; then LEX=${am_missing_run}flex fi]) splint-3.1.2.dfsg1/config.hin0000644021234200000250000000353210645764674013436 0ustar fax/* config.hin. Generated from configure.ac by autoheader. */ /*@ -macroconstdecl@*/ /* build */ #undef BUILD /* build_alias */ #undef BUILD_ALIAS /* build_cpu */ #undef BUILD_CPU /* build_os */ #undef BUILD_OS /* build_vendor */ #undef BUILD_VENDOR /* The directory where Splint's library files live */ #undef DEFAULT_LARCHPATH /* Splint's imports directory */ #undef DEFAULT_LCLIMPORTDIR /* system include directory */ #undef GCC_INCLUDE_DIR /* alternate include directory */ #undef GCC_INCLUDE_DIR2 /* host */ #undef HOST /* host_alias */ #undef HOST_ALIAS /* host_cpu */ #undef HOST_CPU /* host_os */ #undef HOST_OS /* host_vendor */ #undef HOST_VENDOR /* String describing who compiled this binary and how */ #undef LCL_COMPILE /* Splint's version number */ #undef LCL_PARSE_VERSION /* Define to disable support LCL files */ #undef NOLCL /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Splint's version number and configure/build date */ #undef SPLINT_VERSION /* The system's main include directory */ #undef SYSTEM_LIBDIR /* target */ #undef TARGET /* target_alias */ #undef TARGET_ALIAS /* target_cpu */ #undef TARGET_CPU /* target_os */ #undef TARGET_OS /* target_vendor */ #undef TARGET_VENDOR /* uname output */ #undef UNAME /* Define if you're on a Unixy system */ #undef UNIX /* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a `char[]'. */ #undef YYTEXT_POINTER /* needed to expose mode_t on some machines */ #undef _ALL_SOURCE /*@ =macroconstdecl@*/ splint-3.1.2.dfsg1/configure0000755021234200000250000047545310645764665013417 0ustar fax#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.59 for Splint 3.1.2. # # Report bugs to . # # Copyright (C) 2003 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local ac_config_libobj_dir=. cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='Splint' PACKAGE_TARNAME='splint' PACKAGE_VERSION='3.1.2' PACKAGE_STRING='Splint 3.1.2' PACKAGE_BUGREPORT='splint-bug@splint.org' ac_unique_file="src/lclinit.c" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO AMTAR install_sh STRIP ac_ct_STRIP INSTALL_STRIP_PROGRAM AWK SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE CPP LEX LEXLIB LEX_OUTPUT_ROOT LN_S BISON GREP DIFF CAT RM MV CP SED LCLOBJ LIBOBJS LTLIBOBJS' ac_subst_files='' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi (cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null || { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2 { (exit 1); exit 1; }; } srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Splint 3.1.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Splint 3.1.2:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-lcl don't include support for LCL files Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Splint configure 3.1.2 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Splint $as_me 3.1.2, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_sep= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" # Get rid of the leading space. ac_sep=" " ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------- ## ## Output files. ## ## ------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=$`echo $ac_var` echo "$ac_var='"'"'$ac_val'"'"'" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h | sort echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config $srcdir/config; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_target_alias=$target_alias test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version="1.6" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # Define the identity of the package. PACKAGE=splint VERSION=3.1.2 # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Add the stamp file to the list of files AC keeps track of, # along with our hook. ac_config_headers="$ac_config_headers config.h:config.hin" #drl 12-19-2001 commented out so Splint won't depend on C++ #AC_PROG_CXX ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= # b.out is created by i960 compilers. for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; conftest.$ac_ext ) # This is the source file. ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool, # but it would be cool to find out if it's true. Does anybody # maintain Libtool? --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std1 is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std1. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF # Don't try gcc -ansi; that turns off useful extensions and # breaks some systems' header files. # AIX -qlanglvl=ansi # Ultrix and OSF/1 -std1 # HP-UX 10.20 and later -Ae # HP-UX older versions -Aa -D_HPUX_SOURCE # SVR4 -Xc -D__EXTENSIONS__ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext done rm -f conftest.$ac_ext conftest.$ac_objext CC=$ac_save_CC fi case "x$ac_cv_prog_cc_stdc" in x|xno) echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ '' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration #include int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 continue fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_declaration int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CC_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag ac_cpp_err=$ac_cpp_err$ac_c_werror_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then echo "$as_me:$LINENO: result: $LEX" >&5 echo "${ECHO_T}$LEX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test -z "$LEXLIB" then echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 if test "${ac_cv_lib_fl_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfl $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_fl_yywrap=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_fl_yywrap=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 if test $ac_cv_lib_fl_yywrap = yes; then LEXLIB="-lfl" else echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 if test "${ac_cv_lib_l_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ll $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_l_yywrap=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_l_yywrap=no fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 if test $ac_cv_lib_l_yywrap = yes; then LEXLIB="-ll" fi fi fi if test "x$LEX" != "x:"; then echo "$as_me:$LINENO: checking lex output file root" >&5 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 if test "${ac_cv_prog_lex_root+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. cat >conftest.l <<_ACEOF %% %% _ACEOF { (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 (eval $LEX conftest.l) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 rm -f conftest.l LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" cat >conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_lex_yytext_pointer=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\_ACEOF #define YYTEXT_POINTER 1 _ACEOF fi fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="$(MAKE)"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi # Extract the first word of "bison", so it can be a program name with args. set dummy bison; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_BISON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$BISON"; then ac_cv_prog_BISON="$BISON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_BISON="bison" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_BISON" && ac_cv_prog_BISON="no" fi fi BISON=$ac_cv_prog_BISON if test -n "$BISON"; then echo "$as_me:$LINENO: result: $BISON" >&5 echo "${ECHO_T}$BISON" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "grep", so it can be a program name with args. set dummy grep; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GREP"; then ac_cv_prog_GREP="$GREP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_GREP="grep" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_GREP" && ac_cv_prog_GREP="grep-is-missing" fi fi GREP=$ac_cv_prog_GREP if test -n "$GREP"; then echo "$as_me:$LINENO: result: $GREP" >&5 echo "${ECHO_T}$GREP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "diff", so it can be a program name with args. set dummy diff; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_DIFF+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DIFF"; then ac_cv_prog_DIFF="$DIFF" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DIFF="diff" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_DIFF" && ac_cv_prog_DIFF="diff-is-missing" fi fi DIFF=$ac_cv_prog_DIFF if test -n "$DIFF"; then echo "$as_me:$LINENO: result: $DIFF" >&5 echo "${ECHO_T}$DIFF" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "cat", so it can be a program name with args. set dummy cat; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CAT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CAT"; then ac_cv_prog_CAT="$CAT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CAT="cat" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_CAT" && ac_cv_prog_CAT="cat-is-missing" fi fi CAT=$ac_cv_prog_CAT if test -n "$CAT"; then echo "$as_me:$LINENO: result: $CAT" >&5 echo "${ECHO_T}$CAT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RM"; then ac_cv_prog_RM="$RM" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RM="rm" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_RM" && ac_cv_prog_RM="rm-is-missing" fi fi RM=$ac_cv_prog_RM if test -n "$RM"; then echo "$as_me:$LINENO: result: $RM" >&5 echo "${ECHO_T}$RM" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MV+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MV"; then ac_cv_prog_MV="$MV" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MV="mv" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_MV" && ac_cv_prog_MV="mv-is-missing" fi fi MV=$ac_cv_prog_MV if test -n "$MV"; then echo "$as_me:$LINENO: result: $MV" >&5 echo "${ECHO_T}$MV" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CP"; then ac_cv_prog_CP="$CP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CP="cp" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_CP" && ac_cv_prog_CP="cp-is-missing" fi fi CP=$ac_cv_prog_CP if test -n "$CP"; then echo "$as_me:$LINENO: result: $CP" >&5 echo "${ECHO_T}$CP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$SED"; then ac_cv_prog_SED="$SED" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_SED="sed" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_SED" && ac_cv_prog_SED="sed-is-missing" fi fi SED=$ac_cv_prog_SED if test -n "$SED"; then echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking whether we need _ALL_SOURCE to expose mode_t" >&5 echo $ECHO_N "checking whether we need _ALL_SOURCE to expose mode_t... $ECHO_C" >&6 all=no cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include mode_t x; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 all=maybe fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext if test $all = maybe ; then cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #define _ALL_SOURCE #include mode_t x; int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF all=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $all = maybe ; then all=no ; fi echo "$as_me:$LINENO: result: $all" >&5 echo "${ECHO_T}$all" >&6 LCLOBJ='$(lcl_OBJECTS)' # Check whether --with-lcl or --without-lcl was given. if test "${with_lcl+set}" = set; then withval="$with_lcl" ac_cv_use_lcl=$withval else echo "$as_me:$LINENO: checking whether to include support for LCL files" >&5 echo $ECHO_N "checking whether to include support for LCL files... $ECHO_C" >&6 if test "${ac_cv_use_lcl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_lcl=yes fi echo "$as_me:$LINENO: result: $ac_cv_use_lcl" >&5 echo "${ECHO_T}$ac_cv_use_lcl" >&6 fi; if test x$ac_cv_use_lcl != xyes; then LCLOBJ= cat >>confdefs.h <<\_ACEOF #define NOLCL 1 _ACEOF fi # Make sure we have an actual value for $prefix myprefix=$prefix test x$myprefix = xNONE && myprefix=$ac_default_prefix ### Yuck! This is really kludgey, but I don't understand autoconf well ### enough to do something simple that always works. Hopefully this does. # cpplib.h defines 2 include dirs; one is $includedir, the other is gcc's # include dir. Not the most portable setup, but let's do our best. if test x$GCC = xyes; then # This breaks on gcc-3.0 on redhat fixing drl 11-15-2001 # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/'` GCC_INCLUDE_DIR=/usr/include # was /usr/lib/gcc-lib/i386-linux/2.7.2.1/include # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -n -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/p'` cat >>confdefs.h <<_ACEOF #define GCC_INCLUDE_DIR "$GCC_INCLUDE_DIR" _ACEOF else GCC_INCLUDE_DIR=/usr/include cat >>confdefs.h <<_ACEOF #define GCC_INCLUDE_DIR "$GCC_INCLUDE_DIR" _ACEOF fi cat >>confdefs.h <<_ACEOF #define GCC_INCLUDE_DIR2 "$myprefix/include" _ACEOF # These used to be in local_constants.h cat >>confdefs.h <<_ACEOF #define SYSTEM_LIBDIR "$myprefix/include" _ACEOF cat >>confdefs.h <<_ACEOF #define DEFAULT_LARCHPATH ".$PATH_SEPARATOR$myprefix/share/splint/lib$PATH_SEPARATOR`pwd`/lib$PATH_SEPARATOR" _ACEOF cat >>confdefs.h <<_ACEOF #define DEFAULT_LCLIMPORTDIR ".$PATH_SEPARATOR$myprefix/share/splint/imports$PATH_SEPARATOR`pwd`/imports" _ACEOF # These used to be in herald.h LCL_PARSE_VERSION="Splint 3.1.2" cat >>confdefs.h <<_ACEOF #define SPLINT_VERSION "$LCL_PARSE_VERSION --- `date +"%d %b %Y"`" _ACEOF cat >>confdefs.h <<_ACEOF #define LCL_PARSE_VERSION "$LCL_PARSE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define LCL_COMPILE "Compiled using $CC $CFLAGS on `uname -a` by `whoami`" _ACEOF cat >>confdefs.h <<\_ACEOF #define UNIX 1 _ACEOF #just define some Header constants for now... UNAME=`uname` cat >>confdefs.h <<_ACEOF #define UNAME "${UNAME}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD "${build}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST "${host}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET "${target}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_ALIAS "${build_alias}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_ALIAS "${host_alias}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_ALIAS "${TARGET_ALIAS}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_CPU "${build_cpu}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_CPU "$host_cpu" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_CPU "${target_cpu}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_VENDOR "${build_vendor}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_VENDOR "${host_vendor}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_VENDOR "${target_vendor}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_OS "${build_os}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_OS "${host_os}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_OS "${target_os}" _ACEOF ac_config_files="$ac_config_files Makefile imports/Makefile lib/Makefile src/Makefile test/Makefile doc/Makefile bin/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if diff $cache_file confcache >/dev/null 2>&1; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_i=`echo "$ac_i" | sed 's/\$U\././;s/\.o$//;s/\.obj$//'` # 2. Add them. ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi DUALCASE=1; export DUALCASE # for MKS sh # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # Work around bugs in pre-3.0 UWIN ksh. $as_unset ENV MAIL MAILPATH PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; } $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; } CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by Splint $as_me 3.1.2, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Splint config.status 3.1.2 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2003 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` ac_shift=: ;; -*) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; *) # This is not an option, so the user has probably given explicit # arguments. ac_option=$1 ac_need_defaults=false;; esac case $ac_option in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg" ac_need_defaults=false;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running $SHELL $0 " $ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 exec $SHELL $0 $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "imports/Makefile" ) CONFIG_FILES="$CONFIG_FILES imports/Makefile" ;; "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "test/Makefile" ) CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "bin/Makefile" ) CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason to put it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d -q "./confstatXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./confstat$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@target@,$target,;t t s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@CPP@,$CPP,;t t s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t s,@LN_S@,$LN_S,;t t s,@BISON@,$BISON,;t t s,@GREP@,$GREP,;t t s,@DIFF@,$DIFF,;t t s,@CAT@,$CAT,;t t s,@RM@,$RM,;t t s,@MV@,$MV,;t t s,@CP@,$CP,;t t s,@SED@,$SED,;t t s,@LCLOBJ@,$LCLOBJ,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } # Do quote $f, to prevent DOS paths from being IFS'd. echo "$f";; *) # Relative if test -f "$f"; then # Build tree echo "$f" elif test -f "$srcdir/$f"; then # Source tree echo "$srcdir/$f" else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if grep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # grep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if diff $ac_file $tmp/config.h >/dev/null 2>&1; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Run the commands associated with the file. case $ac_file in config.h ) # update the timestamp echo 'timestamp for config.h:config.hin' >"./stamp-h1" ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p "$ac_dir" else as_dir="$ac_dir" as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5 echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Do not use `cd foo && pwd` to compute absolute paths, because # the directories may not exist. case `pwd` in .) ac_abs_builddir="$ac_dir";; *) case "$ac_dir" in .) ac_abs_builddir=`pwd`;; [\\/]* | ?:[\\/]* ) ac_abs_builddir="$ac_dir";; *) ac_abs_builddir=`pwd`/"$ac_dir";; esac;; esac case $ac_abs_builddir in .) ac_abs_top_builddir=${ac_top_builddir}.;; *) case ${ac_top_builddir}. in .) ac_abs_top_builddir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_builddir=${ac_top_builddir}.;; *) ac_abs_top_builddir=$ac_abs_builddir/${ac_top_builddir}.;; esac;; esac case $ac_abs_builddir in .) ac_abs_srcdir=$ac_srcdir;; *) case $ac_srcdir in .) ac_abs_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_srcdir=$ac_srcdir;; *) ac_abs_srcdir=$ac_abs_builddir/$ac_srcdir;; esac;; esac case $ac_abs_builddir in .) ac_abs_top_srcdir=$ac_top_srcdir;; *) case $ac_top_srcdir in .) ac_abs_top_srcdir=$ac_abs_builddir;; [\\/]* | ?:[\\/]* ) ac_abs_top_srcdir=$ac_top_srcdir;; *) ac_abs_top_srcdir=$ac_abs_builddir/$ac_top_srcdir;; esac;; esac { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { if $as_mkdir_p; then mkdir -p $dirpart/$fdir else as_dir=$dirpart/$fdir as_dirs= while test ! -d "$as_dir"; do as_dirs="$as_dir $as_dirs" as_dir=`(dirname "$as_dir") 2>/dev/null || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` done test ! -n "$as_dirs" || mkdir $as_dirs fi || { { echo "$as_me:$LINENO: error: cannot create directory $dirpart/$fdir" >&5 echo "$as_me: error: cannot create directory $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi splint-3.1.2.dfsg1/configure.ac0000644021234200000250000001755510645764637013770 0ustar faxdnl Process with autoconf to create a configure script -*- Autoconf -*- AC_PREREQ(2.50) AC_INIT([Splint], [3.1.2], [splint-bug@splint.org], [splint]) dnl This MUST precede any other macro AC_CONFIG_AUX_DIR([config]) dnl Set up the source directory AC_CONFIG_SRCDIR([src/lclinit.c]) dnl Deduce host AC_CANONICAL_SYSTEM dnl Set up automake & the configuration header AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, AC_PACKAGE_BUGREPORT) AM_CONFIG_HEADER([config.h:config.hin]) dnl Prepare for Splint processing of config.h AH_TOP([/*@ -macroconstdecl@*/]) AH_BOTTOM([/*@ =macroconstdecl@*/]) dnl Checks for programs. #drl 12-19-2001 commented out so Splint won't depend on C++ #AC_PROG_CXX AC_PROG_CC AC_PROG_CPP dnl This produces a warning. See http://mail.gnu.org/pipermail/bug-automake/2001-August/000213.html AM_PROG_LEX AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LN_S AC_CHECK_PROG(BISON, bison, bison, no) AC_CHECK_PROG(GREP, grep, grep, grep-is-missing) AC_CHECK_PROG(DIFF, diff, diff, diff-is-missing) AC_CHECK_PROG(CAT, cat, cat, cat-is-missing) AC_CHECK_PROG(RM, rm, rm, rm-is-missing) AC_CHECK_PROG(MV, mv, mv, mv-is-missing) AC_CHECK_PROG(CP, cp, cp, cp-is-missing) AC_CHECK_PROG(SED, sed, sed, sed-is-missing) dnl Checks for header files. dnl Currently all disable, as the source files don't care about the results dnl AC_HEADER_DIRENT dnl AC_HEADER_STDC dnl AC_CHECK_HEADERS([alloca.h errno.h fcntl.h float.h limits.h locale.h malloc.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h]) dnl Checks for typedefs, structures, and compiler characteristics. dnl Currently all disable, as the source files don't care about the results dnl AC_C_CONST dnl AC_TYPE_UID_T dnl AC_TYPE_MODE_T dnl AC_TYPE_OFF_T dnl AC_TYPE_PID_T dnl AC_TYPE_SIZE_T dnl AC_STRUCT_ST_BLOCKS dnl AC_CHECK_MEMBERS([struct stat.st_rdev]) dnl AC_DECL_SYS_SIGLIST dnl AC_HEADER_TIME dnl AC_STRUCT_TM dnl AC_CHECK_TYPES([ptrdiff_t]) dnl Checks for library functions. dnl Currently all disable, as the source files don't care about the results dnl AC_FUNC_ALLOCA dnl AC_FUNC_CHOWN dnl AC_FUNC_GETPGRP dnl AC_PROG_GCC_TRADITIONAL dnl AC_FUNC_LSTAT dnl AC_FUNC_MALLOC dnl AC_FUNC_MEMCMP dnl AC_FUNC_MKTIME dnl AC_FUNC_MMAP dnl AC_FUNC_SETVBUF_REVERSED dnl AC_TYPE_SIGNAL dnl AC_FUNC_STAT dnl AC_FUNC_STRCOLL dnl AC_FUNC_STRERROR_R dnl AC_FUNC_VFORK dnl AC_FUNC_VPRINTF dnl AC_FUNC_WAIT3 dnl AC_CHECK_FUNCS([alarm atexit btowc bzero dup2 endgrent endpwent fchdir floor ftruncate getcwd getgroups gethostname gettimeofday isascii iswprint lchown localeconv mblen mbrlen mbrtowc memchr memmove memset mkdir mkfifo modf munmap pathconf pow putenv realpath regcomp rint rmdir rpmatch select setenv socket sqrt strcasecmp strchr strcspn strdup strerror strftime strncasecmp strpbrk strrchr strspn strstr strtod strtol strtoul strtoull tzset uname utime vprintf]) dnl This was provided by Nelson Beebe for dealing with problems on IBM dnl AIX 4.3 with defining mode_t. dnl Checks for _ALL_SOURCE (IBM RS/6000 c89 needs this) AC_MSG_CHECKING(whether we need _ALL_SOURCE to expose mode_t) all=no AC_TRY_COMPILE([ #include mode_t x; ], , , all=maybe) if test $all = maybe ; then AC_TRY_COMPILE([ #define _ALL_SOURCE #include mode_t x; ], , AC_DEFINE(_ALL_SOURCE) all=yes) fi if test $all = maybe ; then all=no ; fi AC_MSG_RESULT($all) AH_TEMPLATE([_ALL_SOURCE], [needed to expose mode_t on some machines]) LCLOBJ='$(lcl_OBJECTS)' AC_ARG_WITH([lcl], AC_HELP_STRING([--without-lcl], [don't include support for LCL files]), ac_cv_use_lcl=$withval, AC_CACHE_CHECK([whether to include support for LCL files], ac_cv_use_lcl, ac_cv_use_lcl=yes)) if test x$ac_cv_use_lcl != xyes; then LCLOBJ= AC_DEFINE(NOLCL, 1, [Define to disable support LCL files]) fi AC_SUBST(LCLOBJ) # Make sure we have an actual value for $prefix myprefix=$prefix test x$myprefix = xNONE && myprefix=$ac_default_prefix ### Yuck! This is really kludgey, but I don't understand autoconf well ### enough to do something simple that always works. Hopefully this does. # cpplib.h defines 2 include dirs; one is $includedir, the other is gcc's # include dir. Not the most portable setup, but let's do our best. if test x$GCC = xyes; then dnl Make sure to override NLS; this assumes gcc prints only dnl Reading specs from blah dnl gcc version blah # This breaks on gcc-3.0 on redhat fixing drl 11-15-2001 # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/'` GCC_INCLUDE_DIR=/usr/include # was /usr/lib/gcc-lib/i386-linux/2.7.2.1/include # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -n -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/p'` AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR, "$GCC_INCLUDE_DIR", [system include directory]) else GCC_INCLUDE_DIR=/usr/include AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR, "$GCC_INCLUDE_DIR", [system include directory]) fi AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR2, "$myprefix/include", [alternate include directory]) # These used to be in local_constants.h AC_DEFINE_UNQUOTED(SYSTEM_LIBDIR, "$myprefix/include", [The system's main include directory]) AC_DEFINE_UNQUOTED(DEFAULT_LARCHPATH, ".$PATH_SEPARATOR$myprefix/share/splint/lib$PATH_SEPARATOR`pwd`/lib$PATH_SEPARATOR", [The directory where Splint's library files live]) AC_DEFINE_UNQUOTED(DEFAULT_LCLIMPORTDIR, ".$PATH_SEPARATOR$myprefix/share/splint/imports$PATH_SEPARATOR`pwd`/imports", [Splint's imports directory]) # These used to be in herald.h LCL_PARSE_VERSION="AC_PACKAGE_NAME AC_PACKAGE_VERSION" AC_DEFINE_UNQUOTED(SPLINT_VERSION, "$LCL_PARSE_VERSION --- `date +"%d %b %Y"`", [Splint's version number and configure/build date]) AC_DEFINE_UNQUOTED(LCL_PARSE_VERSION, "$LCL_PARSE_VERSION", [Splint's version number]) AC_DEFINE_UNQUOTED(LCL_COMPILE, "Compiled using $CC $CFLAGS on `uname -a` by `whoami`", [String describing who compiled this binary and how]) dnl TODO: Use result AC_CANONICAL_SYSTEM to figure out what to define AC_DEFINE(UNIX, 1, [Define if you're on a Unixy system]) #just define some Header constants for now... UNAME=`uname` AC_DEFINE_UNQUOTED(UNAME, "${UNAME}", uname output) AC_DEFINE_UNQUOTED(BUILD, "${build}", build) AC_DEFINE_UNQUOTED(HOST, "${host}", host) AC_DEFINE_UNQUOTED(TARGET, "${target}", target) AC_DEFINE_UNQUOTED(BUILD_ALIAS, "${build_alias}", build_alias) AC_DEFINE_UNQUOTED(HOST_ALIAS, "${host_alias}", host_alias) AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${TARGET_ALIAS}", target_alias) AC_DEFINE_UNQUOTED(BUILD_CPU, "${build_cpu}", build_cpu) AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu", host_cpu) AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}", target_cpu) AC_DEFINE_UNQUOTED(BUILD_VENDOR, "${build_vendor}", build_vendor) AC_DEFINE_UNQUOTED(HOST_VENDOR, "${host_vendor}", host_vendor) AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", target_vendor) AC_DEFINE_UNQUOTED(BUILD_OS, "${build_os}", build_os) AC_DEFINE_UNQUOTED(HOST_OS, "${host_os}", host_os) AC_DEFINE_UNQUOTED(TARGET_OS,"${target_os}", target_os) dnl AC_CONFIG_FILES([test/Makefile dnl test/ensuresclauses/Makefile dnl test/conditions/Makefile dnl test/db2/Makefile dnl test/warnuse/Makefile dnl test/tainted/Makefile dnl test/fileio/Makefile dnl test/tests2.4/Makefile dnl test/db3/Makefile dnl test/metastate/Makefile dnl test/mergestate/Makefile dnl test/tests2.5/Makefile dnl test/tests2.2/Makefile dnl test/db1/Makefile]) AC_CONFIG_FILES([Makefile imports/Makefile lib/Makefile src/Makefile test/Makefile doc/Makefile bin/Makefile]) AC_OUTPUT splint-3.1.2.dfsg1/fixBinaryDist.sh0000755021234200000250000000162107630455435014574 0ustar fax#!/bin/sh #This script is intended to be called in make dist #THis is intended to be run in the distribution directory... pwd #echo doing bash #bash #Need to do this so modifications to the destination directory won't effect #the real directory rm Makefile.am rm configure.ac mv Makefile.binary.am Makefile.am mv configure.binary.ac configure.ac sleep 3 mv configure.binary configure #should probably do this in Makefile but it doesn't seem to work.. sed -e 's/Makefile\.binary/Makefile/' Makefile.binary.in > Makefile.in rm Makefile.binary.in #run these if possible... #autoconf #automake mkdir src || echo "COULD NOT MAKE src tar ball may be incorrect" echo "Created this file because some versions of tar are too simple include this directory without it" > src/dummy # Need to do this in the makefile because the tar command in make dist wants to derefence symlinks #ln -s ../bin/splint src/splint splint-3.1.2.dfsg1/Makefile.binary.am0000644021234200000250000000230407630455435014774 0ustar fax## Process this file with automake to create Makefile.in. -*-Makefile-*- ## ## Makefile for Splint 3.0 ## For more information: http://www.splint.org ## ## Copyright (C) 2001-2 University of Virginia, ## Massachusetts Institute of Technology ## ## This program is free software; you can redistribute it and/or modify it ## under the terms of the GNU General Public License as published by the ## Free Software Foundation; either version 2 of the License, or (at your ## option) any later version. ## ## This program is distributed in the hope that it will be useful, but ## WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ## General Public License for more details. ## ## The GNU General Public License is available from http://www.gnu.org/ or ## the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ## MA 02111-1307, USA. ## ## For information on spint: info@splint.org ## To report a bug: splint-bug@splint.org ## AUTOMAKE_OPTIONS = 1.6.3 foreign binaryDir = bin SUBDIRS = $(binaryDir) lib imports doc all: config.h src/splint src/splint: $(binaryDir)/splint ln -s ../$(binaryDir)/splint src/splint splint-3.1.2.dfsg1/configure.binary.ac0000644021234200000250000001761007656111443015230 0ustar faxdnl Process with autoconf to create a configure script -*- Autoconf -*- AC_PREREQ(2.50) AC_INIT([Splint], [3.1.1], [splint-bug@splint.org], [splint]) dnl This MUST precede any other macro AC_CONFIG_AUX_DIR([config]) dnl Set up the source directory #NO source directory in the binary release so this must be commented out #AC_CONFIG_SRCDIR([src/lclinit.c]) dnl Deduce host AC_CANONICAL_SYSTEM dnl Set up automake & the configuration header AM_INIT_AUTOMAKE(AC_PACKAGE_TARNAME, AC_PACKAGE_VERSION, AC_PACKAGE_BUGREPORT) AM_CONFIG_HEADER([config.h:config.hin]) dnl Prepare for Splint processing of config.h AH_TOP([/*@-constmacros@*/]) AH_BOTTOM([/*@=constmacros@*/]) dnl Checks for programs. #drl 12-19-2001 commented out so Splint won't depend on C++ #AC_PROG_CXX AC_PROG_CC AC_PROG_CPP dnl This produces a warning. See http://mail.gnu.org/pipermail/bug-automake/2001-August/000213.html AM_PROG_LEX AC_PROG_INSTALL AC_PROG_MAKE_SET AC_PROG_LN_S AC_CHECK_PROG(BISON, bison, bison, no) AC_CHECK_PROG(GREP, grep, grep, grep-is-missing) AC_CHECK_PROG(DIFF, diff, diff, diff-is-missing) AC_CHECK_PROG(CAT, cat, cat, cat-is-missing) AC_CHECK_PROG(RM, rm, rm, rm-is-missing) AC_CHECK_PROG(MV, mv, mv, mv-is-missing) AC_CHECK_PROG(CP, cp, cp, cp-is-missing) AC_CHECK_PROG(SED, sed, sed, sed-is-missing) dnl Checks for header files. dnl Currently all disable, as the source files don't care about the results dnl AC_HEADER_DIRENT dnl AC_HEADER_STDC dnl AC_CHECK_HEADERS([alloca.h errno.h fcntl.h float.h limits.h locale.h malloc.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h]) dnl Checks for typedefs, structures, and compiler characteristics. dnl Currently all disable, as the source files don't care about the results dnl AC_C_CONST dnl AC_TYPE_UID_T dnl AC_TYPE_MODE_T dnl AC_TYPE_OFF_T dnl AC_TYPE_PID_T dnl AC_TYPE_SIZE_T dnl AC_STRUCT_ST_BLOCKS dnl AC_CHECK_MEMBERS([struct stat.st_rdev]) dnl AC_DECL_SYS_SIGLIST dnl AC_HEADER_TIME dnl AC_STRUCT_TM dnl AC_CHECK_TYPES([ptrdiff_t]) dnl Checks for library functions. dnl Currently all disable, as the source files don't care about the results dnl AC_FUNC_ALLOCA dnl AC_FUNC_CHOWN dnl AC_FUNC_GETPGRP dnl AC_PROG_GCC_TRADITIONAL dnl AC_FUNC_LSTAT dnl AC_FUNC_MALLOC dnl AC_FUNC_MEMCMP dnl AC_FUNC_MKTIME dnl AC_FUNC_MMAP dnl AC_FUNC_SETVBUF_REVERSED dnl AC_TYPE_SIGNAL dnl AC_FUNC_STAT dnl AC_FUNC_STRCOLL dnl AC_FUNC_STRERROR_R dnl AC_FUNC_VFORK dnl AC_FUNC_VPRINTF dnl AC_FUNC_WAIT3 dnl AC_CHECK_FUNCS([alarm atexit btowc bzero dup2 endgrent endpwent fchdir floor ftruncate getcwd getgroups gethostname gettimeofday isascii iswprint lchown localeconv mblen mbrlen mbrtowc memchr memmove memset mkdir mkfifo modf munmap pathconf pow putenv realpath regcomp rint rmdir rpmatch select setenv socket sqrt strcasecmp strchr strcspn strdup strerror strftime strncasecmp strpbrk strrchr strspn strstr strtod strtol strtoul strtoull tzset uname utime vprintf]) dnl This was provided by Nelson Beebe for dealing with problems on IBM dnl AIX 4.3 with defining mode_t. dnl Checks for _ALL_SOURCE (IBM RS/6000 c89 needs this) AC_MSG_CHECKING(whether we need _ALL_SOURCE to expose mode_t) all=no AC_TRY_COMPILE([ #include mode_t x; ], , , all=maybe) if test $all = maybe ; then AC_TRY_COMPILE([ #define _ALL_SOURCE #include mode_t x; ], , AC_DEFINE(_ALL_SOURCE) all=yes) fi if test $all = maybe ; then all=no ; fi AC_MSG_RESULT($all) AH_TEMPLATE([_ALL_SOURCE], [needed to expose mode_t on some machines]) LCLOBJ='$(lcl_OBJECTS)' AC_ARG_WITH([lcl], AC_HELP_STRING([--without-lcl], [don't include support for LCL files]), ac_cv_use_lcl=$withval, AC_CACHE_CHECK([whether to include support for LCL files], ac_cv_use_lcl, ac_cv_use_lcl=yes)) if test x$ac_cv_use_lcl != xyes; then LCLOBJ= AC_DEFINE(NOLCL, 1, [Define to disable support LCL files]) fi AC_SUBST(LCLOBJ) # Make sure we have an actual value for $prefix myprefix=$prefix test x$myprefix = xNONE && myprefix=$ac_default_prefix ### Yuck! This is really kludgey, but I don't understand autoconf well ### enough to do something simple that always works. Hopefully this does. # cpplib.h defines 2 include dirs; one is $includedir, the other is gcc's # include dir. Not the most portable setup, but let's do our best. if test x$GCC = xyes; then dnl Make sure to override NLS; this assumes gcc prints only dnl Reading specs from blah dnl gcc version blah # This breaks on gcc-3.0 on redhat fixing drl 11-15-2001 # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/'` GCC_INCLUDE_DIR=/usr/include # was /usr/lib/gcc-lib/i386-linux/2.7.2.1/include # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -n -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/p'` AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR, "$GCC_INCLUDE_DIR", [system include directory]) else GCC_INCLUDE_DIR=/usr/include AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR, "$GCC_INCLUDE_DIR", [system include directory]) fi AC_DEFINE_UNQUOTED(GCC_INCLUDE_DIR2, "$myprefix/include", [alternate include directory]) # These used to be in local_constants.h AC_DEFINE_UNQUOTED(SYSTEM_LIBDIR, "$myprefix/include", [The system's main include directory]) AC_DEFINE_UNQUOTED(DEFAULT_LARCHPATH, ".$PATH_SEPARATOR$myprefix/share/splint/lib$PATH_SEPARATOR`pwd`/lib$PATH_SEPARATOR", [The directory where Splint's library files live]) AC_DEFINE_UNQUOTED(DEFAULT_LCLIMPORTDIR, ".$PATH_SEPARATOR$myprefix/share/splint/imports$PATH_SEPARATOR`pwd`/imports", [Splint's imports directory]) # These used to be in herald.h LCL_PARSE_VERSION="AC_PACKAGE_NAME AC_PACKAGE_VERSION" AC_DEFINE_UNQUOTED(SPLINT_VERSION, "$LCL_PARSE_VERSION --- `date +"%d %b %Y"`", [Splint's version number and configure/build date]) AC_DEFINE_UNQUOTED(LCL_PARSE_VERSION, "$LCL_PARSE_VERSION", [Splint's version number]) AC_DEFINE_UNQUOTED(LCL_COMPILE, "Compiled using $CC $CFLAGS on `uname -a` by `whoami`", [String describing who compiled this binary and how]) dnl TODO: Use result AC_CANONICAL_SYSTEM to figure out what to define AC_DEFINE(UNIX, 1, [Define if you're on a Unixy system]) #just define some Header constants for now... UNAME=`uname` AC_DEFINE_UNQUOTED(UNAME, "${UNAME}", uname output) AC_DEFINE_UNQUOTED(BUILD, "${build}", build) AC_DEFINE_UNQUOTED(HOST, "${host}", host) AC_DEFINE_UNQUOTED(TARGET, "${target}", target) AC_DEFINE_UNQUOTED(BUILD_ALIAS, "${build_alias}", build_alias) AC_DEFINE_UNQUOTED(HOST_ALIAS, "${host_alias}", host_alias) AC_DEFINE_UNQUOTED(TARGET_ALIAS, "${TARGET_ALIAS}", target_alias) AC_DEFINE_UNQUOTED(BUILD_CPU, "${build_cpu}", build_cpu) AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu", host_cpu) AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}", target_cpu) AC_DEFINE_UNQUOTED(BUILD_VENDOR, "${build_vendor}", build_vendor) AC_DEFINE_UNQUOTED(HOST_VENDOR, "${host_vendor}", host_vendor) AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", target_vendor) AC_DEFINE_UNQUOTED(BUILD_OS, "${build_os}", build_os) AC_DEFINE_UNQUOTED(HOST_OS, "${host_os}", host_os) AC_DEFINE_UNQUOTED(TARGET_OS,"${target_os}", target_os) dnl AC_CONFIG_FILES([ dnl test/ensuresclauses/Makefile dnl test/conditions/Makefile dnl test/db2/Makefile dnl test/warnuse/Makefile dnl test/tainted/Makefile dnl test/fileio/Makefile dnl test/tests2.4/Makefile dnl test/db3/Makefile dnl test/metastate/Makefile dnl test/mergestate/Makefile dnl test/tests2.5/Makefile dnl test/tests2.2/Makefile dnl test/db1/Makefile]) AC_CONFIG_FILES([Makefile imports/Makefile lib/Makefile doc/Makefile bin/Makefile]) AC_OUTPUT splint-3.1.2.dfsg1/Makefile.binary.in0000644021234200000250000003261307630455435015013 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.binary.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = . ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.6.3 foreign binaryDir = bin SUBDIRS = $(binaryDir) lib imports doc subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = DIST_SOURCES = RECURSIVE_TARGETS = info-recursive dvi-recursive install-info-recursive \ uninstall-info-recursive all-recursive install-data-recursive \ install-exec-recursive installdirs-recursive install-recursive \ uninstall-recursive check-recursive installcheck-recursive DIST_COMMON = README Makefile.am Makefile.binary.in acinclude.m4 \ aclocal.m4 config.hin config/config.guess config/config.sub \ config/depcomp config/install-sh config/missing \ config/mkinstalldirs configure configure.ac DIST_SUBDIRS = $(SUBDIRS) all: config.h $(MAKE) $(AM_MAKEFLAGS) all-recursive .SUFFIXES: am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno $(srcdir)/Makefile.in: Makefile.binary.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile Makefile: $(srcdir)/Makefile.binary.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe) $(top_builddir)/config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(srcdir)/configure: $(srcdir)/configure.ac $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): configure.ac acinclude.m4 cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) config.h: stamp-h1 @if test ! -f $@; then \ rm -f stamp-h1; \ $(MAKE) stamp-h1; \ else :; fi stamp-h1: $(srcdir)/config.hin $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status config.h $(srcdir)/config.hin: $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && $(AUTOHEADER) touch $(srcdir)/config.hin distclean-hdr: -rm -f config.h stamp-h1 uninstall-info-am: # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" mostlyclean-recursive clean-recursive distclean-recursive \ maintainer-clean-recursive: @set fnord $$MAKEFLAGS; amf=$$2; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: tags-recursive $(HEADERS) $(SOURCES) config.hin $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -f $$subdir/TAGS && tags="$$tags -i $$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) config.hin $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = . distdir = $(PACKAGE)-$(VERSION) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } GZIP_ENV = --best distcleancheck_listfiles = find . -type f -print distdir: $(DISTFILES) $(am__remove_distdir) mkdir $(distdir) $(mkinstalldirs) $(distdir)/config @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d $(distdir)/$$subdir \ || mkdir $(distdir)/$$subdir \ || exit 1; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" \ distdir=../$(distdir)/$$subdir \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist dist-all: distdir $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist $(am__remove_distdir) GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/=build mkdir $(distdir)/=inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/=inst && pwd` \ && cd $(distdir)/=build \ && ../configure --srcdir=.. --prefix=$$dc_install_base \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && (test `find $$dc_install_base -type f -print | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ find $$dc_install_base -type f -print ; \ exit 1; } >&2 ) \ && $(MAKE) $(AM_MAKEFLAGS) dist-gzip \ && rm -f $(distdir).tar.gz \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @echo "$(distdir).tar.gz is ready for distribution" | \ sed 'h;s/./=/g;p;x;p;x' distcleancheck: distclean if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile config.h installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-recursive dvi-am: info: info-recursive info-am: install-data-am: install-exec-am: install-info: install-info-recursive install-man: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf autom4te.cache maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-info-am uninstall-info: uninstall-info-recursive .PHONY: $(RECURSIVE_TARGETS) GTAGS all all-am check check-am clean \ clean-generic clean-recursive dist dist-all dist-gzip distcheck \ distclean distclean-generic distclean-hdr distclean-recursive \ distclean-tags distcleancheck distdir dvi dvi-am dvi-recursive \ info info-am info-recursive install install-am install-data \ install-data-am install-data-recursive install-exec \ install-exec-am install-exec-recursive install-info \ install-info-am install-info-recursive install-man \ install-recursive install-strip installcheck installcheck-am \ installdirs installdirs-am installdirs-recursive \ maintainer-clean maintainer-clean-generic \ maintainer-clean-recursive mostlyclean mostlyclean-generic \ mostlyclean-recursive tags tags-recursive uninstall \ uninstall-am uninstall-info-am uninstall-info-recursive \ uninstall-recursive all: config.h src/splint src/splint: $(binaryDir)/splint ln -s ../$(binaryDir)/splint src/splint # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/configure.binary0000755021234200000250000044137107656111443014656 0ustar fax#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.53 for Splint 3.1.1. # # Report bugs to . # # Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi (set +x; test -n "`(LANG=C; export LANG) 2>&1`") && { $as_unset LANG || test "${LANG+set}" != set; } || { LANG=C; export LANG; } (set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || { LC_ALL=C; export LC_ALL; } (set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || { LC_TIME=C; export LC_TIME; } (set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || { LC_CTYPE=C; export LC_CTYPE; } (set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || { LANGUAGE=C; export LANGUAGE; } (set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || { LC_COLLATE=C; export LC_COLLATE; } (set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || { LC_NUMERIC=C; export LC_NUMERIC; } (set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || { LC_MESSAGES=C; export LC_MESSAGES; } # Name of the executable. as_me=`(basename "$0") 2>/dev/null || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conftest.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2 { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` exec 6>&1 # # Initializations. # ac_default_prefix=/usr/local cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Maximum number of lines to put in a shell here document. # This variable seems obsolete. It should probably be removed, and # only ac_max_sed_lines should be used. : ${ac_max_here_lines=38} # Identity of this package. PACKAGE_NAME='Splint' PACKAGE_TARNAME='splint' PACKAGE_VERSION='3.1.1' PACKAGE_STRING='Splint 3.1.1' PACKAGE_BUGREPORT='splint-bug@splint.org' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datadir='${prefix}/share' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' libdir='${exec_prefix}/lib' includedir='${prefix}/include' oldincludedir='/usr/include' infodir='${prefix}/info' mandir='${prefix}/man' ac_prev= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval "$ac_prev=\$ac_option" ac_prev= continue fi ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'` # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_option in -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad | --data | --dat | --da) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ | --da=*) datadir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` eval "enable_$ac_feature=no" ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "enable_$ac_feature='$ac_optarg'" ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst \ | --locals | --local | --loca | --loc | --lo) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* \ | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package| sed 's/-/_/g'` case $ac_option in *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;; *) ac_optarg=yes ;; esac eval "with_$ac_package='$ac_optarg'" ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/-/_/g'` eval "with_$ac_package=no" ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` eval "$ac_envvar='$ac_optarg'" export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute paths. for ac_var in exec_prefix prefix do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* | NONE | '' ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # Be sure to have absolute paths. for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \ localstatedir libdir includedir oldincludedir infodir mandir do eval ac_val=$`echo $ac_var` case $ac_val in [\\/$]* | ?:[\\/]* ) ;; *) { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; };; esac done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then its parent. ac_confdir=`(dirname "$0") 2>/dev/null || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` srcdir=$ac_confdir if test ! -r $srcdir/$ac_unique_file; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r $srcdir/$ac_unique_file; then if test "$ac_srcdir_defaulted" = yes; then { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2 { (exit 1); exit 1; }; } else { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi fi srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'` ac_env_build_alias_set=${build_alias+set} ac_env_build_alias_value=$build_alias ac_cv_env_build_alias_set=${build_alias+set} ac_cv_env_build_alias_value=$build_alias ac_env_host_alias_set=${host_alias+set} ac_env_host_alias_value=$host_alias ac_cv_env_host_alias_set=${host_alias+set} ac_cv_env_host_alias_value=$host_alias ac_env_target_alias_set=${target_alias+set} ac_env_target_alias_value=$target_alias ac_cv_env_target_alias_set=${target_alias+set} ac_cv_env_target_alias_value=$target_alias ac_env_CC_set=${CC+set} ac_env_CC_value=$CC ac_cv_env_CC_set=${CC+set} ac_cv_env_CC_value=$CC ac_env_CFLAGS_set=${CFLAGS+set} ac_env_CFLAGS_value=$CFLAGS ac_cv_env_CFLAGS_set=${CFLAGS+set} ac_cv_env_CFLAGS_value=$CFLAGS ac_env_LDFLAGS_set=${LDFLAGS+set} ac_env_LDFLAGS_value=$LDFLAGS ac_cv_env_LDFLAGS_set=${LDFLAGS+set} ac_cv_env_LDFLAGS_value=$LDFLAGS ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS ac_env_CPP_set=${CPP+set} ac_env_CPP_value=$CPP ac_cv_env_CPP_set=${CPP+set} ac_cv_env_CPP_value=$CPP # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Splint 3.1.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] _ACEOF cat <<_ACEOF Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --datadir=DIR read-only architecture-independent data [PREFIX/share] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --infodir=DIR info documentation [PREFIX/info] --mandir=DIR man documentation [PREFIX/man] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] --target=TARGET configure for building compilers for TARGET [HOST] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Splint 3.1.1:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-dependency-tracking Speeds up one-time builds --enable-dependency-tracking Do not reject slow dependency extractors Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --without-lcl don't include support for LCL files Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory CPPFLAGS C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. ac_popdir=`pwd` for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d $ac_dir || continue ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` cd $ac_dir # Check for guested configure; otherwise get Cygnus style configure. if test -f $ac_srcdir/configure.gnu; then echo $SHELL $ac_srcdir/configure.gnu --help=recursive elif test -f $ac_srcdir/configure; then echo $SHELL $ac_srcdir/configure --help=recursive elif test -f $ac_srcdir/configure.ac || test -f $ac_srcdir/configure.in; then echo $ac_configure --help else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi cd $ac_popdir done fi test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF Splint configure 3.1.1 generated by GNU Autoconf 2.53 Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit 0 fi exec 5>config.log cat >&5 <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Splint $as_me 3.1.1, which was generated by GNU Autoconf 2.53. Invocation command line was $ $0 $@ _ACEOF { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` hostinfo = `(hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Also quote any args containing shell meta-characters. ac_configure_args= ac_sep= for ac_arg do case $ac_arg in -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n ) continue ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) continue ;; *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'" ac_sep=" " ;; esac # Get rid of the leading space. done # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Be sure not to use single quotes in there, as some shells, # such as our DU 5.0 friend, will then `close' the trap. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, { (set) 2>&1 | case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in *ac_space=\ *) sed -n \ "s/'"'"'/'"'"'\\\\'"'"''"'"'/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p" ;; *) sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } echo if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo sed "/^$/d" confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core core.* *.core && rm -rf conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -rf conftest* confdefs.h # AIX cpp loses on an empty file, so make sure it contains at least a newline. echo >confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -z "$CONFIG_SITE"; then if test "x$prefix" != xNONE; then CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" else CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" fi fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; *) . ./$cache_file;; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in `(set) 2>&1 | sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val="\$ac_cv_env_${ac_var}_value" eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config $srcdir/config; do if test -f $ac_dir/install-sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f $ac_dir/install.sh; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f $ac_dir/shtool; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config $srcdir/config" >&5 echo "$as_me: error: cannot find install-sh or install.sh in config $srcdir/config" >&2;} { (exit 1); exit 1; }; } fi ac_config_guess="$SHELL $ac_aux_dir/config.guess" ac_config_sub="$SHELL $ac_aux_dir/config.sub" ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. #NO source directory in the binary release so this must be commented out #AC_CONFIG_SRCDIR([src/lclinit.c]) # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || { { echo "$as_me:$LINENO: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } echo "$as_me:$LINENO: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_build_alias=$build_alias test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_build_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_host_alias=$host_alias test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` echo "$as_me:$LINENO: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_target_alias=$target_alias test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || { { echo "$as_me:$LINENO: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` target_vendor=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` target_os=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` # The aliases save the names the user supplied, while $host etc. # will get canonicalized. test -n "$target_alias" && test "$program_prefix$program_suffix$program_transform_name" = \ NONENONEs,x,x, && program_prefix=${target_alias}- am__api_version="1.6" # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6 # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 test "$program_prefix" != NONE && program_transform_name="s,^,$program_prefix,;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s,\$,$program_suffix,;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="${MAKE}"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi # test to see if srcdir already configured if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi # Define the identity of the package. PACKAGE=splint VERSION=3.1.1 # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} AMTAR=${AMTAR-"${am_missing_run}tar"} install_sh=${install_sh-"$am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_ac_ct_STRIP" && ac_cv_prog_ac_ct_STRIP=":" fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi STRIP=$ac_ct_STRIP else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Add the stamp file to the list of files AC keeps track of, # along with our hook. ac_config_headers="$ac_config_headers config.h:config.hin" #drl 12-19-2001 commented out so Splint won't depend on C++ #AC_PROG_CXX ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi CC=$ac_ct_CC else CC="$ac_cv_prog_CC" fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift set dummy "$as_dir/$ac_word" ${1+"$@"} shift ac_cv_prog_CC="$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$ac_ct_CC" && break done CC=$ac_ct_CC fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (eval echo "$as_me:$LINENO: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (eval echo "$as_me:$LINENO: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. echo "$as_me:$LINENO: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last # resort. # Be careful to initialize this variable, since it used to be cached. # Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile. ac_cv_exeext= for ac_file in `ls a_out.exe a.exe conftest.exe 2>/dev/null; ls a.out conftest 2>/dev/null; ls a.* conftest.* 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb | *.xSYM ) ;; a.out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` # FIXME: I believe we export ac_cv_exeext for Libtool --akim. export ac_cv_exeext break;; * ) break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} { (exit 1); exit 1; }; } fi fi fi echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6 if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.o | *.obj | *.xcoff | *.tds | *.d | *.pdb ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` export ac_cv_exeext break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi # Some people use a C++ compiler to compile C. Since we use `exit', # in C++ we need to declare it. In case someone uses the same compiler # for both compiling C and C++ we need to have the C++ compiler decide # the declaration of exit, since it's the most demanding environment. cat >conftest.$ac_ext <<_ACEOF #ifndef __cplusplus choke me #endif _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ '#include ' \ 'extern "C" void std::exit (int) throw (); using std::exit;' \ 'extern "C" void std::exit (int); using std::exit;' \ 'extern "C" void exit (int) throw ();' \ 'extern "C" void exit (int);' \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include $ac_declaration #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" $ac_declaration #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { exit (42); ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done rm -f conftest* if test -n "$ac_declaration"; then echo '#ifdef __cplusplus' >>confdefs.h echo $ac_declaration >>confdefs.h echo '#endif' >>confdefs.h fi else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu rm -f .deps 2>/dev/null mkdir .deps 2>/dev/null if test -d .deps; then DEPDIR=.deps else # MS-DOS does not allow filenames that begin with a dot. DEPDIR=_deps fi rmdir .deps 2>/dev/null ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' doit: @echo done END # If we don't find an include directive, just comment out the code. echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6 am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | fgrep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6 rm -f confinc confmf # Check whether --enable-dependency-tracking or --disable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval="$enable_dependency_tracking" fi; if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6 if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. echo '#include "conftest.h"' > conftest.c echo 'int i;' > conftest.h echo "${am__include} ${am__quote}conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=conftest.c object=conftest.o \ depfile=conftest.Po tmpdepfile=conftest.TPo \ $SHELL ./depcomp $depcc -c conftest.c -o conftest.o >/dev/null 2>&1 && grep conftest.h conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then am_cv_CC_dependencies_compiler_type=$depmode break fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6 CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include Syntax error _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include _ACEOF if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag else ac_cpp_err= fi else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu for ac_prog in flex lex do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LEX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LEX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done fi fi LEX=$ac_cv_prog_LEX if test -n "$LEX"; then echo "$as_me:$LINENO: result: $LEX" >&5 echo "${ECHO_T}$LEX" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$LEX" && break done test -n "$LEX" || LEX=":" if test -z "$LEXLIB" then echo "$as_me:$LINENO: checking for yywrap in -lfl" >&5 echo $ECHO_N "checking for yywrap in -lfl... $ECHO_C" >&6 if test "${ac_cv_lib_fl_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lfl $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_fl_yywrap=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_fl_yywrap=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_fl_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_fl_yywrap" >&6 if test $ac_cv_lib_fl_yywrap = yes; then LEXLIB="-lfl" else echo "$as_me:$LINENO: checking for yywrap in -ll" >&5 echo $ECHO_N "checking for yywrap in -ll... $ECHO_C" >&6 if test "${ac_cv_lib_l_yywrap+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ll $LIBS" cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ #ifdef __cplusplus extern "C" #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ char yywrap (); #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { yywrap (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_l_yywrap=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 ac_cv_lib_l_yywrap=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi echo "$as_me:$LINENO: result: $ac_cv_lib_l_yywrap" >&5 echo "${ECHO_T}$ac_cv_lib_l_yywrap" >&6 if test $ac_cv_lib_l_yywrap = yes; then LEXLIB="-ll" fi fi fi if test "x$LEX" != "x:"; then echo "$as_me:$LINENO: checking lex output file root" >&5 echo $ECHO_N "checking lex output file root... $ECHO_C" >&6 if test "${ac_cv_prog_lex_root+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # The minimal lex program is just a single line: %%. But some broken lexes # (Solaris, I think it was) want two %% lines, so accommodate them. cat >conftest.l <<_ACEOF %% %% _ACEOF { (eval echo "$as_me:$LINENO: \"$LEX conftest.l\"") >&5 (eval $LEX conftest.l) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } if test -f lex.yy.c; then ac_cv_prog_lex_root=lex.yy elif test -f lexyy.c; then ac_cv_prog_lex_root=lexyy else { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5 echo "$as_me: error: cannot find output from $LEX; giving up" >&2;} { (exit 1); exit 1; }; } fi fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5 echo "${ECHO_T}$ac_cv_prog_lex_root" >&6 rm -f conftest.l LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5 echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6 if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # POSIX says lex can declare yytext either as a pointer or an array; the # default is implementation-dependent. Figure out which it is, since # not all implementations provide the %pointer and %array declarations. ac_cv_prog_lex_yytext_pointer=no echo 'extern char *yytext;' >>$LEX_OUTPUT_ROOT.c ac_save_LIBS=$LIBS LIBS="$LIBS $LEXLIB" cat >conftest.$ac_ext <<_ACEOF `cat $LEX_OUTPUT_ROOT.c` _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_lex_yytext_pointer=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_save_LIBS rm -f "${LEX_OUTPUT_ROOT}.c" fi echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5 echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6 if test $ac_cv_prog_lex_yytext_pointer = yes; then cat >>confdefs.h <<\_ACEOF #define YYTEXT_POINTER 1 _ACEOF fi fi if test "$LEX" = :; then LEX=${am_missing_run}flex fi # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. We don't cache a # path for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the path is relative. INSTALL=$ac_install_sh fi fi echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF all: @echo 'ac_maketemp="${MAKE}"' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. eval `${MAKE-make} -f conftest.make 2>/dev/null | grep temp=` if test -n "$ac_maketemp"; then eval ac_cv_prog_make_${ac_make}_set=yes else eval ac_cv_prog_make_${ac_make}_set=no fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi echo "$as_me:$LINENO: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6 else echo "$as_me:$LINENO: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi # Extract the first word of "bison", so it can be a program name with args. set dummy bison; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_BISON+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$BISON"; then ac_cv_prog_BISON="$BISON" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_BISON="bison" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_BISON" && ac_cv_prog_BISON="no" fi fi BISON=$ac_cv_prog_BISON if test -n "$BISON"; then echo "$as_me:$LINENO: result: $BISON" >&5 echo "${ECHO_T}$BISON" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "grep", so it can be a program name with args. set dummy grep; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$GREP"; then ac_cv_prog_GREP="$GREP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_GREP="grep" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_GREP" && ac_cv_prog_GREP="grep-is-missing" fi fi GREP=$ac_cv_prog_GREP if test -n "$GREP"; then echo "$as_me:$LINENO: result: $GREP" >&5 echo "${ECHO_T}$GREP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "diff", so it can be a program name with args. set dummy diff; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_DIFF+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$DIFF"; then ac_cv_prog_DIFF="$DIFF" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DIFF="diff" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_DIFF" && ac_cv_prog_DIFF="diff-is-missing" fi fi DIFF=$ac_cv_prog_DIFF if test -n "$DIFF"; then echo "$as_me:$LINENO: result: $DIFF" >&5 echo "${ECHO_T}$DIFF" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "cat", so it can be a program name with args. set dummy cat; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CAT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CAT"; then ac_cv_prog_CAT="$CAT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CAT="cat" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_CAT" && ac_cv_prog_CAT="cat-is-missing" fi fi CAT=$ac_cv_prog_CAT if test -n "$CAT"; then echo "$as_me:$LINENO: result: $CAT" >&5 echo "${ECHO_T}$CAT" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "rm", so it can be a program name with args. set dummy rm; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RM+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$RM"; then ac_cv_prog_RM="$RM" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RM="rm" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_RM" && ac_cv_prog_RM="rm-is-missing" fi fi RM=$ac_cv_prog_RM if test -n "$RM"; then echo "$as_me:$LINENO: result: $RM" >&5 echo "${ECHO_T}$RM" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "mv", so it can be a program name with args. set dummy mv; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MV+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$MV"; then ac_cv_prog_MV="$MV" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MV="mv" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_MV" && ac_cv_prog_MV="mv-is-missing" fi fi MV=$ac_cv_prog_MV if test -n "$MV"; then echo "$as_me:$LINENO: result: $MV" >&5 echo "${ECHO_T}$MV" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "cp", so it can be a program name with args. set dummy cp; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CP"; then ac_cv_prog_CP="$CP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CP="cp" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_CP" && ac_cv_prog_CP="cp-is-missing" fi fi CP=$ac_cv_prog_CP if test -n "$CP"; then echo "$as_me:$LINENO: result: $CP" >&5 echo "${ECHO_T}$CP" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi # Extract the first word of "sed", so it can be a program name with args. set dummy sed; ac_word=$2 echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_SED+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$SED"; then ac_cv_prog_SED="$SED" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_SED="sed" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done test -z "$ac_cv_prog_SED" && ac_cv_prog_SED="sed-is-missing" fi fi SED=$ac_cv_prog_SED if test -n "$SED"; then echo "$as_me:$LINENO: result: $SED" >&5 echo "${ECHO_T}$SED" >&6 else echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6 fi echo "$as_me:$LINENO: checking whether we need _ALL_SOURCE to expose mode_t" >&5 echo $ECHO_N "checking whether we need _ALL_SOURCE to expose mode_t... $ECHO_C" >&6 all=no cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #include mode_t x; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 all=maybe fi rm -f conftest.$ac_objext conftest.$ac_ext if test $all = maybe ; then cat >conftest.$ac_ext <<_ACEOF #line $LINENO "configure" #include "confdefs.h" #define _ALL_SOURCE #include mode_t x; #ifdef F77_DUMMY_MAIN # ifdef __cplusplus extern "C" # endif int F77_DUMMY_MAIN() { return 1; } #endif int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cat >>confdefs.h <<\_ACEOF #define _ALL_SOURCE 1 _ACEOF all=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext fi if test $all = maybe ; then all=no ; fi echo "$as_me:$LINENO: result: $all" >&5 echo "${ECHO_T}$all" >&6 LCLOBJ='$(lcl_OBJECTS)' # Check whether --with-lcl or --without-lcl was given. if test "${with_lcl+set}" = set; then withval="$with_lcl" ac_cv_use_lcl=$withval else echo "$as_me:$LINENO: checking whether to include support for LCL files" >&5 echo $ECHO_N "checking whether to include support for LCL files... $ECHO_C" >&6 if test "${ac_cv_use_lcl+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_use_lcl=yes fi echo "$as_me:$LINENO: result: $ac_cv_use_lcl" >&5 echo "${ECHO_T}$ac_cv_use_lcl" >&6 fi; if test x$ac_cv_use_lcl != xyes; then LCLOBJ= cat >>confdefs.h <<\_ACEOF #define NOLCL 1 _ACEOF fi # Make sure we have an actual value for $prefix myprefix=$prefix test x$myprefix = xNONE && myprefix=$ac_default_prefix ### Yuck! This is really kludgey, but I don't understand autoconf well ### enough to do something simple that always works. Hopefully this does. # cpplib.h defines 2 include dirs; one is $includedir, the other is gcc's # include dir. Not the most portable setup, but let's do our best. if test x$GCC = xyes; then # This breaks on gcc-3.0 on redhat fixing drl 11-15-2001 # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/'` GCC_INCLUDE_DIR=/usr/include # was /usr/lib/gcc-lib/i386-linux/2.7.2.1/include # GCC_INCLUDE_DIR=`LANGUAGE= LANG= $CC -v 2>&1 | sed -n -e '/^gcc/ d' -e 's/.* \(.*\)specs/\1include/p'` cat >>confdefs.h <<_ACEOF #define GCC_INCLUDE_DIR "$GCC_INCLUDE_DIR" _ACEOF else GCC_INCLUDE_DIR=/usr/include cat >>confdefs.h <<_ACEOF #define GCC_INCLUDE_DIR "$GCC_INCLUDE_DIR" _ACEOF fi cat >>confdefs.h <<_ACEOF #define GCC_INCLUDE_DIR2 "$myprefix/include" _ACEOF # These used to be in local_constants.h cat >>confdefs.h <<_ACEOF #define SYSTEM_LIBDIR "$myprefix/include" _ACEOF cat >>confdefs.h <<_ACEOF #define DEFAULT_LARCHPATH ".$PATH_SEPARATOR$myprefix/share/splint/lib$PATH_SEPARATOR`pwd`/lib$PATH_SEPARATOR" _ACEOF cat >>confdefs.h <<_ACEOF #define DEFAULT_LCLIMPORTDIR ".$PATH_SEPARATOR$myprefix/share/splint/imports$PATH_SEPARATOR`pwd`/imports" _ACEOF # These used to be in herald.h LCL_PARSE_VERSION="Splint 3.1.1" cat >>confdefs.h <<_ACEOF #define SPLINT_VERSION "$LCL_PARSE_VERSION --- `date +"%d %b %Y"`" _ACEOF cat >>confdefs.h <<_ACEOF #define LCL_PARSE_VERSION "$LCL_PARSE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define LCL_COMPILE "Compiled using $CC $CFLAGS on `uname -a` by `whoami`" _ACEOF cat >>confdefs.h <<\_ACEOF #define UNIX 1 _ACEOF #just define some Header constants for now... UNAME=`uname` cat >>confdefs.h <<_ACEOF #define UNAME "${UNAME}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD "${build}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST "${host}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET "${target}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_ALIAS "${build_alias}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_ALIAS "${host_alias}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_ALIAS "${TARGET_ALIAS}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_CPU "${build_cpu}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_CPU "$host_cpu" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_CPU "${target_cpu}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_VENDOR "${build_vendor}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_VENDOR "${host_vendor}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_VENDOR "${target_vendor}" _ACEOF cat >>confdefs.h <<_ACEOF #define BUILD_OS "${build_os}" _ACEOF cat >>confdefs.h <<_ACEOF #define HOST_OS "${host_os}" _ACEOF cat >>confdefs.h <<_ACEOF #define TARGET_OS "${target_os}" _ACEOF ac_config_files="$ac_config_files Makefile imports/Makefile lib/Makefile doc/Makefile bin/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overriden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, don't put newlines in cache variables' values. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. { (set) 2>&1 | case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n \ "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p" ;; esac; } | sed ' t clear : clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ : end' >>confcache if cmp -s $cache_file confcache; then :; else if test -w $cache_file; then test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file" cat confcache >$cache_file else echo "not updating unwritable cache $cache_file" fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/; s/:*\${srcdir}:*/:/; s/:*@srcdir@:*/:/; s/^\([^=]*=[ ]*\):*/\1/; s/:*$//; s/^[^=]*=[ ]*$//; }' fi DEFS=-DHAVE_CONFIG_H if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be Bourne compatible if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then set -o posix fi # NLS nuisances. # Support unset when possible. if (FOO=FOO; unset FOO) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi (set +x; test -n "`(LANG=C; export LANG) 2>&1`") && { $as_unset LANG || test "${LANG+set}" != set; } || { LANG=C; export LANG; } (set +x; test -n "`(LC_ALL=C; export LC_ALL) 2>&1`") && { $as_unset LC_ALL || test "${LC_ALL+set}" != set; } || { LC_ALL=C; export LC_ALL; } (set +x; test -n "`(LC_TIME=C; export LC_TIME) 2>&1`") && { $as_unset LC_TIME || test "${LC_TIME+set}" != set; } || { LC_TIME=C; export LC_TIME; } (set +x; test -n "`(LC_CTYPE=C; export LC_CTYPE) 2>&1`") && { $as_unset LC_CTYPE || test "${LC_CTYPE+set}" != set; } || { LC_CTYPE=C; export LC_CTYPE; } (set +x; test -n "`(LANGUAGE=C; export LANGUAGE) 2>&1`") && { $as_unset LANGUAGE || test "${LANGUAGE+set}" != set; } || { LANGUAGE=C; export LANGUAGE; } (set +x; test -n "`(LC_COLLATE=C; export LC_COLLATE) 2>&1`") && { $as_unset LC_COLLATE || test "${LC_COLLATE+set}" != set; } || { LC_COLLATE=C; export LC_COLLATE; } (set +x; test -n "`(LC_NUMERIC=C; export LC_NUMERIC) 2>&1`") && { $as_unset LC_NUMERIC || test "${LC_NUMERIC+set}" != set; } || { LC_NUMERIC=C; export LC_NUMERIC; } (set +x; test -n "`(LC_MESSAGES=C; export LC_MESSAGES) 2>&1`") && { $as_unset LC_MESSAGES || test "${LC_MESSAGES+set}" != set; } || { LC_MESSAGES=C; export LC_MESSAGES; } # Name of the executable. as_me=`(basename "$0") 2>/dev/null || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)$' \| \ . : '\(.\)' 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; } /^X\/\(\/\/\)$/{ s//\1/; q; } /^X\/\(\/\).*/{ s//\1/; q; } s/.*/./; q'` # PATH needs CR, and LINENO needs CR and PATH. # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh if (PATH=".;."; conftest.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conftest.sh fi as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" || { # Find who we are. Look in the path if we contain no path at all # relative or not. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5 echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;} { (exit 1); exit 1; }; } fi case $CONFIG_SHELL in '') as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for as_base in sh bash ksh sh5; do case $as_dir in /*) if ("$as_dir/$as_base" -c ' as_lineno_1=$LINENO as_lineno_2=$LINENO as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null` test "x$as_lineno_1" != "x$as_lineno_2" && test "x$as_lineno_3" = "x$as_lineno_2" ') 2>/dev/null; then CONFIG_SHELL=$as_dir/$as_base export CONFIG_SHELL exec "$CONFIG_SHELL" "$0" ${1+"$@"} fi;; esac done done ;; esac # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line before each line; the second 'sed' does the real # work. The second script uses 'N' to pair each line-number line # with the numbered line, and appends trailing '-' during # substitution so that $LINENO is not a special case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # second 'sed' script. Blame Lee E. McMahon for sed's syntax. :-) sed '=' <$as_myself | sed ' N s,$,-, : loop s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3, t loop s,-$,, s,^['$as_cr_digits']*\n,, ' >$as_me.lineno && chmod +x $as_me.lineno || { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5 echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;} { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensible to this). . ./$as_me.lineno # Exit status is that of the last command. exit } case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in *c*,-n*) ECHO_N= ECHO_C=' ' ECHO_T=' ' ;; *c*,* ) ECHO_N=-n ECHO_C= ECHO_T= ;; *) ECHO_N= ECHO_C='\c' ECHO_T= ;; esac if expr a : '\(a\)' >/dev/null 2>&1; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then # We could just check for DJGPP; but this test a) works b) is more generic # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04). if test -f conf$$.exe; then # Don't use ln at all; we don't have any links as_ln_s='cp -p' else as_ln_s='ln -s' fi elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.file as_executable_p="test -f" # Sed expression to map a string onto a valid CPP name. as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g" # Sed expression to map a string onto a valid variable name. as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g" # IFS # We need space, tab and new line, in precisely that order. as_nl=' ' IFS=" $as_nl" # CDPATH. $as_unset CDPATH || test "${CDPATH+set}" != set || { CDPATH=$PATH_SEPARATOR; export CDPATH; } exec 6>&1 # Open the log real soon, to keep \$[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. Logging --version etc. is OK. exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX } >&5 cat >&5 <<_CSEOF This file was extended by Splint $as_me 3.1.1, which was generated by GNU Autoconf 2.53. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ _CSEOF echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5 echo >&5 _ACEOF # Files that config.status was made for. if test -n "$ac_config_files"; then echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS fi if test -n "$ac_config_headers"; then echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS fi if test -n "$ac_config_links"; then echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS fi if test -n "$ac_config_commands"; then echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS fi cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number, then exit -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Splint config.status 3.1.1 configured by $0, generated by GNU Autoconf 2.53, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." srcdir=$srcdir INSTALL="$INSTALL" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "x$1" : 'x\([^=]*\)='` ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'` shift set dummy "$ac_option" "$ac_optarg" ${1+"$@"} shift ;; -*);; *) # This is not an option, so the user has probably given explicit # arguments. ac_need_defaults=false;; esac case $1 in # Handling of the options. _ACEOF cat >>$CONFIG_STATUS <<_ACEOF -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion" exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;; _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF --version | --vers* | -V ) echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header { { echo "$as_me:$LINENO: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; };; --help | --hel | -h ) echo "$ac_cs_usage"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --file | --fil | --fi | --f ) shift CONFIG_FILES="$CONFIG_FILES $1" ac_need_defaults=false;; --header | --heade | --head | --hea ) shift CONFIG_HEADERS="$CONFIG_HEADERS $1" ac_need_defaults=false;; # This is an error. -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ;; esac shift done _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS section. # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_config_target in $ac_config_targets do case "$ac_config_target" in # Handling of arguments. "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;; "imports/Makefile" ) CONFIG_FILES="$CONFIG_FILES imports/Makefile" ;; "lib/Makefile" ) CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "doc/Makefile" ) CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "bin/Makefile" ) CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;; "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.hin" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Create a temporary directory, and hook for its removal unless debugging. $debug || { trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. : ${TMPDIR=/tmp} { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=$TMPDIR/cs$$-$RANDOM (umask 077 && mkdir $tmp) } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 { (exit 1); exit 1; } } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "\$CONFIG_FILES"; then # Protect against being on the right side of a sed subst in config.status. sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g; s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF s,@SHELL@,$SHELL,;t t s,@PATH_SEPARATOR@,$PATH_SEPARATOR,;t t s,@PACKAGE_NAME@,$PACKAGE_NAME,;t t s,@PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t s,@PACKAGE_VERSION@,$PACKAGE_VERSION,;t t s,@PACKAGE_STRING@,$PACKAGE_STRING,;t t s,@PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t s,@exec_prefix@,$exec_prefix,;t t s,@prefix@,$prefix,;t t s,@program_transform_name@,$program_transform_name,;t t s,@bindir@,$bindir,;t t s,@sbindir@,$sbindir,;t t s,@libexecdir@,$libexecdir,;t t s,@datadir@,$datadir,;t t s,@sysconfdir@,$sysconfdir,;t t s,@sharedstatedir@,$sharedstatedir,;t t s,@localstatedir@,$localstatedir,;t t s,@libdir@,$libdir,;t t s,@includedir@,$includedir,;t t s,@oldincludedir@,$oldincludedir,;t t s,@infodir@,$infodir,;t t s,@mandir@,$mandir,;t t s,@build_alias@,$build_alias,;t t s,@host_alias@,$host_alias,;t t s,@target_alias@,$target_alias,;t t s,@DEFS@,$DEFS,;t t s,@ECHO_C@,$ECHO_C,;t t s,@ECHO_N@,$ECHO_N,;t t s,@ECHO_T@,$ECHO_T,;t t s,@LIBS@,$LIBS,;t t s,@build@,$build,;t t s,@build_cpu@,$build_cpu,;t t s,@build_vendor@,$build_vendor,;t t s,@build_os@,$build_os,;t t s,@host@,$host,;t t s,@host_cpu@,$host_cpu,;t t s,@host_vendor@,$host_vendor,;t t s,@host_os@,$host_os,;t t s,@target@,$target,;t t s,@target_cpu@,$target_cpu,;t t s,@target_vendor@,$target_vendor,;t t s,@target_os@,$target_os,;t t s,@INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t s,@INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t s,@INSTALL_DATA@,$INSTALL_DATA,;t t s,@PACKAGE@,$PACKAGE,;t t s,@VERSION@,$VERSION,;t t s,@ACLOCAL@,$ACLOCAL,;t t s,@AUTOCONF@,$AUTOCONF,;t t s,@AUTOMAKE@,$AUTOMAKE,;t t s,@AUTOHEADER@,$AUTOHEADER,;t t s,@MAKEINFO@,$MAKEINFO,;t t s,@AMTAR@,$AMTAR,;t t s,@install_sh@,$install_sh,;t t s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@INSTALL_STRIP_PROGRAM@,$INSTALL_STRIP_PROGRAM,;t t s,@AWK@,$AWK,;t t s,@SET_MAKE@,$SET_MAKE,;t t s,@CC@,$CC,;t t s,@CFLAGS@,$CFLAGS,;t t s,@LDFLAGS@,$LDFLAGS,;t t s,@CPPFLAGS@,$CPPFLAGS,;t t s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@DEPDIR@,$DEPDIR,;t t s,@am__include@,$am__include,;t t s,@am__quote@,$am__quote,;t t s,@AMDEP_TRUE@,$AMDEP_TRUE,;t t s,@AMDEP_FALSE@,$AMDEP_FALSE,;t t s,@AMDEPBACKSLASH@,$AMDEPBACKSLASH,;t t s,@CCDEPMODE@,$CCDEPMODE,;t t s,@CPP@,$CPP,;t t s,@LEX@,$LEX,;t t s,@LEXLIB@,$LEXLIB,;t t s,@LEX_OUTPUT_ROOT@,$LEX_OUTPUT_ROOT,;t t s,@LN_S@,$LN_S,;t t s,@BISON@,$BISON,;t t s,@GREP@,$GREP,;t t s,@DIFF@,$DIFF,;t t s,@CAT@,$CAT,;t t s,@RM@,$RM,;t t s,@MV@,$MV,;t t s,@CP@,$CP,;t t s,@SED@,$SED,;t t s,@LCLOBJ@,$LCLOBJ,;t t CEOF _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Split the substitutions into bite-sized pieces for seds with # small command number limits, like on Digital OSF/1 and HP-UX. ac_max_sed_lines=48 ac_sed_frag=1 # Number of current file. ac_beg=1 # First line for current file. ac_end=$ac_max_sed_lines # Line after last line for current file. ac_more_lines=: ac_sed_cmds= while $ac_more_lines; do if test $ac_beg -gt 1; then sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag else sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag fi if test ! -s $tmp/subs.frag; then ac_more_lines=false else # The purpose of the label and of the branching condition is to # speed up the sed processing (if there are no `@' at all, there # is no need to browse any of the substitutions). # These are the two extra sed commands mentioned above. (echo ':t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed if test -z "$ac_sed_cmds"; then ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed" else ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed" fi ac_sed_frag=`expr $ac_sed_frag + 1` ac_beg=$ac_end ac_end=`expr $ac_end + $ac_max_sed_lines` fi done if test -z "$ac_sed_cmds"; then ac_sed_cmds=cat fi fi # test -n "$CONFIG_FILES" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories. ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" || { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; } ;; esac done; } ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_builddir$INSTALL ;; esac if test x"$ac_file" != x-; then { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then configure_input= else configure_input="$ac_file. " fi configure_input=$configure_input"Generated from `echo $ac_file_in | sed 's,.*/,,'` by configure." # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } _ACEOF cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s,@configure_input@,$configure_input,;t t s,@srcdir@,$ac_srcdir,;t t s,@abs_srcdir@,$ac_abs_srcdir,;t t s,@top_srcdir@,$ac_top_srcdir,;t t s,@abs_top_srcdir@,$ac_abs_top_srcdir,;t t s,@builddir@,$ac_builddir,;t t s,@abs_builddir@,$ac_abs_builddir,;t t s,@top_builddir@,$ac_top_builddir,;t t s,@abs_top_builddir@,$ac_abs_top_builddir,;t t s,@INSTALL@,$ac_INSTALL,;t t " $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out rm -f $tmp/stdin if test x"$ac_file" != x-; then mv $tmp/out $ac_file else cat $tmp/out rm -f $tmp/out fi done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_HEADER section. # # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where # NAME is the cpp macro being defined and VALUE is the value it is being given. # # ac_d sets the value in "#define NAME VALUE" lines. ac_dA='s,^\([ ]*\)#\([ ]*define[ ][ ]*\)' ac_dB='[ ].*$,\1#\2' ac_dC=' ' ac_dD=',;t' # ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE". ac_uA='s,^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' ac_uB='$,\1#\2define\3' ac_uC=' ' ac_uD=',;t' for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". case $ac_file in - | *:- | *:-:* ) # input from stdin cat >$tmp/stdin ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;; * ) ac_file_in=$ac_file.in ;; esac test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the # src tree. ac_file_inputs=`IFS=: for f in $ac_file_in; do case $f in -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; *) # Relative if test -f "$f"; then # Build tree echo $f elif test -f "$srcdir/$f"; then # Source tree echo $srcdir/$f else # /dev/null tree { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; esac done` || { (exit 1); exit 1; } # Remove the trailing spaces. sed 's/[ ]*$//' $ac_file_inputs >$tmp/in _ACEOF # Transform confdefs.h into two sed scripts, `conftest.defines' and # `conftest.undefs', that substitutes the proper values into # config.h.in to produce config.h. The first handles `#define' # templates, and the second `#undef' templates. # And first: Protect against being on the right side of a sed subst in # config.status. Protect against being in an unquoted here document # in config.status. rm -f conftest.defines conftest.undefs # Using a here document instead of a string reduces the quoting nightmare. # Putting comments in sed scripts is not portable. # # `end' is used to avoid that the second main sed command (meant for # 0-ary CPP macros) applies to n-ary macro definitions. # See the Autoconf documentation for `clear'. cat >confdef2sed.sed <<\_ACEOF s/[\\&,]/\\&/g s,[\\$`],\\&,g t clear : clear s,^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*\)\(([^)]*)\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp t end s,^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp : end _ACEOF # If some macros were called several times there might be several times # the same #defines, which is useless. Nevertheless, we may not want to # sort them, since we want the *last* AC-DEFINE to be honored. uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs rm -f confdef2sed.sed # This sed command replaces #undef with comments. This is necessary, for # example, in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. cat >>conftest.undefs <<\_ACEOF s,^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */, _ACEOF # Break up conftest.defines because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS echo ' if egrep "^[ ]*#[ ]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS echo ' # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS echo ' :' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.defines >/dev/null do # Write a limited-size here document to $tmp/defines.sed. echo ' cat >$tmp/defines.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#define' lines. echo '/^[ ]*#[ ]*define/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/defines.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail rm -f conftest.defines mv conftest.tail conftest.defines done rm -f conftest.defines echo ' fi # egrep' >>$CONFIG_STATUS echo >>$CONFIG_STATUS # Break up conftest.undefs because some shells have a limit on the size # of here documents, and old seds have small limits too (100 cmds). echo ' # Handle all the #undef templates' >>$CONFIG_STATUS rm -f conftest.tail while grep . conftest.undefs >/dev/null do # Write a limited-size here document to $tmp/undefs.sed. echo ' cat >$tmp/undefs.sed <>$CONFIG_STATUS # Speed up: don't consider the non `#undef' echo '/^[ ]*#[ ]*undef/!b' >>$CONFIG_STATUS # Work around the forget-to-reset-the-flag bug. echo 't clr' >>$CONFIG_STATUS echo ': clr' >>$CONFIG_STATUS sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS echo 'CEOF sed -f $tmp/undefs.sed $tmp/in >$tmp/out rm -f $tmp/in mv $tmp/out $tmp/in ' >>$CONFIG_STATUS sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail rm -f conftest.undefs mv conftest.tail conftest.undefs done rm -f conftest.undefs cat >>$CONFIG_STATUS <<\_ACEOF # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ if test x"$ac_file" = x-; then echo "/* Generated by configure. */" >$tmp/config.h else echo "/* $ac_file. Generated by configure. */" >$tmp/config.h fi cat $tmp/in >>$tmp/config.h rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then { echo "$as_me:$LINENO: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`(dirname "$ac_file") 2>/dev/null || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { case "$ac_dir" in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy="$ac_dir" for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" || { { echo "$as_me:$LINENO: error: cannot create \"$ac_dir\"" >&5 echo "$as_me: error: cannot create \"$ac_dir\"" >&2;} { (exit 1); exit 1; }; } ;; esac done; } rm -f $ac_file mv $tmp/config.h $ac_file fi else cat $tmp/config.h rm -f $tmp/config.h fi # Run the commands associated with the file. case $ac_file in config.h ) # update the timestamp echo 'timestamp for config.h:config.hin' >"./stamp-h1" ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # # CONFIG_COMMANDS section. # for ac_file in : $CONFIG_COMMANDS; do test "x$ac_file" = x: && continue ac_dest=`echo "$ac_file" | sed 's,:.*,,'` ac_source=`echo "$ac_file" | sed 's,[^:]*:,,'` ac_dir=`(dirname "$ac_dest") 2>/dev/null || $as_expr X"$ac_dest" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_dest" : 'X\(//\)[^/]' \| \ X"$ac_dest" : 'X\(//\)$' \| \ X"$ac_dest" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$ac_dest" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` ac_builddir=. if test "$ac_dir" != .; then ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A "../" for each directory in $ac_dir_suffix. ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'` else ac_dir_suffix= ac_top_builddir= fi case $srcdir in .) # No --srcdir option. We are building in place. ac_srcdir=. if test -z "$ac_top_builddir"; then ac_top_srcdir=. else ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'` fi ;; [\\/]* | ?:[\\/]* ) # Absolute path. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ;; *) # Relative path. ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_builddir$srcdir ;; esac # Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be # absolute. ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd` ac_abs_top_builddir=`cd "$ac_dir" && cd $ac_top_builddir && pwd` ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd` ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd` { echo "$as_me:$LINENO: executing $ac_dest commands" >&5 echo "$as_me: executing $ac_dest commands" >&6;} case $ac_dest in depfiles ) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # So let's grep whole file. if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then dirpart=`(dirname "$mf") 2>/dev/null || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` else continue fi grep '^DEP_FILES *= *[^ #]' < "$mf" > /dev/null || continue # Extract the definition of DEP_FILES from the Makefile without # running `make'. DEPDIR=`sed -n -e '/^DEPDIR = / s///p' < "$mf"` test -z "$DEPDIR" && continue # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n -e '/^U = / s///p' < "$mf"` test -d "$dirpart/$DEPDIR" || mkdir "$dirpart/$DEPDIR" # We invoke sed twice because it is the simplest approach to # changing $(DEPDIR) to its actual value in the expansion. for file in `sed -n -e ' /^DEP_FILES = .*\\\\$/ { s/^DEP_FILES = // :loop s/\\\\$// p n /\\\\$/ b loop p } /^DEP_FILES = / s/^DEP_FILES = //p' < "$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`(dirname "$file") 2>/dev/null || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| \ . : '\(.\)' 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; } /^X\(\/\/\)[^/].*/{ s//\1/; q; } /^X\(\/\/\)$/{ s//\1/; q; } /^X\(\/\).*/{ s//\1/; q; } s/.*/./; q'` { case $dirpart/$fdir in [\\/]* | ?:[\\/]* ) as_incr_dir=;; *) as_incr_dir=.;; esac as_dummy=$dirpart/$fdir for as_mkdir_dir in `IFS='/\\'; set X $as_dummy; shift; echo "$@"`; do case $as_mkdir_dir in # Skip DOS drivespec ?:) as_incr_dir=$as_mkdir_dir ;; *) as_incr_dir=$as_incr_dir/$as_mkdir_dir test -d "$as_incr_dir" || mkdir "$as_incr_dir" || { { echo "$as_me:$LINENO: error: cannot create $dirpart/$fdir" >&5 echo "$as_me: error: cannot create $dirpart/$fdir" >&2;} { (exit 1); exit 1; }; } ;; esac done; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: exec 5>/dev/null $SHELL $CONFIG_STATUS || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi splint-3.1.2.dfsg1/install.html0000755021234200000250000000743507670427270014026 0ustar fax Splint - Source Code Installation

Source Code Installation

Splint should compile effortlessly on standard Unix systems, and with a bit of effort on non-Unix platforms. If you produce a port for a non-Unix platform, please let splint@cs.virginia.edu know.

To build Splint you need:

  • a (hopefully ANSI-conforming) C compiler. GNU gcc is recommended, but most modern C compilers should work.
  • make, the GNU make utility. If you don't have make installed on your system, download it from ftp.gnu.org.
  • standard Unix tools: gzip, tar

Instructions:

  1. Download http://www.splint.org/downloads/splint-3.1.1.tgz. (the latest stable release).

    Copy this package to the directory where you want to build Spint. When the tar file is extracted, it will create a splint-3.1.1 subdirectory.

  2. tar xzf splint-3.1.1.src.tgz (extract files from the archive)

  3. cd splint-3.1.1 (enter the extracted directory)

  4. configure
    This will create a Makefile with settings for your system. Use configure --prefix=directory if you want to install Splint in prefix directory directory.

  5. make
    GNU's make utility is required; it may be named gmake or gnumake on your system. It is best to do this in an emacs shell or a buffered terminal, so you can scroll through the output.

    This builds Splint. While it is building, subscribe to the splint-announce mailing list by visiting http://www.splint.org/lists.html

    If the build was successful, it then runs the test suite. You should see:

    Testing splint 3.1.1...
    
    Version Info:
    Splint 3.1.1 --- 11 Feb 2002
    Maintainer: splint-bug@splint.org
    
    ... (about 100 lines of test output elided)
    
    Checking manual...
    Checking tests2.2...
    Checking tests2.4...
    Checking tests2.5...
    Checking db1...
    Checking db2...
    Checking db3...
    
    Examine the test output. If there are errors, send a bug report to splint-bug@cs.virginia.edu.
    Note: If possible do not built splint in a directory under /usr/. If the test suite is run in a directory under /usr/ for example /usr/src/, it will report errors even if Splint was built correctly.

The remaining steps are only necessary if you want to install the Splint binary and libraries in a different directory (set when you ran configure).

  1. make install
  2. Set environment variables:
    LARCH_PATH - path to search for splint libraries and initializations files. If you are using the standard directories, this should be .:base-directory/splint-3.1.1/lib.

    LCLIMPORTDIR - directory containing lcl imports files. If you are using the standard directories, this is base-directory/splint-3.1.1/imports.

    Put the commands to set these variables (the actual commands will depend on the shell you are using) in one of your initialization dotfiles (usually ~/.environment).

    Set up your PATH to include the directory containing splint-3.1.1/bin/splint, or move the binary to a directory on your command path.

splint-3.1.2.dfsg1/src/0000755021234200000250000000000010645776246012253 5ustar faxsplint-3.1.2.dfsg1/src/Headers/0000755021234200000250000000000010645776246013626 5ustar faxsplint-3.1.2.dfsg1/src/Headers/abstBodyNode.h0000644021234200000250000000063707630463445016354 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ struct s_abstBodyNode { ltoken tok; /* check for NULLTOKEN before using it */ /*@null@*/ lclPredicateNode typeinv; fcnNodeList fcns; /* only for abstBody, not for optExposedBody */ } ; extern /*@unused@*/ /*@only@*/ cstring abstBodyNode_unparse (abstBodyNode p_n); splint-3.1.2.dfsg1/src/Headers/ltokenList.h0000644021234200000250000000542607630463447016132 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LTOKENLIST_H # define LTOKENLIST_H abst_typedef /*@null@*/ struct { int nelements; int nspace; int current; /*@reldef@*/ /*@relnull@*/ o_ltoken *elements; } *ltokenList ; /*@iter ltokenList_elements (sef ltokenList x, yield exposed ltoken el); @*/ # define ltokenList_elements(x, m_el) \ { if (ltokenList_isDefined(x)) { \ int m_ind; ltoken *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { ltoken m_el; m_el = *m_elements; m_elements++; # define end_ltokenList_elements }}} /* ** ltokenList_elements is split up to avoid compiler bugs ** and incompatibilities in older C compilers. This has caused problems ** on both RS/AIX and SGI IRIX machines. */ /*@constant null ltokenList ltokenList_undefined;@*/ # define ltokenList_undefined NULL extern /*@falsewhennull@*/ bool ltokenList_isDefined (ltokenList p_s) /*@*/ ; # define ltokenList_isDefined(s) ((s) != ltokenList_undefined) extern /*@nullwhentrue@*/ bool ltokenList_isUndefined (ltokenList p_s) /*@*/ ; # define ltokenList_isUndefined(s) ((s) == ltokenList_undefined) extern int ltokenList_size (/*@sef@*/ ltokenList p_s) /*@*/ ; extern bool ltokenList_empty (/*@sef@*/ ltokenList p_s) /*@*/ ; extern /*@unused@*/ bool ltokenList_isEmpty (/*@sef@*/ ltokenList p_s) /*@*/ ; # define ltokenList_size(s) (ltokenList_isUndefined(s) ? 0 : (s)->nelements) # define ltokenList_empty(s) (ltokenList_isUndefined(s) || ltokenList_size(s) == 0) # define ltokenList_isEmpty(s) (ltokenList_empty(s)) extern /*@only@*/ /*@notnull@*/ ltokenList ltokenList_new (void) /*@*/ ; extern void ltokenList_addh (ltokenList p_s, /*@only@*/ ltoken p_el) /*@modifies p_s@*/ ; extern void ltokenList_reset (ltokenList p_s) /*@modifies p_s@*/ ; extern void ltokenList_advance (ltokenList p_s) /*@modifies p_s@*/ ; extern /*@only@*/ cstring ltokenList_unparse (ltokenList p_s) /*@*/ ; extern void ltokenList_free (/*@only@*/ ltokenList p_s) ; extern /*@observer@*/ ltoken ltokenList_head (ltokenList p_s) /*@*/ ; extern /*@observer@*/ ltoken ltokenList_current (ltokenList p_s) /*@*/ ; extern /*@only@*/ ltokenList ltokenList_copy (ltokenList p_s) /*@*/ ; extern /*@only@*/ /*@notnull@*/ ltokenList ltokenList_singleton (/*@only@*/ ltoken p_l); extern ltokenList ltokenList_push (/*@returned@*/ ltokenList p_s, /*@only@*/ ltoken p_el); extern bool ltokenList_equal (ltokenList p_s1, ltokenList p_s2) /*@*/ ; extern bool ltokenList_isFinished (ltokenList p_s) /*@*/ ; extern void ltokenList_removeCurrent (ltokenList p_s) /*@modifies p_s@*/ ; /*@constant int ltokenListBASESIZE;@*/ # define ltokenListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/abstract.h0000644021234200000250000004267407630463445015611 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef ABSTRACT_H # define ABSTRACT_H /* ** These two are needed in symtable.c */ /*@constant int HT_MAXINDEX; @*/ # define HT_MAXINDEX 255 /* simply use the lower-order bits by masking out the higher order bits */ # include "ltoken.h" # include "ltokenList.h" typedef enum { TAG_ENUM, TAG_STRUCT, TAG_UNION, TAG_FWDSTRUCT, TAG_FWDUNION } tagKind; # include "importNode.h" # include "importNodeList.h" extern void checkBrackets (ltoken p_lb, ltoken p_rb); # include "sortList.h" # include "lsymbolList.h" # include "lsymbolSet.h" # include "sortSet.h" /* ** added pointer indirects to all typedefs, except as noted ** evs 94-01-05 */ # include "pairNode.h" # include "pairNodeList.h" # include "declaratorNode.h" # include "declaratorNodeList.h" # include "declaratorInvNode.h" # include "declaratorInvNodeList.h" # include "typeExpr.h" /* also defines abstDeclaratorNode */ # include "arrayQualNode.h" # include "varNode.h" # include "varNodeList.h" # include "quantifierNode.h" # include "quantifierNodeList.h" # include "storeRefNode.h" # include "storeRefNodeList.h" # include "modifyNode.h" # include "letDeclNode.h" # include "letDeclNodeList.h" # include "programNode.h" # include "programNodeList.h" # include "lclPredicateNode.h" # include "exposedNode.h" typedef enum { TK_ABSTRACT, TK_EXPOSED, TK_UNION } typeKind ; # include "CTypesNode.h" # include "initDeclNode.h" # include "initDeclNodeList.h" # include "constDeclarationNode.h" typedef enum { QLF_NONE, QLF_CONST, QLF_VOLATILE } qualifierKind; # include "varDeclarationNode.h" # include "varDeclarationNodeList.h" # include "globalList.h" # include "claimNode.h" # include "fcnNode.h" # include "fcnNodeList.h" # include "iterNode.h" # include "abstBodyNode.h" # include "abstractNode.h" # include "stDeclNode.h" # include "stDeclNodeList.h" # include "taggedUnionNode.h" # include "typeNode.h" # include "strOrUnionNode.h" # include "enumSpecNode.h" # include "lclTypeSpecNode.h" # include "typeNamePack.h" # include "typeNameNode.h" # include "typeNameNodeList.h" /* this is a list of typeNameNode's */ # include "opFormNode.h" # include "quantifiedTermNode.h" typedef enum { TRM_LITERAL, TRM_CONST, TRM_VAR, TRM_ZEROARY, TRM_APPLICATION, TRM_QUANTIFIER, TRM_UNCHANGEDALL, TRM_UNCHANGEDOTHERS, TRM_SIZEOF } termKIND; # include "sigNode.h" # include "sigNodeSet.h" # include "signNode.h" # include "nameNode.h" # include "lslOp.h" # include "lslOpSet.h" # include "replaceNode.h" # include "replaceNodeList.h" # include "renamingNode.h" # include "traitRefNode.h" # include "traitRefNodeList.h" # include "exportNode.h" # include "privateNode.h" # include "interfaceNode.h" # include "interfaceNodeList.h" /* note: interfaceList --> interfaceNodeList */ # include "termNode.h" # include "termNodeList.h" # include "stmtNode.h" /* The following are for parsing LSL signatures */ # include "sortSetList.h" # include "lslOpList.h" /* function prototypes for parsing LSL signatures */ extern /*@only@*/ lslOp makelslOpNode (/*@only@*/ /*@null@*/ nameNode p_name, /*@dependent@*/ sigNode p_s); extern /*@only@*/ cstring lslOp_unparse (lslOp p_x); /*@notfunction@*/ # define MASH(x,y) \ (/*@+enumint@*/ (((unsigned) ((x)+1) << 1) + (y)) & HT_MAXINDEX /*@=enumint@*/) extern void abstract_init (void); extern void resetImports (cstring p_current) ; extern interfaceNodeList consInterfaceNode (/*@only@*/ interfaceNode p_n, /*@returned@*/ interfaceNodeList p_ns); /* evs 8 Sept 1993 changed to importNodeList */ extern /*@only@*/ interfaceNode makeInterfaceNodeImports (/*@only@*/ importNodeList p_x); extern /*@only@*/ nameNode makeNameNodeForm (/*@only@*/ /*@null@*/ opFormNode p_opform) /*@*/ ; extern /*@only@*/ nameNode makeNameNodeId (/*@only@*/ ltoken p_opid) /*@*/ ; extern /*@only@*/ interfaceNode makeInterfaceNodeUses (/*@only@*/ traitRefNodeList p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makeConst (/*@only@*/ constDeclarationNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makeVar (/*@only@*/ varDeclarationNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makeType (/*@only@*/ typeNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makeFcn (/*@only@*/ fcnNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makeClaim (/*@only@*/ claimNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makeIter (/*@only@*/ iterNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makePrivConst(/*@only@*/ constDeclarationNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makePrivVar(/*@only@*/ varDeclarationNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makePrivType(/*@only@*/ typeNode p_x) /*@*/ ; extern /*@only@*/ interfaceNode interfaceNode_makePrivFcn(/*@only@*/ fcnNode p_x) /*@*/ ; extern /*@only@*/ typeNode makeAbstractTypeNode (/*@only@*/ abstractNode p_x) /*@*/ ; extern /*@only@*/ typeNode makeExposedTypeNode (/*@only@*/ exposedNode p_x) /*@*/ ; extern /*@only@*/ traitRefNode makeTraitRefNode(/*@only@*/ ltokenList p_fl, /*@null@*/ /*@only@*/ renamingNode p_r) /*@*/ ; extern /*@only@*/ cstring printLeaves2 (ltokenList p_f) /*@*/ ; extern /*@only@*/ cstring printRawLeaves2 (ltokenList p_f) /*@*/ ; extern /*@only@*/ cstring sigNode_unparseText (/*@null@*/ sigNode p_n) /*@*/ ; extern /*@only@*/ renamingNode makeRenamingNode (/*@only@*/ typeNameNodeList p_n, /*@only@*/ replaceNodeList p_r) /*@*/ ; extern /*@only@*/ replaceNode makeReplaceNode (/*@only@*/ ltoken p_t, /*@only@*/ typeNameNode p_tn, bool p_is_ctype, /*@only@*/ ltoken p_ct, /*@null@*/ /*@only@*/ nameNode p_nn, /*@null@*/ /*@only@*/ sigNode p_sn) /*@*/ ; extern /*@only@*/ sigNode makesigNode (/*@only@*/ ltoken p_t, /*@only@*/ ltokenList p_domain, /*@only@*/ ltoken p_range) /*@*/ ; extern /*@only@*/ replaceNode makeReplaceNameNode (/*@only@*/ ltoken p_t, /*@only@*/ typeNameNode p_tn, /*@only@*/ nameNode p_nn) /*@*/ ; extern /*@only@*/ opFormNode makeOpFormNode(/*@only@*/ ltoken p_t, opFormKind p_k, opFormUnion p_u, /*@only@*/ ltoken p_close) /*@*/ ; extern /*@only@*/ typeNameNode makeTypeNameNode (bool p_isObj, /*@only@*/ lclTypeSpecNode p_t, /*@only@*/ abstDeclaratorNode p_n) /*@*/ ; extern /*@only@*/ typeNameNode makeTypeNameNodeOp (/*@only@*/ opFormNode p_n) /*@*/ ; extern /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeConj (/*@only@*/ /*@null@*/ lclTypeSpecNode p_a, /*@only@*/ /*@null@*/ lclTypeSpecNode p_b) /*@*/ ; extern /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeType(/*@only@*/ /*@null@*/ CTypesNode p_x) /*@*/ ; extern /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeSU(/*@only@*/ /*@null@*/ strOrUnionNode p_x) /*@*/ ; extern /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeEnum(/*@only@*/ /*@null@*/ enumSpecNode p_x) /*@*/ ; extern /*@only@*/ lclTypeSpecNode lclTypeSpecNode_addQual (/*@only@*/ lclTypeSpecNode p_n, qual p_q) /*@modifies p_n@*/ ; extern /*@only@*/ enumSpecNode makeEnumSpecNode (/*@only@*/ ltoken p_t, /*@only@*/ ltoken p_optTagId, /*@owned@*/ ltokenList p_enums); extern /*@only@*/ enumSpecNode makeEnumSpecNode2 (/*@only@*/ ltoken p_t, /*@only@*/ ltoken p_tagid); extern /*@only@*/ strOrUnionNode makestrOrUnionNode (/*@only@*/ ltoken p_str, suKind p_k, /*@only@*/ ltoken p_opttagid, /*@only@*/ stDeclNodeList p_x); extern /*@only@*/ strOrUnionNode makeForwardstrOrUnionNode (/*@only@*/ ltoken p_str, suKind p_k, /*@only@*/ ltoken p_tagid); extern /*@only@*/ stDeclNode makestDeclNode (/*@only@*/ lclTypeSpecNode p_s, /*@only@*/ declaratorNodeList p_x); extern /*@only@*/ constDeclarationNode makeConstDeclarationNode (/*@only@*/ lclTypeSpecNode p_t, /*@only@*/ initDeclNodeList p_decls); extern /*@only@*/ varDeclarationNode makeVarDeclarationNode (/*@only@*/ lclTypeSpecNode p_t, /*@only@*/ initDeclNodeList p_x, bool p_isGlobal, bool p_isPrivate); extern varDeclarationNode makeFileSystemNode (void); extern varDeclarationNode makeInternalStateNode (void); extern /*@only@*/ initDeclNode makeInitDeclNode (/*@only@*/ declaratorNode p_d, /*@null@*/ /*@only@*/ termNode p_x); extern /*@only@*/ abstractNode makeAbstractNode (/*@only@*/ ltoken p_t, /*@only@*/ ltoken p_name, bool p_isMutable, bool p_isRefCounted, /*@only@*/ abstBodyNode p_a); extern /*@unused@*/ /*@only@*/ cstring abstBodyNode_unparseExposed (abstBodyNode p_n); extern /*@only@*/ exposedNode makeExposedNode (/*@only@*/ ltoken p_t, /*@only@*/ lclTypeSpecNode p_s, /*@only@*/ declaratorInvNodeList p_d); extern /*@only@*/ declaratorInvNode makeDeclaratorInvNode (/*@only@*/ declaratorNode p_d, /*@only@*/ abstBodyNode p_b); extern /*@only@*/ fcnNode fcnNode_fromDeclarator (/*@only@*/ /*@null@*/ lclTypeSpecNode p_t, /*@only@*/ declaratorNode p_d); extern /*@only@*/ fcnNode makeFcnNode (qual p_specQual, /*@only@*/ /*@null@*/ lclTypeSpecNode p_t, /*@only@*/ declaratorNode p_d, /*@only@*/ /*@null@*/ globalList p_g, /*@only@*/ /*@null@*/ varDeclarationNodeList p_privateinits, /*@only@*/ /*@null@*/ letDeclNodeList p_lets, /*@only@*/ /*@null@*/ lclPredicateNode p_checks, /*@only@*/ /*@null@*/ lclPredicateNode p_requires, /*@only@*/ /*@null@*/ modifyNode p_m, /*@only@*/ /*@null@*/ lclPredicateNode p_ensures, /*@only@*/ /*@null@*/ lclPredicateNode p_claims); extern /*@only@*/ iterNode makeIterNode (/*@only@*/ ltoken p_id, /*@only@*/ paramNodeList p_p); extern /*@only@*/ claimNode makeClaimNode (/*@only@*/ ltoken p_id, /*@only@*/ paramNodeList p_p, /*@only@*/ /*@null@*/ globalList p_g, /*@only@*/ /*@null@*/ letDeclNodeList p_lets, /*@only@*/ /*@null@*/ lclPredicateNode p_requires, /*@only@*/ /*@null@*/ programNode p_b, /*@only@*/ /*@null@*/ lclPredicateNode p_ensures); extern /*@only@*/ lclPredicateNode makeIntraClaimNode (/*@only@*/ ltoken p_t, /*@only@*/ lclPredicateNode p_n); extern /*@only@*/ lclPredicateNode makeRequiresNode (/*@only@*/ ltoken p_t, /*@only@*/ lclPredicateNode p_n); extern /*@only@*/ lclPredicateNode makeChecksNode (/*@only@*/ ltoken p_t, /*@only@*/ lclPredicateNode p_n); extern /*@only@*/ lclPredicateNode makeEnsuresNode (/*@only@*/ ltoken p_t, /*@only@*/ lclPredicateNode p_n); extern /*@only@*/ lclPredicateNode makeLclPredicateNode (/*@only@*/ ltoken p_t, /*@only@*/ termNode p_n, lclPredicateKind p_k); extern /*@only@*/ stmtNode makeStmtNode (/*@only@*/ ltoken p_varId, /*@only@*/ ltoken p_fcnId, /*@only@*/ termNodeList p_v); extern /*@only@*/ programNode makeProgramNodeAction (/*@only@*/ programNodeList p_x, actionKind p_k); extern /*@only@*/ programNode makeProgramNode (/*@only@*/ stmtNode p_x); extern /*@only@*/ storeRefNode makeStoreRefNodeTerm (/*@only@*/ termNode p_t); extern /*@only@*/ storeRefNode makeStoreRefNodeType (/*@only@*/ lclTypeSpecNode p_t, bool p_isObj); extern /*@only@*/ modifyNode makeModifyNodeSpecial (/*@only@*/ ltoken p_t, bool p_modifiesNothing); extern storeRefNode makeStoreRefNodeInternal (void); extern storeRefNode makeStoreRefNodeSystem (void); extern /*@only@*/ modifyNode makeModifyNodeRef (/*@only@*/ ltoken p_t, /*@only@*/ storeRefNodeList p_y); extern /*@only@*/ letDeclNode makeLetDeclNode(/*@only@*/ ltoken p_varid, /*@null@*/ /*@only@*/ lclTypeSpecNode p_t, /*@only@*/ termNode p_term); extern /*@only@*/ abstBodyNode makeAbstBodyNode (/*@only@*/ ltoken p_t, /*@only@*/ fcnNodeList p_f); extern /*@only@*/ abstBodyNode makeExposedBodyNode (/*@only@*/ ltoken p_t, /*@only@*/ lclPredicateNode p_inv); extern /*@only@*/ abstBodyNode makeAbstBodyNode2 (/*@only@*/ ltoken p_t, /*@only@*/ ltokenList p_ops); extern paramNode markYieldParamNode (/*@returned@*/ paramNode p_p); extern /*@only@*/ arrayQualNode makeArrayQualNode (/*@only@*/ ltoken p_t, /*@null@*/ /*@only@*/ termNode p_term); extern /*@only@*/ quantifierNode makeQuantifierNode (/*@only@*/ varNodeList p_v, /*@only@*/ ltoken p_quant); extern /*@only@*/ varNode makeVarNode (/*@only@*/ ltoken p_varid, bool p_isObj, /*@only@*/ lclTypeSpecNode p_t); extern /*@only@*/ typeExpr makeTypeExpr (/*@only@*/ ltoken p_t); extern /*@only@*/ declaratorNode makeDeclaratorNode (/*@only@*/ typeExpr p_t); extern /*@only@*/ typeExpr makeFunctionNode (/*@null@*/ /*@only@*/ typeExpr p_x, /*@only@*/ paramNodeList p_p); extern /*@only@*/ typeExpr makePointerNode (/*@only@*/ ltoken p_star, /*@null@*/ /*@only@*/ /*@returned@*/ typeExpr p_x); extern /*@only@*/ typeExpr makeArrayNode (/*@only@*/ /*@returned@*/ /*@null@*/ typeExpr p_x, /*@only@*/ arrayQualNode p_a); extern /*@only@*/ paramNode makeParamNode (/*@only@*/ lclTypeSpecNode p_t, /*@only@*/ typeExpr p_d); extern /*@only@*/ termNode makeIfTermNode (/*@only@*/ ltoken p_ift, /*@only@*/ termNode p_ifn, /*@only@*/ ltoken p_thent, /*@only@*/ termNode p_thenn, /*@only@*/ ltoken p_elset, /*@only@*/ termNode p_elsen); extern /*@only@*/ termNode makeQuantifiedTermNode (/*@only@*/ quantifierNodeList p_qn, /*@only@*/ ltoken p_open, /*@only@*/ termNode p_t, /*@only@*/ ltoken p_close); extern /*@only@*/ termNode makeInfixTermNode (/*@only@*/ termNode p_x, /*@only@*/ ltoken p_op, /*@only@*/ termNode p_y); extern /*@only@*/ termNode makePostfixTermNode (/*@returned@*/ /*@only@*/ termNode p_secondary, /*@only@*/ ltokenList p_postfixops); extern /*@only@*/ termNode makePostfixTermNode2 (/*@only@*/ /*@returned@*/ termNode p_secondary, /*@only@*/ ltoken p_postfixop); extern /*@only@*/ termNode makePrefixTermNode (/*@only@*/ ltoken p_op, /*@only@*/ termNode p_arg); extern /*@exposed@*/ termNode CollapseInfixTermNode (/*@returned@*/ termNode p_secondary, termNodeList p_infix); extern /*@only@*/ termNode makeMatchedNode (/*@only@*/ ltoken p_open, /*@only@*/ termNodeList p_args, /*@only@*/ ltoken p_close); extern /*@only@*/ termNode makeSqBracketedNode (/*@only@*/ ltoken p_lbracket, /*@only@*/ termNodeList p_args, /*@only@*/ ltoken p_rbracket); extern /*@only@*/ termNode updateSqBracketedNode (/*@null@*/ /*@only@*/ termNode p_left, /*@only@*/ /*@returned@*/ termNode p_t, /*@null@*/ /*@only@*/ termNode p_right); extern termNode updateMatchedNode (/*@null@*/ /*@only@*/ termNode p_left, /*@returned@*/ termNode p_t, /*@null@*/ /*@only@*/ termNode p_right); extern /*@only@*/ termNode makeSimpleTermNode (/*@only@*/ ltoken p_varid); extern /*@only@*/ termNode makeSelectTermNode (/*@only@*/ termNode p_pri, /*@only@*/ ltoken p_select, /*@dependent@*/ ltoken p_id); extern /*@only@*/ termNode makeMapTermNode (/*@only@*/ termNode p_pri, /*@only@*/ ltoken p_map, /*@dependent@*/ ltoken p_id); extern /*@only@*/ termNode makeLiteralTermNode (/*@only@*/ ltoken p_tok, sort p_s); extern /*@only@*/ termNode makeUnchangedTermNode1 (/*@only@*/ ltoken p_op, /*@only@*/ ltoken p_all); extern /*@only@*/ termNode makeUnchangedTermNode2 (/*@only@*/ ltoken p_op, /*@only@*/ storeRefNodeList p_x); extern /*@only@*/ termNode makeSizeofTermNode(/*@only@*/ ltoken p_op, /*@only@*/ lclTypeSpecNode p_type); extern /*@only@*/ termNode makeOpCallTermNode (/*@only@*/ ltoken p_op, /*@only@*/ ltoken p_open, /*@only@*/ termNodeList p_args, /*@only@*/ ltoken p_close); extern sort sigNode_rangeSort (sigNode p_sig); extern /*@only@*/ sortList sigNode_domain (sigNode p_sig); extern bool sameNameNode (/*@null@*/ nameNode p_n1, /*@null@*/ nameNode p_n2); extern /*@only@*/ CTypesNode makeCTypesNode (/*@null@*/ /*@only@*/ CTypesNode p_ctypes, /*@only@*/ ltoken p_ct); extern /*@only@*/ CTypesNode makeTypeSpecifier (/*@only@*/ ltoken p_typedefname) ; extern bool sigNode_equal (sigNode p_n1, sigNode p_n2); extern sort lclTypeSpecNode2sort(lclTypeSpecNode p_type); extern sort typeExpr2ptrSort(sort p_base, /*@null@*/ typeExpr p_t); /* should be tagKind, instead of int */ extern lsymbol checkAndEnterTag(tagKind p_k, /*@only@*/ ltoken p_opttagid); extern void enteringFcnScope(lclTypeSpecNode p_t, declaratorNode p_d, globalList p_g); extern void enteringClaimScope (paramNodeList p_params, globalList p_g); extern /*@observer@*/ ltoken nameNode_errorToken (/*@null@*/ nameNode p_nn); extern /*@observer@*/ ltoken termNode_errorToken (/*@null@*/ termNode p_n); extern /*@observer@*/ ltoken lclTypeSpecNode_errorToken (/*@null@*/ lclTypeSpecNode p_t); extern opFormUnion opFormUnion_createAnyOp (ltoken p_t); extern opFormUnion opFormUnion_createMiddle (int p_middle); extern void LCLBuiltins (void); extern /*@only@*/ paramNode paramNode_elipsis (void); extern termNodeList pushInfixOpPartNode (/*@returned@*/ termNodeList p_x, /*@only@*/ ltoken p_op, /*@only@*/ termNode p_secondary); extern /*@only@*/ cstring declaratorNode_unparseCode (declaratorNode p_x); extern /*@only@*/ cstring typeExpr_name (/*@null@*/ typeExpr p_x); extern void setExposedType (lclTypeSpecNode p_s); extern void declareForwardType (declaratorNode p_declare); extern /*@only@*/ declaratorNode declaratorNode_copy (declaratorNode p_x); extern bool lslOp_equal (lslOp p_x, lslOp p_y); extern void lsymbol_setbool (lsymbol p_s) /*@modifies internalState@*/ ; extern lsymbol lsymbol_getbool (void); extern lsymbol lsymbol_getBool (void); extern lsymbol lsymbol_getTRUE (void); extern lsymbol lsymbol_getFALSE (void); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/macrocache.h0000644021234200000250000000221007630463447016053 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** macrocache.h */ # ifndef MACROCACHE_H # define MACROCACHE_H typedef struct { fileloc fl; cstring def; bool defined; bool scomment; } *mce; typedef /*@only@*/ mce o_mce; typedef struct { int nspace; int entries; /*@reldef@*/ /*@only@*/ o_mce *contents; } *macrocache; extern void macrocache_processUndefinedElements (macrocache p_m) ; /* modifies externalState */ extern /*@observer@*/ fileloc macrocache_processFileElements (macrocache p_m, cstring p_base) ; extern /*@only@*/ /*@unused@*/ cstring macrocache_unparse (macrocache p_m) /*@*/ ; extern /*@only@*/ macrocache macrocache_create (void) /*@*/ ; extern void macrocache_addEntry (macrocache p_s, /*@only@*/ fileloc p_fl, /*@only@*/ cstring p_def); extern void macrocache_addComment (macrocache p_s, /*@only@*/ fileloc p_fl, /*@only@*/ cstring p_def); extern void macrocache_free (/*@only@*/ macrocache p_s); extern void macrocache_finalize (void) /*@modifies internalState@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/abstractNode.h0000644021234200000250000000060507630463445016403 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; bool isMutable; /* TRUE means it is mutable */ bool isRefCounted; ltoken name; sort sort; abstBodyNode body; } *abstractNode; extern /*@unused@*/ /*@only@*/ cstring abstractNode_unparse(abstractNode p_n); splint-3.1.2.dfsg1/src/Headers/mapping.h0000644021234200000250000000135707630463447015434 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mapping.h */ # ifndef MAPPING_H # define MAPPING_H typedef struct s_mappair { lsymbol domain, range; /*@null@*/ struct s_mappair *next; } mappair; typedef /*@relnull@*/ /*@only@*/ mappair *o_mappair; typedef /*@abstract@*/ struct { unsigned int count; /*@relnull@*/ /*@only@*/ o_mappair *buckets; } *mapping; extern /*@only@*/ mapping mapping_create (void); extern lsymbol mapping_find (mapping p_t, lsymbol p_domain); extern void mapping_bind (mapping p_t, lsymbol p_domain, lsymbol p_range); extern void mapping_free (/*@only@*/ mapping p_m); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/message.h0000644021234200000250000000074607630463447015426 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef MESSAGE_H # define MESSAGE_H # if USEVARARGS /*@-usevarargs@*/ /* suppress error about varargs.h */ # include /*@=usevarargs@*/ extern cstring message (); # else # include /*@messagelike@*/ extern /*@only@*/ cstring message(/*@temp@*/ char *p_fmt, ...) /*@*/ ; # endif # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/aliasStack.h0000644021234200000250000000260207630463445016050 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** aliasStack.h */ # ifndef aliasStack_H # define aliasStack_H typedef struct _aliasStack *aliasStack ; typedef struct _aliasStack { aliasTable elements; aliasStack thisbranch; aliasStack lastbranch; aliasStack parent; int lexlevel; } _aliasStack ; extern aliasStack aliasStack_new(void); extern void aliasStack_newAlias (aliasStack s, sRef el, sRef al); extern void aliasStack_clearAlias (aliasStack s, sRef el); extern sRefSet aliasStack_canAlias (aliasStack s, sRef sr); extern void aliasStack_push (aliasStack s, sRef el) ; extern aliasStack aliasStack_pop (aliasStack s) ; extern sRef aliasStack_top (aliasStack s) ; extern cstring aliasStack_unparse (aliasStack s) ; extern void aliasStack_free (/*@only@*/ aliasStack s) ; extern sRefSet aliasStack_aliasedBy (aliasStack s, sRef sr); extern aliasStack aliasStack_branch (aliasStack s); extern aliasStack aliasStack_trueBranch (aliasStack s); extern aliasStack aliasStack_altBranch (aliasStack s); extern aliasStack aliasStack_popBranches (aliasStack alt); extern aliasStack aliasStack_popTrueBranch (aliasStack s); extern void aliasStack_checkGlobs (aliasStack s); # define aliasStackBASESIZE MIDBASESIZE # define aliasStackNULL ((aliasStack)0) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/messageLog.h0000644021234200000250000000223107630463447016057 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** messageLog.h (from slist_templace.h) */ # ifndef messageLog_H # define messageLog_H typedef struct { fileloc loc; cstring msg; } *msgentry ; typedef /*@only@*/ msgentry o_msgentry; abst_typedef /*@null@*/ struct { int nelements; int nspace; /*@reldef@*/ /*@only@*/ o_msgentry *elements; } *messageLog ; /*@constant null messageLog messageLog_undefined; @*/ # define messageLog_undefined ((messageLog)0) extern /*@unused@*/ /*@falsewhennull@*/ bool messageLog_isDefined (messageLog p_s) /*@*/ ; # define messageLog_isDefined(c) ((c) != messageLog_undefined) extern /*@only@*/ messageLog messageLog_new (void) /*@*/ ; extern bool messageLog_add (messageLog p_s, fileloc p_fl, cstring p_mess) /*@modifies p_s@*/ ; extern /*@only@*/ /*@unused@*/ cstring messageLog_unparse (messageLog p_s) /*@*/ ; extern void messageLog_free (/*@only@*/ messageLog p_s) ; /*@constant int messageLogBASESIZE; @*/ # define messageLogBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/aliasTable.h0000644021234200000250000000567407630463445016046 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** aliasTable.h */ # ifndef aliasTable_H # define aliasTable_H typedef /*@only@*/ sRefSet o_sRefSet; typedef /*@exposed@*/ sRef e_sRef; struct s_aliasTable { int nelements; int nspace; /*@reldef@*/ /*@only@*/ e_sRef *keys; /*@reldef@*/ /*@only@*/ o_sRefSet *values; } ; extern /*@unused@*/ /*@nullwhentrue@*/ bool aliasTable_isUndefined (aliasTable p_s); extern /*@unused@*/ /*@nullwhentrue@*/ bool aliasTable_isEmpty (/*@sef@*/ aliasTable p_s); extern /*@falsewhennull@*/ bool aliasTable_isDefined (aliasTable p_s); /*@constant null aliasTable aliasTable_undefined; @*/ # define aliasTable_undefined ((aliasTable) NULL) # define aliasTable_isDefined(s) ((s) != aliasTable_undefined) # define aliasTable_isUndefined(s) ((s) == aliasTable_undefined) # define aliasTable_isEmpty(s) (aliasTable_size(s) == 0) extern int aliasTable_size (/*@sef@*/ aliasTable p_s); # define aliasTable_size(s) (aliasTable_isDefined (s) ? (s)->nelements : 0) /*@iter aliasTable_elements (sef aliasTable t, yield exposed sRef key, yield exposed sRefSet values); @*/ # define aliasTable_elements(t, m_key, m_value) \ { if (aliasTable_isDefined (t)) \ { int m_ind; sRef *m_keys = &((t)->keys[0]); \ sRefSet *m_values = &((t)->values[0]); \ for (m_ind = 0 ; m_ind < (t)->nelements; m_ind++) \ { sRef m_key = *(m_keys++); sRefSet m_value = *(m_values++); # define end_aliasTable_elements }}} extern aliasTable aliasTable_new (void) /*@*/ ; extern void aliasTable_clearAliases (aliasTable p_s, sRef p_sr) /*@modifies p_s, p_sr@*/ ; extern /*@only@*/ sRefSet aliasTable_canAlias (aliasTable p_s, sRef p_sr) /*@*/ ; extern aliasTable aliasTable_copy (aliasTable p_s) /*@*/ ; extern /*@only@*/ cstring aliasTable_unparse (aliasTable p_s) /*@*/ ; extern void aliasTable_free (/*@only@*/ aliasTable p_s) ; extern aliasTable aliasTable_addMustAlias (/*@returned@*/ aliasTable p_s, /*@exposed@*/ sRef p_sr, /*@exposed@*/ sRef p_al) /*@modifies p_s@*/ ; extern aliasTable aliasTable_levelUnion (/*@returned@*/ aliasTable p_t1, aliasTable p_t2, int p_level) /*@modifies p_t1@*/ ; extern aliasTable aliasTable_levelUnionNew (aliasTable p_t1, aliasTable p_t2, int p_level) /*@modifies nothing*/ ; extern void aliasTable_checkGlobs (aliasTable p_t) /*@modifies g_warningstream@*/ ; extern /*@only@*/ sRefSet aliasTable_aliasedBy (aliasTable p_s, sRef p_sr) /*@*/ ; extern void aliasTable_fixSrefs (aliasTable p_s); extern aliasTable aliasTable_levelUnionSeq (/*@returned@*/ aliasTable p_t1, /*@only@*/ aliasTable p_t2, int p_level); /*@constant int aliasTableBASESIZE; @*/ # define aliasTableBASESIZE MIDBASESIZE /* ** For debugging only */ # ifdef DEBUGSPLINT extern void aliasTable_checkValid (aliasTable) /*@modifies g_errorstream@*/ ; # endif # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/metaStateConstraint.h0000644021234200000250000000170607630463447017773 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** metaStateConstraint.h */ # ifndef METASTATECONSTRAINT_H # define METASTATECONSTRAINT_H struct s_metaStateConstraint { /*@only@*/ metaStateSpecifier lspec; /*@only@*/ metaStateExpression rspec; } ; extern metaStateConstraint metaStateConstraint_create (/*@only@*/ metaStateSpecifier, /*@only@*/ metaStateExpression) ; extern cstring metaStateConstraint_unparse (metaStateConstraint) /*@*/ ; extern /*@only@*/ metaStateConstraint metaStateConstraint_copy (metaStateConstraint) /*@*/ ; extern void metaStateConstraint_free (/*@only@*/ metaStateConstraint) ; extern /*@observer@*/ metaStateSpecifier metaStateConstraint_getSpecifier (metaStateConstraint) /*@*/ ; extern /*@observer@*/ metaStateExpression metaStateConstraint_getExpression (metaStateConstraint) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/annotationInfo.h0000644021234200000250000000434407630463445016764 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** annotationInfo.h ** ** A record that keeps information on a user-defined annotations including: ** */ # ifndef ANNOTINFO_H # define ANNOTINFO_H struct s_annotationInfo { cstring name; /*@dependent@*/ /*@observer@*/ metaStateInfo state; /* associated metaStateInfo entry */ fileloc loc; int value; mtContextNode context; } ; /* typedef struct _annotationInfo *annotationInfo; */ /*@constant null annotationInfo annotationInfo_undefined; @*/ # define annotationInfo_undefined ((annotationInfo) NULL) extern /*@falsewhennull@*/ bool annotationInfo_isDefined (annotationInfo) /*@*/ ; # define annotationInfo_isDefined(p_info) ((p_info) != annotationInfo_undefined) extern /*@nullwhentrue@*/ bool annotationInfo_isUndefined (annotationInfo) /*@*/ ; # define annotationInfo_isUndefined(p_info) ((p_info) == annotationInfo_undefined) extern bool annotationInfo_equal (annotationInfo, annotationInfo) /*@*/ ; # define annotationInfo_equal(p_info1, p_info2) ((p_info1) == (p_info2)) extern bool annotationInfo_matchesContext (annotationInfo, uentry) /*@*/ ; extern bool annotationInfo_matchesContextRef (annotationInfo, sRef) /*@*/ ; extern /*@observer@*/ metaStateInfo annotationInfo_getState (annotationInfo) /*@*/ ; extern int annotationInfo_getValue (annotationInfo) /*@*/ ; extern /*@observer@*/ cstring annotationInfo_getName (annotationInfo) /*@*/ ; extern /*@only@*/ annotationInfo annotationInfo_create (/*@only@*/ cstring p_name, /*@dependent@*/ /*@exposed@*/ metaStateInfo p_state, /*@only@*/ mtContextNode p_context, int p_value, /*@only@*/ fileloc p_loc) /*@*/ ; extern /*@observer@*/ cstring annotationInfo_unparse (annotationInfo p_a); extern /*@observer@*/ fileloc annotationInfo_getLoc (annotationInfo p_a) /*@*/ ; extern void annotationInfo_free (/*@only@*/ annotationInfo) ; extern /*@observer@*/ cstring annotationInfo_dump (annotationInfo) ; extern /*@observer@*/ annotationInfo annotationInfo_undump (char **p_s) /*@modifies *p_s@*/ ; extern void annotationInfo_showContextRefError (annotationInfo, sRef) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/metaStateConstraintList.h0000644021234200000250000000511507415477017020624 0ustar fax/* ** metaStateConstraintList.h (from slist_templace.h) */ # ifndef metaStateConstraintLIST_H # define metaStateConstraintLIST_H typedef /*@observer@*/ metaStateConstraint b_metaStateConstraint; struct s_metaStateConstraintList { int nelements; int free; /*@reldef@*/ /*@relnull@*/ b_metaStateConstraint *elements; } ; extern /*@unused@*/ /*@nullwhentrue@*/ bool metaStateConstraintList_isUndefined (metaStateConstraintList p_f) /*@*/ ; extern /*@falsewhennull@*/ bool metaStateConstraintList_isDefined (metaStateConstraintList p_f) /*@*/ ; /*@constant null metaStateConstraintList metaStateConstraintList_undefined; @*/ # define metaStateConstraintList_undefined (NULL) # define metaStateConstraintList_isDefined(f) ((f) != metaStateConstraintList_undefined) # define metaStateConstraintList_isUndefined(f) ((f) == metaStateConstraintList_undefined) /*@iter metaStateConstraintList_elements (sef metaStateConstraintList x, yield exposed metaStateConstraint el); @*/ # define metaStateConstraintList_elements(x, m_el) \ { if (metaStateConstraintList_isDefined (x)) { \ int m_ind; metaStateConstraint *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { metaStateConstraint m_el = *(m_elements++); # define end_metaStateConstraintList_elements }}} extern int metaStateConstraintList_size (/*@sef@*/ metaStateConstraintList p_s) /*@*/ ; # define metaStateConstraintList_size(s) (metaStateConstraintList_isDefined (s) ? (s)->nelements : 0) extern bool metaStateConstraintList_isEmpty (/*@sef@*/ metaStateConstraintList p_s); # define metaStateConstraintList_isEmpty(s) (metaStateConstraintList_size(s) == 0) extern metaStateConstraintList metaStateConstraintList_append (/*@returned@*/ metaStateConstraintList p_s, /*@only@*/ metaStateConstraintList p_t); extern /*@observer@*/ metaStateConstraint metaStateConstraintList_getFirst (metaStateConstraintList p_s) /*@*/ ; extern /*@only@*/ metaStateConstraintList metaStateConstraintList_new (void) /*@*/ ; extern metaStateConstraintList metaStateConstraintList_add (/*@returned@*/ metaStateConstraintList p_s, /*@observer@*/ metaStateConstraint p_el) /*@modifies p_s@*/ ; extern metaStateConstraintList metaStateConstraintList_single (/*@observer@*/ metaStateConstraint p_el) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstring metaStateConstraintList_unparse (metaStateConstraintList p_s) ; extern void metaStateConstraintList_free (/*@only@*/ metaStateConstraintList p_s) ; /*@constant int metaStateConstraintListBASESIZE;@*/ # define metaStateConstraintListBASESIZE MIDBASESIZE # endif splint-3.1.2.dfsg1/src/Headers/annotationTable.h0000644021234200000250000000531607630463445017120 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** annotationTable.h ** ** A global table that keeps information on the user-defined annotations. ** ** For each annotation, we need: ** ** o [key] A name (matches @name@ in code) ** o State - index into metaStateTable that identifies the state associated with this annotation ** o Value ** o Context information (where can annotation be used) */ # ifndef ANNOTTABLE_H # define ANNOTTABLE_H /*@constant null annotationTable annotationTable_undefined; @*/ # define annotationTable_undefined genericTable_undefined extern /*@falsewhennull@*/ bool annotationTable_isDefined(annotationTable) /*@*/ ; # define annotationTable_isDefined(p_h) (genericTable_isDefined ((genericTable) (p_h))) extern /*@nullwhentrue@*/ bool annotationTable_isUndefined(annotationTable) /*@*/ ; # define annotationTable_isUndefined(p_h) (genericTable_isDefined ((genericTable) (p_h))) /*@constant int DEFAULT_ANNOTTABLE_SIZE@*/ # define DEFAULT_ANNOTTABLE_SIZE 32 extern /*@only@*/ annotationTable annotationTable_create (void) /*@*/ ; # define annotationTable_create() ((annotationTable) genericTable_create (DEFAULT_ANNOTTABLE_SIZE)) extern void annotationTable_insert (annotationTable p_h, /*@only@*/ annotationInfo p_annotation); extern /*@null@*/ /*@dependent@*/ /*@exposed@*/ annotationInfo annotationTable_lookup (annotationTable p_h, cstring p_key) /*@*/ ; /*@access annotationInfo@*/ # define annotationTable_lookup(p_h,p_key) \ ((annotationInfo) genericTable_lookup ((genericTable) (p_h), p_key)) /*@noaccess annotationInfo@*/ extern bool annotationTable_contains (annotationTable p_h, cstring p_key) /*@*/ ; # define annotationTable_contains(p_h,p_key) \ (genericTable_contains ((genericTable) (p_h), p_key)) extern /*@unused@*/ /*@only@*/ cstring annotationTable_stats(annotationTable p_h); # define annotationTable_stats(p_h) genericTable_stats ((genericTable) (p_h)) extern /*@only@*/ cstring annotationTable_unparse (annotationTable p_h); extern void annotationTable_free (/*@only@*/ annotationTable p_h); # define annotationTable_free(p_h) (genericTable_free ((genericTable) (p_h))) /*@iter annotationTable_elements (sef annotationTable p_g, yield exposed cstring m_key, yield exposed annotationInfo m_el) @*/ # define annotationTable_elements(p_g,m_key,m_el) \ genericTable_elements((genericTable) (p_g), m_key, m_el) # define end_annotationTable_elements end_genericTable_elements extern int annotationTable_size (annotationTable p_h); # define annotationTable_size(p_h) (genericTable_size(p_h)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/metaStateExpression.h0000644021234200000250000000306607630463447020007 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** metaStateExpression.h */ # ifndef METASTATEEXPRESSION_H # define METASTATEEXPRESSION_H struct s_metaStateExpression { metaStateSpecifier spec; /*@null@*/ metaStateExpression rest; } ; /*@constant null metaStateExpression metaStateExpression_undefined; @*/ # define metaStateExpression_undefined ((metaStateExpression) NULL) extern /*@falsewhennull@*/ bool metaStateExpression_isDefined (metaStateExpression) /*@*/ ; # define metaStateExpression_isDefined(p_info) ((p_info) != NULL) extern /*@nullwhentrue@*/ bool metaStateExpression_isUndefined (metaStateExpression) /*@*/ ; # define metaStateExpression_isUndefined(p_info) ((p_info) == NULL) extern /*@notnull@*/ metaStateExpression metaStateExpression_create (/*@only@*/ metaStateSpecifier) ; extern /*@notnull@*/ metaStateExpression metaStateExpression_createMerge (/*@only@*/ metaStateSpecifier, /*@only@*/ metaStateExpression) ; extern /*@observer@*/ metaStateSpecifier metaStateExpression_getSpecifier (metaStateExpression) /*@*/ ; extern bool metaStateExpression_isMerge (metaStateExpression) /*@*/ ; extern /*@observer@*/ metaStateExpression metaStateExpression_getRest (metaStateExpression) /*@*/ ; extern metaStateExpression metaStateExpression_copy (metaStateExpression) ; extern cstring metaStateExpression_unparse (metaStateExpression) /*@*/ ; extern void metaStateExpression_free (/*@only@*/ metaStateExpression) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/arrayQualNode.h0000644021234200000250000000033207630463445016536 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; /*@null@*/ termNode term; } *arrayQualNode; splint-3.1.2.dfsg1/src/Headers/metaStateInfo.h0000644021234200000250000000706707630463447016550 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** metaStateInfo.h ** ** A record that keeps information on a user-defined state including: ** ** o A name ** o State Type (what kinds of things have this state value) ** o Number of values, and their mnemonics ** o A combination table (stateCombinationTable) for how different states combine as l/rvalues ** o Annotations (and map between annotation and value) ** o Context information (where can annotations be used) */ # ifndef MSINFO_H # define MSINFO_H /*@constant int metaState_error@*/ # define metaState_error -1 struct s_metaStateInfo { /*@only@*/ cstring name; fileloc loc; /* metaStateKind type; */ cstringList valueNames; stateCombinationTable sctable; stateCombinationTable mergetable; /* Default values */ int defaultValue [MTC_NUMCONTEXTS]; /* context */ mtContextNode context; } ; /* in forwardTypes: abst_typedef null struct _metaStateInfo *metaStateInfo; */ /*@constant null metaStateInfo metaStateInfo_undefined; @*/ # define metaStateInfo_undefined ((metaStateInfo) NULL) extern /*@falsewhennull@*/ bool metaStateInfo_isDefined (metaStateInfo) /*@*/ ; # define metaStateInfo_isDefined(p_info) ((p_info) != NULL) extern /*@nullwhentrue@*/ bool metaStateInfo_isUndefined (metaStateInfo) /*@*/ ; # define metaStateInfo_isUndefined(p_info) ((p_info) == NULL) extern /*@notnull@*/ metaStateInfo metaStateInfo_create (/*@only@*/ cstring p_name, /*@only@*/ cstringList p_valueNames, /*@only@*/ mtContextNode p_context, /*@only@*/ stateCombinationTable p_sctable, /*@only@*/ stateCombinationTable p_mergetable, /*@only@*/ fileloc p_loc) ; extern bool metaStateInfo_equal (metaStateInfo p_m1, metaStateInfo p_m2) /*@*/ ; # define metaStateInfo_equal(m1,m2) ((m1) == (m2)) extern int metaStateInfo_getDefaultValueContext (metaStateInfo p_info, mtContextKind p_context) /*@*/ ; extern void metaStateInfo_setDefaultValueContext (metaStateInfo p_info, mtContextKind p_context, int p_val) /*@modifies p_info@*/ ; extern void metaStateInfo_setDefaultRefValue (metaStateInfo p_info, int p_val) /*@modifies p_info@*/ ; extern void metaStateInfo_setDefaultParamValue (metaStateInfo p_info, int p_val) /*@modifies p_info@*/ ; extern void metaStateInfo_setDefaultResultValue (metaStateInfo p_info, int p_val) /*@modifies p_info@*/ ; extern int metaStateInfo_getDefaultValue (metaStateInfo p_info, sRef p_s) /*@*/ ; extern int metaStateInfo_getDefaultRefValue (metaStateInfo p_info) /*@*/ ; extern int metaStateInfo_getDefaultParamValue (metaStateInfo p_info) /*@*/ ; extern int metaStateInfo_getDefaultResultValue (metaStateInfo p_info) /*@*/ ; extern int metaStateInfo_getDefaultGlobalValue (metaStateInfo p_info) /*@*/ ; extern /*@observer@*/ mtContextNode metaStateInfo_getContext (metaStateInfo p_info) /*@*/ ; extern /*@observer@*/ cstring metaStateInfo_getName (metaStateInfo p_info) /*@*/ ; extern /*@observer@*/ fileloc metaStateInfo_getLoc (metaStateInfo p_info) /*@*/ ; extern /*@exposed@*/ stateCombinationTable metaStateInfo_getTransferTable (metaStateInfo p_info) /*@*/ ; extern /*@exposed@*/ stateCombinationTable metaStateInfo_getMergeTable (metaStateInfo p_info) /*@*/ ; extern /*@only@*/ cstring metaStateInfo_unparse (metaStateInfo p_info) /*@*/ ; extern /*@observer@*/ cstring metaStateInfo_unparseValue (metaStateInfo p_info, int p_value) /*@*/ ; extern void metaStateInfo_free (/*@only@*/ metaStateInfo) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/basic.h0000644021234200000250000000601407751267447015063 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef BASIC_H # define BASIC_H # ifdef HAVE_CONFIG_H # ifdef WIN32 /* BCC32 Contributed by Scott Frazer */ # ifdef BCC32 # include "../../bcc32/bcc32_config.h" # else /* Win32 uses its own hand-generated config file */ # include "../../winconfig.h" # endif # else # include "../../config.h" # endif # else # error "No config.h file!" # endif # include # include # if !defined (WIN32) && !(defined (OS2) && defined (__IBMC__)) /* Microsoft VC++ still doesn't support ISO C99... */ # include # endif #if defined (OS2) && defined (__IBMC__) extern int snprintf (char *str, size_t count, const char *fmt, ...); #endif # include # include # include # include # include "general.h" # include "ynm.h" # include "message.h" # include "fileloc.h" # include "globals.h" # include "cpp.h" # include "cstringSList.h" # include "cstringList.h" # include "flag_codes.h" # include "flags.h" # include "flagSpec.h" # include "qual.h" # include "lltok.h" # include "clause.h" # include "globalsClause.h" # include "modifiesClause.h" # include "warnClause.h" # include "functionClause.h" # include "functionClauseList.h" # include "llerror.h" # include "fileLib.h" # include "inputStream.h" # include "qualList.h" # include "pointers.h" # include "code.h" # include "mapping.h" # include "sort.h" # include "lclctypes.h" # include "paramNode.h" # include "paramNodeList.h" # include "lsymbol.h" # include "abstract.h" # include "symtable.h" # include "exprNodeList.h" # include "cprim.h" # include "cstringTable.h" # include "genericTable.h" # include "filelocList.h" # include "enumNameList.h" # include "enumNameSList.h" # include "varKinds.h" # include "sRefSet.h" # include "ekind.h" # include "usymId.h" # include "typeId.h" # include "usymIdSet.h" # include "sRefList.h" # include "uentryList.h" # include "globSet.h" # include "ctypeList.h" # include "aliasTable.h" # include "reader.h" # include "usymtab.h" # include "lctype.h" # include "qtype.h" # include "idDecl.h" # include "multiVal.h" # include "stateClause.h" # include "stateClauseList.h" # include "uentry.h" # include "stateInfo.h" # include "stateValue.h" # include "valueTable.h" # include "sRef.h" # include "guardSet.h" # include "constraintTerm.h" # include "constraintExprData.h" # include "constraintExpr.h" # include "constraint.h" # include "constraintList.h" # include "exprNode.h" # include "exprData.h" # include "typeIdSet.h" # include "idDeclList.h" # include "clabstract.h" # include "sRefSetList.h" # include "flagMarker.h" # include "flagMarkerList.h" # include "macrocache.h" # include "fileTable.h" # include "messageLog.h" # include "clauseStack.h" # include "stateCombinationTable.h" # include "mtincludes.h" # include "functionConstraint.h" # include "fileIdList.h" # include "context.h" # include "constants.h" # include "llglobals.h" # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/metaStateSpecifier.h0000644021234200000250000000203107630463447017550 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** metaStateSpecifier.h */ # ifndef METASTATESPECIFIER_H # define METASTATESPECIFIER_H struct s_metaStateSpecifier { bool elipsis; sRef sr; /*@observer@*/ metaStateInfo msinfo; } ; extern metaStateSpecifier metaStateSpecifier_create (/*@only@*/ sRef, /*@observer@*/ metaStateInfo) ; extern metaStateSpecifier metaStateSpecifier_createElipsis (/*@observer@*/ metaStateInfo) ; extern bool metaStateSpecifier_isElipsis (metaStateSpecifier) /*@*/ ; extern /*@exposed@*/ sRef metaStateSpecifier_getSref (metaStateSpecifier) /*@*/ ; extern /*@observer@*/ metaStateInfo metaStateSpecifier_getMetaStateInfo (metaStateSpecifier) /*@*/ ; extern cstring metaStateSpecifier_unparse (metaStateSpecifier) /*@*/ ; extern metaStateSpecifier metaStateSpecifier_copy (metaStateSpecifier) /*@*/ ; extern void metaStateSpecifier_free (/*@only@*/ metaStateSpecifier) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/bool.h0000644021234200000250000000300107730061143014704 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # if !defined(BOOL_H) # define BOOL_H # if defined (WIN32) || defined (OS2) && defined (__IBMC__) # ifndef FALSE /*@constant bool FALSE=false@*/ # define FALSE 0 # endif # ifndef TRUE /*@constant bool TRUE=true@*/ # define TRUE (!FALSE) # endif # else # ifndef FALSE /*@constant bool FALSE=false@*/ # define FALSE false # endif # ifndef TRUE /*@constant bool TRUE=true@*/ # define TRUE true # endif # endif extern /*@observer@*/ cstring bool_unparse (bool p_b) /*@*/ ; extern /*@observer@*/ cstring bool_dump (bool p_b) /*@*/ ; extern /*@unused@*/ bool bool_not (bool p_b) /*@*/ ; extern bool bool_equal (bool p_b1, bool p_b2) /*@*/ ; extern int bool_compare (bool p_b1, bool p_b2) /*@*/ ; extern bool bool_fromInt (int p_i) /*@*/ ; extern int bool_toInt (bool p_b) /*@*/ ; extern bool bool_isReasonable (/*@sef@*/ bool p_b) /*@*/ ; /*@-boolcompare@*/ # define bool_isReasonable(b) (((b) == TRUE) || ((b) == FALSE)) /*@=boolcompare@*/ # define bool_unparse(b) (cstring_makeLiteralTemp ((b) ? "true" : "false" )) # define bool_dump(b) (cstring_makeLiteralTemp ((b) ? "1" : "0" )) # define bool_not(b) ((b) ? FALSE : TRUE) # define bool_equal(a,b) ((a) ? (b) : !(b)) # define bool_compare(a,b) ((a) ? ((b) ? 0 : 1) : ((b) ? -1 : 0)) # define bool_fromInt(i) (((i) != 0) ? TRUE : FALSE) # define bool_toInt(b) ((b) ? 1 : 0) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/metaStateTable.h0000644021234200000250000000637007630463447016700 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** metaStateTable.h ** ** A global table that keeps information on the user-defined states. ** ** For each state definition, we need: ** ** o A name ** o State Type (what kinds of things have this state value) ** o Number of values, and their mnemonics ** o A combination table (stateCombinationTable) for how different states combine as l/rvalues ** o Annotations (and map between annotation and value) ** o Context information (where can annotations be used) */ # ifndef MSTABLE_H # define MSTABLE_H /*@constant null metaStateTable metaStateTable_undefined; @*/ # define metaStateTable_undefined genericTable_undefined extern /*@falsewhennull@*/ bool metaStateTable_isDefined(metaStateTable) /*@*/ ; # define metaStateTable_isDefined(p_h) (genericTable_isDefined ((genericTable) (p_h))) extern /*@nullwhentrue@*/ bool metaStateTable_isUndefined(metaStateTable) /*@*/ ; # define metaStateTable_isUndefined(p_h) (genericTable_isDefined ((genericTable) (p_h))) /*@constant int DEFAULT_MSTABLE_SIZE@*/ # define DEFAULT_MSTABLE_SIZE 32 extern /*@only@*/ metaStateTable metaStateTable_create (void) /*@*/ ; # define metaStateTable_create() ((metaStateTable) genericTable_create (DEFAULT_MSTABLE_SIZE)) extern void metaStateTable_insert (metaStateTable p_h, /*@only@*/ cstring p_key, /*@only@*/ metaStateInfo p_metaState) /*@modifies p_h@*/ ; extern /*@null@*/ /*@dependent@*/ /*@exposed@*/ metaStateInfo metaStateTable_lookup (metaStateTable p_h, cstring p_key) /*@*/ ; /*@access metaStateInfo@*/ # define metaStateTable_lookup(p_h,p_key) \ ((metaStateInfo) genericTable_lookup ((genericTable) (p_h), p_key)) /*@noaccess metaStateInfo@*/ extern bool metaStateTable_contains (metaStateTable p_h, cstring p_key) /*@*/ ; # define metaStateTable_contains(p_h,p_key) \ (genericTable_contains ((genericTable) (p_h), p_key)) extern /*@unused@*/ /*@only@*/ cstring metaStateTable_stats(metaStateTable p_h); # define metaStateTable_stats(p_h) genericTable_stats ((genericTable) (p_h)) extern void metaStateTable_free (/*@only@*/ metaStateTable p_h); # define metaStateTable_free(p_h) (genericTable_free ((genericTable) (p_h))) /*@iter metaStateTable_elements (sef metaStateTable p_g, yield exposed cstring m_key, yield exposed metaStateInfo m_el)@*/ /*@access genericTable@*/ # define metaStateTable_elements(p_g, m_key, m_el) \ { int m_ind; if (metaStateTable_isDefined (p_g)) \ { for (m_ind = 0 ; m_ind < (p_g)->size; m_ind++) \ { ghbucket m_hb; m_hb = (p_g)->buckets[m_ind]; \ if (m_hb != NULL) { \ int m_j; \ for (m_j = 0; m_j < (m_hb)->size; m_j++) { \ cstring m_key; metaStateInfo m_el; m_key = (m_hb)->entries[m_j]->key; \ /*@access metaStateInfo@*/ \ m_el = (metaStateInfo) ((m_hb)->entries[m_j]->val); \ /*@noaccess metaStateInfo@*/ # define end_metaStateTable_elements }}}}} /*@noaccess genericTable@*/ extern cstring metaStateTable_unparse (metaStateTable p_h) ; extern int metaStateTable_size (metaStateTable p_h); # define metaStateTable_size(p_h) (genericTable_size(p_h)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/boolStack.h0000644021234200000250000000164207630463445015715 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** boolStack.h */ # ifndef boolStack_H # define boolStack_H typedef struct _boolStack { int nelements; int nspace; int current; /*@reldef@*/ bool *elements; } _boolStack ; typedef _boolStack *boolStack ; # define boolStack_size(s) ((s)->nelements) # define boolStack_isEmpty(s) (boolStack_size(s) == 0) # define boolStack_empty(s) (boolStack_size(s) == 0) extern boolStack boolStack_new(void); extern void boolStack_push (boolStack s, bool el) ; extern void boolStack_pop (boolStack s) ; extern bool boolStack_top (boolStack s) ; extern cstring boolStack_unparse (boolStack s) ; extern void boolStack_free (/*@only@*/ boolStack s) ; extern void boolStack_switchTop (boolStack s); # define boolStackBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/misc.h0000644021234200000250000000370207646432517014731 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** misc.h ** ** (general.c) */ # ifndef MISC_H # define MISC_H # include "lclMisc.h" extern void assertSet (/*@special@*/ /*@sef@*/ /*@unused@*/ void *p_x) /*@sets p_x, *p_x@*/ ; # define assertSet(x) ; extern void assertDefined (/*@sef@*/ /*@unused@*/ void *p_x) ; # define assertDefined(x) ; /*@-czechfcns@*/ extern int size_toInt (size_t p_x) /*@*/ /*@ensures result == p_x@*/; extern long size_toLong (size_t p_x) /*@*/ /*@ensures result == p_x@*/ ; extern size_t size_fromInt (int p_x) /*@*/ /*@ensures result == p_x@*/ ; extern size_t size_fromLong (long p_x) /*@*/ /*@ensures result == p_x@*/ ; extern size_t size_fromLongUnsigned (long unsigned p_x) /*@*/ /*@ensures result == p_x@*/ ; extern int longUnsigned_toInt (long unsigned int p_x) /*@*/ /*@ensures result == p_x@*/ ; extern int long_toInt (long p_x) /*@*/ /*@ensures result == p_x@*/; extern long unsigned longUnsigned_fromInt (int p_x) /*@*/ /*@ensures result == p_x@*/ ; /*@=czechfcns@*/ # include "mstring.h" extern int int_compare (/*@sef@*/ int p_x, /*@sef@*/ int p_y) /*@*/ ; # define int_compare(x,y) (((x) > (y)) ? 1 : (((x) < (y)) ? -1 : 0)) /*@-macroparams@*/ /*@-macrofcndecl@*/ /* works for lots of types */ # define generic_compare(x,y) (((x) > (y)) ? 1 : (((x) < (y)) ? -1 : 0)) /*@=macrofcndecl@*/ /*@=macroparams@*/ /*@notfunction@*/ # define GET(s) ((s *)smalloc(sizeof(s))) /*@-czechfcns@*/ extern bool isHeaderFile (cstring) /*@*/ ; extern void fputline (FILE *p_out, char *p_s) /*@modifies p_out@*/; extern int int_log (int p_x) /*@*/ ; extern char char_fromInt (int p_x) /*@*/ ; extern /*@exposed@*/ cstring removePreDirs (cstring p_s); /* These are defined by the bison library (?) */ extern /*@external@*/ int isatty (int); extern /*@external@*/ int yywrap (void); /*@=czechfcns@*/ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cgrammar.h0000644021234200000250000000034607630463445015565 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** cgrammar.h */ /* #ifndef NCGRAM2 ** # include "cgrammar_tokens.h" ** #endif */ splint-3.1.2.dfsg1/src/Headers/modifiesClause.h0000644021234200000250000000177707630463447016743 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** modifiesClause.h */ # ifndef MODIFIESCLAUSE_H # define MODIFIESCLAUSE_H struct s_modifiesClause { bool isnomods; fileloc loc; sRefSet srs; } ; extern modifiesClause modifiesClause_createNoMods (/*@only@*/ lltok) /*@*/ ; extern bool modifiesClause_isNoMods (modifiesClause) ; # define modifiesClause_isNoMods(m) ((m)->isnomods) extern /*@observer@*/ sRefSet modifiesClause_getMods (modifiesClause) ; extern /*@only@*/ sRefSet modifiesClause_takeMods (modifiesClause) ; extern /*@observer@*/ fileloc modifiesClause_getLoc (modifiesClause) /*@*/ ; # define modifiesClause_getLoc(gl) ((gl)->loc) extern modifiesClause modifiesClause_create (/*@only@*/ lltok, /*@only@*/ sRefSet) /*@*/ ; extern cstring modifiesClause_unparse (modifiesClause p_node) /*@*/ ; extern void modifiesClause_free (/*@only@*/ modifiesClause) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cgrammar_tokens.h0000644021234200000250000003214210645776225017152 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { BADTOK = 258, SKIPTOK = 259, CTOK_ELIPSIS = 260, CASE = 261, DEFAULT = 262, CIF = 263, CELSE = 264, SWITCH = 265, WHILE = 266, DO = 267, CFOR = 268, GOTO = 269, CONTINUE = 270, BREAK = 271, RETURN = 272, TSEMI = 273, TLBRACE = 274, TRBRACE = 275, TCOMMA = 276, TCOLON = 277, TASSIGN = 278, TLPAREN = 279, TRPAREN = 280, TLSQBR = 281, TRSQBR = 282, TDOT = 283, TAMPERSAND = 284, TEXCL = 285, TTILDE = 286, TMINUS = 287, TPLUS = 288, TMULT = 289, TDIV = 290, TPERCENT = 291, TLT = 292, TGT = 293, TCIRC = 294, TBAR = 295, TQUEST = 296, CSIZEOF = 297, CALIGNOF = 298, CTYPEOF = 299, ARROW_OP = 300, CTYPEDEF = 301, COFFSETOF = 302, INC_OP = 303, DEC_OP = 304, LEFT_OP = 305, RIGHT_OP = 306, LE_OP = 307, GE_OP = 308, EQ_OP = 309, NE_OP = 310, AND_OP = 311, OR_OP = 312, MUL_ASSIGN = 313, DIV_ASSIGN = 314, MOD_ASSIGN = 315, ADD_ASSIGN = 316, SUB_ASSIGN = 317, LEFT_ASSIGN = 318, RIGHT_ASSIGN = 319, AND_ASSIGN = 320, XOR_ASSIGN = 321, OR_ASSIGN = 322, CSTRUCT = 323, CUNION = 324, CENUM = 325, VA_ARG = 326, VA_DCL = 327, QWARN = 328, QGLOBALS = 329, QMODIFIES = 330, QNOMODS = 331, QCONSTANT = 332, QFUNCTION = 333, QITER = 334, QDEFINES = 335, QUSES = 336, QALLOCATES = 337, QSETS = 338, QRELEASES = 339, QPRECLAUSE = 340, QPOSTCLAUSE = 341, QINVARIANT = 342, QALT = 343, QUNDEF = 344, QKILLED = 345, QENDMACRO = 346, LLMACRO = 347, LLMACROITER = 348, LLMACROEND = 349, TENDMACRO = 350, QDREVEALSTATE = 351, QSWITCHBREAK = 352, QLOOPBREAK = 353, QINNERBREAK = 354, QSAFEBREAK = 355, QINNERCONTINUE = 356, QFALLTHROUGH = 357, QLINTNOTREACHED = 358, QLINTFALLTHROUGH = 359, QLINTFALLTHRU = 360, QARGSUSED = 361, QPRINTFLIKE = 362, QLINTPRINTFLIKE = 363, QSCANFLIKE = 364, QMESSAGELIKE = 365, QNOTREACHED = 366, QCONST = 367, QRESTRICT = 368, QVOLATILE = 369, QINLINE = 370, QEXTENSION = 371, QEXTERN = 372, QSTATIC = 373, QAUTO = 374, QREGISTER = 375, QOUT = 376, QIN = 377, QYIELD = 378, QONLY = 379, QTEMP = 380, QSHARED = 381, QREF = 382, QUNIQUE = 383, QCHECKED = 384, QUNCHECKED = 385, QCHECKEDSTRICT = 386, QCHECKMOD = 387, QKEEP = 388, QKEPT = 389, QPARTIAL = 390, QSPECIAL = 391, QOWNED = 392, QDEPENDENT = 393, QRETURNED = 394, QEXPOSED = 395, QNULL = 396, QOBSERVER = 397, QISNULL = 398, QEXITS = 399, QMAYEXIT = 400, QNEVEREXIT = 401, QTRUEEXIT = 402, QFALSEEXIT = 403, QLONG = 404, QSIGNED = 405, QUNSIGNED = 406, QSHORT = 407, QUNUSED = 408, QSEF = 409, QNOTNULL = 410, QRELNULL = 411, QABSTRACT = 412, QNUMABSTRACT = 413, QCONCRETE = 414, QMUTABLE = 415, QIMMUTABLE = 416, QTRUENULL = 417, QFALSENULL = 418, QEXTERNAL = 419, QREFCOUNTED = 420, QREFS = 421, QNEWREF = 422, QTEMPREF = 423, QKILLREF = 424, QRELDEF = 425, CGCHAR = 426, CBOOL = 427, CINT = 428, CGFLOAT = 429, CDOUBLE = 430, CVOID = 431, QANYTYPE = 432, QINTEGRALTYPE = 433, QUNSIGNEDINTEGRALTYPE = 434, QSIGNEDINTEGRALTYPE = 435, QNULLTERMINATED = 436, QSETBUFFERSIZE = 437, QSETSTRINGLENGTH = 438, QMAXSET = 439, QMAXREAD = 440, QTESTINRANGE = 441, TCAND = 442, IDENTIFIER = 443, NEW_IDENTIFIER = 444, TYPE_NAME_OR_ID = 445, CANNOTATION = 446, CCONSTANT = 447, ITER_NAME = 448, ITER_ENDNAME = 449, TYPE_NAME = 450, METASTATE_NAME = 451 }; #endif /* Tokens. */ #define BADTOK 258 #define SKIPTOK 259 #define CTOK_ELIPSIS 260 #define CASE 261 #define DEFAULT 262 #define CIF 263 #define CELSE 264 #define SWITCH 265 #define WHILE 266 #define DO 267 #define CFOR 268 #define GOTO 269 #define CONTINUE 270 #define BREAK 271 #define RETURN 272 #define TSEMI 273 #define TLBRACE 274 #define TRBRACE 275 #define TCOMMA 276 #define TCOLON 277 #define TASSIGN 278 #define TLPAREN 279 #define TRPAREN 280 #define TLSQBR 281 #define TRSQBR 282 #define TDOT 283 #define TAMPERSAND 284 #define TEXCL 285 #define TTILDE 286 #define TMINUS 287 #define TPLUS 288 #define TMULT 289 #define TDIV 290 #define TPERCENT 291 #define TLT 292 #define TGT 293 #define TCIRC 294 #define TBAR 295 #define TQUEST 296 #define CSIZEOF 297 #define CALIGNOF 298 #define CTYPEOF 299 #define ARROW_OP 300 #define CTYPEDEF 301 #define COFFSETOF 302 #define INC_OP 303 #define DEC_OP 304 #define LEFT_OP 305 #define RIGHT_OP 306 #define LE_OP 307 #define GE_OP 308 #define EQ_OP 309 #define NE_OP 310 #define AND_OP 311 #define OR_OP 312 #define MUL_ASSIGN 313 #define DIV_ASSIGN 314 #define MOD_ASSIGN 315 #define ADD_ASSIGN 316 #define SUB_ASSIGN 317 #define LEFT_ASSIGN 318 #define RIGHT_ASSIGN 319 #define AND_ASSIGN 320 #define XOR_ASSIGN 321 #define OR_ASSIGN 322 #define CSTRUCT 323 #define CUNION 324 #define CENUM 325 #define VA_ARG 326 #define VA_DCL 327 #define QWARN 328 #define QGLOBALS 329 #define QMODIFIES 330 #define QNOMODS 331 #define QCONSTANT 332 #define QFUNCTION 333 #define QITER 334 #define QDEFINES 335 #define QUSES 336 #define QALLOCATES 337 #define QSETS 338 #define QRELEASES 339 #define QPRECLAUSE 340 #define QPOSTCLAUSE 341 #define QINVARIANT 342 #define QALT 343 #define QUNDEF 344 #define QKILLED 345 #define QENDMACRO 346 #define LLMACRO 347 #define LLMACROITER 348 #define LLMACROEND 349 #define TENDMACRO 350 #define QDREVEALSTATE 351 #define QSWITCHBREAK 352 #define QLOOPBREAK 353 #define QINNERBREAK 354 #define QSAFEBREAK 355 #define QINNERCONTINUE 356 #define QFALLTHROUGH 357 #define QLINTNOTREACHED 358 #define QLINTFALLTHROUGH 359 #define QLINTFALLTHRU 360 #define QARGSUSED 361 #define QPRINTFLIKE 362 #define QLINTPRINTFLIKE 363 #define QSCANFLIKE 364 #define QMESSAGELIKE 365 #define QNOTREACHED 366 #define QCONST 367 #define QRESTRICT 368 #define QVOLATILE 369 #define QINLINE 370 #define QEXTENSION 371 #define QEXTERN 372 #define QSTATIC 373 #define QAUTO 374 #define QREGISTER 375 #define QOUT 376 #define QIN 377 #define QYIELD 378 #define QONLY 379 #define QTEMP 380 #define QSHARED 381 #define QREF 382 #define QUNIQUE 383 #define QCHECKED 384 #define QUNCHECKED 385 #define QCHECKEDSTRICT 386 #define QCHECKMOD 387 #define QKEEP 388 #define QKEPT 389 #define QPARTIAL 390 #define QSPECIAL 391 #define QOWNED 392 #define QDEPENDENT 393 #define QRETURNED 394 #define QEXPOSED 395 #define QNULL 396 #define QOBSERVER 397 #define QISNULL 398 #define QEXITS 399 #define QMAYEXIT 400 #define QNEVEREXIT 401 #define QTRUEEXIT 402 #define QFALSEEXIT 403 #define QLONG 404 #define QSIGNED 405 #define QUNSIGNED 406 #define QSHORT 407 #define QUNUSED 408 #define QSEF 409 #define QNOTNULL 410 #define QRELNULL 411 #define QABSTRACT 412 #define QNUMABSTRACT 413 #define QCONCRETE 414 #define QMUTABLE 415 #define QIMMUTABLE 416 #define QTRUENULL 417 #define QFALSENULL 418 #define QEXTERNAL 419 #define QREFCOUNTED 420 #define QREFS 421 #define QNEWREF 422 #define QTEMPREF 423 #define QKILLREF 424 #define QRELDEF 425 #define CGCHAR 426 #define CBOOL 427 #define CINT 428 #define CGFLOAT 429 #define CDOUBLE 430 #define CVOID 431 #define QANYTYPE 432 #define QINTEGRALTYPE 433 #define QUNSIGNEDINTEGRALTYPE 434 #define QSIGNEDINTEGRALTYPE 435 #define QNULLTERMINATED 436 #define QSETBUFFERSIZE 437 #define QSETSTRINGLENGTH 438 #define QMAXSET 439 #define QMAXREAD 440 #define QTESTINRANGE 441 #define TCAND 442 #define IDENTIFIER 443 #define NEW_IDENTIFIER 444 #define TYPE_NAME_OR_ID 445 #define CANNOTATION 446 #define CCONSTANT 447 #define ITER_NAME 448 #define ITER_ENDNAME 449 #define TYPE_NAME 450 #define METASTATE_NAME 451 #if ! defined cgrammar_YYSTYPE && ! defined cgrammar_YYSTYPE_IS_DECLARED typedef union cgrammar_YYSTYPE { lltok tok; int count; qual typequal; qualList tquallist; ctype ctyp; /*@dependent@*/ sRef sr; /*@only@*/ sRef osr; /*@only@*/ functionClauseList funcclauselist; /*@only@*/ functionClause funcclause; /*@only@*/ flagSpec flagspec; /*@only@*/ globalsClause globsclause; /*@only@*/ modifiesClause modsclause; /*@only@*/ warnClause warnclause; /*@only@*/ stateClause stateclause; /*@only@*/ pointers pointers; /*@only@*/ functionConstraint fcnconstraint; /*@only@*/ metaStateConstraint msconstraint; /*@only@*/ metaStateSpecifier msspec; /*@only@*/ metaStateExpression msexpr; /*@observer@*/ metaStateInfo msinfo; /*@only@*/ sRefList srlist; /*@only@*/ globSet globset; /*@only@*/ qtype qtyp; /*@only@*/ cstring cname; /*@observer@*/ annotationInfo annotation; /*@only@*/ idDecl ntyp; /*@only@*/ idDeclList ntyplist; /*@only@*/ uentryList flist; /*@owned@*/ uentryList entrylist; /*@observer@*/ /*@dependent@*/ uentry entry; /*@only@*/ uentry oentry; /*@only@*/ exprNode expr; /*@only@*/ enumNameList enumnamelist; /*@only@*/ exprNodeList exprlist; /*@only@*/ sRefSet srset; /*@only@*/ cstringList cstringlist; /*drl added 1/19/2001 */ constraint con; constraintList conL; constraintExpr conE; /* drl */ } /* Line 1529 of yacc.c. */ cgrammar_YYSTYPE; # define yystype cgrammar_YYSTYPE /* obsolescent; will be withdrawn */ # define cgrammar_YYSTYPE_IS_DECLARED 1 # define cgrammar_YYSTYPE_IS_TRIVIAL 1 #endif extern cgrammar_YYSTYPE yylval; /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/Headers/modifyNode.h0000644021234200000250000000077307630463447016077 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; bool modifiesNothing; bool hasStoreRefList; /* if hasStoreRefList is FALSE, then it's either NOTHING or ANYTHING */ /* evs - this is a really kludgy way of doing this... */ /*@reldef@*/ storeRefNodeList list; } *modifyNode; extern /*@unused@*/ /*@only@*/ cstring modifyNode_unparse (/*@null@*/ modifyNode p_m); splint-3.1.2.dfsg1/src/Headers/checking.h0000644021234200000250000000054407630463445015547 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ extern termNode checkSort (/*@returned@*/ termNode p_t); extern /*@null@*/ termNode computePossibleSorts (/*@returned@*/ /*@null@*/ termNode p_t); extern void checkLclPredicate (ltoken p_t, lclPredicateNode p_n); splint-3.1.2.dfsg1/src/Headers/mtAnnotationDecl.h0000644021234200000250000000245007630463447017237 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtAnnotationDecl.h */ # ifndef MTANNOTATIONDECL_H # define MTANNOTATIONDECL_H struct s_mtAnnotationDecl { cstring name; cstring value; mtContextNode context; fileloc loc; } ; extern cstring mtAnnotationDecl_unparse (mtAnnotationDecl p_node) /*@*/ ; extern mtAnnotationDecl mtAnnotationDecl_create (/*@only@*/ mttok p_id, /*@only@*/ mtContextNode p_c, /*@only@*/ mttok p_value) /*@*/ ; extern /*@observer@*/ cstring mtAnnotationDecl_getName (mtAnnotationDecl p_annot) /*@*/ ; # define mtAnnotationDecl_getName(annot) ((annot)->name) extern /*@observer@*/ cstring mtAnnotationDecl_getValue (mtAnnotationDecl p_annot) /*@*/ ; # define mtAnnotationDecl_getValue(annot) ((annot)->value) extern /*@only@*/ mtContextNode mtAnnotationDecl_stealContext (mtAnnotationDecl p_annot) /*@modifies p_annot@*/ ; extern /*@observer@*/ mtContextNode mtAnnotationDecl_getContext (mtAnnotationDecl p_annot) /*@*/ ; # define mtAnnotationDecl_getContext(annot) ((annot)->context) extern /*@observer@*/ fileloc mtAnnotationDecl_getLoc (mtAnnotationDecl p_annot) /*@*/ ; # define mtAnnotationDecl_getLoc(annot) ((annot)->loc) /*@i25@*/ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/clabstract.h0000644021234200000250000001017107671271605016113 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** clabstract.h */ # ifndef CLABSTRACT_H # define CLABSTRACT_H extern void setArgsUsed (void) /*@modifies internalState@*/ ; extern void setSpecialFunction (qual p_qu) /*@modifies internalState@*/ ; extern bool isFlipOldStyle(void) /*@*/ ; extern bool isNewStyle(void) /*@*/ ; extern bool processingIterVars(void) /*@*/ ; extern ctype declareEnum (/*@only@*/ cstring p_ename, /*@only@*/ enumNameList p_el); extern ctype declareStruct (/*@temp@*/ cstring p_id, /*@only@*/ uentryList p_f); extern ctype declareUnnamedStruct (/*@only@*/ uentryList p_f); extern ctype declareUnion (/*@temp@*/ cstring p_id, /*@only@*/ uentryList p_f); extern ctype declareUnnamedUnion (/*@only@*/ uentryList p_f); extern ctype declareUnnamedEnum (/*@only@*/ enumNameList p_el); extern ctype handleEnum (/*@only@*/ cstring p_id); extern ctype handleStruct (/*@only@*/ cstring p_id); extern ctype handleUnion (/*@only@*/ cstring p_id); extern uentryList handleParamIdList (/*@returned@*/ /*@dependent@*/ uentryList p_params); extern uentryList handleParamTypeList (/*@dependent@*/ /*@returned@*/ uentryList p_params); extern uentryList fixUentryList (/*@only@*/ idDeclList p_tl, qtype p_q); extern uentryList fixUnnamedDecl (qtype p_q) /*@*/ ; extern /*@exposed@*/ uentry getCurrentIter(void); extern void processNamedDecl (idDecl p_t); extern void clabstract_declareType (/*@only@*/ exprNodeList, /*@only@*/ warnClause) /*@modifies internalState@*/ ; extern void clabstract_declareFunction (/*@only@*/ idDecl p_tid) /*@globals internalState@*/ ; extern void doVaDcl (void); extern void oldStyleDoneParams (void); extern void setCurrentParams (/*@dependent@*/ uentryList p_ue); extern void clearCurrentParams (void); extern /*@exposed@*/ sRef fixModifiesId (cstring p_s); extern /*@exposed@*/ sRef fixStateClausesId (cstring p_s); extern void setFlipOldStyle(void); extern void setNewStyle(void); extern void unsetProcessingGlobals (void); extern void setProcessingIterVars (uentry p_iter); extern void setProcessingTypedef (/*@only@*/ qtype p_q); extern void setProcessingVars (/*@only@*/ qtype p_q); extern void setStorageClass (storageClassCode p_sc); extern void storeLoc (void); extern void unsetProcessingTypedef (void); extern void unsetProcessingVars (void); extern /*@only@*/ uentry makeCurrentParam (idDecl p_t); extern void setProcessingGlobalsList (void); extern /*@exposed@*/ sRef modListArrayFetch (/*@exposed@*/ sRef p_s, sRef p_mexp); extern /*@exposed@*/ sRef modListPointer (/*@exposed@*/ sRef p_s); extern /*@exposed@*/ sRef modListFieldAccess (sRef p_s, /*@only@*/ cstring p_f); extern /*@exposed@*/ sRef modListArrowAccess (sRef p_s, /*@only@*/ cstring p_f); extern /*@dependent@*/ sRef clabstract_unrecognizedGlobal (cstring p_s); extern /*@dependent@*/ sRef clabstract_createGlobal (/*@temp@*/ sRef p_sr, /*@only@*/ qualList p_quals); extern void checkDoneParams (void); extern void exitParamsTemp (void); extern void enterParamsTemp (void); extern void clearProcessingGlobMods (void); extern bool isProcessingGlobMods (void); extern void setProcessingGlobMods (void); extern void setFunctionNoGlobals (void); extern int iterParamNo (void); extern void nextIterParam (void); extern void declareCIter (cstring p_name, /*@owned@*/ uentryList p_params); extern void checkModifiesId (uentry p_ue); extern /*@exposed@*/ sRef checkStateClausesId (uentry p_ue); extern void checkConstant (qtype p_t, idDecl p_id) ; extern void checkValueConstant (qtype p_t, idDecl p_id, exprNode p_e) ; extern void declareStaticFunction (/*@only@*/ idDecl p_tid) /*@globals internalState@*/ ; /*drl added to header 1/19/2001 (added to clabstract earilier */ extern sRef checkbufferConstraintClausesId (uentry p_ue); extern void setImplicitfcnConstraints (void); /*@observer@*/ constraintList getImplicitFcnConstraints (void); /* end drl*/ extern /*@dependent@*/ sRef clabstract_checkGlobal (/*@only@*/ exprNode) ; extern void clabstract_initMod (void) /*@modifies internalState@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtAnnotationList.h0000644021234200000250000000437607646432517017315 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef MTANNOTATIONLIST_H # define MTANNOTATIONLIST_H typedef /*@only@*/ mtAnnotationDecl o_mtAnnotationDecl; struct s_mtAnnotationList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_mtAnnotationDecl *elements; } ; /*@constant null mtAnnotationList mtAnnotationList_undefined;@*/ # define mtAnnotationList_undefined ((mtAnnotationList) NULL) extern /*@falsewhennull@*/ bool mtAnnotationList_isDefined (mtAnnotationList p_s) /*@*/ ; # define mtAnnotationList_isDefined(s) ((s) != mtAnnotationList_undefined) extern int mtAnnotationList_size (/*@sef@*/ mtAnnotationList) /*@*/ ; # define mtAnnotationList_size(s) (mtAnnotationList_isDefined (s) ? (s)->nelements : 0) extern /*@unused@*/ /*@falsewhennull@*/ bool mtAnnotationList_empty (/*@sef@*/ mtAnnotationList) /*@*/ ; # define mtAnnotationList_empty(s) (mtAnnotationList_size(s) == 0) extern cstring mtAnnotationList_unparseSep (mtAnnotationList p_s, cstring p_sep) /*@*/ ; extern /*@unused@*/ /*@only@*/ mtAnnotationList mtAnnotationList_new (void) /*@*/ ; extern /*@only@*/ mtAnnotationList mtAnnotationList_single (/*@only@*/ mtAnnotationDecl p_el) /*@*/ ; extern mtAnnotationList mtAnnotationList_add (/*@returned@*/ mtAnnotationList p_s, /*@only@*/ mtAnnotationDecl p_el) /*@modifies p_s@*/ ; extern /*@only@*/ mtAnnotationList mtAnnotationList_prepend (/*@only@*/ mtAnnotationList p_s, /*@only@*/ mtAnnotationDecl p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring mtAnnotationList_unparse (mtAnnotationList p_s) ; extern void mtAnnotationList_free (/*@only@*/ mtAnnotationList p_s) ; /*@constant int mtAnnotationListBASESIZE;@*/ # define mtAnnotationListBASESIZE MIDBASESIZE /*@iter mtAnnotationList_elements (sef mtAnnotationList x, yield exposed mtAnnotationDecl el); @*/ # define mtAnnotationList_elements(x, m_el) \ { if (mtAnnotationList_isDefined (x)) { \ int m_ind; mtAnnotationDecl *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { mtAnnotationDecl m_el = *(m_elements++); # define end_mtAnnotationList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/claimNode.h0000644021234200000250000000072007630463445015663 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken name; paramNodeList params; /*@null@*/ globalList globals; /*@null@*/ letDeclNodeList lets; /*@null@*/ lclPredicateNode require; /*@null@*/ programNode body; /*@null@*/ lclPredicateNode ensures; } *claimNode; extern /*@unused@*/ /*@only@*/ cstring claimNode_unparse (claimNode p_c); splint-3.1.2.dfsg1/src/Headers/mtAnnotationsNode.h0000644021234200000250000000135507630463447017443 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtAnnotationsNode.h */ # ifndef MTANNOTATIONSNODE_H # define MTANNOTATIONSNODE_H struct s_mtAnnotationsNode { mtAnnotationList annots; } ; extern mtAnnotationsNode mtAnnotationsNode_create (/*@only@*/ mtAnnotationList p_annots) /*@*/ ; extern /*@observer@*/ mtAnnotationList mtAnnotationsNode_getAnnotations (mtAnnotationsNode p_node) /*@*/ ; # define mtAnnotationsNode_getAnnotations(node) ((node)->annots) extern cstring mtAnnotationsNode_unparse (mtAnnotationsNode p_node) /*@*/ ; extern void mtAnnotationsNode_free (/*@only@*/ mtAnnotationsNode) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/clause.h0000644021234200000250000000147207121317325015237 0ustar fax typedef enum { NOCLAUSE, TRUECLAUSE, FALSECLAUSE, ANDCLAUSE, ORCLAUSE, WHILECLAUSE, DOWHILECLAUSE, FORCLAUSE, CASECLAUSE, SWITCHCLAUSE, CONDCLAUSE, ITERCLAUSE, TRUEEXITCLAUSE, FALSEEXITCLAUSE } clause; extern /*@observer@*/ cstring clause_nameAlternate (clause p_cl) /*@*/ ; extern /*@observer@*/ cstring clause_nameTaken (clause p_cl) /*@*/ ; extern /*@observer@*/ cstring clause_nameFlip (clause p_cl, bool p_flip) /*@*/ ; extern bool clause_isConditional (clause p_cl) /*@*/ ; extern bool clause_isBreakable (clause p_cl) /*@*/ ; extern bool clause_isLoop (clause p_cl) /*@*/ ; extern bool clause_isSwitch (clause p_cl) /*@*/ ; extern bool clause_isCase (clause p_cl) /*@*/ ; extern bool clause_isNone (clause p_cl) /*@*/ ; extern /*@observer@*/ cstring clause_unparse (clause p_cl) /*@*/ ; splint-3.1.2.dfsg1/src/Headers/mtContextNode.h0000644021234200000250000000411507630463447016567 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtContextNode.h */ # ifndef MTCONTEXTNODE_H # define MTCONTEXTNODE_H typedef enum { MTC_ANY = 0, MTC_PARAM, MTC_RESULT, MTC_REFERENCE, MTC_CLAUSE, MTC_LITERAL, MTC_NULL } mtContextKind ; /*@constant int MTC_NUMCONTEXTS@*/ /*@+enumint@*/ # define MTC_NUMCONTEXTS (MTC_NULL + 1) /*@=enumint@*/ struct s_mtContextNode { mtContextKind context; ctype type; /* This state only applies to types matching. */ } ; /*@constant null mtContextNode mtContextNode_undefined@*/ # define mtContextNode_undefined ((mtContextNode) 0) extern /*@falsewhennull@*/ bool mtContextNode_isDefined (mtContextNode p_s) /*@*/ ; # define mtContextNode_isDefined(s) ((s) != mtContextNode_undefined) extern cstring mtContextNode_unparse (mtContextNode) /*@*/ ; extern mtContextNode mtContextNode_createAny (void) /*@*/ ; extern mtContextNode mtContextNode_createParameter (ctype) /*@*/ ; extern mtContextNode mtContextNode_createReference (ctype) /*@*/ ; extern mtContextNode mtContextNode_createResult (ctype) /*@*/ ; extern mtContextNode mtContextNode_createClause (ctype) /*@*/ ; extern mtContextNode mtContextNode_createNull (ctype) /*@*/ ; extern mtContextNode mtContextNode_createLiteral (ctype) /*@*/ ; extern void mtContextNode_free (/*@only@*/ mtContextNode) ; extern bool mtContextNode_isReference (mtContextNode) /*@*/; extern bool mtContextNode_isResult (mtContextNode) /*@*/; extern bool mtContextNode_isParameter (mtContextNode) /*@*/; extern bool mtContextNode_isClause (mtContextNode) /*@*/; extern bool mtContextNode_isLiteral (mtContextNode) /*@*/; extern bool mtContextNode_isNull (mtContextNode) /*@*/; extern bool mtContextNode_matchesEntry (mtContextNode, uentry) /*@*/ ; extern bool mtContextNode_matchesRef (mtContextNode, sRef) /*@*/ ; extern bool mtContextNode_matchesRefStrict (mtContextNode, sRef) /*@*/ ; /* Doesn't allow matches with unknown type. */ extern void mtContextNode_showRefError (mtContextNode, sRef) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/clauseStack.h0000644021234200000250000000316107630463445016234 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** clauseStack.h */ # ifndef clauseStack_H # define clauseStack_H abst_typedef struct { int nelements; int nspace; int current; /*@reldef@*/ clause *elements; } *clauseStack ; /*@iter clauseStack_elements (sef clauseStack s, yield clause el); @*/ # define clauseStack_elements(s, m_el) \ { int m_i; for (m_i = (s)->nelements - 1; m_i >= 0; m_i--) { clause m_el = (s)->elements[m_i]; # define end_clauseStack_elements }} extern int clauseStack_size (clauseStack p_s) /*@*/ ; extern bool clauseStack_isEmpty (clauseStack p_s) /*@*/ ; # define clauseStack_size(s) ((s)->nelements) # define clauseStack_isEmpty(s) (clauseStack_size(s) == 0) extern /*@only@*/ clauseStack clauseStack_new (void) /*@*/ ; extern void clauseStack_push (clauseStack p_s, clause p_el) /*@modifies p_s@*/ ; extern void clauseStack_pop (clauseStack p_s) /*@modifies p_s@*/ ; extern clause clauseStack_top (clauseStack p_s) /*@*/ ; extern /*@only@*/ cstring clauseStack_unparse (clauseStack p_s) /*@*/ ; extern void clauseStack_free (/*@only@*/ clauseStack p_s) ; extern void clauseStack_clear (clauseStack p_s) /*@modifies p_s@*/ ; extern void clauseStack_switchTop (clauseStack p_s, clause p_x) /*@modifies p_s@*/ ; extern void clauseStack_removeFirst (clauseStack p_s, clause p_key) /*@modifies p_s@*/ ; extern int clauseStack_controlDepth (clauseStack p_s) /*@*/ ; /*@constant int clauseStackBASESIZE;@*/ # define clauseStackBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtDeclarationNode.h0000644021234200000250000000171307630463447017371 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtDeclarationNode.h */ # ifndef MTDECLARATIONNODE_H # define MTDECLARATIONNODE_H struct s_mtDeclarationNode { fileloc loc; cstring name; mtDeclarationPieces pieces; } ; /* mtDeclarationNode defined in forwardTypes.h */ extern mtDeclarationNode mtDeclarationNode_create (/*@only@*/ mttok, /*@only@*/ mtDeclarationPieces) /*@*/ ; extern /*@observer@*/ cstring mtDeclarationNode_getName (mtDeclarationNode) /*@*/ ; extern /*@observer@*/ fileloc mtDeclarationNode_getLoc (mtDeclarationNode) /*@*/ ; extern cstring mtDeclarationNode_unparse (mtDeclarationNode p_node) /*@*/ ; extern void mtDeclarationNode_process (mtDeclarationNode p_node, bool p_isglobal) /*@modifies internalState@*/ ; extern void mtDeclarationNode_free (/*@only@*/ mtDeclarationNode p_node) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/code.h0000644021234200000250000000047107630463445014705 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /*@constant ltokenCode LEOFTOKEN;@*/ #define LEOFTOKEN 0 /* assume this is big enough for bison */ /* BOGUS! */ /*@constant ltokenCode NOTTOKEN;@*/ #define NOTTOKEN 9998 splint-3.1.2.dfsg1/src/Headers/mtDeclarationPiece.h0000644021234200000250000000662107651115037017524 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtDeclarationPiece.h */ # ifndef MTDECLARATIONPIECE_H # define MTDECLARATIONPIECE_H /*:private:*/ typedef enum { MTP_DEAD, MTP_CONTEXT, MTP_VALUES, MTP_DEFAULTS, MTP_DEFAULTVALUE, MTP_ANNOTATIONS, MTP_MERGE, MTP_TRANSFERS, MTP_PRECONDITIONS, MTP_POSTCONDITIONS, MTP_LOSERS } mtPieceKind; struct s_mtDeclarationPiece { mtPieceKind kind; /*@relnull@*/ void *node; /* oneof mt*Node or mttok */ } ; /* mtDeclarationPiece defined in forwardTypes.h */ /*@constant null mtDeclarationPiece mtDeclarationPiece_undefined; @*/ # define mtDeclarationPiece_undefined NULL extern /*@falsewhennull@*/ bool mtDeclarationPiece_isDefined(mtDeclarationPiece) /*@*/ ; # define mtDeclarationPiece_isDefined(p_h) ((p_h) != mtDeclarationPiece_undefined) extern /*@nullwhentrue@*/ bool mtDeclarationPiece_isUndefined(mtDeclarationPiece) /*@*/ ; # define mtDeclarationPiece_isUndefined(p_h) ((p_h) == mtDeclarationPiece_undefined) extern mtDeclarationPiece mtDeclarationPiece_createContext (/*@only@*/ mtContextNode) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createValues (/*@only@*/ mtValuesNode) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createDefaults (/*@only@*/ mtDefaultsNode) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createValueDefault (/*@only@*/ mttok) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createAnnotations (/*@only@*/ mtAnnotationsNode) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createMerge (/*@only@*/ mtMergeNode) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createTransfers (/*@only@*/ mtTransferClauseList) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createPostconditions (/*@only@*/ mtTransferClauseList) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createPreconditions (/*@only@*/ mtTransferClauseList) /*@*/ ; extern mtDeclarationPiece mtDeclarationPiece_createLosers (/*@only@*/ mtLoseReferenceList) /*@*/ ; extern /*@observer@*/ mtContextNode mtDeclarationPiece_getContext (mtDeclarationPiece) /*@*/ ; extern /*@only@*/ mtContextNode mtDeclarationPiece_stealContext (mtDeclarationPiece p_node) /*@modifies p_node@*/ ; extern /*@observer@*/ mtValuesNode mtDeclarationPiece_getValues (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ mtDefaultsNode mtDeclarationPiece_getDefaults (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ mtAnnotationsNode mtDeclarationPiece_getAnnotations (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ mtMergeNode mtDeclarationPiece_getMerge (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ mtTransferClauseList mtDeclarationPiece_getTransfers (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ mtTransferClauseList mtDeclarationPiece_getPostconditions (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ mtTransferClauseList mtDeclarationPiece_getPreconditions (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ cstring mtDeclarationPiece_getDefaultValue (mtDeclarationPiece) /*@*/ ; extern /*@observer@*/ mtLoseReferenceList mtDeclarationPiece_getLosers (mtDeclarationPiece) /*@*/ ; extern bool mtDeclarationPiece_matchKind (mtDeclarationPiece p_p, mtPieceKind p_kind) /*@*/ ; extern void mtDeclarationPiece_free (/*@only@*/ mtDeclarationPiece p_node) ; extern /*@only@*/ cstring mtDeclarationPiece_unparse (mtDeclarationPiece p_p) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/constants.h0000644021234200000250000001311310102766474016000 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** constants.h */ /* * This is constants.h from Mike Smith's Win32 port of splint. * Modified by Herbert 04/19/97: * added conditional 'OS2' to conditional 'MSDOS' */ # ifndef CONSTANTS_H # define CONSTANTS_H # if defined(MSDOS) /*@constant observer char *RCFILE; @*/ # define RCFILE "splint.rc" # else /*@constant observer char *RCFILE; @*/ # define RCFILE ".splintrc" /*@constant observer char *ALTRCFILE; @*/ # define ALTRCFILE ".lclintrc" # endif /*@constant observer cstring LARCH_PATH; @*/ # define LARCH_PATH cstring_makeLiteralTemp ("LARCH_PATH") /*@constant observer char *LCLIMPORTDIR; @*/ # define LCLIMPORTDIR "LCLIMPORTDIR" /*@constant observer char *LLSTDLIBS_NAME; @*/ # define LLSTDLIBS_NAME "standard" /*@constant observer char *LLSTRICTLIBS_NAME; @*/ # define LLSTRICTLIBS_NAME "standardstrict" /*@constant observer char *LLUNIXLIBS_NAME; @*/ # define LLUNIXLIBS_NAME "unix" /*@constant observer char *LLUNIXSTRICTLIBS_NAME; @*/ # define LLUNIXSTRICTLIBS_NAME "unixstrict" /*@constant observer char *LLPOSIXLIBS_NAME; @*/ # define LLPOSIXLIBS_NAME "posix" /*@constant observer char *LLPOSIXSTRICTLIBS_NAME; @*/ # define LLPOSIXSTRICTLIBS_NAME "posixstrict" /*@constant observer cstring REFSNAME; @*/ # define REFSNAME cstring_makeLiteralTemp ("refs") /* ** Used to be .lldmp. Truncated to .lcd to fix within ** MS-DOS filename limitations. */ /*@constant observer char *DUMP_SUFFIX; @*/ # define DUMP_SUFFIX ".lcd" /* ** All valid libraries start with this */ /*@constant observer char *LIBRARY_MARKER@*/ # define LIBRARY_MARKER ";;; Splint Library " /*@constant int MAX_NAME_LENGTH=256; @*/ # define MAX_NAME_LENGTH 1024 /*@constant int MAX_LINE_LENGTH=1024; @*/ # define MAX_LINE_LENGTH 1024 /*@constant int MAX_DUMP_LINE_LENGTH=16384; @*/ # define MAX_DUMP_LINE_LENGTH 16384 /*@constant int MINLINELEN=20; @*/ # define MINLINELEN 20 /* ** WARNING: Can't use macros in token for cgrammar.l --> ** must keep these consistent! */ /*@constant observer char *LLMRCODE; @*/ # define LLMRCODE "@QLMR" /* MUST be 5 chars = defin[e]. The number of spaces between the # and the d is the sixth tag. */ /*@constant observer char *PPMRCODE; @*/ # define PPMRCODE "@@MR@@" # ifdef OS2 /*@constant observer char *DEFAULT_SYSTEMDIR; @*/ # define DEFAULT_SYSTEMDIR "/os2/" # else /*@constant observer char *DEFAULT_SYSTEMDIR; @*/ # define DEFAULT_SYSTEMDIR "/usr/" # endif /*@constant char DEFAULT_COMMENTCHAR; @*/ # define DEFAULT_COMMENTCHAR '@' /*@constant int DEFAULT_LINELEN=80; @*/ # define DEFAULT_LINELEN 80 /*@constant int DEFAULT_BUGSLIMIT=3; @*/ # define DEFAULT_BUGSLIMIT 3 /*@constant int DEFAULT_INDENTSPACES=3; @*/ # define DEFAULT_INDENTSPACES 3 /* ** Setting this to 0 means emacs compile mode will ** jump to the locations in message hints. */ /*@constant int DEFAULT_LOCINDENTSPACES=3; @*/ # define DEFAULT_LOCINDENTSPACES 3 /* ** These constants are based on implementation limits in ANSI standard, ** Section 3.1. */ /*@constant int ANSI89_EXTERNALNAMELEN=6; @*/ # define ANSI89_EXTERNALNAMELEN 6 /*@constant int ANSI89_INTERNALNAMELEN=31; @*/ # define ANSI89_INTERNALNAMELEN 31 /*@constant int ANSI89_CONTROLNESTDEPTH=15; @*/ # define ANSI89_CONTROLNESTDEPTH 15 /*@constant int ANSI89_STRINGLITERALLEN=509; @*/ # define ANSI89_STRINGLITERALLEN 509 /*@constant int ANSI89_INCLUDENEST=8; @*/ # define ANSI89_INCLUDENEST 8 /*@constant int ANSI89_NUMSTRUCTFIELDS=127; @*/ # define ANSI89_NUMSTRUCTFIELDS 127 /*@constant int ANSI89_NUMENUMMEMBERS=127; @*/ # define ANSI89_NUMENUMMEMBERS 127 /* ** From ISO C99 5.2.4.1 */ /*@constant int ISO99_EXTERNALNAMELEN=31; @*/ # define ISO99_EXTERNALNAMELEN 31 /*@constant int ISO99_INTERNALNAMELEN=63; @*/ # define ISO99_INTERNALNAMELEN 63 /*@constant int ISO99_CONTROLNESTDEPTH=63; @*/ # define ISO99_CONTROLNESTDEPTH 63 /*@constant int ISO99_STRINGLITERALLEN=4095; @*/ # define ISO99_STRINGLITERALLEN 4095 /*@constant int ISO99_INCLUDENEST=63; @*/ # define ISO99_INCLUDENEST 63 /*@constant int ISO99_NUMSTRUCTFIELDS=1023 @*/ # define ISO99_NUMSTRUCTFIELDS 1023 /*@constant int ISO99_NUMENUMMEMBERS=1023 @*/ # define ISO99_NUMENUMMEMBERS 1023 /*@constant int DEFAULT_LIMIT=-1; @*/ # define DEFAULT_LIMIT -1 /* unlimited messages */ /*@constant char PFX_UPPERCASE; @*/ # define PFX_UPPERCASE '^' /*@constant char PFX_LOWERCASE; @*/ # define PFX_LOWERCASE '&' /*@constant char PFX_ANY; @*/ # define PFX_ANY '?' /*@constant char PFX_DIGIT; @*/ # define PFX_DIGIT '#' /*@constant char PFX_NOTUPPER; @*/ # define PFX_NOTUPPER '%' /*@constant char PFX_NOTLOWER; @*/ # define PFX_NOTLOWER '~' /*@constant char PFX_ANYLETTER; @*/ # define PFX_ANYLETTER '$' /*@constant char PFX_ANYLETTERDIGIT; @*/ # define PFX_ANYLETTERDIGIT '/' /* ** _Bool is defined by ISO C99 (replaced old lltx_Bool) */ /*@constant observer char *DEFAULT_BOOLTYPE;@*/ # define DEFAULT_BOOLTYPE "_Bool" /*@constant observer char *PRAGMA_EXPAND; @*/ # define PRAGMA_EXPAND "expand" /*@constant int PRAGMA_LEN_EXPAND=6; @*/ # define PRAGMA_LEN_EXPAND 6 /*@constant int MAX_PRAGMA_LEN; @*/ # define MAX_PRAGMA_LEN PRAGMA_LEN_EXPAND /* ** Flex doesn't pre-process input, so remember to copy these manually ** to cscanner.l. */ /*@constant observer char *BEFORE_COMMENT_MARKER@*/ # define BEFORE_COMMENT_MARKER "%{" /*@constant observer char *AFTER_COMMENT_MARKER@*/ # define AFTER_COMMENT_MARKER "%}" # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtgrammar.h0000644021234200000250000000052607630463447015765 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtgrammar.h */ # ifndef MTGRAMMAR_H # define MTGRAMMAR_H # include "mtgrammar_tokens.h" /*@-declundef@*/ extern int mtparse (void); /*@=declundef@*/ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtDeclarationPieces.h0000644021234200000250000000262507630463447017717 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtDeclarationPieces.h */ # ifndef mtDeclarationPieces_H # define mtDeclarationPieces_H struct s_mtDeclarationPieces { mtDeclarationPiece thisPiece; /*@null@*/ mtDeclarationPieces rest; } ; /* mtDeclarationPieces defined in forwardTypes.h */ /*@constant null mtDeclarationPieces mtDeclarationPieces_undefined; @*/ # define mtDeclarationPieces_undefined NULL extern /*@falsewhennull@*/ bool mtDeclarationPieces_isDefined(mtDeclarationPieces) /*@*/ ; # define mtDeclarationPieces_isDefined(p_h) ((p_h) != mtDeclarationPieces_undefined) extern /*@nullwhentrue@*/ bool mtDeclarationPieces_isUndefined(mtDeclarationPieces) /*@*/ ; # define mtDeclarationPieces_isUndefined(p_h) ((p_h) == mtDeclarationPieces_undefined) extern mtDeclarationPieces mtDeclarationPieces_create (void) /*@*/ ; extern /*@only@*/ mtDeclarationPieces mtDeclarationPieces_append (/*@only@*/ mtDeclarationPieces p_node, /*@only@*/ mtDeclarationPiece) /*@modifies p_node*/ ; extern /*@exposed@*/ mtDeclarationPiece mtDeclarationPieces_findPiece (mtDeclarationPieces, mtPieceKind) /*@*/ ; extern cstring mtDeclarationPieces_unparse (mtDeclarationPieces p_node) /*@*/ ; extern void mtDeclarationPieces_free (/*@only@*/ mtDeclarationPieces p_node) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/constDeclarationNode.h0000644021234200000250000000053107630463445020072 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { lclTypeSpecNode type; initDeclNodeList decls; } *constDeclarationNode; extern /*@unused@*/ /*@only@*/ cstring constDeclarationNode_unparse (/*@null@*/ constDeclarationNode p_x); splint-3.1.2.dfsg1/src/Headers/mtDefaultsDecl.h0000644021234200000250000000177707630463447016707 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtDefaultsDecl.h */ # ifndef mtDefaultsDecl_H # define mtDefaultsDecl_H struct s_mtDefaultsDecl { mtContextNode context; cstring value; fileloc loc; } ; extern cstring mtDefaultsDecl_unparse (mtDefaultsDecl p_node) /*@*/ ; extern mtDefaultsDecl mtDefaultsDecl_create (/*@only@*/ mtContextNode p_context, /*@only@*/ mttok p_value) /*@*/ ; extern /*@observer@*/ fileloc mtDefaultsDecl_getLoc (mtDefaultsDecl) /*@*/ ; # define mtDefaultsDecl_getLoc(p_dd) ((p_dd)->loc) extern /*@observer@*/ mtContextNode mtDefaultsDecl_getContext (mtDefaultsDecl) /*@*/ ; # define mtDefaultsDecl_getContext(p_dd) ((p_dd)->context) extern /*@observer@*/ cstring mtDefaultsDecl_getValue (mtDefaultsDecl) /*@*/ ; # define mtDefaultsDecl_getValue(p_dd) ((p_dd)->value) extern void mtDefaultsDecl_free (/*@only@*/ mtDefaultsDecl) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/constraintExprData.h0000644021234200000250000000624107671271605017611 0ustar fax#ifndef __constraintExprData_h__ #define __constraintExprData_h__ typedef enum { BINARYOP_UNDEFINED, BINARYOP_PLUS, BINARYOP_MINUS } constraintExprBinaryOpKind; typedef enum { UNARYOP_UNDEFINED, MAXSET, MINSET, MAXREAD, MINREAD } constraintExprUnaryOpKind; typedef struct constraintExprBinaryOp_ { constraintExpr expr1; constraintExprBinaryOpKind binaryOp; constraintExpr expr2; } constraintExprBinaryOp; typedef struct constraintExprUnaryOp_ { constraintExpr expr; constraintExprUnaryOpKind unaryOp; } constraintExprUnaryOp; typedef union constraintExprData { constraintExprBinaryOp binaryOp; constraintExprUnaryOp unaryOp; constraintTerm term; } *constraintExprData; extern /*@falsewhennull@*/ bool constraintExprData_isDefined (/*@temp@*/ /*@observer@*/ /*@reldef@*/ constraintExprData p_e) /*@*/ ; # define constraintExprData_isDefined(e) ((e) != NULL) extern void constraintExprData_freeBinaryExpr (/*@only@*/ constraintExprData) ; extern void constraintExprData_freeUnaryExpr (/*@only@*/ constraintExprData) ; extern void constraintExprData_freeTerm (/*@only@*/ constraintExprData) ; extern constraintExprData constraintExprData_termSetTerm ( /*@returned@*/ /*@partial@*/ constraintExprData p_data, /*@only@*/ constraintTerm p_term); extern /*@exposed@*/ constraintTerm constraintExprData_termGetTerm (/*@observer@*/ constraintExprData p_data) /*@*/; extern constraintExprUnaryOpKind constraintExprData_unaryExprGetOp (/*@observer@*/ /*@reldef@*/ constraintExprData p_data) /*@*/; extern /*@observer@*/ constraintExpr constraintExprData_unaryExprGetExpr (/*@observer@*/ /*@reldef@*/constraintExprData p_data) /*@*/; extern constraintExprData constraintExprData_unaryExprSetOp (/*@partial@*/ /*@returned@*/ constraintExprData p_data, constraintExprUnaryOpKind p_op); extern constraintExprData constraintExprData_unaryExprSetExpr (/*@partial@*/ /*@returned@*/ constraintExprData p_data, /*@only@*/ constraintExpr p_expr); extern constraintExprBinaryOpKind constraintExprData_binaryExprGetOp (/*@partial@*/constraintExprData p_data) /*@*/; extern /*@observer@*/ constraintExpr constraintExprData_binaryExprGetExpr1 (/*@observer@*/ /*@reldef@*/constraintExprData p_data)/*@*/; extern /*@observer@*/ constraintExpr constraintExprData_binaryExprGetExpr2 (/*@observer@*/ /*@reldef@*/constraintExprData p_data)/*@*/; extern constraintExprData constraintExprData_binaryExprSetExpr1 (/*@partial@*/ /*@returned@*/ constraintExprData p_data, /*@only@*/ constraintExpr p_expr) ; extern constraintExprData constraintExprData_binaryExprSetExpr2 (/*@partial@*/ /*@returned@*/ constraintExprData p_data, /*@only@*/ constraintExpr p_expr); extern constraintExprData constraintExprData_binaryExprSetOp (/*@partial@*/ /*@returned@*/ /*@out@*/constraintExprData p_data, constraintExprBinaryOpKind p_op); extern /*@only@*/ constraintExprData constraintExprData_copyBinaryExpr(/*@observer@*/ constraintExprData p_data); extern /*@only@*/ constraintExprData constraintExprData_copyUnaryExpr(/*@observer@*/ constraintExprData p_data); extern /*@only@*/ constraintExprData constraintExprData_copyTerm (/*@observer@*/ constraintExprData p_data); #else #error "Multiple Include" #endif splint-3.1.2.dfsg1/src/Headers/mtDefaultsDeclList.h0000644021234200000250000000451107651115037017520 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef mtDefaultsDeclLIST_H # define mtDefaultsDeclLIST_H /*:private:*/ typedef /*@only@*/ mtDefaultsDecl o_mtDefaultsDecl; struct s_mtDefaultsDeclList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_mtDefaultsDecl *elements; } ; /*@constant null mtDefaultsDeclList mtDefaultsDeclList_undefined;@*/ # define mtDefaultsDeclList_undefined ((mtDefaultsDeclList) NULL) extern /*@falsewhennull@*/ bool mtDefaultsDeclList_isDefined (mtDefaultsDeclList p_s) /*@*/ ; # define mtDefaultsDeclList_isDefined(s) ((s) != mtDefaultsDeclList_undefined) extern int mtDefaultsDeclList_size (/*@sef@*/ mtDefaultsDeclList) /*@*/ ; # define mtDefaultsDeclList_size(s) (mtDefaultsDeclList_isDefined (s) ? (s)->nelements : 0) extern /*@unused@*/ /*@falsewhennull@*/ bool mtDefaultsDeclList_empty (/*@sef@*/ mtDefaultsDeclList) /*@*/ ; # define mtDefaultsDeclList_empty(s) (mtDefaultsDeclList_size(s) == 0) extern cstring mtDefaultsDeclList_unparseSep (mtDefaultsDeclList p_s, cstring p_sep) /*@*/ ; extern /*@unused@*/ /*@only@*/ mtDefaultsDeclList mtDefaultsDeclList_new (void) /*@*/ ; extern /*@only@*/ mtDefaultsDeclList mtDefaultsDeclList_single (/*@keep@*/ mtDefaultsDecl p_el) /*@*/ ; extern mtDefaultsDeclList mtDefaultsDeclList_add (/*@returned@*/ mtDefaultsDeclList p_s, /*@keep@*/ mtDefaultsDecl p_el) /*@modifies p_s@*/ ; extern mtDefaultsDeclList mtDefaultsDeclList_prepend (/*@only@*/ mtDefaultsDeclList p_s, /*@keep@*/ mtDefaultsDecl p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring mtDefaultsDeclList_unparse (mtDefaultsDeclList p_s) ; extern void mtDefaultsDeclList_free (/*@only@*/ mtDefaultsDeclList p_s) ; /*@constant int mtDefaultsDeclListBASESIZE;@*/ # define mtDefaultsDeclListBASESIZE MIDBASESIZE /*@iter mtDefaultsDeclList_elements (sef mtDefaultsDeclList x, yield exposed mtDefaultsDecl el); @*/ # define mtDefaultsDeclList_elements(x, m_el) \ { if (mtDefaultsDeclList_isDefined (x)) { \ int m_ind; mtDefaultsDecl *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { mtDefaultsDecl m_el = *(m_elements++); # define end_mtDefaultsDeclList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/constraintExpr.h0000644021234200000250000001302507671022271017006 0ustar fax#ifndef __constraintExpr_h__ #define __constraintExpr_h__ typedef enum { binaryexpr, unaryExpr, term } constraintExprKind; struct s_constraintExpr { constraintExprKind kind; bool ct; /*changed type */ ctype origType; constraintExprData data; }; /*@constant null constraintExpr constraintExpr_undefined; @*/ # define constraintExpr_undefined ((constraintExpr)NULL) extern /*@falsewhennull@*/ bool constraintExpr_isDefined (constraintExpr p_e) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool constraintExpr_isUndefined (constraintExpr p_e) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool constraintExpr_isError (constraintExpr p_e) /*@*/ ; # define constraintExpr_isDefined(e) ((e) != constraintExpr_undefined) # define constraintExpr_isUndefined(e) ((e) == constraintExpr_undefined) # define constraintExpr_isError(e) ((e) == constraintExpr_undefined) void constraintExpr_free ( /*@only@*/ constraintExpr p_expr); constraintExpr constraintExpr_setFileloc (/*@returned@*/ constraintExpr p_c, fileloc p_loc) /*@modifies p_c@*/; constraintExpr constraintExpr_copy (constraintExpr p_expr) /*@*/; /*@only@*/ cstring constraintExpr_unparse (/*@temp@*/ /*@observer@*/ constraintExpr p_ex) /*@*/; extern cstring constraintExpr_print (constraintExpr p_expr) /*@*/; bool constraintExpr_similar (constraintExpr p_expr1, constraintExpr p_expr2) /*@*/; bool constraintExpr_same (constraintExpr p_expr1, constraintExpr p_expr2) /*@*/; /*@only@*/ constraintExpr constraintExpr_searchandreplace (/*@only@*/ /*@unique@*/ constraintExpr p_c, /*@temp@*/ /*@observer@*/ constraintExpr p_old, /*@temp@*/ /*@observer@*/ constraintExpr p_newExpr ) /*@modifies p_c@*/; bool constraintExpr_canGetValue (constraintExpr p_expr) /*@*/; long constraintExpr_getValue (constraintExpr p_expr) /*@*/; int constraintExpr_compare (constraintExpr p_expr1, constraintExpr p_expr2) /*@*/; /* constraintExpr constraintExpr_makeValueInt (int i); */ /*@only@*/ /*@notnull@*/constraintExpr constraintExpr_makeIntLiteral (long p_i); /*@only@*/ constraintExpr constraintExpr_makeValueExpr (/*@exposed@*/ exprNode p_expr); /*@only@*/ constraintExpr constraintExpr_makeMaxSetExpr (/*@exposed@*/ exprNode p_expr); /*@only@*/ constraintExpr constraintExpr_makeMaxReadExpr (/*@exposed@*/ exprNode p_expr); /*@only@*/ constraintExpr constraintExpr_makeIncConstraintExpr (/*@only@*/ constraintExpr p_expr); /*@only@*/ constraintExpr constraintExpr_makeDecConstraintExpr (/*@only@*/ constraintExpr p_expr); /*@only@*/ constraintExpr constraintExpr_simplify (/*@only@*/ constraintExpr p_c); /*@only@*/ constraintExpr constraintExpr_solveBinaryExpr (constraintExpr p_lexpr, /*@only@*/ constraintExpr p_expr) /*@modifies p_lexpr, p_expr @*/; bool constraintExpr_search (/*@observer@*/ /*@temp@*/ constraintExpr p_c, /*@observer@*/ /*@temp@*/ constraintExpr p_old); /*@only@*/ fileloc constraintExpr_loc (constraintExpr p_expr); /*@only@*/ constraintExpr constraintExpr_makeSRefMaxset ( /*@temp@*/ /*@observer@*/ sRef p_s); /*@only@*/ constraintExpr constraintExpr_makeSRefMaxRead(/*@temp@*/ /*@observer@*/ sRef p_s); /*@only@*/ constraintExpr constraintExpr_makeTermsRef (/*@temp@*/ sRef p_s); constraintExpr constraintExpr_doSRefFixBaseParam ( /*@returned@*/ constraintExpr p_expr, exprNodeList p_arglist); /*@only@*/ constraintExpr constraintExpr_makeExprNode (/*@dependent@*/ exprNode p_e); /*@only@*/ constraintExpr constraintExpr_doFixResult (/*@only@*/ constraintExpr p_expr, /*@observer@*/ exprNode p_fcnCall); /*@falsewhennull@*/ bool constraintExpr_isLit (constraintExpr p_expr) /*@*/ ; /*@only@*/ constraintExpr constraintExpr_makeAddExpr (/*@only@*/ constraintExpr p_expr, /*@only@*/ constraintExpr p_addent); /*@only@*/ constraintExpr constraintExpr_makeSubtractExpr (/*@only@*/ constraintExpr p_expr, /*@only@*/ constraintExpr p_addent); /*@only@*/ constraintExpr constraintExpr_parseMakeUnaryOp (lltok p_op,/*@only@*/ constraintExpr p_cexpr); constraintExpr constraintExpr_parseMakeBinaryOp (/*@only@*/ constraintExpr p_expr1, lltok p_op, /*@only@*/ constraintExpr p_expr2); bool constraintExpr_hasMaxSet (/*@observer@*/ /*@temp@*/ constraintExpr p_expr); /*@only@*/ constraintExpr constraintExpr_doSRefFixConstraintParam (/*@returned@*/ /*@only@*/ constraintExpr p_expr, exprNodeList p_arglist) /*@modifies p_expr@*/; /*@only@*/ constraintExpr constraintExpr_propagateConstants (/*@only@*/ constraintExpr p_expr, /*@out@*/ bool * p_propagate, /*@out@*/ int *p_literal); /*@falsewhennull@*/ bool constraintExpr_isBinaryExpr (/*@observer@*/ /*@temp@*/ constraintExpr p_c) /*@*/ ; extern void constraintExpr_dump (/*@observer@*/ /*@temp@*/ constraintExpr p_expr, FILE *p_f); extern /*@only@*/ constraintExpr constraintExpr_undump (FILE *p_f); extern /*@only@*/ constraintExpr constraintExpr_makeTermExprNode (/*@exposed@*/ exprNode p_e) ; /* drl added 8/8/001*/ bool constraintExpr_isTerm (/*@observer@*/ /*@temp@*/ constraintExpr p_c); /* drl added 8/8/001*/ /*@observer@*/ /*@temp@*/ constraintTerm constraintExpr_getTerm ( /*@temp@*/ /*@observer@*/ constraintExpr p_c); /* drl added 8/8/001*/ int constraintExpr_getDepth (/*@observer@*/ /*@temp@*/ constraintExpr p_ex); /*drl 1/6/2001: I didn't think these functions were solid enough to include in the stable release of splint.*/ /* drl added 12/30/001*/ /* extern / *@only@* / constraintExpr constraintExpr_doSRefFixInvarConstraint (/ *@only@* / constraintExpr p_expr, sRef p_s, ctype p_ct); */ /*drl added 12/19 */ bool constraintExpr_isConstantOnly ( constraintExpr p_e ); #else # error "Multiple include" #endif splint-3.1.2.dfsg1/src/Headers/mtDefaultsNode.h0000644021234200000250000000132407630463447016711 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtDefaultsNode.h */ # ifndef MTDEFAULTSNODE_H # define MTDEFAULTSNODE_H struct s_mtDefaultsNode { mtDefaultsDeclList decls; fileloc loc; } ; extern mtDefaultsNode mtDefaultsNode_create (/*@only@*/ mttok, /*@only@*/ mtDefaultsDeclList) /*@*/ ; extern void mtDefaultsNode_free (/*@only@*/ mtDefaultsNode) ; extern /*@observer@*/ mtDefaultsDeclList mtDefaultsNode_getDecls (mtDefaultsNode) /*@*/ ; # define mtDefaultsNode_getDecls(n) ((n)->decls) extern cstring mtDefaultsNode_unparse (mtDefaultsNode p_node) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/constraint.h0000644021234200000250000001704207671271605016161 0ustar fax#ifndef __constraint_h__ #define __constraint_h__ typedef enum { LT, LTE, GT, GTE, EQ, NONNEGATIVE, POSITIVE, } arithType; struct s_constraint { arithType ar; constraint orig; constraint or; bool fcnPre; constraintExpr lexpr; constraintExpr expr; bool post; /*@exposed@*/ /*@dependent@*/ exprNode generatingExpr; } ; /*@constant null constraint constraint_undefined; @*/ # define constraint_undefined ((constraint)NULL) extern /*@falsewhennull@*/ bool constraint_isDefined (constraint p_e) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool constraint_isUndefined (constraint p_e) /*@*/ ; extern /*@nullwhentrue@*/ /*@unused@*/ bool constraint_isError (constraint p_e) /*@*/ ; # define constraint_isDefined(e) ((e) != constraint_undefined) # define constraint_isUndefined(e) ((e) == constraint_undefined) # define constraint_isError(e) ((e) == constraint_undefined) extern void constraint_free (/*@only@*/ constraint p_c); /* constraint makeConstraintParse (sRef x, lltok relOp, exprNode cconstant); */ /*@-czechfcns*/ extern constraint constraint_makeReadSafeExprNode (/*@observer@*/ exprNode p_po, /*@observer@*/ exprNode p_ind); extern /*@only@*/ constraint constraint_makeWriteSafeExprNode (/*@observer@*/ exprNode p_po, /*@observer@*/ exprNode p_ind); extern /*@only@*/ constraint constraint_makeReadSafeInt (/*@observer@*/ exprNode p_t1, int p_index); extern /*@only@*/ constraint constraint_makeEnsureMaxReadAtLeast (/*@observer@*/ exprNode p_t1, /*@observer@*/ exprNode p_t2, fileloc p_sequencePoint); extern void constraint_overWrite (constraint p_c1, /*@observer@*/ constraint p_c2) /*@modifies p_c1 @*/; extern /*@only@*/ constraint constraint_copy (/*@temp@*/ constraint p_c); extern bool fileloc_closer (/*@observer@*/ fileloc p_loc1, /*@observer@*/ fileloc p_loc2, /*@observer@*/ fileloc p_loc3) /*@*/; extern /*@only@*/ cstring arithType_print (arithType p_ar) /*@*/; extern /*@only@*/ fileloc constraint_getFileloc (constraint p_c); extern /*@only@*/ cstring constraint_unparse (/*@temp@*/ constraint p_c) /*@*/; extern /*@only@*/ cstring constraint_unparseOr (/*@temp@*/ constraint p_c) /*@*/ ; extern /*@only@*/ cstring constraint_unparseDetailed (constraint p_c) /*@*/ ; extern /*@only@*/ constraint constraint_makeWriteSafeInt (/*@dependent@*/ /*@observer@*/ exprNode p_po, int p_ind); extern exprNode exprNode_copyConstraints (/*@returned@*/ exprNode p_dst, exprNode p_src) /*@modifies p_dst @*/; extern /*@only@*/ constraint constraint_makeEnsureEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostIncrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint); extern constraint constraint_preserveOrig (/*@returned@*/ constraint p_c) /*@modifies p_c @*/; extern /*@only@*/ constraint constraint_doSRefFixBaseParam (/*@returned@*/ /*@only@*/ constraint p_precondition, exprNodeList p_arglist); extern /*@only@*/ constraint constraint_makeEnsureLessThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); extern /*@only@*/ constraint constraint_makeEnsureLessThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); extern /*@only@*/ constraint constraint_makeEnsureGreaterThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); extern /*@only@*/ constraint constraint_makeEnsureGreaterThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); /*drl add 11/28/2000 */ extern /*@only@*/ constraint constraint_makeSRefWriteSafeInt (sRef p_s, int p_ind); extern /*@unused@*/ /*@only@*/ constraint constraint_makeSRefReadSafeInt (sRef p_s, int p_ind); /*drl add 11/26/2000 */ extern void constraint_printError (/*@observer@*/ /*@temp@*/ constraint p_c, /*@temp@*/ /*@observer@*/ fileloc p_loc); extern /*@only@*/ constraint constraint_doSRefFixConstraintParam (constraint p_precondition, /*@temp@*/ /*@observer@*/ exprNodeList p_arglist); extern /*@only@*/ constraint constraint_makeSRefSetBufferSize (sRef p_s, long int p_size); extern /*@only@*/ constraint constraint_doFixResult (constraint p_postcondition, /*@dependent@*/ /*@observer@*/ exprNode p_fcnCall); extern /*@only@*/ constraint constraint_makeEnsureLteMaxRead(/*@dependent@*/ /*@observer@*/ exprNode p_index, /*@dependent@*/ /*@observer@*/ exprNode p_buffer); extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostDecrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint); extern bool constraint_search (constraint p_c, constraintExpr p_old); extern /*@only@*/ constraint makeConstraintParse3 (constraintExpr p_l, lltok p_relOp, constraintExpr p_r); extern constraint constraint_addGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@exposed@*/ exprNode p_e); extern bool constraint_hasMaxSet(constraint p_c); /*from constraintGenreation.c*/ extern void exprNode_exprTraverse (exprNode p_e, bool p_definatelv, bool p_definaterv, /*@temp@*/ /*@observer@*/ fileloc p_sequencePoint); extern /*@only@*/ constraintList exprNode_traverseRequiresConstraints (exprNode p_e); extern /*@only@*/ constraintList exprNode_traverseEnsuresConstraints (exprNode p_e); extern constraint constraint_togglePost (/*@returned@*/ constraint p_c); extern bool constraint_same (constraint p_c1, constraint p_c2) ; extern void constraint_printErrorPostCondition (constraint p_c, fileloc p_loc) ; extern cstring constraint_printLocation (/*@observer@*/ /*@temp@*/ constraint p_c) /*@*/; /*drl add 8-11-001*/ extern constraint constraint_setFcnPre (/*@returned@*/ constraint p_c) ; extern constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@observer@*/ exprNode p_e) ; extern bool /*@alt void@*/ exprNode_generateConstraints (/*@temp@*/ exprNode p_e) ; constraint constraint_togglePostOrig (/*@returned@*/ constraint p_c); bool constraint_hasOrig( /*@observer@*/ /*@temp@*/ constraint p_c); constraint constraint_makeAddAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint); constraint constraint_makeSubtractAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint); /*@only@*/ constraint constraint_undump (FILE * p_f); void constraint_dump (/*@observer@*/ constraint p_c, FILE * p_f); extern void exprNode_forLoopHeuristics( /*@dependent@*/ exprNode p_e, /*@dependent@*/ exprNode p_forPred, /*@dependent@*/ exprNode p_forBody); int constraint_compare (/*@observer@*/ /*@temp@*/ const constraint * p_c1, /*@observer@*/ /*@temp@*/ const constraint * p_c2) /*@*/; bool constraint_isPost (/*@observer@*/ /*@temp@*/ constraint p_c); bool constraint_tooDeep (/*@observer@*/ /*@temp@*/ constraint p_c); void exprNode_findValue( exprNode p_e); /*drl 1/6/2001: I didn't think these functions were solid enough to include in the stable release of splint.*/ /*drl added 12/30/01 */ /* extern / *@only@* / constraint constraint_doSRefFixInvarConstraint(constraint p_invar, sRef p_s, ctype p_ct ); */ /*drl added 12/19 */ bool constraint_isConstantOnly (constraint p_c); /*@=czechfcns*/ /* drl possible problem : warning take this out */ #include "constraintResolve.h" #include "constraintOutput.h" #else #error Multiple include #endif splint-3.1.2.dfsg1/src/Headers/constraintList2.h0000644021234200000250000000551407415477017017101 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000. ** See ../LICENSE for license information. */ # ifndef constraintLIST_H # define constraintLIST_H typedef /*@only@*/ constraint o_constraint; struct _constraintList { int nelements; int nspacehigh; int nspacelow; int current; /*@dependent@*/ /*@reldef@*/ /*@relnull@*/ o_constraint *elements; /*@only@*/ /*@reldef@*/ /*@relnull@*/ o_constraint *elementsroot; } ; /*@iter constraintList_elements (sef constraintList x, yield exposed constraint el); @*/ # define constraintList_elements(x, m_el) \ { int m_ind; constraint *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { constraint m_el = *(m_elements++); # define end_constraintList_elements }} extern int constraintList_size (/*@sef@*/ constraintList); # define constraintList_size(s) (constraintList_isDefined (s) ? (s)->nelements : 0) extern bool constraintList_empty (/*@sef@*/ constraintList); # define constraintList_empty(s) (constraintList_size(s) == 0) extern /*@falsewhennull@*/ bool constraintList_isDefined (constraintList p_t); # define constraintList_isDefined(s) ((s) != (constraintList) 0) extern /*@only@*/ constraintList constraintList_makeNew(void); extern constraintList constraintList_push (/*@returned@*/ constraintList p_s, /*@keep@*/ constraint p_el) ; extern void constraintList_addh (constraintList p_s, /*@keep@*/ constraint p_el) ; extern void constraintList_addl (constraintList p_s, /*@keep@*/ constraint p_el) ; extern void constraintList_reset (constraintList p_s) /*@modifies p_s@*/ ; extern void constraintList_finish (constraintList p_s) /*@modifies p_s@*/ ; extern void constraintList_advance (constraintList p_s) /*@modifies p_s@*/ ; extern /*@exposed@*/ constraint constraintList_getN (constraintList p_s, int p_n) /*@*/ ; # if 0 extern /*@only@*/ cstring constraintList_unparse (constraintList p_s) ; extern /*@only@*/ cstring constraintList_unparseTail (constraintList p_s); extern /*@only@*/ cstring constraintList_unparseToCurrent (constraintList p_s); extern /*@only@*/ cstring constraintList_unparseSecondToCurrent (constraintList p_s); # endif extern void constraintList_free (/*@only@*/ constraintList p_s) ; extern /*@exposed@*/ constraint constraintList_head (constraintList p_s) ; extern /*@exposed@*/ constraint constraintList_current (constraintList p_s) ; extern /*@only@*/ constraintList constraintList_copy (constraintList p_s) ; /*@constant int constraintListGROWLOW;@*/ # define constraintListGROWLOW 4 /* addl used in abstract.c */ /*@constant int constraintListGROWHI;@*/ # define constraintListGROWHI 4 /*@constant int constraintListBASESIZE;@*/ # define constraintListBASESIZE (constraintListGROWLOW + constraintListGROWHI) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtgrammar.tab.h0000644021234200000250000000013707320411553016513 0ustar faxtypedef union { lltok ltok; /* a leaf is also an ltoken */ } YYSTYPE; #define MT_STATE 257 splint-3.1.2.dfsg1/src/Headers/constraintList.h0000644021234200000250000001140607671271605017013 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000. ** See ../LICENSE for license information. */ # ifndef constraintLIST_H # define constraintLIST_H typedef /*@only@*/ /*@notnull@*/ constraint o_constraint; struct s_constraintList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_constraint *elements; } ; /*@constant null constraintList constraintList_undefined;@*/ # define constraintList_undefined ((constraintList)NULL) extern /*@falsewhennull@*/ bool constraintList_isDefined (constraintList p_e) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool constraintList_isUndefined (constraintList p_e) /*@*/ ; extern /*@nullwhentrue@*/ /*@unused@*/ bool constraintList_isError (constraintList p_e) /*@*/ ; # define constraintList_isDefined(e) ((e) != constraintList_undefined) # define constraintList_isUndefined(e) ((e) == constraintList_undefined) # define constraintList_isError(e) ((e) == constraintList_undefined) extern bool constraintList_isEmpty (/*@sef@*/ constraintList p_e) /*@*/; # define constraintList_isEmpty(e) ((constraintList_isUndefined((e)) ) ||(( (e)->nelements == 0) ) ) extern constraintList constraintList_single (/*@only@*/ constraint) ; extern constraintList constraintList_addListFree (/*@returned@*/ constraintList, /*@only@*/ constraintList) ; extern constraintList constraintList_preserveCallInfo (/*@returned@*/ constraintList p_c, /*@observer@*/ /*@dependent@*/ exprNode p_fcn) ; /*@iter constraintList_elements (sef constraintList x, yield exposed constraint el); @*/ # define constraintList_elements(x, m_el) \ { if (constraintList_isDefined (x)) { int m_ind; constraint *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { constraint m_el = *(m_elements++); # define end_constraintList_elements }}} extern /*@only@*/ constraintList constraintList_makeNew(void) /*@*/; extern constraintList constraintList_add (/*@returned@*/ constraintList p_s, /*@only@*/ constraint p_el) /*@modifies p_s@*/ ; extern /*@only@*/ constraintList constraintList_addList (/*@only@*/ /*@returned@*/ constraintList p_s, /*@observer@*/ /*@temp@*/ constraintList p_newList) /*@modifies p_s@*/ ; extern constraintList constraintList_copy ( /*@observer@*/ /*@temp@*/ constraintList p_s) /*@*/ ; extern void constraintList_free (/*@only@*/ constraintList p_s) ; extern /*@only@*/ cstring constraintList_unparse (/*@observer@*/ constraintList p_s) /*@*/; extern cstring constraintList_unparseDetailed (/*@observer@*/ constraintList p_s) /*@*/; extern /*@only@*/ constraintList constraintList_logicalOr ( /*@observer@*/ constraintList p_l1, /*@observer@*/ constraintList p_l2); extern constraintList constraintList_preserveOrig (/*@returned@*/ constraintList p_c); /*@constant int constraintListBASESIZE;@*/ # define constraintListBASESIZE SMALLBASESIZE extern /*@only@*/ constraintList constraintList_doSRefFixBaseParam ( constraintList p_preconditions, /*@temp@*/ /*@observer@*/ exprNodeList p_arglist) /*@modifies p_preconditions@*/; extern constraintList constraintList_togglePost (/*@returned@*/ constraintList p_c) /*@modifies p_c@*/; extern /*@only@*/ constraintList constraintList_doSRefFixConstraintParam ( /*@only@*/ constraintList p_preconditions, /*@observer@*/ /*@temp@*/ exprNodeList p_arglist) /*@modifies p_preconditions@*/; extern constraintList exprNode_getPostConditions (/*@dependent@*/ /*@observer@*/ exprNode p_fcn, exprNodeList p_arglist, /*@dependent@*/ /*@observer@*/ exprNode p_fcnCall) /*@*/; /*@only@*/ constraintList constraintList_doFixResult ( /*@only@*/ constraintList p_postconditions, /*@observer@*/ /*@dependent@*/ exprNode p_fcnCall) /*@modifies p_postconditions@*/; extern constraintList constraintList_addGeneratingExpr (/*@returned@*/ constraintList p_c, /*@dependent@*/ /*@observer@*/ exprNode p_e) /*@modifies p_c@*/; extern /*@only@*/ constraintList constraintList_makeFixedArrayConstraints ( /*@observer@*/ sRefSet p_s) ; extern void constraintList_printErrorPostConditions (constraintList p_s, fileloc p_loc) ; extern void constraintList_printError (constraintList p_s, /*@observer@*/ fileloc p_loc) ; extern constraintList constraintList_sort (/*@returned@*/ constraintList p_ret) /*@modifies p_ret@*/ ; extern void constraintList_dump (/*@observer@*/ constraintList p_c, FILE * p_f); /*@only@*/ constraintList constraintList_undump (FILE * p_f); /*@only@*/ constraintList constraintList_removeSurpressed (/*@only@*/ constraintList p_s); /*drl 1/6/2001: I didn't think these functions were solid enough to include in the stable release of splint.*/ /*drl added 12/30/01 */ /* / *@only@* / constraintList constraintList_doSRefFixStructConstraint(constraintList p_invars, sRef p_s, ctype p_ct ); */ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtgrammar_tokens.h0000644021234200000250000000737310102766474017351 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /* < end of bison.head > */ #ifndef BISON_MTGRAMMAR_TAB_H # define BISON_MTGRAMMAR_TAB_H #ifndef YYSTYPE typedef union { mttok tok; mtDeclarationNode mtdecl; mtDeclarationPiece mtpiece; mtDeclarationPieces mtpieces; mtContextNode mtcontext; mtValuesNode mtvalues; mtDefaultsNode mtdefaults; mtDefaultsDeclList mtdeflist; mtAnnotationsNode mtannotations; mtAnnotationList mtannotlist; mtAnnotationDecl mtannotdecl; mtMergeNode mtmerge; mtMergeItem mtmergeitem; mtMergeClauseList mtmergeclauselist; mtMergeClause mtmergeclause; mtTransferClauseList mttransferclauselist; mtTransferClause mttransferclause; mtTransferAction mttransferaction; mtLoseReferenceList mtlosereferencelist; mtLoseReference mtlosereference; pointers pointers; /*@only@*/ cstringList cstringlist; ctype ctyp; /*@only@*/ qtype qtyp; qual qual; qualList quals; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif # define MT_BADTOK 257 # define MT_END 258 # define MT_STATE 259 # define MT_GLOBAL 260 # define MT_CONTEXT 261 # define MT_ONEOF 262 # define MT_DEFAULTS 263 # define MT_DEFAULT 264 # define MT_REFERENCE 265 # define MT_PARAMETER 266 # define MT_RESULT 267 # define MT_CLAUSE 268 # define MT_LITERAL 269 # define MT_NULL 270 # define MT_ANNOTATIONS 271 # define MT_ARROW 272 # define MT_MERGE 273 # define MT_TRANSFERS 274 # define MT_PRECONDITIONS 275 # define MT_POSTCONDITIONS 276 # define MT_LOSEREFERENCE 277 # define MT_AS 278 # define MT_ERROR 279 # define MT_PLUS 280 # define MT_STAR 281 # define MT_BAR 282 # define MT_LPAREN 283 # define MT_RPAREN 284 # define MT_LBRACKET 285 # define MT_RBRACKET 286 # define MT_LBRACE 287 # define MT_RBRACE 288 # define MT_COMMA 289 # define MT_CHAR 290 # define MT_INT 291 # define MT_FLOAT 292 # define MT_DOUBLE 293 # define MT_VOID 294 # define MT_ANYTYPE 295 # define MT_INTEGRALTYPE 296 # define MT_UNSIGNEDINTEGRALTYPE 297 # define MT_SIGNEDINTEGRALTYPE 298 # define MT_CONST 299 # define MT_VOLATILE 300 # define MT_RESTRICT 301 # define MT_STRINGLIT 302 # define MT_IDENT 303 #endif /* not BISON_MTGRAMMAR_TAB_H */ /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ splint-3.1.2.dfsg1/src/Headers/constraintOutput.h0000644021234200000250000000000307310241116017347 0ustar fax splint-3.1.2.dfsg1/src/Headers/mtincludes.h0000644021234200000250000000174607327162470016145 0ustar fax# ifndef MTINCLUDES_H # define MTINCLUDES_H # include "mttok.h" # include "mtreader.h" # include "mtDeclarationNode.h" # include "mtDeclarationPiece.h" # include "mtDeclarationPieces.h" # include "mtContextNode.h" # include "mtValuesNode.h" # include "mtDefaultsNode.h" # include "mtDefaultsDecl.h" # include "mtDefaultsDeclList.h" # include "mtAnnotationsNode.h" # include "mtAnnotationList.h" # include "mtAnnotationDecl.h" # include "mtMergeNode.h" # include "mtTransferClauseList.h" # include "mtTransferClause.h" # include "mtLoseReferenceList.h" # include "mtLoseReference.h" # include "mtTransferAction.h" # include "mtMergeItem.h" # include "mtMergeClause.h" # include "mtMergeClauseList.h" # include "metaStateConstraint.h" # include "metaStateConstraintList.h" # include "metaStateSpecifier.h" # include "metaStateExpression.h" # include "metaStateInfo.h" # include "metaStateTable.h" # include "annotationInfo.h" # include "annotationTable.h" # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/constraintResolve.h0000644021234200000250000000423507340226451017511 0ustar fax extern /*@only@*/ constraintList constraintList_reflectChanges(/*@observer@*/ /*@temp@*/ constraintList p_pre2, /*@observer@*/ /*@temp@*/ constraintList p_post1); /* tries to resolve constraints in List p_pre2 using post1 */ /*@only@*/ extern constraintList constraintList_reflectChangesFreePre (/*@only@*/ constraintList p_pre2, /*@observer@*/ /*@temp@*/ constraintList p_post1); extern /*@only@*/ constraint constraint_substitute (/*@temp@*/ /*@observer@*/ constraint p_c, /*@temp@*/ /*@observer@*/ constraintList p_p); /* extern constraint constraint_searchandreplace (constraint p_c, constraintExpr old, constraintExpr new); */ extern bool constraintList_resolve (/*@temp@*/ /*@observer@*/ constraint p_c, /*@temp@*/ /*@observer@*/ constraintList p_p); extern constraint constraint_simplify ( /*@returned@*/ constraint p_c); extern /*@only@*/ constraintList constraintList_fixConflicts (constraintList p_list1, constraintList p_list2); extern constraintList constraintList_subsumeEnsures (constraintList p_list1, constraintList p_list2); extern constraintList constraintList_mergeEnsures (/*observer@*/ /*@temp@*/ constraintList p_list1, /*@observer@*/ /*@temp@*/ constraintList p_list2); /*@only@*/ constraintList constraintList_mergeEnsuresFreeFirst (/*@only@*/ constraintList p_list1, /*@observer@*/ /*@temp@*/ constraintList p_list2); bool constraint_isAlwaysTrue (/*@observer@*/ /*@temp@*/ constraint p_c); /*@only@*/ constraintList constraintList_mergeRequires (/*@observer@*/ /*@temp@*/ constraintList p_list1,/*@observer@*/ /*@temp@*/ constraintList p_list2); /*@only@*/ constraintList constraintList_mergeRequiresFreeFirst (/*@only@*/constraintList p_list1,/*@observer@*/ /*@temp@*/ constraintList p_list2); constraintList constraintList_reflectChangesOr (constraintList p_pre2, constraintList p_post1); /*@only@*/ constraintList constraintList_substitute (constraintList p_target, /*2observer@*/ constraintList p_subList); /*@only@*/ constraintList constraintList_substituteFreeTarget (/*@only@*/ constraintList p_target, /*@observer@*/ /*@temp@*/ constraintList p_subList); extern void exprNode_mergeResolve (exprNode p_parent, exprNode p_child1, exprNode p_child2); splint-3.1.2.dfsg1/src/Headers/mtLoseReference.h0000644021234200000250000000206507630463447017060 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtLoseReference.h */ # ifndef MTLoseReference_H # define MTLoseReference_H struct s_mtLoseReference { fileloc loc; cstring fromname; mtTransferAction action; } ; extern cstring mtLoseReference_unparse (mtLoseReference p_node) /*@*/ ; extern mtLoseReference mtLoseReference_create (/*@only@*/ mttok p_fromname, /*@only@*/ mtTransferAction p_action) /*@*/ ; extern /*@observer@*/ cstring mtLoseReference_getFrom (mtLoseReference) /*@*/ ; # define mtLoseReference_getFrom(p_trans) ((p_trans)->fromname) extern /*@observer@*/ mtTransferAction mtLoseReference_getAction (mtLoseReference) /*@*/ ; # define mtLoseReference_getAction(p_trans) ((p_trans)->action) extern /*@observer@*/ fileloc mtLoseReference_getLoc (mtLoseReference) /*@*/ ; # define mtLoseReference_getLoc(p_trans) ((p_trans)->loc) extern void mtLoseReference_free (/*@only@*/ mtLoseReference p_transfer) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/constraintTerm.h0000644021234200000250000000562207671022271017003 0ustar fax#ifndef __constraintTerm_h__ #define __constraintTerm_h__ typedef union { /*@exposed@*/ /*@dependent@*/ exprNode expr; /*@only@*/ sRef sref; long intlit; } constraintTermValue; typedef enum { CTT_ERRORBADCONSTRAINTTERMTYPE, CTT_EXPR, CTT_SREF, CTT_INTLITERAL } constraintTermType; struct s_constraintTerm { /*@only@*/ fileloc loc; constraintTermValue value; constraintTermType kind; } ; abst_typedef struct s_constraintTerm *constraintTerm; extern bool constraintTerm_isDefined (constraintTerm p_t) /*@*/ ; extern constraintTermType constraintTerm_getKind (constraintTerm) ; extern /*@exposed@*/ sRef constraintTerm_getSRef (constraintTerm) ; void constraintTerm_free (/*@only@*/ constraintTerm p_term); constraintTerm constraintTerm_simplify (/*@returned@*/ constraintTerm p_term) /*@modifies p_term@*/ ; /*@only@*/ constraintTerm constraintTerm_makeExprNode (/*@dependent@*/ exprNode p_e) /*@*/; constraintTerm constraintTerm_copy (constraintTerm p_term) /*@*/; bool constraintTerm_similar (constraintTerm p_term1, constraintTerm p_term2) /*@*/; extern bool constraintTerm_canGetValue (constraintTerm p_term)/*@*/; extern long constraintTerm_getValue (constraintTerm p_term) /*@*/; extern void constraintTerm_setValue (constraintTerm p_term, long p_value) /*@modifies p_term@*/; extern fileloc constraintTerm_getFileloc (constraintTerm p_t) /*@*/; extern bool constraintTerm_isIntLiteral (constraintTerm p_term) /*@*/; extern constraintTerm constraintTerm_makesRef (/*@temp@*/ /*@observer@*/ sRef p_s) /*@*/; /*@unused@*/ bool constraintTerm_probSame (constraintTerm p_term1, constraintTerm p_term2) /*@*/; constraintTerm constraintTerm_setFileloc (/*@returned@*/ constraintTerm p_term, fileloc p_loc) /*@modifies p_term@*/; constraintTerm constraintTerm_makeIntLiteral (long p_i) /*@*/; bool constraintTerm_isStringLiteral (constraintTerm p_c) /*@*/; cstring constraintTerm_getStringLiteral (constraintTerm p_c) /*@*/; constraintTerm constraintTerm_doSRefFixBaseParam (/*@returned@*/ constraintTerm p_term, exprNodeList p_arglist) /*@modifies p_term@*/; extern cstring constraintTerm_unparse (constraintTerm) /*@*/ ; extern void constraintTerm_dump ( /*@observer@*/ constraintTerm p_t, FILE * p_f); extern /*@only@*/ constraintTerm constraintTerm_undump ( FILE * p_f); extern bool constraintTerm_isInitBlock (/*@observer@*/ /*@temp@*/ constraintTerm p_c) /*@*/; extern int constraintTerm_getInitBlockLength (/*@observer@*/ /*@temp@*/ constraintTerm p_c) /*@*/; extern bool constraintTerm_isExprNode (/*@observer@*/ /*@temp@*/ constraintTerm p_c) /*@*/; extern ctype constraintTerm_getCType (constraintTerm p_term); extern /*@exposed@*/ exprNode constraintTerm_getExprNode (constraintTerm p_t); extern /*@exposed@*/ sRef constraintTerm_getsRef (constraintTerm p_t); /*drl added 12/19/2002*/ extern bool constraintTerm_isConstantOnly (constraintTerm p_term); #else #error "Multiple Include!" #endif splint-3.1.2.dfsg1/src/Headers/mtLoseReferenceList.h0000644021234200000250000000456307651115037017711 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef MTLoseReferenceLIST_H # define MTLoseReferenceLIST_H /*:private:*/ typedef /*@only@*/ mtLoseReference o_mtLoseReference; struct s_mtLoseReferenceList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_mtLoseReference *elements; } ; /*@constant null mtLoseReferenceList mtLoseReferenceList_undefined;@*/ # define mtLoseReferenceList_undefined ((mtLoseReferenceList) NULL) extern /*@falsewhennull@*/ bool mtLoseReferenceList_isDefined (mtLoseReferenceList p_s) /*@*/ ; # define mtLoseReferenceList_isDefined(s) ((s) != mtLoseReferenceList_undefined) extern int mtLoseReferenceList_size (/*@sef@*/ mtLoseReferenceList) /*@*/ ; # define mtLoseReferenceList_size(s) (mtLoseReferenceList_isDefined (s) ? (s)->nelements : 0) extern /*@unused@*/ /*@falsewhennull@*/ bool mtLoseReferenceList_empty (/*@sef@*/ mtLoseReferenceList) /*@*/ ; # define mtLoseReferenceList_empty(s) (mtLoseReferenceList_size(s) == 0) extern cstring mtLoseReferenceList_unparseSep (mtLoseReferenceList p_s, cstring p_sep) /*@*/ ; extern /*@unused@*/ /*@only@*/ mtLoseReferenceList mtLoseReferenceList_new (void) /*@*/ ; extern /*@only@*/ mtLoseReferenceList mtLoseReferenceList_single (/*@only@*/ mtLoseReference p_el) /*@*/ ; extern mtLoseReferenceList mtLoseReferenceList_add (/*@only@*/ mtLoseReferenceList p_s, /*@only@*/ mtLoseReference p_el) /*@modifies p_s@*/ ; extern mtLoseReferenceList mtLoseReferenceList_prepend (/*@only@*/ mtLoseReferenceList p_s, /*@only@*/ mtLoseReference p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring mtLoseReferenceList_unparse (mtLoseReferenceList p_s) ; extern void mtLoseReferenceList_free (/*@only@*/ mtLoseReferenceList p_s) ; /*@constant int mtLoseReferenceListBASESIZE;@*/ # define mtLoseReferenceListBASESIZE MIDBASESIZE /*@iter mtLoseReferenceList_elements (sef mtLoseReferenceList x, yield exposed mtLoseReference el); @*/ # define mtLoseReferenceList_elements(x, m_el) \ { if (mtLoseReferenceList_isDefined (x)) { \ int m_ind; mtLoseReference *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { mtLoseReference m_el = *(m_elements++); # define end_mtLoseReferenceList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/context.h0000644021234200000250000003520207706100771015451 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** context.h */ # ifndef CONTEXT_H # define CONTEXT_H extern void context_pushLoc (void); extern void context_popLoc (void); extern bool context_doMerge (void); extern bool context_doDump (void); extern void context_resetAllFlags (void); extern /*@unused@*/ cstring context_unparseFlagMarkers (void) /*@*/ ; extern void context_enterDoWhileClause (void) /*@modifies internalState@*/ ; extern bool context_hasMods (void); extern bool context_isSystemDir (cstring p_dir) /*@*/ ; extern /*@observer@*/ cstring context_selectedLibrary (void) /*@*/ ; extern bool context_usingPosixLibrary (void) /*@*/ ; extern bool context_usingAnsiLibrary (void) /*@*/ ; extern flagcode context_getLibrary (void) /*@*/ ; extern void context_setLibrary (flagcode) /*@modifies internalState@*/ ; extern void context_setPreprocessing (void) /*@modifies internalState@*/; extern void context_clearPreprocessing (void) /*@modifies internalState@*/; extern bool context_isPreprocessing (void) /*@*/; extern bool context_loadingLibrary (void) /*@*/ ; extern void context_setInCommandLine (void) /*@modifies internalState@*/ ; extern void context_clearInCommandLine (void) /*@modifies internalState@*/ ; extern void context_checkGlobalScope (void) /*@modifies internalState@*/ ; extern bool context_isInCommandLine (void) /*@*/ ; extern bool context_inXHFile (void) /*@*/ ; extern void context_resetErrors (void); extern int context_getLinesProcessed (void) /*@*/ ; extern int context_getSpecLinesProcessed (void) /*@*/ ; extern bool context_setBoolName (void) /*@*/ ; extern /*@observer@*/ cstring context_getBoolName (void) /*@*/ ; extern /*@observer@*/ cstring context_printBoolName (void) /*@*/ ; extern /*@observer@*/ cstring context_getFalseName (void) /*@*/ ; extern /*@observer@*/ cstring context_getTrueName (void) /*@*/ ; extern /*@observer@*/ cstring context_getLarchPath (void) /*@*/ ; extern /*@observer@*/ cstring context_getLCLImportDir (void) /*@*/ ; extern constraintList context_getImplicitFcnConstraints (uentry p_ue) /*@*/ ; extern bool context_checkExport (uentry p_e) /*@*/ ; extern bool context_checkGlobMod (sRef p_el) /*@*/ ; extern bool context_checkGlobUse (uentry p_glob); extern bool context_checkAliasGlob (uentry p_glob); extern bool context_checkInternalUse (void); extern void context_recordFileModifies (/*@dependent@*/ sRefSet p_mods); extern void context_clearJustPopped (void); extern bool context_justPopped (void); extern void context_enterTrueClause (exprNode p_e); extern void context_enterFalseClause (exprNode p_e); extern void context_exitClause (exprNode p_pred, exprNode p_tbranch, exprNode p_fbranch); extern void context_exitInnerSafe (void); extern void context_exitInnerPlain (void) /*@modifies internalState@*/ ; extern bool context_inGlobalScope (void); extern bool context_inInnerScope (void); extern void context_setProtectVars (void); extern int context_getLimit (void) /*@*/ ; extern bool context_unlimitedMessages (void) /*@*/ ; extern void context_releaseVars (void); extern void context_sizeofReleaseVars (void); extern bool context_inProtectVars (void); extern bool context_hasFileAccess (typeId p_t); extern void context_hideShowscan (void); extern void context_unhideShowscan (void); extern void context_setMode (cstring p_s); extern void context_setModeNoWarn (cstring p_s); extern void context_exitAllClauses (void); extern void context_exitAllClausesQuiet (void); extern bool context_inHeader (void); extern /*@dependent@*/ /*@exposed@*/ fileTable context_fileTable (void) /*@*/ ; extern /*@exposed@*/ messageLog context_messageLog (void); extern /*@dependent@*/ /*@observer@*/ cstring context_tmpdir (void); extern void context_enterMTfile (void) /*@modifies internalState@*/ ; extern void context_exitMTfile (void) /*@modifies internalState@*/ ; extern void context_enterLCLfile (void); extern void context_exitLCLfile (void); extern void context_enterImport (void) ; extern void context_leaveImport (void) ; extern void context_processedSpecLine (void) /*@modifies internalState@*/ ; extern int context_getLCLExpect (void) /*@*/ ; extern bool context_msgLh (void) /*@*/ ; extern bool context_inLCLLib (void) /*@globals internalState@*/ ; extern bool context_inImport (void) /*@globals internalState@*/ ; extern void context_resetSpecLines (void) /*@modifies internalState@*/ ; extern void context_exitMacroCache (void); extern void context_enterSuppressRegion (fileloc); extern void context_exitSuppressRegion (fileloc); extern void context_enterMacroFile (void); extern typeIdSet context_fileAccessTypes (void); extern void context_addFileAccessType (typeId p_t); extern void context_removeFileAccessType (typeId p_t); extern /*@observer@*/ uentryList context_getParams (void); extern bool context_isSpecialFile (cstring p_fname); extern /*@observer@*/ cstring context_inFunctionName (void) /*@*/ ; extern ctype context_currentFunctionType (void) /*@*/ ; extern void context_exitCFile (void); extern void context_enterConstantMacro (/*@dependent@*/ /*@exposed@*/ uentry p_e); extern void context_enterMacro (/*@observer@*/ uentry p_e); extern void context_enterFunction (/*@exposed@*/ uentry p_e); extern void context_exitFunction (void); extern void context_initMod (void) /*@modifies internalState@*/ ; extern void context_enterInnerContext(void); extern void context_exitInner (exprNode p_exp); extern bool context_globAccess (sRef p_s); extern /*@observer@*/ globSet context_getUsedGlobs (void); extern bool context_hasAccess (typeId p_t); extern bool context_couldHaveAccess (typeId p_t); extern /*@only@*/ cstring context_unparse (void) /*@*/ ; extern void context_setFunctionDefined (fileloc p_loc); extern void context_setFlagTemp (flagcode p_f, bool p_b); extern /*@unused@*/ void context_showFilelocStack (void) ; extern bool context_getFlag (flagcode p_d) /*@*/ ; extern bool context_flagOn (flagcode p_f, fileloc p_loc) /*@*/ ; extern int context_getLineLen (void) /*@*/ ; # define context_getLineLen() ((int)context_getValue(FLG_LINELEN)) extern int context_getIndentSpaces (void) /*@*/ ; # define context_getIndentSpaces() ((int)context_getValue(FLG_INDENTSPACES)) extern int context_getLocIndentSpaces (void) /*@*/ ; # define context_getLocIndentSpaces() ((int)context_getValue(FLG_LOCINDENTSPACES)) extern int context_getValue (flagcode p_flag) /*@*/ ; extern void context_setValueAndFlag (flagcode p_flag, int p_val) /*@modifies internalState@*/ ; extern /*@unused@*/ int context_getCounter (flagcode p_flag) /*@*/ ; extern /*@unused@*/ void context_incCounter (flagcode p_flag) /*@modifies internalState@*/ ; extern /*@unused@*/ void context_decCounter (flagcode p_flag) /*@modifies internalState@*/ ; extern bool context_maybeSet (flagcode p_d) /*@*/ ; extern /*@observer@*/ cstring context_getString (flagcode p_flag) /*@*/ ; extern void context_setString (flagcode p_flag, /*@only@*/ cstring p_val) /*@modifies internalState@*/ ; extern void context_userSetFlag (flagcode p_f, bool p_b); extern int context_getExpect (void) /*@*/ ; extern /*@observer@*/ sRefSet context_modList(void); extern /*@exposed@*/ uentry context_getHeader(void) /*@*/; extern void context_usedGlobal (/*@exposed@*/ sRef p_el); extern void context_resetModeFlags (void); extern ctype context_typeofZero (void); extern ctype context_typeofOne (void); extern void context_enterFile (void); extern void context_enterUnknownMacro (/*@dependent@*/ /*@observer@*/ uentry p_e); extern char context_getCommentMarkerChar (void); extern void context_setCommentMarkerChar (char p_c); extern bool context_inMacroConstant (void) /*@*/ ; extern void context_returnFunction (void); extern bool context_processingMacros (void); extern void context_saveLocation (void); extern /*@only@*/ fileloc context_getSaveLocation (void); extern void context_setFileId (fileId p_s); extern void context_setFilename(fileId p_fid, int p_lineno) /*@globals fileloc g_currentloc; @*/ /*@modifies g_currentloc@*/ ; extern void context_fileSetFlag (flagcode p_f, ynm p_set, fileloc p_loc); extern /*@unused@*/ /*@only@*/ cstring context_unparseAccess (void) /*@*/ ; extern bool context_inFunction(void) /*@*/ ; extern bool context_inFunctionLike (void) /*@*/ ; extern void context_setMacroMissingParams (void); extern void context_resetMacroMissingParams (void); extern bool context_isMacroMissingParams (void) /*@*/ ; extern bool context_inUnknownMacro (void) /*@*/ ; /*@observer@*/ cstring context_getDump (void) /*@*/ ; /*@observer@*/ cstring context_getMerge (void) /*@*/ ; extern void context_incLineno (void); extern bool context_inSuppressRegion (void) /*@*/ ; extern void context_exitTrueClause (exprNode p_pred, exprNode p_tbranch); extern void context_destroyMod (void) /*@modifies internalState@*/ ; extern void context_addMacroCache (/*@only@*/ cstring p_def); extern void context_processAllMacros (void); extern void context_addComment (/*@only@*/ cstring p_def, fileloc p_loc); extern void context_enterSuppressLine (int p_count, fileloc p_loc); extern bool context_inSuppressZone (fileloc p_fl) /*@*/ ; extern void context_dumpModuleAccess (FILE *p_fout); extern void context_loadModuleAccess (FILE *p_in); extern bool context_inIterDef (void) /*@*/ ; extern bool context_inMacro (void) /*@*/ ; extern bool context_inIterEnd (void) /*@*/ ; extern ctype context_getRetType (void) /*@*/ ; extern void context_enterIterDef (/*@observer@*/ uentry p_le); extern void context_enterIterEnd (/*@observer@*/ uentry p_le); extern void context_addBoolAccess (void); extern bool context_canAccessBool (void); extern void context_quietExitFunction (void); /* speedy shortcuts for frequently used flags */ extern bool context_msgBoolInt (void) /*@*/ ; extern bool context_msgCharInt (void) /*@*/ ; extern bool context_msgEnumInt (void) /*@*/ ; extern bool context_msgLongInt (void) /*@*/ ; extern bool context_msgShortInt (void) /*@*/ ; extern bool context_msgPointerArith (void) /*@*/ ; extern bool context_msgStrictOps (void) /*@*/ ; extern void context_exitStructInnerContext (void); extern void context_enterStructInnerContext (void); extern bool context_inRealFunction (void) /*@*/ ; extern void context_exitOrClause (exprNode p_pred, exprNode p_tbranch); extern void context_exitAndClause (exprNode p_pred, exprNode p_tbranch); extern void context_enterOrClause (exprNode p_e); extern void context_enterAndClause (exprNode p_e); extern void context_enterForClause (exprNode p_e); extern void context_enterWhileClause (exprNode p_e); extern void context_enterIterClause (void); extern void context_exitIterClause (exprNode p_body); extern void context_exitWhileClause (exprNode p_pred, exprNode p_body); extern void context_exitDoWhileClause (exprNode p_pred); extern void context_exitForClause (exprNode p_forPred, exprNode p_body); extern /*@only@*/ cstring context_unparseClauses (void) /*@*/ ; extern /*@observer@*/ globSet context_getGlobs (void) /*@*/ ; extern /*@only@*/ cstring context_getMessageAnnote (void); extern void context_clearMessageAnnote (void); extern bool context_hasMessageAnnote (void); extern void context_setMessageAnnote (/*@only@*/ cstring p_s); extern bool context_suppressFlagMsg (flagcode p_flag, fileloc p_fl); extern bool context_suppressNotFlagMsg (flagcode p_flag, fileloc p_fl); extern void context_enterCaseClause (exprNode p_e); extern void context_enterSwitch (exprNode p_e); extern void context_exitSwitch (exprNode p_e, bool p_allpaths); extern bool context_showFunction (void); extern void context_setShownFunction (void); extern void context_clearAliasAnnote (void); extern cstring context_getAliasAnnote (void); extern bool context_hasAliasAnnote (void); extern void context_setAliasAnnote (/*@observer@*/ sRef p_s, /*@observer@*/ sRef p_t); extern bool context_inDeepLoop (void) /*@globals internalState@*/ ; extern bool context_inDeepLoopSwitch (void) /*@globals internalState@*/ ; extern bool context_inConditional (void) /*@globals internalState@*/ ; extern bool context_inDeepSwitch (void) /*@globals internalState@*/ ; extern clause context_breakClause (void); extern clause context_nextBreakClause (void); extern bool context_anyErrors (void) /*@globals internalState@*/ ; extern void context_hasError (void) /*@modifies internalState@*/ ; extern int context_numErrors (void) /*@globals internalState@*/ ; extern void context_recordBug (void) /*@modifies internalState@*/ ; extern int context_numBugs (void) /*@globals internalState@*/ ; extern bool context_neednl (void); extern void context_setNeednl (void); extern bool context_inGlobalContext (void) /*@globals internalState@*/ ; extern bool context_inMacroFunction (void) /*@globals internalState@*/ ; extern /*@observer@*/ cstring context_moduleName (void) /*@*/ ; extern void context_recordFileGlobals (/*@dependent@*/ globSet p_mods); extern void context_checkSuppressCounts (void) /*@modifies g_warningstream@*/ ; extern bool context_inFunctionHeader (void) /*@globals internalState@*/ ; extern void context_enterFunctionHeader (void) /*@modifies internalState@*/ ; extern void context_exitFunctionHeader (void) /*@modifies internalState@*/ ; extern bool context_inFunctionDeclaration (void) /*@globals internalState@*/ ; extern void context_enterFunctionDeclaration (/*@exposed@*/ uentry) /*@modifies internalState@*/ ; extern void context_exitFunctionDeclaration (void) /*@modifies internalState@*/ ; extern void context_enterOldStyleScope (void) /*@modifies internalState@*/ ; extern void context_completeOldStyleFunction (/*@exposed@*/ uentry p_e) /*@modifies internalState@*/ ; extern ctype context_boolImplementationType (void) /*@*/ ; extern /*@observer@*/ /*@null@*/ annotationInfo context_lookupAnnotation (cstring p_annot) /*@*/ ; extern /*@observer@*/ metaStateTable context_getMetaStateTable (void) /*@globals internalState@*/ ; extern /*@observer@*/ metaStateInfo context_lookupMetaStateInfo (cstring p_key) /*@globals internalState@*/ ; extern void context_addAnnotation (/*@only@*/ annotationInfo) /*@modifies internalState@*/ ; extern void context_addMetaState (/*@only@*/ cstring, /*@only@*/ metaStateInfo) /*@modifies internalState@*/ ; extern valueTable context_createValueTable (sRef p_s, /*@only@*/ stateInfo p_info) /*@globals internalState@*/ ; extern valueTable context_createGlobalMarkerValueTable (/*@only@*/ stateInfo p_info) /*@globals internalState@*/ ; extern int context_getBugsLimit (void) /*@*/ ; # define context_getBugsLimit() ((int)context_getValue(FLG_BUGSLIMIT)) /*drl added 2/4/2002*/ extern bool context_inOldStyleScope (void) /*@*/ ; /*drl added 3/5/2003*/ extern bool context_inSizeof (void); extern void context_enterSizeof (void); extern void context_leaveSizeof (void); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtMergeClause.h0000644021234200000250000000231607630463447016532 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtMergeClause.h */ # ifndef MTMERGECLAUSE_H # define MTMERGECLAUSE_H struct s_mtMergeClause { mtMergeItem item1, item2; mtTransferAction action; } ; extern cstring mtMergeClause_unparse (mtMergeClause p_node) /*@*/ ; extern mtMergeClause mtMergeClause_create (/*@only@*/ mtMergeItem p_item1, /*@only@*/ mtMergeItem p_item2, /*@only@*/ mtTransferAction p_action) ; extern /*@observer@*/ mtMergeItem mtMergeClause_getItem1 (mtMergeClause) /*@*/ ; # define mtMergeClause_getItem1(p_merge) ((p_merge)->item1) extern /*@observer@*/ mtMergeItem mtMergeClause_getItem2 (mtMergeClause) /*@*/ ; # define mtMergeClause_getItem2(p_merge) ((p_merge)->item2) extern /*@observer@*/ mtTransferAction mtMergeClause_getAction (mtMergeClause) /*@*/ ; # define mtMergeClause_getAction(p_merge) ((p_merge)->action) extern /*@observer@*/ fileloc mtMergeClause_getLoc (mtMergeClause) /*@*/ ; # define mtMergeClause_getLoc(p_merge) (mtMergeItem_getLoc ((p_merge)->item1)) extern void mtMergeClause_free (/*@only@*/ mtMergeClause p_merge) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cpperror.h0000644021234200000250000000227007443751373015630 0ustar fax# ifndef CPPERROR_H # define CPPERROR_H /* doesn't exit! */ extern void cppReader_fatalError (cppReader *p_pfile, /*@only@*/ cstring p_str); extern /*@noreturn@*/ void cppReader_pfatalWithName (cppReader *p_pfile, cstring p_name); extern void cppReader_errorLit (cppReader *p_pfile, /*@observer@*/ cstring p_msg); extern void cppReader_pedwarnWithLine (cppReader *p_pfile, int p_line, int p_column, /*@only@*/ cstring p_msg); extern void cppReader_error (cppReader *p_pfile, /*@only@*/ cstring p_msg); extern void cppReader_warning (cppReader *p_pfile, /*@only@*/ cstring p_msg); extern void cppReader_printContainingFiles (cppReader *p_pfile) /*@modifies g_warningstream, p_pfile@*/ ; extern void cppReader_warningLit (cppReader *p_pfile, /*@observer@*/ cstring p_msg); extern void cppReader_pedwarn (cppReader *p_pfile, /*@only@*/ cstring p_msg); extern void cppReader_pedwarnLit (cppReader *p_pfile, /*@observer@*/ cstring p_msg); extern void cppReader_errorWithLine (cppReader *p_pfile, int p_line, int p_column, /*@only@*/ cstring p_msg); extern void cppReader_perrorWithName (cppReader *p_pfile, cstring p_name); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtMergeClauseList.h0000644021234200000250000000443607651115037017363 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef MTMERGECLAUSELIST_H # define MTMERGECLAUSELIST_H /*:private:*/ typedef /*@only@*/ mtMergeClause o_mtMergeClause; struct s_mtMergeClauseList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_mtMergeClause *elements; } ; /*@constant null mtMergeClauseList mtMergeClauseList_undefined;@*/ # define mtMergeClauseList_undefined ((mtMergeClauseList) NULL) extern /*@falsewhennull@*/ bool mtMergeClauseList_isDefined (mtMergeClauseList p_s) /*@*/ ; # define mtMergeClauseList_isDefined(s) ((s) != mtMergeClauseList_undefined) extern int mtMergeClauseList_size (/*@sef@*/ mtMergeClauseList) /*@*/ ; # define mtMergeClauseList_size(s) (mtMergeClauseList_isDefined (s) ? (s)->nelements : 0) extern /*@unused@*/ /*@falsewhennull@*/ bool mtMergeClauseList_empty (/*@sef@*/ mtMergeClauseList) /*@*/ ; # define mtMergeClauseList_empty(s) (mtMergeClauseList_size(s) == 0) extern cstring mtMergeClauseList_unparseSep (mtMergeClauseList p_s, cstring p_sep) /*@*/ ; extern /*@unused@*/ /*@only@*/ mtMergeClauseList mtMergeClauseList_new (void) /*@*/ ; extern /*@only@*/ mtMergeClauseList mtMergeClauseList_single (/*@keep@*/ mtMergeClause p_el) /*@*/ ; extern /*@unused@*/ mtMergeClauseList mtMergeClauseList_add (/*@returned@*/ mtMergeClauseList p_s, /*@keep@*/ mtMergeClause p_el) /*@modifies p_s@*/ ; extern mtMergeClauseList mtMergeClauseList_prepend (/*@only@*/ mtMergeClauseList p_s, /*@only@*/ mtMergeClause p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring mtMergeClauseList_unparse (mtMergeClauseList p_s) ; extern void mtMergeClauseList_free (/*@only@*/ mtMergeClauseList p_s) ; /*@constant int mtMergeClauseListBASESIZE;@*/ # define mtMergeClauseListBASESIZE MIDBASESIZE /*@iter mtMergeClauseList_elements (sef mtMergeClauseList x, yield exposed mtMergeClause el); @*/ # define mtMergeClauseList_elements(x, m_el) \ { if (mtMergeClauseList_isDefined (x)) { \ int m_ind; mtMergeClause *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { mtMergeClause m_el = *(m_elements++); # define end_mtMergeClauseList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cppexp.h0000644021234200000250000000007707121317325015262 0ustar faxextern HOST_WIDE_INT cppReader_parseExpression (cppReader *); splint-3.1.2.dfsg1/src/Headers/mtMergeItem.h0000644021234200000250000000200507630463447016207 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtMergeItem.h */ # ifndef MTMERGEITEM_H # define MTMERGEITEM_H struct s_mtMergeItem { enum { MTMK_VALUE, MTMK_STAR } kind; cstring value; /* for MTAK_VALUE only */ fileloc loc; } ; extern void mtMergeItem_free (/*@only@*/ mtMergeItem p_node) ; extern cstring mtMergeItem_unparse (mtMergeItem p_node) /*@*/ ; extern mtMergeItem mtMergeItem_createValue (/*@only@*/ mttok p_value) /*@*/ ; extern mtMergeItem mtMergeItem_createStar (/*@only@*/ mttok p_value) /*@*/ ; extern bool mtMergeItem_isStar (mtMergeItem) /*@*/ ; # define mtMergeItem_isStar(p_mi) ((p_mi)->kind == MTMK_STAR) extern /*@observer@*/ cstring mtMergeItem_getValue (mtMergeItem) /*@*/ ; # define mtMergeItem_getValue(node) ((node)->value) extern /*@observer@*/ fileloc mtMergeItem_getLoc (mtMergeItem) /*@*/ ; # define mtMergeItem_getLoc(node) ((node)->loc) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cpp.h0000644021234200000250000000272107536414704014554 0ustar fax# ifndef CPP_H # define CPP_H typedef struct cppBuffer cppBuffer; typedef struct cppOptions cppOptions; enum cpp_token { CPP_EOF = -1, CPP_OTHER = 0, CPP_COMMENT = 1, CPP_HSPACE, CPP_VSPACE, /* newlines and #line directives */ CPP_NAME, CPP_NUMBER, CPP_CHAR, CPP_STRING, CPP_DIRECTIVE, CPP_LPAREN, /* "(" */ CPP_RPAREN, /* ")" */ CPP_LBRACE, /* "{" */ CPP_RBRACE, /* "}" */ CPP_COMMA, /* "," */ CPP_SEMICOLON,/* ";" */ CPP_3DOTS, /* "..." */ #if 0 CPP_ANDAND, /* "&&" */ CPP_OROR, /* "||" */ CPP_LSH, /* "<<" */ CPP_RSH, /* ">>" */ CPP_EQL, /* "==" */ CPP_NEQ, /* "!=" */ CPP_LEQ, /* "<=" */ CPP_GEQ, /* ">=" */ CPP_PLPL, /* "++" */ CPP_MINMIN, /* "--" */ #endif /* POP_TOKEN is returned when we've popped a cppBuffer. */ CPP_POP }; typedef struct cppReader cppReader; extern cppReader g_cppState; extern /*@only@*/ cstring cppReader_getIncludePath (void) ; extern int cppProcess (/*@dependent@*/ cstring p_infile, /*@dependent@*/ cstring p_outfile); extern void cppAddIncludeDir (cstring); extern void cppReader_initMod (void) /*@modifies internalState@*/ ; extern void cppReader_destroyMod (void) /*@modifies internalState@*/ ; extern void cppDoDefine (cstring); extern void cppDoUndefine (cstring); extern void cppReader_saveDefinitions (void); extern fileloc cppReader_getLoc (cppReader *); extern void cppReader_initialize (void); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtMergeNode.h0000644021234200000250000000122307630463447016177 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtMergeNode.h */ # ifndef MTMERGENODE_H # define MTMERGENODE_H struct s_mtMergeNode { mtMergeClauseList mlist; } ; extern mtMergeNode mtMergeNode_create (/*@only@*/ mtMergeClauseList) /*@*/ ; extern void mtMergeNode_free (/*@only@*/ mtMergeNode) ; extern cstring mtMergeNode_unparse (mtMergeNode p_node) /*@*/ ; extern /*@observer@*/ mtMergeClauseList mtMergeNode_getClauses (mtMergeNode p_node) /*@*/ ; # define mtMergeNode_getClauses(p_node) ((p_node)->mlist) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cpphash.h0000644021234200000250000000411507440260341015405 0ustar fax# ifndef CPPHASH_H # define CPPHASH_H /*@constant int CPP_HASHSIZE@*/ # define CPP_HASHSIZE 1403 /* different kinds of things that can appear in the value field of a hash node. Actually, this may be useless now. */ typedef union u_hashvalue { int ival; /*@null@*/ /*@owned@*/ char *cpval; /*@owned@*/ DEFINITION *defn; } hashValue; struct s_hashNode { /* double links for easy deletion */ /*@only@*/ /*@null@*/ hashNode next; /*@dependent@*/ /*@null@*/ hashNode prev; /* ** Also, a back pointer to this node's hash ** chain is kept, in case the node is the head ** of the chain and gets deleted. */ /*@null@*/ /*@dependent@*/ hashNode *bucket_hdr; enum node_type type; /* type of special token */ size_t length; /* length of token, for quick comparison */ cstring name; /* the actual name */ hashValue value; /* pointer to expansion, or whatever */ } ; /* Some definitions for the hash table. The hash function MUST be computed as shown in hashf () below. That is because the rescan loop computes the hash value `on the fly' for most tokens, in order to avoid the overhead of a lot of procedure calls to the hashf () function. Hashf () only exists for the sake of politeness, for use when speed isn't so important. */ extern void cppReader_deleteMacro (/*@exposed@*/ hashNode p_hp) /*@modifies internalState, p_hp@*/; extern /*@exposed@*/ hashNode cpphash_install (char *, int, enum node_type, int, /*@only@*/ /*@null@*/ char *, int); extern void cppReader_hashCleanup (void); extern /*@null@*/ /*@exposed@*/ hashNode cpphash_lookup (char *, int, int); extern /*@null@*/ /*@exposed@*/ hashNode cpphash_lookupExpand (char *, int, int, bool p_forceExpand); extern int cpphash_hashCode (const char *p_name, size_t p_len, int p_hashsize) /*@*/ ; extern void cppReader_saveHashtab (void); extern void cppReader_restoreHashtab (void); extern /*@exposed@*/ hashNode cpphash_installMacro (char *p_name, size_t p_len, /*@only@*/ struct definition *p_defn, int p_hash); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtreader.h0000644021234200000250000000110307630463447015571 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtreader.h */ # ifndef MTREADER_H # define MTREADER_H extern void mtreader_readFile (/*@only@*/ cstring p_infile) /*@modifies internalState@*/ ; extern void mtreader_processDeclaration (/*@only@*/ mtDeclarationNode p_decl) /*@modifies internalState@*/ ; extern void mtreader_processGlobalDeclaration (/*@only@*/ mtDeclarationNode p_decl) /*@modifies internalState@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cpplib.h0000644021234200000250000005215107670427302015242 0ustar fax/* Definitions for CPP library. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. Written by Per Bothner, 1994-95. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ #include #include #ifdef __cplusplus extern "C" { #endif typedef enum cpp_token (*parseUnderflow) (cppReader *); typedef void (*parseCleanup) (cppBuffer *, cppReader *); /* Structure returned by create_definition */ typedef struct s_macrodef macroDef; /* A parse_marker indicates a previous position, which we can backtrack to. */ struct parse_marker { /*@dependent@*/ cppBuffer *buf; /*@dependent@*/ /*@null@*/ struct parse_marker *next; int position; }; /* The arglist structure is built by do_define to tell collect_definition where the argument names begin. That is, for a define like "#define f(x,y,z) foo+x-bar*y", the arglist would contain pointers to the strings x, y, and z. Collect_definition would then build a DEFINITION node, with reflist nodes pointing to the places x, y, and z had appeared. So the arglist is just convenience data passed between these two routines. It is not kept around after the current #define has been processed and entered into the hash table. */ struct arglist { /*@null@*/ struct arglist *next; /*@dependent@*/ char *name; size_t length; int argno; int rest_args; }; extern enum cpp_token cpplib_getToken (cppReader *); extern enum cpp_token cpplib_getTokenForceExpand (cppReader *); extern enum cpp_token cpplib_getTokenAux (cppReader *, bool p_forceExpand); extern int /*@alt void@*/ cppSkipHspace (cppReader *); /* This frees resources used by PFILE. */ extern /*@unused@*/ void cppCleanup (cppReader *p_pfile); struct cppBuffer { /*@null@*/ /*@only@*/ char *buf; /*@null@*/ /*@exposed@*/ char *cur; /*@null@*/ /*@exposed@*/ char *rlimit; /* end of valid data */ /*@null@*/ /*@exposed@*/ char *alimit; /* end of allocated buffer */ /*@null@*/ /*@exposed@*/ char *prev; /*@dependent@*/ cstring fname; /* Filename specified with #line command. */ /*@exposed@*/ cstring nominal_fname; /* Record where in the search path this file was found. For #include_next. */ /*@dependent@*/ /*@null@*/ struct file_name_list *dir; long line_base; int lineno; /* Line number at CPP_LINE_BASE. */ int colno; /* Column number at CPP_LINE_BASE. */ parseUnderflow underflow; parseCleanup cleanup; /*@dependent@*/ hashNode hnode; /*@dependent@*/ /*@null@*/ struct parse_marker *marks; /* Value of if_stack at start of this file. Used to prohibit unmatched #endif (etc) in an include file. */ /*@null@*/ /*@exposed@*/ struct if_stack *if_stack; /* True if this is a header file included using . */ char system_header_p; char seen_eof; /* True if buffer contains escape sequences. Currently there are three kinds: "@-" means following identifier should not be macro-expanded. "@ " means a token-separator. This turns into " " in final output if not stringizing and needed to separate tokens; otherwise nothing. "@@" means a normal '@'. (An '@' inside a string stands for itself and is never an escape.) */ bool has_escapes; }; struct cpp_pending; /* Forward declaration - for C++. */ struct file_name_map_list; /* Maximum nesting of cppBuffers. We use a static limit, partly for efficiency, and partly to limit runaway recursion. */ /*@constant int CPP_STACK_MAX; @*/ # define CPP_STACK_MAX 200 /* A cppReader encapsulates the "state" of a pre-processor run. Applying cppGetToken repeatedly yields a stream of pre-processor tokens. Usually, there is only one cppReader object active. */ struct cppReader { parseUnderflow get_token; /*@dependent@*/ /*@null@*/ cppBuffer *buffer; cppBuffer buffer_stack[CPP_STACK_MAX]; int errors; /* Error counter for exit code */ cppOptions *opts; /* void *data; */ /* A buffer used for both for cppGetToken's output, and also internally. */ /*@relnull@*/ char *token_buffer; /* Alocated size of token_buffer. cppReader_reserve allocates space. */ size_t token_buffer_size; /* End of the written part of token_buffer. */ /*@exposed@*/ char *limit; /* Line where a newline was first seen in a string constant. */ int multiline_string_line; /* Current depth in #include directives that use <...>. */ int system_include_depth; /* List of other included files. If ->control_macro if nonzero, the file had a #ifndef around the entire contents, and ->control_macro gives the macro name. */ /*@owned@*/ /*@null@*/ struct file_name_list *all_include_files; /* Current maximum length of directory names in the search path for include files. (Altered as we get more of them.) */ size_t max_include_len; /*@null@*/ struct if_stack *if_stack; /* Nonzero means we are inside an IF during a -pcp run. In this mode macro expansion is done, and preconditions are output for all macro uses requiring them. */ char pcp_inside_if; /* Nonzero means we have printed (while error reporting) a list of containing files that matches the current status. */ char input_stack_listing_current; /* If non-zero, macros are not expanded. */ bool no_macro_expand; /* Print column number in error messages. */ bool show_column; /* If true, character between '<' and '>' are a single (string) token. */ char parsing_include_directive; /* True if escape sequences (as described for has_escapes in parse_buffer) should be emitted. */ char output_escapes; /* 0: Have seen non-white-space on this line. 1: Only seen white space so far on this line. 2: Only seen white space so far in this file. */ char only_seen_white; int lineno; /*@null@*/ /*@observer@*/ struct tm *timebuf; }; /*@constant int cppReader_fatalErrorLimit; @*/ #define cppReader_fatalErrorLimit 1000 /* True if we have seen a "fatal" error. */ extern bool cpplib_fatalErrors (cppReader *) /*@*/ ; #define cpplib_fatalErrors(READER) ((READER)->errors >= cppReader_fatalErrorLimit) extern int cpplib_bufPeek (cppBuffer *) /*@*/ ; /* Macros for manipulating the token_buffer. */ /*@notfunction@*/ #define CPP_OUT_BUFFER(PFILE) ((PFILE)->token_buffer) /* Number of characters currently in PFILE's output buffer. */ extern size_t cpplib_getWritten (/*@sef@*/ cppReader *) /*@*/ ; # define cpplib_getWritten(PFILE) \ (size_fromInt ((PFILE)->limit - (PFILE)->token_buffer)) extern /*@exposed@*/ char *cpplib_getPWritten (cppReader *) /*@*/ ; # define cpplib_getPWritten(PFILE) ((PFILE)->limit) extern /*@null@*/ macroDef cpplib_createDefinition (/*@dependent@*/ cstring p_def, fileloc p_loc, bool p_predefinition, bool p_noExpand) ; /* Make sure PFILE->token_buffer has space for at least N more characters. */ extern void cpplib_reserve (/*@sef@*/ cppReader *, /*@sef@*/ size_t); #define cpplib_reserve(PFILE, N) \ (((cpplib_getWritten (PFILE) + (N) > (PFILE)->token_buffer_size)) ? cppReader_growBuffer (PFILE, (N)) : (void) 0) /* Append string STR (of length N) to PFILE's output buffer. Assume there is enough space. */ extern void cppReader_putStrN (/*@sef@*/ cppReader *p_file, /*@unique@*/ char *p_str, /*@sef@*/ size_t p_n) /*@modifies *p_file; @*/; #define cppReader_putStrN(PFILE, STR, N) \ (memcpy ((PFILE)->limit, STR, (N)), (PFILE)->limit += (N)) extern void cppReader_setWritten (/*@sef@*/ /*@special@*/ cppReader *p_file, size_t) /*@uses p_file, *p_file, p_file->token_buffer;@*/ /*@sets p_file->limit;@*/ /*@modifies *p_file@*/ ; # define cppReader_setWritten(PFILE,N) \ ((PFILE)->limit = (PFILE)->token_buffer + (N)) extern /*@dependent@*/ /*@exposed@*/ cppOptions *CPPOPTIONS (/*@special@*/ cppReader *p_pfile) /*@uses p_pfile->opts@*/ ; #define CPPOPTIONS(PFILE) ((PFILE)->opts) /*@notfunction@*/ #define CPPBUFFER(PFILE) ((PFILE)->buffer) /* Checks for null */ extern /*@exposed@*/ cppBuffer * cppReader_getBufferSafe (/*@special@*/ cppReader *p_pfile) /*@uses p_pfile->buffer@*/ /*@modifies nothing@*/ ; extern /*@exposed@*/ cppBuffer *cppBuffer_prevBuffer (cppBuffer *) /*@*/ ; /* The bottom of the buffer stack. */ extern /*@exposed@*/ cppBuffer *cppReader_nullBuffer (/*@special@*/ cppReader *p_pfile) /*@uses p_pfile->buffer_stack@*/ /*@*/ ; # define cppReader_nullBuffer(PFILE) (&(PFILE)->buffer_stack[CPP_STACK_MAX]) /* Pointed to by cppReader::data. */ struct cppOptions { /*@dependent@*/ cstring in_fname; /* Name of output file, for error messages. */ /*@dependent@*/ cstring out_fname; /*@only@*/ struct file_name_map_list *map_list; /* Non-0 means -v, so print the full set of include dirs. */ bool verbose; /* Nonzero means use extra default include directories for C++. */ bool cplusplus; /* Nonzero means handle cplusplus style comments */ bool cplusplus_comments; /* Nonzero means this is an assembly file, and allow unknown directives, which could be comments. */ int lang_asm; /* Nonzero means turn NOTREACHED into #pragma NOTREACHED etc */ bool for_lint; /* Nonzero means handle CHILL comment syntax and output CHILL string delimiter for __DATE___ etc. */ bool chill; /* Nonzero means copy comments into the output file. */ bool put_out_comments; /* Nonzero means don't process the ANSI trigraph sequences. */ bool no_trigraphs; /* Nonzero means print names of header files (-H). */ bool print_include_names; /* Nonzero means try to make failure to fit ANSI C an error. */ bool pedantic_errors; /* Nonzero means don't print warning messages. -w. */ /* bool inhibit_warnings; -- removed evans 2001-07-19 */ /* Nonzero means warn if slash-star appears in a comment. */ bool warn_comments; /* Nonzero means warn if a macro argument is (or would be) stringified with -traditional. */ bool warn_stringify; bool warnings_are_errors; bool no_output; /* Nonzero means don't output line number information. */ bool no_line_commands; /* Nonzero means output the text in failing conditionals, inside #failed ... #endfailed. */ char output_conditionals; bool ignore_srcdir; /* Zero means dollar signs are punctuation. This used to be needed for conformance to the C Standard, before the C Standard was corrected. */ bool dollars_in_ident; /* Nonzero means try to imitate old fashioned non-ANSI preprocessor. */ bool traditional; /* Nonzero for the 1989 C Standard, including corrigenda and amendments. */ bool c89; /* Nonzero means give all the error messages the ANSI standard requires. */ bool pedantic; bool done_initializing; /* First dir to search */ /*@owned@*/ struct file_name_list *include; /* First dir to search for */ /* This is the first element to use for #include <...>. If it is 0, use the entire chain for such includes. */ /*@dependent@*/ struct file_name_list *first_bracket_include; /* This is the first element in the chain that corresponds to a directory of system header files. */ /*@dependent@*/ struct file_name_list *first_system_include; /*@exposed@*/ struct file_name_list *last_include; /* Last in chain */ /* Chain of include directories to put at the end of the other chain. */ struct file_name_list *after_include; /*@exposed@*/ struct file_name_list *last_after_include; /* Last in chain */ /* Chain to put at the start of the system include files. */ struct file_name_list *before_system; /*@exposed@*/ struct file_name_list *last_before_system; /* Last in chain */ /* Directory prefix that should replace `/usr' in the standard include file directories. */ char *include_prefix; char inhibit_predefs; char no_standard_includes; char no_standard_cplusplus_includes; /* ** DUMP_NAMES means pass #define and the macro name through to output. ** DUMP_DEFINITIONS means pass the whole definition (plus #define) through */ /*@-enummemuse@*/ enum { DUMP_NONE = 0, DUMP_NAMES, DUMP_DEFINITIONS } dump_macros; /*@=enummemuse@*/ /* Nonzero means pass all #define and #undef directives which we actually process through to the output stream. This feature is used primarily to allow cc1 to record the #defines and #undefs for the sake of debuggers which understand about preprocessor macros, but it may also be useful with -E to figure out how symbols are defined, and where they are defined. */ int debug_output; }; extern bool cppReader_isTraditional (/*@special@*/ cppReader *p_pfile) /*@uses p_pfile->opts@*/ /*@modifies nothing@*/ ; #define cppReader_isTraditional(PFILE) (CPPOPTIONS(PFILE)->traditional) extern bool cppReader_isPedantic (cppReader *) /*@*/; #define cppReader_isPedantic(PFILE) (CPPOPTIONS (PFILE)->pedantic) /* The structure of a node in the hash table. The hash table has entries for all tokens defined by #define commands (type T_MACRO), plus some special tokens like __LINE__ (these each have their own type, and the appropriate code is run when that type of node is seen. It does not contain control words like "#define", which are recognized by a separate piece of code. */ /* different flavors of hash nodes --- also used in keyword table */ enum node_type { T_NONE = 0, T_DEFINE = 1, /* the #define keyword */ T_INCLUDE, /* the #include keyword */ T_INCLUDE_NEXT, /* the #include_next keyword */ T_IFDEF, /* the #ifdef keyword */ T_IFNDEF, /* the #ifndef keyword */ T_IF, /* the #if keyword */ T_ELSE, /* #else */ T_PRAGMA, /* #pragma */ T_ELIF, /* #elif */ T_UNDEF, /* #undef */ T_LINE, /* #line */ T_ERROR, /* #error */ T_WARNING, /* #warning */ T_ENDIF, /* #endif */ T_IDENT, /* #ident, used on system V. */ T_SPECLINE, /* special symbol __LINE__ */ T_DATE, /* __DATE__ */ T_FILE, /* __FILE__ */ T_BASE_FILE, /* __BASE_FILE__ */ T_INCLUDE_LEVEL, /* __INCLUDE_LEVEL__ */ T_FUNC, /* __func__ */ T_VERSION, /* __VERSION__ */ T_SIZE_TYPE, /* __SIZE_TYPE__ */ T_PTRDIFF_TYPE, /* __PTRDIFF_TYPE__ */ T_WCHAR_TYPE, /* __WCHAR_TYPE__ */ T_USER_LABEL_PREFIX_TYPE, /* __USER_LABEL_PREFIX__ */ T_REGISTER_PREFIX_TYPE, /* __REGISTER_PREFIX__ */ T_TIME, /* __TIME__ */ T_CONST, /* Constant value, used by __STDC__ */ T_MACRO, /* macro defined by #define */ T_DISABLED, /* macro temporarily turned off for rescan */ T_SPEC_DEFINED, /* special defined macro for use in #if statements */ T_PCSTRING, /* precompiled string (hashval is KEYDEF *) */ T_UNUSED /* Used for something not defined. */ } ; struct s_macrodef { /*@null@*/ struct definition *defn; /*@exposed@*/ /*@relnull@*/ char *symnam; /* null if defn is null */ size_t symlen; }; /* Structure allocated for every #define. For a simple replacement such as #define foo bar , nargs = -1, the `pattern' list is null, and the expansion is just the replacement text. Nargs = 0 means a functionlike macro with no args, e.g., #define getchar() getc (stdin) . When there are args, the expansion is the replacement text with the args squashed out, and the reflist is a list describing how to build the output from the input: e.g., "3 chars, then the 1st arg, then 9 chars, then the 3rd arg, then 0 chars, then the 2nd arg". The chars here come from the expansion. Whatever is left of the expansion after the last arg-occurrence is copied after that arg. Note that the reflist can be arbitrarily long--- its length depends on the number of times the arguments appear in the replacement text, not how many args there are. Example: #define f(x) x+x+x+x+x+x+x would have replacement text "++++++" and pattern list { (0, 1), (1, 1), (1, 1), ..., (1, 1), NULL } where (x, y) means (nchars, argno). */ typedef struct definition DEFINITION; struct definition { int nargs; size_t length; /* length of expansion string */ bool predefined; /* True if the macro was builtin or */ /* came from the command line */ /*@dependent@*/ char *expansion; long line; /* Line number of definition */ /*@exposed@*/ cstring file; /* File of definition */ bool noExpand; /* True if macro should not be expanded in code. */ bool rest_args; /* Nonzero if last arg. absorbs the rest */ /*@null@*/ struct reflist { /*@null@*/ /*@dependent@*/ struct reflist *next; bool stringify; /* nonzero if this arg was preceded by a # operator. */ bool raw_before; /* Nonzero if a ## operator before arg. */ bool raw_after; /* Nonzero if a ## operator after arg. */ bool rest_args; /* Nonzero if this arg. absorbs the rest */ int nchars; /* Number of literal chars to copy before this arg occurrence. */ int argno; /* Number of arg to substitute (origin-0) */ } *pattern; union { /* Names of macro args, concatenated in reverse order with comma-space between them. The only use of this is that we warn on redefinition if this differs between the old and new definitions. */ /*@null@*/ char *argnames; } args; }; /* Stack of conditionals currently in progress (including both successful and failing conditionals). */ struct if_stack { /*@null@*/ struct if_stack *next; /* for chaining to the next stack frame */ /*@observer@*/ cstring fname; /* copied from input when frame is made */ int lineno; /* similarly */ int if_succeeded; /* true if a leg of this if-group has been passed through rescan */ /* For #ifndef at start of file, this is the macro name tested. */ /*@null@*/ /*@dependent@*/ char *control_macro; enum node_type type; /* type of last directive seen in this group */ }; typedef struct if_stack cppIfStackFrame; extern void cppBuffer_getLineAndColumn (/*@null@*/ cppBuffer *, /*@out@*/ int *, /*@out@*/ /*@null@*/ int *); extern /*@exposed@*/ /*@null@*/ cppBuffer *cppReader_fileBuffer (cppReader *); extern void cppReader_growBuffer (cppReader *, size_t); extern int cppReader_parseEscape (cppReader *, char **); extern /*@exposed@*/ cppBuffer *cppReader_popBuffer (cppReader *p_pfile) /*@modifies p_pfile@*/ ; #ifdef __cplusplus } #endif extern void cppReader_skipRestOfLine (cppReader *p_pfile); # include /*@constant observer char *GCC_INCLUDE_DIR;@*/ /* This is defined by config.h now. */ /*@constant observer char *GCC_INCLUDE_DIR2@*/ /* This is defined by config.h now. */ struct file_name_list { /*@owned@*/ /*@null@*/ struct file_name_list *next; /*@dependent@*/ cstring fname; /* If the following is nonzero, it is a macro name. Don't include the file again if that macro is defined. */ /*@dependent@*/ /*@null@*/ char *control_macro; /* If the following is nonzero, it is a C-language system include directory. */ bool c_system_include_path; /* Mapping of file names for this directory. */ /*@exposed@*/ /*@relnull@*/ /*@reldef@*/ struct file_name_map *name_map; /* Non-zero if name_map is valid. */ bool got_name_map; }; extern void cppReader_addIncludeChain (/*@special@*/ cppReader *p_pfile, /*@only@*/ struct file_name_list *p_dir) /*@uses p_pfile->opts, p_pfile->max_include_len@*/ /*@modifies p_pfile, p_dir@*/ ; extern void cppReader_define (cppReader *p_pfile, char *p_str); extern void cppReader_finish (cppReader *p_pfile); extern void cpplib_init (/*@out@*/ cppReader *p_pfile) ; extern void cppOptions_init (/*@out@*/ cppOptions *p_opts); extern void cpplib_initializeReader (cppReader *p_pfile) /*@modifies p_pfile@*/ ; extern int cppReader_startProcess (cppReader *p_pfile, cstring p_fname); extern bool isIdentifierChar (char) /*@*/ ; /* Find the largest host integer type and set its size and type. */ #ifndef HOST_BITS_PER_WIDE_INT #if HOST_BITS_PER_LONG > HOST_BITS_PER_INT /*@notfunction@*/ #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG /*@notfunction@*/ #define HOST_WIDE_INT long #else /*@notfunction@*/ #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT /*@notfunction@*/ #define HOST_WIDE_INT long /* was int */ #endif #endif #ifndef S_ISREG /*@-macrounrecog@*/ #define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) /*@=macrounrecog@*/ #endif #ifndef S_ISDIR /*@-macrounrecog@*/ #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) /*@=macrounrecog@*/ #endif #ifndef INCLUDE_LEN_FUDGE /*@constant int INCLUDE_LEN_FUDGE@*/ #define INCLUDE_LEN_FUDGE 0 #endif extern size_t cppReader_checkMacroName (cppReader *p_pfile, char *p_symname, cstring p_usage); extern struct operation cppReader_parseNumber (cppReader * p_pfile, char * p_start, int p_olen) /*@requires maxRead(p_start) >= (p_olen - 1) @*/; splint-3.1.2.dfsg1/src/Headers/mtscanner.h0000644021234200000250000000112407630463447015763 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtscanner.h */ # ifndef MTSCANNER_H # define MTSCANNER_H /*@-declundef@*/ extern void mtscanner_reset (inputStream p_sourceFile) /*@modifies internalState@*/ ; /*@-redecl@*/ extern int mtlex (YYSTYPE *p_mtlval) /*@modifies internalState, p_mtlval@*/ ; /*@=redecl@*/ extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ; /* Can steal p_tok's location. */ /*@=declundef@*/ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cprim.h0000644021234200000250000000612507630463445015107 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** cprim.h */ # ifndef CPRIM_H # define CPRIM_H /* ** These numbers are not enums, since we need to extend it with all other ** types. They index entries in cttable. */ immut_typedef int cprim; /*@constant int CTX_UNKNOWN;@*/ # define CTX_UNKNOWN 0 /*@constant int CTX_VOID;@*/ # define CTX_VOID 1 /*@constant int CTX_BOOL;@*/ # define CTX_BOOL 2 /*@constant int CTX_UCHAR;@*/ # define CTX_UCHAR 3 /* unsigned char */ /*@constant int CTX_CHAR;@*/ # define CTX_CHAR 4 extern bool cprim_isUnsignedChar (/*@sef@*/ cprim p_c); # define cprim_isUnsignedChar(c) ((c) == CTX_UCHAR) extern bool cprim_isSignedChar (/*@sef@*/ cprim p_c); # define cprim_isSignedChar(c) ((c) == CTX_CHAR) extern bool cprim_isAnyChar (/*@sef@*/ cprim p_c); # define cprim_isAnyChar(c) ((c) >= CTX_UCHAR && (c) <= CTX_CHAR) /* ** only a few combiniations of type qualifiers and base types are ** recognized in the ANSI standard. Splint treats these as distinct ** types. */ /*@constant int CTX_INT;@*/ # define CTX_INT 5 /*@constant int CTX_UINT;@*/ /* unsigned int */ # define CTX_UINT 6 /*@constant int CTX_SINT;@*/ /* short int */ # define CTX_SINT 7 /*@constant int CTX_USINT;@*/ /* unsigned short int */ # define CTX_USINT 8 /*@constant int CTX_LINT;@*/ /* long int */ # define CTX_LINT 9 /*@constant int CTX_ULINT;@*/ /* unsigned long int */ # define CTX_ULINT 10 /*@constant int CTX_LLINT;@*/ /* long long int (WG14/N843) */ # define CTX_LLINT 11 /*@constant int CTX_ULLINT;@*/ /* unsigned long long int (WG14/N843) */ # define CTX_ULLINT 12 /*@constant int CTX_ANYINTEGRAL;@*/ # define CTX_ANYINTEGRAL 13 /*@constant int CTX_UNSIGNEDINTEGRAL;@*/ # define CTX_UNSIGNEDINTEGRAL 14 /*@constant int CTX_SIGNEDINTEGRAL;@*/ # define CTX_SIGNEDINTEGRAL 15 /*@constant int CTX_FLOAT;@*/ # define CTX_FLOAT 16 /*@constant int CTX_DOUBLE;@*/ # define CTX_DOUBLE 17 /*@constant int CTX_LDOUBLE;@*/ /* long double */ # define CTX_LDOUBLE 18 extern bool cprim_isAnyInt (/*@sef@*/ cprim p_c); extern bool cprim_isAnyReal (/*@sef@*/ cprim p_c); # define cprim_isAnyInt(c) ((c) >= CTX_INT && (c) <= CTX_SIGNEDINTEGRAL) extern bool cprim_isAnyUnsignedInt (/*@sef@*/ cprim p_c); # define cprim_isAnyUnsignedInt(c) ((c) == CTX_UINT || (c) == CTX_USINT \ || (c) == CTX_ULINT || (c) == CTX_ULLINT \ || (c) == CTX_UNSIGNEDINTEGRAL) # define cprim_isAnyReal(c) ((c) >= CTX_FLOAT && (c) <= CTX_LDOUBLE) /*@constant int CTX_LAST;@*/ # define CTX_LAST CTX_LDOUBLE /*@constant cprim cprim_int@*/ # define cprim_int CTX_INT extern bool cprim_equal (cprim, cprim); # define cprim_equal(p1,p2) ((p1) == (p2)) extern bool cprim_closeEnough (cprim, cprim) /*@*/ ; extern bool cprim_closeEnoughDeep (cprim, cprim) /*@*/ ; extern /*@only@*/ cstring cprim_unparse (cprim) /*@*/ ; extern cprim cprim_fromInt (int p_i); extern bool cprim_isInt(cprim p_c); extern int cprim_getExpectedBits (cprim p_c) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mttok.h0000644021234200000250000000226407630463447015135 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mttok.h */ # ifndef MTTOK_H # define MTTOK_H struct s_mttok { int tok; cstring text; fileloc loc; } ; /* in forwardTypes.h: abst_typedef struct _mttok *mttok; */ extern mttok mttok_create (int p_tok, /*@only@*/ cstring p_text, /*@only@*/ fileloc p_loc) /*@modifies nothing@*/ ; extern /*@only@*/ cstring mttok_unparse (mttok p_tok) /*@*/ ; extern void mttok_free (/*@only@*/ mttok p_t) ; extern int mttok_getTok (mttok p_t) /*@*/ ; # define mttok_getTok(t) ((t)->tok) extern /*@dependent@*/ /*@exposed@*/ fileloc mttok_getLoc (mttok p_t) /*@*/ ; # define mttok_getLoc(t) ((t)->loc) extern /*@only@*/ fileloc mttok_stealLoc (mttok p_t) /*@modifies p_t@*/ ; extern /*@only@*/ cstring mttok_getText (mttok p_t) /*@*/ ; # define mttok_getText(t) (cstring_copy ((t)->text)) extern /*@observer@*/ cstring mttok_observeText (mttok p_t) /*@*/ ; # define mttok_observeText(t) ((t)->text) extern bool mttok_isIdentifier (mttok p_t) /*@*/ ; extern bool mttok_isError (mttok p_t) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cscanner.h0000644021234200000250000000306607630463445015572 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** cscanner.h */ /*@-declundef@*/ /* Don't always check cscanner.c */ extern void cscanner_swallowMacro (void) /*@modifies internalState, fileSystem@*/ ; extern int cscanner_input (void) /*@modifies internalState, fileSystem@*/ ; extern void cscanner_unput (int) /*@modifies internalState, fileSystem@*/ ; extern int cscanner_returnFloat (ctype p_ct, double p_f) /*@modifies internalState@*/ ; extern int cscanner_returnInt (ctype p_ct, long p_i) /*@modifies internalState@*/ ; extern int cscanner_returnChar (char p_c) /*@modifies internalState@*/ ; /* ** These are all exported by bison, but not declared: */ /*@-namechecks@*/ typedef struct yy_buffer_state *YY_BUFFER_STATE; extern /*@unused@*/ void yy_switch_to_buffer (YY_BUFFER_STATE); extern /*@unused@*/ void yy_load_buffer_state (void); extern /*@unused@*/ YY_BUFFER_STATE yy_create_buffer (FILE *, int); extern /*@unused@*/ void yy_delete_buffer (YY_BUFFER_STATE); extern /*@unused@*/ void yy_init_buffer (YY_BUFFER_STATE, FILE *); extern /*@unused@*/ void yy_flush_buffer (YY_BUFFER_STATE); extern /*@unused@*/ YY_BUFFER_STATE yy_scan_buffer (char *, size_t); extern /*@unused@*/ YY_BUFFER_STATE yy_scan_string (const char *); extern /*@unused@*/ YY_BUFFER_STATE yy_scan_bytes (const char *, int); extern /*@unused@*/ char *yytext; extern /*@unused@*/ void yyerror (char *); extern /*@unused@*/ int yychar; extern /*@unused@*/ int yynerrs; /*@=namechecks@*/ /*@=declundef@*/ splint-3.1.2.dfsg1/src/Headers/mtTransferAction.h0000644021234200000250000000246607630463447017266 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtTransferAction.h */ # ifndef MTTRANSFERACTION_H # define MTTRANSFERACTION_H struct s_mtTransferAction { enum { MTAK_VALUE, MTAK_ERROR } kind; cstring value; /* for MTAK_VALUE only */ cstring message; fileloc loc; } ; extern void mtTransferAction_free (/*@only@*/ mtTransferAction p_node) ; extern cstring mtTransferAction_unparse (mtTransferAction p_node) /*@*/ ; extern mtTransferAction mtTransferAction_createValue (/*@only@*/ mttok p_value) /*@*/ ; extern /*@observer@*/ cstring mtTransferAction_getValue (mtTransferAction) /*@*/ ; # define mtTransferAction_getValue(node) ((node)->value) extern /*@observer@*/ fileloc mtTransferAction_getLoc (mtTransferAction) /*@*/ ; # define mtTransferAction_getLoc(node) ((node)->loc) extern /*@observer@*/ cstring mtTransferAction_getMessage (mtTransferAction) /*@*/ ; extern bool mtTransferAction_isError (mtTransferAction) /*@*/ ; # define mtTransferAction_isError(node) ((node)->kind == MTAK_ERROR) extern mtTransferAction mtTransferAction_createError (/*@only@*/ mttok) /*@*/ ; extern mtTransferAction mtTransferAction_createErrorMessage (/*@only@*/ mttok p_message) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cstring.h0000644021234200000250000002076507651115036015445 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** cstring.h */ # ifndef CSTRING_H # define CSTRING_H /* does this cause problems on Solaris? linux? */ /* sgi's don't like it */ # ifndef IRIX # ifdef NULL /* hack so works */ # undef NULL # endif # endif /* typedefs in forwardTypes */ extern /*@notnull@*/ cstring cstring_create (size_t p_n) /*@*/ /*@ensures maxSet(result) == p_n @*/ ; extern /*@only@*/ /*@notnull@*/ cstring cstring_newEmpty (void) ; extern /*@notnull@*/ cstring cstring_appendChar (/*@only@*/ cstring p_s1, char p_c); extern cstring cstring_concatLength (/*@only@*/ cstring p_s1, char *p_s2, size_t p_len) /*@*/ /*@requires maxSet(p_s2) >= (p_len - 1) @*/ ; extern /*@notnull@*/ cstring cstring_prependChar (char p_c, /*@temp@*/ cstring p_s1); extern /*@notnull@*/ cstring cstring_prependCharO (char p_c, /*@only@*/ cstring p_s1); extern cstring cstring_downcase (cstring p_s) /*@*/ ; extern cstring cstring_copy (cstring p_s) /*@*/ /*@ensures maxSet(result) == maxRead(p_s) /\ maxRead(result) == maxRead(p_s) @*/ ; extern cstring cstring_copyLength (char *p_s, size_t p_len) /*@*/ /*@requires maxSet(p_s) >= (p_len - 1) @*/; extern int cstring_toPosInt (cstring p_s) /*@*/ ; typedef enum { CGE_SAME, /* no differences */ CGE_DISTINCT, /* significant differences */ CGE_CASE, /* case differences */ CGE_LOOKALIKE /* lookalike differences */ } cmpcode; extern cmpcode cstring_genericEqual (cstring p_s, cstring p_t, size_t p_nchars, bool p_caseinsensitive, bool p_lookalike) /*@*/ /*@requires maxRead(p_s) >= p_nchars /\ maxRead(p_t) >= p_nchars @*/ ; /* evans 2001-09-09 - removed conditional compilation on this (for WIN32, OS2) */ extern void cstring_replaceAll (cstring p_s, char p_old, char p_snew) /*@modifies p_s@*/ ; extern void cstring_replaceLit (/*@unique@*/ cstring p_s, char *p_old, char *p_snew) /*@modifies p_s@*/ /*@requires maxRead(p_snew) >= 0 /\ maxRead(p_old) >= 0 /\ maxRead(p_old) >= maxRead(p_snew) @*/; extern char cstring_firstChar (cstring p_s) /*@*/ ; extern char cstring_secondChar (cstring p_s) /*@*/ ; extern char cstring_lastChar (cstring p_s) /*@*/ ; extern char cstring_getChar (cstring p_s, size_t p_n); extern void cstring_setChar (cstring p_s, size_t p_n, char p_c) /*@requires maxRead(p_s) >= (p_n - 1) /\ maxSet(p_s) >= (p_n - 1) @*/ ; # define cstring_secondChar(s) cstring_getChar (s, 2) extern /*@exposed@*/ /*@notnull@*/ /*@untainted@*/ char * cstring_toCharsSafe (/*@temp@*/ /*@exposed@*/ /*@returned@*/ cstring p_s) /*@*/ ; extern size_t cstring_length (cstring p_s) /*@*/ /*@ensures result == maxRead(p_s) @*/; extern bool cstring_contains (/*@unique@*/ cstring p_c, cstring p_sub) /*@*/ ; extern bool cstring_containsChar (cstring p_c, char p_ch) /*@*/ ; extern bool cstring_equal (cstring p_c1, cstring p_c2) /*@*/ ; extern bool cstring_equalCaseInsensitive (cstring p_c1, cstring p_c2) /*@*/ ; extern bool cstring_equalLen (cstring p_c1, cstring p_c2, size_t p_len) /*@*/ ; extern bool cstring_equalLenCaseInsensitive (cstring p_c1, cstring p_c2, size_t p_len) /*@*/ ; extern bool cstring_equalPrefix (cstring p_c1, cstring p_c2) /*@*/ ; extern bool cstring_equalPrefixLit (cstring p_c1, /*@observer@*/ const char *p_c2) /*@*/ ; extern bool cstring_equalLit (cstring p_c1, char *p_c2) /*@*/ ; extern int cstring_compare (cstring p_c1, cstring p_c2) /*@*/ ; extern int cstring_xcompare (cstring *p_c1, cstring *p_c2) /*@*/ ; extern bool cstring_hasNonAlphaNumBar (cstring p_s) /*@*/ ; extern cstring cstring_elide (cstring p_s, size_t p_len) /*@*/ ; extern cstring cstring_clip (/*@returned@*/ cstring p_s, size_t p_len) /*@modifies p_s@*/ ; extern void cstring_stripChars (cstring p_s, const char *p_clist) /*@modifies p_s@*/ ; extern /*@dependent@*/ cstring cstring_bsearch (cstring p_key, char **p_table, int p_nentries); extern bool cstring_lessthan (cstring p_s1, cstring p_s2) /*@*/ ; # define cstring_lessthan(s1, s2) (cstring_compare (s1, s2) < 0) # define cstring_equalLit(s, lit) \ (mstring_equal (cstring_toCharsSafe (s), lit)) extern bool cstring_equalFree (/*@only@*/ cstring p_c1, /*@only@*/ cstring p_c2); /* really exposed! */ /* ** Don't allow tainted cstring's */ extern cstring cstring_fromChars (/*@returned@*/ /*@null@*/ const /*@exposed@*/ /*@temp@*/ char *p_cp) /*@*/ ; extern cstring cstring_fromCharsO (/*@null@*/ /*@only@*/ char *p_cp) /*@*/ ; /*@-mustfree@*/ # define cstring_fromCharsO(s) cstring_fromChars(s) /*@=mustfree@*/ extern cstring cstring_fromCharsNew (/*@null@*/ char *p_s) /*@*/ ; # define cstring_fromCharsNew(s) cstring_copy(cstring_fromChars(s)) extern /*@exposed@*/ /*@notnull@*/ /*@untainted@*/ char *cstring_toCharsSafeO (/*@only@*/ /*@exposed@*/ /*@returned@*/ cstring p_s); /*@-mustfree@*/ # define cstring_toCharsSafeO(s) cstring_toCharsSafe(s) /*@=mustfree@*/ extern void cstring_free (/*@only@*/ cstring p_s); /*@constant null cstring cstring_undefined;@*/ # define cstring_undefined ((cstring)NULL) extern /*@falsewhennull@*/ bool cstring_isDefined (cstring p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool cstring_isUndefined (cstring p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool cstring_isEmpty (cstring p_s) /*@*/ ; extern /*@falsewhennull@*/ bool cstring_isNonEmpty (cstring p_s) /*@*/ ; # define cstring_isDefined(s) ((s) != cstring_undefined) # define cstring_isUndefined(s) (!cstring_isDefined(s)) # define cstring_isEmpty(s) (cstring_length(s) == 0) # define cstring_isNonEmpty(s) (!cstring_isEmpty(s)) extern cstring cstring_makeLiteral (char *) /*@*/ ; extern /*@observer@*/ /*@dependent@*/ cstring cstring_makeLiteralTemp (char *) /*@*/ ; # define cstring_makeLiteral(s) (cstring_copy (cstring_fromChars (s))) # define cstring_makeLiteralTemp(s) (cstring_fromChars (s)) extern cstring cstring_capitalize (cstring p_s) /*@*/ /*@requires maxSet(p_s) >= 0 @*/ ; extern cstring cstring_capitalizeFree (/*@only@*/ cstring p_s) /*@modifies p_s@*/ /*@requires maxSet(p_s) >= 0 /\ maxRead(p_s) >= 0 @*/ ; extern cstring cstring_fill (cstring p_s, size_t p_n) /*@*/ /*@requires p_n >= 0 @*/; extern cstring cstring_prefix (cstring p_s, size_t p_n) /*@*/ /*@requires maxRead(p_s) >= p_n /\ maxSet(p_s) >= p_n @*/ /*@ensures maxRead(result) == p_n /\ maxSet(result) == p_n @*/ ; extern /*@observer@*/ cstring cstring_suffix (cstring p_s, size_t p_n) /*@*/ ; extern cstring cstring_concat (cstring p_s, cstring p_t) /*@*/ /*@requires maxSet(p_s) >= 0 @*/; extern cstring cstring_concatFree (/*@only@*/ cstring p_s, /*@only@*/ cstring p_t) /*@modifies p_s, p_t@*/ ; extern cstring cstring_concatFree1 (/*@only@*/ cstring p_s, cstring p_t) /*@modifies p_s@*/ ; extern cstring cstring_concatChars (/*@only@*/ cstring p_s, char *p_t) /*@modifies p_s@*/ ; extern lsymbol cstring_toSymbol (/*@only@*/ cstring p_s) /*@*/ ; extern void cstring_markOwned (/*@owned@*/ cstring p_s) /*@modifies p_s@*/ ; extern cstring cstring_beforeChar (cstring p_s, char p_c) /*@*/ ; extern /*@exposed@*/ cstring cstring_afterChar (cstring p_s, char p_c) /*@*/ ; /*@iter cstring_chars (sef cstring s, yield char c);@*/ # define cstring_chars(s, m_c) \ if (cstring_isDefined (s)) \ { char *m_current = (char *) (s); \ char m_c; \ for (; (m_c = *m_current) != '\0'; m_current++) { # define end_cstring_chars }} extern /*@observer@*/ cstring cstring_advanceWhiteSpace (cstring) /*@*/ ; extern /*@only@*/ /*@notnull@*/ cstring cstring_copySegment (cstring p_s, size_t p_findex, size_t p_tindex) /*@*/ ; /*drl added 01/22/2001 Expands the escape squences i.e "\\n\\t\\000" becomes "\n\t0" */ extern /*@notnull@*/ cstring cstring_expandEscapes (cstring p_s); /*drl added 01/23/2001 Gives you the number of characters in an expanded escape squences. This can be different from strlen bc/ of escaped nulls. */ extern size_t cstring_lengthExpandEscapes (cstring p_s); extern bool cstring_containsLit (/*@unique@*/ cstring p_c, char *p_sub) /*@*/ ; # define cstring_containsLit(c,sub) \ (cstring_contains (c, cstring_fromChars (sub))) /*drl added July 2, 001 */ extern int cstring_compareLit (/*@unique@*/ cstring p_c, char *p_sub) /*@*/ ; # define cstring_compareLit(c,sub) \ (cstring_compare (c, cstring_fromChars (sub))) /*drl added 2/4/2002*/ /*replaces every instance of the character old with the character new old can not be '\0' */ cstring cstring_replaceChar(/*@returned@*/ cstring p_c, char p_oldChar, char p_newChar); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtTransferClause.h0000644021234200000250000000240207630463447017253 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtTransferClause.h */ # ifndef MTTRANSFERCLAUSE_H # define MTTRANSFERCLAUSE_H struct s_mtTransferClause { fileloc loc; cstring fromname; cstring toname; mtTransferAction action; } ; extern cstring mtTransferClause_unparse (mtTransferClause p_node) /*@*/ ; extern mtTransferClause mtTransferClause_create (/*@only@*/ mttok p_fromname, /*@only@*/ mttok p_toname, /*@only@*/ mtTransferAction p_action) /*@*/ ; extern /*@observer@*/ cstring mtTransferClause_getFrom (mtTransferClause) /*@*/ ; # define mtTransferClause_getFrom(p_trans) ((p_trans)->fromname) extern /*@observer@*/ cstring mtTransferClause_getTo (mtTransferClause) /*@*/ ; # define mtTransferClause_getTo(p_trans) ((p_trans)->toname) extern /*@observer@*/ mtTransferAction mtTransferClause_getAction (mtTransferClause) /*@*/ ; # define mtTransferClause_getAction(p_trans) ((p_trans)->action) extern /*@observer@*/ fileloc mtTransferClause_getLoc (mtTransferClause) /*@*/ ; # define mtTransferClause_getLoc(p_trans) ((p_trans)->loc) extern void mtTransferClause_free (/*@only@*/ mtTransferClause p_transfer) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cstringList.h0000644021234200000250000000522107646432517016301 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef cstringList_H # define cstringList_H abst_typedef /*@null@*/ struct s_cstringList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_cstring *elements; } *cstringList ; /*@constant null cstringList cstringList_undefined;@*/ # define cstringList_undefined ((cstringList) NULL) extern /*@falsewhennull@*/ bool cstringList_isDefined (cstringList p_s) /*@*/ ; # define cstringList_isDefined(s) ((s) != cstringList_undefined) extern int cstringList_size (/*@sef@*/ cstringList) /*@*/ ; # define cstringList_size(s) (cstringList_isDefined (s) ? (s)->nelements : 0) extern /*@unused@*/ /*@falsewhennull@*/ bool cstringList_empty (/*@sef@*/ cstringList) /*@*/ ; # define cstringList_empty(s) (cstringList_size(s) == 0) extern cstring cstringList_unparseSep (cstringList p_s, cstring p_sep) /*@*/ ; extern /*@exposed@*/ /*@null@*/ ob_cstring *cstringList_getElements (cstringList) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstringList cstringList_new (void) /*@*/ ; extern /*@only@*/ cstringList cstringList_single (/*@keep@*/ cstring p_el) /*@*/ ; extern cstringList cstringList_add (/*@returned@*/ cstringList p_s, /*@keep@*/ cstring p_el) /*@modifies p_s@*/ ; extern /*@only@*/ cstringList cstringList_prepend (/*@only@*/ /*@returned@*/ cstringList p_s, /*@keep@*/ cstring p_el) /*@modifies p_s@*/ ; extern bool cstringList_contains (cstringList p_s, cstring p_key) /*@*/ ; extern int cstringList_getIndex (cstringList p_s, cstring p_key) /*@*/ ; extern /*@observer@*/ cstring cstringList_get (cstringList p_s, int p_index) /*@*/ ; extern /*@unused@*/ void cstringList_alphabetize (cstringList p_s); extern /*@unused@*/ /*@only@*/ cstring cstringList_unparseAbbrev (cstringList p_s) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstring cstringList_unparse (cstringList p_s) ; extern void cstringList_free (/*@only@*/ cstringList p_s) ; extern /*@unused@*/ void cstringList_printSpaced (cstringList p_s, size_t p_indent, size_t p_gap, int p_linelen); extern /*@only@*/ cstringList cstringList_copy (cstringList p_s) /*@*/ ; /*@constant int cstringListBASESIZE;@*/ # define cstringListBASESIZE MIDBASESIZE /*@iter cstringList_elements (sef cstringList x, yield exposed cstring el); @*/ # define cstringList_elements(x, m_el) \ { if (cstringList_isDefined (x)) { \ int m_ind; cstring *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { cstring m_el = *(m_elements++); # define end_cstringList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtTransferClauseList.h0000644021234200000250000000466107651115037020110 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef MTTRANSFERCLAUSELIST_H # define MTTRANSFERCLAUSELIST_H /*:private:*/ typedef /*@only@*/ mtTransferClause o_mtTransferClause; struct s_mtTransferClauseList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_mtTransferClause *elements; } ; /*@constant null mtTransferClauseList mtTransferClauseList_undefined;@*/ # define mtTransferClauseList_undefined ((mtTransferClauseList) NULL) extern /*@falsewhennull@*/ bool mtTransferClauseList_isDefined (mtTransferClauseList p_s) /*@*/ ; # define mtTransferClauseList_isDefined(s) ((s) != mtTransferClauseList_undefined) extern int mtTransferClauseList_size (/*@sef@*/ mtTransferClauseList) /*@*/ ; # define mtTransferClauseList_size(s) (mtTransferClauseList_isDefined (s) ? (s)->nelements : 0) extern /*@unused@*/ /*@falsewhennull@*/ bool mtTransferClauseList_empty (/*@sef@*/ mtTransferClauseList) /*@*/ ; # define mtTransferClauseList_empty(s) (mtTransferClauseList_size(s) == 0) extern cstring mtTransferClauseList_unparseSep (mtTransferClauseList p_s, cstring p_sep) /*@*/ ; extern /*@unused@*/ /*@only@*/ mtTransferClauseList mtTransferClauseList_new (void) /*@*/ ; extern /*@only@*/ mtTransferClauseList mtTransferClauseList_single (/*@only@*/ mtTransferClause p_el) /*@*/ ; extern mtTransferClauseList mtTransferClauseList_add (/*@only@*/ mtTransferClauseList p_s, /*@only@*/ mtTransferClause p_el) /*@modifies p_s@*/ ; extern /*@only@*/ mtTransferClauseList mtTransferClauseList_prepend (/*@only@*/ mtTransferClauseList p_s, /*@only@*/ mtTransferClause p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring mtTransferClauseList_unparse (mtTransferClauseList p_s) ; extern void mtTransferClauseList_free (/*@only@*/ mtTransferClauseList p_s) ; /*@constant int mtTransferClauseListBASESIZE;@*/ # define mtTransferClauseListBASESIZE MIDBASESIZE /*@iter mtTransferClauseList_elements (sef mtTransferClauseList x, yield exposed mtTransferClause el); @*/ # define mtTransferClauseList_elements(x, m_el) \ { if (mtTransferClauseList_isDefined (x)) { \ int m_ind; mtTransferClause *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { mtTransferClause m_el = *(m_elements++); # define end_mtTransferClauseList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cstringSList.h0000644021234200000250000000433207630463445016423 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef cstringSList_H # define cstringSList_H typedef /*@observer@*/ cstring ob_cstring; struct s_cstringSList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ ob_cstring *elements; } ; /*@constant null cstringSList cstringSList_undefined;@*/ # define cstringSList_undefined ((cstringSList) NULL) extern /*@falsewhennull@*/ bool cstringSList_isDefined (cstringSList p_s) /*@*/ ; # define cstringSList_isDefined(s) ((s) != cstringSList_undefined) extern int cstringSList_size (/*@sef@*/ cstringSList) /*@*/ ; # define cstringSList_size(s) (cstringSList_isDefined (s) ? (s)->nelements : 0) extern /*@falsewhennull@*/ bool cstringSList_empty (/*@sef@*/ cstringSList) /*@*/ ; # define cstringSList_empty(s) (cstringSList_size(s) == 0) extern /*@unused@*/ cstring cstringSList_unparseSep (cstringSList p_s, cstring p_sep) /*@*/ ; extern /*@only@*/ cstringSList cstringSList_new (void) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstringSList cstringSList_single (/*@exposed@*/ cstring p_el) /*@*/ ; extern cstringSList cstringSList_add (/*@returned@*/ cstringSList p_s, /*@exposed@*/ cstring p_el) /*@modifies p_s@*/ ; extern void cstringSList_alphabetize (cstringSList p_s); extern /*@observer@*/ cstring cstringSList_get (cstringSList p_s, int p_index) /*@*/ ; extern /*@only@*/ cstring cstringSList_unparseAbbrev (cstringSList p_s) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstring cstringSList_unparse (cstringSList p_s) /*@*/ ; extern void cstringSList_free (/*@only@*/ cstringSList p_s) ; extern void cstringSList_printSpaced (cstringSList p_s, size_t p_indent, size_t p_gap, int p_linelen); /*@constant int cstringSListBASESIZE;@*/ # define cstringSListBASESIZE MIDBASESIZE /*@iter cstringSList_elements (sef cstringSList x, yield exposed cstring el); @*/ # define cstringSList_elements(x, m_el) \ { if (cstringSList_isDefined (x)) { \ int m_ind; cstring *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { cstring m_el = *(m_elements++); # define end_cstringSList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mtValuesNode.h0000644021234200000250000000122307646432517016400 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mtValuesNode.h */ # ifndef MTVALUESNODE_H # define MTVALUESNODE_H struct s_mtValuesNode { cstringList values; } ; extern mtValuesNode mtValuesNode_create (/*@only@*/ cstringList p_values) /*@*/ ; extern void mtValuesNode_free (/*@only@*/ mtValuesNode) ; extern cstring mtValuesNode_unparse (mtValuesNode p_node) /*@*/ ; extern /*@observer@*/ cstringList mtValuesNode_getValues (mtValuesNode p_node) /*@*/ ; # define mtValuesNode_getValues(node) ((node)->values) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cstringTable.h0000644021234200000250000000405710102766474016414 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** cstringTable.h */ # ifndef CSTRINGTABLE_H # define CSTRINGTABLE_H /*@constant int HBUCKET_BASESIZE; @*/ # define HBUCKET_BASESIZE 2 /*@constant int HBUCKET_DNE; @*/ # define HBUCKET_DNE NOT_FOUND /* in forwardTypes: abst_typedef null struct _cstringTable *cstringTable; */ /*:private:*/ typedef struct { /*@only@*/ cstring key; int val; } *hentry; /*:private:*/ typedef /*@only@*/ hentry o_hentry; typedef /*@null@*/ struct { int size; int nspace; /*@only@*/ o_hentry *entries; } *hbucket; typedef /*@only@*/ hbucket o_hbucket; struct s_cstringTable { unsigned long size; unsigned long nentries; /*@only@*/ o_hbucket *buckets; } ; /*@constant null cstringTable cstringTable_undefined; @*/ # define cstringTable_undefined ((cstringTable) NULL) extern /*@falsewhennull@*/ bool cstringTable_isDefined(cstringTable) /*@*/ ; # define cstringTable_isDefined(p_h) ((p_h) != cstringTable_undefined) extern /*@nullwhentrue@*/ /*@unused@*/ bool cstringTable_isUndefined(cstringTable) /*@*/ ; # define cstringTable_isUndefined(p_h) ((p_h) == cstringTable_undefined) extern /*@only@*/ cstringTable cstringTable_create(unsigned long p_size) /*@*/ ; extern void cstringTable_insert (cstringTable p_h, /*@only@*/ cstring p_key, int p_value) /*@modifies p_h@*/ ; extern int cstringTable_lookup (cstringTable p_h, cstring p_key); extern /*@unused@*/ /*@only@*/ cstring cstringTable_stats(cstringTable p_h); extern void cstringTable_free (/*@only@*/ cstringTable p_h); extern void cstringTable_remove (cstringTable p_h, cstring p_key) /*@modifies p_h@*/ ; extern /*@unused@*/ cstring cstringTable_unparse (cstringTable) /*@*/ ; extern /*@unused@*/ void cstringTable_update (cstringTable p_h, cstring p_key, int p_newval) /*@modifies p_h@*/ ; extern void cstringTable_replaceKey (cstringTable p_h, cstring p_oldkey, /*@only@*/ cstring p_newkey); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/multiVal.h0000644021234200000250000000506307415477017015573 0ustar fax/* ** multiVal.h */ # ifndef MULTIVAL_H # define MULTIVAL_H typedef enum { MVLONG, MVCHAR, MVDOUBLE, MVSTRING } mvkind; typedef /*@null@*/ struct { mvkind kind; union { long int ival; char cval; double fval; /*@only@*/ cstring sval; } value; } *multiVal; extern /*@falsewhennull@*/ bool multiVal_isDefined (multiVal p_m) /*@*/ ; extern /*@nullwhentrue@*/ bool multiVal_isUndefined (multiVal p_m) /*@*/ ; extern /*@nullwhentrue@*/ bool multiVal_isUnknown (multiVal p_m) /*@*/ ; extern multiVal multiVal_add (multiVal p_m1, multiVal p_m2) /*@*/ ; extern multiVal multiVal_subtract (multiVal p_m1, multiVal p_m2) /*@*/ ; extern multiVal multiVal_multiply (multiVal p_m1, multiVal p_m2) /*@*/ ; extern multiVal multiVal_divide (multiVal p_m1, multiVal p_m2) /*@*/ ; /*@constant null multiVal multiVal_undefined; @*/ # define multiVal_undefined (multiVal)NULL # define multiVal_isDefined(m) ((m) != multiVal_undefined) # define multiVal_isUndefined(m) ((m) == multiVal_undefined) # define multiVal_isUnknown(m) ((m) == multiVal_undefined) extern /*@observer@*/ /*@dependent@*/ cstring multiVal_forceString (multiVal p_m) /*@*/ ; extern /*@unused@*/ double multiVal_forceDouble (multiVal p_m) /*@*/ ; extern char multiVal_forceChar (multiVal p_m) /*@*/ ; extern long multiVal_forceInt (multiVal p_m) /*@*/ ; extern /*@only@*/ multiVal multiVal_makeString (/*@only@*/ cstring p_s) /*@*/ ; extern /*@only@*/ multiVal multiVal_makeDouble (double p_x) /*@*/ ; extern /*@only@*/ multiVal multiVal_makeChar (char p_x) /*@*/ ; extern /*@only@*/ multiVal multiVal_makeInt (long p_x) /*@*/ ; extern /*@only@*/ multiVal multiVal_unknown (void) /*@*/ ; extern /*@only@*/ multiVal multiVal_copy (multiVal p_m) /*@*/ ; extern void multiVal_free (/*@only@*/ multiVal p_m); extern multiVal multiVal_invert (multiVal p_m) /*@*/ ; extern /*@falsewhennull@*/ bool multiVal_isInt (multiVal p_m) /*@*/ ; extern /*@falsewhennull@*/ bool multiVal_isChar (multiVal p_m) /*@*/ ; extern /*@falsewhennull@*/ bool multiVal_isDouble (multiVal p_m) /*@*/ ; extern /*@falsewhennull@*/ bool multiVal_isString (multiVal p_m) /*@*/ ; extern /*@only@*/ multiVal multiVal_undump (char **p_s) /*@modifies *p_s;@*/ ; extern /*@only@*/ cstring multiVal_dump (multiVal p_m) /*@*/ ; extern /*@only@*/ cstring multiVal_unparse (multiVal p_m) /*@*/ ; extern int multiVal_compare (multiVal p_m1, multiVal p_m2) /*@*/ ; extern bool multiVal_equiv (multiVal p_m1, multiVal p_m2) /*@*/ ; # define multiVal_equiv(m1,m2) ((multiVal_compare(m1, m2)) == 0) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/ctokens.h0000644021234200000250000000015607121317325015427 0ustar fax# ifndef CTOKENS # define CTOKENS # include "cgramtoks.h" # else # error "Multiple include" # endif CTOKENS splint-3.1.2.dfsg1/src/Headers/nameChecks.h0000644021234200000250000000142107646432517016033 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef NAMECHECKS_H # define NAMECHECKS_H extern void checkCppName (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; extern void checkExternalName (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; extern void checkLocalName (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; extern void checkFileScopeName (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; extern void checkPrefix (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; extern void checkAnsiName (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; extern void checkParamNames (uentry p_ue) /*@modifies g_warningstream@*/; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/ctypeList.h0000644021234200000250000000374307630463445015760 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef ctypeLIST_H # define ctypeLIST_H /* ** there is a special ctypeList used to represent the () argument list ** this has nelements = -1 ** ** (that is, not void, so any number of arguments is okay.) */ struct s_ctypeList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ ctype *elements; } ; extern int ctypeList_size (/*@sef@*/ ctypeList p_s) /*@*/ ; # define ctypeList_size(s) (ctypeList_isDefined(s) ? (s)->nelements : 0) extern /*@only@*/ ctypeList ctypeList_new(void); extern void ctypeList_addh (ctypeList p_s, ctype p_el) /*@modifies p_s@*/; extern /*@only@*/ ctypeList ctypeList_append (/*@returned@*/ /*@only@*/ ctypeList p_s1, ctypeList p_s2) /*@modifies p_s1@*/ ; extern ctypeList ctypeList_add (/*@only@*/ ctypeList p_s, ctype p_el) /*@modifies p_s@*/; extern /*@unused@*/ /*@only@*/ cstring ctypeList_unparse (ctypeList) /*@*/ ; extern void ctypeList_free (/*@only@*/ /*@only@*/ ctypeList p_s) /*@modifies p_s@*/; extern /*@falsewhennull@*/ bool ctypeList_isDefined (/*@null@*/ ctypeList p_ct) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool ctypeList_isUndefined (/*@null@*/ ctypeList p_ct) /*@*/ ; /*@constant null ctypeList ctypeList_undefined; @*/ # define ctypeList_undefined ((ctypeList) NULL) # define ctypeList_isDefined(ct) ((ct) != ctypeList_undefined) # define ctypeList_isUndefined(ct) ((ct) == ctypeList_undefined) /*@iter ctypeList_elements (sef ctypeList x, yield ctype el); @*/ # define ctypeList_elements(x, m_el) \ { if (!ctypeList_isUndefined(x)) \ { int m_ind; ctype *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { ctype m_el = *(m_elements++); # define end_ctypeList_elements }}} /*@constant int ctypeListBASESIZE;@*/ # define ctypeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/nameNode.h0000644021234200000250000000110607630463447015517 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { bool isOpId; /* TRUE means is opId */ union { ltoken opid; /*@null@*/ opFormNode opform; } content; } *nameNode; extern void nameNode_free (/*@null@*/ /*@only@*/ nameNode p_n); extern /*@only@*/ /*@null@*/ nameNode nameNode_copy (/*@null@*/ nameNode p_n) /*@*/ ; extern /*@only@*/ cstring nameNode_unparse (/*@null@*/ nameNode p_n) /*@*/ ; extern /*@only@*/ nameNode nameNode_copySafe (nameNode p_n) /*@*/ ; splint-3.1.2.dfsg1/src/Headers/CTypesNode.h0000644021234200000250000000034407630463445016007 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { bits intfield; sort sort; ltokenList ctypes; } *CTypesNode; splint-3.1.2.dfsg1/src/Headers/opFormNode.h0000644021234200000250000000137407630463447016050 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef enum { OPF_IF, OPF_ANYOP, OPF_MANYOP, OPF_ANYOPM, OPF_MANYOPM, OPF_MIDDLE, OPF_MMIDDLE, OPF_MIDDLEM, OPF_MMIDDLEM, OPF_BMIDDLE, OPF_BMMIDDLE, OPF_BMIDDLEM, OPF_BMMIDDLEM, OPF_SELECT, OPF_MAP, OPF_MSELECT, OPF_MMAP } opFormKind; typedef union { int middle; ltoken anyop; ltoken id; } opFormUnion; struct s_opFormNode { ltoken tok; /* keeps the openSym token */ opFormKind kind; opFormUnion content; unsigned long int key; ltoken close; /* keeps the closeSym token */ } ; extern /*@unused@*/ /*@only@*/ cstring opFormNode_unparse (/*@null@*/ opFormNode p_n) /*@*/ ; splint-3.1.2.dfsg1/src/Headers/cvar.h0000644021234200000250000000035107630463445014723 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** cvar.h */ # ifndef CVAR_H # define CVAR_H # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/osd.h0000644021234200000250000001207407651115037014554 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** osd.h */ # ifndef OSD_H # define OSD_H /* Macro to substitute for ## because VAX C currently doesn't allow it. */ # ifdef __STDC__ /* Use an intermediate paste macro so PASTE macro arguments will get */ /* evaluated. Therefore, PASTE(PASTE(a,b),c) will work. */ /*@notfunction@*/ # define IPASTE(L,R) L ## R /*@notfunction@*/ # define PASTE(L,R) IPASTE(L,R) # else /*@notfunction@*/ # define PASTE(L,R ) L/**/R # endif /* Macro to substitute for # because VAX C currently doesn't allow it. */ # ifdef __STDC__ /*@notfunction@*/ # define ISTR(x) # x /*@notfunction@*/ # define STR(x) ISTR(x) # else /*@notfunction@*/ # define ISTR(x) "x" /*@notfunction@*/ # define STR(x) ISTR(x) # endif /* ** MAXPATHLEN defines the longest permissable path length. ** ** POSIX defines PATHMAX in limits.h */ # ifdef PATH_MAX /*@constant size_t MAXPATHLEN; @*/ # define MAXPATHLEN PATH_MAX # else /*@constant size_t MAXPATHLEN; @*/ # define MAXPATHLEN 1024 # endif typedef enum { OSD_FILEFOUND, OSD_FILENOTFOUND, OSD_PATHTOOLONG } filestatus; extern /*@only@*/ cstring LSLRootName (cstring p_filespec) /*@*/ ; extern filestatus osd_getPath (cstring p_path, cstring p_file, /*@out@*/ cstring *p_returnPath) /*@modifies *p_returnPath@*/ ; extern filestatus osd_getExePath (cstring p_path, cstring p_file, /*@out@*/ cstring *p_returnPath) /*@modifies *p_returnPath@*/ ; extern bool osd_fileExists (cstring p_filespec) /*@*/ ; extern /*@observer@*/ cstring osd_getEnvironment (cstring p_env, /*@returned@*/ cstring p_def) /*@*/ ; extern filestatus osd_findOnLarchPath (cstring p_file, /*@out@*/ cstring *p_returnPath) /*@modifies *p_returnPath@*/ ; extern void osd_setTempError (void) /*@modifies internalState@*/ ; extern /*@observer@*/ cstring osd_getHomeDir (void) /*@*/ ; extern /*@observer@*/ cstring osd_getEnvironmentVariable (cstring) ; /*@constant int CALL_SUCCESS@*/ # define CALL_SUCCESS 0 extern int osd_system (cstring p_cmd) /*@modifies fileSystem@*/ ; extern cstring osd_absolutePath (cstring p_cwd, cstring p_filename) /*@*/ ; extern /*@only@*/ cstring osd_outputPath (cstring p_filename) /*@*/ ; extern void osd_initMod (void) /*@modifies internalState@*/ ; extern void osd_destroyMod (void) /*@modifies internalState@*/ ; extern bool osd_equalCanonicalPrefix (cstring p_dirpath, cstring p_prefixpath) /*@*/ ; extern int osd_unlink (cstring) /*@modifies fileSystem@*/ ; extern cstring osd_fixDefine (cstring); extern bool osd_fileIsReadable (cstring); extern bool osd_isConnectChar (char) /*@*/ ; extern /*@observer@*/ cstring osd_getCurrentDirectory (void) /*@*/ ; # ifdef WIN32 extern int osd_getPid (void) ; # else extern int /*pid_t*/ osd_getPid (void) ; # endif # ifdef WIN32 /* Win32 doesn't support ISO C99 correctly... */ # define snprintf _snprintf # endif /* ** Win32 convention? */ # if defined(__IBMC__) && defined(OS2) # define S_IFMT (unsigned short)0xFFFF # endif # if defined (OS2) || defined (MSDOS) || defined (WIN32) /*@constant observer cstring INCLUDEPATH_VAR@*/ # define INCLUDEPATH_VAR cstring_makeLiteralTemp ("INCLUDE") # else /*@constant observer cstring INCLUDEPATH_VAR@*/ # define INCLUDEPATH_VAR cstring_makeLiteralTemp ("CPATH") # endif #if defined (VMS) /* ** VMS is here, but hasn't been tested for many releases. Not sure if this works. */ /* ** Connection string inserted between directory and filename to make a ** full path name. */ # define CONNECTSTR ":" # define CONNECTCHAR ':' /* Directory separator character for search list. */ /*@constant static char PATH_SEPARATOR; @*/ # define PATH_SEPARATOR ':' # elif defined(MSDOS) || defined(OS2) || defined(WIN32) /* Connection string inserted between directory and filename to make a */ /* full path name. */ /*@constant observer char *CONNECTSTR@*/ # define CONNECTSTR "\\" /*@constant char CONNECTCHAR@*/ # define CONNECTCHAR '\\' # define HASALTCONNECTCHAR /*@constant char ALTCONNECTCHAR@*/ # define ALTCONNECTCHAR '/' /* Directory separator character for search list. */ /*@constant char PATH_SEPARATOR; @*/ # define PATH_SEPARATOR ';' #else /* Connection string inserted between directory and filename to make a */ /* full path name. */ /*@constant observer char *CONNECTSTR@*/ # define CONNECTSTR "/" /*@constant char CONNECTCHAR; @*/ # define CONNECTCHAR '/' /* Directory separator character for search list. */ /*@constant char PATH_SEPARATOR; @*/ # define PATH_SEPARATOR ':' #endif # ifdef P_tmpdir # if defined(OS2) && defined(__IBMC__) /*@constant observer char *DEFAULT_TMPDIR; @*/ # define DEFAULT_TMPDIR "." # else /*@constant observer char *DEFAULT_TMPDIR; @*/ # define DEFAULT_TMPDIR P_tmpdir # endif # else # ifdef WIN32 /*@constant observer char *DEFAULT_TMPDIR; @*/ # define DEFAULT_TMPDIR "\\WINDOWS\\TEMP\\" # else /*@constant observer char *DEFAULT_TMPDIR; @*/ # define DEFAULT_TMPDIR "/tmp/" # endif /* WIN32 */ # endif /* P_tmpdir */ # else # error "Multiple include" # endif \ splint-3.1.2.dfsg1/src/Headers/declaratorInvNode.h0000644021234200000250000000064507630463445017401 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** declaratorInvNode.h */ typedef struct { declaratorNode declarator; abstBodyNode body; } *declaratorInvNode; extern void declaratorInvNode_free (/*@only@*/ /*@null@*/ declaratorInvNode p_x); extern /*@only@*/ cstring declaratorInvNode_unparse (declaratorInvNode p_d); splint-3.1.2.dfsg1/src/Headers/pairNode.h0000644021234200000250000000056507630463447015542 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** pairNode.h ** ** needs sort_type.h, ltoken_type.h */ typedef struct { sort sort; ltoken tok; /* enable error message to pinpoint location */ } *pairNode; extern void pairNode_free (/*@only@*/ /*@null@*/ pairNode p_x); splint-3.1.2.dfsg1/src/Headers/declaratorInvNodeList.h0000644021234200000250000000265607630463445020241 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef DECLARATORINVNODELIST_H # define DECLARATORINVNODELIST_H typedef /*@only@*/ declaratorInvNode o_declaratorInvNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_declaratorInvNode *elements; } *declaratorInvNodeList ; /*@iter declaratorInvNodeList_elements (sef declaratorInvNodeList x, yield exposed declaratorInvNode el); @*/ # define declaratorInvNodeList_elements(x, m_el) \ { int m_ind; declaratorInvNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { declaratorInvNode m_el = *(m_elements++); # define end_declaratorInvNodeList_elements }} extern int declaratorInvNodeList_size (declaratorInvNodeList); # define declaratorInvNodeList_size(d) ((d)->nelements) extern /*@only@*/ declaratorInvNodeList declaratorInvNodeList_new(void); extern declaratorInvNodeList declaratorInvNodeList_add (/*@returned@*/ declaratorInvNodeList p_s, /*@only@*/ declaratorInvNode p_el); extern /*@only@*/ cstring declaratorInvNodeList_unparse (declaratorInvNodeList p_s) ; extern void declaratorInvNodeList_free (/*@only@*/ declaratorInvNodeList p_s) ; /*@constant int declaratorInvNodeListBASESIZE;@*/ # define declaratorInvNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/pairNodeList.h0000644021234200000250000000262607630463447016376 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef PAIRNODELIST_H # define PAIRNODELIST_H typedef /*@only@*/ pairNode o_pairNode; abst_typedef /*@null@*/ struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_pairNode *elements; } *pairNodeList ; /*@iter pairNodeList_elements (sef pairNodeList x, yield exposed pairNode el); @*/ # define pairNodeList_elements(x, m_el) \ if (pairNodeList_isDefined (x)) \ { int m_ind; pairNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { pairNode m_el = *(m_elements++); # define end_pairNodeList_elements }} extern /*@falsewhennull@*/ bool pairNodeList_isDefined (pairNodeList p_p) /*@*/ ; /*@constant null pairNodeList pairNodeList_undefined; @*/ # define pairNodeList_undefined ((pairNodeList)0) # define pairNodeList_isDefined(p) ((p) != pairNodeList_undefined) extern /*@only@*/ pairNodeList pairNodeList_new(void) /*@*/ ; extern void pairNodeList_addh (pairNodeList p_s, /*@keep@*/ pairNode p_el) /*@modifies p_s@*/ ; extern /*@only@*/ cstring pairNodeList_unparse (pairNodeList p_s) /*@*/ ; extern void pairNodeList_free (/*@only@*/ pairNodeList p_s) ; /*@constant int pairNodeListBASESIZE;@*/ # define pairNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/declaratorNode.h0000644021234200000250000000063107630463445016717 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** declaratorNode.h */ typedef struct { ltoken id; /*@null@*/ typeExpr type; bool isRedecl; } *declaratorNode; extern /*@only@*/ cstring declaratorNode_unparse(declaratorNode p_x); extern void declaratorNode_free (/*@null@*/ /*@only@*/ declaratorNode p_x); splint-3.1.2.dfsg1/src/Headers/paramNode.h0000644021234200000250000000171307630463450015675 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** paramNode.h */ # ifndef PARAMNODEH # define PARAMNODEH typedef enum { PNORMAL, PYIELD, PELIPSIS } paramkind ; /* add PREF later? PYIELD is for iterators only (~ POUT) */ typedef struct { /*@null@*/ lclTypeSpecNode type; /*@null@*/ struct s_typeExpr *paramdecl; paramkind kind; } *paramNode; extern void paramNode_free (/*@only@*/ /*@null@*/ paramNode p_x); extern /*@null@*/ paramNode paramNode_copy (/*@null@*/ paramNode p_p); extern /*@only@*/ cstring paramNode_unparse (paramNode p_x); extern /*@only@*/ cstring paramNode_unparseComments (paramNode p_x); extern bool paramNode_isElipsis (paramNode p_p); extern bool paramNode_isYield (paramNode p_p); # define paramNode_isElipsis(p) ((p)->kind == PELIPSIS) # define paramNode_isYield(p) ((p)->kind == PYIELD) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/declaratorNodeList.h0000644021234200000250000000246307630463445017560 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef DECLARATORNODELIST_H # define DECLARATORNODELIST_H typedef /*@only@*/ declaratorNode o_declaratorNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_declaratorNode *elements; } *declaratorNodeList ; /*@iter declaratorNodeList_elements (sef declaratorNodeList x, yield exposed declaratorNode el); @*/ # define declaratorNodeList_elements(x, m_el) \ { int m_ind; declaratorNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { declaratorNode m_el = *(m_elements++); # define end_declaratorNodeList_elements }} extern /*@only@*/ declaratorNodeList declaratorNodeList_new(void); extern declaratorNodeList declaratorNodeList_add (/*@returned@*/ declaratorNodeList p_s, /*@only@*/ declaratorNode p_el); extern /*@only@*/ cstring declaratorNodeList_unparse (declaratorNodeList p_s) ; extern void declaratorNodeList_free (/*@only@*/ declaratorNodeList p_s) ; extern declaratorNodeList declaratorNodeList_copy (declaratorNodeList p_s) ; /*@constant int declaratorNodeListBASESIZE;@*/ # define declaratorNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/paramNodeList.h0000644021234200000250000000413307630463450016530 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef paramNodeLIST_H # define paramNodeLIST_H typedef /*@null@*/ /*@only@*/ paramNode o_paramNode; abst_typedef /*@null@*/ struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_paramNode *elements; } *paramNodeList ; /*@iter paramNodeList_elements (sef paramNodeList x, yield exposed paramNode el); @*/ # define paramNodeList_elements(x, m_el) \ if (paramNodeList_isDefined (x)) \ { int m_ind; paramNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { paramNode m_el = *(m_elements++); # define end_paramNodeList_elements }} extern int paramNodeList_size (/*@sef@*/ paramNodeList); # define paramNodeList_size(s) (paramNodeList_isDefined (s) ? (s)->nelements : 0) extern bool paramNodeList_empty (/*@sef@*/ paramNodeList p_s); # define paramNodeList_empty(s) (paramNodeList_size(s) == 0) extern /*@only@*/ paramNodeList paramNodeList_single (/*@keep@*/ paramNode p_p); extern /*@falsewhennull@*/ bool paramNodeList_isDefined (paramNodeList p_s) /*@*/ ; # define paramNodeList_isDefined(s) ((s) != (paramNodeList)0) extern /*@only@*/ paramNodeList paramNodeList_new (void); extern paramNodeList paramNodeList_add (/*@returned@*/ paramNodeList p_s, /*@null@*/ /*@only@*/ paramNode p_el) ; extern /*@only@*/ cstring paramNodeList_unparse (paramNodeList p_s) ; extern void paramNodeList_free (/*@only@*/ /*@only@*/ paramNodeList p_s) ; extern /*@only@*/ paramNodeList paramNodeList_copy (paramNodeList p_s) ; extern /*@only@*/ cstring paramNodeList_unparseComments (paramNodeList p_s); /*@constant int paramNodeListBASESIZE;@*/ # define paramNodeListBASESIZE SMALLBASESIZE /*@constant null paramNodeList paramNodeList_undefined; @*/ # define paramNodeList_undefined ((paramNodeList) 0) extern /*@nullwhentrue@*/ bool paramNodeList_isNull (/*@null@*/ paramNodeList p_p); # define paramNodeList_isNull(p) ((p) == paramNodeList_undefined) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/dmalloc.h0000644021234200000250000003162107142101212015362 0ustar fax/* * defines for the dmalloc library * * Copyright 1995 by Gray Watson * * This file is part of the dmalloc package. * * Permission to use, copy, modify, and distribute this software for any * NON-COMMERCIAL purpose and without fee is hereby granted, provided * that the above copyright notice and this permission notice appear * in all copies, and that the name of Gray Watson not be used in * advertising or publicity pertaining to distribution of the document * or software without specific, written prior permission. * * Gray Watson makes no representations about the suitability of the * software described herein for any purpose. It is provided "as is" * without express or implied warranty. * * The author may be contacted at gray.watson@letters.com * * $Id: dmalloc.h,v 1.3 2000/08/02 20:20:26 drl7x Exp $ */ #ifndef __DMALLOC_H__ #define __DMALLOC_H__ /* this is inserted into dmalloc.h */ /* used to handle the const operator */ /* const is available */ /* NOTE: start of $Id: dmalloc.h,v 1.3 2000/08/02 20:20:26 drl7x Exp $ */ /* * NOTE: some archetectures have malloc, realloc, etc. using size_t or * an unsigned long instead of the traditional unsigned int. You may * have to edit this by hand due to the difficulties I am having * getting it to auto configure. Finding the definition of size_t in * the /usr/include files may be a good guess. YEACH!! * * Uncomment the include file and set to the correct file which * defines the size type, if necessary. */ #define DMALLOC_SIZE unsigned long /* #include */ /* this defines what type the standard void memory-pointer is */ #if defined(__STDC__) && __STDC__ == 1 #define DMALLOC_PNT void * #define DMALLOC_FREE_RET void #else #define DMALLOC_PNT void * #define DMALLOC_FREE_RET void #endif /* * malloc function return codes */ #define CALLOC_ERROR 0L /* error from calloc */ #define MALLOC_ERROR 0L /* error from malloc */ #define REALLOC_ERROR 0L /* error from realloc */ /* NOTE: this if for non- __STDC__ systems only */ #define FREE_ERROR 0 /* error from free */ #define FREE_NOERROR 1 /* no error from free */ #define DMALLOC_VERIFY_ERROR 0 /* checks failed, error */ #define DMALLOC_VERIFY_NOERROR 1 /* checks passed, no error */ /* * default values if _malloc_file and _malloc_line are not set */ #define DMALLOC_DEFAULT_FILE 0L #define DMALLOC_DEFAULT_LINE 0 #define DMALLOC_UNKNOWN_FILE "unknown" /* * alloc macros to improve memory usage readibility... */ #undef ALLOC #define ALLOC(type, count) \ (type *)malloc((DMALLOC_SIZE)(sizeof(type) * (count))) #undef MALLOC #define MALLOC(size) \ (char *)malloc((DMALLOC_SIZE)(size)) /* NOTICE: the arguments are REVERSED from normal calloc() */ #undef CALLOC #define CALLOC(type, count) \ (type *)calloc((DMALLOC_SIZE)(count), (DMALLOC_SIZE)sizeof(type)) #undef REALLOC #define REALLOC(ptr, type, count) \ (type *)realloc((char *)(ptr), (DMALLOC_SIZE)(sizeof(type) * (count))) #undef REMALLOC #define REMALLOC(ptr, size) \ (char *)realloc((char *)(ptr), (DMALLOC_SIZE)(size)) #undef FREE #define FREE(ptr) \ free((char *)(ptr)) /*<<<<<<<<<< The below prototypes are auto-generated by fillproto */ #ifdef __cplusplus extern "C" { #endif /* logfile for dumping dmalloc info, DMALLOC_LOGFILE env var overrides this */ extern char *dmalloc_logpath; /* internal dmalloc error number for reference purposes only */ extern int dmalloc_errno; /* address to look for. when discovered call dmalloc_error() */ extern DMALLOC_PNT dmalloc_address; /* * argument to dmalloc_address, if 0 then never call dmalloc_error() * else call it after seeing dmalloc_address for this many times. */ extern int dmalloc_address_count; /* * shutdown memory-allocation module, provide statistics if necessary */ extern void dmalloc_shutdown(void); /* * allocate and return a SIZE block of bytes. returns 0L on error. */ extern DMALLOC_PNT malloc(DMALLOC_SIZE size); /* * allocate and return a block of bytes able to hold NUM_ELEMENTS of elements * of SIZE bytes and zero the block. returns 0L on error. */ extern DMALLOC_PNT calloc(DMALLOC_SIZE num_elements, DMALLOC_SIZE size); /* * resizes OLD_PNT to SIZE bytes and return the new space after either copying * all of OLD_PNT to the new area or truncating. returns 0L on error. */ extern DMALLOC_PNT realloc(DMALLOC_PNT old_pnt, DMALLOC_SIZE new_size); /* * release PNT in the heap, returning FREE_ERROR, FREE_NOERROR or void * depending on whether STDC is defined by your compiler. */ extern DMALLOC_FREE_RET free(DMALLOC_PNT pnt); /* * same as free(PNT) */ extern DMALLOC_FREE_RET cfree(DMALLOC_PNT pnt); /* * log the heap structure plus information on the blocks if necessary. */ extern void dmalloc_log_heap_map(void); /* * dump dmalloc statistics to logfile */ extern void dmalloc_log_stats(void); /* * dump unfreed-memory info to logfile */ extern void dmalloc_log_unfreed(void); /* * verify pointer PNT, if PNT is 0 then check the entire heap. * returns MALLOC_VERIFY_ERROR or MALLOC_VERIFY_NOERROR */ extern int dmalloc_verify(const DMALLOC_PNT pnt); /* * same as dmalloc_verify */ extern int _malloc_verify(const DMALLOC_PNT pnt); /* * set the global debug functionality flags to DEBUG (0 to disable). * NOTE: after this module has started up, you cannot set certain flags * such as fence-post or free-space checking. */ extern void dmalloc_debug(const int debug); /* * returns the current debug functionality flags. this allows you to * save a dmalloc library state to be restored later. */ extern int dmalloc_debug_current(void); /* * examine pointer PNT and returns SIZE, and FILE / LINE info on it, * or return-address RET_ADDR if any of the pointers are not 0L. * if FILE returns 0L then RET_ATTR may have a value and vice versa. * returns NOERROR or ERROR depending on whether PNT is good or not */ extern int dmalloc_examine(const DMALLOC_PNT pnt, DMALLOC_SIZE * size, char ** file, unsigned int * line, DMALLOC_PNT * ret_attr); /* * dmalloc version of strerror to return the string version of ERRNUM * returns the string for MALLOC_BAD_ERRNO if ERRNUM is out-of-range. */ extern char *dmalloc_strerror(const int errnum); #ifdef __cplusplus } #endif /*<<<<<<<<<< This is end of the auto-generated output from fillproto. */ /* * alloc macros to provide for memory FILE/LINE debugging information. */ #ifndef DMALLOC_DISABLE #undef calloc #define calloc(count, size) \ _calloc_leap(__FILE__, __LINE__, count, size) #undef free #define free(ptr) \ _free_leap(__FILE__, __LINE__, ptr) #undef malloc #define malloc(size) \ _malloc_leap(__FILE__, __LINE__, size) #undef realloc #define realloc(ptr, size) \ _realloc_leap(__FILE__, __LINE__, ptr, size) #undef xcalloc #define xcalloc(count, size) \ _xcalloc_leap(__FILE__, __LINE__, count, size) #undef xfree #define xfree(ptr) \ _xfree_leap(__FILE__, __LINE__, ptr) #undef xmalloc #define xmalloc(size) \ _xmalloc_leap(__FILE__, __LINE__, size) #undef xrealloc #define xrealloc(ptr, size) \ _xrealloc_leap(__FILE__, __LINE__, ptr, size) #undef xstrdup #define xstrdup(str) \ _xstrdup_leap(__FILE__, __LINE__, str) #ifdef DMALLOC_FUNC_CHECK /* * do debugging on the following functions. this may cause compilation or * other problems depending on your architecture. */ #undef bcmp #define bcmp(b1, b2, len) _dmalloc_bcmp(b1, b2, len) #undef bcopy #define bcopy(from, to, len) _dmalloc_bcopy(from, to, len) #undef memcmp #define memcmp(b1, b2, len) _dmalloc_memcmp(b1, b2, len) #undef memcpy #define memcpy(to, from, len) _dmalloc_memcpy(to, from, len) #undef memset #define memset(buf, ch, len) _dmalloc_memset(buf, ch, len) #undef index #define index(str, ch) _dmalloc_index(str, ch) #undef rindex #define rindex(str, ch) _dmalloc_rindex(str, ch) #undef strcat #define strcat(to, from) _dmalloc_strcat(to, from) #undef strcmp #define strcmp(s1, s2) _dmalloc_strcmp(s1, s2) #undef strlen #define strlen(str) _dmalloc_strlen(str) #undef strtok #define strtok(str, sep) _dmalloc_strtok(str, sep) #undef bzero #define bzero(buf, len) _dmalloc_bzero(buf, len) #undef memccpy #define memccpy(s1, s2, ch, len) _dmalloc_memccpy(s1, s2, ch, len) #undef memchr #define memchr(s1, ch, len) _dmalloc_memchr(s1, ch, len) #undef strchr #define strchr(str, ch) _dmalloc_strchr(str, ch) #undef strrchr #define strrchr(str, ch) _dmalloc_strrchr(str, ch) #undef strcpy #define strcpy(to, from) _dmalloc_strcpy(to, from) #undef strncpy #define strncpy(to, from, len) _dmalloc_strncpy(to, from, len) #undef strcasecmp #define strcasecmp(s1, s2) _dmalloc_strcasecmp(s1, s2) #undef strncasecmp #define strncasecmp(s1, s2, len) _dmalloc_strncasecmp(s1, s2, len) #undef strspn #define strspn(str, list) _dmalloc_strspn(str, list) #undef strcspn #define strcspn(str, list) _dmalloc_strcspn(str, list) #undef strncat #define strncat(to, from, len) _dmalloc_strncat(to, from, len) #undef strncmp #define strncmp(s1, s2, len) _dmalloc_strncmp(s1, s2, len) #undef strpbrk #define strpbrk(str, list) _dmalloc_strpbrk(str, list) #undef strstr #define strstr(str, pat) _dmalloc_strstr(str, pat) /* * feel free to add your favorite functions here and to arg_check.[ch] */ #ifdef __cplusplus extern "C" { #endif /* * copied in from arg_check.h with IMPORT -> extern, all comments removed */ extern int _dmalloc_bcmp(const void * b1, const void * b2, const DMALLOC_SIZE len); extern void _dmalloc_bcopy(const char * from, char * to, const DMALLOC_SIZE len); extern int _dmalloc_memcmp(const void * b1, const void * b2, const DMALLOC_SIZE len); extern char *_dmalloc_memcpy(char * to, const char * from, const DMALLOC_SIZE len); extern char *_dmalloc_memset(void * buf, const char ch, const DMALLOC_SIZE len); extern char *_dmalloc_index(const char * str, const char ch); extern char *_dmalloc_rindex(const char * str, const char ch); extern char *_dmalloc_strcat(char * to, const char * from); extern int _dmalloc_strcmp(const char * s1, const char * s2); extern DMALLOC_SIZE _dmalloc_strlen(const char * str); extern char *_dmalloc_strtok(char * str, const char * sep); extern void _dmalloc_bzero(void * buf, const DMALLOC_SIZE len); extern char *_dmalloc_memccpy(char * s1, const char * s2, const char ch, const DMALLOC_SIZE len); extern char *_dmalloc_memchr(const char * s1, const char ch, const DMALLOC_SIZE len); extern char *_dmalloc_strchr(const char * str, const char ch); extern char *_dmalloc_strrchr(const char * str, const char ch); extern char *_dmalloc_strcpy(char * to, const char * from); extern char *_dmalloc_strncpy(char * to, const char * from, const DMALLOC_SIZE len); extern int _dmalloc_strcasecmp(const char * s1, const char * s2); extern int _dmalloc_strncasecmp(const char * s1, const char * s2, const DMALLOC_SIZE len); extern int _dmalloc_strspn(const char * str, const char * list); extern int _dmalloc_strcspn(const char * str, const char * list); extern char *_dmalloc_strncat(char * to, const char * from, const DMALLOC_SIZE len); extern int _dmalloc_strncmp(const char * s1, const char * s2, const DMALLOC_SIZE len); extern char *_dmalloc_strpbrk(const char * str, const char * list); extern char *_dmalloc_strstr(const char * str, const char * pat); #ifdef __cplusplus } #endif #endif /* DMALLOC_FUNC_CHECK */ #ifdef __cplusplus extern "C" { #endif /* * copied directly from malloc_lp.h with IMPORT -> extern, routines trimmed */ /* to inform the dmalloc library from which file the call comes from */ extern char *_dmalloc_file; /* to inform the library from which line-number the call comes from */ extern unsigned int _dmalloc_line; /* * leap routine to calloc */ extern DMALLOC_PNT _calloc_leap(const char * file, const int line, DMALLOC_SIZE elen, DMALLOC_SIZE size); /* * leap routine to free */ extern DMALLOC_FREE_RET _free_leap(const char * file, const int line, DMALLOC_PNT pnt); /* * leap routine to malloc */ extern DMALLOC_PNT _malloc_leap(const char * file, const int line, DMALLOC_SIZE size); /* * leap routine to realloc */ extern DMALLOC_PNT _realloc_leap(const char * file, const int line, DMALLOC_PNT oldp, DMALLOC_SIZE new_size); /* * leap routine to calloc with error checking */ extern DMALLOC_PNT _xcalloc_leap(const char * file, const int line, DMALLOC_SIZE elen, DMALLOC_SIZE size); /* * leap routine to free */ extern DMALLOC_FREE_RET _xfree_leap(const char * file, const int line, DMALLOC_PNT pnt); /* * leap routine to malloc with error checking */ extern DMALLOC_PNT _xmalloc_leap(const char * file, const int line, DMALLOC_SIZE size); /* * leap routine to realloc with error checking */ extern DMALLOC_PNT _xrealloc_leap(const char * file, const int line, DMALLOC_PNT oldp, DMALLOC_SIZE new_size); /* * leap routine for strdup with error checking */ extern char *_xstrdup_leap(const char * file, const int line, const char * str); #ifdef __cplusplus } #endif #endif /* ! DMALLOC_DISABLE */ #endif /* ! __DMALLOC_H__ */ splint-3.1.2.dfsg1/src/Headers/ekind.h0000644021234200000250000000323107630463445015062 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef EKIND_H # define EKIND_H /* need to maintain compatibility with libraries */ immut_typedef enum { KINVALID = -1, KDATATYPE = 0, /* must dump datatypes first, so ctypes are ok */ KCONST, KENUMCONST, KVAR, KFCN, KITER, KENDITER, KSTRUCTTAG, KUNIONTAG, KENUMTAG, KELIPSMARKER } ekind; /*@constant ekind KELAST;@*/ # define KELAST KELIPSMARKER /*@constant int KGLOBALMARKER;@*/ # define KGLOBALMARKER ((int) KELAST + 1) extern bool ekind_equal (ekind, ekind) /*@*/ ; # define ekind_equal(e1, e2) ((e1) == (e2)) extern ekind ekind_fromInt (int p_i) /*@*/ ; extern int ekind_toInt (ekind p_k) /*@*/ ; extern bool ekind_isFunction (ekind p_k) /*@*/ ; # define ekind_isFunction(k) ((k) == KFCN) extern /*@unused@*/ bool ekind_isVariable (ekind p_k) /*@*/ ; # define ekind_isVariable(k) ((k) == KVAR) extern bool ekind_isElipsis (ekind p_k) /*@*/ ; # define ekind_isElipsis(k) ((k) == KELIPSMARKER) extern bool ekind_isConst (ekind p_k) /*@*/ ; # define ekind_isConst(k) ((k) == KCONST) extern bool ekind_isEnumConst (ekind p_k) /*@*/ ; # define ekind_isEnumConst(k) ((k) == KENUMCONST) # define ekind_toInt(k) ((int)(k)) /*@constant ekind ekind_variable; @*/ # define ekind_variable ((ekind)KVAR) /*@constant ekind ekind_function; @*/ # define ekind_function ((ekind)KFCN) extern /*@observer@*/ cstring ekind_capName (ekind p_k) /*@*/ ; extern /*@observer@*/ cstring ekind_unparse (ekind p_k) /*@*/ ; extern /*@observer@*/ cstring ekind_unparseLong (ekind p_k) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/pp.h0000644021234200000250000000026407121317327014402 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2000. ** See ../LICENSE for license information. ** */ # define DUMMY3 8 # define DUMMY4 12 splint-3.1.2.dfsg1/src/Headers/enumNameList.h0000644021234200000250000000400707630463445016373 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef enumNameLIST_H # define enumNameLIST_H typedef cstring enumName ; extern /*@only@*/ enumName enumName_create (/*@only@*/ cstring p_s) /*@*/ ; # define enumName_create(s) (s) typedef /*@only@*/ enumName o_enumName; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_enumName *elements; } *enumNameList ; /*@iter enumNameList_elements (sef enumNameList x, yield exposed enumName el); @*/ # define enumNameList_elements(x, m_el) \ { int m_ind; enumName *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { enumName m_el = *(m_elements++); # define end_enumNameList_elements }} extern int enumNameList_size (enumNameList); # define enumNameList_size(s) ((s)->nelements) extern /*@only@*/ enumNameList enumNameList_new(void); extern bool enumNameList_member (enumNameList p_s, cstring p_m); extern enumNameList enumNameList_push (/*@returned@*/ enumNameList p_s, /*@only@*/ enumName p_el); extern void enumNameList_addh (enumNameList p_s, /*@keep@*/ enumName p_el) /*@modifies p_s@*/; extern /*@only@*/ cstring enumNameList_unparse (enumNameList p_s) /*@*/ ; extern void enumNameList_free (/*@only@*/ enumNameList p_s) ; extern bool enumNameList_match (enumNameList p_e1, enumNameList p_e2) /*@*/ ; extern /*@only@*/ enumNameList enumNameList_single (/*@keep@*/ enumName p_t) /*@*/ ; extern /*@only@*/ enumNameList enumNameList_subtract (enumNameList p_source, enumNameList p_del) /*@*/ ; extern /*@only@*/ enumNameList enumNameList_copy (enumNameList p_s) /*@*/ ; extern /*@only@*/ enumNameList enumNameList_undump(char **p_s); extern /*@only@*/ cstring enumNameList_dump (enumNameList p_s); extern /*@only@*/ cstring enumNameList_unparseBrief (enumNameList p_s); /*@constant int enumNameListBASESIZE;@*/ # define enumNameListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/privateNode.h0000644021234200000250000000076507630463450016255 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef enum { PRIV_CONST, PRIV_VAR, PRIV_TYPE, PRIV_FUNCTION } privateKind; typedef struct { privateKind kind; union { constDeclarationNode constdeclaration; varDeclarationNode vardeclaration; typeNode type; fcnNode fcn; } content; } *privateNode; extern /*@unused@*/ /*@only@*/ cstring privateNode_unparse(privateNode p_n); splint-3.1.2.dfsg1/src/Headers/qtype.h0000644021234200000250000000376607630463450015143 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** qtype.h ** ** Qualified types: a type qualifier list, and a ctype. */ # ifndef QTYPEH # define QTYPEH abst_typedef /*@null@*/ struct { ctype type; qualList quals; } *qtype; /*@constant null qtype qtype_undefined;@*/ # define qtype_undefined ((qtype) NULL) extern /*@nullwhentrue@*/ bool qtype_isUndefined (qtype p_q); # define qtype_isUndefined(q) ((q) == qtype_undefined) extern /*@falsewhennull@*/ bool qtype_isDefined (qtype p_q); # define qtype_isDefined(q) ((q) != qtype_undefined) extern ctype qtype_getType (/*@sef@*/ qtype p_q); # define qtype_getType(q) \ (qtype_isDefined(q) ? (q)->type : ctype_unknown) extern /*@exposed@*/ qualList qtype_getQuals (/*@sef@*/ qtype p_q); # define qtype_getQuals(q) \ (qtype_isDefined(q) ? (q)->quals : qualList_undefined) extern void qtype_setType (/*@sef@*/ qtype p_q, ctype p_c); # define qtype_setType(q, c) (qtype_isDefined(q) ? (q)->type = (c) : (c)) extern qtype qtype_addQualList (/*@returned@*/ qtype p_qt, qualList p_ql); extern qtype qtype_mergeImplicitAlt (/*@returned@*/ qtype p_q1, /*@only@*/ qtype p_q2); extern /*@only@*/ qtype qtype_copy (qtype p_q); extern /*@notnull@*/ qtype qtype_create (ctype p_c) /*@*/ ; extern /*@only@*/ qtype qtype_unknown(void) /*@*/ ; extern qtype qtype_addQual (/*@returned@*/ qtype p_qt, qual p_q); extern qtype qtype_combine (/*@returned@*/ qtype p_q1, ctype p_ct); extern qtype qtype_mergeAlt (/*@returned@*/ qtype p_q1, /*@only@*/ qtype p_q2); extern qtype qtype_resolve (/*@returned@*/ qtype p_q); extern void qtype_adjustPointers (/*@only@*/ pointers p_n, /*@returned@*/ qtype p_q); extern /*@only@*/ cstring qtype_unparse (qtype p_q) /*@*/ ; extern qtype qtype_newBase (/*@returned@*/ qtype p_q, ctype p_ct); extern qtype qtype_newQbase (/*@returned@*/ qtype p_q1, qtype p_q2); extern void qtype_free (/*@only@*/ qtype p_q); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/enumNameSList.h0000644021234200000250000000220707630463445016516 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef enumNameSLIST_H # define enumNameSLIST_H abst_typedef enumNameList enumNameSList; extern int enumNameSList_size (enumNameSList) /*@*/ ; # define enumNameSList_size(s) enumNameList_size(s) extern /*@only@*/ enumNameSList enumNameSList_subtract (enumNameList, enumNameSList); # define enumNameSList_subtract(s,t) enumNameList_subtract(s,t) extern /*@only@*/ enumNameSList enumNameSList_new(void); # define enumNameSList_new() enumNameList_new() extern bool enumNameSList_member (enumNameSList p_s, cstring p_m); # define enumNameSList_member(s,m) enumNameList_member(s,m) extern void enumNameSList_addh (enumNameSList p_s, /*@dependent@*/ enumName p_el) ; /*@-dependenttrans@*/ # define enumNameSList_addh(s,el) enumNameList_addh(s, el) /*@=dependenttrans@*/ extern void enumNameSList_free (/*@only@*/ enumNameSList p_s); extern /*@only@*/ cstring enumNameSList_unparse (enumNameSList p_s) /*@*/ ; # define enumNameSList_unparse(s) enumNameList_unparse(s) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/programNode.h0000644021234200000250000000105707630463450016245 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef enum { ACT_SELF, ACT_ITER, ACT_ALTERNATE, ACT_SEQUENCE } actionKind; typedef struct { int wrapped; /* number of balanced parentheses around this program node */ actionKind kind; union { stmtNode self; programNodeList args; } content; } *programNode; extern void programNode_free (/*@only@*/ /*@null@*/ programNode p_x); extern /*@only@*/ cstring programNode_unparse (programNode p_p); splint-3.1.2.dfsg1/src/Headers/enumSpecNode.h0000644021234200000250000000054407630463445016361 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; ltoken opttagid; /*@owned@*/ ltokenList enums; sort sort; } *enumSpecNode; extern /*@unused@*/ /*@only@*/ cstring enumSpecNode_unparse(/*@null@*/ enumSpecNode p_n) /*@*/ ; splint-3.1.2.dfsg1/src/Headers/programNodeList.h0000644021234200000250000000216307630463450017100 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef PROGRAMNODELIST_H # define PROGRAMNODELIST_H typedef /*@only@*/ programNode o_programNode; struct s_programNodeList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_programNode *elements; } ; /*@iter programNodeList_elements (sef programNodeList x, yield exposed programNode el); @*/ # define programNodeList_elements(x, m_el) \ { int m_ind; programNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { programNode m_el = *(m_elements++); # define end_programNodeList_elements }} extern /*@only@*/ programNodeList programNodeList_new(void); extern void programNodeList_addh (programNodeList p_s, /*@keep@*/ programNode p_el) ; extern /*@only@*/ cstring programNodeList_unparse (programNodeList p_s) ; extern void programNodeList_free (/*@only@*/ programNodeList p_s) ; /*@constant int programNodeListBASESIZE;@*/ # define programNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/exportNode.h0000644021234200000250000000104507630463445016120 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef enum { XPK_CONST, XPK_VAR, XPK_TYPE, XPK_FCN, XPK_CLAIM, XPK_ITER } exportKind; typedef struct { exportKind kind; union { constDeclarationNode constdeclaration; varDeclarationNode vardeclaration; typeNode type; fcnNode fcn; claimNode claim; iterNode iter; } content; } *exportNode; extern /*@unused@*/ /*@only@*/ cstring exportNode_unparse (exportNode p_n); splint-3.1.2.dfsg1/src/Headers/exposedNode.h0000644021234200000250000000050407630463445016245 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; lclTypeSpecNode type; declaratorInvNodeList decls; } *exposedNode; extern /*@unused@*/ /*@only@*/ cstring exposedNode_unparse (exposedNode p_n); splint-3.1.2.dfsg1/src/Headers/qual.h0000644021234200000250000004662007630463450014737 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** qual.h ** ** representation of type qualifiers */ # ifndef QUALH # define QUALH /* ** just use tokens to represent type qualifiers ** (tokens are defined in cgrammar.y) */ typedef enum { QU_UNKNOWN = 0, QU_CONST, QU_VOLATILE, QU_RESTRICT, QU_INLINE, QU_EXTERN, QU_STATIC, QU_AUTO, QU_REGISTER, QU_SHORT, QU_LONG, QU_SIGNED, QU_UNSIGNED, QU_OUT, QU_IN, QU_ONLY, QU_IMPONLY, QU_TEMP, QU_SHARED, QU_KEEP, QU_KEPT, QU_PARTIAL, QU_SPECIAL, QU_NULL, QU_RELNULL, QU_ISNULL, QU_NULLTERMINATED, QU_SETBUFFERSIZE, QU_EXPOSED, QU_RETURNED, QU_OBSERVER, QU_UNIQUE, QU_OWNED, QU_DEPENDENT, QU_RELDEF, QU_YIELD, QU_NEVEREXIT, QU_EXITS, QU_MAYEXIT, QU_TRUEEXIT, QU_FALSEEXIT, QU_UNUSED, QU_EXTERNAL, QU_SEF, QU_NOTNULL, QU_ABSTRACT, QU_NUMABSTRACT, QU_CONCRETE, QU_MUTABLE, QU_IMMUTABLE, QU_REFCOUNTED, QU_REFS, QU_NEWREF, QU_KILLREF, QU_TEMPREF, QU_TRUENULL, QU_FALSENULL, QU_CHECKED, QU_UNCHECKED, QU_CHECKEDSTRICT, QU_CHECKMOD, QU_UNDEF, QU_KILLED, QU_PRINTFLIKE, QU_SCANFLIKE, QU_MESSAGELIKE, QU_USERANNOT, QU_LAST } quenum; immut_typedef struct { quenum kind; /*@observer@*/ /*@null@*/ annotationInfo info; /* for QU_USERANNOT only */ } *qual; extern /*@only@*/ cstring qual_dump (qual) ; extern qual qual_undump (char **p_s) /*@modifies *p_s@*/ ; /* ** qualifiers correspond to tokens in the grammar: ** ** standard C qualifiers: ** QCONST QVOLATILE QINLINE QEXTERN QSTATIC QAUTO QREGISTER ** QSHORT QLONG QSIGNED QUNSIGNED ** augmented LCL qualifiers: ** QOUT QONLY QTEMP QSHARED QUNIQUE QYIELD ** QEXITS QMAYEXIT QNULLTERMINATED */ extern qual qual_fromInt (int p_q) /*@*/ ; extern /*@observer@*/ cstring qual_unparse (qual p_q) /*@*/ ; extern bool qual_match (qual p_q1, qual p_q2) /*@*/ ; extern bool qual_isUnknown (qual) /*@*/ ; extern bool qual_isTrueNull (qual) /*@*/ ; extern bool qual_isFalseNull (qual) /*@*/ ; extern bool qual_isOwned (qual) /*@*/ ; extern bool qual_isDependent (qual) /*@*/ ; extern bool qual_isRefCounted (qual) /*@*/ ; extern bool qual_isRefs (qual) /*@*/ ; extern bool qual_isNewRef (qual) /*@*/ ; extern bool qual_isKillRef (qual) /*@*/ ; extern bool qual_isTempRef (qual) /*@*/ ; extern bool qual_isLong (qual) /*@*/ ; extern bool qual_isShort (qual) /*@*/ ; extern bool qual_isSigned (qual) /*@*/ ; extern bool qual_isUnsigned (qual) /*@*/ ; extern bool qual_isUnique (qual) /*@*/ ; extern bool qual_isExits (qual) /*@*/ ; extern bool qual_isMayExit (qual) /*@*/ ; extern bool qual_isNeverExit (qual) /*@*/ ; extern bool qual_isTrueExit (qual) /*@*/ ; extern bool qual_isFalseExit (qual) /*@*/ ; extern bool qual_isConst (qual) /*@*/ ; extern bool qual_isRestrict (qual) /*@*/ ; extern bool qual_isVolatile (qual) /*@*/ ; extern bool qual_isInline (qual) /*@*/ ; extern bool qual_isExtern (qual) /*@*/ ; extern bool qual_isStatic (qual) /*@*/ ; extern bool qual_isAuto (qual) /*@*/ ; extern bool qual_isRegister (qual) /*@*/ ; extern bool qual_isOut (qual) /*@*/ ; extern bool qual_isIn (qual) /*@*/ ; extern bool qual_isYield (qual) /*@*/ ; extern bool qual_isOnly (qual) /*@*/ ; extern bool qual_isImpOnly (qual) /*@*/ ; extern bool qual_isPartial (qual) /*@*/ ; extern bool qual_isSpecial (qual) /*@*/ ; extern bool qual_isKeep (qual) /*@*/ ; extern bool qual_isKept (qual) /*@*/ ; extern bool qual_isTemp (qual) /*@*/ ; extern bool qual_isShared (qual) /*@*/ ; extern bool qual_isRelDef (qual) /*@*/ ; extern bool qual_isChecked (qual) /*@*/ ; extern bool qual_isCheckMod (qual) /*@*/ ; extern bool qual_isCheckedStrict (qual) /*@*/ ; extern bool qual_isUnchecked (qual) /*@*/ ; extern bool qual_isNull (qual) /*@*/ ; extern bool qual_isIsNull (qual) /*@*/ ; extern bool qual_isRelNull (qual) /*@*/ ; extern bool qual_isNotNull (qual) /*@*/ ; extern bool qual_isReturned (qual) /*@*/ ; extern bool qual_isExposed (qual) /*@*/ ; extern bool qual_isObserver (qual) /*@*/ ; extern bool qual_isUnused (qual) /*@*/ ; extern bool qual_isExternal (qual) /*@*/ ; extern bool qual_isSef (qual) /*@*/ ; extern bool qual_isAbstract (qual) /*@*/ ; extern bool qual_isNumAbstract (qual) /*@*/ ; extern bool qual_isEitherAbstract (/*@sef@*/ qual) /*@*/ ; extern bool qual_isConcrete (qual) /*@*/ ; extern bool qual_isMutable (qual) /*@*/ ; extern bool qual_isImmutable (qual) /*@*/ ; extern bool qual_isNullPred (/*@sef@*/ qual) /*@*/ ; extern bool qual_isRefQual (/*@sef@*/ qual) /*@*/ ; extern bool qual_isUndef (/*@sef@*/ qual) /*@*/ ; extern bool qual_isKilled (/*@sef@*/ qual) /*@*/ ; extern /*@unused@*/ bool qual_isTypeQual (/*@sef@*/ qual) /*@*/ ; extern /*@unused@*/ bool qual_isControlQual (/*@sef@*/ qual) /*@*/ ; extern /*@unused@*/ bool qual_isStorageClass (/*@sef@*/ qual) /*@*/ ; extern bool qual_isCQual (/*@sef@*/ qual) /*@*/ ; extern bool qual_isAllocQual (/*@sef@*/ qual) /*@*/ ; extern bool qual_isGlobalQual (/*@sef@*/ qual) /*@*/ ; extern bool qual_isImplied (/*@sef@*/ qual) /*@*/ ; extern bool qual_isExQual (/*@sef@*/ qual) /*@*/ ; extern bool qual_isAliasQual (/*@sef@*/ qual) /*@*/ ; extern bool qual_isPrintfLike (/*@sef@*/ qual) /*@*/ ; extern bool qual_isScanfLike (/*@sef@*/ qual) /*@*/ ; extern bool qual_isMessageLike (/*@sef@*/ qual) /*@*/ ; extern bool qual_isMetaState (/*@sef@*/ qual) /*@*/ ; extern bool qual_isNullTerminated( /*@sef@*/ qual ) /*@*/ ; extern bool qual_isMemoryAllocation (/*@sef@*/ qual) /*@*/ ; # define qual_isMemoryAllocation(q) \ (qual_isOnly (q) || qual_isShared (q) || \ qual_isDependent (q) || qual_isOwned (q)) extern bool qual_isSharing (/*@sef@*/ qual) /*@*/ ; # define qual_isSharing(q) \ (qual_isObserver (q) || qual_isExposed (q)) extern /*@observer@*/ annotationInfo qual_getAnnotationInfo (qual) /*@*/ ; extern void qual_initMod (void) /*@modifies internalState@*/ ; extern void qual_destroyMod (void) /*@modifies internalState@*/ ; # define qual_isUnknown(q) ((q)->kind == QU_UNKNOWN) # define qual_isTrueNull(q) ((q)->kind == QU_TRUENULL) # define qual_isFalseNull(q) ((q)->kind == QU_FALSENULL) # define qual_isOwned(q) ((q)->kind == QU_OWNED) # define qual_isDependent(q) ((q)->kind == QU_DEPENDENT) # define qual_isRefCounted(q) ((q)->kind == QU_REFCOUNTED) # define qual_isRefs(q) ((q)->kind == QU_REFS) # define qual_isNewRef(q) ((q)->kind == QU_NEWREF) # define qual_isKillRef(q) ((q)->kind == QU_KILLREF) # define qual_isTempRef(q) ((q)->kind == QU_TEMPREF) # define qual_isLong(q) ((q)->kind == QU_LONG) # define qual_isShort(q) ((q)->kind == QU_SHORT) # define qual_isSigned(q) ((q)->kind == QU_SIGNED) # define qual_isUnsigned(q) ((q)->kind == QU_UNSIGNED) # define qual_isUnique(q) ((q)->kind == QU_UNIQUE) # define qual_isExits(q) ((q)->kind == QU_EXITS) # define qual_isMayExit(q) ((q)->kind == QU_MAYEXIT) # define qual_isNeverExit(q) ((q)->kind == QU_NEVEREXIT) # define qual_isTrueExit(q) ((q)->kind == QU_TRUEEXIT) # define qual_isFalseExit(q) ((q)->kind == QU_FALSEEXIT) # define qual_isConst(q) ((q)->kind == QU_CONST) # define qual_isRestrict(q) ((q)->kind == QU_RESTRICT) # define qual_isVolatile(q) ((q)->kind == QU_VOLATILE) # define qual_isInline(q) ((q)->kind == QU_INLINE) # define qual_isExtern(q) ((q)->kind == QU_EXTERN) # define qual_isStatic(q) ((q)->kind == QU_STATIC) # define qual_isAuto(q) ((q)->kind == QU_AUTO) # define qual_isRegister(q) ((q)->kind == QU_REGISTER) # define qual_isOut(q) ((q)->kind == QU_OUT) # define qual_isIn(q) ((q)->kind == QU_IN) # define qual_isYield(q) ((q)->kind == QU_YIELD) # define qual_isOnly(q) ((q)->kind == QU_ONLY) # define qual_isImpOnly(q) ((q)->kind == QU_IMPONLY) # define qual_isPartial(q) ((q)->kind == QU_PARTIAL) # define qual_isSpecial(q) ((q)->kind == QU_SPECIAL) # define qual_isKeep(q) ((q)->kind == QU_KEEP) # define qual_isKept(q) ((q)->kind == QU_KEPT) # define qual_isTemp(q) ((q)->kind == QU_TEMP) # define qual_isShared(q) ((q)->kind == QU_SHARED) # define qual_isRelDef(q) ((q)->kind == QU_RELDEF) # define qual_isNull(q) ((q)->kind == QU_NULL) # define qual_isIsNull(q) ((q)->kind == QU_ISNULL) # define qual_isRelNull(q) ((q)->kind == QU_RELNULL) # define qual_isNotNull(q) ((q)->kind == QU_NOTNULL) # define qual_isReturned(q) ((q)->kind == QU_RETURNED) # define qual_isExposed(q) ((q)->kind == QU_EXPOSED) # define qual_isObserver(q) ((q)->kind == QU_OBSERVER) # define qual_isUnused(q) ((q)->kind == QU_UNUSED) # define qual_isExternal(q) ((q)->kind == QU_EXTERNAL) # define qual_isSef(q) ((q)->kind == QU_SEF) # define qual_isAbstract(q) ((q)->kind == QU_ABSTRACT) # define qual_isNumAbstract(q) ((q)->kind == QU_NUMABSTRACT) # define qual_isConcrete(q) ((q)->kind == QU_CONCRETE) # define qual_isMutable(q) ((q)->kind == QU_MUTABLE) # define qual_isImmutable(q) ((q)->kind == QU_IMMUTABLE) # define qual_isChecked(q) ((q)->kind == QU_CHECKED) # define qual_isCheckMod(q) ((q)->kind == QU_CHECKMOD) # define qual_isCheckedStrict(q) ((q)->kind == QU_CHECKEDSTRICT) # define qual_isUnchecked(q) ((q)->kind == QU_UNCHECKED) # define qual_isUndef(q) ((q)->kind == QU_UNDEF) # define qual_isKilled(q) ((q)->kind == QU_KILLED) # define qual_isPrintfLike(q) ((q)->kind == QU_PRINTFLIKE) # define qual_isScanfLike(q) ((q)->kind == QU_SCANFLIKE) # define qual_isMessageLike(q) ((q)->kind == QU_MESSAGELIKE) # define qual_isMetaState(q) ((q)->kind == QU_USERANNOT) # define qual_isNullTerminated(q) ((q)->kind == QU_NULLTERMINATED) extern qual qual_createPlain (quenum) /*@*/ ; extern qual qual_createMetaState (/*@observer@*/ annotationInfo) /*@*/ ; extern qual qual_createTrueNull (void) /*@*/ ; extern qual qual_createFalseNull (void) /*@*/ ; extern qual qual_createRefCounted (void) /*@*/ ; extern qual qual_createRefs (void) /*@*/ ; extern qual qual_createNewRef (void) /*@*/ ; extern qual qual_createKillRef (void) /*@*/ ; extern qual qual_createTempRef (void) /*@*/ ; extern qual qual_createNotNull (void) /*@*/ ; extern qual qual_createAbstract (void) /*@*/ ; extern qual qual_createNumAbstract (void) /*@*/ ; extern qual qual_createConcrete (void) /*@*/ ; extern qual qual_createMutable (void) /*@*/ ; extern qual qual_createImmutable (void) /*@*/ ; extern qual qual_createShort (void) /*@*/ ; extern qual qual_createLong (void) /*@*/ ; extern qual qual_createSigned (void) /*@*/ ; extern qual qual_createUnsigned (void) /*@*/ ; extern qual qual_createUnique (void) /*@*/ ; extern qual qual_createMayExit (void) /*@*/ ; extern qual qual_createExits (void) /*@*/ ; extern qual qual_createNeverExit (void) /*@*/ ; extern qual qual_createFalseExit (void) /*@*/ ; extern qual qual_createTrueExit (void) /*@*/ ; extern qual qual_createConst (void) /*@*/ ; extern qual qual_createRestrict (void) /*@*/ ; extern qual qual_createVolatile (void) /*@*/ ; extern qual qual_createInline (void) /*@*/ ; extern qual qual_createExtern (void) /*@*/ ; extern qual qual_createStatic (void) /*@*/ ; extern qual qual_createAuto (void) /*@*/ ; extern qual qual_createRegister (void) /*@*/ ; extern qual qual_createOut (void) /*@*/ ; extern qual qual_createIn (void) /*@*/ ; extern qual qual_createYield (void) /*@*/ ; extern qual qual_createOnly (void) /*@*/ ; extern qual qual_createOwned (void) /*@*/ ; extern qual qual_createDependent (void) /*@*/ ; extern qual qual_createRelDef (void) /*@*/ ; extern qual qual_createImpOnly (void) /*@*/ ; extern qual qual_createPartial (void) /*@*/ ; extern qual qual_createSpecial (void) /*@*/ ; extern qual qual_createKeep (void) /*@*/ ; extern qual qual_createKept (void) /*@*/ ; extern qual qual_createTemp (void) /*@*/ ; extern qual qual_createShared (void) /*@*/ ; extern qual qual_createNull (void) /*@*/ ; extern qual qual_createIsNull (void) /*@*/ ; extern qual qual_createRelNull (void) /*@*/ ; extern qual qual_createReturned (void) /*@*/ ; extern qual qual_createExposed (void) /*@*/ ; extern qual qual_createObserver (void) /*@*/ ; extern qual qual_createUnused (void) /*@*/ ; extern qual qual_createExternal (void) /*@*/ ; extern qual qual_createSef (void) /*@*/ ; extern qual qual_createChecked (void) /*@*/ ; extern qual qual_createCheckMod (void) /*@*/ ; extern qual qual_createUnchecked (void) /*@*/ ; extern qual qual_createCheckedStrict (void) /*@*/ ; extern qual qual_createUndef (void) /*@*/ ; extern qual qual_createKilled (void) /*@*/ ; extern qual qual_createNullTerminated (void) /*@*/ ; extern qual qual_createUnknown (void) /*@*/ ; # define qual_createUnknown() (qual_createPlain (QU_UNKNOWN)) extern qual qual_createPrintfLike (void) /*@*/ ; extern qual qual_createScanfLike (void) /*@*/ ; extern qual qual_createMessageLike (void) /*@*/ ; # define qual_createPrintfLike() (qual_createPlain (QU_PRINTFLIKE)) # define qual_createScanfLike() (qual_createPlain (QU_SCANFLIKE)) # define qual_createMessageLike() (qual_createPlain (QU_MESSAGELIKE)) # define qual_createTrueNull() qual_createPlain (QU_TRUENULL) # define qual_createFalseNull() qual_createPlain (QU_FALSENULL) # define qual_createRefCounted() qual_createPlain (QU_REFCOUNTED) # define qual_createRefs() qual_createPlain (QU_REFS) # define qual_createNewRef() qual_createPlain (QU_NEWREF) # define qual_createKillRef() qual_createPlain (QU_KILLREF) # define qual_createTempRef() qual_createPlain (QU_TEMPREF) # define qual_createNotNull() qual_createPlain (QU_NOTNULL) # define qual_createAbstract() qual_createPlain (QU_ABSTRACT) # define qual_createNumAbstract() qual_createPlain (QU_NUMABSTRACT) # define qual_createConcrete() qual_createPlain (QU_CONCRETE) # define qual_createMutable() qual_createPlain (QU_MUTABLE) # define qual_createImmutable() qual_createPlain (QU_IMMUTABLE) # define qual_createShort() qual_createPlain (QU_SHORT) # define qual_createLong() qual_createPlain (QU_LONG) # define qual_createSigned() qual_createPlain (QU_SIGNED) # define qual_createUnsigned() qual_createPlain (QU_UNSIGNED) # define qual_createUnique() qual_createPlain (QU_UNIQUE) # define qual_createMayExit() qual_createPlain (QU_MAYEXIT) # define qual_createExits() qual_createPlain (QU_EXITS) # define qual_createNeverExit() qual_createPlain (QU_NEVEREXIT) # define qual_createTrueExit() qual_createPlain (QU_TRUEEXIT) # define qual_createFalseExit() qual_createPlain (QU_FALSEEXIT) # define qual_createConst() qual_createPlain (QU_CONST) # define qual_createRestrict() qual_createPlain (QU_RESTRICT) # define qual_createVolatile() qual_createPlain (QU_VOLATILE) # define qual_createInline() qual_createPlain (QU_INLINE) # define qual_createExtern() qual_createPlain (QU_EXTERN) # define qual_createStatic() qual_createPlain (QU_STATIC) # define qual_createAuto() qual_createPlain (QU_AUTO) # define qual_createRegister() qual_createPlain (QU_REGISTER) # define qual_createOut() qual_createPlain (QU_OUT) # define qual_createIn() qual_createPlain (QU_IN) # define qual_createYield() qual_createPlain (QU_YIELD) # define qual_createOnly() qual_createPlain (QU_ONLY) # define qual_createOwned() qual_createPlain (QU_OWNED) # define qual_createDependent() qual_createPlain (QU_DEPENDENT) # define qual_createRelDef() qual_createPlain (QU_RELDEF) # define qual_createImpOnly() qual_createPlain (QU_IMPONLY) # define qual_createPartial() qual_createPlain (QU_PARTIAL) # define qual_createSpecial() qual_createPlain (QU_SPECIAL) # define qual_createKeep() qual_createPlain (QU_KEEP) # define qual_createKept() qual_createPlain (QU_KEPT) # define qual_createTemp() qual_createPlain (QU_TEMP) # define qual_createShared() qual_createPlain (QU_SHARED) # define qual_createNull() qual_createPlain (QU_NULL) # define qual_createIsNull() qual_createPlain (QU_ISNULL) # define qual_createRelNull() qual_createPlain (QU_RELNULL) # define qual_createReturned() qual_createPlain (QU_RETURNED) # define qual_createExposed() qual_createPlain (QU_EXPOSED) # define qual_createObserver() qual_createPlain (QU_OBSERVER) # define qual_createUnused() qual_createPlain (QU_UNUSED) # define qual_createExternal() qual_createPlain (QU_EXTERNAL) # define qual_createSef() qual_createPlain (QU_SEF) # define qual_createChecked() qual_createPlain (QU_CHECKED) # define qual_createCheckMod() qual_createPlain (QU_CHECKMOD) # define qual_createCheckedStrict() qual_createPlain (QU_CHECKEDSTRICT) # define qual_createUnchecked() qual_createPlain (QU_UNCHECKED) # define qual_createUndef() qual_createPlain (QU_UNDEF) # define qual_createKilled() qual_createPlain (QU_KILLED) # define qual_createNullTerminated() qual_createPlain (QU_NULLTERMINATED) /* start modifications */ /* This is used to check if we the qualifier matches any of the len/size/nullterminated types */ extern bool qual_isBufQualifier(/*@sef@*/ qual) /*@*/; # define qual_isBufQualifier(q) \ (qual_isNullTerminated(q)) /* end of modification/s */ extern bool qual_isGlobCheck (/*@sef@*/ qual p_q) /*@*/ ; # define qual_isGlobCheck(q) \ (qual_isChecked (q) || qual_isCheckMod (q) \ || qual_isUnchecked (q) || qual_isCheckedStrict (q)) # define qual_isNullPred(q) \ (qual_isTrueNull (q) || qual_isFalseNull (q)) # define qual_isRefQual(q) \ (qual_isRefCounted(q) || qual_isRefs(q) || qual_isNewRef (q) || \ qual_isKillRef (q) || qual_isTempRef (q)) extern bool qual_isNullStateQual (/*@sef@*/ qual) /*@*/ ; # define qual_isNullStateQual(q) \ (qual_isNull (q) || qual_isIsNull (q) || qual_isRelNull (q) \ || qual_isNotNull (q)) # define qual_isTypeQual(q) \ (qual_isAbstract(q) || qual_isNumAbstract(q) || qual_isConcrete(q) \ || qual_isMutable(q) || qual_isImmutable(q)) # define qual_isEitherAbstract(q) \ (qual_isAbstract(q) || qual_isNumAbstract(q)) # define qual_isControlQual(q) (qual_isExits(q) || qual_isMayExit (q)) # define qual_isStorageClass(q) (qual_isExtern(q) || qual_isStatic(q)) # define qual_isCQual(q) \ (qual_isAuto(q) || qual_isRegister(q) || qual_isInline(q) \ || qual_isConst(q) || qual_isVolatile(q) || qual_isShort(q) \ || qual_isLong (q) || qual_isSigned (q) || qual_isUnsigned (q)) # define qual_isAllocQual(q) \ (qual_isOut (q) || qual_isIn (q) || qual_isSpecial (q) \ || qual_isPartial (q) || qual_isRelDef (q)) # define qual_isGlobalQual(q) \ (qual_isUndef(q) || qual_isKilled (q)) # define qual_isImplied(q) (qual_isImpOnly(q)) # define qual_isExQual(q) (qual_isExposed (q) || qual_isObserver (q)) # define qual_isAliasQual(q) \ (qual_isOnly(q) || qual_isImpOnly(q) || qual_isTemp(q) \ || qual_isOwned (q) || qual_isShared (q) || qual_isUnique (q) \ || qual_isDependent (q) || qual_isKeep (q) || qual_isKept (q)) extern bool qual_isExitQual (/*@sef@*/ qual p_q) /*@*/ ; # define qual_isExitQual(q) \ (qual_isExits (q) || qual_isNeverExit (q) || qual_isMayExit (q) \ || qual_isTrueExit (q) || qual_isFalseExit (q)) extern char qual_abstractCode (qual) /*@*/ ; extern qual qual_abstractFromCodeChar (char) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/exprChecks.h0000644021234200000250000000276707630463445016104 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** exprChecks.h */ extern bool anyAbstract (ctype p_c1, /*@sef@*/ ctype p_c2); # define anyAbstract(c1, c2) \ (ctype_isRealAbstract(c1) || ctype_isRealAbstract(c2)) extern void exprNode_checkAllMods (sRefSet p_mods, uentry p_ue); extern void exprNode_checkCallModifyVal (sRef p_s, exprNodeList p_args, exprNode p_f, exprNode p_err); extern void exprChecks_checkEmptyMacroBody (void); extern void exprChecks_checkExport (uentry p_e); extern void exprChecks_inCompoundStatementExpression (void) /*@modifies internalState@*/ ; extern void exprChecks_leaveCompoundStatementExpression (void) /*@modifies internalState@*/ ; extern void exprNode_checkFunction (uentry p_ue, /*@only@*/ exprNode p_body); extern void exprNode_checkFunctionBody (exprNode p_body); extern void exprNode_checkIterBody (/*@only@*/ exprNode p_body); extern void exprNode_checkIterEnd (/*@only@*/ exprNode p_body); extern void exprNode_checkMacroBody (/*@only@*/ exprNode p_e); extern void exprNode_checkModify (exprNode p_e, exprNode p_err); extern void exprNode_checkModifyVal (exprNode p_e, exprNode p_err); extern void exprChecks_checkNullReturn (fileloc p_loc); extern void exprNode_checkPred (cstring p_c, exprNode p_e); extern void exprNode_checkReturn (exprNode p_e); extern void exprChecks_checkStatementEffect (exprNode p_e); extern void exprChecks_checkUsedGlobs (globSet p_decl, globSet p_used); splint-3.1.2.dfsg1/src/Headers/qualList.h0000644021234200000250000000420007536414705015563 0ustar fax/* ** qualList.h (from slist_templace.h) */ # ifndef QUALLIST_H # define QUALLIST_H abst_typedef /*@null@*/ struct { int nelements; int free; /*@reldef@*/ /*@relnull@*/ qual *elements; } *qualList ; extern /*@falsewhennull@*/ bool qualList_isDefined (qualList p_s); extern /*@unused@*/ /*@nullwhentrue@*/ bool qualList_isUndefined (qualList p_s); /*@constant null qualList qualList_undefined; @*/ # define qualList_undefined ((qualList) NULL) # define qualList_isDefined(q) ((q) != qualList_undefined) # define qualList_isUndefined(q) ((q) == qualList_undefined) /*@iter qualList_elements (sef qualList x, yield qual el); @*/ # define qualList_elements(x, m_el) \ { if (qualList_isDefined(x)) { \ int m_ind; qual *m_elements = &((x)->elements[0]); \ for (m_ind = 0; m_ind < (x)->nelements; m_ind++) \ { qual m_el = *(m_elements++); # define end_qualList_elements }}} extern int qualList_size (/*@sef@*/ qualList p_s); # define qualList_size(s) (qualList_isDefined(s) ? (s)->nelements : 0) extern bool qualList_isEmpty (/*@sef@*/ qualList p_s); # define qualList_isEmpty(s) (qualList_size(s) == 0) extern qualList qualList_new (void) /*@*/ ; extern qualList qualList_single (qual p_el) /*@*/ ; extern qualList qualList_add (/*@returned@*/ qualList p_s, qual p_el) /*@modifies p_s@*/; extern /*@only@*/ cstring qualList_unparse (qualList p_s) /*@*/ ; extern void qualList_free (/*@only@*/ qualList p_s) ; extern qualList qualList_appendList (/*@returned@*/ qualList p_s, qualList p_t); extern qualList qualList_copy (qualList p_s); extern /*@only@*/ cstring qualList_toCComments (qualList p_s); extern void qualList_clear (qualList p_q); /*@constant int qualListBASESIZE;@*/ # define qualListBASESIZE 8 extern bool qualList_hasAliasQualifier (qualList p_s); extern bool qualList_hasExposureQualifier (qualList p_s); /* start modifications */ extern bool qualList_hasNullTerminatedQualifier(qualList p_s); extern bool qualList_hasBufQualifiers(qualList p_s); # define qualList_hasBufQualifiers(p_s) \ (qualList_hasNullTerminatedQualifier(p_s)) /* end modification/s */ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/exprData.h0000644021234200000250000001216607416213772015545 0ustar fax/* ;-*-C-*-; */ /* ** freeShallow: free exprData created from exprNode_effect calls. ** All but the innermost storage is free'd. */ /*@only@*/ exprData exprData_makeLiteral (/*@only@*/ cstring p_s); /*@only@*/ exprData exprData_makeId (/*@temp@*/ uentry p_id); /*@only@*/ exprData exprData_makePair (/*@keep@*/ exprNode p_a, /*@keep@*/ exprNode p_b); /*@-declundef*/ /*static*/ void exprData_freeShallow (/*@only@*/ exprData p_data, exprKind p_kind); /*static*/ void exprData_free (/*@only@*/ exprData p_data, exprKind p_kind); /*static*/ /*@exposed@*/ exprNode exprData_getInitNode (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ idDecl exprData_getInitId (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getOpA (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getOpB (exprData p_data) /*@*/; /*static*/ /*@observer@*/ lltok exprData_getOpTok (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getPairA (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getPairB (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ uentry exprData_getIterSname (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNodeList exprData_getIterAlist (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getIterBody (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ uentry exprData_getIterEname (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getFcn (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNodeList exprData_getArgs (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getTriplePred (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ uentry exprData_getIterCallIter (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNodeList exprData_getIterCallArgs (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getTripleInit (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getTripleTrue (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getTripleTest (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getTripleFalse (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getTripleInc (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getFieldNode (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ cstring exprData_getFieldName (exprData p_data) /*@*/; /*static*/ /*@observer@*/ lltok exprData_getUopTok (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getUopNode (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ exprNode exprData_getCastNode (exprData p_data) /*@*/; /*static*/ /*@observer@*/ lltok exprData_getCastTok (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ qtype exprData_getCastType (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ cstring exprData_getLiteral (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ cstring exprData_getId (exprData p_data) /*@*/; /*static*/ /*@observer@*/ lltok exprData_getTok (exprData p_data) /*@*/; /*static*/ /*@exposed@*/ qtype exprData_getType (exprData p_data) /*@*/ ; /*static*/ /*@exposed@*/ qtype exprData_getOffsetType (exprData p_data) /*@*/ ; /*static*/ /*@exposed@*/ cstringList exprData_getOffsetName (exprData p_data) /*@*/ ; /*drl 10/18/001 added sef annotation*/ /*static*/ /*@exposed@*/ exprNode exprData_getSingle (exprData p_data) /*@*/; /*static*/ /*@only@*/ exprData exprData_makeOp (/*@keep@*/ exprNode p_a, /*@keep@*/ exprNode p_b, /*@keep@*/ lltok p_op); /*static*/ /*@only@*/ exprData exprData_makeUop (/*@keep@*/ exprNode p_a, /*@keep@*/ lltok p_op); /*static*/ /*@only@*/ exprData exprData_makeSingle (/*@only@*/ exprNode p_a); /*static*/ /*@only@*/ exprData exprData_makeTok (/*@only@*/ lltok p_op); /*static*/ /*@only@*/ exprData exprData_makeIter (/*@exposed@*/ uentry p_sname, /*@keep@*/ exprNodeList p_args, /*@keep@*/ exprNode p_body, /*@exposed@*/ uentry p_ename); /*static*/ /*@only@*/ exprData exprData_makeTriple (/*@keep@*/ exprNode p_pred, /*@keep@*/ exprNode p_tbranch, /*@keep@*/ exprNode p_fbranch); /*static*/ /*@only@*/ exprData exprData_makeCall (/*@keep@*/ exprNode p_fcn, /*@keep@*/ exprNodeList p_args); /*static*/ /*@only@*/ exprData exprData_makeIterCall (/*@dependent@*/ uentry p_iter, /*@keep@*/ exprNodeList p_args); /*static*/ /*@only@*/ exprData exprData_makeField (/*@keep@*/ exprNode p_rec, /*@keep@*/ cstring p_field); /*static*/ /*@only@*/ exprData exprData_makeOffsetof (/*@only@*/ qtype p_q, /*@keep@*/ cstringList p_s); /*static*/ /*@only@*/ exprData exprData_makeSizeofType (/*@only@*/ qtype p_q); /*static*/ /*@only@*/ exprData exprData_makeCast (/*@keep@*/ lltok p_tok, /*@keep@*/ exprNode p_e, /*@only@*/ qtype p_q); /*static*/ /*@only@*/ exprData exprData_makeInit (/*@keep@*/ idDecl p_t, /*@keep@*/ exprNode p_e); /*static*/ /*@only@*/ exprData exprData_makeCond (/*@keep@*/ exprNode p_pred, /*@keep@*/ exprNode p_ifclause, /*@keep@*/ exprNode p_elseclause); /*static*/ /*@only@*/ exprData exprData_makeFor (/*@keep@*/ exprNode p_init, /*@keep@*/ exprNode p_pred, /*@keep@*/ exprNode p_inc); /*@=declundef*/ splint-3.1.2.dfsg1/src/Headers/quantifiedTermNode.h0000644021234200000250000000050107630463450017550 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { quantifierNodeList quantifiers; ltoken open; /* for ease of debugging */ termNode body; ltoken close; /* for ease of debugging */ } *quantifiedTermNode; splint-3.1.2.dfsg1/src/Headers/exprNode.h0000644021234200000250000003452210000622321015532 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** exprNode.h */ # ifndef EXPRNODE_H # define EXPRNODE_H /* ** expression Nodes: ** ** ctype typ --- type of expression ** ** union _val ** { long ival; ** char cval; ** double fval; ** cstring sval; ** } *val --- value, if known. if unknown, val = (_val *)0 ** ** storeRef sref --- storage referred to by expression, of storeRef_null ** ** cstring etext --- to get nice error messages, punt for now! */ /* in exprNode_type: typedef struct _exprNode *exprNode; */ typedef enum { XPR_PARENS, XPR_ASSIGN, XPR_CALL, XPR_EMPTY, XPR_VAR, XPR_OP, XPR_POSTOP, XPR_PREOP, XPR_SIZEOFT, XPR_SIZEOF, XPR_ALIGNOFT, XPR_ALIGNOF, XPR_OFFSETOF, XPR_CAST, XPR_FETCH, XPR_VAARG, XPR_ITER, XPR_FOR, XPR_FORPRED, XPR_GOTO, XPR_CONTINUE, XPR_BREAK, XPR_RETURN, XPR_NULLRETURN, XPR_COMMA, XPR_COND, XPR_IF, XPR_IFELSE, XPR_DOWHILE, XPR_WHILE, XPR_STMT, XPR_STMTLIST, XPR_SWITCH, XPR_INIT, XPR_FACCESS, XPR_ARROW, XPR_CONST, XPR_STRINGLITERAL, XPR_NUMLIT, XPR_BODY, XPR_NODE, XPR_ITERCALL, XPR_TOK, XPR_WHILEPRED, XPR_CASE, XPR_FTCASE, XPR_DEFAULT, XPR_FTDEFAULT, XPR_BLOCK, XPR_INITBLOCK, XPR_LABEL } exprKind; typedef struct { /*@only@*/ qtype q; /*@only@*/ cstringList field; } *exprOffsetof; typedef struct { /*@only@*/ exprNode a; /*@only@*/ exprNode b; } *exprPair; typedef struct { /*@only@*/ exprNode pred; /*@only@*/ exprNode tbranch; /*@only@*/ exprNode fbranch; } *exprTriple; typedef struct { /*@dependent@*/ /*@observer@*/ uentry sname; /*@only@*/ exprNodeList args; /*@only@*/ exprNode body; /*@dependent@*/ /*@observer@*/ uentry ename; } *exprIter; typedef struct { /*@only@*/ exprNode fcn; /*@only@*/ exprNodeList args; } *exprCall; typedef struct { /*@dependent@*/ /*@exposed@*/ uentry iter; /*@only@*/ exprNodeList args; } *exprIterCall; typedef struct { /*@only@*/ exprNode a; /*@only@*/ exprNode b; lltok op; } *exprOp; typedef struct { /*@only@*/ exprNode rec; /*@only@*/ cstring field; } *exprField; typedef struct { /*@only@*/ exprNode a; lltok op; } *exprUop; typedef struct { /*@only@*/ exprNode exp; lltok tok; qtype q; } *exprCast; typedef struct { /*@only@*/ exprNode exp; idDecl id; } *exprInit; typedef /*@null@*/ union { cstring literal; cstring id; lltok tok; qtype qt; /* sizeof(type) */ /* use for any 2-operator (comma, arrayFetch, case, stmt) */ exprPair pair; exprOp op; /* pair + operator */ exprUop uop; exprInit init; exprIter iter; exprCall call; exprIterCall itercall; exprCast cast; exprNode single; exprField field; exprTriple triple; /* ifelse, ternary op, for pred */ exprOffsetof offset; } *exprData; /*@constant null exprData exprData_undefined; @*/ # define exprData_undefined ((exprData) NULL) struct s_exprNode { bool isJumpPoint BOOLBITS; /* expr can be reached non-sequentially */ bool canBreak BOOLBITS; /* expr can break (has break, continue) */ bool mustBreak BOOLBITS; ctype typ; exitkind exitCode; multiVal val; /*@exposed@*/ sRef sref; sRefSet uses; /* sRef's used by this expression */ sRefSet sets; /* sRef's set by this expression */ sRefSet msets; /* sRef's possibly set (implicit out params, etc.) */ guardSet guards; exprKind kind; fileloc loc; /*@relnull@*/ exprData edata; cstring etext; /*@notnull@*/ constraintList requiresConstraints; /*@notnull@*/ constraintList ensuresConstraints; /* ** These two are used only for boolean expressions, ** they store the ensures constraints for the true and false cases */ /*@notnull@*/ constraintList trueEnsuresConstraints; /*@notnull@*/ constraintList falseEnsuresConstraints; } ; /*@constant null exprNode exprNode_undefined; @*/ # define exprNode_undefined ((exprNode)NULL) extern /*@falsewhennull@*/ bool exprNode_isDefined (exprNode p_e) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool exprNode_isUndefined (exprNode p_e) /*@*/ ; extern /*@nullwhentrue@*/ bool exprNode_isError (exprNode p_e) /*@*/ ; # define exprNode_isDefined(e) ((e) != exprNode_undefined) # define exprNode_isUndefined(e) ((e) == exprNode_undefined) # define exprNode_isError(e) ((e) == exprNode_undefined) extern /*@dependent@*/ /*@exposed@*/ guardSet exprNode_getGuards (/*@sef@*/ exprNode p_e) /*@*/ ; # define exprNode_getGuards(e) \ (exprNode_isDefined(e) ? (e)->guards : guardSet_undefined) extern ctype exprNode_getType (/*@sef@*/ exprNode p_e) /*@*/ ; # define exprNode_getType(e) \ (exprNode_isDefined(e) ? (e)->typ : ctype_unknown) extern /*@unused@*/ /*@falsewhennull@*/ bool exprNode_isInParens (/*@sef@*/ exprNode p_e) /*@*/ ; # define exprNode_isInParens(e) \ (exprNode_isDefined(e) && (e)->kind == XPR_PARENS) extern bool exprNode_isStringLiteral (/*@sef@*/ exprNode p_e) /*@*/ ; # define exprNode_isStringLiteral(e) \ (exprNode_isDefined(e) && (e)->kind == XPR_STRINGLITERAL) extern /*@unused@*/ bool exprNode_knownIntValue (/*@sef@*/ exprNode p_e) /*@*/ ; # define exprNode_knownIntValue(e) \ (exprNode_isDefined(e) && multiVal_isInt (exprNode_getValue (e))) extern /*@unused@*/ bool exprNode_knownStringValue (/*@sef@*/ exprNode p_e) /*@*/ ; # define exprNode_knownStringValue(e) \ (exprNode_isDefined(e) && multiVal_isString (exprNode_getValue (e))) extern bool exprNode_hasValue (/*@sef@*/ exprNode p_e) /*@*/ ; # define exprNode_hasValue(e) \ (exprNode_isDefined(e) && multiVal_isDefined (exprNode_getValue (e))) extern /*@exposed@*/ multiVal exprNode_getValue (exprNode p_e) /*@*/ ; extern long exprNode_getLongValue (exprNode p_e) /*@*/ ; extern /*@observer@*/ cstring exprNode_unparseFirst (exprNode p_e) /*@*/ ; extern void exprNode_revealState (exprNode p_e) /*@modifies g_messagestream@*/ ; extern /*@observer@*/ guardSet exprNode_getForGuards (exprNode p_pred) /*@*/ ; extern bool exprNode_loopMustExec (exprNode p_forPred) /*@*/ ; extern bool exprNode_isNullValue (exprNode p_e) /*@*/ ; extern /*@exposed@*/ sRef exprNode_getSref (exprNode p_e) /*@*/ ; extern /*@exposed@*/ uentry exprNode_getUentry (exprNode p_e) /*@globals internalState@*/ ; extern void exprNode_produceGuards (exprNode p_pred) /*@modifies p_pred@*/ ; extern /*@observer@*/ fileloc exprNode_loc (exprNode p_e) /*@*/ ; extern /*@observer@*/ fileloc exprNode_getLoc (exprNode p_e) /*@*/ ; # define exprNode_getLoc exprNode_loc extern exprNode exprNode_charLiteral (char p_c, cstring p_text, /*@only@*/ fileloc p_loc) /*@*/ ; extern /*@observer@*/ exprNode exprNode_makeMustExit (void) /*@*/ ; extern exprNode exprNode_cond (/*@keep@*/ exprNode p_pred, /*@keep@*/ exprNode p_ifclause, /*@keep@*/ exprNode p_elseclause) /*@*/ ; extern exprNode exprNode_condIfOmit (/*@keep@*/ exprNode p_pred, /*@keep@*/ exprNode p_elseclause) /*@*/ ; extern exprNode exprNode_makeError(void) /*@*/ ; extern exprNode exprNode_makeInitBlock (lltok p_brace, /*@only@*/ exprNodeList p_inits) /*@*/ ; extern exprNode exprNode_functionCall (/*@only@*/ exprNode p_f, /*@only@*/ exprNodeList p_args) /*@*/ ; extern /*@notnull@*/ exprNode exprNode_fromIdentifier (/*@observer@*/ uentry p_c) /*@globals internalState@*/ ; extern exprNode exprNode_fromUIO (cstring p_c) /*@globals internalState@*/ ; extern exprNode exprNode_fieldAccess (/*@only@*/ exprNode p_s, /*@only@*/ lltok p_dot, /*@only@*/ cstring p_f) /*@*/ ; extern exprNode exprNode_arrowAccess (/*@only@*/ exprNode p_s, /*@only@*/ lltok p_arrow, /*@only@*/ cstring p_f) /*@*/ ; extern exprNode exprNode_postOp (/*@only@*/ exprNode p_e, /*@only@*/ lltok p_op) /*@modifies p_e@*/ ; extern exprNode exprNode_preOp (/*@only@*/ exprNode p_e, /*@only@*/ lltok p_op) /*@*/ ; extern exprNode exprNode_addParens (/*@only@*/ lltok p_lpar, /*@only@*/ exprNode p_e) /*@*/ ; extern exprNode exprNode_offsetof (/*@only@*/ qtype p_qt, /*@only@*/ cstringList p_s) /*@*/ ; extern exprNode exprNode_sizeofType (/*@only@*/ qtype p_qt) /*@*/ ; extern exprNode exprNode_sizeofExpr (/*@only@*/ exprNode p_e) /*@*/ ; extern exprNode exprNode_alignofType (/*@only@*/ qtype p_qt) /*@*/ ; extern exprNode exprNode_alignofExpr (/*@only@*/ exprNode p_e) /*@*/ ; extern exprNode exprNode_op (/*@only@*/ exprNode p_e1, /*@keep@*/ exprNode p_e2, /*@only@*/ lltok p_op) /*@*/ ; extern exprNode exprNode_assign (/*@only@*/ exprNode p_e1, /*@only@*/ exprNode p_e2, /*@only@*/ lltok p_op) ; extern exprNode exprNode_arrayFetch (/*@only@*/ exprNode p_e1, /*@only@*/ exprNode p_e2) /*@modifies p_e1, p_e2@*/ ; extern void exprNode_free (/*@only@*/ exprNode p_e) ; extern exprNode exprNode_vaArg (/*@only@*/ lltok p_tok, /*@only@*/ exprNode p_arg, /*@only@*/ qtype p_qt) /*@globals internalState@*/ ; extern bool exprNode_isMultiStatement (exprNode p_e) /*@*/ ; /* ** Has surrounding quotes. */ extern /*@only@*/ /*@notnull@*/ exprNode exprNode_stringLiteral (/*@only@*/ cstring p_t, /*@only@*/ fileloc p_loc) /*@*/ ; extern /*@only@*/ /*@notnull@*/ exprNode exprNode_wideStringLiteral (/*@only@*/ cstring p_t, /*@only@*/ fileloc p_loc) /*@*/ ; /* ** No surrounding quotes. */ extern /*@notnull@*/ exprNode exprNode_rawStringLiteral (/*@only@*/ cstring p_t, /*@only@*/ fileloc p_loc) /*@*/ ; extern exprNode exprNode_comma (/*@only@*/ exprNode p_e1, /*@only@*/ exprNode p_e2) /*@*/ ; extern exprNode exprNode_labelMarker (/*@only@*/ cstring p_label); extern exprNode exprNode_notReached (/*@returned@*/ exprNode p_stmt); extern exprNode exprNode_caseMarker (/*@only@*/ exprNode p_test, bool p_fallThrough) /*@*/ ; extern exprNode exprNode_concat (/*@only@*/ exprNode p_e1, /*@only@*/ exprNode p_e2); extern /*@notnull@*/ exprNode exprNode_createTok (/*@only@*/ lltok p_t) /*@*/ ; extern exprNode exprNode_statement (/*@only@*/ exprNode p_e, /*@only@*/ lltok p_t); extern exprNode exprNode_makeBlock (/*@only@*/ exprNode p_e); extern exprNode exprNode_compoundStatementExpression (/*@only@*/ lltok p_tlparen, /*@only@*/ exprNode p_e) ; extern void exprNode_checkIfPred (exprNode p_pred) /*@modifies g_warningstream@*/ ; extern exprNode exprNode_if (/*@only@*/ exprNode p_pred, /*@only@*/ exprNode p_tclause); extern exprNode exprNode_ifelse (/*@only@*/ exprNode p_pred, /*@only@*/ exprNode p_tclause, /*@only@*/ exprNode p_eclause); extern exprNode exprNode_switch (/*@only@*/ exprNode p_e, /*@only@*/ exprNode p_s); extern exprNode exprNode_while (/*@keep@*/ exprNode p_t, /*@keep@*/ exprNode p_b); extern exprNode exprNode_doWhile (/*@only@*/ exprNode p_b, /*@only@*/ exprNode p_t); extern /*@notnull@*/ /*@only@*/ exprNode exprNode_goto (/*@only@*/ cstring p_label); extern exprNode exprNode_continue (/*@only@*/ lltok p_l, int p_qcontinue); extern exprNode exprNode_break (/*@only@*/ lltok p_l, int p_bqual); extern exprNode exprNode_nullReturn (/*@only@*/ lltok p_t); extern exprNode exprNode_return (/*@only@*/ exprNode p_e); extern /*@dependent@*/ /*@observer@*/ cstring exprNode_unparse (/*@temp@*/ exprNode p_e) /*@*/ ; extern /*@falsewhennull@*/ bool exprNode_isBlock (exprNode p_e) /*@*/ ; extern /*@falsewhennull@*/ bool exprNode_isCharLiteral (exprNode p_e) /*@*/ ; extern /*@falsewhennull@*/ bool exprNode_isNumLiteral (exprNode p_e) /*@*/ ; extern exprNode exprNode_makeInitialization (/*@only@*/ idDecl p_t, /*@only@*/ exprNode p_e); exprNode exprNode_makeEmptyInitialization (/*@only@*/ idDecl p_t) ; extern bool exprNode_isInitializer (exprNode p_e) /*@*/ ; extern bool exprNode_matchType (ctype p_expected, exprNode p_e); extern /*@notnull@*/ /*@only@*/ exprNode exprNode_defaultMarker (/*@only@*/ lltok p_def, bool p_fallThrough); extern exprNode exprNode_iter (/*@observer@*/ uentry p_name, /*@only@*/ exprNodeList p_alist, /*@only@*/ exprNode p_body, /*@observer@*/ uentry p_end); extern exprNode exprNode_iterId (/*@observer@*/ uentry p_c); extern exprNode exprNode_iterExpr (/*@returned@*/ exprNode p_e); extern exprNode exprNode_iterNewId (/*@only@*/ cstring p_s); extern exprNode exprNode_iterStart (/*@observer@*/ uentry p_name, /*@only@*/ exprNodeList p_alist); extern exprNode exprNode_numLiteral (ctype p_c, /*@temp@*/ cstring p_t, /*@only@*/ fileloc p_loc, long p_val) /*@*/ ; extern void exprNode_initMod (void) /*@modifies internalState@*/ ; extern exprNode exprNode_for (/*@keep@*/ exprNode p_inc, /*@keep@*/ exprNode p_body); extern exprNode exprNode_forPred (/*@only@*/ exprNode p_init, /*@only@*/ exprNode p_test, /*@only@*/ exprNode p_inc); extern exprNode exprNode_floatLiteral (double p_d, ctype p_ct, cstring p_text, /*@only@*/ fileloc p_loc) /*@*/ ; extern /*@notnull@*/ exprNode exprNode_createId (/*@observer@*/ uentry p_c); extern /*@notnull@*/ exprNode exprNode_makeConstantString (/*@temp@*/ cstring p_c, /*@only@*/ fileloc p_loc) /*@*/ ; extern exprNode exprNode_cast (/*@only@*/ lltok p_tok, /*@only@*/ exprNode p_e, /*@only@*/ qtype p_q); extern bool exprNode_matchLiteral (ctype p_expected, exprNode p_e); extern void exprNode_checkUseParam (exprNode p_current); extern void exprNode_checkSet (exprNode p_e, /*@exposed@*/ sRef p_s); extern void exprNode_checkMSet (exprNode p_e, /*@exposed@*/ sRef p_s); extern exprNode exprNode_checkExpr (/*@returned@*/ exprNode p_e); extern bool exprNode_mustEscape (exprNode p_e); extern bool exprNode_errorEscape (exprNode p_e); extern bool exprNode_mayEscape (exprNode p_e); extern exprNode exprNode_whilePred (/*@only@*/ exprNode p_test); extern exprNode exprNode_updateLocation (/*@returned@*/ exprNode p_e, /*@temp@*/ fileloc p_loc); extern void exprNode_freeShallow (/*@only@*/ exprNode p_e); extern void exprNode_destroyMod (void) /*@modifies internalState@*/ ; extern /*@falsewhennull@*/ bool exprNode_isAssign (exprNode p_e) /*@*/ ; /*@-exportlocal@*/ extern bool exprNode_isDefaultMarker (exprNode p_e) /*@*/ ; extern bool exprNode_isCaseMarker (exprNode p_e) /*@*/ ; extern bool exprNode_isLabelMarker (exprNode p_e) /*@*/ ; /*@=exportlocal@*/ extern /*@only@*/ exprNode exprNode_combineLiterals (/*@only@*/ exprNode p_e, /*@only@*/ exprNode p_rest) ; extern /*@only@*/ fileloc exprNode_getNextSequencePoint (exprNode p_e) ; /*drl 01-20-2001*/ exprNode exprNode_createNew(ctype p_c); /* drl 07-25-01 */ bool exprNode_isInitBlock (exprNode p_e); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/quantifierNode.h0000644021234200000250000000056407630463450016747 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken quant; varNodeList vars; bool isForall; } *quantifierNode; extern quantifierNode quantifierNode_copy (quantifierNode p_x); extern void quantifierNode_free (/*@null@*/ /*@only@*/ quantifierNode p_x); splint-3.1.2.dfsg1/src/Headers/exprNodeList.h0000644021234200000250000000406407630463445016415 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef exprNodeList_H # define exprNodeList_H typedef /*@only@*/ exprNode o_exprNode; abst_typedef struct { int nelements; int nspace; int current; /*@reldef@*/ /*@relnull@*/ o_exprNode *elements /*:invariant maxUse(elements) = nspace /\ maxDefined(elements) = nelements@*/; } *exprNodeList; /*@iter exprNodeList_elements (sef exprNodeList s, yield exposed exprNode el); @*/ # define exprNodeList_elements(x, m_el) \ { int m_ind; exprNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { exprNode m_el = *(m_elements++); # define end_exprNodeList_elements }} extern int exprNodeList_size (exprNodeList p_s) /*@*/ ; # define exprNodeList_size(s) ((s)->nelements) extern bool exprNodeList_isEmpty (exprNodeList p_s) /*@*/ ; # define exprNodeList_isEmpty(s) (exprNodeList_size(s) == 0) extern /*@only@*/ exprNodeList exprNodeList_new(void); extern /*@exposed@*/ exprNode exprNodeList_nth (exprNodeList p_args, int p_n) /*@*/ ; extern exprNodeList exprNodeList_push (/*@returned@*/ exprNodeList p_args, /*@only@*/ exprNode p_e) ; extern /*@only@*/ exprNodeList exprNodeList_singleton (/*@only@*/ exprNode p_e) ; extern void exprNodeList_addh (exprNodeList p_s, /*@only@*/ exprNode p_el) ; extern void exprNodeList_reset (exprNodeList p_s) ; extern void exprNodeList_advance (exprNodeList p_s) ; /* was "list_pointToNext" */ extern /*@only@*/ cstring exprNodeList_unparse (exprNodeList p_s) /*@*/ ; extern void exprNodeList_free (/*@only@*/ exprNodeList p_s) ; extern void exprNodeList_freeShallow (/*@only@*/ exprNodeList p_s); extern /*@observer@*/ exprNode exprNodeList_head (exprNodeList p_s) ; extern /*@observer@*/ exprNode exprNodeList_current (exprNodeList p_s) /*@*/ ; extern /*@exposed@*/ exprNode exprNodeList_getN (exprNodeList p_s, int p_n) /*@*/ ; /*@constant int exprNodeListBASESIZE;@*/ # define exprNodeListBASESIZE SMALLBASESIZE # endif splint-3.1.2.dfsg1/src/Headers/quantifierNodeList.h0000644021234200000250000000251407630463450017600 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef QUANTIFIERNODELIST_H # define QUANTIFIERNODELIST_H typedef /*@only@*/ quantifierNode o_quantifierNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_quantifierNode *elements; } *quantifierNodeList ; /*@iter quantifierNodeList_elements (sef quantifierNodeList x, yield exposed quantifierNode el); @*/ # define quantifierNodeList_elements(x, m_el) \ { int m_ind; quantifierNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { quantifierNode m_el = *(m_elements++); # define end_quantifierNodeList_elements }} extern /*@only@*/ quantifierNodeList quantifierNodeList_new(void); extern quantifierNodeList quantifierNodeList_add (/*@returned@*/ quantifierNodeList p_s, /*@only@*/ quantifierNode p_el); extern /*@only@*/ cstring quantifierNodeList_unparse (quantifierNodeList p_s) ; extern /*@unused@*/ void quantifierNodeList_free (/*@only@*/ quantifierNodeList p_s) ; extern /*@only@*/ quantifierNodeList quantifierNodeList_copy (quantifierNodeList p_s) ; /*@constant int quantifierNodeListBASESIZE;@*/ # define quantifierNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/exprNodeSList.h0000644021234200000250000000255607630463445016544 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef exprNodeSList_H # define exprNodeSList_H /* ** like exprNodeList, except elements are dependent. */ typedef /*@dependent@*/ exprNode d_exprNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ d_exprNode *elements; } *exprNodeSList; /*@iter exprNodeSList_elements (sef exprNodeSList x, yield exposed exprNode el); @*/ # define exprNodeSList_elements(x, m_el) \ { int m_ind; exprNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { exprNode m_el = *(m_elements++); # define end_exprNodeSList_elements }} extern /*@only@*/ exprNodeSList exprNodeSList_new(void); extern /*@only@*/ exprNodeSList exprNodeSList_singleton (/*@exposed@*/ /*@dependent@*/ exprNode p_e) ; extern /*@unused@*/ void exprNodeSList_addh (exprNodeSList p_s, /*@exposed@*/ /*@dependent@*/ exprNode p_el); extern /*@only@*/ /*@unused@*/ cstring exprNodeSList_unparse (exprNodeSList p_s); extern void exprNodeSList_free (/*@only@*/ exprNodeSList p_s) ; extern exprNodeSList exprNodeSList_append (/*@returned@*/ exprNodeSList p_s1, /*@only@*/ exprNodeSList p_s2) ; /*@constant int exprNodeSListBASESIZE;@*/ # define exprNodeSListBASESIZE SMALLBASESIZE # endif splint-3.1.2.dfsg1/src/Headers/randomNumbers.h0000644021234200000250000000053507630463450016604 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef RANDOMNUMBERS_H # define RANDOMNUMBERS_H /*@constant int NUM_RANDOM=256@*/ # define NUM_RANDOM 256 extern unsigned int g_randomNumbers[NUM_RANDOM]; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/fcnNode.h0000644021234200000250000000123007630463445015341 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken name; /*@null@*/ lclTypeSpecNode typespec; declaratorNode declarator; globalList globals; varDeclarationNodeList inits; letDeclNodeList lets; /*@null@*/ lclPredicateNode checks; /*@null@*/ lclPredicateNode require; /*@null@*/ modifyNode modify; /*@null@*/ lclPredicateNode ensures; /*@null@*/ lclPredicateNode claim; qual special; } *fcnNode; extern void fcnNode_free (/*@null@*/ /*@only@*/ fcnNode p_f); extern /*@only@*/ cstring fcnNode_unparse (/*@null@*/ fcnNode p_f); splint-3.1.2.dfsg1/src/Headers/rcfiles.h0000644021234200000250000000057207630463450015420 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** rcfiles.h */ # ifndef RCFILES_H # define RCFILES_H extern bool rcfiles_read (cstring p_fname, cstringList *p_passThroughArgs, bool p_report) /*@modifies fileSystem, internalState, *p_passThroughArgs@*/ ; # endif splint-3.1.2.dfsg1/src/Headers/fcnNodeList.h0000644021234200000250000000341607630463446016206 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef FCNNODELIST_H # define FCNNODELIST_H typedef /*@only@*/ fcnNode o_fcnNode; abst_typedef /*@null@*/ struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_fcnNode *elements; } *fcnNodeList; /*@iter fcnNodeList_elements (sef fcnNodeList x, yield exposed fcnNode el); @*/ # define fcnNodeList_elements(x, m_el) \ if (fcnNodeList_isDefined (x)) \ { int m_ind; fcnNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { fcnNode m_el = *(m_elements++); # define end_fcnNodeList_elements }} /*@constant null fcnNodeList fcnNodeList_undefined; @*/ # define fcnNodeList_undefined ((fcnNodeList)0) extern /*@falsewhennull@*/ bool fcnNodeList_isDefined (fcnNodeList p_f); # define fcnNodeList_isDefined(f) ((f) != fcnNodeList_undefined) extern /*@unused@*/ /*@nullwhentrue@*/ bool fcnNodeList_isUndefined (fcnNodeList p_f); # define fcnNodeList_isUndefined(f) ((f) == fcnNodeList_undefined) extern int fcnNodeList_size (/*@sef@*/ fcnNodeList p_f); extern bool fcnNodeList_isEmpty (/*@sef@*/ fcnNodeList p_f); # define fcnNodeList_size(s) (fcnNodeList_isDefined(s) ? (s)->nelements : 0) # define fcnNodeList_isEmpty(s) (fcnNodeList_size(s) == 0) extern /*@only@*/ fcnNodeList fcnNodeList_new(void); extern fcnNodeList fcnNodeList_add (/*@returned@*/ fcnNodeList p_s, /*@keep@*/ fcnNode p_el) ; extern /*@unused@*/ /*@only@*/ cstring fcnNodeList_unparse (fcnNodeList p_s) ; extern void fcnNodeList_free (/*@null@*/ /*@only@*/ fcnNodeList p_s) ; /*@constant int fcnNodeListBASESIZE;@*/ # define fcnNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/reader.h0000644021234200000250000000251507630463450015232 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef READER_H # define READER_H extern /*@null@*/ char *reader_readLine (FILE *p_f, /*@returned@*/ /*@out@*/ char *p_s, int p_max) /*@modifies *p_f, p_s@*/ ; extern int reader_getInt (char **p_s) /*@modifies *p_s@*/ ; extern char reader_loadChar (char **p_s) /*@modifies *p_s@*/ ; extern double reader_getDouble (char **p_s) /*@modifies *p_s@*/ ; extern void reader_doCheckChar (char ** p_s, char p_c, char *p_file, int p_line) /*@modifies *p_s;@*/; extern bool reader_optCheckChar (char **p_s, char p_c) /*@modifies *p_s;@*/ ; extern void reader_checkChar (char **p_s, char p_c) /*@modifies *p_s;@*/ ; # define reader_checkChar(s,c) (reader_doCheckChar (s, c, __FILE__, __LINE__)) extern /*@only@*/ /*@null@*/ char *reader_getWord (char **p_s) /*@modifies *p_s@*/ ; extern cstring reader_getStringWord (char **p_s) /*@modifies *p_s@*/ ; # define reader_getStringWord(s) (cstring_fromChars(reader_getWord(s))) extern cstring reader_readUntil (char **p_s, char p_x) /*@modifies *p_s@*/ ; extern cstring reader_readUntilOne (char **p_s, char *p_x) /*@modifies *p_s@*/ ; extern void reader_checkUngetc (int p_c, FILE *p_f) /*@modifies *p_f@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/scan.h0000644021234200000250000000132607630463450014713 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** scan.h */ /*@-redecl@*/ /*@-type@*/ /*@-incondefs@*/ extern unsigned int lsllex (YYSTYPE *p_lval); /*@=redecl@*/ /*@=type@*/ /*@=incondefs@*/ extern /*@only@*/ ltoken LSLScanNextToken(void) /*@modifies internalState@*/ ; extern void LSLScanFreshToken(ltoken p_tok) /*@modifies internalState@*/ ; extern /*@exposed@*/ inputStream LSLScanSource (void) /*@*/ ; extern void LSLScanInit (void) /*@modifies internalState@*/ ; extern void LSLScanReset (inputStream p_s) /*@modifies internalState@*/ ; extern void LSLScanCleanup (void) /*@modifies internalState@*/ ; splint-3.1.2.dfsg1/src/Headers/fileId.h0000644021234200000250000000166307630463446015174 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** fileId.h */ # ifndef fileId_H # define fileId_H immut_typedef int fileId; /*@constant fileId fileId_invalid; @*/ # define fileId_invalid -1 extern bool fileId_isValid (fileId) /*@*/ ; # define fileId_isValid(f) ((f) > fileId_invalid) extern bool fileId_isInvalid (fileId) /*@*/ ; # define fileId_isInvalid(f) ((f) == fileId_invalid) extern bool fileId_equal (fileId p_t1, fileId p_t2) /*@*/ ; # define fileId_equal(p_t1, p_t2) (fileTable_sameBase (context_fileTable (), p_t1, p_t2)) /* evs 2000-07-27: was # define fileId_equal(t1,t2) ((t1) == (t2)) */ /* fileId_baseEqual moved to fileTable.h */ extern /*@unused@*/ int fileId_compare (/*@sef@*/ fileId p_t1, /*@sef@*/ fileId p_t2) /*@*/ ; # define fileId_compare(t1,t2) (int_compare (t1, t2)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/refTable-branch.h0000644021234200000250000000112607630463450016744 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** refTable.h */ # ifndef REFTABLE_H # define REFTABLE_H /*@private@*/ typedef struct _refentry { int level; int index; } *refentry; /*@private@*/ typedef /*@only@*/ refentry o_refentry; typedef /*@null@*/ struct s_refTable { int nelements; int nspace; o_refentry *elements; } *refTable; extern /*@only@*/ refTable refTable_create (void) /*@*/ ; static void refTable_free (/*@only@*/ refTable p_x); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/fileIdList.h0000644021234200000250000000347207630463446016030 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** fileIdList.h */ # ifndef FILEIDLIST_H # define FILEIDLIST_H /*@access ctype fileId ctypeList@*/ /*@+allmacros@*/ /* in forwardTypes: abst_typedef null ctypeList fileIdList; */ extern /*@falsewhennull@*/ bool fileIdList_isDefined (fileIdList p_f); # define fileIdList_isDefined(f) (ctypeList_isDefined (f)) /*@iter fileIdList_elements (sef fileIdList x, yield fileId el); @*/ # define fileIdList_elements(x, m_el) \ if (fileIdList_isDefined (x)) \ { int m_ind; fileId *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { fileId m_el = *(m_elements++); # define end_fileIdList_elements }} /*@constant null fileIdList fileIdList_undefined; @*/ # define fileIdList_undefined ctypeList_undefined extern fileIdList fileIdList_create (void); # define fileIdList_create() ctypeList_new() extern bool fileIdList_isEmpty (/*@sef@*/ fileIdList p_f) /*@*/ ; extern fileIdList fileIdList_append (/*@only@*/ fileIdList p_f1, /*@temp@*/ fileIdList p_f2) /*@modifies p_f1@*/ ; # define fileIdList_append(f1,f2) ctypeList_append((ctypeList)(f1), (ctypeList)(f2)) extern void fileIdList_add (fileIdList p_f, fileId p_fid) /*@modifies p_f@*/; # define fileIdList_add(f, el) ctypeList_addh((ctypeList)(f), (ctype)(el)) extern int fileIdList_size (/*@sef@*/ fileIdList p_f); # define fileIdList_size(ft) ctypeList_size((ctypeList)(ft)) extern void fileIdList_free (/*@only@*/ fileIdList p_f) /*@modifies p_f@*/; # define fileIdList_free(ft) ctypeList_free((ctypeList)(ft)) # define fileIdList_isEmpty(f) (fileIdList_size (f) == 0) /*@noaccess ctype fileId ctypeList@*/ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/renamingNode.h0000644021234200000250000000107207630463450016373 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { typeNameNodeList namelist; /* the positional arguments */ replaceNodeList replacelist; /* the rest of replace renamings */ } *nameAndReplaceNode; typedef struct { bool is_replace; /* TRUE means replace, false means name */ union { replaceNodeList replace; nameAndReplaceNode name; } content; } *renamingNode; extern /*@only@*/ cstring renamingNode_unparse (/*@null@*/ renamingNode p_x); splint-3.1.2.dfsg1/src/Headers/fileLib.h0000644021234200000250000000302707646432517015344 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** fileLib.h */ # ifndef FILELIB_H # define FILELIB_H extern bool fileLib_isLCLFile (cstring p_s) /*@*/ ; extern bool fileLib_isCExtension (cstring p_ext) /*@*/ ; extern cstring fileLib_addExtension (cstring p_s, cstring p_suffix); extern cstring fileLib_withoutExtension (cstring p_s, cstring p_suffix) /*@*/ ; extern cstring fileLib_removePath (cstring p_s) /*@*/ ; extern cstring fileLib_removePathFree (/*@only@*/ cstring p_s) /*@*/ ; extern cstring fileLib_removeAnyExtension (cstring p_s) /*@*/ ; extern /*@only@*/ cstring fileLib_cleanName (/*@only@*/ cstring p_s) /*@*/ ; extern bool fileLib_hasExtension (cstring p_s, cstring p_ext) /*@*/ ; extern /*@observer@*/ cstring fileLib_getExtension (/*@returned@*/ cstring p_s) /*@*/ ; /*@constant observer cstring MTS_EXTENSION;@*/ # define MTS_EXTENSION cstring_makeLiteralTemp (".mts") /*@constant observer cstring LCL_EXTENSION;@*/ # define LCL_EXTENSION cstring_makeLiteralTemp (".lcl") /*@constant observer cstring LH_EXTENSION; @*/ # define LH_EXTENSION cstring_makeLiteralTemp (".lh") /*@constant observer cstring C_EXTENSION; @*/ # define C_EXTENSION cstring_makeLiteralTemp (".c") /*@constant observer cstring XH_EXTENSION;@*/ # define XH_EXTENSION cstring_makeLiteralTemp (".xh") /* C files that have already been preprocessed */ /*@constant observer cstring PP_EXTENSION;@*/ # define PP_EXTENSION cstring_makeLiteralTemp (".pp") # endif splint-3.1.2.dfsg1/src/Headers/replaceNode.h0000644021234200000250000000110407630463450016202 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; typeNameNode typename; bool isCType; /* TRUE means it is a CType */ union { struct { /*@only@*/ /*@null@*/ nameNode name; /*@only@*/ /*@null@*/ sigNode signature; } renamesortname; ltoken ctype; } content; } *replaceNode; extern void replaceNode_free (/*@only@*/ /*@null@*/ replaceNode p_x); extern /*@only@*/ cstring replaceNode_unparse (/*@null@*/ replaceNode p_x); splint-3.1.2.dfsg1/src/Headers/fileloc.h0000644021234200000250000001601507630463446015412 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** fileloc.h */ # ifndef FILELOC_H # define FILELOC_H # include "fileId.h" typedef enum { FL_NORMAL, FL_SPEC, FL_LIB, FL_STDLIB, FL_STDHDR, FL_IMPORT, FL_BUILTIN, FL_PREPROC, FL_RC, FL_EXTERNAL } flkind; struct s_fileloc { flkind kind; fileId fid; int lineno; int column; } ; /* typedef in forwardTypes */ typedef /*@only@*/ fileloc o_fileloc; extern fileloc fileloc_update (/*@only@*/ fileloc p_old, fileloc p_fnew) /*@modifies p_old@*/ ; extern fileloc fileloc_create (fileId p_fid, int p_line, int p_col) /*@*/ ; extern bool fileloc_isSystemFile (fileloc p_f1) /*@*/ ; extern bool fileloc_isXHFile (fileloc p_f1) /*@*/ ; extern fileloc fileloc_createSpec (fileId p_fid, int p_line, int p_col) /*@*/ ; extern fileloc fileloc_createLib (cstring p_ln) /*@*/ ; extern fileloc fileloc_createRc (cstring p_name) /*@*/ ; extern fileloc fileloc_decColumn (fileloc p_f, int p_x) /*@*/ ; extern void fileloc_subColumn (fileloc p_f, int p_x) /*@modifies p_f@*/ ; extern fileloc fileloc_getBuiltin (void) /*@*/ ; extern /*@observer@*/ fileloc fileloc_observeBuiltin (void) /*@*/ ; extern fileloc fileloc_createBuiltin (void) /*@*/ ; extern fileloc fileloc_createImport (cstring p_fname, int p_lineno) /*@*/ ; extern void fileloc_destroyMod (void) /*@modifies internalState@*/ ; extern bool fileloc_isSpecialFile (fileloc p_f) /*@*/ ; extern bool fileloc_sameBaseFile (fileloc p_f1, fileloc p_f2) /*@*/ ; extern /*@observer@*/ cstring fileloc_filename (fileloc p_f) /*@*/ ; extern int fileloc_column (fileloc p_f) /*@*/ ; extern cstring fileloc_unparse (fileloc p_f) /*@*/ ; extern cstring fileloc_unparseRaw (cstring p_fname, int p_lineno) /*@*/ ; extern cstring fileloc_unparseRawCol (cstring p_fname, int p_lineno, int p_col) /*@*/ ; extern bool fileloc_sameFile (fileloc p_f1, fileloc p_f2) /*@*/ ; extern bool fileloc_sameFileAndLine (fileloc p_f1, fileloc p_f2) /*@*/ ; extern void fileloc_free (/*@only@*/ fileloc p_f); extern void fileloc_reallyFree (/*@only@*/ fileloc p_f); extern int fileloc_lineno (fileloc p_f) /*@*/ ; extern bool fileloc_equal (fileloc p_f1, fileloc p_f2) /*@*/ ; extern bool fileloc_lessthan (fileloc p_f1, fileloc p_f2) /*@*/ ; extern int fileloc_compare (fileloc p_f1, fileloc p_f2) /*@*/ ; extern /*@observer@*/ cstring fileloc_getBase (fileloc p_f) /*@*/ ; extern bool fileloc_isHeader (fileloc p_f) /*@*/ ; extern bool fileloc_isSpec (fileloc p_f) /*@*/ ; extern bool fileloc_isRealSpec (fileloc p_f) /*@*/ ; extern fileloc fileloc_copy (fileloc p_f) /*@*/ ; extern cstring fileloc_unparseDirect (fileloc p_fl) /*@*/ ; extern bool fileloc_notAfter (fileloc p_f1, fileloc p_f2) /*@*/ ; extern bool fileloc_almostSameFile (fileloc p_f1, fileloc p_f2) /*@*/ ; extern fileloc fileloc_noColumn (fileloc p_f) /*@*/ ; extern /*@observer@*/ fileloc fileloc_getExternal (void) /*@*/ ; extern fileloc fileloc_createExternal (void) /*@*/ ; extern bool fileloc_isExternal (/*@sef@*/ fileloc p_f) /*@*/; # define fileloc_isExternal(f) \ (fileloc_isDefined(f) && ((f)->kind == FL_EXTERNAL)) extern /*@falsewhennull@*/ bool fileloc_isDefined (/*@null@*/ fileloc p_f) /*@*/ ; extern /*@nullwhentrue@*/ bool fileloc_isUndefined (/*@null@*/ fileloc p_f) /*@*/ ; extern bool fileloc_isInvalid (/*@sef@*/ /*@null@*/ fileloc p_f) /*@*/ ; /*@constant null fileloc fileloc_undefined; @*/ # define fileloc_undefined ((fileloc) NULL) # define fileloc_isDefined(f) ((f) != fileloc_undefined) # define fileloc_isUndefined(f) ((f) == fileloc_undefined) # define fileloc_isInvalid(f) (!(fileloc_isValid(f))) extern bool fileloc_isLib (fileloc p_f) /*@*/ ; extern fileloc fileloc_fromTok (ltoken p_t) /*@*/ ; /*@constant int UNKNOWN_LINE; @*/ # define UNKNOWN_LINE (0) /*@constant int UNKNOWN_COLUMN; @*/ # define UNKNOWN_COLUMN (0) extern /*@unused@*/ bool fileloc_linenoDefined (/*@sef@*/ fileloc p_f) /*@*/ ; extern /*@unused@*/ bool fileloc_columnDefined (/*@sef@*/ fileloc p_f) /*@*/ ; # define fileloc_linenoDefined(f) \ (fileloc_isValid (f) && (f)->lineno != UNKNOWN_LINE) # define fileloc_columnDefined(f) \ (fileloc_isValid (f) && (f)->column != UNKNOWN_COLUMN) extern void fileloc_setColumnUndefined (/*@sef@*/ fileloc p_f) /*@modifies p_f@*/; # define fileloc_setColumnUndefined(f) \ (fileloc_isDefined(f) ? (f)->column = UNKNOWN_COLUMN : UNKNOWN_COLUMN) extern /*@falsewhennull@*/ bool fileloc_isValid (/*@sef@*/ fileloc p_f); # define fileloc_isValid(f) \ (fileloc_isDefined(f) && ((f)->lineno >= 0)) extern bool fileloc_isImport (/*@sef@*/ fileloc p_fl); # define fileloc_isImport(fl) (fileloc_isDefined(fl) && (fl)->kind == FL_IMPORT) extern bool fileloc_isPreproc (/*@sef@*/ fileloc p_fl); # define fileloc_isPreproc(fl) (fileloc_isDefined(fl) && (fl)->kind == FL_PREPROC) extern void fileloc_setLineno (/*@sef@*/ fileloc p_f, int p_i) /*@modifies p_f@*/ ; # define fileloc_setLineno(fl, i) \ (fileloc_isDefined(fl) ? ((fl)->lineno = (i), (fl)->column = 1) : (i)) extern void fileloc_nextLine (/*@sef@*/ fileloc p_f) /*@modifies p_f@*/ ; # define fileloc_nextLine(fl) \ (fileloc_isDefined(fl) ? ((fl)->lineno++, (fl)->column = 1) : 0) extern void fileloc_addLine (/*@sef@*/ fileloc p_f, int p_i) /*@modifies p_f@*/ ; # define fileloc_addLine(fl, i) \ (fileloc_isDefined(fl) ? ((fl)->lineno += (i), (fl)->column = 1) : (i)) extern fileId fileloc_fileId (/*@sef@*/ fileloc p_fl) /*@*/ ; # define fileloc_fileId(fl) \ (fileloc_isDefined (fl) ? (fl)->fid : fileId_invalid) extern void fileloc_setColumn (/*@sef@*/ fileloc p_fl, int p_i) /*@modifies p_fl@*/ ; # define fileloc_setColumn(fl, i) \ (fileloc_isDefined (fl) ? ((fl)->column = (i)) : (i)) extern void fileloc_addColumn (/*@sef@*/ fileloc p_fl, int p_i) /*@modifies p_fl@*/ ; # define fileloc_addColumn(fl, i) \ (fileloc_isDefined (fl) ? ((fl)->column += (i)) : (i)) extern void fileloc_incColumn (/*@sef@*/ fileloc p_fl) /*@modifies p_fl@*/ ; # define fileloc_incColumn(fl) \ (fileloc_isDefined (fl) ? ((fl)->column++) : 0) extern bool fileloc_isBuiltin (/*@sef@*/ fileloc p_fl) /*@*/ ; # define fileloc_isBuiltin(fl) \ (fileloc_isDefined (fl) && ((fl)->kind == FL_BUILTIN)) extern fileloc fileloc_updateFileId (/*@only@*/ fileloc p_old, fileId p_s) /*@*/ ; extern fileloc fileloc_makePreproc (fileloc p_loc) /*@*/ ; extern fileloc fileloc_makePreprocPrevious (fileloc p_loc) /*@*/ ; extern /*@only@*/ cstring fileloc_outputFilename (fileloc) /*@*/ ; extern bool fileloc_isStandardLibrary (fileloc p_f) /*@*/ ; extern bool fileloc_isStandardLib (fileloc p_f) /*@*/ ; extern cstring fileloc_unparseFilename (fileloc p_f) /*@*/ ; extern bool fileloc_withinLines (fileloc p_f1, fileloc p_f2, int p_n) /*@*/ ; extern bool fileloc_isUser (fileloc p_f) /*@*/ ; extern bool fileloc_sameModule (fileloc p_f1, fileloc p_f2) /*@*/ ; extern bool fileloc_storable (/*@sef@*/ fileloc p_f) /*@*/; # define fileloc_storable(f) ((f) != g_currentloc || fileloc_isBuiltin (f) || fileloc_isExternal (f)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/replaceNodeList.h0000644021234200000250000000260207630463450017042 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef replaceNodeLIST_H # define replaceNodeLIST_H typedef /*@only@*/ replaceNode o_replaceNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_replaceNode *elements; } *replaceNodeList ; /*@iter replaceNodeList_elements (sef replaceNodeList x, yield exposed replaceNode el); @*/ # define replaceNodeList_elements(x, m_el) \ { int m_ind; replaceNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { replaceNode m_el = *(m_elements++); # define end_replaceNodeList_elements }} extern int replaceNodeList_size (replaceNodeList); # define replaceNodeList_size(s) ((s)->nelements) extern bool replaceNodeList_isDefined (replaceNodeList); # define replaceNodeList_isDefined(s) ((s) != (replaceNodeList)0) extern /*@only@*/ replaceNodeList replaceNodeList_new(void); extern replaceNodeList replaceNodeList_add (/*@returned@*/ replaceNodeList p_s, /*@only@*/ replaceNode p_el) ; extern /*@only@*/ cstring replaceNodeList_unparse (replaceNodeList p_s) ; extern void replaceNodeList_free (/*@only@*/ replaceNodeList p_s) ; /*@constant int replaceNodeListBASESIZE;@*/ # define replaceNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/filelocList.h0000644021234200000250000000415007415477017016243 0ustar fax/* ** filelocList.h (from slist_templace.h) */ # ifndef filelocLIST_H # define filelocLIST_H abst_typedef /*@null@*/ struct { int nelements; int free; /*@reldef@*/ /*@relnull@*/ o_fileloc *elements; } *filelocList ; extern /*@unused@*/ /*@nullwhentrue@*/ bool filelocList_isUndefined (filelocList p_f) /*@*/ ; extern /*@falsewhennull@*/ bool filelocList_isDefined (filelocList p_f); /*@constant null filelocList filelocList_undefined; @*/ # define filelocList_undefined (NULL) # define filelocList_isDefined(f) ((f) != filelocList_undefined) # define filelocList_isUndefined(f) ((f) == filelocList_undefined) /*@iter filelocList_elements (sef filelocList x, yield exposed fileloc el); @*/ # define filelocList_elements(x, m_el) \ { if (filelocList_isDefined (x)) { \ int m_ind; fileloc *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { fileloc m_el = *(m_elements++); # define end_filelocList_elements }}} extern int filelocList_realSize (filelocList p_s) /*@*/ ; extern int filelocList_size (/*@sef@*/ filelocList p_s) /*@*/ ; # define filelocList_size(s) (filelocList_isDefined (s) ? (s)->nelements : 0) extern bool filelocList_isEmpty (/*@sef@*/ filelocList p_s); # define filelocList_isEmpty(s) (filelocList_size(s) == 0) extern filelocList filelocList_append (/*@returned@*/ filelocList p_s, /*@only@*/ filelocList p_t); extern /*@only@*/ filelocList filelocList_new (void) /*@*/ ; extern filelocList filelocList_add (/*@returned@*/ filelocList p_s, /*@only@*/ fileloc p_el) /*@modifies p_s@*/ ; extern filelocList filelocList_addDifferentFile (/*@returned@*/ filelocList p_s, fileloc p_where, fileloc p_loc) /*@modifies p_s@*/ ; extern filelocList filelocList_addUndefined (/*@returned@*/ filelocList p_s) /*@modifies p_s@*/ ; extern /*@only@*/ cstring filelocList_unparseUses (filelocList p_s); extern /*@unused@*/ /*@only@*/ cstring filelocList_unparse (filelocList p_s) ; extern void filelocList_free (/*@only@*/ filelocList p_s) ; /*@constant int filelocListBASESIZE;@*/ # define filelocListBASESIZE MIDBASESIZE # endif splint-3.1.2.dfsg1/src/Headers/filelocStack.h0000644021234200000250000000250207443751373016375 0ustar fax/* ** filelocStack.h (from slist_templace.h) */ # ifndef FILELOCSTACK_H # define FILELOCSTACK_H abst_typedef /*@null@*/ struct { int nelements; int free; /*@reldef@*/ /*@relnull@*/ o_fileloc *elements; } *filelocStack ; /*@constant null filelocStack filelocStack_undefined; @*/ # define filelocStack_undefined (NULL) extern /*@falsewhennull@*/ bool filelocStack_isDefined (filelocStack p_f) /*@*/ ; # define filelocStack_isDefined(f) ((f) != filelocStack_undefined) extern int filelocStack_size (/*@sef@*/ filelocStack p_s) /*@*/ ; # define filelocStack_size(s) (filelocStack_isDefined (s) ? (s)->nelements : 0) extern int filelocStack_includeDepth (filelocStack p_s); extern void filelocStack_printIncludes (filelocStack p_s) /*@modifies g_warningstream@*/ ; extern void filelocStack_clear (filelocStack p_s) /*@modifies p_s@*/ ; extern /*@only@*/ filelocStack filelocStack_new (void) /*@*/ ; extern /*@observer@*/ fileloc filelocStack_nextTop (filelocStack p_s) /*@*/ ; extern bool filelocStack_popPushFile (filelocStack p_s, /*@only@*/ fileloc p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring filelocStack_unparse (filelocStack p_s) /*@*/ ; extern void filelocStack_free (/*@only@*/ filelocStack p_s) ; /*@constant int filelocStackBASESIZE;@*/ # define filelocStackBASESIZE MIDBASESIZE # endif splint-3.1.2.dfsg1/src/Headers/scanline.h0000644021234200000250000000223307630463450015561 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** scanline.h */ # ifndef SCANLINE_H # define SCANLINE_H /*@constant int LASTCHAR; @*/ # define LASTCHAR 255 /*@constant char CHAREXTENDER; @*/ # define CHAREXTENDER '\\' typedef enum { CHC_NULL, IDCHAR, OPCHAR, SLASHCHAR, WHITECHAR, CHC_EXTENSION, SINGLECHAR, PERMCHAR } charCode; typedef struct { charCode code; bool endCommentChar; } charClassData; extern void lscanLine (char *); extern ltoken LSLScanEofToken (void); extern void LSLReportEolTokens (bool p_setting); extern void lscanLineInit (void); extern void lscanLineReset (void); extern void lscanLineCleanup (void); /* ** The following function prototypes are for use by lslinit.c, which ** customizes subsequent actions of scanline.c. */ extern charCode lscanCharClass (char p_c); extern bool LSLIsEndComment (char p_c); extern void lsetCharClass (char p_c, charCode p_cod); extern void lsetEndCommentChar (char p_c, bool p_flag); /*@constant int MAXLINE;@*/ # define MAXLINE 1000 # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/fileTable.h0000644021234200000250000001343707651115037015662 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** fileTable.h */ # ifndef FILETABLE_H # define FILETABLE_H /*@constant int FTBASESIZE; @*/ # define FTBASESIZE 64 /* moved to fileloc.h ** typedef int fileId; */ typedef enum { FILE_NORMAL, FILE_LSLTEMP, FILE_NODELETE, FILE_HEADER, FILE_XH, FILE_MACROS, FILE_METASTATE } fileType; /*:private:*/ typedef struct { bool ftemp BOOLBITS; bool fsystem BOOLBITS; bool fspecial BOOLBITS; /*@only@*/ cstring fname; cstring basename; fileType ftype; fileId fder; } *ftentry; typedef /*@only@*/ ftentry o_ftentry; typedef /*@only@*/ struct { /*@null@*/ /*@dependent@*/ /*@exposed@*/ FILE *f; /*@only@*/ cstring fname; } *foentry; abst_typedef /*@null@*/ struct { int nentries; int nspace; cstringTable htable; /*@reldef@*/ /*@only@*/ o_ftentry *elements; /* ** Keep track of all the open files, so we can close them on error exits. */ int nopen; int nopenspace; /*@reldef@*/ /*@only@*/ foentry *openelements; /* evans 2002-07-12: removed reldef */ } *fileTable ; /*@constant null fileTable fileTable_undefined; @*/ # define fileTable_undefined ((fileTable) NULL) extern /*@unused@*/ /*@nullwhentrue@*/ bool fileTable_isUndefined (/*@null@*/ fileTable p_f) /*@*/ ; extern /*@unused@*/ /*@falsewhennull@*/ bool fileTable_isDefined (/*@null@*/ fileTable p_f) /*@*/ ; # define fileTable_isUndefined(ft) ((ft) == fileTable_undefined) # define fileTable_isDefined(ft) ((ft) != fileTable_undefined) extern /*@observer@*/ cstring fileTable_getName (fileTable p_ft, fileId p_fid) /*@*/ ; extern /*@observer@*/ cstring fileTable_getNameBase (fileTable p_ft, fileId p_fid) ; extern fileId fileTable_addFile (fileTable p_ft, cstring p_name) /*@modifies p_ft@*/ ; extern void fileTable_addStreamFile (fileTable p_ft, /*@dependent@*/ FILE *p_fstream, cstring p_name) /*@modifies p_ft@*/ ; extern fileId fileTable_addHeaderFile (fileTable p_ft, cstring p_name) /*@modifies p_ft@*/ ; extern fileId fileTable_addXHFile (fileTable p_ft, cstring p_name) /*@modifies p_ft@*/ ; extern fileId fileTable_addLibraryFile (fileTable p_ft, cstring p_name) /*@modifies p_ft@*/ ; extern fileId fileTable_addLCLFile (fileTable p_ft, cstring p_name) /*@modifies p_ft@*/ ; extern fileId fileTable_addltemp (fileTable p_ft); extern /*@notnull@*/ /*@only@*/ fileTable fileTable_create (void) /*@*/ ; extern fileId fileTable_lookup (fileTable p_ft, cstring p_s) /*@*/ ; extern fileId fileTable_addCTempFile (fileTable p_ft, fileId p_fid) /*@modifies p_ft@*/ ; extern fileId fileTable_addFileOnly (fileTable p_ft, /*@only@*/ cstring p_name) /*@modifies p_ft@*/ ; extern fileId fileTable_addImportFile (fileTable p_ft, cstring p_name) /*@modifies p_ft@*/ ; extern fileId fileTable_addMacrosFile (fileTable p_ft) /*@modifies p_ft@*/ ; extern fileId fileTable_addMetastateFile (fileTable p_ft, cstring p_name) /*@modifies p_ft@*/ ; extern void fileTable_setFilePath (fileTable p_ft, fileId p_fid, cstring p_path) /*@modifies p_ft@*/ ; extern /*@observer@*/ cstring fileTable_getRootName (fileTable p_ft, fileId p_fid) /*@*/ ; extern bool fileTable_isHeader (fileTable p_ft, fileId p_fid) /*@*/ ; extern bool fileId_isHeader (fileId p_f) /*@*/ ; # define fileId_isHeader(f) (fileTable_isHeader (context_fileTable(), f)) extern bool fileTable_sameBase (fileTable p_ft, fileId p_f1, fileId p_f2); extern void fileTable_cleanup (fileTable p_ft) /*@modifies fileSystem@*/; extern fileId fileTable_lookupBase (fileTable p_ft, cstring p_base) /*@modifies p_ft@*/ ; extern void fileTable_printTemps (fileTable p_ft) /*@modifies g_warningstream@*/ ; extern /*@unused@*/ /*@only@*/ cstring fileTable_unparse (fileTable p_ft) /*@*/ ; extern bool fileTable_exists (fileTable p_ft, cstring p_s) /*@*/ ; extern void fileTable_free (/*@only@*/ fileTable p_f); extern bool fileTable_isSpecialFile (fileTable p_ft, fileId p_fid) /*@*/ ; extern bool fileTable_isSystemFile (fileTable p_ft, fileId p_fid) /*@*/ ; extern bool fileTable_isXHFile (fileTable p_ft, fileId p_fid) /*@*/ ; extern /*@observer@*/ cstring fileTable_fileName (fileId p_fid) /*@*/ ; extern /*@observer@*/ cstring fileTable_fileNameBase (fileId p_fid) /*@*/ ; extern /*@observer@*/ cstring fileTable_rootFileName (fileId p_fid) /*@*/ ; extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE *fileTable_createFile (fileTable p_ft, cstring p_fname) /*@modifies p_ft, fileSystem@*/ ; extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE *fileTable_createMacrosFile (fileTable p_ft, cstring p_fname) /*@modifies p_ft, fileSystem@*/ ; # define fileTable_fileName(fid) (fileTable_getName(context_fileTable(), fid)) # define fileTable_fileNameBase(fid) (fileTable_getNameBase(context_fileTable(), fid)) # define fileTable_rootFileName(fid) (fileTable_getRootName(context_fileTable(), fid)) extern void fileTable_noDelete (fileTable, cstring); extern bool fileId_baseEqual (/*@sef@*/ fileId p_t1, /*@sef@*/ fileId p_t2) /*@*/ ; # define fileId_baseEqual(t1,t2) \ (fileId_equal (t1, t2) || fileTable_sameBase (context_fileTable (), t1, t2)) extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE * fileTable_openReadFile (fileTable p_ft, cstring p_fname) /*@modifies p_ft@*/ ; extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE * fileTable_openWriteFile (fileTable p_ft, cstring p_fname) /*@modifies p_ft@*/ ; extern /*@null@*/ /*@open@*/ /*@dependent@*/ FILE * fileTable_openWriteUpdateFile (fileTable p_ft, cstring p_fname) /*@modifies p_ft@*/ ; extern bool fileTable_closeFile (fileTable p_ft, FILE *p_f) /*@ensures closed p_f@*/ /*@modifies p_ft, p_f@*/ ; extern void fileTable_closeAll (fileTable p_ft) /*@modifies p_ft@*/ ; # else # error "Multiple include" #endif splint-3.1.2.dfsg1/src/Headers/sgrammar_tokens.h0000644021234200000250000001311207121317327017153 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /* < end of bison.head > */ typedef union { lltok tok; int count; specialClauseKind sck; qual typequal; qualList tquallist; ctype ctyp; sRef sr; /*@only@*/ qtype qtyp; /*@only@*/ cstring cname; /*@only@*/ idDecl ntyp; /*@only@*/ idDeclList ntyplist; /*@only@*/ uentryList flist; /*@owned@*/ uentryList entrylist; /*@observer@*/ /*@dependent@*/ uentry entry; /*@only@*/ uentry oentry; /*@only@*/ exprNode expr; /*@only@*/ enumNameList enumnamelist; /*@only@*/ exprNodeList alist; /*@only@*/ sRefSet srset; } YYSTYPE; #define BADTOK 258 #define SKIPTOK 259 #define CTOK_ELIPSIS 260 #define CASE 261 #define DEFAULT 262 #define CIF 263 #define CELSE 264 #define SWITCH 265 #define WHILE 266 #define DO 267 #define CFOR 268 #define GOTO 269 #define CONTINUE 270 #define BREAK 271 #define RETURN 272 #define TSEMI 273 #define TLBRACE 274 #define TRBRACE 275 #define TCOMMA 276 #define TCOLON 277 #define TASSIGN 278 #define TLPAREN 279 #define TRPAREN 280 #define TLSQBR 281 #define TRSQBR 282 #define TDOT 283 #define TAMPERSAND 284 #define TEXCL 285 #define TTILDE 286 #define TMINUS 287 #define TPLUS 288 #define TMULT 289 #define TDIV 290 #define TPERCENT 291 #define TLT 292 #define TGT 293 #define TCIRC 294 #define TBAR 295 #define TQUEST 296 #define CSIZEOF 297 #define ARROW_OP 298 #define CTYPEDEF 299 #define COFFSETOF 300 #define INC_OP 301 #define DEC_OP 302 #define LEFT_OP 303 #define RIGHT_OP 304 #define LE_OP 305 #define GE_OP 306 #define EQ_OP 307 #define NE_OP 308 #define AND_OP 309 #define OR_OP 310 #define MUL_ASSIGN 311 #define DIV_ASSIGN 312 #define MOD_ASSIGN 313 #define ADD_ASSIGN 314 #define SUB_ASSIGN 315 #define LEFT_ASSIGN 316 #define RIGHT_ASSIGN 317 #define AND_ASSIGN 318 #define XOR_ASSIGN 319 #define OR_ASSIGN 320 #define CSTRUCT 321 #define CUNION 322 #define CENUM 323 #define VA_ARG 324 #define VA_DCL 325 #define QGLOBALS 326 #define QMODIFIES 327 #define QNOMODS 328 #define QCONSTANT 329 #define QITER 330 #define QDEFINES 331 #define QUSES 332 #define QALLOCATES 333 #define QSETS 334 #define QRELEASES 335 #define QPRECLAUSE 336 #define QPOSTCLAUSE 337 #define QALT 338 #define QUNDEF 339 #define QKILLED 340 #define QENDMACRO 341 #define LLMACRO 342 #define LLMACROITER 343 #define LLMACROEND 344 #define TENDMACRO 345 #define QSWITCHBREAK 346 #define QLOOPBREAK 347 #define QINNERBREAK 348 #define QSAFEBREAK 349 #define QINNERCONTINUE 350 #define QFALLTHROUGH 351 #define QLINTNOTREACHED 352 #define QLINTFALLTHROUGH 353 #define QLINTFALLTHRU 354 #define QARGSUSED 355 #define QPRINTFLIKE 356 #define QLINTPRINTFLIKE 357 #define QSCANFLIKE 358 #define QMESSAGELIKE 359 #define QNOTREACHED 360 #define QCONST 361 #define QVOLATILE 362 #define QINLINE 363 #define QEXTENSION 364 #define QEXTERN 365 #define QSTATIC 366 #define QAUTO 367 #define QREGISTER 368 #define QOUT 369 #define QIN 370 #define QYIELD 371 #define QONLY 372 #define QTEMP 373 #define QSHARED 374 #define QREF 375 #define QUNIQUE 376 #define QCHECKED 377 #define QUNCHECKED 378 #define QCHECKEDSTRICT 379 #define QCHECKMOD 380 #define QKEEP 381 #define QKEPT 382 #define QPARTIAL 383 #define QSPECIAL 384 #define QOWNED 385 #define QDEPENDENT 386 #define QRETURNED 387 #define QEXPOSED 388 #define QNULL 389 #define QOBSERVER 390 #define QISNULL 391 #define QEXITS 392 #define QMAYEXIT 393 #define QNEVEREXIT 394 #define QTRUEEXIT 395 #define QFALSEEXIT 396 #define QLONG 397 #define QSIGNED 398 #define QUNSIGNED 399 #define QSHORT 400 #define QUNUSED 401 #define QSEF 402 #define QNOTNULL 403 #define QRELNULL 404 #define QABSTRACT 405 #define QCONCRETE 406 #define QMUTABLE 407 #define QIMMUTABLE 408 #define QTRUENULL 409 #define QFALSENULL 410 #define QEXTERNAL 411 #define QREFCOUNTED 412 #define QREFS 413 #define QNEWREF 414 #define QTEMPREF 415 #define QKILLREF 416 #define QRELDEF 417 #define CGCHAR 418 #define CBOOL 419 #define CINT 420 #define CGFLOAT 421 #define CDOUBLE 422 #define CVOID 423 #define QANYTYPE 424 #define QINTEGRALTYPE 425 #define QUNSIGNEDINTEGRALTYPE 426 #define QSIGNEDINTEGRALTYPE 427 #define IDENTIFIER 428 #define NEW_IDENTIFIER 429 #define CCONSTANT 430 #define ITER_NAME 431 #define ITER_ENDNAME 432 #define TYPE_NAME 433 #define TYPE_NAME_OR_ID 434 extern YYSTYPE yylval; /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ splint-3.1.2.dfsg1/src/Headers/flag_codes.h0000644021234200000250000000154607630463446016066 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** flag_codes.h */ # ifndef FLAGCODES_H # define FLAGCODES_H /* ** attempt to keep order consistent with that in flags.c */ typedef enum { MODENAME_FLAG = -3, SKIP_FLAG = -2, INVALID_FLAG = -1, # include "flag_codes.gen" LAST_FLAG } flagcode; /*@constant flagcode NUMFLAGS; @*/ # define NUMFLAGS (LAST_FLAG) /*@constant int NUMVALUEFLAGS; @*/ # define NUMVALUEFLAGS 15 /*@constant int NUMSTRINGFLAGS; @*/ # define NUMSTRINGFLAGS 28 /*@iter allFlagCodes (yield flagcode f); @*/ # define allFlagCodes(m_code) \ { /*@+enumint@*/ flagcode m_code; for (m_code = 0; m_code < NUMFLAGS; m_code++) \ /*@=enumint@*/ { # define end_allFlagCodes }} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sHerald.h0000644021234200000250000000046407121317327015347 0ustar fax/*@constant observer char *SANITIZE_VERSION;@*/ # define SANITIZE_VERSION "Sanitizer 0.1+ --- Fri Dec 12 19:51:34 EST 1997" /*@constant observer char *SANITIZE_COMPILE;@*/ # define SANITIZE_COMPILE "Compiled using gcc -O5 on Linux spd.lcs.mit.edu 2.0.32 #4 Sun Nov 16 22:17:18 EST 1997 i586 unknown by evs" splint-3.1.2.dfsg1/src/Headers/flagMarker.h0000644021234200000250000000433507630463446016052 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** invariant: line1 <= line2 ** if line1 == line2, col1 <= col2. */ # ifndef FLAGMARKER_H # define FLAGMARKER_H typedef enum { FMK_LOCALSET, FMK_IGNOREON, FMK_IGNORECOUNT, FMK_IGNOREOFF, FMK_SUPPRESS } flagMarkerKind ; typedef struct { flagMarkerKind kind; flagcode code; /*@reldef@*/ union { ynm set; int nerrors; } info; fileloc loc; } *flagMarker ; extern bool flagMarker_isLocalSet (flagMarker p_c) /*@*/ ; # define flagMarker_isLocalSet(c) ((c)->kind == FMK_LOCALSET) extern bool flagMarker_isSuppress (flagMarker p_c) /*@*/ ; # define flagMarker_isSuppress(c) ((c)->kind == FMK_SUPPRESS) extern bool flagMarker_isIgnoreOn (flagMarker p_c) /*@*/ ; # define flagMarker_isIgnoreOn(c) ((c)->kind == FMK_IGNOREON) extern bool flagMarker_isIgnoreOff (flagMarker p_c) /*@*/ ; # define flagMarker_isIgnoreOff(c) ((c)->kind == FMK_IGNOREOFF) extern bool flagMarker_isIgnoreCount (flagMarker p_c) /*@*/ ; # define flagMarker_isIgnoreCount(c) ((c)->kind == FMK_IGNORECOUNT) extern flagMarker flagMarker_createLocalSet (flagcode p_code, ynm p_set, fileloc p_loc) /*@*/ ; extern flagMarker flagMarker_createIgnoreOn (fileloc p_loc) /*@*/ ; extern flagMarker flagMarker_createIgnoreOff (fileloc p_loc) /*@*/ ; extern flagMarker flagMarker_createIgnoreCount (int p_count, fileloc p_loc) /*@*/ ; extern flagMarker flagMarker_createSuppress (flagcode p_code, fileloc p_loc) /*@*/ ; extern void flagMarker_free (/*@only@*/ flagMarker p_c) ; extern bool flagMarker_sameFile (flagMarker p_c, fileloc p_loc) /*@*/ ; extern /*@only@*/ cstring flagMarker_unparse (flagMarker p_c) /*@*/ ; extern bool flagMarker_beforeMarker (flagMarker p_c, fileloc p_loc) /*@*/ ; extern bool flagMarker_equal (flagMarker p_f1, flagMarker p_f2) /*@*/ ; extern ynm flagMarker_getSet (flagMarker p_f) /*@*/ ; extern flagcode flagMarker_getCode (flagMarker p_f) /*@*/ ; extern int flagMarker_getCount (flagMarker p_f) /*@*/ ; extern /*@observer@*/ fileloc flagMarker_getLoc (flagMarker p_f) /*@*/ ; # define flagMarker_getLoc(f) ((f)->loc) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/shift.h0000644021234200000250000000054007630463450015101 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** shift.h */ extern void LSLGenShift (ltoken p_tok); extern void LSLGenShiftOnly (/*@only@*/ ltoken p_tok); extern /*@only@*/ ltoken LSLGenTopPopShiftStack(void); extern void LSLGenInit(bool p_LSLParse); splint-3.1.2.dfsg1/src/Headers/flagMarkerList.h0000644021234200000250000000220707630463446016702 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** flagMarkerList.h */ # ifndef flagMarkerList_H # define flagMarkerList_H typedef /*@only@*/ flagMarker o_flagMarker; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_flagMarker *elements; } *flagMarkerList ; extern /*@only@*/ flagMarkerList flagMarkerList_new (void) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstring flagMarkerList_unparse (flagMarkerList p_s) /*@*/ ; extern void flagMarkerList_free (/*@only@*/ flagMarkerList p_s) ; extern bool flagMarkerList_add (flagMarkerList p_s, /*@only@*/ flagMarker p_fm) /*@modifies p_s@*/ ; extern ynm flagMarkerList_suppressError (flagMarkerList p_s, flagcode p_code, fileloc p_loc) /*@*/ ; extern void flagMarkerList_checkSuppressCounts (flagMarkerList p_s) /*@modifies g_warningstream@*/ ; extern bool flagMarkerList_inIgnore (flagMarkerList p_s, fileloc p_loc) /*@*/ ; /*@constant int flagMarkerListBASESIZE;@*/ # define flagMarkerListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/signature2.h0000644021234200000250000000016507121317327016046 0ustar fax# ifndef SIGNATURE2_H # define SIGNATURE2_H # include "signature_gen.h" # else # error "Multiple includes" # endif splint-3.1.2.dfsg1/src/Headers/flags.h0000644021234200000250000001126010102766474015061 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef FLAGS_H # define FLAGS_H typedef enum { FK_ABSTRACT, FK_ANSI, FK_BEHAVIOR, FK_BOUNDS, FK_COMMENTS, FK_COMPLETE, FK_CONTROL, FK_DEBUG, FK_DECL, FK_SYNCOMMENTS, FK_HINTS, FK_SYSTEMFUNCTIONS, FK_ITS4, FK_DEF, FK_DIRECT, FK_DISPLAY, FK_EFFECT, FK_EXPORT, FK_EXPOSURE, FK_EXTENSIBLE, FK_FORMAT, FK_GLOBAL, FK_GLOBALS, FK_HEADERS, FK_HELP, FK_IGNORERET, FK_INIT, FK_ITER, FK_LIBS, FK_LIMITS, FK_MACROS, FK_MEMORY, FK_MODIFIES, FK_NAMES, FK_NONE, FK_NULL, FK_OPS, FK_PRED, FK_PREPROC, FK_SECRET, FK_SUPPRESS, FK_SYNTAX, FK_TYPE, FK_TYPEEQ, FK_NUMBERS, FK_POINTER, FK_UNRECOG, FK_USE, FK_BOOL, FK_ALIAS, FK_PROTOS, FK_SPEC, FK_IMPLICIT, FK_FILES, FK_ERRORS, FK_UNSPEC, FK_SPEED, FK_PARAMS, FK_DEAD, FK_SECURITY, FK_LEAK, FK_ARRAY, FK_OBSOLETE, FK_PREFIX, FK_WARNUSE } flagkind; extern void listAllCategories (void); extern void printAlphaFlags (void); extern void printAllFlags (bool p_desc, bool p_full); extern void printFlagManual (bool p_html); extern void flagcode_recordError (flagcode p_f); extern void flagcode_recordSuppressed (flagcode p_f); extern int flagcode_numReported (flagcode p_f); extern bool flagcode_isNamePrefixFlag (flagcode p_f); extern /*@only@*/ cstring describeFlag (cstring p_flagname); extern flagcode flags_identifyFlag (cstring p_s) /*@modifies g_warningstream@*/ ; extern flagcode flags_identifyFlagQuiet (cstring p_s) /*@modifies nothing@*/ ; extern void flags_setValueFlag (flagcode p_opt, /*@only@*/ cstring p_arg); extern void flags_setStringFlag (flagcode p_opt, /*@only@*/ cstring p_arg); extern /*@observer@*/ cstring flagcode_unparse (flagcode p_code) /*@*/ ; extern int flagcode_valueIndex (flagcode p_f) /*@*/ ; extern int flagcode_stringIndex (flagcode p_f) /*@*/ ; extern int flagcode_priority (flagcode p_code) /*@*/ ; extern bool flagcode_equal (flagcode p_code1, flagcode p_code2) /*@*/ ; # define flagcode_equal(c1, c2) ((c1) == (c2)) extern /*@observer@*/ cstring flagcodeHint (flagcode p_f); extern flagkind identifyCategory (cstring p_s) /*@*/ ; extern void printCategory (flagkind p_kind) /*@modifies g_warningstream@*/ ; extern bool flagcode_isInvalid (flagcode p_f) /*@*/ ; # define flagcode_isInvalid(f) ((f) == INVALID_FLAG) extern bool flagcode_isSkip (flagcode p_f) /*@*/ ; # define flagcode_isSkip(f) ((f) == SKIP_FLAG) extern bool flagcode_isModeName (flagcode p_f) /*@*/ ; # define flagcode_isModeName(f) ((f) == MODENAME_FLAG) extern bool flagcode_isValid (flagcode p_f) /*@*/ ; # define flagcode_isValid(f) ((f) != INVALID_FLAG) extern bool flagcode_isPassThrough (/*@sef@*/ flagcode p_f); # define flagcode_isPassThrough(f) ((f) == FLG_DEFINE || (f) == FLG_UNDEFINE) extern bool flagcode_isLibraryFlag (/*@sef@*/ flagcode p_f); # define flagcode_isLibraryFlag(f) \ ((f) == FLG_POSIXLIB || (f) == FLG_POSIXSTRICTLIB \ || (f) == FLG_UNIXLIB || (f) == FLG_UNIXSTRICTLIB \ || (f) == FLG_STRICTLIB || (f) == FLG_NOLIB \ || (f) == FLG_ANSILIB) extern bool flagcode_isWarnUseFlag (/*@sef@*/ flagcode p_f); # define flagcode_isWarnUseFlag(f) \ ((f) == FLG_BUFFEROVERFLOW || (f) == FLG_BUFFEROVERFLOWHIGH) extern bool flagcode_hasNumber (flagcode p_f) /*@*/ ; extern bool flagcode_hasChar (flagcode p_f) /*@*/ ; extern bool flagcode_hasString (flagcode p_f) /*@*/ ; extern bool flagcode_hasArgument (flagcode p_f) /*@*/ ; /*@constant observer cstring DEFAULT_MODE;@*/ # define DEFAULT_MODE (cstring_makeLiteralTemp ("standard")) extern bool flags_isModeName (cstring p_s) /*@*/ ; extern /*@only@*/ cstring describeModes (void) /*@modifies g_messagestream@*/ ; extern /*@only@*/ cstring describeMode (/*@temp@*/ cstring p_mode) /*@*/ ; extern void summarizeErrors (void) /*@modifies g_messagestream@*/ ; extern bool flagcode_isNameChecksFlag (flagcode p_f) /*@*/ ; extern bool flagcode_isIdemFlag (flagcode p_f) /*@*/ ; extern bool flagcode_isModeFlag (flagcode p_f) /*@*/ ; extern bool flagcode_isSpecialFlag (flagcode p_f) /*@*/ ; extern bool flagcode_isGlobalFlag (flagcode p_f) /*@*/ ; extern bool flagcode_isMessageControlFlag (flagcode p_f) /*@*/ ; extern bool flagcode_isHelpFlag (flagcode p_f) /*@*/ ; extern void flags_initMod (void) /*@modifies internalState@*/ ; extern void flags_processFlags (bool p_inCommandLine, fileIdList p_xfiles, fileIdList p_cfiles, fileIdList p_lclfiles, fileIdList p_mtfiles, cstringList *p_passThroughArgs, int p_argc, /*@null@*/ char **p_argv) /*@requires maxRead(p_argv) >= (p_argc - 1) @*/ /* returns true if normal, false if execution should exit */ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/signature_gen.h0000644021234200000250000001457410645776226016642 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { LST_SIMPLEID = 258, LST_LOGICALOP = 259, LST_EQOP = 260, LST_SIMPLEOP = 261, LST_MAPSYM = 262, LST_FIELDMAPSYM = 263, LST_MARKERSYM = 264, LST_ifTOKEN = 265, LST_thenTOKEN = 266, LST_elseTOKEN = 267, LST_LBRACKET = 268, LST_RBRACKET = 269, LST_SELECTSYM = 270, LST_SEPSYM = 271, LST_OPENSYM = 272, LST_CLOSESYM = 273, LST_COLON = 274, LST_COMMA = 275, LST_EOL = 276, LST_COMMENTSYM = 277, LST_WHITESPACE = 278, LST_QUANTIFIERSYM = 279, LST_EQUATIONSYM = 280, LST_EQSEPSYM = 281, LST_COMPOSESYM = 282, LST_LPAR = 283, LST_RPAR = 284, LST_assertsTOKEN = 285, LST_assumesTOKEN = 286, LST_byTOKEN = 287, LST_convertsTOKEN = 288, LST_enumerationTOKEN = 289, LST_equationsTOKEN = 290, LST_exemptingTOKEN = 291, LST_forTOKEN = 292, LST_generatedTOKEN = 293, LST_impliesTOKEN = 294, LST_includesTOKEN = 295, LST_introducesTOKEN = 296, LST_ofTOKEN = 297, LST_partitionedTOKEN = 298, LST_traitTOKEN = 299, LST_tupleTOKEN = 300, LST_unionTOKEN = 301, LST_BADTOKEN = 302 }; #endif /* Tokens. */ #define LST_SIMPLEID 258 #define LST_LOGICALOP 259 #define LST_EQOP 260 #define LST_SIMPLEOP 261 #define LST_MAPSYM 262 #define LST_FIELDMAPSYM 263 #define LST_MARKERSYM 264 #define LST_ifTOKEN 265 #define LST_thenTOKEN 266 #define LST_elseTOKEN 267 #define LST_LBRACKET 268 #define LST_RBRACKET 269 #define LST_SELECTSYM 270 #define LST_SEPSYM 271 #define LST_OPENSYM 272 #define LST_CLOSESYM 273 #define LST_COLON 274 #define LST_COMMA 275 #define LST_EOL 276 #define LST_COMMENTSYM 277 #define LST_WHITESPACE 278 #define LST_QUANTIFIERSYM 279 #define LST_EQUATIONSYM 280 #define LST_EQSEPSYM 281 #define LST_COMPOSESYM 282 #define LST_LPAR 283 #define LST_RPAR 284 #define LST_assertsTOKEN 285 #define LST_assumesTOKEN 286 #define LST_byTOKEN 287 #define LST_convertsTOKEN 288 #define LST_enumerationTOKEN 289 #define LST_equationsTOKEN 290 #define LST_exemptingTOKEN 291 #define LST_forTOKEN 292 #define LST_generatedTOKEN 293 #define LST_impliesTOKEN 294 #define LST_includesTOKEN 295 #define LST_introducesTOKEN 296 #define LST_ofTOKEN 297 #define LST_partitionedTOKEN 298 #define LST_traitTOKEN 299 #define LST_tupleTOKEN 300 #define LST_unionTOKEN 301 #define LST_BADTOKEN 302 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { ltoken ltok; /* a leaf is also an ltoken */ unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ opFormNode opform; /*@owned@*/ sigNode signature; /*@only@*/ nameNode name; /*@owned@*/ lslOp operator; /*@only@*/ lslOpList operators; /*@-redef@*/ /*@-matchfields@*/ } /* Line 1529 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/Headers/flagSpec.h0000644021234200000250000000261007651115037015506 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** flagSpec.h */ # ifndef flagSpec_H # define flagSpec_H /*:private:*/ typedef struct { cstring name; flagcode code; } *flagSpecItem; abst_typedef /*@null@*/ struct s_flagSpec *flagSpec; struct s_flagSpec { flagSpecItem tspec; /* combination logic if necessary */ /*@null@*/ /*@only@*/ flagSpec trest; } ; /*@constant null flagSpec flagSpec_undefined; @*/ # define flagSpec_undefined ((flagSpec) NULL) extern /*@falsewhennull@*/ bool flagSpec_isDefined (flagSpec p_e) /*@*/ ; # define flagSpec_isDefined(e) ((e) != flagSpec_undefined) extern /*@only@*/ flagSpec flagSpec_createPlain (/*@only@*/ cstring) ; extern /*@only@*/ flagSpec flagSpec_createOr (/*@only@*/ cstring, /*@only@*/ flagSpec) ; extern /*@only@*/ flagSpec flagSpec_copy (flagSpec) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstring flagSpec_unparse (flagSpec) /*@*/ ; extern void flagSpec_free (/*@only@*/ flagSpec) ; extern /*@only@*/ cstring flagSpec_dump (flagSpec) /*@*/ ; extern /*@only@*/ flagSpec flagSpec_undump (char **p_s) /*@modifies p_s@*/ ; extern flagcode flagSpec_getDominant (flagSpec) /*@*/ ; extern flagcode flagSpec_getFirstOn (flagSpec, fileloc) /*@*/ ; extern bool flagSpec_isOn (flagSpec, fileloc) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/signature.h0000644021234200000250000000057707630463450015777 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** signature.h */ # ifndef SIGNATURE_H # define SIGNATURE_H # include "code.h" # ifndef OSD_H # include "osd.h" # endif /*@-declundef@*/ extern void PrintToken(ltoken p_tok); /*@=declundef@*/ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/forwardTypes.h0000644021234200000250000001050007730061143016444 0ustar fax# ifndef FORWARDTYPES_H # define FORWARDTYPES_H # include "lclForwardTypes.h" # if defined (WIN32) || defined (OS2) && defined (__IBMC__) /* Microsoft doesn't support ISO C99 yet */ /*@-namechecks@*/ typedef int bool; /*@=namechecks@*/ # endif abst_typedef /*@null@*/ struct s_sRef *sRef; abst_typedef /*@null@*/ struct s_uentry *uentry; typedef struct s_hashNode *hashNode; immut_typedef int typeIdSet; typedef /*@only@*/ uentry o_uentry; abst_typedef struct s_mttok *mttok; abst_typedef /*@null@*/ struct s_idDecl *idDecl; abst_typedef /*@null@*/ struct s_usymtab *usymtab; abst_typedef /*@null@*/ struct s_exprNode *exprNode; abst_typedef /*@null@*/ struct s_guardSet *guardSet; abst_typedef /*@null@*/ struct s_sRefSet *sRefSet; abst_typedef /*@null@*/ struct s_sRefList *sRefList ; abst_typedef /*@null@*/ struct s_aliasTable *aliasTable; abst_typedef /*@null@*/ struct s_fileloc *fileloc; abst_typedef /*@null@*/ struct s_cstringTable *cstringTable; abst_typedef /*@null@*/ struct s_genericTable *genericTable; abst_typedef /*@null@*/ struct s_annotationInfo *annotationInfo; abst_typedef /*@null@*/ struct s_inputStream *inputStream; abst_typedef /*@null@*/ struct s_stateValue *stateValue; abst_typedef /*@null@*/ struct s_pointers *pointers; abst_typedef /*@null@*/ genericTable valueTable; abst_typedef /*@null@*/ genericTable metaStateTable; abst_typedef /*@null@*/ genericTable annotationTable; abst_typedef /*@null@*/ struct s_metaStateInfo *metaStateInfo; abst_typedef /*@null@*/ struct s_functionConstraint *functionConstraint; abst_typedef struct s_metaStateConstraint *metaStateConstraint; abst_typedef /*@null@*/ struct s_metaStateConstraintList *metaStateConstraintList ; abst_typedef struct s_metaStateSpecifier *metaStateSpecifier; abst_typedef /*@null@*/ struct s_metaStateExpression *metaStateExpression; abst_typedef /*@null@*/ struct s_functionClause *functionClause; abst_typedef /*@null@*/ struct s_functionClauseList *functionClauseList; abst_typedef struct s_globalsClause *globalsClause; abst_typedef struct s_modifiesClause *modifiesClause; abst_typedef /*@null@*/ struct s_warnClause *warnClause; abst_typedef struct s_stateClause *stateClause; abst_typedef /*@null@*/ struct s_stateClauseList *stateClauseList; /* The mt grammar nodes: */ abst_typedef struct s_mtDeclarationNode *mtDeclarationNode; abst_typedef /*@null@*/ struct s_mtDeclarationPiece *mtDeclarationPiece; abst_typedef /*@null@*/ struct s_mtDeclarationPieces *mtDeclarationPieces; abst_typedef /*@null@*/ struct s_mtContextNode *mtContextNode; abst_typedef struct s_mtValuesNode *mtValuesNode; abst_typedef struct s_mtDefaultsNode *mtDefaultsNode; abst_typedef /*@null@*/ struct s_mtDefaultsDeclList *mtDefaultsDeclList; abst_typedef struct s_mtDefaultsDecl *mtDefaultsDecl; abst_typedef struct s_mtAnnotationsNode *mtAnnotationsNode; abst_typedef /*@null@*/ struct s_mtAnnotationList *mtAnnotationList; abst_typedef struct s_mtAnnotationDecl *mtAnnotationDecl; abst_typedef struct s_mtMergeNode *mtMergeNode; abst_typedef struct s_mtMergeItem *mtMergeItem; abst_typedef /*@null@*/ struct s_mtMergeClauseList *mtMergeClauseList; abst_typedef struct s_mtMergeClause *mtMergeClause; abst_typedef /*@null@*/ struct s_mtTransferClauseList *mtTransferClauseList; abst_typedef struct s_mtTransferClause *mtTransferClause; abst_typedef /*@null@*/ struct s_mtLoseReferenceList *mtLoseReferenceList; abst_typedef struct s_mtLoseReference *mtLoseReference; abst_typedef struct s_mtTransferAction *mtTransferAction; abst_typedef sRefSet globSet; abst_typedef /*@null@*/ struct s_constraint *constraint; abst_typedef /*@null@*/ struct s_constraintList *constraintList; abst_typedef /*@null@*/ struct s_ctypeList *ctypeList; abst_typedef /*@null@*/ ctypeList fileIdList; /* DRL modified 9 26 00 */ abst_typedef /*@null@*/ struct s_constraintExpr *constraintExpr; abst_typedef /*@null@*/ char *cstring; typedef /*@only@*/ cstring o_cstring; abst_typedef /*@null@*/ struct s_cstringSList *cstringSList; typedef enum e_LSLInitRuleCode LSLInitRuleCode; immut_typedef int ctype; /* sRef -> bool */ typedef bool (*sRefTest) (sRef); /* sRef, fileloc -> void; modifies sRef */ typedef void (*sRefMod) (sRef, fileloc); /* sRef, int, fileloc -> void; modifies sRef */ typedef void (*sRefModVal) (sRef, int, fileloc); /* sRef -> void */ typedef void (*sRefShower) (sRef); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/signNode.h0000644021234200000250000000055607630463450015541 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; sortList domain; sort range; unsigned long int key; } *signNode; extern /*@only@*/ cstring signNode_unparse (signNode p_sn) /*@*/ ; extern void signNode_free (/*@only@*/ signNode p_sn); splint-3.1.2.dfsg1/src/Headers/functionClause.h0000644021234200000250000000753607651115037016760 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** functionClause.h */ # ifndef FUNCTIONCLAUSE_H # define FUNCTIONCLAUSE_H /*:private:*/ typedef enum { FCK_GLOBALS, FCK_MODIFIES, FCK_WARN, FCK_STATE, FCK_ENSURES, FCK_REQUIRES, FCK_DEAD } functionClauseKind; struct s_functionClause { functionClauseKind kind; union { /*@null@*/ globalsClause globals; /*@null@*/ modifiesClause modifies; /*@null@*/ warnClause warn; /*@null@*/ stateClause state; /*@null@*/ functionConstraint constraint; } val; } ; /* functionClause defined in forwardTypes.h */ /*@constant null functionClause functionClause_undefined; @*/ # define functionClause_undefined NULL extern /*@falsewhennull@*/ bool functionClause_isDefined(functionClause) /*@*/ ; # define functionClause_isDefined(p_h) ((p_h) != functionClause_undefined) extern bool functionClause_isGlobals (functionClause) /*@*/ ; # define functionClause_isGlobals(p_h) (functionClause_matchKind(p_h, FCK_GLOBALS)) extern bool functionClause_isNoMods (/*@sef@*/ functionClause) /*@*/ ; # define functionClause_isNoMods(p_h) (functionClause_matchKind(p_h, FCK_MODIFIES) && modifiesClause_isNoMods (functionClause_getModifies (p_h))) extern bool functionClause_isModifies (functionClause) /*@*/ ; # define functionClause_isModifies(p_h) (functionClause_matchKind(p_h, FCK_MODIFIES)) extern bool functionClause_isState (functionClause) /*@*/ ; # define functionClause_isState(p_h) (functionClause_matchKind(p_h, FCK_STATE)) extern bool functionClause_isWarn (functionClause) /*@*/ ; # define functionClause_isWarn(p_h) (functionClause_matchKind(p_h, FCK_WARN)) extern bool functionClause_isEnsures (functionClause) /*@*/ ; # define functionClause_isEnsures(p_h) (functionClause_matchKind(p_h, FCK_ENSURES)) extern bool functionClause_isRequires (functionClause) /*@*/ ; # define functionClause_isRequires(p_h) (functionClause_matchKind(p_h, FCK_REQUIRES)) extern /*@nullwhentrue@*/ bool functionClause_isUndefined(functionClause) /*@*/ ; # define functionClause_isUndefined(p_h) ((p_h) == functionClause_undefined) extern functionClause functionClause_createGlobals (/*@only@*/ globalsClause) /*@*/ ; extern functionClause functionClause_createModifies (/*@only@*/ modifiesClause) /*@*/ ; extern functionClause functionClause_createWarn (/*@only@*/ warnClause) /*@*/ ; extern functionClause functionClause_createState (/*@only@*/ stateClause) /*@*/ ; extern functionClause functionClause_createEnsures (/*@only@*/ functionConstraint) /*@*/ ; extern functionClause functionClause_createRequires (/*@only@*/ functionConstraint) /*@*/ ; extern /*@exposed@*/ globalsClause functionClause_getGlobals (functionClause) /*@*/ ; extern /*@exposed@*/ modifiesClause functionClause_getModifies (functionClause) /*@*/ ; extern /*@exposed@*/ stateClause functionClause_getState (functionClause) /*@*/ ; extern /*@exposed@*/ warnClause functionClause_getWarn (functionClause) /*@*/ ; extern /*@exposed@*/ functionConstraint functionClause_getEnsures (functionClause) /*@*/ ; extern /*@exposed@*/ functionConstraint functionClause_getRequires (functionClause) /*@*/ ; extern /*@only@*/ stateClause functionClause_takeState (functionClause p_fc) /*@modifies p_fc@*/ ; extern /*@only@*/ functionConstraint functionClause_takeEnsures (functionClause p_fc) /*@modifies p_fc@*/ ; extern /*@only@*/ functionConstraint functionClause_takeRequires (functionClause p_fc) /*@modifies p_fc@*/ ; extern /*@only@*/ warnClause functionClause_takeWarn (functionClause p_fc) /*@modifies p_fc@*/ ; extern bool functionClause_matchKind (functionClause p_p, functionClauseKind p_kind) /*@*/ ; extern void functionClause_free (/*@only@*/ functionClause p_node) ; extern /*@only@*/ cstring functionClause_unparse (functionClause p_p) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sigNode.h0000644021234200000250000000077107630463450015362 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken tok; ltokenList domain; ltoken range; unsigned long int key; } *sigNode; extern /*@only@*/ cstring sigNode_unparse (/*@null@*/ sigNode p_n) /*@*/ ; extern void sigNode_free (/*@only@*/ /*@null@*/ sigNode p_x); extern /*@only@*/ sigNode sigNode_copy (sigNode p_s) /*@*/ ; extern void sigNode_markOwned (/*@owned@*/ sigNode p_n); splint-3.1.2.dfsg1/src/Headers/functionClauseList.h0000644021234200000250000000517407671271605017616 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef FUNCTIONCLAUSELIST_H # define FUNCTIONCLAUSELIST_H /*:private:*/ typedef /*@only@*/ functionClause o_functionClause; struct s_functionClauseList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_functionClause *elements; } ; /*@constant null functionClauseList functionClauseList_undefined;@*/ # define functionClauseList_undefined ((functionClauseList) NULL) extern /*@falsewhennull@*/ bool functionClauseList_isDefined (functionClauseList p_s) /*@*/ ; # define functionClauseList_isDefined(s) ((s) != functionClauseList_undefined) extern /*@nullwhentrue@*/ bool functionClauseList_isUndefined (functionClauseList p_s) /*@*/ ; # define functionClauseList_isUndefined(s) ((s) == functionClauseList_undefined) extern int functionClauseList_size (/*@sef@*/ functionClauseList) /*@*/ ; # define functionClauseList_size(s) (functionClauseList_isDefined (s) ? (s)->nelements : 0) extern /*@unused@*/ /*@falsewhennull@*/ bool functionClauseList_empty (/*@sef@*/ functionClauseList) /*@*/ ; # define functionClauseList_empty(s) (functionClauseList_size(s) == 0) extern cstring functionClauseList_unparseSep (functionClauseList p_s, cstring p_sep) /*@*/ ; extern /*@unused@*/ /*@only@*/ functionClauseList functionClauseList_new (void) /*@*/ ; extern /*@only@*/ functionClauseList functionClauseList_single (/*@keep@*/ functionClause p_el) /*@*/ ; extern /*@unused@*/ functionClauseList functionClauseList_add (/*@returned@*/ functionClauseList p_s, /*@keep@*/ functionClause p_el) /*@modifies p_s@*/ ; extern /*@only@*/ functionClauseList functionClauseList_prepend (/*@only@*/ functionClauseList p_s, /*@keep@*/ functionClause p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring functionClauseList_unparse (functionClauseList p_s) ; extern void functionClauseList_free (/*@only@*/ functionClauseList p_s) ; functionClauseList functionClauseList_setImplicitConstraints (/*@returned@*/ functionClauseList p_s); /*@constant int functionClauseListBASESIZE;@*/ # define functionClauseListBASESIZE MIDBASESIZE /*@iter functionClauseList_elements (sef functionClauseList x, yield exposed functionClause el); @*/ # define functionClauseList_elements(x, m_el) \ { if (functionClauseList_isDefined (x)) { \ int m_ind; functionClause *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { functionClause m_el = *(m_elements++); # define end_functionClauseList_elements }}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sigNodeSet.h0000644021234200000250000000402207630463450016027 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** sigNodeSet.h ** ** based on set_template.h */ # ifndef SIGNODESET_H # define SIGNODESET_H typedef /*@owned@*/ sigNode o_sigNode; abst_typedef /*@null@*/ struct { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ o_sigNode *elements; } *sigNodeSet ; /*@iter sigNodeSet_elements (sef sigNodeSet s, yield exposed sigNode el); @*/ # define sigNodeSet_elements(x, m_el) \ { if (sigNodeSet_isDefined (x)) { \ int m_ind; \ for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ { sigNode m_el = (x)->elements[m_ind]; # define end_sigNodeSet_elements }}} /*@constant null sigNodeSet sigNodeSet_undefined; @*/ # define sigNodeSet_undefined ((sigNodeSet) 0) extern /*@falsewhennull@*/ bool sigNodeSet_isDefined (sigNodeSet p_s) /*@*/ ; # define sigNodeSet_isDefined(s) \ ((s) != sigNodeSet_undefined) extern /*@nullwhentrue@*/ bool sigNodeSet_isUndefined (sigNodeSet p_s) /*@*/ ; # define sigNodeSet_isUndefined(s) \ ((s) == sigNodeSet_undefined) extern bool sigNodeSet_isEmpty (/*@sef@*/ sigNodeSet p_s) /*@*/ ; # define sigNodeSet_isEmpty(s) \ (sigNodeSet_isUndefined(s) || (s)->entries == 0) extern int sigNodeSet_size (/*@sef@*/ sigNodeSet p_s) /*@*/ ; # define sigNodeSet_size(s) (sigNodeSet_isDefined (s) ? (s)->entries : 0) extern /*@only@*/ sigNodeSet sigNodeSet_new(void) /*@*/ ; extern /*@only@*/ sigNodeSet sigNodeSet_singleton (/*@owned@*/ sigNode p_el) /*@*/ ; extern bool sigNodeSet_insert (sigNodeSet p_s, /*@owned@*/ sigNode p_el) /*@modifies p_s@*/ ; extern /*@only@*/ cstring sigNodeSet_unparse (sigNodeSet p_s) /*@*/ ; extern /*@only@*/ cstring sigNodeSet_unparsePossibleAritys (sigNodeSet p_s) /*@*/ ; extern void sigNodeSet_free (/*@only@*/ sigNodeSet p_s); extern /*@only@*/ cstring sigNodeSet_unparseSomeSigs (sigNodeSet p_s) /*@*/ ; /*@constant int sigNodeSetBASESIZE;@*/ # define sigNodeSetBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/functionConstraint.h0000644021234200000250000000444007630463446017666 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** functionConstraint.h */ # ifndef FCNCONSTRAINT_H # define FcNCONSTRAINT_H typedef enum { FCT_BUFFER, FCT_METASTATE, FCT_CONJUNCT } functionConstraintKind ; struct s_functionConstraint { functionConstraintKind kind; union { /*@only@*/ constraintList buffer; /*@only@*/ metaStateConstraint metastate; struct { functionConstraint op1; functionConstraint op2; } conjunct; } constraint; } ; /*@constant null functionConstraint functionConstraint_undefined; @*/ # define functionConstraint_undefined ((functionConstraint) NULL) extern /*@falsewhennull@*/ bool functionConstraint_isDefined (functionConstraint) /*@*/ ; # define functionConstraint_isDefined(p_info) ((p_info) != NULL) extern /*@falsewhennull@*/ bool functionConstraint_isBufferConstraint (/*@sef@*/ functionConstraint) /*@*/ ; # define functionConstraint_isBufferConstraint(p_con) (((p_con) != NULL) && ((p_con)->kind == FCT_BUFFER)) extern void functionConstraint_addBufferConstraints (functionConstraint p_node, /*@only@*/ constraintList) /*@modifies p_node@*/ ; extern /*@nullwhentrue@*/ bool functionConstraint_isUndefined (functionConstraint) /*@*/ ; # define functionConstraint_isUndefined(p_info) ((p_info) == NULL) extern functionConstraint functionConstraint_copy (functionConstraint) /*@*/ ; extern functionConstraint functionConstraint_createBufferConstraint (/*@only@*/ constraintList) ; extern functionConstraint functionConstraint_createMetaStateConstraint (/*@only@*/ metaStateConstraint) ; extern bool functionConstraint_hasBufferConstraint (functionConstraint) /*@*/ ; extern bool functionConstraint_hasMetaStateConstraint (functionConstraint) /*@*/ ; extern functionConstraint functionConstraint_conjoin (/*@only@*/ functionConstraint, /*@only@*/ functionConstraint) ; extern /*@only@*/ constraintList functionConstraint_getBufferConstraints (functionConstraint) /*@*/ ; extern /*@only@*/ metaStateConstraintList functionConstraint_getMetaStateConstraints (functionConstraint) /*@*/ ; extern cstring functionConstraint_unparse (functionConstraint) /*@*/ ; extern void functionConstraint_free (/*@only@*/ functionConstraint) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sort.h0000644021234200000250000001256607641733021014762 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** sort.h */ # ifndef sort_H # define sort_H /*@constant observer char *BEGINSORTTABLE;@*/ # define BEGINSORTTABLE "%LCLSortTable" /*@constant observer char *SORTTABLEEND;@*/ # define SORTTABLEEND "%LCLSortTableEnd" typedef enum { SRT_FIRST, SRT_NONE, SRT_HOF, SRT_PRIM, SRT_SYN, SRT_PTR, SRT_OBJ, SRT_ARRAY, SRT_VECTOR, SRT_STRUCT, SRT_TUPLE, SRT_UNION, SRT_UNIONVAL, SRT_ENUM, SRT_LAST } sortKind; typedef struct s_smemberInfo { lsymbol name; sort sort; /*@reldef@*/ lsymbol sortname; /* useful for sort_imports (yuk!) */ /*@null@*/ /*@dependent@*/ struct s_smemberInfo *next; } smemberInfo; /*@constant null smemberInfo *smemberInfo_undefined; @*/ # define smemberInfo_undefined ((smemberInfo *)NULL) typedef struct { sortKind kind; /* Handle for this sort in the table of known sorts */ sort handle; /* ** if SRT_PRIM then name is gotten from LSL traits. ** elseif SRT_SYN then it is derived from a user-given typdef name, add _. ** elseif SRT_NONE then may contain "_error". ** elseif keeps the name of this sort (unique) */ lsymbol name; /* ** if {STRUCT, UNION, ENUM} and name field is non-nil ** then it is the tag name. Kept to make printing and ** debugging easier, for now. */ /*@reldef@*/ lsymbol tag; /*@reldef@*/ bool realtag; /* ** if SRT_SYN then keeps handle for synonym sort, ** elseif {OBJ, PTR, ARRAY, VECTOR} then keeps the element sort. ** elseif {TUPLE, UNIONVAL} then keeps the baseSort which is a ** record or union sort. */ sort baseSort; /* ** Only for VECTOR sort, gives its array sort, ** not used otherwise. */ /*@reldef@*/ sort objSort; /* First member of struct, union, or enum */ /*@null@*/ smemberInfo *members; bool export; /* TRUE if sort is exported by this spec */ bool mutable; /* TRUE if sort represents a mutable sort */ bool abstract; /* TRUE if sort represents an LCL abstract type */ bool imported; /* TRUE if sort was imported */ } *sortNode; extern cstring sort_unparse (sort p_s) /*@*/ ; extern /*@exposed@*/ cstring sort_unparseName (sort p_s) /*@*/ ; extern sort sort_makeSort (ltoken p_t, lsymbol p_n) /*@*/ ; extern sort sort_makeSyn (ltoken p_t, sort p_s, lsymbol p_n) /*@*/ ; extern sort sort_makeFormal (sort p_insort) /*@*/ ; extern sort sort_makeGlobal (sort p_insort) /*@*/ ; extern sort sort_makePtr (ltoken p_t, sort p_baseSort) /*@*/ ; extern sort sort_makePtrN (sort p_s, pointers p_p) /*@*/ ; extern sort sort_makeVal (sort p_sor) /*@*/ ; extern sort sort_makeObj (sort p_sor) /*@*/ ; extern void sort_destroyMod (void) /*@modifies internalState@*/ ; extern sort sort_makeArr (ltoken p_t, sort p_baseSort) /*@*/ ; extern sort sort_makeVec (ltoken p_t, sort p_arraySort) /*@*/ ; extern sort sort_makeMutable (ltoken p_t, lsymbol p_name) /*@*/ ; extern sort sort_makeImmutable (ltoken p_t, lsymbol p_name) /*@*/ ; extern sort sort_makeStr (ltoken p_opttagid) /*@*/ ; extern sort sort_makeUnion (ltoken p_opttagid) /*@*/ ; extern sort sort_makeEnum (ltoken p_opttagid) /*@*/ ; extern bool sort_updateStr (sort p_strSort, /*@null@*/ /*@only@*/ smemberInfo *p_info) /*@modifies internalState@*/ ; extern bool sort_updateUnion (sort p_unionSort, /*@null@*/ /*@only@*/ smemberInfo *p_info) /*@modifies internalState@*/ ; extern bool sort_updateEnum (sort p_enumSort, /*@null@*/ /*@only@*/ smemberInfo *p_info) /*@modifies internalState@*/ ; extern sort sort_makeTuple (ltoken p_t, sort p_strSort) /*@modifies internalState@*/ ; extern sort sort_makeUnionVal (ltoken p_t, sort p_unionSort) /*@modifies internalState@*/ ; extern lsymbol sort_getLsymbol (sort p_sor) /*@*/ ; extern /*@observer@*/ char *sort_getName (sort p_s) /*@*/ ; extern /*@observer@*/ sortNode sort_lookup (sort p_sor) /*@*/ ; extern /*@observer@*/ sortNode sort_quietLookup (sort p_sor) /*@*/ ; extern sort sort_lookupName (lsymbol p_name) /*@*/ ; extern void sort_dump(FILE *p_f, bool p_lco) /*@modifies p_f@*/ ; extern void sort_init(void) /*@modifies internalState@*/ ; extern bool sort_compatible(sort p_s1, sort p_s2) /*@*/ ; extern bool sort_compatible_modulo_cstring(sort p_s1, sort p_s2) /*@*/ ; extern sort sort_getUnderlying (sort p_s) /*@*/ ; extern bool sort_mutable (sort p_s) /*@*/ ; extern sort sort_makeNoSort(void) /*@modifies internalState@*/ ; extern sort sort_makeHOFSort(sort p_base) /*@*/ ; extern bool sort_isHOFSortKind(sort p_s) /*@*/ ; extern bool sort_isNoSort(sort p_s) /*@*/ ; extern bool sort_isValidSort(sort p_s) /*@*/ ; extern bool sort_setExporting (bool p_flag) /*@modifies internalState@*/ ; # define sort_isNoSort(s) ((s) == 0) /* assume NOSORTHANDLE is #define to 0 in sort.c */ extern /*@unused@*/ void sort_printStats(void) /*@modifies g_warningstream@*/ ; extern bool sort_equal (sort p_s1, sort p_s2) /*@*/ ; extern sort sort_fromLsymbol (lsymbol p_sortid) /*@modifies internalState@*/ ; extern void sort_import (inputStream p_imported, ltoken p_tok, mapping p_map) /*@modifies p_imported, internalState@*/ ; extern sort g_sortBool; extern sort g_sortCapBool; extern sort g_sortInt; extern sort g_sortChar; extern sort g_sortCstring; extern sort g_sortFloat; extern sort g_sortDouble; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/general.h0000644021234200000250000000461607630463446015416 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef GENERAL_H # define GENERAL_H /* sgi's don't let you undef NULL */ # ifndef IRIX # ifdef NULL # undef NULL # endif # endif # include "forwardTypes.h" # ifdef USEDMALLOC # define sfree(x) do { if (x != NULL) free(x); } while (FALSE) # else extern void sfree (/*@out@*/ /*@only@*/ /*@null@*/ void *p_x) /*@modifies p_x@*/; # endif # include "misc.h" # include "cstring.h" # include "bool.h" extern /*@out@*/ /*@only@*/ void *dimalloc (size_t p_size, const char *p_name, int p_line) /*@ensures maxSet(result) == (p_size - 1); @*/ ; extern /*@only@*/ void *dicalloc (size_t p_num, size_t p_size, const char *p_name, int p_line); extern /*@notnull@*/ /*@out@*/ /*@only@*/ void * direalloc (/*@returned@*/ /*@only@*/ /*@out@*/ /*@null@*/ void *p_x, size_t p_size, char *p_name, int p_line); extern /*@only@*/ void * drealloc (/*@special@*/ /*@null@*/ /*@sef@*/ void *p_x, /*@sef@*/ size_t p_size) /*@releases p_x@*/ /*@modifies *p_x@*/ ; extern /*@out@*/ /*@only@*/ void *dmalloc (/*@sef@*/ size_t p_size) /*@*/ /*@ensures maxSet(result) == (p_size - 1); @*/ ; /*drl 12/28/01 Work around for self checking */ #ifndef LINTBUFFERCHECK # ifdef USEDMALLOC # define dmalloc(s) (malloc(s)) # define drealloc(s,l) (realloc(s,l)) # else # define dmalloc(s) (dimalloc(s, __FILE__, __LINE__)) # define drealloc(s,l) (direalloc(s, l, __FILE__, __LINE__)) # endif #endif # include "system_constants.h" # ifdef USEGC # include # define NOFREE # define free(s) ; /* nothing */ # else # endif # ifdef USEDMALLOC # include "dmalloc.h" # endif /* ** no file except general.c should use primitive ** memory operations: */ /*@-exportlocal@*/ # ifndef USEDMALLOC # undef malloc # undef realloc # undef calloc # define malloc(s) (dimalloc(s, __FILE__, __LINE__)) # define calloc(n, s) (dicalloc(n, s, __FILE__, __LINE__)) # define realloc(v, s) (direalloc(v, s, __FILE__, __LINE__)) # endif /*@=exportlocal@*/ # ifndef NULL # define NULL 0 # endif extern void sfreeEventually (/*@owned@*/ /*@null@*/ void *p_x) /*@modifies internalState@*/; typedef /*@dependent@*/ char *d_char; /*@constant int NOT_FOUND;@*/ # define NOT_FOUND (-23) unsigned int int_toNonNegative (int p_x) /*@*/; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sortList.h0000644021234200000250000000146607630463450015617 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef SORTLIST_H # define SORTLIST_H abst_typedef struct { int nelements; int nspace; int current; /*@reldef@*/ /*@relnull@*/ sort *elements; } *sortList ; extern /*@only@*/ sortList sortList_new (void); extern void sortList_addh (sortList p_s, sort p_el) ; extern void sortList_reset (sortList p_s) ; extern void sortList_advance (sortList p_s) ; /* was "list_pointToNext" */ extern /*@only@*/ cstring sortList_unparse (sortList p_s) ; extern void sortList_free (/*@only@*/ sortList p_s) ; extern sort sortList_current (sortList p_s) ; /*@constant int sortListBASESIZE;@*/ # define sortListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/genericTable.h0000644021234200000250000000500707651115037016351 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** genericTable.h */ # ifndef GHTABLE_H # define GHTABLE_H /*@constant int GHBUCKET_BASESIZE; @*/ # define GHBUCKET_BASESIZE 2 /* in forwardTypes: abst_typedef null struct _genericTable *genericTable; */ /*:private:*/ typedef struct { /*@only@*/ cstring key; /*@only@*/ void *val; } *ghentry; typedef /*@only@*/ ghentry o_ghentry; typedef /*@null@*/ struct { int size; int nspace; /*@only@*/ o_ghentry *entries; } *ghbucket; typedef /*@only@*/ ghbucket o_ghbucket; struct s_genericTable { int size; int nentries; /*@only@*/ o_ghbucket *buckets; } ; /*@constant null genericTable genericTable_undefined; @*/ # define genericTable_undefined ((genericTable) NULL) extern /*@falsewhennull@*/ bool genericTable_isDefined(genericTable) /*@*/ ; # define genericTable_isDefined(p_h) ((p_h) != genericTable_undefined) extern /*@nullwhentrue@*/ /*@unused@*/ bool genericTable_isUndefined(genericTable) /*@*/ ; # define genericTable_isUndefined(p_h) ((p_h) == genericTable_undefined) extern /*@only@*/ genericTable genericTable_create (int p_size); extern int genericTable_size (genericTable p_h); extern void genericTable_insert (genericTable p_h, /*@only@*/ cstring p_key, /*@only@*/ void *p_value); extern /*@null@*/ /*@exposed@*/ void *genericTable_lookup (genericTable p_h, cstring p_key); extern bool genericTable_contains (genericTable p_h, cstring p_key) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstring genericTable_stats (genericTable p_h); extern void genericTable_free (/*@only@*/ genericTable p_h); extern void genericTable_remove (genericTable p_h, cstring p_key) /*@modifies p_h@*/ ; extern /*@unused@*/ void genericTable_update (genericTable p_h, cstring p_key, /*@only@*/ void *p_newval) /*@modifies p_h@*/ ; /*@iter genericTable_elements (sef genericTable p_g, yield exposed cstring m_key, yield exposed void *m_el)@*/ # define genericTable_elements(p_g, m_key, m_el) \ { int m_ind; if (genericTable_isDefined (p_g)) \ { for (m_ind = 0 ; m_ind < (p_g)->size; m_ind++) \ { ghbucket m_hb; m_hb = (p_g)->buckets[m_ind]; \ if (m_hb != NULL) { \ int m_j; \ for (m_j = 0; m_j < (m_hb)->size; m_j++) { \ cstring m_key; void *m_el; m_key = (m_hb)->entries[m_j]->key; \ m_el = (m_hb)->entries[m_j]->val; # define end_genericTable_elements }}}}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sortSet.h0000644021234200000250000000303707630463450015433 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** sortSet.h ** ** based on set_template.h */ # ifndef SORTSET_H # define SORTSET_H abst_typedef /*@null@*/ struct { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ sort *elements; } *sortSet ; /*@iter sortSet_elements(sef sortSet s, yield sort el); @*/ # define sortSet_elements(x, m_el) \ if (sortSet_isDefined (x)) { int m_ind; \ for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ { sort m_el = (x)->elements[m_ind]; # define end_sortSet_elements }} /*@constant null sortSet sortSet_undefined; @*/ # define sortSet_undefined ((sortSet) NULL) extern /*@falsewhennull@*/ bool sortSet_isDefined (sortSet p_s) /*@*/ ; # define sortSet_isDefined(s) ((s) != sortSet_undefined) extern int sortSet_size (/*@sef@*/ sortSet p_s); # define sortSet_size(s) (sortSet_isDefined (s) ? (s)->entries : 0) extern /*@only@*/ sortSet sortSet_new(void); extern bool sortSet_insert (sortSet p_s, sort p_el); extern bool sortSet_member (sortSet p_s, sort p_el); extern /*@only@*/ cstring sortSet_unparse (sortSet p_s); extern /*@only@*/ cstring sortSet_unparseClean (sortSet p_s); extern /*@only@*/ cstring sortSet_unparseOr (sortSet p_s); extern void sortSet_free (/*@only@*/ sortSet p_s); extern sort sortSet_choose (sortSet p_s); extern /*@only@*/ sortSet sortSet_copy (sortSet p_s); /*@constant int sortSetBASESIZE;@*/ # define sortSetBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/globalList.h0000644021234200000250000000066707630463446016077 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef varDeclarationNodeList globalList ; extern /*@unused@*/ cstring globalList_unparse (globalList p_s); extern void globalList_free (/*@only@*/ globalList p_s); # define globalList_free(s) (varDeclarationNodeList_free (s)) # define globalList_unparse(s) (varDeclarationNodeList_unparse(s)) splint-3.1.2.dfsg1/src/Headers/sortSetList.h0000644021234200000250000000267207630463450016273 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef sortSetLIST_H # define sortSetLIST_H typedef /*@dependent@*/ sortSet o_sortSet; abst_typedef struct { int nelements; int free; int current; /*@reldef@*/ /*@only@*/ /*@relnull@*/ o_sortSet *elements; } *sortSetList ; /*@iter sortSetList_elements (sef sortSetList x, yield exposed sortSet el); @*/ # define sortSetList_elements(x, m_el) \ { int m_ind; sortSet *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { sortSet m_el = *(m_elements++); # define end_sortSetList_elements }} extern int sortSetList_size (sortSetList); # define sortSetList_size(s) ((s)->nelements) extern /*@only@*/ sortSetList sortSetList_new(void); extern void sortSetList_addh (sortSetList p_s, /*@dependent@*/ /*@exposed@*/ sortSet p_el) ; extern void sortSetList_reset (sortSetList p_s) ; extern void sortSetList_advance (sortSetList p_s) ; /* was "list_pointToNext" */ extern /*@unused@*/ /*@only@*/ cstring sortSetList_unparse (sortSetList p_s) ; extern void sortSetList_free (/*@only@*/ sortSetList p_s) ; extern /*@observer@*/ sortSet sortSetList_head (sortSetList p_s) ; extern /*@observer@*/ sortSet sortSetList_current (sortSetList p_s) ; /*@constant int sortSetListBASESIZE;@*/ # define sortSetListBASESIZE (8) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/globalsClause.h0000644021234200000250000000151307630463447016553 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** globalsClause.h */ # ifndef GLOBALSCLAUSE_H # define GLOBALSCLAUSE_H struct s_globalsClause { globSet globs; fileloc loc; } ; extern globalsClause globalsClause_create (/*@only@*/ lltok, /*@only@*/ globSet) /*@*/ ; extern /*@observer@*/ globSet globalsClause_getGlobs (globalsClause) /*@*/ ; extern /*@only@*/ globSet globalsClause_takeGlobs (globalsClause p_gclause) /*@modifies p_gclause@*/ ; extern /*@observer@*/ fileloc globalsClause_getLoc (globalsClause) /*@*/ ; # define globalsClause_getLoc(gl) ((gl)->loc) extern cstring globalsClause_unparse (globalsClause p_node) /*@*/ ; extern void globalsClause_free (/*@only@*/ globalsClause) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/globals.h0000644021234200000250000000737407630463446015430 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef GLOBALS_H # define GLOBALS_H extern /*@owned@*/ fileloc g_currentloc; /* ** All the streams are unchecked for now. */ /* stream for warning messages */ /*@unchecked@*/ extern /*@relnull@*/ /*@dependent@*/ /*:open:*/ FILE *g_warningstream; /* stream for status messages */ /*@unchecked@*/ extern /*@relnull@*/ /*@dependent@*/ /*:open:*/ FILE *g_messagestream; /* stream for error messages */ /*@unchecked@*/ extern /*@relnull@*/ /*@dependent@*/ /*:open:*/ FILE *g_errorstream; /* stream for error messages */ /*@unchecked@*/ extern /*@null@*/ /*@dependent@*/ /*:open:*/ FILE *g_csvstream; /*@-ansireserved@*/ /* This macro is defined by flex. */ /*@constant external int ECHO@*/ /*@=ansireserved@*/ /*@-redecl@*/ /*@-incondefs@*/ /*@-namechecks@*/ /*@-declundef@*/ /* Might not process grammar files */ extern /*@dependent@*/ /*@open@*/ FILE *yyin; extern /*@dependent@*/ /*@open@*/ /*@unused@*/ FILE *yyout; extern /*@unused@*/ int yyleng; /*@=incondefs@*/ extern int yydebug; /*@=redecl@*/ /*@=declundef@*/ /*@=namechecks@*/ extern /*@observer@*/ cstring g_codeFile; extern int g_codeLine; extern /*@observer@*/ cstring g_prevCodeFile; extern int g_prevCodeLine; extern /*@observer@*/ char *g_localSpecPath; extern /*@only@*/ cstring g_currentSpec; extern /*@null@*/ /*@only@*/ char *g_currentSpecName; extern void setCodePoint (void); # define setCodePoint() \ (g_prevCodeFile = g_codeFile, g_prevCodeLine = g_codeLine, \ g_codeFile = cstring_makeLiteralTemp (__FILE__), g_codeLine = __LINE__) extern void printCodePoint (void); extern fileId currentFile (void) /*@globals g_currentloc; @*/ ; # define currentFile() (fileloc_fileId (g_currentloc)) extern int currentColumn (void) /*@globals g_currentloc; @*/ ; # define currentColumn() (fileloc_column(g_currentloc)) extern void incColumn (void) /*@globals g_currentloc; @*/ /*@modifies g_currentloc@*/ ; # define incColumn() (fileloc_incColumn(g_currentloc)) extern void decColumn (void) /*@globals g_currentloc; @*/ /*@modifies g_currentloc@*/ ; # define decColumn() (fileloc_addColumn(g_currentloc, -1)) extern void incLine (void) /*@globals g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define incLine() (fileloc_nextLine(g_currentloc)) extern void decLine (void) /*@globals g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define decLine() (fileloc_addLine (g_currentloc, -1)) extern void beginLine (void) /*@globals g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define beginLine() (fileloc_setColumn(g_currentloc, 1)) extern void addColumn (int p_n) /*@globals g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define addColumn(n) (fileloc_addColumn(g_currentloc, n)) extern void setLine (int p_n) /*@globals fileloc g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define setLine(n) (fileloc_setLineno(g_currentloc, n)) extern void setColumn (int p_n) /*@globals fileloc g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define setColumn(n) (fileloc_setColumn(g_currentloc, n)) extern void setSpecFileId (fileId p_s) /*@globals fileloc g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define setSpecFileId(s) \ (fileloc_reallyFree (g_currentloc), g_currentloc = fileloc_createSpec (s, 1, 1)) extern void setFileLine (fileId p_s, int p_line) /*@globals fileloc g_currentloc; @*/ /*@modifies g_currentloc; @*/ ; # define setFileLine(s, line) \ (context_setFilename(s, line)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/globSet.h0000644021234200000250000000434507630463446015377 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** globSet.h ** ** based on set_template.h */ # ifndef globSet_H # define globSet_H /*@iter globSet_allElements (sef globSet s, yield exposed sRef el); @*/ # define globSet_allElements(x, m_el) sRefSet_allElements(x, m_el) # define end_globSet_allElements end_sRefSet_allElements extern int globSet_size (/*@sef@*/ globSet p_s); # define globSet_size(s) (sRefSet_size (s)) extern bool globSet_isEmpty (/*@sef@*/ globSet p_s); # define globSet_isEmpty(s) (globSet_size (s) == 0) extern /*@only@*/ globSet globSet_new (void) /*@*/ ; extern globSet globSet_single (/*@exposed@*/ sRef p_el) ; extern globSet globSet_insert (/*@returned@*/ globSet p_s, /*@exposed@*/ sRef p_el) /*@modifies p_s@*/ ; extern bool globSet_member (globSet p_s, sRef p_el) /*@*/ ; extern /*@exposed@*/ sRef globSet_lookup (globSet p_s, sRef p_el) /*@*/ ; extern void globSet_free (/*@only@*/ /*@only@*/ globSet p_s); extern /*@only@*/ cstring globSet_unparse (globSet p_ll) /*@*/ ; extern /*@only@*/ cstring globSet_dump (globSet) /*@*/ ; extern /*@only@*/ globSet globSet_undump (char **p_s) /*@modifies *p_s@*/ ; extern /*@only@*/ globSet globSet_unionFree (/*@only@*/ /*@returned@*/ globSet p_g1, /*@only@*/ globSet p_g2) /*@modifies p_g1@*/ ; # define globSet_unionFree(g1,g2) sRefSet_unionFree(g1,g2) extern void globSet_markImmutable (globSet p_g) /*@modifies p_g@*/ ; extern globSet globSet_copyInto (/*@returned@*/ globSet p_s1, /*@exposed@*/ globSet p_s2) /*@modifies p_s1@*/ ; extern /*@only@*/ globSet globSet_newCopy (globSet p_s) /*@*/ ; extern bool globSet_hasStatic (globSet p_s) /*@*/ ; extern int globSet_compare (globSet p_l1, globSet p_l2); extern void globSet_clear (globSet p_g); /*@constant null globSet globSet_undefined;@*/ # define globSet_undefined sRefSet_undefined extern /*@falsewhennull@*/ bool globSet_isDefined (/*@null@*/ globSet p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool globSet_isUndefined (/*@null@*/ globSet p_s) /*@*/ ; # define globSet_isDefined(s) (sRefSet_isDefined (s)) # define globSet_isUndefined(s) (sRefSet_isUndefined (s)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sRef.h0000644021234200000250000006661507630463450014702 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** storeRef.h */ # ifndef STOREREF_H # define STOREREF_H /* ** note: forwardTypes defines sRef */ /* ** kinds of storage references */ typedef enum { SR_NOTHING, SR_INTERNAL, SR_SPECSTATE, SR_SYSTEM, SR_GLOBALMARKER } speckind; typedef enum { SK_PARAM, SK_ARRAYFETCH, SK_FIELD, SK_PTR, SK_ADR, SK_CONST, SK_CVAR, SK_UNCONSTRAINED, SK_OBJECT, SK_CONJ, SK_EXTERNAL, SK_DERIVED, SK_NEW, SK_TYPE, SK_RESULT, SK_SPECIAL, SK_UNKNOWN } skind; typedef struct { int lexlevel; usymId index; } *cref; typedef struct { /*@exposed@*/ /*@notnull@*/ sRef arr; bool indknown; int ind; } *ainfo; typedef struct { /*@exposed@*/ /*@notnull@*/ sRef rec; /*@observer@*/ cstring field; } *fldinfo ; typedef struct { /*@exposed@*/ /*@notnull@*/ sRef a; /*@exposed@*/ /*@notnull@*/ sRef b; } *cjinfo ; typedef union { /*@only@*/ cref cvar; int paramno; /*@only@*/ ainfo arrayfetch; /*@only@*/ fldinfo field; ctype object; /*@observer@*/ cstring fname; /* unconstrained, new */ /*@exposed@*/ /*@notnull@*/ sRef ref; /*@only@*/ cjinfo conj; speckind spec; } *sinfo; struct s_sRef { /* does it need to be inside parens (macros) */ bool safe; /* has it been modified */ bool modified; /* BOOLBITS; */ /* for debugging: make this sRef as immutable. */ bool immut; /* BOOLBITS; */ skind kind; ctype type; multiVal val; /* Some sRef's have known values */ sstate defstate; nstate nullstate; /* start modifications: We keep a track of the buf state(nullterm info)*/ struct s_bbufinfo bufinfo; /* end modifications */ alkind aliaskind; alkind oaliaskind; exkind expkind; /* exposed, observer, normal */ exkind oexpkind; /* where it becomes observer/exposed */ /*@null@*/ /*@only@*/ stateInfo expinfo; /* where it changed alias kind */ /*@null@*/ /*@only@*/ stateInfo aliasinfo; /* where it is defined/allocated */ /*@null@*/ /*@only@*/ stateInfo definfo; /* where it is null */ /*@null@*/ /*@only@*/ stateInfo nullinfo; /*@only@*/ /*@relnull@*/ sinfo info; /* stores fields for structs, elements for arrays, derefs for pointers */ /*@only@*/ sRefSet deriv; /* sRef's include a lookup table of state variables. */ /*@only@*/ valueTable state; } ; extern bool sRef_perhapsNull (sRef p_s); extern bool sRef_possiblyNull (sRef p_s); extern bool sRef_definitelyNull (sRef p_s); extern bool sRef_definitelyNullContext (sRef p_s); extern bool sRef_definitelyNullAltContext (sRef p_s); extern void sRef_setNullError (sRef p_s); extern void sRef_setNullUnknown (sRef p_s, fileloc p_loc); extern void sRef_setNotNull (sRef p_s, fileloc p_loc); extern void sRef_setNullState (sRef p_s, nstate p_n, fileloc p_loc); extern void sRef_setNullStateInnerComplete (sRef p_s, nstate p_n, fileloc p_loc); extern void sRef_setPosNull (sRef p_s, fileloc p_loc); extern void sRef_setDefNull (sRef p_s, fileloc p_loc); extern /*@nullwhentrue@*/ bool sRef_isInvalid (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isValid (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isReasonable (sRef p_s) /*@*/ ; /*@constant null sRef sRef_undefined; @*/ # define sRef_undefined ((sRef) NULL) # define sRef_isInvalid(s) ((s) == NULL) # define sRef_isValid(s) ((s) != NULL) extern bool sRef_isRecursiveField (sRef p_s) /*@*/ ; extern void sRef_copyRealDerivedComplete (sRef p_s1, sRef p_s2) /*@modifies p_s1@*/ ; extern nstate sRef_getNullState (/*@sef@*/ sRef p_s) /*@*/ ; extern bool sRef_isNotNull (sRef p_s) /*@*/ ; extern bool sRef_isDefinitelyNull (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isLocalVar (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isNSLocalVar (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isRealLocalVar (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isLocalParamVar (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isKnown (/*@sef@*/ sRef p_s) /*@*/ ; extern bool sRef_hasLastReference (sRef p_s) /*@*/ ; # define sRef_hasLastReference(s) (sRef_hasAliasInfoRef (s)) # define sRef_isKnown(s) (sRef_isValid(s) && (s)->kind != SK_UNKNOWN) extern bool sRef_isMeaningful (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isMeaningful(s) (sRef_isValid(s) && sRef_isKnown(s) \ && (s)->kind != SK_NEW && (s)->kind != SK_TYPE) extern bool sRef_isSomewhatMeaningful (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isSomewhatMeaningful(s) (sRef_isValid(s) && sRef_isKnown(s) \ && (s)->kind != SK_TYPE) extern bool sRef_isNew (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isNew(s) (sRef_isValid(s) && (s)->kind == SK_NEW) extern bool sRef_isType (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isType(s) (sRef_isValid(s) && (s)->kind == SK_TYPE) extern bool sRef_isSafe (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isSafe(s) (sRef_isValid(s) && (s)->safe) extern bool sRef_isUnsafe (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isUnsafe(s) (sRef_isValid(s) && !(s)->safe) extern void sRef_clearAliasKind (/*@sef@*/ sRef p_s) /*@modifies p_s@*/ ; # define sRef_clearAliasKind(s) (sRef_isValid(s) ? (s)->aliaskind = AK_UNKNOWN : AK_ERROR) extern bool sRef_stateKnown (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_stateKnown(s) (sRef_isValid(s) && (s)->defstate != SS_UNKNOWN) extern alkind sRef_getAliasKind (/*@sef@*/ sRef p_s) /*@*/ ; extern alkind sRef_getOrigAliasKind (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_getOrigAliasKind(s) (sRef_isValid(s) ? (s)->oaliaskind : AK_ERROR) extern /*@falsewhennull@*/ bool sRef_isConj (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isConj(s) (sRef_isValid(s) && (s)->kind == SK_CONJ) extern /*@exposed@*/ sRef sRef_buildArrow (sRef p_s, /*@dependent@*/ cstring p_f); extern /*@exposed@*/ sRef sRef_makeArrow (sRef p_s, /*@dependent@*/ cstring p_f); extern bool sRef_isAllocIndexRef (sRef p_s) /*@*/ ; extern void sRef_setAliasKind (sRef p_s, alkind p_kind, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setPdefined (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern /*@unused@*/ bool sRef_hasDerived (sRef p_s) /*@*/ ; extern void sRef_clearDerived (sRef p_s); extern void sRef_clearDerivedComplete (sRef p_s); extern /*@exposed@*/ sRef sRef_getBaseSafe (sRef p_s); extern /*@observer@*/ sRefSet sRef_derivedFields (/*@temp@*/ sRef p_rec) /*@*/ ; extern bool sRef_sameName (sRef p_s1, sRef p_s2) /*@*/ ; extern bool sRef_isDirectParam (sRef p_s) /*@*/ ; extern /*@exposed@*/ sRef sRef_makeAnyArrayFetch (/*@exposed@*/ sRef p_arr); extern bool sRef_isUnknownArrayFetch (sRef p_s) /*@*/ ; extern void sRef_setPartialDefinedComplete (sRef p_s, fileloc p_loc); extern bool sRef_isMacroParamRef (sRef p_s) /*@*/ ; extern void sRef_destroyMod (void) /*@modifies internalState@*/ ; extern bool sRef_deepPred (bool (p_predf) (sRef), sRef p_s); extern bool sRef_aliasCompleteSimplePred (bool (p_predf) (sRef), sRef p_s); extern void sRef_clearExKindComplete (sRef p_s, fileloc p_loc); extern /*@falsewhennull@*/ bool sRef_isKindSpecial (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isKindSpecial(s) (sRef_isValid (s) && (s)->kind == SK_SPECIAL) extern /*@observer@*/ cstring sRef_nullMessage (sRef p_s) /*@*/ ; extern bool sRef_isSystemState (sRef p_s) /*@*/ ; extern bool sRef_isGlobalMarker (sRef p_s) /*@*/ ; extern bool sRef_isInternalState (sRef p_s) /*@*/ ; extern bool sRef_isResult (sRef p_s) /*@*/ ; extern bool sRef_isSpecInternalState (sRef p_s) /*@*/ ; extern bool sRef_isSpecState (sRef p_s) /*@*/ ; extern bool sRef_isNothing (sRef p_s) /*@*/ ; extern bool sRef_isFileOrGlobalScope (sRef p_s) /*@*/ ; extern bool sRef_isReference (sRef p_s) /*@*/ ; extern ctype sRef_deriveType (sRef p_s, uentryList p_cl) /*@*/ ; extern ctype sRef_getType (sRef p_s) /*@*/ ; extern void sRef_markImmutable (sRef p_s) /*@modifies p_s@*/ ; extern /*@falsewhennull@*/ bool sRef_isAddress (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isArrayFetch (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isConst (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isCvar (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isField (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isParam (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isPointer (sRef p_s) /*@*/ ; extern void sRef_setType (sRef p_s, ctype p_t); extern void sRef_setTypeFull (sRef p_s, ctype p_t); extern void sRef_mergeNullState (sRef p_s, nstate p_n); extern void sRef_setLastReference (/*@temp@*/ sRef p_s, /*@exposed@*/ sRef p_ref, fileloc p_loc); extern bool sRef_canModify (sRef p_s, sRefSet p_sl) /*@modifies p_s@*/ ; extern bool sRef_canModifyVal (sRef p_s, sRefSet p_sl) /*@modifies p_s@*/ ; extern bool sRef_isIReference (sRef p_s) /*@*/ ; extern bool sRef_isIndexKnown (sRef p_arr) /*@*/ ; extern bool sRef_isModified (sRef p_s) /*@*/ ; extern bool sRef_isExternallyVisible (sRef p_s) /*@*/ ; extern int sRef_compare (sRef p_s1, sRef p_s2) /*@*/ ; extern bool sRef_realSame (sRef p_s1, sRef p_s2) /*@*/ ; extern bool sRef_sameObject (sRef p_s1, sRef p_s2) /*@*/ ; extern bool sRef_same (sRef p_s1, sRef p_s2) /*@*/ ; extern bool sRef_similar (sRef p_s1, sRef p_s2) /*@*/ ; extern /*@observer@*/ cstring sRef_getField (sRef p_s) /*@*/ ; extern /*@only@*/ cstring sRef_unparse (sRef p_s) /*@*/ ; extern /*@observer@*/ cstring sRef_stateVerb (sRef p_s) /*@*/ ; extern /*@observer@*/ cstring sRef_stateAltVerb (sRef p_s) /*@*/ ; extern /*@only@*/ cstring sRef_unparseOpt (sRef p_s) /*@*/ ; extern /*@only@*/ cstring sRef_unparseDebug (sRef p_s) /*@*/ ; extern void sRef_killComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern int sRef_getIndex (sRef p_arr) /*@*/ ; extern /*@dependent@*/ sRef sRef_fixOuterRef (/*@returned@*/ sRef p_s); /* Use this one to clear after error */ extern void sRef_setDefinedCompleteDirect (sRef p_s, fileloc p_loc) ; extern void sRef_setDefinedComplete (sRef p_s, fileloc p_loc) ; extern void sRef_setDefinedNCComplete (sRef p_s, fileloc p_loc) ; extern int sRef_getParam (sRef p_s) /*@*/ ; extern int sRef_lexLevel (sRef p_s) /*@*/ ; extern void sRef_setOrigAliasKind (sRef p_s, alkind p_kind); extern /*@exposed@*/ sRef sRef_fixBase (/*@returned@*/ sRef p_s, /*@returned@*/ sRef p_base) /*@modifies p_s, p_base@*/ ; extern void sRef_showNotReallyDefined (sRef p_s) /*@modifies g_warningstream@*/ ; extern void sRef_enterFunctionScope (void) /*@modifies internalState@*/ ; extern void sRef_setGlobalScope (void) /*@modifies internalState@*/ ; extern bool sRef_inGlobalScope (void) /*@*/ ; extern void sRef_exitFunctionScope (void) /*@modifies internalState@*/ ; extern void sRef_clearGlobalScopeSafe (void) /*@modifies internalState@*/ ; extern void sRef_setGlobalScopeSafe (void) /*@modifies internalState@*/ ; extern /*@notnull@*/ /*@exposed@*/ sRef sRef_buildArrayFetch (/*@exposed@*/ sRef p_arr); extern /*@notnull@*/ /*@exposed@*/ sRef sRef_buildArrayFetchKnown (/*@exposed@*/ sRef p_arr, int p_i); extern /*@exposed@*/ sRef sRef_buildField (/*@exposed@*/ sRef p_rec, /*@dependent@*/ cstring p_f) /*@modifies p_rec@*/ ; extern /*@exposed@*/ sRef sRef_buildPointer (/*@exposed@*/ sRef p_t) /*@modifies p_t@*/ ; extern /*@exposed@*/ sRef sRef_makeAddress (/*@exposed@*/ sRef p_t); /* evans 2002-07-12: the parameter was exposed (but this led to invalid reads, reported by valgrind */ extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeUnconstrained (/*@temp@*/ cstring) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isUnconstrained (sRef p_s) /*@*/ ; extern /*@observer@*/ cstring sRef_unconstrainedName (sRef p_s) /*@*/ ; extern /*@notnull@*/ /*@exposed@*/ sRef sRef_makeArrayFetch (/*@exposed@*/ sRef p_arr) /*@*/ ; extern /*@notnull@*/ /*@exposed@*/ sRef sRef_makeArrayFetchKnown (/*@exposed@*/ sRef p_arr, int p_i); extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeConj (/*@exposed@*/ /*@returned@*/ sRef p_a, /*@exposed@*/ sRef p_b); extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeCvar (int p_level, usymId p_index, ctype p_ct, /*@only@*/ stateInfo p_stinfo); extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeConst (ctype p_ct); extern /*@exposed@*/ sRef sRef_makeField (sRef p_rec, /*@dependent@*/ cstring p_f); extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeGlobal (usymId p_l, ctype p_ct, /*@only@*/ stateInfo); extern /*@exposed@*/ sRef sRef_makeNCField (/*@exposed@*/ sRef p_rec, /*@dependent@*/ cstring p_f) /*@*/ ; extern void sRef_maybeKill (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@notnull@*/ /*@dependent@*/ sRef sRef_makeObject (ctype p_o) /*@*/ ; extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeType (ctype p_ct) /*@*/ ; extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeParam (int p_l, ctype p_ct, /*@only@*/ stateInfo p_stinfo) /*@*/ ; extern /*@exposed@*/ sRef sRef_makePointer (/*@exposed@*/ sRef p_s) /*@modifies p_s@*/ ; extern void sRef_makeSafe (sRef p_s) /*@modifies p_s@*/ ; extern void sRef_makeUnsafe (sRef p_s) /*@modifies p_s@*/ ; extern /*@dependent@*/ sRef sRef_makeUnknown (void) /*@*/ ; extern /*@dependent@*/ sRef sRef_makeNothing (void) /*@*/ ; extern /*@dependent@*/ sRef sRef_makeInternalState (void) /*@*/ ; extern /*@dependent@*/ sRef sRef_makeSpecState (void) /*@*/ ; extern /*@dependent@*/ sRef sRef_makeGlobalMarker (void) /*@*/ ; extern /*@dependent@*/ sRef sRef_makeSystemState (void) /*@*/ ; extern /*@dependent@*/ /*@notnull@*/ sRef sRef_makeResult (ctype) /*@*/ ; extern /*@exposed@*/ sRef sRef_fixResultType (/*@returned@*/ sRef p_s, ctype p_typ, uentry p_ue) /*@modifies p_s@*/; extern void sRef_setParamNo (sRef p_s, int p_l) /*@modifies p_s;@*/; extern /*@notnull@*/ /*@dependent@*/ sRef sRef_makeNew (ctype p_ct, sRef p_t, /*@exposed@*/ cstring p_name) ; extern usymId sRef_getScopeIndex (sRef p_s) /*@*/ ; extern /*@exposed@*/ uentry sRef_getBaseUentry (sRef p_s); extern /*@exposed@*/ sRef sRef_fixBaseParam (/*@returned@*/ sRef p_s, exprNodeList p_args) /*@modifies p_s@*/ ; /* drl7x added function 12/24/2000 */ /*@only@*/ constraintExpr sRef_fixConstraintParam (/*@observer@*/ sRef p_s, /*@observer@*/ /*@temp@*/ exprNodeList p_args); extern bool sRef_isUnionField (sRef p_s); extern void sRef_setModified (sRef p_s); extern void sRef_resetState (sRef p_s); extern void sRef_resetStateComplete (sRef p_s); extern void sRef_storeState (sRef p_s); extern /*@exposed@*/ sRef sRef_getBase (sRef p_s) /*@*/ ; extern /*@exposed@*/ sRef sRef_getRootBase (sRef p_s) /*@*/ ; extern /*@observer@*/ uentry sRef_getUentry (sRef p_s); extern cstring sRef_dump (sRef p_s) /*@*/ ; extern cstring sRef_dumpGlobal (sRef p_s) /*@*/ ; extern /*@exposed@*/ sRef sRef_undump (char **p_c) /*@modifies *p_c@*/ ; extern /*@exposed@*/ sRef sRef_undumpGlobal (char **p_c) /*@modifies *p_c@*/ ; extern /*@only@*/ sRef sRef_saveCopy (sRef p_s); extern /*@dependent@*/ sRef sRef_copy (sRef p_s); extern cstring sRef_unparseState (sRef p_s) /*@*/ ; extern ynm sRef_isWriteable (sRef p_s) /*@*/ ; extern ynm sRef_isValidLvalue (sRef p_s) /*@*/ ; extern bool sRef_isStrictReadable (sRef p_s) /*@*/ ; extern bool sRef_hasNoStorage (sRef p_s) /*@*/ ; extern void sRef_showExpInfo (sRef p_s) /*@modifies g_warningstream*/ ; extern void sRef_setDefined (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setUndefined (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setOnly (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setDependent (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setOwned (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setKept (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setKeptComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setFresh (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setShared (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_showAliasInfo (sRef p_s) /*@modifies g_warningstream@*/ ; extern void sRef_showMetaStateInfo (sRef p_s, cstring p_key) /*@modifies g_warningstream@*/ ; extern void sRef_showNullInfo (sRef p_s) /*@modifies g_warningstream@*/ ; extern void sRef_showStateInfo (sRef p_s) /*@modifies g_warningstream@*/ ; extern void sRef_setStateFromType (sRef p_s, ctype p_ct) /*@modifies p_s@*/ ; extern void sRef_kill (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setAllocated (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setAllocatedShallowComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setAllocatedComplete (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern /*@only@*/ cstring sRef_unparseKindNamePlain (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isRealGlobal(sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isFileStatic (sRef p_s) /*@*/ ; extern int sRef_getScope (sRef p_s) /*@*/ ; extern /*@observer@*/ cstring sRef_getScopeName (sRef p_s) /*@*/ ; /* must be real function (passed as function param) */ extern /*@falsewhennull@*/ bool sRef_isDead (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isDeadStorage (sRef p_s) /*@*/ ; extern bool sRef_isStateLive (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isPossiblyDead (sRef p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool sRef_isStateUndefined (sRef p_s) /*@*/ ; extern bool sRef_isUnuseable (sRef p_s) /*@*/ ; extern /*@exposed@*/ sRef sRef_constructDeref (sRef p_t) /*@modifies p_t@*/ ; extern /*@exposed@*/ sRef sRef_constructDeadDeref (sRef p_t) /*@modifies p_t@*/ ; extern bool sRef_isJustAllocated (sRef p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_isAllocated (sRef p_s) /*@*/ ; extern bool sRef_isUndefGlob (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isUndefGlob(s) \ ((sRef_isValid(s)) \ && ((s)->defstate == SS_UNDEFGLOB || (s)->defstate == SS_UNDEFKILLED)) extern bool sRef_isKilledGlob (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isKilledGlob(s) \ ((sRef_isValid(s)) \ && ((s)->defstate == SS_KILLED || (s)->defstate == SS_UNDEFKILLED)) extern bool sRef_isRelDef (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isRelDef(s) \ ((sRef_isValid(s)) && ((s)->defstate == SS_RELDEF)) extern bool sRef_isPartial (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isPartial(s) \ ((sRef_isValid(s)) && ((s)->defstate == SS_PARTIAL)) extern bool sRef_isStateSpecial (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isStateSpecial(s) \ ((sRef_isValid(s)) && ((s)->defstate == SS_SPECIAL)) extern bool sRef_makeStateSpecial (sRef p_s) /*@modifies p_s@*/ /* returns false is sRef already has an inconsistend defstate */ ; extern bool sRef_isStateDefined (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isStateDefined(s) \ ((sRef_isValid(s)) && (((s)->defstate == SS_DEFINED) \ || (s)->defstate == SS_RELDEF)) extern bool sRef_isAnyDefined (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isAnyDefined(s) ((sRef_isValid(s)) && \ (((s)->defstate == SS_DEFINED) \ || ((s)->defstate == SS_RELDEF) \ || ((s)->defstate == SS_PARTIAL))) extern /*@falsewhennull@*/ bool sRef_isPdefined (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isPdefined(s) \ ((sRef_isValid(s)) && ((s)->defstate == SS_PDEFINED)) extern bool sRef_isReallyDefined (sRef p_s) /*@*/ ; extern bool sRef_isStateUnknown (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isStateUnknown(s) \ ((sRef_isValid(s)) && ((s)->defstate == SS_UNKNOWN)) extern /*@falsewhennull@*/ bool sRef_isRefCounted (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isRefCounted(s) \ ((sRef_isValid(s)) && ((s)->aliaskind == AK_REFCOUNTED)) extern /*@falsewhennull@*/ bool sRef_isNewRef (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isNewRef(s) \ ((sRef_isValid(s)) && ((s)->aliaskind == AK_NEWREF)) extern /*@falsewhennull@*/ bool sRef_isKillRef (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isKillRef(s) \ ((sRef_isValid(s)) && ((s)->aliaskind == AK_KILLREF)) extern bool sRef_isOnly (sRef p_s) /*@*/ ; extern bool sRef_isDependent (sRef p_s) /*@*/ ; extern bool sRef_isOwned (/*@sef@*/ sRef p_s) /*@*/ ; extern bool sRef_isKeep (/*@sef@*/ sRef p_s) /*@*/ ; extern bool sRef_isKept (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isKept(s) \ ((sRef_isValid(s)) && ((s)->aliaskind == AK_KEPT)) extern /*@unused@*/ bool sRef_isTemp (sRef p_s) /*@*/ ; extern bool sRef_isStack (sRef p_s) /*@*/ ; extern bool sRef_isLocalState (sRef p_s) /*@*/ ; extern bool sRef_isUnique (sRef p_s) /*@*/ ; extern bool sRef_isShared (sRef p_s) /*@*/ ; extern bool sRef_isExposed (sRef p_s) /*@*/ ; extern bool sRef_isObserver (sRef p_s) /*@*/ ; extern bool sRef_isFresh (sRef p_s) /*@*/ ; extern bool sRef_isRefsField (/*@sef@*/ sRef p_s) /*@*/ ; # define sRef_isRefsField(s) \ ((sRef_isValid(s)) && ((s)->aliaskind == AK_REFS)) extern void sRef_protectDerivs (void) /*@modifies internalState@*/ ; extern void sRef_clearProtectDerivs (void) /*@modifies internalState@*/ ; extern exkind sRef_getExKind (sRef p_s) /*@*/ ; extern exkind sRef_getOrigExKind (sRef p_s) /*@*/ ; extern void sRef_setExKind (sRef p_s, exkind p_exp, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setExposed (sRef p_s, fileloc p_loc) /*@modifies p_s@*/; extern bool sRef_isAnyParam (sRef p_s) /*@*/ ; extern /*@observer@*/ sRef sRef_getAliasInfoRef (/*@temp@*/ sRef p_s) /*@*/ ; extern bool sRef_hasAliasInfoRef (sRef p_s) /*@*/ ; extern /*@exposed@*/ sRef sRef_constructPointer (/*@exposed@*/ sRef p_t) /*@modifies p_t*/ ; extern bool sRef_isAliasCheckedGlobal (sRef p_s) /*@*/ ; extern bool sRef_includedBy (sRef p_small, sRef p_big) /*@*/ ; extern /*@dependent@*/ /*@exposed@*/ sRef sRef_makeExternal (/*@exposed@*/ sRef p_t) /*@*/ ; extern bool sRef_similarRelaxed (sRef p_s1, sRef p_s2) /*@*/ ; extern /*@only@*/ cstring sRef_unparseKindName (sRef p_s) /*@*/ ; extern void sRef_copyState (sRef p_s1, sRef p_s2) /*@modifies p_s1@*/ ; extern /*@unused@*/ bool sRef_isObject (sRef p_s) /*@*/ ; extern bool sRef_isNotUndefined (sRef p_s) /*@*/ ; extern bool sRef_isExternal (sRef p_s) /*@*/ ; extern cstring sRef_unparseDeep (sRef p_s) /*@*/ ; extern cstring sRef_unparseFull (sRef p_s) /*@*/ ; extern /*@observer@*/ cstring sRef_unparseScope (sRef p_s) /*@*/ ; extern void sRef_mergeState (sRef p_res, sRef p_other, clause p_cl, fileloc p_loc) /*@modifies p_res, p_other@*/ ; extern void sRef_mergeOptState (sRef p_res, sRef p_other, clause p_cl, fileloc p_loc) /*@modifies p_res, p_other@*/ ; extern void sRef_mergeStateQuiet (sRef p_res, sRef p_other) /*@modifies p_res@*/ ; extern void sRef_mergeStateQuietReverse (/*@dependent@*/ sRef p_res, /*@dependent@*/ sRef p_other) /*@modifies p_res@*/ ; extern void sRef_setStateFromUentry (sRef p_s, uentry p_ue) /*@modifies p_s@*/ ; extern bool sRef_isStackAllocated (sRef p_s) /*@*/ ; extern bool sRef_modInFunction (void) /*@*/ ; extern void sRef_clearAliasState (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setPartial (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setDerivNullState (sRef p_set, sRef p_guide, nstate p_ns) /*@modifies p_set@*/ ; extern void sRef_clearGlobalScope (void) /*@modifies internalState@*/ ; extern /*@dependent@*/ sRef sRef_makeDerived (/*@exposed@*/ sRef p_t); extern sstate sRef_getDefState (sRef p_s) /*@*/ ; extern void sRef_setDefState (sRef p_s, sstate p_defstate, fileloc p_loc); extern void sRef_showRefLost (sRef p_s); extern void sRef_showRefKilled (sRef p_s); extern /*@exposed@*/ sRef sRef_updateSref (sRef p_s); extern void sRef_reflectAnnotation (sRef p_s, annotationInfo p_a, fileloc p_loc); extern /*@observer@*/ valueTable sRef_getValueTable (sRef p_s) /*@*/ ; extern void sRef_aliasCheckPred (bool (p_predf) (sRef, exprNode, sRef, exprNode), /*@null@*/ bool (p_checkAliases) (sRef), sRef p_s, exprNode p_e, exprNode p_err); extern bool sRef_aliasCheckSimplePred (sRefTest p_predf, sRef p_s); extern void sRef_showStateInconsistent (sRef p_s); extern void sRef_setDependentComplete (sRef p_s, fileloc p_loc); extern void sRef_setAliasKindComplete (sRef p_s, alkind p_kind, fileloc p_loc); extern bool sRef_isThroughArrayFetch (sRef p_s) /*@*/ ; extern /*@exposed@*/ /*@notnull@*/ sRef sRef_getConjA (sRef p_s) /*@*/ ; extern /*@exposed@*/ /*@notnull@*/ sRef sRef_getConjB (sRef p_s) /*@*/ ; extern /*@only@*/ cstring sRef_unparsePreOpt (sRef p_s) /*@*/ ; extern bool sRef_hasName (sRef p_s) /*@*/ ; extern void sRef_free (/*@only@*/ sRef p_s); extern void sRef_setObserver (sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; /* start modifications */ /* functions for making modification to null-term info */ extern void sRef_setNullTerminatedStateInnerComplete(sRef p_s, struct s_bbufinfo p_b, fileloc p_loc); extern struct s_bbufinfo sRef_getNullTerminatedState(sRef p_s); extern void sRef_setNullTerminatedState (sRef p_s); extern void sRef_setPossiblyNullTerminatedState (sRef p_s); extern void sRef_setNotNullTerminatedState (sRef p_s); extern void sRef_setSize(sRef p_s, int p_size); extern void sRef_setLen(sRef p_s, int p_len); extern int sRef_getSize(sRef p_s); /*@-nullderef@*/ #define sRef_getSize(p_s) \ ((p_s)->bufinfo.size) extern int sRef_getLen(sRef p_s); #define sRef_getLen(p_s) \ ((p_s)->bufinfo.len) extern /*@falsewhennull@*/ bool sRef_hasExpInfoLoc (sRef) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_hasStateInfoLoc (sRef) /*@*/ ; extern /*@falsewhennull@*/ bool sRef_hasAliasInfoLoc (sRef) /*@*/ ; extern bool sRef_hasBufStateInfo(sRef p_s); # define sRef_hasBufStateInfo(p_s) \ (sRef_isValid(p_s)) extern bool sRef_isNullTerminated(/*@sef@*/sRef p_s); # define sRef_isNullTerminated(p_s) \ ( sRef_hasBufStateInfo((p_s)) ? ((p_s)->bufinfo.bufstate \ == BB_NULLTERMINATED) : FALSE) extern bool sRef_isPossiblyNullTerminated(/*@sef@*/sRef p_s); # define sRef_isPossiblyNullTerminated(p_s) \ ( sRef_hasBufStateInfo((p_s)) ? ((p_s)->bufinfo.bufstate \ == BB_POSSIBLYNULLTERMINATED) : FALSE) extern bool sRef_isNotNullTerminated(/*@sef@*/sRef p_s); # define sRef_isNotNullTerminated(p_s) \ ( sRef_hasBufStateInfo((p_s)) ? ((p_s)->bufinfo.bufstate \ == BB_NOTNULLTERMINATED) : FALSE) /*@=nullderef@*/ /*drl7x 11/28/00*/ extern bool sRef_isFixedArray (sRef p_s) /*@*/; extern size_t sRef_getArraySize (sRef p_s) /*@*/; extern /*@observer@*/ cstring sRef_ntMessage (sRef p_s); extern void sRef_resetLen (sRef p_s) /*@modifies p_s@*/ ; /* end modifications */ extern void sRef_setMetaStateValueComplete (sRef p_s, cstring p_key, int p_value, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_setMetaStateValue (sRef p_s, cstring p_key, int p_value, fileloc p_loc) /*@modifies p_s@*/ ; extern /*@observer@*/ stateValue sRef_getMetaStateValue (sRef p_s, cstring p_key) /*@*/ ; extern bool sRef_checkMetaStateValue (sRef p_s, cstring p_key, int p_value) /*@modifies p_s@*/ ; extern void sRef_setValue (sRef p_s, /*@only@*/ multiVal p_val) /*@modifies p_s@*/ ; extern bool sRef_hasValue (sRef p_s) /*@*/ ; extern /*@observer@*/ multiVal sRef_getValue (sRef p_s) /*@*/ ; extern /*@maynotreturn@*/ void sRef_checkValid (/*@temp@*/ sRef p_s) /*@modifies stderr@*/ ; extern void sRef_aliasSetComplete (void (p_predf) (sRef, fileloc), sRef p_s, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_aliasSetCompleteParam (void (p_predf) (sRef, int, fileloc), sRef p_s, int p_kind, fileloc p_loc) /*@modifies p_s@*/ ; extern void sRef_aliasSetCompleteAlkParam (void (p_predf) (sRef, alkind, fileloc), sRef p_s, alkind p_kind, fileloc p_loc) /*@modifies p_s@*/ ; # ifdef DEBUGSPLINT extern void sRef_checkCompletelyReasonable (sRef p_s) /*@modifies g_errorstream@*/ ; # endif # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/gram.h0000644021234200000250000000025007630463447014716 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # include "llgrammar.h" splint-3.1.2.dfsg1/src/Headers/sRefList.h0000644021234200000250000000344607630463450015527 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** sRefList.h (from slist_templace.h) */ # ifndef sRefLIST_H # define sRefLIST_H typedef /*@dependent@*/ sRef d_sRef ; struct s_sRefList { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ d_sRef *elements; } ; /*@iter sRefList_elements (sef sRefList x, yield exposed sRef el); @*/ # define sRefList_elements(x, m_el) \ { if (!sRefList_isUndefined(x)) \ { int m_ind; sRef *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { sRef m_el = *(m_elements++); # define end_sRefList_elements }}} extern int sRefList_size (sRefList p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool sRefList_isUndefined (sRefList p_s) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool sRefList_isEmpty (sRefList p_s) /*@*/ ; extern /*@unused@*/ /*@falsewhennull@*/ bool sRefList_isDefined (sRefList p_s) /*@*/ ; # define sRefList_isEmpty(s) (sRefList_size(s) == 0) /*@constant null sRefList sRefList_undefined; @*/ # define sRefList_undefined ((sRefList)0) # define sRefList_isUndefined(c) ((c) == sRefList_undefined) # define sRefList_isDefined(c) ((c) != sRefList_undefined) extern /*@only@*/ sRefList sRefList_new (void); extern /*@only@*/ sRefList sRefList_single (/*@dependent@*/ sRef p_el); extern /*@notnull@*/ sRefList sRefList_add (/*@returned@*/ sRefList p_s, /*@exposed@*/ sRef p_el) /*@modifies p_s@*/ ; extern cstring sRefList_unparse (sRefList p_s) /*@*/ ; extern void sRefList_free (/*@only@*/ sRefList p_s) ; extern /*@only@*/ sRefList sRefList_copy (sRefList p_s) /*@*/ ; /*@constant int sRefListBASESIZE;@*/ # define sRefListBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/guardSet.h0000644021234200000250000000423607415477017015555 0ustar fax/* ** guardSet.h */ # ifndef GUARDSET_H # define GUARDSET_H /* ** guardSet is usually empty, so allow NULL to represent this. */ /* in forwardTypes: typedef struct _guardSet *guardSet; */ /*@null@*/ struct s_guardSet { /*@only@*/ sRefSet tguard; /* guarded on true branch */ /*@only@*/ sRefSet fguard; /* guarded on false branch */ } ; /*@constant null guardSet guardSet_undefined;@*/ # define guardSet_undefined ((guardSet)NULL) extern /*@falsewhennull@*/ /*@unused@*/ bool guardSet_isDefined (guardSet p_g) /*@*/ ; # define guardSet_isDefined(g) ((g) != guardSet_undefined) extern /*@falsewhennull@*/ bool guardSet_isEmpty (guardSet p_g); extern /*@only@*/ guardSet guardSet_new (void); extern guardSet guardSet_addTrueGuard (/*@returned@*/ guardSet p_g, /*@exposed@*/ sRef p_s); extern guardSet guardSet_addFalseGuard (/*@returned@*/ guardSet p_g, /*@exposed@*/ sRef p_s); extern guardSet guardSet_or (/*@returned@*/ /*@unique@*/ guardSet p_s, guardSet p_t); extern guardSet guardSet_and (/*@returned@*/ /*@unique@*/ guardSet p_s, guardSet p_t); extern void guardSet_delete (guardSet p_g, sRef p_s) /*@modifies p_g@*/ ; extern /*@only@*/ cstring guardSet_unparse (guardSet p_g); extern void guardSet_free (/*@only@*/ /*@only@*/ guardSet p_g); extern /*@dependent@*/ /*@exposed@*/ sRefSet guardSet_getTrueGuards (guardSet p_g) /*@*/ ; extern /*@dependent@*/ /*@exposed@*/ sRefSet guardSet_getFalseGuards (guardSet p_g) /*@*/ ; extern guardSet guardSet_union (/*@only@*/ guardSet p_s, guardSet p_t) /*@modifies p_s@*/ ; extern /*@only@*/ guardSet guardSet_invert (/*@temp@*/ guardSet p_g) /*@*/ ; extern /*@only@*/ guardSet guardSet_copy (/*@temp@*/ guardSet p_g) /*@*/ ; extern bool guardSet_isGuarded (guardSet p_g, sRef p_s) /*@*/ ; extern bool guardSet_mustBeNull (guardSet p_g, sRef p_s) /*@*/ ; extern guardSet guardSet_levelUnion (/*@only@*/ guardSet p_s, guardSet p_t, int p_lexlevel) /*@modifies p_s@*/ ; extern guardSet guardSet_levelUnionFree (/*@returned@*/ /*@unique@*/ guardSet p_s, /*@only@*/ guardSet p_t, int p_lexlevel) /*@modifies p_t, p_s@*/ ; extern void guardSet_flip (guardSet p_g); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sRefSet.h0000644021234200000250000001236107630463450015343 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** sRefSet.h ** ** based on set_template.h */ # ifndef sRefSET_H # define sRefSET_H typedef /*@exposed@*/ sRef ex_sRef; struct s_sRefSet { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ ex_sRef *elements; } ; /* in forwardTypes: typedef _sRefSet *sRefSet; */ /* ** realElements --- only non-objects */ /*@iter sRefSet_realElements (sef sRefSet s, yield exposed sRef el)@*/ # define sRefSet_realElements(x, m_el) \ { int m_ind; if (sRefSet_isDefined (x)) \ { for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ { sRef m_el = (x)->elements[m_ind]; if (!(sRef_isExternal(m_el))) { # define end_sRefSet_realElements }}}} /*@iter sRefSet_elements (sef sRefSet s, yield exposed sRef el)@*/ # define sRefSet_elements(s,m_el) sRefSet_allElements (s, m_el) # define end_sRefSet_elements end_sRefSet_allElements /*@iter sRefSet_allElements (sef sRefSet s, yield exposed sRef el)@*/ # define sRefSet_allElements(x, m_el) \ { int m_ind; if (sRefSet_isDefined (x)) { \ for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ { sRef m_el = (x)->elements[m_ind]; # define end_sRefSet_allElements }}} /*@constant int sRefSetBASESIZE;@*/ # define sRefSetBASESIZE SMALLBASESIZE /*@constant null sRefSet sRefSet_undefined;@*/ # define sRefSet_undefined ((sRefSet) 0) extern /*@nullwhentrue@*/ bool sRefSet_isUndefined (sRefSet p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool sRefSet_isEmpty (/*@sef@*/ sRefSet p_s) /*@*/ ; extern /*@falsewhennull@*/ bool sRefSet_isDefined (sRefSet p_s) /*@*/ ; # define sRefSet_isUndefined(s) ((s) == sRefSet_undefined) # define sRefSet_isDefined(s) ((s) != sRefSet_undefined) # define sRefSet_isEmpty(s) \ ((s) == sRefSet_undefined || ((s)->entries == 0)) extern bool sRefSet_equal (sRefSet p_s1, sRefSet p_s2) /*@*/ ; extern bool sRefSet_hasRealElement (sRefSet p_s) /*@*/ ; extern bool sRefSet_hasUnconstrained (sRefSet p_s) /*@*/ ; extern cstring sRefSet_unparsePlain (sRefSet p_s) /*@*/ ; extern cstring sRefSet_unparseUnconstrained (sRefSet p_s) /*@*/ ; extern cstring sRefSet_unparseUnconstrainedPlain (sRefSet p_s) /*@*/ ; extern void sRefSet_fixSrefs (sRefSet p_s); extern bool sRefSet_delete (sRefSet p_s, sRef p_el); extern /*@exposed@*/ sRef sRefSet_lookupMember (sRefSet p_s, sRef p_el); extern bool sRefSet_isSameMember (sRefSet p_s, sRef p_el) /*@*/ ; extern bool sRefSet_isSameNameMember (sRefSet p_s, sRef p_el) /*@*/ ; extern /*@only@*/ sRefSet sRefSet_newCopy (/*@exposed@*/ /*@temp@*/ sRefSet p_s); extern /*@only@*/ sRefSet sRefSet_newDeepCopy (sRefSet p_s); extern int sRefSet_size(sRefSet p_s) /*@*/ ; extern sRefSet sRefSet_unionFree (/*@returned@*/ sRefSet p_s1, /*@only@*/ sRefSet p_s2); extern /*@only@*/ sRefSet sRefSet_new (void) /*@*/ ; extern /*@only@*/ sRefSet sRefSet_single (/*@exposed@*/ sRef); extern sRefSet sRefSet_insert (/*@returned@*/ sRefSet p_s, /*@exposed@*/ sRef p_el); extern bool sRefSet_member (sRefSet p_s, sRef p_el) /*@*/ ; extern bool sRefSet_containsSameObject (sRefSet p_s, sRef p_el) /*@*/ ; extern /*@only@*/ cstring sRefSet_unparse (sRefSet p_s) /*@*/ ; extern void sRefSet_free (/*@only@*/ sRefSet p_s) /*@modifies p_s@*/; extern void sRefSet_clear (sRefSet p_s) /*@modifies p_s@*/; extern /*@only@*/ sRefSet sRefSet_addIndirection (sRefSet p_s) /*@*/ ; extern /*@only@*/ sRefSet sRefSet_removeIndirection (sRefSet p_s) /*@*/ ; extern sRefSet sRefSet_union (/*@returned@*/ sRefSet p_s1, /*@exposed@*/ sRefSet p_s2) /*@modifies p_s1@*/ ; extern void sRefSet_levelPrune (sRefSet p_s, int p_lexlevel) /*@modifies p_s@*/ ; extern void sRefSet_clearStatics (sRefSet p_s) /*@modifies p_s@*/ ; extern sRefSet sRefSet_levelUnion (/*@returned@*/ sRefSet p_sr, sRefSet p_s, int p_lexlevel); extern /*@only@*/ sRefSet sRefSet_intersect (sRefSet p_s1, sRefSet p_s2); extern /*@only@*/ sRefSet sRefSet_fetchKnown (sRefSet p_s, int p_i); extern /*@only@*/ sRefSet sRefSet_fetchUnknown (sRefSet p_s); extern /*@only@*/ sRefSet sRefSet_accessField (sRefSet p_s, /*@observer@*/ cstring p_f); extern /*@only@*/ sRefSet sRefSet_realNewUnion (sRefSet p_s1, sRefSet p_s2); extern /*@only@*/ cstring sRefSet_unparseDebug (sRefSet p_s) /*@*/ ; extern /*@unused@*/ cstring sRefSet_unparseFull (sRefSet p_s) /*@*/ ; extern int sRefSet_compare (sRefSet p_s1, sRefSet p_s2) /*@*/ ; extern bool sRefSet_modifyMember (sRefSet p_s, sRef p_m) /*@modifies p_m@*/ ; extern /*@only@*/ sRefSet sRefSet_undump (char **p_s) /*@modifies *p_s@*/ ; extern /*@only@*/ cstring sRefSet_dump (sRefSet p_sl) /*@*/ ; extern bool sRefSet_deleteBase (sRefSet p_s, sRef p_base) /*@modifies p_s@*/ ; extern /*@exposed@*/ sRef sRefSet_choose (sRefSet p_s) /*@*/ ; extern /*@exposed@*/ sRef sRefSet_mergeIntoOne (sRefSet p_s) /*@*/ ; extern /*@only@*/ sRefSet sRefSet_levelCopy (/*@exposed@*/ sRefSet p_s, int p_lexlevel) /*@*/ ; extern sRefSet sRefSet_unionExcept (/*@returned@*/ sRefSet p_s1, sRefSet p_s2, sRef p_ex) /*@modifies p_s1@*/ ; sRefSet sRefSet_copyInto (/*@returned@*/ sRefSet p_s1, /*@exposed@*/ sRefSet p_s2) /*@modifies p_s1@*/ ; extern bool sRefSet_hasStatic (sRefSet p_s) /*@*/ ; extern void sRefSet_markImmutable (sRefSet p_s) /*@modifies p_s@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/handle.h0000644021234200000250000000026007630463447015224 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef long unsigned Handle; splint-3.1.2.dfsg1/src/Headers/sRefSetList.h0000644021234200000250000000273307630463450016201 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef sRefSetLIST_H # define sRefSetLIST_H typedef /*@dependent@*/ sRefSet d_sRefSet; abst_typedef /*@null@*/ struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ d_sRefSet *elements; } *sRefSetList ; /*@iter sRefSetList_elements (sef sRefSetList x, yield exposed sRefSet el); @*/ # define sRefSetList_elements(x, m_el) \ { if (sRefSetList_isDefined (x)) { \ int m_ind; sRefSet *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { sRefSet m_el = *(m_elements++); # define end_sRefSetList_elements }}} /*@constant null sRefSetList sRefSetList_undefined; @*/ # define sRefSetList_undefined ((sRefSetList) NULL) extern /*@falsewhennull@*/ bool sRefSetList_isDefined (sRefSetList p_s); # define sRefSetList_isDefined(s) ((s) != sRefSetList_undefined) extern /*@unused@*/ /*@nullwhentrue@*/ bool sRefSetList_isUndefined (sRefSetList p_s); # define sRefSetList_isUndefined(s) ((s) == sRefSetList_undefined) extern sRefSetList sRefSetList_add (/*@returned@*/ sRefSetList p_s, /*@exposed@*/ sRefSet p_el) /*@modifies p_s@*/ ; extern void sRefSetList_free (/*@only@*/ sRefSetList p_s); extern void sRefSetList_clear (sRefSetList p_s); /*@constant int sRefSetListBASESIZE;@*/ # define sRefSetListBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sRefSetStack.h0000644021234200000250000000245707630463450016336 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** sRefSetStack.h */ # ifndef sRefSetStack_H # define sRefSetStack_H typedef struct _sRefSetStack *sRefSetStack ; typedef struct _sRefSetStack { sRefSet elements; sRefSet allElements; sRefSetStack thisbranch; sRefSetStack lastbranch; sRefSetStack parent; int lexlevel; } _sRefSetStack ; extern sRefSetStack sRefSetStack_new(void); extern void sRefSetStack_push (sRefSetStack s, sRef el) ; extern sRefSetStack sRefSetStack_pop (sRefSetStack s) ; extern sRefSet sRefSetStack_top (sRefSetStack s) ; extern cstring sRefSetStack_unparse (sRefSetStack s) ; extern void sRefSetStack_free (/*@only@*/ sRefSetStack s) ; extern sRefSetStack sRefSetStack_init (void); extern sRefSetStack sRefSetStack_branch (sRefSetStack s); extern sRefSetStack sRefSetStack_trueBranch (sRefSetStack s); extern sRefSetStack sRefSetStack_altBranch (sRefSetStack s); extern sRefSetStack sRefSetStack_popBranches (sRefSetStack alt); extern sRefSetStack sRefSetStack_popTrueBranch (sRefSetStack s); # define sRefSetStackBASESIZE MIDBASESIZE # define sRefSetStackNULL ((sRefSetStack)0) # define sRefSetStack_undefined (sRefSetStackNULL) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/idDecl.h0000644021234200000250000000401307630463447015155 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** idDecl.h */ # ifndef idDecl_H # define idDecl_H struct s_idDecl { cstring id; qtype typ; functionClauseList clauses; } ; /*@constant null idDecl idDecl_undefined; @*/ # define idDecl_undefined ((idDecl) NULL) extern /*@falsewhennull@*/ bool idDecl_isDefined (idDecl p_t) /*@*/ ; # define idDecl_isDefined(t) ((t) != idDecl_undefined) extern void idDecl_free (/*@only@*/ idDecl p_t); extern /*@only@*/ idDecl idDecl_create (/*@only@*/ cstring p_s, /*@only@*/ qtype p_t); extern /*@only@*/ idDecl idDecl_createClauses (/*@only@*/ cstring p_s, /*@only@*/ qtype p_t, /*@only@*/ functionClauseList p_clauses); extern /*@only@*/ cstring idDecl_unparse (idDecl p_d) /*@*/ ; extern /*@only@*/ cstring idDecl_unparseC (idDecl p_d) /*@*/ ; extern /*@exposed@*/ qtype idDecl_getTyp (idDecl p_d) /*@*/ ; extern void idDecl_setTyp (idDecl p_d, /*@only@*/ qtype p_c) /*@modifies p_d@*/ ; extern idDecl idDecl_expectFunction (/*@returned@*/ idDecl p_d) /*@*/ ; extern void idDecl_notExpectingFunction (idDecl p_d) /*@modifies p_d@*/ ; extern idDecl idDecl_replaceCtype (/*@returned@*/ idDecl p_d, ctype p_c) /*@modifies p_d@*/ ; extern idDecl idDecl_fixBase (/*@returned@*/ idDecl p_t, qtype p_b) /*@modifies p_t@*/ ; extern idDecl idDecl_fixParamBase (/*@returned@*/ idDecl p_t, qtype p_b) /*@modifies p_t@*/ ; extern void idDecl_addClauses (idDecl p_d, /*@only@*/ functionClauseList) /*@modifies p_d@*/ ; extern ctype idDecl_getCtype (idDecl p_d) /*@*/ ; extern /*@exposed@*/ qualList idDecl_getQuals (idDecl p_d) /*@*/ ; extern /*@exposed@*/ functionClauseList idDecl_getClauses (idDecl p_d) /*@*/ ; extern /*@dependent@*/ /*@observer@*/ cstring idDecl_getName (idDecl p_t) /*@*/ ; extern /*@observer@*/ cstring idDecl_observeId (idDecl p_d) /*@*/ ; extern void idDecl_addQual (idDecl p_d, qual p_q); # define idDecl_getName(t) idDecl_observeId(t) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/sRefTable.h0000644021234200000250000000260707630463450015641 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** sRefTable.h ** ** based on sRefSet.h */ # ifndef sRefTABLE_H # define sRefTABLE_H typedef /*@owned@*/ sRef ow_sRef; abst_typedef /*@null@*/ struct { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ ow_sRef *elements; } *sRefTable; /*@constant int sRefTableBASESIZE; @*/ # define sRefTableBASESIZE HUGEBASESIZE /*@constant null sRefTable sRefTable_undefined; @*/ # define sRefTable_undefined ((sRefTable) NULL) extern /*@nullwhentrue@*/ bool sRefTable_isNull (sRefTable p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool sRefTable_isEmpty (/*@sef@*/ sRefTable p_s) /*@*/ ; extern /*@unused@*/ /*@falsewhennull@*/ bool sRefTable_isDefined (sRefTable p_s) /*@*/ ; # define sRefTable_isNull(s) ((s) == sRefTable_undefined) # define sRefTable_isDefined(s) ((!sRefTable_isNull(s))) # define sRefTable_isEmpty(s) ((s) == sRefTable_undefined || ((s)->entries == 0)) extern /*@unused@*/ /*@only@*/ cstring sRefTable_unparse (sRefTable p_s) /*@*/ ; extern void sRefTable_free (/*@only@*/ sRefTable p_s) /*@modifies p_s@*/; extern void sRefTable_clear (sRefTable p_s) /*@modifies p_s@*/ ; extern sRefTable sRefTable_add (/*@returned@*/ sRefTable p_s, /*@special@*/ /*@owned@*/ sRef p_el) /*@modifies p_s@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/idDeclList.h0000644021234200000250000000210107630463447016005 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef idDeclLIST_H # define idDeclLIST_H typedef /*@only@*/ idDecl o_idDecl; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_idDecl *elements; } *idDeclList ; /*@iter idDeclList_elements (sef idDeclList x, yield exposed idDecl el); @*/ # define idDeclList_elements(x, m_el) \ { int m_ind; idDecl *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { idDecl m_el = *(m_elements++); # define end_idDeclList_elements }} extern /*@only@*/ idDeclList idDeclList_singleton (/*@only@*/ idDecl p_e) ; extern idDeclList idDeclList_add (/*@returned@*/ idDeclList p_s, /*@only@*/ idDecl p_el) ; extern /*@unused@*/ /*@only@*/ cstring idDeclList_unparse (idDeclList p_s) ; extern void idDeclList_free (/*@only@*/ idDeclList p_s) ; /*@constant int idDeclListBASESIZE;@*/ # define idDeclListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/stateClause.h0000644021234200000250000000754207632052003016240 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** stateClause.h */ # ifndef STATECLAUSE_H # define STATECLAUSE_H typedef enum { SP_USES, SP_DEFINES, SP_ALLOCATES, SP_RELEASES, SP_SETS, SP_QUAL, SP_GLOBAL } stateClauseKind ; typedef enum { TK_BEFORE, TK_AFTER, TK_BOTH } stateConstraint; struct s_stateClause { stateConstraint state; stateClauseKind kind; qual squal; /* only for SP_QUAL and SP_GLOBAL */ sRefSet refs; fileloc loc; } ; /* in forwardTypes.h: abst_typedef struct _stateClause *stateClause; */ typedef /*@only@*/ stateClause o_stateClause; extern /*@unused@*/ cstring stateClause_unparse (stateClause p_s) /*@*/ ; extern /*@null@*/ sRefMod stateClause_getEffectFunction (stateClause p_cl) /*@*/ ; extern /*@null@*/ sRefModVal stateClause_getEnsuresFunction (stateClause p_cl) /*@*/ ; extern /*@null@*/ sRefModVal stateClause_getRequiresBodyFunction (stateClause p_cl) /*@*/ ; extern int stateClause_getStateParameter (stateClause p_cl) /*@*/ ; extern /*@null@*/ sRefMod stateClause_getReturnEffectFunction (stateClause p_cl) /*@*/ ; extern /*@null@*/ sRefMod stateClause_getEntryFunction (stateClause p_cl) /*@*/ ; extern bool stateClause_isGlobal (stateClause p_cl) /*@*/ ; # define stateClause_isGlobal(cl) ((cl)->kind == SP_GLOBAL) extern bool stateClause_isBefore (stateClause p_cl) /*@*/ ; extern bool stateClause_isBeforeOnly (stateClause p_cl) /*@*/ ; extern bool stateClause_isAfter (stateClause p_cl) /*@*/ ; extern bool stateClause_isEnsures (stateClause p_cl) /*@*/ ; extern bool stateClause_sameKind (stateClause p_s1, stateClause p_s2) /*@*/ ; extern /*@observer@*/ sRefSet stateClause_getRefs (stateClause p_cl) /*@*/ ; # define stateClause_getRefs(cl) ((cl)->refs) extern flagcode stateClause_preErrorCode (stateClause p_cl) /*@*/ ; extern /*@observer@*/ cstring stateClause_preErrorString (stateClause p_cl, sRef p_sr) /*@*/ ; extern flagcode stateClause_postErrorCode (stateClause p_cl) /*@*/ ; extern /*@observer@*/ cstring stateClause_postErrorString (stateClause p_cl, sRef p_sr) /*@*/ ; extern sRefTest stateClause_getPreTestFunction (stateClause p_cl) /*@*/ ; extern sRefTest stateClause_getPostTestFunction (stateClause p_cl) /*@*/ ; extern sRefShower stateClause_getPostTestShower (stateClause p_cl) /*@*/ ; extern stateClause stateClause_create (lltok p_tok, qual p_q, /*@only@*/ sRefSet p_s) /*@*/ ; extern stateClause stateClause_createPlain (lltok p_tok, /*@only@*/ sRefSet p_s) /*@*/ ; extern stateClause stateClause_createDefines (/*@only@*/ sRefSet p_s) /*@*/ ; extern stateClause stateClause_createUses (/*@only@*/ sRefSet p_s) /*@*/ ; extern stateClause stateClause_createAllocates (/*@only@*/ sRefSet p_s) /*@*/ ; extern stateClause stateClause_createReleases (/*@only@*/ sRefSet p_s) /*@*/ ; extern stateClause stateClause_createSets (/*@only@*/ sRefSet p_s) /*@*/ ; extern /*@observer@*/ fileloc stateClause_loc (stateClause) /*@*/ ; extern bool stateClause_isMemoryAllocation (stateClause p_cl) /*@*/ ; extern bool stateClause_isQual (stateClause p_cl) /*@*/ ; extern void stateClause_free (/*@only@*/ stateClause p_s) ; extern cstring stateClause_dump (stateClause p_s) /*@*/ ; extern stateClause stateClause_undump (char **p_s) /*@modifies *p_s@*/ ; extern stateClause stateClause_copy (stateClause p_s) /*@*/ ; extern bool stateClause_matchKind (stateClause p_s1, stateClause p_s2) /*@*/ ; extern bool stateClause_hasEnsures (stateClause p_cl) /*@*/ ; extern bool stateClause_hasRequires (stateClause p_cl) /*@*/ ; extern bool stateClause_setsMetaState (stateClause p_cl) /*@*/ ; extern qual stateClause_getMetaQual (stateClause p_cl) /*@*/ ; extern bool stateClause_hasEmptyReferences (stateClause p_s); extern bool stateClause_isMetaState (stateClause p_s); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/importNode.h0000644021234200000250000000115107630463447016111 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** importNode.h ** ** needs "ltoken_type.h" */ typedef enum { IMPPLAIN, IMPBRACKET, IMPQUOTE } impkind ; typedef struct { impkind kind; ltoken val; } *importNode ; extern void importNode_free (/*@only@*/ /*@null@*/ importNode p_x); extern /*@only@*/ importNode importNode_makePlain (/*@only@*/ ltoken p_t); extern /*@only@*/ importNode importNode_makeBracketed (/*@only@*/ ltoken p_t); extern /*@only@*/ importNode importNode_makeQuoted (/*@only@*/ ltoken p_t); splint-3.1.2.dfsg1/src/Headers/stateClauseList.h0000644021234200000250000000633707630463450017107 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** stateClauseList.h */ # ifndef STATECLAUSELIST_H # define STATECLAUSELIST_H struct s_stateClauseList { int nelements; int nspace; /*@relnull@*/ /*@reldef@*/ o_stateClause *elements; } ; extern void stateClauseList_checkAll (uentry p_ue) /*@modifies p_ue, g_warningstream@*/ ; /*@constant null stateClauseList stateClauseList_undefined@*/ # define stateClauseList_undefined ((stateClauseList) 0) extern /*@falsewhennull@*/ bool stateClauseList_isDefined (stateClauseList p_s) /*@*/ ; # define stateClauseList_isDefined(s) ((s) != stateClauseList_undefined) extern /*@nullwhentrue@*/ bool stateClauseList_isUndefined (stateClauseList p_s) /*@*/ ; # define stateClauseList_isUndefined(s) ((s) == stateClauseList_undefined) extern /*@unused@*/ int stateClauseList_size (/*@sef@*/ stateClauseList p_s) /*@*/ ; # define stateClauseList_size(s) (stateClauseList_isDefined (s) ? (s)->nelements : 0) extern cstring stateClause_unparseKind (stateClause p_s) /*@*/ ; extern stateClauseList stateClauseList_add (/*@returned@*/ stateClauseList p_s, /*@only@*/ stateClause p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ cstring stateClauseList_unparse (stateClauseList p_s) /*@*/ ; extern void stateClauseList_free (/*@only@*/ stateClauseList p_s) ; extern /*@only@*/ stateClauseList stateClauseList_copy (stateClauseList p_s) /*@*/ ; extern cstring stateClauseList_dump (stateClauseList p_s) /*@*/ ; extern stateClauseList stateClauseList_undump (char **p_s) /*@modifies *p_s@*/ ; extern int stateClauseList_compare (stateClauseList p_s1, stateClauseList p_s2) /*@*/ ; /*@constant int stateClauseListBASESIZE;@*/ # define stateClauseListBASESIZE MIDBASESIZE extern void stateClauseList_checkEqual (uentry p_old, uentry p_unew) /*@modifies g_warningstream@*/ ; /*@iter stateClauseList_elements (sef stateClauseList x, yield exposed stateClause el); @*/ # define stateClauseList_elements(x, m_el) \ { if (!stateClauseList_isUndefined(x)) \ { int m_ind; stateClause *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { stateClause m_el = *(m_elements++); # define end_stateClauseList_elements }}} /*@iter stateClauseList_preElements (sef stateClauseList x, yield exposed stateClause el); @*/ # define stateClauseList_preElements(x, m_el) \ { if (!stateClauseList_isUndefined(x)) \ { int m_ind; stateClause *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { stateClause m_el = *(m_elements++); if (stateClause_isBefore (m_el)) { \ # define end_stateClauseList_preElements }}}} /*@iter stateClauseList_postElements (sef stateClauseList x, yield exposed stateClause el); @*/ # define stateClauseList_postElements(x, m_el) \ { if (!stateClauseList_isUndefined(x)) \ { int m_ind; stateClause *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { stateClause m_el = *(m_elements++); if (stateClause_isAfter (m_el)) { \ # define end_stateClauseList_postElements }}}} # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/importNodeList.h0000644021234200000250000000217507630463447016754 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef IMPORTNODELIST_H # define IMPORTNODELIST_H typedef /*@only@*/ importNode o_importNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_importNode *elements; } *importNodeList ; /*@iter importNodeList_elements (sef importNodeList x, yield exposed importNode el); @*/ # define importNodeList_elements(x, m_el) \ { int m_ind; importNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { importNode m_el = *(m_elements++); # define end_importNodeList_elements }} extern /*@only@*/ importNodeList importNodeList_new (void); extern importNodeList importNodeList_add (/*@returned@*/ importNodeList p_s, /*@only@*/ importNode p_el) ; extern /*@only@*/ cstring importNodeList_unparse (importNodeList p_s) ; extern void importNodeList_free (/*@only@*/ importNodeList p_s) ; /*@constant int importNodeListBASESIZE;@*/ # define importNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/stateCombinationTable.h0000644021234200000250000000332407646432517020251 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** stateCombinationTable.h */ # ifndef STATECOMBINATIONTABLE_H # define STATECOMBINATIONTABLE_H /* ** stateCombinationTable is a mapping: int x int -> int x cstring ** The int values must be in a fixed (pre-defined) range, 0, ..., max. */ typedef struct { int value; cstring msg; } *stateEntry; typedef /*@only@*/ stateEntry o_stateEntry; typedef struct { int size; /*@only@*/ o_stateEntry *entries; } *stateRow; typedef /*@only@*/ stateRow o_stateRow; abst_typedef struct { int size; /*@only@*/ o_stateRow *rows; } *stateCombinationTable; extern /*@only@*/ stateCombinationTable stateCombinationTable_create (int p_size); extern void stateCombinationTable_set (stateCombinationTable p_h, int p_from, int p_to, int p_value, /*@only@*/ cstring p_msg); extern void stateCombinationTable_update (stateCombinationTable p_h, int p_from, int p_to, int p_value, /*@only@*/ cstring p_msg); extern int stateCombinationTable_lookup (stateCombinationTable p_h, int p_from, int p_to, /*@out@*/ ob_cstring *p_msg); extern int stateCombinationTable_lookupLoseReference (stateCombinationTable p_h, int p_from, /*@out@*/ /*@observer@*/ cstring *p_msg); extern void stateCombinationTable_free (/*@only@*/ stateCombinationTable p_t); extern int stateCombinationTable_size (stateCombinationTable p_h) /*@*/ ; # define stateCombinationTable_size(h) ((h)->size) extern cstring stateCombinationTable_unparse (stateCombinationTable) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/imports.h0000644021234200000250000000051207630463447015466 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ extern void processImport (lsymbol p_importSymbol, ltoken p_tok, impkind p_kind); extern void outputLCSFile (char *p_path, char *p_msg, char *p_specname); extern void importCTrait (void); splint-3.1.2.dfsg1/src/Headers/stateInfo.h0000644021234200000250000000532507630463450015726 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** stateInfo.h */ # ifndef STATEINFO_H # define STATEINFO_H typedef /*@null@*/ struct s_stateInfo *stateInfo ; typedef enum { SA_UNKNOWN, /* Any type of action */ SA_CREATED, SA_DECLARED, SA_CHANGED, /* Definition actions */ SA_UNDEFINED, SA_MUNDEFINED, SA_PDEFINED, SA_DEFINED, SA_RELEASED, SA_ALLOCATED, SA_KILLED, SA_PKILLED, SA_MERGED, /* sharing actions */ SA_SHARED, SA_ONLY, SA_IMPONLY, SA_OWNED, SA_DEPENDENT, SA_IMPDEPENDENT, SA_KEPT, SA_KEEP, SA_FRESH, SA_XSTACK, /* SA_STACK is defined in some Linux headers (but ISO does not reserve this namespace) */ SA_TEMP, SA_IMPTEMP, SA_STATIC, SA_LOCAL, SA_REFCOUNTED, SA_REFS, SA_NEWREF, SA_KILLREF, /* exposure */ SA_EXPOSED, SA_OBSERVER, /* nullity actions */ SA_BECOMESNULL, SA_BECOMESNONNULL, SA_BECOMESPOSSIBLYNULL, } stateAction; /*@null@*/ struct s_stateInfo { /*@only@*/ fileloc loc; stateAction action; /*@observer@*/ sRef ref; /*@null@*/ stateInfo previous; } ; /*@constant null stateInfo stateInfo_undefined@*/ # define stateInfo_undefined (NULL) extern /*@falsewhennull@*/ bool stateInfo_isDefined (stateInfo p_s) /*@*/ ; # define stateInfo_isDefined(p_s) ((p_s) != stateInfo_undefined) extern void stateInfo_free (/*@only@*/ stateInfo p_a); extern /*@only@*/ stateInfo stateInfo_update (/*@only@*/ stateInfo p_old, stateInfo p_newinfo); extern /*@only@*/ stateInfo stateInfo_updateLoc (/*@only@*/ stateInfo p_old, stateAction p_action, fileloc p_loc) ; extern /*@only@*/ stateInfo stateInfo_updateRefLoc (/*@only@*/ stateInfo p_old, /*@exposed@*/ sRef p_ref, stateAction p_action, fileloc p_loc) ; extern /*@only@*/ stateInfo stateInfo_copy (stateInfo p_a); extern /*@only@*/ /*@notnull@*/ stateInfo stateInfo_currentLoc (void) ; extern /*@only@*/ /*@notnull@*/ stateInfo stateInfo_makeLoc (fileloc p_loc, stateAction p_action) /*@*/ ; extern /*@only@*/ /*@notnull@*/ stateInfo stateInfo_makeRefLoc (/*@exposed@*/ sRef p_ref, fileloc p_loc, stateAction p_action) /*@*/ ; extern /*@observer@*/ fileloc stateInfo_getLoc (stateInfo p_info) ; extern /*@only@*/ cstring stateInfo_unparse (stateInfo p_s) /*@*/ ; extern stateAction stateAction_fromSState (sstate p_ss) /*@*/ ; extern stateAction stateAction_fromNState (nstate p_ns) /*@*/ ; extern stateAction stateAction_fromExkind (exkind p_ex) /*@*/ ; extern stateAction stateAction_fromAlkind (alkind p_ak) /*@*/ ; extern void stateInfo_display (stateInfo p_s, /*@only@*/ cstring p_sname) /*@modifies g_errorstream@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/initDeclNode.h0000644021234200000250000000056107630463447016336 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { declaratorNode declarator; /*@null@*/ termNode value; } *initDeclNode; extern bool initDeclNode_isRedeclaration (initDeclNode p_d); extern void initDeclNode_free (/*@only@*/ /*@null@*/ initDeclNode p_x); splint-3.1.2.dfsg1/src/Headers/stateValue.h0000644021234200000250000000446307630463450016111 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** stateValue.h */ # ifndef STATEVALUE_H # define STATEVALUE_H /* ** Keeps track of the value of a state variable, as well as tracking ** information about its history. */ struct s_stateValue { int value; bool implicit; /*@only@*/ stateInfo info; }; extern /*@notnull@*/ stateValue stateValue_create (int p_value, /*@only@*/ stateInfo p_info) /*@*/ ; extern /*@notnull@*/ stateValue stateValue_createImplicit (int p_value, /*@only@*/ stateInfo p_info) /*@*/ ; /*@constant null stateValue stateValue_undefined@*/ # define stateValue_undefined (NULL) extern /*@nullwhentrue@*/ bool stateValue_isUndefined (stateValue) /*@*/ ; # define stateValue_isUndefined(p_s) ((p_s) == stateValue_undefined) extern /*@falsewhennull@*/ bool stateValue_isDefined (stateValue) /*@*/ ; # define stateValue_isDefined(p_s) ((p_s) != NULL) extern bool stateValue_isImplicit (stateValue) /*@*/ ; extern int stateValue_getValue (stateValue p_s) /*@*/ ; extern void stateValue_update (stateValue p_res, stateValue p_val) /*@modifies p_res@*/ ; extern /*@observer@*/ fileloc stateValue_getLoc (stateValue p_s) /*@*/ ; # define stateValue_getLoc(p_s) (stateInfo_getLoc (stateValue_getInfo (p_s))) extern bool stateValue_hasLoc (stateValue p_s) /*@*/ ; extern /*@observer@*/ stateInfo stateValue_getInfo (stateValue p_s) /*@*/ ; extern void stateValue_updateValue (/*@sef@*/ stateValue p_s, int p_value, /*@only@*/ stateInfo p_info) /*@modifies p_s@*/ ; extern void stateValue_updateValueLoc (stateValue p_s, int p_value, fileloc p_loc) /*@modifies p_s@*/ ; extern void stateValue_show (stateValue p_s, metaStateInfo p_msinfo) ; extern stateValue stateValue_copy (stateValue p_s) /*@*/ ; extern /*@only@*/ cstring stateValue_unparseValue (stateValue p_s, metaStateInfo p_msinfo) /*@*/ ; extern cstring stateValue_unparse (stateValue p_s) /*@*/ ; extern bool stateValue_sameValue (stateValue p_s1, stateValue p_s2) /*@*/ ; extern bool stateValue_isError (/*@sef@*/ stateValue p_s) /*@*/ ; # define stateValue_isError(p_s) (stateValue_isDefined (p_s) && (stateValue_getValue (p_s) == stateValue_error)) /*@constant int stateValue_error@*/ # define stateValue_error -1 # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/initDeclNodeList.h0000644021234200000250000000226507630463447017175 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef INITDECLNODELIST_H # define INITDECLNODELIST_H typedef /*@only@*/ initDeclNode o_initDeclNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_initDeclNode *elements; } *initDeclNodeList ; /*@iter initDeclNodeList_elements (sef initDeclNodeList x, yield exposed initDeclNode el); @*/ # define initDeclNodeList_elements(x, m_el) \ { int m_ind; initDeclNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { initDeclNode m_el = *(m_elements++); # define end_initDeclNodeList_elements }} extern /*@only@*/ initDeclNodeList initDeclNodeList_new(void); extern initDeclNodeList initDeclNodeList_add (/*@returned@*/ initDeclNodeList p_s, /*@only@*/ initDeclNode p_el) ; extern /*@only@*/ cstring initDeclNodeList_unparse (initDeclNodeList p_s) ; extern void initDeclNodeList_free (/*@only@*/ initDeclNodeList p_s) ; /*@constant int initDeclNodeListBASESIZE;@*/ # define initDeclNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/stDeclNode.h0000644021234200000250000000055007630463450016011 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ typedef struct { lclTypeSpecNode lcltypespec; declaratorNodeList declarators; } *stDeclNode; extern void stDeclNode_free (/*@only@*/ /*@null@*/ stDeclNode p_x); extern stDeclNode stDeclNode_copy (stDeclNode p_x); splint-3.1.2.dfsg1/src/Headers/inputStream.h0000644021234200000250000000454207630463447016313 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** inputStream.h */ # ifndef INPUTSTREAM_H # define INPUTSTREAM_H /*@constant int STUBMAXRECORDSIZE; @*/ # define STUBMAXRECORDSIZE 800 struct s_inputStream { /*@only@*/ cstring name; /*:open:*/ /*@dependent@*/ /*@null@*/ FILE *file; char buffer[STUBMAXRECORDSIZE+1]; int lineNo; size_t charNo; /*@dependent@*/ /*@null@*/ char *curLine; bool echo, fromString; /*@owned@*/ cstring stringSource; /*@dependent@*/ cstring stringSourceTail; } ; /* in forwardTypes.h: abst_typedef null struct _inputStream *inputStream; */ extern /*@falsewhennull@*/ bool inputStream_isDefined (/*@null@*/ inputStream p_f) /*@*/ ; extern /*@nullwhentrue@*/ bool inputStream_isUndefined (/*@null@*/ inputStream p_f) /*@*/ ; /*@constant null inputStream inputStream_undefined; @*/ # define inputStream_undefined ((inputStream) NULL) # define inputStream_isDefined(f) ((f) != inputStream_undefined) # define inputStream_isUndefined(f) ((f) == inputStream_undefined) extern void inputStream_free (/*@null@*/ /*@only@*/ inputStream p_s); extern bool inputStream_close (inputStream p_s) /*@modifies p_s, fileSystem@*/ ; extern /*@only@*/ inputStream inputStream_create (/*@only@*/ cstring p_name, cstring p_suffix, bool p_echo) /*@*/ ; extern inputStream inputStream_fromString (cstring p_name, cstring p_str) /*@*/ ; extern /*@dependent@*/ /*@null@*/ char *inputStream_nextLine(inputStream p_s) /*@modifies p_s@*/ ; extern int inputStream_nextChar (inputStream p_s) /*@modifies p_s@*/ ; /* Returns int for EOF */ extern int inputStream_peekChar (inputStream p_s) /*@modifies p_s@*/ ; /* Returns int for EOF */ extern int inputStream_peekNChar (inputStream p_s, int p_n) /*@modifies p_s@*/ ; /* Returns int for EOF */ extern bool inputStream_open (inputStream p_s) /*@modifies p_s, fileSystem@*/ ; extern bool inputStream_getPath (cstring p_path, inputStream p_s) /*@modifies p_s@*/ ; extern /*@observer@*/ cstring inputStream_fileName (inputStream p_s) /*@*/ ; extern bool inputStream_isOpen (/*@sef@*/ inputStream p_s) /*@*/ ; extern int inputStream_thisLineNumber(inputStream p_s) /*@*/ ; extern /*:open:*/ /*@exposed@*/ FILE *inputStream_getFile (inputStream p_s) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/stDeclNodeList.h0000644021234200000250000000247407630463450016654 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef STRUCTDECLNODELIST_H # define STRUCTDECLNODELIST_H typedef /*@only@*/ stDeclNode o_stDeclNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_stDeclNode *elements; } *stDeclNodeList ; /*@iter stDeclNodeList_elements (sef stDeclNodeList x, yield exposed stDeclNode el); @*/ # define stDeclNodeList_elements(x, m_el) \ { int m_ind; stDeclNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { stDeclNode m_el = *(m_elements++); # define end_stDeclNodeList_elements }} extern int stDeclNodeList_size (stDeclNodeList); # define stDeclNodeList_size(s) ((s)->nelements) extern /*@only@*/ stDeclNodeList stDeclNodeList_new(void); extern stDeclNodeList stDeclNodeList_add (/*@returned@*/ stDeclNodeList p_s, /*@only@*/ stDeclNode p_el); extern /*@only@*/ cstring stDeclNodeList_unparse (stDeclNodeList p_s) ; extern void stDeclNodeList_free (/*@only@*/ stDeclNodeList p_s) ; extern /*@only@*/ stDeclNodeList stDeclNodeList_copy (stDeclNodeList p_s) ; /*@constant int stDeclNodeListBASESIZE;@*/ # define stDeclNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/interfaceNode.h0000644021234200000250000000142607630463447016544 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef enum { INF_IMPORTS, INF_USES, INF_EXPORT, INF_PRIVATE } interfaceNodeKind; typedef struct { interfaceNodeKind kind; /* which kind of interface node */ union { /* evs 8 Sept 1993 */ importNodeList imports; /* a list of simpleId or TYPEDEF_NAME */ traitRefNodeList uses; /* a list of traitRef */ exportNode export; privateNode private; } content; /* can be empty */ /* the list that made up is chained thru next */ } *interfaceNode; extern /*@unused@*/ cstring interfaceNode_unparse (interfaceNode p_x); extern void interfaceNode_free (/*@null@*/ /*@only@*/ interfaceNode p_x); splint-3.1.2.dfsg1/src/Headers/stmtNode.h0000644021234200000250000000046007630463450015562 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ struct s_stmtNode { ltoken lhs; ltoken operator; termNodeList args; } ; extern /*@unused@*/ /*@notnull@*/ /*@only@*/ cstring stmtNode_unparse (stmtNode p_x); splint-3.1.2.dfsg1/src/Headers/interfaceNodeList.h0000644021234200000250000000306207630463447017376 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef interfaceNodeLIST_H # define interfaceNodeLIST_H typedef /*@only@*/ interfaceNode o_interfaceNode; abst_typedef struct { int nelements; int nspacehigh; int nspacelow; /*@dependent@*/ /*@reldef@*/ /*@relnull@*/ o_interfaceNode *elements; /*@only@*/ /*@reldef@*/ /*@relnull@*/ o_interfaceNode *elementsroot; } *interfaceNodeList ; /*@iter interfaceNodeList_elements (sef interfaceNodeList x, yield exposed interfaceNode el); @*/ # define interfaceNodeList_elements(x, m_el) \ { int m_ind; interfaceNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { interfaceNode m_el = *(m_elements++); # define end_interfaceNodeList_elements }} extern /*@only@*/ interfaceNodeList interfaceNodeList_new(void); extern interfaceNodeList interfaceNodeList_addh (/*@returned@*/ interfaceNodeList p_s, /*@only@*/ interfaceNode p_el); extern void interfaceNodeList_addl (interfaceNodeList p_s, /*@keep@*/ interfaceNode p_el) ; extern void interfaceNodeList_free (/*@only@*/ interfaceNodeList p_s) ; /*@constant int interfaceNodeListGROWLOW;@*/ # define interfaceNodeListGROWLOW 4 /* addl used in abstract.c */ /*@constant int interfaceNodeListGROWHI;@*/ # define interfaceNodeListGROWHI 4 /*@constant int interfaceNodeListBASESIZE;@*/ # define interfaceNodeListBASESIZE \ (interfaceNodeListGROWLOW + interfaceNodeListGROWHI) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/storeRefNode.h0000644021234200000250000000203207630463450016361 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ typedef enum { SRN_TERM, SRN_TYPE, SRN_OBJ, SRN_SPECIAL } storeRefNodeKind; typedef struct { storeRefNodeKind kind; union { termNode term; /* for SRN_TERM */ lclTypeSpecNode type; /* for SRN_OBJ and SRN_TYPE */ /*@dependent@*/ sRef ref; /* for SRN_SPECIAL */ } content; } *storeRefNode; extern storeRefNode storeRefNode_copy (storeRefNode p_x); extern bool storeRefNode_isTerm (storeRefNode p_x); # define storeRefNode_isTerm(x) ((x)->kind == SRN_TERM) extern bool storeRefNode_isObj (storeRefNode p_x); # define storeRefNode_isObj(x) ((x)->kind == SRN_OBJ) extern bool storeRefNode_isType (storeRefNode p_x); # define storeRefNode_isType(x) ((x)->kind == SRN_TYPE) extern bool storeRefNode_isSpecial (storeRefNode p_x); # define storeRefNode_isSpecial(x) ((x)->kind == SRN_SPECIAL) extern void storeRefNode_free (/*@only@*/ /*@null@*/ storeRefNode p_x); splint-3.1.2.dfsg1/src/Headers/intSet.h0000644021234200000250000000225007630463447015240 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** intSet.h ** ** based on set_template.h */ # ifndef intSET_H # define intSET_H abst_typedef struct { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ int *elements; } *intSet; /*@iter intSet_elements (sef intSet s, yield int el)@*/ # define intSet_elements(x, m_el) \ { int m_ind; for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ { int m_el = (x)->elements[m_ind]; # define end_intSet_elements }} extern /*@only@*/ intSet intSet_new (void); extern bool intSet_isEmpty (intSet p_s); # define intSet_isEmpty(s) ((s)->entries == 0) extern int intSet_size (intSet p_s); # define intSet_size(s) ((s)->entries) extern bool intSet_insert (intSet p_s, int p_el); extern /*@unused@*/ bool intSet_member (intSet p_s, int p_el); extern /*@only@*/ /*@unused@*/ cstring intSet_unparse (intSet p_s); extern void intSet_free (/*@only@*/ intSet p_s); extern /*@only@*/ cstring intSet_unparseText (intSet p_s); /*@constant int intSetBASESIZE;@*/ # define intSetBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/storeRefNodeList.h0000644021234200000250000000240207630463450017216 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef STOREREFNODELIST_H # define STOREREFNODELIST_H typedef /*@only@*/ storeRefNode o_storeRefNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_storeRefNode *elements; } *storeRefNodeList ; /*@iter storeRefNodeList_elements (sef storeRefNodeList x, yield exposed storeRefNode el); @*/ # define storeRefNodeList_elements(x, m_el) \ { int m_ind; storeRefNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { storeRefNode m_el = *(m_elements++); # define end_storeRefNodeList_elements }} extern /*@only@*/ storeRefNodeList storeRefNodeList_new(void); extern storeRefNodeList storeRefNodeList_add (/*@returned@*/ storeRefNodeList p_s, /*@only@*/ storeRefNode p_el); extern /*@only@*/ cstring storeRefNodeList_unparse (storeRefNodeList p_s) ; extern void storeRefNodeList_free (/*@only@*/ storeRefNodeList p_s) ; extern /*@only@*/ storeRefNodeList storeRefNodeList_copy (storeRefNodeList p_s) ; /*@constant int storeRefNodeListBASESIZE;@*/ # define storeRefNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/intTable.h0000644021234200000250000000131407630463447015534 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** intTable.h */ # ifndef INTTABLE_H # define INTTABLE_H /* ** intTable is used to map a limited number of integers to other integers. ** The table size is fixed, and gives the maximum value. */ abst_typedef struct _intTable { int size; /*@only@*/ int *values; } *intTable; extern /*@only@*/ intTable intTable_create (int p_size); extern void intTable_set (intTable p_h, int p_key, int p_value); extern int intTable_lookup (intTable p_h, int p_key); extern void intTable_free (/*@only@*/ intTable p_h); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/strOrUnionNode.h0000644021234200000250000000070507630463450016717 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ typedef enum {SU_STRUCT, SU_UNION} suKind; typedef struct { suKind kind; ltoken tok; /* also encodes if it's struct or union */ ltoken opttagid; sort sort; /*@owned@*/ stDeclNodeList structdecls; } *strOrUnionNode; extern /*@unused@*/ cstring strOrUnionNode_unparse (/*@null@*/ strOrUnionNode p_n); splint-3.1.2.dfsg1/src/Headers/iterNode.h0000644021234200000250000000046107630463447015545 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken name; paramNodeList params; } *iterNode; extern /*@unused@*/ /*@only@*/ cstring iterNode_unparse (/*@null@*/ iterNode p_i) /*@*/ ; splint-3.1.2.dfsg1/src/Headers/structNames.h0000644021234200000250000000111707320411564016270 0ustar fax# ifndef STRUCTNAMES # define STRUCTNAMES extern /*@only@*/ cstring makeStruct(cstring p_s); extern /*@only@*/ cstring makeUnion(cstring p_s); extern /*@only@*/ cstring makeEnum(cstring p_s); extern /*@only@*/ cstring makeParam (cstring p_s); extern void setTagNo (unsigned int p_n); extern bool isFakeTag (cstring p_s) /*@*/ ; extern /*@only@*/ cstring fakeTag (void); extern /*@only@*/ cstring fixTagName (cstring p_s); extern /*@observer@*/ cstring fixParamName (cstring p_s); extern /*@observer@*/ cstring plainTagName (cstring p_s) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lcl_constants.h0000644021234200000250000000316307630463447016644 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LCL_CONSTANTS_H # define LCL_CONSTANTS_H /* lclsyntable */ /*@constant unsigned long int INITSYNTABLE; @*/ # define INITSYNTABLE 1024 /*@constant double DELTASYNTABLE; @*/ # define DELTASYNTABLE 2.0 /* syntable */ /*@constant int SYNTABLE_BASESIZE; @*/ # define SYNTABLE_BASESIZE 256 /* lcltokentable */ /*@constant unsigned long int INITTOKENTABLE; @*/ # define INITTOKENTABLE 1024 /*@constant double DELTATOKENTABLE; @*/ # define DELTATOKENTABLE 2.0 /* string2sym */ /*@constant int INITCHARSTRING; @*/ # define INITCHARSTRING 8192 /*@constant int DELTACHARSTRING; @*/ # define DELTACHARSTRING 2 /*@constant int INITSTRINGENTRY; @*/ # define INITSTRINGENTRY 1024 /*@constant int DELTASTRINGENTRY; @*/ # define DELTASTRINGENTRY 2 /*@constant int HASHSIZE; @*/ # define HASHSIZE 1024 /*@constant int HASHMASK; @*/ # define HASHMASK (HASHSIZE-1) /* HASHSIZE must be 2^n */ /*@constant observer char *INITFILENAME; @*/ # define INITFILENAME "lclinit.lci" /*@constant observer char *IO_SUFFIX; @*/ # define IO_SUFFIX ".lcs" /*@constant observer char *LCLINIT_SUFFIX; @*/ # define LCLINIT_SUFFIX ".lci" /*@constant observer char *CTRAITSYMSNAME; @*/ # define CTRAITSYMSNAME "CTrait.syms" /*@constant observer char *CTRAITSPECNAME; @*/ # define CTRAITSPECNAME "CTrait.lsl" /*@constant observer char *CTRAITFILENAMEN; @*/ # define CTRAITFILENAMEN "CTrait" # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/symtable.h0000644021234200000250000001415707630463450015615 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** symtable.h */ # ifndef SYMTABLE_H # define SYMTABLE_H /* There are 3 separate namespaces being maintained in this symbol table: (N1) for C objects, functions, typedef names and enumeration constants. (N2) for C tags. (N3) for LSL operators. I re-use the old linked list to represent N1 since it is here and it is convenient for representing scopes. Two more new hashtables are added to store N2 and N3, each keyed on the lsymbol of the identifier. */ /*@constant observer char *BEGINSYMTABLE;@*/ # define BEGINSYMTABLE "%LCLSymbolTable" /*@constant observer char *SYMTABLEEND;@*/ # define SYMTABLEEND "%LCLSymbolTableEnd" typedef long unsigned symbolKey; typedef struct { ltoken id; bool export; /* all HOF maps to one sort kind: SRT_HOF */ /*@only@*/ signNode signature; /* in terms of sorts, no HOF */ /*@only@*/ pairNodeList globals; /* list of (sort globalnameSym) */ } *fctInfo; typedef struct { ltoken id; sort basedOn; bool abstract; /* TRUE means LCL abstract type */ bool modifiable; /* TRUE indicates the abstract type is mutable */ bool export; /* if TRUE, export it from this module */ } *typeInfo; typedef enum { VRK_CONST, /* an LCL constant */ VRK_ENUM, /* an enumeration constant, a special kind of LCL constant */ VRK_VAR, /* an LCL variable */ VRK_PRIVATE,/* a variable private to current function/module */ /* function private overrides module private, usual scoping rules */ VRK_GLOBAL, /* in globals of a function */ VRK_LET, /* local let variable in a function decl */ VRK_PARAM, /* formal parameters of a function/claim */ VRK_QUANT /* bound by a quantifier */ } varKind; typedef struct { ltoken id; sort sort; varKind kind; bool export; /* if TRUE, export it from this module */ } *varInfo; /* The same lsymbol can originate from different files: an LCL file or an LSL file. Each occurrence in an LCL file appears as one of {opId, anyOp, logicalOp, simpleOp, eqOp, MULOP} ltoken. Each occurrence in an LSL file appears as an lslOp AST. */ typedef struct { /*@only@*/ nameNode name; /*@only@*/ sigNodeSet signatures; } *opInfo; typedef struct { ltoken id; tagKind kind; bool imported; sort sort; /*@reldef@*/ union { /*@null@*/ /*@dependent@*/ ltokenList enums; /*@null@*/ stDeclNodeList decls; } content; } *tagInfo; typedef enum { IK_SORT, IK_OP, IK_TAG } infoKind; typedef struct { infoKind kind; union { tagInfo tag; sort sort; opInfo op;} content; } htData; typedef enum { SPE_GLOBAL, SPE_FCN, SPE_QUANT, SPE_CLAIM, SPE_ABSTRACT, SPE_INVALID } scopeKind; typedef struct { scopeKind kind; } *scopeInfo; /* ** A simple hash table implementation: Given a key K and a ** pointer P to a piece of data, associate K with P. ** ** Assumes that K is unsigned int, and data supports ** 3 operations: ** data_key: htData * -> unsigned int */ typedef struct s_htEntry { /*@only@*/ htData *data; /*@only@*/ struct s_htEntry *next; } htEntry; /* Each bucket is a linked list of entries */ typedef htEntry bucket; typedef /*@relnull@*/ /*@only@*/ bucket *o_bucket; typedef struct { unsigned int count; unsigned int size; /*@relnull@*/ /*@only@*/ o_bucket *buckets; } symHashTable; /* Local to implementation */ typedef struct s_symtableStruct *symtable; extern /*@falsewhennull@*/ bool typeInfo_exists(/*@null@*/ typeInfo p_ti); # define typeInfo_exists(ti) ((ti) != NULL) extern /*@falsewhennull@*/ bool varInfo_exists(/*@null@*/ varInfo p_vi); # define varInfo_exists(vi) ((vi) != NULL) extern /*@falsewhennull@*/ bool tagInfo_exists(/*@null@*/ tagInfo p_oi); # define tagInfo_exists(ti) ((ti) != NULL) extern /*@falsewhennull@*/ bool opInfo_exists(/*@null@*/ opInfo p_oi); # define opInfo_exists(oi) ((oi) != NULL) extern /*@only@*/ symtable symtable_new (void) /*@*/ ; extern void symtable_enterScope (symtable p_stable, /*@keep@*/ scopeInfo p_si); extern void symtable_exitScope(symtable p_stable); extern bool symtable_enterFct (symtable p_stable, /*@only@*/ fctInfo p_fi); extern void symtable_enterType (symtable p_stable, /*@only@*/ typeInfo p_ti); /* not only --- it is copied! */ extern bool symtable_enterVar (symtable p_stable, /*@temp@*/ varInfo p_vi); extern void symtable_enterOp (symtable p_st, /*@only@*/ /*@notnull@*/ nameNode p_n, /*@owned@*/ sigNode p_oi); extern bool symtable_enterTag (symtable p_st, /*@only@*/ tagInfo p_ti); extern bool symtable_enterTagForce(symtable p_st, /*@only@*/ tagInfo p_ti); extern bool symtable_exists(symtable p_stable, lsymbol p_i); extern /*@observer@*/ /*@null@*/ typeInfo symtable_typeInfo(symtable p_stable, lsymbol p_i); extern /*@observer@*/ /*@null@*/ varInfo symtable_varInfo(symtable p_stable, lsymbol p_i); extern /*@observer@*/ /*@null@*/ varInfo symtable_varInfoInScope(symtable p_stable, lsymbol p_id); extern /*@observer@*/ /*@null@*/ opInfo symtable_opInfo(symtable p_st, /*@notnull@*/ nameNode p_n); extern /*@observer@*/ /*@null@*/ tagInfo symtable_tagInfo(symtable p_st, lsymbol p_i); extern void symtable_export(symtable p_stable, bool p_yesNo); extern void symtable_dump(symtable p_stable, FILE *p_f, bool p_lco); extern void symtable_import(inputStream p_imported, ltoken p_tok, mapping p_map); extern /*@unused@*/ void symtable_printStats (symtable p_s); extern lsymbol lsymbol_sortFromType (symtable, lsymbol); extern cstring tagKind_unparse (tagKind p_k); extern lsymbol lsymbol_translateSort (mapping p_m, lsymbol p_s); extern void varInfo_free (/*@only@*/ varInfo p_v); extern /*@only@*/ lslOpSet symtable_opsWithLegalDomain (symtable p_tab, /*@temp@*/ /*@null@*/ nameNode p_n, sortSetList p_argSorts, sort p_q); extern /*@observer@*/ sigNodeSet symtable_possibleOps (symtable p_tab, nameNode p_n); extern bool symtable_opExistsWithArity(symtable p_tab, nameNode p_n, int p_arity); extern void symtable_free (/*@only@*/ symtable p_stable); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lclctypes.h0000644021234200000250000000213207630463447015773 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LCLCTYPESX_H # define LCLCTYPESX_H /* ** TypeSpecification is an enum defined for each of the valid C type. */ typedef enum { TS_UNKNOWN, TS_VOID, TS_CHAR, TS_INT, TS_SIGNED, TS_UNSIGNED, TS_SHORT, TS_LONG, TS_FLOAT, TS_DOUBLE, TS_ENUM, TS_STRUCT, TS_UNION, TS_TYPEDEF } TypeSpecification; /* ** TypeSpec is an enum for each of the valid combinations of type specifiers. */ typedef enum { TYS_NONE, TYS_VOID, TYS_CHAR, TYS_SCHAR, TYS_UCHAR, TYS_SSINT, TYS_USINT, TYS_INT, TYS_SINT, TYS_UINT, TYS_SLINT, TYS_ULINT, TYS_FLOAT, TYS_DOUBLE, TYS_LDOUBLE, TYS_ENUM, TYS_STRUCT, TYS_UNION, TYS_TYPENAME } TypeSpec; typedef bits lclctype; extern lclctype fixBits(TypeSpecification p_attr, lclctype p_spec); # define fixBits(attr, spec) ((unsigned)(1<<(attr) | (spec))) extern lsymbol lclctype_toSort(lclctype p_t); extern lsymbol lclctype_toSortDebug(lclctype p_t); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/syntable.h0000644021234200000250000000107707630463450015613 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** syntable.h */ extern void LSLAddSyn(lsymbol, lsymbol) /*@modifies internalState@*/ ; extern /*@exposed@*/ ltoken LSLGetTokenForSyn(lsymbol) /*@globals internalState@*/ ; extern bool LSLIsSyn(lsymbol) /*@globals internalState@*/ ; extern void lsynTableInit (void) /*@modifies internalState@*/ ; extern void lsynTableReset (void) /*@modifies internalState@*/ ; extern void lsynTableCleanup (void) /*@modifies internalState@*/ ; splint-3.1.2.dfsg1/src/Headers/lclForwardTypes.h0000644021234200000250000000122207320411541017074 0ustar fax# ifndef LCL_FORWARDTYPES_H # define LCL_FORWARDTYPES_H typedef struct s_opFormNode *opFormNode; typedef struct s_termNode *termNode; typedef struct s_abstBodyNode *abstBodyNode; typedef struct s_lclPredicateNode *lclPredicateNode; typedef struct s_stmtNode *stmtNode; abst_typedef struct s_programNodeList *programNodeList; typedef /*@null@*/ struct s_lclTypeSpecNode *lclTypeSpecNode; abst_typedef struct s_termNodeList *termNodeList; typedef unsigned int sort; typedef long unsigned lsymbol; typedef struct s_typeExpr *typeExpr; abst_typedef /*@null@*/ struct s_ltoken *ltoken; typedef unsigned int ltokenCode; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/system_constants.h0000644021234200000250000000623410102766474017412 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef SYSTEM_CONSTANTS_H # define SYSTEM_CONSTANTS_H # include "lcl_constants.h" /* exit codes */ /*@constant int LLSUCCESS; @*/ # define LLSUCCESS EXIT_SUCCESS /*@constant int LLFAILURE; @*/ # define LLFAILURE EXIT_FAILURE /*@constant int LLGIVEUP; @*/ # define LLGIVEUP EXIT_FAILURE /*@constant int LLINTERRUPT; @*/ # define LLINTERRUPT EXIT_FAILURE /*@constant int DEFAULTMAXMODS; @*/ # define DEFAULTMAXMODS 32 /* ** number of parse errors before quiting */ /*@constant int GIVEUPPARSE; @*/ # define GIVEUPPARSE 5 /* ** how many recursive searches to do before bailing! */ /*@constant int MAXDEPTH; @*/ # define MAXDEPTH 10 /* ** This limits the number of recursive calls to aliasTable_canAliasAux. ** It is necessary in the presence on recursive nested data structures. ** Note that we don't want to simply detect recursion and quit, since ** aliasing may be apparent only at the deeper level. It would be better ** to do something in the alias table to confirm that there are no aliases ** recorded below a given depth, but in practice this is much easier! */ /*@constant int ALIASSEARCHLIMIT; @*/ # define ALIASSEARCHLIMIT 8 /* ** This one's compilcated. You probably don't want to change ** it. ** ** lclint maintains a table of ctype's (its representation of ** C types) and represents types internally as an index into ** this table. This greatly improves performance of type ** checking and saves memory. For simple derived types, it ** is easy to find if the type is already in the table. For ** more complicated types (e.g., functions and structures), ** we check if a type is already in the table by looking ** backwards for matches. The last DEFAULT_OPTLEVEL types ** entered into the table are checked. Increasing this value ** may improve memory performance, but cost in execution time. ** */ /*@constant int DEFAULT_OPTLEVEL; @*/ # define DEFAULT_OPTLEVEL 15 /* ** There are many *List and *Set types used by lclint (all ** generated automatically using a template and script). ** For each, the BASESIZE is the number of entries the ** structure grows by each time it runs out of space. ** Depending on expected usage, each List/Set defines ** its BASESIZE to one of these three values. */ /*@constant int SMALLBASESIZE; @*/ # define SMALLBASESIZE 4 /*@constant int MIDBASESIZE; @*/ # define MIDBASESIZE 8 /*@constant int LARGEBASESIZE; @*/ # define LARGEBASESIZE 16 /*@constant int BIGBASESIZE; @*/ # define BIGBASESIZE 256 /*@constant int HUGEBASESIZE; @*/ # define HUGEBASESIZE 512 /* ** Size of hash table for file names. */ /*@constant unsigned long FTHASHSIZE; @*/ # define FTHASHSIZE 273 /* ** BASESIZE for C environment frames. */ /*@constant int CBASESIZE; @*/ # define CBASESIZE 4 /* ** The global environment (across files) is stored in ** a hash table. */ /*@constant int CGLOBBASESIZE; @*/ # define CGLOBBASESIZE 1024 /*@constant unsigned long CGLOBHASHSIZE; @*/ # define CGLOBHASHSIZE 1795 /*@constant int LLHASHSIZE; @*/ # define LLHASHSIZE 1279 # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lclinit.h0000644021234200000250000000056607630463447015440 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** LSLInitRuleCode defined in lslinit.h */ typedef LSLInitRuleCode LCLInitRuleCode; extern void lclinit_process (void); extern void lclinit_initMod (void); extern void lclinit_reset (void); extern void lclinit_cleanup (void); splint-3.1.2.dfsg1/src/Headers/taggedUnionNode.h0000644021234200000250000000051507630463450017040 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ typedef struct { stDeclNodeList structdecls; declaratorNode declarator; } *taggedUnionNode; extern /*@unused@*/ /*@only@*/ cstring taggedUnionNode_unparse (taggedUnionNode p_n) /*@*/ ; splint-3.1.2.dfsg1/src/Headers/lcllib.h0000644021234200000250000000061207630463447015233 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LCLLIB_H # define LCLLIB_H extern void dumpState (cstring p_cfname); extern void loadState (cstring p_cfname); extern bool loadStandardState (void); extern bool lcllib_isSkipHeader (cstring p_sname); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/termNode.h0000644021234200000250000000242407630463450015544 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ struct s_termNode { int wrapped; /* the number of matched parentheses around this term */ termKIND kind; sort sort; /*@reldef@*/ sort given; /* if term has a given sort */ sortSet possibleSorts; bool error_reported; /* to prevent multiple sort checking error messages */ lslOpSet possibleOps; /* only for TRM_ZEROARY and TRM_APPLICATION */ /* should make a union but skip this for now */ /*@null@*/ nameNode name; termNodeList args; /* in order */ /*@reldef@*/ ltoken literal; /* for TRM_LITERAL, TRM_UNCHANGEDALL, TRM_SIZEOF, LCLvariableKIND, TRM_CONST, TRM_ZEROARY */ /*@reldef@*/ storeRefNodeList unchanged; /* only for TRM_UNCHANGEDOTHERS */ /*@reldef@*/ quantifiedTermNode quantified; /* only for TRM_QUANTIFIER */ /*@reldef@*/ lclTypeSpecNode sizeofField; /* only for TRM_SIZEOF */ } ; extern /*@falsewhennull@*/ bool termNode_isDefined (/*@null@*/ termNode p_t) /*@*/ ; # define termNode_isDefined(t) ((t) != NULL) extern termNode termNode_copySafe (termNode p_t) /*@*/ ; extern cstring termNode_unparse (/*@null@*/ termNode p_n) /*@*/ ; extern void termNode_free (/*@only@*/ /*@null@*/ termNode p_t); splint-3.1.2.dfsg1/src/Headers/lclMisc.h0000644021234200000250000000022707650621410015346 0ustar fax# ifndef LCLMISC_H # define LCLMISC_H typedef unsigned int bits; typedef long unsigned Handle; extern bool firstWord (char *p_s, char *p_w); # endif splint-3.1.2.dfsg1/src/Headers/termNodeList.h0000644021234200000250000000524607630463450016405 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef termNodeLIST_H # define termNodeLIST_H typedef /*@only@*/ termNode o_termNode; struct s_termNodeList { int nelements; int nspacehigh; int nspacelow; int current; /*@dependent@*/ /*@reldef@*/ /*@relnull@*/ o_termNode *elements; /*@only@*/ /*@reldef@*/ /*@relnull@*/ o_termNode *elementsroot; } ; /*@iter termNodeList_elements (sef termNodeList x, yield exposed termNode el); @*/ # define termNodeList_elements(x, m_el) \ { int m_ind; termNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { termNode m_el = *(m_elements++); # define end_termNodeList_elements }} extern int termNodeList_size (/*@sef@*/ termNodeList); # define termNodeList_size(s) (termNodeList_isDefined (s) ? (s)->nelements : 0) extern bool termNodeList_empty (/*@sef@*/ termNodeList); # define termNodeList_empty(s) (termNodeList_size(s) == 0) extern /*@falsewhennull@*/ bool termNodeList_isDefined (termNodeList p_t); # define termNodeList_isDefined(s) ((s) != (termNodeList) 0) extern /*@only@*/ termNodeList termNodeList_new(void); extern termNodeList termNodeList_push (/*@returned@*/ termNodeList p_s, /*@keep@*/ termNode p_el) ; extern void termNodeList_addh (termNodeList p_s, /*@keep@*/ termNode p_el) ; extern void termNodeList_addl (termNodeList p_s, /*@keep@*/ termNode p_el) ; extern void termNodeList_reset (termNodeList p_s) /*@modifies p_s@*/ ; extern void termNodeList_finish (termNodeList p_s) /*@modifies p_s@*/ ; extern void termNodeList_advance (termNodeList p_s) /*@modifies p_s@*/ ; extern /*@exposed@*/ termNode termNodeList_getN (termNodeList p_s, int p_n) /*@*/ ; extern /*@only@*/ cstring termNodeList_unparse (termNodeList p_s) ; extern /*@only@*/ cstring termNodeList_unparseTail (termNodeList p_s); extern /*@only@*/ cstring termNodeList_unparseToCurrent (termNodeList p_s); extern /*@only@*/ cstring termNodeList_unparseSecondToCurrent (termNodeList p_s); extern void termNodeList_free (/*@only@*/ termNodeList p_s) ; extern /*@exposed@*/ termNode termNodeList_head (termNodeList p_s) ; extern /*@exposed@*/ termNode termNodeList_current (termNodeList p_s) ; extern /*@only@*/ termNodeList termNodeList_copy (termNodeList p_s) ; /*@constant int termNodeListGROWLOW;@*/ # define termNodeListGROWLOW 4 /* addl used in abstract.c */ /*@constant int termNodeListGROWHI;@*/ # define termNodeListGROWHI 4 /*@constant int termNodeListBASESIZE;@*/ # define termNodeListBASESIZE (termNodeListGROWLOW + termNodeListGROWHI) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lclPredicateNode.h0000644021234200000250000000061107630463447017172 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef enum { LPD_PLAIN, LPD_CHECKS, LPD_REQUIRES, LPD_ENSURES, LPD_INTRACLAIM, LPD_CONSTRAINT, LPD_INITIALLY } lclPredicateKind; struct s_lclPredicateNode { ltoken tok; /* for debugging */ lclPredicateKind kind; termNode predicate; } ; splint-3.1.2.dfsg1/src/Headers/tmpname.h0000644021234200000250000000010507121317327015416 0ustar faxextern cstring makeTempName (cstring dir, cstring pfx, cstring sfx); splint-3.1.2.dfsg1/src/Headers/lclscan.h0000644021234200000250000000146507630463447015420 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lclscan.h */ # ifndef LCLSCAN_H # define LCLSCAN_H extern ltokenCode yllex (void) /*@modifies internalState@*/ ; /*@-declundef@*/ extern bool g_inTypeDef; /*@=declundef@*/ extern /*@dependent@*/ /*@exposed@*/ ltoken LCLScanNextToken(void) /*@modifies internalState@*/ ; extern void LCLScanFreshToken(/*@only@*/ ltoken p_tok) /*@modifies internalState@*/ ; extern /*@exposed@*/ inputStream LCLScanSource(void) /*@*/ ; extern void LCLScanInit(void) /*@modifies internalState@*/ ; extern void LCLScanReset(inputStream p_s) /*@modifies internalState@*/ ; extern void LCLScanCleanup(void) /*@modifies internalState@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/tokentable.h0000644021234200000250000000135407630463450016120 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** tokentable.h */ extern /*@exposed@*/ ltoken LSLInsertToken(ltokenCode, lsymbol, lsymbol, bool) /*@modifies internalState@*/ ; extern void LSLUpdateToken(ltokenCode, lsymbol, bool) /*@modifies internalState@*/ ; extern /*@exposed@*/ ltoken LSLGetToken(lsymbol) /*@*/ ; extern /*@exposed@*/ ltoken LSLReserveToken(ltokenCode, char *) /*@modifies internalState@*/ ; extern void LSLSetTokenHasSyn (lsymbol p_sym, bool p_syn) /*@modifies internalState@*/ ; extern void ltokenTableInit(void) /*@modifies internalState@*/ ; extern void ltokenTableCleanup(void) /*@modifies internalState@*/ ; splint-3.1.2.dfsg1/src/Headers/lclscanline.h0000644021234200000250000000303507630463447016263 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** scanline.h ** ** The header files ** lsl.h ** string.h ** scan.h ** must be included prior to including ** scanline.h ** ** MODIFICATION HISTORY: ** ** X0.1-1 GAF 90.11.08 Created from LSL version ** X0.1-2 JPW 91.05.03 Add LSLReportCommentTokens. ** X0.1-3 JPW 91.06.26 Update copyright notice. ** 3.2 ymtan 92.11.14 conditionalize defn of types, needed for ** merging scanline.h and lclscanline.h ** Hence added SLASHCHAR (from LSL's scanline.h). ** 2.4 ymtan 93.03.16 -- adapted original for release 2.4 ** Version Who yy.mm.dd -- did what? */ # ifndef LCLSCANLINE_H # define LCLSCANLINE_H extern void LCLScanLine (char *p_line) /*@modifies internalState, p_line@*/ ; /*@exposed@*/ ltoken LCLScanEofToken (void) /*@*/ ; extern void LCLReportEolTokens (bool p_setting) /*@modifies internalState@*/ ; extern void LCLScanLineInit(void) /*@modifies internalState@*/ ; extern void LCLScanLineReset(void) /*@modifies internalState@*/ ; extern void LCLScanLineCleanup(void) /*@modifies internalState@*/ ; extern charCode LCLScanCharClass (char p_c) /*@*/ ; extern bool LCLIsEndComment(char p_c) /*@*/ ; extern void LCLSetCharClass (char p_c, charCode p_cod) /*@modifies internalState@*/ ; extern void LCLSetEndCommentChar(char p_c, bool p_flag) /*@modifies internalState@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/traitRefNode.h0000644021234200000250000000055107630463450016354 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ typedef struct { ltokenList traitid; /* a list of traitId ltoken's */ /*@null@*/ renamingNode rename; /* a list of renamings */ } *traitRefNode; extern void traitRefNode_free (/*@only@*/ /*@null@*/ traitRefNode p_x); splint-3.1.2.dfsg1/src/Headers/lclsyntable.h0000644021234200000250000000075507630463447016316 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lclsyntable.h */ # ifndef LCLSYNTABLE_H # define LCLSYNTABLE_H extern void LCLAddSyn(lsymbol, lsymbol); extern /*@exposed@*/ ltoken LCLGetTokenForSyn(lsymbol); extern bool LCLIsSyn(lsymbol); extern void LCLSynTableInit(void); extern void LCLSynTableReset(void); extern void LCLSynTableCleanup(void); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/traitRefNodeList.h0000644021234200000250000000226007630463450017207 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef traitRefNodeLIST_H # define traitRefNodeLIST_H typedef /*@only@*/ traitRefNode o_traitRefNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_traitRefNode *elements; } *traitRefNodeList ; /*@iter traitRefNodeList_elements (sef traitRefNodeList x, yield exposed traitRefNode el); @*/ # define traitRefNodeList_elements(x, m_el) \ { int m_ind; traitRefNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { traitRefNode m_el = *(m_elements++); # define end_traitRefNodeList_elements }} extern /*@only@*/ traitRefNodeList traitRefNodeList_new(void); extern traitRefNodeList traitRefNodeList_add (/*@returned@*/ traitRefNodeList p_s, /*@only@*/ traitRefNode p_el); extern /*@only@*/ cstring traitRefNodeList_unparse (traitRefNodeList p_s) ; extern void traitRefNodeList_free (/*@only@*/ traitRefNodeList p_s) ; /*@constant int traitRefNodeListBASESIZE;@*/ # define traitRefNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lcltokentable.h0000644021234200000250000000143307630463447016617 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lcltokentable.h */ # ifndef LCLTOKENTABLE_H # define LCLTOKENTABLE_H extern /*@exposed@*/ ltoken LCLInsertToken (ltokenCode, lsymbol, lsymbol, bool) /*@modifies internalState@*/ ; extern void LCLUpdateToken (ltokenCode, lsymbol, bool) /*@modifies internalState@*/ ; extern void LCLSetTokenHasSyn(lsymbol, bool) /*@modifies internalState@*/ ; extern /*@exposed@*/ ltoken LCLGetToken (lsymbol) /*@*/ ; extern /*@exposed@*/ ltoken LCLReserveToken (ltokenCode, char *) /*@modifies internalState@*/ ; extern void LCLTokenTableInit(void); extern void LCLTokenTableCleanup(void); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/transferChecks.h0000644021234200000250000000174707443751373016751 0ustar fax/* ** transferChecks.h */ extern bool transferChecks_globalDestroyed (sRef p_fref, fileloc p_loc) /*@modifies g_warningstream@*/ ; extern void transferChecks_localDestroyed (sRef p_fref, fileloc p_loc) /*@modifies g_warningstream@*/ ; extern void transferChecks_structDestroyed (sRef p_fref, fileloc p_loc) /*@modifies g_warningstream@*/ ; extern void transferChecks_assign (exprNode p_lhs, exprNode p_rhs); extern void transferChecks_initialization (exprNode p_lhs, exprNode p_rhs); extern void transferChecks_passParam (exprNode p_fexp, uentry p_arg, bool p_isSpec, /*@dependent@*/ exprNode p_fcn, int p_argno, int p_totargs); extern void transferChecks_return (exprNode p_fexp, uentry p_rval); extern void transferChecks_globalReturn (uentry p_glob); extern void transferChecks_paramReturn (uentry p_actual); extern void transferChecks_loseReference (uentry p_actual); extern bool transferChecks_canLoseReference (/*@dependent@*/ sRef p_sr, fileloc p_loc); splint-3.1.2.dfsg1/src/Headers/lclTypeSpecNode.h0000644021234200000250000000222207630463447017026 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef enum { LTS_TYPE, LTS_STRUCTUNION, LTS_ENUM, LTS_CONJ } lclTypeSpecKind; typedef lclTypeSpecNode lcltsp; typedef struct { lcltsp a; lcltsp b; } *lclconj; struct s_lclTypeSpecNode { lclTypeSpecKind kind; qualList quals; union { /*@null@*/ CTypesNode type; /*@null@*/ strOrUnionNode structorunion; /*@null@*/ enumSpecNode enumspec; lclconj conj; } content; pointers pointers; } ; /*@constant null lclTypeSpecNode lclTypeSpecNode_undefined; @*/ # define lclTypeSpecNode_undefined ((lclTypeSpecNode) 0) extern /*@falsewhennull@*/ bool lclTypeSpecNode_isDefined (lclTypeSpecNode p_x) /*@*/ ; # define lclTypeSpecNode_isDefined(x) ((x) != lclTypeSpecNode_undefined) extern /*@null@*/ /*@only@*/ lclTypeSpecNode lclTypeSpecNode_copy (/*@null@*/ lclTypeSpecNode p_n) /*@*/ ; extern /*@only@*/ cstring lclTypeSpecNode_unparse (/*@null@*/ lclTypeSpecNode p_n) /*@*/ ; extern /*@only@*/ cstring lclTypeSpecNode_unparseComments (/*@null@*/ lclTypeSpecNode p_typespec) /*@*/ ; splint-3.1.2.dfsg1/src/Headers/typeExpr.h0000644021234200000250000000221207630463450015602 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** typeExpr.h */ typedef enum { TEXPR_BASE, TEXPR_PTR, TEXPR_ARRAY, TEXPR_FCN } typeExprKind; struct s_typeExpr { int wrapped; /* number of balanced parentheses around this program node */ typeExprKind kind; /* different kinds of type constructors */ union { ltoken base; /*@null@*/ typeExpr pointer; struct { /*@null@*/ typeExpr elementtype; /*@null@*/ termNode size; } array; struct { /*@null@*/ typeExpr returntype; /* not really ... return-part maybe */ paramNodeList args; } function; } content; sort sort; } ; extern void typeExpr_free (/*@only@*/ /*@null@*/ typeExpr p_x); extern /*@only@*/ cstring typeExpr_unparse (/*@null@*/ typeExpr p_x); extern /*@only@*/ cstring typeExpr_unparseNoBase (/*@null@*/ typeExpr p_x); /* like a declaratorNode but without varId */ typedef typeExpr abstDeclaratorNode; extern void abstDeclaratorNode_free (/*@only@*/ /*@null@*/ abstDeclaratorNode p_x); # define abstDeclaratorNode_free(x) typeExpr_free(x); splint-3.1.2.dfsg1/src/Headers/lctype.h0000644021234200000250000003207607671022271015272 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lctype.h ** ** renamed from ctype.h to avoid confusion with standard ** header file */ # ifndef CTYPE_H # define CTYPE_H /* ** since this is the header file for the ctype module, we need ** to use an access comment to provide access to the representation. */ /* in forwardTypes: typedef int ctype; */ typedef enum { CT_UNKNOWN, CT_PRIM, CT_USER, CT_ABST, CT_NUMABST, CT_ENUM, CT_PTR, CT_ARRAY, CT_FIXEDARRAY, CT_FCN, CT_STRUCT, CT_UNION, CT_ENUMLIST, /* bogus type for keeping unnamed enums around */ CT_BOOL, /* since booleans aren't really prim's but we don't want them to be user or abst, they are a separate type */ CT_CONJ, /* conjunction */ CT_EXPFCN } ctuid ; /*@access ctype@*/ /* hack alert! */ /*@constant int CTK_ELIPS;@*/ # define CTK_ELIPS -23 /*@constant int CTK_MISSINGPARAMS;@*/ # define CTK_MISSINGPARAMS -37 /*@constant int CT_FIRST;@*/ # define CT_FIRST 0 /*@constant int CTK_PREDEFINED;@*/ # define CTK_PREDEFINED (CTX_LAST + 1) /*@constant int CTK_PREDEFINED2;@*/ # define CTK_PREDEFINED2 (CTK_PREDEFINED + CTK_PREDEFINED) /*@constant int LAST_PREDEFINED;@*/ # define LAST_PREDEFINED (CTK_PREDEFINED + CTK_PREDEFINED2) /*@constant int CTP_VOID;@*/ # define CTP_VOID (CTX_VOID + CTK_PREDEFINED) /*@constant int CTP_CHAR;@*/ # define CTP_CHAR (CTX_CHAR + CTK_PREDEFINED) /*@constant int CTK_BASESIZE;@*/ # define CTK_BASESIZE BIGBASESIZE typedef enum { CTK_UNKNOWN = -3, CTK_INVALID = -2, CTK_DNE = -1, CTK_PLAIN = 0, /* these must be in order */ CTK_PTR = 1, CTK_ARRAY = 2, CTK_COMPLEX = 3 } ctkind ; extern int ctkind_toInt (ctkind p_x); # define ctkind_toInt(x) ((int)(x)) /* ** ctypes are integer indexes into ctype table ** ** the most common ctypes are hard wired (see cprim.h) */ /*@constant ctype ctype_undefined; @*/ # define ctype_undefined ((ctype) CTK_INVALID) /*@constant ctype ctype_dne; @*/ # define ctype_dne ((ctype) CTK_DNE) /*@constant ctype ctype_unknown; @*/ # define ctype_unknown CTX_UNKNOWN /*@constant ctype ctype_void; @*/ # define ctype_void CTX_VOID /*@constant ctype ctype_char; @*/ # define ctype_char CTX_CHAR /*@constant ctype ctype_uchar; @*/ # define ctype_uchar CTX_UCHAR /*@constant ctype ctype_double; @*/ # define ctype_double CTX_DOUBLE /*@constant ctype ctype_ldouble; @*/ # define ctype_ldouble CTX_LDOUBLE /*@constant ctype ctype_float; @*/ # define ctype_float CTX_FLOAT /*@constant ctype ctype_int; @*/ # define ctype_int CTX_INT /*@constant ctype ctype_uint; @*/ # define ctype_uint CTX_UINT /*@constant ctype ctype_sint; @*/ # define ctype_sint CTX_SINT /*@constant ctype ctype_lint; @*/ # define ctype_lint CTX_LINT /*@constant ctype ctype_usint; @*/ # define ctype_usint CTX_USINT /*@constant ctype ctype_ulint; @*/ # define ctype_ulint CTX_ULINT /*@constant ctype ctype_llint; @*/ # define ctype_llint CTX_LLINT /*@constant ctype ctype_ullint; @*/ # define ctype_ullint CTX_ULLINT /*@constant ctype ctype_bool; @*/ # define ctype_bool CTX_BOOL /*@constant ctype ctype_string; @*/ # define ctype_string CTP_CHAR /*@constant ctype ctype_anyintegral @*/ # define ctype_anyintegral CTX_ANYINTEGRAL /*@constant ctype ctype_unsignedintegral @*/ # define ctype_unsignedintegral CTX_UNSIGNEDINTEGRAL /*@constant ctype ctype_signedintegral @*/ # define ctype_signedintegral CTX_SIGNEDINTEGRAL /*@constant ctype ctype_voidPointer; @*/ # define ctype_voidPointer CTP_VOID extern ctype ctype_forceRealType (ctype p_c); extern bool ctype_forceMatch (ctype p_c1, ctype p_c2); extern bool ctype_genMatch (ctype p_c1, ctype p_c2, bool p_force, bool p_arg, bool p_def, bool p_deep); extern bool ctype_isSimple (ctype p_c) /*@*/ ; extern bool ctype_isAbstract (ctype p_c) /*@*/ ; extern bool ctype_isNumAbstract (ctype p_c) /*@*/ ; extern bool ctype_isArray (ctype p_c) /*@*/ ; extern bool ctype_isFixedArray (ctype p_c) /*@*/ ; extern bool ctype_isIncompleteArray (ctype p_c) /*@*/ ; extern bool ctype_isArrayPtr (ctype p_c) /*@*/ ; extern bool ctype_isBool (ctype p_c) /*@*/ ; /* matches type bool */ extern bool ctype_isManifestBool (ctype p_c) /*@*/ ; /* declared as type bool */ extern bool ctype_isChar (ctype p_c) /*@*/ ; extern bool ctype_isUnsignedChar (ctype p_c) /*@*/ ; extern bool ctype_isSignedChar (ctype p_c) /*@*/ ; extern bool ctype_isString (ctype p_c) /*@*/ ; extern bool ctype_isConj (ctype p_c) /*@*/ ; extern bool ctype_isDirectBool (ctype p_c) /*@*/ ; extern bool ctype_isDirectInt(ctype p_c) /*@*/ ; extern bool ctype_isEnum(ctype p_c) /*@*/ ; extern bool ctype_isExpFcn (ctype p_c) /*@*/ ; extern bool ctype_isFirstVoid (ctype p_c) /*@*/ ; extern bool ctype_isForceRealBool (ctype *p_c) /*@*/ ; extern bool ctype_isForceRealInt (ctype *p_c) /*@*/ ; extern bool ctype_isForceRealNumeric (ctype *p_c) /*@*/ ; extern bool ctype_isFunction (ctype p_c) /*@*/ ; extern bool ctype_isArbitraryIntegral (ctype p_c) /*@*/ ; extern bool ctype_isUnsignedIntegral (ctype p_c) /*@*/ ; extern bool ctype_isSignedIntegral (ctype p_c) /*@*/ ; extern bool ctype_isInt (ctype p_c) /*@*/ ; extern bool ctype_isRegularInt (ctype p_c) /*@*/ ; extern bool ctype_isMutable (ctype p_t) /*@*/ ; extern bool ctype_isImmutableAbstract (ctype p_t) /*@*/ ; extern bool ctype_isNumeric (ctype p_c) /*@*/ ; extern bool ctype_isPointer (ctype p_c) /*@*/ ; extern bool ctype_isReal (ctype p_c) /*@*/ ; extern /*@unused@*/ bool ctype_isFloat (ctype p_c) /*@*/ ; extern bool ctype_isDouble (ctype p_c) /*@*/ ; extern bool ctype_isSigned (ctype p_c) /*@*/ ; extern bool ctype_isUnsigned (ctype p_c) /*@*/ ; extern bool ctype_isRealAP (ctype p_c) /*@*/ ; extern bool ctype_isRealAbstract(ctype p_c) /*@*/ ; extern bool ctype_isRealNumAbstract(ctype p_c) /*@*/ ; extern bool ctype_isRealArray (ctype p_c) /*@*/ ; extern bool ctype_isRealBool (ctype p_c) /*@*/ ; extern bool ctype_isRealFunction (ctype p_c) /*@*/ ; extern bool ctype_isRealInt (ctype p_c) /*@*/ ; extern bool ctype_isRealNumeric (ctype p_c) /*@*/ ; extern bool ctype_isRealPointer (ctype p_c) /*@*/ ; extern bool ctype_isRealSU (ctype p_c) /*@*/ ; extern bool ctype_isRealVoid (ctype p_c) /*@*/ ; extern bool ctype_isStruct (ctype p_c) /*@*/ ; extern bool ctype_isStructorUnion(ctype p_c) /*@*/ ; extern bool ctype_isUA (ctype p_c) /*@*/ ; extern bool ctype_isUnion (ctype p_c) /*@*/ ; extern bool ctype_isVoid (ctype p_c) /*@*/ ; extern bool ctype_isVoidPointer (ctype p_c) /*@*/ ; extern bool ctype_isVisiblySharable (ctype p_t) /*@*/ ; extern bool ctype_match (ctype p_c1, ctype p_c2) /*@*/ ; extern bool ctype_matchArg (ctype p_c1, ctype p_c2) /*@*/ ; extern bool ctype_sameName (ctype p_c1, ctype p_c2) /*@*/ ; extern /*@only@*/ cstring ctype_dump (ctype p_c) /*@*/ ; extern /*@observer@*/ cstring ctype_enumTag (ctype p_c) /*@*/ ; extern /*@observer@*/ cstring ctype_unparse (ctype p_c) /*@*/ ; extern /*@observer@*/ cstring ctype_unparseDeep (ctype p_c) /*@*/ ; extern /*@unused@*/ /*@observer@*/ cstring ctype_unparseSafe (ctype p_c) /*@*/ ; extern ctkind ctkind_fromInt (int p_i) /*@*/ ; extern bool ctype_matchDef (ctype p_c1, ctype p_c2) /*@*/ ; extern ctype ctype_undump (char **p_c); extern ctype ctype_adjustPointers (pointers p_p, ctype p_c); extern ctype ctype_baseArrayPtr (ctype p_c) /*@*/ ; extern ctype ctype_combine (ctype p_dominant, ctype p_modifier) ; extern ctype ctype_createAbstract (typeId p_u) /*@*/ ; extern ctype ctype_createNumAbstract (typeId p_u) /*@*/ ; extern ctype ctype_createForwardStruct (/*@only@*/ cstring p_n) /*@*/ ; extern ctype ctype_createForwardUnion (/*@only@*/ cstring p_n) /*@*/ ; extern ctype ctype_createForwardEnum (/*@only@*/ cstring p_n) /*@*/ ; extern ctype ctype_createStruct (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f); extern ctype ctype_createUnion (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f); extern ctype ctype_createEnum (/*@keep@*/ cstring p_tag, /*@keep@*/ enumNameList p_el); extern ctype ctype_createUnnamedStruct (/*@only@*/ uentryList p_f) ; extern ctype ctype_createUnnamedUnion (/*@only@*/ uentryList p_f) ; extern ctype ctype_createUser (typeId p_u) ; extern bool ctype_isUnnamedSU (ctype p_c) /*@*/ ; extern bool ctype_isUser (ctype p_c) /*@*/ ; extern int ctype_getSize (ctype p_c) /* EFFECTS: Returns the expected size of type p_c. Various flags to control? ** Returns -1 if the size is unknown (or should not be guessed). */ /*@*/ ; extern ctype ctype_biggerType (ctype p_c1, ctype p_c2) /* EFFECTS: returns whichever of c1 or c2 is bigger (storage requirements). If they are equal, returns c1. */ /*@*/ ; extern ctype ctype_expectFunction(ctype p_c) ; extern ctype ctype_dontExpectFunction (ctype p_c) ; extern ctype ctype_fixArrayPtr (ctype p_c); extern ctype ctype_getBaseType (ctype p_c) /*@*/ ; extern ctype ctype_makeAnytype (void) /*@*/ ; extern bool ctype_isAnytype (ctype) /*@*/ ; extern ctype ctype_makeArray (ctype p_c); extern ctype ctype_makeFixedArray (ctype p_c, size_t p_size); extern ctype ctype_makeInnerFixedArray (ctype p_c, size_t p_size); extern ctype ctype_makeInnerArray (ctype p_c); extern ctype ctype_makeConj (ctype p_c1, ctype p_c2) /*@modifies internalState@*/ ; extern ctype ctype_makeParamsFunction (ctype p_base, /*@only@*/ uentryList p_p); extern ctype ctype_makeFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ; extern ctype ctype_makeNFParamsFunction (ctype p_base, /*@only@*/ uentryList p_p) /*@*/ ; extern ctype ctype_makePointer (ctype p_c); extern ctype ctype_makeRawFunction (ctype p_base, /*@only@*/ uentryList p_p); extern ctype ctype_makeWideString (void) /*@modifies internalState@*/ ; extern bool ctype_isWideString (ctype p_c) /*@*/ ; extern ctype ctype_newBase (ctype p_c, ctype p_p) /*@*/ ; extern ctype ctype_realType (ctype p_c) /*@*/ ; extern ctype ctype_realishType (ctype p_c) /*@*/ ; extern ctype ctype_removePointers (ctype p_c) /*@*/ ; extern ctype ctype_resolve (ctype p_c) /*@*/ ; extern ctype ctype_resolveNumerics (ctype p_c1, ctype p_c2) /*@*/ ; extern ctype ctype_getReturnType (ctype p_c) /*@*/ ; extern bool ctype_isRefCounted (ctype p_t) /*@*/ ; extern /*@observer@*/ uentryList ctype_argsFunction (ctype p_c) /*@*/ ; extern /*@observer@*/ uentryList ctype_getParams (ctype p_c) /*@*/ ; # define ctype_getParams(c) ctype_argsFunction(c) extern /*@observer@*/ enumNameList ctype_elist (ctype p_c) /*@*/ ; extern /*@observer@*/ uentryList ctype_getFields (ctype p_c) /*@*/ ; /* ** could do some run-time checks... */ extern cprim ctype_toCprim (ctype p_c) /*@*/ ; /*@access cprim@*/ # define ctype_toCprim(c) ((cprim) (c)) /*@noaccess cprim@*/ extern int ctype_compare (ctype p_c1, ctype p_c2) /*@*/ ; extern /*@unused@*/ int ctype_count (void); extern ctype ctype_makeExplicitConj (ctype p_c1, ctype p_c2); extern typeId ctype_typeId (ctype p_c); extern ctype ctype_fromQual (qual p_q); extern bool ctype_isAnyFloat (ctype p_c); extern bool ctype_isStackAllocated (ctype p_c); /*@constant ctype ctype_missingParamsMarker; @*/ # define ctype_missingParamsMarker ((ctype)CTK_MISSINGPARAMS) extern bool ctype_isMissingParamsMarker (ctype p_ct) /*@*/ ; # define ctype_isMissingParamsMarker(ct) ((ct) == ctype_missingParamsMarker) extern bool ctype_equal (ctype p_c1, ctype p_c2); # define ctype_equal(c1,c2) ((c1) == (c2)) extern bool ctype_almostEqual (ctype p_c1, ctype p_c2); /*@constant ctype ctype_elipsMarker; @*/ # define ctype_elipsMarker ((ctype) CTK_ELIPS) extern bool ctype_isElips (ctype p_ct) /*@*/; # define ctype_isElips(ct) ((ct) == ctype_elipsMarker) extern bool ctype_isAP (ctype p_c) /*@*/ ; # define ctype_isAP(c) ctype_isArrayPtr(c) extern bool ctype_isDefined (ctype p_c) /*@*/ ; # define ctype_isDefined(c) ((c) != ctype_undefined) extern bool ctype_isKnown (ctype p_c) /*@*/ ; # define ctype_isKnown(c) ((c) != CTX_UNKNOWN) extern bool ctype_isSU (ctype p_c) /*@*/ ; # define ctype_isSU(c) ctype_isStructorUnion(c) extern bool ctype_isUndefined (ctype p_c) /*@*/ ; # define ctype_isUndefined(c) ((c) == ctype_undefined) extern bool ctype_isUnknown (ctype p_c) /*@*/; # define ctype_isUnknown(c) ((c) == CTX_UNKNOWN) extern bool ctype_isBogus (/*@sef@*/ ctype p_c) /*@*/ ; # define ctype_isBogus(c) (ctype_isUndefined(c) || ctype_isUnknown(c)) extern cstring ctype_unparseDeclaration (ctype p_c, /*@only@*/ cstring p_name); extern bool ctype_sameAltTypes (ctype p_c1, ctype p_c2) /*@*/ ; extern void ctype_dumpTable (FILE *p_f); extern void ctype_loadTable (FILE *p_f); extern void ctype_destroyMod (void); extern void ctype_initTable (void); extern /*@only@*/ cstring ctype_unparseTable (void); extern /*@unused@*/ void ctype_printTable (void); extern ctype ctype_widest (ctype, ctype) /*@*/ ; /* drl modified */ extern size_t ctype_getArraySize (ctype p_c); /*end drl add functions */ /* Should only be used in uentry.c */ extern bool ctype_isUserBool (ctype p_ct) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/typeIdSet.h0000644021234200000250000000340207630463450015676 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** typeIdSet.h ** ** based on set_template.h */ # ifndef typeIdSET_H # define typeIdSET_H /* in forwardTypes.h: immut_typedef int typeIdSet; */ extern typeIdSet typeIdSet_emptySet (void) /*@modifies internalState@*/ ; extern bool typeIdSet_member (typeIdSet p_t, typeId p_el) /*@*/ ; extern bool typeIdSet_isEmpty (/*@sef@*/ typeIdSet p_t) /*@*/ ; extern typeIdSet typeIdSet_single (typeId p_t) /*@modifies internalState@*/ ; extern typeIdSet typeIdSet_singleOpt (typeId p_t) /*@modifies internalState@*/ ; extern typeIdSet typeIdSet_insert (typeIdSet p_t, typeId p_el) /*@modifies internalState@*/ ; extern typeIdSet typeIdSet_removeFresh (typeIdSet p_t, typeId p_el) /*@modifies internalState@*/ ; extern cstring typeIdSet_unparse (typeIdSet p_t) /*@*/ ; extern typeIdSet typeIdSet_subtract (typeIdSet p_s, typeIdSet p_t) /*@modifies internalState*/ ; extern int typeIdSet_compare (typeIdSet p_t1, typeIdSet p_t2); extern cstring typeIdSet_dump (typeIdSet p_t); extern typeIdSet typeIdSet_undump (char **p_s) /*@modifies internalState, *p_s@*/ ; extern typeIdSet typeIdSet_union (typeIdSet p_t1, typeIdSet p_t2) /*@*/ ; extern void typeIdSet_initMod (void) /*@modifies internalState@*/ ; extern void typeIdSet_destroyMod (void) /*@modifies internalState@*/ ; extern void typeIdSet_dumpTable (FILE *p_fout) /*@modifies *p_fout@*/ ; extern void typeIdSet_loadTable (FILE *p_fin) /*@modifies *p_fin, internalState@*/ ; /*@constant typeIdSet typeIdSet_undefined;@*/ # define typeIdSet_undefined 0 /*@constant typeIdSet typeIdSet_empty;@*/ # define typeIdSet_empty 0 # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/letDeclNode.h0000644021234200000250000000051307630463447016154 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { ltoken varid; /*@null@*/ lclTypeSpecNode sortspec; termNode term; sort sort; } *letDeclNode; extern void letDeclNode_free (/*@only@*/ /*@null@*/ letDeclNode p_x); splint-3.1.2.dfsg1/src/Headers/typeNameNode.h0000644021234200000250000000063507630463450016361 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ typedef struct { bool isTypeName; /*@null@*/ typeNamePack typename; /*@null@*/ opFormNode opform; } *typeNameNode; extern void typeNameNode_free (/*@only@*/ /*@null@*/ typeNameNode p_n); extern /*@only@*/ cstring typeNameNode_unparse (/*@null@*/ typeNameNode p_n); splint-3.1.2.dfsg1/src/Headers/letDeclNodeList.h0000644021234200000250000000223107630463447017007 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LETDECLNODELIST_H # define LETDECLNODELIST_H typedef /*@only@*/ letDeclNode o_letDeclNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_letDeclNode *elements; } *letDeclNodeList ; /*@iter letDeclNodeList_elements (sef letDeclNodeList x, yield exposed letDeclNode el); @*/ # define letDeclNodeList_elements(x, m_el) \ { int m_ind; letDeclNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { letDeclNode m_el = *(m_elements++); # define end_letDeclNodeList_elements }} extern /*@only@*/ letDeclNodeList letDeclNodeList_new(void); extern letDeclNodeList letDeclNodeList_add (/*@returned@*/ letDeclNodeList p_s, /*@only@*/ letDeclNode p_el); extern /*@only@*/ cstring letDeclNodeList_unparse (letDeclNodeList p_s) ; extern void letDeclNodeList_free (/*@only@*/ letDeclNodeList p_s) ; /*@constant int letDeclNodeListBASESIZE;@*/ # define letDeclNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/typeNameNodeList.h0000644021234200000250000000263007630463450017212 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef TYPENAMENODELIST_H # define TYPENAMENODELIST_H typedef /*@only@*/ typeNameNode o_typeNameNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_typeNameNode *elements; } *typeNameNodeList ; /*@iter typeNameNodeList_elements (sef typeNameNodeList x, yield exposed typeNameNode el); @*/ # define typeNameNodeList_elements(x, m_el) \ { int m_ind; typeNameNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { typeNameNode m_el = *(m_elements++); # define end_typeNameNodeList_elements }} extern int typeNameNodeList_size (typeNameNodeList); # define typeNameNodeList_size(s) ((s)->nelements) extern bool typeNameNodeList_empty (typeNameNodeList); # define typeNameNodeList_empty(s) (typeNameNodeList_size(s) == 0) extern /*@only@*/ typeNameNodeList typeNameNodeList_new(void); extern typeNameNodeList typeNameNodeList_add (/*@returned@*/ typeNameNodeList p_s, /*@only@*/ typeNameNode p_el) ; extern /*@only@*/ cstring typeNameNodeList_unparse (typeNameNodeList p_s) ; extern void typeNameNodeList_free (/*@only@*/ typeNameNodeList p_s) ; /*@constant int typeNameNodeListBASESIZE;@*/ # define typeNameNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lh.h0000644021234200000250000000162207630463447014377 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lh.h */ extern void lhCleanup (void) /*@modifies internalState, fileSystem@*/ ; extern void lhIncludeBool (void) /*@modifies internalState@*/ ; extern void lhInit (inputStream p_f) /*@modifies internalState@*/ ; extern void lhOutLine (/*@only@*/ cstring p_s) /*@modifies internalState@*/ ; extern void lhExternals (interfaceNodeList p_x) /*@modifies internalState@*/ ; extern cstring lhVarDecl (lclTypeSpecNode p_lclTypeSpec, initDeclNodeList p_initDecls, qualifierKind p_qualifier); extern cstring lhType (typeNode) ; extern cstring lhFunction (lclTypeSpecNode p_lclTypeSpec, declaratorNode p_declarator); extern void lhForwardStruct (ltoken p_t) /*@modifies internalState@*/ ; extern void lhForwardUnion (ltoken p_t) /*@modifies internalState@*/ ; splint-3.1.2.dfsg1/src/Headers/typeNamePack.h0000644021234200000250000000035707630463450016353 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ typedef struct { bool isObj; lclTypeSpecNode type; abstDeclaratorNode abst; } *typeNamePack; splint-3.1.2.dfsg1/src/Headers/limwr.h0000644021234200000250000000075507630463447015134 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct limwr_t { int (*puts) (/* struct limwr_t *self, char *s, int slen */); unsigned (*tell) (/* struct limwr_t *self */); int (*seek) (/* struct limwr_t *self, unsigned n */); void (*close) (/* struct limwr_t *self */); } *limwr_t; mail() { liwmr_t y; int i; i = (y->puts)(); i = (y->close)(); splint-3.1.2.dfsg1/src/Headers/typeNode.h0000644021234200000250000000073107630463450015555 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef TYPENODE_H # define TYPENODE_H typedef struct { typeKind kind; union { abstractNode abstract; exposedNode exposed; taggedUnionNode taggedunion; } content; } *typeNode; extern /*@unused@*/ /*@only@*/ cstring typeNode_unparse (/*@null@*/ typeNode p_t) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/uentry.h0000644021234200000250000006060207646432517015326 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef UENTRY_H # define UENTRY_H # define CENTRY_H /* ** universal symbol table entry ** (combines old llentry, centry, and ttentry) */ /* ** vkind --- need to fix value for consistency in dump files */ typedef struct { typeIdSet access; bool macro; } *ucinfo; typedef enum { VKSPEC = 0, VKNORMAL, VKPARAM, VKYIELDPARAM, VKREFYIELDPARAM, VKRETPARAM, VKREFPARAM, VKSEFPARAM, VKREFSEFPARAM, VKSEFRETPARAM, VKREFSEFRETPARAM, VKEXPMACRO } vkind; /*@constant vkind VKFIRST;@*/ # define VKFIRST VKSPEC /*@constant vkind VKLAST;@*/ # define VKLAST VKEXPMACRO typedef enum { CH_UNKNOWN, CH_UNCHECKED, CH_CHECKED, CH_CHECKMOD, CH_CHECKEDSTRICT } chkind; /* start modifications */ typedef enum { BB_POSSIBLYNULLTERMINATED, /* buffer is possibly nullterm(can't decide statically) */ BB_NULLTERMINATED, /*buffer is known to be nullterminated */ BB_NOTNULLTERMINATED /* buffer is known to be not nullterm */ } bbufstate; typedef /*@null@*/ struct s_bbufinfo { bbufstate bufstate; /* state of the buffer */ int size; /* size of the buffer allocated */ int len; /* len of the buffer VALID ONLY IF state is NULLTERM */ } *bbufinfo ; typedef struct { vkind kind; /* kind (parameter, specified) */ chkind checked; /* how is it checked */ sstate defstate; nstate nullstate; bbufinfo bufinfo; /* is valid only if the entry is a variable and (a pointer or array) */ } *uvinfo ; /* end modifications */ typedef struct { qual abs; /* oneof QU_UNKNOWN, QU_ABSTRACT, QU_NUMABSTRACT, QU_CONCRETE */ ynm mut; ctype type; } *udinfo ; /* information for specified functions */ typedef enum { SPC_NONE, SPC_PRINTFLIKE, SPC_SCANFLIKE, SPC_MESSAGELIKE, SPC_LAST } specCode; typedef struct { qual nullPred; specCode specialCode; exitkind exitCode; typeIdSet access; /* access types */ /*@owned@*/ globSet globs; /* globals list */ /*@owned@*/ sRefSet mods; /* modifies */ stateClauseList specclauses; /*@dependent@*/ uentryList defparams; bool hasGlobs BOOLBITS; bool hasMods BOOLBITS; functionConstraint preconditions; functionConstraint postconditions; } *ufinfo ; typedef struct { typeIdSet access; /*@owned@*/ globSet globs; /* globals list */ /*@owned@*/ sRefSet mods; /* modifies */ } *uiinfo ; typedef struct { typeIdSet access; } *ueinfo ; typedef union { ucinfo uconst; uvinfo var; udinfo datatype; ufinfo fcn; uiinfo iter; ueinfo enditer; } *uinfo ; struct s_uentry { ekind ukind; cstring uname; ctype utype; fileloc whereSpecified; fileloc whereDefined; fileloc whereDeclared; /* meaning of sref is different for: ** variables current state ** functions state of return value ** types state of datatype */ /*@exposed@*/ /*@null@*/ sRef sref; warnClause warn; /* Location list is complete only if showalluses is set. */ filelocList uses; bool used BOOLBITS; bool lset BOOLBITS; /* set in local table */ bool isPrivate BOOLBITS; /* specification only */ bool hasNameError BOOLBITS; storageClassCode storageclass; /*@relnull@*/ uinfo info; /* null for KELIPSMARKER, KINVALID */ } ; /* ** There is no uentry_isDefined to avoid confusion with ** uentry_isCodeDefined (which was previously called ** uentry_isDefined). */ extern /*@nullwhentrue@*/ bool uentry_isUndefined (/*@special@*/ uentry p_e) /*@*/ ; extern /*@nullwhentrue@*/ bool uentry_isInvalid (/*@special@*/ uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isValid (/*@special@*/ uentry p_e) /*@*/ ; /*@constant null uentry uentry_undefined; @*/ # define uentry_undefined ((uentry) NULL) # define uentry_isUndefined(e) ((e) == uentry_undefined) # define uentry_isValid(e) ((e) != uentry_undefined) # define uentry_isInvalid(e) ((e) == uentry_undefined) extern int uentry_compareStrict (uentry p_v1, uentry p_v2); /*@constant int PARAMUNKNOWN; @*/ # define PARAMUNKNOWN -1 extern bool uentry_isMaybeAbstract (uentry p_e) /*@*/ ; extern void uentry_setAbstract (uentry p_e) /*@modifies p_e@*/ ; extern void uentry_setConcrete (uentry p_e) /*@modifies p_e@*/ ; extern void uentry_setHasNameError (uentry p_ue) /*@modifies p_ue@*/ ; extern /*@falsewhennull@*/ bool uentry_isLset (/*@sef@*/ uentry p_e); # define uentry_isLset(e) \ (uentry_isValid(e) && (e)->lset) extern /*@falsewhennull@*/ bool uentry_isUsed (/*@sef@*/ uentry p_e); # define uentry_isUsed(e) (uentry_isValid(e) && (e)->used) extern /*@unused@*/ /*@falsewhennull@*/ bool uentry_isAbstractType (uentry p_e) /*@*/ ; # define uentry_isAbstractType(e) (uentry_isAbstractDatatype(e)) extern /*@falsewhennull@*/ bool uentry_isConstant (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isConstant(e) \ (uentry_isValid(e) && ekind_isConst ((e)->ukind)) extern /*@falsewhennull@*/ bool uentry_isEitherConstant (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isEitherConstant(e) \ (uentry_isValid(e) && (ekind_isConst ((e)->ukind) || ekind_isEnumConst ((e)->ukind))) extern /*@falsewhennull@*/ bool uentry_isEnumConstant (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isEnumConstant(e) \ (uentry_isValid(e) && ekind_isEnumConst ((e)->ukind)) extern /*@falsewhennull@*/ bool uentry_isExternal (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isExternal(c) \ (uentry_isValid(c) && fileloc_isExternal (uentry_whereDefined (c))) extern /*@falsewhennull@*/ bool uentry_isExtern (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isExtern(c) \ (uentry_isValid(c) && (c)->storageclass == SCEXTERN) extern bool uentry_isForward (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isFunction (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isFunction(e) \ (uentry_isValid(e) && ekind_isFunction ((e)->ukind)) extern /*@falsewhennull@*/ bool uentry_isPriv (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isPriv(e) \ (uentry_isValid(e) && (e)->isPrivate) extern /*@falsewhennull@*/ bool uentry_isFileStatic (uentry p_ue) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isExported (uentry p_ue) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isStatic (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_isStatic(c) \ (uentry_isValid(c) && (c)->storageclass == SCSTATIC) extern void uentry_setLset (/*@sef@*/ uentry p_e); # define uentry_setLset(e) \ (uentry_isValid(e) ? (e)->lset = TRUE : TRUE) extern bool uentry_isSpecialFunction (uentry p_ue) /*@*/ ; extern bool uentry_isMessageLike (uentry p_ue) /*@*/ ; extern bool uentry_isScanfLike (uentry p_ue) /*@*/ ; extern bool uentry_isPrintfLike (uentry p_ue) /*@*/ ; extern void uentry_setMessageLike (uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_setScanfLike (uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_setPrintfLike (uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_checkName (uentry p_ue) /*@modifies g_warningstream, p_ue@*/ ; extern bool uentry_sameObject (uentry p_e1, uentry p_e2); # define uentry_sameObject(e1,e2) ((e1) == (e2)) extern void uentry_addAccessType (uentry p_ue, typeId p_tid) /*@modifies p_ue@*/ ; extern void uentry_showWhereAny (uentry p_spec) /*@modifies g_warningstream@*/ ; extern void uentry_checkParams (uentry p_ue); extern void uentry_mergeUses (uentry p_res, uentry p_other); extern void uentry_setExtern (uentry p_c); extern void uentry_setUsed (uentry p_e, fileloc p_loc); extern void uentry_setDefState (uentry p_ue, sstate p_defstate); extern void uentry_setNotUsed (/*@sef@*/ uentry p_e); # define uentry_setNotUsed(e) \ (uentry_isValid (e) ? (e)->used = FALSE : FALSE) extern bool uentry_wasUsed (/*@sef@*/ uentry p_e); # define uentry_wasUsed(e) \ (uentry_isValid (e) ? (e)->used : TRUE) extern void uentry_mergeConstantValue (uentry p_ue, /*@only@*/ multiVal p_m); extern /*@observer@*/ fileloc uentry_whereEarliest (uentry p_e) /*@*/ ; extern /*@observer@*/ cstring uentry_rawName (uentry p_e) /*@*/ ; extern /*@observer@*/ fileloc uentry_whereDeclared (uentry p_e) /*@*/ ; extern bool uentry_equiv (uentry p_p1, uentry p_p2) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_hasName (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_hasRealName (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isAbstractDatatype (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isAnyTag (/*@special@*/ uentry p_ue) /*@uses p_ue->ukind@*/ /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isDatatype (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isCodeDefined (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isDeclared (/*@special@*/ uentry p_e) /*@uses p_e->whereDeclared@*/ /*@*/ ; extern /*@observer@*/ cstring uentry_ekindName (uentry p_ue) /*@*/ ; extern /*@observer@*/ cstring uentry_ekindNameLC (uentry p_ue) /*@*/ ; extern void uentry_showWhereDefined (uentry p_spec); extern /*@falsewhennull@*/ bool uentry_isEndIter (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isEnumTag (/*@special@*/ uentry p_ue) /*@uses p_ue->ukind@*/ /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isFakeTag (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isIter (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isMutableDatatype (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isParam (uentry p_u) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isExpandedMacro (uentry p_u) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isSefParam (uentry p_u) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isAnyParam (/*@special@*/ uentry p_u) /*@uses p_u->ukind, p_u->info@*/ /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isRealFunction (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isSpecified (uentry p_e) /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isStructTag (/*@special@*/ uentry p_ue) /*@uses p_ue->ukind@*/ /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isUnionTag (/*@special@*/ uentry p_ue) /*@uses p_ue->ukind@*/ /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isVar (/*@special@*/ uentry p_e) /*@uses p_e->ukind@*/ /*@*/ ; extern /*@falsewhennull@*/ bool uentry_isVariable (/*@special@*/ uentry p_e) /*@uses p_e->ukind@*/ /*@*/ ; extern cstring uentry_dump (uentry p_v) ; extern cstring uentry_dumpParam (uentry p_v); extern /*@observer@*/ cstring uentry_observeRealName (uentry p_e) /*@*/ ; extern cstring uentry_getName (/*@special@*/ uentry p_e) /*@uses p_e->ukind, p_e->info, p_e->uname@*/ /*@*/ ; extern cstring uentry_unparse (uentry p_v) /*@*/ ; extern cstring uentry_unparseAbbrev (uentry p_v) /*@*/ ; extern cstring uentry_unparseFull (uentry p_v) /*@*/ ; extern void uentry_setMutable (uentry p_e) /*@modifies p_e@*/ ; extern ctype uentry_getAbstractType (uentry p_e) /*@*/ ; extern ctype uentry_getRealType (uentry p_e) /*@globals internalState@*/ ; extern ctype uentry_getType (uentry p_e) /*@*/ ; extern ekind uentry_getKind (uentry p_e) /*@*/ ; extern /*@observer@*/ fileloc uentry_whereDefined (uentry p_e) /*@*/ ; extern /*@observer@*/ fileloc uentry_whereSpecified (uentry p_e) /*@*/ ; extern int uentry_compare (uentry p_u1, uentry p_u2); extern /*@exposed@*/ sRef uentry_getSref (/*@temp@*/ uentry p_e) /*@*/ ; extern /*@observer@*/ sRefSet uentry_getMods (uentry p_l) /*@*/ ; extern typeIdSet uentry_accessType (uentry p_e) /*@*/ ; extern /*@observer@*/ fileloc uentry_whereEither (uentry p_e) /*@*/ ; extern /*@exposed@*/ uentry uentry_makeUnrecognized (cstring p_c, /*@only@*/ fileloc p_loc); extern /*@notnull@*/ uentry uentry_makeExpandedMacro (cstring p_s, /*@temp@*/ fileloc p_f) /*@*/ ; extern void uentry_checkMatchParam (uentry p_u1, uentry p_u2, int p_paramno, exprNode p_e) /*@modifies g_warningstream@*/ ; extern /*@observer@*/ stateClauseList uentry_getStateClauseList (uentry p_ue) /*@*/ ; extern void uentry_showWhereLastExtra (uentry p_spec, /*@only@*/ cstring p_extra) /*@modifies g_warningstream@*/ ; extern void uentry_setRefCounted (uentry p_e); extern /*@notnull@*/ /*@only@*/ uentry uentry_makeUnnamedVariable (ctype p_t); extern /*@falsewhennull@*/ bool uentry_isUnnamedVariable (uentry) /*@*/; extern /*@notnull@*/ uentry uentry_makeUnspecFunction (cstring p_n, ctype p_t, typeIdSet p_access, /*@keep@*/ fileloc p_f); extern /*@notnull@*/ uentry uentry_makePrivFunction2 (cstring p_n, ctype p_t, typeIdSet p_access, /*@only@*/ globSet p_globs, /*@only@*/ sRefSet p_mods, /*@keep@*/ fileloc p_f); extern /*@notnull@*/ uentry uentry_makeSpecEnumConstant (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_loc) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeEnumTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeTypeListFunction (cstring p_n, typeIdSet p_access, /*@only@*/ fileloc p_f) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeSpecFunction (cstring p_n, ctype p_t, typeIdSet p_access, /*@only@*/ globSet p_globs, /*@only@*/ sRefSet p_mods, /*@keep@*/ fileloc p_f); extern /*@notnull@*/ uentry uentry_makeEnumConstant (cstring p_n, ctype p_t) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeEnumInitializedConstant (cstring p_n, ctype p_t, exprNode p_expr) /*@*/ ; extern /*@notnull@*/ /*@only@*/ uentry uentry_makeConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f) /*@*/ ; extern /*@only@*/ /*@notnull@*/ uentry uentry_makeConstantValue (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, bool p_priv, /*@only@*/ multiVal p_val) /*@*/ ; extern /*@notnull@*/ /*@only@*/ uentry uentry_makeMacroConstant (/*@temp@*/ cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f) /*@*/ ; extern /*@notnull@*/ /*@only@*/ uentry uentry_makeDatatype (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, qual p_abstract, /*@only@*/ fileloc p_f) /*@*/ ; extern /*@notnull@*/ /*@only@*/ uentry uentry_makeDatatypeAux (/*@temp@*/ cstring p_n, ctype p_t, ynm p_mut, qual p_abstract, /*@keep@*/ fileloc p_f, bool p_priv) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeElipsisMarker (void) /*@*/ ; extern void uentry_makeVarFunction (/*@temp@*/ uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_makeConstantFunction (/*@temp@*/ uentry p_ue) /*@modifies p_ue@*/ ; extern bool uentry_isElipsisMarker (/*@sef@*/ uentry p_u) /*@*/ ; # define uentry_isElipsisMarker(u) \ (uentry_isValid(u) && ekind_isElipsis ((u)->ukind)) extern /*@notnull@*/ uentry uentry_makeEndIter (cstring p_n, /*@only@*/ fileloc p_f) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeEnumTagLoc (cstring p_n, ctype p_t) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeForwardFunction (cstring p_n, typeId p_access, /*@temp@*/ fileloc p_f) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeFunction (cstring p_n, ctype p_t, typeId p_access, /*@only@*/ globSet p_globs, /*@only@*/ sRefSet p_mods, /*@only@*/ warnClause p_warn, /*@only@*/ fileloc p_f); extern /*@notnull@*/ uentry uentry_makeIter (cstring p_n, ctype p_ct, /*@only@*/ fileloc p_f) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeParam (idDecl p_t, int p_i) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeStructTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); extern /*@notnull@*/ uentry uentry_makeStructTagLoc (cstring p_n, ctype p_t); extern /*@notnull@*/ uentry uentry_makeUnionTag (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc); extern /*@notnull@*/ uentry uentry_makeUnionTagLoc (cstring p_n, ctype p_t); extern /*@notnull@*/ uentry uentry_makeVariable (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, bool p_isPriv); extern /*@notnull@*/ /*@only@*/ uentry uentry_makeVariableLoc (cstring p_n, ctype p_t); extern /*@notnull@*/ /*@only@*/ uentry uentry_makeVariableParam (cstring p_n, ctype p_t, fileloc p_loc); extern /*@notnull@*/ /*@only@*/ uentry uentry_makeVariableSrefParam (cstring p_n, ctype p_t, /*@only@*/ fileloc p_loc, /*@exposed@*/ sRef p_s); extern /*@notnull@*/ /*@only@*/ uentry uentry_makeIdFunction (idDecl p_id); extern /*@notnull@*/ /*@only@*/ uentry uentry_makeIdDatatype (idDecl p_id); extern /*@notnull@*/ /*@only@*/ uentry uentry_makeBoolDatatype (qual p_abstract); extern void uentry_mergeDefinition (uentry p_old, /*@only@*/ uentry p_unew); extern void uentry_mergeEntries (uentry p_spec, /*@only@*/ uentry p_def); extern uentry uentry_nameCopy (/*@only@*/ cstring p_name, uentry p_e); extern uentry uentry_undump (ekind p_kind, fileloc p_loc, char **p_s); extern /*@observer@*/ uentryList uentry_getParams (uentry p_l) /*@*/ ; extern void uentry_resetParams (uentry p_ue, /*@only@*/ uentryList p_pn) /*@modifies p_ue@*/ ; extern /*@observer@*/ globSet uentry_getGlobs (uentry p_l) /*@*/ ; extern qual uentry_nullPred (uentry p_u); extern void uentry_free (/*@only@*/ /*@only@*/ uentry p_e); extern void uentry_setDatatype (uentry p_e, typeId p_uid); extern void uentry_setDefined (/*@special@*/ uentry p_e, fileloc p_f) /*@uses p_e->whereDefined, p_e->ukind, p_e->uname, p_e->info@*/ /*@modifies p_e@*/ ; extern void uentry_checkDecl (void); extern void uentry_clearDecl (void); extern void uentry_setDeclared (uentry p_e, fileloc p_f); extern void uentry_setDeclaredOnly (uentry p_e, /*@only@*/ fileloc p_f); extern void uentry_setDeclaredForceOnly (uentry p_e, /*@only@*/ fileloc p_f); extern void uentry_setFunctionDefined (uentry p_e, fileloc p_loc); extern void uentry_setName (uentry p_e, /*@only@*/ cstring p_n); extern void uentry_setParam (uentry p_e); extern void uentry_setSref (uentry p_e, /*@exposed@*/ sRef p_s); extern void uentry_setStatic (uentry p_c); extern void uentry_setModifies (uentry p_ue, /*@owned@*/ sRefSet p_sr) /*@modifies p_ue, p_sr@*/; extern bool uentry_hasWarning (uentry p_ue) /*@*/ ; extern void uentry_addWarning (uentry p_ue, /*@only@*/ warnClause p_warn) /*@modifies p_ue*/; extern void uentry_setStateClauseList (uentry p_ue, /*@only@*/ stateClauseList p_clauses) /*@modifies p_ue@*/ ; extern void uentry_setType (uentry p_e, ctype p_t); extern /*@unused@*/ /*@observer@*/ cstring uentry_checkedName (uentry p_ue); extern void uentry_showWhereLastPlain (uentry p_spec) /*@modifies g_warningstream@*/ ; extern void uentry_showWhereSpecifiedExtra (uentry p_spec, /*@only@*/ cstring p_s) /*@modifies g_warningstream@*/ ; extern void uentry_showWhereSpecified (uentry p_spec) /*@modifies g_warningstream@*/ ; extern void uentry_showWhereLast (uentry p_spec) /*@modifies g_warningstream@*/ ; extern void uentry_showWhereDeclared (uentry p_spec) /*@modifies g_warningstream@*/ ; extern /*@notnull@*/ /*@only@*/ uentry uentry_makeIdVariable (idDecl p_t) /*@*/ ; extern uentry uentry_copy (uentry p_e) /*@*/ ; extern uentry uentry_copyNoSave (uentry p_e) /*@*/ ; /* for use for uentries that do not live beyond function exits */ extern void uentry_freeComplete (/*@only@*/ uentry p_e) ; extern void uentry_clearDefined (uentry p_e) /*@modifies p_e@*/; extern /*@observer@*/ cstring uentry_specDeclName (uentry p_u) /*@*/ ; extern void uentry_mergeState (uentry p_res, uentry p_other, fileloc p_loc, bool p_mustReturn, bool p_flip, bool p_opt, clause p_cl) /*@modifies p_res, p_other@*/ ; extern void uentry_setState (uentry p_res, uentry p_other) /*@modifies p_res, p_other@*/ ; extern void uentry_setRefParam (uentry p_e) /*@modifies p_e@*/ ; extern void uentry_setDeclaredForce (uentry p_e, fileloc p_f) /*@modifies p_e@*/; extern bool uentry_isNonLocal (uentry p_ue) /*@*/ ; extern bool uentry_isGlobalVariable (uentry p_ue) /*@*/; extern bool uentry_isVisibleExternally (uentry p_ue) /*@*/; extern bool uentry_isRefParam (uentry p_u) /*@*/ ; extern bool uentry_hasGlobs (uentry p_ue) /*@*/ ; extern bool uentry_hasMods (uentry p_ue) /*@*/ ; extern bool uentry_hasStateClauseList (uentry p_ue) /*@*/ ; extern bool uentry_hasConditions (uentry p_ue) /*@*/ ; extern exitkind uentry_getExitCode (uentry p_ue) /*@*/ ; extern void uentry_checkYieldParam (uentry p_old, uentry p_unew); extern bool uentry_isOnly (uentry p_ue) /*@*/ ; extern bool uentry_isUnique (uentry p_ue) /*@*/ ; extern void uentry_reflectQualifiers (uentry p_ue, qualList p_q) /*@modifies p_ue@*/; extern bool uentry_isOut (uentry p_u) /*@*/ ; extern bool uentry_isPartial (uentry p_u) /*@*/ ; extern bool uentry_isStateSpecial (uentry p_u) /*@*/ ; extern bool uentry_possiblyNull (uentry p_u) /*@*/ ; extern ctype uentry_getForceRealType (uentry p_e) /*@globals internalState@*/ ; extern alkind uentry_getAliasKind (uentry p_u) /*@*/ ; extern exkind uentry_getExpKind (uentry p_u) /*@*/ ; extern /*@observer@*/ multiVal uentry_getConstantValue (uentry p_e) /*@*/ ; extern void uentry_fixupSref (uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_setGlobals (uentry p_ue, /*@only@*/ globSet p_globs) /*@modifies p_ue, p_globs@*/ ; extern bool uentry_isYield (uentry p_ue) /*@*/ ; extern /*@notnull@*/ uentry uentry_makeIdConstant (idDecl p_t) /*@*/ ; extern /*@observer@*/ cstring uentry_getRealName (uentry p_e) /*@*/ ; extern int uentry_xcomparealpha (uentry *p_p1, uentry *p_p2) /*@*/ ; extern int uentry_xcompareuses (uentry *p_p1, uentry *p_p2) /*@*/ ; extern /*@observer@*/ cstring uentry_specOrDefName (uentry p_u) /*@*/ ; extern void uentry_copyState (uentry p_res, uentry p_other); extern bool uentry_sameKind (uentry p_u1, uentry p_u2); extern /*@exposed@*/ sRef uentry_returnedRef (uentry p_u, exprNodeList p_args, fileloc p_loc); extern bool uentry_isReturned (uentry p_u); extern bool uentry_isRefCountedDatatype (uentry p_e); extern sstate uentry_getDefState (uentry p_u); extern /*@unused@*/ void uentry_markFree (/*@owned@*/ uentry p_u); extern /*@dependent@*/ sRef uentry_getOrigSref (uentry p_e); extern void uentry_destroyMod (void) /*@modifies internalState@*/; extern void uentry_showDefSpecInfo (uentry p_ce, fileloc p_fwhere); extern void uentry_markOwned (/*@owned@*/ uentry p_u); extern /*@observer@*/ fileloc uentry_whereLast (uentry p_e) /*@*/ ; extern void uentry_setParamNo (uentry p_ue, int p_pno) /*@modifies p_ue@*/; extern /*@observer@*/ filelocList uentry_getUses (/*@sef@*/ uentry p_e) /*@*/ ; # define uentry_getUses(u) (uentry_isValid (u) ? (u)->uses : filelocList_undefined) extern bool uentry_isCheckedUnknown (uentry p_ue) /*@*/ ; extern bool uentry_isCheckedModify (uentry p_ue) /*@*/ ; extern bool uentry_isUnchecked (uentry p_ue) /*@*/ ; extern bool uentry_isChecked (uentry p_ue) /*@*/ ; extern bool uentry_isCheckMod (uentry p_ue) /*@*/ ; extern bool uentry_isCheckedStrict (uentry p_ue) /*@*/ ; extern void uentry_setUnchecked (uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_setChecked (uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_setCheckMod (uentry p_ue) /*@modifies p_ue@*/ ; extern void uentry_setCheckedStrict (uentry p_ue) /*@modifies p_ue@*/ ; extern bool uentry_hasAccessType (uentry p_e); /*@constant cstring GLOBAL_MARKER_NAME@*/ # define GLOBAL_MARKER_NAME cstring_makeLiteralTemp ("#GM#") /* Null Termination */ extern void uentry_setNullTerminatedState (uentry p_e); extern void uentry_setPossiblyNullTerminatedState (uentry p_e); extern void uentry_setSize(uentry p_e, int p_size); extern void uentry_setLen(uentry p_e, int p_len); extern /*@falsewhennull@*/ bool uentry_hasBufStateInfo (uentry p_ue) /*@*/ ; extern bool uentry_isNullTerminated (uentry p_ue) /*@*/ ; extern bool uentry_isPossiblyNullTerminated (uentry p_ue) /*@*/ ; extern bool uentry_isNotNullTerminated (uentry p_ue) /*@*/ ; /* Global Markers */ extern uentry uentry_makeGlobalMarker (void) ; extern bool uentry_isGlobalMarker (uentry) /*@*/ ; # ifdef DOANNOTS typedef enum { AN_UNKNOWN, AN_FCNRETURN, AN_FCNPARAM, AN_SUFIELD, AN_TDEFN, AN_GSVAR, AN_CONST, AN_LAST } ancontext; extern void initAnnots (); extern void printAnnots (void); extern void uentry_tallyAnnots (uentry u, ancontext kind); # endif /* DOANNOTS */ extern bool uentry_hasMetaStateEnsures (uentry p_e) /*@*/ ; extern /*@only@*/ metaStateConstraintList uentry_getMetaStateEnsures (uentry p_e); /* start modifications */ /*drl7x*/ extern constraintList uentry_getFcnPreconditions (uentry p_ue); extern constraintList uentry_getFcnPostconditions (uentry p_ue); extern void uentry_setPostconditions (uentry p_ue, /*@only@*/ functionConstraint p_postconditions); extern void uentry_setPreconditions (uentry p_ue, /*@only@*/ functionConstraint p_preconditions); /*end mods*/ /* ** For debugging only */ # ifdef DEBUGSPLINT extern void uentry_checkValid (uentry p_ue) /*@modifies g_errorstream@*/ ; # endif # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/llerror.h0000644021234200000250000004012207706100771015443 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LLERROR_H # define LLERROR_H extern bool /*@alt void@*/ check (bool p_x); # define check(p_x) doCheck (p_x, cstring_fromChars (#p_x), cstring_makeLiteralTemp (__FILE__), __LINE__) extern bool doCheck (bool p_x, cstring p_pred, cstring p_file, int p_line); extern /*@noreturnwhenfalse@*/ void llassert (/*@sef@*/ bool p_test); /*@-macroredef@*/ # define llassert(tst) \ do { if (!(tst)) { \ if (context_getFlag (FLG_TRYTORECOVER)) checkParseError (); \ lldiagmsg (message ("%s:%d: at source point", \ cstring_makeLiteralTemp (__FILE__), __LINE__)); \ llbuglit ("llassert failed: " #tst); \ }} while (FALSE) /*@=macroredef@*/ extern /*@noreturnwhenfalse@*/ void llassertretnull (/*@sef@*/ bool p_test); # define llassertretnull(tst) \ do { if (!(tst)) { \ if (context_getFlag (FLG_TRYTORECOVER)) checkParseError (); \ lldiagmsg (message ("%s:%d: at source point", \ cstring_makeLiteralTemp (__FILE__), __LINE__)); \ llbuglit ("llassert failed: " #tst); \ }} while (FALSE) typedef void *tx_voidptr; extern /*@noreturnwhenfalse@*/ void llassertretval (/*@sef@*/ bool p_test, /*@sef@*/ /*@null@*/ tx_voidptr /*@alt anytype@*/ p_val); # define llassertretval(tst,val) \ do { if (!(tst)) { \ if (context_getFlag (FLG_TRYTORECOVER)) checkParseError (); \ lldiagmsg (message ("%s:%d: at source point", \ cstring_makeLiteralTemp (__FILE__), __LINE__)); \ llbuglit ("llassert failed: " #tst); \ /*@-type@*/ return (val); /*@=type@*/ \ }} while (FALSE) /* ** Use this for assertions in error-generation code (that ** might lead to infinite loops of failed assertions if ** the normal error generation routines are used). */ extern /*@noreturnwhenfalse@*/ void llassertprotect (/*@sef@*/ bool p_test); # define llassertprotect(tst) \ do { if (!(tst)) { \ fprintf (stderr, "%s:%d: at source point: ", __FILE__, __LINE__); \ fprintf (stderr, "protected fatal llassert failed: " #tst "\n"); \ llexit (EXIT_FAILURE); \ }} while (FALSE) extern /*@noreturnwhenfalse@*/ void llassertfatal (/*@sef@*/ bool p_test); # define llassertfatal(tst) \ do { if (!(tst)) \ llfatalbug (message("%s:%d: fatal llassert failed: " #tst, \ cstring_makeLiteralTemp (__FILE__), __LINE__)); \ } while (FALSE) /* ** llassertprint and llassertprintret are in splintMacros.nf */ extern void llmsg (/*@only@*/ cstring p_s) /*@modifies g_warningstream@*/ ; extern void lldiagmsg (/*@only@*/ cstring p_s) /*@modifies g_messagestream@*/ ; extern void llmsgplain (/*@only@*/ cstring p_s) /*@modifies g_warningstream@*/ ; extern void llhint (/*@only@*/ cstring p_s) /*@globals g_currentloc, g_warningstream;@*/ /*@modifies g_warningstream@*/ ; extern /*:private:*/ /*@noreturn@*/ void xllfatalbug (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s) /*@globals g_currentloc@*/ /*@modifies g_errorstream@*/ ; extern /*@noreturn@*/ void llfatalbug (/*@only@*/ cstring p_s) /*@globals g_currentloc@*/ /*@modifies g_errorstream@*/ ; # define llfatalbug(p_s) \ xllfatalbug (__FILE__, __LINE__, p_s) extern /*:private:*/ bool xllgenerror (char *p_srcFile, int p_srcLine, flagcode p_o, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream@*/ ; extern bool llgenerror (flagcode p_o, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream@*/ ; # define llgenerror(p_o, p_s, p_fl) \ xllgenerror (__FILE__, __LINE__, p_o, p_s, p_fl) extern /*:private:*/ bool xllgenhinterror (char *p_srcFile, int p_srcLine, flagcode p_o, /*@only@*/ cstring p_s, /*@only@*/ cstring p_hint, fileloc p_fl) /*@modifies g_warningstream@*/ ; extern bool llgenhinterror (flagcode p_o, /*@only@*/ cstring p_s, /*@only@*/ cstring p_hint, fileloc p_fl) /*@modifies g_warningstream@*/ ; # define llgenhinterror(p_o, p_s, p_hint, p_fl) \ xllgenhinterror (__FILE__, __LINE__, p_o, p_s, p_hint, p_fl) extern void llerror (flagcode p_o, /*@only@*/ cstring p_s) /*@globals g_warningstream, g_currentloc@*/ /*@modifies g_warningstream@*/ ; # define llerror(p_o, p_s) \ ((void) llgenerror (p_o, p_s, g_currentloc)) extern void llgenmsg (/*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream@*/ ; extern /*@noreturn@*/ /*:private:*/ void xllfatalerror (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s) /*@modifies g_errorstream@*/ ; extern /*@noreturn@*/ void llfatalerror (/*@only@*/ cstring p_s) /*@modifies g_errorstream@*/ ; # define llfatalerror(p_s) xllfatalerror (__FILE__, __LINE__, p_s) extern /*@noreturn@*/ /*:private:*/ void xllfatalerrorLoc (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s) /*@globals g_currentloc@*/ /*@modifies g_errorstream@*/ ; extern /*@noreturn@*/ void llfatalerrorLoc (/*@only@*/ cstring p_s) /*@globals g_currentloc@*/ /*@modifies g_errorstream@*/ ; # define llfatalerrorLoc(p_s) xllfatalerrorLoc (__FILE__, __LINE__, p_s) extern /*:private:*/ void xllparseerror (char *p_srcFile, int p_srcLine, /*@only@*/ cstring p_s) /*@globals g_currentloc@*/ /*@modifies g_warningstream@*/ ; extern void llparseerror (/*@only@*/ cstring p_s) /*@globals g_currentloc@*/ /*@modifies g_warningstream@*/ ; # define llparseerror(p_s) xllparseerror (__FILE__, __LINE__, p_s) extern /*@noreturn@*/ void lclplainfatalerror (/*@only@*/ cstring p_msg) /*@modifies g_warningstream@*/ ; extern /*@noreturn@*/ void lclfatalbug (/*@temp@*/ char *p_msg) /*@modifies g_warningstream@*/ ; extern int lclNumberErrors (void) /*@*/ ; extern bool lclHadNewError (void) /*@modifies internalState@*/ ; extern /*@noreturn@*/ void lclfatalerror (ltoken p_t, /*@only@*/ cstring p_msg); extern void xlclerror (char *p_srcFile, int p_srcLine, ltoken p_t, /*@only@*/ cstring p_msg) ; extern void lclerror (ltoken p_t, /*@only@*/ cstring p_msg); # define lclerror(p_t,p_msg) \ xlclerror (__FILE__, __LINE__, p_t, p_msg) extern void lclbug (/*@only@*/ cstring p_s); extern void lclplainerror (/*@only@*/ cstring p_msg); extern bool lclHadError (void); extern void lclRedeclarationError (ltoken p_id); extern void llerror_flagWarning (/*@only@*/ cstring p_s) /*@modifies g_warningstream@*/ ; extern /*@noreturn@*/ void llbugaux (cstring p_file, int p_line, /*@only@*/ cstring p_s) /*@globals g_warningstream, g_currentloc@*/ /*@modifies *g_warningstream@*/ ; extern /*@noreturn@*/ void llbug (/*@only@*/ cstring p_s) /*@globals g_warningstream, g_currentloc@*/ /*@modifies *g_warningstream@*/ ; /* doesn't really exit, but don't mind errors if it doesn't */ # define llbug(s) llbugaux (cstring_makeLiteralTemp (__FILE__), __LINE__, s) extern void llquietbugaux (/*@only@*/ cstring p_s, cstring, int) /*@modifies *g_warningstream@*/ ; extern void llquietbug (/*@only@*/ cstring) /*@modifies *g_warningstream@*/ ; # define llquietbug(s) llquietbugaux (s, cstring_makeLiteralTemp (__FILE__), __LINE__) extern void llcontbug (/*@only@*/ cstring p_s) /*@modifies *g_warningstream@*/ ; /* doesn't really exit, but don't mind errors if it doesn't */ # define llcontbug(s) (llbug (s)) extern void cleanupMessages (void) /*@globals g_warningstream, g_currentloc;@*/ /*@modifies g_warningstream, internalState@*/ ; extern void displayScan (/*@only@*/ cstring p_msg) /*@modifies g_messagestream@*/ ; extern void displayScanOpen (/*@only@*/ cstring p_msg) /*@modifies g_messagestream@*/ ; extern void displayScanContinue (/*@temp@*/ cstring p_msg) /*@modifies g_messagestream@*/ ; extern void displayScanClose (void) /*@modifies g_messagestream@*/ ; /* ** Report error iff f1 and f2 are set. */ extern bool xoptgenerror2 (char *p_srcFile, int p_srcLine, flagcode p_f1, flagcode p_f2, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; extern bool optgenerror2 (flagcode p_f1, flagcode p_f2, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; # define optgenerror2(p_f1, p_f2, p_s, p_loc) \ (xoptgenerror2 (__FILE__, __LINE__, p_f1, p_f2, p_s, p_loc)) /* ** Report error if f1 is set and f2 is not set. */ extern bool xoptgenerror2n (char *p_srcFile, int p_srcLine, flagcode p_f1, flagcode p_f2, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; extern bool optgenerror2n (flagcode p_f1, flagcode p_f2, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; # define optgenerror2n(p_f1, p_f2, p_s, p_loc) \ (xoptgenerror2n (__FILE__, __LINE__, p_f1, p_f2, p_s, p_loc)) extern /*:private:*/ bool xlloptgenerror (char *p_srcFile, int p_srcLine, flagcode p_o, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; extern bool lloptgenerror (flagcode p_o, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; # define lloptgenerror(p_o, p_s, p_loc) \ (xlloptgenerror (__FILE__, __LINE__, p_o, p_s, p_loc)) extern bool xllnoptgenerror (char *p_srcFile, int p_srcLine, flagcode p_o, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; extern bool llnoptgenerror (flagcode p_o, /*@only@*/ cstring p_s, fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; # define llnoptgenerror(p_o, p_s, p_loc) \ (xllnoptgenerror (__FILE__, __LINE__, p_o, p_s, p_loc)) extern /*:private:*/ bool xllgenformattypeerror (char *p_srcFile, int p_srcLine, ctype p_t1, exprNode p_e1, ctype p_t2, exprNode p_e2, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies *g_warningstream, internalState@*/ ; extern bool llgenformattypeerror (ctype p_t1, exprNode p_e1, ctype p_t2, exprNode p_e2, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies *g_warningstream, internalState@*/ ; # define llgenformattypeerror(p_t1, p_e1, p_t2, p_e2, p_s, p_fl) \ xllgenformattypeerror (__FILE__, __LINE__, p_t1, p_e1, p_t2, p_e2, p_s, p_fl) extern bool xllgentypeerror (char *p_srcFile, int p_srcLine, ctype p_t1, exprNode p_e1, ctype p_t2, exprNode p_e2, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies *g_warningstream, internalState@*/ ; extern bool llgentypeerror (ctype p_t1, exprNode p_e1, ctype p_t2, exprNode p_e2, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies *g_warningstream, internalState@*/ ; # define llgentypeerror(p_t1, p_e1, p_t2, p_e2, p_s, p_fl) \ xllgentypeerror (__FILE__, __LINE__, p_t1, p_e1, p_t2, p_e2, p_s, p_fl) extern bool gentypeerror (/*@sef@*/ ctype p_t1, /*@sef@*/ exprNode p_e1, /*@sef@*/ ctype p_t2, /*@sef@*/ exprNode p_e2, /*@sef@*/ /*@only@*/ cstring p_s, /*@sef@*/ fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; /*@-branchstate@*/ /* sef only s is freed on one branch */ #define gentypeerror(t1, e1, t2, e2, s, loc) \ (context_suppressFlagMsg (FLG_TYPE,loc) \ ? (flagcode_recordSuppressed (FLG_TYPE), FALSE) \ : llgentypeerror (t1, e1, t2, e2, s, loc)) /*@=branchstate@*/ /* ** These are macros to save evaluating s (which may be some expensive ** message generation function). */ extern bool optgenerror (/*@sef@*/ flagcode p_o, /*@sef@*/ /*@only@*/ cstring p_s, /*@sef@*/ fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; /*@-branchstate@*/ /* sef only s is freed on one branch */ #define optgenerror(o,s,loc) \ (context_suppressFlagMsg(o,loc) ? (flagcode_recordSuppressed(o), FALSE) \ : lloptgenerror (o, s, loc)) /*@=branchstate@*/ extern void voptgenerror (/*@sef@*/ flagcode p_o, /*@sef@*/ /*@only@*/ cstring p_s, /*@sef@*/ fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; #define voptgenerror(o, s, loc) ((void) optgenerror(o,s,loc)) extern /*:private:*/ bool xfsgenerror (char *p_srcFile, int p_srcLine, flagSpec p_fs, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream, internalState@*/ ; extern bool fsgenerror (flagSpec p_fs, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream, internalState@*/ ; # define fsgenerror(p_fs, p_s, p_fl) \ xfsgenerror (__FILE__, __LINE__, p_fs, p_s, p_fl) extern void vfsgenerror (/*@sef@*/ flagSpec p_fs, /*@sef@*/ /*@only@*/ cstring p_s, /*@sef@*/ fileloc p_loc) /*@modifies *g_warningstream, internalState@*/ ; #define vfsgenerror(fs, s, loc) ((void) fsgenerror(fs,s,loc)) /* ** Reports a warning when f1 is ON and f2 is ON */ extern void voptgenerror2 (/*@sef@*/ flagcode p_f1, /*@sef@*/ flagcode p_f2, /*@sef@*/ /*@only@*/ cstring p_s, /*@sef@*/ fileloc p_loc); #define voptgenerror2(f1, f2, s, loc) ((void) optgenerror2 (f1, f2, s, loc)) /* ** Reports a warning when f1 is ON and f2 is OFF */ extern void voptgenerror2n (/*@sef@*/ flagcode p_f1, /*@sef@*/ flagcode p_f2, /*@sef@*/ /*@only@*/ cstring p_s, /*@sef@*/ fileloc p_loc); #define voptgenerror2n(f1, f2, s, loc) ((void) optgenerror2n (f1, f2, s, loc)) extern void noptgenerror (/*@sef@*/ flagcode p_code, /*@sef@*/ /*@only@*/ cstring p_s, /*@sef@*/ fileloc p_loc); /*@-branchstate@*/ /* sef only s is freed on one branch */ #define noptgenerror(o,s,loc) \ (context_suppressNotFlagMsg (o, loc) \ ? (flagcode_recordSuppressed(o), FALSE) \ : llnoptgenerror (o, s, loc)) /*@=branchstate@*/ extern void vnoptgenerror (/*@sef@*/ flagcode p_code, /*@sef@*/ /*@only@*/ cstring p_msg, /*@sef@*/ fileloc p_loc); # define vnoptgenerror(o, s, loc) ((void) noptgenerror(o, s, loc)) extern void vgenhinterror (flagcode p_code, /*@only@*/ cstring p_mst, /*@only@*/ cstring p_hint, /*@sef@*/ fileloc p_loc); # define vgenhinterror(o, s, h, loc) \ ((void) llgenhinterror(o, s, h, loc)) extern /*:private:*/ bool /*@alt void@*/ xllforceerror (char *p_srcFile, int p_srcLine, flagcode p_code, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream@*/ ; extern bool /*@alt void@*/ llforceerror (flagcode p_code, /*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream@*/ ; # define llforceerror(p_code, p_s, p_fl) \ (xllforceerror (__FILE__, __LINE__, p_code, p_s, p_fl)) extern /*:private:*/ bool xcppoptgenerror (char *p_srcFile, int p_srcLine, flagcode p_o, /*@only@*/ cstring p_s, cppReader *p_pfile) /*@modifies g_warningstream, p_pfile@*/ ; extern bool /*@alt void@*/ cppoptgenerror (flagcode p_code, /*@only@*/ cstring p_s, cppReader *p_pfile) /*@modifies g_warningstream, p_pfile@*/ ; # define cppoptgenerror(p_code, p_s, p_pfile) \ (xcppoptgenerror (__FILE__, __LINE__, p_code, p_s, p_pfile)) extern void llerrorlit (flagcode p_o, char *p_s); # define llerrorlit(o, s) ((void) llerror (o, cstring_makeLiteral (s))) extern void llgenindentmsg (/*@only@*/ cstring p_s, fileloc p_fl) /*@modifies g_warningstream@*/ ; extern /*@noreturn@*/ void llbugexitlit (char *p_s); # define llbugexitlit(s) (llbug (cstring_makeLiteral (s))) extern void llbuglit (char *p_s); # define llbuglit(s) (llbug (cstring_makeLiteral (s))) extern void llcontbuglit (char *p_s); # define llcontbuglit(s) (llbug (cstring_makeLiteral (s))) extern void checkParseError (void); extern void llmsglit (char *p_s); # define llmsglit(s) (llmsg (cstring_makeLiteral (s))) extern void ppllerror (/*@only@*/ cstring p_s); extern void genppllerrorhint (flagcode p_code, /*@only@*/ cstring p_s, /*@only@*/ cstring p_hint); extern void genppllerror (flagcode p_code, /*@only@*/ cstring p_s); extern /*@unused@*/ void pplldiagmsg (/*@only@*/ cstring p_s); extern void loadllmsg (/*@only@*/ cstring p_s); extern void llgenindentmsgnoloc (/*@only@*/ cstring p_s); extern /*@observer@*/ cstring lldecodeerror (int) /*@*/ ; /* ** should be static, but used in cpperror (which shouldn't exist) */ extern void prepareMessage (void) /*@modifies internalState, g_messagestream@*/ ; extern void closeMessage (void) /*@modifies internalState, g_messagestream@*/ ; extern void llflush (void) /*@modifies systemState@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/uentryList.h0000644021234200000250000001064207646432517016161 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** uentryList.h (from slist_templace.h) */ # ifndef uentryLIST_H # define uentryLIST_H abst_typedef /*@null@*/ struct { int nelements; int nspace; int current; /*@reldef@*/ /*@relnull@*/ o_uentry *elements; } *uentryList; /*@iter uentryList_elements (sef uentryList x, yield exposed uentry el); @*/ # define uentryList_elements(x, m_el) \ { if (!uentryList_isUndefined(x) && !uentryList_isVoid(x))\ { int m_ind; uentry *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { uentry m_el = *(m_elements++); # define end_uentryList_elements }}} extern void uentryList_clear (uentryList p_s) /*@modifies p_s@*/ ; extern int uentryList_size (uentryList p_s) /*@*/ ; extern /*@only@*/ uentryList uentryList_makeMissingParams (void); /*@constant null uentryList uentryList_missingParams; @*/ # define uentryList_missingParams uentryList_undefined # define uentryList_makeMissingParams() uentryList_missingParams extern /*@nullwhentrue@*/ bool uentryList_isMissingParams (uentryList p_s) /*@*/ ; extern /*@nullwhentrue@*/ bool uentryList_isUndefined (uentryList p_s) /*@*/ ; extern /*@unused@*/ /*@nullwhentrue@*/ bool uentryList_isEmpty (uentryList p_s) /*@*/ ; extern /*@unused@*/ /*@falsewhennull@*/ bool uentryList_isDefined (uentryList p_s) /*@*/ ; # define uentryList_isEmpty(s) (uentryList_size(s) == 0) /*@constant null uentryList uentryList_undefined; @*/ # define uentryList_undefined ((uentryList)0) # define uentryList_isUndefined(c) ((c) == uentryList_undefined) # define uentryList_isDefined(c) ((c) != uentryList_undefined) extern /*@notnull@*/ /*@only@*/ uentryList uentryList_new(void); extern uentryList uentryList_add (/*@returned@*/ uentryList p_s, /*@keep@*/ uentry p_el) /*@modifies p_s@*/ ; extern /*@only@*/ uentryList uentryList_single (/*@keep@*/ uentry p_el) /*@*/ ; extern /*@exposed@*/ uentry uentryList_getN (uentryList p_p, int p_n) /*@*/ ; extern /*@unused@*/ cstring uentryList_unparseFull (uentryList p_s) /*@*/ ; extern cstring uentryList_unparse (uentryList p_s) /*@*/ ; extern cstring uentryList_unparseAbbrev (uentryList p_p) /*@*/ ; extern cstring uentryList_unparseParams (uentryList p_s) /*@*/ ; extern void uentryList_free (/*@only@*/ uentryList p_s) ; extern void uentryList_freeShallow (/*@only@*/ uentryList p_s) ; extern bool uentryList_isVoid (uentryList p_cl) /*@*/ ; extern /*@only@*/ uentryList uentryList_copy (uentryList p_s) /*@*/ ; extern void uentryList_fixMissingNames (uentryList p_cl) /*@modifies p_cl@*/ ; extern int uentryList_compareStrict (uentryList p_s, uentryList p_t) /*@*/ ; extern int uentryList_compareParams (uentryList p_s, uentryList p_t) /*@*/ ; extern int uentryList_compareFields (uentryList p_s, uentryList p_t) /*@*/ ; extern bool uentryList_equivFields (uentryList p_p1, uentryList p_p2) /*@*/ ; extern cstring uentryList_dumpParams (uentryList p_s) /*@*/ ; extern uentryList uentryList_undump (char **p_s) /*@modifies *p_s@*/ ; extern bool uentryList_hasReturned (uentryList p_ul) /*@*/ ; extern void uentryList_advanceSafe (uentryList p_s) /*@modifies p_s@*/; extern bool uentryList_isFinished (uentryList p_s) /*@*/ ; extern void uentryList_reset (uentryList p_s) /*@modifies p_s@*/ ; extern /*@exposed@*/ uentry uentryList_current (uentryList p_s) /*@*/ ; extern int uentryList_lookupRealName (uentryList p_s, cstring p_name) /*@*/ ; extern /*@exposed@*/ uentry uentryList_lookupField (uentryList p_f, cstring p_name) /*@*/ ; extern uentryList uentryList_mergeFields (/*@only@*/ uentryList p_f1, /*@only@*/ uentryList p_f2); extern void uentryList_showFieldDifference (uentryList p_p1, uentryList p_p2); extern /*@only@*/ uentryList uentryList_undumpFields (char **p_s, fileloc p_loc); extern /*@only@*/ cstring uentryList_dumpFields (uentryList p_s); extern void uentryList_fixImpParams (uentryList p_cl); extern bool uentryList_sameObject (uentryList, uentryList); extern bool uentryList_matchFields (uentryList p_p1, uentryList p_p2); extern bool uentryList_matchParams (uentryList p_p1, uentryList p_p2, bool p_force, bool p_arg); # define uentryList_sameObject(s,t) ((s) == (t)) /*@constant int uentryListBASESIZE;@*/ # define uentryListBASESIZE MIDBASESIZE /*@constant int uentryList_abbrevBreadth@*/ # define uentryList_abbrevBreadth 3 # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/llglobals.h0000644021234200000250000000046707630463447015755 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LLGLOBALS_H # define LLGLOBALS_H extern /*@only@*/ lsymbolSet g_currentImports; extern /*@only@*/ symtable g_symtab; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/usymId.h0000644021234200000250000000135207646432517015247 0ustar fax# ifndef USYMID_H # define USYMID_H typedef /*@numabstract@*/ int usymId; extern usymId usymId_fromInt (int p_i) /*@*/ ; # define usymId_fromInt(i) ((usymId)(i)) extern int usymId_toInt (usymId p_i) /*@*/ ; # define usymId_toInt(i) ((int)(i)) extern bool usymId_isInvalid (usymId p_u) /*@*/ ; # define usymId_isInvalid(u) ((u) == usymId_invalid) extern bool usymId_isValid (usymId p_u) /*@*/ ; # define usymId_isValid(u) ((u) != usymId_invalid) extern bool usymId_equal (usymId p_u1, usymId p_u2) /*@*/ ; # define usymId_equal(u1,u2) ((u1) == (u2)) /*@constant usymId usymId_invalid;@*/ # define usymId_invalid -17 /*@constant usymId usymId_notfound;@*/ # define usymId_notfound NOT_FOUND # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/llgrammar2.h0000644021234200000250000000016607121317326016023 0ustar fax# ifndef LLGRAMMAR2_H # define LLGRAMMAR2_H # include "llgrammar_gen2.h" # else # error "Multiple includes" # endif splint-3.1.2.dfsg1/src/Headers/usymIdSet.h0000644021234200000250000000402107646432517015717 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** usymIdSet.h ** ** based on set_template.h */ # ifndef USYMIDSET_H # define USYMIDSET_H abst_typedef /*@null@*/ struct { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ usymId *elements; } *usymIdSet ; extern usymIdSet usymIdSet_new(void); extern bool usymIdSet_member (usymIdSet p_s, usymId p_el) /*@*/ ; extern usymIdSet usymIdSet_subtract (usymIdSet p_s, usymIdSet p_t); extern void usymIdSet_free (/*@only@*/ /*@only@*/ usymIdSet p_s); extern /*@only@*/ cstring usymIdSet_unparse (usymIdSet p_ll); extern /*@only@*/ cstring usymIdSet_dump (usymIdSet p_lset); extern usymIdSet usymIdSet_undump (char **p_s); extern /*@only@*/ usymIdSet usymIdSet_single (usymId p_t); extern int usymIdSet_compare (usymIdSet p_l1, usymIdSet p_l2); /*@constant int usymIdSetBASESIZE;@*/ # define usymIdSetBASESIZE SMALLBASESIZE extern usymIdSet usymIdSet_newUnion (usymIdSet p_s1, usymIdSet p_s2) /*@*/ ; extern usymIdSet usymIdSet_add (usymIdSet p_s, usymId p_el) /*@*/ ; extern /*@only@*/ usymIdSet usymIdSet_removeFresh (/*@temp@*/ usymIdSet p_s, usymId p_el); /*@constant null usymIdSet usymIdSet_undefined; @*/ # define usymIdSet_undefined ((usymIdSet) NULL) extern /*@falsewhennull@*/ bool usymIdSet_isDefined (usymIdSet p_s) /*@*/ ; # define usymIdSet_isDefined(s) ((s) != usymIdSet_undefined) extern /*@nullwhentrue@*/ bool usymIdSet_isUndefined (usymIdSet p_s) /*@*/ ; # define usymIdSet_isUndefined(s) ((s) == usymIdSet_undefined) /*@iter usymIdSet_elements (sef usymIdSet u, yield usymId el); @*/ # define usymIdSet_elements(x, m_el) \ { int m_ind; if (usymIdSet_isDefined (x)) { \ for (m_ind = 0 ; m_ind < usymIdSet_size(x); m_ind++) \ { usymId m_el = (x)->elements[m_ind]; # define end_usymIdSet_elements }}} extern int usymIdSet_size (/*@sef@*/ usymIdSet p_s); # define usymIdSet_size(s) (usymIdSet_isUndefined(s) ? 0 : (s)->entries) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/llgrammar_gen2.h0000644021234200000250000003014510645776225016670 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { simpleOp = 258, PREFIX_OP = 259, POSTFIX_OP = 260, LLT_MULOP = 261, LLT_SEMI = 262, LLT_VERTICALBAR = 263, ITERATION_OP = 264, selectSym = 265, LLT_LBRACKET = 266, LLT_LPAR = 267, LLT_IF_THEN_ELSE = 268, logicalOp = 269, eqSepSym = 270, equationSym = 271, commentSym = 272, LLT_WHITESPACE = 273, LLT_EOL = 274, LLT_TYPEDEF_NAME = 275, quantifierSym = 276, openSym = 277, closeSym = 278, sepSym = 279, simpleId = 280, mapSym = 281, markerSym = 282, preSym = 283, postSym = 284, anySym = 285, LLT_COLON = 286, LLT_COMMA = 287, LLT_EQUALS = 288, LLT_LBRACE = 289, LLT_RBRACE = 290, LLT_RBRACKET = 291, LLT_RPAR = 292, LLT_QUOTE = 293, eqOp = 294, LLT_CCHAR = 295, LLT_CFLOAT = 296, LLT_CINTEGER = 297, LLT_LCSTRING = 298, LLT_ALL = 299, LLT_ANYTHING = 300, LLT_BE = 301, LLT_BODY = 302, LLT_CLAIMS = 303, LLT_CHECKS = 304, LLT_CONSTANT = 305, LLT_ELSE = 306, LLT_ENSURES = 307, LLT_FOR = 308, LLT_FRESH = 309, LLT_IF = 310, LLT_IMMUTABLE = 311, LLT_IMPORTS = 312, LLT_CONSTRAINT = 313, LLT_ISSUB = 314, LLT_LET = 315, LLT_MODIFIES = 316, LLT_MUTABLE = 317, LLT_NOTHING = 318, LLT_INTERNAL = 319, LLT_FILESYS = 320, LLT_OBJ = 321, LLT_OUT = 322, LLT_SEF = 323, LLT_ONLY = 324, LLT_PARTIAL = 325, LLT_OWNED = 326, LLT_DEPENDENT = 327, LLT_KEEP = 328, LLT_KEPT = 329, LLT_TEMP = 330, LLT_SHARED = 331, LLT_UNIQUE = 332, LLT_UNUSED = 333, LLT_EXITS = 334, LLT_MAYEXIT = 335, LLT_NEVEREXIT = 336, LLT_TRUEEXIT = 337, LLT_FALSEEXIT = 338, LLT_UNDEF = 339, LLT_KILLED = 340, LLT_CHECKMOD = 341, LLT_CHECKED = 342, LLT_UNCHECKED = 343, LLT_CHECKEDSTRICT = 344, LLT_TRUENULL = 345, LLT_FALSENULL = 346, LLT_LNULL = 347, LLT_LNOTNULL = 348, LLT_RETURNED = 349, LLT_OBSERVER = 350, LLT_EXPOSED = 351, LLT_REFCOUNTED = 352, LLT_REFS = 353, LLT_RELNULL = 354, LLT_RELDEF = 355, LLT_KILLREF = 356, LLT_NULLTERMINATED = 357, LLT_TEMPREF = 358, LLT_NEWREF = 359, LLT_PRIVATE = 360, LLT_REQUIRES = 361, LLT_RESULT = 362, LLT_SIZEOF = 363, LLT_SPEC = 364, LLT_TAGGEDUNION = 365, LLT_THEN = 366, LLT_TYPE = 367, LLT_TYPEDEF = 368, LLT_UNCHANGED = 369, LLT_USES = 370, LLT_CHAR = 371, LLT_CONST = 372, LLT_DOUBLE = 373, LLT_ENUM = 374, LLT_FLOAT = 375, LLT_INT = 376, LLT_ITER = 377, LLT_YIELD = 378, LLT_LONG = 379, LLT_SHORT = 380, LLT_SIGNED = 381, LLT_UNKNOWN = 382, LLT_STRUCT = 383, LLT_TELIPSIS = 384, LLT_UNION = 385, LLT_UNSIGNED = 386, LLT_VOID = 387, LLT_VOLATILE = 388, LLT_PRINTFLIKE = 389, LLT_SCANFLIKE = 390, LLT_MESSAGELIKE = 391 }; #endif /* Tokens. */ #define simpleOp 258 #define PREFIX_OP 259 #define POSTFIX_OP 260 #define LLT_MULOP 261 #define LLT_SEMI 262 #define LLT_VERTICALBAR 263 #define ITERATION_OP 264 #define selectSym 265 #define LLT_LBRACKET 266 #define LLT_LPAR 267 #define LLT_IF_THEN_ELSE 268 #define logicalOp 269 #define eqSepSym 270 #define equationSym 271 #define commentSym 272 #define LLT_WHITESPACE 273 #define LLT_EOL 274 #define LLT_TYPEDEF_NAME 275 #define quantifierSym 276 #define openSym 277 #define closeSym 278 #define sepSym 279 #define simpleId 280 #define mapSym 281 #define markerSym 282 #define preSym 283 #define postSym 284 #define anySym 285 #define LLT_COLON 286 #define LLT_COMMA 287 #define LLT_EQUALS 288 #define LLT_LBRACE 289 #define LLT_RBRACE 290 #define LLT_RBRACKET 291 #define LLT_RPAR 292 #define LLT_QUOTE 293 #define eqOp 294 #define LLT_CCHAR 295 #define LLT_CFLOAT 296 #define LLT_CINTEGER 297 #define LLT_LCSTRING 298 #define LLT_ALL 299 #define LLT_ANYTHING 300 #define LLT_BE 301 #define LLT_BODY 302 #define LLT_CLAIMS 303 #define LLT_CHECKS 304 #define LLT_CONSTANT 305 #define LLT_ELSE 306 #define LLT_ENSURES 307 #define LLT_FOR 308 #define LLT_FRESH 309 #define LLT_IF 310 #define LLT_IMMUTABLE 311 #define LLT_IMPORTS 312 #define LLT_CONSTRAINT 313 #define LLT_ISSUB 314 #define LLT_LET 315 #define LLT_MODIFIES 316 #define LLT_MUTABLE 317 #define LLT_NOTHING 318 #define LLT_INTERNAL 319 #define LLT_FILESYS 320 #define LLT_OBJ 321 #define LLT_OUT 322 #define LLT_SEF 323 #define LLT_ONLY 324 #define LLT_PARTIAL 325 #define LLT_OWNED 326 #define LLT_DEPENDENT 327 #define LLT_KEEP 328 #define LLT_KEPT 329 #define LLT_TEMP 330 #define LLT_SHARED 331 #define LLT_UNIQUE 332 #define LLT_UNUSED 333 #define LLT_EXITS 334 #define LLT_MAYEXIT 335 #define LLT_NEVEREXIT 336 #define LLT_TRUEEXIT 337 #define LLT_FALSEEXIT 338 #define LLT_UNDEF 339 #define LLT_KILLED 340 #define LLT_CHECKMOD 341 #define LLT_CHECKED 342 #define LLT_UNCHECKED 343 #define LLT_CHECKEDSTRICT 344 #define LLT_TRUENULL 345 #define LLT_FALSENULL 346 #define LLT_LNULL 347 #define LLT_LNOTNULL 348 #define LLT_RETURNED 349 #define LLT_OBSERVER 350 #define LLT_EXPOSED 351 #define LLT_REFCOUNTED 352 #define LLT_REFS 353 #define LLT_RELNULL 354 #define LLT_RELDEF 355 #define LLT_KILLREF 356 #define LLT_NULLTERMINATED 357 #define LLT_TEMPREF 358 #define LLT_NEWREF 359 #define LLT_PRIVATE 360 #define LLT_REQUIRES 361 #define LLT_RESULT 362 #define LLT_SIZEOF 363 #define LLT_SPEC 364 #define LLT_TAGGEDUNION 365 #define LLT_THEN 366 #define LLT_TYPE 367 #define LLT_TYPEDEF 368 #define LLT_UNCHANGED 369 #define LLT_USES 370 #define LLT_CHAR 371 #define LLT_CONST 372 #define LLT_DOUBLE 373 #define LLT_ENUM 374 #define LLT_FLOAT 375 #define LLT_INT 376 #define LLT_ITER 377 #define LLT_YIELD 378 #define LLT_LONG 379 #define LLT_SHORT 380 #define LLT_SIGNED 381 #define LLT_UNKNOWN 382 #define LLT_STRUCT 383 #define LLT_TELIPSIS 384 #define LLT_UNION 385 #define LLT_UNSIGNED 386 #define LLT_VOID 387 #define LLT_VOLATILE 388 #define LLT_PRINTFLIKE 389 #define LLT_SCANFLIKE 390 #define LLT_MESSAGELIKE 391 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { ltoken ltok; /* a leaf is also an ltoken */ qual typequal; unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ abstDeclaratorNode abstDecl; /*@only@*/ declaratorNode declare; /*@only@*/ declaratorNodeList declarelist; /*@only@*/ typeExpr typeexpr; /*@only@*/ arrayQualNode array; /*@only@*/ quantifierNode quantifier; /*@only@*/ quantifierNodeList quantifiers; /*@only@*/ varNode var; /*@only@*/ varNodeList vars; /*@only@*/ storeRefNode storeref; /*@only@*/ storeRefNodeList storereflist; /*@only@*/ termNode term; /*@only@*/ termNodeList termlist; /*@only@*/ programNode program; /*@only@*/ stmtNode stmt; /*@only@*/ claimNode claim; /*@only@*/ typeNode type; /*@only@*/ iterNode iter; /*@only@*/ fcnNode fcn; /*@only@*/ fcnNodeList fcns; /*@only@*/ letDeclNode letdecl; /*@only@*/ letDeclNodeList letdecls; /*@only@*/ lclPredicateNode lclpredicate; /*@only@*/ modifyNode modify; /*@only@*/ paramNode param; /*@only@*/ paramNodeList paramlist; /*@only@*/ declaratorInvNodeList declaratorinvs; /*@only@*/ declaratorInvNode declaratorinv; /*@only@*/ abstBodyNode abstbody; /*@only@*/ abstractNode abstract; /*@only@*/ exposedNode exposed; /*@only@*/ pointers pointers; /* taggedUnionNode taggedunion; */ /*@only@*/ globalList globals; /*@only@*/ constDeclarationNode constdeclaration; /*@only@*/ varDeclarationNode vardeclaration; /*@only@*/ varDeclarationNodeList vardeclarationlist; /*@only@*/ initDeclNodeList initdecls; /*@only@*/ initDeclNode initdecl; /*@only@*/ stDeclNodeList structdecls; /*@only@*/ stDeclNode structdecl; /*@only@*/ strOrUnionNode structorunion; /*@only@*/ enumSpecNode enumspec; /*@only@*/ lclTypeSpecNode lcltypespec; /*@only@*/ typeNameNode typname; /*@only@*/ opFormNode opform; /*@only@*/ sigNode signature; /*@only@*/ nameNode name; /*@only@*/ typeNameNodeList namelist; /*@only@*/ replaceNode replace; /*@only@*/ replaceNodeList replacelist; /*@only@*/ renamingNode renaming; /*@only@*/ traitRefNode traitref; /*@only@*/ traitRefNodeList traitreflist; /*@only@*/ importNode import; /*@only@*/ importNodeList importlist; /*@only@*/ interfaceNode iface; /*@only@*/ interfaceNodeList interfacelist; /*@only@*/ CTypesNode ctypes; /*@-redef@*/ } /* Line 1529 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yllval; /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/Headers/llgrammar_gen.h0000644021234200000250000003014510645776225016606 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton interface for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { simpleOp = 258, PREFIX_OP = 259, POSTFIX_OP = 260, LLT_MULOP = 261, LLT_SEMI = 262, LLT_VERTICALBAR = 263, ITERATION_OP = 264, selectSym = 265, LLT_LBRACKET = 266, LLT_LPAR = 267, LLT_IF_THEN_ELSE = 268, logicalOp = 269, eqSepSym = 270, equationSym = 271, commentSym = 272, LLT_WHITESPACE = 273, LLT_EOL = 274, LLT_TYPEDEF_NAME = 275, quantifierSym = 276, openSym = 277, closeSym = 278, sepSym = 279, simpleId = 280, mapSym = 281, markerSym = 282, preSym = 283, postSym = 284, anySym = 285, LLT_COLON = 286, LLT_COMMA = 287, LLT_EQUALS = 288, LLT_LBRACE = 289, LLT_RBRACE = 290, LLT_RBRACKET = 291, LLT_RPAR = 292, LLT_QUOTE = 293, eqOp = 294, LLT_CCHAR = 295, LLT_CFLOAT = 296, LLT_CINTEGER = 297, LLT_LCSTRING = 298, LLT_ALL = 299, LLT_ANYTHING = 300, LLT_BE = 301, LLT_BODY = 302, LLT_CLAIMS = 303, LLT_CHECKS = 304, LLT_CONSTANT = 305, LLT_ELSE = 306, LLT_ENSURES = 307, LLT_FOR = 308, LLT_FRESH = 309, LLT_IF = 310, LLT_IMMUTABLE = 311, LLT_IMPORTS = 312, LLT_CONSTRAINT = 313, LLT_ISSUB = 314, LLT_LET = 315, LLT_MODIFIES = 316, LLT_MUTABLE = 317, LLT_NOTHING = 318, LLT_INTERNAL = 319, LLT_FILESYS = 320, LLT_OBJ = 321, LLT_OUT = 322, LLT_SEF = 323, LLT_ONLY = 324, LLT_PARTIAL = 325, LLT_OWNED = 326, LLT_DEPENDENT = 327, LLT_KEEP = 328, LLT_KEPT = 329, LLT_TEMP = 330, LLT_SHARED = 331, LLT_UNIQUE = 332, LLT_UNUSED = 333, LLT_EXITS = 334, LLT_MAYEXIT = 335, LLT_NEVEREXIT = 336, LLT_TRUEEXIT = 337, LLT_FALSEEXIT = 338, LLT_UNDEF = 339, LLT_KILLED = 340, LLT_CHECKMOD = 341, LLT_CHECKED = 342, LLT_UNCHECKED = 343, LLT_CHECKEDSTRICT = 344, LLT_TRUENULL = 345, LLT_FALSENULL = 346, LLT_LNULL = 347, LLT_LNOTNULL = 348, LLT_RETURNED = 349, LLT_OBSERVER = 350, LLT_EXPOSED = 351, LLT_REFCOUNTED = 352, LLT_REFS = 353, LLT_RELNULL = 354, LLT_RELDEF = 355, LLT_KILLREF = 356, LLT_NULLTERMINATED = 357, LLT_TEMPREF = 358, LLT_NEWREF = 359, LLT_PRIVATE = 360, LLT_REQUIRES = 361, LLT_RESULT = 362, LLT_SIZEOF = 363, LLT_SPEC = 364, LLT_TAGGEDUNION = 365, LLT_THEN = 366, LLT_TYPE = 367, LLT_TYPEDEF = 368, LLT_UNCHANGED = 369, LLT_USES = 370, LLT_CHAR = 371, LLT_CONST = 372, LLT_DOUBLE = 373, LLT_ENUM = 374, LLT_FLOAT = 375, LLT_INT = 376, LLT_ITER = 377, LLT_YIELD = 378, LLT_LONG = 379, LLT_SHORT = 380, LLT_SIGNED = 381, LLT_UNKNOWN = 382, LLT_STRUCT = 383, LLT_TELIPSIS = 384, LLT_UNION = 385, LLT_UNSIGNED = 386, LLT_VOID = 387, LLT_VOLATILE = 388, LLT_PRINTFLIKE = 389, LLT_SCANFLIKE = 390, LLT_MESSAGELIKE = 391 }; #endif /* Tokens. */ #define simpleOp 258 #define PREFIX_OP 259 #define POSTFIX_OP 260 #define LLT_MULOP 261 #define LLT_SEMI 262 #define LLT_VERTICALBAR 263 #define ITERATION_OP 264 #define selectSym 265 #define LLT_LBRACKET 266 #define LLT_LPAR 267 #define LLT_IF_THEN_ELSE 268 #define logicalOp 269 #define eqSepSym 270 #define equationSym 271 #define commentSym 272 #define LLT_WHITESPACE 273 #define LLT_EOL 274 #define LLT_TYPEDEF_NAME 275 #define quantifierSym 276 #define openSym 277 #define closeSym 278 #define sepSym 279 #define simpleId 280 #define mapSym 281 #define markerSym 282 #define preSym 283 #define postSym 284 #define anySym 285 #define LLT_COLON 286 #define LLT_COMMA 287 #define LLT_EQUALS 288 #define LLT_LBRACE 289 #define LLT_RBRACE 290 #define LLT_RBRACKET 291 #define LLT_RPAR 292 #define LLT_QUOTE 293 #define eqOp 294 #define LLT_CCHAR 295 #define LLT_CFLOAT 296 #define LLT_CINTEGER 297 #define LLT_LCSTRING 298 #define LLT_ALL 299 #define LLT_ANYTHING 300 #define LLT_BE 301 #define LLT_BODY 302 #define LLT_CLAIMS 303 #define LLT_CHECKS 304 #define LLT_CONSTANT 305 #define LLT_ELSE 306 #define LLT_ENSURES 307 #define LLT_FOR 308 #define LLT_FRESH 309 #define LLT_IF 310 #define LLT_IMMUTABLE 311 #define LLT_IMPORTS 312 #define LLT_CONSTRAINT 313 #define LLT_ISSUB 314 #define LLT_LET 315 #define LLT_MODIFIES 316 #define LLT_MUTABLE 317 #define LLT_NOTHING 318 #define LLT_INTERNAL 319 #define LLT_FILESYS 320 #define LLT_OBJ 321 #define LLT_OUT 322 #define LLT_SEF 323 #define LLT_ONLY 324 #define LLT_PARTIAL 325 #define LLT_OWNED 326 #define LLT_DEPENDENT 327 #define LLT_KEEP 328 #define LLT_KEPT 329 #define LLT_TEMP 330 #define LLT_SHARED 331 #define LLT_UNIQUE 332 #define LLT_UNUSED 333 #define LLT_EXITS 334 #define LLT_MAYEXIT 335 #define LLT_NEVEREXIT 336 #define LLT_TRUEEXIT 337 #define LLT_FALSEEXIT 338 #define LLT_UNDEF 339 #define LLT_KILLED 340 #define LLT_CHECKMOD 341 #define LLT_CHECKED 342 #define LLT_UNCHECKED 343 #define LLT_CHECKEDSTRICT 344 #define LLT_TRUENULL 345 #define LLT_FALSENULL 346 #define LLT_LNULL 347 #define LLT_LNOTNULL 348 #define LLT_RETURNED 349 #define LLT_OBSERVER 350 #define LLT_EXPOSED 351 #define LLT_REFCOUNTED 352 #define LLT_REFS 353 #define LLT_RELNULL 354 #define LLT_RELDEF 355 #define LLT_KILLREF 356 #define LLT_NULLTERMINATED 357 #define LLT_TEMPREF 358 #define LLT_NEWREF 359 #define LLT_PRIVATE 360 #define LLT_REQUIRES 361 #define LLT_RESULT 362 #define LLT_SIZEOF 363 #define LLT_SPEC 364 #define LLT_TAGGEDUNION 365 #define LLT_THEN 366 #define LLT_TYPE 367 #define LLT_TYPEDEF 368 #define LLT_UNCHANGED 369 #define LLT_USES 370 #define LLT_CHAR 371 #define LLT_CONST 372 #define LLT_DOUBLE 373 #define LLT_ENUM 374 #define LLT_FLOAT 375 #define LLT_INT 376 #define LLT_ITER 377 #define LLT_YIELD 378 #define LLT_LONG 379 #define LLT_SHORT 380 #define LLT_SIGNED 381 #define LLT_UNKNOWN 382 #define LLT_STRUCT 383 #define LLT_TELIPSIS 384 #define LLT_UNION 385 #define LLT_UNSIGNED 386 #define LLT_VOID 387 #define LLT_VOLATILE 388 #define LLT_PRINTFLIKE 389 #define LLT_SCANFLIKE 390 #define LLT_MESSAGELIKE 391 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { ltoken ltok; /* a leaf is also an ltoken */ qual typequal; unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ abstDeclaratorNode abstDecl; /*@only@*/ declaratorNode declare; /*@only@*/ declaratorNodeList declarelist; /*@only@*/ typeExpr typeexpr; /*@only@*/ arrayQualNode array; /*@only@*/ quantifierNode quantifier; /*@only@*/ quantifierNodeList quantifiers; /*@only@*/ varNode var; /*@only@*/ varNodeList vars; /*@only@*/ storeRefNode storeref; /*@only@*/ storeRefNodeList storereflist; /*@only@*/ termNode term; /*@only@*/ termNodeList termlist; /*@only@*/ programNode program; /*@only@*/ stmtNode stmt; /*@only@*/ claimNode claim; /*@only@*/ typeNode type; /*@only@*/ iterNode iter; /*@only@*/ fcnNode fcn; /*@only@*/ fcnNodeList fcns; /*@only@*/ letDeclNode letdecl; /*@only@*/ letDeclNodeList letdecls; /*@only@*/ lclPredicateNode lclpredicate; /*@only@*/ modifyNode modify; /*@only@*/ paramNode param; /*@only@*/ paramNodeList paramlist; /*@only@*/ declaratorInvNodeList declaratorinvs; /*@only@*/ declaratorInvNode declaratorinv; /*@only@*/ abstBodyNode abstbody; /*@only@*/ abstractNode abstract; /*@only@*/ exposedNode exposed; /*@only@*/ pointers pointers; /* taggedUnionNode taggedunion; */ /*@only@*/ globalList globals; /*@only@*/ constDeclarationNode constdeclaration; /*@only@*/ varDeclarationNode vardeclaration; /*@only@*/ varDeclarationNodeList vardeclarationlist; /*@only@*/ initDeclNodeList initdecls; /*@only@*/ initDeclNode initdecl; /*@only@*/ stDeclNodeList structdecls; /*@only@*/ stDeclNode structdecl; /*@only@*/ strOrUnionNode structorunion; /*@only@*/ enumSpecNode enumspec; /*@only@*/ lclTypeSpecNode lcltypespec; /*@only@*/ typeNameNode typname; /*@only@*/ opFormNode opform; /*@only@*/ sigNode signature; /*@only@*/ nameNode name; /*@only@*/ typeNameNodeList namelist; /*@only@*/ replaceNode replace; /*@only@*/ replaceNodeList replacelist; /*@only@*/ renamingNode renaming; /*@only@*/ traitRefNode traitref; /*@only@*/ traitRefNodeList traitreflist; /*@only@*/ importNode import; /*@only@*/ importNodeList importlist; /*@only@*/ interfaceNode iface; /*@only@*/ interfaceNodeList interfacelist; /*@only@*/ CTypesNode ctypes; /*@-redef@*/ } /* Line 1529 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif extern YYSTYPE yllval; /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/Headers/usymtab.h0000644021234200000250000003125607706100771015456 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** usymtab.h */ # ifndef USYMTAB_H # define USYMTAB_H /*@constant null usymtab GLOBAL_ENV; @*/ # define GLOBAL_ENV usymtab_undefined typedef enum { US_GLOBAL, US_NORMAL, US_TBRANCH, US_FBRANCH, US_CBRANCH, US_SWITCH } uskind; typedef struct { int level; int index; } *refentry; typedef /*@only@*/ refentry o_refentry; typedef o_refentry *refTable; struct s_usymtab { uskind kind; int nentries; int nspace; int lexlevel; bool mustBreak; exitkind exitCode; /*@reldef@*/ /*@only@*/ o_uentry *entries; /*@null@*/ /*@only@*/ cstringTable htable; /* for the global environment */ /*@null@*/ /*@only@*/ refTable reftable; /* for branched environments */ /*@only@*/ guardSet guards; /* guarded references (not null) */ aliasTable aliases; /*@owned@*/ usymtab env; } ; /* ** rep invariant: ** ** (left as exercise to reader) ;) */ extern void usymtab_printTypes (void) /*@globals internalState@*/ /*@modifies g_warningstream@*/ ; extern void usymtab_setMustBreak (void) /*@modifies internalState@*/ ; extern bool usymtab_inGlobalScope (void) /*@globals internalState@*/ ; extern bool usymtab_inFunctionScope (void) /*@globals internalState@*/ ; extern bool usymtab_inFileScope (void) /*@globals internalState@*/ ; extern void usymtab_checkFinalScope (bool p_isReturn) /*@globals internalState@*/ /*@modifies *g_warningstream@*/ ; extern void usymtab_allUsed (void) /*@globals internalState@*/ /*@modifies *g_warningstream@*/ ; extern void usymtab_allDefined (void) /*@globals internalState@*/ /*@modifies *g_warningstream@*/ ; extern void usymtab_prepareDump (void) /*@modifies internalState@*/ ; extern void usymtab_dump (FILE *p_fout) /*@globals internalState@*/ /*@modifies *p_fout@*/ ; extern void usymtab_load (FILE *p_f) /*@modifies p_f, internalState@*/ ; extern /*@exposed@*/ /*@dependent@*/ uentry usymtab_getRefQuiet (int p_level, usymId p_index) /*@globals internalState@*/ ; extern void usymtab_printLocal (void) /*@globals internalState@*/ /*@modifies stdout@*/ ; extern /*@exposed@*/ /*@dependent@*/ uentry usymtab_getParam (int p_paramno) /*@globals internalState@*/; extern void usymtab_free (void) /*@modifies internalState@*/ ; extern bool usymtab_inDeepScope (void) /*@globals internalState@*/ ; extern /*@exposed@*/ uentry usymtab_lookupExpose (cstring p_k) /*@globals internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookup (cstring p_k) /*@globals internalState@*/ ; # define usymtab_lookup(s) (usymtab_lookupExpose (s)) extern /*@observer@*/ uentry usymtab_lookupGlob (cstring p_k) /*@globals internalState@*/ ; extern /*@exposed@*/ uentry usymtab_lookupExposeGlob (cstring p_k) /*@globals internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookupUnionTag (cstring p_k) /*@globals internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookupStructTag (cstring p_k) /*@globals internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookupEither (cstring p_k) /*@globals internalState@*/ ; extern ctype usymtab_lookupType (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_isDefinitelyNull (sRef p_s) /*@globals internalState@*/ ; extern bool usymtab_isDefinitelyNullDeep (sRef p_s) /*@globals internalState@*/ ; extern usymId usymtab_supExposedTypeEntry (/*@only@*/ uentry p_e, bool p_dodef) /*@modifies internalState, p_e@*/ ; extern ctype usymtab_supTypeEntry (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern /*@exposed@*/ uentry usymtab_supReturnTypeEntry (/*@only@*/ uentry p_e) /*@modifies internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookupSafe (cstring p_k) /*@globals internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookupSafeScope (cstring p_k, int p_lexlevel) /*@globals internalState@*/ ; extern /*@observer@*/ uentry usymtab_getGlobalEntry (usymId p_uid) /*@globals internalState@*/ ; extern bool usymtab_exists (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_existsVar (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_existsGlob (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_existsType (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_existsEither (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_existsTypeEither (cstring p_k) /*@globals internalState@*/ ; extern usymId usymtab_getId (cstring p_k) /*@globals internalState@*/ ; extern typeId usymtab_getTypeId (cstring p_k) /*@globals internalState@*/ ; extern void usymtab_supEntry (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern void usymtab_replaceEntry (/*@only@*/ uentry p_s) /*@modifies internalState, p_s@*/ ; extern void usymtab_supEntrySref (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern void usymtab_supGlobalEntry (/*@only@*/ uentry p_e) /*@modifies internalState@*/ ; extern void usymtab_addGlobalEntry (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern /*@exposed@*/ uentry usymtab_supEntryReturn (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern usymId usymtab_addEntry (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern ctype usymtab_lookupAbstractType (cstring p_k) /*@globals internalState@*/ /*@modifies nothing@*/ ; extern bool usymtab_matchForwardStruct (typeId p_u1, typeId p_u2) /*@globals internalState@*/ ; extern bool usymtab_existsEnumTag (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_existsUnionTag (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_existsStructTag (cstring p_k) /*@globals internalState@*/ ; /*@iter usymtab_entries (sef usymtab u, yield exposed uentry el); @*/ # define usymtab_entries(x, m_i) \ { int m_ind; \ if (usymtab_isDefined (x)) \ for (m_ind = 0; m_ind < (x)->nentries; m_ind++) \ { uentry m_i = (x)->entries[m_ind]; # define end_usymtab_entries }} extern /*@unused@*/ void usymtab_displayAllUses (void) /*@globals internalState@*/ /*@modifies *g_warningstream@*/ ; extern /*@unused@*/ void usymtab_printOut (void) /*@globals internalState@*/ /*@modifies *g_warningstream@*/ ; extern /*@unused@*/ void usymtab_printAll (void) /*@globals internalState@*/ /*@modifies *g_warningstream@*/ ; extern void usymtab_enterScope (void) /*@modifies internalState;@*/ ; extern void usymtab_enterFunctionScope (uentry p_fcn) /*@modifies internalState;@*/ ; extern void usymtab_quietExitScope (fileloc p_loc) /*@modifies internalState;@*/ ; extern void usymtab_exitScope (exprNode p_expr) /*@modifies internalState@*/ ; extern void usymtab_addGuards (guardSet p_guards) /*@modifies internalState@*/ ; extern void usymtab_setExitCode (exitkind p_ex) /*@modifies internalState@*/ ; extern void usymtab_exitFile (void) /*@modifies internalState@*/ ; extern void usymtab_enterFile (void) /*@modifies internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookupEnumTag (cstring p_k) /*@globals internalState@*/ ; extern usymId usymtab_convertId (usymId p_uid) /*@globals internalState@*/ ; extern typeId usymtab_convertTypeId (typeId p_uid) /*@globals internalState@*/ ; extern void usymtab_initMod (void) /*@modifies internalState@*/ ; extern void usymtab_destroyMod (void) /*@modifies internalState@*/ ; extern void usymtab_initBool (void) /*@modifies internalState@*/ ; extern void usymtab_initGlobalMarker (void) /*@modifies internalState@*/ ; extern void usymtab_exportHeader (void) /*@modifies internalState@*/ ; extern ctype usymtab_structFieldsType (uentryList p_f) /*@globals internalState@*/ ; extern ctype usymtab_unionFieldsType (uentryList p_f) /*@globals internalState@*/ ; extern ctype usymtab_enumEnumNameListType (enumNameList p_f) /*@globals internalState@*/ ; extern /*@exposed@*/ uentry usymtab_getTypeEntrySafe (typeId p_uid) /*@globals internalState@*/ ; extern void usymtab_popOrBranch (exprNode p_pred, exprNode p_expr) /*@modifies internalState@*/ ; extern void usymtab_popAndBranch (exprNode p_pred, exprNode p_expr) /*@modifies internalState@*/ ; extern void usymtab_trueBranch (/*@only@*/ guardSet p_guards) /*@modifies internalState@*/ ; extern void usymtab_altBranch (/*@only@*/ guardSet p_guards) /*@modifies internalState@*/ ; extern void usymtab_popTrueBranch (exprNode p_pred, exprNode p_expr, clause p_cl) /*@modifies internalState@*/ ; extern void usymtab_popTrueExecBranch (exprNode p_pred, exprNode p_expr, clause p_cl) /*@modifies internalState@*/ ; extern void usymtab_popBranches (exprNode p_pred, exprNode p_tbranch, exprNode p_fbranch, bool p_isOpt, clause p_cl) /*@modifies internalState@*/ ; extern void usymtab_unguard (sRef p_s) /*@modifies internalState@*/ ; extern bool usymtab_isGuarded (sRef p_s) /*@globals internalState@*/ ; extern void usymtab_printGuards (void) /*@globals internalState@*/ /*@modifies *g_warningstream@*/ ; extern void usymtab_quietPlainExitScope (void) /*@modifies internalState@*/ ; extern void usymtab_printComplete (void) /*@globals internalState@*/ /*@modifies *stdout@*/ ; extern bool usymtab_existsGlobEither (cstring p_k) /*@globals internalState@*/ ; extern bool usymtab_isBoolType (typeId p_uid) /*@globals internalState@*/ ; extern /*@only@*/ cstring usymtab_getTypeEntryName (typeId p_uid) /*@globals internalState@*/ ; extern /*@exposed@*/ uentry usymtab_getTypeEntry (typeId p_uid) /*@globals internalState@*/ ; extern typeId usymtab_supAbstractTypeEntry (/*@only@*/ uentry p_e, bool p_dodef) /*@modifies internalState, p_e@*/ ; extern ctype usymtab_supForwardTypeEntry (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern /*@exposed@*/ uentry usymtab_supGlobalEntryReturn (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern /*@exposed@*/ uentry usymtab_supEntrySrefReturn (/*@only@*/ uentry p_e) /*@modifies internalState, p_e@*/ ; extern usymId usymtab_directParamNo (uentry p_ue) /*@globals internalState@*/ ; extern bool usymtab_newCase (exprNode p_pred, exprNode p_last) /*@modifies internalState@*/ ; extern void usymtab_switchBranch (exprNode p_s) /*@modifies internalState@*/ ; extern /*@only@*/ cstring usymtab_unparseStack (void) /*@globals internalState@*/ ; extern void usymtab_exitSwitch (exprNode p_sw, bool p_allpaths) /*@modifies internalState@*/ ; extern /*@observer@*/ uentry usymtab_lookupGlobSafe (cstring p_k) /*@globals internalState@*/ ; extern /*@only@*/ sRefSet usymtab_aliasedBy (sRef p_s) /*@globals internalState@*/ ; extern /*@only@*/ sRefSet usymtab_canAlias (sRef p_s) /*@globals internalState@*/ ; extern void usymtab_clearAlias (sRef p_s) /*@modifies internalState, p_s@*/ ; extern void usymtab_addMustAlias (/*@exposed@*/ sRef p_s, /*@exposed@*/ sRef p_al) /*@modifies internalState@*/ ; extern void usymtab_addForceMustAlias (/*@exposed@*/ sRef p_s, /*@exposed@*/ sRef p_al) /*@modifies internalState@*/ ; extern /*@only@*/ cstring usymtab_unparseAliases (void) /*@globals internalState@*/ ; extern /*@exposed@*/ uentry usymtab_supReturnFileEntry (/*@only@*/ uentry p_e) /*@modifies internalState@*/ ; extern bool usymtab_isAltDefinitelyNullDeep (sRef p_s) /*@globals internalState@*/ ; extern bool usymtab_existsReal (cstring p_k) /*@globals internalState@*/ ; extern /*@only@*/ sRefSet usymtab_allAliases (sRef p_s) /*@globals internalState@*/ ; extern void usymtab_exportLocal (void) /*@modifies internalState@*/ ; extern void usymtab_popCaseBranch (void) /*@modifies internalState@*/ ; /* special scopes */ /*@constant int globScope;@*/ # define globScope 0 /* global variables */ /*@constant int fileScope;@*/ # define fileScope 1 /* file-level static variables */ /*@constant int paramsScope;@*/ # define paramsScope 2 /* function parameters */ /*@constant int functionScope;@*/ # define functionScope 3 extern /*@falsewhennull@*/ bool usymtab_isDefined (usymtab p_u) /*@*/ ; /*@constant null usymtab usymtab_undefined; @*/ # define usymtab_undefined ((usymtab)NULL) # define usymtab_isDefined(u) ((u) != usymtab_undefined) extern void usymtab_checkDistinctName (uentry p_e, int p_scope) /*@globals internalState@*/ /*@modifies *g_warningstream, p_e@*/ ; extern /*@exposed@*/ sRef usymtab_lookupGlobalMarker (void) /*@globals internalState@*/ ; extern void usymtab_addReallyForceMustAlias (/*@exposed@*/ sRef p_s, /*@exposed@*/ sRef p_al) /*@modifies internalState@*/ ; extern int usymtab_getCurrentDepth (void) /*@globals internalState@*/ ; # ifdef DEBUGSPLINT extern void usymtab_checkAllValid (void) /*@modifies g_errorstream@*/ ; # endif # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/llgrammar.h0000644021234200000250000000036407443751373015754 0ustar fax# ifndef LLGRAMMAR_H # define LLGRAMMAR_H # include "llgrammar_gen.h" /*@-redecl@*/ /*@-declundef@*/ extern void ylerror (char *p_s) /*@modifies *g_warningstream@*/ ; /*@=redecl@*/ /*@=declundef@*/ # else # error "Multiple includes" # endif splint-3.1.2.dfsg1/src/Headers/usymtab_interface.h0000644021234200000250000000262107630463450017472 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef USYMTAB_INTERFACE_H # define USYMTAB_INTERFACE_H extern void doDeclareConstant (constDeclarationNode, bool); extern void doDeclareVar (varDeclarationNode, bool); extern void doDeclareType (typeNode, bool); extern void doDeclareFcn (fcnNode p_f, typeId p_tn, bool p_priv, bool p_spec); extern void declareIter (iterNode p_iter); extern void declareConstant (constDeclarationNode); extern void declareVar (varDeclarationNode); extern void declareType (typeNode); extern void declareFcn (fcnNode p_f, typeId p_t); extern void declarePrivConstant (constDeclarationNode); extern void declarePrivVar (varDeclarationNode); extern void declarePrivType (typeNode); extern void declarePrivFcn (fcnNode p_f, typeId p_t); # define declareConstant(c) doDeclareConstant(c, FALSE) # define declareVar(c) doDeclareVar(c, FALSE) # define declareType(c) doDeclareType(c, FALSE) # define declareFcn(f, t) doDeclareFcn(f, t, FALSE, TRUE) # define declarePrivConstant(c) doDeclareConstant(c, TRUE) # define declarePrivVar(c) doDeclareVar(c, TRUE) # define declarePrivType(c) doDeclareType(c, TRUE) # define declarePrivFcn(f, t) doDeclareFcn(f, t, TRUE, TRUE) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/llmain.h0000644021234200000250000000164307630463447015253 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LLMAIN_H # define LLMAIN_H extern int main (int p_argc, char *p_argv[]) /*@globals killed undef g_currentloc, killed undef g_currentSpec, killed undef g_currentSpecName, killed undef g_currentloc, killed undef yyin, undef g_warningstream; @*/ /*@modifies g_currentloc, g_currentSpec, g_currentSpecName, yyin, internalState, fileSystem; @*/ ; extern /*@noreturn@*/ void llexit (int p_status); extern void showHerald (void); /*@-redecl@*/ /*@-incondefs@*/ /*@-declundef@*/ extern int yyparse (void); extern void yyrestart (/*@dependent@*/ FILE *); extern int ylparse (void); extern int lslparse (void); extern /*:open:*/ /*@dependent@*/ FILE *yyin; /*@=incondefs@*/ /*@=redecl@*/ /*@=declundef@*/ # endif splint-3.1.2.dfsg1/src/Headers/valueMatrix.h0000644021234200000250000000447707630463450016302 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** valueMatrix.h */ /* ** key -> (int x int -> int x cstring) ** e.g., "null" -> null x notnull -> error x "attempt to ..." */ # ifndef VALUEMATRIX_H # define VALUEMATRIX_H /* in forward types: abst_typedef genericTable valueMatrix; */ /*@constant null valueMatrix valueMatrix_undefined; @*/ # define valueMatrix_undefined genericTable_undefined extern /*@falsewhennull@*/ bool valueMatrix_isDefined(valueMatrix) /*@*/ ; # define valueMatrix_isDefined(p_h) (genericTable_isDefined ((genericTable) (p_h))) extern /*@nullwhentrue@*/ bool valueMatrix_isUndefined(valueMatrix) /*@*/ ; # define valueMatrix_isUndefined(p_h) (genericTable_isDefined ((genericTable) (p_h))) extern /*@only@*/ valueMatrix valueMatrix_create(int p_size); # define valueMatrix_create(p_s) ((valueMatrix) genericTable_create (p_s)) extern void valueMatrix_insert (valueMatrix p_h, /*@dependent@*/ cstring p_key, /*@only@*/ stateCombinationTable p_value); # define valueMatrix_insert(p_h,p_key,p_value) \ (genericTable_insert ((valueMatrxi) (p_h), p_key, (void *) (p_value))) extern /*@null@*/ /*@dependent@*/ /*@exposed@*/ stateCombinationTable valueMatrix_lookup (valueMatrix p_h, cstring p_key) /*@*/ ; # define valueMatrix_lookup(p_h,p_key) \ ((stateCombinationTable) genericTable_lookup ((genericTable) (p_h), p_key)) extern /*@unused@*/ /*@only@*/ cstring valueMatrix_stats(valueMatrix p_h); # define valueMatrix_stats(p_h) genericTable_stats ((genericTable) (p_h)) extern void valueMatrix_free (/*@only@*/ valueMatrix p_h); # define valueMatrix_free(p_h) (genericTable_free ((genericTable) (p_h))) extern void valueMatrix_remove (valueMatrix p_h, cstring p_key) /*@modifies p_h@*/ ; # define valueMatrix_remove(p_h,p_key) (genericTable_remove ((genericTable) (p_h), p_key)) /*@iter valueMatrix_elements (sef valueMatrix p_g, yield exposed cstring m_key, yield exposed stateCombinationTable m_el)@*/ # define valueMatrix_elements(p_g,m_key,m_el) genericTable_elements((genericTable) (p_g), m_key, m_el) # define end_valueMatrix_elements end_genericTable_elements extern int valueMatrix_size (valueMatrix p_h); # define valueMatrix_size(p_h) (genericTable_size(p_h)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lltok.h0000644021234200000250000000353707630463447015130 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lltok.h */ # ifndef LLTOK_H # define LLTOK_H typedef /*@abstract@*/ struct { int tok; fileloc loc; } *lltok; extern lltok lltok_create (int p_tok, /*@only@*/ fileloc p_loc) /*@modifies nothing@*/ ; extern /*@observer@*/ cstring lltok_unparse (lltok p_tok) /*@*/ ; extern void lltok_free (/*@only@*/ lltok p_t) ; extern void lltok_free2 (/*@only@*/ lltok p_t1, /*@only@*/ lltok p_t2) ; extern void lltok_free3 (/*@only@*/ lltok p_t1, /*@only@*/ lltok p_t2, /*@only@*/ lltok p_t3) ; extern /*@dependent@*/ /*@exposed@*/ fileloc lltok_getLoc (lltok p_t) /*@*/ ; extern int lltok_getTok (lltok p_t) /*@*/ ; # define lltok_getTok(t) ((t)->tok) # define lltok_getLoc(t) ((t)->loc) extern bool lltok_isSemi (lltok p_tok); /* DRL added 10/23/2000 for boolean stuff */ extern bool lltok_isEqOp (lltok p_tok); extern bool lltok_isNotEqOp (lltok p_tok); extern bool lltok_isMult (lltok p_tok); extern bool lltok_isIncOp (lltok p_tok); extern bool lltok_isAndOp (lltok p_tok); extern bool lltok_isOrOp (lltok p_tok); extern bool lltok_isNotOp (lltok p_tok); /*drl7x added this function 11/20/00 */ extern bool lltok_isLt_Op (lltok p_tok); extern bool lltok_isGt_Op (lltok p_tok); extern bool lltok_isGe_Op (lltok p_tok); extern bool lltok_isLe_Op (lltok p_tok); /* end drl7x added */ /*drl7x added 11 30 2000*/ bool lltok_isPlus_Op (lltok p_tok); bool lltok_isMinus_Op (lltok p_tok); /*end drl added */ /*drl added 1/14/2001 */ bool lltok_isDecOp (lltok p_tok); bool lltok_isAmpersand_Op (lltok p_tok); extern bool lltok_isExcl_Op (lltok p_tok); extern bool lltok_isTilde_Op (lltok p_tok); extern bool lltok_isEnsures (lltok p_tok); extern bool lltok_isRequires (lltok p_tok); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/valueTable.h0000644021234200000250000000447007630463450016056 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** valueTable.h */ /* ** valueTable is a table of stateValue's. ** Based on genericTable */ # ifndef VTABLE_H # define VTABLE_H /*@constant null valueTable valueTable_undefined; @*/ # define valueTable_undefined genericTable_undefined extern /*@falsewhennull@*/ bool valueTable_isDefined(valueTable) /*@*/ ; # define valueTable_isDefined(p_h) (genericTable_isDefined ((genericTable) (p_h))) extern /*@nullwhentrue@*/ bool valueTable_isUndefined(valueTable) /*@*/ ; # define valueTable_isUndefined(p_h) (genericTable_isUndefined ((genericTable) (p_h))) extern /*@only@*/ valueTable valueTable_create(int p_size); # define valueTable_create(p_s) ((valueTable) genericTable_create (p_s)) extern void valueTable_insert (valueTable p_h, /*@only@*/ cstring p_key, /*@only@*/ stateValue p_value); /*@access stateValue@*/ extern /*@null@*/ /*@dependent@*/ /*@exposed@*/ stateValue valueTable_lookup (valueTable p_h, cstring p_key) /*@*/ ; # define valueTable_lookup(p_h,p_key) \ ((stateValue) genericTable_lookup ((genericTable) (p_h), p_key)) /*@noaccess stateValue@*/ extern bool valueTable_contains (valueTable p_h, cstring p_key) /*@*/ ; # define valueTable_contains(p_h,p_key) \ (stateValue_isDefined (valueTable_lookup (p_h, p_key))) extern /*@unused@*/ /*@only@*/ cstring valueTable_stats(valueTable p_h); # define valueTable_stats(p_h) genericTable_stats ((genericTable) (p_h)) extern void valueTable_free (/*@only@*/ valueTable p_h); # define valueTable_free(p_h) (genericTable_free ((genericTable) (p_h))) extern /*@only@*/ cstring valueTable_unparse (valueTable p_h) /*@*/ ; extern void valueTable_update (valueTable p_h, cstring p_key, /*@owned@*/ stateValue p_newval) /*@modifies p_h@*/ ; extern /*@only@*/ valueTable valueTable_copy (valueTable p_s) ; /*@iter valueTable_elements (sef valueTable p_g, yield exposed cstring m_key, yield exposed stateValue m_el)@*/ # define valueTable_elements(p_g, m_key, m_el) genericTable_elements (p_g, m_key, m_el) # define end_valueTable_elements end_genericTable_elements extern int valueTable_size (valueTable p_h) /*@*/ ; # define valueTable_size(p_h) (genericTable_size(p_h)) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lslinit.h0000644021234200000250000001226307630463447015455 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lslinit.h */ enum e_LSLInitRuleCode { /* initFile: */ INITFILE1, /* initLines EOF */ /* initLines: */ INITLINES1, /* */ INITLINES2, /* initLine */ INITLINES3, /* initLines initLine */ /* initLine: */ INITLINE1, /* EOL */ INITLINE2, /* classification EOL */ /* classification: */ CLASSIFICATION1, /* charClass */ CLASSIFICATION2, /* tokenClass */ CLASSIFICATION3, /* synClass */ /* charClass: */ CHARCLASS1, /* ENDCOMMENTCHAR endCommentChars */ CHARCLASS2, /* IDCHAR idChars */ CHARCLASS3, /* OPCHAR opChars */ CHARCLASS4, /* CHC_EXTENSION extensionChar */ CHARCLASS5, /* SINGLECHAR singChars */ CHARCLASS6, /* WHITECHAR whiteChars */ /* endCommentChars: */ LRC_ENDCOMMENT1, /* endCommentChar */ LRC_ENDCOMMENT2, /* endCommentChars endCommentChar */ /* idChars: */ IDCHARS1, /* idChar */ IDCHARS2, /* idChars idChar */ /* opChars */ OPCHARS1, /* opChar */ OPCHARS2, /* opChars opChar */ /* ExtensionChar */ LRC_EXTENSIONCHAR1, /* singleChar */ /* singChars */ SINGCHARS1, /* singChar */ SINGCHARS2, /* singChars singChar */ /* whiteChars */ WHITECHARS1, /* whiteChar */ WHITECHARS2, /* whiteChars whiteChar */ /* endCommentChar */ LRC_ENDCOMMENTCHAR1, /* commentChar */ /* idChar */ IDCHAR1, /* singleChar */ /* opChar */ OPCHAR1, /* singleChar */ /* singChar */ SINGCHAR1, /* singleChar */ /* whiteChar */ WHITECHAR1, /* singleChar */ /* tokenClass: */ TOKENCLASS1, /* QUANTIFIERSYM quantifierSymToks */ TOKENCLASS2, /* LOGICALOP logicalOpToks */ TOKENCLASS3, /* EQOP eqOpToks */ TOKENCLASS4, /* EQUATIONSYM equationSymToks */ TOKENCLASS5, /* EQSEPSYM eqSepSymToks */ TOKENCLASS6, /* SELECTSYM selectSymToks */ TOKENCLASS7, /* OPENSYM openSymToks */ TOKENCLASS8, /* SEPSYM sepSymToks */ TOKENCLASS9, /* CLOSESYM closeSymToks */ TOKENCLASS10, /* SIMPLEID simpleIdToks */ TOKENCLASS11, /* MAPSYM mapSymToks */ TOKENCLASS12, /* MARKERSYM markerSymToks */ TOKENCLASS13, /* COMMENTSYM commentSymToks */ /* quantifierSymToks */ QUANTIFIERSYMTOKS1,/* quantifierSymTok */ QUANTIFIERSYMTOKS2,/* quantifierSymToks quantifierSymTok */ /* logicalOpToks */ LOGICALOPTOKS1, /* logicalOpTok */ LOGICALOPTOKS2, /* logicalOpToks logicalOpTok */ /* eqOpToks */ LRC_EQOPTOKS1, /* eqOpTok */ LRC_EQOPTOKS2, /* eqOpToks eqOpTok */ /* equationSymToks */ LRC_EQUATIONSYMTOKS1, /* equationSymTok */ LRC_EQUATIONSYMTOKS2, /* equationSymToks equationSymTok */ /* eqSepSymToks */ LRC_EQSEPSYMTOKS1, /* eqSepSymTok */ LRC_EQSEPSYMTOKS2, /* eqSepSymToks eqSepSymTok */ /* selectSymToks */ SELECTSYMTOKS1, /* selectSymTok */ SELECTSYMTOKS2, /* selectSymToks selectSymTok */ /* openSymToks */ OPENSYMTOKS1, /* openSymTok */ OPENSYMTOKS2, /* openSymToks openSymTok */ /* sepSymToks */ SEPSYMTOKS1, /* sepSymTok */ SEPSYMTOKS2, /* sepSymToks sepSymTok */ /* closeSymToks */ CLOSESYMTOKS1, /* closeSymTok */ CLOSESYMTOKS2, /* closeSymToks closeSymTok */ /* simpleIdToks */ SIMPLEIDTOKS1, /* simpleIdTok */ SIMPLEIDTOKS2, /* simpleIdToks simpleIdTok */ /* mapSymToks */ MAPSYMTOKS1, /* mapSymTok */ MAPSYMTOKS2, /* mapSymToks mapSymTok */ /* markerSymToks */ MARKERSYMTOKS1, /* markerSymTok */ MARKERSYMTOKS2, /* markerSymToks markerSymTok */ /* commentSymToks */ COMMENTSYMTOKS1, /* commentSymTok */ COMMENTSYMTOKS2, /* commentSymToks commentSymTok */ /* quantifierSymTok */ QUANTIFIERSYMTOK1, /* token */ /* logicalOpTok */ LOGICALOPTOK1, /* token */ /* eqOpTok */ LRC_EQOPTOK1, /* token */ /* equationSymTok */ LRC_EQUATIONSYMTOK1, /* token */ /* eqSepSymTok */ LRC_EQSEPSYMTOK1, /* token */ /* selectSymTok */ SELECTSYMTOK1, /* token */ /* openSymTok */ OPENSYMTOK1, /* token */ /* sepSymTok */ SEPSYMTOK1, /* token */ /* closeSymTok */ CLOSESYMTOK1, /* token */ /* simpleIdTok */ SIMPLEIDTOK1, /* token */ /* mapSymTok */ MAPSYMTOK1, /* token */ /* markerSymTok */ MARKERSYMTOK1, /* token */ /* commentSymTok */ COMMENTSYMTOK1, /* token */ /* synClass: */ SYNCLASS1, /* SYNONYM oldToken newToken */ /* oldToken: */ OLDTOKEN1, /* token */ /* newToken: */ NEWTOKEN1 /* token */ } ; extern void lslinit_setInitFile (/*@only@*/ inputStream p_s) /*@modifies internalState@*/ ; extern void lslinit_process (void) /*@globals undef g_symtab; @*/ /*@modifies g_symtab, internalState, fileSystem; @*/ ; splint-3.1.2.dfsg1/src/Headers/varDeclarationNode.h0000644021234200000250000000136707630463450017540 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef VARDECLNODE_H # define VARDECLNODE_H typedef struct { bool isSpecial; /*@dependent@*/ /*@reldef@*/ sRef sref; bool isGlobal; /* global or varDeclaration */ bool isPrivate; /* static variable, within a function defn */ qualifierKind qualifier; /* QLF_NONE, QLF_CONST, or QLF_VOLATILE */ lclTypeSpecNode type; initDeclNodeList decls; } *varDeclarationNode; extern void varDeclarationNode_free (/*@only@*/ /*@null@*/ varDeclarationNode p_x); extern /*@unused@*/ /*@only@*/ cstring varDeclarationNode_unparse (/*@null@*/ varDeclarationNode p_x) /*@*/; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lslOp.h0000644021234200000250000000060307630463447015063 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ typedef struct { /*@null@*/ /*@only@*/ nameNode name; /*@dependent@*/ sigNode signature; /* optional */ } *lslOp; typedef /*@only@*/ lslOp o_lslOp; extern void lslOp_free (/*@only@*/ lslOp p_x); extern /*@only@*/ lslOp lslOp_copy (lslOp); splint-3.1.2.dfsg1/src/Headers/varDeclarationNodeList.h0000644021234200000250000000252707630463450020373 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef VARDECLARATIONNODELIST_H # define VARDECLARATIONNODELIST_H typedef /*@only@*/ varDeclarationNode o_varDeclarationNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_varDeclarationNode *elements; } *varDeclarationNodeList ; /*@iter varDeclarationNodeList_elements (sef varDeclarationNodeList x, yield exposed varDeclarationNode el); @*/ # define varDeclarationNodeList_elements(x, m_el) \ { int m_ind; varDeclarationNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { varDeclarationNode m_el = *(m_elements++); # define end_varDeclarationNodeList_elements }} extern /*@only@*/ varDeclarationNodeList varDeclarationNodeList_new (void) /*@*/ ; extern void varDeclarationNodeList_addh (varDeclarationNodeList p_s, /*@keep@*/ varDeclarationNode p_el) /*@modifies p_s@*/ ; extern /*@only@*/ cstring varDeclarationNodeList_unparse (varDeclarationNodeList p_s) /*@*/ ; extern void varDeclarationNodeList_free (/*@only@*/ varDeclarationNodeList p_s) ; /*@constant int varDeclarationNodeListBASESIZE;@*/ # define varDeclarationNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lslOpList.h0000644021234200000250000000132707630463447015723 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef lslOpLIST_H # define lslOpLIST_H typedef /*@exposed@*/ lslOp e_lslOp; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@only@*/ /*@relnull@*/ e_lslOp *elements; } *lslOpList ; extern /*@only@*/ lslOpList lslOpList_new(void); extern void lslOpList_add (lslOpList p_s, /*@exposed@*/ lslOp p_el) ; extern /*@unused@*/ /*@only@*/ cstring lslOpList_unparse (lslOpList p_s) ; extern void lslOpList_free (/*@only@*/ lslOpList p_s) ; /*@constant int lslOpListBASESIZE;@*/ # define lslOpListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/varKinds.h0000644021234200000250000002173207444476032015556 0ustar fax/* ** varKinds.h */ # ifndef VARKINDSH # define VARKINDSH /* ** states of storage */ typedef enum { SS_UNKNOWN, SS_UNUSEABLE, /* cannot use (unallocated pointer reference) */ SS_UNDEFINED, /* cannot use value (e.g., unbound variable) */ SS_MUNDEFINED,/* maybe undefined */ SS_ALLOCATED, /* allocated pointer */ SS_PDEFINED, /* partially defined: must check reachable values */ SS_DEFINED, /* completely defined: can use value and all reachable values */ SS_PARTIAL, /* defined, but can be bashed without error (partial structure returned) */ SS_DEAD, /* cannot use (after giving aways as only) * same meaning as UNUSEABLE, except that we * want to generate better error messages. */ SS_HOFFA, /* "probably dead" */ SS_FIXED, /* cannot modify */ SS_RELDEF, /* a structure field that may or may not be defined (up to * programmer to worry about it. */ SS_UNDEFGLOB, /* global only: undefined before call */ SS_KILLED, /* global only: undefined after call */ SS_UNDEFKILLED, /* global only: undefined before and after call */ SS_SPECIAL, /* marker for uses/defines/allocates/releases-specified */ SS_LAST } sstate; extern bool sstate_isValid (/*@sef@*/ sstate) /*@*/ ; # define sstate_isValid(s) ((s) >= SS_UNKNOWN && (s) <= SS_LAST) typedef enum { SCNONE, SCEXTERN, SCSTATIC } storageClassCode ; typedef enum { NS_ERROR = -1, /* error (suppress messages) */ NS_UNKNOWN = 0, /* no annotation */ NS_NOTNULL, /* definitely not null */ NS_MNOTNULL, /* marked with notnull */ /* perhaps null */ NS_RELNULL, /* relaxed null --- okay null for set, not null for checking */ NS_CONSTNULL, /* null constant (for abstract types) */ /* don't change the order! */ /* possibly null */ NS_POSNULL, /* possibly null */ NS_DEFNULL, /* definitely null */ NS_ABSNULL /* null from abstract type definition (concrete type unknown) */ } nstate; extern bool nstate_isKnown (nstate p_n) /*@*/ ; # define nstate_isKnown(n) ((n) != NS_UNKNOWN) extern bool nstate_isValid (/*@sef@*/ nstate p_n) /*@*/ ; # define nstate_isValid(n) ((n) >= NS_ERROR && (n) <= NS_ABSNULL) /* ** aliasing states */ /* ** HEY STUPID! Don't switch around the order! ** ** These numbers are fixed into the library format. If the order ** changes, remember to remake all libraries! */ typedef enum { AK_UNKNOWN = 0, /* AK_UNKNOWN must be first */ AK_ERROR, AK_ONLY, AK_IMPONLY, AK_KEEP, AK_KEPT, AK_TEMP, /* 6 */ AK_IMPTEMP, AK_SHARED, AK_UNIQUE, AK_RETURNED, /* 10 */ AK_FRESH, /* local only storage (may be shared) */ AK_STACK, /* allocated on local stack */ AK_REFCOUNTED, AK_REFS, AK_KILLREF, AK_NEWREF, AK_OWNED, AK_DEPENDENT, /* 18 */ AK_IMPDEPENDENT, AK_STATIC, AK_LOCAL /* AK_LOCAL must be last */ } alkind; typedef enum { XO_UNKNOWN, XO_NORMAL, XO_EXPOSED, XO_OBSERVER } exkind; extern bool sstate_isKnown (sstate p_s) /*@*/ ; # define sstate_isKnown(s) ((s) != SS_UNKNOWN) extern bool sstate_isUnknown (sstate p_s) /*@*/ ; # define sstate_isUnknown(s) ((s) == SS_UNKNOWN) extern bool exkind_isUnknown (exkind p_e) /*@*/ ; # define exkind_isUnknown(e) ((e) == XO_UNKNOWN) extern bool exkind_isKnown (/*@sef@*/ exkind p_e) /*@*/ ; # define exkind_isKnown(e) ((e) != XO_UNKNOWN && (e) != XO_NORMAL) extern bool exkind_isValid (/*@sef@*/ exkind p_e) /*@*/ ; # define exkind_isValid(e) ((e) >= XO_UNKNOWN && (e) <= XO_OBSERVER) extern bool alkind_isValid (/*@sef@*/ alkind p_a) /*@*/ ; # define alkind_isValid(a) ((a) >= AK_UNKNOWN && (a) <= AK_LOCAL) extern bool alkind_isImplicit (/*@sef@*/ alkind p_a) /*@*/ ; extern bool alkind_isDependent (/*@sef@*/ alkind p_a) /*@*/ ; extern bool alkind_isOnly (/*@sef@*/ alkind p_a) /*@*/ ; extern bool alkind_isTemp (/*@sef@*/ alkind p_a) /*@*/ ; # define alkind_isImplicit(a) (((a) == AK_IMPONLY || (a) == AK_IMPDEPENDENT \ || (a) == AK_IMPTEMP)) # define alkind_isDependent(a) (((a) == AK_DEPENDENT || (a) == AK_IMPDEPENDENT)) # define alkind_isOnly(a) ((a) == AK_ONLY || (a) == AK_IMPONLY) # define alkind_isTemp(a) (((a) == AK_TEMP || (a) == AK_IMPTEMP)) extern bool alkind_equal (alkind p_a1, alkind p_a2) /*@*/ ; extern bool alkind_isOwned (alkind p_a) /*@*/ ; extern bool alkind_isStack (alkind p_a) /*@*/ ; extern bool alkind_isStatic (alkind p_a) /*@*/ ; extern bool alkind_isKeep (alkind p_a) /*@*/ ; extern bool alkind_isKept (alkind p_a) /*@*/ ; extern bool alkind_isUnique (alkind p_a) /*@*/ ; extern bool alkind_isError (alkind p_a) /*@*/ ; extern bool alkind_isFresh (alkind p_a) /*@*/ ; extern bool alkind_isShared (alkind p_a) /*@*/ ; extern bool alkind_isLocal (alkind p_a) /*@*/ ; extern bool alkind_isKnown (alkind p_a) /*@*/ ; extern bool alkind_isUnknown (alkind p_a) /*@*/ ; extern bool alkind_isRefCounted (alkind p_a) /*@*/ ; extern /*@unused@*/ bool alkind_isRefs (alkind p_a) /*@*/ ; extern bool alkind_isNewRef (alkind p_a) /*@*/ ; extern bool alkind_isKillRef (alkind p_a) /*@*/ ; extern alkind alkind_resolve (alkind p_a1, alkind p_a2) /*@*/ ; # define alkind_isOwned(a) ((a) == AK_OWNED) # define alkind_isStack(a) ((a) == AK_STACK) # define alkind_isStatic(a) ((a) == AK_STATIC) # define alkind_isKeep(a) ((a) == AK_KEEP) # define alkind_isKept(a) ((a) == AK_KEPT) # define alkind_isUnique(a) ((a) == AK_UNIQUE) # define alkind_isError(a) ((a) == AK_ERROR) # define alkind_isFresh(a) ((a) == AK_FRESH) # define alkind_isShared(a) ((a) == AK_SHARED) # define alkind_isLocal(a) ((a) == AK_LOCAL) # define alkind_isKnown(a) ((a) != AK_UNKNOWN) # define alkind_isUnknown(a) ((a) == AK_UNKNOWN) # define alkind_isRefCounted(a) ((a) == AK_REFCOUNTED) # define alkind_isRefs(a) ((a) == AK_REFS) # define alkind_isNewRef(a) ((a) == AK_NEWREF) # define alkind_isKillRef(a) ((a) == AK_KILLREF) extern /*@observer@*/ cstring sstate_unparse (sstate p_s) /*@*/ ; extern alkind alkind_fromQual (qual p_q) /*@*/ ; extern alkind alkind_derive (alkind p_outer, alkind p_inner) /*@*/ ; extern /*@observer@*/ cstring alkind_unparse (alkind p_a) /*@*/ ; extern /*@observer@*/ cstring alkind_capName (alkind p_a) /*@*/ ; extern alkind alkind_fromInt (int p_n) /*@*/ ; extern nstate nstate_fromInt (int p_n) /*@*/ ; extern /*@observer@*/ cstring nstate_unparse (nstate p_n) /*@*/ ; extern int nstate_compare (nstate p_n1, nstate p_n2) /*@*/ ; extern bool nstate_possiblyNull (nstate p_n) /*@*/ ; extern bool nstate_perhapsNull (nstate p_n) /*@*/ ; extern sstate sstate_fromInt (int p_n) /*@*/ ; extern exkind exkind_fromInt (int p_n) /*@*/ ; extern exkind exkind_fromQual (qual p_q) /*@*/ ; extern /*@observer@*/ cstring exkind_unparse (exkind p_a) /*@*/ ; extern /*@observer@*/ cstring exkind_capName (exkind p_a) /*@*/ ; extern /*@observer@*/ cstring exkind_unparseError (exkind p_a) /*@*/ ; extern sstate sstate_fromQual (qual p_q) /*@*/ ; extern bool alkind_compatible (alkind p_a1, alkind p_a2) /*@*/ ; extern alkind alkind_fixImplicit (alkind p_a) /*@*/ ; typedef enum { XK_ERROR, XK_UNKNOWN, XK_NEVERESCAPE, XK_GOTO, XK_MAYGOTO, XK_MAYEXIT, XK_MUSTEXIT, XK_TRUEEXIT, XK_FALSEEXIT, XK_MUSTRETURN, XK_MAYRETURN, XK_MAYRETURNEXIT, XK_MUSTRETURNEXIT /* must return or exit */ } exitkind; /*@constant exitkind XK_LAST; @*/ # define XK_LAST XK_MUSTRETURNEXIT extern exitkind exitkind_fromQual (qual p_q) /*@*/ ; extern /*@unused@*/ bool exitkind_isMustExit (exitkind p_e) /*@*/ ; # define exitkind_isMustExit(e) ((e) == XK_MUSTEXIT) extern bool exitkind_equal (exitkind p_e1, exitkind p_e2) /*@*/ ; # define exitkind_equal(e1,e2) ((e1) == (e2)) extern bool exitkind_couldExit (exitkind p_e) /*@*/ ; extern bool exitkind_couldEscape (exitkind p_e) /*@*/ ; extern exitkind exitkind_fromInt (int p_x) /*@*/ ; extern /*@observer@*/ cstring exitkind_unparse (exitkind p_k) /*@*/ ; extern bool exitkind_isKnown (exitkind p_e) /*@*/ ; # define exitkind_isKnown(e) ((e) != XK_UNKNOWN) extern bool exitkind_isTrueExit (exitkind p_e) /*@*/ ; # define exitkind_isTrueExit(e) \ ((e) == XK_TRUEEXIT) extern bool exitkind_isConditionalExit (/*@sef@*/ exitkind p_e) /*@*/ ; # define exitkind_isConditionalExit(e) \ ((e) == XK_TRUEEXIT || (e) == XK_FALSEEXIT) extern bool exitkind_isError (/*@sef@*/ exitkind p_e) /*@*/ ; # define exitkind_isError(e) ((e) == XK_ERROR) extern bool exitkind_mustExit (/*@sef@*/ exitkind p_e) /*@*/ ; # define exitkind_mustExit(e) ((e) == XK_MUSTEXIT) extern bool exitkind_mustEscape (/*@sef@*/ exitkind p_e) /*@*/ ; # define exitkind_mustEscape(e) \ ((e) == XK_MUSTEXIT || (e) == XK_MUSTRETURN \ || (e) == XK_MUSTRETURNEXIT || (e) == XK_GOTO) extern exitkind exitkind_makeConditional (exitkind p_k) /*@*/ ; extern exitkind exitkind_combine (exitkind p_k1, exitkind p_k2) /*@*/ ; /* ** NOTE: combiners are in sRef */ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lslOpSet.h0000644021234200000250000000272407630463447015545 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lslOpSet.h ** ** based on set_template.h */ # ifndef lslOpSET_H # define lslOpSET_H abst_typedef /*@null@*/ struct { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ o_lslOp *elements; } *lslOpSet ; /*@iter lslOpSet_elements (sef lslOpSet s, yield exposed lslOp el); @*/ # define lslOpSet_elements(x, m_el) \ { if (lslOpSet_isDefined (x)) { int m_ind; \ for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ { lslOp m_el = (x)->elements[m_ind]; # define end_lslOpSet_elements }}} /*@constant null lslOpSet lslOpSet_undefined;@*/ # define lslOpSet_undefined ((lslOpSet) NULL) extern /*@falsewhennull@*/ bool lslOpSet_isDefined (lslOpSet p_s) /*@*/ ; # define lslOpSet_isDefined(s) ((s) != lslOpSet_undefined) extern /*@unused@*/ int lslOpSet_size (/*@sef@*/ lslOpSet p_s) /*@*/ ; # define lslOpSet_size(s) \ (lslOpSet_isDefined(s) ? (s)->entries : 0) extern /*@only@*/ lslOpSet lslOpSet_new (void) /*@*/ ; extern bool lslOpSet_insert (lslOpSet p_s, /*@only@*/ lslOp p_el) /*@modifies p_s@*/ ; extern /*@unused@*/ /*@only@*/ cstring lslOpSet_unparse (lslOpSet p_s) /*@*/ ; extern void lslOpSet_free (/*@only@*/ lslOpSet p_s); extern /*@only@*/ lslOpSet lslOpSet_copy (lslOpSet p_s) /*@*/ ; /*@constant int lslOpSetBASESIZE;@*/ # define lslOpSetBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/varNode.h0000644021234200000250000000072607630463450015370 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef VARNODE_H # define VARNODE_H typedef struct { /* with sort, useful in quantified */ ltoken varid; bool isObj; lclTypeSpecNode type; sort sort; } *varNode; extern varNode varNode_copy (varNode p_x); extern void varNode_free (/*@only@*/ /*@null@*/ varNode p_x); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/ynm.h0000644021234200000250000000230607630463450014571 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # if !defined(YNM_H) # define YNM_H typedef enum { NO, YES, MAYBE } ynm; extern /*@observer@*/ cstring ynm_unparse (/*@sef@*/ ynm p_b) /*@*/ ; extern /*@observer@*/ cstring ynm_unparseCode (/*@sef@*/ ynm p_b) /*@*/ ; extern bool ynm_toBoolStrict (ynm p_b) /*@*/ ; extern bool ynm_toBoolRelaxed (ynm p_b) /*@*/ ; extern ynm ynm_fromBool (bool p_b) /*@*/ ; extern bool ynm_isOff (ynm p_b) /*@*/ ; extern bool ynm_isOn (ynm p_b) /*@*/ ; extern bool ynm_isMaybe (ynm p_b) /*@*/ ; extern int ynm_compare (ynm p_x, ynm p_y) /*@*/ ; extern ynm ynm_fromCodeChar (char p_c) /*@*/ ; # define ynm_unparse(b) \ (cstring_makeLiteralTemp (((b) == NO) ? "no" : ((b) == YES) ? "yes" : "maybe")) # define ynm_unparseCode(b) \ (cstring_makeLiteralTemp (((b) == NO) ? "-" : ((b) == YES) ? "+" : "=")) # define ynm_toBoolStrict(y) ((y) == YES) # define ynm_toBoolRelaxed(y) ((y) != NO) # define ynm_fromBool(b) ((b) ? YES : NO) # define ynm_isOff(y) ((y) == NO) # define ynm_isOn(y) ((y) == YES) # define ynm_isMaybe(y) ((y) == MAYBE) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lslparse.h0000644021234200000250000000125207630463447015620 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lslparse.h */ extern /*@dependent@*/ /*@null@*/ lslOp g_importedlslOp; extern bool g_lslParsingTraits; /*@-namechecks@*/ /*@-declundef@*/ extern int lsldebug; /* defined by bison (not a bool) */ /*@=namechecks@*/ /*@=declundef@*/ extern lsymbol processTraitSortId (lsymbol p_sortid); extern int parseSignatures (/*@only@*/ cstring p_infile); extern /*@only@*/ lslOp parseOpLine (cstring p_fname, cstring p_line); extern void readlsignatures (interfaceNode p_n); extern void callLSL (cstring p_specfile, /*@only@*/ cstring p_text); splint-3.1.2.dfsg1/src/Headers/varNodeList.h0000644021234200000250000000214707630463450016223 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef VARNODELIST_H # define VARNODELIST_H typedef /*@only@*/ varNode o_varNode; abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ o_varNode *elements; } *varNodeList; /*@iter varNodeList_elements (sef varNodeList x, yield exposed varNode el); @*/ # define varNodeList_elements(x, m_el) \ { int m_ind; varNode *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { varNode m_el = *(m_elements++); # define end_varNodeList_elements }} extern /*@only@*/ varNodeList varNodeList_new(void); extern varNodeList varNodeList_add (/*@returned@*/ varNodeList p_s, /*@only@*/ varNode p_el) ; extern varNodeList varNodeList_copy (varNodeList p_s); extern /*@only@*/ cstring varNodeList_unparse (varNodeList p_s) ; extern void varNodeList_free (/*@only@*/ varNodeList p_s) ; /*@constant int varNodeListBASESIZE;@*/ # define varNodeListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lsymbol.h0000644021234200000250000000226207630463447015456 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LSYMBOL_H # define LSYMBOL_H /* ** Offset entries by 1, so 0 is available. */ /*@constant null lsymbol lsymbol_undefined; @*/ # define lsymbol_undefined ((lsymbol) 0) extern bool lsymbol_isDefined (lsymbol p_s); # define lsymbol_isDefined(s) ((s) != lsymbol_undefined) extern bool lsymbol_isUndefined (lsymbol p_s); # define lsymbol_isUndefined(s) ((s) == lsymbol_undefined) extern lsymbol lsymbol_fromChars (/*@temp@*/ char *) /*@*/ ; extern lsymbol lsymbol_fromString (/*@temp@*/ cstring p_s) /*@*/ ; extern /*@exposed@*/ /*@null@*/ char *lsymbol_toChars (lsymbol) /*@*/ ; extern /*@exposed@*/ char *lsymbol_toCharsSafe (lsymbol) /*@*/ ; extern /*@observer@*/ cstring lsymbol_toString(lsymbol) /*@*/ ; extern bool lsymbol_equal (lsymbol p_s1, lsymbol p_s2) /*@*/ ; # define lsymbol_equal(s1, s2) ((s1) == (s2)) extern /*@unused@*/ void lsymbol_printStats (void); extern void lsymbol_initMod (void) /*@modifies internalState@*/ ; extern void lsymbol_destroyMod (void) /*@modifies internalState@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/version.h0000644021234200000250000000073107633031471015450 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ /* ** version.h */ # ifndef VERSION_H # define VERSION_H /* ** Minimum version with compatible libraries. */ /*@constant float SPLINT_LIBVERSION; @*/ # define SPLINT_LIBVERSION 3.018 /*@constant observer char *SPLINT_MAINTAINER; @*/ # define SPLINT_MAINTAINER "splint-bug@splint.org" # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lsymbolList.h0000644021234200000250000000164007630463447016311 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ # ifndef LSYMBOLLIST_H # define LSYMBOLLIST_H abst_typedef struct { int nelements; int nspace; /*@reldef@*/ /*@relnull@*/ lsymbol *elements; } *lsymbolList ; /*@iter lsymbolList_elements (sef lsymbolList x, yield lsymbol el); @*/ # define lsymbolList_elements(x, m_el) \ { int m_ind; lsymbol *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { lsymbol m_el = *(m_elements++); # define end_lsymbolList_elements }} extern /*@only@*/ lsymbolList lsymbolList_new(void); extern void lsymbolList_addh (lsymbolList p_s, lsymbol p_el) ; extern void lsymbolList_free (/*@only@*/ lsymbolList p_s) ; /*@constant int lsymbolListBASESIZE;@*/ # define lsymbolListBASESIZE SMALLBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/warnClause.h0000644021234200000250000000274307630463450016077 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** warnClause.h */ # ifndef WARNCLAUSE_H # define WARNCLAUSE_H struct s_warnClause { /*@only@*/ fileloc loc; /*@only@*/ flagSpec flag; /*@only@*/ cstring msg; } ; /*@constant null warnClause warnClause_undefined; @*/ # define warnClause_undefined ((warnClause) NULL) extern /*@falsewhennull@*/ bool warnClause_isDefined (/*@null@*/ warnClause p_f) /*@*/ ; extern /*@nullwhentrue@*/ bool warnClause_isUndefined (/*@null@*/ warnClause p_f) /*@*/ ; # define warnClause_isDefined(f) ((f) != warnClause_undefined) # define warnClause_isUndefined(f) ((f) == warnClause_undefined) extern warnClause warnClause_create (/*@only@*/ lltok, /*@only@*/ flagSpec p_flag, /*@only@*/ cstring p_msg) /*@*/ ; extern /*@only@*/ warnClause warnClause_copy (warnClause) /*@*/ ; extern /*@observer@*/ flagSpec warnClause_getFlag (warnClause p_w) /*@*/ ; extern /*@only@*/ cstring warnClause_dump (warnClause p_wc) /*@*/ ; extern /*@only@*/ warnClause warnClause_undump (char **p_s) /*@modifies p_s@*/ ; extern /*@falsewhennull@*/ bool warnClause_hasMessage (warnClause p_w) /*@*/ ; extern /*@observer@*/ cstring warnClause_getMessage (warnClause p_w) /*@*/ ; extern /*@only@*/ cstring warnClause_unparse (warnClause p_w) /*@*/ ; extern void warnClause_free (/*@only@*/ warnClause p_w); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/lsymbolSet.h0000644021234200000250000000255307630463447016135 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** lsymbolSet.h ** ** based on set_template.h */ # ifndef LSYMBOLSET_H # define LSYMBOLSET_H abst_typedef /*@null@*/ struct { int entries; int nspace; /*@reldef@*/ /*@relnull@*/ lsymbol *elements; } *lsymbolSet ; /*@constant null lsymbolSet lsymbolSet_undefined; @*/ # define lsymbolSet_undefined (NULL) extern /*@falsewhennull@*/ bool lsymbolSet_isDefined (lsymbolSet p_l) /*@*/ ; # define lsymbolSet_isDefined(l) ((l) != lsymbolSet_undefined) /*@iter lsymbolSet_elements (sef lsymbolSet s, yield lsymbol el); @*/ # define lsymbolSet_elements(x, m_el) \ if (lsymbolSet_isDefined (x)) \ { int m_ind; \ for (m_ind = 0 ; m_ind < (x)->entries; m_ind++) \ { lsymbol m_el = (x)->elements[m_ind]; # define end_lsymbolSet_elements }} extern /*@only@*/ lsymbolSet lsymbolSet_new(void) /*@*/ ; extern bool lsymbolSet_insert (lsymbolSet p_s, lsymbol p_el) /*@modifies p_s@*/ ; extern bool lsymbolSet_member (lsymbolSet p_s, lsymbol p_el) /*@*/ ; extern /*@unused@*/ /*@only@*/ cstring lsymbolSet_unparse (lsymbolSet p_s) /*@*/ ; extern void lsymbolSet_free (/*@only@*/ lsymbolSet p_s); /*@constant int lsymbolSetBASESIZE;@*/ # define lsymbolSetBASESIZE MIDBASESIZE # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/ltoken.h0000644021234200000250000001607507641733021015266 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** ltoken.h */ # ifndef LTOKEN_H # define LTOKEN_H /* SimpleId codes */ typedef enum { SID_VAR, /* VarId */ SID_TYPE, /* TypeId */ SID_OP, /* OpId */ SID_SORT /* sortId */ } SimpleIdCode; struct s_ltoken { ltokenCode code; int col; int line; /* if idtype is SID_SORT, then text field keeps the sort */ lsymbol text; /* string handle */ lsymbol fname; /* source handle */ lsymbol rawText; /* original text */ bool defined: 1; /* token predefined */ bool hasSyn: 1; /* synonym exists */ /* just for simpleId: for distinguish simpleId into varId, fcnId, TypeId, ... */ /*@reldef@*/ SimpleIdCode idtype; /* quick and dirty: just for ctypes */ /*@reldef@*/ unsigned int intfield; } ; typedef /*@only@*/ ltoken o_ltoken; /*@constant null ltoken ltoken_undefined; @*/ # define ltoken_undefined ((ltoken)NULL) extern /*@falsewhennull@*/ bool ltoken_isValid (ltoken p_tok); # define ltoken_isValid(t) ((t) != ltoken_undefined) extern /*@nullwhentrue@*/ bool ltoken_isUndefined (ltoken p_tok); # define ltoken_isUndefined(t) ((t) == ltoken_undefined) extern bool ltoken_isStateDefined (/*@sef@*/ ltoken p_tok) /*@*/ ; # define ltoken_isStateDefined(t) \ (ltoken_isValid (t) && (t)->defined) extern void ltoken_setDefined (/*@sef@*/ ltoken p_tok, bool p_def); # define ltoken_setDefined(t, def) \ (ltoken_isValid (t) ? (t)->defined = (def) : (def)) extern ltoken ltoken_createType (ltokenCode p_code, SimpleIdCode p_idtype, lsymbol p_text) /*@*/ ; extern ltoken ltoken_create (ltokenCode p_code, lsymbol p_text) /*@*/ ; extern void ltoken_setIntField (/*@sef@*/ ltoken p_tok, unsigned int p_i); # define ltoken_setIntField(tok,i) \ (ltoken_isValid (tok) ? (tok)->intfield = (i) : (i)) extern int ltoken_getLine (/*@sef@*/ ltoken p_tok); # define ltoken_getLine(tok) \ (ltoken_isValid (tok) ? (tok)->line : 0) extern void ltoken_setLine (/*@sef@*/ ltoken p_tok, /*@sef@*/ int p_line); # define ltoken_setLine(tok, ln) \ (ltoken_isValid (tok) ? (tok)->line = (ln) : 0) extern int ltoken_getCol (/*@sef@*/ ltoken p_tok); # define ltoken_getCol(tok) \ (ltoken_isValid (tok) ? (tok)->col : 0) extern void ltoken_setCol (/*@sef@*/ ltoken p_tok, int p_col) /*@modifies p_tok@*/ ; # define ltoken_setCol(tok, c) \ (ltoken_isValid (tok) ? (tok)->col = (c) : (c)) extern ltokenCode ltoken_getCode (/*@sef@*/ ltoken p_tok) /*@*/ ; # define ltoken_getCode(tok) \ (ltoken_isValid (tok) ? (tok)->code : NOTTOKEN) extern unsigned int ltoken_getIntField (/*@sef@*/ ltoken p_tok) /*@*/ ; # define ltoken_getIntField(tok) \ (ltoken_isValid (tok) ? (tok)->intfield : 0) extern lsymbol ltoken_getText (/*@sef@*/ ltoken p_tok) /*@*/; # define ltoken_getText(tok) \ (ltoken_isValid (tok) ? (tok)->text : lsymbol_undefined) extern /*@exposed@*/ char *ltoken_getTextChars (/*@sef@*/ ltoken p_tok) /*@*/ ; # define ltoken_getTextChars(tok) \ (lsymbol_toCharsSafe (ltoken_getText (tok))) extern bool ltoken_hasSyn (/*@sef@*/ ltoken p_tok) /*@*/ ; # define ltoken_hasSyn(tok) \ (ltoken_isValid (tok) ? (tok)->hasSyn : FALSE) extern bool ltoken_wasSyn (/*@sef@*/ ltoken p_tok); # define ltoken_wasSyn(tok) \ (ltoken_isValid (tok) ? lsymbol_isDefined ((tok)->rawText) : FALSE) /*@-namechecks@*/ /* all of these should start with g_ */ extern /*@dependent@*/ ltoken ltoken_forall; extern /*@dependent@*/ ltoken ltoken_exists; extern /*@dependent@*/ ltoken ltoken_true; extern /*@dependent@*/ ltoken ltoken_false; extern /*@dependent@*/ ltoken ltoken_not; extern /*@dependent@*/ ltoken ltoken_and; extern /*@dependent@*/ ltoken ltoken_or; extern /*@dependent@*/ ltoken ltoken_implies; extern /*@dependent@*/ ltoken ltoken_eq; extern /*@dependent@*/ ltoken ltoken_neq; extern /*@dependent@*/ ltoken ltoken_equals; extern /*@dependent@*/ ltoken ltoken_eqsep; extern /*@dependent@*/ ltoken ltoken_select; extern /*@dependent@*/ ltoken ltoken_open; extern /*@dependent@*/ ltoken ltoken_sep; extern /*@dependent@*/ ltoken ltoken_close; extern /*@dependent@*/ ltoken ltoken_id; extern /*@dependent@*/ ltoken ltoken_arrow; extern /*@dependent@*/ ltoken ltoken_marker; extern /*@dependent@*/ ltoken ltoken_pre; extern /*@dependent@*/ ltoken ltoken_post; extern /*@dependent@*/ ltoken ltoken_comment; extern /*@dependent@*/ ltoken ltoken_compose; extern /*@dependent@*/ ltoken ltoken_if; extern /*@dependent@*/ ltoken ltoken_any; extern /*@dependent@*/ ltoken ltoken_result; extern /*@dependent@*/ ltoken ltoken_typename; extern /*@dependent@*/ ltoken ltoken_bool; extern /*@dependent@*/ ltoken ltoken_farrow; extern /*@dependent@*/ ltoken ltoken_lbracked; extern /*@dependent@*/ ltoken ltoken_rbracket; /*@=namechecks@*/ extern cstring ltoken_unparseCodeName (ltoken p_tok) /*@*/ ; extern /*@observer@*/ cstring ltoken_unparse (ltoken p_s); extern void ltoken_setCode (/*@sef@*/ ltoken p_s, ltokenCode p_code); # define ltoken_setCode(s,c) (ltoken_isValid (s) ? (s)->code = (c) : (c)) extern void ltoken_setRawText (/*@sef@*/ ltoken p_s, lsymbol p_t); # define ltoken_setRawText(s,t) (ltoken_isValid (s) ? (s)->rawText = (t) : (t)) extern void ltoken_setIdType (/*@sef@*/ ltoken p_s, SimpleIdCode p_idtype); # define ltoken_setIdType(s,i) (ltoken_isValid (s) ? (s)->idtype = (i) : (i)) extern void ltoken_setText (/*@sef@*/ ltoken p_s, lsymbol p_text); # define ltoken_setText(s,t) (ltoken_isValid (s) ? (s)->text = (t) : (t)) extern lsymbol ltoken_getRawText (ltoken) /*@*/ ; /* defined in abstract.c */ extern bool ltoken_similar (ltoken p_t1, ltoken p_t2) /*@*/ ; extern /*@observer@*/ char *ltoken_getRawTextChars (ltoken p_s) /*@*/ ; # define ltoken_getRawTextChars(s) \ (lsymbol_toCharsSafe (ltoken_getRawText (s))) extern /*@observer@*/ cstring ltoken_getRawString (ltoken p_s) /*@*/ ; # define ltoken_getRawString(s) \ (lsymbol_toString (ltoken_getRawText (s))) extern ltoken ltoken_copy (ltoken) /*@*/ ; extern /*@observer@*/ cstring ltoken_fileName (/*@sef@*/ ltoken p_s); # define ltoken_fileName(s) \ (ltoken_isValid(s) ? lsymbol_toString ((s)->fname) : cstring_undefined) extern void ltoken_setFileName (/*@sef@*/ ltoken p_tok, /*@sef@*/ cstring p_fname); # define ltoken_setFileName(tok,f) \ (ltoken_isValid(tok) ? (tok)->fname = lsymbol_fromString (f) : lsymbol_undefined) extern bool ltoken_isChar (ltoken p_tok); # define ltoken_isChar(t) \ (cstring_length (ltoken_unparse (t)) == 1) extern void ltoken_setHasSyn (/*@sef@*/ ltoken p_tok, bool p_def); # define ltoken_setHasSyn(tok, def) \ (ltoken_isValid(tok) ? (tok)->hasSyn = (def) : (def)) extern void ltoken_free (/*@only@*/ ltoken); extern ltoken ltoken_createFull (ltokenCode p_code, lsymbol p_text, cstring p_file, int p_line, int p_col) /*@*/ ; extern ltoken ltoken_createRaw (ltokenCode p_code, lsymbol p_text) /*@*/ ; extern cstring ltoken_unparseLoc (ltoken p_t) /*@*/ ; extern void ltoken_markOwned (/*@owned@*/ ltoken); extern bool ltoken_isSingleChar (char) /*@*/ ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/splintMacros.nf0000644021234200000250000000734607646432517016640 0ustar fax/* ;-*-C-*-; ** Copyright (c) Massachusetts Institute of Technology 1994, 1995. ** All Rights Reserved. ** Unpublished rights reserved under the copyright laws of ** the United States. ** ** THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED ** OR IMPLIED. ANY USE IS AT YOUR OWN RISK. ** ** This code is distributed freely and may be used freely under the ** following conditions: ** ** 1. This notice may not be removed or altered. ** ** 2. This code may not be re-distributed or modified ** without permission from MIT (contact ** lclint-request@larch.lcs.mit.edu.) ** ** Modification and re-distribution are encouraged, ** but we want to keep track of changes and ** distribution sites. */ # ifndef LCLINTMACROS_H # define LCLINTMACROS_H /* ** This file contains notfunction macros (hence, the .nf extension to ** prevent it being skipped when +neverinclude is used.) */ #ifndef PARAMS #ifdef __STDC /*@notfunction@*/ #define PARAMS(P) P #else /*@notfunction@*/ #define PARAMS(P) () #endif #endif /* !PARAMS */ /*@notfunction@*/ # define BADEXIT \ /*@notreached@*/ do { llassertprint(FALSE, ("Reached dead code!")); \ exit(EXIT_FAILURE); } while (FALSE) /*@notfunction@*/ # define BADBRANCH \ /*@notreached@*/ BADBRANCHCONT /*@notfunction@*/ # define BADBRANCHNULL \ /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return NULL; /*@=mustfree@*/ /*@=globstate@*/ /*@notfunction@*/ # define BADBRANCHCONT \ do { llassertprint (FALSE, ("Bad branch taken!")); } while (FALSE) /*@notfunction@*/ # define BADBRANCHRET(r) \ /*@notreached@*/ BADBRANCHCONT ; /*@notreached@*/ /*@-mustfree@*/ /*@-globstate@*/ return (r); /*@=mustfree@*/ /*@=globstate@*/ /*@notfunction@*/ # define BADDEFAULT \ default: llassertprint (FALSE, ("Unexpected default case reached!")); \ exit (EXIT_FAILURE); /*@-namechecks@*/ /*@notfunction@*/ # define llassertprint(tst,p) \ do { \ if (!(tst)) { \ llbug (message("%q:%d: llassert failed: " #tst ": %q", \ cstring_makeLiteral (__FILE__), __LINE__,\ /*@-mustfree@*/ message p) /*@=mustfree@*/ ); \ }} while (FALSE) /*@notfunction@*/ # define llassertprintret(tst,p,r) \ do { if (!(tst)) \ { llbug (message("%q:%d: %q", cstring_makeLiteral (__FILE__), __LINE__, message p)); \ /*@-unreachable@*/ return (r); /*@=unreachable@*/ \ } } while (FALSE) /*@notfunction@*/ # define abst_typedef typedef /*@abstract@*/ /*@notfunction@*/ # define immut_typedef typedef /*@abstract@*/ /*@immutable@*/ /*@=namechecks@*/ /* ** SunOS4 can't handle bit fields correctly. */ # ifdef SYSSunOS /*@notfunction@*/ # define BOOLBITS # else /*@notfunction@*/ # define BOOLBITS : 1 # endif /* ** some stupid proprocessors replace the s in %s...had ** to change s to arg. */ /*@notfunction@*/ # define NOALIAS(s,t) (/*@ignore@*/ (s == NULL) || (s != t) /*@end@*/) /* evans 2002-02-24: got rid of -formatconst */ /*@notfunction@*/ # define TPRINTF(arg) \ do { /*@-mustfree@*/ /*@-null@*/ (void) fflush (stderr); (void) fflush (stdout); \ printf ("%s:%d [%s]: >> ", __FILE__, __LINE__, cstring_toCharsSafe (fileloc_unparse(g_currentloc))); \ (void)printf arg; printf("\n"); /*@=mustfree@*/ /*@=null@*/ (void) fflush (stdout); \ } while (FALSE) /* ** DPRINTF does nothing, just a marker to save TPRINTF's */ /*@notfunction@*/ # define DPRINTF(s) /*@notfunction@*/ # define INTCOMPARERETURN(x,y) \ do { if ((x) > (y)) { return 1; } \ else { if ((x) < (y)) { return -1; }}} while (FALSE); /*@notfunction@*/ # define COMPARERETURN(z) \ do { if (z != 0) { return z; } } while (FALSE); # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/typeId.h0000644021234200000250000000171007646432517015231 0ustar fax# ifndef TYPEID_H # define TYPEID_H typedef /*@numabstract@*/ usymId typeId; /*@access usymId@*/ extern bool typeId_isInvalid (typeId p_u) /*@*/ ; # define typeId_isInvalid(u) ((u) == typeId_invalid) extern bool typeId_isValid (typeId p_u) /*@*/ ; # define typeId_isValid(u) ((u) != typeId_invalid) extern bool typeId_equal (typeId p_u1, typeId p_u2) /*@*/ ; # define typeId_equal(u1,u2) ((u1) == (u2)) extern typeId typeId_fromInt (int p_i) /*@*/ ; # define typeId_fromInt(i) ((typeId) (i)) extern typeId typeId_fromUsymId (usymId p_u) /*@*/ ; # define typeId_fromUsymId(u) ((typeId) (u)) extern usymId typeId_toUsymId (typeId p_u) /*@*/ ; # define typeId_toUsymId(u) ((usymId) (u)) extern int typeId_compare (/*@sef@*/ typeId p_x, /*@sef@*/ typeId p_y) /*@*/ ; # define typeId_compare(x,y) (int_compare(x, y)) /*@constant typeId typeId_invalid;@*/ # define typeId_invalid usymId_invalid /*@noaccess usymId@*/ # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/pointers.h0000644021234200000250000000266007630463450015634 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. */ # ifndef POINTERS_H # define POINTERS_H struct s_pointers { qualList quals; /*@null@*/ pointers rest; } ; /*@constant null pointers pointers_undefined; @*/ # define pointers_undefined ((pointers) NULL) extern /*@nullwhentrue@*/ bool pointers_isUndefined (/*@special@*/ pointers p_e) /*@*/ ; extern /*@falsewhennull@*/ bool pointers_isDefined (/*@special@*/ pointers p_e) /*@*/ ; # define pointers_isUndefined(e) ((e) == pointers_undefined) # define pointers_isDefined(e) ((e) != pointers_undefined) extern pointers pointers_create (lltok p_tok) /*@*/ ; extern pointers pointers_createMods (lltok p_tok, /*@only@*/ qualList p_quals) /*@*/ ; extern pointers pointers_createMt (mttok p_tok) /*@*/ ; extern pointers pointers_createLt (ltoken p_tok) /*@*/ ; extern pointers pointers_createModsLt (ltoken p_tok, /*@only@*/ qualList p_quals) /*@*/ ; extern pointers pointers_createModsMt (mttok p_tok, /*@only@*/ qualList p_quals) /*@*/ ; extern pointers pointers_extend (/*@returned@*/ pointers p_p1, /*@only@*/ pointers p_p2) /*@modifies p_p1@*/ ; extern /*@observer@*/ pointers pointers_getRest (pointers) /*@*/ ; extern int pointers_depth (pointers p_p) /*@*/ ; extern cstring pointers_unparse (pointers) /*@*/ ; extern void pointers_free (/*@only@*/ pointers) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/mstring.h0000644021234200000250000000435007630463447015460 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** mstring.h */ # ifndef MSTRING_H # define MSTRING_H /* mstring is a non-abstract string (char *) */ typedef /*@concrete@*/ char *mstring; typedef /*@observer@*/ char *ob_mstring; typedef /*@observer@*/ /*@null@*/ char *bn_mstring; extern /*@unused@*/ /*@notnull@*/ /*@observer@*/ char * mstring_safePrint (/*@returned@*/ /*@null@*/ mstring p_s) /*@*/ ; extern char *mstring_spaces (int p_n) /*@*/ ; extern char *mstring_concat (const char *p_s1, const char *p_s2) /*@*/ ; extern char *mstring_concatFree (/*@only@*/ char *p_s1, /*@only@*/ char *p_s2) /*@modifies *p_s1, *p_s2*/ ; extern char *mstring_concatFree1 (/*@only@*/ char *p_s1, const char *p_s2); extern char *mstring_append (/*@only@*/ char *p_s1, char p_c); extern char *mstring_copy (/*@null@*/ char *p_s1) /*@*/ /*@ensures maxRead(result) == maxRead(p_s1) /\ maxSet(result) == maxSet(p_s1) @*/ ; extern bool mstring_equalPrefix (const char *p_c1, const char *p_c2) /*@*/ ; extern bool mstring_equal (/*@null@*/ const char *p_s1, /*@null@*/ const char *p_s2) /*@*/ ; extern bool mstring_containsChar (/*@unique@*/ const char *p_s, char p_c) /*@*/ ; extern bool mstring_containsString (/*@unique@*/ const char *p_s, /*@unique@*/ const char *p_c) /*@*/ ; extern size_t mstring_length (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ; # define mstring_length(s) \ (((s) != NULL) ? strlen (s) : 0) extern /*@falsewhennull@*/ bool mstring_isDefined (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ; # define mstring_isDefined(s) ((s) != NULL) extern /*@nullwhentrue@*/ bool mstring_isEmpty (/*@sef@*/ /*@null@*/ char *p_s) /*@*/ ; # define mstring_isEmpty(s) (mstring_length(s) == 0) extern void mstring_markFree (/*@owned@*/ char *p_s) /*@modifies *p_s;@*/ ; extern /*@notnull@*/ /*@only@*/ char *mstring_create (size_t p_n) /*@*/ /*@ensures maxSet(result) == p_n /\ maxRead(result) == 0 @*/ ; extern /*@notnull@*/ /*@only@*/ char *mstring_createEmpty (void) /*@*/ ; extern void mstring_free (/*@out@*/ /*@only@*/ /*@null@*/ char *p_s); # define mstring_free(s) sfree(s) # define mstring_createEmpty() mstring_create(0) # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/help.h0000644021234200000250000000052707630463447014727 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** help.h */ # ifndef HELP_H # define HELP_H extern void help_processFlags (int p_argc, char **p_argv) ; extern void help_showAvailableHelp (void) ; # else # error "Multiple include" # endif splint-3.1.2.dfsg1/src/Headers/cscannerHelp.h0000644021234200000250000000725207630463445016404 0ustar fax/* ** Copyright (C) University of Virginia, Massachusetts Institue of Technology 1994-2003. ** See ../LICENSE for license information. ** */ /* ** cscannerHelp.h */ # ifndef CSCANNERHELP_H # define CSCANNERHELP_H extern void cscannerHelp_swallowMacro (void) ; extern bool cscannerHelp_processMacro (void) ; extern void cscannerHelp_handleMacro (void) ; extern void cscannerHelp_exitSpecPart (void) /*@modifies internalState@*/ ; extern void cscannerHelp_setContinueLine (void) /*@modifies internalState@*/ ; extern int cscannerHelp_returnToken (int p_t) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_returnTokenLength (int p_t, int p_length) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_returnString (/*@only@*/ cstring p_s) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_returnInt (ctype p_ct, long p_val) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_returnFloat (ctype p_ct, double p_f) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_returnChar (char p_c) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_returnType (int p_tok, ctype p_ct) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_returnExpr (/*@only@*/ exprNode p_e) /*@modifies g_currentloc, internalState@*/ ; extern void cscannerHelp_setTokLength (int) /*@modifies g_currentloc, internalState@*/ ; extern void cscannerHelp_setTokLengthT (size_t) /*@modifies g_currentloc, internalState@*/ ; extern void cscannerHelp_advanceLine (void) /*@modifies g_currentloc, internalState@*/ ; extern /*@observer@*/ cstring cscannerHelp_observeLastIdentifier (void) ; extern int cscannerHelp_handleLlSpecial (void) /*@modifies g_currentloc, internalState@*/ ; extern bool cscannerHelp_handleSpecial (char *) /*@modifies g_currentloc, internalState@*/ ; extern /*@only@*/ cstring cscannerHelp_makeIdentifier (char *); extern bool cscannerHelp_isConstraintToken (int p_tok) /*@*/ ; extern int cscannerHelp_handleNewLine (void) /*@modifies g_currentloc, internalState@*/ ; extern int cscannerHelp_processTextIdentifier (char *) /*@modifies internalState@*/ ; extern int cscannerHelp_processIdentifier (/*@only@*/ cstring) /*@modifies internalState@*/ ; extern bool cscannerHelp_processHashIdentifier (/*@only@*/ cstring) /*@modifies internalState@*/ ; extern int cscannerHelp_processSpec (int p_tok) /*@modifies internalState@*/ ; extern char cscannerHelp_processChar (void) /*@modifies internalState@*/ ; extern double cscannerHelp_processFloat (void) /*@modifies internalState@*/ ; extern /*@only@*/ exprNode cscannerHelp_processString (void) /*@modifies internalState@*/ ; extern /*@only@*/ exprNode cscannerHelp_processWideString (void) /*@modifies internalState@*/ ; extern long cscannerHelp_processDec (void) /*@modifies internalState@*/ ; extern long cscannerHelp_processHex (void) /*@modifies internalState@*/ ; extern long cscannerHelp_processOctal (void) /*@modifies internalState@*/ ; extern void cscannerHelp_expectingMetaStateName (void) /*@modifies internalState@*/ ; extern void cscannerHelp_clearExpectingMetaStateName (void) /*@modifies internalState@*/ ; extern /*@observer@*/ uentry cscannerHelp_coerceId (cstring p_cn); extern /*@observer@*/ uentry cscannerHelp_coerceIterId (cstring p_cn); extern void cscannerHelp_setExpectingTypeName (void) /*@modifies internalState@*/ ; extern void cscannerHelp_clearExpectingTypeName (void) /*@modifies internalState@*/ ; extern bool cscannerHelp_isExpectingTypeName (void) /*@globals internalState@*/ ; extern int cscannerHelp_ninput (void) /*@modifies internalState, g_currentloc@*/; # else # error "Multiple include." # endif splint-3.1.2.dfsg1/src/Headers/256_random_numbers.nf0000644021234200000250000000604107121317330017537 0ustar fax0x7be9c1bd, 0x088aa102, 0x3d38509b, 0x746b9fbe, 0x2d04417f, 0x775d4351, 0x53c48d96, 0x02b26e0b, 0x418fedcf, 0x19dbc19e, 0x78512adb, 0x1a1f5e2b, 0x307d7761, 0x6584c1f0, 0x24e3c36f, 0x2232310f, 0x2dac5ceb, 0x106e8b5a, 0x5a05a938, 0x5e6392b6, 0x66b90348, 0x75264901, 0x4174f402, 0x618b18a4, 0x3a6ab4bf, 0x3c4bc289, 0x2657a9a9, 0x4e68589b, 0x09648aa6, 0x3fc489bb, 0x1c1b715c, 0x054e4c63, 0x484f2abd, 0x5953c1f8, 0x79b9ec22, 0x75536c3d, 0x50b10549, 0x4d7e79b8, 0x7805da48, 0x1240f318, 0x675a3b56, 0x70570523, 0x2c605143, 0x17d7b2b7, 0x55dbc713, 0x514414b2, 0x3a09e3c7, 0x038823ff, 0x61b2a00c, 0x140f8cff, 0x61ebb6b5, 0x486ba354, 0x0935d600, 0x2360aab8, 0x29f6bbf8, 0x43a08abf, 0x5fac6d41, 0x504e65a2, 0x1208e35b, 0x6910f7e7, 0x1012ef5d, 0x2e2454b7, 0x6e5f444b, 0x58621a1b, 0x077816af, 0x6819306d, 0x4db58658, 0x58291bf8, 0x3597aa25, 0x45bb60a0, 0x6a6a0f11, 0x1cf1e57c, 0x361265c4, 0x16ca6054, 0x34c99833, 0x0bee2cd7, 0x680e7507, 0x6ed37bfa, 0x0f7650d6, 0x49c11513, 0x02e308f9, 0x7162078c, 0x122cb868, 0x0c18defa, 0x14c2b244, 0x3c237460, 0x4fb969b9, 0x746f1f85, 0x0c71da02, 0x61c24d14, 0x5d80176d, 0x1c84c960, 0x0fe6a1cc, 0x4bdf5bb8, 0x74e6e37b, 0x175eb87b, 0x33f88c25, 0x429c69d3, 0x6f87d474, 0x6990364a, 0x0857ca73, 0x59f1e385, 0x06821bc6, 0x3e6a3037, 0x70bc43d9, 0x3b4bb3fa, 0x4a585d0f, 0x58cab8e0, 0x2a1f2ff4, 0x59ceade5, 0x228bcdf4, 0x2d0238ee, 0x4b30b571, 0x34b8865c, 0x391b17e8, 0x5ff367b5, 0x70dbfabc, 0x08d481a1, 0x5462873b, 0x7d4dd4bf, 0x6a96ceb6, 0x31e29ea8, 0x19d29e1f, 0x7a7d7082, 0x7dc1fa60, 0x0eb9819a, 0x11dc28fd, 0x31ba8685, 0x5155eb6d, 0x0163fd71, 0x1b4abccf, 0x59adb5e0, 0x5b55e0f6, 0x21ccd896, 0x1817e618, 0x4c1224d0, 0x5d188c90, 0x62704327, 0x24dcddb0, 0x0737bc84, 0x3c3ef10c, 0x4768aba4, 0x3439f572, 0x076fa67e, 0x7c213200, 0x6d550d5a, 0x67630e33, 0x6cfd2cbd, 0x76298efc, 0x3bc5956e, 0x6a4b017c, 0x60c05db2, 0x6da83416, 0x041d9f9b, 0x5b3dce34, 0x6b6a2e76, 0x12d72135, 0x6d19f731, 0x1d24b4fb, 0x642d0ca2, 0x6e7df4a3, 0x386f71cb, 0x3ddac282, 0x49d3d599, 0x5a3c4a61, 0x55f2a89a, 0x15e5fa69, 0x3754d6f1, 0x3862ebc1, 0x3ac2d81a, 0x3e8c9375, 0x74a1dcce, 0x022b83be, 0x72c688e8, 0x7c11834c, 0x7e4cb5bf, 0x601b9642, 0x6374917f, 0x6b49e27c, 0x5645253e, 0x1f3a26ee, 0x5594e3f8, 0x370582f0, 0x0ce25b04, 0x59b28393, 0x12435124, 0x784c897b, 0x6c89a4c8, 0x7f5d4856, 0x15713e76, 0x50b6b16a, 0x6ddb3cf9, 0x4de0b041, 0x0e9173ec, 0x37af1292, 0x281cfaa2, 0x64841c87, 0x4d950cfc, 0x5f71d193, 0x1ce70848, 0x0857e516, 0x1dfe6509, 0x1188e516, 0x0a8368d4, 0x10c4edf1, 0x0d9a6862, 0x08d01e93, 0x70e08433, 0x710ef9e2, 0x741a010f, 0x4725a972, 0x104920d0, 0x49aee507, 0x7e2b2c62, 0x1d2b7bd4, 0x2361689a, 0x106e7d87, 0x1578054f, 0x0feb0d62, 0x0fcbc5dd, 0x2ae943c6, 0x60a1becc, 0x7da702d6, 0x78c9f407, 0x6f3332b9, 0x35561568, 0x20e6eeaa, 0x53b74f40, 0x02eb2264, 0x0058c03d, 0x709e5788, 0x0b43077a, 0x1e572546, 0x02273c9f, 0x15c6704f, 0x2f1c1337, 0x0fc1a501, 0x1e968ee2, 0x1ffc976b, 0x00d09ee3, 0x12b08ff2, 0x672240dd, 0x1119bfb3, 0x5c5f74f9, 0x654d6d3f, 0x2e453b88, 0x7fc0dd94, 0x75bbeac6, 0x43bd40d7, 0x0fabeaf6, 0x0587b0a3, 0x6ea6849d, 0x704da9c3, 0x032eb379, 0x677078a5, 0x5f80dc7c, splint-3.1.2.dfsg1/src/Headers/reservedNames.nf0000644021234200000250000000501207121317330016730 0ustar fax "BUFSIZ", "CHAR_BIT", "CHAR_MAX", "CHAR_MIN", "CLOCKS_PER_SEC", "DBL_DIG", "DBL_EPSILON", "DBL_MANT_DIG", "DBL_MAX", "DBL_MAX_10_EXP", "DBL_MAX_EXP", "DBL_MIN", "DBL_MIN_10_EXP", "DBL_MIN_EXP", "EXIT_FAILURE", "EXIT_SUCCESS", "FILE", "FILENAME_MAX", "FLT_DIG", "FLT_EPSILON", "FLT_MANT_DIG", "FLT_MAX", "FLT_MAX_10_EXP", "FLT_MAX_EXP", "FLT_MIN", "FLT_MIN_10_EXP", "FLT_MIN_EXP", "FLT_RADIX", "FLT_ROUNDS", "FOPEN_MAX", "HUGE_VAL", "INT_MAX", "INT_MIN", "LDBL_DIG", "LDBL_EPSILON", "LDBL_MANT_DIG", "LDBL_MAX", "LDBL_MAX_10_EXP", "LDBL_MAX_EXP", "LDBL_MIN", "LDBL_MIN_10_EXP", "LDBL_MIN_EXP", "LONG_MAX", "LONG_MIN", "L_tmpnam", "MB_CUR_MAX", "MB_LEN_MAX", "NDEBUG", "NULL", "RAND_MAX", "SCHAR_MAX", "SCHAR_MIN", "SEEK_CUR", "SEEK_END", "SEEK_SET", "SHRT_MAX", "SHRT_MIN", "SIGABRT", "SIGFPE", "SIGILL", "SIGINT", "SIGSEGV", "SIGTERM", "SIG_DFL", "SIG_ERR", "SIG_IGN", "TMP_MAX", "UCHAR_MAX", "UINT_MAX", "ULONG_MAX", "USHRT_MAX", "abort", "abs", "asctime", "assert", "atexit", "atof", "atoi", "atol", "bsearch", "calloc", "clearerr", "clock", "clock_t", "ctime", "currency_symbol", "decimal_point", /* "defined", */ "difftime", "div", "div_t", "errno", "exit", "fclose", "feof", "ferror", "fflush", "fgetc", "fgetpos", "fgets", "fopen", "fpos_t", "fprintf", "fputc", "fputs", "frac_digits", "fread", "free", "freopen", "fscanf", "fseek", "fsetpos", "ftell", "fwrite", "getc", "getchar", "getenv", "gets", "gmtime", "grouping", "int_curr_symbol", "int_frac_digits", "jmp_buf", "labs", "lconv", "ldiv", "ldiv_t", "localeconv", "localtime", "longjmp", "malloc", "mblen", "mbstowcs", "mbtowc", "mktime", "mon_decimal_point", "mon_grouping", "mon_thousands_sep", "n_cs_precedes", "n_sep_by_space", "n_sign_posn", "negative_sign", "offsetof", "p_cs_precedes", "p_sep_by_space", "p_sign_posn", "perror", "positive_sign", "printf", "ptrdiff_t", "putc", "putchar", "puts", "qsort", "raise", "rand", "realloc", "remove", "rename", "rewind", "scanf", "setbuf", "setjmp", "setlocale", "setvbuf", "sig_atomic_t", "signal", "size_t", "sprintf", "srand", "sscanf", "stderr", "stdin", "stdout", "system", "thousands_sep", "time", "time_t", "tm", "tm_hour", "tm_isdst", "tm_mday", "tm_min", "tm_mon", "tm_sec", "tm_wday", "tm_yday", "tm_year", "tmpfile", "tmpnam", "ungetc", "va_arg", "va_end", "va_list", "va_start", "vfprintf", "vprintf", "vsprintf", "wchar_t", "wcstombs", "wctomb", splint-3.1.2.dfsg1/src/Makefile.am0000644021234200000250000005246607671271600014311 0ustar fax## Note: starting comments with ## means they don't end up in Makefile AUTOMAKE_OPTIONS = 1.5 foreign SUFFIXES = .h .c .o .l .check # Check files before compiling; requires splint! CHECK = 1 # Some preferences ### We use the no-lines option to prevent confusion with splint flag settings. ### Should fix splint to avoid this... YFLAGS = -v -t -d --debug --no-lines LFLAGS = -L BISON_SRC = cgrammar.y llgrammar.y mtgrammar.y signature.y ## We only build Splint bin_PROGRAMS = splint ## This is a fake program, so we can easily substitute in the extra LCL objects EXTRA_PROGRAMS = lcl AM_CPPFLAGS = -IHeaders ## The main sources SETSRC = globSet.c intSet.c typeIdSet.c guardSet.c usymIdSet.c sRefSet.c LISTSRC = clauseStack.c filelocStack.c \ cstringList.c cstringSList.c sRefSetList.c ctypeList.c \ enumNameList.c enumNameSList.c exprNodeList.c exprNodeSList.c \ uentryList.c fileIdList.c filelocList.c qualList.c sRefList.c \ flagMarkerList.c idDeclList.c flagSpec.c CPPSRC = cppmain.c cpplib.c cppexp.c cpphash.c cpperror.c CSRC = context.c uentry.c cprim.c macrocache.c qual.c qtype.c stateClause.c \ stateClauseList.c ctype.c cvar.c clabstract.c idDecl.c clause.c \ globalsClause.c modifiesClause.c warnClause.c functionClause.c \ functionClauseList.c metaStateConstraint.c metaStateConstraintList.c \ metaStateExpression.c metaStateSpecifier.c functionConstraint.c \ pointers.c cscannerHelp.c SPLINTSRC = exprNode.c exprChecks.c llmain.c help.c rcfiles.c CHECKSRC = structNames.c transferChecks.c varKinds.c nameChecks.c GLOBSRC = globals.c flags.c general.c osd.c reader.c mtreader.c GRAMSRC = cgrammar.c cscanner.c mtscanner.c mtgrammar.c llgrammar.c signature.c OVERFLOWCHSRC = constraintList.c constraintResolve.c \ constraintGeneration.c constraintTerm.c \ constraintExprData.c constraintExpr.c constraint.c \ loopHeuristics.c GENERALSRC = exprData.c cstring.c fileloc.c message.c inputStream.c \ fileTable.c cstringTable.c valueTable.c stateValue.c \ llerror.c messageLog.c flagMarker.c aliasTable.c ynm.c \ sRefTable.c genericTable.c ekind.c usymtab.c multiVal.c \ lltok.c sRef.c lcllib.c randomNumbers.c fileLib.c METASTATESRC = stateInfo.c stateCombinationTable.c metaStateTable.c \ metaStateInfo.c annotationTable.c annotationInfo.c mttok.c \ mtDeclarationNode.c mtDeclarationPieces.c mtDeclarationPiece.c \ mtContextNode.c mtValuesNode.c mtDefaultsNode.c \ mtAnnotationsNode.c mtMergeNode.c mtAnnotationList.c \ mtAnnotationDecl.c mtTransferClauseList.c mtTransferClause.c \ mtTransferAction.c mtLoseReferenceList.c mtLoseReference.c \ mtDefaultsDeclList.c mtDefaultsDecl.c mtMergeItem.c \ mtMergeClause.c mtMergeClauseList.c ## These are only used if LCL is enabled LCLONLYSRC = usymtab_interface.c abstract.c ltoken.c lclscanline.c \ lclsyntable.c lcltokentable.c sort.c symtable.c lclinit.c \ shift.c lclscan.c lsymbol.c mapping.c LSLSRC = tokentable.c scan.c scanline.c lslparse.c \ lh.c checking.c lclctypes.c imports.c lslinit.c syntable.c LCLSETSRC = lsymbolSet.c sigNodeSet.c lslOpSet.c sortSet.c LCLLISTSRC = initDeclNodeList.c sortList.c declaratorInvNodeList.c \ interfaceNodeList.c sortSetList.c declaratorNodeList.c \ letDeclNodeList.c stDeclNodeList.c storeRefNodeList.c \ lslOpList.c lsymbolList.c termNodeList.c ltokenList.c \ traitRefNodeList.c pairNodeList.c typeNameNodeList.c \ fcnNodeList.c paramNodeList.c programNodeList.c \ varDeclarationNodeList.c varNodeList.c quantifierNodeList.c \ replaceNodeList.c importNodeList.c HEADERSRC = Headers/abstBodyNode.h Headers/ltokenList.h \ Headers/abstract.h Headers/macrocache.h \ Headers/abstractNode.h Headers/mapping.h \ Headers/message.h \ Headers/aliasStack.h Headers/messageLog.h \ Headers/aliasTable.h Headers/metaStateConstraint.h \ Headers/annotationInfo.h Headers/metaStateConstraintList.h \ Headers/annotationTable.h Headers/metaStateExpression.h \ Headers/arrayQualNode.h Headers/metaStateInfo.h \ Headers/basic.h Headers/metaStateSpecifier.h \ Headers/bool.h Headers/metaStateTable.h \ Headers/boolStack.h Headers/misc.h \ Headers/cgrammar.h Headers/modifiesClause.h \ Headers/cgrammar_tokens.h Headers/modifyNode.h \ Headers/checking.h Headers/mtAnnotationDecl.h \ Headers/clabstract.h Headers/mtAnnotationList.h \ Headers/claimNode.h Headers/mtAnnotationsNode.h \ Headers/clause.h Headers/mtContextNode.h \ Headers/clauseStack.h Headers/mtDeclarationNode.h \ Headers/code.h Headers/mtDeclarationPiece.h \ Headers/constants.h Headers/mtDeclarationPieces.h \ Headers/constDeclarationNode.h Headers/mtDefaultsDecl.h \ Headers/constraintExprData.h Headers/mtDefaultsDeclList.h \ Headers/constraintExpr.h Headers/mtDefaultsNode.h \ Headers/constraint.h Headers/mtgrammar.h \ Headers/constraintList2.h Headers/mtgrammar.tab.h \ Headers/constraintList.h Headers/mtgrammar_tokens.h \ Headers/constraintOutput.h Headers/mtincludes.h \ Headers/constraintResolve.h Headers/mtLoseReference.h \ Headers/constraintTerm.h Headers/mtLoseReferenceList.h \ Headers/context.h Headers/mtMergeClause.h \ Headers/cpperror.h Headers/mtMergeClauseList.h \ Headers/cppexp.h Headers/mtMergeItem.h \ Headers/cpp.h Headers/mtMergeNode.h \ Headers/cpphash.h Headers/mtreader.h \ Headers/cpplib.h Headers/mtscanner.h \ Headers/cprim.h Headers/mttok.h \ Headers/cscanner.h Headers/mtTransferAction.h \ Headers/cstring.h Headers/mtTransferClause.h \ Headers/cstringList.h Headers/mtTransferClauseList.h \ Headers/cstringSList.h Headers/mtValuesNode.h \ Headers/cstringTable.h Headers/multiVal.h \ Headers/ctokens.h Headers/nameChecks.h \ Headers/ctypeList.h Headers/nameNode.h \ Headers/CTypesNode.h Headers/opFormNode.h \ Headers/cvar.h Headers/osd.h \ Headers/declaratorInvNode.h Headers/pairNode.h \ Headers/declaratorInvNodeList.h Headers/pairNodeList.h \ Headers/declaratorNode.h Headers/paramNode.h \ Headers/declaratorNodeList.h Headers/paramNodeList.h \ Headers/dmalloc.h Headers/osd.h \ Headers/ekind.h Headers/pp.h \ Headers/enumNameList.h Headers/privateNode.h \ Headers/enumNameSList.h Headers/programNode.h \ Headers/enumSpecNode.h Headers/programNodeList.h \ Headers/exportNode.h Headers/qtype.h \ Headers/exposedNode.h Headers/qual.h \ Headers/exprChecks.h Headers/qualList.h \ Headers/exprData.h Headers/quantifiedTermNode.h \ Headers/exprNode.h Headers/quantifierNode.h \ Headers/exprNodeList.h Headers/quantifierNodeList.h \ Headers/exprNodeSList.h Headers/randomNumbers.h \ Headers/fcnNode.h Headers/rcfiles.h \ Headers/fcnNodeList.h Headers/reader.h \ Headers/fileId.h Headers/refTable-branch.h \ Headers/fileIdList.h Headers/renamingNode.h \ Headers/fileLib.h Headers/replaceNode.h \ Headers/fileloc.h Headers/replaceNodeList.h \ Headers/filelocList.h Headers/scan.h \ Headers/filelocStack.h Headers/scanline.h \ Headers/fileTable.h Headers/sgrammar_tokens.h \ Headers/flag_codes.h Headers/sHerald.h \ Headers/flagMarker.h Headers/shift.h \ Headers/flagMarkerList.h Headers/signature2.h \ Headers/flags.h Headers/signature_gen.h \ Headers/flagSpec.h Headers/signature.h \ Headers/forwardTypes.h Headers/signNode.h \ Headers/functionClause.h Headers/sigNode.h \ Headers/functionClauseList.h Headers/sigNodeSet.h \ Headers/functionConstraint.h Headers/sort.h \ Headers/general.h Headers/sortList.h \ Headers/genericTable.h Headers/sortSet.h \ Headers/globalList.h Headers/sortSetList.h \ Headers/globalsClause.h \ Headers/globals.h \ Headers/globSet.h Headers/sRef.h \ Headers/gram.h Headers/sRefList.h \ Headers/guardSet.h Headers/sRefSet.h \ Headers/handle.h Headers/sRefSetList.h \ Headers/sRefSetStack.h \ Headers/idDecl.h Headers/sRefTable.h \ Headers/idDeclList.h Headers/stateClause.h \ Headers/importNode.h Headers/stateClauseList.h \ Headers/importNodeList.h Headers/stateCombinationTable.h \ Headers/imports.h Headers/stateInfo.h \ Headers/initDeclNode.h Headers/stateValue.h \ Headers/initDeclNodeList.h Headers/stDeclNode.h \ Headers/inputStream.h Headers/stDeclNodeList.h \ Headers/interfaceNode.h Headers/stmtNode.h \ Headers/interfaceNodeList.h Headers/storeRefNode.h \ Headers/intSet.h Headers/storeRefNodeList.h \ Headers/intTable.h Headers/strOrUnionNode.h \ Headers/iterNode.h Headers/structNames.h \ Headers/lcl_constants.h Headers/symtable.h \ Headers/lclctypes.h Headers/syntable.h \ Headers/lclForwardTypes.h Headers/system_constants.h \ Headers/lclinit.h Headers/taggedUnionNode.h \ Headers/lcllib.h Headers/termNode.h \ Headers/lclMisc.h Headers/termNodeList.h \ Headers/lclPredicateNode.h Headers/tmpname.h \ Headers/lclscan.h Headers/tokentable.h \ Headers/lclscanline.h Headers/traitRefNode.h \ Headers/lclsyntable.h Headers/traitRefNodeList.h \ Headers/lcltokentable.h Headers/transferChecks.h \ Headers/lclTypeSpecNode.h Headers/typeExpr.h \ Headers/lctype.h Headers/typeIdSet.h \ Headers/letDeclNode.h Headers/typeNameNode.h \ Headers/letDeclNodeList.h Headers/typeNameNodeList.h \ Headers/lh.h Headers/typeNamePack.h \ Headers/limwr.h Headers/typeNode.h \ Headers/uentry.h \ Headers/llerror.h Headers/uentryList.h \ Headers/llglobals.h Headers/usymId.h \ Headers/llgrammar2.h Headers/usymIdSet.h \ Headers/llgrammar_gen2.h \ Headers/llgrammar_gen.h Headers/usymtab.h \ Headers/llgrammar.h Headers/usymtab_interface.h \ Headers/llmain.h Headers/valueMatrix.h \ Headers/lltok.h Headers/valueTable.h \ Headers/lslinit.h Headers/varDeclarationNode.h \ Headers/lslOp.h Headers/varDeclarationNodeList.h \ Headers/lslOpList.h Headers/varKinds.h \ Headers/lslOpSet.h Headers/varNode.h \ Headers/lslparse.h Headers/varNodeList.h \ Headers/lsymbol.h Headers/version.h \ Headers/lsymbolList.h Headers/warnClause.h \ Headers/lsymbolSet.h Headers/ynm.h \ Headers/ltoken.h Headers/splintMacros.nf \ Headers/typeId.h \ Headers/pointers.h Headers/mstring.h Headers/help.h IFILES = ctbase.i cttable.i exprDataQuite.i ## Non-built files we need to distribute EXTRA_DIST = $(BISON_SRC) bison.head bison.reset $(HEADERSRC) \ flags.def cscanner.l flex.head flex.reset $(IFILES) \ .splintrc LICENSE \ Headers/cscannerHelp.h \ Headers/256_random_numbers.nf Headers/splintMacros.nf Headers/reservedNames.nf #Makefile.binary.am Makefile.binary.in #Files that are used on systems that do not have bison or yacc DER_BISON_FILES = signature.c.der cgrammar.c.der mtgrammar.c.der \ llgrammar.c.der DER_FILES = $(DER_BISON_FILES) COMMONSRC = $(CPPSRC) $(CSRC) $(CHECKSRC) $(GENERALSRC) \ $(GLOBSRC) $(IFACESRC) $(LISTSRC) $(SETSRC) $(METASTATESRC) ALLSRC = $(GRAMSRC) $(COMMONSRC) $(SPLINTSRC) $(OVERFLOWCHSRC) $(DER_FILES) $(HEADERSRC) #files to run Splint on LINTSRC = $(COMMONSRC) $(SPLINTSRC) # cscanner.c cgrammar.c #ALLSRC = $(COMMONSRC) $(SPLINTSRC) $(DER_FILES) $(HEADERSRC) LCLSRC = $(LCLSETSRC) $(LCLLISTSRC) $(LSLSRC) $(CMNSRC) $(LCLONLYSRC) lcl_SOURCES = $(LCLSRC) splint_SOURCES = $(ALLSRC) splint_LDADD = $(LCLOBJ) @LEXLIB@ # Ensure the LCL objects get built if needed splint_DEPENDENCIES = $(LCLOBJ) # Keep it fake .PHONY: lcl$(EXEEXT) lcl$(EXEEXT): @echo "This is a fake target"; \ echo "Use configure's --with-lcl option to enable lcl" ## Sources that need to be built BUILT_SOURCES = Headers/signature_gen.h Headers/cgrammar_tokens.h \ Headers/llgrammar_gen.h Headers/llgrammar_gen2.h \ Headers/mtgrammar_tokens.h signature.c cgrammar.c \ llgrammar.c mtgrammar.c Headers/flag_codes.gen \ $(DER_FILES) ## Grammars signature.c.der: @if test x$(BISON) = xno; then \ echo "Cannot make signature.c.der because bison is not here" \ else \ echo '* Making signature.c'; \ $(BISON) $(YFLAGS) -p lsl signature.y; \ $(CAT) bison.head signature.tab.c bison.reset >signature.c; \ $(CP) signature.c signature.c.der; \ $(MV) Headers/signature_gen.h Headers/signature_gen.bak || true; \ $(CAT) bison.head signature.tab.h bison.reset >Headers/signature_gen.h; \ $(RM) signature.tab.c signature.tab.h; \ fi Headers/signature_gen.h signature.c: signature.c.der signature.y @if test x$(BISON) = xno; then \ $(CP) signature.c.der signature.c; \ else \ echo '* Making signature.c'; \ $(BISON) $(YFLAGS) -p lsl signature.y; \ $(CAT) bison.head signature.tab.c bison.reset >signature.c; \ $(CP) signature.c signature.c.der; \ $(MV) Headers/signature_gen.h Headers/signature_gen.bak; \ $(CAT) bison.head signature.tab.h bison.reset >Headers/signature_gen.h; \ $(RM) signature.tab.c signature.tab.h; \ fi ## 11/29/001 drl added copy so that the file cgrammar.c.der is created Headers/cgrammar_tokens.h cgrammar.c: cgrammar.c.der cgrammar.y bison.head bison.reset @if test x$(BISON) = xno; then \ $(CP) cgrammar.c.der cgrammar.c; \ else \ echo '* Making cgrammar.c'; \ echo '* Note: Expect 157 shift/reduce conflicts and 123 reduce/reduce conflicts. (see cgrammar.y for explanation)'; \ $(BISON) $(YFLAGS) cgrammar.y; \ $(CAT) bison.head cgrammar.tab.c bison.reset | $(SED) 's/YYSTYPE/cgrammar_YYSTYPE/g' | $(SED) 's/lsllex/cgrammar_lsllex/g' > cgrammar.c; \ $(CP) cgrammar.c cgrammar.c.der; \ $(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak || true; \ $(CAT) bison.head cgrammar.tab.h bison.reset | $(SED) 's/YYSTYPE/cgrammar_YYSTYPE/g' | $(SED) 's/lsllex/cgrammar_lsllex/g' > Headers/cgrammar_tokens.h; \ $(RM) cgrammar.tab.c cgrammar.tab.h; \ fi ## 10/16/001 drl added copy so that the file mtgrammar.c.der is created ## also removed the dependency for this file on mtgrammary.c Headers/mtgrammar_tokens.h mtgrammar.c: mtgrammar.y @if test x$(BISON) = xno; then \ $(CP) mtgrammar.c.der mtgrammar.c; \ else \ echo '* Making mtgrammar.c'; \ echo '* Note: Expect 11 shift/reduce conflicts.'; \ $(BISON) $(YFLAGS) -p mt mtgrammar.y; \ $(CAT) bison.head mtgrammar.tab.c bison.reset >mtgrammar.c; \ $(CP) mtgrammar.c mtgrammar.c.der; \ $(MV) Headers/mtgrammar_tokens.h Headers/mtgrammar_tokens.bak; \ $(CAT) bison.head mtgrammar.tab.h bison.reset >Headers/mtgrammar_tokens.h; \ $(RM) mtgrammar.tab.c mtgrammar.tab.h; \ fi ## 11/29/001 drl added copy so that the file llgrammar.c.der is created Headers/llgrammar_gen.h Headers/llgrammar_gen2.h llgrammar.c: llgrammar.c.der llgrammar.y @if test x$(BISON) = xno; then \ $(CP) llgrammar.c.der llgrammar.c; \ else \ echo '* Making llgrammar.c'; \ echo '* Note: Expect 2 shift/reduce conflicts'; \ $(BISON) $(YFLAGS) -p yl llgrammar.y; \ $(CAT) bison.head llgrammar.tab.c bison.reset >llgrammar.c; \ $(CP) llgrammar.c llgrammar.c.der; \ $(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak; \ $(CAT) bison.head llgrammar.tab.h bison.reset >Headers/llgrammar_gen2.h; \ $(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak; \ $(CAT) bison.head llgrammar.tab.h bison.reset >Headers/llgrammar_gen.h; \ $(RM) llgrammar.tab.c llgrammar.tab.h; \ fi cscanner.c: cscanner.l $(LEX) $(LFLAGS) cscanner.l $(CAT) flex.head @LEX_OUTPUT_ROOT@.c flex.reset | $(SED) 's/YYSTYPE/cgrammar_YYSTYPE/g' | $(SED) 's/lsllex/cgrammar_lsllex/g' > cscanner.c Headers/flag_codes.gen: flags.def grep "FLG_" flags.def > Headers/flag_codes.gen $(MAKE) cd ../lib; $(MAKE) ## Checking rules CHECKS = $(subst .c,.check,$(splint_SOURCES)) ## Other rules .PHONY: nocheck nocheck: $(MAKE) CHECK=0 .PHONY: test test: ${MAKE} ; cd ../test; ${MAKE} --no-print-directory .PHONY: libs libs: ${MAKE} ; cd ../lib; ${MAKE} --no-print-directory ### Automake generates wrong tags .PHONY: etags etags: maketags lintnew: splintme splintme: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted splintmebounds: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted +bounds +impboundsconstraints splintmesupcounts: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -supcounts -constuse -mts file -mts filerw lintbuffercheck: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +bounds -DLINTBUFFERCHECK valsplint: valgrind -v --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=yes ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw splintsome: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude lcllib.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +partial # drl changed to use # for comment #/* $(LINTSRC) $(LCLSRC)*/ splinttest: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude test.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +keep +supcounts +partial -null binDir = bin all: splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT): splint$(EXEEXT) -$(RM) -f $(top_builddir)/$(binDir)/splint$(EXEEXT) ln -s $(top_builddir)/src/splint$(EXEEXT) $(top_builddir)/$(binDir)/splint$(EXEEXT) up: -rm cgrammar.c llgrammar.c mtgrammar.c signature.c cscanner.c $(MAKE) clean CLEANFILES = splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT) .c.o: @echo "Compiling "$<"..."; \ source='$<' object='$@' libtool=no \ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \ $(CCDEPMODE) $(depcomp) \ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< splint-3.1.2.dfsg1/src/Makefile.in0000644021234200000250000015554710645770722014332 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.5 foreign SUFFIXES = .h .c .o .l .check # Check files before compiling; requires splint! CHECK = 1 # Some preferences ### We use the no-lines option to prevent confusion with splint flag settings. ### Should fix splint to avoid this... YFLAGS = -v -t -d --debug --no-lines LFLAGS = -L BISON_SRC = cgrammar.y llgrammar.y mtgrammar.y signature.y bin_PROGRAMS = splint EXTRA_PROGRAMS = lcl AM_CPPFLAGS = -IHeaders SETSRC = globSet.c intSet.c typeIdSet.c guardSet.c usymIdSet.c sRefSet.c LISTSRC = clauseStack.c filelocStack.c \ cstringList.c cstringSList.c sRefSetList.c ctypeList.c \ enumNameList.c enumNameSList.c exprNodeList.c exprNodeSList.c \ uentryList.c fileIdList.c filelocList.c qualList.c sRefList.c \ flagMarkerList.c idDeclList.c flagSpec.c CPPSRC = cppmain.c cpplib.c cppexp.c cpphash.c cpperror.c CSRC = context.c uentry.c cprim.c macrocache.c qual.c qtype.c stateClause.c \ stateClauseList.c ctype.c cvar.c clabstract.c idDecl.c clause.c \ globalsClause.c modifiesClause.c warnClause.c functionClause.c \ functionClauseList.c metaStateConstraint.c metaStateConstraintList.c \ metaStateExpression.c metaStateSpecifier.c functionConstraint.c \ pointers.c cscannerHelp.c SPLINTSRC = exprNode.c exprChecks.c llmain.c help.c rcfiles.c CHECKSRC = structNames.c transferChecks.c varKinds.c nameChecks.c GLOBSRC = globals.c flags.c general.c osd.c reader.c mtreader.c GRAMSRC = cgrammar.c cscanner.c mtscanner.c mtgrammar.c llgrammar.c signature.c OVERFLOWCHSRC = constraintList.c constraintResolve.c \ constraintGeneration.c constraintTerm.c \ constraintExprData.c constraintExpr.c constraint.c \ loopHeuristics.c GENERALSRC = exprData.c cstring.c fileloc.c message.c inputStream.c \ fileTable.c cstringTable.c valueTable.c stateValue.c \ llerror.c messageLog.c flagMarker.c aliasTable.c ynm.c \ sRefTable.c genericTable.c ekind.c usymtab.c multiVal.c \ lltok.c sRef.c lcllib.c randomNumbers.c fileLib.c METASTATESRC = stateInfo.c stateCombinationTable.c metaStateTable.c \ metaStateInfo.c annotationTable.c annotationInfo.c mttok.c \ mtDeclarationNode.c mtDeclarationPieces.c mtDeclarationPiece.c \ mtContextNode.c mtValuesNode.c mtDefaultsNode.c \ mtAnnotationsNode.c mtMergeNode.c mtAnnotationList.c \ mtAnnotationDecl.c mtTransferClauseList.c mtTransferClause.c \ mtTransferAction.c mtLoseReferenceList.c mtLoseReference.c \ mtDefaultsDeclList.c mtDefaultsDecl.c mtMergeItem.c \ mtMergeClause.c mtMergeClauseList.c LCLONLYSRC = usymtab_interface.c abstract.c ltoken.c lclscanline.c \ lclsyntable.c lcltokentable.c sort.c symtable.c lclinit.c \ shift.c lclscan.c lsymbol.c mapping.c LSLSRC = tokentable.c scan.c scanline.c lslparse.c \ lh.c checking.c lclctypes.c imports.c lslinit.c syntable.c LCLSETSRC = lsymbolSet.c sigNodeSet.c lslOpSet.c sortSet.c LCLLISTSRC = initDeclNodeList.c sortList.c declaratorInvNodeList.c \ interfaceNodeList.c sortSetList.c declaratorNodeList.c \ letDeclNodeList.c stDeclNodeList.c storeRefNodeList.c \ lslOpList.c lsymbolList.c termNodeList.c ltokenList.c \ traitRefNodeList.c pairNodeList.c typeNameNodeList.c \ fcnNodeList.c paramNodeList.c programNodeList.c \ varDeclarationNodeList.c varNodeList.c quantifierNodeList.c \ replaceNodeList.c importNodeList.c HEADERSRC = Headers/abstBodyNode.h Headers/ltokenList.h \ Headers/abstract.h Headers/macrocache.h \ Headers/abstractNode.h Headers/mapping.h \ Headers/message.h \ Headers/aliasStack.h Headers/messageLog.h \ Headers/aliasTable.h Headers/metaStateConstraint.h \ Headers/annotationInfo.h Headers/metaStateConstraintList.h \ Headers/annotationTable.h Headers/metaStateExpression.h \ Headers/arrayQualNode.h Headers/metaStateInfo.h \ Headers/basic.h Headers/metaStateSpecifier.h \ Headers/bool.h Headers/metaStateTable.h \ Headers/boolStack.h Headers/misc.h \ Headers/cgrammar.h Headers/modifiesClause.h \ Headers/cgrammar_tokens.h Headers/modifyNode.h \ Headers/checking.h Headers/mtAnnotationDecl.h \ Headers/clabstract.h Headers/mtAnnotationList.h \ Headers/claimNode.h Headers/mtAnnotationsNode.h \ Headers/clause.h Headers/mtContextNode.h \ Headers/clauseStack.h Headers/mtDeclarationNode.h \ Headers/code.h Headers/mtDeclarationPiece.h \ Headers/constants.h Headers/mtDeclarationPieces.h \ Headers/constDeclarationNode.h Headers/mtDefaultsDecl.h \ Headers/constraintExprData.h Headers/mtDefaultsDeclList.h \ Headers/constraintExpr.h Headers/mtDefaultsNode.h \ Headers/constraint.h Headers/mtgrammar.h \ Headers/constraintList2.h Headers/mtgrammar.tab.h \ Headers/constraintList.h Headers/mtgrammar_tokens.h \ Headers/constraintOutput.h Headers/mtincludes.h \ Headers/constraintResolve.h Headers/mtLoseReference.h \ Headers/constraintTerm.h Headers/mtLoseReferenceList.h \ Headers/context.h Headers/mtMergeClause.h \ Headers/cpperror.h Headers/mtMergeClauseList.h \ Headers/cppexp.h Headers/mtMergeItem.h \ Headers/cpp.h Headers/mtMergeNode.h \ Headers/cpphash.h Headers/mtreader.h \ Headers/cpplib.h Headers/mtscanner.h \ Headers/cprim.h Headers/mttok.h \ Headers/cscanner.h Headers/mtTransferAction.h \ Headers/cstring.h Headers/mtTransferClause.h \ Headers/cstringList.h Headers/mtTransferClauseList.h \ Headers/cstringSList.h Headers/mtValuesNode.h \ Headers/cstringTable.h Headers/multiVal.h \ Headers/ctokens.h Headers/nameChecks.h \ Headers/ctypeList.h Headers/nameNode.h \ Headers/CTypesNode.h Headers/opFormNode.h \ Headers/cvar.h Headers/osd.h \ Headers/declaratorInvNode.h Headers/pairNode.h \ Headers/declaratorInvNodeList.h Headers/pairNodeList.h \ Headers/declaratorNode.h Headers/paramNode.h \ Headers/declaratorNodeList.h Headers/paramNodeList.h \ Headers/dmalloc.h Headers/osd.h \ Headers/ekind.h Headers/pp.h \ Headers/enumNameList.h Headers/privateNode.h \ Headers/enumNameSList.h Headers/programNode.h \ Headers/enumSpecNode.h Headers/programNodeList.h \ Headers/exportNode.h Headers/qtype.h \ Headers/exposedNode.h Headers/qual.h \ Headers/exprChecks.h Headers/qualList.h \ Headers/exprData.h Headers/quantifiedTermNode.h \ Headers/exprNode.h Headers/quantifierNode.h \ Headers/exprNodeList.h Headers/quantifierNodeList.h \ Headers/exprNodeSList.h Headers/randomNumbers.h \ Headers/fcnNode.h Headers/rcfiles.h \ Headers/fcnNodeList.h Headers/reader.h \ Headers/fileId.h Headers/refTable-branch.h \ Headers/fileIdList.h Headers/renamingNode.h \ Headers/fileLib.h Headers/replaceNode.h \ Headers/fileloc.h Headers/replaceNodeList.h \ Headers/filelocList.h Headers/scan.h \ Headers/filelocStack.h Headers/scanline.h \ Headers/fileTable.h Headers/sgrammar_tokens.h \ Headers/flag_codes.h Headers/sHerald.h \ Headers/flagMarker.h Headers/shift.h \ Headers/flagMarkerList.h Headers/signature2.h \ Headers/flags.h Headers/signature_gen.h \ Headers/flagSpec.h Headers/signature.h \ Headers/forwardTypes.h Headers/signNode.h \ Headers/functionClause.h Headers/sigNode.h \ Headers/functionClauseList.h Headers/sigNodeSet.h \ Headers/functionConstraint.h Headers/sort.h \ Headers/general.h Headers/sortList.h \ Headers/genericTable.h Headers/sortSet.h \ Headers/globalList.h Headers/sortSetList.h \ Headers/globalsClause.h \ Headers/globals.h \ Headers/globSet.h Headers/sRef.h \ Headers/gram.h Headers/sRefList.h \ Headers/guardSet.h Headers/sRefSet.h \ Headers/handle.h Headers/sRefSetList.h \ Headers/sRefSetStack.h \ Headers/idDecl.h Headers/sRefTable.h \ Headers/idDeclList.h Headers/stateClause.h \ Headers/importNode.h Headers/stateClauseList.h \ Headers/importNodeList.h Headers/stateCombinationTable.h \ Headers/imports.h Headers/stateInfo.h \ Headers/initDeclNode.h Headers/stateValue.h \ Headers/initDeclNodeList.h Headers/stDeclNode.h \ Headers/inputStream.h Headers/stDeclNodeList.h \ Headers/interfaceNode.h Headers/stmtNode.h \ Headers/interfaceNodeList.h Headers/storeRefNode.h \ Headers/intSet.h Headers/storeRefNodeList.h \ Headers/intTable.h Headers/strOrUnionNode.h \ Headers/iterNode.h Headers/structNames.h \ Headers/lcl_constants.h Headers/symtable.h \ Headers/lclctypes.h Headers/syntable.h \ Headers/lclForwardTypes.h Headers/system_constants.h \ Headers/lclinit.h Headers/taggedUnionNode.h \ Headers/lcllib.h Headers/termNode.h \ Headers/lclMisc.h Headers/termNodeList.h \ Headers/lclPredicateNode.h Headers/tmpname.h \ Headers/lclscan.h Headers/tokentable.h \ Headers/lclscanline.h Headers/traitRefNode.h \ Headers/lclsyntable.h Headers/traitRefNodeList.h \ Headers/lcltokentable.h Headers/transferChecks.h \ Headers/lclTypeSpecNode.h Headers/typeExpr.h \ Headers/lctype.h Headers/typeIdSet.h \ Headers/letDeclNode.h Headers/typeNameNode.h \ Headers/letDeclNodeList.h Headers/typeNameNodeList.h \ Headers/lh.h Headers/typeNamePack.h \ Headers/limwr.h Headers/typeNode.h \ Headers/uentry.h \ Headers/llerror.h Headers/uentryList.h \ Headers/llglobals.h Headers/usymId.h \ Headers/llgrammar2.h Headers/usymIdSet.h \ Headers/llgrammar_gen2.h \ Headers/llgrammar_gen.h Headers/usymtab.h \ Headers/llgrammar.h Headers/usymtab_interface.h \ Headers/llmain.h Headers/valueMatrix.h \ Headers/lltok.h Headers/valueTable.h \ Headers/lslinit.h Headers/varDeclarationNode.h \ Headers/lslOp.h Headers/varDeclarationNodeList.h \ Headers/lslOpList.h Headers/varKinds.h \ Headers/lslOpSet.h Headers/varNode.h \ Headers/lslparse.h Headers/varNodeList.h \ Headers/lsymbol.h Headers/version.h \ Headers/lsymbolList.h Headers/warnClause.h \ Headers/lsymbolSet.h Headers/ynm.h \ Headers/ltoken.h Headers/splintMacros.nf \ Headers/typeId.h \ Headers/pointers.h Headers/mstring.h Headers/help.h IFILES = ctbase.i cttable.i exprDataQuite.i EXTRA_DIST = $(BISON_SRC) bison.head bison.reset $(HEADERSRC) \ flags.def cscanner.l flex.head flex.reset $(IFILES) \ .splintrc LICENSE \ Headers/cscannerHelp.h \ Headers/256_random_numbers.nf Headers/splintMacros.nf Headers/reservedNames.nf #Makefile.binary.am Makefile.binary.in #Files that are used on systems that do not have bison or yacc DER_BISON_FILES = signature.c.der cgrammar.c.der mtgrammar.c.der \ llgrammar.c.der DER_FILES = $(DER_BISON_FILES) COMMONSRC = $(CPPSRC) $(CSRC) $(CHECKSRC) $(GENERALSRC) \ $(GLOBSRC) $(IFACESRC) $(LISTSRC) $(SETSRC) $(METASTATESRC) ALLSRC = $(GRAMSRC) $(COMMONSRC) $(SPLINTSRC) $(OVERFLOWCHSRC) $(DER_FILES) $(HEADERSRC) #files to run Splint on LINTSRC = $(COMMONSRC) $(SPLINTSRC) # cscanner.c cgrammar.c #ALLSRC = $(COMMONSRC) $(SPLINTSRC) $(DER_FILES) $(HEADERSRC) LCLSRC = $(LCLSETSRC) $(LCLLISTSRC) $(LSLSRC) $(CMNSRC) $(LCLONLYSRC) lcl_SOURCES = $(LCLSRC) splint_SOURCES = $(ALLSRC) splint_LDADD = $(LCLOBJ) @LEXLIB@ # Ensure the LCL objects get built if needed splint_DEPENDENCIES = $(LCLOBJ) BUILT_SOURCES = Headers/signature_gen.h Headers/cgrammar_tokens.h \ Headers/llgrammar_gen.h Headers/llgrammar_gen2.h \ Headers/mtgrammar_tokens.h signature.c cgrammar.c \ llgrammar.c mtgrammar.c Headers/flag_codes.gen \ $(DER_FILES) CHECKS = $(subst .c,.check,$(splint_SOURCES)) binDir = bin CLEANFILES = splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT) subdir = src mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = EXTRA_PROGRAMS = lcl$(EXEEXT) bin_PROGRAMS = splint$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) am__objects_1 = lsymbolSet.$(OBJEXT) sigNodeSet.$(OBJEXT) \ lslOpSet.$(OBJEXT) sortSet.$(OBJEXT) am__objects_2 = initDeclNodeList.$(OBJEXT) sortList.$(OBJEXT) \ declaratorInvNodeList.$(OBJEXT) interfaceNodeList.$(OBJEXT) \ sortSetList.$(OBJEXT) declaratorNodeList.$(OBJEXT) \ letDeclNodeList.$(OBJEXT) stDeclNodeList.$(OBJEXT) \ storeRefNodeList.$(OBJEXT) lslOpList.$(OBJEXT) \ lsymbolList.$(OBJEXT) termNodeList.$(OBJEXT) \ ltokenList.$(OBJEXT) traitRefNodeList.$(OBJEXT) \ pairNodeList.$(OBJEXT) typeNameNodeList.$(OBJEXT) \ fcnNodeList.$(OBJEXT) paramNodeList.$(OBJEXT) \ programNodeList.$(OBJEXT) varDeclarationNodeList.$(OBJEXT) \ varNodeList.$(OBJEXT) quantifierNodeList.$(OBJEXT) \ replaceNodeList.$(OBJEXT) importNodeList.$(OBJEXT) am__objects_3 = tokentable.$(OBJEXT) scan.$(OBJEXT) scanline.$(OBJEXT) \ lslparse.$(OBJEXT) lh.$(OBJEXT) checking.$(OBJEXT) \ lclctypes.$(OBJEXT) imports.$(OBJEXT) lslinit.$(OBJEXT) \ syntable.$(OBJEXT) am__objects_5 = usymtab_interface.$(OBJEXT) abstract.$(OBJEXT) \ ltoken.$(OBJEXT) lclscanline.$(OBJEXT) lclsyntable.$(OBJEXT) \ lcltokentable.$(OBJEXT) sort.$(OBJEXT) symtable.$(OBJEXT) \ lclinit.$(OBJEXT) shift.$(OBJEXT) lclscan.$(OBJEXT) \ lsymbol.$(OBJEXT) mapping.$(OBJEXT) am__objects_6 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) $(am__objects_5) am_lcl_OBJECTS = $(am__objects_6) lcl_OBJECTS = $(am_lcl_OBJECTS) lcl_LDADD = $(LDADD) lcl_DEPENDENCIES = lcl_LDFLAGS = am__objects_7 = cgrammar.$(OBJEXT) cscanner.$(OBJEXT) \ mtscanner.$(OBJEXT) mtgrammar.$(OBJEXT) llgrammar.$(OBJEXT) \ signature.$(OBJEXT) am__objects_8 = cppmain.$(OBJEXT) cpplib.$(OBJEXT) cppexp.$(OBJEXT) \ cpphash.$(OBJEXT) cpperror.$(OBJEXT) am__objects_9 = context.$(OBJEXT) uentry.$(OBJEXT) cprim.$(OBJEXT) \ macrocache.$(OBJEXT) qual.$(OBJEXT) qtype.$(OBJEXT) \ stateClause.$(OBJEXT) stateClauseList.$(OBJEXT) ctype.$(OBJEXT) \ cvar.$(OBJEXT) clabstract.$(OBJEXT) idDecl.$(OBJEXT) \ clause.$(OBJEXT) globalsClause.$(OBJEXT) \ modifiesClause.$(OBJEXT) warnClause.$(OBJEXT) \ functionClause.$(OBJEXT) functionClauseList.$(OBJEXT) \ metaStateConstraint.$(OBJEXT) metaStateConstraintList.$(OBJEXT) \ metaStateExpression.$(OBJEXT) metaStateSpecifier.$(OBJEXT) \ functionConstraint.$(OBJEXT) pointers.$(OBJEXT) \ cscannerHelp.$(OBJEXT) am__objects_10 = structNames.$(OBJEXT) transferChecks.$(OBJEXT) \ varKinds.$(OBJEXT) nameChecks.$(OBJEXT) am__objects_11 = exprData.$(OBJEXT) cstring.$(OBJEXT) fileloc.$(OBJEXT) \ message.$(OBJEXT) inputStream.$(OBJEXT) fileTable.$(OBJEXT) \ cstringTable.$(OBJEXT) valueTable.$(OBJEXT) \ stateValue.$(OBJEXT) llerror.$(OBJEXT) messageLog.$(OBJEXT) \ flagMarker.$(OBJEXT) aliasTable.$(OBJEXT) ynm.$(OBJEXT) \ sRefTable.$(OBJEXT) genericTable.$(OBJEXT) ekind.$(OBJEXT) \ usymtab.$(OBJEXT) multiVal.$(OBJEXT) lltok.$(OBJEXT) \ sRef.$(OBJEXT) lcllib.$(OBJEXT) randomNumbers.$(OBJEXT) \ fileLib.$(OBJEXT) am__objects_12 = globals.$(OBJEXT) flags.$(OBJEXT) general.$(OBJEXT) \ osd.$(OBJEXT) reader.$(OBJEXT) mtreader.$(OBJEXT) am__objects_13 = clauseStack.$(OBJEXT) filelocStack.$(OBJEXT) \ cstringList.$(OBJEXT) cstringSList.$(OBJEXT) \ sRefSetList.$(OBJEXT) ctypeList.$(OBJEXT) \ enumNameList.$(OBJEXT) enumNameSList.$(OBJEXT) \ exprNodeList.$(OBJEXT) exprNodeSList.$(OBJEXT) \ uentryList.$(OBJEXT) fileIdList.$(OBJEXT) filelocList.$(OBJEXT) \ qualList.$(OBJEXT) sRefList.$(OBJEXT) flagMarkerList.$(OBJEXT) \ idDeclList.$(OBJEXT) flagSpec.$(OBJEXT) am__objects_14 = globSet.$(OBJEXT) intSet.$(OBJEXT) typeIdSet.$(OBJEXT) \ guardSet.$(OBJEXT) usymIdSet.$(OBJEXT) sRefSet.$(OBJEXT) am__objects_15 = stateInfo.$(OBJEXT) stateCombinationTable.$(OBJEXT) \ metaStateTable.$(OBJEXT) metaStateInfo.$(OBJEXT) \ annotationTable.$(OBJEXT) annotationInfo.$(OBJEXT) \ mttok.$(OBJEXT) mtDeclarationNode.$(OBJEXT) \ mtDeclarationPieces.$(OBJEXT) mtDeclarationPiece.$(OBJEXT) \ mtContextNode.$(OBJEXT) mtValuesNode.$(OBJEXT) \ mtDefaultsNode.$(OBJEXT) mtAnnotationsNode.$(OBJEXT) \ mtMergeNode.$(OBJEXT) mtAnnotationList.$(OBJEXT) \ mtAnnotationDecl.$(OBJEXT) mtTransferClauseList.$(OBJEXT) \ mtTransferClause.$(OBJEXT) mtTransferAction.$(OBJEXT) \ mtLoseReferenceList.$(OBJEXT) mtLoseReference.$(OBJEXT) \ mtDefaultsDeclList.$(OBJEXT) mtDefaultsDecl.$(OBJEXT) \ mtMergeItem.$(OBJEXT) mtMergeClause.$(OBJEXT) \ mtMergeClauseList.$(OBJEXT) am__objects_16 = $(am__objects_8) $(am__objects_9) $(am__objects_10) \ $(am__objects_11) $(am__objects_12) $(am__objects_4) \ $(am__objects_13) $(am__objects_14) $(am__objects_15) am__objects_17 = exprNode.$(OBJEXT) exprChecks.$(OBJEXT) \ llmain.$(OBJEXT) help.$(OBJEXT) rcfiles.$(OBJEXT) am__objects_18 = constraintList.$(OBJEXT) constraintResolve.$(OBJEXT) \ constraintGeneration.$(OBJEXT) constraintTerm.$(OBJEXT) \ constraintExprData.$(OBJEXT) constraintExpr.$(OBJEXT) \ constraint.$(OBJEXT) loopHeuristics.$(OBJEXT) am__objects_19 = am__objects_20 = $(am__objects_19) am__objects_21 = $(am__objects_7) $(am__objects_16) $(am__objects_17) \ $(am__objects_18) $(am__objects_20) $(am__objects_19) am_splint_OBJECTS = $(am__objects_21) splint_OBJECTS = $(am_splint_OBJECTS) splint_LDFLAGS = DEFS = @DEFS@ DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir) CPPFLAGS = @CPPFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles @AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/abstract.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/aliasTable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/annotationInfo.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/annotationTable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cgrammar.Po ./$(DEPDIR)/checking.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/clabstract.Po ./$(DEPDIR)/clause.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/clauseStack.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/constraint.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/constraintExpr.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/constraintExprData.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/constraintGeneration.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/constraintList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/constraintResolve.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/constraintTerm.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/context.Po ./$(DEPDIR)/cpperror.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cppexp.Po ./$(DEPDIR)/cpphash.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cpplib.Po ./$(DEPDIR)/cppmain.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cprim.Po ./$(DEPDIR)/cscanner.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cscannerHelp.Po ./$(DEPDIR)/cstring.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cstringList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cstringSList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/cstringTable.Po ./$(DEPDIR)/ctype.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ctypeList.Po ./$(DEPDIR)/cvar.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/declaratorInvNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/declaratorNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ekind.Po ./$(DEPDIR)/enumNameList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/enumNameSList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/exprChecks.Po ./$(DEPDIR)/exprData.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/exprNode.Po ./$(DEPDIR)/exprNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/exprNodeSList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/fcnNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/fileIdList.Po ./$(DEPDIR)/fileLib.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/fileTable.Po ./$(DEPDIR)/fileloc.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/filelocList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/filelocStack.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/flagMarker.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/flagMarkerList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/flagSpec.Po ./$(DEPDIR)/flags.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/functionClause.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/functionClauseList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/functionConstraint.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/general.Po ./$(DEPDIR)/genericTable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/globSet.Po ./$(DEPDIR)/globals.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/globalsClause.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/guardSet.Po ./$(DEPDIR)/help.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/idDecl.Po ./$(DEPDIR)/idDeclList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/importNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/imports.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/initDeclNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/inputStream.Po ./$(DEPDIR)/intSet.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/interfaceNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lclctypes.Po ./$(DEPDIR)/lclinit.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lcllib.Po ./$(DEPDIR)/lclscan.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lclscanline.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lclsyntable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lcltokentable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/letDeclNodeList.Po ./$(DEPDIR)/lh.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/llerror.Po ./$(DEPDIR)/llgrammar.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/llmain.Po ./$(DEPDIR)/lltok.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/loopHeuristics.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lslOpList.Po ./$(DEPDIR)/lslOpSet.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lslinit.Po ./$(DEPDIR)/lslparse.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lsymbol.Po ./$(DEPDIR)/lsymbolList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/lsymbolSet.Po ./$(DEPDIR)/ltoken.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/ltokenList.Po ./$(DEPDIR)/macrocache.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mapping.Po ./$(DEPDIR)/message.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/messageLog.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/metaStateConstraint.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/metaStateConstraintList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/metaStateExpression.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/metaStateInfo.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/metaStateSpecifier.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/metaStateTable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/modifiesClause.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtAnnotationDecl.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtAnnotationList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtAnnotationsNode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtContextNode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtDeclarationNode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtDeclarationPiece.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtDeclarationPieces.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtDefaultsDecl.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtDefaultsDeclList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtDefaultsNode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtLoseReference.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtLoseReferenceList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtMergeClause.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtMergeClauseList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtMergeItem.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtMergeNode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtTransferAction.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtTransferClause.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtTransferClauseList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtValuesNode.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtgrammar.Po ./$(DEPDIR)/mtreader.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/mtscanner.Po ./$(DEPDIR)/mttok.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/multiVal.Po ./$(DEPDIR)/nameChecks.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/osd.Po ./$(DEPDIR)/pairNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/paramNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/pointers.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/programNodeList.Po ./$(DEPDIR)/qtype.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/qual.Po ./$(DEPDIR)/qualList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/quantifierNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/randomNumbers.Po ./$(DEPDIR)/rcfiles.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/reader.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/replaceNodeList.Po ./$(DEPDIR)/sRef.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sRefList.Po ./$(DEPDIR)/sRefSet.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sRefSetList.Po ./$(DEPDIR)/sRefTable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/scan.Po ./$(DEPDIR)/scanline.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/shift.Po ./$(DEPDIR)/sigNodeSet.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/signature.Po ./$(DEPDIR)/sort.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sortList.Po ./$(DEPDIR)/sortSet.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/sortSetList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/stDeclNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/stateClause.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/stateClauseList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/stateCombinationTable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/stateInfo.Po ./$(DEPDIR)/stateValue.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/storeRefNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/structNames.Po ./$(DEPDIR)/symtable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/syntable.Po ./$(DEPDIR)/termNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/tokentable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/traitRefNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/transferChecks.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/typeIdSet.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/typeNameNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/uentry.Po ./$(DEPDIR)/uentryList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/usymIdSet.Po ./$(DEPDIR)/usymtab.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/usymtab_interface.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/valueTable.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/varDeclarationNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/varKinds.Po ./$(DEPDIR)/varNodeList.Po \ @AMDEP_TRUE@ ./$(DEPDIR)/warnClause.Po ./$(DEPDIR)/ynm.Po COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CFLAGS = @CFLAGS@ DIST_SOURCES = $(lcl_SOURCES) $(splint_SOURCES) DIST_COMMON = Makefile.am Makefile.in SOURCES = $(lcl_SOURCES) $(splint_SOURCES) all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .h .c .o .l .check .obj $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(bindir) @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) splint$(EXEEXT): $(splint_OBJECTS) $(splint_DEPENDENCIES) @rm -f splint$(EXEEXT) $(LINK) $(splint_LDFLAGS) $(splint_OBJECTS) $(splint_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/abstract.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/aliasTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/annotationInfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/annotationTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cgrammar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/checking.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clabstract.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/clauseStack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constraint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constraintExpr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constraintExprData.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constraintGeneration.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constraintList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constraintResolve.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/constraintTerm.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/context.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpperror.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppexp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpphash.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpplib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cppmain.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cprim.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cscanner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cscannerHelp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cstring.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cstringList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cstringSList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cstringTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ctypeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cvar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/declaratorInvNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/declaratorNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ekind.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enumNameList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/enumNameSList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exprChecks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exprData.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exprNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exprNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exprNodeSList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fcnNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileIdList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileLib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileloc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filelocList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filelocStack.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flagMarker.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flagMarkerList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flagSpec.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/flags.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functionClause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functionClauseList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/functionConstraint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/general.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/genericTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globals.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/globalsClause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/guardSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/help.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idDecl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/idDeclList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/importNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/imports.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initDeclNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inputStream.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/intSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/interfaceNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lclctypes.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lclinit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcllib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lclscan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lclscanline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lclsyntable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lcltokentable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/letDeclNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lh.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llerror.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llgrammar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/llmain.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lltok.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loopHeuristics.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lslOpList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lslOpSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lslinit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lslparse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsymbol.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsymbolList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lsymbolSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltoken.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ltokenList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/macrocache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapping.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/message.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/messageLog.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaStateConstraint.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaStateConstraintList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaStateExpression.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaStateInfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaStateSpecifier.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/metaStateTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modifiesClause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtAnnotationDecl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtAnnotationList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtAnnotationsNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtContextNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtDeclarationNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtDeclarationPiece.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtDeclarationPieces.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtDefaultsDecl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtDefaultsDeclList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtDefaultsNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtLoseReference.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtLoseReferenceList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtMergeClause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtMergeClauseList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtMergeItem.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtMergeNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtTransferAction.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtTransferClause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtTransferClauseList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtValuesNode.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtgrammar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtreader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mtscanner.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mttok.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multiVal.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/nameChecks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/osd.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pairNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/paramNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pointers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/programNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qtype.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qual.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/qualList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/quantifierNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/randomNumbers.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rcfiles.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/reader.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/replaceNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sRef.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sRefList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sRefSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sRefSetList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sRefTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scan.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scanline.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/shift.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigNodeSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signature.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sort.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sortList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sortSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sortSetList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stDeclNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stateClause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stateClauseList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stateCombinationTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stateInfo.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stateValue.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/storeRefNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/structNames.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/symtable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syntable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/termNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tokentable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/traitRefNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transferChecks.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/typeIdSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/typeNameNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uentry.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uentryList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usymIdSet.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usymtab.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/usymtab_interface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/valueTable.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varDeclarationNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varKinds.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/varNodeList.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/warnClause.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ynm.Po@am__quote@ distclean-depend: -rm -rf ./$(DEPDIR) .c.obj: @AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ @AMDEP_TRUE@ $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ $(COMPILE) -c `cygpath -w $<` CCDEPMODE = @CCDEPMODE@ uninstall-info-am: ETAGS = etags ETAGSFLAGS = tags: TAGS ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(ETAGS_ARGS)$$tags$$unique" \ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) $(mkinstalldirs) $(distdir)/Headers @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: $(mkinstalldirs) $(DESTDIR)$(bindir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-compile distclean-depend \ distclean-generic distclean-tags dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-binPROGRAMS install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic uninstall-am: uninstall-binPROGRAMS uninstall-info-am .PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic distclean distclean-compile distclean-depend \ distclean-generic distclean-tags distdir dvi dvi-am info \ info-am install install-am install-binPROGRAMS install-data \ install-data-am install-exec install-exec-am install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic tags uninstall uninstall-am \ uninstall-binPROGRAMS uninstall-info-am # Keep it fake .PHONY: lcl$(EXEEXT) lcl$(EXEEXT): @echo "This is a fake target"; \ echo "Use configure's --with-lcl option to enable lcl" signature.c.der: @if test x$(BISON) = xno; then \ echo "Cannot make signature.c.der because bison is not here" \ else \ echo '* Making signature.c'; \ $(BISON) $(YFLAGS) -p lsl signature.y; \ $(CAT) bison.head signature.tab.c bison.reset >signature.c; \ $(CP) signature.c signature.c.der; \ $(MV) Headers/signature_gen.h Headers/signature_gen.bak || true; \ $(CAT) bison.head signature.tab.h bison.reset >Headers/signature_gen.h; \ $(RM) signature.tab.c signature.tab.h; \ fi Headers/signature_gen.h signature.c: signature.c.der signature.y @if test x$(BISON) = xno; then \ $(CP) signature.c.der signature.c; \ else \ echo '* Making signature.c'; \ $(BISON) $(YFLAGS) -p lsl signature.y; \ $(CAT) bison.head signature.tab.c bison.reset >signature.c; \ $(CP) signature.c signature.c.der; \ $(MV) Headers/signature_gen.h Headers/signature_gen.bak; \ $(CAT) bison.head signature.tab.h bison.reset >Headers/signature_gen.h; \ $(RM) signature.tab.c signature.tab.h; \ fi Headers/cgrammar_tokens.h cgrammar.c: cgrammar.c.der cgrammar.y bison.head bison.reset @if test x$(BISON) = xno; then \ $(CP) cgrammar.c.der cgrammar.c; \ else \ echo '* Making cgrammar.c'; \ echo '* Note: Expect 157 shift/reduce conflicts and 123 reduce/reduce conflicts. (see cgrammar.y for explanation)'; \ $(BISON) $(YFLAGS) cgrammar.y; \ $(CAT) bison.head cgrammar.tab.c bison.reset | $(SED) 's/YYSTYPE/cgrammar_YYSTYPE/g' | $(SED) 's/lsllex/cgrammar_lsllex/g' > cgrammar.c; \ $(CP) cgrammar.c cgrammar.c.der; \ $(MV) Headers/cgrammar_tokens.h Headers/cgrammar_tokens.bak || true; \ $(CAT) bison.head cgrammar.tab.h bison.reset | $(SED) 's/YYSTYPE/cgrammar_YYSTYPE/g' | $(SED) 's/lsllex/cgrammar_lsllex/g' > Headers/cgrammar_tokens.h; \ $(RM) cgrammar.tab.c cgrammar.tab.h; \ fi Headers/mtgrammar_tokens.h mtgrammar.c: mtgrammar.y @if test x$(BISON) = xno; then \ $(CP) mtgrammar.c.der mtgrammar.c; \ else \ echo '* Making mtgrammar.c'; \ echo '* Note: Expect 11 shift/reduce conflicts.'; \ $(BISON) $(YFLAGS) -p mt mtgrammar.y; \ $(CAT) bison.head mtgrammar.tab.c bison.reset >mtgrammar.c; \ $(CP) mtgrammar.c mtgrammar.c.der; \ $(MV) Headers/mtgrammar_tokens.h Headers/mtgrammar_tokens.bak; \ $(CAT) bison.head mtgrammar.tab.h bison.reset >Headers/mtgrammar_tokens.h; \ $(RM) mtgrammar.tab.c mtgrammar.tab.h; \ fi Headers/llgrammar_gen.h Headers/llgrammar_gen2.h llgrammar.c: llgrammar.c.der llgrammar.y @if test x$(BISON) = xno; then \ $(CP) llgrammar.c.der llgrammar.c; \ else \ echo '* Making llgrammar.c'; \ echo '* Note: Expect 2 shift/reduce conflicts'; \ $(BISON) $(YFLAGS) -p yl llgrammar.y; \ $(CAT) bison.head llgrammar.tab.c bison.reset >llgrammar.c; \ $(CP) llgrammar.c llgrammar.c.der; \ $(MV) Headers/llgrammar_gen2.h Headers/llgrammar_gen2.bak; \ $(CAT) bison.head llgrammar.tab.h bison.reset >Headers/llgrammar_gen2.h; \ $(MV) Headers/llgrammar_gen.h Headers/llgrammar_gen.bak; \ $(CAT) bison.head llgrammar.tab.h bison.reset >Headers/llgrammar_gen.h; \ $(RM) llgrammar.tab.c llgrammar.tab.h; \ fi cscanner.c: cscanner.l $(LEX) $(LFLAGS) cscanner.l $(CAT) flex.head @LEX_OUTPUT_ROOT@.c flex.reset | $(SED) 's/YYSTYPE/cgrammar_YYSTYPE/g' | $(SED) 's/lsllex/cgrammar_lsllex/g' > cscanner.c Headers/flag_codes.gen: flags.def grep "FLG_" flags.def > Headers/flag_codes.gen $(MAKE) cd ../lib; $(MAKE) .PHONY: nocheck nocheck: $(MAKE) CHECK=0 .PHONY: test test: cd ../test; ${MAKE} --no-print-directory .PHONY: libs libs: cd ../lib; ${MAKE} --no-print-directory ### Automake generates wrong tags .PHONY: etags etags: maketags lintnew: splintme splintme: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted splintmebounds: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw -mts tainted +bounds +impboundsconstraints splintmesupcounts: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(OVERFLOWCHSRC) $(LINTSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -supcounts -constuse -mts file -mts filerw lintbuffercheck: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +bounds -DLINTBUFFERCHECK valsplint: valgrind -v --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=yes ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude $(LINTSRC) $(OVERFLOWCHSRC) $(LCLSRC) -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw splintsome: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude lcllib.c -dump lclint +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -supcounts -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +partial # drl changed to use # for comment #/* $(LINTSRC) $(LCLSRC)*/ splinttest: ./splint $(DEFAULT_INCLUDES) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) +singleinclude test.c +forcehints -misplacedsharequal +showsourceloc -unrecogcomments -fcnuse -incondefs -exportlocal -constuse -mts file -mts filerw +keep +supcounts +partial -null all: splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT) ../$(top_builddir)/$(binDir)/splint$(EXEEXT): splint$(EXEEXT) -$(RM) -f $(top_builddir)/$(binDir)/splint$(EXEEXT) ln -s $(top_builddir)/src/splint$(EXEEXT) $(top_builddir)/$(binDir)/splint$(EXEEXT) up: -rm cgrammar.c llgrammar.c mtgrammar.c signature.c cscanner.c $(MAKE) clean .c.o: @echo "Compiling "$<"..."; \ source='$<' object='$@' libtool=no \ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \ $(CCDEPMODE) $(depcomp) \ $(COMPILE) -c `test -f $< || echo '$(srcdir)/'`$< # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/src/lsymbolSet.c0000644021234200000250000000646107646432515014556 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lsymbolSet.c ** ** based on set_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" lsymbolSet lsymbolSet_new () { lsymbolSet s = (lsymbolSet) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = lsymbolSetBASESIZE; s->elements = (lsymbol *) dmalloc (sizeof (*s->elements) * lsymbolSetBASESIZE); return (s); } static void lsymbolSet_grow (lsymbolSet s) { int i; lsymbol *newelements; llassert (lsymbolSet_isDefined (s)); s->nspace = lsymbolSetBASESIZE; newelements = (lsymbol *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace)); if (newelements == (lsymbol *) 0) { llfatalerror (cstring_makeLiteral ("lsymbolSet_grow: out of memory!")); } for (i = 0; i < s->entries; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } /* ** Ensures: if *e \in *s ** then unchanged (*s) & result = false ** else *s' = insert (*s, *e) & result = true ** Modifies: *s */ bool lsymbolSet_insert (lsymbolSet s, lsymbol el) { llassert (lsymbolSet_isDefined (s)); if (lsymbolSet_member (s, el)) { return FALSE; } else { if (s->nspace <= 0) lsymbolSet_grow (s); s->nspace--; s->elements[s->entries] = el; s->entries++; return TRUE; } } bool lsymbolSet_member (lsymbolSet s, lsymbol el) { if (lsymbolSet_isDefined (s)) { int i; for (i = 0; i < s->entries; i++) { /* was: &el == &s->elements[i] ! */ if (lsymbol_equal (el, s->elements[i])) { return TRUE; } } } return FALSE; } /*@only@*/ cstring lsymbolSet_unparse (lsymbolSet s) { if (lsymbolSet_isDefined (s)) { int i; cstring st = cstring_makeLiteral ("{"); for (i = 0; i < s->entries; i++) { if (i == 0) { st = message ("%q %s", st, cstring_fromChars (lsymbol_toChars (s->elements[i]))); } else st = message ("%q, %s", st, cstring_fromChars (lsymbol_toChars (s->elements[i]))); } st = message ("%q }", st); return st; } else { return (cstring_makeLiteral ("{ }")); } } void lsymbolSet_free (/*@null@*/ lsymbolSet s) { if (lsymbolSet_isDefined (s)) { sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/sigNodeSet.c0000644021234200000250000001061207646432516014457 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sigNodeSet.c ** ** based on set_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" # include "intSet.h" static bool sigNodeSet_member (sigNodeSet p_s, sigNode p_el); /*@only@*/ sigNodeSet sigNodeSet_new () { sigNodeSet s = (sigNodeSet) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = sigNodeSetBASESIZE; s->elements = (sigNode *) dmalloc (sizeof (*s->elements) * sigNodeSetBASESIZE); return (s); } /*@only@*/ sigNodeSet sigNodeSet_singleton (sigNode el) { sigNodeSet s = (sigNodeSet) dmalloc (sizeof (*s)); s->entries = 1; s->nspace = sigNodeSetBASESIZE - 1; s->elements = (sigNode *) dmalloc (sizeof (*s->elements) * sigNodeSetBASESIZE); s->elements[0] = el; return (s); } static void sigNodeSet_grow (/*@notnull@*/ sigNodeSet s) { int i; sigNode *newelements; s->nspace = sigNodeSetBASESIZE; newelements = (sigNode *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace)); for (i = 0; i < s->entries; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } /* ** Ensures: if *e \in *s ** then unchanged (*s) & result = false ** else *s' = insert (*s, *e) & result = true ** Modifies: *s */ bool sigNodeSet_insert (sigNodeSet s, /*@owned@*/ sigNode el) { llassert (sigNodeSet_isDefined (s)); if (sigNodeSet_member (s, el)) { sigNode_free (el); return FALSE; } else { if (s->nspace <= 0) { sigNodeSet_grow (s); } s->nspace--; s->elements[s->entries] = el; s->entries++; return TRUE; } } static bool sigNodeSet_member (sigNodeSet s, sigNode el) { if (sigNodeSet_isUndefined (s)) { return FALSE; } else { int i; for (i = 0; i < s->entries; i++) { if (sigNode_equal (el, s->elements[i])) return TRUE; } return FALSE; } } /*@only@*/ cstring sigNodeSet_unparse (sigNodeSet s) { int i; cstring st = cstring_undefined; if (sigNodeSet_isDefined (s)) { for (i = 0; i < s->entries; i++) { if (i == 0) { st = sigNode_unparse (s->elements[i]); } else st = message ("%q, %q", st, sigNode_unparse (s->elements[i])); } } return st; } /*@only@*/ cstring sigNodeSet_unparseSomeSigs (sigNodeSet s) { int i; cstring st = cstring_undefined; if (sigNodeSet_isDefined (s)) { for (i = 0; i < s->entries; i++) { cstring t = sigNode_unparseText (s->elements[i]); if (i == 0) { st = cstring_copy (t); cstring_free (t); } else if (i > 5 && (s->entries > 8)) { return (message ("%q; %q; ... (%d more signatures)", st, t, (s->entries - i - 1))); } else { st = message ("%q; %q", st, t); } } } return st; } /*@only@*/ cstring sigNodeSet_unparsePossibleAritys (sigNodeSet s) { int i; intSet is = intSet_new (); cstring st; if (sigNodeSet_isDefined (s)) { for (i = 0; i < s->entries; i++) { int arity = ltokenList_size ((s->elements[i])->domain); (void) intSet_insert (is, arity); } } st = intSet_unparseText (is); intSet_free (is); return (st); } void sigNodeSet_free (sigNodeSet s) { if (sigNodeSet_isDefined (s)) { int i; for (i = 0; i < s->entries; i++) { sigNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/lslOpSet.c0000644021234200000250000000764307646432515014171 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lslOpSet.c ** ** based on set_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" # include "checking.h" /* for lslOp_equal */ static bool lslOpSet_member (lslOpSet p_s, lslOp p_el); lslOpSet lslOpSet_new () { lslOpSet s = (lslOpSet) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = lslOpSetBASESIZE; s->elements = (lslOp *) dmalloc (sizeof (*s->elements) * lslOpSetBASESIZE); return (s); } static /*@only@*/ lslOpSet lslOpSet_predict (int size) { lslOpSet s = (lslOpSet) dmalloc (sizeof (*s)); s->entries = 0; if (size > 0) { s->nspace = size; s->elements = (lslOp *) dmalloc (sizeof (*s->elements) * size); } else { s->nspace = 0; s->elements = NULL; } return (s); } static void lslOpSet_grow (/*@notnull@*/ lslOpSet s) { int i; lslOp *newelements; s->nspace = lslOpSetBASESIZE; newelements = (lslOp *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace)); if (newelements == (lslOp *) 0) { llfatalerror (cstring_makeLiteral ("lslOpSet_grow: out of memory!")); } for (i = 0; i < s->entries; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } /* ** Ensures: if *e \in *s ** then unchanged (*s) & result = false ** else *s' = insert (*s, *e) & result = true ** Modifies: *s */ bool lslOpSet_insert (lslOpSet s, /*@only@*/ lslOp el) { llassert (lslOpSet_isDefined (s)); if (lslOpSet_member (s, el)) { lslOp_free (el); return FALSE; } else { if (s->nspace <= 0) lslOpSet_grow (s); s->nspace--; s->elements[s->entries] = el; s->entries++; return TRUE; } } static bool lslOpSet_member (lslOpSet s, lslOp el) { if (lslOpSet_isDefined (s)) { int i; for (i = 0; i < lslOpSet_size (s); i++) { if (lslOp_equal (el, s->elements[i])) return TRUE; } } return FALSE; } /*@only@*/ cstring lslOpSet_unparse (lslOpSet s) { if (lslOpSet_isDefined (s)) { int i; cstring st = cstring_makeLiteral ("{"); for (i = 0; i < lslOpSet_size (s); i++) { st = message ("%q %q", st, lslOp_unparse (s->elements[i])); } st = message ("%q}", st); return st; } else { return (cstring_makeLiteral ("{ }")); } } /*@only@*/ lslOpSet lslOpSet_copy (lslOpSet s) { if (lslOpSet_isDefined (s)) { lslOpSet t = lslOpSet_predict (lslOpSet_size (s)); int i; for (i = 0; i < lslOpSet_size (s); i++) { (void) lslOpSet_insert (t, lslOp_copy (s->elements[i])); } return t; } else { return lslOpSet_undefined; } } void lslOpSet_free (lslOpSet s) { if (lslOpSet_isDefined (s)) { int i; for (i = 0; i < s->entries; i++) { lslOp_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/sortSet.c0000644021234200000250000001052007646432516014054 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sortSet.c ** ** based on set_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" sortSet sortSet_new () { sortSet s = (sortSet) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = sortSetBASESIZE; s->elements = (sort *) dmalloc (sizeof (*s->elements) * sortSetBASESIZE); return (s); } static /*@notnull@*/ sortSet sortSet_predict (int size) { sortSet s = (sortSet) dmalloc (sizeof (*s)); s->entries = 0; if (size > 0) { s->nspace = size; s->elements = (sort *) dmalloc (sizeof (*s->elements) * size); } else { s->nspace = 0; s->elements = NULL; } return (s); } static void sortSet_grow (/*@notnull@*/ sortSet s) { int i; sort *newelements; s->nspace = sortSetBASESIZE; newelements = (sort *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace)); if (newelements == (sort *) 0) { llfatalerror (cstring_makeLiteral ("sortSet_grow: out of memory!")); } for (i = 0; i < s->entries; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } /* ** Ensures: if *e \in *s ** then unchanged (*s) & result = false ** else *s' = insert (*s, *e) & result = true ** Modifies: *s */ bool sortSet_insert (sortSet s, sort el) { llassert (sortSet_isDefined (s)); if (sortSet_member (s, el)) { return FALSE; } else { if (s->nspace <= 0) sortSet_grow (s); s->nspace--; s->elements[s->entries] = el; s->entries++; return TRUE; } } sort sortSet_choose (sortSet s) { llassert (sortSet_isDefined (s) && s->entries > 0); return (s->elements[0]); } bool sortSet_member (sortSet s, sort el) { if (sortSet_isDefined (s)) { int i; for (i = 0; i < s->entries; i++) { if (sort_equal (el, s->elements[i])) { return TRUE; } } } return FALSE; } /*@only@*/ cstring sortSet_unparse (sortSet s) { return (message ("{ %q }", sortSet_unparseClean (s))); } /*@only@*/ cstring sortSet_unparseClean (sortSet s) { cstring st = cstring_undefined; if (sortSet_isDefined (s)) { int i; for (i = 0; i < s->entries; i++) { if (i == 0) { st = message ("%q%s", st, sort_unparseName (s->elements[i])); } else { st = message ("%q, %s", st, sort_unparseName (s->elements[i])); } } } return st; } /*@only@*/ cstring sortSet_unparseOr (sortSet s) { cstring st = cstring_undefined; if (sortSet_isDefined (s)) { int i; int last = s->entries - 1; for (i = 0; i < s->entries; i++) { if (i == 0) { st = cstring_concatFree (st, sort_unparse (s->elements[i])); } else { if (i == last) { /* was sort_unparse ??? */ st = message ("%q or %q", st, sort_unparse (s->elements[i])); } else { st = message ("%q, %q", st, sort_unparse (s->elements[i])); } } } } return st; } void sortSet_free (sortSet s) { if (sortSet_isDefined (s)) { sfree (s->elements); sfree (s); } } /*@only@*/ sortSet sortSet_copy (sortSet s) { sortSet t = sortSet_predict (sortSet_size (s)); int i; if (sortSet_isDefined (s)) { for (i = 0; i < sortSet_size (s); i++) { (void) sortSet_insert (t, s->elements[i]); } } return t; } splint-3.1.2.dfsg1/src/initDeclNodeList.c0000644021234200000250000000533007646432515015610 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** initDeclNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ initDeclNodeList initDeclNodeList_new () { initDeclNodeList s = (initDeclNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = initDeclNodeListBASESIZE; s->elements = (initDeclNode *) dmalloc (sizeof (*s->elements) * initDeclNodeListBASESIZE); return (s); } static void initDeclNodeList_grow (initDeclNodeList s) { int i; initDeclNode *newelements; s->nspace += initDeclNodeListBASESIZE; newelements = (initDeclNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } initDeclNodeList initDeclNodeList_add (initDeclNodeList s, initDeclNode el) { if (s->nspace <= 0) initDeclNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring initDeclNodeList_unparse (initDeclNodeList s) { cstring st = cstring_undefined; bool first = TRUE; initDeclNodeList_elements (s, current) { if (first) { first = FALSE; st = declaratorNode_unparse (current->declarator); } else { st = message ("%q, %q", st, declaratorNode_unparse (current->declarator)); } if (current->value != (termNode) 0) { st = message ("%q = %q", st, termNode_unparse (current->value)); } } end_initDeclNodeList_elements; return st; } void initDeclNodeList_free (initDeclNodeList s) { int i; for (i = 0; i < s->nelements; i++) { initDeclNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/sortList.c0000644021234200000250000000564307646432516014246 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sortList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ sortList sortList_new () { sortList s = (sortList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = sortListBASESIZE; s->elements = (sort *) dmalloc (sizeof (*s->elements) * sortListBASESIZE); s->current = 0; return (s); } static void sortList_grow (sortList s) { int i; sort *newelements; s->nspace += sortListBASESIZE; newelements = (sort *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (sort *) 0) { llfatalerror (cstring_makeLiteral ("sortList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void sortList_addh (sortList s, sort el) { if (s->nspace <= 0) sortList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } void sortList_reset (sortList s) { s->current = 0; } void sortList_advance (sortList s) { s->current++; llassert (s->current < s->nelements); } sort sortList_current (sortList s) { if (s->current < 0 || s->current >= s->nelements) { llbug (message ("sortList_current: current out of range: %d (size: %d)", s->current, s->nelements)); } return (s->elements[s->current]); } /*@only@*/ cstring sortList_unparse (sortList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (sort_unparseName (s->elements[i])); /* !!! NEED COPY HERE !!! */ } else { st = message ("%q, %s", st, sort_unparseName (s->elements[i])); } } return st; } void sortList_free (sortList s) { int i; for (i = 0; i < s->nelements; i++) { /* sort_free (s->elements[i]); */ } sfree (s->elements); /* not quite!!! */ sfree (s); } splint-3.1.2.dfsg1/src/declaratorInvNodeList.c0000644021234200000250000000532307646432514016653 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** declaratorInvNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" declaratorInvNodeList declaratorInvNodeList_new () { declaratorInvNodeList s = (declaratorInvNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = declaratorInvNodeListBASESIZE; s->elements = (declaratorInvNode *) dmalloc (sizeof (*s->elements) * declaratorInvNodeListBASESIZE); return (s); } static void declaratorInvNodeList_grow (declaratorInvNodeList s) { int i; declaratorInvNode *newelements; s->nspace = declaratorInvNodeListBASESIZE + s->nspace; newelements = (declaratorInvNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (declaratorInvNode *) 0) { llfatalerror (cstring_makeLiteral ("declaratorInvNodeList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } declaratorInvNodeList declaratorInvNodeList_add (declaratorInvNodeList s, declaratorInvNode el) { if (s->nspace <= 0) { declaratorInvNodeList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring declaratorInvNodeList_unparse (declaratorInvNodeList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { st = message ("%q%q", st, declaratorInvNode_unparse (s->elements[i])); } return st; } void declaratorInvNodeList_free (declaratorInvNodeList s) { int i; for (i = 0; i < s->nelements; i++) { declaratorInvNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/interfaceNodeList.c0000644021234200000250000000542607646432515016023 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** interfaceNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ interfaceNodeList interfaceNodeList_new () { interfaceNodeList s = (interfaceNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspacelow = interfaceNodeListGROWLOW; s->nspacehigh = interfaceNodeListGROWHI; s->elementsroot = (interfaceNode *) dmalloc (sizeof (*s->elements) * interfaceNodeListBASESIZE); s->elements = s->elementsroot + interfaceNodeListGROWLOW; return (s); } static void interfaceNodeList_grow (interfaceNodeList s) { int i; interfaceNode *newelements; newelements = (interfaceNode *) dmalloc (sizeof (*newelements) * (s->nelements + interfaceNodeListBASESIZE)); for (i = 0; i < s->nelements; i++) { newelements[i + interfaceNodeListGROWLOW] = s->elements[i]; } s->nspacelow = interfaceNodeListGROWLOW; s->nspacehigh = interfaceNodeListGROWHI; sfree (s->elementsroot); s->elementsroot = newelements; s->elements = newelements + s->nspacelow; } interfaceNodeList interfaceNodeList_addh (interfaceNodeList s, interfaceNode el) { llassert (interfaceNodeListGROWHI > 0); if (s->nspacehigh <= 0) interfaceNodeList_grow (s); s->nspacehigh--; s->elements[s->nelements] = el; s->nelements++; return s; } void interfaceNodeList_addl (interfaceNodeList s, /*@keep@*/ interfaceNode el) { llassert (interfaceNodeListGROWLOW > 0); if (s->nspacelow <= 0) interfaceNodeList_grow (s); s->nspacelow--; s->elements--; s->elements[0] = el; s->nelements++; } void interfaceNodeList_free (interfaceNodeList s) { int i; for (i = 0; i < s->nelements; i++) { interfaceNode_free (s->elements[i]); } sfree (s->elementsroot); sfree (s); } splint-3.1.2.dfsg1/src/sortSetList.c0000644021234200000250000000606507646432516014721 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sortSetList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ sortSetList sortSetList_new () { sortSetList s = (sortSetList) dmalloc (sizeof (*s)); s->nelements = 0; s->free = sortSetListBASESIZE; s->elements = (sortSet *) dmalloc (sizeof (*s->elements) * sortSetListBASESIZE); s->current = 0; return (s); } static void sortSetList_grow (sortSetList s) { int i; sortSet *newelements; s->free += sortSetListBASESIZE; newelements = (sortSet *) dmalloc (sizeof (*newelements) * (s->nelements + s->free)); if (newelements == (sortSet *) 0) { llfatalerror (cstring_makeLiteral ("sortSetList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void sortSetList_addh (sortSetList s, sortSet el) { llassert (sortSetListBASESIZE > 0); if (s->free <= 0) sortSetList_grow (s); s->free--; s->elements[s->nelements] = el; s->nelements++; } void sortSetList_reset (sortSetList s) { s->current = 0; } void sortSetList_advance (sortSetList s) { s->current++; } /*@observer@*/ sortSet sortSetList_head (sortSetList s) { llassert (s->nelements > 0); return (s->elements[0]); } /*@observer@*/ sortSet sortSetList_current (sortSetList s) { if (s->current < 0 || s->current >= s->nelements) { llbug (message ("sortSetList_current: current out of range: %d (size: %d)", s->current, s->nelements)); } return (s->elements[s->current]); } /*@only@*/ cstring sortSetList_unparse (sortSetList s) { int i; cstring st = cstring_makeLiteral ("[ "); for (i = 0; i < s->nelements; i++) { if (i != 0) st = message ("%q, %q", st, sortSet_unparse (s->elements[i])); else st = message ("%q%q", st, sortSet_unparse (s->elements[i])); } st = message ("%q]", st); return st; } void sortSetList_free (sortSetList s) { /* note: elements are dependent */ sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/declaratorNodeList.c0000644021234200000250000000604707646432514016202 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** declaratorNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" declaratorNodeList declaratorNodeList_new () { declaratorNodeList s = (declaratorNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = declaratorNodeListBASESIZE; s->elements = (declaratorNode *) dmalloc (sizeof (*s->elements) * declaratorNodeListBASESIZE); return (s); } static void declaratorNodeList_grow (declaratorNodeList s) { int i; declaratorNode *newelements; s->nspace = declaratorNodeListBASESIZE + s->nspace; newelements = (declaratorNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (declaratorNode *) 0) { llfatalerror (cstring_makeLiteral ("declaratorNodeList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } declaratorNodeList declaratorNodeList_add (declaratorNodeList s, declaratorNode el) { if (s->nspace <= 0) declaratorNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring declaratorNodeList_unparse (declaratorNodeList s) { cstring st = cstring_undefined; bool first = TRUE; declaratorNodeList_elements (s, current) { if (first) { st = declaratorNode_unparse (current); first = FALSE; } else { st = message ("%q, %q", st, declaratorNode_unparse (current)); } } end_declaratorNodeList_elements; return st; } declaratorNodeList declaratorNodeList_copy (declaratorNodeList s) { declaratorNodeList ret = declaratorNodeList_new (); declaratorNodeList_elements (s, el) { ret = declaratorNodeList_add (ret, declaratorNode_copy (el)); } end_declaratorNodeList_elements ; return ret; } void declaratorNodeList_free (declaratorNodeList s) { int i; for (i = 0; i < s->nelements; i++) { declaratorNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/letDeclNodeList.c0000644021234200000250000000532607646432515015436 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** letDeclNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ letDeclNodeList letDeclNodeList_new () { letDeclNodeList s = (letDeclNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = letDeclNodeListBASESIZE; s->elements = (letDeclNode *) dmalloc (sizeof (*s->elements) * letDeclNodeListBASESIZE); return (s); } static void letDeclNodeList_grow (letDeclNodeList s) { int i; letDeclNode *newelements; s->nspace += letDeclNodeListBASESIZE; newelements = (letDeclNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } letDeclNodeList letDeclNodeList_add (letDeclNodeList s, letDeclNode el) { llassert (letDeclNodeListBASESIZE > 0); if (s->nspace <= 0) letDeclNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring letDeclNodeList_unparse (letDeclNodeList s) { cstring st = cstring_undefined; letDeclNodeList_elements (s, current) { st = message ("%qlet %s", st, ltoken_getRawString (current->varid)); if (current->sortspec != NULL) { st = message ("%q: %q", st, lclTypeSpecNode_unparse (current->sortspec)); } else { st = message ("%q ", st); } st = message ("%q = %q\n", st, termNode_unparse (current->term)); } end_letDeclNodeList_elements; return st; } void letDeclNodeList_free (letDeclNodeList s) { int i; for (i = 0; i < s->nelements; i++) { letDeclNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/stDeclNodeList.c0000644021234200000250000000572307646432516015302 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** structDeclNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ stDeclNodeList stDeclNodeList_new () { stDeclNodeList s = (stDeclNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = stDeclNodeListBASESIZE; s->elements = (stDeclNode *) dmalloc (sizeof (*s->elements) * stDeclNodeListBASESIZE); return (s); } static void stDeclNodeList_grow (stDeclNodeList s) { int i; stDeclNode *newelements; s->nspace += stDeclNodeListBASESIZE; newelements = (stDeclNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } stDeclNodeList stDeclNodeList_add (stDeclNodeList s, /*@only@*/ stDeclNode el) { if (s->nspace <= 0) stDeclNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ stDeclNodeList stDeclNodeList_copy (stDeclNodeList s) { stDeclNodeList r = stDeclNodeList_new (); stDeclNodeList_elements (s, x) { r = stDeclNodeList_add (r, stDeclNode_copy (x)); } end_stDeclNodeList_elements; return r; } /*@only@*/ cstring stDeclNodeList_unparse (stDeclNodeList s) { bool first = TRUE; cstring st = cstring_undefined; stDeclNodeList_elements (s, current) { if (first) { st = message ("%q %q;", lclTypeSpecNode_unparse (current->lcltypespec), declaratorNodeList_unparse (current->declarators)); first = FALSE; } else { st = message ("%q %q %q;", st, lclTypeSpecNode_unparse (current->lcltypespec), declaratorNodeList_unparse (current->declarators)); } } end_stDeclNodeList_elements; return st; } void stDeclNodeList_free (stDeclNodeList s) { int i; for (i = 0; i < s->nelements; i++) { stDeclNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/storeRefNodeList.c0000644021234200000250000000635307646432516015655 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** storeRefNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ storeRefNodeList storeRefNodeList_new () { storeRefNodeList s = (storeRefNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = storeRefNodeListBASESIZE; s->elements = (storeRefNode *) dmalloc (sizeof (*s->elements) * storeRefNodeListBASESIZE); return (s); } static void storeRefNodeList_grow (storeRefNodeList s) { int i; storeRefNode *newelements; s->nspace += storeRefNodeListBASESIZE; newelements = (storeRefNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } storeRefNodeList storeRefNodeList_add (storeRefNodeList s, storeRefNode el) { if (s->nspace <= 0) storeRefNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ storeRefNodeList storeRefNodeList_copy (storeRefNodeList s) { storeRefNodeList r = storeRefNodeList_new (); storeRefNodeList_elements (s, x) { r = storeRefNodeList_add (r, storeRefNode_copy (x)); } end_storeRefNodeList_elements; return r; } /*@only@*/ cstring storeRefNodeList_unparse (storeRefNodeList s) { bool first = TRUE; cstring st = cstring_undefined; storeRefNodeList_elements (s, current) { if (first) { first = FALSE; } else { st = message ("%q, ", st); } switch (current->kind) { case SRN_OBJ: st = message ("%qobj", st); /*@switchbreak@*/ break; case SRN_TERM: st = message ("%q%q", st, termNode_unparse (current->content.term)); /*@switchbreak@*/ break; case SRN_TYPE: st = message ("%q%q", st, lclTypeSpecNode_unparse (current->content.type)); /*@switchbreak@*/ break; case SRN_SPECIAL: st = message ("%q%q", st, sRef_unparse (current->content.ref)); /*@switchbreak@*/ break; } } end_storeRefNodeList_elements; return st; } void storeRefNodeList_free (storeRefNodeList s) { int i; for (i = 0; i < s->nelements; i++) { storeRefNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/lslOpList.c0000644021234200000250000000452307646432515014343 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lslOpList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ lslOpList lslOpList_new () { lslOpList s = (lslOpList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = lslOpListBASESIZE; s->elements = (lslOp *) dmalloc (sizeof (*s->elements) * lslOpListBASESIZE); return (s); } static void lslOpList_grow (lslOpList s) { int i; lslOp *newelements; s->nspace += lslOpListBASESIZE; newelements = (lslOp *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (lslOp *) 0) { llfatalerror (cstring_makeLiteral ("lslOpList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void lslOpList_add (lslOpList s, lslOp el) { llassert (lslOpListBASESIZE != 0); if (s->nspace <= 0) { lslOpList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; } /*@only@*/ cstring lslOpList_unparse (lslOpList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { st = message ("%q%q\n", st, lslOp_unparse (s->elements[i])); } return st; } void lslOpList_free (lslOpList s) { sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/lsymbolList.c0000644021234200000250000000431107646432515014726 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lsymbolList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ lsymbolList lsymbolList_new () { lsymbolList s = (lsymbolList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = lsymbolListBASESIZE; s->elements = (lsymbol *) dmalloc (sizeof (*s->elements) * lsymbolListBASESIZE); return (s); } static void lsymbolList_grow (lsymbolList s) { int i; lsymbol *newelements; s->nspace += lsymbolListBASESIZE; newelements = (lsymbol *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (lsymbol *) 0) { llfatalerror (cstring_makeLiteral ("lsymbolList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void lsymbolList_addh (lsymbolList s, lsymbol el) { if (s->nspace <= 0) lsymbolList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } void lsymbolList_free (lsymbolList s) { int i; for (i = 0; i < s->nelements; i++) { /* lsymbol_free (s->elements[i]); */ } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/termNodeList.c0000644021234200000250000001202607646432516015025 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** termNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" termNodeList termNodeList_new () { termNodeList s = (termNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspacelow = termNodeListGROWLOW; s->nspacehigh = termNodeListGROWHI; s->elementsroot = (termNode *) dmalloc (sizeof (*s->elements) * (s->nspacelow + s->nspacehigh)); s->elements = s->elementsroot + termNodeListGROWLOW; s->current = 0; return (s); } static void termNodeList_grow (termNodeList s) { int i; termNode *newelements = (termNode *) dmalloc (sizeof (*newelements) * (s->nelements + termNodeListBASESIZE)); for (i = 0; i < s->nelements; i++) { newelements[i + termNodeListGROWLOW] = s->elements[i]; } sfree (s->elementsroot); s->nspacelow = termNodeListGROWLOW; s->nspacehigh = termNodeListGROWHI; s->elementsroot = newelements; s->elements = s->elementsroot + s->nspacelow; } void termNodeList_addh (termNodeList s, termNode el) { llassert (termNodeListGROWHI > 0); if (s->nspacehigh <= 0) termNodeList_grow (s); s->nspacehigh--; s->elements[s->nelements] = el; s->nelements++; } termNodeList termNodeList_push (termNodeList s, termNode el) { termNodeList_addh (s, el); return s; } void termNodeList_addl (termNodeList s, termNode el) { llassert (termNodeListGROWLOW > 0); if (s->nspacelow <= 0) termNodeList_grow (s); s->nspacelow--; s->elements--; s->elements[0] = el; s->current++; s->nelements++; } void termNodeList_reset (termNodeList s) { s->current = 0; } void termNodeList_finish (termNodeList s) { s->current = s->nelements - 1; } void termNodeList_advance (termNodeList s) { s->current++; llassert (s->current < s->nelements); } /*@exposed@*/ termNode termNodeList_head (termNodeList s) { llassert (s->nelements > 0); return (s->elements[0]); } /*@only@*/ termNodeList termNodeList_copy (termNodeList s) { termNodeList r = termNodeList_new (); termNodeList_elements (s, x) { termNodeList_addh (r, termNode_copySafe (x)); } end_termNodeList_elements; return r; } /*@exposed@*/ termNode termNodeList_current (termNodeList s) { llassert (!(s->current >= s->nelements)); return (s->elements[s->current]); } termNode termNodeList_getN (termNodeList s, int n) { llassert (n >= 0 && n < s->nelements); return (s->elements[n]); } /*@only@*/ cstring termNodeList_unparse (termNodeList s) { bool first = TRUE; cstring st = cstring_undefined; termNodeList_elements (s, current) { if (first) { st = termNode_unparse (current); first = FALSE; } else st = message ("%q, %q", st, termNode_unparse (current)); } end_termNodeList_elements; return st; } /*@only@*/ cstring termNodeList_unparseTail (termNodeList s) { bool head = TRUE; bool first = TRUE; cstring st = cstring_undefined; termNodeList_elements (s, current) { if (head) { head = FALSE; } else { if (first) { st = termNode_unparse (current); first = FALSE; } else st = message ("%q, %q", st, termNode_unparse (current)); } } end_termNodeList_elements; return st; } /*@only@*/ cstring termNodeList_unparseToCurrent (termNodeList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->current; i++) { termNode current = s->elements[i]; if (i == 0) st = termNode_unparse (current); else st = message ("%q, %q", st, termNode_unparse (current)); } return st; } /*@only@*/ cstring termNodeList_unparseSecondToCurrent (termNodeList s) { int i; cstring st = cstring_undefined; for (i = 1; i < s->current; i++) { termNode current = s->elements[i]; if (i == 1) { st = termNode_unparse (current); } else { st = message ("%q, %q", st, termNode_unparse (current)); } } return st; } void termNodeList_free (termNodeList s) { int i; for (i = 0; i < s->nelements; i++) { termNode_free (s->elements[i]); } sfree (s->elementsroot); sfree (s); } splint-3.1.2.dfsg1/src/ltokenList.c0000644021234200000250000001101207646432515014535 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** ltokenList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@notnull@*/ /*@only@*/ ltokenList ltokenList_new () { ltokenList s = (ltokenList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = ltokenListBASESIZE; s->elements = (ltoken *) dmalloc (sizeof (*s->elements) * ltokenListBASESIZE); s->current = 0; return (s); } /*@notnull@*/ /*@only@*/ ltokenList ltokenList_singleton (ltoken l) { ltokenList s = (ltokenList) dmalloc (sizeof (*s)); s->nelements = 1; s->nspace = ltokenListBASESIZE - 1; s->elements = (ltoken *) dmalloc (sizeof (*s->elements) * ltokenListBASESIZE); s->elements[0] = l; s->current = 0; return (s); } static void ltokenList_grow (/*@notnull@*/ ltokenList s) { int i; ltoken *newelements; s->nspace += ltokenListBASESIZE; newelements = (ltoken *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } ltokenList ltokenList_push (/*@returned@*/ ltokenList s, ltoken el) { ltokenList_addh (s, el); return s; } void ltokenList_addh (ltokenList s, ltoken el) { llassert (ltokenList_isDefined (s)); if (s->nspace <= 0) ltokenList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } void ltokenList_reset (ltokenList s) { if (ltokenList_isDefined (s)) { s->current = 0; } } bool ltokenList_isFinished (ltokenList s) { return (ltokenList_isUndefined(s) || (s->current == s->nelements)); } void ltokenList_advance (ltokenList s) { if (ltokenList_isDefined (s)) { s->current++; llassert (s->current <= s->nelements); } } ltoken ltokenList_head (ltokenList s) { llassert (ltokenList_isDefined (s) && s->nelements > 0); return (s->elements[0]); } bool ltokenList_equal (ltokenList s1, ltokenList s2) { if (ltokenList_isUndefined (s1)) { return (ltokenList_isEmpty (s2)); } else { if (ltokenList_isUndefined (s2)) { return ltokenList_isEmpty (s1); } else { int i; int size = s1->nelements; if (s2->nelements != size) return FALSE; for (i = 0; i < size; i++) { if (!ltoken_similar (s1->elements[i], s2->elements[i])) return FALSE; } return TRUE; } } } /*@only@*/ ltokenList ltokenList_copy (ltokenList s) { ltokenList r = ltokenList_new (); ltokenList_elements (s, x) { ltokenList_addh (r, ltoken_copy (x)); } end_ltokenList_elements; return r; } void ltokenList_removeCurrent (ltokenList s) { int i; llassert (ltokenList_isDefined (s) && s->current >= 0 && s->current < s->nelements); for (i = s->current; i < s->nelements - 1; i++) { s->elements[i] = s->elements[i+1]; } s->nelements--; s->nspace++; } ltoken ltokenList_current (ltokenList s) { llassert (ltokenList_isDefined (s) && s->current >= 0 && s->current < s->nelements); return (s->elements[s->current]); } /*@only@*/ cstring ltokenList_unparse (ltokenList s) { int i; cstring st = cstring_undefined; if (ltokenList_isDefined (s)) { for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (ltoken_unparse (s->elements[i])); } else st = message ("%q, %s", st, ltoken_unparse (s->elements[i])); } } return st; } void ltokenList_free (ltokenList s) { if (ltokenList_isDefined (s)) { sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/traitRefNodeList.c0000644021234200000250000000515407646432516015642 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** traitRefNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ traitRefNodeList traitRefNodeList_new () { traitRefNodeList s = (traitRefNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = traitRefNodeListBASESIZE; s->elements = (traitRefNode *) dmalloc (sizeof (*s->elements) * traitRefNodeListBASESIZE); return (s); } static void traitRefNodeList_grow (traitRefNodeList s) { int i; traitRefNode *newelements; s->nspace += traitRefNodeListBASESIZE; newelements = (traitRefNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } traitRefNodeList traitRefNodeList_add (traitRefNodeList s, /*@only@*/ traitRefNode el) { if (s->nspace <= 0) traitRefNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring traitRefNodeList_unparse (traitRefNodeList s) { cstring st = cstring_undefined; traitRefNodeList_elements (s, current) { st = message ("%quses (%q)", st, printLeaves2 (current->traitid)); if (current->rename != 0) { st = message ("%q (%q)", st, renamingNode_unparse (current->rename)); } st = message ("%q\n", st); } end_traitRefNodeList_elements; return (st); } void traitRefNodeList_free (traitRefNodeList s) { int i; for (i = 0; i < s->nelements; i++) { traitRefNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/pairNodeList.c0000644021234200000250000000520607646432516015013 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** pairNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ pairNodeList pairNodeList_new () { pairNodeList s = (pairNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = pairNodeListBASESIZE; s->elements = (pairNode *) dmalloc (sizeof (*s->elements) * pairNodeListBASESIZE); return (s); } static void pairNodeList_grow (/*@notnull@*/ pairNodeList s) { int i; pairNode *newelements; s->nspace += pairNodeListBASESIZE; newelements = (pairNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void pairNodeList_addh (pairNodeList s, pairNode el) { llassert (pairNodeList_isDefined (s)); llassert (pairNodeListBASESIZE > 0); if (s->nspace <= 0) pairNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } /*@only@*/ cstring pairNodeList_unparse (pairNodeList s) { cstring st = cstring_undefined; if (s != (pairNodeList)0) { pairNodeList_elements (s, current) { if (current != NULL) { st = message ("%q%s %s; ", st, sort_unparseName (current->sort), ltoken_getRawString (current->tok)); } } end_pairNodeList_elements; } return st; } void pairNodeList_free (/*@only@*/ pairNodeList s) { if (pairNodeList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { pairNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/typeNameNodeList.c0000644021234200000250000000507707646432516015650 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** typeNameNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" typeNameNodeList typeNameNodeList_new () { typeNameNodeList s = (typeNameNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = typeNameNodeListBASESIZE; s->elements = (typeNameNode *) dmalloc (sizeof (*s->elements) * typeNameNodeListBASESIZE); return (s); } static void typeNameNodeList_grow (typeNameNodeList s) { int i; typeNameNode *newelements; s->nspace += typeNameNodeListBASESIZE; newelements = (typeNameNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } typeNameNodeList typeNameNodeList_add (typeNameNodeList s, typeNameNode el) { if (s->nspace <= 0) typeNameNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring typeNameNodeList_unparse (typeNameNodeList s) { cstring st = cstring_undefined; bool first = TRUE; typeNameNodeList_elements (s, current) { if (first) { st = typeNameNode_unparse (current); first = FALSE; } else { st = message ("%q, %q", st, typeNameNode_unparse (current)); } } end_typeNameNodeList_elements; return (st); } void typeNameNodeList_free (typeNameNodeList s) { int i; for (i = 0; i < s->nelements; i++) { typeNameNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/fcnNodeList.c0000644021234200000250000000535607646432514014632 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** fcnNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" fcnNodeList fcnNodeList_new () { return fcnNodeList_undefined; } static /*@notnull@*/ /*@only@*/ fcnNodeList fcnNodeList_newEmpty (void) { fcnNodeList s = (fcnNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = fcnNodeListBASESIZE; s->elements = (fcnNode *) dmalloc (sizeof (*s->elements) * fcnNodeListBASESIZE); return (s); } static void fcnNodeList_grow (/*@notnull@*/ fcnNodeList s) { int i; fcnNode *newelements; s->nspace += fcnNodeListBASESIZE; newelements = (fcnNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (fcnNode *) 0) { llfatalerror (cstring_makeLiteral ("fcnNodeList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } fcnNodeList fcnNodeList_add (fcnNodeList s, fcnNode el) { if (fcnNodeList_isUndefined (s)) { s = fcnNodeList_newEmpty (); } if (s->nspace <= 0) fcnNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring fcnNodeList_unparse (fcnNodeList s) { int i; cstring st = cstring_undefined; if (fcnNodeList_isDefined (s)) { for (i = 0; i < s->nelements; i++) { st = message ("%q%q\n", st, fcnNode_unparse (s->elements[i])); } } return st; } void fcnNodeList_free (/*@null@*/ /*@only@*/ fcnNodeList s) { if (s != NULL) { int i; for (i = 0; i < s->nelements; i++) { fcnNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/paramNodeList.c0000644021234200000250000000707407646432516015165 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** paramNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ paramNodeList paramNodeList_new () { paramNodeList s = (paramNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = paramNodeListBASESIZE; s->elements = (paramNode *) dmalloc (sizeof (*s->elements) * paramNodeListBASESIZE); return (s); } /*@only@*/ paramNodeList paramNodeList_single (/*@keep@*/ paramNode p) { paramNodeList s = (paramNodeList) dmalloc (sizeof (*s)); s->nelements = 1; s->nspace = paramNodeListBASESIZE - 1; s->elements = (paramNode *) dmalloc (sizeof (*s->elements) * paramNodeListBASESIZE); s->elements[0] = p; return (s); } static void paramNodeList_grow (/*@notnull@*/ paramNodeList s) { int i; paramNode *newelements; s->nspace += paramNodeListBASESIZE; newelements = (paramNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } paramNodeList paramNodeList_add (paramNodeList s, paramNode el) { llassert (paramNodeList_isDefined (s)); if (s->nspace <= 0) paramNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ paramNodeList paramNodeList_copy (paramNodeList s) { paramNodeList r = paramNodeList_new (); paramNodeList_elements (s, x) { r = paramNodeList_add (r, paramNode_copy (x)); } end_paramNodeList_elements; return r; } /*@only@*/ cstring paramNodeList_unparse (paramNodeList s) { bool first = TRUE; cstring st = cstring_undefined; paramNodeList_elements (s, current) { if (first) { st = paramNode_unparse (current); first = FALSE; } else { st = message ("%q, %q", st, paramNode_unparse (current)); } } end_paramNodeList_elements; return st; } /*@only@*/ cstring paramNodeList_unparseComments (paramNodeList s) { bool first = TRUE; cstring st = cstring_undefined; paramNodeList_elements (s, current) { if (first) { st = paramNode_unparseComments (current); first = FALSE; } else { st = message ("%q, %q", st, paramNode_unparseComments (current)); } } end_paramNodeList_elements; return st; } void paramNodeList_free (/*@only@*/ paramNodeList s) { if (paramNodeList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { paramNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/programNodeList.c0000644021234200000250000000503607646432516015530 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** programNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ programNodeList programNodeList_new () { programNodeList s = (programNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = programNodeListBASESIZE; s->elements = (programNode *) dmalloc (sizeof (*s->elements) * programNodeListBASESIZE); return (s); } static void programNodeList_grow (programNodeList s) { int i; programNode *newelements; s->nspace += programNodeListBASESIZE; newelements = (programNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void programNodeList_addh (programNodeList s, /*@keep@*/ programNode el) { if (s->nspace <= 0) programNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } /*@only@*/ cstring programNodeList_unparse (programNodeList s) { bool first = TRUE; cstring st = cstring_undefined; programNodeList_elements (s, current) { if (first) { st = programNode_unparse (current); first = FALSE; } else { st = message ("%q; %q", st, programNode_unparse (current)); } } end_programNodeList_elements; return st; } void programNodeList_free (programNodeList s) { int i; for (i = 0; i < s->nelements; i++) { programNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/varDeclarationNodeList.c0000644021234200000250000000530107646432516017012 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** varDeclarationNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" varDeclarationNodeList varDeclarationNodeList_new () { varDeclarationNodeList s = (varDeclarationNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = varDeclarationNodeListBASESIZE; s->elements = (varDeclarationNode *) dmalloc (sizeof (*s->elements) * varDeclarationNodeListBASESIZE); return (s); } static void varDeclarationNodeList_grow (varDeclarationNodeList s) { int i; varDeclarationNode *newelements; s->nspace += varDeclarationNodeListBASESIZE; newelements = (varDeclarationNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void varDeclarationNodeList_addh (varDeclarationNodeList s, /*@keep@*/ varDeclarationNode el) { if (s->nspace <= 0) varDeclarationNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } /*@only@*/ cstring varDeclarationNodeList_unparse (varDeclarationNodeList s) { cstring st = cstring_undefined; varDeclarationNodeList_elements (s, current) { if (current->isPrivate) st = message ("%q private ", st); st = message ("%q%q %q;\n", st, lclTypeSpecNode_unparse (current->type), initDeclNodeList_unparse (current->decls)); } end_varDeclarationNodeList_elements; return st; } void varDeclarationNodeList_free (varDeclarationNodeList s) { int i; for (i = 0; i < s->nelements; i++) { varDeclarationNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/varNodeList.c0000644021234200000250000000553407646432516014654 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** varNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" varNodeList varNodeList_new () { varNodeList s = (varNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = varNodeListBASESIZE; s->elements = (varNode *) dmalloc (sizeof (*s->elements) * varNodeListBASESIZE); return (s); } static void varNodeList_grow (varNodeList s) { int i; varNode *newelements; s->nspace += varNodeListBASESIZE; newelements = (varNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } varNodeList varNodeList_add (varNodeList s, varNode el) { if (s->nspace <= 0) varNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } cstring varNodeList_unparse (varNodeList s) { int i; cstring st = cstring_undefined; bool first = TRUE; for (i = 0; i < s->nelements; i++) { cstring type = cstring_undefined; varNode current = s->elements[i]; if (current->isObj) { type = cstring_makeLiteral ("obj "); } if (current->type != NULL) { type = message (": %q%q", type, lclTypeSpecNode_unparse (current->type)); } if (first) { st = type; first = FALSE; } else { st = message ("%q, %q", st, type); } } return st; } void varNodeList_free (varNodeList s) { int i; for (i = 0; i < s->nelements; i++) { varNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } varNodeList varNodeList_copy (varNodeList s) { varNodeList ret = varNodeList_new (); varNodeList_elements (s, el) { ret = varNodeList_add (ret, varNode_copy (el)); } end_varNodeList_elements; return ret; } splint-3.1.2.dfsg1/src/quantifierNodeList.c0000644021234200000250000000553107646432516016230 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** quantifierNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ quantifierNodeList quantifierNodeList_new () { quantifierNodeList s = (quantifierNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = quantifierNodeListBASESIZE; s->elements = (quantifierNode *) dmalloc (sizeof (*s->elements) * quantifierNodeListBASESIZE); return (s); } static void quantifierNodeList_grow (quantifierNodeList s) { int i; quantifierNode *newelements; s->nspace += quantifierNodeListBASESIZE; newelements = (quantifierNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } quantifierNodeList quantifierNodeList_add (quantifierNodeList s, quantifierNode el) { if (s->nspace <= 0) quantifierNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ quantifierNodeList quantifierNodeList_copy (quantifierNodeList s) { quantifierNodeList r = quantifierNodeList_new (); quantifierNodeList_elements (s, x) { r = quantifierNodeList_add (r, quantifierNode_copy (x)); } end_quantifierNodeList_elements; return r; } /*@only@*/ cstring quantifierNodeList_unparse (quantifierNodeList s) { cstring st = cstring_undefined; quantifierNodeList_elements (s, current) { st = message ("%q%s %q", st, ltoken_getRawString (current->quant), varNodeList_unparse (current->vars)); } end_quantifierNodeList_elements; return st; } void quantifierNodeList_free (quantifierNodeList s) { int i; for (i = 0; i < s->nelements; i++) { quantifierNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/replaceNodeList.c0000644021234200000250000000505307646432516015473 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** replaceNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ replaceNodeList replaceNodeList_new () { replaceNodeList s = (replaceNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = replaceNodeListBASESIZE; s->elements = (replaceNode *) dmalloc (sizeof (*s->elements) * replaceNodeListBASESIZE); return (s); } static void replaceNodeList_grow (replaceNodeList s) { int i; replaceNode *newelements; s->nspace += replaceNodeListBASESIZE; newelements = (replaceNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } replaceNodeList replaceNodeList_add (replaceNodeList s, replaceNode el) { if (s->nspace <= 0) replaceNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring replaceNodeList_unparse (replaceNodeList s) { bool first = TRUE; cstring st = cstring_undefined; replaceNodeList_elements (s, current) { if (first) { st = replaceNode_unparse (current); first = FALSE; } else { st = message ("%q, %q", st, replaceNode_unparse (current)); } } end_replaceNodeList_elements; return st; } void replaceNodeList_free (replaceNodeList s) { int i; for (i = 0; i < s->nelements; i++) { replaceNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/importNodeList.c0000644021234200000250000000504407646432515015371 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** importNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ importNodeList importNodeList_new () { importNodeList s = (importNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = importNodeListBASESIZE; s->elements = (importNode *) dmalloc (sizeof (*s->elements) * importNodeListBASESIZE); return (s); } static void importNodeList_grow (importNodeList s) { int i; importNode *newelements; s->nspace += importNodeListBASESIZE; newelements = (importNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } importNodeList importNodeList_add (importNodeList s, importNode el) { if (s->nspace <= 0) importNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring importNodeList_unparse (importNodeList s) { bool first = TRUE; cstring st = cstring_undefined; importNodeList_elements (s, current) { if (first) { st = cstring_copy (ltoken_unparse (current->val)); first = FALSE; } else { st = message ("%q, %s", st, ltoken_unparse (current->val)); } } end_importNodeList_elements; return st; } void importNodeList_free (importNodeList s) { int i; for (i = 0; i < s->nelements; i++) { importNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/tokentable.c0000644021234200000250000000773107646432516014553 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** tokentable.c */ # include "splintMacros.nf" # include "basic.h" # include "osd.h" # include "tokentable.h" static long unsigned MaxToken; static /*@null@*/ /*@only@*/ o_ltoken *TokenTable; static void AllocTokenTable (void) /*@modifies TokenTable, MaxToken@*/ ; ltoken LSLInsertToken (ltokenCode cod, lsymbol sym, lsymbol rTxt, bool def) { while (sym >= MaxToken) { AllocTokenTable (); } llassert (TokenTable != NULL); if (ltoken_isUndefined (TokenTable[sym])) { TokenTable[sym] = ltoken_create (cod, sym); ltoken_setRawText (TokenTable[sym], rTxt); ltoken_setDefined (TokenTable[sym], def); } return TokenTable[sym]; } void LSLUpdateToken (ltokenCode cod, lsymbol sym, bool def) { llassert (TokenTable != NULL); if (!ltoken_isUndefined (TokenTable[sym])) { ltoken_setCode (TokenTable[sym], cod); ltoken_setDefined (TokenTable[sym], def); } else { llfatalbug (message ("LSLUpdateToken: token not in table: %d, text: %s", (int) cod, cstring_fromChars (lsymbol_toChars (sym)))); } } void LSLSetTokenHasSyn (lsymbol sym, bool syn) { llassert (TokenTable != NULL); if (!ltoken_isUndefined (TokenTable[sym])) { ltoken_setHasSyn (TokenTable[sym], syn); } else { llbuglit ("LSLSetTokenHasSyn: null token"); } } ltoken LSLGetToken (lsymbol sym) { llassert (TokenTable != NULL); if (!((sym < MaxToken) || (!ltoken_isUndefined (TokenTable[sym])))) { llcontbuglit ("LSLGetToken: bad argument"); return TokenTable[0]; } return TokenTable[sym]; } /*@exposed@*/ ltoken LSLReserveToken (ltokenCode cod, char *txt) { lsymbol sym; sym = lsymbol_fromChars (txt); /* ** Reserved tokens never have raw text like synonyms. */ return LSLInsertToken (cod, sym, lsymbol_undefined, TRUE); } static void AllocTokenTable (void) { long unsigned oldSize, newSize; long unsigned int i; oldSize = MaxToken; if (oldSize == 0) { newSize = INITTOKENTABLE; llassert (TokenTable == NULL); TokenTable = (ltoken *) dmalloc (size_fromLongUnsigned (newSize * sizeof (*TokenTable))); } else { o_ltoken *oldTokenTable = TokenTable; newSize = (long unsigned) (DELTATOKENTABLE * oldSize); TokenTable = (ltoken *) dmalloc (size_fromLongUnsigned (newSize * sizeof (*TokenTable))); llassert (oldSize > 0); llassert (oldTokenTable != NULL); for (i = 0; i < oldSize; i++) { TokenTable[i] = oldTokenTable[i]; } sfree (oldTokenTable); } /*@+loopexec@*/ for (i = oldSize; i < newSize; i++) { TokenTable[i] = ltoken_undefined; } /*@=loopexec@*/ MaxToken = newSize; /*@-compdef@*/ } /*=compdef@*/ void ltokenTableInit (void) { MaxToken = 0; } void ltokenTableCleanup (void) { if (TokenTable != NULL) { long unsigned i; for (i = 0; i < MaxToken; i++) { ltoken_free (TokenTable[i]); } sfree (TokenTable); TokenTable = NULL; } } splint-3.1.2.dfsg1/src/scan.c0000644021234200000250000001003210645766042013330 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** scan.c ** ** Deliver tokens one at a time ** ** METHOD: ** The input arrives via LSLScanFreshToken (). ** The output is reported via LSLScanNextToken (). ** ** The tokens are built in module ScanLine. ** The tokens are delivered from this module. ** Meantimes, they are saved in a static array. ** ** The tokenizing is split off from the delivery of tokens ** to facilitate incremental scanning at a later date. ** The essential is that scanline () can be called or not ** if the input text is dirty or not. Clean lines cause ** tokens to be played out from the saved token list (not ** yet implemented in this version). */ # include "splintMacros.nf" # include "basic.h" # include "signature.h" # include "signature2.h" # include "scan.h" # include "scanline.h" static /*@exposed@*/ ltoken LSLScanLookAhead (void); static inputStream scanFile; /* file to scan */ static o_ltoken TokenList[MAXLINE]; /* available tokens */ static int nextToken; /* next available token */ static int lastToken; /* next available slot */ static /*@dependent@*/ /*@null@*/ char *line; /* input text */ static unsigned int lineNumber; /* current line number */ unsigned int lsllex (YYSTYPE *lval) { /* This is important! Bison expects this */ /* splint doesn't know the type of YYSTYPE, so we need to ignore warnings here */ /*@i1@*/ lval->ltok = LSLScanNextToken (); /*@i1@*/ return (ltoken_getCode (lval->ltok)); } ltoken LSLScanNextToken (void) { if (nextToken < lastToken) { ltoken res = TokenList[nextToken]; TokenList[nextToken] = ltoken_undefined; nextToken++; /*@-dependenttrans@*/ return res; /* Its the only reference now. */ /*@=dependenttrans@*/ } else { lastToken = 0; lineNumber++; line = inputStream_nextLine (scanFile); if (line != (char *) 0) { lscanLine (line); /* tokenize */ nextToken = 0; return LSLScanNextToken (); } else { return LSLScanEofToken (); } } } static /*@exposed@*/ ltoken LSLScanLookAhead (void) { if (nextToken < lastToken) { return TokenList[nextToken]; } else { lastToken = 0; line = inputStream_nextLine (scanFile); if (line != (char *) 0) { lscanLine (line); nextToken = 0; return LSLScanLookAhead (); } else { /* ** This is a real memory leak. Its only a few bytes ** per file though, and lsl files are hardly ever used. */ /*@-onlytrans@*/ return LSLScanEofToken (); /*@=onlytrans@*/ } } } void LSLScanFreshToken (ltoken tok) { if (lastToken < MAXLINE) { TokenList[lastToken++] = ltoken_copy (tok); } else { llfatalbug (message ("LSLScanFreshToken: out of range: %s", cstring_fromChars (lsymbol_toChars (ltoken_getText (tok))))); } } /*@exposed@*/ inputStream LSLScanSource (void) { return scanFile; } void LSLScanInit (void) { } void LSLScanReset (inputStream s) { scanFile = s; lastToken = 0; nextToken = lastToken + 1; /* force call to scanline */ lineNumber = 0; } void LSLScanCleanup (void) { } splint-3.1.2.dfsg1/src/scanline.c0000644021234200000250000005464107650647340014217 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** scanline.c ** ** Scan one line of Larch SL input at a time. ** ** The input is source text, line at a time. The output is a sequence ** of tokens, reported by call-out LSLScanFreshToken. ** ** This organization allows implementation of line-at-a-time ** incremental scanning. The incremental mechanism is in the ** driving module scan.c, which can save and replay tokens for ** unchanged lines. This module works either way. ** ** The main loop of the scanner keys on the leading character. ** Actions within the loop collect the token starting with the ** and determine its kind. */ # include "splintMacros.nf" # include "basic.h" # include "signature.h" # include "signature2.h" # include "scan.h" # include "scanline.h" # include "tokentable.h" # include "syntable.h" /*@notfunction@*/ # define MOVECHAR() do { *bufptr++ = c; c = *currentLine++; colNumber++; } while (FALSE) /* evans 2003-04-21: changed name to avoid conflict with MS VC++ */ /*@constant static int SCANMAXCHAR;@*/ # define SCANMAXCHAR 512 /*@constant static int TABSIZE;@*/ # define TABSIZE 8 static void LocalUserError (/*@temp@*/ char *p_msg); static charClassData charClass[LASTCHAR + 1]; static int colNumber; static int startCol; static bool reportEOL; static bool reportComments; static char tokenBuffer[SCANMAXCHAR]; static const charClassData charClassDef[] = { /* Control characters */ { CHC_NULL, TRUE }, /* 0 NULL */ { SINGLECHAR, FALSE }, /* 1 CTRL-A */ { SINGLECHAR, FALSE }, /* 2 CTRL-B */ { SINGLECHAR, FALSE }, /* 3 CTRL-C */ { SINGLECHAR, FALSE }, /* 4 CTRL-D */ { SINGLECHAR, FALSE }, /* 5 CTRL-E */ { SINGLECHAR, FALSE }, /* 6 CTRL-F */ { SINGLECHAR, FALSE }, /* 7 CTRL-G */ { SINGLECHAR, FALSE }, /* 8 CTRL-H */ /* defined formatting characters */ { WHITECHAR, FALSE }, /* 9 CTRL-I TAB */ { WHITECHAR, TRUE }, /* 10 CTRL-J EOL */ /* more control characters */ { SINGLECHAR, FALSE }, /* 11 CTRL-K */ { SINGLECHAR, FALSE }, /* 12 CTRL-L */ { SINGLECHAR, FALSE }, /* 13 CTRL-M */ { SINGLECHAR, FALSE }, /* 14 CTRL-N */ { SINGLECHAR, FALSE }, /* 15 CTRL-O */ { SINGLECHAR, FALSE }, /* 16 CTRL-P */ { SINGLECHAR, FALSE }, /* 17 CTRL-Q */ { SINGLECHAR, FALSE }, /* 18 CTRL-R */ { SINGLECHAR, FALSE }, /* 19 CTRL-S */ { SINGLECHAR, FALSE }, /* 20 CTRL-T */ { SINGLECHAR, FALSE }, /* 21 CTRL-U */ { SINGLECHAR, FALSE }, /* 22 CTRL-V */ { SINGLECHAR, FALSE }, /* 23 CTRL-W */ { SINGLECHAR, FALSE }, /* 24 CTRL-X */ { SINGLECHAR, FALSE }, /* 25 CTRL-Y */ { SINGLECHAR, FALSE }, /* 26 CTRL-Z */ { SINGLECHAR, FALSE }, /* 27 CTRL-[ ESC */ { SINGLECHAR, FALSE }, /* 28 CTRL-slash */ { SINGLECHAR, FALSE }, /* 29 CTRL-] GS */ { SINGLECHAR, FALSE }, /* 30 CTRL-^ RS */ { SINGLECHAR, FALSE }, /* 31 CTRL-_ US */ /* Special printing characters */ { WHITECHAR, FALSE }, /* 32 space */ { SINGLECHAR, FALSE }, /* 33 ! */ { SINGLECHAR, FALSE }, /* 34 " */ { SINGLECHAR, FALSE }, /* 35 # */ { SINGLECHAR, FALSE }, /* 36 $ */ { SINGLECHAR, FALSE }, /* 37 % */ { SINGLECHAR, FALSE }, /* 38 & */ { SINGLECHAR, FALSE }, /* 39 ' */ /* Reserved characters */ { PERMCHAR, FALSE }, /* 40 ( */ { PERMCHAR, FALSE }, /* 41 ) */ { OPCHAR, FALSE }, /* 42 * */ { OPCHAR, FALSE }, /* 43 + */ { PERMCHAR, FALSE }, /* 44 , */ { OPCHAR, FALSE }, /* 45 - */ { OPCHAR, FALSE }, /* 46 . */ { SLASHCHAR, FALSE }, /* 47 / */ /* Numbers */ { IDCHAR, FALSE }, /* 48 0 */ { IDCHAR, FALSE }, /* 49 1 */ { IDCHAR, FALSE }, /* 50 2 */ { IDCHAR, FALSE }, /* 51 3 */ { IDCHAR, FALSE }, /* 52 4 */ { IDCHAR, FALSE }, /* 53 5 */ { IDCHAR, FALSE }, /* 54 6 */ { IDCHAR, FALSE }, /* 55 7 */ { IDCHAR, FALSE }, /* 56 8 */ { IDCHAR, FALSE }, /* 57 9 */ /* More reserved and special printing characters */ { PERMCHAR, FALSE }, /* 58 : */ { SINGLECHAR, FALSE }, /* 59; */ { OPCHAR, FALSE }, /* 60 < */ { OPCHAR, FALSE }, /* 61 = */ { OPCHAR, FALSE }, /* 62 > */ { SINGLECHAR, FALSE }, /* 63 ? */ { SINGLECHAR, FALSE }, /* 64 @ */ /* Uppercase Alphabetics */ { IDCHAR, FALSE }, /* 65 A */ { IDCHAR, FALSE }, /* 66 B */ { IDCHAR, FALSE }, /* 67 C */ { IDCHAR, FALSE }, /* 68 D */ { IDCHAR, FALSE }, /* 69 E */ { IDCHAR, FALSE }, /* 70 F */ { IDCHAR, FALSE }, /* 71 G */ { IDCHAR, FALSE }, /* 72 H */ { IDCHAR, FALSE }, /* 73 I */ { IDCHAR, FALSE }, /* 74 J */ { IDCHAR, FALSE }, /* 75 K */ { IDCHAR, FALSE }, /* 76 L */ { IDCHAR, FALSE }, /* 77 M */ { IDCHAR, FALSE }, /* 78 N */ { IDCHAR, FALSE }, /* 79 O */ { IDCHAR, FALSE }, /* 80 P */ { IDCHAR, FALSE }, /* 81 Q */ { IDCHAR, FALSE }, /* 82 R */ { IDCHAR, FALSE }, /* 83 S */ { IDCHAR, FALSE }, /* 84 T */ { IDCHAR, FALSE }, /* 85 U */ { IDCHAR, FALSE }, /* 86 V */ { IDCHAR, FALSE }, /* 87 W */ { IDCHAR, FALSE }, /* 88 X */ { IDCHAR, FALSE }, /* 89 Y */ { IDCHAR, FALSE }, /* 90 Z */ /* Still more reserved and special printing characters */ { SINGLECHAR, FALSE }, /* 91 [ */ { CHC_EXTENSION, FALSE }, /* 92 slash */ { SINGLECHAR, FALSE }, /* 93 ] */ { SINGLECHAR, FALSE }, /* 94 ^ */ { IDCHAR, FALSE }, /* 95 _ */ { SINGLECHAR, FALSE }, /* 96 ` */ /* Lowercase alphabetics */ { IDCHAR, FALSE }, /* 97 a */ { IDCHAR, FALSE }, /* 98 b */ { IDCHAR, FALSE }, /* 99 c */ { IDCHAR, FALSE }, /* 100 d */ { IDCHAR, FALSE }, /* 101 e */ { IDCHAR, FALSE }, /* 102 f */ { IDCHAR, FALSE }, /* 103 g */ { IDCHAR, FALSE }, /* 104 h */ { IDCHAR, FALSE }, /* 105 i */ { IDCHAR, FALSE }, /* 106 j */ { IDCHAR, FALSE }, /* 107 k */ { IDCHAR, FALSE }, /* 108 l */ { IDCHAR, FALSE }, /* 109 m */ { IDCHAR, FALSE }, /* 110 n */ { IDCHAR, FALSE }, /* 111 o */ { IDCHAR, FALSE }, /* 112 p */ { IDCHAR, FALSE }, /* 113 q */ { IDCHAR, FALSE }, /* 114 r */ { IDCHAR, FALSE }, /* 115 s */ { IDCHAR, FALSE }, /* 116 t */ { IDCHAR, FALSE }, /* 117 u */ { IDCHAR, FALSE }, /* 118 v */ { IDCHAR, FALSE }, /* 119 w */ { IDCHAR, FALSE }, /* 120 x */ { IDCHAR, FALSE }, /* 121 y */ { IDCHAR, FALSE }, /* 122 z */ { SINGLECHAR, FALSE }, /* 123 { */ { SINGLECHAR, FALSE }, /* 124 | */ { SINGLECHAR, FALSE }, /* 125 } */ { SINGLECHAR, FALSE }, /* 126 ~ */ { SINGLECHAR, FALSE }, /* 127 DEL */ /* MCS - unused in English */ { SINGLECHAR, FALSE }, /* 128 */ { SINGLECHAR, FALSE }, /* 129 */ { SINGLECHAR, FALSE }, /* 130 */ { SINGLECHAR, FALSE }, /* 131 */ { SINGLECHAR, FALSE }, /* 132 */ { SINGLECHAR, FALSE }, /* 133 */ { SINGLECHAR, FALSE }, /* 134 */ { SINGLECHAR, FALSE }, /* 135 */ { SINGLECHAR, FALSE }, /* 136 */ { SINGLECHAR, FALSE }, /* 137 */ { SINGLECHAR, FALSE }, /* 138 */ { SINGLECHAR, FALSE }, /* 139 */ { SINGLECHAR, FALSE }, /* 140 */ { SINGLECHAR, FALSE }, /* 141 */ { SINGLECHAR, FALSE }, /* 142 */ { SINGLECHAR, FALSE }, /* 143 */ { SINGLECHAR, FALSE }, /* 144 */ { SINGLECHAR, FALSE }, /* 145 */ { SINGLECHAR, FALSE }, /* 146 */ { SINGLECHAR, FALSE }, /* 147 */ { SINGLECHAR, FALSE }, /* 148 */ { SINGLECHAR, FALSE }, /* 149 */ { SINGLECHAR, FALSE }, /* 150 */ { SINGLECHAR, FALSE }, /* 151 */ { SINGLECHAR, FALSE }, /* 152 */ { SINGLECHAR, FALSE }, /* 153 */ { SINGLECHAR, FALSE }, /* 154 */ { SINGLECHAR, FALSE }, /* 155 */ { SINGLECHAR, FALSE }, /* 156 */ { SINGLECHAR, FALSE }, /* 157 */ { SINGLECHAR, FALSE }, /* 158 */ { SINGLECHAR, FALSE }, /* 159 */ { SINGLECHAR, FALSE }, /* 160 */ { SINGLECHAR, FALSE }, /* 161 */ { SINGLECHAR, FALSE }, /* 162 */ { SINGLECHAR, FALSE }, /* 163 */ { SINGLECHAR, FALSE }, /* 164 */ { SINGLECHAR, FALSE }, /* 165 */ { SINGLECHAR, FALSE }, /* 166 */ { SINGLECHAR, FALSE }, /* 167 */ { SINGLECHAR, FALSE }, /* 168 */ { SINGLECHAR, FALSE }, /* 169 */ { SINGLECHAR, FALSE }, /* 170 */ { SINGLECHAR, FALSE }, /* 171 */ { SINGLECHAR, FALSE }, /* 172 */ { SINGLECHAR, FALSE }, /* 173 */ { SINGLECHAR, FALSE }, /* 174 */ { SINGLECHAR, FALSE }, /* 175 */ { SINGLECHAR, FALSE }, /* 176 */ { SINGLECHAR, FALSE }, /* 177 */ { SINGLECHAR, FALSE }, /* 178 */ { SINGLECHAR, FALSE }, /* 179 */ { SINGLECHAR, FALSE }, /* 180 */ { SINGLECHAR, FALSE }, /* 181 */ { SINGLECHAR, FALSE }, /* 182 */ { SINGLECHAR, FALSE }, /* 183 */ { SINGLECHAR, FALSE }, /* 184 */ { SINGLECHAR, FALSE }, /* 185 */ { SINGLECHAR, FALSE }, /* 186 */ { SINGLECHAR, FALSE }, /* 187 */ { SINGLECHAR, FALSE }, /* 188 */ { SINGLECHAR, FALSE }, /* 189 */ { SINGLECHAR, FALSE }, /* 190 */ { SINGLECHAR, FALSE }, /* 191 */ { SINGLECHAR, FALSE }, /* 192 */ { SINGLECHAR, FALSE }, /* 193 */ { SINGLECHAR, FALSE }, /* 194 */ { SINGLECHAR, FALSE }, /* 195 */ { SINGLECHAR, FALSE }, /* 196 */ { SINGLECHAR, FALSE }, /* 197 */ { SINGLECHAR, FALSE }, /* 198 */ { SINGLECHAR, FALSE }, /* 199 */ { SINGLECHAR, FALSE }, /* 200 */ { SINGLECHAR, FALSE }, /* 201 */ { SINGLECHAR, FALSE }, /* 202 */ { SINGLECHAR, FALSE }, /* 203 */ { SINGLECHAR, FALSE }, /* 204 */ { SINGLECHAR, FALSE }, /* 205 */ { SINGLECHAR, FALSE }, /* 206 */ { SINGLECHAR, FALSE }, /* 207 */ { SINGLECHAR, FALSE }, /* 208 */ { SINGLECHAR, FALSE }, /* 209 */ { SINGLECHAR, FALSE }, /* 210 */ { SINGLECHAR, FALSE }, /* 211 */ { SINGLECHAR, FALSE }, /* 212 */ { SINGLECHAR, FALSE }, /* 213 */ { SINGLECHAR, FALSE }, /* 214 */ { SINGLECHAR, FALSE }, /* 215 */ { SINGLECHAR, FALSE }, /* 216 */ { SINGLECHAR, FALSE }, /* 217 */ { SINGLECHAR, FALSE }, /* 218 */ { SINGLECHAR, FALSE }, /* 219 */ { SINGLECHAR, FALSE }, /* 220 */ { SINGLECHAR, FALSE }, /* 221 */ { SINGLECHAR, FALSE }, /* 222 */ { SINGLECHAR, FALSE }, /* 223 */ { SINGLECHAR, FALSE }, /* 224 */ { SINGLECHAR, FALSE }, /* 225 */ { SINGLECHAR, FALSE }, /* 226 */ { SINGLECHAR, FALSE }, /* 227 */ { SINGLECHAR, FALSE }, /* 228 */ { SINGLECHAR, FALSE }, /* 229 */ { SINGLECHAR, FALSE }, /* 230 */ { SINGLECHAR, FALSE }, /* 231 */ { SINGLECHAR, FALSE }, /* 232 */ { SINGLECHAR, FALSE }, /* 233 */ { SINGLECHAR, FALSE }, /* 234 */ { SINGLECHAR, FALSE }, /* 235 */ { SINGLECHAR, FALSE }, /* 236 */ { SINGLECHAR, FALSE }, /* 237 */ { SINGLECHAR, FALSE }, /* 238 */ { SINGLECHAR, FALSE }, /* 239 */ { SINGLECHAR, FALSE }, /* 240 */ { SINGLECHAR, FALSE }, /* 241 */ { SINGLECHAR, FALSE }, /* 242 */ { SINGLECHAR, FALSE }, /* 243 */ { SINGLECHAR, FALSE }, /* 244 */ { SINGLECHAR, FALSE }, /* 245 */ { SINGLECHAR, FALSE }, /* 246 */ { SINGLECHAR, FALSE }, /* 247 */ { SINGLECHAR, FALSE }, /* 248 */ { SINGLECHAR, FALSE }, /* 249 */ { SINGLECHAR, FALSE }, /* 250 */ { SINGLECHAR, FALSE }, /* 251 */ { SINGLECHAR, FALSE }, /* 252 */ { SINGLECHAR, FALSE }, /* 253 */ { SINGLECHAR, FALSE }, /* 254 */ { SINGLECHAR, FALSE } /* 255 */ }; /* **++ ** FUNCTION NAME: ** ** lscanline () ** ** FORMAL PARAMETERS: ** ** None ** ** RETURN VALUE: ** ** None ** ** INVARIANTS: ** ** [@description or none@] ** ** DESCRIPTION: ** ** One line of text is processed. ** Tokens are delivered via the call LSLScanFreshToken (). ** ** EXCEPTIONS: ** **-- */ void lscanLine (char *currentLine) { ltokenCode cod; lsymbol sym; register char c; register char *bufptr; ltoken newToken; c = *currentLine++; colNumber = 0; for (;;) { bufptr = &tokenBuffer[0]; startCol = colNumber; /*@-loopswitchbreak@*/ switch (lscanCharClass (c)) { case CHC_NULL: sym = lsymbol_fromChars ("E O L"); cod = LST_EOL; break; /* Identifiers */ case IDCHAR: while (lscanCharClass (c) == IDCHAR) { MOVECHAR (); } *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SIMPLEID; break; /* One-character tokens */ case SINGLECHAR: case PERMCHAR: MOVECHAR (); *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SIMPLEOP; break; case SLASHCHAR: if (*currentLine == '\\') { MOVECHAR (); MOVECHAR (); *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SIMPLEOP; break; } MOVECHAR (); /* We fall through to next case if we have / followed */ /* by anything else. */ /*@fallthrough@*/ case OPCHAR: /* Operator symbols */ /* possible multi character */ while (lscanCharClass (c) == OPCHAR) { MOVECHAR (); } *bufptr = '\0'; /* null terminate in buffer */ sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SIMPLEOP; break; /* White space */ case WHITECHAR: /*@-switchswitchbreak@*/ switch (c) { case '\t': MOVECHAR (); colNumber--; colNumber += TABSIZE; colNumber -= (colNumber % TABSIZE); break; case '\v': case '\f': MOVECHAR (); colNumber--; break; default: MOVECHAR (); break; } *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_WHITESPACE; break; case CHC_EXTENSION: MOVECHAR (); switch (c) { /* open and close */ case '(': MOVECHAR (); while (lscanCharClass (c) == IDCHAR) { MOVECHAR (); } *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_OPENSYM; break; case ')': MOVECHAR (); while (lscanCharClass (c) == IDCHAR) { MOVECHAR (); } *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_CLOSESYM; break; /* separator */ case ',': MOVECHAR (); while (lscanCharClass (c) == IDCHAR) { MOVECHAR (); } *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SEPSYM; break; /* simpleid */ case ':': MOVECHAR (); while (lscanCharClass (c) == IDCHAR) { MOVECHAR (); } *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SIMPLEID; break; default: if (lscanCharClass (c) == IDCHAR) { do { MOVECHAR (); } while (lscanCharClass (c) == IDCHAR); *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SIMPLEOP; } else { /* ** Meets none of the above. Take the extension ** character and the character following and treat ** together as a SINGLECHAR. SINGLECHARs tranlate into ** SIMPLEOPs. */ MOVECHAR (); *bufptr = '\0'; sym = lsymbol_fromChars (&tokenBuffer[0]); cod = LST_SIMPLEOP; } break; } /*@switchbreak@*/ break; /*@=switchswitchbreak@*/ default: LocalUserError ("unexpected character in input"); return; } /*@=loopswitchbreak@*/ /* ** Above code only "guessed" at token type. Insert it into the ** TokenTable. If the token already exists, it is returned as ** previously defined. If it does not exist, it is inserted as the ** token code computed above. */ newToken = LSLInsertToken (cod, sym, 0, FALSE); if (LSLIsSyn (ltoken_getText (newToken))) { /* ** Token is a synonym. Get the actual token and set the raw ** text to the synonym name. */ newToken = LSLGetTokenForSyn (ltoken_getText (newToken)); ltoken_setRawText (newToken, sym); } ltoken_setCol (newToken, startCol); ltoken_setLine (newToken, inputStream_thisLineNumber (LSLScanSource ())); ltoken_setFileName (newToken, inputStream_fileName (LSLScanSource ())); if (ltoken_getCode (newToken) == LST_COMMENTSYM) { bufptr = &tokenBuffer[0]; while (!LSLIsEndComment (c)) { MOVECHAR (); } if (lscanCharClass (c) != CHC_NULL) { MOVECHAR (); } if (reportComments) { *bufptr = '\0'; ltoken_setRawText (newToken, lsymbol_fromChars (&tokenBuffer[0])); LSLScanFreshToken (newToken); } } else if (ltoken_getCode (newToken) == LST_EOL) { if (reportEOL) { LSLScanFreshToken (newToken); } return; } else { if (cod != LST_WHITESPACE) { LSLScanFreshToken (newToken); } } } } ltoken LSLScanEofToken (void) { ltoken t = ltoken_copy (LSLInsertToken (LEOFTOKEN, lsymbol_fromChars ("E O F"), 0, TRUE)); ltoken_setCol (t, colNumber); ltoken_setLine (t, inputStream_thisLineNumber (LSLScanSource ())); ltoken_setFileName (t, inputStream_fileName (LSLScanSource ())); return t; } void LSLReportEolTokens (bool setting) { reportEOL = setting; } static void LocalUserError (char *msg) { inputStream s = LSLScanSource (); llfatalerror (message ("%s:%d,%d: %s", inputStream_fileName (s), inputStream_thisLineNumber (s), colNumber, cstring_fromChars (msg))); } /* **++ ** FUNCTION NAME: ** ** lscanLineInit () ** ** FORMAL PARAMETERS: ** ** None ** ** RETURN VALUE: ** ** None ** ** INVARIANTS: ** ** [@description or none@] ** ** DESCRIPTION: ** ** Initialize this module (should only be called once). ** ** IMPLICIT INPUTS/OUTPUT: ** ** GetNextLine - (output) initialized ** NullToken - (output) initialized ** PrintName - (output) array contents initialized ** ** EXCEPTIONS: ** ** None **-- */ void lscanLineInit (void) { int i; reportEOL = FALSE; reportComments = FALSE; for (i = 0; i <= LASTCHAR; i++) { charClass[i] = charClassDef[i]; } /* ** NOTE: The following line ensures that all tokens have nonzero ** handles, so that a handle of zero can be used to indicate that a ** token does not have a synonym. */ (void) LSLReserveToken (LST_SIMPLEID, "dummy token"); ltoken_forall = LSLReserveToken (LST_QUANTIFIERSYM, "\\forall"); ltoken_true = LSLReserveToken (LST_SIMPLEID, "true"); ltoken_false = LSLReserveToken (LST_SIMPLEID, "false"); ltoken_not = LSLReserveToken (LST_SIMPLEOP, "\\not"); ltoken_and = LSLReserveToken (LST_LOGICALOP, "\\and"); ltoken_or = LSLReserveToken (LST_LOGICALOP, "\\or"); ltoken_implies = LSLReserveToken (LST_LOGICALOP, "\\implies"); ltoken_eq = LSLReserveToken (LST_EQOP, "\\eq"); ltoken_neq = LSLReserveToken (LST_EQOP, "\\neq"); ltoken_equals = LSLReserveToken (LST_EQUATIONSYM, "\\equals"); ltoken_eqsep = LSLReserveToken (LST_EQSEPSYM, "\\eqsep"); ltoken_select = LSLReserveToken (LST_SELECTSYM, "\\select"); ltoken_open = LSLReserveToken (LST_OPENSYM, "\\open"); ltoken_sep = LSLReserveToken (LST_SEPSYM, "\\,"); ltoken_close = LSLReserveToken (LST_CLOSESYM, "\\close"); ltoken_id = LSLReserveToken (LST_SIMPLEID, "\\:"); ltoken_arrow = LSLReserveToken (LST_MAPSYM, "\\arrow"); ltoken_farrow = LSLReserveToken (LST_FIELDMAPSYM, "\\field_arrow"); ltoken_marker = LSLReserveToken (LST_MARKERSYM, "\\marker"); ltoken_comment = LSLReserveToken (LST_COMMENTSYM, "\\comment"); ltoken_compose = LSLReserveToken (LST_COMPOSESYM, "\\composeSort"); ltoken_if = LSLReserveToken (LST_ifTOKEN, "if"); (void) LSLReserveToken (LST_LPAR, " ("); (void) LSLReserveToken (LST_RPAR, ")"); (void) LSLReserveToken (LST_COMMA, ","); (void) LSLReserveToken (LST_COLON, ":"); (void) LSLReserveToken (LST_LBRACKET, "["); (void) LSLReserveToken (LST_RBRACKET, "]"); (void) LSLReserveToken (LST_WHITESPACE, " "); (void) LSLReserveToken (LST_WHITESPACE, "\t"); (void) LSLReserveToken (LST_WHITESPACE, "\n"); (void) LSLReserveToken (LEOFTOKEN, "E O F"); (void) LSLReserveToken (LST_EOL, "E O L"); (void) LSLReserveToken (LST_assertsTOKEN, "asserts"); (void) LSLReserveToken (LST_assumesTOKEN, "assumes"); (void) LSLReserveToken (LST_byTOKEN, "by"); (void) LSLReserveToken (LST_convertsTOKEN, "converts"); (void) LSLReserveToken (LST_elseTOKEN, "else"); (void) LSLReserveToken (LST_enumerationTOKEN, "enumeration"); (void) LSLReserveToken (LST_equationsTOKEN, "equations"); (void) LSLReserveToken (LST_exemptingTOKEN, "exempting"); (void) LSLReserveToken (LST_forTOKEN, "for"); (void) LSLReserveToken (LST_generatedTOKEN, "generated"); (void) LSLReserveToken (LST_impliesTOKEN, "implies"); (void) LSLReserveToken (LST_includesTOKEN, "includes"); (void) LSLReserveToken (LST_introducesTOKEN, "introduces"); (void) LSLReserveToken (LST_ofTOKEN, "of"); (void) LSLReserveToken (LST_partitionedTOKEN, "partitioned"); (void) LSLReserveToken (LST_thenTOKEN, "then"); (void) LSLReserveToken (LST_traitTOKEN, "trait"); (void) LSLReserveToken (LST_tupleTOKEN, "tuple"); (void) LSLReserveToken (LST_unionTOKEN, "union"); } void lscanLineReset (void) { } void lscanLineCleanup (void) { } charCode lscanCharClass (char c) { return charClass[ (int) (c)].code; } bool LSLIsEndComment (char c) { return charClass[ (int) (c)].endCommentChar; } void lsetCharClass (char c, charCode cod) { charClass[ (int) (c)].code = cod; } void lsetEndCommentChar (char c, bool flag) { charClass[ (int) (c)].endCommentChar = flag; } splint-3.1.2.dfsg1/src/lslparse.c0000644021234200000250000003007707646432515014246 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lslparse.c ** ** Module for calling LSL checker. ** ** AUTHOR: ** Yang Meng Tan, ** Massachusetts Institute of Technology */ # include "splintMacros.nf" # include "basic.h" # include "lclscan.h" # include "signature.h" # include "signature2.h" # include "scan.h" # include "scanline.h" # include "syntable.h" # include "tokentable.h" # include "lslinit.h" # include "lslparse.h" # include "llmain.h" /*@+ignorequals@*/ /*@dependent@*/ /*@null@*/ lslOp g_importedlslOp = NULL; bool g_lslParsingTraits = FALSE; static void invokeLSL (cstring p_infile, cstring p_outfile, bool p_deletep); int parseSignatures (cstring infile) { inputStream sourceFile; ltoken *id = (ltoken *) dmalloc (sizeof (*id)); int status = 0; /* parse traits */ *id = LSLInsertToken (LST_SIMPLEID, lsymbol_fromString (infile), 0, FALSE); ltoken_setFileName (*id, infile); ltoken_setLine (*id, 0); ltoken_setCol (*id, 0); sourceFile = inputStream_create (infile, cstring_undefined, FALSE); if (!inputStream_getPath (context_getLarchPath (), sourceFile)) { lclplainerror (message ("LSL signature parsing: can't find file %s containing trait", inputStream_fileName (sourceFile))); status = 1; sfree (id); inputStream_free (sourceFile); return status; } if (!inputStream_open (sourceFile)) { lclplainerror (cstring_makeLiteral ("LSL parsing: can't open file containing trait")); status = 2; sfree (id); inputStream_free (sourceFile); return status; } lsldebug = 0; g_lslParsingTraits = TRUE; LSLScanReset (sourceFile); LSLReportEolTokens (FALSE); status = lslparse (); /* symtable_dump (symtab, stdout, TRUE); */ g_lslParsingTraits = FALSE; (void) inputStream_close (sourceFile); inputStream_free (sourceFile); sfree (id); return status; } /*@only@*/ lslOp parseOpLine (cstring fname, cstring line) { inputStream sourceFile; bool status; sourceFile = inputStream_fromString (fname, line); if (check (inputStream_open (sourceFile))) { LSLScanReset (sourceFile); LSLReportEolTokens (FALSE); /* 0 by default, lslParsingTraits = 0; */ /* ** lsl parsing and importing .lcs files are expected to be mutually ** exclusive. ** ** lslparse sets importedlslOp */ status = (lslparse () != 0); if (status) { lclplainfatalerror (message ("Error in parsing line: %s", line)); } (void) inputStream_close (sourceFile); } inputStream_free (sourceFile); llassert (g_importedlslOp != NULL); return (lslOp_copy (g_importedlslOp)); } lsymbol processTraitSortId (lsymbol sortid) { lsymbol out = lsymbol_sortFromType (g_symtab, sortid); if (out == sortid) { /* may be a new sort */ (void) sort_fromLsymbol (sortid); } return out; } /* formerly from check.c module */ static /*@only@*/ cstring printTypeName2 (typeNameNode n) { cstring s = cstring_undefined; sortNode sn; lsymbol lclSort; ltoken err; if (n != (typeNameNode) 0) { if (n->isTypeName) { /* does not process opForm renaming, pass on to LSL and hope that it works for now. */ typeNamePack p = n->typename; llassert (p != NULL); /* get the LCL type, assume LCL type has already been mentioned. */ lclSort = lclTypeSpecNode2sort (p->type); lclSort = sort_getUnderlying (lclSort); /* lclsource = LCLSLScanSource (); */ if (!sort_isValidSort (lclSort)) { err = lclTypeSpecNode_errorToken (p->type); /* errorShowPoint (inputStream_thisLine (lclsource), ltoken_getCol (err)); */ lclerror (err, message ("Unrecognized type in uses: %q", typeNameNode_unparse (n))); } else { /* ** Below is necessary because this is one place where an LCL mutable ** type name is mapped directly into its value sort, not obj sort. ** Allows us to support only one qualifying "obj", rather ** than "val" as well. */ lclSort = typeExpr2ptrSort (lclSort, p->abst); lclSort = sort_makeVal (lclSort); /* ** Check that lclSort is not a HOFSort ... ** Propagation of HOFSort should stop here. */ if (sort_isHOFSortKind (lclSort)) { err = lclTypeSpecNode_errorToken (p->type); lclfatalerror (err, cstring_makeLiteral ("LCL uses cannot handle higher-order types")); } if (p->isObj) lclSort = sort_makeObj (lclSort); /* if (!p->isObj) { lclSort = sort_makeVal (lclSort); } */ sn = sort_lookup (lclSort); s = cstring_copy (cstring_fromChars (lsymbol_toChars (sn->name))); /* s = string_paste (s, AbstDeclaratorNode_unparse (p->abst)); */ } } else { /* s = OpFormNode_unparse (n->opform); */ if (n->opform != 0) { lclfatalerror (n->opform->tok, cstring_makeLiteral ("Attempt to rename operator with uses: " "use LSL includes renaming facility")); } else { BADEXIT; } } } return s; } static /*@only@*/ cstring replaceNode_unparseAlt (replaceNode x) { cstring s = cstring_undefined; if (x != (replaceNode) 0) { s = printTypeName2 (x->typename); s = cstring_concatChars (s, " for "); if (x->isCType) { s = cstring_concatFree1 (s, ltoken_unparse (x->content.ctype)); } else { s = cstring_concatFree (s, nameNode_unparse (x->content.renamesortname.name)); s = cstring_concatFree (s, sigNode_unparse (x->content.renamesortname.signature)); } } return s; } static /*@only@*/ cstring replaceNodeList_unparseAlt (replaceNodeList x) { cstring s = cstring_undefined; bool first = TRUE; replaceNodeList_elements (x, i) { if (first) { s = replaceNode_unparseAlt (i); first = FALSE; } else { s = message ("%q, %q", s, replaceNode_unparseAlt (i)); } } end_replaceNodeList_elements; return s; } static /*@only@*/ cstring printNameList2 (typeNameNodeList x) { /* printing a list of typeNameNode's, not nameNode's */ bool first = TRUE; cstring s = cstring_undefined; typeNameNodeList_elements (x, i) { if (first) { s = printTypeName2 (i); first = FALSE; } else { s = message ("%q, %q", s, printTypeName2 (i)); } } end_typeNameNodeList_elements; return s; } static /*@only@*/ cstring printRenamingNode2 (renamingNode x) { cstring s = cstring_undefined; if (x != (renamingNode) 0) { if (x->is_replace) { replaceNodeList r = x->content.replace; s = replaceNodeList_unparseAlt (r); } else { nameAndReplaceNode n = x->content.name; bool printComma = TRUE; if (typeNameNodeList_size (n->namelist) == 0) { printComma = FALSE; } s = printNameList2 (n->namelist); if (printComma) if (replaceNodeList_isDefined (n->replacelist) && replaceNodeList_size (n->replacelist) != 0) { s = cstring_appendChar (s, ','); s = cstring_appendChar (s, ' '); } s = cstring_concatFree (s, replaceNodeList_unparseAlt (n->replacelist)); } } return s; } static /*@only@*/ cstring printTraitRefList2 (traitRefNodeList x) /*@*/ { cstring s = cstring_undefined; traitRefNodeList_elements (x, i) { s = message ("%qincludes (%q)", s, printRawLeaves2 (i->traitid)); if (i->rename != 0) { s = message ("%q(%q)", s, printRenamingNode2 (i->rename)); } s = message ("%q\n", s); } end_traitRefNodeList_elements; return s; } void callLSL (/*@unused@*/ cstring specfile, /*@only@*/ cstring text) { /* specfile is the name of the LCL file that contains "uses" Create an intermediate file named specfile_.. put text in the file, run lsl on it and direct output to specfile_.. specfile can be a full pathname. Note: LSL does not support traitnames that are pathnames, only symbols. */ cstring infile; cstring outfile; cstring nopath; cstring noext; FILE *inptr; infile = fileTable_fileName (fileTable_addltemp (context_fileTable ())); inptr = fileTable_createFile (context_fileTable (), infile); if (inptr == NULL) { /* fopen fails */ llfatalerror (message ("Unable to write intermediate file: %s", infile)); } nopath = fileLib_removePath (infile); noext = fileLib_removeAnyExtension (nopath); fprintf (inptr, "%s : trait\n", cstring_toCharsSafe (noext)); cstring_free (noext); cstring_free (nopath); fprintf (inptr, "%s", cstring_toCharsSafe (text)); check (fileTable_closeFile (context_fileTable (), inptr)); /* the default is to delete the input file */ outfile = fileTable_fileName (fileTable_addltemp (context_fileTable ())); invokeLSL (infile, outfile, context_getFlag (FLG_KEEP)); cstring_free (text); } static void invokeLSL (cstring infile, cstring outfile, bool deletep) { /* run lsl on infile and leave result in outfile */ FILE *outptr; filestatus status; int callstatus; cstring call; cstring returnPath = cstring_undefined; /* ** Ensures that outfile can be written into, should find a better ** way to do this. */ outptr = fileTable_createFile (context_fileTable (), outfile); if (outptr == NULL) { /* fopen fails */ llfatalerror (message ("Unable to write intermediate file: %s", outfile)); } check (fileTable_closeFile (context_fileTable (), outptr)); /* set call to the right command */ status = osd_getExePath (cstring_makeLiteralTemp ("PATH"), cstring_makeLiteralTemp ("lsl"), &returnPath); if (status == OSD_FILEFOUND) { call = message ("%s -syms %s > %s", returnPath, infile, outfile); /* before calling, make sure old file is removed */ (void) osd_unlink (outfile); callstatus = osd_system (call); cstring_free (call); if (callstatus != CALL_SUCCESS) { /* ** lsl errors: call lsl again without -syms, sending output to stdout */ cstring syscal = message ("%s %s", returnPath, infile); (void) osd_system (syscal); cstring_free (syscal); llfatalerror (cstring_makeLiteral ("LSL trait used contains errors.")); } else { /* ok, go ahead */ /* Now parse the LSL output and store info in symbol table */ callstatus = parseSignatures (cstring_copy (outfile)); if (callstatus == 0) { /* all went well */ if (!context_getFlag (FLG_KEEP)) { /* delete temporary files */ if (deletep) { (void) osd_unlink (infile); } (void) osd_unlink (outfile); } } } } else if (status == OSD_FILENOTFOUND) { llfatalerror (cstring_makeLiteral ("Cannot find LSL checker: check your command search path.")); } else /* must be (status == OSD_PATHTOOLONG) */ { lclfatalbug ("invokeLSL: lsl plus directory from search path is too long"); } } /* callLSL ("MySet", "includes Set (CC for C, EE for E)"); */ void readlsignatures (interfaceNode n) { /* assume n->kind = usesKIND */ callLSL (g_currentSpec, printTraitRefList2 (n->content.uses)); } splint-3.1.2.dfsg1/src/lh.c0000644021234200000250000002043507651115036013011 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lh.c ** ** MODULE DESCRIPTION: ** ** This module contains the I/O routines for writing out the .lh file ** generated from the .lcl file. ** ** AUTHORS: ** ** Gary Feldman, Technical Languages and Environments, DECspec project ** Yang Meng Tan, MIT. ** ** CREATION DATE: 9 April 91 ** ** The lh.c module controls formatting policy. */ # include "splintMacros.nf" # include "basic.h" # include "osd.h" # include "lh.h" # include "llmain.h" /*@constant static char TABCH; @*/ # define TABCH ' ' /*@constant static char TABINCH; @*/ # define TABINCH '\t' /*:private:*/ typedef struct { /*@open@*/ /*@dependent@*/ /*@null@*/ /*@reldef@*/ FILE *f; /*@reldef@*/ cstring name; } outFile; static bool genLh; static outFile LhFile; static bool needIncludeBool = FALSE; /* ** ** FORWARD FUNCTIONS ** */ /* static int colpos (int startcol, cstring line); */ static cstring lhTypeSpecNode (lclTypeSpecNode p_typespec); static /*@only@*/ cstring lhTypeExpr (/*@null@*/ typeExpr p_x); static /*@only@*/ cstring lhDeclaratorNode (declaratorNode p_x); /*@only@*/ cstring lhFunction (lclTypeSpecNode lclTypeSpec, declaratorNode declarator) { cstring s; if (!genLh) return cstring_undefined; s = message ("extern %q %q;", lhTypeSpecNode (lclTypeSpec), lhDeclaratorNode (declarator)); return s; } static /*@only@*/ cstring lhDeclaratorNode (declaratorNode x) { return (lhTypeExpr (x->type)); } static /*@only@*/ cstring lhTypeExpr (/*@null@*/ typeExpr x) { cstring s = cstring_undefined; /* print out types in order of appearance in source */ paramNodeList params; int i; if (x != (typeExpr) 0) { cstring front = cstring_undefined; cstring back = cstring_undefined; for (i = x->wrapped; i >= 1; i--) { front = cstring_appendChar (front, '('); back = cstring_appendChar (back, ')'); } switch (x->kind) { case TEXPR_BASE: s = message ("%q%s", s, ltoken_getRawString (x->content.base)); break; case TEXPR_PTR: s = message ("%q*%q", s, lhTypeExpr (x->content.pointer)); break; case TEXPR_ARRAY: s = message ("%q%q[%q]", s, lhTypeExpr (x->content.array.elementtype), termNode_unparse (x->content.array.size)); break; case TEXPR_FCN: s = message ("%q%q (", s, lhTypeExpr (x->content.function.returntype)); params = x->content.function.args; if (!paramNodeList_empty (params)) { s = message ("%q%q", s, paramNodeList_unparseComments (x->content.function.args)); } s = message ("%q)", s); break; } s = message ("%q%q%q", front, s, back); } else { s = cstring_makeLiteral ("?"); } return s; } extern void lhForwardStruct (ltoken t) { if (!genLh) return; lhOutLine (message ("struct %s;", ltoken_unparse (t))); } extern void lhForwardUnion (ltoken t) { if (!genLh) return; lhOutLine (message ("union %s;", ltoken_unparse (t))); } extern /*@only@*/ cstring lhType (typeNode t) { if (!genLh) return cstring_undefined; if (t->kind == TK_EXPOSED) { exposedNode n = t->content.exposed; if (n != (exposedNode) 0) { if (declaratorInvNodeList_size (n->decls) == 0) { /* ** Forward struct or union declaration */ return (cstring_appendChar (lhTypeSpecNode (n->type), ';')); } else { cstring s = cstring_undefined; declaratorInvNodeList_elements (n->decls, d) { cstring name = declaratorNode_unparse (d->declarator); cstring pname = declaratorNode_unparseCode (d->declarator); s = message ("%q\n# ifndef EXPOSED_TYPE_%q\ntypedef %q %q;\n# endif\n", s, pname, lhTypeSpecNode (n->type), name); } end_declaratorInvNodeList_elements; return s; } } } return cstring_undefined; } static /*@only@*/ cstring lhTypeSpecNode (lclTypeSpecNode typespec) { if (!genLh) { return cstring_undefined; } return (lclTypeSpecNode_unparseComments (typespec)); } /*@only@*/ cstring lhVarDecl (lclTypeSpecNode lclTypeSpec, initDeclNodeList initDecls, qualifierKind qualifier) { bool first = TRUE; cstring s; if (!genLh) return cstring_undefined; s = cstring_makeLiteral ("extern"); switch (qualifier) { case QLF_NONE: break; case QLF_CONST: s = message ("%q const", s); break; case QLF_VOLATILE: s = message ("%q volatile", s); break; default: /* ignore it */ break; } s = message ("%q %q ", s, lhTypeSpecNode (lclTypeSpec)); initDeclNodeList_elements (initDecls, i) { if (first) { s = message ("%q %q", s, declaratorNode_unparse (i->declarator)); first = FALSE; } else { s = message ("%q, %q", s, declaratorNode_unparse (i->declarator)); } } end_initDeclNodeList_elements; return (message ("%q;", s)); } extern void lhCleanup (void) /*@modifies fileSystem@*/ { if (!genLh) { return; } else { llassert (LhFile.f != NULL); if (LhFile.f == NULL) { lldiagmsg (message ("Cannot open lh file for output: %s", LhFile.name)); } else { check (fprintf (LhFile.f, "/* Output from %s */\n", LCL_PARSE_VERSION) > 0); check (fileTable_closeFile (context_fileTable (), LhFile.f)); LhFile.f = NULL; } } } /* Write an #include of bool.h if we have't done so already. */ extern void lhIncludeBool (void) { needIncludeBool = TRUE; } void lhInit (inputStream f) /*@globals undef LhFile; @*/ { static bool lherror = FALSE; genLh = context_msgLh (); needIncludeBool = FALSE; if (!genLh) { return; } LhFile.name = cstring_concatFree1 (LSLRootName (inputStream_fileName (f)), LH_EXTENSION); LhFile.f = fileTable_openWriteUpdateFile (context_fileTable (), LhFile.name); if (LhFile.f == NULL) { genLh = FALSE; if (!lherror) { lclplainerror (message ("Cannot write temporary file: %s", LhFile.name)); lherror = TRUE; } } } void lhOutLine (/*@only@*/ cstring s) { if (genLh) { llassert (LhFile.f != NULL); DPRINTF (("lhOutLine: %s / %s", s, LhFile.name)); if (cstring_length (s) > 0) { check (fputs (cstring_toCharsSafe (s), LhFile.f) != EOF); } check (fputc ('\n', LhFile.f) == (int) '\n'); } cstring_free (s); } void lhExternals (interfaceNodeList x) { if (genLh) { llassert (LhFile.f != NULL); /* ** Need to make sure all standard library includes come first. */ interfaceNodeList_elements (x, el) { if (el->kind == INF_IMPORTS) { importNodeList imps = el->content.imports; importNodeList_elements (imps, il) { if (il->kind == IMPBRACKET) { lhOutLine (message ("# include <%s.h>", ltoken_getRawString (il->val))); } } end_importNodeList_elements ; } } end_interfaceNodeList_elements; lhOutLine (cstring_makeLiteral ("# include \"bool.h\"")); interfaceNodeList_elements (x, el) { if (el->kind == INF_IMPORTS) { importNodeList imps = el->content.imports; importNodeList_elements (imps, il) { if (il->kind != IMPBRACKET) { lhOutLine (message ("# include \"%s.h\"", ltoken_getRawString (il->val))); } } end_importNodeList_elements ; } } end_interfaceNodeList_elements; lhOutLine (cstring_undefined); } } splint-3.1.2.dfsg1/src/checking.c0000644021234200000250000004363307646432514014175 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** checking.c ** ** sort checking. ** ** AUTHOR: ** Yang Meng Tan, ** Massachusetts Institute of Technology */ # include "splintMacros.nf" # include "basic.h" # include "llgrammar.h" # include "checking.h" # include "lclscan.h" /*@+ignorequals@*/ static /*@only@*/ cstring printBadArgs (sortSetList p_args); static /*@only@*/ sortSet standardOperators (/*@null@*/ nameNode p_n, sortSetList p_argSorts, sort p_q); static bool isStandardOperator (/*@null@*/ nameNode p_n); static void assignSorts (termNode p_t, sort p_s); /*@null@*/ termNode computePossibleSorts (/*@returned@*/ /*@null@*/ termNode t) { ltoken errtok; if (t != (termNode) 0) { switch (t->kind) { case TRM_LITERAL: case TRM_CONST: case TRM_VAR: case TRM_ZEROARY: case TRM_SIZEOF: case TRM_UNCHANGEDALL: case TRM_UNCHANGEDOTHERS: case TRM_QUANTIFIER: break; case TRM_APPLICATION: { bool fail = FALSE; sortSetList argSorts = sortSetList_new (); lslOpSet ops; sortSet standards; if (termNodeList_size (t->args) != 0) { termNodeList_elements (t->args, arg) { (void) computePossibleSorts (arg); if (sortSet_size (arg->possibleSorts) == 0) { fail = TRUE; } else { sortSetList_addh (argSorts, arg->possibleSorts); } } end_termNodeList_elements; if (fail) { lslOpSet_free (t->possibleOps); sortSetList_free (argSorts); t->possibleOps = lslOpSet_new (); return t; } } ops = symtable_opsWithLegalDomain (g_symtab, t->name, argSorts, t->given); lslOpSet_free (t->possibleOps); t->possibleOps = ops; lslOpSet_elements (t->possibleOps, op) { sort sort; sort = sigNode_rangeSort (op->signature); (void) sortSet_insert (t->possibleSorts, sort); } end_lslOpSet_elements; standards = standardOperators (t->name, argSorts, t->given); sortSet_elements (standards, el) { (void) sortSet_insert (t->possibleSorts, el); } end_sortSet_elements; sortSet_free (standards); if (!(t->error_reported) && sortSet_size (t->possibleSorts) == 0) { unsigned int arity = termNodeList_size (t->args); errtok = nameNode_errorToken (t->name); /* errorShowPoint (inputStream_thisLine (lclsource), ltoken_getCol (errtok)); */ if (isStandardOperator (t->name)) { lclerror (errtok, message ("Type error: %q not declared for %q", nameNode_unparse (t->name), printBadArgs (argSorts))); } else if (t->name != NULL && symtable_opExistsWithArity (g_symtab, t->name, arity)) { sigNodeSet possibleOps = symtable_possibleOps (g_symtab, t->name); cstring opName = nameNode_unparse (t->name); /* ** all these will be standardOperators soon... */ if (cstring_equalLit (opName, "__ [__]")) { lclerror (errtok, message ("Type error: %q not declared for %q", opName, printBadArgs (argSorts))); } else { lclerror (errtok, message ("Type error: %q declared: %q\ngiven: %q", opName, sigNodeSet_unparseSomeSigs (possibleOps), printBadArgs (argSorts))); } } else { sigNodeSet possibleOps; int npossibleOps; llassert (t->name != NULL); possibleOps = symtable_possibleOps (g_symtab, t->name); npossibleOps = sigNodeSet_size (possibleOps); /* ** evs --- check is it is wrong arity... */ if (npossibleOps == 0) { lclerror (errtok, message ("Undeclared operator: %q", nameNode_unparse (t->name))); } else { lclerror (errtok, message ("Operator %q declared for %q arguments, given %d", nameNode_unparse (t->name), sigNodeSet_unparsePossibleAritys (possibleOps), arity)); } } t->error_reported = TRUE; } sortSetList_free (argSorts); break; } } } return t; } static /*@only@*/ cstring printBadArgs (sortSetList args) { if (sortSetList_size (args) == 1) { return (sortSet_unparseOr (sortSetList_head (args))); } else { cstring s = cstring_undefined; int argno = 1; sortSetList_elements (args, ss) { if (argno == 1) s = message ("arg %d: %q", argno, sortSet_unparseOr (ss)); else s = message ("%q; arg %d: %q", s, argno, sortSet_unparseOr (ss)); argno++; } end_sortSetList_elements; return s; } } termNode checkSort (/*@returned@*/ termNode t) { sortSet sorts; sort theSort; int size; ltoken errtok; (void) computePossibleSorts (t); sorts = t->possibleSorts; llassert (sortSet_isDefined (sorts)); size = sortSet_size (sorts); switch (size) { case 0: /* complain later */ break; case 1: /* just right */ theSort = sortSet_choose (sorts); assignSorts (t, theSort); break; default: /* we allow C literals to have multiple sorts */ if (t->kind != TRM_LITERAL) { errtok = termNode_errorToken (t); t->error_reported = TRUE; lclerror (errtok, message ("Term %q: can have more than one possible type. Possible types: %q", termNode_unparse (t), sortSet_unparseClean (sorts))); } } return t; } static void assignSorts (termNode t, sort s) { /* other kinds are already assigned bottom-up */ ltoken errtok; switch (t->kind) { case TRM_ZEROARY: /* pick s to be the sort chosen */ case TRM_LITERAL: sortSet_elements (t->possibleSorts, s2) { if (sort_equal (s2, s)) { sortSet_free (t->possibleSorts); t->possibleSorts = sortSet_new (); (void) sortSet_insert (t->possibleSorts, s); t->sort = s; } return; } end_sortSet_elements; break; case TRM_APPLICATION: { lslOpSet sigs = t->possibleOps; lslOpSet oldops = lslOpSet_undefined; sigNode op = (sigNode) 0; nameNode name = t->name; termNodeList args = t->args; bool found = FALSE; errtok = nameNode_errorToken (name); /* why compute again? to check for duplicates */ lslOpSet_elements (sigs, sig) { sort rsort = sigNode_rangeSort (sig->signature); if (sort_equal (s, rsort)) { lslOp iop; if (found) { t->error_reported = TRUE; lclerror (errtok, message ("Ambiguous operator %q: %q or %q", nameNode_unparse (name), sigNode_unparse (op), sigNode_unparse (sig->signature))); return; } iop = (lslOp) dmalloc (sizeof (*iop)); found = TRUE; op = sig->signature; oldops = t->possibleOps; t->possibleOps = lslOpSet_new (); iop->name = nameNode_copy (name); iop->signature = op; (void) lslOpSet_insert (t->possibleOps, iop); t->sort = s; /*@-branchstate@*/ } /*@=branchstate@*/ } end_lslOpSet_elements; lslOpSet_free (oldops); if (!found) { if (sortSet_size (t->possibleSorts) == 1) { t->sort = sortSet_choose (t->possibleSorts); } else { /* errorShowPoint (inputStream_thisLine (lclsource), ltoken_getCol (errtok)); */ t->error_reported = TRUE; lclerror (errtok, message ("Operator not found: %q", nameNode_unparse (name))); /* evs --- ??? */ } return; } if (termNodeList_empty (args)) { if (op != (sigNode) 0) { /* was --- NB: copy to avoid interference */ /* shouldn't need to copy --- its a fresh list */ sortList dom = sigNode_domain (op); sortList_reset (dom); termNodeList_elements (args, arg) { assignSorts (arg, sortList_current (dom)); sortList_advance (dom); } end_termNodeList_elements; sortList_free (dom); } else { errtok = nameNode_errorToken (name); /* errorShowPoint (inputStream_thisLine (lclsource), ltoken_getCol (errtok)); */ t->error_reported = TRUE; lclerror (errtok, message ("No matching operator: %q", nameNode_unparse (name))); } return; } break; } default: /* do nothing */ break; } } void checkLclPredicate (ltoken t, lclPredicateNode n) { sort theSort; if ((n == NULL) || (n->predicate == NULL)) { llcontbuglit ("checkLclPredicate expects valid lclPredicate. " "Skipping current check"); return; } /* check only if there are no previous errors */ if (!n->predicate->error_reported) { /* check that the sort of n is boolean */ theSort = n->predicate->sort; if (!sort_compatible (theSort, g_sortCapBool)) { if (sort_isNoSort (theSort)) { ; /* "Expects a boolean term. Given term has unknown sort" */ } else { cstring clauset = ltoken_getRawString (t); if (cstring_firstChar (clauset) == '(') { clauset = cstring_makeLiteral ("Equality"); } else { /* uppercase first letter */ clauset = cstring_copy (clauset); cstring_setChar (clauset, 1, (char) toupper (cstring_firstChar (clauset))); } lclerror (t, message ("%q expects a boolean term, given %q.", clauset, sort_unparse (theSort))); } } } } /* ** these should not be doing string comparisons! */ static bool isDeRefOperator (cstring s) { return (cstring_equalLit (s, "*")); } static bool isStateOperator (cstring s) { return (cstring_equalLit (s, "^") || cstring_equalLit (s, "'") || cstring_equalLit (s, "\\any") || cstring_equalLit (s, "\\pre") || cstring_equalLit (s, "\\post")); } static bool isCompareOperator (cstring s) /* YUCK!!! */ { return (cstring_equalLit (s, "\\eq") || cstring_equalLit (s, "\\neq") || cstring_equalLit (s, "=") || cstring_equalLit (s, "!=") || cstring_equalLit (s, "~=") || cstring_equalLit (s, "==")); } static bool isStandardOperator (/*@null@*/ nameNode n) { if (n != (nameNode) 0) { if (!n->isOpId) { opFormNode opf = n->content.opform; llassert (opf != NULL); switch (opf->kind) { case OPF_IF: return TRUE; case OPF_ANYOP: break; case OPF_MANYOP: { cstring s = ltoken_getRawString (opf->content.anyop); if (isStateOperator (s)) return TRUE; return FALSE; } case OPF_ANYOPM: /* operator: *__ */ { cstring s = ltoken_getRawString (opf->content.anyop); return (isDeRefOperator (s)); } case OPF_MANYOPM: { cstring s = ltoken_getRawString (opf->content.anyop); return (isCompareOperator (s)); } case OPF_MIDDLE: break; case OPF_MMIDDLE: break; case OPF_MIDDLEM: break; case OPF_MMIDDLEM: break; case OPF_BMIDDLE: break; case OPF_BMMIDDLE: break; case OPF_BMIDDLEM: break; case OPF_BMMIDDLEM: break; case OPF_SELECT: break; case OPF_MAP: break; case OPF_MSELECT: break; case OPF_MMAP: break; default: break; } } else { int code = ltoken_getCode (n->content.opid); if (code == simpleId) { cstring text = nameNode_unparse (n); bool ret = (cstring_equalLit (text, "trashed") || cstring_equalLit (text, "maxIndex") || cstring_equalLit (text, "minIndex") || cstring_equalLit (text, "isSub")); cstring_free (text); return ret; } return (code == LLT_MODIFIES || code == LLT_FRESH || code == LLT_UNCHANGED || code == LLT_SIZEOF); } } return FALSE; } static /*@only@*/ sortSet standardOperators (/*@null@*/ nameNode n, sortSetList argSorts, /*@unused@*/ sort q) { sortSet argSet; sortSet ret = sortSet_new (); if (n == (nameNode) 0) return ret; if (n->isOpId) { int code = ltoken_getCode (n->content.opid); if (sortSetList_size (argSorts) == 1) { sortSetList_reset (argSorts); argSet = sortSetList_current (argSorts); sortSet_elements (argSet, current) { sortNode sn; sn = sort_quietLookup (current); while (sn->kind == SRT_SYN) { sn = sort_quietLookup (sn->baseSort); } /*@-loopswitchbreak@*/ switch (code) { case simpleId: { cstring text = ltoken_getRawString (n->content.opid); if (cstring_equalLit (text, "trashed")) /* GACK! */ { if (sn->kind == SRT_OBJ || sn->kind == SRT_ARRAY) (void) sortSet_insert (ret, g_sortBool); } if (cstring_equalLit (text, "maxIndex") || cstring_equalLit (text, "minIndex")) { if (sn->kind == SRT_ARRAY || sn->kind == SRT_PTR) (void) sortSet_insert (ret, g_sortInt); /* if (lsymbol_fromChars ("maxIndex") */ } } break; case LLT_MODIFIES: case LLT_FRESH: case LLT_UNCHANGED: if (sn->kind == SRT_OBJ || sn->kind == SRT_ARRAY) { (void) sortSet_insert (ret, g_sortBool); } break; case LLT_SIZEOF: if (sn->kind == SRT_OBJ || sn->kind == SRT_ARRAY || sn->kind == SRT_VECTOR) (void) sortSet_insert (ret, g_sortInt); break; default: break; } } end_sortSet_elements; } } else { opFormNode opf = n->content.opform; llassert (opf != NULL); switch (opf->kind) { case OPF_IF: /* ** if __ then __ else __ : bool, S, S -> S ** is defined for all sorts */ if (sortSetList_size (argSorts) == 3) { argSet = sortSetList_head (argSorts); if (sortSet_member (argSet, g_sortBool)) { sortSetList_reset (argSorts); sortSetList_advance (argSorts); argSet = sortSetList_current (argSorts); if (sortSet_size (argSet) == 1) { sort clause = sortSet_choose (argSet); sort clause2; sortSetList_advance (argSorts); argSet = sortSetList_current (argSorts); clause2 = sortSet_choose (argSet); if (sortSet_size (argSet) == 1 && sort_equal (clause, clause2)) { (void) sortSet_insert (ret, clause); } } } } break; case OPF_MANYOP: { cstring s = ltoken_getRawString (opf->content.anyop); if (isStateOperator (s)) { if (sortSetList_size (argSorts) == 1) { sortSetList_reset (argSorts); argSet = sortSetList_current (argSorts); sortSet_elements (argSet, current) { sortNode sn; sn = sort_quietLookup (current); while (sn->kind == SRT_SYN) { sn = sort_quietLookup (sn->baseSort); } switch (sn->kind) { case SRT_OBJ: (void) sortSet_insert (ret, sn->baseSort); break; case SRT_ARRAY: (void) sortSet_insert (ret, sort_makeVec (ltoken_undefined, current)); break; case SRT_STRUCT: (void) sortSet_insert (ret, sort_makeTuple (ltoken_undefined, current)); break; case SRT_UNION: (void) sortSet_insert (ret, sort_makeUnionVal (ltoken_undefined, current)); break; case SRT_TUPLE: case SRT_UNIONVAL: case SRT_ENUM: case SRT_LAST: case SRT_FIRST: case SRT_NONE: case SRT_HOF: case SRT_PRIM: case SRT_PTR: case SRT_VECTOR: break; case SRT_SYN: llbuglit ("standardOperators: Synonym in switch"); } } end_sortSet_elements ; } } } break; case OPF_ANYOPM: /* operator: *__ */ { cstring s = ltoken_getRawString (opf->content.anyop); if (isDeRefOperator (s)) { if (sortSetList_size (argSorts) == 1) { sortSetList_reset (argSorts); argSet = sortSetList_current (argSorts); sortSet_elements (argSet, current) { sortNode sn; sn = sort_quietLookup (current); while (sn->kind == SRT_SYN) { sn = sort_quietLookup (sn->baseSort); } if (sn->kind == SRT_PTR) { (void) sortSet_insert (ret, sn->baseSort); } } end_sortSet_elements; } } } break; case OPF_ANYOP: break; case OPF_MANYOPM: { cstring s = ltoken_getRawString (opf->content.anyop); if (isCompareOperator (s)) { if (sortSetList_size (argSorts) == 2) { sortSet argSet2; sortSetList_reset (argSorts); argSet = sortSetList_current (argSorts); sortSetList_advance (argSorts); argSet2 = sortSetList_current (argSorts); if (sortSet_size (argSet) == 1) { sortSet_elements (argSet, cl) { sortSet_elements (argSet2, cl2) { if (sort_equal (cl, cl2)) { (void) sortSet_insert (ret, g_sortBool); } } end_sortSet_elements; } end_sortSet_elements; } } } } break; case OPF_MIDDLE: break; case OPF_MMIDDLE: break; case OPF_MIDDLEM: break; case OPF_MMIDDLEM: break; case OPF_BMIDDLE: break; case OPF_BMMIDDLE: break; case OPF_BMIDDLEM: break; case OPF_BMMIDDLEM: break; case OPF_SELECT: break; case OPF_MAP: break; case OPF_MSELECT: break; case OPF_MMAP: break; default: break; } /*@=loopswitchbreak@*/ } return ret; } splint-3.1.2.dfsg1/src/lclctypes.c0000644021234200000250000001226607646432515014423 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lclctypes.c ** ** This contains definitions used in processing C builtin types. ** ** WARNING: there is a different file ctype.c for handling types ** in the C checking of splint. This is only for handling ** C builtin types in LCL files. ** ** AUTHORS: ** ** Gary Feldman, Technical Languages and Environements, DECspec project ** Joe Wild, Technical Languages and Environements, DECspec project ** */ # include "splintMacros.nf" # include "basic.h" typedef struct { bits pt; TypeSpec ts; } Lclctype2sortType; static Lclctype2sortType lclctype2type[] = { { fixBits (TS_VOID, 0), TYS_VOID}, { fixBits (TS_UNKNOWN, 0), TYS_NONE}, { fixBits (TS_CHAR, 0), TYS_CHAR}, { fixBits (TS_SIGNED, fixBits (TS_CHAR, 0)), TYS_SCHAR}, { fixBits (TS_UNSIGNED, fixBits (TS_CHAR, 0)), TYS_UCHAR}, { fixBits (TS_SIGNED, fixBits (TS_SHORT, fixBits (TS_INT, 0))), TYS_SSINT}, { fixBits (TS_SIGNED, fixBits (TS_SHORT, 0)), TYS_SSINT}, { fixBits (TS_SHORT, fixBits (TS_INT, 0)), TYS_SSINT}, { fixBits (TS_SHORT, 0), TYS_SSINT}, { fixBits (TS_UNSIGNED, fixBits (TS_SHORT, fixBits (TS_INT, 0))), TYS_USINT}, { fixBits (TS_UNSIGNED, fixBits (TS_SHORT, 0)), TYS_USINT}, { fixBits (TS_SIGNED, fixBits (TS_INT, 0)), TYS_SINT}, { fixBits (TS_SIGNED, 0), TYS_SINT}, { fixBits (TS_INT, 0), TYS_INT}, { 0, TYS_INT}, { fixBits (TS_UNSIGNED, fixBits (TS_INT, 0)), TYS_UINT}, { fixBits (TS_UNSIGNED, 0), TYS_UINT}, { fixBits (TS_SIGNED, fixBits (TS_LONG, fixBits (TS_INT, 0))), TYS_SLINT}, { fixBits (TS_SIGNED, fixBits (TS_LONG, 0)), TYS_SLINT}, { fixBits (TS_LONG, fixBits (TS_INT, 0)), TYS_SLINT}, { fixBits (TS_LONG, 0), TYS_SLINT}, { fixBits (TS_UNSIGNED, fixBits (TS_LONG, fixBits (TS_INT, 0))), TYS_ULINT}, { fixBits (TS_UNSIGNED, fixBits (TS_LONG, 0)), TYS_ULINT}, { fixBits (TS_FLOAT, 0), TYS_FLOAT}, { fixBits (TS_DOUBLE, 0), TYS_DOUBLE}, { fixBits (TS_LONG, fixBits (TS_DOUBLE, 0)), TYS_LDOUBLE}, { fixBits (TS_STRUCT, 0), TYS_STRUCT}, { fixBits (TS_UNION, 0), TYS_UNION}, { fixBits (TS_ENUM, 0), TYS_ENUM}, { fixBits (TS_TYPEDEF, 0), TYS_TYPENAME} }; lsymbol lclctype_toSortDebug (bits t) { int i; int lsize; static ob_mstring OLD_Type2sortName[] = { "error", /* TYS_NONE */ "void", /* TYS_VOID */ "char", /* TYS_CHAR */ "signed_char", /* TYS_SCHAR */ "char", /* TYS_UCHAR */ "short_int", /* TYS_SSINT */ "unsigned_short_int", /* TYS_USINT */ "int", /* TYS_INT */ "int", /* TYS_SINT */ "unsigned_int", /* TYS_UINT */ "long_int", /* TYS_SLINT */ "unsigned_long_int", /* TYS_ULINT */ "float", /* TYS_FLOAT */ "double", /* TYS_DOUBLE */ "long_double", /* TYS_LDOUBLE */ "error", /* TYS_ENUM */ "error", /* TYS_STRUCT */ "error", /* TYS_UNION */ "error" /* TYS_TYPENAME */ }; lsize = size_toInt (sizeof (lclctype2type) / sizeof (lclctype2type[0])); for (i = 0; i < lsize; i++) { if (lclctype2type[i].pt == t) { return lsymbol_fromChars (OLD_Type2sortName[(int)lclctype2type[i].ts]); } } return lsymbol_fromChars ("_error"); } lsymbol lclctype_toSort (bits t) { int i; static ob_mstring Type2sortName[] = { /* _error must have underscore, LSL/LCL interface convention */ "_error", /* TYS_NONE */ "void", /* TYS_VOID */ "char", /* TYS_CHAR */ "char", /* TYS_SCHAR */ "char", /* TYS_UCHAR */ "int", /* TYS_SSINT */ "int", /* TYS_USINT */ "int", /* TYS_INT */ "int", /* TYS_SINT */ "int", /* TYS_UINT */ "int", /* TYS_SLINT */ "int", /* TYS_ULINT */ "double", /* TYS_FLOAT */ "double", /* TYS_DOUBLE */ "double", /* TYS_LDOUBLE */ "error", /* TYS_ENUM */ "error", /* TYS_STRUCT */ "error", /* TYS_UNION */ "error" /* TYS_TYPENAME */ }; int lsize = size_toInt (sizeof (lclctype2type) / sizeof (lclctype2type[0])); for (i = 0; i < lsize; i++) { if (lclctype2type[i].pt == t) { return lsymbol_fromChars (Type2sortName[(int)lclctype2type[i].ts]); } } return lsymbol_fromChars ("_error"); } splint-3.1.2.dfsg1/src/imports.c0000644021234200000250000002420207650621401014074 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** imports.c ** ** module for importing LCL specs. ** ** AUTHOR: ** Yang Meng Tan, ** Massachusetts Institute of Technology */ # include "splintMacros.nf" # include "basic.h" # include "osd.h" # include "llgrammar.h" /* need simpleOp, MULOP and logicalOp in makeInfixTermNode */ # include "lclscan.h" # include "checking.h" # include "imports.h" # include "lslparse.h" # include "lh.h" # include "llmain.h" void outputLCSFile (char *path, char *msg, char *specname) { static bool haserror = FALSE; char *sfile = mstring_concat (specname, ".lcs"); char *outfile = mstring_concat (path, sfile); char *s; FILE *outfptr = fileTable_openWriteFile (context_fileTable (), cstring_fromChars (outfile)); sfree (sfile); DPRINTF (("Output lcl file: %s / %s / %s", path, specname, outfile)); /* check write permission */ if (outfptr == NULL) /* Cannot open file */ { if (!haserror) { lclplainerror (message ("Cannot write to output file: %s", cstring_fromChars (outfile))); haserror = TRUE; } sfree (outfile); return; } fprintf (outfptr, "%s", msg); fprintf (outfptr, "%s\n", LCL_PARSE_VERSION); /* output line %LCLimports foo bar ... */ fprintf (outfptr, "%%LCLimports "); lsymbolSet_elements (g_currentImports, sym) { s = lsymbol_toChars (sym); if (s != NULL && !mstring_equal (s, specname)) { fprintf (outfptr, "%s ", s); } } end_lsymbolSet_elements; fprintf (outfptr, "\n"); sort_dump (outfptr, TRUE); symtable_dump (g_symtab, outfptr, TRUE); check (fileTable_closeFile (context_fileTable (), outfptr)); sfree (outfile); } void importCTrait (void) { cstring infile = cstring_undefined; filestatus status = osd_findOnLarchPath (cstring_makeLiteralTemp (CTRAITSYMSNAME), &infile); switch (status) { case OSD_FILEFOUND: /* ** This line was missing before version 2.3f. Bug fix by Mike Smith. ** This looks like a bug - infile is already fully qualified path ** parseSignatures() adds another path to the front and fails to ** open the file. */ (void) parseSignatures (cstring_fromCharsNew (CTRAITSYMSNAME)); (void) parseSignatures (infile); break; case OSD_FILENOTFOUND: /* try spec name */ status = osd_findOnLarchPath (cstring_makeLiteralTemp (CTRAITSPECNAME), &infile); if (status == OSD_FILEFOUND) { callLSL (cstring_makeLiteralTemp (CTRAITSPECNAME), message ("includes %s (%s for String)", cstring_fromChars (CTRAITFILENAMEN), cstring_fromChars (sort_getName (g_sortCstring)))); cstring_free (infile); break; } else { lldiagmsg (message ("Unable to find %s or %s. Check LARCH_PATH environment variable.", cstring_fromChars (CTRAITSYMSNAME), cstring_fromChars (CTRAITSPECNAME))); cstring_free (infile); llexit (LLFAILURE); } case OSD_PATHTOOLONG: lclbug (message ("importCTrait: the concatenated directory and file " "name are too long: %s: " "continuing without it", cstring_fromChars (CTRAITSPECNAME))); cstring_free (infile); break; } } /* ** processImport --- load imports from file ** ** impkind: IMPPLAIN file on SPEC_PATH ** # include "./file.h" if it exists, ** # include "/file.h" if not. ** (warn if neither exists) ** IMPBRACKET file in default LCL imports directory ** # include ** IMPQUOTE file directly ** # include "file.h" */ void processImport (lsymbol importSymbol, ltoken tok, impkind kind) { bool readableP, oldexporting; bool compressedFormat = FALSE; inputStream imported, imported2, lclsource; char *bufptr; char *tmpbufptr; char *cptr; cstring name; lsymbol sym; char importName[MAX_NAME_LENGTH + 1]; cstring importFileName; cstring path = cstring_undefined; cstring fpath, fpath2; mapping map; filestatus ret; importFileName = lsymbol_toString (importSymbol); name = cstring_concat (importFileName, cstring_makeLiteralTemp (IO_SUFFIX)); /* ** find .lcs file */ switch (kind) { case IMPPLAIN: path = message ("%s%c%s", cstring_fromChars (g_localSpecPath), PATH_SEPARATOR, context_getLarchPath ()); break; case IMPBRACKET: path = cstring_copy (context_getLCLImportDir ()); break; case IMPQUOTE: path = cstring_fromCharsNew (g_localSpecPath); break; default: llbuglit ("bad imports case\n"); } if ((ret = osd_getPath (path, name, &fpath)) != OSD_FILEFOUND) { cstring fname2; if (ret == OSD_PATHTOOLONG) { llfatalerrorLoc (cstring_makeLiteral ("Path too long")); } imported2 = inputStream_create (cstring_copy (importFileName), LCL_EXTENSION, FALSE); fname2 = inputStream_fileName (imported2); if (osd_getPath (path, fname2, &fpath2) == OSD_FILEFOUND) { llfatalerrorLoc (message ("Specs must be processed before it can be imported: %s", fpath2)); } else { if (kind == IMPPLAIN || kind == IMPQUOTE) { llfatalerrorLoc (message ("Cannot find file to import: %s", name)); } else { llfatalerrorLoc (message ("Cannot find standard import file: %s", name)); } } } imported = inputStream_create (fpath, cstring_makeLiteralTemp (IO_SUFFIX), FALSE); readableP = inputStream_open (imported); if (!readableP) { /* can't read ? */ llfatalerrorLoc (message ("Cannot open import file for reading: %s", inputStream_fileName (imported))); } bufptr = inputStream_nextLine (imported); if (bufptr == 0) { llerror (FLG_SYNTAX, message ("Import file is empty: %s", inputStream_fileName (imported))); cstring_free (name); (void) inputStream_close (imported); inputStream_free (imported); cstring_free (path); return; } /* was it processed successfully ? */ if (firstWord (bufptr, "%FAILED")) { llfatalerrorLoc (message ("Imported file was not checked successfully: %s.", name)); } /* ** Is it generated by the right version of the checker? ** ** Uncompressed .lcs files start with %PASSED ** Compressed files start with %LCS */ if (firstWord (bufptr, "%PASSED")) { /* %PASSED Output from LCP Version 2.* and 3.* */ /* 1234567890123*/ /* +*/ cptr = strstr (bufptr, "LCP Version"); if (cptr != NULL) { /* ** Only really old files start this way! */ cptr += 12; if (*cptr != '2' && *cptr != '3') { llfatalerrorLoc (message ("Imported file %s is obsolete: %s.", inputStream_fileName (imported), cstring_fromChars (bufptr))); } } compressedFormat = FALSE; } else { if (!firstWord (bufptr, "%LCS")) { llfatalerrorLoc (message ("Imported file %s is not in correct format: %s", inputStream_fileName (imported), cstring_fromChars (bufptr))); } compressedFormat = TRUE; } /* push the imported LCL spec onto g_currentImports */ context_enterImport (); bufptr = inputStream_nextLine (imported); llassert (bufptr != NULL); tmpbufptr = bufptr; /* expect %LCLimports foo bar ... */ if (firstWord (bufptr, "%LCLimports ")) { bufptr = bufptr + strlen ("%LCLimports "); while (sscanf (bufptr, "%s", importName) == 1) { bufptr = bufptr + strlen (importName) + 1; /* 1 for space */ sym = lsymbol_fromChars (importName); if (sym == importSymbol || lsymbolSet_member (g_currentImports, sym)) { /* ensure that the import list does not contain itself: an invariant useful for checking imports cycles. */ lclsource = LCLScanSource (); lclfatalerror (tok, message ("Imports cycle: %s%s imports %s", importFileName, LCL_EXTENSION, cstring_fromChars (importName))); } /* push them onto g_currentImports */ /* evs - 94 Apr 3: I don't think it should do this! */ /* (void) lsymbolSet_insert (g_currentImports, sym); */ } } else { lclsource = LCLScanSource (); lclfatalerror (tok, message ("Unexpected line in imported file %s: %s", name, cstring_fromChars (bufptr))); } /* read in the imported info */ oldexporting = sort_setExporting (TRUE); map = mapping_create (); /* tok for error line numbering */ if (!compressedFormat) { sort_import (imported, tok, map); } (void) sort_setExporting (oldexporting); /* sort_import updates a mapping of old anonymous sorts to new anonymous sort that is needed in symtable_import */ /* mapping_print (map); */ if (!compressedFormat) { symtable_import (imported, tok, map); } else { /* symtable_loadImport (imported, tok, map); */ } check (inputStream_close (imported)); inputStream_free (imported); mapping_free (map); cstring_free (name); cstring_free (path); context_leaveImport (); } splint-3.1.2.dfsg1/src/lslinit.c0000644021234200000250000011327007646432515014074 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lslinit.c ** ** Processor for Larch Shared Language Init Files */ # include "splintMacros.nf" # include "basic.h" # include "signature.h" # include "signature2.h" # include "scan.h" # include "scanline.h" # include "tokentable.h" # include "syntable.h" # include "lslinit.h" # include "lclinit.h" # include "lclscan.h" # include "lclscanline.h" # include "lclsyntable.h" # include "lcltokentable.h" /* needed to parse init files */ # include "shift.h" #if TRACING == 1 /*@notfunction@*/ # define LTRACE(rule) printf ("Reducing: %s\n", rule) #else /*@notfunction@*/ # define LTRACE(rule) #endif static void LocalUserError (ltoken p_t, /*@temp@*/ char *p_msg) /*@modifies *g_warningstream@*/; static /*@only@*/ ltoken nextToken; static /*@only@*/ /*@null@*/ inputStream s_initFile = inputStream_undefined; static void InitFile (void) /*@modifies nextToken@*/ ; static void InitLines (void) /*@modifies nextToken@*/ ; static void InitLine (void) /*@modifies nextToken@*/ ; static void Classification (void) /*@modifies nextToken@*/ ; static void CharClass (void) /*@modifies nextToken@*/ ; static void EndCommentChars (void) /*@modifies nextToken@*/ ; static void IdChars (void) /*@modifies nextToken@*/ ; static void OpChars (void) /*@modifies nextToken@*/ ; static void ExtensionChar (void) /*@modifies nextToken@*/ ; static void SingChars (void) /*@modifies nextToken@*/ ; static void WhiteChars (void) /*@modifies nextToken@*/ ; static void EndCommentChar (void) /*@modifies nextToken@*/ ; static void IdChar (void) /*@modifies nextToken@*/ ; static void OpChar (void) /*@modifies nextToken@*/ ; static void SingChar (void) /*@modifies nextToken@*/ ; static void WhiteChar (void) /*@modifies nextToken@*/ ; static void TokenClass (void) /*@modifies nextToken@*/ ; static void QuantifierSymToks (void) /*@modifies nextToken@*/ ; static void LogicalOpToks (void) /*@modifies nextToken@*/ ; static void EqOpToks (void) /*@modifies nextToken@*/ ; static void EquationSymToks (void) /*@modifies nextToken@*/ ; static void EqSepSymToks (void) /*@modifies nextToken@*/ ; static void SelectSymToks (void) /*@modifies nextToken@*/ ; static void OpenSymToks (void) /*@modifies nextToken@*/ ; static void SepSymToks (void) /*@modifies nextToken@*/ ; static void CloseSymToks (void) /*@modifies nextToken@*/ ; static void SimpleIdToks (void) /*@modifies nextToken@*/ ; static void MapSymToks (void) /*@modifies nextToken@*/ ; static void MarkerSymToks (void) /*@modifies nextToken@*/ ; static void CommentSymToks (void) /*@modifies nextToken@*/ ; static void QuantifierSymTok (void) /*@modifies nextToken@*/ ; static void LogicalOpTok (void) /*@modifies nextToken@*/ ; static void EqOpTok (void) /*@modifies nextToken@*/ ; static void EquationSymTok (void) /*@modifies nextToken@*/ ; static void EqSepSymTok (void) /*@modifies nextToken@*/ ; static void SelectSymTok (void) /*@modifies nextToken@*/ ; static void OpenSymTok (void) /*@modifies nextToken@*/ ; static void SepSymTok (void) /*@modifies nextToken@*/ ; static void CloseSymTok (void) /*@modifies nextToken@*/ ; static void SimpleIdTok (void) /*@modifies nextToken@*/ ; static void MapSymTok (void) /*@modifies nextToken@*/ ; static void MarkerSymTok (void) /*@modifies nextToken@*/ ; static void CommentSymTok (void) /*@modifies nextToken@*/ ; static void SynClass (void) /*@modifies nextToken@*/ ; static void OldToken (void) /*@modifies nextToken@*/ ; static void NewToken (void) /*@modifies nextToken@*/ ; static void Token (void) /*@modifies nextToken@*/ ; static void InitReduce (LSLInitRuleCode p_rule) /*@modifies nextToken@*/ ; static void UpdateXCharKeywords (charCode) /*@modifies nextToken@*/ ; static void ProcessExtensionChar (void) /*@modifies nextToken@*/ ; static void ProcessEndCommentChar (void) /*@modifies nextToken@*/ ; static void ProcessSingleChar (charCode p_code) /*@modifies nextToken@*/ ; static void ProcessToken (ltokenCode p_code) /*@modifies nextToken@*/ ; static void ProcessSynonym (void) /*@modifies nextToken@*/ ; /* If TRUE character has been redefined as a singleChar. */ static bool defineSingleChar[LASTCHAR + 1]; static charCode currentExtensionChar; /* LSL init file keyword tokens. */ static /*@dependent@*/ ltoken endCommentCharToken; static /*@dependent@*/ ltoken idCharToken; static /*@dependent@*/ ltoken opCharToken; static /*@dependent@*/ ltoken extensionCharToken; static /*@dependent@*/ ltoken singleCharToken; static /*@dependent@*/ ltoken whiteCharToken; static /*@dependent@*/ ltoken quantifierSymToken; static /*@dependent@*/ ltoken logicalOpToken; static /*@dependent@*/ ltoken eqOpToken; static /*@dependent@*/ ltoken equationSymToken; static /*@dependent@*/ ltoken eqSepSymToken; static /*@dependent@*/ ltoken selectSymToken; static /*@dependent@*/ ltoken openSymToken; static /*@dependent@*/ ltoken sepSymToken; static /*@dependent@*/ ltoken closeSymToken; static /*@dependent@*/ ltoken simpleIdToken; static /*@dependent@*/ ltoken mapSymToken; static /*@dependent@*/ ltoken markerSymToken; static /*@dependent@*/ ltoken commentSymToken; static /*@dependent@*/ ltoken synonymToken; static bool hasFirstChar (ltoken tok) { return (ltoken_isChar (tok) && lscanCharClass (cstring_firstChar (ltoken_unparse (tok))) == SINGLECHAR); } void lslinit_setInitFile (inputStream s) { llassert (inputStream_isUndefined (s_initFile)); s_initFile = s; } /* ** ** Parsing functions for init file processing, in the same order as the ** grammar file lslinit.cfg. This is top-down order, as much as possible. ** */ static void lslinit_processInitFile (void) { InitLines (); InitReduce (INITFILE1); if (ltoken_getCode (nextToken) != LEOFTOKEN) { LocalUserError (nextToken, "unexpected tokens after end-of-file"); } } static void InitLines (void) { InitReduce (INITLINES1); if (ltoken_getCode (nextToken) != LEOFTOKEN) { InitLine (); InitReduce (INITLINES2); } while (ltoken_getCode (nextToken) != LEOFTOKEN) { InitLine (); InitReduce (INITLINES3); } } static void InitLine (void) { if (ltoken_getCode (nextToken) == LST_EOL) { /* Nothing on line. */ InitReduce (INITLINE1); } else { Classification (); InitReduce (INITLINE2); } if (ltoken_getCode (nextToken) != LST_EOL) { LocalUserError (nextToken, "Unexpected tokens on line"); } ltoken_free (nextToken); nextToken = LSLScanNextToken (); } static void Classification (void) { if (ltoken_getRawText (nextToken) == ltoken_getText (endCommentCharToken) || ltoken_getRawText (nextToken) == ltoken_getText (idCharToken) || ltoken_getRawText (nextToken) == ltoken_getText (opCharToken) || ltoken_getRawText (nextToken) == ltoken_getText (extensionCharToken) || ltoken_getRawText (nextToken) == ltoken_getText (singleCharToken) || ltoken_getRawText (nextToken) == ltoken_getText (whiteCharToken)) { CharClass (); InitReduce (CLASSIFICATION1); } else if (ltoken_getRawText (nextToken) == ltoken_getText (quantifierSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (logicalOpToken) || ltoken_getRawText (nextToken) == ltoken_getText (eqOpToken) || ltoken_getRawText (nextToken) == ltoken_getText (equationSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (eqSepSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (selectSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (openSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (sepSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (closeSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (simpleIdToken) || ltoken_getRawText (nextToken) == ltoken_getText (mapSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (markerSymToken) || ltoken_getRawText (nextToken) == ltoken_getText (commentSymToken)) { TokenClass (); InitReduce (CLASSIFICATION2); } else if (ltoken_getRawText (nextToken) == ltoken_getText (synonymToken)) { SynClass (); InitReduce (CLASSIFICATION3); } else { LocalUserError (nextToken, "expected character, token, or synonym classification"); } } static void CharClass (void) { ltoken charClassToken; charClassToken = nextToken; nextToken = LSLScanNextToken (); /* Discard char class keyword. */ if (ltoken_getRawText (charClassToken) == ltoken_getText (endCommentCharToken)) { EndCommentChars (); InitReduce (CHARCLASS1); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (idCharToken)) { IdChars (); InitReduce (CHARCLASS2); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (opCharToken)) { OpChars (); InitReduce (CHARCLASS3); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (extensionCharToken)) { ExtensionChar (); InitReduce (CHARCLASS4); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (singleCharToken)) { SingChars (); InitReduce (CHARCLASS5); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (whiteCharToken)) { WhiteChars (); InitReduce (CHARCLASS6); } else { LocalUserError (nextToken, "expected character classification"); } ltoken_free (charClassToken); } static void EndCommentChars (void) { EndCommentChar (); InitReduce (LRC_ENDCOMMENT1); while (ltoken_getCode (nextToken) != LST_EOL) { EndCommentChar (); InitReduce (LRC_ENDCOMMENT2); } } static void IdChars (void) { IdChar (); InitReduce (IDCHARS1); while (ltoken_getCode (nextToken) != LST_EOL) { IdChar (); InitReduce (IDCHARS2); } } static void OpChars (void) { OpChar (); InitReduce (OPCHARS1); while (ltoken_getCode (nextToken) != LST_EOL) { OpChar (); InitReduce (OPCHARS2); } } static void ExtensionChar (void) { if (ltoken_isChar (nextToken) && lscanCharClass (cstring_firstChar (ltoken_unparse (nextToken))) == SINGLECHAR) { LSLGenShiftOnly (nextToken); nextToken = LSLScanNextToken (); InitReduce (LRC_EXTENSIONCHAR1); } else { LocalUserError (nextToken, "expected only one character"); } } static void SingChars (void) { SingChar (); InitReduce (SINGCHARS1); while (ltoken_getCode (nextToken) != LST_EOL) { SingChar (); InitReduce (SINGCHARS2); } } static void WhiteChars (void) { WhiteChar (); InitReduce (WHITECHARS1); while (ltoken_getCode (nextToken) != LST_EOL) { WhiteChar (); InitReduce (WHITECHARS2); } } static void EndCommentChar (void) { if (ltoken_isChar (nextToken)) { LSLGenShiftOnly (nextToken); nextToken = LSLScanNextToken (); InitReduce (LRC_ENDCOMMENTCHAR1); } else { LocalUserError (nextToken, "expected only one character"); } } static void IdChar (void) { if (hasFirstChar (nextToken)) { LSLGenShiftOnly (nextToken); nextToken = LSLScanNextToken (); InitReduce (IDCHAR1); } else { LocalUserError (nextToken, "character is already defined, cannot redefine"); } } static void OpChar (void) { if (hasFirstChar (nextToken)) { LSLGenShiftOnly (nextToken); nextToken = LSLScanNextToken (); InitReduce (OPCHAR1); } else { LocalUserError (nextToken, "character is already defined, cannot redefine"); } } static void SingChar (void) { if (hasFirstChar (nextToken)) { LSLGenShiftOnly (nextToken); nextToken = LSLScanNextToken (); InitReduce (SINGCHAR1); } else { LocalUserError (nextToken, "character is already defined, cannot redefine"); } } static void WhiteChar (void) { if (hasFirstChar (nextToken)) { LSLGenShiftOnly (nextToken); nextToken = LSLScanNextToken (); InitReduce (WHITECHAR1); } else { LocalUserError (nextToken, "character is already defined, cannot redefine"); } } static void TokenClass (void) { ltoken tokenClassToken; tokenClassToken = nextToken; nextToken = LSLScanNextToken (); if (ltoken_getRawText (tokenClassToken) == ltoken_getText (quantifierSymToken)) { QuantifierSymToks (); InitReduce (TOKENCLASS1); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (logicalOpToken)) { LogicalOpToks (); InitReduce (TOKENCLASS2); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (eqOpToken)) { EqOpToks (); InitReduce (TOKENCLASS3); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (equationSymToken)) { EquationSymToks (); InitReduce (TOKENCLASS4); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (eqSepSymToken)) { EqSepSymToks (); InitReduce (TOKENCLASS5); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (selectSymToken)) { SelectSymToks (); InitReduce (TOKENCLASS6); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (openSymToken)) { OpenSymToks (); InitReduce (TOKENCLASS7); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (sepSymToken)) { SepSymToks (); InitReduce (TOKENCLASS8); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (closeSymToken)) { CloseSymToks (); InitReduce (TOKENCLASS9); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (simpleIdToken)) { SimpleIdToks (); InitReduce (TOKENCLASS10); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (mapSymToken)) { MapSymToks (); InitReduce (TOKENCLASS11); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (markerSymToken)) { MarkerSymToks (); InitReduce (TOKENCLASS12); } else if (ltoken_getRawText (tokenClassToken) == ltoken_getText (commentSymToken)) { CommentSymToks (); InitReduce (TOKENCLASS13); } else { LocalUserError (nextToken, "expected token classification"); } ltoken_free (tokenClassToken); } static void QuantifierSymToks (void) { QuantifierSymTok (); InitReduce (QUANTIFIERSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { QuantifierSymTok (); InitReduce (QUANTIFIERSYMTOKS2); } } static void LogicalOpToks (void) { LogicalOpTok (); InitReduce (LOGICALOPTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { LogicalOpTok (); InitReduce (LOGICALOPTOKS2); } } static void EqOpToks (void) { EqOpTok (); InitReduce (LRC_EQOPTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { EqOpTok (); InitReduce (LRC_EQOPTOKS2); } } static void EquationSymToks (void) { EquationSymTok (); InitReduce (LRC_EQUATIONSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { EquationSymTok (); InitReduce (LRC_EQUATIONSYMTOKS2); } } static void EqSepSymToks (void) { EqSepSymTok (); InitReduce (LRC_EQSEPSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { EqSepSymTok (); InitReduce (LRC_EQSEPSYMTOKS2); } } static void SelectSymToks (void) { SelectSymTok (); InitReduce (SELECTSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { SelectSymTok (); InitReduce (SELECTSYMTOKS2); } } static void OpenSymToks (void) { OpenSymTok (); InitReduce (OPENSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { OpenSymTok (); InitReduce (OPENSYMTOKS2); } } static void SepSymToks (void) { SepSymTok (); InitReduce (SEPSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { SepSymTok (); InitReduce (SEPSYMTOKS2); } } static void CloseSymToks (void) { CloseSymTok (); InitReduce (CLOSESYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { CloseSymTok (); InitReduce (CLOSESYMTOKS2); } } static void SimpleIdToks (void) { SimpleIdTok (); InitReduce (SIMPLEIDTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { SimpleIdTok (); InitReduce (SIMPLEIDTOKS2); } } static void MapSymToks (void) { MapSymTok (); InitReduce (MAPSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { MapSymTok (); InitReduce (MAPSYMTOKS2); } } static void MarkerSymToks (void) { MarkerSymTok (); InitReduce (MARKERSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { MarkerSymTok (); InitReduce (MARKERSYMTOKS2); } } static void CommentSymToks (void) { CommentSymTok (); InitReduce (COMMENTSYMTOKS1); while (ltoken_getCode (nextToken) != LST_EOL) { CommentSymTok (); InitReduce (COMMENTSYMTOKS2); } } static void QuantifierSymTok (void) { Token (); InitReduce (QUANTIFIERSYMTOK1); } static void LogicalOpTok (void) { Token (); InitReduce (LOGICALOPTOK1); } static void EqOpTok (void) { Token (); InitReduce (LRC_EQOPTOK1); } static void EquationSymTok (void) { /* ### EquationSymTok (); ### */ Token (); InitReduce (LRC_EQUATIONSYMTOK1); } static void EqSepSymTok (void) { Token (); InitReduce (LRC_EQSEPSYMTOK1); } static void SelectSymTok (void) { Token (); InitReduce (SELECTSYMTOK1); } static void OpenSymTok (void) { Token (); InitReduce (OPENSYMTOK1); } static void SepSymTok (void) { Token (); InitReduce (SEPSYMTOK1); } static void CloseSymTok (void) { Token (); InitReduce (CLOSESYMTOK1); } static void SimpleIdTok (void) { Token (); InitReduce (SIMPLEIDTOK1); } static void MapSymTok (void) { Token (); InitReduce (MAPSYMTOK1); } static void MarkerSymTok (void) { Token (); InitReduce (MARKERSYMTOK1); } static void CommentSymTok (void) { Token (); InitReduce (COMMENTSYMTOK1); } static void SynClass (void) { if (ltoken_getRawText (nextToken) == ltoken_getText (synonymToken)) { ltoken_free (nextToken); nextToken = LSLScanNextToken (); OldToken (); NewToken (); InitReduce (SYNCLASS1); } else { LocalUserError (nextToken, "expected synonym classification"); } } static void OldToken (void) { Token (); InitReduce (OLDTOKEN1); } static void NewToken (void) { Token (); InitReduce (NEWTOKEN1); } static void Token (void) { if (ltoken_getCode (nextToken) == LST_EOL || ltoken_getCode (nextToken) == LEOFTOKEN) { LocalUserError (nextToken, "unexpected end-of-line or end-of-file"); } else { LSLGenShiftOnly (nextToken); nextToken = LSLScanNextToken (); } } /* ** Init File Processing Routines, these routines use the shift-reduce sequence ** produced by the init file parser and update the necessary tables for the ** scanner. ** ** The same shift stack is used that LSL parser uses. A different reduce ** procedure is used because the init file grammar is different from the LSL ** grammar. ** */ static void InitReduce (LSLInitRuleCode rule) { switch (rule) { case INITFILE1: LTRACE ("INITFILE1"); break; case INITLINES1: LTRACE ("INITLINES1"); break; case INITLINES2: LTRACE ("INITLINES2"); break; case INITLINES3: LTRACE ("INITLINES3"); break; case INITLINE1: LTRACE ("INITLINE1"); break; case INITLINE2: LTRACE ("INITLINE2"); break; case CLASSIFICATION1: LTRACE ("CLASSIFICATION1"); break; case CLASSIFICATION2: LTRACE ("CLASSIFICATION2"); break; case CLASSIFICATION3: LTRACE ("CLASSIFICATION3"); break; case CHARCLASS1: LTRACE ("CHARCLASS1"); break; case CHARCLASS2: LTRACE ("CHARCLASS2"); break; case CHARCLASS3: LTRACE ("CHARCLASS3"); break; case CHARCLASS4: LTRACE ("CHARCLASS4"); break; case CHARCLASS5: LTRACE ("CHARCLASS5"); break; case CHARCLASS6: LTRACE ("CHARCLASS6"); break; case LRC_ENDCOMMENT1: LTRACE ("LRC_ENDCOMMENT1"); break; case LRC_ENDCOMMENT2: LTRACE ("LRC_ENDCOMMENT2"); break; case IDCHARS1: LTRACE ("IDCHARS1"); break; case IDCHARS2: LTRACE ("IDCHARS2"); break; case OPCHARS1: LTRACE ("OPCHARS1"); break; case OPCHARS2: LTRACE ("OPCHARS2"); break; case LRC_EXTENSIONCHAR1: LTRACE ("LRC_EXTENSIONCHAR1"); ProcessExtensionChar (); break; case SINGCHARS1: LTRACE ("SINGCHARS1"); break; case SINGCHARS2: LTRACE ("SINGCHARS2"); break; case WHITECHARS1: LTRACE ("WHITECHARS1"); break; case WHITECHARS2: LTRACE ("WHITECHARS2"); break; case LRC_ENDCOMMENTCHAR1: LTRACE ("LRC_ENDCOMMENTCHAR1"); ProcessEndCommentChar (); break; case IDCHAR1: LTRACE ("IDCHAR1"); ProcessSingleChar (IDCHAR); break; case OPCHAR1: LTRACE ("OPCHAR1"); ProcessSingleChar (OPCHAR); break; case SINGCHAR1: LTRACE ("SINGCHAR1"); ProcessSingleChar (SINGLECHAR); break; case WHITECHAR1: LTRACE ("CHAR1"); ProcessSingleChar (WHITECHAR); break; case TOKENCLASS1: LTRACE ("TOKENCLASS1"); break; case TOKENCLASS2: LTRACE ("TOKENCLASS2"); break; case TOKENCLASS3: LTRACE ("TOKENCLASS3"); break; case TOKENCLASS4: LTRACE ("TOKENCLASS4"); break; case TOKENCLASS5: LTRACE ("TOKENCLASS5"); break; case TOKENCLASS6: LTRACE ("TOKENCLASS6"); break; case TOKENCLASS7: LTRACE ("TOKENCLASS7"); break; case TOKENCLASS8: LTRACE ("TOKENCLASS8"); break; case TOKENCLASS9: LTRACE ("TOKENCLASS9"); break; case TOKENCLASS10: LTRACE ("TOKENCLASS10"); break; case TOKENCLASS11: LTRACE ("TOKENCLASS11"); break; case TOKENCLASS12: LTRACE ("TOKENCLASS12"); break; case TOKENCLASS13: LTRACE ("TOKENCLASS13"); break; case QUANTIFIERSYMTOKS1: LTRACE ("QUALIFERSYMTOKS1"); break; case QUANTIFIERSYMTOKS2: LTRACE ("QUANTIFIERSYMTOKS2"); break; case LOGICALOPTOKS1: LTRACE ("LOGICALOPTOKS1"); break; case LOGICALOPTOKS2: LTRACE ("LOGICALOPTOKS2"); break; case LRC_EQOPTOKS1: LTRACE ("LRC_EQOPTOKS1"); break; case LRC_EQOPTOKS2: LTRACE ("LRC_EQOPTOKS2"); break; case LRC_EQUATIONSYMTOKS1: LTRACE ("LRC_EQUATIONSYMTOKS1"); break; case LRC_EQUATIONSYMTOKS2: LTRACE ("LRC_EQUATIONSYMTOKS2"); break; case LRC_EQSEPSYMTOKS1: LTRACE ("LRC_EQSEPSYMTOKS1"); break; case LRC_EQSEPSYMTOKS2: LTRACE ("LRC_EQSEPSYMTOKS2"); break; case SELECTSYMTOKS1: LTRACE ("SELECTSYMTOKS1"); break; case SELECTSYMTOKS2: LTRACE ("SELECTSYMTOKS2"); break; case OPENSYMTOKS1: LTRACE ("OPENSYMTOKS1"); break; case OPENSYMTOKS2: LTRACE ("OPENSYMTOKS2"); break; case SEPSYMTOKS1: LTRACE ("SEPSYMTOKS1"); break; case SEPSYMTOKS2: LTRACE ("SEPSYMTOKS2"); break; case CLOSESYMTOKS1: LTRACE ("CLOSESYMTOKS1"); break; case CLOSESYMTOKS2: LTRACE ("CLOSESYMTOKS2"); break; case SIMPLEIDTOKS1: LTRACE ("SIMPLEIDTOKS1"); break; case SIMPLEIDTOKS2: LTRACE ("SIMPLEIDTOKS2"); break; case MAPSYMTOKS1: LTRACE ("MAPSYMTOKS1"); break; case MAPSYMTOKS2: LTRACE ("MAPSYMTOKS2"); break; case MARKERSYMTOKS1: LTRACE ("MARKERSYMTOKS1"); break; case MARKERSYMTOKS2: LTRACE ("MARKERSYMTOKS2"); break; case COMMENTSYMTOKS1: LTRACE ("COMMENTSYMTOKS1"); break; case COMMENTSYMTOKS2: LTRACE ("COMMENTSYMTOKS2"); break; case QUANTIFIERSYMTOK1: LTRACE ("QUANTIFERSYMTOK1"); ProcessToken (LST_QUANTIFIERSYM); break; case LOGICALOPTOK1: LTRACE ("LOGICALOPTOK1"); ProcessToken (LST_LOGICALOP); break; case LRC_EQOPTOK1: LTRACE ("LRC_EQOPTOK1"); ProcessToken (LST_EQOP); break; case LRC_EQUATIONSYMTOK1: LTRACE ("LRC_EQUATIONSYMTOK1"); ProcessToken (LST_EQUATIONSYM); break; case LRC_EQSEPSYMTOK1: LTRACE ("LRC_EQSEPSYMTOK1"); ProcessToken (LST_EQSEPSYM); break; case SELECTSYMTOK1: LTRACE ("SELECTSYMTOK1"); ProcessToken (LST_SELECTSYM); break; case OPENSYMTOK1: LTRACE ("OPENSYMTOK1"); ProcessToken (LST_OPENSYM); break; case SEPSYMTOK1: LTRACE ("SEPSYMTOK1"); ProcessToken (LST_SEPSYM); break; case CLOSESYMTOK1: LTRACE ("CLOSESYMTOK1"); ProcessToken (LST_CLOSESYM); break; case SIMPLEIDTOK1: LTRACE ("SIMPLEIDTOK1"); ProcessToken (LST_SIMPLEID); break; case MAPSYMTOK1: LTRACE ("MAPSYMTOK1"); ProcessToken (LST_MAPSYM); break; case MARKERSYMTOK1: LTRACE ("MARKERSYMTOK1"); ProcessToken (LST_MARKERSYM); break; case COMMENTSYMTOK1: LTRACE ("COMMENTSYMTOK1"); ProcessToken (LST_COMMENTSYM); break; case SYNCLASS1: LTRACE ("SYNCLASS1"); ProcessSynonym (); break; case OLDTOKEN1: LTRACE ("OLDTOKEN1"); break; case NEWTOKEN1: LTRACE ("NEWTOKEN1"); break; default: llcontbuglit ("InitReduce: bad switch"); break; } /* end switch */ } /* end InitReduce () */ /* Reset the first character of the predefined extensionChar keywords when */ /* the extensionChar changes. e.g. "extensionChar @" changes "forall" to */ /* "@forall". */ static void UpdateXCharKeywords (charCode xCharCode) { char xChar = (char) xCharCode; char *str; str = ltoken_getTextChars (ltoken_forall); *str = xChar; str = ltoken_getTextChars (ltoken_and); *str = xChar; str = ltoken_getTextChars (ltoken_or); *str = xChar; str = ltoken_getTextChars (ltoken_implies); *str = xChar; str = ltoken_getTextChars (ltoken_eq); *str = xChar; str = ltoken_getTextChars (ltoken_neq); *str = xChar; str = ltoken_getTextChars (ltoken_equals); *str = xChar; str = ltoken_getTextChars (ltoken_eqsep); *str = xChar; str = ltoken_getTextChars (ltoken_select); *str = xChar; str = ltoken_getTextChars (ltoken_open); *str = xChar; str = ltoken_getTextChars (ltoken_sep); *str = xChar; str = ltoken_getTextChars (ltoken_close); *str = xChar; str = ltoken_getTextChars (ltoken_id); *str = xChar; str = ltoken_getTextChars (ltoken_arrow); *str = xChar; str = ltoken_getTextChars (ltoken_marker); *str = xChar; str = ltoken_getTextChars (ltoken_comment); *str = xChar; } /* Different from ProcessCharClass because only allow one extension */ /* character. Therefore, the present extension character must be set to a */ /* singleChar. */ static void ProcessExtensionChar (void) { ltoken stackToken = LSLGenTopPopShiftStack (); char firstChar = cstring_firstChar (ltoken_unparse (stackToken)); if (!defineSingleChar[(int)firstChar] && lscanCharClass (firstChar) == SINGLECHAR) { /* Is a single character that has not been defined before. */ /* Can only have one extension char. Release old one. */ lsetCharClass (firstChar, CHC_EXTENSION); /* this is a (bogus) type bug! caught by splint */ /* lsetCharClass (currentExtensionChar, SINGLECHAR); */ lsetCharClass ((char) currentExtensionChar, SINGLECHAR); currentExtensionChar = (charCode) firstChar; UpdateXCharKeywords (currentExtensionChar); } else { /* Already redefined. Don't allow to be redefined. */ LocalUserError (stackToken, "character is already defined, cannot redefine"); } ltoken_free (stackToken); } /* Different from ProcessSingleChar because allow any characters to be */ /* endCommentChar and also set a different part of the scanner structure. */ static void ProcessEndCommentChar (void) { ltoken stackToken = LSLGenTopPopShiftStack (); char firstChar = cstring_firstChar (ltoken_unparse (stackToken)); if (LSLIsEndComment (firstChar)) { LocalUserError (stackToken, "already defined as a endCommentChar, cannot redefine"); } else { lsetEndCommentChar (firstChar, TRUE); } ltoken_free (stackToken); } static void ProcessSingleChar (charCode code) { ltoken stackToken = LSLGenTopPopShiftStack (); char firstChar = cstring_firstChar (ltoken_unparse (stackToken)); if (!defineSingleChar[(int)firstChar] && lscanCharClass (firstChar) == SINGLECHAR) { /* Is a single character that has not been defined before. */ /* It's OK to redefine once. */ lsetCharClass (firstChar, code); /* OK to mark as a defined singleChar even if not. Only check */ /* defineSingleChar[] if defining a singleChar. */ defineSingleChar[(int)firstChar] = TRUE; } else { LocalUserError (stackToken, "character is already defined, cannot redefine"); } ltoken_free (stackToken); } static void ProcessToken (ltokenCode code) { ltoken stackToken, temp; lsymbol sym; stackToken = LSLGenTopPopShiftStack (); sym = ltoken_getText (stackToken); if (LSLIsSyn (sym)) { LocalUserError (stackToken, "already defined as a synonym, cannot redefine"); } /* Get the token from the token table, so can check if the token */ /* was updated by a previous token. */ temp = LSLGetToken (sym); if (ltoken_isStateDefined (temp)) { if ((code == LST_OPENSYM && sym == lsymbol_fromChars ("[")) || (code == LST_CLOSESYM && sym == lsymbol_fromChars ("]"))) { /* ignore "openSym [" and "closeSym ]" TokenClass */ ltoken_free (stackToken); return; } else { LocalUserError (stackToken, "already defined, cannot redefine"); PrintToken (temp); } } LSLUpdateToken (code, ltoken_getText (stackToken), TRUE); ltoken_free (stackToken); } static void ProcessSynonym (void) { ltoken newtok; ltoken oldtok; newtok = LSLGenTopPopShiftStack (); oldtok = LSLGenTopPopShiftStack (); if (ltoken_wasSyn (newtok)) { /* The token has a synonym. This means that the synonym was in the */ /* init file, so complain about redefining as a synonym again */ LocalUserError (newtok, "newtok already is a synonym, cannot redefine"); } if (ltoken_hasSyn (newtok)) { /* ** newtok already has a synonym defined for it. Do not allow ** synonyms to be chained. */ LocalUserError (newtok, "newtok already has a synonym, cannot chain synonyms"); } if (ltoken_isStateDefined (newtok)) { LocalUserError (newtok, "newtok already defined, cannot redefine"); } LSLAddSyn (ltoken_getText (newtok), ltoken_getText (oldtok)); ltoken_free (oldtok); ltoken_free (newtok); } /* * Utilities, in alphabetical order */ static void LocalUserError (ltoken t, /*@temp@*/ char *msg) { lldiagmsg (message ("%s %s in the LSL init file:", ltoken_unparse (t), cstring_fromChars (msg))); ltoken_free (nextToken); nextToken = LSLScanNextToken (); while (ltoken_getCode (nextToken) != LST_EOL) { ltoken_free (nextToken); nextToken = LSLScanNextToken (); } } /* ** Required initialization and cleanup routines */ static /*@exposed@*/ ltoken insertSimpleToken (char *text) /*@modifies internalState@*/ { return (LSLInsertToken (LST_SIMPLEID, lsymbol_fromChars (text), 0, FALSE)); } static void lslinit_initProcessInitFile (void) { int i; LSLGenInit (TRUE); /* parsing LSLinit not LCLinit */ /* ** Insert the init file keywords into the token table as undefined ** SIMPLEIDs. They are defined as simpleIds since they must be treated ** that way if they do not appear as the first token on a line, and ** they must be treated that way for the actual LSL parsing. Save the ** tokens so can recognize as init file keywords when necessary. */ endCommentCharToken = insertSimpleToken ("endCommentChar"); idCharToken = insertSimpleToken ("idChar"); opCharToken = insertSimpleToken ("opChar"); extensionCharToken = insertSimpleToken ("extensionChar"); singleCharToken = insertSimpleToken ("singleChar"); whiteCharToken = insertSimpleToken ("whiteChar"); quantifierSymToken = insertSimpleToken ("quantifierSym"); logicalOpToken = insertSimpleToken ("logicalOp"); eqOpToken = insertSimpleToken ("eqOp"); equationSymToken = insertSimpleToken ("equationSym"); eqSepSymToken = insertSimpleToken ("eqSepSym"); selectSymToken = insertSimpleToken ("selectSym"); openSymToken = insertSimpleToken ("openSym"); sepSymToken = insertSimpleToken ("sepSym"); closeSymToken = insertSimpleToken ("closeSym"); simpleIdToken = insertSimpleToken ("simpleId"); mapSymToken = insertSimpleToken ("mapSym"); markerSymToken = insertSimpleToken ("markerSym"); commentSymToken = insertSimpleToken ("commentSym"); synonymToken = insertSimpleToken ("synonym"); for (i = 0; i <= LASTCHAR; i++) { defineSingleChar[i] = FALSE; } /* ** Record the current extension character so can redefine back to ** singleChar if a new extension character is redefined. */ currentExtensionChar = (charCode) CHAREXTENDER; LSLReportEolTokens (TRUE); ltoken_free (nextToken); nextToken = LSLScanNextToken (); } void lslinit_process (void) /*@globals undef g_symtab; @*/ /*@modifies g_symtab, internalState, fileSystem; @*/ { /* ** Open init file provided by user, or use the default LCL init file */ cstring larchpath = context_getLarchPath (); inputStream initstream = inputStream_undefined; setCodePoint (); if (inputStream_isUndefined (s_initFile)) { s_initFile = inputStream_create (cstring_makeLiteral (INITFILENAME), cstring_makeLiteralTemp (LCLINIT_SUFFIX), FALSE); if (!inputStream_getPath (larchpath, s_initFile)) { lldiagmsg (message ("Continuing without LCL init file: %s", inputStream_fileName (s_initFile))); } else { if (!inputStream_open (s_initFile)) { lldiagmsg (message ("Continuing without LCL init file: %s", inputStream_fileName (s_initFile))); } } } else { if (!inputStream_open (s_initFile)) { lldiagmsg (message ("Continuing without LCL init file: %s", inputStream_fileName (s_initFile))); } } /* Initialize checker */ lsymbol_initMod (); LCLSynTableInit (); setCodePoint (); LCLSynTableReset (); LCLTokenTableInit (); setCodePoint (); LCLScanLineInit (); setCodePoint (); LCLScanLineReset (); setCodePoint (); LCLScanInit (); setCodePoint (); /* need this to initialize LCL checker */ llassert (inputStream_isDefined (s_initFile)); if (inputStream_isOpen (s_initFile)) { setCodePoint (); LCLScanReset (s_initFile); lclinit_initMod (); lclinit_reset (); setCodePoint (); lclinit_process (); lclinit_cleanup (); setCodePoint (); check (inputStream_close (s_initFile)); } /* Initialize LSL init files, for parsing LSL signatures from LSL */ initstream = inputStream_create (cstring_makeLiteral ("lslinit.lsi"), cstring_makeLiteralTemp (".lsi"), FALSE); if (!inputStream_getPath (larchpath, initstream)) { lldiagmsg (message ("Continuing without LSL init file: %s", inputStream_fileName (initstream))); } else { if (!inputStream_open (initstream)) { lldiagmsg (message ("Continuing without LSL init file: %s", inputStream_fileName (initstream))); } } setCodePoint (); lsynTableInit (); lsynTableReset (); setCodePoint (); ltokenTableInit (); setCodePoint (); lscanLineInit (); lscanLineReset (); LSLScanInit (); if (inputStream_isOpen (initstream)) { setCodePoint (); LSLScanReset (initstream); lslinit_initProcessInitFile (); lslinit_processInitFile (); check (inputStream_close (initstream)); } inputStream_free (initstream); if (lclHadError ()) { lclplainerror (cstring_makeLiteral ("LSL init file error. Attempting to continue.")); } setCodePoint (); g_symtab = symtable_new (); /* ** sort_init must come after symtab has been initialized */ sort_init (); abstract_init (); setCodePoint (); /* ** Equivalent to importing old spec_csupport.lcl ** define immutable LCL type "bool" and bool constants TRUE and FALSE ** and initialized them to be equal to LSL's "true" and "false". ** ** Reads in CTrait.syms (derived from CTrait.lsl) on LARCH_PATH. */ LCLBuiltins (); LCLReportEolTokens (FALSE); } splint-3.1.2.dfsg1/src/syntable.c0000644021234200000250000001121407630461221014217 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** syntable.c ** ** Larch shared language synonym table ** ** This table stores synonyms for the Larch Shared Language. It is ** essentially a array of token-handles indexed by string-handles. ** Therefore, synonyms (strings) can be converted to the actual token. ** ** AUTHORS: ** J.P. Wild */ # include "splintMacros.nf" # include "basic.h" # include "tokentable.h" # include "syntable.h" /*@+ignorequals@*/ typedef lsymbol *lsymbolTable; static /*@only@*/ /*@null@*/ lsymbolTable SynTable; static unsigned long int SynTableEntries; static void SynTable_grow (int p_size); /* **++ ** FUNCTION NAME: ** ** LSLAddSyn () ** ** FORMAL PARAMETERS: ** ** otok - token-handle for token associated with oldToken ** ntok - string-handle for the string to be a synonym with oldToken. ** ** RETURN VALUE: ** ** INVARIANTS: ** ** A context must be established. ** ** DESCRIPTION: ** ** This routine inserts a synonym into the synonym table. The synonym table ** is used to define synonyms in the form: ** ** synonym oldToken newToken ** ** The table associates the string for newToken with the token for oldToken. ** This table is used to find the the actual token (oldToken) from a synonym ** string (newToken). ** ** A new SynTable is allocated when: ** . The SynTable[] is empty (initial case) ** . The location where to insert the synonym is not in SynTable[] ** ** IMPLICIT INPUTS/OUTPUT: ** ** SynTable - (input/output) SynTable array ** ** EXCEPTIONS: ** A synonym already exists at the location where the it is to be added. ** **-- */ void LSLAddSyn (lsymbol ntok, lsymbol otok) { if (ntok >= SynTableEntries) /* was otok */ { SynTable_grow (otok); } llassert (SynTable != NULL); if (SynTable[ntok] == (lsymbol) 0) { /* Entry is empty. Fill it in. */ SynTable[ntok] = otok; LSLSetTokenHasSyn (otok, TRUE); /* Mark oldToken as having a synonym. */ } else { llbuglit ("LSLAddSyn: duplicate SynTable entry"); } } /*@exposed@*/ ltoken LSLGetTokenForSyn (lsymbol ntok) { llassert (SynTable != NULL); llassert (!(!((ntok < SynTableEntries) || (SynTable[ntok] != 0)))); return LSLGetToken (SynTable[ntok]); } bool LSLIsSyn (lsymbol str) { if (str < SynTableEntries) { llassert (SynTable != NULL); return (SynTable[str] != 0); } else { return FALSE; } } static void SynTable_grow (int size) { int oldSize; int i; lsymbolTable oldSynTable = SynTable; llassert (oldSynTable != NULL); oldSize = SynTableEntries; if (size <= oldSize) { llcontbuglit ("SynTable_grow: goal size is smaller than oldSize"); return; } if (size < (oldSize + SYNTABLE_BASESIZE)) { size = oldSize + SYNTABLE_BASESIZE; } SynTable = (lsymbolTable) dmalloc (size * sizeof (*SynTable)); SynTableEntries = size; for (i = 0; i < oldSize; i++) { SynTable[i] = oldSynTable[i]; } /* Zero out new allocated space. Need to detect when cells are empty */ /* and do this by checking that SynTable[x] == 0. */ /*@+loopexec@*/ for (i = oldSize; i < size; i++) { SynTable[i] = (lsymbol) 0; } /*@=loopexec@*/ sfree (oldSynTable); /*@-compdef@*/ } /*=compdef@*/ void lsynTableInit (void) /*@globals undef SynTable; @*/ { int i; SynTable = (lsymbolTable) dmalloc (sizeof (*SynTable) * SYNTABLE_BASESIZE); /*@+loopexec@*/ for (i = 0; i < SYNTABLE_BASESIZE; i++) { SynTable[i] = (lsymbol) 0; } /*@=loopexec@*/ SynTableEntries = SYNTABLE_BASESIZE; /*@-compdef@*/ } /*@=compdef@*/ void lsynTableReset (void) { } void lsynTableCleanup (void) { sfree (SynTable); SynTable = NULL; } splint-3.1.2.dfsg1/src/usymtab_interface.c0000644021234200000250000011040207650621405016105 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** usymtab_interface.c ** ** Grammar interface to symtab. ** ** The Splint parser will build symbol tables for abstract types and ** function declarations. ** */ # include "splintMacros.nf" # include "basic.h" # include "gram.h" # include "lclscan.h" # include "lclsyntable.h" # include "lslparse.h" # include "usymtab_interface.h" # include "structNames.h" static void declareFcnAux (fcnNode p_f, /*@only@*/ qtype p_qt, ctype p_ct, typeId p_tn, bool p_priv, bool p_spec); static uentryList paramNodeList_toUentryList (paramNodeList p_p); static /*@observer@*/ cstring getVarName (/*@null@*/ typeExpr p_x); static qtype convertLclTypeSpecNode (/*@null@*/ lclTypeSpecNode p_n); static ctype convertTypeExpr (ctype p_c, /*@null@*/ typeExpr p_x); static ctype convertCTypeExpr (ctype p_c, /*@null@*/ typeExpr p_x); static /*@exposed@*/ sRef fixTermNode (termNode p_n, fcnNode p_f, uentryList p_cl); static sRefSet fixModifies (fcnNode p_f, uentryList p_cl); static uentryList convertuentryList (stDeclNodeList x) { uentryList fl = uentryList_new (); stDeclNodeList_elements (x, i) { declaratorNodeList d = i->declarators; qtype q = convertLclTypeSpecNode (i->lcltypespec); declaratorNodeList_elements (d, j) { idDecl id; qtype_setType (q, convertTypeExpr (qtype_getType (q), j->type)); id = idDecl_create (cstring_copy (getVarName (j->type)), qtype_copy (q)); fl = uentryList_add (fl, uentry_makeIdVariable (id)); idDecl_free (id); } end_declaratorNodeList_elements; qtype_free (q); } end_stDeclNodeList_elements; return (fl); } static uentryList convert_uentryList (paramNodeList x) { uentryList p = uentryList_undefined; bool first_one = TRUE; paramNodeList_elements (x, i) { if (i != (paramNode) 0) { if (paramNode_isElipsis (i)) { first_one = FALSE; p = uentryList_add (p, uentry_makeElipsisMarker ()); } else { qtype q = convertLclTypeSpecNode (i->type); typeExpr t = i->paramdecl; qtype_setType (q, convertTypeExpr (qtype_getType (q), t)); /* note: has to be like this to hack around void ???? still */ if (first_one) { if (ctype_isVoid (qtype_getType (q))) { llassert (uentryList_isUndefined (p)); qtype_free (q); return (p); } first_one = FALSE; } /* ** don't do qualifiers here, will get errors later */ p = uentryList_add (p, uentry_makeUnnamedVariable (qtype_getType (q))); qtype_free (q); } } else { llbug (cstring_makeLiteral ("convertuentryList: null paramNode")); } } end_paramNodeList_elements; if (first_one) { llassert (uentryList_isUndefined (p)); p = uentryList_makeMissingParams (); } return p; } /* ** convertTypeExpr ** ** modify c with pointer, array, function ** ** (based on printTypeExpr2 from abstract.c) ** */ static ctype convertTypeExpr (ctype c, typeExpr x) { if (x == (typeExpr) 0) { return c; } switch (x->kind) { case TEXPR_BASE: return (c); case TEXPR_PTR: return (convertTypeExpr (ctype_makePointer (c), x->content.pointer)); case TEXPR_ARRAY: return (convertTypeExpr (ctype_makeArray (c), x->content.array.elementtype)); case TEXPR_FCN: { ctype rv = convertTypeExpr (c, x->content.function.returntype); uentryList p = paramNodeList_toUentryList (x->content.function.args); if (x->content.function.returntype != NULL && x->content.function.returntype->wrapped == 1 && ctype_isPointer (rv)) { rv = ctype_baseArrayPtr (rv); } return (ctype_makeParamsFunction (rv, p)); } default: { llfatalbug (message ("convertTypeExpr: unknown typeExprKind: %d", (int) x->kind)); } } BADEXIT; } static ctype convertCTypeExpr (ctype c, typeExpr x) { if (x == (typeExpr) 0) { return c; } switch (x->kind) { case TEXPR_BASE: return (c); case TEXPR_PTR: return (convertCTypeExpr (ctype_makePointer (c), x->content.pointer)); case TEXPR_ARRAY: return (convertCTypeExpr (ctype_makeArray (c), x->content.array.elementtype)); case TEXPR_FCN: { ctype rv = convertCTypeExpr (c, x->content.function.returntype); uentryList p = convert_uentryList (x->content.function.args); return (ctype_makeParamsFunction (rv, p)); } default: { llfatalbug (message ("convertCTypeExpr: unknown typeExprKind: %d", (int) x->kind)); } } BADEXIT; } /* ** convertLclTypeSpecNode ** ** LclTypeSpecNode --> ctype ** this is the base type only! */ /* ** convertLeaves ** ** for now, assume only last leaf is relevant. ** this should be a safe assumption in general??? */ static ctype convertLeaves (ltokenList f) { ctype c = ctype_unknown; ltokenList_reset (f); ltokenList_elements (f, current) { switch (ltoken_getCode (current)) { case LLT_TYPEDEF_NAME: { cstring tn = ltoken_getRawString (current); if (usymtab_existsTypeEither (tn)) { c = ctype_combine (uentry_getAbstractType (usymtab_lookupEither (tn)), c); } else if (cstring_equalLit (tn, "bool")) { /* ** Bogus...keep consistent with old lcl builtin. */ c = ctype_bool; } else { fileloc loc = fileloc_fromTok (current); voptgenerror (FLG_UNRECOG, message ("Unrecognized type: %s", tn), loc); fileloc_free (loc); usymtab_supEntry (uentry_makeDatatype (tn, ctype_unknown, MAYBE, qual_createConcrete (), fileloc_getBuiltin ())); } /*@switchbreak@*/ break; } case LLT_CHAR: c = ctype_combine (ctype_char, c); /*@switchbreak@*/ break; case LLT_DOUBLE: c = ctype_combine (ctype_double, c); /*@switchbreak@*/ break; case LLT_FLOAT: c = ctype_combine (ctype_float, c); /*@switchbreak@*/ break; case LLT_CONST: case LLT_VOLATILE: /*@switchbreak@*/ break; case LLT_INT: c = ctype_combine (ctype_int, c); /*@switchbreak@*/ break; case LLT_LONG: c = ctype_combine (c, ctype_lint); /*@switchbreak@*/ break; case LLT_SHORT: c = ctype_combine (c, ctype_sint); /*@switchbreak@*/ break; case LLT_SIGNED: c = ctype_combine (c, ctype_int); /*@switchbreak@*/ break; case LLT_UNSIGNED: c = ctype_combine (c, ctype_uint); /*@switchbreak@*/ break; case LLT_UNKNOWN: c = ctype_combine (ctype_unknown, c); /*@switchbreak@*/ break; case LLT_VOID: c = ctype_combine (ctype_void, c); /*@switchbreak@*/ break; case LLT_ENUM: llcontbug (cstring_makeLiteral ("convertLeaves: enum")); c = ctype_int; /*@switchbreak@*/ break; default: llfatalbug (message ("convertLeaves: bad token: %q", ltoken_unparseCodeName (current))); } } end_ltokenList_elements; return c; } static enumNameList convertEnumList (ltokenList enums) { enumNameList el = enumNameList_new (); if (ltokenList_isDefined (enums)) { ltokenList_elements (enums, i) { enumNameList_addh (el, enumName_create (cstring_copy (ltoken_unparse (i)))); } end_ltokenList_elements; } return el; } static /*@only@*/ qtype convertLclTypeSpecNode (/*@null@*/ lclTypeSpecNode n) { if (n != (lclTypeSpecNode) 0) { qtype result; switch (n->kind) { case LTS_CONJ: { qtype c1 = convertLclTypeSpecNode (n->content.conj->a); qtype c2 = convertLclTypeSpecNode (n->content.conj->b); /* ** Is it explicit? */ if (fileloc_isLib (g_currentloc) || fileloc_isStandardLibrary (g_currentloc)) { result = qtype_mergeImplicitAlt (c1, c2); } else { result = qtype_mergeAlt (c1, c2); } break; } case LTS_TYPE: llassert (n->content.type != NULL); result = qtype_create (convertLeaves (n->content.type->ctypes)); break; case LTS_STRUCTUNION: { strOrUnionNode sn; cstring cn = cstring_undefined; sn = n->content.structorunion; llassert (sn != (strOrUnionNode) 0); if (!ltoken_isUndefined (sn->opttagid)) { cn = cstring_copy (ltoken_getRawString (sn->opttagid)); } else { cn = fakeTag (); } switch (sn->kind) { case SU_STRUCT: if (usymtab_existsStructTag (cn)) { result = qtype_create (uentry_getAbstractType (usymtab_lookupStructTag (cn))); cstring_free (cn); } else { uentryList fl = convertuentryList (sn->structdecls); ctype ct; ct = ctype_createStruct (cstring_copy (cn), fl); /* ** If it was a forward declaration, this could add it to ** the table. Need to check if it exists again... */ if (usymtab_existsStructTag (cn)) { result = qtype_create (uentry_getAbstractType (usymtab_lookupStructTag (cn))); } else { fileloc loc = fileloc_fromTok (n->content.structorunion->tok); uentry ue = uentry_makeStructTag (cn, ct, loc); result = qtype_create (usymtab_supTypeEntry (ue)); } cstring_free (cn); } /*@switchbreak@*/ break; case SU_UNION: if (usymtab_existsUnionTag (cn)) { result = qtype_create (uentry_getAbstractType (usymtab_lookupUnionTag (cn))); cstring_free (cn); } else { uentryList fl; ctype ct; fl = convertuentryList (sn->structdecls); ct = ctype_createUnion (cstring_copy (cn), fl); /* ** If it was a forward declaration, this could add it to ** the table. Need to check if it exists again... */ if (usymtab_existsUnionTag (cn)) { result = qtype_create (uentry_getAbstractType (usymtab_lookupUnionTag (cn))); } else { fileloc loc = fileloc_fromTok (n->content.structorunion->tok); uentry ue = uentry_makeUnionTag (cn, ct, loc); result = qtype_create (usymtab_supTypeEntry (ue)); } cstring_free (cn); } /*@switchbreak@*/ break; BADDEFAULT } break; } case LTS_ENUM: { enumSpecNode e = n->content.enumspec; enumNameList el; cstring ename; bool first = TRUE; ctype ta; ctype cet; llassert (e != NULL); el = convertEnumList (e->enums); if (!ltoken_isUndefined (e->opttagid)) /* named enumerator */ { ename = cstring_copy (ltoken_getRawString (e->opttagid)); } else { ename = fakeTag (); } cet = ctype_createEnum (ename, el); if (usymtab_existsEnumTag (ename)) { ta = uentry_getAbstractType (usymtab_lookupEnumTag (ename)); } else { fileloc loc = fileloc_fromTok (e->tok); uentry ue = uentry_makeEnumTag (ename, cet, loc); ta = usymtab_supTypeEntry (ue); } enumNameList_elements (el, en) { uentry ue; fileloc loc; if (first) { ltokenList_reset (e->enums); first = FALSE; } else { ltokenList_advance (e->enums); } loc = fileloc_fromTok (ltokenList_current (e->enums)); ue = uentry_makeSpecEnumConstant (en, cet, loc); /* ** Can't check name here, might not have ** type yet. Will check in .lh file? */ ue = usymtab_supGlobalEntryReturn (ue); if (context_inLCLLib ()) { uentry_setDefined (ue, loc); } } end_enumNameList_elements; result = qtype_create (ta); } break; default: { llfatalbug (message ("convertLclTypeSpecNode: unknown lclTypeSpec kind: %d", (int) n->kind)); } } result = qtype_addQualList (result, n->quals); if (pointers_isDefined (n->pointers)) { qtype_adjustPointers (n->pointers, result); } return result; } else { llcontbug (cstring_makeLiteral ("convertLclTypeSpecNode: null")); return qtype_unknown (); } BADEXIT; } static /*@only@*/ multiVal literalValue (ctype ct, ltoken lit) { cstring text = cstring_fromChars (lsymbol_toChars (ltoken_getText (lit))); char first; if (cstring_length (text) > 0) { first = cstring_firstChar (text); } else { return multiVal_unknown (); } if /*@-usedef@*/ (first == '\"') /*@=usedef@*/ { size_t len = cstring_length (text) - 2; char *val = mstring_create (len); llassert (cstring_lastChar (text) == '\"'); strncpy (val, cstring_toCharsSafe (text) + 1, len); return (multiVal_makeString (cstring_fromCharsO (val))); } if (ctype_isDirectInt (ct) || ctype_isPointer (ct)) { long val = 0; if (sscanf (cstring_toCharsSafe (text), "%ld", &val) == 1) { return multiVal_makeInt (val); } } return multiVal_unknown (); } /* ** declareConstant ** ** unfortunately, because the abstract types are different, this ** cannot be easily subsumed into declareVar. */ void doDeclareConstant (constDeclarationNode c, bool priv) { lclTypeSpecNode t; ctype ctx; qtype qt; if (c == (constDeclarationNode) 0) { return; } t = c->type; qt = convertLclTypeSpecNode (t); ctx = qtype_getType (qt); initDeclNodeList_elements (c->decls, i) { ctype ct = convertTypeExpr (ctx, i->declarator->type); cstring s = getVarName (i->declarator->type); if (ctype_isFunction (ct)) { fcnNode fcn = fcnNode_fromDeclarator (lclTypeSpecNode_copy (t), declaratorNode_copy (i->declarator)); /* FALSE == unspecified function, only a declaration */ doDeclareFcn (fcn, typeId_invalid, priv, FALSE); fcnNode_free (fcn); } else { uentry ue; fileloc loc = fileloc_fromTok (i->declarator->id); if (i->value != (termNode)0 && i->value->kind == TRM_LITERAL) { ue = uentry_makeConstantValue (s, ct, loc, priv, literalValue (ct, i->value->literal)); } else { ue = uentry_makeConstantValue (s, ct, loc, priv, multiVal_unknown ()); } uentry_reflectQualifiers (ue, qtype_getQuals (qt)); if (context_inLCLLib () && !priv) { uentry_setDefined (ue, loc); } usymtab_supGlobalEntry (ue); } } end_initDeclNodeList_elements; qtype_free (qt); } static cstring getVarName (/*@null@*/ typeExpr x) { cstring s = cstring_undefined; if (x != (typeExpr) 0) { switch (x->kind) { case TEXPR_BASE: s = ltoken_getRawString (x->content.base); break; case TEXPR_PTR: s = getVarName (x->content.pointer); break; case TEXPR_ARRAY: s = getVarName (x->content.array.elementtype); break; case TEXPR_FCN: s = getVarName (x->content.function.returntype); break; default: llfatalbug (message ("getVarName: unknown typeExprKind: %d", (int) x->kind)); } } return s; } void doDeclareVar (varDeclarationNode v, bool priv) { lclTypeSpecNode t; qtype c; if (v == (varDeclarationNode) 0) { return; } t = v->type; c = convertLclTypeSpecNode (t); initDeclNodeList_elements (v->decls, i) { ctype ct = convertTypeExpr (qtype_getType (c), i->declarator->type); cstring s = getVarName (i->declarator->type); qtype_setType (c, ct); if (ctype_isFunction (ct)) { fcnNode fcn; fcn = fcnNode_fromDeclarator (lclTypeSpecNode_copy (t), declaratorNode_copy (i->declarator)); /* FALSE == unspecified function, only a declaration */ declareFcnAux (fcn, qtype_unknown (), ct, typeId_invalid, priv, FALSE); fcnNode_free (fcn); } else { fileloc loc = fileloc_fromTok (i->declarator->id); uentry le = uentry_makeVariable (s, ct, loc, priv); uentry_reflectQualifiers (le, qtype_getQuals (c)); if (uentry_isCheckedUnknown (le)) { if (context_getFlag (FLG_IMPCHECKEDSTRICTSPECGLOBALS)) { uentry_setCheckedStrict (le); } else if (context_getFlag (FLG_IMPCHECKEDSPECGLOBALS)) { uentry_setChecked (le); } else if (context_getFlag (FLG_IMPCHECKMODSPECGLOBALS)) { uentry_setCheckMod (le); } else { ; /* okay */ } } if (context_inLCLLib () && !priv) { uentry_setDefined (le, loc); } if (initDeclNode_isRedeclaration (i)) { usymtab_replaceEntry (le); } else { le = usymtab_supEntrySrefReturn (le); } } } end_initDeclNodeList_elements; qtype_free (c); } static globSet processGlob (/*@returned@*/ globSet globs, varDeclarationNode v) { if (v == (varDeclarationNode) 0) { return globs; } if (v->isSpecial) { globs = globSet_insert (globs, v->sref); } else { lclTypeSpecNode t = v->type; qtype qt = convertLclTypeSpecNode (t); ctype c = qtype_getType (qt); cstring s; initDeclNodeList_elements (v->decls, i) { ctype ct; uentry ue; qualList quals = qtype_getQuals (qt); s = getVarName (i->declarator->type); ue = usymtab_lookupGlobSafe (s); if (uentry_isInvalid (ue)) { ; /* error already reported */ } else { if (uentry_isPriv (ue)) { globs = globSet_insert (globs, sRef_makeSpecState ()); } else { uentry ce = uentry_copy (ue); ctype lt = uentry_getType (ce); fileloc loc = fileloc_fromTok (i->declarator->id); ct = convertTypeExpr (c, i->declarator->type); if (!ctype_match (lt, ct)) { (void) gentypeerror (lt, exprNode_undefined, ct, exprNode_undefined, message ("Global type mismatch %s (%t, %t)", s, lt, ct), loc); } uentry_reflectQualifiers (ce, quals); globs = globSet_insert (globs, sRef_copy (uentry_getSref (ce))); fileloc_free (loc); uentry_free (ce); } } } end_initDeclNodeList_elements; qtype_free (qt); } return globs; } static void declareAbstractType (abstractNode n, bool priv) { cstring tn; fileloc loc; uentry ue; typeId uid; abstBodyNode ab; if (n == (abstractNode) 0) { return; } tn = ltoken_getRawString (n->name); loc = fileloc_fromTok (n->tok); ue = uentry_makeDatatypeAux (tn, ctype_unknown, ynm_fromBool (n->isMutable), qual_createAbstract (), loc, priv); if (n->isRefCounted) { uentry_setRefCounted (ue); } if (context_inLCLLib () && !priv) { uentry_setDefined (ue, loc); } uid = usymtab_supAbstractTypeEntry (ue, context_inLCLLib() && !priv); if (!priv && (ab = n->body) != (abstBodyNode) 0) { fcnNodeList ops = ab->fcns; if (!fcnNodeList_isEmpty (ops)) { fcnNodeList_elements (ops, i) { if (i->typespec == (lclTypeSpecNode) 0) { cstring fname = ltoken_getRawString (i->name); if (usymtab_exists (fname)) { uentry e = usymtab_lookup (fname); fileloc floc = fileloc_fromTok (i->declarator->id); if (uentry_isForward (e)) { usymtab_supEntry (uentry_makeTypeListFunction (fname, typeIdSet_insert (uentry_accessType (e), uid), floc)); } else { usymtab_supEntry (uentry_makeSpecFunction (fname, uentry_getType (e), typeIdSet_insert (uentry_accessType (e), uid), globSet_undefined, sRefSet_undefined, floc)); if (context_inLCLLib ()) { llbuglit ("Jolly jeepers Wilma, it ain't dead after all!"); } } } else { usymtab_supEntry (uentry_makeForwardFunction (fname, uid, loc)); } } else { declareFcn (i, uid); } } end_fcnNodeList_elements; } } } static void declareExposedType (exposedNode n, bool priv) { qtype c; cstring s; if (n == (exposedNode) 0) { return; } c = convertLclTypeSpecNode (n->type); declaratorInvNodeList_elements (n->decls, i) { ctype realType = convertTypeExpr (qtype_getType (c), i->declarator->type); fileloc loc = fileloc_fromTok (i->declarator->id); uentry ue; s = getVarName (i->declarator->type); ue = uentry_makeDatatypeAux (s, realType, MAYBE, qual_createConcrete (), loc, priv); uentry_reflectQualifiers (ue, qtype_getQuals (c)); if (context_inLCLLib () && !priv) { uentry_setDefined (ue, loc); } (void) usymtab_supExposedTypeEntry (ue, context_inLCLLib () && !priv); } end_declaratorInvNodeList_elements; qtype_free (c); } /* ** ah...remember ye old days... ** ** wow...same thing in THREE symbol tables! talk about space efficiency ** (or as Joe Theory once said, its only a constant factor) */ void doDeclareType (typeNode t, bool priv) { if (t != (typeNode) 0) { switch (t->kind) { case TK_ABSTRACT: declareAbstractType (t->content.abstract, priv); break; case TK_EXPOSED: declareExposedType (t->content.exposed, priv); break; case TK_UNION: default: { llfatalbug (message ("declareType: unknown kind: %d", (int) t->kind)); } } } } extern void declareIter (iterNode iter) { fileloc loc = fileloc_fromTok (iter->name); uentry ue = uentry_makeIter (ltoken_unparse (iter->name), ctype_makeFunction (ctype_void, paramNodeList_toUentryList (iter->params)), fileloc_copy (loc)); usymtab_supEntry (ue); usymtab_supEntry (uentry_makeEndIter (ltoken_unparse (iter->name), loc)); } /* ** declareFcn */ static void declareFcnAux (fcnNode f, /*@only@*/ qtype qt, ctype ct, typeId tn, bool priv, bool spec) { globalList globals; typeIdSet acct; sRefSet sl = sRefSet_undefined; globSet globlist = globSet_undefined; cstring s = getVarName (f->declarator->type); fileloc loc = fileloc_fromTok (f->declarator->id); uentryList args; /* ** type conversion generates args */ if (ctype_isFunction (ct)) { args = ctype_argsFunction (ct); } else { llcontbug (message ("Not function: %s", ctype_unparse (ct))); args = uentryList_undefined; } fileloc_setColumnUndefined (loc); if (spec) { globals = f->globals; sl = fixModifies (f, args); /* ** Bind let declarations in modifies list */ varDeclarationNodeList_elements (globals, glob) { globlist = processGlob (globlist, glob); } end_varDeclarationNodeList_elements; if (f->checks != (lclPredicateNode) 0) /* push stderr on globalList */ /* modifies *stderr^ */ { uentry ue; if (!(usymtab_existsVar (cstring_makeLiteralTemp ("stderr")))) { ctype tfile; llmsglit ("Global stderr implied by checks clause, " "not declared in initializations."); tfile = usymtab_lookupType (cstring_makeLiteralTemp ("FILE")); if (ctype_isUndefined (tfile)) { llmsglit ("FILE datatype implied by checks clause not defined."); tfile = ctype_unknown; } usymtab_supGlobalEntry (uentry_makeVariable (cstring_makeLiteralTemp ("stderr"), tfile, fileloc_getBuiltin (), FALSE)); } ue = usymtab_lookupGlob (cstring_makeLiteralTemp ("stderr")); globlist = globSet_insert (globlist, sRef_copy (uentry_getSref (ue))); sl = sRefSet_insert (sl, sRef_buildPointer (uentry_getSref (ue))); } } if (typeId_isInvalid (tn)) { acct = context_fileAccessTypes (); } else { acct = typeIdSet_single (tn); } if (usymtab_exists (s)) { uentry l = usymtab_lookup (s); uentry ue; if (uentry_isForward (l) || (fileloc_isLib (uentry_whereSpecified (l)))) { typeIdSet accessType; if (uentry_isFunction (l)) { accessType = typeIdSet_union (uentry_accessType (l), context_fileAccessTypes ()); } else { accessType = context_fileAccessTypes (); } if (spec) { ue = uentry_makeSpecFunction (s, ct, accessType, globlist, sl, loc); } else { sRefSet_free (sl); globSet_free (globlist); ue = uentry_makeUnspecFunction (s, ct, accessType, loc); } uentry_reflectQualifiers (ue, qtype_getQuals (qt)); usymtab_supEntry (ue); } else { /* ** error reported by symtable already ** ** llgenerror (message ("Function redeclared: %s (previous declaration: %s)", s, ** fileloc_unparse (uentry_whereSpecified (l))), ** loc); */ fileloc_free (loc); sRefSet_free (sl); globSet_free (globlist); } } else { uentry le; if (spec) { if (priv) { le = uentry_makePrivFunction2 (s, ct, acct, globlist, sl, loc); } else { le = uentry_makeSpecFunction (s, ct, acct, globlist, sl, loc); } } else { le = uentry_makeUnspecFunction (s, ct, acct, loc); sRefSet_free (sl); globSet_free (globlist); } if (context_inLCLLib () && !priv) { uentry_setDefined (le, loc); } uentry_reflectQualifiers (le, qtype_getQuals (qt)); if (qual_isUnknown (f->special)) { ; } else if (qual_isPrintfLike (f->special)) { uentry_setPrintfLike (le); } else if (qual_isScanfLike (f->special)) { uentry_setScanfLike (le); } else if (qual_isMessageLike (f->special)) { uentry_setMessageLike (le); } else { BADBRANCH; } usymtab_supEntry (le); } qtype_free (qt); } extern void doDeclareFcn (fcnNode f, typeId tn, bool priv, bool spec) { qtype qt = convertLclTypeSpecNode (f->typespec); ctype ct = convertTypeExpr (qtype_getType (qt), f->declarator->type); declareFcnAux (f, qt, ct, tn, priv, spec); } /* ** is s is an argument to f, return its arg no. ** otherwise, return 0 */ static int getParamNo (cstring s, fcnNode f) { /* gasp, maybe should do run-time checks here */ paramNodeList params; typeExpr fd = f->declarator->type; /* is this a bug in the LCL grammar? */ while (fd != NULL && (fd->kind == TEXPR_PTR || fd->kind == TEXPR_ARRAY)) { if (fd->kind == TEXPR_PTR) { fd = fd->content.pointer; } else { /*@-null@*/ fd = fd->content.array.elementtype; /*@=null@*/ /* ** This is a bug in checking, that I should eventually fix. ** Need some way of deleting the guard from the true branch, ** but adding it back in the false branch... */ } } llassert (fd != NULL); if (fd->kind != TEXPR_FCN) { llfatalbug (message ("getParamNo: not a function: %q (%d)", typeExpr_unparse (fd), (int) fd->kind)); } params = fd->content.function.args; if (paramNodeList_empty (params)) { return -1; } else { int pno = 0; paramNodeList_elements (params, i) { if (i->paramdecl != (typeExpr) 0) /* handle (void) */ { if (cstring_equal (s, getVarName (i->paramdecl))) { return pno; } } pno++; } end_paramNodeList_elements; return -1; } } static /*@null@*/ /*@observer@*/ termNode getLetDecl (cstring s, fcnNode f) { letDeclNodeList x = f->lets; letDeclNodeList_elements (x, i) { if (cstring_equal (s, ltoken_getRawString (i->varid))) { if (i->sortspec != NULL) { llbuglit ("getLetDecl: cannot return sort!"); } else { /* is a termNode */ return i->term; } } } end_letDeclNodeList_elements; return (termNode) 0; } /* ** processTermNode --- based on printTermNode2 */ static /*@exposed@*/ sRef processTermNode (/*@null@*/ opFormNode op, termNodeList args, fcnNode f, uentryList cl) { if (op != (opFormNode) 0) { switch (op->kind) { case OPF_IF: llcontbuglit ("processTermNode: OPF_IF: not handled"); break; case OPF_ANYOP: llcontbuglit ("processTermNode: OPF_ANYOP: not handled"); break; case OPF_MANYOP: { int size = termNodeList_size (args); if (size == 1 && (cstring_equalLit (ltoken_getRawString (op->content.anyop), "'") || cstring_equalLit (ltoken_getRawString (op->content.anyop), "^"))) { return (fixTermNode (termNodeList_head (args), f, cl)); } else { ; } break; } case OPF_ANYOPM: { int size = termNodeList_size (args); if (size == 1 && (cstring_equalLit (ltoken_getRawString (op->content.anyop), "*"))) { sRef ft; sRef res; ft = fixTermNode (termNodeList_head (args), f, cl); res = sRef_buildPointer (ft); return (res); } else { ; } break; } case OPF_MANYOPM: llcontbuglit ("OPF_MANYOPM: not handled\n"); break; case OPF_MIDDLE: llcontbuglit ("OPF_MIDDLE: not handled\n"); break; case OPF_MMIDDLE: llcontbuglit ("OPF_MMIDDLE: not handled\n"); break; case OPF_MIDDLEM: llcontbuglit ("OPF_MIDDLEM: not handled\n"); break; case OPF_MMIDDLEM: llcontbuglit ("OPF_MMIDDLEM: not handled\n"); break; case OPF_BMIDDLE: if (op->content.middle == 1) llbug (message ("array fetch: [%q]", termNodeList_unparse (args))); else llcontbuglit ("OPF_BMIDDLE: bad\n"); break; case OPF_BMMIDDLE: if (op->content.middle <= 1) { sRef arr = fixTermNode (termNodeList_head (args), f, cl); sRef ret; if (op->content.middle == 1) { termNode t = (termNodeList_reset (args), termNodeList_advance (args), termNodeList_current (args)); if (t->kind == TRM_LITERAL) { int i; if (sscanf (cstring_toCharsSafe (ltoken_getRawString (t->literal)), "%d", &i) == 1) { ret = sRef_buildArrayFetchKnown (arr, i); } else { ret = sRef_buildArrayFetch (arr); } return (ret); } } /* unknown index */ ret = sRef_buildArrayFetch (arr); return (ret); } else { llcontbug (message ("op->content.middle = %d", op->content.middle)); break; } case OPF_BMIDDLEM: llcontbuglit ("OPF_BMIDDLEM not handled"); break; case OPF_BMMIDDLEM: llcontbuglit ("OPF_BMMIDDLEM not handled"); break; case OPF_SELECT: llcontbug (message ("select: .%s", ltoken_getRawString (op->content.id))); break; case OPF_MAP: llcontbug (message ("map: .%s", ltoken_getRawString (op->content.id))); break; case OPF_MSELECT: { sRef rec = fixTermNode (termNodeList_head (args), f, cl); sRef ret; ctype ct = ctype_realType (sRef_deriveType (rec, cl)); cstring fieldname = ltoken_getRawString (op->content.id); ct = ctype_realType (ct); /* ** does it correspond to a typedef struct field ** ** (kind of kludgey, but there is no direct way to ** tell if it is an lsl operator instead) */ if (ctype_isStructorUnion (ct) && uentry_isValid (uentryList_lookupField (ctype_getFields (ct), fieldname))) { cstring fname = cstring_copy (fieldname); ret = sRef_buildField (rec, fname); cstring_markOwned (fname); } else { ret = sRef_undefined; } return ret; } case OPF_MMAP: { sRef rec = fixTermNode (termNodeList_head (args), f, cl); sRef ret = sRef_undefined; ctype ct = ctype_realType (sRef_deriveType (rec, cl)); cstring fieldname = ltoken_getRawString (op->content.id); /* ** does it correspond to a typedef struct field */ if (ctype_isPointer (ct)) { ctype ctb = ctype_realType (ctype_baseArrayPtr (ct)); if (ctype_isStructorUnion (ctb) && uentry_isValid (uentryList_lookupField (ctype_getFields (ctb), fieldname))) { cstring fname = cstring_copy (fieldname); ret = sRef_buildArrow (rec, fname); cstring_markOwned (fname); } } return ret; } } } return sRef_undefined; } /* ** fixModifies ** ** o replace anything in modifies that is bound with let with value ** o replace spec variables with internal state ** o replace paramaters with paramno identifiers ** o replace globals with their usymid's ** o make everything sRefs */ static /*@exposed@*/ sRef fixTermNode (termNode n, fcnNode f, uentryList cl) { if (n != (termNode) 0) { switch (n->kind) { case TRM_LITERAL: break; case TRM_CONST: case TRM_VAR: case TRM_ZEROARY: { cstring s = ltoken_getRawString (n->literal); termNode tl = getLetDecl (s, f); if (tl != (termNode) 0) { return (fixTermNode (tl, f, cl)); } else { int i = getParamNo (s, f); if (i < 0) { usymId usym = usymtab_getId (s); if (usymId_isInvalid (usym)) { if (usymtab_existsEither (s)) { return sRef_makeSpecState (); } else { llcontbuglit ("Invalid symbol in modifies list"); return sRef_undefined; } } else return (sRef_makeGlobal (usym, ctype_unknown, stateInfo_currentLoc ())); } else { sRef p = sRef_makeParam (i, ctype_unknown, stateInfo_currentLoc ()); return (p); } } } case TRM_APPLICATION: { nameNode nn = n->name; if (nn != (nameNode) 0) { if (nn->isOpId) { /* must we handle n->given ? skip for now */ llfatalbug (message ("fixTermNode: expect non-empty nameNode: " "TRM_APPLICATION: %q", nameNode_unparse (nn))); } else { sRef sr; sr = processTermNode (nn->content.opform, n->args, f, cl); return (sr); } } return sRef_undefined; } case TRM_UNCHANGEDALL: case TRM_UNCHANGEDOTHERS: case TRM_SIZEOF: case TRM_QUANTIFIER: return sRef_undefined; } } return sRef_undefined; } static /*@only@*/ sRefSet fixModifies (fcnNode f, uentryList cl) { static bool shownWarning = FALSE; modifyNode m = f->modify; sRefSet sl = sRefSet_new (); if (m != (modifyNode) 0) { if (m->hasStoreRefList) { storeRefNodeList srefs = m->list; storeRefNodeList_elements (srefs, i) { if (storeRefNode_isObj (i) || storeRefNode_isType (i)) { if (!shownWarning) { fileloc loc = fileloc_fromTok (f->name); llmsg (message ("%q: Warning: object and type modifications " "not understood by Splint", fileloc_unparse (loc))); fileloc_free (loc); shownWarning = TRUE; } } else if (storeRefNode_isSpecial (i)) { sl = sRefSet_insert (sl, i->content.ref); } else if (storeRefNode_isTerm (i)) { sRef s = fixTermNode (i->content.term, f, cl); if (sRef_isKnown (s)) { sl = sRefSet_insert (sl, s); } } else { BADEXIT; } } end_storeRefNodeList_elements; } } return sl; } static /*@only@*/ cstring paramNode_name (paramNode x) { return (typeExpr_name (x->paramdecl)); } static /*@only@*/ uentry paramNode_toUentry (paramNode p) { if (p != (paramNode) 0) { if (p->kind == PELIPSIS) { return uentry_makeElipsisMarker (); } else { qtype ct = convertLclTypeSpecNode (p->type); ctype cr = convertTypeExpr (qtype_getType (ct), p->paramdecl); cstring pname = (p->paramdecl == (typeExpr)0) ? cstring_undefined : paramNode_name (p); uentry ue = uentry_makeVariableParam (pname, cr, g_currentloc); uentry_reflectQualifiers (ue, qtype_getQuals (ct)); qtype_free (ct); return (ue); } } else { llcontbuglit ("paramNode_toUentry: NULL"); return uentry_undefined; } BADEXIT; } static uentryList paramNodeList_toUentryList (paramNodeList p) { uentryList cl = uentryList_new (); if (paramNodeList_isNull (p)) return (cl); paramNodeList_elements (p, current) { cl = uentryList_add (cl, paramNode_toUentry (current)); } end_paramNodeList_elements; return cl; } splint-3.1.2.dfsg1/src/abstract.c0000644021234200000250000043701307646432514014224 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** abstract.c ** ** Module for building abstract syntax trees for LCL. ** ** This module is too close to the surface syntax of LCL. ** Suffices for now. ** ** AUTHOR: ** Yang Meng Tan, ** Massachusetts Institute of Technology */ # include "splintMacros.nf" # include "basic.h" # include "lslparse.h" # include "llgrammar.h" /* need simpleOp, MULOP and logicalOp in makeInfixTermNode */ # include "lclscan.h" # include "lh.h" # include "imports.h" static lsymbol lsymbol_Bool; static lsymbol lsymbol_bool; static lsymbol lsymbol_TRUE; static lsymbol lsymbol_FALSE; static void lclPredicateNode_free (/*@only@*/ /*@null@*/ lclPredicateNode p_x) ; static void exposedNode_free (/*@only@*/ /*@null@*/ exposedNode p_x) ; static void CTypesNode_free (/*@null@*/ /*@only@*/ CTypesNode p_x); static /*@null@*/ CTypesNode CTypesNode_copy (/*@null@*/ CTypesNode p_x) /*@*/ ; static void constDeclarationNode_free (/*@only@*/ /*@null@*/ constDeclarationNode p_x); static void claimNode_free (/*@only@*/ /*@null@*/ claimNode p_x); static void iterNode_free (/*@only@*/ /*@null@*/ iterNode p_x); static void abstBodyNode_free (/*@only@*/ /*@null@*/ abstBodyNode p_n); static void abstractNode_free (/*@only@*/ /*@null@*/ abstractNode p_x); static void taggedUnionNode_free (/*@only@*/ /*@null@*/ taggedUnionNode p_x); static void typeNode_free (/*@only@*/ /*@null@*/ typeNode p_t); static /*@null@*/ strOrUnionNode strOrUnionNode_copy (/*@null@*/ strOrUnionNode p_n) /*@*/ ; static void strOrUnionNode_free (/*@null@*/ /*@only@*/ strOrUnionNode p_n) /*@modifies *p_n @*/ ; static void enumSpecNode_free (/*@null@*/ /*@only@*/ enumSpecNode p_x); static /*@only@*/ /*@null@*/ enumSpecNode enumSpecNode_copy (/*@null@*/ enumSpecNode p_x) /*@*/ ; static /*@only@*/ lclTypeSpecNode lclTypeSpecNode_copySafe (lclTypeSpecNode p_n) /*@*/ ; static void lclTypeSpecNode_free (/*@null@*/ /*@only@*/ lclTypeSpecNode p_n); static void typeNamePack_free (/*@only@*/ /*@null@*/ typeNamePack p_x); static void opFormNode_free (/*@only@*/ /*@null@*/ opFormNode p_op); static quantifiedTermNode quantifiedTermNode_copy (quantifiedTermNode p_q) /*@*/ ; static void nameAndReplaceNode_free (/*@only@*/ /*@null@*/ nameAndReplaceNode p_x); static void renamingNode_free (/*@only@*/ /*@null@*/ renamingNode p_x); static void exportNode_free (/*@null@*/ /*@only@*/ exportNode p_x); static void privateNode_free (/*@only@*/ /*@null@*/ privateNode p_x); static /*@null@*/ termNode termNode_copy (/*@null@*/ termNode p_t) /*@*/ ; static void stmtNode_free (/*@only@*/ /*@null@*/ stmtNode p_x) /*@modifies *p_x@*/ ; static /*@null@*/ typeExpr typeExpr_copy (/*@null@*/ typeExpr p_x) /*@*/ ; static lsymbol ConditionalSymbol; static lsymbol equalSymbol; static lsymbol eqSymbol; static lclTypeSpecNode exposedType; static /*@only@*/ cstring abstDeclaratorNode_unparse (abstDeclaratorNode p_x); static pairNodeList extractParams (/*@null@*/ typeExpr p_te); static sort extractReturnSort (lclTypeSpecNode p_t, declaratorNode p_d); static void checkAssociativity (termNode p_x, ltoken p_op); static void LCLBootstrap (void); static cstring printMiddle (int p_j); static void paramNode_checkQualifiers (lclTypeSpecNode p_t, typeExpr p_d); void resetImports (cstring current) { lsymbolSet_free (g_currentImports); g_currentImports = lsymbolSet_new (); /* equal_symbol; */ (void) lsymbolSet_insert (g_currentImports, lsymbol_fromString (current)); } void abstract_init () { typeInfo ti = (typeInfo) dmalloc (sizeof (*ti)); nameNode nn; ltoken dom, range; sigNode sign; opFormNode opform; ltokenList domain = ltokenList_new (); ltokenList domain2; equalSymbol = lsymbol_fromChars ("="); eqSymbol = lsymbol_fromChars ("\\eq"); /* ** not: cstring_toCharsSafe (context_getBoolName ()) ** we use the hard wired "bool" name. */ lsymbol_bool = lsymbol_fromChars ("bool"); lsymbol_Bool = lsymbol_fromChars ("Bool"); lsymbol_TRUE = lsymbol_fromChars ("TRUE"); lsymbol_FALSE = lsymbol_fromChars ("FALSE"); ConditionalSymbol = lsymbol_fromChars ("if__then__else__"); /* generate operators for ** __ \not, __ \implies __ , __ \and __, __ \or __ */ range = ltoken_create (simpleId, lsymbol_bool); dom = ltoken_create (simpleId, lsymbol_bool); ltokenList_addh (domain, ltoken_copy (dom)); domain2 = ltokenList_copy (domain); /* moved this here (before release) */ sign = makesigNode (ltoken_undefined, domain, ltoken_copy (range)); opform = makeOpFormNode (ltoken_undefined, OPF_ANYOPM, opFormUnion_createAnyOp (ltoken_not), ltoken_undefined); nn = makeNameNodeForm (opform); symtable_enterOp (g_symtab, nn, sign); ltokenList_addh (domain2, dom); sign = makesigNode (ltoken_undefined, domain2, range); opform = makeOpFormNode (ltoken_undefined, OPF_MANYOPM, opFormUnion_createAnyOp (ltoken_and), ltoken_undefined); nn = makeNameNodeForm (opform); symtable_enterOp (g_symtab, nn, sigNode_copy (sign)); opform = makeOpFormNode (ltoken_undefined, OPF_MANYOPM, opFormUnion_createAnyOp (ltoken_or), ltoken_undefined); nn = makeNameNodeForm (opform); symtable_enterOp (g_symtab, nn, sigNode_copy (sign)); opform = makeOpFormNode (ltoken_undefined, OPF_MANYOPM, opFormUnion_createAnyOp (ltoken_implies), ltoken_undefined); nn = makeNameNodeForm (opform); symtable_enterOp (g_symtab, nn, sign); /* from lclscanline.c's init procedure */ /* comment out so we can add in lclinit.lci: synonym double float */ /* ReserveToken (FLOAT, "float"); */ /* But we need to make the scanner parse "float" not as a simpleId, but as a TYPEDEF_NAME. This is done later in abstract_init */ ti->id = ltoken_createType (LLT_TYPEDEF_NAME, SID_TYPE, lsymbol_fromChars ("float")); ti->modifiable = FALSE; ti->abstract = FALSE; ti->export = FALSE; /* this is implicit, not exported */ ti->basedOn = g_sortFloat; symtable_enterType (g_symtab, ti); } void declareForwardType (declaratorNode declare) { typeInfo ti = (typeInfo) dmalloc (sizeof (*ti)); sort tsort, handle; lsymbol typedefname; typedefname = ltoken_getText (declare->id); ti->id = ltoken_copy (declare->id); ltoken_setCode (ti->id, LLT_TYPEDEF_NAME); ltoken_setIdType (ti->id, SID_TYPE); ti->modifiable = FALSE; ti->abstract = FALSE; tsort = lclTypeSpecNode2sort (exposedType); handle = typeExpr2ptrSort (tsort, declare->type); ti->basedOn = sort_makeSyn (declare->id, handle, typedefname); ti->export = FALSE; symtable_enterType (g_symtab, ti); } void LCLBuiltins (void) { typeInfo ti = (typeInfo) dmalloc (sizeof (*ti)); varInfo vi = (varInfo) dmalloc (sizeof (*vi)); /* immutable type bool; uses CTrait; constant bool FALSE = false; constant bool TRUE = true; */ /* the following defines the builtin LSL sorts and operators */ LCLBootstrap (); /* now LCL builtin proper */ /* do "immutable type bool;" */ ti->id = ltoken_copy (ltoken_bool); ltoken_setCode (ti->id, LLT_TYPEDEF_NAME); ltoken_setIdType (ti->id, SID_TYPE); ti->modifiable = FALSE; ti->abstract = TRUE; ti->basedOn = g_sortBool; ti->export = FALSE; /* this wasn't set (detected by Splint) */ symtable_enterType (g_symtab, ti); /* do "constant bool FALSE = false;" */ vi->id = ltoken_createType (simpleId, SID_VAR, lsymbol_fromChars ("FALSE")); vi->kind = VRK_CONST; vi->sort = g_sortBool; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); /* do "constant bool TRUE = true;" */ /* vi->id = ltoken_copy (vi->id); */ ltoken_setText (vi->id, lsymbol_fromChars ("TRUE")); (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); importCTrait (); } static void LCLBootstrap (void) { nameNode nn1, nn2; ltoken range; sigNode sign; sort s; /* ** Minimal we need to bootstrap is to provide the sort ** "bool" and 2 bool constants "true" and "false". ** sort_init should already have been called, and hence ** the bool and Bool sorts defined. */ s = sort_makeImmutable (ltoken_undefined, lsymbol_bool); range = ltoken_create (simpleId, lsymbol_bool); sign = makesigNode (ltoken_undefined, ltokenList_new (), range); nn1 = (nameNode) dmalloc (sizeof (*nn1)); nn1->isOpId = TRUE; nn1->content.opid = ltoken_create (simpleId, lsymbol_fromChars ("true")); symtable_enterOp (g_symtab, nn1, sign); nn2 = (nameNode) dmalloc (sizeof (*nn2)); nn2->isOpId = TRUE; nn2->content.opid = ltoken_create (simpleId, lsymbol_fromChars ("false")); symtable_enterOp (g_symtab, nn2, sigNode_copy (sign)); } interfaceNodeList consInterfaceNode (/*@only@*/ interfaceNode n, /*@returned@*/ interfaceNodeList ns) { /* n is never empty, but ns may be empty */ interfaceNodeList_addl (ns, n); return (ns); } /*@only@*/ interfaceNode makeInterfaceNodeImports (/*@only@*/ importNodeList x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); lsymbol importSymbol; i->kind = INF_IMPORTS; i->content.imports = x; /* an importNodeList */ importNodeList_elements (x, imp) { importSymbol = ltoken_getRawText (imp->val); if (lsymbolSet_member (g_currentImports, importSymbol)) { lclerror (imp->val, message ("Circular imports: %s", cstring_fromChars (lsymbol_toChars (importSymbol)))); } else { processImport (importSymbol, imp->val, imp->kind); } } end_importNodeList_elements; lhOutLine (cstring_undefined); return (i); } /*@only@*/ interfaceNode makeInterfaceNodeUses (/*@only@*/ traitRefNodeList x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); i->kind = INF_USES; i->content.uses = x; /* read in LSL traits */ return (i); } /*@only@*/ interfaceNode interfaceNode_makeConst (/*@only@*/ constDeclarationNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); exportNode e = (exportNode) dmalloc (sizeof (*e)); e->kind = XPK_CONST; e->content.constdeclaration = x; i->kind = INF_EXPORT; i->content.export = e; return (i); } /*@only@*/ interfaceNode interfaceNode_makeVar (/*@only@*/ varDeclarationNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); exportNode e = (exportNode) dmalloc (sizeof (*e)); e->kind = XPK_VAR; e->content.vardeclaration = x; i->kind = INF_EXPORT; i->content.export = e; if (context_msgLh ()) { lhOutLine (lhVarDecl (x->type, x->decls, x->qualifier)); } return (i); } /*@only@*/ interfaceNode interfaceNode_makeType (/*@only@*/ typeNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); exportNode e = (exportNode) dmalloc (sizeof (*e)); e->kind = XPK_TYPE; e->content.type = x; i->kind = INF_EXPORT; i->content.export = e; if (context_msgLh ()) { lhOutLine (lhType (x)); } return (i); } /*@only@*/ interfaceNode interfaceNode_makeFcn (/*@only@*/ fcnNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); exportNode e = (exportNode) dmalloc (sizeof (*e)); e->kind = XPK_FCN; e->content.fcn = x; i->kind = INF_EXPORT; i->content.export = e; if (context_msgLh ()) { llassert (x->typespec != NULL); llassert (x->declarator != NULL); lhOutLine (lhFunction (x->typespec, x->declarator)); } return (i); } /*@only@*/ interfaceNode interfaceNode_makeClaim (/*@only@*/ claimNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); exportNode e = (exportNode) dmalloc (sizeof (*e)); e->kind = XPK_CLAIM; e->content.claim = x; i->kind = INF_EXPORT; i->content.export = e; return (i); } /*@only@*/ interfaceNode interfaceNode_makeIter (/*@only@*/ iterNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); exportNode e = (exportNode) dmalloc (sizeof (*e)); e->kind = XPK_ITER; e->content.iter = x; i->kind = INF_EXPORT; i->content.export = e; return (i); } /*@only@*/ interfaceNode interfaceNode_makePrivConst (/*@only@*/ constDeclarationNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); privateNode e = (privateNode) dmalloc (sizeof (*e)); e->kind = PRIV_CONST; e->content.constdeclaration = x; i->kind = INF_PRIVATE; i->content.private = e; return (i); } /*@only@*/ interfaceNode interfaceNode_makePrivVar (/*@only@*/ varDeclarationNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); privateNode e = (privateNode) dmalloc (sizeof (*e)); e->kind = PRIV_VAR; e->content.vardeclaration = x; i->kind = INF_PRIVATE; i->content.private = e; return (i); } /*@only@*/ interfaceNode interfaceNode_makePrivType (/*@only@*/ typeNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); privateNode e = (privateNode) dmalloc (sizeof (*e)); e->kind = PRIV_TYPE; e->content.type = x; i->kind = INF_PRIVATE; i->content.private = e; return (i); } /*@only@*/ interfaceNode interfaceNode_makePrivFcn (/*@only@*/ fcnNode x) { interfaceNode i = (interfaceNode) dmalloc (sizeof (*i)); privateNode e = (privateNode) dmalloc (sizeof (*e)); /* ** bug detected by enum checking ** e->kind = XPK_FCN; */ e->kind = PRIV_FUNCTION; e->content.fcn = x; i->kind = INF_PRIVATE; i->content.private = e; return (i); } /*@only@*/ cstring exportNode_unparse (exportNode n) { if (n != (exportNode) 0) { switch (n->kind) { case XPK_CONST: return (message ("%q\n", constDeclarationNode_unparse (n->content.constdeclaration))); case XPK_VAR: return (message ("%q\n", varDeclarationNode_unparse (n->content.vardeclaration))); case XPK_TYPE: return (message ("%q\n", typeNode_unparse (n->content.type))); case XPK_FCN: return (fcnNode_unparse (n->content.fcn)); case XPK_CLAIM: return (claimNode_unparse (n->content.claim)); case XPK_ITER: return (iterNode_unparse (n->content.iter)); default: llfatalbug (message ("exportNode_unparse: unknown kind: %d", (int) n->kind)); } } return cstring_undefined; } /*@only@*/ cstring privateNode_unparse (privateNode n) { if (n != (privateNode) 0) { switch (n->kind) { case PRIV_CONST: return (constDeclarationNode_unparse (n->content.constdeclaration)); case PRIV_VAR: return (varDeclarationNode_unparse (n->content.vardeclaration)); case PRIV_TYPE: return (typeNode_unparse (n->content.type)); case PRIV_FUNCTION: return (fcnNode_unparse (n->content.fcn)); default: llfatalbug (message ("privateNode_unparse: unknown kind: %d", (int) n->kind)); } } return cstring_undefined; } void lclPredicateNode_free (/*@null@*/ /*@only@*/ lclPredicateNode x) { if (x != NULL) { termNode_free (x->predicate); ltoken_free (x->tok); sfree (x); } } static /*@only@*/ cstring lclPredicateNode_unparse (/*@null@*/ lclPredicateNode p) /*@*/ { if (p != (lclPredicateNode) 0) { cstring st = cstring_undefined; switch (p->kind) { case LPD_REQUIRES: st = cstring_makeLiteral (" requires "); break; case LPD_CHECKS: st = cstring_makeLiteral (" checks "); break; case LPD_ENSURES: st = cstring_makeLiteral (" ensures "); break; case LPD_INTRACLAIM: st = cstring_makeLiteral (" claims "); break; case LPD_CONSTRAINT: st = cstring_makeLiteral ("constraint "); break; case LPD_INITIALLY: st = cstring_makeLiteral ("initially "); break; case LPD_PLAIN: break; default: llfatalbug (message ("lclPredicateNode_unparse: unknown kind: %d", (int) p->kind)); } return (message ("%q%q;\n", st, termNode_unparse (p->predicate))); } return cstring_undefined; } bool ltoken_similar (ltoken t1, ltoken t2) { lsymbol sym1 = ltoken_getText (t1); lsymbol sym2 = ltoken_getText (t2); if (sym1 == sym2) { return TRUE; } if ((sym1 == eqSymbol && sym2 == equalSymbol) || (sym2 == eqSymbol && sym1 == equalSymbol)) { return TRUE; } if ((sym1 == lsymbol_bool && sym2 == lsymbol_Bool) || (sym2 == lsymbol_bool && sym1 == lsymbol_Bool)) { return TRUE; } return FALSE; } /*@only@*/ cstring iterNode_unparse (/*@null@*/ iterNode i) { if (i != (iterNode) 0) { return (message ("iter %s %q", ltoken_unparse (i->name), paramNodeList_unparse (i->params))); } return cstring_undefined; } /*@only@*/ cstring fcnNode_unparse (/*@null@*/ fcnNode f) { if (f != (fcnNode) 0) { return (message ("%q %q%q{\n%q%q%q%q%q%q}\n", lclTypeSpecNode_unparse (f->typespec), declaratorNode_unparse (f->declarator), varDeclarationNodeList_unparse (f->globals), varDeclarationNodeList_unparse (f->inits), letDeclNodeList_unparse (f->lets), lclPredicateNode_unparse (f->require), modifyNode_unparse (f->modify), lclPredicateNode_unparse (f->ensures), lclPredicateNode_unparse (f->claim))); } return cstring_undefined; } /*@only@*/ cstring varDeclarationNode_unparse (/*@null@*/ varDeclarationNode x) { if (x != (varDeclarationNode) 0) { cstring st; if (x->isSpecial) { return (sRef_unparse (x->sref)); } else { switch (x->qualifier) { case QLF_NONE: st = cstring_undefined; break; case QLF_CONST: st = cstring_makeLiteral ("const "); break; case QLF_VOLATILE: st = cstring_makeLiteral ("volatile "); break; BADDEFAULT; } st = message ("%q%q %q", st, lclTypeSpecNode_unparse (x->type), initDeclNodeList_unparse (x->decls)); return (st); } } return cstring_undefined; } /*@only@*/ cstring typeNode_unparse (/*@null@*/ typeNode t) { if (t != (typeNode) 0) { switch (t->kind) { case TK_ABSTRACT: return (abstractNode_unparse (t->content.abstract)); case TK_EXPOSED: return (exposedNode_unparse (t->content.exposed)); case TK_UNION: return (taggedUnionNode_unparse (t->content.taggedunion)); default: llfatalbug (message ("typeNode_unparse: unknown kind: %d", (int)t->kind)); } } return cstring_undefined; } /*@only@*/ cstring constDeclarationNode_unparse (/*@null@*/ constDeclarationNode x) { if (x != (constDeclarationNode) 0) { return (message ("constant %q %q", lclTypeSpecNode_unparse (x->type), initDeclNodeList_unparse (x->decls))); } return cstring_undefined; } /*@only@*/ storeRefNode makeStoreRefNodeTerm (/*@only@*/ termNode t) { storeRefNode x = (storeRefNode) dmalloc (sizeof (*x)); x->kind = SRN_TERM; x->content.term = t; return (x); } /*@only@*/ storeRefNode makeStoreRefNodeType (/*@only@*/ lclTypeSpecNode t, bool isObj) { storeRefNode x = (storeRefNode) dmalloc (sizeof (*x)); x->kind = isObj ? SRN_OBJ : SRN_TYPE; x->content.type = t; return (x); } storeRefNode makeStoreRefNodeInternal (void) { storeRefNode x = (storeRefNode) dmalloc (sizeof (*x)); x->kind = SRN_SPECIAL; x->content.ref = sRef_makeInternalState (); return (x); } storeRefNode makeStoreRefNodeSystem (void) { storeRefNode x = (storeRefNode) dmalloc (sizeof (*x)); x->kind = SRN_SPECIAL; x->content.ref = sRef_makeSystemState (); return (x); } /*@only@*/ modifyNode makeModifyNodeSpecial (/*@only@*/ ltoken t, bool modifiesNothing) { modifyNode x = (modifyNode) dmalloc (sizeof (*x)); x->tok = t; x->modifiesNothing = modifiesNothing; x->hasStoreRefList = FALSE; return (x); } /*@only@*/ modifyNode makeModifyNodeRef (/*@only@*/ ltoken t, /*@only@*/ storeRefNodeList y) { modifyNode x = (modifyNode) dmalloc (sizeof (*x)); sort sort; x->tok = t; x->hasStoreRefList = TRUE; x->modifiesNothing = FALSE; x->list = y; /* check that all storeRef's are modifiable */ storeRefNodeList_elements (y, sr) { if (storeRefNode_isTerm (sr)) { sort = sr->content.term->sort; if (!sort_mutable (sort) && sort_isValidSort (sort)) { ltoken errtok = termNode_errorToken (sr->content.term); lclerror (errtok, message ("Term denoting immutable object used in modifies list: %q", termNode_unparse (sr->content.term))); } } else { if (!storeRefNode_isSpecial (sr)) { sort = lclTypeSpecNode2sort (sr->content.type); if (storeRefNode_isObj (sr)) { sort = sort_makeObj (sort); } if (!sort_mutable (sort)) { ltoken errtok = lclTypeSpecNode_errorToken (sr->content.type); lclerror (errtok, message ("Immutable type used in modifies list: %q", sort_unparse (sort))); } } } } end_storeRefNodeList_elements; return (x); } /*@observer@*/ ltoken termNode_errorToken (/*@null@*/ termNode n) { if (n != (termNode) 0) { switch (n->kind) { case TRM_LITERAL: case TRM_UNCHANGEDALL: case TRM_UNCHANGEDOTHERS: case TRM_SIZEOF: case TRM_CONST: case TRM_VAR: case TRM_ZEROARY: /* also the default kind, when no in symbol table */ return n->literal; case TRM_QUANTIFIER: return n->quantified->open; case TRM_APPLICATION: if (n->name != NULL) { if (n->name->isOpId) { return n->name->content.opid; } else { llassert (n->name->content.opform != NULL); return n->name->content.opform->tok; } } else { return ltoken_undefined; } } } return ltoken_undefined; } /*@observer@*/ ltoken nameNode_errorToken (/*@null@*/ nameNode nn) { if (nn != (nameNode) 0) { if (nn->isOpId) { return nn->content.opid; } else { if (nn->content.opform != NULL) { return nn->content.opform->tok; } } } return ltoken_undefined; } /*@observer@*/ ltoken lclTypeSpecNode_errorToken (/*@null@*/ lclTypeSpecNode t) { if (t != (lclTypeSpecNode) 0) { switch (t->kind) { case LTS_TYPE: { llassert (t->content.type != NULL); if (ltokenList_empty (t->content.type->ctypes)) break; else return (ltokenList_head (t->content.type->ctypes)); } case LTS_STRUCTUNION: llassert (t->content.structorunion != NULL); return t->content.structorunion->tok; case LTS_ENUM: llassert (t->content.enumspec != NULL); return t->content.enumspec->tok; case LTS_CONJ: return (lclTypeSpecNode_errorToken (t->content.conj->a)); } } return ltoken_undefined; } static bool sort_member_modulo_cstring (sort s, /*@null@*/ termNode t) { if (t != (termNode) 0) { if (t->kind == TRM_LITERAL) { /* allow multiple types */ sortNode sn; sortSet_elements (t->possibleSorts, el) { if (sort_compatible_modulo_cstring (s, el)) { return TRUE; } } end_sortSet_elements; sn = sort_lookup (s); if (sn->kind == SRT_PTR) { char *lit = lsymbol_toChars (ltoken_getText (t->literal)); if (lit != NULL) { long val = 0; if (sscanf (lit, "%ld", &val) == 1) { if (val == 0) return TRUE; } } } return FALSE; } else { return sort_compatible_modulo_cstring (s, t->sort); } } return FALSE; } /*@only@*/ letDeclNode makeLetDeclNode (ltoken varid, /*@only@*/ /*@null@*/ lclTypeSpecNode t, /*@only@*/ termNode term) { letDeclNode x = (letDeclNode) dmalloc (sizeof (*x)); varInfo vi = (varInfo) dmalloc (sizeof (*vi)); ltoken errtok; sort s, termsort; if (t != (lclTypeSpecNode) 0) { /* check varid has the same sort as term */ s = lclTypeSpecNode2sort (t); termsort = term->sort; /* should keep the arguments in order */ if (!sort_member_modulo_cstring (s, term) && !term->error_reported) { errtok = termNode_errorToken (term); /* errorShowPoint (inputStream_thisLine (lclsource), ltoken_getCol (errtok)); */ /* sprintf (ERRMSG, "expect `%s' type but given term has `%s' type", sort_unparse (s), sort_unparse (termsort)); */ lclerror (errtok, message ("Let declaration expects type %q", sort_unparse (s))); /* evs --- don't know how to generated this message or what it means? */ } } else { s = term->sort; } /* assign variable its type and sort, store in symbol table */ vi->id = ltoken_copy (varid); vi->kind = VRK_LET; vi->sort = s; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); x->varid = varid; x->sortspec = t; x->term = term; x->sort = sort_makeNoSort (); return (x); } /*@only@*/ programNode makeProgramNodeAction (/*@only@*/ programNodeList x, actionKind k) { programNode n = (programNode) dmalloc (sizeof (*n)); n->wrapped = 0; n->kind = k; n->content.args = x; return (n); } /*@only@*/ programNode makeProgramNode (/*@only@*/ stmtNode x) { programNode n = (programNode) dmalloc (sizeof (*n)); n->wrapped = 0; n->kind = ACT_SELF; n->content.self = x; return (n); } /*@only@*/ typeNode makeAbstractTypeNode (/*@only@*/ abstractNode x) { typeNode n = (typeNode) dmalloc (sizeof (*n)); n->kind = TK_ABSTRACT; n->content.abstract = x; return (n); } /*@only@*/ typeNode makeExposedTypeNode (/*@only@*/ exposedNode x) { typeNode n = (typeNode) dmalloc (sizeof (*n)); n->kind = TK_EXPOSED; n->content.exposed = x; return (n); } /* ** evs added 8 Sept 1993 */ /*@only@*/ importNode importNode_makePlain (/*@only@*/ ltoken t) { importNode imp = (importNode) dmalloc (sizeof (*imp)); imp->kind = IMPPLAIN; imp->val = t; return (imp); } /*@only@*/ importNode importNode_makeBracketed (/*@only@*/ ltoken t) { importNode imp = (importNode) dmalloc (sizeof (*imp)); imp->kind = IMPBRACKET; imp->val = t; return (imp); } static cstring extractQuote (/*@only@*/ cstring s) { size_t len = cstring_length (s); char *sc = cstring_toCharsSafe (s); cstring t; llassert (len > 1); *(sc + len - 1) = '\0'; t = cstring_fromChars (mstring_copy (sc + 1)); cstring_free (s); return (t); } /*@only@*/ importNode importNode_makeQuoted (/*@only@*/ ltoken t) { importNode imp = (importNode) dmalloc (sizeof (*imp)); cstring q = extractQuote (cstring_copy (ltoken_getRawString (t))); imp->kind = IMPQUOTE; ltoken_setRawText (t, lsymbol_fromString (q)); imp->val = t; cstring_free (q); return (imp); } /* ** check that is it '<' and '>' ** should probably be in a different file? */ static void cylerror (/*@only@*/ char *s) { ylerror(s); sfree (s); } void checkBrackets (ltoken lb, ltoken rb) { /* no attempt at error recovery...not really necessary */ cstring tname; tname = ltoken_getRawString (lb); if (!cstring_equalLit (tname, "<")) { cylerror (cstring_toCharsSafeO (message ("Invalid import token: %s", tname))); } tname = ltoken_getRawString (rb); if (!cstring_equalLit (tname, ">")) { cylerror (cstring_toCharsSafeO (message ("Invalid import token: %s", tname))); } } /*@only@*/ traitRefNode makeTraitRefNode (/*@only@*/ ltokenList fl, /*@only@*/ renamingNode r) { traitRefNode n = (traitRefNode) dmalloc (sizeof (*n)); n->traitid = fl; n->rename = r; return (n); } /* ** printLeaves: no commas */ static /*@only@*/ cstring printLeaves (ltokenList f) { bool firstone = TRUE; cstring s = cstring_undefined; ltokenList_elements (f, i) { if (firstone) { s = cstring_copy (ltoken_unparse (i)); firstone = FALSE; } else { s = message ("%q %s", s, ltoken_unparse (i)); } } end_ltokenList_elements; return s; } /*@only@*/ cstring printLeaves2 (ltokenList f) { return (ltokenList_unparse (f)); } /*@only@*/ cstring printRawLeaves2 (ltokenList f) { bool first = TRUE; cstring s = cstring_undefined; ltokenList_elements (f, i) { if (first) { s = message ("%s", ltoken_getRawString (i)); first = FALSE; } else s = message ("%q, %s", s, ltoken_getRawString (i)); } end_ltokenList_elements; return s; } /*@only@*/ renamingNode makeRenamingNode (/*@only@*/ typeNameNodeList n, /*@only@*/ replaceNodeList r) { renamingNode ren = (renamingNode) dmalloc (sizeof (*ren)); if (typeNameNodeList_empty (n)) { ren->is_replace = TRUE; ren->content.replace = r; typeNameNodeList_free (n); } else { nameAndReplaceNode nr = (nameAndReplaceNode) dmalloc (sizeof (*nr)); nr->replacelist = r; nr->namelist = n; ren->is_replace = FALSE; ren->content.name = nr; } return (ren); } /*@only@*/ cstring renamingNode_unparse (/*@null@*/ renamingNode x) { if (x != (renamingNode) 0) { if (x->is_replace) { return (replaceNodeList_unparse (x->content.replace)); } else { return (message ("%q%q", typeNameNodeList_unparse (x->content.name->namelist), replaceNodeList_unparse (x->content.name->replacelist))); } } return cstring_undefined; } /*@only@*/ replaceNode makeReplaceNameNode (ltoken t, typeNameNode tn, nameNode nn) { replaceNode r = (replaceNode) dmalloc (sizeof (*r)); r->tok = t; r->isCType = FALSE; r->typename = tn; r->content.renamesortname.name = nn; r->content.renamesortname.signature = (sigNode) NULL; return (r); } /*@only@*/ replaceNode makeReplaceNode (ltoken t, typeNameNode tn, bool is_ctype, ltoken ct, nameNode nn, sigNode sn) { replaceNode r = (replaceNode) dmalloc (sizeof (*r)); r->tok = t; r->isCType = is_ctype; r->typename = tn; if (is_ctype) { r->content.ctype = ct; sigNode_free (sn); nameNode_free (nn); } else { r->content.renamesortname.name = nn; r->content.renamesortname.signature = sn; ltoken_free (ct); } return (r); } /*@only@*/ cstring replaceNode_unparse (/*@null@*/ replaceNode x) { if (x != (replaceNode) 0) { cstring st; st = message ("%q for ", typeNameNode_unparse (x->typename)); if (x->isCType) { st = message ("%q%s", st, ltoken_getRawString (x->content.ctype)); } else { st = message ("%q%q%q", st, nameNode_unparse (x->content.renamesortname.name), sigNode_unparse (x->content.renamesortname.signature)); } return st; } return cstring_undefined; } /*@only@*/ nameNode makeNameNodeForm (/*@only@*/ /*@null@*/ opFormNode opform) { nameNode nn = (nameNode) dmalloc (sizeof (*nn)); nn->isOpId = FALSE; nn->content.opform = opform; return (nn); } /*@only@*/ nameNode makeNameNodeId (/*@only@*/ ltoken opid) { nameNode nn = (nameNode) dmalloc (sizeof (*nn)); /* ** current LSL -syms output bug produces "if_then_else_" rather ** than 6 separate tokens */ if (ltoken_getText (opid) == ConditionalSymbol) { opFormNode opform = makeOpFormNode (ltoken_undefined, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); nn->isOpId = FALSE; nn->content.opform = opform; ltoken_free (opid); } else { nn->isOpId = TRUE; nn->content.opid = opid; } return (nn); } /*@only@*/ cstring nameNode_unparse (/*@null@*/ nameNode n) { if (n != (nameNode) 0) { if (n->isOpId) { return (cstring_copy (ltoken_getRawString (n->content.opid))); /*!!!*/ } else { return (opFormNode_unparse (n->content.opform)); } } return cstring_undefined; } /*@only@*/ sigNode makesigNode (ltoken t, /*@only@*/ ltokenList domain, ltoken range) { sigNode s = (sigNode) dmalloc (sizeof (*s)); unsigned long int key; /* ** Assign a hash key here to speed up lookup of operators. */ s->tok = t; s->domain = domain; s->range = range; key = MASH (0, ltoken_getText (range)); ltokenList_elements (domain, id) { lsymbol sym = ltoken_getText (id); key = MASH (key, sym); } end_ltokenList_elements; s->key = key; return (s); } cstring sigNode_unparse (/*@null@*/ sigNode n) { if (n != (sigNode) 0) { return (message (":%q -> %s", printLeaves2 (n->domain), ltoken_unparse (n->range))); } return cstring_undefined; } void sigNode_markOwned (sigNode n) { sfreeEventually (n); } /*@only@*/ cstring sigNode_unparseText (/*@null@*/ sigNode n) { if (n != (sigNode) 0) { return (message ("%q -> %s", printLeaves2 (n->domain), ltoken_unparse (n->range))); } return cstring_undefined; } static unsigned long opFormNode2key (opFormNode op, opFormKind k) { unsigned long int key; switch (k) { case OPF_IF: /* OPF_IF is the first enum, so it's 0 */ /*@-type@*/ key = MASH (k, k + 1); /*@=type@*/ break; case OPF_ANYOP: case OPF_MANYOP: case OPF_ANYOPM: case OPF_MANYOPM: { /* treat eq and = the same */ lsymbol sym = ltoken_getText (op->content.anyop); if (sym == equalSymbol) { key = MASH (k, eqSymbol); } else { key = MASH (k, ltoken_getText (op->content.anyop)); } break; } case OPF_MIDDLE: case OPF_MMIDDLE: case OPF_MIDDLEM: case OPF_MMIDDLEM: case OPF_BMIDDLE: case OPF_BMMIDDLE: case OPF_BMIDDLEM: case OPF_BMMIDDLEM: key = MASH (k, op->content.middle); key = MASH (key, ltoken_getRawText (op->tok)); break; case OPF_SELECT: case OPF_MAP: case OPF_MSELECT: case OPF_MMAP: key = MASH (k, ltoken_getRawText (op->content.id)); break; default: key = 0; } return key; } /*@only@*/ opFormNode makeOpFormNode (ltoken t, opFormKind k, opFormUnion u, ltoken close) { opFormNode n = (opFormNode) dmalloc (sizeof (*n)); unsigned long int key = 0; /* ** Assign a hash key here to speed up lookup of operators. */ n->tok = t; n->close = close; n->kind = k; switch (k) { case OPF_IF: n->content.middle = 0; /* OPF_IF is the first enum, so it's 0 */ key = MASH /*@+enumint@*/ (k, k + 1) /*@=enumint@*/; break; case OPF_ANYOP: case OPF_MANYOP: case OPF_ANYOPM: case OPF_MANYOPM: { /* treat eq and = the same */ lsymbol sym = ltoken_getText (u.anyop); if (sym == equalSymbol) { key = MASH (k, eqSymbol); } else { key = MASH (k, ltoken_getText (u.anyop)); } n->content = u; break; } case OPF_MIDDLE: case OPF_MMIDDLE: case OPF_MIDDLEM: case OPF_MMIDDLEM: case OPF_BMIDDLE: case OPF_BMMIDDLE: case OPF_BMIDDLEM: case OPF_BMMIDDLEM: n->content = u; key = MASH (k, u.middle); key = MASH (key, ltoken_getRawText (t)); break; case OPF_SELECT: case OPF_MAP: case OPF_MSELECT: case OPF_MMAP: key = MASH (k, ltoken_getRawText (u.id)); n->content = u; break; default: { llbug (message ("makeOpFormNode: unknown opFormKind: %d", (int) k)); } } n->key = key; return (n); } static cstring printMiddle (int j) { int i; char *s = mstring_createEmpty (); for (i = j; i >= 1; i--) { s = mstring_concatFree1 (s, "__"); if (i != 1) { s = mstring_concatFree1 (s, ", "); } } return cstring_fromCharsO (s); } /*@only@*/ cstring opFormNode_unparse (/*@null@*/ opFormNode n) { if (n != (opFormNode) 0) { switch (n->kind) { case OPF_IF: return (cstring_makeLiteral ("if __ then __ else __ ")); case OPF_ANYOP: return (cstring_copy (ltoken_getRawString (n->content.anyop))); case OPF_MANYOP: return (message ("__ %s", ltoken_getRawString (n->content.anyop))); case OPF_ANYOPM: return (message ("%s __ ", ltoken_getRawString (n->content.anyop))); case OPF_MANYOPM: return (message ("__ %s __ ", ltoken_getRawString (n->content.anyop))); case OPF_MIDDLE: return (message ("%s %q %s", ltoken_getRawString (n->tok), printMiddle (n->content.middle), ltoken_getRawString (n->close))); case OPF_MMIDDLE: return (message ("__ %s %q %s", ltoken_getRawString (n->tok), printMiddle (n->content.middle), ltoken_getRawString (n->close))); case OPF_MIDDLEM: return (message ("%s %q %s __", ltoken_getRawString (n->tok), printMiddle (n->content.middle), ltoken_getRawString (n->close))); case OPF_MMIDDLEM: return (message ("__ %s%q %s __", ltoken_getRawString (n->tok), printMiddle (n->content.middle), ltoken_getRawString (n->close))); case OPF_BMIDDLE: return (message ("[%q]", printMiddle (n->content.middle))); case OPF_BMMIDDLE: return (message ("__ [%q]", printMiddle (n->content.middle))); case OPF_BMIDDLEM: return (message ("[%q] __", printMiddle (n->content.middle))); case OPF_BMMIDDLEM: return (message ("__ [%q] __", printMiddle (n->content.middle))); case OPF_SELECT: return (message (" \\select %s", ltoken_getRawString (n->content.id))); case OPF_MAP: return (message (" \\field_arrow%s", ltoken_getRawString (n->content.id))); case OPF_MSELECT: return (message ("__ \\select %s", ltoken_getRawString (n->content.id))); case OPF_MMAP: return (message ("__ \\field_arrow %s", ltoken_getRawString (n->content.id))); default: llfatalbug (message ("opFormNodeUnparse: unknown kind: %d", (int) n->kind)); } } return cstring_undefined; } /*@only@*/ typeNameNode makeTypeNameNode (bool isObj, lclTypeSpecNode t, abstDeclaratorNode n) { typeNameNode tn = (typeNameNode) dmalloc (sizeof (*tn)); typeNamePack p = (typeNamePack) dmalloc (sizeof (*p)); tn->isTypeName = TRUE; p->isObj = isObj; p->type = t; p->abst = n; tn->opform = (opFormNode) 0; tn->typename = p; return (tn); } /*@only@*/ typeNameNode makeTypeNameNodeOp (opFormNode n) { typeNameNode t = (typeNameNode) dmalloc (sizeof (*t)); t->typename = (typeNamePack) 0; t->opform = n; t->isTypeName = FALSE; return (t); } /*@only@*/ cstring typeNameNode_unparse (/*@null@*/ typeNameNode n) { if (n != (typeNameNode) 0) { if (n->isTypeName) { cstring st = cstring_undefined; typeNamePack p = n->typename; llassert (p != NULL); if (p->isObj) st = cstring_makeLiteral ("obj "); return (message ("%q%q%q", st, lclTypeSpecNode_unparse (p->type), abstDeclaratorNode_unparse (p->abst))); } else return (opFormNode_unparse (n->opform)); } return cstring_undefined; } /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeConj (/*@null@*/ lclTypeSpecNode a, /*@null@*/ lclTypeSpecNode b) { lclTypeSpecNode n = (lclTypeSpecNode) dmalloc (sizeof (*n)); n->kind = LTS_CONJ; n->pointers = pointers_undefined; n->quals = qualList_new (); n->content.conj = (lclconj) dmalloc (sizeof (*n->content.conj)); n->content.conj->a = a; n->content.conj->b = b; return (n); } /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeType (/*@null@*/ CTypesNode x) { lclTypeSpecNode n = (lclTypeSpecNode) dmalloc (sizeof (*n)); n->kind = LTS_TYPE; n->pointers = pointers_undefined; n->content.type = x; n->quals = qualList_new (); return (n); } /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeSU (/*@null@*/ strOrUnionNode x) { lclTypeSpecNode n = (lclTypeSpecNode) dmalloc (sizeof (*n)); n->kind = LTS_STRUCTUNION; n->pointers = pointers_undefined; n->content.structorunion = x; n->quals = qualList_new (); return (n); } /*@only@*/ lclTypeSpecNode makeLclTypeSpecNodeEnum (/*@null@*/ enumSpecNode x) { lclTypeSpecNode n = (lclTypeSpecNode) dmalloc (sizeof (*n)); n->quals = qualList_new (); n->kind = LTS_ENUM; n->pointers = pointers_undefined; n->content.enumspec = x; return (n); } lclTypeSpecNode lclTypeSpecNode_addQual (lclTypeSpecNode n, qual q) { llassert (lclTypeSpecNode_isDefined (n)); n->quals = qualList_add (n->quals, q); return n; } /*@only@*/ cstring lclTypeSpecNode_unparse (/*@null@*/ lclTypeSpecNode n) { if (n != (lclTypeSpecNode) 0) { switch (n->kind) { case LTS_TYPE: llassert (n->content.type != NULL); return (printLeaves (n->content.type->ctypes)); case LTS_STRUCTUNION: return (strOrUnionNode_unparse (n->content.structorunion)); case LTS_ENUM: return (enumSpecNode_unparse (n->content.enumspec)); case LTS_CONJ: return (lclTypeSpecNode_unparse (n->content.conj->a)); default: llfatalbug (message ("lclTypeSpecNode_unparse: unknown lclTypeSpec kind: %d", (int) n->kind)); } } return cstring_undefined; } /*@only@*/ enumSpecNode makeEnumSpecNode (ltoken t, ltoken optTagId, /*@owned@*/ ltokenList enums) { enumSpecNode n = (enumSpecNode) dmalloc (sizeof (*n)); tagInfo ti; smemberInfo *top = smemberInfo_undefined; n->tok = t; n->opttagid = ltoken_copy (optTagId); n->enums = enums; /* generate sort for this LCL type */ n->sort = sort_makeEnum (optTagId); if (!ltoken_isUndefined (optTagId)) { /* First, check to see if tag is already defined */ ti = symtable_tagInfo (g_symtab, ltoken_getText (optTagId)); if (tagInfo_exists (ti)) { if (ti->kind == TAG_ENUM) { /* 23 Sep 1995 --- had been noting here...is this right? */ ti->content.enums = enums; ti->sort = n->sort; ti->imported = context_inImport (); } else { lclerror (optTagId, message ("Tag %s previously defined as %q, redefined as enum", ltoken_getRawString (optTagId), tagKind_unparse (ti->kind))); /* evs --- shouldn't they be in different name spaces? */ } ltoken_free (optTagId); } else { ti = (tagInfo) dmalloc (sizeof (*ti)); ti->kind = TAG_ENUM; ti->id = optTagId; ti->content.enums = enums; ti->sort = n->sort; ti->imported = context_inImport (); /* First, store tag info in symbol table */ (void) symtable_enterTag (g_symtab, ti); } } /* check that enumeration constants are unique */ ltokenList_reset (enums); while (!ltokenList_isFinished (enums)) { ltoken c = ltokenList_current (enums); smemberInfo *ei = (smemberInfo *) dmalloc (sizeof (*ei)); ei->name = ltoken_getText (c); ei->next = top; ei->sort = n->sort; top = ei; if (!varInfo_exists (symtable_varInfo (g_symtab, ltoken_getText (c)))) { /* put info into symbol table */ varInfo vi = (varInfo) dmalloc (sizeof (*vi)); vi->id = ltoken_copy (c); vi->kind = VRK_ENUM; vi->sort = n->sort; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); } else { lclerror (c, message ("Enumerated value redeclared: %s", ltoken_getRawString (c))); ltokenList_removeCurrent (enums); } ltokenList_advance (enums); /*@-branchstate@*/ } /*@=branchstate@*/ (void) sort_updateEnum (n->sort, top); return (n); } /*@only@*/ enumSpecNode makeEnumSpecNode2 (ltoken t, ltoken tagid) { /* a reference, not a definition */ enumSpecNode n = (enumSpecNode) dmalloc (sizeof (*n)); tagInfo ti = symtable_tagInfo (g_symtab, ltoken_getText (tagid)); n->tok = t; n->opttagid = tagid; n->enums = ltokenList_new (); if (tagInfo_exists (ti)) { if (ti->kind == TAG_ENUM) { n->sort = ti->sort; } else { n->sort = sort_makeNoSort (); lclerror (tagid, message ("Tag %s defined as %q, used as enum", ltoken_getRawString (tagid), tagKind_unparse (ti->kind))); } } else { n->sort = sort_makeNoSort (); lclerror (t, message ("Undefined type: enum %s", ltoken_getRawString (tagid))); } return (n); } /*@only@*/ cstring enumSpecNode_unparse (/*@null@*/ enumSpecNode n) { if (n != (enumSpecNode) 0) { cstring s = cstring_makeLiteral ("enum "); if (!ltoken_isUndefined (n->opttagid)) { s = message ("%q%s ", s, ltoken_getRawString (n->opttagid)); } s = message ("%q{%q}", s, printLeaves2 (n->enums)); return s; } return cstring_undefined; } /*@only@*/ strOrUnionNode makestrOrUnionNode (ltoken str, suKind k, ltoken opttagid, /*@only@*/ stDeclNodeList x) { strOrUnionNode n = (strOrUnionNode) dmalloc (sizeof (*n)); lsymbolSet set = lsymbolSet_new (); declaratorNodeList declarators; sort fieldsort, tsort1, tsort2; smemberInfo *mi, *top = smemberInfo_undefined; bool doTag = FALSE; bool isStruct = (k == SU_STRUCT); tagInfo t; n->kind = k; n->tok = str; n->opttagid = ltoken_copy (opttagid); n->structdecls = x; n->sort = isStruct ? sort_makeStr (opttagid) : sort_makeUnion (opttagid); if (!ltoken_isUndefined (opttagid)) { /* First, check to see if tag is already defined */ t = symtable_tagInfo (g_symtab, ltoken_getText (opttagid)); if (tagInfo_exists (t)) { if ((t->kind == TAG_FWDUNION && k == SU_UNION) || (t->kind == TAG_FWDSTRUCT && k == SU_STRUCT)) { /* to allow self-recursive types and forward tag declarations */ t->content.decls = stDeclNodeList_copy (x); /* update tag info */ t->sort = n->sort; } else { lclerror (opttagid, message ("Tag %s previously defined as %q, used as %q", ltoken_getRawString (opttagid), tagKind_unparse (t->kind), cstring_makeLiteral (isStruct ? "struct" : "union"))); } } else { doTag = TRUE; } } else { doTag = TRUE; } if (doTag && !ltoken_isUndefined (opttagid)) { t = (tagInfo) dmalloc (sizeof (*t)); /* can either override prev defn or use prev defn */ /* override it so as to detect more errors */ t->kind = (k == SU_STRUCT) ? TAG_STRUCT : TAG_UNION; t->id = opttagid; t->content.decls = stDeclNodeList_copy (x); t->sort = n->sort; t->imported = FALSE; /* Next, update tag info in symbol table */ (void) symtable_enterTagForce (g_symtab, t); } /* check no duplicate field names */ stDeclNodeList_elements (x, i) { fieldsort = lclTypeSpecNode2sort (i->lcltypespec); /* need the locations, not values */ /* fieldsort = sort_makeObj (fieldsort); */ /* 2/19/93, was fieldsort = sort_makeGlobal (fieldsort); */ declarators = i->declarators; declaratorNodeList_elements (declarators, decl) { lsymbol fieldname; mi = (smemberInfo *) dmalloc (sizeof (*mi)); /* need to make dynamic copies */ fieldname = ltoken_getText (decl->id); /* 2/19/93, added */ tsort1 = typeExpr2ptrSort (fieldsort, decl->type); tsort2 = sort_makeGlobal (tsort1); mi->name = fieldname; mi->sort = tsort2; /* fieldsort; */ mi->next = top; top = mi; if (lsymbolSet_member (set, fieldname)) { lclerror (decl->id, message ("Field name reused: %s", ltoken_getRawString (decl->id))); } else { (void) lsymbolSet_insert (set, fieldname); } /*@-branchstate@*/ } end_declaratorNodeList_elements; /*@=branchstate@*/ } end_stDeclNodeList_elements; if (k == SU_STRUCT) { (void) sort_updateStr (n->sort, top); } else { (void) sort_updateUnion (n->sort, top); } /* We shall keep the info with both tags and types if any of them are present. */ lsymbolSet_free (set); return (n); } /*@only@*/ strOrUnionNode makeForwardstrOrUnionNode (ltoken str, suKind k, ltoken tagid) { strOrUnionNode n = (strOrUnionNode) dmalloc (sizeof (*n)); sort sort = sort_makeNoSort (); tagInfo t; /* a reference, not a definition */ n->kind = k; n->tok = str; n->opttagid = tagid; n->structdecls = stDeclNodeList_new (); /* get sort for this LCL type */ t = symtable_tagInfo (g_symtab, ltoken_getText (tagid)); if (tagInfo_exists (t)) { sort = t->sort; if (!(((t->kind == TAG_STRUCT || t->kind == TAG_FWDSTRUCT) && k == SU_STRUCT) || ((t->kind == TAG_UNION || t->kind == TAG_FWDUNION) && k == SU_UNION))) { lclerror (tagid, message ("Tag %s previously defined as %q, used as %q", ltoken_getRawString (tagid), tagKind_unparse (t->kind), cstring_makeLiteral ((k == SU_STRUCT) ? "struct" : "union"))); } } else { /* ** changed from error: 31 Mar 1994 ** ** lclerror (str, message ("Undefined type: %s %s", s, ltoken_getRawString (tagid)); ** */ /* forward struct's and union's are ok... */ if (k == SU_STRUCT) { (void) checkAndEnterTag (TAG_FWDSTRUCT, ltoken_copy (tagid)); lhForwardStruct (tagid); sort = sort_makeStr (tagid); } else { (void) checkAndEnterTag (TAG_FWDUNION, ltoken_copy (tagid)); lhForwardUnion (tagid); sort = sort_makeUnion (tagid); } } n->sort = sort; return (n); } /*@only@*/ cstring strOrUnionNode_unparse (/*@null@*/ strOrUnionNode n) { if (n != (strOrUnionNode) 0) { cstring s; switch (n->kind) { case SU_STRUCT: s = cstring_makeLiteral ("struct "); break; case SU_UNION: s = cstring_makeLiteral ("union "); break; BADDEFAULT } if (!ltoken_isUndefined (n->opttagid)) { s = message ("%q%s ", s, ltoken_getRawString (n->opttagid)); } s = message ("%q{%q}", s, stDeclNodeList_unparse (n->structdecls)); return s; } return cstring_undefined; } /*@only@*/ stDeclNode makestDeclNode (lclTypeSpecNode s, declaratorNodeList x) { stDeclNode n = (stDeclNode) dmalloc (sizeof (*n)); n->lcltypespec = s; n->declarators = x; return n; } /*@only@*/ typeExpr makeFunctionNode (typeExpr x, paramNodeList p) { typeExpr y = (typeExpr) dmalloc (sizeof (*y)); y->wrapped = 0; y->kind = TEXPR_FCN; y->content.function.returntype = x; y->content.function.args = p; y->sort = sort_makeNoSort (); return (y); } static /*@observer@*/ ltoken extractDeclarator (/*@null@*/ typeExpr t) { if (t != (typeExpr) 0) { switch (t->kind) { case TEXPR_BASE: return t->content.base; case TEXPR_PTR: return (extractDeclarator (t->content.pointer)); case TEXPR_ARRAY: return (extractDeclarator (t->content.array.elementtype)); case TEXPR_FCN: return (extractDeclarator (t->content.function.returntype)); } } return ltoken_undefined; } /*@only@*/ typeExpr makeTypeExpr (ltoken t) { typeExpr x = (typeExpr) dmalloc (sizeof (*x)); x->wrapped = 0; x->kind = TEXPR_BASE; x->content.base = t; x->sort = sort_makeNoSort (); return (x); } /*@only@*/ declaratorNode makeDeclaratorNode (typeExpr t) { declaratorNode x = (declaratorNode) dmalloc (sizeof (*x)); x->id = ltoken_copy (extractDeclarator (t)); x->type = t; x->isRedecl = FALSE; return (x); } static /*@only@*/ declaratorNode makeUnknownDeclaratorNode (/*@only@*/ ltoken t) { declaratorNode x = (declaratorNode) dmalloc (sizeof (*x)); x->id = t; x->type = (typeExpr) 0; x->isRedecl = FALSE; return (x); } static /*@only@*/ cstring printTypeExpr2 (/*@null@*/ typeExpr x) { paramNodeList params; if (x != (typeExpr) 0) { cstring s; /* print out types in reverse order */ switch (x->kind) { case TEXPR_BASE: return (message ("%s ", ltoken_getRawString (x->content.base))); case TEXPR_PTR: return (message ("%qptr to ", printTypeExpr2 (x->content.pointer))); case TEXPR_ARRAY: return (message ("array[%q] of %q", termNode_unparse (x->content.array.size), printTypeExpr2 (x->content.array.elementtype))); case TEXPR_FCN: s = printTypeExpr2 (x->content.function.returntype); params = x->content.function.args; if (!paramNodeList_empty (params)) { s = message ("%qfcn with args: (%q)", s, paramNodeList_unparse (x->content.function.args)); } else s = message ("%qfcn with no args", s); return s; default: llfatalbug (message ("printTypeExpr2: unknown typeExprKind: %d", (int) x->kind)); } } return cstring_undefined; } /*@only@*/ cstring declaratorNode_unparse (declaratorNode x) { return (typeExpr_unparse (x->type)); } /*@only@*/ declaratorNode declaratorNode_copy (declaratorNode x) { declaratorNode ret = (declaratorNode) dmalloc (sizeof (*ret)); ret->type = typeExpr_copy (x->type); ret->id = ltoken_copy (x->id); ret->isRedecl = x->isRedecl; return (ret); } static /*@null@*/ typeExpr typeExpr_copy (/*@null@*/ typeExpr x) { if (x == NULL) { return NULL; } else { typeExpr ret = (typeExpr) dmalloc (sizeof (*ret)); ret->wrapped = x->wrapped; ret->kind = x->kind; switch (ret->kind) { case TEXPR_BASE: ret->content.base = ltoken_copy (x->content.base); break; case TEXPR_PTR: ret->content.pointer = typeExpr_copy (x->content.pointer); break; case TEXPR_ARRAY: ret->content.array.elementtype = typeExpr_copy (x->content.array.elementtype); ret->content.array.size = termNode_copy (x->content.array.size); break; case TEXPR_FCN: ret->content.function.returntype = typeExpr_copy (x->content.function.returntype); ret->content.function.args = paramNodeList_copy (x->content.function.args); break; } ret->sort = x->sort; return ret; } } static /*@only@*/ cstring typeExpr_unparseCode (/*@null@*/ typeExpr x) { /* print out types in order of appearance in source */ cstring s = cstring_undefined; if (x != (typeExpr) 0) { switch (x->kind) { case TEXPR_BASE: return (cstring_copy (ltoken_getRawString (x->content.base))); case TEXPR_PTR: return (typeExpr_unparseCode (x->content.pointer)); case TEXPR_ARRAY: return (typeExpr_unparseCode (x->content.array.elementtype)); case TEXPR_FCN: return (typeExpr_unparseCode (x->content.function.returntype)); } } return s; } void typeExpr_free (/*@only@*/ /*@null@*/ typeExpr x) { if (x != (typeExpr) 0) { switch (x->kind) { case TEXPR_BASE: break; case TEXPR_PTR: typeExpr_free (x->content.pointer); break; case TEXPR_ARRAY: typeExpr_free (x->content.array.elementtype); termNode_free (x->content.array.size); break; case TEXPR_FCN: typeExpr_free (x->content.function.returntype); paramNodeList_free (x->content.function.args); break; /*@-branchstate@*/ } /*@=branchstate@*/ sfree (x); } } /*@only@*/ cstring declaratorNode_unparseCode (declaratorNode x) { return (typeExpr_unparseCode (x->type)); } /*@only@*/ cstring typeExpr_unparse (/*@null@*/ typeExpr x) { cstring s = cstring_undefined; /* print out types in order of appearance in source */ paramNodeList params; int i; if (x != (typeExpr) 0) { cstring front = cstring_undefined; cstring back = cstring_undefined; llassert (x->wrapped < 100); for (i = x->wrapped; i >= 1; i--) { front = cstring_appendChar (front, '('); back = cstring_appendChar (back, ')'); } switch (x->kind) { case TEXPR_BASE: s = message ("%q%s", s, ltoken_getRawString (x->content.base)); break; case TEXPR_PTR: s = message ("%q*%q", s, typeExpr_unparse (x->content.pointer)); break; case TEXPR_ARRAY: s = message ("%q%q[%q]", s, typeExpr_unparse (x->content.array.elementtype), termNode_unparse (x->content.array.size)); break; case TEXPR_FCN: s = message ("%q%q (", s, typeExpr_unparse (x->content.function.returntype)); params = x->content.function.args; if (!paramNodeList_empty (params)) { s = message ("%q%q", s, paramNodeList_unparse (x->content.function.args)); } s = message ("%q)", s); break; } s = message ("%q%q%q", front, s, back); } else { s = cstring_makeLiteral ("?"); } return s; } /*@only@*/ cstring typeExpr_unparseNoBase (/*@null@*/ typeExpr x) { cstring s = cstring_undefined; /* print out types in order of appearance in source */ paramNodeList params; int i; if (x != (typeExpr) 0) { cstring front = cstring_undefined; cstring back = cstring_undefined; llassert (x->wrapped < 100); for (i = x->wrapped; i >= 1; i--) { front = cstring_appendChar (front, '('); back = cstring_appendChar (back, ')'); } switch (x->kind) { case TEXPR_BASE: s = message ("%q /* %s */", s, ltoken_getRawString (x->content.base)); break; case TEXPR_PTR: s = message ("%q*%q", s, typeExpr_unparseNoBase (x->content.pointer)); break; case TEXPR_ARRAY: s = message ("%q%q[%q]", s, typeExpr_unparseNoBase (x->content.array.elementtype), termNode_unparse (x->content.array.size)); break; case TEXPR_FCN: s = message ("%q%q (", s, typeExpr_unparseNoBase (x->content.function.returntype)); params = x->content.function.args; if (!paramNodeList_empty (params)) { s = message ("%q%q", s, paramNodeList_unparse (x->content.function.args)); } s = message ("%q)", s); break; } s = message ("%q%q%q", front, s, back); } else { s = cstring_makeLiteral ("?"); } return s; } cstring typeExpr_name (/*@null@*/ typeExpr x) { if (x != (typeExpr) 0) { switch (x->kind) { case TEXPR_BASE: return (cstring_copy (ltoken_getRawString (x->content.base))); case TEXPR_PTR: return (typeExpr_name (x->content.pointer)); case TEXPR_ARRAY: return (typeExpr_name (x->content.array.elementtype)); case TEXPR_FCN: return (typeExpr_name (x->content.function.returntype)); } } /* evs --- 14 Mar 1995 ** not a bug: its okay to have empty parameter names ** llbug ("typeExpr_name: null"); */ return cstring_undefined; } /*@only@*/ typeExpr makePointerNode (ltoken star, /*@only@*/ /*@returned@*/ typeExpr x) { if (x != (typeExpr)0 && (x->kind == TEXPR_FCN && (x->wrapped == 0))) { x->content.function.returntype = makePointerNode (star, x->content.function.returntype); return x; } else { typeExpr y = (typeExpr) dmalloc (sizeof (*y)); y->wrapped = 0; y->kind = TEXPR_PTR; y->content.pointer = x; y->sort = sort_makeNoSort (); ltoken_free (star); return y; } } typeExpr makeArrayNode (/*@returned@*/ typeExpr x, /*@only@*/ arrayQualNode a) { if (x != (typeExpr)0 && (x->kind == TEXPR_FCN && (x->wrapped == 0))) { /* ** Spurious errors reported here, because of referencing ** in makeArrayNode. */ /*@-usereleased@*/ x->content.function.returntype = makeArrayNode (x, a); /*@=usereleased@*/ /*@-kepttrans@*/ return x; /*@=kepttrans@*/ } else { typeExpr y = (typeExpr) dmalloc (sizeof (*y)); y->wrapped = 0; y->kind = TEXPR_ARRAY; if (a == (arrayQualNode) 0) { y->content.array.size = (termNode) 0; } else { y->content.array.size = a->term; ltoken_free (a->tok); sfree (a); } y->content.array.elementtype = x; y->sort = sort_makeNoSort (); return (y); } } /*@only@*/ constDeclarationNode makeConstDeclarationNode (lclTypeSpecNode t, initDeclNodeList decls) { constDeclarationNode n = (constDeclarationNode) dmalloc (sizeof (*n)); sort s, s2, initValueSort; ltoken varid, errtok; termNode initValue; s = lclTypeSpecNode2sort (t); initDeclNodeList_elements (decls, init) { declaratorNode vdnode = init->declarator; varInfo vi = (varInfo) dmalloc (sizeof (*vi)); varid = ltoken_copy (vdnode->id); s2 = typeExpr2ptrSort (s, vdnode->type); initValue = init->value; if (termNode_isDefined (initValue) && !initValue->error_reported) { initValueSort = initValue->sort; /* should keep the arguments in order */ if (!sort_member_modulo_cstring (s2, initValue) && !initValue->error_reported) { errtok = termNode_errorToken (initValue); lclerror (errtok, message ("Constant %s declared type %q, initialized to %q: %q", ltoken_unparse (varid), sort_unparse (s2), sort_unparse (initValueSort), termNode_unparse (initValue))); } } vi->id = varid; vi->kind = VRK_CONST; vi->sort = s2; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); } end_initDeclNodeList_elements; n->type = t; n->decls = decls; return n; } varDeclarationNode makeInternalStateNode (void) { varDeclarationNode n = (varDeclarationNode) dmalloc (sizeof (*n)); n->isSpecial = TRUE; n->sref = sRef_makeInternalState (); /*@-compdef@*/ return n; /*@=compdef@*/ } varDeclarationNode makeFileSystemNode (void) { varDeclarationNode n = (varDeclarationNode) dmalloc (sizeof (*n)); n->isSpecial = TRUE; n->sref = sRef_makeSystemState (); /*@-compdef@*/ return n; /*@=compdef@*/ } /*@only@*/ varDeclarationNode makeVarDeclarationNode (lclTypeSpecNode t, initDeclNodeList x, bool isGlobal, bool isPrivate) { varDeclarationNode n = (varDeclarationNode) dmalloc (sizeof (*n)); sort s, s2, initValueSort; ltoken varid, errtok; termNode initValue; declaratorNode vdnode; n->isSpecial = FALSE; n->qualifier = QLF_NONE; n->isGlobal = isGlobal; n->isPrivate = isPrivate; n->decls = x; s = lclTypeSpecNode2sort (t); /* t is an lclTypeSpec, its sort may not be assigned yet */ initDeclNodeList_elements (x, init) { vdnode = init->declarator; varid = vdnode->id; s2 = typeExpr2ptrSort (s, vdnode->type); initValue = init->value; if (termNode_isDefined (initValue) && !initValue->error_reported) { initValueSort = initValue->sort; /* should keep the arguments in order */ if (!sort_member_modulo_cstring (s2, initValue) && !initValue->error_reported) { errtok = termNode_errorToken (initValue); lclerror (errtok, message ("Variable %s declared type %q, initialized to %q", ltoken_unparse (varid), sort_unparse (s2), sort_unparse (initValueSort))); } } /* ** If global, check that it has been declared already, don't push ** onto symbol table yet (wrong scope, done in enteringFcnScope */ if (isGlobal) { varInfo vi = symtable_varInfo (g_symtab, ltoken_getText (varid)); if (!varInfo_exists (vi)) { lclerror (varid, message ("Undeclared global variable: %s", ltoken_getRawString (varid))); } else { if (vi->kind == VRK_CONST) { lclerror (varid, message ("Constant used in global list: %s", ltoken_getRawString (varid))); } } } else { varInfo vi = (varInfo) dmalloc (sizeof (*vi)); vi->id = ltoken_copy (varid); if (isPrivate) { vi->kind = VRK_PRIVATE; /* check that initValue is not empty */ if (initValue == (termNode) 0) { lclerror (varid, message ("Private variable must have initialization: %s", ltoken_getRawString (varid))); } } else { vi->kind = VRK_VAR; } vi->sort = sort_makeGlobal (s2); vi->export = TRUE; vdnode->isRedecl = symtable_enterVar (g_symtab, vi); varInfo_free (vi); } } end_initDeclNodeList_elements; n->type = t; return n; } /*@only@*/ initDeclNode makeInitDeclNode (declaratorNode d, termNode x) { initDeclNode n = (initDeclNode) dmalloc (sizeof (*n)); n->declarator = d; n->value = x; return n; } /*@only@*/ abstractNode makeAbstractNode (ltoken t, ltoken name, bool isMutable, bool isRefCounted, abstBodyNode a) { abstractNode n = (abstractNode) dmalloc (sizeof (*n)); sort handle; typeInfo ti = (typeInfo) dmalloc (sizeof (*ti)); n->tok = t; n->isMutable = isMutable; n->name = name; n->body = a; n->isRefCounted = isRefCounted; if (isMutable) handle = sort_makeMutable (name, ltoken_getText (name)); else handle = sort_makeImmutable (name, ltoken_getText (name)); n->sort = handle; ti->id = ltoken_createType (ltoken_getCode (ltoken_typename), SID_TYPE, ltoken_getText (name)); ti->modifiable = isMutable; ti->abstract = TRUE; ti->basedOn = handle; ti->export = TRUE; symtable_enterType (g_symtab, ti); return n; } /*@only@*/ cstring abstractNode_unparse (abstractNode n) { if (n != (abstractNode) 0) { cstring s; if (n->isMutable) s = cstring_makeLiteral ("mutable"); else s = cstring_makeLiteral ("immutable"); return (message ("%q type %s%q;", s, ltoken_getRawString (n->name), abstBodyNode_unparse (n->body))); } return cstring_undefined; } void setExposedType (lclTypeSpecNode s) { exposedType = s; } /*@only@*/ exposedNode makeExposedNode (ltoken t, lclTypeSpecNode s, declaratorInvNodeList d) { exposedNode n = (exposedNode) dmalloc (sizeof (*n)); n->tok = t; n->type = s; n->decls = d; return n; } /*@only@*/ cstring exposedNode_unparse (exposedNode n) { if (n != (exposedNode) 0) { return (message ("typedef %q %q;", lclTypeSpecNode_unparse (n->type), declaratorInvNodeList_unparse (n->decls))); } return cstring_undefined; } /*@only@*/ declaratorInvNode makeDeclaratorInvNode (declaratorNode d, abstBodyNode b) { declaratorInvNode n = (declaratorInvNode) dmalloc (sizeof (*n)); n->declarator = d; n->body = b; return (n); } /*@only@*/ cstring declaratorInvNode_unparse (declaratorInvNode d) { return (message ("%q%q", declaratorNode_unparse (d->declarator), abstBodyNode_unparseExposed (d->body))); } /*@only@*/ cstring abstBodyNode_unparse (abstBodyNode n) { if (n != (abstBodyNode) 0) { return (lclPredicateNode_unparse (n->typeinv)); } return cstring_undefined; } /*@only@*/ cstring abstBodyNode_unparseExposed (abstBodyNode n) { if (n != (abstBodyNode) 0) { return (message ("%q", lclPredicateNode_unparse (n->typeinv))); } return cstring_undefined; } /*@only@*/ cstring taggedUnionNode_unparse (taggedUnionNode n) { if (n != (taggedUnionNode) 0) { return (message ("tagged union {%q}%q;\n", stDeclNodeList_unparse (n->structdecls), declaratorNode_unparse (n->declarator))); } return cstring_undefined; } static /*@observer@*/ paramNodeList typeExpr_toParamNodeList (/*@null@*/ typeExpr te) { if (te != (typeExpr) 0) { switch (te->kind) { case TEXPR_FCN: return te->content.function.args; case TEXPR_PTR: return typeExpr_toParamNodeList (te->content.pointer); case TEXPR_ARRAY: /* return typeExpr_toParamNodeList (te->content.array.elementtype); */ case TEXPR_BASE: return paramNodeList_undefined; } } return paramNodeList_undefined; } /*@only@*/ fcnNode fcnNode_fromDeclarator (/*@only@*/ /*@null@*/ lclTypeSpecNode t, /*@only@*/ declaratorNode d) { return (makeFcnNode (qual_createUnknown (), t, d, varDeclarationNodeList_new (), varDeclarationNodeList_new (), letDeclNodeList_new (), (lclPredicateNode) 0, (lclPredicateNode) 0, (modifyNode) 0, (lclPredicateNode) 0, (lclPredicateNode) 0)); } /*@only@*/ iterNode makeIterNode (ltoken id, paramNodeList p) { iterNode x = (iterNode) dmalloc (sizeof (*x)); bool hasYield = FALSE; x->name = id; x->params = p; /* check there is at least one yield param */ paramNodeList_elements (p, pe) { if (paramNode_isYield (pe)) { hasYield = TRUE; break; } } end_paramNodeList_elements if (!hasYield) { lclerror (id, message ("Iterator has no yield parameters: %s", ltoken_getRawString (id))); } return (x); } /*@only@*/ fcnNode makeFcnNode (qual specQual, /*@null@*/ lclTypeSpecNode t, declaratorNode d, /*@null@*/ globalList g, /*@null@*/ varDeclarationNodeList privateinits, /*@null@*/ letDeclNodeList lets, /*@null@*/ lclPredicateNode checks, /*@null@*/ lclPredicateNode requires, /*@null@*/ modifyNode m, /*@null@*/ lclPredicateNode ensures, /*@null@*/ lclPredicateNode claims) { fcnNode x = (fcnNode) dmalloc (sizeof (*x)); if (d->type != (typeExpr)0 && (d->type)->kind != TEXPR_FCN) { lclerror (d->id, cstring_makeLiteral ("Attempt to specify function without parameter list")); d->type = makeFunctionNode (d->type, paramNodeList_new ()); } x->special = specQual; x->typespec = t; x->declarator = d; x->globals = g; x->inits = privateinits; x->lets = lets; x->checks = checks; x->require = requires; x->modify = m; x->ensures = ensures; x->claim = claims; /* extract info to fill in x->name =; x->signature =; */ x->name = ltoken_copy (d->id); return (x); } /*@only@*/ claimNode makeClaimNode (ltoken id, paramNodeList p, globalList g, letDeclNodeList lets, lclPredicateNode requires, programNode b, lclPredicateNode ensures) { claimNode x = (claimNode) dmalloc (sizeof (*x)); x->name = id; x->params = p; x->globals = g; x->lets = lets; x->require = requires; x->body = b; x->ensures = ensures; return (x); } /*@only@*/ lclPredicateNode makeIntraClaimNode (ltoken t, lclPredicateNode n) { ltoken_free (n->tok); n->tok = t; n->kind = LPD_INTRACLAIM; return (n); } /*@only@*/ lclPredicateNode makeRequiresNode (ltoken t, lclPredicateNode n) { ltoken_free (n->tok); n->tok = t; n->kind = LPD_REQUIRES; return (n); } /*@only@*/ lclPredicateNode makeChecksNode (ltoken t, lclPredicateNode n) { ltoken_free (n->tok); n->tok = t; n->kind = LPD_CHECKS; return (n); } /*@only@*/ lclPredicateNode makeEnsuresNode (ltoken t, lclPredicateNode n) { ltoken_free (n->tok); n->tok = t; n->kind = LPD_ENSURES; return (n); } /*@only@*/ lclPredicateNode makeLclPredicateNode (ltoken t, termNode n, lclPredicateKind k) { lclPredicateNode x = (lclPredicateNode) dmalloc (sizeof (*x)); x->tok = t; x->predicate = n; x->kind = k; return (x); } /*@only@*/ quantifierNode makeQuantifierNode (varNodeList v, ltoken quant) { quantifierNode x = (quantifierNode) dmalloc (sizeof (*x)); x->quant = quant; x->vars = v; x->isForall = cstring_equalLit (ltoken_unparse (quant), "\forall"); return (x); } /*@only@*/ arrayQualNode makeArrayQualNode (ltoken t, termNode term) { arrayQualNode x = (arrayQualNode) dmalloc (sizeof (*x)); x->tok = t; x->term = term; return (x); } /*@only@*/ varNode makeVarNode (/*@only@*/ ltoken varid, bool isObj, lclTypeSpecNode t) { varNode x = (varNode) dmalloc (sizeof (*x)); varInfo vi = (varInfo) dmalloc (sizeof (*vi)); sort sort; vi->id = ltoken_copy (varid); sort = lclTypeSpecNode2sort (t); /* 9/3/93, The following is needed because we want value sorts to be the default, object sort is generated only if there is "obj" qualifier. There are 2 cases: (1) for immutable types (including C primitive types), we need to generate the object sort if qualifier is present; (2) for array, struct and union types, they are already in their object sorts. */ sort = sort_makeVal (sort); /* both cases are now value sorts */ if (isObj) { sort = sort_makeObj (sort); } vi->sort = sort; vi->kind = VRK_QUANT; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); x->varid = varid; x->isObj = isObj; x->type = t; x->sort = sort_makeNoSort (); return (x); } /*@only@*/ abstBodyNode makeAbstBodyNode (ltoken t, fcnNodeList f) { abstBodyNode x = (abstBodyNode) dmalloc (sizeof (*x)); x->tok = t; x->typeinv = (lclPredicateNode)0; x->fcns = f; return (x); } /*@only@*/ abstBodyNode makeExposedBodyNode (ltoken t, lclPredicateNode inv) { abstBodyNode x = (abstBodyNode) dmalloc (sizeof (*x)); x->tok = t; x->typeinv = inv; x->fcns = fcnNodeList_undefined; return (x); } /*@only@*/ abstBodyNode makeAbstBodyNode2 (ltoken t, ltokenList ops) { abstBodyNode x = (abstBodyNode) dmalloc (sizeof (*x)); x->tok = t; x->typeinv = (lclPredicateNode) 0; x->fcns = fcnNodeList_new (); ltokenList_elements (ops, op) { x->fcns = fcnNodeList_add (x->fcns, fcnNode_fromDeclarator (lclTypeSpecNode_undefined, makeUnknownDeclaratorNode (ltoken_copy (op)))); } end_ltokenList_elements; ltokenList_free (ops); return (x); } /*@only@*/ stmtNode makeStmtNode (ltoken varId, ltoken fcnId, /*@only@*/ termNodeList v) { stmtNode n = (stmtNode) dmalloc (sizeof (*n)); n->lhs = varId; n->operator = fcnId; n->args = v; return (n); } /* printDeclarators -> declaratorNodeList_unparse */ static cstring abstDeclaratorNode_unparse (abstDeclaratorNode x) { return (typeExpr_unparse ((typeExpr) x)); } /*@only@*/ paramNode makeParamNode (lclTypeSpecNode t, typeExpr d) { paramNode x = (paramNode) dmalloc (sizeof (*x)); paramNode_checkQualifiers (t, d); x->type = t; x->paramdecl = d; x->kind = PNORMAL; /*< forgot this! >*/ return (x); } /*@only@*/ paramNode paramNode_elipsis (void) { paramNode x = (paramNode) dmalloc (sizeof (*x)); x->type = (lclTypeSpecNode) 0; x->paramdecl = (typeExpr) 0; x->kind = PELIPSIS; return (x); } static /*@observer@*/ ltoken typeExpr_getTok (typeExpr d) { while (d != (typeExpr)0) { if (d->kind == TEXPR_BASE) { return (d->content.base); } else { if (d->kind == TEXPR_PTR) { d = d->content.pointer; } else if (d->kind == TEXPR_ARRAY) { d = d->content.array.elementtype; } else if (d->kind == TEXPR_FCN) { d = d->content.function.returntype; } else { BADBRANCH; } } } llfatalerror (cstring_makeLiteral ("typeExpr_getTok: unreachable code")); BADEXIT; } void paramNode_checkQualifiers (lclTypeSpecNode t, typeExpr d) { bool isPointer = FALSE; bool isUser = FALSE; bool hasAlloc = FALSE; bool hasAlias = FALSE; llassert (lclTypeSpecNode_isDefined (t)); if (pointers_isUndefined (t->pointers) && (d != (typeExpr)0 && d->kind != TEXPR_PTR) && d->kind != TEXPR_ARRAY) { if (t->kind == LTS_TYPE) { sortNode sn; llassert (t->content.type != NULL); sn = sort_quietLookup (sort_getUnderlying ((t->content.type)->sort)); if (sn->kind == SRT_PTR || sn->kind == SRT_ARRAY || sn->kind == SRT_HOF || sn->kind == SRT_NONE) { isPointer = TRUE; } } } else { isPointer = TRUE; } if (d != (typeExpr)0 && d->kind != TEXPR_BASE) { if (t->kind == LTS_TYPE) { sortNode sn; llassert (t->content.type != NULL); sn = sort_quietLookup (sort_getUnderlying ((t->content.type)->sort)); if (sn->kind == SRT_PTR || sn->kind == SRT_ARRAY || sn->kind == SRT_HOF || sn->kind == SRT_NONE) { isUser = TRUE; } } } else { isPointer = TRUE; } if (d != (typeExpr)NULL) { qualList_elements (t->quals, q) { if (qual_isAllocQual (q)) { if (hasAlloc) { ltoken tok = typeExpr_getTok (d); lclerror (tok, message ("Parameter declared with multiple allocation " "qualifiers: %q", typeExpr_unparse (d))); } hasAlloc = TRUE; if (!isPointer) { ltoken tok = typeExpr_getTok (d); lclerror (tok, message ("Non-pointer declared as %s parameter: %q", qual_unparse (q), typeExpr_unparse (d))); } } if (qual_isAliasQual (q)) { if (hasAlias) { ltoken tok = typeExpr_getTok (d); lclerror (tok, message ("Parameter declared with multiple alias qualifiers: %q", typeExpr_unparse (d))); } hasAlias = TRUE; if (!(isPointer || isUser)) { ltoken tok = typeExpr_getTok (d); lclerror (tok, message ("Unsharable type declared as %s parameter: %q", qual_unparse (q), typeExpr_unparse (d))); } } } end_qualList_elements; } } /*@only@*/ cstring paramNode_unparse (paramNode x) { if (x != (paramNode) 0) { if (x->kind == PELIPSIS) { return (cstring_makeLiteral ("...")); } if (x->paramdecl != (typeExpr) 0) { /* handle (void) */ return (message ("%q %q", lclTypeSpecNode_unparse (x->type), typeExpr_unparse (x->paramdecl))); } else { return (lclTypeSpecNode_unparse (x->type)); } } return cstring_undefined; } static cstring lclTypeSpecNode_unparseAltComments (/*@null@*/ lclTypeSpecNode typespec) /*@*/ { if (typespec != (lclTypeSpecNode) 0) { cstring s = qualList_toCComments (typespec->quals); switch (typespec->kind) { case LTS_TYPE: { llassert (typespec->content.type != NULL); return (cstring_concatFree (s, printLeaves (typespec->content.type->ctypes))); } case LTS_ENUM: { bool first = TRUE; enumSpecNode n = typespec->content.enumspec; s = cstring_concatFree (s, cstring_makeLiteral ("enum")); llassert (n != NULL); if (!ltoken_isUndefined (n->opttagid)) { s = message ("%q %s", s, ltoken_unparse (n->opttagid)); } s = message ("%q {", s); ltokenList_elements (n->enums, e) { if (first) { first = FALSE; s = message ("%q%s", s, ltoken_getRawString (e)); } else s = message ("%q, %s", s, ltoken_getRawString (e)); } end_ltokenList_elements; return (message ("%q}", s)); } case LTS_STRUCTUNION: { strOrUnionNode n = typespec->content.structorunion; stDeclNodeList decls; llassert (n != NULL); switch (n->kind) { case SU_STRUCT: s = cstring_concatFree (s, cstring_makeLiteral ("struct ")); /*@switchbreak@*/ break; case SU_UNION: s = cstring_concatFree (s, cstring_makeLiteral ("union ")); /*@switchbreak@*/ break; } if (!ltoken_isUndefined (n->opttagid)) { if (stDeclNodeList_size (n->structdecls) == 0) { return (message ("%q%s", s, ltoken_unparse (n->opttagid))); } s = message ("%q%s {\n\t", s, ltoken_unparse (n->opttagid)); } else { s = message ("%q{\n\t", s); } decls = n->structdecls; stDeclNodeList_elements (decls, f) { s = message ("%q%q %q;\n\t", s, lclTypeSpecNode_unparseAltComments (f->lcltypespec), declaratorNodeList_unparse (f->declarators)); } end_stDeclNodeList_elements; return (message ("%q }", s)); } case LTS_CONJ: { cstring_free (s); return (message ("%q, %q", lclTypeSpecNode_unparseAltComments (typespec->content.conj->a), lclTypeSpecNode_unparseAltComments (typespec->content.conj->b))); } BADDEFAULT; } } else { llcontbuglit ("lclTypeSpecNode_unparseComments: null typespec"); return cstring_undefined; } BADEXIT; } cstring lclTypeSpecNode_unparseComments (/*@null@*/ lclTypeSpecNode typespec) { if (typespec != (lclTypeSpecNode) 0) { cstring s = qualList_toCComments (typespec->quals); switch (typespec->kind) { case LTS_TYPE: { llassert (typespec->content.type != NULL); return (cstring_concatFree (s, printLeaves (typespec->content.type->ctypes))); } case LTS_ENUM: { bool first = TRUE; enumSpecNode n = typespec->content.enumspec; s = cstring_concatFree (s, cstring_makeLiteral ("enum")); llassert (n != NULL); if (!ltoken_isUndefined (n->opttagid)) { s = message ("%q %s", s, ltoken_unparse (n->opttagid)); } s = message ("%q {", s); ltokenList_elements (n->enums, e) { if (first) { first = FALSE; s = message ("%q%s", s, ltoken_getRawString (e)); } else s = message ("%q, %s", s, ltoken_getRawString (e)); } end_ltokenList_elements; return (message ("%q}", s)); } case LTS_STRUCTUNION: { strOrUnionNode n = typespec->content.structorunion; stDeclNodeList decls; llassert (n != NULL); switch (n->kind) { case SU_STRUCT: s = cstring_concatFree (s, cstring_makeLiteral ("struct ")); /*@switchbreak@*/ break; case SU_UNION: s = cstring_concatFree (s, cstring_makeLiteral ("union ")); /*@switchbreak@*/ break; } if (!ltoken_isUndefined (n->opttagid)) { if (stDeclNodeList_size (n->structdecls) == 0) { return (message ("%q%s", s, ltoken_unparse (n->opttagid))); } s = message ("%q%s {\n\t", s, ltoken_unparse (n->opttagid)); } else { s = message ("%q{\n\t", s); } decls = n->structdecls; stDeclNodeList_elements (decls, f) { s = message ("%q%q %q;\n\t", s, lclTypeSpecNode_unparseComments (f->lcltypespec), declaratorNodeList_unparse (f->declarators)); } end_stDeclNodeList_elements; return (message ("%q }", s)); } case LTS_CONJ: { cstring_free (s); return (message ("%q /*@alt %q@*/", lclTypeSpecNode_unparseComments (typespec->content.conj->a), lclTypeSpecNode_unparseAltComments (typespec->content.conj->b))); } BADDEFAULT; } } else { llcontbuglit ("lclTypeSpecNode_unparseComments: null typespec"); return cstring_undefined; } BADEXIT; } /*@only@*/ cstring paramNode_unparseComments (paramNode x) { if (x != (paramNode) 0) { if (x->kind == PELIPSIS) { return (cstring_makeLiteral ("...")); } if (x->paramdecl != (typeExpr) 0) { /* handle (void) */ return (message ("%q %q", lclTypeSpecNode_unparseComments (x->type), typeExpr_unparseNoBase (x->paramdecl))); } else { return (lclTypeSpecNode_unparseComments (x->type)); } } return cstring_undefined; } /*@only@*/ termNode makeIfTermNode (ltoken ift, termNode ifn, ltoken thent, termNode thenn, ltoken elset, termNode elsen) { termNode t = (termNode) dmalloc (sizeof (*t)); opFormNode opform = makeOpFormNode (ift, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); nameNode nn = makeNameNodeForm (opform); termNodeList args = termNodeList_new (); t->error_reported = FALSE; t->wrapped = 0; termNodeList_addh (args, ifn); termNodeList_addh (args, thenn); termNodeList_addh (args, elsen); t->name = nn; t->args = args; t->kind = TRM_APPLICATION; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); ltoken_free (thent); ltoken_free (elset); return (t); } static /*@observer@*/ ltoken nameNode2anyOp (nameNode n) { if (n != (nameNode) 0) { opFormNode opnode = n->content.opform; opFormKind kind; llassert (opnode != NULL); kind = opnode->kind; if (kind == OPF_MANYOPM || kind == OPF_ANYOP || kind == OPF_MANYOP || kind == OPF_ANYOPM) { opFormUnion u; u = opnode->content; return u.anyop; } } return ltoken_undefined; } /*@only@*/ termNode makeInfixTermNode (termNode x, ltoken op, termNode y) { termNode t = (termNode) dmalloc (sizeof (*t)); opFormNode opform; nameNode nn; termNodeList args = termNodeList_new (); checkAssociativity (x, op); opform = makeOpFormNode (op, OPF_MANYOPM, opFormUnion_createAnyOp (op), ltoken_undefined); nn = makeNameNodeForm (opform); t->error_reported = FALSE; t->wrapped = 0; termNodeList_addh (args, x); termNodeList_addh (args, y); t->name = nn; t->args = args; t->kind = TRM_APPLICATION; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); /* sort_equal */ t->possibleOps = lslOpSet_new (); return (t); } /*@only@*/ quantifiedTermNode quantifiedTermNode_copy (quantifiedTermNode q) { quantifiedTermNode ret = (quantifiedTermNode) dmalloc (sizeof (*ret)); ret->quantifiers = quantifierNodeList_copy (q->quantifiers); ret->open = ltoken_copy (q->open); ret->close = ltoken_copy (q->close); ret->body = termNode_copySafe (q->body); return (ret); } /*@only@*/ termNode makeQuantifiedTermNode (quantifierNodeList qn, ltoken open, termNode t, ltoken close) { sort sort; termNode n = (termNode) dmalloc (sizeof (*n)); quantifiedTermNode q = (quantifiedTermNode) dmalloc (sizeof (*q)); n->name = NULL; /*> missing this --- detected by splint <*/ n->error_reported = FALSE; n->wrapped = 0; n->error_reported = FALSE; n->kind = TRM_QUANTIFIER; n->possibleSorts = sortSet_new (); n->possibleOps = lslOpSet_new (); n->kind = TRM_UNCHANGEDALL; n->args = termNodeList_new (); /*< forgot this >*/ termNodeList_free (t->args); t->args = termNodeList_new (); sort = g_sortBool; n->sort = sort; (void) sortSet_insert (n->possibleSorts, sort); q->quantifiers = qn; q->open = open; q->close = close; q->body = t; n->quantified = q; return (n); } /*@only@*/ termNode makePostfixTermNode (/*@returned@*/ /*@only@*/ termNode secondary, ltokenList postfixops) { termNode top = secondary; ltokenList_elements (postfixops, op) { top = makePostfixTermNode2 (top, ltoken_copy (op)); /*@i@*/ } end_ltokenList_elements; ltokenList_free (postfixops); return (top); /* dep as only? */ } /* ** secondary is returned in the args list */ /*@only@*/ termNode makePostfixTermNode2 (/*@returned@*/ /*@only@*/ termNode secondary, /*@only@*/ ltoken postfixop) { termNode t = (termNode) dmalloc (sizeof (*t)); opFormNode opform = makeOpFormNode (postfixop, OPF_MANYOP, opFormUnion_createAnyOp (postfixop), ltoken_undefined); nameNode nn = makeNameNodeForm (opform); termNodeList args = termNodeList_new (); t->error_reported = FALSE; t->wrapped = 0; termNodeList_addh (args, secondary); t->name = nn; t->args = args; t->kind = TRM_APPLICATION; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); return t; } /*@only@*/ termNode makePrefixTermNode (ltoken op, termNode arg) { termNode t = (termNode) dmalloc (sizeof (*t)); termNodeList args = termNodeList_new (); opFormNode opform = makeOpFormNode (op, OPF_ANYOPM, opFormUnion_createAnyOp (op), ltoken_undefined); nameNode nn = makeNameNodeForm (opform); t->error_reported = FALSE; t->wrapped = 0; t->name = nn; termNodeList_addh (args, arg); t->args = args; t->kind = TRM_APPLICATION; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); return t; } /*@only@*/ termNode makeOpCallTermNode (ltoken op, ltoken open, termNodeList args, ltoken close) { /* like prefixTerm, but with opId LPAR termNodeList RPAR */ termNode t = (termNode) dmalloc (sizeof (*t)); nameNode nn = makeNameNodeId (op); t->error_reported = FALSE; t->wrapped = 0; t->name = nn; t->args = args; t->kind = TRM_APPLICATION; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); ltoken_free (open); ltoken_free (close); return t; } /*@exposed@*/ termNode CollapseInfixTermNode (/*@returned@*/ termNode secondary, termNodeList infix) { termNode left = secondary; termNodeList_elements (infix, node) { termNodeList_addl (node->args, termNode_copySafe (left)); left = node; /* computePossibleSorts (left); */ } end_termNodeList_elements; return (left); } static void checkAssociativity (termNode x, ltoken op) { ltoken lastOpToken; if (x->wrapped == 0 && /* no parentheses */ x->kind == TRM_APPLICATION && x->name != (nameNode) 0 && (!x->name->isOpId)) { lastOpToken = nameNode2anyOp (x->name); if ((ltoken_getCode (lastOpToken) == logicalOp && ltoken_getCode (op) == logicalOp) || ((ltoken_getCode (lastOpToken) == simpleOp || ltoken_getCode (lastOpToken) == LLT_MULOP) && (ltoken_getCode (op) == simpleOp || ltoken_getCode (op) == LLT_MULOP))) if (ltoken_getText (lastOpToken) != ltoken_getText (op)) { lclerror (op, message ("Parentheses needed to specify associativity of %s and %s", cstring_fromChars (lsymbol_toChars (ltoken_getText (lastOpToken))), cstring_fromChars (lsymbol_toChars (ltoken_getText (op))))); } } } termNodeList pushInfixOpPartNode (/*@returned@*/ termNodeList x, ltoken op, /*@only@*/ termNode secondary) { termNode lastLeftTerm; termNodeList args = termNodeList_new (); termNode t = (termNode) dmalloc (sizeof (*t)); opFormNode opform; nameNode nn; termNodeList_addh (args, secondary); if (!termNodeList_empty (x)) { termNodeList_reset (x); lastLeftTerm = termNodeList_current (x); checkAssociativity (lastLeftTerm, op); } opform = makeOpFormNode (op, OPF_MANYOPM, opFormUnion_createAnyOp (op), ltoken_undefined); nn = makeNameNodeForm (opform); t->error_reported = FALSE; t->wrapped = 0; t->name = nn; t->kind = TRM_APPLICATION; t->args = args; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); termNodeList_addh (x, t); /* don't compute sort yet, do it in CollapseInfixTermNode */ return (x); } termNode updateMatchedNode (/*@only@*/ termNode left, /*@returned@*/ termNode t, /*@only@*/ termNode right) { opFormNode op; if ((t == (termNode) 0) || (t->name == NULL) || t->name->isOpId) { llbugexitlit ("updateMatchedNode: expect opForm in nameNode"); } op = t->name->content.opform; llassert (op != NULL); if (left == (termNode) 0) { if (right == (termNode) 0) { /* op->kind is not changed */ termNode_free (right); } else { op->kind = OPF_MIDDLEM; op->key = opFormNode2key (op, OPF_MIDDLEM); termNodeList_addh (t->args, right); } } else { termNodeList_addl (t->args, left); if (right == (termNode) 0) { op->kind = OPF_MMIDDLE; op->key = opFormNode2key (op, OPF_MMIDDLE); } else { op->kind = OPF_MMIDDLEM; op->key = opFormNode2key (op, OPF_MMIDDLEM); termNodeList_addh (t->args, right); } } return t; } /*@only@*/ termNode updateSqBracketedNode (/*@only@*/ termNode left, /*@only@*/ /*@returned@*/ termNode t, /*@only@*/ termNode right) { opFormNode op; if ((t == (termNode) 0) || (t->name == NULL) || (t->name->isOpId)) { llbugexitlit ("updateSqBracketededNode: expect opForm in nameNode"); } op = t->name->content.opform; llassert (op != NULL); if (left == (termNode) 0) { if (right == (termNode) 0) { /* op->kind is not changed */ } else { op->kind = OPF_BMIDDLEM; op->key = opFormNode2key (op, OPF_BMIDDLEM); termNodeList_addh (t->args, right); } } else { termNodeList_addl (t->args, left); if (right == (termNode) 0) { op->kind = OPF_BMMIDDLE; op->key = opFormNode2key (op, OPF_BMMIDDLE); } else { op->kind = OPF_BMMIDDLEM; op->key = opFormNode2key (op, OPF_BMMIDDLEM); termNodeList_addh (t->args, right); } } return t; } /*@only@*/ termNode makeSqBracketedNode (ltoken lbracket, termNodeList args, ltoken rbracket) { termNode t = (termNode) dmalloc (sizeof (*t)); int size; opFormNode opform; nameNode nn; t->error_reported = FALSE; t->wrapped = 0; size = termNodeList_size (args); opform = makeOpFormNode (lbracket, OPF_BMIDDLE, opFormUnion_createMiddle (size), rbracket); nn = makeNameNodeForm (opform); t->name = nn; t->kind = TRM_APPLICATION; t->args = args; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); /* do sort checking later, not here, incomplete parse */ return (t); } /*@only@*/ termNode makeMatchedNode (ltoken open, termNodeList args, ltoken close) { /* matched : open args close */ termNode t = (termNode) dmalloc (sizeof (*t)); int size; opFormNode opform; nameNode nn; t->error_reported = FALSE; t->wrapped = 0; size = termNodeList_size (args); opform = makeOpFormNode (open, OPF_MIDDLE, opFormUnion_createMiddle (size), close); nn = makeNameNodeForm (opform); t->name = nn; t->kind = TRM_APPLICATION; t->args = args; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); /* do sort checking later, not here, incomplete parse */ return (t); } /*@only@*/ termNode makeSimpleTermNode (ltoken varid) { sort theSort = sort_makeNoSort (); lsymbol sym; opInfo oi; varInfo vi; termNode n = (termNode) dmalloc (sizeof (*n)); n->error_reported = FALSE; n->wrapped = 0; n->name = (nameNode) 0; n->given = theSort; n->args = termNodeList_new (); n->possibleSorts = sortSet_new (); n->possibleOps = lslOpSet_new (); sym = ltoken_getText (varid); /* lookup current scope */ vi = symtable_varInfoInScope (g_symtab, sym); if (varInfo_exists (vi)) { theSort = vi->sort; n->kind = TRM_VAR; n->sort = theSort; n->literal = varid; (void) sortSet_insert (n->possibleSorts, theSort); } else { /* need to handle LCL constants */ vi = symtable_varInfo (g_symtab, sym); if (varInfo_exists (vi) && vi->kind == VRK_CONST) { theSort = vi->sort; n->kind = TRM_CONST; n->sort = theSort; n->literal = varid; (void) sortSet_insert (n->possibleSorts, theSort); } else { /* and LSL operators (true, false, new, nil, etc) */ nameNode nn = makeNameNodeId (ltoken_copy (varid)); oi = symtable_opInfo (g_symtab, nn); if (opInfo_exists (oi) && (oi->name->isOpId) && !sigNodeSet_isEmpty (oi->signatures)) { sigNodeSet_elements (oi->signatures, x) { if (ltokenList_empty (x->domain)) /* yes, it really is empty, not not empty */ { lslOp op = (lslOp) dmalloc (sizeof (*op)); op->name = nameNode_copy (nn); op->signature = x; (void) sortSet_insert (n->possibleSorts, sigNode_rangeSort (x)); (void) lslOpSet_insert (n->possibleOps, op); } } end_sigNodeSet_elements; } nameNode_free (nn); if (sortSet_size (n->possibleSorts) == 0) { lclerror (varid, message ("Unrecognized identifier (constant, variable or operator): %s", ltoken_getRawString (varid))); } n->sort = sort_makeNoSort (); n->literal = varid; n->kind = TRM_ZEROARY; } } return (n); } /*@only@*/ termNode makeSelectTermNode (termNode pri, ltoken select, /*@dependent@*/ ltoken id) { termNode t = (termNode) dmalloc (sizeof (*t)); opFormNode opform = makeOpFormNode (select, OPF_MSELECT, opFormUnion_createAnyOp (id), ltoken_undefined); nameNode nn = makeNameNodeForm (opform); termNodeList args = termNodeList_new (); t->error_reported = FALSE; t->wrapped = 0; t->name = nn; t->kind = TRM_APPLICATION; termNodeList_addh (args, pri); t->args = args; t->kind = TRM_APPLICATION; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); return t; } /*@only@*/ termNode makeMapTermNode (termNode pri, ltoken map, /*@dependent@*/ ltoken id) { termNode t = (termNode) dmalloc (sizeof (*t)); opFormNode opform = makeOpFormNode (map, OPF_MMAP, opFormUnion_createAnyOp (id), ltoken_undefined); nameNode nn = makeNameNodeForm (opform); termNodeList args = termNodeList_new (); t->error_reported = FALSE; t->wrapped = 0; t->kind = TRM_APPLICATION; t->name = nn; termNodeList_addh (args, pri); t->args = args; t->kind = TRM_APPLICATION; t->sort = sort_makeNoSort (); t->given = t->sort; t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); return t; } /*@only@*/ termNode makeLiteralTermNode (ltoken tok, sort s) { nameNode nn = makeNameNodeId (ltoken_copy (tok)); opInfo oi = symtable_opInfo (g_symtab, nn); lslOp op = (lslOp) dmalloc (sizeof (*op)); termNode n = (termNode) dmalloc (sizeof (*n)); sigNode sign; ltoken range; n->name = nn; n->error_reported = FALSE; n->wrapped = 0; n->kind = TRM_LITERAL; n->literal = tok; n->given = sort_makeNoSort (); n->sort = n->given; n->args = termNodeList_new (); n->possibleSorts = sortSet_new (); n->possibleOps = lslOpSet_new (); /* look up signatures for this operator too */ range = ltoken_create (simpleId, sort_getLsymbol (s)); sign = makesigNode (ltoken_undefined, ltokenList_new (), ltoken_copy (range)); if (opInfo_exists (oi) && (oi->name->isOpId) && (sigNodeSet_size (oi->signatures) > 0)) { sigNodeSet_elements (oi->signatures, x) { if (ltokenList_empty (x->domain)) { lslOp opn = (lslOp) dmalloc (sizeof (*opn)); sort sort; opn->name = nameNode_copy (nn); opn->signature = x; sort = sigNode_rangeSort (x); (void) sortSet_insert (n->possibleSorts, sort); (void) lslOpSet_insert (n->possibleOps, opn); } } end_sigNodeSet_elements; } /* insert into literal term */ (void) sortSet_insert (n->possibleSorts, s); op->name = nameNode_copy (nn); op->signature = sign; (void) lslOpSet_insert (n->possibleOps, op); /* enter the literal as an operator into the operator table */ /* 8/9/93. C's char constant 'c' syntax conflicts with LSL's lslinit.lsi table. Throw out, because it's not needed anyway. */ /* symtable_enterOp (g_symtab, nn, sign); */ if (s == g_sortInt) { sigNode osign; lslOp opn = (lslOp) dmalloc (sizeof (*opn)); /* if it is a C int, we should overload it as double too because C allows you to say "x > 2". */ (void) sortSet_insert (n->possibleSorts, g_sortDouble); ltoken_setText (range, lsymbol_fromChars ("double")); osign = makesigNode (ltoken_undefined, ltokenList_new (), range); opn->name = nameNode_copy (nn); opn->signature = osign; (void) lslOpSet_insert (n->possibleOps, opn); symtable_enterOp (g_symtab, nameNode_copySafe (nn), sigNode_copy (osign)); } else { ltoken_free (range); } /* future: could overload cstrings to be both char_Vec as well as char_ObjPtr */ /*@-mustfree@*/ return n; } /*@=mustfree@*/ /*@only@*/ termNode makeUnchangedTermNode1 (ltoken op, /*@unused@*/ ltoken all) { termNode t = (termNode) dmalloc (sizeof (*t)); t->error_reported = FALSE; t->wrapped = 0; t->kind = TRM_UNCHANGEDALL; t->sort = g_sortBool; t->literal = op; t->given = sort_makeNoSort (); t->name = NULL; /*< missing this >*/ t->args = termNodeList_new (); t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); (void) sortSet_insert (t->possibleSorts, t->sort); ltoken_free (all); return t; } /*@only@*/ termNode makeUnchangedTermNode2 (ltoken op, storeRefNodeList x) { termNode t = (termNode) dmalloc (sizeof (*t)); ltoken errtok; sort sort; t->name = NULL; /*< missing this >*/ t->error_reported = FALSE; t->wrapped = 0; t->kind = TRM_UNCHANGEDOTHERS; t->sort = g_sortBool; t->literal = op; t->unchanged = x; t->given = sort_makeNoSort (); t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); t->args = termNodeList_new (); (void) sortSet_insert (t->possibleSorts, t->sort); /* check storeRefNode's are mutable, uses sort of term */ storeRefNodeList_elements (x, sto) { if (storeRefNode_isTerm (sto)) { sort = sto->content.term->sort; if (!sort_mutable (sort)) { errtok = termNode_errorToken (sto->content.term); lclerror (errtok, message ("Term denoting immutable object used in unchanged list: %q", termNode_unparse (sto->content.term))); } } else { if (storeRefNode_isType (sto)) { lclTypeSpecNode type = sto->content.type; sort = lclTypeSpecNode2sort (type); if (!sort_mutable (sort)) { errtok = lclTypeSpecNode_errorToken (type); lclerror (errtok, message ("Immutable type used in unchanged list: %q", sort_unparse (sort))); } } } } end_storeRefNodeList_elements; return t; } /*@only@*/ termNode makeSizeofTermNode (ltoken op, lclTypeSpecNode type) { termNode t = (termNode) dmalloc (sizeof (*t)); t->name = NULL; /*< missing this >*/ t->error_reported = FALSE; t->wrapped = 0; t->kind = TRM_SIZEOF; t->sort = g_sortInt; t->literal = op; t->sizeofField = type; t->given = sort_makeNoSort (); t->possibleSorts = sortSet_new (); t->possibleOps = lslOpSet_new (); t->args = termNodeList_new (); (void) sortSet_insert (t->possibleSorts, t->sort); /* nothing to check */ return (t); } /*@only@*/ cstring claimNode_unparse (claimNode c) { if (c != (claimNode) 0) { cstring s = message ("claims (%q)%q{\n%q", paramNodeList_unparse (c->params), varDeclarationNodeList_unparse (c->globals), lclPredicateNode_unparse (c->require)); if (c->body != NULL) { s = message ("%qbody {%q}\n", s, programNode_unparse (c->body)); } s = message ("%q%q}\n", s, lclPredicateNode_unparse (c->ensures)); return s; } return cstring_undefined; } static void WrongArity (ltoken tok, int expect, int size) { lclerror (tok, message ("Expecting %d arguments but given %d", expect, size)); } static cstring printTermNode2 (/*@null@*/ opFormNode op, termNodeList args, sort sort) { if (op != (opFormNode) 0) { cstring s = cstring_undefined; cstring sortText; cstring sortSpace; if (sort != sort_makeNoSort ()) { sortText = message (": %s", cstring_fromChars (lsymbol_toChars (sort_getLsymbol (sort)))); sortSpace = cstring_makeLiteral (" "); } else { sortText = cstring_undefined; sortSpace = cstring_undefined; } switch (op->kind) { case OPF_IF: { int size = termNodeList_size (args); if (size == 3) { s = message ("if %q then %q else %q\n", termNode_unparse (termNodeList_getN (args, 0)), termNode_unparse (termNodeList_getN (args, 1)), termNode_unparse (termNodeList_getN (args, 2))); } else { WrongArity (op->tok, 3, size); s = cstring_makeLiteral ("if __ then __ else __"); } s = message ("%q%s", s, sortText); break; } case OPF_ANYOP: { /* ymtan ? */ s = message ("%s %s", ltoken_getRawString (op->content.anyop), sortText); break; } case OPF_MANYOP: { int size = termNodeList_size (args); if (size == 1) { s = message ("%q ", termNode_unparse (termNodeList_head (args))); } else { WrongArity (op->content.anyop, 1, size); s = cstring_makeLiteral ("__ "); } s = message ("%q%s%s", s, ltoken_getRawString (op->content.anyop), sortText); break; } case OPF_ANYOPM: { int size = termNodeList_size (args); s = message ("%s ", ltoken_getRawString (op->content.anyop)); if (size == 1) { s = message ("%q%q", s, termNode_unparse (termNodeList_head (args))); } else { WrongArity (op->content.anyop, 1, size); s = message ("%q__", s); } s = message ("%q%s", s, sortText); break; } case OPF_MANYOPM: { int size = termNodeList_size (args); if (size == 2) { s = message ("%q %s %q", termNode_unparse (termNodeList_getN (args, 0)), ltoken_getRawString (op->content.anyop), termNode_unparse (termNodeList_getN (args, 1))); } else { WrongArity (op->content.anyop, 2, size); s = message ("__ %s __", ltoken_getRawString (op->content.anyop)); } s = message ("%q%s", s, sortText); break; } case OPF_MIDDLE: { int size = termNodeList_size (args); int expect = op->content.middle; /* ymtan ? use { or openSym token ? */ if (size == expect) { s = message ("{%q}", termNodeList_unparse (args)); } else { WrongArity (op->tok, expect, size); s = cstring_makeLiteral ("{ * }"); } s = message ("%q%s", s, sortText); break; } case OPF_MMIDDLE: { int size = termNodeList_size (args); int expect = op->content.middle + 1; if (size == expect) { s = message ("%q{%q}", termNode_unparse (termNodeList_head (args)), termNodeList_unparseTail (args)); } else { WrongArity (op->tok, expect, size); s = cstring_makeLiteral ("__ { * }"); } s = message ("%q%s", s, sortText); break; } case OPF_MIDDLEM: { int size = termNodeList_size (args); int expect = op->content.middle + 1; if (size == expect) { termNodeList_finish (args); s = message ("{%q}%s%s%q", termNodeList_unparseToCurrent (args), sortText, sortSpace, termNode_unparse (termNodeList_current (args))); } else { WrongArity (op->tok, expect, size); s = message ("{ * }%s __", sortText); /* used to put in extra space! evs 94-01-05 */ } break; } case OPF_MMIDDLEM: { int size = termNodeList_size (args); int expect = op->content.middle + 2; if (size == expect) { termNodeList_finish (args); s = message ("%q {%q} %s%s%q", termNode_unparse (termNodeList_head (args)), termNodeList_unparseSecondToCurrent (args), sortText, sortSpace, termNode_unparse (termNodeList_current (args))); } else { WrongArity (op->tok, expect, size); s = message ("__ { * } %s __", sortText); /* also had extra space? */ } break; } case OPF_BMIDDLE: { int size = termNodeList_size (args); int expect = op->content.middle; if (size == expect) { s = message ("[%q]", termNodeList_unparse (args)); } else { WrongArity (op->tok, expect, size); s = cstring_makeLiteral ("[ * ]"); } s = message ("%q%s", s, sortText); break; } case OPF_BMMIDDLE: { int size = termNodeList_size (args); int expect = op->content.middle + 1; if (size == expect) { s = message ("%q[%q]", termNode_unparse (termNodeList_head (args)), termNodeList_unparseTail (args)); } else { WrongArity (op->tok, expect, size); s = cstring_makeLiteral ("__ [ * ]"); } s = message ("%q%s", s, sortText); break; } case OPF_BMMIDDLEM: { int size = termNodeList_size (args); int expect = op->content.middle + 1; if (size == expect) { s = message ("%q[%q] __", termNode_unparse (termNodeList_head (args)), termNodeList_unparseTail (args)); } else { WrongArity (op->tok, expect, size); s = cstring_makeLiteral ("__ [ * ] __"); } s = message ("%q%s", s, sortText); break; } case OPF_BMIDDLEM: { int size = termNodeList_size (args); int expect = op->content.middle + 1; if (size == expect) { termNodeList_finish (args); s = message ("[%q]%s%s%q", termNodeList_unparseToCurrent (args), sortText, sortSpace, termNode_unparse (termNodeList_current (args))); } else { WrongArity (op->tok, expect, size); s = cstring_makeLiteral ("[ * ] __"); } break; } case OPF_SELECT: { /* ymtan constant, check args ? */ s = cstring_prependChar ('.', ltoken_getRawString (op->content.id)); break; } case OPF_MAP: s = cstring_concat (cstring_makeLiteralTemp ("->"), ltoken_getRawString (op->content.id)); break; case OPF_MSELECT: { int size = termNodeList_size (args); if (size == 1) { s = message ("%q.%s", termNode_unparse (termNodeList_head (args)), ltoken_getRawString (op->content.id)); } else { WrongArity (op->content.id, 1, size); s = cstring_concat (cstring_makeLiteralTemp ("__."), ltoken_getRawString (op->content.id)); } break; } case OPF_MMAP: { int size = termNodeList_size (args); if (size == 1) { s = message ("%q->%s", termNode_unparse (termNodeList_head (args)), ltoken_getRawString (op->content.id)); } else { WrongArity (op->content.id, 1, size); s = cstring_concat (cstring_makeLiteralTemp ("__->"), ltoken_getRawString (op->content.id)); } break; } } cstring_free (sortSpace); cstring_free (sortText); return s; } return cstring_undefined; } /*@only@*/ cstring termNode_unparse (/*@null@*/ termNode n) { cstring s = cstring_undefined; cstring back = cstring_undefined; cstring front = cstring_undefined; int count; if (n != (termNode) 0) { for (count = n->wrapped; count > 0; count--) { front = cstring_appendChar (front, '('); back = cstring_appendChar (back, ')'); } switch (n->kind) { case TRM_LITERAL: case TRM_CONST: case TRM_VAR: case TRM_ZEROARY: s = cstring_copy (ltoken_getRawString (n->literal)); break; case TRM_APPLICATION: { nameNode nn = n->name; if (nn != (nameNode) 0) { if (nn->isOpId) { s = message ("%s (%q) ", ltoken_getRawString (nn->content.opid), termNodeList_unparse (n->args)); /* must we handle n->given ? skip for now */ } else { s = message ("%q ", printTermNode2 (nn->content.opform, n->args, n->given)); } } else { llfatalbug (message ("termNode_unparse: expect non-empty nameNode: TRM_APPLICATION: %q", nameNode_unparse (nn))); } break; } case TRM_UNCHANGEDALL: s = cstring_makeLiteral ("unchanged (all)"); break; case TRM_UNCHANGEDOTHERS: s = message ("unchanged (%q)", storeRefNodeList_unparse (n->unchanged)); break; case TRM_SIZEOF: s = message ("sizeof (%q)", lclTypeSpecNode_unparse (n->sizeofField)); break; case TRM_QUANTIFIER: { quantifiedTermNode x = n->quantified; s = message ("%q%s%q%s", quantifierNodeList_unparse (x->quantifiers), ltoken_getRawString (x->open), termNode_unparse (x->body), ltoken_getRawString (x->close)); break; } } } return (message ("%q%q%q", front, s, back)); } static void modifyNode_free (/*@null@*/ /*@only@*/ modifyNode m) { if (m != (modifyNode) 0) { if (m->hasStoreRefList) { storeRefNodeList_free (m->list); /*@-branchstate@*/ } /*@=branchstate@*/ ltoken_free (m->tok); sfree (m); } } /*@only@*/ cstring modifyNode_unparse (/*@null@*/ modifyNode m) { if (m != (modifyNode) 0) { if (m->hasStoreRefList) { return (message (" modifies %q; \n", storeRefNodeList_unparse (m->list))); } else { if (m->modifiesNothing) { return (cstring_makeLiteral ("modifies nothing; \n")); } else { return (cstring_makeLiteral ("modifies anything; \n")); } } } return cstring_undefined; } /*@only@*/ cstring programNode_unparse (programNode p) { if (p != (programNode) 0) { cstring s = cstring_undefined; int count; switch (p->kind) { case ACT_SELF: { cstring back = cstring_undefined; for (count = p->wrapped; count > 0; count--) { s = cstring_appendChar (s, '('); back = cstring_appendChar (back, ')'); } s = message ("%q%q%q", s, stmtNode_unparse (p->content.self), back); break; } case ACT_ITER: s = message ("*(%q)", programNodeList_unparse (p->content.args)); break; case ACT_ALTERNATE: s = message ("|(%q)", programNodeList_unparse (p->content.args)); break; case ACT_SEQUENCE: s = programNodeList_unparse (p->content.args); break; } return s; } return cstring_undefined; } /*@only@*/ cstring stmtNode_unparse (stmtNode x) { cstring s = cstring_undefined; if (x != (stmtNode) 0) { if (ltoken_isValid (x->lhs)) { s = cstring_concat (ltoken_getRawString (x->lhs), cstring_makeLiteralTemp (" = ")); } s = message ("%q%s (%q)", s, ltoken_getRawString (x->operator), termNodeList_unparse (x->args)); } return s; } /*@only@*/ lslOp makelslOpNode (/*@only@*/ /*@null@*/ nameNode name, /*@dependent@*/ sigNode s) { lslOp x = (lslOp) dmalloc (sizeof (*x)); x->name = name; x->signature = s; /* enter operator info into symtab */ /* if not, they may need to be renamed in LCL imports */ if (g_lslParsingTraits) { if (name != NULL) { symtable_enterOp (g_symtab, nameNode_copySafe (name), sigNode_copy (s)); } } else { /* nameNode_free (name); */ /* YIKES! */ } return x; } /*@only@*/ cstring lslOp_unparse (lslOp x) { char *s = mstring_createEmpty (); if (x != (lslOp) 0) { s = mstring_concatFree (s, cstring_toCharsSafe (nameNode_unparse (x->name))); if (x->signature != (sigNode) 0) { s = mstring_concatFree (s, cstring_toCharsSafe (sigNode_unparse (x->signature))); } } return cstring_fromCharsO (s); } static bool sameOpFormNode (/*@null@*/ opFormNode n1, /*@null@*/ opFormNode n2) { if (n1 == n2) return TRUE; if (n1 == 0) return FALSE; if (n2 == 0) return FALSE; if (n1->kind == n2->kind) { switch (n1->kind) { case OPF_IF: return TRUE; case OPF_ANYOP: case OPF_MANYOP: case OPF_ANYOPM: return (ltoken_similar (n1->content.anyop, n2->content.anyop)); case OPF_MANYOPM: { /* want to treat eq and = the same */ return ltoken_similar (n1->content.anyop, n2->content.anyop); } case OPF_MIDDLE: case OPF_MMIDDLE: case OPF_MIDDLEM: case OPF_MMIDDLEM: /* need to check the rawText of openSym and closeSym */ if ((int) n1->content.middle == (int) n2->content.middle) { if (lsymbol_equal (ltoken_getRawText (n1->tok), ltoken_getRawText (n2->tok)) && lsymbol_equal (ltoken_getRawText (n1->close), ltoken_getRawText (n2->close))) return TRUE; } return FALSE; case OPF_BMIDDLE: case OPF_BMMIDDLE: case OPF_BMIDDLEM: case OPF_BMMIDDLEM: return ((int) n1->content.middle == (int) n2->content.middle); case OPF_SELECT: case OPF_MAP: case OPF_MSELECT: case OPF_MMAP: return (ltoken_similar (n1->content.id, n2->content.id)); } } return FALSE; } bool sameNameNode (/*@null@*/ nameNode n1, /*@null@*/ nameNode n2) { if (n1 == n2) return TRUE; if (n1 != (nameNode) 0 && n2 != (nameNode) 0) { if (bool_equal (n1->isOpId, n2->isOpId)) { if (n1->isOpId) return (ltoken_similar (n1->content.opid, n2->content.opid)); else return sameOpFormNode (n1->content.opform, n2->content.opform); } } return FALSE; } void CTypesNode_free (/*@only@*/ /*@null@*/ CTypesNode x) { if (x != NULL) { ltokenList_free (x->ctypes); sfree (x); } } /*@null@*/ CTypesNode CTypesNode_copy (/*@null@*/ CTypesNode x) { if (x != NULL) { CTypesNode newnode = (CTypesNode) dmalloc (sizeof (*newnode)); newnode->intfield = x->intfield; newnode->ctypes = ltokenList_copy (x->ctypes); newnode->sort = x->sort; return newnode; } else { return NULL; } } /*@only@*/ CTypesNode makeCTypesNode (/*@only@*/ CTypesNode ctypes, ltoken ct) { /*@only@*/ CTypesNode newnode; lsymbol sortname; bits sortbits; if (ctypes == (CTypesNode) NULL) { newnode = (CTypesNode) dmalloc (sizeof (*newnode)); newnode->intfield = 0; newnode->ctypes = ltokenList_new (); newnode->sort = sort_makeNoSort (); } else { newnode = ctypes; } if ((ltoken_getIntField (ct) & newnode->intfield) != 0) { lclerror (ct, message ("Duplicate type specifier ignored: %s", cstring_fromChars (lsymbol_toChars (lclctype_toSortDebug (ltoken_getIntField (ct)))))); /* evs --- don't know how to generator this error */ /* Use previous value, to keep things consistent */ ltoken_free (ct); return newnode; } sortbits = newnode->intfield | ltoken_getIntField (ct); sortname = lclctype_toSort (sortbits); if (sortname == lsymbol_fromChars ("error")) { lclerror (ct, cstring_makeLiteral ("Invalid combination of type specifiers")); } else { newnode->intfield = sortbits; } ltokenList_addh (newnode->ctypes, ct); /* ** Sorts are assigned after CTypesNode is created during parsing, ** see bison grammar. */ return newnode; } /*@only@*/ CTypesNode makeTypeSpecifier (ltoken typedefname) { CTypesNode newnode = (CTypesNode) dmalloc (sizeof (*newnode)); typeInfo ti = symtable_typeInfo (g_symtab, ltoken_getText (typedefname)); newnode->intfield = 0; newnode->ctypes = ltokenList_singleton (ltoken_copy (typedefname)); /* if we see "bool" include bool.h header file */ if (ltoken_getText (typedefname) == lsymbol_bool) { lhIncludeBool (); } if (typeInfo_exists (ti)) { /* must we be concern about whether this type is exported by module? No. Because all typedef's are exported. No hiding supported. */ /* Later, may want to keep types around too */ /* 3/2/93, use underlying sort */ newnode->sort = sort_getUnderlying (ti->basedOn); } else { lclerror (typedefname, message ("Unrecognized type: %s", ltoken_getRawString (typedefname))); /* evs --- Don't know how to get this message */ newnode->sort = sort_makeNoSort (); } ltoken_free (typedefname); return newnode; } bool sigNode_equal (sigNode n1, sigNode n2) { /* n1 and n2 are never 0 */ return ((n1 == n2) || (n1->key == n2->key && ltoken_similar (n1->range, n2->range) && ltokenList_equal (n1->domain, n2->domain))); } sort typeExpr2ptrSort (sort base, /*@null@*/ typeExpr t) { if (t != (typeExpr) 0) { switch (t->kind) { case TEXPR_BASE: return base; case TEXPR_PTR: return typeExpr2ptrSort (sort_makePtr (ltoken_undefined, base), t->content.pointer); case TEXPR_ARRAY: return typeExpr2ptrSort (sort_makeArr (ltoken_undefined, base), t->content.array.elementtype); case TEXPR_FCN: /* map all hof types to some sort of SRT_HOF */ return sort_makeHOFSort (base); } } return base; } static sort typeExpr2returnSort (sort base, /*@null@*/ typeExpr t) { if (t != (typeExpr) 0) { switch (t->kind) { case TEXPR_BASE: return base; case TEXPR_PTR: return typeExpr2returnSort (sort_makePtr (ltoken_undefined, base), t->content.pointer); case TEXPR_ARRAY: return typeExpr2returnSort (sort_makeArr (ltoken_undefined, base), t->content.array.elementtype); case TEXPR_FCN: return typeExpr2returnSort (base, t->content.function.returntype); } } return base; } sort lclTypeSpecNode2sort (lclTypeSpecNode type) { if (type != (lclTypeSpecNode) 0) { switch (type->kind) { case LTS_TYPE: llassert (type->content.type != NULL); return sort_makePtrN (type->content.type->sort, type->pointers); case LTS_STRUCTUNION: llassert (type->content.structorunion != NULL); return sort_makePtrN (type->content.structorunion->sort, type->pointers); case LTS_ENUM: llassert (type->content.enumspec != NULL); return sort_makePtrN (type->content.enumspec->sort, type->pointers); case LTS_CONJ: return (lclTypeSpecNode2sort (type->content.conj->a)); } } return (sort_makeNoSort ()); } lsymbol checkAndEnterTag (tagKind k, ltoken opttagid) { /* should be tagKind, instead of int */ tagInfo t; sort sort = sort_makeNoSort (); if (!ltoken_isUndefined (opttagid)) { switch (k) { case TAG_FWDSTRUCT: case TAG_STRUCT: sort = sort_makeStr (opttagid); break; case TAG_FWDUNION: case TAG_UNION: sort = sort_makeUnion (opttagid); break; case TAG_ENUM: sort = sort_makeEnum (opttagid); break; } /* see if it is already in symbol table */ t = symtable_tagInfo (g_symtab, ltoken_getText (opttagid)); if (tagInfo_exists (t)) { if (t->kind == TAG_FWDUNION || t->kind == TAG_FWDSTRUCT) { /* this is fine, for mutually recursive types */ } else { /* this is not good, complain later */ cstring s; switch (k) { case TAG_ENUM: s = cstring_makeLiteral ("Enum"); break; case TAG_STRUCT: case TAG_FWDSTRUCT: s = cstring_makeLiteral ("Struct"); break; case TAG_UNION: case TAG_FWDUNION: s = cstring_makeLiteral ("Union"); break; } t->sort = sort; t->kind = k; lclerror (opttagid, message ("Tag redefined: %q %s", s, ltoken_getRawString (opttagid))); } ltoken_free (opttagid); } else { tagInfo newnode = (tagInfo) dmalloc (sizeof (*newnode)); newnode->sort = sort; newnode->kind = k; newnode->id = opttagid; newnode->imported = FALSE; newnode->content.decls = stDeclNodeList_new (); (void) symtable_enterTag (g_symtab, newnode); } } return sort_getLsymbol (sort); } static sort extractReturnSort (lclTypeSpecNode t, declaratorNode d) { sort sort; sort = lclTypeSpecNode2sort (t); sort = typeExpr2returnSort (sort, d->type); return sort; } void signNode_free (/*@only@*/ signNode sn) { sortList_free (sn->domain); ltoken_free (sn->tok); sfree (sn); } /*@only@*/ cstring signNode_unparse (signNode sn) { cstring s = cstring_undefined; if (sn != (signNode) 0) { s = message (": %q -> %s", sortList_unparse (sn->domain), sort_unparseName (sn->range)); } return s; } static /*@only@*/ pairNodeList globalList_toPairNodeList (globalList g) { /* expect list to be globals, drop private ones */ pairNodeList result = pairNodeList_new (); pairNode p; declaratorNode vdnode; lclTypeSpecNode type; sort sort; lsymbol sym; initDeclNodeList decls; varDeclarationNodeList_elements (g, x) { if (x->isSpecial) { ; } else { if (x->isGlobal && !x->isPrivate) { type = x->type; decls = x->decls; initDeclNodeList_elements (decls, init) { p = (pairNode) dmalloc (sizeof (*p)); vdnode = init->declarator; sym = ltoken_getText (vdnode->id); /* 2/21/93, not sure if it should be extractReturnSort, or some call to typeExpr2ptrSort */ sort = extractReturnSort (type, vdnode); p->sort = sort_makeGlobal (sort); /* if (!sort_isArrayKind (sort)) p->sort = sort_makeObj (sort); else p->sort = sort; */ /* p->name = sym; */ p->tok = ltoken_copy (vdnode->id); pairNodeList_addh (result, p); } end_initDeclNodeList_elements; } } } end_varDeclarationNodeList_elements; return result; } void enteringFcnScope (lclTypeSpecNode t, declaratorNode d, globalList g) { scopeInfo si = (scopeInfo) dmalloc (sizeof (*si)); varInfo vi = (varInfo) dmalloc (sizeof (*vi)); sort returnSort; ltoken result = ltoken_copy (ltoken_id); pairNodeList paramPairs, globals; fctInfo fi = (fctInfo) dmalloc (sizeof (*fi)); signNode sign = (signNode) dmalloc (sizeof (*sign)); sortList domain = sortList_new (); unsigned long int key; paramPairs = extractParams (d->type); returnSort = extractReturnSort (t, d); globals = globalList_toPairNodeList (g); sign->tok = ltoken_undefined; sign->range = returnSort; key = MASH (0, sort_getLsymbol (returnSort)); pairNodeList_elements (paramPairs, p) { sortList_addh (domain, p->sort); key = MASH (key, sort_getLsymbol (p->sort)); } end_pairNodeList_elements; sign->domain = domain; sign->key = key; /* push fcn onto symbol table stack first */ fi->id = ltoken_copy (d->id); fi->export = TRUE; fi->signature = sign; fi->globals = globals; (void) symtable_enterFct (g_symtab, fi); /* push new fcn scope */ si->kind = SPE_FCN; symtable_enterScope (g_symtab, si); /* add "result" with return type to current scope */ ltoken_setText (result, lsymbol_fromChars ("result")); vi->id = result; vi->sort = sort_makeFormal (returnSort); /* make appropriate values */ vi->kind = VRK_PARAM; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); /* ** evs - 4 Mar 1995 ** pust globals first (they are in outer scope) */ /* push onto symbol table the global variables declared in this function, together with their respective sorts */ pairNodeList_elements (globals, gl) { ltoken_free (vi->id); vi->id = ltoken_copy (gl->tok); vi->kind = VRK_GLOBAL; vi->sort = gl->sort; (void) symtable_enterVar (g_symtab, vi); } end_pairNodeList_elements; /* ** could enter a new scope; instead, warn when variable shadows global ** that is used */ /* ** push onto symbol table the formal parameters of this function, ** together with their respective sorts */ pairNodeList_elements (paramPairs, pair) { ltoken_free (vi->id); vi->id = ltoken_copy (pair->tok); vi->sort = pair->sort; vi->kind = VRK_PARAM; (void) symtable_enterVar (g_symtab, vi); } end_pairNodeList_elements; pairNodeList_free (paramPairs); varInfo_free (vi); } void enteringClaimScope (paramNodeList params, globalList g) { scopeInfo si = (scopeInfo) dmalloc (sizeof (*si)); pairNodeList globals; lclTypeSpecNode paramtype; typeExpr paramdecl; sort sort; globals = globalList_toPairNodeList (g); /* push new claim scope */ si->kind = SPE_CLAIM; symtable_enterScope (g_symtab, si); /* push onto symbol table the formal parameters of this function, together with their respective sorts */ paramNodeList_elements (params, param) { paramdecl = param->paramdecl; paramtype = param->type; if (paramdecl != (typeExpr) 0 && paramtype != (lclTypeSpecNode) 0) { varInfo vi = (varInfo) dmalloc (sizeof (*vi)); sort = lclTypeSpecNode2sort (paramtype); sort = sort_makeFormal (sort); vi->sort = typeExpr2ptrSort (sort, paramdecl); vi->id = ltoken_copy (extractDeclarator (paramdecl)); vi->kind = VRK_PARAM; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); } } end_paramNodeList_elements; /* push onto symbol table the global variables declared in this function, together with their respective sorts */ pairNodeList_elements (globals, g2) { varInfo vi = (varInfo) dmalloc (sizeof (*vi)); vi->id = ltoken_copy (g2->tok); vi->kind = VRK_GLOBAL; vi->sort = g2->sort; vi->export = TRUE; /* should catch duplicates in formals */ (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); } end_pairNodeList_elements; pairNodeList_free (globals); /* should not free it here! ltoken_free (claimId); @*/ } static /*@only@*/ pairNodeList extractParams (/*@null@*/ typeExpr te) { /* extract the parameters from a function header declarator's typeExpr */ sort sort; typeExpr paramdecl; paramNodeList params; lclTypeSpecNode paramtype; pairNodeList head = pairNodeList_new (); pairNode pair; if (te != (typeExpr) 0) { params = typeExpr_toParamNodeList (te); if (paramNodeList_isDefined (params)) { paramNodeList_elements (params, param) { paramdecl = param->paramdecl; paramtype = param->type; if (paramdecl != (typeExpr) 0 && paramtype != (lclTypeSpecNode) 0) { pair = (pairNode) dmalloc (sizeof (*pair)); sort = lclTypeSpecNode2sort (paramtype); /* 2/17/93, was sort_makeVal (sort) */ sort = sort_makeFormal (sort); pair->sort = typeExpr2ptrSort (sort, paramdecl); /* pair->name = ltoken_getText (extractDeclarator (paramdecl)); */ pair->tok = ltoken_copy (extractDeclarator (paramdecl)); pairNodeList_addh (head, pair); } } end_paramNodeList_elements; } } return head; } sort sigNode_rangeSort (sigNode sig) { if (sig == (sigNode) 0) { return sort_makeNoSort (); } else { return sort_fromLsymbol (ltoken_getText (sig->range)); } } /*@only@*/ sortList sigNode_domain (sigNode sig) { sortList domain = sortList_new (); if (sig == (sigNode) 0) { ; } else { ltokenList dom = sig->domain; ltokenList_elements (dom, tok) { sortList_addh (domain, sort_fromLsymbol (ltoken_getText (tok))); } end_ltokenList_elements; } return domain; } opFormUnion opFormUnion_createAnyOp (/*@temp@*/ ltoken t) { opFormUnion u; /* do not distinguish between .anyop and .id */ u.anyop = t; return u; } opFormUnion opFormUnion_createMiddle (int middle) { opFormUnion u; u.middle = middle; return u; } paramNode markYieldParamNode (paramNode p) { p->kind = PYIELD; llassert (p->type != NULL); p->type->quals = qualList_add (p->type->quals, qual_createYield ()); return (p); } /*@only@*/ lclTypeSpecNode lclTypeSpecNode_copySafe (lclTypeSpecNode n) { lclTypeSpecNode ret = lclTypeSpecNode_copy (n); llassert (ret != NULL); return ret; } /*@null@*/ /*@only@*/ lclTypeSpecNode lclTypeSpecNode_copy (/*@null@*/ lclTypeSpecNode n) { if (n != NULL) { switch (n->kind) { case LTS_CONJ: return (makeLclTypeSpecNodeConj (lclTypeSpecNode_copy (n->content.conj->a), lclTypeSpecNode_copy (n->content.conj->b))); case LTS_TYPE: return (makeLclTypeSpecNodeType (CTypesNode_copy (n->content.type))); case LTS_STRUCTUNION: return (makeLclTypeSpecNodeSU (strOrUnionNode_copy (n->content.structorunion))); case LTS_ENUM: return (makeLclTypeSpecNodeEnum (enumSpecNode_copy (n->content.enumspec))); } } return NULL; } void lclTypeSpecNode_free (/*@null@*/ /*@only@*/ lclTypeSpecNode n) { if (n != NULL) { switch (n->kind) { case LTS_CONJ: lclTypeSpecNode_free (n->content.conj->a); lclTypeSpecNode_free (n->content.conj->b); break; case LTS_TYPE: CTypesNode_free (n->content.type); break; case LTS_STRUCTUNION: strOrUnionNode_free (n->content.structorunion); break; case LTS_ENUM: enumSpecNode_free (n->content.enumspec); break; } qualList_free (n->quals); sfree (n); } } static /*@null@*/ opFormNode opFormNode_copy (/*@null@*/ opFormNode op) { if (op != NULL) { opFormNode ret = (opFormNode) dmalloc (sizeof (*ret)); ret->tok = ltoken_copy (op->tok); ret->kind = op->kind; ret->content = op->content; ret->key = op->key; ret->close = ltoken_copy (op->close); return ret; } else { return NULL; } } void opFormNode_free (/*@null@*/ opFormNode op) { if (op != NULL) { ltoken_free (op->tok); ltoken_free (op->close); sfree (op); } } void nameNode_free (nameNode n) { if (n != NULL) { if (!n->isOpId) { opFormNode_free (n->content.opform); } sfree (n); } } bool lslOp_equal (lslOp x, lslOp y) { return ((x == y) || ((x != 0) && (y != 0) && sameNameNode (x->name, y->name) && sigNode_equal (x->signature, y->signature))); } void lslOp_free (lslOp x) { nameNode_free (x->name); sfree (x); } void sigNode_free (sigNode x) { if (x != NULL) { ltokenList_free (x->domain); ltoken_free (x->tok); ltoken_free (x->range); sfree (x); } } void declaratorNode_free (/*@null@*/ /*@only@*/ declaratorNode x) { if (x != NULL) { typeExpr_free (x->type); ltoken_free (x->id); sfree (x); } } void abstBodyNode_free (/*@null@*/ /*@only@*/ abstBodyNode n) { if (n != NULL) { lclPredicateNode_free (n->typeinv); fcnNodeList_free (n->fcns); ltoken_free (n->tok); sfree (n); } } void fcnNode_free (/*@null@*/ /*@only@*/ fcnNode f) { if (f != NULL) { lclTypeSpecNode_free (f->typespec); declaratorNode_free (f->declarator); globalList_free (f->globals); varDeclarationNodeList_free (f->inits); letDeclNodeList_free (f->lets); lclPredicateNode_free (f->checks); lclPredicateNode_free (f->require); lclPredicateNode_free (f->claim); lclPredicateNode_free (f->ensures); modifyNode_free (f->modify); ltoken_free (f->name); sfree (f); } } void declaratorInvNode_free (/*@null@*/ /*@only@*/ declaratorInvNode x) { if (x != NULL) { declaratorNode_free (x->declarator); abstBodyNode_free (x->body); sfree (x); } } /*@only@*/ lslOp lslOp_copy (lslOp x) { return (makelslOpNode (nameNode_copy (x->name), x->signature)); } sigNode sigNode_copy (sigNode s) { llassert (s != NULL); return (makesigNode (ltoken_copy (s->tok), ltokenList_copy (s->domain), ltoken_copy (s->range))); } /*@null@*/ nameNode nameNode_copy (/*@null@*/ nameNode n) { if (n == NULL) return NULL; return nameNode_copySafe (n); } nameNode nameNode_copySafe (nameNode n) { if (n->isOpId) { return (makeNameNodeId (ltoken_copy (n->content.opid))); } else { /* error should be detected by splint: forgot to copy opform! */ return (makeNameNodeForm (opFormNode_copy (n->content.opform))); } } bool initDeclNode_isRedeclaration (initDeclNode d) { return (d->declarator->isRedecl); } void termNode_free (/*@only@*/ /*@null@*/ termNode t) { if (t != NULL) { sortSet_free (t->possibleSorts); lslOpSet_free (t->possibleOps); nameNode_free (t->name); termNodeList_free (t->args); sfree (t); } } /*@only@*/ termNode termNode_copySafe (termNode t) { termNode ret = termNode_copy (t); llassert (ret != NULL); return ret; } /*@null@*/ /*@only@*/ termNode termNode_copy (/*@null@*/ termNode t) { if (t != NULL) { termNode ret = (termNode) dmalloc (sizeof (*ret)); ret->wrapped = t->wrapped; ret->kind = t->kind; ret->sort = t->sort; ret->given = t->given; ret->possibleSorts = sortSet_copy (t->possibleSorts); ret->error_reported = t->error_reported; ret->possibleOps = lslOpSet_copy (t->possibleOps); ret->name = nameNode_copy (t->name); ret->args = termNodeList_copy (t->args); if (t->kind == TRM_LITERAL || t->kind == TRM_SIZEOF || t->kind == TRM_VAR || t->kind == TRM_CONST || t->kind == TRM_ZEROARY) { ret->literal = ltoken_copy (t->literal); } if (t->kind == TRM_UNCHANGEDOTHERS) { ret->unchanged = storeRefNodeList_copy (t->unchanged); } if (t->kind == TRM_QUANTIFIER) { ret->quantified = quantifiedTermNode_copy (t->quantified); } if (t->kind == TRM_SIZEOF) { ret->sizeofField = lclTypeSpecNode_copySafe (t->sizeofField); } return ret; } else { return NULL; } } void importNode_free (/*@only@*/ /*@null@*/ importNode x) { if (x != NULL) { ltoken_free (x->val); sfree (x); } } void initDeclNode_free (/*@only@*/ /*@null@*/ initDeclNode x) { if (x != NULL) { declaratorNode_free (x->declarator); termNode_free (x->value); sfree (x); } } void letDeclNode_free (/*@only@*/ /*@null@*/ letDeclNode x) { if (x != NULL) { lclTypeSpecNode_free (x->sortspec); termNode_free (x->term); ltoken_free (x->varid); sfree (x); } } void pairNode_free (/*@only@*/ /*@null@*/ pairNode x) { if (x != NULL) { ltoken_free (x->tok); sfree (x); } } /*@null@*/ paramNode paramNode_copy (/*@null@*/ paramNode p) { if (p != NULL) { paramNode ret = (paramNode) dmalloc (sizeof (*ret)); ret->type = lclTypeSpecNode_copy (p->type); ret->paramdecl = typeExpr_copy (p->paramdecl); ret->kind = p->kind; return ret; } return NULL; } void paramNode_free (/*@only@*/ /*@null@*/ paramNode x) { if (x != NULL) { lclTypeSpecNode_free (x->type); typeExpr_free (x->paramdecl); sfree (x); } } void programNode_free (/*@only@*/ /*@null@*/ programNode x) { if (x != NULL) { switch (x->kind) { case ACT_SELF: stmtNode_free (x->content.self); break; case ACT_ITER: case ACT_ALTERNATE: case ACT_SEQUENCE: programNodeList_free (x->content.args); break; BADDEFAULT; } sfree (x); } } quantifierNode quantifierNode_copy (quantifierNode x) { quantifierNode ret = (quantifierNode) dmalloc (sizeof (*ret)); ret->quant = ltoken_copy (x->quant); ret->vars = varNodeList_copy (x->vars); ret->isForall = x->isForall; return ret; } void quantifierNode_free (/*@null@*/ /*@only@*/ quantifierNode x) { if (x != NULL) { varNodeList_free (x->vars); ltoken_free (x->quant); sfree (x); } } void replaceNode_free (/*@only@*/ /*@null@*/ replaceNode x) { if (x != NULL) { if (x->isCType) { ; } else { nameNode_free (x->content.renamesortname.name); sigNode_free (x->content.renamesortname.signature); } typeNameNode_free (x->typename); ltoken_free (x->tok); sfree (x); } } storeRefNode storeRefNode_copy (storeRefNode x) { storeRefNode ret = (storeRefNode) dmalloc (sizeof (*ret)); ret->kind = x->kind; switch (x->kind) { case SRN_TERM: ret->content.term = termNode_copySafe (x->content.term); break; case SRN_OBJ: case SRN_TYPE: ret->content.type = lclTypeSpecNode_copy (x->content.type); break; case SRN_SPECIAL: ret->content.ref = sRef_copy (x->content.ref); break; } return ret; } void storeRefNode_free (/*@only@*/ /*@null@*/ storeRefNode x) { if (x != NULL) { if (storeRefNode_isTerm (x)) { termNode_free (x->content.term); } else if (storeRefNode_isType (x) || storeRefNode_isObj (x)) { lclTypeSpecNode_free (x->content.type); } else { /* nothing to free */ } sfree (x); } } stDeclNode stDeclNode_copy (stDeclNode x) { stDeclNode ret = (stDeclNode) dmalloc (sizeof (*ret)); ret->lcltypespec = lclTypeSpecNode_copySafe (x->lcltypespec); ret->declarators = declaratorNodeList_copy (x->declarators); return ret; } void stDeclNode_free (/*@only@*/ /*@null@*/ stDeclNode x) { if (x != NULL) { lclTypeSpecNode_free (x->lcltypespec); declaratorNodeList_free (x->declarators); sfree (x); } } void traitRefNode_free (/*@only@*/ /*@null@*/ traitRefNode x) { if (x != NULL) { ltokenList_free (x->traitid); renamingNode_free (x->rename); sfree (x); } } void typeNameNode_free (/*@only@*/ /*@null@*/ typeNameNode n) { if (n != NULL) { typeNamePack_free (n->typename); opFormNode_free (n->opform); sfree (n); } } void varDeclarationNode_free (/*@only@*/ /*@null@*/ varDeclarationNode x) { if (x != NULL) { if (x->isSpecial) { ; } else { lclTypeSpecNode_free (x->type); initDeclNodeList_free (x->decls); sfree (x); } } } varNode varNode_copy (varNode x) { varNode ret = (varNode) dmalloc (sizeof (*ret)); ret->varid = ltoken_copy (x->varid); ret->isObj = x->isObj; ret->type = lclTypeSpecNode_copySafe (x->type); ret->sort = x->sort; return ret; } void varNode_free (/*@only@*/ /*@null@*/ varNode x) { if (x != NULL) { lclTypeSpecNode_free (x->type); ltoken_free (x->varid); sfree (x); } } void stmtNode_free (/*@only@*/ /*@null@*/ stmtNode x) { if (x != NULL) { ltoken_free (x->lhs); termNodeList_free (x->args); ltoken_free (x->operator); sfree (x); } } void renamingNode_free (/*@only@*/ /*@null@*/ renamingNode x) { if (x != NULL) { if (x->is_replace) { replaceNodeList_free (x->content.replace); } else { nameAndReplaceNode_free (x->content.name); } sfree (x); } } void nameAndReplaceNode_free (/*@only@*/ /*@null@*/ nameAndReplaceNode x) { if (x != NULL) { typeNameNodeList_free (x->namelist); replaceNodeList_free (x->replacelist); sfree (x); } } void typeNamePack_free (/*@only@*/ /*@null@*/ typeNamePack x) { if (x != NULL) { lclTypeSpecNode_free (x->type); abstDeclaratorNode_free (x->abst); sfree (x); } } cstring interfaceNode_unparse (interfaceNode x) { if (x != NULL) { switch (x->kind) { case INF_IMPORTS: return (message ("[imports] %q", importNodeList_unparse (x->content.imports))); case INF_USES: return (message ("[uses] %q", traitRefNodeList_unparse (x->content.uses))); case INF_EXPORT: return (message ("[export] %q", exportNode_unparse (x->content.export))); case INF_PRIVATE: return (message ("[private] %q", privateNode_unparse (x->content.private))); } BADBRANCH; } else { return (cstring_makeLiteral ("")); } BADBRANCHRET (cstring_undefined); } void interfaceNode_free (/*@null@*/ /*@only@*/ interfaceNode x) { if (x != NULL) { switch (x->kind) { case INF_IMPORTS: importNodeList_free (x->content.imports); break; case INF_USES: traitRefNodeList_free (x->content.uses); break; case INF_EXPORT: exportNode_free (x->content.export); break; case INF_PRIVATE: privateNode_free (x->content.private); break; } sfree (x); } } void exportNode_free (/*@null@*/ /*@only@*/ exportNode x) { if (x != NULL) { switch (x->kind) { case XPK_CONST: constDeclarationNode_free (x->content.constdeclaration); break; case XPK_VAR: varDeclarationNode_free (x->content.vardeclaration); break; case XPK_TYPE: typeNode_free (x->content.type); break; case XPK_FCN: fcnNode_free (x->content.fcn); break; case XPK_CLAIM: claimNode_free (x->content.claim); break; case XPK_ITER: iterNode_free (x->content.iter); break; } sfree (x); } } void privateNode_free (/*@null@*/ /*@only@*/ privateNode x) { if (x != NULL) { switch (x->kind) { case PRIV_CONST: constDeclarationNode_free (x->content.constdeclaration); break; case PRIV_VAR: varDeclarationNode_free (x->content.vardeclaration); break; case PRIV_TYPE: typeNode_free (x->content.type); break; case PRIV_FUNCTION: fcnNode_free (x->content.fcn); break; } sfree (x); } } void constDeclarationNode_free (/*@only@*/ /*@null@*/ constDeclarationNode x) { if (x != NULL) { lclTypeSpecNode_free (x->type); initDeclNodeList_free (x->decls); sfree (x); } } void typeNode_free (/*@only@*/ /*@null@*/ typeNode t) { if (t != NULL) { switch (t->kind) { case TK_ABSTRACT: abstractNode_free (t->content.abstract); break; case TK_EXPOSED: exposedNode_free (t->content.exposed); break; case TK_UNION: taggedUnionNode_free (t->content.taggedunion); break; } sfree (t); } } void claimNode_free (/*@only@*/ /*@null@*/ claimNode x) { if (x != NULL) { paramNodeList_free (x->params); globalList_free (x->globals); letDeclNodeList_free (x->lets); lclPredicateNode_free (x->require); programNode_free (x->body); lclPredicateNode_free (x->ensures); ltoken_free (x->name); sfree (x); } } void iterNode_free (/*@only@*/ /*@null@*/ iterNode x) { if (x != NULL) { paramNodeList_free (x->params); ltoken_free (x->name); sfree (x); } } void abstractNode_free (/*@only@*/ /*@null@*/ abstractNode x) { if (x != NULL) { abstBodyNode_free (x->body); ltoken_free (x->tok); ltoken_free (x->name); sfree (x); } } void exposedNode_free (/*@only@*/ /*@null@*/ exposedNode x) { if (x != NULL) { lclTypeSpecNode_free (x->type); declaratorInvNodeList_free (x->decls); ltoken_free (x->tok); sfree (x); } } void taggedUnionNode_free (/*@only@*/ /*@null@*/ taggedUnionNode x) { if (x != NULL) { stDeclNodeList_free (x->structdecls); declaratorNode_free (x->declarator); sfree (x); } } /*@only@*/ /*@null@*/ strOrUnionNode strOrUnionNode_copy (/*@null@*/ strOrUnionNode n) { if (n != NULL) { strOrUnionNode ret = (strOrUnionNode) dmalloc (sizeof (*ret)); ret->kind = n->kind; ret->tok = ltoken_copy (n->tok); ret->opttagid = ltoken_copy (n->opttagid); ret->sort = n->sort; ret->structdecls = stDeclNodeList_copy (n->structdecls); return ret; } else { return NULL; } } void strOrUnionNode_free (/*@null@*/ /*@only@*/ strOrUnionNode n) { if (n != NULL) { stDeclNodeList_free (n->structdecls); ltoken_free (n->tok); ltoken_free (n->opttagid); sfree (n); } } void enumSpecNode_free (/*@null@*/ /*@only@*/ enumSpecNode x) { if (x != NULL) { ltokenList_free (x->enums); ltoken_free (x->tok); ltoken_free (x->opttagid); sfree (x); } } /*@only@*/ /*@null@*/ enumSpecNode enumSpecNode_copy (/*@null@*/ enumSpecNode x) { if (x != NULL) { enumSpecNode ret = (enumSpecNode) dmalloc (sizeof (*ret)); ret->tok = ltoken_copy (x->tok); ret->opttagid = ltoken_copy (x->opttagid); ret->enums = ltokenList_copy (x->enums); ret->sort = x->sort; return ret; } else { return NULL; } } void lsymbol_setbool (lsymbol s) { lsymbol_bool = s; } lsymbol lsymbol_getbool () { return lsymbol_bool; } lsymbol lsymbol_getBool () { return lsymbol_Bool; } lsymbol lsymbol_getFALSE () { return lsymbol_FALSE; } lsymbol lsymbol_getTRUE () { return lsymbol_TRUE; } splint-3.1.2.dfsg1/src/ltoken.c0000644021234200000250000002560007646432515013711 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** ltoken.c */ # include "splintMacros.nf" # include "basic.h" # include "llgrammar.h" # include "scanline.h" # include "lclscanline.h" /* ** Place to store the \keyword (\forall ...) tokens. These tokens will ** have to be modified when the extensionChar ("\") changes. ** set in LCLScanLineInit of lclscanline.c or in scanline.c */ /*@-namechecks@*/ /* These should all start with g_ */ ltoken ltoken_forall; ltoken ltoken_exists; ltoken ltoken_true; ltoken ltoken_false; ltoken ltoken_not; ltoken ltoken_and; ltoken ltoken_or; ltoken ltoken_implies; ltoken ltoken_eq; ltoken ltoken_neq; ltoken ltoken_equals; ltoken ltoken_eqsep; ltoken ltoken_select; ltoken ltoken_open; ltoken ltoken_sep; ltoken ltoken_close; ltoken ltoken_id; ltoken ltoken_arrow; ltoken ltoken_marker; ltoken ltoken_pre; ltoken ltoken_post; ltoken ltoken_comment; ltoken ltoken_any; ltoken ltoken_compose; ltoken ltoken_if; ltoken ltoken_result; ltoken ltoken_typename; ltoken ltoken_bool; ltoken ltoken_farrow; ltoken ltoken_lbracked; ltoken ltoken_rbracket; /*@=namechecks@*/ static /*@notnull@*/ ltoken ltoken_new (void) { ltoken tok = (ltoken) dmalloc (sizeof (*tok)); tok->code = NOTTOKEN; tok->col = 0; tok->line = 0; tok->text = lsymbol_undefined; tok->fname = lsymbol_undefined; tok->rawText = lsymbol_undefined; tok->defined = FALSE; tok->hasSyn = FALSE; return tok; } ltoken ltoken_create (ltokenCode code, lsymbol text) { ltoken tok = ltoken_new (); tok->code = code; tok->text = text; return tok; } ltoken ltoken_createRaw (ltokenCode code, lsymbol text) { ltoken tok = ltoken_new (); tok->code = code; tok->rawText = text; return tok; } ltoken ltoken_createType (ltokenCode code, SimpleIdCode idtype, lsymbol text) { ltoken tok = ltoken_new (); /* no...what's the real llassert (code == simpleId); */ tok->code = code; tok->idtype = idtype; tok->text = text; return tok; } ltoken ltoken_createFull (ltokenCode code, lsymbol text, cstring file, int line, int col) { ltoken tok = (ltoken) dmalloc (sizeof (*tok)); tok->code = code; tok->text = text; tok->fname = lsymbol_fromString (file); tok->line = line; tok->col = col; tok->rawText = lsymbol_undefined; tok->defined = FALSE; tok->hasSyn = FALSE; return tok; } static /*@only@*/ cstring LCLTokenCode_unparseCodeName (ltokenCode t) { switch (t) { case NOTTOKEN: return cstring_makeLiteral ("*** NOTTOKEN ***"); case quantifierSym: return cstring_makeLiteral ("QUANTIFIERSYM"); case logicalOp: return cstring_makeLiteral ("LOGICALOP"); case selectSym: return cstring_makeLiteral ("SELECTSYM"); case openSym: return cstring_makeLiteral ("OPENSYM"); case preSym: return cstring_makeLiteral ("\\pre"); case postSym: return cstring_makeLiteral ("\\post"); case anySym: return cstring_makeLiteral ("\\any"); case sepSym: return cstring_makeLiteral ("SEPSYM"); case closeSym: return cstring_makeLiteral ("CLOSESYM"); case simpleId: return cstring_makeLiteral ("simpleId"); case LLT_TYPEDEF_NAME: return cstring_makeLiteral ("TYPEDEF_NAME"); case mapSym: return cstring_makeLiteral ("MAPSYM"); case markerSym: return cstring_makeLiteral ("MARKERSYM"); case commentSym: return cstring_makeLiteral ("COMMENTSYM"); case simpleOp: return cstring_makeLiteral ("SIMPLEOP"); case LLT_COLON: return cstring_makeLiteral ("COLON"); case LLT_COMMA: return cstring_makeLiteral ("COMMA"); case LLT_EQUALS: return cstring_makeLiteral ("LLT_EQUALS"); case LLT_LBRACE: return cstring_makeLiteral ("LBRACE"); case LLT_LBRACKET: return cstring_makeLiteral ("LBRACKET"); case LLT_LPAR: return cstring_makeLiteral ("LPAR"); case LLT_QUOTE: return cstring_makeLiteral ("QUOTE"); case LLT_RBRACE: return cstring_makeLiteral ("RBRACE"); case LLT_RBRACKET: return cstring_makeLiteral ("RBRACKET"); case LLT_RPAR: return cstring_makeLiteral ("RPAR"); case LLT_SEMI: return cstring_makeLiteral ("SEMI"); case LLT_VERTICALBAR: return cstring_makeLiteral ("VERTICALBAR"); case eqOp: return cstring_makeLiteral ("EQOP"); case LLT_MULOP: return cstring_makeLiteral ("MULOP"); case LLT_WHITESPACE: return cstring_makeLiteral ("WHITESPACE,"); case LEOFTOKEN: return cstring_makeLiteral ("EOFTOKEN"); case LLT_EOL: return cstring_makeLiteral ("LLT_EOL"); case LLT_CCHAR: return cstring_makeLiteral ("CCHAR"); case LLT_CFLOAT: return cstring_makeLiteral ("CFLOAT"); case LLT_CINTEGER: return cstring_makeLiteral ("CINTEGER"); case LLT_LCSTRING: return cstring_makeLiteral ("CSTRING"); case LLT_ALL: return cstring_makeLiteral ("allTOKEN"); case LLT_ANYTHING: return cstring_makeLiteral ("anythingTOKEN"); case LLT_BE: return cstring_makeLiteral ("beTOKEN"); case LLT_CONSTANT: return cstring_makeLiteral ("constantTOKEN"); case LLT_ELSE: return cstring_makeLiteral ("elseTOKEN"); case LLT_ENSURES: return cstring_makeLiteral ("ensuresTOKEN"); case LLT_IF: return cstring_makeLiteral ("ifTOKEN"); case LLT_IMMUTABLE: return cstring_makeLiteral ("immutableTOKEN"); case LLT_OBJ: return cstring_makeLiteral ("objTOKEN"); case LLT_IMPORTS: return cstring_makeLiteral ("importsTOKEN"); case LLT_CONSTRAINT: return cstring_makeLiteral ("constraintTOKEN"); case LLT_LET: return cstring_makeLiteral ("letTOKEN"); case LLT_MODIFIES: return cstring_makeLiteral ("modifiesTOKEN"); case LLT_CLAIMS: return cstring_makeLiteral ("claimsTOKEN"); case LLT_MUTABLE: return cstring_makeLiteral ("mutableTOKEN"); case LLT_FRESH: return cstring_makeLiteral ("freshTOKEN"); case LLT_NOTHING: return cstring_makeLiteral ("nothingTOKEN"); case LLT_PRIVATE: return cstring_makeLiteral ("privateTOKEN"); case LLT_SPEC: return cstring_makeLiteral ("specTOKEN"); case LLT_REQUIRES: return cstring_makeLiteral ("requiresTOKEN"); case LLT_BODY: return cstring_makeLiteral ("bodyTOKEN"); case LLT_RESULT: return cstring_makeLiteral ("resultTOKEN"); case LLT_SIZEOF: return cstring_makeLiteral ("sizeofTOKEN"); case LLT_THEN: return cstring_makeLiteral ("thenTOKEN"); case LLT_TYPE: return cstring_makeLiteral ("typeTOKEN"); case LLT_TYPEDEF: return cstring_makeLiteral ("typedefTOKEN"); case LLT_UNCHANGED: return cstring_makeLiteral ("unchangedTOKEN"); case LLT_USES: return cstring_makeLiteral ("usesTOKEN"); case LLT_CHAR: return cstring_makeLiteral ("charTOKEN"); case LLT_CONST: return cstring_makeLiteral ("constTOKEN"); case LLT_DOUBLE: return cstring_makeLiteral ("doubleTOKEN"); case LLT_ENUM: return cstring_makeLiteral ("enumTOKEN"); case LLT_FLOAT: return cstring_makeLiteral ("floatTOKEN"); case LLT_INT: return cstring_makeLiteral ("intTOKEN"); case LLT_LONG: return cstring_makeLiteral ("longTOKEN"); case LLT_SHORT: return cstring_makeLiteral ("shortTOKEN"); case LLT_STRUCT: return cstring_makeLiteral ("structTOKEN"); case LLT_SIGNED: return cstring_makeLiteral ("signedTOKEN"); case LLT_UNION: return cstring_makeLiteral ("unionTOKEN"); case LLT_UNKNOWN: return cstring_makeLiteral ("unknownTOKEN"); case LLT_UNSIGNED: return cstring_makeLiteral ("unsignedTOKEN"); case LLT_VOID: return cstring_makeLiteral ("voidTOKEN"); case LLT_VOLATILE: return cstring_makeLiteral ("volatileTOKEN"); case LLT_TELIPSIS: return cstring_makeLiteral ("elipsisTOKEN"); case LLT_ITER: return cstring_makeLiteral ("iterTOKEN"); case LLT_YIELD: return cstring_makeLiteral ("yieldTOKEN"); default: return cstring_makeLiteral ("*** invalid token code ***"); } /* end switch */ } cstring ltoken_unparseCodeName (ltoken tok) { return LCLTokenCode_unparseCodeName (ltoken_getCode (tok)); } /*@observer@*/ cstring ltoken_unparse (ltoken s) { if (ltoken_isValid (s)) { return (lsymbol_toString (s->text)); } else { return cstring_undefined; } } ltoken ltoken_copy (ltoken tok) { if (ltoken_isValid (tok)) { ltoken ret = (ltoken) dmalloc (sizeof (*ret)); ret->code = tok->code; ret->text = tok->text; ret->fname = tok->fname; ret->line = tok->line; ret->col = tok->col; ret->rawText = tok->rawText; ret->defined = tok->defined; ret->hasSyn = tok->hasSyn; ret->idtype = tok->idtype; ret->intfield = tok->intfield; return ret; } else { return ltoken_undefined; } } lsymbol ltoken_getRawText (ltoken tok) { if (ltoken_isValid (tok)) { lsymbol ret = tok->rawText; if (lsymbol_isUndefined (ret)) { ret = tok->text; } return ret; } else { return lsymbol_undefined; } } /*@only@*/ cstring ltoken_unparseLoc (ltoken t) { if (ltoken_getCode (t) != NOTTOKEN) { cstring res = fileloc_unparseRawCol (ltoken_fileName (t), ltoken_getLine (t), ltoken_getCol (t)); return res; } else { return cstring_makeLiteral ("*** Not Token ***"); } } void ltoken_markOwned (/*@owned@*/ ltoken tok) { sfreeEventually (tok); } void ltoken_free (/*@only@*/ ltoken tok) { sfree (tok); } bool ltoken_isSingleChar (char c) { return (LCLScanCharClass (c) == SINGLECHAR); } splint-3.1.2.dfsg1/src/lclscanline.c0000644021234200000250000015505207646432515014711 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** scanline.c ** ** MODULE DESCRIPTION: ** ** This module scans one line of Larch C Interface Language (LCL) input at ** a time. ** ** The input is source text, line at a time. The output is a sequence ** of tokens, reported by call-out LSLScanFreshToken. ** ** This organization allows implementation of line-at-a-time incremental ** scanning. The incremental mechanism is in the driving module scan.c. ** ** The main loop of the scanner keys on the leading character. ** Within the loop are actions which collect the rest of the ** token starting with the character. Various careful hacks ** show up to disambiguate tokens that break the general pattern ** (Examples, \/ and /\). White space is passed and the loop ** goes once again without calling LSLScanFreshToken (). ** The line ends with a null. ** ** AUTHORS: ** ** JPW, GAF, Yang Meng Tan */ # include "splintMacros.nf" # include "basic.h" # include "gram.h" # include "lclscan.h" # include "scanline.h" # include "lclscanline.h" # include "lcltokentable.h" # include "lclsyntable.h" /*@constant int CHARSIZE;@*/ # define CHARSIZE 256 /* on an 8-bit machine */ /*@notfunction@*/ # define LCLMOVECHAR() \ do { *bufPtr++ = currentChar; currentChar = *currentLine++; \ colNumber++; } while (FALSE) /*@notfunction@*/ # define LOOKAHEADCHAR() (*currentLine) /*@notfunction@*/ # define LOOKAHEADTWICECHAR() (*(currentLine + 1)) /*@constant static int MAXCHAR;@*/ # define MAXCHAR 512 /* storage for a lexeme */ /* ** Printname for the TokenCode NOTTOKEN (also 1st one reserved) ** Printname for the TokenCode BADTOKEN (also last one reserved) */ /*@constant static observer char *FIRSTRESERVEDNAME;@*/ # define FIRSTRESERVEDNAME "?" /* ** The scanner establishes lexical boundaries by first switching ** on the leading character of the pending lexeme. */ typedef enum { STARTCNUM, /* First character of a C number. */ STARTCNUMDOT, /* "." only starts a C number if digit follows*/ STARTCSTR, /* First character of a C string. */ STARTCCHAR, /* First character of a C character. */ STARTWIDE, /* slash L starts both string and character. */ STARTSLASH, /* "/" starts caret, comment comment, operator */ STARTOTHER /* Everything else. */ } StartCharType; static void ScanCComment (void); static void ScanEscape (void); static void ScanCString (void); static void ScanCChar (void); static void ScanCNumber (void); static void LocalUserError (/*@temp@*/ char *); /* ** Array to store character class defintions and record end-of-comment ** characters. */ static charClassData LCLcharClass[LASTCHAR + 1]; /* ** Data shared between routines LCLScanLine, ScanCString, ScanCChar, ** ScanCNumber. LCLScanLine was getting too big for one routine and ** passing this data was rather cumbersome. Making this data global seemed ** to be the simpliest solution. */ /* evs - sounds bogus to me! */ static int colNumber; static int startCol; static char *currentLine; static char currentChar; static ltokenCode tokenCode; static lsymbol tokenSym; static char *bufPtr; static bool inComment; static /*@only@*/ ltoken commentTok; static ltokenCode prevTokenCode; /* to disambiguate ' */ static StartCharType startClass[CHARSIZE] = { STARTOTHER, /* ^@ 00x */ STARTOTHER, /* ^a 01x */ STARTOTHER, /* ^b 02x */ STARTOTHER, /* ^c 03x */ STARTOTHER, /* ^d 04x */ STARTOTHER, /* ^e 05x */ STARTOTHER, /* ^f 06x */ STARTOTHER, /* ^g BELL 07x */ STARTOTHER, /* ^h BACKSPACE 08x */ STARTOTHER, /* ^i TAB 09x */ STARTOTHER, /* ^j NEWLINE 0Ax */ STARTOTHER, /* ^k 0Bx */ STARTOTHER, /* ^l FORMFEED 0Cx */ STARTOTHER, /* ^m RETURN 0Dx */ STARTOTHER, /* ^n 0Ex */ STARTOTHER, /* ^o 0Fx */ STARTOTHER, /* ^p 10x */ STARTOTHER, /* ^q 11x */ STARTOTHER, /* ^r 12x */ STARTOTHER, /* ^s 13x */ STARTOTHER, /* ^t 14x */ STARTOTHER, /* ^u 15x */ STARTOTHER, /* ^v 16x */ STARTOTHER, /* ^w 17x */ STARTOTHER, /* ^x 18x */ STARTOTHER, /* ^y 19x */ STARTOTHER, /* ^z 1Ax */ STARTOTHER, /* ^[ ESC 1Bx */ STARTOTHER, /* ^slash 1Cx */ STARTOTHER, /* ^] 1Dx */ STARTOTHER, /* ^^ 1Ex */ STARTOTHER, /* ^_ 1Fx */ STARTOTHER, /* BLANK 20x */ STARTOTHER, /* ! 21x */ STARTCSTR, /* " 22x */ STARTOTHER, /* # 23x */ STARTOTHER, /* $ (may be changed in reset) 24x */ STARTOTHER, /* % 25x */ STARTOTHER, /* & 26x */ STARTCCHAR, /* ' 27x */ STARTOTHER, /* ( 28x */ STARTOTHER, /* ) 29x */ STARTOTHER, /* * 2Ax */ STARTOTHER, /* + 2Bx */ STARTOTHER, /* , 2Cx */ STARTOTHER, /* - 2Dx */ STARTCNUMDOT, /* . 2Ex */ STARTSLASH, /* / 2Fx */ STARTCNUM, /* 0 30x */ STARTCNUM, /* 1 31x */ STARTCNUM, /* 2 32x */ STARTCNUM, /* 3 33x */ STARTCNUM, /* 4 34x */ STARTCNUM, /* 5 35x */ STARTCNUM, /* 6 36x */ STARTCNUM, /* 7 37x */ STARTCNUM, /* 8 38x */ STARTCNUM, /* 9 39x */ STARTOTHER, /* : 3Ax */ STARTOTHER, /* ; 3Bx */ STARTOTHER, /* < 3Cx */ STARTOTHER, /* = 3Dx */ STARTOTHER, /* > 3Ex */ STARTOTHER, /* ? 3Fx */ STARTOTHER, /* @ 40x */ STARTOTHER, /* A 41x */ STARTOTHER, /* B 42x */ STARTOTHER, /* C 43x */ STARTOTHER, /* D 44x */ STARTOTHER, /* E 45x */ STARTOTHER, /* F 46x */ STARTOTHER, /* G 47x */ STARTOTHER, /* H 48x */ STARTOTHER, /* I 49x */ STARTOTHER, /* J 4Ax */ STARTOTHER, /* K 4Bx */ STARTOTHER, /* L 4Cx */ STARTOTHER, /* M 4Dx */ STARTOTHER, /* N 4Ex */ STARTOTHER, /* O 4Fx */ STARTOTHER, /* P 50x */ STARTOTHER, /* Q 51x */ STARTOTHER, /* R 52x */ STARTOTHER, /* S 53x */ STARTOTHER, /* T 54x */ STARTOTHER, /* U 55x */ STARTOTHER, /* V 56x */ STARTOTHER, /* W 57x */ STARTOTHER, /* X 58x */ STARTOTHER, /* Y 59x */ STARTOTHER, /* Z 5Ax */ STARTOTHER, /* [ 5Bx */ STARTWIDE, /* slash 5Cx */ STARTOTHER, /* ] 5Dx */ STARTOTHER, /* ^ 5Ex */ STARTOTHER, /* _ 5Fx */ STARTOTHER, /* ` 60x */ STARTOTHER, /* a 61x */ STARTOTHER, /* b 62x */ STARTOTHER, /* c 63x */ STARTOTHER, /* d 64x */ STARTOTHER, /* e 65x */ STARTOTHER, /* f 66x */ STARTOTHER, /* g 67x */ STARTOTHER, /* h 68x */ STARTOTHER, /* i 69x */ STARTOTHER, /* j 6Ax */ STARTOTHER, /* k 6Bx */ STARTOTHER, /* l 6Cx */ STARTOTHER, /* m 6Dx */ STARTOTHER, /* n 6Ex */ STARTOTHER, /* o 6Fx */ STARTOTHER, /* p 70x */ STARTOTHER, /* q 71x */ STARTOTHER, /* r 72x */ STARTOTHER, /* s 73x */ STARTOTHER, /* t 74x */ STARTOTHER, /* u 75x */ STARTOTHER, /* v 76x */ STARTOTHER, /* w 77x */ STARTOTHER, /* x 78x */ STARTOTHER, /* y 79x */ STARTOTHER, /* z 7Ax */ STARTOTHER, /* { 7Dx */ STARTOTHER, /* | 7Cx */ STARTOTHER, /* } 7Dx */ STARTOTHER, /* ~ 7Ex */ STARTOTHER, STARTOTHER /* RUBOUT 7Fx */ }; /* ** Given a character code, its status as part of an decimal escape sequence ** can be derived from this table. Digits 0-9 allowed. */ static bool isDigit[CHARSIZE] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }; /* * Given a character code, its status as part of an octal escape sequence * can be derived from this table. Digits 0-7 allowed. */ static bool isOigit[CHARSIZE] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }; /* * Given a character code, its status as part of a hex escape sequence * can be derived from this table. Digits, a-f, A-F allowed. */ static bool isXigit[CHARSIZE] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }; /* * Given a character code, its status as part of a C string * can be derived from this table. Everything but quotes and newline * are allowed. */ static bool isStrChar[CHARSIZE] = { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }; /* * Given a character code, its status as part of a C Character * can be derived from this table. Everything but quotes and newline * are allowed. */ static bool isCharChar[CHARSIZE] = { TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE }; /* ** Given a character code, its status as part of a string or character ** simple escape sequence ('slash'', 'slash"', 'slash?', 'slashslash', ** 'slasha', 'slashb', 'slashf', 'slashn', 'slasht', and 'slashv') ** can be derived from this table. ''', '"', '?', 'slash', 'a', ** 'b', 'f', 'n', 't', and 'v' are allowed. */ static bool isSimpleEscape[CHARSIZE] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, FALSE, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE }; static bool reportEOL; static bool reportComments; static lsymbol firstReserved; static char tokenBuffer[MAXCHAR]; static const charClassData charClassDef[] = { /* Control characters */ { SINGLECHAR, FALSE }, /* 0 NULL */ { SINGLECHAR, FALSE }, /* 1 CTRL-A */ { SINGLECHAR, FALSE }, /* 2 CTRL-B */ { SINGLECHAR, FALSE }, /* 3 CTRL-C */ { SINGLECHAR, FALSE }, /* 4 CTRL-D */ { SINGLECHAR, FALSE }, /* 5 CTRL-E */ { SINGLECHAR, FALSE }, /* 6 CTRL-F */ { SINGLECHAR, FALSE }, /* 7 CTRL-G */ { SINGLECHAR, FALSE }, /* 8 CTRL-H */ /* defined formatting characters */ { WHITECHAR, FALSE }, /* 9 CTRL-I TAB */ { CHC_NULL, TRUE }, /* 10 CTRL-J EOL */ /* more control characters */ { SINGLECHAR, FALSE }, /* 11 CTRL-K */ { WHITECHAR, FALSE }, /* 12 CTRL-L */ { SINGLECHAR, FALSE }, /* 13 CTRL-M */ { SINGLECHAR, FALSE }, /* 14 CTRL-N */ { SINGLECHAR, FALSE }, /* 15 CTRL-O */ { SINGLECHAR, FALSE }, /* 16 CTRL-P */ { SINGLECHAR, FALSE }, /* 17 CTRL-Q */ { SINGLECHAR, FALSE }, /* 18 CTRL-R */ { SINGLECHAR, FALSE }, /* 19 CTRL-S */ { SINGLECHAR, FALSE }, /* 20 CTRL-T */ { SINGLECHAR, FALSE }, /* 21 CTRL-U */ { SINGLECHAR, FALSE }, /* 22 CTRL-V */ { SINGLECHAR, FALSE }, /* 23 CTRL-W */ { SINGLECHAR, FALSE }, /* 24 CTRL-X */ { SINGLECHAR, FALSE }, /* 25 CTRL-Y */ { SINGLECHAR, FALSE }, /* 26 CTRL-Z */ { SINGLECHAR, FALSE }, /* 27 CTRL-[ ESC */ { SINGLECHAR, FALSE }, /* 28 CTRL-slash FS */ { SINGLECHAR, FALSE }, /* 29 CTRL-] GS */ { SINGLECHAR, FALSE }, /* 30 CTRL-^ RS */ { SINGLECHAR, FALSE }, /* 31 CTRL-_ US */ /* Special printing characters */ { WHITECHAR, FALSE }, /* 32 space */ { SINGLECHAR, FALSE }, /* 33 ! */ { SINGLECHAR, FALSE }, /* 34 " */ { SINGLECHAR, FALSE }, /* 35 # */ { SINGLECHAR, FALSE }, /* 36 $ */ { SINGLECHAR, FALSE }, /* 37 % */ { SINGLECHAR, FALSE }, /* 38 & */ { SINGLECHAR, FALSE }, /* 39 ' */ /* Reserved characters */ { PERMCHAR, FALSE }, /* 40 ( */ { PERMCHAR, FALSE }, /* 41 ) */ { PERMCHAR, FALSE }, /* 42 * */ { OPCHAR, FALSE }, /* 43 + */ { PERMCHAR, FALSE }, /* 44 , */ { OPCHAR, FALSE }, /* 45 - */ { OPCHAR, FALSE }, /* 46 . */ { OPCHAR, FALSE }, /* 47 / */ /* Numbers */ { IDCHAR, FALSE }, /* 48 0 */ { IDCHAR, FALSE }, /* 49 1 */ { IDCHAR, FALSE }, /* 50 2 */ { IDCHAR, FALSE }, /* 51 3 */ { IDCHAR, FALSE }, /* 52 4 */ { IDCHAR, FALSE }, /* 53 5 */ { IDCHAR, FALSE }, /* 54 6 */ { IDCHAR, FALSE }, /* 55 7 */ { IDCHAR, FALSE }, /* 56 8 */ { IDCHAR, FALSE }, /* 57 9 */ /* More reserved and special printing characters */ { PERMCHAR, FALSE }, /* 58 : */ { PERMCHAR, FALSE }, /* 59; */ { OPCHAR, FALSE }, /* 60 < */ { OPCHAR, FALSE }, /* 61 = */ { OPCHAR, FALSE }, /* 62 > */ { SINGLECHAR, FALSE }, /* 63 ? */ { SINGLECHAR, FALSE }, /* 64 @ */ /* Uppercase Alphabetics */ { IDCHAR, FALSE }, /* 65 A */ { IDCHAR, FALSE }, /* 66 B */ { IDCHAR, FALSE }, /* 67 C */ { IDCHAR, FALSE }, /* 68 D */ { IDCHAR, FALSE }, /* 69 E */ { IDCHAR, FALSE }, /* 70 F */ { IDCHAR, FALSE }, /* 71 G */ { IDCHAR, FALSE }, /* 72 H */ { IDCHAR, FALSE }, /* 73 I */ { IDCHAR, FALSE }, /* 74 J */ { IDCHAR, FALSE }, /* 75 K */ { IDCHAR, FALSE }, /* 76 L */ { IDCHAR, FALSE }, /* 77 M */ { IDCHAR, FALSE }, /* 78 N */ { IDCHAR, FALSE }, /* 79 O */ { IDCHAR, FALSE }, /* 80 P */ { IDCHAR, FALSE }, /* 81 Q */ { IDCHAR, FALSE }, /* 82 R */ { IDCHAR, FALSE }, /* 83 S */ { IDCHAR, FALSE }, /* 84 T */ { IDCHAR, FALSE }, /* 85 U */ { IDCHAR, FALSE }, /* 86 V */ { IDCHAR, FALSE }, /* 87 W */ { IDCHAR, FALSE }, /* 88 X */ { IDCHAR, FALSE }, /* 89 Y */ { IDCHAR, FALSE }, /* 90 Z */ /* Still more reserved and special printing characters */ { PERMCHAR, FALSE }, /* 91 [ */ { CHC_EXTENSION, FALSE }, /* 92 slash */ { PERMCHAR, FALSE }, /* 93 ] */ { SINGLECHAR, FALSE }, /* 94 ^ */ { IDCHAR, FALSE }, /* 95 _ */ { SINGLECHAR, FALSE }, /* 96 ` */ /* Lowercase alphabetics */ { IDCHAR, FALSE }, /* 97 a */ { IDCHAR, FALSE }, /* 98 b */ { IDCHAR, FALSE }, /* 99 c */ { IDCHAR, FALSE }, /* 100 d */ { IDCHAR, FALSE }, /* 101 e */ { IDCHAR, FALSE }, /* 102 f */ { IDCHAR, FALSE }, /* 103 g */ { IDCHAR, FALSE }, /* 104 h */ { IDCHAR, FALSE }, /* 105 i */ { IDCHAR, FALSE }, /* 106 j */ { IDCHAR, FALSE }, /* 107 k */ { IDCHAR, FALSE }, /* 108 l */ { IDCHAR, FALSE }, /* 109 m */ { IDCHAR, FALSE }, /* 110 n */ { IDCHAR, FALSE }, /* 111 o */ { IDCHAR, FALSE }, /* 112 p */ { IDCHAR, FALSE }, /* 113 q */ { IDCHAR, FALSE }, /* 114 r */ { IDCHAR, FALSE }, /* 115 s */ { IDCHAR, FALSE }, /* 116 t */ { IDCHAR, FALSE }, /* 117 u */ { IDCHAR, FALSE }, /* 118 v */ { IDCHAR, FALSE }, /* 119 w */ { IDCHAR, FALSE }, /* 120 x */ { IDCHAR, FALSE }, /* 121 y */ { IDCHAR, FALSE }, /* 122 z */ { SINGLECHAR, FALSE }, /* 123 { */ { SINGLECHAR, FALSE }, /* 124 | */ { SINGLECHAR, FALSE }, /* 125 } */ { SINGLECHAR, FALSE }, /* 126 ~ */ { SINGLECHAR, FALSE }, /* 127 DEL */ /* MCS - unused in English */ { SINGLECHAR, FALSE }, /* 128 */ { SINGLECHAR, FALSE }, /* 129 */ { SINGLECHAR, FALSE }, /* 130 */ { SINGLECHAR, FALSE }, /* 131 */ { SINGLECHAR, FALSE }, /* 132 */ { SINGLECHAR, FALSE }, /* 133 */ { SINGLECHAR, FALSE }, /* 134 */ { SINGLECHAR, FALSE }, /* 135 */ { SINGLECHAR, FALSE }, /* 136 */ { SINGLECHAR, FALSE }, /* 137 */ { SINGLECHAR, FALSE }, /* 138 */ { SINGLECHAR, FALSE }, /* 139 */ { SINGLECHAR, FALSE }, /* 140 */ { SINGLECHAR, FALSE }, /* 141 */ { SINGLECHAR, FALSE }, /* 142 */ { SINGLECHAR, FALSE }, /* 143 */ { SINGLECHAR, FALSE }, /* 144 */ { SINGLECHAR, FALSE }, /* 145 */ { SINGLECHAR, FALSE }, /* 146 */ { SINGLECHAR, FALSE }, /* 147 */ { SINGLECHAR, FALSE }, /* 148 */ { SINGLECHAR, FALSE }, /* 149 */ { SINGLECHAR, FALSE }, /* 150 */ { SINGLECHAR, FALSE }, /* 151 */ { SINGLECHAR, FALSE }, /* 152 */ { SINGLECHAR, FALSE }, /* 153 */ { SINGLECHAR, FALSE }, /* 154 */ { SINGLECHAR, FALSE }, /* 155 */ { SINGLECHAR, FALSE }, /* 156 */ { SINGLECHAR, FALSE }, /* 157 */ { SINGLECHAR, FALSE }, /* 158 */ { SINGLECHAR, FALSE }, /* 159 */ { SINGLECHAR, FALSE }, /* 160 */ { SINGLECHAR, FALSE }, /* 161 */ { SINGLECHAR, FALSE }, /* 162 */ { SINGLECHAR, FALSE }, /* 163 */ { SINGLECHAR, FALSE }, /* 164 */ { SINGLECHAR, FALSE }, /* 165 */ { SINGLECHAR, FALSE }, /* 166 */ { SINGLECHAR, FALSE }, /* 167 */ { SINGLECHAR, FALSE }, /* 168 */ { SINGLECHAR, FALSE }, /* 169 */ { SINGLECHAR, FALSE }, /* 170 */ { SINGLECHAR, FALSE }, /* 171 */ { SINGLECHAR, FALSE }, /* 172 */ { SINGLECHAR, FALSE }, /* 173 */ { SINGLECHAR, FALSE }, /* 174 */ { SINGLECHAR, FALSE }, /* 175 */ { SINGLECHAR, FALSE }, /* 176 */ { SINGLECHAR, FALSE }, /* 177 */ { SINGLECHAR, FALSE }, /* 178 */ { SINGLECHAR, FALSE }, /* 179 */ { SINGLECHAR, FALSE }, /* 180 */ { SINGLECHAR, FALSE }, /* 181 */ { SINGLECHAR, FALSE }, /* 182 */ { SINGLECHAR, FALSE }, /* 183 */ { SINGLECHAR, FALSE }, /* 184 */ { SINGLECHAR, FALSE }, /* 185 */ { SINGLECHAR, FALSE }, /* 186 */ { SINGLECHAR, FALSE }, /* 187 */ { SINGLECHAR, FALSE }, /* 188 */ { SINGLECHAR, FALSE }, /* 189 */ { SINGLECHAR, FALSE }, /* 190 */ { SINGLECHAR, FALSE }, /* 191 */ { SINGLECHAR, FALSE }, /* 192 */ { SINGLECHAR, FALSE }, /* 193 */ { SINGLECHAR, FALSE }, /* 194 */ { SINGLECHAR, FALSE }, /* 195 */ { SINGLECHAR, FALSE }, /* 196 */ { SINGLECHAR, FALSE }, /* 197 */ { SINGLECHAR, FALSE }, /* 198 */ { SINGLECHAR, FALSE }, /* 199 */ { SINGLECHAR, FALSE }, /* 200 */ { SINGLECHAR, FALSE }, /* 201 */ { SINGLECHAR, FALSE }, /* 202 */ { SINGLECHAR, FALSE }, /* 203 */ { SINGLECHAR, FALSE }, /* 204 */ { SINGLECHAR, FALSE }, /* 205 */ { SINGLECHAR, FALSE }, /* 206 */ { SINGLECHAR, FALSE }, /* 207 */ { SINGLECHAR, FALSE }, /* 208 */ { SINGLECHAR, FALSE }, /* 209 */ { SINGLECHAR, FALSE }, /* 210 */ { SINGLECHAR, FALSE }, /* 211 */ { SINGLECHAR, FALSE }, /* 212 */ { SINGLECHAR, FALSE }, /* 213 */ { SINGLECHAR, FALSE }, /* 214 */ { SINGLECHAR, FALSE }, /* 215 */ { SINGLECHAR, FALSE }, /* 216 */ { SINGLECHAR, FALSE }, /* 217 */ { SINGLECHAR, FALSE }, /* 218 */ { SINGLECHAR, FALSE }, /* 219 */ { SINGLECHAR, FALSE }, /* 220 */ { SINGLECHAR, FALSE }, /* 221 */ { SINGLECHAR, FALSE }, /* 222 */ { SINGLECHAR, FALSE }, /* 223 */ { SINGLECHAR, FALSE }, /* 224 */ { SINGLECHAR, FALSE }, /* 225 */ { SINGLECHAR, FALSE }, /* 226 */ { SINGLECHAR, FALSE }, /* 227 */ { SINGLECHAR, FALSE }, /* 228 */ { SINGLECHAR, FALSE }, /* 229 */ { SINGLECHAR, FALSE }, /* 230 */ { SINGLECHAR, FALSE }, /* 231 */ { SINGLECHAR, FALSE }, /* 232 */ { SINGLECHAR, FALSE }, /* 233 */ { SINGLECHAR, FALSE }, /* 234 */ { SINGLECHAR, FALSE }, /* 235 */ { SINGLECHAR, FALSE }, /* 236 */ { SINGLECHAR, FALSE }, /* 237 */ { SINGLECHAR, FALSE }, /* 238 */ { SINGLECHAR, FALSE }, /* 239 */ { SINGLECHAR, FALSE }, /* 240 */ { SINGLECHAR, FALSE }, /* 241 */ { SINGLECHAR, FALSE }, /* 242 */ { SINGLECHAR, FALSE }, /* 243 */ { SINGLECHAR, FALSE }, /* 244 */ { SINGLECHAR, FALSE }, /* 245 */ { SINGLECHAR, FALSE }, /* 246 */ { SINGLECHAR, FALSE }, /* 247 */ { SINGLECHAR, FALSE }, /* 248 */ { SINGLECHAR, FALSE }, /* 249 */ { SINGLECHAR, FALSE }, /* 250 */ { SINGLECHAR, FALSE }, /* 251 */ { SINGLECHAR, FALSE }, /* 252 */ { SINGLECHAR, FALSE }, /* 253 */ { SINGLECHAR, FALSE }, /* 254 */ { SINGLECHAR, FALSE } /* 255 */ }; void ScanCComment (void) { inComment = TRUE; for (;;) { switch (currentChar) { case '*': LCLMOVECHAR (); if (currentChar == '/') { LCLMOVECHAR (); inComment = FALSE; return; } /*@switchbreak@*/ break; case '\n': return; default: LCLMOVECHAR (); } } } void ScanEscape (void) { if (isSimpleEscape[(int)currentChar]) { LCLMOVECHAR (); /* discard simple escape character. */ } else if (currentChar == 'x') { LCLMOVECHAR (); /* discard 'x'. */ if (!isXigit[(int)currentChar]) { LocalUserError ("at least one hex digit must follow '\\x'"); } while (isXigit[(int)currentChar]) { LCLMOVECHAR (); /* discard hex digits. */ } } else if (isOigit[(int)currentChar]) { LCLMOVECHAR (); /* discard first hex digit. */ if (isOigit[(int)currentChar]) { LCLMOVECHAR (); /* discard second hex digit. */ } if (isOigit[(int)currentChar]) { LCLMOVECHAR (); /* discard third hex digit. */ } } else { LocalUserError ("invalid escape sequence in a C string or character"); } } void ScanCString (void) { if (currentChar == '\\' && LOOKAHEADCHAR () == 'L') { LCLMOVECHAR (); /* discard slash */ LCLMOVECHAR (); /* discard 'L'. */ } if (currentChar == '\"') { LCLMOVECHAR (); /* discard opening quote. */ while (currentChar != '\"') { if (isStrChar[(int)currentChar]) { LCLMOVECHAR (); /* discard string character. */ } else if (currentChar == '\\') { LCLMOVECHAR (); /* discard slash */ ScanEscape (); } else if (currentChar == '\n') { LocalUserError ("Unterminated C string"); } else { LocalUserError ("Invalid character in C string"); } } LCLMOVECHAR (); /* discard closing quote */ } else { LocalUserError ("C string must start with '\"'"); } *bufPtr = '\0'; /* null terminate in buffer */ tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = LLT_LCSTRING; } void ScanCChar (void) { if (currentChar == '\\' && LOOKAHEADCHAR () == 'L') { LCLMOVECHAR (); /* discard slash */ LCLMOVECHAR (); /* discard 'L'. */ } if (currentChar == '\'') { LCLMOVECHAR (); /* discard opening quote */ while (currentChar != '\'') { if (isCharChar[(int)currentChar]) { LCLMOVECHAR (); /* discard string character. */ } else if (currentChar == '\\') { LCLMOVECHAR (); /* discard slash */ ScanEscape (); } else if (currentChar == '\n') { LocalUserError ("Unterminated C character constant"); } else { LocalUserError ("Invalid character in C character"); } } LCLMOVECHAR (); /* discard closing quote */ } else { LocalUserError ("Invalid C character"); } *bufPtr = '\0'; /* null terminate in buffer */ tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = LLT_CCHAR; } void ScanCNumber (void) { tokenCode = LLT_CINTEGER; switch (currentChar) { case '.': LCLMOVECHAR (); tokenCode = LLT_CFLOAT; if (!isDigit[(int)currentChar]) { LocalUserError ("at least one digit must follow '.'"); } while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } if (currentChar == 'e' || currentChar == 'E') { LCLMOVECHAR (); /* discard 'e' or 'E'. */ if (currentChar == '+' || currentChar == '-') { LCLMOVECHAR (); } if (!isDigit[(int)currentChar]) { LocalUserError ("digit must follow exponent"); } while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } } if (currentChar == 'f' || currentChar == 'l' || currentChar == 'F' || currentChar == 'L') { LCLMOVECHAR (); } break; case '0': LCLMOVECHAR (); /* discard '0'. */ switch (currentChar) { case 'x': case 'X': LCLMOVECHAR (); if (!isXigit[(int)currentChar]) { LocalUserError ("hex digit must follow 'x' or 'X'"); } while (isXigit[(int)currentChar]) { LCLMOVECHAR (); } /*@switchbreak@*/ break; default: /* ** Could either be an octal number or a floating point ** number. Scan decimal digits so don't run into ** problems if turns out problems if it is an fp ** number. Let converter/parser catch bad octal ** numbers. e.g. 018 not caught by scanner. */ while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } switch (currentChar) { case '.': LCLMOVECHAR (); /* discard '.'. */ tokenCode = LLT_CFLOAT; while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } if (currentChar == 'e' || currentChar == 'E') { LCLMOVECHAR (); /* discard 'e' or 'E'. */ if (currentChar == '+' || currentChar == '-') { LCLMOVECHAR (); } if (!isDigit[(int)currentChar]) { LocalUserError ("digit must follow exponent"); } while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } } if (currentChar == 'f' || currentChar == 'l' || currentChar == 'F' || currentChar == 'L') { LCLMOVECHAR (); } /*@switchbreak@*/ break; case 'e': case 'E': LCLMOVECHAR (); tokenCode = LLT_CFLOAT; if (currentChar == '+' || currentChar == '-') { LCLMOVECHAR (); } if (!isDigit[(int)currentChar]) { LocalUserError ("digit must follow exponent"); } while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } if (currentChar == 'f' || currentChar == 'l' || currentChar == 'F' || currentChar == 'L') { LCLMOVECHAR (); } /*@switchbreak@*/ break; default: /* Scan integer suffix. */ switch (currentChar) { case 'u': case 'U': LCLMOVECHAR (); if (currentChar == 'l' || currentChar == 'L') { LCLMOVECHAR (); } /*@switchbreak@*/ break; case 'l': case 'L': LCLMOVECHAR (); if (currentChar == 'u' || currentChar == 'U') { LCLMOVECHAR (); } /*@switchbreak@*/ break; } /*@switchbreak@*/ break; } } /* Scan integer suffix. */ switch (currentChar) { case 'u': case 'U': LCLMOVECHAR (); if (currentChar == 'l' || currentChar == 'L') { LCLMOVECHAR (); } /*@switchbreak@*/ break; case 'l': case 'L': LCLMOVECHAR (); if (currentChar == 'u' || currentChar == 'U') { LCLMOVECHAR (); } /*@switchbreak@*/ break; } break; default: if (isDigit[(int)currentChar]) { while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } switch (currentChar) { case '.': LCLMOVECHAR (); /* discard '.'. */ tokenCode = LLT_CFLOAT; while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } if (currentChar == 'e' || currentChar == 'E') { LCLMOVECHAR (); if (currentChar == '+' || currentChar == '-') { LCLMOVECHAR (); } if (!isDigit[(int)currentChar]) { LocalUserError ("digit must follow exponent"); } while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } } if (currentChar == 'f' || currentChar == 'l' || currentChar == 'F' || currentChar == 'L') { LCLMOVECHAR (); } /*@switchbreak@*/ break; case 'e': case 'E': LCLMOVECHAR (); tokenCode = LLT_CFLOAT; if (currentChar == '+' || currentChar == '-') { LCLMOVECHAR (); } if (!isDigit[(int)currentChar]) { LocalUserError ("digit must follow exponent"); } while (isDigit[(int)currentChar]) { LCLMOVECHAR (); } if (currentChar == 'f' || currentChar == 'l' || currentChar == 'F' || currentChar == 'L') { LCLMOVECHAR (); } /*@switchbreak@*/ break; default: switch (currentChar) { case 'u': case 'U': LCLMOVECHAR (); if (currentChar == 'l' || currentChar == 'L') { LCLMOVECHAR (); } /*@switchbreak@*/ break; case 'l': case 'L': LCLMOVECHAR (); if (currentChar == 'u' || currentChar == 'U') { LCLMOVECHAR (); } /*@switchbreak@*/ break; } /*@switchbreak@*/ break; } } else { LocalUserError ("invalid C number"); } break; } *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); } static void ScanOther (void) { switch (LCLScanCharClass (currentChar)) { case CHC_NULL: tokenSym = lsymbol_fromChars ("E O L"); tokenCode = LLT_EOL; break; /* identifiers */ case IDCHAR: while (LCLScanCharClass (currentChar) == IDCHAR) { /* identifier: find end */ LCLMOVECHAR (); } *bufPtr = '\0'; /* null terminate in buffer */ tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = simpleId; break; /* one-character tokens */ case SINGLECHAR: case PERMCHAR: LCLMOVECHAR (); *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = simpleOp; break; /* operator symbols */ case OPCHAR: if (currentChar == '.' && LOOKAHEADCHAR () == '.' && LOOKAHEADTWICECHAR () == '.') { LCLMOVECHAR (); LCLMOVECHAR (); LCLMOVECHAR (); *bufPtr = '\0'; tokenSym = lsymbol_fromChars ("..."); tokenCode = LLT_TELIPSIS; } else { if (currentChar == '/' && LOOKAHEADCHAR () == '\\') { LCLMOVECHAR (); LCLMOVECHAR (); } else { while (LCLScanCharClass (currentChar) == OPCHAR) { LCLMOVECHAR (); } } *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = simpleOp; } break; /* white space */ case WHITECHAR: /*@-loopswitchbreak@*/ /*@-switchswitchbreak@*/ switch (currentChar) { case '\t': LCLMOVECHAR (); /* tabs only count as one character */ break; case '\v': case '\f': LCLMOVECHAR (); colNumber--; /* does not change column */ break; default: LCLMOVECHAR (); break; } /*@=switchswitchbreak@*/ *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = LLT_WHITESPACE; break; /* symbols */ case CHC_EXTENSION: LCLMOVECHAR (); /*@-switchswitchbreak@*/ switch (currentChar) { /* open and close */ case '(': LCLMOVECHAR (); while (LCLScanCharClass (currentChar) == IDCHAR) { LCLMOVECHAR (); } *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = openSym; break; case ')': LCLMOVECHAR (); while (LCLScanCharClass (currentChar) == IDCHAR) { LCLMOVECHAR (); } *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = closeSym; break; /* separator */ case ',': LCLMOVECHAR (); while (LCLScanCharClass (currentChar) == IDCHAR) { LCLMOVECHAR (); } *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = sepSym; break; /* simpleid */ case ':': LCLMOVECHAR (); while (LCLScanCharClass (currentChar) == IDCHAR) { LCLMOVECHAR (); } *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = simpleId; break; default: if (LCLScanCharClass (currentChar) == IDCHAR) { do { LCLMOVECHAR (); } while (LCLScanCharClass (currentChar) == IDCHAR); *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = simpleOp; } else { /* ** Meets none of the above. Take the extension ** character and the character following and treat ** together as a SINGLECHAR. SINGLECHARs tranlate into ** SIMPLEOPs. */ LCLMOVECHAR (); *bufPtr = '\0'; tokenSym = lsymbol_fromChars (&tokenBuffer[0]); tokenCode = simpleOp; } break; /*@=switchswitchbreak@*/ } break; default: LocalUserError ("unexpected character in input"); return; } /*@=loopswitchbreak@*/ } static bool nextCanBeCharLiteral (ltokenCode c) { switch (c) { /* A ' following these tokens starts a C character literal. */ case logicalOp: case equationSym: case eqSepSym: case openSym: case sepSym: case simpleOp: case LLT_COMMA: case LLT_EQUALS: case LLT_LBRACE: case LLT_LBRACKET: case LLT_LPAR: case eqOp: case LLT_BE: case LLT_ELSE: case LLT_ENSURES: case LLT_IF: case LLT_CONSTRAINT: case LLT_REQUIRES: case LLT_CHECKS: case LLT_BODY: case LLT_THEN: return (TRUE); /* A ' following these tokens means post */ case selectSym: case closeSym: case simpleId: case preSym: case anySym: case postSym: case LLT_QUOTE: case LLT_RBRACE: case LLT_RBRACKET: case LLT_RPAR: case LLT_RESULT: return (FALSE); /* Neither a C character literal nor post should follow these tokens */ case quantifierSym: case mapSym: case markerSym: case LLT_COLON: case LLT_SEMI: case LLT_VERTICALBAR: case LLT_MULOP: case LLT_CCHAR: case LLT_CFLOAT: case LLT_CINTEGER: case LLT_LCSTRING: case LLT_ALL: case LLT_ANYTHING: case LLT_CONSTANT: case LLT_FOR: case LLT_IMMUTABLE: case LLT_OBJ: case LLT_OUT: case LLT_IMPORTS: case LLT_ISSUB: case LLT_LET: case LLT_MODIFIES: case LLT_CLAIMS: case LLT_MUTABLE: case LLT_FRESH: case LLT_NOTHING: case LLT_PRIVATE: case LLT_SPEC: case LLT_SIZEOF: case LLT_TAGGEDUNION: case LLT_TYPE: case LLT_UNCHANGED: case LLT_USES: case LLT_CHAR: case LLT_CONST: case LLT_DOUBLE: case LLT_ENUM: case LLT_FLOAT: case LLT_INT: case LLT_TYPEDEF_NAME: case LLT_LONG: case LLT_SHORT: case LLT_STRUCT: case LLT_SIGNED: case LLT_UNKNOWN: case LLT_UNION: case LLT_UNSIGNED: case LLT_VOID: case LLT_VOLATILE: return (FALSE); /* These tokens should have been ignored */ case NOTTOKEN: case commentSym: case LLT_WHITESPACE: case LLT_EOL: case LEOFTOKEN: llcontbuglit ("scanline: nextCanBeChar"); return FALSE; BADDEFAULT; } BADEXIT; } void LCLScanLine (char *line) { ltoken newToken; lsymbol CCommentSym = lsymbol_fromChars ("/*"); size_t linelength = strlen (line); static bool inSpecComment = FALSE; line[(int)linelength] = '\n'; currentLine = line; currentChar = *currentLine++; context_processedSpecLine (); incLine (); colNumber = 1; if (inComment) { ScanCComment (); if (reportComments) { *bufPtr = '\0'; newToken = ltoken_createRaw (simpleId, lsymbol_fromChars (&tokenBuffer[0])); LCLScanFreshToken (newToken); } } if (inSpecComment) { if (currentChar == '*' && LOOKAHEADCHAR () == '/') { LCLMOVECHAR (); LCLMOVECHAR (); inSpecComment = FALSE; } } /*@+loopexec@*/ for (;;) { if (inSpecComment && currentChar == '*' && LOOKAHEADCHAR () == '/') { LCLMOVECHAR (); LCLMOVECHAR (); inSpecComment = FALSE; } bufPtr = &tokenBuffer[0]; startCol = colNumber; /*@-loopswitchbreak@*/ switch (startClass[(int)currentChar]) { case STARTCNUM: ScanCNumber (); break; case STARTCNUMDOT: if (isDigit[(int) LOOKAHEADCHAR ()]) { ScanCNumber (); } else { ScanOther (); } break; case STARTCSTR: ScanCString (); break; case STARTCCHAR: if (nextCanBeCharLiteral (prevTokenCode)) { ScanCChar (); } else { ScanOther (); } break; case STARTWIDE: if (LOOKAHEADCHAR () == 'L' && LOOKAHEADTWICECHAR () == '\"') { ScanCString (); } else if (LOOKAHEADCHAR () == 'L' && LOOKAHEADTWICECHAR () == '\'') { ScanCChar (); } else { ScanOther (); } break; case STARTSLASH: if (LOOKAHEADCHAR () == '*') { LCLMOVECHAR (); LCLMOVECHAR (); if (currentChar == '@') { char *s = mstring_createEmpty (); LCLMOVECHAR (); while (currentChar != '\0' && currentChar != ' ' && currentChar != '*' && currentChar != '\t' && currentChar != '\n') { s = mstring_append (s, currentChar); LCLMOVECHAR (); } if (mstring_equal (s, "alt")) { tokenCode = LLT_VERTICALBAR; tokenSym = lsymbol_fromChars ("|"); inSpecComment = TRUE; } else { ScanCComment (); tokenCode = commentSym; tokenSym = CCommentSym; } sfree (s); break; } else { ScanCComment (); tokenCode = commentSym; tokenSym = CCommentSym; break; } } else { ScanOther (); } break; case STARTOTHER: ScanOther (); break; default: llcontbuglit ("LCLScanLine: bad case"); break; } /*@=loopswitchbreak@*/ /* ** Above code only "guessed" at token type. Insert it into the ** TokenTable. If the token already exists, it is returned as ** previously defined. If it does not exist, it is inserted as the ** token code computed above. */ newToken = LCLInsertToken (tokenCode, tokenSym, lsymbol_undefined, FALSE); if (LCLIsSyn (ltoken_getText (newToken))) { /* ** Token is a synonym. Get the actual token and set the raw ** text to the synonym name. */ newToken = ltoken_copy (LCLGetTokenForSyn (ltoken_getText (newToken))); ltoken_setRawText (newToken, tokenSym); } else { newToken = ltoken_copy (newToken); } ltoken_setCol (newToken, startCol); ltoken_setLine (newToken, inputStream_thisLineNumber (LCLScanSource ())); ltoken_setFileName (newToken, inputStream_fileName (LCLScanSource ())); if (ltoken_getCode (newToken) == commentSym) { if (tokenSym == CCommentSym) { /* C-style comment */ ltoken_free (commentTok); commentTok = ltoken_copy (newToken); if (!inComment && reportComments) { *bufPtr = '\0'; ltoken_setRawText (newToken, lsymbol_fromChars (&tokenBuffer[0])); LCLScanFreshToken (newToken); } else { ltoken_free (newToken); } } else { /* LSL-style comment */ bufPtr = &tokenBuffer[0]; while (!LCLIsEndComment (currentChar)) { LCLMOVECHAR (); } if (LCLScanCharClass (currentChar) != CHC_NULL) { /* Not EOL character. Toss it out. */ LCLMOVECHAR (); } if (reportComments) { *bufPtr = '\0'; ltoken_setRawText (newToken, lsymbol_fromChars (&tokenBuffer[0])); LCLScanFreshToken (newToken); } else { ltoken_free (newToken); } } } else if (ltoken_getCode (newToken) == LLT_EOL) { if (reportEOL) { LCLScanFreshToken (newToken); } else { ltoken_free (newToken); } line[(int) linelength] = '\0'; return; } else if (ltoken_getCode (newToken) != LLT_WHITESPACE) { prevTokenCode = ltoken_getCode (newToken); LCLScanFreshToken (newToken); } else { ltoken_free (newToken); } } /*@=loopexec@*/ } /*@exposed@*/ ltoken LCLScanEofToken (void) { ltoken t = LCLInsertToken (LEOFTOKEN, lsymbol_fromChars ("E O F"), 0, TRUE); if (inComment) { lclerror (commentTok, cstring_makeLiteral ("Unterminated comment")); } ltoken_setCol (t, colNumber); ltoken_setLine (t, inputStream_thisLineNumber (LCLScanSource ())); ltoken_setFileName (t, inputStream_fileName (LCLScanSource ())); return t; } void LCLReportEolTokens (bool setting) { reportEOL = setting; } static void LocalUserError (char *msg) { inputStream s = LCLScanSource (); llfatalerror (message ("%s:%d,%d: %s", inputStream_fileName (s), inputStream_thisLineNumber (s), colNumber, cstring_fromChars (msg))); } void LCLScanLineInit (void) { int i; setCodePoint (); reportEOL = FALSE; reportComments = FALSE; for (i = 0; i <= LASTCHAR; i++) { LCLcharClass[i] = charClassDef[i]; } setCodePoint (); /* ** Make sure first postion is never used because use the 0th index to ** mean empty. */ firstReserved = lsymbol_fromChars (FIRSTRESERVEDNAME); setCodePoint (); /* Predefined LSL Tokens */ ltoken_forall = LCLReserveToken (quantifierSym, "\\forall"); setCodePoint (); ltoken_exists = LCLReserveToken (quantifierSym, "\\exists"); ltoken_implies = LCLReserveToken (logicalOp, "\\implies"); ltoken_eqsep = LCLReserveToken (eqSepSym, "\\eqsep"); ltoken_select = LCLReserveToken (selectSym, "\\select"); ltoken_open = LCLReserveToken (openSym, "\\open"); ltoken_sep = LCLReserveToken (sepSym, "\\,"); ltoken_close = LCLReserveToken (closeSym, "\\close"); ltoken_id = LCLReserveToken (simpleId, "\\:"); ltoken_arrow = LCLReserveToken (mapSym, "\\arrow"); ltoken_marker = LCLReserveToken (markerSym, "\\marker"); ltoken_pre = LCLReserveToken (preSym, "\\pre"); ltoken_post = LCLReserveToken (postSym, "\\post"); ltoken_comment = LCLReserveToken (commentSym, "\\comment"); ltoken_any = LCLReserveToken (anySym, "\\any"); ltoken_result = LCLReserveToken (LLT_RESULT, "result"); ltoken_typename = LCLReserveToken (LLT_TYPEDEF_NAME, "TYPEDEF_NAME"); ltoken_setIdType (ltoken_typename, SID_TYPE); /* ** Not context_getBoolName () --- "bool" is built in to LCL. ** This is bogus, but necessary for a lot of old lcl files. */ ltoken_bool = LCLReserveToken (LLT_TYPEDEF_NAME, "bool"); ltoken_lbracked = LCLReserveToken (LLT_LBRACKET, "["); ltoken_rbracket = LCLReserveToken (LLT_RBRACKET, "]"); (void) LCLReserveToken (LLT_COLON, ":"); (void) LCLReserveToken (LLT_COMMA, ","); (void) LCLReserveToken (LLT_EQUALS, "="); (void) LCLReserveToken (LLT_LBRACE, "{"); (void) LCLReserveToken (LLT_LPAR, "("); (void) LCLReserveToken (LLT_RBRACE, "}"); (void) LCLReserveToken (LLT_RPAR, ")"); (void) LCLReserveToken (LLT_SEMI, ";"); (void) LCLReserveToken (LLT_VERTICALBAR, "|"); (void) LCLReserveToken (LLT_MULOP, "*"); (void) LCLReserveToken (LLT_WHITESPACE, " "); (void) LCLReserveToken (LLT_WHITESPACE, "\t"); (void) LCLReserveToken (LLT_WHITESPACE, "\f"); (void) LCLReserveToken (LLT_WHITESPACE, "\n"); (void) LCLReserveToken (LEOFTOKEN, "E O F"); (void) LCLReserveToken (LLT_EOL, "E O L"); /* LSL Keywords */ ltoken_and = LCLReserveToken (logicalOp, "\\and"); ltoken_or = LCLReserveToken (logicalOp, "\\or"); ltoken_equals = LCLReserveToken (equationSym, "\\equals"); ltoken_eq = LCLReserveToken (eqOp, "\\eq"); ltoken_neq = LCLReserveToken (eqOp, "\\neq"); ltoken_not = LCLReserveToken (simpleOp, "\\not"); ltoken_true = LCLReserveToken (simpleId, "true"); ltoken_false = LCLReserveToken (simpleId, "false"); /* LCL Keywords */ (void) LCLReserveToken (LLT_ALL, "all"); (void) LCLReserveToken (LLT_ANYTHING, "anything"); (void) LCLReserveToken (LLT_BE, "be"); (void) LCLReserveToken (LLT_CONSTANT, "constant"); (void) LCLReserveToken (LLT_CHECKS, "checks"); (void) LCLReserveToken (LLT_ELSE, "else"); (void) LCLReserveToken (LLT_ENSURES, "ensures"); (void) LCLReserveToken (LLT_FOR, "for"); (void) LCLReserveToken (LLT_IF, "if"); (void) LCLReserveToken (LLT_IMMUTABLE, "immutable"); (void) LCLReserveToken (LLT_OBJ, "obj"); (void) LCLReserveToken (LLT_OUT, "out"); (void) LCLReserveToken (LLT_ITER, "iter"); (void) LCLReserveToken (LLT_YIELD, "yield"); (void) LCLReserveToken (LLT_PARTIAL, "partial"); (void) LCLReserveToken (LLT_ONLY, "only"); (void) LCLReserveToken (LLT_UNDEF, "undef"); (void) LCLReserveToken (LLT_KILLED, "killed"); (void) LCLReserveToken (LLT_OWNED, "owned"); (void) LCLReserveToken (LLT_DEPENDENT, "dependent"); (void) LCLReserveToken (LLT_PARTIAL, "partial"); (void) LCLReserveToken (LLT_RELDEF, "reldef"); (void) LCLReserveToken (LLT_KEEP, "keep"); (void) LCLReserveToken (LLT_KEPT, "kept"); (void) LCLReserveToken (LLT_TEMP, "temp"); (void) LCLReserveToken (LLT_SHARED, "shared"); (void) LCLReserveToken (LLT_RELNULL, "relnull"); (void) LCLReserveToken (LLT_RELDEF, "reldef"); (void) LCLReserveToken (LLT_CHECKED, "checked"); (void) LCLReserveToken (LLT_UNCHECKED, "unchecked"); (void) LCLReserveToken (LLT_CHECKEDSTRICT, "checkedstrict"); (void) LCLReserveToken (LLT_CHECKMOD, "checkmod"); (void) LCLReserveToken (LLT_TRUENULL, "truenull"); (void) LCLReserveToken (LLT_FALSENULL, "falsenull"); (void) LCLReserveToken (LLT_LNULL, "null"); (void) LCLReserveToken (LLT_LNOTNULL, "notnull"); (void) LCLReserveToken (LLT_RETURNED, "returned"); (void) LCLReserveToken (LLT_OBSERVER, "observer"); (void) LCLReserveToken (LLT_EXPOSED, "exposed"); (void) LCLReserveToken (LLT_REFCOUNTED, "refcounted"); (void) LCLReserveToken (LLT_REFS, "refs"); (void) LCLReserveToken (LLT_NEWREF, "newref"); (void) LCLReserveToken (LLT_TEMPREF, "tempref"); (void) LCLReserveToken (LLT_KILLREF, "killref"); (void) LCLReserveToken (LLT_NULLTERMINATED, "nullterminated"); (void) LCLReserveToken (LLT_EXITS, "exits"); (void) LCLReserveToken (LLT_MAYEXIT, "mayexit"); (void) LCLReserveToken (LLT_TRUEEXIT, "trueexit"); (void) LCLReserveToken (LLT_FALSEEXIT, "falseexit"); (void) LCLReserveToken (LLT_NEVEREXIT, "neverexit"); (void) LCLReserveToken (LLT_SEF, "sef"); (void) LCLReserveToken (LLT_UNUSED, "unused"); (void) LCLReserveToken (LLT_UNIQUE, "unique"); (void) LCLReserveToken (LLT_IMPORTS, "imports"); (void) LCLReserveToken (LLT_CONSTRAINT, "constraint"); (void) LCLReserveToken (LLT_LET, "let"); (void) LCLReserveToken (LLT_MODIFIES, "modifies"); (void) LCLReserveToken (LLT_CLAIMS, "claims"); (void) LCLReserveToken (LLT_BODY, "body"); (void) LCLReserveToken (LLT_MUTABLE, "mutable"); (void) LCLReserveToken (LLT_FRESH, "fresh"); (void) LCLReserveToken (LLT_NOTHING, "nothing"); (void) LCLReserveToken (LLT_INTERNAL, "internalState"); (void) LCLReserveToken (LLT_FILESYS, "fileSystem"); (void) LCLReserveToken (LLT_PRIVATE, "private"); (void) LCLReserveToken (LLT_SPEC, "spec"); (void) LCLReserveToken (LLT_REQUIRES, "requires"); (void) LCLReserveToken (LLT_SIZEOF, "sizeof"); (void) LCLReserveToken (LLT_TAGGEDUNION, "taggedunion"); (void) LCLReserveToken (LLT_THEN, "then"); (void) LCLReserveToken (LLT_TYPE, "type"); (void) LCLReserveToken (LLT_TYPEDEF, "typedef"); (void) LCLReserveToken (LLT_UNCHANGED, "unchanged"); (void) LCLReserveToken (LLT_USES, "uses"); (void) LCLReserveToken (LLT_PRINTFLIKE, "printflike"); (void) LCLReserveToken (LLT_SCANFLIKE, "scanflike"); (void) LCLReserveToken (LLT_MESSAGELIKE, "messagelike"); /* LCL C Keywords */ (void) LCLReserveToken (LLT_CHAR, "char"); (void) LCLReserveToken (LLT_CONST, "const"); (void) LCLReserveToken (LLT_DOUBLE, "double"); (void) LCLReserveToken (LLT_ENUM, "enum"); /* comment out so we can add in lclinit.lci: synonym double float */ /* LCLReserveToken (LLT_FLOAT, "float"); */ /* But we need to make the scanner parse "float" not as a simpleId, but as a TYPEDEF_NAME. This is done later in abstract_init */ (void) LCLReserveToken (LLT_INT, "int"); (void) LCLReserveToken (LLT_LONG, "long"); (void) LCLReserveToken (LLT_SHORT, "short"); (void) LCLReserveToken (LLT_STRUCT, "struct"); (void) LCLReserveToken (LLT_SIGNED, "signed"); (void) LCLReserveToken (LLT_UNION, "union"); (void) LCLReserveToken (LLT_UNKNOWN, "__unknown"); (void) LCLReserveToken (LLT_UNSIGNED, "unsigned"); (void) LCLReserveToken (LLT_VOID, "void"); (void) LCLReserveToken (LLT_VOLATILE, "volatile"); setCodePoint (); } void LCLScanLineReset (void) { inComment = FALSE; prevTokenCode = LLT_LPAR; /* Presume first ' starts literal */ } void LCLScanLineCleanup (void) { } bool LCLIsEndComment (char c) { return LCLcharClass[(int)(c)].endCommentChar; } charCode LCLScanCharClass (char c) { return LCLcharClass[(int)(c)].code; } void LCLSetCharClass (char c, charCode cod) { LCLcharClass[(int)(c)].code = (cod); } void LCLSetEndCommentChar (char c, bool flag) { LCLcharClass[(int)(c)].endCommentChar = flag; } splint-3.1.2.dfsg1/src/lclsyntable.c0000644021234200000250000001015607630461221014716 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** syntable.c ** ** Larch/C Interface language synonym table ** ** This table stores synonyms for the Larch/C Interface Language. It is ** essentially an array of token-handles indexed by string-handles. ** Therefore, synonyms (strings) can be converted to the actual token. ** ** AUTHORS: ** J.P. Wild ** ** ** CREATION DATE: 90.08.10 */ # include "splintMacros.nf" # include "basic.h" # include "lcltokentable.h" # include "lclsyntable.h" static long unsigned MaxSyn; /* size of SynTable[] */ static /*@only@*/ /*@reldef@*/ /*@null@*/ lsymbol *SynTable; static void AllocSynTable (void) /*@globals SynTable, MaxSyn@*/ /*@modifies *SynTable, MaxSyn@*/; void LCLAddSyn (lsymbol ntok, lsymbol otok) { while (otok >= MaxSyn) { /* No more space available. Allocate more. */ AllocSynTable (); } llassert (SynTable != NULL); if (SynTable[ntok] == 0) { /* Entry is empty. Fill it in. */ SynTable[ntok] = otok; /* Mark oldToken as having a synonym. */ LCLSetTokenHasSyn (otok, TRUE); } else { llbuglit ("LCLAddSyn: invalid argument"); } } /*@exposed@*/ ltoken LCLGetTokenForSyn (lsymbol ntok) { llassert (SynTable != NULL); if (!((ntok < MaxSyn) || (SynTable[ntok] != 0))) llbuglit ("LCLGetSyn: bad argument"); return LCLGetToken (SynTable[ntok]); } bool LCLIsSyn (lsymbol str) { if (MaxSyn == 0) { return FALSE; } else { llassert (SynTable != NULL); if (str < MaxSyn) { /* Check for synonym entry in table. */ return (SynTable[str] != 0); } else { /* No token for synonym. Return FALSE. */ return FALSE; } } } static void AllocSynTable (void) /*@globals SynTable; @*/ { long unsigned newSize, oldSize; long unsigned int i; oldSize = MaxSyn; if (oldSize == 0) { /* First time SynTable allocated. Set initial size. */ newSize = INITSYNTABLE; SynTable = (lsymbol *) dmalloc (size_fromLongUnsigned (newSize * sizeof (*SynTable))); } else { lsymbol *oldSynTable = SynTable; llassert (oldSynTable != NULL); /* Synonym table already allocated. Calulate extension size. */ newSize = (unsigned long) (DELTASYNTABLE * oldSize); SynTable = (lsymbol *) dmalloc (size_fromLongUnsigned (newSize * sizeof (*SynTable))); for (i = 0; i < oldSize; i++) { SynTable[i] = oldSynTable[i]; } sfree (oldSynTable); } /* Zero out new allocated space. Need to detect when cells are empty */ /* and do this by checking that SynTable[x] == 0. */ /* ### Should the "for" loop be replaced with the following? */ /* #if VMS */ /* # include ; */ /* #else */ /* # include ; */ /* */ /* memset (SynTable[oldSize], 0, */ /* (newSize - oldSize) * sizeof (*SynTable)); */ for (i = oldSize; i < newSize; i++) { SynTable[i] = 0; } MaxSyn = newSize; } void LCLSynTableInit (void) { MaxSyn = 0; } void LCLSynTableReset (void) { } void LCLSynTableCleanup (void) { sfree (SynTable); SynTable = NULL; } splint-3.1.2.dfsg1/src/lcltokentable.c0000644021234200000250000001202507646432515015235 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** tokentable.c ** ** Larch processors token table ** This table stores predefined tokens for LCL. */ # include "splintMacros.nf" # include "basic.h" # include "lcltokentable.h" static long unsigned MaxToken; static /*@only@*/ /*@null@*/ o_ltoken *LCLTokenTable = NULL; static void AllocTokenTable (void) /*@globals LCLTokenTable@*/ /*@modifies LCLTokenTable, MaxToken@*/; ltoken LCLInsertToken (ltokenCode cod, lsymbol sym, lsymbol rTxt, bool isPredefined) { /* ** If the token is already in the token table, it is returned. Otherwise, ** the token is inserted into the table and then returned. ** ** A new TokenTable is allocated when: ** . The TokenTable[] is empty (initial case) ** . The location where to insert the token is not in TokenTable[] */ setCodePoint (); while (sym >= MaxToken) { setCodePoint (); /* No more space available. Allocate more. */ AllocTokenTable (); } llassert (LCLTokenTable != NULL); if (ltoken_isUndefined (LCLTokenTable[sym])) { LCLTokenTable[sym] = ltoken_create (cod, sym); ltoken_setRawText (LCLTokenTable[sym], rTxt); ltoken_setDefined (LCLTokenTable[sym], isPredefined); return LCLTokenTable[sym]; } return LCLTokenTable[sym]; } void LCLUpdateToken (ltokenCode cod, lsymbol sym, bool def) { llassert (LCLTokenTable != NULL); if (!ltoken_isUndefined (LCLTokenTable[sym])) { ltoken_setCode (LCLTokenTable[sym], cod); ltoken_setDefined (LCLTokenTable[sym], def); } else { llfatalbug (message ("LCLUpdateToken: %s", cstring_fromChars (lsymbol_toChars (sym)))); } } void LCLSetTokenHasSyn (lsymbol sym, bool syn) { llassert (LCLTokenTable != NULL); if (!ltoken_isUndefined (LCLTokenTable[sym])) { ltoken_setHasSyn (LCLTokenTable[sym], syn); } else { llfatalbug (message ("LCLSetTokenHasSyn: null token (%d)", (int)sym)); } } ltoken LCLGetToken (lsymbol sym) { llassert (LCLTokenTable != NULL); llassert (sym < MaxToken); return LCLTokenTable[sym]; } #if 0 bool LCLTokenTableContainsToken (ltoken tok) { unsigned long i; if (LCLTokenTable != NULL) { for (i = 0; i < MaxToken; i++) { if (LCLTokenTable[i] == tok) { return TRUE; } } } return FALSE; } # endif /*@exposed@*/ ltoken LCLReserveToken (ltokenCode cod, char *txt) { /* ** The same context that was active when the string-handle ** was derived by a previous call to lsymbol_fromChars (), ** must be established. */ lsymbol sym; setCodePoint (); sym = lsymbol_fromChars (txt); /* ** Reserved tokens never have raw text like synonyms. */ return (LCLInsertToken (cod, sym, lsymbol_undefined, TRUE)); } static void AllocTokenTable (void) /*@globals LCLTokenTable; @*/ { long unsigned oldSize, newSize; long unsigned int i; oldSize = MaxToken; if (oldSize == 0) { newSize = INITTOKENTABLE; llassert (LCLTokenTable == NULL); LCLTokenTable = (ltoken *) dmalloc (size_fromLongUnsigned (newSize * sizeof (*LCLTokenTable))); } else { o_ltoken *oldLCLTokenTable = LCLTokenTable; llassert (oldLCLTokenTable != NULL); newSize = (long unsigned) (DELTATOKENTABLE * oldSize); LCLTokenTable = (ltoken *) dmalloc (size_fromLongUnsigned (newSize * sizeof (*LCLTokenTable))); for (i = 0; i < oldSize; i++) { LCLTokenTable[i] = oldLCLTokenTable[i]; } sfree (oldLCLTokenTable); } MaxToken = newSize; /*@+loopexec@*/ for (i = oldSize; i < newSize; i++) { LCLTokenTable[i] = ltoken_undefined; } /*@=loopexec@*/ /*@-compdef@*/ } /*=compdef@*/ void LCLTokenTableInit (void) { MaxToken = 0; } void LCLTokenTableCleanup (void) { if (LCLTokenTable != NULL) { long unsigned i; for (i = 0; i < MaxToken; i++) { ltoken tok = LCLTokenTable[i]; LCLTokenTable[i] = NULL; /*@-dependenttrans@*/ ltoken_free (tok); /*@=dependenttrans@*/ } sfree (LCLTokenTable); LCLTokenTable = NULL; } } splint-3.1.2.dfsg1/src/sort.c0000644021234200000250000023423307646432516013411 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sort.c ** ** sort abstraction ** ** NOTE: The structure of this module follows a similar one ** used in the previous LCL checker. However, all other ** details are quite different. ** ** AUTHOR: ** Yang Meng Tan, ** Massachusetts Institute of Technology */ # include "splintMacros.nf" # include "basic.h" # include "llgrammar.h" # include "lclscan.h" /*@+ignorequals@*/ static lsymbol newStructTag (void) /*@*/ ; static lsymbol newEnumTag (void) /*@*/ ; static lsymbol newUnionTag (void) /*@*/ ; /*@constant static int MAXBUFFLEN; @*/ # define MAXBUFFLEN 1024 /*@constant static int DELTA; @*/ # define DELTA 100 /*@constant static int NOSORTHANDLE; @*/ # define NOSORTHANDLE 0 /*@constant static int HOFSORTHANDLE; @*/ # define HOFSORTHANDLE 1 /* local routines */ static void sort_addTupleMembers (sort p_tupleSort, sort p_strSort) /*@modifies internalState@*/ ; static bool sort_isNewEntry (sortNode p_s) /*@*/ ; static sort sort_enterNew (/*@only@*/ sortNode p_s) /*@modifies internalState@*/ ; static sort sort_enterGlobal (/*@only@*/ sortNode p_s) /*@modifies internalState@*/ ; static sort sort_enterNewForce (/*@only@*/ sortNode p_s) /*@modifies internalState@*/ ; static void genPtrOps (sort p_baseSort, sort p_ptrSort, sort p_arraySort); static void genArrOps (sort p_baseSort, sort p_arraySort, int p_dim, sort p_vecSort); static void genVecOps (sort p_baseSort, sort p_vecSort, int p_dim); static void genTupleOps (sort p_tupleSort); static void genUnionOps (sort p_tupleSort); static void genStrOps (sort p_strSort, sort p_tupleSort); static void genEnumOps (sort p_enumSort); static void overloadPtrFcns (sort p_ptrSort); static void overloadIsSub (sort p_s, int p_dim); static void overloadSizeof (sort p_domainSort); /*@observer@*/ static cstring sort_unparseKind (sortKind p_k) /*@*/ ; static /*@observer@*/ cstring sort_unparseKindName (sortNode p_s) /*@*/ ; static lsymbol sortTag_toSymbol (char *p_kind, ltoken p_tagid, /*@out@*/ bool *p_isNew); static void overloadUnaryTok (/*@only@*/ nameNode p_nn, sort p_domainSort, /*@only@*/ ltoken p_range); static void overloadUnary (/*@only@*/ nameNode p_nn, sort p_domainSort, sort p_rangeSort); static void overloadBinary (/*@only@*/ nameNode p_nn, sort p_s, /*@only@*/ ltoken p_dTok, sort p_rs); static /*@only@*/ nameNode makeFieldOp (lsymbol p_field); static /*@only@*/ nameNode makeArrowFieldOp (lsymbol p_field); # undef sp static lsymbol sp (lsymbol p_s1, lsymbol p_s2); static void sortError (ltoken p_t, sort p_oldsort, sortNode p_newnode); sort g_sortBool; sort g_sortCapBool; sort g_sortInt; sort g_sortChar; sort g_sortFloat; sort g_sortDouble; sort g_sortCstring; static sort sort_void; static sort char_obj_ptrSort; static sort char_obj_ArrSort; /* This is used to uniqueize sort names, for anonymous C types */ static int sortUID = 1; typedef /*@only@*/ sortNode o_sortNode; static /*@only@*/ /*@null@*/ o_sortNode *sortTable = (sortNode *) 0; static int sortTableSize = 0; static int sortTableAlloc = 0; /* Important to keep sorts in some order because importing routines for sorts rely on this order to ensure that when we encounter a sort S1 that is based on sort S2, S2 is before S1 in the imported file. */ static bool exporting = TRUE; static lsymbol underscoreSymbol; static /*@only@*/ ltoken intToken; static /*@owned@*/ nameNode arrayRefNameNode; static /*@owned@*/ nameNode ptr2arrayNameNode; static /*@owned@*/ nameNode deRefNameNode; static /*@owned@*/ nameNode nilNameNode; static /*@owned@*/ nameNode plusNameNode; static /*@owned@*/ nameNode minusNameNode; static /*@owned@*/ nameNode condNameNode; static /*@owned@*/ nameNode eqNameNode; static /*@owned@*/ nameNode neqNameNode; static ob_mstring sortKindName[] = { "FIRSTSORT", "NOSORT", "HOFSORT", "PRIMITIVE", "SYNONYM", "POINTER", "OBJ", "ARRAY", "VECTOR", "STRUCT", "TUPLE", "UNION", "UNIONVAL", "ENUM", "LASTSORT" } ; static void smemberInfo_free (/*@null@*/ /*@only@*/ smemberInfo *mem) { sfree (mem); } static void sortNode_free (/*@only@*/ sortNode sn) { smemberInfo_free (sn->members); sfree (sn); } void sort_destroyMod (void) /*@globals killed sortTable, killed arrayRefNameNode, killed ptr2arrayNameNode,killed deRefNameNode, killed nilNameNode, killed plusNameNode, killed minusNameNode, killed condNameNode, killed eqNameNode, killed neqNameNode @*/ { if (sortTable != NULL) { int i; nameNode_free (arrayRefNameNode); nameNode_free (ptr2arrayNameNode); nameNode_free (deRefNameNode); nameNode_free (nilNameNode); nameNode_free (plusNameNode); nameNode_free (minusNameNode); nameNode_free (condNameNode); nameNode_free (eqNameNode); nameNode_free (neqNameNode); for (i = 0; i < sortTableSize; i++) { sortNode_free (sortTable[i]); } sfree (sortTable); /*@-branchstate@*/ } } /*@=branchstate@*/ sort sort_makeNoSort (void) { return NOSORTHANDLE; } sort sort_makeHOFSort (sort base) { sortNode outSort; sort handle; outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_HOF; outSort->name = cstring_toSymbol (message ("_HOF_sort_%d", sortTableSize)); outSort->tag = lsymbol_undefined; outSort->baseSort = base; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->imported = context_inImport (); outSort->mutable = FALSE; outSort->abstract = FALSE; llassert (sortTable != NULL); outSort->handle = handle = sortTableSize; sortTable[handle] = outSort; sortTableSize++; return handle; } static sort sort_construct (lsymbol name, sortKind kind, sort baseSort, lsymbol tagName, bool mut, sort objSort, /*@null@*/ /*@only@*/ smemberInfo *members) { sortNode outSort; sort handle; handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = kind; outSort->name = name; outSort->tag = tagName; outSort->realtag = TRUE; outSort->baseSort = baseSort; outSort->objSort = objSort; outSort->members = members; outSort->mutable = mut; outSort->export = exporting; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { outSort->handle = handle = sort_enterNew (outSort); return handle; } else { llassert (sortTable != NULL); if (sortTable[handle]->kind != kind) { sortError (ltoken_undefined, handle, outSort); sortNode_free (outSort); return handle; } else { /* evs --- added 11 Mar 1994 ** the new entry should supercede the old one, since ** it could be a forward reference to a struct, etc. */ sortTable[handle] = outSort; return handle; } } } static sort sort_constructAbstract (lsymbol name, bool mut, sort baseSort) { sortNode outSort; sortKind kind; sort handle; if (mut) kind = SRT_OBJ; else kind = SRT_PRIM; handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = kind; outSort->name = name; outSort->tag = lsymbol_undefined; outSort->baseSort = baseSort; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->mutable = mut; outSort->export = exporting; outSort->imported = context_inImport (); outSort->abstract = TRUE; outSort->handle = handle; if (handle == NOSORTHANDLE) { outSort->handle = handle = sort_enterNew (outSort); /* do not make sort operators. */ } else { llassert (sortTable != NULL); if (sortTable[handle]->kind != kind) { sortError (ltoken_undefined, handle, outSort); } sortNode_free (outSort); } return handle; } sort sort_makeSort (/*@unused@*/ ltoken t, lsymbol n) { /* ** Expects n to be a new sort. ** Generate a sort with the given name. Useful for LSL sorts. */ sort handle = sort_lookupName (n); if (handle == NOSORTHANDLE) { sortNode outSort; outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->handle = handle; outSort->kind = SRT_PRIM; outSort->name = n; outSort->tag = lsymbol_undefined; outSort->baseSort = NOSORTHANDLE; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->mutable = FALSE; outSort->imported = context_inImport (); outSort->abstract = FALSE; /* Put into sort table, sort_enter checks for duplicates. */ handle = sort_enterNew (outSort); } else { /* don't override old info */ ; } return handle; } static sort sort_makeSortNoOps (/*@unused@*/ ltoken t, lsymbol n) /*@modifies internalState@*/ { sort handle; handle = sort_lookupName (n); if (handle == NOSORTHANDLE) { sortNode outSort; outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->handle = handle; outSort->kind = SRT_PRIM; outSort->name = n; outSort->tag = lsymbol_undefined; outSort->baseSort = NOSORTHANDLE; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->mutable = FALSE; outSort->imported = context_inImport (); outSort->abstract = FALSE; /* Put into sort table, sort_enter checks for duplicates. */ handle = sort_enterNew (outSort); } /* Don't override old info */ return handle; } static sort sort_makeLiteralSort (ltoken t, lsymbol n) /*@modifies internalState@*/ { /* ** Like sort_makeSort, in addition, generate sizeof operator ** t not currently used, may be useful for generating error msgs later ** Also useful for abstract types, need sizeof operator. */ sort handle = sort_makeSort (t, n); overloadSizeof (handle); return handle; } sort sort_makeSyn (ltoken t, sort s, lsymbol n) { /* make a synonym sort with name n that is == to sort s */ /* expect n to be a new sort name */ sortNode outSort; sort handle; /* must not clash with any LSL sorts */ lsymbol newname = sp (underscoreSymbol, n); if (n == lsymbol_undefined) { llbuglit ("sort_makeSyn: synonym must have name"); } handle = sort_lookupName (newname); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_SYN; outSort->name = newname; outSort->baseSort = s; outSort->objSort = NOSORTHANDLE; /* info is not duplicated */ outSort->tag = lsymbol_undefined; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->mutable = FALSE; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { outSort->handle = handle = sort_enterNew (outSort); /* No operators to generate for synonyms */ } else { llassert (sortTable != NULL); if (sortTable[handle]->kind != SRT_SYN) { sortError (t, handle, outSort); } sortNode_free (outSort); } return handle; } sort sort_makeFormal (sort insort) { sortNode s; sort sor, handle; sor = sort_getUnderlying (insort); handle = sor; s = sort_lookup (sor); switch (s->kind) { case SRT_STRUCT: handle = sort_makeTuple (ltoken_undefined, sor); break; case SRT_UNION: handle = sort_makeUnionVal (ltoken_undefined, sor); break; default: break; } return handle; } sort sort_makeGlobal (sort insort) { /* Make a Obj if not an array or a struct */ sortNode s; sort sor, handle; sor = sort_getUnderlying (insort); handle = sor; s = sort_lookup (sor); switch (s->kind) { case SRT_ARRAY: case SRT_STRUCT: case SRT_UNION: case SRT_HOF: case SRT_NONE: break; case SRT_VECTOR: case SRT_TUPLE: case SRT_UNIONVAL: llcontbuglit ("sort_makeGlobal: can't make vectors, tuples, or unionvals global"); break; default: handle = sort_makeObj (sor); break; } return handle; } sort sort_makeObj (sort sor) { sortNode baseSortNode, outSort; sort baseSort, handle; lsymbol name; /* skip the synonym sort */ baseSort = sort_getUnderlying (sor); baseSortNode = sort_quietLookup (baseSort); switch (baseSortNode->kind) { case SRT_HOF: case SRT_NONE: return baseSort; case SRT_VECTOR: if (baseSortNode->objSort != 0) return baseSortNode->objSort; else /* must have well-defined objSort field */ { llcontbuglit ("sort_makeObj: Inconsistent vector reps:invalid objSort field"); return baseSort; } case SRT_TUPLE: case SRT_UNIONVAL: /* need to map *_Struct_Tuple to *_Struct and *_Union_UnionVal to *_Union, according to sort naming conventions */ if (baseSortNode->baseSort != NOSORTHANDLE) /* for tuples and unionvals, baseSort field keeps the map from value sort to obj sort-> */ return baseSortNode->baseSort; else /* valid tuples and unionvals must have baseSort fields */ { llcontbuglit ("sort_makeObj: Inconsistent tuples or unionvals reps: invalid baseSort field"); return baseSort; } default: name = sp (sp (underscoreSymbol, sort_getLsymbol (baseSort)), lsymbol_fromChars ("_Obj")); handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_OBJ; /* must not clash with any LSL sorts */ outSort->name = name; outSort->tag = lsymbol_undefined; outSort->baseSort = baseSort; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->mutable = TRUE; outSort->export = exporting; outSort->abstract = FALSE; outSort->handle = handle; outSort->imported = TRUE; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); } else { outSort->handle = handle = sort_enterNew (outSort); } } else { llassert (sortTable != NULL); if (sortTable[handle]->kind != SRT_OBJ) { sortError (ltoken_undefined, handle, outSort); } sortNode_free (outSort); } return handle; } } sort sort_makePtr (ltoken t, sort baseSort) { sortNode s, outSort; sort handle, arrayHandle; lsymbol name; s = sort_lookup (baseSort); if (s->kind == SRT_HOF) { return baseSort; } if (s->kind == SRT_NONE) { return baseSort; } if (s->kind != SRT_ARRAY && s->kind != SRT_STRUCT && s->kind != SRT_UNION) /* && s->kind != SRT_OBJ) */ /* base is not an SRT_ARRAY, struct or union. Need to insert a obj. */ baseSort = sort_makeObj (baseSort); name = sp (sp (underscoreSymbol, sort_getLsymbol (baseSort)), lsymbol_fromChars ("_Ptr")); handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_PTR; outSort->name = name; outSort->tag = lsymbol_undefined; outSort->baseSort = baseSort; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->mutable = FALSE; outSort->export = exporting; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); arrayHandle = sort_makeArr (t, baseSort); genPtrOps (baseSort, handle, arrayHandle); } else { outSort->handle = handle = sort_enterNew (outSort); } } else { llassert (sortTable != NULL); if (sortTable[handle]->kind != SRT_PTR) { sortError (t, handle, outSort); } sortNode_free (outSort); } return handle; } sort sort_makePtrN (sort s, pointers p) { if (pointers_isUndefined (p)) { return s; } else { return sort_makePtrN (sort_makePtr (ltoken_undefined, s), pointers_getRest (p)); } } sort sort_makeArr (ltoken t, sort baseSort) { sortNode s, outSort, old; sort handle, vecHandle; int dim; lsymbol name; s = sort_lookup (baseSort); if (s->kind == SRT_HOF) return baseSort; if (s->kind == SRT_NONE) return baseSort; if (s->kind != SRT_ARRAY && s->kind != SRT_STRUCT && s->kind != SRT_UNION && s->kind != SRT_OBJ) /* base is not an array, struct or obj. Need to insert a Obj. */ baseSort = sort_makeObj (baseSort); name = sp (sp (underscoreSymbol, sort_getLsymbol (baseSort)), lsymbol_fromChars ("_Arr")); handle = sort_lookupName (name); /* must not clash with any LSL sorts */ outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->name = name; outSort->kind = SRT_ARRAY; outSort->baseSort = baseSort; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->mutable = TRUE; outSort->export = exporting; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { handle = sort_enterNew (outSort); outSort = sort_lookup (handle); for (old = outSort, dim = 0; old->kind == SRT_ARRAY; dim++, old = sort_lookup (old->baseSort)) { ; } vecHandle = sort_makeVec (t, handle); genArrOps (baseSort, handle, dim, vecHandle); } else { outSort->handle = handle = sort_enterNew (outSort); } } else { llassert (sortTable != NULL); if (sortTable[handle]->kind != SRT_ARRAY) { sortError (t, handle, outSort); } sortNode_free (outSort); } return handle; } sort sort_makeVec (ltoken t, sort arraySort) { sortNode s, outSort, old; sort baseSort, handle, elementSort; int dim; /* array dimension count. */ lsymbol name; s = sort_lookup (arraySort); if (s->kind == SRT_HOF) return arraySort; if (s->kind == SRT_NONE) return arraySort; if (s->kind != SRT_ARRAY) { llbug (message ("sort_makeVec: only arrays can become vectors: given sort is %s", sort_unparseKind (s->kind))); } if (s->baseSort == NOSORTHANDLE) llbuglit ("sort_makeVec: arrays must have base (element) sort"); /* Vectors return "values", so make array elements values. */ baseSort = s->baseSort; elementSort = sort_makeVal (baseSort); name = sp (sp (underscoreSymbol, sort_getLsymbol (elementSort)), lsymbol_fromChars ("_Vec")); handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->baseSort = elementSort; outSort->name = name; outSort->objSort = arraySort; outSort->kind = SRT_VECTOR; outSort->members = smemberInfo_undefined; outSort->mutable = FALSE; outSort->export = exporting; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort = sort_lookup (handle = sort_enterNew (outSort)); for (old = outSort, dim = 0; old->kind == SRT_VECTOR; dim++, old = sort_lookup (old->baseSort)) { ; } genVecOps (elementSort, handle, dim); } else { outSort->handle = handle = sort_enterNew (outSort); } } else { llassert (sortTable != NULL); if (sortTable[handle]->kind != SRT_VECTOR) { sortError (t, handle, outSort); } sortNode_free (outSort); } return handle; } sort sort_makeVal (sort sor) { sort retSort = sor; sortNode rsn, s; llassert (sortTable != NULL); s = sort_quietLookup (sor); switch (s->kind) { case SRT_PRIM: case SRT_ENUM: case SRT_PTR: case SRT_TUPLE: case SRT_UNIONVAL: case SRT_VECTOR: case SRT_HOF: case SRT_NONE: /* Do nothing for basic types and pointers. */ retSort = sor; break; case SRT_SYN: return sort_makeVal (sortTable[sor]->baseSort); case SRT_OBJ: /* Strip out the last Obj's */ if (s->baseSort == NOSORTHANDLE) { llbuglit ("sort_makeVal: expecting a base sort for Obj"); } retSort = s->baseSort; break; case SRT_ARRAY: retSort = sort_makeVec (ltoken_undefined, sor); break; case SRT_STRUCT: retSort = sort_makeTuple (ltoken_undefined, sor); break; case SRT_UNION: retSort = sort_makeUnionVal (ltoken_undefined, sor); break; default: llbuglit ("sort_makeVal: invalid sort kind"); } rsn = sort_quietLookup (retSort); if (rsn->kind == SRT_NONE) { llfatalbug (message ("sort_makeVal: invalid return sort kind: %d", (int)rsn->kind)); } return retSort; } sort sort_makeImmutable (ltoken t, lsymbol name) { sortNode outSort; sort handle; handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_PRIM; outSort->name = name; outSort->baseSort = NOSORTHANDLE; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->mutable = FALSE; outSort->imported = context_inImport (); outSort->abstract = TRUE; outSort->handle = handle; if (handle == NOSORTHANDLE) { handle = sort_enterNew (outSort); outSort = sort_lookup (handle); overloadSizeof (handle); } else { /* complain */ llassert (sortTable != NULL); if ((sortTable[handle]->kind != SRT_PRIM) && (sortTable[handle]->abstract) && (!sortTable[handle]->mutable)) { sortError (t, handle, outSort); } sortNode_free (outSort); } return handle; } sort sort_makeMutable (ltoken t, lsymbol name) { sort immutable_old, handle, baseSort; lsymbol objName; immutable_old = sort_lookupName (name); /* First generate the value sort */ baseSort = sort_makeImmutable (t, name); llassert (sortTable != NULL); /* to prevent duplicate error messages */ if (immutable_old != NOSORTHANDLE && (sortTable[baseSort]->kind != SRT_PRIM) && (sortTable[baseSort]->abstract) && (!sortTable[baseSort]->mutable)) { /* already complained */ handle = NOSORTHANDLE; } else { /* sort_makeImmutable must have succeeded */ sortNode outSort; /* must not clash with any LSL sorts */ objName = sp (sp (underscoreSymbol, name), lsymbol_fromChars ("_Obj")); handle = sort_lookupName (objName); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_OBJ; outSort->name = objName; outSort->tag = lsymbol_undefined; outSort->baseSort = baseSort; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->mutable = TRUE; outSort->export = exporting; outSort->imported = context_inImport (); outSort->abstract = TRUE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); } else { handle = sort_enterNew (outSort); } } else { llassert (sortTable != NULL); if ((sortTable[handle]->kind != SRT_OBJ) && sortTable[handle]->abstract && sortTable[handle]->mutable) { sortError (t, handle, outSort); } sortNode_free (outSort); } } return handle; } sort sort_makeStr (ltoken opttagid) { sortNode outSort; sort handle; bool isNewTag; lsymbol name; outSort = (sortNode) dmalloc (sizeof (*outSort)); /* must not clash with any LSL sorts, tag2sortname adds "_" prefix */ /* isNewTag true means that the name generated is new */ if (ltoken_isUndefined (opttagid)) { opttagid = ltoken_create (simpleId, newStructTag ()); outSort->realtag = FALSE; } else { outSort->realtag = TRUE; } name = sortTag_toSymbol ("Struct", opttagid, &isNewTag); llassert (sortTable != NULL); handle = sort_lookupName (name); outSort->name = name; outSort->kind = SRT_STRUCT; outSort->tag = ltoken_getText (opttagid); outSort->baseSort = NOSORTHANDLE; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->mutable = TRUE; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); } else { outSort->handle = handle = sort_enterNewForce (outSort); } } else { if (sortTable[handle]->kind != SRT_STRUCT) { sortError (opttagid, handle, outSort); } sortNode_free (outSort); } return handle; } bool sort_updateStr (sort strSort, /*@only@*/ smemberInfo *info) { /* expect strSort to be in sort table but not yet filled in */ /* return TRUE if it is "new" */ sort tupleSort; sortNode sn; llassert (sortTable != NULL); sn = sort_lookup (strSort); if (sn->members == (smemberInfo *) 0) { sortTable[strSort]->members = info; tupleSort = sort_makeTuple (ltoken_undefined, strSort); genStrOps (strSort, tupleSort); return TRUE; } else { smemberInfo_free (info); return FALSE; } } sort sort_makeTuple (ltoken t, sort strSort) { sort handle; sortNode outSort, s = sort_lookup (strSort); lsymbol name; if (s->kind != SRT_STRUCT) { llfatalbug (message ("sort_makeTuple: Only structs can become tuples: given sort is %s", sort_unparseKind (s->kind))); } name = sp (s->name, lsymbol_fromChars ("_Tuple")); llassert (sortTable != NULL); handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_TUPLE; outSort->name = name; outSort->tag = s->tag; outSort->realtag = s->realtag; outSort->baseSort = strSort; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->abstract = FALSE; outSort->imported = context_inImport (); outSort->mutable = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); sort_addTupleMembers (handle, strSort); genTupleOps (handle); } else { outSort->handle = handle = sort_enterNew (outSort); } } else { if (sortTable[handle]->kind != SRT_TUPLE) { sortError (t, handle, outSort); } sortNode_free (outSort); } return handle; } static void sort_addTupleMembers (sort tupleSort, sort strSort) { smemberInfo *mem, *tail = smemberInfo_undefined; smemberInfo *top = smemberInfo_undefined; smemberInfo *newinfo; /* make sure it works for empty smemberInfo */ llassert (sortTable != NULL); for (mem = sortTable[strSort]->members; mem != smemberInfo_undefined; mem = mem->next) { newinfo = (smemberInfo *) dmalloc (sizeof (*newinfo)); newinfo->name = mem->name; newinfo->sort = sort_makeVal (mem->sort); newinfo->next = smemberInfo_undefined; if (top == smemberInfo_undefined) { /* start of iteration */ top = newinfo; tail = newinfo; } else { llassert (tail != smemberInfo_undefined); tail->next = newinfo; tail = newinfo; /*@-branchstate@*/ /* tail is dependent */ } /*@=branchstate@*/ } sortTable[tupleSort]->members = top; } static void genTupleOps (sort tupleSort) { ltoken range, dom; sort fieldsort; smemberInfo *m; unsigned int memCount; ltokenList domain = ltokenList_new (); sigNode signature; opFormUnion u; opFormNode opform; nameNode nn; memCount = 0; range = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (tupleSort)); llassert (sortTable != NULL); for (m = sortTable[tupleSort]->members; m != smemberInfo_undefined; m = m->next) { fieldsort = sort_makeVal (m->sort); overloadUnary (makeFieldOp (m->name), tupleSort, fieldsort); dom = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (fieldsort)); ltokenList_addh (domain, dom); memCount++; } /* For tuples only: [__, ...]: memSorts, ... -> tupleSort */ signature = makesigNode (ltoken_undefined, domain, range); u.middle = memCount; opform = makeOpFormNode (ltoken_copy (ltoken_lbracked), OPF_BMIDDLE, u, ltoken_copy (ltoken_rbracket)); nn = makeNameNodeForm (opform); symtable_enterOp (g_symtab, nn, signature); /* ** should not be able to take sizeof (struct^) ... */ } static void genUnionOps (sort tupleSort) { /* like genTupleOps but no constructor [ ...]: -> unionSort */ smemberInfo *m; sort sort; llassert (sortTable != NULL); for (m = sortTable[tupleSort]->members; m != smemberInfo_undefined; m = m->next) { /* Generate __.memName: strSort ->memSortObj */ overloadUnary (makeFieldOp (m->name), tupleSort, m->sort); /* printf ("making __.%s: %s -> %s\n", lsymbol_toChars (m->name), sort_getName (tupleSort), sort_getName (m->sort)); */ /* __->memName : Union_Ptr -> memSortObj */ sort = sort_makePtr (ltoken_undefined, tupleSort); overloadUnary (makeArrowFieldOp (m->name), sort, m->sort); /* printf ("making __->%s: %s -> %s\n", lsymbol_toChars (m->name), sort_getName (sort), sort_getName (m->sort)); */ } } static void genStrOps (sort strSort, /*@unused@*/ sort tupleSort) { smemberInfo *m; sort sort; llassert (sortTable != NULL); for (m = sortTable[strSort]->members; m != smemberInfo_undefined; m = m->next) { /* Generate __.memName: strSort ->memSortObj */ overloadUnary (makeFieldOp (m->name), strSort, m->sort); /* printf ("making __.%s: %s -> %s\n", lsymbol_toChars (m->name), sort_getName (strSort), sort_getName (m->sort)); */ /* __->memName : Struct_Ptr -> memSortObj */ sort = sort_makePtr (ltoken_undefined, strSort); overloadUnary (makeArrowFieldOp (m->name), sort, m->sort); /* printf ("making __->%s: %s -> %s\n", lsymbol_toChars (m->name), sort_getName (sort), sort_getName (m->sort)); */ } /* Generate fresh, trashed, modifies, unchanged: struct/union -> bool */ /* Generate __any, __pre, __post: nStruct -> nTuple */ /* Generate sizeof: strSort -> int */ /* overloadStateFcns (strSort, tupleSort); */ } sort sort_makeUnion (ltoken opttagid) { sortNode outSort; sort handle; bool isNewTag; lsymbol name; /* must not clash with any LSL sorts, tag2sortname adds "_" prefix */ /* isNewTag true means that the name generated is new */ outSort = (sortNode) dmalloc (sizeof (*outSort)); if (ltoken_isUndefined (opttagid)) { opttagid = ltoken_create (simpleId, newUnionTag ()); outSort->realtag = FALSE; } else { outSort->realtag = TRUE; } llassert (sortTable != NULL); name = sortTag_toSymbol ("Union", opttagid, &isNewTag); handle = sort_lookupName (name); outSort->name = name; outSort->kind = SRT_UNION; outSort->tag = ltoken_getText (opttagid); outSort->baseSort = NOSORTHANDLE; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->mutable = TRUE; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); } else { outSort->handle = handle = sort_enterNewForce (outSort); } } else { if (sortTable[handle]->kind != SRT_UNION) { sortError (opttagid, handle, outSort); } sortNode_free (outSort); } return handle; } bool sort_updateUnion (sort unionSort, /*@only@*/ smemberInfo *info) { /* expect unionSort to be in sort table but not yet filled in */ /* return TRUE if it is "new" */ sort uValSort; sortNode sn; llassert (sortTable != NULL); sn = sort_lookup (unionSort); if (sn->members == (smemberInfo *) 0) { sortTable[unionSort]->members = info; uValSort = sort_makeUnionVal (ltoken_undefined, unionSort); /* same as struct operations */ genStrOps (unionSort, uValSort); return TRUE; } else { smemberInfo_free (info); return FALSE; } } sort sort_makeUnionVal (ltoken t, sort unionSort) { sort handle; sortNode outSort, s = sort_lookup (unionSort); lsymbol name; if (s->kind != SRT_UNION) { llfatalbug (message ("sort_makeUnion: only unions can become unionVals: given sort is: %s", sort_unparseKind (s->kind))); } llassert (sortTable != NULL); name = sp (s->name, lsymbol_fromChars ("_UnionVal")); handle = sort_lookupName (name); outSort = (sortNode) dmalloc (sizeof (*outSort)); outSort->kind = SRT_UNIONVAL; outSort->name = name; outSort->tag = s->tag; outSort->realtag = s->realtag; outSort->baseSort = unionSort; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->abstract = FALSE; outSort->imported = context_inImport (); outSort->mutable = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); /* Add members to the unionVal's. */ /* same as structs and tuples */ sort_addTupleMembers (handle, unionSort); genUnionOps (handle); } else { outSort->handle = handle = sort_enterNew (outSort); } } else { if (sortTable[handle]->kind != SRT_UNIONVAL) { sortError (t, handle, outSort); } sortNode_free (outSort); } return handle; } static lsymbol newEnumTag () { static int ecount = 0; return (cstring_toSymbol (message ("e%s%de", context_moduleName (), ecount++))); } static lsymbol newStructTag () { static int ecount = 0; return (cstring_toSymbol (message ("s%s%ds", context_moduleName (), ecount++))); } static lsymbol newUnionTag () { static int ecount = 0; return (cstring_toSymbol (message ("u%s%du", context_moduleName (), ecount++))); } sort sort_makeEnum (ltoken opttagid) { sortNode outSort; sort handle; bool isNew; lsymbol name; llassert (sortTable != NULL); outSort = (sortNode) dmalloc (sizeof (*outSort)); if (ltoken_isUndefined (opttagid)) { opttagid = ltoken_create (simpleId, newEnumTag ()); outSort->realtag = FALSE; } else { outSort->realtag = TRUE; } /* must not clash with any LSL sorts, tag2sortname adds "_" prefix */ name = sortTag_toSymbol ("Enum", opttagid, &isNew); handle = sort_lookupName (name); outSort->name = name; outSort->kind = SRT_ENUM; outSort->tag = ltoken_getText (opttagid); outSort->baseSort = NOSORTHANDLE; outSort->objSort = NOSORTHANDLE; outSort->members = smemberInfo_undefined; outSort->export = exporting; outSort->mutable = FALSE; outSort->imported = context_inImport (); outSort->abstract = FALSE; outSort->handle = handle; if (handle == NOSORTHANDLE) { if (sort_isNewEntry (outSort)) { outSort->handle = handle = sort_enterNew (outSort); } else { outSort->handle = handle = sort_enterNewForce (outSort); } } else { if (sortTable[handle]->kind != SRT_ENUM) { sortError (opttagid, handle, outSort); } sortNode_free (outSort); } return handle; } bool sort_updateEnum (sort enumSort, /*@only@*/ smemberInfo *info) { /* ** Expect enumSort to be in sort table but not yet filled in. ** Return TRUE if it is "new" */ sortNode sn; llassert (sortTable != NULL); sn = sort_lookup (enumSort); if (sn->members == (smemberInfo *) 0) { sortTable[enumSort]->members = info; genEnumOps (enumSort); return TRUE; } else { smemberInfo_free (info); return FALSE; } } static void genEnumOps (sort enumSort) { smemberInfo *ei; ltokenList domain = ltokenList_new (); ltoken range, mem; nameNode nn; sigNode signature; range = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (enumSort)); signature = makesigNode (ltoken_undefined, domain, range); llassert (sortTable != NULL); for (ei = sortTable[enumSort]->members; ei != (smemberInfo *) 0; ei = ei->next) { mem = ltoken_createType (simpleId, SID_OP, ei->name); nn = makeNameNodeId (mem); symtable_enterOp (g_symtab, nn, sigNode_copy (signature)); } sigNode_free (signature); overloadSizeof (enumSort); } static void genPtrOps (/*@unused@*/ sort baseSort, sort ptrSort, sort arraySort) { /* Generate *__: xPtr -> x */ /* overloadUnary (deRefNameNode, ptrSort, baseSort); */ /* Generate maxIndex, minIndex: xPtr -> int */ /* overloadUnaryTok (maxIndexNameNode, ptrSort, intToken); */ /* overloadUnaryTok (minIndexNameNode, ptrSort, intToken); */ /* Generate __[]: pointer -> array */ overloadUnary (nameNode_copySafe (ptr2arrayNameNode), ptrSort, arraySort); /* Generate __+__, __-__: pointer, int -> pointer */ overloadBinary (nameNode_copySafe (plusNameNode), ptrSort, ltoken_copy (intToken), ptrSort); overloadBinary (nameNode_copySafe (minusNameNode), ptrSort, ltoken_copy (intToken), ptrSort); /* Generate NIL: -> xPtr */ /* Generate __+__: int, pointer -> pointer */ /* Generate __-__: pointer, pointer -> int */ overloadPtrFcns (ptrSort); } static void genArrOps (sort baseSort, sort arraySort, int dim, /*@unused@*/ sort vecSort) { /* Generate __[__]: nArr, int -> n */ overloadBinary (nameNode_copySafe (arrayRefNameNode), arraySort, ltoken_copy (intToken), baseSort); /* Generate maxIndex, minIndex: sort -> int */ /* overloadUnaryTok (maxIndexNameNode, arraySort, intToken); */ /* overloadUnaryTok (minIndexNameNode, arraySort, intToken); */ /* Generate isSub: arraySort, int, ... -> bool */ overloadIsSub (arraySort, dim); /* Generate fresh, trashed, modifies, unchanged: array -> bool */ /* Generate any, pre, post: array -> vector */ /* overloadStateFcns (arraySort, vecSort); */ /* overloadObjFcns (arraySort); */ } /* ** overloadPtrFcns: ** generate NIL: -> ptrSort ** __+__: int, ptrSort -> ptrSort ** __-__: ptrSort, ptrSort -> int */ static void overloadPtrFcns (sort ptrSort) { ltokenList domain = ltokenList_new (); ltoken range; sigNode signature; /* NIL: -> ptrSort */ range = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (ptrSort)); signature = makesigNode (ltoken_undefined, ltokenList_new (), ltoken_copy (range)); symtable_enterOp (g_symtab, nameNode_copySafe (nilNameNode), signature); /* __+__: int, ptrSort -> ptrSort */ ltokenList_addh (domain, ltoken_copy (intToken)); ltokenList_addh (domain, ltoken_copy (range)); signature = makesigNode (ltoken_undefined, domain, ltoken_copy (range)); symtable_enterOp (g_symtab, nameNode_copySafe (plusNameNode), signature); /* __-__: ptrSort, ptrSort -> int */ domain = ltokenList_new (); ltokenList_addh (domain, ltoken_copy (range)); ltokenList_addh (domain, range); range = ltoken_copy (intToken); signature = makesigNode (ltoken_undefined, domain, range); symtable_enterOp (g_symtab, nameNode_copySafe (minusNameNode), signature); } static void genVecOps (sort baseSort, sort vecSort, int dim) { /* Generate __[__]: vecSort, int -> baseSort */ overloadBinary (nameNode_copySafe (arrayRefNameNode), vecSort, ltoken_copy (intToken), baseSort); /* sizeof: vecSort -> int */ /* Generate isSub: vecSort, int, ... -> bool */ overloadIsSub (vecSort, dim); } static void overloadIsSub (sort s, int dim) { /* Generate isSub: s, int, ... -> bool */ int j, i; ltoken dom, nulltok = ltoken_undefined; ltokenList domain; sigNode signature; for (j = 1; j <= dim; j++) { nameNode isSubNameNode = (nameNode) dmalloc (sizeof (*isSubNameNode)); isSubNameNode->isOpId = TRUE; isSubNameNode->content.opid = ltoken_createType (simpleId, SID_OP, lsymbol_fromChars ("isSub")); dom = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (s)); domain = ltokenList_singleton (dom); for (i = 1; i <= j; i++) { ltokenList_addh (domain, ltoken_copy (intToken)); } signature = makesigNode (nulltok, domain, ltoken_copy (ltoken_bool)); symtable_enterOp (g_symtab, isSubNameNode, signature); } } static void overloadUnaryTok (/*@only@*/ nameNode nn, sort domainSort, /*@only@*/ ltoken range) { /* Generate : domainSort -> rangeTok */ sigNode signature; ltoken dom; ltokenList domain; dom = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (domainSort)); domain = ltokenList_singleton (dom); signature = makesigNode (ltoken_undefined, domain, range); symtable_enterOp (g_symtab, nn, signature); } static void overloadSizeof (sort domainSort) { nameNode sizeofNameNode = (nameNode) dmalloc (sizeof (*sizeofNameNode)); sizeofNameNode->isOpId = TRUE; sizeofNameNode->content.opid = ltoken_createType (simpleId, SID_OP, lsymbol_fromChars ("sizeof")); overloadUnaryTok (sizeofNameNode, domainSort, ltoken_copy (intToken)); } static void overloadUnary (/*@only@*/ nameNode nn, sort domainSort, sort rangeSort) { ltoken range = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (rangeSort)); overloadUnaryTok (nn, domainSort, range); } static void overloadBinary (/*@only@*/ nameNode nn, sort s, /*@only@*/ ltoken dTok, sort rs) { /* Generate : s, dTok -> rs */ sigNode signature; ltoken range, dom; ltokenList domain = ltokenList_new (); range = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (rs)); dom = ltoken_createType (simpleId, SID_SORT, sort_getLsymbol (s)); ltokenList_addh (domain, dom); ltokenList_addh (domain, dTok); signature = makesigNode (ltoken_undefined, domain, range); symtable_enterOp (g_symtab, nn, signature); } static /*@only@*/ nameNode makeFieldOp (lsymbol field) { /* operator: __. */ nameNode nn; opFormUnion u; opFormNode opform; u.id = ltoken_createType (simpleId, SID_OP, field); opform = makeOpFormNode (ltoken_undefined, OPF_MSELECT, u, ltoken_undefined); nn = makeNameNodeForm (opform); return nn; } static /*@only@*/ nameNode makeArrowFieldOp (lsymbol field) { /* operator: __-> */ nameNode nn; opFormUnion u; opFormNode opform; u.id = ltoken_createType (simpleId, SID_OP, field); opform = makeOpFormNode (ltoken_undefined, OPF_MMAP, u, ltoken_undefined); nn = makeNameNodeForm (opform); return nn; } void sort_init (void) /*@globals undef arrayRefNameNode, undef ptr2arrayNameNode, undef deRefNameNode, undef nilNameNode, undef plusNameNode, undef minusNameNode, undef condNameNode, undef eqNameNode, undef neqNameNode, undef intToken; @*/ { /* on alpha, declaration does not allocate storage */ sortNode noSort, HOFSort; opFormNode opform; opFormUnion u; underscoreSymbol = lsymbol_fromChars ("_"); /* ** commonly used data for generating operators */ lsymbol_setbool (lsymbol_fromChars ("bool")); intToken = ltoken_createType (simpleId, SID_SORT, lsymbol_fromChars ("int")); /* ** __ \eq __: sort, sort -> bool */ u.anyop = ltoken_copy (ltoken_eq); opform = makeOpFormNode (ltoken_undefined, OPF_MANYOPM, u, ltoken_undefined); eqNameNode = makeNameNodeForm (opform); /* ** __ \neq __: sort, sort -> bool */ u.anyop = ltoken_copy (ltoken_neq); opform = makeOpFormNode (ltoken_undefined, OPF_MANYOPM, u, ltoken_undefined); neqNameNode = makeNameNodeForm (opform); /* **if __ then __ else __: bool, sort, sort -> sort */ opform = makeOpFormNode (ltoken_undefined, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); condNameNode = makeNameNodeForm (opform); /* operator: __[__]: arraySort, int -> elementSort_Obj */ u.middle = 1; opform = makeOpFormNode (ltoken_copy (ltoken_lbracked), OPF_BMMIDDLE, u, ltoken_copy (ltoken_rbracket)); arrayRefNameNode = makeNameNodeForm (opform); /* operator: __[]: ptrSort -> arraySort */ u.middle = 0; opform = makeOpFormNode (ltoken_copy (ltoken_lbracked), OPF_BMMIDDLE, u, ltoken_copy (ltoken_rbracket)); ptr2arrayNameNode = makeNameNodeForm (opform); /* operator: *__ */ u.anyop = ltoken_create (LLT_MULOP, lsymbol_fromChars ("*")); opform = makeOpFormNode (ltoken_undefined, OPF_ANYOPM, u, ltoken_undefined); deRefNameNode = makeNameNodeForm (opform); /* operator: __ + __ */ u.anyop = ltoken_create (simpleOp, lsymbol_fromChars ("+")); opform = makeOpFormNode (ltoken_undefined, OPF_MANYOPM, u, ltoken_undefined); plusNameNode = makeNameNodeForm (opform); /* operator: __ - __ */ u.anyop = ltoken_create (simpleOp, lsymbol_fromChars ("-")); opform = makeOpFormNode (ltoken_undefined, OPF_MANYOPM, u, ltoken_undefined); minusNameNode = makeNameNodeForm (opform); /* operator: NIL */ nilNameNode = (nameNode) dmalloc (sizeof (*nilNameNode)); nilNameNode->isOpId = TRUE; nilNameNode->content.opid = ltoken_createType (simpleId, SID_OP, lsymbol_fromChars ("NIL")); noSort = (sortNode) dmalloc (sizeof (*noSort)); noSort->kind = SRT_NONE; noSort->name = lsymbol_fromChars ("_unknown");; noSort->tag = lsymbol_undefined; noSort->baseSort = NOSORTHANDLE; noSort->objSort = NOSORTHANDLE; noSort->members = smemberInfo_undefined; noSort->export = FALSE; noSort->mutable = FALSE; noSort->abstract = FALSE; noSort->imported = FALSE; noSort->handle = NOSORTHANDLE; HOFSort = (sortNode) dmalloc (sizeof (*HOFSort)); HOFSort->kind = SRT_HOF; HOFSort->handle = HOFSORTHANDLE; HOFSort->name = lsymbol_undefined; HOFSort->tag = lsymbol_undefined; HOFSort->realtag = FALSE; HOFSort->baseSort = NOSORTHANDLE; HOFSort->objSort = NOSORTHANDLE; HOFSort->members = smemberInfo_undefined; HOFSort->export = FALSE; HOFSort->mutable = FALSE; HOFSort->abstract = FALSE; HOFSort->imported = FALSE; /* ** Store the null sort into table, and in the process initialize the sort table. ** Must be the first sort_enter so NOSORTHANDLE is truly = 0. Similarly, ** for HOFSORTHANDLE = 1. */ (void) sort_enterGlobal (noSort); (void) sort_enterGlobal (HOFSort); /* Other builtin sorts */ g_sortBool = sort_makeImmutable (ltoken_undefined, lsymbol_fromChars ("bool")); g_sortCapBool = sort_makeSortNoOps (ltoken_undefined, lsymbol_fromChars ("Bool")); llassert (sortTable != NULL); /* make g_sortBool a synonym for g_sortBool */ sortTable[g_sortCapBool]->kind = SRT_SYN; sortTable[g_sortCapBool]->baseSort = g_sortBool; sortTable[g_sortCapBool]->mutable = FALSE; sortTable[g_sortCapBool]->abstract = TRUE; g_sortInt = sort_makeLiteralSort (ltoken_undefined, lsymbol_fromChars ("int")); g_sortChar = sort_makeLiteralSort (ltoken_undefined, lsymbol_fromChars ("char")); sort_void = sort_makeLiteralSort (ltoken_undefined, lsymbol_fromChars ("void")); /* g_sortCstring is char__Vec, for C strings eg: "xyz" */ char_obj_ptrSort = sort_makePtr (ltoken_undefined, g_sortChar); char_obj_ArrSort = sort_makeArr (ltoken_undefined, g_sortChar); g_sortCstring = sort_makeVal (char_obj_ArrSort); g_sortFloat = sort_makeLiteralSort (ltoken_undefined, lsymbol_fromChars ("float")); g_sortDouble = sort_makeLiteralSort (ltoken_undefined, lsymbol_fromChars ("double")); } sort sort_lookupName (lsymbol name) { long int i; if (name == lsymbol_undefined) { return NOSORTHANDLE; } llassert (sortTable != NULL); for (i = 0; i < sortTableSize; i++) { if (sortTable[i]->name == name) { return i; } } return NOSORTHANDLE; } static bool sort_isNewEntry (sortNode s) { int i; for (i = 0; i < sortTableSize; i++) { llassert (sortTable != NULL); if (sortTable[i]->kind == s->kind && sortTable[i]->name == s->name) { return FALSE; } } return TRUE; } static sort sort_enterGlobal (sortNode s) { return (sort_enterNew (s)); } static sort sort_enterNew (sortNode s) { /* ** This ensures that the argument sortNode is not entered into ** the sort table more than once. isNew flag will tell the ** caller this info, and the caller will decide whether to generate ** operators for this sort. */ long int i; for (i = 0; i < sortTableSize; i++) { llassert (sortTable != NULL); if (sortTable[i]->kind == s->kind && sortTable[i]->name == s->name) { sortNode_free (s); return i; } } if (sortTableSize >= sortTableAlloc) { sortNode *oldSortTable = sortTable; sortTableAlloc += DELTA; sortTable = (sortNode *) dmalloc (sortTableAlloc * sizeof (*sortTable)); if (sortTableSize > 0) { llassert (oldSortTable != NULL); for (i = 0; i < sortTableSize; i++) { sortTable[i] = oldSortTable[i]; } } sfree (oldSortTable); } llassert (sortTable != NULL); s->handle = sortTableSize; sortTable[sortTableSize++] = s; /*@-compdef@*/ return s->handle; } /*=compdef@*/ static sort sort_enterNewForce (sortNode s) { sort sor = sort_lookupName (s->name); if (sort_isNoSort (sor)) { sor = sort_enterNew (s); llassert (sortTable != NULL); /*@-usereleased@*/ llassert (sortTable[sor] == s); /*@=usereleased@*/ } else { s->handle = sor; llassert (sortTable != NULL); sortTable[sor] = s; } /*@-globstate@*/ return (sor); /*@=globstate@*/ } void sort_printStats (void) { /* only for debugging */ printf ("sortTableSize = %d; sortTableAlloc = %d\n", sortTableSize, sortTableAlloc); } sortNode sort_lookup (sort sor) { /* ymtan: can sor be 0 ? */ /* evs --- yup...0 should return noSort ? */ if (sor > 0U && sor < (unsigned) sortTableSize) { llassert (sortTable != NULL); return sortTable[sor]; } llassert (sor == 0); llassert (sor == NOSORTHANDLE); llassert (sortTable != NULL); return sortTable[NOSORTHANDLE]; } sortNode sort_quietLookup (sort sor) { /* ymtan: can sor be 0 ? */ if (sor > 0U && sor < (unsigned) sortTableSize) { llassert (sortTable != NULL); return (sortTable[sor]); } else { llassert (sortTable != NULL); return (sortTable[NOSORTHANDLE]); } } static cstring printEnumMembers (/*@null@*/ smemberInfo *list) { cstring out = cstring_undefined; smemberInfo *m; for (m = list; m != (smemberInfo *) 0; m = m->next) { out = cstring_concat (out, lsymbol_toString (m->name)); if (m->next != (smemberInfo *) 0) { out = cstring_concatChars (out, ", "); } } return out; } static /*@only@*/ cstring printStructMembers (/*@null@*/ smemberInfo *list) { cstring ret = cstring_undefined; smemberInfo *m; for (m = list; m != (smemberInfo *) 0; m = m->next) { ret = message ("%q%q %s; ", ret, sort_unparse (m->sort), cstring_fromChars (lsymbol_toChars (m->name))); } return ret; } /*@only@*/ cstring sort_unparse (sort s) { /* printing routine for sorts */ sortNode sn; lsymbol name; sn = sort_quietLookup (s); name = sn->name; switch (sn->kind) { case SRT_NONE: if (name == lsymbol_undefined) { return cstring_makeLiteral ("_unknown"); } return (cstring_fromCharsNew (lsymbol_toChars (name))); case SRT_HOF: return cstring_makeLiteral ("procedural"); case SRT_PRIM: return (cstring_fromCharsNew (lsymbol_toChars (name))); case SRT_SYN: return (cstring_fromCharsNew (lsymbol_toChars (name))); case SRT_PTR: return (message ("%q *", sort_unparse (sort_makeVal (sn->baseSort)))); case SRT_OBJ: return (message ("obj %q", sort_unparse (sn->baseSort))); case SRT_ARRAY: return (message ("array of %q", sort_unparse (sort_makeVal (sn->baseSort)))); case SRT_VECTOR: return (message ("vector of %q", sort_unparse (sn->baseSort))); case SRT_TUPLE: if (sn->tag != lsymbol_undefined && sn->realtag) { return (message ("struct %s", cstring_fromChars (lsymbol_toChars (sn->tag)))); } else { return (message ("struct {%q}", printStructMembers (sn->members))); } case SRT_UNIONVAL: if (sn->tag != lsymbol_undefined && sn->realtag) { return (message ("union %s", cstring_fromChars (lsymbol_toChars (sn->tag)))); } else { return (message ("union {%q}", printStructMembers (sn->members))); } case SRT_ENUM: if (sn->tag != lsymbol_undefined && sn->realtag) { return (message ("enum %s", cstring_fromChars (lsymbol_toChars (sn->tag)))); } else { return (message ("enum {%q}", printEnumMembers (sn->members))); } case SRT_STRUCT: if (sn->tag != lsymbol_undefined && sn->realtag) { return (message ("obj struct %s", cstring_fromChars (lsymbol_toChars (sn->tag)))); } else { return (message ("obj struct {%q}", printStructMembers (sn->members))); } case SRT_UNION: if (sn->tag != lsymbol_undefined && sn->realtag) { return (message ("obj union %s", cstring_fromChars (lsymbol_toChars (sn->tag)))); } else { return (message ("obj union {%q}", printStructMembers (sn->members))); } default: return (cstring_makeLiteral ("illegal")); } } static lsymbol sp (lsymbol s1, lsymbol s2) { char buff[MAXBUFFLEN]; char *name1Ptr; char *name2Ptr; int temp_length; name1Ptr = lsymbol_toCharsSafe (s1); name2Ptr = lsymbol_toCharsSafe (s2); if (strlen (name1Ptr) + strlen (name2Ptr) + 1 > MAXBUFFLEN) { temp_length = strlen (name1Ptr) + strlen (name2Ptr) + 1; llfatalbug (message ("sp: name too long: %s%s", cstring_fromChars (name1Ptr), cstring_fromChars (name2Ptr))); } strcpy (&buff[0], name1Ptr); strcat (&buff[0], name2Ptr); return lsymbol_fromChars (&buff[0]); } static lsymbol sortTag_toSymbol (char *kind, ltoken tagid, /*@out@*/ bool *isNew) { /* ** kind could be struct, union or enum. Create a unique sort ** name based on the given info. But first check that tagid ** has not been defined already. (ok if it is a forward decl) **/ tagInfo to; if (ltoken_isUndefined (tagid)) { *isNew = TRUE; return (cstring_toSymbol (message ("_anon_%s%d", cstring_fromChars (kind), sortUID++))); } else { to = symtable_tagInfo (g_symtab, ltoken_getText (tagid)); if (tagInfo_exists (to)) { *isNew = FALSE; } else { *isNew = TRUE; } return (cstring_toSymbol (message ("_%s_%s", ltoken_unparse (tagid), cstring_fromChars (kind)))); } } /*@constant int MAX_SORT_DEPTH@*/ # define MAX_SORT_DEPTH 10 static sort sort_getUnderlyingAux (sort s, int depth) { sortNode sn = sort_quietLookup (s); if (sn->kind == SRT_SYN) { if (depth > MAX_SORT_DEPTH) { llcontbug (message ("sort_getUnderlying: depth charge: %d", depth)); return s; } return sort_getUnderlyingAux (sn->baseSort, depth + 1); } return s; } sort sort_getUnderlying (sort s) { return sort_getUnderlyingAux (s, 0); } static lsymbol underlyingSortName (sortNode sn) { if (sn->kind == SRT_SYN) return underlyingSortName (sort_quietLookup (sn->baseSort)); return sn->name; } static /*@observer@*/ sortNode underlyingSortNode (sortNode sn) { if (sn->kind == SRT_SYN) { return underlyingSortNode (sort_quietLookup (sn->baseSort)); } return sn; } bool sort_mutable (sort s) { /* if s is not a valid sort, then returns false */ sortNode sn = sort_quietLookup (s); if (sn->mutable) return TRUE; return FALSE; } bool sort_setExporting (bool flag) { bool old; old = exporting; exporting = flag; return old; } /*@observer@*/ static cstring sort_unparseKind (sortKind k) { if (k > SRT_FIRST && k < SRT_LAST) return (cstring_fromChars (sortKindName[(int)k])); else return (cstring_makeLiteralTemp ("")); } bool sort_isValidSort (sort s) { sortNode sn = sort_quietLookup (s); sortKind k = sn->kind; if (k != SRT_NONE && k > SRT_FIRST && k < SRT_LAST) return TRUE; else return FALSE; } void sort_dump (FILE *f, bool lco) { int i; sortNode s; smemberInfo *mem; fprintf (f, "%s\n", BEGINSORTTABLE); llassert (sortTable != NULL); for (i = 2; i < sortTableSize; i++) { /* skips 0 and 1, noSort and HOFSort */ s = sortTable[i]; /* if (lco && !s.export) continue; */ /* Difficult to keep track of where each op and sort belong to which LCL type. Easiest to export them all (even private sorts and op's) but for checking imported modules, we only use LCL types and variables to check, i.e., we don't rely on sorts and op's for such checking. */ if (s->kind == SRT_NONE) continue; if (lco) { fprintf (f, "%%LCL"); } if (lsymbol_isDefined (s->name)) { fprintf (f, "sort %s ", lsymbol_toCharsSafe (s->name)); } else { llcontbug (message ("Invalid sort in sort_dump: sort %d; sortname: %s. " "This may result from using .lcs files produced by an old version of Splint. " "Remove the .lcs files, and rerun Splint.", i, lsymbol_toString (s->name))); fprintf (f, "sort _error_ "); } if (!lco && !s->export) fprintf (f, "private "); /*@-loopswitchbreak@*/ switch (s->kind) { case SRT_HOF: fprintf (f, "hof nil nil\n"); break; case SRT_PRIM: if (s->abstract) fprintf (f, "immutable nil nil\n"); else fprintf (f, "primitive nil nil\n"); break; case SRT_OBJ: if (s->abstract) fprintf (f, "mutable %s nil\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name)); else fprintf (f, "obj %s nil\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name)); break; case SRT_SYN: fprintf (f, "synonym %s nil\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name)); break; case SRT_PTR: fprintf (f, "ptr %s nil\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name)); break; case SRT_ARRAY: fprintf (f, "arr %s nil\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name)); break; case SRT_VECTOR: fprintf (f, "vec %s %s\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name), lsymbol_toCharsSafe (sortTable[s->objSort]->name)); break; case SRT_STRUCT: if (s->tag == lsymbol_undefined) { /* we need to make up a tag to prevent excessive growth of .lcs files when tags are overloaded */ llbuglit ("Struct has no tag"); } else fprintf (f, "str %s nil\n", lsymbol_toCharsSafe (s->tag)); for (mem = s->members; mem != smemberInfo_undefined; mem = mem->next) { if (lco) fprintf (f, "%%LCL"); fprintf (f, "sort %s strMem %s nil\n", lsymbol_toCharsSafe (mem->name), lsymbol_toCharsSafe (sortTable[mem->sort]->name)); } if (lco) fprintf (f, "%%LCL"); fprintf (f, "sort strEnd nil nil nil\n"); break; case SRT_UNION: if (s->tag == lsymbol_undefined) llbuglit ("Union has no tag"); else fprintf (f, "union %s nil\n", lsymbol_toCharsSafe (s->tag)); for (mem = s->members; mem != smemberInfo_undefined; mem = mem->next) { if (lco) fprintf (f, "%%LCL"); fprintf (f, "sort %s unionMem %s nil\n", lsymbol_toCharsSafe (mem->name), lsymbol_toCharsSafe (sortTable[mem->sort]->name)); } if (lco) fprintf (f, "%%LCL"); fprintf (f, "sort unionEnd nil nil nil\n"); break; case SRT_ENUM: if (s->tag == lsymbol_undefined) { llbuglit ("Enum has no tag"); } fprintf (f, "enum %s nil\n", lsymbol_toCharsSafe (s->tag)); for (mem = s->members; mem != smemberInfo_undefined; mem = mem->next) { if (lco) fprintf (f, "%%LCL"); fprintf (f, "sort %s enumMem nil nil\n", lsymbol_toCharsSafe (mem->name)); } if (lco) fprintf (f, "%%LCL"); fprintf (f, "sort enumEnd nil nil nil\n"); break; case SRT_TUPLE: fprintf (f, "tup %s nil\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name)); break; case SRT_UNIONVAL: fprintf (f, "unionval %s nil\n", lsymbol_toCharsSafe (sortTable[s->baseSort]->name)); break; default: fprintf (f, "sort_dump: unexpected sort: %d", (int)s->kind); } /* switch */ /*@=loopswitchbreak@*/ } fprintf (f, "%s\n", SORTTABLEEND); } static void sort_loadOther (char *kstr, lsymbol sname, sort bsort) { if (strcmp (kstr, "synonym") == 0) { (void) sort_construct (sname, SRT_SYN, bsort, lsymbol_undefined, FALSE, NOSORTHANDLE, smemberInfo_undefined); } else if (strcmp (kstr, "mutable") == 0) { (void) sort_constructAbstract (sname, TRUE, bsort); } else if (strcmp (kstr, "obj") == 0) { (void) sort_construct (sname, SRT_OBJ, bsort, lsymbol_undefined, TRUE, NOSORTHANDLE, smemberInfo_undefined); } else if (strcmp (kstr, "ptr") == 0) { (void) sort_construct (sname, SRT_PTR, bsort, lsymbol_undefined, FALSE, NOSORTHANDLE, smemberInfo_undefined); } else if (strcmp (kstr, "arr") == 0) { (void) sort_construct (sname, SRT_ARRAY, bsort, lsymbol_undefined, TRUE, NOSORTHANDLE, smemberInfo_undefined); } else if (strcmp (kstr, "tup") == 0) { (void) sort_construct (sname, SRT_TUPLE, bsort, lsymbol_undefined, FALSE, NOSORTHANDLE, smemberInfo_undefined); } else if (strcmp (kstr, "unionval") == 0) { (void) sort_construct (sname, SRT_UNIONVAL, bsort, lsymbol_undefined, FALSE, NOSORTHANDLE, smemberInfo_undefined); } else { llbug (message ("Unhandled: %s", cstring_fromChars (kstr))); } } static void parseSortLine (char *line, ltoken t, inputStream s, mapping map, lsymbolList slist) { /* caller expects that map and slist are updated */ /* t and importfle are only used for error messages */ static lsymbol strName = lsymbol_undefined; static smemberInfo *strMemList = NULL; static lsymbol unionName = lsymbol_undefined; static smemberInfo *unionMemList = NULL; static lsymbol enumName = lsymbol_undefined; static smemberInfo *enumMemList = NULL; static lsymbol tagName = lsymbol_undefined; cstring importfile = inputStream_fileName (s); char sostr[MAXBUFFLEN], kstr[10], basedstr[MAXBUFFLEN], objstr[MAXBUFFLEN]; bool tmp; tagInfo ti; lsymbol sname, bname, new_name, objName; sort objSort; char *lineptr; int col; /* for keeping column number */ ltoken tagid; if (sscanf (line, "sort %s %s %s %s", &(sostr[0]), &(kstr[0]), &(basedstr[0]), &(objstr[0])) != 4) { /* if this fails, can have weird errors */ /* strEnd, unionEnd, enumEnd won't return 4 args */ lclplainerror (message ("%q: Imported file contains illegal sort declaration. " "Skipping this line: \n%s\n", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (s)), cstring_fromChars (line))); return; } sname = lsymbol_fromChars (sostr); if (sname == lsymbol_fromChars ("nil")) { /* No given sort name. Use lsymbol_undefined and generate sort name in sort building routines. */ sname = lsymbol_undefined; lclerror (t, message ("Illegal sort declaration in import file: %s:\n%s", importfile, cstring_fromChars (line))); } /* Assume that when we encounter a sort S1 that is based on sort S2, S2 is before S1 in the imported file. sort table is a linear list and we create base sorts before other sorts. */ bname = lsymbol_fromChars (basedstr); if (strcmp (kstr, "primitive") == 0) { new_name = lsymbol_translateSort (map, sname); (void) sort_construct (new_name, SRT_PRIM, NOSORTHANDLE, lsymbol_undefined, FALSE, NOSORTHANDLE, smemberInfo_undefined); } else if (strcmp (kstr, "strMem") == 0) { smemberInfo *mem = (smemberInfo *) dmalloc (sizeof (*mem)); mem->next = strMemList; mem->name = sname; mem->sortname = bname; mem->sort = NOSORTHANDLE; strMemList = mem; } else if (strcmp (sostr, "strEnd") == 0) { /* now process it */ if (strName != lsymbol_undefined && strMemList != NULL) { sort asort = sort_construct (strName, SRT_STRUCT, NOSORTHANDLE, tagName, TRUE, NOSORTHANDLE, strMemList); if (tagName != lsymbol_undefined) { tagid = ltoken_create (simpleId, tagName); ti = (tagInfo) dmalloc (sizeof (*ti)); ti->sort = asort; ti->kind = TAG_STRUCT; ti->id = tagid; ti->imported = FALSE; (void) symtable_enterTagForce (g_symtab, ti); } } else { if (strName == lsymbol_undefined) { lclbug (message ("%q: Imported file contains unexpected null struct sort", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (s)))); } else { /* ** no members -> its a forward struct */ if (tagName != lsymbol_undefined) { tagid = ltoken_create (simpleId, tagName); (void) checkAndEnterTag (TAG_FWDSTRUCT, tagid); } } } strName = lsymbol_undefined; strMemList = NULL; tagName = lsymbol_undefined; } else if (strcmp (kstr, "str") == 0) { if (strName != lsymbol_undefined || strMemList != NULL) { lclbug (message ("%q: unexpected non-null struct sort or " "non-empty member list", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (s)))); } /* see if a tag is associated with this sort */ if (strcmp (basedstr, "nil") == 0) { llfatalerror (message ("%s: Struct missing tag. Obsolete .lcs file, remove and rerun lcl.", importfile)); /* strName = sortTag_toSymbol ("Struct", nulltok, &tmp); tagName = lsymbol_undefined; mapping_bind (map, sname, strName); */ } else /* a tag exists */ { /* create tag in symbol table and add tagged sort in sort table */ tagName = bname; tagid = ltoken_create (simpleId, bname); strName = sortTag_toSymbol ("Struct", tagid, &tmp); ti = symtable_tagInfo (g_symtab, tagName); /* ** No error for redefining a tag in an import. */ } /* to be processed later in sort_import */ lsymbolList_addh (slist, strName); } else if (strcmp (kstr, "enumMem") == 0) { smemberInfo *mem = (smemberInfo *) dmalloc (sizeof (*mem)); mem->next = enumMemList; mem->sortname = enumName; mem->name = sname; mem->sort = NOSORTHANDLE; enumMemList = mem; } else if (strcmp (sostr, "enumEnd") == 0) { if (enumName != lsymbol_undefined && enumMemList != NULL) { sort asort = sort_construct (enumName, SRT_ENUM, NOSORTHANDLE, tagName, FALSE, NOSORTHANDLE, enumMemList); if (tagName != lsymbol_undefined) { tagid = ltoken_create (simpleId, tagName); ti = (tagInfo) dmalloc (sizeof (*ti)); ti->sort = asort; ti->kind = TAG_ENUM; ti->id = tagid; ti->imported = FALSE; (void) symtable_enterTagForce (g_symtab, ti); } } else { lclbug (message ("%q: unexpected null enum sort or empty member list", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (s)))); } enumName = lsymbol_undefined; enumMemList = NULL; tagName = lsymbol_undefined; } else if (strcmp (kstr, "enum") == 0) { if (enumName != lsymbol_undefined || enumMemList != NULL) { lclbug (message ("%q: Unexpected non-null enum sort or " "non-empty member list", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (s)))); } /* see if a tag is associated with this sort */ if (strcmp (basedstr, "nil") == 0) { llfatalerror (message ("%s: Enum missing tag. Obsolete .lcs file, " "remove and rerun lcl.", importfile)); } else { /* a tag exists */ tagName = bname; tagid = ltoken_create (simpleId, bname); enumName = sortTag_toSymbol ("Enum", tagid, &tmp); ti = symtable_tagInfo (g_symtab, bname); } } else if (strcmp (kstr, "unionMem") == 0) { smemberInfo *mem = (smemberInfo *) dmalloc (sizeof (*mem)); mem->next = unionMemList; mem->sortname = bname; mem->name = sname; mem->sort = NOSORTHANDLE; unionMemList = mem; } else if (strcmp (sostr, "unionEnd") == 0) { if (unionName != lsymbol_undefined && unionMemList != NULL) { sort asort = sort_construct (unionName, SRT_UNION, NOSORTHANDLE, tagName, FALSE, NOSORTHANDLE, unionMemList); if (tagName != lsymbol_undefined) { tagid = ltoken_create (simpleId, tagName); ti = (tagInfo) dmalloc (sizeof (*ti)); ti->sort = asort; ti->kind = TAG_UNION; ti->id = tagid; ti->imported = FALSE; (void) symtable_enterTagForce (g_symtab, ti); } } else { if (unionName == lsymbol_undefined) { lclbug (message ("%q: Imported file contains unexpected null union sort", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (s)))); } else { /* ** no members -> its a forward struct */ if (tagName != lsymbol_undefined) { tagid = ltoken_create (simpleId, tagName); (void) checkAndEnterTag (TAG_FWDUNION, tagid); } } } unionName = lsymbol_undefined; unionMemList = NULL; tagName = lsymbol_undefined; } else if (strcmp (kstr, "union") == 0) { if (unionName != lsymbol_undefined || unionMemList != NULL) { lclbug (message ("%q: Unexpected non-null union sort or non-empty " "member list", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (s)))); } /* see if a tag is associated with this sort */ if (strcmp (basedstr, "nil") == 0) { llfatalerror (message ("%s: Union missing tag. Obsolete .lcs file, " "remove and rerun lcl.", importfile)); } else { /* a tag exists */ tagName = bname; tagid = ltoken_create (simpleId, bname); unionName = sortTag_toSymbol ("Union", tagid, &tmp); ti = symtable_tagInfo (g_symtab, bname); } lsymbolList_addh (slist, unionName); } else if (strcmp (kstr, "immutable") == 0) { (void) sort_constructAbstract (sname, FALSE, NOSORTHANDLE); } else if (strcmp (kstr, "hof") == 0) { (void) sort_construct (sname, SRT_HOF, NOSORTHANDLE, lsymbol_undefined, FALSE, NOSORTHANDLE, smemberInfo_undefined); } else { sort bsort = sort_lookupName (lsymbol_translateSort (map, bname)); if (sort_isNoSort (bsort)) { lineptr = strchr (line, ' '); /* go past "sort" */ llassert (lineptr != NULL); lineptr = strchr (lineptr + 1, ' '); /* go past sostr */ llassert (lineptr != NULL); lineptr = strchr (lineptr + 1, ' '); /* go past kstr */ llassert (lineptr != NULL); col = 5 + lineptr - line; /* 5 for initial "%LCL "*/ llbug (message ("%q: Imported file contains unknown base sort: %s", fileloc_unparseRawCol (importfile, inputStream_thisLineNumber (s), col), cstring_fromChars (lsymbol_toCharsSafe (bname)))); } if (strcmp (kstr, "vec") == 0) { objName = lsymbol_fromChars (objstr); objSort = sort_lookupName (lsymbol_translateSort (map, objName)); (void) sort_construct (sname, SRT_VECTOR, bsort, lsymbol_undefined, FALSE, objSort, smemberInfo_undefined); } else { sort_loadOther (kstr, sname, bsort); } } } void sort_import (inputStream imported, ltoken tok, mapping map) { /* tok is only used for error message line number */ char *buf; cstring importfile; inputStream lclsource; sort bsort; lsymbolList slist = lsymbolList_new (); buf = inputStream_nextLine (imported); llassert (buf != NULL); importfile = inputStream_fileName (imported); if (!firstWord (buf, "%LCLSortTable")) { lclsource = LCLScanSource (); lclfatalerror (tok, message ("Expecting \"%%LCLSortTable\" line " "in import file %s:\n%s", importfile, cstring_fromChars (buf))); } for (;;) { buf = inputStream_nextLine (imported); llassert (buf != NULL); if (firstWord (buf, "%LCLSortTableEnd")) { break; } else { /* a good line, remove %LCL from line first */ if (firstWord (buf, "%LCL")) { parseSortLine (buf + 4, tok, imported, map, slist); } else { lclsource = LCLScanSource (); lclfatalerror (tok, message ("Expecting '%%LCL' prefix in import file %s:\n%s\n", importfile, cstring_fromChars (buf))); } } } /* now process the smemberInfo in the sort List */ lsymbolList_elements (slist, s) { if (s != lsymbol_undefined) { sort sor; sortNode sn; sor = sort_lookupName (s); sn = sort_quietLookup (sor); switch (sn->kind) { case SRT_ENUM: { /* update the symbol table with members of enum */ varInfo vi; smemberInfo *mlist = sn->members; for (; mlist != NULL; mlist = mlist->next) { /* check that enumeration constants are unique */ vi = symtable_varInfo (g_symtab, mlist->name); if (!varInfo_exists (vi)) { /* put info into symbol table */ vi = (varInfo) dmalloc (sizeof (*vi)); vi->id = ltoken_create (NOTTOKEN, mlist->name); vi->kind = VRK_ENUM; vi->sort = sor; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); } else { lclplainerror (message ("%s: enum member %s of %s has already been declared", importfile, lsymbol_toString (mlist->name), lsymbol_toString (sn->name))); } } /*@switchbreak@*/ break; } case SRT_STRUCT: case SRT_UNION: { smemberInfo *mlist = sn->members; for (; mlist != NULL; mlist = mlist->next) { bsort = sort_lookupName (lsymbol_translateSort (map, mlist->sortname)); if (sort_isNoSort (bsort)) { lclbug (message ("%s: member %s of %s has unknown sort\n", importfile, cstring_fromChars (lsymbol_toChars (mlist->name)), cstring_fromChars (lsymbol_toChars (sn->name)))); } else { mlist->sort = bsort; } } /*@switchbreak@*/ break; } default: lclbug (message ("%s: %s has unexpected sort kind %s", importfile, cstring_fromChars (lsymbol_toChars (sn->name)), sort_unparseKind (sn->kind))); } } } end_lsymbolList_elements; /* list and sorts in it are not used anymore */ lsymbolList_free (slist); } bool sort_equal (sort s1, sort s2) { sort syn1, syn2; if (s1 == s2) return TRUE; /* handle synonym sorts */ syn1 = sort_getUnderlying (s1); syn2 = sort_getUnderlying (s2); if (syn1 == syn2) return TRUE; /* makes bool and Bool equal */ return FALSE; } bool sort_compatible (sort s1, sort s2) { sort syn1, syn2; /* later: might consider "char" and enum types the same as "int" */ if (s1 == s2) return TRUE; /* handle synonym sorts */ syn1 = sort_getUnderlying (s1); syn2 = sort_getUnderlying (s2); if (syn1 == syn2) return TRUE; /* makes bool and Bool equal */ return FALSE; } bool sort_compatible_modulo_cstring (sort s1, sort s2) { /* like sort_compatible but also handles special cstring inits, allows the following 2 cases: char c[] = "abc"; (LHS: char_Obj_Arr, RHS = char_Vec) (c as implicitly coerced into c^) char *d = "abc"; (LHS: char_Obj_Ptr, RHS = char_Vec) (d as implicitly coerced into d[]^) */ sort syn1, syn2; if (sort_compatible (s1, s2)) return TRUE; syn1 = sort_getUnderlying (s1); syn2 = sort_getUnderlying (s2); if (g_sortCstring == syn2 && (syn1 == char_obj_ptrSort || syn1 == char_obj_ArrSort)) return TRUE; return FALSE; } lsymbol sort_getLsymbol (sort sor) { sortNode sn = sort_quietLookup (sor); return sn->name; } /* a few handy routines for debugging */ char *sort_getName (sort s) { return (lsymbol_toCharsSafe (sort_getLsymbol (s))); } /*@exposed@*/ cstring sort_unparseName (sort s) { return (cstring_fromChars (sort_getName (s))); } static void sortError (ltoken t, sort oldsort, sortNode newnode) { sortNode old = sort_quietLookup (oldsort); if ((old->kind <= SRT_FIRST || old->kind >= SRT_LAST) || (newnode->kind <= SRT_FIRST || newnode->kind >= SRT_LAST)) { llbuglit ("sortError: illegal sort kind"); } llassert (sortTable != NULL); lclerror (t, message ("Sort %s defined as %s cannot be redefined as %s", cstring_fromChars (lsymbol_toChars (newnode->name)), sort_unparseKindName (sortTable[oldsort]), sort_unparseKindName (newnode))); } static /*@observer@*/ cstring sort_unparseKindName (sortNode s) { switch (s->kind) { case SRT_NONE: return cstring_fromChars (sortKindName[(int)s->kind]); default: if (s->abstract) { if (s->mutable) { return cstring_makeLiteralTemp ("MUTABLE"); } else { return cstring_makeLiteralTemp ("IMMUTABLE"); } } else return cstring_fromChars (sortKindName[(int)s->kind]); } BADEXIT; } sort sort_fromLsymbol (lsymbol sortid) { /* like sort_lookupName but creates sort if not already present */ sort sort = sort_lookupName (sortid); if (sort == NOSORTHANDLE) sort = sort_makeSort (ltoken_undefined, sortid); return sort; } bool sort_isHOFSortKind (sort s) { sortNode sn = sort_quietLookup (s); if (sn->kind == SRT_HOF) return TRUE; return FALSE; } /* ** returns TRUE iff s has State operators (', ~, ^) */ static bool sort_hasStateFcns (sort s) { sortNode sn = sort_quietLookup (s); sortKind kind = sn->kind; if (kind == SRT_SYN) { return (sort_hasStateFcns (sn->baseSort)); } return ((kind == SRT_PTR) || (kind == SRT_OBJ) || (kind == SRT_ARRAY) || (kind == SRT_STRUCT) || (kind == SRT_UNION)); } splint-3.1.2.dfsg1/src/symtable.c0000644021234200000250000013747007646432516014247 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** symtable.c ** ** Symbol table abstraction ** ** AUTHORS: ** ** Gary Feldman, Technical Languages and Environments, DECspec project ** Steve Garland, ** Massachusetts Institute of Technology ** Joe Wild, Technical Languages and Environments, DECspec project ** Yang Meng Tan, ** Massachusetts Institute of Technology ** ** CREATION DATE: ** ** 20 January 1991 */ # include "splintMacros.nf" # include "basic.h" # include "gram.h" # include "lclscan.h" # include "lclsyntable.h" # include "lslparse.h" /*@+ignorequals@*/ static bool isBlankLine (char *p_line); static bool inImport = FALSE; /*@constant static int MAXBUFFLEN;@*/ # define MAXBUFFLEN 512 /*@constant static int DELTA;@*/ # define DELTA 100 static void symHashTable_dump (symHashTable * p_t, FILE * p_f, bool p_lco); static void tagInfo_free (/*@only@*/ tagInfo p_tag); static /*@observer@*/ scopeInfo symtable_scopeInfo (symtable p_stable); static void symtable_dumpId (symtable p_stable, FILE *p_f, bool p_lco); static lsymbol nameNode2key (nameNode p_n); typedef enum { SYMK_FCN, SYMK_SCOPE, SYMK_TYPE, SYMK_VAR } symKind; typedef struct { symKind kind; union { /*@only@*/ fctInfo fct; /*@only@*/ scopeInfo scope; /*@only@*/ typeInfo type; /*@only@*/ varInfo var; } info; } idTableEntry; typedef struct { unsigned int size; unsigned int allocated; /*@relnull@*/ idTableEntry *entries; bool exporting; } idTable; struct s_symtableStruct { idTable *idTable; /* data is idTableEntry */ symHashTable *hTable; /* data is htData */ mapping type2sort; /* maps LCL type symbol to LSL sort */ } ; static /*@observer@*/ ltoken idTableEntry_getId (idTableEntry *p_x); static /*@out@*/ /*@exposed@*/ idTableEntry *nextFree (idTable * p_st); static /*@dependent@*/ /*@null@*/ idTableEntry *symtable_lookup (idTable * p_st, lsymbol p_id); static /*@dependent@*/ /*@null@*/ idTableEntry *symtable_lookupInScope (idTable * p_st, lsymbol p_id); static /*@only@*/ idTable *symtable_newIdTable (void); static void idTableEntry_free (idTableEntry p_x); /* Local implementatio of hash table */ static bool allowed_redeclaration = FALSE; static symbolKey htData_key (htData *p_x); static void symHashTable_free (/*@only@*/ symHashTable *p_h); static /*@only@*/ symHashTable *symHashTable_create (unsigned int p_size); static /*@null@*/ /*@exposed@*/ htData * symHashTable_get (symHashTable * p_t, symbolKey p_key, infoKind p_kind, /*@null@*/ nameNode p_n); static bool symHashTable_put (symHashTable *p_t, /*@only@*/ htData *p_data); static /*@only@*/ /*@exposed@*/ /*@null@*/ htData * symHashTable_forcePut (symHashTable * p_t, /*@only@*/ htData *p_data); /* static unsigned int symHashTable_count (symHashTable * t); */ static void idTable_free (/*@only@*/ idTable *p_st); void varInfo_free (/*@only@*/ varInfo v) { ltoken_free (v->id); sfree (v); } static /*@only@*/ varInfo varInfo_copy (varInfo v) { varInfo ret = (varInfo) dmalloc (sizeof (*ret)); ret->id = ltoken_copy (v->id); ret->sort = v->sort; ret->kind = v->kind; ret->export = v->export; return ret; } void symtable_free (symtable stable) { /* symtable_printStats (stable); */ idTable_free (stable->idTable); symHashTable_free (stable->hTable); mapping_free (stable->type2sort); sfree (stable); } static void idTable_free (idTable *st) { unsigned int i; for (i = 0; i < st->size; i++) { idTableEntry_free (st->entries[i]); } sfree (st->entries); sfree (st); } static void fctInfo_free (/*@only@*/ fctInfo f) { signNode_free (f->signature); pairNodeList_free (f->globals); ltoken_free (f->id); sfree (f); } static void typeInfo_free (/*@only@*/ typeInfo t) { ltoken_free (t->id); sfree (t); } static void scopeInfo_free (/*@only@*/ scopeInfo s) { sfree (s); } static void idTableEntry_free (idTableEntry x) { switch (x.kind) { case SYMK_FCN: fctInfo_free (x.info.fct); break; case SYMK_SCOPE: scopeInfo_free (x.info.scope); break; case SYMK_TYPE: typeInfo_free (x.info.type); break; case SYMK_VAR: varInfo_free (x.info.var); break; } } static /*@observer@*/ ltoken idTableEntry_getId (idTableEntry *x) { switch (x->kind) { case SYMK_FCN: return (x->info.fct->id); case SYMK_SCOPE: return ltoken_undefined; case SYMK_TYPE: return (x->info.type->id); case SYMK_VAR: return (x->info.var->id); } BADBRANCHRET (ltoken_undefined); } /*@only@*/ symtable symtable_new (void) { symtable stable = (symtable) dmalloc (sizeof (*stable)); idTableEntry *e; stable->idTable = symtable_newIdTable (); stable->hTable = symHashTable_create (HT_MAXINDEX); stable->type2sort = mapping_create (); /* add builtin synonym: Bool -> bool */ mapping_bind (stable->type2sort, lsymbol_getBool (), lsymbol_getbool ()); /* ** done by symtable_newIdTable ** st->allocated = 0; ** st->entries = (idTableEntry *) 0; ** st->exporting = TRUE; */ /* this is global scope */ e = nextFree (stable->idTable); e->kind = SYMK_SCOPE; (e->info).scope = (scopeInfo) dmalloc (sizeof (*((e->info).scope))); (e->info).scope->kind = SPE_GLOBAL; return stable; } static /*@only@*/ idTable *symtable_newIdTable (void) { idTable *st = (idTable *) dmalloc (sizeof (*st)); st->size = 0; st->allocated = 0; st->entries = (idTableEntry *) 0; st->exporting = TRUE; /* this was being done twice! e = nextFree (st); e->kind = SYMK_SCOPE; (e->info).scope.kind = globScope; */ return st; } static lsymbol nameNode2key (nameNode n) { unsigned int ret; if (n->isOpId) { ret = ltoken_getText (n->content.opid); } else { /* use opForm's key as its Identifier */ llassert (n->content.opform != NULL); ret = (n->content.opform)->key; } return ret; } /* ** requires: nameNode n is already in st. */ static bool htData_insertSignature (htData *d, /*@owned@*/ sigNode oi) { sigNodeSet set = d->content.op->signatures; if (oi != (sigNode) 0) { return (sigNodeSet_insert (set, oi)); } return FALSE; } void symtable_enterOp (symtable st, /*@only@*/ /*@notnull@*/ nameNode n, /*@owned@*/ sigNode oi) { /* ** Operators are overloaded, we allow entering opInfo more than once, ** even if it's the same signature. ** ** Assumes all sorts are already entered into the symbol table */ symHashTable *ht = st->hTable; htData *d; lsymbol id; id = nameNode2key (n); d = symHashTable_get (ht, id, IK_OP, n); if (d == (htData *) 0) { /* first signature of this operator */ opInfo op = (opInfo) dmalloc (sizeof (*op)); htData *nd = (htData *) dmalloc (sizeof (*nd)); op->name = n; if (oi != (sigNode) 0) { op->signatures = sigNodeSet_singleton (oi); ht->count++; } else { op->signatures = sigNodeSet_new (); sigNode_markOwned (oi); } nd->kind = IK_OP; nd->content.op = op; (void) symHashTable_put (ht, nd); } else { nameNode_free (n); /*<<count++; } } } bool symtable_enterTag (symtable st, tagInfo ti) { /* put ti only if it is not already in symtable */ symHashTable *ht = st->hTable; htData *d; symbolKey key = ltoken_getText (ti->id); d = symHashTable_get (ht, key, IK_TAG, (nameNode) 0); if (d == (htData *) 0) { d = (htData *) dmalloc (sizeof (*d)); d->kind = IK_TAG; d->content.tag = ti; d->content.tag->imported = context_inImport (); (void) symHashTable_put (ht, d); return TRUE; } else { if (d->content.tag->imported) { d->content.tag = ti; d->content.tag->imported = context_inImport (); return TRUE; } else { tagInfo_free (ti); return FALSE; } } } bool symtable_enterTagForce (symtable st, tagInfo ti) { /* put ti, force-put if necessary */ symHashTable *ht = st->hTable; htData *d; symbolKey key = ltoken_getText (ti->id); d = symHashTable_get (ht, key, IK_TAG, (nameNode) 0); if (d == (htData *) 0) { d = (htData *) dmalloc (sizeof (*d)); d->kind = IK_TAG; d->content.tag = ti; d->content.tag->imported = context_inImport (); (void) symHashTable_put (ht, d); return TRUE; } else { d->kind = IK_TAG; d->content.tag = ti; d->content.tag->imported = context_inImport (); /* interpret return data later, htData * */ /*@i@*/ (void) symHashTable_forcePut (ht, d); return FALSE; } } /*@null@*/ opInfo symtable_opInfo (symtable st, /*@notnull@*/ nameNode n) { symHashTable *ht = st->hTable; lsymbol i = nameNode2key (n); htData *d; d = symHashTable_get (ht, i, IK_OP, n); if (d == (htData *) 0) { return (opInfo)NULL; } return (d->content.op); } /*@null@*/ tagInfo symtable_tagInfo (symtable st, lsymbol i) { symHashTable *ht = st->hTable; htData *d; d = symHashTable_get (ht, i, IK_TAG, 0); if (d == (htData *) 0) { return (tagInfo) NULL; } return (d->content.tag); } void symtable_enterScope (symtable stable, scopeInfo si) { idTable *st = stable->idTable; idTableEntry *e = nextFree (st); if (si->kind == SPE_GLOBAL) llbuglit ("symtable_enterScope: SPE_GLOBAL"); e->kind = SYMK_SCOPE; (e->info).scope = si; } void symtable_exitScope (symtable stable) { idTable *st = stable->idTable; int n; if (st->entries != NULL) { for (n = st->size - 1; (st->entries[n]).kind != SYMK_SCOPE; n--) { ; } } else { llcontbuglit ("symtable_exitScope: no scope to exit"); n = 0; } st->size = n; } bool symtable_enterFct (symtable stable, fctInfo fi) { idTable *st = stable->idTable; idTableEntry *e; bool redecl = FALSE; if (!allowed_redeclaration && symtable_lookup (st, ltoken_getText (fi->id)) != (idTableEntry *) 0) { lclRedeclarationError (fi->id); redecl = TRUE; } e = nextFree (st); e->kind = SYMK_FCN; fi->export = st->exporting; /* && !fi->private; */ (e->info).fct = fi; return redecl; } void symtable_enterType (symtable stable, /*@only@*/ typeInfo ti) { idTable *st = stable->idTable; idTableEntry *e; bool insertp = TRUE; scopeKind k = (symtable_scopeInfo (stable))->kind; /* symtable_disp (stable); */ if (k != SPE_GLOBAL && k != SPE_INVALID) /* fixed for Splint */ { llbug (message ("%q: symtable_enterType: expect global scope. (type: %s)", ltoken_unparseLoc (ti->id), ltoken_getRawString (ti->id))); } if (!allowed_redeclaration && symtable_lookup (st, ltoken_getText (ti->id)) != (idTableEntry *) 0) { /* ignore if Bool is re-entered */ if (ltoken_getText (ti->id) == lsymbol_getBool () || ltoken_getText (ti->id) == lsymbol_getbool ()) { insertp = FALSE; } else { lclRedeclarationError (ti->id); } } if (insertp) { /* make sure it is a type TYPEDEF_NAME; */ if (ltoken_getCode (ti->id) != LLT_TYPEDEF_NAME) { lclbug (message ("symtable_enterType: gets a simpleId, expect a type: %s", ltoken_getRawString (ti->id))); } e = nextFree (st); e->kind = SYMK_TYPE; ti->export = st->exporting;/* && !ti->private; */ (e->info).type = ti; mapping_bind (stable->type2sort, ltoken_getText (ti->id), sort_getLsymbol (sort_makeVal (sort_getUnderlying (ti->basedOn)))); } else { typeInfo_free (ti); } } lsymbol lsymbol_sortFromType (symtable s, lsymbol typename) { lsymbol inter; lsymbol out; ltoken tok; /* check the synonym table first */ if (LCLIsSyn (typename)) { tok = LCLGetTokenForSyn (typename); inter = ltoken_getText (tok); /* printf ("In lsymbol_sortFromType: %s -> %s\n", lsymbol_toChars (typename), lsymbol_toChars (inter)); */ } else { inter = typename; } /* now map LCL type to sort */ out = mapping_find (s->type2sort, inter); if (out == lsymbol_undefined) { return inter; } return out; } /* really temp! */ /* ** returns true is vi is a redeclaration */ bool symtable_enterVar (symtable stable, /*@temp@*/ varInfo vi) { idTable *st = stable->idTable; bool insertp = TRUE; bool redecl = FALSE; /* symtable_disp (symtab); */ if (!allowed_redeclaration && (symtable_lookupInScope (st, ltoken_getText (vi->id)) != (idTableEntry *) 0)) { if (ltoken_getText (vi->id) == lsymbol_getTRUE () || ltoken_getText (vi->id) == lsymbol_getFALSE ()) { insertp = FALSE; } else { if (usymtab_existsEither (ltoken_getRawString (vi->id))) { lclRedeclarationError (vi->id); redecl = TRUE; } else { llbuglit ("redeclared somethingerother?!"); } } } if (insertp) { idTableEntry *e = nextFree (st); e->kind = SYMK_VAR; vi->export = st->exporting && /* !vi.private && */ (vi->kind == VRK_VAR || vi->kind == VRK_CONST || vi->kind == VRK_ENUM); (e->info).var = varInfo_copy (vi); } return (redecl); } bool symtable_exists (symtable stable, lsymbol i) { idTable *st = stable->idTable; return symtable_lookup (st, i) != (idTableEntry *) 0; } /*@null@*/ typeInfo symtable_typeInfo (symtable stable, lsymbol i) { idTable *st; idTableEntry *e; st = stable->idTable; e = symtable_lookup (st, i); if (e == (idTableEntry *) 0 || e->kind != SYMK_TYPE) { return (typeInfo) NULL; } return (e->info).type; } /*@null@*/ varInfo symtable_varInfo (symtable stable, lsymbol i) { idTable *st = stable->idTable; idTableEntry *e; e = symtable_lookup (st, i); if (e == (idTableEntry *) 0 || e->kind != SYMK_VAR) { return (varInfo) NULL; } return (e->info).var; } /*@null@*/ varInfo symtable_varInfoInScope (symtable stable, lsymbol id) { /* if current scope is a SPE_QUANT, can go beyond current scope */ idTable *st = stable->idTable; idTableEntry *e2 = (idTableEntry *) 0; int n; for (n = st->size - 1; n >= 0; n--) { ltoken tok; e2 = &(st->entries[n]); if (e2->kind == SYMK_SCOPE && e2->info.scope->kind != SPE_QUANT) { return (varInfo) NULL; } tok = idTableEntry_getId (e2); if (e2->kind == SYMK_VAR && ltoken_getText (tok) == id) { return (e2->info).var; } } return (varInfo) NULL; } scopeInfo symtable_scopeInfo (symtable stable) { idTable *st = stable->idTable; int n; idTableEntry *e; for (n = st->size - 1; n >= 0; n--) { e = &(st->entries[n]); if (e->kind == SYMK_SCOPE) return (e->info).scope; } lclfatalbug ("symtable_scopeInfo: not found"); BADEXIT; } void symtable_export (symtable stable, bool yesNo) { idTable *st = stable->idTable; st->exporting = yesNo; (void) sort_setExporting (yesNo); } static void symHashTable_dump (symHashTable * t, FILE * f, bool lco) { /* like symHashTable_dump2 but for output to .lcs file */ int i, size; bucket *b; htEntry *entry; htData *d; ltoken tok; sigNodeSet sigs; for (i = 0; i <= HT_MAXINDEX; i++) { b = t->buckets[i]; for (entry = b; entry != NULL; entry = entry->next) { d = entry->data; switch (d->kind) { case IK_SORT: /*@switchbreak@*/ break; case IK_OP: { char *name = cstring_toCharsSafe (nameNode_unparse (d->content.op->name)); sigs = d->content.op->signatures; size = sigNodeSet_size (sigs); sigNodeSet_elements (sigs, x) { cstring s = sigNode_unparse (x); if (lco) { fprintf (f, "%%LCL"); } fprintf (f, "op %s %s\n", name, cstring_toCharsSafe (s)); cstring_free (s); } end_sigNodeSet_elements; sfree (name); /*@switchbreak@*/ break; } case IK_TAG: tok = d->content.tag->id; if (!ltoken_isUndefined (tok)) { cstring s = tagKind_unparse (d->content.tag->kind); if (lco) { fprintf (f, "%%LCL"); } fprintf (f, "tag %s %s\n", ltoken_getTextChars (tok), cstring_toCharsSafe (s)); cstring_free (s); } /*@switchbreak@*/ break; } } } } void symtable_dump (symtable stable, FILE * f, bool lco) { symHashTable *ht = stable->hTable; fprintf (f, "%s\n", BEGINSYMTABLE); symHashTable_dump (ht, f, lco); symtable_dumpId (stable, f, lco); fprintf (f, "%s\n", SYMTABLEEND); } lsymbol lsymbol_translateSort (mapping m, lsymbol s) { lsymbol res = mapping_find (m, s); if (res == lsymbol_undefined) return s; return res; } static /*@null@*/ lslOp lslOp_renameSorts (mapping map,/*@returned@*/ /*@null@*/ lslOp op) { sigNode sign; if (op != (lslOp) 0) { ltokenList domain; ltoken range; sign = op->signature; range = sign->range; domain = sign->domain; ltokenList_elements (domain, dt) { ltoken_setText (dt, lsymbol_translateSort (map, ltoken_getText (dt))); } end_ltokenList_elements; /*@-onlytrans@*/ /* A memory leak... */ op->signature = makesigNode (sign->tok, domain, range); /*@=onlytrans@*/ } return op; } static /*@null@*/ signNode signNode_fromsigNode (sigNode s) { signNode sign; sortList slist; if (s == (sigNode) 0) { return (signNode) 0; } sign = (signNode) dmalloc (sizeof (*sign)); slist = sortList_new (); sign->tok = ltoken_copy (s->tok); sign->key = s->key; sign->range = sort_makeSort (ltoken_undefined, ltoken_getText (s->range)); ltokenList_elements (s->domain, dt) { sortList_addh (slist, sort_makeSort (ltoken_undefined, ltoken_getText (dt))); } end_ltokenList_elements; sign->domain = slist; return sign; } /** 2.4.3 ymtan 93.09.23 -- fixed bug in parseGlobals: removed ";" at the ** end of pairNode (gstr). */ static /*@only@*/ pairNodeList parseGlobals (char *line, inputStream srce) { pairNodeList plist = pairNodeList_new (); pairNode p; int semi_index; char *lineptr, sostr[MAXBUFFLEN], gstr[MAXBUFFLEN]; /* line is not all blank */ /* expected format: "sort1 g1; sort2 g2; sort3 g3;" */ lineptr = line; while (!isBlankLine (lineptr)) { if (sscanf (lineptr, "%s %s", &(sostr[0]), gstr) != 2) { lclplainerror (message ("%q: Imported file contains illegal function global declaration.\n" "Skipping rest of the line: %s (%s)", fileloc_unparseRaw (inputStream_fileName (srce), inputStream_thisLineNumber (srce)), cstring_fromChars (line), cstring_fromChars (lineptr))); return plist; } p = (pairNode) dmalloc (sizeof (*p)); /* Note: remove the ";" separator at the end of gstr */ semi_index = size_toInt (strlen (gstr)); gstr[semi_index - 1] = '\0'; p->tok = ltoken_create (NOTTOKEN, lsymbol_fromChars (gstr)); p->sort = sort_makeSort (ltoken_undefined, lsymbol_fromChars (sostr)); pairNodeList_addh (plist, p); lineptr = strchr (lineptr, ';'); /* go pass the next; */ llassert (lineptr != NULL); lineptr = lineptr + 1; } return plist; } static bool isBlankLine (char *line) { int i; if (line == NULL) return TRUE; for (i = 0; line[i] != '\0'; i++) { if (line[i] == ' ') continue; if (line[i] == '\t') continue; if (line[i] == '\n') return TRUE; return FALSE; } return TRUE; } typedef /*@only@*/ fctInfo o_fctInfo; static void parseLine (char *line, inputStream srce, mapping map) { static /*@owned@*/ o_fctInfo *savedFcn = NULL; char *lineptr, *lineptr2; cstring importfile = inputStream_fileName (srce); char namestr[MAXBUFFLEN], kstr[20], sostr[MAXBUFFLEN]; sort bsort, nullSort = sort_makeNoSort (); int col = 0; fileloc imploc = fileloc_undefined; if (inImport) { imploc = fileloc_createImport (importfile, inputStream_thisLineNumber (srce)); } if (firstWord (line, "op")) { lslOp op; lineptr = strchr (line, 'o'); /* remove any leading blanks */ llassert (lineptr != NULL); lineptr = strchr (lineptr, ' '); /* go past "op" */ llassert (lineptr != NULL); /* add a newline to the end of the line since parseOpLine expects it */ lineptr2 = strchr (lineptr, '\0'); if (lineptr2 != 0) { *lineptr2 = '\n'; *(lineptr2 + 1) = '\0'; } llassert (cstring_isDefined (importfile)); op = parseOpLine (importfile, cstring_fromChars (lineptr + 1)); if (op == (lslOp) 0) { lclplainerror (message ("%q: Imported file contains illegal operator declaration:\n " "skipping this line: %s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); fileloc_free (imploc); return; } op = lslOp_renameSorts (map, op); llassert (op != NULL); llassert (op->name != NULL); symtable_enterOp (g_symtab, op->name, sigNode_copy (op->signature)); /*@-mustfree@*/ } /*@=mustfree@*/ else if (firstWord (line, "type")) { typeInfo ti; if (sscanf (line, "type %s %s %s", namestr, sostr, kstr) != 3) { lclplainerror (message ("%q: illegal type declaration:\n skipping this line: %s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); fileloc_free (imploc); return; } ti = (typeInfo) dmalloc (sizeof (*ti)); ti->id = ltoken_createFull (LLT_TYPEDEF_NAME, lsymbol_fromChars (namestr), importfile, inputStream_thisLineNumber (srce), col); bsort = sort_lookupName (lsymbol_translateSort (map, lsymbol_fromChars (sostr))); if (sort_isNoSort (bsort)) { lineptr = strchr (line, ' '); /* go past "type" */ llassert (lineptr != NULL); lineptr = strchr (lineptr + 1, ' '); /* go past namestr */ llassert (lineptr != NULL); col = 5 + ((int) (lineptr - line)); /* 5 for initial "%LCL "*/ lclbug (message ("%q: Imported files contains unknown base sort", fileloc_unparseRawCol (importfile, inputStream_thisLineNumber (srce), col))); bsort = nullSort; } ti->basedOn = bsort; if (strcmp (kstr, "exposed") == 0) { ti->abstract = FALSE; ti->modifiable = TRUE; } else { ti->abstract = TRUE; if (strcmp (kstr, "mutable") == 0) ti->modifiable = TRUE; else ti->modifiable = FALSE; } ti->export = TRUE; /* ** sort of a hack to get imports to work... */ if (inImport) { cstring cnamestr = cstring_fromChars (namestr); if (!usymtab_existsGlobEither (cnamestr)) { (void) usymtab_addEntry (uentry_makeDatatype (cnamestr, ctype_unknown, ti->abstract ? ynm_fromBool (ti->modifiable) : MAYBE, ti->abstract ? qual_createAbstract () : qual_createConcrete (), fileloc_copy (imploc))); } } symtable_enterType (g_symtab, ti); } else if (firstWord (line, "var")) { varInfo vi; if (sscanf (line, "var %s %s", namestr, sostr) != 2) { lclplainerror (message ("%q: Imported file contains illegal variable declaration. " "Skipping this line.", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)))); fileloc_free (imploc); return; } vi = (varInfo) dmalloc (sizeof (*vi)); bsort = sort_lookupName (lsymbol_translateSort (map, lsymbol_fromChars (sostr))); lineptr = strchr (line, ' '); /* go past "var" */ llassert (lineptr != NULL); lineptr = strchr (lineptr + 1, ' '); /* go past namestr */ llassert (lineptr != NULL); col = 5 + ((int) (lineptr - line)); /* 5 for initial "%LCL "*/ if (sort_isNoSort (bsort)) { lclplainerror (message ("%q: Imported file contains unknown base sort", fileloc_unparseRawCol (importfile, inputStream_thisLineNumber (srce), col))); bsort = nullSort; } vi->id = ltoken_createFull (simpleId, lsymbol_fromChars (namestr), importfile, inputStream_thisLineNumber (srce), col); vi->sort = bsort; vi->kind = VRK_VAR; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); if (inImport) { cstring cnamestr = cstring_fromChars (namestr); if (!usymtab_existsGlobEither (cnamestr)) { (void) usymtab_supEntrySref (uentry_makeVariable (cnamestr, ctype_unknown, fileloc_copy (imploc), FALSE)); } } } else if (firstWord (line, "const")) { varInfo vi; if (sscanf (line, "const %s %s", namestr, sostr) != 2) { lclbug (message ("%q: Imported file contains illegal constant declaration: %s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); fileloc_free (imploc); return; } vi = (varInfo) dmalloc (sizeof (*vi)); bsort = sort_lookupName (lsymbol_translateSort (map, lsymbol_fromChars (sostr))); lineptr = strchr (line, ' '); /* go past "var" */ llassert (lineptr != NULL); lineptr = strchr (lineptr + 1, ' '); /* go past namestr */ llassert (lineptr != NULL); col = 5 + ((int) (lineptr - line)); /* 5 for initial "%LCL "*/ if (sort_isNoSort (bsort)) { lclplainerror (message ("%q: Imported file contains unknown base sort", fileloc_unparseRawCol (importfile, inputStream_thisLineNumber (srce), col))); bsort = nullSort; } vi->id = ltoken_createFull (simpleId, lsymbol_fromChars (namestr), importfile, inputStream_thisLineNumber (srce), col); vi->sort = bsort; vi->kind = VRK_CONST; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); if (inImport) { cstring cnamestr = cstring_fromChars (namestr); if (!usymtab_existsGlobEither (cnamestr)) { (void) usymtab_addEntry (uentry_makeConstant (cnamestr, ctype_unknown, fileloc_copy (imploc))); } } /* must check for "fcnGlobals" before "fcn" */ } else if (firstWord (line, "fcnGlobals")) { pairNodeList globals; lineptr = strchr (line, 'f'); /* remove any leading blanks */ llassert (lineptr != NULL); lineptr = strchr (lineptr, ' '); /* go past "fcnGlobals" */ llassert (lineptr != NULL); /* a quick check for empty fcnGlobals */ if (!isBlankLine (lineptr)) { globals = parseGlobals (lineptr, srce); /* should ensure that each global in an imported function corresponds to some existing global. Since only "correctly processed" .lcs files are imported, this is true as an invariant. */ } else { globals = pairNodeList_new (); } /* check that they exist, store them on fctInfo */ if (savedFcn != NULL) { pairNodeList_free ((*savedFcn)->globals); (*savedFcn)->globals = globals; /* evs, moved inside if predicate */ (void) symtable_enterFct (g_symtab, *savedFcn); savedFcn = NULL; } else { lclplainerror (message ("%q: Unexpected function globals. " "Skipping this line: \n%s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); savedFcn = NULL; pairNodeList_free (globals); } } else if (firstWord (line, "fcn")) { lslOp op; lslOp op2; if (savedFcn != (fctInfo *) 0) { lclplainerror (message ("%q: illegal function declaration. Skipping this line:\n%s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); fileloc_free (imploc); return; } savedFcn = (fctInfo *) dmalloc (sizeof (*savedFcn)); lineptr = strchr (line, 'f'); /* remove any leading blanks */ llassert (lineptr != NULL); lineptr = strchr (lineptr, ' '); /* go past "fcn" */ llassert (lineptr != NULL); /* add a newline to the end of the line since parseOpLine expects it */ lineptr2 = strchr (lineptr, '\0'); if (lineptr2 != 0) { *lineptr2 = '\n'; *(lineptr2 + 1) = '\0'; } op = parseOpLine (importfile, cstring_fromChars (lineptr + 1)); if (op == (lslOp) 0) { lclplainerror (message ("%q: illegal function declaration: %s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); fileloc_free (imploc); return; } op2 = lslOp_renameSorts (map, op); llassert (op2 != NULL); if ((op->name != NULL) && op->name->isOpId) { (*savedFcn) = (fctInfo) dmalloc (sizeof (**savedFcn)); (*savedFcn)->id = op->name->content.opid; (*savedFcn)->signature = signNode_fromsigNode (op2->signature); (*savedFcn)->globals = pairNodeList_new (); (*savedFcn)->export = TRUE; if (inImport) { /* 27 Jan 1995 --- added this to be undefined namestr bug */ cstring fname = ltoken_unparse ((*savedFcn)->id); if (!usymtab_existsGlobEither (fname)) { (void) usymtab_addEntry (uentry_makeFunction (fname, ctype_unknown, typeId_invalid, globSet_new (), sRefSet_undefined, warnClause_undefined, fileloc_copy (imploc))); } } } else { /* evans 2001-05-27: detected by splint after fixing external alias bug. */ if (op->name != NULL) { ltoken_free (op->name->content.opid); } lclplainerror (message ("%q: unexpected function name: %s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); } } else if (firstWord (line, "enumConst")) { varInfo vi; if (sscanf (line, "enumConst %s %s", namestr, sostr) != 2) { lclplainerror (message ("%q: Illegal enum constant declaration. " "Skipping this line:\n%s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); fileloc_free (imploc); return; } vi = (varInfo) dmalloc (sizeof (*vi)); bsort = sort_lookupName (lsymbol_translateSort (map, lsymbol_fromChars (sostr))); lineptr = strchr (line, ' '); /* go past "var" */ llassert (lineptr != NULL); lineptr = strchr (lineptr + 1, ' '); /* go past namestr */ llassert (lineptr != NULL); col = 5 + ((int) (lineptr - line)); /* 5 for initial "%LCL "*/ if (sort_isNoSort (bsort)) { lclplainerror (message ("%q: unknown base sort\n", fileloc_unparseRawCol (importfile, inputStream_thisLineNumber (srce), col))); bsort = nullSort; } vi->id = ltoken_createFull (simpleId, lsymbol_fromChars (namestr), importfile, inputStream_thisLineNumber (srce), col); vi->sort = bsort; vi->kind = VRK_ENUM; vi->export = TRUE; (void) symtable_enterVar (g_symtab, vi); varInfo_free (vi); if (inImport) { cstring cnamestr = cstring_fromChars (namestr); if (!usymtab_existsEither (cnamestr)) { (void) usymtab_addEntry (uentry_makeConstant (cnamestr, ctype_unknown, fileloc_copy (imploc))); } } } else if (firstWord (line, "tag")) { /* do nothing, sort processing already handles this */ } else { lclplainerror (message ("%q: Unknown symbol declaration. Skipping this line:\n%s", fileloc_unparseRaw (importfile, inputStream_thisLineNumber (srce)), cstring_fromChars (line))); } fileloc_free (imploc); } void symtable_import (inputStream imported, ltoken tok, mapping map) { char *buf; cstring importfile; inputStream lclsource; int old_lsldebug; bool old_inImport = inImport; buf = inputStream_nextLine (imported); importfile = inputStream_fileName (imported); llassert (buf != NULL); if (!firstWord (buf, "%LCLSymbolTable")) { lclsource = LCLScanSource (); lclfatalerror (tok, message ("Expecting '%%LCLSymbolTable' line in import file %s:\n%s\n", importfile, cstring_fromChars (buf))); } old_lsldebug = lsldebug; lsldebug = 0; allowed_redeclaration = TRUE; inImport = TRUE; for (;;) { buf = inputStream_nextLine (imported); llassert (buf != NULL); if (firstWord (buf, "%LCLSymbolTableEnd")) { break; } else { /* a good line, remove %LCL from line first */ if (firstWord (buf, "%LCL")) { parseLine (buf + 4, imported, map); } else { lclsource = LCLScanSource (); lclfatalerror (tok, message ("Expecting '%%LCL' prefix in import file %s:\n%s\n", importfile, cstring_fromChars (buf))); } } } /* restore old value */ inImport = old_inImport; lsldebug = old_lsldebug; allowed_redeclaration = FALSE; } static void symtable_dumpId (symtable stable, FILE *f, bool lco) { idTable *st = stable->idTable; unsigned int i; idTableEntry *se; fctInfo fi; typeInfo ti; varInfo vi; for (i = 1; i < st->size; i++) { /* 2/22/93 I think there is a off-by-1 error, 0 entry is never used */ se = st->entries + i; llassert (se != NULL); /*@-loopswitchbreak@*/ switch (se->kind) { case SYMK_FCN: { cstring tmp; fi = (se->info).fct; if (lco) { fprintf (f, "%%LCL"); } if (!lco && !fi->export) { fprintf (f, "spec "); } tmp = signNode_unparse (fi->signature); fprintf (f, "fcn %s %s \n", ltoken_getTextChars (fi->id), cstring_toCharsSafe (tmp)); cstring_free (tmp); tmp = pairNodeList_unparse (fi->globals); fprintf (f, "%%LCLfcnGlobals %s\n", cstring_toCharsSafe (tmp)); cstring_free (tmp); break; } case SYMK_SCOPE: if (lco) { break; } /*@-switchswitchbreak@*/ switch ((se->info).scope->kind) { case SPE_GLOBAL: fprintf (f, "Global scope\n"); break; case SPE_ABSTRACT: fprintf (f, "Abstract type scope\n"); break; case SPE_FCN: fprintf (f, "Function scope\n"); break; /* a let scope can only occur in a function scope, should not push a new scope, so symtable_lookupInScope works properly case letScope: fprintf (f, "Let scope\n"); break; */ case SPE_QUANT: fprintf (f, "Quantifier scope\n"); break; case SPE_CLAIM: fprintf (f, "Claim scope\n"); break; case SPE_INVALID: break; } break; case SYMK_TYPE: ti = (se->info).type; if (lco) fprintf (f, "%%LCL"); if (!lco && !ti->export) fprintf (f, "spec "); fprintf (f, "type %s %s", ltoken_getTextChars (ti->id), sort_getName (ti->basedOn)); if (ti->abstract) { if (ti->modifiable) fprintf (f, " mutable\n"); else fprintf (f, " immutable\n"); } else fprintf (f, " exposed\n"); break; case SYMK_VAR: vi = (se->info).var; if (lco) { fprintf (f, "%%LCL"); } if (!lco && !vi->export) { fprintf (f, "spec "); } switch (vi->kind) { case VRK_CONST: fprintf (f, "const %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; case VRK_VAR: fprintf (f, "var %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; case VRK_ENUM: fprintf (f, "enumConst %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; default: if (lco) { switch (vi->kind) { case VRK_GLOBAL: fprintf (f, "global %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; case VRK_PRIVATE: /* for private vars within function */ fprintf (f, "local %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; case VRK_LET: fprintf (f, "let %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; case VRK_PARAM: fprintf (f, "param %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; case VRK_QUANT: fprintf (f, "quant %s %s\n", ltoken_getTextChars (vi->id), sort_getName (vi->sort)); break; BADDEFAULT; } /*@=loopswitchbreak@*/ /*@=switchswitchbreak@*/ } } } } } static /*@exposed@*/ /*@out@*/ idTableEntry * nextFree (idTable * st) { idTableEntry *ret; unsigned int n = st->size; if (n >= st->allocated) { /* ** this loses with the garbage collector ** (and realloc is notoriously dangerous) ** ** st->entries = (idTableEntry *) LSLMoreMem (st->entries, (n + DELTA) ** * sizeof (idTableEntry)); ** ** instead, we copy the symtable... */ idTableEntry *oldentries = st->entries; unsigned int i; st->entries = dmalloc ((n+DELTA) * sizeof (*st->entries)); for (i = 0; i < n; i++) { st->entries[i] = oldentries[i]; } sfree (oldentries); st->allocated = n + DELTA; } ret = &(st->entries[st->size]); st->size++; return ret; } static /*@dependent@*/ /*@null@*/ idTableEntry * symtable_lookup (idTable *st, lsymbol id) { int n; idTableEntry *e; for (n = st->size - 1; n >= 0; n--) { e = &(st->entries[n]); /*@-loopswitchbreak@*/ switch (e->kind) { case SYMK_SCOPE: break; case SYMK_FCN: if (ltoken_getText (e->info.fct->id) == id) return e; break; case SYMK_TYPE: if (ltoken_getText (e->info.type->id) == id) return e; break; case SYMK_VAR: if (ltoken_getText (e->info.var->id) == id) return e; break; BADDEFAULT; } /*@=loopswitchbreak@*/ } return (idTableEntry *) 0; } static /*@dependent@*/ /*@null@*/ idTableEntry * symtable_lookupInScope (idTable *st, lsymbol id) { int n; idTableEntry *e; for (n = st->size - 1; n >= 0; n--) { e = &(st->entries[n]); if (e->kind == SYMK_SCOPE) break; if (ltoken_getText (e->info.fct->id) == id) { return e; } } return (idTableEntry *) 0; } /* hash table implementation */ static symbolKey htData_key (htData * x) { /* assume x points to a valid htData struct */ switch (x->kind) { case IK_SORT: return x->content.sort; case IK_OP: { /* get the textSym of the token */ nameNode n = (x->content.op)->name; if (n->isOpId) { return ltoken_getText (n->content.opid); } else { llassert (n->content.opform != NULL); return (n->content.opform)->key; } } case IK_TAG: return ltoken_getText ((x->content).tag->id); } BADEXIT; } static void htData_free (/*@null@*/ /*@only@*/ htData *d) { if (d != NULL) { switch (d->kind) { case IK_SORT: break; case IK_OP: /* nameNode_free (d->content.op->name);*/ sigNodeSet_free (d->content.op->signatures); break; case IK_TAG: { switch (d->content.tag->kind) { case TAG_STRUCT: case TAG_UNION: case TAG_FWDSTRUCT: case TAG_FWDUNION: /* ** no: stDeclNodeList_free (d->content.tag->content.decls); ** it is dependent! */ /*@switchbreak@*/ break; case TAG_ENUM: /* no: ltokenList_free (d->content.tag->content.enums); ** it is dependent! */ /*@switchbreak@*/ break; } } } sfree (d); } } static void bucket_free (/*@null@*/ /*@only@*/ bucket *b) { if (b != NULL) { bucket_free (b->next); htData_free (b->data); sfree (b); } } static void symHashTable_free (/*@only@*/ symHashTable *h) { unsigned int i; for (i = 0; i < h->size; i++) { bucket_free (h->buckets[i]); } sfree (h->buckets); sfree (h); } static /*@only@*/ symHashTable * symHashTable_create (unsigned int size) { unsigned int i; symHashTable *t = (symHashTable *) dmalloc (sizeof (*t)); t->buckets = (bucket **) dmalloc ((size + 1) * sizeof (*t->buckets)); t->count = 0; t->size = size; for (i = 0; i <= size; i++) { t->buckets[i] = (bucket *) NULL; } return t; } static /*@null@*/ /*@exposed@*/ htData * symHashTable_get (symHashTable *t, symbolKey key, infoKind kind, /*@null@*/ nameNode n) { bucket *b; htEntry *entry; htData *d; b = t->buckets[MASH (key, kind)]; if (b == (bucket *) 0) { return ((htData *) 0); } for (entry = (htEntry *) b; entry != NULL; entry = entry->next) { d = entry->data; if (d->kind == kind && htData_key (d) == key) if (kind != IK_OP || sameNameNode (n, d->content.op->name)) { return d; } } return ((htData *) 0); } static bool symHashTable_put (symHashTable *t, /*@only@*/ htData *data) { /* if key is already taken, don't insert, return FALSE else insert it and return TRUE. */ symbolKey key; htData *oldd; infoKind kind; nameNode name; key = htData_key (data); kind = data->kind; if (kind == IK_OP && (!data->content.op->name->isOpId)) { name = data->content.op->name; } else { name = (nameNode) 0; } oldd = symHashTable_get (t, key, kind, name); if (oldd == (htData *) 0) { /*@-deparrays@*/ bucket *new_entry = (bucket *) dmalloc (sizeof (*new_entry)); bucket *b = (t->buckets[MASH (key, kind)]); htEntry *entry = (htEntry *) b; /*@=deparrays@*/ new_entry->data = data; new_entry->next = entry; t->buckets[MASH (key, kind)] = new_entry; t->count++; return TRUE; } else { htData_free (data); } return FALSE; } static /*@only@*/ /*@exposed@*/ /*@null@*/ htData * symHashTable_forcePut (symHashTable *t, /*@only@*/ htData *data) { /* Put data in, return old value */ symbolKey key; bucket *b; htData *oldd; htEntry *entry, *new_entry; infoKind kind; nameNode name; key = htData_key (data); kind = data->kind; if (kind == IK_OP && (!data->content.op->name->isOpId)) { name = data->content.op->name; } else { name = (nameNode) 0; } oldd = symHashTable_get (t, key, kind, name); if (oldd == (htData *) 0) { new_entry = (htEntry *) dmalloc (sizeof (*new_entry)); /*@-deparrays@*/ b = t->buckets[MASH (key, kind)]; /*@=deparrays@*/ entry = b; new_entry->data = data; new_entry->next = entry; t->buckets[MASH (key, kind)] = new_entry; t->count++; return NULL; } else { /* modify in place */ *oldd = *data; /* copy new info over to old info */ /* dangerous: if the data is the same, don't free it */ if (data != oldd) { sfree (data); /*@-branchstate@*/ } /*@=branchstate@*/ return oldd; } } #if 0 static unsigned int symHashTable_count (symHashTable * t) { return (t->count); } #endif static void symHashTable_printStats (symHashTable * t) { int i, bucketCount, setsize, sortCount, opCount, tagCount; int sortTotal, opTotal, tagTotal; bucket *b; htEntry *entry; htData *d; sortTotal = 0; opTotal = 0; tagTotal = 0; sortCount = 0; opCount = 0; tagCount = 0; /* for debugging only */ printf ("\n Printing symHashTable stats ... \n"); for (i = 0; i <= HT_MAXINDEX; i++) { b = t->buckets[i]; bucketCount = 0; for (entry = b; entry != NULL; entry = entry->next) { d = entry->data; bucketCount++; switch (d->kind) { case IK_SORT: sortCount++; /*@switchbreak@*/ break; case IK_OP: { cstring name = nameNode_unparse (d->content.op->name); cstring sigs = sigNodeSet_unparse (d->content.op->signatures); opCount++; /* had a tt? */ setsize = sigNodeSet_size (d->content.op->signatures); printf (" Op (%d): %s %s\n", setsize, cstring_toCharsSafe (name), cstring_toCharsSafe (sigs)); cstring_free (name); cstring_free (sigs); /*@switchbreak@*/ break; } case IK_TAG: tagCount++; /*@switchbreak@*/ break; } } if (bucketCount > 0) { printf (" Bucket %d has count = %d; opCount = %d; sortCount = %d; tagCount = %d\n", i, bucketCount, opCount, sortCount, tagCount); sortTotal += sortCount; tagTotal += tagCount; opTotal += opCount; } } printf ("SymHashTable has total count = %d, opTotal = %d, sortTotal = %d, tagTotal = %d :\n", t->count, opTotal, sortTotal, tagTotal); } void symtable_printStats (symtable s) { symHashTable_printStats (s->hTable); /* for debugging only */ printf ("idTable size = %d; allocated = %d\n", s->idTable->size, s->idTable->allocated); } /*@only@*/ cstring tagKind_unparse (tagKind k) { switch (k) { case TAG_STRUCT: case TAG_FWDSTRUCT: return cstring_makeLiteral ("struct"); case TAG_UNION: case TAG_FWDUNION: return cstring_makeLiteral ("union"); case TAG_ENUM: return cstring_makeLiteral ("enum"); } BADEXIT; } static void tagInfo_free (/*@only@*/ tagInfo tag) { ltoken_free (tag->id); sfree (tag); } /*@observer@*/ sigNodeSet symtable_possibleOps (symtable tab, nameNode n) { opInfo oi = symtable_opInfo (tab, n); if (opInfo_exists (oi)) { return (oi->signatures); } return sigNodeSet_undefined; } bool symtable_opExistsWithArity (symtable tab, nameNode n, int arity) { opInfo oi = symtable_opInfo (tab, n); if (opInfo_exists (oi)) { sigNodeSet sigs = oi->signatures; sigNodeSet_elements (sigs, sig) { if (ltokenList_size (sig->domain) == arity) return TRUE; } end_sigNodeSet_elements; } return FALSE; } static bool domainMatches (ltokenList domain, sortSetList argSorts) { /* expect their length to match */ /* each domain sort in op must be an element of the corresponding set in argSorts. */ bool matched = TRUE; sort s; sortSetList_reset (argSorts); ltokenList_elements (domain, dom) { s = sort_fromLsymbol (ltoken_getText (dom)); if (!(sortSet_member (sortSetList_current (argSorts), s))) { /* printf (" mismatched element is: %s in %s\n", ltoken_getTextChars (*dom), sortSet_unparse (sortSetList_current (argSorts))); */ matched = FALSE; break; } sortSetList_advance (argSorts); } end_ltokenList_elements; return matched; } /*@only@*/ lslOpSet symtable_opsWithLegalDomain (symtable tab, /*@temp@*/ /*@null@*/ nameNode n, sortSetList argSorts, sort q) { /* handles nil qual */ lslOpSet ops = lslOpSet_new (); lslOp op; sort rangeSort; opInfo oi; llassert (n != NULL); oi = symtable_opInfo (tab, n); if (opInfo_exists (oi)) { sigNodeSet sigs = oi->signatures; sigNodeSet_elements (sigs, sig) { if (ltokenList_size (sig->domain) == sortSetList_size (argSorts)) { rangeSort = sigNode_rangeSort (sig); if ((q == NULL) || (sort_equal (rangeSort, q))) { if (domainMatches (sig->domain, argSorts)) { op = (lslOp) dmalloc (sizeof (*op)); /* each domain sort in op must be an element of the corresponding set in argSorts. */ op->signature = sig; op->name = nameNode_copy (n); (void) lslOpSet_insert (ops, op); } } } } end_sigNodeSet_elements; } return ops; } splint-3.1.2.dfsg1/src/lclinit.c0000644021234200000250000010400107646432515014044 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lslinit.c ** ** Processor for Larch Shared Language Init Files */ # include "splintMacros.nf" # include "basic.h" # include "gram.h" # include "lclscan.h" # include "scanline.h" # include "lclscanline.h" # include "lcltokentable.h" # include "lclsyntable.h" # include "lslinit.h" # include "lclinit.h" # include "shift.h" # if 0 /*@notfunction@*/ # define TRACE(rule) printf ("Reducing: %s\n", rule) # else /*@notfunction@*/ # define TRACE(rule) # endif static /*@dependent@*/ ltoken nextToken; static void InitLines (void) /*@modifies nextToken@*/ ; static void InitLine (void) /*@modifies nextToken@*/; static void Classification (void) /*@modifies nextToken@*/; static void CharClass (void) /*@modifies nextToken@*/; static void EndCommentChars (void) /*@modifies nextToken@*/ ; static void IdChars (void) /*@modifies nextToken@*/ ; static void OpChars (void) /*@modifies nextToken@*/ ; static void ExtensionChar (void) /*@modifies nextToken@*/ ; static void SingChars (void) /*@modifies nextToken@*/ ; static void WhiteChars (void) /*@modifies nextToken@*/ ; static void EndCommentChar (void) /*@modifies nextToken@*/ ; static void IdChar (void) /*@modifies nextToken@*/ ; static void OpChar (void) /*@modifies nextToken@*/ ; static void SingChar (void) /*@modifies nextToken@*/ ; static void WhiteChar (void) /*@modifies nextToken@*/ ; static void TokenClass (void) /*@modifies nextToken@*/ ; static void QuantifierSymToks (void) /*@modifies nextToken@*/ ; static void LogicalOpToks (void) /*@modifies nextToken@*/ ; static void EqOpToks (void) /*@modifies nextToken@*/ ; static void EquationSymToks (void) /*@modifies nextToken@*/ ; static void EqSepSymToks (void) /*@modifies nextToken@*/ ; static void SelectSymToks (void) /*@modifies nextToken@*/ ; static void OpenSymToks (void) /*@modifies nextToken@*/ ; static void SepSymToks (void) /*@modifies nextToken@*/ ; static void CloseSymToks (void) /*@modifies nextToken@*/ ; static void SimpleIdToks (void) /*@modifies nextToken@*/ ; static void MapSymToks (void) /*@modifies nextToken@*/ ; static void MarkerSymToks (void) /*@modifies nextToken@*/ ; static void CommentSymToks (void) /*@modifies nextToken@*/ ; static void QuantifierSymTok (void) /*@modifies nextToken@*/ ; static void LogicalOpTok (void) /*@modifies nextToken@*/ ; static void EqOpTok (void) /*@modifies nextToken@*/ ; static void EquationSymTok (void) /*@modifies nextToken@*/ ; static void EqSepSymTok (void) /*@modifies nextToken@*/ ; static void SelectSymTok (void) /*@modifies nextToken@*/ ; static void OpenSymTok (void) /*@modifies nextToken@*/ ; static void SepSymTok (void) /*@modifies nextToken@*/ ; static void CloseSymTok (void) /*@modifies nextToken@*/ ; static void SimpleIdTok (void) /*@modifies nextToken@*/ ; static void MapSymTok (void) /*@modifies nextToken@*/ ; static void MarkerSymTok (void) /*@modifies nextToken@*/ ; static void CommentSymTok (void) /*@modifies nextToken@*/ ; static void SynClass (void) /*@modifies nextToken@*/ ; static void OldToken (void) /*@modifies nextToken@*/ ; static void NewToken (void) /*@modifies nextToken@*/ ; static void Token (void) /*@modifies nextToken@*/ ; static void InitReduce (LCLInitRuleCode p_rule) /*@modifies nextToken@*/ ; static void UpdateXCharKeywords (charCode p_xChar) /*@modifies nextToken@*/ ; static void ProcessExtensionChar (void) /*@modifies nextToken@*/ ; static void ProcessEndCommentChar (void) /*@modifies nextToken@*/ ; static void ProcessSingleChar (charCode p_code) /*@modifies nextToken@*/ ; static void ProcessToken (ltokenCode p_code) /*@modifies nextToken@*/ ; static void ProcessSynonym (void) /*@modifies nextToken@*/ ; static void LocalUserError (/*@unused@*/ ltoken p_t, /*@temp@*/ char *p_msg) /*@modifies *g_warningstream@*/ ; /* If TRUE character has been redefined as a singleChar. */ static bool defineSingleChar[LASTCHAR + 1]; static charCode currentExtensionChar; /* LSL init file keyword tokens. */ static /*@exposed@*/ ltoken endCommentCharToken; static /*@exposed@*/ ltoken idCharToken; static /*@exposed@*/ ltoken opCharToken; static /*@exposed@*/ ltoken extensionCharToken; static /*@exposed@*/ ltoken singleCharToken; static /*@exposed@*/ ltoken whiteCharToken; static /*@exposed@*/ ltoken quantifierSymToken; static /*@exposed@*/ ltoken logicalOpToken; static /*@exposed@*/ ltoken eqOpToken; static /*@exposed@*/ ltoken equationSymToken; static /*@exposed@*/ ltoken eqSepSymToken; static /*@exposed@*/ ltoken selectSymToken; static /*@exposed@*/ ltoken openSymToken; static /*@exposed@*/ ltoken sepSymToken; static /*@exposed@*/ ltoken closeSymToken; static /*@exposed@*/ ltoken simpleIdToken; static /*@exposed@*/ ltoken mapSymToken; static /*@exposed@*/ ltoken markerSymToken; static /*@exposed@*/ ltoken commentSymToken; static /*@exposed@*/ ltoken synonymToken; static /*@exposed@*/ ltoken insertSimpleToken (char *s) /*@modifies internalState@*/ { return (LCLInsertToken (simpleId, lsymbol_fromChars (s), 0, FALSE)); } static bool hasFirstChar (ltoken tok) /*@*/ { return (ltoken_isChar (tok) && ltoken_isSingleChar (cstring_firstChar (ltoken_unparse (tok)))); } void lclinit_process (void) { InitLines (); InitReduce (INITFILE1); if (ltoken_getCode (nextToken) != LEOFTOKEN) { LocalUserError (nextToken, "unexpected tokens after end-of-file"); } } static void InitLines (void) { setCodePoint (); InitReduce (INITLINES1); if (ltoken_getCode (nextToken) != LEOFTOKEN) { InitLine (); InitReduce (INITLINES2); } while (ltoken_getCode (nextToken) != LEOFTOKEN) { InitLine (); InitReduce (INITLINES3); } } static void InitLine (void) { if (ltoken_getCode (nextToken) == LLT_EOL) { /* Nothing on line. */ InitReduce (INITLINE1); } else { Classification (); InitReduce (INITLINE2); } if (ltoken_getCode (nextToken) != LLT_EOL) { LocalUserError (nextToken, "Unexpected tokens on line"); } nextToken = LCLScanNextToken (); /* Discard EOL */ } static void Classification (void) { lsymbol ntext = ltoken_getRawText (nextToken); if (ntext == ltoken_getText (endCommentCharToken) || ntext == ltoken_getText (idCharToken) || ntext == ltoken_getText (opCharToken) || ntext == ltoken_getText (extensionCharToken) || ntext == ltoken_getText (singleCharToken) || ntext == ltoken_getText (whiteCharToken)) { CharClass (); InitReduce (CLASSIFICATION1); } else if (ntext == ltoken_getText (quantifierSymToken) || ntext == ltoken_getText (logicalOpToken) || ntext == ltoken_getText (eqOpToken) || ntext == ltoken_getText (equationSymToken) || ntext == ltoken_getText (eqSepSymToken) || ntext == ltoken_getText (selectSymToken) || ntext == ltoken_getText (openSymToken) || ntext == ltoken_getText (sepSymToken) || ntext == ltoken_getText (closeSymToken) || ntext == ltoken_getText (simpleIdToken) || ntext == ltoken_getText (mapSymToken) || ntext == ltoken_getText (markerSymToken) || ntext == ltoken_getText (commentSymToken)) { TokenClass (); InitReduce (CLASSIFICATION2); } else if (ntext == ltoken_getText (synonymToken)) { SynClass (); InitReduce (CLASSIFICATION3); } else { llbug (message ("Expected character, token, or synonym classification: %s", ltoken_getRawString (nextToken))); /* pop off all tokens on this line */ } } static void CharClass (void) { ltoken charClassToken; charClassToken = nextToken; nextToken = LCLScanNextToken (); /* Discard char class keyword. */ if (ltoken_getRawText (charClassToken) == ltoken_getText (endCommentCharToken)) { EndCommentChars (); InitReduce (CHARCLASS1); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (idCharToken)) { IdChars (); InitReduce (CHARCLASS2); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (opCharToken)) { OpChars (); InitReduce (CHARCLASS3); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (extensionCharToken)) { ExtensionChar (); InitReduce (CHARCLASS4); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (singleCharToken)) { SingChars (); InitReduce (CHARCLASS5); } else if (ltoken_getRawText (charClassToken) == ltoken_getText (whiteCharToken)) { WhiteChars (); InitReduce (CHARCLASS6); } else { LocalUserError (nextToken, "expected character classification"); } } static void EndCommentChars (void) { EndCommentChar (); InitReduce (LRC_ENDCOMMENT1); while (ltoken_getCode (nextToken) != LLT_EOL) { EndCommentChar (); InitReduce (LRC_ENDCOMMENT2); } } static void IdChars (void) /*@modifies nextToken@*/ { IdChar (); InitReduce (IDCHARS1); while (ltoken_getCode (nextToken) != LLT_EOL) { IdChar (); InitReduce (IDCHARS2); } } static void OpChars (void) /*@modifies nextToken@*/ { OpChar (); InitReduce (OPCHARS1); while (ltoken_getCode (nextToken) != LLT_EOL) { OpChar (); InitReduce (OPCHARS2); } } static void ExtensionChar (void) /*@modifies nextToken@*/ { if (hasFirstChar (nextToken)) { LSLGenShift (nextToken); nextToken = LCLScanNextToken (); InitReduce (LRC_EXTENSIONCHAR1); } else { LocalUserError (nextToken, "expected only one character"); } } static void SingChars (void) /*@modifies nextToken@*/ { SingChar (); InitReduce (SINGCHARS1); while (ltoken_getCode (nextToken) != LLT_EOL) { SingChar (); InitReduce (SINGCHARS2); } } static void WhiteChars (void) /*@modifies nextToken@*/ { WhiteChar (); InitReduce (WHITECHARS1); while (ltoken_getCode (nextToken) != LLT_EOL) { WhiteChar (); InitReduce (WHITECHARS2); } } static void EndCommentChar (void) /*@modifies nextToken@*/ { if (ltoken_isChar (nextToken)) { LSLGenShift (nextToken); nextToken = LCLScanNextToken (); InitReduce (LRC_ENDCOMMENTCHAR1); } else { LocalUserError (nextToken, "expected only one character"); } } static void IdChar (void) /*@modifies nextToken@*/ { if (hasFirstChar (nextToken)) { LSLGenShift (nextToken); nextToken = LCLScanNextToken (); InitReduce (IDCHAR1); } else { LocalUserError (nextToken, "Character is already defined, cannot redefine"); } } static void OpChar (void) /*@modifies nextToken@*/ { if (hasFirstChar (nextToken)) { LSLGenShift (nextToken); nextToken = LCLScanNextToken (); InitReduce (OPCHAR1); } else { LocalUserError (nextToken, "Character is already defined, cannot redefine"); } } static void SingChar (void) /*@modifies nextToken@*/ { if (hasFirstChar (nextToken)) { LSLGenShift (nextToken); nextToken = LCLScanNextToken (); InitReduce (SINGCHAR1); } else { LocalUserError (nextToken, "Character is already defined, cannot redefine"); } } static void WhiteChar (void) /*@modifies nextToken@*/ { if (hasFirstChar (nextToken)) { LSLGenShift (nextToken); nextToken = LCLScanNextToken (); InitReduce (WHITECHAR1); } else { LocalUserError (nextToken, "Character is already defined, cannot redefine"); } } static void TokenClass (void) /*@modifies nextToken@*/ { ltoken tokenClassToken; lsymbol ttext = ltoken_getRawText (nextToken); tokenClassToken = nextToken; /* Discard token class keyword. */ nextToken = LCLScanNextToken (); if (ttext == ltoken_getText (quantifierSymToken)) { QuantifierSymToks (); InitReduce (TOKENCLASS1); } else if (ttext == ltoken_getText (logicalOpToken)) { LogicalOpToks (); InitReduce (TOKENCLASS2); } else if (ttext == ltoken_getText (eqOpToken)) { EqOpToks (); InitReduce (TOKENCLASS3); } else if (ttext == ltoken_getText (equationSymToken)) { EquationSymToks (); InitReduce (TOKENCLASS4); } else if (ttext == ltoken_getText (eqSepSymToken)) { EqSepSymToks (); InitReduce (TOKENCLASS5); } else if (ttext == ltoken_getText (selectSymToken)) { SelectSymToks (); InitReduce (TOKENCLASS6); } else if (ttext == ltoken_getText (openSymToken)) { OpenSymToks (); InitReduce (TOKENCLASS7); } else if (ttext == ltoken_getText (sepSymToken)) { SepSymToks (); InitReduce (TOKENCLASS8); } else if (ttext == ltoken_getText (closeSymToken)) { CloseSymToks (); InitReduce (TOKENCLASS9); } else if (ttext == ltoken_getText (simpleIdToken)) { SimpleIdToks (); InitReduce (TOKENCLASS10); } else if (ttext == ltoken_getText (mapSymToken)) { MapSymToks (); InitReduce (TOKENCLASS11); } else if (ttext == ltoken_getText (markerSymToken)) { MarkerSymToks (); InitReduce (TOKENCLASS12); } else if (ttext == ltoken_getText (commentSymToken)) { CommentSymToks (); InitReduce (TOKENCLASS13); } else { LocalUserError (nextToken, "expected token classification"); } } static void QuantifierSymToks (void) /*@modifies nextToken@*/ { QuantifierSymTok (); InitReduce (QUANTIFIERSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { QuantifierSymTok (); InitReduce (QUANTIFIERSYMTOKS2); } } static void LogicalOpToks (void) /*@modifies nextToken@*/ { LogicalOpTok (); InitReduce (LOGICALOPTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { LogicalOpTok (); InitReduce (LOGICALOPTOKS2); } } static void EqOpToks (void) /*@modifies nextToken@*/ { EqOpTok (); InitReduce (LRC_EQOPTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { EqOpTok (); InitReduce (LRC_EQOPTOKS2); } } static void EquationSymToks (void) /*@modifies nextToken@*/ { EquationSymTok (); InitReduce (LRC_EQUATIONSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { EquationSymTok (); InitReduce (LRC_EQUATIONSYMTOKS2); } } static void EqSepSymToks (void) /*@modifies nextToken@*/ { EqSepSymTok (); InitReduce (LRC_EQSEPSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { EqSepSymTok (); InitReduce (LRC_EQSEPSYMTOKS2); } } static void SelectSymToks (void) /*@modifies nextToken@*/ { SelectSymTok (); InitReduce (SELECTSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { SelectSymTok (); InitReduce (SELECTSYMTOKS2); } } static void OpenSymToks (void) /*@modifies nextToken@*/ { OpenSymTok (); InitReduce (OPENSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { OpenSymTok (); InitReduce (OPENSYMTOKS2); } } static void SepSymToks (void) /*@modifies nextToken@*/ { SepSymTok (); InitReduce (SEPSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { SepSymTok (); InitReduce (SEPSYMTOKS2); } } static void CloseSymToks (void) /*@modifies nextToken@*/ { CloseSymTok (); InitReduce (CLOSESYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { CloseSymTok (); InitReduce (CLOSESYMTOKS2); } } static void SimpleIdToks (void) /*@modifies nextToken@*/ { SimpleIdTok (); InitReduce (SIMPLEIDTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { SimpleIdTok (); InitReduce (SIMPLEIDTOKS2); } } static void MapSymToks (void) /*@modifies nextToken@*/ { MapSymTok (); InitReduce (MAPSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { MapSymTok (); InitReduce (MAPSYMTOKS2); } } static void MarkerSymToks (void) /*@modifies nextToken@*/ { MarkerSymTok (); InitReduce (MARKERSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { MarkerSymTok (); InitReduce (MARKERSYMTOKS2); } } static void CommentSymToks (void) /*@modifies nextToken@*/ { CommentSymTok (); InitReduce (COMMENTSYMTOKS1); while (ltoken_getCode (nextToken) != LLT_EOL) { CommentSymTok (); InitReduce (COMMENTSYMTOKS2); } } static void QuantifierSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (QUANTIFIERSYMTOK1); } static void LogicalOpTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (LOGICALOPTOK1); } static void EqOpTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (LRC_EQOPTOK1); } static void EquationSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (LRC_EQUATIONSYMTOK1); } static void EqSepSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (LRC_EQSEPSYMTOK1); } static void SelectSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (SELECTSYMTOK1); } static void OpenSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (OPENSYMTOK1); } static void SepSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (SEPSYMTOK1); } static void CloseSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (CLOSESYMTOK1); } static void SimpleIdTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (SIMPLEIDTOK1); } static void MapSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (MAPSYMTOK1); } static void MarkerSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (MARKERSYMTOK1); } static void CommentSymTok (void) /*@modifies nextToken@*/ { Token (); InitReduce (COMMENTSYMTOK1); } static void SynClass (void) /*@modifies nextToken@*/ { if (ltoken_getRawText (nextToken) == ltoken_getText (synonymToken)) { nextToken = LCLScanNextToken (); OldToken (); NewToken (); InitReduce (SYNCLASS1); } else { LocalUserError (nextToken, "expected synonym classification"); } } static void OldToken (void) /*@modifies nextToken@*/ { Token (); InitReduce (OLDTOKEN1); } static void NewToken (void) /*@modifies nextToken@*/ { Token (); InitReduce (NEWTOKEN1); } static void Token (void) /*@modifies nextToken@*/ { if (ltoken_getCode (nextToken) == LLT_EOL || ltoken_getCode (nextToken) == LEOFTOKEN) { LocalUserError (nextToken, "unexpected end-of-line or end-of-file"); } else { LSLGenShift (nextToken); nextToken = LCLScanNextToken (); } } /* ** Init File Processing Routines, these routines use the shift-reduce sequence ** produced by the init file parser and update the necessary tables for the ** scanner. ** ** The same shift stack is used that LSL parser uses. A different reduce ** procedure is used because the init file grammar is different from the LSL ** grammar. */ static void InitReduce (LCLInitRuleCode rule) /*@modifies nextToken@*/ { switch (rule) { case INITFILE1: TRACE ("INITFILE1"); break; case INITLINES1: TRACE ("INITLINES1"); break; case INITLINES2: TRACE ("INITLINES2"); break; case INITLINES3: TRACE ("INITLINES3"); break; case INITLINE1: TRACE ("INITLINE1"); break; case INITLINE2: TRACE ("INITLINE2"); break; case CLASSIFICATION1: TRACE ("CLASSIFICATION1"); break; case CLASSIFICATION2: TRACE ("CLASSIFICATION2"); break; case CLASSIFICATION3: TRACE ("CLASSIFICATION3"); break; case CHARCLASS1: TRACE ("CHARCLASS1"); break; case CHARCLASS2: TRACE ("CHARCLASS2"); break; case CHARCLASS3: TRACE ("CHARCLASS3"); break; case CHARCLASS4: TRACE ("CHARCLASS4"); break; case CHARCLASS5: TRACE ("CHARCLASS5"); break; case CHARCLASS6: TRACE ("CHARCLASS6"); break; case LRC_ENDCOMMENT1: TRACE ("LRC_ENDCOMMENT1"); break; case LRC_ENDCOMMENT2: TRACE ("LRC_ENDCOMMENT2"); break; case IDCHARS1: TRACE ("IDCHARS1"); break; case IDCHARS2: TRACE ("IDCHARS2"); break; case OPCHARS1: TRACE ("OPCHARS1"); break; case OPCHARS2: TRACE ("OPCHARS2"); break; case LRC_EXTENSIONCHAR1: TRACE ("LRC_EXTENSIONCHAR1"); ProcessExtensionChar (); break; case SINGCHARS1: TRACE ("SINGCHARS1"); break; case SINGCHARS2: TRACE ("SINGCHARS2"); break; case WHITECHARS1: TRACE ("WHITECHARS1"); break; case WHITECHARS2: TRACE ("WHITECHARS2"); break; case LRC_ENDCOMMENTCHAR1: TRACE ("LRC_ENDCOMMENTCHAR1"); ProcessEndCommentChar (); break; case IDCHAR1: TRACE ("IDCHAR1"); ProcessSingleChar (IDCHAR); break; case OPCHAR1: TRACE ("OPCHAR1"); ProcessSingleChar (OPCHAR); break; case SINGCHAR1: TRACE ("SINGCHAR1"); ProcessSingleChar (SINGLECHAR); break; case WHITECHAR1: TRACE ("CHAR1"); ProcessSingleChar (WHITECHAR); break; case TOKENCLASS1: TRACE ("TOKENCLASS1"); break; case TOKENCLASS2: TRACE ("TOKENCLASS2"); break; case TOKENCLASS3: TRACE ("TOKENCLASS3"); break; case TOKENCLASS4: TRACE ("TOKENCLASS4"); break; case TOKENCLASS5: TRACE ("TOKENCLASS5"); break; case TOKENCLASS6: TRACE ("TOKENCLASS6"); break; case TOKENCLASS7: TRACE ("TOKENCLASS7"); break; case TOKENCLASS8: TRACE ("TOKENCLASS8"); break; case TOKENCLASS9: TRACE ("TOKENCLASS9"); break; case TOKENCLASS10: TRACE ("TOKENCLASS10"); break; case TOKENCLASS11: TRACE ("TOKENCLASS11"); break; case TOKENCLASS12: TRACE ("TOKENCLASS12"); break; case TOKENCLASS13: TRACE ("TOKENCLASS13"); break; case QUANTIFIERSYMTOKS1: TRACE ("QUALIFERSYMTOKS1"); break; case QUANTIFIERSYMTOKS2: TRACE ("QUANTIFIERSYMTOKS2"); break; case LOGICALOPTOKS1: TRACE ("LOGICALOPTOKS1"); break; case LOGICALOPTOKS2: TRACE ("LOGICALOPTOKS2"); break; case LRC_EQOPTOKS1: TRACE ("LRC_EQOPTOKS1"); break; case LRC_EQOPTOKS2: TRACE ("LRC_EQOPTOKS2"); break; case LRC_EQUATIONSYMTOKS1: TRACE ("LRC_EQUATIONSYMTOKS1"); break; case LRC_EQUATIONSYMTOKS2: TRACE ("LRC_EQUATIONSYMTOKS2"); break; case LRC_EQSEPSYMTOKS1: TRACE ("LRC_EQSEPSYMTOKS1"); break; case LRC_EQSEPSYMTOKS2: TRACE ("LRC_EQSEPSYMTOKS2"); break; case SELECTSYMTOKS1: TRACE ("SELECTSYMTOKS1"); break; case SELECTSYMTOKS2: TRACE ("SELECTSYMTOKS2"); break; case OPENSYMTOKS1: TRACE ("OPENSYMTOKS1"); break; case OPENSYMTOKS2: TRACE ("OPENSYMTOKS2"); break; case SEPSYMTOKS1: TRACE ("SEPSYMTOKS1"); break; case SEPSYMTOKS2: TRACE ("SEPSYMTOKS2"); break; case CLOSESYMTOKS1: TRACE ("CLOSESYMTOKS1"); break; case CLOSESYMTOKS2: TRACE ("CLOSESYMTOKS2"); break; case SIMPLEIDTOKS1: TRACE ("SIMPLEIDTOKS1"); break; case SIMPLEIDTOKS2: TRACE ("SIMPLEIDTOKS2"); break; case MAPSYMTOKS1: TRACE ("MAPSYMTOKS1"); break; case MAPSYMTOKS2: TRACE ("MAPSYMTOKS2"); break; case MARKERSYMTOKS1: TRACE ("MARKERSYMTOKS1"); break; case MARKERSYMTOKS2: TRACE ("MARKERSYMTOKS2"); break; case COMMENTSYMTOKS1: TRACE ("COMMENTSYMTOKS1"); break; case COMMENTSYMTOKS2: TRACE ("COMMENTSYMTOKS2"); break; case QUANTIFIERSYMTOK1: TRACE ("QUANTIFERSYMTOK1"); ProcessToken (quantifierSym); break; case LOGICALOPTOK1: TRACE ("LOGICALOPTOK1"); ProcessToken (logicalOp); break; case LRC_EQOPTOK1: TRACE ("LRC_EQOPTOK1"); ProcessToken (eqOp); break; case LRC_EQUATIONSYMTOK1: TRACE ("LRC_EQUATIONSYMTOK1"); ProcessToken (equationSym); break; case LRC_EQSEPSYMTOK1: TRACE ("LRC_EQSEPSYMTOK1"); ProcessToken (eqSepSym); break; case SELECTSYMTOK1: TRACE ("SELECTSYMTOK1"); ProcessToken (selectSym); break; case OPENSYMTOK1: TRACE ("OPENSYMTOK1"); ProcessToken (openSym); break; case SEPSYMTOK1: TRACE ("SEPSYMTOK1"); ProcessToken (sepSym); break; case CLOSESYMTOK1: TRACE ("CLOSESYMTOK1"); ProcessToken (closeSym); break; case SIMPLEIDTOK1: TRACE ("SIMPLEIDTOK1"); ProcessToken (simpleId); break; case MAPSYMTOK1: TRACE ("MAPSYMTOK1"); ProcessToken (mapSym); break; case MARKERSYMTOK1: TRACE ("MARKERSYMTOK1"); ProcessToken (markerSym); break; case COMMENTSYMTOK1: TRACE ("COMMENTSYMTOK1"); ProcessToken (commentSym); break; case SYNCLASS1: TRACE ("SYNCLASS1"); ProcessSynonym (); break; case OLDTOKEN1: TRACE ("OLDTOKEN1"); break; case NEWTOKEN1: TRACE ("NEWTOKEN1"); break; default: llcontbuglit ("InitReduce: bad case"); break; } } /* ** Reset the first character of the predefined extensionChar keywords when ** the extensionChar changes. e.g. "extensionChar @" changes "\forall" to ** "@forall". */ static void UpdateXCharKeywords (charCode xChar) { char *str; char xchar = (char)xChar; str = ltoken_getTextChars (ltoken_forall); *str = xchar; str = ltoken_getTextChars (ltoken_and); *str = xchar; str = ltoken_getTextChars (ltoken_or); *str = xchar; str = ltoken_getTextChars (ltoken_implies); *str = xchar; str = ltoken_getTextChars (ltoken_eq); *str = xchar; str = ltoken_getTextChars (ltoken_neq); *str = xchar; str = ltoken_getTextChars (ltoken_equals); *str = xchar; str = ltoken_getTextChars (ltoken_eqsep); *str = xchar; str = ltoken_getTextChars (ltoken_select); *str = xchar; str = ltoken_getTextChars (ltoken_open); *str = xchar; str = ltoken_getTextChars (ltoken_sep); *str = xchar; str = ltoken_getTextChars (ltoken_close); *str = xchar; str = ltoken_getTextChars (ltoken_id); *str = xchar; str = ltoken_getTextChars (ltoken_arrow); *str = xchar; str = ltoken_getTextChars (ltoken_marker); *str = xchar; str = ltoken_getTextChars (ltoken_comment); *str = xchar; } /* Different from ProcessCharClass because only allow one extension */ /* character. Therefore, the present extension character must be set to a */ /* singleChar. */ static void ProcessExtensionChar (void) { ltoken stackToken = LSLGenTopPopShiftStack (); char firstChar = cstring_firstChar (ltoken_unparse (stackToken)); if (!defineSingleChar[(int)firstChar] && ltoken_isSingleChar (firstChar)) { /* ** Is a single character that has not been defined before. ** Can only have one extension char. Release old one. */ LCLSetCharClass (firstChar, CHC_EXTENSION); LCLSetCharClass ((char) currentExtensionChar, SINGLECHAR); currentExtensionChar = (charCode) firstChar; UpdateXCharKeywords (currentExtensionChar); } else { /* Already redefined. Don't allow to be redefined. */ LocalUserError (stackToken, "Character is already defined, cannot redefine"); } ltoken_free (stackToken); } /* Different from ProcessSingleChar because allow any characters to be */ /* endCommentChar and also set a different part of the scanner structure. */ static void ProcessEndCommentChar (void) { ltoken stackToken = LSLGenTopPopShiftStack (); char firstChar = cstring_firstChar (ltoken_unparse (stackToken)); if (LCLIsEndComment (firstChar)) { LocalUserError (stackToken, "already defined as a endCommentChar, cannot redefine"); } else { LCLSetEndCommentChar (firstChar, TRUE); } ltoken_free (stackToken); } static void ProcessSingleChar (charCode code) { ltoken stackToken = LSLGenTopPopShiftStack (); char firstChar = cstring_firstChar (ltoken_unparse (stackToken)); if (!defineSingleChar[(int)firstChar] && ltoken_isSingleChar (firstChar)) { /* Is a single character that has not been defined before. */ /* It's OK to redefine once. */ LCLSetCharClass (firstChar, code); /* OK to mark as a defined singleChar even if not. Only check */ /* defineSingleChar[] if defining a singleChar. */ defineSingleChar[(int)(firstChar)] = TRUE; } else { LocalUserError (stackToken, "Character is already defined, cannot redefine"); } ltoken_free (stackToken); } static void ProcessToken (ltokenCode code) { ltoken stackToken, ptok; stackToken = LSLGenTopPopShiftStack (); if (LCLIsSyn (ltoken_getText (stackToken))) { LocalUserError (stackToken, "already defined as a synonym, cannot redefine"); } /* ** Get the token from the token table, so can check if the token ** was updated by a previous token. */ ptok = LCLGetToken (ltoken_getText (stackToken)); if (ltoken_isStateDefined (ptok)) { LocalUserError (stackToken, "already defined, cannot redefine"); } LCLUpdateToken (code, ltoken_getText (stackToken), TRUE); ltoken_free (stackToken); } static void ProcessSynonym (void) { ltoken newtok; ltoken oldtok; newtok = LSLGenTopPopShiftStack (); oldtok = LSLGenTopPopShiftStack (); /* ignore synonyms: Bool -> bool and: bool -> Bool */ /* if ((ltoken_getText (newtok) == lsymbol_Bool || ltoken_getText (newtok) == lsymbol_bool) && (ltoken_getText (oldtok) == lsymbol_Bool || ltoken_getText (oldtok) == lsymbol_bool)) return; */ if (ltoken_wasSyn (newtok)) { /* ** The token has a synonym. This means that the synonym was in the ** init file, so complain about redefining as a synonym again */ LocalUserError (newtok, "already is a synonym, cannot redefine"); } if (ltoken_hasSyn (newtok)) { /* ** newtok already has a synonym defined for it. Do not allow ** synonyms to be chained. */ LocalUserError (newtok, "newtok already has a synonym, cannot chain synonyms"); } if (ltoken_isStateDefined (newtok)) { LocalUserError (newtok, "newtok already defined, cannot redefine"); } LCLAddSyn (ltoken_getText (newtok), ltoken_getText (oldtok)); ltoken_free (newtok); ltoken_free (oldtok); } /* ** Utilities, in alphabetical order */ static void LocalUserError (ltoken t, char *msg) { lclplainerror (message ("%s %s in the LCL init file. Ignoring line.", ltoken_unparse (t), cstring_fromChars (msg))); /* discard the whole current line */ nextToken = LCLScanNextToken (); /* Discard bad token */ while (ltoken_getCode (nextToken) != LLT_EOL && ltoken_getCode (nextToken) != LEOFTOKEN) { nextToken = LCLScanNextToken (); } } /* * Required initialization and cleanup routines */ void lclinit_initMod (void) { int i; LSLGenInit (FALSE); /* parsing LCLinit, not LSLinit */ /* ** Insert the init file keywords into the token table as undefined ** SIMPLEIDs. They are defined as simpleIds since they must be treated ** that way if they do not appear as the first token on a line, and ** they must be treated that way for the actual LSL parsing. Save the ** tokens so can recognize as init file keywords when necessary. */ endCommentCharToken = insertSimpleToken ("endCommentChar"); idCharToken = insertSimpleToken ("idChar"); opCharToken = insertSimpleToken ("opChar"); extensionCharToken = insertSimpleToken ("extensionChar"); singleCharToken = insertSimpleToken ("singleChar"); whiteCharToken = insertSimpleToken ("whiteChar"); quantifierSymToken = insertSimpleToken ("quantifierSym"); logicalOpToken = insertSimpleToken ("logicalOp"); eqOpToken = insertSimpleToken ("eqOp"); equationSymToken = insertSimpleToken ("equationSym"); eqSepSymToken = insertSimpleToken ("eqSepSym"); selectSymToken = insertSimpleToken ("selectSym"); openSymToken = insertSimpleToken ("openSym"); sepSymToken = insertSimpleToken ("sepSym"); closeSymToken = insertSimpleToken ("closeSym"); simpleIdToken = insertSimpleToken ("simpleId"); mapSymToken = insertSimpleToken ("mapSym"); markerSymToken = insertSimpleToken ("markerSym"); commentSymToken = insertSimpleToken ("commentSym"); synonymToken = insertSimpleToken ("synonym"); /* ** Initialize defineSingleChar array to all FALSE to signal that no ** characters have been redefined as singleChar. */ for (i = 0; i <= LASTCHAR; i++) { defineSingleChar[i] = FALSE; } /* ** Record the current extension character so can redefine back to ** singleChar if a new extension character is redefined. */ currentExtensionChar = (charCode) CHAREXTENDER; /* Init file processing needs to have EOL reported. */ LCLReportEolTokens (TRUE); /* Not: context_getBoolName () */ LCLAddSyn (lsymbol_fromChars ("Bool"), lsymbol_fromChars ("bool")); } void lclinit_reset (void) { nextToken = LCLScanNextToken (); } void lclinit_cleanup (void) { ; } splint-3.1.2.dfsg1/src/shift.c0000644021234200000250000000462207646432516013534 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** shift.c ** ** Larch shift sequence manager ** ** Tokens are sent by the parser to this module. Here they are saved ** for awhile in a stack, and delivered on demand during reduce actions. ** The coordination between what the parser sends here and what reduce ** consumes here must be maintained by the programmer. ** */ # include "splintMacros.nf" # include "basic.h" # include "shift.h" /*@constant static int SHIFTMAX=200;@*/ # define SHIFTMAX 200 static o_ltoken Shifts[SHIFTMAX]; static int shiftIndex; static bool Parsing_LSLinit = TRUE; static bool LSLGenIsEmptyShiftStack (void) { return (shiftIndex == 0); } void LSLGenShift (ltoken tok) { if (shiftIndex < SHIFTMAX) { Shifts[shiftIndex] = ltoken_copy (tok); shiftIndex++; } else { llbuglit ("LSLGenShift: needs MoreMem ()"); } } extern void LSLGenShiftOnly (/*@only@*/ ltoken tok) { if (shiftIndex < SHIFTMAX) { Shifts[shiftIndex] = tok; shiftIndex++; } else { llbugexitlit ("LSLGenShift: needs MoreMem ()"); } } extern ltoken LSLGenTopPopShiftStack (void) { ltoken res; if (LSLGenIsEmptyShiftStack ()) { lclfatalbug ("LSLGenTopPopShiftStack: Empty stack"); } res = Shifts[--shiftIndex]; Shifts[shiftIndex] = ltoken_undefined; /*@-retalias@*/ /*@-dependenttrans@*/ return res; /*@=retalias@*/ /*@=dependenttrans@*/ } void LSLGenInit (bool LSLParse) { Parsing_LSLinit = LSLParse; } splint-3.1.2.dfsg1/src/lclscan.c0000644021234200000250000001145410645772425014036 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lclscan.c ** ** Deliver tokens one at a time ** ** METHOD: ** The input arrives via LSLScanFreshToken (). ** The output is reported via LSLScanNextToken (). ** ** The tokens are built in module ScanLine. ** The tokens are delivered from this module. ** Meantimes, they are saved in a static array. ** ** The tokenizing is split off from the delivery of tokens ** to facilitate incremental scanning at a later date. ** The essential is that scanline () can be called or not ** if the input text is dirty or not. Clean lines cause ** tokens to be played out from the saved token list (not ** yet implemented in this version). */ # include "splintMacros.nf" # include "basic.h" /*@-redecl@*/ /* from llgrammar.y */ extern bool g_inTypeDef; /*@=redecl@*/ /*@ignore@*/ # include "llgrammar2.h" /* hack to force real include */ /*@end@*/ # include "lclscan.h" # include "scanline.h" # include "lclscanline.h" # include "lcltokentable.h" static inputStream scanFile; /* file to scan */ static o_ltoken TokenList[MAXLINE]; /* available tokens */ static bool restore = FALSE; /* wasn't static! */ static YYSTYPE restoretok; static int nextToken; /* next available token */ static int lastToken; /* next available slot */ static /*@dependent@*/ /*@null@*/ char *line; /* input text */ static unsigned int lineNumber; /* current line number */ ltokenCode yllex (void) /*@globals killed restoretok@*/ /* only if restore is TRUE */ { lsymbol tokenSym; if (restore) { yllval = restoretok; restore = FALSE; } else { /*@-onlyunqglobaltrans@*/ yllval.ltok = ltoken_copy (LCLScanNextToken ()); /*@=onlyunqglobaltrans@*/ } tokenSym = ltoken_getText (yllval.ltok); if (ltoken_getCode (yllval.ltok) == simpleId) { if (g_inTypeDef) { ltoken_setCode (yllval.ltok, LLT_TYPEDEF_NAME); LCLUpdateToken (LLT_TYPEDEF_NAME, tokenSym, ltoken_isStateDefined (yllval.ltok)); } else { /* or if it is already declared as a type, so typedef int foo; typedef foo bar; works*/ if (symtable_exists (g_symtab, tokenSym)) { if (typeInfo_exists (symtable_typeInfo (g_symtab, tokenSym))) { ltoken_setCode (yllval.ltok, LLT_TYPEDEF_NAME); LCLUpdateToken (LLT_TYPEDEF_NAME, tokenSym, ltoken_isStateDefined (yllval.ltok)); } } } } /*@-onlyunqglobaltrans@*/ /* restoretok not released on non-restore path */ /*@-globstate@*/ return (ltoken_getCode (yllval.ltok)); /*@=onlyunqglobaltrans@*/ /*@=globstate@*/ } /* useful for scanning LCL init files and LSL init files ? */ /*@dependent@*/ ltoken LCLScanNextToken (void) { ltoken ret; if (nextToken < lastToken) { ret = TokenList[nextToken++]; } else { lastToken = 0; lineNumber++; line = inputStream_nextLine (scanFile); if (line != (char *) 0) { LCLScanLine (line); nextToken = 0; ret = LCLScanNextToken (); return ret; } else { ret = LCLScanEofToken (); } } return ret; } static /*@exposed@*/ /*@dependent@*/ ltoken LCLScanLookAhead (void) { if (nextToken < lastToken) { return TokenList[nextToken]; } else { lastToken = 0; line = inputStream_nextLine (scanFile); if (line != (char *) 0) { LCLScanLine (line); nextToken = 0; return LCLScanLookAhead (); } else { return LCLScanEofToken (); } } } void LCLScanFreshToken (/*@only@*/ ltoken tok) { if (lastToken < MAXLINE) { TokenList[lastToken++] = tok; } else { llbugexitlit ("LCLScanFreshToken: out of range"); } } inputStream LCLScanSource (void) { return scanFile; } void LCLScanInit (void) { } void LCLScanReset (inputStream s) { scanFile = s; lastToken = 0; nextToken = lastToken + 1; lineNumber = 0; } void LCLScanCleanup (void) { } splint-3.1.2.dfsg1/src/lsymbol.c0000644021234200000250000001767707630461221014102 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** lsymbol.c ** ** String manager ** ** This module implements an abstraction for efficiently managing ** string comparisons. It alloctes and manages a string context, ** which consists of three major data structures: ** - a StringEntry table ** - a character-string table ** - a hash table ** ** A StringEntry table is made of of StringEntries. StringEntries ** are linked in hash-chains to support fast lookup. Every ** allocated StringEntry corresponds to a unique character-string ** in the character-string table. StringEntries can be referenced ** via Symbol values. ** ** A character-string table is composed of character-strings. A ** character-string is a variable length byte array that is always ** null-terminated ('\0'). ** ** A hash table manages the start of each hash-list of StringEntries. ** StringEntries are entered into the hash-list by hashing on its ** character-string representation. ** ** This module provides routines for retrieving a unique Symbol for a ** given character-string, and returning the character-string given its ** corresponding Symbol. An item is allocated in both tables whenever a ** new character-string is encountered, otherwise the Symbol for the ** character-string is found and returned. ** ** AUTHORS: ** ** Shota Aki ** ** MODIFICATION HISTORY: ** ** {0} Aki at Digital -- 89.08.07 -- original ** {1} Aki at Digital -- 89.11.13 -- context switchable ** {2} Aki at Digital -- 89.11.28 -- removed use of TABLES interface ** {3} Aki at Digital -- 89.11.29 -- moved to RC ** {4} Aki at Digital -- 90.04.10 -- support primary-context ** {5} McKeeman at Digital -- 90.05.08 -- C to Larch SL ** {6} Wild at Digital -- 91.06.26 -- Update copyright notice. ** {n} Who at Where -- yy.mm.dd -- what */ # include "splintMacros.nf" # include "basic.h" /*@+ignorequals@*/ /*@constant int NULLFACTOR; @*/ # define NULLFACTOR 1 typedef Handle CharIndex; typedef struct { lsymbol HashNext; CharIndex i; } StringEntry; static void AllocCharSpace (unsigned p_newSize) /*@modifies internalState@*/ ; static CharIndex AllocChar (/*@unique@*/ char *p_name) /*@modifies internalState@*/ ; static void AllocEntrySpace (unsigned p_newSize) /*@modifies internalState@*/ ; static lsymbol AllocEntry (char *p_name, long unsigned p_hashValue) /*@modifies internalState@*/ ; static /*@only@*/ /*@null@*/ lsymbol *hashArray = NULL; static long unsigned MaxChar; static CharIndex FreeChar; static /*@only@*/ /*@null@*/ char *CharString; static long unsigned MaxEntry; static lsymbol FreeEntry; static /*@only@*/ /*@null@*/ StringEntry *Entry; lsymbol lsymbol_fromString (cstring s) { if (cstring_isUndefined (s)) { return lsymbol_undefined; } else { return (lsymbol_fromChars (cstring_toCharsSafe (s))); } } lsymbol lsymbol_fromChars (/*@temp@*/ char *name) { lsymbol ss; long unsigned hashValue; unsigned h = 0; char *p = name; while (*p != '\0') { h = (h << 1) + (unsigned) (*p++); } hashValue = h & HASHMASK; if (hashArray == NULL) /* evs - was MaxIndex == 0 */ { /* nothing initialized */ ss = AllocEntry (name, hashValue); } else { ss = hashArray[hashValue]; /* start of hash chain */ if (ss == lsymbol_undefined) { /* hash not initialized */ ss = AllocEntry (name, hashValue); } else { /* * Traverse hash-chain. Loop terminates when * a match is found or end of chain is encountered. */ llassert (Entry != NULL); llassert (CharString != NULL); while (strcmp (&CharString[Entry[ss].i], name) != 0) { if (lsymbol_undefined == (ss = Entry[ss].HashNext)) { ss = AllocEntry (name, hashValue); break; } } } } return ss; } cstring lsymbol_toString (lsymbol ss) { return (cstring_fromChars (lsymbol_toChars (ss))); } char * lsymbol_toCharsSafe (lsymbol ss) { char *ret = lsymbol_toChars (ss); if (ret == NULL) { ret = mstring_create (0); } return ret; } char *lsymbol_toChars (lsymbol ss) { if (lsymbol_isDefined (ss)) { if (ss >= FreeEntry) { llcontbug (message ("lsymbol_toChars: invalid lsymbol: %d", ss)); return NULL; } llassert (Entry != NULL); llassert (CharString != NULL); return &CharString[Entry[ss].i]; } else { return NULL; } } static void AllocCharSpace (unsigned newSize) { llassert (newSize > MaxChar); CharString = (char *) drealloc ((void *) CharString, newSize * sizeof (*CharString)); MaxChar = newSize; /*@-compdef@*/ } /*@=compdef@*/ static CharIndex AllocChar (/*@unique@*/ char *name) { int namelength; CharIndex retVal; long unsigned size; CharIndex unused; namelength = size_toInt (strlen (name)); unused = FreeChar; size = MaxChar; if ((unused + namelength + NULLFACTOR) > size) { if (size == 0) size = INITCHARSTRING; else size = (unsigned) (DELTACHARSTRING * size); AllocCharSpace (size); } llassert (CharString != NULL); retVal = unused; strcpy (&CharString[unused], name); unused += namelength; CharString[unused] = '\0'; unused += 1; FreeChar = unused; return retVal; } static void AllocEntrySpace (unsigned newSize) { llassert (newSize > MaxEntry); /* Casts mess up checking here. */ /*@-mustfree@*/ Entry = (StringEntry *) drealloc ((void *) Entry, newSize * sizeof (*Entry)); /*@=mustfree@*/ if (MaxEntry == 0) MaxEntry = 1; FreeEntry = MaxEntry; MaxEntry = newSize; /*@-compdef@*/ } /*@=compdef@*/ static lsymbol AllocEntry (char *name, long unsigned hashValue) { lsymbol retVal; long unsigned size; size = MaxEntry; if ((retVal = FreeEntry) == size) { if (size == 0) { size = INITSTRINGENTRY; } else { size = (unsigned) (DELTASTRINGENTRY * size); } AllocEntrySpace (size); retVal = FreeEntry; } FreeEntry = retVal + 1; llassert (hashArray != NULL); llassert (Entry != NULL); Entry[retVal].HashNext = hashArray[hashValue]; hashArray[hashValue] = retVal; Entry[retVal].i = AllocChar (name); return retVal; } void lsymbol_initMod (void) /*@globals undef CharString, undef Entry; @*/ { int i; if (hashArray != NULL) { sfree (hashArray); } hashArray = (lsymbol *) dmalloc (HASHSIZE * sizeof (*hashArray)); for (i = 0; i < HASHSIZE; i++) { hashArray[i] = lsymbol_undefined; } MaxChar = 0; MaxEntry = 0; FreeChar = 0; FreeEntry = 0; CharString = (char *) 0; Entry = (StringEntry *) 0; /*@-compdef@*/ } /*@=compdef@*/ void lsymbol_destroyMod (void) /*@globals killed Entry, killed CharString, killed hashArray@*/ { sfree (Entry); sfree (CharString); sfree (hashArray); } void lsymbol_printStats (void) { /* only for debugging */ printf ("Number of lsymbols generated = %d\n", (int) FreeEntry); } /* ** note lsymbol_setbool, etc. defined in abstract.c */ splint-3.1.2.dfsg1/src/mapping.c0000644021234200000250000000543007646432515014047 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mapping.c ** ** Module for lsymbol maps. ** ** AUTHOR: ** Yang Meng Tan, ** Massachusetts Institute of Technology */ # include "splintMacros.nf" # include "basic.h" /*@constant int MAPPING_SIZE; @*/ # define MAPPING_SIZE 127 /* use lower-order bits by masking out higher order bits */ /*@-macrofcndecl@*/ # define MMASH(key) ((unsigned int) ((key) & MAPPING_SIZE)) /*@=macrofcndecl@*/ static void mappair_free (/*@null@*/ /*@only@*/ mappair *p) { if (p == NULL) { return; } else { mappair_free (p->next); sfree (p); } } void mapping_free (/*@only@*/ mapping m) { int i; for (i = 0; i <= MAPPING_SIZE; i++) { mappair_free (m->buckets[i]); } sfree (m->buckets); sfree (m); } /*@only@*/ mapping mapping_create (void) { int i; mapping t = (mapping) dmalloc (sizeof (*t)); t->buckets = (mappair **) dmalloc ((MAPPING_SIZE + 1) * sizeof (*t->buckets)); t->count = 0; for (i = 0; i <= MAPPING_SIZE; i++) { t->buckets[i] = (mappair *) 0; } return t; } lsymbol mapping_find (mapping t, lsymbol domain) { mappair *entry; unsigned int key; key = MMASH (domain); entry = t->buckets[key]; for (; entry != NULL; entry = entry->next) { if (entry->domain == domain) return entry->range; } return lsymbol_undefined; } void mapping_bind (mapping t, lsymbol domain, lsymbol range) { /* add the binding (domain -> range) to t */ /* can assume that the binding is a new one in m, so no need to check. */ mappair *entry; mappair *newentry = (mappair *) dmalloc (sizeof (*newentry)); unsigned int key; key = MMASH (domain); /*@-deparrays@*/ entry = t->buckets[key]; /*@=deparrays@*/ newentry->domain = domain; newentry->range = range; newentry->next = entry; t->buckets[key] = newentry; t->count++; } splint-3.1.2.dfsg1/src/cgrammar.c0000644021234200000250000111704310645776225014214 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { BADTOK = 258, SKIPTOK = 259, CTOK_ELIPSIS = 260, CASE = 261, DEFAULT = 262, CIF = 263, CELSE = 264, SWITCH = 265, WHILE = 266, DO = 267, CFOR = 268, GOTO = 269, CONTINUE = 270, BREAK = 271, RETURN = 272, TSEMI = 273, TLBRACE = 274, TRBRACE = 275, TCOMMA = 276, TCOLON = 277, TASSIGN = 278, TLPAREN = 279, TRPAREN = 280, TLSQBR = 281, TRSQBR = 282, TDOT = 283, TAMPERSAND = 284, TEXCL = 285, TTILDE = 286, TMINUS = 287, TPLUS = 288, TMULT = 289, TDIV = 290, TPERCENT = 291, TLT = 292, TGT = 293, TCIRC = 294, TBAR = 295, TQUEST = 296, CSIZEOF = 297, CALIGNOF = 298, CTYPEOF = 299, ARROW_OP = 300, CTYPEDEF = 301, COFFSETOF = 302, INC_OP = 303, DEC_OP = 304, LEFT_OP = 305, RIGHT_OP = 306, LE_OP = 307, GE_OP = 308, EQ_OP = 309, NE_OP = 310, AND_OP = 311, OR_OP = 312, MUL_ASSIGN = 313, DIV_ASSIGN = 314, MOD_ASSIGN = 315, ADD_ASSIGN = 316, SUB_ASSIGN = 317, LEFT_ASSIGN = 318, RIGHT_ASSIGN = 319, AND_ASSIGN = 320, XOR_ASSIGN = 321, OR_ASSIGN = 322, CSTRUCT = 323, CUNION = 324, CENUM = 325, VA_ARG = 326, VA_DCL = 327, QWARN = 328, QGLOBALS = 329, QMODIFIES = 330, QNOMODS = 331, QCONSTANT = 332, QFUNCTION = 333, QITER = 334, QDEFINES = 335, QUSES = 336, QALLOCATES = 337, QSETS = 338, QRELEASES = 339, QPRECLAUSE = 340, QPOSTCLAUSE = 341, QINVARIANT = 342, QALT = 343, QUNDEF = 344, QKILLED = 345, QENDMACRO = 346, LLMACRO = 347, LLMACROITER = 348, LLMACROEND = 349, TENDMACRO = 350, QDREVEALSTATE = 351, QSWITCHBREAK = 352, QLOOPBREAK = 353, QINNERBREAK = 354, QSAFEBREAK = 355, QINNERCONTINUE = 356, QFALLTHROUGH = 357, QLINTNOTREACHED = 358, QLINTFALLTHROUGH = 359, QLINTFALLTHRU = 360, QARGSUSED = 361, QPRINTFLIKE = 362, QLINTPRINTFLIKE = 363, QSCANFLIKE = 364, QMESSAGELIKE = 365, QNOTREACHED = 366, QCONST = 367, QRESTRICT = 368, QVOLATILE = 369, QINLINE = 370, QEXTENSION = 371, QEXTERN = 372, QSTATIC = 373, QAUTO = 374, QREGISTER = 375, QOUT = 376, QIN = 377, QYIELD = 378, QONLY = 379, QTEMP = 380, QSHARED = 381, QREF = 382, QUNIQUE = 383, QCHECKED = 384, QUNCHECKED = 385, QCHECKEDSTRICT = 386, QCHECKMOD = 387, QKEEP = 388, QKEPT = 389, QPARTIAL = 390, QSPECIAL = 391, QOWNED = 392, QDEPENDENT = 393, QRETURNED = 394, QEXPOSED = 395, QNULL = 396, QOBSERVER = 397, QISNULL = 398, QEXITS = 399, QMAYEXIT = 400, QNEVEREXIT = 401, QTRUEEXIT = 402, QFALSEEXIT = 403, QLONG = 404, QSIGNED = 405, QUNSIGNED = 406, QSHORT = 407, QUNUSED = 408, QSEF = 409, QNOTNULL = 410, QRELNULL = 411, QABSTRACT = 412, QNUMABSTRACT = 413, QCONCRETE = 414, QMUTABLE = 415, QIMMUTABLE = 416, QTRUENULL = 417, QFALSENULL = 418, QEXTERNAL = 419, QREFCOUNTED = 420, QREFS = 421, QNEWREF = 422, QTEMPREF = 423, QKILLREF = 424, QRELDEF = 425, CGCHAR = 426, CBOOL = 427, CINT = 428, CGFLOAT = 429, CDOUBLE = 430, CVOID = 431, QANYTYPE = 432, QINTEGRALTYPE = 433, QUNSIGNEDINTEGRALTYPE = 434, QSIGNEDINTEGRALTYPE = 435, QNULLTERMINATED = 436, QSETBUFFERSIZE = 437, QSETSTRINGLENGTH = 438, QMAXSET = 439, QMAXREAD = 440, QTESTINRANGE = 441, TCAND = 442, IDENTIFIER = 443, NEW_IDENTIFIER = 444, TYPE_NAME_OR_ID = 445, CANNOTATION = 446, CCONSTANT = 447, ITER_NAME = 448, ITER_ENDNAME = 449, TYPE_NAME = 450, METASTATE_NAME = 451 }; #endif /* Tokens. */ #define BADTOK 258 #define SKIPTOK 259 #define CTOK_ELIPSIS 260 #define CASE 261 #define DEFAULT 262 #define CIF 263 #define CELSE 264 #define SWITCH 265 #define WHILE 266 #define DO 267 #define CFOR 268 #define GOTO 269 #define CONTINUE 270 #define BREAK 271 #define RETURN 272 #define TSEMI 273 #define TLBRACE 274 #define TRBRACE 275 #define TCOMMA 276 #define TCOLON 277 #define TASSIGN 278 #define TLPAREN 279 #define TRPAREN 280 #define TLSQBR 281 #define TRSQBR 282 #define TDOT 283 #define TAMPERSAND 284 #define TEXCL 285 #define TTILDE 286 #define TMINUS 287 #define TPLUS 288 #define TMULT 289 #define TDIV 290 #define TPERCENT 291 #define TLT 292 #define TGT 293 #define TCIRC 294 #define TBAR 295 #define TQUEST 296 #define CSIZEOF 297 #define CALIGNOF 298 #define CTYPEOF 299 #define ARROW_OP 300 #define CTYPEDEF 301 #define COFFSETOF 302 #define INC_OP 303 #define DEC_OP 304 #define LEFT_OP 305 #define RIGHT_OP 306 #define LE_OP 307 #define GE_OP 308 #define EQ_OP 309 #define NE_OP 310 #define AND_OP 311 #define OR_OP 312 #define MUL_ASSIGN 313 #define DIV_ASSIGN 314 #define MOD_ASSIGN 315 #define ADD_ASSIGN 316 #define SUB_ASSIGN 317 #define LEFT_ASSIGN 318 #define RIGHT_ASSIGN 319 #define AND_ASSIGN 320 #define XOR_ASSIGN 321 #define OR_ASSIGN 322 #define CSTRUCT 323 #define CUNION 324 #define CENUM 325 #define VA_ARG 326 #define VA_DCL 327 #define QWARN 328 #define QGLOBALS 329 #define QMODIFIES 330 #define QNOMODS 331 #define QCONSTANT 332 #define QFUNCTION 333 #define QITER 334 #define QDEFINES 335 #define QUSES 336 #define QALLOCATES 337 #define QSETS 338 #define QRELEASES 339 #define QPRECLAUSE 340 #define QPOSTCLAUSE 341 #define QINVARIANT 342 #define QALT 343 #define QUNDEF 344 #define QKILLED 345 #define QENDMACRO 346 #define LLMACRO 347 #define LLMACROITER 348 #define LLMACROEND 349 #define TENDMACRO 350 #define QDREVEALSTATE 351 #define QSWITCHBREAK 352 #define QLOOPBREAK 353 #define QINNERBREAK 354 #define QSAFEBREAK 355 #define QINNERCONTINUE 356 #define QFALLTHROUGH 357 #define QLINTNOTREACHED 358 #define QLINTFALLTHROUGH 359 #define QLINTFALLTHRU 360 #define QARGSUSED 361 #define QPRINTFLIKE 362 #define QLINTPRINTFLIKE 363 #define QSCANFLIKE 364 #define QMESSAGELIKE 365 #define QNOTREACHED 366 #define QCONST 367 #define QRESTRICT 368 #define QVOLATILE 369 #define QINLINE 370 #define QEXTENSION 371 #define QEXTERN 372 #define QSTATIC 373 #define QAUTO 374 #define QREGISTER 375 #define QOUT 376 #define QIN 377 #define QYIELD 378 #define QONLY 379 #define QTEMP 380 #define QSHARED 381 #define QREF 382 #define QUNIQUE 383 #define QCHECKED 384 #define QUNCHECKED 385 #define QCHECKEDSTRICT 386 #define QCHECKMOD 387 #define QKEEP 388 #define QKEPT 389 #define QPARTIAL 390 #define QSPECIAL 391 #define QOWNED 392 #define QDEPENDENT 393 #define QRETURNED 394 #define QEXPOSED 395 #define QNULL 396 #define QOBSERVER 397 #define QISNULL 398 #define QEXITS 399 #define QMAYEXIT 400 #define QNEVEREXIT 401 #define QTRUEEXIT 402 #define QFALSEEXIT 403 #define QLONG 404 #define QSIGNED 405 #define QUNSIGNED 406 #define QSHORT 407 #define QUNUSED 408 #define QSEF 409 #define QNOTNULL 410 #define QRELNULL 411 #define QABSTRACT 412 #define QNUMABSTRACT 413 #define QCONCRETE 414 #define QMUTABLE 415 #define QIMMUTABLE 416 #define QTRUENULL 417 #define QFALSENULL 418 #define QEXTERNAL 419 #define QREFCOUNTED 420 #define QREFS 421 #define QNEWREF 422 #define QTEMPREF 423 #define QKILLREF 424 #define QRELDEF 425 #define CGCHAR 426 #define CBOOL 427 #define CINT 428 #define CGFLOAT 429 #define CDOUBLE 430 #define CVOID 431 #define QANYTYPE 432 #define QINTEGRALTYPE 433 #define QUNSIGNEDINTEGRALTYPE 434 #define QSIGNEDINTEGRALTYPE 435 #define QNULLTERMINATED 436 #define QSETBUFFERSIZE 437 #define QSETSTRINGLENGTH 438 #define QMAXSET 439 #define QMAXREAD 440 #define QTESTINRANGE 441 #define TCAND 442 #define IDENTIFIER 443 #define NEW_IDENTIFIER 444 #define TYPE_NAME_OR_ID 445 #define CANNOTATION 446 #define CCONSTANT 447 #define ITER_NAME 448 #define ITER_ENDNAME 449 #define TYPE_NAME 450 #define METASTATE_NAME 451 /* Copy the first part of user declarations. */ /* ** ** cgrammar.y ** ** Yacc/Bison grammar for extended ANSI C used by Splint. ** ** original grammar by Nate Osgood --- ** hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993 ** ** changes for Splint --- handle typedef names correctly ** fix struct/union parsing bug (empty struct is accepted) ** add productions to handle macros --- require ** error correction --- main source of conflicts in grammar. ** need to process initializations sequentially, L->R ** ** production names are cryptic, so more productions fit on one line ** ** conflicts: 87 shift/reduce, 18 reduce/reduce ** most of these are due to handling macros ** a few are due to handling type expressions */ /*@=allmacros@*/ extern int yylex (); extern void yyerror (char *); # include "splintMacros.nf" # include "basic.h" # include "cscanner.h" # include "cscannerHelp.h" # include "cgrammar.h" # include "exprChecks.h" /*@-allmacros@*/ /*@-matchfields@*/ # define SHOWCSYM FALSE /* ** This is necessary, or else when the bison-generated code #include's malloc.h, ** there will be a parse error. ** ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations ** in bison-generated files under Win32. */ # ifdef WIN32 # undef malloc # undef calloc # undef realloc # endif /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined cgrammar_YYSTYPE && ! defined cgrammar_YYSTYPE_IS_DECLARED typedef union cgrammar_YYSTYPE { lltok tok; int count; qual typequal; qualList tquallist; ctype ctyp; /*@dependent@*/ sRef sr; /*@only@*/ sRef osr; /*@only@*/ functionClauseList funcclauselist; /*@only@*/ functionClause funcclause; /*@only@*/ flagSpec flagspec; /*@only@*/ globalsClause globsclause; /*@only@*/ modifiesClause modsclause; /*@only@*/ warnClause warnclause; /*@only@*/ stateClause stateclause; /*@only@*/ pointers pointers; /*@only@*/ functionConstraint fcnconstraint; /*@only@*/ metaStateConstraint msconstraint; /*@only@*/ metaStateSpecifier msspec; /*@only@*/ metaStateExpression msexpr; /*@observer@*/ metaStateInfo msinfo; /*@only@*/ sRefList srlist; /*@only@*/ globSet globset; /*@only@*/ qtype qtyp; /*@only@*/ cstring cname; /*@observer@*/ annotationInfo annotation; /*@only@*/ idDecl ntyp; /*@only@*/ idDeclList ntyplist; /*@only@*/ uentryList flist; /*@owned@*/ uentryList entrylist; /*@observer@*/ /*@dependent@*/ uentry entry; /*@only@*/ uentry oentry; /*@only@*/ exprNode expr; /*@only@*/ enumNameList enumnamelist; /*@only@*/ exprNodeList exprlist; /*@only@*/ sRefSet srset; /*@only@*/ cstringList cstringlist; /*drl added 1/19/2001 */ constraint con; constraintList conL; constraintExpr conE; /* drl */ } /* Line 193 of yacc.c. */ cgrammar_YYSTYPE; # define yystype cgrammar_YYSTYPE /* obsolescent; will be withdrawn */ # define cgrammar_YYSTYPE_IS_DECLARED 1 # define cgrammar_YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined cgrammar_YYSTYPE_IS_TRIVIAL && cgrammar_YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; cgrammar_YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (cgrammar_YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 262 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 6819 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 197 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 276 /* YYNRULES -- Number of rules. */ #define YYNRULES 719 /* YYNRULES -- Number of states. */ #define YYNSTATES 1264 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 451 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 6, 8, 11, 14, 16, 18, 20, 22, 24, 26, 28, 37, 49, 50, 56, 58, 62, 64, 67, 69, 76, 80, 87, 88, 95, 96, 104, 106, 113, 117, 124, 125, 132, 133, 141, 142, 143, 154, 158, 162, 166, 169, 171, 175, 176, 181, 182, 187, 189, 193, 195, 197, 199, 203, 205, 209, 211, 213, 215, 217, 219, 221, 226, 232, 234, 236, 238, 240, 244, 249, 252, 256, 260, 264, 266, 268, 270, 271, 274, 275, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 305, 306, 311, 313, 316, 317, 321, 323, 327, 329, 331, 332, 335, 339, 342, 344, 348, 351, 352, 355, 357, 359, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 381, 383, 385, 387, 391, 392, 396, 397, 398, 403, 406, 409, 411, 413, 415, 417, 421, 426, 429, 433, 437, 441, 443, 445, 447, 451, 453, 455, 459, 464, 467, 471, 475, 479, 480, 482, 484, 488, 490, 492, 494, 498, 500, 502, 503, 508, 510, 515, 519, 524, 531, 537, 543, 546, 549, 557, 559, 563, 565, 568, 571, 574, 577, 580, 583, 586, 589, 593, 595, 599, 604, 606, 616, 617, 621, 622, 623, 628, 631, 636, 639, 641, 646, 648, 652, 656, 660, 662, 666, 670, 672, 676, 680, 682, 686, 690, 694, 698, 700, 704, 708, 710, 714, 716, 720, 722, 726, 728, 729, 734, 736, 737, 742, 744, 745, 746, 753, 754, 755, 763, 765, 769, 773, 777, 781, 785, 789, 793, 797, 801, 805, 809, 811, 815, 816, 818, 820, 822, 824, 826, 830, 831, 841, 842, 854, 856, 858, 861, 862, 869, 870, 879, 884, 889, 890, 891, 894, 896, 901, 904, 906, 911, 912, 917, 919, 923, 928, 931, 934, 937, 939, 942, 946, 949, 951, 955, 957, 959, 961, 963, 965, 968, 969, 976, 979, 982, 983, 990, 991, 997, 999, 1001, 1003, 1005, 1007, 1009, 1011, 1013, 1015, 1017, 1019, 1021, 1023, 1025, 1027, 1029, 1031, 1033, 1035, 1037, 1039, 1041, 1043, 1045, 1047, 1049, 1051, 1053, 1055, 1057, 1059, 1061, 1063, 1065, 1067, 1069, 1071, 1073, 1075, 1077, 1079, 1081, 1083, 1085, 1087, 1089, 1091, 1093, 1095, 1097, 1099, 1101, 1103, 1106, 1109, 1112, 1115, 1118, 1121, 1124, 1127, 1130, 1133, 1136, 1139, 1142, 1145, 1148, 1151, 1154, 1157, 1160, 1163, 1166, 1169, 1172, 1175, 1178, 1181, 1185, 1187, 1192, 1194, 1198, 1201, 1204, 1207, 1208, 1210, 1211, 1212, 1213, 1226, 1227, 1228, 1240, 1247, 1254, 1255, 1256, 1267, 1268, 1269, 1280, 1286, 1292, 1297, 1302, 1303, 1305, 1307, 1310, 1316, 1320, 1323, 1328, 1330, 1334, 1339, 1346, 1347, 1356, 1361, 1363, 1367, 1370, 1372, 1377, 1379, 1381, 1384, 1387, 1389, 1392, 1394, 1397, 1399, 1401, 1403, 1405, 1408, 1410, 1413, 1416, 1420, 1422, 1426, 1428, 1432, 1434, 1436, 1440, 1441, 1444, 1445, 1450, 1455, 1457, 1459, 1462, 1464, 1466, 1469, 1470, 1472, 1478, 1481, 1485, 1489, 1494, 1498, 1503, 1508, 1514, 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1539, 1541, 1543, 1545, 1548, 1551, 1559, 1566, 1569, 1570, 1571, 1582, 1583, 1590, 1592, 1594, 1596, 1598, 1601, 1603, 1605, 1607, 1609, 1611, 1613, 1615, 1619, 1621, 1622, 1626, 1629, 1632, 1634, 1636, 1638, 1640, 1642, 1644, 1646, 1648, 1650, 1652, 1656, 1658, 1660, 1662, 1665, 1668, 1669, 1672, 1673, 1678, 1679, 1686, 1687, 1691, 1692, 1698, 1702, 1705, 1709, 1710, 1711, 1712, 1713, 1714, 1716, 1719, 1722, 1726, 1729, 1733, 1737, 1742, 1745, 1748, 1752, 1756, 1761, 1763, 1766, 1768, 1771, 1773, 1777, 1779, 1784, 1786, 1789, 1791, 1794, 1796, 1799, 1801, 1806, 1809, 1810, 1816, 1817, 1824, 1829, 1834, 1835, 1836, 1847, 1849, 1850, 1855, 1857, 1859, 1861, 1863, 1865, 1868, 1870, 1874, 1876, 1881, 1885, 1890, 1897, 1903, 1909, 1912, 1915, 1917, 1920, 1923, 1926, 1929, 1932, 1935, 1938, 1941, 1943, 1945, 1950, 1952, 1956, 1960, 1964, 1966, 1970, 1974, 1976, 1980, 1984, 1986, 1990, 1994, 1998, 2002, 2004, 2008, 2012, 2014, 2018, 2020, 2024, 2026, 2030, 2032, 2036, 2038, 2042, 2044, 2045, 2046, 2053, 2054, 2055, 2063, 2065, 2069, 2073, 2077, 2081, 2085, 2089, 2093, 2097, 2101, 2105, 2109, 2111, 2112, 2114, 2117, 2125, 2128, 2131, 2139, 2146, 2149, 2153, 2156, 2160, 2163, 2167, 2171, 2175, 2179, 2182, 2186, 2187, 2189, 2190, 2192, 2194, 2196, 2198, 2200, 2202, 2204, 2206, 2208, 2213 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 198, 0, -1, -1, 199, -1, 200, -1, 199, 200, -1, 261, 468, -1, 201, -1, 202, -1, 212, -1, 215, -1, 303, -1, 18, -1, 1, -1, 77, 347, 361, 371, 361, 468, 312, 91, -1, 77, 347, 361, 371, 361, 23, 312, 319, 318, 468, 91, -1, -1, 78, 203, 204, 468, 91, -1, 205, -1, 347, 361, 205, -1, 209, -1, 375, 209, -1, 471, -1, 312, 24, 361, 371, 312, 25, -1, 206, 26, 27, -1, 206, 26, 312, 302, 27, 361, -1, -1, 206, 313, 24, 25, 207, 233, -1, -1, 206, 313, 24, 372, 25, 208, 233, -1, 471, -1, 312, 24, 361, 205, 312, 25, -1, 209, 26, 27, -1, 209, 26, 312, 302, 27, 361, -1, -1, 209, 313, 24, 25, 210, 234, -1, -1, 209, 313, 24, 372, 25, 211, 234, -1, -1, -1, 79, 471, 24, 372, 25, 213, 234, 214, 468, 91, -1, 92, 403, 95, -1, 93, 389, 95, -1, 94, 390, 95, -1, 92, 95, -1, 256, -1, 218, 23, 221, -1, -1, 230, 219, 22, 222, -1, -1, 5, 220, 22, 222, -1, 218, -1, 218, 40, 221, -1, 196, -1, 187, -1, 56, -1, 225, 223, 224, -1, 225, -1, 228, 227, 228, -1, 184, -1, 185, -1, 53, -1, 52, -1, 54, -1, 229, -1, 231, 24, 228, 25, -1, 24, 228, 232, 228, 25, -1, 230, -1, 192, -1, 470, -1, 189, -1, 230, 26, 27, -1, 230, 26, 192, 27, -1, 34, 230, -1, 24, 230, 25, -1, 230, 28, 471, -1, 230, 45, 471, -1, 226, -1, 33, -1, 32, -1, -1, 235, 233, -1, -1, 236, 234, -1, 237, -1, 241, -1, 240, -1, 325, -1, 328, -1, 247, -1, 238, -1, 242, -1, 240, -1, 326, -1, 330, -1, 248, -1, 238, 91, -1, -1, 74, 239, 249, 468, -1, 76, -1, 242, 91, -1, -1, 75, 243, 262, -1, 245, -1, 245, 40, 244, -1, 189, -1, 247, -1, -1, 248, 91, -1, 73, 244, 442, -1, 73, 244, -1, 250, -1, 249, 21, 250, -1, 251, 252, -1, -1, 253, 251, -1, 470, -1, 189, -1, 303, -1, 89, -1, 90, -1, 121, -1, 122, -1, 135, -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, -1, 85, -1, 86, -1, 371, -1, 347, 361, 371, -1, -1, 19, 258, 420, -1, -1, -1, 259, 424, 260, 413, -1, 216, 257, -1, 265, 468, -1, 468, -1, 470, -1, 189, -1, 190, -1, 263, 26, 27, -1, 263, 26, 264, 27, -1, 34, 263, -1, 24, 263, 25, -1, 263, 28, 471, -1, 263, 45, 471, -1, 263, -1, 442, -1, 263, -1, 265, 21, 263, -1, 470, -1, 189, -1, 266, 26, 27, -1, 266, 26, 264, 27, -1, 34, 266, -1, 24, 266, 25, -1, 266, 28, 471, -1, 266, 45, 471, -1, -1, 268, -1, 266, -1, 268, 21, 266, -1, 470, -1, 189, -1, 442, -1, 24, 300, 25, -1, 190, -1, 116, -1, -1, 24, 270, 413, 25, -1, 269, -1, 271, 26, 300, 27, -1, 271, 24, 25, -1, 271, 24, 272, 25, -1, 71, 24, 299, 21, 383, 25, -1, 271, 361, 28, 471, 312, -1, 271, 361, 45, 471, 312, -1, 271, 48, -1, 271, 49, -1, 24, 383, 25, 19, 425, 469, 20, -1, 299, -1, 272, 21, 299, -1, 271, -1, 48, 273, -1, 49, 273, -1, 29, 281, -1, 34, 281, -1, 33, 281, -1, 32, 281, -1, 31, 281, -1, 30, 281, -1, 278, 276, 279, -1, 275, -1, 274, 28, 471, -1, 274, 26, 300, 27, -1, 471, -1, 47, 312, 24, 383, 361, 21, 274, 25, 312, -1, -1, 312, 277, 280, -1, -1, -1, 42, 24, 383, 25, -1, 42, 273, -1, 43, 24, 383, 25, -1, 43, 273, -1, 273, -1, 24, 383, 25, 281, -1, 281, -1, 282, 34, 281, -1, 282, 35, 281, -1, 282, 36, 281, -1, 282, -1, 283, 33, 282, -1, 283, 32, 282, -1, 283, -1, 284, 50, 283, -1, 284, 51, 283, -1, 284, -1, 285, 37, 284, -1, 285, 38, 284, -1, 285, 52, 284, -1, 285, 53, 284, -1, 285, -1, 286, 54, 285, -1, 286, 55, 285, -1, 286, -1, 287, 29, 286, -1, 287, -1, 288, 39, 287, -1, 288, -1, 289, 40, 288, -1, 289, -1, -1, 290, 56, 291, 289, -1, 290, -1, -1, 292, 57, 293, 290, -1, 292, -1, -1, -1, 292, 41, 295, 22, 296, 294, -1, -1, -1, 292, 41, 297, 300, 22, 298, 294, -1, 294, -1, 273, 23, 299, -1, 273, 58, 299, -1, 273, 59, 299, -1, 273, 60, 299, -1, 273, 61, 299, -1, 273, 62, 299, -1, 273, 63, 299, -1, 273, 64, 299, -1, 273, 65, 299, -1, 273, 66, 299, -1, 273, 67, 299, -1, 299, -1, 300, 21, 299, -1, -1, 300, -1, 294, -1, 304, -1, 72, -1, 310, -1, 347, 312, 18, -1, -1, 347, 361, 371, 361, 305, 312, 318, 18, 312, -1, -1, 347, 361, 371, 361, 23, 306, 312, 319, 318, 18, 312, -1, 308, -1, 195, -1, 371, 361, -1, -1, 371, 361, 23, 309, 312, 319, -1, -1, 46, 347, 311, 361, 316, 312, 246, 18, -1, 46, 347, 312, 18, -1, 46, 314, 312, 18, -1, -1, -1, 315, 312, -1, 308, -1, 314, 21, 361, 308, -1, 317, 312, -1, 307, -1, 316, 21, 361, 307, -1, -1, 318, 21, 361, 308, -1, 299, -1, 19, 323, 20, -1, 19, 323, 21, 20, -1, 320, 319, -1, 321, 23, -1, 471, 22, -1, 322, -1, 321, 322, -1, 26, 302, 27, -1, 28, 471, -1, 319, -1, 323, 21, 319, -1, 117, -1, 115, -1, 118, -1, 119, -1, 120, -1, 326, 91, -1, -1, 254, 361, 327, 268, 468, 312, -1, 330, 91, -1, 255, 361, -1, -1, 329, 336, 331, 267, 468, 312, -1, -1, 329, 332, 333, 468, 312, -1, 224, -1, 217, -1, 144, -1, 145, -1, 147, -1, 148, -1, 146, -1, 129, -1, 132, -1, 130, -1, 131, -1, 137, -1, 138, -1, 123, -1, 125, -1, 124, -1, 133, -1, 134, -1, 126, -1, 128, -1, 141, -1, 143, -1, 156, -1, 155, -1, 140, -1, 142, -1, 181, -1, 191, -1, 139, -1, 154, -1, 153, -1, 164, -1, 162, -1, 163, -1, 157, -1, 158, -1, 159, -1, 160, -1, 161, -1, 165, -1, 166, -1, 169, -1, 170, -1, 167, -1, 168, -1, 152, -1, 149, -1, 150, -1, 151, -1, 121, -1, 122, -1, 135, -1, 136, -1, 112, 312, -1, 114, 312, -1, 113, 312, -1, 343, 312, -1, 336, 312, -1, 334, 312, -1, 337, 312, -1, 335, 312, -1, 339, 312, -1, 338, 312, -1, 340, 312, -1, 341, 312, -1, 171, 361, -1, 173, 361, -1, 172, 361, -1, 174, 361, -1, 175, 361, -1, 176, 361, -1, 177, 361, -1, 178, 361, -1, 179, 361, -1, 180, 361, -1, 472, 361, -1, 352, 361, -1, 366, 361, -1, 342, 361, -1, 312, 347, 312, -1, 349, -1, 349, 88, 348, 91, -1, 383, -1, 383, 21, 348, -1, 324, 350, -1, 344, 350, -1, 345, 350, -1, -1, 347, -1, -1, -1, -1, 361, 68, 471, 312, 19, 353, 417, 362, 418, 354, 20, 351, -1, -1, -1, 361, 69, 471, 312, 19, 355, 417, 362, 418, 356, 20, -1, 361, 68, 471, 312, 19, 20, -1, 361, 69, 471, 312, 19, 20, -1, -1, -1, 361, 68, 312, 19, 357, 417, 362, 418, 358, 20, -1, -1, -1, 361, 69, 312, 19, 359, 417, 362, 418, 360, 20, -1, 361, 68, 312, 19, 20, -1, 361, 69, 312, 19, 20, -1, 361, 68, 471, 361, -1, 361, 69, 471, 361, -1, -1, 363, -1, 215, -1, 362, 363, -1, 347, 361, 364, 312, 18, -1, 347, 312, 18, -1, 365, 361, -1, 364, 21, 365, 361, -1, 371, -1, 22, 312, 302, -1, 371, 22, 312, 302, -1, 361, 70, 19, 368, 20, 312, -1, -1, 361, 70, 471, 19, 367, 368, 20, 312, -1, 361, 70, 471, 312, -1, 369, -1, 368, 21, 369, -1, 368, 21, -1, 471, -1, 471, 23, 312, 302, -1, 206, -1, 385, -1, 375, 195, -1, 375, 370, -1, 206, -1, 375, 206, -1, 378, -1, 361, 376, -1, 112, -1, 113, -1, 114, -1, 373, -1, 374, 373, -1, 34, -1, 34, 374, -1, 34, 375, -1, 34, 374, 375, -1, 377, -1, 377, 21, 5, -1, 471, -1, 377, 21, 471, -1, 5, -1, 379, -1, 379, 21, 5, -1, -1, 380, 382, -1, -1, 379, 21, 381, 382, -1, 312, 347, 370, 312, -1, 471, -1, 346, -1, 346, 384, -1, 375, -1, 386, -1, 375, 386, -1, -1, 386, -1, 312, 24, 361, 384, 25, -1, 26, 27, -1, 26, 302, 27, -1, 386, 26, 27, -1, 386, 26, 302, 27, -1, 312, 24, 25, -1, 312, 24, 378, 25, -1, 386, 312, 24, 25, -1, 386, 312, 24, 378, 25, -1, 405, -1, 407, -1, 410, -1, 413, -1, 428, -1, 431, -1, 465, -1, 436, -1, 467, -1, 388, -1, 96, 24, 300, 25, -1, 391, -1, 389, -1, 398, -1, 391, 398, -1, 435, 391, -1, 464, 404, 11, 24, 300, 25, 18, -1, 464, 404, 11, 24, 300, 25, -1, 393, 398, -1, -1, -1, 13, 24, 301, 18, 301, 18, 394, 301, 395, 25, -1, -1, 193, 415, 24, 397, 439, 25, -1, 194, -1, 405, -1, 407, -1, 410, -1, 401, 424, -1, 401, -1, 402, -1, 428, -1, 399, -1, 392, -1, 396, -1, 467, -1, 24, 398, 25, -1, 1, -1, -1, 430, 400, 398, -1, 415, 19, -1, 419, 20, -1, 404, -1, 423, -1, 405, -1, 407, -1, 410, -1, 414, -1, 429, -1, 431, -1, 436, -1, 466, -1, 24, 404, 25, -1, 467, -1, 388, -1, 1, -1, 471, 22, -1, 111, 387, -1, -1, 102, 406, -1, -1, 6, 302, 408, 22, -1, -1, 102, 406, 6, 302, 409, 22, -1, -1, 7, 411, 22, -1, -1, 102, 406, 7, 412, 22, -1, 24, 413, 25, -1, 415, 421, -1, 415, 422, 416, -1, -1, -1, -1, -1, -1, 20, -1, 111, 20, -1, 427, 20, -1, 427, 111, 20, -1, 424, 20, -1, 424, 111, 20, -1, 424, 427, 20, -1, 424, 427, 111, 20, -1, 19, 420, -1, 19, 20, -1, 19, 423, 20, -1, 19, 424, 20, -1, 19, 424, 427, 20, -1, 404, -1, 423, 404, -1, 303, -1, 424, 303, -1, 426, -1, 425, 21, 426, -1, 299, -1, 19, 425, 469, 20, -1, 387, -1, 427, 387, -1, 18, -1, 300, 18, -1, 18, -1, 300, 18, -1, 300, -1, 8, 24, 300, 25, -1, 430, 387, -1, -1, 430, 387, 9, 432, 387, -1, -1, 10, 24, 300, 433, 25, 387, -1, 11, 24, 300, 25, -1, 11, 24, 300, 25, -1, -1, -1, 193, 437, 415, 24, 438, 439, 25, 413, 463, 416, -1, 441, -1, -1, 439, 440, 21, 441, -1, 462, -1, 470, -1, 190, -1, 189, -1, 192, -1, 442, 192, -1, 442, -1, 24, 300, 25, -1, 443, -1, 271, 26, 300, 27, -1, 271, 24, 25, -1, 271, 24, 272, 25, -1, 71, 24, 299, 21, 383, 25, -1, 271, 361, 28, 471, 312, -1, 271, 361, 45, 471, 312, -1, 271, 48, -1, 271, 49, -1, 444, -1, 48, 273, -1, 49, 273, -1, 29, 281, -1, 34, 281, -1, 33, 281, -1, 32, 281, -1, 31, 281, -1, 30, 281, -1, 276, -1, 445, -1, 24, 383, 25, 281, -1, 446, -1, 282, 34, 281, -1, 282, 35, 281, -1, 282, 36, 281, -1, 447, -1, 283, 33, 282, -1, 283, 32, 282, -1, 448, -1, 284, 50, 283, -1, 284, 51, 283, -1, 449, -1, 285, 37, 284, -1, 285, 38, 284, -1, 285, 52, 284, -1, 285, 53, 284, -1, 450, -1, 286, 54, 285, -1, 286, 55, 285, -1, 451, -1, 287, 29, 286, -1, 452, -1, 288, 39, 287, -1, 453, -1, 289, 40, 288, -1, 454, -1, 290, 56, 289, -1, 455, -1, 292, 57, 290, -1, 456, -1, -1, -1, 292, 41, 458, 22, 459, 294, -1, -1, -1, 292, 41, 460, 300, 22, 461, 294, -1, 457, -1, 273, 23, 299, -1, 273, 58, 299, -1, 273, 59, 299, -1, 273, 60, 299, -1, 273, 61, 299, -1, 273, 62, 299, -1, 273, 63, 299, -1, 273, 64, 299, -1, 273, 65, 299, -1, 273, 66, 299, -1, 273, 67, 299, -1, 194, -1, -1, 12, -1, 434, 387, -1, 464, 387, 11, 24, 300, 25, 18, -1, 393, 387, -1, 434, 404, -1, 464, 404, 11, 24, 300, 25, 18, -1, 464, 404, 11, 24, 300, 25, -1, 393, 404, -1, 14, 471, 18, -1, 15, 18, -1, 101, 15, 18, -1, 16, 18, -1, 97, 16, 18, -1, 98, 16, 18, -1, 99, 16, 18, -1, 100, 16, 18, -1, 17, 18, -1, 17, 300, 18, -1, -1, 18, -1, -1, 21, -1, 188, -1, 189, -1, 193, -1, 194, -1, 470, -1, 190, -1, 195, -1, 190, -1, 44, 24, 300, 25, -1, 44, 24, 383, 25, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 327, 327, 329, 333, 334, 338, 339, 340, 341, 342, 343, 344, 345, 349, 351, 356, 356, 365, 371, 376, 377, 382, 383, 385, 387, 405, 404, 436, 435, 465, 466, 468, 472, 490, 489, 502, 501, 516, 517, 515, 524, 525, 526, 527, 531, 535, 540, 540, 545, 545, 553, 554, 558, 564, 565, 569, 570, 574, 580, 581, 585, 586, 587, 591, 592, 593, 599, 600, 604, 606, 608, 610, 619, 621, 623, 625, 642, 646, 647, 654, 655, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 689, 693, 693, 702, 706, 711, 710, 725, 727, 732, 736, 737, 741, 745, 751, 756, 757, 761, 765, 766, 770, 771, 772, 776, 777, 778, 779, 780, 784, 785, 786, 787, 788, 792, 793, 797, 804, 809, 809, 815, 816, 815, 826, 837, 838, 842, 843, 844, 845, 846, 847, 848, 849, 850, 854, 855, 860, 861, 865, 867, 869, 870, 871, 872, 873, 875, 880, 881, 885, 891, 904, 905, 906, 907, 908, 909, 910, 910, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 930, 931, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 949, 950, 952, 956, 962, 962, 966, 969, 973, 974, 975, 976, 982, 983, 988, 989, 990, 991, 995, 996, 997, 1001, 1002, 1003, 1007, 1008, 1009, 1010, 1011, 1015, 1016, 1017, 1021, 1022, 1026, 1027, 1031, 1032, 1036, 1038, 1037, 1049, 1051, 1050, 1063, 1065, 1067, 1064, 1069, 1070, 1069, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1090, 1091, 1095, 1096, 1100, 1106, 1107, 1108, 1112, 1127, 1126, 1138, 1137, 1146, 1147, 1151, 1156, 1156, 1161, 1161, 1164, 1165, 1169, 1173, 1177, 1181, 1182, 1186, 1190, 1191, 1195, 1196, 1200, 1201, 1202, 1203, 1211, 1212, 1217, 1218, 1222, 1223, 1227, 1229, 1239, 1240, 1241, 1242, 1243, 1247, 1252, 1251, 1267, 1271, 1276, 1275, 1290, 1289, 1321, 1322, 1326, 1327, 1328, 1329, 1330, 1334, 1335, 1336, 1337, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1361, 1362, 1366, 1367, 1371, 1372, 1376, 1377, 1378, 1379, 1380, 1384, 1385, 1386, 1387, 1388, 1389, 1393, 1394, 1395, 1396, 1400, 1401, 1402, 1403, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1443, 1448, 1449, 1454, 1455, 1460, 1461, 1462, 1466, 1467, 1471, 1478, 1480, 1478, 1484, 1486, 1484, 1489, 1491, 1493, 1495, 1493, 1498, 1500, 1498, 1503, 1505, 1507, 1508, 1512, 1516, 1517, 1518, 1522, 1524, 1529, 1531, 1536, 1537, 1538, 1543, 1545, 1545, 1547, 1551, 1553, 1555, 1559, 1564, 1572, 1573, 1574, 1580, 1585, 1586, 1591, 1592, 1596, 1597, 1598, 1602, 1603, 1607, 1608, 1609, 1610, 1614, 1615, 1619, 1620, 1624, 1625, 1626, 1630, 1630, 1631, 1631, 1636, 1648, 1665, 1666, 1670, 1671, 1672, 1676, 1677, 1681, 1683, 1684, 1686, 1687, 1689, 1691, 1693, 1695, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1715, 1719, 1723, 1727, 1728, 1733, 1735, 1737, 1739, 1745, 1745, 1744, 1753, 1752, 1756, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1776, 1776, 1783, 1787, 1791, 1792, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1811, 1812, 1820, 1821, 1828, 1828, 1830, 1830, 1835, 1835, 1837, 1837, 1842, 1843, 1848, 1852, 1856, 1860, 1864, 1868, 1872, 1873, 1874, 1875, 1877, 1878, 1880, 1882, 1889, 1894, 1896, 1898, 1900, 1905, 1906, 1910, 1911, 1915, 1916, 1920, 1921, 1925, 1926, 1930, 1931, 1935, 1936, 1937, 1941, 1955, 1960, 1960, 1965, 1965, 1970, 1976, 1980, 1981, 1980, 1991, 1992, 1992, 1997, 1998, 1999, 2010, 2018, 2019, 2023, 2024, 2028, 2029, 2030, 2031, 2032, 2034, 2035, 2036, 2037, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2054, 2055, 2059, 2060, 2061, 2062, 2066, 2067, 2068, 2072, 2073, 2074, 2078, 2079, 2080, 2081, 2082, 2086, 2087, 2088, 2092, 2093, 2097, 2098, 2102, 2103, 2107, 2108, 2112, 2113, 2117, 2118, 2119, 2118, 2121, 2122, 2121, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2142, 2143, 2147, 2151, 2153, 2155, 2160, 2161, 2163, 2165, 2169, 2170, 2171, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2182, 2184, 2187, 2189, 2193, 2197, 2198, 2199, 2200, 2201, 2205, 2206, 2207, 2208 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "BADTOK", "SKIPTOK", "CTOK_ELIPSIS", "CASE", "DEFAULT", "CIF", "CELSE", "SWITCH", "WHILE", "DO", "CFOR", "GOTO", "CONTINUE", "BREAK", "RETURN", "TSEMI", "TLBRACE", "TRBRACE", "TCOMMA", "TCOLON", "TASSIGN", "TLPAREN", "TRPAREN", "TLSQBR", "TRSQBR", "TDOT", "TAMPERSAND", "TEXCL", "TTILDE", "TMINUS", "TPLUS", "TMULT", "TDIV", "TPERCENT", "TLT", "TGT", "TCIRC", "TBAR", "TQUEST", "CSIZEOF", "CALIGNOF", "CTYPEOF", "ARROW_OP", "CTYPEDEF", "COFFSETOF", "INC_OP", "DEC_OP", "LEFT_OP", "RIGHT_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "MOD_ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "CSTRUCT", "CUNION", "CENUM", "VA_ARG", "VA_DCL", "QWARN", "QGLOBALS", "QMODIFIES", "QNOMODS", "QCONSTANT", "QFUNCTION", "QITER", "QDEFINES", "QUSES", "QALLOCATES", "QSETS", "QRELEASES", "QPRECLAUSE", "QPOSTCLAUSE", "QINVARIANT", "QALT", "QUNDEF", "QKILLED", "QENDMACRO", "LLMACRO", "LLMACROITER", "LLMACROEND", "TENDMACRO", "QDREVEALSTATE", "QSWITCHBREAK", "QLOOPBREAK", "QINNERBREAK", "QSAFEBREAK", "QINNERCONTINUE", "QFALLTHROUGH", "QLINTNOTREACHED", "QLINTFALLTHROUGH", "QLINTFALLTHRU", "QARGSUSED", "QPRINTFLIKE", "QLINTPRINTFLIKE", "QSCANFLIKE", "QMESSAGELIKE", "QNOTREACHED", "QCONST", "QRESTRICT", "QVOLATILE", "QINLINE", "QEXTENSION", "QEXTERN", "QSTATIC", "QAUTO", "QREGISTER", "QOUT", "QIN", "QYIELD", "QONLY", "QTEMP", "QSHARED", "QREF", "QUNIQUE", "QCHECKED", "QUNCHECKED", "QCHECKEDSTRICT", "QCHECKMOD", "QKEEP", "QKEPT", "QPARTIAL", "QSPECIAL", "QOWNED", "QDEPENDENT", "QRETURNED", "QEXPOSED", "QNULL", "QOBSERVER", "QISNULL", "QEXITS", "QMAYEXIT", "QNEVEREXIT", "QTRUEEXIT", "QFALSEEXIT", "QLONG", "QSIGNED", "QUNSIGNED", "QSHORT", "QUNUSED", "QSEF", "QNOTNULL", "QRELNULL", "QABSTRACT", "QNUMABSTRACT", "QCONCRETE", "QMUTABLE", "QIMMUTABLE", "QTRUENULL", "QFALSENULL", "QEXTERNAL", "QREFCOUNTED", "QREFS", "QNEWREF", "QTEMPREF", "QKILLREF", "QRELDEF", "CGCHAR", "CBOOL", "CINT", "CGFLOAT", "CDOUBLE", "CVOID", "QANYTYPE", "QINTEGRALTYPE", "QUNSIGNEDINTEGRALTYPE", "QSIGNEDINTEGRALTYPE", "QNULLTERMINATED", "QSETBUFFERSIZE", "QSETSTRINGLENGTH", "QMAXSET", "QMAXREAD", "QTESTINRANGE", "TCAND", "IDENTIFIER", "NEW_IDENTIFIER", "TYPE_NAME_OR_ID", "CANNOTATION", "CCONSTANT", "ITER_NAME", "ITER_ENDNAME", "TYPE_NAME", "METASTATE_NAME", "$accept", "file", "externalDefs", "externalDef", "constantDecl", "fcnDecl", "@1", "plainFcn", "plainNamedDecl", "namedDeclBase", "@2", "@3", "plainNamedDeclBase", "@4", "@5", "iterDecl", "@6", "@7", "macroDef", "fcnDefHdr", "metaStateConstraint", "metaStateSpecifier", "@8", "@9", "metaStateExpression", "metaStateName", "constraintSeperator", "BufConstraintList", "BufConstraint", "bufferModifier", "relationalOp", "BufConstraintExpr", "BufConstraintTerm", "BufConstraintSrefExpr", "BufUnaryOp", "BufBinaryOp", "functionClauses", "functionClausesPlain", "functionClause", "functionClausePlain", "globalsClause", "globalsClausePlain", "@10", "nomodsClause", "modifiesClause", "modifiesClausePlain", "@11", "flagSpec", "flagId", "optWarnClause", "warnClause", "warnClausePlain", "globIdList", "globIdListExpr", "optGlobQuals", "globId", "globQual", "stateTag", "conditionTag", "fcnDefHdrAux", "fcnBody", "@12", "@13", "@14", "fcnDef", "locModifies", "modListExpr", "mExpr", "modList", "specClauseListExpr", "optSpecClauseList", "specClauseList", "primaryExpr", "@15", "postfixExpr", "argumentExprList", "unaryExpr", "fieldDesignator", "offsetofExpr", "sizeofExpr", "@16", "processSizeof", "endprocessSizeof", "sizeofExprAux", "castExpr", "timesExpr", "plusExpr", "shiftExpr", "relationalExpr", "equalityExpr", "bitandExpr", "xorExpr", "bitorExpr", "andExpr", "@17", "orExpr", "@18", "conditionalExpr", "@19", "@20", "@21", "@22", "assignExpr", "expr", "optExpr", "constantExpr", "initializer", "instanceDecl", "@23", "@24", "namedInitializerType", "namedInitializer", "@25", "typeDecl", "@26", "IsType", "PushType", "namedInitializerList", "namedInitializerListAux", "namedInitializerTypeList", "namedInitializerTypeListAux", "optDeclarators", "init", "designation", "designatorList", "designator", "initList", "storageSpecifier", "stateClause", "stateClausePlain", "@27", "conditionClause", "startConditionClause", "conditionClausePlain", "@28", "@29", "functionConstraint", "exitsQualifier", "checkQualifier", "stateQualifier", "paramQualifier", "visibilityQualifier", "returnQualifier", "typedefQualifier", "refcountQualifier", "typeModifier", "definedQualifier", "typeQualifier", "typeSpecifier", "completeType", "completeTypeSpecifier", "altType", "completeTypeSpecifierAux", "optCompleteType", "optStructInvariant", "suSpc", "@30", "@31", "@32", "@33", "@34", "@35", "@36", "@37", "NotType", "structDeclList", "structDecl", "structNamedDeclList", "structNamedDecl", "enumSpc", "@38", "enumeratorList", "enumerator", "optNamedDecl", "namedDecl", "genericParamList", "innerMods", "innerModsList", "pointers", "paramIdList", "idList", "paramTypeList", "paramList", "@39", "@40", "paramDecl", "typeExpression", "abstractDecl", "optAbstractDeclBase", "abstractDeclBase", "stmt", "debugStmt", "iterBody", "endBody", "iterDefStmtList", "iterDefIterationStmt", "forPred", "@41", "@42", "partialIterStmt", "@43", "iterDefStmt", "iterSelectionStmt", "@44", "openScope", "closeScope", "macroBody", "stmtErr", "labeledStmt", "optExtraFallThroughs", "caseStmt", "@45", "@46", "defaultStmt", "@47", "@48", "compoundStmt", "compoundStmtErr", "CreateInnerScope", "DeleteInnerScope", "CreateStructInnerScope", "DeleteStructInnerScope", "DeleteInnerScopeSafe", "compoundStmtRest", "compoundStmtAux", "compoundStmtAuxErr", "stmtListErr", "initializerList", "typeInitializerList", "typeInitializer", "stmtList", "expressionStmt", "expressionStmtErr", "ifPred", "selectionStmt", "@49", "@50", "whilePred", "iterWhilePred", "iterStmt", "@51", "@52", "iterArgList", "@53", "iterArgExpr", "cconstantExpr", "primaryIterExpr", "postfixIterExpr", "unaryIterExpr", "castIterExpr", "timesIterExpr", "plusIterExpr", "shiftIterExpr", "relationalIterExpr", "equalityIterExpr", "bitandIterExpr", "xorIterExpr", "bitorIterExpr", "andIterExpr", "orIterExpr", "conditionalIterExpr", "@54", "@55", "@56", "@57", "assignIterExpr", "endIter", "doHeader", "iterationStmt", "iterationStmtErr", "jumpStmt", "optSemi", "optComma", "id", "newId", "typeName", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 197, 198, 198, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 203, 202, 204, 204, 205, 205, 206, 206, 206, 206, 207, 206, 208, 206, 209, 209, 209, 209, 210, 209, 211, 209, 213, 214, 212, 215, 215, 215, 215, 216, 217, 219, 218, 220, 218, 221, 221, 222, 223, 223, 224, 224, 225, 226, 226, 227, 227, 227, 228, 228, 228, 229, 229, 230, 230, 230, 230, 230, 230, 230, 230, 231, 232, 232, 233, 233, 234, 234, 235, 235, 235, 235, 235, 235, 236, 236, 236, 236, 236, 236, 237, 239, 238, 240, 241, 243, 242, 244, 244, 245, 246, 246, 247, 248, 248, 249, 249, 250, 251, 251, 252, 252, 252, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254, 255, 255, 256, 256, 258, 257, 259, 260, 257, 261, 262, 262, 263, 263, 263, 263, 263, 263, 263, 263, 263, 264, 264, 265, 265, 266, 266, 266, 266, 266, 266, 266, 266, 267, 267, 268, 268, 269, 269, 269, 269, 269, 269, 270, 269, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 272, 272, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 274, 274, 274, 275, 277, 276, 278, 279, 280, 280, 280, 280, 281, 281, 282, 282, 282, 282, 283, 283, 283, 284, 284, 284, 285, 285, 285, 285, 285, 286, 286, 286, 287, 287, 288, 288, 289, 289, 290, 291, 290, 292, 293, 292, 294, 295, 296, 294, 297, 298, 294, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 300, 300, 301, 301, 302, 303, 303, 303, 304, 305, 304, 306, 304, 307, 307, 308, 309, 308, 311, 310, 310, 310, 312, 313, 314, 315, 315, 316, 317, 317, 318, 318, 319, 319, 319, 319, 320, 320, 321, 321, 322, 322, 323, 323, 324, 324, 324, 324, 324, 325, 327, 326, 328, 329, 331, 330, 332, 330, 333, 333, 334, 334, 334, 334, 334, 335, 335, 335, 335, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 337, 337, 338, 338, 339, 339, 340, 340, 340, 340, 340, 341, 341, 341, 341, 341, 341, 342, 342, 342, 342, 343, 343, 343, 343, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 346, 347, 347, 348, 348, 349, 349, 349, 350, 350, 351, 353, 354, 352, 355, 356, 352, 352, 352, 357, 358, 352, 359, 360, 352, 352, 352, 352, 352, 361, 362, 362, 362, 363, 363, 364, 364, 365, 365, 365, 366, 367, 366, 366, 368, 368, 368, 369, 369, 370, 370, 370, 370, 371, 371, 372, 372, 373, 373, 373, 374, 374, 375, 375, 375, 375, 376, 376, 377, 377, 378, 378, 378, 380, 379, 381, 379, 382, 382, 383, 383, 384, 384, 384, 385, 385, 386, 386, 386, 386, 386, 386, 386, 386, 386, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 388, 389, 390, 391, 391, 392, 392, 392, 392, 394, 395, 393, 397, 396, 396, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 400, 399, 401, 402, 403, 403, 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, 405, 405, 406, 406, 408, 407, 409, 407, 411, 410, 412, 410, 413, 413, 414, 415, 416, 417, 418, 419, 420, 420, 420, 420, 420, 420, 420, 420, 421, 422, 422, 422, 422, 423, 423, 424, 424, 425, 425, 426, 426, 427, 427, 428, 428, 429, 429, 429, 430, 431, 432, 431, 433, 431, 434, 435, 437, 438, 436, 439, 440, 439, 441, 441, 441, 441, 442, 442, 443, 443, 444, 444, 444, 444, 444, 444, 444, 444, 444, 445, 445, 445, 445, 445, 445, 445, 445, 445, 445, 446, 446, 447, 447, 447, 447, 448, 448, 448, 449, 449, 449, 450, 450, 450, 450, 450, 451, 451, 451, 452, 452, 453, 453, 454, 454, 455, 455, 456, 456, 457, 458, 459, 457, 460, 461, 457, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 463, 463, 464, 465, 465, 465, 466, 466, 466, 466, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 468, 468, 469, 469, 470, 471, 471, 471, 471, 471, 472, 472, 472, 472 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 8, 11, 0, 5, 1, 3, 1, 2, 1, 6, 3, 6, 0, 6, 0, 7, 1, 6, 3, 6, 0, 6, 0, 7, 0, 0, 10, 3, 3, 3, 2, 1, 3, 0, 4, 0, 4, 1, 3, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 1, 3, 4, 2, 3, 3, 3, 1, 1, 1, 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 4, 1, 2, 0, 3, 1, 3, 1, 1, 0, 2, 3, 2, 1, 3, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, 3, 0, 0, 4, 2, 2, 1, 1, 1, 1, 3, 4, 2, 3, 3, 3, 1, 1, 1, 3, 1, 1, 3, 4, 2, 3, 3, 3, 0, 1, 1, 3, 1, 1, 1, 3, 1, 1, 0, 4, 1, 4, 3, 4, 6, 5, 5, 2, 2, 7, 1, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 3, 4, 1, 9, 0, 3, 0, 0, 4, 2, 4, 2, 1, 4, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 1, 0, 4, 1, 0, 4, 1, 0, 0, 6, 0, 0, 7, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 0, 1, 1, 1, 1, 1, 3, 0, 9, 0, 11, 1, 1, 2, 0, 6, 0, 8, 4, 4, 0, 0, 2, 1, 4, 2, 1, 4, 0, 4, 1, 3, 4, 2, 2, 2, 1, 2, 3, 2, 1, 3, 1, 1, 1, 1, 1, 2, 0, 6, 2, 2, 0, 6, 0, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 4, 1, 3, 2, 2, 2, 0, 1, 0, 0, 0, 12, 0, 0, 11, 6, 6, 0, 0, 10, 0, 0, 10, 5, 5, 4, 4, 0, 1, 1, 2, 5, 3, 2, 4, 1, 3, 4, 6, 0, 8, 4, 1, 3, 2, 1, 4, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 2, 3, 1, 3, 1, 3, 1, 1, 3, 0, 2, 0, 4, 4, 1, 1, 2, 1, 1, 2, 0, 1, 5, 2, 3, 3, 4, 3, 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 2, 7, 6, 2, 0, 0, 10, 0, 6, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 2, 2, 0, 2, 0, 4, 0, 6, 0, 3, 0, 5, 3, 2, 3, 0, 0, 0, 0, 0, 1, 2, 2, 3, 2, 3, 3, 4, 2, 2, 3, 3, 4, 1, 2, 1, 2, 1, 3, 1, 4, 1, 2, 1, 2, 1, 2, 1, 4, 2, 0, 5, 0, 6, 4, 4, 0, 0, 10, 1, 0, 4, 1, 1, 1, 1, 1, 2, 1, 3, 1, 4, 3, 4, 6, 5, 5, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 4, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 0, 0, 6, 0, 0, 7, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 0, 1, 2, 7, 2, 2, 7, 6, 2, 3, 2, 3, 2, 3, 3, 3, 3, 2, 3, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 0, 13, 12, 459, 0, 426, 266, 426, 16, 0, 0, 0, 0, 282, 282, 282, 305, 304, 306, 307, 308, 367, 368, 331, 333, 332, 336, 337, 325, 327, 328, 326, 334, 335, 369, 370, 329, 330, 346, 342, 338, 343, 339, 320, 321, 324, 322, 323, 364, 365, 366, 363, 348, 347, 341, 340, 352, 353, 354, 355, 356, 350, 351, 349, 357, 358, 361, 362, 359, 360, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 344, 710, 711, 715, 345, 712, 713, 716, 0, 0, 4, 7, 8, 450, 9, 10, 135, 45, 706, 11, 265, 267, 0, 405, 282, 282, 282, 282, 282, 282, 282, 282, 426, 282, 405, 405, 426, 398, 426, 0, 426, 131, 282, 714, 22, 426, 454, 455, 456, 457, 460, 461, 282, 285, 282, 282, 278, 426, 717, 426, 426, 715, 0, 547, 203, 556, 0, 0, 0, 688, 0, 0, 0, 0, 203, 593, 0, 203, 203, 203, 203, 203, 203, 282, 203, 203, 0, 44, 0, 0, 0, 0, 0, 0, 550, 203, 171, 167, 170, 614, 604, 174, 186, 209, 196, 282, 211, 215, 218, 221, 226, 229, 231, 233, 235, 238, 241, 248, 260, 595, 546, 0, 0, 581, 536, 537, 538, 539, 0, 0, 540, 203, 541, 0, 542, 168, 0, 543, 545, 166, 0, 529, 0, 591, 0, 563, 516, 0, 0, 0, 525, 0, 526, 505, 524, 521, 522, 517, 518, 519, 0, 0, 523, 530, 0, 0, 527, 504, 0, 371, 373, 372, 383, 385, 384, 386, 387, 388, 389, 390, 391, 392, 1, 5, 282, 0, 133, 138, 426, 707, 6, 426, 406, 402, 376, 378, 375, 377, 380, 379, 381, 382, 396, 374, 403, 404, 0, 282, 282, 394, 282, 282, 0, 395, 451, 393, 458, 462, 282, 167, 170, 0, 426, 476, 0, 166, 426, 0, 284, 426, 0, 275, 282, 706, 18, 20, 0, 426, 282, 30, 470, 209, 264, 552, 0, 203, 203, 203, 203, 0, 697, 699, 704, 0, 563, 0, 0, 0, 189, 194, 193, 192, 191, 190, 0, 282, 187, 188, 203, 203, 0, 0, 0, 0, 0, 550, 0, 282, 549, 501, 203, 492, 493, 494, 495, 0, 496, 497, 203, 499, 203, 498, 500, 563, 203, 203, 181, 182, 0, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 204, 201, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 236, 245, 239, 594, 203, 695, 41, 0, 564, 582, 597, 692, 615, 0, 548, 203, 0, 0, 0, 592, 42, 506, 510, 583, 426, 520, 532, 533, 0, 0, 0, 43, 24, 203, 470, 426, 426, 282, 268, 132, 0, 400, 0, 426, 0, 426, 0, 282, 0, 718, 282, 203, 0, 478, 477, 479, 719, 282, 281, 282, 280, 276, 426, 0, 282, 0, 426, 282, 21, 467, 0, 0, 452, 468, 282, 0, 557, 0, 600, 0, 263, 0, 696, 705, 563, 0, 169, 203, 544, 282, 0, 0, 0, 700, 701, 702, 703, 698, 551, 203, 558, 0, 691, 426, 561, 689, 0, 0, 176, 0, 184, 0, 0, 0, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 195, 0, 212, 213, 214, 217, 216, 219, 220, 222, 223, 224, 225, 227, 228, 230, 232, 234, 203, 0, 203, 203, 261, 577, 717, 581, 0, 426, 562, 598, 0, 0, 528, 514, 282, 584, 531, 0, 0, 26, 0, 568, 203, 589, 134, 426, 203, 563, 282, 269, 399, 282, 416, 0, 424, 419, 0, 425, 0, 441, 444, 438, 440, 397, 484, 0, 470, 480, 203, 0, 286, 274, 288, 273, 282, 282, 282, 706, 17, 32, 203, 470, 282, 19, 453, 463, 465, 38, 472, 426, 471, 475, 553, 596, 0, 602, 203, 173, 203, 210, 426, 0, 282, 502, 554, 0, 560, 576, 0, 605, 203, 177, 175, 282, 282, 203, 203, 202, 237, 243, 0, 240, 578, 579, 203, 203, 203, 603, 203, 426, 203, 426, 80, 28, 569, 572, 203, 203, 570, 203, 590, 137, 0, 271, 282, 401, 422, 565, 408, 423, 565, 411, 282, 443, 282, 0, 485, 488, 282, 0, 486, 0, 470, 426, 107, 287, 203, 282, 282, 0, 34, 0, 282, 0, 82, 469, 282, 481, 203, 0, 203, 587, 708, 585, 0, 0, 0, 559, 203, 203, 185, 179, 180, 282, 206, 282, 208, 203, 246, 580, 599, 0, 282, 203, 203, 203, 203, 203, 203, 203, 203, 0, 167, 170, 186, 209, 636, 215, 218, 221, 226, 229, 231, 233, 235, 238, 0, 608, 607, 168, 618, 627, 637, 639, 643, 646, 649, 654, 657, 659, 661, 663, 665, 667, 674, 610, 166, 0, 25, 0, 97, 101, 99, 124, 125, 126, 127, 128, 129, 130, 27, 80, 84, 0, 86, 85, 0, 89, 0, 426, 426, 87, 0, 88, 316, 0, 80, 573, 574, 203, 571, 23, 282, 290, 426, 414, 565, 426, 415, 565, 437, 442, 203, 0, 0, 489, 487, 490, 0, 282, 0, 106, 203, 203, 0, 292, 277, 203, 0, 298, 0, 203, 0, 426, 82, 36, 0, 464, 466, 39, 82, 90, 92, 91, 95, 93, 94, 473, 446, 0, 282, 481, 447, 482, 601, 511, 708, 203, 0, 0, 178, 555, 0, 608, 0, 0, 244, 203, 694, 0, 0, 189, 194, 193, 192, 191, 190, 187, 188, 203, 203, 203, 181, 182, 0, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 671, 203, 515, 0, 509, 105, 110, 103, 114, 706, 81, 96, 100, 108, 310, 313, 309, 0, 314, 312, 29, 575, 203, 0, 428, 426, 426, 427, 426, 426, 426, 445, 282, 483, 491, 289, 279, 302, 0, 0, 301, 295, 296, 299, 297, 290, 14, 33, 35, 82, 31, 706, 83, 470, 474, 448, 449, 203, 0, 586, 183, 0, 199, 0, 563, 205, 207, 247, 693, 169, 203, 0, 176, 0, 0, 0, 0, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 212, 213, 214, 217, 216, 219, 220, 222, 223, 224, 225, 227, 228, 230, 232, 234, 664, 0, 203, 666, 203, 508, 109, 0, 119, 120, 121, 122, 123, 706, 111, 426, 114, 0, 0, 142, 143, 102, 152, 706, 140, 141, 0, 49, 0, 0, 59, 60, 70, 68, 319, 0, 318, 57, 77, 0, 64, 67, 0, 706, 69, 162, 290, 282, 426, 0, 282, 429, 417, 426, 420, 426, 439, 293, 203, 300, 706, 37, 0, 282, 512, 588, 282, 203, 0, 690, 687, 210, 282, 177, 175, 282, 282, 669, 0, 609, 104, 114, 98, 117, 113, 118, 116, 115, 0, 146, 0, 0, 0, 0, 139, 0, 0, 155, 164, 706, 154, 0, 0, 67, 0, 73, 0, 55, 54, 0, 62, 61, 63, 0, 0, 0, 0, 0, 0, 282, 706, 163, 0, 270, 282, 431, 282, 282, 426, 434, 0, 409, 0, 412, 294, 303, 0, 40, 282, 0, 200, 0, 197, 686, 564, 0, 179, 180, 203, 672, 112, 147, 144, 150, 0, 151, 148, 149, 153, 0, 158, 0, 0, 0, 0, 282, 0, 79, 78, 0, 74, 0, 51, 46, 47, 56, 67, 58, 71, 0, 75, 76, 0, 0, 317, 282, 282, 291, 203, 282, 0, 432, 282, 418, 0, 421, 0, 15, 513, 198, 606, 178, 670, 203, 145, 159, 156, 0, 160, 161, 165, 311, 53, 50, 0, 0, 72, 48, 65, 315, 272, 435, 426, 430, 203, 407, 413, 673, 157, 66, 52, 433, 436, 410 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 88, 89, 90, 91, 92, 140, 313, 314, 93, 665, 809, 315, 847, 975, 94, 707, 977, 950, 96, 1064, 1202, 1147, 1131, 1203, 1243, 1139, 1066, 1067, 1068, 1143, 1069, 1070, 1206, 1072, 1199, 793, 852, 794, 853, 795, 854, 934, 855, 798, 856, 935, 932, 933, 833, 800, 801, 1043, 1044, 1045, 1114, 1046, 802, 803, 97, 267, 443, 268, 580, 98, 1051, 1183, 1184, 1053, 1128, 1150, 1129, 181, 334, 182, 517, 183, 987, 184, 749, 534, 185, 533, 650, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 551, 196, 554, 197, 552, 730, 553, 880, 198, 227, 489, 323, 431, 100, 677, 815, 605, 606, 609, 101, 309, 102, 265, 134, 135, 607, 608, 949, 839, 840, 841, 842, 964, 103, 804, 858, 1056, 806, 807, 859, 1075, 943, 1073, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 303, 432, 448, 117, 273, 1263, 118, 819, 1224, 822, 1226, 680, 1160, 683, 1162, 119, 952, 953, 1157, 1158, 120, 688, 591, 592, 863, 137, 479, 129, 130, 122, 617, 618, 480, 481, 482, 709, 623, 336, 827, 865, 463, 358, 359, 228, 248, 229, 230, 360, 983, 1169, 232, 661, 233, 234, 436, 235, 236, 202, 417, 361, 356, 362, 483, 719, 363, 324, 638, 364, 207, 365, 561, 817, 1082, 241, 577, 512, 416, 209, 578, 715, 716, 579, 366, 210, 211, 367, 658, 627, 368, 244, 369, 373, 722, 760, 929, 761, 215, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 1031, 1178, 1032, 1233, 778, 1174, 370, 371, 217, 372, 270, 871, 305, 220, 125 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -1033 static const yytype_int16 yypact[] = { 2259, -1033, -1033, 357, 60, 5469, -1033, 6624, -1033, 677, 1966, 3655, 3655, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 805, -1033, -1033, -1033, -1033, 118, 2441, -1033, -1033, -1033, 331, -1033, -1033, 87, -1033, 134, -1033, -1033, -1033, 101, 6210, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 6210, 6210, 151, 57, -1033, 666, -1033, -1033, 677, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 357, -1033, 1900, -1033, 185, -1033, 151, -1033, -1033, -1033, 5469, -1033, 210, -1033, 5716, -1033, 219, 230, 293, -1033, 300, 677, 348, 362, 879, -1033, 2827, 5716, 5716, 5716, 5716, 5716, 5716, -1033, 5748, 5748, 388, -1033, 395, 371, 456, 463, 487, 417, 415, 4875, -1033, 500, 532, -1033, 543, -1033, 652, 1193, -1033, -1033, -1033, 668, 145, 254, 678, 474, 571, 569, 585, 579, 50, -1033, -1033, 55, -1033, 3458, 549, 560, -1033, -1033, -1033, -1033, 649, 3217, -1033, 4875, -1033, 3458, -1033, 501, 3458, -1033, -1033, 699, 702, -1033, 690, -1033, 3022, 543, 704, 205, 656, 3611, -1033, 3655, -1033, -1033, -1033, 5934, -1033, -1033, -1033, -1033, 740, 762, -1033, -1033, 3655, 3458, -1033, -1033, 669, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 759, 765, -1033, -1033, 6486, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 773, 995, -1033, -1033, 677, 677, 14, -1033, 331, -1033, -1033, -1033, 5310, -1033, -1033, 94, 6624, 414, 777, -1033, -1033, 787, -1033, -1033, 813, 827, 995, 134, -1033, 548, 798, -1033, 677, -1033, 263, -1033, -1033, -1033, 814, 5716, 5716, 5716, 1299, 842, -1033, -1033, -1033, 346, 844, 593, 862, 867, -1033, -1033, -1033, -1033, -1033, -1033, 851, 5310, -1033, -1033, 5716, 5716, 876, 926, 929, 938, 960, 415, 529, 5337, -1033, -1033, 4875, -1033, -1033, -1033, -1033, 883, -1033, -1033, 4875, -1033, 4875, -1033, -1033, -1033, 5641, 5716, -1033, -1033, 85, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, -1033, -1033, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, -1033, 892, -1033, -1033, 5716, -1033, -1033, 2632, -1033, -1033, 930, -1033, -1033, 958, -1033, 5716, 618, 972, 998, -1033, -1033, -1033, -1033, -1033, 151, 5934, -1033, -1033, 3655, 3261, 999, -1033, -1033, 5716, 368, 3808, 4959, 995, -1033, 384, 944, 1025, 1030, 1033, 1036, 1033, 677, 1038, 475, -1033, -1033, 5652, 1039, 567, -1033, 659, -1033, 995, -1033, 884, -1033, -1033, -1033, 973, 1049, 1041, -1033, 995, 548, -1033, 677, 1057, -1033, 1062, 677, 1064, -1033, 483, 1063, 562, 1063, 1072, -1033, -1033, 844, 1066, -1033, 5364, -1033, -1033, 1071, 1079, 577, -1033, -1033, -1033, -1033, -1033, -1033, 5716, -1033, 1076, -1033, 3808, -1033, -1033, 1093, 1081, -1033, 638, -1033, 311, 677, 677, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 631, -1033, -1033, -1033, 668, 668, 145, 145, 254, 254, 254, 254, 678, 678, 474, 571, 569, 5716, 1086, 5716, 5716, -1033, -1033, 2174, -1033, 3414, 3998, -1033, -1033, 1087, 692, -1033, -1033, 995, -1033, -1033, 1100, 1101, -1033, 1102, -1033, 4378, -1033, -1033, 4188, 4422, 844, -1033, 1106, -1033, -1033, 1110, 1113, -1033, 1115, 1114, -1033, 741, -1033, 1121, -1033, -1033, -1033, -1033, 1111, 626, 659, 5684, 1123, -1033, -1033, -1033, -1033, 1116, -1033, -1033, 310, -1033, -1033, 5716, 502, 995, -1033, -1033, 1128, -1033, -1033, 1145, 6624, -1033, -1033, -1033, -1033, 1127, -1033, 1299, -1033, 5385, -1033, -1033, 1134, -1033, -1033, -1033, 1133, -1033, -1033, 1136, -1033, 5716, -1033, -1033, -1033, -1033, 5775, 5819, -1033, 585, -1033, 750, 579, -1033, -1033, 4529, 4875, 5716, -1033, 5853, -1033, 5716, -1033, 1496, -1033, -1033, -1033, 4573, 4680, -1033, 4724, -1033, -1033, 1131, -1033, -1033, -1033, -1033, -1033, 1138, -1033, -1033, 1142, -1033, 677, -1033, 677, -1033, -1033, 132, 1144, -1033, 1150, 98, -1033, 1088, -1033, 3549, -1033, -1033, 1152, -1033, 1147, -1033, 325, 1496, -1033, 677, 925, 4875, 1164, 5385, -1033, 1165, -1033, 1169, 1173, 1182, -1033, 5716, 5853, -1033, -1033, -1033, 5310, -1033, 5310, -1033, 5716, -1033, -1033, -1033, 698, 5310, 5716, 5716, 5716, 5716, 5716, 5716, 5748, 5748, 1139, 712, 732, 739, 1489, -1033, 983, 783, 802, 761, 909, 1176, 1167, 1168, 1151, 107, 1185, -1033, 45, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 758, 775, -1033, 1037, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 1496, -1033, 1146, -1033, -1033, 1148, -1033, 1149, -1033, -1033, -1033, 1153, -1033, 1313, 1155, 1496, -1033, -1033, 4831, -1033, -1033, -1033, -1033, 6348, -1033, -1033, 6348, -1033, -1033, -1033, -1033, 5716, 966, 1200, -1033, -1033, -1033, 1202, 884, 1211, -1033, 3549, 5716, 677, -1033, -1033, 3549, 519, -1033, 1225, 3549, 1157, -1033, 1496, -1033, 1208, -1033, -1033, -1033, 1496, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 331, 1226, -1033, 1007, -1033, 659, -1033, -1033, 1165, 3701, 1244, 677, -1033, -1033, 782, 1240, 1241, 1242, -1033, 5716, 1250, 803, 1245, 804, 822, 824, 848, 855, 857, 864, 880, 5716, 5673, 5716, 896, 908, 109, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 1252, 5716, -1033, 1254, 1259, -1033, 1090, 1238, 11, 301, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 453, -1033, -1033, -1033, -1033, 3549, 376, -1033, 151, 5121, -1033, 6348, 5121, 6348, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 993, 1256, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 1496, -1033, 134, -1033, 233, -1033, -1033, -1033, 5705, 1264, -1033, -1033, 258, -1033, 1267, 844, 1134, 1134, -1033, -1033, 913, 5364, 1258, 915, 921, 358, 677, 677, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 933, 940, 941, 1188, 1196, 874, 898, 84, 363, 455, 530, 91, 552, 106, 165, 477, 585, 1265, 5716, 579, 5853, -1033, 501, 1037, -1033, -1033, -1033, -1033, -1033, 399, -1033, 6072, 11, 164, 164, -1033, -1033, -1033, 317, 442, -1033, -1033, 63, -1033, 982, 90, -1033, -1033, -1033, -1033, -1033, 1263, -1033, 43, -1033, 1008, -1033, 76, 1274, 134, -1033, 63, -1033, -1033, -1033, 1270, 133, -1033, -1033, 5121, -1033, 5121, -1033, -1033, 5289, -1033, 467, -1033, 1209, 240, -1033, -1033, -1033, 5716, 677, -1033, 1105, 949, -1033, 951, 959, -1033, -1033, -1033, 1003, -1033, -1033, 11, -1033, -1033, -1033, -1033, -1033, -1033, 498, 317, 793, 677, 677, 164, -1033, 63, 63, -1033, 416, 491, -1033, 1279, 1004, 581, 90, 421, 58, -1033, -1033, 982, -1033, -1033, -1033, 982, 22, 677, 677, 1282, 982, -1033, 134, 1284, 612, -1033, 995, -1033, -1033, 1285, -1033, 1286, 1287, -1033, 1289, -1033, -1033, -1033, 1219, -1033, 587, 1288, -1033, 447, -1033, -1033, -1033, 1290, 971, 984, 5716, -1033, -1033, -1033, -1033, 317, 1291, 501, -1033, -1033, 317, 639, 416, 850, 677, 677, 63, -1033, 1118, -1033, -1033, 982, -1033, 581, 1272, -1033, 421, -1033, 421, -1033, -1033, 1293, -1033, -1033, 1118, 1297, -1033, -1033, -1033, -1033, 5716, 133, 1298, -1033, -1033, -1033, 1304, -1033, 1306, -1033, -1033, -1033, -1033, 986, -1033, 5716, -1033, -1033, -1033, 1300, -1033, -1033, 416, -1033, -1033, -1033, 1311, 58, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 5716, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -1033, -1033, -1033, 1248, -1033, -1033, -1033, -1033, -403, -118, -1033, -1033, 1020, -1033, -1033, -1033, -1033, -1033, 64, -1033, -1033, 397, -1033, -1033, 96, 130, -1033, 206, -1033, -1033, -1033, -938, -1033, -886, -1033, -1033, -620, -778, -1033, -1033, -1033, -610, -1033, -594, -1033, -577, -1033, 312, -1033, -1033, 654, -668, -1033, 242, 308, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -898, 166, -1033, -1032, -1033, 280, -1033, -1033, -636, 466, 1132, -1033, -1033, 1178, -1033, -1033, -1033, -1033, -117, -381, -345, -322, -372, -388, -347, -353, -535, -551, -1033, -626, -1033, -76, -1033, -1033, -1033, -1033, 1013, 1218, -602, -433, 6, -1033, -1033, -1033, 533, -3, -1033, -1033, -1033, 634, -254, -1033, -1033, -1033, -1033, -911, -806, -1033, -1033, 523, -1033, -1033, -1033, -554, -1033, -1033, -1033, -384, -1033, -1033, -1033, -1033, -1033, 559, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 801, 784, -1033, 889, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 224, -684, -890, -1033, 148, -1033, -1033, 683, 687, 511, 1, -395, 1246, -1033, 17, -1033, -1033, -578, -1033, -1033, -1033, 670, -125, 1074, -1033, -448, 1141, 26, 1366, -1033, 1137, -1033, 744, -1033, -1033, -1033, -1033, -173, -1033, -1033, -1033, -1033, -1033, 20, 799, 1028, 1251, -1033, -1033, 1261, -1033, -1033, -311, -1033, 617, 211, -423, -737, -1033, 869, -1033, -1033, 969, -187, 673, 518, -493, 127, -1033, 180, 40, -1033, -1033, 173, -1033, 337, -1033, -1033, 667, -1033, 356, -639, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 1401, -1033, -1033, 1588, -295, 522, 0, 19, -1033 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -718 static const yytype_int16 yytable[] = { 123, 121, 133, 654, 294, 123, 99, 304, 571, 123, 219, 219, 219, 600, 538, 539, 651, 548, 471, 124, 131, 692, 762, 493, 124, 747, 598, 712, 142, 963, 203, 546, 547, 454, 967, 759, 200, 1052, 971, 857, 338, 339, 340, 341, 342, 343, 509, 573, 433, 1208, 212, 425, 540, 541, 550, 796, 429, 1071, 430, 549, 1090, 473, 1081, 1057, 95, 1081, -616, 657, 322, 974, -616, 797, 616, 411, 637, 978, 412, 542, 543, 544, 545, 444, 1134, 762, 132, 670, 747, 1125, 799, 123, 121, 409, 1059, 1189, 1190, 99, 759, 1126, -47, 1137, 1038, 1039, 1144, 477, 1145, -650, 266, 410, 124, -650, 758, 805, -655, 520, 1134, 412, -655, 831, 262, 457, 1132, 1146, 123, 830, 1059, 271, 757, -658, 399, 400, 521, -658, 1040, 1041, 397, 398, 955, 1001, 242, 242, 123, 124, 1076, 401, 402, 288, 1042, 297, 926, 1118, 1119, 123, 269, 95, 1002, 1156, 219, 318, 459, 319, 403, 404, 1240, 449, 927, 1152, 3, 3, 694, -282, 329, 758, 1133, 1135, 936, 219, 337, 395, 396, 857, 702, 509, 200, 213, 796, 857, -660, 757, 1047, 946, -660, 243, 243, 1081, 405, 1081, 212, 1091, 1048, 796, 797, 219, 81, 82, 141, 1207, 306, 85, 86, 219, 1213, 219, 705, 219, 1209, 797, 219, 799, 1084, 704, 498, 413, 473, 427, 219, 1188, 412, 200, 560, 219, 1138, 219, 799, 419, 320, 200, 421, 420, 477, 200, 805, 212, 200, 325, 219, 219, 81, 1062, 1201, 212, 1204, 81, 1127, 212, 326, 805, 212, -426, 690, -426, 820, 1244, 866, 569, 429, 438, 459, -426, 477, 674, 1083, 200, 1085, 754, 3, 535, 536, 537, 81, 1062, 750, 808, 1165, 1096, 1097, 212, 1098, 123, 447, 753, 123, 123, 123, 1036, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 397, 398, 124, 857, 756, 451, 453, 455, 123, 470, 755, 701, 751, 327, 123, 269, 461, 81, 82, 141, 328, 1047, 85, 86, 269, 213, 850, 124, 412, 700, 754, 1048, 282, 319, 645, 752, 287, 750, 289, 1120, 293, 1121, 1161, 214, 1163, 295, 753, 242, 81, 1049, 1050, -283, 242, 264, 242, 1204, 219, 311, 1122, 312, 491, 322, 330, 412, 219, 756, 219, 242, 633, 477, 213, 755, 1033, 751, 632, 412, 331, 1094, 213, 322, -651, 1104, 213, 350, -651, 213, 1030, 3, 957, 572, 1077, 762, 954, 1078, 747, 956, 752, 692, -426, 965, 243, -426, 378, -426, 759, 243, 808, 243, 348, 397, 398, 219, 866, 269, 213, 349, 1111, -426, -426, -426, 243, 808, -426, -426, 81, 82, 141, 322, 354, 85, 86, 558, 219, 219, -282, 568, 459, 200, 1191, 219, 1192, 123, 581, 1144, 3, 1145, 568, -426, -426, -426, 123, 212, -426, -426, 1057, 449, 269, 1193, 603, 1123, 124, 123, 1146, 123, 412, 126, 127, 128, 351, 593, 1229, 123, -652, 1058, 123, 352, -652, 1185, 123, 758, 124, 269, 124, 1059, 1078, 81, 1049, 1050, 318, 214, 319, 445, 412, 619, -662, 757, 494, 624, -662, 353, 412, 397, 398, 477, 626, 269, 718, 219, 1194, 81, 82, 141, 406, 355, 85, 86, 123, 123, -711, 1181, 1120, 322, 1121, 703, 403, 404, 465, 1017, 1018, 467, 1027, 507, 508, 322, 214, 646, 647, 475, 968, 1122, 478, 836, 214, 837, 1025, 1026, 214, -653, 1185, 214, -715, -653, -426, -426, -426, 219, 219, -426, -426, 242, 242, -712, 568, 123, 662, 1019, 1020, 1029, -283, -656, 472, 219, 1028, -656, 219, 219, 397, 398, 214, 412, 568, 200, 124, 628, 213, 399, 400, -282, 861, 459, 1021, 1022, 1023, 1024, 412, 212, 405, 877, 636, 878, 401, 402, 1200, 1144, 406, 1145, 883, 411, -478, 459, 412, 123, 243, 243, 494, 884, 885, 886, 887, 888, 889, 407, 1146, 208, 240, 240, 1216, 477, 318, 1078, 319, 408, 427, 1060, 1061, 412, 1054, 81, 1062, 494, 414, 1063, 754, 249, 250, 251, -426, 690, -426, 750, 879, -534, 567, 219, 219, 643, -426, 779, 753, 644, 1235, 1191, 478, 1192, 415, 219, 219, 582, 219, 648, 649, 587, 374, 590, 375, 1100, -426, 756, 1092, -282, 1193, 601, 123, 755, 123, 751, -426, -426, -426, 420, 610, -426, -426, -426, 615, 219, 376, 377, 392, 393, 394, 593, 123, 593, 461, 123, 123, 219, 752, 412, 423, 399, 400, 660, 843, 412, 600, -714, 779, 881, 422, 851, -713, 864, 624, 124, 401, 402, 213, -613, 290, 291, 292, -613, 274, 275, 276, 277, 278, 279, 280, 281, 861, 283, 1112, 322, 286, 428, 214, -612, 201, 231, 231, -612, 1124, 434, 322, 685, 686, 893, 439, 894, 302, -426, 307, 308, 310, 412, 731, 208, 316, 81, 82, 141, 1149, -611, 85, 86, 435, -611, -426, 1251, 440, 895, 896, 442, 302, 446, 1014, 1015, 1016, 1166, 412, 344, 916, 917, 930, 116, 464, 412, 993, 466, 136, 989, 139, 204, 237, 237, 219, 918, 919, 912, 913, 1047, 208, 391, 1182, 1262, 474, 691, 412, -630, 208, 1048, 995, -630, 208, 468, 123, 208, 1195, 219, 484, 123, 478, -717, 219, 240, 426, -635, 219, -634, 240, -635, 240, -634, 469, 124, 914, 915, 843, 1215, 966, 717, 302, 843, 490, 240, 208, 843, 123, 81, 82, 141, 492, -633, 85, 86, 123, -633, 1047, 497, -632, 1236, -631, 1101, -632, 864, -631, 124, 1048, -628, 582, 495, 781, -628, 116, 988, 496, -717, 501, -647, 214, 332, 441, -647, 201, -629, 511, 298, 272, -629, 395, 396, 157, 158, 159, 160, 161, 162, -242, 272, 272, -625, 3, -648, 832, -625, 302, -648, 450, 452, 163, 164, 165, -626, 395, 396, 302, -626, -617, 1055, -620, 460, -617, 562, -620, 317, 643, 1074, 502, 201, 1103, 503, 219, -282, 166, 459, 316, 201, -640, 204, 504, 201, -640, 3, 201, -641, -642, 920, 921, -641, -642, 843, 231, 563, -638, 897, -621, 231, -638, 231, -621, 1175, 505, 302, -619, 81, 1049, 1050, -619, 179, 958, 686, 231, 201, 515, 302, -623, -717, -717, 176, -623, 565, -717, -717, 204, 123, 123, 284, 285, -624, 1058, -622, 204, -624, 570, -622, 204, 1087, 1088, 204, 1059, 909, 910, 911, 1105, 1106, 566, 237, 412, 1179, 940, 941, 237, 3, 237, -282, 208, 459, 779, 583, 1197, 1198, 81, 1049, 1050, 3, 179, 237, 204, 1116, 584, 1055, 1055, 585, 294, 1115, -282, 240, 240, 588, 1130, 594, 1074, 1074, 1140, 1141, 1142, 599, 611, 614, 286, 81, 299, 300, 973, 179, 81, 82, 141, 1130, 612, 85, 86, 604, 123, 1159, 620, 621, 412, 586, 625, 589, 219, 595, 629, 630, 596, 123, 581, 460, 634, 602, 123, 124, 635, 639, 1232, 458, 641, 642, 613, 843, 652, 316, 1168, 659, 124, 81, 82, 141, 622, 1172, 85, 86, 1055, 123, 123, 1055, 663, 1130, 1130, 666, 664, 676, 679, 302, 681, 684, 1074, 682, 1074, 696, 689, 1074, 1186, 1187, 322, 1074, 687, 123, 123, 695, 1074, 706, 708, 1217, 711, 631, 123, 720, 814, 1257, 818, 201, 721, 782, 821, 892, 1210, 1211, 1060, 1061, 123, 828, 81, 1062, 848, 124, 1063, 1080, 208, 829, 322, 846, 231, 231, 868, 81, 82, 141, 870, 124, 85, 86, 872, 1055, 123, 123, 1130, 81, 82, 141, 873, 1074, 85, 86, 981, 1093, 874, 922, 923, 925, 924, -645, 928, 1238, 1239, -645, 204, 675, 379, -644, 302, 123, 1159, -644, 392, 393, 394, 959, 931, 960, 199, 962, 392, 393, 394, 976, 602, 237, 237, 937, 124, 938, 939, 697, 698, 699, 942, 1074, 945, 970, 972, 316, 979, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 205, 238, 238, 986, 990, 991, 992, 994, 302, 996, 206, 239, 239, -668, 1034, 321, 1035, 1037, 1102, 724, 725, 179, 1089, 1095, 1099, 1136, 1107, 1155, 321, 321, 321, 321, 321, 321, 391, 346, 347, 1148, 1173, 1167, 1196, 1154, 201, 1212, 1194, 1219, 1223, 1222, 1225, 1227, 816, 1245, 1228, 1242, 1231, 1253, -262, 1234, 823, 1246, 825, 1248, 298, 1255, 460, 1256, 1258, 157, 158, 159, 160, 161, 162, 844, 845, 1259, 263, 476, 849, 1065, 1260, 1247, 622, 862, 1205, 163, 164, 165, 1110, 301, 834, 418, 1180, 1117, 1151, 391, 1237, 204, 999, 302, 499, 302, 390, 969, 961, 944, 1252, 678, 302, 166, 826, 333, 824, 335, 982, 296, 462, 247, 860, 640, 437, 1221, 506, 559, 1230, 869, 518, 985, 876, 1109, 984, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 0, 0, 0, 0, 205, 0, 0, 0, 216, 245, 245, 0, 176, 0, 206, 0, 199, 0, 0, 0, 710, 0, 555, 0, 199, 0, 0, 0, 199, 0, 0, 199, 0, 23, 24, 25, 26, 0, 27, 424, 0, 0, 0, 32, 33, 0, 948, 36, 37, 205, 39, 40, 41, 42, 0, 0, 0, 205, 0, 206, 199, 205, 0, 0, 205, 54, 55, 206, 0, 0, 0, 206, 238, 1261, 206, 0, 0, 238, 0, 238, 0, 0, 239, 0, 81, 299, 300, 239, 179, 239, 0, 80, 238, 205, 980, 862, 0, 602, 510, 0, 0, 84, 239, 206, 0, 0, 513, 0, 514, 898, 0, 0, 0, 456, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 485, 486, 487, 488, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 216, 0, 0, 0, 0, 0, 456, 0, 0, 0, 500, 0, 782, 783, 784, 785, 321, 0, 456, 786, 787, 788, 789, 790, 791, 792, 0, 576, 1079, 0, 0, 0, 0, 0, 321, 1086, 519, 0, 0, 0, 0, 218, 246, 246, 0, 216, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 216, 951, 0, 0, 951, 0, 0, 0, 245, 0, 321, 0, 0, 245, 0, 245, 199, 0, 0, 0, 0, 0, 321, 0, 564, 0, 0, 714, 245, 216, 0, 0, 0, 0, 0, 576, 0, 0, 0, 723, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, 0, 391, 0, 0, 0, 0, 0, 0, 0, 206, 0, 0, 0, 0, 0, 0, 321, 0, 0, 321, 238, 238, 0, 0, 0, 0, 0, 0, 0, 0, 239, 239, 0, 0, 576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1153, 838, 0, 0, 0, 0, 0, 0, 576, 673, 0, 0, 0, 0, 0, 714, 862, 0, 0, 1170, 0, 0, 321, 0, 0, 302, 0, 0, 1176, 1177, 0, 0, 0, 218, 321, 0, 0, 0, 0, 0, 0, 0, 951, 0, 951, 951, 951, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 653, 0, 0, 0, 0, 0, 199, 0, 0, 727, 729, 0, 1214, 0, 0, 0, 0, 0, 218, 1218, 1220, 0, 748, 0, 0, 0, 218, 673, 733, 0, 218, 862, 0, 218, 0, 0, 0, 0, 0, 205, 673, 246, 0, 0, 0, 216, 246, 0, 246, 206, 0, 0, 0, 0, 0, 0, 0, 0, 1241, 0, 0, 246, 218, 0, 0, 0, 245, 245, 0, 0, 0, 0, 0, 0, 0, 0, 488, 838, 1249, 1250, 0, 867, 838, 748, 0, 1254, 838, 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 890, 891, 0, 734, 0, 0, 0, 780, 0, 714, 951, 0, 951, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 997, 518, 0, 0, 0, 0, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 0, 0, 298, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 875, 0, 0, -203, -203, 456, 0, 456, 163, 164, 165, 0, 0, 0, 882, 0, 0, 0, 321, 0, 0, 216, 838, 0, 0, 0, 0, 0, 143, 321, 0, 0, 166, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 0, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 218, 0, 0, 0, 0, -203, -203, 0, 0, 321, 163, 164, 165, 176, 0, 0, 0, 0, 0, 0, 0, 246, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 167, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 218, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 0, 0, 748, 0, 0, 0, 0, 0, 0, 0, 0, -170, 0, 0, 0, 0, -170, -170, -170, 0, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -715, -170, -170, 0, -170, 488, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 0, -170, 0, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 0, 0, 0, -170, 0, 0, 0, 0, 1108, 0, 0, 0, 0, 0, 0, 0, 0, -2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -170, -170, -170, -170, -170, -170, -170, 2, 0, 0, 0, 0, 0, -282, 0, -170, 0, 0, 0, 0, -170, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 321, 0, 0, 0, 0, 1171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 6, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, -170, -170, -170, 321, -170, -170, -170, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 321, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, -3, 1, 0, 0, 0, 0, 81, 82, 83, 84, 0, 85, 86, 87, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -282, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 6, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 82, 83, 84, 143, 85, 86, 87, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 556, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 143, 0, 0, 0, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -172, 0, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, -282, 0, 0, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -282, -282, -282, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, -282, -282, -282, -282, 176, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, 0, 0, 0, 0, 0, 81, 177, 178, -282, 179, 180, 86, -282, 221, 0, 0, 0, 0, 144, 145, 146, 0, 0, 222, 149, 150, 151, 152, 153, 154, 223, -172, -567, 0, 0, 0, 224, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, -282, 0, 0, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -282, -282, -282, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, -282, -282, -282, -282, 176, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, 0, 0, 0, 0, 0, 81, 177, 178, -282, 179, 225, 226, -282, 143, 0, 0, 0, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 0, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 221, 0, 163, 164, 165, 144, 145, 146, 0, 0, 222, 149, 150, 151, 152, 153, 154, 223, -507, -507, 0, 0, 0, 224, -507, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, 0, 163, 164, 165, 0, -535, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -507, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 143, 0, 0, 0, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 655, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 81, 177, 178, 0, 179, 225, 226, -203, -203, 0, 143, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 0, 0, 0, 0, 156, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 835, 175, 0, 0, 0, 298, 176, 836, 0, 837, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 164, 165, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 221, 0, 0, 0, 0, 144, 145, 146, 166, 0, 222, 149, 150, 151, 152, 153, 154, 223, -563, -567, 0, 0, 0, 224, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 81, 177, 178, 0, 179, 180, 86, -203, -203, 0, 221, 0, 163, 164, 165, 144, 145, 146, 0, 176, 222, 149, 150, 151, 152, 153, 154, 223, -563, -567, 0, 0, 0, 224, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, 0, 163, 164, 165, 0, -503, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 713, -709, 175, 0, 0, 298, 166, 176, 0, 0, 157, 158, 159, 160, 161, 162, 0, 81, 177, 178, 0, 179, 85, 86, 0, 0, 0, 0, 163, 164, 165, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 0, 176, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 225, 226, 0, 0, 0, 0, 0, 0, 0, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 574, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 81, 177, 178, 0, 179, 225, 226, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 575, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 656, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 668, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 669, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 667, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 671, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 672, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 732, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 810, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 811, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 813, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 812, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 947, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 0, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, -136, 0, 0, 0, 0, -136, 0, 0, 175, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, -566, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 835, 1164, 0, 138, 84, 298, 0, 836, 87, 837, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, -172, 0, 0, 0, 0, 298, 0, 163, 164, 165, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, -172, 163, 164, 165, 166, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 166, 0, 631, 163, 164, 165, 0, 298, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 713, 176, 0, 0, 166, 298, 0, 163, 164, 165, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 163, 164, 165, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 0, 0, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 176, 179, 85, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, -282, 0, 0, 0, 0, 81, 299, 300, 176, 179, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 82, 83, 84, 0, 85, 86, 87, 298, 516, 0, 0, 0, 157, 158, 159, 160, 161, 162, 298, 0, 0, 597, 0, 157, 158, 159, 160, 161, 162, 0, 163, 164, 165, 0, 0, 0, 0, 0, 0, 298, 998, 163, 164, 165, 157, 158, 159, 160, 161, 162, 298, 0, 0, 693, 166, 157, 158, 159, 160, 161, 162, 0, 163, 164, 165, 166, 0, 0, 0, 0, 0, 298, -262, 163, 164, 165, 157, 158, 159, 160, 161, 162, 298, 0, 0, 0, 166, 157, 158, 159, 160, 161, 162, 0, 163, 164, 165, 166, 0, 176, 0, 0, 0, 0, 0, 163, 164, 165, 0, 0, 176, 0, 0, 0, 345, 0, 0, 0, 166, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 166, 0, 176, 0, 0, 0, 0, 0, 163, 164, 165, 0, 726, 176, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 176, 163, 164, 165, 0, 0, 0, 0, 81, 299, 300, 176, 179, 0, 0, 0, 0, 0, 0, 81, 299, 300, 728, 179, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 176, 179, 163, 164, 165, 0, 0, 0, 81, 299, 300, 0, 179, 735, 0, 0, 0, 0, 736, 737, 738, 739, 740, 741, 0, 0, 166, 176, 0, 81, 299, 300, 0, 179, 0, 0, 163, 742, 743, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 6, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 745, 746, 0, 179, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 5, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 0, 0, 0, 0, 81, 1113, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 5, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87 }; static const yytype_int16 yycheck[] = { 0, 0, 5, 554, 122, 5, 0, 132, 441, 9, 10, 11, 12, 461, 395, 396, 551, 405, 313, 0, 3, 599, 661, 334, 5, 661, 459, 629, 9, 835, 10, 403, 404, 19, 840, 661, 10, 935, 844, 707, 157, 158, 159, 160, 161, 162, 357, 442, 235, 27, 10, 224, 397, 398, 407, 665, 229, 943, 231, 406, 971, 315, 952, 5, 0, 955, 21, 560, 144, 847, 25, 665, 475, 18, 507, 853, 21, 399, 400, 401, 402, 268, 24, 722, 24, 578, 722, 24, 665, 89, 89, 41, 34, 1125, 1126, 89, 722, 34, 22, 56, 89, 90, 26, 5, 28, 21, 19, 57, 89, 25, 661, 665, 21, 28, 24, 21, 25, 695, 0, 25, 1058, 45, 122, 25, 34, 24, 661, 21, 37, 38, 45, 25, 121, 122, 50, 51, 820, 28, 11, 12, 140, 122, 948, 52, 53, 88, 135, 130, 41, 1047, 1048, 151, 18, 89, 45, 22, 156, 140, 26, 140, 54, 55, 1194, 288, 57, 1076, 34, 34, 601, 18, 151, 722, 1058, 1059, 794, 175, 156, 32, 33, 847, 613, 492, 156, 10, 794, 853, 21, 722, 24, 809, 25, 11, 12, 1083, 29, 1085, 156, 975, 34, 809, 794, 201, 188, 189, 190, 1143, 21, 193, 194, 209, 1148, 211, 615, 213, 192, 809, 216, 794, 955, 614, 345, 201, 476, 18, 224, 1123, 21, 201, 415, 229, 187, 231, 809, 213, 24, 209, 216, 192, 5, 213, 794, 201, 216, 24, 244, 245, 188, 189, 1134, 209, 1136, 188, 189, 213, 24, 809, 216, 24, 25, 26, 683, 1199, 710, 436, 437, 245, 26, 34, 5, 580, 954, 245, 956, 661, 34, 392, 393, 394, 188, 189, 661, 665, 1088, 25, 26, 245, 28, 287, 287, 661, 290, 291, 292, 932, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 50, 51, 287, 975, 661, 290, 291, 292, 312, 312, 661, 610, 661, 24, 318, 18, 303, 188, 189, 190, 24, 24, 193, 194, 18, 156, 5, 312, 21, 23, 722, 34, 112, 318, 27, 661, 116, 722, 118, 26, 120, 28, 1083, 10, 1085, 125, 722, 224, 188, 189, 190, 24, 229, 26, 231, 1245, 360, 137, 45, 139, 18, 441, 18, 21, 368, 722, 370, 244, 497, 5, 201, 722, 927, 722, 495, 21, 18, 983, 209, 459, 21, 27, 213, 16, 25, 216, 925, 34, 825, 25, 18, 1034, 819, 21, 1034, 822, 722, 979, 18, 836, 224, 21, 182, 23, 1034, 229, 794, 231, 24, 50, 51, 415, 864, 18, 245, 24, 21, 188, 189, 190, 244, 809, 193, 194, 188, 189, 190, 507, 15, 193, 194, 415, 436, 437, 24, 433, 26, 415, 26, 443, 28, 445, 445, 26, 34, 28, 444, 188, 189, 190, 454, 415, 193, 194, 5, 584, 18, 45, 465, 21, 445, 465, 45, 467, 21, 112, 113, 114, 16, 454, 27, 475, 21, 24, 478, 16, 25, 1120, 482, 1034, 465, 18, 467, 34, 21, 188, 189, 190, 475, 156, 475, 271, 21, 478, 21, 1034, 25, 482, 25, 16, 21, 50, 51, 5, 25, 18, 635, 511, 21, 188, 189, 190, 39, 102, 193, 194, 520, 521, 22, 25, 26, 601, 28, 25, 54, 55, 306, 912, 913, 309, 922, 6, 7, 613, 201, 520, 521, 317, 23, 45, 320, 26, 209, 28, 920, 921, 213, 21, 1191, 216, 22, 25, 188, 189, 190, 559, 560, 193, 194, 436, 437, 22, 560, 567, 567, 914, 915, 924, 24, 21, 26, 575, 923, 25, 578, 579, 50, 51, 245, 21, 578, 559, 567, 25, 415, 37, 38, 24, 710, 26, 916, 917, 918, 919, 21, 559, 29, 726, 25, 728, 52, 53, 25, 26, 39, 28, 735, 18, 25, 26, 21, 615, 436, 437, 25, 736, 737, 738, 739, 740, 741, 40, 45, 10, 11, 12, 18, 5, 615, 21, 615, 56, 18, 184, 185, 21, 935, 188, 189, 25, 95, 192, 1034, 13, 14, 15, 24, 25, 26, 1034, 730, 95, 432, 657, 658, 21, 34, 661, 1034, 25, 25, 26, 442, 28, 19, 669, 670, 447, 672, 42, 43, 451, 24, 453, 26, 990, 28, 1034, 977, 24, 45, 26, 686, 1034, 688, 1034, 188, 189, 190, 192, 470, 193, 194, 45, 474, 699, 48, 49, 34, 35, 36, 686, 706, 688, 691, 709, 710, 711, 1034, 21, 24, 37, 38, 25, 699, 21, 1168, 22, 722, 25, 22, 706, 22, 710, 709, 710, 52, 53, 559, 21, 68, 69, 70, 25, 104, 105, 106, 107, 108, 109, 110, 111, 864, 113, 1043, 825, 116, 95, 415, 21, 10, 11, 12, 25, 1053, 19, 836, 20, 21, 24, 95, 26, 132, 28, 134, 135, 136, 21, 22, 156, 140, 188, 189, 190, 1073, 21, 193, 194, 20, 25, 45, 1218, 27, 48, 49, 24, 156, 18, 909, 910, 911, 1090, 21, 163, 37, 38, 25, 0, 25, 21, 880, 18, 5, 25, 7, 10, 11, 12, 812, 52, 53, 32, 33, 24, 201, 185, 27, 1254, 24, 599, 21, 21, 209, 34, 25, 25, 213, 18, 832, 216, 1129, 835, 22, 837, 614, 34, 840, 224, 225, 21, 844, 21, 229, 25, 231, 25, 23, 832, 50, 51, 835, 1150, 837, 633, 224, 840, 18, 244, 245, 844, 864, 188, 189, 190, 24, 21, 193, 194, 872, 25, 24, 24, 21, 27, 21, 996, 25, 864, 25, 864, 34, 21, 662, 25, 664, 25, 89, 872, 25, 88, 18, 21, 559, 18, 264, 25, 156, 21, 19, 24, 103, 25, 32, 33, 29, 30, 31, 32, 33, 34, 22, 114, 115, 21, 34, 21, 696, 25, 288, 25, 290, 291, 47, 48, 49, 21, 32, 33, 298, 25, 21, 935, 21, 303, 25, 9, 25, 140, 21, 943, 18, 201, 25, 18, 948, 24, 71, 26, 318, 209, 21, 156, 18, 213, 25, 34, 216, 21, 21, 54, 55, 25, 25, 948, 224, 11, 21, 747, 21, 229, 25, 231, 25, 1102, 18, 345, 21, 188, 189, 190, 25, 192, 20, 21, 244, 245, 373, 357, 21, 188, 189, 116, 25, 25, 193, 194, 201, 1001, 1002, 114, 115, 21, 24, 21, 209, 25, 11, 25, 213, 20, 21, 216, 34, 34, 35, 36, 1001, 1002, 24, 224, 21, 22, 802, 803, 229, 34, 231, 24, 415, 26, 1034, 91, 32, 33, 188, 189, 190, 34, 192, 244, 245, 1045, 21, 1047, 1048, 19, 1168, 1045, 19, 436, 437, 19, 1056, 19, 1058, 1059, 52, 53, 54, 24, 91, 24, 432, 188, 189, 190, 846, 192, 188, 189, 190, 1075, 27, 193, 194, 195, 1080, 1080, 25, 21, 21, 451, 22, 453, 1088, 455, 18, 25, 458, 1093, 1093, 461, 25, 463, 1098, 1080, 21, 25, 1178, 302, 11, 24, 472, 1088, 22, 475, 1093, 24, 1093, 188, 189, 190, 482, 1098, 193, 194, 1120, 1121, 1122, 1123, 24, 1125, 1126, 25, 27, 23, 20, 497, 19, 19, 1134, 20, 1136, 21, 27, 1139, 1121, 1122, 1218, 1143, 23, 1145, 1146, 24, 1148, 21, 5, 1154, 25, 19, 1154, 22, 25, 1233, 20, 415, 24, 73, 20, 24, 1145, 1146, 184, 185, 1168, 25, 188, 189, 25, 1154, 192, 951, 559, 27, 1254, 27, 436, 437, 18, 188, 189, 190, 21, 1168, 193, 194, 21, 1191, 1192, 1193, 1194, 188, 189, 190, 25, 1199, 193, 194, 195, 979, 22, 29, 39, 56, 40, 21, 25, 1192, 1193, 25, 415, 581, 23, 21, 584, 1219, 1219, 25, 34, 35, 36, 25, 189, 25, 10, 18, 34, 35, 36, 25, 600, 436, 437, 91, 1219, 91, 91, 607, 608, 609, 91, 1245, 91, 22, 91, 615, 24, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 10, 11, 12, 20, 25, 25, 25, 18, 635, 25, 10, 11, 12, 22, 21, 144, 18, 40, 21, 646, 647, 192, 27, 20, 18, 23, 22, 18, 157, 158, 159, 160, 161, 162, 661, 164, 165, 24, 194, 91, 22, 1078, 559, 22, 21, 21, 20, 22, 20, 91, 677, 40, 25, 196, 25, 18, 18, 27, 685, 27, 687, 25, 24, 20, 691, 20, 27, 29, 30, 31, 32, 33, 34, 700, 701, 25, 89, 318, 705, 943, 1245, 1212, 709, 710, 1139, 47, 48, 49, 1037, 132, 697, 211, 1111, 1046, 1075, 722, 1191, 559, 893, 726, 348, 728, 185, 841, 832, 807, 1219, 584, 735, 71, 688, 154, 686, 156, 864, 130, 303, 12, 709, 511, 244, 1158, 355, 415, 1174, 713, 374, 870, 722, 1034, 869, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, -1, -1, -1, -1, 156, -1, -1, -1, 10, 11, 12, -1, 116, -1, 156, -1, 201, -1, -1, -1, 622, -1, 412, -1, 209, -1, -1, -1, 213, -1, -1, 216, -1, 123, 124, 125, 126, -1, 128, 224, -1, -1, -1, 133, 134, -1, 815, 137, 138, 201, 140, 141, 142, 143, -1, -1, -1, 209, -1, 201, 245, 213, -1, -1, 216, 155, 156, 209, -1, -1, -1, 213, 224, 1252, 216, -1, -1, 229, -1, 231, -1, -1, 224, -1, 188, 189, 190, 229, 192, 231, -1, 181, 244, 245, 863, 864, -1, 866, 360, -1, -1, 191, 244, 245, -1, -1, 368, -1, 370, 23, -1, -1, -1, 298, -1, -1, -1, -1, -1, -1, -1, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, -1, -1, -1, 325, 326, 327, 328, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 156, -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, -1, 73, 74, 75, 76, 441, -1, 357, 80, 81, 82, 83, 84, 85, 86, -1, 443, 951, -1, -1, -1, -1, -1, 459, 958, 375, -1, -1, -1, -1, 10, 11, 12, -1, 201, -1, -1, -1, -1, -1, -1, -1, 209, -1, -1, -1, 213, -1, -1, 216, 817, -1, -1, 820, -1, -1, -1, 224, -1, 495, -1, -1, 229, -1, 231, 415, -1, -1, -1, -1, -1, 507, -1, 423, -1, -1, 631, 244, 245, -1, -1, -1, -1, -1, 511, -1, -1, -1, 643, -1, -1, -1, -1, -1, -1, -1, -1, -1, 415, -1, 1034, -1, -1, -1, -1, -1, -1, -1, 415, -1, -1, -1, -1, -1, -1, 551, -1, -1, 554, 436, 437, -1, -1, -1, -1, -1, -1, -1, -1, 436, 437, -1, -1, 560, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, 699, -1, -1, -1, -1, -1, -1, 578, 579, -1, -1, -1, -1, -1, 713, 1093, -1, -1, 1096, -1, -1, 601, -1, -1, 1102, -1, -1, 1105, 1106, -1, -1, -1, 156, 613, -1, -1, -1, -1, -1, -1, -1, 952, -1, 954, 955, 956, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 553, -1, -1, -1, -1, -1, 559, -1, -1, 648, 649, -1, 1149, -1, -1, -1, -1, -1, 201, 1156, 1157, -1, 661, -1, -1, -1, 209, 657, 658, -1, 213, 1168, -1, 216, -1, -1, -1, -1, -1, 559, 670, 224, -1, -1, -1, 415, 229, -1, 231, 559, -1, -1, -1, -1, -1, -1, -1, -1, 1195, -1, -1, 244, 245, -1, -1, -1, 436, 437, -1, -1, -1, -1, -1, -1, -1, -1, 629, 835, 1215, 1216, -1, 711, 840, 722, -1, 1222, 844, -1, -1, -1, -1, 730, -1, -1, -1, -1, -1, 736, 737, 738, 739, 740, 741, 742, 743, -1, 659, -1, -1, -1, 663, -1, 870, 1083, -1, 1085, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 892, 893, -1, -1, -1, -1, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, 721, -1, -1, 42, 43, 726, -1, 728, 47, 48, 49, -1, -1, -1, 735, -1, -1, -1, 825, -1, -1, 559, 948, -1, -1, -1, -1, -1, 1, 836, -1, -1, 71, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 415, -1, -1, -1, -1, 42, 43, -1, -1, 880, 47, 48, 49, 116, -1, -1, -1, -1, -1, -1, -1, 436, 437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, -1, 927, -1, 95, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, 1088, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 894, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 996, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 559, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, -1, 1034, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, -1, 26, 983, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, -1, -1, -1, 71, -1, -1, -1, -1, 1032, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, 18, -1, -1, -1, -1, -1, 24, -1, 111, -1, -1, -1, -1, 116, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, 1178, -1, -1, -1, -1, 1097, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, 72, -1, -1, -1, -1, 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1218, 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, 1233, 192, 193, 194, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 1254, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 0, 1, -1, -1, -1, -1, 188, 189, 190, 191, -1, 193, 194, 195, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, 72, -1, -1, -1, -1, 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 1, 193, 194, 195, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, -1, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 1, -1, -1, -1, -1, 6, 7, 8, -1, -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, -1, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, 1, -1, 47, 48, 49, 6, 7, 8, -1, -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, 25, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, 47, 48, 49, -1, 95, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, 188, 189, 190, -1, 192, 193, 194, 42, 43, -1, 1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, 19, 111, -1, -1, -1, 24, 116, 26, -1, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 48, 49, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 1, -1, -1, -1, -1, 6, 7, 8, 71, -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, 188, 189, 190, -1, 192, 193, 194, 42, 43, -1, 1, -1, 47, 48, 49, 6, 7, 8, -1, 116, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, 47, 48, 49, -1, 95, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 19, 20, 111, -1, -1, 24, 71, 116, -1, -1, 29, 30, 31, 32, 33, 34, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, 47, 48, 49, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, 116, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, -1, -1, -1, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, 188, 189, 190, -1, 192, 193, 194, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, 19, -1, -1, -1, -1, 24, -1, -1, 111, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 20, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, 19, 20, -1, 190, 191, 24, -1, 26, 195, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, 24, -1, 47, 48, 49, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, 19, 47, 48, 49, 71, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 71, -1, 19, 47, 48, 49, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, 19, 116, -1, -1, 71, 24, -1, 47, 48, 49, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, 47, 48, 49, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, 116, 192, 193, 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, 188, 189, 190, 116, 192, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, -1, 193, 194, 195, 24, 25, -1, -1, -1, 29, 30, 31, 32, 33, 34, 24, -1, -1, 27, -1, 29, 30, 31, 32, 33, 34, -1, 47, 48, 49, -1, -1, -1, -1, -1, -1, 24, 25, 47, 48, 49, 29, 30, 31, 32, 33, 34, 24, -1, -1, 27, 71, 29, 30, 31, 32, 33, 34, -1, 47, 48, 49, 71, -1, -1, -1, -1, -1, 24, 25, 47, 48, 49, 29, 30, 31, 32, 33, 34, 24, -1, -1, -1, 71, 29, 30, 31, 32, 33, 34, -1, 47, 48, 49, 71, -1, 116, -1, -1, -1, -1, -1, 47, 48, 49, -1, -1, 116, -1, -1, -1, 24, -1, -1, -1, 71, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, 71, -1, 116, -1, -1, -1, -1, -1, 47, 48, 49, -1, 24, 116, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, 116, 47, 48, 49, -1, -1, -1, -1, 188, 189, 190, 116, 192, -1, -1, -1, -1, -1, -1, 188, 189, 190, 24, 192, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, 116, 192, 47, 48, 49, -1, -1, -1, 188, 189, 190, -1, 192, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 71, 116, -1, 188, 189, 190, -1, 192, -1, -1, 47, 48, 49, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, 72, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, 46, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, -1, -1, -1, -1, 188, 189, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, 46, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 1, 18, 34, 44, 46, 72, 77, 78, 79, 92, 93, 94, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 188, 189, 190, 191, 193, 194, 195, 198, 199, 200, 201, 202, 206, 212, 215, 216, 256, 261, 303, 304, 310, 312, 324, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 347, 349, 352, 361, 366, 371, 375, 470, 471, 472, 112, 113, 114, 373, 374, 375, 24, 308, 314, 315, 347, 371, 190, 347, 203, 190, 471, 1, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 24, 29, 30, 31, 32, 33, 34, 47, 48, 49, 71, 95, 96, 97, 98, 99, 100, 101, 102, 111, 116, 189, 190, 192, 193, 269, 271, 273, 275, 278, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 292, 294, 299, 300, 388, 393, 403, 404, 405, 407, 410, 414, 415, 423, 429, 430, 431, 434, 436, 442, 464, 466, 467, 470, 471, 1, 11, 18, 24, 193, 194, 300, 389, 391, 392, 393, 396, 398, 399, 401, 402, 405, 407, 410, 415, 419, 428, 430, 435, 464, 467, 389, 390, 312, 312, 312, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 0, 200, 26, 313, 19, 257, 259, 18, 468, 24, 347, 350, 312, 312, 312, 312, 312, 312, 312, 312, 361, 312, 350, 350, 312, 361, 88, 361, 68, 69, 70, 361, 206, 361, 373, 375, 24, 189, 190, 300, 312, 346, 383, 470, 21, 312, 312, 311, 312, 361, 361, 204, 205, 209, 312, 347, 375, 471, 24, 273, 294, 302, 411, 24, 24, 24, 24, 471, 18, 18, 18, 300, 270, 300, 383, 404, 281, 281, 281, 281, 281, 281, 312, 24, 273, 273, 24, 24, 16, 16, 16, 16, 15, 102, 406, 24, 387, 388, 393, 405, 407, 410, 413, 415, 428, 431, 434, 436, 464, 465, 467, 437, 24, 26, 48, 49, 361, 23, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 276, 312, 34, 35, 36, 32, 33, 50, 51, 37, 38, 52, 53, 54, 55, 29, 39, 40, 56, 41, 57, 18, 21, 404, 95, 19, 422, 404, 387, 404, 192, 404, 22, 24, 300, 398, 415, 18, 95, 398, 398, 303, 347, 424, 19, 20, 400, 391, 404, 95, 27, 312, 24, 258, 424, 361, 18, 371, 348, 383, 312, 471, 312, 471, 19, 471, 300, 25, 347, 26, 312, 375, 384, 386, 25, 361, 18, 361, 18, 23, 371, 468, 26, 313, 24, 361, 209, 5, 361, 372, 378, 379, 380, 408, 22, 300, 300, 300, 300, 301, 18, 18, 24, 413, 25, 25, 25, 24, 383, 299, 300, 18, 18, 18, 18, 18, 406, 6, 7, 413, 387, 19, 421, 387, 387, 415, 25, 272, 299, 300, 28, 45, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 279, 277, 281, 281, 281, 282, 282, 283, 283, 284, 284, 284, 284, 285, 285, 286, 287, 288, 291, 295, 297, 293, 299, 20, 190, 404, 423, 424, 416, 9, 11, 300, 25, 24, 361, 303, 398, 11, 302, 25, 372, 20, 111, 387, 420, 424, 427, 260, 371, 361, 91, 21, 19, 312, 361, 19, 312, 361, 368, 369, 471, 19, 312, 312, 27, 302, 24, 386, 26, 312, 308, 195, 307, 308, 316, 317, 309, 361, 91, 27, 312, 24, 361, 205, 376, 377, 471, 25, 21, 312, 382, 471, 22, 25, 433, 25, 18, 25, 19, 281, 383, 25, 21, 25, 302, 412, 25, 420, 11, 24, 21, 25, 27, 471, 471, 42, 43, 280, 289, 22, 300, 290, 20, 20, 427, 432, 24, 25, 397, 371, 24, 27, 207, 25, 20, 20, 111, 427, 20, 111, 387, 413, 312, 23, 305, 348, 20, 357, 19, 20, 359, 19, 20, 21, 23, 367, 27, 25, 361, 378, 27, 302, 24, 21, 312, 312, 312, 23, 468, 302, 25, 372, 205, 21, 213, 5, 381, 347, 25, 301, 19, 299, 425, 426, 361, 383, 409, 22, 24, 438, 299, 312, 312, 24, 273, 24, 273, 296, 22, 20, 387, 300, 24, 29, 30, 31, 32, 33, 34, 48, 49, 71, 189, 190, 271, 273, 276, 282, 283, 284, 285, 286, 287, 288, 289, 290, 292, 439, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 462, 470, 300, 361, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 233, 235, 237, 238, 240, 241, 242, 247, 248, 254, 255, 325, 326, 328, 329, 330, 208, 20, 20, 111, 20, 25, 306, 312, 417, 20, 353, 417, 20, 355, 312, 369, 312, 368, 384, 25, 27, 25, 378, 361, 246, 247, 19, 26, 28, 299, 319, 320, 321, 322, 471, 312, 312, 27, 210, 25, 312, 5, 471, 234, 236, 238, 240, 242, 248, 326, 330, 382, 206, 312, 370, 375, 385, 386, 387, 18, 425, 21, 469, 21, 25, 22, 300, 439, 383, 383, 294, 298, 25, 300, 383, 281, 281, 281, 281, 281, 281, 273, 273, 24, 24, 26, 48, 49, 361, 23, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 34, 35, 36, 32, 33, 50, 51, 37, 38, 52, 53, 54, 55, 29, 39, 40, 56, 41, 57, 25, 440, 25, 189, 244, 245, 239, 243, 233, 91, 91, 91, 361, 361, 91, 332, 336, 91, 233, 20, 312, 318, 215, 347, 362, 363, 417, 362, 417, 302, 20, 25, 25, 307, 18, 319, 323, 302, 471, 319, 23, 322, 22, 319, 91, 361, 234, 211, 25, 214, 234, 24, 312, 195, 370, 394, 469, 426, 20, 274, 471, 25, 25, 25, 25, 294, 18, 25, 25, 299, 25, 272, 300, 28, 45, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 281, 281, 281, 282, 282, 283, 283, 284, 284, 284, 284, 285, 285, 286, 287, 288, 289, 458, 460, 290, 21, 18, 442, 40, 89, 90, 121, 122, 135, 249, 250, 251, 253, 24, 34, 189, 190, 262, 263, 265, 468, 470, 327, 5, 24, 34, 184, 185, 189, 192, 217, 218, 224, 225, 226, 228, 229, 230, 231, 333, 470, 331, 319, 18, 21, 312, 361, 363, 418, 362, 418, 362, 312, 20, 21, 27, 318, 234, 468, 361, 301, 20, 25, 26, 28, 18, 413, 281, 21, 25, 27, 471, 471, 22, 300, 441, 244, 21, 468, 189, 252, 303, 470, 251, 263, 263, 26, 28, 45, 21, 468, 24, 34, 189, 266, 268, 470, 220, 228, 230, 24, 230, 23, 56, 187, 223, 52, 53, 54, 227, 26, 28, 45, 219, 24, 468, 267, 268, 318, 312, 361, 18, 22, 364, 365, 371, 358, 418, 360, 418, 20, 319, 468, 91, 375, 395, 312, 300, 471, 194, 463, 383, 312, 312, 459, 22, 250, 25, 27, 263, 264, 442, 471, 471, 263, 266, 266, 26, 28, 45, 21, 468, 22, 32, 33, 232, 25, 230, 218, 221, 230, 224, 230, 228, 27, 192, 471, 471, 22, 228, 312, 468, 18, 308, 312, 21, 312, 361, 22, 20, 354, 20, 356, 91, 25, 27, 416, 25, 294, 461, 27, 25, 27, 264, 471, 471, 266, 312, 196, 222, 228, 40, 27, 222, 25, 312, 312, 302, 365, 18, 312, 20, 20, 294, 27, 25, 221, 361, 302, 351 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, cgrammar_YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; cgrammar_YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, cgrammar_YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; cgrammar_YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (cgrammar_YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) cgrammar_YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, cgrammar_YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; cgrammar_YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ cgrammar_YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ cgrammar_YYSTYPE yyvsa[YYINITDEPTH]; cgrammar_YYSTYPE *yyvs = yyvsa; cgrammar_YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ cgrammar_YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ cgrammar_YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 4: { context_checkGlobalScope (); ;} break; case 5: { context_checkGlobalScope (); ;} break; case 6: { uentry_clearDecl (); ;} break; case 7: { uentry_clearDecl (); ;} break; case 8: { uentry_clearDecl (); ;} break; case 9: { uentry_clearDecl (); ;} break; case 10: { uentry_clearDecl (); ;} break; case 11: { uentry_checkDecl (); exprNode_free ((yyvsp[(1) - (1)].expr)); ;} break; case 12: { uentry_clearDecl (); lltok_free ((yyvsp[(1) - (1)].tok)); /* evans 2002-02-08: okay to have a null statement */ ;} break; case 13: { uentry_clearDecl (); ;} break; case 14: { checkConstant ((yyvsp[(2) - (8)].qtyp), (yyvsp[(4) - (8)].ntyp)); lltok_free2 ((yyvsp[(1) - (8)].tok), (yyvsp[(8) - (8)].tok)); ;} break; case 15: { checkValueConstant ((yyvsp[(2) - (11)].qtyp), (yyvsp[(4) - (11)].ntyp), (yyvsp[(8) - (11)].expr)); lltok_free3 ((yyvsp[(1) - (11)].tok), (yyvsp[(6) - (11)].tok), (yyvsp[(11) - (11)].tok)); ;} break; case 16: { context_enterFunctionHeader (); ;} break; case 17: { declareStaticFunction ((yyvsp[(3) - (5)].ntyp)); context_quietExitFunction (); context_exitFunctionHeader (); lltok_free2 ((yyvsp[(1) - (5)].tok), (yyvsp[(5) - (5)].tok)); /*!*/ ;} break; case 18: { qtype qint = qtype_create (ctype_int); (yyval.ntyp) = idDecl_fixBase ((yyvsp[(1) - (1)].ntyp), qint); qtype_free (qint); ;} break; case 19: { (yyval.ntyp) = idDecl_fixBase ((yyvsp[(3) - (3)].ntyp), (yyvsp[(1) - (3)].qtyp)); ;} break; case 21: { (yyval.ntyp) = (yyvsp[(2) - (2)].ntyp); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), idDecl_getTyp ((yyval.ntyp))); ;} break; case 22: { (yyval.ntyp) = idDecl_create ((yyvsp[(1) - (1)].cname), qtype_unknown ()); ;} break; case 23: { (yyval.ntyp) = idDecl_expectFunction ((yyvsp[(4) - (6)].ntyp)); lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(6) - (6)].tok)); ;} break; case 24: { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (3)].ntyp), ctype_makeInnerArray (idDecl_getCtype ((yyvsp[(1) - (3)].ntyp)))); lltok_free2 ((yyvsp[(2) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 25: { exprNode_findValue ((yyvsp[(4) - (6)].expr)); idDecl_notExpectingFunction ((yyvsp[(1) - (6)].ntyp)); if (exprNode_hasValue ((yyvsp[(4) - (6)].expr))) { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ctype_makeInnerFixedArray (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), exprNode_getLongValue ((yyvsp[(4) - (6)].expr)))); } else { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ctype_makeInnerArray (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)))); } lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(5) - (6)].tok)); ;} break; case 26: { setCurrentParams (uentryList_missingParams); ;} break; case 27: { /* need to support globals and modifies here! */ functionClauseList fcl; ctype ct = ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), uentryList_makeMissingParams ()); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ct); /*drl 7/25/01 added*/ setImplicitfcnConstraints(); DPRINTF((message("namedDeclBase PushType TLPAREN TRPAREN...:\n adding implict constraints to functionClause List: %s", functionClauseList_unparse((yyvsp[(6) - (6)].funcclauselist)) ) )); fcl = functionClauseList_setImplicitConstraints((yyvsp[(6) - (6)].funcclauselist)); idDecl_addClauses ((yyval.ntyp), fcl); DPRINTF((message("1 added fuctionClause List: %s to the Id", functionClauseList_unparse(fcl) ) )); context_popLoc (); lltok_free2 ((yyvsp[(3) - (6)].tok), (yyvsp[(4) - (6)].tok)); ;} break; case 28: { setCurrentParams ((yyvsp[(4) - (5)].entrylist)); ;} break; case 29: { functionClauseList fcl; setImplicitfcnConstraints (); clearCurrentParams (); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (7)].ntyp), ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (7)].ntyp)), (yyvsp[(4) - (7)].entrylist))); DPRINTF((message("namedDeclBase PushType TLPAREN genericParamList TRPAREN...:\n adding implict constraints to functionClause List: %s", functionClauseList_unparse((yyvsp[(7) - (7)].funcclauselist)) ) )) ; fcl = functionClauseList_setImplicitConstraints((yyvsp[(7) - (7)].funcclauselist)); idDecl_addClauses ((yyval.ntyp), fcl); DPRINTF((message("added fuctionClause List: %s to the Id", functionClauseList_unparse(fcl) ) )); context_popLoc (); lltok_free2 ((yyvsp[(3) - (7)].tok), (yyvsp[(5) - (7)].tok)); ;} break; case 30: { (yyval.ntyp) = idDecl_create ((yyvsp[(1) - (1)].cname), qtype_unknown ()); ;} break; case 31: { (yyval.ntyp) = idDecl_expectFunction ((yyvsp[(4) - (6)].ntyp)); lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(6) - (6)].tok)); ;} break; case 32: { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (3)].ntyp), ctype_makeInnerArray (idDecl_getCtype ((yyvsp[(1) - (3)].ntyp)))); lltok_free2 ((yyvsp[(2) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 33: { int value; if (exprNode_hasValue ((yyvsp[(4) - (6)].expr)) && multiVal_isInt (exprNode_getValue ((yyvsp[(4) - (6)].expr)))) { value = (int) multiVal_forceInt (exprNode_getValue ((yyvsp[(4) - (6)].expr))); } else { value = 0; } (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ctype_makeInnerFixedArray (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), value)); lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(5) - (6)].tok)); ;} break; case 34: { setCurrentParams (uentryList_missingParams); ;} break; case 35: { ctype ct = ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), uentryList_makeMissingParams ()); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ct); idDecl_addClauses ((yyval.ntyp), (yyvsp[(6) - (6)].funcclauselist)); context_popLoc (); lltok_free2 ((yyvsp[(3) - (6)].tok), (yyvsp[(4) - (6)].tok)); ;} break; case 36: { setCurrentParams ((yyvsp[(4) - (5)].entrylist)); ;} break; case 37: { clearCurrentParams (); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (7)].ntyp), ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (7)].ntyp)), (yyvsp[(4) - (7)].entrylist))); idDecl_addClauses ((yyval.ntyp), (yyvsp[(7) - (7)].funcclauselist)); context_popLoc (); lltok_free ((yyvsp[(3) - (7)].tok)); /*!! lltok_free2 ($3, $5); */ ;} break; case 38: { setCurrentParams ((yyvsp[(4) - (5)].entrylist)); ;} break; case 39: { clearCurrentParams (); ;} break; case 40: { declareCIter ((yyvsp[(2) - (10)].cname), (yyvsp[(4) - (10)].entrylist)); lltok_free3 ((yyvsp[(1) - (10)].tok), (yyvsp[(3) - (10)].tok), (yyvsp[(5) - (10)].tok)); ;} break; case 41: { exprNode_checkMacroBody ((yyvsp[(2) - (3)].expr)); lltok_free2 ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 42: { exprNode_checkIterBody ((yyvsp[(2) - (3)].expr)); lltok_free2 ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 43: { exprNode_checkIterEnd ((yyvsp[(2) - (3)].expr)); lltok_free2 ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].tok));;} break; case 44: { exprChecks_checkEmptyMacroBody (); lltok_free2 ((yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].tok)); ;} break; case 45: { clabstract_declareFunction ((yyvsp[(1) - (1)].ntyp)); ;} break; case 46: { (yyval.msconstraint) = metaStateConstraint_create ((yyvsp[(1) - (3)].msspec), (yyvsp[(3) - (3)].msexpr)); lltok_free ((yyvsp[(2) - (3)].tok)); ;} break; case 47: { cscannerHelp_expectingMetaStateName (); ;} break; case 48: { cscannerHelp_clearExpectingMetaStateName (); (yyval.msspec) = metaStateSpecifier_create ((yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].msinfo)); lltok_free ((yyvsp[(3) - (4)].tok)); ;} break; case 49: { cscannerHelp_expectingMetaStateName (); ;} break; case 50: { cscannerHelp_clearExpectingMetaStateName (); (yyval.msspec) = metaStateSpecifier_createElipsis ((yyvsp[(4) - (4)].msinfo)); lltok_free2 ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].tok)); ;} break; case 51: { (yyval.msexpr) = metaStateExpression_create ((yyvsp[(1) - (1)].msspec)); ;} break; case 52: { (yyval.msexpr) = metaStateExpression_createMerge ((yyvsp[(1) - (3)].msspec), (yyvsp[(3) - (3)].msexpr)); lltok_free ((yyvsp[(2) - (3)].tok)); ;} break; case 56: { (yyval.conL) = constraintList_add ((yyvsp[(3) - (3)].conL), (yyvsp[(1) - (3)].con)); ;} break; case 57: { (yyval.conL) = constraintList_single ((yyvsp[(1) - (1)].con)); ;} break; case 58: { (yyval.con) = makeConstraintParse3 ((yyvsp[(1) - (3)].conE), (yyvsp[(2) - (3)].tok), (yyvsp[(3) - (3)].conE)); DPRINTF(("Done BufConstraint1\n")); ;} break; case 65: {(yyval.conE) = constraintExpr_parseMakeUnaryOp ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].conE)); DPRINTF( ("Got BufConstraintExpr UNary Op ") ); ;} break; case 66: { DPRINTF( ("Got BufConstraintExpr BINary Op ") ); (yyval.conE) = constraintExpr_parseMakeBinaryOp ((yyvsp[(2) - (5)].conE), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].conE)); ;} break; case 67: { (yyval.conE) = constraintExpr_makeTermsRef ((yyvsp[(1) - (1)].sr));;} break; case 68: { (yyval.conE) = constraintExpr_makeIntLiteral (exprNode_getLongValue ((yyvsp[(1) - (1)].expr))); ;} break; case 69: { /*@-onlytrans@*/ (yyval.sr) = checkbufferConstraintClausesId ((yyvsp[(1) - (1)].entry)); /*@=onlytrans@*/ /*@i523@*/ ;} break; case 70: { (yyval.sr) = fixStateClausesId ((yyvsp[(1) - (1)].cname)); ;} break; case 71: { (yyval.sr) = sRef_makeAnyArrayFetch ((yyvsp[(1) - (3)].sr)); ;} break; case 72: { /* char *t; int c; t = cstring_toCharsSafe (exprNode_unparse($3)); c = atoi( t ); */ (yyval.sr) = sRef_makeArrayFetchKnown ((yyvsp[(1) - (4)].sr), exprNode_getLongValue ((yyvsp[(3) - (4)].expr))); ;} break; case 73: { (yyval.sr) = sRef_constructPointer ((yyvsp[(2) - (2)].sr)); ;} break; case 74: { (yyval.sr) = (yyvsp[(2) - (3)].sr); ;} break; case 75: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_buildField ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 76: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_makeArrow ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 80: { (yyval.funcclauselist) = functionClauseList_new (); ;} break; case 81: { (yyval.funcclauselist) = functionClauseList_prepend ((yyvsp[(2) - (2)].funcclauselist), (yyvsp[(1) - (2)].funcclause)); ;} break; case 82: { (yyval.funcclauselist) = functionClauseList_new (); ;} break; case 83: { (yyval.funcclauselist) = functionClauseList_prepend ((yyvsp[(2) - (2)].funcclauselist), (yyvsp[(1) - (2)].funcclause)); ;} break; case 84: { (yyval.funcclause) = functionClause_createGlobals ((yyvsp[(1) - (1)].globsclause)); ;} break; case 85: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 86: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 87: { (yyval.funcclause) = functionClause_createState ((yyvsp[(1) - (1)].stateclause)); ;} break; case 88: { (yyval.funcclause) = (yyvsp[(1) - (1)].funcclause); ;} break; case 89: { (yyval.funcclause) = functionClause_createWarn ((yyvsp[(1) - (1)].warnclause)); ;} break; case 90: { (yyval.funcclause) = functionClause_createGlobals ((yyvsp[(1) - (1)].globsclause)); ;} break; case 91: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 92: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 93: { (yyval.funcclause) = functionClause_createState ((yyvsp[(1) - (1)].stateclause)); ;} break; case 94: { (yyval.funcclause) = (yyvsp[(1) - (1)].funcclause); ;} break; case 95: { (yyval.funcclause) = functionClause_createWarn ((yyvsp[(1) - (1)].warnclause)); ;} break; case 96: { (yyval.globsclause) = (yyvsp[(1) - (2)].globsclause); ;} break; case 97: { setProcessingGlobalsList (); ;} break; case 98: { unsetProcessingGlobals (); (yyval.globsclause) = globalsClause_create ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].globset)); ;} break; case 99: { (yyval.modsclause) = modifiesClause_createNoMods ((yyvsp[(1) - (1)].tok)); ;} break; case 100: { (yyval.modsclause) = (yyvsp[(1) - (2)].modsclause); ;} break; case 101: { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 102: { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); (yyval.modsclause) = modifiesClause_create ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].srset)); ;} break; case 103: { (yyval.flagspec) = flagSpec_createPlain ((yyvsp[(1) - (1)].cname)); ;} break; case 104: { (yyval.flagspec) = flagSpec_createOr ((yyvsp[(1) - (3)].cname), (yyvsp[(3) - (3)].flagspec)); ;} break; case 107: { (yyval.warnclause) = warnClause_undefined; ;} break; case 108: { (yyval.warnclause) = (yyvsp[(1) - (2)].warnclause); ;} break; case 109: { llassert (exprNode_knownStringValue ((yyvsp[(3) - (3)].expr))); (yyval.warnclause) = warnClause_create ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].flagspec), cstring_copy (multiVal_forceString (exprNode_getValue ((yyvsp[(3) - (3)].expr))))); exprNode_free ((yyvsp[(3) - (3)].expr)); ;} break; case 110: { (yyval.warnclause) = warnClause_create ((yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].flagspec), cstring_undefined); ;} break; case 111: { (yyval.globset) = globSet_single ((yyvsp[(1) - (1)].sr)); ;} break; case 112: { (yyval.globset) = globSet_insert ((yyvsp[(1) - (3)].globset), (yyvsp[(3) - (3)].sr)); ;} break; case 113: { (yyval.sr) = clabstract_createGlobal ((yyvsp[(2) - (2)].sr), (yyvsp[(1) - (2)].tquallist)); ;} break; case 114: { (yyval.tquallist) = qualList_undefined; ;} break; case 115: { (yyval.tquallist) = qualList_add ((yyvsp[(2) - (2)].tquallist), (yyvsp[(1) - (2)].typequal)); ;} break; case 116: { (yyval.sr) = uentry_getSref ((yyvsp[(1) - (1)].entry)); ;} break; case 117: { (yyval.sr) = clabstract_unrecognizedGlobal ((yyvsp[(1) - (1)].cname)); ;} break; case 118: { (yyval.sr) = clabstract_checkGlobal ((yyvsp[(1) - (1)].expr)); ;} break; case 119: { (yyval.typequal) = qual_createUndef (); ;} break; case 120: { (yyval.typequal) = qual_createKilled (); ;} break; case 121: { (yyval.typequal) = qual_createOut (); ;} break; case 122: { (yyval.typequal) = qual_createIn (); ;} break; case 123: { (yyval.typequal) = qual_createPartial (); ;} break; case 131: { /**!!! deal with fred; fred (int); declarations! **/ qtype qint = qtype_create (ctype_int); (yyval.ntyp) = idDecl_fixBase ((yyvsp[(1) - (1)].ntyp), qint); qtype_free (qint); ;} break; case 132: { (yyval.ntyp) = idDecl_fixBase ((yyvsp[(3) - (3)].ntyp), (yyvsp[(1) - (3)].qtyp)); ;} break; case 133: { checkDoneParams (); context_enterInnerContext (); ;} break; case 134: { exprNode_checkFunctionBody ((yyvsp[(3) - (3)].expr)); (yyval.expr) = (yyvsp[(3) - (3)].expr); context_exitInner ((yyvsp[(3) - (3)].expr)); ;} break; case 135: { context_enterOldStyleScope (); ;} break; case 136: { oldStyleDoneParams (); context_enterInnerContext (); ;} break; case 137: { exprNode_checkFunctionBody ((yyvsp[(4) - (4)].expr)); (yyval.expr) = (yyvsp[(4) - (4)].expr); /* oldstyle */ context_exitInner ((yyvsp[(4) - (4)].expr)); ;} break; case 138: { context_setFunctionDefined (exprNode_loc ((yyvsp[(2) - (2)].expr))); exprNode_checkFunction (context_getHeader (), (yyvsp[(2) - (2)].expr)); /* DRL 8 8 2000 */ context_exitFunction (); ;} break; case 139: { (yyval.srset) = (yyvsp[(1) - (2)].srset); ;} break; case 140: { (yyval.srset) = sRefSet_new (); ;} break; case 141: { (yyval.sr) = uentry_getSref ((yyvsp[(1) - (1)].entry)); checkModifiesId ((yyvsp[(1) - (1)].entry)); ;} break; case 142: { (yyval.sr) = fixModifiesId ((yyvsp[(1) - (1)].cname)); ;} break; case 143: { (yyval.sr) = fixModifiesId ((yyvsp[(1) - (1)].cname)); ;} break; case 144: { (yyval.sr) = modListArrayFetch ((yyvsp[(1) - (3)].sr), sRef_undefined); ;} break; case 145: { (yyval.sr) = modListArrayFetch ((yyvsp[(1) - (4)].sr), (yyvsp[(3) - (4)].sr)); ;} break; case 146: { (yyval.sr) = modListPointer ((yyvsp[(2) - (2)].sr)); ;} break; case 147: { (yyval.sr) = (yyvsp[(2) - (3)].sr); ;} break; case 148: { (yyval.sr) = modListFieldAccess ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 149: { (yyval.sr) = modListArrowAccess ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 150: { (yyval.sr) = (yyvsp[(1) - (1)].sr); ;} break; case 151: { (yyval.sr) = sRef_makeUnknown (); /* sRef_makeConstant ($1); ? */ ;} break; case 152: { (yyval.srset) = sRefSet_single ((yyvsp[(1) - (1)].sr)); ;} break; case 153: { (yyval.srset) = sRefSet_insert ((yyvsp[(1) - (3)].srset), (yyvsp[(3) - (3)].sr)); ;} break; case 154: { (yyval.sr) = checkStateClausesId ((yyvsp[(1) - (1)].entry)); ;} break; case 155: { (yyval.sr) = fixStateClausesId ((yyvsp[(1) - (1)].cname)); ;} break; case 156: { (yyval.sr) = sRef_makeAnyArrayFetch ((yyvsp[(1) - (3)].sr)); ;} break; case 157: { (yyval.sr) = sRef_makeAnyArrayFetch ((yyvsp[(1) - (4)].sr)); ;} break; case 158: { (yyval.sr) = sRef_constructPointer ((yyvsp[(2) - (2)].sr)); ;} break; case 159: { (yyval.sr) = (yyvsp[(2) - (3)].sr); ;} break; case 160: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_buildField ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 161: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_makeArrow ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 162: { DPRINTF ((message("Empty optSpecClauseList") )); (yyval.srset) = sRefSet_undefined ;} break; case 164: { if (sRef_isValid ((yyvsp[(1) - (1)].sr))) { (yyval.srset) = sRefSet_single ((yyvsp[(1) - (1)].sr)); } else { DPRINTF((message("returning sRefSEt_undefined ") )); (yyval.srset) = sRefSet_undefined; } ;} break; case 165: { if (sRef_isValid ((yyvsp[(3) - (3)].sr))) { (yyval.srset) = sRefSet_insert ((yyvsp[(1) - (3)].srset), (yyvsp[(3) - (3)].sr)); } else { (yyval.srset) = (yyvsp[(1) - (3)].srset); } ;} break; case 166: { (yyval.expr) = exprNode_fromIdentifier ((yyvsp[(1) - (1)].entry)); ;} break; case 167: { (yyval.expr) = exprNode_fromUIO ((yyvsp[(1) - (1)].cname)); ;} break; case 169: { (yyval.expr) = exprNode_addParens ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].expr)); ;} break; case 170: { (yyval.expr) = exprNode_fromIdentifier (cscannerHelp_coerceId ((yyvsp[(1) - (1)].cname))); ;} break; case 171: { (yyval.expr) = exprNode_makeError (); ;} break; case 172: { exprChecks_inCompoundStatementExpression (); ;} break; case 173: { exprChecks_leaveCompoundStatementExpression (); (yyval.expr) = exprNode_compoundStatementExpression ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].expr)); ;} break; case 175: { (yyval.expr) = exprNode_arrayFetch ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;} break; case 176: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (3)].expr), exprNodeList_new ()); ;} break; case 177: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].exprlist)); ;} break; case 178: { (yyval.expr) = exprNode_vaArg ((yyvsp[(1) - (6)].tok), (yyvsp[(3) - (6)].expr), (yyvsp[(5) - (6)].qtyp)); ;} break; case 179: { (yyval.expr) = exprNode_fieldAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 180: { (yyval.expr) = exprNode_arrowAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 181: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 182: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 183: { /* added for C99 */ (yyval.expr) = exprNode_undefined; /*@i87 no checking */ ;} break; case 184: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 185: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (3)].exprlist), (yyvsp[(3) - (3)].expr)); ;} break; case 187: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 188: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 189: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 190: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 191: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 192: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 193: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 194: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 195: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 196: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 197: { (yyval.cstringlist) = cstringList_add ((yyvsp[(1) - (3)].cstringlist), (yyvsp[(3) - (3)].cname)); lltok_free ((yyvsp[(2) - (3)].tok)); ;} break; case 198: { (yyval.cstringlist) = (yyvsp[(1) - (4)].cstringlist); lltok_free2 ((yyvsp[(2) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 199: { (yyval.cstringlist) = cstringList_single ((yyvsp[(1) - (1)].cname)); ;} break; case 200: { (yyval.expr) = exprNode_offsetof ((yyvsp[(4) - (9)].qtyp), (yyvsp[(7) - (9)].cstringlist)); lltok_free3 ((yyvsp[(1) - (9)].tok), (yyvsp[(3) - (9)].tok), (yyvsp[(6) - (9)].tok)); lltok_free ((yyvsp[(8) - (9)].tok)); ;} break; case 201: { context_setProtectVars (); ;} break; case 202: { context_sizeofReleaseVars (); (yyval.expr) = (yyvsp[(3) - (3)].expr); ;} break; case 203: {context_enterSizeof();} break; case 204: {context_leaveSizeof();} break; case 205: { (yyval.expr) = exprNode_sizeofType ((yyvsp[(3) - (4)].qtyp)); lltok_free3 ((yyvsp[(1) - (4)].tok), (yyvsp[(2) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 206: { (yyval.expr) = exprNode_sizeofExpr ((yyvsp[(2) - (2)].expr)); lltok_free ((yyvsp[(1) - (2)].tok)); ;} break; case 207: { (yyval.expr) = exprNode_alignofType ((yyvsp[(3) - (4)].qtyp)); lltok_free3 ((yyvsp[(1) - (4)].tok), (yyvsp[(2) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 208: { (yyval.expr) = exprNode_alignofExpr ((yyvsp[(2) - (2)].expr)); lltok_free ((yyvsp[(1) - (2)].tok)); ;} break; case 210: { (yyval.expr) = exprNode_cast ((yyvsp[(1) - (4)].tok), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].qtyp)); lltok_free ((yyvsp[(3) - (4)].tok)); ;} break; case 212: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 213: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 214: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 216: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 217: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 219: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 220: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 222: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 223: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 224: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 225: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 227: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 228: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 230: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 232: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 234: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 236: { exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterAndClause ((yyvsp[(1) - (2)].expr)); ;} break; case 237: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].tok)); context_exitAndClause ((yyval.expr), (yyvsp[(4) - (4)].expr)); ;} break; case 239: { exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterOrClause ((yyvsp[(1) - (2)].expr)); ;} break; case 240: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].tok)); context_exitOrClause ((yyval.expr), (yyvsp[(4) - (4)].expr)); ;} break; case 242: { /* GCC extension: conditional with empty if */ exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 243: { context_enterFalseClause ((yyvsp[(1) - (4)].expr)); ;} break; case 244: { (yyval.expr) = exprNode_condIfOmit ((yyvsp[(1) - (6)].expr), (yyvsp[(6) - (6)].expr)); context_exitClause ((yyvsp[(1) - (6)].expr), exprNode_undefined, (yyvsp[(6) - (6)].expr)); ;} break; case 245: { exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 246: { context_enterFalseClause ((yyvsp[(1) - (5)].expr)); ;} break; case 247: { (yyval.expr) = exprNode_cond ((yyvsp[(1) - (7)].expr), (yyvsp[(4) - (7)].expr), (yyvsp[(7) - (7)].expr)); context_exitClause ((yyvsp[(1) - (7)].expr), (yyvsp[(4) - (7)].expr), (yyvsp[(7) - (7)].expr)); ;} break; case 249: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 250: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 251: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 252: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 253: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 254: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 255: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 256: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 257: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 258: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 259: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 261: { (yyval.expr) = exprNode_comma ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 262: { (yyval.expr) = exprNode_undefined; ;} break; case 265: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 266: { doVaDcl (); (yyval.expr) = exprNode_makeError (); ;} break; case 267: { (yyval.expr) = exprNode_makeError (); ;} break; case 268: { (yyval.expr) = exprNode_makeError (); ;} break; case 269: { setProcessingVars ((yyvsp[(1) - (4)].qtyp)); processNamedDecl ((yyvsp[(3) - (4)].ntyp)); ;} break; case 270: { unsetProcessingVars (); (yyval.expr) = exprNode_makeEmptyInitialization ((yyvsp[(3) - (9)].ntyp)); DPRINTF (("Empty initialization: %s", exprNode_unparse ((yyval.expr)))); ;} break; case 271: { setProcessingVars ((yyvsp[(1) - (5)].qtyp)); processNamedDecl ((yyvsp[(3) - (5)].ntyp)); ;} break; case 272: { (yyval.expr) = exprNode_concat ((yyvsp[(9) - (11)].expr), exprNode_makeInitialization ((yyvsp[(3) - (11)].ntyp), (yyvsp[(8) - (11)].expr))); unsetProcessingVars (); ;} break; case 273: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 274: { (yyval.expr) = exprNode_fromIdentifier (usymtab_getTypeEntry (ctype_typeId ((yyvsp[(1) - (1)].ctyp)))); ;} break; case 275: { processNamedDecl ((yyvsp[(1) - (2)].ntyp)); (yyval.expr) = exprNode_makeEmptyInitialization ((yyvsp[(1) - (2)].ntyp)); ;} break; case 276: { processNamedDecl ((yyvsp[(1) - (3)].ntyp)); ;} break; case 277: { (yyval.expr) = exprNode_makeInitialization ((yyvsp[(1) - (6)].ntyp), (yyvsp[(6) - (6)].expr)); ;} break; case 278: { setProcessingTypedef ((yyvsp[(2) - (2)].qtyp)); ;} break; case 279: { clabstract_declareType ((yyvsp[(5) - (8)].exprlist), (yyvsp[(7) - (8)].warnclause)); ;} break; case 280: { /* in the ANSI grammar, semantics unclear */ ;} break; case 281: { /* in the ANSI grammar, semantics unclear */ ;} break; case 282: { cscannerHelp_setExpectingTypeName (); ;} break; case 283: { cscannerHelp_setExpectingTypeName (); context_pushLoc (); ;} break; case 284: { (yyval.exprlist) = (yyvsp[(1) - (2)].exprlist); ;} break; case 285: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 286: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (4)].exprlist), (yyvsp[(4) - (4)].expr)); ;} break; case 287: { (yyval.exprlist) = (yyvsp[(1) - (2)].exprlist); ;} break; case 288: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 289: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (4)].exprlist), (yyvsp[(4) - (4)].expr)); ;} break; case 290: { (yyval.expr) = exprNode_makeError (); ;} break; case 291: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].expr)); ;} break; case 293: { (yyval.expr) = exprNode_makeInitBlock ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].exprlist)); lltok_free ((yyvsp[(3) - (3)].tok)); ;} break; case 294: { (yyval.expr) = exprNode_makeInitBlock ((yyvsp[(1) - (4)].tok), (yyvsp[(2) - (4)].exprlist)); lltok_free2 ((yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 295: { (yyval.expr) = exprNode_undefined; ;} break; case 296: { (yyval.expr) = (yyvsp[(1) - (2)].expr); ;} break; case 297: { (yyval.expr) = exprNode_undefined; /* gcc extension, obsolete since 2.5 */ ;} break; case 298: { (yyval.expr) = exprNode_undefined; ;} break; case 299: { (yyval.expr) = exprNode_undefined; ;} break; case 300: { (yyval.expr) = exprNode_undefined; ;} break; case 301: { (yyval.expr) = exprNode_undefined; ;} break; case 302: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 303: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (3)].exprlist), (yyvsp[(3) - (3)].expr)); ;} break; case 304: { setStorageClass (SCEXTERN); (yyval.typequal) = qual_createExtern (); ;} break; case 305: { (yyval.typequal) = qual_createInline (); ;} break; case 306: { setStorageClass (SCSTATIC); (yyval.typequal) = qual_createStatic (); ;} break; case 307: { (yyval.typequal) = qual_createAuto (); ;} break; case 308: { (yyval.typequal) = qual_createRegister (); ;} break; case 309: { (yyval.stateclause) = (yyvsp[(1) - (2)].stateclause); ;} break; case 310: { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 311: { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); (yyval.stateclause) = stateClause_createPlain ((yyvsp[(1) - (6)].tok), (yyvsp[(4) - (6)].srset)); ;} break; case 312: { (yyval.funcclause) = (yyvsp[(1) - (2)].funcclause); ;} break; case 313: { (yyval.tok) = (yyvsp[(1) - (2)].tok); context_enterFunctionHeader (); ;} break; case 314: { context_exitFunctionHeader (); context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 315: { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); (yyval.funcclause) = functionClause_createState (stateClause_create ((yyvsp[(1) - (6)].tok), (yyvsp[(2) - (6)].typequal), (yyvsp[(4) - (6)].srset))); ;} break; case 316: { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 317: { context_exitFunctionHeader (); exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); DPRINTF (("done optGlobBufConstraintsAux\n")); if (lltok_isEnsures ((yyvsp[(1) - (5)].tok))) { (yyval.funcclause) = functionClause_createEnsures ((yyvsp[(3) - (5)].fcnconstraint)); } else if (lltok_isRequires ((yyvsp[(1) - (5)].tok))) { (yyval.funcclause) = functionClause_createRequires ((yyvsp[(3) - (5)].fcnconstraint)); } else { BADBRANCH; } DPRINTF (("FunctionclauseS: %s", functionClause_unparse ((yyval.funcclause)))); ;} break; case 318: { (yyval.fcnconstraint) = functionConstraint_createBufferConstraint ((yyvsp[(1) - (1)].conL)); ;} break; case 319: { (yyval.fcnconstraint) = functionConstraint_createMetaStateConstraint ((yyvsp[(1) - (1)].msconstraint)); DPRINTF (("Made constraint: %s", functionConstraint_unparse ((yyval.fcnconstraint)))); ;} break; case 320: { (yyval.typequal) = qual_createExits (); ;} break; case 321: { (yyval.typequal) = qual_createMayExit (); ;} break; case 322: { (yyval.typequal) = qual_createTrueExit (); ;} break; case 323: { (yyval.typequal) = qual_createFalseExit (); ;} break; case 324: { (yyval.typequal) = qual_createNeverExit (); ;} break; case 325: { (yyval.typequal) = qual_createChecked (); ;} break; case 326: { (yyval.typequal) = qual_createCheckMod (); ;} break; case 327: { (yyval.typequal) = qual_createUnchecked (); ;} break; case 328: { (yyval.typequal) = qual_createCheckedStrict (); ;} break; case 329: { (yyval.typequal) = qual_createOwned (); ;} break; case 330: { (yyval.typequal) = qual_createDependent (); ;} break; case 331: { (yyval.typequal) = qual_createYield (); ;} break; case 332: { (yyval.typequal) = qual_createTemp (); ;} break; case 333: { (yyval.typequal) = qual_createOnly (); ;} break; case 334: { (yyval.typequal) = qual_createKeep (); ;} break; case 335: { (yyval.typequal) = qual_createKept (); ;} break; case 336: { (yyval.typequal) = qual_createShared (); ;} break; case 337: { (yyval.typequal) = qual_createUnique (); ;} break; case 338: { (yyval.typequal) = qual_createNull (); ;} break; case 339: { (yyval.typequal) = qual_createIsNull (); ;} break; case 340: { (yyval.typequal) = qual_createRelNull (); ;} break; case 341: { (yyval.typequal) = qual_createNotNull (); ;} break; case 342: { (yyval.typequal) = qual_createExposed (); ;} break; case 343: { (yyval.typequal) = qual_createObserver (); ;} break; case 344: { (yyval.typequal) = qual_createNullTerminated (); ;} break; case 345: { (yyval.typequal) = qual_createMetaState ((yyvsp[(1) - (1)].annotation)); ;} break; case 346: { (yyval.typequal) = qual_createReturned (); ;} break; case 347: { (yyval.typequal) = qual_createSef (); ;} break; case 348: { (yyval.typequal) = qual_createUnused (); ;} break; case 349: { (yyval.typequal) = qual_createExternal (); ;} break; case 350: { (yyval.typequal) = qual_createTrueNull (); ;} break; case 351: { (yyval.typequal) = qual_createFalseNull (); ;} break; case 352: { (yyval.typequal) = qual_createAbstract (); ;} break; case 353: { (yyval.typequal) = qual_createNumAbstract (); ;} break; case 354: { (yyval.typequal) = qual_createConcrete (); ;} break; case 355: { (yyval.typequal) = qual_createMutable (); ;} break; case 356: { (yyval.typequal) = qual_createImmutable (); ;} break; case 357: { (yyval.typequal) = qual_createRefCounted (); ;} break; case 358: { (yyval.typequal) = qual_createRefs (); ;} break; case 359: { (yyval.typequal) = qual_createKillRef (); ;} break; case 360: { (yyval.typequal) = qual_createRelDef (); ;} break; case 361: { (yyval.typequal) = qual_createNewRef (); ;} break; case 362: { (yyval.typequal) = qual_createTempRef (); ;} break; case 363: { (yyval.typequal) = qual_createShort (); ;} break; case 364: { (yyval.typequal) = qual_createLong (); ;} break; case 365: { (yyval.typequal) = qual_createSigned (); ;} break; case 366: { (yyval.typequal) = qual_createUnsigned (); ;} break; case 367: { (yyval.typequal) = qual_createOut (); ;} break; case 368: { (yyval.typequal) = qual_createIn (); ;} break; case 369: { (yyval.typequal) = qual_createPartial (); ;} break; case 370: { (yyval.typequal) = qual_createSpecial (); ;} break; case 371: { (yyval.typequal) = qual_createConst (); ;} break; case 372: { (yyval.typequal) = qual_createVolatile (); ;} break; case 373: { (yyval.typequal) = qual_createRestrict (); ;} break; case 374: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 375: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 376: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 377: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 378: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 379: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 380: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 381: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 382: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 389: { (yyval.ctyp) = ctype_makeAnytype (); ;} break; case 390: { (yyval.ctyp) = ctype_anyintegral; ;} break; case 391: { (yyval.ctyp) = ctype_unsignedintegral; ;} break; case 392: { (yyval.ctyp) = ctype_signedintegral; ;} break; case 396: { (yyval.ctyp) = ctype_fromQual ((yyvsp[(1) - (2)].typequal)); ;} break; case 397: { (yyval.qtyp) = qtype_resolve ((yyvsp[(2) - (3)].qtyp)); ;} break; case 398: { (yyval.qtyp) = (yyvsp[(1) - (1)].qtyp); ;} break; case 399: { (yyval.qtyp) = qtype_mergeAlt ((yyvsp[(1) - (4)].qtyp), (yyvsp[(3) - (4)].qtyp)); ;} break; case 401: { (yyval.qtyp) = qtype_mergeAlt ((yyvsp[(1) - (3)].qtyp), (yyvsp[(3) - (3)].qtyp)); ;} break; case 402: { (yyval.qtyp) = qtype_addQual ((yyvsp[(2) - (2)].qtyp), (yyvsp[(1) - (2)].typequal)); ;} break; case 403: { (yyval.qtyp) = qtype_addQual ((yyvsp[(2) - (2)].qtyp), (yyvsp[(1) - (2)].typequal)); ;} break; case 404: { (yyval.qtyp) = qtype_combine ((yyvsp[(2) - (2)].qtyp), (yyvsp[(1) - (2)].ctyp)); ;} break; case 405: { (yyval.qtyp) = qtype_unknown (); ;} break; case 406: { (yyval.qtyp) = (yyvsp[(1) - (1)].qtyp); ;} break; case 407: { (yyval.conL) = constraintList_undefined; ;} break; case 408: { sRef_setGlobalScopeSafe (); ;} break; case 409: { sRef_clearGlobalScopeSafe (); ;} break; case 410: { ctype ct; ct = declareStruct ((yyvsp[(3) - (12)].cname), (yyvsp[(8) - (12)].flist)); /* context_setGlobalStructInfo(ct, $12); */ (yyval.ctyp) = ct; ;} break; case 411: { sRef_setGlobalScopeSafe (); ;} break; case 412: { sRef_clearGlobalScopeSafe (); ;} break; case 413: { (yyval.ctyp) = declareUnion ((yyvsp[(3) - (11)].cname), (yyvsp[(8) - (11)].flist)); ;} break; case 414: { (yyval.ctyp) = declareStruct ((yyvsp[(3) - (6)].cname), uentryList_new ()); ;} break; case 415: { (yyval.ctyp) = declareUnion ((yyvsp[(3) - (6)].cname), uentryList_new ()); ;} break; case 416: { sRef_setGlobalScopeSafe (); ;} break; case 417: { sRef_clearGlobalScopeSafe (); ;} break; case 418: { (yyval.ctyp) = declareUnnamedStruct ((yyvsp[(7) - (10)].flist)); ;} break; case 419: { sRef_setGlobalScopeSafe (); ;} break; case 420: { sRef_clearGlobalScopeSafe (); ;} break; case 421: { (yyval.ctyp) = declareUnnamedUnion ((yyvsp[(7) - (10)].flist)); ;} break; case 422: { (yyval.ctyp) = ctype_createUnnamedStruct (uentryList_new ()); ;} break; case 423: { (yyval.ctyp) = ctype_createUnnamedUnion (uentryList_new ()); ;} break; case 424: { (yyval.ctyp) = handleStruct ((yyvsp[(3) - (4)].cname)); ;} break; case 425: { (yyval.ctyp) = handleUnion ((yyvsp[(3) - (4)].cname)); ;} break; case 426: { cscannerHelp_clearExpectingTypeName (); ;} break; case 428: { (yyval.flist) = uentryList_undefined; /* bogus! */ ;} break; case 429: { (yyval.flist) = uentryList_mergeFields ((yyvsp[(1) - (2)].flist), (yyvsp[(2) - (2)].flist)); ;} break; case 430: { (yyval.flist) = fixUentryList ((yyvsp[(3) - (5)].ntyplist), (yyvsp[(1) - (5)].qtyp)); ;} break; case 431: { (yyval.flist) = fixUnnamedDecl ((yyvsp[(1) - (3)].qtyp)); ;} break; case 432: { (yyval.ntyplist) = idDeclList_singleton ((yyvsp[(1) - (2)].ntyp)); ;} break; case 433: { (yyval.ntyplist) = idDeclList_add ((yyvsp[(1) - (4)].ntyplist), (yyvsp[(3) - (4)].ntyp)); ;} break; case 434: { (yyval.ntyp) = (yyvsp[(1) - (1)].ntyp); ;} break; case 435: { (yyval.ntyp) = idDecl_undefined; ;} break; case 436: { (yyval.ntyp) = (yyvsp[(1) - (4)].ntyp); ;} break; case 437: { (yyval.ctyp) = declareUnnamedEnum ((yyvsp[(4) - (6)].enumnamelist)); ;} break; case 438: { context_pushLoc (); ;} break; case 439: { context_popLoc (); (yyval.ctyp) = declareEnum ((yyvsp[(3) - (8)].cname), (yyvsp[(6) - (8)].enumnamelist)); ;} break; case 440: { (yyval.ctyp) = handleEnum ((yyvsp[(3) - (4)].cname)); ;} break; case 441: { (yyval.enumnamelist) = enumNameList_single ((yyvsp[(1) - (1)].cname)); ;} break; case 442: { (yyval.enumnamelist) = enumNameList_push ((yyvsp[(1) - (3)].enumnamelist), (yyvsp[(3) - (3)].cname)); ;} break; case 444: { uentry ue = uentry_makeEnumConstant ((yyvsp[(1) - (1)].cname), ctype_unknown); usymtab_supGlobalEntry (ue); (yyval.cname) = (yyvsp[(1) - (1)].cname); ;} break; case 445: { uentry ue = uentry_makeEnumInitializedConstant ((yyvsp[(1) - (4)].cname), ctype_unknown, (yyvsp[(4) - (4)].expr)); usymtab_supGlobalEntry (ue); (yyval.cname) = (yyvsp[(1) - (4)].cname); ;} break; case 447: { (yyval.ntyp) = idDecl_create (cstring_undefined, qtype_create ((yyvsp[(1) - (1)].ctyp))); ;} break; case 448: { qtype qt = qtype_unknown (); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), qt); (yyval.ntyp) = idDecl_create (cstring_copy (cscannerHelp_observeLastIdentifier ()), qt); ;} break; case 449: { (yyval.ntyp) = (yyvsp[(2) - (2)].ntyp); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), idDecl_getTyp ((yyval.ntyp))); ;} break; case 451: { (yyval.ntyp) = (yyvsp[(2) - (2)].ntyp); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), idDecl_getTyp ((yyval.ntyp))); ;} break; case 452: { (yyval.entrylist) = handleParamTypeList ((yyvsp[(1) - (1)].entrylist)); ;} break; case 453: { (yyval.entrylist) = handleParamIdList ((yyvsp[(2) - (2)].entrylist)); ;} break; case 454: { (yyval.typequal) = qual_createConst (); ;} break; case 455: { (yyval.typequal) = qual_createRestrict (); ;} break; case 456: { (yyval.typequal) = qual_createVolatile (); ;} break; case 457: { (yyval.tquallist) = qualList_single ((yyvsp[(1) - (1)].typequal)); ;} break; case 458: { (yyval.tquallist) = qualList_add ((yyvsp[(1) - (2)].tquallist), (yyvsp[(2) - (2)].typequal)); ;} break; case 459: { (yyval.pointers) = pointers_create ((yyvsp[(1) - (1)].tok)); ;} break; case 460: { (yyval.pointers) = pointers_createMods ((yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].tquallist)); ;} break; case 461: { (yyval.pointers) = pointers_extend (pointers_create ((yyvsp[(1) - (2)].tok)), (yyvsp[(2) - (2)].pointers)); ;} break; case 462: { (yyval.pointers) = pointers_extend (pointers_createMods ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].tquallist)), (yyvsp[(3) - (3)].pointers)); ;} break; case 464: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (3)].entrylist), uentry_makeElipsisMarker ()); ;} break; case 465: { (yyval.entrylist) = uentryList_single (uentry_makeVariableLoc ((yyvsp[(1) - (1)].cname), ctype_int)); ;} break; case 466: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (3)].entrylist), uentry_makeVariableLoc ((yyvsp[(3) - (3)].cname), ctype_int)); ;} break; case 467: { (yyval.entrylist) = uentryList_single (uentry_makeElipsisMarker ()); ;} break; case 469: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (3)].entrylist), uentry_makeElipsisMarker ()); ;} break; case 470: { storeLoc (); ;} break; case 471: { (yyval.entrylist) = uentryList_single ((yyvsp[(2) - (2)].oentry)); ;} break; case 472: { storeLoc (); ;} break; case 473: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (4)].entrylist), (yyvsp[(4) - (4)].oentry)); ;} break; case 474: { if (isFlipOldStyle ()) { llparseerror (cstring_makeLiteral ("Inconsistent function parameter syntax (mixing old and new style declaration)")); } else { setNewStyle (); } (yyval.oentry) = makeCurrentParam (idDecl_fixParamBase ((yyvsp[(3) - (4)].ntyp), (yyvsp[(2) - (4)].qtyp))); ;} break; case 475: { idDecl tparam = idDecl_create ((yyvsp[(1) - (1)].cname), qtype_unknown ()); if (isNewStyle ()) { llparseerror (message ("Inconsistent function parameter syntax: %q", idDecl_unparse (tparam))); } setFlipOldStyle (); (yyval.oentry) = makeCurrentParam (tparam); idDecl_free (tparam); ;} break; case 477: { (yyval.qtyp) = qtype_newBase ((yyvsp[(1) - (2)].qtyp), (yyvsp[(2) - (2)].ctyp)); ;} break; case 478: { (yyval.ctyp) = ctype_adjustPointers ((yyvsp[(1) - (1)].pointers), ctype_unknown); ;} break; case 480: { (yyval.ctyp) = ctype_adjustPointers ((yyvsp[(1) - (2)].pointers), (yyvsp[(2) - (2)].ctyp)); ;} break; case 481: { (yyval.ctyp) = ctype_unknown; ;} break; case 483: { (yyval.ctyp) = ctype_expectFunction ((yyvsp[(4) - (5)].ctyp)); ;} break; case 484: { (yyval.ctyp) = ctype_makeArray (ctype_unknown); ;} break; case 485: { (yyval.ctyp) = ctype_makeFixedArray (ctype_unknown, exprNode_getLongValue ((yyvsp[(2) - (3)].expr))); ;} break; case 486: { (yyval.ctyp) = ctype_makeInnerArray ((yyvsp[(1) - (3)].ctyp)); ;} break; case 487: { (yyval.ctyp) = ctype_makeInnerFixedArray ((yyvsp[(1) - (4)].ctyp), exprNode_getLongValue ((yyvsp[(3) - (4)].expr))); ;} break; case 488: { (yyval.ctyp) = ctype_makeFunction (ctype_unknown, uentryList_makeMissingParams ()); ;} break; case 489: { (yyval.ctyp) = ctype_makeParamsFunction (ctype_unknown, (yyvsp[(3) - (4)].entrylist)); ;} break; case 490: { (yyval.ctyp) = ctype_makeFunction ((yyvsp[(1) - (4)].ctyp), uentryList_makeMissingParams ()); ;} break; case 491: { (yyval.ctyp) = ctype_makeParamsFunction ((yyvsp[(1) - (5)].ctyp), (yyvsp[(4) - (5)].entrylist)); ;} break; case 502: { exprNode_revealState ((yyvsp[(3) - (4)].expr)); (yyval.expr) = exprNode_undefined; ;} break; case 503: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 506: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 507: { (yyval.expr) = exprNode_while ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 508: { (yyval.expr) = exprNode_doWhile ((yyvsp[(2) - (7)].expr), (yyvsp[(5) - (7)].expr)); ;} break; case 509: { (yyval.expr) = exprNode_doWhile ((yyvsp[(2) - (6)].expr), (yyvsp[(5) - (6)].expr)); ;} break; case 510: { (yyval.expr) = exprNode_for ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 511: { context_setProtectVars (); ;} break; case 512: { context_sizeofReleaseVars (); ;} break; case 513: { (yyval.expr) = exprNode_forPred ((yyvsp[(3) - (10)].expr), (yyvsp[(5) - (10)].expr), (yyvsp[(8) - (10)].expr)); context_enterForClause ((yyvsp[(5) - (10)].expr)); ;} break; case 514: { setProcessingIterVars ((yyvsp[(1) - (3)].entry)); ;} break; case 515: { (yyval.expr) = exprNode_iterStart ((yyvsp[(1) - (6)].entry), (yyvsp[(5) - (6)].exprlist)); ;} break; case 516: { (yyval.expr) = exprNode_createId ((yyvsp[(1) - (1)].entry)); ;} break; case 520: { (yyval.expr) = (yyvsp[(1) - (2)].expr); DPRINTF (("def stmt: %s", exprNode_unparse ((yyval.expr)))); ;} break; case 528: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 529: { (yyval.expr) = exprNode_makeError (); ;} break; case 530: { exprNode_checkIfPred ((yyvsp[(1) - (1)].expr)); ;} break; case 531: { /* don't: context_exitTrueClause ($1, $2); */ (yyval.expr) = exprNode_if ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 532: { (yyval.expr) = exprNode_createTok ((yyvsp[(2) - (2)].tok)); ;} break; case 533: { (yyval.expr) = exprNode_createTok ((yyvsp[(2) - (2)].tok)); ;} break; case 544: { (yyval.expr) = exprNode_addParens ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].expr)); ;} break; case 547: { (yyval.expr) = exprNode_makeError (); ;} break; case 548: { (yyval.expr) = exprNode_labelMarker ((yyvsp[(1) - (2)].cname)); ;} break; case 549: { (yyval.expr) = exprNode_notReached ((yyvsp[(2) - (2)].expr)); ;} break; case 550: { ; ;} break; case 551: { ; ;} break; case 552: { context_enterCaseClause ((yyvsp[(2) - (2)].expr)); ;} break; case 553: { (yyval.expr) = exprNode_caseMarker ((yyvsp[(2) - (4)].expr), FALSE); ;} break; case 554: { context_enterCaseClause ((yyvsp[(4) - (4)].expr)); ;} break; case 555: { (yyval.expr) = exprNode_caseMarker ((yyvsp[(4) - (6)].expr), TRUE); ;} break; case 556: { context_enterCaseClause (exprNode_undefined); ;} break; case 557: { (yyval.expr) = exprNode_defaultMarker ((yyvsp[(1) - (3)].tok), FALSE); ;} break; case 558: { context_enterCaseClause (exprNode_undefined); ;} break; case 559: { (yyval.expr) = exprNode_defaultMarker ((yyvsp[(3) - (5)].tok), TRUE); ;} break; case 560: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 561: { (yyval.expr) = (yyvsp[(2) - (2)].expr); context_exitInner ((yyvsp[(2) - (2)].expr)); ;} break; case 562: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 563: { context_enterInnerContext (); ;} break; case 564: { context_exitInnerPlain (); ;} break; case 565: { context_enterStructInnerContext (); ;} break; case 566: { context_exitStructInnerContext (); ;} break; case 567: { context_exitInnerSafe (); ;} break; case 568: { (yyval.expr) = exprNode_createTok ((yyvsp[(1) - (1)].tok)); ;} break; case 569: { (yyval.expr) = exprNode_notReached (exprNode_createTok ((yyvsp[(2) - (2)].tok))); ;} break; case 570: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(1) - (2)].expr), lltok_getLoc ((yyvsp[(2) - (2)].tok))); ;} break; case 571: { (yyval.expr) = exprNode_notReached (exprNode_updateLocation ((yyvsp[(1) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok)))); ;} break; case 572: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(1) - (2)].expr), lltok_getLoc ((yyvsp[(2) - (2)].tok))); ;} break; case 573: { (yyval.expr) = exprNode_notReached (exprNode_updateLocation ((yyvsp[(1) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok)))); ;} break; case 574: { (yyval.expr) = exprNode_updateLocation (exprNode_concat ((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].expr)), lltok_getLoc ((yyvsp[(3) - (3)].tok))); ;} break; case 575: { (yyval.expr) = exprNode_notReached (exprNode_updateLocation (exprNode_concat ((yyvsp[(1) - (4)].expr), (yyvsp[(2) - (4)].expr)), lltok_getLoc ((yyvsp[(3) - (4)].tok)))); ;} break; case 576: { (yyval.expr) = exprNode_makeBlock ((yyvsp[(2) - (2)].expr)); ;} break; case 577: { (yyval.expr) = exprNode_createTok ((yyvsp[(2) - (2)].tok)); ;} break; case 578: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(2) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok))); ;} break; case 579: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(2) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok))); ;} break; case 580: { (yyval.expr) = exprNode_updateLocation (exprNode_concat ((yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)), lltok_getLoc ((yyvsp[(4) - (4)].tok))); ;} break; case 582: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 583: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 584: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 585: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 586: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 587: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 588: { (yyval.expr) = (yyvsp[(2) - (4)].expr); ;} break; case 589: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 590: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 591: { (yyval.expr) = exprNode_createTok ((yyvsp[(1) - (1)].tok)); ;} break; case 592: { (yyval.expr) = exprNode_statement ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 593: { (yyval.expr) = exprNode_createTok ((yyvsp[(1) - (1)].tok)); ;} break; case 594: { (yyval.expr) = exprNode_statement ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 595: { (yyval.expr) = exprNode_checkExpr ((yyvsp[(1) - (1)].expr)); ;} break; case 596: { exprNode_produceGuards ((yyvsp[(3) - (4)].expr)); context_enterTrueClause ((yyvsp[(3) - (4)].expr)); exprNode_checkIfPred ((yyvsp[(3) - (4)].expr)); (yyval.expr) = (yyvsp[(3) - (4)].expr); ;} break; case 597: { context_exitTrueClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); (yyval.expr) = exprNode_if ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 598: { context_enterFalseClause ((yyvsp[(1) - (3)].expr)); ;} break; case 599: { context_exitClause ((yyvsp[(1) - (5)].expr), (yyvsp[(2) - (5)].expr), (yyvsp[(5) - (5)].expr)); (yyval.expr) = exprNode_ifelse ((yyvsp[(1) - (5)].expr), (yyvsp[(2) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;} break; case 600: { context_enterSwitch ((yyvsp[(3) - (3)].expr)); ;} break; case 601: { (yyval.expr) = exprNode_switch ((yyvsp[(3) - (6)].expr), (yyvsp[(6) - (6)].expr)); ;} break; case 602: { (yyval.expr) = exprNode_whilePred ((yyvsp[(3) - (4)].expr)); context_enterWhileClause ((yyvsp[(3) - (4)].expr)); ;} break; case 603: { (yyval.expr) = exprNode_whilePred((yyvsp[(3) - (4)].expr)); ;} break; case 604: { context_enterIterClause (); ;} break; case 605: { setProcessingIterVars ((yyvsp[(1) - (4)].entry)); ;} break; case 606: { (yyval.expr) = exprNode_iter ((yyvsp[(1) - (10)].entry), (yyvsp[(6) - (10)].exprlist), (yyvsp[(8) - (10)].expr), (yyvsp[(9) - (10)].entry)); ;} break; case 607: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 608: { nextIterParam (); ;} break; case 609: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (4)].exprlist), (yyvsp[(4) - (4)].expr)); ;} break; case 610: { (yyval.expr) = exprNode_iterExpr ((yyvsp[(1) - (1)].expr)); ;} break; case 611: { (yyval.expr) = exprNode_iterId ((yyvsp[(1) - (1)].entry)); ;} break; case 612: { uentry ue = cscannerHelp_coerceIterId ((yyvsp[(1) - (1)].cname)); if (uentry_isValid (ue)) { (yyval.expr) = exprNode_iterId (ue); } else { (yyval.expr) = exprNode_iterNewId (cstring_copy (cscannerHelp_observeLastIdentifier ())); } ;} break; case 613: { (yyval.expr) = exprNode_iterNewId ((yyvsp[(1) - (1)].cname)); ;} break; case 615: { (yyval.expr) = exprNode_combineLiterals ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 617: { (yyval.expr) = exprNode_addParens ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].expr)); ;} break; case 619: { (yyval.expr) = exprNode_arrayFetch ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;} break; case 620: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (3)].expr), exprNodeList_new ()); ;} break; case 621: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].exprlist)); ;} break; case 622: { (yyval.expr) = exprNode_vaArg ((yyvsp[(1) - (6)].tok), (yyvsp[(3) - (6)].expr), (yyvsp[(5) - (6)].qtyp)); ;} break; case 623: { (yyval.expr) = exprNode_fieldAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 624: { (yyval.expr) = exprNode_arrowAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 625: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 626: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 628: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 629: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 630: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 631: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 632: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 633: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 634: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 635: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 636: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 638: { (yyval.expr) = exprNode_cast ((yyvsp[(1) - (4)].tok), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].qtyp)); ;} break; case 640: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 641: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 642: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 644: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 645: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 647: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 648: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 650: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 651: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 652: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 653: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 655: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 656: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 658: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 660: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 662: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 664: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 666: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 668: { context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 669: { context_enterFalseClause ((yyvsp[(1) - (4)].expr)); ;} break; case 670: { (yyval.expr) = exprNode_condIfOmit ((yyvsp[(1) - (6)].expr), (yyvsp[(6) - (6)].expr)); ;} break; case 671: { context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 672: { context_enterFalseClause ((yyvsp[(1) - (5)].expr)); ;} break; case 673: { (yyval.expr) = exprNode_cond ((yyvsp[(1) - (7)].expr), (yyvsp[(4) - (7)].expr), (yyvsp[(7) - (7)].expr)); ;} break; case 675: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 676: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 677: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 678: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 679: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 680: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 681: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 682: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 683: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 684: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 685: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 686: { (yyval.entry) = (yyvsp[(1) - (1)].entry); ;} break; case 687: { (yyval.entry) = uentry_undefined; ;} break; case 688: { context_enterDoWhileClause (); (yyval.tok) = (yyvsp[(1) - (1)].tok); ;} break; case 689: { (yyval.expr) = exprNode_while ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitWhileClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 690: { (yyval.expr) = exprNode_statement (exprNode_doWhile ((yyvsp[(2) - (7)].expr), (yyvsp[(5) - (7)].expr)), (yyvsp[(7) - (7)].tok)); ;} break; case 691: { (yyval.expr) = exprNode_for ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitForClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 692: { (yyval.expr) = exprNode_while ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitWhileClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 693: { (yyval.expr) = exprNode_statement (exprNode_doWhile ((yyvsp[(2) - (7)].expr), (yyvsp[(5) - (7)].expr)), (yyvsp[(7) - (7)].tok)); ;} break; case 694: { (yyval.expr) = exprNode_doWhile ((yyvsp[(2) - (6)].expr), (yyvsp[(5) - (6)].expr)); ;} break; case 695: { (yyval.expr) = exprNode_for ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitForClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 696: { (yyval.expr) = exprNode_goto ((yyvsp[(2) - (3)].cname)); ;} break; case 697: { (yyval.expr) = exprNode_continue ((yyvsp[(1) - (2)].tok), BADTOK); ;} break; case 698: { (yyval.expr) = exprNode_continue ((yyvsp[(1) - (3)].tok), QINNERCONTINUE); ;} break; case 699: { (yyval.expr) = exprNode_break ((yyvsp[(1) - (2)].tok), BADTOK); ;} break; case 700: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QSWITCHBREAK); ;} break; case 701: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QLOOPBREAK); ;} break; case 702: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QINNERBREAK); ;} break; case 703: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QSAFEBREAK); ;} break; case 704: { (yyval.expr) = exprNode_nullReturn ((yyvsp[(1) - (2)].tok)); ;} break; case 705: { (yyval.expr) = exprNode_return ((yyvsp[(2) - (3)].expr)); ;} break; case 707: { ; ;} break; case 709: { ; ;} break; case 712: { (yyval.cname) = uentry_getName ((yyvsp[(1) - (1)].entry)); ;} break; case 713: { (yyval.cname) = uentry_getName ((yyvsp[(1) - (1)].entry)); ;} break; case 714: { (yyval.cname) = uentry_getName ((yyvsp[(1) - (1)].entry)); ;} break; case 715: { (yyval.cname) = (yyvsp[(1) - (1)].cname); ;} break; case 717: { (yyval.ctyp) = ctype_unknown; ;} break; case 718: { (yyval.ctyp) = exprNode_getType ((yyvsp[(3) - (4)].expr)); exprNode_free ((yyvsp[(3) - (4)].expr)); ;} break; case 719: { (yyval.ctyp) = qtype_getType ((yyvsp[(3) - (4)].qtyp)); ;} break; /* Line 1267 of yacc.c. */ default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /*@-redecl@*/ /*@-namechecks@*/ extern char *yytext; /*@=redecl@*/ /*@=namechecks@*/ # include "bison.reset" void yyerror (/*@unused@*/ char *s) { static bool givehint = FALSE; if (context_inIterDef ()) { llerror (FLG_SYNTAX, message ("Iter syntax not parseable: %s", context_inFunctionName ())); } else if (context_inIterEnd ()) { llerror (FLG_SYNTAX, message ("Iter finalizer syntax not parseable: %s", context_inFunctionName ())); } else if (context_inMacro ()) { llerror (FLG_SYNTAX, message ("Macro syntax not parseable: %s", context_inFunctionName ())); if (context_inUnknownMacro ()) { if (!givehint) { llhint (cstring_makeLiteral ("Precede macro definition with /*@notfunction@*/ " "to suppress checking and force expansion")); givehint = TRUE; } } cscannerHelp_swallowMacro (); context_exitAllClausesQuiet (); } else { llparseerror (cstring_undefined); } } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/cscanner.c0000644021234200000250000025102510645761522014207 0ustar fax/* ** Inserted at beginning of c files generated by flex ** REMEMBER: Change flex.reset too. */ /*@-allmacros@*/ /*@-pred@*/ /*@-globstate@*/ /*@-null@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macrospec@*/ /*@-macroredef@*/ /*@-exitarg@*/ /*@-compdef@*/ /*@-uniondef@*/ /*@+ignorequals@*/ /*@-noreturn@*/ /*@-mustfree@*/ /*@-compdestroy@*/ /*@-branchstate@*/ /*@-unreachable@*/ /*@-varuse@*/ /*@-fcnuse@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-redecl@*/ /*@-loopswitchbreak@*/ /*@-switchswitchbreak@*/ /*@-sizeoftype@*/ /*@-czechfcns@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-ifblock@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-elseifcomplete@*/ /*@+ptrnegate@*/ /*@-onlytrans@*/ /*@-temptrans@*/ /*@-immediatetrans@*/ /*@-namechecks@*/ /*@+matchanyintegral@*/ /*@-statictrans@*/ /*@-compmempass@*/ /*@-forempty@*/ /*@-evalorder@*/ /*@-retalias@*/ /*@-dependenttrans@*/ /*@-noeffect@*/ /*@-protoparammatch@*/ /*@-casebreak@*/ /*@-retvalother@*/ /*@-exportheader@*/ /*drl added 11/27/2001*/ # ifdef __LCLINT__ /*@-redecl@*/ /*@-type@*/ extern int cgrammar_lsllex (void); /*@=redecl@*/ /*@=type@*/ /* ** Need to do this because ECHO is defined by the Posix library. ** flex shouldn't use it. */ /*@notfunction@*/ # define ECHO \ fwrite (yytext, yyleng, 1, yyout) # ifndef DEFFILENO extern /*@external@*/ int fileno (/* FILE *stream */); # define DEFFILENO # endif # endif # ifdef OSF # undef __GNUC__ # endif /*@-redecl@*/ /* < end of flex.head > */ /* A lexical scanner generated by flex*/ /* Scanner skeleton version: * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #include #include /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ #ifdef c_plusplus #ifndef __cplusplus #define __cplusplus #endif #endif #ifdef __cplusplus #include /* Use prototypes in function declarations. */ #define YY_USE_PROTOS /* The "const" storage-class-modifier is valid. */ #define YY_USE_CONST #else /* ! __cplusplus */ #if __STDC__ #define YY_USE_PROTOS #define YY_USE_CONST #endif /* __STDC__ */ #endif /* ! __cplusplus */ #ifdef __TURBOC__ #pragma warn -rch #pragma warn -use #include #include #define YY_USE_CONST #define YY_USE_PROTOS #endif #ifdef YY_USE_CONST #define yyconst const #else #define yyconst #endif #ifdef YY_USE_PROTOS #define YY_PROTO(proto) proto #else #define YY_PROTO(proto) () #endif /* Returned upon end-of-file. */ #define YY_NULL 0 /* Promotes a possibly negative, possibly signed char to an unsigned * integer for use as an array index. If the signed char is negative, * we want to instead treat it as an 8-bit unsigned char, hence the * double cast. */ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN yy_start = 1 + 2 * /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START ((yy_start - 1) / 2) #define YYSTATE YY_START /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* Special action meaning "start processing a new file". */ #define YY_NEW_FILE yyrestart( yyin ) #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 typedef struct yy_buffer_state *YY_BUFFER_STATE; extern int yyleng; extern FILE *yyin, *yyout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 /* The funky do-while in the following #define is used to turn the definition * int a single C statement (which needs a semi-colon terminator). This * avoids problems with code like: * * if ( condition_holds ) * yyless( 5 ); * else * do_something_else(); * * Prior to using the do-while the compiler would get upset at the * "else" because it interpreted the "if" statement as being all * done when it reached the ';' after the yyless() call. */ /* Return all but the first 'n' matched characters back to the input stream. */ #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ *yy_cp = yy_hold_char; \ YY_RESTORE_YY_MORE_OFFSET \ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) #define unput(c) yyunput( c, yytext_ptr ) /* Some routines like yy_flex_realloc() are emitted as static but are not called by all lexers. This generates warnings in some compilers, notably GCC. Arrange to suppress these. */ #ifdef __GNUC__ #define YY_MAY_BE_UNUSED __attribute__((unused)) #else #define YY_MAY_BE_UNUSED #endif /* The following is because we cannot portably get our hands on size_t * (without autoconf's help, which isn't available because we want * flex-generated scanners to compile on their own). */ typedef unsigned int yy_size_t; struct yy_buffer_state { FILE *yy_input_file; char *yy_ch_buf; /* input buffer */ char *yy_buf_pos; /* current position in input buffer */ /* Size of input buffer in bytes, not including room for EOB * characters. */ yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. */ int yy_n_chars; /* Whether we "own" the buffer - i.e., we know we created it, * and can realloc() it to grow it, and should free() it to * delete it. */ int yy_is_our_buffer; /* Whether this is an "interactive" input source; if so, and * if we're using stdio for input, then we want to use getc() * instead of fread(), to make sure we stop fetching input after * each newline. */ int yy_is_interactive; /* Whether we're considered to be at the beginning of a line. * If so, '^' rules will be active on the next match, otherwise * not. */ int yy_at_bol; /* Whether to try to fill the input buffer when we reach the * end of it. */ int yy_fill_buffer; int yy_buffer_status; #define YY_BUFFER_NEW 0 #define YY_BUFFER_NORMAL 1 /* When an EOF's been seen but there's still some text to process * then we mark the buffer as YY_EOF_PENDING, to indicate that we * shouldn't try reading from the input source any more. We might * still have a bunch of tokens to match, though, because of * possible backing-up. * * When we actually see the EOF, we change the status to "new" * (via yyrestart()), so that the user can continue scanning by * just pointing yyin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 }; static YY_BUFFER_STATE yy_current_buffer = 0; /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general * "scanner state". */ #define YY_CURRENT_BUFFER yy_current_buffer /* yy_hold_char holds the character lost when yytext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ int yyleng; /* Points to current character in buffer. */ static char *yy_c_buf_p = (char *) 0; static int yy_init = 1; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches * instead of setting up a fresh yyin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; void yyrestart YY_PROTO(( FILE *input_file )); void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); void yy_load_buffer_state YY_PROTO(( void )); YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); static void *yy_flex_alloc YY_PROTO(( yy_size_t )); static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )) YY_MAY_BE_UNUSED; static void yy_flex_free YY_PROTO(( void * )); #define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_is_interactive = is_interactive; \ } #define yy_set_bol(at_bol) \ { \ if ( ! yy_current_buffer ) \ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ yy_current_buffer->yy_at_bol = at_bol; \ } #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) typedef unsigned char YY_CHAR; FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; typedef int yy_state_type; extern char *yytext; #define yytext_ptr yytext static yy_state_type yy_get_previous_state YY_PROTO(( void )); static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); static int yy_get_next_buffer YY_PROTO(( void )); static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. */ #define YY_DO_BEFORE_ACTION \ yytext_ptr = yy_bp; \ yyleng = (int) (yy_cp - yy_bp); \ yy_hold_char = *yy_cp; \ *yy_cp = '\0'; \ yy_c_buf_p = yy_cp; #define YY_NUM_RULES 190 #define YY_END_OF_BUFFER 191 static yyconst short int yy_accept[575] = { 0, 0, 0, 191, 189, 167, 168, 155, 189, 3, 88, 161, 154, 189, 149, 150, 159, 158, 146, 157, 153, 160, 103, 103, 147, 143, 162, 148, 163, 166, 189, 88, 88, 151, 188, 152, 164, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 144, 165, 145, 156, 142, 0, 43, 0, 2, 88, 127, 186, 187, 136, 128, 0, 0, 125, 133, 123, 134, 124, 135, 0, 117, 1, 126, 138, 120, 96, 0, 105, 104, 0, 103, 132, 139, 141, 140, 131, 0, 0, 0, 0, 0, 88, 129, 88, 88, 88, 88, 88, 88, 88, 88, 9, 88, 88, 88, 88, 88, 88, 88, 13, 46, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 130, 137, 0, 0, 2, 110, 4, 0, 115, 116, 117, 0, 118, 119, 98, 97, 0, 114, 106, 107, 107, 89, 122, 121, 175, 176, 173, 178, 183, 174, 185, 184, 179, 182, 177, 180, 181, 0, 0, 0, 44, 0, 0, 0, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 11, 88, 88, 27, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 45, 88, 88, 88, 88, 88, 88, 88, 78, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 0, 43, 0, 0, 117, 0, 115, 116, 0, 120, 99, 100, 100, 112, 113, 109, 108, 90, 92, 171, 172, 0, 0, 0, 0, 111, 88, 88, 88, 88, 40, 88, 6, 29, 88, 88, 88, 88, 88, 88, 10, 25, 88, 88, 88, 88, 12, 88, 88, 88, 53, 88, 31, 88, 88, 88, 88, 54, 88, 88, 72, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 26, 88, 88, 88, 0, 117, 102, 101, 91, 93, 93, 0, 170, 0, 44, 0, 88, 88, 88, 88, 5, 88, 36, 88, 88, 88, 88, 88, 88, 88, 30, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 73, 88, 88, 88, 88, 88, 88, 88, 88, 32, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 81, 24, 88, 88, 88, 88, 88, 18, 80, 95, 94, 169, 88, 84, 88, 88, 88, 88, 88, 88, 88, 28, 88, 39, 88, 21, 88, 56, 82, 88, 88, 86, 64, 88, 88, 88, 88, 88, 88, 88, 88, 62, 88, 88, 14, 79, 34, 15, 88, 42, 22, 17, 88, 88, 88, 88, 88, 76, 19, 20, 88, 85, 38, 49, 68, 88, 88, 8, 88, 63, 88, 88, 88, 66, 87, 55, 88, 88, 88, 88, 47, 88, 88, 61, 88, 88, 48, 65, 88, 23, 88, 88, 88, 88, 69, 7, 88, 77, 88, 88, 88, 88, 74, 16, 88, 41, 37, 88, 57, 88, 33, 35, 88, 75, 58, 88, 88, 88, 88, 88, 88, 71, 88, 88, 88, 88, 88, 88, 67, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 50, 88, 88, 59, 88, 88, 70, 88, 60, 88, 88, 83, 88, 88, 88, 88, 88, 88, 88, 88, 52, 88, 88, 51, 0 } ; static yyconst int yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 30, 32, 33, 34, 8, 8, 8, 35, 36, 37, 8, 8, 8, 38, 39, 40, 41, 42, 8, 43, 44, 8, 45, 46, 47, 48, 49, 50, 1, 51, 52, 53, 54, 55, 56, 57, 58, 59, 8, 60, 61, 62, 63, 64, 65, 8, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 } ; static yyconst int yy_meta[79] = { 0, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 3, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 1, 1, 1, 1, 1, 1, 1, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 2, 5, 5, 5, 5, 5, 5, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1 } ; static yyconst short int yy_base[585] = { 0, 0, 0, 749, 750, 750, 750, 723, 73, 0, 0, 55, 71, 700, 750, 750, 721, 67, 750, 68, 66, 74, 80, 87, 750, 750, 65, 720, 77, 750, 99, 98, 693, 750, 750, 750, 718, 692, 28, 675, 67, 51, 73, 82, 676, 84, 55, 675, 687, 89, 98, 686, 681, 105, 102, 672, 62, 676, 674, 750, 86, 750, 750, 750, 132, 175, 729, 0, 0, 750, 750, 750, 750, 750, 144, 163, 750, 750, 750, 750, 750, 750, 713, 151, 750, 750, 750, 165, 172, 179, 167, 144, 0, 198, 705, 750, 750, 750, 704, 239, 691, 691, 176, 679, 653, 750, 671, 650, 654, 666, 653, 160, 656, 157, 649, 650, 647, 164, 654, 650, 647, 644, 0, 127, 648, 655, 648, 645, 635, 635, 637, 643, 636, 646, 640, 632, 636, 632, 181, 641, 138, 178, 641, 159, 636, 632, 624, 627, 191, 641, 195, 631, 634, 750, 750, 259, 240, 0, 750, 750, 271, 750, 750, 269, 278, 750, 750, 235, 203, 286, 290, 182, 750, 233, 267, 750, 750, 750, 647, 658, 750, 750, 750, 750, 750, 750, 750, 750, 750, 750, 647, 648, 275, 310, 681, 274, 244, 275, 619, 614, 617, 629, 624, 612, 624, 250, 625, 620, 622, 618, 610, 607, 615, 602, 617, 0, 603, 607, 610, 595, 598, 601, 604, 280, 594, 596, 597, 602, 589, 582, 0, 599, 585, 599, 592, 203, 582, 580, 0, 582, 581, 583, 590, 591, 575, 573, 573, 575, 584, 583, 579, 581, 571, 575, 566, 246, 578, 580, 569, 568, 302, 329, 625, 313, 317, 324, 750, 750, 322, 327, 285, 750, 304, 750, 750, 750, 750, 316, 319, 750, 750, 599, 587, 364, 350, 750, 570, 569, 560, 549, 0, 561, 0, 0, 560, 551, 559, 548, 553, 554, 0, 0, 547, 547, 557, 543, 0, 547, 552, 547, 0, 73, 0, 552, 551, 550, 535, 291, 537, 547, 0, 547, 541, 535, 531, 542, 527, 529, 528, 538, 524, 536, 526, 530, 529, 534, 533, 519, 521, 529, 527, 525, 517, 522, 523, 511, 523, 0, 507, 519, 519, 348, 351, 750, 750, 322, 750, 321, 544, 750, 355, 373, 568, 519, 501, 501, 502, 0, 319, 0, 503, 504, 510, 508, 507, 498, 497, 0, 504, 492, 496, 502, 500, 503, 485, 496, 490, 495, 491, 478, 479, 0, 495, 476, 476, 487, 481, 482, 477, 485, 0, 484, 481, 485, 482, 466, 475, 477, 462, 475, 476, 0, 0, 465, 473, 469, 464, 465, 0, 0, 750, 750, 750, 469, 0, 454, 466, 466, 455, 449, 449, 461, 0, 461, 463, 444, 0, 461, 0, 0, 455, 456, 0, 0, 448, 442, 452, 451, 441, 443, 440, 447, 0, 440, 447, 0, 0, 440, 0, 437, 0, 0, 0, 441, 435, 439, 434, 438, 0, 0, 0, 431, 0, 0, 0, 424, 436, 434, 0, 425, 0, 426, 425, 424, 0, 0, 0, 422, 420, 416, 425, 0, 412, 413, 0, 410, 414, 0, 0, 415, 0, 420, 420, 418, 404, 0, 0, 403, 0, 409, 401, 409, 27, 0, 0, 412, 0, 0, 398, 0, 411, 405, 0, 397, 0, 0, 389, 398, 409, 393, 404, 402, 0, 381, 373, 363, 372, 359, 350, 0, 354, 342, 356, 353, 338, 338, 349, 337, 346, 332, 0, 344, 343, 0, 345, 338, 0, 340, 0, 332, 326, 0, 322, 338, 313, 268, 198, 175, 176, 144, 0, 100, 104, 0, 750, 412, 416, 420, 425, 429, 431, 436, 441, 446, 451 } ; static yyconst short int yy_def[585] = { 0, 574, 1, 574, 574, 574, 574, 574, 575, 576, 577, 574, 574, 578, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 577, 577, 574, 574, 574, 574, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 574, 574, 574, 574, 574, 575, 574, 575, 579, 577, 574, 574, 574, 574, 574, 578, 578, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 580, 574, 574, 574, 574, 574, 574, 574, 574, 574, 581, 582, 577, 574, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 574, 574, 574, 583, 579, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 580, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 581, 574, 581, 582, 582, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 583, 574, 583, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 584, 574, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 574, 574, 574, 574, 574, 574, 574, 574, 574, 584, 574, 584, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 574, 574, 574, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 577, 0, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574 } ; static yyconst short int yy_nxt[829] = { 0, 4, 5, 6, 5, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 10, 10, 10, 10, 10, 10, 10, 31, 32, 10, 10, 10, 10, 10, 10, 10, 10, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 10, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 10, 58, 10, 59, 60, 61, 62, 65, 69, 72, 77, 528, 82, 79, 83, 83, 84, 94, 95, 107, 78, 80, 81, 529, 73, 108, 87, 85, 88, 88, 97, 98, 102, 87, 113, 93, 93, 103, 125, 153, 89, 149, 126, 114, 90, 99, 110, 89, 66, 86, 91, 90, 92, 111, 150, 100, 381, 91, 70, 112, 71, 118, 115, 89, 116, 101, 65, 382, 122, 90, 89, 119, 129, 117, 120, 123, 90, 91, 132, 124, 92, 130, 133, 158, 91, 145, 131, 573, 139, 134, 154, 140, 141, 572, 574, 135, 146, 136, 142, 83, 83, 143, 74, 147, 144, 155, 155, 66, 173, 156, 193, 160, 161, 163, 163, 162, 217, 239, 87, 75, 88, 88, 169, 218, 169, 164, 165, 170, 170, 166, 240, 171, 89, 173, 160, 161, 167, 172, 244, 203, 162, 206, 168, 204, 87, 571, 93, 93, 164, 165, 207, 194, 275, 245, 166, 89, 171, 211, 89, 570, 212, 167, 90, 241, 172, 233, 234, 272, 91, 168, 235, 569, 250, 251, 261, 574, 236, 237, 252, 275, 242, 89, 256, 195, 257, 325, 253, 90, 254, 155, 155, 568, 272, 156, 326, 91, 177, 276, 178, 270, 179, 180, 181, 182, 183, 271, 184, 185, 186, 193, 187, 188, 189, 285, 263, 262, 263, 163, 163, 264, 264, 268, 276, 268, 270, 345, 269, 269, 346, 265, 266, 277, 271, 267, 170, 170, 261, 278, 170, 170, 283, 283, 286, 287, 284, 295, 296, 313, 314, 196, 194, 273, 265, 266, 274, 353, 277, 567, 267, 155, 155, 264, 264, 156, 278, 264, 264, 351, 354, 351, 269, 269, 352, 352, 273, 269, 269, 262, 161, 274, 355, 162, 353, 357, 361, 421, 356, 387, 165, 361, 388, 166, 420, 354, 283, 283, 352, 352, 284, 352, 352, 161, 427, 283, 283, 355, 162, 284, 357, 428, 421, 165, 266, 356, 566, 267, 166, 565, 564, 420, 563, 562, 561, 560, 559, 362, 558, 557, 556, 555, 362, 554, 553, 552, 551, 266, 550, 549, 548, 547, 267, 64, 64, 64, 64, 64, 67, 546, 545, 67, 68, 544, 68, 68, 74, 74, 543, 74, 74, 157, 542, 157, 157, 174, 174, 192, 192, 192, 192, 192, 195, 195, 541, 195, 195, 260, 260, 260, 260, 260, 360, 360, 360, 360, 360, 540, 539, 538, 537, 536, 535, 534, 533, 532, 531, 530, 527, 526, 525, 524, 523, 522, 521, 520, 519, 518, 517, 516, 515, 514, 513, 512, 511, 510, 509, 508, 507, 506, 505, 504, 503, 502, 501, 500, 499, 498, 497, 496, 495, 494, 493, 492, 491, 490, 489, 488, 487, 486, 485, 484, 483, 482, 481, 480, 479, 478, 477, 476, 475, 474, 473, 472, 471, 470, 469, 468, 467, 466, 465, 464, 463, 462, 461, 460, 459, 458, 457, 456, 455, 454, 453, 452, 451, 450, 449, 448, 447, 446, 445, 444, 443, 442, 441, 440, 439, 438, 437, 436, 435, 434, 433, 432, 431, 430, 429, 426, 425, 424, 423, 574, 422, 419, 418, 417, 416, 415, 414, 413, 412, 411, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 400, 399, 398, 397, 396, 395, 394, 393, 392, 391, 390, 389, 386, 385, 384, 383, 380, 379, 378, 377, 376, 375, 374, 373, 372, 371, 370, 369, 368, 367, 366, 365, 364, 363, 359, 358, 574, 350, 349, 348, 347, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 324, 323, 322, 321, 320, 319, 318, 317, 316, 315, 312, 311, 310, 309, 308, 307, 306, 305, 304, 303, 302, 301, 300, 299, 298, 297, 294, 293, 292, 291, 290, 289, 288, 574, 282, 281, 280, 279, 259, 258, 255, 249, 248, 247, 246, 243, 238, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223, 222, 221, 220, 219, 216, 215, 214, 213, 210, 209, 208, 205, 202, 201, 200, 199, 198, 197, 196, 191, 190, 176, 175, 159, 574, 152, 151, 148, 138, 137, 128, 127, 121, 109, 106, 105, 104, 96, 76, 75, 63, 574, 3, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574 } ; static yyconst short int yy_chk[829] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 8, 11, 12, 17, 512, 20, 19, 20, 20, 21, 26, 26, 38, 17, 19, 19, 512, 12, 38, 22, 21, 22, 22, 28, 28, 31, 23, 41, 23, 23, 31, 46, 60, 22, 56, 46, 41, 22, 30, 40, 23, 8, 21, 22, 23, 22, 40, 56, 30, 311, 23, 11, 40, 11, 43, 42, 22, 42, 30, 64, 311, 45, 22, 23, 43, 49, 42, 43, 45, 23, 22, 50, 45, 22, 49, 50, 74, 23, 54, 49, 572, 53, 50, 60, 53, 53, 571, 75, 50, 54, 50, 53, 83, 83, 53, 75, 54, 53, 65, 65, 64, 91, 65, 102, 83, 83, 87, 87, 83, 123, 140, 88, 74, 88, 88, 89, 123, 89, 87, 87, 89, 89, 87, 140, 90, 88, 91, 83, 83, 88, 90, 143, 111, 83, 113, 88, 111, 93, 569, 93, 93, 87, 87, 113, 102, 171, 143, 87, 88, 90, 117, 93, 568, 117, 88, 93, 141, 90, 138, 138, 168, 93, 88, 138, 567, 148, 148, 156, 196, 138, 138, 148, 171, 141, 93, 150, 196, 150, 235, 148, 93, 148, 155, 155, 566, 168, 155, 235, 93, 99, 173, 99, 167, 99, 99, 99, 99, 99, 167, 99, 99, 99, 192, 99, 99, 99, 195, 160, 156, 160, 163, 163, 160, 160, 164, 173, 164, 167, 255, 164, 164, 255, 163, 163, 174, 167, 163, 169, 169, 260, 174, 170, 170, 193, 193, 197, 197, 193, 205, 205, 223, 223, 195, 192, 170, 163, 163, 170, 270, 174, 565, 163, 261, 261, 263, 263, 261, 174, 264, 264, 265, 272, 265, 268, 268, 265, 265, 170, 269, 269, 260, 264, 170, 277, 264, 270, 278, 284, 357, 277, 317, 269, 360, 317, 269, 355, 272, 283, 283, 351, 351, 283, 352, 352, 264, 368, 361, 361, 277, 264, 361, 278, 368, 357, 269, 352, 277, 564, 352, 269, 563, 562, 355, 560, 559, 557, 555, 554, 284, 552, 551, 549, 548, 360, 547, 546, 545, 544, 352, 543, 542, 541, 540, 352, 575, 575, 575, 575, 575, 576, 538, 537, 576, 577, 536, 577, 577, 578, 578, 535, 578, 578, 579, 534, 579, 579, 580, 580, 581, 581, 581, 581, 581, 582, 582, 533, 582, 582, 583, 583, 583, 583, 583, 584, 584, 584, 584, 584, 531, 530, 529, 528, 527, 526, 523, 521, 520, 518, 515, 511, 510, 509, 507, 504, 503, 502, 501, 499, 496, 495, 493, 492, 490, 489, 488, 487, 483, 482, 481, 479, 477, 476, 475, 471, 467, 466, 465, 464, 463, 459, 457, 454, 453, 451, 450, 449, 448, 447, 446, 445, 444, 441, 440, 437, 435, 434, 433, 431, 430, 429, 428, 427, 426, 425, 423, 417, 416, 415, 414, 413, 410, 409, 408, 407, 406, 405, 404, 403, 402, 401, 399, 398, 397, 396, 395, 394, 393, 392, 390, 389, 388, 387, 386, 385, 384, 383, 382, 381, 380, 379, 378, 376, 375, 374, 373, 372, 371, 370, 366, 365, 364, 363, 362, 358, 350, 349, 348, 346, 345, 344, 343, 342, 341, 340, 339, 338, 337, 336, 335, 334, 333, 332, 331, 330, 329, 328, 327, 326, 325, 324, 323, 322, 321, 319, 318, 316, 315, 314, 313, 309, 308, 307, 305, 304, 303, 302, 299, 298, 297, 296, 295, 294, 291, 289, 288, 287, 286, 282, 281, 262, 259, 258, 257, 256, 254, 253, 252, 251, 250, 249, 248, 247, 246, 245, 244, 243, 242, 241, 240, 239, 237, 236, 234, 233, 232, 231, 229, 228, 227, 226, 225, 224, 222, 221, 220, 219, 218, 217, 216, 214, 213, 212, 211, 210, 209, 208, 207, 206, 204, 203, 202, 201, 200, 199, 198, 194, 191, 190, 179, 178, 152, 151, 149, 147, 146, 145, 144, 142, 139, 137, 136, 135, 134, 133, 132, 131, 130, 129, 128, 127, 126, 125, 124, 121, 120, 119, 118, 116, 115, 114, 112, 110, 109, 108, 107, 106, 104, 103, 101, 100, 98, 94, 82, 66, 58, 57, 55, 52, 51, 48, 47, 44, 39, 37, 36, 32, 27, 16, 13, 7, 3, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574, 574 } ; static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. */ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; #define INITIAL 0 /*;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: splint@cs.virginia.edu ** To report a bug: splint-bug@cs.virginia.edu ** For more information: http://www.splint.org */ /* ** cscanner.l ** ** Flex lexer for C. ** Based on a C lexer by Nate Osgood ** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993 */ /* ** Modified by Herbert 08/19/97: ** - added #include for IBM's OS/2 compiler. ** - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only). */ /* ** Modified by Mike Smith ** Corrected missing 'line' in scanf() calls in handleSpecial(). ** Without this, I get an error when Splint hits a '#line' directive ** in the pre-pre-processed source files. For safety, I have made these ** conditional on OS2 and MSDOS because I don't understand why noone else ** has seen this problem. ** ** Modified by Mike Smith, 4th June 1997 ** Finally resolved the #line problem. The scanf() calls have been fixed to ** allow the following #line forms:- ** ** #line 123 "filename" ** #line 123 ** # 123 "filename" ** # 123 ** ** The last two are generated by the GNU pre-processor, apparently */ # include "splintMacros.nf" # if defined(OS2) && defined(__IBMC__) /* needed for isatty()... */ # include # else /* ** Win32 doesn't have unistd.h */ # ifndef WIN32 # include # endif # endif # include "basic.h" # include "cscannerHelp.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "osd.h" /*@notfunction@*/ # define yyinput() (incColumn (), getc (yyin)) # include "flex.head" /* Macros after this point can all be overridden by user definitions in * section 1. */ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus extern "C" int yywrap YY_PROTO(( void )); #else extern int yywrap YY_PROTO(( void )); #endif #endif #ifndef YY_NO_UNPUT static void yyunput YY_PROTO(( int c, char *buf_ptr )); #endif #ifndef yytext_ptr static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); #endif #ifdef YY_NEED_STRLEN static int yy_flex_strlen YY_PROTO(( yyconst char * )); #endif #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput YY_PROTO(( void )); #else static int input YY_PROTO(( void )); #endif #endif #if YY_STACK_USED static int yy_start_stack_ptr = 0; static int yy_start_stack_depth = 0; static int *yy_start_stack = 0; #ifndef YY_NO_PUSH_STATE static void yy_push_state YY_PROTO(( int new_state )); #endif #ifndef YY_NO_POP_STATE static void yy_pop_state YY_PROTO(( void )); #endif #ifndef YY_NO_TOP_STATE static int yy_top_state YY_PROTO(( void )); #endif #else #define YY_NO_PUSH_STATE 1 #define YY_NO_POP_STATE 1 #define YY_NO_TOP_STATE 1 #endif #ifdef YY_MALLOC_DECL YY_MALLOC_DECL #else #if __STDC__ #ifndef __cplusplus #include #endif #else /* Just try to get by without declaring the routines. This will fail * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) * or sizeof(void*) != sizeof(int). */ #endif #endif /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE #define YY_READ_BUF_SIZE 8192 #endif /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, * is returned in "result". */ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( yy_current_buffer->yy_is_interactive ) \ { \ int c = '*', n; \ for ( n = 0; n < max_size && \ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ if ( c == EOF && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ && ferror( yyin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); #endif /* No semi-colon after return; correct usage is to write "yyterminate();" - * we don't want an extra ';' after the "return" because that will cause * some compilers to complain about unreachable statements. */ #ifndef yyterminate #define yyterminate() return YY_NULL #endif /* Number of entries by which start-condition stack grows. */ #ifndef YY_START_STACK_INCR #define YY_START_STACK_INCR 25 #endif /* Report a fatal error. */ #ifndef YY_FATAL_ERROR #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) #endif /* Default declaration of generated scanner - a define so the user can * easily add parameters. */ #ifndef YY_DECL #define YY_DECL int yylex YY_PROTO(( void )) #endif /* Code executed at the beginning of each rule, after yytext and yyleng * have been set up. */ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif /* Code executed at the end of each rule. */ #ifndef YY_BREAK #define YY_BREAK break; #endif #define YY_RULE_SETUP \ YY_USER_ACTION YY_DECL { register yy_state_type yy_current_state; register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; if ( yy_init ) { yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; #endif if ( ! yy_start ) yy_start = 1; /* first start state */ if ( ! yyin ) yyin = stdin; if ( ! yyout ) yyout = stdout; if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_load_buffer_state(); } while ( 1 ) /* loops until end-of-file is reached */ { yy_cp = yy_c_buf_p; /* Support of yytext. */ *yy_cp = yy_hold_char; /* yy_bp points to the position in yy_ch_buf of the start of * the current run. */ yy_bp = yy_cp; yy_current_state = yy_start; yy_match: do { register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 575 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 750 ); yy_find_action: yy_act = yy_accept[yy_current_state]; if ( yy_act == 0 ) { /* have to back up */ yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; yy_act = yy_accept[yy_current_state]; } YY_DO_BEFORE_ACTION; do_action: /* This label is used only to access EOF actions. */ switch ( yy_act ) { /* beginning of action switch */ case 0: /* must back up */ /* undo the effects of YY_DO_BEFORE_ACTION */ *yy_cp = yy_hold_char; yy_cp = yy_last_accepting_cpos; yy_current_state = yy_last_accepting_state; goto yy_find_action; case 1: YY_RULE_SETUP { llfatalerror (cstring_makeLiteral ("Comment in pre-processor output")); } YY_BREAK case 2: YY_RULE_SETUP { context_saveLocation (); cscannerHelp_setTokLength (longUnsigned_toInt (mstring_length (yytext))); if (cscannerHelp_processHashIdentifier (cscannerHelp_makeIdentifier (yytext + 1))) { return cscannerHelp_returnString (cstring_makeLiteral ("\"\"")); } else { if (cscannerHelp_handleSpecial (yytext)) { cscannerHelp_setTokLength (1); return cscannerHelp_returnToken (0); } } } YY_BREAK case 3: YY_RULE_SETUP { if (cscannerHelp_handleSpecial (yytext)) { cscannerHelp_setTokLength (1); return cscannerHelp_returnToken (0); } } YY_BREAK case 4: YY_RULE_SETUP { cscannerHelp_setTokLength (3); return cscannerHelp_returnToken (CTOK_ELIPSIS); } YY_BREAK case 5: YY_RULE_SETUP { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (BREAK); } YY_BREAK case 6: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (CASE); } YY_BREAK case 7: YY_RULE_SETUP { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (CONTINUE); } YY_BREAK case 8: YY_RULE_SETUP { cscannerHelp_setTokLength (7); return cscannerHelp_returnToken (DEFAULT); } YY_BREAK case 9: YY_RULE_SETUP { cscannerHelp_setTokLength (2); return cscannerHelp_returnToken (DO); } YY_BREAK case 10: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (CELSE); } YY_BREAK case 11: YY_RULE_SETUP { cscannerHelp_setTokLength (3); return cscannerHelp_returnToken (CFOR); } YY_BREAK case 12: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (GOTO); } YY_BREAK case 13: YY_RULE_SETUP { cscannerHelp_setTokLength (2); return cscannerHelp_returnToken (CIF); } YY_BREAK case 14: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (RETURN); } YY_BREAK case 15: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (CSIZEOF); } YY_BREAK case 16: YY_RULE_SETUP { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (COFFSETOF); } YY_BREAK case 17: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (SWITCH); } YY_BREAK case 18: YY_RULE_SETUP { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (WHILE); } YY_BREAK case 19: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (VA_ARG); } YY_BREAK case 20: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (VA_DCL); } YY_BREAK case 21: YY_RULE_SETUP { /* gcc extension...this might not be appropriate */ cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QINLINE); } YY_BREAK case 22: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (CSTRUCT); } YY_BREAK case 23: YY_RULE_SETUP { cscannerHelp_setTokLength (7); return cscannerHelp_returnToken (CTYPEDEF); } YY_BREAK case 24: YY_RULE_SETUP { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (CUNION); } YY_BREAK case 25: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (CENUM); } YY_BREAK case 26: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnType (CVOID, ctype_void); } YY_BREAK case 27: YY_RULE_SETUP { cscannerHelp_setTokLength (3); return cscannerHelp_returnType (CINT, ctype_int); } YY_BREAK case 28: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnType (CDOUBLE, ctype_double); } YY_BREAK case 29: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnType (CGCHAR, ctype_char); } YY_BREAK case 30: YY_RULE_SETUP { cscannerHelp_setTokLength (5); return cscannerHelp_returnType (CGFLOAT, ctype_float); } YY_BREAK case 31: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (QLONG); } YY_BREAK case 32: YY_RULE_SETUP { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (QSHORT); } YY_BREAK case 33: YY_RULE_SETUP { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QUNSIGNED); } YY_BREAK case 34: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QSIGNED); } YY_BREAK case 35: YY_RULE_SETUP { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QVOLATILE); } YY_BREAK case 36: YY_RULE_SETUP { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (QCONST); } YY_BREAK case 37: YY_RULE_SETUP { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QRESTRICT); } YY_BREAK /* some systems expect this! [gack!] */ case 38: YY_RULE_SETUP { cscannerHelp_setTokLength (7); return cscannerHelp_returnToken (QCONST); } YY_BREAK case 39: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QEXTERN); } YY_BREAK case 40: YY_RULE_SETUP { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (QAUTO); } YY_BREAK case 41: YY_RULE_SETUP { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QREGISTER); } YY_BREAK case 42: YY_RULE_SETUP { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QSTATIC); } YY_BREAK case 43: YY_RULE_SETUP { return cscannerHelp_returnExpr (cscannerHelp_processString ()); } YY_BREAK case 44: YY_RULE_SETUP { return cscannerHelp_returnExpr (cscannerHelp_processWideString ()); } YY_BREAK case 45: YY_RULE_SETUP { return (cscannerHelp_processSpec (QOUT)); } YY_BREAK case 46: YY_RULE_SETUP { return (cscannerHelp_processSpec (QIN)); } YY_BREAK case 47: YY_RULE_SETUP { return (cscannerHelp_processSpec (QPARTIAL)); } YY_BREAK case 48: YY_RULE_SETUP { return (cscannerHelp_processSpec (QSPECIAL)); } YY_BREAK case 49: YY_RULE_SETUP { return (cscannerHelp_processSpec (QANYTYPE)); } YY_BREAK case 50: YY_RULE_SETUP { return (cscannerHelp_processSpec (QINTEGRALTYPE)); } YY_BREAK case 51: YY_RULE_SETUP { return (cscannerHelp_processSpec (QUNSIGNEDINTEGRALTYPE)); } YY_BREAK case 52: YY_RULE_SETUP { return (cscannerHelp_processSpec (QSIGNEDINTEGRALTYPE)); } YY_BREAK case 53: YY_RULE_SETUP { return (cscannerHelp_processSpec (QKEEP)); } YY_BREAK case 54: YY_RULE_SETUP { return (cscannerHelp_processSpec (QNULL)); } YY_BREAK case 55: YY_RULE_SETUP { return (cscannerHelp_processSpec (QNOTNULL)); } YY_BREAK case 56: YY_RULE_SETUP { return (cscannerHelp_processSpec (QISNULL)); } YY_BREAK case 57: YY_RULE_SETUP { return (cscannerHelp_processSpec (QTRUENULL)); } YY_BREAK case 58: YY_RULE_SETUP { return (cscannerHelp_processSpec (QFALSENULL)); } YY_BREAK case 59: YY_RULE_SETUP { return (cscannerHelp_processSpec (QTRUENULL)); } YY_BREAK case 60: YY_RULE_SETUP { return (cscannerHelp_processSpec (QFALSENULL)); } YY_BREAK case 61: YY_RULE_SETUP { return (cscannerHelp_processSpec (QRELNULL)); } YY_BREAK case 62: YY_RULE_SETUP { return (cscannerHelp_processSpec (QRELDEF)); } YY_BREAK case 63: YY_RULE_SETUP { return (cscannerHelp_processSpec (QEXPOSED)); } YY_BREAK case 64: YY_RULE_SETUP { return (cscannerHelp_processSpec (QNEWREF)); } YY_BREAK case 65: YY_RULE_SETUP { return (cscannerHelp_processSpec (QTEMPREF)); } YY_BREAK case 66: YY_RULE_SETUP { return (cscannerHelp_processSpec (QKILLREF)); } YY_BREAK case 67: YY_RULE_SETUP { return (cscannerHelp_processSpec (QREFCOUNTED)); } YY_BREAK case 68: YY_RULE_SETUP { return (cscannerHelp_processSpec (QCHECKED)); } YY_BREAK case 69: YY_RULE_SETUP { return (cscannerHelp_processSpec (QCHECKMOD)); } YY_BREAK case 70: YY_RULE_SETUP { return (cscannerHelp_processSpec (QCHECKEDSTRICT)); } YY_BREAK case 71: YY_RULE_SETUP { return (cscannerHelp_processSpec (QUNCHECKED)); } YY_BREAK case 72: YY_RULE_SETUP { return (cscannerHelp_processSpec (QONLY)); } YY_BREAK case 73: YY_RULE_SETUP { return (cscannerHelp_processSpec (QOWNED)); } YY_BREAK case 74: YY_RULE_SETUP { return (cscannerHelp_processSpec (QOBSERVER)); } YY_BREAK case 75: YY_RULE_SETUP { return (cscannerHelp_processSpec (QDEPENDENT)); } YY_BREAK case 76: YY_RULE_SETUP { return (cscannerHelp_processSpec (QUNUSED)); } YY_BREAK case 77: YY_RULE_SETUP { return (cscannerHelp_processSpec (QEXTERNAL)); } YY_BREAK case 78: YY_RULE_SETUP { return (cscannerHelp_processSpec (QSEF)); } YY_BREAK case 79: YY_RULE_SETUP { return (cscannerHelp_processSpec (QSHARED)); } YY_BREAK case 80: YY_RULE_SETUP { return (cscannerHelp_processSpec (QYIELD)); } YY_BREAK case 81: YY_RULE_SETUP { return (cscannerHelp_processSpec (QUNDEF)); } YY_BREAK case 82: YY_RULE_SETUP { return (cscannerHelp_processSpec (QKILLED)); } YY_BREAK case 83: YY_RULE_SETUP { return (cscannerHelp_processSpec (QNULLTERMINATED));} YY_BREAK case 84: YY_RULE_SETUP { return (cscannerHelp_processSpec (QMAXSET));} YY_BREAK case 85: YY_RULE_SETUP { return (cscannerHelp_processSpec (QMAXREAD));} YY_BREAK case 86: YY_RULE_SETUP { return (cscannerHelp_processSpec (QMAXSET));} YY_BREAK case 87: YY_RULE_SETUP { return (cscannerHelp_processSpec (QMAXREAD));} YY_BREAK case 88: YY_RULE_SETUP { int tok = cscannerHelp_processTextIdentifier (yytext); if (tok != BADTOK) { return (tok); } } YY_BREAK case 89: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_int, cscannerHelp_processHex ()); /* evs 2000-05-17 was ctype_uint */ } YY_BREAK case 90: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_lint, cscannerHelp_processHex ()); } YY_BREAK case 91: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_llint, cscannerHelp_processHex ()); } YY_BREAK case 92: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_uint, cscannerHelp_processHex ()); } YY_BREAK case 93: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ulint, cscannerHelp_processHex ()); } YY_BREAK case 94: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processHex ()); } YY_BREAK case 95: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processHex ()); } YY_BREAK case 96: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_int, cscannerHelp_processOctal ()); } YY_BREAK case 97: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_uint, cscannerHelp_processOctal ()); } YY_BREAK case 98: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_lint, cscannerHelp_processOctal ()); } YY_BREAK case 99: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_llint, cscannerHelp_processOctal ()); } YY_BREAK case 100: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ulint, cscannerHelp_processOctal ()); } YY_BREAK case 101: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processOctal ()); } YY_BREAK case 102: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processOctal ()); } YY_BREAK case 103: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_int, cscannerHelp_processDec ()); } YY_BREAK case 104: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_uint, cscannerHelp_processDec ()); } YY_BREAK case 105: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_lint, cscannerHelp_processDec ()); } YY_BREAK case 106: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_llint, cscannerHelp_processDec ()); } YY_BREAK case 107: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ulint, cscannerHelp_processDec ()); } YY_BREAK case 108: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processDec ()); } YY_BREAK case 109: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processDec ()); } YY_BREAK case 110: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnChar (cscannerHelp_processChar ()); } YY_BREAK case 111: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnChar (cscannerHelp_processChar ()); } YY_BREAK case 112: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_float, cscannerHelp_processFloat ()); } YY_BREAK case 113: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_ldouble, cscannerHelp_processFloat ()); } YY_BREAK case 114: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_double, cscannerHelp_processFloat ()); } YY_BREAK case 115: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_float, cscannerHelp_processFloat ()); } YY_BREAK case 116: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_ldouble, cscannerHelp_processFloat ()); } YY_BREAK case 117: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_double, cscannerHelp_processFloat ()); } YY_BREAK case 118: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_float, cscannerHelp_processFloat ()); } YY_BREAK case 119: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_ldouble, cscannerHelp_processFloat ()); } YY_BREAK case 120: YY_RULE_SETUP { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_double, cscannerHelp_processFloat ()); } YY_BREAK case 121: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (RIGHT_ASSIGN, 3); } YY_BREAK case 122: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (LEFT_ASSIGN, 3); } YY_BREAK case 123: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (ADD_ASSIGN, 2); } YY_BREAK case 124: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (SUB_ASSIGN, 2); } YY_BREAK case 125: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (MUL_ASSIGN, 2); } YY_BREAK case 126: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (DIV_ASSIGN, 2); } YY_BREAK case 127: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (MOD_ASSIGN, 2); } YY_BREAK case 128: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (AND_ASSIGN, 2); } YY_BREAK case 129: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (XOR_ASSIGN, 2); } YY_BREAK case 130: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (OR_ASSIGN, 2); } YY_BREAK case 131: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (RIGHT_OP, 2); } YY_BREAK case 132: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (LEFT_OP, 2); } YY_BREAK case 133: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (INC_OP, 2); } YY_BREAK case 134: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (DEC_OP, 2); } YY_BREAK case 135: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (ARROW_OP, 2); } YY_BREAK case 136: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (AND_OP, 2); } YY_BREAK case 137: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (OR_OP, 2); } YY_BREAK case 138: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TCAND, 2); } YY_BREAK case 139: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (LE_OP, 2); } YY_BREAK case 140: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (GE_OP, 2); } YY_BREAK case 141: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (EQ_OP, 2); } YY_BREAK case 142: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (NE_OP, 2); } YY_BREAK case 143: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TSEMI, 1); } YY_BREAK case 144: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TLBRACE, 1); } YY_BREAK case 145: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TRBRACE, 1); } YY_BREAK case 146: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TCOMMA, 1); } YY_BREAK case 147: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TCOLON, 1); } YY_BREAK case 148: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TASSIGN, 1); } YY_BREAK case 149: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TLPAREN, 1); } YY_BREAK case 150: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TRPAREN, 1); } YY_BREAK case 151: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TLSQBR, 1); } YY_BREAK case 152: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TRSQBR, 1); } YY_BREAK case 153: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TDOT, 1); } YY_BREAK case 154: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TAMPERSAND, 1); } YY_BREAK case 155: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TEXCL, 1); } YY_BREAK case 156: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TTILDE, 1); } YY_BREAK case 157: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TMINUS, 1); } YY_BREAK case 158: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TPLUS, 1); } YY_BREAK case 159: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TMULT, 1); } YY_BREAK case 160: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TDIV, 1); } YY_BREAK case 161: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TPERCENT, 1); } YY_BREAK case 162: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TLT, 1); } YY_BREAK case 163: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TGT, 1); } YY_BREAK case 164: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TCIRC, 1); } YY_BREAK case 165: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TBAR, 1); } YY_BREAK case 166: YY_RULE_SETUP { return cscannerHelp_returnTokenLength (TQUEST, 1); } YY_BREAK case 167: YY_RULE_SETUP { incColumn (); } YY_BREAK case 168: YY_RULE_SETUP { int tok = cscannerHelp_handleNewLine (); if (tok != BADTOK) return tok; } YY_BREAK case 169: YY_RULE_SETUP { cscannerHelp_setTokLength (6); if (cscannerHelp_processMacro ()) { if (context_inIterDef ()) { return cscannerHelp_returnToken (LLMACROITER); } if (context_inIterEnd ()) { return cscannerHelp_returnToken (LLMACROEND); } if (context_inMacro ()) { return cscannerHelp_returnToken (LLMACRO); } } } YY_BREAK case 170: YY_RULE_SETUP { if (context_inHeader () || context_inFunction ()) { cscannerHelp_handleMacro (); } else { int nspchar = cscannerHelp_ninput (); int nspaces; /* ** This is a hack to get the column number correct. */ llassert (nspchar >= '0' && nspchar <= '9'); nspaces = nspchar - '0'; cscannerHelp_setTokLength (5 + nspaces); if (cscannerHelp_processMacro ()) { DPRINTF (("Here we are: %s", context_unparse ())); if (context_inIterDef ()) { return cscannerHelp_returnToken (LLMACROITER); } if (context_inIterEnd ()) { return cscannerHelp_returnToken (LLMACROEND); } if (context_inMacro ()) { return cscannerHelp_returnToken (LLMACRO); } } } } YY_BREAK case 171: YY_RULE_SETUP { cscannerHelp_setTokLength (4); lldiagmsg (ctype_unparseTable ()); } YY_BREAK case 172: YY_RULE_SETUP { cscannerHelp_setTokLength (4); lldiagmsg (message ("Access types: %q", typeIdSet_unparse (context_fileAccessTypes ()))); } YY_BREAK case 173: YY_RULE_SETUP { cscannerHelp_setTokLength (3); lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc))); } YY_BREAK case 174: YY_RULE_SETUP { cscannerHelp_setTokLength (3); usymtab_printLocal (); } YY_BREAK case 175: YY_RULE_SETUP { cscannerHelp_setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); } YY_BREAK case 176: YY_RULE_SETUP { cscannerHelp_setTokLength (3); lldiagmsg (context_unparse ()); } YY_BREAK case 177: YY_RULE_SETUP { cscannerHelp_setTokLength (3); lldiagmsg (context_unparseClauses ()); } YY_BREAK case 178: YY_RULE_SETUP { cscannerHelp_setTokLength (3); usymtab_printGuards (); } YY_BREAK case 179: YY_RULE_SETUP { cscannerHelp_setTokLength (3); usymtab_printOut (); } YY_BREAK case 180: YY_RULE_SETUP { cscannerHelp_setTokLength (3); usymtab_printAll (); } YY_BREAK case 181: YY_RULE_SETUP { cscannerHelp_setTokLength (3); usymtab_printComplete (); } YY_BREAK case 182: YY_RULE_SETUP { cscannerHelp_setTokLength (3); usymtab_printTypes (); } YY_BREAK case 183: YY_RULE_SETUP { cscannerHelp_setTokLength (3); lldiagmsg (usymtab_unparseStack ()); } YY_BREAK case 184: YY_RULE_SETUP { cscannerHelp_setTokLength (3); return cscannerHelp_returnToken (QDREVEALSTATE); } YY_BREAK case 185: YY_RULE_SETUP { cscannerHelp_setTokLength (3); lldiagmsg (message ("Can modify: %q", sRefSet_unparse (context_modList ()))); } YY_BREAK case 186: YY_RULE_SETUP { /* BEFORE_COMMENT_MARKER */ int tok; incColumn (); incColumn (); tok = cscannerHelp_handleLlSpecial (); if (tok != BADTOK) { if (tok == CANNOTATION) { return (tok); } else { /* Beware - this bashes yylval! */ return cscannerHelp_returnToken (tok); } } } YY_BREAK case 187: YY_RULE_SETUP { /* AFTER_COMMENT_MARKER */ cscannerHelp_setTokLength (2); cscannerHelp_exitSpecPart (); return cscannerHelp_returnToken (QENDMACRO); } YY_BREAK case 188: YY_RULE_SETUP { incColumn (); cscannerHelp_setContinueLine (); } YY_BREAK case 189: YY_RULE_SETUP { incColumn (); if ((int) *yytext == 13 ) { ; } else { voptgenerror (FLG_SYNTAX, message ("Invalid character (ascii: %d), skipping character", (int)(*yytext)), g_currentloc); } } YY_BREAK case 190: YY_RULE_SETUP ECHO; YY_BREAK case YY_STATE_EOF(INITIAL): yyterminate(); case YY_END_OF_BUFFER: { /* Amount of text matched not including the EOB char. */ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; /* Undo the effects of YY_DO_BEFORE_ACTION. */ *yy_cp = yy_hold_char; YY_RESTORE_YY_MORE_OFFSET if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) { /* We're scanning a new file or input source. It's * possible that this happened because the user * just pointed yyin at a new source and called * yylex(). If so, then we have to assure * consistency between yy_current_buffer and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ yy_n_chars = yy_current_buffer->yy_n_chars; yy_current_buffer->yy_input_file = yyin; yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; } /* Note that here we test for yy_c_buf_p "<=" to the position * of the first EOB in the buffer, since yy_c_buf_p will * already have been incremented past the NUL character * (since all states make transitions on EOB to the * end-of-buffer state). Contrast this with the test * in input(). */ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) { /* This was really a NUL. */ yy_state_type yy_next_state; yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); /* Okay, we're now positioned to make the NUL * transition. We couldn't have * yy_get_previous_state() go ahead and do it * for us because it doesn't know how to deal * with the possibility of jamming (and we don't * want to build jamming into it because then it * will run more slowly). */ yy_next_state = yy_try_NUL_trans( yy_current_state ); yy_bp = yytext_ptr + YY_MORE_ADJ; if ( yy_next_state ) { /* Consume the NUL. */ yy_cp = ++yy_c_buf_p; yy_current_state = yy_next_state; goto yy_match; } else { yy_cp = yy_c_buf_p; goto yy_find_action; } } else switch ( yy_get_next_buffer() ) { case EOB_ACT_END_OF_FILE: { yy_did_buffer_switch_on_eof = 0; if ( yywrap() ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up * yytext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the * YY_NULL, it'll still work - another * YY_NULL will get returned. */ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; yy_act = YY_STATE_EOF(YY_START); goto do_action; } else { if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; } break; } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_match; case EOB_ACT_LAST_MATCH: yy_c_buf_p = &yy_current_buffer->yy_ch_buf[yy_n_chars]; yy_current_state = yy_get_previous_state(); yy_cp = yy_c_buf_p; yy_bp = yytext_ptr + YY_MORE_ADJ; goto yy_find_action; } break; } default: YY_FATAL_ERROR( "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ } /* end of yylex */ /* yy_get_next_buffer - try to read in a new buffer * * Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ static int yy_get_next_buffer() { register char *dest = yy_current_buffer->yy_ch_buf; register char *source = yytext_ptr; register int number_to_move, i; int ret_val; if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) YY_FATAL_ERROR( "fatal flex scanner internal error--end of buffer missed" ); if ( yy_current_buffer->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ yy_current_buffer->yy_n_chars = yy_n_chars = 0; else { int num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ #ifdef YY_USES_REJECT YY_FATAL_ERROR( "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); #else /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = yy_current_buffer; int yy_c_buf_p_offset = (int) (yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { int new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ yy_flex_realloc( (void *) b->yy_ch_buf, b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "fatal error - scanner input buffer overflow" ); yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = yy_current_buffer->yy_buf_size - number_to_move - 1; #endif } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), yy_n_chars, num_to_read ); yy_current_buffer->yy_n_chars = yy_n_chars; } if ( yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; yyrestart( yyin ); } else { ret_val = EOB_ACT_LAST_MATCH; yy_current_buffer->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; yy_n_chars += number_to_move; yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; return ret_val; } /* yy_get_previous_state - get the state just before the EOB char was reached */ static yy_state_type yy_get_previous_state() { register yy_state_type yy_current_state; register char *yy_cp; yy_current_state = yy_start; for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) { register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 575 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; } /* yy_try_NUL_trans - try to make a transition on the NUL character * * synopsis * next_state = yy_try_NUL_trans( current_state ); */ #ifdef YY_USE_PROTOS static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) #else static yy_state_type yy_try_NUL_trans( yy_current_state ) yy_state_type yy_current_state; #endif { register int yy_is_jam; register char *yy_cp = yy_c_buf_p; register YY_CHAR yy_c = 1; if ( yy_accept[yy_current_state] ) { yy_last_accepting_state = yy_current_state; yy_last_accepting_cpos = yy_cp; } while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 575 ) yy_c = yy_meta[(unsigned int) yy_c]; } yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 574); return yy_is_jam ? 0 : yy_current_state; } #ifndef YY_NO_UNPUT #ifdef YY_USE_PROTOS static void yyunput( int c, register char *yy_bp ) #else static void yyunput( c, yy_bp ) int c; register char *yy_bp; #endif { register char *yy_cp = yy_c_buf_p; /* undo effects of setting up yytext */ *yy_cp = yy_hold_char; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ register int number_to_move = yy_n_chars + 2; register char *dest = &yy_current_buffer->yy_ch_buf[ yy_current_buffer->yy_buf_size + 2]; register char *source = &yy_current_buffer->yy_ch_buf[number_to_move]; while ( source > yy_current_buffer->yy_ch_buf ) *--dest = *--source; yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); yy_current_buffer->yy_n_chars = yy_n_chars = yy_current_buffer->yy_buf_size; if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); } *--yy_cp = (char) c; yytext_ptr = yy_bp; yy_hold_char = *yy_cp; yy_c_buf_p = yy_cp; } #endif /* ifndef YY_NO_UNPUT */ #ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else static int input() #endif { int c; *yy_c_buf_p = yy_hold_char; if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) { /* yy_c_buf_p now points to the character we want to return. * If this occurs *before* the EOB characters, then it's a * valid NUL; if not, then we've hit the end of the buffer. */ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) /* This was really a NUL. */ *yy_c_buf_p = '\0'; else { /* need more input */ int offset = yy_c_buf_p - yytext_ptr; ++yy_c_buf_p; switch ( yy_get_next_buffer() ) { case EOB_ACT_LAST_MATCH: /* This happens because yy_g_n_b() * sees that we've accumulated a * token and flags that we need to * try matching the token before * proceeding. But for input(), * there's no matching to consider. * So convert the EOB_ACT_LAST_MATCH * to EOB_ACT_END_OF_FILE. */ /* Reset buffer status. */ yyrestart( yyin ); /* fall through */ case EOB_ACT_END_OF_FILE: { if ( yywrap() ) return EOF; if ( ! yy_did_buffer_switch_on_eof ) YY_NEW_FILE; #ifdef __cplusplus return yyinput(); #else return input(); #endif } case EOB_ACT_CONTINUE_SCAN: yy_c_buf_p = yytext_ptr + offset; break; } } } c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ *yy_c_buf_p = '\0'; /* preserve yytext */ yy_hold_char = *++yy_c_buf_p; return c; } #endif /* YY_NO_INPUT */ #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) #else void yyrestart( input_file ) FILE *input_file; #endif { if ( ! yy_current_buffer ) yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); yy_init_buffer( yy_current_buffer, input_file ); yy_load_buffer_state(); } #ifdef YY_USE_PROTOS void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) #else void yy_switch_to_buffer( new_buffer ) YY_BUFFER_STATE new_buffer; #endif { if ( yy_current_buffer == new_buffer ) return; if ( yy_current_buffer ) { /* Flush out information for old buffer. */ *yy_c_buf_p = yy_hold_char; yy_current_buffer->yy_buf_pos = yy_c_buf_p; yy_current_buffer->yy_n_chars = yy_n_chars; } yy_current_buffer = new_buffer; yy_load_buffer_state(); /* We don't actually know whether we did this switch during * EOF (yywrap()) processing, but the only time this flag * is looked at is after yywrap() is called, so it's safe * to go ahead and always set it. */ yy_did_buffer_switch_on_eof = 1; } #ifdef YY_USE_PROTOS void yy_load_buffer_state( void ) #else void yy_load_buffer_state() #endif { yy_n_chars = yy_current_buffer->yy_n_chars; yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; yyin = yy_current_buffer->yy_input_file; yy_hold_char = *yy_c_buf_p; } #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) #else YY_BUFFER_STATE yy_create_buffer( file, size ) FILE *file; int size; #endif { YY_BUFFER_STATE b; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_buf_size = size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); b->yy_is_our_buffer = 1; yy_init_buffer( b, file ); return b; } #ifdef YY_USE_PROTOS void yy_delete_buffer( YY_BUFFER_STATE b ) #else void yy_delete_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; if ( b == yy_current_buffer ) yy_current_buffer = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) yy_flex_free( (void *) b->yy_ch_buf ); yy_flex_free( (void *) b ); } #ifdef YY_USE_PROTOS void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) #else void yy_init_buffer( b, file ) YY_BUFFER_STATE b; FILE *file; #endif { yy_flush_buffer( b ); b->yy_input_file = file; b->yy_fill_buffer = 1; #if YY_ALWAYS_INTERACTIVE b->yy_is_interactive = 1; #else #if YY_NEVER_INTERACTIVE b->yy_is_interactive = 0; #else b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; #endif #endif } #ifdef YY_USE_PROTOS void yy_flush_buffer( YY_BUFFER_STATE b ) #else void yy_flush_buffer( b ) YY_BUFFER_STATE b; #endif { if ( ! b ) return; b->yy_n_chars = 0; /* We always need two end-of-buffer characters. The first causes * a transition to the end-of-buffer state. The second causes * a jam in that state. */ b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; b->yy_buf_pos = &b->yy_ch_buf[0]; b->yy_at_bol = 1; b->yy_buffer_status = YY_BUFFER_NEW; if ( b == yy_current_buffer ) yy_load_buffer_state(); } #ifndef YY_NO_SCAN_BUFFER #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) #else YY_BUFFER_STATE yy_scan_buffer( base, size ) char *base; yy_size_t size; #endif { YY_BUFFER_STATE b; if ( size < 2 || base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ return 0; b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); if ( ! b ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; yy_switch_to_buffer( b ); return b; } #endif #ifndef YY_NO_SCAN_STRING #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) #else YY_BUFFER_STATE yy_scan_string( yy_str ) yyconst char *yy_str; #endif { int len; for ( len = 0; yy_str[len]; ++len ) ; return yy_scan_bytes( yy_str, len ); } #endif #ifndef YY_NO_SCAN_BYTES #ifdef YY_USE_PROTOS YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) #else YY_BUFFER_STATE yy_scan_bytes( bytes, len ) yyconst char *bytes; int len; #endif { YY_BUFFER_STATE b; char *buf; yy_size_t n; int i; /* Get memory for full buffer, including space for trailing EOB's. */ n = len + 2; buf = (char *) yy_flex_alloc( n ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); for ( i = 0; i < len; ++i ) buf[i] = bytes[i]; buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = yy_scan_buffer( buf, n ); if ( ! b ) YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. */ b->yy_is_our_buffer = 1; return b; } #endif #ifndef YY_NO_PUSH_STATE #ifdef YY_USE_PROTOS static void yy_push_state( int new_state ) #else static void yy_push_state( new_state ) int new_state; #endif { if ( yy_start_stack_ptr >= yy_start_stack_depth ) { yy_size_t new_size; yy_start_stack_depth += YY_START_STACK_INCR; new_size = yy_start_stack_depth * sizeof( int ); if ( ! yy_start_stack ) yy_start_stack = (int *) yy_flex_alloc( new_size ); else yy_start_stack = (int *) yy_flex_realloc( (void *) yy_start_stack, new_size ); if ( ! yy_start_stack ) YY_FATAL_ERROR( "out of memory expanding start-condition stack" ); } yy_start_stack[yy_start_stack_ptr++] = YY_START; BEGIN(new_state); } #endif #ifndef YY_NO_POP_STATE static void yy_pop_state() { if ( --yy_start_stack_ptr < 0 ) YY_FATAL_ERROR( "start-condition stack underflow" ); BEGIN(yy_start_stack[yy_start_stack_ptr]); } #endif #ifndef YY_NO_TOP_STATE static int yy_top_state() { return yy_start_stack[yy_start_stack_ptr - 1]; } #endif #ifndef YY_EXIT_FAILURE #define YY_EXIT_FAILURE 2 #endif #ifdef YY_USE_PROTOS static void yy_fatal_error( yyconst char msg[] ) #else static void yy_fatal_error( msg ) char msg[]; #endif { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } /* Redefine yyless() so it works in section 3 code. */ #undef yyless #define yyless(n) \ do \ { \ /* Undo effects of setting up yytext. */ \ yytext[yyleng] = yy_hold_char; \ yy_c_buf_p = yytext + n; \ yy_hold_char = *yy_c_buf_p; \ *yy_c_buf_p = '\0'; \ yyleng = n; \ } \ while ( 0 ) /* Internal utility routines. */ #ifndef yytext_ptr #ifdef YY_USE_PROTOS static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) #else static void yy_flex_strncpy( s1, s2, n ) char *s1; yyconst char *s2; int n; #endif { register int i; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } #endif #ifdef YY_NEED_STRLEN #ifdef YY_USE_PROTOS static int yy_flex_strlen( yyconst char *s ) #else static int yy_flex_strlen( s ) yyconst char *s; #endif { register int n; for ( n = 0; s[n]; ++n ) ; return n; } #endif #ifdef YY_USE_PROTOS static void *yy_flex_alloc( yy_size_t size ) #else static void *yy_flex_alloc( size ) yy_size_t size; #endif { return (void *) malloc( size ); } #ifdef YY_USE_PROTOS static void *yy_flex_realloc( void *ptr, yy_size_t size ) #else static void *yy_flex_realloc( ptr, size ) void *ptr; yy_size_t size; #endif { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those * that use void* generic pointers. It works with the latter * because both ANSI C and C++ allow castless assignment from * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ return (void *) realloc( (char *) ptr, size ); } #ifdef YY_USE_PROTOS static void yy_flex_free( void *ptr ) #else static void yy_flex_free( ptr ) void *ptr; #endif { free( ptr ); } #if YY_MAIN int main() { yylex(); return 0; } #endif /* ** These need to go here, after flex-generated code defined input and unput. */ int cscanner_input (void) { return input (); /* input is a static procedure defined by flex-generated code */ } void cscanner_unput (int c) { unput (c); /* unput is a static procedure defined by flex-generated code */ } /* ** Resets flags set by flex.head. */ /*@=allmacros@*/ /*@=pred@*/ /*@=globstate@*/ /*@=null@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macrospec@*/ /*@=macroredef@*/ /*@=exitarg@*/ /*@=compdef@*/ /*@=uniondef@*/ /*@=ignorequals@*/ /*@=noreturn@*/ /*@=mustfree@*/ /*@=compdestroy@*/ /*@=branchstate@*/ /*@=unreachable@*/ /*@=varuse@*/ /*@=fcnuse@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=redecl@*/ /*@=loopswitchbreak@*/ /*@=switchswitchbreak@*/ /*@=sizeoftype@*/ /*@=czechfcns@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=ifblock@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=elseifcomplete@*/ /*@=ptrnegate@*/ /*@=onlytrans@*/ /*@=temptrans@*/ /*@=immediatetrans@*/ /*@=namechecks@*/ /*@=matchanyintegral@*/ /*@=statictrans@*/ /*@=compmempass@*/ /*@=forempty@*/ /*@=evalorder@*/ /*@=retalias@*/ /*@=redecl@*/ /*@=retvalother@*/ # ifdef OSF # define __GNUC__ # endif splint-3.1.2.dfsg1/src/mtscanner.c0000644021234200000250000002334607646432516014415 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtscanner.c ** ** Because flex is so lame, we can't use two flex scanners at once. Instead, ** we have to write a manual scanner. Should look into some real parser ** generator tools one day... */ # include "splintMacros.nf" # include "basic.h" # include "mtgrammar.h" # include "mtscanner.h" static inputStream scanFile; /* file to scan */ static mttok mtscanner_getNextToken (void); static /*@only@*/ cstringTable tokenTable = cstringTable_undefined; static bool isInitialized = FALSE; /*@constant int MT_TOKENTABLESIZE@*/ # define MT_TOKENTABLESIZE 64 static void mtscanner_initMod (void) { llassert (cstringTable_isUndefined (tokenTable)); tokenTable = cstringTable_create (MT_TOKENTABLESIZE); cstringTable_insert (tokenTable, cstring_makeLiteral ("attribute"), MT_STATE); cstringTable_insert (tokenTable, cstring_makeLiteral ("global"), MT_GLOBAL); cstringTable_insert (tokenTable, cstring_makeLiteral ("context"), MT_CONTEXT); cstringTable_insert (tokenTable, cstring_makeLiteral ("oneof"), MT_ONEOF); cstringTable_insert (tokenTable, cstring_makeLiteral ("defaults"), MT_DEFAULTS); cstringTable_insert (tokenTable, cstring_makeLiteral ("default"), MT_DEFAULT); cstringTable_insert (tokenTable, cstring_makeLiteral ("parameter"), MT_PARAMETER); cstringTable_insert (tokenTable, cstring_makeLiteral ("result"), MT_RESULT); cstringTable_insert (tokenTable, cstring_makeLiteral ("literal"), MT_LITERAL); cstringTable_insert (tokenTable, cstring_makeLiteral ("null"), MT_NULL); cstringTable_insert (tokenTable, cstring_makeLiteral ("reference"), MT_REFERENCE); cstringTable_insert (tokenTable, cstring_makeLiteral ("clause"), MT_CLAUSE); cstringTable_insert (tokenTable, cstring_makeLiteral ("annotations"), MT_ANNOTATIONS); cstringTable_insert (tokenTable, cstring_makeLiteral ("merge"), MT_MERGE); cstringTable_insert (tokenTable, cstring_makeLiteral ("transfers"), MT_TRANSFERS); cstringTable_insert (tokenTable, cstring_makeLiteral ("preconditions"), MT_PRECONDITIONS); cstringTable_insert (tokenTable, cstring_makeLiteral ("postconditions"), MT_POSTCONDITIONS); cstringTable_insert (tokenTable, cstring_makeLiteral ("losereference"), MT_LOSEREFERENCE); cstringTable_insert (tokenTable, cstring_makeLiteral ("error"), MT_ERROR); cstringTable_insert (tokenTable, cstring_makeLiteral ("end"), MT_END); cstringTable_insert (tokenTable, cstring_makeLiteral ("as"), MT_AS); /* ** C Types */ cstringTable_insert (tokenTable, cstring_makeLiteral ("char"), MT_CHAR); cstringTable_insert (tokenTable, cstring_makeLiteral ("int"), MT_INT); cstringTable_insert (tokenTable, cstring_makeLiteral ("float"), MT_FLOAT); cstringTable_insert (tokenTable, cstring_makeLiteral ("double"), MT_DOUBLE); cstringTable_insert (tokenTable, cstring_makeLiteral ("void"), MT_VOID); cstringTable_insert (tokenTable, cstring_makeLiteral ("anytype"), MT_ANYTYPE); cstringTable_insert (tokenTable, cstring_makeLiteral ("integraltype"), MT_INTEGRALTYPE); cstringTable_insert (tokenTable, cstring_makeLiteral ("unsignedintegraltype"), MT_UNSIGNEDINTEGRALTYPE); cstringTable_insert (tokenTable, cstring_makeLiteral ("signedintegraltype"), MT_SIGNEDINTEGRALTYPE); cstringTable_insert (tokenTable, cstring_makeLiteral ("const"), MT_CONST); cstringTable_insert (tokenTable, cstring_makeLiteral ("volatile"), MT_VOLATILE); cstringTable_insert (tokenTable, cstring_makeLiteral ("restrict"), MT_RESTRICT); /* ** Punctuation */ cstringTable_insert (tokenTable, cstring_makeLiteral ("==>"), MT_ARROW); cstringTable_insert (tokenTable, cstring_makeLiteral ("+"), MT_PLUS); cstringTable_insert (tokenTable, cstring_makeLiteral ("*"), MT_STAR); cstringTable_insert (tokenTable, cstring_makeLiteral ("{"), MT_LBRACE); cstringTable_insert (tokenTable, cstring_makeLiteral ("}"), MT_RBRACE); cstringTable_insert (tokenTable, cstring_makeLiteral ("("), MT_LPAREN); cstringTable_insert (tokenTable, cstring_makeLiteral (")"), MT_RPAREN); cstringTable_insert (tokenTable, cstring_makeLiteral ("["), MT_LBRACKET); cstringTable_insert (tokenTable, cstring_makeLiteral ("]"), MT_RBRACKET); cstringTable_insert (tokenTable, cstring_makeLiteral (","), MT_COMMA); cstringTable_insert (tokenTable, cstring_makeLiteral ("|"), MT_BAR); isInitialized = TRUE; } void mtscanner_reset (inputStream sourceFile) { if (!isInitialized) { mtscanner_initMod (); } scanFile = sourceFile; } int mtlex (YYSTYPE *mtlval) { llassert (isInitialized); /* This is important! Bison expects this */ /*@ignore@*/ mtlval->tok = mtscanner_getNextToken (); DPRINTF (("Return token: %s", mttok_unparse (mtlval->tok))); llassert (fileloc_isDefined (mttok_getLoc (mtlval->tok))); return (mttok_getTok (mtlval->tok)); /*@end@*/ } static void skipComments (void) { int tchar; bool gotone = FALSE; tchar = inputStream_peekChar (scanFile); if (tchar == (int) '/' && inputStream_peekNChar (scanFile, 1) == (int) '*') { check ((int) '/' == inputStream_nextChar (scanFile)); check ((int) '*' == inputStream_nextChar (scanFile)); while ((tchar = inputStream_nextChar (scanFile)) != EOF) { if (tchar == (int) '*' && inputStream_peekChar (scanFile) == (int) '/') { tchar = inputStream_nextChar (scanFile); break; } } if (tchar == EOF) { llfatalerror (cstring_makeLiteral ("Reached end of metastate file inside comment.")); BADBRANCH; } else { check ((int) '/' == tchar); gotone = TRUE; } } if (isspace (tchar)) { while (isspace (inputStream_peekChar (scanFile))) { tchar = inputStream_nextChar (scanFile); } gotone = TRUE; } if (gotone) { /* If there was a comment or whitespace, need to skip again... */ skipComments (); } } static mttok mtscanner_getNextToken () { int tchar; int mtcode; cstring tok; mttok res; fileloc loc; skipComments (); loc = fileloc_copy (g_currentloc); tchar = inputStream_nextChar (scanFile); if (tchar == EOF) { return mttok_create (EOF, cstring_undefined, loc); } tok = cstring_newEmpty (); DPRINTF (("tchar: %c", (char) tchar)); if (tchar == (int) '\"') { bool escaped = FALSE; /* String literal */ while ((tchar = inputStream_peekChar (scanFile)) != EOF) { if (escaped) { escaped = FALSE; } else if (tchar == (int) '\\') { escaped = TRUE; } else if (tchar == (int) '\"') { break; } else { ; } tok = cstring_appendChar (tok, (char) tchar); check (tchar == inputStream_nextChar (scanFile)); } if (tchar == EOF) { llfatalerror (cstring_makeLiteral ("Reached end of metastate file inside string literal.")); } else { check ((int) '\"' == inputStream_nextChar (scanFile)); return mttok_create (MT_STRINGLIT, tok, loc); } } tok = cstring_appendChar (tok, (char) tchar); DPRINTF (("tok: %s", tok)); if (isalpha (tchar)) { while ((tchar = inputStream_peekChar (scanFile)) != EOF) { if (!isalnum (tchar) && (tchar != (int) '_') && (tchar != (int) '$')) { break; } tok = cstring_appendChar (tok, (char) tchar); check (tchar == inputStream_nextChar (scanFile)); } mtcode = cstringTable_lookup (tokenTable, tok); if (mtcode == NOT_FOUND) { DPRINTF (("Returning identifier: %s", tok)); return mttok_create (MT_IDENT, tok, loc); } } else { /* Read until next space */ DPRINTF (("Here we are: %s", tok)); while ((tchar = inputStream_peekChar (scanFile)) != EOF) { if (isspace (tchar) || isalnum (tchar)) { break; } tok = cstring_appendChar (tok, (char) tchar); DPRINTF (("Here we are: %s", tok)); check (tchar == inputStream_nextChar (scanFile)); } DPRINTF (("Here we are: [%s]", tok)); mtcode = cstringTable_lookup (tokenTable, tok); if (mtcode == NOT_FOUND) { mtcode = MT_BADTOK; } } DPRINTF (("Read %s / %d", tok, mtcode)); cstring_free (tok); res = mttok_create (mtcode, cstring_undefined, loc); DPRINTF (("Return token: %s", mttok_unparse (res))); return res; } ctype mtscanner_lookupType (mttok tok) { cstring tname; uentry ue; llassert (mttok_isIdentifier (tok)); tname = mttok_observeText (tok); DPRINTF (("Lookup type: %s", tname)); ue = usymtab_lookupSafe (tname); if (uentry_isValid (ue) && uentry_isDatatype (ue)) { DPRINTF (("Found it: %s / %s", uentry_unparse (ue), ctype_unparse (uentry_getAbstractType (ue)))); return uentry_getAbstractType (ue); } else { ctype ct; ue = uentry_makeDatatype (tname, ctype_unknown, MAYBE, qual_createUnknown(), mttok_stealLoc (tok)); DPRINTF (("Making mts entry: %s", uentry_unparse (ue))); ct = usymtab_supForwardTypeEntry (ue); DPRINTF (("Type: %s", ctype_unparse (ct))); return ct; } } splint-3.1.2.dfsg1/src/mtgrammar.c0000644021234200000250000014311310102766473014376 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /* < end of bison.head > */ /* A Bison parser, made from mtgrammar.y by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ #define yyparse mtparse #define yylex mtlex #define yyerror mterror #define yylval mtlval #define yychar mtchar #define yydebug mtdebug #define yynerrs mtnerrs # define MT_BADTOK 257 # define MT_END 258 # define MT_STATE 259 # define MT_GLOBAL 260 # define MT_CONTEXT 261 # define MT_ONEOF 262 # define MT_DEFAULTS 263 # define MT_DEFAULT 264 # define MT_REFERENCE 265 # define MT_PARAMETER 266 # define MT_RESULT 267 # define MT_CLAUSE 268 # define MT_LITERAL 269 # define MT_NULL 270 # define MT_ANNOTATIONS 271 # define MT_ARROW 272 # define MT_MERGE 273 # define MT_TRANSFERS 274 # define MT_PRECONDITIONS 275 # define MT_POSTCONDITIONS 276 # define MT_LOSEREFERENCE 277 # define MT_AS 278 # define MT_ERROR 279 # define MT_PLUS 280 # define MT_STAR 281 # define MT_BAR 282 # define MT_LPAREN 283 # define MT_RPAREN 284 # define MT_LBRACKET 285 # define MT_RBRACKET 286 # define MT_LBRACE 287 # define MT_RBRACE 288 # define MT_COMMA 289 # define MT_CHAR 290 # define MT_INT 291 # define MT_FLOAT 292 # define MT_DOUBLE 293 # define MT_VOID 294 # define MT_ANYTYPE 295 # define MT_INTEGRALTYPE 296 # define MT_UNSIGNEDINTEGRALTYPE 297 # define MT_SIGNEDINTEGRALTYPE 298 # define MT_CONST 299 # define MT_VOLATILE 300 # define MT_RESTRICT 301 # define MT_STRINGLIT 302 # define MT_IDENT 303 # include "bison.reset" # include "splintMacros.nf" # include "basic.h" # ifndef S_SPLINT_S extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ; # endif /*@i523@*/ /* can't include these here # include "mtgrammar.h" # include "mtscanner.h" */ static /*@noreturn@*/ void mterror (char *); /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ extern int mtlex () ; static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); /*@=noparams@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) # define YYDEBUG 1 # include "bison.head" #ifndef YYSTYPE typedef union { mttok tok; mtDeclarationNode mtdecl; mtDeclarationPiece mtpiece; mtDeclarationPieces mtpieces; mtContextNode mtcontext; mtValuesNode mtvalues; mtDefaultsNode mtdefaults; mtDefaultsDeclList mtdeflist; mtAnnotationsNode mtannotations; mtAnnotationList mtannotlist; mtAnnotationDecl mtannotdecl; mtMergeNode mtmerge; mtMergeItem mtmergeitem; mtMergeClauseList mtmergeclauselist; mtMergeClause mtmergeclause; mtTransferClauseList mttransferclauselist; mtTransferClause mttransferclause; mtTransferAction mttransferaction; mtLoseReferenceList mtlosereferencelist; mtLoseReference mtlosereference; pointers pointers; /*@only@*/ cstringList cstringlist; ctype ctyp; /*@only@*/ qtype qtyp; qual qual; qualList quals; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYDEBUG # define YYDEBUG 1 #endif #define YYFINAL 136 #define YYFLAG -32768 #define YYNTBASE 50 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ #define YYTRANSLATE(x) ((unsigned)(x) <= 303 ? yytranslate[x] : 93) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 }; #if YYDEBUG static const short yyprhs[] = { 0, 0, 1, 3, 7, 12, 15, 16, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 42, 43, 45, 48, 51, 54, 57, 60, 63, 64, 66, 68, 71, 73, 77, 80, 81, 83, 85, 87, 90, 92, 95, 98, 102, 104, 106, 108, 110, 113, 117, 120, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 149, 151, 155, 158, 161, 165, 170, 173, 175, 178, 183, 186, 188, 191, 197, 199, 201, 204, 207, 210, 213, 215, 218, 222, 224, 227, 233, 235, 237, 239, 242 }; static const short yyrhs[] = { -1, 51, 0, 5, 52, 4, 0, 6, 5, 52, 4, 0, 49, 53, 0, 0, 54, 53, 0, 55, 0, 70, 0, 73, 0, 72, 0, 75, 0, 78, 0, 84, 0, 82, 0, 83, 0, 85, 0, 7, 57, 0, 0, 57, 0, 12, 58, 0, 11, 58, 0, 13, 58, 0, 14, 58, 0, 15, 58, 0, 16, 58, 0, 0, 59, 0, 60, 0, 60, 63, 0, 61, 0, 60, 28, 59, 0, 68, 62, 0, 0, 60, 0, 64, 0, 67, 0, 64, 67, 0, 27, 0, 27, 66, 0, 27, 64, 0, 27, 66, 64, 0, 45, 0, 46, 0, 47, 0, 65, 0, 66, 65, 0, 29, 63, 30, 0, 31, 32, 0, 67, 31, 32, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 69, 0, 49, 0, 8, 71, 0, 49, 0, 49, 35, 71, 0, 10, 92, 0, 9, 74, 0, 57, 18, 92, 0, 57, 18, 92, 74, 0, 17, 76, 0, 77, 0, 77, 76, 0, 49, 56, 18, 92, 0, 19, 79, 0, 80, 0, 80, 79, 0, 81, 26, 81, 18, 90, 0, 92, 0, 27, 0, 21, 88, 0, 22, 88, 0, 20, 88, 0, 23, 86, 0, 87, 0, 87, 86, 0, 92, 18, 91, 0, 89, 0, 89, 88, 0, 92, 24, 92, 18, 90, 0, 92, 0, 91, 0, 25, 0, 25, 48, 0, 49, 0 }; #endif #if YYDEBUG /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { 0, 160, 161, 165, 167, 172, 177, 178, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 196, 201, 202, 206, 207, 208, 209, 210, 211, 219, 220, 224, 225, 229, 230, 235, 239, 240, 244, 245, 246, 250, 251, 252, 253, 257, 258, 259, 263, 264, 268, 269, 270, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 294, 298, 302, 303, 308, 312, 316, 318, 323, 327, 328, 333, 338, 342, 343, 347, 352, 353, 357, 361, 365, 369, 373, 374, 378, 382, 383, 387, 392, 393, 397, 398, 402 }; #endif #if (YYDEBUG) || defined YYERROR_VERBOSE /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ static const char *const yytname[] = { "$", "error", "$undefined.", "MT_BADTOK", "MT_END", "MT_STATE", "MT_GLOBAL", "MT_CONTEXT", "MT_ONEOF", "MT_DEFAULTS", "MT_DEFAULT", "MT_REFERENCE", "MT_PARAMETER", "MT_RESULT", "MT_CLAUSE", "MT_LITERAL", "MT_NULL", "MT_ANNOTATIONS", "MT_ARROW", "MT_MERGE", "MT_TRANSFERS", "MT_PRECONDITIONS", "MT_POSTCONDITIONS", "MT_LOSEREFERENCE", "MT_AS", "MT_ERROR", "MT_PLUS", "MT_STAR", "MT_BAR", "MT_LPAREN", "MT_RPAREN", "MT_LBRACKET", "MT_RBRACKET", "MT_LBRACE", "MT_RBRACE", "MT_COMMA", "MT_CHAR", "MT_INT", "MT_FLOAT", "MT_DOUBLE", "MT_VOID", "MT_ANYTYPE", "MT_INTEGRALTYPE", "MT_UNSIGNEDINTEGRALTYPE", "MT_SIGNEDINTEGRALTYPE", "MT_CONST", "MT_VOLATILE", "MT_RESTRICT", "MT_STRINGLIT", "MT_IDENT", "file", "mtsDeclaration", "declarationNode", "declarationPieces", "declarationPiece", "contextDeclaration", "optContextSelection", "contextSelection", "optType", "typeExpression", "completeType", "completeTypeAux", "optCompleteType", "abstractDecl", "pointers", "innerMods", "innerModsList", "abstractDeclBase", "typeSpecifier", "typeName", "valuesDeclaration", "valuesList", "defaultNode", "defaultsDeclaration", "defaultDeclarationList", "annotationsDeclaration", "annotationsDeclarationList", "annotationDeclaration", "mergeDeclaration", "mergeClauses", "mergeClause", "mergeItem", "preconditionsDeclaration", "postconditionsDeclaration", "transfersDeclaration", "loseReferenceDeclaration", "lostClauses", "lostClause", "transferClauses", "transferClause", "transferAction", "errorAction", "valueChoice", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { 0, 50, 50, 51, 51, 52, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 56, 56, 57, 57, 57, 57, 57, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 81, 82, 83, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 91, 92 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { 0, 0, 1, 3, 4, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 1, 3, 2, 0, 1, 1, 1, 2, 1, 2, 2, 3, 1, 1, 1, 1, 2, 3, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, 3, 4, 2, 1, 2, 4, 2, 1, 2, 5, 1, 1, 2, 2, 2, 2, 1, 2, 3, 1, 2, 5, 1, 1, 1, 2, 1 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const short yydefact[] = { 1, 0, 0, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 8, 9, 11, 10, 12, 13, 15, 16, 14, 17, 3, 0, 27, 27, 27, 27, 27, 27, 18, 63, 62, 0, 66, 93, 65, 19, 69, 70, 78, 73, 74, 0, 77, 81, 86, 0, 79, 80, 82, 83, 0, 7, 4, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 22, 28, 29, 31, 34, 60, 21, 23, 24, 25, 26, 0, 0, 0, 20, 71, 75, 0, 87, 0, 84, 0, 39, 0, 0, 0, 30, 36, 37, 35, 33, 64, 67, 0, 0, 0, 91, 85, 43, 44, 45, 41, 46, 40, 32, 0, 49, 38, 0, 68, 72, 0, 0, 92, 42, 47, 48, 50, 76, 90, 89, 88, 0, 0, 0 }; static const short yydefgoto[] = { 134, 3, 5, 17, 18, 19, 85, 40, 72, 73, 74, 75, 102, 98, 99, 114, 115, 100, 76, 77, 20, 39, 21, 22, 41, 23, 45, 46, 24, 48, 49, 50, 25, 26, 27, 28, 57, 58, 52, 53, 130, 131, 54 }; static const short yypact[] = { 21, -29, 30,-32768, 2, 33, -29, 52, -9, 52, -8, -3, -19, -8, -8, -8, -8,-32768, 2,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 54, 13, 13, 13, 13, 13, 13,-32768, 24,-32768, 43,-32768,-32768,-32768, 52,-32768, -3,-32768,-32768, -19, 34,-32768,-32768, -8, 46,-32768,-32768,-32768, -8, 57, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 16,-32768, 13,-32768,-32768,-32768, -32768,-32768,-32768, -9, -8, 58,-32768,-32768,-32768, -19, -32768, -8,-32768, 47, -14, 13, 42, 45,-32768, 5, 49, 50,-32768,-32768, 52, -8, 64, 65, 36,-32768, -32768,-32768,-32768,-32768,-32768, -14,-32768, 55,-32768, 49, 56,-32768,-32768, -20, -20,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 86, 87,-32768 }; static const short yypgoto[] = { -32768,-32768, 83, 72,-32768,-32768,-32768, -6, -18, -4, 17,-32768,-32768, -2, -87, -23,-32768, -1,-32768,-32768, -32768, 14,-32768,-32768, -5,-32768, 59,-32768,-32768, 51, -32768, 7,-32768,-32768,-32768,-32768, 44,-32768, -11,-32768, -21, 8, -10 }; #define YYLAST 114 static const short yytable[] = { 43, 37, 51, 55, 56, 108, 59, 113, 47, 7, 8, 9, 10, 94, 78, 79, 80, 81, 82, 11, 4, 12, 13, 14, 15, 16, 1, 2, 126, 42, 42, 110, 111, 112, 96, 6, 97, 29, 86, 51, 38, 42, 90, 94, 95, 96, 44, 97, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 61, 83, 89, 84, 71, 31, 32, 33, 34, 35, 36, 94, 91, 96, 108, 97, 104, 93, 105, 118, 95, 51, 120, 107, 123, 124, 125, 128, 135, 136, 129, 30, 60, 116, 127, 101, 117, 122, 106, 103, 119, 121, 88, 109, 92, 133, 0, 87, 0, 0, 0, 0, 0, 0, 0, 132, 132 }; static const short yycheck[] = { 10, 7, 12, 14, 15, 25, 16, 94, 27, 7, 8, 9, 10, 27, 32, 33, 34, 35, 36, 17, 49, 19, 20, 21, 22, 23, 5, 6, 115, 49, 49, 45, 46, 47, 29, 5, 31, 4, 44, 49, 49, 49, 53, 27, 28, 29, 49, 31, 58, 36, 37, 38, 39, 40, 41, 42, 43, 44, 4, 35, 26, 18, 49, 11, 12, 13, 14, 15, 16, 27, 24, 29, 25, 31, 84, 18, 18, 32, 28, 89, 31, 91, 18, 18, 48, 30, 0, 0, 32, 6, 18, 95, 115, 76, 96, 105, 89, 83, 99, 104, 49, 93, 58, 124, -1, 46, -1, -1, -1, -1, -1, -1, -1, 123, 124 }; #define YYPURE 1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; # if YYLSP_NEEDED YYLTYPE yyls; # endif }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # if YYLSP_NEEDED # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAX) # else # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAX) # endif /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up"); \ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). When YYLLOC_DEFAULT is run, CURRENT is set the location of the first token. By default, to implement support for ranges, extend its range to the last symbol. */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; #endif /* YYLEX -- calling `yylex' with the right arguments. */ #if YYPURE # if YYLSP_NEEDED # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # else # define YYLEX yylex (&yylval, &yylloc) # endif # else /* !YYLSP_NEEDED */ # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) # else # define YYLEX yylex (&yylval) # endif # endif /* !YYLSP_NEEDED */ #else /* !YYPURE */ # define YYLEX yylex () #endif /* !YYPURE */ /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #ifdef YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL # else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; # endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL #endif /* !YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ # ifdef YYPARSE_PARAM int yyparse (void *); # else int yyparse (void); # endif #endif /* YY_DECL_VARIABLES -- depending whether we use a pure parser, variables are global, or local to YYPARSE. */ #define YY_DECL_NON_LSP_VARIABLES \ /* The lookahead symbol. */ \ int yychar; \ \ /* The semantic value of the lookahead symbol. */ \ YYSTYPE yylval; \ \ /* Number of parse errors so far. */ \ int yynerrs; #if YYLSP_NEEDED # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES \ \ /* Location data for the lookahead symbol. */ \ YYLTYPE yylloc; #else # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES #endif /* If nonreentrant, generate the variables here. */ #if !YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { /* If reentrant, generate the variables here. */ #if YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yychar1 = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #if YYLSP_NEEDED /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #endif #if YYLSP_NEEDED # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else # define YYPOPSTACK (yyvsp--, yyssp--) #endif YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYLSP_NEEDED YYLTYPE yyloc; #endif /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; #if YYLSP_NEEDED yylsp = yyls; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ # if YYLSP_NEEDED YYLTYPE *yyls1 = yyls; /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; # else yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); # endif yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # if YYLSP_NEEDED YYSTACK_RELOCATE (yyls); # endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; #if YYLSP_NEEDED yylsp = yyls + yysize - 1; #endif YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yychar1 = YYTRANSLATE (yychar); #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { YYFPRINTF (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ # ifdef YYPRINT YYPRINT (stderr, yychar, yylval); # endif YYFPRINTF (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to the semantic value of the lookahead token. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; #if YYLSP_NEEDED /* Similarly for the default location. Let the user run additional commands if for instance locations are ranges. */ yyloc = yylsp[1-yylen]; YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); #endif #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { int yyi; YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 1: {; break;} case 2: {; break;} case 3: { mtreader_processDeclaration (yyvsp[-1].mtdecl); ; break;} case 4: { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ; break;} case 5: { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ; break;} case 6: { yyval.mtpieces = mtDeclarationPieces_create (); ; break;} case 7: { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ; break;} case 8: { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ; break;} case 9: { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ; break;} case 10: { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ; break;} case 11: { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ; break;} case 12: { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ; break;} case 13: { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ; break;} case 14: { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ; break;} case 15: { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ; break;} case 16: { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ; break;} case 17: { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ; break;} case 18: { yyval.mtcontext = yyvsp[0].mtcontext; ; break;} case 19: { yyval.mtcontext = mtContextNode_createAny (); ; break;} case 21: { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ; break;} case 22: { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ; break;} case 23: { yyval.mtcontext = mtContextNode_createResult (yyvsp[0].ctyp); ; break;} case 24: { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ; break;} case 25: { yyval.mtcontext = mtContextNode_createLiteral (yyvsp[0].ctyp); ; break;} case 26: { yyval.mtcontext = mtContextNode_createNull (yyvsp[0].ctyp); ; break;} case 27: { yyval.ctyp = ctype_unknown; ; break;} case 28: { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ; break;} case 30: { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ; break;} case 31: { yyval.qtyp = yyvsp[0].qtyp; ; break;} case 32: { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ; break;} case 33: { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ; break;} case 34: { yyval.qtyp = qtype_unknown (); ; break;} case 35: { yyval.qtyp = yyvsp[0].qtyp; ; break;} case 36: { yyval.ctyp = ctype_adjustPointers (yyvsp[0].pointers, ctype_unknown); ; break;} case 38: { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].pointers, yyvsp[0].ctyp); ; break;} case 39: { yyval.pointers = pointers_createMt (yyvsp[0].tok); ; break;} case 40: { yyval.pointers = pointers_createModsMt (yyvsp[-1].tok, yyvsp[0].quals); ; break;} case 41: { yyval.pointers = pointers_extend (pointers_createMt (yyvsp[-1].tok), yyvsp[0].pointers); ; break;} case 42: { yyval.pointers = pointers_extend (pointers_createModsMt (yyvsp[-2].tok, yyvsp[-1].quals), yyvsp[0].pointers); ; break;} case 43: { yyval.qual = qual_createConst (); ; break;} case 44: { yyval.qual = qual_createVolatile (); ; break;} case 45: { yyval.qual = qual_createRestrict (); ; break;} case 46: { yyval.quals = qualList_single (yyvsp[0].qual); ; break;} case 47: { yyval.quals = qualList_add (yyvsp[-1].quals, yyvsp[0].qual); ; break;} case 48: { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ; break;} case 49: { yyval.ctyp = ctype_makeArray (ctype_unknown); ; break;} case 50: { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ; break;} case 51: { yyval.ctyp = ctype_char; ; break;} case 52: { yyval.ctyp = ctype_int; ; break;} case 53: { yyval.ctyp = ctype_float; ; break;} case 54: { yyval.ctyp = ctype_double; ; break;} case 55: { yyval.ctyp = ctype_void; ; break;} case 56: { yyval.ctyp = ctype_unknown; ; break;} case 57: { yyval.ctyp = ctype_anyintegral; ; break;} case 58: { yyval.ctyp = ctype_unsignedintegral; ; break;} case 59: { yyval.ctyp = ctype_signedintegral; ; break;} case 61: { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ; break;} case 62: { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ; break;} case 63: { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ; break;} case 64: { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ; break;} case 65: { yyval.tok = yyvsp[0].tok; ; break;} case 66: { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ; break;} case 67: { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ; break;} case 68: { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ; break;} case 69: { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ; break;} case 70: { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ; break;} case 71: { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ; break;} case 72: { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ; break;} case 73: { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ; break;} case 74: { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ; break;} case 75: { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ; break;} case 76: { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ; break;} case 77: { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ; break;} case 78: { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ; break;} case 79: { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; break;} case 80: { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; break;} case 81: { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; break;} case 82: { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ; break;} case 83: { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ; break;} case 84: { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ; break;} case 85: { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ; break;} case 86: { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ; break;} case 87: { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ; break;} case 88: { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ; break;} case 89: { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ; break;} case 90: { yyval.mttransferaction = yyvsp[0].mttransferaction; ; break;} case 91: { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ; break;} case 92: { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ; break;} } yyvsp -= yylen; yyssp -= yylen; #if YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif *++yyvsp = yyval; #if YYLSP_NEEDED *++yylsp = yyloc; #endif /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { YYSIZE_T yysize = 0; char *yymsg; int yyx, yycount; yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) yysize += yystrlen (yytname[yyx]) + 15, yycount++; yysize += yystrlen ("parse error, unexpected ") + 1; yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "parse error, unexpected "); yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); if (yycount < 5) { yycount = 0; for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); yyp = yystpcpy (yyp, yytname[yyx]); yycount++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("parse error; also virtual memory exhausted"); } else #endif /* defined (YYERROR_VERBOSE) */ yyerror ("parse error"); } goto yyerrlab1; /*--------------------------------------------------. | yyerrlab1 -- error raised explicitly by an action | `--------------------------------------------------*/ yyerrlab1: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; /*-------------------------------------------------------------------. | yyerrdefault -- current state does not do anything special for the | | error token. | `-------------------------------------------------------------------*/ yyerrdefault: #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ /* If its default is to accept any token, ok. Otherwise pop it. */ yyn = yydefact[yystate]; if (yyn) goto yydefault; #endif /*---------------------------------------------------------------. | yyerrpop -- pop the current state because it cannot handle the | | error token | `---------------------------------------------------------------*/ yyerrpop: if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #if YYLSP_NEEDED yylsp--; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif /*--------------. | yyerrhandle. | `--------------*/ yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; /*---------------------------------------------. | yyoverflowab -- parser overflow comes here. | `---------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } # include "bison.reset" extern char *yytext; static void mterror (char *s) { if (s != NULL) { llparseerror (message ("Parse error in meta-state file: %s", cstring_fromChars (s))); } else { llparseerror (message ("Parse error in meta-state file")); } } static void yyprint (FILE *file, int type, YYSTYPE value) { cstring tname = mttok_unparse (value.tok); fprintf (file, " (%s)", cstring_toCharsSafe (tname)); cstring_free (tname); } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ splint-3.1.2.dfsg1/src/llgrammar.c0000644021234200000250000056412710645776225014411 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse ylparse #define yylex yllex #define yyerror ylerror #define yylval yllval #define yychar ylchar #define yydebug yldebug #define yynerrs ylnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { simpleOp = 258, PREFIX_OP = 259, POSTFIX_OP = 260, LLT_MULOP = 261, LLT_SEMI = 262, LLT_VERTICALBAR = 263, ITERATION_OP = 264, selectSym = 265, LLT_LBRACKET = 266, LLT_LPAR = 267, LLT_IF_THEN_ELSE = 268, logicalOp = 269, eqSepSym = 270, equationSym = 271, commentSym = 272, LLT_WHITESPACE = 273, LLT_EOL = 274, LLT_TYPEDEF_NAME = 275, quantifierSym = 276, openSym = 277, closeSym = 278, sepSym = 279, simpleId = 280, mapSym = 281, markerSym = 282, preSym = 283, postSym = 284, anySym = 285, LLT_COLON = 286, LLT_COMMA = 287, LLT_EQUALS = 288, LLT_LBRACE = 289, LLT_RBRACE = 290, LLT_RBRACKET = 291, LLT_RPAR = 292, LLT_QUOTE = 293, eqOp = 294, LLT_CCHAR = 295, LLT_CFLOAT = 296, LLT_CINTEGER = 297, LLT_LCSTRING = 298, LLT_ALL = 299, LLT_ANYTHING = 300, LLT_BE = 301, LLT_BODY = 302, LLT_CLAIMS = 303, LLT_CHECKS = 304, LLT_CONSTANT = 305, LLT_ELSE = 306, LLT_ENSURES = 307, LLT_FOR = 308, LLT_FRESH = 309, LLT_IF = 310, LLT_IMMUTABLE = 311, LLT_IMPORTS = 312, LLT_CONSTRAINT = 313, LLT_ISSUB = 314, LLT_LET = 315, LLT_MODIFIES = 316, LLT_MUTABLE = 317, LLT_NOTHING = 318, LLT_INTERNAL = 319, LLT_FILESYS = 320, LLT_OBJ = 321, LLT_OUT = 322, LLT_SEF = 323, LLT_ONLY = 324, LLT_PARTIAL = 325, LLT_OWNED = 326, LLT_DEPENDENT = 327, LLT_KEEP = 328, LLT_KEPT = 329, LLT_TEMP = 330, LLT_SHARED = 331, LLT_UNIQUE = 332, LLT_UNUSED = 333, LLT_EXITS = 334, LLT_MAYEXIT = 335, LLT_NEVEREXIT = 336, LLT_TRUEEXIT = 337, LLT_FALSEEXIT = 338, LLT_UNDEF = 339, LLT_KILLED = 340, LLT_CHECKMOD = 341, LLT_CHECKED = 342, LLT_UNCHECKED = 343, LLT_CHECKEDSTRICT = 344, LLT_TRUENULL = 345, LLT_FALSENULL = 346, LLT_LNULL = 347, LLT_LNOTNULL = 348, LLT_RETURNED = 349, LLT_OBSERVER = 350, LLT_EXPOSED = 351, LLT_REFCOUNTED = 352, LLT_REFS = 353, LLT_RELNULL = 354, LLT_RELDEF = 355, LLT_KILLREF = 356, LLT_NULLTERMINATED = 357, LLT_TEMPREF = 358, LLT_NEWREF = 359, LLT_PRIVATE = 360, LLT_REQUIRES = 361, LLT_RESULT = 362, LLT_SIZEOF = 363, LLT_SPEC = 364, LLT_TAGGEDUNION = 365, LLT_THEN = 366, LLT_TYPE = 367, LLT_TYPEDEF = 368, LLT_UNCHANGED = 369, LLT_USES = 370, LLT_CHAR = 371, LLT_CONST = 372, LLT_DOUBLE = 373, LLT_ENUM = 374, LLT_FLOAT = 375, LLT_INT = 376, LLT_ITER = 377, LLT_YIELD = 378, LLT_LONG = 379, LLT_SHORT = 380, LLT_SIGNED = 381, LLT_UNKNOWN = 382, LLT_STRUCT = 383, LLT_TELIPSIS = 384, LLT_UNION = 385, LLT_UNSIGNED = 386, LLT_VOID = 387, LLT_VOLATILE = 388, LLT_PRINTFLIKE = 389, LLT_SCANFLIKE = 390, LLT_MESSAGELIKE = 391 }; #endif /* Tokens. */ #define simpleOp 258 #define PREFIX_OP 259 #define POSTFIX_OP 260 #define LLT_MULOP 261 #define LLT_SEMI 262 #define LLT_VERTICALBAR 263 #define ITERATION_OP 264 #define selectSym 265 #define LLT_LBRACKET 266 #define LLT_LPAR 267 #define LLT_IF_THEN_ELSE 268 #define logicalOp 269 #define eqSepSym 270 #define equationSym 271 #define commentSym 272 #define LLT_WHITESPACE 273 #define LLT_EOL 274 #define LLT_TYPEDEF_NAME 275 #define quantifierSym 276 #define openSym 277 #define closeSym 278 #define sepSym 279 #define simpleId 280 #define mapSym 281 #define markerSym 282 #define preSym 283 #define postSym 284 #define anySym 285 #define LLT_COLON 286 #define LLT_COMMA 287 #define LLT_EQUALS 288 #define LLT_LBRACE 289 #define LLT_RBRACE 290 #define LLT_RBRACKET 291 #define LLT_RPAR 292 #define LLT_QUOTE 293 #define eqOp 294 #define LLT_CCHAR 295 #define LLT_CFLOAT 296 #define LLT_CINTEGER 297 #define LLT_LCSTRING 298 #define LLT_ALL 299 #define LLT_ANYTHING 300 #define LLT_BE 301 #define LLT_BODY 302 #define LLT_CLAIMS 303 #define LLT_CHECKS 304 #define LLT_CONSTANT 305 #define LLT_ELSE 306 #define LLT_ENSURES 307 #define LLT_FOR 308 #define LLT_FRESH 309 #define LLT_IF 310 #define LLT_IMMUTABLE 311 #define LLT_IMPORTS 312 #define LLT_CONSTRAINT 313 #define LLT_ISSUB 314 #define LLT_LET 315 #define LLT_MODIFIES 316 #define LLT_MUTABLE 317 #define LLT_NOTHING 318 #define LLT_INTERNAL 319 #define LLT_FILESYS 320 #define LLT_OBJ 321 #define LLT_OUT 322 #define LLT_SEF 323 #define LLT_ONLY 324 #define LLT_PARTIAL 325 #define LLT_OWNED 326 #define LLT_DEPENDENT 327 #define LLT_KEEP 328 #define LLT_KEPT 329 #define LLT_TEMP 330 #define LLT_SHARED 331 #define LLT_UNIQUE 332 #define LLT_UNUSED 333 #define LLT_EXITS 334 #define LLT_MAYEXIT 335 #define LLT_NEVEREXIT 336 #define LLT_TRUEEXIT 337 #define LLT_FALSEEXIT 338 #define LLT_UNDEF 339 #define LLT_KILLED 340 #define LLT_CHECKMOD 341 #define LLT_CHECKED 342 #define LLT_UNCHECKED 343 #define LLT_CHECKEDSTRICT 344 #define LLT_TRUENULL 345 #define LLT_FALSENULL 346 #define LLT_LNULL 347 #define LLT_LNOTNULL 348 #define LLT_RETURNED 349 #define LLT_OBSERVER 350 #define LLT_EXPOSED 351 #define LLT_REFCOUNTED 352 #define LLT_REFS 353 #define LLT_RELNULL 354 #define LLT_RELDEF 355 #define LLT_KILLREF 356 #define LLT_NULLTERMINATED 357 #define LLT_TEMPREF 358 #define LLT_NEWREF 359 #define LLT_PRIVATE 360 #define LLT_REQUIRES 361 #define LLT_RESULT 362 #define LLT_SIZEOF 363 #define LLT_SPEC 364 #define LLT_TAGGEDUNION 365 #define LLT_THEN 366 #define LLT_TYPE 367 #define LLT_TYPEDEF 368 #define LLT_UNCHANGED 369 #define LLT_USES 370 #define LLT_CHAR 371 #define LLT_CONST 372 #define LLT_DOUBLE 373 #define LLT_ENUM 374 #define LLT_FLOAT 375 #define LLT_INT 376 #define LLT_ITER 377 #define LLT_YIELD 378 #define LLT_LONG 379 #define LLT_SHORT 380 #define LLT_SIGNED 381 #define LLT_UNKNOWN 382 #define LLT_STRUCT 383 #define LLT_TELIPSIS 384 #define LLT_UNION 385 #define LLT_UNSIGNED 386 #define LLT_VOID 387 #define LLT_VOLATILE 388 #define LLT_PRINTFLIKE 389 #define LLT_SCANFLIKE 390 #define LLT_MESSAGELIKE 391 /* Copy the first part of user declarations. */ # include "splintMacros.nf" # include "basic.h" # include "lclscan.h" # include "checking.h" # include "lslparse.h" # include "lh.h" # include "usymtab_interface.h" /*@-noparams@*/ static /*@unused@*/ void yyprint (); /*@=noparams@*/ /*@-redecl@*/ void ylerror (char *) /*@modifies *g_warningstream@*/ ; /*@=redecl@*/ bool g_inTypeDef = FALSE; /*@constant int YYDEBUG;@*/ # define YYDEBUG 1 /*@notfunction@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) /* ** This is necessary, or else when the bison-generated code #include's malloc.h, ** there will be a parse error. ** ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations ** in bison-generated files under Win32. */ # ifdef WIN32 # undef malloc # undef calloc # undef realloc # endif /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { ltoken ltok; /* a leaf is also an ltoken */ qual typequal; unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ abstDeclaratorNode abstDecl; /*@only@*/ declaratorNode declare; /*@only@*/ declaratorNodeList declarelist; /*@only@*/ typeExpr typeexpr; /*@only@*/ arrayQualNode array; /*@only@*/ quantifierNode quantifier; /*@only@*/ quantifierNodeList quantifiers; /*@only@*/ varNode var; /*@only@*/ varNodeList vars; /*@only@*/ storeRefNode storeref; /*@only@*/ storeRefNodeList storereflist; /*@only@*/ termNode term; /*@only@*/ termNodeList termlist; /*@only@*/ programNode program; /*@only@*/ stmtNode stmt; /*@only@*/ claimNode claim; /*@only@*/ typeNode type; /*@only@*/ iterNode iter; /*@only@*/ fcnNode fcn; /*@only@*/ fcnNodeList fcns; /*@only@*/ letDeclNode letdecl; /*@only@*/ letDeclNodeList letdecls; /*@only@*/ lclPredicateNode lclpredicate; /*@only@*/ modifyNode modify; /*@only@*/ paramNode param; /*@only@*/ paramNodeList paramlist; /*@only@*/ declaratorInvNodeList declaratorinvs; /*@only@*/ declaratorInvNode declaratorinv; /*@only@*/ abstBodyNode abstbody; /*@only@*/ abstractNode abstract; /*@only@*/ exposedNode exposed; /*@only@*/ pointers pointers; /* taggedUnionNode taggedunion; */ /*@only@*/ globalList globals; /*@only@*/ constDeclarationNode constdeclaration; /*@only@*/ varDeclarationNode vardeclaration; /*@only@*/ varDeclarationNodeList vardeclarationlist; /*@only@*/ initDeclNodeList initdecls; /*@only@*/ initDeclNode initdecl; /*@only@*/ stDeclNodeList structdecls; /*@only@*/ stDeclNode structdecl; /*@only@*/ strOrUnionNode structorunion; /*@only@*/ enumSpecNode enumspec; /*@only@*/ lclTypeSpecNode lcltypespec; /*@only@*/ typeNameNode typname; /*@only@*/ opFormNode opform; /*@only@*/ sigNode signature; /*@only@*/ nameNode name; /*@only@*/ typeNameNodeList namelist; /*@only@*/ replaceNode replace; /*@only@*/ replaceNodeList replacelist; /*@only@*/ renamingNode renaming; /*@only@*/ traitRefNode traitref; /*@only@*/ traitRefNodeList traitreflist; /*@only@*/ importNode import; /*@only@*/ importNodeList importlist; /*@only@*/ interfaceNode iface; /*@only@*/ interfaceNodeList interfacelist; /*@only@*/ CTypesNode ctypes; /*@-redef@*/ } /* Line 193 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 3314 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 137 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 155 /* YYNRULES -- Number of rules. */ #define YYNRULES 414 /* YYNRULES -- Number of states. */ #define YYNSTATES 684 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 391 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 8, 9, 12, 14, 16, 17, 20, 23, 24, 27, 29, 31, 33, 37, 41, 43, 45, 47, 49, 51, 53, 60, 61, 63, 65, 69, 72, 74, 75, 79, 81, 83, 85, 87, 92, 96, 101, 106, 108, 110, 112, 114, 116, 117, 131, 132, 147, 148, 162, 167, 168, 169, 176, 177, 178, 186, 187, 188, 196, 197, 198, 205, 206, 207, 214, 217, 220, 222, 226, 228, 232, 234, 236, 240, 242, 244, 248, 250, 255, 259, 266, 268, 272, 274, 276, 280, 282, 286, 288, 292, 296, 300, 305, 307, 309, 311, 313, 315, 319, 321, 325, 326, 329, 333, 336, 339, 340, 343, 348, 349, 353, 355, 359, 365, 369, 371, 372, 376, 377, 381, 382, 386, 390, 394, 396, 400, 402, 404, 407, 409, 411, 412, 416, 417, 421, 422, 424, 426, 428, 432, 434, 438, 439, 444, 450, 452, 456, 459, 463, 467, 472, 476, 482, 489, 491, 495, 497, 499, 502, 505, 509, 513, 517, 522, 524, 528, 533, 537, 538, 541, 542, 544, 545, 552, 554, 558, 559, 563, 564, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 593, 595, 597, 599, 601, 603, 605, 607, 609, 611, 613, 615, 617, 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, 659, 661, 663, 665, 667, 669, 671, 673, 675, 678, 684, 686, 689, 691, 694, 695, 702, 703, 710, 713, 716, 717, 719, 721, 724, 728, 730, 734, 735, 737, 744, 747, 749, 753, 755, 757, 759, 763, 766, 769, 773, 778, 780, 784, 787, 790, 794, 799, 801, 804, 807, 811, 816, 819, 822, 825, 828, 832, 834, 835, 837, 841, 844, 846, 848, 851, 855, 859, 864, 867, 871, 878, 880, 883, 886, 890, 894, 899, 904, 910, 914, 919, 924, 930, 933, 936, 940, 944, 946, 948, 950, 952, 954, 956, 958, 959, 961, 963, 967, 969, 971, 976, 977, 979, 981, 985, 987, 989, 996, 998, 1002, 1004, 1009, 1013, 1017, 1019, 1022, 1025, 1027, 1029, 1031, 1034, 1036, 1039, 1042, 1046, 1048, 1050, 1053, 1056, 1060, 1062, 1065, 1069, 1071, 1077, 1081, 1086, 1089, 1093, 1096, 1098, 1102, 1106, 1108, 1113, 1115, 1118, 1122, 1126, 1130, 1135, 1139, 1141, 1145, 1147, 1149, 1151, 1153, 1155, 1157, 1162, 1167, 1172, 1177, 1184, 1189, 1191, 1193, 1195, 1197, 1199, 1202, 1203, 1207, 1209, 1213, 1217, 1222, 1224, 1226, 1228, 1230, 1232, 1234, 1236, 1238 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 138, 0, -1, -1, 140, 139, 142, -1, -1, 140, 141, -1, 145, -1, 146, -1, -1, 147, 143, -1, 152, 143, -1, -1, 143, 144, -1, 147, -1, 152, -1, 146, -1, 57, 176, 7, -1, 115, 180, 7, -1, 155, -1, 156, -1, 157, -1, 159, -1, 162, -1, 148, -1, 122, 286, 12, 149, 37, 7, -1, -1, 150, -1, 151, -1, 150, 32, 151, -1, 123, 245, -1, 245, -1, -1, 109, 153, 154, -1, 155, -1, 156, -1, 157, -1, 159, -1, 50, 228, 190, 7, -1, 228, 190, 7, -1, 117, 228, 190, 7, -1, 133, 228, 190, 7, -1, 164, -1, 173, -1, 134, -1, 135, -1, 136, -1, -1, 228, 241, 192, 160, 34, 194, 196, 200, 201, 202, 205, 206, 35, -1, -1, 158, 228, 241, 192, 161, 34, 194, 196, 200, 201, 202, 205, 206, 35, -1, -1, 48, 288, 12, 207, 37, 192, 163, 34, 196, 201, 210, 205, 35, -1, 48, 285, 288, 7, -1, -1, -1, 62, 165, 112, 20, 166, 215, -1, -1, -1, 62, 167, 97, 112, 20, 168, 215, -1, -1, -1, 97, 62, 169, 112, 20, 170, 215, -1, -1, -1, 56, 171, 112, 20, 172, 215, -1, -1, -1, 113, 228, 174, 220, 175, 7, -1, 231, 7, -1, 239, 7, -1, 177, -1, 176, 32, 177, -1, 179, -1, 3, 179, 3, -1, 43, -1, 179, -1, 178, 32, 179, -1, 284, -1, 181, -1, 180, 32, 181, -1, 290, -1, 290, 12, 183, 37, -1, 12, 182, 37, -1, 12, 182, 37, 12, 183, 37, -1, 290, -1, 182, 32, 290, -1, 185, -1, 184, -1, 184, 32, 185, -1, 246, -1, 184, 32, 246, -1, 186, -1, 185, 32, 186, -1, 246, 53, 224, -1, 246, 53, 187, -1, 246, 53, 187, 257, -1, 291, -1, 250, -1, 189, -1, 261, -1, 191, -1, 190, 32, 191, -1, 241, -1, 241, 33, 188, -1, -1, 192, 193, -1, 228, 190, 7, -1, 64, 7, -1, 65, 7, -1, -1, 194, 195, -1, 105, 228, 190, 7, -1, -1, 60, 197, 7, -1, 198, -1, 197, 32, 198, -1, 286, 31, 199, 46, 261, -1, 286, 46, 261, -1, 228, -1, -1, 49, 260, 7, -1, -1, 106, 260, 7, -1, -1, 61, 63, 7, -1, 61, 45, 7, -1, 61, 203, 7, -1, 204, -1, 203, 32, 204, -1, 261, -1, 229, -1, 66, 229, -1, 64, -1, 65, -1, -1, 52, 260, 7, -1, -1, 48, 260, 7, -1, -1, 208, -1, 209, -1, 129, -1, 209, 32, 129, -1, 245, -1, 209, 32, 245, -1, -1, 47, 34, 211, 35, -1, 47, 34, 211, 7, 35, -1, 212, -1, 12, 211, 37, -1, 211, 6, -1, 211, 8, 211, -1, 211, 7, 211, -1, 285, 12, 213, 37, -1, 285, 12, 37, -1, 286, 33, 285, 12, 37, -1, 286, 33, 285, 12, 213, 37, -1, 214, -1, 213, 32, 214, -1, 278, -1, 286, -1, 3, 214, -1, 214, 3, -1, 214, 3, 214, -1, 12, 214, 37, -1, 285, 12, 37, -1, 285, 12, 213, 37, -1, 7, -1, 34, 216, 35, -1, 34, 178, 35, 7, -1, 34, 35, 7, -1, -1, 216, 159, -1, -1, 218, -1, -1, 58, 219, 280, 12, 260, 37, -1, 221, -1, 220, 32, 221, -1, -1, 241, 222, 223, -1, -1, 34, 217, 35, -1, 132, -1, 116, -1, 118, -1, 120, -1, 121, -1, 124, -1, 125, -1, 126, -1, 131, -1, 127, -1, 224, -1, 225, 224, -1, 20, -1, 225, -1, 67, -1, 78, -1, 68, -1, 69, -1, 71, -1, 72, -1, 73, -1, 74, -1, 95, -1, 79, -1, 80, -1, 82, -1, 83, -1, 81, -1, 75, -1, 76, -1, 77, -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, -1, 99, -1, 100, -1, 97, -1, 98, -1, 104, -1, 101, -1, 92, -1, 93, -1, 94, -1, 96, -1, 70, -1, 102, -1, 84, -1, 85, -1, 226, -1, 231, -1, 239, -1, 227, 228, -1, 8, 229, 31, 229, 8, -1, 228, -1, 228, 230, -1, 6, -1, 230, 6, -1, -1, 128, 234, 232, 34, 235, 35, -1, -1, 130, 234, 233, 34, 235, 35, -1, 128, 287, -1, 130, 287, -1, -1, 287, -1, 236, -1, 235, 236, -1, 228, 237, 7, -1, 241, -1, 237, 32, 241, -1, -1, 32, -1, 119, 234, 34, 240, 238, 35, -1, 119, 287, -1, 25, -1, 240, 32, 25, -1, 243, -1, 242, -1, 286, -1, 12, 242, 37, -1, 6, 242, -1, 242, 249, -1, 242, 12, 37, -1, 242, 12, 208, 37, -1, 20, -1, 12, 243, 37, -1, 6, 243, -1, 243, 249, -1, 243, 12, 37, -1, 243, 12, 208, 37, -1, 20, -1, 6, 244, -1, 244, 249, -1, 244, 12, 37, -1, 244, 12, 208, 37, -1, 228, 244, -1, 228, 242, -1, 228, 247, -1, 228, 247, -1, 66, 228, 247, -1, 250, -1, -1, 248, -1, 12, 248, 37, -1, 6, 248, -1, 6, -1, 249, -1, 248, 249, -1, 248, 12, 37, -1, 12, 208, 37, -1, 248, 12, 208, 37, -1, 11, 36, -1, 11, 189, 36, -1, 55, 27, 111, 27, 51, 27, -1, 253, -1, 27, 253, -1, 253, 27, -1, 27, 253, 27, -1, 251, 254, 252, -1, 27, 251, 254, 252, -1, 251, 254, 252, 27, -1, 27, 251, 254, 252, 27, -1, 11, 254, 36, -1, 11, 254, 36, 27, -1, 27, 11, 254, 36, -1, 27, 11, 254, 36, 27, -1, 10, 284, -1, 26, 284, -1, 27, 10, 284, -1, 27, 26, 284, -1, 22, -1, 34, -1, 23, -1, 35, -1, 265, -1, 14, -1, 39, -1, -1, 255, -1, 27, -1, 255, 256, 27, -1, 32, -1, 24, -1, 31, 258, 26, 289, -1, -1, 259, -1, 289, -1, 259, 32, 289, -1, 261, -1, 262, -1, 55, 262, 111, 262, 51, 262, -1, 263, -1, 262, 14, 262, -1, 264, -1, 279, 12, 260, 37, -1, 264, 39, 264, -1, 264, 33, 264, -1, 266, -1, 269, 267, -1, 269, 268, -1, 3, -1, 6, -1, 269, -1, 265, 266, -1, 265, -1, 267, 265, -1, 265, 269, -1, 268, 265, 269, -1, 274, -1, 270, -1, 270, 274, -1, 274, 270, -1, 274, 270, 274, -1, 271, -1, 271, 274, -1, 272, 31, 289, -1, 272, -1, 11, 273, 36, 31, 289, -1, 11, 273, 36, -1, 11, 36, 31, 289, -1, 11, 36, -1, 251, 273, 252, -1, 251, 252, -1, 261, -1, 273, 256, 261, -1, 12, 262, 37, -1, 286, -1, 291, 12, 275, 37, -1, 277, -1, 274, 276, -1, 274, 10, 284, -1, 274, 26, 284, -1, 274, 11, 36, -1, 274, 11, 275, 36, -1, 274, 31, 289, -1, 262, -1, 275, 32, 262, -1, 28, -1, 29, -1, 30, -1, 38, -1, 278, -1, 107, -1, 54, 12, 275, 37, -1, 114, 12, 44, 37, -1, 114, 12, 203, 37, -1, 108, 12, 261, 37, -1, 59, 12, 261, 32, 261, 37, -1, 108, 12, 228, 37, -1, 42, -1, 43, -1, 40, -1, 41, -1, 280, -1, 279, 280, -1, -1, 21, 281, 282, -1, 283, -1, 282, 32, 283, -1, 286, 31, 199, -1, 286, 31, 66, 199, -1, 25, -1, 20, -1, 25, -1, 25, -1, 284, -1, 284, -1, 284, -1, 284, -1, 284, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 382, 382, 382, 387, 388, 392, 393, 397, 398, 399, 403, 404, 408, 409, 410, 414, 421, 426, 428, 430, 432, 434, 436, 441, 446, 447, 451, 453, 458, 459, 463, 463, 468, 470, 472, 474, 479, 484, 486, 488, 493, 494, 498, 499, 500, 504, 504, 512, 512, 526, 525, 530, 535, 535, 535, 537, 538, 537, 540, 541, 540, 543, 543, 543, 548, 549, 548, 551, 553, 570, 572, 577, 578, 580, 584, 585, 589, 594, 596, 601, 603, 605, 607, 612, 613, 617, 619, 621, 625, 627, 631, 633, 637, 638, 639, 644, 645, 648, 651, 655, 657, 662, 663, 668, 669, 674, 675, 676, 680, 681, 685, 690, 691, 695, 696, 700, 701, 704, 708, 709, 713, 714, 718, 719, 720, 721, 725, 726, 730, 731, 732, 733, 734, 738, 739, 743, 744, 748, 749, 753, 754, 755, 759, 760, 764, 765, 766, 770, 771, 774, 779, 785, 794, 796, 798, 800, 805, 806, 810, 811, 812, 813, 814, 815, 816, 818, 823, 824, 825, 826, 830, 831, 835, 836, 840, 840, 850, 851, 856, 856, 861, 862, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 884, 885, 891, 893, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 939, 941, 943, 945, 947, 957, 958, 964, 965, 970, 969, 974, 973, 977, 979, 984, 985, 989, 990, 996, 1000, 1002, 1007, 1008, 1012, 1014, 1019, 1020, 1031, 1032, 1036, 1037, 1038, 1039, 1040, 1041, 1045, 1046, 1047, 1048, 1049, 1050, 1060, 1061, 1062, 1063, 1064, 1071, 1072, 1073, 1084, 1085, 1086, 1092, 1093, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1108, 1109, 1113, 1115, 1117, 1119, 1121, 1124, 1126, 1128, 1130, 1132, 1134, 1142, 1144, 1146, 1149, 1152, 1155, 1161, 1162, 1166, 1167, 1171, 1172, 1173, 1177, 1178, 1182, 1183, 1187, 1188, 1192, 1196, 1197, 1201, 1202, 1206, 1210, 1217, 1219, 1220, 1224, 1225, 1230, 1232, 1237, 1238, 1239, 1243, 1244, 1248, 1249, 1253, 1254, 1258, 1259, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1273, 1274, 1278, 1281, 1283, 1287, 1292, 1293, 1297, 1298, 1302, 1304, 1306, 1308, 1309, 1311, 1313, 1315, 1318, 1320, 1325, 1326, 1330, 1331, 1332, 1333, 1337, 1338, 1339, 1340, 1341, 1342, 1347, 1353, 1364, 1365, 1366, 1367, 1371, 1373, 1378, 1378, 1386, 1387, 1391, 1392, 1396, 1397, 1401, 1402, 1403, 1404, 1405, 1406, 1407 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "simpleOp", "PREFIX_OP", "POSTFIX_OP", "LLT_MULOP", "LLT_SEMI", "LLT_VERTICALBAR", "ITERATION_OP", "selectSym", "LLT_LBRACKET", "LLT_LPAR", "LLT_IF_THEN_ELSE", "logicalOp", "eqSepSym", "equationSym", "commentSym", "LLT_WHITESPACE", "LLT_EOL", "LLT_TYPEDEF_NAME", "quantifierSym", "openSym", "closeSym", "sepSym", "simpleId", "mapSym", "markerSym", "preSym", "postSym", "anySym", "LLT_COLON", "LLT_COMMA", "LLT_EQUALS", "LLT_LBRACE", "LLT_RBRACE", "LLT_RBRACKET", "LLT_RPAR", "LLT_QUOTE", "eqOp", "LLT_CCHAR", "LLT_CFLOAT", "LLT_CINTEGER", "LLT_LCSTRING", "LLT_ALL", "LLT_ANYTHING", "LLT_BE", "LLT_BODY", "LLT_CLAIMS", "LLT_CHECKS", "LLT_CONSTANT", "LLT_ELSE", "LLT_ENSURES", "LLT_FOR", "LLT_FRESH", "LLT_IF", "LLT_IMMUTABLE", "LLT_IMPORTS", "LLT_CONSTRAINT", "LLT_ISSUB", "LLT_LET", "LLT_MODIFIES", "LLT_MUTABLE", "LLT_NOTHING", "LLT_INTERNAL", "LLT_FILESYS", "LLT_OBJ", "LLT_OUT", "LLT_SEF", "LLT_ONLY", "LLT_PARTIAL", "LLT_OWNED", "LLT_DEPENDENT", "LLT_KEEP", "LLT_KEPT", "LLT_TEMP", "LLT_SHARED", "LLT_UNIQUE", "LLT_UNUSED", "LLT_EXITS", "LLT_MAYEXIT", "LLT_NEVEREXIT", "LLT_TRUEEXIT", "LLT_FALSEEXIT", "LLT_UNDEF", "LLT_KILLED", "LLT_CHECKMOD", "LLT_CHECKED", "LLT_UNCHECKED", "LLT_CHECKEDSTRICT", "LLT_TRUENULL", "LLT_FALSENULL", "LLT_LNULL", "LLT_LNOTNULL", "LLT_RETURNED", "LLT_OBSERVER", "LLT_EXPOSED", "LLT_REFCOUNTED", "LLT_REFS", "LLT_RELNULL", "LLT_RELDEF", "LLT_KILLREF", "LLT_NULLTERMINATED", "LLT_TEMPREF", "LLT_NEWREF", "LLT_PRIVATE", "LLT_REQUIRES", "LLT_RESULT", "LLT_SIZEOF", "LLT_SPEC", "LLT_TAGGEDUNION", "LLT_THEN", "LLT_TYPE", "LLT_TYPEDEF", "LLT_UNCHANGED", "LLT_USES", "LLT_CHAR", "LLT_CONST", "LLT_DOUBLE", "LLT_ENUM", "LLT_FLOAT", "LLT_INT", "LLT_ITER", "LLT_YIELD", "LLT_LONG", "LLT_SHORT", "LLT_SIGNED", "LLT_UNKNOWN", "LLT_STRUCT", "LLT_TELIPSIS", "LLT_UNION", "LLT_UNSIGNED", "LLT_VOID", "LLT_VOLATILE", "LLT_PRINTFLIKE", "LLT_SCANFLIKE", "LLT_MESSAGELIKE", "$accept", "interface", "@1", "externals", "external", "optDeclarations", "declarations", "declaration", "imports", "uses", "export", "iter", "iterParamList", "realIterParamList", "iterParam", "private", "@2", "private2", "constDeclaration", "varDeclaration", "type", "special", "fcn", "@3", "@4", "claim", "@5", "abstract", "@6", "@7", "@8", "@9", "@10", "@11", "@12", "@13", "exposed", "@14", "@15", "importNameList", "importName", "interfaceNameList", "interfaceName", "traitRefNodeList", "traitRef", "traitIdList", "renaming", "nameList", "replaceNodeList", "replace", "name", "initializer", "constLclExpr", "initDecls", "initDecl", "globals", "globalDecl", "privateInits", "privateInit", "optLetDecl", "beDeclList", "beDecl", "sortSpec", "optChecks", "optRequire", "optModify", "storeRefList", "storeRef", "optEnsure", "optClaim", "optParamList", "realParamList", "paramList", "optBody", "callExpr", "stmt", "valueList", "value", "abstBody", "fcns", "optTypeInv", "typeInv", "@16", "declaratorInvs", "declaratorInv", "@17", "optExposedBody", "CType", "CTypes", "typeSpecifier", "specialQualifier", "lclTypeSpec", "lclType", "pointers", "structOrUnionSpec", "@18", "@19", "optTagId", "structDecls", "structDecl", "declaratorList", "optCOMMA", "enumSpec", "enumeratorList", "declarator", "notype_decl", "after_type_decl", "parameter_decl", "param", "typeName", "optAbstDeclarator", "abstDeclarator", "arrayQual", "opForm", "open", "close", "anyOp", "middle", "placeList", "separator", "signature", "domain", "sortList", "lclPredicate", "term", "term0", "equalityTerm", "simpleOpTerm", "simpleOp2", "prefixOpTerm", "postfixOps", "infixOpPart", "secondary", "bracketed", "sqBracketed", "matched", "args", "primary", "termList", "stateFcn", "lclPrimary", "cLiteral", "quantifiers", "quantifier", "@20", "quantifiedList", "quantified", "simpleIdOrTypedefName", "fcnId", "varId", "tagId", "claimId", "sortId", "traitId", "opId", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 137, 139, 138, 140, 140, 141, 141, 142, 142, 142, 143, 143, 144, 144, 144, 145, 146, 147, 147, 147, 147, 147, 147, 148, 149, 149, 150, 150, 151, 151, 153, 152, 154, 154, 154, 154, 155, 156, 156, 156, 157, 157, 158, 158, 158, 160, 159, 161, 159, 163, 162, 162, 165, 166, 164, 167, 168, 164, 169, 170, 164, 171, 172, 164, 174, 175, 173, 173, 173, 176, 176, 177, 177, 177, 178, 178, 179, 180, 180, 181, 181, 181, 181, 182, 182, 183, 183, 183, 184, 184, 185, 185, 186, 186, 186, 187, 187, 188, 189, 190, 190, 191, 191, 192, 192, 193, 193, 193, 194, 194, 195, 196, 196, 197, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 202, 202, 203, 203, 204, 204, 204, 204, 204, 205, 205, 206, 206, 207, 207, 208, 208, 208, 209, 209, 210, 210, 210, 211, 211, 211, 211, 211, 212, 212, 212, 212, 213, 213, 214, 214, 214, 214, 214, 214, 214, 214, 215, 215, 215, 215, 216, 216, 217, 217, 219, 218, 220, 220, 222, 221, 223, 223, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 226, 226, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 228, 228, 228, 228, 228, 229, 229, 230, 230, 232, 231, 233, 231, 231, 231, 234, 234, 235, 235, 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 242, 242, 242, 242, 243, 243, 243, 243, 243, 243, 244, 244, 244, 244, 244, 245, 245, 245, 246, 246, 246, 247, 247, 248, 248, 248, 248, 248, 248, 248, 248, 249, 249, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 251, 251, 252, 252, 253, 253, 253, 254, 254, 255, 255, 256, 256, 257, 258, 258, 259, 259, 260, 261, 262, 262, 262, 263, 263, 263, 263, 264, 264, 264, 265, 265, 266, 266, 267, 267, 268, 268, 269, 269, 269, 269, 269, 269, 269, 270, 270, 271, 271, 271, 271, 272, 272, 273, 273, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, 275, 275, 276, 276, 276, 276, 277, 277, 277, 277, 277, 277, 277, 277, 278, 278, 278, 278, 279, 279, 281, 280, 282, 282, 283, 283, 284, 284, 285, 286, 287, 288, 289, 290, 291 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 3, 0, 2, 1, 1, 0, 2, 2, 0, 2, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 6, 0, 1, 1, 3, 2, 1, 0, 3, 1, 1, 1, 1, 4, 3, 4, 4, 1, 1, 1, 1, 1, 0, 13, 0, 14, 0, 13, 4, 0, 0, 6, 0, 0, 7, 0, 0, 7, 0, 0, 6, 0, 0, 6, 2, 2, 1, 3, 1, 3, 1, 1, 3, 1, 1, 3, 1, 4, 3, 6, 1, 3, 1, 1, 3, 1, 3, 1, 3, 3, 3, 4, 1, 1, 1, 1, 1, 3, 1, 3, 0, 2, 3, 2, 2, 0, 2, 4, 0, 3, 1, 3, 5, 3, 1, 0, 3, 0, 3, 0, 3, 3, 3, 1, 3, 1, 1, 2, 1, 1, 0, 3, 0, 3, 0, 1, 1, 1, 3, 1, 3, 0, 4, 5, 1, 3, 2, 3, 3, 4, 3, 5, 6, 1, 3, 1, 1, 2, 2, 3, 3, 3, 4, 1, 3, 4, 3, 0, 2, 0, 1, 0, 6, 1, 3, 0, 3, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 2, 1, 2, 0, 6, 0, 6, 2, 2, 0, 1, 1, 2, 3, 1, 3, 0, 1, 6, 2, 1, 3, 1, 1, 1, 3, 2, 2, 3, 4, 1, 3, 2, 2, 3, 4, 1, 2, 2, 3, 4, 2, 2, 2, 2, 3, 1, 0, 1, 3, 2, 1, 1, 2, 3, 3, 4, 2, 3, 6, 1, 2, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 3, 1, 1, 4, 0, 1, 1, 3, 1, 1, 6, 1, 3, 1, 4, 3, 3, 1, 2, 2, 1, 1, 1, 2, 1, 2, 2, 3, 1, 1, 2, 2, 3, 1, 2, 3, 1, 5, 3, 4, 2, 3, 2, 1, 3, 3, 1, 4, 1, 2, 3, 3, 3, 4, 3, 1, 3, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 6, 4, 1, 1, 1, 1, 1, 2, 0, 3, 1, 3, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 4, 0, 2, 1, 0, 0, 8, 5, 6, 7, 0, 407, 406, 74, 0, 70, 72, 77, 0, 0, 78, 413, 80, 0, 195, 0, 0, 62, 53, 197, 199, 200, 229, 201, 202, 203, 204, 211, 212, 213, 198, 206, 207, 210, 208, 209, 231, 232, 214, 215, 216, 217, 218, 225, 226, 227, 205, 228, 221, 222, 219, 220, 224, 230, 223, 31, 0, 184, 0, 185, 248, 186, 187, 0, 188, 189, 190, 192, 248, 248, 191, 183, 0, 43, 44, 45, 3, 11, 23, 11, 18, 19, 20, 0, 21, 22, 41, 42, 193, 196, 233, 0, 0, 234, 235, 0, 16, 0, 0, 84, 17, 0, 0, 221, 238, 0, 234, 235, 408, 411, 0, 0, 0, 0, 0, 0, 59, 0, 65, 0, 0, 410, 258, 409, 0, 242, 246, 244, 247, 0, 9, 10, 0, 194, 236, 0, 0, 269, 0, 100, 104, 262, 261, 263, 68, 69, 73, 71, 0, 82, 79, 345, 346, 0, 322, 320, 315, 0, 0, 316, 321, 0, 0, 0, 87, 86, 91, 286, 89, 285, 322, 299, 319, 240, 239, 0, 0, 138, 0, 102, 0, 0, 0, 0, 32, 33, 34, 35, 36, 0, 0, 0, 25, 0, 0, 0, 12, 15, 13, 14, 104, 265, 271, 0, 0, 38, 0, 0, 46, 0, 0, 266, 0, 272, 85, 0, 311, 324, 0, 323, 312, 0, 322, 0, 322, 300, 0, 286, 81, 0, 0, 290, 0, 283, 287, 291, 0, 0, 301, 241, 0, 52, 141, 0, 139, 140, 286, 143, 37, 63, 54, 0, 0, 66, 177, 179, 39, 259, 255, 0, 0, 26, 27, 30, 0, 0, 40, 48, 264, 270, 101, 0, 0, 400, 409, 396, 397, 394, 395, 0, 0, 0, 387, 0, 0, 103, 98, 0, 99, 334, 336, 338, 0, 342, 347, 354, 358, 361, 353, 373, 386, 0, 398, 414, 371, 0, 0, 0, 0, 105, 0, 296, 0, 267, 0, 273, 0, 0, 307, 327, 326, 0, 313, 0, 314, 0, 302, 0, 284, 88, 90, 92, 0, 289, 0, 0, 0, 292, 94, 93, 97, 96, 317, 318, 303, 237, 104, 0, 290, 0, 275, 281, 280, 282, 0, 0, 57, 60, 0, 0, 181, 256, 0, 29, 0, 0, 0, 0, 250, 0, 0, 365, 368, 0, 0, 0, 0, 0, 0, 0, 0, 367, 0, 0, 0, 0, 348, 347, 349, 343, 344, 355, 359, 0, 0, 0, 0, 382, 383, 384, 0, 385, 356, 374, 0, 399, 0, 107, 108, 109, 0, 297, 268, 274, 83, 308, 325, 309, 304, 0, 294, 288, 293, 0, 329, 95, 305, 50, 142, 144, 276, 290, 0, 277, 167, 171, 64, 55, 0, 0, 178, 67, 173, 180, 260, 257, 24, 28, 0, 253, 243, 251, 245, 109, 0, 363, 0, 370, 401, 402, 0, 380, 0, 0, 0, 195, 0, 0, 0, 132, 133, 0, 0, 127, 130, 129, 366, 337, 341, 340, 351, 350, 0, 412, 360, 375, 377, 0, 376, 379, 357, 0, 333, 0, 112, 106, 310, 306, 0, 295, 0, 330, 331, 0, 278, 0, 0, 0, 75, 0, 58, 61, 175, 0, 174, 252, 0, 112, 364, 0, 369, 0, 0, 0, 388, 0, 0, 393, 391, 389, 131, 0, 390, 352, 378, 339, 372, 0, 0, 110, 119, 298, 0, 0, 112, 279, 170, 0, 0, 168, 172, 0, 0, 182, 254, 119, 362, 403, 0, 404, 118, 381, 0, 0, 128, 0, 114, 0, 0, 0, 121, 328, 332, 121, 76, 169, 104, 0, 121, 405, 335, 392, 113, 0, 0, 0, 0, 0, 0, 123, 145, 0, 123, 115, 0, 117, 111, 120, 0, 0, 134, 0, 134, 0, 134, 0, 122, 0, 0, 0, 0, 136, 0, 0, 176, 136, 116, 125, 124, 126, 0, 0, 0, 0, 409, 0, 148, 0, 0, 51, 0, 135, 0, 47, 0, 150, 0, 0, 146, 0, 0, 49, 137, 0, 149, 147, 152, 151, 0, 0, 154, 0, 157, 159, 0, 160, 408, 0, 161, 0, 0, 153, 162, 0, 0, 164, 158, 163, 165, 0, 155, 0, 166, 156 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 1, 6, 2, 7, 86, 140, 206, 8, 207, 208, 88, 270, 271, 272, 209, 127, 194, 90, 91, 92, 93, 94, 318, 380, 95, 513, 96, 124, 365, 125, 448, 193, 449, 123, 364, 97, 199, 369, 14, 15, 517, 16, 19, 20, 108, 173, 174, 175, 176, 348, 295, 296, 148, 149, 218, 319, 504, 549, 550, 575, 576, 569, 580, 599, 610, 482, 483, 621, 632, 253, 344, 255, 612, 656, 636, 661, 662, 446, 519, 523, 524, 562, 263, 264, 370, 453, 98, 99, 100, 101, 256, 484, 184, 116, 203, 204, 130, 377, 378, 458, 372, 117, 268, 189, 151, 152, 362, 257, 178, 243, 244, 245, 179, 297, 354, 181, 228, 229, 466, 435, 510, 511, 501, 502, 299, 300, 301, 302, 303, 399, 400, 304, 305, 306, 307, 383, 308, 472, 413, 309, 310, 311, 312, 385, 468, 469, 313, 664, 314, 132, 121, 494, 22, 315 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -607 static const yytype_int16 yypact[] = { -607, 50, -29, -607, 198, 89, 1350, -607, -607, -607, 208, -607, -607, -607, 65, -607, -607, -607, 208, 110, -607, -607, 45, 2903, -607, 276, 2903, -607, 18, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, 85, -607, -607, -607, -607, -607, -607, -607, 2903, -607, 2903, -607, 208, -607, -607, 133, -607, -607, -607, -607, 208, 208, -607, -607, 2903, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, 2903, -607, -607, -607, -607, -607, 399, -607, 2903, 336, 155, 192, 185, -607, 198, 268, -607, -607, 89, 1152, -607, 213, 199, -607, -607, 297, -607, 208, 305, 336, 240, 242, 273, -607, 1445, -607, 336, 333, -607, 359, -607, 369, -607, 359, -607, 359, 336, 1247, 1247, 336, -607, -607, 336, 336, -607, 139, -607, 145, 416, 422, -607, -607, -607, -607, -607, 208, 388, -607, -607, -607, 208, 360, -607, -607, 208, 471, -607, -607, 376, 2903, 398, 393, 406, -607, 347, 387, -607, 360, 445, -607, -607, 456, 2903, 476, 2319, 143, 457, 474, 484, 397, 404, -607, -607, -607, -607, -607, 336, 150, 481, 2414, 477, 488, 166, -607, -607, -607, -607, -607, 416, 422, 239, 279, -607, 336, 3150, 1836, 272, 1933, -607, 2030, -607, -607, 1152, -607, -607, 482, 224, -607, 208, 360, 208, 360, 501, 418, 347, -607, 1152, 1152, 347, 1741, -607, 433, -607, 453, 118, -607, -607, 524, -607, -607, 496, -607, 503, 435, -607, -607, -607, -607, 517, 519, 508, -607, -607, -607, -607, 509, 2903, 505, 512, -607, -607, 2903, 2903, -607, 1836, -607, -607, -607, 3059, 3150, -607, 297, -607, -607, -607, -607, 533, 3150, 534, -607, 535, 536, -607, -607, 3033, -607, 537, -607, 304, 3200, -607, 329, 1155, 1155, 521, 654, -607, -607, 188, -607, -607, -607, 538, 547, 548, 522, -607, 336, -607, 523, -607, 527, -607, 528, 529, 540, -607, -607, 541, -607, 525, -607, 118, -607, 543, -607, 406, 387, -607, 387, 433, 539, 292, 2127, -607, 544, -607, -607, -607, -607, -607, 545, -607, -607, 2509, 435, 1644, -607, 416, 446, -607, 35, 35, -607, -607, 336, 553, 549, 556, 551, -607, 580, 2414, 336, 2611, -607, 2713, 554, 559, -607, 381, 44, 133, 3150, -1, 3150, 1022, 762, -607, 375, 3150, 3200, 3200, -607, -607, 335, 329, 329, 236, 236, 208, 208, 3109, 208, -607, -607, -607, 208, -607, 1155, -607, 3150, -607, 3150, -607, -607, -607, 189, -607, -607, -607, -607, -607, -607, 564, 565, 550, -607, -607, -607, 557, 208, -607, -607, 1836, -607, -607, 446, 459, 2224, -607, -607, 182, -607, -607, 35, 35, -607, -607, 542, -607, -607, -607, -607, -607, 197, -607, -607, -607, -607, -607, 208, 567, 3150, -607, 563, -607, 568, 537, 293, 3150, 570, 584, 566, 573, 574, -607, -607, 2903, 312, -607, -607, -607, -607, -607, -607, -607, -607, -607, 335, -607, -607, -607, -607, 394, -607, -607, 236, 575, -607, 331, -15, -607, -607, -607, 578, -607, 588, 583, -607, 582, -607, 586, 610, 247, -607, 1547, -607, -607, -607, 585, -607, -607, 336, -15, -607, 208, -607, 133, 2808, 3150, -607, 25, 3150, -607, -607, -607, -607, 892, -607, -607, -607, -607, -607, 133, 2903, -607, 577, -607, 208, 208, 569, -607, -607, 208, 617, -607, -607, 336, 606, -607, -607, 577, -607, -607, 2903, -607, -607, 537, 3150, 594, -607, 270, -607, 77, 336, 3150, 530, -607, -607, 530, -607, -607, -607, 625, 530, -607, 537, -607, -607, 133, 2903, 3150, 278, 634, 3150, 581, 592, 3150, 581, -607, 599, -607, -607, -607, 639, 632, 595, 614, 595, 612, 595, 3150, -607, 643, 644, 288, 3150, 607, 181, 621, -607, 607, -607, -607, -607, -607, 651, 3150, 624, 181, 648, 126, -607, 649, 629, -607, 628, -607, 660, -607, 48, -607, 299, 181, -607, 212, 645, -607, -607, 181, -607, -607, 661, -607, 202, 202, -607, 351, 665, -607, 659, -607, -607, 666, -607, 43, 202, -607, 246, 379, 411, -607, 665, -607, -607, 358, -607, 365, -607, -607 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -607, -607, -607, -607, -607, -607, 590, -607, -607, 679, 683, -607, -607, -607, 315, 687, -607, -607, 591, 608, 611, -607, -123, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, 587, -607, -8, -607, 626, -607, 516, -607, 504, 502, -607, -607, 526, -110, 531, -190, -607, 281, -607, -483, -607, 156, -520, 190, -159, 152, 157, 220, -353, 142, -607, -182, -607, -607, -554, -607, -185, -606, -322, -607, -607, -607, -607, -607, 401, -607, -607, -91, -607, -607, -607, -5, -20, -607, 29, -607, -607, 417, 497, -6, -607, -607, 54, -607, -95, -119, 353, 413, -178, 261, -137, -210, -22, 532, -14, -248, 609, -121, -607, 546, -607, -607, -607, -528, -203, -265, -607, 108, -101, 478, -607, -607, -280, 468, -607, -607, 489, -269, -285, -607, -607, -308, -607, -305, -607, -607, 248, 5, -25, -40, 434, 668, -369, 16, 552 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -409 static const yytype_int16 yytable[] = { 120, 102, 105, 115, 198, 254, 415, 150, 143, 17, 21, 182, 188, 393, 298, 17, 298, 384, 114, 200, 277, 122, 397, 21, 273, 387, 211, 213, 4, 205, 119, 343, 345, 134, 109, 103, 401, 402, 324, 393, 326, 499, 444, 447, 565, 547, 672, 210, 589, 391, 3, 597, 668, 669, 645, 653, 647, 112, 393, 247, 104, 128, 153, 129, 676, 512, 677, 182, 635, 445, 608, 583, 106, 613, 604, 131, 572, 139, 382, 644, 675, 467, 153, 131, 131, 654, 5, 428, 142, 153, 548, 373, 630, 657, 382, 528, 144, 107, 180, 153, 338, 18, 153, 642, 265, 153, 153, 177, 594, 11, 473, 333, 17, 335, 12, -56, 21, 110, 490, 363, 497, 471, 102, 595, 182, 119, 520, 521, 487, 221, 223, 503, 645, 646, 647, 102, 102, 361, 182, 182, 471, 352, 111, 500, 486, 182, 215, 126, 343, 345, 258, 471, -102, 353, 234, 349, 103, 266, 133, 153, 566, 648, 154, 21, 433, 250, 437, 237, 226, 103, 103, 216, 230, 276, 224, 216, 153, -102, 217, 439, 114, 104, 216, 581, 582, 474, 477, 485, 156, 221, 223, 221, 223, 633, 104, 104, 505, 273, 216, 155, 414, 10, 11, 398, 525, 658, 634, 12, 535, 283, 420, 180, 543, 320, 659, 658, 153, 516, 11, 183, 177, 216, 347, 12, 659, 180, 180, 634, 11, 526, 185, 343, 180, 12, 177, 177, 332, 634, 334, 211, 213, 13, 285, 286, 287, 288, 404, 405, 329, 660, 219, 220, 285, 286, 287, 288, 330, 587, 659, 623, 515, 625, 406, 530, 407, 408, 409, 410, 571, 376, 376, 634, 320, 265, 411, 161, 278, 592, 162, 557, 153, 459, 558, 281, 282, 606, 285, 286, 287, 288, 219, 222, 11, 283, 166, 629, 11, 284, 491, 492, 158, 118, 593, 219, 346, 159, 169, 590, 321, -406, 216, 633, 285, 286, 287, 288, 279, 187, 153, 153, 541, 347, 211, 347, 634, 533, 289, 290, 153, 431, 534, 291, 161, 573, 655, 162, 153, 394, 485, 221, 443, 663, 145, 395, 541, 470, 281, 282, 146, 542, 663, 663, 190, 241, 191, 11, 147, 166, 219, 242, 284, 133, 663, 533, 663, 663, 663, 201, 546, 169, 192, 461, 376, 461, 376, 285, 286, 287, 288, 292, 293, 202, 658, 670, 476, 114, 294, 227, 671, 289, 670, 659, 605, -249, 291, 682, 560, 670, 352, 329, 225, 153, 683, 236, 634, 329, 485, 330, 493, 495, 353, 498, 626, 330, 658, 493, 678, 465, 443, 285, 286, 287, 288, 659, 600, 239, 533, 219, 220, 602, 544, 564, 320, 219, 222, 238, 634, 518, 240, 493, 246, 358, 292, 293, 219, 346, 219, 359, 680, 294, 17, 285, 286, 287, 288, 360, 161, 219, 442, 162, 133, 540, 249, 163, 164, 441, 586, 165, 596, 493, 219, 359, 248, 11, 161, 166, 114, 162, 12, 167, 168, 231, 232, 251, 133, 165, 153, 169, 679, 681, 217, 470, 170, 166, 259, 135, 137, 233, 212, 214, 340, 342, 488, 489, 260, 169, 267, 577, 171, 261, 170, 274, 136, 138, 561, 67, 262, 69, 328, 71, 72, 153, 275, 74, 75, 76, 77, 570, 336, 337, 80, 81, 355, 356, 493, 357, 114, 366, 153, 367, 368, 371, 374, 578, 375, 386, 388, 389, 390, 584, 416, 393, 403, 577, 417, 418, 419, 493, 493, 421, 451, 427, 17, 570, 422, 423, 424, 425, 426, 67, 429, 69, 436, 71, 72, 434, 430, 74, 75, 76, 77, 454, 638, 452, 80, 81, 455, 456, 463, 570, 464, 506, 507, 638, 509, 531, -407, 637, 529, 532, 522, 508, 536, 537, 114, 551, 638, 638, 637, 665, 538, 539, 545, 638, 552, 553, 554, 556, 665, 665, 563, 637, 637, 555, 585, 667, 579, 283, 637, 547, 665, 591, 665, 665, 665, 161, 598, 601, 162, 611, 23, 607, 609, 281, 282, 615, 616, 620, 622, 624, 627, 628, 475, 283, 166, 631, 639, 284, 641, 643, -408, 649, 650, 651, 404, 405, 169, 652, 672, 647, 666, 673, 285, 286, 287, 288, 166, 617, 674, 141, 406, 9, 407, 408, 409, 410, 289, 290, 169, 87, 457, 291, 411, 89, 157, 618, 479, 480, 481, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 195, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 196, 64, 160, 197, 292, 293, 327, 341, 339, 527, 322, 294, 280, 67, 603, 69, 70, 71, 72, 614, 588, 74, 75, 76, 77, 78, 574, 79, 80, 81, 161, 619, 640, 162, 450, 23, 440, 379, 281, 282, 331, 412, 235, 350, 567, 396, 0, 475, 283, 166, 0, 392, 284, 186, 0, 0, 0, 0, 0, 0, 0, 169, 0, 351, 0, 0, 0, 285, 286, 287, 288, 478, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 290, 0, 0, 0, 291, 0, 0, 0, 0, 479, 480, 481, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 23, 0, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 475, 283, 166, 0, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 290, 0, 0, 0, 291, 0, 0, 0, 0, 479, 480, 481, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 23, 0, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 475, 283, 166, 0, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 290, 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 23, 0, 163, 164, 0, 0, 165, 282, 0, 0, 0, 0, 24, 0, 166, 11, 0, 0, 167, 168, 284, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 170, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 171, 0, 289, 0, 0, 0, 0, 291, 0, 0, 0, 172, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 292, 293, 0, 0, 0, 24, 67, 294, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 26, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 65, 0, 23, 0, 66, 0, 5, 67, 68, 69, 70, 71, 72, 73, 24, 74, 75, 76, 77, 78, 0, 79, 80, 81, 82, 83, 84, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 26, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 65, 0, 0, 0, 66, 0, 24, 67, 68, 69, 70, 71, 72, 73, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 82, 83, 84, 85, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 23, 0, 0, 66, 0, 0, 67, 68, 69, 70, 71, 72, 24, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 82, 83, 84, 85, 559, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 441, 64, 23, 0, 0, 219, 359, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 133, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 83, 84, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 241, 64, 23, 0, 0, 219, 242, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 316, 317, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 323, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 269, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 67, 0, 69, 70, 71, 72, 24, 0, 74, 75, 76, 77, 78, 438, 79, 80, 81, 0, 0, 0, 0, 460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 67, 0, 69, 70, 71, 72, 24, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 462, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 568, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 0, 0, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 11, 283, 166, 352, 0, 284, 0, 0, 0, 161, 0, 0, 162, 0, 169, 353, 0, 281, 282, 0, 285, 286, 287, 288, 0, 0, 11, 283, 166, 0, 0, 284, 0, 0, 289, 290, 0, 0, 0, 291, 169, 0, 381, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, 289, 290, 162, 0, 0, 291, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 11, 283, 166, 0, 0, 284, 0, 0, 0, 0, 0, 292, 293, 0, 169, 0, 496, 0, 294, 0, 285, 286, 287, 288, 161, 0, 0, 162, 0, 0, 0, 0, 281, 282, 289, 290, 0, 292, 293, 291, 0, 11, 283, 166, 294, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, 289, 290, 162, 0, 0, 291, 0, 281, 282, 0, 0, 0, 292, 293, 0, 0, 11, 0, 166, 294, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 0, 0, 292, 293, 291, 0, 0, 0, 0, 294, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294 }; static const yytype_int16 yycheck[] = { 25, 6, 10, 23, 127, 187, 311, 102, 99, 4, 5, 112, 122, 14, 217, 10, 219, 282, 23, 129, 210, 26, 302, 18, 202, 290, 145, 146, 57, 139, 25, 241, 242, 73, 18, 6, 305, 306, 220, 14, 222, 410, 7, 365, 527, 60, 3, 142, 568, 297, 0, 579, 658, 659, 6, 7, 8, 12, 14, 180, 6, 66, 102, 68, 670, 434, 672, 168, 622, 34, 598, 554, 7, 601, 594, 70, 51, 82, 281, 633, 37, 37, 122, 78, 79, 37, 115, 335, 93, 129, 105, 269, 620, 647, 297, 464, 101, 32, 112, 139, 237, 12, 142, 631, 199, 145, 146, 112, 31, 20, 111, 232, 107, 234, 25, 97, 111, 7, 398, 256, 405, 386, 127, 46, 225, 120, 448, 449, 393, 151, 152, 416, 6, 7, 8, 140, 141, 256, 239, 240, 405, 23, 32, 412, 392, 246, 7, 62, 358, 359, 7, 416, 7, 35, 168, 246, 127, 7, 25, 199, 529, 35, 7, 158, 346, 185, 356, 172, 163, 140, 141, 32, 167, 7, 158, 32, 216, 32, 33, 357, 185, 127, 32, 552, 553, 388, 389, 390, 3, 211, 212, 213, 214, 12, 140, 141, 7, 375, 32, 7, 12, 3, 20, 304, 7, 3, 25, 25, 473, 21, 320, 225, 492, 218, 12, 3, 256, 35, 20, 6, 225, 32, 244, 25, 12, 239, 240, 25, 20, 32, 31, 441, 246, 25, 239, 240, 231, 25, 233, 358, 359, 43, 40, 41, 42, 43, 10, 11, 24, 37, 11, 12, 40, 41, 42, 43, 32, 562, 12, 612, 442, 614, 26, 466, 28, 29, 30, 31, 533, 274, 275, 25, 277, 368, 38, 3, 37, 7, 6, 32, 320, 376, 35, 11, 12, 7, 40, 41, 42, 43, 11, 12, 20, 21, 22, 7, 20, 25, 399, 400, 32, 25, 32, 11, 12, 37, 34, 572, 36, 12, 32, 12, 40, 41, 42, 43, 37, 12, 358, 359, 32, 343, 441, 345, 25, 32, 54, 55, 368, 37, 37, 59, 3, 536, 35, 6, 376, 33, 541, 361, 362, 649, 6, 39, 32, 385, 11, 12, 12, 37, 658, 659, 112, 6, 112, 20, 20, 22, 11, 12, 25, 25, 670, 32, 672, 673, 674, 34, 37, 34, 97, 377, 377, 379, 379, 40, 41, 42, 43, 107, 108, 12, 3, 32, 389, 390, 114, 27, 37, 54, 32, 12, 595, 34, 59, 37, 519, 32, 23, 24, 12, 441, 37, 27, 25, 24, 609, 32, 403, 404, 35, 406, 615, 32, 3, 410, 37, 36, 440, 40, 41, 42, 43, 12, 583, 32, 32, 11, 12, 588, 36, 526, 437, 11, 12, 37, 25, 445, 32, 434, 53, 6, 107, 108, 11, 12, 11, 12, 37, 114, 445, 40, 41, 42, 43, 20, 3, 11, 12, 6, 25, 481, 6, 10, 11, 6, 561, 14, 578, 464, 11, 12, 27, 20, 3, 22, 481, 6, 25, 26, 27, 10, 11, 7, 25, 14, 526, 34, 673, 674, 33, 531, 39, 22, 20, 78, 79, 26, 145, 146, 239, 240, 394, 395, 20, 34, 25, 547, 55, 112, 39, 34, 78, 79, 519, 116, 112, 118, 36, 120, 121, 561, 34, 124, 125, 126, 127, 532, 27, 111, 131, 132, 8, 37, 529, 32, 541, 20, 578, 20, 32, 32, 37, 548, 32, 12, 12, 12, 12, 557, 12, 14, 31, 593, 7, 7, 34, 552, 553, 36, 7, 36, 557, 568, 37, 37, 37, 27, 27, 116, 27, 118, 27, 120, 121, 31, 37, 124, 125, 126, 127, 25, 622, 34, 131, 132, 35, 7, 34, 594, 31, 27, 27, 633, 37, 32, 12, 622, 31, 31, 58, 51, 32, 37, 609, 27, 646, 647, 633, 649, 37, 37, 37, 653, 26, 32, 34, 7, 658, 659, 35, 646, 647, 37, 7, 650, 49, 21, 653, 60, 670, 37, 672, 673, 674, 3, 106, 12, 6, 47, 8, 7, 61, 11, 12, 46, 7, 52, 34, 37, 7, 7, 20, 21, 22, 48, 35, 25, 7, 35, 12, 12, 33, 35, 10, 11, 34, 7, 3, 8, 25, 12, 40, 41, 42, 43, 22, 45, 12, 89, 26, 2, 28, 29, 30, 31, 54, 55, 34, 6, 375, 59, 38, 6, 107, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 127, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 127, 104, 111, 127, 107, 108, 225, 240, 239, 463, 219, 114, 216, 116, 593, 118, 119, 120, 121, 602, 565, 124, 125, 126, 127, 128, 541, 130, 131, 132, 3, 609, 625, 6, 368, 8, 358, 275, 11, 12, 229, 308, 168, 246, 531, 302, -1, 20, 21, 22, -1, 297, 25, 120, -1, -1, -1, -1, -1, -1, -1, 34, -1, 246, -1, -1, -1, 40, 41, 42, 43, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, 55, -1, -1, -1, 59, -1, -1, -1, -1, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, 55, -1, -1, -1, 59, -1, -1, -1, -1, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, 55, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, 8, -1, 10, 11, -1, -1, 14, 12, -1, -1, -1, -1, 20, -1, 22, 20, -1, -1, 26, 27, 25, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, 39, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, 54, -1, -1, -1, -1, 59, -1, -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, 107, 108, -1, -1, -1, 20, 116, 114, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, 50, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, 109, -1, 8, -1, 113, -1, 115, 116, 117, 118, 119, 120, 121, 122, 20, 124, 125, 126, 127, 128, -1, 130, 131, 132, 133, 134, 135, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, 50, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, 109, -1, -1, -1, 113, -1, 20, 116, 117, 118, 119, 120, 121, 122, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 133, 134, 135, 136, -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, 8, -1, -1, 113, -1, -1, 116, 117, 118, 119, 120, 121, 20, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 133, 134, 135, 136, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 6, 104, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, 25, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, 134, 135, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 6, 104, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, 123, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, 116, -1, 118, 119, 120, 121, 20, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, 116, -1, 118, 119, 120, 121, 20, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, -1, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, -1, 25, -1, -1, -1, 3, -1, -1, 6, -1, 34, 35, -1, 11, 12, -1, 40, 41, 42, 43, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, 54, 55, -1, -1, -1, 59, 34, -1, 36, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 54, 55, 6, -1, -1, 59, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, -1, -1, -1, 107, 108, -1, 34, -1, 36, -1, 114, -1, 40, 41, 42, 43, 3, -1, -1, 6, -1, -1, -1, -1, 11, 12, 54, 55, -1, 107, 108, 59, -1, 20, 21, 22, 114, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 54, 55, 6, -1, -1, 59, -1, 11, 12, -1, -1, -1, 107, 108, -1, -1, 20, -1, 22, 114, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, 107, 108, 59, -1, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 138, 140, 0, 57, 115, 139, 141, 145, 146, 3, 20, 25, 43, 176, 177, 179, 284, 12, 180, 181, 284, 290, 8, 20, 48, 50, 56, 62, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 104, 109, 113, 116, 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 142, 147, 148, 152, 155, 156, 157, 158, 159, 162, 164, 173, 224, 225, 226, 227, 228, 231, 239, 179, 7, 32, 182, 290, 7, 32, 12, 97, 228, 229, 231, 239, 25, 284, 285, 288, 228, 171, 165, 167, 62, 153, 228, 228, 234, 284, 287, 25, 286, 234, 287, 234, 287, 228, 143, 143, 228, 224, 228, 6, 12, 20, 190, 191, 241, 242, 243, 286, 7, 7, 3, 177, 32, 37, 181, 3, 6, 10, 11, 14, 22, 26, 27, 34, 39, 55, 66, 183, 184, 185, 186, 228, 246, 250, 251, 253, 265, 6, 230, 31, 288, 12, 190, 241, 112, 112, 97, 169, 154, 155, 156, 157, 159, 174, 190, 34, 12, 232, 233, 190, 144, 146, 147, 152, 241, 242, 243, 242, 243, 7, 32, 33, 192, 11, 12, 249, 12, 249, 290, 12, 284, 27, 254, 255, 284, 10, 11, 26, 251, 253, 27, 228, 37, 32, 32, 6, 12, 247, 248, 249, 53, 254, 27, 6, 229, 7, 129, 207, 208, 209, 228, 245, 7, 20, 20, 112, 112, 220, 221, 241, 7, 25, 240, 123, 149, 150, 151, 245, 34, 34, 7, 192, 37, 37, 191, 11, 12, 21, 25, 40, 41, 42, 43, 54, 55, 59, 107, 108, 114, 188, 189, 251, 261, 262, 263, 264, 265, 266, 269, 270, 271, 272, 274, 277, 278, 279, 280, 284, 286, 291, 64, 65, 160, 193, 228, 36, 189, 37, 208, 37, 208, 183, 36, 24, 32, 256, 284, 254, 284, 254, 27, 111, 247, 185, 246, 186, 246, 248, 208, 248, 12, 249, 187, 224, 250, 291, 23, 35, 252, 8, 37, 32, 6, 12, 20, 242, 244, 247, 172, 166, 20, 20, 32, 175, 222, 32, 238, 245, 37, 32, 228, 235, 236, 235, 161, 36, 261, 273, 262, 281, 12, 262, 12, 12, 12, 252, 273, 14, 33, 39, 266, 269, 265, 267, 268, 274, 274, 31, 10, 11, 26, 28, 29, 30, 31, 38, 270, 276, 12, 280, 12, 7, 7, 34, 190, 36, 37, 37, 37, 27, 27, 36, 252, 27, 37, 37, 37, 208, 31, 257, 27, 192, 129, 245, 244, 6, 12, 249, 7, 34, 215, 215, 168, 170, 221, 7, 34, 223, 25, 35, 7, 151, 237, 241, 35, 236, 35, 34, 31, 36, 256, 37, 282, 283, 286, 262, 275, 111, 261, 20, 228, 261, 44, 64, 65, 66, 203, 204, 229, 261, 252, 262, 264, 264, 269, 265, 265, 284, 289, 284, 36, 275, 284, 289, 274, 260, 261, 275, 194, 7, 27, 27, 51, 37, 258, 259, 289, 163, 37, 208, 35, 178, 179, 216, 215, 215, 58, 217, 218, 7, 32, 194, 289, 31, 261, 32, 31, 32, 37, 262, 32, 37, 37, 37, 229, 32, 37, 269, 36, 37, 37, 60, 105, 195, 196, 27, 26, 32, 34, 37, 7, 32, 35, 35, 159, 228, 219, 35, 241, 196, 289, 283, 66, 199, 228, 262, 51, 261, 204, 197, 198, 286, 228, 49, 200, 289, 289, 196, 179, 7, 241, 280, 200, 199, 262, 37, 7, 32, 31, 46, 190, 260, 106, 201, 201, 12, 201, 198, 199, 261, 7, 7, 260, 61, 202, 47, 210, 260, 202, 46, 7, 45, 63, 203, 52, 205, 34, 205, 37, 205, 261, 7, 7, 7, 260, 48, 206, 12, 25, 211, 212, 285, 286, 35, 206, 7, 260, 35, 211, 6, 7, 8, 35, 12, 33, 35, 7, 7, 37, 35, 211, 211, 3, 12, 37, 213, 214, 278, 285, 286, 25, 285, 214, 214, 32, 37, 3, 12, 12, 37, 214, 214, 37, 213, 37, 213, 37, 37 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: { lhExternals ((yyvsp[(1) - (1)].interfacelist)); ;} break; case 3: { interfaceNodeList_free ((yyvsp[(1) - (3)].interfacelist)); interfaceNodeList_free ((yyvsp[(3) - (3)].interfacelist)); ;} break; case 4: { (yyval.interfacelist) = interfaceNodeList_new (); ;} break; case 5: { (yyval.interfacelist) = interfaceNodeList_addh ((yyvsp[(1) - (2)].interfacelist), (yyvsp[(2) - (2)].iface));;} break; case 8: { (yyval.interfacelist) = interfaceNodeList_new (); ;} break; case 9: { (yyval.interfacelist) = consInterfaceNode ((yyvsp[(1) - (2)].iface), (yyvsp[(2) - (2)].interfacelist));;} break; case 10: { (yyval.interfacelist) = consInterfaceNode ((yyvsp[(1) - (2)].iface), (yyvsp[(2) - (2)].interfacelist));;} break; case 11: { (yyval.interfacelist) = interfaceNodeList_new (); ;} break; case 12: { (yyval.interfacelist) = interfaceNodeList_addh ((yyvsp[(1) - (2)].interfacelist), (yyvsp[(2) - (2)].iface));;} break; case 16: { (yyval.iface) = makeInterfaceNodeImports ((yyvsp[(2) - (3)].importlist)); /* assume subspecs are already processed, symbol table info in external file */ ;} break; case 17: { (yyval.iface) = makeInterfaceNodeUses ((yyvsp[(2) - (3)].traitreflist)); readlsignatures ((yyval.iface));;} break; case 18: { declareConstant ((yyvsp[(1) - (1)].constdeclaration)); (yyval.iface) = interfaceNode_makeConst ((yyvsp[(1) - (1)].constdeclaration)); ;} break; case 19: { declareVar ((yyvsp[(1) - (1)].vardeclaration)); (yyval.iface) = interfaceNode_makeVar ((yyvsp[(1) - (1)].vardeclaration)); ;} break; case 20: { declareType ((yyvsp[(1) - (1)].type)); (yyval.iface) = interfaceNode_makeType ((yyvsp[(1) - (1)].type)); ;} break; case 21: { declareFcn ((yyvsp[(1) - (1)].fcn), typeId_invalid); (yyval.iface) = interfaceNode_makeFcn ((yyvsp[(1) - (1)].fcn)); ;} break; case 22: { (yyval.iface) = interfaceNode_makeClaim ((yyvsp[(1) - (1)].claim)); ;} break; case 23: { declareIter ((yyvsp[(1) - (1)].iter)); (yyval.iface) = interfaceNode_makeIter ((yyvsp[(1) - (1)].iter)); ;} break; case 24: { (yyval.iter) = makeIterNode ((yyvsp[(2) - (6)].ltok), (yyvsp[(4) - (6)].paramlist)); ;} break; case 25: { (yyval.paramlist) = paramNodeList_new (); ;} break; case 26: { (yyval.paramlist) = (yyvsp[(1) - (1)].paramlist); ;} break; case 27: { (yyval.paramlist) = paramNodeList_add (paramNodeList_new (), (yyvsp[(1) - (1)].param)); ;} break; case 28: { (yyval.paramlist) = paramNodeList_add ((yyvsp[(1) - (3)].paramlist),(yyvsp[(3) - (3)].param)); ;} break; case 29: { (yyval.param) = markYieldParamNode ((yyvsp[(2) - (2)].param)); ;} break; case 30: { (yyval.param) = (yyvsp[(1) - (1)].param); ;} break; case 31: { symtable_export (g_symtab, FALSE); ;} break; case 32: { (yyval.iface) = (yyvsp[(3) - (3)].iface); symtable_export (g_symtab, TRUE); ;} break; case 33: { declarePrivConstant ((yyvsp[(1) - (1)].constdeclaration)); (yyval.iface) = interfaceNode_makePrivConst ((yyvsp[(1) - (1)].constdeclaration)); ;} break; case 34: { declarePrivVar ((yyvsp[(1) - (1)].vardeclaration)); (yyval.iface) = interfaceNode_makePrivVar ((yyvsp[(1) - (1)].vardeclaration)); ;} break; case 35: { declarePrivType ((yyvsp[(1) - (1)].type)); (yyval.iface) = interfaceNode_makePrivType ((yyvsp[(1) - (1)].type)); ;} break; case 36: { declarePrivFcn ((yyvsp[(1) - (1)].fcn), typeId_invalid); (yyval.iface) = interfaceNode_makePrivFcn ((yyvsp[(1) - (1)].fcn)); ;} break; case 37: { (yyval.constdeclaration) = makeConstDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls)); ;} break; case 38: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].initdecls), FALSE, FALSE); (yyval.vardeclaration)->qualifier = QLF_NONE; ;} break; case 39: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls), FALSE, FALSE); (yyval.vardeclaration)->qualifier = QLF_CONST; ;} break; case 40: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls), FALSE, FALSE); (yyval.vardeclaration)->qualifier = QLF_VOLATILE; ;} break; case 41: { (yyval.type) = makeAbstractTypeNode ((yyvsp[(1) - (1)].abstract)); ;} break; case 42: { (yyval.type) = makeExposedTypeNode ((yyvsp[(1) - (1)].exposed)); ;} break; case 43: { (yyval.typequal) = qual_createPrintfLike (); ;} break; case 44: { (yyval.typequal) = qual_createScanfLike (); ;} break; case 45: { (yyval.typequal) = qual_createMessageLike (); ;} break; case 46: { enteringFcnScope ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].declare), (yyvsp[(3) - (3)].globals)); ;} break; case 47: { (yyval.fcn) = makeFcnNode (qual_createUnknown (), (yyvsp[(1) - (13)].lcltypespec), (yyvsp[(2) - (13)].declare), (yyvsp[(3) - (13)].globals), (yyvsp[(6) - (13)].vardeclarationlist), (yyvsp[(7) - (13)].letdecls), (yyvsp[(8) - (13)].lclpredicate), (yyvsp[(9) - (13)].lclpredicate), (yyvsp[(10) - (13)].modify), (yyvsp[(11) - (13)].lclpredicate), (yyvsp[(12) - (13)].lclpredicate)); /* type, declarator, glovbls, privateinits, lets, checks, requires, modifies, ensures, claims */ symtable_exitScope (g_symtab); ;} break; case 48: { enteringFcnScope ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].declare), (yyvsp[(4) - (4)].globals)); ;} break; case 49: { (yyval.fcn) = makeFcnNode ((yyvsp[(1) - (14)].typequal), (yyvsp[(2) - (14)].lcltypespec), (yyvsp[(3) - (14)].declare), (yyvsp[(4) - (14)].globals), (yyvsp[(7) - (14)].vardeclarationlist), (yyvsp[(8) - (14)].letdecls), (yyvsp[(9) - (14)].lclpredicate), (yyvsp[(10) - (14)].lclpredicate), (yyvsp[(11) - (14)].modify), (yyvsp[(12) - (14)].lclpredicate), (yyvsp[(13) - (14)].lclpredicate)); /* type, declarator, glovbls, privateinits, lets, checks, requires, modifies, ensures, claims */ symtable_exitScope (g_symtab); ;} break; case 50: { enteringClaimScope ((yyvsp[(4) - (6)].paramlist), (yyvsp[(6) - (6)].globals)); ;} break; case 51: { (yyval.claim) = makeClaimNode ((yyvsp[(2) - (13)].ltok), (yyvsp[(4) - (13)].paramlist), (yyvsp[(6) - (13)].globals), (yyvsp[(9) - (13)].letdecls), (yyvsp[(10) - (13)].lclpredicate), (yyvsp[(11) - (13)].program), (yyvsp[(12) - (13)].lclpredicate)); symtable_exitScope (g_symtab); ;} break; case 52: { (yyval.claim) = (claimNode) 0; ;} break; case 53: {g_inTypeDef = TRUE; ;} break; case 54: {g_inTypeDef = FALSE; ;} break; case 55: { (yyval.abstract) = makeAbstractNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(4) - (6)].ltok), TRUE, FALSE, (yyvsp[(6) - (6)].abstbody)); ;} break; case 56: {g_inTypeDef = TRUE; ;} break; case 57: {g_inTypeDef = FALSE; ;} break; case 58: { (yyval.abstract) = makeAbstractNode ((yyvsp[(1) - (7)].ltok), (yyvsp[(5) - (7)].ltok), TRUE, TRUE, (yyvsp[(7) - (7)].abstbody)); ;} break; case 59: {g_inTypeDef = TRUE; ;} break; case 60: {g_inTypeDef = FALSE; ;} break; case 61: { (yyval.abstract) = makeAbstractNode ((yyvsp[(2) - (7)].ltok), (yyvsp[(5) - (7)].ltok), TRUE, TRUE, (yyvsp[(7) - (7)].abstbody)); ;} break; case 62: {g_inTypeDef = TRUE; ;} break; case 63: {g_inTypeDef = FALSE; ;} break; case 64: { (yyval.abstract) = makeAbstractNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(4) - (6)].ltok), FALSE, FALSE, (yyvsp[(6) - (6)].abstbody)); ;} break; case 65: { g_inTypeDef = TRUE; setExposedType ((yyvsp[(2) - (2)].lcltypespec)); ;} break; case 66: { g_inTypeDef = FALSE; ;} break; case 67: { (yyval.exposed) = makeExposedNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(2) - (6)].lcltypespec), (yyvsp[(4) - (6)].declaratorinvs)); /* to support mutually recursive types */ ;} break; case 68: { (yyval.exposed) = makeExposedNode ((yyvsp[(2) - (2)].ltok), makeLclTypeSpecNodeSU ((yyvsp[(1) - (2)].structorunion)), declaratorInvNodeList_new ()); ;} break; case 69: { (yyval.exposed) = makeExposedNode ((yyvsp[(2) - (2)].ltok), makeLclTypeSpecNodeEnum ((yyvsp[(1) - (2)].enumspec)), declaratorInvNodeList_new ()); ;} break; case 70: { (yyval.importlist) = importNodeList_add (importNodeList_new (), (yyvsp[(1) - (1)].import)); ;} break; case 71: { (yyval.importlist) = importNodeList_add ((yyvsp[(1) - (3)].importlist), (yyvsp[(3) - (3)].import)); ;} break; case 72: { (yyval.import) = importNode_makePlain ((yyvsp[(1) - (1)].ltok)); ;} break; case 73: { checkBrackets ((yyvsp[(1) - (3)].ltok), (yyvsp[(3) - (3)].ltok)); (yyval.import) = importNode_makeBracketed ((yyvsp[(2) - (3)].ltok)); ;} break; case 74: { (yyval.import) = importNode_makeQuoted ((yyvsp[(1) - (1)].ltok)); ;} break; case 75: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 76: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 78: { (yyval.traitreflist) = traitRefNodeList_add (traitRefNodeList_new (), (yyvsp[(1) - (1)].traitref)); ;} break; case 79: { (yyval.traitreflist) = traitRefNodeList_add ((yyvsp[(1) - (3)].traitreflist), (yyvsp[(3) - (3)].traitref)); ;} break; case 80: { (yyval.traitref) = makeTraitRefNode (ltokenList_singleton ((yyvsp[(1) - (1)].ltok)), (renamingNode)0); ;} break; case 81: { (yyval.traitref) = makeTraitRefNode (ltokenList_singleton ((yyvsp[(1) - (4)].ltok)), (yyvsp[(3) - (4)].renaming)); ;} break; case 82: { (yyval.traitref) = makeTraitRefNode ((yyvsp[(2) - (3)].ltokenList), (renamingNode)0); ;} break; case 83: { (yyval.traitref) = makeTraitRefNode ((yyvsp[(2) - (6)].ltokenList), (yyvsp[(5) - (6)].renaming)); ;} break; case 84: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 85: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 86: { (yyval.renaming) = makeRenamingNode (typeNameNodeList_new (), (yyvsp[(1) - (1)].replacelist)); ;} break; case 87: { (yyval.renaming) = makeRenamingNode ((yyvsp[(1) - (1)].namelist), replaceNodeList_new ()); ;} break; case 88: { (yyval.renaming) = makeRenamingNode ((yyvsp[(1) - (3)].namelist), (yyvsp[(3) - (3)].replacelist)); ;} break; case 89: { (yyval.namelist) = typeNameNodeList_add (typeNameNodeList_new (), (yyvsp[(1) - (1)].typname)); ;} break; case 90: { (yyval.namelist) = typeNameNodeList_add ((yyvsp[(1) - (3)].namelist), (yyvsp[(3) - (3)].typname)); ;} break; case 91: { (yyval.replacelist) = replaceNodeList_add (replaceNodeList_new (), (yyvsp[(1) - (1)].replace)); ;} break; case 92: { (yyval.replacelist) = replaceNodeList_add ((yyvsp[(1) - (3)].replacelist), (yyvsp[(3) - (3)].replace)); ;} break; case 93: { (yyval.replace) = makeReplaceNode ((yyvsp[(2) - (3)].ltok), (yyvsp[(1) - (3)].typname), TRUE, (yyvsp[(3) - (3)].ltok), NULL, NULL); ;} break; case 94: { (yyval.replace) = makeReplaceNameNode ((yyvsp[(2) - (3)].ltok), (yyvsp[(1) - (3)].typname), (yyvsp[(3) - (3)].name)); ;} break; case 95: { (yyval.replace) = makeReplaceNode ((yyvsp[(2) - (4)].ltok), (yyvsp[(1) - (4)].typname), FALSE, ltoken_undefined, (yyvsp[(3) - (4)].name), (yyvsp[(4) - (4)].signature)); ;} break; case 96: { (yyval.name) = makeNameNodeId ((yyvsp[(1) - (1)].ltok)); ;} break; case 97: { (yyval.name) = makeNameNodeForm ((yyvsp[(1) - (1)].opform)); ;} break; case 100: { (yyval.initdecls) = initDeclNodeList_add (initDeclNodeList_new (), (yyvsp[(1) - (1)].initdecl)); ;} break; case 101: { (yyval.initdecls) = initDeclNodeList_add ((yyvsp[(1) - (3)].initdecls), (yyvsp[(3) - (3)].initdecl)); ;} break; case 102: { (yyval.initdecl) = makeInitDeclNode ((yyvsp[(1) - (1)].declare), (termNode)0); ;} break; case 103: { (yyval.initdecl) = makeInitDeclNode ((yyvsp[(1) - (3)].declare), (yyvsp[(3) - (3)].term)); ;} break; case 104: { (yyval.globals) = varDeclarationNodeList_new (); ;} break; case 105: { varDeclarationNodeList_addh ((yyvsp[(1) - (2)].globals), (yyvsp[(2) - (2)].vardeclaration)); (yyval.globals) = (yyvsp[(1) - (2)].globals); ;} break; case 106: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].initdecls), TRUE, FALSE); ;} break; case 107: { (yyval.vardeclaration) = makeInternalStateNode (); ;} break; case 108: { (yyval.vardeclaration) = makeFileSystemNode (); ;} break; case 109: { (yyval.vardeclarationlist) = varDeclarationNodeList_new (); ;} break; case 110: { varDeclarationNodeList_addh ((yyvsp[(1) - (2)].vardeclarationlist), (yyvsp[(2) - (2)].vardeclaration)); (yyval.vardeclarationlist) = (yyvsp[(1) - (2)].vardeclarationlist); ;} break; case 111: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls), FALSE, TRUE); ;} break; case 112: { (yyval.letdecls) = letDeclNodeList_new (); ;} break; case 113: { (yyval.letdecls) = (yyvsp[(2) - (3)].letdecls); ;} break; case 114: { (yyval.letdecls) = letDeclNodeList_add (letDeclNodeList_new (), (yyvsp[(1) - (1)].letdecl)); ;} break; case 115: { (yyval.letdecls) = letDeclNodeList_add ((yyvsp[(1) - (3)].letdecls), (yyvsp[(3) - (3)].letdecl)); ;} break; case 116: { (yyval.letdecl) = makeLetDeclNode ((yyvsp[(1) - (5)].ltok), (yyvsp[(3) - (5)].lcltypespec), (yyvsp[(5) - (5)].term)); ;} break; case 117: { (yyval.letdecl) = makeLetDeclNode ((yyvsp[(1) - (3)].ltok), (lclTypeSpecNode)0, (yyvsp[(3) - (3)].term)); ;} break; case 119: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 120: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeChecksNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); ;} break; case 121: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 122: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeRequiresNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate));;} break; case 123: { (yyval.modify) = (modifyNode)0; ;} break; case 124: { (yyval.modify) = makeModifyNodeSpecial ((yyvsp[(1) - (3)].ltok), TRUE); ;} break; case 125: { (yyval.modify) = makeModifyNodeSpecial ((yyvsp[(1) - (3)].ltok), FALSE); ;} break; case 126: { (yyval.modify) = makeModifyNodeRef ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].storereflist)); ;} break; case 127: { (yyval.storereflist) = storeRefNodeList_add (storeRefNodeList_new (), (yyvsp[(1) - (1)].storeref)); ;} break; case 128: { (yyval.storereflist) = storeRefNodeList_add ((yyvsp[(1) - (3)].storereflist), (yyvsp[(3) - (3)].storeref)); ;} break; case 129: { (yyval.storeref) = makeStoreRefNodeTerm ((yyvsp[(1) - (1)].term)); ;} break; case 130: { (yyval.storeref) = makeStoreRefNodeType ((yyvsp[(1) - (1)].lcltypespec), FALSE); ;} break; case 131: { (yyval.storeref) = makeStoreRefNodeType ((yyvsp[(2) - (2)].lcltypespec), TRUE); ;} break; case 132: { (yyval.storeref) = makeStoreRefNodeInternal (); ;} break; case 133: { (yyval.storeref) = makeStoreRefNodeSystem (); ;} break; case 134: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 135: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeEnsuresNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate));;} break; case 136: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 137: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeIntraClaimNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate));;} break; case 138: { (yyval.paramlist) = paramNodeList_new (); ;} break; case 139: { (yyval.paramlist) = (yyvsp[(1) - (1)].paramlist); ;} break; case 141: { (yyval.paramlist) = paramNodeList_add (paramNodeList_new (), paramNode_elipsis ()); ;} break; case 142: { (yyval.paramlist) = paramNodeList_add ((yyvsp[(1) - (3)].paramlist), paramNode_elipsis ()); ;} break; case 143: { (yyval.paramlist) = paramNodeList_single ((yyvsp[(1) - (1)].param)); ;} break; case 144: { (yyval.paramlist) = paramNodeList_add ((yyvsp[(1) - (3)].paramlist), (yyvsp[(3) - (3)].param)); ;} break; case 145: { (yyval.program) = (programNode)0; ;} break; case 146: { (yyval.program) = (yyvsp[(3) - (4)].program); ;} break; case 147: { (yyval.program) = (yyvsp[(3) - (5)].program); ;} break; case 148: { (yyval.program) = makeProgramNode ((yyvsp[(1) - (1)].stmt)); ;} break; case 149: { (yyval.program) = (yyvsp[(2) - (3)].program); (yyval.program)->wrapped = (yyval.program)->wrapped + 1; ;} break; case 150: { programNodeList x = programNodeList_new (); programNodeList_addh (x, (yyvsp[(1) - (2)].program)); (yyval.program) = makeProgramNodeAction (x, ACT_ITER); ;} break; case 151: { programNodeList x = programNodeList_new (); programNodeList_addh (x, (yyvsp[(1) - (3)].program)); programNodeList_addh (x, (yyvsp[(3) - (3)].program)); (yyval.program) = makeProgramNodeAction (x, ACT_ALTERNATE); ;} break; case 152: { programNodeList x = programNodeList_new (); programNodeList_addh (x, (yyvsp[(1) - (3)].program)); programNodeList_addh (x, (yyvsp[(3) - (3)].program)); (yyval.program) = makeProgramNodeAction (x, ACT_SEQUENCE); ;} break; case 153: { (yyval.stmt) = makeStmtNode (ltoken_undefined, (yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].termlist)); ;} break; case 154: { (yyval.stmt) = makeStmtNode (ltoken_undefined, (yyvsp[(1) - (3)].ltok), termNodeList_new ()); ;} break; case 155: { (yyval.stmt) = makeStmtNode ((yyvsp[(1) - (5)].ltok), (yyvsp[(3) - (5)].ltok), termNodeList_new ()); ;} break; case 156: { (yyval.stmt) = makeStmtNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(3) - (6)].ltok), (yyvsp[(5) - (6)].termlist)); ;} break; case 157: { (yyval.termlist) = termNodeList_push (termNodeList_new (), (yyvsp[(1) - (1)].term)); ;} break; case 158: { (yyval.termlist) = termNodeList_push ((yyvsp[(1) - (3)].termlist), (yyvsp[(3) - (3)].term)); ;} break; case 160: { (yyval.term) = makeSimpleTermNode ((yyvsp[(1) - (1)].ltok)); ;} break; case 161: { (yyval.term) = makePrefixTermNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].term)); ;} break; case 162: { (yyval.term) = makePostfixTermNode2 ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].ltok)); ;} break; case 163: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term)); ;} break; case 164: { (yyval.term) = (yyvsp[(2) - (3)].term); (yyval.term)->wrapped = (yyval.term)->wrapped + 1; ;} break; case 165: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].ltok), termNodeList_new (), (yyvsp[(3) - (3)].ltok)); ;} break; case 166: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)); ;} break; case 167: { (yyval.abstbody) = (abstBodyNode)0; ;} break; case 168: { (yyval.abstbody) = makeAbstBodyNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].fcns)); ;} break; case 169: { (yyval.abstbody) = makeAbstBodyNode2 ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltokenList)); ;} break; case 170: { (yyval.abstbody) = (abstBodyNode)0; ;} break; case 171: { (yyval.fcns) = fcnNodeList_new (); ;} break; case 172: { (yyval.fcns) = fcnNodeList_add ((yyvsp[(1) - (2)].fcns), (yyvsp[(2) - (2)].fcn)); ;} break; case 173: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 175: { g_inTypeDef = FALSE; ;} break; case 176: { (yyvsp[(5) - (6)].lclpredicate)->tok = (yyvsp[(1) - (6)].ltok); (yyvsp[(5) - (6)].lclpredicate)->kind = LPD_CONSTRAINT; checkLclPredicate ((yyvsp[(1) - (6)].ltok), (yyvsp[(5) - (6)].lclpredicate)); (yyval.lclpredicate) = (yyvsp[(5) - (6)].lclpredicate); symtable_exitScope (g_symtab); g_inTypeDef = TRUE; ;} break; case 177: { (yyval.declaratorinvs) = declaratorInvNodeList_add (declaratorInvNodeList_new (), (yyvsp[(1) - (1)].declaratorinv)); ;} break; case 178: { (yyval.declaratorinvs) = declaratorInvNodeList_add ((yyvsp[(1) - (3)].declaratorinvs), (yyvsp[(3) - (3)].declaratorinv)); ;} break; case 179: { declareForwardType ((yyvsp[(1) - (1)].declare)); ;} break; case 180: { (yyval.declaratorinv) = makeDeclaratorInvNode ((yyvsp[(1) - (3)].declare), (yyvsp[(3) - (3)].abstbody)); ;} break; case 181: { (yyval.abstbody) = (abstBodyNode)0; ;} break; case 182: { (yyval.abstbody) = makeExposedBodyNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); ;} break; case 183: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_VOID, 0)); ;} break; case 184: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_CHAR, 0)); ;} break; case 185: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_DOUBLE, 0)); ;} break; case 186: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_FLOAT, 0)); ;} break; case 187: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_INT, 0)); ;} break; case 188: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_LONG, 0)); ;} break; case 189: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_SHORT, 0)); ;} break; case 190: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_SIGNED, 0)); ;} break; case 191: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_UNSIGNED, 0)); ;} break; case 192: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_UNKNOWN, 0)); ;} break; case 193: { (yyval.ctypes) = makeCTypesNode ((CTypesNode)0, (yyvsp[(1) - (1)].ltok)); ;} break; case 194: { (yyval.ctypes) = makeCTypesNode ((yyvsp[(1) - (2)].ctypes), (yyvsp[(2) - (2)].ltok)); ;} break; case 195: { (yyval.ctypes) = makeTypeSpecifier ((yyvsp[(1) - (1)].ltok)); ;} break; case 196: { (yyval.ctypes) = (yyvsp[(1) - (1)].ctypes); (yyval.ctypes)->sort = sort_lookupName (lclctype_toSort ((yyvsp[(1) - (1)].ctypes)->intfield)); ;} break; case 197: { (yyval.typequal) = qual_createOut (); ;} break; case 198: { (yyval.typequal) = qual_createUnused (); ;} break; case 199: { (yyval.typequal) = qual_createSef (); ;} break; case 200: { (yyval.typequal) = qual_createOnly (); ;} break; case 201: { (yyval.typequal) = qual_createOwned (); ;} break; case 202: { (yyval.typequal) = qual_createDependent (); ;} break; case 203: { (yyval.typequal) = qual_createKeep (); ;} break; case 204: { (yyval.typequal) = qual_createKept (); ;} break; case 205: { (yyval.typequal) = qual_createObserver (); ;} break; case 206: { (yyval.typequal) = qual_createExits (); ;} break; case 207: { (yyval.typequal) = qual_createMayExit (); ;} break; case 208: { (yyval.typequal) = qual_createTrueExit (); ;} break; case 209: { (yyval.typequal) = qual_createFalseExit (); ;} break; case 210: { (yyval.typequal) = qual_createNeverExit (); ;} break; case 211: { (yyval.typequal) = qual_createOnly (); ;} break; case 212: { (yyval.typequal) = qual_createShared (); ;} break; case 213: { (yyval.typequal) = qual_createUnique (); ;} break; case 214: { (yyval.typequal) = qual_createChecked (); ;} break; case 215: { (yyval.typequal) = qual_createUnchecked (); ;} break; case 216: { (yyval.typequal) = qual_createCheckedStrict (); ;} break; case 217: { (yyval.typequal) = qual_createTrueNull (); ;} break; case 218: { (yyval.typequal) = qual_createFalseNull (); ;} break; case 219: { (yyval.typequal) = qual_createRelNull (); ;} break; case 220: { (yyval.typequal) = qual_createRelDef (); ;} break; case 221: { (yyval.typequal) = qual_createRefCounted (); ;} break; case 222: { (yyval.typequal) = qual_createRefs (); ;} break; case 223: { (yyval.typequal) = qual_createNewRef (); ;} break; case 224: { (yyval.typequal) = qual_createKillRef (); ;} break; case 225: { (yyval.typequal) = qual_createNull (); ;} break; case 226: { (yyval.typequal) = qual_createNotNull (); ;} break; case 227: { (yyval.typequal) = qual_createReturned (); ;} break; case 228: { (yyval.typequal) = qual_createExposed (); ;} break; case 229: { (yyval.typequal) = qual_createPartial (); ;} break; case 230: { (yyval.typequal) = qual_createNullTerminated () ; ;} break; case 231: { (yyval.typequal) = qual_createUndef (); ;} break; case 232: { (yyval.typequal) = qual_createKilled (); ;} break; case 233: { (yyval.lcltypespec) = makeLclTypeSpecNodeType ((yyvsp[(1) - (1)].ctypes)); ;} break; case 234: { (yyval.lcltypespec) = makeLclTypeSpecNodeSU ((yyvsp[(1) - (1)].structorunion)); ;} break; case 235: { (yyval.lcltypespec) = makeLclTypeSpecNodeEnum ((yyvsp[(1) - (1)].enumspec)); ;} break; case 236: { (yyval.lcltypespec) = lclTypeSpecNode_addQual ((yyvsp[(2) - (2)].lcltypespec), (yyvsp[(1) - (2)].typequal)); ;} break; case 237: { (yyval.lcltypespec) = makeLclTypeSpecNodeConj ((yyvsp[(2) - (5)].lcltypespec), (yyvsp[(4) - (5)].lcltypespec)); ;} break; case 239: { llassert (lclTypeSpecNode_isDefined ((yyvsp[(1) - (2)].lcltypespec))); (yyvsp[(1) - (2)].lcltypespec)->pointers = (yyvsp[(2) - (2)].pointers); (yyval.lcltypespec) = (yyvsp[(1) - (2)].lcltypespec); ;} break; case 240: { (yyval.pointers) = pointers_createLt ((yyvsp[(1) - (1)].ltok)); ;} break; case 241: { (yyval.pointers) = pointers_extend ((yyvsp[(1) - (2)].pointers), pointers_createLt ((yyvsp[(2) - (2)].ltok))); ;} break; case 242: { (void) checkAndEnterTag (TAG_FWDSTRUCT, ltoken_copy ((yyvsp[(2) - (2)].ltok))); ;} break; case 243: { (yyval.structorunion) = makestrOrUnionNode ((yyvsp[(1) - (6)].ltok), SU_STRUCT, (yyvsp[(2) - (6)].ltok), (yyvsp[(5) - (6)].structdecls)); ;} break; case 244: { (void) checkAndEnterTag (TAG_FWDUNION, ltoken_copy ((yyvsp[(2) - (2)].ltok))); ;} break; case 245: { (yyval.structorunion) = makestrOrUnionNode ((yyvsp[(1) - (6)].ltok), SU_UNION, (yyvsp[(2) - (6)].ltok), (yyvsp[(5) - (6)].structdecls)); ;} break; case 246: { (yyval.structorunion) = makeForwardstrOrUnionNode ((yyvsp[(1) - (2)].ltok), SU_STRUCT, (yyvsp[(2) - (2)].ltok)); ;} break; case 247: { (yyval.structorunion) = makeForwardstrOrUnionNode ((yyvsp[(1) - (2)].ltok), SU_UNION, (yyvsp[(2) - (2)].ltok)); ;} break; case 248: { (yyval.ltok) = ltoken_undefined; ;} break; case 250: { (yyval.structdecls) = stDeclNodeList_add (stDeclNodeList_new (), (yyvsp[(1) - (1)].structdecl)); ;} break; case 251: { (yyval.structdecls) = stDeclNodeList_add ((yyvsp[(1) - (2)].structdecls), (yyvsp[(2) - (2)].structdecl)); ;} break; case 252: { (yyval.structdecl) = makestDeclNode ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].declarelist)); ;} break; case 253: { (yyval.declarelist) = declaratorNodeList_add (declaratorNodeList_new (), (yyvsp[(1) - (1)].declare)); ;} break; case 254: { (yyval.declarelist) = declaratorNodeList_add ((yyvsp[(1) - (3)].declarelist), (yyvsp[(3) - (3)].declare)); ;} break; case 255: { ; ;} break; case 256: { ; ;} break; case 257: { (yyval.enumspec) = makeEnumSpecNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(2) - (6)].ltok), (yyvsp[(4) - (6)].ltokenList)); ;} break; case 258: { (yyval.enumspec) = makeEnumSpecNode2 ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].ltok)); ;} break; case 259: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 260: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 261: { (yyval.declare) = makeDeclaratorNode ((yyvsp[(1) - (1)].typeexpr)); ;} break; case 262: { (yyval.declare) = makeDeclaratorNode ((yyvsp[(1) - (1)].typeexpr)); ;} break; case 263: { (yyval.typeexpr) = makeTypeExpr ((yyvsp[(1) - (1)].ltok)); ;} break; case 264: { (yyval.typeexpr) = (yyvsp[(2) - (3)].typeexpr); (yyval.typeexpr)->wrapped = (yyval.typeexpr)->wrapped + 1; ;} break; case 265: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 266: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 267: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 268: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 269: { (yyval.typeexpr) = makeTypeExpr ((yyvsp[(1) - (1)].ltok)); ;} break; case 270: { (yyval.typeexpr) = (yyvsp[(2) - (3)].typeexpr); (yyval.typeexpr)->wrapped = (yyval.typeexpr)->wrapped + 1; ;} break; case 271: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 272: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 273: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 274: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 275: { (yyval.typeexpr) = makeTypeExpr ((yyvsp[(1) - (1)].ltok)); ;} break; case 276: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 277: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 278: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 279: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 280: { (yyval.param) = makeParamNode ((yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 281: { (yyval.param) = makeParamNode ((yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 282: { (yyval.param) = makeParamNode ((yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].abstDecl)); ;} break; case 283: { (yyval.typname) = makeTypeNameNode (FALSE, (yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].abstDecl)); ;} break; case 284: { (yyval.typname) = makeTypeNameNode (TRUE, (yyvsp[(2) - (3)].lcltypespec), (yyvsp[(3) - (3)].abstDecl)); ;} break; case 285: { (yyval.typname) = makeTypeNameNodeOp ((yyvsp[(1) - (1)].opform)); ;} break; case 286: { (yyval.abstDecl) = (abstDeclaratorNode)0; ;} break; case 287: { (yyval.abstDecl) = (abstDeclaratorNode)(yyvsp[(1) - (1)].typeexpr); ;} break; case 288: { (yyval.typeexpr) = (yyvsp[(2) - (3)].typeexpr); (yyval.typeexpr)->wrapped = (yyval.typeexpr)->wrapped + 1; ;} break; case 289: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 290: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (1)].ltok), (typeExpr)0); ;} break; case 291: { (yyval.typeexpr) = makeArrayNode ((typeExpr)0, (yyvsp[(1) - (1)].array)); ;} break; case 292: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 293: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 294: { (yyval.typeexpr) = makeFunctionNode ((typeExpr)0, (yyvsp[(2) - (3)].paramlist)); ;} break; case 295: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 296: { (yyval.array) = makeArrayQualNode ((yyvsp[(1) - (2)].ltok), (termNode)0); ;} break; case 297: { (yyval.array) = makeArrayQualNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].term)); ;} break; case 298: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (6)].ltok), OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ;} break; case 299: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (1)].ltok), OPF_ANYOP, opFormUnion_createAnyOp ((yyvsp[(1) - (1)].ltok)), ltoken_undefined); ;} break; case 300: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_MANYOP, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 301: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_ANYOPM, opFormUnion_createAnyOp ((yyvsp[(1) - (2)].ltok)), ltoken_undefined); ;} break; case 302: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MANYOPM, opFormUnion_createAnyOp ((yyvsp[(2) - (3)].ltok)), ltoken_undefined); ;} break; case 303: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 304: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_MMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 305: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_MIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 306: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_MMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 307: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_BMIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 308: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_BMIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 309: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (4)].ltok), OPF_BMMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 310: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_BMMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 311: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_SELECT, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 312: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_MAP, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 313: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MSELECT, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 314: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MMAP, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 322: { (yyval.count) = 0; ;} break; case 324: { (yyval.count) = 1; ;} break; case 325: { (yyval.count) = (yyvsp[(1) - (3)].count) + 1; ;} break; case 328: { (yyval.signature) = makesigNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltokenList), (yyvsp[(4) - (4)].ltok)); ;} break; case 329: { (yyval.ltokenList) = ltokenList_new (); ;} break; case 331: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 332: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 333: { (yyval.lclpredicate) = makeLclPredicateNode (ltoken_undefined, (yyvsp[(1) - (1)].term), LPD_PLAIN);;} break; case 334: { (yyval.term) = checkSort ((yyvsp[(1) - (1)].term)); ;} break; case 335: { (yyval.term) = makeIfTermNode ((yyvsp[(1) - (6)].ltok),(yyvsp[(2) - (6)].term),(yyvsp[(3) - (6)].ltok),(yyvsp[(4) - (6)].term),(yyvsp[(5) - (6)].ltok),(yyvsp[(6) - (6)].term)); ;} break; case 337: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term)); ;} break; case 339: { checkLclPredicate ((yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].lclpredicate)); (yyval.term) = makeQuantifiedTermNode ((yyvsp[(1) - (4)].quantifiers), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].lclpredicate)->predicate, (yyvsp[(4) - (4)].ltok)); symtable_exitScope (g_symtab); ;} break; case 340: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term));;} break; case 341: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term));;} break; case 343: { (yyval.term) = makePostfixTermNode ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].ltokenList)); ;} break; case 344: { (yyval.term) = CollapseInfixTermNode ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].termlist)); ;} break; case 348: { (yyval.term) = makePrefixTermNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].term)); ;} break; case 349: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 350: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (2)].ltokenList), (yyvsp[(2) - (2)].ltok)); ;} break; case 351: { (yyval.termlist) = pushInfixOpPartNode (termNodeList_new (), (yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].term)); ;} break; case 352: { (yyval.termlist) = pushInfixOpPartNode ((yyvsp[(1) - (3)].termlist), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term)); ;} break; case 354: { (yyval.term) = computePossibleSorts ((yyvsp[(1) - (1)].term)); ;} break; case 355: { (yyval.term) = updateMatchedNode ((termNode)0, (yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].term)); ;} break; case 356: { (yyval.term) = updateMatchedNode ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].term), (termNode)0); ;} break; case 357: { (yyval.term) = updateMatchedNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].term), (yyvsp[(3) - (3)].term)); ;} break; case 358: { (yyval.term) = computePossibleSorts ((yyvsp[(1) - (1)].term)); ;} break; case 359: { (yyval.term) = updateSqBracketedNode ((termNode)0, (yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].term)); ;} break; case 360: { (yyval.term) = (yyvsp[(1) - (3)].term); (yyval.term)->sort = sort_lookupName (ltoken_getText ((yyvsp[(3) - (3)].ltok))); ;} break; case 362: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (5)].ltok), (yyvsp[(2) - (5)].termlist), (yyvsp[(3) - (5)].ltok)); (yyval.term)->given = sort_lookupName (ltoken_getText ((yyvsp[(5) - (5)].ltok))); ;} break; case 363: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].termlist), (yyvsp[(3) - (3)].ltok)); ;} break; case 364: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (4)].ltok), termNodeList_new (), (yyvsp[(2) - (4)].ltok)); (yyval.term)->given = sort_lookupName (ltoken_getText ((yyvsp[(4) - (4)].ltok))); ;} break; case 365: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (2)].ltok), termNodeList_new (), (yyvsp[(2) - (2)].ltok)); ;} break; case 366: { (yyval.term) = makeMatchedNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].termlist), (yyvsp[(3) - (3)].ltok)); ;} break; case 367: { (yyval.term) = makeMatchedNode ((yyvsp[(1) - (2)].ltok), termNodeList_new (), (yyvsp[(2) - (2)].ltok)); ;} break; case 368: { (yyval.termlist) = termNodeList_push (termNodeList_new (), (yyvsp[(1) - (1)].term)); ;} break; case 369: { (yyval.termlist) = termNodeList_push ((yyvsp[(1) - (3)].termlist), (yyvsp[(3) - (3)].term)); ;} break; case 370: { (yyval.term) = (yyvsp[(2) - (3)].term); (yyval.term)->wrapped = (yyval.term)->wrapped + 1; ;} break; case 371: { (yyval.term) = makeSimpleTermNode ((yyvsp[(1) - (1)].ltok)); ;} break; case 372: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)); ;} break; case 374: { (yyval.term) = makePostfixTermNode2 ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].ltok)); ;} break; case 375: { ltoken_markOwned ((yyvsp[(3) - (3)].ltok)); (yyval.term) = makeSelectTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].ltok)); ;} break; case 376: { ltoken_markOwned ((yyvsp[(3) - (3)].ltok)); (yyval.term) = makeMapTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].ltok)); ;} break; case 377: { (yyval.term) = updateSqBracketedNode ((yyvsp[(1) - (3)].term), makeSqBracketedNode ((yyvsp[(2) - (3)].ltok), termNodeList_new (), (yyvsp[(3) - (3)].ltok)), (termNode)0); ;} break; case 378: { (yyval.term) = updateSqBracketedNode ((yyvsp[(1) - (4)].term), makeSqBracketedNode ((yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)), (termNode)0); ;} break; case 379: { (yyval.term) = (yyvsp[(1) - (3)].term); (yyval.term)->given = sort_lookupName (ltoken_getText ((yyvsp[(3) - (3)].ltok))); ;} break; case 380: { (yyval.termlist) = termNodeList_push (termNodeList_new (), (yyvsp[(1) - (1)].term)); ;} break; case 381: { (yyval.termlist) = termNodeList_push ((yyvsp[(1) - (3)].termlist), (yyvsp[(3) - (3)].term)); ;} break; case 387: { (yyval.term) = makeSimpleTermNode ((yyvsp[(1) - (1)].ltok)); ;} break; case 388: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)); ;} break; case 389: { (yyval.term) = makeUnchangedTermNode1 ((yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].ltok)); ;} break; case 390: { (yyval.term) = makeUnchangedTermNode2 ((yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].storereflist)); ;} break; case 391: { termNodeList x = termNodeList_new (); termNodeList_addh (x, (yyvsp[(3) - (4)].term)); (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), x, (yyvsp[(4) - (4)].ltok)); ;} break; case 392: { termNodeList x = termNodeList_new (); termNodeList_addh (x, (yyvsp[(3) - (6)].term)); termNodeList_addh (x, (yyvsp[(5) - (6)].term)); (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(2) - (6)].ltok), x, (yyvsp[(6) - (6)].ltok)); ;} break; case 393: { (yyval.term) = makeSizeofTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].lcltypespec)); ;} break; case 394: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortInt); ;} break; case 395: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortCstring); ;} break; case 396: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortChar); ;} break; case 397: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortDouble); ;} break; case 398: { (yyval.quantifiers) = quantifierNodeList_add (quantifierNodeList_new (), (yyvsp[(1) - (1)].quantifier)); ;} break; case 399: { (yyval.quantifiers) = quantifierNodeList_add ((yyvsp[(1) - (2)].quantifiers), (yyvsp[(2) - (2)].quantifier)); ;} break; case 400: { scopeInfo si = (scopeInfo) dmalloc (sizeof (*si)); si->kind = SPE_QUANT; symtable_enterScope (g_symtab, si); ;} break; case 401: { (yyval.quantifier) = makeQuantifierNode ((yyvsp[(3) - (3)].vars), (yyvsp[(1) - (3)].ltok)); ;} break; case 402: { (yyval.vars) = varNodeList_add (varNodeList_new (), (yyvsp[(1) - (1)].var)); ;} break; case 403: { (yyval.vars) = varNodeList_add ((yyvsp[(1) - (3)].vars), (yyvsp[(3) - (3)].var)); ;} break; case 404: { (yyval.var) = makeVarNode ((yyvsp[(1) - (3)].ltok), FALSE, (yyvsp[(3) - (3)].lcltypespec)); ;} break; case 405: { (yyval.var) = makeVarNode ((yyvsp[(1) - (4)].ltok), TRUE, (yyvsp[(4) - (4)].lcltypespec)); ;} break; /* Line 1267 of yacc.c. */ default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } # include "bison.reset" /* ** yytext is set in lex scanner ** extern YYSTYPE yylval; ** yylval is defined by code generated by bison */ void ylerror (char *s) { /* ** This resetting of the left context is very important when multiple ** files are to be parsed. We do not want failures to propagate. ** Lex/Yacc does not reset the flags when the parsing goes bad. ** BEGIN 0; **/ /*@-mustfree@*/ lclfatalerror (yllval.ltok, message ("%s: Token code: %s, Token String: %s", cstring_fromChars (s), ltoken_unparseCodeName (yllval.ltok), ltoken_getRawString (yllval.ltok))); /*@=mustfree@*/ } static void yyprint (FILE *f, int t, YYSTYPE value) { fprintf (f, " type: %d (%s)", t, cstring_toCharsSafe (ltoken_getRawString (value.ltok))); } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/signature.c0000644021234200000250000016121310645776225014421 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse lslparse #define yylex lsllex #define yyerror lslerror #define yylval lsllval #define yychar lslchar #define yydebug lsldebug #define yynerrs lslnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { LST_SIMPLEID = 258, LST_LOGICALOP = 259, LST_EQOP = 260, LST_SIMPLEOP = 261, LST_MAPSYM = 262, LST_FIELDMAPSYM = 263, LST_MARKERSYM = 264, LST_ifTOKEN = 265, LST_thenTOKEN = 266, LST_elseTOKEN = 267, LST_LBRACKET = 268, LST_RBRACKET = 269, LST_SELECTSYM = 270, LST_SEPSYM = 271, LST_OPENSYM = 272, LST_CLOSESYM = 273, LST_COLON = 274, LST_COMMA = 275, LST_EOL = 276, LST_COMMENTSYM = 277, LST_WHITESPACE = 278, LST_QUANTIFIERSYM = 279, LST_EQUATIONSYM = 280, LST_EQSEPSYM = 281, LST_COMPOSESYM = 282, LST_LPAR = 283, LST_RPAR = 284, LST_assertsTOKEN = 285, LST_assumesTOKEN = 286, LST_byTOKEN = 287, LST_convertsTOKEN = 288, LST_enumerationTOKEN = 289, LST_equationsTOKEN = 290, LST_exemptingTOKEN = 291, LST_forTOKEN = 292, LST_generatedTOKEN = 293, LST_impliesTOKEN = 294, LST_includesTOKEN = 295, LST_introducesTOKEN = 296, LST_ofTOKEN = 297, LST_partitionedTOKEN = 298, LST_traitTOKEN = 299, LST_tupleTOKEN = 300, LST_unionTOKEN = 301, LST_BADTOKEN = 302 }; #endif /* Tokens. */ #define LST_SIMPLEID 258 #define LST_LOGICALOP 259 #define LST_EQOP 260 #define LST_SIMPLEOP 261 #define LST_MAPSYM 262 #define LST_FIELDMAPSYM 263 #define LST_MARKERSYM 264 #define LST_ifTOKEN 265 #define LST_thenTOKEN 266 #define LST_elseTOKEN 267 #define LST_LBRACKET 268 #define LST_RBRACKET 269 #define LST_SELECTSYM 270 #define LST_SEPSYM 271 #define LST_OPENSYM 272 #define LST_CLOSESYM 273 #define LST_COLON 274 #define LST_COMMA 275 #define LST_EOL 276 #define LST_COMMENTSYM 277 #define LST_WHITESPACE 278 #define LST_QUANTIFIERSYM 279 #define LST_EQUATIONSYM 280 #define LST_EQSEPSYM 281 #define LST_COMPOSESYM 282 #define LST_LPAR 283 #define LST_RPAR 284 #define LST_assertsTOKEN 285 #define LST_assumesTOKEN 286 #define LST_byTOKEN 287 #define LST_convertsTOKEN 288 #define LST_enumerationTOKEN 289 #define LST_equationsTOKEN 290 #define LST_exemptingTOKEN 291 #define LST_forTOKEN 292 #define LST_generatedTOKEN 293 #define LST_impliesTOKEN 294 #define LST_includesTOKEN 295 #define LST_introducesTOKEN 296 #define LST_ofTOKEN 297 #define LST_partitionedTOKEN 298 #define LST_traitTOKEN 299 #define LST_tupleTOKEN 300 #define LST_unionTOKEN 301 #define LST_BADTOKEN 302 /* Copy the first part of user declarations. */ # include # include "splintMacros.nf" # include "basic.h" # include "lslparse.h" # include "signature.h" static void lslerror (char *); extern int lsllex (); /*@dependent@*/ /*@null@*/ lslOp importedlslOp; /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); /*@=noparams@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) # define YYDEBUG 1 /*@-redef@*/ /*@-readonlytrans@*/ /*@-nullassign@*/ /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { ltoken ltok; /* a leaf is also an ltoken */ unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ opFormNode opform; /*@owned@*/ sigNode signature; /*@only@*/ nameNode name; /*@owned@*/ lslOp operator; /*@only@*/ lslOpList operators; /*@-redef@*/ /*@-matchfields@*/ } /* Line 193 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 28 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 54 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 48 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 15 /* YYNRULES -- Number of rules. */ #define YYNRULES 39 /* YYNRULES -- Number of states. */ #define YYNSTATES 62 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 302 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 7, 10, 14, 16, 18, 25, 27, 30, 33, 37, 41, 46, 51, 57, 61, 66, 71, 77, 80, 84, 88, 90, 92, 94, 95, 97, 99, 103, 105, 107, 111, 112, 114, 116, 120, 122 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 49, 0, -1, 50, -1, 51, -1, 50, 51, -1, 52, 19, 58, -1, 62, -1, 53, -1, 10, 9, 11, 9, 12, 9, -1, 54, -1, 9, 54, -1, 54, 9, -1, 9, 54, 9, -1, 17, 55, 18, -1, 9, 17, 55, 18, -1, 17, 55, 18, 9, -1, 9, 17, 55, 18, 9, -1, 13, 55, 14, -1, 9, 13, 55, 14, -1, 13, 55, 14, 9, -1, 9, 13, 55, 14, 9, -1, 15, 3, -1, 9, 15, 3, -1, 9, 8, 3, -1, 6, -1, 4, -1, 5, -1, -1, 56, -1, 9, -1, 56, 57, 9, -1, 20, -1, 16, -1, 59, 7, 61, -1, -1, 60, -1, 61, -1, 60, 20, 61, -1, 3, -1, 3, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 139, 139, 142, 147, 152, 159, 161, 166, 168, 170, 172, 174, 176, 178, 180, 182, 185, 188, 191, 194, 197, 200, 205, 210, 212, 214, 219, 220, 224, 226, 230, 232, 236, 241, 242, 246, 248, 252, 259 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "LST_SIMPLEID", "LST_LOGICALOP", "LST_EQOP", "LST_SIMPLEOP", "LST_MAPSYM", "LST_FIELDMAPSYM", "LST_MARKERSYM", "LST_ifTOKEN", "LST_thenTOKEN", "LST_elseTOKEN", "LST_LBRACKET", "LST_RBRACKET", "LST_SELECTSYM", "LST_SEPSYM", "LST_OPENSYM", "LST_CLOSESYM", "LST_COLON", "LST_COMMA", "LST_EOL", "LST_COMMENTSYM", "LST_WHITESPACE", "LST_QUANTIFIERSYM", "LST_EQUATIONSYM", "LST_EQSEPSYM", "LST_COMPOSESYM", "LST_LPAR", "LST_RPAR", "LST_assertsTOKEN", "LST_assumesTOKEN", "LST_byTOKEN", "LST_convertsTOKEN", "LST_enumerationTOKEN", "LST_equationsTOKEN", "LST_exemptingTOKEN", "LST_forTOKEN", "LST_generatedTOKEN", "LST_impliesTOKEN", "LST_includesTOKEN", "LST_introducesTOKEN", "LST_ofTOKEN", "LST_partitionedTOKEN", "LST_traitTOKEN", "LST_tupleTOKEN", "LST_unionTOKEN", "LST_BADTOKEN", "$accept", "top", "operatorList", "operator", "name", "opForm", "anyOp", "middle", "placeList", "separator", "signature", "domain", "sortList", "sortId", "opId", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 48, 49, 50, 50, 51, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 62 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 2, 3, 1, 1, 6, 1, 2, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 2, 3, 3, 1, 1, 1, 0, 1, 1, 3, 1, 1, 3, 0, 1, 1, 3, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 39, 25, 26, 24, 0, 0, 27, 0, 27, 0, 2, 3, 0, 7, 9, 6, 0, 27, 0, 27, 10, 0, 29, 0, 28, 21, 0, 1, 4, 34, 11, 23, 0, 22, 0, 12, 0, 17, 32, 31, 0, 13, 38, 5, 0, 35, 36, 18, 14, 0, 19, 30, 15, 0, 0, 20, 16, 0, 33, 37, 8 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 10, 11, 12, 13, 14, 15, 24, 25, 41, 44, 45, 46, 47, 16 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -34 static const yytype_int8 yypact[] = { -3, -34, -34, -34, -34, 11, -4, 2, 10, 2, 23, -3, -34, 6, -34, 18, -34, 26, 2, 27, 2, 22, 21, -34, 19, -12, -34, 16, -34, -34, 32, -34, -34, 24, -34, 25, -34, 28, 30, -34, -34, 31, 33, -34, -34, 29, 34, -34, 35, 36, 37, -34, -34, -34, 32, 32, -34, -34, 38, -34, -34, -34 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -34, -34, -34, 39, -34, -34, 41, 0, -34, -34, -34, -34, -34, -33, -34 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 1, 2, 3, 4, 39, 22, 5, 6, 40, 27, 7, 23, 8, 26, 9, 2, 3, 4, 33, 17, 35, 59, 60, 28, 18, 30, 19, 31, 20, 32, 34, 36, 37, 38, 42, 43, 54, 50, 48, 51, 52, 0, 53, 49, 56, 57, 21, 61, 0, 58, 29, 0, 0, 0, 55 }; static const yytype_int8 yycheck[] = { 3, 4, 5, 6, 16, 9, 9, 10, 20, 9, 13, 9, 15, 3, 17, 4, 5, 6, 18, 8, 20, 54, 55, 0, 13, 19, 15, 9, 17, 3, 3, 9, 11, 14, 18, 3, 7, 9, 14, 9, 9, -1, 9, 18, 9, 9, 5, 9, -1, 12, 11, -1, -1, -1, 20 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 9, 10, 13, 15, 17, 49, 50, 51, 52, 53, 54, 62, 8, 13, 15, 17, 54, 9, 9, 55, 56, 3, 55, 0, 51, 19, 9, 3, 55, 3, 55, 9, 11, 14, 16, 20, 57, 18, 3, 58, 59, 60, 61, 14, 18, 9, 9, 9, 9, 7, 20, 9, 9, 12, 61, 61, 9 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else # define YYLEX yylex (&yylval) #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: { lslOpList_free ((yyvsp[(1) - (1)].operators)); ;} break; case 3: { lslOpList x = lslOpList_new (); g_importedlslOp = (yyvsp[(1) - (1)].operator); lslOpList_add (x, (yyvsp[(1) - (1)].operator)); (yyval.operators) = x; ;} break; case 4: { lslOpList_add ((yyvsp[(1) - (2)].operators), (yyvsp[(2) - (2)].operator)); (yyval.operators) = (yyvsp[(1) - (2)].operators); ;} break; case 5: { (yyval.operator) = makelslOpNode ((yyvsp[(1) - (3)].name), (yyvsp[(3) - (3)].signature)); ;} break; case 6: { (yyval.name) = makeNameNodeId ((yyvsp[(1) - (1)].ltok)); ;} break; case 7: { (yyval.name) = makeNameNodeForm ((yyvsp[(1) - (1)].opform)); ;} break; case 8: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (6)].ltok), OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ;} break; case 9: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (1)].ltok), OPF_ANYOP, opFormUnion_createAnyOp ((yyvsp[(1) - (1)].ltok)), ltoken_undefined); ;} break; case 10: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_MANYOP, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 11: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_ANYOPM, opFormUnion_createAnyOp ((yyvsp[(1) - (2)].ltok)), ltoken_undefined); ;} break; case 12: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MANYOPM, opFormUnion_createAnyOp ((yyvsp[(2) - (3)].ltok)), ltoken_undefined); ;} break; case 13: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 14: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (4)].ltok), OPF_MMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 15: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_MIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 16: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_MMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 17: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_BMIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 18: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (4)].ltok), OPF_BMMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 19: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_BMIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 20: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_BMMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 21: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_SELECT, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 22: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MSELECT, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 23: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MMAP, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 24: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 25: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 26: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 27: { (yyval.count) = 0; ;} break; case 28: { (yyval.count) = (yyvsp[(1) - (1)].count); ;} break; case 29: { (yyval.count) = 1; ;} break; case 30: { (yyval.count) = (yyvsp[(1) - (3)].count) + 1; ;} break; case 31: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 32: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 33: { (yyval.signature) = makesigNode ((yyvsp[(2) - (3)].ltok), (yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 34: { (yyval.ltokenList) = ltokenList_new (); ;} break; case 35: { (yyval.ltokenList) = (yyvsp[(1) - (1)].ltokenList); ;} break; case 36: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 37: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 38: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setText ((yyval.ltok), processTraitSortId (ltoken_getText ((yyvsp[(1) - (1)].ltok)))); ;} break; case 39: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; /* Line 1267 of yacc.c. */ default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } # include "bison.reset" extern char *yytext; void lslerror (char *s) { llfatalbug (cstring_makeLiteral ("There has been a problem in the parser with LSL signatures. This is believed to result " "from a problem with bison v. 1.25. Please try rebuidling Splint " "using the pre-compiled grammar files by commenting out the " "BISON= line in the top-level Makefile.")); } static void yyprint (FILE *file, int type, YYSTYPE value) { fprintf (file, " (%u:%u type: %d; text: %s) ", ltoken_getLine (value.ltok), ltoken_getCol (value.ltok), type, ltoken_getRawTextChars (value.ltok)); } extern void PrintToken (ltoken tok) { char *codStr; switch (ltoken_getCode (tok)) { case NOTTOKEN: codStr = "*** NOTTOKEN ***"; break; case LST_QUANTIFIERSYM: codStr = "QUANTIFIERSYM"; break; case LST_LOGICALOP: codStr = "LOGICALOP: "; break; case LST_SELECTSYM: codStr = "LST_SELECTSYM"; break; case LST_OPENSYM: codStr = "LST_OPENSYM"; break; case LST_SEPSYM: codStr = "SEPSYM"; break; case LST_CLOSESYM: codStr = "LST_CLOSESYM"; break; case LST_SIMPLEID: codStr = "LST_SIMPLEID"; break; case LST_MAPSYM: codStr = "MAPSYM"; break; case LST_MARKERSYM: codStr = "LST_MARKERSYM"; break; case LST_COMMENTSYM: codStr = "COMMENTSYM"; break; case LST_SIMPLEOP: codStr = "SIMPLEOP"; break; case LST_COLON: codStr = "LST_COLON"; break; case LST_COMMA: codStr = "COMMA"; break; case LST_LBRACKET: codStr = "LST_LBRACKET"; break; case LST_LPAR: codStr = "LST_LPAR"; break; case LST_RBRACKET: codStr = "LST_RBRACKET"; break; case LST_RPAR: codStr = "LST_RPAR"; break; case LST_EQOP: codStr = "LST_EQOP"; break; case LST_WHITESPACE: codStr = "WHITESPACE,"; break; case LST_EOL: codStr = "LST_EOL"; break; case LST_elseTOKEN: codStr = "elseTOKEN"; break; case LST_ifTOKEN: codStr = "ifTOKEN"; break; case LST_thenTOKEN: codStr = "thenTOKEN"; break; case LST_BADTOKEN: codStr = "*** BADTOKEN ***"; break; case LEOFTOKEN: /* can't reach LEOFTOKEN easily */ codStr = "LEOFTOKEN"; break; default: codStr = "*** invalid token code ***"; break; } /* end switch */ /* only used for debugging */ printf ("%u:%u: Token Code (%u): %s", ltoken_getLine (tok), ltoken_getCol (tok), ltoken_getCode (tok), codStr); if (ltoken_getRawText (tok) != 0) { printf (", Token String (%lu): %s\n", ltoken_getRawText (tok), ltoken_getRawTextChars (tok)); } else printf ("\n"); } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/cppmain.c0000644021234200000250000001435407646432514014047 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cppmain.c */ /* CPP main program, using CPP Library. Copyright (C) 1995 Free Software Foundation, Inc. Written by Per Bothner, 1994-95. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ # include "splintMacros.nf" # include "basic.h" # include "cpplib.h" # include "cpphash.h" # include "cpperror.h" # include "llmain.h" # include "osd.h" # include # ifdef WIN32 /*@-ansireserved@*/ extern /*@external@*/ /*@observer@*/ char *getenv (const char *); /*@=ansireserved@*/ # endif /* char *progname; */ cppReader g_cppState; #ifdef abort /* More 'friendly' abort that prints the line and file. config.h can #define abort fancy_abort if you like that sort of thing. */ void fancy_abort () { fatal ("Internal gcc abort."); } #endif void cppReader_initMod () { struct cppOptions *opts = (struct cppOptions *) dmalloc (sizeof (*opts)); cpplib_init (&g_cppState); llassert (g_cppState.opts == NULL); g_cppState.opts = opts; cppOptions_init (opts); /*@-compdef@*/ /* g_cppState is not yet innitialized */ } /*@=compdef@*/ void cppReader_destroyMod () /*@globals killed g_cppState@*/ { cppCleanup (&g_cppState); } void cppReader_initialize () { cpplib_initializeReader (&g_cppState); } int cppProcess (/*@dependent@*/ cstring infile, /*@dependent@*/ cstring outfile) { FILE *ofile; struct cppOptions *opts = CPPOPTIONS (&g_cppState); opts->out_fname = outfile; opts->in_fname = infile; opts->out_fname = outfile; if (cpplib_fatalErrors (&g_cppState)) { llexit (LLFAILURE); } g_cppState.show_column = TRUE; if (cppReader_startProcess (&g_cppState, opts->in_fname) == 0) { llexit (LLFAILURE); } ofile = fileTable_createFile (context_fileTable (), outfile); if (ofile == NULL) { fileTable_noDelete (context_fileTable (), outfile); osd_setTempError (); llfatalerror (message ("Cannot create temporary file for " "pre-processor output. Trying to " "open: %s. Use -tmpdir to change " "the directory for temporary files.", outfile)); } for (;;) { enum cpp_token kind; llassert (g_cppState.token_buffer != NULL); if (!opts->no_output) { DPRINTF (("Writing: %s", cstring_copyLength (g_cppState.token_buffer, cpplib_getWritten (&g_cppState)))); (void) fwrite (g_cppState.token_buffer, (size_t) 1, cpplib_getWritten (&g_cppState), ofile); } cppReader_setWritten (&g_cppState, 0); kind = cpplib_getToken (&g_cppState); if (kind == CPP_EOF) break; } cppReader_finish (&g_cppState); check (fileTable_closeFile (context_fileTable (), ofile)); /* Restore the original definition table. */ if (!context_getFlag (FLG_SINGLEINCLUDE)) { cppReader_restoreHashtab (); } /* Undefine everything from this file! */ if (g_cppState.errors != 0) { return -1; } return 0; } void cppAddIncludeDir (cstring dir) { /* evans 2001-08-26 ** Add the -I- code. This code provided by Robin Watts */ DPRINTF (("Adding include: %s", dir)); if (cstring_equalLit (dir, "-I-")) { struct cppOptions *opts = CPPOPTIONS (&g_cppState); opts->ignore_srcdir = TRUE; } else { struct file_name_list *dirtmp = (struct file_name_list *) dmalloc (sizeof (*dirtmp)); DPRINTF (("Add include: %s", dir)); dirtmp->next = 0; /* New one goes on the end */ dirtmp->control_macro = 0; dirtmp->c_system_include_path = FALSE; /* This copy is necessary...but shouldn't be? */ /*@-onlytrans@*/ dirtmp->fname = cstring_copy (dir); /*@=onlytrans@*/ dirtmp->got_name_map = FALSE; cppReader_addIncludeChain (&g_cppState, dirtmp); } } void cppDoDefine (cstring str) { cppBuffer *tbuf = g_cppState.buffer; g_cppState.buffer = NULL; cppReader_define (&g_cppState, cstring_toCharsSafe (str)); g_cppState.buffer = tbuf; } void cppDoUndefine (cstring str) { size_t sym_length; hashNode hp; char *buf = cstring_toCharsSafe (str); sym_length = cppReader_checkMacroName (&g_cppState, buf, cstring_makeLiteralTemp ("macro")); while ((hp = cpphash_lookup (buf, size_toInt (sym_length), -1)) != NULL) { /*@-exposetrans@*/ /*@-dependenttrans@*/ cppReader_deleteMacro (hp); /*@=exposetrans@*/ /*@=dependenttrans@*/ } } void cppReader_saveDefinitions () { if (!context_getFlag (FLG_SINGLEINCLUDE)) { cppReader_saveHashtab (); } } splint-3.1.2.dfsg1/src/cpplib.c0000644021234200000250000065240110645775014013670 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cpplib.c */ /* Copyright (C) 1986, 87, 89, 92-6, 1997 Free Software Foundation, Inc. Contributed by Per Bothner, 1994-95. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ /* * Herbert 06/12/2000: * - OS2 drive specs like WIN32 * - Includes for IBMs OS/2 compiler */ # include # include # include # ifdef __STDC__ # include # endif # include # if !(defined (WIN32) || defined (OS2) && defined (__IBMC__)) # include # endif # include # include # include # if defined (WIN32) || defined (OS2) && defined (__IBMC__) # include /* SMF */ # ifndef BCC32 # include /* for __DATE__ and __TIME__ */ # endif # include # else # ifndef VMS /* ** evans 2002-07-03: exception for WATCOM 10.6 compiler suggest by Adam Clarke */ # if !defined (USG) && !defined (__WATCOMC__) # include /* Reported by Paul Smith */ # include # include # else # include # include # include # endif /* USG */ # endif /* not VMS */ # endif /* not WIN32 */ /* This defines "errno" properly for VMS, and gives us EACCES. */ # include # include "splintMacros.nf" # include "basic.h" # include "lcllib.h" # include "cpplib.h" # include "cpperror.h" # include "cpphash.h" # include "cppexp.h" # include "version.h" # include "osd.h" /* ** This is really kludgey code... */ /*@+boolint@*/ /*@+charint@*/ /* Warnings for using sprintf - suppress them all for now... */ /*@-bufferoverflowhigh@*/ /*@-bounds@*/ #define NO_SHORTNAMES # ifdef open # undef open # undef read # undef write # endif /* open */ /*@constant int IMPORT_FOUND@*/ # define IMPORT_FOUND -2 /*@constant int SKIP_INCLUDE@*/ # define SKIP_INCLUDE IMPORT_FOUND /*@constant unused int IMPORT_NOT_FOUND@*/ # define IMPORT_NOT_FOUND -1 #ifndef STDC_VALUE /*@constant unused int STDC_VALUE@*/ #define STDC_VALUE 1 #endif /* By default, colon separates directories in a path. */ #ifndef PATH_SEPARATOR /*@constant char PATH_SEPARATOR@*/ #define PATH_SEPARATOR ':' #endif static void parse_name (cppReader *, int); static int cpp_openIncludeFile (char *p_filename) /*@modifies fileSystem @*/ ; static void cpp_setLocation (cppReader *p_pfile) /*@modifies g_currentloc@*/ ; static enum cpp_token cpp_handleComment (cppReader *p_pfile, struct parse_marker *p_smark) /*@modifies p_pfile, p_smark@*/; static bool cpp_shouldCheckMacro (cppReader *p_pfile, char *p_p) /*@modifies p_p@*/ ; static size_t cppReader_checkMacroNameLoc (fileloc p_loc, char *p_symname, cstring p_usage) ; static bool cpp_skipIncludeFile (cstring p_fname) /*@*/ ; #ifndef O_RDONLY #define O_RDONLY 0 #endif /* Symbols to predefine. */ #ifdef CPP_PREDEFINES static /*@observer@*/ char *predefs = CPP_PREDEFINES; #else static /*@observer@*/ char *predefs = ""; #endif /* We let tm.h override the types used here, to handle trivial differences such as the choice of unsigned int or long unsigned int for size_t. When machines start needing nontrivial differences in the size type, it would be best to do something here to figure out automatically from other information what type to use. */ /* The string value for __SIZE_TYPE__. */ #ifndef SIZE_TYPE /*@constant observer char *SIZE_TYPE@*/ #define SIZE_TYPE "long unsigned int" #endif /* The string value for __PTRDIFF_TYPE__. */ #ifndef PTRDIFF_TYPE /*@constant observer char *PTRDIFF_TYPE@*/ #define PTRDIFF_TYPE "long int" #endif /* The string value for __WCHAR_TYPE__. */ #ifndef WCHAR_TYPE /*@constant observer char *WCHAR_TYPE@*/ #define WCHAR_TYPE "int" #endif /* The string value for __USER_LABEL_PREFIX__ */ #ifndef USER_LABEL_PREFIX /*@constant observer char *USER_LABEL_PREFIX@*/ #define USER_LABEL_PREFIX "" #endif /* The string value for __REGISTER_PREFIX__ */ #ifndef REGISTER_PREFIX /*@constant observer char *REGISTER_PREFIX@*/ #define REGISTER_PREFIX "" #endif /* table to tell if char can be part of a C identifier. */ static bool is_idchar[256]; /* table to tell if char can be first char of a c identifier. */ static bool is_idstart[256]; /* table to tell if c is horizontal space. */ static bool is_hor_space[256]; /* table to tell if c is horizontal or vertical space. */ static bool is_space[256]; static /*@exposed@*/ /*@null@*/ cppBuffer * cppReader_getBuffer (/*@special@*/ cppReader *p_pfile) /*@uses p_pfile->buffer@*/ /*@modifies nothing@*/ ; /*@notfunction@*/ # define SKIP_WHITE_SPACE(p) do { /*@access cstring@*/ while (is_hor_space[(int) *(p)]) { (p)++; } } /*@noaccess cstring@*/ while (0) /*@notfunction@*/ # define SKIP_ALL_WHITE_SPACE(p) do { while (is_space[*(p)]) { (p)++; } } while (0) static int cpp_peekN (cppReader *p_pfile, int p_n) /*@*/ ; /*@function static int cppBuffer_get (sef cppBuffer *p_b) modifies *p_b ; @*/ # define cppBuffer_get(BUFFER) \ ((BUFFER)->cur < (BUFFER)->rlimit ? *(BUFFER)->cur++ : EOF) /*@function static int cppBuffer_reachedEOF (sef cppBuffer *p_b) modifies nothing; @*/ # define cppBuffer_reachedEOF(b) \ ((b)->cur < (b)->rlimit ? FALSE : TRUE) /* Append string STR (of length N) to PFILE's output buffer. Make space. */ /*@function static void cppReader_puts (sef cppReader *p_file, char *p_str, sef size_t p_n) modifies *p_file; @*/ # define cppReader_puts(PFILE, STR, N) \ cpplib_reserve(PFILE, N), cppReader_putStrN (PFILE, STR,N) /* Append character CH to PFILE's output buffer. Assume sufficient space. */ /*@function static void cppReader_putCharQ (cppReader *p_file, char p_ch) modifies *p_file; @*/ # define cppReader_putCharQ(PFILE, CH) (*(PFILE)->limit++ = (CH)) /* static void cppReader_putCharQ (cppReader *p_file, char p_ch) { fprintf (stderr, "put char: %c\n", p_ch); (*(p_file)->limit++ = (p_ch)); } */ /* Append character CH to PFILE's output buffer. Make space if need be. */ /*@function static void cppReader_putChar (sef cppReader *p_file, char p_ch) modifies *p_file; @*/ #define cppReader_putChar(PFILE, CH) (cpplib_reserve (PFILE, (size_t) 1), cppReader_putCharQ (PFILE, CH)) /* Make sure PFILE->limit is followed by '\0'. */ /*@function static void cppReader_nullTerminateQ (cppReader *p_file) modifies *p_file; @*/ #define cppReader_nullTerminateQ(PFILE) (*(PFILE)->limit = 0) /*@function static void cppReader_nullTerminate (sef cppReader *p_file) modifies *p_file; @*/ # define cppReader_nullTerminate(PFILE) \ (cpplib_reserve (PFILE, (size_t) 1), *(PFILE)->limit = 0) /*@function static void cppReader_adjustWritten (cppReader *p_file, size_t) modifies *p_file; @*/ #define cppReader_adjustWritten(PFILE,DELTA) ((PFILE)->limit += (DELTA)) /*@function static bool cppReader_isC89 (cppReader *) modifies nothing; @*/ #define cppReader_isC89(PFILE) (CPPOPTIONS(PFILE)->c89) /*@function static observer char *cppReader_wcharType (cppReader *) modifies nothing; @*/ # define cppReader_wcharType(PFILE) \ (CPPOPTIONS (PFILE)->cplusplus ? "__wchar_t" : WCHAR_TYPE) static void cppBuffer_forward (cppBuffer *p_buf, int p_n) /*@modifies *p_buf@*/ ; /*@function static void cppReader_forward (cppReader *p_pfile, int) modifies *p_pfile; @*/ # define cppReader_forward(pfile, N) \ (cppBuffer_forward (cppReader_getBufferSafe (pfile), (N))) /*@function static int cppReader_getC (cppReader *p_pfile) modifies *p_pfile; @*/ # define cppReader_getC(pfile) (cppBuffer_get (cppReader_getBufferSafe (pfile))) /*@function static int cppReader_reachedEOF (sef cppReader *p_pfile) modifies *p_pfile; @*/ # define cppReader_reachedEOF(pfile) (cppBuffer_reachedEOF (cppReader_getBufferSafe (pfile))) /*@function static int cppReader_peekC (cppReader *) modifies nothing;@*/ # define cppReader_peekC(pfile) (cpplib_bufPeek (cppReader_getBufferSafe (pfile))) /* Move all backslash-newline pairs out of embarrassing places. Exchange all such pairs following BP with any potentially-embarrassing characters that follow them. Potentially-embarrassing characters are / and * (because a backslash-newline inside a comment delimiter would cause it not to be recognized). */ /*@notfunction@*/ # define NEWLINE_FIX \ do { while (cppReader_peekC (pfile) == '\\' && cpp_peekN (pfile, 1) == '\n') { cppReader_forward (pfile, 2); } } while(FALSE) /* Same, but assume we've already read the potential '\\' into C. */ /*@notfunction@*/ # define NEWLINE_FIX1(C) do { \ while ((C) == '\\' && cppReader_peekC (pfile) == '\n') { cppReader_forward (pfile, 1); (C) = cppReader_getC (pfile); }\ } while(0) static void parseSetMark (/*@out@*/ struct parse_marker *, cppReader *); static void parseClearMark (struct parse_marker *); static void parseGotoMark (struct parse_marker *, cppReader *); static void parseMoveMark (struct parse_marker *, cppReader *); /* If we have a huge buffer, may need to cache more recent counts */ static /*@exposed@*/ char *cppLineBase (/*@sef@*/ cppBuffer *); static /*@exposed@*/ /*@null@*/ cppBuffer * cppReader_pushBuffer (cppReader *p_pfile, /*@owned@*/ /*@null@*/ char *, size_t) /*@modifies p_pfile@*/ ; static void cppReader_appendIncludeChain (cppReader *p_pfile, /*@keep@*/ struct file_name_list *p_first, /*@dependent@*/ struct file_name_list *p_last); static void cppReader_macroCleanup (cppBuffer *p_pbuf, cppReader *p_pfile); static enum cpp_token cppReader_nullUnderflow (/*@unused@*/ cppReader *p_pfile); static void cppReader_nullCleanup (/*@unused@*/ cppBuffer *p_pbuf, /*@unused@*/ cppReader *p_pfile); static void cppReader_fileCleanup (cppBuffer *p_pbuf, /*@unused@*/ cppReader *p_pfile); static int cppReader_handleDirective (cppReader *p_pfile); static void cppReader_scanBuffer (cppReader *p_pfile); # if defined (WIN32) || defined (OS2) && defined (__IBMC__) /* SMF */ # ifndef BCC32 /* ** WIN32 (at least the VC++ include files) does not define mode_t. */ /*@-incondefs@*/ /*@-czechtypes@*/ typedef unsigned int mode_t; /*@=incondefs@*/ /*@=czechtypes@*/ # endif # endif static int file_size_and_mode (int p_fd, /*@out@*/ mode_t *p_mode_pointer, /*@out@*/ size_t *p_size_pointer); static int safe_read (int p_desc, /*@out@*/ char *p_ptr, int p_len); /* ** cppBuffer_isMacro is true if the buffer contains macro expansion. ** (Note that it is false while we're expanding marco *arguments*.) */ static bool cppBuffer_isMacro (/*@null@*/ cppBuffer *) /*@*/ ; static void path_include (cppReader *p_pfile, char *p_path) /*@modifies p_pfile@*/ ; static void initialize_builtins (cppReader *p_pfile) /*@modifies p_pfile@*/ ; static void initialize_char_syntax (struct cppOptions *p_opts) ; static int /*@alt void@*/ finclude (cppReader *p_pfile, int p_f, cstring p_fname, bool p_system_header_p, /*@dependent@*/ /*@null@*/ struct file_name_list *p_dirptr); static void validate_else (cppReader *p_pfile, cstring p_directive); static void conditional_skip (cppReader *p_pfile, int p_skip, enum node_type p_type, /*@dependent@*/ /*@null@*/ char *p_control_macro); static HOST_WIDE_INT eval_if_expression (cppReader *p_pfile, char *p_buf, int p_length); static void skip_if_group (cppReader *p_pfile, int p_any); static bool comp_def_part (bool p_first, char *p_beg1, int p_len1, char *p_beg2, int p_len2, bool p_last); #ifdef abort extern void fancy_abort (); #endif static bool redundant_include_p (cppReader *p_pfile, /*@null@*/ cstring p_name); static bool is_system_include (cppReader *p_pfile, cstring p_filename); static /*@observer@*/ /*@null@*/ struct file_name_map * read_name_map (cppReader *p_pfile, cstring p_dirname); static cstring read_filename_string (int p_ch, /*:open:*/ FILE *p_f); static int open_include_file (cppReader *p_pfile, /*@owned@*/ cstring p_fname, /*@null@*/ struct file_name_list *p_searchptr); static void push_macro_expansion (cppReader *, /*@owned@*/ char *, size_t, /*@dependent@*/ hashNode); /* Last arg to output_line_command. */ enum file_change_code { same_file, enter_file, leave_file }; /* `struct directive' defines one #-directive, including how to handle it. */ struct directive { int length; /* Length of name */ /*@null@*/ int (*func)(); /* Function to handle directive */ /*@observer@*/ cstring name; /* Name of directive */ enum node_type type; /* Code which describes which directive. */ bool command_reads_line; /* One if rest of line is read by func. */ bool traditional_comments; /* Nonzero: keep comments if -traditional. */ bool pass_thru; /* Copy preprocessed directive to output file.*/ }; /* These functions are declared to return int instead of void since they are going to be placed in a table and some old compilers have trouble with pointers to functions returning void. */ static int do_define (cppReader *, /*@null@*/ struct directive *, /*@exposed@*/ char *, char *); static int do_defineAux (cppReader *, /*@null@*/ struct directive *, /*@exposed@*/ char *, char *, bool); static int do_line (cppReader *, /*@null@*/ struct directive *); static int do_include (cppReader *, struct directive *, char *, char *); static int do_undef (cppReader *, struct directive *, char *, char *); static int do_error (cppReader *, struct directive *, char *, char *); static int do_pragma (cppReader *, struct directive *, char *, char *); static int do_ident (cppReader *, struct directive *, char *, char *); static int do_if (cppReader *, struct directive *, char *, char *); static int do_xifdef (cppReader *, struct directive *, char *, char *); static int do_else (cppReader *, struct directive *, char *, char *); static int do_elif (cppReader *, struct directive *, char *, char *); static int do_endif (cppReader *, struct directive *, char *, char *); static int do_warning (cppReader *, struct directive *, char *, char *); /* If a buffer's dir field is SELF_DIR_DUMMY, it means the file was found via the same directory as the file that #included it. */ /*@constant observer struct file_name_list *SELF_DIR_DUMMY@*/ #define SELF_DIR_DUMMY ((struct file_name_list *) (~0)) /* #include "file" looks in source file dir, then stack. */ /* #include just looks in the stack. */ /* -I directories are added to the end, then the defaults are added. */ /*@access cstring@*/ static struct default_include { /*@dependent@*/ /*@observer@*/ cstring fname; /* The name of the directory. */ int cplusplus; /* Only look here if we're compiling C++. */ int cxx_aware; /* Includes in this directory don't need to be wrapped in extern "C" when compiling C++. */ } include_defaults_array[] = { /* This is the dir for fixincludes. Put it just before the files that we fix. */ { GCC_INCLUDE_DIR, 0, 0 }, { GCC_INCLUDE_DIR2, 0, 0 }, { cstring_undefined, 0, 0 } }; /*@noaccess cstring@*/ /* Here is the actual list of #-directives, most-often-used first. The initialize_builtins function assumes #define is the very first. */ /*@access cstring@*/ static struct directive directive_table[] = { { 6, do_define, "define", T_DEFINE, FALSE, TRUE, FALSE }, { 5, do_xifdef, "ifdef", T_IFDEF, TRUE, FALSE, FALSE }, { 6, do_xifdef, "ifndef", T_IFNDEF, TRUE, FALSE, FALSE }, { 7, do_include, "include", T_INCLUDE, TRUE, FALSE, FALSE }, { 5, do_endif, "endif", T_ENDIF, TRUE, FALSE, FALSE }, { 4, do_else, "else", T_ELSE, TRUE, FALSE, FALSE }, { 2, do_if, "if", T_IF, TRUE, FALSE, FALSE }, { 4, do_elif, "elif", T_ELIF, TRUE, FALSE, FALSE }, { 5, do_undef, "undef", T_UNDEF, FALSE, FALSE, FALSE }, { 5, do_error, "error", T_ERROR, FALSE, FALSE, FALSE }, { 7, do_warning, "warning", T_WARNING, FALSE, FALSE, FALSE }, { 6, do_pragma, "pragma", T_PRAGMA, FALSE, FALSE, TRUE}, { 4, do_line, "line", T_LINE, TRUE, FALSE, FALSE }, { 5, do_ident, "ident", T_IDENT, TRUE, FALSE, TRUE }, /* { 8, do_unassert, "unassert", T_UNASSERT, TRUE, FALSE, FALSE }, */ { -1, NULL, "", T_UNUSED, FALSE, FALSE, FALSE }, }; /*@noaccess cstring@*/ static cstring searchPath_unparse (struct file_name_list *search_start) { cstring res = cstring_newEmpty (); struct file_name_list *searchptr = NULL; for (searchptr = search_start; searchptr != NULL; searchptr = searchptr->next) { if (!cstring_isEmpty (searchptr->fname)) { res = cstring_concatFree1 (res, searchptr->fname); if (searchptr->next != NULL) { res = cstring_appendChar (res, ';'); } } } return res; } /*@+charint@*/ static void initialize_char_syntax (struct cppOptions *opts) { char i; /* * Set up is_idchar and is_idstart tables. These should be * faster than saying (is_alpha (c) || c == '_'), etc. * Set up these things before calling any routines tthat * refer to them. */ for (i = 'a'; i <= 'z'; i++) { is_idchar[i - 'a' + 'A'] = TRUE; is_idchar[(int) i] = TRUE; is_idstart[i - 'a' + 'A'] = TRUE; is_idstart[(int) i] = TRUE; } for (i = '0'; i <= '9'; i++) { is_idchar[(int) i] = TRUE; } is_idchar['_'] = TRUE; is_idstart['_'] = TRUE; is_idchar['$'] = opts->dollars_in_ident; is_idstart['$'] = opts->dollars_in_ident; /* horizontal space table */ is_hor_space[' '] = TRUE; is_hor_space['\t'] = TRUE; is_hor_space['\v'] = TRUE; is_hor_space['\f'] = TRUE; is_hor_space['\r'] = TRUE; is_space[' '] = TRUE; is_space['\t'] = TRUE; is_space['\v'] = TRUE; is_space['\f'] = TRUE; is_space['\n'] = TRUE; is_space['\r'] = TRUE; } bool isIdentifierChar (char c) { return is_idchar[(int) c]; } /* Place into P_PFILE a quoted string representing the string SRC. Caller must reserve enough space in pfile->token_buffer. */ static void quote_string (cppReader *pfile, char *src) { char c; cppReader_putCharQ (pfile, '\"'); for (;;) { switch ((c = *src++)) { default: if (isprint (c)) cppReader_putCharQ (pfile, c); else { sprintf (cpplib_getPWritten (pfile), "\\%03o", (unsigned int) c); cppReader_adjustWritten (pfile, (size_t) 4); } /*@switchbreak@*/ break; case '\"': case '\\': cppReader_putCharQ (pfile, '\\'); cppReader_putCharQ (pfile, c); /*@switchbreak@*/ break; case '\0': cppReader_putCharQ (pfile, '\"'); cppReader_nullTerminateQ (pfile); return; } } } /* Re-allocates PFILE->token_buffer so it will hold at least N more chars. */ void cppReader_growBuffer (cppReader *pfile, size_t n) { size_t old_written = cpplib_getWritten (pfile); pfile->token_buffer_size = n + 2 * pfile->token_buffer_size; pfile->token_buffer = (char *) drealloc (pfile->token_buffer, pfile->token_buffer_size); cppReader_setWritten (pfile, old_written); } /* * process a given definition string, for initialization * If STR is just an identifier, define it with value 1. * If STR has anything after the identifier, then it should * be identifier=definition. */ void cppReader_define (cppReader *pfile, char *str) { char *buf = NULL; char *p = str; DPRINTF (("Cpp reader define: %s", str)); if (!is_idstart[(int) *p]) { DPRINTF (("ERROR 1")); cppReader_error (pfile, message ("Malformed option `-D%s'", cstring_fromChars (str))); return; } p++; DPRINTF (("Here 2")); while (is_idchar[(int) *p]) { p++; } if (*p == '(') { p++; while (*p != ')' && *p != '\0') { p++; } if (*p == ')') { p++; } else { cppReader_error (pfile, message ("Malformed option: -D%s (no closing parenthesis)", cstring_fromChars (str))); } } DPRINTF (("Here 2")); if (*p == '\0') { buf = (char *) dmalloc (size_fromInt (p - str + 4)); strcpy ((char *) buf, str); strcat ((char *) buf, " 1"); } else if (*p != '=') { DPRINTF (("ERROR 2")); cppReader_error (pfile, message ("Malformed option: -D%s (expected '=', found '%c')", cstring_fromChars (str), *p)); return; } else { char *q; /* Copy the entire option so we can modify it. */ DPRINTF (("Copying...")); buf = (char *) dmalloc (2 * strlen (str) + 1); strncpy (buf, str, size_fromInt (p - str)); /* Change the = to a space. */ buf[p - str] = ' '; /* Scan for any backslash-newline and remove it. */ p++; q = &buf[p - str]; while (*p != '\0') { if (*p == '\\' && p[1] == '\n') p += 2; else *q++ = *p++; } DPRINTF (("Here we are...")); *q = '\0'; } llassert (buf != NULL); DPRINTF (("Do define: %s / %ld", buf, size_toLong (strlen (buf)))); (void) do_define (pfile, NULL, buf, buf + strlen (buf)); sfree (buf); } /* Append a chain of `struct file_name_list's to the end of the main include chain. FIRST is gthe beginning of the chain to append, and LAST is the end. */ void cppReader_appendIncludeChain (cppReader *pfile, struct file_name_list *first, struct file_name_list *last) { struct cppOptions *opts = CPPOPTIONS (pfile); struct file_name_list *dir; if (first == NULL || last == NULL) { return; } if (opts->include == 0) { opts->include = first; } else { llassert (opts->last_include->next == NULL); opts->last_include->next = first; } if (opts->first_bracket_include == 0) { opts->first_bracket_include = first; for (dir = first; ; dir = dir->next) { size_t len = cstring_length (dir->fname) + INCLUDE_LEN_FUDGE; if (len > pfile->max_include_len) { pfile->max_include_len = len; } if (dir == last) { break; } } } llassert (last->next == NULL); /* last->next = NULL; */ opts->last_include = last; } # if 0 static /*@unused@*/ void cppReader_showIncludeChain (cppReader *pfile) { struct file_name_list *dirs = CPPOPTIONS (pfile)->include; if (dirs != NULL) { while (dirs != NULL) { fprintf (stderr, "*%s*:", cstring_toCharsSafe (dirs->fname)); dirs = dirs->next; } fprintf (stderr, "\n"); } else { fprintf (stderr, "No includes\n"); } } # endif cstring cppReader_getIncludePath () { cppReader *pfile = &g_cppState; struct file_name_list *dirs = CPPOPTIONS (pfile)->include; cstring res = cstring_undefined; if (dirs != NULL) { while (dirs != NULL) { res = message ("%q%c%s", res, PATH_SEPARATOR, dirs->fname); dirs = dirs->next; } } else { res = cstring_makeLiteral (""); } return res; } void cppReader_addIncludeChain (cppReader *pfile, /*@only@*/ struct file_name_list *dir) { struct cppOptions *opts = CPPOPTIONS (pfile); if (dir == NULL) { return; } if (opts->include == 0) { opts->include = dir; } else { llassert (opts->last_include->next == NULL); opts->last_include->next = dir; } if (opts->first_bracket_include == 0) { size_t len = cstring_length (dir->fname) + INCLUDE_LEN_FUDGE; opts->first_bracket_include = dir; if (len > pfile->max_include_len) { pfile->max_include_len = len; } } dir->next = NULL; opts->last_include = dir; /* cppReader_showIncludeChain (pfile); */ } /* Given a colon-separated list of file names PATH, add all the names to the search path for include files. */ static void path_include (cppReader *pfile, char *path) { char *p; #ifdef __CYGWIN32__ char *win32temp; /* if we have a posix path list, convert to win32 path list */ win32temp = (char *) dmalloc /*@i4@*/ (cygwin32_posix_to_win32_path_list_buf_size (path)); cygwin32_posix_to_win32_path_list (path, win32temp); path = win32temp; #endif p = path; if (*p != '\0') while (1) { char *q = p; char *name; struct file_name_list *dirtmp; /* Find the end of this name. */ while (*q != '\0' && *q != PATH_SEPARATOR) { q++; } if (p == q) { /* An empty name in the path stands for the current directory. */ name = (char *) dmalloc ((size_t) 2); name[0] = '.'; name[1] = '\0'; } else { /* Otherwise use the directory that is named. */ name = (char *) dmalloc (size_fromInt (q - p + 1)); memcpy (name, p, size_fromInt (q - p)); name[q - p] = '\0'; } dirtmp = (struct file_name_list *) dmalloc (sizeof (*dirtmp)); dirtmp->next = 0; /* New one goes on the end */ dirtmp->control_macro = 0; dirtmp->c_system_include_path = 0; dirtmp->fname = cstring_fromChars (name); dirtmp->got_name_map = 0; cppReader_addIncludeChain (pfile, dirtmp); /* Advance past this name. */ p = q; if (*p == '\0') break; /* Skip the colon. */ p++; } } void cppOptions_init (cppOptions *opts) { memset ((char *) opts, 0, sizeof *opts); assertSet (opts); opts->in_fname = NULL; opts->out_fname = NULL; /* Initialize is_idchar to allow $. */ opts->dollars_in_ident = TRUE; opts->no_line_commands = 0; opts->no_trigraphs = TRUE; opts->put_out_comments = 1; opts->print_include_names = 0; opts->dump_macros = DUMP_DEFINITIONS; /* DUMP_NONE; */ opts->no_output = 0; opts->cplusplus = 0; opts->cplusplus_comments = 1; opts->verbose = 0; opts->lang_asm = 0; opts->for_lint = 0; opts->chill = 0; opts->pedantic_errors = 0; opts->warn_comments = 0; opts->warnings_are_errors = 0; /* Added 2003-07-10: */ opts->traditional = FALSE; opts->c89 = TRUE; initialize_char_syntax (opts); } enum cpp_token cppReader_nullUnderflow (/*@unused@*/ cppReader *pfile) { return CPP_EOF; } void cppReader_nullCleanup (/*@unused@*/ cppBuffer *pbuf, /*@unused@*/ cppReader *pfile) { ; } void cppReader_macroCleanup (cppBuffer *pbuf, /*@unused@*/ cppReader *pfile) { hashNode macro = pbuf->hnode; if (macro->type == T_DISABLED) { macro->type = T_MACRO; } if (macro->type != T_MACRO || pbuf->buf != macro->value.defn->expansion) { sfree (pbuf->buf); pbuf->buf = NULL; } } void cppReader_fileCleanup (cppBuffer *pbuf, /*@unused@*/ cppReader *pfile) { if (pbuf->buf != NULL) { sfree (pbuf->buf); pbuf->buf = NULL; } } /* Assuming we have read '/'. If this is the start of a comment (followed by '*' or '/'), skip to the end of the comment, and return ' '. Return EOF if we reached the end of file before the end of the comment. If not the start of a comment, return '/'. */ static int skip_comment (cppReader *pfile, /*@null@*/ long *linep) { int c = 0; llassert (pfile->buffer != NULL); llassert (pfile->buffer->cur != NULL); while (cppReader_peekC (pfile) == '\\' && cpp_peekN (pfile, 1) == '\n') { if (linep != NULL) { (*linep)++; } cppReader_forward (pfile, 2); } if (cppReader_peekC (pfile) == '*') { cppReader_forward (pfile, 1); for (;;) { int prev_c = c; c = cppReader_getC (pfile); if (c == EOF) { return EOF; } while (c == (int) '\\' && cppReader_peekC (pfile) == (int) '\n') { if (linep != NULL ) { (*linep)++; } cppReader_forward (pfile, 1), c = cppReader_getC (pfile); } if (prev_c == (int) '*' && c == (int) '/') { return (int) ' '; } if (c == (int) '\n' && (linep != NULL)) { (*linep)++; } } } else if (cppReader_peekC (pfile) == '/' && CPPOPTIONS (pfile)->cplusplus_comments) { (void) cppoptgenerror (FLG_SLASHSLASHCOMMENT, message ("C++ style // comment" ), pfile); cppReader_forward (pfile, 1); for (;;) { c = cppReader_getC (pfile); if (c == EOF) { /* Allow hash comment to be terminated by EOF. */ return (int) ' '; } while (c == (int) '\\' && cppReader_peekC (pfile) == '\n') { cppReader_forward (pfile, 1); c = cppReader_getC (pfile); if (linep != NULL) { (*linep)++; } } if (c == (int) '\n') { /* Don't consider final '\n' to be part of comment. */ cppReader_forward (pfile, -1); return (int) ' '; } } } else { return (int) '/'; } } /* Skip whitespace \-newline and comments. Does not macro-expand. */ int /*@alt void@*/ cppSkipHspace (cppReader *pfile) { int nspaces = 0; while (TRUE) { int c; llassert (pfile->buffer != NULL); c = cppReader_peekC (pfile); if (c == EOF) { return 0; /* FIXME */ } if (is_hor_space[c]) { if ((c == '\f' || c == '\v') && cppReader_isPedantic (pfile)) cppReader_pedwarn (pfile, message ("%s in preprocessing directive", c == '\f' ? cstring_makeLiteralTemp ("formfeed") : cstring_makeLiteralTemp ("vertical tab"))); nspaces++; cppReader_forward (pfile, 1); } else if (c == '/') { cppReader_forward (pfile, 1); c = skip_comment (pfile, NULL); if (c == '/') { cppReader_forward (pfile, -1); } if (c == EOF || c == '/') { return nspaces; } } else if (c == '\\' && cpp_peekN (pfile, 1) == '\n') { cppReader_forward (pfile, 2); } else if (c == '@' && CPPBUFFER (pfile)->has_escapes && is_hor_space [cpp_peekN (pfile, 1)]) { cppReader_forward (pfile, 2); } else { return nspaces; } } } /* Read the rest of the current line. The line is appended to PFILE's output buffer. */ static void copy_rest_of_line (cppReader *pfile) { struct cppOptions *opts = CPPOPTIONS (pfile); for (;;) { int c; int nextc; llassert (pfile->buffer != NULL); c = cppReader_getC (pfile); switch (c) { case EOF: goto end_directive; case '\\': /* ** Patch from Brian St. Pierre for handling MS-DOS files. */ DPRINTF (("Reading directive: %d", (int) c)); if (cppReader_peekC (pfile) == '\n' || cppReader_peekC (pfile) == '\r') { DPRINTF (("Reading directive...")); if (cppReader_peekC (pfile) == '\r') { DPRINTF (("Reading directive...")); cppReader_forward (pfile, 1); } DPRINTF (("Reading directive...")); cppReader_forward (pfile, 1); continue; } DPRINTF (("Falling...")); /*@fallthrough@*/ case '\'': case '\"': goto scan_directive_token; case '/': nextc = cppReader_peekC (pfile); /* ** was (opts->cplusplus_comments && nextc == '*') ** yoikes! */ if (nextc == '*' || (opts->cplusplus_comments && nextc == '/')) { goto scan_directive_token; } /*@switchbreak@*/ break; case '\f': case '\v': if (cppReader_isPedantic (pfile)) cppReader_pedwarn (pfile, message ("%s in preprocessing directive", c == '\f' ? cstring_makeLiteralTemp ("formfeed") : cstring_makeLiteralTemp ("vertical tab"))); /*@switchbreak@*/ break; case '\n': cppReader_forward (pfile, -1); goto end_directive; scan_directive_token: cppReader_forward (pfile, -1); (void) cpplib_getToken (pfile); continue; } cppReader_putChar (pfile, c); } end_directive: ; cppReader_nullTerminate (pfile); } void cppReader_skipRestOfLine (cppReader *pfile) { size_t old = cpplib_getWritten (pfile); copy_rest_of_line (pfile); cppReader_setWritten (pfile, old); } /* Handle a possible # directive. '#' has already been read. */ int cppReader_handleDirective (cppReader *pfile) { int c; struct directive *kt = NULL; int ident_length; size_t after_ident = 0; char *ident = NULL; char *line_end = NULL; size_t old_written = cpplib_getWritten (pfile); int nspaces = cppSkipHspace (pfile); c = cppReader_peekC (pfile); if (c >= '0' && c <= '9') { /* Handle # followed by a line number. */ if (cppReader_isPedantic (pfile)) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("`#' followed by integer")); } (void) do_line (pfile, NULL); goto done_a_directive; } /* Now find the directive name. */ cppReader_putChar (pfile, '#'); parse_name (pfile, cppReader_getC (pfile)); llassert (pfile->token_buffer != NULL); ident = pfile->token_buffer + old_written + 1; ident_length = cpplib_getPWritten (pfile) - ident; if (ident_length == 0 && cppReader_peekC (pfile) == '\n') { /* A line of just `#' becomes blank. */ return 1; } for (kt = directive_table; ; kt++) { if (kt->length <= 0) { return 0; /* goto not_a_directive; */ } if (kt->length == ident_length && (cstring_equalPrefix (kt->name, cstring_fromChars (ident)))) { break; } } if (kt->command_reads_line) { after_ident = 0; } else { /* Nonzero means do not delete comments within the directive. #define needs this when -traditional. */ bool comments = 1; /*cppReader_isTraditional (pfile) && kt->traditional_comments; */ int save_put_out_comments = CPPOPTIONS (pfile)->put_out_comments; CPPOPTIONS (pfile)->put_out_comments = comments; after_ident = cpplib_getWritten (pfile); copy_rest_of_line (pfile); CPPOPTIONS (pfile)->put_out_comments = save_put_out_comments; } /* For #pragma and #define, we may want to pass through the directive. Other directives may create output, but we don't want the directive itself out, so we pop it now. For example #include may write a #line command (see comment in do_include), and conditionals may emit #failed ... #endfailed stuff. But note that popping the buffer means the parameters to kt->func may point after pfile->limit so these parameters are invalid as soon as something gets appended to the token_buffer. */ line_end = cpplib_getPWritten (pfile); if (!kt->pass_thru && kt->type != T_DEFINE) { cppReader_setWritten (pfile, old_written); } llassert (pfile->token_buffer != NULL); /* was kt->pass_thru || */ if (kt->type == T_DEFINE && cpp_shouldCheckMacro (pfile, pfile->token_buffer + old_written)) { char *p = pfile->token_buffer + old_written; /* ** Still need to record value for preprocessing, so ** #ifdef's, etc. using the value behave correctly. */ (void) do_defineAux (pfile, kt, pfile->token_buffer + after_ident, line_end, TRUE); if (*p == '#') { *p = ' '; } SKIP_WHITE_SPACE (p); llassert (*p == 'd'); *p++ = LLMRCODE[0]; llassert (*p == 'e'); *p++ = LLMRCODE[1]; llassert (*p == 'f'); *p++ = LLMRCODE[2]; llassert (*p == 'i'); *p++ = LLMRCODE[3]; llassert (*p == 'n'); *p++ = LLMRCODE[4]; llassert (*p == 'e'); /* ** This is way-bogus. We use the last char to record the number of ** spaces. Its too hard to get them back into the input stream. */ if (nspaces > 9) nspaces = 9; *p++ = '0' + nspaces; return 0; /* not_a_directive */ } else if (kt->pass_thru) { /* Just leave the entire #define in the output stack. */ return 0; /* not_a_directive */ } else if (kt->type == T_DEFINE && CPPOPTIONS (pfile)->dump_macros == DUMP_NAMES) { char *p = pfile->token_buffer + old_written + 7; /* Skip "#define". */ SKIP_WHITE_SPACE (p); while (is_idchar[(int) *p]) { p++; } pfile->limit = p; cppReader_putChar (pfile, '\n'); } else if (kt->type == T_DEFINE) { cppReader_setWritten (pfile, old_written); } else { ; } done_a_directive: if (kt == NULL) { return 1; } else { llassert (kt->func != NULL); (void) (kt->func) (pfile, kt, pfile->token_buffer + after_ident, line_end); return 1; } } /* Pass a directive through to the output file. BUF points to the contents of the directive, as a contiguous string. LIMIT points to the first character past the end of the directive. KEYWORD is the keyword-table entry for the directive. */ static void pass_thru_directive (char *buf, char *limit, cppReader *pfile, struct directive *keyword) { int keyword_length = keyword->length; cpplib_reserve (pfile, size_fromInt (2 + keyword_length + (limit - buf))); cppReader_putCharQ (pfile, '#'); /*@-observertrans@*/ cppReader_putStrN (pfile, cstring_toCharsSafe (keyword->name), size_fromInt (keyword_length)); /*:=observertrans@*/ if (limit != buf && buf[0] != ' ') { /* Was a bug, since reserve only used 1 + ... */ cppReader_putCharQ (pfile, ' '); } cppReader_putStrN (pfile, buf, size_fromInt (limit - buf)); } /* Read a replacement list for a macro with parameters. Build the DEFINITION structure. Reads characters of text starting at BUF until END. ARGLIST specifies the formal parameters to look for in the text of the definition; NARGS is the number of args in that list, or -1 for a macro name that wants no argument list. MACRONAME is the macro name itself (so we can avoid recursive expansion) and NAMELEN is its length in characters. Note that comments, backslash-newlines, and leading white space have already been deleted from the argument. */ static DEFINITION * collect_expansion (cppReader *pfile, char *buf, char *limit, int nargs, /*@null@*/ struct arglist *arglist) { DEFINITION *defn; char *p, *lastp, *exp_p; struct reflist *endpat = NULL; /* Pointer to first nonspace after last ## seen. */ char *concat = 0; /* Pointer to first nonspace after last single-# seen. */ char *stringify = 0; size_t maxsize; char expected_delimiter = '\0'; /* Scan thru the replacement list, ignoring comments and quoted strings, picking up on the macro calls. It does a linear search thru the arg list on every potential symbol. Profiling might say that something smarter should happen. */ if (limit < buf) abort (); /* Find the beginning of the trailing whitespace. */ p = buf; while (p < limit && is_space[(int) limit[-1]]) { limit--; } /* Allocate space for the text in the macro definition. Leading and trailing whitespace chars need 2 bytes each. Each other input char may or may not need 1 byte, so this is an upper bound. The extra 5 are for invented leading and trailing newline-marker and final null. */ maxsize = (sizeof (*defn) + (limit - p) + 5); /* Occurrences of '@' get doubled, so allocate extra space for them. */ while (p < limit) { if (*p++ == '@') { maxsize++; } } defn = (DEFINITION *) dmalloc (maxsize); defn->noExpand = FALSE; defn->file = NULL; defn->pattern = NULL; defn->nargs = nargs; defn->predefined = NULL; exp_p = defn->expansion = (char *) defn + sizeof (*defn); *defn->expansion = '\0'; /* convince splint it is initialized */ defn->line = 0; defn->rest_args = NULL; defn->args.argnames = NULL; lastp = exp_p; p = buf; /* Add one initial space escape-marker to prevent accidental token-pasting (often removed by cpplib_macroExpand). */ *exp_p++ = '@'; *exp_p++ = ' '; if (limit - p >= 2 && p[0] == '#' && p[1] == '#') { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("`##' at start of macro definition")); p += 2; } /* Process the main body of the definition. */ while (p < limit) { int skipped_arg = 0; register char c = *p++; *exp_p++ = c; if (!cppReader_isTraditional (pfile)) { switch (c) { case '\'': case '\"': if (expected_delimiter != '\0') { if (c == expected_delimiter) expected_delimiter = '\0'; } else { expected_delimiter = c; } /*@switchbreak@*/ break; case '\\': if (p < limit && (expected_delimiter != '\0')) { /* In a string, backslash goes through and makes next char ordinary. */ *exp_p++ = *p++; } /*@switchbreak@*/ break; case '@': /* An '@' in a string or character constant stands for itself, and does not need to be escaped. */ if (expected_delimiter == '\0') { *exp_p++ = c; } /*@switchbreak@*/ break; case '#': /* # is ordinary inside a string. */ if (expected_delimiter != '\0') { /*@switchbreak@*/ break; } if (p < limit && *p == '#') { /* ##: concatenate preceding and following tokens. */ /* Take out the first #, discard preceding whitespace. */ exp_p--; /*@-usedef@*/ while (exp_p > lastp && is_hor_space[(int) exp_p[-1]]) { --exp_p; } /*@=usedef@*/ /* Skip the second #. */ p++; /* Discard following whitespace. */ SKIP_WHITE_SPACE (p); concat = p; if (p == limit) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("`##' at end of macro definition")); } } else if (nargs >= 0) { /* Single #: stringify following argument ref. Don't leave the # in the expansion. */ exp_p--; SKIP_WHITE_SPACE (p); if (p == limit || ! is_idstart[(int) *p] || (*p == 'L' && p + 1 < limit && (p[1] == '\'' || p[1] == '\"'))) cppReader_errorLit (pfile, cstring_makeLiteralTemp ("`#' operator is not followed by a macro argument name")); else stringify = p; } else { ; /* BADBRANCH; */ } /*@switchbreak@*/ break; } } else { /* In -traditional mode, recognize arguments inside strings and and character constants, and ignore special properties of #. Arguments inside strings are considered "stringified", but no extra quote marks are supplied. */ switch (c) { case '\'': case '\"': if (expected_delimiter != '\0') { if (c == expected_delimiter) expected_delimiter = '\0'; } else expected_delimiter = c; /*@switchbreak@*/ break; case '\\': /* Backslash quotes delimiters and itself, but not macro args. */ if (expected_delimiter != '\0' && p < limit && (*p == expected_delimiter || *p == '\\')) { *exp_p++ = *p++; continue; } /*@switchbreak@*/ break; case '/': if (expected_delimiter != '\0') /* No comments inside strings. */ /*@switchbreak@*/ break; if (*p == '*') { /* If we find a comment that wasn't removed by cppReader_handleDirective, this must be -traditional. So replace the comment with nothing at all. */ exp_p--; p += 1; while (p < limit && !(p[-2] == '*' && p[-1] == '/')) { p++; } } /*@switchbreak@*/ break; } } /* Handle the start of a symbol. */ if (is_idchar[(int) c] && nargs > 0) { char *id_beg = p - 1; size_t id_len; --exp_p; while (p != limit && is_idchar[(int) *p]) { p++; } id_len = size_fromInt (p - id_beg); if (is_idstart[(int) c] && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '\"'))) { register struct arglist *arg; for (arg = arglist; arg != NULL; arg = arg->next) { struct reflist *tpat; if (arg->name[0] == c && arg->length == id_len && strncmp (arg->name, id_beg, id_len) == 0) { char *p1; if (expected_delimiter && CPPOPTIONS (pfile)->warn_stringify) { if (cppReader_isTraditional (pfile)) { cppReader_warning (pfile, message ("macro argument `%x' is stringified.", cstring_prefix (cstring_fromChars (arg->name), id_len))); } else { cppReader_warning (pfile, message ("macro arg `%x' would be stringified with -traditional.", cstring_prefix (cstring_fromChars (arg->name), id_len))); } } /* If ANSI, don't actually substitute inside a string. */ if (!cppReader_isTraditional (pfile) && expected_delimiter) /*@innerbreak@*/ break; /* make a pat node for this arg and append it to the end of the pat list */ tpat = (struct reflist *) dmalloc (sizeof (*tpat)); tpat->next = NULL; tpat->raw_before = (concat == id_beg); tpat->raw_after = 0; tpat->rest_args = arg->rest_args; tpat->stringify = (cppReader_isTraditional (pfile) ? expected_delimiter != '\0' : stringify == id_beg); if (endpat == NULL) { defn->pattern = tpat; } else { endpat->next = tpat; /*@-branchstate@*/ } /*@=branchstate@*/ /* evs 2000 was =branchstate */ endpat = tpat; tpat->argno = arg->argno; tpat->nchars = exp_p - lastp; p1 = p; SKIP_WHITE_SPACE (p1); if (p1 + 2 <= limit && p1[0] == '#' && p1[1] == '#') { tpat->raw_after = 1; } lastp = exp_p; /* place to start copying from next time */ skipped_arg = 1; /*@innerbreak@*/ break; } } } /* If this was not a macro arg, copy it into the expansion. */ if (skipped_arg == 0) { register char *lim1 = p; p = id_beg; while (p != lim1) { *exp_p++ = *p++; } if (stringify == id_beg) cppReader_errorLit (pfile, cstring_makeLiteralTemp ("`#' operator should be followed by a macro argument name")); } } } if (!cppReader_isTraditional (pfile) && expected_delimiter == '\0') { /* If ANSI, put in a "@ " marker to prevent token pasting. But not if "inside a string" (which in ANSI mode happens only for -D option). */ *exp_p++ = '@'; *exp_p++ = ' '; } *exp_p = '\0'; defn->length = size_fromInt (exp_p - defn->expansion); /* Crash now if we overrun the allocated size. */ if (defn->length + 1 > maxsize) { llfatalbug (cstring_makeLiteral ("Maximum definition size exceeded.")); } return defn; /* Spurious warning here */ } /* ** evans 2001-12-31 ** Gasp...cut-and-pasted from above to deal with pfile (should replace throughout with this...) */ static DEFINITION * collect_expansionLoc (fileloc loc, char *buf, char *limit, int nargs, /*@null@*/ struct arglist *arglist) { DEFINITION *defn; char *p, *lastp, *exp_p; struct reflist *endpat = NULL; /* Pointer to first nonspace after last ## seen. */ char *concat = 0; /* Pointer to first nonspace after last single-# seen. */ char *stringify = 0; size_t maxsize; char expected_delimiter = '\0'; /* Scan thru the replacement list, ignoring comments and quoted strings, picking up on the macro calls. It does a linear search thru the arg list on every potential symbol. Profiling might say that something smarter should happen. */ if (limit < buf) { llfatalbug (message ("%q: Limit is less than initial buffer pointer", fileloc_unparse (loc))); } /* Find the beginning of the trailing whitespace. */ p = buf; while (p < limit && is_space[(int) limit[-1]]) { limit--; } /* Allocate space for the text in the macro definition. Leading and trailing whitespace chars need 2 bytes each. Each other input char may or may not need 1 byte, so this is an upper bound. The extra 5 are for invented leading and trailing newline-marker and final null. */ maxsize = (sizeof (*defn) + (limit - p) + 5); /* Occurrences of '@' get doubled, so allocate extra space for them. */ while (p < limit) { if (*p++ == '@') { maxsize++; } } defn = (DEFINITION *) dmalloc (maxsize); defn->noExpand = FALSE; defn->file = NULL; defn->pattern = NULL; defn->nargs = nargs; defn->predefined = NULL; exp_p = defn->expansion = (char *) defn + sizeof (*defn); defn->line = 0; defn->rest_args = NULL; defn->args.argnames = NULL; lastp = exp_p; p = buf; /* Add one initial space escape-marker to prevent accidental token-pasting (often removed by cpplib_macroExpand). */ *exp_p++ = '@'; *exp_p++ = ' '; if (limit - p >= 2 && p[0] == '#' && p[1] == '#') { voptgenerror (FLG_PREPROC, cstring_makeLiteral ("Paste marker ## at start of macro definition"), loc); p += 2; } /* Process the main body of the definition. */ while (p < limit) { int skipped_arg = 0; register char c = *p++; *exp_p++ = c; if (TRUE) { /* !cppReader_isTraditional (pfile)) { */ switch (c) { case '\'': case '\"': if (expected_delimiter != '\0') { if (c == expected_delimiter) expected_delimiter = '\0'; } else { expected_delimiter = c; } /*@switchbreak@*/ break; case '\\': if (p < limit && (expected_delimiter != '\0')) { /* In a string, backslash goes through and makes next char ordinary. */ *exp_p++ = *p++; } /*@switchbreak@*/ break; case '@': /* An '@' in a string or character constant stands for itself, and does not need to be escaped. */ if (expected_delimiter == '\0') { *exp_p++ = c; } /*@switchbreak@*/ break; case '#': /* # is ordinary inside a string. */ if (expected_delimiter != '\0') { /*@switchbreak@*/ break; } if (p < limit && *p == '#') { /* ##: concatenate preceding and following tokens. */ /* Take out the first #, discard preceding whitespace. */ exp_p--; /*@-usedef@*/ while (exp_p > lastp && is_hor_space[(int) exp_p[-1]]) { --exp_p; } /*@=usedef@*/ /* Skip the second #. */ p++; /* Discard following whitespace. */ SKIP_WHITE_SPACE (p); concat = p; if (p == limit) { voptgenerror (FLG_PREPROC, cstring_makeLiteral ("`##' at end of macro definition"), loc); } } else if (nargs >= 0) { /* Single #: stringify following argument ref. Don't leave the # in the expansion. */ exp_p--; SKIP_WHITE_SPACE (p); if (p == limit || ! is_idstart[(int) *p] || (*p == 'L' && p + 1 < limit && (p[1] == '\'' || p[1] == '\"'))) { voptgenerror (FLG_PREPROC, cstring_makeLiteral ("`#' operator is not followed by a macro argument name"), loc); } else stringify = p; } else { ; /* BADBRANCH; */ } /*@switchbreak@*/ break; } } else { /* In -traditional mode, recognize arguments inside strings and and character constants, and ignore special properties of #. Arguments inside strings are considered "stringified", but no extra quote marks are supplied. */ switch (c) { case '\'': case '\"': if (expected_delimiter != '\0') { if (c == expected_delimiter) expected_delimiter = '\0'; } else expected_delimiter = c; /*@switchbreak@*/ break; case '\\': /* Backslash quotes delimiters and itself, but not macro args. */ if (expected_delimiter != '\0' && p < limit && (*p == expected_delimiter || *p == '\\')) { *exp_p++ = *p++; continue; } /*@switchbreak@*/ break; case '/': if (expected_delimiter != '\0') /* No comments inside strings. */ /*@switchbreak@*/ break; if (*p == '*') { /* If we find a comment that wasn't removed by cppReader_handleDirective, this must be -traditional. So replace the comment with nothing at all. */ exp_p--; p += 1; while (p < limit && !(p[-2] == '*' && p[-1] == '/')) { p++; } } /*@switchbreak@*/ break; } } /* Handle the start of a symbol. */ if (is_idchar[(int) c] && nargs > 0) { char *id_beg = p - 1; size_t id_len; --exp_p; while (p != limit && is_idchar[(int) *p]) { p++; } id_len = size_fromInt (p - id_beg); if (is_idstart[(int) c] && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '\"'))) { register struct arglist *arg; for (arg = arglist; arg != NULL; arg = arg->next) { struct reflist *tpat; if (arg->name[0] == c && arg->length == id_len && strncmp (arg->name, id_beg, id_len) == 0) { char *p1; if (expected_delimiter) { /* && CPPOPTIONS (pfile)->warn_stringify) { */ if (FALSE) { /* cppReader_isTraditional (pfile)) { */ voptgenerror (FLG_PREPROC, message ("macro argument `%x' is stringified.", cstring_prefix (cstring_fromChars (arg->name), id_len)), loc); } else { voptgenerror (FLG_PREPROC, message ("Macro arg `%x' would be stringified with -traditional.", cstring_prefix (cstring_fromChars (arg->name), id_len)), loc); } } /* If ANSI, don't actually substitute inside a string. */ if (TRUE /* !cppReader_isTraditional (pfile) */ && expected_delimiter) /*@innerbreak@*/ break; /* make a pat node for this arg and append it to the end of the pat list */ tpat = (struct reflist *) dmalloc (sizeof (*tpat)); tpat->next = NULL; tpat->raw_before = (concat == id_beg); tpat->raw_after = 0; tpat->rest_args = arg->rest_args; tpat->stringify = (FALSE /* cppReader_isTraditional (pfile) */ ? expected_delimiter != '\0' : stringify == id_beg); if (endpat == NULL) { defn->pattern = tpat; } else { endpat->next = tpat; /*@-branchstate@*/ } /*@=branchstate@*/ /* evs 2000 was =branchstate */ endpat = tpat; tpat->argno = arg->argno; tpat->nchars = exp_p - lastp; p1 = p; SKIP_WHITE_SPACE (p1); if (p1 + 2 <= limit && p1[0] == '#' && p1[1] == '#') { tpat->raw_after = 1; } lastp = exp_p; /* place to start copying from next time */ skipped_arg = 1; /*@innerbreak@*/ break; } } } /* If this was not a macro arg, copy it into the expansion. */ if (skipped_arg == 0) { register char *lim1 = p; p = id_beg; while (p != lim1) { *exp_p++ = *p++; } if (stringify == id_beg) { voptgenerror (FLG_PREPROC, cstring_makeLiteral ("# operator should be followed by a macro argument name"), loc); } } } } if (/*!cppReader_isTraditional (pfile) && */ expected_delimiter == '\0') { /* If ANSI, put in a "@ " marker to prevent token pasting. But not if "inside a string" (which in ANSI mode happens only for -D option). */ *exp_p++ = '@'; *exp_p++ = ' '; } *exp_p = '\0'; defn->length = size_fromInt (exp_p - defn->expansion); /* Crash now if we overrun the allocated size. */ if (defn->length + 1 > maxsize) { llfatalbug (cstring_makeLiteral ("Maximum definition size exceeded.")); } /*@-compdef@*/ /* defn->expansion defined? */ return defn; /*@=compdef@*/ } /* * special extension string that can be added to the last macro argument to * allow it to absorb the "rest" of the arguments when expanded. Ex: * #define wow(a, b...) process (b, a, b) * { wow (1, 2, 3); } -> { process (2, 3, 1, 2, 3); } * { wow (one, two); } -> { process (two, one, two); } * if this "rest_arg" is used with the concat token '##' and if it is not * supplied then the token attached to with ## will not be outputted. Ex: * #define wow (a, b...) process (b ## , a, ## b) * { wow (1, 2); } -> { process (2, 1, 2); } * { wow (one); } -> { process (one); { */ /*@-readonlytrans@*/ static char rest_extension[] = "..."; /*:=readonlytrans@*/ /*@notfunction@*/ #define REST_EXTENSION_LENGTH (sizeof (rest_extension) - 1) /* Create a DEFINITION node from a #define directive. Arguments are as for do_define. */ static /*@null@*/ macroDef create_definition (/*@exposed@*/ char *buf, char *limit, cppReader *pfile, bool predefinition, bool noExpand) { char *bp; /* temp ptr into input buffer */ char *symname; /* remember where symbol name starts */ size_t sym_length; /* and how long it is */ int rest_args = 0; /* really int! */ int line; int col; cstring file = (CPPBUFFER (pfile) != NULL) ? CPPBUFFER (pfile)->nominal_fname : cstring_makeLiteralTemp (""); DEFINITION *defn; int arglengths = 0; /* Accumulate lengths of arg names plus number of args. */ macroDef mdef; char save = *limit; *limit = '\0'; DPRINTF (("Create definition: %s", buf)); *limit = save; cppBuffer_getLineAndColumn (CPPBUFFER (pfile), &line, &col); bp = buf; while (is_hor_space[(int) *bp]) { bp++; } symname = bp; /* remember where it starts */ sym_length = cppReader_checkMacroName (pfile, bp, cstring_makeLiteralTemp ("macro")); bp += sym_length; /* Lossage will occur if identifiers or control keywords are broken across lines using backslash. This is not the right place to take care of that. */ if (*bp == '(') { struct arglist *arg_ptrs = NULL; int argno = 0; bp++; /* skip '(' */ SKIP_WHITE_SPACE (bp); /* Loop over macro argument names. */ while (*bp != ')') { struct arglist *temp = (struct arglist *) dmalloc (sizeof (*temp)); temp->name = bp; temp->next = arg_ptrs; temp->argno = argno++; temp->rest_args = 0; arg_ptrs = temp; if (rest_args != 0) { cppReader_pedwarn (pfile, message ("another parameter follows `%s'", cstring_fromChars (rest_extension))); } if (!is_idstart[(int) *bp]) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("Invalid character in macro parameter name")); } /* Find the end of the arg name. */ while (is_idchar[(int) *bp]) { bp++; /* do we have a "special" rest-args extension here? */ if (limit - bp > size_toInt (REST_EXTENSION_LENGTH) && strncmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) { rest_args = 1; temp->rest_args = 1; /*@innerbreak@*/ break; } } temp->length = size_fromInt (bp - temp->name); if (rest_args != 0) { bp += REST_EXTENSION_LENGTH; } arglengths += temp->length + 2; SKIP_WHITE_SPACE (bp); if (temp->length == 0 || (*bp != ',' && *bp != ')')) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Parameter list for #define is not parseable")); goto nope; } if (*bp == ',') { bp++; SKIP_WHITE_SPACE (bp); } if (bp >= limit) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("unterminated parameter list in `#define'")); goto nope; } { struct arglist *otemp; for (otemp = temp->next; otemp != NULL; otemp = otemp->next) { if (temp->length == otemp->length && strncmp (temp->name, otemp->name, temp->length) == 0) { cstring name = cstring_copyLength (temp->name, temp->length); cppReader_error (pfile, message ("duplicate argument name `%x' in `#define'", name)); goto nope; } } } } ++bp; /* skip paren */ SKIP_WHITE_SPACE (bp); /* now everything from bp before limit is the definition. */ defn = collect_expansion (pfile, bp, limit, argno, arg_ptrs); defn->rest_args = rest_args; /* Now set defn->args.argnames to the result of concatenating the argument names in reverse order with comma-space between them. */ defn->args.argnames = (char *) dmalloc (size_fromInt (arglengths + 1)); { struct arglist *temp; int i = 0; for (temp = arg_ptrs; temp != NULL; temp = temp->next) { memcpy (&defn->args.argnames[i], temp->name, temp->length); i += temp->length; if (temp->next != 0) { defn->args.argnames[i++] = ','; defn->args.argnames[i++] = ' '; } } defn->args.argnames[i] = '\0'; } sfree (arg_ptrs); } else { /* Simple expansion or empty definition. */ if (bp < limit) { if (is_hor_space[(int) *bp]) { bp++; SKIP_WHITE_SPACE (bp); } else { switch (*bp) { case '!': case '\"': case '#': case '%': case '&': case '\'': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '?': case '[': case '\\': case ']': case '^': case '{': case '|': case '}': case '~': cppReader_warning (pfile, message ("Missing white space after #define %x", cstring_prefix (cstring_fromChars (symname), sym_length))); break; default: cppReader_pedwarn (pfile, message ("Missing white space after #define %x", cstring_prefix (cstring_fromChars (symname), sym_length))); break; } } } /* now everything from bp before limit is the definition. */ defn = collect_expansion (pfile, bp, limit, -1, NULL); defn->args.argnames = mstring_createEmpty (); } defn->noExpand = noExpand; DPRINTF (("No expand: %d", noExpand)); defn->line = line; /* not: llassert (cstring_isUndefined (defn->file)); */ defn->file = file; /* OP is null if this is a predefinition */ defn->predefined = predefinition; mdef.defn = defn; mdef.symnam = symname; mdef.symlen = sym_length; return mdef; nope: mdef.defn = NULL; mdef.symnam = NULL; return mdef; } /*@null@*/ macroDef cpplib_createDefinition (cstring def, fileloc loc, bool predefinition, bool noExpand) { char *buf = cstring_toCharsSafe (def); char *limit = buf + cstring_length (def); char *bp; /* temp ptr into input buffer */ char *symname; /* remember where symbol name starts */ size_t sym_length; /* and how long it is */ int rest_args = 0; /* really int! */ int line = fileloc_lineno (loc); cstring file = fileloc_filename (loc); DEFINITION *defn; int arglengths = 0; /* Accumulate lengths of arg names plus number of args. */ macroDef mdef; bp = buf; DPRINTF (("Creating definition: %s", buf)); while (is_hor_space[(int) *bp]) { bp++; } symname = bp; /* remember where it starts */ sym_length = cppReader_checkMacroNameLoc (loc, symname, cstring_makeLiteralTemp ("macro")); DPRINTF (("length: %d", sym_length)); bp += sym_length; DPRINTF (("Here: %s", bp)); /* Lossage will occur if identifiers or control keywords are broken across lines using backslash. This is not the right place to take care of that. */ if (*bp == '(') { struct arglist *arg_ptrs = NULL; int argno = 0; bp++; /* skip '(' */ SKIP_WHITE_SPACE (bp); /* Loop over macro argument names. */ while (*bp != ')') { struct arglist *temp = (struct arglist *) dmalloc (sizeof (*temp)); temp->name = bp; temp->next = arg_ptrs; temp->argno = argno++; temp->rest_args = 0; arg_ptrs = temp; if (rest_args != 0) { voptgenerror (FLG_PREPROC, message ("Another parameter follows %s", cstring_fromChars (rest_extension)), loc); } if (!is_idstart[(int) *bp]) { voptgenerror (FLG_PREPROC, message ("Invalid character in macro parameter name: %c", *bp), loc); } /* Find the end of the arg name. */ while (is_idchar[(int) *bp]) { bp++; /* do we have a "special" rest-args extension here? */ if (limit - bp > size_toInt (REST_EXTENSION_LENGTH) && strncmp (rest_extension, bp, REST_EXTENSION_LENGTH) == 0) { rest_args = 1; temp->rest_args = 1; /*@innerbreak@*/ break; } } temp->length = size_fromInt (bp - temp->name); if (rest_args != 0) { bp += REST_EXTENSION_LENGTH; } arglengths += temp->length + 2; SKIP_WHITE_SPACE (bp); if (temp->length == 0 || (*bp != ',' && *bp != ')')) { voptgenerror (FLG_PREPROC, cstring_makeLiteral ("Parameter list for #define is not parseable"), loc); goto nope; } if (*bp == ',') { bp++; SKIP_WHITE_SPACE (bp); } if (bp >= limit) { voptgenerror (FLG_PREPROC, cstring_makeLiteral ("Unterminated parameter list in #define'"), loc); goto nope; } { struct arglist *otemp; for (otemp = temp->next; otemp != NULL; otemp = otemp->next) { if (temp->length == otemp->length && strncmp (temp->name, otemp->name, temp->length) == 0) { cstring name = cstring_copyLength (temp->name, temp->length); voptgenerror (FLG_PREPROC, message ("Duplicate argument name in #define: %s", name), loc); goto nope; } } } } ++bp; /* skip paren */ SKIP_WHITE_SPACE (bp); /* now everything from bp before limit is the definition. */ defn = collect_expansionLoc (loc, bp, limit, argno, arg_ptrs); defn->rest_args = rest_args; /* Now set defn->args.argnames to the result of concatenating the argument names in reverse order with comma-space between them. */ defn->args.argnames = (char *) dmalloc (size_fromInt (arglengths + 1)); { struct arglist *temp; int i = 0; for (temp = arg_ptrs; temp != NULL; temp = temp->next) { memcpy (&defn->args.argnames[i], temp->name, temp->length); i += temp->length; if (temp->next != 0) { defn->args.argnames[i++] = ','; defn->args.argnames[i++] = ' '; } } defn->args.argnames[i] = '\0'; } sfree (arg_ptrs); } else { /* Simple expansion or empty definition. */ if (bp < limit) { if (is_hor_space[(int) *bp]) { bp++; SKIP_WHITE_SPACE (bp); } else { switch (*bp) { case '!': case '\"': case '#': case '%': case '&': case '\'': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '?': case '[': case '\\': case ']': case '^': case '{': case '|': case '}': case '~': voptgenerror (FLG_PREPROC, message ("Missing white space after #define %x", cstring_prefix (cstring_fromChars (symname), sym_length)), loc); break; default: voptgenerror (FLG_PREPROC, message ("Missing white space after #define %x", cstring_prefix (cstring_fromChars (symname), sym_length)), loc); break; } } } /* now everything from bp before limit is the definition. */ llassert (limit > bp); defn = collect_expansionLoc (loc, bp, limit, -1, NULL); defn->args.argnames = mstring_createEmpty (); } defn->noExpand = noExpand; DPRINTF (("No expand: %d", noExpand)); defn->line = line; /* not: llassert (cstring_isUndefined (defn->file)); */ defn->file = file; /* OP is null if this is a predefinition */ defn->predefined = predefinition; mdef.defn = defn; mdef.symnam = symname; mdef.symlen = sym_length; return mdef; nope: mdef.defn = NULL; mdef.symnam = NULL; return mdef; } /* Check a purported macro name SYMNAME, and yield its length. USAGE is the kind of name this is intended for. */ size_t cppReader_checkMacroName (cppReader *pfile, char *symname, cstring usage) { char *p; size_t sym_length; for (p = symname; is_idchar[(int) *p]; p++) { ; } sym_length = size_fromInt (p - symname); if (sym_length == 0 || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '\"'))) { cppReader_error (pfile, message ("invalid %s name", usage)); } else if (!is_idstart[(int) *symname]) { char *msg = (char *) dmalloc (sym_length + 1); memcpy (msg, symname, sym_length); msg[sym_length] = '\0'; cppReader_error (pfile, message ("invalid %s name `%s'", usage, cstring_fromChars (msg))); sfree (msg); } else { if ((strncmp (symname, "defined", 7) == 0) && sym_length == 7) { cppReader_error (pfile, message ("invalid %s name `defined'", usage)); } } return sym_length; } /* ** evans 2001-12-31 ** Gasp...cut-and-pasted from above to deal with pfile (should replace throughout with this...) */ size_t cppReader_checkMacroNameLoc (fileloc loc, char *symname, cstring usage) { char *p; size_t sym_length; for (p = symname; is_idchar[(int) *p]; p++) { ; } sym_length = size_fromInt (p - symname); if (sym_length == 0 || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '\"'))) { voptgenerror (FLG_PREPROC, message ("Invalid %s name: %s", usage, cstring_fromChars (symname)), loc); } else if (!is_idstart[(int) *symname]) { char *msg = (char *) dmalloc (sym_length + 1); memcpy (msg, symname, sym_length); msg[sym_length] = '\0'; voptgenerror (FLG_PREPROC, message ("Invalid %s name: %s", usage, cstring_fromChars (msg)), loc); sfree (msg); } else { if ((strncmp (symname, "defined", 7) == 0) && sym_length == 7) { voptgenerror (FLG_PREPROC, message ("Invalid %s name: defined", usage), loc); } } return sym_length; } /* Return zero if two DEFINITIONs are isomorphic. */ static bool compare_defs (DEFINITION *d1, DEFINITION *d2) { register struct reflist *a1, *a2; register char *p1 = d1->expansion; register char *p2 = d2->expansion; bool first = TRUE; if (d1->nargs != d2->nargs) { return TRUE; } llassert (d1->args.argnames != NULL); llassert (d2->args.argnames != NULL); if (strcmp ((char *)d1->args.argnames, (char *)d2->args.argnames) != 0) { return TRUE; } for (a1 = d1->pattern, a2 = d2->pattern; (a1 != NULL) && (a2 != NULL); a1 = a1->next, a2 = a2->next) { if (!((a1->nchars == a2->nchars && (strncmp (p1, p2, size_fromInt (a1->nchars)) == 0)) || ! comp_def_part (first, p1, a1->nchars, p2, a2->nchars, 0)) || a1->argno != a2->argno || a1->stringify != a2->stringify || a1->raw_before != a2->raw_before || a1->raw_after != a2->raw_after) return TRUE; first = 0; p1 += a1->nchars; p2 += a2->nchars; } if (a1 != a2) return TRUE; if (comp_def_part (first, p1, size_toInt (d1->length - (p1 - d1->expansion)), p2, size_toInt (d2->length - (p2 - d2->expansion)), 1)) return TRUE; return FALSE; } /* ** Return TRUE if two parts of two macro definitions are effectively different. ** One of the parts starts at BEG1 and has LEN1 chars; ** the other has LEN2 chars at BEG2. ** Any sequence of whitespace matches any other sequence of whitespace. ** FIRST means these parts are the first of a macro definition; ** so ignore leading whitespace entirely. ** LAST means these parts are the last of a macro definition; ** so ignore trailing whitespace entirely. */ static bool comp_def_part (bool first, char *beg1, int len1, char *beg2, int len2, bool last) { char *end1 = beg1 + len1; char *end2 = beg2 + len2; if (first) { while (beg1 != end1 && is_space[(int) *beg1]) { beg1++; } while (beg2 != end2 && is_space[(int) *beg2]) { beg2++; } } if (last) { while (beg1 != end1 && is_space[(int) end1[-1]]) { end1--; } while (beg2 != end2 && is_space[(int) end2[-1]]) { end2--; } } while (beg1 != end1 && beg2 != end2) { if (is_space[(int) *beg1] && is_space[(int) *beg2]) { while (beg1 != end1 && is_space[(int) *beg1]) { beg1++; } while (beg2 != end2 && is_space[(int) *beg2]) { beg2++; } } else if (*beg1 == *beg2) { beg1++; beg2++; } else break; } return (beg1 != end1) || (beg2 != end2); } /* ** Process a #define command. ** BUF points to the contents of the #define command, as a contiguous string. ** LIMIT points to the first character past the end of the definition. ** KEYWORD is the keyword-table entry for #define, ** or NULL for a "predefined" macro. */ static int do_defineAux (cppReader *pfile, struct directive *keyword, /*@exposed@*/ char *buf, char *limit, bool noExpand) { int hashcode; macroDef mdef; hashNode hp; mdef = create_definition (buf, limit, pfile, keyword == NULL, noExpand); if (mdef.defn == 0) goto nope; hashcode = cpphash_hashCode (mdef.symnam, mdef.symlen, CPP_HASHSIZE); if ((hp = cpphash_lookup (mdef.symnam, size_toInt (mdef.symlen), hashcode)) != NULL) { bool ok = FALSE; /* Redefining a precompiled key is ok. */ if (hp->type == T_PCSTRING) ok = TRUE; /* Redefining a macro is ok if the definitions are the same. */ else if (hp->type == T_MACRO) ok = !compare_defs (mdef.defn, hp->value.defn); /* Redefining a constant is ok with -D. */ else if (hp->type == T_CONST) ok = !CPPOPTIONS (pfile)->done_initializing; else { ok = FALSE; /* Redefining anything else is bad. */ } /* Print the warning if it's not ok. */ if (!ok) { /* ** If we are passing through #define and #undef directives, do ** that for this re-definition now. */ if (CPPOPTIONS (pfile)->debug_output && (keyword != NULL)) { /* llassert (keyword != NULL); */ pass_thru_directive (buf, limit, pfile, keyword); } cpp_setLocation (pfile); if (hp->type == T_MACRO) { if (hp->value.defn->noExpand) { ; /* error will be reported checking macros */ } else { genppllerrorhint (FLG_MACROREDEF, message ("Macro %q already defined", cstring_copyLength (mdef.symnam, mdef.symlen)), message ("%q: Previous definition of %q", fileloc_unparseRaw (hp->value.defn->file, (int) hp->value.defn->line), cstring_copyLength (mdef.symnam, mdef.symlen))); } } else { genppllerror (FLG_MACROREDEF, message ("Macro %q already defined", cstring_copyLength (mdef.symnam, mdef.symlen))); } } /* Replace the old definition. */ hp->type = T_MACRO; hp->value.defn = mdef.defn; } else { /* ** If we are passing through #define and #undef directives, do ** that for this new definition now. */ hashNode hn; if (CPPOPTIONS (pfile)->debug_output && (keyword != NULL)) { pass_thru_directive (buf, limit, pfile, keyword); } DPRINTF (("Define macro: %s / %d", mdef.symnam, mdef.defn->noExpand)); hn = cpphash_installMacro (mdef.symnam, mdef.symlen, mdef.defn, hashcode); /*@-branchstate@*/ } /*@=branchstate@*/ return 0; nope: return 1; } static int do_define (cppReader *pfile, struct directive *keyword, /*@exposed@*/ char *buf, char *limit) { DPRINTF (("Regular do define")); return do_defineAux (pfile, keyword, buf, limit, FALSE); } /* ** This structure represents one parsed argument in a macro call. ** `raw' points to the argument text as written (`raw_length' is its length). ** `expanded' points to the argument's macro-expansion ** (its length is `expand_length'). ** `stringified_length' is the length the argument would have ** if stringified. ** `use_count' is the number of times this macro arg is substituted ** into the macro. If the actual use count exceeds 10, ** the value stored is 10. */ /* raw and expanded are relative to ARG_BASE */ /*@notfunction@*/ #define ARG_BASE ((pfile)->token_buffer) struct argdata { /* Strings relative to pfile->token_buffer */ long raw; size_t expanded; size_t stringified; int raw_length; int expand_length; int stringified_length; bool newlines; int use_count; }; /* ** Allocate a new cppBuffer for PFILE, and push it on the input buffer stack. ** If BUFFER != NULL, then use the LENGTH characters in BUFFER ** as the new input buffer. ** Return the new buffer, or NULL on failure. */ /*@null@*/ /*@exposed@*/ cppBuffer * cppReader_pushBuffer (cppReader *pfile, char *buffer, size_t length) { cppBuffer *buf = cppReader_getBufferSafe (pfile); if (buf == pfile->buffer_stack) { cppReader_fatalError (pfile, message ("%s: macro or `#include' recursion too deep", (buf->fname != NULL) ? buf->fname : cstring_makeLiteral (""))); sfreeEventually (buffer); return NULL; } llassert (buf != NULL); buf--; memset ((char *) buf, 0, sizeof (*buf)); DPRINTF (("Pushing buffer: %s", cstring_copyLength (buffer, length))); CPPBUFFER (pfile) = buf; buf->if_stack = pfile->if_stack; buf->cleanup = cppReader_nullCleanup; buf->underflow = cppReader_nullUnderflow; buf->buf = buffer; buf->cur = buf->buf; if (buffer != NULL) { buf->alimit = buf->rlimit = buffer + length; } else { buf->alimit = buf->rlimit = NULL; } return buf; } cppBuffer * cppReader_popBuffer (cppReader *pfile) { cppBuffer *buf = CPPBUFFER (pfile); llassert (buf != NULL); (void) (*buf->cleanup) (buf, pfile); return ++CPPBUFFER (pfile); } /* ** Scan until CPPBUFFER (PFILE) is exhausted into PFILE->token_buffer. ** Pop the buffer when done. */ void cppReader_scanBuffer (cppReader *pfile) { cppBuffer *buffer = CPPBUFFER (pfile); for (;;) { enum cpp_token token; token = cpplib_getToken (pfile); if (token == CPP_EOF) /* Should not happen ... */ { break; } if (token == CPP_POP && CPPBUFFER (pfile) == buffer) { (void) cppReader_popBuffer (pfile); break; } } } /* * Rescan a string (which may have escape marks) into pfile's buffer. * Place the result in pfile->token_buffer. * * The input is copied before it is scanned, so it is safe to pass * it something from the token_buffer that will get overwritten * (because it follows cpplib_getWritten). This is used by do_include. */ static void cpp_expand_to_buffer (cppReader *pfile, char *buf, size_t length) { register cppBuffer *ip; char *limit = buf + length; char *buf1, *p1, *p2; DPRINTF (("Expand to buffer: %s", cstring_copyLength (buf, length))); /* evans - 2001-08-26 ** length is unsigned - this doesn't make sense if (length < 0) abort (); ** */ /* Set up the input on the input stack. */ buf1 = (char *) dmalloc (length + 1); p1 = buf; p2 = buf1; while (p1 != limit) { *p2++ = *p1++; } buf1[length] = '\0'; ip = cppReader_pushBuffer (pfile, buf1, length); if (ip == NULL) return; ip->has_escapes = TRUE; /* Scan the input, create the output. */ cppReader_scanBuffer (pfile); cppReader_nullTerminate (pfile); } static void adjust_position (char *buf, char *limit, int *linep, int *colp) { while (buf < limit) { char ch = *buf++; if (ch == '\n') (*linep)++, (*colp) = 1; else (*colp)++; } } /* Move line_base forward, updating lineno and colno. */ static void update_position (cppBuffer *pbuf) { char *old_pos; char *new_pos = pbuf->cur; register struct parse_marker *mark; llassert (pbuf->buf != NULL); old_pos = pbuf->buf + pbuf->line_base; for (mark = pbuf->marks; mark != NULL; mark = mark->next) { if (pbuf->buf + mark->position < new_pos) new_pos = pbuf->buf + mark->position; } pbuf->line_base += new_pos - old_pos; llassert (old_pos != NULL); llassert (new_pos != NULL); adjust_position (old_pos, new_pos, &pbuf->lineno, &pbuf->colno); } void cppBuffer_getLineAndColumn (/*@null@*/ cppBuffer *pbuf, /*@out@*/ int *linep, /*@null@*/ /*@out@*/ int *colp) { int dummy; if (colp == NULL) { colp = &dummy; /*@-branchstate@*/ } /*@=branchstate@*/ if (pbuf != NULL) { *linep = pbuf->lineno; *colp = pbuf->colno; llassert (pbuf->buf != NULL); llassert (pbuf->cur != NULL); adjust_position (pbuf->buf + pbuf->line_base, pbuf->cur, linep, colp); } else { *linep = 0; *colp = 0; } } /* Return the cppBuffer that corresponds to a file (not a macro). */ /*@exposed@*/ /*@null@*/ cppBuffer *cppReader_fileBuffer (cppReader *pfile) { cppBuffer *ip = cppReader_getBuffer (pfile); for ( ; ip != NULL && ip != cppReader_nullBuffer (pfile); ip = cppBuffer_prevBuffer (ip)) { if (ip->fname != NULL) { return ip; } } return NULL; } static long count_newlines (char *buf, char *limit) { register long count = 0; while (buf < limit) { char ch = *buf++; if (ch == '\n') count++; } return count; } /* * write out a #line command, for instance, after an #include file. * If CONDITIONAL is nonzero, we can omit the #line if it would * appear to be a no-op, and we can output a few newlines instead * if we want to increase the line number by a small amount. * FILE_CHANGE says whether we are entering a file, leaving, or neither. */ static void output_line_command (cppReader *pfile, bool conditional, enum file_change_code file_change) { int line, col; cppBuffer *ip = CPPBUFFER (pfile); cppBuffer *buf; llassert (ip != NULL); if (ip->fname == NULL) return; update_position (ip); if (CPPOPTIONS (pfile)->no_line_commands || CPPOPTIONS (pfile)->no_output) return; buf = CPPBUFFER (pfile); llassert (buf != NULL); line = buf->lineno; col = buf->colno; llassert (ip->cur != NULL); adjust_position (cppLineBase (ip), ip->cur, &line, &col); if (CPPOPTIONS (pfile)->no_line_commands) return; if (conditional) { if (line == pfile->lineno) return; /* If the inherited line number is a little too small, output some newlines instead of a #line command. */ if (line > pfile->lineno && line < pfile->lineno + 8) { cpplib_reserve (pfile, 20); while (line > pfile->lineno) { cppReader_putCharQ (pfile, '\n'); pfile->lineno++; } return; } } cpplib_reserve (pfile, 4 * cstring_length (ip->nominal_fname) + 50); { #ifdef OUTPUT_LINE_COMMANDS static char sharp_line[] = "#line "; #else static char sharp_line[] = "# "; #endif cppReader_putStrN (pfile, sharp_line, sizeof(sharp_line)-1); } sprintf (cpplib_getPWritten (pfile), "%d ", line); cppReader_adjustWritten (pfile, strlen (cpplib_getPWritten (pfile))); quote_string (pfile, cstring_toCharsSafe (ip->nominal_fname)); if (file_change != same_file) { cppReader_putCharQ (pfile, ' '); cppReader_putCharQ (pfile, file_change == enter_file ? '1' : '2'); } /* Tell cc1 if following text comes from a system header file. */ if (ip->system_header_p != '\0') { cppReader_putCharQ (pfile, ' '); cppReader_putCharQ (pfile, '3'); } #ifndef NO_IMPLICIT_EXTERN_C /* Tell cc1plus if following text should be treated as C. */ if (ip->system_header_p == (char) 2 && CPPOPTIONS (pfile)->cplusplus) { cppReader_putCharQ (pfile, ' '); cppReader_putCharQ (pfile, '4'); } #endif cppReader_putCharQ (pfile, '\n'); pfile->lineno = line; } /* * Parse a macro argument and append the info on PFILE's token_buffer. * REST_ARGS means to absorb the rest of the args. * Return nonzero to indicate a syntax error. */ static enum cpp_token macarg (cppReader *pfile, int rest_args) { int paren = 0; enum cpp_token token; char save_put_out_comments = CPPOPTIONS (pfile)->put_out_comments; bool oldexpand = pfile->no_macro_expand; CPPOPTIONS (pfile)->put_out_comments = 1; /* Try to parse as much of the argument as exists at this input stack level. */ pfile->no_macro_expand = TRUE; for (;;) { token = cpplib_getToken (pfile); switch (token) { case CPP_EOF: goto done; case CPP_POP: /* If we've hit end of file, it's an error (reported by caller). Ditto if it's the end of cpp_expand_to_buffer text. If we've hit end of macro, just continue. */ if (!cppBuffer_isMacro (CPPBUFFER (pfile))) goto done; /*@switchbreak@*/ break; case CPP_LPAREN: paren++; /*@switchbreak@*/ break; case CPP_RPAREN: if (--paren < 0) goto found; /*@switchbreak@*/ break; case CPP_COMMA: /* if we've returned to lowest level and we aren't absorbing all args */ if (paren == 0 && rest_args == 0) goto found; /*@switchbreak@*/ break; found: /* Remove ',' or ')' from argument buffer. */ cppReader_adjustWritten (pfile, -1); goto done; default: ; } } done: CPPOPTIONS (pfile)->put_out_comments = save_put_out_comments; pfile->no_macro_expand = oldexpand; return token; } /* Turn newlines to spaces in the string of length LENGTH at START, except inside of string constants. The string is copied into itself with its beginning staying fixed. */ static int change_newlines (char *start, int length) { register char *ibp; register char *obp; register char *limit; char c; ibp = start; limit = start + length; obp = start; while (ibp < limit) { *obp++ = c = *ibp++; switch (c) { case '\'': case '\"': /* Notice and skip strings, so that we don't delete newlines in them. */ { char quotec = c; while (ibp < limit) { *obp++ = c = *ibp++; if (c == quotec) /*@innerbreak@*/ break; if (c == '\n' && quotec == '\'') /*@innerbreak@*/ break; } } /*@switchbreak@*/ break; } } return obp - start; } static /*@observer@*/ struct tm * timestamp (/*@returned@*/ cppReader *pfile) { if (pfile->timebuf == NULL) { time_t t = time ((time_t *) 0); pfile->timebuf = localtime (&t); } llassert (pfile->timebuf != NULL); return pfile->timebuf; } static ob_mstring monthnames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", } ; /* * expand things like __FILE__. Place the expansion into the output * buffer *without* rescanning. */ static void special_symbol (hashNode hp, cppReader *pfile) { cstring buf = cstring_undefined; size_t len; int true_indepth; cppBuffer *ip; struct tm *timebuf; int paren = 0; /* For special `defined' keyword */ for (ip = cppReader_getBuffer (pfile); ip != NULL; ip = cppBuffer_prevBuffer (ip)) { if (ip == cppReader_nullBuffer (pfile)) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("cccp error: not in any file?!")); return; /* the show must go on */ } if (ip != NULL && ip->fname != NULL) { break; } } switch (hp->type) { case T_FILE: case T_BASE_FILE: { char *string; if (hp->type == T_BASE_FILE) { while (cppBuffer_prevBuffer (ip) != cppReader_nullBuffer (pfile)) { ip = cppBuffer_prevBuffer (ip); } } llassert (ip != NULL); string = cstring_toCharsSafe (ip->nominal_fname); if (string == NULL) { string = ""; } cpplib_reserve (pfile, 3 + 4 * strlen (string)); quote_string (pfile, string); return; } case T_FUNC: /* added in ISO C99 */ { /* We don't know the actual name of the function, but it doesn't matter */ char *string = "** function-name **"; cpplib_reserve (pfile, 3 + 4 * strlen (string)); quote_string (pfile, string); return; } case T_INCLUDE_LEVEL: true_indepth = 0; ip = cppReader_getBuffer (pfile); for (; ip != cppReader_nullBuffer (pfile) && ip != NULL; ip = cppBuffer_prevBuffer (ip)) { if (ip != NULL && ip->fname != NULL) { true_indepth++; } } buf = message ("%d", true_indepth - 1); break; case T_VERSION: buf = cstring_makeLiteral ("\"--- cpp version---\""); break; #ifndef NO_BUILTIN_SIZE_TYPE case T_SIZE_TYPE: buf = cstring_makeLiteral (SIZE_TYPE); break; #endif #ifndef NO_BUILTIN_PTRDIFF_TYPE case T_PTRDIFF_TYPE: buf = cstring_makeLiteral (PTRDIFF_TYPE); break; #endif case T_WCHAR_TYPE: buf = cstring_makeLiteral (cppReader_wcharType (pfile)); break; case T_USER_LABEL_PREFIX_TYPE: buf = cstring_makeLiteral (USER_LABEL_PREFIX); break; case T_REGISTER_PREFIX_TYPE: buf = cstring_makeLiteral (REGISTER_PREFIX); break; case T_CONST: buf = message ("%d", hp->value.ival); break; case T_SPECLINE: { if (ip != NULL) { int line = ip->lineno; int col = ip->colno; llassert (ip->cur != NULL); adjust_position (cppLineBase (ip), ip->cur, &line, &col); buf = message ("%d", (int) line); } else { BADBRANCH; } } break; case T_DATE: case T_TIME: { char *sbuf = (char *) dmalloc (20); timebuf = timestamp (pfile); if (hp->type == T_DATE) { sprintf (sbuf, "\"%s %2d %4d\"", monthnames[timebuf->tm_mon], timebuf->tm_mday, timebuf->tm_year + 1900); } else { sprintf (sbuf, "\"%02d:%02d:%02d\"", timebuf->tm_hour, timebuf->tm_min, timebuf->tm_sec); } buf = cstring_fromCharsNew (sbuf); sfree (sbuf); break; } case T_SPEC_DEFINED: buf = cstring_makeLiteral (" 0 "); /* Assume symbol is not defined */ ip = cppReader_getBuffer (pfile); llassert (ip != NULL); llassert (ip->cur != NULL); SKIP_WHITE_SPACE (ip->cur); if (*ip->cur == '(') { paren++; ip->cur++; /* Skip over the paren */ SKIP_WHITE_SPACE (ip->cur); } if (!is_idstart[(int) *ip->cur]) goto oops; if (ip->cur[0] == 'L' && (ip->cur[1] == '\'' || ip->cur[1] == '\"')) goto oops; if ((hp = cpphash_lookup (ip->cur, -1, -1)) != 0) { cstring_free (buf); buf = cstring_makeLiteral (" 1 "); } while (is_idchar[(int) *ip->cur]) { ++ip->cur; } SKIP_WHITE_SPACE (ip->cur); if (paren != 0) { if (*ip->cur != ')') goto oops; ++ip->cur; } break; oops: cppReader_errorLit (pfile, cstring_makeLiteralTemp ("`defined' without an identifier")); break; default: cpp_setLocation (pfile); llfatalerror (message ("Pre-processing error: invalid special hash type")); } len = cstring_length (buf); cpplib_reserve (pfile, len + 1); cppReader_putStrN (pfile, cstring_toCharsSafe (buf), len); cppReader_nullTerminateQ (pfile); cstring_free (buf); return; } /* Write out a #define command for the special named MACRO_NAME to PFILE's token_buffer. */ static void dump_special_to_buffer (cppReader *pfile, char *macro_name) { static char define_directive[] = "#define "; size_t macro_name_length = strlen (macro_name); output_line_command (pfile, 0, same_file); cpplib_reserve (pfile, sizeof(define_directive) + macro_name_length); cppReader_putStrN (pfile, define_directive, sizeof(define_directive)-1); cppReader_putStrN (pfile, macro_name, macro_name_length); cppReader_putCharQ (pfile, ' '); cpp_expand_to_buffer (pfile, macro_name, macro_name_length); cppReader_putChar (pfile, '\n'); } /* Initialize the built-in macros. */ static void cpplib_installBuiltin (/*@observer@*/ char *name, ctype ctyp, int len, enum node_type type, int ivalue, /*@null@*/ /*@only@*/ char *value, int hash) { cstring sname = cstring_fromCharsNew (name); llassert (usymtab_inGlobalScope ()); /* ** Be careful here: this is done before the ctype table has ** been initialized. */ if (!usymtab_exists (sname)) { uentry ue = uentry_makeConstant (sname, ctyp, fileloc_createBuiltin ()); if (ctype_equal (ctyp, ctype_string)) { qualList ql = qualList_new (); ql = qualList_add (ql, qual_createObserver ()); uentry_reflectQualifiers (ue, ql); qualList_free (ql); } usymtab_addGlobalEntry (ue); } else { ; } (void) cpphash_install (name, len, type, ivalue, value, hash); cstring_free (sname); } static void cpplib_installBuiltinType (/*@observer@*/ char *name, ctype ctyp, int len, enum node_type type, int ivalue, /*@only@*/ /*@null@*/ char *value, int hash) { cstring sname = cstring_fromChars (name); /* evs 2000 07 10 - removed a memory leak, detected by splint */ llassert (usymtab_inGlobalScope ()); if (!usymtab_existsTypeEither (sname)) { uentry ue = uentry_makeDatatype (sname, ctyp, NO, qual_createConcrete (), fileloc_createBuiltin ()); llassert (!usymtab_existsEither (sname)); usymtab_addGlobalEntry (ue); } (void) cpphash_install (name, len, type, ivalue, value, hash); } static void initialize_builtins (cppReader *pfile) { cpplib_installBuiltin ("__LINE__", ctype_int, -1, T_SPECLINE, 0, NULL, -1); cpplib_installBuiltin ("__DATE__", ctype_string, -1, T_DATE, 0, NULL, -1); cpplib_installBuiltin ("__FILE__", ctype_string, -1, T_FILE, 0, NULL, -1); cpplib_installBuiltin ("__BASE_FILE__", ctype_string, -1, T_BASE_FILE, 0, NULL, -1); cpplib_installBuiltin ("__func__", ctype_string, -1, T_FUNC, 0, NULL, -1); cpplib_installBuiltin ("__INCLUDE_LEVEL__", ctype_int, -1, T_INCLUDE_LEVEL, 0, NULL, -1); cpplib_installBuiltin ("__VERSION__", ctype_string, -1, T_VERSION, 0, NULL, -1); #ifndef NO_BUILTIN_SIZE_TYPE cpplib_installBuiltinType ("__SIZE_TYPE__", ctype_anyintegral, -1, T_SIZE_TYPE, 0, NULL, -1); #endif #ifndef NO_BUILTIN_PTRDIFF_TYPE cpplib_installBuiltinType ("__PTRDIFF_TYPE__", ctype_anyintegral, -1, T_PTRDIFF_TYPE, 0, NULL, -1); #endif cpplib_installBuiltinType ("__WCHAR_TYPE__", ctype_anyintegral, -1, T_WCHAR_TYPE, 0, NULL, -1); cpplib_installBuiltin ("__USER_LABEL_PREFIX__", ctype_string, -1, T_USER_LABEL_PREFIX_TYPE, 0, NULL, -1); cpplib_installBuiltin ("__REGISTER_PREFIX__", ctype_string, -1, T_REGISTER_PREFIX_TYPE, 0, NULL, -1); cpplib_installBuiltin ("__TIME__", ctype_string, -1, T_TIME, 0, NULL, -1); if (!cppReader_isTraditional (pfile)) { cpplib_installBuiltin ("__STDC__", ctype_int, -1, T_CONST, STDC_VALUE, NULL, -1); } # ifdef WIN32 cpplib_installBuiltin ("_WIN32", ctype_int, -1, T_CONST, STDC_VALUE, NULL, -1); # endif /* ** This is supplied using a -D by the compiler driver ** so that it is present only when truly compiling with GNU C. */ /* cpplib_install ("__GNUC__", -1, T_CONST, 2, 0, -1); */ cpplib_installBuiltin ("S_SPLINT_S", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__LCLINT__", ctype_int, -1, T_CONST, 2, NULL, -1); /*drl 1/9/2001/ try to define the right symbol for the architecture We use autoconf to determine the target cpu */ # ifndef S_SPLINT_S cpplib_installBuiltin ("__" TARGET_CPU, ctype_int, -1, T_CONST, 2, NULL, -1); # endif /*drl 1/2/2002 set some flags based on uname I'd like to be able to do this with autoconf macro instead... */ /*Thanks to Nelson Beebe for suggesting possible values for these */ if (! strcmp (UNAME, "Linux")) { #ifdef __ppc cpplib_installBuiltin ("__BIG_ENDIAN__", ctype_int, -1, T_CONST, 2, NULL, -1); #endif } else if(! strcmp (UNAME, "Darwin")) { cpplib_installBuiltin ("__ppc__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__BIG_ENDIAN__", ctype_int, -1, T_CONST, 2, NULL, -1); } else if(! strcmp (UNAME, "HP-UX")) { cpplib_installBuiltin ("PWB", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_HIUX_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_HPUX_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_PA_RISC1_1", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__PWB", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__PWB__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__STDC_EXT__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hp9000s700", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hp9000s800", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hp9000s800__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hp9k8", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hp9k8__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hppa", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hppa__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hpux", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__hpux__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__unix", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__unix__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("hp9000s800", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("hp9k8", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("hppa", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("hpux", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("unix", ctype_int, -1, T_CONST, 2, NULL, -1); } else if(! strcmp (UNAME, "IRIX64")) { cpplib_installBuiltin ("LANGUAGE_C", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("MIPSEB", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_ABIN32", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_COMPILER_VERSION", ctype_int, -1, T_CONST, 730, NULL, -1); cpplib_installBuiltin ("_LANGUAGE_C", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_LONGLONG", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_MIPSEB", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_MIPS_FPSET", ctype_int, -1, T_CONST, 32, NULL, -1); cpplib_installBuiltin ("_MIPS_ISA", ctype_int, -1, T_CONST, 3, NULL, -1); /*_MIPS_SIM=_ABIN32*/ cpplib_installBuiltin ("_MIPS_SIM", ctype_int, -1, T_CONST, 2, NULL , -1); cpplib_installBuiltin ("_MIPS_SZINT", ctype_int, -1, T_CONST, 32, NULL, -1); cpplib_installBuiltin ("_MIPS_SZLONG", ctype_int, -1, T_CONST, 32, NULL, -1); cpplib_installBuiltin ("_MIPS_SZPTR", ctype_int, -1, T_CONST, 32, NULL, -1); cpplib_installBuiltin ("_MODERN_C", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_PIC", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_SGI_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_SIZE_INT", ctype_int, -1, T_CONST, 32, NULL, -1); cpplib_installBuiltin ("_SIZE_LONG", ctype_int, -1, T_CONST, 32, NULL, -1); cpplib_installBuiltin ("_SIZE_PTR", ctype_int, -1, T_CONST, 32, NULL, -1); cpplib_installBuiltin ("_SVR4_SOURCE", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("_SYSTYPE_SVR4", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__DSO__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__EXTENSIONS__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__INLINE_INTRINSICS", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__MATH_HAS_NO_SIDE_EFFECTS", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__host_mips", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__mips", ctype_int, -1, T_CONST, 3, NULL, -1); cpplib_installBuiltin ("__sgi", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__unix", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("host_mips", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("mips", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("sgi", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("unix", ctype_int, -1, T_CONST, 2, NULL, -1); } else if(! strcmp (UNAME, "OSF1")) { cpplib_installBuiltin ("__alpha", ctype_int, -1, T_CONST, 2, NULL, -1); } else if (!strcmp (UNAME, "Rhapsody")) { cpplib_installBuiltin ("__ppc__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__BIG_ENDIAN__", ctype_int, -1, T_CONST, 2, NULL, -1); } else if (!strcmp (UNAME, "SunOS")) { cpplib_installBuiltin ("__OPEN_MAX", ctype_int, -1, T_CONST, 20, NULL, -1); cpplib_installBuiltin ("__STDC__", ctype_int, -1, T_CONST, 2, NULL, -1); cpplib_installBuiltin ("__sparc", ctype_int, -1, T_CONST, 2, NULL, -1); /* This define "-Dfileno(f)=0" should be inserted but we're going to stick to deinfe constants for now...*/ } else { /* types which we have not explictedly handled. AIX, FreeBSD, IRIX, Mach */ } if (CPPOPTIONS (pfile)->debug_output) { dump_special_to_buffer (pfile, "__BASE_FILE__"); dump_special_to_buffer (pfile, "__VERSION__"); #ifndef NO_BUILTIN_SIZE_TYPE dump_special_to_buffer (pfile, "__SIZE_TYPE__"); #endif #ifndef NO_BUILTIN_PTRDIFF_TYPE dump_special_to_buffer (pfile, "__PTRDIFF_TYPE__"); #endif dump_special_to_buffer (pfile, "__WCHAR_TYPE__"); dump_special_to_buffer (pfile, "__DATE__"); dump_special_to_buffer (pfile, "__TIME__"); if (!cppReader_isTraditional (pfile)) dump_special_to_buffer (pfile, "__STDC__"); } } /* Return 1 iff a token ending in C1 followed directly by a token C2 could cause mis-tokenization. */ static bool unsafe_chars (char c1, char c2) { switch (c1) { case '+': case '-': if (c2 == c1 || c2 == '=') return 1; goto letter; case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'e': case 'E': case 'p': case 'P': if (c2 == '-' || c2 == '+') return 1; /* could extend a pre-processing number */ goto letter; case 'L': if (c2 == '\'' || c2 == '\"') return 1; /* Could turn into L"xxx" or L'xxx'. */ goto letter; letter: case '_': case 'a': case 'b': case 'c': case 'd': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'B': case 'C': case 'D': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'M': case 'N': case 'O': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': /* We're in the middle of either a name or a pre-processing number. */ return (is_idchar[(int) c2] || c2 == '.'); case '<': case '>': case '!': case '%': case '#': case ':': case '^': case '&': case '|': case '*': case '/': case '=': return (c2 == c1 || c2 == '='); } return 0; } /* Expand a macro call. HP points to the symbol that is the macro being called. Put the result of expansion onto the input stack so that subsequent input by our caller will use it. If macro wants arguments, caller has already verified that an argument list follows; arguments come from the input stack. */ static void cpplib_macroExpand (cppReader *pfile, /*@dependent@*/ hashNode hp) { int nargs; DEFINITION *defn = hp->value.defn; char *xbuf; char *oxbuf = NULL; int start_line; int start_column; int end_line; int end_column; size_t xbuf_len; size_t old_written = cpplib_getWritten (pfile); int rest_args; int rest_zero = 0; int i; struct argdata *args = NULL; pfile->output_escapes++; cppBuffer_getLineAndColumn (cppReader_fileBuffer (pfile), &start_line, &start_column); DPRINTF (("Expand macro: %d:%d", start_line, start_column)); nargs = defn->nargs; if (nargs >= 0) { enum cpp_token token = CPP_EOF; args = (struct argdata *) dmalloc ((nargs + 1) * sizeof (*args)); for (i = 0; i < nargs; i++) { args[i].expanded = 0; args[i].raw = 0; args[i].raw_length = 0; args[i].expand_length = args[i].stringified_length = -1; args[i].use_count = 0; } /* ** Parse all the macro args that are supplied. I counts them. ** The first NARGS args are stored in ARGS. ** The rest are discarded. If rest_args is set then we assume ** macarg absorbed the rest of the args. */ i = 0; rest_args = 0; cppReader_forward (pfile, 1); /* Discard the open-parenthesis before the first arg. */ do { if (rest_args != 0) { continue; } if (i < nargs || (nargs == 0 && i == 0)) { /* if we are working on last arg which absorbs rest of args... */ if (i == nargs - 1 && defn->rest_args) { rest_args = 1; } args[i].raw = size_toLong (cpplib_getWritten (pfile)); token = macarg (pfile, rest_args); args[i].raw_length = size_toInt (cpplib_getWritten (pfile) - args[i].raw); args[i].newlines = FALSE; /* FIXME */ } else { token = macarg (pfile, 0); } if (token == CPP_EOF || token == CPP_POP) { cppReader_errorWithLine (pfile, start_line, start_column, cstring_fromCharsNew ("unterminated macro call")); sfree (args); return; } i++; } while (token == CPP_COMMA); /* If we got one arg but it was just whitespace, call that 0 args. */ if (i == 1) { char *bp; char *lim; assertSet (args); bp = ARG_BASE + args[0].raw; lim = bp + args[0].raw_length; /* cpp.texi says for foo ( ) we provide one argument. However, if foo wants just 0 arguments, treat this as 0. */ if (nargs == 0) { while (bp != lim && is_space[(int) *bp]) { bp++; } } if (bp == lim) i = 0; } /* Don't output an error message if we have already output one for a parse error above. */ rest_zero = 0; if (nargs == 0 && i > 0) { cppReader_error (pfile, message ("arguments given to macro `%s'", hp->name)); } else if (i < nargs) { /* traditional C allows foo() if foo wants one argument. */ if (nargs == 1 && i == 0 && cppReader_isTraditional (pfile)) { ; } /* the rest args token is allowed to absorb 0 tokens */ else if (i == nargs - 1 && defn->rest_args) rest_zero = 1; else if (i == 0) cppReader_error (pfile, message ("macro `%s' used without args", hp->name)); else if (i == 1) cppReader_error (pfile, message ("macro `%s' used with just one arg", hp->name)); else { cppReader_error (pfile, message ("macro `%s' used with only %d args", hp->name, i)); } } else if (i > nargs) { cppReader_error (pfile, message ("macro `%s' used with too many (%d) args", hp->name, i)); } else { ; } } /* ** If the agrument list was multiple lines, need to insert new lines to keep line ** numbers accurate. */ cppBuffer_getLineAndColumn (cppReader_fileBuffer (pfile), &end_line, &end_column); DPRINTF (("Expand macro: %d:%d", end_line, end_column)); /* If macro wants zero args, we parsed the arglist for checking only. Read directly from the macro definition. */ if (nargs <= 0) { xbuf = defn->expansion; xbuf_len = defn->length; } else { char *exp = defn->expansion; int offset; /* offset in expansion, copied a piece at a time */ size_t totlen; /* total amount of exp buffer filled so far */ register struct reflist *ap, *last_ap; assertSet (args); /* args is defined since the nargs > 0 path was taken */ /* Macro really takes args. Compute the expansion of this call. */ /* Compute length in characters of the macro's expansion. Also count number of times each arg is used. */ xbuf_len = defn->length; llassert (args != NULL); for (ap = defn->pattern; ap != NULL; ap = ap->next) { if (ap->stringify) { struct argdata *arg = &args[ap->argno]; /* Stringify it it hasn't already been */ assertSet (arg); if (arg->stringified_length < 0) { int arglen = arg->raw_length; bool escaped = FALSE; char in_string = '\0'; char c; /* Initially need_space is -1. Otherwise, 1 means the previous character was a space, but we suppressed it; 0 means the previous character was a non-space. */ int need_space = -1; i = 0; arg->stringified = cpplib_getWritten (pfile); if (!cppReader_isTraditional (pfile)) cppReader_putChar (pfile, '\"'); /* insert beginning quote */ for (; i < arglen; i++) { c = (ARG_BASE + arg->raw)[i]; if (in_string == '\0') { /* Internal sequences of whitespace are replaced by one space except within an string or char token.*/ if (is_space[(int) c]) { if (cpplib_getWritten (pfile) > arg->stringified && (cpplib_getPWritten (pfile))[-1] == '@') { /* "@ " escape markers are removed */ cppReader_adjustWritten (pfile, -1); /*@innercontinue@*/ continue; } if (need_space == 0) need_space = 1; /*@innercontinue@*/ continue; } else if (need_space > 0) cppReader_putChar (pfile, ' '); else { ; } need_space = 0; } if (escaped) escaped = 0; else { if (c == '\\') escaped = 1; if (in_string != '\0') { if (c == in_string) in_string = '\0'; } else if (c == '\"' || c == '\'') { in_string = c; } else { ; } } /* Escape these chars */ if (c == '\"' || (in_string != '\0' && c == '\\')) cppReader_putChar (pfile, '\\'); if (isprint (c)) cppReader_putChar (pfile, c); else { cpplib_reserve (pfile, 4); sprintf (cpplib_getPWritten (pfile), "\\%03o", (unsigned int) c); cppReader_adjustWritten (pfile, 4); } } if (!cppReader_isTraditional (pfile)) cppReader_putChar (pfile, '\"'); /* insert ending quote */ arg->stringified_length = size_toInt (cpplib_getWritten (pfile) - arg->stringified); } xbuf_len += args[ap->argno].stringified_length; } else if (ap->raw_before || ap->raw_after || cppReader_isTraditional (pfile)) { /* Add 4 for two newline-space markers to prevent token concatenation. */ assertSet (args); /* Splint shouldn't need this */ xbuf_len += args[ap->argno].raw_length + 4; } else { /* We have an ordinary (expanded) occurrence of the arg. So compute its expansion, if we have not already. */ assertSet (args); /* shouldn't need this */ if (args[ap->argno].expand_length < 0) { args[ap->argno].expanded = cpplib_getWritten (pfile); cpp_expand_to_buffer (pfile, ARG_BASE + args[ap->argno].raw, size_fromInt (args[ap->argno].raw_length)); args[ap->argno].expand_length = size_toInt (cpplib_getWritten (pfile) - args[ap->argno].expanded); } /* Add 4 for two newline-space markers to prevent token concatenation. */ xbuf_len += args[ap->argno].expand_length + 4; } if (args[ap->argno].use_count < 10) args[ap->argno].use_count++; } xbuf = (char *) dmalloc (xbuf_len + 1); oxbuf = xbuf; /* ** Generate in XBUF the complete expansion ** with arguments substituted in. ** TOTLEN is the total size generated so far. ** OFFSET is the index in the definition ** of where we are copying from. */ offset = 0; totlen = 0; for (last_ap = NULL, ap = defn->pattern; ap != NULL; last_ap = ap, ap = ap->next) { register struct argdata *arg = &args[ap->argno]; size_t count_before = totlen; /* Add chars to XBUF. */ for (i = 0; i < ap->nchars; i++, offset++) { xbuf[totlen++] = exp[offset]; } /* If followed by an empty rest arg with concatenation, delete the last run of nonwhite chars. */ if (rest_zero && totlen > count_before && ((ap->rest_args && ap->raw_before) || (last_ap != NULL && last_ap->rest_args && last_ap->raw_after))) { /* Delete final whitespace. */ while (totlen > count_before && is_space[(int) xbuf[totlen - 1]]) { totlen--; } /* Delete the nonwhites before them. */ while (totlen > count_before && ! is_space[(int) xbuf[totlen - 1]]) { totlen--; } } if (ap->stringify != 0) { assertSet(arg); memcpy (xbuf + totlen, ARG_BASE + arg->stringified, size_fromInt (arg->stringified_length)); totlen += arg->stringified_length; } else if (ap->raw_before || ap->raw_after || cppReader_isTraditional (pfile)) { char *p1; char *l1; assertSet (arg); p1 = ARG_BASE + arg->raw; l1 = p1 + arg->raw_length; if (ap->raw_before) { while (p1 != l1 && is_space[(int) *p1]) { p1++; } while (p1 != l1 && is_idchar[(int) *p1]) { xbuf[totlen++] = *p1++; } /* Delete any no-reexpansion marker that follows an identifier at the beginning of the argument if the argument is concatenated with what precedes it. */ if (p1[0] == '@' && p1[1] == '-') p1 += 2; } if (ap->raw_after) { /* Arg is concatenated after: delete trailing whitespace, whitespace markers, and no-reexpansion markers. */ while (p1 != l1) { if (is_space[(int) l1[-1]]) l1--; else if (l1[-1] == '-') { char *p2 = l1 - 1; /* If a `-' is preceded by an odd number of newlines then it and the last newline are a no-reexpansion marker. */ while (p2 != p1 && p2[-1] == '\n') { p2--; } if (((l1 - 1 - p2) & 1) != 0) { l1 -= 2; } else { /*@innerbreak@*/ break; } } else { /*@innerbreak@*/ break; } } } memcpy (xbuf + totlen, p1, size_fromInt (l1 - p1)); totlen += l1 - p1; } else { char *expanded; assertSet (arg); expanded = ARG_BASE + arg->expanded; if (!ap->raw_before && totlen > 0 && (arg->expand_length != 0) && !cppReader_isTraditional(pfile) && unsafe_chars (xbuf[totlen-1], expanded[0])) { xbuf[totlen++] = '@'; xbuf[totlen++] = ' '; } memcpy (xbuf + totlen, expanded, size_fromInt (arg->expand_length)); totlen += arg->expand_length; if (!ap->raw_after && totlen > 0 && offset < size_toInt (defn->length) && !cppReader_isTraditional(pfile) && unsafe_chars (xbuf[totlen-1], exp[offset])) { xbuf[totlen++] = '@'; xbuf[totlen++] = ' '; } /* If a macro argument with newlines is used multiple times, then only expand the newlines once. This avoids creating output lines which don't correspond to any input line, which confuses gdb and gcov. */ if (arg->use_count > 1 && arg->newlines > 0) { /* Don't bother doing change_newlines for subsequent uses of arg. */ arg->use_count = 1; arg->expand_length = change_newlines (expanded, arg->expand_length); } } if (totlen > xbuf_len) abort (); } /* if there is anything left of the definition after handling the arg list, copy that in too. */ for (i = offset; i < size_toInt (defn->length); i++) { /* if we've reached the end of the macro */ if (exp[i] == ')') rest_zero = 0; if (! (rest_zero && last_ap != NULL && last_ap->rest_args && last_ap->raw_after)) xbuf[totlen++] = exp[i]; } xbuf[totlen] = '\0'; xbuf_len = totlen; } pfile->output_escapes--; /* Now put the expansion on the input stack so our caller will commence reading from it. */ DPRINTF (("Pushing expansion: %s", cstring_copyLength (xbuf, xbuf_len))); if (end_line != start_line) { /* xbuf must have enough newlines */ int newlines = end_line - start_line; int foundnewlines = 0; char *xbufptr = xbuf; while ((xbufptr = strchr (xbufptr, '\n')) != NULL && foundnewlines <= newlines) { foundnewlines++; xbufptr++; if (*xbufptr == '\0') { break; } } if (foundnewlines < newlines) { cstring newbuf = cstring_copyLength (xbuf, xbuf_len); while (foundnewlines < newlines) { newbuf = cstring_appendChar (newbuf, '\n'); foundnewlines++; } sfree (oxbuf); xbuf = cstring_toCharsSafe (newbuf); xbuf_len = cstring_length (newbuf); /*@-branchstate@*/ } /*@=branchstate@*/ } DPRINTF (("Pushing expansion: %s", cstring_copyLength (xbuf, xbuf_len))); push_macro_expansion (pfile, xbuf, xbuf_len, hp); DPRINTF (("After pushing expansion: %s", cstring_copyLength (xbuf, xbuf_len))); cppReader_getBufferSafe (pfile)->has_escapes = 1; /* Pop the space we've used in the token_buffer for argument expansion. */ cppReader_setWritten (pfile, old_written); DPRINTF (("Done set written")); /* Recursive macro use sometimes works traditionally. #define foo(x,y) bar (x (y,0), y) foo (foo, baz) */ if (!cppReader_isTraditional (pfile)) hp->type = T_DISABLED; sfree (args); } static void push_macro_expansion (cppReader *pfile, char *xbuf, size_t xbuf_len, /*@dependent@*/ hashNode hp) { cppBuffer *mbuf = cppReader_pushBuffer (pfile, xbuf, xbuf_len); if (mbuf == NULL) { return; } mbuf->cleanup = cppReader_macroCleanup; llassert (mbuf->hnode == NULL); mbuf->hnode = hp; /* The first chars of the expansion should be a "@ " added by collect_expansion. This is to prevent accidental token-pasting between the text preceding the macro invocation, and the macro expansion text. We would like to avoid adding unneeded spaces (for the sake of tools that use cpp, such as imake). In some common cases we can tell that it is safe to omit the space. The character before the macro invocation cannot have been an idchar (or else it would have been pasted with the idchars of the macro name). Therefore, if the first non-space character of the expansion is an idchar, we do not need the extra space to prevent token pasting. Also, we don't need the extra space if the first char is '(', or some other (less common) characters. */ if (xbuf[0] == '@' && xbuf[1] == ' ' && (is_idchar[(int) xbuf[2]] || xbuf[2] == '(' || xbuf[2] == '\'' || xbuf[2] == '\"')) { llassert (mbuf->cur != NULL); DPRINTF (("Eating: %c", xbuf[2])); mbuf->cur += 2; } } /* Like cpplib_getToken, except that it does not read past end-of-line. Also, horizontal space is skipped, and macros are popped. */ static enum cpp_token get_directive_token (cppReader *pfile) { for (;;) { size_t old_written = cpplib_getWritten (pfile); enum cpp_token token; cppSkipHspace (pfile); if (cppReader_peekC (pfile) == '\n') { return CPP_VSPACE; } token = cpplib_getToken (pfile); switch (token) { case CPP_POP: if (!cppBuffer_isMacro (cppReader_getBuffer (pfile))) return token; /*@fallthrough@*/ case CPP_HSPACE: case CPP_COMMENT: cppReader_setWritten (pfile, old_written); /*@switchbreak@*/ break; default: return token; } } } /* Handle #include and #import. This function expects to see "fname" or on the input. The input is normally in part of the output_buffer following cpplib_getWritten, and will get overwritten by output_line_command. I.e. in input file specification has been popped by cppReader_handleDirective. This is safe. */ static int do_include (cppReader *pfile, struct directive *keyword, /*@unused@*/ char *unused1, /*@unused@*/ char *unused2) { bool skip_dirs = (keyword->type == T_INCLUDE_NEXT); cstring fname; char *fbeg, *fend; /* Beginning and end of fname */ enum cpp_token token; /* Chain of dirs to search */ struct file_name_list *search_start = CPPOPTIONS (pfile)->include; struct file_name_list dsp[1]; /* First in chain, if #include "..." */ struct file_name_list *searchptr = NULL; size_t old_written = cpplib_getWritten (pfile); size_t flen; int f; /* file number */ int angle_brackets = 0; /* 0 for "...", 1 for <...> */ f= -1; /* JF we iz paranoid! */ pfile->parsing_include_directive++; token = get_directive_token (pfile); pfile->parsing_include_directive--; if (token == CPP_STRING) { /* FIXME - check no trailing garbage */ fbeg = pfile->token_buffer + old_written + 1; fend = cpplib_getPWritten (pfile) - 1; if (fbeg[-1] == '<') { angle_brackets = 1; /* If -I-, start with the first -I dir after the -I-. */ if (CPPOPTIONS (pfile)->first_bracket_include != NULL) search_start = CPPOPTIONS (pfile)->first_bracket_include; } /* If -I- was specified, don't search current dir, only spec'd ones. */ else if (!CPPOPTIONS (pfile)->ignore_srcdir) { cppBuffer *fp = CPPBUFFER (pfile); /* We have "filename". Figure out directory this source file is coming from and put it on the front of the list. */ for ( ; fp != cppReader_nullBuffer (pfile); fp = cppBuffer_prevBuffer (fp)) { int n; char *ep,*nam; llassert (fp != NULL); nam = NULL; if (cstring_isDefined (fp->nominal_fname)) { nam = cstring_toCharsSafe (fp->nominal_fname); /* Found a named file. Figure out dir of the file, and put it in front of the search list. */ dsp[0].next = search_start; search_start = dsp; #ifndef VMS ep = strrchr (nam, CONNECTCHAR); #else /* VMS */ ep = strrchr (nam, ']'); if (ep == NULL) ep = strrchr (nam, '>'); if (ep == NULL) ep = strrchr (nam, ':'); if (ep != NULL) ep++; #endif /* VMS */ if (ep != NULL) { char save; n = ep - nam; save = nam[n]; nam[n] = '\0'; /*@-onlytrans@*/ /* This looks like a memory leak... */ dsp[0].fname = cstring_fromCharsNew (nam); /* evs 2000-07-20: was fromChars */ /*@=onlytrans@*/ nam[n] = save; if (n + INCLUDE_LEN_FUDGE > size_toInt (pfile->max_include_len)) pfile->max_include_len = size_fromInt (n + INCLUDE_LEN_FUDGE); } else { dsp[0].fname = cstring_undefined; /* Current directory */ } dsp[0].got_name_map = 0; break; } } } else { ; } } #ifdef VMS else if (token == CPP_NAME) { /* * Support '#include xyz' like VAX-C to allow for easy use of all the * decwindow include files. It defaults to '#include ' (so the * code from case '<' is repeated here) and generates a warning. */ cppReader_warning (pfile, "VAX-C-style include specification found, use '#include ' !"); angle_brackets = 1; /* If -I-, start with the first -I dir after the -I-. */ if (CPPOPTIONS (pfile)->first_bracket_include) search_start = CPPOPTIONS (pfile)->first_bracket_include; fbeg = pfile->token_buffer + old_written; fend = cpplib_getPWritten (pfile); } #endif else { cppReader_error (pfile, message ("Preprocessor command #%s expects \"FILENAME\" or ", keyword->name)); cppReader_setWritten (pfile, old_written); cppReader_skipRestOfLine (pfile); return 0; } *fend = 0; token = get_directive_token (pfile); if (token != CPP_VSPACE) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Junk at end of #include")); while (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP) { token = get_directive_token (pfile); } } /* ** For #include_next, skip in the search path ** past the dir in which the containing file was found. */ if (skip_dirs) { cppBuffer *fp = CPPBUFFER (pfile); for (; fp != cppReader_nullBuffer (pfile); fp = cppBuffer_prevBuffer (fp)) { llassert (fp != NULL); if (fp->fname != NULL) { /* fp->dir is null if the containing file was specified with an absolute file name. In that case, don't skip anything. */ if (fp->dir == SELF_DIR_DUMMY) { search_start = CPPOPTIONS (pfile)->include; } else if (fp->dir != NULL) { search_start = fp->dir->next; } else { ; } break; } } } cppReader_setWritten (pfile, old_written); flen = size_fromInt (fend - fbeg); DPRINTF (("fbeg: %s", fbeg)); if (flen == 0) { cppReader_error (pfile, message ("Empty file name in #%s", keyword->name)); return 0; } /* ** Allocate this permanently, because it gets stored in the definitions ** of macros. */ fname = cstring_undefined; /* + 2 above for slash and terminating null. */ /* + 2 added for '.h' on VMS (to support '#include filename') */ /* If specified file name is absolute, just open it. */ if (osd_isConnectChar (*fbeg) # if defined (WIN32) || defined (OS2) || (*(fbeg + 1) == ':') # endif ) { fname = cstring_copyLength (fbeg, flen); if (redundant_include_p (pfile, fname)) { cstring_free (fname); return 0; } f = open_include_file (pfile, fname, NULL); if (f == IMPORT_FOUND) { return 0; /* Already included this file */ } } else { /* Search directory path, trying to open the file. Copy each filename tried into FNAME. */ for (searchptr = search_start; searchptr != NULL; searchptr = searchptr->next) { if (!cstring_isEmpty (searchptr->fname)) { /* The empty string in a search path is ignored. This makes it possible to turn off entirely a standard piece of the list. */ if (cstring_isEmpty (searchptr->fname)) continue; fname = cstring_copy (searchptr->fname); fname = cstring_appendChar (fname, CONNECTCHAR); DPRINTF (("Here: %s", fname)); } else { ; } fname = cstring_concatLength (fname, fbeg, flen); DPRINTF (("fname: %s", fname)); /* Win32 directory fix from Kay Buschner. */ #if defined (WIN32) || defined (OS2) /* Fix all unixdir slashes to win dir slashes */ if (searchptr->fname && (searchptr->fname[0] != 0)) { cstring_replaceAll (fname, '/', '\\'); } #endif /* WIN32 */ #ifdef VMS /* Change this 1/2 Unix 1/2 VMS file specification into a full VMS file specification */ if (searchptr->fname && (searchptr->fname[0] != 0)) { /* Fix up the filename */ hack_vms_include_specification (fname); } else { /* This is a normal VMS filespec, so use it unchanged. */ strncpy (fname, fbeg, flen); fname[flen] = 0; /* if it's '#include filename', add the missing .h */ if (strchr (fname,'.') == NULL) { strcat (fname, ".h"); } } #endif /* VMS */ /* ??? There are currently 3 separate mechanisms for avoiding processing of redundant include files: #import, #pragma once, and redundant_include_p. It would be nice if they were unified. */ if (redundant_include_p (pfile, fname)) { cstring_free (fname); return 0; } DPRINTF (("Trying: %s", fname)); f = open_include_file (pfile, fname, searchptr); if (f == IMPORT_FOUND) { return 0; /* Already included this file */ } #ifdef EACCES else if (f == IMPORT_NOT_FOUND && errno == EACCES) { cppReader_warning (pfile, message ("Header file %s exists, but is not readable", fname)); } #endif if (f >= 0) { break; } } } if (f < 0) { /* A file that was not found. */ fname = cstring_copyLength (fbeg, flen); if (search_start != NULL) { cppReader_error (pfile, message ("Cannot find include file %s on search path: %x", fname, searchPath_unparse (search_start))); } else { cppReader_error (pfile, message ("No include path in which to find %s", fname)); } } else { /* ** Check to see if this include file is a once-only include file. ** If so, give up. */ struct file_name_list *ptr; for (ptr = pfile->all_include_files; ptr != NULL; ptr = ptr->next) { if (cstring_equal (ptr->fname, fname)) { /* This file was included before. */ break; } } if (ptr == NULL) { /* This is the first time for this file. */ /* Add it to list of files included. */ ptr = (struct file_name_list *) dmalloc (sizeof (*ptr)); ptr->control_macro = NULL; ptr->c_system_include_path = NULL; ptr->next = pfile->all_include_files; ptr->fname = fname; ptr->got_name_map = NULL; DPRINTF (("Including file: %s", fname)); pfile->all_include_files = ptr; assertSet (pfile->all_include_files); } if (angle_brackets != 0) { pfile->system_include_depth++; } /* Actually process the file */ if (cppReader_pushBuffer (pfile, NULL, 0) == NULL) { cstring_free (fname); return 0; } if (finclude (pfile, f, fname, is_system_include (pfile, fname), searchptr != dsp ? searchptr : SELF_DIR_DUMMY)) { output_line_command (pfile, 0, enter_file); pfile->only_seen_white = 2; } if (angle_brackets) { pfile->system_include_depth--; } /*@-branchstate@*/ } /*@=branchstate@*/ return 0; } /* Return nonzero if there is no need to include file NAME because it has already been included and it contains a conditional to make a repeated include do nothing. */ static bool redundant_include_p (cppReader *pfile, cstring name) { struct file_name_list *l = pfile->all_include_files; for (; l != NULL; l = l->next) { if (cstring_equal (name, l->fname) && (l->control_macro != NULL) && (cpphash_lookup (l->control_macro, -1, -1) != NULL)) { return TRUE; } } return FALSE; } /* Return nonzero if the given FILENAME is an absolute pathname which designates a file within one of the known "system" include file directories. We assume here that if the given FILENAME looks like it is the name of a file which resides either directly in a "system" include file directory, or within any subdirectory thereof, then the given file must be a "system" include file. This function tells us if we should suppress pedantic errors/warnings for the given FILENAME. The value is 2 if the file is a C-language system header file for which C++ should (on most systems) assume `extern "C"'. */ static bool is_system_include (cppReader *pfile, cstring filename) { struct file_name_list *searchptr; for (searchptr = CPPOPTIONS (pfile)->first_system_include; searchptr != NULL; searchptr = searchptr->next) { if (!cstring_isEmpty (searchptr->fname)) { cstring sys_dir = searchptr->fname; size_t length = cstring_length (sys_dir); if (cstring_equalLen (sys_dir, filename, length) && osd_isConnectChar (cstring_getChar (filename, length))) { if (searchptr->c_system_include_path) return 2; else return 1; } } } return 0; } /* Convert a character string literal into a nul-terminated string. The input string is [IN ... LIMIT). The result is placed in RESULT. RESULT can be the same as IN. The value returned in the end of the string written to RESULT, or NULL on error. */ static /*@null@*/ char * convert_string (cppReader *pfile, /*@returned@*/ char *result, char *in, char *limit, int handle_escapes) { char c; c = *in++; if (c != '\"') { return NULL; } while (in < limit) { c = *in++; switch (c) { case '\0': return NULL; case '\"': limit = in; /*@switchbreak@*/ break; case '\\': if (handle_escapes) { char *bpc = (char *) in; int i = (char) cppReader_parseEscape (pfile, &bpc); in = (char *) bpc; if (i >= 0) *result++ = (char) c; /*@switchbreak@*/ break; } /*@fallthrough@*/ default: *result++ = c; } } *result = 0; return result; } /* * interpret #line command. Remembers previously seen fnames * in its very own hash table. */ /*@constant int FNAME_HASHSIZE@*/ #define FNAME_HASHSIZE 37 static int do_line (cppReader *pfile, /*@unused@*/ struct directive *keyword) { cppBuffer *ip = cppReader_getBuffer (pfile); int new_lineno; size_t old_written = cpplib_getWritten (pfile); enum file_change_code file_change = same_file; enum cpp_token token; llassert (ip != NULL); token = get_directive_token (pfile); if (token != CPP_NUMBER || !isdigit(pfile->token_buffer[old_written])) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("invalid format `#line' command")); goto bad_line_directive; } /* The Newline at the end of this line remains to be processed. To put the next line at the specified line number, we must store a line number now that is one less. */ new_lineno = atoi (pfile->token_buffer + old_written) - 1; cppReader_setWritten (pfile, old_written); /* NEW_LINENO is one less than the actual line number here. */ if (cppReader_isPedantic (pfile) && new_lineno < 0) cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("line number out of range in `#line' command")); token = get_directive_token (pfile); if (token == CPP_STRING) { char *fname = pfile->token_buffer + old_written; char *end_name; static hashNode fname_table[FNAME_HASHSIZE]; hashNode hp; hashNode *hash_bucket; char *p; size_t num_start; size_t fname_length; /* Turn the file name, which is a character string literal, into a null-terminated string. Do this in place. */ end_name = convert_string (pfile, fname, fname, cpplib_getPWritten (pfile), 1); if (end_name == NULL) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("invalid format `#line' command")); goto bad_line_directive; } fname_length = size_fromInt (end_name - fname); num_start = cpplib_getWritten (pfile); token = get_directive_token (pfile); if (token != CPP_VSPACE && token != CPP_EOF && token != CPP_POP) { p = pfile->token_buffer + num_start; if (cppReader_isPedantic (pfile)) cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("garbage at end of `#line' command")); if (token != CPP_NUMBER || *p < '0' || *p > '4' || p[1] != '\0') { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("invalid format `#line' command")); goto bad_line_directive; } if (*p == '1') file_change = enter_file; else if (*p == 2) file_change = leave_file; else if (*p == 3) ip->system_header_p = 1; else /* if (*p == 4) */ ip->system_header_p = 2; cppReader_setWritten (pfile, num_start); token = get_directive_token (pfile); p = pfile->token_buffer + num_start; if (token == CPP_NUMBER && p[1] == '\0' && (*p == '3' || *p== '4')) { ip->system_header_p = *p == 3 ? 1 : 2; token = get_directive_token (pfile); } if (token != CPP_VSPACE) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("invalid format `#line' command")); goto bad_line_directive; } } hash_bucket = &fname_table[cpphash_hashCode (fname, fname_length, FNAME_HASHSIZE)]; for (hp = *hash_bucket; hp != NULL; hp = hp->next) { if (hp->length == fname_length) { llassert (hp->value.cpval != NULL); if (strncmp (hp->value.cpval, fname, fname_length) == 0) { ip->nominal_fname = cstring_fromChars (hp->value.cpval); break; } } } if (hp == 0) { /* Didn't find it; cons up a new one. */ hp = (hashNode) dmalloc (sizeof (*hp)); hp->prev = NULL; hp->bucket_hdr = NULL; hp->type = T_NONE; hp->name = cstring_undefined; hp->next = *hash_bucket; *hash_bucket = hp; hp->length = fname_length; hp->value.cpval = dmalloc (sizeof (*hp->value.cpval) * (fname_length + 1)); memcpy (hp->value.cpval, fname, fname_length); hp->value.cpval[fname_length] = '\0'; ip->nominal_fname = cstring_fromChars (hp->value.cpval); } } else if (token != CPP_VSPACE && token != CPP_EOF) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("invalid format `#line' command")); goto bad_line_directive; } else { ; } ip->lineno = new_lineno; bad_line_directive: cppReader_skipRestOfLine (pfile); cppReader_setWritten (pfile, old_written); output_line_command (pfile, 0, file_change); return 0; } /* * remove the definition of a symbol from the symbol table. * according to un*x /lib/cpp, it is not an error to undef * something that has no definitions, so it isn't one here either. */ static int do_undef (cppReader *pfile, struct directive *keyword, char *buf, char *limit) { size_t sym_length; hashNode hp; char *orig_buf = buf; SKIP_WHITE_SPACE (buf); sym_length = cppReader_checkMacroName (pfile, buf, cstring_makeLiteralTemp ("macro")); while ((hp = cpphash_lookup (buf, size_toInt (sym_length), -1)) != NULL) { /* If we are generating additional info for debugging (with -g) we need to pass through all effective #undef commands. */ if (CPPOPTIONS (pfile)->debug_output && (keyword != NULL)) { pass_thru_directive (orig_buf, limit, pfile, keyword); } if (hp->type != T_MACRO) { cppReader_warning (pfile, message ("Undefining preprocessor builtin: %s", hp->name)); } cppReader_deleteMacro (hp); } if (cppReader_isPedantic (pfile)) { buf += sym_length; SKIP_WHITE_SPACE (buf); if (buf != limit) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("garbage after `#undef' directive")); } } return 0; } /* * Report an error detected by the program we are processing. * Use the text of the line in the error message. * (We use error because it prints the filename & line#.) */ static int do_error (cppReader *pfile, /*@unused@*/ struct directive *keyword, char *buf, char *limit) { size_t length = size_fromInt (limit - buf); cstring copy = cstring_copyLength (buf, length); cstring adv = cstring_advanceWhiteSpace (copy); cppReader_error (pfile, message ("#error %s", adv)); cstring_free (copy); return 0; } /* * Report a warning detected by the program we are processing. * Use the text of the line in the warning message, then continue. * (We use error because it prints the filename & line#.) */ static int do_warning (cppReader *pfile, /*@unused@*/ struct directive *keyword, char *buf, char *limit) { size_t length = size_fromInt (limit - buf); cstring copy = cstring_copyLength (buf, length); cstring adv = cstring_advanceWhiteSpace (copy); cppReader_warning (pfile, message ("#warning %s", adv)); cstring_free (copy); return 0; } /* #ident has already been copied to the output file, so just ignore it. */ static int do_ident (cppReader *pfile, /*@unused@*/ struct directive *keyword, /*@unused@*/ char *buf, /*@unused@*/ char *limit) { /* Allow #ident in system headers, since that's not user's fault. */ if (cppReader_isPedantic (pfile) && !cppReader_getBufferSafe (pfile)->system_header_p) cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("ANSI C does not allow `#ident'")); /* Leave rest of line to be read by later calls to cpplib_getToken. */ return 0; } /* #pragma and its argument line have already been copied to the output file. Just check for some recognized pragmas that need validation here. */ static int do_pragma (cppReader *pfile, /*@unused@*/ struct directive *keyword, /*@unused@*/ char *buf, /*@unused@*/ char *limit) { while (*buf == ' ' || *buf == '\t') { buf++; } if (!strncmp (buf, "implementation", 14)) { /* Be quiet about `#pragma implementation' for a file only if it hasn't been included yet. */ struct file_name_list *ptr; char *p = buf + 14, *fname, *inc_fname; size_t fname_len; SKIP_WHITE_SPACE (p); if (*p == '\n' || *p != '\"') return 0; fname = p + 1; p = (char *) strchr (fname, '\"'); fname_len = p != NULL ? size_fromInt (p - fname) : mstring_length (fname); for (ptr = pfile->all_include_files; ptr != NULL; ptr = ptr->next) { inc_fname = (char *) strrchr (cstring_toCharsSafe (ptr->fname), CONNECTCHAR); inc_fname = (inc_fname != NULL) ? inc_fname + 1 : cstring_toCharsSafe (ptr->fname); if ((inc_fname != NULL) && (strncmp (inc_fname, fname, fname_len) == 0)) { cpp_setLocation (pfile); ppllerror (message ("`#pragma implementation' for `%s' appears " "after file is included", cstring_fromChars (fname))); } } } return 0; } /* * handle #if command by * 1) inserting special `defined' keyword into the hash table * that gets turned into 0 or 1 by special_symbol (thus, * if the luser has a symbol called `defined' already, it won't * work inside the #if command) * 2) rescan the input into a temporary output buffer * 3) pass the output buffer to the yacc parser and collect a value * 4) clean up the mess left from steps 1 and 2. * 5) call conditional_skip to skip til the next #endif (etc.), * or not, depending on the value from step 3. */ static int do_if (cppReader *pfile, /*@unused@*/ struct directive *keyword, char *buf, char *limit) { HOST_WIDE_INT value; DPRINTF (("Do if: %s", buf)); value = eval_if_expression (pfile, buf, limit - buf); conditional_skip (pfile, value == 0, T_IF, NULL); return 0; } /* * handle a #elif directive by not changing if_stack either. * see the comment above do_else. */ static int do_elif (cppReader *pfile, /*@unused@*/ struct directive *keyword, char *buf, char *limit) { if (pfile->if_stack == cppReader_getBufferSafe (pfile)->if_stack) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Preprocessor command #elif is not within a conditional")); return 0; } else { llassert (pfile->if_stack != NULL); if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("`#elif' after `#else'")); if (pfile->if_stack->fname != NULL && cppReader_getBufferSafe (pfile)->fname != NULL && !cstring_equal (pfile->if_stack->fname, cppReader_getBufferSafe (pfile)->nominal_fname)) fprintf (stderr, ", file %s", cstring_toCharsSafe (pfile->if_stack->fname)); fprintf (stderr, ")\n"); } pfile->if_stack->type = T_ELIF; } if (pfile->if_stack->if_succeeded) { skip_if_group (pfile, 0); } else { HOST_WIDE_INT value = eval_if_expression (pfile, buf, limit - buf); if (value == 0) skip_if_group (pfile, 0); else { ++pfile->if_stack->if_succeeded; /* continue processing input */ output_line_command (pfile, 1, same_file); } } return 0; } /* * evaluate a #if expression in BUF, of length LENGTH, * then parse the result as a C expression and return the value as an int. */ static HOST_WIDE_INT eval_if_expression (cppReader *pfile, /*@unused@*/ char *buf, /*@unused@*/ int length) { hashNode save_defined; HOST_WIDE_INT value; size_t old_written = cpplib_getWritten (pfile); DPRINTF (("Saving defined...")); save_defined = cpphash_install ("defined", -1, T_SPEC_DEFINED, 0, 0, -1); pfile->pcp_inside_if = 1; value = cppReader_parseExpression (pfile); pfile->pcp_inside_if = 0; /* Clean up special symbol */ DPRINTF (("Removing defined...")); cppReader_deleteMacro (save_defined); cppReader_setWritten (pfile, old_written); /* Pop */ return value; } /* * routine to handle ifdef/ifndef. Try to look up the symbol, * then do or don't skip to the #endif/#else/#elif depending * on what directive is actually being processed. */ static int do_xifdef (cppReader *pfile, struct directive *keyword, /*@unused@*/ char *unused1, /*@unused@*/ char *unused2) { int skip; cppBuffer *ip = cppReader_getBufferSafe (pfile); char *ident; size_t ident_length; enum cpp_token token; int start_of_file = 0; char *control_macro = 0; size_t old_written = cpplib_getWritten (pfile); DPRINTF (("do xifdef: %d", keyword->type == T_IFNDEF)); /* Detect a #ifndef at start of file (not counting comments). */ if (cstring_isDefined (ip->fname) && keyword->type == T_IFNDEF) { start_of_file = pfile->only_seen_white == 2; } pfile->no_macro_expand++; token = get_directive_token (pfile); pfile->no_macro_expand--; ident = pfile->token_buffer + old_written; DPRINTF (("Ident: %s", ident)); ident_length = cpplib_getWritten (pfile) - old_written; cppReader_setWritten (pfile, old_written); /* Pop */ if (token == CPP_VSPACE || token == CPP_POP || token == CPP_EOF) { skip = (keyword->type == T_IFDEF); if (! cppReader_isTraditional (pfile)) { cppReader_pedwarn (pfile, message ("`#%s' with no argument", keyword->name)); } } else if (token == CPP_NAME) { hashNode hp = cpphash_lookup (ident, size_toInt (ident_length), -1); skip = (keyword->type == T_IFDEF) ? (hp == NULL) : (hp != NULL); DPRINTF (("hp null: %d / %d / %d", hp == NULL, keyword->type == T_IFNDEF, skip)); if (start_of_file && !skip) { DPRINTF (("Not skipping!")); control_macro = (char *) dmalloc (ident_length + 1); memcpy (control_macro, ident, ident_length + 1); } } else { skip = (keyword->type == T_IFDEF); if (! cppReader_isTraditional (pfile)) { cppReader_error (pfile, message ("`#%s' with invalid argument", keyword->name)); } } if (!cppReader_isTraditional (pfile)) { int c; cppSkipHspace (pfile); c = cppReader_peekC (pfile); if (c != EOF && c != '\n') { cppReader_pedwarn (pfile, message ("garbage at end of `#%s' argument", keyword->name)); } } cppReader_skipRestOfLine (pfile); DPRINTF (("Conditional skip: %d", skip)); conditional_skip (pfile, skip, T_IF, control_macro); return 0; } /* Push TYPE on stack; then, if SKIP is nonzero, skip ahead. If this is a #ifndef starting at the beginning of a file, CONTROL_MACRO is the macro name tested by the #ifndef. Otherwise, CONTROL_MACRO is 0. */ static void conditional_skip (cppReader *pfile, int skip, enum node_type type, /*@dependent@*/ char *control_macro) { cppIfStackFrame *temp = (cppIfStackFrame *) dmalloc (sizeof (*temp)); temp->fname = cppReader_getBufferSafe (pfile)->nominal_fname; temp->next = pfile->if_stack; temp->control_macro = control_macro; temp->lineno = 0; temp->if_succeeded = 0; pfile->if_stack = temp; pfile->if_stack->type = type; if (skip != 0) { skip_if_group (pfile, 0); return; } else { ++pfile->if_stack->if_succeeded; output_line_command (pfile, 1, same_file); } } /* * skip to #endif, #else, or #elif. adjust line numbers, etc. * leaves input ptr at the sharp sign found. * If ANY is nonzero, return at next directive of any sort. */ static void skip_if_group (cppReader *pfile, int any) { int c; struct directive *kt; cppIfStackFrame *save_if_stack = pfile->if_stack; /* don't pop past here */ register int ident_length; char *ident; struct parse_marker line_start_mark; parseSetMark (&line_start_mark, pfile); if (CPPOPTIONS (pfile)->output_conditionals) { static char failed[] = "#failed\n"; cppReader_puts (pfile, failed, sizeof(failed)-1); pfile->lineno++; output_line_command (pfile, 1, same_file); } beg_of_line: if (CPPOPTIONS (pfile)->output_conditionals) { cppBuffer *pbuf = cppReader_getBufferSafe (pfile); char *start_line; llassert (pbuf->buf != NULL); start_line = pbuf->buf + line_start_mark.position; cppReader_puts (pfile, start_line, size_fromInt (pbuf->cur - start_line)); } parseMoveMark (&line_start_mark, pfile); if (!cppReader_isTraditional (pfile)) { cppSkipHspace (pfile); } c = cppReader_getC (pfile); if (c == '#') { size_t old_written = cpplib_getWritten (pfile); cppSkipHspace (pfile); parse_name (pfile, cppReader_getC (pfile)); ident_length = size_toInt (cpplib_getWritten (pfile) - old_written); ident = pfile->token_buffer + old_written; pfile->limit = ident; for (kt = directive_table; kt->length >= 0; kt++) { cppIfStackFrame *temp; if (ident_length == kt->length && cstring_equalPrefix (kt->name, cstring_fromChars (ident))) { /* If we are asked to return on next directive, do so now. */ if (any) { goto done; } switch (kt->type) { case T_IF: case T_IFDEF: case T_IFNDEF: temp = (cppIfStackFrame *) dmalloc (sizeof (*temp)); temp->next = pfile->if_stack; temp->fname = cppReader_getBufferSafe (pfile)->nominal_fname; temp->type = kt->type; temp->lineno = 0; temp->if_succeeded = 0; temp->control_macro = NULL; pfile->if_stack = temp; /*@switchbreak@*/ break; case T_ELSE: case T_ENDIF: if (cppReader_isPedantic (pfile) && pfile->if_stack != save_if_stack) validate_else (pfile, cstring_makeLiteralTemp (kt->type == T_ELSE ? "#else" : "#endif")); /*@fallthrough@*/ case T_ELIF: if (pfile->if_stack == cppReader_getBufferSafe (pfile)->if_stack) { cppReader_error (pfile, message ("Preprocessor command #%s is not within a conditional", kt->name)); /*@switchbreak@*/ break; } else if (pfile->if_stack == save_if_stack) { goto done; /* found what we came for */ } else { ; } if (kt->type != T_ENDIF) { llassert (pfile->if_stack != NULL); if (pfile->if_stack->type == T_ELSE) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("`#else' or `#elif' after `#else'")); } pfile->if_stack->type = kt->type; /*@switchbreak@*/ break; } temp = pfile->if_stack; llassert (temp != NULL); pfile->if_stack = temp->next; sfree (temp); /*@switchbreak@*/ break; default: ; /*@-branchstate@*/ #if defined (OS2) && defined (__IBMC__) /* Dummy code to eleminate optimization problems with icc */ c = 0; # endif } /*@=branchstate@*/ break; } /* Don't let erroneous code go by. */ if (kt->length < 0 && !CPPOPTIONS (pfile)->lang_asm && cppReader_isPedantic (pfile)) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("Invalid preprocessor directive name")); } } c = cppReader_getC (pfile); } /* We're in the middle of a line. Skip the rest of it. */ for (;;) { size_t old; switch (c) { case EOF: goto done; case '/': /* possible comment */ c = skip_comment (pfile, NULL); if (c == EOF) goto done; /*@switchbreak@*/ break; case '\"': case '\'': cppReader_forward (pfile, -1); old = cpplib_getWritten (pfile); (void) cpplib_getToken (pfile); cppReader_setWritten (pfile, old); /*@switchbreak@*/ break; case '\\': /* Char after backslash loses its special meaning. */ if (cppReader_peekC (pfile) == '\n') { cppReader_forward (pfile, 1); } /*@switchbreak@*/ break; case '\n': goto beg_of_line; } c = cppReader_getC (pfile); } done: if (CPPOPTIONS (pfile)->output_conditionals) { static char end_failed[] = "#endfailed\n"; cppReader_puts (pfile, end_failed, sizeof(end_failed)-1); pfile->lineno++; } pfile->only_seen_white = 1; parseGotoMark (&line_start_mark, pfile); parseClearMark (&line_start_mark); } /* * handle a #else directive. Do this by just continuing processing * without changing if_stack ; this is so that the error message * for missing #endif's etc. will point to the original #if. It * is possible that something different would be better. */ static int do_else (cppReader *pfile, /*@unused@*/ struct directive *keyword, /*@unused@*/ char *buf, /*@unused@*/ char *limit) { if (cppReader_isPedantic (pfile)) { validate_else (pfile, cstring_makeLiteralTemp ("#else")); } cppReader_skipRestOfLine (pfile); if (pfile->if_stack == cppReader_getBufferSafe (pfile)->if_stack) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Preprocessor command #else is not within a conditional")); return 0; } else { /* #ifndef can't have its special treatment for containing the whole file if it has a #else clause. */ llassert (pfile->if_stack != NULL); pfile->if_stack->control_macro = 0; if (pfile->if_stack->type != T_IF && pfile->if_stack->type != T_ELIF) { cpp_setLocation (pfile); genppllerrorhint (FLG_PREPROC, message ("Pre-processor directive #else after #else"), message ("%q: Location of match", fileloc_unparseRaw (pfile->if_stack->fname, pfile->if_stack->lineno))); } pfile->if_stack->type = T_ELSE; } if (pfile->if_stack->if_succeeded) skip_if_group (pfile, 0); else { ++pfile->if_stack->if_succeeded; /* continue processing input */ output_line_command (pfile, 1, same_file); } return 0; } /* * unstack after #endif command */ static int do_endif (cppReader *pfile, /*@unused@*/ struct directive *keyword, /*@unused@*/ char *buf, /*@unused@*/ char *limit) { if (cppReader_isPedantic (pfile)) { validate_else (pfile, cstring_makeLiteralTemp ("#endif")); } cppReader_skipRestOfLine (pfile); if (pfile->if_stack == cppReader_getBufferSafe (pfile)->if_stack) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Unbalanced #endif")); } else { cppIfStackFrame *temp = pfile->if_stack; llassert (temp != NULL); pfile->if_stack = temp->next; if (temp->control_macro != 0) { /* This #endif matched a #ifndef at the start of the file. See if it is at the end of the file. */ struct parse_marker start_mark; int c; parseSetMark (&start_mark, pfile); for (;;) { cppSkipHspace (pfile); c = cppReader_getC (pfile); if (c != '\n') break; } parseGotoMark (&start_mark, pfile); parseClearMark (&start_mark); if (c == EOF) { /* If we get here, this #endif ends a #ifndef that contains all of the file (aside from whitespace). Arrange not to include the file again if the macro that was tested is defined. Do not do this for the top-level file in a -include or any file in a -imacros. */ struct file_name_list *ifile = pfile->all_include_files; for ( ; ifile != NULL; ifile = ifile->next) { if (cstring_equal (ifile->fname, cppReader_getBufferSafe (pfile)->fname)) { ifile->control_macro = temp->control_macro; break; } } } } sfree (temp); output_line_command (pfile, 1, same_file); } return 0; } /* When an #else or #endif is found while skipping failed conditional, if -pedantic was specified, this is called to warn about text after the command name. P points to the first char after the command name. */ static void validate_else (cppReader *pfile, cstring directive) { int c; cppSkipHspace (pfile); c = cppReader_peekC (pfile); if (c != EOF && c != '\n') { cppReader_pedwarn (pfile, message ("text following `%s' violates ANSI standard", directive)); } } /* ** Get the next token, and add it to the text in pfile->token_buffer. ** Return the kind of token we got. */ enum cpp_token cpplib_getToken (cppReader *pfile) { return cpplib_getTokenAux (pfile, FALSE); } enum cpp_token cpplib_getTokenForceExpand (cppReader *pfile) { return cpplib_getTokenAux (pfile, TRUE); } enum cpp_token cpplib_getTokenAux (cppReader *pfile, bool forceExpand) { int c, c2, c3; size_t old_written = 0; int start_line, start_column; enum cpp_token token; struct cppOptions *opts = CPPOPTIONS (pfile); cppReader_getBufferSafe (pfile)->prev = cppReader_getBufferSafe (pfile)->cur; get_next: c = cppReader_getC (pfile); DPRINTF (("Get next token: %c", c)); if (c == EOF) { handle_eof: if (cppReader_getBufferSafe (pfile)->seen_eof) { cppBuffer *buf = cppReader_popBuffer (pfile); if (buf != cppReader_nullBuffer (pfile)) { goto get_next; } else { return CPP_EOF; } } else { cppBuffer *next_buf = cppBuffer_prevBuffer (cppReader_getBufferSafe (pfile)); cppReader_getBufferSafe (pfile)->seen_eof = 1; if (cstring_isDefined (cppReader_getBufferSafe (pfile)->nominal_fname) && next_buf != cppReader_nullBuffer (pfile)) { /* We're about to return from an #include file. Emit #line information now (as part of the CPP_POP) result. But the #line refers to the file we will pop to. */ cppBuffer *cur_buffer = CPPBUFFER (pfile); CPPBUFFER (pfile) = next_buf; pfile->input_stack_listing_current = 0; output_line_command (pfile, 0, leave_file); CPPBUFFER (pfile) = cur_buffer; } return CPP_POP; } } else { long newlines; struct parse_marker start_mark; switch (c) { case '/': if (cppReader_peekC (pfile) == '=') { goto op2; } if (opts->put_out_comments) { parseSetMark (&start_mark, pfile); } newlines = 0; cppBuffer_getLineAndColumn (cppReader_fileBuffer (pfile), &start_line, &start_column); c = skip_comment (pfile, &newlines); DPRINTF (("c = %c", c)); if (opts->put_out_comments && (c == '/' || c == EOF)) { assertSet (&start_mark); parseClearMark (&start_mark); } if (c == '/') goto randomchar; if (c == EOF) { cppReader_errorWithLine (pfile, start_line, start_column, cstring_makeLiteral ("Unterminated comment")); goto handle_eof; } c = '/'; /* Initial letter of comment. */ return_comment: /* Comments are equivalent to spaces. For -traditional, a comment is equivalent to nothing. */ if (opts->put_out_comments) { enum cpp_token res; assertSet (&start_mark); res = cpp_handleComment (pfile, &start_mark); pfile->lineno += newlines; return res; } else if (cppReader_isTraditional (pfile)) { return CPP_COMMENT; } else { cpplib_reserve(pfile, 1); cppReader_putCharQ (pfile, ' '); return CPP_HSPACE; } case '#': if (!pfile->only_seen_white) { goto randomchar; } if (cppReader_handleDirective (pfile)) { return CPP_DIRECTIVE; } pfile->only_seen_white = 0; return CPP_OTHER; case '\"': case '\'': /* A single quoted string is treated like a double -- some programs (e.g., troff) are perverse this way */ cppBuffer_getLineAndColumn (cppReader_fileBuffer (pfile), &start_line, &start_column); old_written = cpplib_getWritten (pfile); string: DPRINTF (("Reading string: %c", c)); cppReader_putChar (pfile, c); while (TRUE) { /* evans-2003-06-07 ** Because of ISO8859-1 characters in string literals, we need a special test here. */ if (cppReader_reachedEOF (pfile)) { DPRINTF (("Matches EOF!")); if (cppBuffer_isMacro (CPPBUFFER (pfile))) { /* try harder: this string crosses a macro expansion boundary. This can happen naturally if -traditional. Otherwise, only -D can make a macro with an unmatched quote. */ cppBuffer *next_buf = cppBuffer_prevBuffer (cppReader_getBufferSafe (pfile)); (*cppReader_getBufferSafe (pfile)->cleanup) (cppReader_getBufferSafe (pfile), pfile); CPPBUFFER (pfile) = next_buf; continue; } if (!cppReader_isTraditional (pfile)) { cpp_setLocation (pfile); setLine (long_toInt (start_line)); setColumn (long_toInt (start_column)); if (pfile->multiline_string_line != long_toInt (start_line) && pfile->multiline_string_line != 0) { genppllerrorhint (FLG_PREPROC, message ("Unterminated string or character constant"), message ("%q: Possible real start of unterminated constant", fileloc_unparseRaw (fileloc_filename (g_currentloc), pfile->multiline_string_line))); pfile->multiline_string_line = 0; } else { genppllerror (FLG_PREPROC, message ("Unterminated string or character constant")); } } /*@loopbreak@*/ break; } else { int cc = cppReader_getC (pfile); DPRINTF (("cc: %c [%d] [%d]", cc, cc, EOF)); DPRINTF (("putting char: %c", cc)); cppReader_putChar (pfile, cc); switch (cc) { case '\n': /* Traditionally, end of line ends a string constant with no error. So exit the loop and record the new line. */ if (cppReader_isTraditional (pfile)) goto while2end; if (c == '\'') { goto while2end; } if (cppReader_isPedantic (pfile) && pfile->multiline_string_line == 0) { cppReader_pedwarnWithLine (pfile, long_toInt (start_line), long_toInt (start_column), cstring_makeLiteral ("String constant runs past end of line")); } if (pfile->multiline_string_line == 0) { pfile->multiline_string_line = start_line; } /*@switchbreak@*/ break; case '\\': cc = cppReader_getC (pfile); if (cc == '\n') { /* Backslash newline is replaced by nothing at all. */ pfile->lineno++; /* 2003-11-03: AMiller suggested adding this, but its not clear why it is needed. */ cppReader_adjustWritten (pfile, -1); pfile->lineno++; } else { /* ANSI stupidly requires that in \\ the second \ is *not* prevented from combining with a newline. */ NEWLINE_FIX1(cc); if (cc != EOF) cppReader_putChar (pfile, cc); } /*@switchbreak@*/ break; case '\"': case '\'': if (cc == c) goto while2end; /*@switchbreak@*/ break; } } } while2end: pfile->lineno += count_newlines (pfile->token_buffer + old_written, cpplib_getPWritten (pfile)); pfile->only_seen_white = 0; return c == '\'' ? CPP_CHAR : CPP_STRING; case '$': if (!opts->dollars_in_ident) goto randomchar; goto letter; case ':': if (opts->cplusplus && cppReader_peekC (pfile) == ':') goto op2; goto randomchar; case '&': case '+': case '|': NEWLINE_FIX; c2 = cppReader_peekC (pfile); if (c2 == c || c2 == '=') goto op2; goto randomchar; case '*': case '!': case '%': case '=': case '^': NEWLINE_FIX; if (cppReader_peekC (pfile) == '=') goto op2; goto randomchar; case '-': NEWLINE_FIX; c2 = cppReader_peekC (pfile); if (c2 == '-' && opts->chill) { /* Chill style comment */ if (opts->put_out_comments) { parseSetMark (&start_mark, pfile); } cppReader_forward (pfile, 1); /* Skip second '-'. */ for (;;) { c = cppReader_getC (pfile); if (c == EOF) /*@loopbreak@*/ break; if (c == '\n') { /* Don't consider final '\n' to be part of comment. */ cppReader_forward (pfile, -1); /*@loopbreak@*/ break; } } c = '-'; goto return_comment; } if (c2 == '-' || c2 == '=' || c2 == '>') goto op2; goto randomchar; case '<': if (pfile->parsing_include_directive) { for (;;) { cppReader_putChar (pfile, c); if (c == '>') /*@loopbreak@*/ break; c = cppReader_getC (pfile); NEWLINE_FIX1 (c); if (c == '\n' || c == EOF) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Missing '>' in \"#include \"")); /*@loopbreak@*/ break; } } return CPP_STRING; } /*@fallthrough@*/ case '>': NEWLINE_FIX; c2 = cppReader_peekC (pfile); if (c2 == '=') goto op2; if (c2 != c) goto randomchar; cppReader_forward (pfile, 1); cpplib_reserve (pfile, 4); cppReader_putChar (pfile, c); cppReader_putChar (pfile, c2); NEWLINE_FIX; c3 = cppReader_peekC (pfile); if (c3 == '=') cppReader_putCharQ (pfile, cppReader_getC (pfile)); cppReader_nullTerminateQ (pfile); pfile->only_seen_white = 0; return CPP_OTHER; case '@': DPRINTF (("Macro @!")); if (cppReader_getBufferSafe (pfile)->has_escapes) { c = cppReader_getC (pfile); DPRINTF (("got c: %c", c)); if (c == '-') { if (pfile->output_escapes) cppReader_puts (pfile, "@-", 2); parse_name (pfile, cppReader_getC (pfile)); return CPP_NAME; } else if (is_space [c]) { cpplib_reserve (pfile, 2); if (pfile->output_escapes) cppReader_putCharQ (pfile, '@'); cppReader_putCharQ (pfile, c); return CPP_HSPACE; } else { ; } } if (pfile->output_escapes) { cppReader_puts (pfile, "@@", 2); return CPP_OTHER; } goto randomchar; case '.': NEWLINE_FIX; c2 = cppReader_peekC (pfile); if (isdigit(c2)) { cpplib_reserve(pfile, 2); cppReader_putCharQ (pfile, '.'); c = cppReader_getC (pfile); goto number; } /* FIXME - misses the case "..\\\n." */ if (c2 == '.' && cpp_peekN (pfile, 1) == '.') { cpplib_reserve(pfile, 4); cppReader_putCharQ (pfile, '.'); cppReader_putCharQ (pfile, '.'); cppReader_putCharQ (pfile, '.'); cppReader_forward (pfile, 2); cppReader_nullTerminateQ (pfile); pfile->only_seen_white = 0; return CPP_3DOTS; } goto randomchar; op2: token = CPP_OTHER; pfile->only_seen_white = 0; op2any: /* jumped to for \ continuations */ cpplib_reserve(pfile, 3); cppReader_putCharQ (pfile, c); /* evans 2003-08-24: This is a hack to fix line output for \ continuations. Someday I really should get a decent pre-processor! */ if (c == '\\') { (void) cppReader_getC (pfile); /* skip the newline to avoid extra lines */ } else { cppReader_putCharQ (pfile, cppReader_getC (pfile)); } cppReader_nullTerminateQ (pfile); return token; case 'L': NEWLINE_FIX; c2 = cppReader_peekC (pfile); if ((c2 == '\'' || c2 == '\"') && !cppReader_isTraditional (pfile)) { cppReader_putChar (pfile, c); c = cppReader_getC (pfile); goto string; } goto letter; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': number: c2 = '.'; for (;;) { cpplib_reserve (pfile, 2); cppReader_putCharQ (pfile, c); NEWLINE_FIX; c = cppReader_peekC (pfile); if (c == EOF) /*@loopbreak@*/ break; if (!is_idchar[c] && c != '.' && ((c2 != 'e' && c2 != 'E' && ((c2 != 'p' && c2 != 'P') || cppReader_isC89 (pfile))) || (c != '+' && c != '-'))) /*@loopbreak@*/ break; cppReader_forward (pfile, 1); c2= c; } cppReader_nullTerminateQ (pfile); pfile->only_seen_white = 0; return CPP_NUMBER; case 'b': case 'c': case 'd': case 'h': case 'o': case 'B': case 'C': case 'D': case 'H': case 'O': if (opts->chill && cppReader_peekC (pfile) == '\'') { pfile->only_seen_white = 0; cpplib_reserve (pfile, 2); cppReader_putCharQ (pfile, c); cppReader_putCharQ (pfile, '\''); cppReader_forward (pfile, 1); for (;;) { c = cppReader_getC (pfile); if (c == EOF) goto chill_number_eof; if (!is_idchar[c]) { if (c == '\\' && cppReader_peekC (pfile) == '\n') { cppReader_forward (pfile, 2); continue; } /*@loopbreak@*/ break; } cppReader_putChar (pfile, c); } if (c == '\'') { cpplib_reserve (pfile, 2); cppReader_putCharQ (pfile, c); cppReader_nullTerminateQ (pfile); return CPP_STRING; } else { cppReader_forward (pfile, -1); chill_number_eof: cppReader_nullTerminate (pfile); return CPP_NUMBER; } } else goto letter; case '_': case 'a': case 'e': case 'f': case 'g': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case 'A': case 'E': case 'F': case 'G': case 'I': case 'J': case 'K': case 'M': case 'N': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': letter: { hashNode hp; char *ident; size_t before_name_written = cpplib_getWritten (pfile); size_t ident_len; parse_name (pfile, c); pfile->only_seen_white = 0; if (pfile->no_macro_expand) { DPRINTF (("Not expanding: %s", pfile->token_buffer)); return CPP_NAME; } ident = pfile->token_buffer + before_name_written; DPRINTF (("Ident: %s", ident)); ident_len = size_fromInt ((cpplib_getPWritten (pfile)) - ident); hp = cpphash_lookupExpand (ident, size_toInt (ident_len), -1, forceExpand); if (hp == NULL) { DPRINTF (("No expand: %s %d", ident, ident_len)); return CPP_NAME; } if (hp->type == T_DISABLED) { DPRINTF (("Disabled!")); if (pfile->output_escapes) { /* Return "@-IDENT", followed by '\0'. */ int i; cpplib_reserve (pfile, 3); ident = pfile->token_buffer + before_name_written; cppReader_adjustWritten (pfile, 2); for (i = size_toInt (ident_len); i >= 0; i--) { ident[i+2] = ident[i]; } ident[0] = '@'; ident[1] = '-'; } return CPP_NAME; } /* ** If macro wants an arglist, verify that a '(' follows. ** first skip all whitespace, copying it to the output ** after the macro name. Then, if there is no '(', ** decide this is not a macro call and leave things that way. */ if (hp->type == T_MACRO && hp->value.defn->nargs >= 0) { struct parse_marker macro_mark; int is_macro_call; DPRINTF (("Arglist macro!")); /* ** evans 2002-07-03: Moved this here (from below). ** This bug caused necessary whitespace to be lost ** when parsing parameterized macros without parameters. */ parseSetMark (¯o_mark, pfile); while (cppBuffer_isMacro (CPPBUFFER (pfile))) { cppBuffer *next_buf; cppSkipHspace (pfile); if (cppReader_peekC (pfile) != EOF) { DPRINTF (("Peeking!")); /*@loopbreak@*/ break; } next_buf = cppBuffer_prevBuffer (cppReader_getBufferSafe (pfile)); (*cppReader_getBufferSafe (pfile)->cleanup) (cppReader_getBufferSafe (pfile), pfile); CPPBUFFER (pfile) = next_buf; } /* parseSetMark (¯o_mark, pfile); */ for (;;) { cppSkipHspace (pfile); c = cppReader_peekC (pfile); DPRINTF (("c: %c", c)); is_macro_call = c == '('; if (c != '\n') /*@loopbreak@*/ break; cppReader_forward (pfile, 1); } if (!is_macro_call) { parseGotoMark (¯o_mark, pfile); } parseClearMark (¯o_mark); if (!is_macro_call) { DPRINTF (("not macro call!")); return CPP_NAME; } } /* This is now known to be a macro call. */ /* it might not actually be a macro. */ if (hp->type != T_MACRO) { size_t xbuf_len; char *xbuf; cppReader_setWritten (pfile, before_name_written); special_symbol (hp, pfile); xbuf_len = cpplib_getWritten (pfile) - before_name_written; xbuf = (char *) dmalloc (xbuf_len + 1); cppReader_setWritten (pfile, before_name_written); memcpy (xbuf, cpplib_getPWritten (pfile), xbuf_len + 1); push_macro_expansion (pfile, xbuf, xbuf_len, hp); } else { /* ** Expand the macro, reading arguments as needed, ** and push the expansion on the input stack. */ cpplib_macroExpand (pfile, hp); cppReader_setWritten (pfile, before_name_written); } /* An extra "@ " is added to the end of a macro expansion to prevent accidental token pasting. We prefer to avoid unneeded extra spaces (for the sake of cpp-using tools like imake). Here we remove the space if it is safe to do so. */ llassert (pfile->buffer->rlimit != NULL); if (pfile->buffer->rlimit - pfile->buffer->cur >= 3 && pfile->buffer->rlimit[-2] == '@' && pfile->buffer->rlimit[-1] == ' ') { int c1 = pfile->buffer->rlimit[-3]; int cl2 = cpplib_bufPeek (cppBuffer_prevBuffer (CPPBUFFER (pfile))); if (cl2 == EOF || !unsafe_chars ((char) c1, (char) cl2)) pfile->buffer->rlimit -= 2; } } goto get_next; case ' ': case '\t': case '\v': case '\r': for (;;) { cppReader_putChar (pfile, c); c = cppReader_peekC (pfile); if (c == EOF || !is_hor_space[c]) /*@loopbreak@*/ break; cppReader_forward (pfile, 1); } return CPP_HSPACE; case '\\': c2 = cppReader_peekC (pfile); /* allow other stuff here if a flag is set? */ DPRINTF (("Got continuation!")); if (c2 != '\n') goto randomchar; token = CPP_HSPACE; goto op2any; case '\n': cppReader_putChar (pfile, c); if (pfile->only_seen_white == 0) pfile->only_seen_white = 1; pfile->lineno++; output_line_command (pfile, 1, same_file); return CPP_VSPACE; case '(': token = CPP_LPAREN; goto char1; case ')': token = CPP_RPAREN; goto char1; case '{': token = CPP_LBRACE; goto char1; case '}': token = CPP_RBRACE; goto char1; case ',': token = CPP_COMMA; goto char1; case ';': token = CPP_SEMICOLON; goto char1; randomchar: default: token = CPP_OTHER; char1: pfile->only_seen_white = 0; cppReader_putChar (pfile, c); return token; } } BADBRANCH; /*@notreached@*/ } /* Parse an identifier starting with C. */ void parse_name (cppReader *pfile, int c) { for (;;) { if (!is_idchar[c]) { if (c == '\\' && cppReader_peekC (pfile) == '\n') { cppReader_forward (pfile, 2); continue; } cppReader_forward (pfile, -1); break; } if (c == '$' && cppReader_isPedantic (pfile)) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("`$' in identifier")); } cpplib_reserve(pfile, 2); /* One more for final NUL. */ cppReader_putCharQ (pfile, c); c = cppReader_getC (pfile); if (c == EOF) break; } cppReader_nullTerminateQ (pfile); } /* The file_name_map structure holds a mapping of file names for a particular directory. This mapping is read from the file named FILE_NAME_MAP_FILE in that directory. Such a file can be used to map filenames on a file system with severe filename restrictions, such as DOS. The format of the file name map file is just a series of lines with two tokens on each line. The first token is the name to map, and the second token is the actual name to use. */ struct file_name_map { struct file_name_map *map_next; cstring map_from; cstring map_to; }; /*@constant observer char *FILE_NAME_MAP_FILE*/ #define FILE_NAME_MAP_FILE "header.gcc" /* Read a space delimited string of unlimited length from a stdio file. */ static cstring read_filename_string (int ch, /*:open:*/ FILE *f) { char *alloc, *set; size_t len; len = 20; set = alloc = dmalloc (len + 1); if (!is_space[ch]) { *set++ = ch; while ((ch = getc (f)) != EOF && ! is_space[ch]) { if (set - alloc == size_toInt (len)) { len *= 2; alloc = drealloc (alloc, len + 1); set = alloc + len / 2; /*@-branchstate@*/ } *set++ = ch; } /*@=branchstate@*/ } *set = '\0'; check (ungetc (ch, f) != EOF); return cstring_fromChars (alloc); } /* This structure holds a linked list of file name maps, one per directory. */ struct file_name_map_list { /*@only@*/ struct file_name_map_list *map_list_next; /*@only@*/ cstring map_list_name; /*@null@*/ struct file_name_map *map_list_map; }; /* Read the file name map file for DIRNAME. */ static struct file_name_map * read_name_map (cppReader *pfile, cstring dirname) { struct file_name_map_list *map_list_ptr; cstring name; FILE *f; for (map_list_ptr = CPPOPTIONS (pfile)->map_list; map_list_ptr != NULL; map_list_ptr = map_list_ptr->map_list_next) { if (cstring_equal (map_list_ptr->map_list_name, dirname)) { return map_list_ptr->map_list_map; } } map_list_ptr = (struct file_name_map_list *) dmalloc (sizeof (*map_list_ptr)); map_list_ptr->map_list_name = cstring_copy (dirname); map_list_ptr->map_list_map = NULL; name = cstring_copy (dirname); if (cstring_length (dirname) > 0) { name = cstring_appendChar (name, CONNECTCHAR); } name = cstring_concatFree1 (name, cstring_makeLiteralTemp (FILE_NAME_MAP_FILE)); f = fileTable_openReadFile (context_fileTable (), name); cstring_free (name); if (f == NULL) { map_list_ptr->map_list_map = NULL; } else { int ch; while ((ch = getc (f)) != EOF) { cstring from, to; struct file_name_map *ptr; if (is_space[ch]) { continue; } from = read_filename_string (ch, f); while ((ch = getc (f)) != EOF && is_hor_space[ch]) { ; } to = read_filename_string (ch, f); ptr = (struct file_name_map *) dmalloc (sizeof (*ptr)); ptr->map_from = from; /* Make the real filename absolute. */ if (cstring_length (to) > 1 && osd_isConnectChar (cstring_firstChar (to))) { ptr->map_to = to; } else { ptr->map_to = cstring_copy (dirname); ptr->map_to = cstring_appendChar (ptr->map_to, CONNECTCHAR); ptr->map_to = cstring_concatFree (ptr->map_to, to); } ptr->map_next = map_list_ptr->map_list_map; map_list_ptr->map_list_map = ptr; while ((ch = getc (f)) != '\n') { if (ch == EOF) { /*@innerbreak@*/ break; } } } assertSet (map_list_ptr->map_list_map); check (fileTable_closeFile (context_fileTable (),f) == 0); } map_list_ptr->map_list_next = pfile->opts->map_list; pfile->opts->map_list = map_list_ptr; return map_list_ptr->map_list_map; } /* Try to open include file FILENAME. SEARCHPTR is the directory being tried from the include file search path. This function maps filenames on file systems based on information read by read_name_map. */ static int open_include_file (cppReader *pfile, cstring fname, struct file_name_list *searchptr) { char *filename = cstring_toCharsSafe (fname); struct file_name_map *map; char *from; char *p, *dir; cstring_markOwned (fname); cpp_setLocation (pfile); if (context_getFlag (FLG_NEVERINCLUDE)) { if (isHeaderFile (fname)) { return SKIP_INCLUDE; } } if ((searchptr != NULL) && ! searchptr->got_name_map) { searchptr->name_map = read_name_map (pfile, !cstring_isEmpty (searchptr->fname) ? searchptr->fname : cstring_makeLiteralTemp (".")); searchptr->got_name_map = 1; } /* First check the mapping for the directory we are using. */ if ((searchptr != NULL) && (searchptr->name_map != NULL)) { from = filename; if (!cstring_isEmpty (searchptr->fname)) { from += cstring_length (searchptr->fname) + 1; } for (map = searchptr->name_map; map != NULL; map = map->map_next) { if (cstring_equal (map->map_from, cstring_fromChars (from))) { /* ** Found a match. Check if the file should be skipped */ if (cpp_skipIncludeFile (map->map_to)) { return SKIP_INCLUDE; } else { return cpp_openIncludeFile (cstring_toCharsSafe (map->map_to)); } } } } /* ** Try to find a mapping file for the particular directory we are ** looking in. Thus #include will look up sys/types.h ** in /usr/include/header.gcc and look up types.h in ** /usr/include/sys/header.gcc. */ p = strrchr (filename, CONNECTCHAR); if (p == NULL) { p = filename; } if ((searchptr != NULL) && (cstring_isDefined (searchptr->fname)) && (size_toInt (cstring_length (searchptr->fname)) == p - filename) && !strncmp (cstring_toCharsSafe (searchptr->fname), filename, size_fromInt (p - filename))) { /* filename is in SEARCHPTR, which we've already checked. */ if (cpp_skipIncludeFile (cstring_fromChars (filename))) { return SKIP_INCLUDE; } else { return cpp_openIncludeFile (filename); } } if (p == filename) { dir = mstring_copy ("."); from = filename; } else { dir = (char *) dmalloc (size_fromInt (p - filename + 1)); memcpy (dir, filename, size_fromInt (p - filename)); dir[p - filename] = '\0'; from = p + 1; } for (map = read_name_map (pfile, cstring_fromChars (dir)); map != NULL; map = map->map_next) { if (cstring_equal (map->map_from, cstring_fromChars (from))) { sfree (dir); if (cpp_skipIncludeFile (map->map_to)) { return SKIP_INCLUDE; } else { return cpp_openIncludeFile (cstring_toCharsSafe (map->map_to)); } } } sfree (dir); if (cpp_skipIncludeFile (cstring_fromChars (filename))) { return SKIP_INCLUDE; } else { return cpp_openIncludeFile (filename); } } /* Process the contents of include file FNAME, already open on descriptor F, with output to OP. SYSTEM_HEADER_P is 1 if this file resides in any one of the known "system" include directories (as decided by the `is_system_include' function above). DIRPTR is the link in the dir path through which this file was found, or 0 if the file name was absolute or via the current directory. Return 1 on success, 0 on failure. The caller is responsible for the cppReader_pushBuffer. */ static int finclude (cppReader *pfile, int f, cstring fname, bool system_header_p, /*@dependent@*/ struct file_name_list *dirptr) { mode_t st_mode; /* was __mode_t */ size_t st_size; long i; int length = 0; cppBuffer *fp; /* For input stack frame */ if (file_size_and_mode (f, &st_mode, &st_size) < 0) { cppReader_perrorWithName (pfile, fname); check (close (f) == 0); (void) cppReader_popBuffer (pfile); /*@-mustfree@*/ return 0; /*@=mustfree@*/ } fp = cppReader_getBufferSafe (pfile); /*@-temptrans@*/ /* fname shouldn't really be temp */ fp->nominal_fname = fp->fname = fname; /*@=temptrans@*/ fp->dir = dirptr; fp->system_header_p = system_header_p; fp->lineno = 1; fp->colno = 1; fp->cleanup = cppReader_fileCleanup; if (S_ISREG (st_mode)) { sfree (fp->buf); fp->buf = (char *) dmalloc (st_size + 2); fp->alimit = fp->buf + st_size + 2; fp->cur = fp->buf; /* Read the file contents, knowing that st_size is an upper bound on the number of bytes we can read. */ length = safe_read (f, fp->buf, size_toInt (st_size)); fp->rlimit = fp->buf + length; if (length < 0) goto nope; } else if (S_ISDIR (st_mode)) { cppReader_error (pfile, message ("Directory specified where file is expected: %s", fname)); check (close (f) == 0); return 0; } else { /* ** Cannot count its file size before reading. ** First read the entire file into heap and ** copy them into buffer on stack. */ size_t bsize = 2000; st_size = 0; sfree (fp->buf); fp->buf = (char *) dmalloc (bsize + 2); for (;;) { i = safe_read (f, fp->buf + st_size, size_toInt (bsize - st_size)); if (i < 0) goto nope; /* error! */ st_size += i; if (st_size != bsize) { break; /* End of file */ } bsize *= 2; fp->buf = (char *) drealloc (fp->buf, bsize + 2); } fp->cur = fp->buf; length = size_toInt (st_size); } if ((length > 0 && fp->buf[length - 1] != '\n') /* Backslash-newline at end is not good enough. */ || (length > 1 && fp->buf[length - 2] == '\\')) { fp->buf[length++] = '\n'; } fp->buf[length] = '\0'; fp->rlimit = fp->buf + length; /* Close descriptor now, so nesting does not use lots of descriptors. */ check (close (f) == 0); /* Must do this before calling trigraph_pcp, so that the correct file name will be printed in warning messages. */ pfile->input_stack_listing_current = 0; return 1; nope: cppReader_perrorWithName (pfile, fname); check (close (f) == 0); sfree (fp->buf); return 1; } void cpplib_init (cppReader *pfile) { memset ((char *) pfile, 0, sizeof (*pfile)); pfile->get_token = cpplib_getToken; pfile->token_buffer_size = 200; pfile->token_buffer = (char *) dmalloc (pfile->token_buffer_size); pfile->all_include_files = NULL; assertSet (pfile); cppReader_setWritten (pfile, 0); pfile->system_include_depth = 0; pfile->max_include_len = 0; pfile->timebuf = NULL; pfile->only_seen_white = 1; pfile->buffer = cppReader_nullBuffer (pfile); } void cppReader_finish (/*@unused@*/ cppReader *pfile) { ; } /* Free resources used by PFILE. This is the cppReader 'finalizer' or 'destructor' (in C++ terminology). */ void cppCleanup (/*@special@*/ cppReader *pfile) /*@uses pfile@*/ /*@releases pfile@*/ { DPRINTF (("cppCleanup!")); while (CPPBUFFER (pfile) != cppReader_nullBuffer (pfile)) { (void) cppReader_popBuffer (pfile); } if (pfile->token_buffer != NULL) { sfree (pfile->token_buffer); pfile->token_buffer = NULL; } while (pfile->if_stack != NULL) { cppIfStackFrame *temp = pfile->if_stack; pfile->if_stack = temp->next; sfree (temp); } while (pfile->all_include_files != NULL) { struct file_name_list *temp = pfile->all_include_files; pfile->all_include_files = temp->next; /*@-dependenttrans@*/ cstring_free (temp->fname); /*@=dependenttrans@*/ sfree (temp); } /* evans 2002-07-12 */ while (pfile->opts->map_list != NULL) { struct file_name_map_list *temp = pfile->opts->map_list; pfile->opts->map_list = pfile->opts->map_list->map_list_next; cstring_free (temp->map_list_name); sfree (temp); } while (pfile->opts->include != NULL) { struct file_name_list *temp = pfile->opts->include; pfile->opts->include = pfile->opts->include->next; /* cstring_free (temp->fname); */ sfree (temp); } sfree (pfile->opts); pfile->opts = NULL; cppReader_hashCleanup (); } /* ** Get the file-mode and data size of the file open on FD ** and store them in *MODE_POINTER and *SIZE_POINTER. */ static int file_size_and_mode (int fd, mode_t *mode_pointer, size_t *size_pointer) { struct stat sbuf; if (fstat (fd, &sbuf) < 0) { *mode_pointer = 0; *size_pointer = 0; /*@-compdestroy@*/ /* possibly spurious warnings here (or memory leak) */ return (-1); /*@=compdestroy@*/ } if (mode_pointer != NULL) { /*@-type@*/ /* confusion between __mode_t and mode_t types */ *mode_pointer = sbuf.st_mode; /*@=type@*/ } if (size_pointer != NULL) { *size_pointer = (size_t) sbuf.st_size; } /*@-compdestroy@*/ /* possibly spurious warnings here (or memory leak) */ return 0; /*@=compdestroy@*/ } /* Read LEN bytes at PTR from descriptor DESC, for file FILENAME, retrying if necessary. Return a negative value if an error occurs, otherwise return the actual number of bytes read, which must be LEN unless end-of-file was reached. */ static int safe_read (int desc, char *ptr, int len) { int left = len; while (left > 0) { # if defined (WIN32) || defined (OS2) && defined (__IBMC__) /*@-compdef@*/ /* ptr is an out parameter */ int nchars = _read (desc, ptr, (unsigned) left); /*@=compdef@*/ # else ssize_t nchars = read (desc, ptr, size_fromInt (left)); # endif if (nchars < 0) { #ifdef EINTR if (errno == EINTR) continue; #endif return (int) nchars; } if (nchars == 0) { break; } ptr += nchars; left -= nchars; } return len - left; } /* Initialize PMARK to remember the current position of PFILE. */ void parseSetMark (struct parse_marker *pmark, cppReader *pfile) { cppBuffer *pbuf = cppReader_getBufferSafe (pfile); pmark->next = pbuf->marks; /*@-temptrans@*/ pbuf->marks = pmark; /*@=temptrans@*/ pmark->buf = pbuf; pmark->position = pbuf->cur - pbuf->buf; DPRINTF (("set mark: %d / %s", pmark->position, pbuf->cur)); } /* Cleanup PMARK - we no longer need it. */ void parseClearMark (struct parse_marker *pmark) { struct parse_marker **pp = &pmark->buf->marks; for (; ; pp = &(*pp)->next) { llassert (*pp != NULL); if (*pp == pmark) break; } *pp = pmark->next; } /* Backup the current position of PFILE to that saved in PMARK. */ void parseGotoMark (struct parse_marker *pmark, cppReader *pfile) { cppBuffer *pbuf = cppReader_getBufferSafe (pfile); if (pbuf != pmark->buf) { cpp_setLocation (pfile); llfatalbug (cstring_makeLiteral ("Internal error parseGotoMark")); } llassert (pbuf->buf != NULL); pbuf->cur = pbuf->buf + pmark->position; DPRINTF (("goto mark: %d / %s", pmark->position, pbuf->cur)); } /* Reset PMARK to point to the current position of PFILE. (Same as parseClearMark (PMARK), parseSetMark (PMARK, PFILE) but faster. */ void parseMoveMark (struct parse_marker *pmark, cppReader *pfile) { cppBuffer *pbuf = cppReader_getBufferSafe (pfile); if (pbuf != pmark->buf) { cpp_setLocation (pfile); llfatalerror (cstring_makeLiteral ("Internal error parseMoveMark")); } pmark->position = pbuf->cur - pbuf->buf; DPRINTF (("move mark: %s", pmark->position)); } void cpplib_initializeReader (cppReader *pfile) /* Must be done after library is loaded. */ { struct cppOptions *opts = CPPOPTIONS (pfile); cstring xp; /* The code looks at the defaults through this pointer, rather than through the constant structure above. This pointer gets changed if an environment variable specifies other defaults. */ struct default_include *include_defaults = include_defaults_array; /* Add dirs from INCLUDEPATH_VAR after dirs from -I. */ /* There seems to be confusion about what CPATH should do, so for the moment it is not documented. */ /* Some people say that CPATH should replace the standard include dirs, but that seems pointless: it comes before them, so it overrides them anyway. */ xp = osd_getEnvironmentVariable (INCLUDEPATH_VAR); if (cstring_isDefined (xp) && !opts->no_standard_includes) { path_include (pfile, cstring_toCharsSafe (xp)); } /* Now that dollars_in_ident is known, initialize is_idchar. */ initialize_char_syntax (opts); /* CppReader_Install __LINE__, etc. Must follow initialize_char_syntax and option processing. */ initialize_builtins (pfile); /* Do standard #defines and assertions that identify system and machine type. */ if (!opts->inhibit_predefs) { char *p = (char *) dmalloc (strlen (predefs) + 1); strcpy (p, predefs); while (*p) { char *q; while (*p == ' ' || *p == '\t') { p++; } /* Handle -D options. */ if (p[0] == '-' && p[1] == 'D') { q = &p[2]; while (*p && *p != ' ' && *p != '\t') { p++; } if (*p != 0) { *p++= 0; } if (opts->debug_output) { output_line_command (pfile, 0, same_file); } cppReader_define (pfile, q); while (*p == ' ' || *p == '\t') { p++; } } else { abort (); } } sfree (p); } opts->done_initializing = 1; { /* Read the appropriate environment variable and if it exists replace include_defaults with the listed path. */ char *epath = 0; #ifdef __CYGWIN32__ char *win32epath; int win32_buf_size = 0; /* memory we need to allocate */ #endif if (opts->cplusplus) { epath = getenv ("CPLUS_INCLUDE_PATH"); } else { epath = getenv ("C_INCLUDE_PATH"); } /* ** If the environment var for this language is set, ** add to the default list of include directories. */ if (epath != NULL) { char *nstore = (char *) dmalloc (strlen (epath) + 2); int num_dirs; char *startp, *endp; #ifdef __CYGWIN32__ /* if we have a posix path list, convert to win32 path list */ if (cygwin32_posix_path_list_p (epath)) { win32_buf_size = cygwin32_posix_to_win32_path_list_buf_size (epath); win32epath = (char *) dmalloc /*@i4@*/ (win32_buf_size); cygwin32_posix_to_win32_path_list (epath, win32epath); epath = win32epath; } #endif for (num_dirs = 1, startp = epath; *startp; startp++) { if (*startp == PATH_SEPARATOR) num_dirs++; } /*@-sizeoftype@*/ include_defaults = (struct default_include *) dmalloc ((num_dirs * sizeof (struct default_include)) + sizeof (include_defaults_array)); /*@=sizeoftype@*/ startp = endp = epath; num_dirs = 0; while (1) { /* Handle cases like c:/usr/lib:d:/gcc/lib */ if ((*endp == PATH_SEPARATOR) || *endp == 0) { strncpy (nstore, startp, size_fromInt (endp - startp)); if (endp == startp) { strcpy (nstore, "."); } else { nstore[endp-startp] = '\0'; } include_defaults[num_dirs].fname = cstring_fromCharsNew (nstore); include_defaults[num_dirs].cplusplus = opts->cplusplus; include_defaults[num_dirs].cxx_aware = 1; num_dirs++; if (*endp == '\0') { break; } endp = startp = endp + 1; } else { endp++; } } /* Put the usual defaults back in at the end. */ memcpy ((char *) &include_defaults[num_dirs], (char *) include_defaults_array, sizeof (include_defaults_array)); sfree (nstore); /*@-branchstate@*/ } /*@=branchstate@*/ } cppReader_appendIncludeChain (pfile, opts->before_system, opts->last_before_system); opts->first_system_include = opts->before_system; /* Unless -fnostdinc, tack on the standard include file dirs to the specified list */ if (!opts->no_standard_includes) { struct default_include *p = include_defaults; char *specd_prefix = opts->include_prefix; char *default_prefix = mstring_copy (GCC_INCLUDE_DIR); size_t default_len = 0; /* Remove the `include' from /usr/local/lib/gcc.../include. */ if (default_prefix != NULL) { if (!strcmp (default_prefix + strlen (default_prefix) - 8, "/include")) { default_len = strlen (default_prefix) - 7; default_prefix[default_len] = 0; } } /* Search "translated" versions of GNU directories. These have /usr/local/lib/gcc... replaced by specd_prefix. */ if (specd_prefix != 0 && default_len != 0) for (p = include_defaults; p->fname != NULL; p++) { /* Some standard dirs are only for C++. */ if (!p->cplusplus || (opts->cplusplus && !opts->no_standard_cplusplus_includes)) { /* Does this dir start with the prefix? */ llassert (default_prefix != NULL); if (!strncmp (cstring_toCharsSafe (p->fname), default_prefix, default_len)) { /* Yes; change prefix and add to search list. */ struct file_name_list *nlist = (struct file_name_list *) dmalloc (sizeof (*nlist)); size_t this_len = strlen (specd_prefix) + cstring_length (p->fname) - default_len; char *str = (char *) dmalloc (this_len + 1); strcpy (str, specd_prefix); strcat (str, cstring_toCharsSafe (p->fname) + default_len); nlist->next = NULL; nlist->fname = cstring_fromChars (str); nlist->control_macro = 0; nlist->c_system_include_path = !p->cxx_aware; nlist->got_name_map = 0; if (opts->first_system_include == 0) { opts->first_system_include = nlist; } cppReader_addIncludeChain (pfile, nlist); } } } /* Search ordinary names for GNU include directories. */ for (p = include_defaults; p->fname != NULL; p++) { /* Some standard dirs are only for C++. */ if (!p->cplusplus || (opts->cplusplus && !opts->no_standard_cplusplus_includes)) { struct file_name_list *nlist = (struct file_name_list *) dmalloc (sizeof (*nlist)); nlist->control_macro = 0; nlist->c_system_include_path = !p->cxx_aware; nlist->fname = p->fname; nlist->got_name_map = 0; nlist->next = NULL; /* Spurious warning reported for opts->first_system_include */ /*@-usereleased@*/ if (opts->first_system_include == NULL) { opts->first_system_include = nlist; } /*@=usereleased@*/ cppReader_addIncludeChain (pfile, nlist); } } sfree (default_prefix); } /* Tack the after_include chain at the end of the include chain. */ cppReader_appendIncludeChain (pfile, opts->after_include, opts->last_after_include); /* Spurious warnings for opts->first_system_include */ /*@-usereleased@*/ if (opts->first_system_include == NULL) { opts->first_system_include = opts->after_include; } /*@=usereleased@*/ /* With -v, print the list of dirs to search. */ if (opts->verbose) { struct file_name_list *p; fprintf (stderr, "#include \"...\" search starts here:\n"); for (p = opts->include; p != NULL; p = p->next) { if (p == opts->first_bracket_include) fprintf (stderr, "#include <...> search starts here:\n"); fprintf (stderr, " %s\n", cstring_toCharsSafe (p->fname)); } fprintf (stderr, "End of search list.\n"); } } int cppReader_startProcess (cppReader *pfile, cstring fname) { cppBuffer *fp; int f; struct cppOptions *opts = CPPOPTIONS (pfile); fp = cppReader_pushBuffer (pfile, NULL, 0); if (fp == NULL) { return 0; } if (opts->in_fname == NULL) { opts->in_fname = cstring_makeLiteralTemp (""); } fp->fname = opts->in_fname; fp->nominal_fname = fp->fname; fp->lineno = 0; /* Copy the entire contents of the main input file into the stacked input buffer previously allocated for it. */ if (cstring_isEmpty (fname)) { fname = cstring_makeLiteralTemp (""); f = 0; } else if ((f = open (cstring_toCharsSafe (fname), O_RDONLY, 0666)) < 0) { cppReader_error (pfile, message ("Error opening %s for reading: %s", fname, lldecodeerror (errno))); return 0; } else { ; } if (finclude (pfile, f, fname, 0, NULL)) { output_line_command (pfile, 0, same_file); } return 1; } static /*@exposed@*/ /*@null@*/ cppBuffer *cppReader_getBuffer (cppReader *pfile) { return pfile->buffer; } /*@exposed@*/ cppBuffer *cppReader_getBufferSafe (cppReader *pfile) { llassert (pfile->buffer != NULL); return pfile->buffer; } /*@exposed@*/ char *cppLineBase (cppBuffer *buf) { llassert (buf->buf != NULL); return (buf->buf + buf->line_base); } int cpplib_bufPeek (cppBuffer *buf) { if (buf->cur == NULL || buf->rlimit == NULL) { return EOF; } if (buf->cur < buf->rlimit) { return *(buf->cur); } return EOF; } bool cppBuffer_isMacro (cppBuffer *buf) { if (buf != NULL) { return (buf->cleanup == cppReader_macroCleanup); } return FALSE; } /* ** Returns true if the macro should be checked, false ** if it should be expanded normally. */ static bool notparseable = FALSE; /* preceeded by @notparseable@ */ static bool notfunction = FALSE; /* preceeded by @notfunction@ */ static bool expectiter = FALSE; /* preceeded by @iter@ */ static bool expectenditer = FALSE; /* second after @iter@ */ static bool expectfunction = FALSE; /* preceeded by @function@ */ static bool expectconstant = FALSE; /* preceeded by @constant@ */ static bool expectmacro = FALSE; /* preceeded by notfunction or notparseable */ static void cpp_setLocation (cppReader *pfile) { fileId fid; int line; if (pfile->buffer != NULL) { if (cstring_isDefined (cppReader_getBufferSafe (pfile)->nominal_fname)) { cstring fname = cppReader_getBufferSafe (pfile)->nominal_fname; DPRINTF (("Looking up: %s", fname)); if (fileTable_exists (context_fileTable (), fname)) { fid = fileTable_lookup (context_fileTable (), fname); } else { DPRINTF (("Trying %s", cppReader_getBuffer (pfile)->fname)); fid = fileTable_lookup (context_fileTable (), cppReader_getBufferSafe (pfile)->fname); } } else { fid = fileTable_lookup (context_fileTable (), cppReader_getBufferSafe (pfile)->fname); } line = cppReader_getBufferSafe (pfile)->lineno; fileloc_free (g_currentloc); if (fileId_isValid (fid)) { g_currentloc = fileloc_create (fid, line, 1); } else { g_currentloc = fileloc_createBuiltin (); } } else { fileloc_free (g_currentloc); g_currentloc = fileloc_createBuiltin (); } } static bool cpp_shouldCheckMacro (cppReader *pfile, char *p) /*@modifies p*/ { bool checkmacro = FALSE; bool hasParams = FALSE; bool noexpand = FALSE; cstring sname; char c; cpp_setLocation (pfile); DPRINTF (("Should check macro? %s", p)); if (expectiter || expectconstant || expectenditer) { if (expectiter) { expectiter = FALSE; expectenditer = TRUE; } else { expectiter = FALSE; expectconstant = FALSE; expectenditer = FALSE; } if (notfunction || notparseable) { notfunction = FALSE; notparseable = FALSE; return FALSE; } else { return TRUE; } } llassert (*p == '#'); p++; while (*p == ' ' || *p == '\t') { p++; } llassert (*p == 'd'); /* define starts */ p += 6; while (*p == ' ' || *p == '\t') { p++; } sname = cstring_fromChars (p); DPRINTF (("Check macro: %s", sname)); while (((c = *p) != ' ') && c != '\0' && c != '(' && c != '\t' && c != '\\' && c != '\n' && !iscntrl (c)) { p++; } hasParams = (c == '('); *p = '\0'; if (notparseable) { notparseable = FALSE; } else if (notfunction || fileloc_isStandardLib (g_currentloc)) { DPRINTF (("Clear notfunction")); notfunction = FALSE; } else { if (noexpand) { checkmacro = TRUE; if (!expectenditer) { noexpand = FALSE; } } else { if (usymtab_existsReal (sname)) { uentry ue = usymtab_lookup (sname); DPRINTF (("Lookup macro: %s", uentry_unparse (ue))); if (fileloc_isPreproc (uentry_whereLast (ue))) { goto macroDne; } else { if (uentry_isSpecified (ue)) { checkmacro = context_getFlag (FLG_SPECMACROS); } else { if (hasParams) { checkmacro = context_getFlag (FLG_LIBMACROS) || context_getFlag (FLG_FCNMACROS); } } } } else { macroDne: DPRINTF (("Macro doesn't exist: %s", bool_unparse (checkmacro))); if (fileloc_isSystemFile (g_currentloc) && context_getFlag (FLG_SYSTEMDIREXPAND)) { ; /* don't check this macro */ DPRINTF (("Don't check 1")); } else { uentry le; if (hasParams) { DPRINTF (("Has params...")); if (context_getFlag (FLG_FCNMACROS)) { if (usymtab_exists (sname)) { /* ** only get here is macro is redefined ** error reported elsewhere */ DPRINTF (("It exists!")); } else { /* ** We make it a forward function, since it might be declared elsewhere. ** After all headers have been processed, we should check the forward ** functions. */ fileloc loc = fileloc_makePreproc (g_currentloc); /* the line is off-by-one, since the newline was already read */ decLine (); if (expectfunction) { expectfunction = FALSE; } le = uentry_makeForwardFunction (sname, typeId_invalid, loc); fileloc_free (loc); incLine (); /* Do not define here! */ (void) usymtab_addEntry (le); } checkmacro = TRUE; DPRINTF (("Check: TRUE")); } else { DPRINTF (("Flag FCN_MACROS not set!")); } } else { DPRINTF (("No params")); if (context_getFlag (FLG_CONSTMACROS)) { bool nocontent = FALSE; if (c == '\0') { nocontent = TRUE; } else { if (isspace (c)) { char *rest = p + 1; /* ** Check if there is nothing after the define. */ while ((*rest) != '\0' && isspace (*rest)) { rest++; } if (*rest == '\0') { nocontent = TRUE; /* empty macro, don't check */ } } } if (usymtab_exists (sname)) { ; } else { fileloc loc = fileloc_makePreproc (g_currentloc); DPRINTF (("Make constant: %s", sname)); le = uentry_makeMacroConstant (sname, ctype_unknown, loc); (void) usymtab_addEntry (le); } checkmacro = !nocontent; } } } if (checkmacro && usymtab_existsType (sname)) { DPRINTF (("Making false...")); decLine (); ppllerror (message ("Specified type implemented as macro: %s", sname)); checkmacro = FALSE; incLine (); } } } } if (!checkmacro) { if (usymtab_exists (sname)) { uentry ue = usymtab_lookupExpose (sname); fileloc tloc = fileloc_makePreproc (g_currentloc); uentry_setDefined (ue, tloc); fileloc_free (tloc); uentry_setUsed (ue, fileloc_undefined); } else { fileloc tloc = fileloc_makePreproc (g_currentloc); uentry ue = uentry_makeExpandedMacro (sname, tloc); DPRINTF (("Make expanded macro: %s", sname)); DPRINTF (("Not in symbol table: %s", sname)); (void) usymtab_addGlobalEntry (ue); fileloc_free (tloc); } } *p = c; DPRINTF (("Returning: %s", bool_unparse (checkmacro))); return checkmacro; } static enum cpp_token cpp_handleComment (cppReader *pfile, struct parse_marker *smark) { cppBuffer *pbuf = cppReader_getBufferSafe (pfile); char *start; int len; fileloc loc; bool eliminateComment = FALSE; llassert (pbuf->buf != NULL); start = pbuf->buf + smark->position; llassert (pbuf->cur != NULL); len = pbuf->cur - start; if (start[0] == '*' && start[1] == context_getCommentMarkerChar ()) { int i; char c = ' '; char *scomment = start + 2; char savec = start[len]; cpp_setLocation (pfile); loc = fileloc_copy (g_currentloc); start[0] = BEFORE_COMMENT_MARKER[0]; start[1] = BEFORE_COMMENT_MARKER[1]; llassert (start[len - 2] == '*'); start[len - 2] = AFTER_COMMENT_MARKER[0]; llassert (start[len - 1] == '/'); start[len - 1] = AFTER_COMMENT_MARKER[1]; cpplib_reserve(pfile, size_fromInt (1 + len)); cppReader_putCharQ (pfile, c); cpp_setLocation (pfile); start[len] = '\0'; if (mstring_containsString (scomment, "/*")) { (void) cppoptgenerror (FLG_NESTCOMMENT, message ("Comment starts inside syntactic comment: %s", cstring_fromChars (scomment)), pfile); } start[len] = savec; if (mstring_equalPrefix (scomment, "ignore")) { if (!context_getFlag (FLG_NOCOMMENTS)) { context_enterSuppressRegion (loc); } } else if (mstring_equalPrefix (scomment, "end")) { if (!context_getFlag (FLG_NOCOMMENTS)) { context_exitSuppressRegion (loc); } } else if (mstring_equalPrefix (scomment, "notparseable")) { notparseable = TRUE; expectmacro = TRUE; eliminateComment = TRUE; } else if (mstring_equalPrefix (scomment, "notfunction")) { notfunction = TRUE; expectmacro = TRUE; eliminateComment = TRUE; } else if (mstring_equalPrefix (scomment, "iter")) { expectiter = TRUE; } else if (mstring_equalPrefix (scomment, "function")) { expectfunction = TRUE; } else if (mstring_equalPrefix (scomment, "constant")) { expectconstant = TRUE; } else { char sChar = *scomment; if (sChar == '=' || sChar == '-' || sChar == '+') { char *rest = scomment + 1; if (mstring_equalPrefix (rest, "commentchar")) { eliminateComment = TRUE; if (sChar == '=') { ppllerror (cstring_makeLiteral ("Cannot restore commentchar")); } else { char *next = scomment + 12; /* strlen commentchar = 12 */ if (*next != ' ' && *next != '\t' && *next != '\n') { ppllerror (message ("Syntactic commentchar comment is not followed by a " "whitespace character: %c", *next)); } else { char cchar = *(next + 1); if (cchar == '\0') { ppllerror (cstring_makeLiteral ("Cannot set commentchar to NUL")); } else { context_setCommentMarkerChar (cchar); /* setComment = TRUE; */ } } } } else if (mstring_equalPrefix (scomment, "nestcomment")) { /* fix from Mike Miller */ context_fileSetFlag (FLG_NESTCOMMENT, ynm_fromCodeChar (sChar), loc); } else if (mstring_equalPrefix (rest, "namechecks")) { context_fileSetFlag (FLG_NAMECHECKS, ynm_fromCodeChar (sChar), loc); } else if (mstring_equalPrefix (rest, "macroredef")) { context_fileSetFlag (FLG_MACROREDEF, ynm_fromCodeChar (sChar), loc); } else if (mstring_equalPrefix (rest, "usevarargs")) { context_fileSetFlag (FLG_USEVARARGS, ynm_fromCodeChar (sChar), loc); } else if (mstring_equalPrefix (rest, "nextlinemacros")) { context_fileSetFlag (FLG_MACRONEXTLINE, ynm_fromCodeChar (sChar), loc); } else if (mstring_equalPrefix (rest, "allmacros") || mstring_equalPrefix (rest, "fcnmacros") || mstring_equalPrefix (rest, "constmacros")) { flagcode fl; if (mstring_equalPrefix (rest, "allmacros")) { fl = FLG_ALLMACROS; } else if (mstring_equalPrefix (rest, "fcnmacros")) { fl = FLG_FCNMACROS; } else { llassert (mstring_equalPrefix (rest, "constmacros")); fl = FLG_CONSTMACROS; } context_fileSetFlag (fl, ynm_fromCodeChar (sChar), loc); notfunction = FALSE; } else { ; } } else { ; } } if (eliminateComment) { goto removeComment; } /* Replaces comment char's in start with spaces */ for (i = 2; i < len - 2; i++) { if (start[i] == BEFORE_COMMENT_MARKER[0] || start[i] == BEFORE_COMMENT_MARKER[1] || start[i] == context_getCommentMarkerChar ()) { start[i] = ' '; } } cppReader_putStrN (pfile, start, size_fromInt (len)); parseClearMark (smark); return CPP_COMMENT; } else { removeComment: { int i; /* ** Output the comment as all spaces so line/column ** in output file is still correct. */ char c = ' '; cstring lintcomment = cstring_undefined; if (context_getFlag (FLG_LINTCOMMENTS)) { if (mstring_equalPrefix (start, "*NOTREACHED*/")) { lintcomment = cstring_makeLiteralTemp ("l_notreach"); } else if (mstring_equalPrefix (start, "*PRINTFLIKE*/")) { lintcomment = cstring_makeLiteralTemp ("l_printfli"); } else if (mstring_equalPrefix (start, "*FALLTHROUGH*/")) { lintcomment = cstring_makeLiteralTemp ("l_fallthrou"); } else if (mstring_equalPrefix (start, "*ARGSUSED*/")) { lintcomment = cstring_makeLiteralTemp ("l_argsus"); } else if (mstring_equalPrefix (start, "*FALLTHRU*/")) { lintcomment = cstring_makeLiteralTemp ("l_fallth"); } else { lintcomment = cstring_undefined; } } else { lintcomment = cstring_undefined; } if (cstring_isDefined (lintcomment)) { c = BEFORE_COMMENT_MARKER[0]; start[0] = BEFORE_COMMENT_MARKER[1]; llassert (size_toLong (cstring_length (lintcomment)) == len - 3); for (i = 1; i < len - 2; i++) { start[i] = cstring_getChar (lintcomment, size_fromInt (i)); } start[len - 2] = AFTER_COMMENT_MARKER[0]; start[len - 1] = AFTER_COMMENT_MARKER[1]; } else { /* Replaces char's in start with spaces */ for (i = 0; i < len; i++) { if (start[i] == '/' && i < len - 1 && start[i + 1] == '*') { (void) cppoptgenerror (FLG_NESTCOMMENT, message ("Comment starts inside comment"), pfile); } if (start[i] != '\n') { start[i] = ' '; } } } cpplib_reserve (pfile, size_fromInt (1 + len)); cppReader_putCharQ (pfile, c); cppReader_putStrN (pfile, start, size_fromInt (len)); parseClearMark (smark); return CPP_COMMENT; } } } static int cpp_openIncludeFile (char *filename) { int res = open (filename, O_RDONLY, 0666); /* evans 2001-08-23: was (res) - open returns -1 on error! reported by Robin Watts */ if (res >= 0) { if (!fileTable_exists (context_fileTable (), cstring_fromChars (filename))) { if (fileloc_isXHFile (g_currentloc)) { /* ** Files includes by XH files are also XH files */ (void) fileTable_addXHFile (context_fileTable (), cstring_fromChars (filename)); } else { (void) fileTable_addHeaderFile (context_fileTable (), cstring_fromChars (filename)); } } else { DPRINTF (("File already exists: %s", filename)); } } return res; } static bool cpp_skipIncludeFile (cstring fname) { if (context_isSystemDir (fname)) { DPRINTF (("System dir: %s", fname)); if (lcllib_isSkipHeader (fname)) { DPRINTF (("Skip include TRUE: %s", fname)); return TRUE; } if (context_getFlag (FLG_SKIPSYSHEADERS)) { /* ** 2003-04-18: Patch from Randal Parsons */ /* ** Don't skip include file unless the file actually exists. ** It may be in a different directory. */ int f = open (cstring_toCharsSafe (fname), O_RDONLY, 0666); if (f >= 0) { check (close (f) == 0); DPRINTF (("Skip include TRUE: %s", fname)); return TRUE; } else { /* Keep looking... */ } } } if (context_getFlag (FLG_SINGLEINCLUDE)) { fname = removePreDirs (fname); # if defined (WIN32) || defined (OS2) cstring_replaceAll (fname, '\\', '/'); # endif if (fileTable_exists (context_fileTable (), fname)) { DPRINTF (("Skip include TRUE: %s", fname)); return TRUE; } } DPRINTF (("Skip include FALSE: %s", fname)); return FALSE; } static int cpp_peekN (cppReader *pfile, int n) { cppBuffer *buf = cppReader_getBufferSafe (pfile); llassert (buf->cur != NULL); return (buf->rlimit - buf->cur >= (n) ? buf->cur[n] : EOF); } cppBuffer *cppBuffer_prevBuffer (cppBuffer *buf) { return buf + 1; } void cppBuffer_forward (cppBuffer *buf, int n) { llassert (buf->cur != NULL); buf->cur += n; } /*@=bufferoverflowhigh@*/ /*@=bounds@*/ splint-3.1.2.dfsg1/src/cppexp.c0000644021234200000250000010036110052457402013675 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cppexp.c */ /* Parse C expressions for CCCP. Copyright (C) 1987, 1992, 1994, 1995, 1997 Free Software Foundation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! Written by Per Bothner 1994. */ /* Parse a C expression from text in a string */ /*@+charint@*/ /*@+ignorequals@*/ /*@+ignoresigns@*/ /*@+matchanyintegral@*/ # include # include "splintMacros.nf" # include "basic.h" # include "cpplib.h" # include "cpphash.h" # include "cppexp.h" # include "cpperror.h" /* Yield nonzero if adding two numbers with A's and B's signs can yield a number with SUM's sign, where A, B, and SUM are all C integers. */ /*@function static bool possibleSumSign (sef int, int, int) modifies nothing ; @*/ #define possibleSumSign(a, b, sum) ((((a) ^ (b)) | ~ ((a) ^ (sum))) < 0) /* these are guesses! */ /*@constant int BITS_PER_UNIT = 8@*/ # define BITS_PER_UNIT 8 /*@constant size_t BITS_PER_CHAR@*/ # define BITS_PER_CHAR 8 /*@constant size_t BITS_PER_WORD@*/ # define BITS_PER_WORD 32 /*@constant size_t HOST_BITS_PER_INT@*/ # define HOST_BITS_PER_INT 32 /*@constant size_t HOST_BITS_PER_LONG = 32@*/ # define HOST_BITS_PER_LONG 32 /*@constant char TARGET_BELL@*/ # define TARGET_BELL (char) 6 /*@constant char TARGET_BS@*/ # define TARGET_BS (char) 7 /*@constant char TARGET_FF@*/ # define TARGET_FF (char) 8 /*@constant char TARGET_NEWLINE@*/ # define TARGET_NEWLINE '\n' /*@constant char TARGET_CR@*/ # define TARGET_CR '\n' /*@constant char TARGET_TAB@*/ # define TARGET_TAB '\t' /*@constant char TARGET_VT@*/ # define TARGET_VT '\v' #ifdef MULTIBYTE_CHARS #include #include #endif #include #ifndef INT_TYPE_SIZE /*@constant size_t INT_TYPE_SIZE@*/ #define INT_TYPE_SIZE BITS_PER_WORD #endif #ifndef LONG_TYPE_SIZE /*@constant size_t LONG_TYPE_SIZE@*/ #define LONG_TYPE_SIZE BITS_PER_WORD #endif #ifndef WCHAR_TYPE_SIZE /*@constant size_t WCHAR_TYPE_SIZE@*/ #define WCHAR_TYPE_SIZE INT_TYPE_SIZE #endif # ifndef CHAR_TYPE_SIZE /*@constant size_t CHAR_TYPE_SIZE@*/ # define CHAR_TYPE_SIZE BITS_PER_CHAR # endif #ifndef MAX_CHAR_TYPE_SIZE /*@constant size_t MAX_CHAR_TYPE_SIZE@*/ #define MAX_CHAR_TYPE_SIZE CHAR_TYPE_SIZE #endif #ifndef MAX_LONG_TYPE_SIZE /*@constant size_t MAX_LONG_TYPE_SIZE@*/ #define MAX_LONG_TYPE_SIZE LONG_TYPE_SIZE #endif #ifndef MAX_WCHAR_TYPE_SIZE /*@constant size_t MAX_WCHAR_TYPE_SIZE@*/ #define MAX_WCHAR_TYPE_SIZE WCHAR_TYPE_SIZE #endif static struct operation cppexp_lex (cppReader *); static void integer_overflow (cppReader *); static long left_shift (cppReader *, long, bool p_unsignedp, unsigned long); static long right_shift (long, bool p_unsignedp, unsigned long); /*@constant short CPPREADER_ERRORTOK@*/ #define CPPREADER_ERRORTOK 299 /*@constant int OROR@*/ #define OROR 300 /*@constant int ANDAND@*/ #define ANDAND 301 /*@constant int CPP_EQUALTOK@*/ #define CPP_EQUALTOK 302 /*@constant int NOTEQUAL@*/ #define NOTEQUAL 303 /*@constant int LEQ@*/ #define LEQ 304 /*@constant int GEQ@*/ #define GEQ 305 /*@constant int LSH@*/ #define LSH 306 /*@constant int RSH@*/ #define RSH 307 /*@constant int NAME@*/ #define NAME 308 /*@constant short CPPEXP_INT@*/ #define CPPEXP_INT 309 /*@constant short CPPEXP_CHAR@*/ #define CPPEXP_CHAR 310 /*@constant int LEFT_OPERAND_REQUIRED@*/ #define LEFT_OPERAND_REQUIRED 1 /*@constant int RIGHT_OPERAND_REQUIRED@*/ #define RIGHT_OPERAND_REQUIRED 2 /*@constant int HAVE_VALUE@*/ #define HAVE_VALUE 4 #ifndef HOST_BITS_PER_WIDE_INT #if HOST_BITS_PER_LONG > HOST_BITS_PER_INT /*@constant int HOST_BITS_PER_WIDE_INT@*/ #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_LONG /*@notfunction@*/ #define HOST_WIDE_INT long #else /*@constant int HOST_BITS_PER_WIDE_INT@*/ #define HOST_BITS_PER_WIDE_INT HOST_BITS_PER_INT /*@notfunction@*/ #define HOST_WIDE_INT long #endif #endif struct operation { short op; /* Priority of op (relative to it right operand). */ /*@reldef@*/ char rprio; /*@reldef@*/ char flags; /* true if value should be treated as unsigned */ /*@reldef@*/ bool unsignedp; /* The value logically "right" of op. */ /*@reldef@*/ HOST_WIDE_INT value; } ; /* Take care of parsing a number (anything that starts with a digit). LEN is the number of characters in it. */ /* maybe needs to actually deal with floating point numbers */ struct operation cppReader_parseNumber (cppReader *pfile, char *start, int olen) /*@requires maxRead(start) >= (olen - 1) @*/ { struct operation op; char *p = start; char c; int i; long n = 0; unsigned long nd, ULONG_MAX_over_base; int base = 10; int len = olen; bool overflow = FALSE; int digit, largest_digit = 0; bool spec_long = FALSE; op.unsignedp = FALSE; for (i = 0; i < len; i++) { if (p[i] == '.') { /* It's a float since it contains a point. */ cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Floating point numbers not allowed in #if expressions")); op.op = CPPREADER_ERRORTOK; return op; } } if (len >= 3 && (mstring_equalPrefix (p, "0x") || mstring_equalPrefix (p, "0X"))) { p += 2; base = 16; len -= 2; } else if (*p == '0') { base = 8; } else { ; } /* Some buggy compilers (e.g. MPW C) seem to need both casts. */ ULONG_MAX_over_base = ((unsigned long) -1) / ((unsigned long) base); for (; len > 0; len--) { c = *p++; if (c >= '0' && c <= '9') { digit = (int) (c - '0'); } else if (base == 16 && c >= 'a' && c <= 'f') { digit = (int) (c - 'a') + 10; } else if (base == 16 && c >= 'A' && c <= 'F') { digit = (int) (c - 'A') + 10; } else { /* `l' means long, and `u' means unsigned. */ while (TRUE) { if (c == 'l' || c == 'L') { if (spec_long) cppReader_errorLit (pfile, cstring_makeLiteralTemp ("two `l's in integer constant")); spec_long = TRUE; } else if (c == 'u' || c == 'U') { if (op.unsignedp) cppReader_errorLit (pfile, cstring_makeLiteralTemp ("two `u's in integer constant")); op.unsignedp = TRUE; } else { /*@innerbreak@*/ break; } if (--len == 0) { /*@innerbreak@*/ break; } c = *p++; } /* Don't look for any more digits after the suffixes. */ break; } if (largest_digit < digit) { largest_digit = digit; } nd = (long unsigned) (n * base + digit); overflow |= (ULONG_MAX_over_base < (unsigned long) n) | (nd < (unsigned long) n); n = (long) nd; } if (len != 0) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Invalid number in #if expression")); op.op = CPPREADER_ERRORTOK; return op; } if (base <= largest_digit) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("Integer constant contains digits beyond the radix")); } if (overflow) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("Integer constant out of range")); } /* If too big to be signed, consider it unsigned. */ if ((long) n < 0 && ! op.unsignedp) { if (base == 10) { cppReader_warningLit (pfile, cstring_makeLiteralTemp ("Integer constant is so large that it is unsigned")); } op.unsignedp = TRUE; } op.value = n; op.op = CPPEXP_INT; DPRINTF (("Parse number: %d", op.value)); return op; } struct token { /*@null@*/ /*@observer@*/ char *operator; int token; }; static struct token tokentab2[] = { { "&&", ANDAND }, { "||", OROR }, { "<<", LSH }, { ">>", RSH }, { "==", CPP_EQUALTOK }, { "!=", NOTEQUAL }, { "<=", LEQ }, { ">=", GEQ }, { "++", CPPREADER_ERRORTOK }, { "--", CPPREADER_ERRORTOK }, { NULL, CPPREADER_ERRORTOK } } ; /* Read one token. */ struct operation cppexp_lex (cppReader *pfile) { int ic; char c; register struct token *toktab; enum cpp_token token; struct operation op; char *tok_start, *tok_end; int old_written; retry: old_written = size_toInt (cpplib_getWritten (pfile)); cppSkipHspace (pfile); ic = cpplib_bufPeek (cppReader_getBufferSafe (pfile)); c = (char) ic; if (c == '#') { /* was: llassert (c != '#'); - Solaris uses this, attempt to continue anyway... */ cppReader_pedwarn (pfile, message ("non-standard pre-processor directive: %c", c)); } DPRINTF (("Read: %c", c)); if (c == '\n') { op.op = 0; return op; } token = cpplib_getTokenForceExpand (pfile); tok_start = pfile->token_buffer + old_written; tok_end = cpplib_getPWritten (pfile); DPRINTF (("Token: %s < %s", tok_start, tok_end)); pfile->limit = tok_start; switch (token) { case CPP_EOF: /* Should not happen ... */ case CPP_VSPACE: op.op = 0; return op; case CPP_POP: if (cstring_isDefined (cppReader_getBufferSafe (pfile)->fname)) { op.op = 0; return op; } (void) cppReader_popBuffer (pfile); goto retry; case CPP_HSPACE: case CPP_COMMENT: goto retry; case CPP_NUMBER: return cppReader_parseNumber (pfile, tok_start, tok_end - tok_start); case CPP_STRING: cppReader_errorLit (pfile, cstring_makeLiteralTemp ("string constants not allowed in #if expressions")); op.op = CPPREADER_ERRORTOK; return op; case CPP_CHAR: /* This code for reading a character constant handles multicharacter constants and wide characters. It is mostly copied from c-lex.c. */ { int result = 0; int num_chars = 0; size_t width = MAX_CHAR_TYPE_SIZE; int wide_flag = 0; int max_chars; char *ptr = tok_start; #ifdef MULTIBYTE_CHARS char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + MB_CUR_MAX]; #else char token_buffer[MAX_LONG_TYPE_SIZE/MAX_CHAR_TYPE_SIZE + 1]; #endif if (*ptr == 'L') { ptr++; wide_flag = 1; width = MAX_WCHAR_TYPE_SIZE; #ifdef MULTIBYTE_CHARS max_chars = MB_CUR_MAX; #else max_chars = 1; #endif } else { max_chars = size_toInt (MAX_LONG_TYPE_SIZE / width); } ++ptr; while (ptr < tok_end && ((c = *ptr++) != '\'')) { if (c == '\\') { c = cppReader_parseEscape (pfile, &ptr); if (width < HOST_BITS_PER_INT && c >= (1 << width)) { cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("Escape sequence out of range for character")); } } num_chars++; /* Merge character into result; ignore excess chars. */ if (num_chars < max_chars + 1) { if (width < HOST_BITS_PER_INT) { result = (int) ((unsigned) result << width) | (c & ((1 << width) - 1)); } else { result = c; } token_buffer[num_chars - 1] = c; } } token_buffer[num_chars] = 0; if (c != '\'') cppReader_errorLit (pfile, cstring_makeLiteralTemp ("malformatted character constant")); else if (num_chars == 0) cppReader_errorLit (pfile, cstring_makeLiteralTemp ("empty character constant")); else if (num_chars > max_chars) { num_chars = max_chars; cppReader_errorLit (pfile, cstring_makeLiteralTemp ("character constant too long")); } else if (num_chars != 1 && ! cppReader_isTraditional (pfile)) { cppReader_warningLit (pfile, cstring_makeLiteralTemp ("multi-character character constant")); } else { ; } /* If char type is signed, sign-extend the constant. */ if (wide_flag == 0) { int num_bits = num_chars * width; if ((cpphash_lookup ("__CHAR_UNSIGNED__", sizeof ("__CHAR_UNSIGNED__") - 1, -1) != NULL) || (((unsigned) result >> (int_toNonNegative (num_bits - 1))) & 1) == 0) { op.value = result & ((unsigned long) ~0 >> int_toNonNegative ((HOST_BITS_PER_LONG - num_bits))); } else { op.value = result | ~((unsigned long) ~0 >> int_toNonNegative ((HOST_BITS_PER_LONG - num_bits))); } } else { #ifdef MULTIBYTE_CHARS /* Set the initial shift state and convert the next sequence. */ result = 0; /* In all locales L'\0' is zero and mbtowc will return zero, so don't use it. */ if (num_chars > 1 || (num_chars == 1 && token_buffer[0] != '\0')) { wchar_t wc; (void) mbtowc (NULL, NULL, 0); if (mbtowc (& wc, token_buffer, num_chars) == num_chars) result = wc; else cppReader_pedwarn (pfile,"Ignoring invalid multibyte character"); } #endif op.value = result; } } /* This is always a signed type. */ op.unsignedp = FALSE; op.op = CPPEXP_CHAR; return op; case CPP_NAME: DPRINTF (("Name!")); return cppReader_parseNumber (pfile, "0", 0); case CPP_OTHER: /* See if it is a special token of length 2. */ if (tok_start + 2 == tok_end) { for (toktab = tokentab2; toktab->operator != NULL; toktab++) { if (tok_start[0] == toktab->operator[0] && tok_start[1] == toktab->operator[1]) { /*@loopbreak@*/ break; } } if (toktab->token == CPPREADER_ERRORTOK) { cppReader_error (pfile, message ("`%s' not allowed in operand of `#if'", cstring_fromChars (tok_start))); } op.op = toktab->token; return op; } /*@fallthrough@*/ default: op.op = *tok_start; return op; } BADEXIT; /*@notreached@*/ } /* Parse a C escape sequence. STRING_PTR points to a variable containing a pointer to the string to parse. That pointer is updated past the characters we use. The value of the escape sequence is returned. A negative value means the sequence \ newline was seen, which is supposed to be equivalent to nothing at all. If \ is followed by a null character, we return a negative value and leave the string pointer pointing at the null character. If \ is followed by 000, we return 0 and leave the string pointer after the zeros. A value of 0 does not mean end of string. */ int cppReader_parseEscape (cppReader *pfile, char **string_ptr) { char c = *(*string_ptr)++; switch (c) { case 'a': return TARGET_BELL; case 'b': return TARGET_BS; case 'e': case 'E': if (cppReader_isPedantic (pfile)) { cppReader_pedwarn (pfile, message ("non-standard escape sequence, `\\%c'", c)); } return (char) 033; case 'f': return TARGET_FF; case 'n': return TARGET_NEWLINE; case 'r': return TARGET_CR; case 't': return TARGET_TAB; case 'v': return TARGET_VT; case '\n': return -2; case 0: (*string_ptr)--; return 0; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { int i = (int) c - '0'; int count = 0; while (++count < 3) { c = *(*string_ptr)++; if (c >= '0' && c <= '7') { i = ((unsigned) i << 3) + c - '0'; } else { (*string_ptr)--; /*@loopbreak@*/ break; } } if ((i & ~((1 << MAX_CHAR_TYPE_SIZE) - 1)) != 0) { i &= (1 << MAX_CHAR_TYPE_SIZE) - 1; cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("octal character constant does not fit in a byte")); } return i; } case 'x': { register unsigned i = 0, overflow = 0, digits_found = 0, digit; for (;;) { c = *(*string_ptr)++; if (c >= '0' && c <= '9') { digit = (unsigned int) (c - '0'); } else if (c >= 'a' && c <= 'f') { digit = (unsigned int) (c - 'a') + 10; } else if (c >= 'A' && c <= 'F') { digit = (unsigned int) (c - 'A') + 10; } else { (*string_ptr)--; /*@loopbreak@*/ break; } overflow |= i ^ (i << 4 >> 4); i = (i << 4) + digit; digits_found = 1; } if (digits_found == 0) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("\\x used with no following hex digits")); } if ((overflow | (i & ~((1 << int_toNonNegative (BITS_PER_UNIT)) - 1))) != 0) { i &= (1 << BITS_PER_UNIT) - 1; cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("hex character constant does not fit in a byte")); } return i; } default: return c; } } static void integer_overflow (cppReader *pfile) { if (cppReader_isPedantic (pfile)) cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("integer overflow in preprocessor expression")); } static long left_shift (cppReader *pfile, long a, bool unsignedp, unsigned long b) { if (b >= HOST_BITS_PER_LONG) { if (!unsignedp && a != 0) { integer_overflow (pfile); } return 0; } else if (unsignedp) { return (unsigned long) a << b; } else { /*@-shiftimplementation@*/ long l = a << b; /* int_toNonNegative removed (allow shifts of negative values) */ # ifdef WIN32 # pragma warning( disable : 4018 ) # endif if (l >> b != a) /* int_toNonNegative removed (allow shifts of negative values) */ { integer_overflow (pfile); } return l; } } static long right_shift (long a, bool unsignedp, unsigned long b) { if (b >= HOST_BITS_PER_LONG) return (unsignedp ? 0 : int_toNonNegative (a) >> (HOST_BITS_PER_LONG - 1)); else if (unsignedp) return (unsigned long) a >> b; else return a >> b; /* int_toNonNegative removed (allow shifts of negative values) */ /*@=shiftimplementation@*/ } /* These priorities are all even, so we can handle associatively. */ /*@constant int PAREN_INNER_PRIO@*/ #define PAREN_INNER_PRIO 0 /*@constant int COMMA_PRIO@*/ #define COMMA_PRIO 4 /*@constant int COND_PRIO@*/ #define COND_PRIO (COMMA_PRIO+2) /*@constant int OROR_PRIO@*/ #define OROR_PRIO (COND_PRIO+2) /*@constant int ANDAND_PRIO@*/ #define ANDAND_PRIO (OROR_PRIO+2) /*@constant int OR_PRIO@*/ #define OR_PRIO (ANDAND_PRIO+2) /*@constant int XOR_PRIO@*/ #define XOR_PRIO (OR_PRIO+2) /*@constant int AND_PRIO@*/ #define AND_PRIO (XOR_PRIO+2) /*@constant int CPP_EQUAL_PRIO@*/ #define CPP_EQUAL_PRIO (AND_PRIO+2) /*@constant int LESS_PRIO@*/ #define LESS_PRIO (CPP_EQUAL_PRIO+2) /*@constant int SHIFT_PRIO@*/ #define SHIFT_PRIO (LESS_PRIO+2) /*@constant int PLUS_PRIO@*/ #define PLUS_PRIO (SHIFT_PRIO+2) /*@constant int MUL_PRIO@*/ #define MUL_PRIO (PLUS_PRIO+2) /*@constant int UNARY_PRIO@*/ #define UNARY_PRIO (MUL_PRIO+2) /*@constant int PAREN_OUTER_PRIO@*/ #define PAREN_OUTER_PRIO (UNARY_PRIO+2) /*@notfunction@*/ #define COMPARE(OP) \ top->unsignedp = FALSE;\ top->value = ((unsigned1 || unsigned2) \ ? (unsigned long) v1 OP (unsigned long) v2 \ : ((long) v1 OP (long) v2)) ? 1 : 0 /* Parse and evaluate a C expression, reading from PFILE. Returns the value of the expression. */ /*@constant int INIT_STACK_SIZE@*/ # define INIT_STACK_SIZE 20 HOST_WIDE_INT cppReader_parseExpression (cppReader *pfile) { /* The implementation is an operator precedence parser, i.e. a bottom-up parser, using a stack for not-yet-reduced tokens. The stack base is 'stack', and the current stack pointer is 'top'. There is a stack element for each operator (only), and the most recently pushed operator is 'top->op'. An operand (value) is stored in the 'value' field of the stack element of the operator that precedes it. In that case the 'flags' field has the HAVE_VALUE flag set. */ struct operation init_stack[INIT_STACK_SIZE]; struct operation *stack = init_stack; struct operation *limit = stack + INIT_STACK_SIZE; register struct operation *top = stack; int lprio, rprio = 0; int skip_evaluation = 0; top->rprio = 0; top->flags = 0; for (;;) { struct operation op; int flags = 0; /* Read a token */ op = cppexp_lex (pfile); /* See if the token is an operand, in which case go to set_value. If the token is an operator, figure out its left and right priorities, and then goto maybe_reduce. */ switch (op.op) { case NAME: top->value = 0, top->unsignedp = FALSE; goto set_value; case CPPEXP_INT: case CPPEXP_CHAR: top->value = op.value; top->unsignedp = op.unsignedp; goto set_value; case 0: lprio = 0; goto maybe_reduce; case '+': case '-': /* Is this correct if unary ? FIXME */ flags = RIGHT_OPERAND_REQUIRED; lprio = PLUS_PRIO; rprio = lprio + 1; goto maybe_reduce; case '!': case '~': flags = RIGHT_OPERAND_REQUIRED; rprio = UNARY_PRIO; lprio = rprio + 1; goto maybe_reduce; case '*': case '/': case '%': lprio = MUL_PRIO; goto binop; case '<': case '>': case LEQ: case GEQ: lprio = LESS_PRIO; goto binop; case CPP_EQUALTOK: case NOTEQUAL: lprio = CPP_EQUAL_PRIO; goto binop; case LSH: case RSH: lprio = SHIFT_PRIO; goto binop; case '&': lprio = AND_PRIO; goto binop; case '^': lprio = XOR_PRIO; goto binop; case '|': lprio = OR_PRIO; goto binop; case ANDAND: lprio = ANDAND_PRIO; goto binop; case OROR: lprio = OROR_PRIO; goto binop; case ',': lprio = COMMA_PRIO; goto binop; case '(': lprio = PAREN_OUTER_PRIO; rprio = PAREN_INNER_PRIO; goto maybe_reduce; case ')': lprio = PAREN_INNER_PRIO; rprio = PAREN_OUTER_PRIO; goto maybe_reduce; case ':': lprio = COND_PRIO; rprio = COND_PRIO; goto maybe_reduce; case '?': lprio = COND_PRIO + 1; rprio = COND_PRIO; goto maybe_reduce; binop: flags = LEFT_OPERAND_REQUIRED | RIGHT_OPERAND_REQUIRED; rprio = lprio + 1; goto maybe_reduce; default: cppReader_error (pfile, message ("Invalid character in #if: %c", (char) op.op)); goto syntax_error; } set_value: /* Push a value onto the stack. */ if ((top->flags & HAVE_VALUE) != 0) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("syntax error in #if")); goto syntax_error; } top->flags |= HAVE_VALUE; continue; maybe_reduce: /* Push an operator, and check if we can reduce now. */ while (top->rprio > lprio) { /*@-usedef@*/ HOST_WIDE_INT v1 = top[-1].value; HOST_WIDE_INT v2 = top[0].value; bool unsigned1 = top[-1].unsignedp; bool unsigned2 = top[0].unsignedp; top--; if (((top[1].flags & LEFT_OPERAND_REQUIRED) != 0) && ((top[0].flags & HAVE_VALUE) == 0)) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("syntax error - missing left operand")); goto syntax_error; } if (((top[1].flags & RIGHT_OPERAND_REQUIRED) != 0) && ((top[1].flags & HAVE_VALUE) == 0)) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("syntax error - missing right operand")); goto syntax_error; } /* top[0].value = (top[1].op)(v1, v2);*/ switch (top[1].op) { case '+': if ((top->flags & HAVE_VALUE) == 0) { /* Unary '+' */ top->value = v2; top->unsignedp = unsigned2; top->flags |= HAVE_VALUE; } else { top->value = v1 + v2; top->unsignedp = unsigned1 || unsigned2; if (!top->unsignedp && (skip_evaluation == 0) && ! possibleSumSign (v1, v2, top->value)) integer_overflow (pfile); } /*@switchbreak@*/ break; case '-': if ((top->flags & HAVE_VALUE) == 0) { /* Unary '-' */ top->value = - v2; if ((skip_evaluation == 0) && (top->value & v2) < 0 && !unsigned2) integer_overflow (pfile); top->unsignedp = unsigned2; top->flags |= HAVE_VALUE; } else { /* Binary '-' */ top->value = v1 - v2; top->unsignedp = unsigned1 || unsigned2; if (!top->unsignedp && (skip_evaluation == 0) && !possibleSumSign (top->value, v2, v1)) { integer_overflow (pfile); } } /*@switchbreak@*/ break; case '*': top->unsignedp = unsigned1 || unsigned2; if (top->unsignedp) { top->value = (unsigned long) v1 * v2; } else if (skip_evaluation == 0) { top->value = v1 * v2; if ((v1 != 0) && (top->value / v1 != v2 || (top->value & v1 & v2) < 0)) { integer_overflow (pfile); } } else { ; } /*@switchbreak@*/ break; case '/': if (skip_evaluation != 0) /*@switchbreak@*/ break; if (v2 == 0) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Division by zero in #if")); v2 = 1; } top->unsignedp = unsigned1 || unsigned2; if (top->unsignedp) top->value = (unsigned long) v1 / v2; else { top->value = v1 / v2; if ((top->value & v1 & v2) < 0) integer_overflow (pfile); } /*@switchbreak@*/ break; case '%': if (skip_evaluation != 0) /*@switchbreak@*/ break; if (v2 == 0) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Division by zero in #if")); v2 = 1; } top->unsignedp = unsigned1 || unsigned2; if (top->unsignedp) top->value = (unsigned long) v1 % v2; else top->value = v1 % v2; /*@switchbreak@*/ break; case '!': if ((top->flags & HAVE_VALUE) != 0) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("Syntax error")); goto syntax_error; } top->value = (v2 == 0) ? 1 : 0; top->unsignedp = FALSE; top->flags |= HAVE_VALUE; /*@switchbreak@*/ break; case '~': if ((top->flags & HAVE_VALUE) != 0) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("syntax error")); goto syntax_error; } top->value = ~ v2; top->unsignedp = unsigned2; top->flags |= HAVE_VALUE; /*@switchbreak@*/ break; case '<': COMPARE(<); /*@switchbreak@*/ break; case '>': COMPARE(>); /*@switchbreak@*/ break; case LEQ: COMPARE(<=); /*@switchbreak@*/ break; case GEQ: COMPARE(>=); /*@switchbreak@*/ break; case CPP_EQUALTOK: top->value = (v1 == v2) ? 1 : 0; top->unsignedp = FALSE; /*@switchbreak@*/ break; case NOTEQUAL: top->value = (v1 != v2) ? 1 : 0; top->unsignedp = FALSE; /*@switchbreak@*/ break; case LSH: if (skip_evaluation != 0) { /*@switchbreak@*/ break; } top->unsignedp = unsigned1; if (v2 < 0 && ! unsigned2) top->value = right_shift (v1, unsigned1, -v2); else top->value = left_shift (pfile, v1, unsigned1, v2); /*@switchbreak@*/ break; case RSH: if (skip_evaluation != 0) { /*@switchbreak@*/ break; } top->unsignedp = unsigned1; if (v2 < 0 && ! unsigned2) top->value = left_shift (pfile, v1, unsigned1, -v2); else top->value = right_shift (v1, unsigned1, v2); /*@switchbreak@*/ break; /*@notfunction@*/ #define LOGICAL(OP) \ top->value = v1 OP v2;\ top->unsignedp = unsigned1 || unsigned2; case '&': LOGICAL(&); /*@switchbreak@*/ break; case '^': LOGICAL(^); /*@switchbreak@*/ break; case '|': LOGICAL(|); /*@switchbreak@*/ break; case ANDAND: top->value = ((v1 != 0) && (v2 != 0)) ? 1 : 0; top->unsignedp = FALSE; if (v1 == 0) { skip_evaluation--; } /*@switchbreak@*/ break; case OROR: top->value = ((v1 != 0) || (v2 != 0)) ? 1 : 0; top->unsignedp = FALSE; if (v1 != 0) { skip_evaluation--; } /*@switchbreak@*/ break; case ',': if (cppReader_isPedantic (pfile)) cppReader_pedwarnLit (pfile, cstring_makeLiteralTemp ("comma operator in operand of `#if'")); top->value = v2; top->unsignedp = unsigned2; /*@switchbreak@*/ break; case '(': case '?': cppReader_errorLit (pfile, cstring_makeLiteralTemp ("syntax error in #if")); goto syntax_error; case ':': if (top[0].op != '?') { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("syntax error ':' without preceding '?'")); goto syntax_error; } else if (((top[1].flags & HAVE_VALUE) == 0) || ((top[-1].flags & HAVE_VALUE) == 0) || ((top[0].flags & HAVE_VALUE) == 0)) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("bad syntax for ?: operator")); goto syntax_error; } else { top--; if (top->value != 0) { skip_evaluation--; } top->value = (top->value != 0) ? v1 : v2; top->unsignedp = unsigned1 || unsigned2; } /*@switchbreak@*/ break; case ')': if (((top[1].flags & HAVE_VALUE) != 0) || ((top[0].flags & HAVE_VALUE) == 0) || top[0].op != '(' || ((top[-1].flags & HAVE_VALUE) != 0)) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("mismatched parentheses in #if")); goto syntax_error; } else { top--; top->value = v1; top->unsignedp = unsigned1; top->flags |= HAVE_VALUE; } /*@switchbreak@*/ break; default: /*@-formatconst@*/ fprintf (stderr, top[1].op >= ' ' && top[1].op <= '~' ? "unimplemented operator '%c'\n" : "unimplemented operator '\\%03o'\n", top[1].op); /*@=formatconst@*/ } } if (op.op == 0) { long val; if (top != stack) { cppReader_errorLit (pfile, cstring_makeLiteralTemp ("internal error in #if expression")); } val = top->value; if (stack != init_stack) { sfree (stack); /*@-branchstate@*/ } /*@=branchstate@*/ return val; } top++; /* Check for and handle stack overflow. */ if (top == limit) { struct operation *new_stack; size_t old_size = size_fromInt ((char *) limit - (char *) stack); size_t new_size = (size_t) (2 * old_size); if (stack != init_stack) { new_stack = (struct operation *) drealloc ((char *) stack, new_size); } else { new_stack = (struct operation *) dmalloc (new_size); /* Bug: the parameters were in the wrong order! */ memcpy ((char *) new_stack, (char *) stack, old_size); /*@-branchstate@*/ } /*@=branchstate@*/ stack = new_stack; top = (struct operation *) ((char *) new_stack + old_size); limit = (struct operation *) ((char *) new_stack + new_size); /*@-branchstate@*/ } /*@=branchstate@*/ top->flags = flags; top->rprio = rprio; top->op = op.op; if ((op.op == OROR && (top[-1].value != 0)) || (op.op == ANDAND && (top[-1].value == 0)) || (op.op == '?' && (top[-1].value == 0))) { skip_evaluation++; } else if (op.op == ':') { if (top[-2].value != 0) /* Was condition true? */ { skip_evaluation++; } else { skip_evaluation--; } } else { ; } } syntax_error: /*@-usereleased@*/ if (stack != init_stack) { sfree (stack); /*@-branchstate@*/ } /*@=branchstate@*/ /*@=usereleased@*/ cppReader_skipRestOfLine (pfile); return 0; } splint-3.1.2.dfsg1/src/cpphash.c0000644021234200000250000002736107646432514014050 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cpphash.c ** ** Pre-processor hash table. Derived from gnu cpp. */ /* Part of CPP library. (Macro hash table support.) Copyright (C) 1986, 87, 89, 92-95, 1996 Free Software Foundation, Inc. Written by Per Bothner, 1994. Based on CCCP program by by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ # include "splintMacros.nf" # include "basic.h" # include # include "cpplib.h" # include "cpphash.h" typedef /*@null@*/ /*@only@*/ hashNode o_hashNode; typedef /*@null@*/ /*@only@*/ hashNode n_hashNode; static o_hashNode hashtab[CPP_HASHSIZE]; static o_hashNode ohashtab[CPP_HASHSIZE]; static void hashNode_delete (/*@null@*/ /*@only@*/ hashNode); /* p_prev need not be defined, but isn't defined by hashNode_copy */ /*@function static unsigned int hashStep (unsigned, char) modifies nothing ; @*/ # define hashStep(old, c) (((old) << 2) + (unsigned int) (c)) /*@function static unsigned int makePositive (unsigned int) modifies nothing ; @*/ # define makePositive(v) ((v) & 0x7fffffff) /* make number positive */ static /*@null@*/ hashNode hashNode_copy (/*@null@*/ hashNode, /*@null@*/ /*@dependent@*/ n_hashNode *p_hdr, /*@dependent@*/ /*@null@*/ /*@special@*/ hashNode p_prev) /*@*/ ; void cppReader_saveHashtab () { int i; for (i = 0; i < CPP_HASHSIZE; i++) { ohashtab[i] = hashNode_copy (hashtab[i], &ohashtab[i], NULL); } } void cppReader_restoreHashtab () { int i; for (i = 0; i < CPP_HASHSIZE; i++) { /* hashNode_delete (hashtab[i]); */ hashtab[i] = hashNode_copy (ohashtab[i], &hashtab[i], NULL); } } static void hashNode_delete (/*@only@*/ /*@null@*/ hashNode node) { if (node == NULL) { ; } else { hashNode_delete (node->next); if (node->type == T_MACRO) { DEFINITION *d = node->value.defn; struct reflist *ap, *nextap; for (ap = d->pattern; ap != NULL; ap = nextap) { nextap = ap->next; sfree (ap); } if (d->nargs >= 0) { sfree (d->args.argnames); } sfree (d); } cstring_free (node->name); sfree (node); } } /*@null@*/ hashNode hashNode_copy (hashNode node, hashNode *hdr, /*@dependent@*/ hashNode prev) { if (node == NULL) { return NULL; } else { hashNode res = dmalloc (sizeof (*res)); res->next = hashNode_copy (node->next, hdr, res); res->prev = prev; res->bucket_hdr = hdr; res->type = node->type; res->length = node->length; res->name = cstring_copy (node->name); if (node->type == T_MACRO) { DEFINITION *d = node->value.defn; DEFINITION *nd = dmalloc (sizeof (*nd)); res->value.defn = nd; nd->nargs = d->nargs; nd->length = d->length; nd->predefined = d->predefined; nd->expansion = d->expansion; nd->line = d->line; nd->file = d->file; if (d->pattern != NULL) { struct reflist *ap, *nextap; struct reflist **last = &nd->pattern; for (ap = d->pattern; ap != NULL; ap = nextap) { struct reflist *npattern = dmalloc (sizeof (* (nd->pattern))); nextap = ap->next; if (ap == d->pattern) { *last = npattern; /*@-branchstate@*/ } /*@=branchstate@*/ /* npattern is propagated through loop */ last = & (npattern->next); npattern->next = NULL; /* will get filled in */ npattern->stringify = d->pattern->stringify; npattern->raw_before = d->pattern->raw_before; npattern->raw_after = d->pattern->raw_after; npattern->rest_args = d->pattern->rest_args; npattern->argno = d->pattern->argno; /*@-mustfree@*/ } /*@=mustfree@*/ } else { nd->pattern = NULL; } if (d->nargs >= 0) { llassert (d->args.argnames != NULL); nd->args.argnames = mstring_copy (d->args.argnames); } else { /* ** This fix found by: ** ** Date: Mon, 31 May 1999 15:10:50 +0900 (JST) ** From: "N.Komazaki" */ /*! why doesn't splint report an error for this? */ nd->args.argnames = mstring_createEmpty (); } } else { if (node->type == T_CONST) { res->value.ival = node->value.ival; } else if (node->type == T_PCSTRING) { res->value.cpval = mstring_copy (node->value.cpval); llassert (res->value.cpval != NULL); } else { res->value = node->value; } } /*@-uniondef@*/ /*@-compdef@*/ /* res->prev is not defined */ return res; /*@=uniondef@*/ /*@=compdef@*/ } } /* Return hash function on name. must be compatible with the one computed a step at a time, elsewhere */ int cpphash_hashCode (const char *name, size_t len, int hashsize) { unsigned int r = 0; while (len-- != 0) { r = hashStep (r, *name++); } return (int) (makePositive (r) % hashsize); } /* ** Find the most recent hash node for name name (ending with first ** non-identifier char) cpphash_installed by install ** ** If len is >= 0, it is the length of the name. ** Otherwise, compute the length by scanning the entire name. ** ** If hash is >= 0, it is the precomputed hash code. ** Otherwise, compute the hash code. */ /*@null@*/ hashNode cpphash_lookup (char *name, int len, int hash) { const char *bp; hashNode bucket; if (len < 0) { for (bp = name; isIdentifierChar (*bp); bp++) { ; } len = bp - name; } if (hash < 0) { hash = cpphash_hashCode (name, size_fromInt (len), CPP_HASHSIZE); } bucket = hashtab[hash]; while (bucket != NULL) { if (bucket->length == size_fromInt (len) && cstring_equalLen (bucket->name, cstring_fromChars (name), size_fromInt (len))) { return bucket; } bucket = bucket->next; } return NULL; } /*@null@*/ hashNode cpphash_lookupExpand (char *name, int len, int hash, bool forceExpand) { hashNode node = cpphash_lookup (name, len, hash); DPRINTF (("Lookup expand: %s", name)); if (node != NULL) { if (node->type == T_MACRO) { DEFINITION *defn = (DEFINITION *) node->value.defn; DPRINTF (("Check macro...")); if (defn->noExpand && !forceExpand) { DPRINTF (("No expand!")); return NULL; } } } return node; } /* * Delete a hash node. Some weirdness to free junk from macros. * More such weirdness will have to be added if you define more hash * types that need it. */ /* Note that the DEFINITION of a macro is removed from the hash table but its storage is not freed. This would be a storage leak except that it is not reasonable to keep undefining and redefining large numbers of macros many times. In any case, this is necessary, because a macro can be #undef'd in the middle of reading the arguments to a call to it. If #undef freed the DEFINITION, that would crash. */ void cppReader_deleteMacro (hashNode hp) { if (hp->prev != NULL) { /*@-mustfree@*/ hp->prev->next = hp->next; /*@=mustfree@*/ /*@-branchstate@*/ } /*@=branchstate@*/ if (hp->next != NULL) { hp->next->prev = hp->prev; } /* make sure that the bucket chain header that the deleted guy was on points to the right thing afterwards. */ llassert (hp != NULL); llassert (hp->bucket_hdr != NULL); if (hp == *hp->bucket_hdr) { *hp->bucket_hdr = hp->next; } if (hp->type == T_MACRO) { DEFINITION *d = hp->value.defn; struct reflist *ap, *nextap; for (ap = d->pattern; ap != NULL; ap = nextap) { nextap = ap->next; sfree (ap); } if (d->nargs >= 0) { sfree (d->args.argnames); } } /*@-dependenttrans@*/ /*@-exposetrans@*/ /*@-compdestroy@*/ sfree (hp); /*@=dependenttrans@*/ /*@=exposetrans@*/ /*@=compdestroy@*/ } /* Install a name in the main hash table, even if it is already there. name stops with first non alphanumeric, except leading '#'. caller must check against redefinition if that is desired. cppReader_deleteMacro () removes things installed by install () in fifo order. this is important because of the `defined' special symbol used in #if, and also if pushdef/popdef directives are ever implemented. If LEN is >= 0, it is the length of the name. Otherwise, compute the length by scanning the entire name. If HASH is >= 0, it is the precomputed hash code. Otherwise, compute the hash code. */ hashNode cpphash_install (char *name, int len, enum node_type type, int ivalue, char *value, int hash) { hashNode hp; int bucket; char *p; DPRINTF (("Install: %s / %d", name, len)); if (len < 0) { p = name; while (isIdentifierChar (*p)) { p++; } len = p - name; } if (hash < 0) { hash = cpphash_hashCode (name, size_fromInt (len), CPP_HASHSIZE); } hp = (hashNode) dmalloc (sizeof (*hp)); bucket = hash; hp->bucket_hdr = &hashtab[bucket]; hp->next = hashtab[bucket]; hp->prev = NULL; if (hp->next != NULL) { hp->next->prev = hp; } hashtab[bucket] = hp; hp->type = type; hp->length = size_fromInt (len); if (hp->type == T_CONST) { hp->value.ival = ivalue; llassert (value == NULL); } else { hp->value.cpval = value; } hp->name = cstring_clip (cstring_fromCharsNew (name), size_fromInt (len)); DPRINTF (("Name: *%s*", hp->name)); /*@-mustfree@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-compmempass@*/ return hp; /*@=mustfree@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=compmempass@*/ } hashNode cpphash_installMacro (char *name, size_t len, struct definition *defn, int hash) { DPRINTF (("install macro: %s", name)); return cpphash_install (name, size_toInt (len), T_MACRO, 0, (char *) defn, hash); } void cppReader_hashCleanup (void) { int i; for (i = CPP_HASHSIZE; --i >= 0; ) { while (hashtab[i] != NULL) { cppReader_deleteMacro (hashtab[i]); } } } splint-3.1.2.dfsg1/src/cpperror.c0000644021234200000250000002033607646432514014251 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cpperror.c */ /* Default error handlers for CPP Library. Copyright (C) 1986, 87, 89, 92, 93, 94, 1995 Free Software Foundation, Inc. Written by Per Bothner, 1994. Based on CCCP program by by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. In other words, you are welcome to use, share and improve this program. You are forbidden to forbid anyone else to use, share and improve what you give them. Help stamp out software-hoarding! */ /*@-macroconstdecl@*/ /*@-macrofcndecl@*/ /*@-evalorderuncon@*/ /*@+ptrnegate@*/ /*@-memchecks@*/ /*@+charintliteral@*/ /*@-infloopsuncon@*/ /*@-loopswitchbreak@*/ /*@-switchloopbreak@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-elseifcomplete@*/ /*@-abstract@*/ /*@-usedef@*/ /*@-retvalint@*/ /*@-macroparams@*/ /*@-readonlytrans@*/ /*@-boolops@*/ /*@-sizeoftype@*/ /*@-predboolint@*/ /*@-predboolptr@*/ /*@+boolint@*/ /*@+charint@*/ /*@+ignorequals@*/ /*@+ignoresigns@*/ /*@+matchanyintegral@*/ /*@-onlyunqglobaltrans@*/ /*@-macroconstdecl@*/ # include # include # include # define FATAL_EXIT_CODE EXIT_FAILURE # include "splintMacros.nf" # include "basic.h" # include "cpplib.h" # include "cpperror.h" static cstring cppReader_unparseLoc (cppReader *p_pfile); static void cppReader_warningWithLine (cppReader *p_pfile, int p_line, int p_column, /*@only@*/ cstring p_msg); /* Print the file names and line numbers of the #include commands which led to the current file. */ void cppReader_printContainingFiles (cppReader *pfile) { cppBuffer *ip; int first = 1; if (pfile == NULL) { /* Error processing command line. */ return; } /* If stack of files hasn't changed since we last printed this info, don't repeat it. */ if (pfile->input_stack_listing_current) { return; } ip = cppReader_fileBuffer (pfile); /* Give up if we don't find a source file. */ if (ip == NULL) { return; } /* Find the other, outer source files. */ while ((ip = cppBuffer_prevBuffer (ip)), ip != cppReader_nullBuffer (pfile)) { int line, col; cstring temps; cppBuffer_getLineAndColumn (ip, &line, &col); if (ip->fname != NULL) { if (first) { first = 0; fprintf (g_warningstream, " In file included"); } else fprintf (g_warningstream, ",\n "); } fprintf (g_warningstream, " from %s", cstring_toCharsSafe (temps = fileloc_unparseRaw (ip->nominal_fname, line))); cstring_free (temps); } if (!first) { fprintf (g_warningstream, "\n"); } /* Record we have printed the status as of this time. */ pfile->input_stack_listing_current = 1; } static /*@only@*/ cstring cppReader_unparseLoc (cppReader *pfile) { DPRINTF (("unparse loc: %s", fileloc_unparse (cppReader_getLoc (pfile)))); return (fileloc_unparse (cppReader_getLoc (pfile))); } /* IS_ERROR is 2 for "fatal" error, 1 for error, 0 for warning */ static void cppReader_message (cppReader *pfile, int is_error, /*@only@*/ cstring msg) { if (!is_error) { /* fprintf (stderr, "warning: "); */ } else if (is_error == 2) { pfile->errors = cppReader_fatalErrorLimit; } else if (pfile->errors < cppReader_fatalErrorLimit) { pfile->errors++; } else { ; } fprintf (stderr, "%s", cstring_toCharsSafe (msg)); fprintf (stderr, "\n"); } /* Same as cppReader_error, except we consider the error to be "fatal", such as inconsistent options. I.e. there is little point in continuing. (We do not exit, to support use of cpplib as a library. Instead, it is the caller's responsibility to check cpplib_fatalErrors. */ void cppReader_fatalError (cppReader *pfile, /*@only@*/ cstring str) { fprintf (stderr, "preprocessor: "); cppReader_message (pfile, 2, str); } void cppReader_pfatalWithName (cppReader *pfile, cstring name) { cppReader_perrorWithName (pfile, name); exit (FATAL_EXIT_CODE); } /*@only@*/ fileloc cppReader_getLoc (cppReader *pfile) { cppBuffer *ip = cppReader_fileBuffer (pfile); if (ip != NULL && ip->buf != NULL) { int line, col; cstring fname = ip->nominal_fname; fileId fid = fileTable_lookup (context_fileTable (), fname); if (!fileId_isValid (fid)) { /* evans 2002-02-09 ** filename used in #line comment is new */ fid = fileTable_addFile (context_fileTable (), fname); } cppBuffer_getLineAndColumn (ip, &line, &col); return fileloc_create (fid, line, col); } else { return fileloc_createBuiltin (); } } void cppReader_errorLit (cppReader *pfile, /*@observer@*/ cstring msg) { cppReader_error (pfile, cstring_copy (msg)); } void cppReader_error (cppReader *pfile, /*@only@*/ cstring msg) { if (cppoptgenerror (FLG_PREPROC, msg, pfile)) { pfile->errors++; } } /* Print error message but don't count it. */ void cppReader_warningLit (cppReader *pfile, cstring msg) { cppReader_warning (pfile, cstring_copy (msg)); } void cppReader_warning (cppReader *pfile, /*@only@*/ cstring msg) { if (CPPOPTIONS (pfile)->warnings_are_errors) pfile->errors++; cppoptgenerror (FLG_PREPROC, msg, pfile); } /* Print an error message and maybe count it. */ extern void cppReader_pedwarnLit (cppReader *pfile, /*@observer@*/ cstring msg) { cppReader_pedwarn (pfile, cstring_copy (msg)); } extern void cppReader_pedwarn (cppReader *pfile, /*@only@*/ cstring msg) { if (CPPOPTIONS (pfile)->pedantic_errors) { cppReader_error (pfile, msg); } else { cppReader_warning (pfile, msg); } } void cppReader_errorWithLine (cppReader *pfile, int line, int column, /*@only@*/ cstring msg) { fileloc loc = cppReader_getLoc (pfile); fileloc_setLineno (loc, line); fileloc_setColumn (loc, column); cppoptgenerror (FLG_PREPROC, message ("%s: %s", fileloc_unparse (loc), msg), pfile); } void cppReader_warningWithLine (cppReader *pfile, int line, int column, /*@only@*/ cstring msg) { if (CPPOPTIONS (pfile)->warnings_are_errors) pfile->errors++; cppReader_errorWithLine (pfile, line, column, msg); } void cppReader_pedwarnWithLine (cppReader *pfile, int line, int column, /*@only@*/ cstring msg) { if (CPPOPTIONS (pfile)->pedantic_errors) { cppReader_errorWithLine (pfile, column, line, msg); } else { cppReader_warningWithLine (pfile, line, column, msg); } } void cppReader_perrorWithName (cppReader *pfile, cstring name) { cppoptgenerror (FLG_PREPROC, message ("%s: Preprocessing error: %s", name, lldecodeerror (errno)), pfile); } splint-3.1.2.dfsg1/src/context.c0000644021234200000250000032547110102766472014103 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** context.c */ /* * Modified by Herbert 04/19/97: * - added include for new header portab.h containing OS dependent stuff. * - changed occurrances of '/' as path delimiters to macro from portab.h * - changed the handling of the tmp directory -- will no longer always be * ".", if possible, environment variables "TMP" or, if not set, "TMP", * or, if not set "." will be used. */ # include "splintMacros.nf" # include "basic.h" # include "usymtab_interface.h" # include "exprChecks.h" # include "filelocStack.h" # include "llmain.h" # include "intSet.h" # include "osd.h" extern /*@external@*/ int yydebug; extern /*@external@*/ int mtdebug; typedef struct { cstring file; typeIdSet daccess; } maccesst; typedef enum { CX_ERROR, CX_GLOBAL, CX_INNER, CX_FUNCTION, CX_FCNDECLARATION, CX_MACROFCN, CX_MACROCONST, CX_UNKNOWNMACRO, CX_ITERDEF, CX_ITEREND, CX_OLDSTYLESCOPE, /* Parsing old-style parameter declarations */ CX_LCL, CX_LCLLIB, CX_MT } kcontext; static struct { int linesprocessed; int speclinesprocessed; flagMarkerList markers; /* ** used to record state where a macro must match a function name ** (i.e., no params were listed in the macro definition */ bool macroMissingParams BOOLBITS; bool preprocessing BOOLBITS; bool incommandline BOOLBITS; bool insuppressregion BOOLBITS; bool inDerivedFile BOOLBITS; bool instandardlib BOOLBITS; bool inimport BOOLBITS; bool inheader BOOLBITS; bool inmacrocache BOOLBITS; bool protectVars BOOLBITS; bool neednl BOOLBITS; bool showfunction BOOLBITS; bool savedFlags BOOLBITS; bool justpopped BOOLBITS; bool anyExports BOOLBITS; bool inFunctionHeader BOOLBITS; flagcode library; ynm isNullGuarded; fileloc saveloc; fileloc pushloc; clauseStack clauses; clause inclause; int numerrors; int numbugs; filelocStack locstack; fileTable ftab; cstring msgAnnote; /*@observer@*/ sRef aliasAnnote; /*@observer@*/ sRef aliasAnnoteAls; messageLog msgLog; macrocache mc; /*@observer@*/ sRefSet mods; /* file access types */ typeIdSet facct; /* local access types (this function) */ typeIdSet acct; /* no access types (@noaccess) */ typeIdSet nacct; /*@observer@*/ globSet globs; /*@only@*/ globSet globs_used; int nmods; int maxmods; /*@reldef@*/ maccesst *moduleaccess; /* Not defined is nmods == 0. */ kcontext kind; ctype boolType; bool flags[NUMFLAGS]; bool saveflags[NUMFLAGS]; bool setGlobally[NUMFLAGS]; bool setLocally[NUMFLAGS]; int values[NUMVALUEFLAGS]; int counters[NUMVALUEFLAGS]; o_cstring strings[NUMSTRINGFLAGS]; sRefSetList modrecs; /* Keep track of file static symbols modified. */ metaStateTable stateTable; /* User-defined state information. */ annotationTable annotTable; /* User-defined annotations table. */ union u_cont { bool glob; int cdepth; /*@dependent@*/ /*@exposed@*/ uentry fcn; } cont; kcontext savekind; union u_cont savecont; } gc; static /*@exposed@*/ cstring context_exposeString (flagcode p_flag) ; static void context_restoreFlagSettings (void) /*@modifies gc@*/ ; static void context_saveFlagSettings (void) /*@modifies gc@*/ ; static void context_exitClauseAux (exprNode p_pred, exprNode p_tbranch) /*@modifies gc@*/ ; static void context_exitClauseSimp (void) /*@modifies gc@*/ ; static void context_exitClausePlain (void) /*@modifies gc@*/ ; static void context_setJustPopped (void) /*@modifies gc.justpopped@*/ ; static void context_setValue (flagcode p_flag, int p_val) /*@modifies gc.flags@*/ ; static void context_setFlag (flagcode p_f, bool p_b, fileloc p_loc) /*@modifies gc.flags@*/ ; static void context_setFlagAux (flagcode p_f, bool p_b, bool p_inFile, bool p_isRestore, fileloc p_loc) /*@modifies gc.flags@*/ ; static void context_restoreFlag (flagcode p_f, fileloc p_loc) /*@modifies gc.flags@*/ ; /*@+enumindex@*/ cstring context_unparseFlagMarkers () { return (flagMarkerList_unparse (gc.markers)); } void context_setPreprocessing (void) { llassert (!gc.preprocessing); gc.preprocessing = TRUE; } void context_clearPreprocessing (void) { llassert (gc.preprocessing); gc.preprocessing = FALSE; } bool context_isPreprocessing (void) { return gc.preprocessing; } bool context_loadingLibrary (void) { return (fileloc_isLib (g_currentloc)); } bool context_inXHFile (void) { return (fileloc_isXHFile (g_currentloc)); } void context_setInCommandLine (void) { llassert (!gc.incommandline); gc.incommandline = TRUE; } void context_clearInCommandLine (void) { llassert (gc.incommandline); gc.incommandline = FALSE; } bool context_isInCommandLine (void) { return gc.incommandline; } static void pushClause (clause c) /*@modifies gc.clauses, gc.inclause@*/ { gc.inclause = c; clauseStack_push (gc.clauses, c); if (clause_isConditional (c) && context_getFlag (FLG_CONTROLNESTDEPTH)) { int maxdepth = context_getValue (FLG_CONTROLNESTDEPTH); int depth = clauseStack_controlDepth (gc.clauses); if (depth == maxdepth + 1) { voptgenerror (FLG_CONTROLNESTDEPTH, message ("Maximum control nesting depth " "(%d) exceeded", maxdepth), g_currentloc); } } } static clause topClause (clauseStack s) /*@*/ { if (clauseStack_isEmpty (s)) return NOCLAUSE; return ((clause) clauseStack_top (s)); } void context_addMacroCache (/*@only@*/ cstring def) { DPRINTF (("macro cache: %s", def)); macrocache_addEntry (gc.mc, fileloc_copy (g_currentloc), def); } void context_addComment (/*@only@*/ cstring def, fileloc loc) { macrocache_addComment (gc.mc, fileloc_copy (loc), def); } /* ** returns TRUE is fl is in ignore region, or region where -code ** ** the logic is fuzzy... */ static bool context_inSuppressFlagZone (fileloc fl, flagcode code) { ynm ret = flagMarkerList_suppressError (gc.markers, code, fl); bool res = FALSE; if (ynm_isMaybe (ret)) { /* ** whas is dis? */ if (gc.savedFlags) { res = !gc.saveflags[code]; } else { res = !context_getFlag (code); } } else { res = ynm_toBoolStrict (ret); } return res; } static bool context_suppressSystemMsg (fileloc fl) { if (context_getFlag (FLG_SYSTEMDIRERRORS)) { return FALSE; } else { return (fileloc_isSystemFile (fl)); } } bool context_suppressFlagMsg (flagcode flag, fileloc fl) { if (context_suppressSystemMsg (fl)) { return TRUE; } DPRINTF (("Checking suppress: %s / %s", fileloc_unparse (fl), fileloc_unparse (g_currentloc))); /* want same object compare here */ if (fileloc_equal (fl, g_currentloc) || gc.inDerivedFile) { DPRINTF (("In derived file: %s", bool_unparse (gc.inDerivedFile))); return (!context_getFlag (flag) || context_inSuppressRegion () || context_inSuppressZone (fl) || (context_inSuppressFlagZone (fl, flag))); /* removed gc.inDerivedFile from this */ } else { return (context_inSuppressFlagZone (fl, flag)); } } bool context_suppressNotFlagMsg (flagcode flag, fileloc fl) { if (context_suppressSystemMsg (fl)) { return TRUE; } /*@access fileloc@*/ if (fl == g_currentloc) /*@noaccess fileloc@*/ { return (context_getFlag (flag) || context_inSuppressRegion ()); } else { /* for now... */ return (context_getFlag (flag) || context_inSuppressRegion ()); } } bool context_inSuppressZone (fileloc fl) { if (context_suppressSystemMsg (fl)) { return TRUE; } return (flagMarkerList_inIgnore (gc.markers, fl)); } bool context_inSuppressRegion (void) { return (gc.insuppressregion); } void context_enterSuppressRegion (fileloc loc) { if (gc.insuppressregion) { gc.insuppressregion = FALSE; /* get this msg! */ llmsg (message ("%q: New ignore errors region entered while in ignore errors region", fileloc_unparse (loc))); } gc.insuppressregion = TRUE; (void) flagMarkerList_add (gc.markers, flagMarker_createIgnoreOn (loc)); } static void context_addFlagMarker (flagcode code, ynm set, fileloc loc) { (void) flagMarkerList_add (gc.markers, flagMarker_createLocalSet (code, set, loc)); } void context_enterSuppressLine (int count, fileloc loc) { if (context_processingMacros ()) { return; } if (flagMarkerList_add (gc.markers, flagMarker_createIgnoreCount (count, loc))) { fileloc nextline = fileloc_copy (loc); fileloc_nextLine (nextline); fileloc_setColumn (nextline, 0); check (flagMarkerList_add (gc.markers, flagMarker_createIgnoreOff (nextline))); fileloc_free (nextline); } } void context_checkSuppressCounts (void) { if (context_getFlag (FLG_SUPCOUNTS)) { flagMarkerList_checkSuppressCounts (gc.markers); } } void context_incLineno (void) { gc.linesprocessed++; incLine (); } void context_exitSuppressRegion (fileloc loc) { if (!gc.insuppressregion) { voptgenerror (FLG_SYNTAX, message ("End ignore errors in region while not ignoring errors"), loc); } gc.insuppressregion = FALSE; (void) flagMarkerList_add (gc.markers, flagMarker_createIgnoreOff (loc)); } void context_enterMTfile (void) { gc.kind = CX_MT; } void context_exitMTfile (void) { llassert (gc.kind == CX_MT); gc.kind = CX_GLOBAL; } void context_enterLCLfile (void) { gc.kind = CX_LCL; gc.facct = typeIdSet_emptySet (); } static void addModuleAccess (/*@only@*/ cstring fname, typeIdSet mods) { int i; for (i = 0; i < gc.nmods; i++) { if (cstring_equal (gc.moduleaccess[i].file, fname)) { gc.moduleaccess[i].daccess = typeIdSet_union (gc.moduleaccess[i].daccess, mods); cstring_free (fname); return; } } if (gc.nmods == gc.maxmods) { maccesst *oldmods; gc.maxmods = gc.maxmods + DEFAULTMAXMODS; oldmods = gc.moduleaccess; gc.moduleaccess = (maccesst *) dmalloc (sizeof (*gc.moduleaccess) * (gc.maxmods)); for (i = 0; i < gc.nmods; i++) { gc.moduleaccess[i] = oldmods[i]; } sfree (oldmods); } gc.moduleaccess[gc.nmods].file = fname; gc.moduleaccess[gc.nmods].daccess = mods; gc.nmods++; } static void insertModuleAccess (cstring fname, typeId t) { int i; for (i = 0; i < gc.nmods; i++) { if (cstring_equal (gc.moduleaccess[i].file, fname)) { gc.moduleaccess[i].daccess = typeIdSet_insert (gc.moduleaccess[i].daccess, t); break; } } addModuleAccess (cstring_copy (fname), typeIdSet_single (t)); } void context_exitLCLfile (void) { if (gc.kind != CX_LCLLIB) { cstring lclname = fileLib_withoutExtension (fileTable_fileName (currentFile ()), LCL_EXTENSION); addModuleAccess (fileLib_removePath (lclname), gc.facct); cstring_free (lclname); } gc.kind = CX_LCL; gc.kind = CX_GLOBAL; gc.facct = typeIdSet_emptySet (); } void context_dumpModuleAccess (FILE *fout) { int i = 0; for (i = 0; i < gc.nmods; i++) { cstring td = typeIdSet_dump (gc.moduleaccess[i].daccess); fprintf (fout, "%s#%s@\n", cstring_toCharsSafe (gc.moduleaccess[i].file), cstring_toCharsSafe (td)); cstring_free (td); } } bool context_usingPosixLibrary () { return (gc.library == FLG_POSIXLIB || gc.library == FLG_POSIXSTRICTLIB || gc.library == FLG_UNIXLIB || gc.library == FLG_UNIXSTRICTLIB); } bool context_usingAnsiLibrary () { return (gc.library != FLG_NOLIB); } flagcode context_getLibrary () { return gc.library; } void context_setLibrary (flagcode code) { gc.library = code; } /*@observer@*/ cstring context_selectedLibrary () { switch (gc.library) { case FLG_STRICTLIB: return cstring_makeLiteralTemp (LLSTRICTLIBS_NAME); case FLG_POSIXLIB: return cstring_makeLiteralTemp (LLPOSIXLIBS_NAME); case FLG_POSIXSTRICTLIB: return cstring_makeLiteralTemp (LLPOSIXSTRICTLIBS_NAME); case FLG_UNIXLIB: return cstring_makeLiteralTemp (LLUNIXLIBS_NAME); case FLG_UNIXSTRICTLIB: return cstring_makeLiteralTemp (LLUNIXSTRICTLIBS_NAME); case FLG_ANSILIB: return cstring_makeLiteralTemp (LLSTDLIBS_NAME); BADDEFAULT; } } void context_loadModuleAccess (FILE *in) { char *s = mstring_create (MAX_DUMP_LINE_LENGTH); char *lasts = s; char *name = mstring_create (MAX_NAME_LENGTH); char *oname = name; # ifndef NOFREE char *os = s; # endif while ((reader_readLine (in, s, MAX_DUMP_LINE_LENGTH) != NULL ) && *s == ';') { ; } while (s != NULL && *s != ';' && *s != '\0') { name = oname; while (*s != '#' && *s != '\0') { *name++ = *s++; } *name = '\0'; if (*s != '#') { llcontbug (message ("context_loadModuleAccess: bad library line: %s\n", cstring_fromChars (s))); break; } s++; addModuleAccess (cstring_copy (cstring_fromChars (oname)), typeIdSet_undump (&s)); (void) reader_readLine (in, s, MAX_DUMP_LINE_LENGTH); llassert (s != lasts); lasts = s; } sfree (oname); # ifndef NOFREE sfree (os); # endif } typeIdSet context_fileAccessTypes (void) { return gc.facct; } void context_resetModeFlags (void) { allFlagCodes (code) { if (flagcode_isModeFlag (code)) { context_setFlag (code, FALSE, g_currentloc); } } end_allFlagCodes; } /* ** resetAllFlags ** ** Set all flags to FALSE, except for a few which are ** true by default. ** ** Set all values and strings to appropriate defaults. ** Set all counters to 0. */ static void conext_resetAllCounters (void) { int i; for (i = 0; i < NUMVALUEFLAGS; i++) { gc.counters[i] = 0; } } void context_resetAllFlags (void) { DPRINTF (("******** Reset all flags")); allFlagCodes (code) { gc.flags[code] = FALSE; if (flagcode_hasNumber (code)) { int val = 0; /*@-loopswitchbreak@*/ switch (code) { case FLG_LIMIT: val = DEFAULT_LIMIT; break; case FLG_BUGSLIMIT: val = DEFAULT_BUGSLIMIT; break; case FLG_LINELEN: val = DEFAULT_LINELEN; break; case FLG_INDENTSPACES: val = DEFAULT_INDENTSPACES; break; case FLG_LOCINDENTSPACES: val = DEFAULT_LOCINDENTSPACES; break; case FLG_EXTERNALNAMELEN: val = ISO99_EXTERNALNAMELEN; break; case FLG_INTERNALNAMELEN: val = ISO99_INTERNALNAMELEN; break; case FLG_COMMENTCHAR: val = (int) DEFAULT_COMMENTCHAR; break; case FLG_CONTROLNESTDEPTH: val = (int) ISO99_CONTROLNESTDEPTH; break; case FLG_STRINGLITERALLEN: val = (int) ISO99_STRINGLITERALLEN; break; case FLG_INCLUDENEST: val = (int) ISO99_INCLUDENEST; break; case FLG_NUMSTRUCTFIELDS: val = (int) ISO99_NUMSTRUCTFIELDS; break; case FLG_NUMENUMMEMBERS: val = (int) ISO99_NUMENUMMEMBERS; break; case FLG_EXPECT: case FLG_LCLEXPECT: break; default: llbug (message ("Bad value flag: %s", flagcode_unparse (code))); } /*@=loopswitchbreak@*/ DPRINTF (("Set value: [%s] / %d", flagcode_unparse (code), val)); context_setValue (code, val); DPRINTF (("Set value: [%s] / %d", flagcode_unparse (code), context_getValue (code))); llassert (context_getValue (code) == val); } else if (flagcode_hasChar (code)) { llassert (code == FLG_COMMENTCHAR); context_setCommentMarkerChar (DEFAULT_COMMENTCHAR); } else if (flagcode_hasString (code)) { cstring val = cstring_undefined; switch (code) { /*@-loopswitchbreak@*/ case FLG_LARCHPATH: { cstring larchpath = osd_getEnvironmentVariable (LARCH_PATH); if (cstring_isDefined (larchpath)) { val = cstring_copy (larchpath); } else { val = cstring_makeLiteral (DEFAULT_LARCHPATH); } break; } case FLG_LCLIMPORTDIR: { val = cstring_copy (osd_getEnvironment (cstring_makeLiteralTemp (LCLIMPORTDIR), cstring_makeLiteralTemp (DEFAULT_LCLIMPORTDIR))); break; } case FLG_TMPDIR: # if defined(OS2) || defined(MSDOS) || defined(WIN32) { char *env = osd_getEnvironmentVariable ("TMP"); if (env == NULL) { env = osd_getEnvironmentVariable ("TEMP"); } val = cstring_makeLiteral (env != NULL ? env : DEFAULT_TMPDIR); } # else val = cstring_makeLiteral (DEFAULT_TMPDIR); # endif /* !defined(OS2) && !defined(MSDOS) */ break; case FLG_BOOLTYPE: val = cstring_makeLiteral (DEFAULT_BOOLTYPE); break; case FLG_BOOLFALSE: val = cstring_makeLiteral ("false"); break; case FLG_BOOLTRUE: val = cstring_makeLiteral ("true"); break; case FLG_MACROVARPREFIX: val = cstring_makeLiteral ("m_"); break; case FLG_SYSTEMDIRS: val = cstring_makeLiteral (DEFAULT_SYSTEMDIR); break; default: break; } /*@=loopswitchbreak@*/ context_setString (code, val); } else { ; /* nothing to set */ } } end_allFlagCodes; /* ** These flags are true by default. */ /* eventually, move this into flags.def */ gc.flags[FLG_STREAMOVERWRITE] = TRUE; gc.flags[FLG_OBVIOUSLOOPEXEC] = TRUE; gc.flags[FLG_MODIFIES] = TRUE; gc.flags[FLG_NESTCOMMENT] = TRUE; gc.flags[FLG_GLOBALS] = TRUE; gc.flags[FLG_FULLINITBLOCK] = TRUE; gc.flags[FLG_INITSIZE] = TRUE; gc.flags[FLG_INITALLELEMENTS] = TRUE; gc.flags[FLG_NULLINIT] = TRUE; gc.flags[FLG_STRINGLITTOOLONG] = TRUE; gc.flags[FLG_MACROCONSTDIST] = TRUE; gc.flags[FLG_LIKELYBOOL] = TRUE; gc.flags[FLG_ZEROPTR] = TRUE; gc.flags[FLG_NUMLITERAL] = TRUE; gc.flags[FLG_DUPLICATEQUALS] = TRUE; gc.flags[FLG_SKIPISOHEADERS] = TRUE; gc.flags[FLG_SKIPPOSIXHEADERS] = FALSE; gc.flags[FLG_SYSTEMDIREXPAND] = TRUE; gc.flags[FLG_UNRECOGCOMMENTS] = TRUE; gc.flags[FLG_UNRECOGFLAGCOMMENTS] = TRUE; gc.flags[FLG_CASTFCNPTR] = TRUE; gc.flags[FLG_DOLCS] = TRUE; gc.flags[FLG_USEVARARGS] = TRUE; gc.flags[FLG_MAINTYPE] = TRUE; gc.flags[FLG_SPECMACROS] = TRUE; gc.flags[FLG_REDEF] = TRUE; gc.flags[FLG_MACRONEXTLINE] = TRUE; gc.flags[FLG_SIZEOFFORMALARRAY] = TRUE; gc.flags[FLG_FIXEDFORMALARRAY] = TRUE; gc.flags[FLG_UNRECOGDIRECTIVE] = TRUE; gc.flags[FLG_WARNUSE] = TRUE; gc.flags[FLG_PREDASSIGN] = TRUE; gc.flags[FLG_MODOBSERVER] = TRUE; gc.flags[FLG_MACROVARPREFIXEXCLUDE] = TRUE; gc.flags[FLG_EXTERNALNAMECASEINSENSITIVE] = TRUE; gc.flags[FLG_PARAMIMPTEMP] = TRUE; gc.flags[FLG_RETIMPONLY] = TRUE; gc.flags[FLG_GLOBIMPONLY] = TRUE; gc.flags[FLG_STRUCTIMPONLY] = TRUE; gc.flags[FLG_PREPROC] = TRUE; gc.flags[FLG_NAMECHECKS] = TRUE; gc.flags[FLG_FORMATCODE] = TRUE; gc.flags[FLG_FORMATTYPE] = TRUE; gc.flags[FLG_BADFLAG] = TRUE; gc.flags[FLG_WARNFLAGS] = TRUE; gc.flags[FLG_WARNRC] = TRUE; gc.flags[FLG_FILEEXTENSIONS] = TRUE; gc.flags[FLG_WARNUNIXLIB] = FALSE; gc.flags[FLG_WARNPOSIX] = TRUE; gc.flags[FLG_SHOWCOL] = TRUE; gc.flags[FLG_SHOWDEEPHISTORY] = FALSE; /* TRUE; */ gc.flags[FLG_SHOWFUNC] = TRUE; gc.flags[FLG_SUPCOUNTS] = TRUE; gc.flags[FLG_HINTS] = TRUE; gc.flags[FLG_SYNTAX] = TRUE; gc.flags[FLG_TYPE] = TRUE; gc.flags[FLG_INCOMPLETETYPE] = TRUE; gc.flags[FLG_ABSTRACT] = TRUE; gc.flags[FLG_NUMABSTRACT] = TRUE; gc.flags[FLG_ITERBALANCE] = TRUE; gc.flags[FLG_ITERYIELD] = TRUE; gc.flags[FLG_DUPLICATECASES] = TRUE; gc.flags[FLG_ALWAYSEXITS] = TRUE; gc.flags[FLG_EMPTYRETURN] = TRUE; gc.flags[FLG_MACRORETURN] = TRUE; gc.flags[FLG_UNRECOG] = TRUE; gc.flags[FLG_SYSTEMUNRECOG] = TRUE; gc.flags[FLG_LINTCOMMENTS] = TRUE; gc.flags[FLG_ACCESSCZECH] = TRUE; gc.flags[FLG_ACCESSMODULE] = TRUE; gc.flags[FLG_ACCESSFILE] = TRUE; gc.flags[FLG_MACROVARPREFIX] = TRUE; gc.flags[FLG_ANNOTATIONERROR] = TRUE; gc.flags[FLG_COMMENTERROR] = TRUE; /* ** Changed for version 2.4. */ gc.flags[FLG_GNUEXTENSIONS] = TRUE; /* Changed for 3.0.0.19 */ /* commenting ou until some output issues are fixed */ gc.flags[FLG_ORCONSTRAINT] = TRUE; gc.flags[FLG_CONSTRAINTLOCATION] = TRUE; /*drl 1/18/2002*/ gc.flags[FLG_WARNSYSFILES] = TRUE; /* ** On by default for Win32, but not Unix */ # if defined (WIN32) || defined (OS2) gc.flags[FLG_PARENFILEFORMAT] = TRUE; gc.flags[FLG_CASEINSENSITIVEFILENAMES] = TRUE; # endif } /* ** C is way-lame, and you can initialize an array to a constant except where ** it is declared. Hence, a macro is used to set the modeflags. */ /*@notfunction@*/ # define SETFLAGS() \ { int i = 0; while (modeflags[i] != INVALID_FLAG) { \ if (!flagcode_isModeFlag (modeflags[i])) \ { llbug (message ("not a mode flag: %s", \ flagcode_unparse (modeflags[i]))); } \ else { context_setFlag (modeflags[i], TRUE, g_currentloc); } i++; }} static void context_setModeAux (cstring p_s, bool p_warn) ; void context_setMode (cstring s) { context_setModeAux (s, TRUE); } void context_setModeNoWarn (cstring s) { context_setModeAux (s, FALSE); } void context_setModeAux (cstring s, bool warn) { intSet setflags = intSet_new (); allFlagCodes (code) { if (flagcode_isModeFlag (code)) { if (gc.setGlobally[code]) { (void) intSet_insert (setflags, (int) code); } } } end_allFlagCodes; if (!intSet_isEmpty (setflags)) { cstring rflags = cstring_undefined; int num = 0; intSet_elements (setflags, el) { if (cstring_isUndefined (rflags)) { rflags = cstring_copy (flagcode_unparse ((flagcode) (el))); } else { rflags = message ("%q, %s", rflags, flagcode_unparse ((flagcode) el)); } num++; if (num > 4 && intSet_size (setflags) > 6) { rflags = message ("%q, (%d others) ...", rflags, intSet_size (setflags) - num); break; } } end_intSet_elements ; if (warn) { voptgenerror (FLG_WARNFLAGS, message ("Setting mode %s after setting mode flags will " "override set values of flags: %s", s, rflags), g_currentloc); } cstring_free (rflags); } intSet_free (setflags); context_resetModeFlags (); if (cstring_equalLit (s, "standard")) { flagcode modeflags[] = { FLG_ENUMINT, FLG_MACROMATCHNAME, FLG_STRINGLITNOROOM, FLG_STRINGLITNOROOMFINALNULL, FLG_MACROUNDEF, FLG_RELAXQUALS, FLG_USEALLGLOBS, FLG_CHECKSTRICTGLOBALS, FLG_CHECKSTRICTGLOBALIAS, FLG_CHECKEDGLOBALIAS, FLG_CHECKMODGLOBALIAS, FLG_PREDBOOLOTHERS, FLG_PREDBOOLINT, FLG_UNSIGNEDCOMPARE, FLG_PARAMUNUSED, FLG_VARUNUSED, FLG_FUNCUNUSED, FLG_TYPEUNUSED, FLG_ABSTRACTCOMPARE, FLG_CONSTUNUSED, FLG_ENUMMEMUNUSED, FLG_FIELDUNUSED, FLG_PTRNUMCOMPARE, FLG_BOOLCOMPARE, FLG_UNSIGNEDCOMPARE, FLG_MUTREP, FLG_NOEFFECT, FLG_IMPTYPE, FLG_RETVALOTHER, FLG_RETVALBOOL, FLG_RETVALINT, FLG_SPECUNDEF, FLG_INCONDEFS, FLG_INCONDEFSLIB, FLG_MISPLACEDSHAREQUAL, FLG_MATCHFIELDS, FLG_FORMATCONST, FLG_MACROPARAMS, FLG_MACROASSIGN, FLG_SEFPARAMS, FLG_MACROSTMT, FLG_MACROPARENS, FLG_MACROFCNDECL, FLG_MACROCONSTDECL, FLG_MACROREDEF, FLG_INFLOOPS, FLG_UNREACHABLE, FLG_NORETURN, FLG_CASEBREAK, FLG_MISSCASE, FLG_USEDEF, FLG_FIRSTCASE, FLG_NESTEDEXTERN, FLG_NUMLITERAL, FLG_ZEROBOOL, /* memchecks flags */ FLG_NULLDEREF, FLG_NULLSTATE, FLG_NULLASSIGN, FLG_NULLPASS, FLG_NULLRET, FLG_ALLOCMISMATCH, FLG_COMPDEF, FLG_COMPMEMPASS, FLG_UNIONDEF, FLG_RETSTACK, /* memtrans flags */ FLG_EXPOSETRANS, FLG_OBSERVERTRANS, FLG_DEPENDENTTRANS, FLG_NEWREFTRANS, FLG_ONLYTRANS, FLG_OWNEDTRANS, FLG_FRESHTRANS, FLG_SHAREDTRANS, FLG_TEMPTRANS, FLG_KEPTTRANS, FLG_REFCOUNTTRANS, FLG_STATICTRANS, FLG_UNKNOWNTRANS, FLG_KEEPTRANS, FLG_IMMEDIATETRANS, FLG_NUMABSTRACTCAST, FLG_EXPORTLOCAL, FLG_USERELEASED, FLG_ALIASUNIQUE, FLG_MAYALIASUNIQUE, FLG_MUSTFREEONLY, FLG_MUSTFREEFRESH, FLG_MUSTDEFINE, FLG_GLOBSTATE, FLG_COMPDESTROY, FLG_MUSTNOTALIAS, FLG_MEMIMPLICIT, FLG_BRANCHSTATE, FLG_STATETRANSFER, FLG_STATEMERGE, FLG_EVALORDER, FLG_SHADOW, FLG_READONLYSTRINGS, FLG_EXITARG, FLG_IMPCHECKEDSPECGLOBALS, FLG_MODGLOBS, FLG_WARNLINTCOMMENTS, FLG_IFEMPTY, FLG_REALCOMPARE, FLG_BOOLOPS, FLG_PTRNEGATE, FLG_SHIFTNEGATIVE, FLG_SHIFTIMPLEMENTATION, FLG_BUFFEROVERFLOWHIGH, FLG_BUFFEROVERFLOW, INVALID_FLAG } ; SETFLAGS (); } else if (cstring_equalLit (s, "weak")) { flagcode modeflags[] = { FLG_BOOLINT, FLG_CHARINT, FLG_FLOATDOUBLE, FLG_LONGINT, FLG_SHORTINT, FLG_ENUMINT, FLG_RELAXQUALS, FLG_FORWARDDECL, FLG_CHARINDEX, FLG_NUMABSTRACTINDEX, FLG_ABSTVOIDP, FLG_USEALLGLOBS, FLG_CHARUNSIGNEDCHAR, FLG_PREDBOOLOTHERS, FLG_NUMABSTRACTLIT, FLG_VARUNUSED, FLG_FUNCUNUSED, FLG_TYPEUNUSED, FLG_CHECKSTRICTGLOBALS, FLG_MACROMATCHNAME, FLG_RETVALOTHER, FLG_IFEMPTY, FLG_BUFFEROVERFLOWHIGH, FLG_RETSTACK, FLG_PTRNEGATE, FLG_STATETRANSFER, FLG_STATEMERGE, FLG_LONGUNSIGNEDINTEGRAL, FLG_LONGUNSIGNEDUNSIGNEDINTEGRAL, FLG_NUMLITERAL, FLG_CHARINTLITERAL, FLG_ZEROBOOL, FLG_BUFFEROVERFLOWHIGH, FLG_STRINGLITNOROOM, FLG_STRINGLITNOROOMFINALNULL, INVALID_FLAG } ; SETFLAGS (); } else if (cstring_equalLit (s, "checks")) { flagcode modeflags[] = { FLG_EXPORTLOCAL, FLG_IMPTYPE, FLG_NUMABSTRACTCAST, FLG_ABSTRACTCOMPARE, FLG_STATETRANSFER, FLG_STATEMERGE, FLG_CHECKSTRICTGLOBALIAS, FLG_CHECKEDGLOBALIAS, FLG_CHECKMODGLOBALIAS, FLG_UNCHECKEDGLOBALIAS, FLG_FORMATCONST, FLG_STRINGLITNOROOM, FLG_STRINGLITNOROOMFINALNULL, FLG_STRINGLITSMALLER, FLG_EXITARG, FLG_PTRNUMCOMPARE, FLG_BOOLCOMPARE, FLG_UNSIGNEDCOMPARE, FLG_MACROUNDEF, FLG_MUSTMOD, FLG_ALLGLOBALS, FLG_PREDBOOLOTHERS, FLG_PREDBOOLPTR, FLG_PREDBOOLINT, FLG_USEALLGLOBS, FLG_MUTREP, FLG_RETALIAS, FLG_RETEXPOSE, FLG_ASSIGNEXPOSE, FLG_CASTEXPOSE, FLG_FUNCUNUSED, FLG_GLOBALSIMPMODIFIESNOTHING, FLG_TYPEUNUSED, FLG_FIELDUNUSED, FLG_PARAMUNUSED, FLG_VARUNUSED, FLG_CONSTUNUSED, FLG_ENUMMEMUNUSED, FLG_NOEFFECT, FLG_EXPORTHEADER, FLG_EXPORTHEADERVAR, FLG_RETVALOTHER, FLG_RETVALBOOL, FLG_RETVALINT, FLG_SPECUNDEF, FLG_IMPCHECKMODINTERNALS, FLG_DECLUNDEF, FLG_INCONDEFS, FLG_INCONDEFSLIB, FLG_MISPLACEDSHAREQUAL, FLG_REDUNDANTSHAREQUAL, FLG_NUMABSTRACTPRINT, FLG_MATCHFIELDS, FLG_MACROPARAMS, FLG_MACROASSIGN, FLG_DECLPARAMMATCH, FLG_FCNDEREF, FLG_FIRSTCASE, FLG_SEFPARAMS, FLG_SEFUNSPEC, FLG_MACROSTMT, FLG_MACROPARENS, FLG_MACROCONSTDECL, FLG_MACROFCNDECL, FLG_MACROREDEF, FLG_INFLOOPS, FLG_INFLOOPSUNCON, FLG_UNREACHABLE, FLG_NORETURN, FLG_CASEBREAK, FLG_MISSCASE, FLG_EVALORDER, FLG_USEDEF, FLG_NESTEDEXTERN, /* warn use flags */ FLG_MULTITHREADED, FLG_PORTABILITY, FLG_SUPERUSER, FLG_IMPLEMENTATIONOPTIONAL, FLG_BUFFEROVERFLOWHIGH, /* memchecks flags */ FLG_NULLSTATE, FLG_NULLDEREF, FLG_NULLASSIGN, FLG_NULLPASS, FLG_NULLRET, FLG_ALLOCMISMATCH, FLG_COMPDEF, FLG_COMPMEMPASS, FLG_UNIONDEF, FLG_RETSTACK, /* memtrans flags */ FLG_EXPOSETRANS, FLG_OBSERVERTRANS, FLG_DEPENDENTTRANS, FLG_NEWREFTRANS, FLG_ONLYTRANS, FLG_OWNEDTRANS, FLG_FRESHTRANS, FLG_SHAREDTRANS, FLG_TEMPTRANS, FLG_KEPTTRANS, FLG_REFCOUNTTRANS, FLG_STATICTRANS, FLG_UNKNOWNTRANS, FLG_STATICINITTRANS, FLG_UNKNOWNINITTRANS, FLG_KEEPTRANS, FLG_IMMEDIATETRANS, FLG_ONLYUNQGLOBALTRANS, FLG_USERELEASED, FLG_ALIASUNIQUE, FLG_MAYALIASUNIQUE, FLG_MUSTFREEONLY, FLG_MUSTFREEFRESH, FLG_MUSTDEFINE, FLG_GLOBSTATE, FLG_COMPDESTROY, FLG_MUSTNOTALIAS, FLG_MEMIMPLICIT, FLG_BRANCHSTATE, FLG_NULLPOINTERARITH, FLG_SHADOW, FLG_DEPARRAYS, FLG_REDECL, FLG_READONLYSTRINGS, FLG_READONLYTRANS, FLG_LOOPLOOPBREAK, FLG_SWITCHLOOPBREAK, FLG_MODGLOBS, FLG_CHECKSTRICTGLOBALS, FLG_IMPCHECKEDSPECGLOBALS, FLG_MACROMATCHNAME, FLG_WARNLINTCOMMENTS, FLG_INCLUDENEST, FLG_ISORESERVED, FLG_CPPNAMES, FLG_NOPARAMS, FLG_IFEMPTY, FLG_WHILEEMPTY, FLG_REALCOMPARE, FLG_REALRELATECOMPARE, FLG_BOOLOPS, FLG_SHIFTNEGATIVE, FLG_SHIFTIMPLEMENTATION, FLG_BUFFEROVERFLOWHIGH, FLG_BUFFEROVERFLOW, INVALID_FLAG } ; SETFLAGS (); } else if (cstring_equalLit (s, "strict")) { flagcode modeflags[] = { FLG_ABSTRACTCOMPARE, FLG_CHECKSTRICTGLOBALIAS, FLG_NUMABSTRACTCAST, FLG_CHECKEDGLOBALIAS, FLG_CHECKMODGLOBALIAS, FLG_UNCHECKEDGLOBALIAS, FLG_MODFILESYSTEM, FLG_MACROMATCHNAME, FLG_FORMATCONST, FLG_NUMABSTRACTPRINT, FLG_STRINGLITNOROOM, FLG_STRINGLITNOROOMFINALNULL, FLG_STRINGLITSMALLER, FLG_STATETRANSFER, FLG_STATEMERGE, FLG_MACROUNDEF, FLG_MUTREP, FLG_MUSTMOD, FLG_ALLGLOBALS, FLG_IMPTYPE, FLG_MODNOMODS, FLG_MODGLOBSUNSPEC, FLG_MODSTRICTGLOBSUNSPEC, FLG_GLOBUNSPEC, FLG_SIZEOFTYPE, FLG_EXPORTHEADER, FLG_EXPORTHEADERVAR, FLG_NOPARAMS, FLG_OLDSTYLE, FLG_EXITARG, FLG_RETSTACK, FLG_FCNDEREF, FLG_ONLYUNQGLOBALTRANS, FLG_GLOBALSIMPMODIFIESNOTHING, FLG_PREDBOOLOTHERS, FLG_PREDBOOLPTR, FLG_PREDBOOLINT, FLG_INTERNALGLOBS, FLG_INTERNALGLOBSNOGLOBS, FLG_USEALLGLOBS, FLG_RETALIAS, FLG_MODGLOBS, FLG_MODGLOBSUNSPEC, FLG_MODGLOBSUNCHECKED, FLG_RETEXPOSE, FLG_ASSIGNEXPOSE, FLG_CASTEXPOSE, FLG_NOEFFECTUNCON, FLG_EVALORDERUNCON, FLG_FUNCUNUSED, FLG_EXPORTITER, FLG_EXPORTCONST, FLG_TYPEUNUSED, FLG_FIELDUNUSED, FLG_PARAMUNUSED, FLG_TOPUNUSED, FLG_CONSTUNUSED, FLG_ENUMMEMUNUSED, FLG_VARUNUSED, FLG_NULLPOINTERARITH, FLG_POINTERARITH, FLG_PTRNUMCOMPARE, FLG_BOOLCOMPARE, FLG_UNSIGNEDCOMPARE, FLG_NOEFFECT, FLG_RETVALINT, FLG_RETVALBOOL, FLG_RETVALOTHER, FLG_ISORESERVED, FLG_ISORESERVEDLOCAL, FLG_CPPNAMES, FLG_RETVALBOOL, FLG_RETVALINT, FLG_SPECUNDEF, FLG_DECLUNDEF, FLG_STRICTOPS, FLG_INCONDEFS, FLG_MISPLACEDSHAREQUAL, FLG_REDUNDANTSHAREQUAL, FLG_INCONDEFSLIB, FLG_MATCHFIELDS, FLG_EXPORTMACRO, FLG_EXPORTVAR, FLG_EXPORTFCN, FLG_EXPORTTYPE, FLG_EXPORTLOCAL, FLG_MACROPARAMS, FLG_MACROASSIGN, FLG_SEFPARAMS, FLG_SEFUNSPEC, FLG_MACROSTMT, FLG_MACROPARENS, FLG_MACROFCNDECL, FLG_MACROCONSTDECL, FLG_MACROREDEF, FLG_MACROEMPTY, FLG_INFLOOPS, FLG_INFLOOPSUNCON, FLG_UNREACHABLE, FLG_NORETURN, FLG_CASEBREAK, FLG_MISSCASE, FLG_USEDEF, FLG_EVALORDER, FLG_MODUNCON, FLG_MODUNCONNOMODS, FLG_MODINTERNALSTRICT, FLG_MODOBSERVERUNCON, FLG_NESTEDEXTERN, FLG_FIRSTCASE, /* warn use flags */ FLG_MULTITHREADED, FLG_PORTABILITY, FLG_SUPERUSER, FLG_IMPLEMENTATIONOPTIONAL, FLG_BUFFEROVERFLOWHIGH, FLG_BUFFEROVERFLOW, FLG_TOCTOU, /* memchecks flags */ FLG_NULLSTATE, FLG_NULLDEREF, FLG_NULLASSIGN, FLG_NULLPASS, FLG_NULLRET, FLG_ALLOCMISMATCH, FLG_COMPDEF, FLG_COMPMEMPASS, FLG_UNIONDEF, /* memory checking flags */ FLG_BOUNDSREAD, FLG_BOUNDSWRITE, FLG_LIKELYBOUNDSREAD, FLG_LIKELYBOUNDSWRITE, FLG_CHECKPOST, /* memtrans flags */ FLG_EXPOSETRANS, FLG_OBSERVERTRANS, FLG_DEPENDENTTRANS, FLG_NEWREFTRANS, FLG_ONLYTRANS, FLG_OWNEDTRANS, FLG_FRESHTRANS, FLG_SHAREDTRANS, FLG_TEMPTRANS, FLG_KEPTTRANS, FLG_REFCOUNTTRANS, FLG_STATICTRANS, FLG_UNKNOWNTRANS, FLG_KEEPTRANS, FLG_IMMEDIATETRANS, FLG_STATICINITTRANS, FLG_UNKNOWNINITTRANS, FLG_USERELEASED, FLG_ALIASUNIQUE, FLG_MAYALIASUNIQUE, FLG_MUSTFREEONLY, FLG_MUSTFREEFRESH, FLG_MUSTDEFINE, FLG_GLOBSTATE, FLG_COMPDESTROY, FLG_MUSTNOTALIAS, FLG_MEMIMPLICIT, FLG_BRANCHSTATE, FLG_DECLPARAMNAME, FLG_DECLPARAMMATCH, FLG_SHADOW, FLG_DEPARRAYS, FLG_STRICTDESTROY, FLG_STRICTUSERELEASED, FLG_STRICTBRANCHSTATE, FLG_REDECL, FLG_READONLYSTRINGS, FLG_READONLYTRANS, FLG_LOOPLOOPBREAK, FLG_LOOPSWITCHBREAK, FLG_SWITCHLOOPBREAK, FLG_SWITCHSWITCHBREAK, FLG_LOOPLOOPCONTINUE, FLG_CHECKSTRICTGLOBALS, FLG_IMPCHECKEDSPECGLOBALS, FLG_ALLGLOBALS, FLG_IMPCHECKEDSTRICTGLOBALS, FLG_IMPCHECKEDSTRICTSTATICS, FLG_IMPCHECKEDSTRICTSPECGLOBALS, FLG_IMPCHECKMODINTERNALS, FLG_WARNMISSINGGLOBALS, FLG_WARNMISSINGGLOBALSNOGLOBS, FLG_WARNLINTCOMMENTS, FLG_ISORESERVEDLOCAL, FLG_INCLUDENEST, FLG_STRINGLITERALLEN, FLG_NUMSTRUCTFIELDS, FLG_NUMENUMMEMBERS, FLG_CONTROLNESTDEPTH, FLG_FORBLOCK, FLG_WHILEBLOCK, FLG_FOREMPTY, FLG_WHILEEMPTY, FLG_IFEMPTY, FLG_IFBLOCK, FLG_ELSEIFCOMPLETE, FLG_REALCOMPARE, FLG_BOOLOPS, FLG_REALRELATECOMPARE, FLG_SYSTEMDIRERRORS, FLG_UNUSEDSPECIAL, FLG_SHIFTNEGATIVE, FLG_SHIFTIMPLEMENTATION, FLG_BITWISEOPS, FLG_BUFFEROVERFLOWHIGH, FLG_BUFFEROVERFLOW, INVALID_FLAG } ; SETFLAGS (); } else { llcontbug (message ("context_setMode: bad mode: %s", s)); } } bool context_isSpecialFile (cstring fname) { cstring ext = fileLib_getExtension (fname); return (cstring_equalLit (ext, ".y") || cstring_equalLit (ext, ".l") || cstring_equalLit (fname, "lex.yy.c")); } bool context_isSystemDir (cstring dir) { cstring thisdir = cstring_copy (context_getString (FLG_SYSTEMDIRS)); cstring savedir = thisdir; cstring nextdir = cstring_afterChar (thisdir, PATH_SEPARATOR); if (cstring_isDefined (nextdir)) { /*@access cstring@*/ *nextdir = '\0'; /* closes thisdir */ nextdir += 1; /*@noaccess cstring@*/ } /* 2001-09-09: added thisdir[0] != '\0' ** herbert: don't compare with an empty name! ** should return false for empty directory path */ while (!cstring_isEmpty (thisdir)) { DPRINTF (("Test: %s / %s", dir, thisdir)); if (osd_equalCanonicalPrefix (dir, thisdir)) { cstring_free (savedir); return TRUE; } if (cstring_isDefined (nextdir)) { thisdir = nextdir; nextdir = cstring_afterChar (thisdir, PATH_SEPARATOR); if (cstring_isDefined (nextdir)) { /*@access cstring@*/ *nextdir = '\0'; nextdir += 1; /*@noaccess cstring@*/ } } else { break; } } DPRINTF (("Returns FALSE")); cstring_free (savedir); return FALSE; } void context_addFileAccessType (typeId t) { cstring base; if (context_inFunctionLike ()) { gc.acct = typeIdSet_insert (gc.acct, t); } gc.facct = typeIdSet_insert (gc.facct, t); base = fileloc_getBase (g_currentloc); insertModuleAccess (base, t); DPRINTF (("Add file access: %s / %s", typeIdSet_unparse (gc.facct), typeIdSet_unparse (gc.acct))); } void context_removeFileAccessType (typeId t) { if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN || gc.kind == CX_UNKNOWNMACRO) { gc.acct = typeIdSet_removeFresh (gc.acct, t); } gc.facct = typeIdSet_removeFresh (gc.facct, t); gc.nacct = typeIdSet_insert (gc.nacct, t); } void context_enterFunctionHeader (void) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Enter function header: %q", context_unparse ())); } if (gc.kind != CX_GLOBAL) { llparseerror (cstring_makeLiteral ("Likely parse error. Function header outside global context.")); } else { llassert (gc.kind == CX_GLOBAL); DPRINTF (("Enter function header!")); gc.inFunctionHeader = TRUE; } } void context_exitFunctionHeader (void) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Exit function header: %q", context_unparse ())); } DPRINTF (("Exit function header!")); gc.inFunctionHeader = FALSE; } bool context_inFunctionHeader (void) { return (gc.inFunctionHeader); } void context_enterFunctionDeclaration (uentry e) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Enter function declaration: %q", context_unparse ())); } DPRINTF (("Enter function decl")); llassert (gc.savekind == CX_ERROR); gc.savekind = gc.kind; gc.savecont = gc.cont; gc.kind = CX_FCNDECLARATION; gc.cont.fcn = e; } void context_exitFunctionDeclaration (void) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Exit function declaration: %q", context_unparse ())); } DPRINTF (("Exit function decl")); llassert (gc.savekind != CX_ERROR); llassert (gc.kind == CX_FCNDECLARATION); gc.kind = gc.savekind; gc.cont = gc.savecont; gc.savekind = CX_ERROR; if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("After exit function declaration: %q", context_unparse ())); } } bool context_inFunctionDeclaration (void) { return (gc.kind == CX_FCNDECLARATION); } void context_enterMacro (/*@observer@*/ uentry e) { context_enterFunction (e); gc.kind = CX_MACROFCN; } void context_enterUnknownMacro (/*@dependent@*/ uentry e) { llassert (uentry_isFunction (e)); context_enterFunction (e); gc.kind = CX_UNKNOWNMACRO; } void context_enterAndClause (exprNode e) { DPRINTF (("enter and clause: %s", exprNode_unparse (e))); usymtab_trueBranch (guardSet_copy (exprNode_getGuards (e))); pushClause (ANDCLAUSE); } void context_enterOrClause (exprNode e) { usymtab_trueBranch (guardSet_invert (exprNode_getGuards (e))); pushClause (ORCLAUSE); } bool context_inDeepLoop (void) { bool inLoop = FALSE; clauseStack_elements (gc.clauses, el) { if (clause_isLoop (el)) { if (inLoop) { return TRUE; } inLoop = TRUE; } } end_clauseStack_elements; return FALSE; } bool context_inDeepSwitch (void) { bool inLoop = FALSE; clauseStack_elements (gc.clauses, el) { if (clause_isSwitch (el)) { if (inLoop) { return TRUE; } inLoop = TRUE; } } end_clauseStack_elements; return FALSE; } bool context_inDeepLoopSwitch (void) { bool inLoop = FALSE; clauseStack_elements (gc.clauses, el) { if (clause_isBreakable (el)) { if (inLoop) { return TRUE; } inLoop = TRUE; } } end_clauseStack_elements; return FALSE; } clause context_breakClause (void) { clauseStack_elements (gc.clauses, el) { if (clause_isSwitch (el)) { return el; } else if (clause_isLoop (el)) { return el; } else { ; } } end_clauseStack_elements; return NOCLAUSE; } clause context_nextBreakClause (void) { bool hasOne = FALSE; clauseStack_elements (gc.clauses, el) { if (clause_isBreakable (el)) { if (hasOne) { return el; } else { hasOne = TRUE; } } } end_clauseStack_elements; return NOCLAUSE; } bool context_inConditional (void) { clauseStack_elements (gc.clauses, el) { /* ** Should also include TRUECLAUSE and FALSECLAUSE, but need ** to distinguish if from ? for this */ if (clause_isBreakable (el) && (el != DOWHILECLAUSE)) { return TRUE; } } end_clauseStack_elements; return FALSE; } void context_exitAndClause (exprNode pred, exprNode tbranch) { context_setJustPopped (); llassert (gc.inclause == ANDCLAUSE); usymtab_popAndBranch (pred, tbranch); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } void context_exitOrClause (exprNode pred, exprNode tbranch) { context_setJustPopped (); llassert (gc.inclause == ORCLAUSE); usymtab_popOrBranch (pred, tbranch); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } static void context_enterCondClauseAux (clause cl) /*@modifies gc@*/ { pushClause (cl); } static void context_enterTrueAux (exprNode e, clause cl) /*@modifies gc@*/ { usymtab_trueBranch (guardSet_copy (exprNode_getGuards (e))); pushClause (cl); } void context_enterIterClause (void) { context_enterTrueAux (exprNode_undefined, ITERCLAUSE); } void context_enterDoWhileClause (void) { pushClause (DOWHILECLAUSE); } void context_enterWhileClause (exprNode e) { context_enterTrueAux (e, WHILECLAUSE); } void context_enterForClause (exprNode e) { context_enterTrueAux (e, FORCLAUSE); } void context_enterTrueClause (exprNode e) { context_enterTrueAux (e, TRUECLAUSE); } void context_enterSwitch (exprNode e) { DPRINTF (("Enter switch: %s", exprNode_unparse (e))); usymtab_switchBranch (e); context_enterCondClauseAux (SWITCHCLAUSE); } void context_exitSwitch (exprNode e, bool allpaths) { usymtab_exitSwitch (e, allpaths); while (clause_isCase (clauseStack_top (gc.clauses))) { clauseStack_pop (gc.clauses); } context_exitClauseSimp (); } void context_enterCaseClause (exprNode e) { bool branch = FALSE; DPRINTF (("Enter case clause!")); branch = usymtab_newCase (exprNode_undefined, e); if (branch) { context_enterCondClauseAux (CASECLAUSE); } } static void context_enterFalseClauseAux (exprNode e, clause cl) /*@modifies gc@*/ { usymtab_altBranch (guardSet_invert (exprNode_getGuards (e))); gc.inclause = cl; clauseStack_switchTop (gc.clauses, cl); } void context_enterFalseClause (exprNode e) { context_enterFalseClauseAux (e, FALSECLAUSE); } void context_enterConstantMacro (/*@exposed@*/ /*@dependent@*/ uentry e) { gc.kind = CX_MACROCONST; gc.cont.fcn = e; gc.showfunction = context_getFlag (FLG_SHOWFUNC); gc.acct = typeIdSet_subtract (typeIdSet_union (gc.facct, uentry_accessType (e)), gc.nacct); usymtab_enterScope (); sRef_enterFunctionScope (); gc.globs = globSet_undefined; globSet_clear (gc.globs_used); gc.mods = sRefSet_undefined; } uentry context_getHeader (void) { if (!(context_inFunctionLike () || (gc.kind == CX_MACROCONST))) { llfatalbug (message ("context_getHeader: bad call: %q", context_unparse ())); } return (gc.cont.fcn); } void context_setFunctionDefined (fileloc loc) { switch (gc.kind) { case CX_UNKNOWNMACRO: case CX_FUNCTION: case CX_MACROFCN: uentry_setFunctionDefined (gc.cont.fcn, loc); break; default: /* (not a bug because of parse errors) */ break; } } void context_enterFunction (/*@exposed@*/ uentry e) { gc.kind = CX_FUNCTION; gc.cont.fcn = e; DPRINTF (("Enter function: %s", uentry_unparse (e))); if (uentry_hasAccessType (e)) { gc.acct = typeIdSet_subtract (typeIdSet_union (gc.facct, uentry_accessType (e)), gc.nacct); } else { gc.acct = gc.facct; } DPRINTF (("Enter function: %s / %s", uentry_unparse (e), typeIdSet_unparse (gc.acct))); gc.showfunction = context_getFlag (FLG_SHOWFUNC); gc.globs = uentry_getGlobs (e); globSet_clear (gc.globs_used); gc.mods = uentry_getMods (e); usymtab_enterFunctionScope (e); sRef_enterFunctionScope (); } bool context_inOldStyleScope(void) { return (gc.kind == CX_OLDSTYLESCOPE); } void context_enterOldStyleScope (void) { gc.kind = CX_OLDSTYLESCOPE; DPRINTF (("Enter old style scope!")); usymtab_enterFunctionScope (uentry_undefined); } void context_completeOldStyleFunction (uentry e) { llassert (gc.kind == CX_OLDSTYLESCOPE); gc.kind = CX_FUNCTION; gc.cont.fcn = e; DPRINTF (("Enter function: %s", uentry_unparse (e))); if (uentry_hasAccessType (e)) { gc.acct = typeIdSet_subtract (typeIdSet_union (gc.facct, uentry_accessType (e)), gc.nacct); } else { gc.acct = gc.facct; } DPRINTF (("Enter function: %s / %s", uentry_unparse (e), typeIdSet_unparse (gc.acct))); gc.showfunction = context_getFlag (FLG_SHOWFUNC); if (!globSet_isEmpty (uentry_getGlobs (e))) { llfatalerror (message ("%q: Old-style function declaration uses a clause (rewrite with function parameters): %q", fileloc_unparse (g_currentloc), uentry_unparse (e))); } gc.showfunction = context_getFlag (FLG_SHOWFUNC); gc.globs = uentry_getGlobs (e); globSet_clear (gc.globs_used); gc.mods = uentry_getMods (e); if (!sRefSet_isEmpty (gc.mods)) { llfatalerror (message ("%q: Old-style function declaration uses a clause (rewrite with function parameters): %q", fileloc_unparse (g_currentloc), uentry_unparse (e))); } sRef_enterFunctionScope (); } static bool context_checkStrictGlobals (void) { return (context_getFlag (FLG_CHECKSTRICTGLOBALS)); } static bool context_hasGlobs (void) { if (context_inFunctionLike ()) { return (uentry_hasGlobs (gc.cont.fcn)); } else { return (FALSE); } } static bool context_checkCheckedGlobals (void) { return (context_getFlag (FLG_GLOBALS) && (context_getFlag (FLG_GLOBUNSPEC) || context_hasGlobs ())); } static bool context_checkUnknownGlobals (void) { /* should be uentry_hasGlobs ? */ return (context_getFlag (FLG_ALLGLOBALS) && (context_getFlag (FLG_GLOBUNSPEC) || context_hasGlobs ())); } static bool context_checkUncheckedGlobals (void) { return (FALSE); } bool context_checkExport (uentry e) { if (!gc.anyExports) return FALSE; if (uentry_isFunction (e) || (uentry_isVariable (e) && ctype_isFunction (uentry_getType (e)))) { return context_maybeSet (FLG_EXPORTFCN); } else if (uentry_isExpandedMacro (e)) { return context_maybeSet (FLG_EXPORTMACRO); } else if (uentry_isVariable (e)) { return context_maybeSet (FLG_EXPORTVAR); } else if (uentry_isEitherConstant (e)) { return context_maybeSet (FLG_EXPORTCONST); } else if (uentry_isIter (e) || uentry_isEndIter (e)) { return context_maybeSet (FLG_EXPORTITER); } else if (uentry_isDatatype (e)) { return context_maybeSet (FLG_EXPORTTYPE); } else { BADEXIT; } } bool context_checkGlobUse (uentry glob) { if (uentry_isCheckedStrict (glob)) { return context_checkStrictGlobals (); } else if (uentry_isChecked (glob)) { return context_checkCheckedGlobals (); } else if (uentry_isCheckedUnknown (glob) || uentry_isCheckMod (glob)) { return context_checkUnknownGlobals (); } else { llassert (uentry_isUnchecked (glob)); return context_checkUncheckedGlobals (); } } bool context_checkAliasGlob (uentry glob) { if (uentry_isCheckedStrict (glob)) { return gc.flags[FLG_CHECKSTRICTGLOBALIAS]; } else if (uentry_isChecked (glob)) { return gc.flags[FLG_CHECKEDGLOBALIAS]; } else if (uentry_isCheckMod (glob)) { return gc.flags[FLG_CHECKMODGLOBALIAS]; } else { llassert (uentry_isUnchecked (glob) || uentry_isCheckedUnknown (glob)); return gc.flags[FLG_UNCHECKEDGLOBALIAS]; } } bool context_checkInternalUse (void) { if (context_hasGlobs ()) { return (gc.flags[FLG_INTERNALGLOBS]); } else { return (gc.flags[FLG_INTERNALGLOBSNOGLOBS]); } } bool context_checkGlobMod (sRef el) { uentry ue = sRef_getUentry (el); /* no: llassert (sRef_isFileOrGlobalScope (el)); also check local statics */ if (uentry_isCheckedModify (ue) || (!uentry_isUnchecked (ue) && (gc.flags[FLG_ALLGLOBALS]))) { if (context_hasMods ()) { return (gc.flags[FLG_MODGLOBS]); } else { if (uentry_isCheckedStrict (ue)) { return (gc.flags[FLG_MODGLOBSUNSPEC]); } else { return (gc.flags[FLG_MODSTRICTGLOBSUNSPEC]); } } } else { if (context_hasMods ()) { return (gc.flags[FLG_MODGLOBSUNCHECKED]); } else { return FALSE; } } } void context_usedGlobal (/*@exposed@*/ sRef el) { if (!globSet_member (gc.globs_used, el)) { /* ** The first time a global is used in a function, we need ** to clear the derived sRefs, since they were set for the ** previous function. */ sRef_clearDerived (el); gc.globs_used = globSet_insert (gc.globs_used, el); } } /*@observer@*/ sRefSet context_modList (void) { return gc.mods; } bool context_globAccess (sRef s) { llassert (sRef_isFileOrGlobalScope (s) || sRef_isKindSpecial (s)); return (globSet_member (gc.globs, s)); } bool context_hasAccess (typeId t) { if (context_inFunctionLike ()) { DPRINTF (("Access %d / %s", t, typeIdSet_unparse (gc.acct))); return (typeIdSet_member (gc.acct, t)); } else { return (context_hasFileAccess (t)); } } bool context_hasFileAccess (typeId t) { return (typeIdSet_member (gc.facct, t)); } /*@only@*/ cstring context_unparseAccess (void) { return (message ("%q / %q", typeIdSet_unparse (gc.acct), typeIdSet_unparse (gc.facct))); } /*@only@*/ cstring context_unparseClauses (void) { return (clauseStack_unparse (gc.clauses)); } bool context_couldHaveAccess (typeId t) { if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN || gc.kind == CX_UNKNOWNMACRO) { return (typeIdSet_member (gc.acct, t)); } else { return (typeIdSet_member (gc.facct, t)); } } ctype context_getRetType (void) { ctype f = ctype_undefined; if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN) { f = uentry_getType (gc.cont.fcn); } else if (gc.kind == CX_UNKNOWNMACRO) { return ctype_unknown; } else { llcontbuglit ("context_getRetType: not in a function context"); return ctype_unknown; } if (!ctype_isFunction (f)) { if (ctype_isKnown (f)) { llbuglit ("context_getRetType: not a function"); } return ctype_unknown; } return (ctype_getReturnType (f)); } bool context_hasMods (void) { if (context_inFunctionLike ()) { return (uentry_hasMods (gc.cont.fcn)); } else { return FALSE; } } void context_exitAllClauses (void) { while (!clauseStack_isEmpty (gc.clauses)) { clause el = clauseStack_top (gc.clauses); gc.inclause = el; if (clause_isNone (el)) { usymtab_quietExitScope (g_currentloc); clauseStack_pop (gc.clauses); } else { context_exitClausePlain (); } } clauseStack_clear (gc.clauses); gc.inclause = NOCLAUSE; } void context_exitAllClausesQuiet (void) { while (!clauseStack_isEmpty (gc.clauses)) { clause el = clauseStack_top (gc.clauses); gc.inclause = el; usymtab_quietExitScope (g_currentloc); clauseStack_pop (gc.clauses); } clauseStack_clear (gc.clauses); gc.inclause = NOCLAUSE; } static void context_exitClauseSimp (void) { context_setJustPopped (); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } static void context_exitCaseClause (void) { context_setJustPopped (); usymtab_popCaseBranch (); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } static void context_exitClauseAux (exprNode pred, exprNode tbranch) { context_setJustPopped (); usymtab_popTrueBranch (pred, tbranch, gc.inclause); /* evans 2003-02-02?: was makeAlt */ clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } void context_exitTrueClause (exprNode pred, exprNode tbranch) { DPRINTF (("Exit true clause: %s", exprNode_unparse (tbranch))); if (gc.inclause != TRUECLAUSE) { llparseerror (cstring_makeLiteral ("Likely parse error. Conditional clauses are inconsistent.")); return; } context_setJustPopped (); usymtab_popTrueBranch (pred, tbranch, TRUECLAUSE); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } void context_exitIterClause (exprNode body) { llassert (gc.inclause == ITERCLAUSE); context_setJustPopped (); if (context_getFlag (FLG_ITERLOOPEXEC)) { usymtab_popTrueExecBranch (exprNode_undefined, body, ITERCLAUSE); } else { usymtab_popTrueBranch (exprNode_undefined, body, ITERCLAUSE); } clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } static void context_popCase (void) { /* ** If we are exiting an outer clause, sometimes still in a switch case. ** ** e.g.: ** ** switch(a) ** { ** case 1: ** while (c>3) ** { ** case 3: ++c; ** } ** } */ DPRINTF (("Popping case clause: %s", clauseStack_unparse (gc.clauses))); if (gc.inclause == CASECLAUSE) { context_exitCaseClause (); } } void context_exitWhileClause (exprNode pred, exprNode body) { guardSet invGuards = guardSet_invert (exprNode_getGuards (pred)); context_popCase (); if (gc.inclause != WHILECLAUSE) { DPRINTF (("Clause: %s / %s", clause_unparse (gc.inclause), clauseStack_unparse (gc.clauses))); } llassert (gc.inclause == WHILECLAUSE); context_setJustPopped (); /* ** predicate must be false after while loop (unless there are breaks) */ if (context_getFlag (FLG_WHILELOOPEXEC)) { usymtab_popTrueExecBranch (pred, body, WHILECLAUSE); } else { usymtab_popTrueBranch (pred, body, WHILECLAUSE); } usymtab_addGuards (invGuards); guardSet_free (invGuards); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } void context_exitDoWhileClause (exprNode pred) { guardSet invGuards = guardSet_invert (exprNode_getGuards (pred)); if (gc.inclause == CASECLAUSE) { /* handle Duff's device */ clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } llassert (gc.inclause == DOWHILECLAUSE); context_setJustPopped (); usymtab_addGuards (invGuards); guardSet_free (invGuards); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } void context_exitForClause (exprNode forPred, exprNode body) { guardSet invGuards = guardSet_invert (exprNode_getForGuards (forPred)); llassert (gc.inclause == FORCLAUSE); context_setJustPopped (); DPRINTF (("Exit for: %s / %s", exprNode_unparse (forPred), exprNode_unparse (body))); /* ** Predicate must be false after for loop (unless there are breaks) */ if (context_getFlag (FLG_FORLOOPEXEC)) { DPRINTF (("Here: for loop exec")); usymtab_popTrueExecBranch (forPred, body, FORCLAUSE); } else { if (context_getFlag (FLG_OBVIOUSLOOPEXEC) && exprNode_loopMustExec (forPred)) { DPRINTF (("Here: loop must exec")); usymtab_popTrueExecBranch (forPred, body, FORCLAUSE); } else { DPRINTF (("Pop true branch:")); usymtab_popTrueBranch (forPred, body, FORCLAUSE); } } usymtab_addGuards (invGuards); guardSet_free (invGuards); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } static void context_exitClausePlain (void) { llassert (gc.inclause != NOCLAUSE); if (gc.inclause == FALSECLAUSE) { context_exitClause (exprNode_undefined, exprNode_undefined, exprNode_undefined); } else { context_exitClauseAux (exprNode_undefined, exprNode_undefined); } } void context_exitClause (exprNode pred, exprNode tbranch, exprNode fbranch) { context_setJustPopped (); if (gc.inclause == FALSECLAUSE) { usymtab_popBranches (pred, tbranch, fbranch, FALSE, FALSECLAUSE); llassert (clauseStack_top (gc.clauses) == FALSECLAUSE); clauseStack_pop (gc.clauses); gc.inclause = topClause (gc.clauses); } else { context_exitTrueClause (pred, tbranch); } } void context_returnFunction (void) { usymtab_checkFinalScope (TRUE); } void context_exitFunction (void) { DPRINTF (("Exit function: %s", context_unparse ())); if (!context_inFunction () && !context_inMacroConstant () && !context_inUnknownMacro () && !context_inIterDef () && !context_inIterEnd ()) { /* ** not a bug because of parse errors */ BADBRANCH; } else { if (context_inMacro () && usymtab_inFunctionScope ()) { usymtab_exitScope (exprNode_undefined); } if (uentry_hasGlobs (gc.cont.fcn)) { exprChecks_checkUsedGlobs (gc.globs, gc.globs_used); } if (uentry_hasMods (gc.cont.fcn)) { if (context_getFlag (FLG_MUSTMOD)) { exprNode_checkAllMods (gc.mods, gc.cont.fcn); } } DPRINTF (("Exit function: %s", uentry_unparse (gc.cont.fcn))); /* ** clear file static modifies */ /* do this first to get unused error messages */ usymtab_exitScope (exprNode_undefined); sRef_exitFunctionScope (); gc.showfunction = FALSE; gc.kind = CX_GLOBAL; gc.cont.glob = TRUE; gc.acct = gc.facct; gc.globs = globSet_new (); globSet_clear (gc.globs_used); gc.mods = sRefSet_new (); } llassert (clauseStack_isEmpty (gc.clauses)); llassert (gc.inclause == NOCLAUSE); DPRINTF (("After exit function: %s", context_unparse ())); } void context_quietExitFunction (void) { while (gc.kind == CX_INNER) { context_exitInnerPlain (); } if (!context_inFunction () && !context_inMacroConstant () && !context_inUnknownMacro () && !context_inIterDef () && !context_inIterEnd ()) { } else { usymtab_quietExitScope (g_currentloc); gc.showfunction = FALSE; gc.kind = CX_GLOBAL; gc.cont.glob = TRUE; gc.acct = gc.facct; gc.globs = globSet_new (); globSet_clear (gc.globs_used); gc.mods = sRefSet_new (); sRef_exitFunctionScope (); } } /*@observer@*/ uentryList context_getParams (void) { if (context_inFunctionLike ()) { return (uentry_getParams (gc.cont.fcn)); } else { llcontbug (message ("context_getParams: not in function: %q", context_unparse ())); return uentryList_undefined; } } /*@observer@*/ globSet context_getUsedGlobs (void) { llassert (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_ITERDEF); return (gc.globs_used); } cstring context_moduleName () { return (fileloc_getBase (g_currentloc)); } /*@observer@*/ globSet context_getGlobs (void) { llassert (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_ITERDEF); return (gc.globs); } void context_addBoolAccess (void) { cstring bname = context_getString (FLG_BOOLTYPE); typeIdSet boolt = typeIdSet_single (usymtab_getTypeId (bname)); addModuleAccess (cstring_copy (bname), boolt); /* for sys/types (perhaps, this is bogus!) */ addModuleAccess (cstring_makeLiteral ("types"), boolt); } # if 0 bool context_canAccessBool (void) { return TRUE; } # endif /* static typeId boolType = typeId_invalid; if (typeId_isInvalid (boolType)) { boolType = usymtab_getTypeId (context_getBoolName ()); } if (typeId_isInvalid (boolType)) { return FALSE; } else { return (typeIdSet_member (gc.acct, boolType)); } } */ /* evs 2000-07-25: old version - replaced */ ctype context_boolImplementationType () { /* For now, this is bogus! */ return ctype_int; } bool context_canAccessBool (void) { static typeId boolType = typeId_invalid; if (typeId_isInvalid (boolType)) { boolType = usymtab_getTypeId (context_getBoolName ()); } if (!typeId_isInvalid (boolType)) { return context_hasAccess (boolType); } else { ; } return FALSE; } void context_setMessageAnnote (/*@only@*/ cstring s) { llassert (cstring_isUndefined (gc.msgAnnote)); gc.msgAnnote = s; } bool context_hasMessageAnnote (void) { return (cstring_isDefined (gc.msgAnnote)); } void context_clearMessageAnnote (void) { if (cstring_isDefined (gc.msgAnnote)) { cstring_free (gc.msgAnnote); gc.msgAnnote = cstring_undefined; } } /*@only@*/ cstring context_getMessageAnnote (void) { cstring st = gc.msgAnnote; gc.msgAnnote = cstring_undefined; return st; } void context_setAliasAnnote (/*@observer@*/ sRef s, /*@observer@*/ sRef t) { llassert (sRef_isInvalid (gc.aliasAnnote)); llassert (!sRef_sameName (s, t)); gc.aliasAnnote = s; gc.aliasAnnoteAls = t; } bool context_hasAliasAnnote (void) { return (sRef_isValid (gc.aliasAnnote)); } void context_clearAliasAnnote (void) { gc.aliasAnnote = sRef_undefined; } cstring context_getAliasAnnote (void) { sRef ret = gc.aliasAnnote; sRef als = gc.aliasAnnoteAls; llassert (sRef_isValid (ret) && sRef_isValid (als)); gc.aliasAnnote = sRef_undefined; return (message ("%q aliases %q", sRef_unparse (als), sRef_unparse (ret))); } void context_recordFileModifies (sRefSet mods) { gc.modrecs = sRefSetList_add (gc.modrecs, mods); } void context_recordFileGlobals (globSet mods) { DPRINTF (("Recording file globals: %s", globSet_unparse (mods))); /*@access globSet@*/ context_recordFileModifies (mods); /*@noaccess globSet@*/ } void context_setCommentMarkerChar (char c) { llassert (c != '\0'); context_setValue (FLG_COMMENTCHAR, (int) c); } char context_getCommentMarkerChar (void) { return ((char) context_getValue (FLG_COMMENTCHAR)); } static void context_setValue (flagcode flag, int val) { int index = flagcode_valueIndex (flag); llassert (index >= 0 && index <= NUMVALUEFLAGS); switch (flag) { case FLG_LINELEN: if (val <= 0) { llerror_flagWarning (message ("Value for %s must be a positive " "number (given %d)", flagcode_unparse (flag), val)); return; } if (flag == FLG_LINELEN && val < MINLINELEN) { llerror_flagWarning (message ("Value for %s must be at least %d (given %d)", flagcode_unparse (flag), MINLINELEN, val)); val = MINLINELEN; } break; case FLG_INCLUDENEST: case FLG_CONTROLNESTDEPTH: case FLG_STRINGLITERALLEN: case FLG_NUMSTRUCTFIELDS: case FLG_NUMENUMMEMBERS: case FLG_INDENTSPACES: if (val < 0) { llerror_flagWarning (message ("Value for %s must be a non-negative " "number (given %d)", flagcode_unparse (flag), val)); return; } break; default: break; } DPRINTF (("Set value [%s] %d = %d", flagcode_unparse (flag), index, val)); gc.values[index] = val; } void context_setValueAndFlag (flagcode flag, int val) { gc.flags[flag] = TRUE; context_setValue (flag, val); } int context_getValue (flagcode flag) { int index = flagcode_valueIndex (flag); llassert (index >= 0 && index <= NUMVALUEFLAGS); DPRINTF (("Get value [%s] %d = %d", flagcode_unparse (flag), index, gc.values[index])); return (gc.values[index]); } int context_getCounter (flagcode flag) { int index = flagcode_valueIndex (flag); llassert (index >= 0 && index <= NUMVALUEFLAGS); return (gc.counters[index]); } void context_incCounter (flagcode flag) { int index = flagcode_valueIndex (flag); llassert (index >= 0 && index <= NUMVALUEFLAGS); /* check limit */ gc.counters[index]++; } void context_decCounter (flagcode flag) { int index = flagcode_valueIndex (flag); llassert (index >= 0 && index <= NUMVALUEFLAGS); gc.counters[index]--; } bool context_showFunction (void) { return (gc.showfunction); } void context_setString (flagcode flag, cstring val) { int index = flagcode_stringIndex (flag); llassert (index >= 0 && index <= NUMSTRINGFLAGS); DPRINTF (("set string: %s", flagcode_unparse (flag))); switch (flag) { case FLG_MESSAGESTREAM: case FLG_WARNINGSTREAM: case FLG_ERRORSTREAM: { if (cstring_isDefined (val)) { FILE *fstream; if (osd_fileExists (val)) { if (context_getFlag (FLG_STREAMOVERWRITE)) { llfatalerror (message ("Output stream file %s would overwrite existing file. " "Use -streamoverwrite if you want to allow this.", val)); } } fstream = fopen (cstring_toCharsSafe (val), "w"); if (fstream == NULL) { llfatalerror (message ("Unable to open output stream file %s for writing", val)); } /* ** This ensures fstream will be closed on exit. */ fileTable_addStreamFile (gc.ftab, fstream, cstring_copy (val)); switch (flag) { case FLG_MESSAGESTREAM: g_messagestream = fstream; /*@innerbreak@*/ break; case FLG_WARNINGSTREAM: g_warningstream = fstream; /*@innerbreak@*/ break; case FLG_ERRORSTREAM: g_errorstream = fstream; /*@innerbreak@*/ break; BADDEFAULT; } /*@-statetransfer@*/ } /*@=statetransfer@*/ /* fstream not closed, but will be on exit */ break; } case FLG_SYSTEMDIRS: { llassert (cstring_isDefined (val)); if (cstring_firstChar (val) == '\"') { cstring oval = val; cstring tval = cstring_copy (cstring_suffix (val, 1)); if (cstring_lastChar (tval) != '\"') { int n = size_toInt (cstring_length (tval) - 1); while (isspace ((int) cstring_getChar (tval, size_fromInt (n)))) { n--; } if (cstring_getChar (tval, size_fromInt (n)) != '\"') { llerror_flagWarning (message ("Setting -systemdirs to string with unmatching quotes: %s", val)); } else { cstring otval = tval; tval = cstring_prefix (tval, size_fromInt (n)); cstring_free (otval); } } val = cstring_copy (cstring_clip (tval, cstring_length (tval) - 1)); DPRINTF (("val = %s", val)); cstring_free (tval); cstring_free (oval); } break; } case FLG_TMPDIR: { llassert (cstring_isDefined (val)); if (cstring_length (val) == 0) { cstring_free (val); val = message (".%s", cstring_makeLiteralTemp (CONNECTSTR)); } else if (cstring_lastChar (val) != CONNECTCHAR) { val = cstring_appendChar (val, CONNECTCHAR); } else { ; } break; } default: { ; /* Okay not handle everything in this switch */ } /*@-branchstate@*/ } /* evans 2002-03-24: splintme reports a spurious (I think) warning here...need to look into it */ /*@=branchstate@*/ if (cstring_length (val) >= 1 && cstring_firstChar (val) == '\"') { llerror_flagWarning (message ("Setting %s to string beginning with \". You probably " "don't meant to have the \"'s.", flagcode_unparse (flag))); } gc.strings[index] = val; } static /*@exposed@*/ cstring context_exposeString (flagcode flag) { int index = flagcode_stringIndex (flag); llassert (index >= 0 && index <= NUMSTRINGFLAGS); return (gc.strings[index]); } cstring context_getString (flagcode flag) { return (context_exposeString (flag)); } void context_resetErrors (void) { gc.numerrors = 0; } void context_recordBug (void) { gc.numbugs++; } int context_numBugs (void) { return gc.numbugs; } void context_initMod (void) /*@globals undef gc; @*/ { gc.kind = CX_GLOBAL; gc.savekind = CX_ERROR; gc.savecont.glob = FALSE; gc.instandardlib = FALSE; gc.numerrors = 0; gc.numbugs = 0; gc.neednl = FALSE; gc.linesprocessed = 0; gc.speclinesprocessed = 0; gc.insuppressregion = FALSE; gc.macroMissingParams = FALSE; gc.preprocessing = FALSE; gc.incommandline = FALSE; gc.mc = macrocache_create (); gc.nmods = 0; gc.maxmods = DEFAULTMAXMODS; gc.moduleaccess = (maccesst *) dmalloc (sizeof (*gc.moduleaccess) * (gc.maxmods)); gc.library = FLG_ANSILIB; gc.locstack = filelocStack_new (); gc.modrecs = sRefSetList_undefined; gc.anyExports = FALSE; gc.ftab = fileTable_create (); gc.msgLog = messageLog_new (); gc.inimport = FALSE; gc.inDerivedFile = FALSE; gc.inheader = FALSE; gc.markers = flagMarkerList_new (); gc.cont.glob = TRUE; gc.showfunction = FALSE; gc.msgAnnote = cstring_undefined; gc.aliasAnnote = sRef_undefined; gc.aliasAnnoteAls = sRef_undefined; gc.boolType = ctype_bool; gc.mods = sRefSet_new (); gc.saveloc = fileloc_undefined; gc.inmacrocache = FALSE; gc.inclause = NOCLAUSE; gc.clauses = clauseStack_new (); gc.globs = globSet_new (); gc.nacct = typeIdSet_emptySet (); gc.acct = typeIdSet_emptySet (); gc.facct = typeIdSet_emptySet (); gc.savedFlags = FALSE; gc.pushloc = fileloc_undefined; gc.protectVars = FALSE; gc.justpopped = FALSE; gc.isNullGuarded = NO; gc.globs_used = globSet_undefined; allFlagCodes (code) { gc.setGlobally[code] = FALSE; gc.setLocally[code] = FALSE; } end_allFlagCodes ; usymtab_initMod (); context_resetAllFlags (); assertSet (gc.flags); /* Can't use global in defines */ assertSet (gc.saveflags); assertSet (gc.values); assertSet (gc.strings); conext_resetAllCounters (); assertSet (gc.counters); context_setMode (DEFAULT_MODE); gc.stateTable = metaStateTable_create (); gc.annotTable = annotationTable_create (); gc.inFunctionHeader = FALSE; DPRINTF (("Annotations: \n%s", cstring_toCharsSafe (annotationTable_unparse (gc.annotTable)))); DPRINTF (("State: \n%s", cstring_toCharsSafe (metaStateTable_unparse (gc.stateTable)))); } ctype context_typeofZero (void) { ctype ct = ctype_int; if (context_getFlag (FLG_ZEROPTR)) { ct = ctype_makeConj (ct, ctype_voidPointer); } if (context_getFlag (FLG_ZEROBOOL)) { ct = ctype_makeConj (ct, ctype_bool); } return ct; } ctype context_typeofOne (void) { ctype ct = ctype_int; /* 1 is on longer a bool (was before 2.4) if (!context_getFlag (FLG_ABSTRACTBOOL)) { ct = ctype_makeConj (ct, ctype_bool); } */ return (ct); } /*@only@*/ cstring context_unparse (void) { cstring s; switch (gc.kind) { case CX_LCL: s = message ("LCL File: %q", fileloc_unparse (g_currentloc)); break; case CX_LCLLIB: s = message ("LCL Lib File: %q", fileloc_unparse (g_currentloc)); break; case CX_GLOBAL: s = message ("Global Context:%q", fileloc_unparse (g_currentloc)); break; case CX_INNER: s = message ("Inner Context [%d] : %q", gc.cont.cdepth, fileloc_unparse (g_currentloc)); break; case CX_FUNCTION: s = message ("Function %q :%q \n\taccess %q\n\tmodifies %q", uentry_unparse (gc.cont.fcn), fileloc_unparse (g_currentloc), typeIdSet_unparse (gc.acct), sRefSet_unparse (gc.mods)); break; case CX_MACROFCN: s = message ("Function Macro %q", uentry_unparse (gc.cont.fcn)); break; case CX_UNKNOWNMACRO: s = message ("Forward Specified Macro %q", uentry_unparse (gc.cont.fcn)); break; case CX_MACROCONST: s = message ("Constant Macro %q", uentry_unparse (gc.cont.fcn)); break; case CX_ITERDEF: s = message ("Iter definition %q", uentry_unparse (gc.cont.fcn)); break; case CX_ITEREND: s = message ("Iter end %q", uentry_unparse (gc.cont.fcn)); break; case CX_FCNDECLARATION: s = message ("Function declaration %q", uentry_unparse (gc.cont.fcn)); break; default: s = message ("Un-unparseable context: %d", (int) gc.kind); break; } s = message ("%q\naccess: %q", s, context_unparseAccess ()); return (s); } extern ctype context_currentFunctionType (void) { if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN) { return (uentry_getType (gc.cont.fcn)); } else if (gc.kind == CX_INNER) { llcontbuglit ("context_currentFunctionType: inner context"); do { context_exitInnerPlain (); } while (gc.kind == CX_INNER); return (context_currentFunctionType ()); } else { llcontbuglit ("context_currentFunctionType: not in function"); return (ctype_undefined); } } void context_enterInnerContext (void) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Enter inner context: %q", context_unparse ())); } if (gc.kind == CX_GLOBAL) { gc.kind = CX_INNER; gc.cont.cdepth = 1; } else if (gc.kind == CX_INNER) { gc.cont.cdepth++; } else { ; } usymtab_enterScope (); pushClause (NOCLAUSE); } void context_exitInnerPlain (void) /*@modifies gc;@*/ { context_exitInner (exprNode_undefined); } void context_exitInner (exprNode exp) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Enter inner context: %q", context_unparse ())); } llassertprint (gc.inclause == NOCLAUSE || gc.inclause == CASECLAUSE, ("inclause = %s", clause_nameTaken (gc.inclause))); clauseStack_removeFirst (gc.clauses, NOCLAUSE); gc.inclause = topClause (gc.clauses); if (gc.kind == CX_INNER) { if (--gc.cont.cdepth == 0) { gc.kind = CX_GLOBAL; gc.cont.glob = TRUE; } } else { if (gc.kind == CX_GLOBAL) { llcontbuglit ("Attempt to exit global context"); return; } } usymtab_exitScope (exp); } void context_enterStructInnerContext (void) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Enter struct inner context: %q", context_unparse ())); } if (gc.kind == CX_GLOBAL) { gc.kind = CX_INNER; gc.cont.cdepth = 1; } else if (gc.kind == CX_INNER) { gc.cont.cdepth++; } else { ; } usymtab_enterScope (); if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Enter struct inner context: %q", context_unparse ())); } } void context_exitStructInnerContext (void) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Exit struct inner context: %q [%d]", context_unparse (), gc.cont.cdepth)); } if (gc.kind == CX_INNER) { if (gc.cont.cdepth <= 0) { llcontbuglit ("Attempt to exit inner context with no depth"); gc.kind = CX_GLOBAL; gc.cont.glob = TRUE; gc.cont.cdepth = 0; } else { gc.cont.cdepth--; if (gc.cont.cdepth == 0) { gc.kind = CX_GLOBAL; gc.cont.glob = TRUE; } } } else { if (gc.kind == CX_GLOBAL) { llcontbuglit ("Attempt to exit global context"); return; } } usymtab_exitScope (exprNode_undefined); if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("After exit struct inner context: %q [%d]", context_unparse (), gc.cont.cdepth)); } } void context_exitInnerSafe (void) { if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Exit inner safe: %q", context_unparse ())); } if (gc.kind == CX_INNER) { if (--gc.cont.cdepth <= 0) { gc.cont.cdepth = 0; } } else if (gc.kind == CX_GLOBAL) { llcontbuglit ("Attempt to exit global context"); return; } else { if (usymtab_inDeepScope ()) { usymtab_exitScope (exprNode_undefined); } } } static void setModuleAccess (void) { gc.facct = typeIdSet_emptySet (); if (fileId_isValid (currentFile ())) { cstring baseName = fileloc_getBase (g_currentloc); if (context_getFlag (FLG_ACCESSFILE)) { if (usymtab_existsType (baseName)) { gc.facct = typeIdSet_insert (gc.facct, usymtab_getTypeId (baseName)); } else { ; } } if (context_getFlag (FLG_ACCESSMODULE)) { int i; bool hasaccess = FALSE; for (i = 0; i < gc.nmods; i++) { if (cstring_equal (baseName, gc.moduleaccess[i].file)) { gc.facct = typeIdSet_union (gc.facct, gc.moduleaccess[i].daccess); hasaccess = TRUE; break; } } } gc.acct = gc.facct; gc.inheader = fileId_isHeader (currentFile ()); } else { llcontbuglit ("Current file not defined\n"); gc.facct = typeIdSet_emptySet (); gc.acct = gc.facct; gc.inheader = FALSE; } /* 17 Jan 1995: forgot to clear nacct */ gc.nacct = typeIdSet_emptySet (); } static void context_enterFileAux (void) { setModuleAccess (); } void context_enterFile (void) { context_enterFileAux (); usymtab_enterFile (); } void context_enterMacroFile (void) { context_enterFileAux (); } bool context_inFunction (void) { kcontext ck = gc.kind; return ((ck == CX_FUNCTION) || (ck == CX_MACROFCN) || (ck == CX_INNER)); } bool context_inFunctionLike (void) { return (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN || gc.kind == CX_FCNDECLARATION || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_ITERDEF); } bool context_inRealFunction (void) { kcontext ck = gc.kind; return ((ck == CX_FUNCTION) || (ck == CX_MACROFCN)); } void context_processAllMacros (void) { usymtab_enterFile (); gc.inmacrocache = TRUE; macrocache_processUndefinedElements (gc.mc); cleanupMessages (); usymtab_exitFile (); gc.inmacrocache = FALSE; macrocache_finalize (); } /* ** this happens once at the end of each C file ** ** check each Macro that was defined in current file.c or current file.h ** */ static void context_processMacros (void) { if (fileId_isValid (currentFile ())) { fileloc lastfl; cstring cbase = fileLib_removePathFree (fileLib_removeAnyExtension (fileTable_fileName (currentFile ()))); gc.inmacrocache = TRUE; DPRINTF (("Processing macros: %s", cbase)); lastfl = macrocache_processFileElements (gc.mc, cbase); DPRINTF (("Processing macros: %s", fileloc_unparse (lastfl))); cstring_free (cbase); if (fileloc_isDefined (lastfl)) { g_currentloc = fileloc_update (g_currentloc, lastfl); cleanupMessages (); } gc.inmacrocache = FALSE; } } bool context_processingMacros (void) { return (gc.inmacrocache); } void context_exitCFile (void) { if (gc.kind != CX_GLOBAL) { llfatalerrorLoc (cstring_makeLiteral ("File ended outside global scope")); } if (gc.insuppressregion) { /* gack...don't reverse the order of these lines! ;-> */ gc.insuppressregion = FALSE; llerrorlit (FLG_SYNTAX, "File ended in ignore errors region, " "possible missing /*@end*/"); } /* fix up parse errors */ while (!usymtab_inFileScope ()) { usymtab_quietExitScope (g_currentloc); } /* ** Clear the file-specific modifies information. */ sRefSetList_elements (gc.modrecs, mods) { sRefSet_clearStatics (mods); } end_sRefSetList_elements ; sRefSetList_clear (gc.modrecs); context_processMacros (); cleanupMessages (); usymtab_exitFile (); gc.inDerivedFile = FALSE; filelocStack_clear (gc.locstack); gc.nacct = typeIdSet_emptySet (); /* empty noaccess */ gc.cont.glob = TRUE; if (gc.savedFlags) { context_restoreFlagSettings (); gc.savedFlags = FALSE; } /* DPRINTF (("After exiting file: ")); usymtab_printAll (); */ } void context_exitMacroCache (void) { if (gc.kind != CX_GLOBAL) { if (context_inMacro ()) /* this is okay, file could end without newline in macro */ { DPRINTF (("Still in macro: %s", context_unparse ())); context_exitFunction (); } else { llcontbug (message ("context_exitMacroCache: outside global scope: %q", context_unparse ())); gc.kind = CX_GLOBAL; } } /* ** no longer valid here ** if (gc.insuppressregion) ** { ** gc.insuppressregion = FALSE; ** llerror ("File ended in ignore errors region, possible missing @"); ** } */ gc.cont.glob = TRUE; } void context_saveLocation (void) { /* was llassert (fileloc_isUndefined (gc.saveloc)) */ fileloc_free (gc.saveloc); gc.saveloc = fileloc_copy (g_currentloc); } fileloc context_getSaveLocation (void) { fileloc fl = gc.saveloc; gc.saveloc = fileloc_undefined; return fl; } /*@observer@*/ cstring context_inFunctionName (void) { if (gc.kind == CX_FUNCTION || gc.kind == CX_MACROFCN || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_MACROCONST || gc.kind == CX_ITERDEF || gc.kind == CX_ITEREND) { return (uentry_rawName (gc.cont.fcn)); } else { llcontbuglit ("context_inFunctionName: not in function"); return (cstring_undefined); } } void context_userSetFlag (flagcode f, bool b) { DPRINTF (("set flag: %s / %s", flagcode_unparse (f), bool_unparse (context_getFlag (f)))); if (f == FLG_NEVERINCLUDE && b) { if (gc.flags[FLG_EXPORTHEADER]) { llerror_flagWarning (cstring_makeLiteral ("Setting +neverinclude after +exportheader. " "Turning off exportheader, since headers are not checked " "when +neverinclude is used.")); gc.flags[FLG_EXPORTHEADER] = FALSE; } } else { if (f == FLG_EXPORTHEADER && b) { if (gc.flags[FLG_NEVERINCLUDE]) { llerror_flagWarning (cstring_makeLiteral ("Setting +exportheader after +neverinclude. " "Not setting exportheader, since headers are not checked " "when +neverinclude is used.")); gc.flags[FLG_EXPORTHEADER] = FALSE; return; } } } if (context_getFlag (FLG_WARNFLAGS) && f != FLG_NOF && f != FLG_OPTF) { bool lastsetting = context_getFlag (f); if (bool_equal (lastsetting, b) && !flagcode_isSpecialFlag (f) && !flagcode_isIdemFlag (f) && !flagcode_hasArgument (f)) { llerror_flagWarning (message ("Setting %s%s redundant with current value", cstring_makeLiteralTemp (b ? "+" : "-"), flagcode_unparse (f))); } } if (flagcode_isWarnUseFlag (f) && b) { if (!context_getFlag (FLG_WARNUSE)) { llerror_flagWarning (message ("Flag +%s is canceled by -warnuse", flagcode_unparse (f))); } } if (flagcode_isLibraryFlag (f)) { if (gc.library != FLG_ANSILIB && gc.library != f) { llerror_flagWarning (message ("Selecting library %s after library %s was " "selected (only one library may be used)", flagcode_unparse (f), flagcode_unparse (gc.library))); } if (f == FLG_UNIXLIB) { if (context_getFlag (FLG_WARNUNIXLIB)) { llerror_flagWarning (cstring_makeLiteral ("Selecting unix library. Unix library is " "based on the Single Unix Specification, Version 2. Not all " "Unix implementations are consistend with this specification. " "Use -warnunixlib to suppress this message.")); } } gc.library = f; } if (flagcode_isNameChecksFlag (f) && b && !context_maybeSet (FLG_NAMECHECKS)) { llerror_flagWarning (message ("Setting +%s will not produce warnings with -namechecks. " "Must set +namechecks also.", flagcode_unparse (f))); } gc.setGlobally[f] = TRUE; context_setFlag (f, b, g_currentloc); } void context_fileSetFlag (flagcode f, ynm set, fileloc loc) { if (!gc.savedFlags) { context_saveFlagSettings (); } if (ynm_isOff (set)) { context_setFlagAux (f, FALSE, TRUE, FALSE, loc); } else if (ynm_isOn (set)) { context_setFlagAux (f, TRUE, TRUE, FALSE, loc); gc.setLocally[f] = TRUE; } else { context_restoreFlag (f, loc); } } static void context_restoreFlag (flagcode f, fileloc loc) { if (!gc.savedFlags) { voptgenerror (FLG_SYNTAX, message ("Attempt to restore flag %s when no file scope flags " "have been set.", flagcode_unparse (f)), loc); } else { context_addFlagMarker (f, MAYBE, loc); context_setFlagAux (f, gc.saveflags[f], FALSE, TRUE, loc); } } static void context_setFlag (flagcode f, bool b, fileloc loc) { context_setFlagAux (f, b, FALSE, FALSE, loc); } void context_setFlagTemp (flagcode f, bool b) { DPRINTF (("Set flag temp: %s / %s", flagcode_unparse (f), bool_unparse (b))); gc.flags[f] = b; } /*@notfunction@*/ # define DOSET(ff,b) \ do { if (inFile) { gc.setLocally[ff] = TRUE; \ context_addFlagMarker (ff, ynm_fromBool (b), loc); } \ DPRINTF (("set flag: %s / %s", flagcode_unparse (ff), bool_unparse (b))); \ gc.flags[ff] = b; } while (FALSE) static void context_setFlagAux (flagcode f, bool b, bool inFile, /*@unused@*/ bool isRestore, fileloc loc) { DPRINTF (("Set flag: %s / %s", flagcode_unparse (f), bool_unparse (b))); /* ** Removed test for special flags. */ if (flagcode_isIdemFlag (f)) { DOSET (f, TRUE); } else { DOSET (f, b); } if (f >= FLG_ITS4MOSTRISKY && f <= FLG_ITS4LOWRISK) { if (b) /* Turing higher level on, turns on all lower levels */ { switch (f) { case FLG_ITS4MOSTRISKY: DOSET (FLG_ITS4VERYRISKY, b); /*@fallthrough@*/ case FLG_ITS4VERYRISKY: DOSET (FLG_ITS4RISKY, b); /*@fallthrough@*/ case FLG_ITS4RISKY: DOSET (FLG_ITS4MODERATERISK, b); /*@fallthrough@*/ case FLG_ITS4MODERATERISK: DOSET (FLG_ITS4LOWRISK, b); /*@fallthrough@*/ case FLG_ITS4LOWRISK: break; BADDEFAULT; } } else /* Turning level off, turns off all higher levels */ { switch (f) { case FLG_ITS4LOWRISK: DOSET (FLG_ITS4MODERATERISK, b); /*@fallthrough@*/ case FLG_ITS4MODERATERISK: DOSET (FLG_ITS4RISKY, b); /*@fallthrough@*/ case FLG_ITS4RISKY: DOSET (FLG_ITS4VERYRISKY, b); /*@fallthrough@*/ case FLG_ITS4VERYRISKY: DOSET (FLG_ITS4MOSTRISKY, b); /*@fallthrough@*/ case FLG_ITS4MOSTRISKY: break; BADDEFAULT; } } } switch (f) { case FLG_MESSAGESTREAMSTDOUT: g_messagestream = stdout; break; case FLG_MESSAGESTREAMSTDERR: g_messagestream = stderr; break; case FLG_WARNINGSTREAMSTDOUT: g_warningstream = stdout; break; case FLG_WARNINGSTREAMSTDERR: g_warningstream = stderr; break; case FLG_ERRORSTREAMSTDOUT: g_errorstream = stdout; break; case FLG_ERRORSTREAMSTDERR: g_errorstream = stderr; break; case FLG_ALLEMPTY: DOSET (FLG_ALLEMPTY, b); DOSET (FLG_IFEMPTY, b); DOSET (FLG_WHILEEMPTY, b); DOSET (FLG_FOREMPTY, b); break; case FLG_PREDBOOL: DOSET (FLG_PREDBOOL, b); DOSET (FLG_PREDBOOLINT, b); DOSET (FLG_PREDBOOLPTR, b); DOSET (FLG_PREDBOOLOTHERS, b); break; case FLG_GLOBALIAS: DOSET (FLG_CHECKSTRICTGLOBALIAS, b); DOSET (FLG_CHECKEDGLOBALIAS, b); DOSET (FLG_CHECKMODGLOBALIAS, b); DOSET (FLG_UNCHECKEDGLOBALIAS, b); break; case FLG_ALLBLOCK: DOSET (FLG_ALLBLOCK, b); DOSET (FLG_IFBLOCK, b); DOSET (FLG_WHILEBLOCK, b); DOSET (FLG_FORBLOCK, b); break; case FLG_GRAMMAR: if (b) { yydebug = 1; mtdebug = 1; } else { yydebug = 0; mtdebug = 0; } DOSET (FLG_GRAMMAR, b); break; case FLG_CODEIMPONLY: DOSET (FLG_CODEIMPONLY, b); DOSET (FLG_GLOBIMPONLY, b); DOSET (FLG_RETIMPONLY, b); DOSET (FLG_STRUCTIMPONLY, b); break; case FLG_SPECALLIMPONLY: DOSET (FLG_SPECALLIMPONLY, b); DOSET (FLG_SPECGLOBIMPONLY, b); DOSET (FLG_SPECRETIMPONLY, b); DOSET (FLG_SPECSTRUCTIMPONLY, b); break; case FLG_ALLIMPONLY: DOSET (FLG_ALLIMPONLY, b); DOSET (FLG_GLOBIMPONLY, b); DOSET (FLG_RETIMPONLY, b); DOSET (FLG_STRUCTIMPONLY, b); DOSET (FLG_SPECGLOBIMPONLY, b); DOSET (FLG_SPECRETIMPONLY, b); DOSET (FLG_SPECSTRUCTIMPONLY, b); break; case FLG_ANSI89LIMITS: DOSET (FLG_ANSI89LIMITS, b); DOSET (FLG_CONTROLNESTDEPTH, b); DOSET (FLG_STRINGLITERALLEN, b); DOSET (FLG_INCLUDENEST, b); DOSET (FLG_NUMSTRUCTFIELDS, b); DOSET (FLG_NUMENUMMEMBERS, b); if (b) { context_setValue (FLG_CONTROLNESTDEPTH, ANSI89_CONTROLNESTDEPTH); context_setValue (FLG_STRINGLITERALLEN, ANSI89_STRINGLITERALLEN); context_setValue (FLG_INCLUDENEST, ANSI89_INCLUDENEST); context_setValue (FLG_NUMSTRUCTFIELDS, ANSI89_NUMSTRUCTFIELDS); context_setValue (FLG_NUMENUMMEMBERS, ANSI89_NUMENUMMEMBERS); context_setValue (FLG_EXTERNALNAMELEN, ANSI89_EXTERNALNAMELEN); context_setValue (FLG_INTERNALNAMELEN, ANSI89_INTERNALNAMELEN); } break; case FLG_ISO99LIMITS: DOSET (FLG_ISO99LIMITS, b); DOSET (FLG_CONTROLNESTDEPTH, b); DOSET (FLG_STRINGLITERALLEN, b); DOSET (FLG_INCLUDENEST, b); DOSET (FLG_NUMSTRUCTFIELDS, b); DOSET (FLG_NUMENUMMEMBERS, b); if (b) { context_setValue (FLG_CONTROLNESTDEPTH, ISO99_CONTROLNESTDEPTH); context_setValue (FLG_STRINGLITERALLEN, ISO99_STRINGLITERALLEN); context_setValue (FLG_INCLUDENEST, ISO99_INCLUDENEST); context_setValue (FLG_NUMSTRUCTFIELDS, ISO99_NUMSTRUCTFIELDS); context_setValue (FLG_NUMENUMMEMBERS, ISO99_NUMENUMMEMBERS); context_setValue (FLG_EXTERNALNAMELEN, ISO99_EXTERNALNAMELEN); context_setValue (FLG_INTERNALNAMELEN, ISO99_INTERNALNAMELEN); } break; case FLG_EXTERNALNAMELEN: DOSET (FLG_DISTINCTEXTERNALNAMES, TRUE); DOSET (FLG_EXTERNALNAMELEN, TRUE); break; case FLG_INTERNALNAMELEN: DOSET (FLG_DISTINCTINTERNALNAMES, TRUE); DOSET (FLG_INTERNALNAMELEN, TRUE); break; case FLG_EXTERNALNAMECASEINSENSITIVE: DOSET (FLG_EXTERNALNAMECASEINSENSITIVE, b); if (b && !gc.flags[FLG_DISTINCTEXTERNALNAMES]) { DOSET (FLG_DISTINCTEXTERNALNAMES, TRUE); context_setValue (FLG_EXTERNALNAMELEN, 0); } break; case FLG_INTERNALNAMECASEINSENSITIVE: DOSET (FLG_INTERNALNAMECASEINSENSITIVE, b); if (b && !gc.flags[FLG_DISTINCTINTERNALNAMES]) { DOSET (FLG_DISTINCTINTERNALNAMES, TRUE); context_setValue (FLG_INTERNALNAMELEN, 0); } break; case FLG_INTERNALNAMELOOKALIKE: DOSET (FLG_INTERNALNAMELOOKALIKE, b); if (b && !gc.flags[FLG_DISTINCTINTERNALNAMES]) { DOSET (FLG_DISTINCTINTERNALNAMES, TRUE); context_setValue (FLG_INTERNALNAMELEN, 0); } break; case FLG_MODUNSPEC: DOSET (FLG_MODNOMODS, b); DOSET (FLG_MODGLOBSUNSPEC, b); DOSET (FLG_MODSTRICTGLOBSUNSPEC, b); break; case FLG_EXPORTANY: DOSET (FLG_EXPORTVAR, b); DOSET (FLG_EXPORTFCN, b); DOSET (FLG_EXPORTTYPE, b); DOSET (FLG_EXPORTMACRO, b); DOSET (FLG_EXPORTCONST, b); gc.anyExports = TRUE; break; case FLG_REPEXPOSE: DOSET (FLG_RETEXPOSE, b); DOSET (FLG_ASSIGNEXPOSE, b); DOSET (FLG_CASTEXPOSE, b); break; case FLG_RETVAL: DOSET (FLG_RETVALBOOL, b); DOSET (FLG_RETVALINT, b); DOSET (FLG_RETVALOTHER, b); break; case FLG_PARTIAL: if (b) { DOSET (FLG_EXPORTLOCAL, FALSE); DOSET (FLG_DECLUNDEF, FALSE); DOSET (FLG_SPECUNDEF, FALSE); DOSET (FLG_TOPUNUSED, FALSE); } break; case FLG_DEEPBREAK: DOSET (FLG_LOOPLOOPBREAK, b); DOSET (FLG_LOOPSWITCHBREAK, b); DOSET (FLG_SWITCHLOOPBREAK, b); DOSET (FLG_SWITCHSWITCHBREAK, b); DOSET (FLG_LOOPLOOPCONTINUE, b); DOSET (FLG_DEEPBREAK, b); break; case FLG_LOOPEXEC: DOSET (FLG_FORLOOPEXEC, b); DOSET (FLG_WHILELOOPEXEC, b); DOSET (FLG_ITERLOOPEXEC, b); break; case FLG_ACCESSALL: DOSET (FLG_ACCESSMODULE, b); DOSET (FLG_ACCESSFILE, b); DOSET (FLG_ACCESSCZECH, b); break; case FLG_ALLMACROS: DOSET (FLG_ALLMACROS, b); DOSET (FLG_FCNMACROS, b); DOSET (FLG_CONSTMACROS, b); break; case FLG_BOUNDS: DOSET (FLG_BOUNDSREAD, b); DOSET (FLG_BOUNDSWRITE, b); DOSET (FLG_LIKELYBOUNDSREAD, b); DOSET (FLG_LIKELYBOUNDSWRITE, b); break; case FLG_BOUNDSREAD: DOSET (FLG_LIKELYBOUNDSREAD, b); break; case FLG_BOUNDSWRITE: DOSET (FLG_LIKELYBOUNDSWRITE, b); break; case FLG_LIKELYBOUNDS: DOSET (FLG_LIKELYBOUNDSREAD, b); DOSET (FLG_LIKELYBOUNDSWRITE, b); break; case FLG_CZECH: if (b) { DOSET (FLG_ACCESSCZECH, b); } DOSET (FLG_CZECHFUNCTIONS, b); DOSET (FLG_CZECHVARS, b); DOSET (FLG_CZECHCONSTANTS, b); DOSET (FLG_CZECHTYPES, b); break; case FLG_SLOVAK: if (b) { DOSET (FLG_ACCESSSLOVAK, b); } DOSET (FLG_SLOVAKFUNCTIONS, b); DOSET (FLG_SLOVAKVARS, b); DOSET (FLG_SLOVAKCONSTANTS, b); DOSET (FLG_SLOVAKTYPES, b); break; case FLG_CZECHOSLOVAK: if (b) { DOSET (FLG_ACCESSCZECHOSLOVAK, b); } DOSET (FLG_CZECHOSLOVAKFUNCTIONS, b); DOSET (FLG_CZECHOSLOVAKVARS, b); DOSET (FLG_CZECHOSLOVAKCONSTANTS, b); DOSET (FLG_CZECHOSLOVAKTYPES, b); break; case FLG_NULL: DOSET (FLG_NULLSTATE, b); DOSET (FLG_NULLDEREF, b); DOSET (FLG_NULLASSIGN, b); DOSET (FLG_NULLPASS, b); DOSET (FLG_NULLRET, b); break; case FLG_MUSTFREE: DOSET (FLG_MUSTFREEONLY, b); DOSET (FLG_MUSTFREEFRESH, b); break; case FLG_MEMCHECKS: DOSET (FLG_NULLSTATE, b); DOSET (FLG_NULLDEREF, b); DOSET (FLG_NULLASSIGN, b); DOSET (FLG_NULLPASS, b); DOSET (FLG_NULLRET, b); DOSET (FLG_COMPDEF, b); DOSET (FLG_COMPMEMPASS, b); DOSET (FLG_UNIONDEF, b); DOSET (FLG_MEMTRANS, b); DOSET (FLG_USERELEASED, b); DOSET (FLG_ALIASUNIQUE, b); DOSET (FLG_MAYALIASUNIQUE, b); DOSET (FLG_MUSTFREEONLY, b); DOSET (FLG_MUSTFREEFRESH, b); DOSET (FLG_MUSTDEFINE, b); DOSET (FLG_GLOBSTATE, b); DOSET (FLG_COMPDESTROY, b); DOSET (FLG_MUSTNOTALIAS, b); DOSET (FLG_MEMIMPLICIT, b); DOSET (FLG_BRANCHSTATE, b); /*@fallthrough@*/ /* also sets memtrans flags */ case FLG_MEMTRANS: DOSET (FLG_MEMTRANS, b); DOSET (FLG_EXPOSETRANS, b); DOSET (FLG_OBSERVERTRANS, b); DOSET (FLG_DEPENDENTTRANS, b); DOSET (FLG_NEWREFTRANS, b); DOSET (FLG_ONLYTRANS, b); DOSET (FLG_OWNEDTRANS, b); DOSET (FLG_FRESHTRANS, b); DOSET (FLG_SHAREDTRANS, b); DOSET (FLG_TEMPTRANS, b); DOSET (FLG_KEPTTRANS, b); DOSET (FLG_REFCOUNTTRANS, b); DOSET (FLG_STATICTRANS, b); DOSET (FLG_UNKNOWNTRANS, b); DOSET (FLG_KEEPTRANS, b); DOSET (FLG_IMMEDIATETRANS, b); break; default: break; } if (b && !gc.anyExports && (f == FLG_EXPORTVAR || f == FLG_EXPORTFCN || f == FLG_EXPORTTYPE || f == FLG_EXPORTMACRO || f == FLG_EXPORTCONST || f == FLG_EXPORTANY)) { gc.anyExports = TRUE; } } bool context_maybeSet (flagcode d) { return (gc.flags[d] || gc.setLocally[d]); } bool context_getFlag (flagcode d) { return (gc.flags[d]); } bool context_flagOn (flagcode f, fileloc loc) { return (!context_suppressFlagMsg (f, loc)); } static void context_saveFlagSettings (void) { gc.savedFlags = TRUE; llassert (sizeof (gc.saveflags) == sizeof (gc.flags)); memcpy (gc.saveflags, gc.flags, sizeof (gc.flags)); } static void context_restoreFlagSettings (void) { llassert (sizeof (gc.saveflags) == sizeof (gc.flags)); memcpy (gc.flags, gc.saveflags, sizeof (gc.flags)); gc.savedFlags = FALSE; } void context_setFilename (fileId fid, int lineno) /*@globals fileloc g_currentloc;@*/ /*@modifies g_currentloc@*/ { if (fileId_baseEqual (currentFile (), fid)) { setLine (lineno); return; } else { fileloc_setColumn (g_currentloc, 0); if (fileloc_isSpecialFile (g_currentloc)) { gc.inDerivedFile = TRUE; } if (filelocStack_popPushFile (gc.locstack, g_currentloc)) { int maxdepth = context_getValue (FLG_INCLUDENEST); if (filelocStack_size (gc.locstack) > maxdepth) { int depth = filelocStack_includeDepth (gc.locstack); if (depth > maxdepth) { if (optgenerror (FLG_INCLUDENEST, message ("Maximum include nesting depth " "(%d, current depth %d) exceeded", maxdepth, depth), filelocStack_nextTop (gc.locstack))) { filelocStack_printIncludes (gc.locstack); } } } } g_currentloc = fileloc_create (fid, lineno, 1); gc.inheader = fileId_isHeader (currentFile ()); context_enterFileAux (); } } void context_enterIterDef (/*@observer@*/ uentry le) { context_enterMacro (le); gc.acct = typeIdSet_subtract (gc.facct, gc.nacct); gc.kind = CX_ITERDEF; } void context_enterIterEnd (/*@observer@*/ uentry le) { context_enterMacro (le); gc.kind = CX_ITEREND; } void context_destroyMod (void) /*@globals killed gc@*/ { int i; setCodePoint (); ctype_destroyMod (); /* setCodePoint (); usymtab_free (); setCodePoint (); */ fileTable_free (gc.ftab); gc.ftab = fileTable_undefined; filelocStack_free (gc.locstack); setCodePoint (); macrocache_free (gc.mc); /* evans 2002-07-12: not reported because of reldef */ for (i = 0; i < gc.nmods; i++) { cstring_free (gc.moduleaccess[i].file); } sfree (gc.moduleaccess); setCodePoint (); fileloc_free (gc.saveloc); gc.saveloc = fileloc_undefined; fileloc_free (gc.pushloc); gc.pushloc = fileloc_undefined; setCodePoint (); sRefSetList_free (gc.modrecs); setCodePoint (); flagMarkerList_free (gc.markers); setCodePoint (); messageLog_free (gc.msgLog); setCodePoint (); clauseStack_free (gc.clauses); setCodePoint (); cstring_free (gc.msgAnnote); globSet_free (gc.globs_used); metaStateTable_free (gc.stateTable); annotationTable_free (gc.annotTable); } /* ** Flag shortcuts */ bool context_msgBoolInt (void) { return context_flagOn (FLG_BOOLINT, g_currentloc); } bool context_msgCharInt (void) { return context_flagOn (FLG_CHARINT, g_currentloc); } bool context_msgEnumInt (void) { return context_flagOn (FLG_ENUMINT, g_currentloc); } bool context_msgLongInt (void) { return context_flagOn (FLG_LONGINT, g_currentloc); } bool context_msgShortInt (void) { return context_flagOn (FLG_SHORTINT, g_currentloc); } bool context_msgPointerArith (void) { return context_flagOn (FLG_POINTERARITH, g_currentloc); } bool context_msgStrictOps (void) { return context_flagOn (FLG_STRICTOPS, g_currentloc); } bool context_msgLh (void) { return gc.flags [FLG_DOLH]; } void context_pushLoc (void) { fileloc_free (gc.pushloc); gc.pushloc = gc.saveloc; gc.saveloc = fileloc_undefined; } void context_popLoc (void) { gc.saveloc = fileloc_update (gc.saveloc, gc.pushloc); } bool context_inGlobalScope (void) { return (usymtab_inFileScope() || usymtab_inGlobalScope ()); } bool context_inInnerScope (void) { return (gc.kind == CX_INNER); } void context_setProtectVars (void) { gc.protectVars = TRUE; } bool context_anyErrors (void) { return (gc.numerrors > 0); } void context_hasError (void) { gc.numerrors++; DPRINTF (("num errors: %d", gc.numerrors)); } int context_numErrors (void) { return gc.numerrors; } bool context_neednl (void) { return gc.neednl; } void context_setNeednl (void) { gc.neednl = TRUE; } int context_getExpect (void) { return (context_getValue (FLG_EXPECT)); } int context_getLCLExpect (void) { return (context_getValue (FLG_LCLEXPECT)); } int context_getLimit (void) { return (context_getValue (FLG_LIMIT)); } bool context_unlimitedMessages (void) { return (context_getLimit () < 0); } void context_releaseVars (void) { llassert (gc.protectVars); gc.protectVars = FALSE; } void context_sizeofReleaseVars (void) { /* If there is a nested sizeof, this might not hold: llassert (gc.protectVars); */ gc.protectVars = FALSE; } bool context_inProtectVars (void) { return (gc.protectVars); } void context_hideShowscan (void) { gc.flags[FLG_SHOWSCAN] = FALSE; } void context_unhideShowscan (void) { gc.flags[FLG_SHOWSCAN] = TRUE; } bool context_inHeader (void) { return (gc.inheader); } fileTable context_fileTable (void) { return gc.ftab; } cstring context_tmpdir (void) { return (context_getString (FLG_TMPDIR)); } messageLog context_messageLog (void) { return gc.msgLog; } bool context_inMacroFunction (void) { return (gc.kind == CX_MACROFCN); } bool context_inMacroConstant (void) { return (gc.kind == CX_MACROCONST); } bool context_inUnknownMacro (void) { return (gc.kind == CX_UNKNOWNMACRO); } void context_setShownFunction (void) { gc.showfunction = FALSE; } bool context_doDump (void) { return cstring_isNonEmpty (context_getString (FLG_DUMP)); } bool context_doMerge (void) { return cstring_isNonEmpty (context_getString (FLG_MERGE)); } cstring context_getDump (void) { return context_getString (FLG_DUMP); } cstring context_getMerge (void) { return context_getString (FLG_MERGE); } bool context_inLCLLib (void) { return (gc.kind == CX_LCLLIB); } /*drl add these 3/5/2003*/ static bool inSizeof = FALSE; bool context_inSizeof (void) { return (inSizeof); } void context_enterSizeof (void) { DPRINTF((message("context_enterSizeof ") ) ); inSizeof = TRUE; } void context_leaveSizeof (void) { DPRINTF((message("context_leaveSizeof ") )); inSizeof = FALSE; } /*end function added 3/5/2003*/ bool context_inImport (void) { return (gc.inimport); } void context_enterImport (void) { gc.inimport = TRUE; } void context_leaveImport (void) { gc.inimport = FALSE; } bool context_inMacro (void) { return (gc.kind == CX_MACROFCN || gc.kind == CX_MACROCONST || gc.kind == CX_UNKNOWNMACRO || gc.kind == CX_ITERDEF || gc.kind == CX_ITEREND); } bool context_inIterDef (void) { return (gc.kind == CX_ITERDEF); } bool context_inIterEnd (void) { return (gc.kind == CX_ITEREND); } int context_getLinesProcessed (void) { return (gc.linesprocessed); } int context_getSpecLinesProcessed (void) { return (gc.speclinesprocessed); } void context_processedSpecLine (void) { gc.speclinesprocessed++; } void context_resetSpecLines (void) { gc.speclinesprocessed = 0; } bool context_inGlobalContext (void) { return (gc.kind == CX_GLOBAL); } static void context_quietExitScopes (void) { /* ** Try to restore the global scope (after an error). */ while (!usymtab_inFileScope ()) { usymtab_quietExitScope (g_currentloc); } gc.cont.glob = TRUE; gc.kind = CX_GLOBAL; } void context_checkGlobalScope (void) { if (gc.kind != CX_GLOBAL) { if (context_inMacro ()) { ; /* evans 2001-10-14: Okay to be in a macro here! */ } else { llcontbug (message ("Not in global scope as expected: %q", context_unparse ())); context_quietExitScopes (); } } } void context_setFileId (fileId s) { g_currentloc = fileloc_updateFileId (g_currentloc, s); } bool context_setBoolName (void) { return (!cstring_equalLit (context_getString (FLG_BOOLTYPE), DEFAULT_BOOLTYPE)); } cstring context_printBoolName (void) { if (context_setBoolName ()) { return context_getBoolName (); } else { return cstring_makeLiteralTemp ("boolean"); } } cstring context_getBoolName (void) { return (context_getString (FLG_BOOLTYPE)); } cstring context_getFalseName (void) { return (context_getString (FLG_BOOLFALSE)); } cstring context_getTrueName (void) { return (context_getString (FLG_BOOLTRUE)); } cstring context_getLarchPath (void) { return (context_getString (FLG_LARCHPATH)); } cstring context_getLCLImportDir (void) { return (context_getString (FLG_LCLIMPORTDIR)); } static void context_setJustPopped (void) { gc.justpopped = TRUE; } void context_clearJustPopped (void) { gc.justpopped = FALSE; } bool context_justPopped (void) { return (gc.justpopped); } void context_setMacroMissingParams (void) { gc.macroMissingParams = TRUE; } void context_resetMacroMissingParams (void) { gc.macroMissingParams = FALSE; } bool context_isMacroMissingParams (void) { return (gc.macroMissingParams); } void context_showFilelocStack (void) { filelocStack_printIncludes (gc.locstack); } metaStateTable context_getMetaStateTable (void) { return gc.stateTable; } metaStateInfo context_lookupMetaStateInfo (cstring key) { return metaStateTable_lookup (gc.stateTable, key); } /*@null@*/ annotationInfo context_lookupAnnotation (cstring annot) { return annotationTable_lookup (gc.annotTable, annot); } void context_addAnnotation (annotationInfo info) { if (annotationTable_contains (gc.annotTable, annotationInfo_getName (info))) { voptgenerror (FLG_SYNTAX, message ("Duplicate annotation declaration: %s", annotationInfo_getName (info)), annotationInfo_getLoc (info)); annotationInfo_free (info); } else { annotationTable_insert (gc.annotTable, info); } } void context_addMetaState (cstring mname, metaStateInfo msinfo) { if (metaStateTable_contains (gc.stateTable, mname)) { voptgenerror (FLG_SYNTAX, message ("Duplicate metastate declaration: %s", mname), metaStateInfo_getLoc (msinfo)); cstring_free (mname); metaStateInfo_free (msinfo); } else { DPRINTF (("Adding meta state: %s", mname)); metaStateTable_insert (gc.stateTable, mname, msinfo); } } valueTable context_createValueTable (sRef s, stateInfo info) { if (metaStateTable_size (gc.stateTable) > 0) { valueTable res = valueTable_create (metaStateTable_size (gc.stateTable)); /* should use smaller value... */ DPRINTF (("Value table for: %s", sRef_unparse (s))); metaStateTable_elements (gc.stateTable, msname, msi) { mtContextNode context = metaStateInfo_getContext (msi); if (mtContextNode_matchesRefStrict (context, s)) { DPRINTF (("Create: %s", metaStateInfo_unparse (msi))); llassert (cstring_equal (msname, metaStateInfo_getName (msi))); valueTable_insert (res, cstring_copy (metaStateInfo_getName (msi)), stateValue_createImplicit (metaStateInfo_getDefaultValue (msi, s), stateInfo_copy (info))); } else { DPRINTF (("No match: %s", metaStateInfo_unparse (msi))); } } end_metaStateTable_elements ; stateInfo_free (info); DPRINTF (("Value table: %s", valueTable_unparse (res))); return res; } else { stateInfo_free (info); return valueTable_undefined; } } valueTable context_createGlobalMarkerValueTable (stateInfo info) { if (metaStateTable_size (gc.stateTable) > 0) { valueTable res = valueTable_create (metaStateTable_size (gc.stateTable)); /* should use smaller value... */ metaStateTable_elements (gc.stateTable, msname, msi) { /* only add global...*/ DPRINTF (("Create: %s", metaStateInfo_unparse (msi))); llassert (cstring_equal (msname, metaStateInfo_getName (msi))); valueTable_insert (res, cstring_copy (metaStateInfo_getName (msi)), stateValue_create (metaStateInfo_getDefaultGlobalValue (msi), stateInfo_copy (info))); } end_metaStateTable_elements ; stateInfo_free (info); DPRINTF (("Value table: %s", valueTable_unparse (res))); return res; } else { stateInfo_free (info); return valueTable_undefined; } } constraintList context_getImplicitFcnConstraints (uentry ue) { constraintList ret = constraintList_makeNew (); uentryList params = uentry_getParams (ue); uentryList_elements (params, el) { DPRINTF (("setImplicitfcnConstraints doing: %s", uentry_unparse(el))); if (uentry_isElipsisMarker (el)) { ; } else { sRef s = uentry_getSref (el); DPRINTF (("Trying: %s", sRef_unparse (s))); if (ctype_isPointer (sRef_getType (s))) { constraint c = constraint_makeSRefWriteSafeInt (s, 0); ret = constraintList_add (ret, c); /*drl 10/23/2002 added support for out*/ if (!uentry_isOut(el)) { c = constraint_makeSRefReadSafeInt (s, 0); ret = constraintList_add (ret , c); } } else { DPRINTF (("%s is NOT a pointer", sRef_unparseFull (s))); } } } end_uentryList_elements; DPRINTF (("Returns ==> %s", constraintList_unparse (ret))); return ret; } splint-3.1.2.dfsg1/src/uentry.c0000644021234200000250000101174410102766473013742 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** uentry.c */ # include "splintMacros.nf" # include "basic.h" # include "structNames.h" # include "nameChecks.h" static /*@dependent@*/ uentry posRedeclared = uentry_undefined; static /*@only@*/ fileloc posLoc = fileloc_undefined; static int nuentries = 0; static int totuentries = 0; static void checkGlobalsModifies (/*@notnull@*/ uentry p_ue, sRefSet p_sr) ; static void uentry_setDeclDef (uentry p_e, fileloc p_f) /*@modifies p_e@*/ ; static bool uentry_isRefCounted (uentry p_ue) /*@*/ ; static bool uentry_isRefsField (uentry p_ue) /*@*/ ; static bool uentry_isReallySpecified (uentry p_e) /*@*/ ; static void uentry_checkIterArgs (uentry p_ue); static cstring uentry_dumpAux (uentry p_v, bool p_isParam); static void uentry_showWhereLastKind (uentry p_spec) /*@modifies g_warningstream@*/ ; static void uentry_combineModifies (uentry p_ue, /*@owned@*/ sRefSet p_sr) /*@modifies p_ue@*/ ; static void uentry_addStateClause (uentry p_ue, /*@only@*/ stateClause p_sc) /*@modifies p_ue@*/ ; /*@access ekind@*/ static void checkAliasState (/*@notnull@*/ uentry p_old, /*@notnull@*/ uentry p_unew, bool p_mustConform, bool p_completeConform) /*@modifies p_old, p_unew@*/ ; static void checkNullState (/*@notnull@*/ uentry p_old, /*@notnull@*/ uentry p_unew, bool p_mustConform, bool p_completeConform) /*@modifies p_old, p_unew@*/ ; static void checkVarConformance (/*@notnull@*/ uentry p_old, /*@notnull@*/ uentry p_unew, bool p_mustConform, bool p_completeConform) /*@modifies p_old, p_unew@*/; static void uentry_setHasMods (uentry p_ue) /*@modifies p_ue@*/; static void uentry_setHasGlobs (uentry p_ue) /*@modifies p_ue@*/; static void uentry_reallyFree (/*@notnull@*/ /*@only@*/ uentry p_e); static void uentry_setSpecDef (/*@special@*/ uentry p_e, /*@keep@*/ fileloc p_f) /*@defines p_e->whereSpecified, p_e->whereDeclared, p_e->whereDefined@*/ /*@modifies p_e@*/; static void returnValueError (/*@notnull@*/ uentry p_old, /*@notnull@*/ uentry p_unew); static void nargsError (/*@notnull@*/ uentry p_old, /*@notnull@*/ uentry p_unew); static /*@observer@*/ cstring paramStorageName (uentry p_ue) /*@*/ ; static /*@observer@*/ cstring fcnErrName (uentry p_ue) /*@*/ ; static /*@observer@*/ cstring checkedName (chkind p_checked) /*@*/ ; static void paramTypeError (/*@notnull@*/ uentry p_old, /*@notnull@*/ uentry p_oldCurrent, ctype p_oldType, /*@notnull@*/ uentry p_unew, /*@notnull@*/ uentry p_newCurrent, ctype p_newType, int p_paramno) /*@modifies g_warningstream@*/ ; static /*@only@*/ /*@notnull@*/ uentry uentry_makeVariableAux (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, /*@exposed@*/ sRef p_s, bool p_priv, vkind p_kind); static /*@only@*/ /*@notnull@*/ uentry uentry_makeConstantAux (cstring p_n, ctype p_t, /*@keep@*/ fileloc p_f, bool p_priv, bool p_macro, /*@only@*/ multiVal p_m) /*@*/ ; static void uentry_convertVarFunction (uentry ue) /*@modifies ue@*/ { if (uentry_isVariable (ue) && (ctype_isFunction (ctype_realType (uentry_getType (ue))) || ctype_isUnknown (uentry_getType (ue)))) { uentry_makeVarFunction (ue); } } static /*@out@*/ /*@notnull@*/ uentry uentry_alloc (void) /*@*/ { uentry ue = (uentry) dmalloc (sizeof (*ue)); ue->warn = warnClause_undefined; nuentries++; totuentries++; return ue; } static cstring uentry_getOptName (uentry p_e) /*@*/ ; static void uentry_updateInto (/*@unique@*/ uentry p_unew, uentry p_old) /*@modifies p_unew, p_old@*/ ; static void uentry_setNullState (/*@notnull@*/ uentry p_ue, nstate p_ns); static void uentry_setAliasKind (/*@notnull@*/ uentry p_ue, alkind p_ak); static /*@only@*/ /*@null@*/ uinfo uinfo_copy (uinfo p_u, ekind p_kind); static void uinfo_free (/*@only@*/ uinfo p_u, ekind p_kind); static void ucinfo_free (/*@only@*/ ucinfo p_u); static void uvinfo_free (/*@only@*/ uvinfo p_u); # ifdef DOANNOTS static /*@only@*/ cstring ancontext_unparse (ancontext an) { switch (an) { case AN_UNKNOWN: return cstring_makeLiteral ("unknown"); case AN_FCNRETURN: return cstring_makeLiteral ("return value"); case AN_FCNPARAM: return cstring_makeLiteral ("function param"); case AN_SUFIELD: return cstring_makeLiteral ("su field"); case AN_TDEFN: return cstring_makeLiteral ("type definition"); case AN_GSVAR: return cstring_makeLiteral ("global/static var"); case AN_CONST: return cstring_makeLiteral ("constant"); BADDEFAULT; } BADEXIT; } static int annots[AN_LAST][QU_LAST]; static int decls[AN_LAST]; static int shdecls[AN_LAST]; static int idecls[AN_LAST]; void initAnnots () { int i, j; for (i = AN_UNKNOWN; i < AN_LAST; i++) { decls[i] = 0; shdecls[i] = 0; idecls[i] = 0; for (j = QU_UNKNOWN; j < QU_LAST; j++) { annots[i][j] = 0; } } } static void tallyAnnot (ancontext ac, qual q) { (annots[ac][q])++; } void printAnnots () { int total[QU_LAST]; int alltotals = 0; int totdecls = 0; int totshdecls = 0; int totidecls = 0; int i, j; for (j = QU_UNKNOWN; j < QU_LAST; j++) { total[j] = 0; } for (i = AN_UNKNOWN; i < AN_LAST; i++) { int tmptot; if (decls[i] > 0) { printf ("Context: %s (%d declarations, %d sharable, %d indirect)\n", ancontext_unparse (i), decls[i], shdecls[i], idecls[i]); totdecls += decls[i]; totshdecls += shdecls[i]; totidecls += idecls[i]; for (j = QU_UNKNOWN; j < QU_LAST; j++) { total[j] += annots[i][j]; alltotals += annots[i][j]; } printf (" Allocation:\n"); tmptot = 0; for (j = QU_UNKNOWN; j < QU_LAST; j++) { if (qual_isAliasQual (j) && !qual_isUnique (j)) { if (annots[i][j] > 0) { printf ("\t%10s: %5d (%3.2f%%)\n", qual_unparse (j), annots[i][j], 100.0 * (double)annots[i][j] / (double)decls[i]); tmptot += annots[i][j]; } } } printf (" Exposure:\n"); tmptot = 0; for (j = QU_UNKNOWN; j < QU_LAST; j++) { if (qual_isExQual (j)) { if (annots[i][j] > 0) { printf ("\t%10s: %5d (%3.2f%%)\n", qual_unparse (j), annots[i][j], 100.0 * (double)annots[i][j] / (double)decls[i]); tmptot += annots[i][j]; } } } printf (" Definition:\n"); for (j = QU_UNKNOWN; j < QU_LAST; j++) { if (qual_isAllocQual (j)) { if (annots[i][j] > 0) { printf ("\t%10s: %5d (%3.2f%%)\n", qual_unparse (j), annots[i][j], 100.0 * (double)annots[i][j] / (double)decls[i]); } } } printf (" Null:\n"); for (j = QU_UNKNOWN; j < QU_LAST; j++) { if (qual_isNull (j) || qual_isNotNull (j) || qual_isRelNull (j)) { if (annots[i][j] > 0) { printf ("\t%10s: %5d (%3.2f%%)\n", qual_unparse (j), annots[i][j], 100.0 * (double)annots[i][j] / (double)decls[i]); } } } printf ("\n"); } } for (j = QU_UNKNOWN; j < QU_LAST; j++) { bool hasone = FALSE; for (i = AN_UNKNOWN; i < AN_LAST; i++) { if (annots[i][j] > 0) { hasone = TRUE; break; } } if (hasone) { printf ("Annotation: %s\n", qual_unparse (j)); for (i = AN_UNKNOWN; i < AN_LAST; i++) { if (annots[i][j] > 0) { printf ("%25s: %5d\n", ancontext_unparse (i), annots[i][j]); } } printf ("\n"); } } printf ("All Contexts\n"); for (j = QU_UNKNOWN; j < QU_LAST; j++) { if (total[j] > 0) { printf ("%10s: %5d (%3.2f%%)\n", qual_unparse (j), total[j], 100.0 * (double)total[j] / (double)(totdecls)); } } printf ("\n"); printf ("Total Annotations: %d (%d decls, %d sharable, %d indirect)\n", alltotals, totdecls, totshdecls, totidecls); } extern void uentry_tallyAnnots (uentry u, ancontext kind) { alkind ak = sRef_getAliasKind (u->sref); exkind ek = sRef_getExKind (u->sref); nstate ns = sRef_getNullState (u->sref); sstate ss = sRef_getDefState (u->sref); bool recordUnknown = FALSE; if (kind == AN_UNKNOWN) { ekind e = u->ukind; if (e == KENDITER) { return; } else if (e == KCONST || e == KENUMCONST) { kind = AN_CONST; } else if (e == KFCN || e == KITER) { uentryList params = uentry_getParams (u); bool hasRet = FALSE; uentryList_elements (params, current) { if (uentry_isReturned (current)) { hasRet = TRUE; } if (!uentry_isElipsisMarker (current)) { uentry_tallyAnnots (current, AN_FCNPARAM); } } end_uentryList_elements; kind = AN_FCNRETURN; if (ctype_isFunction (u->utype) && !hasRet && ctype_isVisiblySharable (ctype_realType (ctype_getReturnType (u->utype)))) { recordUnknown = TRUE; } } else if (e == KDATATYPE || e == KSTRUCTTAG || e == KUNIONTAG || e == KENUMTAG) { ctype t = ctype_realType (u->utype); if (ctype_isSU (t)) { uentryList fields = ctype_getFields (t); uentryList_elements (fields, current) { uentry_tallyAnnots (current, AN_SUFIELD); } } end_uentryList_elements; kind = AN_TDEFN; if (ctype_isVisiblySharable (u->utype)) { recordUnknown = TRUE; } } else { kind = AN_GSVAR; if (ctype_isVisiblySharable (ctype_realType (u->utype))) { recordUnknown = TRUE; } } } decls[kind]++; if (kind == AN_FCNRETURN) { if (recordUnknown) { shdecls[kind]++; idecls[kind]++; } else { ; } } else { if (ctype_isVisiblySharable (ctype_realType (u->utype))) { shdecls[kind]++; } if (ctype_isRealPointer (ctype_realType (u->utype))) { idecls[kind]++; } } switch (ss) { case SS_ALLOCATED: tallyAnnot (kind, QU_OUT); break; case SS_PARTIAL: tallyAnnot (kind, QU_PARTIAL); break; case SS_RELDEF: tallyAnnot (kind, QU_RELDEF); break; case SS_SPECIAL: tallyAnnot (kind, QU_SPECIAL); break; default: break; } if (uentry_isReturned (u)) { tallyAnnot (kind, QU_RETURNED); } switch (ak) { case AK_UNKNOWN: if (ctype_isRefCounted (ctype_realType (u->utype)) || (ctype_isFunction (u->utype) && ctype_isRefCounted (ctype_realType (ctype_getReturnType (u->utype))))) { ; } else { if (kind == AN_FCNPARAM) { tallyAnnot (kind, QU_TEMP); } else if (recordUnknown) { if (kind == AN_FCNRETURN) { } tallyAnnot (kind, QU_UNKNOWN); } } break; case AK_ONLY: tallyAnnot (kind, QU_ONLY); break; case AK_IMPONLY: tallyAnnot (kind, QU_ONLY); break; case AK_KEEP: tallyAnnot (kind, QU_KEEP); break; case AK_KEPT: tallyAnnot (kind, QU_KEPT); break; case AK_IMPTEMP: case AK_TEMP: tallyAnnot (kind, QU_TEMP); break; case AK_SHARED: tallyAnnot (kind, QU_SHARED); break; case AK_UNIQUE: tallyAnnot (kind, QU_UNIQUE); break; case AK_RETURNED: tallyAnnot (kind, QU_RETURNED); break; case AK_REFCOUNTED: tallyAnnot (kind, QU_UNKNOWN); break; case AK_REFS: tallyAnnot (kind, QU_REFS); break; case AK_KILLREF: tallyAnnot (kind, QU_KILLREF); break; case AK_NEWREF: tallyAnnot (kind, QU_NEWREF); break; case AK_OWNED: tallyAnnot (kind, QU_OWNED); break; case AK_IMPDEPENDENT: case AK_DEPENDENT: tallyAnnot (kind, QU_DEPENDENT); break; case AK_ERROR: case AK_FRESH: case AK_STACK: case AK_LOCAL: break; } switch (ek) { case XO_EXPOSED: tallyAnnot (kind, QU_EXPOSED); break; case XO_OBSERVER: tallyAnnot (kind, QU_OBSERVER); break; default: break; } switch (ns) { case NS_ERROR: break; case NS_UNKNOWN: break; case NS_NOTNULL: break; case NS_MNOTNULL: tallyAnnot (kind, QU_NOTNULL); break; case NS_RELNULL: tallyAnnot (kind, QU_RELNULL); break; case NS_CONSTNULL: tallyAnnot (kind, QU_NULL); break; case NS_POSNULL: tallyAnnot (kind, QU_NULL); break; case NS_DEFNULL: case NS_ABSNULL: break; } } # endif static /*@observer@*/ cstring specCode_unparse (specCode s) /*@*/ { switch (s) { case SPC_NONE: return cstring_makeLiteralTemp ("normal"); case SPC_PRINTFLIKE: return cstring_makeLiteralTemp ("printflike"); case SPC_SCANFLIKE: return cstring_makeLiteralTemp ("scanflike"); case SPC_MESSAGELIKE: return cstring_makeLiteralTemp ("messagelike"); case SPC_LAST: return cstring_makeLiteralTemp (""); } BADEXIT; } static specCode specCode_fromInt (int i) { /*@+enumint@*/ llassert (i >= SPC_NONE && i < SPC_LAST); return ((specCode) i); /*@=enumint@*/ } /*@observer@*/ cstring uentry_specOrDefName (uentry u) { if (uentry_isDeclared (u)) { return cstring_makeLiteralTemp ("previously declared"); } else { return cstring_makeLiteralTemp ("specified"); } } /*@observer@*/ cstring uentry_specDeclName (uentry u) { if (uentry_isDeclared (u)) { return cstring_makeLiteralTemp ("previous declaration"); } else { return cstring_makeLiteralTemp ("specification"); } } static /*@observer@*/ cstring uentry_reDefDecl (uentry old, uentry unew) /*@*/ { if (uentry_isCodeDefined (old) && uentry_isCodeDefined (unew)) { return cstring_makeLiteralTemp ("redefined"); } else if (uentry_isCodeDefined (unew)) { return cstring_makeLiteralTemp ("defined"); } else if (uentry_isDeclared (old) && uentry_isDeclared (unew)) { return cstring_makeLiteralTemp ("redeclared"); } else { return cstring_makeLiteralTemp ("declared"); } } static constraintList uentry_getFunctionConditions (uentry ue, bool isPost) { if (uentry_isValid (ue)) { functionConstraint constraint; DPRINTF((message ("called uentry_getFcnPostconditions on %s", uentry_unparse (ue) ) ) ); if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue))) { DPRINTF((message ("called uentry_getFunctionConditions on nonfunction %s", uentry_unparse (ue) ) ) ); if (!uentry_isFunction (ue) ) { DPRINTF((message ("called uentry_getFunctionConditions on nonfunction %s", uentry_unparse (ue) ) )); return constraintList_undefined; } return constraintList_undefined; } if (!uentry_isFunction(ue)) { DPRINTF((message ("called uentry_getFunctionConditions on non function %s", uentry_unparse (ue) ) ) ); return constraintList_undefined; } llassert (uentry_isFunction (ue)); if (isPost) { constraint = ue->info->fcn->postconditions; } else { constraint = ue->info->fcn->preconditions; } return functionConstraint_getBufferConstraints (constraint); } return constraintList_undefined; } /*drl7x*/ /*@only@*/ constraintList uentry_getFcnPreconditions (uentry ue) { return uentry_getFunctionConditions (ue, FALSE); } /*drl 12/28/2000 */ constraintList uentry_getFcnPostconditions (uentry ue) { return uentry_getFunctionConditions (ue, TRUE); } static /*@only@*/ fileloc setLocation (void) { fileloc fl = context_getSaveLocation (); if (fileloc_isDefined (fl)) { return fl; } else { return fileloc_copy (g_currentloc); } } static void uentry_setConstantValue (uentry ue, /*@only@*/ multiVal val) { llassert (uentry_isEitherConstant (ue)); sRef_setValue (ue->sref, val); } /*@notnull@*/ uentry uentry_makeEnumConstant (cstring n, ctype t) { fileloc loc = setLocation (); uentry ue = uentry_makeConstant (n, t, loc); ue->ukind = KENUMCONST; uentry_setDefined (ue, loc); return ue; } /*@notnull@*/ uentry uentry_makeEnumInitializedConstant (cstring n, ctype t, exprNode expr) { fileloc loc = setLocation (); uentry ue = uentry_makeConstant (n, t, loc); ctype etype = exprNode_getType (expr); if (!ctype_isRealInt (etype)) { voptgenerror (FLG_ENUMMEMBERS, message ("Value of enum member is not an integeral type (type %s): %s", ctype_unparse (etype), exprNode_unparse (expr)), exprNode_loc (expr)); } ue->ukind = KENUMCONST; uentry_setDefined (ue, loc); return ue; } /*@notnull@*/ uentry uentry_makeSpecEnumConstant (cstring n, ctype t, fileloc loc) { uentry ue = uentry_makeConstant (n, t, loc); ue->ukind = KENUMCONST; return ue; } /*@notnull@*/ uentry uentry_makeVariableLoc (cstring n, ctype t) { return uentry_makeVariable (n, t, setLocation (), FALSE); } bool uentry_isUnnamedVariable (uentry ue) { return uentry_isVariable (ue) && cstring_isUndefined (ue->uname); } /*@notnull@*/ /*@only@*/ uentry uentry_makeUnnamedVariable (ctype t) { return uentry_makeVariable (cstring_undefined, t, setLocation (), FALSE); } /*@notnull@*/ uentry uentry_makeIdDatatype (idDecl id) { ctype ct = idDecl_getCtype (id); uentry ue = uentry_makeDatatype (idDecl_observeId (id), ct, MAYBE, qual_createUnknown (), setLocation ()); uentry_reflectQualifiers (ue, idDecl_getQuals (id)); if (!qual_isEitherAbstract (ue->info->datatype->abs)) { if (ctype_isUnknown (ct)) { ue->info->datatype->mut = MAYBE; } else { ue->info->datatype->mut = ynm_fromBool (ctype_isMutable (ct)); } } return ue; } void uentry_checkParams (uentry ue) { if (uentry_isValid (ue)) { bool isExt = uentry_isExtern (ue); if (uentry_isRealFunction (ue)) { uentryList params = uentry_getParams (ue); int paramno = 0; uentryList_elements (params, current) { paramno++; if (uentry_isValid (current)) { ctype ct = current->utype; if (ctype_isFixedArray (ct)) { DPRINTF (("Array: %s / %s", ctype_unparse (ct), ctype_unparse (ctype_baseArrayPtr (ct)))); if (ctype_isArray (ctype_baseArrayPtr (ct)) && !ctype_isFixedArray (ctype_baseArrayPtr (ct))) { ; } else { if (uentry_hasName (current)) { voptgenerror (FLG_FIXEDFORMALARRAY, message ("Function parameter %q declared as " "manifest array (size constant is meaningless)", uentry_getName (current)), uentry_whereDeclared (current)); } else { voptgenerror (FLG_FIXEDFORMALARRAY, message ("Unnamed function parameter %d declared as " "manifest array (size constant is meaningless)", paramno), uentry_whereDeclared (current)); } } } else { if (ctype_isArray (ct)) { if (uentry_hasName (current)) { voptgenerror (FLG_FORMALARRAY, message ("Function parameter %q declared as " "array (treated as pointer)", uentry_getName (current)), uentry_whereDeclared (current)); } else { voptgenerror (FLG_FORMALARRAY, message ("Unnamed function parameter %d declared as " "array (treated as pointer)", paramno), uentry_whereDeclared (current)); } } } if (sRef_getNullState (uentry_getSref (current)) == NS_MNOTNULL) { if (ctype_isAbstract (ct) && (isExt || (ctype_isAbstract (ctype_realType (ct)) && !context_hasFileAccess (ctype_typeId (ct))))) { vgenhinterror (FLG_INCONDEFS, message ("Function %q declared with notnull parameter %q of abstract " "type %s", uentry_getName (ue), uentry_getName (current), ctype_unparse (ct)), message ("Since %s is an abstract type, notnull can only be " "used for parameters if the function is static to a " "module where %s is accessible.", ctype_unparse (ct), ctype_unparse (ct)), uentry_whereDeclared (current)); } } } } end_uentryList_elements; if (sRef_getNullState (uentry_getSref (ue)) == NS_MNOTNULL) { ctype ct = ue->utype; if (ctype_isAbstract (ct) && (isExt || (ctype_isAbstract (ctype_realType (ct)) && !context_hasFileAccess (ctype_typeId (ct))))) { vgenhinterror (FLG_INCONDEFS, message ("%s %q declared %s notnull storage of abstract type %s", ekind_capName (uentry_getKind (ue)), uentry_getName (ue), fcnErrName (ue), ctype_unparse (ct)), message ("Since %s is an abstract type, notnull can only be used " "if it is static to a module where %s is accessible.", ctype_unparse (ct), ctype_unparse (ct)), uentry_whereDeclared (ue)); } } } } } static void reflectImplicitFunctionQualifiers (/*@notnull@*/ uentry ue, bool spec) { alkind ak = sRef_getAliasKind (ue->sref); if (alkind_isRefCounted (ak)) { sRef_setAliasKind (ue->sref, AK_NEWREF, fileloc_undefined); } else { if (alkind_isUnknown (ak)) { exkind ek = sRef_getExKind (ue->sref); if (exkind_isKnown (ek)) { DPRINTF (("Setting imp dependent: %s", uentry_unparseFull (ue))); sRef_setAliasKind (ue->sref, AK_IMPDEPENDENT, fileloc_undefined); } else { if (context_getFlag (spec ? FLG_SPECRETIMPONLY : FLG_RETIMPONLY)) { /* evans 2000-12-22 removed ctype_realType so it will not apply to immutable abstract types. */ if (ctype_isVisiblySharable (ctype_realType (ctype_getReturnType (ue->utype)))) { if (uentryList_hasReturned (uentry_getParams (ue))) { ; } else { if (ctype_isImmutableAbstract (ctype_getReturnType (ue->utype)) || ctype_isNumAbstract (ctype_getReturnType (ue->utype))) { ; /* Immutable objects are not shared. */ } else { sRef_setAliasKind (ue->sref, AK_IMPONLY, fileloc_undefined); DPRINTF (("Ret imp only: %s", ctype_unparse (ctype_getReturnType (ue->utype)))); } } } } } } } } static /*@notnull@*/ uentry uentry_makeFunctionAux (cstring n, ctype t, typeIdSet access, /*@only@*/ globSet globs, /*@only@*/ sRefSet mods, /*@only@*/ warnClause warn, /*@keep@*/ fileloc f, bool priv, /*@unused@*/ bool isForward) { uentry e = uentry_alloc (); ctype ret; llassert (warnClause_isUndefined (warn)); if (ctype_isFunction (t)) { ret = ctype_getReturnType (t); } else { if (ctype_isKnown (t)) { llbug (message ("not function: %s", ctype_unparse (t))); } ret = ctype_unknown; } e->ukind = KFCN; if (fileloc_isSpec (f) || fileloc_isImport (f)) { e->whereSpecified = f; e->whereDeclared = fileloc_undefined; } else { e->whereSpecified = fileloc_undefined; e->whereDeclared = f; } /* e->shallowCopy = FALSE; */ e->uname = cstring_copy (n); e->utype = t; e->storageclass = SCNONE; e->sref = sRef_makeResult (ret); /* evans 2001-07-19 - was sRef_makeType */ DPRINTF (("Result: %s", sRef_unparseFull (e->sref))); if (ctype_isUA (ret)) { sRef_setStateFromType (e->sref, ret); } e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->isPrivate = priv; e->hasNameError = FALSE; e->warn = warn; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->fcn = (ufinfo) dmalloc (sizeof (*e->info->fcn)); e->info->fcn->hasMods = sRefSet_isDefined (mods); e->info->fcn->hasGlobs = globSet_isDefined (globs); e->info->fcn->exitCode = XK_UNKNOWN; e->info->fcn->nullPred = qual_createUnknown (); e->info->fcn->specialCode = SPC_NONE; e->info->fcn->access = access; e->info->fcn->globs = globs; e->info->fcn->defparams = uentryList_undefined; sRef_setDefined (e->sref, f); e->whereDefined = fileloc_undefined; e->info->fcn->mods = sRefSet_undefined; e->info->fcn->specclauses = NULL; /*drl 11 29 2000*/ e->info->fcn->preconditions = NULL; /*end drl*/ /*drl 12 28 2000*/ e->info->fcn->postconditions = NULL; /*end drl*/ checkGlobalsModifies (e, mods); e->info->fcn->mods = mods; return (e); } static void uentry_reflectClauses (uentry ue, functionClauseList clauses) { functionClauseList_elements (clauses, el) { DPRINTF (("Reflect clause: %s on %s", functionClause_unparse (el), uentry_getName (ue))); if (functionClause_isNoMods (el)) { modifiesClause mel = functionClause_getModifies (el); if (uentry_hasGlobs (ue)) { voptgenerror (FLG_SYNTAX, message ("No globals and modifies inconsistent to globals clause for %q: %q", uentry_getName (ue), globSet_unparse (uentry_getGlobs (ue))), modifiesClause_getLoc (mel)); } if (uentry_hasMods (ue)) { voptgenerror (FLG_SYNTAX, message ("No globals and modifies inconsistent to modifies clause for %q: %q", uentry_getName (ue), sRefSet_unparse (uentry_getMods (ue))), modifiesClause_getLoc (mel)); } uentry_setGlobals (ue, globSet_undefined); uentry_setModifies (ue, sRefSet_undefined); } else if (functionClause_isGlobals (el)) { globalsClause glc = functionClause_getGlobals (el); DPRINTF (("Globals: %s / %s", uentry_unparse (ue), globalsClause_unparse (glc))); if (uentry_hasGlobs (ue)) { vgenhinterror (FLG_SYNTAX, message ("Multiple globals clauses for %q: %q", uentry_getName (ue), globalsClause_unparse (glc)), cstring_makeLiteral ("Only one globals clause may be used. The second globals clause is ignored."), globalsClause_getLoc (glc)); /* uentry_setGlobals (ue, globalsClause_takeGlobs (glc)); */ } else { DPRINTF (("Taking globs: %s", globalsClause_unparse (glc))); uentry_setGlobals (ue, globalsClause_takeGlobs (glc)); DPRINTF (("Taking globs after: %s", globalsClause_unparse (glc))); } } else if (functionClause_isModifies (el)) { modifiesClause mlc = functionClause_getModifies (el); DPRINTF (("Has modifies: %s", uentry_unparseFull (ue))); if (uentry_hasMods (ue)) { /* ** Not an error: if (optgenerror (FLG_SYNTAX, message ("Multiple modifies clauses for %s: %s", uentry_getName (ue), modifiesClause_unparse (mlc)), modifiesClause_getLoc (mlc))) { llhint (message ("Previous modifies clause: ", sRefSet_unparse (uentry_getMods (ue)))); } ** */ uentry_combineModifies (ue, modifiesClause_takeMods (mlc)); } else { uentry_setModifies (ue, modifiesClause_takeMods (mlc)); } } else if (functionClause_isEnsures (el)) { functionConstraint cl = functionClause_takeEnsures (el); DPRINTF (("Setting post: %s / %s", uentry_unparse (ue), functionConstraint_unparse (cl))); uentry_setPostconditions (ue, cl); } else if (functionClause_isRequires (el)) { functionConstraint cl = functionClause_takeRequires (el); uentry_setPreconditions (ue, cl); } else if (functionClause_isState (el)) { stateClause sc = functionClause_takeState (el); if (stateClause_isBefore (sc) && stateClause_setsMetaState (sc)) { sRefSet rfs = stateClause_getRefs (sc); sRefSet_elements (rfs, s) { if (sRef_isParam (s)) { /* ** Can't use requires on parameters */ voptgenerror (FLG_ANNOTATIONERROR, message ("Requires clauses for %q concerns parameters %q should be " "a parameter annotation instead: %q", uentry_unparse (ue), sRef_unparse (s), stateClause_unparse (sc)), stateClause_loc (sc)); } } end_sRefSet_elements ; } DPRINTF (("State clause: %s", stateClause_unparse (sc))); uentry_addStateClause (ue, sc); } else if (functionClause_isWarn (el)) { warnClause wc = functionClause_takeWarn (el); uentry_addWarning (ue, wc); } else { DPRINTF (("Unhandled clause: %s", functionClause_unparse (el))); } } end_functionClauseList_elements ; DPRINTF (("Checking all: %s", sRef_unparseFull (ue->sref))); stateClauseList_checkAll (ue); } /*@notnull@*/ uentry uentry_makeIdFunction (idDecl id) { bool leaveFunc = FALSE; uentry ue = uentry_makeFunction (idDecl_observeId (id), idDecl_getCtype (id), typeId_invalid, globSet_undefined, sRefSet_undefined, warnClause_undefined, setLocation ()); DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref))); /* ** This makes parameters names print out correctly. ** (But we might be a local variable declaration for a function type...) */ if (context_inFunctionLike ()) { DPRINTF (("Header: %s / %s", uentry_unparse (context_getHeader ()), idDecl_unparse (id))); } else { context_enterFunctionDeclaration (ue); leaveFunc = TRUE; } DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref))); uentry_reflectQualifiers (ue, idDecl_getQuals (id)); DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref))); reflectImplicitFunctionQualifiers (ue, FALSE); DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref))); uentry_reflectClauses (ue, idDecl_getClauses (id)); DPRINTF (("Id function: %s", sRef_unparseFull (ue->sref))); if (!uentry_isStatic (ue) && cstring_equalLit (ue->uname, "main")) { ctype typ = ue->utype; ctype retval; uentryList args; llassert (ctype_isFunction (typ)); retval = ctype_getReturnType (typ); if (!ctype_isInt (retval)) { voptgenerror (FLG_MAINTYPE, message ("Function main declared to return %s, should return int", ctype_unparse (retval)), uentry_whereDeclared (ue)); } args = ctype_argsFunction (typ); if (uentryList_isMissingParams (args) || uentryList_size (args) == 0) { ; } else { if (uentryList_size (args) != 2) { voptgenerror (FLG_MAINTYPE, message ("Function main declared with %d arg%&, " "should have 2 (int argc, char *argv[])", uentryList_size (args)), uentry_whereLast (ue)); } else { uentry arg = uentryList_getN (args, 0); ctype ct = uentry_getType (arg); if (!ctype_isInt (ct)) { voptgenerror (FLG_MAINTYPE, message ("Parameter 1, %q, of function main declared " "with type %t, should have type int", uentry_getName (arg), ct), uentry_whereDeclared (arg)); } arg = uentryList_getN (args, 1); ct = uentry_getType (arg); if (ctype_isArrayPtr (ct) && ctype_isArrayPtr (ctype_baseArrayPtr (ct)) && ctype_isChar (ctype_baseArrayPtr (ctype_baseArrayPtr (ct)))) { ; } else { voptgenerror (FLG_MAINTYPE, message ("Parameter 2, %q, of function main declared " "with type %t, should have type char **", uentry_getName (arg), ct), uentry_whereDeclared (arg)); } } } } if (leaveFunc) { context_exitFunctionDeclaration (); } return ue; } static void uentry_implicitParamAnnots (/*@notnull@*/ uentry e) { alkind ak = sRef_getAliasKind (e->sref); if ((alkind_isUnknown (ak) || alkind_isImplicit (ak)) && context_getFlag (FLG_PARAMIMPTEMP)) { exkind ek = sRef_getExKind (e->sref); if (exkind_isKnown (ek)) { DPRINTF (("imp dep: %s", uentry_unparseFull (e))); sRef_setAliasKind (e->sref, AK_IMPDEPENDENT, fileloc_undefined); sRef_setOrigAliasKind (e->sref, AK_IMPDEPENDENT); } else { sRef_setAliasKind (e->sref, AK_IMPTEMP, fileloc_undefined); sRef_setOrigAliasKind (e->sref, AK_IMPTEMP); } } } static /*@only@*/ /*@notnull@*/ uentry uentry_makeVariableParamAux (cstring n, ctype t, /*@dependent@*/ sRef s, /*@only@*/ fileloc loc, sstate defstate) { cstring pname = makeParam (n); uentry e; DPRINTF (("Sref: %s", sRef_unparseFull (s))); e = uentry_makeVariableAux (pname, t, loc, s, FALSE, VKPARAM); cstring_free (pname); DPRINTF (("Param: %s", uentry_unparseFull (e))); uentry_implicitParamAnnots (e); DPRINTF (("Param: %s", uentry_unparseFull (e))); if (!sRef_isAllocated (e->sref) && !sRef_isPartial (e->sref)) { DPRINTF (("Param: %s", uentry_unparseFull (e))); sRef_setDefState (e->sref, defstate, uentry_whereDeclared (e)); e->info->var->defstate = defstate; } DPRINTF (("Param: %s", uentry_unparseFull (e))); return (e); } void uentry_setRefCounted (uentry e) { if (uentry_isValid (e)) { uentry_setAliasKind (e, AK_REFCOUNTED); sRef_storeState (e->sref); } } void uentry_setStatic (uentry c) { if (uentry_isValid (c)) { alkind ak = sRef_getAliasKind (c->sref); c->storageclass = SCSTATIC; if (uentry_isVariable (c) && !ctype_isFunction (uentry_getType (c))) { if (!alkind_isUnknown (ak) && !alkind_isStatic (ak)) { if (!(ctype_isRealPointer (uentry_getType (c))) && !(ctype_isAbstract (ctype_realType (uentry_getType (c)))) && !alkind_isRefCounted (ak)) { if (alkind_isImplicit (ak) && alkind_isDependent (ak) && ctype_isArray (uentry_getType (c))) { ; /* no error for observer arrays */ } else { voptgenerror (FLG_INCONDEFS, message ("Static storage %q declared as %s", uentry_getName (c), alkind_unparse (ak)), uentry_whereDeclared (c)); } } } else { if (alkind_isUnknown (ak) || (alkind_isImplicit (sRef_getAliasKind (c->sref)) && !alkind_isDependent (sRef_getAliasKind (c->sref)))) { sRef_setAliasKind (c->sref, AK_STATIC, fileloc_undefined); sRef_setOrigAliasKind (c->sref, AK_STATIC); } } } } } void uentry_setExtern (uentry c) { if (uentry_isValid (c)) c->storageclass = SCEXTERN; } void uentry_setParamNo (uentry ue, int pno) { llassert (uentry_isAnyParam (ue) && sRef_isParam (ue->sref)); sRef_setParamNo (ue->sref, pno); } static void checkGlobalsModifies (/*@notnull@*/ uentry ue, sRefSet sr) { sRefSet_allElements (sr, el) { sRef base = sRef_getRootBase (el); if (sRef_isFileOrGlobalScope (base) || sRef_isInternalState (base) || (sRef_isKindSpecial (base) && !sRef_isNothing (base))) { if (!globSet_member (ue->info->fcn->globs, base)) { if (uentry_hasGlobs (ue) || context_getFlag (FLG_WARNMISSINGGLOBALSNOGLOBS)) { if (optgenerror (FLG_WARNMISSINGGLOBALS, message ("Modifies list for %q uses global %q, " "not included in globals list.", uentry_getName (ue), sRef_unparse (base)), uentry_whereLast (ue))) { uentry_showWhereSpecified (ue); } } ue->info->fcn->globs = globSet_insert (ue->info->fcn->globs, base); if (sRef_isFileStatic (base)) { context_recordFileGlobals (ue->info->fcn->globs); } } } } end_sRefSet_allElements; } uentry uentry_makeVariableSrefParam (cstring n, ctype t, /*@only@*/ fileloc loc, /*@exposed@*/ sRef s) { return (uentry_makeVariableParamAux (n, t, s, loc, SS_UNKNOWN)); } void uentry_fixupSref (uentry ue) { sRef sr; if (uentry_isUndefined (ue) || uentry_isElipsisMarker (ue)) { return; } sr = uentry_getSref (ue); sRef_resetState (sr); sRef_clearDerived (sr); llassertprint (uentry_isVariable (ue), ("fixing: %s", uentry_unparseFull (ue))); llassert (sRef_isValid (sr)); if (uentry_isVariable (ue)) { /* removed this: no need to copy? ue->sref = sRef_saveCopyShallow (ue->info->var->origsref); */ sRef_setDefState (sr, ue->info->var->defstate, fileloc_undefined); sRef_setNullState (sr, ue->info->var->nullstate, fileloc_undefined); } } static void uentry_addStateClause (/*@notnull@*/ uentry ue, stateClause sc) { /* ** Okay to allow multiple clauses of the same kind. */ ue->info->fcn->specclauses = stateClauseList_add (ue->info->fcn->specclauses, sc); /* Will call checkAll to check later... */ } void uentry_setStateClauseList (uentry ue, stateClauseList clauses) { llassert (uentry_isFunction (ue)); llassert (!stateClauseList_isDefined (ue->info->fcn->specclauses)); DPRINTF (("checked clauses: %s", stateClauseList_unparse (clauses))); ue->info->fcn->specclauses = clauses; stateClauseList_checkAll (ue); DPRINTF (("checked clauses: %s", uentry_unparseFull (ue))); } /* ** Used for @modifies@ @endmodifies@ syntax. ** ** If ue is specified, sr must contain *only*: ** ** o file static globals ** o sRef's derived from modifies spec (i.e., more specific than ** what was specified) ** ** Otherwise, if sr has modifies it must match sr. ** ** If it doesn't have modifies, set them to sr. */ static bool uentry_checkModifiesContext (void) { if (sRef_modInFunction ()) { llparseerror (message ("Modifies list not in function context. " "A modifies list can only appear following the parameter list " "in a function declaration or header.")); return FALSE; } return TRUE; } void uentry_setModifies (uentry ue, /*@owned@*/ sRefSet sr) { if (!uentry_checkModifiesContext ()) { sRefSet_free (sr); return; } if (uentry_isValid (ue)) { if (uentry_isIter (ue)) { llassert (sRefSet_isUndefined (ue->info->iter->mods)); ue->info->iter->mods = sr; } else { uentry_convertVarFunction (ue); llassertfatal (uentry_isFunction (ue)); llassert (sRefSet_isUndefined (ue->info->fcn->mods)); ue->info->fcn->mods = sr; ue->info->fcn->hasMods = TRUE; checkGlobalsModifies (ue, sr); } if (context_getFlag (FLG_MODIFIESIMPNOGLOBALS)) { ue->info->fcn->hasGlobs = TRUE; } if (sRefSet_hasStatic (ue->info->fcn->mods)) { context_recordFileModifies (ue->info->fcn->mods); } } else { sRefSet_free (sr); } } static void uentry_combineModifies (uentry ue, /*@owned@*/ sRefSet sr) { /* ** Function already has one modifies clause (possibly from ** a specification). */ if (!uentry_checkModifiesContext ()) { BADBRANCH; } llassert (uentry_isValid (ue)); if (uentry_isIter (ue)) { ue->info->iter->mods = sRefSet_unionFree (ue->info->iter->mods, sr); } else { llassertfatal (uentry_isFunction (ue)); llassert (ue->info->fcn->hasMods); checkGlobalsModifies (ue, sr); ue->info->fcn->mods = sRefSet_unionFree (ue->info->fcn->mods, sr); if (context_getFlag (FLG_MODIFIESIMPNOGLOBALS)) { ue->info->fcn->hasGlobs = TRUE; } } if (sRefSet_hasStatic (ue->info->fcn->mods)) { context_recordFileModifies (ue->info->fcn->mods); } } bool uentry_hasWarning (uentry ue) { return (uentry_isValid (ue) && warnClause_isDefined (ue->warn)); } void uentry_addWarning (uentry ue, /*@only@*/ warnClause warn) { llassert (uentry_isValid (ue)); llassert (warnClause_isUndefined (ue->warn)); ue->warn = warn; } void uentry_setPreconditions (uentry ue, /*@only@*/ functionConstraint preconditions) { if (sRef_modInFunction ()) { llparseerror (message ("Precondition list not in function context. " "A precondition list can only appear following the parameter list " "in a function declaration or header.")); /*@-mustfree@*/ return; /*@=mustfree@*/ } if (uentry_isValid (ue)) { uentry_convertVarFunction (ue); llassertfatal (uentry_isFunction (ue)); if (functionConstraint_isDefined (ue->info->fcn->preconditions)) { /*drl oops this date is wronge...*/ /* drl 11-29-2002 I changed this so it didn't appear as a Splint bug among other things this gets triggered when there is a function with two requires clauses. Now Splint prints an error and tries to conjoin the lists. */ llparseerror (message ("Duplicate precondition list" "Attemping the conjoin the requires clauses" )); /* should conjoin constraints? */ /*@notreached@*/ ue->info->fcn->preconditions = functionConstraint_conjoin (ue->info->fcn->preconditions, preconditions); } else { ue->info->fcn->preconditions = preconditions; } } else { llfatalbug ((message("uentry_setPreconditions called with invalid uentry") )); } } /* drl added 12/28/2000 */ void uentry_setPostconditions (uentry ue, /*@only@*/ functionConstraint postconditions) { if (sRef_modInFunction ()) { llparseerror (message ("Postcondition list not in function context. " "A postcondition list can only appear following the parameter list " "in a function declaration or header.")); /*@-mustfree@*/ return; /*@=mustfree@*/ } if (uentry_isValid (ue)) { uentry_convertVarFunction (ue); llassertfatal (uentry_isFunction (ue)); if (functionConstraint_isUndefined (ue->info->fcn->postconditions)) { ue->info->fcn->postconditions = postconditions; } else { ue->info->fcn->postconditions = functionConstraint_conjoin (ue->info->fcn->postconditions, postconditions); } } else { llfatalbug ((message("uentry_setPostconditions called with invalid uentry") )); } } /* ** requires: new and old are functions */ static void checkGlobalsConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { bool hasInternalState = FALSE; old->info->fcn->hasGlobs |= unew->info->fcn->hasGlobs; if (globSet_isDefined (unew->info->fcn->globs)) { globSet_allElements (unew->info->fcn->globs, el) { if (sRef_isFileStatic (el)) { sRef sr = globSet_lookup (old->info->fcn->globs, el); if (sRef_isInvalid (sr)) { bool hasError = FALSE; if (!hasInternalState && sRef_isInvalid (globSet_lookup (old->info->fcn->globs, sRef_makeInternalState ())) && sRef_isInvalid (globSet_lookup (old->info->fcn->globs, sRef_makeSpecState ()))) { if (mustConform && !uentry_isStatic (old) && optgenerror (FLG_INCONDEFS, message ("Globals list for %q includes internal state, %q, " "but %s without globals internalState.", uentry_getName (old), sRef_unparse (el), uentry_specOrDefName (old)), uentry_whereLast (unew))) { uentry_showWhereSpecified (old); hasError = TRUE; } old->info->fcn->globs = globSet_insert (old->info->fcn->globs, sRef_makeInternalState ()); hasInternalState = TRUE; } if (!hasError && fileloc_sameFile (uentry_whereDeclared (unew), uentry_whereDeclared (old))) { if (mustConform && optgenerror (FLG_INCONDEFS, message ("Function %q inconsistently %rdeclared (in " "same file) with file static global %q in " "globals list", uentry_getName (unew), uentry_isDeclared (old), sRef_unparse (el)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } } old->info->fcn->globs = globSet_insert (old->info->fcn->globs, el); context_recordFileGlobals (old->info->fcn->globs); } else { sRef sr = globSet_lookup (old->info->fcn->globs, el); if (sRef_isInvalid (sr)) { if (mustConform && optgenerror (FLG_INCONDEFS, message ("Function %q inconsistently %rdeclared with " "%q in globals list", uentry_getName (unew), uentry_isDeclared (old), sRef_unparse (el)), uentry_whereDeclared (unew))) { old->info->fcn->globs = globSet_insert (old->info->fcn->globs, el); uentry_showWhereSpecified (old); } } else { if (!bool_equal (sRef_isAllocated (el), sRef_isAllocated (sr))) { if (mustConform && optgenerror (FLG_INCONDEFS, message ("Function %q global %q inconsistently " "%rdeclared as %qout global", uentry_getName (unew), sRef_unparse (el), uentry_isDeclared (old), cstring_makeLiteral (sRef_isAllocated (el) ? "" : "non-")), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } } } } end_globSet_allElements ; if (completeConform) { globSet_allElements (old->info->fcn->globs, el) { sRef sr = globSet_lookup (unew->info->fcn->globs, el); if (sRef_isInvalid (sr)) { if (mustConform && uentry_isReallySpecified (old) && optgenerror (FLG_NEEDSPEC, message ("Function %q specified with %q in globals list, " "but declared without %q", uentry_getName (unew), sRef_unparse (el), sRef_unparse (el)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } } end_globSet_allElements; } } else { if (completeConform && !globSet_isEmpty (old->info->fcn->globs)) { if (uentry_isReallySpecified (old) && optgenerror (FLG_NEEDSPEC, message ("%s %q specified with globals list, but " "declared with no globals", ekind_capName (unew->ukind), uentry_getName (unew)), uentry_whereDeclared (unew))) { llgenindentmsg (message ("Specification globals: %q", globSet_unparse (old->info->fcn->globs)), uentry_whereSpecified (old)); } } unew->info->fcn->globs = globSet_copyInto (unew->info->fcn->globs, old->info->fcn->globs); } } /* ** new modifies list must be included by old modifies list. ** ** file static state may be added to new, if old has internal. */ static void checkModifiesConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { sRefSet newMods; bool changedMods = FALSE; bool modInternal = FALSE; llassert (uentry_isFunction (old) && uentry_isFunction (unew)); old->info->fcn->hasMods |= unew->info->fcn->hasMods; newMods = unew->info->fcn->mods; if (sRefSet_isEmpty (newMods)) { if (completeConform && !sRefSet_isEmpty (old->info->fcn->mods) && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("%s %q specified with modifies clause, " "but declared with no modifies clause", ekind_capName (unew->ukind), uentry_getName (unew)), uentry_whereDeclared (unew))) { llgenindentmsg (message ("Specification has modifies %q", sRefSet_unparse (old->info->fcn->mods)), uentry_whereSpecified (old)); } } return; } sRefSet_allElements (newMods, current) { if (sRef_isValid (current)) { sRef rb = sRef_getRootBase (current); if (sRef_isFileStatic (rb)) { if (!modInternal) { if (!sRefSet_isSameMember (old->info->fcn->mods, sRef_makeInternalState ()) && !sRefSet_isSameMember (old->info->fcn->mods, sRef_makeSpecState ())) { if (mustConform && !uentry_isStatic (old) && optgenerror (FLG_INCONDEFS, message ("Modifies list for %q includes internal state, " "but %s without modifies internal.", uentry_getName (old), uentry_specOrDefName (old)), uentry_whereLast (unew))) { uentry_showWhereSpecified (old); } old->info->fcn->mods = sRefSet_insert (old->info->fcn->mods, sRef_makeInternalState ()); modInternal = TRUE; } } old->info->fcn->mods = sRefSet_insert (old->info->fcn->mods, current); changedMods = TRUE; } else { if (sRef_canModifyVal (current, old->info->fcn->mods)) { int size = sRefSet_size (old->info->fcn->mods); old->info->fcn->mods = sRefSet_insert (old->info->fcn->mods, current); if (sRefSet_size (old->info->fcn->mods) != size) { changedMods = TRUE; } } else { if (mustConform && optgenerror (FLG_INCONDEFS, message ("Modifies list for %q contains %q, not modifiable " "according to %s", uentry_getName (old), sRef_unparse (current), uentry_specDeclName (old)), uentry_whereLast (unew))) { uentry_showWhereSpecified (old); } } } } } end_sRefSet_allElements; if (completeConform && uentry_isReallySpecified (old)) { sRefSet_allElements (old->info->fcn->mods, el) { if (sRef_canModify (el, newMods)) { ; /* okay */ } else { if (optgenerror (FLG_NEEDSPEC, message ("Specification modifies clause for %q contains %q, " "not included in declaration modifies clause", uentry_getName (old), sRef_unparse (el)), uentry_whereLast (unew))) { uentry_showWhereSpecified (old); } } } end_sRefSet_allElements ; } /* ** Make sure file static elements will be removed. */ if (changedMods) { context_recordFileModifies (old->info->fcn->mods); } } static void uentry_checkMutableType (uentry ue) { ctype ct = uentry_getType (ue); if (!ctype_isRealPointer (ct) && !ctype_isRealAbstract (ct)) { DPRINTF (("Check mutable: %s", uentry_unparseFull (ue))); voptgenerror (FLG_MUTREP, message ("Mutable abstract type %q declared without pointer " "indirection: %t (violates assignment semantics)", uentry_getName (ue), ct), uentry_whereDeclared (ue)); } } void uentry_setMutable (uentry e) { llassert (uentry_isDatatype (e)); e->info->datatype->mut = YES; } static void uentry_checkIterArgs (uentry ue) { bool hasYield = FALSE; uentryList args; llassert (uentry_isIter (ue)); args = uentry_getParams (ue); uentryList_elements (args, el) { sstate ds = uentry_getDefState (el); if (uentry_isYield (el)) { hasYield = TRUE; } if (sstate_isUnknown (ds)) { uentry_setDefState (el, SS_DEFINED); } else { ; } } end_uentryList_elements; if (!hasYield) { voptgenerror (FLG_HASYIELD, message ("Iterator %q declared with no yield parameters", uentry_getName (ue)), uentry_whereDeclared (ue)); } } static chkind chkind_fromQual (qual qel) { if (qual_isChecked (qel)) { return CH_CHECKED; } else if (qual_isCheckMod (qel)) { return CH_CHECKMOD; } else if (qual_isCheckedStrict (qel)) { return CH_CHECKEDSTRICT; } else if (qual_isUnchecked (qel)) { return CH_UNCHECKED; } else { BADEXIT; /*@notreached@*/ return CH_UNKNOWN; } } static void uentry_reflectOtherQualifier (/*@notnull@*/ uentry ue, qual qel) { if (qual_isKillRef (qel) || qual_isNewRef (qel) || qual_isTempRef (qel)) { if (!uentry_isRefCounted (ue)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Reference counting qualifier %s used on non-reference " "counted storage: %q", qual_unparse (qel), uentry_unparse (ue)), uentry_whereLast (ue)); } else { alkind ak = alkind_fromQual (qel); uentry_setAliasKind (ue, ak); } } else if (qual_isRefCounted (qel)) { ctype ct = ctype_realType (uentry_getType (ue)); ctype rt; if (ctype_isPointer (ct) && (ctype_isStruct (rt = ctype_realType (ctype_baseArrayPtr (ct))))) { /* check there is a refs field */ uentryList fields = ctype_getFields (rt); uentry refs = uentry_undefined; uentryList_elements (fields, field) { if (uentry_isRefsField (field)) { if (uentry_isValid (refs)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Reference counted structure type %s has " "multiple refs fields: %q and %q", ctype_unparse (ct), uentry_getName (refs), uentry_getName (field)), uentry_whereLast (field)); } refs = field; } } end_uentryList_elements; if (uentry_isInvalid (refs)) { vgenhinterror (FLG_SYNTAX, message ("Reference counted structure type %s has " "no refs field", ctype_unparse (ct)), cstring_makeLiteral ("To count reference, the structure must have a field named " "refs of type int."), g_currentloc); } else if (!ctype_isInt (uentry_getType (refs))) { voptgenerror (FLG_ANNOTATIONERROR, message ("Reference counted structure type %s refs field has " "type %s (should be int)", ctype_unparse (ct), ctype_unparse (uentry_getType (refs))), uentry_whereLast (refs)); } else { sRef_setAliasKind (ue->sref, alkind_fromQual (qel), uentry_whereDeclared (ue)); } } else { if ((ctype_isPointer (ct) && ctype_isUnknown (ctype_realType (ctype_baseArrayPtr (ct)))) ||ctype_isAbstract (ct) || ctype_isUnknown (ct)) { sRef_setAliasKind (ue->sref, alkind_fromQual (qel), uentry_whereDeclared (ue)); } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Non-pointer to structure type %s declared with " "refcounted qualifier", ctype_unparse (ct)), uentry_whereLast (ue)); } } } else if (qual_isRefs (qel)) { if (uentry_isVariable (ue) && !uentry_isParam (ue)) { uentry_setAliasKind (ue, AK_REFS); } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Refs qualifier used on non-structure field: %q", uentry_unparse (ue)), uentry_whereLast (ue)); } } else if (qual_isAliasQual (qel)) { alkind ak = alkind_fromQual (qel); bool okay = TRUE; alkind oldak = uentry_getAliasKind (ue); ctype ut = uentry_getType (ue); if (alkind_isImplicit (ak) && (alkind_isKnown (oldak) && !alkind_isImplicit (oldak))) { /* ignore the implied qualifier */ okay = FALSE; } if (uentry_isEitherConstant (ue)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Alias qualifier %s used on constant: %q", alkind_unparse (ak), uentry_unparse (ue)), uentry_whereLast (ue)); okay = FALSE; } if (ctype_isFunction (ut)) { ut = ctype_getReturnType (ut); } if (!(ctype_isVisiblySharable (ut) || ctype_isRealArray (ut) || ctype_isRealSU (ut))) { if (!qual_isImplied (qel)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Alias qualifier %s used on unsharable storage type %t: %q", alkind_unparse (ak), ut, uentry_getName (ue)), uentry_whereLast (ue)); } okay = FALSE; } else { if (uentry_isRefCounted (ue)) { if (!(qual_isRefQual (qel) || qual_isOnly (qel) || qual_isExposed (qel) || qual_isObserver (qel))) { if (!qual_isImplied (qel)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Alias qualifier %s used on reference counted storage: %q", alkind_unparse (ak), uentry_unparse (ue)), uentry_whereLast (ue)); } okay = FALSE; } } else { if (qual_isRefQual (qel)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used on non-reference counted storage: %q", alkind_unparse (ak), uentry_unparse (ue)), uentry_whereLast (ue)); okay = FALSE; } } } if (okay) { uentry_setAliasKind (ue, ak); } } else if (qual_isNull (qel)) { if (uentry_isConstant (ue)) { sRef_setNullState (ue->sref, ctype_isAbstract (ue->utype) ? NS_CONSTNULL : NS_DEFNULL, uentry_whereDeclared (ue)); } else { uentry_setNullState (ue, NS_POSNULL); } } else if (qual_isRelNull (qel)) { uentry_setNullState (ue, NS_RELNULL); } else if (qual_isNotNull (qel)) { uentry_setNullState (ue, NS_MNOTNULL); } else if (qual_isAbstract (qel) || qual_isNumAbstract (qel) || qual_isConcrete (qel)) { if (!uentry_isDatatype (ue)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used with non-datatype", qual_unparse (qel)), uentry_whereLast (ue)); } else { ue->info->datatype->abs = qel; DPRINTF (("Setting abstract %s: %s", uentry_unparse (ue), qual_unparse (qel))); } } else if (qual_isMutable (qel)) { if (!uentry_isDatatype (ue)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used with non-datatype", qual_unparse (qel)), uentry_whereLast (ue)); } else { if (!ynm_isOn (ue->info->datatype->mut)) { uentry_checkMutableType (ue); } ue->info->datatype->mut = YES; } } else if (qual_isImmutable (qel)) { if (!uentry_isDatatype (ue)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used with non-datatype", qual_unparse (qel)), uentry_whereLast (ue)); } else { ue->info->datatype->mut = NO; } } else if (qual_isNullPred (qel)) { uentry_convertVarFunction (ue); if (uentry_isFunction (ue)) { ctype typ = uentry_getType (ue); ctype rtype = ctype_getReturnType (uentry_getType (ue)); if (ctype_isRealBool (rtype)) { uentryList pl = ctype_argsFunction (typ); if (uentryList_size (pl) == 1) { ue->info->fcn->nullPred = qel; } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used with function having %d " "arguments (should have 1)", qual_unparse (qel), uentryList_size (pl)), uentry_whereLast (ue)); } } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used with function returning %s " "(should return bool)", qual_unparse (qel), ctype_unparse (rtype)), uentry_whereLast (ue)); } } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used with non-function", qual_unparse (qel)), uentry_whereLast (ue)); } } else if (qual_isExitQual (qel)) { exitkind exk = exitkind_fromQual (qel); if (uentry_isFunction (ue)) { if (exitkind_isKnown (ue->info->fcn->exitCode)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Multiple exit qualifiers used on function %q: %s, %s", uentry_getName (ue), exitkind_unparse (ue->info->fcn->exitCode), exitkind_unparse (exk)), uentry_whereLast (ue)); } ue->info->fcn->exitCode = exk; } else { if (uentry_isVariable (ue) && ctype_isFunction (uentry_getType (ue))) { uentry_makeVarFunction (ue); ue->info->fcn->exitCode = exk; } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Exit qualifier %s used with non-function (type %s)", qual_unparse (qel), ctype_unparse (uentry_getType (ue))), uentry_whereLast (ue)); } } } else if (qual_isMetaState (qel)) { annotationInfo ainfo = qual_getAnnotationInfo (qel); if (annotationInfo_matchesContext (ainfo, ue)) { DPRINTF (("Reflecting %s on %s", annotationInfo_unparse (ainfo), uentry_unparseFull (ue))); sRef_reflectAnnotation (ue->sref, ainfo, g_currentloc); DPRINTF (("==> %s", sRef_unparseFull (ue->sref))); DPRINTF (("==> %s", uentry_unparseFull (ue))); } else { if (optgenerror (FLG_ANNOTATIONERROR, message ("Attribute annotation %s used in inconsistent context: %q", qual_unparse (qel), uentry_unparse (ue)), uentry_whereLast (ue))) { /* annotationInfo_showContextError (ainfo, ue); */ } } } else { if (qual_isCQual (qel)) { ; /* okay */ } else { llbug (message ("Unhandled qualifier: %s", qual_unparse (qel))); } } } void uentry_reflectQualifiers (uentry ue, qualList q) { llassert (uentry_isValid (ue)); DPRINTF (("Reflect qualifiers: %s / %s", uentry_unparseFull (ue), qualList_unparse (q))); qualList_elements (q, qel) { if (qual_isStatic (qel)) { uentry_setStatic (ue); } else if (qual_isUnused (qel)) { uentry_setUsed (ue, fileloc_undefined); DPRINTF (("Used: %s", uentry_unparseFull (ue))); } else if (qual_isExternal (qel)) { fileloc_free (ue->whereDefined); ue->whereDefined = fileloc_createExternal (); } else if (qual_isSef (qel)) { if (uentry_isVariable (ue)) { vkind vk = ue->info->var->kind; llassert (vk != VKREFPARAM); if (vk == VKYIELDPARAM) { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier sef cannot be used with %s: %q", cstring_makeLiteralTemp (vk == VKYIELDPARAM ? "yield" : "returned"), uentry_unparse (ue)), uentry_whereLast (ue)); } else if (vk == VKRETPARAM) { ue->info->var->kind = VKSEFRETPARAM; } else { ue->info->var->kind = VKSEFPARAM; } } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier sef is meaningful only on parameters: %q", uentry_unparse (ue)), uentry_whereLast (ue)); } } else if (qual_isExtern (qel)) { ue->storageclass = SCEXTERN; } else if (qual_isGlobalQual (qel)) /* undef, killed */ { DPRINTF (("Reflecting qual: %s / %s", qual_unparse (qel), uentry_unparse (ue))); if (uentry_isVariable (ue)) { sstate oldstate = ue->info->var->defstate; sstate defstate = sstate_fromQual (qel); if ((oldstate == SS_UNDEFGLOB && defstate == SS_KILLED) || (oldstate == SS_KILLED && defstate == SS_UNDEFGLOB)) { defstate = SS_UNDEFKILLED; } else { ; /* any errors? */ } sRef_setDefState (ue->sref, defstate, fileloc_undefined); ue->info->var->defstate = defstate; } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used on non-variable: %q", qual_unparse (qel), uentry_unparse (ue)), uentry_whereLast (ue)); } DPRINTF (("After: %s", uentry_unparseFull (ue))); } /* start modifications */ else if( qual_isBufQualifier(qel) ) { ctype ct = ctype_realType(uentry_getType(ue)); if( ctype_isArray(ct) || ctype_isPointer(ct) ) { if( uentry_hasBufStateInfo(ue) ) { if( qual_isNullTerminated(qel) ) { /* handle Nullterm */ if (uentry_isAnyParam(ue) || uentry_isReturned (ue)) { /* If formal func param */ uentry_setNullTerminatedState(ue); uentry_setLen (ue, 1); uentry_setSize (ue, 1); sRef_setNullTerminatedState(uentry_getSref(ue)); sRef_setLen (uentry_getSref(ue), 1); sRef_setSize (uentry_getSref(ue), 1); } else { uentry_setPossiblyNullTerminatedState(ue); sRef_setPossiblyNullTerminatedState(uentry_getSref(ue)); } } /* put other BufState Qualifiers here */ } else { cstring s = uentry_getName(ue); llfatalbug(message("INTERNAL Error: we have a NULL BufState \ struct for identifier %s\n", s) ); } } else if (ctype_isFunction (ct)) { /* We have to handle function */ sRef retSref = uentry_getSref (ue); ctype retType = sRef_getType (retSref); if (ctype_isPointer (retType) || ctype_isArray (retType)) { sRef_setNullTerminatedState (retSref); } else { llerror (FLG_SYNTAX, message ("Qualifier %s used on non-pointer on \ function return: %q", qual_unparse (qel), uentry_unparse (ue))); } } else { llerror (FLG_SYNTAX, message ("Qualifier %s used on non-pointer: %q", qual_unparse (qel), uentry_unparse (ue))); } DPRINTF (("After: %s", uentry_unparseFull (ue))); }/* end else if */ else if (qual_isAllocQual (qel)) /* out, partial, reldef, special, etc. */ { ctype realType = ctype_realType (ue->utype); sstate defstate = sstate_fromQual (qel); if (ctype_isFunction (realType)) { realType = ctype_realType (ctype_getReturnType (realType)); } if (qual_isRelDef (qel)) { ; /* okay anywhere */ } else { if (!ctype_isAP (realType) && !ctype_isSU (realType) && !ctype_isUnknown (realType) && !ctype_isAbstract (ue->utype)) { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used on non-pointer or struct: %q", qual_unparse (qel), uentry_unparse (ue)), uentry_whereLast (ue)); } } uentry_setDefState (ue, defstate); if (sRef_isStateSpecial (ue->sref) && alkind_isImplicit (sRef_getAliasKind (ue->sref))) { sRef_setAliasKind (ue->sref, AK_ERROR, fileloc_undefined); } } else if (qual_isYield (qel)) { if (uentry_isVariable (ue)) { ue->info->var->kind = VKYIELDPARAM; } else { voptgenerror (FLG_ANNOTATIONERROR, message ("Qualifier %s used on non-iterator parameter: %q", qual_unparse (qel), uentry_unparse (ue)), uentry_whereLast (ue)); } } else if (qual_isExQual (qel)) { exkind ek = exkind_fromQual (qel); ctype ut = uentry_getType (ue); DPRINTF (("Reflect ex qual: %s / %s", uentry_unparse (ue), exkind_unparse (ek))); if (ctype_isFunction (ut)) { ut = ctype_getReturnType (ut); } if (!(ctype_isVisiblySharable (ut)) && !(ctype_isArray (ut)) /* can apply to arrays also! */ && !(ctype_isStruct (ctype_realType (ut)))) /* applies to structure fields! */ { if (!qual_isImplied (qel)) { if (ctype_isImmutableAbstract (ut)) { voptgenerror (FLG_REDUNDANTSHAREQUAL, message ("Qualifier %s used on unsharable storage type %t: %q", exkind_unparse (ek), ut, uentry_getName (ue)), uentry_whereLast (ue)); } else { voptgenerror (FLG_MISPLACEDSHAREQUAL, message ("Qualifier %s used on unsharable storage type %t: %q", exkind_unparse (ek), ut, uentry_getName (ue)), uentry_whereLast (ue)); } } } else { alkind ak = sRef_getAliasKind (ue->sref); sRef_setExKind (ue->sref, ek, uentry_whereDeclared (ue)); DPRINTF (("Set exkind: %s", sRef_unparseFull (ue->sref))); if (alkind_isUnknown (ak) || alkind_isImplicit (ak) || alkind_isStatic (ak)) { if (!alkind_isTemp (ak)) { DPRINTF (("imp dep: %s", uentry_unparseFull (ue))); uentry_setAliasKind (ue, AK_IMPDEPENDENT); } } else if (alkind_isDependent (ak) || alkind_isTemp (ak) || alkind_isOwned (ak)) { ; /* okay */ } else { llerror (FLG_SYNTAX, message ("Exposure qualifier %s used on %s storage (should " "be dependent): %q", qual_unparse (qel), alkind_unparse (ak), uentry_unparse (ue))); } } } else if (qual_isGlobCheck (qel)) { if (uentry_isVariable (ue)) { chkind ch = chkind_fromQual (qel); if (ue->info->var->checked != CH_UNKNOWN) { if (ch == ue->info->var->checked) { llerror (FLG_SYNTAX, message ("Redundant %s qualifier on %q", qual_unparse (qel), uentry_getName (ue))); } else { llerror (FLG_SYNTAX, message ("Contradictory %s and %s qualifiers on %q", qual_unparse (qel), checkedName (ue->info->var->checked), uentry_getName (ue))); } } ue->info->var->checked = ch; } else { llerror (FLG_SYNTAX, message ("Qualifier %s used with non-variable", qual_unparse (qel))); } } else if (qual_isReturned (qel)) { if (uentry_isVariable (ue)) { ue->info->var->kind = VKRETPARAM; } else { llerror (FLG_SYNTAX, message ("Qualifier %s used with non-variable", qual_unparse (qel))); } } else { uentry_reflectOtherQualifier (ue, qel); } sRef_storeState (ue->sref); } end_qualList_elements; qualList_clear (q); DPRINTF (("Done: %s", sRef_unparseFull (ue->sref))); } bool uentry_isOnly (uentry ue) { return (!uentry_isUndefined (ue) && uentry_isVariable (ue) && alkind_isOnly (sRef_getOrigAliasKind (ue->sref))); } static void uentry_setAliasKind (/*@notnull@*/ uentry ue, alkind ak) { sRef_setAliasKind (ue->sref, ak, uentry_whereDeclared (ue)); sRef_setOrigAliasKind (ue->sref, ak); } static void uentry_setNullState (/*@notnull@*/ uentry ue, nstate ns) { if (uentry_isVariable (ue)) { ue->info->var->nullstate = ns; } sRef_setNullState (ue->sref, ns, uentry_whereDeclared (ue)); } bool uentry_isUnique (uentry ue) { return (!uentry_isUndefined (ue) && uentry_isVariable (ue) && alkind_isUnique (sRef_getOrigAliasKind (ue->sref))); } bool uentry_isFileStatic (uentry ue) { return (uentry_isStatic (ue) && (!uentry_isVariable (ue) || sRef_isFileStatic (uentry_getSref (ue)))); } bool uentry_isExported (uentry ue) { if (uentry_isValid (ue)) { if (uentry_isVariable (ue)) { return (sRef_isRealGlobal (uentry_getSref (ue))); } else { return !uentry_isStatic (ue); } } return FALSE; } bool uentry_isNonLocal (uentry ue) { return (uentry_isValid (ue) && uentry_isVariable (ue) && (sRef_isFileOrGlobalScope (ue->sref) || uentry_isStatic (ue))); } bool uentry_isGlobalVariable (uentry ue) { return (uentry_isValid (ue) && uentry_isVariable (ue) && sRef_isFileOrGlobalScope (ue->sref)); } bool uentry_isVisibleExternally (uentry ue) { return (uentry_isValid (ue) && ((uentry_isVariable (ue) && sRef_isRealGlobal (ue->sref)) || (!uentry_isStatic (ue) && (uentry_isFunction (ue) || uentry_isIter (ue) || uentry_isEndIter (ue) || uentry_isConstant (ue) || uentry_isDatatype (ue) || uentry_isAnyTag (ue))))); } bool uentry_isPrintfLike (uentry ue) { return (uentry_isFunction (ue) && (ue->info->fcn->specialCode == SPC_PRINTFLIKE)); } bool uentry_isScanfLike (uentry ue) { return (uentry_isFunction (ue) && (ue->info->fcn->specialCode == SPC_SCANFLIKE)); } bool uentry_isMessageLike (uentry ue) { return (uentry_isFunction (ue) && (ue->info->fcn->specialCode == SPC_MESSAGELIKE)); } static void checkSpecialFunction (/*@notnull@*/ uentry ue) { uentryList args = uentry_getParams (ue); if (!uentryList_isMissingParams (args)) { uentry last = uentry_undefined; uentryList_elements (args, current) { if (uentry_isElipsisMarker (current)) { if (uentry_isUndefined (last)) { voptgenerror (FLG_SYNTAX, message ("Function %q is marked %s, but has no format " "string argument before elipsis", uentry_getName (ue), specCode_unparse (ue->info->fcn->specialCode)), uentry_whereLast (ue)); ue->info->fcn->specialCode = SPC_NONE; } else { ctype rt = ctype_realType (uentry_getType (last)); if (!ctype_match (rt, ctype_string)) { bool okay = FALSE; /* wchar_t * is okay too */ if (ctype_isAP (rt)) { ctype base = ctype_baseArrayPtr (rt); if (ctype_isArbitraryIntegral (base)) { okay = TRUE; } } if (!okay) { voptgenerror (FLG_SYNTAX, message ("Function %q is marked %s, but the argument " "before the elipsis has type %s (should be char *)", uentry_getName (ue), specCode_unparse (ue->info->fcn->specialCode), ctype_unparse (uentry_getType (last))), uentry_whereLast (ue)); ue->info->fcn->specialCode = SPC_NONE; } } } return; } last = current; } end_uentryList_elements ; voptgenerror (FLG_SYNTAX, message ("Function %q is marked %s, but has no elipsis parameter", uentry_getName (ue), specCode_unparse (ue->info->fcn->specialCode)), uentry_whereLast (ue)); ue->info->fcn->specialCode = SPC_NONE; } } void uentry_setPrintfLike (uentry ue) { uentry_convertVarFunction (ue); llassertfatal (uentry_isFunction (ue)); ue->info->fcn->specialCode = SPC_PRINTFLIKE; checkSpecialFunction (ue); } void uentry_setScanfLike (uentry ue) { uentry_convertVarFunction (ue); llassertfatal (uentry_isFunction (ue)); ue->info->fcn->specialCode = SPC_SCANFLIKE; checkSpecialFunction (ue); } void uentry_setMessageLike (uentry ue) { uentry_convertVarFunction (ue); llassertfatal (uentry_isFunction (ue)); ue->info->fcn->specialCode = SPC_MESSAGELIKE; checkSpecialFunction (ue); } bool uentry_isSpecialFunction (uentry ue) { return (uentry_isFunction (ue) && (ue->info->fcn->specialCode != SPC_NONE)); } /*@notnull@*/ uentry uentry_makeParam (idDecl t, int i) { ctype ct = idDecl_getCtype (t); fileloc loc = setLocation (); sRef pref = sRef_makeParam (i, ct, stateInfo_makeLoc (loc, SA_CREATED)); uentry ue = uentry_makeVariableSrefParam (idDecl_observeId (t), ct, loc, pref); DPRINTF (("Make param: %s", uentry_unparseFull (ue))); DPRINTF (("Base: %s [%d]", ctype_unparse (base), ctype_isFixedArray (base))); uentry_reflectQualifiers (ue, idDecl_getQuals (t)); uentry_implicitParamAnnots (ue); if (ctype_isArray (ct)) { /* Parameter type [][] or [x][] is invalid, but [][x] is okay */ ctype base = ctype_baseArrayPtr (ct); DPRINTF (("Check array: %s / Base: %s", ctype_unparse (ct), ctype_unparse (base))); if (ctype_isIncompleteArray (base)) { if (!uentry_hasName (ue)) { voptgenerror (FLG_INCOMPLETETYPE, message ("Unnamed function parameter %d is incomplete type " "(inner array must have bounds): %s", i + 1, ctype_unparse (ct)), uentry_whereLast (ue)); } else { voptgenerror (FLG_INCOMPLETETYPE, message ("Function parameter %q is incomplete type " "(inner array must have bounds): %s", uentry_getName (ue), ctype_unparse (ct)), uentry_whereLast (ue)); } } } DPRINTF (("Param: %s", uentry_unparseFull (ue))); return ue; } /*@only@*/ /*@notnull@*/ uentry uentry_makeIdVariable (idDecl t) { ctype ct = idDecl_getCtype (t); if (ctype_isFunction (ct)) { return (uentry_makeIdFunction (t)); } else { fileloc loc = setLocation (); uentry ue = uentry_makeVariable (idDecl_observeId (t), ct, loc, FALSE); uentry_reflectQualifiers (ue, idDecl_getQuals (t)); if (!uentry_isExtern (ue)) { uentry_setDefined (ue, loc); } return ue; } } /*@notnull@*/ uentry uentry_makeVariableParam (cstring n, ctype t, fileloc loc) { return (uentry_makeVariableParamAux (n, t, sRef_makeType (t), fileloc_copy (loc), SS_DEFINED)); } /* ** constants */ static /*@only@*/ /*@notnull@*/ uentry uentry_makeConstantAux (cstring n, ctype t, /*@keep@*/ fileloc f, bool priv, bool macro, /*@only@*/ multiVal m) { uentry e = uentry_alloc (); e->ukind = KCONST; e->uname = cstring_copy (n); e->utype = t; e->storageclass = SCNONE; e->warn = warnClause_undefined; /* Don't support warnings for constants */ e->sref = sRef_makeConst (t); e->lset = FALSE; e->used = FALSE; e->uses = filelocList_new (); e->isPrivate = priv; e->hasNameError = FALSE; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst)); e->info->uconst->access = typeIdSet_undefined; e->info->uconst->macro = macro; uentry_setSpecDef (e, f); if (multiVal_isInt (m) && (multiVal_forceInt (m) == 0)) { sRef_setDefNull (e->sref, uentry_whereDeclared (e)); } uentry_setConstantValue (e, m); return (e); } /*@notnull@*/ uentry uentry_makeConstant (cstring n, ctype t, fileloc f) { uentry ue = uentry_makeConstantAux (n, t, f, FALSE, FALSE, multiVal_unknown ()); return ue; } /*@notnull@*/ uentry uentry_makeConstantValue (cstring n, ctype t, fileloc f, bool priv, multiVal val) { uentry ue = uentry_makeConstantAux (n, t, f, priv, FALSE, val); return ue; } /*@notnull@*/ uentry uentry_makeMacroConstant (cstring n, ctype t, fileloc f) { uentry ue = uentry_makeConstantAux (n, t, f, FALSE, TRUE, multiVal_unknown ()); return ue; } /*@notnull@*/ uentry uentry_makeIdConstant (idDecl t) { uentry ue = uentry_makeConstant (idDecl_observeId (t), idDecl_getCtype (t), fileloc_undefined); llassert (fileloc_isUndefined (ue->whereDeclared)); ue->whereDeclared = setLocation (); uentry_reflectQualifiers (ue, idDecl_getQuals (t)); DPRINTF (("Constant: %s", uentry_unparseFull (ue))); DPRINTF (("Value: %s", multiVal_unparse (uentry_getConstantValue (ue)))); return ue; } /* ** variables */ void uentry_setDefState (uentry ue, sstate defstate) { if (uentry_isValid (ue)) { sRef_setDefState (ue->sref, defstate, fileloc_undefined); if (uentry_isVariable (ue)) { ue->info->var->defstate = defstate; /* evs 2000-05-17: fixed bug, was SS_DEFINED! */ } } } bool uentry_isCheckedUnknown (uentry ue) { return (uentry_isVar (ue) && (ue->info->var->checked == CH_UNKNOWN)); } bool uentry_isCheckMod (uentry ue) { return (uentry_isVar (ue) && (ue->info->var->checked == CH_CHECKMOD)); } bool uentry_isUnchecked (uentry ue) { return (uentry_isVar (ue) && (ue->info->var->checked == CH_UNCHECKED)); } bool uentry_isChecked (uentry ue) { return (uentry_isVar (ue) && (ue->info->var->checked == CH_CHECKED)); } bool uentry_isCheckedModify (uentry ue) { return (uentry_isVar (ue) && (ue->info->var->checked == CH_CHECKED || ue->info->var->checked == CH_CHECKMOD || ue->info->var->checked == CH_CHECKEDSTRICT)); } bool uentry_isCheckedStrict (uentry ue) { return (uentry_isVar (ue) && (ue->info->var->checked == CH_CHECKEDSTRICT)); } void uentry_setUnchecked (uentry ue) { llassert (uentry_isVar (ue)); ue->info->var->checked = CH_UNCHECKED; } void uentry_setChecked (uentry ue) { llassert (uentry_isVar (ue)); ue->info->var->checked = CH_CHECKED; } void uentry_setCheckMod (uentry ue) { llassert (uentry_isVar (ue)); ue->info->var->checked = CH_CHECKMOD; } void uentry_setCheckedStrict (uentry ue) { llassert (uentry_isVar (ue)); ue->info->var->checked = CH_CHECKEDSTRICT; } static /*@only@*/ /*@notnull@*/ uentry uentry_makeVariableAux (cstring n, ctype t, fileloc f, /*@exposed@*/ sRef s, bool priv, vkind kind) { uentry e = uentry_alloc (); ctype rt = t; DPRINTF (("Make variable: %s %s %s", n, ctype_unparse (t), sRef_unparse (s))); e->ukind = KVAR; e->uname = cstring_copy (n); e->utype = t; e->storageclass = SCNONE; e->warn = warnClause_undefined; /* Don't support warnings for variables yet @*/ e->sref = s; e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->isPrivate = priv; e->hasNameError = FALSE; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->var = (uvinfo) dmalloc (sizeof (*e->info->var)); e->info->var->kind = kind; /* removed: e->info->var->origsref = sRef_saveCopy (e->sref); */ e->info->var->checked = CH_UNKNOWN; DPRINTF (("Here we are: %s", sRef_unparseFull (e->sref))); uentry_setSpecDef (e, f); DPRINTF (("Here we are: %s", sRef_unparseFull (e->sref))); if (ctype_isFunction (rt)) { rt = ctype_getReturnType (rt); } if (ctype_isUA (rt)) { DPRINTF (("Here we are: %s", sRef_unparseFull (e->sref))); sRef_setStateFromType (e->sref, rt); } e->info->var->defstate = sRef_getDefState (e->sref); e->info->var->nullstate = sRef_getNullState (e->sref); /* start modifications */ /* This function sets the uentry for a pointer or array variable declaration, it allocates memory and sets the fields. We check if the type of the variable is a pointer or array and allocate a `bbufinfo' struct accordingly */ if (ctype_isArray (t) || ctype_isPointer(t)) { e->info->var->bufinfo = dmalloc (sizeof (*e->info->var->bufinfo)); e->info->var->bufinfo->bufstate = BB_NOTNULLTERMINATED; sRef_setNotNullTerminatedState (s); } else { e->info->var->bufinfo = NULL; }/* end else */ /* end modification */ DPRINTF (("New variable: %s", sRef_unparseFull (e->sref))); return (e); } bool uentry_isYield (uentry ue) { return (uentry_isVariable (ue) && (ue->info->var->kind == VKYIELDPARAM || ue->info->var->kind == VKREFYIELDPARAM)); } static bool uentry_isRefsField (uentry ue) { return (uentry_isVariable (ue) && sRef_isRefsField (ue->sref)); } /*@only@*/ /*@notnull@*/ uentry uentry_makeVariable (cstring n, ctype t, fileloc f, bool isPriv) { return (uentry_makeVariableAux (n, t, f, sRef_makeType (t), isPriv, fileloc_isSpec (f) ? VKSPEC : VKNORMAL)); } /* ** functions */ void uentry_makeVarFunction (uentry ue) { alkind ak; exkind ek; uvinfo oldInfo; fileloc loc; llassert (uentry_isValid (ue)); llassert (!sRef_modInFunction ()); ak = sRef_getOrigAliasKind (ue->sref); ek = sRef_getOrigExKind (ue->sref); llassert (uentry_isVariable (ue)); oldInfo = ue->info->var; DPRINTF (("ue: %s", uentry_unparseFull (ue))); llassert (ctype_isUnknown (ue->utype) || ctype_isFunction (ctype_realType (ue->utype))); /* ** expanded macro is marked used */ ue->used = ue->used || (oldInfo->kind == VKEXPMACRO); ue->ukind = KFCN; ue->info->fcn = (ufinfo) dmalloc (sizeof (*ue->info->fcn)); ue->info->fcn->exitCode = XK_UNKNOWN; ue->info->fcn->nullPred = qual_createUnknown (); ue->info->fcn->specialCode = SPC_NONE; ue->info->fcn->access = typeIdSet_undefined; ue->info->fcn->hasGlobs = FALSE; ue->info->fcn->globs = globSet_undefined; ue->info->fcn->hasMods = FALSE; ue->info->fcn->mods = sRefSet_undefined; ue->info->fcn->specclauses = NULL; ue->info->fcn->defparams = uentryList_undefined; /*drl*/ ue->info->fcn->preconditions = functionConstraint_undefined; /*end */ /*drl 12/28/2000*/ ue->info->fcn->postconditions = functionConstraint_undefined; /*end */ if (ctype_isFunction (ue->utype)) { ue->sref = sRef_makeType (ctype_getReturnType (ue->utype)); } else { ue->sref = sRef_makeType (ctype_unknown); } if (sRef_isRefCounted (ue->sref)) { ak = AK_NEWREF; } else { if (alkind_isUnknown (ak)) { if (exkind_isKnown (ek)) { DPRINTF (("imp dep: %s", uentry_unparseFull (ue))); ak = AK_IMPDEPENDENT; } else { if (context_getFlag (FLG_RETIMPONLY)) { if (ctype_isFunction (ue->utype) && ctype_isVisiblySharable (ctype_realType (ctype_getReturnType (ue->utype)))) { if (uentryList_hasReturned (uentry_getParams (ue))) { ; } else { if (ctype_isImmutableAbstract (ctype_getReturnType (ue->utype))) { ; } else { ak = AK_IMPONLY; } } } } } } } loc = ue->whereDeclared; sRef_setAliasKind (ue->sref, ak, loc); sRef_setNullState (ue->sref, oldInfo->nullstate, loc); sRef_setDefState (ue->sref, oldInfo->defstate, loc); sRef_setExKind (ue->sref, ek, loc); if (oldInfo->kind == VKEXPMACRO) { ; } else { fileloc_free (ue->whereDefined); ue->whereDefined = fileloc_undefined; } uvinfo_free (oldInfo); } void uentry_makeConstantFunction (uentry ue) { alkind ak; exkind ek; ucinfo oldInfo; fileloc loc; llassert (uentry_isValid (ue)); llassert (!sRef_modInFunction ()); ak = sRef_getOrigAliasKind (ue->sref); ek = sRef_getOrigExKind (ue->sref); llassert (uentry_isConstant (ue)); oldInfo = ue->info->uconst; llassert (ctype_isUnknown (ue->utype) || ctype_isFunction (ue->utype)); /* ** expanded macro is marked used (until I write a pre-processor) */ ue->ukind = KFCN; ue->info->fcn = (ufinfo) dmalloc (sizeof (*ue->info->fcn)); ue->info->fcn->exitCode = XK_UNKNOWN; ue->info->fcn->nullPred = qual_createUnknown (); ue->info->fcn->specialCode = SPC_NONE; ue->info->fcn->access = typeIdSet_undefined; ue->info->fcn->hasGlobs = FALSE; ue->info->fcn->globs = globSet_undefined; ue->info->fcn->hasMods = FALSE; ue->info->fcn->mods = sRefSet_undefined; ue->info->fcn->specclauses = NULL; ue->info->fcn->defparams = uentryList_undefined; /*drl*/ ue->info->fcn->preconditions = functionConstraint_undefined; /*end */ /*drl 12/28/2000*/ ue->info->fcn->postconditions = functionConstraint_undefined; /*end */ if (ctype_isFunction (ue->utype)) { ue->sref = sRef_makeType (ctype_getReturnType (ue->utype)); } else { ue->sref = sRef_makeType (ctype_unknown); } if (sRef_isRefCounted (ue->sref)) { ak = AK_NEWREF; } else { if (alkind_isUnknown (ak)) { if (exkind_isKnown (ek)) { DPRINTF (("imp dep: %s", uentry_unparseFull (ue))); ak = AK_IMPDEPENDENT; } else { if (context_getFlag (FLG_RETIMPONLY)) { if (ctype_isFunction (ue->utype) && ctype_isVisiblySharable (ctype_realType (ctype_getReturnType (ue->utype)))) { if (uentryList_hasReturned (uentry_getParams (ue))) { ; } else { if (ctype_isImmutableAbstract (ctype_getReturnType (ue->utype))) { ; } else { ak = AK_IMPONLY; } } } } } } } loc = ue->whereDeclared; sRef_setAliasKind (ue->sref, ak, loc); sRef_setExKind (ue->sref, ek, loc); fileloc_free (ue->whereDefined); ue->whereDefined = fileloc_undefined; ucinfo_free (oldInfo); } void uentry_setGlobals (uentry ue, /*@only@*/ globSet globs) { llassert (uentry_isValid (ue)); globSet_markImmutable (globs); if (uentry_isIter (ue)) { ue->info->iter->globs = globSet_unionFree (ue->info->iter->globs, globs); } else { uentry_convertVarFunction (ue); llassert (uentry_isFunction (ue)); ue->info->fcn->hasGlobs = TRUE; ue->info->fcn->globs = globSet_unionFree (ue->info->fcn->globs, globs); } if (context_getFlag (FLG_GLOBALSIMPMODIFIESNOTHING)) { ue->info->fcn->hasMods = TRUE; } } void uentry_addAccessType (uentry ue, typeId tid) { if (uentry_isFunction (ue)) { ue->info->fcn->access = typeIdSet_insert (ue->info->fcn->access, tid); } else if (uentry_isEitherConstant (ue)) { ue->info->uconst->access = typeIdSet_insert (ue->info->uconst->access, tid); } else if (uentry_isIter (ue)) { ue->info->iter->access = typeIdSet_insert (ue->info->iter->access, tid); } else if (uentry_isEndIter (ue)) { ue->info->enditer->access = typeIdSet_insert (ue->info->enditer->access, tid); } else { llbug (message ("no access for: %q", uentry_unparse (ue))); } } /*@only@*/ /*@notnull@*/ uentry uentry_makeFunction (cstring n, ctype t, typeId access, /*@only@*/ globSet globs, /*@only@*/ sRefSet mods, /*@only@*/ warnClause warn, fileloc f) { llassert (warnClause_isUndefined (warn)); return (uentry_makeFunctionAux (n, t, ((typeId_isInvalid (access)) ? typeIdSet_emptySet () : typeIdSet_single (access)), globs, mods, warn, f, FALSE, FALSE)); } /*@notnull@*/ uentry uentry_makePrivFunction2 (cstring n, ctype t, typeIdSet access, globSet globs, sRefSet mods, fileloc f) { return (uentry_makeFunctionAux (n, t, access, globs, mods, warnClause_undefined, f, TRUE, FALSE)); } /*@notnull@*/ uentry uentry_makeSpecFunction (cstring n, ctype t, typeIdSet access, /*@only@*/ globSet globs, /*@only@*/ sRefSet mods, fileloc f) { uentry ue = uentry_makeFunctionAux (n, t, access, globs, mods, warnClause_undefined, f, FALSE, FALSE); uentry_setHasGlobs (ue); uentry_setHasMods (ue); reflectImplicitFunctionQualifiers (ue, TRUE); return (ue); } uentry uentry_makeExpandedMacro (cstring s, fileloc f) { uentry ue = uentry_makeVariableAux (s, ctype_unknown, fileloc_undefined, sRef_undefined, FALSE, VKEXPMACRO); uentry_setDefined (ue, f); return ue; } /*@notnull@*/ /*@notnull@*/ uentry uentry_makeForwardFunction (cstring n, typeId access, fileloc f) { uentry ue = uentry_makeFunctionAux (n, ctype_unknown, typeIdSet_singleOpt (access), globSet_undefined, sRefSet_undefined, warnClause_undefined, fileloc_undefined, FALSE, TRUE); ue->whereDeclared = fileloc_update (ue->whereDeclared, f); return ue; } bool uentry_isForward (uentry e) { if (uentry_isValid (e)) { ctype ct = uentry_getType (e); return (ctype_isUnknown (ct) || (ctype_isFunction (ct) && ctype_isUnknown (ctype_getReturnType (ct)))); } return FALSE; } /*@notnull@*/ uentry uentry_makeTypeListFunction (cstring n, typeIdSet access, fileloc f) { return (uentry_makeFunctionAux (n, ctype_unknown, access, globSet_undefined, sRefSet_undefined, warnClause_undefined, f,FALSE, TRUE)); } /*@notnull@*/ uentry uentry_makeUnspecFunction (cstring n, ctype t, typeIdSet access, fileloc f) { uentry ue = uentry_makeFunctionAux (n, t, access, globSet_undefined, sRefSet_undefined, warnClause_undefined, f, FALSE, TRUE); reflectImplicitFunctionQualifiers (ue, TRUE); return ue; } /* ** datatypes */ /* is exported for use by usymtab_interface */ /*@notnull@*/ uentry uentry_makeDatatypeAux (cstring n, ctype t, ynm mut, qual abstract, fileloc f, bool priv) { uentry e = uentry_alloc (); DPRINTF (("Make datatype: %s / %s", n, ctype_unparse (t))); /* e->shallowCopy = FALSE; */ e->ukind = KDATATYPE; e->uname = cstring_copy (n); e->utype = t; e->storageclass = SCNONE; e->sref = sRef_makeUnknown (); if (ctype_isUA (t)) { sRef_setStateFromType (e->sref, t); } uentry_setSpecDef (e, f); e->warn = warnClause_undefined; e->uses = filelocList_new (); e->isPrivate = priv; e->hasNameError = FALSE; e->used = FALSE; e->lset = FALSE; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->datatype = (udinfo) dmalloc (sizeof (*e->info->datatype)); e->info->datatype->abs = abstract; e->info->datatype->mut = mut; e->info->datatype->type = ctype_undefined; if (uentry_isDeclared (e)) { uentry_setDefined (e, f); } if (qual_isAbstract (abstract) && !(uentry_isCodeDefined (e))) { sRef_setNullState (e->sref, NS_ABSNULL, uentry_whereDeclared (e)); } return (e); } /*@notnull@*/ uentry uentry_makeDatatype (cstring n, ctype t, ynm mut, qual abstract, fileloc f) { return (uentry_makeDatatypeAux (n, t, mut, abstract, f, FALSE)); } /*@notnull@*/ uentry uentry_makeBoolDatatype (qual abstract) { uentry ret = uentry_makeDatatypeAux (context_getBoolName (), ctype_bool, NO, abstract, fileloc_getBuiltin (), FALSE); ret->info->datatype->type = ctype_bool; return ret; } /* ** iters */ static /*@only@*/ /*@notnull@*/ uentry uentry_makeIterAux (cstring n, typeIdSet access, ctype ct, /*@only@*/ fileloc f) { uentry e = uentry_alloc (); e->ukind = KITER; e->uname = cstring_copy (n); e->utype = ct; e->sref = sRef_makeUnknown (); e->storageclass = SCNONE; e->used = FALSE; e->lset = FALSE; uentry_setSpecDef (e, f); e->warn = warnClause_undefined; e->uses = filelocList_new (); e->isPrivate = FALSE; e->hasNameError = FALSE; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->iter = (uiinfo) dmalloc (sizeof (*e->info->iter)); e->info->iter->access = access; e->info->iter->mods = sRefSet_undefined; e->info->iter->globs = globSet_undefined; uentry_checkIterArgs (e); return (e); } /*@notnull@*/ uentry uentry_makeIter (cstring n, ctype ct, fileloc f) { return (uentry_makeIterAux (n, context_fileAccessTypes (), ct, f)); } static /*@notnull@*/ uentry uentry_makeEndIterAux (cstring n, typeIdSet access, /*@only@*/ fileloc f) { uentry e = uentry_alloc (); /* e->shallowCopy = FALSE; */ e->ukind = KENDITER; e->storageclass = SCNONE; e->uname = message ("end_%s", n); e->utype = ctype_unknown; e->sref = sRef_makeUnknown (); uentry_setSpecDef (e, f); e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->isPrivate = FALSE; e->hasNameError = FALSE; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->enditer = (ueinfo) dmalloc (sizeof (*e->info->enditer)); e->info->enditer->access = access; e->warn = warnClause_undefined; return (e); } /*@notnull@*/ /*@only@*/ uentry uentry_makeEndIter (cstring n, fileloc f) { return (uentry_makeEndIterAux (n, context_fileAccessTypes (), f)); } /* ** tags */ static /*@only@*/ /*@notnull@*/ uentry uentry_makeTagAux (cstring n, ctype t, /*@only@*/ fileloc fl, bool priv, ekind kind) { uentry e = uentry_alloc (); if (kind != KSTRUCTTAG && kind != KUNIONTAG && kind != KENUMTAG) { llbuglit ("uentry_makeTagAux: not a tag type"); } e->ukind = kind; /* e->shallowCopy = FALSE; */ e->uname = cstring_copy (n); e->utype = t; e->sref = sRef_makeUnknown (); e->storageclass = SCNONE; uentry_setSpecDef (e, fl); e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->isPrivate = priv; e->hasNameError = FALSE; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->datatype = (udinfo) dmalloc (sizeof (*e->info->datatype)); e->info->datatype->abs = qual_createUnknown (); e->info->datatype->mut = (kind == KENUMTAG) ? NO : MAYBE; e->info->datatype->type = t; e->warn = warnClause_undefined; if (uentry_isDeclared (e)) { uentry_setDefined (e, fl); } return (e); } uentry uentry_makeStructTagLoc (cstring n, ctype t) { cstring sname = makeStruct (n); uentry ret = uentry_makeTagAux (sname, t, setLocation (), FALSE, KSTRUCTTAG); cstring_free (sname); return (ret); } /*@only@*/ uentry uentry_makeStructTag (cstring n, ctype t, fileloc loc) { cstring sname = makeStruct (n); uentry ret = uentry_makeTagAux (sname, t, loc, FALSE, KSTRUCTTAG); cstring_free (sname); return ret; } /*@only@*/ uentry uentry_makeUnionTag (cstring n, ctype t, fileloc loc) { cstring uname = makeUnion (n); uentry ret = uentry_makeTagAux (uname, t, loc, FALSE, KUNIONTAG); cstring_free (uname); return (ret); } uentry uentry_makeEnumTag (cstring n, ctype t, fileloc loc) { cstring ename = makeEnum (n); uentry ret = uentry_makeTagAux (ename, t, loc, FALSE, KENUMTAG); cstring_free (ename); return ret; } uentry uentry_makeUnionTagLoc (cstring n, ctype t) { cstring uname = makeUnion (n); uentry ret = uentry_makeTagAux (uname, t, setLocation (), FALSE, KUNIONTAG); cstring_free (uname); return ret; } uentry uentry_makeEnumTagLoc (cstring n, ctype t) { cstring ename = makeEnum (n); uentry ret = uentry_makeTagAux (ename, t, setLocation (), FALSE, KENUMTAG); cstring_free (ename); return ret; } bool uentry_isStructTag (uentry ue) { return (uentry_isValid (ue) && ue->ukind == KSTRUCTTAG); } bool uentry_isUnionTag (uentry ue) { return (uentry_isValid (ue) && ue->ukind == KUNIONTAG); } bool uentry_isEnumTag (uentry ue) { return (uentry_isValid (ue) && ue->ukind == KENUMTAG); } bool uentry_isAnyTag (uentry ue) { return (uentry_isStructTag (ue) || uentry_isUnionTag (ue) || uentry_isEnumTag (ue)); } static /*@unchecked@*/ /*@only@*/ uentry emarker = NULL; extern void uentry_destroyMod (void) /*@globals killed emarker@*/ /*@modifies emarker@*/ { static bool wasDestroyed = FALSE; llassert (!wasDestroyed); if (emarker != NULL) { uentry_reallyFree (emarker); } wasDestroyed = TRUE; } uentry uentry_makeElipsisMarker (void) { if (emarker == NULL) { emarker = uentry_alloc (); emarker->ukind = KELIPSMARKER; emarker->uname = cstring_makeLiteral ("..."); emarker->utype = ctype_elipsMarker; emarker->sref = sRef_undefined; emarker->storageclass = SCNONE; emarker->used = FALSE; emarker->lset = FALSE; emarker->info = NULL; uentry_setSpecDef (emarker, fileloc_undefined); emarker->uses = filelocList_new (); emarker->isPrivate = FALSE; emarker->hasNameError = FALSE; } /*@ignore@*/ return (emarker); /*@end@*/ } /* ** comparisons */ bool uentry_equiv (uentry p1, uentry p2) { if (uentry_compare (p1, p2) != 0) { return FALSE; } else { return TRUE; } } int uentry_xcomparealpha (uentry *p1, uentry *p2) { int res; if ((res = uentry_compare (*p1, *p2)) == 0) { if ((*p1 != NULL) && (*p2 != NULL)) { res = cstring_compare ((*p1)->uname, (*p2)->uname); } } return res; } int uentry_xcompareuses (uentry *p1, uentry *p2) { uentry u1 = *p1; uentry u2 = *p2; if (uentry_isValid (u1)) { if (uentry_isValid (u2)) { return (-1 * int_compare (filelocList_size (u1->uses), filelocList_size (u2->uses))); } else { return 1; } } else { if (uentry_isValid (u2)) { return -1; } else { return 0; } } } int uentry_compareStrict (uentry v1, uentry v2) { COMPARERETURN (uentry_compare (v1, v2)); if (v1 != v2 && uentry_isValid (v1) && uentry_isValid (v2)) { COMPARERETURN (fileloc_compare (v1->whereDeclared, v2->whereDeclared)); COMPARERETURN (fileloc_compare (v1->whereDefined, v2->whereDefined)); COMPARERETURN (fileloc_compare (v1->whereSpecified, v2->whereSpecified)); } return 0; } int uentry_compare (uentry u1, uentry u2) { if (u1 == u2) return 0; if (uentry_isInvalid (u1)) return -1; if (uentry_isInvalid (u2)) return 1; INTCOMPARERETURN (u1->ukind, u2->ukind); COMPARERETURN (ctype_compare (u1->utype, u2->utype)); COMPARERETURN (bool_compare (uentry_isPriv (u1), uentry_isPriv (u2))); COMPARERETURN (sRef_compare (u1->sref, u2->sref)); switch (u1->ukind) { case KINVALID: case KELIPSMARKER: /* bug detected by splint: ** uentry.c:753,14: Return value type bool does not match declared type int: TRUE */ return 0; case KENUMCONST: case KCONST: return (multiVal_compare (uentry_getConstantValue (u1), uentry_getConstantValue (u2))); case KSTRUCTTAG: case KUNIONTAG: case KENUMTAG: return (ctype_compare (u1->info->datatype->type, u2->info->datatype->type)); case KITER: COMPARERETURN (typeIdSet_compare (uentry_accessType (u1), uentry_accessType (u2))); return (uentryList_compareParams (uentry_getParams (u1), uentry_getParams (u2))); case KENDITER: return (typeIdSet_compare (uentry_accessType (u1), uentry_accessType (u2))); case KFCN: /* ** Functions are never equivalent */ if (u1 - u2 < 0) /* evans 2001-08-21: was: ((int) u1 < (int) u2), changed to remove gcc warning */ { return -1; } else { return 1; } case KVAR: COMPARERETURN (generic_compare (u1->info->var->kind, u2->info->var->kind)); COMPARERETURN (generic_compare (sRef_getOrigAliasKind (u1->sref), sRef_getOrigAliasKind (u2->sref))); COMPARERETURN (generic_compare (sRef_getOrigExKind (u1->sref), sRef_getOrigExKind (u2->sref))); COMPARERETURN (generic_compare (u1->info->var->checked, u2->info->var->checked)); COMPARERETURN (generic_compare (u1->info->var->defstate, u2->info->var->defstate)); return (generic_compare (u1->info->var->nullstate, u2->info->var->nullstate)); case KDATATYPE: COMPARERETURN (ctype_compare (u1->info->datatype->type, u2->info->datatype->type)); COMPARERETURN (ynm_compare (u1->info->datatype->mut, u2->info->datatype->mut)); return (generic_compare (u1->info->datatype->abs, u2->info->datatype->abs)); } BADEXIT; } /* ** library format: ** ** all entries are: [@]*# ** ** info depends on kind: */ static void advanceField (char **s) { reader_checkChar (s, '@'); } static void advanceName (char **s) { reader_checkChar (s, '#'); } static vkind vkind_fromInt (int i) { if /*@+enumint@*/ (i < VKFIRST || i > VKLAST) /*@=enumint@*/ { llbuglit ("vkind_fromInt: out of range"); } return (vkind)i; } static uentry uentry_makeConstantBase (/*@only@*/ cstring name, ctype ct, typeIdSet access, nstate nullstate, /*@keep@*/ fileloc loc, /*@only@*/ multiVal m) { uentry e = uentry_alloc (); e->ukind = KCONST; e->uname = name; e->utype = ct; e->sref = sRef_makeConst (ct); sRef_setNullState (e->sref, nullstate, loc); e->storageclass = SCNONE; if (fileloc_isSpec (loc)) { e->whereSpecified = loc; e->whereDeclared = fileloc_undefined; } else { e->whereSpecified = fileloc_undefined; e->whereDeclared = loc; } e->whereDefined = fileloc_undefined; e->uses = filelocList_new (); e->isPrivate = FALSE; e->hasNameError = FALSE; e->used = FALSE; e->lset = FALSE; e->warn = warnClause_undefined; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->uconst = (ucinfo) dmalloc (sizeof (*e->info->uconst)); e->info->uconst->access = access; e->info->uconst->macro = FALSE; /* fix this when macro info added to library */ uentry_setConstantValue (e, m); sRef_storeState (e->sref); return (e); } static /*@only@*/ uentry uentry_makeVariableBase (/*@only@*/ cstring name, ctype ct, vkind kind, sstate defstate, nstate isnull, alkind aliased, exkind exp, chkind checked, /*@only@*/ fileloc loc) { uentry e = uentry_alloc (); e->ukind = KVAR; e->uname = name; e->utype = ct; e->storageclass = SCNONE; e->sref = sRef_makeType (ct); sRef_setNullState (e->sref, isnull, loc); e->whereDefined = fileloc_undefined; if (fileloc_isSpec (loc)) { e->whereSpecified = loc; e->whereDeclared = fileloc_undefined; } else { e->whereSpecified = fileloc_undefined; e->whereDeclared = loc; } e->isPrivate = FALSE; e->hasNameError = FALSE; e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->warn = warnClause_undefined; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->var = (uvinfo) dmalloc (sizeof (*e->info->var)); e->info->var->kind = kind; e->info->var->checked = checked; e->info->var->defstate = defstate; sRef_setDefState (e->sref, defstate, loc); e->info->var->nullstate = sRef_getNullState (e->sref); sRef_setExKind (e->sref, exp, loc); sRef_setAliasKind (e->sref, aliased, loc); sRef_storeState (e->sref); /*DRL ADDED 9-1-2000 */ e->info->var->bufinfo = NULL; return (e); } static /*@only@*/ uentry uentry_makeDatatypeBase (/*@only@*/ cstring name, ctype ct, qual abstract, ynm mut, ctype rtype, alkind ak, exkind exp, sstate defstate, nstate isnull, /*@only@*/ fileloc loc) { uentry e = uentry_alloc (); e->ukind = KDATATYPE; /* e->shallowCopy = FALSE; */ e->uname = name; e->utype = ct; e->storageclass = SCNONE; e->sref = sRef_makeUnknown (); DPRINTF (("Merge null 1: %s", sRef_unparseFull (e->sref))); /* ** This is only setting null state. (I think?) */ if (ctype_isUA (ct)) { uentry te = usymtab_getTypeEntrySafe (ctype_typeId (ct)); if (uentry_isValid (te)) { sRef_setStateFromUentry (e->sref, te); } else { /* problem for recursive type definitions */ } } sRef_setAliasKind (e->sref, ak, loc); sRef_setExKind (e->sref, exp, loc); sRef_setDefState (e->sref, defstate, loc); if (qual_isEitherAbstract (abstract) && ctype_isUnknown (ct) && isnull == NS_UNKNOWN) { isnull = NS_ABSNULL; } DPRINTF (("Merge null: %s", sRef_unparseFull (e->sref))); sRef_mergeNullState (e->sref, isnull); e->whereDefined = fileloc_copy (loc); /*< bogus! (but necessary for lexer) >*/ if (fileloc_isSpec (loc)) { e->whereSpecified = loc; e->whereDeclared = fileloc_undefined; } else { e->whereSpecified = fileloc_undefined; e->whereDeclared = loc; } e->isPrivate = FALSE; e->hasNameError = FALSE; e->warn = warnClause_undefined; e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->datatype = (udinfo) dmalloc (sizeof (*e->info->datatype)); e->info->datatype->abs = abstract; e->info->datatype->mut = mut; e->info->datatype->type = rtype; DPRINTF (("About to store: %s", sRef_unparseFull (e->sref))); sRef_storeState (e->sref); DPRINTF (("After store: %s", sRef_unparseFull (e->sref))); return (e); } static void uentry_setHasGlobs (uentry ue) { llassert (uentry_isFunction (ue)); ue->info->fcn->hasGlobs = TRUE; } static void uentry_setHasMods (uentry ue) { llassert (uentry_isFunction (ue)); ue->info->fcn->hasMods = TRUE; } bool uentry_hasGlobs (uentry ue) { if (uentry_isFunction (ue)) { return (ue->info->fcn->hasGlobs); } return FALSE; } bool uentry_hasStateClauseList (uentry ue) { return (uentry_isFunction (ue) && stateClauseList_isDefined (ue->info->fcn->specclauses)); } bool uentry_hasConditions (uentry ue) { return (uentry_isFunction (ue) && (functionConstraint_isDefined (ue->info->fcn->preconditions) || functionConstraint_isDefined (ue->info->fcn->postconditions))); } stateClauseList uentry_getStateClauseList (uentry ue) { if (!uentry_isFunction (ue)) { llassert (uentry_isFunction (ue)); return stateClauseList_undefined; } DPRINTF (("Get state clause list: %s", uentry_unparse (ue))); return ue->info->fcn->specclauses; } bool uentry_hasMods (uentry ue) { if (uentry_isFunction (ue)) { return (ue->info->fcn->hasMods); } return FALSE; } static uentry uentry_makeFunctionBase (/*@only@*/ cstring name, ctype ct, typeIdSet access, bool hasGlobs, /*@only@*/ globSet globs, bool hasMods, /*@only@*/ sRefSet mods, alkind ak, exkind exp, sstate defstate, nstate isnull, exitkind exitCode, specCode sCode, qual nullPred, /*@only@*/ stateClauseList specclauses, /*@only@*/ warnClause warnclause, /*@only@*/ fileloc loc) { uentry e = uentry_alloc (); ctype ret; /* e->shallowCopy = FALSE; */ e->ukind = KFCN; e->uname = name; e->utype = ct; e->storageclass = SCNONE; if (ctype_isFunction (ct)) { ret = ctype_getReturnType (ct); } else { if (ctype_isKnown (ct)) { llbug (message ("not function: %s", ctype_unparse (ct))); } ret = ctype_unknown; } e->sref = sRef_makeType (ret); if (ctype_isUA (ret)) { sRef_setStateFromType (e->sref, ret); } sRef_setDefined (e->sref, loc); sRef_setNullState (e->sref, isnull, loc); sRef_setAliasKind (e->sref, ak, loc); sRef_setExKind (e->sref, exp, loc); sRef_setDefState (e->sref, defstate, loc); e->whereSpecified = loc; e->whereDefined = fileloc_undefined; e->isPrivate = FALSE; e->hasNameError = FALSE; e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->warn = warnclause; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->fcn = (ufinfo) dmalloc (sizeof (*e->info->fcn)); e->info->fcn->exitCode = exitCode; e->info->fcn->specialCode = sCode; e->info->fcn->nullPred = nullPred; e->info->fcn->access = access; e->info->fcn->specclauses = specclauses; e->info->fcn->hasGlobs = hasGlobs; e->info->fcn->globs = globs; e->info->fcn->hasMods = hasMods; e->info->fcn->mods = mods; e->info->fcn->defparams = uentryList_undefined; e->whereDeclared = fileloc_undefined; sRef_storeState (e->sref); /*drl 111 30 2000*/ e->info->fcn->preconditions = NULL; /* end drl */ /*drl 12 28 2000*/ e->info->fcn->postconditions = NULL; /* end drl */ return (e); } static /*@only@*/ uentry uentry_makeTagBase (/*@only@*/ cstring name, ekind tagkind, ctype ct, ctype rtype, /*@only@*/ fileloc loc) { uentry e = uentry_alloc (); if (tagkind != KSTRUCTTAG && tagkind != KUNIONTAG && tagkind != KENUMTAG) { llbuglit ("uentry_makeTagBase: not a tag type"); } /* e->shallowCopy = FALSE; */ e->ukind = tagkind; e->uname = name; e->utype = ct; e->sref = sRef_makeUnknown (); e->storageclass = SCNONE; if (fileloc_isSpec (loc)) { e->whereSpecified = loc; e->whereDeclared = fileloc_undefined; } else { e->whereDeclared = loc; e->whereSpecified = fileloc_undefined; } e->whereDefined = fileloc_undefined; e->isPrivate = FALSE; e->hasNameError = FALSE; e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->warn = warnClause_undefined; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->datatype = (udinfo) dmalloc (sizeof (*e->info->datatype)); e->info->datatype->abs = qual_createUnknown (); e->info->datatype->mut = MAYBE; e->info->datatype->type = rtype; sRef_storeState (e->sref); return (e); } static uentry uentry_makeIterBase (/*@only@*/ cstring name, typeIdSet access, ctype ct, /*@only@*/ fileloc loc) { uentry e = uentry_alloc (); /* e->shallowCopy = FALSE; */ e->ukind = KITER; e->uname = name; e->utype = ct; e->sref = sRef_makeUnknown (); e->storageclass = SCNONE; if (fileloc_isSpec (loc)) { e->whereSpecified = loc; e->whereDeclared = fileloc_undefined; } else { e->whereDeclared = loc; e->whereSpecified = fileloc_undefined; } e->whereDefined = fileloc_undefined; e->isPrivate = FALSE; e->hasNameError = FALSE; e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->warn = warnClause_undefined; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->iter = (uiinfo) dmalloc (sizeof (*e->info->iter)); e->info->iter->access = access; e->info->iter->mods = sRefSet_undefined; e->info->iter->globs = globSet_undefined; sRef_storeState (e->sref); return (e); } static uentry uentry_makeEndIterBase (/*@only@*/ cstring name, typeIdSet access, /*@only@*/ fileloc loc) { uentry e = uentry_alloc (); /* e->shallowCopy = FALSE; */ e->ukind = KENDITER; e->storageclass = SCNONE; e->uname = name; e->utype = ctype_unknown; e->sref = sRef_makeUnknown (); if (fileloc_isSpec (loc)) { e->whereSpecified = loc; e->whereDeclared = fileloc_undefined; } else { e->whereDeclared = loc; e->whereSpecified = fileloc_undefined; } e->whereDefined = fileloc_undefined; e->isPrivate = FALSE; e->hasNameError = FALSE; e->used = FALSE; e->lset = FALSE; e->uses = filelocList_new (); e->warn = warnClause_undefined; e->info = (uinfo) dmalloc (sizeof (*e->info)); e->info->enditer = (ueinfo) dmalloc (sizeof (*e->info->enditer)); e->info->enditer->access = access; sRef_storeState (e->sref); return (e); } void uentry_markFree (/*@unused@*/ /*@owned@*/ uentry u) { /* should save u */ /*@-mustfree@*/ } /*@=mustfree@*/ /*@only@*/ uentry uentry_undump (ekind kind, fileloc loc, char **s) { uentry ue; DPRINTF (("Uentry undump: %s", *s)); if (**s == '!') { reader_checkChar (s, '!'); reader_checkChar (s, '.'); ue = uentry_makeElipsisMarker (); } else { ctype ct = ctype_undump (s); cstring name; switch (kind) { case KVAR: { vkind tkind; sstate defstate; nstate isnull; alkind aliased; exkind exp; chkind checked; reader_checkChar (s, '|'); if (reader_optCheckChar (s, '@')) { tkind = vkind_fromInt (reader_getInt (s)); reader_checkChar (s, '|'); } else { tkind = VKPARAM; } if (reader_optCheckChar (s, '$')) { defstate = SS_UNKNOWN; isnull = NS_UNKNOWN; aliased = AK_IMPTEMP; exp = XO_UNKNOWN; checked = CH_UNKNOWN; } else if (reader_optCheckChar (s, '&')) { defstate = SS_DEFINED; isnull = NS_UNKNOWN; aliased = AK_IMPTEMP; exp = XO_UNKNOWN; checked = CH_UNKNOWN; } else if (reader_optCheckChar (s, '^')) { defstate = SS_UNKNOWN; isnull = NS_UNKNOWN; aliased = AK_IMPTEMP; exp = XO_UNKNOWN; checked = CH_UNKNOWN; } else { defstate = sstate_fromInt (reader_getInt (s)); advanceField (s); isnull = nstate_fromInt (reader_getInt (s)); advanceField (s); aliased = alkind_fromInt (reader_getInt (s)); if (reader_optCheckChar (s, '&')) { exp = XO_UNKNOWN; checked = CH_UNKNOWN; } else { advanceField (s); exp = exkind_fromInt (reader_getInt (s)); advanceField (s); checked = (chkind) (reader_getInt (s)); } } advanceName (s); name = reader_getStringWord (s); llassert (!cstring_equal (name, GLOBAL_MARKER_NAME)); ue = uentry_makeVariableBase (name, ct, tkind, defstate, isnull, aliased, exp, checked, fileloc_copy (loc)); } break; case KDATATYPE: { qual abstract; ynm mut; ctype rtype; sstate defstate; nstate isnull; alkind aliased; exkind exp; advanceField (s); abstract = qual_abstractFromCodeChar (reader_loadChar (s)); advanceField (s); mut = ynm_fromCodeChar (reader_loadChar (s)); advanceField (s); defstate = sstate_fromInt (reader_getInt (s)); advanceField (s); isnull = nstate_fromInt (reader_getInt (s)); advanceField (s); aliased = alkind_fromInt (reader_getInt (s)); advanceField (s); exp = exkind_fromInt (reader_getInt (s)); advanceField (s); rtype = ctype_undump (s); advanceName (s); name = reader_getStringWord (s); DPRINTF (("Datatype %s, Exp = %s", name, exkind_unparse (exp))); ue = uentry_makeDatatypeBase (name, ct, abstract, mut, rtype, aliased, exp, defstate, isnull, fileloc_copy (loc)); } break; case KFCN: { alkind ak; exkind exp; sstate defstate; nstate isnull; exitkind exitCode; specCode specc; qual nullPred; typeIdSet access; bool hasGlobs; globSet globs; bool hasMods; sRefSet mods; stateClauseList specclauses = stateClauseList_undefined; warnClause warnclause = warnClause_undefined; if (reader_optCheckChar (s, '$')) { defstate = SS_DEFINED; isnull = NS_UNKNOWN; exitCode = XK_UNKNOWN; specc = SPC_NONE; nullPred = qual_createUnknown (); } else { advanceField (s); defstate = sstate_fromInt (reader_getInt (s)); advanceField (s); isnull = nstate_fromInt (reader_getInt (s)); advanceField (s); exitCode = exitkind_fromInt (reader_getInt (s)); advanceField (s); specc = specCode_fromInt (reader_getInt (s)); advanceField (s); nullPred = qual_undump (s); } if (reader_optCheckChar (s, '$')) { hasGlobs = FALSE; globs = globSet_undefined; hasMods = FALSE; mods = sRefSet_undefined; } else if (reader_optCheckChar (s, '^')) { hasGlobs = TRUE; globs = globSet_undefined; hasMods = TRUE; mods = sRefSet_undefined; } else { advanceField (s); hasGlobs = bool_fromInt (reader_getInt (s)); advanceField (s); globs = globSet_undump (s); advanceField (s); hasMods = bool_fromInt (reader_getInt (s)); advanceField (s); mods = sRefSet_undump (s); } if (reader_optCheckChar (s, '$')) { ak = AK_UNKNOWN; exp = XO_UNKNOWN; } else { advanceField (s); ak = alkind_fromInt (reader_getInt (s)); advanceField (s); exp = exkind_fromInt (reader_getInt (s)); } advanceField (s); access = typeIdSet_undump (s); /* ** Optional clauses: Start with @: */ while (reader_optCheckChar (s, '@')) { if (reader_optCheckChar (s, 'W')) /* Warn clause */ { reader_checkChar (s, ':'); warnclause = warnClause_undump (s); } else if (reader_optCheckChar (s, 'S')) /* stateClause List */ { reader_checkChar (s, ':'); specclauses = stateClauseList_undump (s); } else { BADBRANCH; } } advanceName (s); name = reader_getStringWord (s); ue = uentry_makeFunctionBase (name, ct, access, hasGlobs, globs, hasMods, mods, ak, exp, defstate, isnull, exitCode, specc, nullPred, specclauses, warnclause, fileloc_copy (loc)); DPRINTF (("Undump: %s", uentry_unparse (ue))); } break; case KITER: { typeIdSet access; advanceField (s); access = typeIdSet_undump (s); advanceName (s); name = reader_getStringWord (s); ue = uentry_makeIterBase (name, access, ct, fileloc_copy (loc)); } break; case KENDITER: { typeIdSet access; advanceField (s); access = typeIdSet_undump (s); advanceName (s); name = reader_getStringWord (s); ue = uentry_makeEndIterBase (name, access, fileloc_copy (loc)); } break; case KENUMCONST: case KCONST: { typeIdSet access; multiVal val; nstate nullstate; if (reader_optCheckChar (s, '$')) { val = multiVal_undefined; access = typeIdSet_undefined; nullstate = NS_UNKNOWN; } else { advanceField (s); val = multiVal_undump (s); advanceField (s); access = typeIdSet_undump (s); advanceField (s); nullstate = nstate_fromInt (reader_getInt (s)); } advanceName (s); name = reader_getStringWord (s); ue = uentry_makeConstantBase (name, ct, access, nullstate, fileloc_copy (loc), val); break; } case KSTRUCTTAG: case KUNIONTAG: case KENUMTAG: { ctype rtype; advanceField (s); rtype = ctype_undump (s); advanceName (s); name = reader_getStringWord (s); ue = uentry_makeTagBase (name, kind, ct, rtype, fileloc_copy (loc)); } break; case KINVALID: llcontbuglit ("uentry_undump: invalid"); ue = uentry_undefined; break; case KELIPSMARKER: llcontbuglit ("uentry_undump: elips marker"); ue = uentry_undefined; break; } } return (ue); } cstring uentry_dump (uentry v) { return (uentry_dumpAux (v, FALSE)); } cstring uentry_dumpParam (uentry v) { llassertprint (uentry_isVariable (v) || uentry_isElipsisMarker (v), ("dump: %s", uentry_unparseFull (v))); return (uentry_dumpAux (v, TRUE)); } static cstring uentry_dumpAux (uentry v, bool isParam) { llassert (uentry_isValid (v)); llassert (!uentry_isGlobalMarker (v)); DPRINTF (("Dump uentry: [%p]", v)); DPRINTF (("Dumping entry: %s", uentry_unparseFull (v))); switch (v->ukind) { case KINVALID: llcontbuglit ("uentry_dump: invalid entry"); return cstring_undefined; case KELIPSMARKER: return (message ("!.")); case KVAR: { cstring sdump; vkind vk = v->info->var->kind; sstate dss = sRef_getDefState (v->sref); nstate nst = sRef_getNullState (v->sref); alkind alk = sRef_getAliasKind (v->sref); exkind exk = sRef_getExKind (v->sref); chkind chk = v->info->var->checked; DPRINTF (("Dumping var")); if (dss == SS_UNKNOWN && nst == NS_UNKNOWN && alk == AK_IMPTEMP && exk == XO_UNKNOWN && chk == CH_UNKNOWN) { sdump = cstring_makeLiteral ("$"); } else if (dss == SS_DEFINED && nst == NS_UNKNOWN && alk == AK_IMPTEMP && exk == XO_UNKNOWN && chk == CH_UNKNOWN) { sdump = cstring_makeLiteral ("&"); } else if (dss == SS_UNKNOWN && nst == NS_UNKNOWN && alk == AK_UNKNOWN && exk == XO_UNKNOWN && chk == CH_UNKNOWN) { sdump = cstring_makeLiteral ("^"); } else if (exk == XO_UNKNOWN && chk == CH_UNKNOWN) { sdump = message ("%d@%d@%d&", (int) dss, (int) nst, (int) alk); } else { sdump = message ("%d@%d@%d@%d@%d", (int) dss, (int) nst, (int) alk, (int) exk, (int) chk); } if (vk != VKPARAM) { return (message ("%q|@%d|%q#%s", ctype_dump (v->utype), (int) vk, sdump, isParam ? cstring_undefined : v->uname)); } else { return (message ("%q|%q#%s", ctype_dump (v->utype), sdump, isParam ? cstring_undefined : v->uname)); } } case KDATATYPE: /* DPRINTF (("Dumping datatype: %s -> %s type: %s [%d]", uentry_unparse (v), exkind_unparse (sRef_getExKind (v->sref)), ctype_unparse (v->utype), (int) v->utype)); */ return (message ("%q@%c@%s@%d@%d@%d@%d@%q#%s", ctype_dump (v->utype), qual_abstractCode (v->info->datatype->abs), ynm_unparseCode (v->info->datatype->mut), (int) sRef_getDefState (v->sref), (int) sRef_getNullState (v->sref), (int) sRef_getAliasKind (v->sref), (int) sRef_getExKind (v->sref), ctype_dump (v->info->datatype->type), v->uname)); case KFCN: { cstring sdump, gdump, adump, xdump; alkind alk = sRef_getAliasKind (v->sref); exkind exk = sRef_getExKind (v->sref); if (sRef_getDefState (v->sref) == SS_DEFINED && !nstate_isKnown (sRef_getNullState (v->sref)) && !exitkind_isKnown (v->info->fcn->exitCode) && v->info->fcn->specialCode == SPC_NONE && qual_isUnknown (v->info->fcn->nullPred)) { sdump = cstring_makeLiteral ("$"); } else { sdump = message ("@%d@%d@%d@%d@%x", (int) sRef_getDefState (v->sref), (int) sRef_getNullState (v->sref), (int) v->info->fcn->exitCode, (int) v->info->fcn->specialCode, qual_dump (v->info->fcn->nullPred)); } if (!uentry_hasGlobs(v) && !uentry_hasMods (v)) { gdump = cstring_makeLiteral ("$"); } else if (uentry_hasGlobs (v) && globSet_isEmpty (uentry_getGlobs (v)) && uentry_hasMods (v) && sRefSet_isEmpty (uentry_getMods (v))) { gdump = cstring_makeLiteral ("^"); } else { gdump = message ("@%s@%q@%s@%q", bool_dump (uentry_hasGlobs (v)), globSet_dump (uentry_getGlobs (v)), bool_dump (uentry_hasMods (v)), sRefSet_dump (uentry_getMods (v))); } if (alk == AK_UNKNOWN && exk == XO_UNKNOWN) { adump = cstring_makeLiteral ("$"); } else { adump = message ("@%d@%d", (int) alk, (int) exk); } xdump = cstring_undefined; if (uentry_hasWarning (v)) { xdump = message ("%q@W:%q", xdump, warnClause_dump (v->warn)); } if (uentry_hasStateClauseList (v)) { xdump = message ("%q@S:%q", xdump, stateClauseList_dump (v->info->fcn->specclauses)); } return (message ("%q%q%q%q@%q%q#%s", ctype_dump (v->utype), sdump, gdump, adump, typeIdSet_dump (uentry_accessType (v)), xdump, v->uname)); } case KITER: return (message ("%q@%q#%s", ctype_dump (v->utype), typeIdSet_dump (v->info->iter->access), v->uname)); case KENDITER: return (message ("%q@%q#%s", ctype_dump (v->utype), typeIdSet_dump (uentry_accessType (v)), v->uname)); case KENUMCONST: case KCONST: { cstring sdump; if (multiVal_isUnknown (uentry_getConstantValue (v)) && typeIdSet_isEmpty (uentry_accessType (v)) && (sRef_getNullState (v->sref) == NS_UNKNOWN)) { sdump = cstring_makeLiteral ("$"); } else { sdump = message ("@%q@%q@%d", multiVal_dump (uentry_getConstantValue (v)), typeIdSet_dump (uentry_accessType (v)), (int) sRef_getNullState (v->sref)); } return (message ("%q%q#%s", ctype_dump (v->utype), sdump, v->uname)); } case KSTRUCTTAG: case KUNIONTAG: case KENUMTAG: return (message ("%q@%q#%s", ctype_dump (v->utype), ctype_dump (v->info->datatype->type), v->uname)); } BADEXIT; } /*@only@*/ cstring uentry_unparseAbbrev (uentry v) { if (!uentry_isVariable (v)) { llcontbuglit ("uentry_unparseAbbrev: not variable"); return uentry_unparse (v); } return (message ("%s %q", ctype_unparseDeep (v->utype), uentry_getName (v))); } /*@only@*/ cstring uentry_unparse (uentry v) { cstring st; if (uentry_isUndefined (v)) return (cstring_makeLiteral ("")); if (uentry_isElipsisMarker (v)) return (cstring_makeLiteral ("...")); st = uentry_getName (v); if (cstring_isDefined (st)) { return (ctype_unparseDeclaration (v->utype, st)); } else { cstring_free (st); return (cstring_copy (ctype_unparse (v->utype))); } } /*@only@*/ cstring uentry_unparseFull (uentry v) { if (uentry_isUndefined (v)) { return (cstring_makeLiteral ("")); } else { cstring res; res = message ("[%p] %s %s: %s [spec: %q; decl: %q; def: %q]", v, ekind_unparse (v->ukind), v->uname, ctype_unparse (v->utype), fileloc_unparse (uentry_whereSpecified (v)), fileloc_unparse (uentry_whereDeclared (v)), fileloc_unparse (uentry_whereDefined (v))); DPRINTF (("uentry: %s", res)); if (uentry_isDatatype (v)) { res = message ("%q / type: %s mut: %s abs: %s state: %q", res, ctype_unparse (ctype_isDefined (v->info->datatype->type) ? v->info->datatype->type : ctype_unknown), ynm_unparse (v->info->datatype->mut), qual_unparse (v->info->datatype->abs), sRef_unparseState (v->sref)); } else if (uentry_isFunction (v)) { res = message ("%q / sref: %q / mods: %q / " "globs: %q / clauses: %q / pre: %q / post: %q", res, sRef_unparseFull (v->sref), sRefSet_unparse (v->info->fcn->mods), globSet_unparse (v->info->fcn->globs), stateClauseList_unparse (v->info->fcn->specclauses), functionConstraint_unparse (v->info->fcn->preconditions), functionConstraint_unparse (v->info->fcn->postconditions)); } else if (uentry_isIter (v)) { res = message ("%q / sref: %q", res, sRef_unparseFull (v->sref)); } else if (uentry_isVariable (v)) { res = message ("%q / sref: %q / kind <%d> isout <%d> null <%d> used <%d>", res, sRef_unparseFull (v->sref), (int) v->info->var->kind, (int) v->info->var->defstate, (int) v->info->var->nullstate, (int) v->used); DPRINTF (("sref: [%p]", v->sref)); DPRINTF (("sref: %s", sRef_unparseDebug (v->sref))); /* DPRINTF (("sref: %s", sRef_unparseDeep (v->sref))); */ } else if (uentry_isConstant (v)) { res = message ("%q = %q / %q", res, multiVal_unparse (uentry_getConstantValue (v)), sRef_unparseFull (v->sref)); } else { res = message ("%q :: %q", res, uentry_unparse (v)); } return res; } } bool uentry_hasAccessType (uentry e) { if (uentry_isValid (e)) { switch (e->ukind) { case KITER: return (!typeIdSet_isEmpty (e->info->iter->access)); case KENDITER: return (!typeIdSet_isEmpty (e->info->enditer->access)); case KFCN: return (!typeIdSet_isEmpty (e->info->fcn->access)); case KENUMCONST: case KCONST: return (!typeIdSet_isEmpty (e->info->uconst->access)); default: return FALSE; } } return FALSE; } typeIdSet uentry_accessType (uentry e) { if (uentry_isValid (e)) { switch (e->ukind) { case KITER: return (e->info->iter->access); case KENDITER: return (e->info->enditer->access); case KFCN: return (e->info->fcn->access); case KENUMCONST: case KCONST: return (e->info->uconst->access); default: break; } } return typeIdSet_undefined; } bool uentry_isVariable (uentry e) { return (uentry_isVar (e)); } bool uentry_isSpecified (uentry e) { return (uentry_isValid (e) && !fileloc_isUndefined (e->whereSpecified)); } static bool uentry_isReallySpecified (uentry e) { return (uentry_isValid (e) && fileloc_isRealSpec (e->whereSpecified)); } bool uentry_isVar (uentry e) { return (!uentry_isUndefined (e) && e->ukind == KVAR); } bool uentry_isFakeTag (uentry e) { return (uentry_isValid (e) && strchr (cstring_toCharsSafe (e->uname), '!') != 0); } bool uentry_isDatatype (uentry e) { return (!uentry_isUndefined (e) && (e->ukind == KDATATYPE || e->ukind == KSTRUCTTAG || e->ukind == KUNIONTAG || e->ukind == KENUMTAG)); } void uentry_setAbstract (uentry e) { typeId oldid; llassert (uentry_isDatatype (e) && (qual_isUnknown (e->info->datatype->abs))); oldid = ctype_typeId (e->info->datatype->type); e->info->datatype->abs = qual_createAbstract (); e->info->datatype->type = ctype_createAbstract (oldid); } void uentry_setConcrete (uentry e) { llassert (uentry_isDatatype (e) && (qual_isUnknown (e->info->datatype->abs) || qual_isConcrete (e->info->datatype->abs))); e->info->datatype->abs = qual_createConcrete (); } bool uentry_isAbstractDatatype (uentry e) { return (uentry_isDatatype (e) && (qual_isEitherAbstract (e->info->datatype->abs))); } bool uentry_isMaybeAbstract (uentry e) { return (uentry_isDatatype (e) && (!qual_isConcrete (e->info->datatype->abs))); } bool uentry_isMutableDatatype (uentry e) { if (uentry_isDatatype (e)) { if (ctype_isNumAbstract (e->info->datatype->type)) { return FALSE; } else { return ynm_toBoolRelaxed (e->info->datatype->mut); } } return FALSE; } bool uentry_isRefCountedDatatype (uentry e) { return (uentry_isDatatype (e) && (sRef_isRefCounted (uentry_getSref (e)))); } bool uentry_isParam (uentry u) { return (uentry_isVariable (u) && (u->info->var->kind == VKPARAM || u->info->var->kind == VKYIELDPARAM)); } bool uentry_isExpandedMacro (uentry u) { return (uentry_isVariable (u) && (u->info->var->kind == VKEXPMACRO)); } bool uentry_isSefParam (uentry u) { return (uentry_isVariable (u) && (u->info->var->kind == VKSEFPARAM || u->info->var->kind == VKREFSEFPARAM || u->info->var->kind == VKSEFRETPARAM || u->info->var->kind == VKREFSEFRETPARAM)); } bool uentry_isRefParam (uentry u) { return (uentry_isVariable (u) && (u->info->var->kind == VKREFPARAM || u->info->var->kind == VKREFYIELDPARAM || u->info->var->kind == VKREFSEFPARAM || u->info->var->kind == VKREFSEFRETPARAM)); } bool uentry_isAnyParam (uentry u) { return (uentry_isVariable (u) && ((u->info->var->kind == VKPARAM) || (u->info->var->kind == VKSEFPARAM) || (u->info->var->kind == VKYIELDPARAM) || (u->info->var->kind == VKRETPARAM) || (u->info->var->kind == VKSEFRETPARAM))); } sstate uentry_getDefState (uentry u) { if (uentry_isValid (u)) { return (sRef_getDefState (u->sref)); } else { return (SS_UNKNOWN); } } bool uentry_isOut (uentry u) { return ((uentry_isVariable (u) && (u->info->var->defstate == SS_ALLOCATED)) || (uentry_isDatatype (u) && (sRef_isAllocated (u->sref)))); } bool uentry_isPartial (uentry u) { return ((uentry_isVariable (u) && (u->info->var->defstate == SS_PARTIAL)) || (uentry_isDatatype (u) && (sRef_isAllocated (u->sref)))); } bool uentry_isStateSpecial (uentry u) { return ((uentry_isVariable (u) && (u->info->var->defstate == SS_SPECIAL)) || (uentry_isValid (u) && sRef_isStateSpecial (u->sref))); } exitkind uentry_getExitCode (uentry ue) { if (uentry_isFunction (ue)) { return ue->info->fcn->exitCode; } else { return XK_UNKNOWN; } } qual uentry_nullPred (uentry u) { llassert (uentry_isRealFunction (u)); if (uentry_isFunction (u)) { return (u->info->fcn->nullPred); } else { return qual_createUnknown (); } } /* ** Note for variables, this is checking the declared state, not the current state. */ bool uentry_possiblyNull (uentry u) { return ((uentry_isVariable (u) && (nstate_possiblyNull (u->info->var->nullstate))) || (uentry_isDatatype (u) && (sRef_possiblyNull (u->sref)))); } alkind uentry_getAliasKind (uentry u) { if (uentry_isValid (u)) { return (sRef_getAliasKind (uentry_getSref (u))); } else { return AK_UNKNOWN; } } exkind uentry_getExpKind (uentry u) { if (uentry_isValid (u)) { return (sRef_getExKind (uentry_getSref (u))); } else { return XO_UNKNOWN; } } bool uentry_isIter (uentry e) { return (!uentry_isUndefined (e) && e->ukind == KITER); } bool uentry_isEndIter (uentry e) { return (!uentry_isUndefined (e) && e->ukind == KENDITER); } bool uentry_isRealFunction (uentry e) { return (uentry_isFunction (e) || (uentry_isVariable (e) && ctype_isFunction (uentry_getType (e)))); } bool uentry_hasName (uentry e) { if (uentry_isValid (e)) { cstring s = e->uname; return (!(cstring_isEmpty (s) || cstring_equalLit (s, "...") || uentry_isFakeTag (e))); } else { return FALSE; } } /* ** Returns true for fake tags. ** This is used for dumping the library */ bool uentry_hasRealName (uentry e) { return (uentry_isValid (e) && cstring_isNonEmpty (e->uname) && !uentry_isGlobalMarker (e)); } /*@observer@*/ globSet uentry_getGlobs (uentry l) { if (uentry_isInvalid (l)) { return globSet_undefined; } if (uentry_isFunction (l)) { return l->info->fcn->globs; } else if (uentry_isIter (l)) { return l->info->iter->globs; } else if (uentry_isEndIter (l)) { return globSet_undefined; } else { if (l->ukind == KVAR) { llcontbug (message ("Bad call to uentry_getGlobs (var): %q (%s)", uentry_unparse (l), ekind_unparse (l->ukind))); } else { llcontbug (message ("Bad call to uentry_getGlobs: %q (%s)", uentry_unparse (l), ekind_unparse (l->ukind))); } return globSet_undefined; } } # ifdef WIN32 /* Make Microsoft VC++ happy */ # pragma warning (disable : 4715) # endif /*@observer@*/ sRefSet uentry_getMods (uentry l) { llassert (uentry_isValid (l)); if (l->ukind != KFCN && l->ukind != KITER && l->ukind != KENDITER) { llcontbug (message ("Bad call to uentry_getMods: %q", uentry_unparse (l))); return sRefSet_undefined; } if (uentry_isFunction (l)) { return l->info->fcn->mods; } else if (uentry_isIter (l)) { return l->info->iter->mods; } else if (uentry_isEndIter (l)) { return sRefSet_undefined; } else { BADBRANCH; } } ekind uentry_getKind (uentry e) { llassert (uentry_isValid (e)); return (e->ukind); } /*@observer@*/ multiVal uentry_getConstantValue (uentry e) { llassert (uentry_isEitherConstant (e)); return (sRef_getValue (e->sref)); } /*@observer@*/ uentryList uentry_getParams (uentry l) { if (uentry_isInvalid (l)) return uentryList_undefined; switch (l->ukind) { case KFCN: case KITER: { ctype ct = l->utype; if (ctype_isFunction (ct)) { return (ctype_argsFunction (ct)); } else { return uentryList_undefined; } } case KVAR: { ctype ct = l->utype; /*drl 12/10/2002 changed to fix bug involving multiple redefines of library functions in macros. Bug was reported by Malcolm Parsons Old code was simplly llassert (ctype_isFunction (ct) ); */ llassert (ctype_isFunction (ct) || context_inMacro() ); return (ctype_argsFunction (ct)); } BADDEFAULT; } BADEXIT; } /*@observer@*/ cstring uentry_rawName (uentry e) { if (uentry_isValid (e)) { return (e->uname); } else { return cstring_undefined; } } static cstring uentry_getOptName (uentry e) { cstring s = uentry_getName (e); if (cstring_isDefined (s)) { s = cstring_appendChar (s, ' '); } return s; } /*@only@*/ cstring uentry_getName (uentry e) { cstring ret = cstring_undefined; if (uentry_isValid (e)) { if (uentry_isAnyTag (e)) { ret = fixTagName (e->uname); } else if (uentry_isAnyParam (e)) { ret = cstring_copy (fixParamName (e->uname)); } else { ret = cstring_copy (e->uname); } } return ret; } cstring uentry_observeRealName (uentry e) { cstring ret = cstring_undefined; if (uentry_isValid (e)) { if (uentry_isAnyTag (e)) { if (isFakeTag (e->uname)) { ret = cstring_undefined; } else { ret = plainTagName (e->uname); } } else if (uentry_isAnyParam (e)) { ret = fixParamName (e->uname); } else { ret = e->uname; } } return ret; } cstring uentry_getRealName (uentry e) { if (uentry_isValid (e)) { if (uentry_isAnyTag (e)) { return (cstring_undefined); } else { return (e->uname); } } return cstring_undefined; } ctype uentry_getType (uentry e) { if (uentry_isValid (e)) { return e->utype; } else { return ctype_unknown; } } fileloc uentry_whereLast (uentry e) { fileloc loc; if (uentry_isInvalid (e)) { return fileloc_undefined; } loc = e->whereDefined; if (fileloc_isValid (loc) && !fileloc_isExternal (loc)) { return loc; } loc = uentry_whereDeclared (e); if (fileloc_isValid (loc) && !fileloc_isExternal (loc)) { return loc; } loc = uentry_whereSpecified (e); return loc; } fileloc uentry_whereEither (uentry e) { if (uentry_isInvalid (e)) return fileloc_undefined; if (fileloc_isDefined (e->whereDefined) && !fileloc_isExternal (e->whereDefined)) { return e->whereDefined; } else if (fileloc_isDefined (e->whereDeclared)) { return e->whereDeclared; } else { return e->whereSpecified; } } fileloc uentry_whereSpecified (uentry e) { if (uentry_isInvalid (e)) return fileloc_undefined; return (e->whereSpecified); } fileloc uentry_whereDefined (uentry e) { if (uentry_isInvalid (e)) return fileloc_undefined; return (e->whereDefined); } fileloc uentry_whereDeclared (uentry e) { if (uentry_isInvalid (e)) return fileloc_undefined; return (e->whereDeclared); } /*@observer@*/ fileloc uentry_whereEarliest (uentry e) { if (uentry_isInvalid (e)) return fileloc_undefined; if (fileloc_isDefined (e->whereSpecified)) { return (e->whereSpecified); } else if (fileloc_isDefined (e->whereDeclared)) { return (e->whereDeclared); } else { return e->whereDefined; } } void uentry_setFunctionDefined (uentry e, fileloc loc) { if (uentry_isValid (e)) { llassert (uentry_isFunction (e)); if (fileloc_isUndefined (e->whereDeclared)) { e->whereDeclared = fileloc_update (e->whereDeclared, loc); } if (!fileloc_isDefined (e->whereDefined)) { e->whereDefined = fileloc_update (e->whereDefined, loc); } } } void uentry_setDeclDef (uentry e, fileloc f) { uentry_setDeclared (e, f); if (!uentry_isFunction (e) && !(uentry_isVariable (e) && uentry_isExtern (e))) { uentry_setDefined (e, f); } } void uentry_setDeclaredForce (uentry e, fileloc f) { llassert (uentry_isValid (e)); e->whereDeclared = fileloc_update (e->whereDeclared, f); } void uentry_setDeclaredForceOnly (uentry e, fileloc f) { llassert (uentry_isValid (e)); fileloc_free (e->whereDeclared); e->whereDeclared = f; } void uentry_setDeclaredOnly (uentry e, /*@only@*/ fileloc f) { fileloc oldloc; llassert (uentry_isValid (e)); oldloc = e->whereDeclared; if (fileloc_isDefined (oldloc)) { if (fileloc_isLib (oldloc) || fileloc_isImport (oldloc)) { e->whereDeclared = f; fileloc_free (oldloc); } else { fileloc_free (f); } } else { e->whereDeclared = f; fileloc_free (oldloc); } } void uentry_setDeclared (uentry e, fileloc f) { fileloc oldloc; llassert (uentry_isValid (e)); oldloc = e->whereDeclared; if (fileloc_isDefined (oldloc)) { if (fileloc_isLib (oldloc) || fileloc_isImport (oldloc)) { e->whereDeclared = fileloc_update (e->whereDeclared, f); } else { ; } } else { e->whereDeclared = fileloc_update (e->whereDeclared, f); } } void uentry_clearDefined (uentry e) { if (uentry_isValid (e)) { e->whereDefined = fileloc_update (e->whereDefined, fileloc_undefined); } } void uentry_setDefined (uentry e, fileloc f) { fileloc oldloc; llassert (uentry_isValid (e)); oldloc = e->whereDefined; if (fileloc_isDefined (oldloc)) { if (fileloc_isLib (oldloc) || fileloc_isImport (oldloc) || fileloc_isBuiltin (oldloc) || fileloc_isPreproc (oldloc)) { e->whereDefined = fileloc_update (e->whereDefined, f); } else { if (fileloc_equal (oldloc, f) || context_processingMacros ()) { ; /* okay */ } else { if (optgenerror (FLG_REDEF, message ("%s %q redefined", ekind_capName (e->ukind), uentry_getName (e)), f)) { llgenindentmsg (message ("Previous definition of %q", uentry_getName (e)), e->whereDefined); } } } } else { e->whereDefined = fileloc_update (e->whereDefined, f); } } bool uentry_isCodeDefined (uentry e) { llassert (uentry_isValid (e)); return (fileloc_isDefined (e->whereDefined)); } bool uentry_isDeclared (uentry e) { if (uentry_isValid (e)) { return (fileloc_isDefined (e->whereDeclared)); } return FALSE; } sRef uentry_getSref (uentry e) { /* not true, used for functions too (but shouldn't be? */ /* llassertprint (e->ukind == KVAR, ("uentry_getSref: not variable!")); */ if (uentry_isInvalid (e)) return sRef_undefined; return (e->sref); } sRef uentry_getOrigSref (uentry e) { /* evans 2003-04-12 - removed for now */ /* evans 2001-09-09 - need to fix this if (uentry_isValid (e)) { if (uentry_isVariable (e)) { return e->info->var->origsref; } else { sRef sr = sRef_copy (uentry_getSref (e)); sRef_resetState (sr); sRef_clearDerived (sr); return (sr); } } else { return sRef_undefined; } */ if (uentry_isValid (e)) { sRef sr = sRef_copy (uentry_getSref (e)); sRef_resetState (sr); sRef_clearDerived (sr); if (uentry_isVariable (e)) { sRef_setDefState (sr, e->info->var->defstate, fileloc_undefined); sRef_setNullState (sr, e->info->var->nullstate, fileloc_undefined); } return (sr); } else { return sRef_undefined; } } /* ** requires: uentry e is not in a hashed symbol table */ void uentry_setName (uentry e, /*@only@*/ cstring n) { llassert (uentry_isValid (e)); cstring_free (e->uname); e->uname = n; } void uentry_setType (uentry e, ctype t) { if (uentry_isValid (e)) { e->utype = t; sRef_setType (e->sref, t); } } void uentry_resetParams (uentry ue, /*@only@*/ uentryList pn) { ctype rct; ctype rettype = ctype_unknown; llassert (uentry_isValid (ue)); uentry_convertVarFunction (ue); llassert (uentry_isFunction (ue)); rct = ctype_realType (ue->utype); if (ctype_isFunction (rct)) { rettype = ctype_getReturnType (rct); } ue->utype = ctype_makeNFParamsFunction (rettype, pn); } void uentry_setRefParam (uentry e) { if (!uentry_isVar (e)) { llbug (message ("uentry_setParam: not variable: %q", uentry_unparse (e))); } else { if (e->info->var->kind == VKSEFPARAM) { e->info->var->kind = VKREFSEFPARAM; } else if (e->info->var->kind == VKSEFRETPARAM) { e->info->var->kind = VKREFSEFRETPARAM; } else if (e->info->var->kind == VKYIELDPARAM) { e->info->var->kind = VKREFYIELDPARAM; } else { e->info->var->kind = VKREFPARAM; } } } void uentry_setParam (uentry e) { if (!uentry_isVar (e)) { if (uentry_isElipsisMarker (e)) { } else { llbug (message ("uentry_setParam: not variable: %q", uentry_unparse (e))); } } else { cstring oldname; if (e->info->var->kind == VKYIELDPARAM || e->info->var->kind == VKSEFPARAM || e->info->var->kind == VKSEFRETPARAM) { ; } else { e->info->var->kind = VKPARAM; } oldname = e->uname; e->uname = makeParam (e->uname); cstring_free (oldname); } } void uentry_setSref (uentry e, sRef s) { if (uentry_isValid (e)) { if (sRef_isValid (e->sref)) { sRef_mergeStateQuietReverse (e->sref, s); } else { e->sref = sRef_saveCopy (s); } } } ctype uentry_getAbstractType (uentry e) { llassert (uentry_isDatatype (e)); /* ** This assertion removed. ** Okay to have undefined type, for system types llassertprintret (!ctype_isUndefined (e->info->datatype->type), ("uentry_getAbstractType %q: undefined", uentry_unparseFull (e)), e->utype); */ if (ctype_isUndefined (e->info->datatype->type)) { return ctype_unknown; } /* ** Sadly, a kludge... */ if (ctype_isUserBool (e->info->datatype->type)) { return ctype_bool; } return e->info->datatype->type; } ctype uentry_getRealType (uentry e) { ctype ct; typeId uid = typeId_invalid; if (uentry_isInvalid (e)) { return ctype_unknown; } if (!uentry_isDatatype (e)) { /* This shouldn't happen, except when types are redeclared in strange ways */ return ctype_unknown; } if (uentry_isAnyTag (e)) { return (e->utype); } if (uentry_isAbstractType (e)) { ct = uentry_getAbstractType (e); if (ctype_isManifestBool (ct)) { return ct; } llassert (ctype_isUA (ct)); uid = ctype_typeId (ct); if (!context_hasAccess (uid)) { return (ct); } } ct = uentry_getType (e); /* if (ctype_isUserBool (ct)) return ct; */ if (ctype_isManifestBool (ct)) { return ctype_bool; } if (ctype_isUA (ct)) { typeId iid = ctype_typeId (ct); if (typeId_equal (iid, uid)) { llcontbug (message ("uentry_getRealType: recursive type! %s", ctype_unparse (ct))); return ct; } else { /* evs 2000-07-25: possible infinite recursion ? */ uentry ue2 = usymtab_getTypeEntry (iid); if (ue2 == e) { llcontbug (message ("Bad recursion: %q", uentry_unparseFull (e))); return ctype_unknown; } return uentry_getRealType (ue2); } } else { return ct; } } ctype uentry_getForceRealType (uentry e) { ctype ct; typeId uid = typeId_invalid; if (uentry_isInvalid (e)) { return ctype_unknown; } llassertprint (uentry_isDatatype (e), ("not datatype: %s", uentry_unparse (e))); if (uentry_isAnyTag (e)) { return (e->utype); } if (uentry_isAbstractType (e)) { ct = uentry_getAbstractType (e); llassert (ctype_isUA (ct)); uid = ctype_typeId (ct); /* no check for access! */ } ct = uentry_getType (e); /* evs 2000-07-25 */ /* if (ctype_isUserBool (ct)) return ct; */ if (ctype_isManifestBool (ct)) { return ctype_bool; } if (ctype_isUA (ct)) { typeId iid = ctype_typeId (ct); if (typeId_equal (iid, uid)) { llcontbug (message ("uentry_getRealType: recursive type! %s", ctype_unparse (ct))); return ct; } else { return uentry_getForceRealType (usymtab_getTypeEntry (iid)); } } else { return ct; } } uentry uentry_nameCopy (cstring name, uentry e) { uentry enew = uentry_alloc (); llassert (uentry_isValid (e)); /* enew->shallowCopy = FALSE; */ enew->ukind = e->ukind; enew->uname = name; enew->utype = e->utype; enew->whereSpecified = fileloc_copy (e->whereSpecified); enew->whereDefined = fileloc_copy (e->whereDefined); enew->whereDeclared = fileloc_copy (e->whereDeclared); enew->sref = sRef_copy (e->sref); enew->used = e->used; enew->lset = FALSE; enew->isPrivate = e->isPrivate; enew->hasNameError = FALSE; enew->uses = filelocList_new (); enew->warn = warnClause_undefined; enew->storageclass = e->storageclass; enew->info = uinfo_copy (e->info, e->ukind); return enew; } void uentry_setDatatype (uentry e, typeId uid) { llassert (uentry_isDatatype (e)); if (uentry_isAbstractType (e)) { if (qual_isNumAbstract (e->info->datatype->abs)) { e->info->datatype->type = ctype_createNumAbstract (uid); } else { llassert (qual_isAbstract (e->info->datatype->abs)); e->info->datatype->type = ctype_createAbstract (uid); } } else { e->info->datatype->type = ctype_createUser (uid); } } static void uentry_setSpecDef (/*@special@*/ uentry e, /*@keep@*/ fileloc f) /*@defines e->whereSpecified, e->whereDeclared, e->whereDefined@*/ /*@modifies e@*/ { llassert (uentry_isValid (e)); if (fileloc_isSpec (f) || fileloc_isImport (f)) { e->whereSpecified = f; e->whereDeclared = fileloc_undefined; e->whereDefined = fileloc_undefined; } else { e->whereSpecified = fileloc_undefined; e->whereDeclared = f; e->whereDefined = fileloc_undefined; } llassert (fileloc_storable (f)); } static void ucinfo_free (/*@only@*/ ucinfo u) { sfree (u); } static void uvinfo_free (/*@only@*/ uvinfo u) { /*drl7x added 6/29/01 */ free (u->bufinfo); /* evans - 2001-07-19 fixed this bug */ sfree (u); } static void udinfo_free (/*@only@*/ udinfo u) { sfree (u); } static void ufinfo_free (/*@only@*/ ufinfo u) { globSet_free (u->globs); sRefSet_free (u->mods); stateClauseList_free (u->specclauses); sfree (u); } static void uiinfo_free (/*@only@*/ uiinfo u) { sfree (u); } static void ueinfo_free (/*@only@*/ ueinfo u) { sfree (u); } static /*@only@*/ ucinfo ucinfo_copy (ucinfo u) { ucinfo ret = (ucinfo) dmalloc (sizeof (*ret)); ret->access = u->access; ret->macro = u->macro; return ret; } static /*@only@*/ uvinfo uvinfo_copy (uvinfo u) { uvinfo ret = (uvinfo) dmalloc (sizeof (*ret)); ret->kind = u->kind; ret->nullstate = u->nullstate; ret->defstate = u->defstate; ret->checked = u->checked; /* drl added 07-02-001 */ /* copy null terminated information */ if (u->bufinfo != NULL) { ret->bufinfo = (bbufinfo) dmalloc (sizeof( * u->bufinfo ) ); ret->bufinfo->bufstate = u->bufinfo->bufstate; ret->bufinfo->size = u->bufinfo->size; ret->bufinfo->len = u->bufinfo->len; return ret; } else { ret->bufinfo = NULL; return ret; } } static /*@only@*/ udinfo udinfo_copy (udinfo u) { udinfo ret = (udinfo) dmalloc (sizeof (*ret)); ret->abs = u->abs; ret->mut = u->mut; ret->type = u->type; return ret; } static /*@only@*/ ufinfo ufinfo_copy (ufinfo u) { ufinfo ret = (ufinfo) dmalloc (sizeof (*ret)); ret->hasGlobs = u->hasGlobs; ret->hasMods = u->hasMods; ret->exitCode = u->exitCode; ret->specialCode = u->specialCode; ret->nullPred = u->nullPred; ret->access = u->access; ret->globs = globSet_newCopy (u->globs); ret->mods = sRefSet_newCopy (u->mods); ret->defparams = u->defparams; ret->specclauses = stateClauseList_copy (u->specclauses); ret->preconditions = functionConstraint_copy (u->preconditions); ret->postconditions = functionConstraint_copy (u->postconditions); return ret; } static /*@only@*/ uiinfo uiinfo_copy (uiinfo u) { uiinfo ret = (uiinfo) dmalloc (sizeof (*ret)); ret->access = u->access; ret->globs = globSet_newCopy (u->globs); ret->mods = sRefSet_newCopy (u->mods); return (ret); } static /*@only@*/ ueinfo ueinfo_copy (ueinfo u) { ueinfo ret = (ueinfo) dmalloc (sizeof (*ret)); ret->access = u->access; return ret; } static void uinfo_free (uinfo u, ekind kind) { switch (kind) { case KENUMCONST: case KCONST: ucinfo_free (u->uconst); break; case KVAR: uvinfo_free (u->var); break; case KSTRUCTTAG: case KUNIONTAG: case KENUMTAG: case KDATATYPE: udinfo_free (u->datatype); break; case KFCN: ufinfo_free (u->fcn); break; case KITER: uiinfo_free (u->iter); break; case KENDITER: ueinfo_free (u->enditer); break; case KELIPSMARKER: break; case KINVALID: break; } sfree (u); } static /*@only@*/ /*@null@*/ uinfo uinfo_copy (uinfo u, ekind kind) { if (kind == KELIPSMARKER || kind == KINVALID) { return NULL; } else { uinfo ret = (uinfo) dmalloc (sizeof (*ret)); switch (kind) { case KENUMCONST: case KCONST: ret->uconst = ucinfo_copy (u->uconst); break; case KVAR: ret->var = uvinfo_copy (u->var); break; case KSTRUCTTAG: case KUNIONTAG: case KENUMTAG: case KDATATYPE: ret->datatype = udinfo_copy (u->datatype); break; case KFCN: ret->fcn = ufinfo_copy (u->fcn); break; case KITER: ret->iter = uiinfo_copy (u->iter); break; case KENDITER: ret->enditer = ueinfo_copy (u->enditer); break; BADDEFAULT; } return ret; } } static void uentry_reallyFree (/*@notnull@*/ /*@only@*/ uentry e) { filelocList_free (e->uses); cstring_free (e->uname); uinfo_free (e->info, e->ukind); fileloc_free (e->whereSpecified); fileloc_free (e->whereDefined); fileloc_free (e->whereDeclared); warnClause_free (e->warn); nuentries--; sfree (e); } extern void uentry_markOwned (/*@owned@*/ uentry u) { sfreeEventually (u); } void uentry_free (/*@only@*/ uentry e) { if (uentry_isValid (e) && !uentry_isElipsisMarker (e)) { uentry_reallyFree (e); } } /* ** For uentry's in the global or file scope */ void uentry_freeComplete (/*@only@*/ uentry e) { if (uentry_isValid (e) && !uentry_isElipsisMarker (e)) { DPRINTF (("Free complete: %s", sRef_unparseFull (e->sref))); /*@i@*/ sRef_free (e->sref); e->sref = sRef_undefined; uentry_reallyFree (e); } } /* ** requires old->kind != new->kind, old->uname = new->uname */ static void KindConformanceError (/*@unique@*/ uentry old, uentry unew, bool mustConform) { llassert (uentry_isValid (old)); llassert (uentry_isValid (unew)); if ((uentry_isEitherConstant (unew) || uentry_isDatatype (unew)) && (fileloc_isPreproc (uentry_whereDeclared (old)) || ctype_isUnknown (old->utype)) && !uentry_isSpecified (old)) { ; /* no error */ } else { if (mustConform) { if (!uentry_isDeclared (old)) { if (uentry_isSpecified (old)) { if (uentry_isSpecified (unew)) { llbuglit ("Respecification!"); } else if (uentry_isDeclared (unew)) { if (optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently declared as %s: %t", ekind_capName (old->ukind), uentry_getName (unew), ekind_unparseLong (unew->ukind), unew->utype), uentry_whereLast (unew))) /* evans 2001-12-30: was uentry_whereDeclared */ { uentry_showWhereLastKind (old); } } else { BADEXIT; } } else { if (optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently declared as %s: %t", ekind_capName (old->ukind), uentry_getName (unew), ekind_unparseLong (unew->ukind), unew->utype), uentry_whereLast (unew))) /* evans 2001-12-30: was uentry_whereDeclared */ { uentry_showWhereLastKind (old); } } } else { llassert (uentry_isDeclared (unew)); DPRINTF (("Old: \n\t%s", uentry_unparseFull (old))); DPRINTF (("New: \n\t%s", uentry_unparseFull (unew))); if (optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently redeclared as %s", ekind_capName (old->ukind), uentry_getName (unew), ekind_unparseLong (unew->ukind)), uentry_whereLast (unew))) /* evans 2001-12-30: was uentry_whereDeclared */ { uentry_showWhereLastKind (old); } } } } uentry_updateInto (old, unew); } /* ** def is the definition of spec, modifies spec ** ** reports any inconsistencies ** returns the summary of all available information ** if spec and def are inconsistent, def is returned */ void uentry_showWhereLast (uentry spec) { if (uentry_isValid (spec)) { if (fileloc_isDefined (spec->whereDefined) && !fileloc_isLib (spec->whereDefined) /*!! && !fileloc_isPreproc (spec->whereDefined) */ ) { llgenindentmsg (message ("Previous definition of %q: %t", uentry_getName (spec), uentry_getType (spec)), uentry_whereDefined (spec)); } else if (uentry_isDeclared (spec)) { llgenindentmsg (message ("Previous declaration of %q: %t", uentry_getName (spec), uentry_getType (spec)), uentry_whereDeclared (spec)); } else if (uentry_isSpecified (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Specification of %q: %t", uentry_getName (spec), uentry_getType (spec)), uentry_whereSpecified (spec)); } else { llgenindentmsg (message ("Specification: %t", uentry_getType (spec)), uentry_whereSpecified (spec)); } } else { /* nothing to show */ } } } static void uentry_showWhereLastKind (uentry spec) { if (uentry_isValid (spec)) { if (fileloc_isDefined (spec->whereDefined) && !fileloc_isLib (spec->whereDefined) /*!! && !fileloc_isPreproc (spec->whereDefined) */ ) { llgenindentmsg (message ("Previous definition of %q as %s: %t", uentry_getName (spec), ekind_unparseLong (spec->ukind), uentry_getType (spec)), uentry_whereDefined (spec)); } else if (uentry_isDeclared (spec)) { llgenindentmsg (message ("Previous declaration of %q as %s: %t", uentry_getName (spec), ekind_unparseLong (spec->ukind), uentry_getType (spec)), uentry_whereDeclared (spec)); } else if (uentry_isSpecified (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Specification of %q as %s: %t", uentry_getName (spec), ekind_unparseLong (spec->ukind), uentry_getType (spec)), uentry_whereSpecified (spec)); } else { llgenindentmsg (message ("Specification as %s: %t", ekind_unparseLong (spec->ukind), uentry_getType (spec)), uentry_whereSpecified (spec)); } } else { /* nothing to show */ } } } void uentry_showDefSpecInfo (uentry ce, fileloc fwhere) { fileloc loc = uentry_whereDefined (ce); if (fileloc_isUser (loc) && !fileloc_equal (loc, fwhere)) { llgenindentmsg (message ("Definition of %q", uentry_getName (ce)), loc); } loc = uentry_whereSpecified (ce); if (fileloc_isUser (loc) && !fileloc_equal (loc, fwhere)) { llgenindentmsg (message ("Specification of %q", uentry_getName (ce)), loc); } } void uentry_showWhereLastExtra (uentry spec, cstring extra) { if (uentry_isDeclared (spec)) { llgenindentmsg (message ("Previous declaration of %q: %q", uentry_getName (spec), extra), uentry_whereDeclared (spec)); } else if (uentry_isSpecified (spec)) { llgenindentmsg (message ("Specification of %q: %q", uentry_getName (spec), extra), uentry_whereSpecified (spec)); } else { cstring_free (extra); } } void uentry_showWhereDeclared (uentry spec) { if (uentry_isDeclared (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Declaration of %q", uentry_getName (spec)), uentry_whereDeclared (spec)); } else { llgenindentmsg (cstring_makeLiteral ("Declaration"), uentry_whereDeclared (spec)); } } else if (uentry_isSpecified (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Specification of %q", uentry_getName (spec)), uentry_whereSpecified (spec)); } else { llgenindentmsg (cstring_makeLiteral ("Specification"), uentry_whereSpecified (spec)); } } else { /* nothing to show */ } } void uentry_showWhereAny (uentry spec) { if (uentry_isDeclared (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Declaration of %q", uentry_getName (spec)), uentry_whereDeclared (spec)); } else { llgenindentmsg (cstring_makeLiteral ("Declaration"), uentry_whereDeclared (spec)); } } else if (uentry_isSpecified (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Specification of %q", uentry_getName (spec)), uentry_whereSpecified (spec)); } else { llgenindentmsg (cstring_makeLiteral ("Specification"), uentry_whereSpecified (spec)); } } else if (fileloc_isDefined (uentry_whereDefined (spec))) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Definition of %q", uentry_getName (spec)), uentry_whereDefined (spec)); } else { llgenindentmsg (cstring_makeLiteral ("Definition"), uentry_whereDefined (spec)); } } else { /* nothing to show */ } } void uentry_showWhereDefined (uentry spec) { if (uentry_isCodeDefined (spec)) { llgenindentmsg (message ("Previous definition of %q", uentry_getName (spec)), uentry_whereDefined (spec)); } } void uentry_showWhereLastPlain (uentry spec) { if (uentry_isDeclared (spec)) { llgenindentmsg (message ("Previous declaration of %q", uentry_getName (spec)), uentry_whereDeclared (spec)); } else if (uentry_isSpecified (spec)) { llgenindentmsg (message ("Specification of %q", uentry_getName (spec)), uentry_whereSpecified (spec)); } else { } } static void uentry_showWhereLastVal (uentry spec, cstring val) { if (uentry_isDeclared (spec)) { llgenindentmsg (message ("Previous declaration of %q: %s", uentry_getName (spec), val), uentry_whereDeclared (spec)); } else if (uentry_isSpecified (spec)) { llgenindentmsg (message ("Specification of %q: %s", uentry_getName (spec), val), uentry_whereSpecified (spec)); } else { } } void uentry_showWhereSpecified (uentry spec) { if (uentry_isSpecified (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Specification of %q", uentry_getName (spec)), uentry_whereSpecified (spec)); } else { llgenindentmsg (cstring_makeLiteral ("Specification"), uentry_whereSpecified (spec)); } } else if (uentry_isDeclared (spec)) { llgenindentmsg (message ("Declaration of %q", uentry_getName (spec)), uentry_whereDeclared (spec)); } else { /* nothing to show */ } } void uentry_showWhereSpecifiedExtra (uentry spec, cstring s) { if (uentry_isSpecified (spec)) { if (uentry_hasName (spec)) { llgenindentmsg (message ("Specification of %q: %q", uentry_getName (spec), s), uentry_whereSpecified (spec)); } else { llgenindentmsg (message ("Specification: %q", s), uentry_whereSpecified (spec)); } } else if (uentry_isDeclared (spec)) { llgenindentmsg (message ("Declaration of %q: %q", uentry_getName (spec), s), uentry_whereDeclared (spec)); } else { llgenindentmsg (message ("Previous: %q", s), uentry_whereLast (spec)); } } /* ** */ static void checkStructConformance (uentry old, uentry unew) { ctype oldr, newr; uentryList fold, fnew; /* ** requires: types of old and new are structs or unions */ llassert (uentry_isValid (old)); llassert (uentry_isValid (unew)); oldr = ctype_realType (old->utype); fold = ctype_getFields (oldr); newr = ctype_realType (unew->utype); fnew = ctype_getFields (newr); if (!uentryList_matchFields (fold, fnew)) { if (fileloc_equal (uentry_whereLast (old), uentry_whereLast (unew))) { ; /* cheat! */ } else { if (optgenerror (FLG_MATCHFIELDS, message ("%q %q %rdeclared with fields { %q }, %s " "with fields { %q }", cstring_makeLiteral (ctype_isStruct (newr) ? "Structure": "Union"), uentry_getName (old), uentry_isDeclared (old), uentryList_unparseAbbrev (fnew), uentry_specOrDefName (old), uentryList_unparseAbbrev (fold)), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); uentryList_showFieldDifference (fold, fnew); } } old->utype = unew->utype; } } static void checkEnumConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew) { /* ** requires old and new are enums */ ctype rold = ctype_realType (old->utype); ctype rnew = ctype_realType (unew->utype); enumNameList eold = ctype_elist (rold); enumNameList enew = ctype_elist (rnew); if (!enumNameList_match (eold, enew)) { if (optgenerror (FLG_MATCHFIELDS, message ("Enum %q declared with members { %q } but " "%s with members { %q }", uentry_getName (old), enumNameList_unparse (enew), uentry_specOrDefName (old), enumNameList_unparse (eold)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); old->utype = unew->utype; } } } /* ** either oldCurrent or newCurrent may be undefined! */ static void paramTypeError (uentry old, uentry oldCurrent, ctype oldType, uentry unew, uentry newCurrent, ctype newType, int paramno) { bool hasError = FALSE; if (uentry_isValid (newCurrent) && uentry_isDeclared (newCurrent)) { if (uentry_hasName (newCurrent)) { hasError = optgenerror (FLG_TYPE, message ("Parameter %d, %q, of function %q has inconsistent type: " "declared %t, %s %t", paramno + 1, uentry_getName (newCurrent), uentry_getName (unew), newType, uentry_specOrDefName (old), oldType), uentry_whereDeclared (newCurrent)); } else { hasError = optgenerror (FLG_TYPE, message ("Parameter %d of function %q has inconsistent type: " "declared %t, %s %t", paramno + 1, uentry_getName (unew), newType, uentry_specOrDefName (old), oldType), uentry_whereDeclared (newCurrent)); DPRINTF (("type: %s / %s", ctype_unparse (newType), ctype_unparse (ctype_realType (newType)))); } } else { if (uentry_isDeclared (unew)) { hasError = optgenerror (FLG_TYPE, message ("Parameter %d of function %s has inconsistent type: " "declared %t, %s %t", paramno + 1, unew->uname, newType, uentry_specOrDefName (old), oldType), uentry_whereDeclared (unew)); } else { hasError = optgenerror (FLG_TYPE, message ("Parameter %d of function %s has inconsistent type: " "declared %t, %s %t", paramno + 1, unew->uname, newType, uentry_specOrDefName (old), oldType), uentry_whereDeclared (unew)); } } if (hasError) { DPRINTF (("Here: %s / %s", uentry_unparseFull (oldCurrent), uentry_unparseFull (newCurrent))); if (!uentry_isUndefined (oldCurrent)) { if (!uentry_isUndefined (newCurrent) && cstring_equal (uentry_rawName (newCurrent), uentry_rawName (oldCurrent))) { uentry_showWhereLast (oldCurrent); } else { uentry_showWhereLastPlain (old); } uentry_setType (oldCurrent, newType); } else { uentry_showWhereLastPlain (old); } } } static void nargsError (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew) { if (optgenerror (FLG_TYPE, message ("Function %s %rdeclared with %d arg%&, %s with %d", unew->uname, uentry_isDeclared (old), uentryList_size (uentry_getParams (unew)), uentry_specOrDefName (old), uentryList_size (uentry_getParams (old))), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); } } static void returnValueError (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew) { if (optgenerror (FLG_INCONDEFS, message ("Function %s inconsistently %rdeclared to return %t", unew->uname, uentry_isDeclared (old), ctype_getReturnType (unew->utype)), uentry_whereDeclared (unew))) { uentry_showWhereLastVal (old, ctype_unparse (ctype_getReturnType (old->utype))); } } static cstring paramStorageName (uentry ue) { return (cstring_makeLiteralTemp (uentry_isParam (ue) ? "param" : "storage")); } static cstring fcnErrName (uentry ue) { return (cstring_makeLiteralTemp (uentry_isFunction (ue) ? "to return" : "as")); } extern /*@observer@*/ cstring uentry_checkedName (uentry ue) { if (uentry_isVar (ue)) { return (checkedName (ue->info->var->checked)); } else { return (cstring_makeLiteralTemp ("")); } } static cstring checkedName (chkind checked) { switch (checked) { case CH_UNKNOWN: return (cstring_makeLiteralTemp ("unknown")); case CH_UNCHECKED: return (cstring_makeLiteralTemp ("unchecked")); case CH_CHECKED: return (cstring_makeLiteralTemp ("checked")); case CH_CHECKMOD: return (cstring_makeLiteralTemp ("checkmod")); case CH_CHECKEDSTRICT: return (cstring_makeLiteralTemp ("checkedstrict")); } BADEXIT; } static void checkNullState (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { nstate oldState; nstate newState; if (uentry_isVar (unew)) { llassert (uentry_isVar (old)); oldState = old->info->var->nullstate; newState = unew->info->var->nullstate; } else { oldState = sRef_getNullState (old->sref); newState = sRef_getNullState (unew->sref); } if (oldState == NS_ABSNULL) { if (uentry_isVar (old)) { old->info->var->nullstate = newState; } sRef_mergeNullState (old->sref, newState); } else if (newState == NS_UNKNOWN) { if (completeConform && newState != oldState && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("%s %q specified as %s, but declared without %s qualifier", ekind_capName (unew->ukind), uentry_getName (unew), nstate_unparse (oldState), nstate_unparse (oldState)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } if (uentry_isVar (unew)) { unew->info->var->nullstate = oldState; } sRef_mergeNullState (unew->sref, oldState); } else if (newState == NS_POSNULL) { if (oldState == NS_MNOTNULL && (ctype_isUA (unew->utype) || (uentry_isFunction (unew) && ctype_isUA (ctype_getReturnType (unew->utype))))) { if (uentry_isVar (unew)) { unew->info->var->nullstate = oldState; } sRef_mergeNullState (unew->sref, oldState); } else { if (oldState == NS_NOTNULL || oldState == NS_MNOTNULL || oldState == NS_UNKNOWN) { if (mustConform) { if (optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s possibly null storage, " "%s %q qualifier", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), uentry_specOrDefName (old), cstring_makeLiteral (oldState == NS_MNOTNULL ? "with notnull" : "without null")), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } } if (uentry_isVar (old)) { old->info->var->nullstate = newState; } sRef_mergeNullState (old->sref, newState); } } else if (newState == NS_MNOTNULL) { if (oldState != NS_MNOTNULL) { if (mustConform) { if (optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s notnull storage, " "%s without notnull qualifier", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), uentry_specOrDefName (old)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } if (uentry_isVar (old)) { old->info->var->nullstate = newState; } sRef_mergeNullState (old->sref, newState); } } else { if (uentry_isVar (unew)) { unew->info->var->nullstate = oldState; } sRef_mergeNullState (unew->sref, oldState); } } static void checkDefState (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { sstate oldState; sstate newState; bool vars = FALSE; if (uentry_isVar (old) && uentry_isVar (unew)) { oldState = old->info->var->defstate; newState = unew->info->var->defstate; vars = TRUE; } else { oldState = sRef_getDefState (old->sref); newState = sRef_getDefState (unew->sref); } if (newState != oldState && newState != SS_UNKNOWN && newState != SS_DEFINED) { if (mustConform) { if (optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s %s %s, " "%s %s %s %s", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), sstate_unparse (newState), paramStorageName (unew), uentry_specOrDefName (old), fcnErrName (unew), sstate_unparse (oldState), paramStorageName (unew)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } if (vars) old->info->var->defstate = newState; sRef_setDefState (old->sref, newState, uentry_whereDeclared (unew)); } else { if (completeConform && (newState != oldState) && (oldState != SS_DEFINED) && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("%s %q specified as %s, but declared without %s qualifier", ekind_capName (unew->ukind), uentry_getName (unew), sstate_unparse (oldState), sstate_unparse (oldState)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } if (vars) unew->info->var->defstate = oldState; sRef_setDefState (unew->sref, oldState, uentry_whereDeclared (unew)); } } static void checkAliasState (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { alkind newKind; alkind oldKind; oldKind = sRef_getAliasKind (old->sref); newKind = sRef_getAliasKind (unew->sref); if (alkind_isImplicit (newKind) || (alkind_isRefCounted (newKind) && !uentry_isDatatype (unew))) { if (completeConform && !alkind_equal (newKind, oldKind) && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("%s %q specified as %s, but declared without " "explicit alias qualifier", ekind_capName (unew->ukind), uentry_getName (unew), alkind_unparse (oldKind)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } /* ** This really shouldn't be necessary, but it is! ** Function params (?) use new here. */ sRef_setAliasKind (unew->sref, oldKind, uentry_whereDeclared (unew)); return; } if (alkind_isKnown (newKind)) { if (!alkind_equal (oldKind, newKind)) { if (alkind_isKnown (oldKind)) { if (mustConform && optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s %s storage, " "%s as %s storage", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), alkind_unparse (newKind), uentry_specOrDefName (old), alkind_unparse (oldKind)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); DPRINTF (("Old: %s", sRef_unparseFull (old->sref))); DPRINTF (("New: %s", sRef_unparseFull (unew->sref))); sRef_setAliasKind (old->sref, AK_ERROR, uentry_whereDeclared (unew)); } else { sRef_setAliasKind (old->sref, newKind, uentry_whereDeclared (unew)); } } else { if (!(alkind_isImplicit (newKind))) { if (mustConform && !uentry_isFunction (unew) && optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s %s storage, " "implicitly %s as temp storage", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), alkind_unparse (newKind), uentry_specOrDefName (old)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); oldKind = AK_ERROR; } sRef_setAliasKind (old->sref, newKind, uentry_whereDeclared (unew)); } else /* newKind is temp or refcounted */ { ; } } } } else /* newKind unknown */ { ; } } static void checkExpState(/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { exkind newKind; exkind oldKind; oldKind = sRef_getExKind (old->sref); newKind = sRef_getExKind (unew->sref); if (exkind_isKnown (newKind)) { if (oldKind != newKind) { if (exkind_isKnown (oldKind)) { if (mustConform && optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s %s, %s as %s", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), exkind_unparse (newKind), uentry_specOrDefName (old), exkind_unparse (oldKind)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } sRef_setExKind (old->sref, newKind, uentry_whereDefined (unew)); } else { if (mustConform && optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s %s, " "implicitly %s without exposure qualifier", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), exkind_unparse (newKind), uentry_specOrDefName (old)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } sRef_setExKind (old->sref, newKind, uentry_whereDefined (unew)); } } } else { if (completeConform && exkind_isKnown (oldKind) && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("%s %q specified as %s, but declared without " "exposure qualifier", ekind_capName (unew->ukind), uentry_getName (unew), exkind_unparse (oldKind)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } /* yes, this is necessary! (if its a param) */ sRef_setExKind (unew->sref, oldKind, fileloc_undefined); } } static void checkMetaState (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, /*@unused@*/ bool completeConform) { valueTable newvals = sRef_getValueTable (unew->sref); if (valueTable_isDefined (newvals)) { DPRINTF (("Check meta state: %s -> %s", uentry_unparseFull (old), uentry_unparseFull (unew))); DPRINTF (("Check meta state refs: %s -> %s", sRef_unparseFull (old->sref), sRef_unparseFull (unew->sref))); DPRINTF (("Value table: %s", valueTable_unparse (newvals))); /* ** Copy the new values into the old ref */ valueTable_elements (newvals, key, newval) { metaStateInfo msinfo = context_lookupMetaStateInfo (key); stateValue oldval = sRef_getMetaStateValue (old->sref, key); llassert (metaStateInfo_isDefined (msinfo)); if (stateValue_isUndefined (oldval)) { sRef_setMetaStateValue (old->sref, key, stateValue_getValue (newval), uentry_whereLast (unew)); } else { if (stateValue_isError (oldval)) { if (!stateValue_isError (newval)) { sRef_setMetaStateValue (old->sref, key, stateValue_getValue (newval), uentry_whereLast (unew)); } else { ; /* No change necessary. */ } } else { if (stateValue_getValue (newval) != stateValue_getValue (oldval)) { if (fileloc_isXHFile (uentry_whereDeclared (unew))) { ; } else { if (!stateValue_isError (newval) && !stateValue_isImplicit (newval)) { if (uentry_hasName (unew) || !sRef_isParam (uentry_getSref (unew))) { if (mustConform && optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared %s %q, %s as %q", uentry_ekindName (unew), uentry_getName (unew), uentry_isDeclared (old), fcnErrName (unew), stateValue_unparseValue (newval, msinfo), uentry_specOrDefName (old), stateValue_unparseValue (oldval, msinfo)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } else { if (mustConform && optgenerror (FLG_INCONDEFS, message ("%s %d inconsistently %rdeclared %s %q, %s as %q", uentry_ekindName (unew), sRef_getParam (uentry_getSref (unew)), uentry_isDeclared (old), fcnErrName (unew), stateValue_unparseValue (newval, msinfo), uentry_specOrDefName (old), stateValue_unparseValue (oldval, msinfo)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } } } DPRINTF (("Updating!")); sRef_setMetaStateValue (old->sref, key, stateValue_getValue (newval), uentry_whereLast (unew)); } else { DPRINTF (("Values match")); } } } } end_valueTable_elements ; } } static void uentry_checkStateConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { checkDefState (old, unew, mustConform, completeConform); checkNullState (old, unew, mustConform, completeConform); checkAliasState (old, unew, mustConform, completeConform); checkExpState (old, unew, mustConform, completeConform); checkMetaState (old, unew, mustConform, completeConform); sRef_storeState (old->sref); sRef_storeState (unew->sref); } static void checkVarConformance (uentry old, uentry unew, bool mustConform, bool completeConform) { if (uentry_isElipsisMarker (old) || uentry_isElipsisMarker (unew)) { return; } llassert (uentry_isVar (old)); llassert (uentry_isVar (unew)); if (cstring_isEmpty (old->uname)) { cstring_free (old->uname); old->uname = cstring_copy (unew->uname); } if (unew->info->var->kind == VKRETPARAM || unew->info->var->kind == VKSEFRETPARAM) { if (old->info->var->kind != VKRETPARAM && old->info->var->kind != VKSEFRETPARAM) { if (optgenerror (FLG_INCONDEFS, message ("Parameter %q inconsistently %rdeclared as " "returned parameter", uentry_getName (unew), uentry_isDeclared (old)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); old->info->var->kind = unew->info->var->kind; } } } if (unew->info->var->kind == VKSEFPARAM || unew->info->var->kind == VKSEFRETPARAM) { if (old->info->var->kind != VKSEFPARAM && old->info->var->kind != VKSEFRETPARAM) { if (optgenerror (FLG_INCONDEFS, message ("Parameter %qinconsistently %rdeclared as " "sef parameter", uentry_getOptName (unew), uentry_isDeclared (old)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); old->info->var->kind = unew->info->var->kind; } } } if (old->info->var->kind == VKSPEC) { old->info->var->kind = unew->info->var->kind; } else { unew->info->var->kind = old->info->var->kind; } if (unew->info->var->checked != CH_UNKNOWN && unew->info->var->checked != old->info->var->checked) { if (old->info->var->checked == CH_UNKNOWN && !fileloc_isUser (uentry_whereLast (old))) { ; /* no error */ } else { if (optgenerror (FLG_INCONDEFS, message ("Variable %q inconsistently %rdeclared as " "%s parameter (was %s)", uentry_getName (unew), uentry_isDeclared (old), checkedName (unew->info->var->checked), checkedName (old->info->var->checked)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } old->info->var->checked = unew->info->var->checked; } else { if (completeConform && (old->info->var->checked != CH_UNKNOWN) && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("%s %q specified as %s, but declared without %s qualifier", ekind_capName (unew->ukind), uentry_getName (unew), checkedName (old->info->var->checked), checkedName (old->info->var->checked)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } unew->info->var->checked = old->info->var->checked; } uentry_checkStateConformance (old, unew, mustConform, completeConform); } void uentry_checkMatchParam (uentry u1, uentry u2, int paramno, exprNode e) { if (uentry_isElipsisMarker (u1) || uentry_isElipsisMarker (u2)) { return; } llassert (uentry_isVar (u1)); llassert (uentry_isVar (u2)); if (u1->info->var->kind != u2->info->var->kind) { if (u1->info->var->kind == VKSEFRETPARAM) { if (u2->info->var->kind == VKRETPARAM) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "sef parameter, but non-sef parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } else if (u2->info->var->kind == VKSEFPARAM) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "returns parameter, but non-returns parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } else { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "sef returns parameter, but non-sef returns parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } } else if (u1->info->var->kind == VKRETPARAM) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "returns parameter, but non-returns parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } else if (u1->info->var->kind == VKSEFPARAM) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "sef parameter, but non-sef parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } else { if (u2->info->var->kind == VKSEFRETPARAM) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "normal parameter, but sef returns parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } else if (u2->info->var->kind == VKSEFPARAM) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "normal parameter, but sef parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } else if (u2->info->var->kind == VKRETPARAM) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "normal parameter, but returns parameter in " "assigned function: %s", paramno, exprNode_unparse (e)), exprNode_loc (e)); } else { BADBRANCH; } } } if (u1->info->var->defstate != u2->info->var->defstate) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "%s, but %s in assigned function: %s", paramno, sstate_unparse (u1->info->var->defstate), sstate_unparse (u2->info->var->defstate), exprNode_unparse (e)), exprNode_loc (e)); } if (u1->info->var->nullstate != u2->info->var->nullstate) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "%s, but %s in assigned function: %s", paramno, nstate_unparse (u1->info->var->nullstate), nstate_unparse (u2->info->var->nullstate), exprNode_unparse (e)), exprNode_loc (e)); } if (sRef_getAliasKind (u1->sref) != sRef_getAliasKind (u2->sref)) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "%s, but %s in assigned function: %s", paramno, alkind_unparse (sRef_getAliasKind (u1->sref)), alkind_unparse (sRef_getAliasKind (u2->sref)), exprNode_unparse (e)), exprNode_loc (e)); } if (sRef_getExKind (u1->sref) != sRef_getExKind (u2->sref)) { voptgenerror (FLG_TYPE, message ("Function types are inconsistent. Parameter %d is " "%s, but %s in assigned function: %s", paramno, exkind_unparse (sRef_getExKind (u1->sref)), exkind_unparse (sRef_getExKind (u2->sref)), exprNode_unparse (e)), exprNode_loc (e)); } } static void uentry_convertIntoFunction (/*@notnull@*/ uentry old) { /* ** Convert old into a function */ old->ukind = KFCN; old->utype = ctype_unknown; old->info->fcn = (ufinfo) dmalloc (sizeof (*old->info->fcn)); old->info->fcn->hasMods = FALSE; old->info->fcn->hasGlobs = FALSE; old->info->fcn->exitCode = XK_UNKNOWN; old->info->fcn->nullPred = qual_createUnknown (); old->info->fcn->specialCode = SPC_NONE; old->info->fcn->access = typeIdSet_undefined; old->info->fcn->globs = globSet_undefined; old->info->fcn->defparams = uentryList_undefined; old->info->fcn->mods = sRefSet_undefined; old->info->fcn->specclauses = NULL; old->info->fcn->preconditions = NULL; old->info->fcn->postconditions = NULL; } static void checkFunctionConformance (/*@unique@*/ /*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, /*@unused@*/ bool completeConform) { uentryList oldParams = uentry_getParams (old); uentryList newParams = uentry_getParams (unew); ctype newType = unew->utype; ctype oldType = ctype_realType (old->utype); ctype oldRetType = ctype_unknown; ctype newRetType = ctype_unknown; DPRINTF (("Function conform: %s ==> %s", uentry_unparseFull (old), uentry_unparseFull (unew))); if (uentry_isForward (old)) { mustConform = FALSE; uentry_updateInto (old, unew); return; } /* ** check return values */ if (ctype_isKnown (oldType)) { if (ctype_isFunction (oldType)) { oldRetType = ctype_getReturnType (oldType); } else { if (optgenerror (FLG_INCONDEFS, message ("%s %q declared as function, but previously declared as %s", ekind_capName (unew->ukind), uentry_getName (unew), ekind_unparseLong (old->ukind)), uentry_whereDeclared (unew))) { uentry_showWhereLast (old); } uentry_convertIntoFunction (old); return; } } if (ctype_isKnown (newType)) { llassert (ctype_isFunction (newType)); newRetType = ctype_getReturnType (newType); } if (ctype_isKnown (oldRetType) && ctype_isKnown (newRetType) && !ctype_matchDef (newRetType, oldRetType)) { if (mustConform) returnValueError (old, unew); } else { if (ctype_isConj (newRetType)) { if (ctype_isConj (oldRetType)) { if (!ctype_sameAltTypes (newRetType, oldRetType)) { if (optgenerror (FLG_INCONDEFS, message ("Function %q inconsistently %rdeclared to " "return alternate types %s " "(types match, but alternates are not identical, " "so checking may not be correct)", uentry_getName (unew), uentry_isDeclared (old), ctype_unparse (newRetType)), uentry_whereDeclared (unew))) { uentry_showWhereLastVal (old, ctype_unparse (oldRetType)); } } } else { old->utype = ctype_makeFunction (oldRetType, uentryList_copy (newParams)); } } } DPRINTF (("Before state: %s", uentry_unparseFull (old))); uentry_checkStateConformance (old, unew, mustConform, completeConform); DPRINTF (("After state: %s", uentry_unparseFull (old))); if (!exitkind_equal (unew->info->fcn->exitCode, old->info->fcn->exitCode)) { if (exitkind_isKnown (unew->info->fcn->exitCode)) { if (optgenerror (FLG_INCONDEFS, message ("Function %q inconsistently %rdeclared using %s", uentry_getName (unew), uentry_isDeclared (old), exitkind_unparse (unew->info->fcn->exitCode)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } else { unew->info->fcn->exitCode = old->info->fcn->exitCode; } } if (!qual_isUnknown (unew->info->fcn->nullPred)) { if (!qual_match (old->info->fcn->nullPred, unew->info->fcn->nullPred)) { if (optgenerror (FLG_INCONDEFS, message ("Function %q inconsistently %rdeclared using %s", uentry_getName (unew), uentry_isDeclared (old), qual_unparse (unew->info->fcn->nullPred)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } } else { unew->info->fcn->nullPred = old->info->fcn->nullPred; } if (unew->info->fcn->specialCode != SPC_NONE) { if (old->info->fcn->specialCode != unew->info->fcn->specialCode) { if (optgenerror (FLG_INCONDEFS, message ("Function %q inconsistently %rdeclared using %s", uentry_getName (unew), uentry_isDeclared (old), specCode_unparse (unew->info->fcn->specialCode)), uentry_whereDeclared (unew))) { uentry_showWhereSpecified (old); } } } else { unew->info->fcn->specialCode = old->info->fcn->specialCode; } /* ** check parameters */ if (!uentryList_sameObject (oldParams, newParams) && (!uentryList_isMissingParams (oldParams))) { if (!uentryList_isMissingParams (newParams)) { int paramno = 0; int nparams = uentryList_size (oldParams); bool checknames = context_maybeSet (FLG_DECLPARAMMATCH); if (nparams != uentryList_size (newParams)) { nargsError (old, unew); } if (uentryList_size (newParams) < nparams) { nparams = uentryList_size (newParams); } while (paramno < nparams) { uentry oldCurrent = uentryList_getN (oldParams, paramno); uentry newCurrent = uentryList_getN (newParams, paramno); ctype oldCurrentType = uentry_getType (oldCurrent); ctype newCurrentType = uentry_getType (newCurrent); llassert (uentry_isValid (oldCurrent) && uentry_isValid (newCurrent)); if (!uentry_isElipsisMarker (oldCurrent) && !uentry_isElipsisMarker (newCurrent)) { checkVarConformance (oldCurrent, newCurrent, mustConform, completeConform); } if (checknames) { if (uentry_hasName (oldCurrent) && uentry_hasName (newCurrent)) { cstring oldname = uentry_getName (oldCurrent); cstring pfx = context_getString (FLG_DECLPARAMPREFIX); cstring oname; cstring nname = uentry_getName (newCurrent); cstring nnamefix; if (cstring_isDefined (pfx) && cstring_equalPrefix (oldname, pfx)) { oname = cstring_suffix (oldname, cstring_length (pfx)); } else { oname = oldname; /*@-branchstate@*/ } /*@=branchstate@*/ if (cstring_isDefined (pfx) && cstring_equalPrefix (nname, pfx)) { nnamefix = cstring_suffix (nname, cstring_length (pfx)); } else { nnamefix = nname; /*@-branchstate@*/ } /*@=branchstate@*/ if (!cstring_equal (oname, nnamefix)) { if (optgenerror (FLG_DECLPARAMMATCH, message ("Definition parameter name %s does not match " "name of corresponding parameter in " "declaration: %s", nnamefix, oname), uentry_whereLast (newCurrent))) { uentry_showWhereLastPlain (oldCurrent); } } cstring_free (oldname); cstring_free (nname); } } if (!ctype_match (oldCurrentType, newCurrentType)) { paramTypeError (old, oldCurrent, oldCurrentType, unew, newCurrent, newCurrentType, paramno); } else { if (ctype_isMissingParamsMarker (newCurrentType) || ctype_isElips (newCurrentType) || ctype_isMissingParamsMarker (oldCurrentType) || ctype_isElips (oldCurrentType)) { ; } else { if (ctype_isConj (newCurrentType)) { if (ctype_isConj (oldCurrentType)) { if (!ctype_sameAltTypes (newCurrentType, oldCurrentType)) { if (optgenerror (FLG_INCONDEFS, message ("Parameter %q inconsistently %rdeclared with " "alternate types %s " "(types match, but alternates are not identical, " "so checking may not be correct)", uentry_getName (newCurrent), uentry_isDeclared (oldCurrent), ctype_unparse (newCurrentType)), uentry_whereDeclared (unew))) { uentry_showWhereLastVal (oldCurrent, ctype_unparse (oldCurrentType)); } } } else { if (optgenerror (FLG_INCONDEFS, message ("Parameter %q inconsistently %rdeclared with " "alternate types %s", uentry_getName (newCurrent), uentry_isDeclared (oldCurrent), ctype_unparse (newCurrentType)), uentry_whereDeclared (unew))) { uentry_showWhereLastVal (oldCurrent, ctype_unparse (oldCurrentType)); } } } else { if (ctype_isConj (oldCurrentType)) { uentry_setType (newCurrent, oldCurrentType); } } } } paramno++; /* ** Forgot this! detected by splint: ** uentry.c:1257,15: Suspected infinite loop */ } } } if (!uentryList_isMissingParams (newParams)) { if (ctype_isConj (oldRetType)) { old->utype = ctype_makeFunction (oldRetType, uentryList_copy (newParams)); } else { old->utype = unew->utype; } } checkGlobalsConformance (old, unew, mustConform, completeConform); checkModifiesConformance (old, unew, mustConform, completeConform); DPRINTF (("Before list: %s", uentry_unparseFull (old))); if (stateClauseList_isDefined (unew->info->fcn->specclauses)) { if (!stateClauseList_isDefined (old->info->fcn->specclauses)) { /* if (optgenerror (FLG_INCONDEFS, message ("Function %q redeclared using special clauses (can only " "be used in first declaration)", uentry_getName (unew)), uentry_whereDeclared (unew))) { uentry_showWhereLast (old); } */ /* need to add some checking @*/ old->info->fcn->specclauses = unew->info->fcn->specclauses; } else { /* should be able to append? */ stateClauseList_checkEqual (old, unew); stateClauseList_free (unew->info->fcn->specclauses); unew->info->fcn->specclauses = stateClauseList_undefined; /*@-branchstate@*/ } } /*@=branchstate@*/ /* shouldn't need this */ if (fileloc_isUndefined (old->whereDeclared)) { old->whereDeclared = fileloc_copy (unew->whereDeclared); } else if (fileloc_isUndefined (unew->whereDeclared)) { unew->whereDeclared = fileloc_copy (old->whereDeclared); } else { /* no change */ } /*@-compmempass@*/ } /*@=compmempass@*/ /* I think this is a spurious warning */ void uentry_mergeConstantValue (uentry ue, /*@only@*/ multiVal m) { multiVal uval; llassert (uentry_isValid (ue)); llassert (uentry_isEitherConstant (ue)); DPRINTF (("Constant value: %s / %s", uentry_unparse (ue), multiVal_unparse (m))); uval = uentry_getConstantValue (ue); if (multiVal_isDefined (uval)) { if (multiVal_isDefined (m)) { if (!multiVal_equiv (uval, m)) { if (optgenerror (FLG_INCONDEFS, message ("%s %q defined with inconsistent value: %q", ekind_capName (ue->ukind), uentry_getName (ue), multiVal_unparse (m)), g_currentloc)) { uentry_showWhereLastExtra (ue, multiVal_unparse (uval)); } } } multiVal_free (m); } else { uentry_setConstantValue (ue, m); } } static bool checkTypeConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform) { bool typeError = FALSE; if (uentry_isStructTag (old) || uentry_isUnionTag (old)) { if (ctype_isSU (old->utype) && ctype_isSU (unew->utype)) { if (mustConform) { DPRINTF (("Check struct conformance: %s / %s", uentry_unparseFull (old), uentry_unparseFull (unew))); checkStructConformance (old, unew); } } else { if (!(ctype_isBogus (old->utype) || ctype_isBogus (unew->utype))) { llbug (message ("struct tags: bad types: %t / %t", old->utype, unew->utype)); } } } else if (uentry_isEnumTag (old)) { if (ctype_isEnum (old->utype) && ctype_isEnum (unew->utype)) { if (mustConform) checkEnumConformance (old, unew); } else { if (!(ctype_isBogus (old->utype) || ctype_isBogus (unew->utype))) { llbug (message ("enum! bad type: %s / %s", ctype_unparse (old->utype), ctype_unparse (unew->utype))); } } } else if (!ctype_match (old->utype, unew->utype)) { DPRINTF (("Type mismatch: %s / %s", ctype_unparse (old->utype), ctype_unparse (unew->utype))); if (cstring_equal (uentry_rawName (old), context_getBoolName ())) { ctype realt = ctype_realType (unew->utype); if (ctype_isRealInt (realt) || ctype_isChar (realt)) { unew->utype = ctype_bool; } else { if (mustConform) { typeError = optgenerror (FLG_INCONDEFS, message ("%q defined as %s", uentry_getName (old), ctype_unparse (realt)), uentry_whereDeclared (unew)); } } } else { if (mustConform) { ctype oldr = ctype_realType (old->utype); ctype newr = ctype_realType (unew->utype); if (ctype_isStruct (oldr) && ctype_isStruct (newr)) { checkStructConformance (old, unew); } else if (ctype_isUnion (oldr) && ctype_isUnion (newr)) { checkStructConformance (old, unew); } else if (ctype_isEnum (oldr) && ctype_isEnum (newr)) { checkEnumConformance (old, unew); } else if (uentry_isConstant (old) && (ctype_isAbstract (oldr) && ctype_isEnum (newr))) { /* okay...for now! (should check the type is reset later... */ } else { DPRINTF (("YABA!")); if (optgenerror (FLG_INCONDEFS, message ("%s %q %rdeclared with inconsistent type: %t", ekind_capName (unew->ukind), uentry_getName (unew), uentry_isDeclared (old), unew->utype), uentry_whereDeclared (unew))) { uentry_showWhereLast (old); typeError = TRUE; } } } } } else { /* no error */ } return typeError; } static void uentry_checkDatatypeConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { if (ctype_isDefined (unew->info->datatype->type)) { /* ** bool is hard coded here, since it is built into LCL. ** For now, we're stuck with LCL's types. */ if (ctype_isDirectBool (old->utype) && cstring_equalLit (unew->uname, "bool")) { /* if (!context_getFlag (FLG_ABSTRACTBOOL)) evs 2000-07-25: removed */ unew->utype = ctype_bool; } if (ctype_isUnknown (old->info->datatype->type)) { old->info->datatype->type = unew->info->datatype->type; } else { DPRINTF (("Old: %s / New: %s", uentry_unparseFull (old), uentry_unparseFull (unew))); DPRINTF (("Types: %s / %s", ctype_unparse (old->info->datatype->type), ctype_unparse (unew->info->datatype->type))); if (ctype_matchDef (old->info->datatype->type, unew->info->datatype->type)) { ; } else { if (optgenerror (FLG_INCONDEFS, message ("Type %q %s with inconsistent type: %t", uentry_getName (unew), uentry_reDefDecl (old, unew), unew->info->datatype->type), uentry_whereDeclared (unew))) { uentry_showWhereLastExtra (old, cstring_copy (ctype_unparse (old->info->datatype->type))); } old->info->datatype->type = unew->info->datatype->type; } } } if (!qual_isUnknown (unew->info->datatype->abs)) { if (qual_isConcrete (old->info->datatype->abs) && qual_isEitherAbstract (unew->info->datatype->abs)) { if (!ctype_isDirectBool (old->utype)) { if (optgenerror (FLG_INCONDEFS, message ("Datatype %q inconsistently %rdeclared as abstract type", uentry_getName (unew), uentry_isDeclared (old)), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); } } } else if (qual_isEitherAbstract (old->info->datatype->abs) && qual_isConcrete (unew->info->datatype->abs)) { if (!ctype_isDirectBool (old->utype)) { if (optgenerror (FLG_INCONDEFS, message ("Datatype %q inconsistently %rdeclared as concrete type", uentry_getName (unew), uentry_isDeclared (old)), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); } } } else { ; } } else { if (qual_isEitherAbstract (old->info->datatype->abs)) { old->sref = unew->sref; unew->info->datatype->mut = old->info->datatype->mut; if (completeConform && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("Datatype %q specified as abstract, " "but abstract annotation not used in declaration", uentry_getName (unew)), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); } } } } unew->info->datatype->abs = old->info->datatype->abs; if (ynm_isMaybe (unew->info->datatype->mut)) { if (completeConform && ynm_isOff (old->info->datatype->mut) && uentry_isReallySpecified (old)) { if (optgenerror (FLG_NEEDSPEC, message ("Datatype %q specified as immutable, " "but immutable annotation not used in declaration", uentry_getName (unew)), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); } } unew->info->datatype->mut = old->info->datatype->mut; } else if (ynm_isMaybe (old->info->datatype->mut)) { old->info->datatype->mut = unew->info->datatype->mut; } else { if (qual_isEitherAbstract (old->info->datatype->abs)) { if (ynm_isOn (old->info->datatype->mut) && ynm_isOff (unew->info->datatype->mut)) { if (optgenerror (FLG_INCONDEFS, message ("Datatype %q inconsistently %rdeclared as immutable", uentry_getName (unew), uentry_isDeclared (old)), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); } } else { if (ynm_isOff (old->info->datatype->mut) && ynm_isOn (unew->info->datatype->mut)) { if (optgenerror (FLG_INCONDEFS, message ("Datatype %q inconsistently %rdeclared as mutable", uentry_getName (unew), uentry_isDeclared (old)), uentry_whereDeclared (unew))) { uentry_showWhereLastPlain (old); } } } } old->info->datatype->mut = unew->info->datatype->mut; } uentry_checkStateConformance (old, unew, mustConform, completeConform); } static void uentry_checkConstantConformance (/*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, /*@unused@*/ bool completeConform) { multiVal oldval = uentry_getConstantValue (old); multiVal newval = uentry_getConstantValue (unew); if (multiVal_isDefined (oldval)) { if (multiVal_isDefined (newval)) { if (!multiVal_equiv (oldval, newval)) { if (mustConform && optgenerror (FLG_INCONDEFS, message ("%s %q %rdeclared with inconsistent value: %q", ekind_capName (unew->ukind), uentry_getName (unew), uentry_isDeclared (old), multiVal_unparse (newval)), uentry_whereDeclared (unew))) { uentry_showWhereLastExtra (old, multiVal_unparse (oldval)); } } uentry_setConstantValue (unew, multiVal_copy (oldval)); } else { ; } } else { uentry_setConstantValue (old, multiVal_copy (newval)); } } static void uentry_checkConformance (/*@unique@*/ /*@notnull@*/ uentry old, /*@notnull@*/ uentry unew, bool mustConform, bool completeConform) { bool typeError = FALSE; bool fcnConformance = FALSE; if (!ekind_equal (unew->ukind, old->ukind)) { /* ** okay, only if one is a function and the other is ** a variable of type function. */ if (unew->ukind == KENUMCONST && old->ukind == KCONST) { old->ukind = KENUMCONST; goto nokinderror; } if (unew->ukind == KFCN && old->ukind == KCONST && ctype_isUnknown (old->utype)) { /* ** When a function is defined with an unparam macro */ uentry_updateInto (old, unew); return; } if (uentry_isExpandedMacro (old) && uentry_isEitherConstant (unew)) { uentry_updateInto (old, unew); return; } if (uentry_isEndIter (unew)) { if (ctype_isUnknown (old->utype)) { if (!uentry_isSpecified (old) && uentry_isCodeDefined (unew)) { if (!fileloc_withinLines (uentry_whereDefined (old), uentry_whereDeclared (unew), 2)) { /* bogus! will give errors if there is too much whitespace */ voptgenerror (FLG_SYNTAX, message ("Iterator finalized name %q does not match name in " "previous iter declaration (should be end_%q). This iter " "is declared at %q", uentry_getName (unew), uentry_getName (old), fileloc_unparse (uentry_whereDefined (old))), uentry_whereDeclared (old)); } } uentry_updateInto (old, unew); return; } else { KindConformanceError (old, unew, mustConform); } } if (uentry_isFunction (unew)) { if (uentry_isVariable (old)) { if (!ctype_isUnknown (old->utype)) { if (ctype_isFunction (old->utype)) { uentry_makeVarFunction (old); checkFunctionConformance (old, unew, mustConform, completeConform); fcnConformance = TRUE; } else { KindConformanceError (old, unew, mustConform); } } else { if (uentry_isExpandedMacro (old)) { if (fileloc_isUndefined (unew->whereDefined)) { unew->whereDefined = fileloc_update (unew->whereDefined, old->whereDefined); } uentry_updateInto (old, unew); old->used = unew->used = TRUE; return; } else { /* undeclared identifier */ old->utype = unew->utype; uentry_makeVarFunction (old); checkFunctionConformance (old, unew, FALSE, FALSE); fcnConformance = TRUE; } } } else { KindConformanceError (old, unew, mustConform); } } else if (uentry_isFunction (old) && uentry_isVariable (unew)) { if (!ctype_isUnknown (unew->utype)) { if (ctype_isFunction (unew->utype)) { uentry_makeVarFunction (unew); checkFunctionConformance (old, unew, mustConform, completeConform); fcnConformance = TRUE; } else { KindConformanceError (old, unew, mustConform); } } else { KindConformanceError (old, unew, mustConform); } } else { KindConformanceError (old, unew, mustConform); } } else { /* ** check parameter lists for functions ** (before type errors, to get better messages */ if (uentry_isFunction (old)) { checkFunctionConformance (old, unew, mustConform, completeConform); fcnConformance = TRUE; } else { if (!ctype_isUndefined (old->utype)) { typeError = checkTypeConformance (old, unew, mustConform); } } } nokinderror: if (uentry_isEitherConstant (old) && uentry_isEitherConstant (unew)) { uentry_checkConstantConformance (old, unew, mustConform, completeConform); } if (uentry_isDatatype (old) && uentry_isDatatype (unew)) { DPRINTF (("Check datatype: %s / %s", uentry_unparseFull (old), uentry_unparseFull (unew))); uentry_checkDatatypeConformance (old, unew, mustConform, completeConform); } if (uentry_isVariable (old) && uentry_isVariable (unew)) { if (!typeError && !ctype_matchDef (old->utype, unew->utype)) { if (optgenerror (FLG_INCONDEFS, message ("Variable %q %s with inconsistent type (arrays and pointers are " "not identical in variable declarations): %t", uentry_getName (unew), uentry_reDefDecl (old, unew), unew->utype), uentry_whereDeclared (unew))) { uentry_showWhereLast (old); /* ** Avoid repeated errors. */ if (uentry_isCodeDefined (old) && uentry_isCodeDefined (unew)) { old->whereDefined = fileloc_update (old->whereDefined, fileloc_undefined); } typeError = TRUE; } } checkVarConformance (old, unew, mustConform, completeConform); } if (fcnConformance) { /* old->utype = unew->utype; */ } else { if (ctype_isConj (old->utype)) { if (ctype_isConj (unew->utype)) { if (!ctype_sameAltTypes (old->utype, unew->utype)) { if (optgenerror (FLG_INCONDEFS, message ("%s %q inconsistently %rdeclared with " "alternate types %s " "(types match, but alternates are not identical, " "so checking may not be correct)", ekind_capName (uentry_getKind (old)), uentry_getName (unew), uentry_isDeclared (old), ctype_unparse (unew->utype)), uentry_whereDeclared (unew))) { uentry_showWhereLastVal (old, ctype_unparse (old->utype)); } else { old->utype = unew->utype; } } } } else { if (ctype_isUnknown (old->utype)) { old->utype = unew->utype; } } } if (unew->ukind == old->ukind) { sfree (unew->info); unew->info = uinfo_copy (old->info, old->ukind); } sRef_storeState (old->sref); sRef_storeState (unew->sref); } static void uentry_mergeConstraints (uentry spec, uentry def) { if (uentry_isFunction (def)) { DPRINTF (("Here: %s / %s", uentry_unparseFull (spec), uentry_unparseFull (def))); /* evans 2001-07-21 */ llassert (uentry_isFunction (spec)); if (functionConstraint_isDefined (def->info->fcn->preconditions)) { if (fileloc_isXHFile (uentry_whereLast (def))) { llassert (uentry_isFunction (spec)); spec->info->fcn->preconditions = functionConstraint_conjoin (spec->info->fcn->preconditions, def->info->fcn->preconditions); } else if (fileloc_equal (uentry_whereLast (spec), uentry_whereLast (def))) { ; } else { /* Check if the constraints are identical */ if (optgenerror (FLG_INCONDEFS, message ("Preconditions for %q redeclared. Dropping previous precondition: %q", uentry_getName (spec), functionConstraint_unparse (spec->info->fcn->preconditions)), uentry_whereLast (def))) { uentry_showWhereSpecified (spec); } functionConstraint_free (spec->info->fcn->preconditions); spec->info->fcn->preconditions = def->info->fcn->preconditions; } def->info->fcn->preconditions = functionConstraint_undefined; } if (functionConstraint_isDefined (def->info->fcn->postconditions)) { if (fileloc_isXHFile (uentry_whereLast (def))) { llassert (uentry_isFunction (spec)); DPRINTF (("Post: %s /++/ %s", functionConstraint_unparse (spec->info->fcn->postconditions), functionConstraint_unparse (def->info->fcn->postconditions))); spec->info->fcn->postconditions = functionConstraint_conjoin (spec->info->fcn->postconditions, def->info->fcn->postconditions); def->info->fcn->postconditions = functionConstraint_undefined; DPRINTF (("Conjoined post: %s", functionConstraint_unparse (spec->info->fcn->postconditions))); } else { if (optgenerror (FLG_INCONDEFS, message ("Postconditions for %q redeclared. Dropping previous postcondition: %q", uentry_getName (spec), functionConstraint_unparse (spec->info->fcn->postconditions)), uentry_whereLast (def))) { uentry_showWhereSpecified (spec); } functionConstraint_free (spec->info->fcn->postconditions); spec->info->fcn->postconditions = def->info->fcn->postconditions; def->info->fcn->postconditions = functionConstraint_undefined; } } } } /* ** modifies spec to reflect def, reports any inconsistencies */ void uentry_mergeEntries (uentry spec, /*@only@*/ uentry def) { llassert (uentry_isValid (spec)); llassert (uentry_isValid (def)); llassert (cstring_equal (spec->uname, def->uname)); if (uentry_isFunction (def)) { if (uentry_isConstant (spec)) { llassert (ctype_isUnknown (spec->utype) || ctype_isFunction (spec->utype)); uentry_makeConstantFunction (spec); } else { uentry_convertVarFunction (spec); } llassert (uentry_isFunction (spec)); } DPRINTF (("Merge entries: %s / %s", uentry_unparseFull (spec), uentry_unparseFull (def))); uentry_mergeConstraints (spec, def); uentry_checkConformance (spec, def, TRUE, context_getFlag (FLG_NEEDSPEC)); DPRINTF (("Merge entries after conform: %s / %s", uentry_unparseFull (spec), uentry_unparseFull (def))); /* was: !(fileloc_isImport (uentry_whereSpecified (spec)))); */ /* ** okay, declarations conform. Propagate extra information. */ uentry_setDefined (spec, uentry_whereDefined (def)); uentry_setDeclared (spec, uentry_whereDeclared (def)); if (uentry_isStatic (def)) { if (optgenerror (FLG_INCONDEFS, message ("%s %q specified, but declared as static", ekind_capName (def->ukind), uentry_getName (def)), uentry_whereDeclared (def))) { uentry_showWhereSpecified (spec); } } else { spec->storageclass = def->storageclass; } sRef_storeState (spec->sref); spec->used = def->used || spec->used; spec->hasNameError |= def->hasNameError; uentry_free (def); if (!spec->hasNameError) { uentry_checkName (spec); } else { ; } } /* ** Can't generate function redeclaration errors when the ** entries are merged, since we don't yet know if its the ** definition of the function. */ void uentry_clearDecl (void) { posRedeclared = uentry_undefined; fileloc_free (posLoc); posLoc = fileloc_undefined; } void uentry_checkDecl (void) { if (uentry_isValid (posRedeclared) && !fileloc_isXHFile (posLoc)) { llassert (fileloc_isDefined (posLoc)); if (uentry_isCodeDefined (posRedeclared)) { if (optgenerror (FLG_REDECL, message ("%s %q declared after definition", ekind_capName (posRedeclared->ukind), uentry_getName (posRedeclared)), posLoc)) { llgenindentmsg (message ("Definition of %q", uentry_getName (posRedeclared)), posRedeclared->whereDeclared); } } else { if (optgenerror (FLG_REDECL, message ("%s %q declared more than once", ekind_capName (posRedeclared->ukind), uentry_getName (posRedeclared)), posLoc)) { llgenindentmsg (message ("Previous declaration of %q", uentry_getName (posRedeclared)), posRedeclared->whereDeclared); } } } fileloc_free (posLoc); posLoc = fileloc_undefined; posRedeclared = uentry_undefined; } /* ** Redefinition of old as unew. ** modifies old to reflect unew, reports any inconsistencies */ void uentry_mergeDefinition (uentry old, /*@only@*/ uentry unew) { fileloc olddef = uentry_whereDeclared (old); fileloc unewdef = uentry_whereDeclared (unew); bool mustConform; bool wasForward; DPRINTF (("uentry merge: %s / %s", uentry_unparseFull (old), uentry_unparseFull (unew))); wasForward = fileloc_isUndefined (olddef) && fileloc_isDefined (uentry_whereDefined (old)) && !uentry_isExpandedMacro (old); if (!context_getFlag (FLG_INCONDEFSLIB) && (fileloc_isLib (olddef) || fileloc_isImport (olddef))) { mustConform = FALSE; } else { mustConform = TRUE; } llassert (uentry_isValid (old)); llassert (uentry_isValid (unew)); llassert (cstring_equal (old->uname, unew->uname)); if (uentry_isFunction (unew) && !uentry_isFunction (old)) { if (uentry_isConstant (old)) { llassert (ctype_isUnknown (old->utype) || ctype_isFunction (old->utype)); uentry_makeConstantFunction (old); } else { uentry_convertVarFunction (old); } if (!uentry_isFunction (old)) { if (optgenerror (FLG_INCONDEFS, message ("%s %q declared as function, but previously declared as %s", ekind_capName (unew->ukind), uentry_getName (unew), ekind_unparseLong (old->ukind)), uentry_whereDeclared (unew))) { uentry_showWhereLast (old); } uentry_convertIntoFunction (old); return; } } DPRINTF (("uentry merge: %s / %s", uentry_unparseFull (old), uentry_unparseFull (unew))); if (uentry_isExtern (unew)) { uentry_setUsed (old, unewdef); } /* ** should check old one was extern! */ if (uentry_isStatic (old)) { if (!(uentry_isStatic (unew))) { if (optgenerror (FLG_SHADOW, message ("%s %q shadows static declaration", ekind_capName (unew->ukind), uentry_getName (unew)), unewdef)) { uentry_showWhereLast (old); } } else { uentry_setDeclDef (old, unewdef); } } else if (uentry_isStatic (unew)) { uentry_setDeclDef (old, unewdef); } else if (uentry_isExtern (old)) { uentry_setDeclared (old, unewdef); } else { if (!uentry_isExtern (unew) && !uentry_isForward (old) && !fileloc_equal (olddef, unewdef) && !fileloc_isUndefined (olddef) && !fileloc_isUndefined (unewdef) && !fileloc_isBuiltin (olddef) && !fileloc_isBuiltin (unewdef) && !uentry_isYield (old) && !(fileloc_isLib (olddef) || fileloc_isImport (olddef))) { if (uentry_isVariable (old) || uentry_isVariable (unew)) { ; /* will report redeclaration error later */ } else { if (fileloc_isDefined (uentry_whereDefined (old))) { if (optgenerror (FLG_REDEF, message ("%s %q defined more than once", ekind_capName (unew->ukind), uentry_getName (unew)), uentry_whereLast (unew))) { llgenindentmsg (message ("Previous definition of %q", uentry_getName (old)), uentry_whereLast (old)); } /* if (uentry_isDatatype (old) || uentry_isAnyTag (old)) { uentry_updateInto (old, unew); old->sref = sRef_saveCopy (old->sref); } */ } } } else { if (fileloc_isLib (olddef) || fileloc_isUndefined (olddef) || fileloc_isImport (olddef)) { if (uentry_isExtern (unew)) { if (uentry_isExtern (old) || (fileloc_isDefined (uentry_whereDeclared (old)) && (!fileloc_equal (uentry_whereDeclared (old), uentry_whereDefined (old))))) { if (optgenerror (FLG_REDECL, message ("%s %q declared more than once", ekind_capName (unew->ukind), uentry_getName (unew)), unew->whereDeclared)) { llgenindentmsg (message ("Previous declaration of %q", uentry_getName (old)), old->whereDeclared); } } uentry_setExtern (old); } else { uentry_setDeclared (old, unewdef); /* evans 2001-07-23 was setDefined */ } } } } DPRINTF (("uentry merge: %s / %s", uentry_unparseFull (old), uentry_unparseFull (unew))); uentry_mergeConstraints (old, unew); DPRINTF (("uentry merge: %s / %s", uentry_unparseFull (old), uentry_unparseFull (unew))); uentry_checkConformance (old, unew, mustConform, FALSE); DPRINTF (("uentry merge: %s / %s", uentry_unparseFull (old), uentry_unparseFull (unew))); old->used = old->used || unew->used; old->uses = filelocList_append (old->uses, unew->uses); unew->uses = filelocList_undefined; sRef_storeState (old->sref); sRef_storeState (unew->sref); if (wasForward) { old->whereDefined = fileloc_update (old->whereDefined, fileloc_undefined); } DPRINTF (("here: %s", uentry_unparseFull (old))); /* ** No redeclaration errors for functions here, since we ** don't know if this is the definition of the function. */ if (fileloc_isUser (old->whereDeclared) && fileloc_isUser (unew->whereDeclared) && !fileloc_equal (old->whereDeclared, unew->whereDeclared) && !fileloc_isDefined (unew->whereDefined)) { if (uentry_isFunction (old)) { /*@-temptrans@*/ posRedeclared = old; /*@=temptrans@*/ posLoc = fileloc_update (posLoc, unew->whereDeclared); } else { if (optgenerror (FLG_REDECL, message ("%s %q declared more than once", ekind_capName (unew->ukind), uentry_getName (unew)), unew->whereDeclared)) { llgenindentmsg (message ("Previous declaration of %q", uentry_getName (old)), old->whereDeclared); } } } if (fileloc_isUndefined (old->whereDefined)) { old->whereDefined = fileloc_update (old->whereDefined, unew->whereDefined); } else { if (!context_processingMacros () && fileloc_isUser (old->whereDefined) && fileloc_isUser (unew->whereDefined) && !fileloc_equal (old->whereDefined, unew->whereDefined)) { if (uentry_isVariable (unew) || uentry_isFunction (unew)) { if (uentry_isVariable (unew) && uentry_isExtern (unew)) { if (optgenerror (FLG_REDECL, message ("%s %q declared after definition", ekind_capName (unew->ukind), uentry_getName (unew)), unew->whereDeclared)) { llgenindentmsg (message ("Definition of %q", uentry_getName (old)), old->whereDefined); } } else { if (optgenerror (FLG_REDEF, message ("%s %q redefined", ekind_capName (unew->ukind), uentry_getName (unew)), unew->whereDefined)) { llgenindentmsg (message ("Previous definition of %q", uentry_getName (old)), old->whereDefined); } } } } } if (uentry_isExternal (unew)) { old->whereDefined = fileloc_createExternal (); } if (unew->hasNameError) { old->hasNameError = TRUE; } uentry_free (unew); if (!old->hasNameError) { uentry_checkName (old); } DPRINTF (("After: %s", uentry_unparseFull (old))); llassert (!ctype_isUndefined (old->utype)); } void uentry_copyState (uentry res, uentry other) { llassert (uentry_isValid (res)); llassert (uentry_isValid (other)); res->used = other->used; res->info->var->kind = other->info->var->kind; res->info->var->defstate = other->info->var->defstate; res->info->var->nullstate = other->info->var->nullstate; res->info->var->checked = other->info->var->checked; sRef_copyState (res->sref, other->sref); } bool uentry_sameKind (uentry u1, uentry u2) { if (uentry_isValid (u1) && uentry_isValid (u2)) { if (uentry_isVar (u1) && uentry_isVar (u2)) { ctype c1 = u1->utype; ctype c2 = u2->utype; if (ctype_isUnknown (c1) || ctype_isUnknown (c2)) return FALSE; /* ** both functions, or both not functions */ return (bool_equal (ctype_isFunction (c1), ctype_isFunction (c2))); } else { return ((u1->ukind == u2->ukind)); } } return FALSE; } static void uentry_updateInto (/*@unique@*/ uentry unew, uentry old) { ekind okind; llassert (uentry_isValid (unew)); llassert (uentry_isValid (old)); DPRINTF (("Update into: %s / %s", uentry_unparseFull (unew), uentry_unparseFull (old))); okind = unew->ukind; unew->ukind = old->ukind; llassert (cstring_equal (unew->uname, old->uname)); unew->utype = old->utype; if (fileloc_isDefined (unew->whereSpecified) && !fileloc_isDefined (old->whereSpecified)) { ; /* Keep the old value */ } else { fileloc_free (unew->whereSpecified); unew->whereSpecified = fileloc_copy (old->whereSpecified); } if (fileloc_isDefined (unew->whereDefined) && !fileloc_isDefined (old->whereDefined)) { ; /* Keep the old value */ } else { fileloc_free (unew->whereDefined); unew->whereDefined = fileloc_copy (old->whereDefined); } if (fileloc_isDefined (unew->whereDeclared) && !fileloc_isDefined (old->whereDeclared)) { ; /* Keep the old value */ } else { fileloc_free (unew->whereDeclared); unew->whereDeclared = fileloc_copy (old->whereDeclared); } DPRINTF (("Update into: %s / %s", uentry_unparseFull (unew), uentry_unparseFull (old))); unew->sref = sRef_saveCopy (old->sref); /* Memory leak! */ unew->used = old->used; unew->lset = FALSE; unew->isPrivate = old->isPrivate; unew->hasNameError = old->hasNameError; unew->uses = filelocList_append (unew->uses, old->uses); old->uses = filelocList_undefined; unew->storageclass = old->storageclass; uinfo_free (unew->info, okind); unew->info = uinfo_copy (old->info, old->ukind); } static uentry uentry_copyAux (uentry e, bool saveCopy) { if (uentry_isValid (e)) { uentry enew = uentry_alloc (); DPRINTF (("copy: %s", uentry_unparseFull (e))); enew->ukind = e->ukind; enew->uname = cstring_copy (e->uname); enew->utype = e->utype; enew->whereSpecified = fileloc_copy (e->whereSpecified); enew->whereDefined = fileloc_copy (e->whereDefined); enew->whereDeclared = fileloc_copy (e->whereDeclared); if (saveCopy) { enew->sref = sRef_saveCopy (e->sref); /* Memory leak! */ } else { enew->sref = sRef_copy (e->sref); } enew->used = e->used; enew->lset = FALSE; enew->isPrivate = e->isPrivate; enew->hasNameError = e->hasNameError; enew->uses = filelocList_undefined; enew->storageclass = e->storageclass; enew->info = uinfo_copy (e->info, e->ukind); enew->warn = warnClause_copy (e->warn); DPRINTF (("Here we are...")); DPRINTF (("original: %s", uentry_unparseFull (e))); DPRINTF (("copy: %s", uentry_unparse (enew))); DPRINTF (("copy: %s", uentry_unparseFull (enew))); return enew; } else { return uentry_undefined; } } uentry uentry_copy (uentry e) { return uentry_copyAux (e, TRUE); } uentry uentry_copyNoSave (uentry e) { return uentry_copyAux (e, FALSE); } void uentry_setState (uentry res, uentry other) { llassert (uentry_isValid (res)); llassert (uentry_isValid (other)); llassert (res->ukind == other->ukind); llassert (res->ukind == KVAR); res->sref = sRef_saveCopy (other->sref); res->used = other->used; filelocList_free (res->uses); res->uses = other->uses; other->uses = filelocList_undefined; res->lset = other->lset; } void uentry_mergeUses (uentry res, uentry other) { llassert (uentry_isValid (res)); llassert (uentry_isValid (other)); res->used = other->used || res->used; res->lset = other->lset || res->lset; res->uses = filelocList_append (res->uses, other->uses); other->uses = filelocList_undefined; } /* ** This is a really ugly routine. ** ** gack...fix this one day. */ /* ** flip == TRUE ** >> res is the false branch, other is the true branch (or continuation) ** flip == FALSE ** >> res is the true branch, other is the false branch (or continutation) ** ** opt == TRUE if, ** ** ** if ; ** ** References not effected by res are propagated from other. */ static void branchStateError (/*@notnull@*/ uentry res, /*@notnull@*/ uentry other, bool flip, clause cl, fileloc loc) { if (optgenerror (FLG_BRANCHSTATE, message ("%s %q is %s %s, but %s %s.", ekind_capName (res->ukind), uentry_getName (res), sRef_stateVerb (res->sref), clause_nameFlip (cl, flip), sRef_stateAltVerb (res->sref), clause_nameFlip (cl, !flip)), loc)) { DPRINTF (("Here: %s / %s", sRef_unparseFull (res->sref), sRef_unparseFull (other->sref))); if (sRef_isDead (res->sref)) { if (sRef_hasStateInfoLoc (res->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc); sRef_showStateInfo (res->sref); } if (sRef_hasStateInfoLoc (other->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc); sRef_showStateInfo (other->sref); } } else if (sRef_isKept (res->sref)) { if (sRef_hasAliasInfoLoc (res->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc); sRef_showAliasInfo (res->sref); } if (sRef_hasAliasInfoLoc (other->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc); sRef_showAliasInfo (other->sref); } } else /* dependent */ { if (sRef_hasAliasInfoLoc (res->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc); sRef_showAliasInfo (res->sref); } if (sRef_hasAliasInfoLoc (other->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc); sRef_showAliasInfo (other->sref); } } sRef_setAliasKind (res->sref, AK_ERROR, fileloc_undefined); } } static bool uentry_incompatibleMemoryStates (sRef rs, sRef os) { alkind rk = sRef_getAliasKind (rs); alkind ok = sRef_getAliasKind (os); if (alkind_isError (rk) || alkind_isError (ok)) { return FALSE; } else { return ((sRef_isDead (rs) || (alkind_isKept (rk) && !alkind_isKept (ok)) || (alkind_isDependent (rk) && !alkind_isDependent (ok) && !alkind_isTemp (ok))) && (sRef_isAllocated (os) || sRef_isStateDefined (os))); } } static void branchStateAltError (/*@notnull@*/ uentry res, /*@notnull@*/ uentry other, bool flip, clause cl, fileloc loc) { if (optgenerror (FLG_BRANCHSTATE, message ("%s %q is %s %s, but %s %s.", ekind_capName (res->ukind), uentry_getName (res), sRef_stateVerb (other->sref), clause_nameFlip (cl, flip), sRef_stateAltVerb (other->sref), clause_nameFlip (cl, !flip)), loc)) { if (sRef_isDead (other->sref)) { if (sRef_hasStateInfoLoc (other->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc); sRef_showStateInfo (other->sref); } if (sRef_hasStateInfoLoc (res->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc); sRef_showStateInfo (res->sref); } } else /* kept */ { if (sRef_hasAliasInfoLoc (other->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, flip)), loc); sRef_showAliasInfo (other->sref); } if (sRef_hasAliasInfoLoc (res->sref)) { llgenindentmsg (message ("%s:", clause_nameFlip (cl, !flip)), loc); sRef_showAliasInfo (res->sref); } } sRef_setAliasKind (res->sref, AK_ERROR, fileloc_undefined); sRef_setDefinedComplete (res->sref, fileloc_undefined); sRef_setAliasKind (other->sref, AK_ERROR, fileloc_undefined); sRef_setDefinedComplete (other->sref, fileloc_undefined); } } /* ** A reference is relevant for certain checks, only if it ** is not definitely null on this path (but not declared ** to always be null.) */ static bool uentry_relevantReference (sRef sr, bool flip) { if (sRef_isKept (sr) || sRef_isDependent (sr)) { return FALSE; } else { if (flip) { return !sRef_definitelyNullContext (sr); } else { return !sRef_definitelyNullAltContext (sr); } } } static void uentry_mergeAliasStates (/*@notnull@*/ uentry res, /*@notnull@*/ uentry other, fileloc loc, bool mustReturn, bool flip, bool opt, clause cl) { sRef rs = res->sref; sRef os = other->sref; DPRINTF (("Merge alias states: %s / %s", uentry_unparseFull (res), uentry_unparseFull (other))); if (sRef_isValid (rs)) { if (!mustReturn) { if (uentry_incompatibleMemoryStates (rs, os)) { DPRINTF (("Incompatible: \n\t%s / \n\t%s", sRef_unparseFull (rs), sRef_unparseFull (os))); if (sRef_isThroughArrayFetch (rs) && !context_getFlag (FLG_STRICTBRANCHSTATE)) { if (sRef_isKept (rs) || sRef_isKept (os)) { sRef_maybeKill (rs, loc); } else if (sRef_isPossiblyDead (os)) { sRef_maybeKill (rs, loc); } else { ; } } else { if (uentry_relevantReference (os, flip)) { if (sRef_isLocalParamVar (rs) && (sRef_isLocalState (os) || sRef_isDependent (os))) { if (sRef_isDependent (rs)) { sRef_setDependent (os, loc); } else { sRef_setDefState (rs, SS_UNUSEABLE, loc); } } else { branchStateError (res, other, !flip, cl, loc); /* evans 2002-12-15: changed flip to !flip */ } } } if (sRef_isKept (rs)) { DPRINTF (("Setting kept: %s", sRef_unparseFull (os))); sRef_setKept (os, loc); } } else { if (uentry_incompatibleMemoryStates (os, rs)) { if (uentry_relevantReference (rs, !flip)) { if (sRef_isLocalParamVar (rs) && (sRef_isDependent (rs) || sRef_isLocalState (rs))) { if (sRef_isDependent (os)) { sRef_setDependent (rs, loc); } else { sRef_setDefState (rs, SS_UNUSEABLE, loc); } } else { if (sRef_isParam (os)) { /* ** If the local variable associated ** with the param has the correct state, ** its okay. ** (e.g., free (s); s = new(); ... */ uentry uvar = usymtab_lookupSafe (other->uname); if (uentry_isValid (uvar) && ((sRef_isDead (os) && sRef_isOnly (uvar->sref)) || (sRef_isDependent (os) && sRef_isOwned (uvar->sref)))) { /* no error */ } else { branchStateAltError (res, other, flip, cl, loc); } } else { DPRINTF (("Here: %s / %s", uentry_unparseFull (res), uentry_unparseFull (other))); branchStateAltError (res, other, flip, cl, loc); } } } } if (sRef_isKept (os)) { sRef_setKept (rs, loc); } } if (opt) { DPRINTF (("Merge opt...")); sRef_mergeOptState (rs, os, cl, loc); DPRINTF (("Done!")); } else { DPRINTF (("Merging states: \n\t%s / \n\t%s", sRef_unparseFull (rs), sRef_unparseFull (os))); sRef_mergeState (rs, os, cl, loc); DPRINTF (("After merging : \n\t%s / \n\t%s", sRef_unparseFull (rs), sRef_unparseFull (os))); } } else { if (sRef_isModified (os)) { sRef_setModified (rs); } } } DPRINTF (("After merge: %s", sRef_unparseFull (res->sref))); } static void uentry_mergeValueStates (/*@notnull@*/ uentry res, /*@notnull@*/ uentry other, fileloc loc, bool mustReturn, /*@unused@*/ bool flip) { valueTable rvalues; valueTable ovalues; DPRINTF (("Merge values: %s / %s", sRef_unparseFull (res->sref), sRef_unparseFull (other->sref))); if (mustReturn) { return; } /* flip? */ rvalues = sRef_getValueTable (res->sref); ovalues = sRef_getValueTable (other->sref); if (valueTable_isUndefined (ovalues)) { DPRINTF (("No value table: %s", sRef_unparseFull (other->sref))); ; } else if (valueTable_isUndefined (rvalues)) { /* ** Copy values from other */ /* ??? */ } else { valueTable_elements (ovalues, fkey, fval) { stateValue tval; metaStateInfo minfo; stateCombinationTable sctable; cstring msg; int nval; tval = valueTable_lookup (rvalues, fkey); DPRINTF (("Merge value: %s / %s X %s", fkey, stateValue_unparse (fval), stateValue_unparse (tval))); minfo = context_lookupMetaStateInfo (fkey); llassert (stateValue_isDefined (tval)); if (metaStateInfo_isUndefined (minfo) || !stateValue_isDefined (tval)) { DPRINTF (("Cannot find meta state for: %s", fkey)); BADBRANCH; } else { llassert (metaStateInfo_isDefined (minfo)); if (stateValue_isError (fval) || sRef_definitelyNullContext (res->sref)) { sRef_setMetaStateValueComplete (res->sref, fkey, stateValue_getValue (fval), stateValue_getLoc (fval)); DPRINTF (("Setting res: %s", sRef_unparseFull (res->sref))); } else if (stateValue_isError (tval) || sRef_definitelyNullAltContext (other->sref)) { DPRINTF (("Other branch is definitely null!")); } else if (sRef_isStateUndefined (res->sref) || sRef_isDead (res->sref)) { ; /* Combination state doesn't matter if it is undefined or dead */ } else { DPRINTF (("Check: %s / %s / %s / %s", fkey, metaStateInfo_unparse (minfo), stateValue_unparse (fval), stateValue_unparse (tval))); DPRINTF (("state values: %d / %d", stateValue_getValue (fval), stateValue_getValue (tval))); sctable = metaStateInfo_getMergeTable (minfo); DPRINTF (("Merge table: %s", stateCombinationTable_unparse (sctable))); msg = cstring_undefined; nval = stateCombinationTable_lookup (sctable, stateValue_getValue (fval), stateValue_getValue (tval), &msg); DPRINTF (("nval: %d / %d / %d", nval, stateValue_getValue (fval), stateValue_getValue (tval))); if (nval == stateValue_error) { if (uentry_isGlobalMarker (res)) { if (optgenerror (FLG_STATEMERGE, message ("Control branches merge with incompatible global states (%s and %s)%q", metaStateInfo_unparseValue (minfo, stateValue_getValue (fval)), metaStateInfo_unparseValue (minfo, stateValue_getValue (tval)), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), loc)) { sRef_showMetaStateInfo (res->sref, fkey); sRef_showMetaStateInfo (other->sref, fkey); } } else { if (optgenerror (FLG_STATEMERGE, message ("Control branches merge with incompatible states for %q (%s and %s)%q", uentry_getName (res), metaStateInfo_unparseValue (minfo, stateValue_getValue (fval)), metaStateInfo_unparseValue (minfo, stateValue_getValue (tval)), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), loc)) { sRef_showMetaStateInfo (res->sref, fkey); sRef_showMetaStateInfo (other->sref, fkey); DPRINTF (("Res: %s", sRef_unparseFull (res->sref))); DPRINTF (("Other: %s", sRef_unparseFull (other->sref))); DPRINTF (("Null: %s / %s", bool_unparse (usymtab_isDefinitelyNull (res->sref)), bool_unparse (usymtab_isDefinitelyNull (other->sref)))); } } } if (nval == stateValue_getValue (fval) && nval != stateValue_getValue (tval)) { loc = stateValue_getLoc (fval); } else if (nval == stateValue_getValue (tval) && nval != stateValue_getValue (fval)) { loc = stateValue_getLoc (tval); } else { ; } if (stateValue_getValue (sRef_getMetaStateValue (res->sref, fkey)) == nval && nval == stateValue_getValue (fval) && nval == stateValue_getValue (tval)) { ; } else { sRef_setMetaStateValueComplete (res->sref, fkey, nval, loc); } } } } end_valueTable_elements ; } } static void uentry_mergeSetStates (/*@notnull@*/ uentry res, /*@notnull@*/ uentry other, /*@unused@*/ fileloc loc, bool flip, clause cl) { if (cl == DOWHILECLAUSE) { res->used = other->used || res->used; res->lset = other->lset || res->lset; res->uses = filelocList_append (res->uses, other->uses); other->uses = filelocList_undefined; } else { if (sRef_isMacroParamRef (res->sref) && !uentry_isSefParam (other) && !uentry_isSefParam (res)) { bool hasError = FALSE; if (bool_equal (res->used, other->used)) { res->used = other->used; } else { if (other->used && !flip) { hasError = optgenerror (FLG_MACROPARAMS, message ("Macro parameter %q used in true clause, " "but not in false clause", uentry_getName (res)), uentry_whereDeclared (res)); } else { hasError = optgenerror (FLG_MACROPARAMS, message ("Macro parameter %q used in false clause, " "but not in true clause", uentry_getName (res)), uentry_whereDeclared (res)); } res->used = TRUE; if (hasError) { /* make it sef now, prevent more errors */ res->info->var->kind = VKREFSEFPARAM; } } } else { res->used = other->used || res->used; res->lset = other->lset || res->lset; res->uses = filelocList_append (res->uses, other->uses); other->uses = filelocList_undefined; } } } void uentry_mergeState (uentry res, uentry other, fileloc loc, bool mustReturn, bool flip, bool opt, clause cl) { llassert (uentry_isValid (res)); llassert (uentry_isValid (other)); llassert (res->ukind == other->ukind); llassert (res->ukind == KVAR); DPRINTF (("Merge state: %s / %s", uentry_unparseFull (res), uentry_unparseFull (other))); uentry_mergeAliasStates (res, other, loc, mustReturn, flip, opt, cl); uentry_mergeValueStates (res, other, loc, mustReturn, flip); uentry_mergeSetStates (res, other, loc, flip, cl); DPRINTF (("Merge ==> %s", uentry_unparseFull (res))); } void uentry_setUsed (uentry e, fileloc loc) { static bool firstTime = TRUE; static bool showUses = FALSE; static bool exportLocal = FALSE; DPRINTF (("Used: %s / %s", uentry_unparse (e), fileloc_unparse (loc))); if (firstTime) { /* need to track uses is FLG_SHOWUSES or FLG_EXPORTLOCAL is true */ showUses = context_getFlag (FLG_SHOWUSES); exportLocal = context_maybeSet (FLG_EXPORTLOCAL); firstTime = FALSE; } if (uentry_isValid (e)) { if (warnClause_isDefined (e->warn)) { flagSpec flg = warnClause_getFlag (e->warn); cstring msg; if (warnClause_hasMessage (e->warn)) { msg = cstring_copy (warnClause_getMessage (e->warn)); } else { msg = message ("Use of possibly dangerous %s", uentry_ekindNameLC (e)); } vfsgenerror (flg, message ("%q: %q", msg, uentry_getName (e)), loc); } if (sRef_isMacroParamRef (e->sref)) { if (uentry_isYield (e) || uentry_isSefParam (e)) { ; } else { if (context_inConditional ()) { if (optgenerror (FLG_MACROPARAMS, message ("Macro parameter %q used in conditionally " "executed code (may or may not be " "evaluated exactly once)", uentry_getName (e)), loc)) { e->info->var->kind = VKREFSEFPARAM; } } else { if ((e)->used) { if (optgenerror (FLG_MACROPARAMS, message ("Macro parameter %q used more than once", uentry_getName (e)), uentry_whereDeclared (e))) { e->info->var->kind = VKREFSEFPARAM; } } } } } if (usymId_isValid (usymtab_directParamNo (e))) { uentry_setUsed (usymtab_getParam (usymId_toInt (usymtab_directParamNo (e))), loc); } e->used = TRUE; if (!sRef_isLocalVar (e->sref)) { if (showUses) { e->uses = filelocList_add (e->uses, fileloc_copy (loc)); } else { if (exportLocal) { if (context_inMacro ()) { e->uses = filelocList_addUndefined (e->uses); } else { e->uses = filelocList_addDifferentFile (e->uses, uentry_whereDeclared (e), loc); } } } } } } bool uentry_isReturned (uentry u) { return (uentry_isValid (u) && uentry_isVar (u) && (u->info->var->kind == VKRETPARAM || u->info->var->kind == VKSEFRETPARAM)); } /*@exposed@*/ sRef uentry_returnedRef (uentry u, exprNodeList args, fileloc loc) { llassert (uentry_isRealFunction (u)); if (ctype_isFunction (u->utype) && sRef_isStateSpecial (uentry_getSref (u))) { stateClauseList clauses = uentry_getStateClauseList (u); sRef res = sRef_makeNew (ctype_getReturnType (u->utype), u->sref, u->uname); DPRINTF (("Returned: %s", sRef_unparseFull (res))); sRef_setAllocated (res, loc); DPRINTF (("ensures clause: %s / %s", uentry_unparse (u), stateClauseList_unparse (clauses))); /* ** This should be in exprNode_reflectEnsuresClause */ stateClauseList_postElements (clauses, cl) { if (!stateClause_isGlobal (cl)) { sRefSet refs = stateClause_getRefs (cl); sRefMod modf = stateClause_getEffectFunction (cl); sRefSet_elements (refs, el) { sRef base = sRef_getRootBase (el); if (sRef_isResult (base)) { if (modf != NULL) { sRef sr = sRef_fixBase (el, res); modf (sr, loc); } } else { ; } } end_sRefSet_elements ; } } end_stateClauseList_postElements ; return res; } else { uentryList params; alkind ak; sRefSet prefs = sRefSet_new (); sRef res = sRef_undefined; int paramno = 0; params = uentry_getParams (u); uentryList_elements (params, current) { if (uentry_isReturned (current)) { if (exprNodeList_size (args) >= paramno) { exprNode ecur = exprNodeList_nth (args, paramno); sRef tref = exprNode_getSref (ecur); DPRINTF (("Returned reference: %s", sRef_unparseFull (tref))); if (sRef_isValid (tref)) { sRef tcref = sRef_copy (tref); usymtab_addForceMustAlias (tcref, tref); /* evans 2001-05-27 */ if (sRef_isNew (tcref)) { /* tcref->kind = SK_OBJECT; */ /*!! Not new anymore */ } if (sRef_isDead (tcref)) { sRef_setDefined (tcref, loc); sRef_setOnly (tcref, loc); } if (sRef_isRefCounted (tcref)) { /* could be a new ref now (but only if its returned) */ sRef_setAliasKindComplete (tcref, AK_ERROR, loc); } sRef_makeSafe (tcref); DPRINTF (("Returns tcref / %s", sRef_unparseFull (tcref))); prefs = sRefSet_insert (prefs, tcref); } } } paramno++; } end_uentryList_elements ; if (sRefSet_size (prefs) > 0) { nstate n = sRef_getNullState (u->sref); if (sRefSet_size (prefs) == 1) { res = sRefSet_choose (prefs); } else { /* should this ever happen? */ res = sRefSet_mergeIntoOne (prefs); } if (nstate_isKnown (n)) { sRef_setNullState (res, n, loc); } } else { if (ctype_isFunction (u->utype)) { DPRINTF (("Making new from %s -->", uentry_unparseFull (u))); res = sRef_makeNew (ctype_getReturnType (u->utype), u->sref, u->uname); } else { res = sRef_makeNew (ctype_unknown, u->sref, u->uname); } if (sRef_isRefCounted (res)) { sRef_setAliasKind (res, AK_NEWREF, loc); } } if (sRef_getNullState (res) == NS_ABSNULL) { ctype ct = ctype_realType (u->utype); if (ctype_isAbstract (ct)) { sRef_setNotNull (res, loc); } else { if (ctype_isUser (ct)) { sRef_setStateFromUentry (res, usymtab_getTypeEntry (ctype_typeId (ct))); } else { sRef_setNotNull (res, loc); } } } if (sRef_isRefCounted (res)) { sRef_setAliasKind (res, AK_NEWREF, loc); } else if (sRef_isKillRef (res)) { sRef_setAliasKind (res, AK_REFCOUNTED, loc); } else { ; } ak = sRef_getAliasKind (res); if (alkind_isImplicit (ak)) { sRef_setAliasKind (res, alkind_fixImplicit (ak), loc); } sRefSet_free (prefs); /* if (sRef_isOnly (res)) { sRef_setFresh (res, loc); } */ DPRINTF (("Returns ref: %s", sRef_unparseFull (res))); return res; } } static bool uentry_isRefCounted (uentry ue) { ctype ct = uentry_getType (ue); if (ctype_isFunction (ct)) { return (ctype_isRefCounted (ctype_getReturnType (ct))); } else { return (ctype_isRefCounted (ct)); } } /* ** old was declared yield in the specification. ** new is declared in the iter implementation. */ void uentry_checkYieldParam (uentry old, uentry unew) { cstring name; llassert (uentry_isVariable (old)); llassert (uentry_isVariable (unew)); unew->info->var->kind = VKYIELDPARAM; (void) checkTypeConformance (old, unew, TRUE); checkVarConformance (old, unew, TRUE, FALSE); /* get rid of param marker */ name = uentry_getName (unew); cstring_free (unew->uname); unew->uname = name; unew->info->var->kind = VKREFYIELDPARAM; uentry_setUsed (old, fileloc_undefined); uentry_setUsed (unew, fileloc_undefined); } /*@observer@*/ cstring uentry_ekindName (uentry ue) { if (uentry_isValid (ue)) { switch (ue->ukind) { case KINVALID: return cstring_makeLiteralTemp (""); case KDATATYPE: return cstring_makeLiteralTemp ("Datatype"); case KENUMCONST: return cstring_makeLiteralTemp ("Enum member"); case KCONST: return cstring_makeLiteralTemp ("Constant"); case KVAR: if (uentry_isParam (ue)) { return cstring_makeLiteralTemp ("Parameter"); } else if (uentry_isExpandedMacro (ue)) { return cstring_makeLiteralTemp ("Expanded macro"); } else { return cstring_makeLiteralTemp ("Variable"); } case KFCN: return cstring_makeLiteralTemp ("Function"); case KITER: return cstring_makeLiteralTemp ("Iterator"); case KENDITER: return cstring_makeLiteralTemp ("Iterator finalizer"); case KSTRUCTTAG: return cstring_makeLiteralTemp ("Struct tag"); case KUNIONTAG: return cstring_makeLiteralTemp ("Union tag"); case KENUMTAG: return cstring_makeLiteralTemp ("Enum tag"); case KELIPSMARKER: return cstring_makeLiteralTemp ("Optional parameters"); } } else { return cstring_makeLiteralTemp (""); } BADEXIT; } /*@observer@*/ cstring uentry_ekindNameLC (uentry ue) { if (uentry_isValid (ue)) { switch (ue->ukind) { case KINVALID: return cstring_makeLiteralTemp (""); case KDATATYPE: return cstring_makeLiteralTemp ("datatype"); case KENUMCONST: return cstring_makeLiteralTemp ("enum member"); case KCONST: return cstring_makeLiteralTemp ("constant"); case KVAR: if (uentry_isParam (ue)) { return cstring_makeLiteralTemp ("parameter"); } else if (uentry_isExpandedMacro (ue)) { return cstring_makeLiteralTemp ("expanded macro"); } else { return cstring_makeLiteralTemp ("variable"); } case KFCN: return cstring_makeLiteralTemp ("function"); case KITER: return cstring_makeLiteralTemp ("iterator"); case KENDITER: return cstring_makeLiteralTemp ("iterator finalizer"); case KSTRUCTTAG: return cstring_makeLiteralTemp ("struct tag"); case KUNIONTAG: return cstring_makeLiteralTemp ("union tag"); case KENUMTAG: return cstring_makeLiteralTemp ("enum tag"); case KELIPSMARKER: return cstring_makeLiteralTemp ("optional parameters"); } } else { return cstring_makeLiteralTemp (""); } BADEXIT; } void uentry_setHasNameError (uentry ue) { llassert (uentry_isValid (ue)); ue->hasNameError = TRUE; } void uentry_checkName (uentry ue) { DPRINTF (("Checking name: %s / %s / %s", uentry_unparse (ue), uentry_observeRealName (ue), bool_unparse (uentry_isVisibleExternally (ue)))); if (uentry_isValid (ue) && !context_inXHFile () && uentry_hasName (ue) && !uentry_isElipsisMarker (ue) && context_getFlag (FLG_NAMECHECKS) && !ue->hasNameError && !uentry_isEndIter (ue) && !fileloc_isBuiltin (uentry_whereLast (ue)) && (uentry_isExpandedMacro (ue) || !uentry_isForward (ue))) { DPRINTF (("Here...")); if (uentry_isPriv (ue)) { ; /* any checks here? */ } else if (fileloc_isExternal (uentry_whereDefined (ue))) { ; /* no errors for externals */ } else { int scope; if (uentry_isExpandedMacro (ue)) { scope = globScope; } else { if (uentry_isExpandedMacro (ue)) { scope = fileScope; } else if (uentry_isVariable (ue)) { sRef sr = uentry_getSref (ue); if (sRef_isValid (sr)) { scope = sRef_getScope (sr); } else { scope = fileScope; } } else if (uentry_isFunction (ue) || uentry_isIter (ue) || uentry_isEndIter (ue) || uentry_isConstant (ue)) { scope = uentry_isStatic (ue) ? fileScope : globScope; } else /* datatypes, etc. must be global */ { scope = globScope; } usymtab_checkDistinctName (ue, scope); } if (context_getFlag (FLG_CPPNAMES)) { checkCppName (ue); } if (scope == globScope) { checkExternalName (ue); } else if (scope == fileScope) { checkFileScopeName (ue); } else { checkLocalName (ue); } checkPrefix (ue); checkAnsiName (ue); } } } /*@exposed@*/ uentry uentry_makeUnrecognized (cstring c, /*@only@*/ fileloc loc) { uentry ue; fileloc tloc; /* ** Can't but unrecognized ids in macros in global scope, because srefs will break! */ if (!context_inMacro ()) { sRef_setGlobalScopeSafe (); } ue = uentry_makeVariable (c, ctype_unknown, loc, FALSE); uentry_setUsed (ue, loc); tloc = fileloc_createExternal (); uentry_setDefined (ue, tloc); fileloc_free (tloc); uentry_setHasNameError (ue); if (context_getFlag (FLG_REPEATUNRECOG) || (context_inOldStyleScope())) { uentry_markOwned (ue); } else { ue = usymtab_supReturnFileEntry (ue); } if (!context_inMacro ()) { sRef_clearGlobalScopeSafe (); } return ue; } uentry uentry_makeGlobalMarker () { uentry ue; fileloc tloc; llassert (sRef_inGlobalScope ()); ue = uentry_makeVariableAux (GLOBAL_MARKER_NAME, ctype_unknown, fileloc_undefined, sRef_makeGlobalMarker (), FALSE, VKNORMAL); tloc = fileloc_createExternal (); uentry_setUsed (ue, tloc); uentry_setDefined (ue, tloc); fileloc_free (tloc); uentry_setHasNameError (ue); return ue; } bool uentry_isGlobalMarker (uentry ue) { return (uentry_isValid (ue) && (cstring_equal (uentry_rawName (ue), GLOBAL_MARKER_NAME))); } /* new start modifications */ /* start modifications */ /* requires: p_e is defined, is a ptr/array variable modifies: p_e effects: sets the state of the variable */ void uentry_setPossiblyNullTerminatedState (uentry p_e) { llassert (uentry_isValid (p_e)); if (p_e->info != NULL) { if (p_e->info->var != NULL) { llassert (p_e->info->var->bufinfo != NULL); p_e->info->var->bufinfo->bufstate = BB_POSSIBLYNULLTERMINATED; sRef_setPossiblyNullTerminatedState (p_e->sref); } } } /* requires: p_e is defined, is a ptr/array variable modifies: p_e effects: sets the size of the buffer */ void uentry_setNullTerminatedState (uentry p_e) { llassert (uentry_isValid (p_e)); if (p_e->info != NULL) { if (p_e->info->var != NULL) { llassert (p_e->info->var->bufinfo != NULL); p_e->info->var->bufinfo->bufstate = BB_NULLTERMINATED; sRef_setNullTerminatedState (p_e->sref); } } } /* requires: p_e is defined, is a ptr/array variable modifies: p_e effects: sets the size of the buffer */ void uentry_setSize (uentry p_e, int size) { if (uentry_isValid (p_e)) { if (p_e->info != NULL) { if (p_e->info->var != NULL) { llassert (p_e->info->var->bufinfo != NULL); p_e->info->var->bufinfo->size = size; sRef_setSize (p_e->sref, size); } } } } /* requires: p_e is defined, is a ptr/array variable modifies: p_e effects: sets the length of the buffer */ void uentry_setLen (uentry p_e, int len) { if (uentry_isValid (p_e)) { if (p_e->info != NULL && p_e->info->var != NULL) { llassert (p_e->info->var->bufinfo != NULL); p_e->info->var->bufinfo->len = len; sRef_setLen (p_e->sref, len); } } } /*@=type*/ bool uentry_hasMetaStateEnsures (uentry e) { if (uentry_isValid (e) && uentry_isFunction (e)) { return functionConstraint_hasMetaStateConstraint (e->info->fcn->postconditions); } else { return FALSE; } } metaStateConstraintList uentry_getMetaStateEnsures (uentry e) { llassert (uentry_isValid (e) && uentry_isFunction (e)); return functionConstraint_getMetaStateConstraints (e->info->fcn->postconditions); } bool uentry_hasBufStateInfo (uentry ue) { llassert (uentry_isValid (ue)); return (ue->info->var->bufinfo != NULL); } bool uentry_isNullTerminated (uentry ue) { llassert (uentry_hasBufStateInfo (ue)); llassert (ue->info->var->bufinfo != NULL); return ue->info->var->bufinfo->bufstate == BB_NULLTERMINATED; } bool uentry_isPossiblyNullTerminated (uentry ue) { llassert (uentry_hasBufStateInfo (ue)); llassert (ue->info->var->bufinfo != NULL); return (ue->info->var->bufinfo->bufstate == BB_POSSIBLYNULLTERMINATED); } bool uentry_isNotNullTerminated (uentry ue) { llassert (uentry_hasBufStateInfo (ue)); llassert (ue->info->var->bufinfo != NULL); return (ue->info->var->bufinfo->bufstate == BB_NOTNULLTERMINATED); } # ifdef DEBUGSPLINT /* ** For debugging only */ void uentry_checkValid (uentry ue) { if (uentry_isValid (ue)) { sRef_checkCompletelyReasonable (ue->sref); } } # endif splint-3.1.2.dfsg1/src/cprim.c0000644021234200000250000002730707716314756013541 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cprim.c */ # include "splintMacros.nf" # include "basic.h" static bool cprim_isReal (cprim c) { return (cprim_isAnyReal (c)); } static bool cprim_isNumeric (cprim c) { return (cprim_isReal (c) || cprim_isInt (c)); } cprim cprim_fromInt (int i) { if (i < CTX_UNKNOWN || i > CTX_LAST) { llcontbug (message ("cprim_fromInt: out of range: %d", i)); return CTX_UNKNOWN; } return (cprim) i; } /* ** not symmetric: c1 := c2 or c2 is passed as c1 ** (if RELAXQUALS, c1 must be "bigger" than c2) */ static bool cprim_closeEnoughAux (cprim p_c1, cprim p_c2, bool p_deep); bool cprim_closeEnoughDeep (cprim c1, cprim c2) { /* ** If * c2 is passed as * c1 ** Comparison is slightly different since it is safe to pass int as long, ** but not to pass int * as long *! ** ** For deep comparisons, +relaxquals does not permit the long/int break. */ return cprim_closeEnoughAux (c1, c2, TRUE); } bool cprim_closeEnough (cprim c1, cprim c2) { return cprim_closeEnoughAux (c1, c2, FALSE); } static bool cprim_closeEnoughAux (cprim c1, cprim c2, bool deep) { if (c1 == c2) return TRUE; DPRINTF (("cprim close: %s / %s", cprim_unparse (c1), cprim_unparse (c2))); if (c1 == CTX_ANYINTEGRAL) { if (context_getFlag (FLG_MATCHANYINTEGRAL) || context_getFlag (FLG_IGNOREQUALS)) { return (cprim_isAnyInt (c2) || (cprim_isAnyChar (c2) && context_msgCharInt ())); } else if (context_getFlag (FLG_LONGINTEGRAL)) { return (cprim_closeEnough (CTX_LINT, c2)); } else if (context_getFlag (FLG_LONGUNSIGNEDINTEGRAL)) { return (cprim_closeEnough (CTX_ULINT, c2)); } else { return FALSE; } } if (c1 == CTX_UNSIGNEDINTEGRAL) { /* We allow signed ints to match any integral if matchanyintegral is set */ if (context_getFlag (FLG_MATCHANYINTEGRAL)) { return (cprim_isAnyInt (c2) || (cprim_isAnyChar (c2) && context_msgCharInt ())); } if (context_getFlag (FLG_IGNOREQUALS)) { if (context_getFlag (FLG_IGNORESIGNS)) { return (cprim_isAnyUnsignedInt (c2) || (cprim_isUnsignedChar (c2) && context_msgCharInt ())); } else { return (cprim_isAnyInt (c2) || (cprim_isAnyChar (c2) && context_msgCharInt ())); } } else if (context_getFlag (FLG_LONGUNSIGNEDUNSIGNEDINTEGRAL)) { return (cprim_closeEnough (CTX_ULINT, c2)); } else { return FALSE; } } if (c1 == CTX_SIGNEDINTEGRAL) { /* We allow signed ints to match any integral if matchanyintegral is set */ if (context_getFlag (FLG_MATCHANYINTEGRAL)) { return (cprim_isAnyInt (c2) || (cprim_isAnyChar (c2) && context_msgCharInt ())); } if (context_getFlag (FLG_IGNOREQUALS)) { return (cprim_isAnyInt (c2) || (cprim_isAnyChar (c2) && context_msgCharInt ())); } else if (context_getFlag (FLG_LONGSIGNEDINTEGRAL)) { return (cprim_closeEnough (CTX_LINT, c2)); } else { return FALSE; } } if (c2 == CTX_ANYINTEGRAL) { if (context_getFlag (FLG_MATCHANYINTEGRAL)) { return (cprim_isAnyInt (c1) || (cprim_isAnyChar (c1) && context_msgCharInt ())); } else if (context_getFlag (FLG_LONGINTEGRAL)) { return (cprim_closeEnough (c1, CTX_LINT)); } else if (context_getFlag (FLG_LONGUNSIGNEDINTEGRAL)) { return (cprim_closeEnough (c1, CTX_ULINT)); } else { return FALSE; } } if (c2 == CTX_UNSIGNEDINTEGRAL) { if (context_getFlag (FLG_MATCHANYINTEGRAL)) { return (cprim_isAnyInt (c1) || (cprim_isAnyChar (c1) && context_msgCharInt ())); } else if (context_getFlag (FLG_LONGUNSIGNEDUNSIGNEDINTEGRAL)) { return (cprim_closeEnough (c1, CTX_ULINT)); } else { return FALSE; } } if (c2 == CTX_SIGNEDINTEGRAL) { if (context_getFlag (FLG_MATCHANYINTEGRAL)) { return (cprim_isAnyInt (c2) || (cprim_isAnyChar (c2) && context_msgCharInt ())); } else if (context_getFlag (FLG_LONGSIGNEDINTEGRAL)) { return (cprim_closeEnough (c1, CTX_LINT)); } else { return FALSE; } } DPRINTF (("cprim close: %s / %s", cprim_unparse (c1), cprim_unparse (c2))); if (context_getFlag (FLG_RELAXTYPES)) { if (cprim_isNumeric (c1) && cprim_isNumeric (c2)) return TRUE; } if (context_getFlag (FLG_IGNOREQUALS)) { switch (c1) { case CTX_CHAR: case CTX_UCHAR: if (cprim_isAnyChar (c2) || (cprim_isAnyInt (c2) && (context_msgCharInt ()))) { return TRUE; } break; case CTX_DOUBLE: case CTX_FLOAT: case CTX_LDOUBLE: if (c2 == CTX_DOUBLE || c2 == CTX_FLOAT || c2 == CTX_LDOUBLE) { return TRUE; } break; case CTX_INT: case CTX_LINT: case CTX_LLINT: case CTX_ULLINT: case CTX_SINT: case CTX_UINT: case CTX_ULINT: case CTX_USINT: if (cprim_isAnyInt (c2) || (cprim_isAnyChar (c2) && context_msgCharInt ())) { return TRUE; } /*@fallthrough@*/ default: ; } } if (context_getFlag (FLG_IGNORESIGNS)) { if (c1 == CTX_UCHAR) { c1 = CTX_CHAR; } else if (c1 == CTX_UINT) { c1 = CTX_INT; } else if (c1 == CTX_ULINT) { c1 = CTX_LINT; } /* 2001-06-10: This fix provided by Jim Zelenka: */ else if (c1 == CTX_ULLINT) { c1 = CTX_LLINT; } /* End fix */ else if (c1 == CTX_USINT) { c1 = CTX_SINT; } else { ; } if (c2 == CTX_UCHAR) { c2 = CTX_CHAR; } else if (c2 == CTX_UINT) { c2 = CTX_INT; } else if (c2 == CTX_ULINT) { c2 = CTX_LINT; } /* 2001-06-10: This fix provided by Jim Zelenka: */ else if (c2 == CTX_ULLINT) { c2 = CTX_LLINT; } /* End fix */ else if (c2 == CTX_USINT) { c2 = CTX_SINT; } else { ; } } if (c1 == c2) return TRUE; if (context_getFlag (FLG_FLOATDOUBLE)) { if (c1 == CTX_FLOAT && c2 == CTX_DOUBLE) { return TRUE; } if (c2 == CTX_FLOAT && c1 == CTX_DOUBLE) { return TRUE; } } DPRINTF (("cprim close: %s / %s", cprim_unparse (c1), cprim_unparse (c2))); if (!deep && context_getFlag (FLG_RELAXQUALS)) { switch (c1) { case CTX_DOUBLE: return (c2 == CTX_FLOAT); case CTX_LDOUBLE: return (c2 == CTX_DOUBLE || c2 == CTX_FLOAT); case CTX_SINT: return ((c2 == CTX_CHAR && context_msgCharInt ()) || (c2 == CTX_INT && context_msgShortInt ()) || (c2 == CTX_LINT && context_msgShortInt () && context_msgLongInt ())); case CTX_INT: return ((c2 == CTX_SINT || (cprim_isAnyChar (c2) && context_msgCharInt ()) || (c2 == CTX_LINT && context_msgLongInt ()))); case CTX_LLINT: return (c2 == CTX_SINT || c2 == CTX_INT || c2 == CTX_LINT || (cprim_isAnyChar (c2) && context_msgCharInt ())); case CTX_ULLINT: return (c2 == CTX_USINT || c2 == CTX_UINT || c2 == CTX_ULINT /* 2001-06-10: This fix provided by Jim Zelenka: */ || (cprim_isAnyChar (c2) && context_msgCharInt ())); case CTX_LINT: return (c2 == CTX_SINT || c2 == CTX_INT || (cprim_isAnyChar (c2) && context_msgCharInt ())); case CTX_UINT: return (c2 == CTX_USINT || (c2 == CTX_UCHAR && context_msgCharInt ())); case CTX_USINT: return (c2 == CTX_UCHAR && context_msgCharInt ()); case CTX_ULINT: /* 2001-06-10: This fix provided by Jim Zelenka: */ return (c2 == CTX_UINT || c2 == CTX_USINT || (c2 == CTX_UCHAR && context_msgCharInt())); case CTX_UCHAR: return (c2 == CTX_UINT && context_msgCharInt ()); case CTX_CHAR: return ((c2 == CTX_INT || c2 == CTX_SINT) && context_msgCharInt ()); default: return FALSE; } } else { switch (c1) { case CTX_DOUBLE: case CTX_LDOUBLE: return FALSE; case CTX_SINT: if (c2 == CTX_INT && context_msgShortInt ()) { return TRUE; } /*@fallthrough@*/ case CTX_INT: if (c2 == CTX_INT && context_msgLongInt ()) { return TRUE; } if (c2 == CTX_SINT && context_msgShortInt ()) { return TRUE; } /*@fallthrough@*/ case CTX_LINT: if (c2 == CTX_INT && context_msgLongInt ()) { return TRUE; } /*@fallthrough@*/ case CTX_LLINT: return (c2 == CTX_CHAR && context_msgCharInt ()); case CTX_UINT: case CTX_USINT: case CTX_ULINT: case CTX_ULLINT: return (c2 == CTX_UCHAR && context_msgCharInt ()); case CTX_UCHAR: return (c2 == CTX_UINT && context_msgCharInt ()); case CTX_CHAR: return ((c2 == CTX_INT || c2 == CTX_SINT) && context_msgCharInt ()); default: return FALSE; } } } /*@only@*/ cstring cprim_unparse (cprim c) { switch (c) { case CTX_UNKNOWN: return cstring_makeLiteral ("-"); case CTX_VOID: return cstring_makeLiteral ("void"); case CTX_CHAR: return cstring_makeLiteral ("char"); case CTX_UCHAR: return cstring_makeLiteral ("unsigned char"); case CTX_DOUBLE: return cstring_makeLiteral ("double"); case CTX_LDOUBLE: return cstring_makeLiteral ("long double"); case CTX_FLOAT: return cstring_makeLiteral ("float"); case CTX_INT: return cstring_makeLiteral ("int"); case CTX_LINT: return cstring_makeLiteral ("long int"); case CTX_LLINT: return cstring_makeLiteral ("long long"); case CTX_ULLINT: return cstring_makeLiteral ("unsigned long long"); case CTX_SINT: return cstring_makeLiteral ("short int"); case CTX_UINT: return cstring_makeLiteral ("unsigned int"); case CTX_ULINT: return cstring_makeLiteral ("unsigned long int"); case CTX_USINT: return cstring_makeLiteral ("unsigned short int"); case CTX_UNSIGNEDINTEGRAL: return cstring_makeLiteral ("arbitrary unsigned integral type"); case CTX_SIGNEDINTEGRAL: return cstring_makeLiteral ("arbitrary signed integral type"); case CTX_ANYINTEGRAL: return cstring_makeLiteral ("arbitrary integral type"); default: return cstring_makeLiteral ("unknown prim"); } } bool cprim_isInt (cprim c) { return (cprim_isAnyInt (c) || (cprim_isAnyChar (c) && context_msgCharInt ())); } int cprim_getExpectedBits (cprim c) { /* Any basis to these numbers? Just guesses for now..., check ISO spec */ switch (c) { case CTX_UNKNOWN: return 0; case CTX_VOID: return 0; case CTX_CHAR: return 8; case CTX_UCHAR: return 8; case CTX_DOUBLE: return 64; case CTX_LDOUBLE: return 128; case CTX_FLOAT: return 32; case CTX_INT: return 32; case CTX_LINT: return 64; case CTX_LLINT: return 128; case CTX_ULLINT: return 128; case CTX_SINT: return 8; case CTX_UINT: return 32; case CTX_ULINT: return 64; case CTX_USINT: return 8; case CTX_UNSIGNEDINTEGRAL: return 64; case CTX_SIGNEDINTEGRAL: return 64; case CTX_ANYINTEGRAL: return 64; default: return 0; } } splint-3.1.2.dfsg1/src/macrocache.c0000644021234200000250000002032707646432515014503 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** macrocache.c ** ** rep Invariant: ** no two fileloc's may be equal ** */ # include "splintMacros.nf" # include "basic.h" # include "llmain.h" /*@constant int MCEBASESIZE;@*/ # define MCEBASESIZE 8 /*@constant int DNE;@*/ # define DNE -1 /* ** Temporary file used for processing macros. */ static /*:open:*/ /*@null@*/ FILE *s_macFile = NULL; /* ** mcDisable is set to TRUE when a macro is being processed, so ** its contents are not added to the macrocache again, creating ** a nasty infinite loop. */ static bool mcDisable = TRUE; static void macrocache_grow (macrocache p_s); static int macrocache_exists (macrocache p_s, fileloc p_fl); static void macrocache_processMacro (macrocache p_m, int p_i); static /*@only@*/ mce mce_create (/*@only@*/ fileloc fl, /*@only@*/ cstring def, bool comment) { mce m = (mce) dmalloc (sizeof (*m)); m->fl = fl; m->def = def; /*< had a copy here! check this carefully */ m->defined = FALSE; m->scomment = comment; return m; } static void mce_free (/*@only@*/ mce m) { fileloc_free (m->fl); cstring_free (m->def); sfree (m); } /*@only@*/ macrocache macrocache_create (void) { macrocache s = (macrocache) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = MCEBASESIZE; s->contents = (mce *) dmalloc (sizeof (*s->contents) * MCEBASESIZE); mcDisable = FALSE; return (s); } void macrocache_free (macrocache s) { int i; llassert (s_macFile == NULL); for (i = 0; i < s->entries; i++) { mce_free (s->contents[i]); } sfree (s->contents); sfree (s); } static void macrocache_grow (macrocache s) { int i; o_mce *oldcontents = s->contents; s->nspace = MCEBASESIZE; s->contents = (mce *) dmalloc (sizeof (*s->contents) * (s->entries + s->nspace)); for (i = 0; i < s->entries; i++) { s->contents[i] = oldcontents[i]; } sfree (oldcontents); } static void macrocache_addGenEntry (macrocache s, /*@only@*/ fileloc fl, /*@only@*/ cstring def, bool sup) { int i; if (mcDisable) { fileloc_free (fl); cstring_free (def); return; } if ((i = macrocache_exists (s, fl)) != DNE) { if (cstring_equal (def, s->contents[i]->def)) { fileloc_free (fl); cstring_free (def); return; } else { /* ** macro definition contained macro that is expanded ** replace with def ** ** how do we know which is better?? */ cstring_free (s->contents[i]->def); s->contents[i]->def = def; fileloc_free (fl); return; } } if (s->nspace <= 0) { macrocache_grow (s); } s->nspace--; s->contents[s->entries] = mce_create (fl, def, sup); s->entries++; } void macrocache_addEntry (macrocache s, /*@only@*/ fileloc fl, /*@only@*/ cstring def) { macrocache_addGenEntry (s, fl, def, FALSE); } void macrocache_addComment (macrocache s, /*@only@*/ fileloc fl, /*@only@*/ cstring def) { DPRINTF (("Macrocache add comment: %s / %s", fileloc_unparse (fl), def)); macrocache_addGenEntry (s, fl, def, TRUE); } static int macrocache_exists (macrocache s, fileloc fl) { int i; for (i = 0; i < s->entries; i++) { if (fileloc_equal (s->contents[i]->fl, fl)) return (i); } return (DNE); } /*@only@*/ cstring macrocache_unparse (macrocache m) { cstring s = cstring_undefined; int i; for (i = 0; i < m->entries; i++) { fileloc fl = m->contents[i]->fl; cstring def = m->contents[i]->def; bool defined = m->contents[i]->defined; s = message ("%q%q: %s [%s]\n", s, fileloc_unparse (fl), def, bool_unparse (defined)); } return (s); } /* ** needs to call lex by hand...yuk! ** ** modifies gc fileloc! */ /* ** there's gotta be a better way of doing this! */ static void pushString (/*@only@*/ cstring s) { static fileId mtid = fileId_invalid; long floc; if (s_macFile == NULL) { cstring fname; mtid = fileTable_addMacrosFile (context_fileTable ()); fname = fileTable_fileName (mtid); s_macFile = fileTable_createMacrosFile (context_fileTable (), fname); /* , "wb+"); ? **/ if (s_macFile == NULL) { llcontbug (message ("Cannot open tmp file %s needed to process macro: %s", fname, s)); cstring_free (s); return; } } llassert (s_macFile != NULL); /* SunOS, others? don't define SEEK_CUR and SEEK_SET */ # ifndef SEEK_CUR # define SEEK_CUR 1 # endif check (fseek (s_macFile, 0, SEEK_CUR) == 0); floc = ftell (s_macFile); if (cstring_length (s) > 0) { check (fputs (cstring_toCharsSafe (s), s_macFile) != EOF); } check (fputc ('\n', s_macFile) == (int) '\n'); # ifndef SEEK_SET # define SEEK_SET 0 # endif check (fseek (s_macFile, floc, SEEK_SET) == 0); yyin = s_macFile; (void) yyrestart (yyin); cstring_free (s); } static void macrocache_processMacro (macrocache m, int i) { fileloc fl = m->contents[i]->fl; m->contents[i]->defined = TRUE; if (!fileId_equal (currentFile (), fileloc_fileId (fl))) { g_currentloc = fileloc_update (g_currentloc, fl); context_enterMacroFile (); } else { setLine (fileloc_lineno (fl)); } beginLine (); DPRINTF (("Process macro: %s", m->contents[i]->def)); if (m->contents[i]->scomment) { pushString (message ("%s%s%s", cstring_fromChars (BEFORE_COMMENT_MARKER), m->contents[i]->def, cstring_fromChars (AFTER_COMMENT_MARKER))); (void) yyparse (); } else { bool insup = context_inSuppressRegion (); pushString (message ("%s %s", cstring_makeLiteralTemp (PPMRCODE), m->contents[i]->def)); (void) yyparse (); if (context_inSuppressRegion () && !insup) { voptgenerror (FLG_SYNTAX, message ("Macro ends in ignore region: %s", m->contents[i]->def), fl); } } incLine (); context_exitAllClauses (); context_exitMacroCache (); } extern void macrocache_processUndefinedElements (macrocache m) { fileloc lastfl = fileloc_undefined; int i; mcDisable = TRUE; DPRINTF (("Processing undefined elements")); if (!context_getFlag (FLG_PARTIAL)) { for (i = 0; i < m->entries; i++) { if (m->contents[i]->defined) { ; } else { fileloc fl = m->contents[i]->fl; if (fileloc_isDefined (lastfl) && fileloc_sameFile (fl, lastfl)) { ; } else { if (!fileloc_isLib (fl)) { displayScan (message ("checking macros %q", fileloc_outputFilename (fl))); } lastfl = fl; cleanupMessages (); } macrocache_processMacro (m, i); } } } mcDisable = FALSE; } extern /*@observer@*/ fileloc macrocache_processFileElements (macrocache m, cstring base) { fileloc lastfl = fileloc_undefined; int i; mcDisable = TRUE; for (i = 0; i < m->entries; i++) { if (m->contents[i]->defined) { ; } else { fileloc fl = m->contents[i]->fl; /* should be dependent! */ cstring fb = fileloc_getBase (fl); if (cstring_equal (fb, base)) { lastfl = fl; macrocache_processMacro (m, i); } } } mcDisable = FALSE; return lastfl; } void macrocache_finalize (void) { if (s_macFile != NULL) { check (fileTable_closeFile (context_fileTable (), s_macFile)); s_macFile = NULL; } } splint-3.1.2.dfsg1/src/qual.c0000644021234200000250000002050607630461221013344 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** qual.c ** ** representation of type qualifiers */ # include "splintMacros.nf" # include "basic.h" static qual qual_createPlainAux (int i) /*@*/ { qual res = (qual) dmalloc (sizeof (*res)); res->kind = (quenum) i; res->info = annotationInfo_undefined; sfreeEventually (res); /* stored in qtable */ return res; } static qual qtable[QU_LAST]; static bool isinit = FALSE; extern void qual_initMod (void) { int i = (int) QU_UNKNOWN; llassert (!isinit); while (i < (int) QU_LAST) { qtable[i] = qual_createPlainAux (i); i++; } isinit = TRUE; } static void qual_free (qual p_q) ; extern void qual_destroyMod (void) { if (isinit) { int i = (int) QU_UNKNOWN; isinit = FALSE; while (i < (int) QU_LAST) { qual_free (qtable[i]); i++; } } } static void qual_free (qual q) { llassert (!isinit); sfree (q); } extern qual qual_createPlain (quenum q) { llassert (isinit); llassert (q != QU_USERANNOT && q < QU_LAST); return qtable[(int) q]; } extern qual qual_createMetaState (annotationInfo info) { qual res; res = (qual) dmalloc (sizeof (*res)); res->kind = QU_USERANNOT; res->info = info; sfreeEventually (res); /* Memory leak */ return res; } static bool quenum_isValid (int q) { return ((quenum) q >= QU_UNKNOWN && ((quenum) q < QU_LAST)); } qual qual_fromInt (int q) { llassertprint (quenum_isValid (q), ("Invalid qual: %d", q)); return (qual_createPlain ((quenum) q)); } cstring qual_unparse (qual q) { if (q->kind == QU_USERANNOT) { return (annotationInfo_unparse (q->info)); } else { switch (q->kind) { case QU_UNKNOWN: return cstring_makeLiteralTemp ("unknown"); case QU_ABSTRACT: return cstring_makeLiteralTemp ("abstract"); case QU_NUMABSTRACT:return cstring_makeLiteralTemp ("numabstract"); case QU_CONCRETE: return cstring_makeLiteralTemp ("concrete"); case QU_MUTABLE: return cstring_makeLiteralTemp ("mutable"); case QU_IMMUTABLE: return cstring_makeLiteralTemp ("immutable"); case QU_SHORT: return cstring_makeLiteralTemp ("short"); case QU_LONG: return cstring_makeLiteralTemp ("long"); case QU_SIGNED: return cstring_makeLiteralTemp ("signed"); case QU_UNSIGNED: return cstring_makeLiteralTemp ("unsigned"); case QU_CONST: return cstring_makeLiteralTemp ("const"); case QU_RESTRICT: return cstring_makeLiteralTemp ("restrict"); case QU_VOLATILE: return cstring_makeLiteralTemp ("volatile"); case QU_INLINE: return cstring_makeLiteralTemp ("inline"); case QU_EXTERN: return cstring_makeLiteralTemp ("extern"); case QU_STATIC: return cstring_makeLiteralTemp ("static"); case QU_AUTO: return cstring_makeLiteralTemp ("auto"); case QU_REGISTER: return cstring_makeLiteralTemp ("register"); case QU_OUT: return cstring_makeLiteralTemp ("out"); case QU_IN: return cstring_makeLiteralTemp ("in"); case QU_RELDEF: return cstring_makeLiteralTemp ("reldef"); case QU_ONLY: return cstring_makeLiteralTemp ("only"); case QU_IMPONLY: return cstring_makeLiteralTemp ("only"); case QU_PARTIAL: return cstring_makeLiteralTemp ("partial"); case QU_SPECIAL: return cstring_makeLiteralTemp ("special"); case QU_KEEP: return cstring_makeLiteralTemp ("keep"); case QU_KEPT: return cstring_makeLiteralTemp ("kept"); case QU_YIELD: return cstring_makeLiteralTemp ("yield"); case QU_TEMP: return cstring_makeLiteralTemp ("temp"); case QU_SHARED: return cstring_makeLiteralTemp ("shared"); case QU_UNIQUE: return cstring_makeLiteralTemp ("unique"); case QU_UNCHECKED: return cstring_makeLiteralTemp ("unchecked"); case QU_CHECKED: return cstring_makeLiteralTemp ("checked"); case QU_CHECKMOD: return cstring_makeLiteralTemp ("checkmod"); case QU_CHECKEDSTRICT: return cstring_makeLiteralTemp ("checkedstrict"); case QU_TRUENULL: return cstring_makeLiteralTemp ("truenull"); case QU_FALSENULL: return cstring_makeLiteralTemp ("falsenull"); case QU_NULL: return cstring_makeLiteralTemp ("null"); case QU_ISNULL: return cstring_makeLiteralTemp ("isnull"); case QU_RELNULL: return cstring_makeLiteralTemp ("relnull"); case QU_NOTNULL: return cstring_makeLiteralTemp ("notnull"); case QU_NULLTERMINATED: return cstring_makeLiteralTemp ("nullterminated"); case QU_RETURNED: return cstring_makeLiteralTemp ("returned"); case QU_EXPOSED: return cstring_makeLiteralTemp ("exposed"); case QU_EXITS: return cstring_makeLiteralTemp ("noreturn"); case QU_MAYEXIT: return cstring_makeLiteralTemp ("maynotreturn"); case QU_UNUSED: return cstring_makeLiteralTemp ("unused"); case QU_EXTERNAL: return cstring_makeLiteralTemp ("external"); case QU_SEF: return cstring_makeLiteralTemp ("sef"); case QU_OBSERVER: return cstring_makeLiteralTemp ("observer"); case QU_REFCOUNTED: return cstring_makeLiteralTemp ("refcounted"); case QU_REFS: return cstring_makeLiteralTemp ("refs"); case QU_NEWREF: return cstring_makeLiteralTemp ("newref"); case QU_KILLREF: return cstring_makeLiteralTemp ("killref"); case QU_TEMPREF: return cstring_makeLiteralTemp ("tempref"); case QU_OWNED: return cstring_makeLiteralTemp ("owned"); case QU_DEPENDENT: return cstring_makeLiteralTemp ("dependent"); case QU_NEVEREXIT: return cstring_makeLiteralTemp ("alwaysreturns"); case QU_TRUEEXIT: return cstring_makeLiteralTemp ("noreturnwhentrue"); case QU_FALSEEXIT: return cstring_makeLiteralTemp ("noreturnwhenfalse"); case QU_UNDEF: return cstring_makeLiteralTemp ("undef"); case QU_KILLED: return cstring_makeLiteralTemp ("killed"); case QU_PRINTFLIKE: return cstring_makeLiteralTemp ("printflike"); case QU_SCANFLIKE: return cstring_makeLiteralTemp ("scanflike"); case QU_MESSAGELIKE:return cstring_makeLiteralTemp ("messagelike"); case QU_SETBUFFERSIZE: return cstring_makeLiteralTemp(""); case QU_LAST: return cstring_makeLiteralTemp ("< last >"); case QU_USERANNOT: return cstring_makeLiteralTemp (""); } } BADEXIT; } qual qual_abstractFromCodeChar (char c) { switch (c) { case '-': return qual_createUnknown (); case 'a': return qual_createAbstract (); case 'n': return qual_createNumAbstract (); case 'c': return qual_createConcrete (); BADDEFAULT; } } char qual_abstractCode (qual q) { switch (q->kind) { case QU_UNKNOWN: return '-'; case QU_ABSTRACT: return 'a'; case QU_NUMABSTRACT: return 'n'; case QU_CONCRETE: return 'c'; BADDEFAULT; } } extern bool qual_match (qual q1, qual q2) { if (q1->kind == q2->kind) { if (q1->kind == QU_USERANNOT) { return (annotationInfo_equal (q1->info, q2->info)); } else { return TRUE; } } return FALSE; } extern annotationInfo qual_getAnnotationInfo (qual q) { llassert (qual_isMetaState (q)); return q->info; } extern cstring qual_dump (qual q) { llassert (isinit); if (q->kind == QU_USERANNOT) { return message ("%d.%s", (int) q->kind, annotationInfo_dump (q->info)); } else { return message ("%d", (int) q->kind); } } extern qual qual_undump (char **s) { quenum q = (quenum) reader_getInt (s); llassert (isinit); if (q == QU_USERANNOT) { annotationInfo ai; reader_checkChar (s, '.'); ai = annotationInfo_undump (s); return qual_createMetaState (ai); } else { return qual_createPlain (q); } } splint-3.1.2.dfsg1/src/qtype.c0000644021234200000250000001217707630461221013551 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** qtype.c ** ** Qualified types: a type qualifier list, and a ctype. ** qtypes are mutable */ # include "splintMacros.nf" # include "basic.h" /*@notnull@*/ qtype qtype_create (ctype c) { qtype q = (qtype) dmalloc (sizeof (*q)); q->type = c; q->quals = qualList_new (); return q; } void qtype_free (/*@only@*/ qtype q) { if (qtype_isDefined (q)) { qualList_free (q->quals); sfree (q); } } qtype qtype_unknown () { return (qtype_create (ctype_unknown)); } qtype qtype_addQual (qtype qt, qual q) { DPRINTF (("Add qual: %s / %s", qtype_unparse (qt), qual_unparse (q))); if (qtype_isDefined (qt)) { qt->quals = qualList_add (qt->quals, q); } DPRINTF (("==> %s", qtype_unparse (qt))); return qt; } qtype qtype_addQualList (/*@returned@*/ qtype qt, qualList ql) { if (qtype_isDefined (qt)) { qt->quals = qualList_appendList (qt->quals, ql); } return qt; } static void checkAltQuals (qtype q) { if (qtype_isDefined (q)) { qualList badQuals = qualList_undefined; qualList_elements (q->quals, qu) { if (!qual_isCQual (qu) && !qual_isImplied (qu)) { badQuals = qualList_add (badQuals, qu); } } end_qualList_elements ; if (!qualList_isEmpty (badQuals)) { voptgenerror (FLG_SYNTAX, message ("Alternate type cannot use annotations %q: %q", qualList_unparse (badQuals), qtype_unparse (q)), g_currentloc); } } } qtype qtype_mergeImplicitAlt (/*@returned@*/ qtype q1, /*@only@*/ qtype q2) { if (qtype_isDefined (q1) && qtype_isDefined (q2)) { q1->type = ctype_makeConj (q1->type, q2->type); if (!qualList_isEmpty (q2->quals)) { checkAltQuals (q2); } } qtype_free (q2); return q1; } qtype qtype_mergeAlt (/*@returned@*/ qtype q1, /*@only@*/ qtype q2) { DPRINTF (("Merge alt: %s + %s", qtype_unparse (q1), qtype_unparse (q2))); if (qtype_isDefined (q1) && qtype_isDefined (q2)) { if (context_getFlag (FLG_IMPCONJ)) { q1->type = ctype_makeConj (q1->type, q2->type); } else { q1->type = ctype_makeExplicitConj (q1->type, q2->type); } if (!qualList_isEmpty (q2->quals)) { checkAltQuals (q2); } } qtype_free (q2); return q1; } qtype qtype_combine (/*@returned@*/ qtype q1, ctype ct) { DPRINTF (("Combine: %s %s", qtype_unparse (q1), ctype_unparse (ct))); if (qtype_isDefined (q1)) { /* ct is modifier (or q1->type is unknown) */ q1->type = ctype_combine (q1->type, ct); } DPRINTF (("Combine: %s %s", qtype_unparse (q1), ctype_unparse (ct))); return q1; } qtype qtype_resolve (/*@returned@*/ qtype q) { if (qtype_isDefined (q)) { DPRINTF (("Resolving: %s", qtype_unparse (q))); q->type = ctype_resolve (q->type); DPRINTF (("Resolving: %s", qtype_unparse (q))); } return q; } cstring qtype_unparse (qtype q) { if (qtype_isDefined (q)) { return (message ("%q%s", qualList_unparse (q->quals), ctype_unparse (q->type))); } else { return (cstring_makeLiteral ("")); } } qtype qtype_newBase (/*@returned@*/ qtype q, ctype ct) { if (qtype_isDefined (q)) { DPRINTF (("new base: %s -> %s", qtype_unparse (q), ctype_unparse (ct))); q->type = ctype_newBase (ct, q->type); DPRINTF (("new base: %s -> %s", qtype_unparse (q), ctype_unparse (ct))); } return q; } qtype qtype_newQbase (qtype q1, qtype q2) { if (qtype_isDefined (q1) && qtype_isDefined (q2)) { q1->type = ctype_newBase (q1->type, q2->type); q1->quals = qualList_appendList (q1->quals, q2->quals); } DPRINTF (("new base: %s -> %s", qtype_unparse (q1), qtype_unparse (q1))); return q1; } void qtype_adjustPointers (pointers n, qtype q) { if (qtype_isDefined (q)) { DPRINTF (("Pointers: %s %s", pointers_unparse (n), qtype_unparse (q))); q->type = ctype_adjustPointers (n, q->type); } pointers_free (n); } qtype qtype_copy (qtype q) { if (qtype_isDefined (q)) { qtype r = qtype_create (q->type); qualList_free (r->quals); r->quals = qualList_copy (q->quals); return r; } else { return qtype_undefined; } } splint-3.1.2.dfsg1/src/stateClause.c0000644021234200000250000004570007646432516014676 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** stateClause.c */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" static stateClause stateClause_createRaw (stateConstraint st, stateClauseKind sk, /*@only@*/ sRefSet s) { stateClause ret = (stateClause) dmalloc (sizeof (*ret)); ret->state = st; ret->kind = sk; ret->squal = qual_createUnknown (); ret->refs = s; ret->loc = fileloc_undefined; return ret; } /*drl added 3/7/2003*/ bool stateClause_hasEmptyReferences (stateClause s) { if (sRefSet_isUndefined(s->refs) ) return TRUE; else return FALSE; } bool stateClause_isMetaState (stateClause s) { if (qual_isMetaState (s->squal) ) return TRUE; else return FALSE; } /*end drl added*/ stateClause stateClause_create (lltok tok, qual q, sRefSet s) { stateClause ret = (stateClause) dmalloc (sizeof (*ret)); if (lltok_getTok (tok) == QPRECLAUSE) { ret->state = TK_BEFORE; } else if (lltok_getTok (tok) == QPOSTCLAUSE) { ret->state = TK_AFTER; } else { BADBRANCH; } ret->loc = fileloc_copy (lltok_getLoc (tok)); ret->squal = q; ret->refs = s; if (sRefSet_isDefined (s)) { ret->kind = SP_QUAL; } else { ret->kind = SP_GLOBAL; } return ret; } bool stateClause_isBeforeOnly (stateClause cl) { return (cl->state == TK_BEFORE); } bool stateClause_isBefore (stateClause cl) { return (cl->state == TK_BEFORE || cl->state == TK_BOTH); } bool stateClause_isAfter (stateClause cl) { return (cl->state == TK_AFTER || cl->state == TK_BOTH); } bool stateClause_isEnsures (stateClause cl) { return (cl->state == TK_AFTER); } bool stateClause_isQual (stateClause cl) { return (cl->kind == SP_QUAL); } bool stateClause_isMemoryAllocation (stateClause cl) { switch (cl->kind) { case SP_ALLOCATES: case SP_RELEASES: return TRUE; case SP_USES: case SP_DEFINES: case SP_SETS: return FALSE; case SP_GLOBAL: return FALSE; case SP_QUAL: return (qual_isMemoryAllocation (cl->squal) || qual_isSharing (cl->squal)); } BADEXIT; } /* ** An error is reported if the test is NOT true. */ # ifdef WIN32 /* Microsoft doesn't believe in higher order functions... */ # pragma warning( disable : 4550 ) # endif sRefTest stateClause_getPreTestFunction (stateClause cl) { switch (cl->kind) { case SP_USES: return sRef_isStrictReadable; case SP_ALLOCATES: return sRef_hasNoStorage; case SP_DEFINES: return sRef_hasNoStorage; case SP_SETS: return sRef_isNotUndefined; case SP_RELEASES: return sRef_isNotUndefined; case SP_GLOBAL: BADBRANCH; case SP_QUAL: { if (qual_isOnly (cl->squal)) { return sRef_isOnly; } else if (qual_isShared (cl->squal)) { return sRef_isShared; } else if (qual_isDependent (cl->squal)) { return sRef_isDependent; } else if (qual_isOwned (cl->squal)) { return sRef_isOwned; } else if (qual_isObserver (cl->squal)) { return sRef_isObserver; } else if (qual_isExposed (cl->squal)) { return sRef_isExposed; } else if (qual_isNotNull (cl->squal)) { return sRef_isNotNull; } else if (qual_isIsNull (cl->squal)) { return sRef_isDefinitelyNull; } else { BADBRANCH; } } } BADEXIT; } sRefTest stateClause_getPostTestFunction (stateClause cl) { llassert (stateClause_isAfter (cl)); switch (cl->kind) { case SP_USES: return NULL; case SP_ALLOCATES: return sRef_isAllocated; case SP_DEFINES: return sRef_isReallyDefined; case SP_SETS: return sRef_isReallyDefined; case SP_RELEASES: return sRef_isDeadStorage; case SP_GLOBAL: BADBRANCH; case SP_QUAL: if (qual_isOnly (cl->squal)) { return sRef_isOnly; } else if (qual_isShared (cl->squal)) { return sRef_isShared; } else if (qual_isDependent (cl->squal)) { return sRef_isDependent; } else if (qual_isOwned (cl->squal)) { return sRef_isOwned; } else if (qual_isObserver (cl->squal)) { return sRef_isObserver; } else if (qual_isExposed (cl->squal)) { return sRef_isExposed; } else if (qual_isNotNull (cl->squal)) { return sRef_isNotNull; } else if (qual_isIsNull (cl->squal)) { return sRef_isDefinitelyNull; } else { BADBRANCH; } } BADEXIT; } sRefShower stateClause_getPostTestShower (stateClause cl) { switch (cl->kind) { case SP_USES: case SP_ALLOCATES: return NULL; case SP_DEFINES: case SP_SETS: return sRef_showNotReallyDefined; case SP_RELEASES: return NULL; case SP_GLOBAL: BADBRANCH; case SP_QUAL: if (qual_isMemoryAllocation (cl->squal)) { return sRef_showAliasInfo; } else if (qual_isSharing (cl->squal)) { return sRef_showExpInfo; } else if (qual_isIsNull (cl->squal) || qual_isNotNull (cl->squal)) { return sRef_showNullInfo; } else { BADBRANCH; } } BADEXIT; } sRefMod stateClause_getEntryFunction (stateClause cl) { if (cl->state == TK_BEFORE || cl->state == TK_BOTH) { switch (cl->kind) { case SP_USES: return sRef_setDefinedComplete; case SP_ALLOCATES: return sRef_setUndefined; /* evans 2002-01-01 */ case SP_DEFINES: return sRef_setUndefined; /* evans 2002-01-01 */ case SP_SETS: return sRef_setAllocatedComplete; case SP_RELEASES: return sRef_setDefinedComplete; case SP_GLOBAL: BADBRANCH; case SP_QUAL: if (qual_isOnly (cl->squal)) { return sRef_setOnly; } else if (qual_isShared (cl->squal)) { return sRef_setShared; } else if (qual_isDependent (cl->squal)) { return sRef_setDependent; } else if (qual_isOwned (cl->squal)) { return sRef_setOwned; } else if (qual_isObserver (cl->squal)) { return sRef_setObserver; } else if (qual_isExposed (cl->squal)) { return sRef_setExposed; } else if (qual_isNotNull (cl->squal)) { return sRef_setNotNull; } else if (qual_isIsNull (cl->squal)) { return sRef_setDefNull; } else { DPRINTF (("Here we are: %s", qual_unparse (cl->squal))); BADBRANCH; } } BADBRANCH; } else { return NULL; } BADBRANCHNULL; } sRefMod stateClause_getEffectFunction (stateClause cl) { if (cl->state == TK_AFTER || cl->state == TK_BOTH) { switch (cl->kind) { case SP_USES: return NULL; case SP_ALLOCATES: return sRef_setAllocatedComplete; case SP_DEFINES: return sRef_setDefinedNCComplete; case SP_SETS: return sRef_setDefinedNCComplete; case SP_RELEASES: return sRef_killComplete; case SP_GLOBAL: BADBRANCH; case SP_QUAL: if (qual_isOnly (cl->squal)) { return sRef_setOnly; } else if (qual_isShared (cl->squal)) { return sRef_setShared; } else if (qual_isDependent (cl->squal)) { return sRef_setDependent; } else if (qual_isOwned (cl->squal)) { return sRef_setOwned; } else if (qual_isObserver (cl->squal)) { return sRef_setObserver; } else if (qual_isExposed (cl->squal)) { return sRef_setExposed; } else if (qual_isNotNull (cl->squal)) { return sRef_setNotNull; } else if (qual_isIsNull (cl->squal)) { return sRef_setDefNull; } else { BADBRANCH; } } BADBRANCH; } else { return NULL; } BADBRANCHNULL; } sRefMod stateClause_getReturnEffectFunction (stateClause cl) { if (cl->state == TK_AFTER || cl->state == TK_BOTH) { switch (cl->kind) { case SP_USES: case SP_ALLOCATES: case SP_DEFINES: case SP_SETS: case SP_RELEASES: return NULL; case SP_GLOBAL: BADBRANCH; case SP_QUAL: if (qual_isOnly (cl->squal)) { return sRef_killComplete; } else { return NULL; } } BADBRANCH; } else { return NULL; } BADBRANCHNULL; } static flagcode stateClause_qualErrorCode (stateClause cl) { if (qual_isOnly (cl->squal)) { return FLG_ONLYTRANS; } else if (qual_isShared (cl->squal)) { return FLG_SHAREDTRANS; } else if (qual_isDependent (cl->squal)) { return FLG_DEPENDENTTRANS; } else if (qual_isOwned (cl->squal)) { return FLG_OWNEDTRANS; } else if (qual_isObserver (cl->squal)) { return FLG_OBSERVERTRANS; } else if (qual_isExposed (cl->squal)) { return FLG_EXPOSETRANS; } else if (qual_isIsNull (cl->squal) || qual_isNotNull (cl->squal)) { return FLG_NULLSTATE; } else { BADBRANCH; } BADBRANCHRET (INVALID_FLAG); } flagcode stateClause_preErrorCode (stateClause cl) { llassert (cl->state == TK_BOTH || cl->state == TK_BEFORE); switch (cl->kind) { case SP_USES: return FLG_USEDEF; case SP_ALLOCATES: /*@fallthrough@*/ case SP_DEFINES: case SP_SETS: return FLG_MUSTFREEONLY; case SP_RELEASES: return FLG_USEDEF; case SP_GLOBAL: case SP_QUAL: return stateClause_qualErrorCode (cl); } BADBRANCHRET (INVALID_FLAG); } static /*@observer@*/ cstring stateClause_qualErrorString (stateClause cl, sRef sr) { if (qual_isMemoryAllocation (cl->squal)) { return alkind_capName (sRef_getAliasKind (sr)); } else if (qual_isObserver (cl->squal)) { return cstring_makeLiteralTemp ("Non-observer"); } else if (qual_isExposed (cl->squal)) { if (sRef_isObserver (sr)) { return cstring_makeLiteralTemp ("Observer"); } else { return cstring_makeLiteralTemp ("Non-exposed"); } } else if (qual_isNotNull (cl->squal)) { if (sRef_isDefinitelyNull (sr)) { return cstring_makeLiteralTemp ("Null"); } else { return cstring_makeLiteralTemp ("Possibly null"); } } else if (qual_isIsNull (cl->squal)) { return cstring_makeLiteralTemp ("Non-null"); } else { BADBRANCH; } BADBRANCHRET (cstring_undefined); } cstring stateClause_preErrorString (stateClause cl, sRef sr) { llassert (cl->state == TK_BOTH || cl->state == TK_BEFORE); switch (cl->kind) { case SP_USES: if (sRef_isDead (sr)) return cstring_makeLiteralTemp ("Dead"); else return cstring_makeLiteralTemp ("Undefined"); case SP_ALLOCATES: /*@fallthrough@*/ case SP_DEFINES: case SP_SETS: return cstring_makeLiteralTemp ("Allocated"); case SP_RELEASES: if (sRef_isDead (sr)) { return cstring_makeLiteralTemp ("Dead"); } else if (sRef_isDependent (sr) || sRef_isShared (sr)) { return alkind_unparse (sRef_getAliasKind (sr)); } else if (sRef_isObserver (sr) || sRef_isExposed (sr)) { return exkind_unparse (sRef_getExKind (sr)); } else { return cstring_makeLiteralTemp ("Undefined"); } case SP_GLOBAL: BADBRANCH; case SP_QUAL: return stateClause_qualErrorString (cl, sr); } BADEXIT; } flagcode stateClause_postErrorCode (stateClause cl) { llassert (cl->state == TK_BOTH || cl->state == TK_AFTER); switch (cl->kind) { case SP_USES: BADBRANCHCONT; return INVALID_FLAG; case SP_ALLOCATES: case SP_DEFINES: case SP_SETS: return FLG_COMPDEF; case SP_RELEASES: return FLG_MUSTFREEONLY; case SP_GLOBAL: BADBRANCH; case SP_QUAL: return stateClause_qualErrorCode (cl); } BADBRANCHRET (INVALID_FLAG); } cstring stateClause_postErrorString (stateClause cl, sRef sr) { llassert (cl->state == TK_BOTH || cl->state == TK_AFTER); switch (cl->kind) { case SP_USES: BADBRANCHCONT; return cstring_makeLiteralTemp (""); case SP_ALLOCATES: return cstring_makeLiteralTemp ("Unallocated"); case SP_DEFINES: case SP_SETS: return cstring_makeLiteralTemp ("Undefined"); case SP_RELEASES: return cstring_makeLiteralTemp ("Unreleased"); case SP_GLOBAL: BADBRANCH; case SP_QUAL: return stateClause_qualErrorString (cl, sr); } BADEXIT; } cstring stateClause_dump (stateClause s) { return (message ("%d.%d.%q.%q", (int) s->state, (int) s->kind, qual_dump (s->squal), sRefSet_dump (s->refs))); } stateClause stateClause_undump (char **s) { stateClause ret = (stateClause) dmalloc (sizeof (*ret)); ret->loc = fileloc_undefined; ret->state = (stateConstraint) reader_getInt (s); reader_checkChar (s, '.'); ret->kind = (stateClauseKind) reader_getInt (s); reader_checkChar (s, '.'); ret->squal = qual_undump (s); reader_checkChar (s, '.'); ret->refs = sRefSet_undump (s); return ret; } stateClause stateClause_copy (stateClause s) { stateClause ret = (stateClause) dmalloc (sizeof (*ret)); ret->state = s->state; ret->kind = s->kind; ret->squal = s->squal; ret->refs = sRefSet_newCopy (s->refs); ret->loc = fileloc_copy (s->loc); return ret; } bool stateClause_sameKind (stateClause s1, stateClause s2) { return (s1->state == s2->state && s1->kind == s2->kind && qual_match (s1->squal, s2->squal)); } void stateClause_free (stateClause s) { sRefSet_free (s->refs); fileloc_free (s->loc); sfree (s); } static /*@observer@*/ cstring stateClauseKind_unparse (stateClause s) { switch (s->kind) { case SP_USES: return cstring_makeLiteralTemp ("uses"); case SP_DEFINES: return cstring_makeLiteralTemp ("defines"); case SP_ALLOCATES: return cstring_makeLiteralTemp ("allocates"); case SP_RELEASES: return cstring_makeLiteralTemp ("releases"); case SP_SETS: return cstring_makeLiteralTemp ("sets"); case SP_GLOBAL: return qual_unparse (s->squal); case SP_QUAL: return qual_unparse (s->squal); } BADEXIT; } cstring stateClause_unparseKind (stateClause s) { return (message ("%s%s", cstring_makeLiteralTemp (s->state == TK_BEFORE ? "requires " : (s->state == TK_AFTER ? "ensures " : "")), stateClauseKind_unparse (s))); } cstring stateClause_unparse (stateClause s) { return (message ("%q %q", stateClause_unparseKind (s), sRefSet_unparsePlain (s->refs))); } stateClause stateClause_createDefines (sRefSet s) { return (stateClause_createRaw (TK_BOTH, SP_DEFINES, s)); } stateClause stateClause_createUses (sRefSet s) { return (stateClause_createRaw (TK_BOTH, SP_USES, s)); } stateClause stateClause_createSets (sRefSet s) { return (stateClause_createRaw (TK_BOTH, SP_SETS, s)); } stateClause stateClause_createReleases (sRefSet s) { return (stateClause_createRaw (TK_BOTH, SP_RELEASES, s)); } stateClause stateClause_createPlain (lltok tok, sRefSet s) { switch (lltok_getTok (tok)) { case QUSES: return stateClause_createUses (s); case QDEFINES: return stateClause_createDefines (s); case QALLOCATES: return stateClause_createAllocates (s); case QSETS: return stateClause_createSets (s); case QRELEASES: return stateClause_createReleases (s); default: sRefSet_free (s); BADBRANCH; } BADBRANCHRET (stateClause_createUses (sRefSet_undefined)); } stateClause stateClause_createAllocates (sRefSet s) { return (stateClause_createRaw (TK_BOTH, SP_ALLOCATES, s)); } bool stateClause_matchKind (stateClause s1, stateClause s2) { return (s1->state == s2->state && s1->kind == s2->kind && qual_match (s1->squal, s2->squal)); } bool stateClause_hasEnsures (stateClause cl) { return (cl->state == TK_AFTER && (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL)); } bool stateClause_hasRequires (stateClause cl) { return (cl->state == TK_BEFORE && (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL)); } bool stateClause_setsMetaState (stateClause cl) { return ((cl->kind == SP_QUAL || cl->kind == SP_GLOBAL) && qual_isMetaState (cl->squal)); } qual stateClause_getMetaQual (stateClause cl) { llassert (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL); return cl->squal; } static sRefModVal stateClause_getStateFunction (stateClause cl) { qual sq; llassert (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL); sq = cl->squal; /*@+enumint@*/ if (qual_isNullStateQual (sq)) { return (sRefModVal) sRef_setNullState; } else if (qual_isExQual (sq)) { return (sRefModVal) sRef_setExKind; } else if (qual_isAliasQual (sq)) { return (sRefModVal) sRef_setAliasKind; } else { DPRINTF (("Unhandled ensures qual: %s", qual_unparse (sq))); BADBRANCH; } /*@=enumint@*/ BADBRANCHRET (NULL); } int stateClause_getStateParameter (stateClause cl) { qual sq; llassert (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL); sq = cl->squal; /*@+enumint@*/ /* ** Since this can be many different types of state kinds, we need to allow all ** enum's to be returned as int. */ if (qual_isNotNull (sq)) { return NS_MNOTNULL; } else if (qual_isIsNull (sq)) { return NS_DEFNULL; } else if (qual_isNull (sq)) { return NS_POSNULL; } else if (qual_isRelNull (sq)) { return NS_RELNULL; } else if (qual_isExposed (sq)) { return XO_EXPOSED; } else if (qual_isObserver (sq)) { return XO_OBSERVER; } else if (qual_isAliasQual (sq)) { if (qual_isOnly (sq)) return AK_ONLY; if (qual_isImpOnly (sq)) return AK_IMPONLY; if (qual_isTemp (sq)) return AK_TEMP; if (qual_isOwned (sq)) return AK_OWNED; if (qual_isShared (sq)) return AK_SHARED; if (qual_isUnique (sq)) return AK_UNIQUE; if (qual_isDependent (sq)) return AK_DEPENDENT; if (qual_isKeep (sq)) return AK_KEEP; if (qual_isKept (sq)) return AK_KEPT; BADBRANCH; } else { DPRINTF (("Unhandled ensures qual: %s", qual_unparse (sq))); BADBRANCH; } /*@=enumint@*/ /*@=relaxtypes@*/ BADBRANCHRET (0); } sRefModVal stateClause_getEnsuresFunction (stateClause cl) { llassertprint (cl->state == TK_AFTER, ("Not after: %s", stateClause_unparse (cl))); llassert (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL); return stateClause_getStateFunction (cl); } sRefModVal stateClause_getRequiresBodyFunction (stateClause cl) { llassertprint (cl->state == TK_BEFORE, ("Not before: %s", stateClause_unparse (cl))); llassert (cl->kind == SP_QUAL || cl->kind == SP_GLOBAL); return stateClause_getStateFunction (cl); } /*@observer@*/ fileloc stateClause_loc (stateClause s) { return s->loc; } splint-3.1.2.dfsg1/src/stateClauseList.c0000644021234200000250000002570107651115036015520 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** stateClauseList.c */ # include "splintMacros.nf" # include "basic.h" static /*@notnull@*/ stateClauseList stateClauseList_new (void) { stateClauseList s = (stateClauseList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = stateClauseListBASESIZE; s->elements = (stateClause *) dmalloc (sizeof (*s->elements) * stateClauseListBASESIZE); return (s); } static void stateClauseList_grow (stateClauseList s) { int i; stateClause *newelements; llassert (stateClauseList_isDefined (s)); s->nspace += stateClauseListBASESIZE; newelements = (stateClause *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } stateClauseList stateClauseList_add (stateClauseList s, stateClause el) { DPRINTF (("Adding: %s", stateClause_unparse (el))); if (stateClauseList_isUndefined (s)) { s = stateClauseList_new (); } else { stateClauseList_elements (s, cl) { if (stateClause_sameKind (cl, el)) { voptgenerror (FLG_SYNTAX, message ("Multiple %q clauses for one function (ignoring second)", stateClause_unparseKind (cl)), g_currentloc); stateClause_free (el); return s; } } end_stateClauseList_elements ; } if (s->nspace <= 0) { stateClauseList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } cstring stateClauseList_unparse (stateClauseList s) { cstring st = cstring_undefined; int i; if (stateClauseList_isDefined (s)) { for (i = 0; i < stateClauseList_size (s); i++) { if (i == 0) { st = message ("%q;", stateClause_unparse (s->elements[i])); } else st = message ("%q %q;", st, stateClause_unparse (s->elements[i])); } } return (st); } stateClauseList stateClauseList_copy (stateClauseList s) { if (stateClauseList_isDefined (s)) { stateClauseList t = (stateClauseList) dmalloc (sizeof (*t)); int i; t->nelements = s->nelements; t->nspace = 0; if (s->nelements > 0) { t->elements = (stateClause *) dmalloc (sizeof (*t->elements) * t->nelements); for (i = 0; i < s->nelements; i++) { t->elements[i] = stateClause_copy (s->elements[i]); } } else { t->elements = NULL; } return t; } else { return stateClauseList_undefined; } } void stateClauseList_free (stateClauseList s) { if (!stateClauseList_isUndefined (s)) { int i; for (i = 0; i < s->nelements; i++) { stateClause_free (s->elements[i]); } sfree (s->elements); sfree (s); } } cstring stateClauseList_dump (stateClauseList s) { cstring st = cstring_undefined; if (stateClauseList_isUndefined (s)) return st; stateClauseList_elements (s, current) { st = message ("%q%q$", st, stateClause_dump (current)); } end_stateClauseList_elements; return st; } stateClauseList stateClauseList_undump (char **s) { char c; stateClauseList pn = stateClauseList_new (); int paramno = 0; c = **s; while (c != '#' && c != '@') { stateClause sc = stateClause_undump (s); pn = stateClauseList_add (pn, sc); reader_checkChar (s, '$'); c = **s; paramno++; } return pn; } int stateClauseList_compare (stateClauseList s1, stateClauseList s2) { if (stateClauseList_isUndefined (s1) && stateClauseList_isUndefined (s2)) { return 0; } else { if (s1 - s2 > 0) /* evans 2001-08-21: was (int) s1 > (int) s2) */ { return 1; } else { return -1; } } } static /*@exposed@*/ sRefSet stateClauseList_getClause (stateClauseList s, stateClause k) { stateClauseList_elements (s, el) { if (stateClause_matchKind (el, k)) { return stateClause_getRefs (el); } } end_stateClauseList_elements ; return sRefSet_undefined; } void stateClauseList_checkAll (uentry ue) { stateClauseList clauses = uentry_getStateClauseList (ue); sRef res = uentry_getSref (ue); bool specialResult = FALSE; DPRINTF (("Check state clauses: %s", uentry_unparseFull (ue))); stateClauseList_elements (clauses, cl) { bool isPre = stateClause_isBeforeOnly (cl); if (stateClause_isGlobal (cl)) { ; } else { sRefSet refs = stateClause_getRefs (cl); sRefSet_allElements (refs, el) { sRef rb = sRef_getRootBase (el); DPRINTF (("Check: %s", sRef_unparse (el))); if (sRef_isResult (rb)) { /* ** The result type is now know, need to set it: */ if (ctype_isUnknown (sRef_getType (rb))) { ctype utype = uentry_getType (ue); llassert (ctype_isFunction (utype)); sRef_setTypeFull (rb, ctype_getReturnType (utype)); DPRINTF (("el: %s", sRef_unparseFull (el))); } } if (stateClause_setsMetaState (cl)) { qual q = stateClause_getMetaQual (cl); annotationInfo qa = qual_getAnnotationInfo (q); if (!annotationInfo_matchesContextRef (qa, el)) { if (optgenerror (FLG_ANNOTATIONERROR, message ("Attribute annotation %s used on inappropriate reference %q in %q clause of %q: %q", qual_unparse (q), sRef_unparse (el), stateClause_unparseKind (cl), uentry_getName (ue), stateClause_unparse (cl)), uentry_whereLast (ue))) { /* annotationInfo_showContextError (ainfo, ue); */ } } } if (sRef_isResult (rb)) { if (isPre) { voptgenerror (FLG_INCONDEFS, message ("Function result is used in %q clause of %q " "(%q applies to the state before function is " "called, so should not use result): %q", stateClause_unparseKind (cl), uentry_getName (ue), stateClause_unparseKind (cl), sRef_unparse (el)), uentry_whereLast (ue)); } else { if (!sRef_isStateSpecial (res)) { DPRINTF (("Here we are: %s", sRef_unparseFull (res))); if (!specialResult) { sstate pstate = sRef_getDefState (res); if (!sRef_makeStateSpecial (res)) { if (optgenerror (FLG_INCONDEFS, message ("Function result is used in %q clause of %q " "but was previously annotated with %s: %q", stateClause_unparseKind (cl), uentry_getName (ue), sstate_unparse (pstate), sRef_unparse (el)), uentry_whereLast (ue))) { specialResult = TRUE; } } } } DPRINTF (("Fixing result type! %s", sRef_unparseFull (el))); (void) sRef_fixResultType (el, sRef_getType (res), ue); } } else if (sRef_isParam (rb)) { DPRINTF (("Make special: %s", sRef_unparseFull (rb))); if (!sRef_makeStateSpecial (rb)) { if (fileloc_isXHFile (uentry_whereLast (ue))) { ; /* Okay to override in .xh files */ } else if (stateClause_isQual (cl)) { ; /* qual clauses don't interfere with definition state */ } else { voptgenerror (FLG_INCONDEFS, message ("Reference %q used in %q clause of %q, " "but was previously annotated with %s: %q", sRef_unparse (rb), stateClause_unparseKind (cl), uentry_getName (ue), sstate_unparse (sRef_getDefState (res)), sRef_unparse (el)), uentry_whereLast (ue)); } } DPRINTF (("Made special: %s", sRef_unparseFull (rb))); } else if (sRef_isInvalid (rb)) { /*@innercontinue@*/ continue; } else { BADBRANCHCONT; /*@innercontinue@*/ continue; } if (stateClause_isMemoryAllocation (cl)) { if (!ctype_isVisiblySharable (sRef_getType (el))) { voptgenerror (FLG_ANNOTATIONERROR, /*@-sefparams@*/ /* This is okay because its fresh storage. */ message ("%q clauses includes %q of " "non-dynamically allocated type %s", cstring_capitalizeFree (stateClause_unparseKind (cl)), sRef_unparse (el), ctype_unparse (sRef_getType (el))), uentry_whereLast (ue)); /*@=sefparams@*/ } } } end_sRefSet_allElements ; } } end_stateClauseList_elements ; } void stateClauseList_checkEqual (uentry old, uentry unew) { stateClauseList oldClauses = uentry_getStateClauseList (old); stateClauseList newClauses = uentry_getStateClauseList (unew); if (stateClauseList_isDefined (newClauses)) { stateClauseList_elements (newClauses, cl) { if (stateClause_isGlobal (cl)) { ; } else { sRefSet sc = stateClauseList_getClause (oldClauses, cl); if (!sRefSet_equal (sc, stateClause_getRefs (cl))) { if (optgenerror (FLG_INCONDEFS, message ("Function %q %rdeclared with inconsistent %q clause: %q", uentry_getName (old), uentry_isDeclared (old), stateClause_unparseKind (cl), sRefSet_unparsePlain (stateClause_getRefs (cl))), g_currentloc)) { uentry_showWhereLastExtra (old, sRefSet_unparsePlain (sc)); } } } } end_stateClauseList_elements ; stateClauseList_elements (oldClauses, cl) { if (stateClause_isGlobal (cl)) { ; /* Don't handle globals for now */ } else { sRefSet sc = stateClauseList_getClause (newClauses, cl); if (sRefSet_isUndefined (sc) && !sRefSet_isEmpty (stateClause_getRefs (cl))) { if (optgenerror (FLG_INCONDEFS, message ("Function %q %rdeclared without %q clause (either " "use no special clauses in redeclaration, or " "they must match exactly: %q", uentry_getName (old), uentry_isDeclared (old), stateClause_unparseKind (cl), sRefSet_unparsePlain (stateClause_getRefs (cl))), g_currentloc)) { uentry_showWhereLastExtra (old, sRefSet_unparsePlain (sc)); } } } } end_stateClauseList_elements ; } } splint-3.1.2.dfsg1/src/ctype.c0000644021234200000250000015500507731476207013545 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** ctype.c ** ** This files implements three types: ctentry, cttable and ctype. ** They should probably be separated soon. */ # include "splintMacros.nf" # include "basic.h" # include "structNames.h" static void ctype_recordConj (ctype p_c); /* ** ctbase file */ # include "ctbase.i" /* ** ctype table */ # include "cttable.i" static ctype ctype_getConjA (ctype p_c) /*@*/ ; static ctype ctype_getConjB (ctype p_c) /*@*/ ; static bool ctype_isComplex (ctype c) { return (ctentry_isComplex (ctype_getCtentry (c))); } static bool ctype_isPlain (ctype c) { return (ctentry_isPlain (ctype_getCtentry (c))); } static bool ctype_isBroken (ctype c) { /*@+enumint@*/ if (c == CTK_DNE || c == CTK_INVALID || c == CTK_UNKNOWN) { /*@-enumint@*/ return TRUE; } else { ctentry cte = ctype_getCtentry (c); return (ctentry_isBogus (cte)); } } ctkind ctkind_fromInt (int i) { /*@+enumint@*/ if (i < CTK_UNKNOWN || i > CTK_COMPLEX) { llcontbug (message ("ctkind_fromInt: out of range: %d", i)); return CTK_INVALID; } return (ctkind) i; /*@=enumint@*/ } /* ** ctype functions */ void ctype_initTable () { cttable_init (); } void ctype_destroyMod () { cttable_reset (); } void ctype_loadTable (FILE *f) { DPRINTF (("Loading cttable!")); cttable_load (f); } void ctype_dumpTable (FILE *f) { DPRINTF (("Dumping cttable!")); cttable_dump (f); } cstring ctype_unparseTable () { return (cttable_unparse ()); } void ctype_printTable () { cttable_print (); } bool ctype_isUserBool (ctype ct) { if (ctype_isUA (ct)) { return (usymtab_isBoolType (ctype_typeId (ct))); } return (FALSE); } ctype ctype_createUser (typeId u) { /* requires: ctype_createUser (u) is never called more than once for any u. */ ctbase ct = ctbase_createUser (u); return (cttable_addFullSafe (ctentry_makeNew (CTK_PLAIN, ct))); } ctype ctype_createAbstract (typeId u) { /* requires: ctype_createAbstract (u) is never called more than once for any u. */ /* [ tested by cttable_addFullSafe, not really required ] */ return (cttable_addFullSafe (ctentry_makeNew (CTK_PLAIN, ctbase_createAbstract (u)))); } ctype ctype_createNumAbstract (typeId u) { /* requires: ctype_createAbstract (u) is never called more than once for any u. */ /* [ tested by cttable_addFullSafe, not really required ] */ return (cttable_addFullSafe (ctentry_makeNew (CTK_PLAIN, ctbase_createNumAbstract (u)))); } int ctype_count (void) { return (cttab.size); } ctype ctype_realType (ctype c) { ctype r = c; if (ctype_isElips (c) || ctype_isMissingParamsMarker (c)) { return c; } if (ctype_isUA (c)) { r = uentry_getRealType (usymtab_getTypeEntry (ctype_typeId (c))); } if (ctype_isManifestBool (r)) { if (context_canAccessBool ()) { r = context_boolImplementationType (); } } return r; } bool ctype_isSimple (ctype c) { return (! (ctype_isPointer (c) || ctype_isArray (c) || ctype_isFunction (c))); } ctype ctype_forceRealType (ctype c) { ctype r = c; if (ctype_isUA (c)) { r = uentry_getForceRealType (usymtab_getTypeEntry (ctype_typeId (c))); } return r; } ctype ctype_realishType (ctype c) { if (ctype_isUA (c)) { if (ctype_isManifestBool (c)) { return ctype_bool; } else { ctype r = uentry_getRealType (usymtab_getTypeEntry (ctype_typeId (c))); return (r); } } return c; } bool ctype_isUA (ctype c) { return (!ctype_isUnknown (c) && ctbase_isUA (ctype_getCtbase (c))); } bool ctype_isUser (ctype c) { return (!ctype_isUnknown (c) && ctbase_isUser (ctype_getCtbase (c))); } bool ctype_isAbstract (ctype c) { return (!ctype_isUnknown (c) && ((ctype_isPlain (c) && ctbase_isAbstract (ctype_getCtbaseSafe (c))) || (ctype_isConj (c) && (ctype_isAbstract (ctype_getConjA (c)) || ctype_isAbstract (ctype_getConjB (c)))))); } bool ctype_isNumAbstract (ctype c) { return (!ctype_isUnknown (c) && ((ctype_isPlain (c) && ctbase_isNumAbstract (ctype_getCtbaseSafe (c))) || (ctype_isConj (c) && (ctype_isNumAbstract (ctype_getConjA (c)) || ctype_isNumAbstract (ctype_getConjB (c)))))); } bool ctype_isImmutableAbstract (ctype t) { return (ctype_isAbstract (t) && !ctype_isMutable (t)); } bool ctype_isRealAbstract (ctype c) { return (ctype_isAbstract (ctype_realType (c)) || (ctype_isConj (c) && (ctype_isRealAbstract (ctype_getConjA (c)) || ctype_isRealAbstract (ctype_getConjB (c))))); } bool ctype_isRealNumAbstract (ctype c) { return (ctype_isNumAbstract (ctype_realType (c)) || (ctype_isConj (c) && (ctype_isRealNumAbstract (ctype_getConjA (c)) || ctype_isRealNumAbstract (ctype_getConjB (c))))); } /* ** primitive creators */ /* ** createPrim not necessary --- subsumed by ctype_int, etc. */ /* ** ctbase_unknown --- removed argument */ /* ** derived types: ** requires: if DerivedType (T) exists in cttable, then T->derivedType is it. */ ctype ctype_makePointer (ctype c) { if (c == ctype_char) { return ctype_string; } else if (c == ctype_void) { return ctype_voidPointer; } else { ctentry cte = ctype_getCtentry (c); ctype clp = ctentry_getPtr (cte); if /*@+enumint@*/ (clp == CTK_DNE) /*@=enumint@*/ { ctype cnew = cttable_addDerived (CTK_PTR, ctbase_makePointer (c), c); ctentry_setPtr (cte, cnew); return (cnew); } else { return clp; } } } ctype ctype_makeFixedArray (ctype c, size_t size) { ctype res; res = cttable_addDerived (CTK_ARRAY, ctbase_makeFixedArray (c, size), c); return res; } /* ** In C, array terms appear backwards: ** ** int a[5][7] ** ** declares an array of 5 elements, each of which is ** an array of 7 int's. ** ** We represent this as, ** ** array (array (int, 7), 5) ** ** Hence, the rightmost declaration is the innermost type. */ ctype ctype_makeInnerFixedArray (ctype c, size_t size) { ctype res; DPRINTF (("makeinnerfixed: %s / %d", ctype_unparse (c), size)); if (ctype_isFixedArray (c)) { ctype cb = ctype_baseArrayPtr (c); size_t osize = ctype_getArraySize (c); res = ctype_makeFixedArray (ctype_makeInnerFixedArray (cb, size), osize); DPRINTF (("res 1: %s", ctype_unparse (res))); } else if (ctype_isArray (c)) { ctype cb = ctype_baseArrayPtr (c); res = ctype_makeArray (ctype_makeInnerFixedArray (cb, size)); DPRINTF (("res 2: %s", ctype_unparse (res))); } else { res = ctype_makeFixedArray (c, size); DPRINTF (("res 3: %s", ctype_unparse (res))); } DPRINTF (("Make inner fixed array: %s / base: %s", ctype_unparse (res), ctype_unparse (ctype_baseArrayPtr (res)))); return res; } ctype ctype_makeInnerArray (ctype c) { ctype res; DPRINTF (("Make inner array: %s", ctype_unparse (c))); if (ctype_isFixedArray (c)) { ctype cb = ctype_baseArrayPtr (c); size_t osize = ctype_getArraySize (c); res = ctype_makeFixedArray (ctype_makeInnerArray (cb), osize); } else if (ctype_isArray (c)) { ctype cb = ctype_baseArrayPtr (c); res = ctype_makeArray (ctype_makeInnerArray (cb)); } else { res = ctype_makeArray (c); } DPRINTF (("Make inner array: %s", ctype_unparse (res))); return res; } ctype ctype_makeArray (ctype c) { ctentry cte = ctype_getCtentry (c); ctype clp = ctentry_getArray (cte); DPRINTF (("Make array: %s", ctype_unparse (c))); if /*@+enumint@*/ (clp == CTK_DNE) /*@=enumint@*/ { ctype cnew = cttable_addDerived (CTK_ARRAY, ctbase_makeArray (c), c); ctentry_setArray (cte, cnew); return (cnew); } else { return clp; } } /* ** requires c is a pointer of array */ ctype ctype_baseArrayPtr (ctype c) { ctentry cte = ctype_getCtentry (ctype_realType (c)); if (ctype_isConj (c)) { if (ctype_isAP (ctype_getConjA (c))) { if (ctype_isAP (ctype_getConjB (c))) { return (ctype_makeConj (ctype_baseArrayPtr (ctype_getConjA (c)), ctype_baseArrayPtr (ctype_getConjB (c)))); } else { return (ctype_baseArrayPtr (ctype_getConjA (c))); } } else { return (ctype_baseArrayPtr (ctype_getConjB (c))); } } else if (ctype_isInt (c)) /* could be NULL */ { return ctype_unknown; } else { ctype clp = ctentry_getBase (cte); if (ctype_isBroken (clp)) { llcontbug (message ("ctype_baseArrayPtr: bogus ctype getting base of: %s", ctype_unparse (c))); return ctype_unknown; } return clp; } } /* ** wchar_t * */ ctype ctype_makeWideString () { static ctype res = ctype_unknown; if (ctype_isUnknown (res)) { ctype wchart; if (usymtab_existsType (cstring_makeLiteralTemp ("wchar_t"))) { wchart = uentry_getAbstractType (usymtab_lookup (cstring_makeLiteralTemp ("wchar_t"))); } else { wchart = ctype_char; } res = ctype_makePointer (wchart); } return res; } bool ctype_isWideString (ctype c) { if (ctype_isPointer (c)) { ctype ct = ctype_baseArrayPtr (c); if (usymtab_existsType (cstring_makeLiteralTemp ("wchar_t"))) { return (ct == uentry_getAbstractType (usymtab_lookup (cstring_makeLiteralTemp ("wchar_t")))); } else { return FALSE; } } else { return FALSE; } } ctype ctype_getReturnType (ctype c) { if (ctype_isUnknown (c)) { return ctype_unknown; } return (ctbase_baseFunction (ctype_getCtbaseSafe (c))); } /* ** must be a shared pointer */ /*@observer@*/ uentryList ctype_argsFunction (ctype c) { if (ctype_isUnknown (c)) { return uentryList_undefined; } return (ctbase_argsFunction (ctype_getCtbaseSafe (c))); } /* ** Returns type with base type p and compound types from c. ** ** i.e., c = char *[]; p = int ** => int *[] */ ctype ctype_newBase (ctype c, ctype p) { return (ctbase_newBase (c, p)); } bool ctype_sameAltTypes (ctype c1, ctype c2) { ctype c1a, c2a; ctype c1b, c2b; llassert (ctype_isConj (c1) && ctype_isConj (c2)); c1a = ctype_getConjA (c1); c2a = ctype_getConjA (c2); c1b = ctype_getConjB (c1); c2b = ctype_getConjB (c2); if (ctype_compare (c1a, c2a) == 0) { if (ctype_compare (c1b, c2b) == 0) { return TRUE; } else { if (ctype_isConj (c1b) && ctype_isConj (c2b)) { return ctype_sameAltTypes (c1b, c2b); } else { return FALSE; } } } else { if (ctype_compare (c1a, c2b) == 0) { if (ctype_compare (c1b, c2a) == 0) { return TRUE; } else { if (ctype_isConj (c1b) && ctype_isConj (c2a)) { return ctype_sameAltTypes (c1b, c2a); } else { return FALSE; } } } else { return FALSE; } } } int ctype_compare (ctype c1, ctype c2) { ctentry ce1; ctentry ce2; if (ctype_isUnknown (c1)) { if (ctype_isUnknown (c2)) { return 0; } else { return 1; } } if (ctype_isUnknown (c2)) { return -1; } /* Can't get entries for special ctypes (elips marker) */ if (ctype_isElips (c1) || ctype_isElips (c2) || ctype_isMissingParamsMarker (c1) || ctype_isMissingParamsMarker (c2)) { return int_compare (c1, c2); } ce1 = ctype_getCtentry (c1); ce2 = ctype_getCtentry (c2); if (ctentry_isComplex (ce1)) { if (ctentry_isComplex (ce2)) { return (ctbase_compare (ctype_getCtbase (c1), ctype_getCtbase (c2), FALSE)); } else { return 1; } } else if (ctentry_isComplex (ce2)) { return -1; } else { return (int_compare (c1, c2)); } } /* ** complex types */ /* ** makeFunction: pointer to function returning base */ ctype ctype_makeParamsFunction (ctype base, /*@only@*/ uentryList p) { uentryList_fixImpParams (p); return (ctype_makeFunction (base, p)); } ctype ctype_makeNFParamsFunction (ctype base, /*@only@*/ uentryList p) { uentryList_fixImpParams (p); return (ctbase_makeNFFunction (base, p)); } ctype ctype_makeFunction (ctype base, /*@only@*/ uentryList p) { ctype ret; ret = ctbase_makeFunction (base, p); return (ret); } ctype ctype_expectFunction (ctype c) { /* handle parenthesized declarations */ if (!ctype_isAP (c)) { c = ctype_makePointer (c); } return (cttable_addComplex (ctbase_expectFunction (c))); } ctype ctype_dontExpectFunction (ctype c) { ctbase ctb = ctype_getCtbase (c); /* what about this? if (!ctype_isAP (c)) { c = ctype_makePointer (c); } */ return (ctbase_getExpectFunction (ctb)); } /* ** makeRealFunction: function returning base */ ctype ctype_makeRawFunction (ctype base, uentryList p) { return (cttable_addComplex (ctbase_makeLiveFunction (base, p))); } /* ** plain predicates */ /*** **** this is very poorly defined **** **** need to unify function/function pointer meaning ***/ bool ctype_isFunction (ctype c) { if (ctype_isKnown (c) && ctype_isDefined (c)) { return (ctbase_isFunction (ctype_getCtbase (c))); } else { return FALSE; } } bool ctype_isExpFcn (ctype c) { return (ctype_isKnown (c) && ctbase_isExpFcn (ctype_getCtbase (c))); } bool ctype_isVoid (ctype c) { return (c == CTX_VOID); } bool ctype_isArbitraryIntegral (ctype c) { ctype cr = ctype_realType (c); return (cr == ctype_anyintegral || cr == ctype_unsignedintegral || cr == ctype_signedintegral); } bool ctype_isUnsignedIntegral (ctype c) { ctype cr = ctype_realType (c); return (cr == ctype_unsignedintegral); } bool ctype_isSignedIntegral (ctype c) { ctype cr = ctype_realType (c); return (cr == ctype_signedintegral); } bool ctype_isInt (ctype c) { cprim cp = ctype_toCprim (c); return (c == ctype_unknown || cprim_isAnyInt (cp) || (cprim_isAnyChar (cp) && context_msgCharInt ()) || (c == ctype_bool && context_msgBoolInt ()) || (ctype_isEnum (c) && context_msgEnumInt ())); } bool ctype_isRegularInt (ctype c) { cprim cp = ctype_toCprim (c); return (c == ctype_unknown || cprim_closeEnough (cprim_int, cp) || (cprim_isAnyChar (cp) && context_msgCharInt ()) || (c == ctype_bool && context_msgBoolInt ()) || (ctype_isEnum (c) && context_msgEnumInt ())); } bool ctype_isString (ctype c) { return (c == ctype_string || (ctype_isPointer (c) && ctype_isChar (ctype_baseArrayPtr (c)))); } bool ctype_isChar (ctype c) { return ((c == ctype_unknown) || (cprim_isAnyChar (ctype_toCprim (c))) || (context_getFlag (FLG_CHARINT) && ctype_isInt (c))); } bool ctype_isUnsignedChar (ctype c) { return ((c == ctype_unknown) || (cprim_isUnsignedChar (ctype_toCprim (c)))); } bool ctype_isSignedChar (ctype c) { return ((c == ctype_unknown) || (cprim_isSignedChar (ctype_toCprim (c)))); } /* ** Returns true if c matches the name -booltype */ bool ctype_isManifestBool (ctype c) { /* ** Changed the meaning of ctype_isBool - evs 2000-07-24 ** The old meaning was very convoluted! ** ** c is a bool if: ** c == CTX_BOOL - its a direct bool ** c is a user/abstract type matching the bool name ** (should never occur?) */ if (ctype_isDirectBool (c)) { return TRUE; } else if (ctype_isUA (c)) { return ctype_isUserBool (c); } else { return FALSE; } } bool ctype_isBool (ctype c) { /* ** Changed the meaning of ctype_isBool - evs 2000-07-24 ** The old meaning was very convoluted! ** ** c is a bool if: ** its a manifest bool ** +boolint and ctype_isInt (c) */ if (ctype_isManifestBool (c)) { return TRUE; } else if (context_msgBoolInt ()) { return ctype_isInt (c); } else { return FALSE; } # if 0 if (context_getFlag (FLG_ABSTRACTBOOL)) { if (typeId_isInvalid (boolType)) { boolType = usymtab_getTypeId (context_getBoolName ()); } if (context_hasAccess (boolType)) { return (((c == CTX_UNKNOWN) || (c == CTX_BOOL) || (context_msgBoolInt () && (c == CTX_INT || (c == CTX_CHAR && context_msgCharInt ())))) || ctype_isInt (c)); } } return ((c == CTX_UNKNOWN) || (c == CTX_BOOL) || (context_msgBoolInt () && (c == CTX_INT || (c == CTX_CHAR && context_msgCharInt ())))); # endif } bool ctype_isDirectBool (ctype c) { return (c == CTX_BOOL); } bool ctype_isReal (ctype c) { return (cprim_isAnyReal (ctype_toCprim (c))); } bool ctype_isFloat (ctype c) { return (c == ctype_float); } bool ctype_isDouble (ctype c) { return (c == ctype_double || c == ctype_ldouble); } bool ctype_isSigned (ctype c) { return (!ctype_isUnsigned (c)); } bool ctype_isNumeric (ctype c) { return (ctype_isInt (c) || ctype_isReal (c) || ctype_isEnum (c) /* evans 2001-10-05: added this: */ || ctype_isArbitraryIntegral (c)); } /* ** real predicates ** ** work on actual type in current context */ bool ctype_isRealNumeric (ctype c) { if (ctype_isPlain (c)) return (ctype_isNumeric (ctype_realType (c))); if (ctype_isConj (c)) return (ctype_isRealNumeric (ctype_getConjA (c)) || ctype_isRealNumeric (ctype_getConjB (c))); else return FALSE; } bool ctype_isRealInt (ctype c) { if (ctype_isPlain (c)) return (ctype_isInt (ctype_realType (c))); else if (ctype_isConj (c)) return (ctype_isRealInt (ctype_getConjA (c)) || ctype_isRealInt (ctype_getConjB (c))); else { if (ctype_isEnum (c) && context_msgEnumInt ()) return TRUE; return FALSE; } } bool ctype_isRealVoid (ctype c) { if (ctype_isPlain (c)) { return (ctype_isVoid (ctype_realType (c))); } else if (ctype_isConj (c)) { return (ctype_isRealVoid (ctype_getConjA (c)) || ctype_isRealVoid (ctype_getConjB (c))); } else { return FALSE; } } bool ctype_isRealBool (ctype c) { if (ctype_isPlain (c)) { return (ctype_isBool (ctype_realishType (c))); } else if (ctype_isConj (c)) { return (ctype_isRealBool (ctype_getConjA (c)) || ctype_isRealBool (ctype_getConjB (c))); } else { return FALSE; } } bool ctype_isRealPointer (ctype c) { if (ctype_isConj (c)) return (ctype_isRealPointer (ctype_getConjA (c)) || ctype_isRealPointer (ctype_getConjB (c))); return (ctype_isPointer (ctype_realType (c))); } bool ctype_isRealSU (ctype c) { if (ctype_isConj (c)) { return (ctype_isRealSU (ctype_getConjA (c)) || ctype_isRealSU (ctype_getConjB (c))); } DPRINTF (("Real su: %s / %s", ctype_unparse (c), ctype_unparse (ctype_realType (c)))); return (ctype_isStructorUnion (ctype_realType (c))); } bool ctype_isRealArray (ctype c) { if (ctype_isConj (c)) return (ctype_isRealArray (ctype_getConjA (c)) || ctype_isRealArray (ctype_getConjB (c))); return (ctype_isArray (ctype_realType (c))); } bool ctype_isRealAP (ctype c) { if (ctype_isConj (c)) return (ctype_isRealAP (ctype_getConjA (c)) || ctype_isRealAP (ctype_getConjB (c))); return (ctype_isAP (ctype_realType (c))); } bool ctype_isRealFunction (ctype c) { if (ctype_isConj (c)) return (ctype_isRealFunction (ctype_getConjA (c)) || ctype_isRealFunction (ctype_getConjB (c))); return (ctype_isFunction (ctype_realType (c))); } bool ctype_isDirectInt (ctype c) { return (c == CTX_INT || c == CTX_UINT || c == CTX_SINT || c == CTX_ULINT || c == CTX_USINT); } /* ** forceful predicates ** ** take *ctype; if its a conjunct, and there is a match replace with match only. ** if both match, still conjunct */ static bool ctype_isForcePred (ctype * c, bool (pred) (ctype)) { /*drl bee: pbr */ if (ctype_isConj (*c)) { ctype cbr = ctype_getConjA (*c); if ((*pred) (cbr)) { if ((*pred) (ctype_getConjB (*c))) { ; } else { *c = cbr; } return TRUE; } else { if ((*pred) (cbr = ctype_getConjB (*c))) { *c = cbr; return TRUE; } } } return ((*pred) (*c)); } bool ctype_isForceRealNumeric (ctype * c) { return (ctype_isForcePred (c, ctype_isRealNumeric)); } bool ctype_isForceRealInt (ctype * c) { return (ctype_isForcePred (c, ctype_isRealInt)); } bool ctype_isForceRealBool (ctype * c) { return (ctype_isForcePred (c, ctype_isRealBool)); } /* ** conjuncts ** ** save int/char, int/bool, other random conjuncts */ static ctype ctype_makeConjAux (ctype c1, ctype c2, bool isExplicit) { if (ctype_isBogus (c1) || ctype_isUndefined (c1)) { return c2; } else if (ctype_isBogus (c2) || ctype_isUndefined (c2)) { return c1; } else { if (isExplicit) { return (ctype_makeExplicitConj (c1, c2)); } else { return (ctype_makeConj (c1, c2)); } } } ctype ctype_makeExplicitConj (ctype c1, ctype c2) { if (ctype_isAnytype (c1) || ctype_isAnytype (c2)) { return ctype_makeAnytype (); } else if (ctype_isFunction (c1) && !ctype_isFunction (c2)) { ctype ret = ctype_makeExplicitConj (ctype_getReturnType (c1), c2); return ctype_makeFunction (ret, uentryList_copy (ctype_getParams (c1))); } else if (ctype_isFunction (c2) && !ctype_isFunction (c1)) { ctype ret = ctype_makeExplicitConj (c1, ctype_getReturnType (c2)); return ctype_makeFunction (ret, uentryList_copy (ctype_getParams (c2))); } else { return (cttable_addComplex (ctbase_makeConj (c1, c2, TRUE))); } } static ctype ic = ctype_unknown; /* int | char */ static ctype ib = ctype_unknown; /* int | bool */ static ctype ifl = ctype_unknown; /* int | float */ static ctype ibf = ctype_unknown; /* int | bool | float */ static ctype ibc = ctype_unknown; /* int | bool | char */ static ctype iv = ctype_unknown; /* int | void * */ static ctype ivf = ctype_unknown; /* int | void * | float */ static ctype ivb = ctype_unknown; /* int | void * | bool */ static ctype ivbf = ctype_unknown; /* int | void * | bool | float */ static ctype cuc = ctype_unknown; /* char | unsigned char */ static ctype cany = ctype_unknown; ctype ctype_makeAnytype () { if (cany == ctype_unknown) { cany = ctype_makeConj (ctype_unknown, ctype_dne); llassert (ctype_isAnytype (cany)); } DPRINTF (("make anytype: %s", ctype_unparse (cany))); return cany; } bool ctype_isAnytype (ctype c) { return (c == cany); } static void ctype_recordConj (ctype c) { ctype c1, c2; llassert (ctype_isConj (c)); c1 = ctype_getConjA (c); c2 = ctype_getConjB (c); /* No, can't swap! if (c2 == ctype_int && c1 != ctype_int) { ctype tmp; tmp = c1; c1 = c2; c2 = tmp; } */ if (c1 == ctype_int) { if (c2 == ctype_char) { llassert (ic == ctype_unknown); ic = c; } else if (c2 == ctype_bool) { llassert (ib == ctype_unknown); ib = c; } else if (c2 == ctype_float) { llassert (ifl == ctype_unknown); ifl = c; } else if (c2 == CTP_VOID) { llassert (iv == ctype_unknown); iv = c; } else { /* not special */ } } else if (c1 == ib && ib != ctype_unknown) { if (c2 == ctype_float) { llassert (ibf == ctype_unknown); ibf = c; } else if (c2 == ctype_char) { llassert (ibc == ctype_unknown); ibc = c; } else { /* not special */ } } else if (c1 == iv) { if (c2 == ctype_bool) { llassert (ivb == ctype_unknown); ivb = c; } else if (c2 == ctype_float) { llassert (ivf == ctype_unknown); ivf = c; } else { /* not special */ } } else if (c1 == ivf) { if (c2 == ctype_bool) { llassert (ivbf == ctype_unknown); ivbf = c; } } else if (c1 == ivb) { if (c2 == ctype_float) { llassert (ivbf == ctype_unknown); ivbf = c; } } else if (c1 == ctype_char) { if (c2 == ctype_uchar) { llassert (cuc == ctype_unknown); cuc = c; } } else { /* not special */ } } ctype ctype_makeConj (ctype c1, ctype c2) { /* no: can have unsigned long @alt long@: llassert (c1 != c2); */ DPRINTF (("Make conj: %s / %s", ctype_unparse (c1), ctype_unparse (c2))); if (ctype_isAnytype (c1)) { return c1; } else if (ctype_isAnytype (c2)) { return c2; } else if (ctype_isUnknown (c1)) { return c2; } else if (ctype_isUnknown (c2)) { return c1; } else if (ctype_isFunction (c1) && !ctype_isFunction (c2)) { ctype ret = ctype_makeConj (ctype_getReturnType (c1), c2); return ctype_makeFunction (ret, uentryList_copy (ctype_getParams (c1))); } else if (ctype_isFunction (c2) && !ctype_isFunction (c1)) { ctype ret = ctype_makeConj (c1, ctype_getReturnType (c2)); return ctype_makeFunction (ret, uentryList_copy (ctype_getParams (c2))); } else { if (ctype_isManifestBool (c1)) { c1 = ctype_bool; } if (ctype_isManifestBool (c2)) { c2 = ctype_bool; } if (ctbase_isVoidPointer (ctype_getCtbaseSafe (c1))) { c1 = ctype_voidPointer; } if (ctbase_isVoidPointer (ctype_getCtbaseSafe (c2))) { c2 = ctype_voidPointer; } /* ** Ouch, can't do this. unsigned, etc. modifiers might ** apply to wrong type! ** ** if (c2 == ctype_int && c1 != ctype_int) ** { ** ctype tmp; ** ** tmp = c1; ** c1 = c2; ** c2 = tmp; ** } ** */ if (c1 == ctype_int) { if (c2 == ctype_char) { if (ic == ctype_unknown) { ic = cttable_addComplex (ctbase_makeConj (ctype_int, ctype_char, FALSE)); } return ic; } else if (c2 == ctype_bool) { if (ib == ctype_unknown) { ib = cttable_addComplex (ctbase_makeConj (ctype_int, ctype_bool, FALSE)); } return ib; } else if (c2 == ctype_float) { if (ifl == ctype_unknown) { ifl = cttable_addComplex (ctbase_makeConj (ctype_int, ctype_float, FALSE)); } return ifl; } else { if (c2 == ctype_voidPointer) { if (iv == ctype_unknown) { iv = cttable_addComplex (ctbase_makeConj (ctype_int, ctype_voidPointer, FALSE)); } return iv; } } } else if (c1 == ib && ib != ctype_unknown) { if (c2 == ctype_float) { if (ibf == ctype_unknown) { ibf = cttable_addComplex (ctbase_makeConj (ib, ctype_float, FALSE)); } return ibf; } else if (c2 == ctype_char) { if (ibc == ctype_unknown) { ibc = cttable_addComplex (ctbase_makeConj (ib, ctype_char, FALSE)); } return ibc; } else { ; } } else if (c1 == iv) { if (c2 == ctype_bool) { if (ivb == ctype_unknown) { ivb = cttable_addComplex (ctbase_makeConj (c1, c2, FALSE)); } return ivb; } else if (c2 == ctype_float) { if (ivf == ctype_unknown) { ivf = cttable_addComplex (ctbase_makeConj (c1, c2, FALSE)); } return ivf; } else { ; } } else if (c1 == ivf) { if (c2 == ctype_bool) { if (ivbf == ctype_unknown) { ivbf = cttable_addComplex (ctbase_makeConj (c1, c2, FALSE)); } return ivbf; } } else if (c1 == ivb) { if (c2 == ctype_float) { if (ivbf == ctype_unknown) { ivbf = cttable_addComplex (ctbase_makeConj (c1, c2, FALSE)); } return ivbf; } } else if (c1 == ctype_char) { if (c2 == ctype_uchar) { if (cuc == ctype_unknown) { cuc = cttable_addComplex (ctbase_makeConj (c1, c2, FALSE)); } return cuc; } } else { ; } return (cttable_addComplex (ctbase_makeConj (c1, c2, FALSE))); } } bool ctype_isConj (ctype c) { return (ctype_isComplex (c) && ctbase_isConj (ctype_getCtbase (c))); } static ctype ctype_getConjA (ctype c) { if (!ctype_isConj (c)) llbuglit ("ctype_getConjA: not a conj"); return (ctbase_getConjA (ctype_getCtbaseSafe (c))); } static ctype ctype_getConjB (ctype c) { if (!ctype_isConj (c)) llbuglit ("ctype_getConjB: not a conj"); return (ctbase_getConjB (ctype_getCtbaseSafe (c))); } static bool ctype_isExplicitConj (ctype c) { return (ctype_isConj (c) && ctbase_isExplicitConj (ctype_getCtbaseSafe (c))); } /** << need to fix resolveConj >> **/ /* ** structs and unions */ ctype ctype_createStruct (/*@only@*/ cstring n, /*@only@*/ uentryList f) { ctype ct; DPRINTF (("Creating a struct: %s / %s", n, uentryList_unparse (f))); ct = cttable_addComplex (ctbase_createStruct (n, f)); DPRINTF (("ct: %s", ctype_unparse (ct))); return (ct); } uentryList ctype_getFields (ctype c) { return (ctbase_getuentryList (ctype_getCtbaseSafe (c))); } ctype ctype_createUnion (/*@only@*/ cstring n, /*@only@*/ uentryList f) { ctype ret; ret = cttable_addComplex (ctbase_createUnion (n, f)); return ret; } /* ** matching ** ** if ctype's are same, definite match. ** else, need to call ctbase_match. ** ** if necessary context can memoize matches */ static bool quickMatch (ctype c1, ctype c2) { if (c1 == c2) return TRUE; return FALSE; } bool ctype_genMatch (ctype c1, ctype c2, bool force, bool arg, bool def, bool deep) { bool match; DPRINTF (("Gen match: %s / %s arg: %s", ctype_unparse (c1), ctype_unparse (c2), bool_unparse (arg))); if (quickMatch (c1, c2)) { return TRUE; } if (ctype_isElips (c1) || ctype_isElips (c2)) { return FALSE; } else { match = ctbase_genMatch (ctype_getCtbase (c1), ctype_getCtbase (c2), force, arg, def, deep); return (match); } } bool ctype_sameName (ctype c1, ctype c2) { if (quickMatch (c1, c2)) return TRUE; else return (cstring_equal (ctype_unparse (c1), ctype_unparse (c2))); } bool ctype_almostEqual (ctype c1, ctype c2) { if (ctype_equal (c1, c2)) { return TRUE; } else { if (ctype_isUnknown (c1)) { return ctype_isUnknown (c2); } else if (ctype_isUnknown (c2)) { return FALSE; } else { return (ctbase_almostEqual (ctype_getCtbase (c1), ctype_getCtbase (c2))); } } } bool ctype_matchDef (ctype c1, ctype c2) { DPRINTF (("Match def: %s / %s", ctype_unparse (c1), ctype_unparse (c2))); if (quickMatch (c1, c2)) return TRUE; if (ctype_isElips (c1)) return (ctype_isElips (c2) || ctype_isUnknown (c2)); if (ctype_isElips (c2)) { return (ctype_isUnknown (c2)); } else { bool oldrelax = context_getFlag (FLG_RELAXQUALS); bool res; context_setFlagTemp (FLG_RELAXQUALS, FALSE); res = ctbase_matchDef (ctype_getCtbase (c1), ctype_getCtbase (c2)); context_setFlagTemp (FLG_RELAXQUALS, oldrelax); return res; } } bool ctype_match (ctype c1, ctype c2) { if (quickMatch (c1, c2)) return TRUE; if (ctype_isElips (c1)) return (ctype_isElips (c2) || ctype_isUnknown (c2)); if (ctype_isElips (c2)) return (ctype_isUnknown (c2)); return (ctbase_match (ctype_getCtbase (c1), ctype_getCtbase (c2))); } bool ctype_forceMatch (ctype c1, ctype c2) { if (quickMatch (c1, c2)) return TRUE; if (ctype_isElips (c1)) return (ctype_isElips (c2)); if (ctype_isElips (c2)) return FALSE; /*@-modobserver@*/ /* The call forceMatch may modify the observer params, but, we don't care. */ return (ctbase_forceMatch (ctype_getCtbase (c1), ctype_getCtbase (c2))); /*@=modobserver@*/ } bool ctype_matchArg (ctype c1, ctype c2) { if (quickMatch (c1, c2)) { return TRUE; } else { return (ctbase_matchArg (ctype_getCtbase (c1), ctype_getCtbase (c2))); } } /* ** simple ctype_is operations. ** DO NOT use real type of c, only direct type. */ /* ** ctype_isVoidPointer ** ** void * */ bool ctype_isVoidPointer (ctype c) { if (ctype_isComplex (c)) { return ctbase_isVoidPointer (ctype_getCtbaseSafe (c)); } if (ctype_isConj (c)) { return (ctype_isVoidPointer (ctype_getConjA (c)) || ctype_isVoidPointer (ctype_getConjB (c))); } else { return (c == ctype_voidPointer || (ctype_isRealPointer (c) && ctype_isVoid (ctype_baseArrayPtr (c)))); } } /* ** ctype_isPointer ** ** true for C and LCL pointers */ bool ctype_isPointer (ctype c) { if (ctype_isElips (c)) return FALSE; if (ctype_isComplex (c)) { ctbase ctb = ctype_getCtbaseSafe (c); bool res = ctbase_isPointer (ctb); return res; } else { bool res = ctentry_isPointer (ctype_getCtentry (c)); return res; } } /* ** ctype_isArray ** ** true for C and LCL array's */ bool ctype_isArray (ctype c) { if (ctype_isElips (c)) return FALSE; if (ctype_isComplex (c)) return (ctbase_isEitherArray (ctype_getCtbaseSafe (c))); else return (ctentry_isArray (ctype_getCtentry (c))); } bool ctype_isIncompleteArray (ctype c) { if (ctype_isArray (c)) { if (ctype_isFixedArray (c)) { return ctype_isIncompleteArray (ctype_baseArrayPtr (c)); } else { return TRUE; } } return FALSE; } bool ctype_isArrayPtr (ctype c) { return ((ctype_isArray (c)) || (ctype_isPointer (c))); } typeId ctype_typeId (ctype c) { return (ctbase_typeId (ctype_getCtbase (c))); } cstring ctype_unparseDeclaration (ctype c, /*@only@*/ cstring name) { llassert (!(ctype_isElips (c) || ctype_isMissingParamsMarker (c))); if (ctype_isUnknown (c)) { return message ("? %q", name); } else { return (ctbase_unparseDeclaration (ctype_getCtbase (c), name)); } } cstring ctype_unparse (ctype c) { if (ctype_isElips (c)) { return cstring_makeLiteralTemp ("..."); } else if (ctype_isMissingParamsMarker (c)) { return cstring_makeLiteralTemp ("-"); } else if (ctype_isAnytype (c)) { return cstring_makeLiteralTemp (""); } else if (ctype_isUnknown (c)) { return cstring_makeLiteralTemp ("?"); } else { /*@-modobserver@*/ return (ctentry_doUnparse (ctype_getCtentry (c))); /*@=modobserver@*/ } } cstring ctype_unparseSafe (ctype c) { if (ctype_isElips (c)) { return cstring_makeLiteralTemp ("..."); } else if (ctype_isMissingParamsMarker (c)) { return cstring_makeLiteralTemp ("-"); } else { cstring ret; if /*@+enumint@*/ (c >= CTK_PLAIN && c < cttab.size) /*@=enumint@*/ { ctentry cte = ctype_getCtentry (c); if (cstring_isDefined (cte->unparse)) { return (cte->unparse); } } ret = message ("[%d]", (int) c); cstring_markOwned (ret); return ret; } } cstring ctype_unparseDeep (ctype c) { if (ctype_isElips (c)) { return cstring_makeLiteralTemp ("..."); } if (ctype_isMissingParamsMarker (c)) { return cstring_makeLiteralTemp ("-"); } return (ctentry_doUnparseDeep (ctype_getCtentry (c))); } ctype ctype_undump (char **c) { return ((ctype) reader_getInt (c)); /* check its valid? */ } cstring ctype_dump (ctype c) { DPRINTF (("Ctype dump: %s", ctype_unparse (c))); if (c < 0) { /* Handle invalid types in a kludgey way. */ return (message ("0")); } if (ctype_isUA (c)) { cstring tname = usymtab_getTypeEntryName (usymtab_convertTypeId (ctype_typeId (c))); if (cstring_equal (tname, context_getBoolName ())) { cstring_free (tname); return (message ("%d", ctype_bool)); } cstring_free (tname); } DPRINTF (("Returning: %d", c)); return (message ("%d", c)); } ctype ctype_getBaseType (ctype c) { ctentry cte = ctype_getCtentry (c); switch (ctentry_getKind (cte)) { case CTK_UNKNOWN: case CTK_INVALID: case CTK_PLAIN: return c; case CTK_PTR: case CTK_ARRAY: return (ctype_getBaseType (ctype_baseArrayPtr (c))); case CTK_COMPLEX: { ctbase ctb = cte->ctbase; if (ctbase_isDefined (ctb)) { /*@access ctbase@*/ switch (ctb->type) { case CT_UNKNOWN: case CT_PRIM: case CT_USER: case CT_ENUM: case CT_ENUMLIST: case CT_BOOL: case CT_ABST: case CT_NUMABST: case CT_FCN: case CT_STRUCT: case CT_UNION: case CT_EXPFCN: return c; case CT_PTR: case CT_ARRAY: return (ctype_getBaseType (ctb->contents.base)); case CT_FIXEDARRAY: return (ctype_getBaseType (ctb->contents.farray->base)); case CT_CONJ: /* base type of A conj branch? */ return (ctype_getBaseType (ctb->contents.conj->a)); } /*@noaccess ctbase@*/ } else { return c; } } default: llbuglit ("ctype_newBase: bad case"); } llcontbuglit ("ctype_getBaseType: unreachable code"); return ((ctype)NULL); } ctype ctype_adjustPointers (pointers p, ctype c) { int np = pointers_depth (p); if (ctype_isFunction (c)) { c = ctype_makeParamsFunction (ctype_adjustPointers (p, ctype_getReturnType (c)), uentryList_copy (ctype_argsFunction (c))); } else { /* fix this should not use getBaseType ??? */ ctype cb = ctype_getBaseType (c); while (np > 0) { cb = ctype_makePointer (cb); np--; } c = ctype_newBase (c, cb); } return (c); } enumNameList ctype_elist (ctype c) { return (ctbase_elist (ctype_getCtbase (c))); } bool ctype_isFirstVoid (ctype c) { return (c == CTX_VOID || (ctype_isConj (c) && ctype_isFirstVoid (ctype_getConjA (c)))); } ctype ctype_createEnum (/*@keep@*/ cstring tag, /*@keep@*/ enumNameList el) { return (cttable_addComplex (ctbase_createEnum (tag, el))); } bool ctype_isEnum (ctype c) { return (ctype_isComplex (c) && ctbase_isEnum (ctype_getCtbase (c))); } cstring ctype_enumTag (ctype c) { llassert (ctype_isEnum (c)); return (ctbase_enumTag (ctype_getCtbaseSafe (c))); } bool ctype_isStruct (ctype c) { return (ctype_isComplex (c) && ctbase_isStruct (ctype_getCtbaseSafe (c))); } bool ctype_isUnion (ctype c) { return (ctype_isComplex (c) && ctbase_isUnion (ctype_getCtbaseSafe (c))); } ctype ctype_resolveNumerics (ctype c1, ctype c2) { /* ** returns longest type of c1 and c2 */ if (c1 == c2) return c1; c1 = ctype_realType (c1); c2 = ctype_realType (c2); if (ctype_isEnum (c1)) c1 = ctype_unknown; if (ctype_isEnum (c2)) c2 = ctype_int; if (c1 == ctype_ldouble || c2 == ctype_ldouble) return ctype_ldouble; /* 2001-06-08: This fix provided by Jim Zelenka. */ if (c1 == ctype_llint || c2 == ctype_llint) return ctype_llint; if (c1 == ctype_ullint || c2 == ctype_ullint) return ctype_ullint; if (c1 == ctype_ulint || c2 == ctype_ulint) return ctype_ulint; if (c1 == ctype_lint || c2 == ctype_lint) return ctype_lint; if (c1 == ctype_uint || c2 == ctype_uint) return ctype_uint; if (c1 == ctype_int || c2 == ctype_int) return ctype_int; /* 2001-06-08: This fix provided by Jim Zelenka. */ if (c1 == ctype_usint || c2 == ctype_usint) return ctype_usint; if (c1 == ctype_sint || c2 == ctype_sint) return ctype_sint; if (c1 == ctype_uchar || c2 == ctype_uchar) return ctype_uchar; if (c1 == ctype_char || c2 == ctype_char) return ctype_char; if (ctype_isKnown (c1)) return c1; else return c2; } bool ctype_isStructorUnion (ctype c) { return (ctype_isStruct (c) || ctype_isUnion (c)); } ctype ctype_fixArrayPtr (ctype c) { if (ctype_isArray (c)) { return (ctype_makePointer (ctype_baseArrayPtr (c))); } else return c; } /* ** createUnnamedStruct/Union ** ** check if it corresponds to an existing LCL-specified unnamed struct ** otherwise, give it a new tag */ ctype ctype_createUnnamedStruct (/*@only@*/ uentryList f) { ctype ret = usymtab_structFieldsType (f); DPRINTF (("unnamed struct: %s", ctype_unparse (ret))); if (ctype_isDefined (ret)) { uentryList_free (f); return ret; } else { cstring ft = fakeTag (); ctype ct = ctype_createStruct (cstring_copy (ft), f); uentry ue = uentry_makeStructTagLoc (ft, ct); DPRINTF (("Unnamed struct: %s", uentry_unparseFull (ue))); ue = usymtab_supGlobalEntryReturn (ue); DPRINTF (("After Unnamed struct: %s", uentry_unparseFull (ue))); cstring_free (ft); return (ct); } } ctype ctype_createUnnamedUnion (/*@only@*/ uentryList f) { ctype ret = usymtab_unionFieldsType (f); if (ctype_isDefined (ret)) { uentryList_free (f); return ret; } else { cstring ft = fakeTag (); ctype ct = ctype_createUnion (cstring_copy (ft), f); uentry ue = uentry_makeUnionTagLoc (ft, ct); usymtab_supGlobalEntry (ue); cstring_free (ft); return (ct); } } bool ctype_isUnnamedSU (ctype c) { if (ctype_isSU (c)) { return ctbase_isUnnamedSU (ctype_getCtbase (c)); } else { return FALSE; } } ctype ctype_createForwardStruct (cstring n) { uentry ue = uentry_makeStructTag (n, ctype_unknown, fileloc_undefined); ctype ct = usymtab_supForwardTypeEntry (ue); cstring_free (n); return (ct); } ctype ctype_createForwardUnion (cstring n) { uentry ue = uentry_makeUnionTag (n, ctype_unknown, fileloc_undefined); ctype ct = usymtab_supForwardTypeEntry (ue); cstring_free (n); return (ct); } ctype ctype_createForwardEnum (cstring n) { uentry ue = uentry_makeEnumTag (n, ctype_unknown, fileloc_undefined); ctype ct = usymtab_supForwardTypeEntry (ue); cstring_free (n); return (ct); } ctype ctype_removePointers (ctype c) { ctype oldc; while (ctype_isKnown (c) && ctype_isArrayPtr (c)) { oldc = c; c = ctype_baseArrayPtr (c); llassert (c != oldc); } return (c); } bool ctype_isMutable (ctype t) { if (ctype_isUA (t)) { return (uentry_isMutableDatatype (usymtab_getTypeEntry (ctype_typeId (t)))); } else { return (ctype_isPointer (ctype_realType (t))); /*!! || ctype_isStructorUnion (ctype_realType (t))); */ } } bool ctype_isRefCounted (ctype t) { if (ctype_isUA (t)) { return (uentry_isRefCountedDatatype (usymtab_getTypeEntry (ctype_typeId (t)))); } return FALSE; } bool ctype_isVisiblySharable (ctype t) { if (ctype_isUnknown (t)) { return TRUE; } if (ctype_isConj (t)) { return (ctype_isVisiblySharable (ctype_getConjA (t)) || ctype_isVisiblySharable (ctype_getConjB (t))); } if (ctype_isMutable (t)) { if (ctype_isUA (t)) { ctype rt = ctype_realType (t); if (rt == t) { if (ctype_isNumAbstract (t)) { return FALSE; } else { return TRUE; } } else { return ctype_isVisiblySharable (rt); } } else { return TRUE; } } return FALSE; } # if 0 /* Replaced by ctype_isMutable (more sensible) */ bool ctype_canAlias (ctype ct) { /* can ct refer to memory locations? ** ==> a pointer or a mutable abstract type ** arrays? */ ctype tr = ctype_realType (ct); return (ctype_isPointer (tr) || ctype_isMutable (ct) || ctype_isStructorUnion (tr)); } # endif /* ** c1 is the dominant type; c2 is the modifier type ** ** eg. double + long int => long double */ ctype ctype_combine (ctype dominant, ctype modifier) { DPRINTF (("Combine: %s + %s", ctype_unparse (dominant), ctype_unparse (modifier))); if (ctype_isConj (dominant)) { ctype res; if (ctype_isExplicitConj (dominant)) { res = ctype_makeExplicitConj (ctype_combine (ctype_getConjA (dominant), modifier), ctype_getConjB (dominant)); } else { res = ctype_makeConj (ctype_combine (ctype_getConjA (dominant), modifier), ctype_getConjB (dominant)); } return res; } if (ctype_isUnknown (modifier)) { return dominant; } else if (ctype_isUnknown (dominant)) { return modifier; } else { if (ctype_isEnum (dominant)) dominant = ctype_int; if (ctype_isEnum (modifier)) modifier = ctype_int; if (modifier == ctype_uint) { if (dominant == ctype_int) return ctype_uint; if (dominant == ctype_lint) return ctype_ulint; if (dominant == ctype_sint) return ctype_usint; if (dominant == ctype_char) return ctype_uchar; /* evs 2000-07-28: added this line */ if (dominant == ctype_llint) return ctype_ullint; if ((dominant == ctype_uint) || dominant == ctype_uchar) { voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate unsigned qualifier"), g_currentloc); return ctype_uint; } else { voptgenerror (FLG_DUPLICATEQUALS, message ("Type qualifier unsigned used with %s", ctype_unparse (dominant)), g_currentloc); return dominant; } } else if (modifier == ctype_llint) { if (dominant == ctype_int) { return ctype_llint; } voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate long qualifier on non-int"), g_currentloc); } else if (modifier == ctype_lint) { if (dominant == ctype_int) return ctype_lint; if (dominant == ctype_uint) return ctype_ulint; if (dominant == ctype_double) return ctype_ldouble; if (dominant == ctype_lint || dominant == ctype_ulint || dominant == ctype_sint || dominant == ctype_usint || dominant == ctype_ldouble) { if (dominant == ctype_lint) { /* long long not supported by ANSI */ return ctype_llint; } /* ++jimz */ if (dominant == ctype_ulint) { /* unsigned long long not supported by ANSI */ return ctype_ullint; } /* ==jimz */ if (dominant == ctype_sint || dominant == ctype_usint) { if (!context_getFlag (FLG_IGNOREQUALS)) { llerrorlit (FLG_SYNTAX, "Contradictory long and short type qualifiers"); } } else { voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate long qualifier"), g_currentloc); } return ctype_lint; } } else if (modifier == ctype_sint) { if (dominant == ctype_int) return ctype_sint; if (dominant == ctype_uint) return ctype_usint; if (dominant == ctype_sint || dominant == ctype_usint) { voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate short qualifier"), g_currentloc); return ctype_uint; } else if (dominant == ctype_lint) { if (!context_getFlag (FLG_IGNOREQUALS)) { llerrorlit (FLG_SYNTAX, "Contradictory long and short type qualifiers"); } return dominant; } /* ++jimz */ else if (dominant == ctype_llint) { if (!context_getFlag (FLG_IGNOREQUALS)) { llerrorlit (FLG_SYNTAX, "Contradictory long long and short type qualifiers"); } return dominant; } /* ==jimz */ else { if (!context_getFlag (FLG_IGNOREQUALS)) { llerror (FLG_SYNTAX, message ("Type qualifier short used with %s", ctype_unparse (dominant))); } return dominant; } } else if (modifier == ctype_ulint) { if (dominant == ctype_int) return modifier; if (dominant == ctype_lint || dominant == ctype_ulint) { voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate long qualifier"), g_currentloc); return modifier; } if (dominant == ctype_uint || dominant == ctype_usint) { voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate unsigned qualifier"), g_currentloc); return modifier; } if (dominant == ctype_sint || dominant == ctype_usint) { if (!context_getFlag (FLG_IGNOREQUALS)) { llerrorlit (FLG_SYNTAX, "Contradictory long and short type qualifiers"); } return dominant; } if (!context_getFlag (FLG_IGNOREQUALS)) { llerror (FLG_SYNTAX, message ("Type qualifiers unsigned long used with %s", ctype_unparse (dominant))); } return dominant; } else if (modifier == ctype_usint) { if (dominant == ctype_int) return modifier; if (dominant == ctype_sint || dominant == ctype_usint) { voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate short qualifier"), g_currentloc); return modifier; } if (dominant == ctype_uint) { voptgenerror (FLG_DUPLICATEQUALS, message ("Duplicate unsigned qualifier"), g_currentloc); return modifier; } if (dominant == ctype_lint || dominant == ctype_ulint || dominant == ctype_llint) { if (!context_getFlag (FLG_IGNOREQUALS)) { llerrorlit (FLG_SYNTAX, "Contradictory long and short type qualifiers"); } return dominant; } if (!context_getFlag (FLG_IGNOREQUALS)) { llerror (FLG_SYNTAX, message ("Type qualifiers unsigned short used with %s", ctype_unparse (dominant))); } return dominant; } else { ; } return dominant; } } ctype ctype_resolve (ctype c) { if (ctype_isUnknown (c) && !ctype_isAnytype (c)) { DPRINTF (("Resolving to int: %s", ctype_unparse (c))); return ctype_int; } return c; } ctype ctype_fromQual (qual q) { if (qual_isSigned (q)) return ctype_int; if (qual_isUnsigned (q)) return ctype_uint; if (qual_isLong (q)) return ctype_lint; if (qual_isShort (q)) return ctype_sint; llcontbug (message ("ctype_fromQual: invalid qualifier: %s", qual_unparse (q))); return ctype_unknown; } bool ctype_isAnyFloat (ctype c) { return (cprim_isAnyReal (ctype_toCprim (c))); } bool ctype_isUnsigned (ctype c) { if (ctype_isConj (c)) return (ctype_isUnsigned (ctype_getConjA (c)) || ctype_isUnsigned (ctype_getConjB (c))); return (c == ctype_uint || c == ctype_uchar || c == ctype_usint || c == ctype_ulint || c == ctype_ullint || c == ctype_unsignedintegral); } /* ++jimz */ static bool ctype_isLongLong (ctype c) { if (ctype_isConj (c)) return (ctype_isLongLong (ctype_getConjA (c)) || ctype_isLongLong (ctype_getConjB (c))); return (c == ctype_llint || c == ctype_ullint); } /* ==jimz */ static bool ctype_isLong (ctype c) { if (ctype_isConj (c)) return (ctype_isLong (ctype_getConjA (c)) || ctype_isLong (ctype_getConjB (c))); return (c == ctype_lint || c == ctype_ulint); } static bool ctype_isShort (ctype c) { if (ctype_isConj (c)) return (ctype_isShort (ctype_getConjA (c)) || ctype_isShort (ctype_getConjB (c))); return (c == ctype_sint || c == ctype_usint); } bool ctype_isStackAllocated (ctype c) { ctype ct = ctype_realType (c); if (ctype_isConj (ct)) return (ctype_isStackAllocated (ctype_getConjA (ct)) || ctype_isStackAllocated (ctype_getConjB (ct))); return (ctype_isArray (c) || ctype_isSU (c)); } static bool ctype_isMoreUnsigned (ctype c1, ctype c2) { return (ctype_isUnsigned (c1) && !ctype_isUnsigned (c2)); } static bool ctype_isLonger (ctype c1, ctype c2) { /* 2001-06-10: Fix for long long's provided by Jim Zelenka */ return ((ctype_isDouble (c1) && !ctype_isDouble (c2)) || (ctype_isLongLong (c1) && !ctype_isLongLong (c2)) || (ctype_isLong (c1) && (!ctype_isLong (c2)) && (!ctype_isLongLong (c2))) || (ctype_isShort (c2) && !ctype_isShort (c1))); } ctype ctype_widest (ctype c1, ctype c2) { if (ctype_isMoreUnsigned (c2, c1) || ctype_isLonger (c2, c1)) { return c2; } else { return c1; } } static /*@observer@*/ ctbase ctype_getCtbase (ctype c) { /*@+enumint@*/ if (c >= 0 && c < cttab.size) { return (cttab.entries[c]->ctbase); } else { if (c == ctype_unknown) llbuglit ("ctype_getCtbase: ctype unknown"); if (c == ctype_undefined) llbuglit ("ctype_getCtbase: ctype undefined"); if (c == ctype_dne) llbuglit ("ctype_getCtbase: ctype dne"); if (c == ctype_elipsMarker) llbuglit ("ctype_getCtbase: elips marker"); llfatalbug (message ("ctype_getCtbase: ctype out of range: %d", c)); BADEXIT; } /*@=enumint@*/ } static /*@notnull@*/ /*@observer@*/ ctbase ctype_getCtbaseSafe (ctype c) { ctbase res = ctype_getCtbase (c); llassert (ctbase_isDefined (res)); return res; } /* ** ctentry */ static ctentry ctype_getCtentry (ctype c) { static /*@only@*/ ctentry errorEntry = NULL; if (cttab.size == 0) { if (errorEntry == NULL) { errorEntry = ctentry_makeNew (CTK_UNKNOWN, ctbase_undefined); } return errorEntry; } /*@+enumint@*/ if (c >= CTK_PLAIN && c < cttab.size) { return (cttab.entries[c]); } else if (c == CTK_UNKNOWN) llcontbuglit ("ctype_getCtentry: ctype unknown"); else if (c == CTK_INVALID) llcontbuglit ("ctype_getCtentry: ctype invalid (ctype_undefined)"); else if (c == CTK_DNE) llcontbuglit ("ctype_getCtentry: ctype dne"); else if (c == CTK_ELIPS) llcontbuglit ("ctype_getCtentry: ctype elipsis"); else if (c == CTK_MISSINGPARAMS) llcontbuglit ("ctype_getCtentry: ctype missing params"); else llbug (message ("ctype_getCtentry: ctype out of range: %d", c)); return (cttab.entries[ctype_unknown]); /*@=enumint@*/ } bool ctype_isFixedArray (ctype c) { if (ctype_isElips (c)) return FALSE; return (ctbase_isFixedArray (ctype_getCtbaseSafe (c))); } /*drl 11/28/2000 */ /* requires that the type is an fixed array */ /* return the size of the array */ size_t ctype_getArraySize (ctype c) { size_t size; ctbase ctb; llassert (ctype_isFixedArray (c)); ctb = ctype_getCtbaseSafe(c); size = ctbase_getArraySize (ctb); DPRINTF ((message ("ctype_getArraySize: got fixed array size of %s / %d ", ctype_unparse (c), (int) size))); return size; } ctype ctype_biggerType (ctype c1, ctype c2) { if (ctbase_isBigger (ctype_getCtbaseSafe (c2), ctype_getCtbaseSafe (c1))) { return c2; } else { return c1; } } int ctype_getSize (ctype c) { return ctbase_getSize (ctype_getCtbaseSafe (ctype_realType (c))); } splint-3.1.2.dfsg1/src/cvar.c0000644021234200000250000000205307630461220013331 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cvar.c */ # include "splintMacros.nf" # include "basic.h" # include "cvar.h" splint-3.1.2.dfsg1/src/clabstract.c0000644021234200000250000015363007671271602014540 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** clabstract.c ** ** ASTs for C grammar ** */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "usymtab_interface.h" # include "structNames.h" # include "nameChecks.h" # include "cscannerHelp.h" # ifdef SANITIZER # include "sgrammar_tokens.h" # else # include "cgrammar_tokens.h" # endif /* ** Lots of variables are needed because of interactions with the ** parser. This is easier than restructuring the grammar so the ** right values are available in the right place. */ /*drl*/ static /*@only@*/ constraintList implicitFcnConstraints = NULL; static void clabstract_prepareFunction (uentry p_e) /*@modifies p_e@*/ ; static bool fcnNoGlobals = FALSE; static void processVariable (/*@temp@*/ idDecl p_t) /*@modifies internalState@*/ ; static bool s_processingVars = FALSE; static bool s_processingParams = FALSE; static bool s_processingGlobals = FALSE; static bool s_processingTypedef = FALSE; static bool s_processingIterVars = FALSE; static /*@only@*/ qtype processingType = qtype_undefined; static uentry currentIter = uentry_undefined; static /*@dependent@*/ uentryList saveParamList; /* for old style functions */ static /*@owned@*/ uentry saveFunction = uentry_undefined; static int saveIterParamNo; static idDecl fixStructDecl (/*@returned@*/ idDecl p_d); static void checkTypeDecl (uentry p_e, ctype p_rep); static /*@dependent@*/ fileloc saveStoreLoc = fileloc_undefined; static storageClassCode storageClass = SCNONE; static void declareEnumList (/*@temp@*/ enumNameList p_el, ctype p_c, fileloc p_loc); static void resetGlobals (void); static /*@null@*/ qual specialFunctionCode; static bool argsUsed = FALSE; extern void clabstract_initMod () { specialFunctionCode = qual_createUnknown (); DPRINTF (("Initialized: %s", qual_unparse (specialFunctionCode))); } static bool hasSpecialCode (void) { return (!qual_isUnknown (specialFunctionCode)); } extern void setArgsUsed (void) { if (argsUsed) { voptgenerror (FLG_SYNTAX, cstring_makeLiteral ("Multiple ARGSUSED comments for one function"), g_currentloc); } argsUsed = TRUE; } static void reflectArgsUsed (uentry ue) { if (argsUsed) { if (uentry_isFunction (ue)) { uentryList params = uentry_getParams (ue); uentryList_elements (params, el) { uentry_setUsed (el, fileloc_undefined); } end_uentryList_elements ; } argsUsed = FALSE; } } extern void setSpecialFunction (qual qu) { if (!qual_isUnknown (specialFunctionCode)) { voptgenerror (FLG_SYNTAX, message ("Multiple special function codes: %s, %s " "(first code is ignored)", qual_unparse (specialFunctionCode), qual_unparse (qu)), g_currentloc); } specialFunctionCode = qu; } static void reflectSpecialCode (uentry ue) { if (qual_isUnknown (specialFunctionCode)) { ; } else if (qual_isPrintfLike (specialFunctionCode)) { uentry_setPrintfLike (ue); } else if (qual_isScanfLike (specialFunctionCode)) { uentry_setScanfLike (ue); } else if (qual_isMessageLike (specialFunctionCode)) { uentry_setMessageLike (ue); } else { BADBRANCH; } specialFunctionCode = qual_createUnknown (); } static void resetStorageClass (void) { qtype_free (processingType); processingType = qtype_undefined; storageClass = SCNONE; } static void reflectStorageClass (uentry u) { if (storageClass == SCSTATIC) { uentry_setStatic (u); } else if (storageClass == SCEXTERN) { uentry_setExtern (u); } else { ; /* no storage class */ } } void storeLoc () { saveStoreLoc = g_currentloc; } void setFunctionNoGlobals (void) { fcnNoGlobals = TRUE; } static void reflectGlobalQualifiers (sRef sr, qualList quals) { DPRINTF (("Reflect global qualifiers: %s / %s", sRef_unparseFull (sr), qualList_unparse (quals))); qualList_elements (quals, qel) { if (qual_isGlobalQual (qel)) /* undef, killed */ { sstate oldstate = sRef_getDefState (sr); sstate defstate = sstate_fromQual (qel); if ((oldstate == SS_UNDEFGLOB && defstate == SS_KILLED) || (oldstate == SS_KILLED && defstate == SS_UNDEFGLOB)) { defstate = SS_UNDEFKILLED; } else { ; /* any errors? */ } sRef_setDefState (sr, defstate, fileloc_undefined); DPRINTF (("State: %s", sRef_unparseFull (sr))); } else if (qual_isAllocQual (qel)) /* out, partial, reldef, etc. */ { ctype realType = sRef_getType (sr); sstate defstate = sstate_fromQual (qel); if (qual_isRelDef (qel)) { ; /* okay anywhere */ } else { if (!ctype_isAP (realType) && !ctype_isSU (realType) && !ctype_isUnknown (realType) && !ctype_isAbstract (sRef_getType (sr))) { llerror (FLG_SYNTAX, message ("Qualifier %s used on non-pointer or struct: %q", qual_unparse (qel), sRef_unparse (sr))); } } sRef_setDefState (sr, defstate, fileloc_undefined); } else if (qual_isNull (qel)) { sRef_setNullState (sr, NS_POSNULL, fileloc_undefined); } else if (qual_isRelNull (qel)) { sRef_setNullState (sr, NS_RELNULL, fileloc_undefined); } else if (qual_isNotNull (qel)) { sRef_setNullState (sr, NS_MNOTNULL, fileloc_undefined); } else { if (qual_isCQual (qel)) { ; /* okay */ } else { llerror (FLG_SYNTAX, message ("Qualifier %s cannot be used in a globals list", qual_unparse (qel))); } } } end_qualList_elements; } sRef clabstract_createGlobal (sRef sr, qualList quals) { sRef res; if (sRef_isValid (sr)) { res = sRef_copy (sr); DPRINTF (("Reflecting quals: %s / %s", sRef_unparse (sr), qualList_unparse (quals))); reflectGlobalQualifiers (res, quals); DPRINTF (("==> %s", sRef_unparseFull (res))); } else { res = sRef_undefined; } qualList_free (quals); return res; } extern void declareCIter (cstring name, /*@owned@*/ uentryList params) { uentry ue; ue = uentry_makeIter (name, ctype_makeFunction (ctype_void, params), fileloc_copy (g_currentloc)); usymtab_supEntry (uentry_makeEndIter (name, fileloc_copy (g_currentloc))); ue = usymtab_supGlobalEntryReturn (ue); } extern void nextIterParam (void) { llassert (s_processingIterVars); saveIterParamNo++; } extern int iterParamNo (void) { llassert (s_processingIterVars); return saveIterParamNo; } /* ** yucky hacks to put it in the right place */ /*@only@*/ uentry makeCurrentParam (idDecl t) { uentry ue; saveStoreLoc = fileloc_undefined; /* param number unknown */ ue = uentry_makeParam (t, 0); return ue; } ctype declareUnnamedEnum (enumNameList el) { ctype ret = usymtab_enumEnumNameListType (el); ctype rt; uentry e; if (ctype_isDefined (ret)) { rt = ret; e = uentry_makeEnumTagLoc (ctype_enumTag (rt), ret); reflectStorageClass (e); usymtab_supGlobalEntry (e); declareEnumList (el, ret, g_currentloc); enumNameList_free (el); } else { ctype ct = ctype_createEnum (fakeTag (), el); e = uentry_makeEnumTagLoc (ctype_enumTag (ctype_realType (ct)), ct); reflectStorageClass (e); e = usymtab_supGlobalEntryReturn (e); rt = uentry_getAbstractType (e); declareEnumList (el, ct, g_currentloc); } return (rt); } ctype declareEnum (cstring ename, enumNameList el) { ctype cet; uentry e; llassert (cstring_isDefined (ename)); cet = ctype_createEnum (ename, el); e = uentry_makeEnumTagLoc (ename, cet); reflectStorageClass (e); e = usymtab_supGlobalEntryReturn (e); cet = uentry_getType (e); declareEnumList (el, cet, uentry_whereLast (e)); return (uentry_getAbstractType (e)); } static void declareEnumList (enumNameList el, ctype c, fileloc loc) { bool boolnames = FALSE; bool othernames = FALSE; (void) context_getSaveLocation (); /* undefine it */ if (context_maybeSet (FLG_NUMENUMMEMBERS)) { int maxnum = context_getValue (FLG_NUMENUMMEMBERS); int num = enumNameList_size (el); if (num > maxnum) { voptgenerror (FLG_NUMENUMMEMBERS, message ("Enumerator %s declared with %d members (limit is set to %d)", ctype_unparse (c), num, maxnum), loc); } } enumNameList_elements (el, e) { uentry ue = usymtab_lookupExposeGlob (e); ctype ct = uentry_getType (ue); llassert (uentry_isEnumConstant (ue)); if (ctype_isUnknown (ct)) { uentry_setType (ue, c); } else { if (cstring_equal (e, context_getFalseName ()) || cstring_equal (e, context_getTrueName ())) { if (othernames) { if (optgenerror (FLG_INCONDEFS, message ("Enumerator mixes boolean name (%s) with " "non-boolean names", e), uentry_whereLast (ue))) { ; } } boolnames = TRUE; uentry_setType (ue, ctype_bool); DPRINTF (("Set type: %s / %s", uentry_unparse (ue), ctype_unparse (ctype_bool))); } else { if (boolnames) { if (optgenerror (FLG_INCONDEFS, message ("Enumerator mixes boolean names (%s, %s) with " "non-boolean name: %s", context_getTrueName (), context_getFalseName (), e), uentry_whereLast (ue))) { ; } } othernames = TRUE; } if (!ctype_match (c, ct)) { if (ctype_isDirectBool (ct)) { if (cstring_equal (e, context_getFalseName ()) || cstring_equal (e, context_getTrueName ())) { DPRINTF (("Here we are!")); } else { if (optgenerror (FLG_INCONDEFS, message ("Enumerator member %s declared with " "inconsistent type: %s", e, ctype_unparse (c)), uentry_whereLast (ue))) { uentry_showWhereSpecifiedExtra (ue, cstring_copy (ctype_unparse (ct))); } } } else { if (optgenerror (FLG_INCONDEFS, message ("Enumerator member %s declared with " "inconsistent type: %s", e, ctype_unparse (c)), uentry_whereLast (ue))) { uentry_showWhereSpecifiedExtra (ue, cstring_copy (ctype_unparse (ct))); } } } } } end_enumNameList_elements; } static /*@dependent@*/ uentryList currentParamList; /*drl added 3-28-2002*/ /* this function takes a list of paramentar and generates a list of constraints. */ /* drl modified 10/23/2002 The current semantics are generated constraints of the form MaxSet(p) >= 0 and MaxRead(p) >= 0 for all pointers unless the @out@ annotation has been applied to a parameter, then we only want to generate maxSet(p) > = 0 */ void setImplicitfcnConstraints (void) { uentryList params; sRef s; constraint c; params = currentParamList; if (constraintList_isDefined (implicitFcnConstraints)) { constraintList_free (implicitFcnConstraints); } implicitFcnConstraints = constraintList_makeNew(); uentryList_elements (params, el) { DPRINTF (("setImplicitfcnConstraints doing: %s", uentry_unparse(el))); if (uentry_isVariable (el)) { s = uentry_getSref(el); if (sRef_isReference (s)) { DPRINTF((message ("%s is a pointer", sRef_unparse(s) ) )); /*drl 4/26/01 chagned this from MaxSet(s) == 0 to MaxSet(s) >= 0 */ c = constraint_makeSRefWriteSafeInt (s, 0); implicitFcnConstraints = constraintList_add (implicitFcnConstraints , c); /*drl 10/23/2002 added support for out*/ if (!uentry_isOut(el)) { c = constraint_makeSRefReadSafeInt (s, 0); implicitFcnConstraints = constraintList_add (implicitFcnConstraints , c); } } else { DPRINTF((message ("%s is NOT a pointer", sRef_unparse(s) ) )); } } /*end uentry_isVariable*/ else if (uentry_isElipsisMarker (el) ) { /* just ignore these*/ ; } else { /* just ignore this I'm not sure if this is possible though */ ; } } end_uentryList_elements; } /*@observer@*/ constraintList getImplicitFcnConstraints (void) { return implicitFcnConstraints; } void setCurrentParams (/*@dependent@*/ uentryList ue) { currentParamList = ue; } void clearCurrentParams (void) { currentParamList = uentryList_undefined; } /* ** requires: uentry_isFunction (e) ** parameter names for current function are in currentParamList */ static void enterFunctionParams (uentryList params) { int paramno = 0; uentryList_elements (params, current) { if (uentry_hasName (current)) { uentry_setParamNo (current, paramno); usymtab_supEntry (uentry_copy (current)); } paramno++; } end_uentryList_elements; } extern void enterParamsTemp (void) { usymtab_enterScope (); enterFunctionParams (currentParamList); } extern void exitParamsTemp (void) { usymtab_quietPlainExitScope (); } static /*@exposed@*/ uentry clabstract_globalDeclareFunction (idDecl tid) { ctype deftype = idDecl_getCtype (tid); ctype rettype; uentry ue; DPRINTF (("Global function: %s", idDecl_unparse (tid))); if (ctype_isFunction (deftype)) { rettype = ctype_getReturnType (deftype); } else { rettype = ctype_unknown; } /* ** check has been moved here... */ if (ctype_isFunction (idDecl_getCtype (tid))) { ue = uentry_makeIdFunction (tid); reflectSpecialCode (ue); reflectArgsUsed (ue); reflectStorageClass (ue); uentry_checkParams (ue); DPRINTF (("Supercede function: %s", uentry_unparseFull (ue))); ue = usymtab_supGlobalEntryReturn (ue); DPRINTF (("After supercede function: %s", uentry_unparseFull (ue))); DPRINTF (("Enter function: %s", uentry_unparseFull (ue))); context_enterFunction (ue); enterFunctionParams (uentry_getParams (ue)); resetStorageClass (); DPRINTF (("Function: %s", uentry_unparseFull (ue))); return (ue); } else { llparseerror (message ("Non-function declaration: %q", idDecl_unparse (tid))); return (uentry_undefined); } } /* ** for now, no type checking ** (must check later though!) */ static /*@only@*/ uentry globalDeclareOldStyleFunction (idDecl tid) { uentry ue; /* ** check has been moved here... */ if (cstring_equalLit (idDecl_observeId (tid), "main")) { context_setFlagTemp (FLG_MAINTYPE, FALSE); } ue = uentry_makeIdFunction (tid); reflectStorageClass (ue); reflectSpecialCode (ue); reflectArgsUsed (ue); uentry_setDefined (ue, g_currentloc); uentry_checkParams (ue); resetStorageClass (); /* context_enterOldStyleScope (); */ return (ue); } static void oldStyleDeclareFunction (/*@only@*/ uentry e) { uentryList params = saveParamList; ctype rt = uentry_getType (e); llassert (ctype_isFunction (rt)); if (uentry_hasStateClauseList (e) || uentry_hasConditions (e)) { llfatalerror (message ("%q: Old-style function declaration uses a clause (rewrite with function parameters): %q", fileloc_unparse (g_currentloc), uentry_unparse (e))); } e = usymtab_supGlobalEntryReturn (e); context_enterFunction (e); enterFunctionParams (params); saveParamList = uentryList_undefined; resetStorageClass (); } static void oldStyleCompleteFunction (/*@only@*/ uentry e) { uentryList params = saveParamList; ctype rt = uentry_getType (e); llassert (ctype_isFunction (rt)); if (uentry_hasStateClauseList (e) || uentry_hasConditions (e)) { llfatalerror (message ("%q: Old-style function declaration uses a clause (rewrite with function parameters): %q", fileloc_unparse (g_currentloc), uentry_unparse (e))); } e = usymtab_supGlobalEntryReturn (e); context_completeOldStyleFunction (e); enterFunctionParams (params); saveParamList = uentryList_undefined; resetStorageClass (); } void clabstract_declareFunction (idDecl tid) /*@globals undef saveFunction; @*/ { uentry ue; DPRINTF (("Declare function: %s", idDecl_unparse (tid))); if (ctype_isUnknown (idDecl_getCtype (tid))) { /* ** No type, its really a plain name (int) declaration */ voptgenerror (FLG_IMPTYPE, message ("No type before declaration name (implicit int type): %q", idDecl_unparse (tid)), g_currentloc); tid = idDecl_replaceCtype (tid, ctype_int); processVariable (tid); saveFunction = uentry_undefined; } else { if (s_processingParams) { ue = globalDeclareOldStyleFunction (tid); saveFunction = ue; DPRINTF (("Set save function: %s", uentry_unparseFull (ue))); } else { saveFunction = uentry_undefined; if (context_inRealFunction ()) { ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown); llparseerror (message ("Function declared inside function: %q", idDecl_unparse (tid))); context_quietExitFunction (); ue = usymtab_supEntryReturn (ue); } else { if (context_inInnerScope ()) { llparseerror (message ("Declaration in inner context: %q", idDecl_unparse (tid))); sRef_setGlobalScope (); ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown); ue = usymtab_supGlobalEntryReturn (ue); sRef_clearGlobalScope (); } else { ue = clabstract_globalDeclareFunction (tid); } } resetGlobals (); } resetStorageClass (); } idDecl_free (tid); } void declareStaticFunction (idDecl tid) /*@globals undef saveFunction; @*/ { uentry ue; DPRINTF (("Declare static funciton: %s", idDecl_unparse (tid))); if (s_processingParams) { ue = globalDeclareOldStyleFunction (tid); saveFunction = ue; } else { saveFunction = uentry_undefined; if (context_inRealFunction ()) { ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown); llparseerror (message ("Function declared inside function: %q", idDecl_unparse (tid))); context_quietExitFunction (); ue = usymtab_supEntryReturn (ue); } else { if (context_inInnerScope ()) { llparseerror (message ("Declaration in inner context: %q", idDecl_unparse (tid))); sRef_setGlobalScope (); ue = uentry_makeVariableLoc (idDecl_observeId (tid), ctype_unknown); ue = usymtab_supGlobalEntryReturn (ue); sRef_clearGlobalScope (); } else { ctype deftype = idDecl_getCtype (tid); ctype rettype; if (ctype_isFunction (deftype)) { rettype = ctype_getReturnType (deftype); } else { rettype = ctype_unknown; } /* ** check has been moved here... */ if (ctype_isFunction (idDecl_getCtype (tid))) { ue = uentry_makeIdFunction (tid); reflectSpecialCode (ue); reflectArgsUsed (ue); } else { DPRINTF (("Here we are!")); llparseerror (message ("Inconsistent function declaration: %q", idDecl_unparse (tid))); tid = idDecl_replaceCtype (tid, ctype_makeFunction (ctype_unknown, uentryList_undefined)); ue = uentry_makeIdFunction (tid); } reflectStorageClass (ue); uentry_setStatic (ue); uentry_checkParams (ue); DPRINTF (("Sub global entry: %s", uentry_unparse (ue))); ue = usymtab_supGlobalEntryReturn (ue); context_enterFunction (ue); enterFunctionParams (uentry_getParams (ue)); resetStorageClass (); } } resetGlobals (); } resetStorageClass (); idDecl_free (tid); } void checkTypeDecl (uentry e, ctype rep) { cstring n = uentry_getName (e); DPRINTF (("Check type decl: %s", uentry_unparseFull (e))); if (cstring_equal (context_getBoolName (), n)) { ctype rrep = ctype_realType (rep); /* ** for abstract enum types, we need to fix the enum members: ** they should have the abstract type, not the rep type. */ if (ctype_isEnum (ctype_realType (rrep))) { enumNameList el = ctype_elist (rrep); enumNameList_elements (el, ye) { if (usymtab_existsGlob (ye)) { uentry ue = usymtab_lookupSafe (ye); uentry_setType (ue, ctype_bool); } if (cstring_equal (context_getTrueName (), ye) || cstring_equal (context_getFalseName (), ye)) { ; } else { vgenhinterror (FLG_SYNTAX, message ("Member of boolean enumerated type definition " "does not match name set to represent true " "or false: %s", ye), message ("Use -boolfalse and -booltrue to set the " "name of false and true boolean values."), uentry_whereDefined (e)); } } end_enumNameList_elements; } } if (usymtab_exists (n)) { usymId llm = usymtab_getId (n); uentry le = usymtab_getTypeEntry (typeId_fromUsymId (llm)); uentry_setDeclared (e, g_currentloc); uentry_setSref (e, sRef_makeGlobal (llm, uentry_getType (le), stateInfo_currentLoc ())); DPRINTF (("Here we are: %s / %s", n, context_getBoolName ())); if (uentry_isAbstractDatatype (le)) { ctype rrep = ctype_realType (rep); DPRINTF (("Abstract type: %s", uentry_unparseFull (le))); /* ** for abstract enum types, we need to fix the enum members: ** they should have the abstract type, not the rep type. */ if (ctype_isEnum (ctype_realType (rrep))) { ctype at = uentry_getAbstractType (le); enumNameList el = ctype_elist (rrep); enumNameList_elements (el, ye) { if (usymtab_existsGlob (ye)) { uentry ue = usymtab_lookupSafe (ye); llassert (uentry_isEitherConstant (ue)); /* evans 2002-04-22 */ if (ctype_isBool (uentry_getType (ue))) { /* ** If set using -booltrue or -boolfalse, don't change the type. */ } else { llassertprint (ctype_match (uentry_getType (ue), rrep), ("Bad enum: %s / %s", uentry_unparse (ue), ctype_unparse (rrep))); uentry_setType (ue, at); } } } end_enumNameList_elements; } if (uentry_isMutableDatatype (le)) { /* maybe more complicated if abstract and immutable ? */ if (!ctype_isRealPointer (rep) && !ctype_isRealAbstract (rep)) { voptgenerror (FLG_MUTREP, message ("Mutable abstract type %s declared without pointer " "indirection: %s (violates assignment semantics)", n, ctype_unparse (rep)), uentry_whereDefined (e)); uentry_setMutable (e); } } } } else { fileloc fl = uentry_whereDeclared (e); if (context_getFlag (FLG_LIKELYBOOL) && !context_getFlag (FLG_BOOLINT)) { if ((cstring_equalLit (n, "BOOL") || cstring_equalLit (n, "Bool") || cstring_equalLit (n, "bool") || cstring_equalLit (n, "boolean") || cstring_equalLit (n, "Boolean") || cstring_equalLit (n, "BOOLEAN")) && !(cstring_equal (n, context_getBoolName ()))) { if (context_setBoolName ()) { voptgenerror (FLG_LIKELYBOOL, message ("Type %s is probably meant as a boolean type, but does " "not match the boolean type name \"%s\".", n, context_getBoolName ()), fl); } else voptgenerror (FLG_LIKELYBOOL, message ("Type %s is probably meant as a boolean type, " "but the boolean type name is not set. " "Use -booltype %s to set it.", n, n), fl); } } if (!uentry_isStatic (e) && !ctype_isFunction (uentry_getType (e)) && !fileloc_isLib (fl) && !fileloc_isImport (fl) && fileloc_isHeader (fl)) { voptgenerror (FLG_EXPORTTYPE, message ("Type exported, but not specified: %s\n", n), fl); } } cstring_free (n); } uentryList fixUentryList (idDeclList tl, qtype q) { uentryList f = uentryList_new (); idDeclList_elements (tl, i) { if (idDecl_isDefined (i)) { uentry ue; uentry old; ctype rt; (void) idDecl_fixBase (i, q); /* ** implicit annotations */ (void) fixStructDecl (i); ue = uentry_makeIdVariable (i); rt = ctype_realType (uentry_getType (ue)); /* ** where is this here??? if (ctype_isArray (rt) || ctype_isSU (rt)) { sRef_setAllocated (uentry_getSref (ue), uentry_whereDefined (ue)); } ** */ if (uentry_isValid (old = uentryList_lookupField (f, uentry_rawName (ue)))) { if (optgenerror (FLG_SYNTAX, message ("Field name reused: %s", uentry_rawName (ue)), uentry_whereDefined (ue))) { llgenmsg (message ("Previous use of %s", uentry_rawName (ue)), uentry_whereDefined (old)); } } f = uentryList_add (f, ue); } } end_idDeclList_elements; idDeclList_free (tl); return (f); } /* ** This is a hack to support unnamed struct/union fields as done by ** Microsoft VC++. It is not supported by the ANSI standard. ** ** The inner fields are added to the outer structure. This is meaningful ** for nesting structs inside unions, but Splint does no related ** checking. */ uentryList fixUnnamedDecl (qtype q) { ctype ct = ctype_realType (qtype_getType (q)); if (ctype_isStruct (ct) || ctype_isUnion (ct)) { return uentryList_single (uentry_makeUnnamedVariable (ct)); } else if (ctype_isEnum (ct)) { /* evans 2002-02-05: nothing to do for unnamed enum lists */ return uentryList_undefined; } else { voptgenerror (FLG_SYNTAX, message ("Type name in field declarations: %s", qtype_unparse (q)), g_currentloc); } return uentryList_undefined; } void setStorageClass (storageClassCode sc) { storageClass = sc; } void setProcessingIterVars (uentry iter) { s_processingIterVars = TRUE; currentIter = iter; saveIterParamNo = 0; } void setProcessingGlobalsList () { s_processingGlobals = TRUE; fcnNoGlobals = FALSE; } static bool ProcessingGlobMods = FALSE; void setProcessingGlobMods () { ProcessingGlobMods = TRUE; } void clearProcessingGlobMods () { ProcessingGlobMods = FALSE; } bool isProcessingGlobMods () { return (ProcessingGlobMods); } static void resetGlobals (void) { s_processingGlobals = FALSE; fcnNoGlobals = FALSE; } void unsetProcessingGlobals () { s_processingGlobals = FALSE; } void setProcessingVars (/*@only@*/ qtype q) { s_processingVars = TRUE; qtype_free (processingType); processingType = q; } static void setGenericParamList (/*@dependent@*/ uentryList pm) { s_processingParams = TRUE; saveParamList = pm; } void setProcessingTypedef (qtype q) { s_processingTypedef = TRUE; qtype_free (processingType); processingType = q; } void unsetProcessingVars () { resetStorageClass (); s_processingVars = FALSE; } void oldStyleDoneParams () { if (s_processingParams) { if (uentry_isInvalid (saveFunction)) { llbuglit ("unsetProcessingVars: no saved function\n"); } else { ctype ct = ctype_getReturnType (uentry_getType (saveFunction)); uentryList params = uentryList_copy (saveParamList); ctype ct2 = ctype_makeFunction (ct, params); uentry_setType (saveFunction, ct2); s_processingParams = FALSE; oldStyleCompleteFunction (saveFunction); saveFunction = uentry_undefined; resetGlobals (); } } else { /* ** If the paramlist used a type name, we could be here. */ llfatalerror (message ("%q: Old-style function parameter list uses a " "type name.", fileloc_unparse (g_currentloc))); } } void checkDoneParams () { if (uentry_isValid (saveFunction)) { /* ** old style declaration */ ctype ct = ctype_getReturnType (uentry_getType (saveFunction)); ctype ct2; DPRINTF (("save function: %s", uentry_unparseFull (saveFunction))); uentryList_elements (saveParamList, current) { uentry_setType (current, ctype_int); /* all params are ints */ } end_uentryList_elements; ct2 = ctype_makeParamsFunction (ct, uentryList_copy (saveParamList)); uentry_setType (saveFunction, ct2); s_processingParams = FALSE; oldStyleDeclareFunction (saveFunction); saveFunction = uentry_undefined; } } void clabstract_declareType (/*@only@*/ exprNodeList decls, /*@only@*/ warnClause warn) { llassert (s_processingTypedef); DPRINTF (("Declare type: %s", exprNodeList_unparse (decls))); if (warnClause_isDefined (warn)) { DPRINTF (("Has a warn clause!")); DPRINTF (("Warn: %s", warnClause_unparse (warn))); exprNodeList_elements (decls, el) { uentry ue = exprNode_getUentry (el); cstring uname = uentry_getName (ue); DPRINTF (("Entry: %s", exprNode_unparse (el))); /* ** Need to lookup again to make sure we have the right one... */ ue = usymtab_lookupExposeGlob (uname); llassert (uentry_isValid (ue)); llassert (uentry_isDatatype (ue)); DPRINTF (("Warning for %s: %s", uentry_unparse (ue), warnClause_unparse (warn))); uentry_addWarning (ue, warnClause_copy (warn)); DPRINTF (("After add warning: %s", uentry_unparseFull (ue))); cstring_free (uname); } end_exprNodeList_elements; } warnClause_free (warn); exprNodeList_free (decls); unsetProcessingTypedef (); } void unsetProcessingTypedef () { s_processingTypedef = FALSE; } void checkConstant (qtype t, idDecl id) { uentry e; id = idDecl_fixBase (id, t); e = uentry_makeIdConstant (id); reflectStorageClass (e); resetStorageClass (); DPRINTF (("Constant: %s", uentry_unparseFull (e))); usymtab_supGlobalEntry (e); } void checkValueConstant (qtype t, idDecl id, exprNode e) { uentry ue; id = idDecl_fixBase (id, t); ue = uentry_makeIdConstant (id); reflectStorageClass (ue); resetStorageClass (); if (exprNode_isDefined (e)) { if (!exprNode_matchType (uentry_getType (ue), e)) { (void) gentypeerror (exprNode_getType (e), e, uentry_getType (ue), exprNode_undefined, message ("Constant %q initialized to type %t, expects %t: %s", uentry_getName (ue), exprNode_getType (e), uentry_getType (ue), exprNode_unparse (e)), exprNode_loc (e)); } else { if (exprNode_hasValue (e)) { uentry_mergeConstantValue (ue, multiVal_copy (exprNode_getValue (e))); } else { DPRINTF (("No value: %s", exprNode_unparse (e))); } } } DPRINTF (("Constant value: %s", uentry_unparseFull (ue))); usymtab_supGlobalEntry (ue); } static void processVariable (idDecl t) { uentry e; ctype ct; ct = ctype_realType (idDecl_getCtype (t)); if (s_processingParams) { cstring id = idDecl_getName (t); int paramno = uentryList_lookupRealName (saveParamList, id); if (paramno >= 0) { uentry cparam = uentryList_getN (saveParamList, paramno); DPRINTF (("Processing param: %s", uentry_unparseFull (cparam))); uentry_setType (cparam, idDecl_getCtype (t)); uentry_reflectQualifiers (cparam, idDecl_getQuals (t)); uentry_setDeclaredOnly (cparam, context_getSaveLocation ()); DPRINTF (("Processing param: %s", uentry_unparseFull (cparam))); } else { llfatalerrorLoc (message ("Old style declaration uses unlisted parameter: %s", id)); } } else { fileloc loc; if (context_inIterDef ()) { cstring pname = makeParam (idDecl_observeId (t)); uentry p = usymtab_lookupSafe (pname); cstring_free (pname); if (uentry_isYield (p)) { e = uentry_makeParam (t, sRef_getParam (uentry_getSref (p))); uentry_checkYieldParam (p, e); usymtab_supEntrySref (e); return; } } if ((hasSpecialCode () || argsUsed) && ctype_isFunction (idDecl_getCtype (t))) { e = uentry_makeIdFunction (t); reflectSpecialCode (e); reflectArgsUsed (e); } else { e = uentry_makeIdVariable (t); } loc = uentry_whereDeclared (e); /* if (context_inGlobalScope ()) { uentry_checkParams was here! } */ if (ctype_isFunction (uentry_getType (e))) { clabstract_prepareFunction (e); } DPRINTF (("Superceding... %s", uentry_unparseFull (e))); e = usymtab_supEntrySrefReturn (e); DPRINTF (("After superceding... %s", uentry_unparseFull (e))); if (uentry_isExtern (e) && !context_inGlobalScope ()) { voptgenerror (FLG_NESTEDEXTERN, message ("Declaration using extern inside function scope: %q", uentry_unparse (e)), g_currentloc); uentry_setDefined (e, fileloc_getExternal ()); sRef_setDefined (uentry_getSref (e), fileloc_getExternal ()); } if (uentry_isFunction (e)) { if (!context_inXHFile ()) { checkParamNames (e); } } if (uentry_isVar (e) && uentry_isCheckedUnknown (e)) { sRef sr = uentry_getSref (e); if (sRef_isLocalVar (sr)) { if (context_getFlag (FLG_IMPCHECKMODINTERNALS)) { uentry_setCheckMod (e); } else { uentry_setUnchecked (e); } } else if (sRef_isFileStatic (sr)) { if (context_getFlag (FLG_IMPCHECKEDSTRICTSTATICS)) { uentry_setCheckedStrict (e); } else if (context_getFlag (FLG_IMPCHECKEDSTATICS)) { uentry_setChecked (e); } else if (context_getFlag (FLG_IMPCHECKMODSTATICS)) { uentry_setCheckMod (e); } else { ; } } else /* real global */ { llassert (sRef_isRealGlobal (sr)); if (context_getFlag (FLG_IMPCHECKEDSTRICTGLOBALS)) { uentry_setCheckedStrict (e); } else if (context_getFlag (FLG_IMPCHECKEDGLOBALS)) { uentry_setChecked (e); } else if (context_getFlag (FLG_IMPCHECKMODGLOBALS)) { uentry_setCheckMod (e); } else { ; } } } } } void processNamedDecl (idDecl t) { if (qtype_isUndefined (processingType)) { processingType = qtype_create (ctype_int); t = idDecl_fixBase (t, processingType); voptgenerror (FLG_IMPTYPE, message ("No type before declaration name (implicit int type): %q", idDecl_unparse (t)), g_currentloc); } else { t = idDecl_fixBase (t, processingType); } DPRINTF (("Declare: %s", idDecl_unparse (t))); if (s_processingGlobals) { cstring id = idDecl_getName (t); uentry ue = usymtab_lookupSafe (id); if (!uentry_isValid (ue)) { llerror (FLG_UNRECOG, message ("Variable used in globals list is undeclared: %s", id)); } else { if (!ctype_match (uentry_getType (ue), idDecl_getCtype (t))) { voptgenerror (FLG_INCONDEFS, message ("Variable %s used in globals list declared %s, " "but listed as %s", id, ctype_unparse (uentry_getType (ue)), ctype_unparse (idDecl_getCtype (t))), g_currentloc); } else { sRef sr = sRef_copy (uentry_getSref (ue)); reflectGlobalQualifiers (sr, idDecl_getQuals (t)); } } } else if (s_processingVars) { processVariable (t); } else if (s_processingTypedef) { ctype ct = idDecl_getCtype (t); uentry e; DPRINTF (("Processing typedef: %s", ctype_unparse (ct))); e = uentry_makeIdDatatype (t); if (cstring_equal (idDecl_getName (t), context_getBoolName ())) { ctype rt = ctype_realType (ct); if (ctype_isEnum (rt)) { ; } else { if (!(ctype_isInt (rt) || ctype_isUnknown (rt) || ctype_isChar (rt))) { (void) llgenerror (FLG_BOOLTYPE, message ("Boolean type %s defined using non-standard type %s (integral, char or enum type expected)", context_getBoolName (), ctype_unparse (ct)), uentry_whereLast (e)); } ct = ctype_bool; uentry_setType (e, ct); } } reflectStorageClass (e); checkTypeDecl (e, ct); e = usymtab_supReturnTypeEntry (e); } else { llparseerror (message ("Suspect missing struct or union keyword: %q", idDecl_unparse (t))); } } /* ** moved from grammar */ static idDecl fixStructDecl (/*@returned@*/ idDecl d) { if (ctype_isVisiblySharable (idDecl_getCtype (d)) && context_getFlag (FLG_STRUCTIMPONLY)) { if (!qualList_hasAliasQualifier (idDecl_getQuals (d))) { if (qualList_hasExposureQualifier (idDecl_getQuals (d))) { idDecl_addQual (d, qual_createDependent ()); } else { idDecl_addQual (d, qual_createImpOnly ()); } } } return d; } ctype declareUnnamedStruct (/*@only@*/ uentryList f) { DPRINTF (("Unnamed struct: %s", uentryList_unparse (f))); if (context_maybeSet (FLG_NUMSTRUCTFIELDS)) { int num = uentryList_size (f); int max = context_getValue (FLG_NUMSTRUCTFIELDS); if (num > max) { voptgenerror (FLG_NUMSTRUCTFIELDS, message ("Structure declared with %d fields " "(limit is set to %d)", num, max), g_currentloc); } } return (ctype_createUnnamedStruct (f)); } ctype declareUnnamedUnion (/*@only@*/ uentryList f) { DPRINTF (("Unnamed union: %s", uentryList_unparse (f))); if (context_maybeSet (FLG_NUMSTRUCTFIELDS)) { int num = uentryList_size (f); int max = context_getValue (FLG_NUMSTRUCTFIELDS); if (num > max) { voptgenerror (FLG_NUMSTRUCTFIELDS, message ("Union declared with %d fields " "(limit is set to %d)", num, max), g_currentloc); } } return (ctype_createUnnamedUnion (f)); } ctype declareStruct (cstring id, /*@only@*/ uentryList f) { ctype ct; uentry ue; int num = uentryList_size (f); DPRINTF (("Declare struct: %s / %s [%d]", id, uentryList_unparse (f), uentryList_size (f))); ct = ctype_createStruct (cstring_copy (id), f); DPRINTF (("Ctype: %s", ctype_unparse (ct))); ue = uentry_makeStructTagLoc (id, ct); DPRINTF (("ue: %s", uentry_unparseFull (ue))); if (context_maybeSet (FLG_NUMSTRUCTFIELDS)) { int max = context_getValue (FLG_NUMSTRUCTFIELDS); if (num > max) { voptgenerror (FLG_NUMSTRUCTFIELDS, message ("Structure %q declared with %d fields " "(limit is set to %d)", uentry_getName (ue), num, max), uentry_whereLast (ue)); } } return (usymtab_supTypeEntry (ue)); } ctype declareUnion (cstring id, uentryList f) { ctype ct; uentry ue; int num = uentryList_size (f); ct = ctype_createUnion (cstring_copy (id), f); ue = uentry_makeUnionTagLoc (id, ct); if (context_maybeSet (FLG_NUMSTRUCTFIELDS)) { int max = context_getValue (FLG_NUMSTRUCTFIELDS); if (num > max) { voptgenerror (FLG_NUMSTRUCTFIELDS, message ("Union %q declared with %d fields " "(limit is set to %d)", uentry_getName (ue), num, max), uentry_whereLast (ue)); } } return (usymtab_supTypeEntry (ue)); } ctype handleStruct (/*@only@*/ cstring id) { if (usymtab_existsStructTag (id)) { ctype ct = uentry_getAbstractType (usymtab_lookupStructTag (id)); cstring_free (id); return ct; } else { return (ctype_createForwardStruct (id)); } } ctype handleUnion (/*@only@*/ cstring id) { if (usymtab_existsUnionTag (id)) { ctype ret = uentry_getAbstractType (usymtab_lookupUnionTag (id)); cstring_free (id); return (ret); } else { return (ctype_createForwardUnion (id)); } } ctype handleEnum (cstring id) { if (usymtab_existsEnumTag (id)) { ctype ret = uentry_getAbstractType (usymtab_lookupEnumTag (id)); cstring_free (id); return ret; } else { return (ctype_createForwardEnum (id)); } } bool processingIterVars (void) { return s_processingIterVars; } uentry getCurrentIter (void) { return currentIter; } static bool flipOldStyle = FALSE; static bool flipNewStyle = TRUE; void setFlipOldStyle () { flipOldStyle = TRUE; } bool isFlipOldStyle () { return flipOldStyle; } bool isNewStyle () { return flipNewStyle; } void setNewStyle () { flipNewStyle = TRUE; } /*@dependent@*/ uentryList handleParamIdList (/*@dependent@*/ uentryList params) { int paramno = 0; /* ** this is a really YUCKY hack to handle old style ** declarations. */ voptgenerror (FLG_OLDSTYLE, cstring_makeLiteral ("Old style function declaration"), g_currentloc); DPRINTF (("Handle old style params: %s", uentryList_unparseFull (params))); uentryList_elements (params, current) { uentry_setParam (current); uentry_setSref (current, sRef_makeParam (paramno, ctype_unknown, stateInfo_makeLoc (uentry_whereLast (current), SA_DECLARED))); paramno++; } end_uentryList_elements; setGenericParamList (params); cscannerHelp_setExpectingTypeName (); return params; } /*@dependent@*/ uentryList handleParamTypeList (/*@returned@*/ uentryList params) { if (flipOldStyle) { uentryList_fixMissingNames (params); voptgenerror (FLG_OLDSTYLE, cstring_makeLiteral ("Old style function declaration."), g_currentloc); setGenericParamList (params); flipOldStyle = FALSE; cscannerHelp_setExpectingTypeName (); } return (params); } void doVaDcl () { ctype c = ctype_unknown; cstring id = cstring_makeLiteral ("va_alist"); uentry e; if (s_processingParams) { int i = uentryList_lookupRealName (saveParamList, id); if (i >= 0) { fileloc loc = context_getSaveLocation (); e = uentry_makeVariableSrefParam (id, c, loc, sRef_makeParam (i, c, stateInfo_makeLoc (loc, SA_DECLARED))); } else { e = uentry_undefined; /* suppress gcc message */ llfatalerrorLoc (cstring_makeLiteral ("va_dcl used without va_alist")); } } else { llerror (FLG_SYNTAX, cstring_makeLiteral ("va_dcl used outside of function declaration")); e = uentry_makeVariableLoc (id, c); } cstring_free (id); uentry_setUsed (e, g_currentloc); usymtab_supEntrySref (e); } /*@exposed@*/ sRef modListPointer (/*@exposed@*/ sRef s) { ctype ct = sRef_getType (s); ctype rt = ctype_realType (ct); if (ctype_isAP (rt)) { if (context_inHeader () && ctype_isAbstract (ct)) { voptgenerror (FLG_ABSTRACT, message ("Modifies clause in header file dereferences abstract " "type %s (interface modifies clause should not depend " "on or expose type representation): %q", ctype_unparse (ct), sRef_unparse (s)), g_currentloc); } return (sRef_constructPointer (s)); } else { if (ctype_isKnown (rt)) { voptgenerror (FLG_TYPE, message ("Implementation modifies clause dereferences non-pointer (type %s): %q", ctype_unparse (rt), sRef_unparse (s)), g_currentloc); } return s; } } /*@exposed@*/ sRef modListFieldAccess (sRef s, cstring f) { ctype ct = sRef_getType (s); ctype rt = ctype_realType (ct); if (ctype_isStructorUnion (rt)) { uentry tf = uentryList_lookupField (ctype_getFields (rt), f); if (uentry_isUndefined (tf)) { voptgenerror (FLG_TYPE, message ("Modifies list accesses non-existent " "field %s of %t: %q", f, ct, sRef_unparse (s)), g_currentloc); cstring_free (f); return sRef_undefined; } else { if (ctype_isAbstract (ct) && context_inHeader ()) { voptgenerror (FLG_ABSTRACT, message ("Modifies clause in header file accesses abstract " "type %s (interface modifies clause should not depend " "on or expose type representation): %q", ctype_unparse (ct), sRef_unparse (s)), g_currentloc); } } cstring_markOwned (f); return (sRef_makeField (s, f)); } else { voptgenerror (FLG_TYPE, message ("Modifies clause dereferences non-pointer (type %s): %q", ctype_unparse (rt), sRef_unparse (s)), g_currentloc); cstring_free (f); return s; } } /*@dependent@*/ sRef clabstract_unrecognizedGlobal (cstring s) { if (cstring_equalLit (s, "nothing")) { return sRef_makeNothing (); } else if (cstring_equalLit (s, "internalState")) { return sRef_makeInternalState (); } else if (cstring_equalLit (s, "fileSystem") || cstring_equalLit (s, "systemState")) { return sRef_makeSystemState (); } else { voptgenerror (FLG_UNRECOG, message ("Unrecognized identifier in globals list: %s", s), g_currentloc); return sRef_undefined; } } /*@exposed@*/ sRef modListArrowAccess (sRef s, cstring f) { ctype ct = sRef_getType (s); ctype rt = ctype_realType (ct); if (ctype_isRealPointer (rt)) { ctype b = ctype_baseArrayPtr (rt); ctype rb = ctype_realType (b); if (ctype_isStructorUnion (rb)) { uentry tf = uentryList_lookupField (ctype_getFields (rb), f); if (uentry_isUndefined (tf)) { voptgenerror (FLG_TYPE, message ("Modifies list arrow accesses non-existent " "field %s of %t: %q", f, b, sRef_unparse (s)), g_currentloc); cstring_free (f); return sRef_undefined; } else { if (context_inHeader ()) { if (ctype_isAbstract (b)) { voptgenerror (FLG_ABSTRACT, message ("Modifies clause in header file arrow accesses abstract " "type %s (interface modifies clause should not depend " "on or expose type representation): %q", ctype_unparse (b), sRef_unparse (s)), g_currentloc); } } else { if (ctype_isAbstract (rt)) { voptgenerror (FLG_ABSTRACT, message ("Modifies clause arrow accesses inaccessible abstract " "type %s (interface modifies clause should not depend " "on or expose type representation): %q", ctype_unparse (rt), sRef_unparse (s)), g_currentloc); } } } cstring_markOwned (f); return (sRef_makeArrow (s, f)); } else { voptgenerror (FLG_TYPE, message ("Modifies clause arrow accesses pointer to " "non-structure (type %s): %q", ctype_unparse (rt), sRef_unparse (s)), g_currentloc); } } else { voptgenerror (FLG_TYPE, message ("Modifies clause arrow accesses non-pointer (type %s): %q", ctype_unparse (rt), sRef_unparse (s)), g_currentloc); } cstring_free (f); return s; } sRef checkStateClausesId (uentry ue) { cstring s = uentry_rawName (ue); if (sRef_isFileOrGlobalScope (uentry_getSref (ue))) { voptgenerror (FLG_COMMENTERROR, message ("Global variable %s used state clause. (Global variables " "are not recognized in state clauses. If they are present " "they are ignored. " " If there is " "sufficient interest in support for this, it may be " "added to a future release. Send mail to " "info@splint.org.)", s), g_currentloc); return sRef_undefined; } else { if (cstring_equalLit (s, "result")) { if (optgenerror (FLG_SYNTAX, message ("Special clause list uses %s which is a variable and has special " "meaning in a modifies list. (Special meaning assumed.)", s), g_currentloc)) { uentry_showWhereDeclared (ue); } } return uentry_getSref (ue); } } /*drl:1/19/2001 oops to 1/8/2000 date is wronge .. don;t know what the real date is... */ /*drl added 1/8/2000 based on checkSpecClausesId called by grammar */ sRef checkbufferConstraintClausesId (uentry ue) { sRef sr; cstring s = uentry_rawName (ue); if (cstring_equalLit (s, "result")) { if (optgenerror (FLG_SYNTAX, message ("Function clause list uses %s which is a variable and has special " "meaning in a modifies list. (Special meaning assumed.)", s), g_currentloc)) { uentry_showWhereDeclared (ue); } } sr = uentry_getSref (ue); if (sRef_isInvalid (sr)) { llfatalerrorLoc (cstring_makeLiteral ("Macro defined constants can not be used in function " "constraints unless they are specifed with the constant " "annotation. To use a macro defined constant include an " "annotation of the form /*@constant =@*/ " "somewhere before the function constraint. This restriction " "may be removed in future releases.")); } /* saveCopy to used to mitigate danger of accessing freed memory*/ return sRef_saveCopy (sr); } void checkModifiesId (uentry ue) { cstring s = uentry_rawName (ue); if (cstring_equalLit (s, "nothing") || cstring_equalLit (s, "internalState") || cstring_equalLit (s, "systemState") || (cstring_equalLit (s, "fileSystem"))) { if (optgenerror (FLG_SYNTAX, message ("Modifies list uses %s which is a variable and has special " "meaning in a modifies list. (Special meaning assumed.)", s), g_currentloc)) { uentry_showWhereDeclared (ue); } } } /*@exposed@*/ sRef fixModifiesId (cstring s) { sRef ret; cstring pname = makeParam (s); uentry ue = usymtab_lookupSafe (pname); cstring_free (pname); if (cstring_equalLit (s, "nothing")) { ret = sRef_makeNothing (); } else if (cstring_equalLit (s, "internalState")) { ret = sRef_makeInternalState (); } else if (cstring_equalLit (s, "fileSystem") || cstring_equalLit (s, "systemState")) { ret = sRef_makeSystemState (); } else { ret = sRef_undefined; } if (sRef_isValid (ret)) { if (uentry_isValid (ue)) { voptgenerror (FLG_SYNTAX, message ("Modifies list uses %s which is a parameter and has special " "meaning in a modifies list. (Special meaning assumed.)", s), g_currentloc); } } else { if (uentry_isValid (ue)) { ret = uentry_getSref (ue); } else { fileloc loc = fileloc_decColumn (g_currentloc, size_toInt (cstring_length (s))); ret = sRef_undefined; voptgenerror (FLG_UNRECOG, message ("Unrecognized identifier in modifies comment: %s", s), loc); fileloc_free (loc); } } return ret; } sRef fixStateClausesId (cstring s) { sRef ret; cstring pname = makeParam (s); uentry ue = usymtab_lookupSafe (pname); cstring_free (pname); if (cstring_equalLit (s, "result")) { ret = sRef_makeResult (ctype_unknown); } else { ret = sRef_undefined; } if (sRef_isValid (ret)) { if (uentry_isValid (ue)) { voptgenerror (FLG_SYNTAX, message ("Function clause uses %s which is a parameter and has special " "meaning in a function clause. (Special meaning assumed.)", s), g_currentloc); } } else { if (uentry_isValid (ue)) { ret = uentry_getSref (ue); if (sRef_isFileOrGlobalScope (ret)) { voptgenerror (FLG_SYNTAX, message ("Global variable %s used in function clause. (Global variables " "are not recognized in function clauses. If there is " "sufficient interest in support for this, it may be " "added to a future release. Send mail to " "info@splint.org.)", s), g_currentloc); ret = sRef_undefined; } } else { /* drl This is the code for structure invariants It is no yet stable enough to be included in a Splint release. */ /*check that we're in a structure */ #if 0 /*@unused@*/ uentryList ueL; /*@unused@*/ uentry ue2; /*@unused@*/ ctype ct; #endif fileloc loc = fileloc_decColumn (g_currentloc, size_toInt (cstring_length (s))); ret = sRef_undefined; # if 0 ct = context_getLastStruct ( ct ); llassert( ctype_isStruct(ct) ); ueL = ctype_getFields (ct); ue2 = uentryList_lookupField (ueL, s); if (!uentry_isUndefined(ue2) ) { ret = uentry_getSref(ue2); DPRINTF(( message("Got field in structure in the annotation constraint: %s (or sref: %s)", s, sRef_unparse(ret) ) )); return ret; } #endif voptgenerror (FLG_UNRECOG, message ("Unrecognized identifier in function clause: %s", s), loc); fileloc_free (loc); } } return ret; } sRef modListArrayFetch (/*@exposed@*/ sRef s, /*@unused@*/ sRef mexp) { ctype ct = sRef_getType (s); ctype rt = ctype_realType (ct); if (ctype_isAP (rt)) { if (context_inHeader () && ctype_isAbstract (ct)) { voptgenerror (FLG_ABSTRACT, message ("Modifies clause in header file indexes abstract " "type %s (interface modifies clause should not depend " "on or expose type representation): %q", ctype_unparse (ct), sRef_unparse (s)), g_currentloc); } return (sRef_makeAnyArrayFetch (s)); } else { voptgenerror (FLG_TYPE, message ("Implementation modifies clause uses array fetch on non-array (type %s): %q", ctype_unparse (ct), sRef_unparse (s)), g_currentloc); return s; } } static void clabstract_prepareFunction (uentry e) { uentry_checkParams (e); DPRINTF (("After prepare: %s", uentry_unparseFull (e))); } sRef clabstract_checkGlobal (exprNode e) { sRef s; llassert (exprNode_isInitializer (e)); s = exprNode_getSref (e); DPRINTF (("Initializer: %s -> %s", exprNode_unparse (e), sRef_unparse (s))); exprNode_free (e); return sRef_copy (s); } splint-3.1.2.dfsg1/src/idDecl.c0000644021234200000250000001230607646432515013600 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** idDecl.c */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ idDecl idDecl_createClauses (/*@only@*/ cstring s, /*@only@*/ qtype t, /*@only@*/ functionClauseList clauses) { idDecl d = (idDecl) dmalloc (sizeof (*d)); d->id = s; d->typ = t; d->clauses = clauses; return (d); } /*@only@*/ idDecl idDecl_create (/*@only@*/ cstring s, /*@only@*/ qtype t) { return idDecl_createClauses (s, t, functionClauseList_undefined); } void idDecl_free (idDecl t) { if (idDecl_isDefined (t)) { /* don't: functionClauseList_free (t->clauses); */ /* evans 2002-01-03: splint catches this now! */ qtype_free (t->typ); cstring_free (t->id); /*@-compdestroy@*/ sfree (t); /*@=compdestroy@*/ } } cstring idDecl_unparse (idDecl d) { if (idDecl_isDefined (d)) { if (functionClauseList_isDefined (d->clauses)) { return (message ("%s : %q / %q", d->id, qtype_unparse (d->typ), functionClauseList_unparse (d->clauses))); } else { return (message ("%s : %q", d->id, qtype_unparse (d->typ))); } } else { return (cstring_makeLiteral ("")); } } cstring idDecl_unparseC (idDecl d) { if (idDecl_isDefined (d)) { return (message ("%q %s", qtype_unparse (d->typ), d->id)); } else { return (cstring_makeLiteral ("")); } } /*@observer@*/ cstring idDecl_observeId (idDecl d) { if (idDecl_isDefined (d)) { return (d->id); } else { return cstring_undefined; } } qtype idDecl_getTyp (idDecl d) { llassert (idDecl_isDefined (d)); return d->typ; } ctype idDecl_getCtype (idDecl d) { if (idDecl_isDefined (d)) { return (qtype_getType (d->typ)); } else { return ctype_unknown; } } qualList idDecl_getQuals (idDecl d) { if (idDecl_isDefined (d)) { return (qtype_getQuals (d->typ)); } else { return qualList_undefined; } } functionClauseList idDecl_getClauses (idDecl d) { if (idDecl_isDefined (d)) { return (d->clauses); } else { return functionClauseList_undefined; } } void idDecl_addQual (idDecl d, qual q) { llassert (idDecl_isDefined (d)); (void) qtype_addQual (d->typ, q); } void idDecl_setTyp (idDecl d, qtype c) { llassert (idDecl_isDefined (d)); qtype_free (d->typ); d->typ = c; } idDecl idDecl_replaceCtype (/*@returned@*/ idDecl d, ctype c) { llassert (idDecl_isDefined (d)); DPRINTF (("Replace type: %s / %s", idDecl_unparse (d), ctype_unparse (c))); qtype_setType (d->typ, c); return d; } idDecl idDecl_fixBase (/*@returned@*/ idDecl t, qtype b) { llassert (idDecl_isDefined (t)); t->typ = qtype_newQbase (t->typ, b); return t; } idDecl idDecl_fixParamBase (/*@returned@*/ idDecl t, qtype b) { qtype q; ctype c; llassert (idDecl_isDefined (t)); q = qtype_newQbase (t->typ, b); c = qtype_getType (q); /* ** For some reason, C adds an implicit pointer to function ** parameters. It is "optional" syntax. */ if (ctype_isFunction (c) && !ctype_isPointer (c)) { qtype_setType (q, ctype_makePointer (c)); } t->typ = q; /* Splint thinks t->typ is kept. */ /*@-compmempass@*/ return t; /*@=compmempass@*/ } idDecl idDecl_expectFunction (/*@returned@*/ idDecl d) { llassert (idDecl_isDefined (d)); qtype_setType (d->typ, ctype_expectFunction (qtype_getType (d->typ))); return d; } /* ** evans 2002-02-09: This is a bit of a kludge, but we ** need it to fix declarations like int (*p)[]; */ void idDecl_notExpectingFunction (/*@returned@*/ idDecl d) { if (idDecl_isDefined (d)) { ctype ct = qtype_getType (d->typ); if (ctype_isExpFcn (ct)) { qtype_setType (d->typ, ctype_dontExpectFunction (ct)); } } } void idDecl_addClauses (idDecl d, functionClauseList clauses) { llassert (idDecl_isDefined (d)); /* DRL comment out llassert: This breaks on sometypes of functionPointers. I.e. void (*signal (int sig ) @requires g >= 0 @ ) (int) @requires g >= 0 @ ; llassert (functionClauseList_isUndefined (d->clauses)); */ if (functionClauseList_isUndefined (d->clauses) ) { d->clauses = clauses; } else { functionClauseList_free(d->clauses); d->clauses = clauses; } } splint-3.1.2.dfsg1/src/clause.c0000644021234200000250000001232107630461220013651 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** clause.c */ # include "splintMacros.nf" # include "basic.h" cstring clause_unparse (clause cl) { switch (cl) { case TRUECLAUSE: return (cstring_makeLiteralTemp ("true")); case FALSECLAUSE: return (cstring_makeLiteralTemp ("false")); case ANDCLAUSE: return (cstring_makeLiteralTemp ("and")); case ORCLAUSE: return (cstring_makeLiteralTemp ("or")); case DOWHILECLAUSE: return (cstring_makeLiteralTemp ("do ... while")); case WHILECLAUSE: return (cstring_makeLiteralTemp ("while")); case ITERCLAUSE: return (cstring_makeLiteralTemp ("iter")); case FORCLAUSE: return (cstring_makeLiteralTemp ("for")); case CASECLAUSE: return (cstring_makeLiteralTemp ("case")); case NOCLAUSE: return (cstring_makeLiteralTemp ("none")); case SWITCHCLAUSE: return (cstring_makeLiteralTemp ("switch")); case CONDCLAUSE: return (cstring_makeLiteralTemp ("cond")); case TRUEEXITCLAUSE: return (cstring_makeLiteralTemp ("trueexit")); case FALSEEXITCLAUSE: return (cstring_makeLiteralTemp ("falseexit")); } BADEXIT; } cstring clause_nameTaken (clause cl) { switch (cl) { case TRUECLAUSE: return (cstring_makeLiteralTemp ("in true branch")); case FALSECLAUSE: return (cstring_makeLiteralTemp ("in true branch")); case ANDCLAUSE: return (cstring_makeLiteralTemp ("in first and clause")); case ORCLAUSE: return (cstring_makeLiteralTemp ("in first or clause")); case DOWHILECLAUSE: return (cstring_makeLiteralTemp ("in do ... while body")); case WHILECLAUSE: return (cstring_makeLiteralTemp ("in while body")); case ITERCLAUSE: return (cstring_makeLiteralTemp ("in iter body")); case FORCLAUSE: return (cstring_makeLiteralTemp ("in for body")); case CASECLAUSE: return (cstring_makeLiteralTemp ("in one case")); case NOCLAUSE: return (cstring_makeLiteralTemp ("in some clause")); case SWITCHCLAUSE: return (cstring_makeLiteralTemp ("in one possible execution")); case CONDCLAUSE: return (cstring_makeLiteralTemp ("in true condition")); case TRUEEXITCLAUSE: return (cstring_makeLiteralTemp ("in trueexit")); case FALSEEXITCLAUSE: return (cstring_makeLiteralTemp ("in falseexit")); } BADBRANCHRET (cstring_undefined); } cstring clause_nameAlternate (clause cl) { switch (cl) { case TRUECLAUSE: return (cstring_makeLiteralTemp ("in continuation")); case FALSECLAUSE: return (cstring_makeLiteralTemp ("in false branch")); case ANDCLAUSE: return (cstring_makeLiteralTemp ("in second and clause")); case ORCLAUSE: return (cstring_makeLiteralTemp ("in second or clause")); case DOWHILECLAUSE: return (cstring_makeLiteralTemp ("if loop is not taken")); case WHILECLAUSE: return (cstring_makeLiteralTemp ("if loop is not taken")); case ITERCLAUSE: return (cstring_makeLiteralTemp ("if iter body does not execute")); case FORCLAUSE: return (cstring_makeLiteralTemp ("if for loop body does not execute")); case CASECLAUSE: return (cstring_makeLiteralTemp ("in other case")); case NOCLAUSE: case SWITCHCLAUSE: return (cstring_makeLiteralTemp ("in other possible execution")); case CONDCLAUSE: return (cstring_makeLiteralTemp ("in false condition")); case TRUEEXITCLAUSE: return (cstring_makeLiteralTemp ("in trueexit")); case FALSEEXITCLAUSE: return (cstring_makeLiteralTemp ("in falseexit")); } BADBRANCHRET (cstring_undefined); } cstring clause_nameFlip (clause cl, bool flip) { if (flip) { return clause_nameAlternate (cl); } else { return clause_nameTaken (cl); } } bool clause_isBreakable (clause cl) { return (cl == SWITCHCLAUSE || cl == WHILECLAUSE || cl == DOWHILECLAUSE || cl == FORCLAUSE || cl == ITERCLAUSE); } bool clause_isLoop (clause cl) { return (cl == WHILECLAUSE || cl == FORCLAUSE || cl == ITERCLAUSE || cl == DOWHILECLAUSE); } bool clause_isConditional (clause cl) { return ( cl == TRUECLAUSE || cl == FALSECLAUSE || cl == WHILECLAUSE || cl == FORCLAUSE || cl == SWITCHCLAUSE || cl == ITERCLAUSE); } bool clause_isSwitch (clause cl) { return (cl == SWITCHCLAUSE); } bool clause_isCase (clause cl) { return (cl == CASECLAUSE); } bool clause_isNone (clause cl) { return (cl == NOCLAUSE); } splint-3.1.2.dfsg1/src/globalsClause.c0000644021234200000250000000355307646432515015200 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** globalsClause.c */ # include "splintMacros.nf" # include "basic.h" extern globalsClause globalsClause_create (lltok tok, globSet gl) { globalsClause res = (globalsClause) dmalloc (sizeof (*res)); res->globs = gl; res->loc = fileloc_copy (lltok_getLoc (tok)); lltok_free (tok); return res; /* releases doesn't seem to work right here... */ } globSet globalsClause_getGlobs (globalsClause gclause) { return gclause->globs; } globSet globalsClause_takeGlobs (globalsClause gclause) { globSet globs = gclause->globs; gclause->globs = globSet_undefined; return globs; } extern void globalsClause_free (globalsClause gclause) { if (gclause == NULL) { return; /* shouldn't ever need this? */ } globSet_free (gclause->globs); sfree (gclause); } extern cstring globalsClause_unparse (globalsClause node) { return message ("globals %q", globSet_unparse (node->globs)); } splint-3.1.2.dfsg1/src/modifiesClause.c0000644021234200000250000000432007630461221015332 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** modifiesClause.c */ # include "splintMacros.nf" # include "basic.h" extern modifiesClause modifiesClause_createNoMods (lltok tok) { modifiesClause res = (modifiesClause) dmalloc (sizeof (*res)); res->isnomods = TRUE; res->srs = sRefSet_undefined; res->loc = fileloc_copy (lltok_getLoc (tok)); lltok_free (tok); return res; } extern modifiesClause modifiesClause_create (lltok tok, sRefSet rfs) { modifiesClause res = (modifiesClause) dmalloc (sizeof (*res)); res->isnomods = FALSE; res->srs = rfs; res->loc = fileloc_copy (lltok_getLoc (tok)); lltok_free (tok); return res; } extern void modifiesClause_free (modifiesClause mclause) { sRefSet_free (mclause->srs); fileloc_free (mclause->loc); sfree (mclause); } extern cstring modifiesClause_unparse (modifiesClause node) { if (node->isnomods) { return cstring_makeLiteral ("modifies nothing"); } else { return message ("modifies %q", sRefSet_unparse (node->srs)); } } extern sRefSet modifiesClause_getMods (modifiesClause m) { llassert (!m->isnomods); return m->srs; } extern sRefSet modifiesClause_takeMods (modifiesClause m) { sRefSet mods; llassert (!m->isnomods); mods = m->srs; m->srs = sRefSet_undefined; return mods; } splint-3.1.2.dfsg1/src/warnClause.c0000644021234200000250000000747407630461222014520 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** warnClause.c */ # include "splintMacros.nf" # include "basic.h" static warnClause warnClause_createAux (/*@only@*/ fileloc loc, /*@only@*/ flagSpec flag, /*@only@*/ cstring msg) { warnClause res = (warnClause) dmalloc (sizeof (*res)); res->loc = loc; res->flag = flag; res->msg = msg; DPRINTF (("Creating warn clause with flag spec: [%p] %s", flag, flagSpec_unparse (flag))); return res; } extern warnClause warnClause_create (lltok tok, flagSpec flag, cstring msg) { warnClause res; /* ** evans 2002-03-11 ** was ** res = warnClause_createAux (lltok_stealLoc (tok), flag, msg); ** but this leads to unexplained (yet) crashes. ** Reported by Walter Briscoe */ res = warnClause_createAux (fileloc_copy (lltok_getLoc (tok)), flag, msg); lltok_free (tok); return res; } warnClause warnClause_copy (warnClause w) { if (warnClause_isDefined (w)) { return warnClause_createAux (fileloc_copy (w->loc), flagSpec_copy (w->flag), cstring_copy (w->msg)); } else { return warnClause_undefined; } } extern flagSpec warnClause_getFlag (warnClause w) { llassert (warnClause_isDefined (w)); return w->flag; } extern cstring warnClause_unparse (warnClause w) { if (warnClause_isDefined (w)) { return message ("<%q> %s", flagSpec_unparse (w->flag), w->msg); } else { return cstring_undefined; } } extern bool warnClause_hasMessage (warnClause w) { return warnClause_isDefined (w) && cstring_isDefined (w->msg); } extern /*@observer@*/ cstring warnClause_getMessage (warnClause w) { if (warnClause_isDefined (w)) { return w->msg; } else { return cstring_undefined; } } extern void warnClause_free (warnClause w) { if (warnClause_isDefined (w)) { flagSpec_free (w->flag); fileloc_free (w->loc); cstring_free (w->msg); sfree (w); } } /*@only@*/ cstring warnClause_dump (warnClause wc) { cstring st = cstring_undefined; llassert (warnClause_isDefined (wc)); llassert (!cstring_containsChar (warnClause_getMessage (wc), '#')); if (warnClause_hasMessage (wc)) { llassert (cstring_firstChar (warnClause_getMessage (wc)) != '.'); st = message ("%q#%s#", flagSpec_dump (wc->flag), warnClause_getMessage (wc)); } else { st = message ("%q#.#", flagSpec_dump (wc->flag)); } return st; } warnClause warnClause_undump (char **s) { flagSpec flag; cstring msg; DPRINTF (("Undump: %s", *s)); flag = flagSpec_undump (s); DPRINTF (("Here: %s", *s)); reader_checkChar (s, '#'); DPRINTF (("Here: %s", *s)); if (reader_optCheckChar (s, '.')) { msg = cstring_undefined; } else { msg = reader_readUntil (s, '#'); } DPRINTF (("Here: %s", *s)); reader_checkChar (s, '#'); return warnClause_createAux (fileloc_copy (g_currentloc), flag, msg); } splint-3.1.2.dfsg1/src/functionClause.c0000644021234200000250000001476307646432515015407 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** functionClause.c */ # include "splintMacros.nf" # include "basic.h" static /*@only@*/ /*@notnull@*/ /*@special@*/ functionClause functionClause_alloc (functionClauseKind kind) /*@defines result->kind@*/ { functionClause res = (functionClause) dmalloc (sizeof (*res)); res->kind = kind; return res; } extern functionClause functionClause_createGlobals (globalsClause node) /*@*/ { functionClause res = functionClause_alloc (FCK_GLOBALS); res->val.globals = node; return res; } extern functionClause functionClause_createModifies (modifiesClause node) /*@*/ { functionClause res = functionClause_alloc (FCK_MODIFIES); res->val.modifies = node; return res; } extern functionClause functionClause_createState (stateClause node) /*@*/ { if (stateClause_hasEmptyReferences (node) && (!stateClause_isMetaState (node) ) ) { DPRINTF((message("functionClause_createState:: Returning functionClause_undefined" ) )); stateClause_free (node); return functionClause_undefined; } else { functionClause res = functionClause_alloc (FCK_STATE); res->val.state = node; return res; } } extern functionClause functionClause_createEnsures (functionConstraint node) /*@*/ { functionClause res = functionClause_alloc (FCK_ENSURES); res->val.constraint = node; return res; } extern functionClause functionClause_createRequires (functionConstraint node) /*@*/ { functionClause res = functionClause_alloc (FCK_REQUIRES); res->val.constraint = node; return res; } extern functionClause functionClause_createWarn (warnClause node) /*@*/ { functionClause res = functionClause_alloc (FCK_WARN); res->val.warn = node; return res; } /*@only@*/ cstring functionClause_unparse (functionClause p) { if (functionClause_isUndefined (p)) { return cstring_undefined; } switch (p->kind) { case FCK_GLOBALS: return globalsClause_unparse (p->val.globals); case FCK_MODIFIES: return modifiesClause_unparse (p->val.modifies); case FCK_WARN: return warnClause_unparse (p->val.warn); case FCK_STATE: return stateClause_unparse (p->val.state); case FCK_ENSURES: return message ("ensures %q", functionConstraint_unparse (p->val.constraint)); case FCK_REQUIRES: return message ("requires %q", functionConstraint_unparse (p->val.constraint)); case FCK_DEAD: return cstring_makeLiteral (""); } BADBRANCHRET (cstring_undefined); } extern bool functionClause_matchKind (functionClause p, functionClauseKind kind) /*@*/ { if (functionClause_isDefined (p)) { return (p->kind == kind); } else { return FALSE; } } extern stateClause functionClause_getState (functionClause node) { llassert (functionClause_isDefined (node)); llassert (node->kind == FCK_STATE); return node->val.state; } extern stateClause functionClause_takeState (functionClause fc) { stateClause res; llassert (functionClause_isDefined (fc)); llassert (fc->kind == FCK_STATE); res = fc->val.state; fc->val.state = NULL; fc->kind = FCK_DEAD; return res; } extern functionConstraint functionClause_getEnsures (functionClause node) { llassert (functionClause_isDefined (node)); llassert (node->kind == FCK_ENSURES); return node->val.constraint; } extern functionConstraint functionClause_takeEnsures (functionClause fc) { functionConstraint res; llassert (functionClause_isDefined (fc)); llassert (fc->kind == FCK_ENSURES); res = fc->val.constraint; fc->val.constraint = NULL; fc->kind = FCK_DEAD; return res; } extern functionConstraint functionClause_getRequires (functionClause node) { llassert (functionClause_isDefined (node)); llassert (node->kind == FCK_REQUIRES); return node->val.constraint; } extern functionConstraint functionClause_takeRequires (functionClause fc) { functionConstraint res; llassert (functionClause_isDefined (fc)); llassert (fc->kind == FCK_REQUIRES); res = fc->val.constraint; fc->val.constraint = NULL; fc->kind = FCK_DEAD; return res; } extern warnClause functionClause_getWarn (functionClause node) { llassert (functionClause_isDefined (node)); llassert (node->kind == FCK_WARN); return node->val.warn; } extern warnClause functionClause_takeWarn (functionClause fc) { warnClause res; llassert (functionClause_isDefined (fc)); llassert (fc->kind == FCK_WARN); res = fc->val.warn; fc->val.warn = warnClause_undefined; fc->kind = FCK_DEAD; return res; } extern modifiesClause functionClause_getModifies (functionClause node) { llassert (functionClause_isDefined (node)); llassert (node->kind == FCK_MODIFIES); return node->val.modifies; } extern globalsClause functionClause_getGlobals (functionClause node) { llassert (functionClause_isDefined (node)); llassert (node->kind == FCK_GLOBALS); return node->val.globals; } extern void functionClause_free (/*@only@*/ functionClause node) { if (node != NULL) { DPRINTF (("free: %s", functionClause_unparse (node))); switch (node->kind) { case FCK_GLOBALS: globalsClause_free (node->val.globals); break; case FCK_MODIFIES: modifiesClause_free (node->val.modifies); break; case FCK_WARN: warnClause_free (node->val.warn); break; case FCK_STATE: stateClause_free (node->val.state); break; case FCK_ENSURES: functionConstraint_free (node->val.constraint); break; case FCK_REQUIRES: functionConstraint_free (node->val.constraint); break; case FCK_DEAD: /* Nothing to release */ break; } sfree (node); } } splint-3.1.2.dfsg1/src/functionClauseList.c0000644021234200000250000001270107765024013016221 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** functionClauseList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" functionClauseList functionClauseList_new () { return functionClauseList_undefined; } static /*@notnull@*/ functionClauseList functionClauseList_newEmpty (void) { functionClauseList s = (functionClauseList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = functionClauseListBASESIZE; s->elements = (functionClause *) dmalloc (sizeof (*s->elements) * functionClauseListBASESIZE); return (s); } static void functionClauseList_grow (/*@notnull@*/ functionClauseList s) { int i; functionClause *newelements; s->nspace += functionClauseListBASESIZE; newelements = (functionClause *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (functionClause *) 0) { llfatalerror (cstring_makeLiteral ("functionClauseList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } functionClauseList functionClauseList_single (/*@keep@*/ functionClause el) { functionClauseList s = functionClauseList_new (); s = functionClauseList_add (s, el); return s; } functionClauseList functionClauseList_add (functionClauseList s, /*@keep@*/ functionClause el) { if (!functionClauseList_isDefined (s)) { s = functionClauseList_newEmpty (); } if (s->nspace <= 0) { functionClauseList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } functionClauseList functionClauseList_prepend (functionClauseList s, /*@keep@*/ functionClause el) { int i; if (!functionClauseList_isDefined (s)) { return functionClauseList_single (el); } if (s->nspace <= 0) { functionClauseList_grow (s); } s->nspace--; for (i = s->nelements; i > 0; i--) { s->elements[i] = s->elements [i - 1]; } s->elements[0] = el; s->nelements++; return s; } cstring functionClauseList_unparse (functionClauseList s) { return functionClauseList_unparseSep (s, cstring_makeLiteralTemp (" ")); } cstring functionClauseList_unparseSep (functionClauseList s, cstring sep) { cstring st = cstring_undefined; if (functionClauseList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = functionClause_unparse (s->elements[i]); } else st = message ("%q%s%q", st, sep, functionClause_unparse (s->elements[i])); } } return st; } void functionClauseList_free (functionClauseList s) { if (functionClauseList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { functionClause_free (s->elements[i]); } sfree (s->elements); sfree (s); } } functionClauseList functionClauseList_setImplicitConstraints (/*@returned@*/ functionClauseList s) { bool addedConstraints; constraintList c; DPRINTF ((message ("functionClauseList_setImplicitConstraints called ") )); addedConstraints = FALSE; c = getImplicitFcnConstraints (); if (constraintList_isEmpty(c) ) { return s; } functionClauseList_elements(s, el) { if (functionClause_isRequires(el)) { functionConstraint con = functionClause_getRequires(el); if (functionConstraint_hasBufferConstraint(con)) { if (functionConstraint_isBufferConstraint (con)) { constraintList implCons = getImplicitFcnConstraints (); DPRINTF ((message ("functionClauseList_ImplicitConstraints adding the implict constraints: %s to %s", constraintList_unparse(implCons), constraintList_unparse (con->constraint.buffer)))); functionConstraint_addBufferConstraints (con, constraintList_copy (implCons) ); addedConstraints = TRUE; DPRINTF ((message ("functionClauseList_ImplicitConstraints the new constraint is %s", functionConstraint_unparse (con)))); } else { llassert (FALSE); } } } } end_functionClauseList_elements; if (!addedConstraints) { functionConstraint fCon; functionClause fClause; constraintList implCons = getImplicitFcnConstraints (); fCon = functionConstraint_createBufferConstraint(constraintList_copy (implCons) ); fClause = functionClause_createRequires(fCon); s = functionClauseList_add(s, fClause); } return s; } splint-3.1.2.dfsg1/src/metaStateConstraint.c0000644021234200000250000000406207630461221016375 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** metaStateConstraint.c */ # include "splintMacros.nf" # include "basic.h" metaStateConstraint metaStateConstraint_create (/*@only@*/ metaStateSpecifier lspec, /*@only@*/ metaStateExpression rspec) { metaStateConstraint res = (metaStateConstraint) dmalloc (sizeof (*res)); res->lspec = lspec; res->rspec = rspec; return res; } cstring metaStateConstraint_unparse (metaStateConstraint m) { return message ("%q = %q", metaStateSpecifier_unparse (m->lspec), metaStateExpression_unparse (m->rspec)); } metaStateConstraint metaStateConstraint_copy (metaStateConstraint m) { return metaStateConstraint_create (metaStateSpecifier_copy (m->lspec), metaStateExpression_copy (m->rspec)); } /*@observer@*/ metaStateSpecifier metaStateConstraint_getSpecifier (metaStateConstraint m) { return m->lspec; } /*@observer@*/ metaStateExpression metaStateConstraint_getExpression (metaStateConstraint m) { return m->rspec; } void metaStateConstraint_free (/*@only@*/ metaStateConstraint m) { metaStateSpecifier_free (m->lspec); metaStateExpression_free (m->rspec); sfree (m); } splint-3.1.2.dfsg1/src/metaStateConstraintList.c0000644021234200000250000001051307630461221017227 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** metaStateConstraintList.c (from slist_template.c) */ # include "splintMacros.nf" # include "basic.h" # include "metaStateConstraintList.h" /* ** Invariant: If any member of the list is metaStateConstraint_undefined, then ** the 0th member is metaStateConstraint_undefined. */ metaStateConstraintList metaStateConstraintList_new () { return (metaStateConstraintList_undefined); } static /*@notnull@*/ /*@only@*/ metaStateConstraintList metaStateConstraintList_newEmpty (void) { metaStateConstraintList s = (metaStateConstraintList) dmalloc (sizeof (*s)); s->nelements = 0; s->free = metaStateConstraintListBASESIZE; s->elements = (metaStateConstraint *) dmalloc (sizeof (*s->elements) * metaStateConstraintListBASESIZE); return (s); } static void metaStateConstraintList_grow (/*@notnull@*/ metaStateConstraintList s) { int i; metaStateConstraint *oldelements = s->elements; s->free += metaStateConstraintListBASESIZE; s->elements = (metaStateConstraint *) dmalloc (sizeof (*s->elements) * (s->nelements + s->free)); for (i = 0; i < s->nelements; i++) { s->elements[i] = oldelements[i]; } sfree (oldelements); } metaStateConstraintList metaStateConstraintList_append (/*@returned@*/ metaStateConstraintList s, /*@only@*/ metaStateConstraintList t) { llassert (NOALIAS (s, t)); if (metaStateConstraintList_isUndefined (t) || metaStateConstraintList_isEmpty (t)) return s; if (metaStateConstraintList_isUndefined (s)) { s = metaStateConstraintList_newEmpty (); } metaStateConstraintList_elements (t, fl) { /* Okay to use exposed storage here, t is begin eaten. */ /*@-exposetrans@*/ /*@-dependenttrans@*/ s = metaStateConstraintList_add (s, fl); /*@=exposetrans@*/ /*@=dependenttrans@*/ } end_metaStateConstraintList_elements; sfree (t->elements); sfree (t); return s; } metaStateConstraintList metaStateConstraintList_add (/*@returned@*/ metaStateConstraintList s, /*@observer@*/ metaStateConstraint el) { if (metaStateConstraintList_isUndefined (s)) { s = metaStateConstraintList_newEmpty (); } if (s->free <= 0) { metaStateConstraintList_grow (s); } s->free--; s->elements[s->nelements] = el; s->nelements++; return s; } metaStateConstraintList metaStateConstraintList_single (metaStateConstraint el) { metaStateConstraintList res = metaStateConstraintList_newEmpty (); return metaStateConstraintList_add (res, el); } metaStateConstraint metaStateConstraintList_getFirst (metaStateConstraintList s) { llassert (metaStateConstraintList_isDefined (s) && metaStateConstraintList_size (s) >= 1); return s->elements[0]; } /*@only@*/ cstring metaStateConstraintList_unparse (metaStateConstraintList s) { int i; cstring st = cstring_makeLiteral ("["); if (metaStateConstraintList_isDefined (s)) { for (i = 0; i < metaStateConstraintList_size (s); i++) { if (i == 0) { st = message ("%q %q", st, metaStateConstraint_unparse (s->elements[i])); } else st = message ("%q, %q", st, metaStateConstraint_unparse (s->elements[i])); } } st = message ("%q ]", st); return st; } void metaStateConstraintList_free (/*@only@*/ metaStateConstraintList s) { if (metaStateConstraintList_isDefined (s)) { sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/metaStateExpression.c0000644021234200000250000000547207630461221016416 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** metaStateExpression.c */ # include "splintMacros.nf" # include "basic.h" metaStateExpression metaStateExpression_create (/*@only@*/ metaStateSpecifier spec) { metaStateExpression res = (metaStateExpression) dmalloc (sizeof (*res)); res->spec = spec; res->rest = NULL; return res; } metaStateExpression metaStateExpression_createMerge (/*@only@*/ metaStateSpecifier spec, /*@only@*/ metaStateExpression exp) { metaStateExpression res = (metaStateExpression) dmalloc (sizeof (*res)); res->spec = spec; res->rest = exp; return res; } cstring metaStateExpression_unparse (metaStateExpression m) { llassert (m != NULL); if (m->rest != NULL) { return message ("%q | %q", metaStateSpecifier_unparse (m->spec), metaStateExpression_unparse (m->rest)); } else { return metaStateSpecifier_unparse (m->spec); } } metaStateExpression metaStateExpression_copy (metaStateExpression m) { if (m == NULL) return NULL; if (m->rest != NULL) { return metaStateExpression_createMerge (metaStateSpecifier_copy (m->spec), metaStateExpression_copy (m->rest)); } else { return metaStateExpression_create (metaStateSpecifier_copy (m->spec)); } } metaStateSpecifier metaStateExpression_getSpecifier (metaStateExpression m) { llassert (m != NULL); return m->spec; } bool metaStateExpression_isMerge (metaStateExpression m) { return (metaStateExpression_isDefined (m) && metaStateExpression_isDefined (m->rest)); } /*@observer@*/ metaStateExpression metaStateExpression_getRest (metaStateExpression m) { llassert (m != NULL); return m->rest; } void metaStateExpression_free (/*@only@*/ metaStateExpression m) { llassert (m != NULL); metaStateSpecifier_free (m->spec); if (m->rest != NULL) { metaStateExpression_free (m->rest); } sfree (m); } splint-3.1.2.dfsg1/src/metaStateSpecifier.c0000644021234200000250000000500107630461221016154 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** metaStateSpecifier.c */ # include "splintMacros.nf" # include "basic.h" metaStateSpecifier metaStateSpecifier_create (/*@only@*/ sRef sr, /*@observer@*/ metaStateInfo msinfo) { metaStateSpecifier res = (metaStateSpecifier) dmalloc (sizeof (*res)); res->sr = sr; res->msinfo = msinfo; res->elipsis = FALSE; return res; } metaStateSpecifier metaStateSpecifier_createElipsis (/*@observer@*/ metaStateInfo msinfo) { metaStateSpecifier res = (metaStateSpecifier) dmalloc (sizeof (*res)); res->sr = sRef_undefined; res->msinfo = msinfo; res->elipsis = TRUE; return res; } bool metaStateSpecifier_isElipsis (metaStateSpecifier m) { return m->elipsis; } sRef metaStateSpecifier_getSref (metaStateSpecifier m) { llassert (!metaStateSpecifier_isElipsis (m)); return m->sr; } metaStateInfo metaStateSpecifier_getMetaStateInfo (metaStateSpecifier m) { return m->msinfo; } metaStateSpecifier metaStateSpecifier_copy (metaStateSpecifier m) { if (metaStateSpecifier_isElipsis (m)) { return metaStateSpecifier_createElipsis (m->msinfo); } else { return metaStateSpecifier_create (sRef_saveCopy (m->sr), m->msinfo); } } cstring metaStateSpecifier_unparse (metaStateSpecifier m) { if (m->elipsis) { return message ("...:%s", metaStateInfo_getName (m->msinfo)); } else { return message ("%q:%s", sRef_unparse (m->sr), metaStateInfo_getName (m->msinfo)); } } void metaStateSpecifier_free (/*@only@*/ metaStateSpecifier m) { sRef_free (m->sr); sfree (m); } splint-3.1.2.dfsg1/src/functionConstraint.c0000644021234200000250000001536307646432515016314 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** functionConstraint.c */ # include "splintMacros.nf" # include "basic.h" static /*@only@*/ /*@notnull@*/ /*@special@*/ functionConstraint functionConstraint_alloc (functionConstraintKind kind) /*@defines result->kind@*/ { functionConstraint res = (functionConstraint) dmalloc (sizeof (*res)); res->kind = kind; return res; } extern functionConstraint functionConstraint_createBufferConstraint (constraintList buf) { functionConstraint res = functionConstraint_alloc (FCT_BUFFER); res->constraint.buffer = buf; return res; } extern functionConstraint functionConstraint_createMetaStateConstraint (metaStateConstraint msc) { functionConstraint res = functionConstraint_alloc (FCT_METASTATE); res->constraint.metastate = msc; return res; } extern functionConstraint functionConstraint_conjoin (functionConstraint f1, functionConstraint f2) { functionConstraint res = functionConstraint_alloc (FCT_CONJUNCT); res->constraint.conjunct.op1 = f1; res->constraint.conjunct.op2 = f2; DPRINTF (("Conjoining ==> %s", functionConstraint_unparse (res))); return res; } /*@only@*/ cstring functionConstraint_unparse (functionConstraint p) { if (functionConstraint_isDefined (p)) { switch (p->kind) { case FCT_BUFFER: return constraintList_unparse (p->constraint.buffer); case FCT_METASTATE: return metaStateConstraint_unparse (p->constraint.metastate); case FCT_CONJUNCT: return message ("%q /\\ %q", functionConstraint_unparse (p->constraint.conjunct.op1), functionConstraint_unparse (p->constraint.conjunct.op2)); BADDEFAULT; } BADBRANCH; } else { return cstring_makeLiteral ("< empty constraint >"); } } extern constraintList functionConstraint_getBufferConstraints (functionConstraint node) { if (functionConstraint_isDefined (node)) { if (node->kind == FCT_CONJUNCT) { /* make sure this is safe*/ return constraintList_addListFree (functionConstraint_getBufferConstraints (node->constraint.conjunct.op1), functionConstraint_getBufferConstraints (node->constraint.conjunct.op2)); } else { if (node->kind == FCT_BUFFER) { return constraintList_copy (node->constraint.buffer); } else { return constraintList_undefined; } } } else { return constraintList_undefined; } } extern metaStateConstraintList functionConstraint_getMetaStateConstraints (functionConstraint node) { if (functionConstraint_isDefined (node)) { if (node->kind == FCT_CONJUNCT) { return metaStateConstraintList_append (functionConstraint_getMetaStateConstraints (node->constraint.conjunct.op1), functionConstraint_getMetaStateConstraints (node->constraint.conjunct.op2)); } else { if (node->kind == FCT_METASTATE) { return metaStateConstraintList_single (node->constraint.metastate); } else { return metaStateConstraintList_undefined; } } } else { return metaStateConstraintList_undefined; } } extern bool functionConstraint_hasBufferConstraint (functionConstraint node) { if (functionConstraint_isDefined (node)) { return node->kind == FCT_BUFFER || (node->kind == FCT_CONJUNCT && (functionConstraint_hasBufferConstraint (node->constraint.conjunct.op1) || functionConstraint_hasBufferConstraint (node->constraint.conjunct.op2))); } else { return FALSE; } } extern bool functionConstraint_hasMetaStateConstraint (functionConstraint node) { if (functionConstraint_isDefined (node)) { return node->kind == FCT_METASTATE || (node->kind == FCT_CONJUNCT && (functionConstraint_hasMetaStateConstraint (node->constraint.conjunct.op1) || functionConstraint_hasMetaStateConstraint (node->constraint.conjunct.op2))); } else { return FALSE; } } extern functionConstraint functionConstraint_copy (functionConstraint node) { if (functionConstraint_isDefined (node)) { switch (node->kind) { case FCT_BUFFER: return functionConstraint_createBufferConstraint (constraintList_copy (node->constraint.buffer)); case FCT_METASTATE: return functionConstraint_createMetaStateConstraint (metaStateConstraint_copy (node->constraint.metastate)); case FCT_CONJUNCT: return functionConstraint_conjoin (functionConstraint_copy (node->constraint.conjunct.op1), functionConstraint_copy (node->constraint.conjunct.op2)); } BADBRANCH; } else { return functionConstraint_undefined; } BADBRANCHRET (functionConstraint_undefined); } extern void functionConstraint_free (/*@only@*/ functionConstraint node) { if (functionConstraint_isDefined (node)) { switch (node->kind) { case FCT_BUFFER: constraintList_free (node->constraint.buffer); break; case FCT_METASTATE: metaStateConstraint_free (node->constraint.metastate); break; case FCT_CONJUNCT: functionConstraint_free (node->constraint.conjunct.op1); functionConstraint_free (node->constraint.conjunct.op2); break; BADDEFAULT; } sfree (node); } } /*drl modified */ void functionConstraint_addBufferConstraints (functionConstraint node, constraintList clist) { constraintList temp; temp = constraintList_copy (clist); if (functionConstraint_isDefined (node)) { if (node->kind == FCT_CONJUNCT) { functionConstraint_addBufferConstraints (node->constraint.conjunct.op1, constraintList_copy(temp) ); functionConstraint_addBufferConstraints (node->constraint.conjunct.op2,temp); } else { if (node->kind == FCT_BUFFER) { node->constraint.buffer = constraintList_addListFree(node->constraint.buffer, temp); } else { constraintList_free (temp); return; } } } else { constraintList_free (temp); return; } } splint-3.1.2.dfsg1/src/pointers.c0000644021234200000250000000613607630461221014250 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** pointers.c */ # include "splintMacros.nf" # include "basic.h" pointers pointers_create (lltok tok) { return pointers_createMods (tok, qualList_undefined); } pointers pointers_createMods (/*@unused@*/ lltok tok, qualList quals) { pointers res = (pointers) dmalloc (sizeof (*res)); res->quals = quals; res->rest = pointers_undefined; return res; } pointers pointers_createMt (mttok tok) { return pointers_createModsMt (tok, qualList_undefined); } pointers pointers_createLt (ltoken tok) { return pointers_createModsLt (tok, qualList_undefined); } pointers pointers_createModsMt (/*@unused@*/ mttok tok, qualList quals) { pointers res = (pointers) dmalloc (sizeof (*res)); res->quals = quals; res->rest = pointers_undefined; return res; } pointers pointers_createModsLt (/*@unused@*/ ltoken tok, qualList quals) { pointers res = (pointers) dmalloc (sizeof (*res)); res->quals = quals; res->rest = pointers_undefined; return res; } pointers pointers_extend (pointers p1, pointers p2) { llassert (pointers_isDefined (p1)); llassert (pointers_isUndefined (p1->rest)); p1->rest = p2; return p1; } pointers pointers_getRest (pointers p) { llassert (pointers_isDefined (p)); return p->rest; } cstring pointers_unparse (pointers p) { if (pointers_isDefined (p)) { if (qualList_isDefined (p->quals)) { if (pointers_isDefined (p->rest)) { return (message ("* %q %q", qualList_unparse (p->quals), pointers_unparse (p->rest))); } else { return (message ("* %q", qualList_unparse (p->quals))); } } else { if (pointers_isDefined (p->rest)) { return (message ("* %q", pointers_unparse (p->rest))); } else { return (cstring_makeLiteral ("*")); } } } else { return cstring_undefined; } } int pointers_depth (pointers p) { if (pointers_isUndefined (p)) { return 0; } else { return 1 + pointers_depth (p->rest); } } void pointers_free (/*@only@*/ pointers p) { if (pointers_isDefined (p)) { qualList_free (p->quals); pointers_free (p->rest); sfree (p); } } splint-3.1.2.dfsg1/src/cscannerHelp.c0000644021234200000250000016572110102766473015025 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cscannerHelp.c - procedures for scanning C ** ** Most of this code was in cscanner.l, but moved here to separate it ** from the flex-generated code. */ # include "splintMacros.nf" # include "basic.h" # include "cscannerHelp.h" # include "cscanner.h" # include "cgrammar_tokens.h" # include "osd.h" static int lminput (void); static int s_tokLength = 0; static /*@owned@*/ cstring s_lastidprocessed = cstring_undefined; static bool s_inSpecPart = FALSE; static int s_whichSpecPart; static char s_savechar = '\0'; static bool s_expectingMetaStateName = FALSE; static bool s_lastWasString = FALSE; static bool s_expectingTypeName = TRUE; struct skeyword { /*@null@*/ /*@observer@*/ char *name; int token; } ; /* ** These tokens are followed by syntax that is parsed by the ** grammar proper. */ static struct skeyword s_parsetable[] = { { "modifies", QMODIFIES } , { "globals", QGLOBALS } , { "alt", QALT } , { "warn", QWARN } , { "constant", QCONSTANT } , { "function", QFUNCTION } , { "iter", QITER } , { "defines", QDEFINES } , { "uses", QUSES } , { "allocates", QALLOCATES } , { "sets", QSETS } , { "releases", QRELEASES } , { "pre", QPRECLAUSE } , { "post", QPOSTCLAUSE } , { "setBufferSize", QSETBUFFERSIZE}, { "setStringLength", QSETSTRINGLENGTH}, { "testinRange", QTESTINRANGE}, { "requires", QPRECLAUSE } , { "ensures", QPOSTCLAUSE } , { "invariant", QINVARIANT} , { NULL, BADTOK } } ; /* ** These tokens are either stand-alone tokens, or followed by ** token-specific text. */ static struct skeyword s_keytable[] = { { "anytype", QANYTYPE } , { "integraltype", QINTEGRALTYPE } , { "unsignedintegraltype", QUNSIGNEDINTEGRALTYPE } , { "signedintegraltype", QSIGNEDINTEGRALTYPE } , { "out", QOUT } , { "in", QIN } , { "only", QONLY } , { "owned", QOWNED } , { "dependent", QDEPENDENT } , { "partial", QPARTIAL } , { "special", QSPECIAL } , { "truenull", QTRUENULL } , { "falsenull", QFALSENULL } , { "nullwhentrue", QTRUENULL } , { "falsewhennull", QFALSENULL } , { "keep", QKEEP } , { "kept", QKEPT } , { "notnull", QNOTNULL } , { "abstract", QABSTRACT } , { "numabstract", QNUMABSTRACT } , { "concrete", QCONCRETE } , { "mutable", QMUTABLE } , { "immutable", QIMMUTABLE } , { "unused", QUNUSED } , { "external", QEXTERNAL } , { "sef", QSEF } , { "unique", QUNIQUE } , { "returned", QRETURNED } , { "exposed", QEXPOSED } , { "refcounted", QREFCOUNTED } , { "refs", QREFS } , { "newref", QNEWREF } , { "tempref", QTEMPREF } , { "killref", QKILLREF } , { "null", QNULL } , { "relnull", QRELNULL } , { "nullterminated", QNULLTERMINATED }, { "setBufferSize", QSETBUFFERSIZE }, { "testInRange", QTESTINRANGE}, { "isnull", QISNULL }, { "MaxSet", QMAXSET}, { "MaxRead", QMAXREAD}, { "maxSet", QMAXSET}, { "maxRead", QMAXREAD}, { "reldef", QRELDEF } , { "observer", QOBSERVER } , { "exits", QEXITS } , { "noreturn", QEXITS } , { "mayexit", QMAYEXIT } , { "maynotreturn", QMAYEXIT } , { "trueexit", QTRUEEXIT } , { "falseexit", QFALSEEXIT } , { "noreturnwhentrue", QTRUEEXIT } , { "noreturnwhenfalse", QFALSEEXIT } , { "neverexit", QNEVEREXIT } , { "alwaysreturns", QNEVEREXIT } , { "temp", QTEMP } , { "shared", QSHARED } , { "ref", QREF } , { "unchecked", QUNCHECKED } , { "checked", QCHECKED } , { "checkmod", QCHECKMOD } , { "checkedstrict", QCHECKEDSTRICT } , { "innercontinue", QINNERCONTINUE } , { "innerbreak", QINNERBREAK } , { "loopbreak", QLOOPBREAK } , { "switchbreak", QSWITCHBREAK } , { "safebreak", QSAFEBREAK } , { "fallthrough", QFALLTHROUGH } , { "l_fallthrou", QLINTFALLTHROUGH } , { "l_fallth", QLINTFALLTHRU } , { "notreached", QNOTREACHED } , { "l_notreach", QLINTNOTREACHED } , { "printflike", QPRINTFLIKE } , { "l_printfli", QLINTPRINTFLIKE } , { "scanflike", QSCANFLIKE } , { "messagelike", QMESSAGELIKE } , { "l_argsus", QARGSUSED } , { NULL, BADTOK } } ; /* ** would be better if these weren't hard coded... */ static bool isArtificial (cstring s) { return (cstring_equalLit (s, "modifies") || cstring_equalLit (s, "globals") || cstring_equalLit (s, "warn") || cstring_equalLit (s, "alt")); } void cscannerHelp_swallowMacro (void) { int i; bool skipnext = FALSE; while ((i = lminput ()) != EOF) { char c = (char) i; if (c == '\\') { skipnext = TRUE; } else if (c == '\n') { if (skipnext) { skipnext = FALSE; } else { reader_checkUngetc (i, yyin); return; } } else { ; } } if (i != EOF) { reader_checkUngetc (i, yyin); } } static int commentMarkerToken (cstring s) { int i = 0; while (s_parsetable[i].name != NULL) { DPRINTF (("Try :%s:%s:", s, s_parsetable[i].name)); if (cstring_equalLit (s, s_parsetable[i].name)) { return s_parsetable[i].token; } i++; } return BADTOK; } static int tokenMacroCode (cstring s) { int i = 0; while (s_keytable[i].name != NULL) { if (cstring_equalLit (s, s_keytable[i].name)) { if (s_keytable[i].token == QLINTFALLTHROUGH) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*FALLTHROUGH*/ used. " "Splint interprets this in the same way as most Unix lints, but it is " "preferable to replace it with the /*@fallthrough@*/ " "semantic comment"), g_currentloc); return QFALLTHROUGH; } else if (s_keytable[i].token == QLINTFALLTHRU) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*FALLTHRU*/ used. " "Splint interprets this in the same way as most Unix lints, but it is " "preferable to replace it with the /*@fallthrough@*/ " "semantic comment"), g_currentloc); return QFALLTHROUGH; } else if (s_keytable[i].token == QLINTNOTREACHED) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*NOTREACHED*/ used. " "Splint interprets this in the same way as most Unix lints, but it is " "preferable to replace it with the /*@notreached@*/ " "semantic comment."), g_currentloc); return QNOTREACHED; } else if (s_keytable[i].token == QPRINTFLIKE) { setSpecialFunction (qual_createPrintfLike ()); return SKIPTOK; } else if (s_keytable[i].token == QLINTPRINTFLIKE) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*PRINTFLIKE*/ used. " "Splint interprets this in the same way as most Unix lints, but it is " "preferable to replace it with either /*@printflike@*/, " "/*@scanflike@*/ or /*@messagelike@*/."), g_currentloc); setSpecialFunction (qual_createPrintfLike ()); return SKIPTOK; } else if (s_keytable[i].token == QSCANFLIKE) { setSpecialFunction (qual_createScanfLike ()); return SKIPTOK; } else if (s_keytable[i].token == QMESSAGELIKE) { setSpecialFunction (qual_createMessageLike ()); return SKIPTOK; } else if (s_keytable[i].token == QARGSUSED) { voptgenerror (FLG_WARNLINTCOMMENTS, cstring_makeLiteral ("Traditional lint comment /*ARGSUSED*/ used. " "Splint interprets this in the same way as most Unix lints, but it is " "preferable to use /*@unused@*/ annotations on " "the unused parameters."), g_currentloc); setArgsUsed (); return SKIPTOK; } else { return s_keytable[i].token; } } i++; } return BADTOK; } static int lminput () { if (s_savechar == '\0') { incColumn (); return (cscanner_input ()); } else { int save = (int) s_savechar; s_savechar = '\0'; return save; } } static void lmsavechar (char c) { if (s_savechar == '\0') { s_savechar = c; } else { llbuglit ("lmsavechar: override"); } } int cscannerHelp_ninput () { int c = lminput (); if (c != EOF && ((char)c == '\n')) { context_incLineno (); } return c; } static char macro_nextChar (void) { static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE; int ic; char c; ic = lminput (); c = char_fromInt (ic); if (!in_quote && !in_char && (c == '\\' || c == BEFORE_COMMENT_MARKER[0])) { if (c == '\\') { while ((c = char_fromInt (lminput ())) != '\0' && c != '\n') { ; /* skip to newline */ } context_incLineno (); if (c != '\0') { return macro_nextChar (); } else { return c; } } else /* if (c == '@') */ { llassert (FALSE); if (cscannerHelp_handleLlSpecial () != BADTOK) { llerrorlit (FLG_SYNTAX, "Macro cannot use special syntax"); } return macro_nextChar (); } } else if (!in_escape && c == '\"') { in_quote = !in_quote; } else if (!in_escape && c == '\'') { in_char = !in_char; } else if ((in_quote || in_char) && c == '\\') { in_escape = !in_escape; } else if ((in_quote || in_char) && in_escape) { in_escape = FALSE; } else if (!in_quote && c == '/') { char c2; if ((c2 = char_fromInt (lminput ())) == '*') { while (c2 != '\0') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 != '\n' && c2 != '*') { ; } if (c2 == '*') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 == '*') { ; } if (c2 == '/') { goto outofcomment; } } else { llfatalerror (cstring_makeLiteral ("Macro: bad comment!")); } } outofcomment: return macro_nextChar (); } else { /*** putchar does not work! why? puts to stdio...??! ***/ lmsavechar (c2); } } else { ; } return c; } /* ** keeps semantic comments */ static char macro_nextCharC (void) { static bool in_quote = FALSE, in_escape = FALSE, in_char = FALSE; char c; c = char_fromInt (lminput ()); if (!in_quote && !in_char && c == '\\') { while ((c = char_fromInt (lminput ())) != '\0' && c != '\n') { ; /* skip to newline */ } context_incLineno (); if (c != '\0') { return macro_nextCharC (); } else { return c; } } else if (!in_escape && c == '\"') { in_quote = !in_quote; } else if (!in_escape && c == '\'') { in_char = !in_char; } else if ((in_quote || in_char) && c == '\\') { in_escape = !in_escape; } else if ((in_quote || in_char) && in_escape) { in_escape = FALSE; } else if (!in_quote && c == '/') { char c2; if ((c2 = char_fromInt (lminput ())) == '*') { while (c2 != '\0') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 != '\n' && c2 != '*') { ; } if (c2 == '*') { while ((c2 = char_fromInt (lminput ())) != '\0' && c2 == '*') { ; } if (c2 == '/') { goto outofcomment; } } else { llfatalerror (cstring_makeLiteral ("Macro: bad comment!")); } } outofcomment: return macro_nextCharC (); } else { lmsavechar (c2); } } else /* normal character */ { ; } return c; } /* ** skips whitespace (handles line continuations) ** returns first non-whitespace character */ static char skip_whitespace (void) { char c; while ((c = macro_nextChar ()) == ' ' || c == '\t') { ; } return c; } void cscannerHelp_handleMacro () { cstring mac = cstring_undefined; int macrocode; char c; while (currentColumn () > 2) { mac = cstring_appendChar (mac, ' '); cscannerHelp_setTokLength (-1); } c = macro_nextCharC (); if (c >= '0' && c <= '9') { int i; for (i = 0; i < (((int) (c - '0')) + 1); i++) { mac = cstring_appendChar (mac, ' '); } } else { BADBRANCH; } while (((c = macro_nextCharC ()) != '\0') && (c != '\n')) { mac = cstring_appendChar (mac, c); } macrocode = tokenMacroCode (mac); if (macrocode == BADTOK && !isArtificial (mac)) { context_addMacroCache (mac); } else { cstring_free (mac); } if (c == '\n') { context_incLineno (); } } bool cscannerHelp_handleSpecial (char *yyt) { char *l; /* !! = mstring_create (MAX_NAME_LENGTH); */ int lineno = 0; char c; char *ol; cstring olc; size_t len_yyt; len_yyt = strlen (yyt +1) ; l = mstring_copy (yyt + 1); while ((c = char_fromInt (lminput ())) != '\n' && c != '\0') { l = mstring_append(l, c); } /* Need to safe original l for deallocating. */ ol = l; l += strlen (l); olc = cstring_fromChars (ol); if (cstring_equalPrefixLit (olc, "pragma")) { char *pname = mstring_create (size_fromInt (MAX_PRAGMA_LEN)); char *opname = pname; char *ptr = ol + 6; /* pragma is six characters, plus space */ int len = 0; /* skip whitespace */ while (((c = *ptr) != '\0') && isspace (c)) { ptr++; } while (((c = *ptr) != '\0') && !isspace (c)) { len++; if (len > MAX_PRAGMA_LEN) { break; } ptr++; *pname++ = c; } *pname = '\0'; if (len == PRAGMA_LEN_EXPAND && mstring_equal (opname, PRAGMA_EXPAND)) { cstring exname = cstring_undefined; uentry ue; ptr++; while (((c = *ptr) != '\0') && !isspace (c)) { exname = cstring_appendChar (exname, c); ptr++; } ue = usymtab_lookupExposeGlob (exname); if (uentry_isExpandedMacro (ue)) { if (fileloc_isPreproc (uentry_whereDefined (ue))) { fileloc_setColumn (g_currentloc, 1); uentry_setDefined (ue, g_currentloc); } } cstring_free (exname); } (void) cscannerHelp_handleNewLine (); /* evans 2003-10-27: pragment increments line */ } else if (cstring_equalPrefixLit (olc, "ident")) { /* Some pre-processors will leave these in the code. Ignore rest of line */ (void) cscannerHelp_handleNewLine (); /* evans 2003-10-27: ident increments line */ } /* ** Yuk...Win32 filenames can have spaces in them...we need to read ** to the matching end quote. */ else if ((sscanf (ol, "line %d \"", &lineno) == 1) || (sscanf (ol, " %d \"", &lineno) == 1)) { char *tmp = ol; cstring fname; fileId fid; /*@access cstring@*/ while (*tmp != '\"' && *tmp != '\0') { tmp++; } llassert (*tmp == '\"'); tmp++; fname = tmp; while (*tmp != '\"' && *tmp != '\0') { tmp++; } llassert (*tmp == '\"'); *tmp = '\0'; # if defined(OS2) || defined(MSDOS) || defined(WIN32) /* ** DOS-like path delimiters get delivered in pairs, something like ** \"..\\\\file.h\", so we have to make it normal again. We do NOT ** remove the pre dirs yet as we usually specify tmp paths relative ** to the current directory, so tmp files would not get found in ** the hash table. If this method fails we try it again later. */ { char *stmp = fname; /* ** Skip past the drive marker. */ if (strchr (stmp, ':') != NULL) { stmp = strchr (stmp, ':') + 1; } while ((stmp = strchr (stmp, CONNECTCHAR)) != NULL ) { if (*(stmp+1) == CONNECTCHAR) { memmove (stmp, stmp+1, strlen (stmp)); } stmp++; } fid = fileTable_lookupBase (context_fileTable (), fname); if (!(fileId_isValid (fid))) { fname = removePreDirs (fname); fid = fileTable_lookupBase (context_fileTable (), fname); } } # else /* !defined(OS2) && !defined(MSDOS) */ fname = removePreDirs (fname); fid = fileTable_lookupBase (context_fileTable (), fname); # endif /* !defined(OS2) && !defined(MSDOS) */ if (!(fileId_isValid (fid))) { if (context_inXHFile ()) { fid = fileTable_addXHFile (context_fileTable (), fname); } else if (isHeaderFile (fname)) { fid = fileTable_addHeaderFile (context_fileTable (), fname); } else { fid = fileTable_addFile (context_fileTable (), fname); } } setFileLine (fid, lineno); /*@noaccess cstring@*/ } else if ((sscanf (ol, "line %d", &lineno) == 1) || (sscanf (ol, " %d", &lineno) == 1)) { setLine (lineno); /* next line is */ } else { if (mstring_equal (ol, "")) { DPRINTF (("Empty pp command!")); /* ** evs 2000-05-16: This is a horrible kludge, to get around a bug (well, difficulty) in the pre-processor. ** We handle a plain # in the input file, by echoing it, and ignoring it in the post-pp-file. */ mstring_free (ol); (void) cscannerHelp_handleNewLine (); /* evans 2003-10-27: increments line */ return FALSE; } else { voptgenerror (FLG_UNRECOGDIRECTIVE, message ("Unrecognized pre-processor directive: #%s", cstring_fromChars (ol)), g_currentloc); (void) cscannerHelp_handleNewLine (); /* evans 2003-10-27: increments line */ } sfree (ol); return FALSE; /* evans 2001-12-30: was: TRUE; */ } sfree (ol); return FALSE; } int cscannerHelp_handleLlSpecial (void) { bool hasnl = FALSE; int ic; char c; char *s = mstring_createEmpty (); char *os; int tok; int charsread = 0; fileloc loc; loc = fileloc_copy (g_currentloc); DPRINTF (("Handle special: %s", fileloc_unparse (loc))); while (((ic = cscannerHelp_ninput ()) != 0) && isalpha (ic)) { c = (char) ic; s = mstring_append (s, c); charsread++; } DPRINTF (("Read: %s / %s", s, fileloc_unparse (g_currentloc))); os = s; if (charsread == 0 && ic == (int) AFTER_COMMENT_MARKER[0]) { ic = cscannerHelp_ninput (); llassert (ic == (int) AFTER_COMMENT_MARKER[1]); if (*s == '\0') { sfree (os); fileloc_free (loc); return QNOMODS; /* special token no modifications token */ } } DPRINTF (("Coment marker: %s", os)); tok = commentMarkerToken (cstring_fromChars (os)); if (tok != BADTOK) { s_tokLength = charsread; sfree (os); s_inSpecPart = TRUE; s_whichSpecPart = tok; fileloc_free (loc); return tok; } DPRINTF (("Not a comment marker...")); /* Add rest of the comment */ if (ic != 0 && ic != EOF) { c = (char) ic; s = mstring_append (s, c); charsread++; while (((ic = cscannerHelp_ninput ()) != 0) && (ic != EOF) && (ic != (int) AFTER_COMMENT_MARKER[0])) { c = (char) ic; /* evans 2001-09-01 added to prevent assertion failures for uncloses syntactic comments */ if (c == '\n') { hasnl = TRUE; /* This prevents tokLength from being set later. */ s_tokLength = 0; voptgenerror (FLG_SYNTAX, message ("Likely parse error: syntactic comment token spans multiple lines: %s", cstring_fromChars (s)), loc); } s = mstring_append (s, c); charsread++; } /*@-branchstate@*/ } /* spurious (?) warnings about s */ /*@=branchstate@*/ DPRINTF (("Read: %s / %s", s, fileloc_unparse (g_currentloc))); if (ic == (int) AFTER_COMMENT_MARKER[0]) { int nc = cscannerHelp_ninput (); llassert ((char) nc == AFTER_COMMENT_MARKER[1]); charsread++; } os = s; while (*s == ' ' || *s == '\t' || *s == '\n') { s++; } if (*s == '-' || *s == '+' || *s == '=') /* setting flags */ { c = *s; while (c == '-' || c == '+' || c == '=') { ynm set = ynm_fromCodeChar (c); cstring thisflag; s++; thisflag = cstring_fromChars (s); while ((c = *s) != '\0' && (c != '-') && (c != '=') && (c != '+') && (c != ' ') && (c != '\t') && (c != '\n')) { s++; } *s = '\0'; if (!context_getFlag (FLG_NOCOMMENTS)) { cstring flagname = thisflag; flagcode fflag = flags_identifyFlag (flagname); if (flagcode_isSkip (fflag)) { ; } else if (flagcode_isModeName (fflag)) { if (ynm_isMaybe (set)) { llerror (FLG_BADFLAG, message ("Semantic comment attempts to restore flag %s. " "A mode flag cannot be restored.", flagname)); } else { context_setMode (flagname); } } else if (flagcode_isInvalid (fflag)) { voptgenerror (FLG_UNRECOGFLAGCOMMENTS, message ("Unrecognized option in semantic comment: %s", flagname), loc); } else if (flagcode_isGlobalFlag (fflag)) { voptgenerror (FLG_BADFLAG, message ("Semantic comment attempts to set global flag %s. " "A global flag cannot be set locally.", flagname), loc); } else { context_fileSetFlag (fflag, set, loc); if (flagcode_hasArgument (fflag)) { if (ynm_isMaybe (set)) { voptgenerror (FLG_BADFLAG, message ("Semantic comment attempts to restore flag %s. " "A flag for setting a value cannot be restored.", flagname), loc); } else { /* cut-and-pastied from llmain...blecch */ cstring extra = cstring_undefined; char *rest; char *orest; char rchar; *s = c; rest = mstring_copy (s); orest = rest; *s = '\0'; while ((rchar = *rest) != '\0' && (isspace (rchar))) { rest++; s++; } while ((rchar = *rest) != '\0' && !isspace (rchar)) { extra = cstring_appendChar (extra, rchar); rest++; s++; } s--; /* evans 2002-07-12: this was previously only in the else branch. Leads to an invalid read on the true branch. */ sfree (orest); if (cstring_isUndefined (extra)) { llerror (FLG_BADFLAG, message ("Flag %s (in semantic comment) must be followed by an argument", flagcode_unparse (fflag))); cstring_free (extra); } else { if (flagcode_hasNumber (fflag)) { flags_setValueFlag (fflag, extra); } else if (flagcode_hasChar (fflag)) { flags_setValueFlag (fflag, extra); } else if (flagcode_hasString (fflag)) { flags_setStringFlag (fflag, extra); } else { cstring_free (extra); BADEXIT; } } } } } } else { ; } *s = c; while ((c == ' ') || (c == '\t') || (c == '\n')) { c = *(++s); } } if (context_inHeader () && !isArtificial (cstring_fromChars (os))) { DPRINTF (("Here adding comment: %s", os)); context_addComment (cstring_fromCharsNew (os), loc); } else { ; } } else { char *t = s; int macrocode; char tchar = '\0'; annotationInfo ainfo; while (*s != '\0' && *s != ' ' && *s != '\t' && *s != '\n') { s++; } if (*s != '\0') { tchar = *s; *s = '\0'; s++; } t = cstring_toCharsSafe (cstring_downcase (cstring_fromChars (t))); macrocode = tokenMacroCode (cstring_fromChars (t)); if (macrocode != BADTOK) { s_tokLength = hasnl ? 0 : size_toInt (mstring_length (t)); sfree (t); sfree (os); fileloc_free (loc); if (macrocode == SKIPTOK) { return BADTOK; } return macrocode; } ainfo = context_lookupAnnotation (cstring_fromChars (os)); if (annotationInfo_isDefined (ainfo)) { DPRINTF (("Found annotation: %s", annotationInfo_unparse (ainfo))); yylval.annotation = ainfo; s_tokLength = 0; sfree (os); sfree (t); fileloc_free (loc); return CANNOTATION; } if (context_inHeader ()) { if (tchar != '\0') { *(s-1) = tchar; } if ((context_inMacro () || context_inGlobalContext ()) && macrocode != SKIPTOK && !isArtificial (cstring_fromChars (os))) { if (context_processingMacros ()) { /* evans 2002-02-24: don't add comments when procssing macros */ } else { context_addComment (cstring_fromCharsNew (os), loc); } } else { ; } if (tchar != '\0') { *(s-1) = '\0'; } } if (mstring_equal (t, "ignore")) { if (!context_getFlag (FLG_NOCOMMENTS)) { context_enterSuppressRegion (loc); } } else if ((*t == 'i' || *t == 't') && (*(t + 1) == '\0')) { if (!context_getFlag (FLG_NOCOMMENTS) && (*t == 'i' || context_getFlag (FLG_TMPCOMMENTS))) { context_enterSuppressLine (-1, loc); /* infinite suppression */ } } else if (((*t == 'i') || (*t == 't')) && ((*(t + 1) >= '0' && *(t + 1) <= '9'))) { bool tmpcomment = (*t == 't'); int val = -1; char *tt = t; /* don't mangle t, since it is free'd */ char lc = *(++tt); if (lc >= '0' && lc <= '9') { val = (int)(lc - '0'); lc = *(++tt); while (lc >= '0' && lc <= '9') { val *= 10; val += (int) (lc - '0'); lc = *(++tt); } } if (!context_getFlag (FLG_NOCOMMENTS) && (!tmpcomment || context_getFlag (FLG_TMPCOMMENTS))) { DPRINTF (("Here: enter suppress: %s", fileloc_unparse (loc))); context_enterSuppressLine (val, loc); } } else if (mstring_equal (t, "end")) { if (!context_getFlag (FLG_NOCOMMENTS)) { context_exitSuppressRegion (loc); } } else if (mstring_equal (t, "notfunction")) { ; /* handled by pcpp */ } else if (mstring_equal (t, "access")) { cstring tname; while (TRUE) { while (((c = *s) != '\0') && (c == ' ' || c == '\t' || c == '\n')) { s++; } if (c == '\0') { break; } tname = cstring_fromChars (s); while ((c = *s) != '\0' && c != ' ' && c != '\t' && c != '\n' && c != ',') { s++; } *s = '\0'; DPRINTF (("Access %s", tname)); if (!context_getFlag (FLG_NOCOMMENTS) && !context_getFlag (FLG_NOACCESS)) { if (usymtab_existsType (tname)) { typeId uid = usymtab_getTypeId (tname); uentry ue = usymtab_getTypeEntry (uid); if (uentry_isAbstractDatatype (ue)) { context_addFileAccessType (uid); DPRINTF (("Adding access to: %s / %d", tname, uid)); } else { voptgenerror (FLG_COMMENTERROR, message ("Non-abstract type %s used in access comment", tname), loc); } } else { if (!(context_inSuppressRegion () || context_inSuppressZone (loc))) { voptgenerror (FLG_COMMENTERROR, message ("Unrecognized type %s used in access comment", tname), loc); } } } if (c != '\0') { s++; } if (c != ',' && c != ' ') { break; } } } else if (mstring_equal (t, "noaccess")) { cstring tname; char lc; while (TRUE) { while (((lc = *s) != '\0') && (lc == ' ' || lc == '\t' || lc == '\n')) { s++; } if (lc == '\0') { break; } tname = cstring_fromChars (s); while ((lc = *s) != '\0' && lc != ' ' && lc != '\t' && lc != '\n' && lc != ',') { s++; } *s = '\0'; if (!context_getFlag (FLG_NOCOMMENTS) && !context_getFlag (FLG_NOACCESS)) { if (usymtab_existsType (tname)) { typeId tuid = usymtab_getTypeId (tname); if (context_couldHaveAccess (tuid)) { DPRINTF (("Removing access: %s", tname)); context_removeFileAccessType (tuid); } else { if (!(context_inSuppressRegion () || context_inSuppressZone (loc))) { uentry ue = usymtab_getTypeEntry (tuid); if (uentry_isAbstractDatatype (ue)) { voptgenerror (FLG_COMMENTERROR, message ("Non-accessible abstract type %s used in noaccess comment", tname), loc); } else { voptgenerror (FLG_COMMENTERROR, message ("Non-abstract type %s used in noaccess comment", tname), loc); } } } } else { if (!(context_inSuppressRegion () || context_inSuppressZone (loc))) { voptgenerror (FLG_COMMENTERROR, message ("Unrecognized type %s used in noaccess comment", tname), loc); } } } if (lc != '\0') { s++; } if (lc != ',' && lc != ' ') { break; } } } else { voptgenerror (FLG_UNRECOGCOMMENTS, message ("Semantic comment unrecognized: %s", cstring_fromChars (os)), loc); /*@-branchstate@*/ } /* spurious (?) warning about t */ /*@=branchstate@*/ sfree (t); } sfree (os); fileloc_free (loc); return BADTOK; } /*@only@*/ cstring cscannerHelp_makeIdentifier (char *s) { char *c = mstring_create (strlen (s) + 1); cstring id = cstring_fromChars (c); while (isalnum (*s) || (*s == '_') || (*s == '$')) { *c++ = *s++; } *c = '\0'; return (id); } /*@observer@*/ /*@dependent@*/ uentry cscannerHelp_coerceId (cstring cn) { if (!(usymtab_exists (cn))) { fileloc loc = fileloc_createExternal (); /* ** We need to put this in a global scope, otherwise the sRef will be deallocated. */ uentry ce = uentry_makeUnrecognized (cn, loc); if (!context_inIterEnd ()) { voptgenerror (FLG_SYSTEMUNRECOG, message ("Unrecognized (possibly system) identifier: %q", uentry_getName (ce)), g_currentloc); } return ce; } return (usymtab_lookup (cn)); } /* ** like, cscannerHelp_coerceId, but doesn't supercede for iters */ /*@observer@*/ uentry cscannerHelp_coerceIterId (cstring cn) { if (!(usymtab_exists (cn))) { return uentry_undefined; } return (usymtab_lookup (cn)); } /* ** Need to keep this in case there is a declaration that isn't processed until ** the scope exits. Would be good to rearrange the symbol table so this doesn't ** happen, and save all the cstring copying. */ /*@observer@*/ cstring cscannerHelp_observeLastIdentifier () { cstring res = s_lastidprocessed; return res; } static void cscanner_setLastIdentifier (/*@keep@*/ cstring id) /*@modifies s_lastidprocessed@*/ { if (cstring_isDefined (s_lastidprocessed)) { cstring_free (s_lastidprocessed); } s_lastidprocessed = id; } int cscannerHelp_processIdentifier (cstring id) { uentry le; if (context_getFlag (FLG_GRAMMAR)) { lldiagmsg (message ("Process identifier: %s", id)); } context_clearJustPopped (); cscanner_setLastIdentifier (id); DPRINTF (("Context: %s", context_unparse ())); if (context_inFunctionHeader ()) { int tok = commentMarkerToken (id); DPRINTF (("in function decl: %s", id)); if (tok != BADTOK) { return tok; } else { tok = tokenMacroCode (id); if (tok != BADTOK) { return tok; } else { annotationInfo ainfo; if (s_expectingMetaStateName) { metaStateInfo msinfo = context_lookupMetaStateInfo (id); if (metaStateInfo_isDefined (msinfo)) { yylval.msinfo = msinfo; return METASTATE_NAME; } else { DPRINTF (("Not meta state name: %s", cstring_toCharsSafe (id))); } } ainfo = context_lookupAnnotation (id); if (annotationInfo_isDefined (ainfo)) { DPRINTF (("Found annotation: %s", annotationInfo_unparse (ainfo))); yylval.annotation = ainfo; return CANNOTATION; } else { DPRINTF (("Not annotation: %s", id)); } } } } DPRINTF (("Here!")); /* Consider handling: Defined by C99 as static const char __func__[] */ if (context_getFlag (FLG_GNUEXTENSIONS)) { int tok = BADTOK; if (cstring_equalLit (id, "__stdcall") || cstring_equalLit (id, "__cdecl") || cstring_equalLit (id, "__extension__")) { return BADTOK; } else if (cstring_equalLit (id, "__volatile__")) { tok = QVOLATILE; } else if (cstring_equalLit (id, "__signed")) { tok = QSIGNED; } else if (cstring_equalLit (id, "__unsigned")) { tok = QUNSIGNED; } else if (cstring_equalLit (id, "__const__")) { tok = QCONST; } else if (cstring_equalLit (id, "__alignof__")) { tok = CALIGNOF; /* alignof is parsed like sizeof */ } else if (cstring_equalLit (id, "__typeof__")) { tok = CTYPEOF; } else if (cstring_equalLit (id, "typeof")) { tok = CTYPEOF; } else if (cstring_equalLit (id, "__FUNCTION__") || cstring_equalLit (id, "__PRETTY_FUNCTION__")) { /* These tokens hold the name of the current function as strings */ /* evans 2001-12-30: changed from exprNode_stringLiteral; bug reported by Jim Zelenka. */ yylval.expr = exprNode_makeConstantString (id, fileloc_copy (g_currentloc)); s_tokLength = 0; s_lastWasString = TRUE; tok = CCONSTANT; return tok; } else if (cstring_equalLit (id, "__attribute__") || cstring_equalLit (id, "__asm__") || cstring_equalLit (id, "_asm") || cstring_equalLit (id, "__asm") || cstring_equalLit (id, "__declspec")) { int depth = 0; bool useparens = FALSE; bool usebraces = FALSE; bool inquote = FALSE; bool inescape = FALSE; int ic; while ((ic = cscanner_input ()) != EOF) { char cc = (char) ic; if (inescape) { inescape = FALSE; } else if (cc == '\\') { inescape = TRUE; } else if (cc == '\"') { inquote = !inquote; } else if (!inquote) { if (cc == '(') { if (!useparens) { if (!usebraces) { useparens = TRUE; } } if (useparens) { depth++; } } else if (cc == '{') { if (!usebraces) { if (!useparens) { usebraces = TRUE; } } if (usebraces) { depth++; } } else if (cc == ')' && useparens) { depth--; if (depth == 0) break; } else if (cc == '}' && usebraces) { depth--; if (depth == 0) break; } else if (cc == '}' && !usebraces && !useparens && cstring_equalLit (id, "__asm")) { /* ** We need this because some MS VC++ include files ** have __asm mov ... } ** Its a kludge, but otherwise would need to parse ** the asm code! */ return TRBRACE; } else { ; } } else { ; } if (cc == '\n') { context_incLineno (); if (cstring_equalLit (id, "__asm") && !useparens && !usebraces) { break; } } } llassert ((useparens && ic == (int) ')') || (usebraces && ic == (int) '}') || (!useparens && !usebraces)); return BADTOK; } else if (cstring_equalLit (id, "inline") || cstring_equalLit (id, "__inline") || cstring_equalLit (id, "_inline") || cstring_equalLit (id, "__inline__")) { tok = QINLINE; } else { ; } if (tok != BADTOK) { return (cscannerHelp_returnToken (tok)); } } le = usymtab_lookupSafe (id); /*@-dependenttrans@*/ if (uentry_isIter (le)) { yylval.entry = le; return (ITER_NAME); } else if (uentry_isEndIter (le)) { yylval.entry = le; return (ITER_ENDNAME); } else if (uentry_isUndefined (le)) { yylval.cname = cstring_copy (id); /* avoid parse errors for certain system built ins */ if (s_expectingTypeName && (cstring_firstChar (id) == '_') && (cstring_secondChar (id) == '_')) { return (TYPE_NAME_OR_ID); } return (NEW_IDENTIFIER); } else if (!uentry_isDeclared (le) && !uentry_isCodeDefined (le)) { if (uentry_isDatatype (le)) { yylval.cname = cstring_copy (id); return (NEW_IDENTIFIER); } else { yylval.entry = le; return (IDENTIFIER); } } else if (uentry_isDatatype (le)) { if (!s_expectingTypeName) { yylval.cname = cstring_copy (id); return (NEW_IDENTIFIER); } else { yylval.ctyp = uentry_getAbstractType (le); uentry_setUsed (le, g_currentloc); return (TYPE_NAME); } } else { yylval.entry = le; return (IDENTIFIER); } /*@=dependenttrans@*/ } bool cscannerHelp_processHashIdentifier (/*@only@*/ cstring id) { if (context_inMacro () || context_inIterDef () || context_inIterEnd ()) { uentry le; context_clearJustPopped (); le = usymtab_lookupSafe (id); cscanner_setLastIdentifier (id); if (uentry_isParam (le) || uentry_isRefParam (le)) { return TRUE; } else { return FALSE; } } else { /* ** Will be handled by handleLlSpecial */ cstring_free (id); return FALSE; } } /*@only@*/ exprNode cscannerHelp_processString (void) { exprNode res; fileloc loc; char *nl = strchr (yytext, '\n'); cstring ns = cstring_fromCharsNew (yytext); if (nl == NULL) { loc = fileloc_copy (g_currentloc); addColumn (size_toInt (cstring_length (ns))); } else { char *lastnl = nl; loc = fileloc_copy (g_currentloc); context_incLineno (); while ((nl = strchr ((nl + 1), '\n')) != NULL) { context_incLineno (); lastnl = nl; } } res = exprNode_stringLiteral (ns, loc); return (res); } /* ** process a wide character string L"...." */ /*@only@*/ exprNode cscannerHelp_processWideString () { exprNode res; fileloc loc; char *nl = strchr (yytext, '\n'); cstring ns; llassert (*yytext == 'L'); yytext++; ns = cstring_fromCharsNew (yytext); if (nl == NULL) { loc = fileloc_copy (g_currentloc); addColumn (size_toInt (cstring_length (ns))); } else { char *lastnl = nl; loc = fileloc_copy (g_currentloc); context_incLineno (); while ((nl = strchr ((nl + 1), '\n')) != NULL) { context_incLineno (); lastnl = nl; } } res = exprNode_wideStringLiteral (ns, loc); return (res); } char cscannerHelp_processChar () { char fchar; char next; llassert (*yytext != '\0'); fchar = *(yytext + 1); if (fchar != '\\') return fchar; next = *(yytext + 2); switch (next) { case 'n': return '\n'; case 't': return '\t'; case '\"': return '\"'; case '\'': return '\''; case '\\': return '\\'; default: return '\0'; } } double cscannerHelp_processFloat () { double ret = atof (yytext); return (ret); } long cscannerHelp_processHex () { int index = 2; long val = 0; llassert (yytext[0] == '0' && (yytext[1] == 'X' || yytext[1] == 'x')); while (yytext[index] != '\0') { int tval; char c = yytext[index]; if (c >= '0' && c <= '9') { tval = (int) c - (int) '0'; } else if (c >= 'A' && c <= 'F') { tval = (int) c - (int) 'A' + 10; } else if (c >= 'a' && c <= 'f') { tval = (int) c - (int) 'a' + 10; } else if (c == 'U' || c == 'L' || c == 'u' || c == 'l') { index++; while (yytext[index] != '\0') { if (c == 'U' || c == 'L' || c == 'u' || c == 'l') { ; } else { voptgenerror (FLG_SYNTAX, message ("Invalid character (%c) following specifier in hex constant: %s", c, cstring_fromChars (yytext)), g_currentloc); } index++; } break; } else { voptgenerror (FLG_SYNTAX, message ("Invalid character (%c) in hex constant: %s", c, cstring_fromChars (yytext)), g_currentloc); break; } val = (val * 16) + tval; index++; } DPRINTF (("Hex constant: %s = %ld", yytext, val)); return val; } long cscannerHelp_processOctal () { int index = 1; long val = 0; llassert (yytext[0] == '0' && yytext[1] != 'X' && yytext[1] != 'x'); while (yytext[index] != '\0') { int tval; char c = yytext[index]; if (c >= '0' && c <= '7') { tval = (int) c - (int) '0'; } else if (c == 'U' || c == 'L' || c == 'u' || c == 'l') { index++; while (yytext[index] != '\0') { if (c == 'U' || c == 'L' || c == 'u' || c == 'l') { ; } else { voptgenerror (FLG_SYNTAX, message ("Invalid character (%c) following specifier in octal constant: %s", c, cstring_fromChars (yytext)), g_currentloc); } index++; } break; } else { voptgenerror (FLG_SYNTAX, message ("Invalid character (%c) in octal constant: %s", c, cstring_fromChars (yytext)), g_currentloc); break; } val = (val * 8) + tval; index++; } DPRINTF (("Octal constant: %s = %ld", yytext, val)); return val; } long cscannerHelp_processDec () { return (atol (yytext)); } int cscannerHelp_processSpec (int tok) { size_t length = strlen (yytext); if (s_inSpecPart) { /*drl 12/11/2002 patched to fix assert failures in constraint code. Added the else if test so that splint does not treat MaxSet and MaxRead as identifies*/ if (s_whichSpecPart == QMODIFIES || s_whichSpecPart == QDEFINES || s_whichSpecPart == QUSES || s_whichSpecPart == QALLOCATES || s_whichSpecPart == QSETS || s_whichSpecPart == QRELEASES) { DPRINTF((message("Treating specifaction keyword %s as an identifiers. (This corresponds to" " token %d and we're in the specification denoted by %d see cgrammar_tokens.h" " for an explanation of these numbers", yytext, tok, s_whichSpecPart) )); ; /* Allow specificiation keywords to be used as identifiers in these contexts. */ } else if ( (s_whichSpecPart == QPRECLAUSE || s_whichSpecPart == QPOSTCLAUSE || s_whichSpecPart == QINVARIANT ) && (!cscannerHelp_isConstraintToken(tok) ) ) { DPRINTF((message("Treating specifaction keyword %s as an identifiers. (This corresponds to" " token %d and we're in the specification denoted by %d see cgrammar_tokens.h" " for an explanation of these numbers", yytext, tok, s_whichSpecPart) )); /* Allow specificiation keywords to be used as identifiers in these contexts. */ } else { cscannerHelp_setTokLengthT (length); return cscannerHelp_returnToken (tok); } } context_saveLocation (); cscannerHelp_setTokLengthT (length); return (cscannerHelp_processIdentifier (cscannerHelp_makeIdentifier (yytext))); } void cscannerHelp_expectingMetaStateName () { llassert (!s_expectingMetaStateName); llassert (context_inFunctionHeader ()); s_expectingMetaStateName = TRUE; } void cscannerHelp_clearExpectingMetaStateName () { llassert (s_expectingMetaStateName); s_expectingMetaStateName = FALSE; } bool cscannerHelp_isConstraintToken (int tok) /* drl added 12/11/2002 Tell whether a token has special meaning within a function constraint */ { return (tok == QMAXSET || tok == QMAXREAD); /* || tok == QMINREAD || tok == QMINSET */ /* uncomment the additional if statement tests when minSet and minRead are supported */ } bool cscannerHelp_processMacro (void) { uentry e2; ctype ct; int noparams = 0; cstring fname = cstring_undefined; bool res = TRUE; bool isspecfcn = FALSE; bool isiter = FALSE; bool skipparam = FALSE; bool isenditer = FALSE; bool unknownm = FALSE; bool hasParams = FALSE; bool emptyMacro = FALSE; char c = skip_whitespace (); fileloc loc = fileloc_noColumn (g_currentloc); /* are both of these necessary? what do they mean? */ uentryList specparams = uentryList_undefined; uentryList pn = uentryList_undefined; context_resetMacroMissingParams (); if (c == '\0' || c == '\n') { llcontbug (cstring_makeLiteral ("Bad macro")); fileloc_free (loc); return FALSE; } fname = cstring_appendChar (fname, c); while ((c = macro_nextChar ()) != '(' && c != '\0' && c != ' ' && c != '\t' && c != '\n') { fname = cstring_appendChar (fname, c); } if (c == ' ' || c == '\t' || c == '\n') { char oldc = c; if (c != '\n') { while (c == ' ' || c == '\t') { c = macro_nextChar (); } cscanner_unput ((int) c); } if (c == '\n') { emptyMacro = TRUE; cscanner_unput ((int) c); } c = oldc; } hasParams = (c == '('); if (usymtab_exists (fname)) { e2 = usymtab_lookupExpose (fname); ct = uentry_getType (e2); if (uentry_isCodeDefined (e2) && fileloc_isUser (uentry_whereDefined (e2))) { if (optgenerror (FLG_MACROREDEF, message ("Macro %s already defined", fname), loc)) { uentry_showWhereDefined (e2); uentry_clearDefined (e2); } if (uentry_isFunction (e2)) { uentry_setType (e2, ctype_unknown); ct = ctype_unknown; unknownm = TRUE; context_enterUnknownMacro (e2); } else { context_enterConstantMacro (e2); } } else { if (uentry_isForward (e2) && uentry_isFunction (e2)) { unknownm = TRUE; voptgenerror (FLG_MACROFCNDECL, message ("Parameterized macro has no prototype or specification: %s ", fname), loc); ct = ctype_unknown; uentry_setType (e2, ctype_unknown); uentry_setFunctionDefined (e2, loc); uentry_setUsed (e2, fileloc_undefined); context_enterUnknownMacro (e2); } else { if (uentry_isIter (e2)) { isiter = TRUE; specparams = uentry_getParams (e2); noparams = uentryList_size (specparams); uentry_setDefined (e2, loc); context_enterIterDef (e2); } else if (uentry_isEndIter (e2)) { isenditer = TRUE; uentry_setDefined (e2, loc); context_enterIterEnd (e2); /* don't care about it now */ /* but should parse like an iter! */ } else if (uentry_isConstant (e2)) { if (hasParams) { voptgenerror (FLG_INCONDEFS, message ("Constant %s implemented as parameterized macro", fname), g_currentloc); uentry_showWhereSpecified (e2); uentry_setType (e2, ctype_unknown); uentry_makeConstantFunction (e2); uentry_setDefined (e2, g_currentloc); uentry_setFunctionDefined (e2, g_currentloc); context_enterUnknownMacro (e2); } else { if (!uentry_isSpecified (e2)) { fileloc oloc = uentry_whereDeclared (e2); if (fileloc_isLib (oloc)) { ; } else if (fileloc_isUndefined (oloc) || fileloc_isPreproc (oloc)) { if (!emptyMacro) { voptgenerror (FLG_MACROCONSTDECL, message ("Macro constant %q not declared", uentry_getName (e2)), loc); } } else if (!fileloc_withinLines (oloc, loc, 2)) { /* bogus! will give errors if there is too much whitespace */ voptgenerror (FLG_MACROCONSTDIST, message ("Macro constant name %s matches name in " "distant constant declaration. This constant " "is declared at %q", fname, fileloc_unparse (oloc)), loc); } else { /* No warning */ } } context_enterConstantMacro (e2); cstring_free (fname); fileloc_free (loc); return res; } } else if (ctype_isFunction (ct)) { isspecfcn = TRUE; specparams = ctype_argsFunction (ct); noparams = uentryList_size (specparams); uentry_setFunctionDefined (e2, loc); context_enterMacro (e2); } else if (uentry_isVar (e2)) { if (hasParams) { voptgenerror (FLG_INCONDEFS, message ("Variable %s implemented as parameterized macro", fname), loc); uentry_showWhereSpecified (e2); uentry_setType (e2, ctype_unknown); uentry_makeVarFunction (e2); uentry_setDefined (e2, g_currentloc); uentry_setFunctionDefined (e2, g_currentloc); context_enterUnknownMacro (e2); } else { uentry ucons = uentry_makeConstant (fname, ctype_unknown, loc); if (uentry_isExpandedMacro (e2)) { ; /* okay */ } else { if (optgenerror (FLG_INCONDEFS, message ("Variable %s implemented by a macro", fname), loc)) { uentry_showWhereSpecified (e2); } } uentry_setDefined (e2, loc); uentry_setUsed (ucons, loc); context_enterConstantMacro (ucons); uentry_markOwned (ucons); cstring_free (fname); return res; } } else { if (uentry_isDatatype (e2)) { vgenhinterror (FLG_SYNTAX, message ("Type implemented as macro: %x", uentry_getName (e2)), message ("A type is implemented using a macro definition. A " "typedef should be used instead."), g_currentloc); cscannerHelp_swallowMacro (); /* Must exit scope (not sure why a new scope was entered?) */ usymtab_quietExitScope (g_currentloc); uentry_setDefined (e2, g_currentloc); res = FALSE; } else { llcontbug (message ("Unexpanded macro not function or constant: %q", uentry_unparse (e2))); uentry_setType (e2, ctype_unknown); if (hasParams) { uentry_makeVarFunction (e2); uentry_setDefined (e2, g_currentloc); uentry_setFunctionDefined (e2, g_currentloc); context_enterUnknownMacro (e2); } } } } } } else { uentry ce; /* evans 2001-09-09 - if it has params, assume a function */ if (hasParams) { voptgenerror (FLG_MACROMATCHNAME, message ("Unexpanded macro %s does not match name of a declared " "function. The name used in the control " "comment on the previous line should match.", fname), loc); ce = uentry_makeFunction (fname, ctype_unknown, typeId_invalid, globSet_undefined, sRefSet_undefined, warnClause_undefined, fileloc_undefined); uentry_setUsed (ce, loc); /* perhaps bogus? */ e2 = usymtab_supEntryReturn (ce); context_enterUnknownMacro (e2); } else { voptgenerror (FLG_MACROMATCHNAME, message ("Unexpanded macro %s does not match name of a constant " "or iter declaration. The name used in the control " "comment on the previous line should match. " "(Assuming macro defines a constant.)", fname), loc); ce = uentry_makeConstant (fname, ctype_unknown, fileloc_undefined); uentry_setUsed (ce, loc); /* perhaps bogus? */ e2 = usymtab_supEntryReturn (ce); context_enterConstantMacro (e2); cstring_free (fname); fileloc_free (loc); return res; } } /* in macros, ( must follow immediatetly after name */ if (hasParams) { int paramno = 0; c = skip_whitespace (); while (c != ')' && c != '\0') { uentry param; bool suppress = context_inSuppressRegion (); cstring paramname = cstring_undefined; /* ** save the parameter location */ decColumn (); context_saveLocation (); incColumn (); while (c != ' ' && c != '\t' && c != ',' && c != '\0' && c != ')') { paramname = cstring_appendChar (paramname, c); c = macro_nextChar (); } if (c == ' ' || c == '\t') c = skip_whitespace (); if (c == ',') { c = macro_nextChar (); if (c == ' ' || c == '\t') c = skip_whitespace (); } if (c == '\0') { llfatalerror (cstring_makeLiteral ("Bad macro syntax: uentryList")); } if ((isspecfcn || isiter) && (paramno < noparams) && !uentry_isElipsisMarker (uentryList_getN (specparams, paramno))) { fileloc sloc = context_getSaveLocation (); uentry decl = uentryList_getN (specparams, paramno); sRef sr; param = uentry_nameCopy (paramname, decl); uentry_setParam (param); sr = sRef_makeParam (paramno, uentry_getType (param), stateInfo_makeLoc (sloc, SA_DECLARED)); if (sRef_getNullState (sr) == NS_ABSNULL) { ctype pt = ctype_realType (uentry_getType (param)); if (ctype_isUser (pt)) { uentry te = usymtab_getTypeEntrySafe (ctype_typeId (pt)); if (uentry_isValid (te)) { sRef_setStateFromUentry (sr, te); } } else { sRef_setNullState (sr, NS_UNKNOWN, sloc); } } uentry_setSref (param, sr); uentry_setDeclaredForceOnly (param, sloc); skipparam = isiter && uentry_isOut (uentryList_getN (specparams, paramno)); } else { fileloc sloc = context_getSaveLocation (); param = uentry_makeVariableSrefParam (paramname, ctype_unknown, fileloc_copy (sloc), sRef_makeParam (paramno, ctype_unknown, stateInfo_makeLoc (sloc, SA_DECLARED))); DPRINTF (("Unknown param: %s", uentry_unparseFull (param))); cstring_free (paramname); sRef_setPosNull (uentry_getSref (param), sloc); uentry_setDeclaredForce (param, sloc); skipparam = FALSE; fileloc_free (sloc); } if (!skipparam) { llassert (!uentry_isElipsisMarker (param)); if (!suppress) { sRef_makeUnsafe (uentry_getSref (param)); } pn = uentryList_add (pn, uentry_copy (param)); usymtab_supEntry (param); } else { /* don't add param */ uentry_free (param); } if (c == ',') { (void) macro_nextChar (); c = skip_whitespace (); } paramno++; } if (c == ')') { if (isspecfcn || isiter) { if (paramno != noparams && noparams >= 0) { cscannerHelp_advanceLine (); voptgenerror (FLG_INCONDEFS, message ("Macro %s specified with %d args, defined with %d", fname, noparams, paramno), g_currentloc); uentry_showWhereSpecified (e2); uentry_resetParams (e2, pn); } } else { uentry_resetParams (e2, pn); } } } else { /* ** the form should be: ** ** # define newname oldname ** where oldname refers to a function matching the specification ** of newname. */ if (unknownm) { sRef_setGlobalScope (); usymtab_supGlobalEntry (uentry_makeVariableLoc (fname, ctype_unknown)); sRef_clearGlobalScope (); } else { context_setMacroMissingParams (); } } /* context_setuentryList (pn); */ usymtab_enterScope (); fileloc_free (loc); cstring_free (fname); return res; } void cscannerHelp_setTokLength (int len) { addColumn (len); s_tokLength = len; DPRINTF (("Set tok length: %d", len)); } void cscannerHelp_setTokLengthT (size_t len) { cscannerHelp_setTokLength (size_toInt (len)); } void cscannerHelp_advanceLine (void) { s_tokLength = 0; beginLine (); } int cscannerHelp_returnToken (int t) { if (s_tokLength > fileloc_column (g_currentloc)) { yylval.tok = lltok_create (t, fileloc_copy (g_currentloc)); } else { yylval.tok = lltok_create (t, fileloc_decColumn (g_currentloc, s_tokLength)); } s_tokLength = 0; s_lastWasString = FALSE; return (t); } int cscannerHelp_returnTokenLength (int t, int length) { cscannerHelp_setTokLength (length); return cscannerHelp_returnToken (t); } int cscannerHelp_returnString (cstring s) { yylval.expr = exprNode_stringLiteral (s, fileloc_decColumn (g_currentloc, s_tokLength)); s_tokLength = 0; s_lastWasString = TRUE; return (CCONSTANT); } int cscannerHelp_returnInt (ctype ct, long val) { ctype c = ct; if (ctype_equal (ct, ctype_int)) { if (val == 0) { c = context_typeofZero (); } else if (val == 1) { c = context_typeofOne (); } else { ; } } yylval.expr = exprNode_numLiteral (c, cstring_fromChars (yytext), fileloc_decColumn (g_currentloc, s_tokLength), val); s_tokLength = 0; s_lastWasString = FALSE; return (CCONSTANT); } int cscannerHelp_returnFloat (ctype ct, double f) { yylval.expr = exprNode_floatLiteral (f, ct, cstring_fromChars (yytext), fileloc_decColumn (g_currentloc, s_tokLength)); s_tokLength = 0; s_lastWasString = FALSE; return (CCONSTANT); } int cscannerHelp_returnChar (char c) { yylval.expr = exprNode_charLiteral (c, cstring_fromChars (yytext), fileloc_decColumn (g_currentloc, s_tokLength)); s_tokLength = 0; s_lastWasString = FALSE; return (CCONSTANT); } int cscannerHelp_returnType (int tok, ctype ct) { yylval.ctyp = ct; s_tokLength = 0; s_lastWasString = FALSE; return tok; } int cscannerHelp_returnExpr (exprNode e) { yylval.expr = e; s_tokLength = 0; s_lastWasString = TRUE; return (CCONSTANT); } void cscannerHelp_setExpectingTypeName () { s_expectingTypeName = TRUE; } void cscannerHelp_clearExpectingTypeName () { s_expectingTypeName = FALSE; } bool cscannerHelp_isExpectingTypeName () { return s_expectingTypeName; } int cscannerHelp_processTextIdentifier (char *text) { context_saveLocation (); cscannerHelp_setTokLength (size_toInt (mstring_length (text))); return cscannerHelp_processIdentifier (cscannerHelp_makeIdentifier (text)); } static bool s_continueLine = FALSE; int cscannerHelp_handleNewLine () { context_incLineno (); if (s_tokLength != 0) { s_tokLength = 0; /* No error to report voptgenerror (FLG_SYNTAX, message ("Likely parse error: token spans multiple lines."), g_currentloc); */ } if (s_continueLine) { s_continueLine = FALSE; } else { if (context_inMacro ()) { /* Don't use return cscannerHelp_returnToken */ /* !!! evans 2002-03-13 */ yylval.tok = lltok_create (TENDMACRO, fileloc_copy (g_currentloc)); s_lastWasString = FALSE; return TENDMACRO; } } return BADTOK; } void cscannerHelp_setContinueLine () { s_continueLine = TRUE; } void cscannerHelp_exitSpecPart () { llassert (s_inSpecPart); s_inSpecPart = FALSE; s_whichSpecPart = BADTOK; } splint-3.1.2.dfsg1/src/structNames.c0000644021234200000250000000703707630461221014716 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** structNames.c ** ** Hacks to fit tags into the same namespace. */ # include "splintMacros.nf" # include "basic.h" # include "structNames.h" /*@constant char MARKCHAR_STRUCT; @*/ # define MARKCHAR_STRUCT '@' /*@constant char MARKCHAR_UNION; @*/ # define MARKCHAR_UNION '$' /*@constant char MARKCHAR_ENUM; @*/ # define MARKCHAR_ENUM '&' /*@constant char MARKCHAR_PARAM; @*/ # define MARKCHAR_PARAM '%' /*@observer@*/ cstring plainTagName (cstring s) { llassert (!isFakeTag (s)); return cstring_suffix (s, 1); } /*@only@*/ cstring fixTagName (cstring s) { if (isFakeTag (s)) { switch (cstring_firstChar (s)) { case MARKCHAR_STRUCT: return (cstring_makeLiteral ("struct")); case MARKCHAR_UNION: return (cstring_makeLiteral ("union")); case MARKCHAR_ENUM: return (cstring_makeLiteral ("enum")); default: return (message ("", s)); } } else { if (cstring_isDefined (s)) { switch (cstring_firstChar (s)) { case MARKCHAR_STRUCT: return (message ("struct %s", cstring_suffix (s, 1))); case MARKCHAR_UNION: return (message ("union %s", cstring_suffix (s, 1))); case MARKCHAR_ENUM: return (message ("enum %s", cstring_suffix (s, 1))); BADDEFAULT; } } else { return (cstring_makeLiteral ("")); } } } cstring makeParam (cstring s) { if (cstring_length(s) > 0 && cstring_firstChar (s) == MARKCHAR_PARAM) { llbug (message ("makeParam: %s\n", s)); } if (cstring_isUndefined (s)) { return cstring_undefined; } return (cstring_prependChar (MARKCHAR_PARAM, s)); } /*@observer@*/ cstring fixParamName (cstring s) { if (cstring_length(s) < 1) { return cstring_undefined; } if (cstring_firstChar (s) != MARKCHAR_PARAM) { llbug (message ("fixParamName (no #): %s", s)); } return (cstring_suffix (s, 1)); } cstring makeStruct (cstring s) { if (cstring_firstChar (s) == '@') { llbug (message ("makeStruct: %s\n", s)); } return (cstring_prependChar (MARKCHAR_STRUCT, s)); } cstring makeUnion (cstring s) { return (cstring_prependChar (MARKCHAR_UNION, s)); } cstring makeEnum (cstring s) { return (cstring_prependChar (MARKCHAR_ENUM, s)); } static unsigned int tagno = 1; void setTagNo (unsigned int n) { if (n > tagno) tagno = n; } bool isFakeTag (cstring s) { size_t length = cstring_length (s); return ((length >= 1 && cstring_firstChar (s) == '!') || (length >= 2 && cstring_getChar (s, 2) == '!')); } cstring fakeTag () { tagno++; return (message ("!%u", tagno)); } splint-3.1.2.dfsg1/src/transferChecks.c0000644021234200000250000032103510102766473015355 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** transferChecks.c */ # include "splintMacros.nf" # include "basic.h" # include "transferChecks.h" /* transfer types: */ typedef enum { TT_FCNRETURN, TT_DOASSIGN, TT_FIELDASSIGN, TT_FCNPASS, TT_GLOBPASS, TT_GLOBRETURN, TT_PARAMRETURN, TT_LEAVETRANS, TT_GLOBINIT } transferKind; static void checkStructTransfer (exprNode p_lhs, sRef p_slhs, exprNode p_rhs, sRef p_srhs, fileloc p_loc, transferKind p_tt); static void checkMetaStateConsistent (/*@exposed@*/ sRef p_fref, sRef p_tref, fileloc p_loc, transferKind p_transferType) ; static void checkLeaveTrans (uentry p_actual, transferKind p_transferType); static void checkTransfer (exprNode p_fexp, /*@dependent@*/ sRef p_fref, exprNode p_texp, /*@dependent@*/ sRef p_tref, exprNode p_fcn, /* for printing better error messages */ fileloc p_loc, transferKind p_transferType); static void checkGlobTrans (uentry p_glob, transferKind p_type); static ynm checkCompletelyDefined (exprNode p_fexp, /*@exposed@*/ sRef p_fref, sRef p_ofref, exprNode p_texp, sRef p_tref, bool p_topLevel, bool p_inUnion, bool p_directUnion, fileloc p_loc, transferKind p_transferType, int p_depth, bool p_report); static /*@exposed@*/ sRef dependentReference (sRef p_sr); static bool canLoseLocalReference (/*@dependent@*/ sRef p_sr, fileloc p_loc) ; /* ** returns the most specific alkind */ alkind alkind_resolve (alkind a1, alkind a2) { if (a1 == AK_UNKNOWN || a1 == AK_ERROR) return a2; if (a2 == AK_UNKNOWN || a2 == AK_ERROR || a2 == AK_LOCAL) return a1; if (a1 == AK_LOCAL) return a2; return a1; } /* ** tref <- fref ** ** transferType: ** FCNRETURN return fref; tref is return type ** GLOBASSIGN tref = fref; ** FCNPASS call (fref) ; tref is the argument type ** */ static /*@only@*/ cstring transferErrorMessage (transferKind transferType, alkind tkind) /*@*/ { switch (transferType) { case TT_FCNRETURN: return (message ("returned as %s", alkind_unparse (tkind))); case TT_DOASSIGN: return (message ("assigned to %s", alkind_unparse (tkind))); case TT_FIELDASSIGN: return (message ("assigned to %s", alkind_unparse (tkind))); case TT_GLOBINIT: return (message ("used as initial value for %s", alkind_unparse (tkind))); case TT_FCNPASS: return (message ("passed as %s param", alkind_unparse (tkind))); BADDEFAULT; } BADEXIT; } static /*@only@*/ cstring transferErrorExcerpt (transferKind transferType, exprNode fexp, exprNode texp, exprNode fcn) /*@*/ { switch (transferType) { case TT_FCNRETURN: return (message ("return %s", exprNode_unparse (fexp))); case TT_FIELDASSIGN: case TT_DOASSIGN: case TT_GLOBINIT: return (message ("%s = %s", exprNode_unparse (texp), exprNode_unparse (fexp))); case TT_FCNPASS: if (exprNode_isDefined (fcn)) { return message ("%s(..., %s, ...)", exprNode_unparse (fcn), exprNode_unparse (fexp)); } else { return cstring_copy (exprNode_unparse (fexp)); } BADDEFAULT; } BADEXIT; } static cstring transferErrorExpMessage (transferKind transferType, exkind tkind) /*@*/ { if (exkind_isUnknown (tkind)) { switch (transferType) { case TT_FCNRETURN: return (cstring_makeLiteral ("returned without qualification")); case TT_FIELDASSIGN: case TT_DOASSIGN: return (cstring_makeLiteral ("assigned to unqualified reference")); case TT_FCNPASS: return (cstring_makeLiteral ("passed without qualification")); case TT_GLOBINIT: return (cstring_makeLiteral ("used as initial value for unqualified storage")); BADDEFAULT; } } else { switch (transferType) { case TT_FCNRETURN: return (message ("returned as %s", exkind_unparse (tkind))); case TT_FIELDASSIGN: case TT_DOASSIGN: return (message ("assigned to %s", exkind_unparse (tkind))); case TT_FCNPASS: return (message ("passed as %s param", exkind_unparse (tkind))); BADDEFAULT; } } BADEXIT; } static /*@observer@*/ cstring transferNullMessage (transferKind transferType) /*@*/ { switch (transferType) { case TT_FCNRETURN: return (cstring_makeLiteralTemp ("returned as non-null")); case TT_DOASSIGN: case TT_FIELDASSIGN: return (cstring_makeLiteralTemp ("assigned to non-null")); case TT_GLOBINIT: return (cstring_makeLiteralTemp ("initialized to non-null")); case TT_FCNPASS: return (cstring_makeLiteralTemp ("passed as non-null param")); BADDEFAULT; } BADEXIT; } static /*@dependent@*/ exprNode atFunction = exprNode_undefined; static int atArgNo = 0; static int atNumArgs = 0; static cstring generateText (exprNode e1, exprNode e2, sRef tref, transferKind tt) /*@*/ { if (tt == TT_DOASSIGN || tt == TT_GLOBINIT) { return (message ("%s = %s", exprNode_unparse (e2), exprNode_unparse (e1))); } else if (tt == TT_FIELDASSIGN) { return (message ("%s = %s (field %q)", exprNode_unparse (e2), exprNode_unparse (e1), sRef_unparse (tref))); } else if (tt == TT_FCNPASS) { return (message ("%s (%s%s%s)", exprNode_unparse (atFunction), (atArgNo == 1 ? cstring_undefined : cstring_makeLiteralTemp ("..., ")), exprNode_unparse (e1), (atArgNo == atNumArgs ? cstring_undefined : cstring_makeLiteralTemp (", ...")))); } else { return (cstring_copy (exprNode_unparse (e1))); } } static /*@observer@*/ cstring transferType_unparse (transferKind transferType) /*@*/ { switch (transferType) { case TT_FCNRETURN: return (cstring_makeLiteralTemp ("Returned")); case TT_DOASSIGN: case TT_FIELDASSIGN: return (cstring_makeLiteralTemp ("Assigned")); case TT_FCNPASS: return (cstring_makeLiteralTemp ("Passed")); case TT_GLOBINIT: return (cstring_makeLiteralTemp ("Initialized")); case TT_GLOBRETURN: return (cstring_makeLiteralTemp ("GLOB RETURN!")); case TT_GLOBPASS: return (cstring_makeLiteralTemp ("GLOB PASS!")); case TT_PARAMRETURN: return (cstring_makeLiteralTemp ("PARAM RETURN!")); case TT_LEAVETRANS: return (cstring_makeLiteralTemp ("LEAVE TRANS!")); BADDEFAULT; } BADEXIT; } static /*@observer@*/ cstring udError (sRef s) { if (sRef_isDead (s)) { return cstring_makeLiteralTemp ("released"); } else if (sRef_isAllocated (s)) { return cstring_makeLiteralTemp ("allocated but not defined"); } else { return cstring_makeLiteralTemp ("undefined"); } } static /*@only@*/ cstring defExpl (sRef s) /*@*/ { sRef rb = sRef_getRootBase (s); if (sRef_sameName (rb, s)) { if (sRef_isAllocated (s)) { return cstring_makeLiteral (" (allocated only)"); } return cstring_undefined; } else { return (message (" (%q is %s)", sRef_unparse (s), udError (s))); } } /* ** ** More than just definition checking --- checks for consistent state also! ** ** Returns TRUE if fref is completely defined. ** if !report, returns TRUE unless error is at the deep level. */ static ynm checkCompletelyDefined (exprNode fexp, /*@exposed@*/ sRef fref, sRef ofref, exprNode texp, sRef tref, bool topLevel, bool inUnion, bool directUnion, fileloc loc, transferKind transferType, int depth, bool report) { ctype ct; alkind fkind = sRef_getAliasKind (fref); alkind tkind = sRef_getAliasKind (tref); DPRINTF (("Check completely defined: %s [%s] / %s [%s]", exprNode_unparse (fexp), sRef_unparseFull (fref), exprNode_unparse (texp), sRef_unparseFull (tref))); if (depth > MAXDEPTH) { llquietbug (message ("Check definition limit exceeded, checking %q. " "This either means there is a variable with at least " "%d indirections apparent in the program text, or " "there is a bug in Splint.", sRef_unparse (fref), MAXDEPTH)); return YES; } if (!sRef_isKnown (fref)) { return YES; } if (sRef_isDead (fref)) { DPRINTF (("Dead storage to completely defined: %s", sRef_unparseFull (fref))); } if (alkind_isStack (fkind)) { ctype rt = ctype_realType (sRef_getType (tref)); if (ctype_isMutable (rt) && !ctype_isSU (rt)) { if (transferType == TT_PARAMRETURN) { if (optgenerror (FLG_RETSTACK, message ("Stack-allocated storage %qreachable from parameter %q", sRef_unparseOpt (fref), sRef_unparse (ofref)), loc)) { sRef_showAliasInfo (fref); } } else if (transferType == TT_GLOBRETURN) { if (optgenerror (FLG_RETSTACK, message ("Stack-allocated storage %qreachable from global %q", sRef_unparseOpt (fref), sRef_unparse (ofref)), loc)) { sRef_showAliasInfo (fref); } } else if (transferType == TT_FCNRETURN) { if (optgenerror (FLG_RETSTACK, message ("Stack-allocated storage %qreachable from return value: %s", sRef_unparseOpt (fref), exprNode_unparse (fexp)), loc)) { sRef_showAliasInfo (fref); } } else { /* no error */ } } } if (!topLevel) { DPRINTF (("From: %s ==> %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); checkMetaStateConsistent (fref, tref, loc, transferType); if ((sRef_isObserver (fref) && !sRef_isObserver (tref)) || (sRef_isExposed (fref) && !(sRef_isObserver (tref) || sRef_isExposed (tref)))) { flagcode code = (sRef_isObserver (fref) ? FLG_OBSERVERTRANS : FLG_EXPOSETRANS); if (!sRef_isStateLive (fref)) { ; /* no error (will be a definition error) */ } else if (transferType == TT_DOASSIGN || transferType == TT_FIELDASSIGN || transferType == TT_GLOBINIT || transferType == TT_FCNPASS) { ; /* no error */ } else if (transferType == TT_PARAMRETURN) { if (optgenerror (code, message ("%s storage %qreachable from %s parameter", exkind_capName (sRef_getExKind (fref)), sRef_unparseOpt (fref), exkind_unparseError (sRef_getExKind (tref))), loc)) { sRef_showExpInfo (fref); sRef_setExKind (fref, XO_UNKNOWN, loc); } } else if (transferType == TT_LEAVETRANS) { ; } else if (transferType == TT_GLOBINIT) { if (optgenerror (code, message ("%s storage %qreachable from %s initial value", exkind_capName (sRef_getExKind (fref)), sRef_unparseOpt (fref), exkind_unparseError (sRef_getExKind (tref))), loc)) { sRef_showExpInfo (fref); sRef_setExKind (fref, XO_UNKNOWN, loc); } } else if (transferType == TT_GLOBRETURN) { if (optgenerror (code, message ("%s storage %qreachable from %s global", exkind_capName (sRef_getExKind (fref)), sRef_unparseOpt (fref), exkind_unparseError (sRef_getExKind (tref))), loc)) { sRef_showExpInfo (fref); sRef_setExKind (fref, XO_UNKNOWN, loc); } } else if (transferType == TT_FCNRETURN) { if (optgenerror (code, message ("%s storage %qreachable from %s return value", exkind_capName (sRef_getExKind (fref)), sRef_unparseOpt (fref), exkind_unparseError (sRef_getExKind (tref))), loc)) { sRef_showExpInfo (fref); sRef_setExKind (fref, XO_UNKNOWN, loc); } } else { llcontbug (message ("Transfer type: %s", transferType_unparse (transferType))); if (optgenerror (code, message ("%s storage %qreachable from %s return value", exkind_capName (sRef_getExKind (fref)), sRef_unparseOpt (fref), exkind_unparseError (sRef_getExKind (tref))), loc)) { sRef_showExpInfo (fref); sRef_setExKind (fref, XO_UNKNOWN, loc); } } } if (!alkind_compatible (fkind, tkind)) { if (fkind == AK_UNKNOWN && !sRef_isStateLive (fref)) { ; /* no error (will be a definition error) */ } else if (transferType == TT_DOASSIGN || transferType == TT_FIELDASSIGN) /* evans 2002-02-05 - added TT_FIELDASSIGN */ { ; /* no error */ } else if (transferType == TT_FCNPASS) { if (alkind_isKnown (sRef_getAliasKind (tref))) { if (optgenerror (FLG_COMPMEMPASS, message ("Storage %qreachable from passed parameter " "is %s (should be %s): %s", sRef_unparseOpt (fref), alkind_unparse (sRef_getAliasKind (fref)), alkind_unparse (sRef_getAliasKind (tref)), exprNode_unparse (fexp)), loc)) { sRef_showAliasInfo (fref); } } } else if (transferType == TT_PARAMRETURN) { bool noerror = FALSE; if (alkind_isDependent (sRef_getAliasKind (fref))) { if (canLoseLocalReference (fref, loc)) { noerror = TRUE; } } if (!noerror && optgenerror (FLG_COMPMEMPASS, message ("Storage %qreachable from parameter is %s (should be %s)", sRef_unparseOpt (fref), alkind_unparse (sRef_getAliasKind (fref)), alkind_unparse (sRef_getAliasKind (tref))), loc)) { sRef_showAliasInfo (fref); } } else if (transferType == TT_LEAVETRANS) { if (optgenerror (FLG_COMPMEMPASS, message ("Storage %qreachable from temporary reference is %s " "at scope exit (should be %s)", sRef_unparseOpt (fref), alkind_unparse (sRef_getAliasKind (fref)), alkind_unparse (sRef_getAliasKind (tref))), loc)) { sRef_showAliasInfo (fref); } } else if (transferType == TT_GLOBRETURN) { if (optgenerror (FLG_COMPMEMPASS, message ("Storage %qreachable from global is %s (should be %s)", sRef_unparseOpt (fref), alkind_unparse (sRef_getAliasKind (fref)), alkind_unparse (sRef_getAliasKind (tref))), loc)) { sRef_showAliasInfo (fref); } } else if (transferType == TT_FCNRETURN) { if (optgenerror (FLG_COMPMEMPASS, message ("Storage %qreachable from return value is %s (should be %s)", sRef_unparseOpt (fref), alkind_unparse (sRef_getAliasKind (fref)), alkind_unparse (sRef_getAliasKind (tref))), loc)) { sRef_showAliasInfo (fref); } } else if (transferType == TT_GLOBINIT) { if (optgenerror (FLG_COMPMEMPASS, message ("Storage %qreachable from initial value is %s (should be %s)", sRef_unparseOpt (fref), alkind_unparse (sRef_getAliasKind (fref)), alkind_unparse (sRef_getAliasKind (tref))), loc)) { sRef_showAliasInfo (fref); } } else { llcontbug (message ("Transfer type: %s", transferType_unparse (transferType))); if (optgenerror (FLG_COMPMEMPASS, message ("Storage %qreachable from return value is %s (should be %s)", sRef_unparseOpt (fref), alkind_unparse (sRef_getAliasKind (fref)), alkind_unparse (sRef_getAliasKind (tref))), loc)) { sRef_showAliasInfo (fref); } } } if (sRef_isDead (fref)) { if (directUnion) { return NO; } if (transferType == TT_PARAMRETURN) { if (optgenerror (FLG_USERELEASED, message ("Released storage %q reachable from parameter at return point", sRef_unparse (fref)), loc)) { sRef_showStateInfo (fref); return YES; } } else if (transferType == TT_LEAVETRANS) { if (optgenerror (FLG_USERELEASED, message ("Released storage %q reachable from temporary " "reference at scope exit", sRef_unparse (fref)), loc)) { sRef_showStateInfo (fref); return YES; } } else if (transferType == TT_GLOBRETURN) { if (optgenerror (FLG_GLOBSTATE, message ("Released storage %q reachable from global", sRef_unparse (fref)), loc)) { sRef_showStateInfo (fref); return YES; } } else if (transferType == TT_FCNPASS) { if (optgenerror (FLG_USERELEASED, message ("Released storage %q reachable from passed parameter", sRef_unparse (fref)), loc)) { sRef_showStateInfo (fref); return YES; } } else { if (optgenerror (FLG_USERELEASED, message ("Released storage %q reachable from parameter", sRef_unparse (fref)), loc)) { sRef_showStateInfo (fref); return YES; } } } } if (!topLevel && sRef_possiblyNull (fref) && !sRef_perhapsNull (tref) && ctype_isRealPointer (sRef_getType (tref)) && !usymtab_isGuarded (fref)) { if (transferType == TT_FCNRETURN) { if (optgenerror (FLG_NULLRET, message ("%q storage %qderivable from return value: %s", cstring_capitalize (sRef_nullMessage (fref)), sRef_unparseOpt (fref), exprNode_unparse (fexp)), loc)) { sRef_showNullInfo (fref); DPRINTF (("fref: %s", sRef_unparseFull (fref))); DPRINTF (("tref: %s", sRef_unparseFull (tref))); sRef_setNullError (fref); } } else if (transferType == TT_GLOBRETURN || transferType == TT_PARAMRETURN) { if (optgenerror (FLG_NULLSTATE, message ("Function returns with %s storage derivable from %q %q", sRef_nullMessage (fref), cstring_makeLiteral ((transferType == TT_GLOBRETURN) ? "global" : "parameter"), sRef_unparse (fref)), loc)) { sRef_showNullInfo (fref); sRef_setNullError (fref); } } else if (transferType == TT_GLOBPASS) { if (optgenerror (FLG_NULLPASS, message ("Function called with %s storage " "derivable from global %q", sRef_nullMessage (fref), sRef_unparse (fref)), loc)) { sRef_showNullInfo (fref); sRef_setNullError (fref); } } else if (transferType == TT_FCNPASS) { if (optgenerror (FLG_NULLSTATE, message ("%q storage %qderivable from parameter %q", cstring_capitalize (sRef_nullMessage (fref)), sRef_unparseOpt (fref), generateText (fexp, exprNode_undefined, sRef_undefined, TT_FCNPASS)), loc)) { DPRINTF (("fref: %s", sRef_unparseFull (fref))); DPRINTF (("tref: %s", sRef_unparseFull (tref))); sRef_showNullInfo (fref); sRef_setNullError (fref); } } else { llassert (transferType == TT_DOASSIGN || transferType == TT_FIELDASSIGN /* evans 2002-02-05: no warnings for local fields */ || transferType == TT_GLOBINIT || transferType == TT_LEAVETRANS); } } if (sRef_isRelDef (tref) || sRef_isPartial (tref) || sRef_isAllocated (tref) || sRef_isStateSpecial (tref)) { /* should check fref is allocated? */ return YES; } ct = ctype_realType (sRef_getType (fref)); DPRINTF (("Here: %s", ctype_unparse (ct))); if (!(sRef_isAnyDefined (fref) || sRef_isPdefined (fref) || sRef_isAllocated (fref) || sRef_isStateUnknown (fref))) { if (transferType == TT_GLOBRETURN) { if (report && optgenerror (FLG_COMPDEF, message ("Function returns with global %q not " "completely defined%q", sRef_unparse (sRef_getRootBase (fref)), defExpl (fref)), loc)) { sRef_showStateInfo (fref); sRef_setDefined (fref, loc); } } else if (transferType == TT_GLOBPASS) { if (report && optgenerror (FLG_COMPDEF, message ("Function called with global %q not completely defined%q", sRef_unparse (sRef_getRootBase (fref)), defExpl (fref)), loc)) { sRef_showStateInfo (fref); sRef_setDefined (fref, loc); } } else if (transferType == TT_PARAMRETURN) { if (report && !topLevel && optgenerror (FLG_COMPDEF, message ("Function returns storage %q reachable from parameter not " "completely defined%q", sRef_unparse (ofref), defExpl (fref)), loc)) { sRef_showStateInfo (fref); sRef_setDefined (fref, loc); } } else if (transferType == TT_LEAVETRANS) { if (report && !topLevel && optgenerror (FLG_COMPDEF, message ("Scope exits with storage %q reachable from " "temporary reference not completely defined%q", sRef_unparse (ofref), defExpl (fref)), loc)) { sRef_showStateInfo (fref); sRef_setDefined (fref, loc); } } else { if (transferType != TT_DOASSIGN && (!(sRef_isNew (fref) || sRef_isType (fref)))) { if (report) { DPRINTF (("Here we are: %s", sRef_unparseFull (fref))); if (sRef_isDead (fref)) { if (optgenerror (FLG_USERELEASED, message ("%s storage %qwas released: %q", transferType_unparse (transferType), sRef_unparseOpt (fref), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showStateInfo (fref); } } else { if (optgenerror (FLG_COMPDEF, message ("%s storage %qnot completely defined%q: %q", transferType_unparse (transferType), sRef_unparseOpt (ofref), defExpl (fref), generateText (fexp, texp, tref, transferType)), loc)) { sRef rb = sRef_getRootBase (fref); sRef_showStateInfo (fref); sRef_setDefinedCompleteDirect (rb, loc); } } } } else { if (sRef_isAllocated (fref) && sRef_isValid (tref) && (transferType == TT_DOASSIGN)) { sRef_setAllocatedComplete (tref, loc); } return YES; } } return NO; } if (ctype_isUnknown (ct)) { return YES; } else if (ctype_isPointer (ct) || ctype_isArray (ct)) /* evans 2001-07-12 added ctype_isArray */ { ctype tct = ctype_realType (sRef_getType (tref)); if (sRef_isStateUnknown (fref)) { return NO; } else { DPRINTF (("Here fref: %s", sRef_unparseFull (fref))); DPRINTF (("Here tref: %s", sRef_unparseFull (tref))); if (ctype_isAP (tct) || ctype_isUnknown (tct)) { sRef fptr = sRef_constructDeref (fref); sRef tptr = sRef_constructDeref (tref); DPRINTF (("Here tptr: %s", sRef_unparseFull (tptr))); return (checkCompletelyDefined (fexp, fptr, ofref, texp, tptr, FALSE, inUnion, FALSE, loc, transferType, depth + 1, report)); } else { return YES; } } } else if (ctype_isStruct (ct)) { ctype tct = ctype_realType (sRef_getType (tref)); DPRINTF (("Struct defined: %s", ctype_unparse (tct))); if (ctype_match (ct, tct)) { bool isOk = TRUE; bool hasOneDefined = FALSE; cstringSList badFields = cstringSList_undefined; if (sRef_isStateUnknown (fref) || sRef_isAllocated (tref)) { return YES; } DPRINTF (("Check field: %s", sRef_unparseFull (fref))); if (sRef_isPdefined (fref) || sRef_isAnyDefined (fref)) { DPRINTF (("Is defined: %s", sRef_unparse (fref))); sRefSet_realElements (sRef_derivedFields (fref), sr) { bool thisField; hasOneDefined = TRUE; DPRINTF (("Check derived: %s", sRef_unparseFull (sr))); if (sRef_isField (sr)) { cstring fieldname = sRef_getField (sr); sRef fldref = sRef_makeField (tref, fieldname); bool shouldCheck = !sRef_isRecursiveField (fldref); if (shouldCheck) { thisField = ynm_toBoolRelaxed (checkCompletelyDefined (fexp, sr, ofref, texp, fldref, FALSE, inUnion, FALSE, loc, transferType, depth + 1, FALSE)); } else { thisField = TRUE; } if (!thisField) { isOk = FALSE; badFields = cstringSList_add (badFields, sRef_getField (sr)); } } } end_sRefSet_realElements; } else if (sRef_isAllocated (fref)) { /* ** for structures, each field must be completely defined */ uentryList fields = ctype_getFields (ct); uentryList_elements (fields, ue) { bool thisField; cstring name = uentry_getRealName (ue); sRef ffield = sRef_makeField (fref, name); sRef tfield = sRef_makeField (tref, name); bool shouldCheck = !sRef_isRecursiveField (tfield); if (!shouldCheck) { thisField = TRUE; } else { thisField = ynm_toBoolRelaxed (checkCompletelyDefined (fexp, ffield, ofref, texp, tfield, FALSE, inUnion, FALSE, loc, transferType, depth + 1, FALSE)); } if (!thisField) { isOk = FALSE; badFields = cstringSList_add (badFields, uentry_rawName (ue)); } else { hasOneDefined = TRUE; } } end_uentryList_elements; } else { DPRINTF (("Not checking: %s", sRef_unparseFull (fref))); } if (!isOk && (!inUnion || hasOneDefined)) { if (transferType == TT_GLOBRETURN) { if (optgenerror (FLG_COMPDEF, message ("Global storage %q contains %d undefined field%& " "when call returns: %q", sRef_unparse (fref), cstringSList_size (badFields), cstringSList_unparseAbbrev (badFields)), loc)) { sRef_setDefined (fref, loc); } } else if (transferType == TT_GLOBPASS) { if (optgenerror (FLG_COMPDEF, message ("Global storage %q contains %d undefined field%& " "before call: %q", sRef_unparse (fref), cstringSList_size (badFields), cstringSList_unparseAbbrev (badFields)), loc)) { sRef_setDefined (fref, loc); } } else if (transferType == TT_PARAMRETURN) { if (optgenerror (FLG_COMPDEF, message ("Storage %qreachable from parameter " "contains %d undefined field%&: %q", sRef_unparseOpt (fref), cstringSList_size (badFields), cstringSList_unparseAbbrev (badFields)), loc)) { sRef_setDefined (fref, loc); } } else if (transferType == TT_LEAVETRANS) { /* no error */ } else { if (optgenerror (FLG_COMPDEF, message ("%s storage %qcontains %d undefined field%&: %q", transferType_unparse (transferType), sRef_unparseOpt (fref), cstringSList_size (badFields), cstringSList_unparseAbbrev (badFields)), loc)) { sRef_setDefined (fref, loc); } } } cstringSList_free (badFields); if (inUnion) { if (directUnion) { return (ynm_fromBool (hasOneDefined)); } else { return (MAYBE); } } else { return (ynm_fromBool (!report || isOk)); } } else { return YES; } } else if (ctype_isUnion (ct)) { if (sRef_isStateUnknown (fref) || sRef_isAllocated (tref)) { return YES; } else { ctype tct = ctype_realType (sRef_getType (tref)); if (ctype_isKnown (tct) && ctype_match (ct, tct)) { cstringSList goodFields = cstringSList_new (); bool isOk = FALSE; int nelements = sRefSet_size (sRef_derivedFields (fref)); /* ** for unions, at least one field must be completely defined */ if (sRef_isPdefined (fref) || sRef_isAnyDefined (fref)) { isOk = TRUE; } sRefSet_realElements (sRef_derivedFields (fref), sr) { bool thisField; if (sRef_isField (sr)) { sRef fldref = sRef_makeField (tref, sRef_getField (sr)); DPRINTF (("Trying union field: %s", sRef_unparseFull (fldref))); thisField = ynm_toBoolStrict (checkCompletelyDefined (fexp, sr, ofref, texp, fldref, FALSE, inUnion, (nelements > 1 ? TRUE : FALSE), loc, transferType, depth + 1, FALSE)); if (thisField) { goodFields = cstringSList_add (goodFields, sRef_getField (sr)); } } } end_sRefSet_realElements; if (cstringSList_empty (goodFields) && !isOk && context_getFlag (FLG_UNIONDEF)) { if (!inUnion) { if (transferType == TT_PARAMRETURN) { voptgenerror (FLG_UNIONDEF, message ("Union %q reachable from parameter has " "no defined field", sRef_unparse (fref)), loc); } else if (transferType == TT_LEAVETRANS) { voptgenerror (FLG_UNIONDEF, message ("Union %q has no defined field at scope exit", sRef_unparse (fref)), loc); } /* evans 2001-08-21: added this branch for global returns */ else if (transferType == TT_GLOBRETURN) { voptgenerror (FLG_UNIONDEF, message ("Union %q reachable from global %q has " "no defined field", sRef_unparse (fref), sRef_unparse (sRef_getRootBase (fref))), loc); } else if (transferType == TT_DOASSIGN || transferType == TT_FIELDASSIGN || transferType == TT_GLOBINIT) { ; /* no error */ } else { voptgenerror (FLG_UNIONDEF, message ("%s union %q has no defined field", transferType_unparse (transferType), sRef_unparse (fref)), loc); } } isOk = FALSE; } cstringSList_free (goodFields); return ynm_fromBool (!report || isOk); } } } else { ; } return YES; } /* ** fref is being free'd */ typedef enum { DSC_GLOB, DSC_LOCAL, DSC_PARAM, DSC_STRUCT } dscCode; static /*@observer@*/ cstring dscCode_unparse (dscCode desc) /*@*/ { switch (desc) { case DSC_GLOB: return cstring_makeLiteralTemp ("killed global"); case DSC_LOCAL: return cstring_makeLiteralTemp ("variable declared in this scope"); case DSC_PARAM: return cstring_makeLiteralTemp ("released storage"); case DSC_STRUCT: return cstring_makeLiteralTemp ("released structure parameter"); } BADEXIT; } static bool checkCompletelyDestroyed (exprNode p_fexp, sRef p_fref, bool p_topLevel, bool p_isField, fileloc p_loc, int p_depth, dscCode p_desc, bool p_hideErrors); bool transferChecks_globalDestroyed (sRef fref, fileloc loc) { DPRINTF (("Global destroyed: %s", sRef_unparseFull (fref))); return (checkCompletelyDestroyed (exprNode_undefined, fref, TRUE, FALSE, loc, 0, DSC_GLOB, FALSE)); } void transferChecks_localDestroyed (sRef fref, fileloc loc) { if (sRef_isObserver (fref) || sRef_isExposed (fref) || sRef_isPartial (fref)) { ; } else { (void) checkCompletelyDestroyed (exprNode_undefined, fref, TRUE, FALSE, loc, 0, DSC_LOCAL, FALSE); } } void transferChecks_structDestroyed (sRef fref, fileloc loc) { DPRINTF (("Check struct destroyed: %s", sRef_unparse (fref))); if (sRef_isObserver (fref) || sRef_isExposed (fref) || sRef_isPartial (fref)) { DPRINTF (("Its exposed!"));; } else { (void) checkCompletelyDestroyed (exprNode_undefined, fref, TRUE, FALSE, loc, 0, DSC_STRUCT, FALSE); } } static bool checkCompletelyDestroyed (exprNode fexp, sRef fref, bool topLevel, bool isField, fileloc loc, int depth, dscCode desc, bool hideErrors) { ctype ct; DPRINTF (("Check completely destroyed: %s / %s", sRef_unparse (fref), bool_unparse (hideErrors))); if (depth > MAXDEPTH) { llquietbug (message ("checkCompletelyDestroyed: too deep: %s / %q", exprNode_unparse (fexp), sRef_unparseFull (fref))); return TRUE; } if (!sRef_isKnown (fref)) return TRUE; /* evans 2001-03-24: added this. Definitely null values are always destroyed. */ if (sRef_isDefinitelyNull (fref)) { return TRUE; } if (sRef_isDependent (fref) || sRef_isShared (fref) || sRef_isKept (fref)) { return TRUE; } { /* ** evans 2001-03-24: if there is a dependent reference to this storage, ** no need to destroy, but make it responsible. */ sRef depRef = dependentReference (fref); DPRINTF (("Destroyed? %s / %s", sRef_unparseFull (fref), sRef_unparseFull (depRef))); DPRINTF (("Aliases: %s", usymtab_unparseAliases ())); if (sRef_isValid (depRef)) { /* ** If the referenced storage was not dependent, we make ** the reference the owner since it must eventually be ** destroyed. */ if (!sRef_isDependent (depRef)) { sRef_setOnly (depRef, loc); /* could be owned? */ } sRef_kill (fref, loc); return TRUE; } } ct = ctype_realType (sRef_getType (fref)); if (sRef_isPdefined (fref) && ctype_isAP (ct) && !isField && !context_getFlag (FLG_STRICTDESTROY)) { /* ** Don't report errors for array elements (unless strictdestroy) ** when at least one appears to have been destroyed. */ DPRINTF (("Partial: %s / hiding errors: %s", sRef_unparseFull (fref), ctype_unparse (ct))); hideErrors = TRUE; /* Don't report any more errors, but still change ownership. */ } if (usymtab_isDefinitelyNull (fref)) { DPRINTF (("Probably null!")); return TRUE; } /* ** evans 2002-01-02: removed this ** if (!context_flagOn (FLG_COMPDESTROY, loc)) ** { ** return TRUE; ** } ** ** if (!context_getFlag (FLG_MUSTFREEONLY)) return TRUE; */ DPRINTF (("Here: %s", ctype_unparse (ct))); if (!topLevel) { bool docheck = FALSE; bool reportederror; if (sRef_isFresh (fref) || sRef_isOnly (fref)) { docheck = TRUE; DPRINTF (("Here: %s", ctype_unparse (ct))); if (sRef_isDead (fref) || sRef_isUnuseable (fref) || sRef_definitelyNull (fref) || sRef_isObserver (fref) || sRef_isExposed (fref)) { docheck = FALSE; } } if (docheck) { if (sRef_isPossiblyDead (fref) || sRef_isRelDef (fref)) { if (exprNode_isDefined (fexp)) { reportederror = !hideErrors && optgenerror2 (FLG_COMPDESTROY, FLG_STRICTDESTROY, message ("Only storage %q (type %s) derived from %s " "may not have been released: %s", sRef_unparse (fref), ctype_unparse (sRef_getType (fref)), dscCode_unparse (desc), exprNode_unparse (fexp)), loc); } else { reportederror = !hideErrors && optgenerror2 (FLG_COMPDESTROY, FLG_STRICTDESTROY, message ("Only storage %q (type %s) derived from %s " "may not have been released", sRef_unparse (fref), ctype_unparse (sRef_getType (fref)), dscCode_unparse (desc)), loc); } if (reportederror) { sRef_kill (fref, loc); /* prevent further errors */ } } else { if (sRef_isStateUndefined (fref)) { DPRINTF (("Here: %s", ctype_unparse (ct))); return TRUE; } else { if (exprNode_isDefined (fexp)) { DPRINTF (("Here: %s", sRef_unparseFull (fref))); reportederror = !hideErrors && optgenerror (FLG_COMPDESTROY, message ("Only storage %q (type %s) derived from %s " "is not released (memory leak): %s", sRef_unparse (fref), ctype_unparse (sRef_getType (fref)), dscCode_unparse (desc), exprNode_unparse (fexp)), loc); } else { reportederror = !hideErrors && optgenerror (FLG_COMPDESTROY, message ("Only storage %q (type %s) derived from %s " "is not released (memory leak)", sRef_unparse (fref), ctype_unparse (sRef_getType (fref)), dscCode_unparse (desc)), loc); } if (reportederror) { hideErrors = TRUE; /* sRef_kill (fref, loc); */ /* prevent further errors */ DPRINTF (("Killed: %s", sRef_unparseFull (fref))); } } } DPRINTF (("Here: %s", ctype_unparse (ct))); return FALSE; } if (/*! evs-2002-03-24 sRef_isAnyDefined (fref) || */ sRef_isDead (fref) || (sRef_isPdefined (fref) && sRefSet_isEmpty (sRef_derivedFields (fref)))) { DPRINTF (("Here: %s [%s / %s]", sRef_unparseFull (fref), bool_unparse (sRef_isAnyDefined (fref)), bool_unparse (sRef_isDead (fref)))); return TRUE; } } DPRINTF (("Here...")); if (ctype_isPointer (ct)) { sRef fptr = sRef_constructDeadDeref (fref); bool res; res = checkCompletelyDestroyed (fexp, fptr, FALSE, FALSE, loc, depth + 1, desc, hideErrors); return res; } else if (ctype_isArray (ct)) { if ((sRef_isStateUnknown (fref) || sRef_isAllocated (fref)) && !sRef_hasDerived (fref)) { /* ** Bogosity necessary to prevent infinite depth. */ return FALSE; } else { sRef farr = sRef_constructDeadDeref (fref); return (checkCompletelyDestroyed (fexp, farr, FALSE, FALSE, loc, depth + 1, desc, hideErrors)); } } else if (ctype_isStruct (ct)) { /* ** for structures, each field must be completely destroyed */ bool isOk = TRUE; uentryList fields = ctype_getFields (ct); DPRINTF (("Struct fields: %s", uentryList_unparse (fields))); if (depth >= MAXDEPTH) { llquietbug (message ("checkCompletelyDestroyed (fields): too deep: %s / %q", exprNode_unparse (fexp), sRef_unparseFull (fref))); return TRUE; } else { uentryList_elements (fields, ue) { sRef field = sRef_makeField (fref, uentry_rawName (ue)); /* ** note order of && operands --- want to report multiple errors */ DPRINTF (("Check field: %s", sRef_unparseFull (field))); isOk = (checkCompletelyDestroyed (fexp, field, FALSE, TRUE, loc, depth + 1, desc, hideErrors) && isOk); } end_uentryList_elements; } return isOk; } else { return TRUE; } } void transferChecks_return (exprNode fexp, uentry rval) { sRef uref = uentry_getSref (rval); sRef rref = sRef_makeNew (sRef_getType (uref), uref, cstring_undefined); uentry fcn = context_getHeader (); sRef fref = exprNode_getSref (fexp); stateClauseList clauses = uentry_getStateClauseList (fcn); DPRINTF (("Check return: %s as %s = %s", exprNode_unparse (fexp), sRef_unparseFull (uref), sRef_unparseFull (rref))); /* evans 2001-07-18: removed: if (sRef_isStateSpecial (rref)) */ DPRINTF (("Check state clauses: %s", stateClauseList_unparse (clauses))); stateClauseList_postElements (clauses, cl) { if (stateClause_isGlobal (cl)) { ; } else if (stateClause_setsMetaState (cl)) { sRefSet refs = stateClause_getRefs (cl); qual ql = stateClause_getMetaQual (cl); annotationInfo ainfo = qual_getAnnotationInfo (ql); metaStateInfo minfo = annotationInfo_getState (ainfo); cstring key = metaStateInfo_getName (minfo); int mvalue = annotationInfo_getValue (ainfo); DPRINTF (("Return check: %s", stateClause_unparse (cl))); sRefSet_elements (refs, el) { sRef base = sRef_getRootBase (el); DPRINTF (("Sets meta state! %s", stateClause_unparse (cl))); if (sRef_isResult (base)) { sRef sr = sRef_fixBase (el, fref); if (!sRef_checkMetaStateValue (sr, key, mvalue)) { if (optgenerror (FLG_STATETRANSFER, message ("Result state %q does not satisfy ensures " "clause: %q (state is %q, should be %s): %s", sRef_unparse (sr), stateClause_unparse (cl), stateValue_unparseValue (sRef_getMetaStateValue (sr, key), minfo), metaStateInfo_unparseValue (minfo, mvalue), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRef_showAliasInfo (sr); } } } else { /* ** Non-results are checked in exit scope. */ } } end_sRefSet_elements ; } else { sRefSet refs = stateClause_getRefs (cl); sRefTest tst = stateClause_getPostTestFunction (cl); sRefMod modf = stateClause_getReturnEffectFunction (cl); DPRINTF (("Clause: %s / %s", stateClause_unparse (cl), sRefSet_unparse (refs))); sRefSet_elements (refs, el) { sRef base = sRef_getRootBase (el); DPRINTF (("el: %s / %s", sRef_unparse (el), sRef_unparse (base))); if (sRef_isResult (base) && !sRef_isDefinitelyNull (fref)) /* evans 2002-07-22: don't report allocation errors for null results */ { sRef sr = sRef_fixBase (el, fref); if (tst != NULL && !(tst (sr))) { if (optgenerror (stateClause_postErrorCode (cl), message ("%s storage %q corresponds to " "storage %q listed in %q clause: %s", stateClause_postErrorString (cl, sr), sRef_unparse (sr), sRef_unparse (el), stateClause_unparseKind (cl), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRefShower ss = stateClause_getPostTestShower (cl); if (ss != NULL) { ss (sr); } } } if (modf != NULL) { modf (sr, exprNode_loc (fexp)); } } else { /* ** Non-results are checked in exit scope. */ } } end_sRefSet_elements ; } } end_stateClauseList_postElements ; if (ctype_isRealSU (exprNode_getType (fexp))) { sRef ffref = exprNode_getSref (fexp); checkStructTransfer (exprNode_undefined, rref, fexp, ffref, exprNode_loc (fexp), TT_FCNRETURN); } else { (void) checkTransfer (fexp, exprNode_getSref (fexp), exprNode_undefined, rref, exprNode_undefined, exprNode_loc (fexp), TT_FCNRETURN); } } static void checkPassstateClauseList (uentry ue, exprNode fexp, sRef fref, int argno) { stateClauseList clauses = uentry_getStateClauseList (ue); DPRINTF (("Check pass special: %s / %s", exprNode_unparse (fexp), sRef_unparseFull (fref))); stateClauseList_preElements (clauses, cl) { if (stateClause_isGlobal (cl)) { ; } else { sRefSet refs = stateClause_getRefs (cl); sRefTest tst = stateClause_getPreTestFunction (cl); sRefMod modf = stateClause_getEffectFunction (cl); sRefSet_elements (refs, el) { sRef base = sRef_getRootBase (el); if (sRef_isResult (base)) { ; /* nothing to check before */ } else if (sRef_isParam (base)) { if (sRef_getParam (base) == argno - 1) { sRef sb; DPRINTF (("Fix base: %s / %s", sRef_unparseFull (el), sRef_unparseFull (fref))); sb = sRef_fixBase (el, fref); if (tst != NULL && !(tst(sb))) { voptgenerror (stateClause_preErrorCode (cl), message ("%s storage %qcorresponds to " "storage listed in %q clause of " "called function: %s", stateClause_preErrorString (cl, sb), sRef_unparseOpt (sb), stateClause_unparseKind (cl), exprNode_unparse (fexp)), exprNode_loc (fexp)); } if (modf != NULL) { DPRINTF (("Fixing: %s", sRef_unparseFull (sb))); modf (sb, exprNode_loc (fexp)); DPRINTF (("==> %s", sRef_unparseFull (sb))); } } } else { BADBRANCH; } } end_sRefSet_elements ; } } end_stateClauseList_preElements ; DPRINTF (("After: %s", sRef_unparseFull (fref))); } /* ** should not modify arg */ void transferChecks_passParam (exprNode fexp, uentry arg, bool isSpec, /*@dependent@*/ exprNode fcn, int argno, int totargs) { sRef tref = uentry_getSref (arg); sRef fref = exprNode_getSref (fexp); bool isOut = FALSE; bool isPartial = FALSE; bool isImpOut = FALSE; ctype ct = uentry_getType (arg); DPRINTF (("Check pass: %s -> %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); atFunction = fcn; atArgNo = argno; atNumArgs = totargs; if (ctype_isElips (ct)) { ct = ctype_unknown; } DPRINTF (("Out arg: %s", bool_unparse (uentry_isOut (arg)))); if (!ctype_isElips (ct) && (ctype_isVoidPointer (ct) && uentry_isOut (arg) && sRef_isOnly (tref))) { if (ctype_isRealAP (ct)) { if (sRef_aliasCheckSimplePred (sRef_isDead, fref)) { if (optgenerror (FLG_USERELEASED, message ("Dead storage %qpassed as out parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp))) { if (sRef_isDead (fref)) { sRef_showStateInfo (fref); } else { DPRINTF (("Not really dead!")); sRef_showStateInfo (fref); } } sRef_setAllocated (fref, exprNode_loc (fexp)); } else if (context_getFlag (FLG_STRICTUSERELEASED) && sRef_aliasCheckSimplePred (sRef_isPossiblyDead, fref)) { if (optgenerror2 (FLG_USERELEASED, FLG_STRICTUSERELEASED, message ("Possibly dead storage %qpassed as out parameter: %s", sRef_unparseOpt (fref), exprNode_unparse (fexp)), exprNode_loc (fexp))) { if (sRef_isPossiblyDead (fref)) { sRef_showStateInfo (fref); } } sRef_setAllocated (fref, exprNode_loc (fexp)); } else if (sRef_aliasCheckSimplePred (sRef_isStateUndefined, fref) || sRef_aliasCheckSimplePred (sRef_isUnuseable, fref)) { voptgenerror (FLG_USEDEF, message ("Unallocated storage %qpassed as out parameter: %s", sRef_unparseOpt (fref), exprNode_unparse (fexp)), exprNode_loc (fexp)); sRef_setAllocated (fref, exprNode_loc (fexp)); } else { ; } } (void) checkCompletelyDestroyed (fexp, fref, TRUE, FALSE, exprNode_loc (fexp), 0, DSC_PARAM, FALSE); /* make it defined now, so checkTransfer is okay */ sRef_setDefined (fref, exprNode_loc (fexp)); } else if (uentry_isOut (arg)) { DPRINTF (("Here we are!")); if (ctype_isRealAP (ct) && (sRef_isStateUndefined (fref) || sRef_isUnuseable (fref))) { voptgenerror (FLG_USEDEF, message ("Unallocated storage %qpassed as out parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp)); sRef_setAllocated (fref, exprNode_loc (fexp)); } else if (sRef_isDead (fref)) { if (optgenerror (FLG_USERELEASED, message ("Dead storage %qpassed as out parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRef_showStateInfo (fref); sRef_setAllocated (fref, exprNode_loc (fexp)); } } else if (sRef_isPossiblyDead (fref)) { if (optgenerror2 (FLG_USERELEASED, FLG_STRICTUSERELEASED, message ("Possibly dead storage %qpassed as out parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRef_showStateInfo (fref); sRef_setAllocated (fref, exprNode_loc (fexp)); } } else { ; } isOut = TRUE; } else if (uentry_isPartial (arg)) { if (ctype_isRealAP (ct) && (sRef_isStateUndefined (fref) || sRef_isUnuseable (fref))) { voptgenerror (FLG_USEDEF, message ("Unallocated storage %qpassed as partial parameter: %s", sRef_unparseOpt (fref), exprNode_unparse (fexp)), exprNode_loc (fexp)); sRef_setAllocated (fref, exprNode_loc (fexp)); } else if (sRef_isDead (fref)) { if (optgenerror (FLG_USERELEASED, message ("Dead storage %qpassed as partial parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRef_showStateInfo (fref); sRef_setAllocated (fref, exprNode_loc (fexp)); } } else if (sRef_isPossiblyDead (fref)) { if (optgenerror2 (FLG_USERELEASED, FLG_STRICTUSERELEASED, message ("Possibly dead storage %qpassed as partial parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRef_showStateInfo (fref); sRef_setAllocated (fref, exprNode_loc (fexp)); } } else { ; } isPartial = TRUE; } else if (uentry_isStateSpecial (arg)) { uentry ue = exprNode_getUentry (fcn); if (ctype_isRealAP (ct) && (sRef_isStateUndefined (fref) || sRef_isUnuseable (fref))) { voptgenerror (FLG_USEDEF, message ("Unallocated storage %qpassed as special parameter: %s", sRef_unparseOpt (fref), exprNode_unparse (fexp)), exprNode_loc (fexp)); sRef_setAllocated (fref, exprNode_loc (fexp)); } else if (sRef_isDead (fref)) { if (optgenerror (FLG_USERELEASED, message ("Dead storage %qpassed as special parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRef_showStateInfo (fref); sRef_setAllocated (fref, exprNode_loc (fexp)); } } else if (sRef_isPossiblyDead (fref)) { if (optgenerror2 (FLG_USERELEASED, FLG_STRICTUSERELEASED, message ("Possibly dead storage %qpassed as special parameter to %s: %s", sRef_unparseOpt (fref), exprNode_unparse (fcn), exprNode_unparse (fexp)), exprNode_loc (fexp))) { sRef_showStateInfo (fref); sRef_setAllocated (fref, exprNode_loc (fexp)); } } else { ; } if (uentry_hasStateClauseList (ue)) { checkPassstateClauseList (ue, fexp, fref, argno); } return; /* ??? */ } else if (sRef_isStateDefined (tref)) { exprNode_checkUseParam (fexp); } else { if (isSpec || (!context_getFlag (FLG_IMPOUTS))) { exprNode_checkUseParam (fexp); } else { if (!sRef_isMacroParamRef (fref) && (ctype_isRealAP (ct))) { if (sRef_isAddress (fref)) { if (sRef_isStateUndefined (fref) || sRef_isUnuseable (fref)) { voptgenerror (FLG_USEDEF, message ("Unallocated address %qpassed as implicit " "out parameter: %s", sRef_unparseOpt (fref), exprNode_unparse (fexp)), exprNode_loc (fexp)); sRef_setAllocated (fref, exprNode_loc (fexp)); } } /* yes, I really mean this! */ tref = sRef_copy (tref); sRef_setAllocated (tref, exprNode_loc (fexp)); isOut = TRUE; isImpOut = TRUE; } else { exprNode_checkUseParam (fexp); } } } if (sRef_isNew (fref)) { alkind tkind = sRef_getAliasKind (tref); if ((sRef_isFresh (fref) || sRef_isOnly (fref)) && !alkind_isOnly (tkind) && !alkind_isKeep (tkind) && !alkind_isOwned (tkind) && !alkind_isError (tkind) && !uentry_isReturned (arg)) { voptgenerror (FLG_MUSTFREEFRESH, message ("New fresh storage %q(type %s) passed as %s (not released): %s", sRef_unparseOpt (fref), ctype_unparse (sRef_getType (fref)), alkind_unparse (sRef_getAliasKind (tref)), exprNode_unparse (fexp)), exprNode_loc (fexp)); DPRINTF (("Fresh: %s", sRef_unparseFull (fref))); } else { if (sRef_isNewRef (fref) && !sRef_isKillRef (tref)) { alkind ak = sRef_getAliasKind (tref); if (!alkind_isError (ak)) { voptgenerror (FLG_MUSTFREEFRESH, message ("New reference %q(type %s) passed as %s (not released): %s", sRef_unparseOpt (fref), ctype_unparse (sRef_getType (fref)), alkind_unparse (sRef_getAliasKind (tref)), exprNode_unparse (fexp)), exprNode_loc (fexp)); } } } } (void) checkTransfer (fexp, exprNode_getSref (fexp), exprNode_undefined, tref, fcn, exprNode_loc (fexp), TT_FCNPASS); setCodePoint (); fref = exprNode_getSref (fexp); if (isOut && !sRef_isDead (fref) && !sRef_isPossiblyDead (fref)) { sRef base; if (ctype_isRealAP (sRef_getType (fref))) { base = sRef_makePointer (fref); } else { base = fref; } if (isImpOut) { exprNode_checkMSet (fexp, base); } else { exprNode_checkSet (fexp, base); } if (sRef_isValid (base)) { setCodePoint (); sRef_clearDerived (base); sRef_setDefined (base, exprNode_loc (fexp)); usymtab_clearAlias (base); /* evans 2004-07-31: Don't change state of constants! */ if (!sRef_isConst (base)) { sRef_setNullUnknown (base, exprNode_loc (fexp)); } } } if (isPartial) { if (sRef_isValid (fref)) { sRef_setPartial (fref, exprNode_loc (fexp)); } } atFunction = exprNode_undefined; atArgNo = 0; atNumArgs = 0; /* need to fixup here: derived refs could be bogus */ /* (better to change sRef to not add derivs for "protected" ref) */ uentry_fixupSref (arg); setCodePoint (); DPRINTF (("Check pass: ==> %s", sRef_unparseFull (fref))); } void transferChecks_globalReturn (uentry glob) { sRef_protectDerivs (); checkGlobTrans (glob, TT_GLOBRETURN); sRef_clearProtectDerivs (); } void transferChecks_paramReturn (uentry actual) { checkLeaveTrans (actual, TT_PARAMRETURN); } void transferChecks_loseReference (uentry actual) { checkLeaveTrans (actual, TT_LEAVETRANS); } static void checkLeaveTrans (uentry actual, transferKind transferType) { sRef aref = uentry_getSref (actual); sRef origref = uentry_getOrigSref (actual); if (transferType == TT_PARAMRETURN && (sRef_isKeep (origref) || sRef_isOnly (origref) || sRef_isOwned (origref))) { /* caller cannot use, nothing to check */ } else { if (sRef_isNSLocalVar (origref)) { ; } else { DPRINTF (("Leave trans: %s", uentry_unparseFull (actual))); (void) checkCompletelyDefined (exprNode_undefined, aref, aref, exprNode_undefined, origref, TRUE, FALSE, FALSE, g_currentloc, transferType, 0, TRUE); } } } static void checkGlobTrans (uentry glob, transferKind type) { sRef eref = uentry_getOrigSref (glob); DPRINTF (("Completely defined: %s", uentry_unparseFull (glob))); (void) checkCompletelyDefined (exprNode_undefined, uentry_getSref (glob), uentry_getSref (glob), exprNode_undefined, eref, TRUE, FALSE, FALSE, g_currentloc, type, 0, TRUE); } /* ** For lhs of assignment, alias kind is set from basic type. ** Yoikes! */ static void fixAssignLhs (sRef s) { sRef_resetStateComplete (s); } static void checkStructTransfer (exprNode lhs, sRef slhs, exprNode rhs, sRef srhs, fileloc loc, transferKind tt) { ctype st = ctype_realType (sRef_getType (srhs)); if (ctype_isSU (st) && ctype_isRealSU (sRef_getType (slhs)) && ctype_match (sRef_getType (slhs), st)) { if ((tt == TT_DOASSIGN || tt == TT_FIELDASSIGN) && sRef_isStateDefined (srhs)) { sRef_setDefinedComplete (slhs, loc); } if (sRef_isDependent (slhs) || sRef_isObserver (slhs) || sRef_isExposed (slhs)) { ; } else { if (sRef_isLocalVar (slhs) && sRef_isFileOrGlobalScope (sRef_getRootBase (srhs))) { DPRINTF (("Global scope!")); sRef_setDependent (slhs, exprNode_loc (lhs)); } } /* ** evans 2003-07-10: should always copy the fields! */ if (ctype_isUnion (st)) { sRef_setDefState (slhs, sRef_getDefState (srhs), exprNode_loc (lhs)); sRefSet_realElements (sRef_derivedFields (srhs), sr) { if (sRef_isField (sr)) { cstring fieldname = sRef_getField (sr); sRef lfld = sRef_makeField (slhs, fieldname); (void) checkTransfer (rhs, sr, lhs, lfld, exprNode_undefined, exprNode_loc (lhs), tt); } } end_sRefSet_realElements ; } else { uentryList fields = ctype_getFields (st); uentryList_elements (fields, field) { sRef rfld = sRef_makeField (srhs, uentry_rawName (field)); sRef lfld = sRef_makeField (slhs, uentry_rawName (field)); DPRINTF (("Transfer field: %s := %s", sRef_unparse (lfld), sRef_unparse (rfld))); (void) checkTransfer (rhs, rfld, lhs, lfld, exprNode_undefined, exprNode_loc (lhs), tt); } end_uentryList_elements ; } if (sRef_isOnly (srhs)) { sRef_setKeptComplete (srhs, loc); } } } void transferChecks_initialization (exprNode lhs, exprNode rhs) { sRef slhs = exprNode_getSref (lhs); if (sRef_isFileOrGlobalScope (slhs) || (!sRef_isCvar (slhs))) { (void) checkTransfer (rhs, exprNode_getSref (rhs), lhs, slhs, exprNode_undefined, exprNode_loc (rhs), TT_GLOBINIT); } else { transferChecks_assign (lhs, rhs); } } void transferChecks_assign (exprNode lhs, exprNode rhs) { sRef slhs = exprNode_getSref (lhs); sRef srhs = exprNode_getSref (rhs); sRef base = sRef_getBaseSafe (slhs); nstate ns; DPRINTF (("Check assign: %s = %s", exprNode_unparse (lhs), exprNode_unparse (rhs))); DPRINTF (("lhs: %s", sRef_unparseFull (slhs))); DPRINTF (("rhs: %s", sRef_unparseFull (srhs))); if (ctype_isRealSU (sRef_getType (srhs))) { DPRINTF (("Check struct transfer: %s := %s", exprNode_unparse (lhs), exprNode_unparse (rhs))); checkStructTransfer (lhs, slhs, rhs, srhs, exprNode_loc (lhs), TT_FIELDASSIGN); } else { DPRINTF (("lhs: %s", sRef_unparseFull (slhs))); DPRINTF (("rhs: %s", sRef_unparseFull (srhs))); (void) checkTransfer (rhs, srhs, lhs, slhs, exprNode_undefined, exprNode_loc (lhs), TT_DOASSIGN); DPRINTF (("lhs: %s", sRef_unparseFull (slhs))); DPRINTF (("rhs: %s", sRef_unparseFull (srhs))); } if (sRef_isConst (srhs) && sRef_isLocalState (srhs)) { /* constants can match anything (e.g., NULL) */ sRef_setAliasKind (slhs, AK_ERROR, fileloc_undefined); } if (sRef_isValid (base) && sRef_isStateDefined (base)) { sRef_setPdefined (base, g_currentloc); } if (sRef_isPartial (srhs)) { sRef_setPartial (slhs, exprNode_loc (rhs)); } ns = sRef_getNullState (srhs); if (nstate_possiblyNull (ns)) { if (usymtab_isGuarded (srhs)) { ns = NS_NOTNULL; } } sRef_setNullStateInnerComplete (slhs, ns, exprNode_loc (rhs)); if (sRef_isExposed (srhs) || sRef_isObserver (srhs)) { sRef_setExKind (slhs, sRef_getExKind (srhs), exprNode_loc (rhs)); } DPRINTF (("Done transfer: %s", sRef_unparseFull (slhs))); } static void checkTransferNullAux (sRef fref, exprNode fexp, /*@unused@*/ bool ffix, sRef tref, exprNode texp, /*@unused@*/ bool tfix, fileloc loc, transferKind transferType) { alkind tkind = sRef_getAliasKind (tref); ctype ttyp = ctype_realType (sRef_getType (tref)); DPRINTF (("Null transfer: %s => %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); if (ctype_isUnknown (ttyp)) { ttyp = exprNode_getType (texp); if (ctype_isUnknown (ttyp)) { ttyp = exprNode_getType (fexp); if (ctype_isUnknown (ttyp)) { ttyp = sRef_getType (fref); } } } if (ctype_isFunction (ttyp) && (transferType == TT_FCNRETURN)) { ttyp = ctype_getReturnType (ttyp); } /* ** check for null (don't need to check aliases??) */ if (sRef_possiblyNull (fref) && !usymtab_isGuarded (fref) && ctype_isRealAP (ttyp)) { if (!alkind_isLocal (tkind) && !alkind_isFresh (tkind) && !sRef_perhapsNull (tref) && !(transferType == TT_DOASSIGN)) { if (transferType == TT_GLOBINIT) { if (sRef_isNotNull (tref)) { if (optgenerror (FLG_NULLINIT, /* kuldge flag... */ message ("%s %q initialized to %s value: %q", sRef_getScopeName (tref), sRef_unparse (tref), sRef_nullMessage (fref), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showNullInfo (fref); sRef_setNullError (tref); } } else { if (optgenerror (FLG_NULLASSIGN, message ("%s %q initialized to %s value: %q", sRef_getScopeName (tref), sRef_unparse (tref), sRef_nullMessage (fref), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showNullInfo (fref); sRef_setNullError (tref); } } } else { if (optgenerror ((transferType == TT_FCNPASS) ? FLG_NULLPASS : FLG_NULLRET, message ("%q storage %q%s: %q", cstring_capitalize (sRef_nullMessage (fref)), sRef_unparseOpt (fref), transferNullMessage (transferType), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showNullInfo (fref); sRef_setNullError (fref); } } } else { ; } } } static void checkTransferAssignAux (sRef fref, exprNode fexp, /*@unused@*/ bool ffix, /*@exposed@*/ sRef tref, exprNode texp, bool tfix, fileloc loc, transferKind transferType) { alkind tkind = sRef_getAliasKind (tref); /* ** Assignment to same --- no errors, or state changes. ** This can happen when returned params are used. */ if (sRef_sameName (fref, tref)) { sRef_copyState (tref, fref); return; } if ((alkind_isOnly (tkind) || alkind_isFresh (tkind) || alkind_isNewRef (tkind) || alkind_isOwned (tkind)) && !(sRef_isDead (tref) || sRef_isStateUndefined (tref) || sRef_isUnuseable (tref) || sRef_isPartial (tref) || sRef_definitelyNull (tref) || sRef_isStackAllocated (tref) || sRef_isAllocIndexRef (tref)) && !(sRef_same (fref, tref)) /* okay to assign to self (returned params) */ && !(usymtab_isDefinitelyNull (tref))) { if (transferChecks_canLoseReference (tref, loc)) { ; /* no error */ } else { flagcode flg = sRef_isFresh (tref) ? FLG_MUSTFREEFRESH : FLG_MUSTFREEONLY; if (sRef_hasLastReference (tref)) { if (optgenerror (flg, message ("Last reference %q to %s storage %q(type %s) not released " "before assignment: %q", sRef_unparse (tref), alkind_unparse (tkind), sRef_unparseOpt (sRef_getAliasInfoRef (tref)), ctype_unparse (sRef_getType (tref)), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showRefLost (tref); } } else { if (context_inGlobalScope ()) { /* no errors for static initializations */ } else { /* ** don't report this error for a[i], since it could ** be a new element. */ if (alkind_isNewRef (tkind)) { if (optgenerror (flg, message ("%q %q(type %s) not released before assignment: %q", cstring_makeLiteral (alkind_isKillRef (sRef_getOrigAliasKind (tref)) ? "Kill reference parameter" : "New reference"), sRef_unparseOpt (tref), ctype_unparse (sRef_getType (tref)), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (tref); sRef_setAliasKind (tref, AK_ERROR, loc); } } else if (!(sRef_isUnknownArrayFetch (tref) && !context_getFlag (FLG_STRICTDESTROY)) && !sRef_isUnionField (tref) && !sRef_isRelDef (tref) && optgenerror (flg, message ("%s storage %q(type %s) not released before assignment: %q", alkind_capName (tkind), sRef_unparseOpt (tref), ctype_unparse (sRef_getType (tref)), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (tref); } else { ; } } } } } fixAssignLhs (tref); if (sRef_isRefCounted (tref)) /* tkind might not be correct now */ { if (sRef_isNewRef (fref)) { sRef_setAliasKind (tref, AK_NEWREF, loc); } else if (sRef_isConst (fref)) { /* for now, constants are not ref counted */ sRef_setAliasKind (tref, AK_ERROR, loc); } else { ; } if (!sRef_isNSLocalVar (tref) && sRef_isRefCounted (fref) && sRef_isStateDefined (fref)) { voptgenerror (FLG_NEWREFTRANS, message ("New reference %qto reference counted storage: %q", sRef_unparseOpt (tref), generateText (fexp, texp, tref, transferType)), loc); } } /* ** Not for structures and unions, since assignments copy. */ if (sRef_isStack (fref) && !ctype_isSU (ctype_realType (sRef_getType (fref)))) { sRef_setAliasKindComplete (tref, AK_STACK, loc); } if (sRef_isNSLocalVar (tref) && !sRef_isOwned (tref) /*< should only apply to static >*/ && ctype_isMutable (sRef_getType (tref))) { if (sRef_isOnly (fref) && sRef_isNew (fref)) { if (!tfix) { sRef_setFresh (tref, loc); } } } DPRINTF (("Transfer ==> %s", sRef_unparseFull (tref))); } /* ** requires sRef_isOnly (fref) */ static void checkOnlyTransferAux (sRef fref, exprNode fexp, bool ffix, sRef tref, exprNode texp, /*@unused@*/ bool tfix, fileloc loc, transferKind transferType) { alkind tkind = sRef_getAliasKind (tref); if (sRef_isExposed (tref) || sRef_isObserver (tref)) { if (transferType == TT_FCNRETURN && sRef_isNew (fref) && !alkind_isError (tkind)) { if (optgenerror (FLG_ONLYTRANS, message ("Only storage %q%q (will not be released): %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } /* no errors for exposed transfers (is this good enough?) */ } else if (alkind_isOnly (tkind) || alkind_isKeep (tkind) || alkind_isOwned (tkind)) { ; /* okay */ } else if ((transferType == TT_FCNPASS) && (alkind_isUnknown (tkind) || alkind_isTemp (tkind) || alkind_isUnique (tkind))) { if (sRef_isFresh (fref) && alkind_isUnknown (tkind) && !context_getFlag (FLG_PASSUNKNOWN)) { if (!ffix) sRef_setAliasKind (fref, AK_UNKNOWN, loc); } } else if (alkind_isLocal (tkind) || alkind_isFresh (tkind) || alkind_isUnknown (tkind)) { if ((transferType == TT_DOASSIGN) && sRef_isNew (fref) && sRef_isOnly (fref)) { bool error = FALSE; if (alkind_isUnknown (tkind) && sRef_isFileOrGlobalScope (sRef_getRootBase (tref))) { if (optgenerror (FLG_ONLYUNQGLOBALTRANS, message ("Only storage %q%q: %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); sRef_setAliasKind (tref, AK_ERROR, loc); error = TRUE; } } if (!error && !ffix) { sRef_setFresh (tref, loc); } } else { if (alkind_isLocal (tkind)) { if (sRef_sameName (tref, fref)) { ; /* don't set this --- corresponds to return transfer */ } else { /* ** Don't set local to dependent. Error will ** be detected through aliasing. Except for ** arrays. */ if (!tfix && sRef_isThroughArrayFetch (fref) && context_getFlag (FLG_DEPARRAYS)) { sRef_setDependent (tref, loc); } } } else { if (optgenerror (FLG_ONLYTRANS, message ("Only storage %q%q: %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } } } else { if (alkind_isError (tkind) || (alkind_isUnknown (tkind) && !context_getFlag (FLG_MEMIMPLICIT))) { flagcode_recordSuppressed (FLG_ONLYTRANS); } else { if ((alkind_isKept (tkind) || alkind_isStack (tkind) || alkind_isDependent (tkind)) && sRef_isNSLocalVar (tref)) { ; /* okay */ } else { if (optgenerror (FLG_ONLYTRANS, message ("Only storage %q%q: %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); if (transferType == TT_DOASSIGN) { /* ** alias kind unknown to suppress future messages */ if (!ffix && sRef_isNSLocalVar (sRef_getRootBase (fref))) { sRef_clearAliasKind (fref); } } } } } } } /* ** ??? same as checkOnly ? */ static void checkOwnedTransferAux (sRef fref, exprNode fexp, bool ffix, sRef tref, exprNode texp, bool tfix, fileloc loc, transferKind transferType) { alkind tkind = sRef_getAliasKind (tref); if (sRef_isExposed (tref) || sRef_isObserver (tref)) { if (transferType == TT_FCNRETURN && sRef_isNew (fref)) { if (optgenerror (FLG_OWNEDTRANS, message ("Owned storage %q%q (will not be released): %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } } else if (alkind_isOnly (tkind) || alkind_isKeep (tkind) || alkind_isDependent (tkind) || alkind_isOwned (tkind)) { /* okay */ } else if (alkind_isLocal (tkind) || alkind_isFresh (tkind) || alkind_isUnknown (tkind)) { if ((transferType == TT_DOASSIGN) && sRef_isNew (fref) && sRef_isOnly (fref)) { if (!tfix) { sRef_setFresh (tref, loc); } } else { } } else if ((transferType == TT_FCNPASS) && (alkind_isUnknown (tkind) || alkind_isTemp (tkind) || alkind_isUnique (tkind))) { if (sRef_isFresh (fref) && alkind_isUnknown (tkind) && !context_getFlag (FLG_PASSUNKNOWN)) { if (!ffix) { sRef_clearAliasKind (fref); } } } else { if (alkind_isUnknown (tkind) && !context_getFlag (FLG_MEMIMPLICIT)) { flagcode_recordSuppressed (FLG_OWNEDTRANS); } else { if (alkind_isKept (tkind) && sRef_isNSLocalVar (tref)) { ; /* okay */ } else { voptgenerror (FLG_OWNEDTRANS, message ("Owned storage %q%q: %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc); } } if (transferType == TT_DOASSIGN) { /* ** alias kind unknown to suppress future messages */ if (!ffix) { sRef_clearAliasKind (fref); } } } } static void checkFreshTransferAux (sRef fref, exprNode fexp, bool ffix, sRef tref, exprNode texp, /*@unused@*/ bool tfix, fileloc loc, transferKind transferType) { alkind tkind = sRef_getAliasKind (tref); /* ** error to return fresh as non-only */ if (transferType == TT_FCNRETURN && !(alkind_isOnly (tkind) || alkind_isNewRef (tkind))) { if (alkind_isUnknown (tkind) && !context_getFlag (FLG_MEMIMPLICIT)) { flagcode_recordSuppressed (FLG_NEWREFTRANS); } else { if (alkind_isError (tkind)) { if (!ffix) { sRef_killComplete (fref, loc); } } else if (alkind_isRefCounted (tkind)) { if (optgenerror (FLG_NEWREFTRANS, message ("New reference returned without newref qualifier: %q", generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); sRef_killComplete (fref, loc); } } else { if (optgenerror (FLG_FRESHTRANS, message ("Fresh storage %q (should be only): %q", transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); sRef_killComplete (fref, loc); } } } } /* ** Okay to assign fresh to only, shared or unqualified. ** ** should generate other errors? */ if (alkind_isOnly (tkind)) { if (transferType == TT_DOASSIGN && !sRef_isFileOrGlobalScope (tref)) { if (!ffix) { if (!sRef_isNSLocalVar (tref)) { sRef_setKeptComplete (fref, loc); } } } else { if (sRef_isConst (fref)) { ; } else { if (!ffix) { sRef_killComplete (fref, loc); } } } } else if (alkind_isOwned (tkind)) { if (!ffix) { sRef_setDependentComplete (fref, loc); } } else if (alkind_isRefCounted (tkind) && (transferType == TT_FCNRETURN) && sRef_isFresh (fref)) { if (!ffix) { sRef_killComplete (fref, loc); } } else if (alkind_isKeep (tkind)) { if (!ffix) { if (!sRef_isNSLocalVar (tref)) { sRef_setKeptComplete (fref, loc); } } } else if (alkind_isShared (tkind)) { if (!ffix) { sRef_setShared (fref, loc); } } else if (alkind_isLocal (tkind) || alkind_isUnknown (tkind)) { if (transferType == TT_DOASSIGN || transferType == TT_FCNRETURN) { /* ** local shares fresh. Make it owned/dependent. */ if (!tfix) { sRef_setOwned (tref, loc); } if (!ffix && !tfix) { sRef_setDependentComplete (fref, loc); } /* NO! sRef_clearAliasKind (fref); */ } else { if (context_getFlag (FLG_PASSUNKNOWN)) { sRef_clearAliasKind (fref); } } } else { ; } } static void checkTransferExposure (sRef fref, exprNode fexp, /*@unused@*/ bool ffix, sRef tref, exprNode texp, bool tfix, fileloc loc, transferKind transferType) { alkind fkind = sRef_getAliasKind (fref); alkind tkind = sRef_getAliasKind (tref); exkind tekind = sRef_getExKind (tref); if (sRef_isObserver (fref) && ctype_isMutable (sRef_getType (fref))) { /* ** observer -> exposed or observer */ /* ** observer -> temp is okay [NO! really? only in function calls] */ if (sRef_isExposed (tref) || sRef_isObserver (tref) || alkind_isLocal (tkind)) { /* okay */ if ((transferType == TT_DOASSIGN) && alkind_isLocal (tkind)) { if (!tfix) { sRef_setAliasKindComplete (tref, fkind, loc); } } } else { if (transferType == TT_FCNRETURN || transferType == TT_DOASSIGN || transferType == TT_FIELDASSIGN || transferType == TT_GLOBINIT) { bool hasError = FALSE; if (exprNode_isStringLiteral (fexp) && transferType == TT_GLOBINIT) { hasError = optgenerror (FLG_READONLYTRANS, message ("Read-only string literal storage %q%q: %q", sRef_unparseOpt (fref), transferErrorExpMessage (transferType, tekind), generateText (fexp, texp, tref, transferType)), loc); sRef_setAliasKind (fref, AK_ERROR, fileloc_undefined); } else { if ((transferType == TT_DOASSIGN || transferType == TT_FIELDASSIGN) && (sRef_isNSLocalVar (tref) || (exprNode_isStringLiteral (fexp) && ctype_isRealArray (exprNode_getType (texp))))) { ; /* No error for local assignment or assignment to static array (copies string). */ } else { if (exprNode_isStringLiteral (fexp)) { hasError = optgenerror (FLG_READONLYTRANS, message ("Read-only string literal storage %q%q: %q", sRef_unparseOpt (fref), transferErrorExpMessage (transferType, tekind), generateText (fexp, texp, tref, transferType)), loc); } if (!hasError) { hasError = optgenerror (FLG_OBSERVERTRANS, message ("Observer storage %q%q: %q", sRef_unparseOpt (fref), transferErrorExpMessage (transferType, tekind), generateText (fexp, texp, tref, transferType)), loc); } } } if (hasError) { if (transferType != TT_GLOBINIT) { sRef_showExpInfo (fref); sRef_setAliasKind (tref, AK_ERROR, loc); } } else { if (transferType == TT_DOASSIGN && !tfix) { DPRINTF (("Setting unknown!")); /* sRef_setAliasKind (tref, AK_ERROR, loc); */ } } } else /* TT_FCNPASS */ { llassert (transferType == TT_FCNPASS); if (alkind_isTemp (tkind) || alkind_isDependent (tkind) || alkind_isRefCounted (tkind)) { ; /* okay */ } else { if (!alkind_isError (tkind)) { if (optgenerror (FLG_OBSERVERTRANS, message ("Observer storage %q%q: %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showExpInfo (fref); sRef_clearAliasState (fref, loc); } } } } } } else if (sRef_isExposed (fref) && ctype_isMutable (sRef_getType (fref))) { if (transferType == TT_FCNRETURN) { if (!(sRef_isExposed (tref) || sRef_isObserver (tref) || sRef_isParam (fref))) { if (optgenerror (FLG_EXPOSETRANS, message ("Exposed storage %q%q: %q", sRef_unparseOpt (fref), transferErrorExpMessage (transferType, tekind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showExpInfo (fref); } } } else if (transferType == TT_FCNPASS) { if (!(sRef_isExposed (tref) || sRef_isObserver (tref) || (alkind_isUnknown (tkind) || alkind_isDependent (tkind) || alkind_isTemp (tkind) || alkind_isKillRef (tkind) || alkind_isRefCounted (tkind)))) { if (alkind_isUnique (tkind) || alkind_isError (tkind)) { } else { if (optgenerror (FLG_EXPOSETRANS, message ("Exposed storage %q%q: %q", sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showExpInfo (fref); sRef_clearAliasState (fref, loc); } } } else { ; } } else if (transferType == TT_DOASSIGN /* evans 2001-10-05: added TT_FIELDASSIGN: */ || transferType == TT_FIELDASSIGN) { if (!(sRef_isExposed (tref) || !sRef_isCvar (tref) || (alkind_isUnknown (tkind) || alkind_isDependent (tkind) || alkind_isRefCounted (tkind) || alkind_isNewRef (tkind) || alkind_isFresh (tkind) || alkind_isLocal (tkind)))) { if (optgenerror (FLG_EXPOSETRANS, message ("Exposed storage %q%q: %q", sRef_unparseOpt (fref), transferErrorExpMessage (transferType, tekind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showExpInfo (fref); } } if (!tfix) { sRef_setExposed (tref, loc); } } else { llassert (transferType == TT_GLOBPASS || transferType == TT_GLOBRETURN || transferType == TT_PARAMRETURN || transferType == TT_LEAVETRANS || transferType == TT_GLOBINIT); } } else { ; } } /* ** returns TRUE if there is no error reported ** ** if fixt, don't change tref (except if error reported.) ** if fixf, don't change fref (except if error reported.) */ static void checkTransferAux (exprNode fexp, /*@exposed@*/ sRef fref, bool ffix, exprNode texp, /*@exposed@*/ sRef tref, bool tfix, fileloc loc, transferKind transferType) { alkind fkind; alkind tkind; bool isassign = (transferType == TT_DOASSIGN); bool isfieldassign = (transferType == TT_FIELDASSIGN); bool iseitherassign = isassign || (transferType == TT_FIELDASSIGN); bool isfcnpass = (transferType == TT_FCNPASS); bool isfcnreturn = (transferType == TT_FCNRETURN); DPRINTF (("Check transfer: %s [%s] => %s [%s]", exprNode_unparse (fexp), sRef_unparseFull (fref), exprNode_unparse (texp), sRef_unparseFull (tref))); setCodePoint (); if (!ffix && !tfix) { setCodePoint (); checkTransferNullAux (fref, fexp, ffix, tref, texp, tfix, loc, transferType); DPRINTF (("Transfer ==> %s", sRef_unparseFull (fref))); } if (isassign) { setCodePoint (); checkTransferAssignAux (fref, fexp, ffix, tref, texp, tfix, loc, transferType); DPRINTF (("Transfer ==> %s", sRef_unparseFull (fref))); } /* ** Check for definition */ /* ** errors passing out params already detected in checkAnyCall */ if (!ffix && !tfix) { bool defok = TRUE; if (!iseitherassign || (!sRef_isNSLocalVar (tref) && (sRef_isAnyDefined (tref) || !sRef_stateKnown (tref)))) { setCodePoint (); if (!ynm_toBoolRelaxed (checkCompletelyDefined (fexp, fref, fref, texp, tref, TRUE, FALSE, FALSE, loc, transferType, 0, TRUE))) { defok = FALSE; } } setCodePoint (); if (defok && iseitherassign) { sRef_setDefState (tref, sRef_getDefState (fref), loc); } } /* ** check exposure */ setCodePoint (); checkTransferExposure (fref, fexp, ffix, tref, texp, tfix, loc, transferType); fkind = sRef_getAliasKind (fref); tkind = sRef_getAliasKind (tref); /* ** check aliasing */ if (alkind_isOnly (fkind)) { setCodePoint (); checkOnlyTransferAux (fref, fexp, ffix, tref, texp, tfix, loc, transferType); } else if (alkind_isFresh (fkind)) { setCodePoint (); checkFreshTransferAux (fref, fexp, ffix, tref, texp, tfix, loc, transferType); } else if (alkind_isOwned (fkind)) { setCodePoint (); checkOwnedTransferAux (fref, fexp, ffix, tref, texp, tfix, loc, transferType); } else if (alkind_isDependent (fkind)) { setCodePoint (); if (isfcnreturn && (sRef_isExposed (tref) || sRef_isObserver (tref))) { ; /* okay */ } else if ((alkind_isOnly (tkind) || alkind_isKeep (tkind) || alkind_isOwned (tkind)) || (!isfcnpass && alkind_isTemp (tkind))) { bool error = TRUE; if (sRef_isLocalVar (fref)) { sRef depRef = dependentReference (fref); if (sRef_isValid (depRef) && sRef_isLocalVar (depRef)) { error = FALSE; sRef_kill (depRef, loc); sRef_kill (fref, loc); } } if (isfieldassign) { error = FALSE; } if (canLoseLocalReference (fref, loc)) { ; } else { if (error && (optgenerror (FLG_DEPENDENTTRANS, message ("%s storage %q%q: %q", alkind_capName (fkind), sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc))) { DPRINTF (("Here: %s / %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); sRef_showAliasInfo (fref); } } } else { if (isassign && (alkind_isFresh (tkind) || alkind_isLocal (tkind))) { if (!tfix && !ffix) { sRef_setDependent (tref, loc); } } } } else if (alkind_isShared (fkind)) { setCodePoint (); /* ** xxx <- shared */ if (alkind_isOnly (tkind) || (!isfcnpass && (!(sRef_isObserver (tref) || sRef_isExposed (tref)) && alkind_isTemp (tkind)))) { if (optgenerror (FLG_SHAREDTRANS, message ("%s storage %q%q: %q", alkind_capName (fkind), sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } else { if (alkind_isFresh (tkind) || alkind_isLocal (tkind)) { sRef_setShared (tref, loc); } } } else if (alkind_isKeep (fkind)) { setCodePoint (); if (alkind_isKeep (tkind) || alkind_isLocal (tkind) || (isfcnreturn && sRef_isExposed (tref)) || (iseitherassign && (alkind_isOnly (tkind) || alkind_isOwned (tkind)))) { sRef_setKept (fref, loc); } else if (isfcnpass && (alkind_isTemp (tkind) || alkind_isOwned (tkind))) { ; } else { if (!alkind_isError (tkind)) { if (optgenerror (FLG_KEEPTRANS, message ("%s storage %q: %q", alkind_capName (fkind), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } } } else if (alkind_isTemp (fkind) || alkind_isKept (fkind)) { /* ** xxx <- temp */ if (alkind_isOnly (tkind) || alkind_isShared (tkind) || (alkind_isTemp (fkind) && !isfcnreturn && alkind_isDependent (tkind)) || alkind_isOwned (tkind) || alkind_isKeep (tkind)) { if (!exprNode_isNullValue (fexp) && (ctype_isMutable (exprNode_getType (fexp)) || (ctype_isArray (exprNode_getType (fexp)) && sRef_isParam (fref))) && (!iseitherassign || sRef_isReference (tref))) { if (sRef_isThroughArrayFetch (fref)) { if (optgenerror2 (alkind_isTemp (fkind) ? FLG_TEMPTRANS : FLG_KEPTTRANS, FLG_STRICTUSERELEASED, message ("%s storage %q%q: %q", alkind_capName (fkind), sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } else { if (optgenerror (alkind_isTemp (fkind) ? FLG_TEMPTRANS : FLG_KEPTTRANS, message ("%s storage %q%q: %q", alkind_capName (fkind), sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } } } } else if (alkind_isRefCounted (fkind) || alkind_isKillRef (fkind)) { if (alkind_isNewRef (tkind)) { /* ** check that the refs field has been modified */ if (!sRef_isConst (fref)) { voptgenerror (FLG_REFCOUNTTRANS, message ("Reference counted storage returned without modifying " "reference count: %s", exprNode_unparse (fexp)), loc); } } else if (iseitherassign) { if (alkind_isRefCounted (fkind)) { if (!sRef_isLocalVar (tref)) { vgenhinterror (FLG_REFCOUNTTRANS, message ("Assignment to non-local from reference counted storage: %s", exprNode_unparse (fexp)), cstring_makeLiteral ("Reference counted storage should call a function returning " "a newref instead of direct assignments."), loc); } else { ; } } } else /* fcnpass */ { if (alkind_isRefCounted (tkind) || alkind_isTemp (tkind)) { /* okay --- no change in state */ } else if (alkind_isKillRef (tkind)) { if (!ffix && !tfix && !(transferType == TT_FCNRETURN)) { sRef_killComplete (fref, loc); } } else { if (!alkind_isError (tkind)) { voptgenerror (FLG_REFCOUNTTRANS, message ("Reference counted storage %q: %q", transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc); } } } } else { ; } setCodePoint (); if (alkind_isOnly (tkind) || alkind_isKeep (tkind)) { if (sRef_isAddress (fref)) { voptgenerror (FLG_IMMEDIATETRANS, message ("Immediate address %q %q: %q", sRef_unparse (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc); sRef_setAliasKind (fref, AK_ERROR, loc); } else { if ((alkind_isUnknown (fkind) || alkind_isStatic (fkind)) && !sRef_isDefinitelyNull (fref) && (!ffix && !tfix) && (!exprNode_isNullValue (fexp))) { flagcode errkind = alkind_isStatic (fkind) ? FLG_STATICTRANS : FLG_UNKNOWNTRANS; if (transferType == TT_GLOBINIT) { if (errkind == FLG_STATICTRANS) { errkind = FLG_STATICINITTRANS; } else { errkind = FLG_UNKNOWNINITTRANS; } } if (optgenerror (errkind, message ("%s storage %s %q: %q", alkind_capName (fkind), exprNode_unparse (fexp), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } } /* don't kill shared to suppress future messages */ if (!alkind_isShared (fkind)) { if (isassign) { if (!ffix) { /*< yuk! should do this in aliasaux >*/ if (!sRef_isNSLocalVar (tref) && !sRef_sameName (fref, tref)) { if (!tfix) { sRef_setKeptComplete (fref, loc); } else { sRef_setKept (fref, loc); } } } } else { if (!ffix) { if (!tfix) { if (alkind_isKeep (tkind)) { sRef_setKeptComplete (fref, loc); } else { sRef_killComplete (fref, loc); } } else { if (alkind_isKeep (tkind)) { sRef_setKept (fref, loc); } else { sRef_kill (fref, loc); } } } } } } else if (alkind_isOwned (tkind)) { /* don't kill shared to suppress future messages */ if (!alkind_isShared (fkind)) { if (!isassign || !sRef_sameName (fref, tref)) /* result of return parameter */ { if (!ffix) { if (!tfix) { sRef_setDependentComplete (fref, loc); } else { sRef_setDependent (fref, loc); } } } } } else if (alkind_isShared (tkind)) { if (alkind_isFresh (fkind) || alkind_isLocal (fkind)) { if (!ffix) { sRef_setShared (fref, loc); } } } else if (alkind_isUnknown (tkind) && context_getFlag (FLG_MEMIMPLICIT)) { if (alkind_isDependent (fkind)) { if (!exprNode_isNullValue (fexp) && ctype_isMutable (exprNode_getType (fexp)) && (!iseitherassign || sRef_isReference (tref))) { if (transferChecks_canLoseReference (fref, loc)) { ; } else { if (optgenerror (FLG_DEPENDENTTRANS, message ("%s storage %q%q: %q", alkind_capName (fkind), sRef_unparseOpt (fref), transferErrorMessage (transferType, tkind), generateText (fexp, texp, tref, transferType)), loc)) { DPRINTF (("Here: %s / %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); sRef_showAliasInfo (fref); } } } } } else if (alkind_isNewRef (tkind)) { if (!ffix && !tfix) { sRef_killComplete (fref, loc); } } else if (alkind_isKillRef (tkind)) { if (transferType == TT_FCNRETURN) { if (sRef_isNewRef (fref)) { if (optgenerror (FLG_REFCOUNTTRANS, message ("New reference returned as temp reference: %q", generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } } else { if (sRef_isNewRef (fref)) { sRef_killComplete (fref, loc); } else { if (sRef_isRefCounted (fref) && sRef_isCvar (fref) && !sRef_isLocalVar (fref)) { if (optgenerror (FLG_REFCOUNTTRANS, message ("External reference counted storage released: %q", generateText (fexp, texp, tref, transferType)), loc)) { sRef_showAliasInfo (fref); } } } } } else { ; } DPRINTF (("Transfer ==> %s", sRef_unparseFull (fref))); DPRINTF (("Transfer ==> %s", sRef_unparseFull (tref))); setCodePoint (); } static void checkMetaStateConsistent (/*@exposed@*/ sRef fref, sRef tref, fileloc loc, /*@unused@*/ transferKind transferType) { /* ** Checks if it is consistent to leave storage marked as tref in state of fref. */ valueTable fvalues = sRef_getValueTable (fref); valueTable tvalues = sRef_getValueTable (tref); DPRINTF (("Metastate consistent: %s => %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); if (valueTable_isUndefined (tvalues) || valueTable_isUndefined (fvalues)) { /* Cannot check without value tables. An error was already detected. */ DPRINTF (("No value table: %s / %s", bool_unparse (valueTable_isUndefined (tvalues)), bool_unparse (valueTable_isUndefined (fvalues)))); return; } valueTable_elements (fvalues, fkey, fval) { stateValue tval; metaStateInfo minfo; DPRINTF (("Transfer: %s", fkey)); tval = valueTable_lookup (tvalues, fkey); minfo = context_lookupMetaStateInfo (fkey); if (!stateValue_isDefined (tval)) { if (ctype_isUnknown (sRef_getType (fref))) { ; /* Okay, put in default values without knowing type */ } else { DPRINTF (("Cannot find meta state for: %s / to: %s / %s", sRef_unparseFull (fref), sRef_unparseFull (tref), fkey)); } } else { llassert (metaStateInfo_isDefined (minfo)); if (stateValue_isError (fval) || stateValue_isError (tval)) { ; } else if (sRef_isDefinitelyNull (fref) || usymtab_isDefinitelyNull (fref)) { ; /* No errors for null values in state transfers. */ } else { stateCombinationTable sctable = metaStateInfo_getTransferTable (minfo); cstring msg = cstring_undefined; int nval = stateCombinationTable_lookup (sctable, stateValue_getValue (fval), stateValue_getValue (tval), &msg); if (nval == stateValue_error) { if (transferType == TT_LEAVETRANS) { BADBRANCH; } else if (transferType == TT_GLOBRETURN) { if (optgenerror (FLG_STATETRANSFER, message ("Function returns with global %q in inconsistent state (%q is %q, should be %q)%q", sRef_unparse (sRef_getRootBase (fref)), sRef_unparse (fref), stateValue_unparseValue (fval, minfo), stateValue_unparseValue (tval, minfo), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), loc)) { sRef_showMetaStateInfo (fref, fkey); } } else if (transferType == TT_GLOBPASS) { if (optgenerror (FLG_STATETRANSFER, message ("Function called with global %q in inconsistent state (%q is %q, should be %q)%q", sRef_unparse (sRef_getRootBase (fref)), stateValue_unparseValue (fval, minfo), sRef_unparse (fref), stateValue_unparseValue (tval, minfo), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), loc)) { sRef_showMetaStateInfo (fref, fkey); } } else if (transferType == TT_PARAMRETURN) { if (optgenerror (FLG_STATETRANSFER, message ("Function returns with parameter %q in inconsistent state (%q is %q, should be %q)%q", sRef_unparse (sRef_getRootBase (fref)), sRef_unparse (fref), stateValue_unparseValue (fval, minfo), stateValue_unparseValue (tval, minfo), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), loc)) { sRef_showMetaStateInfo (fref, fkey); } } else { if (optgenerror (FLG_STATETRANSFER, message ("Invalid transfer from %q %x to %q (%q)%q", stateValue_unparseValue (fval, minfo), sRef_unparse (fref), stateValue_unparseValue (tval, minfo), sRef_unparse (tref), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), loc)) { sRef_showMetaStateInfo (fref, fkey); } } } if (stateValue_getValue (fval) != nval) { stateValue_updateValueLoc (fval, nval, loc); } } } DPRINTF (("Transfer: %s %s -> %s", fkey, stateValue_unparse (fval), stateValue_unparse (tval))); } end_valueTable_elements ; } static void checkMetaStateTransfer (exprNode fexp, sRef fref, exprNode texp, sRef tref, exprNode fcn, fileloc loc, transferKind transferType) { valueTable fvalues = sRef_getValueTable (fref); valueTable tvalues = sRef_getValueTable (tref); DPRINTF (("Metastate transfer: from %s", exprNode_unparse (fexp))); DPRINTF (("Metastate transfer: %s => %s", sRef_unparseFull (fref), sRef_unparseFull (tref))); if (valueTable_isUndefined (tvalues) || valueTable_isUndefined (fvalues)) { /* Cannot check without value tables. An error was already detected. */ DPRINTF (("No value table: %s / %s", bool_unparse (valueTable_isUndefined (tvalues)), bool_unparse (valueTable_isUndefined (fvalues)))); return; } valueTable_elements (fvalues, fkey, fval) { stateValue tval; metaStateInfo minfo; stateCombinationTable sctable; cstring msg; int nval; DPRINTF (("Transfer: %s", fkey)); tval = valueTable_lookup (tvalues, fkey); minfo = context_lookupMetaStateInfo (fkey); if (!stateValue_isDefined (tval)) { if (ctype_isUnknown (sRef_getType (fref))) { ; /* Okay, put in default values without knowing type */ } else { DPRINTF (("Metastate transfer: %s => %s", exprNode_unparse (fexp), exprNode_unparse (texp))); DPRINTF (("Cannot find meta state for: %s / to: %s / %s", sRef_unparseFull (fref), sRef_unparseFull (tref), fkey)); } } else { llassert (metaStateInfo_isDefined (minfo)); if (stateValue_isError (fval)) { ; } else if (stateValue_isError (tval)) { if (sRef_isLocalVar (tref) && transferType == TT_DOASSIGN) { /* Local assignments just replace state. */ stateValue_updateValueLoc (tval, stateValue_getValue (fval), loc); DPRINTF (("Update: %s", stateValue_unparse (tval))); } else if (transferType == TT_FCNRETURN) { ; /* Returning from an unannotated function */ } else { DPRINTF (("Transfer to error: %s / %s", sRef_unparseFull (tref), transferType_unparse (transferType))); } } else { DPRINTF (("Check: %s / %s / %s / %s", fkey, metaStateInfo_unparse (minfo), stateValue_unparse (fval), stateValue_unparse (tval))); sctable = metaStateInfo_getTransferTable (minfo); msg = cstring_undefined; nval = stateCombinationTable_lookup (sctable, stateValue_getValue (fval), stateValue_getValue (tval), &msg); if (transferType == TT_DOASSIGN && sRef_isLocalVar (tref)) { /* Local assignments just replace state. */ DPRINTF (("No transfer error assigning to local: %s", msg)); stateValue_updateValueLoc (tval, stateValue_getValue (fval), loc); DPRINTF (("Update: %s", stateValue_unparse (tval))); } else { if (nval == stateValue_error) { if (optgenerror (FLG_STATETRANSFER, message ("Invalid transfer from %q %x to %q%q: %q", stateValue_unparseValue (fval, minfo), sRef_unparse (fref), stateValue_unparseValue (tval, minfo), cstring_isDefined (msg) ? message (" (%s)", msg) : cstring_undefined, transferErrorExcerpt (transferType, fexp, texp, fcn)), loc)) { sRef_showMetaStateInfo (fref, fkey); sRef_showMetaStateInfo (tref, fkey); } else { DPRINTF (("Suppressed transfer error: %s", msg)); } } else { if (transferType == TT_FCNRETURN) { /* ** Returning this reference from a function, mark this reference ** so no lost reference errors are returned. */ stateValue_updateValueLoc (fval, stateValue_error, loc); } else if (stateValue_getValue (fval) != nval) { stateValue_updateValueLoc (fval, nval, loc); } else { ; } } } } } DPRINTF (("Transfer: %s %s -> %s", fkey, stateValue_unparse (fval), stateValue_unparse (tval))); } end_valueTable_elements ; } /* ** assigns fexp := tref or passes fexp as a parameter, or returns fexp. ** ** For assignments, sets alias and definition state accordingly. */ static void checkTransfer (exprNode fexp, /*@dependent@*/ sRef fref, exprNode texp, /*@dependent@*/ sRef tref, exprNode fcn, fileloc loc, transferKind transferType) { setCodePoint (); if (context_inProtectVars ()) { return; } DPRINTF (("Check transfer: %s => %s", sRef_unparse (fref), sRef_unparse (tref))); DPRINTF (("Check transfer: %s => %s", exprNode_unparse (fexp), exprNode_unparse (texp))); checkMetaStateTransfer (fexp, fref, texp, tref, fcn, loc, transferType); /* ** for local references, we need to check ** the transfer for all possible aliases. */ if (sRef_isLocalVar (tref) && transferType != TT_DOASSIGN) { sRefSet alias = usymtab_allAliases (tref); sRefSet_realElements (alias, atref) { sRef abase = sRef_getRootBase (atref); if (sRef_isKnown (atref) && !sRef_isLocalVar (abase) && !sRef_isExternal (abase)) { atref = sRef_updateSref (atref); if (sRef_hasName (atref)) { if (!sRef_isNew (atref) && !sRef_sameName (tref, atref)) { context_setAliasAnnote (atref, tref); } checkTransferAux (fexp, fref, TRUE, texp, atref, FALSE, loc, transferType); context_clearAliasAnnote (); } } } end_sRefSet_realElements; sRefSet_free (alias); } if (sRef_isLocalVar (fref)) { sRefSet alias = usymtab_allAliases (fref); sRefSet_realElements (alias, afref) { sRef abase = sRef_getRootBase (afref); if (sRef_isKnown (afref) && !sRef_isLocalVar (abase) && !sRef_isExternal (abase)) { afref = sRef_updateSref (afref); if (sRef_hasName (afref)) { if (!sRef_isNew (afref) && !sRef_sameName (afref, fref)) { context_setAliasAnnote (afref, fref); } checkTransferAux (fexp, afref, FALSE, texp, tref, TRUE, loc, transferType); context_clearAliasAnnote (); } } } end_sRefSet_realElements; sRefSet_free (alias); } setCodePoint (); checkTransferAux (fexp, fref, FALSE, texp, tref, FALSE, loc, transferType); setCodePoint (); } static /*@exposed@*/ sRef dependentReference (sRef sr) { sRefSet ab = usymtab_aliasedBy (sr); /* yes, really mean aliasedBy */ DPRINTF (("Dependent reference: %s", sRef_unparse (sr))); DPRINTF (("Aliases: %s", sRefSet_unparse (ab))); /* ** If there is a local variable that aliases sr, then there is no ** error. Make the local an only. */ if (!sRefSet_isEmpty (ab)) { sRef res = sRef_undefined; DPRINTF (("Here we are!")); /* ** make one an only, others alias it */ sRefSet_realElements (ab, current) { if (sRef_isOwned (current)) { res = current; break; } } end_sRefSet_realElements; if (sRef_isInvalid (res)) { /* ** evans - 2001-03-24 ** No owned element, just choose one! ** (Any reason for preference?) */ res = sRefSet_choose (ab); } sRefSet_free (ab); return res; } return sRef_undefined; } bool transferChecks_canLoseReference (/*@dependent@*/ sRef sr, fileloc loc) { bool gotone = FALSE; sRefSet ab = usymtab_aliasedBy (sr); /* yes, really mean aliasedBy */ DPRINTF (("Aliased by: %s", sRefSet_unparse (ab))); /* ** if there is a local variable that aliases sr, then there is no ** error. Make the local an only. */ if (!sRefSet_isEmpty (ab)) { /* ** make one an only, others alias it */ sRefSet_realElements (ab, current) { sRef_setLastReference (current, sr, loc); gotone = TRUE; break; } end_sRefSet_realElements; sRefSet_free (ab); } return gotone; } bool canLoseLocalReference (/*@dependent@*/ sRef sr, fileloc loc) { bool gotone = FALSE; sRefSet ab = usymtab_aliasedBy (sr); /* yes, really mean aliasedBy */ /* ** if there is a local variable that aliases sr, then there is no ** error. Make the local an only. */ if (!sRefSet_isEmpty (ab)) { /* ** make one an only, others alias it */ sRefSet_realElements (ab, current) { if (sRef_isRealLocalVar (sRef_getRootBase (current))) { sRef_setLastReference (current, sr, loc); gotone = TRUE; break; } } end_sRefSet_realElements; sRefSet_free (ab); } return gotone; } splint-3.1.2.dfsg1/src/varKinds.c0000644021234200000250000004426607630461222014175 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** varKinds.c */ # include "splintMacros.nf" # include "basic.h" alkind alkind_fromInt (int n) { /*@+enumint@*/ if (n < AK_UNKNOWN || n > AK_LOCAL) { llbug (message ("Alias kind out of range: %d", n)); } /*@=enumint@*/ return ((alkind)n); } nstate nstate_fromInt (int n) { /*@+enumint@*/ llassertprint (n >= NS_ERROR && n <= NS_ABSNULL, ("Bad null state: %d", n)); /*@=enumint@*/ return ((nstate)n); } sstate sstate_fromInt (int n) { /*@+enumint@*/ llassert (n >= SS_UNKNOWN && n < SS_LAST); /*@=enumint@*/ return ((sstate)n); } exkind exkind_fromInt (int n) { /*@+enumint@*/ llassert (n >= XO_UNKNOWN && n <= XO_OBSERVER); /*@=enumint@*/ return ((exkind) n); } cstring sstate_unparse (sstate s) { switch (s) { case SS_UNKNOWN: return cstring_makeLiteralTemp ("unknown"); case SS_UNUSEABLE: return cstring_makeLiteralTemp ("unuseable"); case SS_UNDEFINED: return cstring_makeLiteralTemp ("undefined"); case SS_MUNDEFINED:return cstring_makeLiteralTemp ("possibly undefined"); case SS_ALLOCATED: return cstring_makeLiteralTemp ("allocated"); case SS_PDEFINED: return cstring_makeLiteralTemp ("partially defined"); case SS_DEFINED: return cstring_makeLiteralTemp ("defined"); case SS_PARTIAL: return cstring_makeLiteralTemp ("partial"); case SS_SPECIAL: return cstring_makeLiteralTemp ("special"); case SS_DEAD: return cstring_makeLiteralTemp ("dead"); case SS_HOFFA: return cstring_makeLiteralTemp ("probably dead"); case SS_FIXED: return cstring_makeLiteralTemp ("unmodifiable"); case SS_RELDEF: return cstring_makeLiteralTemp ("reldef"); case SS_LAST: llcontbuglit ("sstate_unparse: last"); return cstring_makeLiteralTemp (""); case SS_UNDEFGLOB: return cstring_makeLiteralTemp ("undefglob"); case SS_KILLED: return cstring_makeLiteralTemp ("killed"); case SS_UNDEFKILLED: return cstring_makeLiteralTemp ("undefkilled"); } BADEXIT; } bool nstate_possiblyNull (nstate n) { /* ** note: not NS_UNKNOWN or NS_ERROR */ return ((n >= NS_CONSTNULL) && (n <= NS_ABSNULL)); } bool nstate_perhapsNull (nstate n) { /* ** note: not NS_UNKNOWN or NS_ERROR */ return ((n >= NS_RELNULL) && (n <= NS_ABSNULL)); } cstring nstate_unparse (nstate n) { switch (n) { case NS_ERROR: return cstring_makeLiteralTemp (""); case NS_UNKNOWN: return cstring_makeLiteralTemp ("implicitly non-null"); case NS_POSNULL: return cstring_makeLiteralTemp ("null"); case NS_DEFNULL: return cstring_makeLiteralTemp ("null"); case NS_NOTNULL: return cstring_makeLiteralTemp ("notnull"); case NS_MNOTNULL: return cstring_makeLiteralTemp ("notnull"); case NS_ABSNULL: return cstring_makeLiteralTemp ("null"); case NS_RELNULL: return cstring_makeLiteralTemp ("relnull"); case NS_CONSTNULL: return cstring_makeLiteralTemp ("null"); } /*@notreached@*/ llcontbuglit ("bad null state!"); /*@notreached@*/ return cstring_makeLiteralTemp ("!!! bad null state !!!"); BADEXIT; } /* ** ??? (used to do something different for guarded) */ int nstate_compare (nstate n1, nstate n2) { return (generic_compare (n1, n2)); } /* ** This occurs when we select a field with alkind inner, ** from a structure with alkind outer. It is probably ** unnecessary. */ alkind alkind_derive (alkind outer, alkind inner) { switch (outer) { case AK_ERROR: case AK_UNKNOWN: return inner; case AK_KEPT: case AK_KEEP: case AK_ONLY: case AK_IMPONLY: case AK_OWNED: case AK_IMPDEPENDENT: case AK_DEPENDENT: if (inner == AK_SHARED) return AK_SHARED; else if (outer == AK_DEPENDENT) return AK_IMPDEPENDENT; else if (outer == AK_ONLY) return AK_IMPONLY; else return outer; /* not so sure about these? */ case AK_REFCOUNTED: case AK_NEWREF: case AK_KILLREF: case AK_REFS: case AK_STACK: case AK_STATIC: return outer; case AK_TEMP: case AK_IMPTEMP: case AK_SHARED: case AK_UNIQUE: case AK_LOCAL: case AK_FRESH: case AK_RETURNED: if (alkind_isKnown (inner)) return inner; else return outer; } BADEXIT; } cstring alkind_unparse (alkind a) { switch (a) { case AK_ERROR: return cstring_makeLiteralTemp (""); case AK_UNKNOWN: return cstring_makeLiteralTemp ("unqualified"); case AK_ONLY: return cstring_makeLiteralTemp ("only"); case AK_IMPONLY: return cstring_makeLiteralTemp ("implicitly only"); case AK_OWNED: return cstring_makeLiteralTemp ("owned"); case AK_IMPDEPENDENT: return cstring_makeLiteralTemp ("implicitly dependent"); case AK_DEPENDENT: return cstring_makeLiteralTemp ("dependent"); case AK_KEEP: return cstring_makeLiteralTemp ("keep"); case AK_KEPT: return cstring_makeLiteralTemp ("kept"); case AK_IMPTEMP: return cstring_makeLiteralTemp ("implicitly temp"); case AK_TEMP: return cstring_makeLiteralTemp ("temp"); case AK_SHARED: return cstring_makeLiteralTemp ("shared"); case AK_UNIQUE: return cstring_makeLiteralTemp ("unique"); case AK_RETURNED: return cstring_makeLiteralTemp ("returned"); case AK_FRESH: return cstring_makeLiteralTemp ("fresh"); case AK_STACK: return cstring_makeLiteralTemp ("stack"); case AK_REFCOUNTED: return cstring_makeLiteralTemp ("refcounted"); case AK_REFS: return cstring_makeLiteralTemp ("refs"); case AK_KILLREF: return cstring_makeLiteralTemp ("killref"); case AK_NEWREF: return cstring_makeLiteralTemp ("newref"); case AK_LOCAL: return cstring_makeLiteralTemp ("local"); case AK_STATIC: return cstring_makeLiteralTemp ("unqualified static"); } BADEXIT; } cstring exkind_unparse (exkind a) { switch (a) { case XO_UNKNOWN: return cstring_makeLiteralTemp ("unknown"); case XO_NORMAL: return cstring_makeLiteralTemp ("unexposed"); case XO_EXPOSED: return cstring_makeLiteralTemp ("exposed"); case XO_OBSERVER: return cstring_makeLiteralTemp ("observer"); } BADEXIT; } cstring exkind_capName (exkind a) { switch (a) { case XO_UNKNOWN: return cstring_makeLiteralTemp ("Unknown"); case XO_NORMAL: return cstring_makeLiteralTemp ("Unexposed"); case XO_EXPOSED: return cstring_makeLiteralTemp ("Exposed"); case XO_OBSERVER: return cstring_makeLiteralTemp ("Observer"); } BADEXIT; } cstring exkind_unparseError (exkind a) { switch (a) { case XO_UNKNOWN: return cstring_makeLiteralTemp ("unqualified"); case XO_NORMAL: return cstring_makeLiteralTemp ("unqualifier"); case XO_EXPOSED: return cstring_makeLiteralTemp ("exposed"); case XO_OBSERVER: return cstring_makeLiteralTemp ("observer"); } BADEXIT; } cstring alkind_capName (alkind a) { switch (a) { case AK_ERROR: return cstring_makeLiteralTemp (""); case AK_UNKNOWN: return cstring_makeLiteralTemp ("Unqualified"); case AK_ONLY: return cstring_makeLiteralTemp ("Only"); case AK_IMPONLY: return cstring_makeLiteralTemp ("Implicitly only"); case AK_OWNED: return cstring_makeLiteralTemp ("Owned"); case AK_IMPDEPENDENT: return cstring_makeLiteralTemp ("Implicitly dependent"); case AK_DEPENDENT: return cstring_makeLiteralTemp ("Dependent"); case AK_KEEP: return cstring_makeLiteralTemp ("Keep"); case AK_KEPT: return cstring_makeLiteralTemp ("Kept"); case AK_IMPTEMP: return cstring_makeLiteralTemp ("Implicitly temp"); case AK_TEMP: return cstring_makeLiteralTemp ("Temp"); case AK_SHARED: return cstring_makeLiteralTemp ("Shared"); case AK_UNIQUE: return cstring_makeLiteralTemp ("Unique"); case AK_RETURNED: return cstring_makeLiteralTemp ("Returned"); case AK_FRESH: return cstring_makeLiteralTemp ("Fresh"); case AK_STACK: return cstring_makeLiteralTemp ("Stack"); case AK_REFCOUNTED: return cstring_makeLiteralTemp ("Refcounted"); case AK_REFS: return cstring_makeLiteralTemp ("Refs"); case AK_KILLREF: return cstring_makeLiteralTemp ("Killref"); case AK_NEWREF: return cstring_makeLiteralTemp ("Newref"); case AK_LOCAL: return cstring_makeLiteralTemp ("Local"); case AK_STATIC: return cstring_makeLiteralTemp ("Unqualified static"); } BADEXIT; } exkind exkind_fromQual (qual q) { if (qual_isExposed (q)) { return XO_EXPOSED; } else if (qual_isObserver (q)) { return XO_OBSERVER; } else { llcontbug (message ("exkind_fromQual: not exp qualifier: %s" , qual_unparse (q))); return XO_UNKNOWN; } } sstate sstate_fromQual (qual q) { if (qual_isOut (q)) return SS_ALLOCATED; if (qual_isIn (q)) return SS_DEFINED; else if (qual_isPartial (q)) return SS_PARTIAL; else if (qual_isRelDef (q)) return SS_RELDEF; else if (qual_isUndef (q)) return SS_UNDEFGLOB; else if (qual_isKilled (q)) return SS_KILLED; else if (qual_isSpecial (q)) return SS_SPECIAL; else { llcontbug (message ("sstate_fromQual: not alias qualifier: %s", qual_unparse (q))); return SS_UNKNOWN; } } exitkind exitkind_fromQual (qual q) { if (qual_isExits (q)) return XK_MUSTEXIT; if (qual_isMayExit (q)) return XK_MAYEXIT; if (qual_isTrueExit (q)) return XK_TRUEEXIT; if (qual_isFalseExit (q)) return XK_FALSEEXIT; if (qual_isNeverExit (q)) return XK_NEVERESCAPE; else { llcontbug (message ("exitkind_fromQual: not exit qualifier: %s", qual_unparse (q))); return XK_UNKNOWN; } } alkind alkind_fromQual (qual q) { if (qual_isOnly (q)) return AK_ONLY; if (qual_isImpOnly (q)) return AK_IMPONLY; if (qual_isKeep (q)) return AK_KEEP; if (qual_isKept (q)) return AK_KEPT; if (qual_isTemp (q)) return AK_TEMP; if (qual_isShared (q)) return AK_SHARED; if (qual_isUnique (q)) return AK_UNIQUE; if (qual_isRefCounted (q)) return AK_REFCOUNTED; if (qual_isRefs (q)) return AK_REFS; if (qual_isNewRef (q)) return AK_NEWREF; if (qual_isKillRef (q)) return AK_KILLREF; if (qual_isTempRef (q)) return AK_KILLREF; /* kludge? use kill ref for this */ if (qual_isOwned (q)) return AK_OWNED; if (qual_isDependent (q)) return AK_DEPENDENT; llcontbug (message ("alkind_fromQual: not alias qualifier: %s", qual_unparse (q))); return AK_ERROR; } static bool alkind_isMeaningless (alkind a1) { return (a1 == AK_ERROR || a1 == AK_UNKNOWN || a1 == AK_RETURNED || a1 == AK_STACK || a1 == AK_REFCOUNTED || a1 == AK_REFS || a1 == AK_KILLREF || a1 == AK_NEWREF || a1 == AK_LOCAL); } bool alkind_compatible (alkind a1, alkind a2) { if (a1 == a2) return TRUE; if (a2 == AK_ERROR) return TRUE; if (a2 == AK_UNKNOWN) { return (alkind_isMeaningless (a1) || (a1 == AK_IMPTEMP)); } switch (a1) { case AK_ERROR: return TRUE; case AK_UNKNOWN: return (alkind_isMeaningless (a2) || (a2 == AK_IMPTEMP)); case AK_IMPONLY: return (a2 == AK_KEEP || a2 == AK_FRESH || a2 == AK_ONLY); case AK_ONLY: return (a2 == AK_KEEP || a2 == AK_FRESH || a2 == AK_IMPONLY); case AK_OWNED: return FALSE; case AK_IMPDEPENDENT: return (a2 == AK_DEPENDENT); case AK_DEPENDENT: return (a2 == AK_IMPDEPENDENT); case AK_KEEP: return (a2 == AK_ONLY || a2 == AK_FRESH || a2 == AK_IMPONLY); case AK_KEPT: return FALSE; case AK_IMPTEMP: return (a2 == AK_TEMP); case AK_TEMP: return (a2 == AK_IMPTEMP); case AK_SHARED: return FALSE; case AK_UNIQUE: return (a2 == AK_TEMP); case AK_RETURNED: return (alkind_isMeaningless (a2)); case AK_FRESH: return (alkind_isOnly (a2)); case AK_STACK: return (alkind_isMeaningless (a2)); case AK_REFCOUNTED: return (alkind_isMeaningless (a2)); case AK_REFS: return (alkind_isMeaningless (a2)); case AK_KILLREF: return (alkind_isMeaningless (a2)); case AK_NEWREF: return (alkind_isMeaningless (a2)); case AK_LOCAL: return (alkind_isMeaningless (a2)); case AK_STATIC: return (alkind_isMeaningless (a2)); } BADEXIT; } bool alkind_equal (alkind a1, alkind a2) { if (a1 == a2) return TRUE; if (a2 == AK_ERROR) return TRUE; switch (a1) { case AK_ERROR: return TRUE; case AK_IMPONLY: return (a2 == AK_ONLY); case AK_ONLY: return (a2 == AK_IMPONLY); case AK_IMPDEPENDENT: return (a2 == AK_DEPENDENT); case AK_DEPENDENT: return (a2 == AK_IMPDEPENDENT); case AK_IMPTEMP: return (a2 == AK_TEMP); case AK_TEMP: return (a2 == AK_IMPTEMP); default: return FALSE; } BADEXIT; } alkind alkind_fixImplicit (alkind a) { if (a == AK_IMPTEMP) return AK_TEMP; if (a == AK_IMPONLY) return AK_IMPONLY; if (a == AK_IMPDEPENDENT) return AK_DEPENDENT; return a; } cstring exitkind_unparse (exitkind k) { switch (k) { case XK_ERROR: return (cstring_makeLiteralTemp ("")); case XK_UNKNOWN: return (cstring_makeLiteralTemp ("?")); case XK_NEVERESCAPE: return (cstring_makeLiteralTemp ("never escape")); case XK_MAYEXIT: return (cstring_makeLiteralTemp ("mayexit")); case XK_MUSTEXIT: return (cstring_makeLiteralTemp ("exits")); case XK_TRUEEXIT: return (cstring_makeLiteralTemp ("trueexit")); case XK_FALSEEXIT: return (cstring_makeLiteralTemp ("falseexit")); case XK_MUSTRETURN: return (cstring_makeLiteralTemp ("mustreturn")); case XK_MAYRETURN: return (cstring_makeLiteralTemp ("mayreturn")); case XK_MUSTRETURNEXIT: return (cstring_makeLiteralTemp ("mustreturnexit")); case XK_MAYRETURNEXIT: return (cstring_makeLiteralTemp ("mayreturnexit")); case XK_GOTO: return (cstring_makeLiteralTemp ("goto")); case XK_MAYGOTO: return (cstring_makeLiteralTemp ("maygoto")); } BADEXIT; } exitkind exitkind_makeConditional (exitkind k) { switch (k) { case XK_TRUEEXIT: case XK_FALSEEXIT: case XK_MUSTEXIT: return XK_MAYEXIT; case XK_MUSTRETURN: return XK_MAYRETURN; case XK_MUSTRETURNEXIT: return XK_MAYRETURNEXIT; case XK_GOTO: return XK_MAYGOTO; default: return k; } } exitkind exitkind_combine (exitkind k1, exitkind k2) { if (k1 == k2) { return k1; } if (k2 == XK_ERROR) { return XK_ERROR; } switch (k1) { case XK_ERROR: return XK_ERROR; case XK_UNKNOWN: case XK_NEVERESCAPE: return (exitkind_makeConditional (k2)); case XK_MUSTEXIT: switch (k2) { case XK_MUSTRETURNEXIT: case XK_MUSTRETURN: return XK_MUSTRETURNEXIT; case XK_MAYRETURNEXIT: case XK_MAYRETURN: return XK_MAYRETURNEXIT; default: return XK_MAYEXIT; } BADEXIT; case XK_MAYEXIT: case XK_TRUEEXIT: case XK_FALSEEXIT: switch (k2) { case XK_MUSTRETURNEXIT: case XK_MAYRETURNEXIT: case XK_MAYRETURN: case XK_MUSTRETURN: return XK_MAYRETURNEXIT; default: return XK_MAYEXIT; } BADEXIT; case XK_MUSTRETURN: switch (k2) { case XK_MUSTRETURNEXIT: case XK_MUSTEXIT: return XK_MUSTRETURNEXIT; case XK_MAYRETURNEXIT: case XK_TRUEEXIT: case XK_FALSEEXIT: case XK_MAYEXIT: return XK_MAYRETURNEXIT; default: return XK_MAYRETURN; } BADEXIT; case XK_MAYRETURN: if (exitkind_couldExit (k2)) { return XK_MAYRETURNEXIT; } else { return XK_MAYRETURN; } case XK_MUSTRETURNEXIT: switch (k2) { case XK_MUSTRETURN: case XK_MUSTEXIT: return XK_MUSTRETURNEXIT; default: return XK_MAYRETURNEXIT; } BADEXIT; case XK_MAYRETURNEXIT: return XK_MAYRETURNEXIT; case XK_GOTO: case XK_MAYGOTO: if (exitkind_couldExit (k2)) { return XK_MAYRETURNEXIT; } return XK_MAYGOTO; } BADEXIT; } bool exitkind_couldExit (exitkind e) { switch (e) { case XK_MAYEXIT: case XK_MUSTEXIT: case XK_TRUEEXIT: case XK_FALSEEXIT: case XK_MAYRETURNEXIT: case XK_MUSTRETURNEXIT: case XK_GOTO: case XK_MAYGOTO: return TRUE; default: return FALSE; } } static bool exitkind_couldReturn (exitkind e) /*@*/ { switch (e) { case XK_MUSTRETURN: case XK_MAYRETURN: case XK_MAYRETURNEXIT: case XK_MUSTRETURNEXIT: return TRUE; default: return FALSE; } } static bool exitkind_couldGoto (exitkind e) /*@*/ { return (e == XK_GOTO || e == XK_MAYGOTO); } bool exitkind_couldEscape (exitkind e) { return exitkind_couldReturn (e) || exitkind_couldExit (e) || exitkind_couldGoto (e); } exitkind exitkind_fromInt (int x) { /*@+enumint@*/ llassert (x >= XK_ERROR && x <= XK_LAST); /*@=enumint@*/ return (exitkind) x; } splint-3.1.2.dfsg1/src/nameChecks.c0000644021234200000250000010632510101544330014435 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** nameChecks.c */ # include "splintMacros.nf" # include "basic.h" # include "nameChecks.h" static bool checkCzechName (uentry p_ue, flagcode p_czechflag, bool p_report) /*@modifies p_ue, g_warningstream@*/ ; static bool checkSlovakName (uentry p_ue, flagcode p_slovakflag, bool p_report) /*@modifies p_ue, g_warningstream@*/ ; static cstring czechPrefix (cstring name) { return (cstring_beforeChar (name, '_')); } static cstring slovakPrefix (cstring name) { size_t i = 0; cstring_chars (name, c) { if (isupper ((unsigned char) c)) { return (cstring_prefix (name, i)); } i++; } end_cstring_chars; return cstring_undefined; } static flagcode excludeCodes [] = { FLG_MACROVARPREFIXEXCLUDE, FLG_TAGPREFIXEXCLUDE, FLG_ENUMPREFIXEXCLUDE, FLG_FILESTATICPREFIXEXCLUDE, FLG_GLOBPREFIXEXCLUDE, FLG_TYPEPREFIXEXCLUDE, FLG_EXTERNALPREFIXEXCLUDE, FLG_UNCHECKEDMACROPREFIXEXCLUDE, FLG_LOCALPREFIXEXCLUDE, INVALID_FLAG } ; /*@iter excludeFlagCodes (yield flagcode code);@*/ # define excludeFlagCodes(m_c) \ { int m_i = 0; while (flagcode_isValid (excludeCodes[m_i])) \ { flagcode m_c = excludeCodes[m_i]; m_i++; # define end_excludeFlagCodes }} static bool matchPrefixChar (int nc, int pc) { if (nc == pc) { return TRUE; } else { switch (pc) { case PFX_UPPERCASE: return isupper (nc); case PFX_LOWERCASE: return islower (nc); case PFX_ANY: return TRUE; case PFX_DIGIT: return isdigit (nc); case PFX_NOTUPPER: return !isupper (nc); case PFX_NOTLOWER: return !islower (nc); case PFX_ANYLETTER: return isalpha (nc); case PFX_ANYLETTERDIGIT: return (isdigit (nc) || isalpha (nc)); default: return FALSE; } } BADEXIT; } static bool matchPrefix (cstring name, cstring prefix) { if (cstring_isUndefined (name) || cstring_isUndefined (prefix)) { return TRUE; } else { size_t namelen = cstring_length (name); int last = (int) '\0'; size_t n = 1; cstring_chars (prefix, pc) { int nc; if (pc == '*') { n++; while (n <= namelen) { nc = (int) cstring_getChar (name, n); if (!matchPrefixChar (nc, last)) { return FALSE; } n++; } return TRUE; } else { if (n > namelen) { if (namelen > 1 && (cstring_length (prefix) >= n + 1) && cstring_getChar (prefix, n + 1) == '*') { return TRUE; } else { return FALSE; } } nc = (int) cstring_getChar (name, n); if (!matchPrefixChar (nc, (int) pc)) { return FALSE; } } last = (int) pc; n++; } end_cstring_chars; return TRUE; } } static flagcode namespaceExcluded (flagcode code) /*@*/ { switch (code) { case FLG_MACROVARPREFIXEXCLUDE: return (FLG_MACROVARPREFIX); case FLG_TAGPREFIXEXCLUDE: return (FLG_TAGPREFIX); case FLG_ENUMPREFIXEXCLUDE: return (FLG_ENUMPREFIX); case FLG_FILESTATICPREFIXEXCLUDE: return (FLG_FILESTATICPREFIX); case FLG_GLOBPREFIXEXCLUDE: return (FLG_GLOBPREFIX); case FLG_TYPEPREFIXEXCLUDE: return (FLG_TYPEPREFIX); case FLG_EXTERNALPREFIXEXCLUDE: return (FLG_EXTERNALPREFIX); case FLG_UNCHECKEDMACROPREFIXEXCLUDE: return (FLG_UNCHECKEDMACROPREFIX); case FLG_LOCALPREFIXEXCLUDE: return (FLG_LOCALPREFIX); case FLG_ITERPREFIXEXCLUDE: return (FLG_ITERPREFIX); case FLG_CONSTPREFIXEXCLUDE: return (FLG_CONSTPREFIX); BADDEFAULT; } } static /*@observer@*/ cstring namespaceName (flagcode flag) /*@*/ { switch (flag) { case FLG_MACROVARPREFIX: return cstring_makeLiteralTemp ("macro variable"); case FLG_TAGPREFIX: return cstring_makeLiteralTemp ("tag"); case FLG_ENUMPREFIX: return cstring_makeLiteralTemp ("enum member"); case FLG_TYPEPREFIX: return cstring_makeLiteralTemp ("user-defined type"); case FLG_FILESTATICPREFIX: return cstring_makeLiteralTemp ("file static"); case FLG_GLOBPREFIX: return cstring_makeLiteralTemp ("global variable"); case FLG_EXTERNALPREFIX: return cstring_makeLiteralTemp ("external"); case FLG_LOCALPREFIX: return cstring_makeLiteralTemp ("local variable"); case FLG_CONSTPREFIX: return cstring_makeLiteralTemp ("constant"); case FLG_ITERPREFIX: return cstring_makeLiteralTemp ("iter"); case FLG_UNCHECKEDMACROPREFIX: return cstring_makeLiteralTemp ("unchecked macro"); BADDEFAULT; } } void checkPrefix (uentry ue) { cstring name = cstring_undefined; flagcode flag; if (uentry_isExpandedMacro (ue)) { flag = FLG_UNCHECKEDMACROPREFIX; } else if (uentry_isAnyTag (ue)) { flag = FLG_TAGPREFIX; } else if (uentry_isEnumConstant (ue)) { flag = FLG_ENUMPREFIX; } else if (uentry_isDatatype (ue)) { flag = FLG_TYPEPREFIX; } else if (uentry_isFileStatic (ue)) { flag = FLG_FILESTATICPREFIX; } else if (uentry_isGlobalVariable (ue)) { flag = FLG_GLOBPREFIX; } else if (uentry_isVariable (ue)) { if (uentry_isRefParam (ue)) { return; /* already checked param */ } if (context_inMacro ()) { if (uentry_isAnyParam (ue)) { if (uentry_isYield (ue)) { flag = FLG_MACROVARPREFIX; } else { flag = FLG_LOCALPREFIX; } } else { flag = FLG_MACROVARPREFIX; } } else { flag = FLG_LOCALPREFIX; } } else if (uentry_isConstant (ue)) { flag = FLG_CONSTPREFIX; } else if (uentry_isIter (ue)) { flag = FLG_ITERPREFIX; } else if (uentry_isExported (ue)) { flag = FLG_EXTERNALPREFIX; } else { llcontbug (message ("What is it: %q", uentry_unparseFull (ue))); return; } if (flag == FLG_TYPEPREFIX || flag == FLG_GLOBPREFIX || flag == FLG_ENUMPREFIX || flag == FLG_CONSTPREFIX) { if (flag == FLG_ENUMPREFIX) { if (!context_getFlag (flag)) { flag = FLG_CONSTPREFIX; } } if (!context_getFlag (flag)) { flag = FLG_EXTERNALPREFIX; } } if (context_getFlag (flag)) { name = uentry_observeRealName (ue); if (!matchPrefix (name, context_getString (flag))) { llassert (flag != FLG_NAMECHECKS); if (optgenerror2 (flag, FLG_NAMECHECKS, message ("%s %s name is not consistent with %s " "namespace prefix \"%s\"", uentry_ekindName (ue), name, namespaceName (flag), context_getString (flag)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } } excludeFlagCodes (code) { bool check = FALSE; if (context_getFlag (code)) { /*@-loopswitchbreak@*/ switch (code) { case FLG_MACROVARPREFIXEXCLUDE: check = (flag != FLG_MACROVARPREFIX); break; case FLG_TAGPREFIXEXCLUDE: check = (flag != FLG_TAGPREFIX); break; case FLG_ENUMPREFIXEXCLUDE: check = (flag != FLG_ENUMPREFIX); break; case FLG_FILESTATICPREFIXEXCLUDE: check = (flag != FLG_FILESTATICPREFIX); break; case FLG_GLOBPREFIXEXCLUDE: check = (flag != FLG_GLOBPREFIX); break; case FLG_TYPEPREFIXEXCLUDE: check = (flag != FLG_TYPEPREFIX); break; case FLG_EXTERNALPREFIXEXCLUDE: check = (flag != FLG_EXTERNALPREFIX && flag != FLG_GLOBPREFIX && flag != FLG_TYPEPREFIX && flag != FLG_UNCHECKEDMACROPREFIX); break; case FLG_UNCHECKEDMACROPREFIXEXCLUDE: check = (flag != FLG_UNCHECKEDMACROPREFIX); break; case FLG_LOCALPREFIXEXCLUDE: check = (flag != FLG_LOCALPREFIX); break; case FLG_CONSTPREFIXEXCLUDE: check = (flag != FLG_CONSTPREFIX); break; case FLG_ITERPREFIXEXCLUDE: check = (flag != FLG_ITERPREFIX); break; BADDEFAULT; } /*@=loopswitchbreak@*/ if (check) { flagcode rcode = namespaceExcluded (code); cstring pstring = context_getString (rcode); if (cstring_isDefined (pstring)) { if (cstring_isUndefined (name)) { name = uentry_observeRealName (ue); } if (matchPrefix (name, context_getString (rcode))) { if (optgenerror2 (code, FLG_NAMECHECKS, message ("%s %s name is not a %s (it is a %s), " "but matches the %s " "namespace prefix \"%s\"", uentry_ekindName (ue), name, namespaceName (rcode), namespaceName (flag), namespaceName (rcode), context_getString (rcode)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } } } } } end_excludeFlagCodes ; } static void checkNationalName (uentry ue) { flagcode czechflag; flagcode slovakflag; flagcode czechoslovakflag; bool gcf, gsf, gcsf; if (uentry_isFunction (ue) || uentry_isIter (ue) || uentry_isEndIter (ue)) { czechflag = FLG_CZECHFUNCTIONS; slovakflag = FLG_SLOVAKFUNCTIONS; czechoslovakflag = FLG_CZECHOSLOVAKFUNCTIONS; } else if (uentry_isExpandedMacro (ue)) { czechflag = FLG_CZECHMACROS; slovakflag = FLG_SLOVAKMACROS; czechoslovakflag = FLG_CZECHOSLOVAKMACROS; } else if (uentry_isVariable (ue)) { if (uentry_isGlobalVariable (ue) && context_getFlag (FLG_GLOBPREFIX)) { /* prefix checks supercede national naming checks */ return; } czechflag = FLG_CZECHVARS; slovakflag = FLG_SLOVAKVARS; czechoslovakflag = FLG_CZECHOSLOVAKVARS; } else if (uentry_isConstant (ue)) { if (uentry_isGlobalVariable (ue) && context_getFlag (FLG_CONSTPREFIX)) { /* prefix checks supercede national naming checks */ return; } czechflag = FLG_CZECHCONSTANTS; slovakflag = FLG_SLOVAKCONSTANTS; czechoslovakflag = FLG_CZECHOSLOVAKCONSTANTS; } else { if (uentry_isAnyTag (ue) || uentry_isEnumConstant (ue)) { return; /* no errors for tags */ } llassert (uentry_isDatatype (ue)); czechflag = FLG_CZECHTYPES; slovakflag = FLG_SLOVAKTYPES; czechoslovakflag = FLG_CZECHOSLOVAKTYPES; } gcf = context_getFlag (czechflag); gsf = context_getFlag (slovakflag); gcsf = context_getFlag (czechoslovakflag); if (gcf || (uentry_isFunction (ue) && context_getFlag (FLG_ACCESSCZECH))) { (void) checkCzechName (ue, czechflag, gcf); } if (gsf || (uentry_isFunction (ue) && context_getFlag (FLG_ACCESSSLOVAK))) { (void) checkSlovakName (ue, slovakflag, gsf); } if (gcsf) { if (uentry_isDatatype (ue)) { /* May not have either _'s or uppercase letter */ cstring name = uentry_rawName (ue); int charno = 1; cstring_chars (name, c) { if (isupper ((unsigned char) c)) { if (optgenerror2 (FLG_CZECHOSLOVAKTYPES, FLG_NAMECHECKS, message ("%s %q name violates Czechoslovak naming convention. " "Czechoslovak datatype names should not use uppercase " "letters.", uentry_ekindName (ue), uentry_getName (ue)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } break; } if (c == '_' && charno != 2 && charno != 3) { if (optgenerror2 (FLG_CZECHOSLOVAKTYPES, FLG_NAMECHECKS, message ("%s %q name violates Czechoslovak naming " "convention. Czechoslovak datatype names " "should not use the _ charater.", uentry_ekindName (ue), uentry_getName (ue)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } break; } charno++; } end_cstring_chars; } else { bool okay = checkCzechName (ue, czechflag, FALSE); /* still need to call, to set access */ okay |= checkSlovakName (ue, slovakflag, FALSE); if (!okay) { if (optgenerror2 (czechoslovakflag, FLG_NAMECHECKS, message ("%s %q name is not consistent with Czechoslovak " "naming convention.", uentry_ekindName (ue), uentry_getName (ue)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } } } } static bool checkCzechName (uentry ue, flagcode czechflag, bool report) { if (uentry_isDatatype (ue)) { /* ** Czech datatypes may not have _'s, except if there are 1 or 2 characters ** before the only _. */ cstring name = uentry_rawName (ue); int charno = 1; cstring_chars (name, c) { if (c == '_' && charno != 2 && charno != 3) { if (report) { if (optgenerror2 (FLG_CZECHTYPES, FLG_NAMECHECKS, message ("%s %q name violates Czech naming convention. " "Czech datatype names should not use the _ charater.", uentry_ekindName (ue), uentry_getName (ue)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } return FALSE; } charno++; } end_cstring_chars; } else { typeIdSet acc = context_fileAccessTypes (); cstring pfx = czechPrefix (uentry_rawName (ue)); if (cstring_isEmpty (pfx)) { if (uentry_isVariable (ue) || uentry_isConstant (ue)) { ctype ct = uentry_getType (ue); if (ctype_isAbstract (ct) && context_hasAccess (ctype_typeId (ct))) { if (report) { if (optgenerror2 (czechflag, FLG_NAMECHECKS, message ("%s %q name is not consistent with Czech " "naming convention. The name should " "begin with %s_", uentry_ekindName (ue), uentry_getName (ue), ctype_unparse (ct)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } else if (uentry_isFunction (ue) || uentry_isIter (ue)) { if (typeIdSet_isEmpty (acc)) { ; /* okay - should not be czech name */ } else { if (report) { if (optgenerror2 (czechflag, FLG_NAMECHECKS, message ("%s %q name is not consistent with Czech " "naming convention. Accessible types: %q", uentry_ekindName (ue), uentry_getName (ue), typeIdSet_unparse (acc)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } else { ; } } else { if (usymtab_existsTypeEither (pfx)) { ctype ct = usymtab_lookupAbstractType (pfx); typeId tid; if (ctype_isUA (ct)) { tid = ctype_typeId (ct); if (ctype_isUser (ct) || context_hasAccess (tid)) { ; } else { if (context_getFlag (FLG_ACCESSCZECH) || context_getFlag (FLG_ACCESSCZECHOSLOVAK)) { if (!uentry_isVar (ue)) { uentry_addAccessType (ue, tid); } } else { if (report) { if (llgenhinterror (czechflag, message ("%s %q name violates Czech naming " "convention. Czech prefix %s names " "an abstract type that is " "not accessible.", uentry_ekindName (ue), uentry_getName (ue), pfx), cstring_makeLiteral ("Use +accessczech to allow access to " "type in functions " "named _."), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } } else if (ctype_isManifestBool (ct)) { if (context_canAccessBool ()) { ; } else { if (context_getFlag (FLG_ACCESSCZECH) || context_getFlag (FLG_ACCESSCZECHOSLOVAK)) { if (!uentry_isVar (ue)) { tid = usymtab_getTypeId (context_getBoolName ()); uentry_addAccessType (ue, tid); } } else { if (report) { if (llgenhinterror (czechflag, message ("%s %q name violates Czech naming " "convention. Type bool is not accessible.", uentry_ekindName (ue), uentry_getName (ue)), cstring_makeLiteral ("Use +accessczech to allow access to " "type in functions named _."), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } } else { ; } } else { if (cstring_equalLit (pfx, "int") || cstring_equalLit (pfx, "char") || cstring_equalLit (pfx, "short") || cstring_equalLit (pfx, "long") || cstring_equalLit (pfx, "unsigned") || cstring_equalLit (pfx, "signed") || cstring_equalLit (pfx, "float") || cstring_equalLit (pfx, "double")) { ; /* built-in types */ } else { /* no accessible types, could match module name */ if (cstring_equal (pfx, context_moduleName ())) { ; } else { if (report) { if (optgenerror2 (czechflag, FLG_NAMECHECKS, message ("%s %q name violates Czech naming convention. " "Czech prefix %s is not the name of a type.", uentry_ekindName (ue), uentry_getName (ue), pfx), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } } } cstring_free (pfx); } return TRUE; } static bool checkSlovakName (uentry ue, flagcode slovakflag, bool report) { if (uentry_isDatatype (ue)) { /* ** Slovak datatypes may not have uppercase letters. */ if (context_getFlag (FLG_SLOVAK)) { cstring name = uentry_rawName (ue); cstring_chars (name, c) { if (isupper ((unsigned char) c)) { if (report) { if (optgenerror2 (FLG_SLOVAKTYPES, FLG_NAMECHECKS, message ("%s %q name violates Slovak naming convention. " "Slovak datatype names should not use uppercase " "letters.", uentry_ekindName (ue), uentry_getName (ue)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } return FALSE; } } end_cstring_chars; } } else { typeIdSet acc = context_fileAccessTypes (); cstring pfx = slovakPrefix (uentry_rawName (ue)); if (cstring_isEmpty (pfx)) { if (typeIdSet_isEmpty (acc)) { ; /* okay - should not be slovak name */ } else { if (uentry_isFunction (ue)) { if (report) { if (optgenerror2 (slovakflag, FLG_NAMECHECKS, message ("%s %q name is not consistent with Slovak " "naming convention. Accessible types: %q", uentry_ekindName (ue), uentry_getName (ue), typeIdSet_unparse (acc)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } else { ctype ct = uentry_getType (ue); if (ctype_isUA (ct)) { if (report) { if (optgenerror2 (slovakflag, FLG_NAMECHECKS, message ("%s %q name is not consistent with " "Slovak naming convention. The " "name should begin with %s followed " "by an uppercase letter.", uentry_ekindName (ue), uentry_getName (ue), ctype_unparse (ct)), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } } } else { if (usymtab_existsTypeEither (pfx)) { ctype ct = usymtab_lookupAbstractType (pfx); typeId tid; if (ctype_isUA (ct)) { tid = ctype_typeId (ct); if (ctype_isUser (ct) || context_hasAccess (tid)) { ; } else { if (context_getFlag (FLG_ACCESSSLOVAK) || context_getFlag (FLG_ACCESSCZECHOSLOVAK)) { if (!uentry_isVar (ue)) { uentry_addAccessType (ue, tid); } } else { if (report) { if (llgenhinterror (slovakflag, message ("%s %q name violates Slovak naming " "convention. Slovak prefix %s names " "an abstract type that is not accessible.", uentry_ekindName (ue), uentry_getName (ue), pfx), cstring_makeLiteral ("Use +accessslovak to allow access to " "type in functions named _."), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } } else if (ctype_isManifestBool (ct)) { if (context_canAccessBool ()) { ; } else { if (context_getFlag (FLG_ACCESSSLOVAK) || context_getFlag (FLG_ACCESSCZECHOSLOVAK)) { if (!uentry_isVar (ue)) { tid = usymtab_getTypeId (context_getBoolName ()); uentry_addAccessType (ue, tid); } } else { if (report) { if (llgenhinterror (slovakflag, message ("%s %q name violates Slovak naming convention. " "Type bool is not accessible.", uentry_ekindName (ue), uentry_getName (ue)), cstring_makeLiteral ("Use +accessslovak to allow access to " "type in functions named _."), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } } else { ; } } else { if (cstring_equalLit (pfx, "int") || cstring_equalLit (pfx, "char") || cstring_equalLit (pfx, "short") || cstring_equalLit (pfx, "long") || cstring_equalLit (pfx, "unsigned") || cstring_equalLit (pfx, "signed") || cstring_equalLit (pfx, "float") || cstring_equalLit (pfx, "double")) { ; /* built-in types */ } else { /* no accessible types, could match module name */ if (cstring_equal (pfx, context_moduleName ())) { ; } else { if (report) { if (optgenerror2 (slovakflag, FLG_NAMECHECKS, message ("%s %q name violates Slovak naming convention. " "Slovak prefix %s is not the name of a type.", uentry_ekindName (ue), uentry_getName (ue), pfx), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } cstring_free (pfx); return FALSE; } } } } cstring_free (pfx); } return TRUE; } void checkExternalName (uentry ue) { if (!uentry_isStatic (ue) && uentry_hasName (ue)) { checkNationalName (ue); } else { ; } } void checkLocalName (/*@unused@*/ uentry ue) { /* ** No local checks (yet) */ return; } void checkFileScopeName (/*@unused@*/ uentry ue) { /* ** No file scope checks (yet) */ /* add a file scope naming convention policy? */ return; } /* ** Checks a name used by user source is not reserved by ANSI ** (or for future library functions). ** ** The restrictions are described in X3.159-1989: 4.13 */ /*@constant int NRESERVEDNAMES; @*/ # define NRESERVEDNAMES 201 /*@constant int NCPPNAMES@*/ # define NCPPNAMES 39 void checkCppName (uentry ue) { cstring name = uentry_observeRealName (ue); static ob_mstring cppNames[NCPPNAMES] = { "and", "and_eq", "asm", "bitand", "bitor", "bool", /* gasp: "bool", is special for splint */ "catch", "class", "compl", "const_class", "delete", "dynamic_cast", "false", "friend", "inline", "mutable", "namespace", "new", "not", "not_eq", "operator", "or", "or_eq", "overload", "private", "protected", "public", "reinterpret_cast", "static_cast", "template", "this", "throw", "true", "try", "typeid", "using", "virtual", "xor", "xor_eq" } ; if (cstring_isDefined (cstring_bsearch (name, &cppNames[0], NCPPNAMES))) { if (optgenerror2 (FLG_CPPNAMES, FLG_NAMECHECKS, message ("Name %s is a keyword or reserved word in C++", name), uentry_whereLast (ue))) { uentry_setHasNameError (ue); } } } void checkAnsiName (uentry ue) { bool hasError = FALSE; cstring name = uentry_observeRealName (ue); size_t length = cstring_length (name); char fchar = (length >= 1) ? cstring_firstChar (name) : '\0'; char schar = (length >= 2) ? cstring_secondChar (name) : '\0'; char tchar = (length >= 3) ? cstring_getChar (name, 3) : '\0'; char rchar = (length >= 4) ? cstring_getChar (name, 4) : '\0'; /* ** reservedNames ** taken from Linden, "Expert C Programming", p. 126-8. ** invariant: must be sorted (case-insensitive, lexicographically) ** must end with NULL */ static ob_mstring reservedNames[NRESERVEDNAMES] = { # include "reservedNames.nf" } ; # if 0 /* ** This code is for checking reservedNames.nf */ { int i = 0; char *lastname = NULL; char *name; while ((name = reservedNames[i]) != NULL) { llassertprint (lastname == NULL || strcmp (name, lastname) > 0, ("%s / %s", lastname, name)); lastname = name; i++; } nreservedNames = i - 1; } # endif if (fileloc_isSystemFile (uentry_whereLast (ue)) || fileloc_isBuiltin (uentry_whereLast (ue))) { return; /* no errors for system files */ } if (cstring_isDefined (cstring_bsearch (name, &reservedNames[0], NRESERVEDNAMES))) { hasError |= optgenerror2 (FLG_ISORESERVED, FLG_NAMECHECKS, message ("Name %s is reserved for the standard library", name), uentry_whereLast (ue)); } if (uentry_isFileStatic (ue) || uentry_isVisibleExternally (ue) || uentry_isAnyTag (ue) || context_getFlag (FLG_ISORESERVEDLOCAL)) { if (fchar == '_') { hasError |= optgenerror2 (FLG_ISORESERVED, FLG_NAMECHECKS, message ("Name %s is in the implementation name space (any identifier " "beginning with underscore)", name), uentry_whereLast (ue)); } } else { /* ** ISO 7.1.3: ** - All identifiers that begin with an underscore and either an uppercase ** letter or another underscore are always reserved for any use. */ if (fchar == '_' && (schar == '_' || isupper ((int) schar))) { hasError |= optgenerror2 (FLG_ISORESERVED, FLG_NAMECHECKS, message ("Name %s is in the implementation name space (any identifier " "beginning with underscore and either an uppercase letter or " "another underscore is always reserved for any use)", name), uentry_whereLast (ue)); } } /* ** 4.13.1 Errors ** ** Macros that begin with E and a digit or E and an uppercase letter ... */ if (fchar == 'E' && (isdigit ((int) schar) || isupper ((int) schar))) { hasError |= optgenerror2 (FLG_ISORESERVED, FLG_NAMECHECKS, message ("Name %s is reserved for future library extensions. " "Macros beginning with E and a digit or uppercase letter " "may be added to . (ISO99:7.26.3)", name), uentry_whereLast (ue)); } /* ** 4.13.3 Localization ** ** Macros that begin with LC_ and an uppercase letter ... */ if (length >= 4 && ((fchar == 'L') && (schar == 'C') && (tchar == '_')) && (isupper ((int) rchar))) { hasError |= optgenerror2 (FLG_ISORESERVED, FLG_NAMECHECKS, message ("Name %s is reserved for future library extensions. " "Macros beginning with \"LC_\" and an uppercase letter may " "be added to . (ISO99:7.26.5)", name), uentry_whereLast (ue)); } /* ** 4.13.5 Signal Handling ** ** Macros that begin with either SIG or SIG_ and an uppercase letter or... */ if (fchar == 'S' && schar == 'I' && tchar == 'G' && ((rchar == '_' && ((length >= 5 && isupper ((int) cstring_getChar (name, 5))))) || (isupper ((int) rchar)))) { hasError |= optgenerror2 (FLG_ISORESERVED, FLG_NAMECHECKS, message ("Name %s is reserved for future library extensions. " "Macros that begin with SIG and an uppercase letter or SIG_ " "and an uppercase letter may be added to " ". (ISO99:7.14)", name), uentry_whereLast (ue)); } /* ** evans - 2002-12-16: added this check (even though it is not required by ISO) */ if (fchar == 'S' && schar == 'A' && tchar == '_') { hasError |= optgenerror2 (FLG_ISORESERVED, FLG_NAMECHECKS, message ("Name %s may be defined as a macro by Linux library. " "It is not research by the ISO specification, but may produce conflicts on some systems.", name), uentry_whereLast (ue)); } if ((uentry_isVisibleExternally (ue) && !uentry_isAnyTag (ue)) || context_getFlag (FLG_ISORESERVEDLOCAL)) { flagcode flg; DPRINTF (("Okay...: %s", uentry_unparse (ue))); if (uentry_isVisibleExternally (ue) && !uentry_isAnyTag (ue)) { flg = FLG_ISORESERVED; } else { flg = FLG_ISORESERVEDLOCAL; } DPRINTF (("ue: %s", uentry_unparseFull (ue))); /* ** These restrictions only apply to identifiers with global linkage. */ /* ** 4.13.2 Character Handling ** ** Function names that begin with either "is" or "to" and a lowercase letter ... */ if (((fchar == 'i' && schar == 's') || (fchar == 't' && schar == 'o')) && (islower ((int) tchar))) { hasError |= optgenerror2 (flg, FLG_NAMECHECKS, message ("Name %s is reserved for future library extensions. " "Functions beginning with \"is\" or \"to\" and a lowercase " "letter may be added to . (ISO99:7.26.2)", name), uentry_whereLast (ue)); DPRINTF (("Externally visible: %s / %s", uentry_unparseFull (ue), bool_unparse (uentry_isVisibleExternally (ue)))); } /* ** 4.13.4 Mathematics ** ** The names of all existing functions declared in the header, ** suffixed with f or l... */ DPRINTF (("Check name: %s", name)); if ((cstring_lastChar (name) == 'f' || cstring_lastChar (name) == 'l') && (((length == 4) && ((cstring_equalPrefixLit (name, "cos") || cstring_equalPrefixLit (name, "sin") || cstring_equalPrefixLit (name, "tan") || cstring_equalPrefixLit (name, "exp") || cstring_equalPrefixLit (name, "log") || cstring_equalPrefixLit (name, "pow")))) || ((length == 5) && ((cstring_equalPrefixLit (name, "acos") || cstring_equalPrefixLit (name, "asin") || cstring_equalPrefixLit (name, "atan") || cstring_equalPrefixLit (name, "cosh") || cstring_equalPrefixLit (name, "sinh") || cstring_equalPrefixLit (name, "sqrt") || cstring_equalPrefixLit (name, "ceil") || cstring_equalPrefixLit (name, "fabs") || cstring_equalPrefixLit (name, "fmod") || cstring_equalPrefixLit (name, "tanh") || cstring_equalPrefixLit (name, "modf")))) || ((length == 6) && ((cstring_equalPrefixLit (name, "atan2") || cstring_equalPrefixLit (name, "floor") || cstring_equalPrefixLit (name, "frexp") || cstring_equalPrefixLit (name, "ldexp") || cstring_equalPrefixLit (name, "log10")))))) { hasError |= optgenerror2 (flg, FLG_NAMECHECKS, message ("Name %s is reserved for future library extensions. " "The names of all existing functions in suffixed " "with 'f' or 'l' may be added to . (ISO:7.26.1)", name), uentry_whereLast (ue)); } /* ** 4.13.6 Input/Output ** ** (nothing to check) */ /* ** 4.13.7 General Utilities ** ** Functions names that begin with str and a lowercase letter may be added to . */ if (fchar == 's' && schar == 't' && tchar == 'r' && (islower ((int) rchar))) { hasError |= optgenerror2 (flg, FLG_NAMECHECKS, message ("Name %s is reserved for future library extensions. " "Functions that begin with \"str\" and a lowercase letter " "may be added to or . (ISO99:7.26.9)", name), uentry_whereLast (ue)); } /* ** 4.13.8 String Handling ** ** Function names that begin with str, mem, or wcs and a lowercase letter ... ** ** (Note: already checked "str" above.) */ if (((fchar == 'm' && schar == 'e' && tchar == 'm') || (fchar == 'w' && schar == 'c' && tchar == 's')) && (islower ((int) rchar))) { hasError |= optgenerror2 (flg, FLG_NAMECHECKS, message ("Name %s is reserved for future library extensions. " "Functions that begin with \"mem\" or \"wcs\" and a " "lowercase letter may be added to . (ISO:7.26.11)", name), uentry_whereLast (ue)); } } else { DPRINTF (("Not checked: [%s] %s", bool_unparse (uentry_isVisibleExternally (ue)), uentry_unparseFull (ue))); } if (hasError) { uentry_setHasNameError (ue); } } void checkParamNames (uentry ue) { cstring fpfx = context_getString (FLG_DECLPARAMPREFIX); bool noformal = context_getFlag (FLG_DECLPARAMNAME); llassert (uentry_isFunction (ue)); if (cstring_isDefined (fpfx) || noformal) { uentryList params = uentry_getParams (ue); uentryList_elements (params, p) { if (uentry_hasName (p)) { if (noformal && !cstring_isDefined (fpfx)) { if (optgenerror2 (FLG_DECLPARAMNAME, FLG_NAMECHECKS, message ("Declaration parameter has name: %q", uentry_getName (p)), uentry_whereLast (p))) { uentry_setHasNameError (p); } } else { cstring pname = uentry_observeRealName (p); if (!cstring_equalPrefix (pname, fpfx)) { if (context_getFlag (FLG_NAMECHECKS)) { if (optgenerror2 (FLG_DECLPARAMPREFIX, FLG_NAMECHECKS, message ("Declaration parameter name %s does not begin " "with protoparamprefix (%s)", pname, fpfx), uentry_whereLast (p))) { uentry_setHasNameError (p); } } } } } } end_uentryList_elements ; } } /* not yet checked: POSIX p. 527 - applications should not declare any symbols that end _MAX */ splint-3.1.2.dfsg1/src/exprData.c0000644021234200000250000003616007445010135014153 0ustar fax/* ** exprData.c */ # include /* for isdigit */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" void exprData_freeShallow (/*@only@*/ exprData data, exprKind kind) { /*@-compdestroy@*/ if (data == exprData_undefined) { return; } switch (kind) { case XPR_INITBLOCK: case XPR_CALL: exprNode_freeShallow (data->call->fcn); exprNodeList_freeShallow (data->call->args); sfree (data->call); break; case XPR_COMMA: case XPR_FETCH: case XPR_OP: case XPR_ASSIGN: case XPR_IF: case XPR_WHILE: case XPR_DOWHILE: case XPR_STMTLIST: case XPR_SWITCH: case XPR_FOR: exprNode_freeShallow (data->op->a); exprNode_freeShallow (data->op->b); sfree (data->op); break; case XPR_STMT: case XPR_PREOP: case XPR_POSTOP: case XPR_PARENS: exprNode_freeShallow (data->uop->a); sfree (data->uop); break; case XPR_FTCASE: case XPR_CASE: case XPR_RETURN: case XPR_WHILEPRED: case XPR_BLOCK: exprNode_freeShallow (data->single); break; case XPR_CAST: case XPR_VAARG: exprNode_freeShallow (data->cast->exp); /* NO: qtype_free (data->cast->q); */ sfree (data->cast); break; case XPR_ITERCALL: exprNodeList_freeShallow (data->itercall->args); sfree (data->itercall); break; case XPR_ITER: exprNodeList_freeShallow (data->iter->args); exprNode_freeShallow (data->iter->body); sfree (data->iter); break; case XPR_FORPRED: case XPR_COND: case XPR_IFELSE: exprNode_freeShallow (data->triple->pred); exprNode_freeShallow (data->triple->tbranch); exprNode_freeShallow (data->triple->fbranch); sfree (data->triple); break; case XPR_INIT: exprNode_freeShallow (data->init->exp); /* NO: idDecl_free (data->init->id); */ sfree (data->init); break; case XPR_FACCESS: case XPR_ARROW: exprNode_freeShallow (data->field->rec); /* NO: cstring_free (data->field->field); */ sfree (data->field); break; case XPR_LABEL: case XPR_CONST: case XPR_VAR: break; case XPR_OFFSETOF: case XPR_ALIGNOFT: case XPR_ALIGNOF: case XPR_SIZEOFT: case XPR_SIZEOF: case XPR_GOTO: case XPR_CONTINUE: case XPR_BREAK: case XPR_NULLRETURN: case XPR_TOK: case XPR_FTDEFAULT: case XPR_DEFAULT: break; case XPR_STRINGLITERAL: case XPR_NUMLIT: llcontbuglit ("exprData_freeShallow: not shallow!"); break; case XPR_EMPTY: llcontbuglit ("XPR_EMPTY case!"); break; case XPR_BODY: llcontbuglit ("XPR_BODY case!"); break; case XPR_NODE: llcontbuglit ("XPR_NODE case!"); break; } sfree (data); /*@=compdestroy@*/ } void exprData_free (/*@only@*/ exprData data, exprKind kind) { if (data == exprData_undefined) { return; } switch (kind) { case XPR_INITBLOCK: case XPR_CALL: exprNode_free (data->call->fcn); exprNodeList_free (data->call->args); sfree (data->call); break; case XPR_LABEL: case XPR_CONST: case XPR_VAR: cstring_free (data->id); break; case XPR_COMMA: case XPR_FETCH: case XPR_OP: case XPR_ASSIGN: case XPR_IF: case XPR_WHILE: case XPR_DOWHILE: case XPR_STMTLIST: case XPR_SWITCH: case XPR_FOR: exprNode_free (data->op->a); exprNode_free (data->op->b); sfree (data->op); break; case XPR_STMT: case XPR_PREOP: case XPR_POSTOP: case XPR_PARENS: exprNode_free (data->uop->a); sfree (data->uop); break; case XPR_OFFSETOF: qtype_free (data->offset->q); cstringList_free (data->offset->field); sfree (data->offset); break; case XPR_ALIGNOFT: case XPR_SIZEOFT: qtype_free (data->qt); break; case XPR_FTCASE: case XPR_CASE: case XPR_SIZEOF: case XPR_ALIGNOF: case XPR_RETURN: case XPR_WHILEPRED: case XPR_BLOCK: exprNode_free (data->single); break; case XPR_CAST: case XPR_VAARG: exprNode_free (data->cast->exp); qtype_free (data->cast->q); sfree (data->cast); break; case XPR_ITERCALL: exprNodeList_free (data->itercall->args); sfree (data->itercall); break; case XPR_ITER: exprNodeList_free (data->iter->args); exprNode_free (data->iter->body); sfree (data->iter); break; case XPR_FORPRED: case XPR_COND: case XPR_IFELSE: exprNode_free (data->triple->pred); exprNode_free (data->triple->tbranch); exprNode_free (data->triple->fbranch); sfree (data->triple); break; case XPR_GOTO: case XPR_STRINGLITERAL: case XPR_NUMLIT: cstring_free (data->literal); break; case XPR_CONTINUE: case XPR_BREAK: case XPR_NULLRETURN: break; case XPR_FTDEFAULT: case XPR_DEFAULT: case XPR_TOK: break; case XPR_INIT: exprNode_free (data->init->exp); idDecl_free (data->init->id); sfree (data->init); break; case XPR_FACCESS: case XPR_ARROW: exprNode_free (data->field->rec); cstring_free (data->field->field); sfree (data->field); break; case XPR_EMPTY: llcontbuglit ("XPR_EMPTY case!"); break; case XPR_BODY: llcontbuglit ("XPR_BODY case!"); break; case XPR_NODE: llcontbuglit ("XPR_NODE case!"); break; } sfree (data); } /*@exposed@*/ exprNode exprData_getInitNode (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->init->exp); } /*@exposed@*/ idDecl exprData_getInitId (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->init->id); } /*@exposed@*/ exprNode exprData_getOpA (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->op->a); } /*@exposed@*/ exprNode exprData_getOpB (exprData data) /*@*/ { llassertretval (data != exprData_undefined, exprNode_undefined); return (data->op->b); } /*@observer@*/ lltok exprData_getOpTok (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->op->op); } /*@exposed@*/ exprNode exprData_getPairA (exprData data) /*@*/ { llassertretval (data != exprData_undefined, exprNode_undefined); return (data->pair->a); } /*@exposed@*/ exprNode exprData_getPairB (exprData data) /*@*/ { llassertretval (data != exprData_undefined, exprNode_undefined); return (data->pair->b); } /*@exposed@*/ uentry exprData_getIterSname (exprData data) /*@*/ { llassertretval (data != exprData_undefined, uentry_undefined); return (data->iter->sname); } /*@exposed@*/ exprNodeList exprData_getIterAlist (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->iter->args); } /*@exposed@*/ exprNode exprData_getIterBody (exprData data) /*@*/ { llassertretval (data != exprData_undefined, exprNode_undefined); return (data->iter->body); } /*@exposed@*/ uentry exprData_getIterEname (exprData data) /*@*/ { llassertretval (data != exprData_undefined, uentry_undefined); return (data->iter->ename); } /*@exposed@*/ exprNode exprData_getFcn (exprData data) /*@*/ { llassertretval (data != exprData_undefined, exprNode_undefined); return (data->call->fcn); } /*@exposed@*/ exprNodeList exprData_getArgs (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->call->args); } /*@exposed@*/ exprNode exprData_getTriplePred (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->triple->pred); } /*@exposed@*/ uentry exprData_getIterCallIter (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->itercall->iter); } /*@exposed@*/ exprNodeList exprData_getIterCallArgs (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->itercall->args); } /*@exposed@*/ exprNode exprData_getTripleInit (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->triple->pred); } /*@exposed@*/ exprNode exprData_getTripleTrue (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->triple->tbranch); } /*@exposed@*/ exprNode exprData_getTripleTest (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->triple->tbranch); } /*@exposed@*/ exprNode exprData_getTripleFalse (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->triple->fbranch); } /*@exposed@*/ exprNode exprData_getTripleInc (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->triple->fbranch); } /*@exposed@*/ exprNode exprData_getFieldNode (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->field->rec); } /*@exposed@*/ cstring exprData_getFieldName (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->field->field); } /*@observer@*/ lltok exprData_getUopTok (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->uop->op); } /*@exposed@*/ exprNode exprData_getUopNode (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->uop->a); } /*@exposed@*/ exprNode exprData_getCastNode (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->cast->exp); } /*@observer@*/ lltok exprData_getCastTok (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->cast->tok); } /*@exposed@*/ qtype exprData_getCastType (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->cast->q); } /*@exposed@*/ cstring exprData_getLiteral (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->literal); } /*@exposed@*/ cstring exprData_getId (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->id); } /*@observer@*/ lltok exprData_getTok (exprData data) /*@*/ { llassert (data != exprData_undefined); return data->tok; } /*@exposed@*/ qtype exprData_getType (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->qt); } /*@exposed@*/ qtype exprData_getOffsetType (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->offset->q); } /*@exposed@*/ cstringList exprData_getOffsetName (exprData data) /*@*/ { llassert (data != exprData_undefined); return (data->offset->field); } /*@exposed@*/ exprNode exprData_getSingle (exprData data) /*@*/ { exprNode ret; llassert (data != exprData_undefined); ret = data->single; return (ret); } /*@only@*/ exprData exprData_makeOp (/*@keep@*/ exprNode a, /*@keep@*/ exprNode b, /*@keep@*/ lltok op) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->op = (exprOp) dmalloc (sizeof (*ed->op)); ed->op->a = a; ed->op->b = b; ed->op->op = op; return ed; } /*@only@*/ exprData exprData_makeUop (/*@keep@*/ exprNode a, /*@keep@*/ lltok op) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->uop = (exprUop) dmalloc (sizeof (*ed->uop)); ed->uop->a = a; ed->uop->op = op; return ed; } /*@only@*/ exprData exprData_makeSingle (/*@only@*/ exprNode a) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->single = a; return ed; } /*@only@*/ exprData exprData_makeTok (/*@only@*/ lltok op) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->tok = op; return ed; } /*@only@*/ exprData exprData_makeIter (/*@exposed@*/ uentry sname, /*@keep@*/ exprNodeList args, /*@keep@*/ exprNode body, /*@exposed@*/ uentry ename) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->iter = (exprIter) dmalloc (sizeof (*ed->iter)); ed->iter->sname = uentry_isVar (sname) ? uentry_copy (sname) : sname; ed->iter->args = args; ed->iter->body = body; ed->iter->ename = uentry_isVar (ename) ? uentry_copy (ename) : ename; return ed; } /*@only@*/ exprData exprData_makeTriple (/*@keep@*/ exprNode pred, /*@keep@*/ exprNode tbranch, /*@keep@*/ exprNode fbranch) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->triple = (exprTriple) dmalloc (sizeof (*ed->triple)); ed->triple->pred = pred; ed->triple->tbranch = tbranch; ed->triple->fbranch = fbranch; return ed; } /*@only@*/ exprData exprData_makeCall (/*@keep@*/ exprNode fcn, /*@keep@*/ exprNodeList args) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->call = (exprCall) dmalloc (sizeof (*ed->call)); ed->call->fcn = fcn; ed->call->args = args; return ed; } /*@only@*/ exprData exprData_makeIterCall (/*@dependent@*/ uentry iter, /*@keep@*/ exprNodeList args) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->itercall = (exprIterCall) dmalloc (sizeof (*ed->itercall)); ed->itercall->iter = uentry_isVar (iter) ? uentry_copy (iter) : iter; ed->itercall->args = args; return ed; } /*@only@*/ exprData exprData_makeField (/*@keep@*/ exprNode rec, /*@keep@*/ cstring field) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->field = (exprField) dmalloc (sizeof (*ed->field)); ed->field->rec = rec; ed->field->field = field; return ed; } /*@only@*/ exprData exprData_makeOffsetof (/*@only@*/ qtype q, /*@keep@*/ cstringList s) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->offset = (exprOffsetof) dmalloc (sizeof (*ed->offset)); ed->offset->q = q; ed->offset->field = s; return ed; } /*@only@*/ exprData exprData_makeSizeofType (/*@only@*/ qtype q) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->qt = q; return ed; } /*@only@*/ exprData exprData_makeCast (/*@keep@*/ lltok tok, /*@keep@*/ exprNode e, /*@only@*/ qtype q) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->cast = (exprCast) dmalloc (sizeof (*ed->cast)); ed->cast->tok = tok; ed->cast->exp = e; ed->cast->q = q; return ed; } /*@only@*/ exprData exprData_makeInit (/*@keep@*/ idDecl t, /*@keep@*/ exprNode e) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->init = (exprInit) dmalloc (sizeof (*ed->init)); ed->init->exp = e; ed->init->id = t; return ed; } /*@only@*/ exprData exprData_makeCond (/*@keep@*/ exprNode pred, /*@keep@*/ exprNode ifclause, /*@keep@*/ exprNode elseclause) { return exprData_makeTriple (pred, ifclause, elseclause); } /*@only@*/ exprData exprData_makeFor (/*@keep@*/ exprNode init, /*@keep@*/ exprNode pred, /*@keep@*/ exprNode inc) { return exprData_makeTriple (init, pred, inc); } /*@only@*/ exprData exprData_makeLiteral (/*@only@*/ cstring s) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->literal = s; return ed; } /*@only@*/ exprData exprData_makeId (/*@temp@*/ uentry id) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->id = cstring_copy (uentry_rawName (id)); return ed; } /*@only@*/ exprData exprData_makePair (/*@keep@*/ exprNode a, /*@keep@*/ exprNode b) { exprData ed = (exprData) dmalloc (sizeof (*ed)); ed->pair = (exprPair) dmalloc (sizeof (*ed->pair)); ed->pair->a = a; ed->pair->b = b; return ed; } splint-3.1.2.dfsg1/src/cstring.c0000644021234200000250000005066607650622512014071 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cstring.c */ /* * Herbert 06/12/2000 * - use drive spec specials with OS2 like with WIN32 * - cstring_replaceAll () needed in cpplib.c */ # include "splintMacros.nf" # include "basic.h" # include "osd.h" /*@only@*/ /*@notnull@*/ cstring cstring_newEmpty (void) { return (cstring_create (0)); } char cstring_firstChar (cstring s) { llassert (cstring_isDefined (s)); llassert (cstring_length (s) > 0); return (s[0]); } char cstring_getChar (cstring s, size_t n) { size_t length = cstring_length (s); llassert (cstring_isDefined (s)); llassert (n >= 1 && n <= length); return (s[n - 1]); } cstring cstring_suffix (cstring s, size_t n) { llassert (cstring_isDefined (s)); llassert (n <= cstring_length (s)); return (s + n); } cstring cstring_prefix (cstring s, size_t n) /*@requires maxRead(s) >= n /\ maxSet(s) >= n @*/ /*@ensures maxRead(result) == n /\ maxSet(result) == n @*/ { cstring t; char c; llassert (cstring_isDefined (s)); llassert (n <= cstring_length (s)); c = *(s + n); /*@-mods@*/ /* The modifications cancel out. */ *(s + n) = '\0'; t = cstring_copy (s); *(s + n) = c; /*@=mods@*/ return t; } /* effects If s = [0-9]*, returns s as an int. ** else returns -1. */ int cstring_toPosInt (cstring s) { int val = 0; cstring_chars (s, c) { if (isdigit ((unsigned char) c)) { val = (val * 10) + (int)(c - '0'); } else { return -1; } } end_cstring_chars ; return val; } cstring cstring_afterChar (cstring s, char c) { llassert (cstring_isDefined (s)); return strchr (s, c); } cstring cstring_beforeChar (cstring s, char c) { if (cstring_isDefined (s)) { char *cp = strchr (s, c); if (cp != NULL) { cstring ret; /*@-mods@*/ *cp = '\0'; ret = cstring_copy (s); *cp = c; /*@=mods@*/ /* modification is undone */ return ret; } } return cstring_undefined; } void cstring_setChar (cstring s, size_t n, char c) /*@requires maxRead(s) >= (n - 1) /\ maxSet(s) >= (n - 1) @*/ { llassert (cstring_isDefined (s)); llassert (n > 0 && n <= cstring_length (s)); s[n - 1] = c; } char cstring_lastChar (cstring s) { size_t length; llassert (cstring_isDefined (s)); length = cstring_length (s); llassert (length > 0); return (s[length - 1]); } /*@only@*/ cstring cstring_copy (cstring s) /*@ensures maxSet(result) == maxRead(s) /\ maxRead(result) == maxRead(s) @*/ { if (cstring_isDefined (s)) { return (mstring_copy (s)); } else { return cstring_undefined; } } /*@only@*/ cstring cstring_copyLength (char *s, size_t len) /*@requires maxSet(s) >= (len - 1) @*/ { char *res = mstring_create (len + 1); strncpy (res, s, len); res[len] = '\0'; return res; } bool cstring_containsChar (cstring c, char ch) { if (cstring_isDefined (c)) { return (strchr (c, ch) != NULL); } else { return FALSE; } } /* ** Replaces all occurances of old in s with new. */ void cstring_replaceAll (cstring s, char old, char snew) { llassert (old != snew); if (cstring_isDefined (s)) { char *sp = strchr (s, old); while (sp != NULL) { *sp = snew; sp = strchr (sp, old); } } } void cstring_replaceLit (/*@unique@*/ cstring s, char *old, char *snew) /*@requires maxRead(snew) >= 0 /\ maxRead(old) >= 0 /\ maxRead(old) >= maxRead(snew) @*/ { llassert (strlen (old) >= strlen (snew)); if (cstring_isDefined (s)) { char *sp = strstr (s, old); while (sp != NULL) { int lendiff = size_toInt (strlen (old) - strlen (snew)); char *tsnew = snew; llassert (lendiff >= 0); while (*tsnew != '\0') { llassert (*sp != '\0'); *sp++ = *tsnew++; } if (lendiff > 0) { while (*(sp + lendiff) != '\0') { *sp = *(sp + lendiff); sp++; } *sp = '\0'; } sp = strstr (s, old); } } } /* ** removes all chars in clist from s */ void cstring_stripChars (cstring s, const char *clist) { if (cstring_isDefined (s)) { int i; size_t size = cstring_length (s); for (i = 0; i < size_toInt (size); i++) { char c = s[i]; if (strchr (clist, c) != NULL) { /* strip this char */ int j; size--; for (j = i; j < size_toInt (size); j++) { s[j] = s[j+1]; } s[size] = '\0'; i--; } } } } bool cstring_contains (/*@unique@*/ cstring c, cstring sub) { if (cstring_isDefined (c)) { llassert (cstring_isDefined (sub)); return (strstr (c, sub) != NULL); } else { return FALSE; } } static char lookLike (char c) /*@*/ { if (c == 'I' || c == 'l') { return '1'; } else if (c == 'O' || c == 'o') { return '0'; } else if (c == 'Z') { return '2'; } else if (c == 'S') { return '5'; } else { return c; } } cmpcode cstring_genericEqual (cstring s, cstring t, size_t nchars, bool caseinsensitive, bool lookalike) /*@requires maxRead(s) >= nchars /\ maxRead(t) >= nchars @*/ { if (s == t) return CGE_SAME; else if (cstring_isUndefined (s)) { return cstring_isEmpty (t) ? CGE_SAME : CGE_DISTINCT; } else if (cstring_isUndefined (t)) { return cstring_isEmpty (s) ? CGE_SAME : CGE_DISTINCT; } else { int i = 0; bool diffcase = FALSE; bool difflookalike = FALSE; while (*s != '\0') { if (nchars > 0 && i >= size_toInt (nchars)) { break; } if (*t == *s) { ; /* no difference */ } else if (caseinsensitive && (toupper ((int) *t) == toupper ((int) *s))) { diffcase = TRUE; } else if (lookalike && (lookLike (*t) == lookLike (*s))) { difflookalike = TRUE; } else { return CGE_DISTINCT; } i++; s++; t++; } if (*s == '\0' && *t != '\0') { return CGE_DISTINCT; } if (diffcase) { return CGE_CASE; } else if (difflookalike) { return CGE_LOOKALIKE; } else { return CGE_SAME; } } } bool cstring_equalFree (/*@only@*/ cstring c1, /*@only@*/ cstring c2) { bool res = cstring_equal (c1, c2); cstring_free (c1); cstring_free (c2); return res; } bool cstring_equal (cstring c1, cstring c2) { if (c1 == c2) return TRUE; else if (cstring_isUndefined (c1)) return cstring_isEmpty (c2); else if (cstring_isUndefined (c2)) return cstring_isEmpty (c1); else return (strcmp (c1, c2) == 0); } bool cstring_equalLen (cstring c1, cstring c2, size_t len) { if (c1 == c2) return TRUE; else if (cstring_isUndefined (c1)) return cstring_isEmpty (c2); else if (cstring_isUndefined (c2)) return cstring_isEmpty (c1); else return (strncmp (c1, c2, len) == 0); } bool cstring_equalCaseInsensitive (cstring c1, cstring c2) { if (c1 == c2) return TRUE; else if (cstring_isUndefined (c1)) return cstring_isEmpty (c2); else if (cstring_isUndefined (c2)) return cstring_isEmpty (c1); else return (cstring_genericEqual (c1, c2, 0, TRUE, FALSE) != CGE_DISTINCT); } bool cstring_equalLenCaseInsensitive (cstring c1, cstring c2, size_t len) { if (c1 == c2) return TRUE; else if (cstring_isUndefined (c1)) return cstring_isEmpty (c2); else if (cstring_isUndefined (c2)) return cstring_isEmpty (c1); else return (cstring_genericEqual (c1, c2, len, TRUE, FALSE) != CGE_DISTINCT); } bool cstring_equalPrefix (cstring c1, cstring c2) { llassert (c2 != NULL); if (cstring_isUndefined (c1)) { return (strlen (c2) == 0); } return (strncmp (c1, c2, strlen (c2)) == 0); } bool cstring_equalPrefixLit (cstring c1, const char *c2) { llassert (c2 != NULL); if (cstring_isUndefined (c1)) { return (strlen (c2) == 0); } return (strncmp (c1, c2, strlen (c2)) == 0); } int cstring_xcompare (cstring *c1, cstring *c2) { return (cstring_compare (*c1, *c2)); } int cstring_compare (cstring c1, cstring c2) { int res; if (c1 == c2) { res = 0; } else if (cstring_isUndefined (c1)) { if (cstring_isEmpty (c2)) { res = 0; } else { res = 1; } } else if (cstring_isUndefined (c2)) { if (cstring_isEmpty (c1)) { res = 0; } else { res = -1; } } else { res = strcmp (c1, c2); } return (res); } void cstring_markOwned (/*@owned@*/ cstring s) { sfreeEventually (s); } void cstring_free (/*@only@*/ cstring s) { if (cstring_isDefined (s)) { /*drl 2/3/2002*/ s[0] = '\0'; sfree (s); } } cstring cstring_fromChars (/*@exposed@*/ const char *cp) { return (cstring) cp; } /*@exposed@*/ char *cstring_toCharsSafe (cstring s) { static /*@only@*/ cstring emptystring = cstring_undefined; if (cstring_isDefined (s)) { return (char *) s; } else { if (cstring_isUndefined (emptystring)) { emptystring = cstring_newEmpty (); } return emptystring; } } size_t cstring_length (cstring s) { if (cstring_isDefined (s)) { return strlen (s); } return 0; } cstring cstring_capitalize (cstring s) /*@requires maxSet(s) >= 0 @*/ { if (!cstring_isEmpty (s)) { cstring ret = cstring_copy (s); cstring_setChar (ret, 1, (char) toupper ((int) cstring_firstChar (ret))); return ret; } return cstring_undefined; } cstring cstring_capitalizeFree (cstring s) /*@requires maxSet(s) >= 0 /\ maxRead(s) >= 0 @*/ { if (!cstring_isEmpty (s)) { cstring_setChar (s, 1, (char) toupper ((int) cstring_firstChar (s))); return s; } return s; } cstring cstring_clip (cstring s, size_t len) { if (cstring_isUndefined (s) || cstring_length (s) <= len) { ; } else { llassert (s != NULL); *(s + len) = '\0'; } return s; } /*@only@*/ cstring cstring_elide (cstring s, size_t len) { if (cstring_isUndefined (s) || cstring_length (s) <= len) { return cstring_copy (s); } else { cstring sc = cstring_create (len); strncpy (sc, s, len); *(sc + len - 1) = '\0'; *(sc + len - 2) = '.'; *(sc + len - 3) = '.'; *(sc + len - 4) = '.'; return sc; } } /*@only@*/ cstring cstring_fill (cstring s, size_t n) /*@requires n >= 0 @*/ { cstring t = cstring_create (n + 1); cstring ot = t; size_t len = cstring_length (s); size_t i; if (len > n) { for (i = 0; i < n; i++) { *t++ = *s++; } *t = '\0'; } else { for (i = 0; i < len; i++) { *t++ = *s++; } for (i = 0; i < n - len; i++) { *t++ = ' '; } *t = '\0'; } return ot; } cstring cstring_downcase (cstring s) { if (cstring_isDefined (s)) { cstring t = cstring_create (strlen (s) + 1); cstring ot = t; char c; while ((c = *s) != '\0') { if (c >= 'A' && c <= 'Z') { c = c - 'A' + 'a'; } *t++ = c; s++; } *t = '\0'; return ot; } else { return cstring_undefined; } } /*@notnull@*/ cstring cstring_appendChar (/*@only@*/ cstring s1, char c) { size_t l = cstring_length (s1); char *s; s = (char *) dmalloc (sizeof (*s) * (l + 2)); if (cstring_isDefined (s1)) { strcpy (s, s1); *(s + l) = c; *(s + l + 1) = '\0'; sfree (s1); } else { *(s) = c; *(s + 1) = '\0'; } return s; } /*@only@*/ cstring cstring_concatFree (cstring s, cstring t) { cstring res = cstring_concat (s, t); cstring_free (s); cstring_free (t); return res; } /*@only@*/ cstring cstring_concatFree1 (cstring s, cstring t) { cstring res = cstring_concat (s, t); cstring_free (s); return res; } /*@only@*/ cstring cstring_concatChars (cstring s, char *t) { cstring res = cstring_concat (s, cstring_fromChars (t)); cstring_free (s); return res; } /*@only@*/ cstring cstring_concatLength (cstring s1, char *s2, size_t len) /*@requires maxSet(s2) >= (len - 1) @*/ { cstring tmp = cstring_copyLength (s2, len); cstring res = cstring_concat (s1, tmp); cstring_free (tmp); cstring_free (s1); return res; } /*@only@*/ cstring cstring_concat (cstring s, cstring t) /*@requires maxSet(s) >= 0 @*/ { char *ret = mstring_create (cstring_length (s) + cstring_length (t)); if (cstring_isDefined (s)) { strcpy (ret, s); } if (cstring_isDefined (t)) { strcat (ret, t); } return ret; } /*@notnull@*/ /*@only@*/ cstring cstring_prependCharO (char c, /*@only@*/ cstring s1) { cstring res = cstring_prependChar (c, s1); cstring_free (s1); return (res); } /*@notnull@*/ /*@only@*/ cstring cstring_prependChar (char c, /*@temp@*/ cstring s1) { size_t l = cstring_length (s1); char *s = (char *) dmalloc (sizeof (*s) * (l + 2)); *(s) = c; if (cstring_isDefined (s1)) { /*@-mayaliasunique@*/ strcpy (s + 1, s1); /*@=mayaliasunique@*/ } *(s + l + 1) = '\0'; return s; } bool cstring_hasNonAlphaNumBar (cstring s) { int c; if (cstring_isUndefined (s)) return FALSE; while ((c = (int) *s) != (int) '\0') { if ((isalnum (c) == 0) && (c != (int) '_') && (c != (int) '.') && (c != (int) CONNECTCHAR)) { return TRUE; } s++; } return FALSE; } /*@only@*/ /*@notnull@*/ cstring cstring_create (size_t n) { char *s = dmalloc (sizeof (*s) * (n + 1)); *s = '\0'; return s; } /*@only@*/ /*@notnull@*/ cstring cstring_copySegment (cstring s, size_t findex, size_t tindex) { cstring res = cstring_create (tindex - findex + 1); llassert (cstring_isDefined (s)); llassert (cstring_length (s) > tindex); strncpy (res, (s + findex), size_fromInt (size_toInt (tindex - findex) + 1)); return res; } lsymbol cstring_toSymbol (cstring s) { lsymbol res = lsymbol_fromString (s); cstring_free (s); return res; } cstring cstring_bsearch (cstring key, char **table, int nentries) { if (cstring_isDefined (key)) { int low = 0; int high = nentries; int mid = (high + low + 1) / 2; int last = -1; cstring res = cstring_undefined; while (low <= high && mid < nentries) { int cmp; llassert (mid != last); llassert (mid >= 0 && mid < nentries); cmp = cstring_compare (key, table[mid]); if (cmp == 0) { res = table[mid]; break; } else if (cmp < 0) /* key is before table[mid] */ { high = mid - 1; } else /* key of after table[mid] */ { low = mid + 1; } last = mid; mid = (high + low + 1) / 2; } if (mid != 0 && mid < nentries - 1) { llassert (cstring_compare (key, table[mid - 1]) > 0); llassert (cstring_compare (key, table[mid + 1]) < 0); } return res; } return cstring_undefined; } extern /*@observer@*/ cstring cstring_advanceWhiteSpace (cstring s) { if (cstring_isDefined (s)) { char *t = s; while (*t != '\0' && isspace ((int) *t)) { t++; } return t; } return cstring_undefined; } /* changes strings like "sdf" "sdfsd" into "sdfsdfsd"*/ /* This function understands that "sdf\" \"sdfsdf" is okay*/ static mstring doMergeString (cstring s) { char *ptr; mstring ret; char * retPtr; bool escape; llassert(cstring_isDefined (s)); ret = mstring_create (cstring_length(s) ); ptr = s; retPtr = ret; /* llassert(*ptr == '\"'); *retPtr = *ptr; retPtr++; ptr++; */ while (*ptr != '\0') { escape = FALSE; if (*ptr == '\\') { *retPtr = *ptr; if (!escape) escape = TRUE; else /* case of escaped \ ('\\') */ escape = FALSE; } else if ( (*ptr == '\"') && (!escape) ) { while ( (ptr[1] != '\"') && (ptr[1] != '\0') ) { ptr++; } if (ptr[1] == '\0') { llassert(*ptr == '\"'); *retPtr = '\"'; retPtr++; *retPtr = '\0'; BADEXIT; /*@notreached@*/ return ret; } else { ptr++; } } else { *retPtr = *ptr; } retPtr++; ptr++; }/* end while */ *retPtr = '\0'; return ret; } static mstring doExpandEscapes (cstring s, /*@out@*/ size_t *len) { char *ptr; mstring ret; char * retPtr; llassert(cstring_isDefined (s)); ret = mstring_create (cstring_length(s)); ptr = s; retPtr = ret; while (*ptr != '\0') { if (*ptr != '\\') { *retPtr = *ptr; retPtr++; ptr++; continue; } if (*ptr == '\\') { ptr++; if (*ptr == '\0') { /*not a legal escape sequence but try to handle it in a sesible way*/ *retPtr = '\\'; retPtr++; } /* Handle Octal escapes */ else if (*ptr >= '0' && *ptr <= '9' ) { int total; total = (int)(*ptr - '0'); ptr++; /*octal can only be 3 characters long */ if (*ptr != '\0' && (*ptr >= '0' && *ptr <= '9' ) ) { total *= 8; ptr++; if (*ptr != '\0' && (*ptr >= '0' && *ptr <= '9' ) ) { total *= 8; total += (int) (*ptr - '0'); ptr++; } } *retPtr = (char) total; retPtr++; } else if (*ptr == 'x') { int total; total = 0; ptr++; if (!(*ptr != '\0' && ( (*ptr >= '0' && *ptr <= '9' ) || (toupper(*ptr) >= (int)('A') && toupper(*ptr) <= (int)('F') ) ) )) { total = (int)'x'; } else { while (*ptr != '\0' && ( (*ptr >= '0' && *ptr <= '9' ) || (toupper(*ptr) >= ((int)('A')) && toupper(*ptr) <= ((int)'F') ) ) ) { total *= 16; if (*ptr >= '0' && *ptr <= '9' ) total += (int)(*ptr - '0'); else total += ( (toupper(*ptr) - 'A') + 10); ptr++; } } *retPtr = (char) total; retPtr++; } else { switch ( *ptr ) { case 'a': *retPtr = '\a'; retPtr++; /*@switchbreak@*/ break; case 'b': *retPtr = '\b'; retPtr++; /*@switchbreak@*/ break; case 'f': *retPtr = '\f'; retPtr++; /*@switchbreak@*/ break; case 'n': *retPtr = '\n'; retPtr++; /*@switchbreak@*/ break; case 'r': *retPtr = '\r'; retPtr++; /*@switchbreak@*/ break; case 't': *retPtr = '\t'; retPtr++; /*@switchbreak@*/ break; /* ' " ? \ */ /* we assume invalid sequences are handled somewhere else so we handle an invalid sequence of the form \char by replacing it with char (this is what gcc does) the C standard says a diagnostic is required..*/ default: *retPtr = *ptr; retPtr++; } ptr++; } }/*end outer if*/ }/*end while */ /* add the null character */ *retPtr = '\0'; llassert( (retPtr-ret) >= 0 ); *len = (size_t)(retPtr - ret); return ret; } /*this function is like sctring_expandEscapses */ mstring cstring_expandEscapes (cstring s) { size_t len; mstring ret; ret = doExpandEscapes (s, &len); return ret; } size_t cstring_lengthExpandEscapes (cstring s) { size_t len; mstring tmpStr, tmpStr2; tmpStr = doMergeString (s); tmpStr2 = doExpandEscapes (tmpStr, &len); cstring_free(tmpStr); cstring_free(tmpStr2); return len; } cstring cstring_replaceChar(/*@returned@*/ cstring c, char oldChar, char newChar) { char *ptr; llassert(oldChar != '\0'); if (cstring_isUndefined(c) ) { llcontbug(cstring_makeLiteral("cstring_replaceChar called with undefined string")); return c; } ptr = c; while (*ptr != '\0') { if (*ptr == oldChar) *ptr = newChar; ptr++; } return c; } splint-3.1.2.dfsg1/src/fileloc.c0000644021234200000250000004514707706100770014032 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** fileloc.c */ /* * Modified by Herbert 04/19/97: * - added new include file portab.h (now in osd.h) * - added new private function fileloc_filenameForCpp() to handle * filenames belonging to "#line" statements for OS/2 and MSDOS. It * gets called by fileloc_lineMarker() and fileloc_previousLineMarker() * instead of fileloc_unparseFilename(). */ # include "splintMacros.nf" # include "basic.h" # include "osd.h" static /*@only@*/ fileloc fileloc_createPrim (flkind p_kind, fileId p_fid, int p_line, int p_col) /*@*/ ; /* ** builtin locs are never free'd */ static /*@owned@*/ fileloc s_builtinLoc = fileloc_undefined; static /*@owned@*/ fileloc s_externalLoc = fileloc_undefined; void fileloc_destroyMod () { if (fileloc_isDefined (s_builtinLoc)) { sfree (s_builtinLoc); s_builtinLoc = fileloc_undefined; } if (fileloc_isDefined (s_externalLoc)) { sfree (s_externalLoc); s_externalLoc = fileloc_undefined; } } static flkind fileId_kind (fileId s) { cstring fname = fileTable_rootFileName (s); if (fileLib_isLCLFile (fname)) { return (FL_SPEC); } else if (cstring_equalPrefix (fname, cstring_makeLiteralTemp (SYSTEM_LIBDIR))) { return (FL_STDHDR); } else { return (FL_NORMAL); } } fileloc fileloc_decColumn (fileloc f, int x) { fileloc ret = fileloc_copy (f); llassert (x >= 0); if (x > 0 && fileloc_isDefined (ret)) { llassertprint (ret->column > x, ("decColumn %s: %d", fileloc_unparse (f), x)); ret->column -= x; } return ret; } fileloc fileloc_noColumn (fileloc f) { if (fileloc_isDefined (f)) { fileloc ret = fileloc_copy (f); if (fileloc_isDefined (ret)) { ret->column = 0; } return ret; } else { return fileloc_undefined; } } void fileloc_subColumn (fileloc f, int x) { if (x > 0 && fileloc_isDefined (f)) { llassert (f->column > x); f->column -= x; } } fileloc fileloc_copy (fileloc f) { if (fileloc_isDefined (f)) { if (fileloc_isBuiltin (f) || fileloc_isExternal (f)) { /* ** Legitimate (spurious) errors reported since no copy ** is made. */ /*@i3@*/ return f; /* No copy is necessary. */ } else { return (fileloc_createPrim (f->kind, f->fid, f->lineno, f->column)); } } else { return fileloc_undefined; } } fileloc fileloc_update (/*@only@*/ fileloc old, fileloc fnew) { if (fileloc_isUndefined (fnew)) { fileloc_free (old); return fileloc_undefined; } else if (fileloc_isUndefined (old) || fileloc_isBuiltin (old) || fileloc_isExternal (old)) { return (fileloc_copy (fnew)); } else { old->kind = fnew->kind; old->fid = fnew->fid; old->lineno = fnew->lineno; old->column = fnew->column; return old; } } fileloc fileloc_updateFileId (/*@only@*/ fileloc old, fileId s) { if (fileloc_isUndefined (old) || fileloc_isBuiltin (old) || fileloc_isExternal (old)) { return (fileloc_create (s, 1, 1)); } else { old->kind = fileId_kind (s); old->fid = s; old->lineno = 1; old->column = 1; return old; } } void fileloc_free (/*@only@*/ fileloc f) { if (fileloc_isDefined (f)) { if (f != g_currentloc) { if (fileloc_isBuiltin (f) || fileloc_isExternal (f)) { ; /* don't free */ } else { sfree (f); /*@-branchstate@*/ } } else { ; /* Don't free g_currentloc ever! */ } /*@=branchstate@*/ } } void fileloc_reallyFree (/*@only@*/ fileloc f) { if (fileloc_isDefined (f)) { if (fileloc_isBuiltin (f) || fileloc_isExternal (f)) { ; /* don't free */ } else { sfree (f); /*@-branchstate@*/ } /*@=branchstate@*/ } } cstring fileloc_getBase (fileloc f) { llassert (fileloc_isDefined (f)); return (fileTable_fileNameBase (f->fid)); } bool fileloc_equal (fileloc f1, fileloc f2) { return ((f1 == f2) || (fileloc_isDefined (f1) && fileloc_isDefined (f2) && ((f1->column == f2->column) && (f1->lineno == f2->lineno) && fileloc_sameFile (f1, f2)))); } int fileloc_compare (fileloc f1, fileloc f2) { if (fileloc_isUndefined (f1)) { if (fileloc_isUndefined (f2)) return 0; return -1; } if (fileloc_isUndefined (f2)) return 1; /*@access fileId@*/ INTCOMPARERETURN (f1->fid, f2->fid); /*@noaccess fileId@*/ /* drl 8-11-01 fix what I think is a bug lineno should more important than column number*/ INTCOMPARERETURN (f1->lineno, f2->lineno); INTCOMPARERETURN (f1->column, f2->column); return 0; } bool fileloc_withinLines (fileloc f1, fileloc f2, int n) { return (fileloc_isDefined (f1) && fileloc_isDefined (f2) && ((f2->lineno <= f1->lineno + n) && (f2->lineno >= f1->lineno) && fileloc_sameFile (f1, f2))); } bool fileloc_lessthan (fileloc f1, fileloc f2) { /*@access fileId*/ return ((fileloc_isDefined (f1) && fileloc_isDefined (f2)) && ((f1->fid < f2->fid) || ((f1->fid == f2->fid) && ((f1->lineno < f2->lineno) || ((f1->lineno == f2->lineno) && (f1->column < f2->column)))))); /*@noaccess fileId*/ } /* ** returns true if f1 and f2 are different files, ** or f1 is before f2 in same file */ bool fileloc_notAfter (fileloc f1, fileloc f2) { /*@access fileId*/ return ((fileloc_isDefined (f1) && fileloc_isDefined (f2)) && ((f1->fid != f2->fid) || ((f1->lineno < f2->lineno) || ((f1->lineno == f2->lineno) && (f1->column <= f2->column))))); /*@noaccess fileId@*/ } bool fileloc_isStandardLibrary (fileloc f) { cstring s = fileloc_getBase (f); return (cstring_equalLit (s, LLSTDLIBS_NAME) || cstring_equalLit (s, LLSTRICTLIBS_NAME) || cstring_equalLit (s, LLUNIXLIBS_NAME) || cstring_equalLit (s, LLUNIXSTRICTLIBS_NAME) || cstring_equalLit (s, LLPOSIXSTRICTLIBS_NAME) || cstring_equalLit (s, LLPOSIXLIBS_NAME)); } bool fileloc_sameFileAndLine (fileloc f1, fileloc f2) { return (fileloc_sameFile (f1, f2) && (fileloc_isDefined (f1) && fileloc_isDefined (f2) && f1->lineno == f2->lineno)); } bool fileloc_sameFile (fileloc f1, fileloc f2) { if ((fileloc_isUndefined (f1) || (fileloc_isUndefined (f2)) || (fileloc_isLib (f1)) || (fileloc_isLib (f2)))) { return FALSE; } else { return (fileId_equal (f1->fid, f2->fid)); } } bool fileloc_sameModule (fileloc f1, fileloc f2) { if (fileloc_isUndefined (f1)) { return (fileloc_isUndefined (f2)); } else if (fileloc_isUndefined (f2)) { return (FALSE); } else { if (fileloc_isBuiltin (f1) || fileloc_isBuiltin (f2) || fileloc_isExternal (f1) || fileloc_isExternal (f2)) { return fileloc_sameFile (f1, f2); } else { cstring s1 = fileloc_getBase (f1); cstring s2 = fileloc_getBase (f2); return (cstring_equal (s1, s2)); } } } bool fileloc_sameBaseFile (fileloc f1, fileloc f2) { if (fileloc_isUndefined (f1)) { return (fileloc_isUndefined (f2)); } else if (fileloc_isUndefined (f2)) { return (FALSE); } else { return (fileId_baseEqual (f1->fid, f2->fid)); } } bool fileloc_isSystemFile (fileloc f1) { if (fileloc_isDefined (f1) && !fileloc_isBuiltin (f1) && !fileloc_isExternal (f1)) { return (fileTable_isSystemFile (context_fileTable (), f1->fid)); } return FALSE; } bool fileloc_isXHFile (fileloc f1) { if (fileloc_isDefined (f1) && !fileloc_isBuiltin (f1) && !fileloc_isExternal (f1)) { DPRINTF (("Fileloc is XH: [%p] %s", f1, fileloc_unparse (f1))); return (fileTable_isXHFile (context_fileTable (), f1->fid)); } return FALSE; } bool fileloc_almostSameFile (fileloc f1, fileloc f2) { if ((fileloc_isUndefined (f1) || (fileloc_isUndefined (f2)) || (fileloc_isLib (f1)) || (fileloc_isLib (f2)))) { return FALSE; } else { if (fileId_baseEqual (f1->fid, f2->fid)) { return TRUE; } else if (fileTable_isSystemFile (context_fileTable (), f1->fid) || fileTable_isSystemFile (context_fileTable (), f2->fid)) { return TRUE; } else if (fileTable_isSpecialFile (context_fileTable (), f1->fid) || fileTable_isSpecialFile (context_fileTable (), f2->fid)) { return (cstring_equal (fileloc_getBase (f1), fileloc_getBase (f2))); } else { return FALSE; } } } /*@only@*/ fileloc fileloc_fromTok (ltoken t) { cstring fname = ltoken_fileName (t); fileId fid = fileTable_lookup (context_fileTable (), fname); fileloc fl; if (!fileId_isValid (fid)) { fid = fileTable_addLCLFile (context_fileTable (), fname); } fl = fileloc_create (fid, (int) ltoken_getLine (t), (int) ltoken_getCol (t)); return (fl); } /*@only@*/ fileloc fileloc_createLib (cstring ln) { flkind fk = FL_LIB; fileId fid = fileTable_lookup (context_fileTable (), ln); if (!fileId_isValid (fid)) { fid = fileTable_addLibraryFile (context_fileTable (), ln); } if (cstring_equalPrefix (ln, cstring_makeLiteralTemp (SYSTEM_LIBDIR))) { fk = FL_STDLIB; } return (fileloc_createPrim (fk, fid, 0, 0)); } fileloc fileloc_createRc (cstring name) { fileId fid = fileTable_addFile (context_fileTable (), name); return (fileloc_createPrim (FL_RC, fid, 0, 0)); } fileloc fileloc_createExternal (void) { /*@i@*/ return (fileloc_getExternal ()); } fileloc fileloc_getExternal (void) { if (s_externalLoc == fileloc_undefined) { s_externalLoc = fileloc_createPrim (FL_EXTERNAL, fileId_invalid, 0, 0); } return s_externalLoc; } fileloc fileloc_observeBuiltin () { /*@-onlytrans@*/ return (fileloc_getBuiltin ()); /*@=onlytrans@*/ } fileloc fileloc_getBuiltin () { static /*@owned@*/ fileloc res = fileloc_undefined; if (res == fileloc_undefined) { res = fileloc_createPrim (FL_BUILTIN, fileId_invalid, 0, 0); } return res; } fileloc fileloc_makePreproc (fileloc loc) { if (fileloc_isDefined (loc)) { return (fileloc_createPrim (FL_PREPROC, loc->fid, loc->lineno, loc->column)); } return (fileloc_createPrim (FL_PREPROC, fileId_invalid, 0, 0)); } fileloc fileloc_makePreprocPrevious (fileloc loc) { if (fileloc_isDefined (loc)) { if (loc->lineno > 1) { return (fileloc_createPrim (FL_PREPROC, loc->fid, loc->lineno - 1, 0)); } else { return (fileloc_createPrim (FL_PREPROC, loc->fid, loc->lineno, 0)); } } return (fileloc_createPrim (FL_PREPROC, fileId_invalid, 0, 0)); } /* We pretend the result is only, because fileloc_free doesn't free it! */ /*@only@*/ fileloc fileloc_createBuiltin () { if (fileloc_isUndefined (s_builtinLoc)) { s_builtinLoc = fileloc_createPrim (FL_BUILTIN, fileId_invalid, 0, 0); } /*@-globstate@*/ /*@-retalias@*/ return s_builtinLoc; /*@=globstate@*/ /*@=retalias@*/ } /*@only@*/ fileloc fileloc_createImport (cstring fname, int lineno) { fileId fid = fileTable_lookup (context_fileTable (), fname); if (!fileId_isValid (fid)) { fid = fileTable_addImportFile (context_fileTable (), fname); } return (fileloc_createPrim (FL_IMPORT, fid, lineno, 0)); } static /*@only@*/ fileloc fileloc_createPrim (flkind kind, fileId fid, int line, int col) { fileloc f = (fileloc) dmalloc (sizeof (*f)); f->kind = kind; f->fid = fid; f->lineno = line; f->column = col; DPRINTF (("Fileloc create: [%p] %s", f, fileloc_unparse (f))); return (f); } /*@only@*/ fileloc fileloc_createSpec (fileId fid, int line, int col) { return (fileloc_createPrim (FL_SPEC, fid, line, col)); } fileloc fileloc_create (fileId fid, int line, int col) { return (fileloc_createPrim (fileId_kind (fid), fid, line, col)); } /*@observer@*/ cstring fileloc_filename (fileloc f) { return (fileloc_isDefined (f) ? fileTable_rootFileName (f->fid) : cstring_makeLiteralTemp ("")); } /*@only@*/ cstring fileloc_outputFilename (fileloc f) { if (fileloc_isDefined (f)) { if (fileId_isValid (f->fid)) { return osd_outputPath (fileTable_rootFileName (f->fid)); } else { return cstring_makeLiteral (""); } } else { return cstring_makeLiteral (""); } } cstring fileloc_unparseFilename (fileloc f) { if (fileloc_isDefined (f)) { switch (f->kind) { case FL_LIB: return (message ("load file %q", fileloc_outputFilename (f))); case FL_BUILTIN: return (cstring_makeLiteral ("# builtin #")); case FL_IMPORT: return (message ("import file %q", fileloc_outputFilename (f))); case FL_EXTERNAL: return (cstring_makeLiteral ("")); default: return (fileloc_outputFilename (f)); } } return cstring_undefined; } int fileloc_lineno (fileloc f) { return (fileloc_isDefined (f) ? f->lineno : -1); } int fileloc_column (fileloc f) { return (fileloc_isDefined (f) ? f->column : -1); } /*@only@*/ cstring fileloc_unparse (fileloc f) { static bool in_funparse = FALSE; bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); bool htmlFormat = context_getFlag (FLG_HTMLFILEFORMAT); cstring res = cstring_undefined; /* watch out for recursive calls when debugging... */ llassert (!in_funparse); in_funparse = TRUE; if (fileloc_isDefined (f)) { switch (f->kind) { case FL_BUILTIN: { res = cstring_makeLiteral ("Command Line"); break; } case FL_IMPORT: if (parenFormat) { res = message ("import file %q(%d)", fileloc_outputFilename (f), f->lineno); } else { res = message ("import file %q:%d", fileloc_outputFilename (f), f->lineno); } break; case FL_PREPROC: { if (parenFormat) { res = message ("%q(%d)", fileloc_outputFilename (f), f->lineno); } else { res = message ("%q:%d", fileloc_outputFilename (f), f->lineno); } break; } case FL_EXTERNAL: res = cstring_makeLiteral (""); break; default: { cstring fname; if (f->kind == FL_LIB) { fname = message ("load file %q", fileloc_outputFilename (f)); if (!context_getFlag (FLG_SHOWLOADLOC)) { res = fname; break; } } else { fname = fileloc_outputFilename (f); } if (context_getFlag (FLG_SHOWCOL)) { if (fileloc_linenoDefined (f)) { if (fileloc_columnDefined (f)) { if (parenFormat) { res = message ("%q(%d,%d)", fname, f->lineno, f->column); } else { res = message ("%q:%d:%d", fname, f->lineno, f->column); } } else { if (parenFormat) { res = message ("%q(%d)", fname, f->lineno); } else { res = message ("%q:%d", fname, f->lineno); } } } else { res = fname; /*@-branchstate@*/ /* spurious warnings reporteded because of break above */ } } else if (fileloc_linenoDefined (f)) { if (parenFormat) { res = message ("%q(%d)", fname, f->lineno); } else { res = message ("%q:%d", fname, f->lineno); } } else { res = fname; } } } if (htmlFormat && fileloc_linenoDefined (f)) { res = message ("%s", f->lineno, res); } } else { res = cstring_makeLiteral ("< Location unknown >"); } /*@=branchstate@*/ /* this is a spurious warning because of the break */ in_funparse = FALSE; return res; } /*@only@*/ cstring fileloc_unparseRaw (cstring fname, int lineno) { if (!cstring_isEmpty (fname)) { bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); if (parenFormat) { return (message ("%q(%d)", osd_outputPath (fname), lineno)); } else { return (message ("%q:%d", osd_outputPath (fname), lineno)); } } else { return cstring_makeLiteral ("Command Line"); } } /*@only@*/ cstring fileloc_unparseRawCol (cstring fname, int lineno, int col) { if (!cstring_isEmpty (fname)) { if (context_getFlag (FLG_SHOWCOL)) { bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); if (parenFormat) { return (message ("%q(%d,%d)", osd_outputPath (fname), lineno, col)); } else { return (message ("%q:%d:%d", osd_outputPath (fname), lineno, col)); } } else { return fileloc_unparseRaw (fname, lineno); } } else { return cstring_makeLiteral ("Command Line"); } } bool fileloc_isSpecialFile (fileloc f) { if (fileloc_isDefined (f) && fileId_isValid (f->fid)) { return (fileTable_isSpecialFile (context_fileTable (), f->fid)); } else { return FALSE; } } bool fileloc_isHeader (fileloc f) { /* returns true if is not a .c file */ return (fileloc_isDefined (f) && fileId_isValid (f->fid) && fileId_isHeader (f->fid)); } bool fileloc_isSpec (fileloc f) { return (fileloc_isDefined (f) && (f->kind == FL_LIB || f->kind == FL_STDLIB || f->kind == FL_SPEC)); } bool fileloc_isRealSpec (fileloc f) { return (fileloc_isDefined (f) && (f->kind == FL_SPEC)); } bool fileloc_isLib (fileloc f) { return (fileloc_isDefined (f) && (f->kind == FL_LIB || f->kind == FL_STDHDR || f->kind == FL_STDLIB)); } bool fileloc_isStandardLib (fileloc f) { return (fileloc_isDefined (f) && f->kind == FL_STDLIB); } /*@only@*/ cstring fileloc_unparseDirect (fileloc fl) { if (fileloc_isDefined (fl)) { return (message ("%d:%d:%d", /*@access fileId@*/ (int) fl->fid, /*@noaccess fileId@*/ fl->lineno, fl->column)); } else { return (cstring_makeLiteral ("")); } } bool fileloc_isUser (fileloc f) { return (fileloc_isDefined (f) && f->kind == FL_NORMAL); } splint-3.1.2.dfsg1/src/message.c0000644021234200000250000001454407650621403014035 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** message.c */ # include "splintMacros.nf" # include "basic.h" /* patch for linux? solaris? */ static char strbuf[64]; static int modcode; typedef enum { XINVALID, XCHAR, XSTRING, XSTRINGFREE, XTSTRINGFREE, XINT, XFLOAT, XBOOL, XUENTRY, XPERCENT, XCTYPE, XPLURAL, XREPREFIX, XFILELOC, XPOINTER } ccode; /*@function void GETPRINTF (char *p_s, anytype p_v) modifies strbuf@*/ /*@notfunction@*/ # ifndef WIN32 /* ISO requires this, but not all implementations (e.g., Microsoft's) provide it */ # define GETPRINTF(s,v) (snprintf (strbuf, 64, s, v), mstring_copy (strbuf)) # else /* MS provides _snprintf instead */ # define GETPRINTF(s,v) (_snprintf (strbuf, 64, s, v), mstring_copy (strbuf)) # endif /* ** returns control code indicated by *c, and ** advances *c to next character. */ static ccode identify_control (char **s) { char c; modcode = 0; c = **s; if (c == '\0') { return (XINVALID); } if (c >= '0' && c <= '9') { modcode = reader_getInt (s); } c = **s; (*s)++; /* ** handle single-char codes */ switch (c) { case '%': return (XPERCENT); case 'h': case 'c': return (XCHAR); case 's': return (XSTRING); case 'q': return (XSTRINGFREE); case 'x': return (XSTRINGFREE); case 'd': return (XINT); case 'u': return (XINT); /* unsigned */ case 'w': return (XINT); /* unsigned long */ case 'f': return (XFLOAT); case 'b': return (XBOOL); case 't': return (XCTYPE); case 'p': return (XPOINTER); case 'l': return (XFILELOC); case '&': return (XPLURAL); case 'r': return (XREPREFIX); default: llcontbug (message ("Message: invalid code: %h (%s)", c, cstring_fromChars (*s))); return (XINVALID); } } /* ** message ** ** returns a cstring containing the message, as formated by s. ** ** the format codes are similar to printf: ** ** %s cstring (don't free after print) ** %q cstring (free after print) ** %d int ** %f float ** %b bool (uses bool_unparse) ** %u uentry ** %l fileloc ** %t ctype */ # if USEVARARGS cstring message (fmt, va_alist) char *fmt; va_dcl # else /*@messagelike@*/ /*@only@*/ cstring message (/*@temp@*/ char *fmt, ...) # endif { char c; int lastint = 0; char *ret = mstring_createEmpty (); char *ofmt = fmt; va_list pvar; # if USEVARARGS va_start (pvar); # else va_start (pvar, fmt); # endif while ((c = *fmt++) != '\0') { if (c == '%') { /*@-loopswitchbreak@*/ switch (identify_control (&fmt)) { case XPERCENT: { ret = mstring_concatFree1 (ret, "%"); break; } case XCHAR: { /* ** some systems don't handle char va_arg correctly, so it must be ** passed as an int here */ char lc = (char) va_arg (pvar, int); ret = mstring_append (ret, lc); break; } case XSTRING: { cstring s = va_arg (pvar, cstring); if (modcode != 0) { ret = mstring_concatFree (ret, cstring_toCharsSafe (cstring_fill (s, size_fromInt (modcode)))); } else { if (cstring_isDefined (s)) { ret = mstring_concatFree1 (ret, cstring_toCharsSafe (s)); } } } break; case XSTRINGFREE: case XTSTRINGFREE: { cstring s = va_arg (pvar, cstring); if (modcode != 0) { ret = mstring_concatFree (ret, cstring_toCharsSafe (cstring_fill (s, size_fromInt (modcode)))); } else { if (cstring_isDefined (s)) { ret = mstring_concatFree (ret, cstring_toCharsSafe (s)); } } } break; case XREPREFIX: lastint = va_arg (pvar, int); if (lastint != 0) { ret = mstring_concatFree1 (ret, "re"); } break; case XPLURAL: if (lastint != 1) { ret = mstring_concatFree1 (ret, "s"); } break; case XINT: lastint = va_arg (pvar, int); ret = mstring_concatFree (ret, GETPRINTF ("%d", lastint)); break; case XFLOAT: ret = mstring_concatFree (ret, GETPRINTF ("%.2lf", va_arg (pvar, double))); break; case XBOOL: ret = mstring_concatFree1 (ret, cstring_toCharsSafe (bool_unparse (bool_fromInt ((va_arg (pvar, int)))))); /* va_arg should not use bool type */ break; case XUENTRY: ret = mstring_concatFree (ret, cstring_toCharsSafe (uentry_unparse (va_arg (pvar, uentry)))); break; case XCTYPE: /* cannot free ctype_unparse */ ret = mstring_concatFree1 (ret, cstring_toCharsSafe (ctype_unparse (va_arg (pvar, ctype)))); break; case XPOINTER: ret = mstring_concatFree (ret, GETPRINTF ("%p", va_arg (pvar, void *))); break; case XFILELOC: ret = mstring_concatFree (ret, cstring_toCharsSafe (fileloc_unparse (va_arg (pvar, fileloc)))); break; case XINVALID: default: llcontbug (cstring_makeLiteral ("message: bad control flag")); fprintf (stdout, "\tFormat string: %s", ofmt); } /*@=loopswitchbreak@*/ } else { ret = mstring_append (ret, c); } } va_end (pvar); /* ** cstring_fromChars returns the same storage (exposed) */ /*@-mustfree@*/ return (cstring_fromChars (ret)); /*@=mustfree@*/ } splint-3.1.2.dfsg1/src/inputStream.c0000644021234200000250000002014207650622513014716 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** source.c ** ** Interface to source file abstraction ** ** NOTE: This module is almost identical to the one for LCL. The ** only difference is that a couple of source lines have been ** commented out. ** ** This module has too many dependencies to be in the common ** source area. Any of the solutions that would allow this ** module to be common had its own set of compromises. It ** seemed best and most straightforward to just keep separte ** copies for LSL and LCL. We should examine this again if we ** ever reorganize the module structure. ** ** AUTHORS: ** ** Steve Garland, ** Massachusetts Institute of Technology ** Joe Wild, Technical Languages and Environments, DECspec project */ # include "splintMacros.nf" # include "basic.h" # include "osd.h" extern bool inputStream_close (inputStream s) { llassert (inputStream_isDefined (s)); if (s->file != NULL) { check (fileTable_closeFile (context_fileTable (), s->file)); s->file = NULL; return TRUE; } return FALSE; } extern void inputStream_free (/*@null@*/ /*@only@*/ inputStream s) { if (inputStream_isDefined (s)) { cstring_free (s->name); cstring_free (s->stringSource); sfree (s); } } extern /*@only@*/ inputStream inputStream_create (cstring name, cstring suffix, bool echo) { char *ps; inputStream s = (inputStream) dmalloc (sizeof (*s)); s->name = name; s->file = NULL; /*@access cstring@*/ llassert (cstring_isDefined (s->name)); ps = strrchr (s->name, CONNECTCHAR); if (ps == NULL) { ps = s->name; } /*@noaccess cstring@*/ if (strchr (ps, '.') == NULL) { s->name = cstring_concatFree1 (s->name, suffix); } s->name = fileLib_cleanName (s->name); s->lineNo = 0; s->charNo = 0; s->curLine = NULL; s->echo = echo; s->fromString = FALSE; s->stringSource = NULL; s->stringSourceTail = NULL; s->buffer[0] = '\0'; return s; } extern /*@only@*/ inputStream inputStream_fromString (cstring name, cstring str) { inputStream s = (inputStream) dmalloc (sizeof (*s)); s->name = cstring_copy (name); s->stringSource = cstring_copy (str); s->stringSourceTail = s->stringSource; s->file = 0; s->echo = FALSE; s->fromString = TRUE; s->lineNo = 0; s->charNo = 0; s->curLine = NULL; s->buffer[0] = '\0'; return s; } extern int inputStream_nextChar (inputStream s) { int res; llassert (inputStream_isDefined (s)); res = inputStream_peekChar (s); if (res != EOF) { if (res == (int) '\n') { s->curLine = NULL; s->charNo = 0; incLine (); } else { s->charNo++; incColumn (); } } DPRINTF (("Next char: %c [%d]", (char) res, res)); return res; } extern int inputStream_peekNChar (inputStream s, int n) /* Doesn't work across lines! */ { llassert (inputStream_isDefined (s)); llassert (s->curLine != NULL); llassert (s->charNo + n < strlen (s->curLine)); return ((int) s->curLine [s->charNo + n]); } extern int inputStream_peekChar (inputStream s) { llassert (inputStream_isDefined (s)); if (s->curLine == NULL) { char *cur; s->curLine = NULL; cur = inputStream_nextLine (s); s->curLine = cur; /* split this to avoid possible undefined behavior */ s->charNo = 0; } if (s->curLine == NULL) { return EOF; } llassert (s->charNo <= strlen (s->curLine)); if (s->curLine[s->charNo] == '\0') { return (int) '\n'; } return ((int) s->curLine [s->charNo]); } extern /*@dependent@*/ /*@null@*/ char *inputStream_nextLine (inputStream s) { char *currentLine; size_t len; llassert (inputStream_isDefined (s)); llassert (s->curLine == NULL); s->charNo = 0; if (s->fromString) { if (cstring_isEmpty (s->stringSourceTail)) { currentLine = 0; } else { /*@access cstring@*/ char *c = strchr (s->stringSourceTail, '\n'); /* in case line is terminated not by newline */ if (c == 0) { c = strchr (s->stringSourceTail, '\0'); } len = size_fromInt (c - s->stringSourceTail + 1); if (len > size_fromInt (STUBMAXRECORDSIZE - 2)) { len = size_fromInt (STUBMAXRECORDSIZE - 2); } currentLine = &(s->buffer)[0]; strncpy (currentLine, s->stringSourceTail, len); currentLine[len] = '\0'; s->stringSourceTail += len; /*@noaccess cstring@*/ } } else { llassert (s->file != NULL); currentLine = fgets (&(s->buffer)[0], STUBMAXRECORDSIZE, s->file); } if (currentLine == 0) { strcpy (s->buffer, "*** End of File ***"); } else { s->lineNo++; len = strlen (currentLine) - 1; if (s->buffer[len] == '\n') { s->buffer[len] = '\0'; } else { if (len >= size_fromInt (STUBMAXRECORDSIZE - 2)) { lldiagmsg (message ("Input line too long: %s", cstring_fromChars (currentLine))); } } } /* if (s->echo) slo_echoLine (currentLine); only needed in LCL */ return currentLine; } extern bool inputStream_open (inputStream s) { llassert (inputStream_isDefined (s)); if (s->fromString) { /* not an error: tail is dependent */ s->stringSourceTail = s->stringSource; return TRUE; } DPRINTF (("Opening: %s", s->name)); s->file = fileTable_openReadFile (context_fileTable (), s->name); return (s->file != 0 || s->fromString); } /* ** requires ** path != NULL \and ** s != NULL \and ** *s.name == filename (*s.name) || filetype (*s.name) ** *s.name consists of a file name and type only (".) ** No path name is included ** ** ensures ** if filefound (*path, *s) then ** result = true \and *s.name = filespec_where_file_found (*path, *s) ** else ** result = false */ extern bool inputStream_getPath (cstring path, inputStream s) { cstring returnPath; filestatus status; /* return status of osd_getEnvPath.*/ bool rVal; /* return value of this procedure. */ llassert (cstring_isDefined (path)); llassert (inputStream_isDefined (s)); llassert (cstring_isDefined (s->name)); status = osd_getPath (path, s->name, &returnPath); if (status == OSD_FILEFOUND) { /* Should be majority of cases. */ rVal = TRUE; cstring_free (s->name); s->name = fileLib_cleanName (returnPath); } else if (status == OSD_FILENOTFOUND) { rVal = FALSE; } else if (status == OSD_PATHTOOLONG) { rVal = FALSE; /* Directory and filename are too long. Report error. */ llbuglit ("soure_getPath: Filename plus directory from search path too long"); } else { rVal = FALSE; llbuglit ("inputStream_getPath: invalid return status"); } return rVal; } /*:open:*/ FILE *inputStream_getFile (inputStream s) { llassert (inputStream_isDefined (s)); llassert (s->file != NULL); return s->file; } cstring inputStream_fileName (inputStream s) { llassert (inputStream_isDefined (s)); return s->name; } bool inputStream_isOpen (inputStream s) { return (inputStream_isDefined (s) && (s->file != 0 || s->fromString)); } int inputStream_thisLineNumber (inputStream s) { llassert (inputStream_isDefined (s)); return s->lineNo; } splint-3.1.2.dfsg1/src/fileTable.c0000644021234200000250000006217007751270740014304 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** fileTable.c ** ** replaces filenamemap.c ** based (loosely) on typeTable.c ** ** entries in the fileTable are: ** ** name - name of the file ** type - kind of file (a temp file to be deleted?) ** link - derived from this file ** */ /* * Herbert 04/1997: * - Added conditional stuff (macros OS2 and MSDOS) to make names of temporary * files under Windows or OS/2 not larger than 8+3 characters to avoid * trouble with FAT file systems or Novell Netware volumes. * - Added include of new header file portab.h containing OS dependent stuff. * - Changed occurance of '/' as path delimiter to a macro. * - Added conditional stuff (#define and #include) for IBM's compiler. */ # include # include # include # include "splintMacros.nf" # include "basic.h" # include "osd.h" # include "llmain.h" # ifdef WIN32 # include # else # if defined(__IBMC__) && defined(OS2) # include # include # define getpid _getpid # define S_IRUSR S_IREAD # define S_IWUSR S_IWRITE # define S_IXUSR S_IEXEC # endif # endif /*@access fileId*/ static void fileTable_addOpen (fileTable p_ft, /*@observer@*/ FILE *p_f, /*@only@*/ cstring p_fname) /*@modifies p_ft@*/ ; static bool fileTable_inRange (fileTable ft, fileId fid) /*@*/ { return (fileTable_isDefined (ft) && (fid >= 0) && (fid < ft->nentries)); } static fileId fileTable_internAddEntry (fileTable p_ft, /*@only@*/ ftentry p_e) /*@modifies p_ft@*/ ; static /*@only@*/ cstring makeTempName (cstring p_dir, cstring p_pre, cstring p_suf); static /*@only@*/ cstring fileType_unparse (fileType ft) { switch (ft) { case FILE_NORMAL: return cstring_makeLiteral ("normal"); case FILE_NODELETE: return cstring_makeLiteral ("normal"); case FILE_LSLTEMP: return cstring_makeLiteral ("ltemp"); case FILE_HEADER: return cstring_makeLiteral ("header"); case FILE_XH: return cstring_makeLiteral ("xh"); case FILE_MACROS: return cstring_makeLiteral ("macros"); case FILE_METASTATE: return cstring_makeLiteral ("metastate"); } BADEXIT; } static int fileTable_getIndex (fileTable ft, cstring s) { int res; cstring abspath; if (ft == NULL) return NOT_FOUND; abspath = osd_absolutePath (cstring_undefined, s); if (context_getFlag (FLG_CASEINSENSITIVEFILENAMES)) { abspath = cstring_downcase (abspath); } DPRINTF (("Absolute path: %s: %s", s, abspath)); res = cstringTable_lookup (ft->htable, abspath); cstring_free (abspath); return res; } static cstring ftentry_unparse (fileTable ft, ftentry fte) { if (fileId_isValid (fte->fder)) { llassert (fileTable_isDefined (ft)); return message ("%s %q %d (%s)", fte->fname, fileType_unparse (fte->ftype), fte->fder, ft->elements[fte->fder]->fname); } else { return message ("%s %q", fte->fname, fileType_unparse (fte->ftype)); } } /*@only@*/ cstring fileTable_unparse (fileTable ft) { cstring s = cstring_undefined; int i; if (fileTable_isUndefined (ft)) { return (cstring_makeLiteral ("")); } for (i = 0; i < ft->nentries; i++) { s = message ("%s\n[%d] %q", s, i, ftentry_unparse (ft, ft->elements[i])); } return s; } void fileTable_printTemps (fileTable ft) { if (fileTable_isDefined (ft)) { int i; for (i = 0; i < ft->nentries; i++) { if (ft->elements[i]->ftemp) { if (fileId_isValid (ft->elements[i]->fder)) { fprintf (stderr, " %s:1\n\t%s:1\n", cstring_toCharsSafe (ft->elements[ft->elements[i]->fder]->fname), cstring_toCharsSafe (ft->elements[i]->fname)); } else { fprintf (stderr, "[no file]\n\t%s:1\n", cstring_toCharsSafe (ft->elements[i]->fname)); } } } } } /* ** loads in fileTable from fileTable_dump */ static /*@notnull@*/ ftentry ftentry_create (/*@keep@*/ cstring tn, bool temp, fileType typ, fileId der) { ftentry t = (ftentry) dmalloc (sizeof (*t)); if (cstring_isUndefined (tn)) { llbug (cstring_makeLiteral ("Undefined filename!")); } t->fname = tn; t->basename = cstring_undefined; t->ftemp = temp; t->ftype = typ; t->fder = der; /* Don't set these until the basename is needed. */ t->fsystem = FALSE; t->fspecial = FALSE; return t; } static void ftentry_free (/*@only@*/ ftentry t) { cstring_free (t->fname); cstring_free (t->basename); sfree (t); } /*@only@*/ /*@notnull@*/ fileTable fileTable_create () { fileTable ft = (fileTable) dmalloc (sizeof (*ft)); ft->nentries = 0; ft->nspace = FTBASESIZE; ft->elements = (ftentry *) dmalloc (FTBASESIZE * sizeof (*ft->elements)); ft->htable = cstringTable_create (FTHASHSIZE); ft->nopen = 0; ft->nopenspace = FTBASESIZE; ft->openelements = (foentry *) dmalloc (FTBASESIZE * sizeof (*ft->openelements)); return (ft); } /*@-bounds@*/ static void fileTable_grow (fileTable ft) { int i; ftentry *newent; llassert (fileTable_isDefined (ft)); ft->nspace = FTBASESIZE; newent = (ftentry *) dmalloc ((ft->nentries + ft->nspace) * sizeof (*newent)); for (i = 0; i < ft->nentries; i++) { newent[i] = ft->elements[i]; } sfree (ft->elements); ft->elements = newent; } /*@=bounds@*/ static void fileTable_growOpen (fileTable ft) { int i; foentry *newent; llassert (fileTable_isDefined (ft)); ft->nopenspace = FTBASESIZE; newent = (foentry *) dmalloc ((ft->nopen + ft->nopenspace) * sizeof (*newent)); for (i = 0; i < ft->nopen; i++) { newent[i] = ft->openelements[i]; } sfree (ft->openelements); ft->openelements = newent; } static fileId fileTable_internAddEntry (fileTable ft, /*@only@*/ ftentry e) { llassert (fileTable_isDefined (ft)); if (ft->nspace <= 0) fileTable_grow (ft); ft->nspace--; DPRINTF (("Adding: %s", e->fname)); if (context_getFlag (FLG_CASEINSENSITIVEFILENAMES)) { cstring sd = cstring_downcase (e->fname); cstringTable_insert (ft->htable, sd, ft->nentries); } else { cstringTable_insert (ft->htable, cstring_copy (e->fname), ft->nentries); } /* evans 2002-07-12: Before, there was no cstring_copy above, and e->fname was free'd in the if branch. Splint should have caught this, and produced a warning for this assignment. Why not? */ ft->elements[ft->nentries] = e; ft->nentries++; return (ft->nentries - 1); } void fileTable_noDelete (fileTable ft, cstring name) { fileId fid = fileTable_lookup (ft, name); if (fileId_isValid (fid)) { llassert (fileTable_isDefined (ft)); ft->elements[fid]->ftype = FILE_NODELETE; } else { DPRINTF (("Invalid no delete: %s", name)); } } static fileId fileTable_addFilePrim (fileTable ft, /*@temp@*/ cstring name, bool temp, fileType typ, fileId der) /*@modifies ft@*/ { cstring absname = osd_absolutePath (NULL, name); int tindex = fileTable_getIndex (ft, absname); llassert (ft != fileTable_undefined); if (tindex != NOT_FOUND) { llcontbug (message ("fileTable_addFilePrim: duplicate entry: %q", absname)); return tindex; } else { ftentry e = ftentry_create (absname, temp, typ, der); if (der == fileId_invalid) { llassert (cstring_isUndefined (e->basename)); e->basename = fileLib_removePathFree (fileLib_removeAnyExtension (absname)); e->fsystem = context_isSystemDir (absname); /* ** evans 2002-03-15: change suggested by Jim Zelenka ** support relative paths for system directories */ if (!e->fsystem) { e->fsystem = context_isSystemDir (name); } e->fspecial = context_isSpecialFile (absname); if (e->fspecial) { cstring srcname = cstring_concatFree1 (fileLib_removeAnyExtension (absname), C_EXTENSION); fileId fid = fileTable_lookup (ft, srcname); cstring_free (srcname); if (fileId_isValid (fid)) { fileId derid = ft->elements[fid]->fder; ft->elements[fid]->fspecial = TRUE; if (fileId_isValid (derid)) { ft->elements[derid]->fspecial = TRUE; } } } } else { ftentry de = ft->elements[der]; llassert (cstring_isUndefined (e->basename)); e->basename = cstring_copy (de->basename); e->fsystem = de->fsystem; e->fspecial = de->fspecial; } return (fileTable_internAddEntry (ft, e)); } } fileId fileTable_addFile (fileTable ft, cstring name) { return (fileTable_addFilePrim (ft, name, FALSE, FILE_NORMAL, fileId_invalid)); } fileId fileTable_addFileOnly (fileTable ft, /*@only@*/ cstring name) { fileId res = fileTable_addFilePrim (ft, name, FALSE, FILE_NORMAL, fileId_invalid); cstring_free (name); return res; } fileId fileTable_addHeaderFile (fileTable ft, cstring name) { fileId res; res = fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid); return res; } void fileTable_addStreamFile (fileTable ft, FILE *fstream, cstring name) { fileTable_addOpen (ft, fstream, cstring_copy (name)); } bool fileTable_isHeader (fileTable ft, fileId fid) { if (fileId_isInvalid (fid)) { return FALSE; } llassert (fileTable_isDefined (ft) && fileTable_inRange (ft, fid)); return (ft->elements[fid]->ftype == FILE_HEADER); } bool fileTable_isSystemFile (fileTable ft, fileId fid) { if (fileId_isInvalid (fid)) { return FALSE; } llassert (fileTable_isDefined (ft) && fileTable_inRange (ft, fid)); return (ft->elements[fid]->fsystem); } bool fileTable_isXHFile (fileTable ft, fileId fid) { if (fileId_isInvalid (fid)) { return FALSE; } if (!(fileTable_isDefined (ft) && fileTable_inRange (ft, fid))) { llcontbug (message ("Bad file table or id: %s %d", bool_unparse (fileTable_isDefined (ft)), fid)); return FALSE; } else { return (ft->elements[fid]->ftype == FILE_XH); } } bool fileTable_isSpecialFile (fileTable ft, fileId fid) { if (fileId_isInvalid (fid)) { return FALSE; } llassert (fileTable_isDefined (ft) && fileTable_inRange (ft, fid)); return (ft->elements[fid]->fspecial); } fileId fileTable_addLibraryFile (fileTable ft, cstring name) { return (fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid)); } fileId fileTable_addXHFile (fileTable ft, cstring name) { return (fileTable_addFilePrim (ft, name, FALSE, FILE_XH, fileId_invalid)); } fileId fileTable_addImportFile (fileTable ft, cstring name) { return (fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid)); } fileId fileTable_addLCLFile (fileTable ft, cstring name) { return (fileTable_addFilePrim (ft, name, FALSE, FILE_HEADER, fileId_invalid)); } static int tmpcounter = 0; fileId fileTable_addMacrosFile (fileTable ft) { cstring newname = makeTempName (context_tmpdir (), cstring_makeLiteralTemp ("lmx"), cstring_makeLiteralTemp (".llm")); fileId res = fileTable_addFilePrim (ft, newname, TRUE, FILE_MACROS, fileId_invalid); cstring_free (newname); return res; } fileId fileTable_addMetastateFile (fileTable ft, cstring name) { return (fileTable_addFilePrim (ft, name, FALSE, FILE_METASTATE, fileId_invalid)); } fileId fileTable_addCTempFile (fileTable ft, fileId fid) { cstring newname = makeTempName (context_tmpdir (), cstring_makeLiteralTemp ("cl"), C_EXTENSION); fileId res; DPRINTF (("tmp dir: %s", context_tmpdir ())); DPRINTF (("new name: %s", newname)); llassert (fileTable_isDefined (ft)); if (!fileId_isValid (ft->elements[fid]->fder)) { if (fileTable_isXHFile (ft, fid)) { res = fileTable_addFilePrim (ft, newname, TRUE, FILE_XH, fid); } else { res = fileTable_addFilePrim (ft, newname, TRUE, FILE_NORMAL, fid); } } else { if (fileTable_isXHFile (ft, fid)) { res = fileTable_addFilePrim (ft, newname, TRUE, FILE_XH, ft->elements[fid]->fder); } else { res = fileTable_addFilePrim (ft, newname, TRUE, FILE_NORMAL, ft->elements[fid]->fder); } } DPRINTF (("Added file: %s", fileTable_fileName (res))); cstring_free (newname); return res; } fileId fileTable_addltemp (fileTable ft) { cstring newname = makeTempName (context_tmpdir (), cstring_makeLiteralTemp ("ls"), cstring_makeLiteralTemp (".lsl")); fileId ret; if (cstring_hasNonAlphaNumBar (newname)) { char *lastpath = (char *)NULL; if (tmpcounter == 0) { lldiagmsg (message ("Operating system generates tmp filename containing invalid charater: %s", newname)); lldiagmsg (cstring_makeLiteral ("Try cleaning up the tmp directory. Attempting to continue.")); } /*@access cstring@*/ llassert (cstring_isDefined (newname)); lastpath = strrchr (newname, CONNECTCHAR); /* get the directory */ llassert (lastpath != NULL); *lastpath = '\0'; newname = message ("%q%hlsl%d.lsl", newname, CONNECTCHAR, tmpcounter); /*@noaccess cstring@*/ tmpcounter++; } /* ** this is kind of yucky...need to make the result of cstring_fromChars ** refer to the same storage as its argument. Of course, this loses, ** since cstring is abstract. Should make it an only? */ ret = fileTable_addFilePrim (ft, newname, TRUE, FILE_LSLTEMP, fileId_invalid); cstring_free (newname); return (ret); } bool fileTable_exists (fileTable ft, cstring s) { int tindex = fileTable_getIndex (ft, s); if (tindex == NOT_FOUND) { DPRINTF (("Not found: %s", s)); return FALSE; } else { return TRUE; } } fileId fileTable_lookup (fileTable ft, cstring s) { int tindex = fileTable_getIndex (ft, s); if (tindex == NOT_FOUND) { return fileId_invalid; } else { return tindex; } } /* ** This is pretty awkward --- when we find the real path of ** a .xh file, we may need to change the recorded name. [Sigh] */ void fileTable_setFilePath (fileTable ft, fileId fid, cstring path) { llassert (fileId_isValid (fid)); llassert (fileTable_isDefined (ft)); /* Need to put new string in hash table */ cstringTable_insert (ft->htable, cstring_copy (path), fid); ft->elements[fid]->fname = cstring_copy (path); } fileId fileTable_lookupBase (fileTable ft, cstring base) { int tindex; if (context_getFlag (FLG_CASEINSENSITIVEFILENAMES)) { cstring dbase = cstring_downcase (base); tindex = fileTable_getIndex (ft, dbase); cstring_free (dbase); } else { tindex = fileTable_getIndex (ft, base); } if (tindex == NOT_FOUND) { return fileId_invalid; } else { fileId der; llassert (fileTable_isDefined (ft)); der = ft->elements[tindex]->fder; if (!fileId_isValid (der)) { der = tindex; } return der; } } cstring fileTable_getName (fileTable ft, fileId fid) { if (!fileId_isValid (fid)) { llcontbug (message ("fileTable_getName: called with invalid type id: %d", fid)); return cstring_makeLiteralTemp (""); } llassert (fileTable_isDefined (ft)); return (ft->elements[fid]->fname); } cstring fileTable_getRootName (fileTable ft, fileId fid) { fileId fder; if (!fileId_isValid (fid)) { llcontbug (message ("fileTable_getName: called with invalid id: %d", fid)); return cstring_makeLiteralTemp (""); } if (!fileTable_isDefined (ft)) { return cstring_makeLiteralTemp (""); } fder = ft->elements[fid]->fder; if (fileId_isValid (fder)) { return (ft->elements[fder]->fname); } else { return (ft->elements[fid]->fname); } } cstring fileTable_getNameBase (fileTable ft, fileId fid) { if (!fileId_isValid (fid)) { llcontbug (message ("fileTable_getName: called with invalid id: %d", fid)); return cstring_makeLiteralTemp (""); } if (!fileTable_isDefined (ft)) { return cstring_makeLiteralTemp (""); } return (ft->elements[fid]->basename); } bool fileTable_sameBase (fileTable ft, fileId f1, fileId f2) { fileId fd1, fd2; if (!fileId_isValid (f1)) { return FALSE; } if (!fileId_isValid (f2)) { return FALSE; } llassert (fileTable_isDefined (ft)); if (f1 == f2) { return TRUE; } fd1 = ft->elements[f1]->fder; if (!fileId_isValid (fd1)) { fd1 = f1; } fd2 = ft->elements[f2]->fder; if (!fileId_isValid (fd2)) { fd2 = f2; } return (fd1 == fd2); } void fileTable_cleanup (fileTable ft) { int i; bool msg; int skip; llassert (fileTable_isDefined (ft)); msg = ((ft->nentries > 40) && context_getFlag (FLG_SHOWSCAN)); skip = ft->nentries / 10; if (msg) { (void) fflush (g_warningstream); displayScanOpen (cstring_makeLiteral ("cleaning")); } for (i = 0; i < ft->nentries; i++) { ftentry fe = ft->elements[i]; if (fe->ftemp) { /* let's be real careful now, hon! */ /* ** Make sure it is really a derived file */ if (fe->ftype == FILE_LSLTEMP || fe->ftype == FILE_NODELETE) { ; /* already removed */ } else if (fileId_isValid (fe->fder)) { /* this should use close (fd) also... */ (void) osd_unlink (fe->fname); } else if (fe->ftype == FILE_MACROS) { (void) osd_unlink (fe->fname); } else { llbug (message ("Temporary file is not derivative: %s " "(not deleted)", fe->fname)); } } else { ; } if (msg && ((i % skip) == 0)) { displayScanContinue (cstring_makeLiteral (i == 0 ? " " : ".")); } } if (msg) { displayScanClose (); } } void fileTable_free (/*@only@*/ fileTable f) { int i = 0; if (f == (fileTable)NULL) { return; } while ( i < f->nentries ) { ftentry_free (f->elements[i]); i++; } cstringTable_free (f->htable); sfree (f->elements); sfree (f->openelements); /*!! why didn't splint report this? */ sfree (f); } /* ** unique temp filename are constructed from

.
** requires:  must end in '/'
*/

static void nextMsg (char *msg)
{
  /*@+charint@*/
  if (msg[0] < 'Z') 
    {
      msg[0]++; 
    }
  else 
    {
      msg[0] = 'A';
      if (msg[1] < 'Z')
	{ 
	  msg[1]++; 
	}
      else
	{
	  msg[1] = 'A';
	  if (msg[2] < 'Z') 
	    {
	      msg[2]++;
	    }
	  else
	    {
	      msg[2] = 'A';
	      if (msg[3] < 'Z') 
		{
		  msg[3]++; 
		}
	      else
		{
		  llassertprint (FALSE, ("nextMsg: out of unique names!!!"));
		}
	    }
	}
    }
  /*@-charint@*/
}

static /*@only@*/ cstring makeTempName (cstring dir, cstring pre, cstring suf)
{
  static int pid = 0; 
  static /*@owned@*/ char *msg = NULL; 
  static /*@only@*/ cstring pidname = NULL;
  size_t maxlen;
  cstring smsg;

  llassert (cstring_length (pre) <= 3);

  /*
  ** We limit the temp name to 8 characters:
  **   pre: 3 or less
  **   msg: 3
  **   pid: 2  (% 100)
  */

  if (msg == NULL)
    {
      msg = mstring_copy ("AAA"); /* there are 26^3 temp names */
    }

  if (pid == 0) 
    {
      /*@+matchanyintegral@*/
      pid = osd_getPid ();
      /*@=matchanyintegral@*/
    }

  if (cstring_isUndefined (pidname)) 
    {
      pidname = message ("%d", pid % 100);
    }
  
  maxlen = (cstring_length (dir) + cstring_length (pre) + mstring_length (msg) 
	    + cstring_length (pidname) + cstring_length (suf) + 2);

  DPRINTF (("Dir: %s / %s / %s / %s / %s",
	    dir, pre, pidname, msg, suf));

  smsg = message ("%s%s%s%s%s", dir, pre, pidname, cstring_fromChars (msg), suf);
  nextMsg (msg);

  DPRINTF (("Trying: %s", smsg));

  while (osd_fileExists (smsg))
    {
      cstring_free (smsg);
      smsg = message ("%s%s%s%s%s", dir, pre, pidname, cstring_fromChars (msg), suf);
      nextMsg (msg);
    }

  return smsg;
}

static foentry
foentry_create (/*@exposed@*/ FILE *f, /*@only@*/ cstring fname)
{
  foentry t = (foentry) dmalloc (sizeof (*t));
  t->f = f;
  t->fname = fname;
  return t;
}

static void 
foentry_free (/*@only@*/ foentry foe)
{
  cstring_free (foe->fname);
  sfree (foe);
}

static void 
fileTable_addOpen (fileTable ft, /*@observer@*/ FILE *f, /*@only@*/ cstring fname)
{
  llassert (fileTable_isDefined (ft));

  if (ft->nopenspace <= 0) 
    {
      fileTable_growOpen (ft);
    }

  ft->nopenspace--;
  ft->openelements[ft->nopen] = foentry_create (f, fname);
  ft->nopen++;
}

FILE *fileTable_createFile (fileTable ft, cstring fname)
{
# if defined (WIN32) && !defined (BCC32)
  int fdesc = _open (cstring_toCharsSafe (fname), 
		     O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 
		     _S_IWRITE | S_IREAD);
# else
   int fdesc = open (cstring_toCharsSafe (fname), 
		     O_WRONLY | O_CREAT | O_TRUNC | O_EXCL,
		     S_IRUSR | S_IWUSR);
# endif

  if (fdesc == -1)
    {
      osd_setTempError ();
      llfatalerror (message ("Temporary file for "
			     "pre-processor output already exists.  Trying to "
			     "open: %s.",
			     fname));

      /*@notreached@*/ return NULL;
    }
  else
    {
      FILE *res = fdopen (fdesc, "w");
  
      if (res != NULL) 
	{
	  fileTable_addOpen (ft, res, cstring_copy (fname));
	  DPRINTF (("Opening file: %s / %p", fname, res));
	}
      else
	{
	  DPRINTF (("Error opening: %s", fname));
	}

      return res;
    }
}

FILE *fileTable_createMacrosFile (fileTable ft, cstring fname)
{
# if defined (WIN32) && !defined (BCC32)
  int fdesc = _open (cstring_toCharsSafe (fname), 
		     O_RDWR | O_CREAT | O_TRUNC | O_EXCL,
		     _S_IREAD | _S_IWRITE);
# else
  int fdesc = open (cstring_toCharsSafe (fname), 
		    O_RDWR | O_CREAT | O_TRUNC | O_EXCL, 
		    S_IRUSR | S_IWUSR);
# endif

  if (fdesc == -1)
    {
      osd_setTempError ();
      llfatalerror (message ("Temporary file for "
			     "pre-processor output already exists.  Trying to "
			     "open: %s.",
			     fname));

      /*@notreached@*/ return NULL;
    }
  else
    {
      FILE *res = fdopen (fdesc, "w+");
  
      if (res != NULL) 
	{
	  fileTable_addOpen (ft, res, cstring_copy (fname));
	  DPRINTF (("Opening file: %s / %p", fname, res));
	}
      else
	{
	  DPRINTF (("Error opening: %s", fname));
	}

      return res;
    }
}

FILE *fileTable_openReadFile (fileTable ft, cstring fname)
{
  FILE *res = fopen (cstring_toCharsSafe (fname), "r");

  if (res != NULL) 
    {
      fileTable_addOpen (ft, res, cstring_copy (fname));
      DPRINTF (("Opening read file: %s / %p", fname, res));
    }
  else
    {
      DPRINTF (("Cannot open read file: %s", fname));
    }

  return res;
}

/*
** Allows overwriting
*/

FILE *fileTable_openWriteFile (fileTable ft, cstring fname)
{
  FILE *res = fopen (cstring_toCharsSafe (fname), "w");

  if (res != NULL) {
    fileTable_addOpen (ft, res, cstring_copy (fname));
    DPRINTF (("Opening file: %s / %p", fname, res));
  }

  return res;
}

FILE *fileTable_openWriteUpdateFile (fileTable ft, cstring fname)
{
  FILE *res = fopen (cstring_toCharsSafe (fname), "w+");

  if (res != NULL) {
    fileTable_addOpen (ft, res, cstring_copy (fname));
    DPRINTF (("Opening file: %s / %p", fname, res));
  }

  return res;
}

bool fileTable_closeFile (fileTable ft, FILE *f)
{
  bool foundit = FALSE;
  int i = 0;

  llassert (fileTable_isDefined (ft));

  DPRINTF (("Closing file: %p", f));

  for (i = 0; i < ft->nopen; i++) 
    {
      if (ft->openelements[i]->f == f)
	{
	  DPRINTF (("Closing file: %p = %s", f, ft->openelements[i]->fname));
	  
	  if (i == ft->nopen - 1)
	    {
	      foentry_free (ft->openelements[i]);
	      ft->openelements[i] = NULL;
	    }
	  else
	    {
	      foentry_free (ft->openelements[i]);
	      ft->openelements[i] = ft->openelements[ft->nopen - 1];
	      ft->openelements[ft->nopen - 1] = NULL;
	    }

	  ft->nopen--;
	  ft->nopenspace++;
	  foundit = TRUE;
	  break;
	}
    }
  
  llassert (foundit);
  return (fclose (f) == 0);
}

void fileTable_closeAll (fileTable ft)
{
  int i = 0;

  llassert (fileTable_isDefined (ft));

  for (i = 0; i < ft->nopen; i++) 
    {
      /* 
	 lldiagmsg (message ("Unclosed file at exit: %s", ft->openelements[i]->fname)); 
      */
      
      if (ft->openelements[i]->f != NULL)
	{
	  (void) fclose (ft->openelements[i]->f); /* No check - cleaning up after errors */
	}

      ft->openelements[i]->f = NULL;
      foentry_free (ft->openelements[i]);
      ft->openelements[i] = NULL;
    }
  
  ft->nopenspace += ft->nopen;
  ft->nopen = 0;
}

splint-3.1.2.dfsg1/src/cstringTable.c0000644021234200000250000002532610102766473015035 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** cstringTable.c
**
** Since hsearch defined in  only allows one hash table,
** I'll implement my own.
**
** Try to find a decent hash function, etc. later...
**
** cstringTable is from string -> unsigned
**
*/

# include "splintMacros.nf"
# include "basic.h"
# include "randomNumbers.h"

/*@constant null hbucket hbucket_undefined; @*/
# define hbucket_undefined 0

static void
cstringTable_addEntry (/*@notnull@*/ cstringTable p_h, /*@only@*/ hentry p_e) 
     /*@modifies p_h@*/ ;

static /*@nullwhentrue@*/ bool hbucket_isNull (/*@null@*/ hbucket h) 
{ 
  return (h == hbucket_undefined); 
}

static hentry hentry_create (/*@only@*/ cstring key, int val)
{
  hentry h = (hentry) dmalloc (sizeof (*h));

  h->key = key;
  h->val = val;
  llassert (val != HBUCKET_DNE); 
  return (h);
}

static void hentry_free (/*@only@*/ hentry h)
{
  cstring_free (h->key);
  sfree (h);
}

static bool
hbucket_isEmpty (hbucket h)
{
  return (h == hbucket_undefined || h->size == 0);
}

static cstring
hbucket_unparse (hbucket h)
{
  cstring s = cstring_undefined;

  if (!hbucket_isNull (h))
    {
      int i;
      
      for (i = 0; i < h->size; i++)
	{
	 s = message ("%q %s:%d", s, h->entries[i]->key, h->entries[i]->val);
	}
    }

  return s;
}

static hbucket
hbucket_single (/*@only@*/ hentry e)
{
  hbucket h = (hbucket) dmalloc (sizeof (*h));
  
  h->size = 1;
  h->nspace = HBUCKET_BASESIZE - 1;
  h->entries = (hentry *) dmalloc (HBUCKET_BASESIZE * sizeof (*h->entries));
 h->entries[0] = e;
  
  return (h);
}

static void
hbucket_grow (/*@notnull@*/ hbucket h)
{
  int i;
  hentry *newentries; 
  
  h->nspace += HBUCKET_BASESIZE;

  newentries = (hentry *) 
    dmalloc ((h->size + HBUCKET_BASESIZE) * sizeof (*newentries));
  
  for (i = 0; i < h->size; i++) 
    {
      newentries[i] = h->entries[i]; 
    }
 
  sfree (h->entries);
  h->entries = newentries; 
  /*@-compmempass@*/
} /*@=compmempass@*/ /* Spurious warnings reported - shouldn't need this */

static int hbucket_lookup (hbucket p_h, cstring p_key);

static bool hbucket_contains (hbucket p_h, cstring p_key) /*@*/ {
  return (hbucket_lookup (p_h, p_key) != HBUCKET_DNE);
}

/*
** bizarre duplicate behaviour
** required for duplicate entries
*/

static void
hbucket_add (/*@notnull@*/ hbucket h, /*@only@*/ hentry e)
{
  int exloc = hbucket_lookup (h, e->key);

  llassert (exloc == HBUCKET_DNE);
  
  if (h->nspace == 0)
    {
      hbucket_grow (h);
    }
  
  llassert (e->val != HBUCKET_DNE);
  h->entries[h->size] = e;
  h->size++;
  h->nspace--;
}

static int
hbucket_ncollisions (hbucket h)
{
  if (!hbucket_isNull (h) && (h->size > 1))
    return (h->size - 1);
  else
    return 0;
}

int
hbucket_lookup (hbucket h, cstring key)
{
  if (!hbucket_isNull (h))
    {
      int i;
      
      for (i = 0; i < h->size; i++)
	{
	 if (cstring_equal (h->entries[i]->key, key))
	    {
	      return h->entries[i]->val;
	    }
	}
    }

  return HBUCKET_DNE;
}

static
void hbucket_free (/*@only@*/ hbucket h)
{
  if (!hbucket_isNull (h))
    {
      int i;
      /* evans 2002-07-12: added this to free entries (splint warning had been suppressed) */
      for (i = 0; i < h->size; i++)
	{
	  hentry_free (h->entries[i]);
	}

      sfree (h->entries);
      sfree (h);
    }
}

void 
cstringTable_free (/*@only@*/ cstringTable h)
{
  unsigned long i;

  llassert (cstringTable_isDefined (h)); 

  for (i = 0; i < h->size; i++)
    {
      hbucket_free (h->buckets[i]);
    }

  sfree (h->buckets);
  sfree (h);
}
  
static int
cstringTable_countCollisions (cstringTable h)
{
  int nc = 0;
  unsigned long i;

  llassert (cstringTable_isDefined (h)); 

  for (i = 0; i < h->size; i++)
    {
     nc += hbucket_ncollisions (h->buckets[i]);
    }

  return (nc);
}


static int
cstringTable_countEmpty (cstringTable h)
{
  int nc = 0;
  unsigned long i;

  llassert (cstringTable_isDefined (h)); 

  for (i = 0; i < h->size; i++)
    {
       if (hbucket_isEmpty (h->buckets[i]))
	{
	  nc++;
	}
    }

  return (nc);
}

/*
** hash function snarfed from quake/hash.c Hash_String
** by Stephen Harrison
*/

static unsigned int 
cstringTable_hashValue (/*@notnull@*/ cstringTable h, cstring key)
{
  char *p;
  unsigned int hash_value = 0;

  for (p = cstring_toCharsSafe (key); *p != '\0'; p++)
    {
      hash_value = (hash_value << 1) ^ g_randomNumbers[*p % 256];
    }

  return (hash_value % h->size);
}

static /*@exposed@*/ hbucket
cstringTable_hash (/*@notnull@*/ cstringTable h, cstring key)
{
  return h->buckets[cstringTable_hashValue (h, key)];
}


/*@only@*/ cstringTable
cstringTable_create (unsigned long size)
{
  unsigned long i;
  cstringTable h = (cstringTable) dmalloc (sizeof (*h));
  
  h->size = size;
  h->nentries = 0;
  h->buckets = (hbucket *) dmalloc (sizeof (*h->buckets) * size);
  
  /*@+loopexec@*/
  for (i = 0; i < size; i++)
    {
       h->buckets[i] = hbucket_undefined;
    }
  /*@-loopexec@*/
  return h;
}

cstring cstringTable_unparse (cstringTable h)
{
  cstring res = cstring_newEmpty ();
  unsigned long i;

  if (cstringTable_isDefined (h)) 
    {
      for (i = 0; i < h->size; i++)
	{
	   hbucket hb = h->buckets[i];
	  
	  if (hb != NULL)
	    {
	      res = message ("%q%wl. %q\n", res, i, hbucket_unparse (hb));
	    }
	}
      
      res = message ("%qsize: %wl, collisions: %d, empty: %d", 
		     res,
		     h->size, 
		     cstringTable_countCollisions (h),
		     cstringTable_countEmpty (h));
    } 
  else
    {
      cstring_free (res);
      res = cstring_makeLiteral ("< empty cstring table >");
    }
  
  return res;
}


/*@only@*/ cstring
cstringTable_stats (cstringTable h)
{
  llassert (cstringTable_isDefined (h)); 
  return (message ("size: %wl, collisions: %d, empty: %d\n", 
		   h->size, cstringTable_countCollisions (h),
		   cstringTable_countEmpty (h)));
}

static void
cstringTable_rehash (/*@notnull@*/ cstringTable h)
{
  /*
  ** rehashing based (loosely) on code by Steve Harrison
  */

  unsigned long i;
  /* Fix provided by Thomas Mertz (int -> unsigned long), 21 Apr 2004 */
  unsigned long oldsize = h->size;
  unsigned long newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */
  hbucket *oldbuckets = h->buckets;
  
  h->size = newsize;  
  h->nentries = 0;
  h->buckets = (hbucket *) dmalloc (sizeof (*h->buckets) * newsize);

  /*@+loopexec@*/
  for (i = 0; i < newsize; i++)
    {
       h->buckets[i] = hbucket_undefined;
    }
  /*@=loopexec@*/
  
  for (i = 0; i < oldsize; i++)
    {
       hbucket bucket = oldbuckets[i];

       oldbuckets[i] = NULL;

      if (!hbucket_isNull (bucket))
	{
	  int j;
	  
	  for (j = 0; j < bucket->size; j++)
	    {
	       cstringTable_addEntry (h, bucket->entries[j]);
	    }
	  
	  /* 
	  ** evans 2001-03-24: new memory leak detected by Splint
	  **   after I fixed the checkCompletelyDestroyed.
	  */

	  sfree (bucket->entries);
	  sfree (bucket);
	}
    }
  
  sfree (oldbuckets);
}

static void
cstringTable_addEntry (/*@notnull@*/ cstringTable h, /*@only@*/ hentry e)
{
  unsigned int hindex = cstringTable_hashValue (h, e->key);

  /*
  ** using
  **   hbucket hb = h->buckets[hindex];  
  ** instead reveals a bug I don't want to deal with right now!
  */

   if (hbucket_isNull (h->buckets[hindex]))
    {
       h->buckets[hindex] = hbucket_single (e); 
      h->nentries++;
    }
  else
    {
      if (hbucket_contains (h->buckets[hindex], e->key)) {
	llcontbug 
	  (message
	   ("cstringTable: Attempt to add duplicate entry: %s "
	    "[previous value %d, new value %d]", 
	    e->key, cstringTable_lookup (h, e->key), e->val));
	hentry_free (e);
	return;
      }

      hbucket_add (h->buckets[hindex], e);
      h->nentries++;
    }
}

void
cstringTable_insert (cstringTable h, cstring key, int value)
{
  unsigned long hindex;
  hbucket hb;
  hentry e;  

  llassert (cstringTable_isDefined (h)); 

  h->nentries++;

  if (h->nentries * 162 > h->size * 100) 
    {
      cstringTable_rehash (h);
    }
  
  hindex = cstringTable_hashValue (h, key);
  e = hentry_create (key, value);

   hb = h->buckets[hindex];
  
  if (hbucket_isNull (hb))
    {
       h->buckets[hindex] = hbucket_single (e);
    }
  else
    {
      llassert (!hbucket_contains (hb, e->key));
      hbucket_add (hb, e);
    }
}

int
cstringTable_lookup (cstringTable h, cstring key)
{
  hbucket hb;
  llassert (cstringTable_isDefined (h));

  hb = cstringTable_hash (h, key);
  return (hbucket_lookup (hb, key));
}

void
cstringTable_update (cstringTable h, cstring key, int newval)
{
  hbucket hb;

  llassert (cstringTable_isDefined (h));

  hb = cstringTable_hash (h, key);

  if (!hbucket_isNull (hb))
    {
      int i;
      
      for (i = 0; i < hb->size; i++)
	{
	   if (cstring_equal (hb->entries[i]->key, key))
	    {
	           hb->entries[i]->val = newval;
	      return;
	    }
	}
    }

  llbug (message ("cstringTable_update: %s not found", key));
}

/*
** This is needed if oldkey is going to be released.
*/

void
cstringTable_replaceKey (cstringTable h, cstring oldkey, /*@only@*/ cstring newkey)
{
  hbucket hb;
  llassert (cstringTable_isDefined (h));
  
  hb = cstringTable_hash (h, oldkey);
  llassert (cstring_equal (oldkey, newkey));

  if (!hbucket_isNull (hb))
    {
      int i;
      
      for (i = 0; i < hb->size; i++)
	{
	   if (cstring_equal (hb->entries[i]->key, oldkey))
	    {
	      hb->entries[i]->key = newkey;
	      return;
	    }
	}
    }

  llbug (message ("cstringTable_replaceKey: %s not found", oldkey));
}

void
cstringTable_remove (cstringTable h, cstring key)
{
  hbucket hb;

  llassert (cstringTable_isDefined (h));
  hb = cstringTable_hash (h, key);

  if (!hbucket_isNull (hb))
    {
      int i;
      
      for (i = 0; i < hb->size; i++)
	{
	   if (cstring_equal (hb->entries[i]->key, key))
	    {
	      if (i < hb->size - 1)
		{
		  		  hb->entries[i] = hb->entries[hb->size - 1];
		}
	      
	      hb->size--;
	      return;
	    }
	}
    }

  llbug (message ("cstringTable_removeKey: %s not found", key));
}


splint-3.1.2.dfsg1/src/valueTable.c0000644021234200000250000000444507630461222014473 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** valueTable.c
** Based on genericTable.c
*/

# include "splintMacros.nf"
# include "basic.h"
# include "randomNumbers.h"

valueTable valueTable_copy (valueTable s)
{
  if (valueTable_size (s) > 0)
    {
      valueTable t;
      t = valueTable_create (valueTable_size (s));
      
      valueTable_elements (s, key, val) 
	{
	  valueTable_insert (t, cstring_copy (key), stateValue_copy (val));
	} end_valueTable_elements ;
	
	llassert (valueTable_size (s) == valueTable_size (t));
	return t;
    }
  else
    {
      return valueTable_undefined;
    }
}

cstring valueTable_unparse (valueTable h)
{
  cstring res = cstring_newEmpty ();

  valueTable_elements (h, key, val) {
    DPRINTF (("Using key: %s", key));
    res = message ("%q%s: %q [%q]; ", res, key, 
		   stateValue_unparseValue (val, context_lookupMetaStateInfo (key)),
		   stateValue_unparse (val));
  } end_valueTable_elements ;
  
  return res;
}

void valueTable_insert (valueTable h, cstring key, stateValue value)
{
  llassert (stateValue_isDefined (value));
  genericTable_insert ((genericTable) (h), key, (void *) (value));
}

void valueTable_update (valueTable h, cstring key, stateValue newval) 
{
  DPRINTF (("Update: %s -> %s", key, stateValue_unparse (newval)));
  llassert (stateValue_isDefined (newval));
  genericTable_update ((genericTable) (h), key, (void *) (newval));
}
splint-3.1.2.dfsg1/src/stateValue.c0000644021234200000250000001042407646432516014531 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** stateValue.c
*/

# include "splintMacros.nf"
# include "basic.h"

extern 
/*@notnull@*/ stateValue stateValue_create (int value, stateInfo info) {
  stateValue sv = (stateValue) dmalloc (sizeof (*sv));
  
  sv->value = value;
  sv->info = info;
  sv->implicit = FALSE;
  return sv;
}

extern 
/*@notnull@*/ stateValue stateValue_createImplicit (int value, stateInfo info) {
  stateValue sv = (stateValue) dmalloc (sizeof (*sv));
  
  sv->value = value;
  sv->info = info;
  sv->implicit = TRUE;
  return sv;
}

stateValue stateValue_copy (stateValue s) {
  stateValue res;
  llassert (stateValue_isDefined (s));
  res = stateValue_create (s->value, stateInfo_copy (s->info));
  res->implicit = s->implicit;
  return res;
}

bool stateValue_sameValue (stateValue s1, stateValue s2) 
{
  if (stateValue_isDefined (s1) && stateValue_isDefined (s2))
    {
      return s1->value == s2->value;
    }
  else
    {
      return !stateValue_isDefined (s1) && !stateValue_isDefined (s2);
    }
}

extern
cstring stateValue_unparse (stateValue s) {
  if (stateValue_isDefined (s))
    {
      return (message ("%d:%q", s->value, stateInfo_unparse (s->info)));
    }
  else
    {
      return (cstring_makeLiteral (""));
    }
}

void stateValue_updateValue (stateValue s, int value, stateInfo info) 
{
  llassert (stateValue_isDefined (s));
  s->value = value;
  
  if (stateInfo_isDefined (info)) {
    stateInfo_free (s->info);
    s->info = info;
  }
  
  DPRINTF (("update state value: %s", stateValue_unparse (s)));
}

void stateValue_updateValueLoc (stateValue s, int value, fileloc loc)
{
  llassert (stateValue_isDefined (s));

  DPRINTF (("Update state: %s -> %d at %s", stateValue_unparse (s), value, 
	    fileloc_unparse (loc)));

  s->value = value;
  s->info = stateInfo_updateLoc (s->info, SA_CHANGED, loc);
}
		  
void stateValue_update (stateValue res, stateValue val)
{
  llassert (stateValue_isDefined (res));
  llassert (stateValue_isDefined (val));

  res->value = val->value;
  res->info = stateInfo_update (res->info, val->info);

  DPRINTF (("update state: %s", stateValue_unparse (res)));
}
		  
void stateValue_show (stateValue s, metaStateInfo msinfo)
{
  if (stateValue_isDefined (s))
    {
      stateInfo info = stateValue_getInfo (s);
      
      if (stateInfo_isDefined (info))
	{
	  if (fileloc_isDefined (info->loc))
	    {
	      llgenindentmsg (message 
			      ("State becomes %q",
			       stateValue_unparseValue (s, msinfo)),
			      info->loc);
	    }
	}
    }
}

/*@only@*/ cstring stateValue_unparseValue (stateValue s, metaStateInfo msinfo)
{
  if (stateValue_isImplicit (s))
    {
      return message ("implicitly %s",
		      metaStateInfo_unparseValue (msinfo,
						  stateValue_getValue (s)));
    }
  else
    {
      return cstring_copy (metaStateInfo_unparseValue (msinfo,
						       stateValue_getValue (s)));
    }
}

int stateValue_getValue (stateValue s)
{
  if (!stateValue_isDefined (s))
    {
      llassert (stateValue_isDefined (s));
      return stateValue_error;
    }

  return s->value;
}

bool stateValue_isImplicit (stateValue s)
{
  llassert (stateValue_isDefined (s));
  return s->implicit;
}

stateInfo stateValue_getInfo (stateValue s)
{
  llassert (stateValue_isDefined (s));
  return s->info;
}

bool stateValue_hasLoc (stateValue s)
{
  return (fileloc_isDefined (stateValue_getLoc (s)));
}
splint-3.1.2.dfsg1/src/llerror.c0000644021234200000250000013224607716314756014107 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** llerror.c
**
** error reporting procedures
*/

# include "splintMacros.nf"
# include 
# include 
# include "basic.h"
# include "llmain.h"
# include "cpperror.h"
# include "Headers/version.h" /* Visual C++ finds a different version.h on some path! */

/* Don't allow possibly-recursive assertion failures. */
# undef llassert
# define llassert llassertprotect

static void printIndentMessage (FILE *p_stream, /*@only@*/ cstring p_sc, int p_indent)
   /*@modifies *p_stream@*/ ;

static bool s_scanOpen = FALSE;
static int s_lclerrors = 0;
static size_t s_lastfileloclen = 10;
static /*@only@*/ cstring s_lastmsg = cstring_undefined;
static int s_mcount = 0;
static /*@only@*/ cstring saveOneMessage = cstring_undefined;
static /*@only@*/ fileloc lastparseerror = fileloc_undefined;
static /*@only@*/ fileloc lastbug = fileloc_undefined;
static bool llgenerrorreal (flagcode p_code, 
			    char *p_srcFile, int p_srcLine, 
			    /*@only@*/ cstring p_s,
			    /*@temp@*/ cstring p_addtext,
			    fileloc p_fl, bool p_iserror, bool p_indent)
                 /*@modifies g_warningstream@*/ ;
static bool llgenerroraux (flagcode p_code, char *p_srcFile, int p_srcLine, 
			   /*@only@*/ cstring p_s,
			   /*@temp@*/ cstring p_addtext,
			   fileloc p_fl, bool p_iserror, bool p_indent)
                 /*@modifies g_warningstream@*/ ;

static void generateCSV (flagcode p_code, cstring p_s, cstring p_addtext, fileloc p_fl) 
     /*@modifies g_csvstream@*/ ;

static void printError (FILE *p_stream, /*@only@*/ cstring p_sc)
   /*@globals s_lastfileloclen @*/
   /*@modifies *p_stream@*/ ;
static void printMessage (FILE *p_stream, /*@only@*/ cstring p_s)
   /*@modifies *p_stream@*/ ;

static void llgenhint (/*@only@*/ cstring p_s) /*@modifies g_warningstream@*/ ;

static void showSourceLoc (char *srcFile, int srcLine)
     /*@modifies g_warningstream@*/
{
  if (context_getFlag (FLG_SHOWSOURCELOC)) {
    llgenhint (message ("%s:%d: Source code error generation point.",
			cstring_fromChars (srcFile), srcLine));
  }
  
}

static /*@null@*/ char *
maxcp (/*@null@*/ /*@returned@*/ char *a, /*@null@*/ /*@returned@*/ char *b)
{
  if (a > b) return a;
  else return b;
}

static void
printBugReport (void)
{
  fprintf (g_errorstream, "     *** Please report bug to %s ***\n",
	   SPLINT_MAINTAINER);
  llflush ();
  /* don't exit (EXIT_FAILURE); */
}

static bool s_needsPrepare = TRUE;

void prepareMessage ()
{
  DPRINTF (("Prepare message: %s", bool_unparse (context_loadingLibrary ())));
  showHerald ();

  if ((context_isPreprocessing () || context_loadingLibrary ())
      && s_needsPrepare
      && context_getFlag (FLG_SHOWSCAN))
    {
      llflush ();
      displayScanClose ();
      s_needsPrepare = FALSE;
    }

  llflush ();
}

void closeMessage (void)
{
  if (context_isPreprocessing ()
      && context_getFlag (FLG_SHOWSCAN))
    {
      llflush ();
      displayScanOpen (cstring_makeLiteral ("more preprocessing ."));
      llassertprotect (!s_needsPrepare);
      s_needsPrepare = TRUE;
    }
  else
    {
      llflush ();
    }
}

void
llmsg (/*@only@*/ cstring s)
{
  context_setNeednl ();
  prepareMessage ();
  printMessage (g_messagestream, s);
  closeMessage ();
}

void
lldiagmsg (/*@only@*/ cstring s)
{
  static bool inmsg = FALSE;

  if (inmsg)
    {
      fprintf (g_errorstream,
	       "Recursive message call detected: %s\n", 
	       cstring_toCharsSafe (s));
      llexit (LLFAILURE);
    }

  inmsg = TRUE;

  context_setNeednl ();
  prepareMessage ();
  printMessage (g_messagestream, s);
  closeMessage ();

  inmsg = FALSE;
}

void
llmsgplain (/*@only@*/ cstring s)
{
  context_setNeednl ();
  prepareMessage ();
  printMessage (g_messagestream, s);
  closeMessage ();
}

void llerror_flagWarning (cstring s)
{
  if (context_getFlag (FLG_WARNFLAGS))
    {
      llgenmsg (s, g_currentloc);
    }
  else
    {
      cstring_free (s);
    }
}

static void
llgenhint (/*@only@*/ cstring s) /*@modifies g_warningstream@*/
{
  int indent = context_getIndentSpaces () - 1;

  if (indent < 0) indent = 0;

  context_setNeednl ();
  printIndentMessage (g_warningstream, s, indent);
}

void
llhint (cstring s)
{
  if (context_getFlag (FLG_HINTS) &&
      !(context_inSuppressRegion () || context_inSuppressZone (g_currentloc)))
    {
      llgenhint (s);
    }
  else
    {
      cstring_free (s);
    }
}

static void
llshowhint (flagcode f)
{
  if (context_getFlag (FLG_HINTS))
    {
      if ((flagcode_numReported (f) == 0) || context_getFlag (FLG_FORCEHINTS))
	{
	  cstring desc = flagcodeHint (f);

	  if (cstring_isDefined (desc))
	    {
	      llgenhint (cstring_copy (desc));
	    }
	}
    }
}

static void
llsuppresshint2 (char c, flagcode f1, flagcode f2)
{

  if (context_getFlag (FLG_HINTS))
    {
      if ((flagcode_numReported (f1) == 0
	   || flagcode_numReported (f2) == 0)
	  || context_getFlag (FLG_FORCEHINTS))
	{
	  cstring desc = flagcodeHint (f1);
	  context_setNeednl ();
	  s_lastfileloclen = 8;

	  if (cstring_isUndefined (desc))
	    {
	      desc = flagcodeHint (f2);
	    }

	  if (flagcode_isNamePrefixFlag (f1))
	    {
	      f1 = FLG_NAMECHECKS;
	    }

	  if (flagcode_isNamePrefixFlag (f2))
	    {
	      f2 = FLG_NAMECHECKS;
	    }

	  if (f1 == f2)
	    {
	      if (cstring_isDefined (desc))
		{
		  llgenhint (message ("%s (Use %h%s to inhibit warning)", desc,
				      c,
				      flagcode_unparse (f1)));
		}
	      else
		{
		  llgenhint (message ("(Use %h%s to inhibit warning)", 
				      c, flagcode_unparse (f1)));
		}
	    }
	  else
	    {
	      if (cstring_isDefined (desc))
		{
		  llgenhint (message ("%s (Use either %h%s or %h%s to inhibit warning)", desc, 
				      c,
				      flagcode_unparse (f1),
				      c,
				      flagcode_unparse (f2)));
		}
	      else
		{
		  llgenhint (message ("(Use either %h%s or %h%s to inhibit warning)", c,
				      flagcode_unparse (f1),
				      c, flagcode_unparse (f2)));
		}
	    }
	}
    }
}

static void
llsuppresshint (char c, flagcode f)
{
  if (context_getFlag (FLG_HINTS))
    {
      if ((flagcode_numReported (f) == 0) || context_getFlag (FLG_FORCEHINTS))
	{
	  cstring desc = flagcodeHint (f);
	  context_setNeednl ();
	  s_lastfileloclen = 8;

	  if (flagcode_isNamePrefixFlag (f))
	    {
	      f = FLG_NAMECHECKS;
	    }

	  if (cstring_isDefined (desc))
	    {
	      llgenhint (message ("%s (Use %h%s to inhibit warning)", desc, c,
				  flagcode_unparse (f)));
	    }
	  else
	    {
	      llgenhint (message ("(Use %h%s to inhibit warning)", c,
				  flagcode_unparse (f)));
	    }
	}
    }
}

static void
llnosuppresshint (flagcode f)
{
  if (context_getFlag (FLG_FORCEHINTS))
    {
      cstring desc = flagcodeHint (f);
      context_setNeednl ();
      s_lastfileloclen = 8;

      if (cstring_isDefined (desc))
	{
	  printError (g_warningstream, message ("    %s", desc));
	}
    }
}

/*@constant int MAXSEARCH; @*/
# define MAXSEARCH 20

/*@constant int MINLINE; @*/
# define MINLINE 35

typedef /*@null@*/ /*@dependent@*/ char *nd_charp;

/*
** mstring_split
**
** Divides a string into lines of up to maxline characters.
**
** Initial string: *sp
**
** Output split: *sp / *tp
**                     possibly null
*/

static void
mstring_split (/*@returned@*/ char **sp,
	       /*@out@*/ nd_charp *tp,
	       int maxline, /*@in@*/ int *indentchars)
{
  char *nl;
  char *t;
  char *s = *sp;
  char *osp = *sp;

  *tp = NULL;

  DPRINTF (("Split: %s / %d", *sp, maxline));

  if (maxline < MINLINELEN)
    {
      maxline = MINLINELEN;
    }

  if (*indentchars > 0)
    {
      s = *sp = mstring_concatFree1 (mstring_spaces (*indentchars), s);
      osp = s;
    }

  /*
  ** splitting:
  **
  **    if there is a newline in first maxline characters, split there
  **    if line len is <= maxline, return no split
  **    if there is a ':' or ';' or ',' followed by ' ' in first maxline characters,
  **       split there unless the ' ' is followed by a '}', then
  **       split after '}'
  **       of the ';' is inside quotation marks
  **    if there is a space or tab in last maxsearch characters, split there
  **    else, split at maxline
  **
  **    special code: slash [1-9] after a newline means indent the rest  chars
  **
  */

  nl = strchr (s, '\n');

  if ((nl != NULL) && ((nl - s) < maxline))
    {
      *nl = '\0';
      t = nl + 1;

      if (*t == '\0')
	{
	  llassertprotect (*tp == NULL || (*tp > osp));
	  return;
	}

      if (*t >= '\1' && *t <= '\7')
	{
	  *indentchars += (int) (*t - '\1') + 1;
	  t++;
	}
      
      *tp = t;
      return;
    }
  else if (size_toInt (strlen (s)) < maxline)
    {
      llassertprotect (*tp == NULL);
      return;
    }
  else
    {
      int i = 0;
      char savechar;
      char *lcolon, *lsemi, *lcomma;
      char *splitat;
      
      splitat = NULL;

      t = s + maxline - 1;
      savechar = *t;

      *t = '\0';
      lcolon = strrchr (s, ':');
      lsemi = strrchr (s, ';');
      lcomma = strrchr (s, ',');

      *t = savechar;

      splitat = maxcp (lcolon, lsemi);

      if (splitat != NULL && ((int)(splitat - s) > MINLINE)
	  && *(splitat) != '\0'
	  && *(splitat + 1) == ' ' 
	  && (*(splitat + 2) != '}'
	      && *(splitat + 2) != ',' 
	      && (*(splitat + 2) != '\0'))) 
	{
	  *(splitat + 1) = '\0';
	  t = splitat + 2;
	  *tp = t;
	  llassertprotect (*tp == NULL || (*tp > osp));
	  return;
	}

      if (lcomma != NULL && ((lcomma - s) > maxline - 5))
	{
	  splitat = lcomma;
	  
	  if (splitat != NULL && ((int)(splitat - s) > MINLINE)
	      && *(splitat) != '\0'
	      && *(splitat + 1) == ' ' 
	      && (*(splitat + 2) != '}'
		  && (*(splitat + 2) != '\0'))) 
	    {
	      *(splitat + 1) = '\0';
	      t = splitat + 2;
	      *tp = t;
	      llassertprotect (*tp == NULL || (*tp > osp));
	      return;
	    }
	}
      
      /*
      ** Search for any breaking point (at least 4 letters past s)
      */

      while (*t != ' ' && *t != '\t' && i < MAXSEARCH && t > (s + 4))
	{
	  t--;
	  i++;
	}

      if (*t != ' ' && *t != '\t')
	{
	  llassertprotect (maxline > 0);
	  t = mstring_copy (s + maxline);
	  *(s + maxline) = '\0';

	  if (*t == '\0')
	    {
	      sfree (t);
	      llassertprotect (*tp == NULL || (*tp > osp));
	      return;
	    }

	  mstring_markFree (t);
	  *tp = t;
	  /* Won't be true since t is a copy: llassertprotect (*tp == NULL || (*tp > osp)); */
	  return;
	}
      else
	{

	  *t = '\0';
	  t++;
	  
	  if (*t == '\0') return;

	  /*
	  ** returns unqualified as only
	  */

	  *tp = t;

	  llassert (*sp != *tp);
	  return;
	}
    }

  BADBRANCH;
}

static
void limitmessage (/*@only@*/ cstring s, fileloc loc)
{
  if (s_mcount > context_getLimit () + 1)
    {
      cstring_free (s);
    }
  else
    {
      cstring flstring = fileloc_unparse (loc);

      s_lastfileloclen = cstring_length (flstring);
      cstring_free (saveOneMessage);
      saveOneMessage = message ("%q: %q", flstring, s);
    }
}

static int parseerrorcount = 0;

void cleanupMessages ()
{
  parseerrorcount = 0;

  if (context_unlimitedMessages ())
    {
     ;
    }
  else
    {
      int unprinted = s_mcount - context_getLimit ();

      if (unprinted > 0)
	{
	  if (unprinted == 1 && cstring_isDefined (saveOneMessage))
	    {
	      prepareMessage ();
	      printError (g_warningstream, saveOneMessage);
	      closeMessage ();
	      saveOneMessage = cstring_undefined;
	    }
	  else
	    {
	      if (cstring_isDefined (saveOneMessage))
		{
		  /* cstring_free (saveOneMessage); */
		  saveOneMessage = cstring_undefined;
		}

	      fprintf (g_warningstream, "%s: (%d more similar errors unprinted)\n",
		       cstring_toCharsSafe (fileloc_filename (g_currentloc)),
		       s_mcount - context_getLimit ());
	    }
	}
    }

  s_mcount = 0;
}

void
llgenmsg (/*@only@*/ cstring s, fileloc fl)
{
  cstring flstring = fileloc_unparse (fl);
  s_lastfileloclen = cstring_length (flstring);

  prepareMessage ();
  (void) printError (g_warningstream, message ("%q: %q", flstring, s));
  closeMessage ();
}

void
llgenindentmsg (/*@only@*/ cstring s, fileloc fl)
{
  cstring flstring = fileloc_unparse (fl);
  int indentspaces = context_getLocIndentSpaces ();
  prepareMessage ();
  
  (void) printIndentMessage (g_warningstream, message ("%q: %q", flstring, s),
			     indentspaces);

  closeMessage ();
}

void
llgenindentmsgnoloc (/*@only@*/ cstring s)
{
  prepareMessage ();
  (void) printIndentMessage (g_warningstream, s, context_getIndentSpaces ());
  closeMessage ();
}

static bool
llgentypeerroraux (char *srcFile, int srcLine,
		   flagcode ocode, ctype t1, exprNode e1, ctype t2, exprNode e2,
		   /*@only@*/ cstring s, fileloc fl)
{
  cstring hint = cstring_undefined;
  flagcode code = ocode;
  flagcode hcode = INVALID_FLAG;
  ctype ut1 = t1;
  ctype ut2 = t2;

  DPRINTF (("Type error [%s]: %s / %s : %s / %s",
	    flagcode_unparse (ocode),
	    exprNode_unparse (e1), exprNode_unparse (e2),
	    ctype_unparse (t1), ctype_unparse (t2)));
  
  DPRINTF (("Bool: %s / %s",
	    bool_unparse (ctype_isBool (t1)),
	    bool_unparse (ctype_isBool (t2))));

  /* 
  ** Set the flag using the underlying types that didn't match.
  */

  while (ctype_isPointer (ut1) && ctype_isPointer (ut2)) {
    ut1 = ctype_baseArrayPtr (ut1);
    ut2 = ctype_baseArrayPtr (ut2);
  }

  if (ctype_isRealNumAbstract (ut1) && exprNode_isNumLiteral (e2)) 
    {
      hcode = FLG_NUMABSTRACTLIT;
    }
  else if ((ctype_isFloat (ut1) && ctype_isDouble (ut2))
	   || (ctype_isFloat (ut1) && ctype_isDouble (ut2)))
    {
      hcode = FLG_FLOATDOUBLE;
    }
  else if ((exprNode_isCharLiteral (e1) && ctype_isInt (ut2))
	   || (exprNode_isCharLiteral (e2) && ctype_isInt (ut1)))
    {
      hcode = FLG_CHARINTLITERAL;
    }
  else if ((exprNode_isNumLiteral (e1) && ctype_isReal (ut2))
	   || (exprNode_isNumLiteral (e2) && ctype_isReal (ut1)))
    {
      hcode = FLG_NUMLITERAL;
    }
  else if ((ctype_isManifestBool (ut1) && ctype_isInt (ut2))
	   || (ctype_isInt (ut1) && ctype_isManifestBool (ut2)))
    /* evs 2000-07-24: was ctype_isDirectBool */
    {
      hcode = FLG_BOOLINT;
    }
  else if (((ctype_isChar (ut1) && !ctype_isInt (ut1)) && ctype_isInt (ut2))
	   || ((ctype_isInt (ut1) && (ctype_isChar (ut2) && !ctype_isInt (ut2)))))
    {
      hcode = FLG_CHARINT;
    }
  else if ((ctype_isInt (ut1) && ctype_isInt (ut2))
	   || (ctype_isChar (ut1) && ctype_isChar (ut2))
	   || (ctype_isDouble (ut1) && ctype_isDouble (ut2)))
    {
      if (!bool_equal (ctype_isSigned (ut1), ctype_isSigned (ut2)))
	{
	  if (ctype_isArbitraryIntegral (ctype_realType (ut1))
	      && !ctype_isArbitraryIntegral (ctype_realType (ut2)))
	    {
	      hcode = FLG_MATCHANYINTEGRAL;
	    }
	  else if (ctype_isArbitraryIntegral (ctype_realType (ut2))
		   && !ctype_isArbitraryIntegral (ctype_realType (ut1)))
	    {
	      hcode = FLG_MATCHANYINTEGRAL;
	    }
	  else
	    /*drl 4-270-2003 even if ignoresigns is set there may be another
	      problem that is causing splint to complain about a type error.
	      Don't tell the user that they can add +ignoresigns if it's
	      already on*/
	    {
	      DPRINTF(("TEST INGORESIGNS"));
	      if (context_getFlag(FLG_IGNORESIGNS) )
		{
		  DPRINTF(("INGORESIGNS SET"));
		  hcode = FLG_IGNOREQUALS;
		}
	    
	      else
		{
		  DPRINTF(("INGORESIGNS NOT SET"));
		  hcode = FLG_IGNORESIGNS;
		}
	    }
	}
      else
	{
	  hcode = FLG_IGNOREQUALS;
	}
    }
  else if (ctype_isArbitraryIntegral (ctype_realType (ut1)))
    {
      DPRINTF (("HERE: %s", ctype_unparse (ctype_realType (ut2))));

      if (ctype_isArbitraryIntegral (ctype_realType (ut2)))
	{
	  hcode = FLG_MATCHANYINTEGRAL;
	}
      else if (ctype_equal (ut2, ctype_ulint))
	{
	  hcode = FLG_LONGUNSIGNEDINTEGRAL;
	}
      else if (ctype_equal (ut2, ctype_lint))
	{
	  hcode = FLG_LONGINTEGRAL;
	}
      else if (ctype_isInt (ut2))
	{
	  hcode = FLG_MATCHANYINTEGRAL;
	}	  
      else
	{
	  hcode = FLG_TYPE;
	}
    }
  else if (ctype_isArbitraryIntegral (ctype_realType (ut2)))
    {
      ctype tr = ctype_realType (ut1);

      if (ctype_isArbitraryIntegral (tr))
	{
	  hcode = FLG_MATCHANYINTEGRAL;
	}
      else if (ctype_match (ut1, ctype_ulint))
	{
	  if (ctype_isUnsignedIntegral (tr))
	    {
	      hcode = FLG_LONGUNSIGNEDUNSIGNEDINTEGRAL;
	    }
	  else if (ctype_isSignedIntegral (tr))
	    {
	      ;
	    }
	  else
	    {
	      hcode = FLG_LONGUNSIGNEDINTEGRAL;
	    }
	}
      else if (ctype_match (ut1, ctype_lint))
	{
	  if (ctype_isSignedIntegral (tr))
	    {
	      hcode = FLG_LONGSIGNEDINTEGRAL;
	    }
	  else if (ctype_isSignedIntegral (tr))
	    {
	      ;
	    }
	  else
	    {
	      hcode = FLG_LONGINTEGRAL;
	    }
	}
      else if (ctype_isInt (ut1))
	{
	  hcode = FLG_MATCHANYINTEGRAL;
	}
      else
	{
	  ;
	}
    }
  else
    {
      ;
    }

  if (hcode == INVALID_FLAG)
    {
      DPRINTF (("[%s] %s - %s / %s",
		ctype_unparse (ut1),
		bool_unparse (ctype_isEnum (ut1)),
		bool_unparse (ctype_isEnum (ctype_realType (ut1))),
		bool_unparse (ctype_isInt (ut2))));

      if (ctype_isAbstract (ut1) && !ctype_isAbstract (ut2))
	{
	  uentry ue1 = usymtab_getTypeEntry (ctype_typeId (ut1));
	  ctype ct = uentry_getType (ue1);
	  
	  if (ctype_match (ct, ut2))
	    {
	      code = FLG_ABSTRACT;
	      hint = message ("Underlying types match, but %s is an "
			      "abstract type that is not accessible here.",
			      ctype_unparse (t1));
	    }
	}
      else if (ctype_isAbstract (ut2) && !ctype_isAbstract (ut1))
	{
	  uentry ue = usymtab_getTypeEntry (ctype_typeId (ut2));
	  ctype ct = uentry_getType (ue);
	  
	  if (ctype_match (ct, ut1))
	    {
	      if (ctype_isNumAbstract (ut2)) 
		{
		  if (exprNode_isNumLiteral (e1))
		    {
		      code = FLG_NUMABSTRACTLIT;
		      hint = message ("Underlying types match, but %s is a "
				      "numabstract type that is not accessible here. "
				      "(Use +numabstractlit to allow numeric literals "
				      "to be used as numabstract type values.)",
				      ctype_unparse (t2));
		    }
		  else
		    {
		      code = FLG_NUMABSTRACT;
		      hint = message ("Underlying types match, but %s is a "
				      "numabstract type that is not accessible here.",
				      ctype_unparse (t2));
		    }
		}
	      else
		{
		  code = FLG_ABSTRACT;
		  hint = message ("Underlying types match, but %s is an "
				  "abstract type that is not accessible here.",
				  ctype_unparse (t2));
		}
	    }
	}
      else
	{
	  ; /* Not an abstract mismatch. */
	}
				       

      if (hcode == INVALID_FLAG)
	{
	  if ((ctype_isEnum (ut1) && ctype_isInt (ut2))
	      || (ctype_isEnum (ut2) && ctype_isInt (ut1))) 
	    {
	      hcode = FLG_ENUMINT;
	    }
	  else if ((ctype_isEnum (ut1) && ctype_isInt (ut2))
		   || (ctype_isEnum (ut2) && ctype_isInt (ut1))) 
	    {
	      hcode = FLG_ENUMINT;
	    }
	  else if ((ctype_isSignedChar (ut1) && ctype_isUnsignedChar (ut2))
		   || (ctype_isUnsignedChar (ut1) && ctype_isSignedChar (ut2)))
	    {
	      hcode = FLG_CHARUNSIGNEDCHAR;
	    }
	  else if (ctype_isNumeric (ut1) && ctype_isNumeric (ut2)) 
	    {
	      hcode = FLG_RELAXTYPES;
	      DPRINTF (("Setting relax types!"));
	    }
	  else
	    {
	      DPRINTF (("No special type rule: %s / %s", ctype_unparse (ut1),
			ctype_unparse (ut2)));
	    }
	}
    }

  if (cstring_isDefined (hint))
    {
      if (!context_suppressFlagMsg (ocode, fl))
	{
	  return xllgenhinterror (srcFile, srcLine, code, s, hint, fl);
	}
      else
	{
	  cstring_free (s);
	  cstring_free (hint);
	  return FALSE;
	}
    }
  else
    {
      if (hcode != INVALID_FLAG && hcode != ocode)
	{
	  code = hcode;
	}
      
      if (llgenerroraux (ocode, srcFile, srcLine, s,
			 flagcodeHint (code), fl, TRUE, FALSE))
	{
	  if (code != ocode) 
	    {
	      if (context_flagOn (code, fl))
		{
		  /* The flag is alreay set, something buggy in the flag code */
		  llcontbug (message ("No hint available, flag %s is already set.",
				      flagcode_unparse (code)));
		}
	      else
		{
		  llshowhint (code);
		}
	  } 
	  else
	    {
	      llsuppresshint ('-', code);
	    }

	  flagcode_recordError (code);
	  return TRUE;
	}

      return FALSE;
    }
}

bool
xllgentypeerror (char *srcFile, int srcLine,
		 ctype t1, exprNode e1, ctype t2, exprNode e2,
		 /*@only@*/ cstring s, fileloc fl)
{
  return llgentypeerroraux (srcFile, srcLine, FLG_TYPE, t1, e1, t2, e2, s, fl);
}

bool
xllgenformattypeerror (char *srcFile, int srcLine,
		       ctype t1, exprNode e1, ctype t2, exprNode e2,
		       /*@only@*/ cstring s, fileloc fl)
{
  if (!context_suppressFlagMsg (FLG_FORMATTYPE, fl))
    {
      if (ctype_isInt (t1)
	  && ctype_isNumAbstract (t2))
	{
	  if (!context_suppressFlagMsg (FLG_NUMABSTRACTPRINT, fl))
	    {
	      return llgentypeerroraux (srcFile, srcLine, FLG_NUMABSTRACTPRINT, t1, e1, t2, e2, s, fl);
	    }
	  else
	    {
	      return FALSE;
	    }
	}
      else
	{
	  return llgentypeerroraux (srcFile, srcLine, FLG_FORMATTYPE, t1, e1, t2, e2, s, fl);
	}
    }
  else
    {
      cstring_free (s);
      return FALSE;
    }
}

bool
xllgenerror (char *srcFile, int srcLine, flagcode o, /*@only@*/ cstring s, fileloc fl)
{
  if (llgenerroraux (o, srcFile, srcLine, s, flagcodeHint (o), fl, TRUE, FALSE))
    {
      llnosuppresshint (o);
      flagcode_recordError (o);
      closeMessage ();
      return TRUE;
    }
  else
    {
      flagcode_recordSuppressed (o);
      return FALSE;
    }
}

bool
xllgenhinterror (char *srcFile, int srcLine,
		 flagcode o, /*@only@*/ cstring s, /*@only@*/ cstring hint,
		 fileloc fl)
{
  if (!context_suppressFlagMsg (o, fl))
    {
      if (llgenerroraux (o, srcFile, srcLine, s, hint, fl, TRUE, FALSE))
	{
	  flagcode_recordError (o);

	  if (context_getFlag (FLG_HINTS))
	    {
	      llgenhint (hint);
	    }
	  else
	    {
	      cstring_free (hint);
	    }

	  closeMessage ();
	  return TRUE;
	}

      cstring_free (hint);
    }
  else
    {
      cstring_free (hint);
      cstring_free (s);
    }

  flagcode_recordSuppressed (o);
  return FALSE;
}

static bool
llrealerror (flagcode code, char *srcFile, int srcLine, /*@only@*/ cstring s, /*@temp@*/ cstring addtext, fileloc fl)
{
  return (llgenerrorreal (code, srcFile, srcLine, s, addtext, fl, TRUE, FALSE));
}

static bool
llgenerroraux (flagcode code,
	       char *srcFile, int srcLine,
	       /*@only@*/ cstring s, 
	       cstring addtext,
	       fileloc fl, bool iserror, bool indent)
{
  if (context_inSuppressZone (fl))
    {
      cstring_free (s);
      return FALSE;
    }
  
  if (llgenerrorreal (code, srcFile, srcLine, s, addtext, fl, iserror, indent)) {
    return TRUE;
  } else {
    return FALSE;
  }
}

bool
xllforceerror (char *srcFile, int srcLine, 
	       flagcode code, /*@only@*/ cstring s, fileloc fl)
{
  flagcode_recordError (code);

  if (llgenerrorreal (code, srcFile, srcLine, s, cstring_undefined, fl, TRUE, FALSE)) {
    closeMessage ();
    return TRUE;
  } else {
    return FALSE;
  }
}

static void generateCSV (flagcode code, cstring s, cstring addtext, fileloc fl)
{

  if (g_csvstream != NULL) {
    /* Warning, Flag Code, Flag Name, Priority, File, Line, Column, Warning Text, Additional Text */
    fprintf (g_csvstream, "%d,%d,%s,%d,%s,%d,%d,\"%s\"",
	     context_numErrors (),
	     (int) code, /* flag code */
	     cstring_toCharsSafe (flagcode_unparse (code)), /* flag name */
	     flagcode_priority (code), /* priority */
	     cstring_toCharsSafe (fileloc_outputFilename (fl)),
	     fileloc_lineno (fl),
	     fileloc_column (fl),
	     cstring_toCharsSafe (s));

    if (cstring_isDefined (addtext)) {
      fprintf (g_csvstream, ",\"%s\"\n", cstring_toCharsSafe (addtext));
    } else {
      fprintf (g_csvstream, "\n");
    }
  }
}

static bool
llgenerrorreal (flagcode code, char *srcFile, int srcLine, 
		/*@only@*/ cstring s, 
		cstring addtext,
		fileloc fl, bool iserror, bool indent)
{
  cstring flstring;

  /* duplicate message (rescanning a header file */

  if (!messageLog_add (context_messageLog (), fl, s))
    {
      DPRINTF (("Duplicate message suppressed! %s / %s",
		fileloc_unparse (fl), s));
      cstring_free (s);
      return FALSE;
    }

  /*
  ** If herald has not been displayed, display it before the first message.
  */

  showHerald ();

  if (iserror) context_hasError ();

  if (context_unlimitedMessages ())
    {
      ;
    }
  else
    {
      /*
      ** suppress excessive messages:
      **    check up to ':'
      **
      */

      char *sc = cstring_toCharsSafe (s);
      char *tmpmsg = strchr (sc, ':');

      if (tmpmsg == NULL)
	{
	  tmpmsg = sc;
	}
      else
	{
	  char *savechar = tmpmsg;
	  *tmpmsg = '\0';
	  tmpmsg = sc;
	  *savechar = ':';
	}

      if (cstring_equal (s_lastmsg, cstring_fromChars (tmpmsg)))
	{
	  s_mcount++;
	  if (s_mcount == (context_getLimit () + 1))
	    {
	      limitmessage (s, fl);
	      return FALSE;
	    }

	  if (s_mcount > (context_getLimit ()))
	    {
	      cstring_free (s);
	      return FALSE;
	    }
	}
      else
	{
	  cleanupMessages ();
	  s_mcount = 0;
	  cstring_free (s_lastmsg);
	  s_lastmsg = cstring_fromCharsNew (tmpmsg);
	}
    }

  DPRINTF (("Here..."));

  if (context_hasAliasAnnote ())
    {
      char *sc = cstring_toCharsSafe (s);
      char *fcolon = strchr (sc, ':');
      cstring a = context_getAliasAnnote ();


      if (fcolon == NULL)
	{
	  s = message ("%q (%q)", s, a);
	}
      else
	{
	  cstring afterColon;

	  *fcolon = '\0';
	  afterColon = cstring_fromCharsNew (fcolon + 1);

	  s = message ("%q (%q):%q", s, a, afterColon);
	}
          }

  if (context_hasMessageAnnote ())
    {
      char *fcolon = strchr (cstring_toCharsSafe (s), ':');


      if (fcolon == NULL)
	{
	  /*@-dependenttrans@*/ /* s becomes dependent for fcolon */
	  s = message ("%q (%q)", s, context_getMessageAnnote ());
	  /*@=dependenttrans@*/
	}
      else
	{
	  cstring afterColon;

	  *fcolon = '\0';
	  afterColon = cstring_fromCharsNew (fcolon + 1);

	  /*@-dependenttrans@*/ /* s becomes dependent for fcolon */
	  s = message ("%q (%q):%q", s,
		       context_getMessageAnnote (), afterColon);
	  /*@=dependenttrans@*/
	}
     }

  context_setNeednl ();
  prepareMessage ();

  if (context_showFunction ())
    {
      cstring fname = fileloc_unparseFilename (g_currentloc);

      if (context_inIterDef ())
	{
	  fprintf (g_warningstream, "%s: (in iter %s)\n",
		   cstring_toCharsSafe (fname),
		   cstring_toCharsSafe (context_inFunctionName ()));
	}
      else if (context_inIterEnd ())
	{
	  fprintf (g_warningstream, "%s: (in iter finalizer %s)\n",
		   cstring_toCharsSafe (fname),
		   cstring_toCharsSafe (context_inFunctionName ()));
	}
      else if (context_inMacro ())
	{
	  fprintf (g_warningstream, "%s: (in macro %s)\n", cstring_toCharsSafe (fname),
		   cstring_toCharsSafe (context_inFunctionName ()));
	}
      else
	{
	  fprintf (g_warningstream, "%s: (in function %s)\n",
		   cstring_toCharsSafe (fname),
		   cstring_toCharsSafe (context_inFunctionName ()));
	}

      cstring_free (fname);
      context_setShownFunction ();
    }

  flstring = fileloc_unparse (fl);
  s_lastfileloclen = cstring_length (flstring);

  generateCSV (code, s, addtext, fl);

  if (indent)
    {
      printError (g_warningstream, message ("   %q: %q", flstring, s));
    }
  else
    {
      printError (g_warningstream, message ("%q: %q", flstring, s));
    }

  showSourceLoc (srcFile, srcLine);
	     
  return TRUE;
}

/*
** printMessage
**
** message contains no '\n'
**    message fits in one line: print it
**    message fits in two lines with 3-space indent after fileloc: print it
**    split line with 5-space indent from left margin: print it
**
*/

static
void printMessage (FILE *stream, /*@only@*/ cstring s)
{
  printIndentMessage (stream, s, 0);
}

static
void printIndentMessage (FILE *stream, /*@only@*/ cstring sc, int indent)
{
  static bool inbody = FALSE;
  int maxlen = context_getLineLen ();
  char *s = cstring_toCharsSafe (sc);
  char *olds = NULL;

  llassertprotect (!inbody);
  inbody = TRUE;

  do
    {
      char *t = NULL;
      char *st = s;

      llassertprotect (st != olds);
      olds = st;
      mstring_split (&st, &t, maxlen, &indent);
      fprintf (stream, "%s\n", st);
      llassertprotect (t != s);
      s = t;
    } while (s != NULL) ;

  cstring_free (sc);
  inbody = FALSE;
}

static
void printError (FILE *stream, /*@only@*/ cstring sc)
{
  int maxlen = context_getLineLen ();
  size_t nspaces = s_lastfileloclen + 5;
  int nextlen = maxlen - size_toInt (nspaces);
  size_t len = cstring_length (sc);
  int indent = 0;
  char *s = cstring_toCharsSafe (sc);
  char *os = s;
  char *t = NULL;

  DPRINTF (("Print error: [%s]", sc));

  if (size_toInt (len) < (maxlen + nextlen) && (strchr (s, '\n') == NULL))
    {
      mstring_split (&s, &t, maxlen, &indent);

      fprintf (stream, "%s\n", s);

      if (t != NULL)
	{
	  len = mstring_length (t);

	  if (size_toInt (len) < (maxlen - 3) && (strchr (t, '\n') == NULL)
	      && size_toInt (len) > (nextlen - 1))
	    {
	      fprintf (stream, "    %s\n", t);
	    }
	  else
	    {
	      char *spaces = (char *) dmalloc ((nspaces + 1) * sizeof (*spaces));
	      int i;

	      for (i = 0; i < size_toInt (nspaces); i++)
		{
		  spaces[i] = ' ';
		}

	      spaces[nspaces] = '\0';

	      while (t != NULL)
		{
		  char *st = t;
		  mstring_split (&st, &t, nextlen, &indent);
		  fprintf (stream, "%s%s\n", spaces, st);
		}

	      sfree (spaces);
	    }
	}
    }
  else
    {
      DPRINTF (("Here 1: [%s]", sc));

      if (size_toInt (len) < (maxlen + maxlen - 1) && (strchr (s, '\n') != NULL))
	{
	  nspaces = ((maxlen + maxlen - 1) - len) / 2;

	  if (nspaces < 1) nspaces = 1;

	  nextlen = size_toInt (maxlen - nspaces);

	  mstring_split (&s, &t, maxlen, &indent);

	  fprintf (stream, "%s\n", s);

	  if (t != NULL)
	    {
	      char *spaces = (char *) dmalloc ((nspaces + 1) * sizeof (*spaces));
	      int i;

	      for (i = 0; i < size_toInt (nspaces); i++)
		{
		  spaces[i] = ' ';
		}

	      spaces[nspaces] = '\0';

	      while (t != NULL)
		{
		  char *st = t;

		  mstring_split (&st, &t, nextlen, &indent);
		  fprintf (stream, "%s%s\n", spaces, st);
		}

	      sfree (spaces);
	    }
	}
      else
	{
	  nspaces = 4;
	  nextlen = size_toInt (maxlen - nspaces);

	  DPRINTF (("Here 2: [%s]", s));
	  mstring_split (&s, &t, maxlen, &indent);
	  DPRINTF (("Here 3: [%s] [%s]", s, t));

	  fprintf (stream, "%s\n", s);

	  if (t != NULL)
	    {
  	      char *spaces = (char *) dmalloc ((nspaces + 1) * sizeof (*spaces));
	      size_t i;

	      for (i = 0; i < nspaces; i++)
		{
		  spaces[i] = ' ';
		}

	      spaces[nspaces] = '\0';

	      while (t != NULL)
		{
		  char *st = t;
		  DPRINTF (("Loop: [%s]", t));
		  mstring_split (&st, &t, nextlen, &indent);
		  DPRINTF (("Split: [%s] [%s]", st, t));
		  fprintf (stream, "%s%s\n", spaces, st);
		  DPRINTF (("Next..."));
		}

	      sfree (spaces);
	    }
	}
    }

  DPRINTF (("Done"));
  sfree (os);
}

void
xllfatalbug (char *srcFile, int srcLine, /*@only@*/ cstring s)
{
  prepareMessage ();
  printError (g_errorstream, message ("%q: *** Fatal bug: %q",
				      fileloc_unparse (g_currentloc), s));
  showSourceLoc (srcFile, srcLine);
  printCodePoint ();
  printBugReport ();
  llexit (LLFAILURE);
}

void
lclfatalbug (char *msg)
{
  prepareMessage ();
  printError (g_errorstream,
	      message ("*** Fatal Bug: %s", cstring_fromChars (msg)));
  printCodePoint ();
  printBugReport ();
  llexit (LLFAILURE);
}

void
checkParseError (void)
{
  if (fileloc_withinLines (lastparseerror, g_currentloc, 10))
    {
      llfatalerror (message ("%q: Cannot recover from parse error.",
			     fileloc_unparse (g_currentloc)));
    }
}

void llbugaux (cstring file, int line, /*@only@*/ cstring s)
{
  /*@unchecked@*/
  static int numbugs = 0;
  static bool inbug = FALSE;

  context_recordBug ();

  if (inbug)
    {
      cstring temps = fileloc_unparseRaw (file, line);

      fprintf (g_errorstream,
	       "%s: Recursive bug detected: %s\n",
	       cstring_toCharsSafe (temps),
	       cstring_toCharsSafe (s));
      cstring_free (temps);

      llexit (LLFAILURE);
    }

  inbug = TRUE;

  prepareMessage ();

  if (fileloc_withinLines (lastparseerror, g_currentloc, 7))
    {
      llfatalerror (message ("%q: Cannot recover from parse error.",
			     fileloc_unparse (g_currentloc)));
    }

  (void) fflush (g_warningstream);

  printError (g_errorstream,
	      message ("%q: *** Internal Bug at %q: %q [errno: %d]",
		       fileloc_unparse (g_currentloc),
		       fileloc_unparseRaw (file, line),
		       s, errno));
  
  /* printCodePoint (); no longer useful */

  llflush ();
  
  /*
  ** This is confusing, and hardly ever useful.

  if (errno != 0)
    {
      perror ("Possible system error diagnostic: ");
    }

  **
  */

  printBugReport ();
  llflush ();

  numbugs++;

  if (numbugs > context_getBugsLimit () && fileloc_withinLines (lastbug, g_currentloc, 2))
    {
      llfatalerror
	(message ("%q: Cannot recover from last bug. "
		  "(If you really want Splint to try to continue, use -bugslimit .)",
		  fileloc_unparse (g_currentloc)));
    }
  
  fprintf (g_errorstream, "       (attempting to continue, results may be incorrect)\n");
  fileloc_free (lastbug);
  lastbug = fileloc_copy (g_currentloc);
  closeMessage ();
  inbug = FALSE;
}

void
lclbug (/*@only@*/ cstring s)
{
  prepareMessage ();
  printError (g_errorstream, message ("*** Internal Bug: %q", s));
  printCodePoint ();
  printBugReport ();
  fprintf (g_errorstream, "       (attempting to continue, results may be incorrect)\n");
  closeMessage ();
}

void
xllfatalerror (char *srcFile, int srcLine, cstring s)
{
  prepareMessage ();
  printError (g_errorstream, s);
  printError (g_errorstream, cstring_makeLiteral ("*** Cannot continue."));
  showSourceLoc (srcFile, srcLine);
  llexit (LLFAILURE);
}

void
xllfatalerrorLoc (char *srcFile, int srcLine, /*@only@*/ cstring s)
{
  prepareMessage ();
  (void) fflush (g_warningstream);
  printError (g_errorstream, message ("%q: %q", fileloc_unparse (g_currentloc), s));
  printError (g_errorstream, cstring_makeLiteral ("*** Cannot continue."));
  showSourceLoc (srcFile, srcLine);
  (void) fflush (g_warningstream);
  llexit (LLFAILURE);
}

bool
lclHadError (void)
{
  return (s_lclerrors > 0);
}

bool
lclHadNewError (void)
{
  static int lastcall = 0;

  if (s_lclerrors > lastcall)
    {
      lastcall = s_lclerrors;
      return TRUE;
    }
  else
    {
      return FALSE;
    }
}

int
lclNumberErrors (void)
{
  return (s_lclerrors);
}

void
xlclerror (char *srcFile, int srcLine, ltoken t, /*@only@*/ cstring msg)
{
  s_lclerrors++;

  if (ltoken_getCode (t) != NOTTOKEN)
    {
      cstring loc = ltoken_unparseLoc (t);
      s_lastfileloclen = cstring_length (loc);

      printError (g_warningstream, message ("%q: %q", loc, msg));
      showSourceLoc (srcFile, srcLine);
    }
  else
    {
      printError (g_warningstream, msg);
      showSourceLoc (srcFile, srcLine);
    }
}

void
lclplainerror (/*@only@*/ cstring msg)
{
  s_lclerrors++;
  printError (g_warningstream, msg);
}

void
lclfatalerror (ltoken t, /*@only@*/ cstring msg)
{
  if (ltoken_getCode (t) != NOTTOKEN)
    {
      cstring loc = ltoken_unparseLoc (t);
      s_lastfileloclen = cstring_length (loc);
      printError (g_errorstream, message ("%q: %q", loc, msg));
    }
  else
    {
      printError (g_errorstream, msg);
    }

  printError (g_errorstream, cstring_makeLiteral ("*** Cannot continue"));
  llexit (LLFAILURE);
}

void
lclplainfatalerror (/*@only@*/ cstring msg)
{
  (void) fflush (g_warningstream);
  printError (g_errorstream, message ("*** Cannot continue: %q", msg));
  llexit (LLFAILURE);
}

void
lclRedeclarationError (ltoken id)
{
  cstring s = ltoken_getRawString (id);


  if (usymtab_existsEither (s))
    {
      uentry le = usymtab_lookupEither (s);

      lclerror (id, message ("Respecification of %s", s));
      llgenindentmsg (message ("Previous specification of %q",
			       uentry_getName (le)),
		uentry_whereSpecified (le));
    }
  else
    {
      lclerror (id, message ("Identifier redeclared: %s", s));
    }
}

void genppllerror (flagcode code, /*@only@*/ cstring s)
{
  if (context_inSuppressZone (g_currentloc))
    {
      cstring_free (s);
    }
  else
    {
      if (context_getFlag (code))
	{
	  if (s_scanOpen)
	    {
	      displayScanClose ();
	    }

	  llerror (code, s);

	  if (code != FLG_PREPROC)
	    {
	      llsuppresshint ('-', code);
	    }

	  if (!context_isInCommandLine ())
	    {
	      displayScanOpen (cstring_makeLiteral ("< more preprocessing ."));
	    }
	}
      else
	{
	  cstring_free (s);
	}
    }
}

void genppllerrorhint (flagcode code, /*@only@*/ cstring s,
		       /*@only@*/ cstring hint)
{
  if (context_inSuppressZone (g_currentloc))
    {
      cstring_free (s);
      cstring_free (hint);
    }
  else
    {
      if (context_getFlag (code))
	{
	  generateCSV (code, s, hint, g_currentloc);
	  prepareMessage ();
	  context_clearPreprocessing ();
	  llerror (code, s);
	  llgenhint (hint);
	  context_setPreprocessing ();
	  closeMessage ();
	}
      else
	{
	  cstring_free (s);
	  cstring_free (hint);
	}
    }
}

void ppllerror (/*@only@*/ cstring s)
{
  genppllerror (FLG_PREPROC, s);
}

void pplldiagmsg (cstring s)
{
  if (!context_isInCommandLine ())
    {
      if (s_scanOpen) 
	{
	  displayScanClose ();
	}

      lldiagmsg (s);
      displayScanOpen (cstring_makeLiteral ("< more preprocessing ."));
    }
  else
    {
      lldiagmsg (s);
    }
}

void loadllmsg (cstring s)
{
  displayScanClose ();
  lldiagmsg (s);
  displayScanOpen (cstring_makeLiteral ("< ."));
}

static void llreportparseerror (/*@only@*/ cstring s)
{
  if (fileloc_withinLines (lastparseerror, g_currentloc, 5))
    {
      cstring_free (s);
    }
  else
    {
      llerror (FLG_SYNTAX, s);

      fileloc_free (lastparseerror);
      lastparseerror = fileloc_copy (g_currentloc);
    }
}

bool xcppoptgenerror (char *srcFile, int srcLine,
		      flagcode o,
		      /*@only@*/ cstring s,
		      cppReader *pfile)
{
  bool res = FALSE;
  fileloc loc = cppReader_getLoc (pfile);

  if (context_flagOn (o, loc))
    {
      if (xlloptgenerror (srcFile, srcLine, o, s, loc))
	{
	  cppReader_printContainingFiles (pfile);
	  res = TRUE;
	}
    }
  else
    {
      cstring_free (s);
    }

  fileloc_free (loc);

  return res;
}

bool xlloptgenerror (char *srcFile, int srcLine, 
		     flagcode o, /*@only@*/ cstring s, fileloc loc)
{
  DPRINTF (("xllopt: %s", s));

  if (llrealerror (o, srcFile, srcLine, s, flagcodeHint (o), loc))
    {
      DPRINTF (("Here we are!"));
      llsuppresshint ('-', o);
      closeMessage ();
      flagcode_recordError (o);
      return TRUE;
    }
  else
    {
      DPRINTF (("Suppressed!"));
      flagcode_recordSuppressed (o);
      return FALSE;
    }
}

bool xoptgenerror2 (char *srcFile, int srcLine,
		    flagcode f1, flagcode f2, /*@only@*/ cstring s, fileloc loc)
{
  if (context_suppressFlagMsg (f1, loc))
    {
      flagcode_recordSuppressed (f1);
      cstring_free (s);
    }
  else
    {
      if (context_suppressFlagMsg (f2, loc))
	{
	  flagcode_recordSuppressed (f2);
	  cstring_free (s);
	}
      else
	{
	  if (llrealerror (f1, srcFile, srcLine, s, flagcodeHint (f1), loc))
	    {
	      llsuppresshint2 ('-', f1, f2);
	      flagcode_recordError (f2);
	      closeMessage ();
	      return TRUE;
	    }
	  else
	    {
	      flagcode_recordSuppressed (f2);
	    }
	}
    }

  return FALSE;
}

bool xoptgenerror2n (char *srcFile, int srcLine,
		     flagcode f1, flagcode f2, /*@only@*/ cstring s, fileloc loc)
{

  if (context_suppressFlagMsg (f1, loc))
    {
      flagcode_recordSuppressed (f1);
      cstring_free (s);
    }
  else
    {
      if (context_suppressNotFlagMsg (f2, loc))
	{
	  flagcode_recordSuppressed (f2);
	  cstring_free (s);
	}
      else
	{
	  if (llrealerror (f1, srcFile, srcLine, s, flagcodeHint (f2), loc))
	    {
	      llsuppresshint ('+', f2);
	      flagcode_recordError (f2);
	      closeMessage ();
	      return TRUE;
	    }

	  flagcode_recordSuppressed (f2);
	}
    }
  return FALSE;
}

bool xllnoptgenerror (char *srcFile, int srcLine,
		      flagcode o, /*@only@*/ cstring s, fileloc loc)
{
  if (llrealerror (o, srcFile, srcLine, s, flagcodeHint (o), loc))
    {
      llsuppresshint ('+', o);
      flagcode_recordError (o);
      closeMessage ();
      return TRUE;
    }

  flagcode_recordSuppressed (o);
  return FALSE;
}

void xllparseerror (char *srcFile, int srcLine, cstring s)
{
  if (context_getFlag (FLG_TRYTORECOVER))
    {
      parseerrorcount++;

      if (parseerrorcount > GIVEUPPARSE)
	{
	  if (cstring_isDefined (s))
	    {
	      xllfatalerror (srcFile, srcLine,
			     message ("%q: Parse Error: %q.  "
				      "Too many errors, giving up.",
				      fileloc_unparse (g_currentloc), s));
	    }
	  else
	    {
	      xllfatalerror (srcFile, srcLine,
			     message ("%q: Parse Error.  Too many errors, giving up.",
				      fileloc_unparse (g_currentloc)));
	    }
	}
      else
	{
	  if (cstring_isDefined (s))
	    {
	      llreportparseerror (message ("Parse Error: %q. Attempting to continue.",
					   s));
	      showSourceLoc (srcFile, srcLine);
	    }
	  else
	    {
	      llreportparseerror (message ("Parse Error. Attempting to continue."));
	      showSourceLoc (srcFile, srcLine);
	    }
	}
    }
  else
    {
      cstring msg;

      if (cstring_isDefined (s))
	{
	  msg = message ("Parse Error: %q.", s);
	}
      else
	{
	  msg = message ("Parse Error.");
	}

      xllfatalerror
	(srcFile, srcLine,
	 message ("%q: %s (For help on parse errors, "
		  "see splint -help parseerrors.)",
		  fileloc_unparse (g_currentloc), msg));
    }
}

bool xfsgenerror (char *srcFile, int srcLine,
		  flagSpec fs, /*@only@*/ cstring s, fileloc fl) 
{
  if (flagSpec_isOn (fs, fl))
    {
      flagcode firston = flagSpec_getFirstOn (fs, fl);

      if (llgenerroraux (firston, srcFile, srcLine, s, 
			 flagcodeHint (firston),
			 fl, TRUE, FALSE))
	{
	  llsuppresshint ('-', firston);
	  flagcode_recordError (firston);
	  return TRUE;
	}
      else
	{
	  flagcode_recordSuppressed (firston);
	  return FALSE;
	}
    }
  else
    {
      flagcode_recordSuppressed (flagSpec_getDominant (fs));
      cstring_free (s);
      return FALSE;
    }
}

bool doCheck (bool x, cstring pred, cstring file, int line)
{
  if (!x) {
    llbug (message ("%q: Check Failed: %s",
		    fileloc_unparseRaw (file, line),
		    pred));
  }

  return x;
}

/*@observer@*/ cstring lldecodeerror (/*@unused@*/ int errnum)
{
  char *result;

#ifndef VMS
#ifndef HAVE_STRERROR
  result = NULL;
#else
  result = strerror (errnum);
#endif
#else	/* VMS */
  /* VAXCRTL's strerror() takes an optional second argument, which only
     matters when the first argument is EVMSERR.  However, it's simplest
     just to pass it unconditionally.  `vaxc$errno' is declared in
     , and maintained by the library in parallel with `errno'.
     We assume that caller's `errnum' either matches the last setting of
     `errno' by the library or else does not have the value `EVMSERR'.  */

  result = strerror (errnum, vaxc$errno);
#endif

  if (result == NULL)
    {
      result = cstring_toCharsSafe (message ("undocumented I/O error: %d", errnum));
    }

  return cstring_fromChars (result);
}

void llquietbugaux (cstring s, /*@unused@*/ cstring file, /*@unused@*/ int line)
{
# if 0
# ifdef HOMEVERSION
  llflush ();
  printError (g_errorstream, message ("%q: *** Internal Bug at %q: %q [errno: %d]",
				      fileloc_unparse (g_currentloc),
				      fileloc_unparseRaw (file, line),
				      s, errno));
  printCodePoint ();
  llflush ();
# endif
# else
  cstring_free (s);
# endif
}

void llflush (void)
{
  (void) fflush (g_warningstream);
  (void) fflush (g_messagestream);
}

void displayScan (cstring msg)
{
  if (s_scanOpen)
    {
      displayScanClose ();
    }

  llassert (!s_scanOpen);

  if (context_getFlag (FLG_SHOWSCAN))
    {
      showHerald ();
      fprintf (g_messagestream, "< %s >\n", cstring_toCharsSafe (msg));
      (void) fflush (g_messagestream);
    }

  cstring_free (msg);
}

void displayScanOpen (cstring msg)
{
  if (s_scanOpen)
    {
      displayScanClose ();
    }

  llassert (!s_scanOpen);
  s_scanOpen = TRUE;

  if (context_getFlag (FLG_SHOWSCAN))
    {
      fprintf (g_messagestream, "< %s", cstring_toCharsSafe (msg));
      (void) fflush (g_messagestream);
    }

  cstring_free (msg);
}

void displayScanContinue (/*@temp@*/ cstring msg)
{
  if (context_getFlag (FLG_SHOWSCAN))
    {
      if (s_scanOpen) 
	{
	  fprintf (g_messagestream, "%s", cstring_toCharsSafe (msg));
	  (void) fflush (g_messagestream);
	}
      else
	{
	  /*
	  ** Don't call bug recursively
	  */

	  fprintf (stderr, "*** Bug: scan continue scan not open\n");
	}
    }
}

void displayScanClose (void)
{
  if (s_scanOpen)
    {
      if (context_getFlag (FLG_SHOWSCAN))
	{
	  fprintf (g_messagestream, " >\n");
	  (void) fflush (g_messagestream);
	}
    }
  else
    {
      /*
      ** Don't call bug recursively
      */
      
      fprintf (stderr, "*** Bug: scan close scan not open\n");
    }
  
  s_scanOpen = FALSE;
}


splint-3.1.2.dfsg1/src/messageLog.c0000644021234200000250000001056707630461221014476 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** messageLog.c (from slist_template.c)
*/

# include "splintMacros.nf"
# include "basic.h"

/*@only@*/ messageLog
messageLog_new ()
{
  messageLog s = (messageLog) dmalloc (sizeof (*s));
  
  s->nelements = 0;
  s->nspace = messageLogBASESIZE;
  s->elements = (msgentry *) dmalloc (sizeof (*s->elements) * messageLogBASESIZE);

  return (s);
}

static /*@only@*/ msgentry
msgentry_create (fileloc loc, cstring mess)
{
  msgentry msg = (msgentry) dmalloc (sizeof (*msg));

  msg->loc = fileloc_copy (loc);
  msg->msg = cstring_copy (mess);

  return msg;
}

# ifdef S_SPLINT_S
static /*@unused@*/ cstring msgentry_unparse (msgentry msg) /*@*/
{
  return message ("%q:%s", fileloc_unparse (msg->loc), msg->msg);
}
# endif

static void msgentry_free (/*@only@*/ msgentry msg)
{
  fileloc_free (msg->loc);
  cstring_free (msg->msg);
  sfree (msg);
}

/*
** returns TRUE if m1 < m2
*/

static bool
msgentry_lessthan (msgentry m1, msgentry m2)
{
  return (fileloc_lessthan (m1->loc, m2->loc)
	  || (fileloc_equal (m1->loc, m2->loc) 
	      && (cstring_lessthan (m1->msg, m2->msg))));
}

static bool
msgentry_equal (msgentry m1, msgentry m2)
{
  return (fileloc_equal (m1->loc, m2->loc) &&
	  cstring_equal (m1->msg, m2->msg));
}

/*
** returns highest index of element less than msg
*/

static int
messageLog_index (messageLog s, msgentry msg)
{
  int high;
  int low  = 0;

  llassert (messageLog_isDefined (s));

  high = s->nelements - 1;

  for (low = high; low >= 0; low--)
    {
      if (msgentry_lessthan (s->elements[low], msg))
	{
	  return low;
	}
    }

  return -1;
# if 0      
  while (low < high)
    {
      int mid = (low + high + 1) / 2;

      if (msgentry_lessthan (s->elements[mid], msg)) /* mid < msg */
	{
	  if (high == mid) break;
	  high = mid;
	}
      else
	{
	  if (low == mid) break;
	  low = mid;
	}
    }

  return low - 1;
# endif
}

static void
messageLog_grow (/*@notnull@*/ messageLog s)
{
  int i;
  msgentry *newelements;
  
  s->nspace += messageLogBASESIZE; 
  newelements = (msgentry *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace));
  
  for (i = 0; i < s->nelements; i++)
    {
      newelements[i] = s->elements[i];
    }
  
  sfree (s->elements);
  s->elements = newelements;
}

bool messageLog_add (messageLog s, fileloc fl, cstring mess)
{
  msgentry msg = msgentry_create (fl, mess);
  int ind, i;

  llassert (messageLog_isDefined (s));

  ind = messageLog_index (s, msg);

  if (ind + 1 < s->nelements)
    {
      if (msgentry_equal (msg, s->elements[ind + 1]))
	{
	  msgentry_free (msg);
	  return FALSE;
	}
    }

  if (s->nspace <= 0) {
    messageLog_grow (s);
  }

  for (i = s->nelements; i > ind + 1; i--)
    {
      s->elements[i] = s->elements[i-1];
    }
  
  s->elements[ind + 1] = msg;
  s->nspace--;
  s->nelements++;

  return TRUE;
}

/*@only@*/ cstring
messageLog_unparse (messageLog s)
{
   int i;
   cstring st = cstring_makeLiteral ("[");

   if (messageLog_isDefined (s))
     {
       for (i = 0; i < s->nelements; i++)
	 {
	   if (i == 0)
	     {
	       st = message ("%q %q", st, fileloc_unparseDirect (s->elements[i]->loc));
	     }
	   else
	     st = message ("%q, %q", st, fileloc_unparseDirect (s->elements[i]->loc));
	 }
     }

   st = message ("%q ]", st);
   return st;
}

void
messageLog_free (messageLog s)
{
  if (s != NULL)
    {
      int i;

      for (i = 0; i < s->nelements; i++)
	{
	  msgentry_free (s->elements[i]);
	}
      
      sfree (s->elements); 
      sfree (s);
    }
}
splint-3.1.2.dfsg1/src/flagMarker.c0000644021234200000250000001035707630461220014457 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** flagMarker.c
*/

# include "splintMacros.nf"
# include "basic.h"

flagMarker flagMarker_createLocalSet (flagcode code, ynm set, fileloc loc)
{
  flagMarker c = (flagMarker) dmalloc (sizeof (*c));
  
  c->kind = FMK_LOCALSET;
  c->code = code;
  c->info.set = set;
  c->loc = fileloc_copy (loc); 

  return c;
}

flagMarker flagMarker_createSuppress (flagcode code, fileloc loc)
{
  flagMarker c = (flagMarker) dmalloc (sizeof (*c));
  
  c->kind = FMK_SUPPRESS;
  c->code = code;
  c->loc = fileloc_copy (loc); 

  return c;
}

flagMarker flagMarker_createIgnoreOn (fileloc loc)
{
  flagMarker c = (flagMarker) dmalloc (sizeof (*c));
  
  c->kind = FMK_IGNOREON;
  c->code = INVALID_FLAG;
  c->loc = fileloc_copy (loc); 

  return c;
}

flagMarker flagMarker_createIgnoreCount (int count, fileloc loc)
{
  flagMarker c = (flagMarker) dmalloc (sizeof (*c));
  
  c->kind = FMK_IGNORECOUNT;
  c->code = INVALID_FLAG;
  c->info.nerrors = count;
  c->loc = fileloc_copy (loc); 

  DPRINTF (("Create ignore count: %s", flagMarker_unparse (c)));
  return c;
}

flagMarker flagMarker_createIgnoreOff (fileloc loc)
{
  flagMarker c = (flagMarker) dmalloc (sizeof (*c));
  
  c->kind = FMK_IGNOREOFF;
  c->code = INVALID_FLAG;
  c->loc = fileloc_copy (loc); 

  return c;
}

ynm flagMarker_getSet (flagMarker f)
{
  llassert (f->kind == FMK_LOCALSET);

  return f->info.set;
}

flagcode flagMarker_getCode (flagMarker f)
{
  llassert (f->kind == FMK_LOCALSET|| f->kind == FMK_SUPPRESS);

  return f->code;
}

int flagMarker_getCount (flagMarker f)
{
  llassert (f->kind == FMK_IGNORECOUNT);

  return f->info.nerrors;
}

bool flagMarker_equal (flagMarker f1, flagMarker f2)
{
  if (f1->kind != f2->kind)
    {
      return FALSE;
    }

  if (!fileloc_equal (f1->loc, f2->loc))
    {
      return FALSE;
    }

  switch (f1->kind)
    {
    case FMK_LOCALSET:
      return (f1->info.set == f2->info.set
	      && flagcode_equal (f1->code, f2->code));
    case FMK_IGNORECOUNT:
      return (f1->info.nerrors == f2->info.nerrors);
    case FMK_IGNOREON:
    case FMK_IGNOREOFF:
      return TRUE;
    case FMK_SUPPRESS:
      return (flagcode_equal (f1->code, f2->code));
    }

  BADBRANCHRET (FALSE);
}

cstring flagMarker_unparse (flagMarker c)
{
  switch (c->kind)
    {
    case FMK_LOCALSET:
      return (message ("%q: %s%s", 
		       fileloc_unparse (c->loc), ynm_unparseCode (c->info.set), 
		       flagcode_unparse (c->code)));
    case FMK_IGNORECOUNT:
      return (message ("%q: ignore count %d", 
		       fileloc_unparse (c->loc), c->info.nerrors));
    case FMK_IGNOREON:
      return (message ("%q: ignore on", 
		       fileloc_unparse (c->loc)));
    case FMK_IGNOREOFF:
      return (message ("%q: ignore off", 
		       fileloc_unparse (c->loc)));
    case FMK_SUPPRESS:
      return (message ("%q: suppress %s", 
		       fileloc_unparse (c->loc),
		       flagcode_unparse (c->code)));
    }

  BADBRANCHRET (cstring_undefined);
}
  
void flagMarker_free (/*@only@*/ flagMarker c)
{
  fileloc_free (c->loc); /* evans 2001-03-24: Splint caught this... */
  sfree (c);
}

bool flagMarker_sameFile (flagMarker c, fileloc loc)
{
  return (fileloc_almostSameFile (c->loc, loc));
}

/*
** return true if loc is before c->loc
*/

bool flagMarker_beforeMarker (flagMarker c, fileloc loc)
{
  return  (!fileloc_notAfter (c->loc, loc));
}



splint-3.1.2.dfsg1/src/aliasTable.c0000644021234200000250000004241607706100767014460 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** aliasTable.c
*/

# include "splintMacros.nf"
# include "basic.h"

/*@constant int ATINVALID; @*/
# define ATINVALID -1

static sRefSet
  aliasTable_canAliasAux (aliasTable p_s, sRef p_sr, int p_lim) /*@*/ ;
static sRefSet
  aliasTable_aliasedByLimit (aliasTable p_s, sRef p_sr, int p_lim) /*@*/ ;
static sRefSet 
  aliasTable_aliasedByAux (aliasTable p_s, sRef p_sr, int p_lim) /*@*/ ;

aliasTable
aliasTable_new ()
{
  return (aliasTable_undefined);
}

static /*@only@*/ /*@notnull@*/ aliasTable
aliasTable_newEmpty (void)
{
  aliasTable s = (aliasTable) dmalloc (sizeof (*s));
  
  s->nelements = 0;
  s->nspace = aliasTableBASESIZE;
  s->keys = (sRef *) dmalloc (sizeof (*s->keys) * aliasTableBASESIZE);
  s->values = (sRefSet *) dmalloc (sizeof (*s->values) * aliasTableBASESIZE);
  
  return (s);
}

static void
aliasTable_grow (/*@notnull@*/ aliasTable s)
{
  int i;
  o_sRefSet *oldvalues = s->values;
  sRef    *oldkeys = s->keys;
  
  s->nspace += aliasTableBASESIZE; 

  s->values = (sRefSet *) dmalloc (sizeof (*s->values)
				   * (s->nelements + s->nspace));
  s->keys = (sRef *) dmalloc (sizeof (*s->keys) * (s->nelements + aliasTableBASESIZE));

  if (s->keys == (sRef *) 0 || s->values == (sRefSet *)0)
    {
      llfatalerror (cstring_makeLiteral ("aliasTable_grow: out of memory!"));
    }

  for (i = 0; i < s->nelements; i++)
    {
      s->values[i] = oldvalues[i];
      s->keys[i] = oldkeys[i];
    }
  
  sfree (oldvalues);
  sfree (oldkeys);
}

static int aliasTable_lookupRefs (/*@notnull@*/ aliasTable s, sRef sr)
{
  int i;

  
  for (i = 0; i < aliasTable_size (s); i++)
    {
      if (sRef_same (sr, s->keys[i])) 
	{
	  DPRINTF (("sRef match: %s / %s",
		    sRef_unparseFull (sr),
		    sRef_unparseFull (s->keys[i])));
	  return i;
	}
    }

  return ATINVALID;
}

/*
** sr aliases al (and anything al aliases!)
*/

aliasTable
aliasTable_addMustAlias (/*@returned@*/ aliasTable s,
			 /*@exposed@*/ sRef sr,
			 /*@exposed@*/ sRef al)
{
  int ind;
  sRefSet ss;
  
  llassert (NOALIAS (sr, al));
  
  DPRINTF (("Adding alias: %s / %s", sRef_unparseFull (sr),
	    sRef_unparseFull (al)));

  if (aliasTable_isUndefined (s))
    {
      s = aliasTable_newEmpty ();
      ind = ATINVALID;
    }
  else
    {
      ind = aliasTable_lookupRefs (s, sr);
    }
  
  ss = aliasTable_canAlias (s, al); 
  DPRINTF (("Previous aliases: %s", sRefSet_unparse (ss)));
  
  if (ind == ATINVALID)
    {
      if (s->nspace <= 0) {
	aliasTable_grow (s);
      }

      s->nspace--;
      s->keys[s->nelements] = sr;
      s->values[s->nelements] = sRefSet_single (al); 
      ind = s->nelements;
      s->nelements++;      
    }
  else
    {
      s->values[ind] = sRefSet_insert (s->values[ind], al); 
    }
  
  s->values[ind] = sRefSet_unionExcept (s->values[ind], ss, s->keys[ind]); 
  DPRINTF (("New aliases: %s", sRefSet_unparse (s->values[ind])));

  sRefSet_free (ss);
  return s;
}

static aliasTable 
  aliasTable_addSet (/*@returned@*/ aliasTable s,
		     /*@exposed@*/ sRef key, /*@only@*/ sRefSet value)
{
  if (!sRefSet_isEmpty (value))
    {
      if (aliasTable_isUndefined (s))
	{
	  s = aliasTable_newEmpty ();
	}
      else
	{
	  if (s->nspace <= 0)
	    {
	      aliasTable_grow (s);
	    }
	}

      s->nspace--;
      s->keys[s->nelements] = key;
      s->values[s->nelements] = value;
      s->nelements++;      
    }
  else
    {
      sRefSet_free (value);
    }

  return s;
}

/*
** When aliases are cleared:
**
**    o remove all entries for sr
**    o replace all aliases for things which alias sr with sr's aliases
**
** Clear aliases for sr; if sr is a direct param reference, clear its aliases too.
*/

static void aliasTable_clearAliasesAux (/*@notnull@*/ aliasTable p_s, sRef p_sr)
   /*@modifies p_s@*/ ;

void aliasTable_clearAliases (aliasTable s, sRef sr)
{
  if (aliasTable_isUndefined (s))
    {
      return;
    }
  else
    {
      sRef rb = sRef_getRootBase (sr);

            
      if (!sRef_isCvar (sr) && sRef_isLocalVar (rb))
	{
	  int ind = aliasTable_lookupRefs (s, rb);
	  
	  if (ind != ATINVALID)
	    {
	      sRefSet al = s->values[ind];
	      
	      	      
	      sRefSet_realElements (al, el)
		{
		  		  
		  if (sRef_isParam (el))
		    {
		      if (sRef_sameName (el, rb))
			{
			  sRef fb = sRef_fixBase (sr, el); 

			  aliasTable_clearAliasesAux (s, fb); 
			}
		    }
		} end_sRefSet_realElements ;
	    }
	}
      
      aliasTable_clearAliasesAux (s, sr); 
    }  
}

static
void aliasTable_clearAliasesAux (/*@notnull@*/ aliasTable s, sRef sr)
{
  int i;
  
  for (i = 0; i < s->nelements; i++)
    {
      sRef key = s->keys[i];
      
      if (sRef_includedBy (key, sr))
	{
	  sRefSet_clear (s->values[i]);
	}
      else
	{
	  (void) sRefSet_deleteBase (s->values[i], sr);   
	}
    }
}

/*
** returns set of all sRefs that must alias sr (but are different from sr)
*/

static /*@only@*/ sRefSet aliasTable_aliasedByAux (aliasTable s, sRef sr, int lim)
{
  static bool hadWarning = FALSE;
  sRefSet res = sRefSet_undefined;
  int i;

  llassert (!sRef_isConj (sr));
  
  
  if (aliasTable_isUndefined (s) || lim >= ALIASSEARCHLIMIT)
    {
      if (lim >= ALIASSEARCHLIMIT && !hadWarning)
	{
	  llquietbug
	    (message ("Alias search limit exceeded, checking %q. "
		      "This either means there is a variable with at least "
		      "%d indirections, or there is a bug in Splint.",
		      sRef_unparse (sr),
		      ALIASSEARCHLIMIT));
	  
	  hadWarning = TRUE;
	}

      return sRefSet_undefined;
    }
  else
    {
      sRefSet abl;

      if (sRef_isPointer (sr))
	{
	  abl = aliasTable_aliasedByLimit (s, sRef_getBase (sr), lim);
	  res = sRefSet_addIndirection (abl);
	}
      else if (sRef_isAddress (sr))
	{
	  abl = aliasTable_aliasedByLimit (s, sRef_getBase (sr), lim);
	  res = sRefSet_removeIndirection (abl);
	}
      else if (sRef_isField (sr))
	{
	  abl = aliasTable_aliasedByLimit (s, sRef_getBase (sr), lim);
	  res = sRefSet_accessField (abl, sRef_getField (sr));
	}
      else if (sRef_isArrayFetch (sr))
	{
	  abl = aliasTable_aliasedByLimit (s, sRef_getBase (sr), lim);

	  if (sRef_isIndexKnown (sr))
	    {
	      int idx = sRef_getIndex (sr);
	      
	      res = sRefSet_fetchKnown (abl, idx);
	    }
	  else
	    {
	      res = sRefSet_fetchUnknown (abl);
	    }
	}
      else
	{
	  abl = sRefSet_undefined;
	}

      sRefSet_free (abl);
    }

  for (i = 0; i < s->nelements; i++)
    {
      sRef elem = s->keys[i];
      
      if (!sRef_same (sr, elem)) /* was sameName */
	{
	  	  
	  sRefSet_realElements (s->values[i], current)
	    {
	      	      
	      if (sRef_similar (sr, current))
		{
		  		  		  res = sRefSet_insert (res, sRef_fixOuterRef (elem));
		  /*@innerbreak@*/ break;
		}
	    } end_sRefSet_realElements;
	} 
    }
  
    return res;
}

static /*@only@*/ sRefSet aliasTable_aliasedByLimit (aliasTable s, sRef sr, int lim)
{
  sRefSet res;
  
  
  if (sRef_isConj (sr))
    {
      res = sRefSet_unionFree (aliasTable_aliasedByLimit (s, sRef_getConjA (sr), lim),
			       aliasTable_aliasedByLimit (s, sRef_getConjB (sr), lim));
    }
  else
    {
      res = aliasTable_aliasedByAux (s, sr, lim + 1);
    }
  
    return res;
}

/*@only@*/ sRefSet aliasTable_aliasedBy (aliasTable s, sRef sr)
{ 
  if (sRef_isConj (sr))
    {
      return (sRefSet_unionFree (aliasTable_aliasedBy (s, sRef_getConjA (sr)),
				 aliasTable_aliasedBy (s, sRef_getConjB (sr))));
    }

  return (aliasTable_aliasedByAux (s, sr, 0));
}

/*@only@*/ sRefSet aliasTable_canAlias (aliasTable s, sRef sr)
{
  sRefSet res;

    
  if (sRef_isConj (sr))
    {
      res = sRefSet_unionFree (aliasTable_canAlias (s, sRef_getConjA (sr)),
			       aliasTable_canAlias (s, sRef_getConjB (sr)));
    }
  else
    {
      res = aliasTable_canAliasAux (s, sr, 0);
          }

    return res;
}

/*
** need to limit the depth of aliasing searches 
*/

static /*@only@*/ sRefSet aliasTable_canAliasLimit (aliasTable s, sRef sr, int lim)
{
  sRefSet res;
  
  if (sRef_isConj (sr))
    {
      sRefSet a = aliasTable_canAliasLimit (s, sRef_getConjA (sr), lim);
      sRefSet b = aliasTable_canAliasLimit (s, sRef_getConjB (sr), lim);

      res = sRefSet_unionFree (a, b);
    }
  else
    {
      res = aliasTable_canAliasAux (s, sr, lim + 1);
    }
  
  return res;
}

static /*@only@*/ sRefSet 
  aliasTable_canAliasAux (aliasTable s, sRef sr, int lim)
{
  static bool hadWarning = FALSE;
  llassert (!sRef_isConj (sr));
  
  
  if (aliasTable_isUndefined (s) || lim >= ALIASSEARCHLIMIT)
    {
      if (lim >= ALIASSEARCHLIMIT && !hadWarning)
	{
	  llquietbug
	    (message ("Alias search limit exceeded, checking %q. "
		      "This either means there is a variable with at least "
		      "%d indirections, or there is a bug in Splint.",
		      sRef_unparse (sr),
		      ALIASSEARCHLIMIT));
	  
	  hadWarning = TRUE;
	}

      return sRefSet_undefined;
    }
  else
    {
      int ind = aliasTable_lookupRefs (s, sr);

      if (sRef_isPointer (sr) || sRef_isAddress (sr) || sRef_isField (sr)
	  || sRef_isArrayFetch (sr))
	{
	  sRef base = sRef_getBase (sr);
	  sRefSet tmp = aliasTable_canAliasLimit (s, base, lim);
	  sRefSet ret;

	  if (sRef_isPointer (sr))
	    {
	      ret = sRefSet_addIndirection (tmp); 
	    }
	  else if (sRef_isAddress (sr))
	    {
	      ret = sRefSet_removeIndirection (tmp);
	    }
	  else if (sRef_isField (sr))
	    {
	      ret = sRefSet_accessField (tmp, sRef_getField (sr));
	    }
	  else if (sRef_isArrayFetch (sr))
	    {
	      if (sRef_isIndexKnown (sr))
		{
		  ret = sRefSet_fetchKnown (tmp, sRef_getIndex (sr));
		}
	      else
		{
		  ret = sRefSet_fetchUnknown (tmp);
		}
	    }
	  else
	    {
	      BADBRANCH;
	    }

	  if (ind != ATINVALID)
	    {
	      ret = sRefSet_union (ret, s->values[ind]);
	    }
	  
	  sRefSet_free (tmp);
	  return ret;
	}
      
      if (ind == ATINVALID) return sRefSet_undefined;      
      
      return sRefSet_newCopy (s->values[ind]);
    }
}

aliasTable aliasTable_copy (aliasTable s)
{
  if (aliasTable_isEmpty (s))
    {
      return aliasTable_undefined;
    }
  else
    {
      aliasTable t = (aliasTable) dmalloc (sizeof (*s));
      int i;

      t->nelements = s->nelements;
      t->nspace = 0;
      t->keys = (sRef *) dmalloc (sizeof (*s->keys) * s->nelements);
      t->values = (sRefSet *) dmalloc (sizeof (*s->values) * t->nelements);
        
      for (i = 0; i < s->nelements; i++)
	{
	  t->keys[i] = s->keys[i];
	  t->values[i] = sRefSet_newCopy (s->values[i]);
	}

      return t;
    }
}

static void
aliasTable_levelPrune (aliasTable s, int lexlevel)
{
  
  
  if (aliasTable_isEmpty (s))
    {
      return;
    }
  else
    {
      int i;
      int backcount = s->nelements - 1;
      
      for (i = 0; i <= backcount; i++)
	{
	  sRef key = s->keys[i];
	  
	  if (sRef_lexLevel (key) > lexlevel)
	    {
	      int j;
	      for (j = backcount; j > i; j--)
		{
		  backcount--;
		  s->nelements--;
		  s->nspace++;
		  
		  if (sRef_lexLevel (s->keys[j]) <= lexlevel)
		    {
		      s->keys[i] = s->keys[j];
		      s->values[i] = s->values[j];
		      sRefSet_levelPrune (s->values[i], lexlevel);
		      /*@innerbreak@*/ break;
		    }
		}
	      if (backcount == i)
		s->nelements--;
	    }
	  else
	    {
	      sRefSet_levelPrune (s->values[i], lexlevel);
	    }
	}
    }
}

/*
** levelUnionSeq
**
**    like level union, but know that t2 was executed after t1.  So if
**    t1 has x -> { a, b } and t2 has x -> { a }, then result has x -> { a }.
**
** NOTE: t2 is "only".
*/

aliasTable aliasTable_levelUnionSeq (/*@returned@*/ aliasTable t1, 
				     /*@only@*/ aliasTable t2, int level)
{
  if (aliasTable_isUndefined (t2))
    {
      return t1;
    }

  if (aliasTable_isUndefined (t1))
    {
      t1 = aliasTable_newEmpty ();
    }
  else
    {
      aliasTable_levelPrune (t1, level);
    }

  aliasTable_elements (t2, key, value)
    {
      if (sRef_lexLevel (key) <= level)
	{
	  int ind = aliasTable_lookupRefs (t1, key);

	  sRefSet_levelPrune (value, level);
	      
	  if (ind == ATINVALID)
	    {
	      /* okay, t2 is killed */
	      /*@-exposetrans@*/ /*@-dependenttrans@*/ 
	      t1 = aliasTable_addSet (t1, key, value);
	      /*@=exposetrans@*/ /*@=dependenttrans@*/ 
	    }
	  else
	    {
	      sRefSet_free (t1->values[ind]);

	      /*@-dependenttrans@*/ /* okay, t2 is killed */
	      t1->values[ind] = value;
	      /*@=dependenttrans@*/
	    } 
	}
      else
	{
	  /*@-exposetrans@*/ /*@-dependenttrans@*/ 
	  sRefSet_free (value);
	  /*@=exposetrans@*/ /*@=dependenttrans@*/ 
	}

    } end_aliasTable_elements;
  
  sfree (t2->keys);
  sfree (t2->values);
  sfree (t2);

    return t1;
}

aliasTable 
aliasTable_levelUnion (/*@returned@*/ aliasTable t1, aliasTable t2, int level)
{
  if (aliasTable_isUndefined (t1))
    {
      if (aliasTable_isUndefined (t2)) 
	{
	  return t1;
	}
      else
	{
	  t1 = aliasTable_newEmpty ();
	}
    }
  else
    {
      aliasTable_levelPrune (t1, level);
    }

  aliasTable_elements (t2, key, cvalue)
    {
      sRefSet value = sRefSet_newCopy (cvalue);

      if (sRef_lexLevel (key) <= level)
	{
	  sRefSet_levelPrune (value, level);

	  if (sRefSet_size (value) > 0)
	    {
	      int ind = aliasTable_lookupRefs (t1, key);
	      
	      if (ind == ATINVALID)
		{
		  t1 = aliasTable_addSet (t1, key, value);
		}
	      else
		{
		  t1->values[ind] = sRefSet_union (t1->values[ind], value);
		  sRefSet_free (value);
		}
	    }
	  else
	    {
	      sRefSet_free (value); 
	    }
	}
      else
	{
	  sRefSet_free (value); 
	}
    } end_aliasTable_elements;

    return t1;
}

aliasTable aliasTable_levelUnionNew (aliasTable t1, aliasTable t2, int level)
{
  aliasTable ret = aliasTable_levelUnion (aliasTable_copy (t1), t2, level);

  return ret;
}

/*@only@*/ cstring
aliasTable_unparse (aliasTable s)
{
   cstring st = cstring_undefined;

   if (aliasTable_isUndefined (s)) return (cstring_makeLiteral (""));

   aliasTable_elements (s, key, value)
     {
       st = message ("%q\t%q -> %q\n", st, sRef_unparseFull (key), 
		     sRefSet_unparseFull (value));
     } end_aliasTable_elements;

   return st;
}

/*
** bogus!
*/

void
aliasTable_fixSrefs (aliasTable s)
{
  int i;

  if (aliasTable_isUndefined (s)) return;

  for (i = 0; i < s->nelements; i++)
    {
      sRef old = s->keys[i];

      if (sRef_isLocalVar (old))
	{
	  s->keys[i] = uentry_getSref (sRef_getUentry (old));
	}

      sRefSet_fixSrefs (s->values[i]);
    }
}

void
aliasTable_free (/*@only@*/ aliasTable s)
{
  int i;
  
  if (aliasTable_isUndefined (s)) return;
  
  for (i = 0; i < s->nelements; i++)
    {
      sRefSet_free (s->values[i]); 
    }
  
  sfree (s->values);
  sfree (s->keys);
  sfree (s);
}

void 
aliasTable_checkGlobs (aliasTable t)
{
  aliasTable_elements (t, key, value)
    {
      sRef root = sRef_getRootBase (key);

      if (sRef_isAliasCheckedGlobal (root))
	{
	  sRefSet_realElements (value, sr)
	    {
	      root = sRef_getRootBase (sr);

	      if (((sRef_isAliasCheckedGlobal (root) 
		    && !(sRef_similar (root, key)))
		   || sRef_isAnyParam (root))
		  && !sRef_isExposed (root))
		{
		  if (sRef_isAliasCheckedGlobal (key))
		    {
		      if (!(sRef_isShared (key) 
			    && sRef_isShared (root)))
			{
			  voptgenerror 
			    (FLG_GLOBALIAS,
			     message 
			     ("Function returns with %q variable %q aliasing %q %q",
			      cstring_makeLiteral (sRef_isRealGlobal (key) 
						   ? "global" : "file static"),
			      sRef_unparse (key),
			      cstring_makeLiteral (sRef_isAnyParam (root) 
						   ? "parameter" : "global"),
			      sRef_unparse (sr)),
			     g_currentloc);
			}
		    }

		}
	    } end_sRefSet_realElements;
	}
      else if (sRef_isAnyParam (key) || sRef_isAnyParam (root))
	{
	  sRefSet_realElements (value, sr)
	    {
	      root = sRef_getRootBase (sr);
	      
	      if (sRef_isAliasCheckedGlobal (root) 
		  && !sRef_isExposed (root)
		  && !sRef_isDead (key)
		  && !sRef_isShared (root))
		{
		  voptgenerror 
		    (FLG_GLOBALIAS,
		     message ("Function returns with parameter %q aliasing %q %q",
			      sRef_unparse (key),
			      cstring_makeLiteral (sRef_isRealGlobal (root) 
						   ? "global" : "file static"),
			      sRef_unparse (sr)),
		     g_currentloc);
		}
	    } end_sRefSet_realElements;
	}
      else
	{
	  ;
	}
    } end_aliasTable_elements;
}

# ifdef DEBUGSPLINT

/*
** For debugging only
*/

void aliasTable_checkValid (aliasTable t)
{
  aliasTable_elements (t, key, value)
    {
      sRef_checkCompletelyReasonable (key);

      sRefSet_elements (value, sr) 
	{
	  sRef_checkCompletelyReasonable (sr);
	} end_sRefSet_elements ;
    } end_aliasTable_elements ;
}
# endif
splint-3.1.2.dfsg1/src/ynm.c0000644021234200000250000000265407630461222013212 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** ynm.c
*/

# include "splintMacros.nf"
# include "basic.h"

ynm ynm_fromCodeChar (char c)
{
  switch (c)
    {
    case '+': return YES;
    case '-': return NO;
    case '=': return MAYBE;
    BADDEFAULT;
    }
}

int ynm_compare (ynm x, ynm y)
{
  switch (x)
    {
    case YES: if (y == YES) return 0; else return 1;
    case NO:  if (y == NO)  return 0; else return -1;
    case MAYBE: if (y == MAYBE) return 0; else return 1;
    }

  BADEXIT;
}
      
      
splint-3.1.2.dfsg1/src/sRefTable.c0000644021234200000250000000652707630461221014260 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** sRefTable.c
**
** based on table_template.c
**
** where T has T_equal (or change this) and T_unparse
*/

# include "splintMacros.nf"
# include "basic.h"
# include "sRefTable.h"

static /*@notnull@*/ /*@only@*/ sRefTable
sRefTable_new (void)
{
  sRefTable s = (sRefTable) dmalloc (sizeof (*s));

  s->entries = 0;
  s->nspace = sRefTableBASESIZE;
  s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefTableBASESIZE);

  return (s);
}

static void
sRefTable_grow (/*@notnull@*/ sRefTable s)
{
  int i;
  sRef *newelements; 

  s->nspace = sRefTableBASESIZE;
  newelements = (sRef *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace));

  for (i = 0; i < s->entries; i++)
    {
      newelements[i] = s->elements[i];
    }

  sfree (s->elements);
  s->elements = newelements;
}

sRefTable
sRefTable_add (sRefTable s, /*@owned@*/ sRef el)
{
  if (sRefTable_isNull (s))
    {
      s = sRefTable_new ();
    }

  if (s->nspace <= 0)
    {
      sRefTable_grow (s);
    }

  s->nspace--;
  
  llassert (s->elements != NULL);
  s->elements[s->entries] = el;
  DPRINTF (("Adding to sRef table: [%p]", el));
  
  s->entries++;
  return s;
}

void
sRefTable_clear (sRefTable s)
{
# ifdef DEBUGSPLINT
  usymtab_checkAllValid ();
# endif

  if (sRefTable_isDefined (s))
    {
      int i;
      
      for (i = 0; i < s->entries; i++)
	{
	  DPRINTF (("Table clear: [%p] %s", s->elements[i], sRef_unparseDebug (s->elements[i])));
	  /* sRef_checkValid (s->elements[i]); */
	  sRef_free (s->elements[i]); 
	}
      
      s->nspace += s->entries;
      s->entries = 0;
    }

# ifdef DEBUGSPLINT
  usymtab_checkAllValid ();
# endif
}

static int sRefTable_size (sRefTable s)
{
  if (sRefTable_isNull (s)) return 0;
  return s->entries;
}

/*@only@*/ cstring
sRefTable_unparse (sRefTable s)
{
  int i;
  cstring st = cstring_undefined;

  if (sRefTable_isDefined (s))
    {
      for (i = 0; i < sRefTable_size (s); i++)
	{
	  if (i == 0)
	    st = message ("%4d. %q\n", i, sRef_unparse (s->elements[i]));
	  else
	    st = message ("%q%4d. %q\n", st, i, sRef_unparse (s->elements[i]));
	}
    }
  return st;
}

void
sRefTable_free (/*@only@*/ sRefTable s)
{
  if (sRefTable_isDefined (s))
    {
      int i;

      for (i = 0; i < s->entries; i++)
	{
	  DPRINTF (("Table free: [%p] %s", s->elements[i], sRef_unparse (s->elements[i])));
	  sRef_free (s->elements[i]);
	}

      sfree (s->elements); 
      sfree (s);
    }
}

splint-3.1.2.dfsg1/src/ekind.c0000644021234200000250000000750307630461220013475 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** ekind.c
*/

# include "splintMacros.nf"
# include "basic.h"

ekind
ekind_fromInt (int i)
{
  if /*@+enumint@*/ (i < KINVALID || i > KELAST) /*@=enumint@*/
    {
      llcontbug (message ("ekind_fromInt: invalid: %d", i));
      return KINVALID; 
    }

  return (ekind)i;
}

cstring ekind_unparse (ekind k)
{
  switch (k)
    {
    case KENUMCONST:   return cstring_makeLiteralTemp ("ect");
    case KCONST:       return cstring_makeLiteralTemp ("cst");
    case KVAR:         return cstring_makeLiteralTemp ("var");
    case KITER:        return cstring_makeLiteralTemp ("itr");
    case KENDITER:     return cstring_makeLiteralTemp ("etr");
    case KDATATYPE:    return cstring_makeLiteralTemp ("dtp");
    case KFCN:         return cstring_makeLiteralTemp ("fcn");
    case KSTRUCTTAG:   return cstring_makeLiteralTemp ("stg");
    case KUNIONTAG:    return cstring_makeLiteralTemp ("utg");
    case KENUMTAG:     return cstring_makeLiteralTemp ("etg");
    case KELIPSMARKER: return cstring_makeLiteralTemp ("eps");
    case KINVALID:     return cstring_makeLiteralTemp ("[invalid]");
    }

  BADEXIT;
}

cstring ekind_unparseLong (ekind k)
{
  switch (k)
    {
    case KCONST:       return cstring_makeLiteralTemp ("constant");
    case KENUMCONST:   return cstring_makeLiteralTemp ("enum member");
    case KVAR:         return cstring_makeLiteralTemp ("variable");
    case KITER:        return cstring_makeLiteralTemp ("iterator");
    case KENDITER:     return cstring_makeLiteralTemp ("iterator finalizer");
    case KDATATYPE:    return cstring_makeLiteralTemp ("datatype");
    case KFCN:         return cstring_makeLiteralTemp ("function");
    case KSTRUCTTAG:   return cstring_makeLiteralTemp ("struct tag");
    case KUNIONTAG:    return cstring_makeLiteralTemp ("union tag");
    case KENUMTAG:     return cstring_makeLiteralTemp ("enum tag");
    case KELIPSMARKER: return cstring_makeLiteralTemp ("...");
    case KINVALID:     return cstring_makeLiteralTemp ("[invalid]");
    }

  BADEXIT;
}

cstring
ekind_capName (ekind k)
{
  switch (k)
    {
    case KCONST:       return cstring_makeLiteralTemp ("Constant");
    case KENUMCONST:   return cstring_makeLiteralTemp ("Enum member");
    case KVAR:         return cstring_makeLiteralTemp ("Variable");
    case KITER:        return cstring_makeLiteralTemp ("Iterator");
    case KENDITER:     return cstring_makeLiteralTemp ("Iterator finalizer");
    case KDATATYPE:    return cstring_makeLiteralTemp ("Datatype");
    case KFCN:         return cstring_makeLiteralTemp ("Function");
    case KSTRUCTTAG:   return cstring_makeLiteralTemp ("Struct tag");
    case KUNIONTAG:    return cstring_makeLiteralTemp ("Union tag");
    case KENUMTAG:     return cstring_makeLiteralTemp ("Enum tag");
    case KELIPSMARKER: return cstring_makeLiteralTemp ("...");
    case KINVALID:     return cstring_makeLiteralTemp ("[invalid]");
    }

  BADEXIT;
}

splint-3.1.2.dfsg1/src/genericTable.c0000644021234200000250000002350207650647340014777 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** genericTable.c
**
** A genericTable is a mapping from string keys to void * objects.
** We sacrific type checking here for code reuse.
*/

# include "splintMacros.nf"
# include "basic.h"
# include "randomNumbers.h"

/*@constant null ghbucket ghbucket_undefined; @*/
# define ghbucket_undefined 0

static /*@nullwhentrue@*/ bool ghbucket_isNull (/*@null@*/ ghbucket h) 
{ 
  return (h == ghbucket_undefined); 
}

static ghentry
ghentry_create (/*@keep@*/ cstring key, /*@keep@*/ void *val)
{
  ghentry h = (ghentry) dmalloc (sizeof (*h));

  h->key = key;

  llassert (val != NULL);
  h->val = val;

  return (h);
}

static void
ghentry_free (/*@only@*/ ghentry ghe)
{
  cstring_free (ghe->key);
  /* can't free val contents */
  sfree (ghe->val);
  sfree (ghe);
}

static bool
ghbucket_isEmpty (ghbucket h)
{
  return (h == ghbucket_undefined || h->size == 0);
}

int genericTable_size (genericTable h)
{
  if (genericTable_isDefined (h)) {
    return h->nentries;
  } else {
    return 0;
  }
}

# if 0
static /*@unused@*/ cstring
ghbucket_unparse (ghbucket h)
{
  cstring s = cstring_undefined;

  if (!ghbucket_isNull (h))
    {
      int i;
      
      for (i = 0; i < h->size; i++)
	{
	  s = message ("%q %s", s, h->entries[i]->key);
	}
    }

  return s;
}
# endif

static ghbucket ghbucket_single (/*@keep@*/ ghentry e)
{
  ghbucket h = (ghbucket) dmalloc (sizeof (*h));
  
  h->size = 1;
  h->nspace = GHBUCKET_BASESIZE - 1;
  h->entries = (ghentry *) dmalloc (GHBUCKET_BASESIZE * sizeof (*h->entries));
  h->entries[0] = e;
  
  return (h);
}

static void
ghbucket_grow (/*@notnull@*/ ghbucket h)
{
  int i;
  ghentry *newentries; 
  
  h->nspace += GHBUCKET_BASESIZE;

  newentries = (ghentry *) 
    dmalloc ((h->size + GHBUCKET_BASESIZE) * sizeof (*newentries));
  
  for (i = 0; i < h->size; i++) 
    {
      newentries[i] = h->entries[i]; 
    }
  
  sfree (h->entries);
  h->entries = newentries; 
  /*@-compmempass@*/
} /*@=compmempass*/ /* Spurious warnings reported for h->entries */ 

static /*@null@*/ /*@exposed@*/ void *ghbucket_lookup (ghbucket p_h, cstring p_key);

/*
** bizarre duplicate behaviour
** required for duplicate entries
*/

static void
ghbucket_add (/*@notnull@*/ ghbucket h, /*@only@*/ ghentry e)
{
  void *exloc = ghbucket_lookup (h, e->key);
  
  if (exloc != NULL) {
    llcontbug (message ("ghbucket_add: adding duplicate entry: %s",
			e->key));
    ghentry_free (e);
    return;
  }
  
  if (h->nspace == 0) {
    ghbucket_grow (h);
  }
  
  h->entries[h->size] = e;
  h->size++;
  h->nspace--;
}

static int
ghbucket_ncollisions (ghbucket h)
{
  if (!ghbucket_isNull (h) && (h->size > 1))
    return (h->size - 1);
  else
    return 0;
}

/*@exposed@*/ /*@null@*/ void *
ghbucket_lookup (ghbucket h, cstring key)
{
  if (!ghbucket_isNull (h))
    {
      int i;
      
      for (i = 0; i < h->size; i++)
	{
	  if (cstring_equal (h->entries[i]->key, key))
	    {
		return h->entries[i]->val;
	    }
	}
    }

  return NULL;
}

static
void ghbucket_free (/*@only@*/ ghbucket h)
{
  if (!ghbucket_isNull (h))
    {
      int i;

      for (i = 0; i < h->size; i++)  
	{
	  ghentry_free (h->entries[i]);
	}

      sfree (h->entries);
      sfree (h);
    }
}

void 
genericTable_free (/*@only@*/ genericTable h)
{
  if (genericTable_isDefined (h))
    {
      int i;
      
      for (i = 0; i < h->size; i++)
	{
	  ghbucket_free (h->buckets[i]);
	}
      
      sfree (h->buckets);
      sfree (h);
    }
}

static int
genericTable_countCollisions (genericTable h)
{
  int nc = 0;
  int i;

  llassert (genericTable_isDefined (h)); 

  for (i = 0; i < h->size; i++)
    {
      nc += ghbucket_ncollisions (h->buckets[i]);
    }

  return (nc);
}


static int
genericTable_countEmpty (genericTable h)
{
  int nc = 0;
  int i;

  llassert (genericTable_isDefined (h)); 

  for (i = 0; i < h->size; i++)
    {
      if (ghbucket_isEmpty (h->buckets[i]))
	{
	  nc++;
	}
    }

  return (nc);
}

/*
** hash function snarfed from quake/hash.c Hash_String
** by Stephen Harrison
*/

static unsigned int 
genericTable_hashValue (/*@notnull@*/ genericTable h, cstring key)
{
  char *p;
  unsigned int hash_value = 0;

  llassert (h->size != 0);

  for (p = cstring_toCharsSafe (key); *p != '\0'; p++)
    {
      hash_value = (hash_value << 1) ^ g_randomNumbers[*p % 256];
    }

  return (hash_value % h->size);
}

static /*@exposed@*/ ghbucket
genericTable_hash (/*@notnull@*/ genericTable h, cstring key)
{
  return h->buckets[genericTable_hashValue (h, key)];
}


/*@only@*/ genericTable
genericTable_create (int size)
{
  int i;
  genericTable h = (genericTable) dmalloc (sizeof (*h));

  llassert (size > 0);
  h->size = size;
  h->nentries = 0;
  h->buckets = (ghbucket *) dmalloc (sizeof (*h->buckets) * size);
  
  /*@+loopexec@*/
  for (i = 0; i < size; i++)
    {
      h->buckets[i] = ghbucket_undefined;
    }
  /*@-loopexec@*/
  return h;
}

# if 0
/*@-mustfree@*/
static /*@unused@*/ void
genericTable_print (genericTable h)
{
  int i;

  if (genericTable_isDefined (h)) {
    for (i = 0; i < h->size; i++)
      {
	ghbucket hb = h->buckets[i];
	
	if (hb != NULL)
	  {
	    llmsg (message ("%d. %s\n", i, ghbucket_unparse (hb)));
	  }
      }
    
    llmsg (message ("size: %d, collisions: %d, empty: %d", 
		    h->size, 
		    genericTable_countCollisions (h),
		    genericTable_countEmpty (h)));
  } else {
    llmsglit ("Empty hash table.");
  }
}
/*@=mustfree@*/
# endif

/*@only@*/ cstring
genericTable_stats (genericTable h)
{
  llassert (genericTable_isDefined (h)); 
  return (message ("size: %d, collisions: %d, empty: %d\n", 
		   h->size, genericTable_countCollisions (h),
		   genericTable_countEmpty (h)));
}

static void
genericTable_addEntry (/*@notnull@*/ genericTable h, /*@only@*/ ghentry e)
{
  unsigned int hindex = genericTable_hashValue (h, e->key);
  /*
  ** using
  **   ghbucket hb = h->buckets[hindex];  
  ** instead reveals a bug I don't want to deal with right now!
  */

  h->nentries++;
  
  if (ghbucket_isNull (h->buckets[hindex]))
    {
      h->buckets[hindex] = ghbucket_single (e); 
    }
  else
    {
      ghbucket_add (h->buckets[hindex], e);
    }
}

void
genericTable_insert (genericTable h, cstring key, void *value)
{
  unsigned int hindex;
  ghbucket hb;
  ghentry e;  

  llassert (genericTable_isDefined (h)); 

  /*
  ** rehashing based (loosely) on code by Steve Harrison
  */

  if (h->nentries * 162 > h->size * 100) 
    {
      int i;
      int oldsize = h->size;
      int newsize = 1 + ((oldsize * 26244) / 10000); /* 26244 = 162^2 */
      ghbucket *oldbuckets = h->buckets;

      DPRINTF (("Rehashing..."));
      h->size = newsize;  
      h->nentries = 0;
      h->buckets = (ghbucket *) dmalloc (sizeof (*h->buckets) * newsize);

      /*@+loopexec@*/
      for (i = 0; i < newsize; i++)
	{
	  h->buckets[i] = ghbucket_undefined;
	}
      /*@=loopexec@*/
      
      for (i = 0; i < oldsize; i++)
	{
	  ghbucket bucket = oldbuckets[i];

	  oldbuckets[i] = NULL;

	  if (!ghbucket_isNull (bucket))
	    {
	      int j;
	      
	      for (j = 0; j < bucket->size; j++)
		{
		  genericTable_addEntry (h, bucket->entries[j]);
		}
	      
	      sfree (bucket->entries); /* evans 2001-03-24: Splint caught this */
	      sfree (bucket);
	    }
	}

      sfree (oldbuckets);
    }

  /* evans 2000-12-22: this was before the rehash!  Lost an entry size! */
  h->nentries++;
  e = ghentry_create (key, value);
  hindex = genericTable_hashValue (h, key);
  hb = h->buckets[hindex];
  
  if (ghbucket_isNull (hb))
      {
	h->buckets[hindex] = ghbucket_single (e);
      }
  else
      {
	ghbucket_add (hb, e);
      }
}

/*@null@*/ /*@exposed@*/ void *
genericTable_lookup (genericTable h, cstring key)
{
  ghbucket hb;
  void *res;
  llassert (genericTable_isDefined (h));

  hb = genericTable_hash (h, key);
  res = ghbucket_lookup (hb, key);

  /* if (res == NULL) { DPRINTF (("Lookup not found: %s", key)); } */
  return res;
}

void
genericTable_update (genericTable h, cstring key, /*@only@*/ void *newval)
{
  ghbucket hb;

  llassert (genericTable_isDefined (h));

  hb = genericTable_hash (h, key);

  if (!ghbucket_isNull (hb))
    {
      int i;
      
      for (i = 0; i < hb->size; i++)
	{
	  if (cstring_equal (hb->entries[i]->key, key))
	    {
	      llassert (newval != NULL);
	      hb->entries[i]->val = newval;
	      return;
	    }
	}
    }

  llbug (message ("genericTable_update: %s not found", key));
}

void
genericTable_remove (genericTable h, cstring key)
{
  ghbucket hb;

  llassert (genericTable_isDefined (h));
  hb = genericTable_hash (h, key);

  if (!ghbucket_isNull (hb))
    {
      int i;
      
      for (i = 0; i < hb->size; i++)
	{
	  if (cstring_equal (hb->entries[i]->key, key))
	    {
	      if (i < hb->size - 1)
		{
		  hb->entries[i] = hb->entries[hb->size - 1];
		}
	      
	      hb->size--;
	      return;
	    }
	}
    }

  llbug (message ("genericTable_removeKey: %s not found", key));
}

bool genericTable_contains (genericTable h, cstring key) 
{
  return (genericTable_lookup (h, key) != NULL);
}
splint-3.1.2.dfsg1/src/usymtab.c0000644021234200000250000043003410102766474014075 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** usymtab
**
** Lexically scoped symbol table.
**
** Unlike a normal symbol table, this table splits to reflect branches.
**
** This is necessary since symbol table entries also reflect
** some state information, like initialization, that may be
** different on different branches.
**
** For each control structure we split:
**
** { }                - a normal scope (no control) US_NORMAL
**
** if  { }      - US_TBRANCH true branch
** while  { }     US_FBRANCH else branch
**
** switch  { }  - US_SWITCH
**
** case x:            - case scope US_CBRANCH
**                      Should be kept in a separate table, because of
**                      weird C syntax.
*/

# include "splintMacros.nf"
# include "basic.h"
# include "structNames.h"
# include "exprChecks.h"
# include "transferChecks.h"

/* Needed to install macros when loading libraries */

# include "cpplib.h"
# include "cpperror.h"
# include "cpphash.h"

/*
** Keep track of type definitions inside a function.
*/

static uentryList functypes = uentryList_undefined;

static bool dbgfree = FALSE;
static bool dbgload = TRUE;

/*@access ekind@*/

/*
** Hack to prevent shadow errors from appearing when function parameters
** are entered into a new scope.
*/

static bool noshadowerror = FALSE;

/*
** Constraint: static variables can live in 1 or > 2. 
**
** except for tags.  All tags must be at the global level.
** Static tags are handled in a kludgey way.
*/

/*
** utab    is the universal symbol table
** globtab is the global environment of utab
** oldtab  is needed for conversions in dumping (after sorting the table)
**
** there can be only one usymtab!
*/

static /*@checkedstrict@*/ /*@owned@*/ /*@notnull@*/ usymtab utab;

/* Reachable environments from from utab */
static /*@checkedstrict@*/ /*@notnull@*/ /*@dependent@*/ usymtab globtab;
static /*@checkedstrict@*/ /*@dependent@*/ usymtab filetab;

/* Used for sorting for dumpage. */
static /*@checkedstrict@*/ /*@owned@*/ usymtab oldtab;

static int usymtab_lexicalLevel (void) /*@globals utab@*/ ;
static bool usymtab_isAltDefinitelyNull (sRef p_s) /*@globals utab@*/ ;
static void refTable_free (/*@only@*/ /*@null@*/ refTable p_x, int p_nentries);
static ctype usymtab_suFieldsType (uentryList p_f, bool p_isStruct) /*@globals globtab@*/ ;

static void usymtab_freeAux (/*@only@*/ usymtab p_u)
     /*@globals globtab, utab, filetab@*/
     /*@modifies p_u@*/ ;

extern int usymtab_getCurrentDepth (void) /*@globals utab@*/ 
{
  return utab->lexlevel;
}

static void
usymtab_freeLevel (/*@notnull@*/ /*@only@*/ usymtab p_u)
  /*@globals globtab, utab, filetab@*/ /*@modifies p_u@*/ ;

static bool usymtab_isDefinitelyNullAux (sRef p_s) /*@globals utab@*/ ;
static /*@only@*/ cstring usymtab_unparseStackTab (usymtab p_t);
static /*@exposed@*/ /*@dependent@*/ uentry 
  usymtab_getRefTab (/*@notnull@*/ usymtab p_u, int p_level, usymId p_index);

# ifdef S_SPLINT_S
/* These are not used anymore... */
static /*@unused@*/ /*@only@*/ cstring 
  usymtab_unparseLocalAux (/*@notnull@*/ usymtab p_s);
static /*@unused@*/ /*@only@*/ cstring 
  usymtab_unparseLocalList (/*@notnull@*/ usymtab p_s);
# endif

static /*@only@*/ cstring usymtab_typeName (/*@notnull@*/ usymtab p_t);
static void usymtab_handleParams (void)
   /*@globals utab, globtab, filetab@*/ 
   /*@modifies utab@*/ ;

static /*@exposed@*/ /*@dependent@*/ uentry 
  usymtab_addRefEntry (/*@notnull@*/ usymtab p_s, cstring p_k);
static /*@exposed@*/ /*@dependent@*/ usymtab
  usymtab_dropEnv (/*@notnull@*/ usymtab p_s);
static /*@exposed@*/ /*@dependent@*/ uentry 
  usymtab_getRefNoisy (/*@notnull@*/ usymtab p_s, int p_level, usymId p_index);

static /*@exposed@*/ /*@dependent@*/ uentry 
  usymtab_lookupQuietAux (usymtab p_s, cstring p_k, bool p_noalt);

static /*@exposed@*/ /*@dependent@*/ uentry 
  usymtab_lookupQuiet (usymtab p_s, cstring p_k);

static /*@exposed@*/ /*@dependent@*/ uentry 
  usymtab_lookupQuietNoAlt (usymtab p_s, cstring p_k);

static void usymtab_printAllAux (usymtab p_s) /*@modifies g_warningstream@*/ ;

/*@function bool usymtab_indexFound (usymId) @*/
# define usymtab_indexFound(u) ((u) != usymId_notfound)

static usymId usymtab_getIndex (/*@notnull@*/ usymtab p_s, cstring p_k);
static /*@exposed@*/ uentry usymtab_fetchIndex (/*@notnull@*/ usymtab p_s, usymId p_ui);
static /*@exposed@*/ uentry usymtab_lookupAux (usymtab p_s, cstring p_k);

static /*@exposed@*/ /*@dependent@*/ /*@notnull@*/ 
   usymtab usymtab_getFileTab (void) /*@globals filetab@*/ ;

static int refTable_lookup (/*@notnull@*/ usymtab p_ut, int p_level, usymId p_index);
static bool usymtab_mustBreak (usymtab p_s);
static bool usymtab_mustEscape (usymtab p_s);

static void recordFunctionType (uentry ue)
{
  llassert (uentry_isDatatype (ue) || uentry_isAnyTag (ue)
	    || uentry_isEnumConstant (ue));
  DPRINTF (("Function type: %s", uentry_unparseFull (ue)));
  /*@-temptrans@*/
  functypes = uentryList_add (functypes, ue);
  /*@=temptrans@*/
}

static void clearFunctionTypes (void)
  /*@modifies globtab@*/
{
  uentryList_elements (functypes, el)
    {
      if (cstring_isDefined (uentry_rawName (el)))
	{
	  if (cstringTable_isDefined (globtab->htable))
	    {
	      cstringTable_remove (globtab->htable, uentry_rawName (el));
	    }

	  uentry_setName (el, cstring_undefined);
	}

      /*@access uentry@*/ 
      llassert (uentry_isValid (el));
      el->sref = sRef_undefined;
      /*@noaccess uentry@*/
    } end_uentryList_elements ;

  uentryList_clear (functypes);
}

static /*@falsewhennull@*/ bool usymtab_isBranch (usymtab u)
{
  return (usymtab_isDefined (u) && 
	  (u->kind == US_TBRANCH || u->kind == US_FBRANCH
	   || u->kind == US_CBRANCH || u->kind == US_SWITCH));
}

static bool usymtab_mustBreak (usymtab s)
{
  llassert (s != GLOBAL_ENV);
  return (s->mustBreak);
}

static bool usymtab_mustEscape (usymtab s)
{
  llassert (s != GLOBAL_ENV);
  return (exitkind_mustEscape (s->exitCode));
}

void usymtab_setMustBreak () 
  /*@modifies utab@*/
{
  llassert (utab != GLOBAL_ENV);
  utab->mustBreak = TRUE;
}

void usymtab_setExitCode (exitkind ex) 
   /*@modifies utab@*/
{
  llassert (utab != GLOBAL_ENV);

  utab->exitCode = ex;
  
  if (exitkind_mustEscape (ex))
    {
      utab->mustBreak = TRUE;
    }
}

bool usymtab_isAltDefinitelyNullDeep (sRef s)
{
  return (sRef_deepPred (usymtab_isAltDefinitelyNull, s));
}

static bool usymtab_isAltDefinitelyNull (sRef s) 
   /*@globals utab@*/
{
  guardSet t;
  bool res;

  t = utab->guards;

  llassert (utab->env != NULL);

  /*@-mods@*/ /* These modifications are cancelled. */
  utab->guards = utab->env->guards;
  utab->env->guards = t;
  /*@=mods@*/

  llassert (usymtab_isDefined (utab));
  res = usymtab_isDefinitelyNull (s);

  /*
  ** This reports a spurious error.  It is okay, because of
  ** the nesting relationship of usymtab environments.
  */

  /*@-mods@*/ /* Cancelling modifications. */
  /*@i1@*/ utab->env->guards = utab->guards;
  /*@i1@*/ utab->guards = t;
  /*@=mods@*/ 

  return res;
}

static /*@notnull@*/ /*@special@*/ usymtab
  usymtab_create (uskind kind, /*@keep@*/ usymtab env, bool nextlevel)
  /*@defines result@*/
  /*@post:isnull result->htable, result->guards, result->aliases@*/
{
  usymtab t = (usymtab) dmalloc (sizeof (*t));
  
  t->nentries = 0;
  t->nspace = CBASESIZE;
  t->entries = (uentry *) dmalloc (sizeof (*t->entries) * CBASESIZE);

  /* We only use a reftable for branch-level symbol tables. 
  */

  t->reftable = (nextlevel 
		 ? NULL
		 : (refentry *) dmalloc (sizeof (*t->reftable) * CBASESIZE));
  
  t->kind = kind;
  t->lexlevel = (env == GLOBAL_ENV ? 0 : env->lexlevel) + (nextlevel ? 1 : 0); 
  
  t->env = env;
  t->htable = NULL;

  t->guards = guardSet_undefined;
  t->aliases = aliasTable_undefined;

  t->mustBreak = FALSE;
  t->exitCode = XK_NEVERESCAPE;

  DPRINTF (("Create usymtab [%p]", t));
  return t;
}

/*
** constructors
*/

static /*@only@*/ /*@notnull@*/ usymtab
  usymtab_createRoot (void) /*@modifies nothing@*/
{
  usymtab u = (usymtab) dmalloc (sizeof (*u));
  
  u->nentries = 0;
  u->nspace = CGLOBBASESIZE;
  u->entries = (uentry *) dmalloc (sizeof (*u->entries) * CGLOBBASESIZE);
  u->env = GLOBAL_ENV;
  u->lexlevel = 0;
  u->htable = cstringTable_create (CGLOBHASHSIZE);
  u->reftable = NULL;
  
  u->guards = guardSet_new ();
  u->aliases = aliasTable_new ();

  u->mustBreak = FALSE;
  u->exitCode = XK_NEVERESCAPE;
  u->kind = US_NORMAL;

  return (u);
}

void
usymtab_initMod (void)
   /*@globals undef utab, undef oldtab, undef globtab, undef filetab @*/
   /*@modifies utab, globtab, filetab, oldtab @*/
{
  utab = usymtab_createRoot ();
  globtab = utab;
  filetab = usymtab_undefined;
  oldtab = usymtab_undefined;
}

void 
usymtab_destroyMod (void) /*@modifies utab, globtab, filetab@*/ /*@globals killed utab@*/ 
{
  DPRINTF (("Destroy usymtab [%p]: %d", utab, utab->nentries));
  usymtab_freeAux (utab);
  utab = usymtab_undefined;
  /*@-globstate@*/ 
} /*@=globstate@*/

void
usymtab_initGlobalMarker () /*@globals globtab@*/
{
  if (uentry_isValid (usymtab_lookupAux (globtab, GLOBAL_MARKER_NAME)))
    {
      ; /* Already entered from load table. */
    }
  else
    {
      usymtab_addGlobalEntry (uentry_makeGlobalMarker ());
    }
}

/*
** utab should be empty?  (requires?)
**
** Adds bool types to symbol table (these are built in for now)
** Only do this is there is no library!
*/

void
usymtab_initBool ()
{
  DPRINTF (("Init bool!"));

  if (context_getFlag (FLG_NOLIB))
    {
      ctype boolt = ctype_bool;
      /* evs 2000-07-24: bool is now treated as abstract (always) */

      uentry boolentry = uentry_makeBoolDatatype (qual_createAbstract ());
      usymtab_supGlobalEntry (boolentry);
      context_addBoolAccess ();

      /*
      ** We supply values 0 and 1 for the constants, so things like
      ** while (TRUE) can be interpreted correctly.
      */

      usymtab_supGlobalEntry 
	(uentry_makeConstantValue (context_getFalseName (), boolt, 
				   fileloc_getBuiltin (), FALSE, 
				   multiVal_makeInt (0)));

      usymtab_supGlobalEntry 
	(uentry_makeConstantValue (context_getTrueName (), boolt, 
				   fileloc_getBuiltin (), FALSE, 
				   multiVal_makeInt (1)));
    }
}

/*
** mutators 
*/

static void
usymtab_grow (/*@notnull@*/ usymtab s)
{
  int i;
  o_uentry *oldsyms = s->entries;

  s->nspace = CBASESIZE;
  s->entries = (uentry *) dmalloc (sizeof (*s->entries) 
				   * (s->nentries + s->nspace));

  for (i = 0; i < s->nentries; i++)
    {
      s->entries[i] = oldsyms[i];
    }

  sfree (oldsyms);

  if (s->reftable != NULL)
    {
      refTable oldRefs = s->reftable;

      s->reftable = (refentry *) dmalloc (sizeof (*s->reftable)
					  * (s->nentries + CBASESIZE + 1));
      
      for (i = 0; i < s->nentries; i++)
	{
	  s->reftable[i] = oldRefs[i];
	}

      /*@-compdestroy@*/ 
      sfree (oldRefs);
      /*@=compdestroy@*/ 
    }
      
}

static void
usymtab_addEntryQuiet (/*@notnull@*/ usymtab s, /*@keep@*/ uentry e)
{
  if (!(s->lexlevel > fileScope || !sRef_modInFunction ()))
    {
      if (uentry_isDatatype (e) 
	  || uentry_isFunction (e)
	  || uentry_isAnyTag (e)
	  || uentry_isEnumConstant (e)
	  || context_inMacro ())
	{
	  /* 
	  ** Not a bug.  Code like,
	  **    int f (void) { typedef int tint; ... }
	  ** is legal.
	  */
	  
	  /* was nothing here! */
	  /*@i@*/ e->sref = sRef_saveCopy (e->sref);
	}
      else
	{
	  llparseerror 
	    (cstring_makeLiteral ("Declaration outside function scope"));

	  llcontbug (message ("usymtab_addEntryQuiet: inconsistent state "
			      "(lexlevel = %d, modFunction = %s) adding: %q", 
			      s->lexlevel, bool_unparse (sRef_modInFunction ()), 
			      uentry_unparse (e)));
	  sRef_setGlobalScope ();
	  /* make sure the sRef is not bashed! */
	  /*@i@*/ e->sref = sRef_saveCopy (e->sref);
	}
    }

  if (s->nspace <= 0)
    {
      usymtab_grow (s);
    }
  
  s->nspace--;
  s->entries[s->nentries] = e;

# ifdef DOANNOTS
  if (s == globtab || s == filetab)
    {
      if (!fileloc_isLib (g_currentloc))
	{
	  uentry_tallyAnnots (e, AN_UNKNOWN);
	}
    }
# endif

  if (cstringTable_isDefined (s->htable))
    {
      cstringTable_insert (s->htable, cstring_copy (uentry_rawName (e)), s->nentries);
    }

  s->nentries++;
}

static /*@observer@*/ uentry /*@alt void@*/
usymtab_addEntryBase (/*@notnull@*/ usymtab s, /*@only@*/ uentry e)
{
  /* 
  ** In theory, we shouldn't need this test because it this is
  ** only called when a library is being read, and it shouldn't
  ** ever have a duplicate entry.  In practice, its safer to
  ** leave it in, though.
  */

  uentry old;

  if (uentry_isValid (old = usymtab_lookupQuiet (s, uentry_rawName (e))))
    {
      DPRINTF (("Duplicate entry: %s", uentry_unparse (e)));
      uentry_free (e); /* duplicate */
      return old;
    }
  else
    {
      usymId thisentry = usymId_fromInt (s->nentries); 
      
      if (uentry_isVar (e))
	{
	  uentry_setSref 
	    (e, sRef_makeCvar (globScope, thisentry, 
			       uentry_getType (e),
			       stateInfo_makeLoc (uentry_whereLast (e), SA_DECLARED)));
	}
      
      usymtab_addEntryQuiet (s, e);
      return e;
    }
}


static /*@observer@*/ uentry /*@alt void@*/
usymtab_addEntryAlways (/*@notnull@*/ usymtab s, /*@only@*/ uentry e)
{
  /* 
  ** In theory, we shouldn't need this test because it this is
  ** only called when a library is being read, and it shouldn't
  ** ever have a duplicate entry.  In practice, its safer to
  ** leave it in, though.
  */

  uentry old;
  usymId thisentry = usymId_fromInt (s->nentries);

  if (uentry_isValid (old = usymtab_lookupQuiet (s, uentry_rawName (e))))
    {
      llcontbug 
	(message ("Duplicate entry in load library: %s. "
		  "Old entry: %q.  New entry: %q", 
		  uentry_rawName (e),
		  uentry_unparseFull (old),
		  uentry_unparseFull (e)));

      uentry_setName (e, message ("__x_%s", uentry_rawName (e)));
      /* This shouldn't happen...unless the library is bad! */
    }


  if (uentry_isVar (e) && !uentry_isGlobalMarker (e))
    {
      uentry_setSref 
	(e, sRef_makeCvar (globScope, thisentry, 
			   uentry_getType (e),
			   stateInfo_makeLoc (uentry_whereLast (e), SA_DECLARED)));
    }
  
  usymtab_addEntryQuiet (s, e);
  return e;
}

static usymId
usymtab_addEntryAux (/*@notnull@*/ usymtab st, /*@keep@*/ uentry e, bool isSref)
     /*@globals globtab@*/
     /*@modifies st, e@*/
{
  usymId thisentry = usymId_fromInt (st->nentries);

  llassert (!uentry_isElipsisMarker (e));

  /*
  ** not true for tags
  **  llassert (usymtab_lookupSafe (uentry_rawName (e)) == uentry_undefined);
  **/

  llassertprint (uentry_isAnyTag (e) ? st == globtab : TRUE, 
		 ("non-global tag: %s / %d", uentry_unparseFull (e), st->lexlevel));

  if (st->lexlevel == fileScope 
      && (!(uentry_isStatic (e)) || uentry_isAnyTag (e))) 
    {
      st = globtab;
    }

  if (isSref)
    {
      ctype ct = uentry_getType (e);

      if (uentry_isFunction (e) && ctype_isFunction (ct))
	{
	  ct = ctype_getReturnType (ct);
	}

      if (uentry_isStatic (e))
	{
	  sRef sr = sRef_makeCvar (st->lexlevel, thisentry, ct,
				   stateInfo_makeLoc (uentry_whereLast (e), SA_DECLARED));

	  if (sRef_isStack (sr) || sRef_isLocalState (sr))
	    {
	      sRef_setAliasKind (sr, AK_STATIC, uentry_whereLast (e));
	      sRef_setDefined (sr, uentry_whereLast (e));
	    }
	  
	  uentry_setSref (e, sr);
	}
      else
	{
	  uentry_setSref 
	    (e, sRef_makeCvar (st->lexlevel, thisentry, ct,
			       stateInfo_makeLoc (uentry_whereLast (e), SA_DECLARED)));
	}
    }

  if (uentry_isDatatype (e))
    {
      uentry_setDatatype (e, typeId_fromUsymId (thisentry));
    }

  if (uentry_isFunction (e))
    {
      ctype ct = uentry_getType (e);

      if (ctype_isFunction (ct)
	  && uentryList_isMissingParams (ctype_argsFunction (ct)))
	{
	  if (uentry_isDeclared (e))
	    {
	      voptgenerror 
		(FLG_NOPARAMS,
		 message ("Function %q declared without parameter list",
			  uentry_getName (e)),
		 uentry_whereDeclared (e));
	    }
	  else
	    {
	      voptgenerror
		(FLG_NOPARAMS,
		 message ("Function %q specified without parameter list",
			  uentry_getName (e)),
		 uentry_whereSpecified (e));
	    }
	}
    }

  if (st == globtab && !uentry_isSpecified (e))
    {
      exprChecks_checkExport (e);
    }
  
  uentry_checkName (e);
  
  usymtab_addEntryQuiet (st, e);
  DPRINTF (("Adding entry: [%p] %s", e, uentry_unparseFull (e)));
  return (thisentry);
}

usymId
usymtab_addEntry (uentry e) 
   /*@globals utab, globtab@*/
   /*@modifies utab, e@*/
{  
  llassertprint (!usymtab_exists (uentry_rawName (e)),
		 ("Entry already exists: %s", uentry_unparse (e)));

  return usymtab_addEntryAux (utab, e, FALSE);
}

void
usymtab_addGlobalEntry (uentry e)
   /*@modifies globtab, e@*/ 
{
  DPRINTF (("Add global: %s / %s", uentry_unparse (e), bool_unparse (uentry_isForward (e))));

  (void) usymtab_addEntryAux (globtab, e, FALSE);
}

/*
** supercede and replace entry use elements of entries array, and
** assign an element to a new value, and then free the old value.
** Need -deparrays to avoid errors for this. 
*/

/*@-deparrays@*/ 

static usymId
usymtab_supEntryAux (/*@notnull@*/ usymtab st, 
		     /*@only@*/ uentry e, bool isSref)
   /*@globals globtab, filetab@*/
   /*@modifies st, globtab, e@*/
{
  cstring ename = uentry_rawName (e);
  bool staticEntry = FALSE;
  usymId eindex;

  DPRINTF (("Sup entry aux: %s", uentry_unparseFull (e)));
  
  /* static tags in global scope */
  if (st->lexlevel == fileScope 
      && (!(uentry_isStatic (e)) || uentry_isAnyTag (e))) 
    {
      eindex = usymtab_getIndex (st, ename);

      if (usymtab_indexFound (eindex))
	{
	  uentry ce = st->entries[eindex];      
	  
	  if (optgenerror
	      (FLG_SHADOW,
	       message ("%s %q shadows static declaration",
			ekind_capName (uentry_getKind (e)),
			uentry_getName (e)),
	       uentry_whereDeclared (e)))
	    {
	      uentry_showWhereLast (ce);
	    }

	  if (eindex == usymId_fromInt (st->nentries - 1))
	    {
	     ;
	    }
	  else
	    {
	      st->entries[eindex] = st->entries[st->nentries - 1];
	    }

	  if (cstringTable_isDefined (st->htable))
	    {
	      cstringTable_replaceKey (st->htable, uentry_rawName (ce), 
				       cstring_copy (uentry_rawName (e)));
	    }

	  uentry_free (ce);
	  st->nentries--;
	}
      
      st = globtab;
    }

  if (uentry_isStatic (e)) {
    if (uentry_isFunction (e)) {
      /* 
      ** Static function declarations are at the file level,
      ** even if they are in a deeper scope. 
      */

      st = usymtab_getFileTab ();
      staticEntry = TRUE;
    } else {
      if (!uentry_isAnyTag (e) && st == globtab) 
	{
	  st = usymtab_getFileTab ();
	  staticEntry = TRUE;
	  DPRINTF (("Static entry!"));
	}
    }
  }

  eindex = usymtab_getIndex (st, ename);
      
  if (usymtab_indexFound (eindex))
    {
      uentry ce = st->entries[eindex];
      
      DPRINTF (("Found entry: %s", uentry_unparse (ce)));

      if (uentry_isPriv (ce)
	  /* || (fileloc_isImport (uentry_whereSpecified (ce))) */
	  || (uentry_isStatic (ce) 
	      && uentry_isAnyTag (ce)
	      && (uentry_isDeclared (ce) 
		  && !fileloc_sameFile (uentry_whereDefined (ce),
					uentry_whereDefined (e)))))
	{
	  /*
          ** overload entry 
	  **    if overloading import should do some checks!
	  */

	  llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
	  
	  DPRINTF (("Overloading!"));

	  st->entries[eindex] = e;

	  if (uentry_isDatatype (e))
	    {
	      uentry_setDatatype (e, typeId_fromUsymId (eindex));
	    }
	  
	  if (st == globtab && !uentry_isSpecified (e))
	    {
	      exprChecks_checkExport (e);
	    }

	  if (cstringTable_isDefined (st->htable))
	    {
	      cstringTable_replaceKey (st->htable, uentry_rawName (ce), 
				       cstring_copy (uentry_rawName (e)));
	    }

	  uentry_free (ce);
	  ce = e; 
	}
      else if (uentry_isSpecified (ce))
	{
	  if (uentry_isSpecified (e))
	    {
	      DPRINTF (("Here we are: %s", uentry_unparseFull (e)));

	      if (fileloc_isImport (uentry_whereSpecified (ce)))
		{		  
		  if (cstringTable_isDefined (st->htable))
		    {
		      cstringTable_replaceKey (st->htable, 
					       uentry_rawName (ce), 
					       cstring_copy (uentry_rawName (e)));
		    }
		  
		  uentry_free (ce); 
		  st->entries[eindex] = e;
		  ce = e;

		  if (uentry_isDatatype (e)) uentry_setDatatype (e, typeId_fromUsymId (eindex));
		}
	      else 
		{
		  if (fileloc_isImport (uentry_whereSpecified (e)))
		    {
		      uentry_free (e);
		    }
		  else
		    {
		      /* Respecification errors already reported */
		      DPRINTF (("Respecification: %s / %s", 
				fileloc_unparse (uentry_whereSpecified (e)),
				bool_unparse (fileloc_isSpec (uentry_whereSpecified (e)))));

		      if (uentry_isDatatype (e)) 
			{
			  uentry_setDatatype (e, typeId_fromUsymId (eindex));
			}
		      
		      if (cstringTable_isDefined (st->htable))
			{
			  cstringTable_replaceKey (st->htable, 
						   uentry_rawName (ce), 
						   cstring_copy (uentry_rawName (e)));
			}
		      
		      llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
		      uentry_free (ce);
		      st->entries[eindex] = e;
		      ce = e;
		    } 
		}
	    }
	  else /* e not specified */
	    {
	      DPRINTF (("Merging..."));

	      if (uentry_isDeclared (ce))
		{
		  /* evans 2001-08-26
		    No - this can happen for internal typedefs
		    llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
		  */

		  DPRINTF (("Merge defn"));
		  uentry_mergeDefinition (ce, e);
		}
	      else 
		{
		  /* evans 2001-08-26
		    No - this can happen for internal typedefs
		    llassert ((st->lexlevel > fileScope || !sRef_modInFunction ()));
		  */

		  DPRINTF (("Merge entries..."));
		  uentry_mergeEntries (ce, e);
		  DPRINTF (("After: %s", uentry_unparseFull (ce)));
		}
	    }
	}
      else /* ce not specified */
	{
	  if (!(st->lexlevel > fileScope || !sRef_modInFunction ()))
	    {
	      if (uentry_isDatatype (e) || uentry_isAnyTag (e)
		  || uentry_isEnumConstant (e)
		  || uentry_isStatic (e)) /* bug fix from Brian St. Pierre */
		{
		  ; /* 
		     ** Not a bug.  Code like,
		     **    int f (void) { typedef int tint; ... }
		     ** is legal.
		     */
		}
	      else
		{
		  llcontbug (message ("usymtab_supEntryAux: inconsistent state "
				      "(lexlevel = %d, modFunction = %s) adding: %q", 
				      st->lexlevel, bool_unparse (sRef_modInFunction ()), 
				      uentry_unparse (e)));

		  if (sRef_modInFunction ())
		    {
		      /* make sure the sRef is not bashed! */
		      /*@i@*/ e->sref = sRef_saveCopy (e->sref);
		    }
		}
	    }
	  
	  DPRINTF (("Merge.."));
	  uentry_mergeDefinition (ce, e);
	}
      
      if (isSref)
	{
	  ctype ct = uentry_getType (ce);
	  
	  if (uentry_isFunction (ce) && ctype_isFunction (ct))
	    {
	      ct = ctype_getReturnType (ct);
	    }
	  
	  uentry_setSref
	    (ce, sRef_makeCvar (st->lexlevel, eindex, ct,
				stateInfo_makeLoc (uentry_whereLast (ce), SA_DECLARED)));
	}
    }
  else /* no previous entry */
    {
      uentry outer;

      if (st->lexlevel == globScope 
	  && !uentry_isStatic (e)
	  && !uentry_isExtern (e)
	  && usymtab_isDefined (filetab))
	{
	  /*
	  ** check if there is a static entry:  (i.e.,
	  **   
	  **    static int f ();
	  **    ...
	  **    int f (); 
	  */
	  
	  eindex = usymtab_getIndex (filetab, ename);
	  
	  if (usymtab_indexFound (eindex))
	    {
	      uentry ce = filetab->entries[eindex];

	      uentry_setStatic (e);
	      uentry_mergeDefinition (ce, e);
	      staticEntry = TRUE;
	      goto exitPoint;
	    }
	}
      
      outer = usymtab_lookupQuiet (st->env, ename);

      DPRINTF (("New  : [%p] %s", e, uentry_unparseFull (e)));
      DPRINTF (("Outer: [%p] %s", outer, uentry_unparseFull (outer)));

      /*
      ** no previous definition, add the new one
      */
      
      if (!noshadowerror 
	  && uentry_isValid (outer)
	  && !(uentry_isYield (e) || uentry_isYield (outer))
	  && fileloc_isDefined (uentry_whereLast (e))
	  && !fileloc_isXHFile (uentry_whereLast (e))
	  && fileloc_isDefined (uentry_whereLast (outer))
	  && !fileloc_isXHFile (uentry_whereLast (outer)))
	{
	  if (!uentry_sameKind (outer, e))
	    {
	      ; /* no error */
	    }
	  else
	    {
	      if (ctype_isUnknown (uentry_getType (outer))
		  || uentry_isForward (outer))
		{
		  ;
		}
	      else
		{
		  if (optgenerror 
		      (FLG_SHADOW,
		       message ("%s %q shadows outer declaration",
				ekind_capName (uentry_getKind (e)),
				uentry_getName (e)),
		       uentry_whereLast (e)))
		    {
		      uentry_showWhereLast (outer);
		    }
		}
	    }
	}
      
      if (st == globtab && context_getFlag (FLG_NEWDECL))
	{
	  voptgenerror 
	    (FLG_NEWDECL,
	     message ("New declaration: %q", uentry_getName (e)),
	     uentry_whereLast (e));
	}

      eindex = usymtab_addEntryAux (st, e, isSref);
    }

 exitPoint:
    return (staticEntry ? usymId_invalid : eindex);
}

static void
usymtab_replaceEntryAux (/*@notnull@*/ usymtab st, /*@only@*/ uentry e)
   /*@globals globtab@*/ /*@modifies st, e@*/
{
  cstring ename = uentry_rawName (e);
  usymId eindex;

  /* static tags in global scope */
  eindex = usymtab_getIndex (st, ename);
  
  if (usymtab_indexFound (eindex))
    {
      uentry ce = st->entries[eindex];      
      
      if (cstringTable_isDefined (st->htable))
	{
	  cstringTable_replaceKey (st->htable, uentry_rawName (ce), 
				   cstring_copy (uentry_rawName (e)));
	}

      uentry_free (ce);
      st->entries[eindex] = e;
    }
  else
    {
      eindex = usymtab_addEntryAux (st, e, FALSE);
    }
}

/*@=deparrays@*/ 

void usymtab_supEntry (uentry e)
   /*@globals utab, filetab, globtab@*/
   /*@modifies utab, globtab, e@*/
{
    (void) usymtab_supEntryAux (utab, e, FALSE);
}

/*
** this should be lots more efficient!
*/

static /*@exposed@*/ uentry 
  usymtab_supEntryReturnAux (/*@notnull@*/ usymtab tab, 
			     /*@only@*/ uentry e, bool isref)
  /*@globals globtab, filetab@*/
  /*@modifies tab, globtab, e@*/
{
  cstring rawName = cstring_copy (uentry_rawName (e));
  bool stat = (tab == globtab) && uentry_isStatic (e);
  uentry ret;

  (void) usymtab_supEntryAux (tab, e, isref);

  if (stat)
    {
      ret = usymtab_lookupAux (filetab, rawName);
    }
  else
    {
      ret = usymtab_lookupAux (tab, rawName);

      if (uentry_isInvalid (ret) && usymtab_isDefined (filetab))
	{
	  ret = usymtab_lookupAux (filetab, rawName);
	}
    }
  
  cstring_free (rawName);
  return ret;
}

/*@dependent@*/ /*@exposed@*/ uentry 
  usymtab_supEntryReturn (/*@only@*/ uentry e)
  /*@globals utab, filetab, globtab@*/
  /*@modifies utab, globtab, e@*/
{
  return (usymtab_supEntryReturnAux (utab, e, FALSE));
}

/*@dependent@*/ /*@exposed@*/ uentry 
  usymtab_supEntrySrefReturn (/*@only@*/ uentry e)
  /*@globals utab, globtab, filetab@*/
  /*@modifies utab, globtab, e@*/
{
  return (usymtab_supEntryReturnAux (utab, e, TRUE));
}

/*@dependent@*/ /*@exposed@*/ uentry 
  usymtab_supGlobalEntryReturn (uentry e)
  /*@globals globtab, filetab@*/
  /*@modifies globtab, e@*/
{
  uentry ret;

  ret = usymtab_supEntryReturnAux (globtab, e, FALSE);

  /*
  ** We need to keep track of internal function declarations, so
  ** we can remove them from the symbol table after exiting this
  ** function.  This is a bit bogus, of course.
  */

  if (sRef_modInFunction ())
    {
      recordFunctionType (ret);
    }

  return (ret);
}

ctype
usymtab_supTypeEntry (/*@only@*/ uentry e)
  /*@globals globtab, filetab@*/
  /*@modifies globtab, e@*/
{
  usymId uid;
  ctype ret;

  if (uentry_isAbstractDatatype (e))
    {
      typeId tid = usymtab_supAbstractTypeEntry (e, FALSE);
      ret = ctype_createAbstract (tid);
      uid = typeId_toUsymId (tid);
    }
  else
    {
      uid = usymtab_supEntryAux (globtab, e, FALSE);
      ret = ctype_createUser (typeId_fromUsymId (uid));
    }

  if (sRef_modInFunction ())
    {
      recordFunctionType (globtab->entries[uid]);
    }

  return ret;
}

uentry
usymtab_supReturnTypeEntry (/*@only@*/ uentry e)
  /*@globals globtab, filetab@*/
  /*@modifies globtab@*/
{
  usymId uid;

  DPRINTF (("Abstract? %s", uentry_unparseFull (e)));

  if (uentry_isAbstractDatatype (e))
    {
      uid = typeId_toUsymId (usymtab_supAbstractTypeEntry (e, FALSE));
    }
  else if (uentry_isMaybeAbstract (e) && context_getFlag (FLG_IMPABSTRACT))
    {
      bool maybeabs = TRUE;
      cstring sname = uentry_getName (e);
      uentry ue = usymtab_lookupGlobSafe (sname);
      cstring_free (sname);

      if (uentry_isValid (ue)) 
	{
	  DPRINTF (("Lookup: %s", uentry_unparseFull (ue)));

	  if (uentry_isDatatype (ue)) 
	    {
	      if (uentry_isMaybeAbstract (ue))
		{
		  ;
		}
	      else
		{
		  maybeabs = FALSE;
		}
	    }
	  else
	    {
	      DPRINTF (("Not datatype!"));
	    }
	}
      
      if (maybeabs)
	{
	  uentry ux;
	  typeId tid = usymtab_supAbstractTypeEntry (e, FALSE);
	  ux = usymtab_getTypeEntry (tid);
	  uentry_setAbstract (ux);
	  uid = typeId_toUsymId (tid);
	}
      else
	{
	  uid = usymtab_supEntryAux (globtab, e, FALSE);
	  e = usymtab_getTypeEntry (typeId_fromUsymId (uid));
	  
	  if (uentry_isMaybeAbstract (e))
	    {
	      uentry_setConcrete (e);
	    }
	}
    }
  else
    {
      uid = usymtab_supEntryAux (globtab, e, FALSE);
      e = usymtab_getTypeEntry (typeId_fromUsymId (uid));

      /*? evans 2002-12-16 removed this? it doesn't make sense
      if (uentry_isMaybeAbstract (e))
	{
	  uentry_setConcrete (e);
	}
      */
    }
  
  if (sRef_modInFunction ())
    {
      recordFunctionType (globtab->entries[uid]);
    }

    return (globtab->entries[uid]);
}

typeId
usymtab_supAbstractTypeEntry (/*@only@*/ uentry e, bool dodef)
  /*@globals globtab, filetab@*/
  /*@modifies globtab, e@*/
{
  typeId uid;
  uentry ue;

  uid = typeId_fromUsymId (usymtab_supEntryAux (globtab, e, FALSE));
  ue = usymtab_getTypeEntry (uid);

  if (dodef)
    {
      uentry_setDatatype (ue, uid);
    }

  if (context_getFlag (FLG_ACCESSMODULE)) /* was accessfile */
    {
      context_addFileAccessType (uid);
    }

  if (sRef_modInFunction ())
    {
      recordFunctionType (globtab->entries[uid]);
    }

  return (uid);
}

typeId
usymtab_supExposedTypeEntry (/*@only@*/ uentry e, bool dodef)
  /*@globals globtab, filetab@*/
  /*@modifies globtab, e@*/
{
  typeId uid;

  uid = typeId_fromUsymId (usymtab_supEntryAux (globtab, e, FALSE));

  if (dodef)
    {
      uentry ue = usymtab_getTypeEntry (uid);

      uentry_setDatatype (ue, uid);
    }

  if (sRef_modInFunction ())
    {
      recordFunctionType (globtab->entries[uid]);
    }

  return uid;
}

ctype
usymtab_supForwardTypeEntry (/*@only@*/ uentry e)
  /*@globals globtab, filetab@*/
  /*@modifies globtab, e@*/
{
  typeId uid = typeId_fromUsymId (usymtab_supEntryAux (globtab, e, FALSE));
  uentry ue = usymtab_getTypeEntry (uid);

    uentry_setDatatype (ue, uid);

  if (sRef_modInFunction ())
    {
      recordFunctionType (globtab->entries[uid]);
    }

  return (uentry_getAbstractType (ue));
}

void
  usymtab_supEntrySref (uentry e)
  /*@globals utab, globtab, filetab@*/
  /*@modifies utab, globtab, e@*/
{
  sRef old = uentry_getSref (e);
  
  if (sRef_isType (old))
    {
      uentry ue = usymtab_supEntryReturnAux (utab, e, TRUE);

      /*@access uentry@*/
      if (uentry_isValid (ue)) 
	{
	  sRef uref = uentry_getSref (ue);

	  sRef_mergeStateQuiet (uref, old); 
	  sRef_clearDerived (uref);
	}
      /*@noaccess uentry@*/
    }
  else if (sRef_isKnown (old))
    {
      usymtab_supEntry (e);
    }
  else
    {
      (void) usymtab_supEntryAux (utab, e, TRUE);
    }
}

void usymtab_supGlobalEntry (/*@only@*/ uentry e)
  /*@globals globtab, filetab@*/
  /*@modifies globtab, filetab, e@*/
{
  usymId uid;

  DPRINTF (("Sup global entry: %s", uentry_unparse (e)));

  uid = usymtab_supEntryAux (globtab, e, FALSE);

  if (sRef_modInFunction ())
    {
      recordFunctionType (globtab->entries[uid]);
    }
}

uentry
  usymtab_supReturnFileEntry (/*@only@*/ uentry e)
  /*@globals filetab, globtab@*/
  /*@modifies filetab, globtab, e@*/
{
  llassert (filetab != usymtab_undefined);
  DPRINTF (("File entry: %s", uentry_unparse (e)));
  return (usymtab_supEntryReturnAux (filetab, e, FALSE));
}

/*
** observers
*/

bool
usymtab_inDeepScope () /*@globals utab@*/
{
  return (utab->lexlevel > paramsScope);
}

static usymId
usymtab_getIndex (/*@notnull@*/ usymtab s, cstring k)
{
  int i;

  DPRINTF (("Lookup %s", k));

  if (cstringTable_isDefined (s->htable))
    {
      i = cstringTable_lookup (s->htable, k);
      return usymId_fromInt (i);
    }
  else
    {
      for (i = 0; i < s->nentries; i++)
	{
	  uentry current = s->entries[i];

	  DPRINTF (("Check %d: %s", i, uentry_rawName (current)));

	  if (!uentry_isUndefined (current) 
	      && cstring_equal (uentry_rawName (current), k))
	    {
	      return usymId_fromInt (i);
	    }
	}

      return usymId_notfound;
    }
}

static uentry
usymtab_fetchIndex (/*@notnull@*/ usymtab s, usymId ui)
{
  int i = usymId_toInt (ui);
  llassert (i >= 0 && i < s->nentries);
  return (s->entries[i]);
}

typeId
usymtab_getTypeId (cstring k) /*@globals globtab@*/
{
  usymId uid = usymtab_getIndex (globtab, k);

  if (!usymtab_indexFound (uid)
      || !(uentry_isDatatype (usymtab_getTypeEntry (typeId_fromUsymId (uid)))))
    
    {
      return typeId_invalid;
    }
  else
    {
      return typeId_fromUsymId (uid);
    }
}

/*@dependent@*/ uentry
usymtab_lookupStructTag (cstring k)
{
  cstring sname = makeStruct (k);
  uentry ue = usymtab_lookupGlob (sname);
  
  cstring_free (sname);
  return (ue);
}

/*@dependent@*/ uentry
usymtab_lookupUnionTag (cstring k)
{
  cstring uname = makeUnion (k);
  uentry res = usymtab_lookupGlob (uname);

  cstring_free (uname);
  return res;
}

/*@dependent@*/ uentry
usymtab_lookupEnumTag (cstring k)
{
  cstring ename = makeEnum (k);
  uentry res = usymtab_lookupGlob (ename);

  cstring_free (ename);
  return res;
}

usymId
usymtab_getId (cstring k) /*@globals globtab@*/
{
  usymId uid = usymtab_getIndex (globtab, k);
  uentry ue;

  if (!usymtab_indexFound (uid))
    {
      return usymId_invalid;
    }

  ue = usymtab_getGlobalEntry (uid);

  if (uentry_isPriv (ue))
    {
      return usymId_invalid;
    }

  return uid;
}

static /*@exposed@*/ uentry 
usymtab_getEntryAux (/*@notnull@*/ usymtab s, usymId uid)
{
  llassert (uid != usymId_invalid);
 
  if (uid < 0 || uid >= usymId_fromInt (s->nentries))
    {
      llcontbug (message ("usymtab_getEntry: out of range: level = %d [%d]",
			  s->lexlevel, uid));
      return uentry_undefined;
    }

  llassertprint (uentry_isValid (s->entries[uid]),
		 ("entry undefined: %d", uid));

  return s->entries[uid];
}

/*@dependent@*/ /*@observer@*/ uentry 
  usymtab_getGlobalEntry (usymId uid)
  /*@globals utab, globtab@*/
{
  if (dbgfree) return (uentry_undefined);
  
  if (utab->lexlevel > paramsScope)
    {
      /* need to do this the awkward way, since it could be in conditional scope */
     return (usymtab_lookupSafe (uentry_rawName (globtab->entries[uid])));
    }
  else
    {
      return (globtab->entries[uid]);
    }
}

/*@dependent@*/ /*@exposed@*/ uentry usymtab_getTypeEntry (typeId uid)
  /*@globals globtab@*/
{
  if (dbgload)
    {
      if (uid >= 0 && uid < typeId_fromInt (globtab->nentries))
	{
	  return (globtab->entries[uid]);
	}
      else
	{
	  return (uentry_undefined);
	}
    }
  else
    {
      llassert (uid >= 0 && uid < typeId_fromInt (globtab->nentries));
      return (globtab->entries[uid]);
    }
}

/*
** in load files
*/

/*@dependent@*/ /*@exposed@*/ uentry usymtab_getTypeEntrySafe (typeId uid)
  /*@globals globtab@*/
{
  if (uid < 0 || uid >= typeId_fromInt (globtab->nentries))
    {
      return uentry_undefined;
    }
  
  return (globtab->entries[uid]);
}

bool usymtab_isBoolType (typeId uid)
  /*@globals globtab@*/
{
  llassert (uid >= 0 && uid < typeId_fromInt (globtab->nentries));

  return (cstring_equal (uentry_rawName (globtab->entries[uid]),
			 context_getBoolName ()));
}
 
cstring usymtab_getTypeEntryName (typeId uid)
   /*@globals globtab@*/
{
  uentry ue;

  if (dbgfree)
    {
      return (cstring_makeLiteral (""));
    }

  ue = usymtab_getTypeEntry (uid);

  if (dbgload && !uentry_isValid (ue))
    {
      return (message ("", uid));
    }

  llassertprint (uentry_isValid (ue), ("type undefined: %d", uid));

  return (uentry_getName (ue));
}

# if 0
/*@unused@*/ static void
usymtab_rehash (/*@notnull@*/ usymtab s)
{
  int i;
  
  if (cstringTable_isDefined (s->htable))
    {
      cstringTable_free (s->htable);
    }
  
  s->htable = cstringTable_create (LLAHSHSIZE);

  for (i = 0; i < s->nentries; i++)
    {
      cstringTable_insert (s->htable, cstring_copy (uentry_rawName (s->entries[i])), i);
    }
}
# endif

/*
** superficial copy of usymtab
**
** DO copy spec entries 
*/

static /*@only@*/ /*@notnull@*/ usymtab
usymtab_shallowCopy (/*@notnull@*/ usymtab s) /*@*/
{
  usymtab copytab = usymtab_createRoot ();
  int i;

  for (i = 0; i < s->nentries; i++)
    {
      usymtab_addEntryBase (copytab, s->entries[i]);
    }

  return copytab;
}

static void
usymtab_shallowFree (/*@only@*/ /*@notnull@*/ usymtab s)
{
  aliasTable_free (s->aliases);
  refTable_free (s->reftable, s->nentries);
  sfree (s->entries);
  /*@-compdestroy@*/ sfree (s); /*@=compdestroy@*/
}

usymId usymtab_convertTypeId (typeId uid)
{
  return usymtab_convertId (typeId_toUsymId (uid));
}

/*
** usymtab_convertId: converts usymId from old table to sorted one
*/

usymId usymtab_convertId (usymId uid)
  /*@globals oldtab, utab@*/
{
  uentry ue;
  usymId ret;
  cstring name;

  llassert (usymtab_isDefined (oldtab));

  ue = usymtab_getEntryAux (oldtab, uid);

  llassertprint (uentry_isValid (ue), ("convertId: undefined: %d", uid));

  name = uentry_rawName (ue);

  ret = usymtab_getIndex (utab, name);
  llassert (ret == uid); /*! for now, no rehash! */
  DPRINTF (("Convert: %s [%d] -> %s [%d]",
	    uentry_unparse (ue), uid,
	    uentry_unparse (utab->entries[ret]), ret));

  llassertprint (ret != usymId_invalid, ("convertId: return is invalid"));

  return (ret);
}

void
usymtab_prepareDump (void)
   /*@globals oldtab, utab@*/
   /*@modifies oldtab, utab@*/
{
  llassert (usymtab_inGlobalScope ());
  llassert (oldtab == usymtab_undefined);

  /*
  DPRINTF (("Preparing to dump:"));
  usymtab_printAll ();
  */

  oldtab = usymtab_shallowCopy (utab);

  /* 
  ** alpha compare - make sure order is same on different platforms
  ** error messages appear in same order 
  */

  /*
  qsort (utab->entries, (size_t)utab->nentries, 
	 sizeof (*utab->entries), 
	 (int (*)(const void *, const void *)) uentry_xcomparealpha);
  
  usymtab_rehash (utab);
  */

  /*
  DPRINTF (("After rehash:"));
  usymtab_printAll ();
  */
}

void usymtab_dump (FILE *fout)
     /*@globals utab, oldtab@*/
{
  int i;
  bool neednl = FALSE;
  uentry lastentry = uentry_undefined;
  ekind lastekind = KINVALID;
  int linelen = 0;

  /*
  ** must call prepareDump first
  */

  llassert (oldtab != usymtab_undefined);

  for (i = 0; i < utab->nentries; i++)
    {
      uentry thisentry = utab->entries[i];
      ekind  thisekind = uentry_getKind (thisentry);

      if (!uentry_hasRealName (thisentry))
	{
	  llassert (uentry_isGlobalMarker (thisentry));

	  if (neednl)
	    {
	      check (fputc ('\n', fout) == (int) '\n');
	    }
	  
	  fprintf (fout, "*%d (GlobalMarker)\n", KGLOBALMARKER);
	  lastekind = KINVALID;
	  linelen = 0;
	  neednl = FALSE;
	}
      else
	{
	  if (thisekind != lastekind)
	    {
	      if (neednl)
		{
		  check (fputc ('\n', fout) == (int) '\n');
		}
	      
	      neednl = FALSE;
	      lastentry = uentry_undefined;
	      fprintf (fout, "*%d (%s)\n", ekind_toInt (thisekind),  
		       cstring_toCharsSafe (ekind_capName (thisekind)));
	      lastekind = thisekind;
	      linelen = 0;
	    }
	  
	  /*
	  ** evans - 2001-02-18 - added the - 48 fudge factor...
	  ** extra characters dumped, but I haven't counded them carefully... 
	  */
	  
	  if (uentry_isInvalid (lastentry) || !uentry_equiv (lastentry, thisentry)
	      || (linelen > (MAX_DUMP_LINE_LENGTH - (2 * MAX_NAME_LENGTH) - 48))) 
	    {
	      cstring cdump;
	      
	      DPRINTF (("Dumping entry: %d", i));
	      cdump = message ("^%d %q", i, uentry_dump (thisentry));
	      /* was: cdump = uentry_dump (thisentry)); */
	      
	      lastentry = thisentry;
	      if (neednl)
		{
		  check (fputc ('\n', fout) == (int) '\n');
		  linelen = 0;
		}
	      
	      linelen += cstring_length (cdump);
	      
	      /* no new line here! */
	      if (cstring_length (cdump) > 0) 
		{
		  check (fputs (cstring_toCharsSafe (cdump), fout) != EOF);
		}
	      
	      cstring_free (cdump);
	      neednl = TRUE;
	    }
	  else
	    {
	      cstring cdump = uentry_rawName (thisentry);
	      DPRINTF (("Raw name: %s", cdump));
	      linelen += (cstring_length (cdump) + 1);
	      fprintf (fout, "#%s", cstring_toCharsSafe (cdump));
	    }
	}
    }

  if (neednl)
    {
      check (fputc ('\n', fout) == (int) '\n');
    }

  lastekind = KINVALID;

  fprintf(fout, ";; Library constraints\n");

 /*drl July 27 added this so that libraries without
    buffer constraints would be handled correctly.
    I'm trying to do this without breaking older libraries.

    Splint should still be able to handle libraries without this message.
 */

  
  fprintf(fout, "start_Buffer_Constraints\n");

  for (i = 0; i < utab->nentries; i++)
    {
      uentry thisentry = utab->entries[i];

      if (uentry_isFunction (thisentry) )
	{
	  constraintList preconditions;
	  constraintList postconditions;

	  preconditions = uentry_getFcnPreconditions (thisentry);
	  postconditions = uentry_getFcnPostconditions (thisentry);

	  if ( constraintList_isDefined(preconditions) ||
	       constraintList_isDefined(postconditions) )
	    {
	      fprintf(fout,"%s\n", cstring_toCharsSafe (uentry_rawName(thisentry) ) );
	      if (constraintList_isDefined(preconditions) )
		{
		  fprintf(fout,"pre:\n");
		  constraintList_dump(preconditions, fout);
		  fprintf (fout, ";; end precondition constraints\n" );
		  constraintList_free(preconditions);
		}
	      else
		{
		  fprintf(fout,"pre:EMPTY\n");
		}
	      if (constraintList_isDefined(postconditions) )
		{
		  fprintf(fout,"post:\n");
		  constraintList_dump(postconditions, fout);
		  fprintf (fout, ";; end precondition constraints\n" );
		  constraintList_free(postconditions);
		}
	      else
		{
		  fprintf(fout,"post:EMPTY\n");
		}
	    }
		  
	}
    }
}


void usymtab_load (FILE *f)
  /*@globals utab, globtab@*/
  /*@modifies utab, *f@*/
{
  char *s = mstring_create (MAX_DUMP_LINE_LENGTH);
  char *os = s;
  ekind kind = KINVALID;
  fileloc loc = g_currentloc;
  char c;
  uentry ue;

  dbgload = TRUE;

  llassert (utab == globtab);
  llassert (utab->nentries == 0);

  while (((s = reader_readLine (f, s, MAX_DUMP_LINE_LENGTH)) != NULL)
	 && *s == ';')
    {
      /* ignore ; comments */      ;
    }
  
  while (s != NULL && *s != ';')
    {
      int index;

      if (*s == '*')
	{
	  int ek;
	  s++;
	  ek = reader_getInt (&s);

	  if (ek == KGLOBALMARKER) 
	    {
	      uentry lue = uentry_makeGlobalMarker ();
	      DPRINTF (("Adding global marker: %s", uentry_unparseFull (lue)));
	      usymtab_addEntryAlways (utab, lue);
	      kind = KINVALID;
	      goto nextiter;
	    }
	  else
	    {
	      kind = ekind_fromInt (ek);
	      goto nextiter;
	    }
	}

      if (*s == '$')
	{
	  llfatalerror
	    (cstring_makeLiteral 
	     ("Library is in obsolete format.  Use splint +whichlib "
	      "to see which library is being loaded."));
	}

      if (reader_optCheckChar (&s, '^'))
	{
	  index = reader_getInt (&s);
	}
      else
	{
	  index = -1;
	}

      llassert (kind != KINVALID);
      ue = uentry_undump (kind, loc, &s);

      llassert (utab->nentries == index || index == -1);

      if (uentry_isValid (ue))
	{	
	  int lastindex = utab->nentries;
	  ue = usymtab_addEntryAlways (utab, ue);


# if 0
	  if (uentry_isConstant (ue)) /*@i23! isPreProcessorMacro */
	    {
	      cstring uname = uentry_getName (ue);
	      
	      /* Also check its a macro... */
	      DPRINTF (("Installing: %s", uname));

	      cpphash_installMacro 
		(mstring_copy (cstring_toCharsSafe (uname)),
		 cstring_length (uname),
		 cpplib_createDefinition (message ("%s 255", uname),
					  loc,
					  FALSE, FALSE).defn,
		 cpphash_hashCode (cstring_toCharsSafe (uname),
				   cstring_length (uname),
				   CPP_HASHSIZE));
	      
	      DPRINTF (("After install: %s", uname));
	    }
# endif

	  if (utab->nentries != lastindex + 1)
	    {
	      DPRINTF (("No add: %s", uentry_unparseFull (ue)));
	      BADBRANCH;
	    }
	  /*@-branchstate@*/ 
	} 
      /*@=branchstate@*/

      /*
      ** now, any other names are the same uentry
      */

      while (*(s++) == '#')
	{
	  cstring name = cstring_fromCharsO (reader_getWord (&s));
	  uentry nue = uentry_nameCopy (name, ue);
	  /*
	    DPRINTF (("Name copy: %s", uentry_unparseFull (nue)));
	    BADBRANCH;
	  */

	  usymtab_addEntryAlways (utab, nue);
	}

      while ((c = *s) != '\0' && (c !='\n'))
	{
	  if (c != ' ' || c != '\t') 
	    {
	      llbuglit ("Junk in load file");
	    }

	  s++;
	}

    nextiter:
      {
	s = reader_readLine (f, os, MAX_DUMP_LINE_LENGTH);
      }
    }

  /*DRL added 6/21/01
    to handle reading of buffer overflow related constraints
   */
  while (fgets (s, MAX_DUMP_LINE_LENGTH, f) != NULL 
	 && *s == ';')
    {
      ; /* ignore ;-comments */
    }

  /*drl July 27 added this so that libraries without
    buffer constraints would be handled correctly.
    I'm trying to do this without breaking older libraries*/
  
  /*check for "optional" start buffer constraints message*/

  if (mstring_equalPrefix (s, "start_Buffer_Constraints")) 
    {
      (void) fgets (s, MAX_DUMP_LINE_LENGTH, f);
    }
  
  while (s != NULL && *s != ';')
    {
      constraintList preconditions;
      constraintList postconditions;
      cstring name = cstring_fromChars (reader_getWord (&s));
      cstring temp;

      ue = usymtab_lookup (name);
      cstring_free (name);
      
      preconditions = constraintList_undefined;
      postconditions = constraintList_undefined;
      
      if (!uentry_isValid(ue) )
	{
	  llfatalbug ((message("Invalid uentry for %s library file may be corrupted", cstring_fromChars(s) ) ));
	}
      s = fgets (os, MAX_DUMP_LINE_LENGTH, f);

      temp = cstring_fromChars (reader_getWord(&s) );
      
      if (cstring_compareLit (temp,"pre:") == 0 )
	{
	  preconditions = constraintList_undump (f);
	}
      else
	{
	  if (cstring_compareLit (temp,"pre:EMPTY") != 0 )
	    llfatalbug ((message("Error reading library file pre:EMPTY expected but got %s", temp ) ));
	}
      
      cstring_free(temp);
      
      s = fgets (os, MAX_DUMP_LINE_LENGTH, f);

      temp = cstring_fromChars(reader_getWord(&s) );
      if (cstring_compareLit (temp, "post:") == 0 )
	{
	  postconditions = constraintList_undump (f);
	}
      else
	{
	  if (cstring_compareLit (temp, "post:EMPTY") != 0 )
	    llfatalbug ((message("Error reading library file post:EMPTY expected but got %s", temp ) ));
	}
      
      cstring_free (temp);

      uentry_setPreconditions (ue, functionConstraint_createBufferConstraint (preconditions));
      uentry_setPostconditions (ue, functionConstraint_createBufferConstraint (postconditions));
      
      s = fgets (os, MAX_DUMP_LINE_LENGTH, f);
    }
    
  dbgload = FALSE;
  sfree (os);
}

/*
** file scope for static variables
*/

void
usymtab_enterFile ()
  /*@globals utab, globtab, filetab@*/
  /*@modifies filetab@*/
{
  llassert (utab == globtab);

  # if 0
  /* check globals */
  
  usymtab_entries (globtab, ue)
    {
      if (sRef_hasDerived (uentry_getSref (ue)))
	{
	  fprintf (g_warningstream, "Derived Global: %s\n", uentry_unparse (ue));
	  fprintf (g_warningstream, "sRef: %s\n", sRef_unparseFull (ue->sref));
	}
    } end_usymtab_entries ;

  # endif

  usymtab_enterScope ();
  filetab = utab;
}

void
usymtab_exitFile ()
   /*@globals utab, filetab@*/
   /*@modifies filetab, utab@*/
{
  
  llassert (utab->lexlevel == 1);

  usymtab_exitScope (exprNode_undefined);
  filetab = NULL;
}

void
usymtab_enterScope ()
  /*@globals utab, globtab, filetab@*/
  /*@modifies utab@*/
{
  usymtab t = usymtab_create (US_NORMAL, utab, TRUE);
    	  
  /* unconditional scope: optimize to avoid copy */
  t->aliases = aliasTable_copy (utab->aliases); 
  utab = t;
  
  llassert (usymtab_isDefined (t->env));
  
  if (t->env->lexlevel == paramsScope && context_inFunctionLike ())
    {
      noshadowerror = TRUE;
      usymtab_handleParams ();
      noshadowerror = FALSE;
    }
}

/*
** setup external references:
**    o only, unique params alias external args
**    o other params may alias anything of their type
*/
 
static void
usymtab_handleParams (void)
  /*@globals utab, globtab, filetab@*/
  /*@modifies utab, globtab@*/
{
  usymtab ptab = utab->env;
  uentry fcn = context_getHeader ();

  usymtab_entries (ptab, param)
    {
      uentry ue;

      if (!uentry_isYield (param))
	{
	  sRef uref;
	  sRef pref = uentry_getSref (param);

	  /* Could be a global. */
	  
	  if (uentry_isAnyParam (param))
	    {	  
	      ue = uentry_makeVariable (fixParamName (uentry_rawName (param)),
					uentry_getType (param),
					fileloc_copy (uentry_whereDeclared (param)),
					FALSE);
	      
	      uentry_copyState (ue, param);
	      uentry_setRefParam (ue);
	      
	      ue = usymtab_supEntrySrefReturn (ue);
	      
	      /* must be after supercede! */
	      
	      if (!sRef_stateKnown (pref))
		{
		  uentry_setDefState (ue, SS_DEFINED);
		  uentry_setDefState (param, SS_DEFINED);
		}
	      else
		{
		  if (sRef_isStateSpecial (pref))
		    {
		      uentry_setDefState (ue, SS_SPECIAL); /* ALLOCATED); */
		      /* evans 2002-01-01: should be unnecessary, the pre clauses
		      **    set the state if necessary.
		      */
		    }
		  else
		    {
		      uentry_setDefState (ue, sRef_getDefState (pref));
		    }
		}
	      
	      uref = uentry_getSref (ue);
	      
	      if (sRef_isStack (uref))
		{
		  alkind pkind = sRef_getAliasKind (pref);
		  
		  if (alkind_isKnown (pkind) && !alkind_isLocal (pkind)
		      && !alkind_isStack (pkind))
		    {
		      sRef_setAliasKind (uref, pkind, fileloc_undefined);
		      sRef_setOrigAliasKind (uref, pkind);
		    }
		  else
		    {
		      sRef_setAliasKind (uref, AK_IMPTEMP, fileloc_undefined);
		      sRef_setOrigAliasKind (uref, AK_IMPTEMP);
		      
		      if (uentry_isOut (param))
			{
			  ;
			}
		      else
			{
			  sRef_setDefined (uref, fileloc_undefined);
			}
		    }
		  
		}
	      
	      usymtab_addMustAlias (uref, pref);   
	      
	      if (!(uentry_isOnly (param) || uentry_isUnique (param)))
		{
		  /*
		  ** This is needed for detecting possibly aliased parameters.
		  */

		  sRef s = sRef_makeExternal (uref);
		  usymtab_addMustAlias (uref, s);   
		}
	      
	      if (sRef_isKillRef (pref))
		{
		  sRef_setAliasKind (uref, AK_NEWREF, fileloc_undefined);
		  sRef_setOrigAliasKind (uref, AK_KILLREF);
		}
	      else if (sRef_isRefCounted (uref))
		{
		  sRef_setOrigAliasKind (uref, AK_REFCOUNTED);
		}
	      else
		{
		  /* was AK_UNIQUE */
		  sRef_setOrigAliasKind (uref, AK_LOCAL);
		}
	    }
	  else
	    {
	    }
	}
    } end_usymtab_entries;
  
  
  if (uentry_hasStateClauseList (fcn))
    {
      stateClauseList clauses = uentry_getStateClauseList (fcn);
      
      stateClauseList_preElements (clauses, cl)
	{
	  fileloc loc = stateClause_loc (cl);
	  sRefSet osrs = sRefSet_undefined;
	  sRefSet srs;
	  
	  if (stateClause_isGlobal (cl))
	    {
	      DPRINTF (("Global Marker: %s",
			sRef_unparseFull (usymtab_lookupGlobalMarker ())));
	      llassert (sRef_isGlobalMarker (usymtab_lookupGlobalMarker ()));
	      srs = sRefSet_single (usymtab_lookupGlobalMarker ());
	      osrs = srs;
	    }
	  else
	    {
	      srs = stateClause_getRefs (cl);
	    }
	  
	  sRefSet_elements (srs, el)
	    {
	      sRef base = sRef_getRootBase (el);
	      sRef sb = sRef_updateSref (el);

	      if (sRef_isResult (base))
		{
		  ; /* nothing to do before */
		}
	      else if (sRef_isParam (base) || sRef_isGlobalMarker (base))
		{
		  if (stateClause_setsMetaState (cl))
		    {
		      /* copied from exprNode.c:3040 */
		      qual ql = stateClause_getMetaQual (cl);
		      annotationInfo ainfo = qual_getAnnotationInfo (ql);
		      metaStateInfo minfo = annotationInfo_getState (ainfo);
		      cstring key = metaStateInfo_getName (minfo);
		      int mvalue = annotationInfo_getValue (ainfo);
		      
		      DPRINTF (("Sets meta state! %s", stateClause_unparse (cl)));
			  
		      if (sRef_isResult (base))
			{
			  BADBRANCH;
			}
		      else 
			{
			  sRef_setMetaStateValueComplete (sb, key, mvalue, loc);
			}
		    }
		  else
		    {
		      sRefMod modf = stateClause_getEntryFunction (cl);
		      
		      if (modf != NULL)
			{
			  sRefSet aliases = usymtab_allAliases (sb);
			  
			  modf (sb, loc);
			  
			  sRefSet_elements (aliases, sr)
			    {
			      modf (sr, loc);
			    } end_sRefSet_elements ;
			    
			  sRefSet_free (aliases);
			}
		    }
		}
	      else
		{
		  if (sRef_isValid (base))
		    {
		      DPRINTF (("Base: %s", sRef_unparseFull (base)));
		      BADBRANCH;
		    }
		}
	    } end_sRefSet_elements ; 	  
	} end_stateClauseList_preElements ;
    }
}

void
usymtab_enterFunctionScope (uentry fcn)
  /*@globals utab, filetab, globtab@*/
  /*@modifies utab@*/
{
  usymtab t = usymtab_create (US_NORMAL, utab, TRUE);

  DPRINTF (("Enter function: %s", uentry_unparse (fcn)));

  if (utab->lexlevel != fileScope)
    {
      if (utab->lexlevel > fileScope)
	{
	  llparseerror (cstring_makeLiteral ("New function scope inside function"));
	  
	  while (utab->lexlevel > fileScope)
	    {
	      /*@i@*/ utab = usymtab_dropEnv (utab);
              /*@-branchstate@*/
            }
	  /*@=branchstate@*/
	}
      else
	{
	  llfatalbug (cstring_makeLiteral ("New function not inside file."));
	}
    /*@-branchstate@*/ } /*@=branchstate@*/

  utab = t;
  
  DPRINTF (("Globs: %s", globSet_unparse (uentry_getGlobs (fcn))));

  globSet_allElements (uentry_getGlobs (fcn), el)
    {
      DPRINTF (("Here we go: %s", sRef_unparseFull (el)));
      
      if (sRef_isUndefGlob (el))
	{
	  usymId index = sRef_getScopeIndex (el);
	  sRef sr = sRef_updateSref (el);
	  fileloc loc = uentry_whereEarliest (fcn);
	
	  DPRINTF (("update: %s", sRef_unparseFull (sr)));
	  DPRINTF (("Undef!"));
	  if (sRef_isFileStatic (el))
	    {
	      ctype ct = sRef_getType (el);
	      uentry ue;
	      
	      llassert (usymtab_isDefined (filetab));

	      ue = usymtab_fetchIndex (filetab, index);
	      
	      if (ctype_isRealArray (ct) || ctype_isRealSU (ct))
		{
		  sRef_setAllocated (sr, loc);
		}
	      else
		{
		  sRef_setUndefined (sr, loc);
		}
	    }
	  else
	    {
	      uentry ue = globtab->entries[index];
	      ctype ct = uentry_getType (ue);
	      
	      if (ctype_isArray (ct) || ctype_isSU (ct))
		{
		  sRef_setAllocated (sr, loc);
		}
	      else
		{
		  sRef_setUndefined (sr, loc);
		}
	    }
	}
      else if (sRef_isAllocated (el))
	{
	  sRef sr = sRef_updateSref (el);
	  fileloc loc = uentry_whereEarliest (fcn);
	  
	  sRef_setAllocated (sr, loc);
	}
      else if (sRef_isPartial (el))
	{
	  sRef sr = sRef_updateSref (el);
	  fileloc loc = uentry_whereEarliest (fcn);

	  sRef_setPartial (sr, loc);
	}
      else
	{
	  /*
	  sRef sr = sRef_updateSref (el);
	  fileloc loc = uentry_whereEarliest (fcn);

	  sRef_setDefined (sr, loc);
	  */

	  /* defined */
	  /* shouldn't need to do anything! */ 
	}
    } end_globSet_allElements;

  DPRINTF (("Globs after: %s", globSet_unparse (uentry_getGlobs (fcn))));
# ifdef DEBUGSPLINT
  usymtab_checkAllValid ();
# endif
}

static void
usymtab_caseBranch (void)
  /*@modifies utab@*/
{
  usymtab t = usymtab_create (US_CBRANCH, utab, FALSE);
  utab = t;
}

void
usymtab_switchBranch (/*@unused@*/ exprNode s)
  /*@modifies utab@*/
{
  usymtab t = usymtab_create (US_SWITCH, utab, FALSE);

  t->aliases = aliasTable_copy (utab->aliases);
  utab = t;
}

void
usymtab_trueBranch (/*@only@*/ guardSet guards)
  /*@modifies utab@*/
{
  usymtab t = usymtab_create (US_TBRANCH, utab, FALSE);

  /*
  ** not true! (could be in a macro)
  **
  ** llassertprint (utab->lexlevel > paramsScope,
  ** ("not in scope: %s", usymtab_unparseLocal ()));
  **
  */

  guardSet_free (t->guards);
  t->guards = guards;
  
  aliasTable_free (t->aliases);
  t->aliases = aliasTable_copy (utab->aliases);
  
  utab = t;
}

/*
** consider,
** 
**   { int a; if (...) a = 3; < a may be undefined here!
**
*/

void
usymtab_popTrueBranch (exprNode pred, exprNode expr, clause cl) /*@modifies utab@*/
{
  /*
  ** add a false branch
  ** (could be done more efficiently as a special case, but
  ** it is better to only maintain one version of the code)
  */

  if (utab->kind != US_TBRANCH 
      && context_inIterDef ())
    {
      usymtab_exitScope (expr);
    }
  else
    {
      DPRINTF (("pop true branch.."));
      usymtab_altBranch (guardSet_invert (exprNode_getGuards (pred)));
      usymtab_popBranches (pred, expr, exprNode_undefined, TRUE, cl);
    }
}

void
usymtab_popCaseBranch () /*@modifies utab@*/
{
  llassert (utab->kind == US_CBRANCH);
  usymtab_quietPlainExitScope ();
}

void
usymtab_popTrueExecBranch (exprNode pred, exprNode expr, clause cl)
{
  /*
  ** add a false branch that must return --- that is,
  ** the true branch is always executed!
  */
  
  usymtab_altBranch (guardSet_invert (exprNode_getGuards (pred)));
  usymtab_popBranches (pred, expr, exprNode_makeMustExit (), FALSE, cl);
}

void
usymtab_popOrBranch (exprNode pred, exprNode expr)
  /*@modifies utab@*/
{
  bool mustReturn;
  usymtab env = utab->env;
  usymtab otab = utab;
  int i = 0;

  llassert (env != NULL);

  if (exprNode_isError (expr))
    {
      mustReturn = FALSE;
    }
  else
    {
      mustReturn = exprNode_mustEscape (expr);
    }

  
  llassert (utab->kind == US_TBRANCH);

  /*
  ** merge each entry in table with its original
  ** unless execution cannot continue after this branch
  */

  for (i = 0; i < utab->nentries; i++)
    {
      uentry current = utab->entries[i];
      uentry old = usymtab_lookupAux (env, uentry_rawName (current));

      uentry_mergeState (old, current, exprNode_loc (expr), 
			 mustReturn, FALSE, TRUE, ORCLAUSE);
    }
  
  
  if (mustReturn)
    {
      env->guards = guardSet_levelUnionFree (env->guards, 
					     guardSet_invert (exprNode_getGuards (pred)), 
					     env->lexlevel);
    }
  else
    {
      env->aliases = aliasTable_levelUnion (env->aliases, otab->aliases, env->lexlevel);
    }
 
  /* env is now utab */
  usymtab_quietPlainExitScope ();
}

/*
** case syntax in C is very unrestricted.  This is unfortunate.
**
** A switch case is ended either by a new case or default, or
** a close } that may close the switch or some other control
** structure.  
*/

bool
usymtab_newCase (/*@unused@*/ exprNode pred, exprNode last)
  /*@modifies utab@*/
{
  bool mustBreak = usymtab_mustBreak (utab);
  bool mustReturn = usymtab_mustEscape (utab);
  usymtab stab = utab;

  DPRINTF (("New case!"));

  /*
  ** Find last case (or outer switch)
  */

  while (stab->kind != US_CBRANCH && stab->kind != US_SWITCH)
    {
      stab = stab->env;
      llassert (stab != GLOBAL_ENV);
    }
  
  while (stab->kind == US_CBRANCH)
    {
      stab = stab->env;
      llassert (stab != GLOBAL_ENV);
    }
  
  /*
  ** if its a fall through case, merge in outside entries and last case.
  **
  ** e.g.,
  **        ...
  **        switch
  **          case 1: x = 3; 
  **          case 2: << x may not be defined
  **
  */

  if (!mustBreak && !mustReturn && utab->kind == US_CBRANCH)
    {
      llassert (stab->kind == US_SWITCH || stab->kind == US_NORMAL);

      usymtab_entries (utab, ue)  /* but, keep track of used variables */
	{
	  uentry old = usymtab_lookupAux (stab, uentry_rawName (ue));

	  llassert (uentry_isValid (old));

	  /* modifies ue, not old */
	  
	  uentry_mergeState (ue, old, exprNode_loc (last),
			     FALSE, FALSE, TRUE, CASECLAUSE); 
	} end_usymtab_entries;

      utab->aliases = aliasTable_levelUnion (utab->aliases, 
					     stab->aliases, utab->lexlevel);
      
      /* 
      ** No need for a new branch.
      */
      
      return FALSE;
    }
  else
    {
      usymtab_caseBranch ();
      /*@-mustfree@*/ /*< utab->aliases >*/
      utab->aliases = aliasTable_copy (stab->aliases);
      /*@=mustfree@*/
      
      return TRUE;
    }
}

/*
** for && (both pred and expr are executed)
*/

void
usymtab_popAndBranch (exprNode pred, /*@unused@*/ exprNode expr)
  /*@modifies utab@*/
{
  usymtab env = utab->env;
  usymtab otab= utab;
  int i = 0;

  llassert (utab->kind == US_TBRANCH);

  /*
  ** merge each entry in table with its original
  ** unless execution cannot continue after this branch
  */

  for (i = 0; i < utab->nentries; i++)
    {
      uentry current = utab->entries[i];
      sRef   tref = uentry_getSref (current);
      uentry old = usymtab_lookupAux (env, uentry_rawName (current));
      sRef   oref = uentry_getSref (old);

      /* note that is current is in a nested branch,
	 it may create a "new" old entry. */

      llassert (uentry_isValid (old));
      uentry_mergeState (old, current, exprNode_loc (expr), 
			 FALSE, FALSE, TRUE, ANDCLAUSE);

      /*
      ** if is it defined by the second clause, then it should be defined.
      */

      if (sRef_isAnyDefined (tref)
	  && (sRef_isAllocated (oref) || sRef_isStateUndefined (oref)))
	{
	  sRef_setDefined (oref, g_currentloc);
	}
    }

  DPRINTF (("Popping and: %s / %s",
	    guardSet_unparse (utab->guards),
	    guardSet_unparse (exprNode_getGuards (pred))));

  utab->guards = guardSet_levelUnionFree (utab->guards, 
					  guardSet_invert (exprNode_getGuards (pred)), 
					  utab->lexlevel);
  utab->aliases = aliasTable_levelUnion (utab->aliases, otab->aliases, utab->lexlevel);

  usymtab_quietPlainExitScope ();

  }

/*
** Stack should be [ US_CBRANCH+ US_SWITCH ]
** Only branches which do not return (except possibly the last branch) are included.
**
** Conditionally merge state from all CBRANCHes.
**
** If allpaths is TRUE, then all possible executions go through some switch 
** case, and the original scope is not merged.
*/

void
usymtab_exitSwitch (/*@unused@*/ exprNode sw, bool allpaths)
  /*@modifies utab@*/
{
  usymtab ttab = utab;
  usymtab stab = ttab;
  usymtab ltab = ttab;
  bool lastMustReturn = usymtab_mustEscape (utab);
  int i;
  
    
  while (stab->kind == US_CBRANCH)
    {
      stab = stab->env;
      llassert (stab != GLOBAL_ENV);
    }

  while (stab->kind == US_NORMAL)
    {
      stab = stab->env;
      llassert (stab != GLOBAL_ENV);
    }

  llassert (stab->kind == US_SWITCH);

  /* go to the scope outside the switch (US_SWITCH is just a marker! */
  stab = stab->env; 
  llassert (stab != GLOBAL_ENV);

  
  ttab = ttab->env;
  llassert (usymtab_isDefined (ttab));
  
  if (ttab->kind == US_CBRANCH)
    {
      /* was quietPlainExitScope --- but, can't free it yet! */
      utab = utab->env;
      llassert (utab != GLOBAL_ENV);

      while (ttab->kind == US_CBRANCH)
	{
	  /*
	  ** (from popTrueBranch)
	  */	  
	  
	  bool mustReturn = usymtab_mustEscape (ttab);
	  bool mustBreak = usymtab_mustBreak (ttab);
	  
	  usymtab_entries (ttab, current)
	    {
	      uentry old = /*@-compmempass@*/ usymtab_lookupAux (ltab, uentry_rawName (current));
       	                   /*@=compmempass@*/ 
	      
	      /*
	      ** note that is this is in a nested branch,
	      ** it may create a "new" old entry. 
	      */
	   
	      if (uentry_isValid (old))
		{
		  if (lastMustReturn)
		    {
		      uentry_mergeUses (current, old);
		      uentry_setState (old, current);
		    }
		  else
		    {
		      uentry_mergeState (old, current, exprNode_loc (sw),
					 mustReturn, FALSE, TRUE, SWITCHCLAUSE);
		    }
		}
	      else
		{
		  ;
		}
	    } end_usymtab_entries;
	  
	  /*
	  ** if entry is not in symbol table for this case, merge with pre-switch
	  ** table
	  */
	  
	  if (!mustReturn && !mustBreak)
	    {
	      usymtab_entries (stab, current)
		{
		  if (!usymtab_indexFound (usymtab_getIndex (ttab, uentry_rawName (current))))
		    {
		      uentry old = /*@-compmempass@*/
			usymtab_lookupAux (ltab, uentry_rawName (current));
		      /*@=compmempass@*/

		      llassert (uentry_isValid (old));
		      uentry_mergeState (old, current, exprNode_loc (sw),
					 FALSE, FALSE, TRUE, SWITCHCLAUSE);
		    }
		} end_usymtab_entries;
	    }
	  
	  ltab->env = ttab->env; 
	  ttab = ltab->env;

	  /*
	  ** Suprious error, becuase of environments.
	  */

	  /*@i1@*/ utab = ltab;

	  lastMustReturn = FALSE;
	  /*@-branchstate@*/ 
	}
    }
  /*@=branchstate@*/

  /*
  ** now, there is one US_CBRANCH.  Merge this with the stab.
  */
  
    
  for (i = 0; i < ltab->nentries; i++)
    {
      uentry current = ltab->entries[i];
      uentry old = usymtab_lookupAux (stab, uentry_rawName (current));
      
      /* note that is this is in a nested branch,
	 it may create a "new" old entry. */
      
         
      if (uentry_isValid (old))
	{
	  if (allpaths)
	    {
	      uentry_mergeUses (current, old);
	      uentry_setState (old, current);
	    }
	  else
	    {
	      uentry_mergeState (old, current, exprNode_loc (sw), 
				 FALSE, FALSE, TRUE, SWITCHCLAUSE);
	    }
	}
      else
	{
	  	}
    }
  
  /*
  ** exit the switch
  */
  
  
  /*
  ** switch may or may not be followed by a new scope
  */

  if (utab->kind == US_SWITCH)
    {
      usymtab_quietPlainExitScope ();  
    }
  else
    {
      usymtab_quietPlainExitScope ();
      llassert (utab->kind == US_SWITCH);
      usymtab_quietPlainExitScope ();   
    }

  }

static void 
updateNullState (sRef el, /*@notnull@*/ usymtab ttab, 
		 /*@notnull@*/ usymtab ftab, bool trueGuard)
{
  sRef base = sRef_getRootBase (el);
  int level = sRef_lexLevel (base);        
    
  if (sRef_isCvar (base))
    {
      usymId index = sRef_getScopeIndex (base);
      uentry ue = usymtab_getRefTab (ttab, level, index);

      if (!uentry_isLset (ue)) 
	{
	  sRef sr = uentry_getSref (ue);

	  if (trueGuard)
	    {
	      sRef_setDerivNullState (sr, el, NS_NOTNULL);
	    }
	  else 
	    {
	      if (!guardSet_isGuarded (ttab->guards, el) 
		  && !sRef_isNotNull (sr))
		{
		  DPRINTF (("Here! %s / %s",
			    sRef_unparseFull (sr),
			    sRef_unparseFull (el)));
		  sRef_setDerivNullState (sr, el, NS_DEFNULL);
		}
	    }
	}
      else
	{
	  ;
	}
      
      ue = usymtab_getRefTab (ftab, level, index);
      
      if (!uentry_isLset (ue)) 
	{
	  sRef sr = uentry_getSref (ue);
	  
	  if (!trueGuard) /* yikes!  forgot the ! */
	    {
	      sRef_setDerivNullState (sr, el, NS_NOTNULL);
	    }
	  else 
	    {
	      
	      if (!guardSet_isGuarded (ftab->guards, el)
		  && !sRef_isNotNull (sr))
		{
		  sRef_setDerivNullState (sr, el, NS_DEFNULL);
		}
	    }
	}
      else
	{
	  ;
	}
    }  
}

void
usymtab_popBranches (exprNode pred, exprNode tbranch, exprNode fbranch, 
		     bool isOpt, clause cl)
     /*@modifies utab@*/
{
  int i = 0;
  usymtab ftab = utab;
  usymtab ttab = utab->env;

  fileloc loc;
  usymtab env;
  guardSet guards = exprNode_getGuards (pred);
  sRefSet tguards = guardSet_getTrueGuards (guards);
  sRefSet fguards = guardSet_getFalseGuards (guards);
  bool mustReturnT = exprNode_mustEscape (tbranch);
  bool mustReturnF = exprNode_mustEscape (fbranch);

  DPRINTF (("Pop branches: %s [mustreturn: %s/%s]", exprNode_unparse (pred),
	    bool_unparse (mustReturnT),
	    bool_unparse (mustReturnF)));

  if (exprNode_isDefined (fbranch))
    {
      loc = exprNode_loc (fbranch);
    }
  else
    {
      loc = exprNode_loc (tbranch);
    }

  llassert (usymtab_isDefined (ttab));
  
  env = ttab->env;
  
  llassert (usymtab_isDefined (env));
  llassert (ftab->kind == US_FBRANCH);
  llassert (ttab->kind == US_TBRANCH);

  /*
  ** For each element that is true guarded (i.e., if (x != NULL)) 
  **          make x = null in false branch,
  **          and x = notnull in true branch.
  **          unless x was set locally in that branch.
  ** For each element that is false guarded (x == NULL) 
  **          make x = null in true, notnull in false.
  **                      
  ** For each element that is either guarded (pred(x)) 
  **     
  */
  
  sRefSet_allElements (tguards, el)
    {
      updateNullState (el, ttab, ftab, TRUE);
    } end_sRefSet_allElements;
    
  sRefSet_allElements (fguards, el)
    {
      updateNullState (el, ttab, ftab, FALSE);
    } end_sRefSet_allElements;

  /*
  ** 
  ** if an entry is in both true and false, merge the entries,
  ** then replace original with new state.
  **
  ** if an entry is in one table, merge it with the original.
  */
  
  DPRINTF (("ftab: %d", ftab->nentries));

  for (i = 0; i < ftab->nentries; i++)
    {
      uentry fthis = ftab->entries[i];
      uentry old = usymtab_lookupAux (env, uentry_rawName (fthis));
      usymId tindex = usymtab_getIndex (ttab, uentry_rawName (fthis));
      
      DPRINTF (("Entry: %s / %s", uentry_unparseFull (fthis), uentry_unparseFull (old)));
	  
      if (uentry_isUndefined (old))
	{
	  /* possible entry was added as an undefined id */
	  DPRINTF (("Undefined! %s", uentry_rawName (fthis)));
	  continue;
	}
      
      if (usymtab_indexFound (tindex))
	{
	  uentry tthis = ttab->entries[tindex];

	  /* note that is this is in a nested branch,
	     it may create a "new" old entry. */
	  
	  if (!mustReturnF)
	    {
	      if (!mustReturnT)
		{
		  uentry_mergeState (fthis, tthis, loc,
				     mustReturnT, FALSE, FALSE, cl);
		}
	      else
		{
		  uentry_mergeUses (fthis, tthis);
		}
	      
	      uentry_setState (old, fthis);
	      
	      /*@-mustfree@*/ 
	    } 
	  /*@=mustfree@*/
	  else
	    {
	      uentry_setState (old, tthis);
	      uentry_mergeState (old, fthis, loc, mustReturnF, 
				 TRUE, FALSE, cl);
	    }
	  
	  ttab->entries[tindex] = uentry_undefined;
	  uentry_free (tthis);
	}
      else
	{
	  uentry_mergeState (old, fthis, loc, mustReturnF, TRUE, FALSE, cl);
	}
    }

  for (i = 0; i < ttab->nentries; i++)
    {
      uentry current = ttab->entries[i];
      
      DPRINTF (("ttab: %s", uentry_unparseFull (current)));
      
      if (!uentry_isUndefined (current)) 
	{
	  uentry old = usymtab_lookupAux (env, uentry_rawName (current));

	  DPRINTF (("Old: %s", uentry_unparseFull (old)));

	  if (uentry_isUndefined (old))
	    {
	      llcontbug (message ("Undefined entry: %s", uentry_rawName (current)));
	      continue;
	    }

	  if (mustReturnF)
	    {
	      uentry_mergeUses (current, old); 
	      uentry_setState (old, current);
	    }
	  else
	    {
	      /*
              ** Assumes false branch is a fall-through if
              ** fbranch is not defined.  This is true, unless
              ** where was some greivous error in processing
              ** the else branch of an if-then, in which case
              ** this is probably the right thing to do anyway.
              */

	      uentry_mergeState (old, current, loc, mustReturnT, 
				 FALSE, isOpt, cl);
	    }

	  DPRINTF (("==> %s", uentry_unparseFull (old)));
	}
    }
  
  /*
  ** Plain levelUnion doesn't work, since we need to use the sRef's in env->aliases
  ** if they are present.
  */

  llassert (NOALIAS (env->aliases, ttab->aliases));
  llassert (NOALIAS (env->aliases, ftab->aliases));

  aliasTable_free (env->aliases);  

  env->aliases = aliasTable_levelUnionNew (ttab->aliases, 
					   ftab->aliases, env->lexlevel);

  aliasTable_fixSrefs (env->aliases);

  DPRINTF (("Aliases: %s", aliasTable_unparse (env->aliases)));
  
  /* exit true and false scopes */
  usymtab_quietPlainExitScope ();
  usymtab_quietPlainExitScope ();
  
  if (mustReturnT)
    {
      utab->guards = guardSet_levelUnionFree 
	(utab->guards, 
	 guardSet_invert (exprNode_getGuards (pred)), 
	 utab->lexlevel);
    }

  if (mustReturnF)
    {
      utab->guards = guardSet_levelUnion (utab->guards, 
					  exprNode_getGuards (pred), 
					  utab->lexlevel);
    }

  DPRINTF (("Here."));
}

static void usymtab_fixCases (void) /*@modifies utab@*/ {
  while (utab->kind == US_CBRANCH)
    {
      usymtab_quietPlainExitScope ();
    }

  llassert (utab->kind != US_CBRANCH);
}

void
usymtab_altBranch (/*@only@*/ guardSet guards)
  /*@modifies utab@*/
{
  usymtab t;
  usymtab parent = utab->env;

  t = usymtab_create (US_FBRANCH, utab, FALSE);

  /*
  ** If we are in a case, need to close it.  The C syntax
  ** is very liberal, so this kludge is necessary.
  */

  usymtab_fixCases ();

  DPRINTF (("Current kind: %s", usymtab_unparseStack ()));

  llassert (utab->kind == US_TBRANCH);
  llassert (parent != GLOBAL_ENV);
  
  guardSet_free (t->guards);
  t->guards = guards;
  
  aliasTable_free (t->aliases);
  t->aliases = aliasTable_copy (parent->aliases);
  
  utab = t;
}

void
usymtab_allDefined (void)
   /*@globals utab, globtab@*/
{
  int i;

  llassert (utab == globtab);

  for (i = 0; i < utab->nentries; i++)
    {
      uentry e = utab->entries[i];

      if (uentry_isPriv (e))
	{
	 ; /* no need to define it */
	}
      else
	{
	  if (context_getFlag (FLG_SPECUNDECL))
	    {
	      fileloc sloc = uentry_whereSpecified (e);
	      fileloc dloc = uentry_whereDeclared (e);

	      if (fileloc_isDefined (sloc) 
		  && !uentry_isFakeTag (e)
		  && !fileloc_isDefined (dloc))
		{
		  voptgenerror 
		    (FLG_SPECUNDECL,
		     message ("%s %q specified but not declared",
			      ekind_capName (uentry_getKind (e)),
			      uentry_getName (e)),
		     sloc);
		}
	    }
	  
	  if (!uentry_isCodeDefined (e))
	    {
	      fileloc dloc = uentry_whereDeclared (e);
	      
	      if (fileloc_isLib (dloc) || fileloc_isXHFile (dloc))
		{
		 ;
		}
	      else if (fileloc_isDefined (dloc))
		{
		  if (!uentry_isAnyTag (e))
		    {
		      if (fileloc_isUser (dloc))
			{
			  voptgenerror 
			    (FLG_DECLUNDEF,
			     message ("%s %q declared but not defined",
				      ekind_capName (uentry_getKind (e)),
				      uentry_getName (e)),
			     dloc);
			  DPRINTF (("decl: %s", uentry_unparseFull (e)));
			}
		    }
		}
	      else
		{
		  fileloc sloc = uentry_whereSpecified (e);

		  if (fileloc_isDefined (sloc) 
		      && !fileloc_isImport (sloc)
		      && !fileloc_isLib (sloc)
		      && !fileloc_isPreproc (sloc)
		      && !uentry_isFakeTag (e))
		    {
		      if (uentry_isVariable (e) || uentry_isFunction (e))
			{
			  voptgenerror 
			    (FLG_SPECUNDEF,
			     message ("%s %q specified but not declared or defined",
				      ekind_capName (uentry_getKind (e)),
				      uentry_getName (e)),
			     sloc);
			}
		      else
			{
			  voptgenerror 
			    (FLG_SPECUNDEF,
			     message ("%s %q specified but not defined",
				      ekind_capName (uentry_getKind (e)),
				      uentry_getName (e)),
			     sloc);
			}
		    }
		}
	    }
	}
    }
}

void usymtab_exportHeader (void)
     /*@globals utab@*/
{
  int i;

  for (i = 0; i < utab->nentries; i++)
    {
      uentry ce = utab->entries[i];

      if (!uentry_isDatatype (ce) 
	  && !uentry_isAnyTag (ce) 
	  && !uentry_isEitherConstant (ce) && !uentry_isStatic (ce)
	  && !uentry_isExternal (ce)
	  && !uentry_isForward (ce))
	{
	  fileloc fwhere = uentry_whereDeclared (ce);

	  if (fileloc_isUndefined (fwhere)
	      && uentry_isFunction (ce))
	    {
	      fwhere = uentry_whereDefined (ce);
	    }

	  if (fileloc_isDefined (fwhere) 
	      && !fileloc_isHeader (fwhere)
	      && !fileloc_isXHFile (fwhere)
	      && !(fileloc_isSpecialFile (fwhere)
		   && !context_getFlag (FLG_UNUSEDSPECIAL)))
	    {
	      if (uentry_isVariable (ce))
		{
		  if (optgenerror
		      (FLG_EXPORTHEADERVAR,
		       message ("%s %q exported but not declared in header file", 
				ekind_capName (uentry_getKind (ce)),
				uentry_getName (ce)),
		       fwhere))
		    {
		      uentry_showDefSpecInfo (ce, fwhere);
		    }
		}
	      else
		{
		  if (!uentry_isIter (ce)
		      && !uentry_isEndIter (ce)
		      && !uentry_isExpandedMacro (ce))
		    {
		      if (uentry_isFunction (ce) 
			  && cstring_equalLit (uentry_rawName (ce), "main"))
			{
			  ; /* no error for main */
			}
		      else
			{
			  if (optgenerror
			      (FLG_EXPORTHEADER,
			       message ("%s %q exported but not declared "
					"in header file", 
					ekind_capName (uentry_getKind (ce)),
					uentry_getName (ce)),
			       fwhere))
			    {
			      uentry_showDefSpecInfo (ce, fwhere);
			    }
			}
		    }
		}
	    }
	}
    }
}

void usymtab_exportLocal (void)
   /*@globals utab@*/
{
  int i;
  
  for (i = 0; i < utab->nentries; i++)
    {
      uentry ce = utab->entries[i];
      
      if (!uentry_isDatatype (ce) && !uentry_isAnyTag (ce) 
	  && !uentry_isEitherConstant (ce) 
	  && !uentry_isIter (ce)
	  && !uentry_isEndIter (ce)
	  && !uentry_isExpandedMacro (ce)
	  && uentry_isUsed (ce))
	{
	  /* check static uses */
	  filelocList fuses = uentry_getUses (ce);
	  fileloc mod = uentry_whereDefined (ce);
	  bool ok = filelocList_isEmpty (fuses);
	  fileloc fwhere = uentry_whereDeclared (ce);

	  if (fileloc_isSpecialFile (fwhere)
	      && !context_getFlag (FLG_UNUSEDSPECIAL))
	    {
	      ok = TRUE; /* no errors for special files */
	    }
	  else
	    {
	      filelocList_elements (fuses, uloc)
		{
		  if (fileloc_isUndefined (uloc) || !fileloc_sameModule (uloc, mod))
		    {
		      ok = TRUE;
		      /*@innerbreak@*/ break;
		    }
		} end_filelocList_elements;
	    }

	  if (!ok)
	    {
	      if (optgenerror
		  (FLG_EXPORTLOCAL,
		   message ("%s exported but not used outside %s: %q", 
			    ekind_capName (uentry_getKind (ce)),
			    fileloc_getBase (mod),
			    uentry_getName (ce)),
		   fwhere))
		{
		  uentry_showDefSpecInfo (ce, fwhere);
		}
	    }
	}
    }
}

void
usymtab_allUsed (void)
  /*@globals utab@*/
{
  int i;
  bool isFileStatic = usymtab_inFileScope ();
  cstring last_file = cstring_undefined;

  for (i = 0; i < utab->nentries; i++)
    {
      bool hasError = FALSE;
      uentry ce = utab->entries[i];
      fileloc fwhere = uentry_whereDeclared (ce);

      if (fileloc_isUndefined (fwhere))
	{
	  fwhere = uentry_whereDefined (ce);
	}

      if (fileloc_isInvalid (fwhere) 
	  || fileloc_isLib (fwhere) 
	  || fileloc_isBuiltin (fwhere)
	  || ((fileloc_isSpecialFile (fwhere)
	       || fileloc_isSpecialFile (uentry_whereDefined (ce)))
	      && !context_getFlag (FLG_UNUSEDSPECIAL)))
	{
	  ;
	}
      else if (!uentry_wasUsed (ce) && !uentry_isAnyTag (ce))
	{
	  cstring fname = fileloc_filename (fwhere);

	  if (cstring_isUndefined (last_file))
	    {
	      last_file = fname;
	    }
	  else if (cstring_equal (fname, last_file))
	    {
	    }
	  else
	    {
	      cleanupMessages ();
	      last_file = fname;
	    } 
	  
	  if (uentry_isParam (ce))
	    {
	      if (context_inMacro ())
		{
		  sRef cref = uentry_getSref (ce);

		  if (uentry_isYield (ce))
		    {
		      ; /* no checks (for now) */
		    }
		  else if (sRef_isSafe (cref))
		    {
		      ; /* no error */
		    }
		  else
		    {
		      if (uentry_hasRealName (ce))
			{
			  hasError = 
			    optgenerror (FLG_MACROPARAMS,
					 message ("Macro parameter %q not used", 
						  uentry_getName (ce)),
					 fwhere);
			}
		    }
		}
	      else 
		{
		  if (cstring_equalFree (uentry_getName (ce), 
					 cstring_makeLiteral ("...")))
		    {
		      ;
		    }
		  else
		    {
		      hasError = optgenerror (FLG_PARAMUNUSED,
					      message ("Parameter %q not used",
						       uentry_getName (ce)),
					      fwhere);
		    }
		}
	    } /* isParam */
	  else if (uentry_isFunction (ce) || uentry_isIter (ce))
	    {
	      if (fileloc_isUser (fwhere))
		{
		  hasError = optgenerror
		    (FLG_FUNCUNUSED, 
		     message ("%q %q declared but not used", 
			      cstring_makeLiteral 
			      (uentry_isIter (ce) ? "Iterator" 
			       : (isFileStatic ? "File static function" : "Function")),
			      uentry_getName (ce)),
		     fwhere);
		}
	    }
	  else if (uentry_isEndIter (ce))
	    {
	      ; /* no error (already reported for iter */
	    }
	  else if (uentry_isEnumConstant (ce))
	    {
	      if (fileloc_isUser (fwhere))
		{
		  hasError = optgenerror
		    (FLG_ENUMMEMUNUSED,
		     message ("Enum member %q not used", 
			      uentry_getName (ce)),
		     fwhere);
		}
	    }
	  else if (uentry_isConstant (ce))
	    {
	      if (fileloc_isUser (fwhere))
		{
		  hasError = optgenerror
		    (FLG_CONSTUNUSED,
		     message ("Constant %q declared but not used", 
			      uentry_getName (ce)),
		     fwhere);
		}
	    }
	  else if (uentry_isDatatype (ce))
	    {
	      if (fileloc_isUser (fwhere))
		{
		  hasError = optgenerror
		    (FLG_TYPEUNUSED,
		     message ("Type %q declared but not used", 
			      uentry_getName (ce)),
		     fwhere);
		}
	    }
	  else if (!uentry_isRefParam (ce) && !uentry_isExpandedMacro (ce))
	    { /* errors for ref params will be reported in the next scope */
	      llassertprint (uentry_isVar (ce), 
			     ("ce: %s", uentry_unparseFull (ce)));

	      if (ctype_isFunction (uentry_getType (ce)))
		{
		  if (fileloc_isUser (fwhere))
		    {
		      hasError = optgenerror
			(FLG_FUNCUNUSED,
			 message ("%q %q declared but not used", 
				  cstring_makeLiteral 
				  (isFileStatic ? "File static function" 
				   : "Function"),
				  uentry_getName (ce)),
			 fwhere);
		    }
		}
	      else 
		{
		  if (fileloc_isUser (fwhere))
		    {
		      
		      
		      hasError = optgenerror 
			(FLG_VARUNUSED,
			 message ("%q %q declared but not used", 
				  cstring_makeLiteral 
				  (isFileStatic ? "File static variable" 
				   : "Variable"), 
				  uentry_getName (ce)),
			 fwhere);
		    }
		}
	    }
	  else
	    {
	      ; /* no errors */
	    }
	} /* unused */
      else if ((uentry_isDatatype (ce) || uentry_isAnyTag (ce)))
	{ /* check all fields */
	  ctype ct = uentry_getRealType (ce); 

	  
	  while (ctype_isAP (ct))
	    {
	      ct = ctype_getBaseType (ct);
	    }

	  if (ctype_isSU (ct))
	    {
	      uentryList fields = ctype_getFields (ct);

	      uentryList_elements (fields, field)
		{
		  if (!uentry_isUsed (field))
		    {
		      if (uentry_hasName (ce))
			{
			  hasError |= optgenerror 
			    (FLG_FIELDUNUSED,
			     message ("Field %q of %s %q declared but not used", 
				      uentry_getName (field),
				      cstring_makeLiteralTemp
				      (ctype_isStruct (ct) ? "structure" : "union"),
				      uentry_getName (ce)),
			     uentry_whereEarliest (field));
			}
		      else
			{
			  /*
			  ** evans 2001-06-08
			  ** Can't report these errors for unnamed structs.
			  ** No way to tell when there are multiple consistent
			  ** unnamed structure types.  (Could go through table
			  ** and mark them all unused...)

			  hasError |= optgenerror 
			    (FLG_FIELDUNUSED,
			     message ("Field %q of unnamed %s declared but not used", 
				      uentry_getName (field),
				      cstring_makeLiteralTemp
				      (ctype_isStruct (ct) ? "structure" : "union")),
			     uentry_whereEarliest (field));

			  */
			}
		      
		      uentry_setUsed (field, fileloc_undefined);
		    }
		} end_uentryList_elements;
	    }
	}
      else
	{
	  ; /* no errors */
	}

      if (hasError)
	{
	  if (uentry_isParam (ce) && context_inMacro ())
	    {
	      if (fileloc_isDefined (uentry_whereSpecified (ce)))
		{
		  uentry_showWhereSpecified (ce);
		}
	    }
	  else
	    {
	      uentry_showDefSpecInfo (ce, fwhere);
	    }

	  uentry_setUsed (ce, fileloc_undefined);
	}
    }
}

static void
checkGlobalReturn (uentry glob, sRef orig)
{
  sRef sr = uentry_getSref (glob);
  
  DPRINTF (("Check global return: %s / orig: %s / sr: %s",
	    uentry_unparseFull (glob),
	    sRef_unparseFull (orig),
	    sRef_unparseFull (sr)));

  DPRINTF (("Is killed: %s", bool_unparse (sRef_isKilledGlob (orig))));

  if (context_getFlag (FLG_GLOBSTATE))
    {
      DPRINTF (("Is killed: %s", sRef_unparseFull (orig)));
      
      if (sRef_isKilledGlob (orig))
	{
	  if (sRef_isStateUndefined (sr)
	      || sRef_isUnuseable (sr)
	      || sRef_isStateUnknown (sr)
	      || sRef_isDead (sr))
	    {
	      ;
	    }
	  else
	    {
	      ctype ct = ctype_realType (uentry_getType (glob));
	      
	      DPRINTF (("Check global destroyed: %s", uentry_unparseFull (glob)));

	      if (ctype_isVisiblySharable (ct))
		{
		  if (optgenerror 
		      (FLG_GLOBSTATE,
		       message 
		       ("Killed global %q (type %s) not released before return",
			uentry_getName (glob),
			ctype_unparse (ct)),
		       g_currentloc))
		    {
		      sRef_showStateInfo (sr);
		    }
		}
	      else
		{
		  sRef_protectDerivs ();
		  (void) transferChecks_globalDestroyed (sr, g_currentloc);
		  sRef_clearProtectDerivs ();
		}
	    }
	}
      else
	{
	  if (sRef_isStateUndefined (sr))
	    {
	      if (optgenerror (FLG_GLOBSTATE,
			       message 
			       ("Function returns with global %q undefined",
				uentry_getName (glob)),
			       g_currentloc))
		{
		  sRef_showStateInfo (sr);
		}
	    }
	  else 
	    {
	      if (sRef_isDead (sr) || sRef_isKept (sr))
		{
		  if (optgenerror 
		      (FLG_GLOBSTATE,
		       message ("Function returns with global %q "
				"referencing %s storage",
				uentry_getName (glob),
				cstring_makeLiteralTemp (sRef_isDead (sr) ? "released" : "kept")),
		       g_currentloc))
		    {
		      if (sRef_isKept (sr))
			{
			  sRef_showAliasInfo (sr);      
			}
		      else
			{
			  sRef_showStateInfo (sr);
			}

		      sRef_setDefState (sr, SS_UNKNOWN, fileloc_undefined);
		    }
		}
	      
	      DPRINTF (("Here: %s / %s",
			uentry_unparseFull (glob),
			sRef_unparseFull (sr)));

	      if (ctype_isRealPointer (uentry_getType (glob))
		  && sRef_possiblyNull (sr)
		  && !uentry_possiblyNull (glob))
		{
		  if (optgenerror 
		      (FLG_GLOBSTATE,
		       message ("Function returns with non-null global %q "
				"referencing null storage",
				uentry_getName (glob)),
		       g_currentloc))
		    {
		      sRef_showNullInfo (sr);
		    }
		}
	      else
		{
		  DPRINTF (("Check transfer: %s", uentry_unparseFull (glob)));
		  transferChecks_globalReturn (glob);
		}
	    }
	}
    }
}

/*
** remember: check alias globals
*/

void usymtab_checkFinalScope (bool isReturn)
  /*@globals utab@*/
{
  bool mustDefine = context_getFlag (FLG_MUSTDEFINE);
  sRefSet checked = sRefSet_new ();
  usymtab stab = utab;
  int i;
    
  /*
  ** need to check all scopes out to function parameters.
  */

  do 
    {
      for (i = 0; i < stab->nentries; i++)
	{
	  uentry ce = stab->entries[i];
	  sRef sr = uentry_getSref (ce);
	  sRef rb = sRef_getRootBase (sr);
	  valueTable tvalues;

	  /*
	  ** Shouldn't check if shadow checked in deeper scope:
	  */

	  if (stab != utab)
	    {
	      uentry oue = usymtab_lookupQuietNoAlt (utab, uentry_observeRealName (ce));

	      if (!uentry_sameObject (ce, oue))
		{
		  /* what if it is one an alternate branch? */
		  /*@innercontinue@*/ continue;
		}
	    }
	  
	  DPRINTF (("Here check final scope: %s", uentry_unparseFull (ce)));
	  
	  if (ctype_isFunction (uentry_getType (ce)))
	    {
	      /*@innercontinue@*/ continue;
	    }

	  if (uentry_isAnyParam (ce)
	      || uentry_isRefParam (ce)
	      || sRef_isFileOrGlobalScope (rb))
	    {
	      /* Don't do the loseref check...but should check state! */
	      DPRINTF (("Skipping check 1"));
	    }
	  else if (sRef_isDefinitelyNull (sr)
		   || usymtab_isDefinitelyNull (sr))
	    {
	      /*
	      ** No state reference errors for definitely null references.
	      */

	      DPRINTF (("Skipping check 2"));
	    }
	  else
	    {
	      DPRINTF (("Lose ref: %s / %s", uentry_unparse (ce), 
			sRef_unparseFull (sr)));
	      
	      tvalues = sRef_getValueTable (sr);
	      
	      valueTable_elements (tvalues, fkey, fval) {
		metaStateInfo minfo;
		cstring msg = cstring_undefined;
		int nval;
		
		minfo = context_lookupMetaStateInfo (fkey);
		llassert (metaStateInfo_isDefined (minfo));
		
		if (stateValue_isError (fval)
		    || sRef_isStateUndefined (sr)) /* No errors for undefined state */
		  {
		    DPRINTF (("Skipping check 3"));
		  }
		else 
		  {
		    DPRINTF (("Check: %s / %s / %s", fkey,
			      metaStateInfo_unparse (minfo),
			      stateValue_unparse (fval)));
		    
		    minfo = context_lookupMetaStateInfo (fkey);
		    
		    nval = stateCombinationTable_lookupLoseReference 
		      (metaStateInfo_getTransferTable (minfo), 
		       stateValue_getValue (fval), &msg);
		    
		    if (cstring_isDefined (msg)) 
		      {
			if (optgenerror 
			    (FLG_STATETRANSFER,
			     message
			     ("%s loses reference %q in invalid state %q (%s)",
			      cstring_makeLiteralTemp (isReturn ? "Return" : "Scope exit"),
			      uentry_getName (ce),
			      stateValue_unparseValue (fval, minfo),
			      msg),
			     g_currentloc))
			  {
			    stateValue_show (fval, minfo);
			  }
			else
			  {
			    DPRINTF (("Suppressed transfer error: %s", msg));
			  }
		      }
		  }
	      } end_valueTable_elements;
	    }

	  DPRINTF (("Check mustfree entry: %s", uentry_unparseFull (ce)));
	  
	  if (!sRefSet_member (checked, sr) && !sRef_isFileOrGlobalScope (rb))
	    {
	      if (ctype_isRealSU (uentry_getType (ce))
		  && !uentry_isAnyParam (ce)
		  && !uentry_isRefParam (ce)
		  && !uentry_isStatic (ce)
		  && !sRef_isDependent (sr)
		  && !sRef_isOwned (sr))
		{
		  sRefSet als = usymtab_allAliases (sr);
		  
		  if (sRefSet_isEmpty (als))
		    {
		      transferChecks_localDestroyed (sr, g_currentloc);
		    }
		  else
		    {
		      /* aliased, no problem */ ;
		    }
		  
		  sRefSet_free (als);
		}
	      else if
		(!uentry_isStatic (ce)
		 && ((sRef_isNewRef (sr))
		     || (((sRef_isOnly (sr) || sRef_isFresh (sr) 
			   || sRef_isKeep (sr) || sRef_isOwned (sr))
			  && !sRef_isDead (sr))
			 && (!sRef_definitelyNull (sr))
			 && (!usymtab_isDefinitelyNull (sr)))))
		{
		  bool hasError = TRUE;
		  
		  DPRINTF (("Checking: %s", sRef_unparseFull (sr)));
		  
		  /*
		  ** If its a scope exit, check if there is an alias.
		  ** If so, make it only.  If not, there is an error.
		  */
		  
		  if (!isReturn)
		    {
		      if (transferChecks_canLoseReference (sr, g_currentloc))
			{
			  DPRINTF (("Can lose!"));
			  hasError = FALSE;
			}
		    }
		  
		  if (hasError)
		    {
		      if (sRef_hasLastReference (sr))
			{
			  sRef ar = sRef_getAliasInfoRef (sr);
			  
			  if (optgenerror 
			      (sRef_isFresh (ar) ? FLG_MUSTFREEFRESH : FLG_MUSTFREEONLY,
			       message
			       ("Last reference %q to %s storage %qnot %q before %q",
				sRef_unparse (sr),
				alkind_unparse (sRef_getAliasKind (sr)),
				sRef_unparseOpt (ar),
				cstring_makeLiteral (sRef_isKeep (sr) 
						     ? "transferred" : "released"),
				cstring_makeLiteral (isReturn 
						     ? "return" : "scope exit")),
			       g_currentloc))
			    {
			      sRef_showRefLost (sr);
			    }
			}
		      else if (sRef_isNewRef (sr))
			{
			  if (optgenerror
			      (sRef_isFresh (sr) ? FLG_MUSTFREEFRESH : FLG_MUSTFREEONLY,
			       message 
			       ("%q %q not released before %q",
				cstring_makeLiteral 
				(alkind_isKillRef (sRef_getOrigAliasKind (sr))
				 ? "Kill reference parameter" : "New reference"),
				uentry_getName (ce),
				cstring_makeLiteral (isReturn
						     ? "return" : "scope exit")),
			       g_currentloc))
			    {
			      sRef_showAliasInfo (sr);
			    }
			}
		      else 
			{
			  if (ctype_isRealSU (sRef_getType (sr)))
			    {
			      transferChecks_structDestroyed (sr, g_currentloc);
			    }
			  else
			    {
			      if (optgenerror
				  (sRef_isFresh (sr) ? FLG_MUSTFREEFRESH : FLG_MUSTFREEONLY,
				   message 
				   ("%s storage %q not %q before %q",
				    alkind_capName (sRef_getAliasKind (sr)),
				    uentry_getName (ce),
				    cstring_makeLiteral (sRef_isKeep (sr) 
							 ? "transferred" : "released"),
				    cstring_makeLiteral (isReturn 
							 ? "return" : "scope exit")),
				   g_currentloc))
				{
				  sRef_showAliasInfo (sr);
				  DPRINTF (("Storage: %s", sRef_unparseFull (sr)));
				}
			    }
			}
		    }
		}
	      else
		{
		  ;
		}
	    }

	  if (mustDefine && uentry_isOut (ce))
	    {
	      /* No error if its dead (either only or error already reported */
	      if (!sRef_isReallyDefined (sr) && !sRef_isDead (sr))
		{
		  voptgenerror 
		    (FLG_MUSTDEFINE,
		     message ("Out storage %q not defined before %q",
			      uentry_getName (ce),
			      cstring_makeLiteral 
			      (isReturn ? "return" : "scope exit")),
		     g_currentloc);

		  DPRINTF (("sr: %s", sRef_unparseFull (sr)));
		}
	    }
	  
	  /*
	  ** also check state is okay
	  */
	  
	  if (usymtab_lexicalLevel () > functionScope
	      && uentry_isVariable (ce)
	      && (sRef_isLocalVar (sr)
		  && (sRef_isDependent (sr) || sRef_isLocalState (sr))))
	    {
	      sRefSet ab = usymtab_aliasedBy (sr);
	      
	      /* should do something more efficient here */
	      
	      if (sRefSet_isEmpty (ab))
		{
		  /* and no local ref */
		  DPRINTF (("Check lose ref: %s", uentry_unparseFull (ce)));
		  transferChecks_loseReference (ce);
		}
	      else
		{
		  ;
		}
	      
	      sRefSet_free (ab);
	    }
	  else 
	    {
	      ;
	    }
	  
	  checked = sRefSet_insert (checked, sr);
	}

      llassert (usymtab_isDefined (stab->env));

      if (usymtab_isBranch (stab))
	{
	  stab = usymtab_dropEnv (stab);
	}
      else
	{
	  stab = stab->env;
	}
      
      llassert (stab != usymtab_undefined);
    } while (isReturn && (stab->lexlevel >= paramsScope));
  
  sRefSet_free (checked);
  
  /*
  ** for returns:
  **      all globals are appropriately defined
  **      all parameters are appropriately defined
  **      special clauses are followed
  */

  if (isReturn || (utab->lexlevel == paramsScope))
    {
      uentry fcn = context_getHeader ();
      uentryList params = context_getParams ();
      globSet uglobs = context_getUsedGlobs ();
      globSet sglobs = context_getGlobs ();
            
      if (isReturn && context_maybeSet (FLG_GLOBALIAS))
	{ 
	  aliasTable_checkGlobs (utab->aliases); 
	}

      /*
      ** state clauses (ensures, defines, sets, allocates, releases) 
      */
      
      if (uentry_hasStateClauseList (fcn))
	{
	  stateClauseList clauses = uentry_getStateClauseList (fcn);

	  stateClauseList_elements (clauses, cl)
	    {
	      if (stateClause_isAfter (cl) && !stateClause_isGlobal (cl)) 
		{ 
		  if (stateClause_setsMetaState (cl)) 
		    {
		      sRefSet rfs = stateClause_getRefs (cl);
		      qual q = stateClause_getMetaQual (cl);
		      annotationInfo ainfo = qual_getAnnotationInfo (q);
		      metaStateInfo minfo = annotationInfo_getState (ainfo);
		      cstring key = metaStateInfo_getName (minfo);
		      int mvalue = annotationInfo_getValue (ainfo);

		      DPRINTF (("Post meta state clause: %s", stateClause_unparse (cl)));

		      sRefSet_elements (rfs, el)
			{
			  sRef base = sRef_getRootBase (el);
			  
			  if (sRef_isResult (base))
			    {
			      /* 
			      ** This is checked for return transfers. 
			      */
			      ;
			    }
			  else if (sRef_isParam (base) || sRef_isGlobalMarker (base))
			    {
			      sRef sr = sRef_updateSref (base);
			      sr = sRef_fixBase (el, sr);
			      
			      if (!sRef_checkMetaStateValue (sr, key, mvalue))
				{
				  if (optgenerror 
				      (FLG_STATETRANSFER,
				       message
				       ("Ensures clause not satisfied%q (state is %q): %q",
					sRef_isGlobalMarker (sr) 
					? message ("") 
					: message (" by %q", sRef_unparse (sr)),
					stateValue_unparseValue (sRef_getMetaStateValue (sr, key), 
								 minfo),
					stateClause_unparse (cl)),
				       g_currentloc))
				    {
				      sRef_showMetaStateInfo (sr, key);
				    }  
				}
			    }
			  else
			    {
			      if (sRef_isMeaningful (el))
				{
				  BADBRANCH;
				}
			    }
			} end_sRefSet_elements ;
		    }
		  else
		    {
		      /* evs - 2000 07 10 - added this */
		      sRefTest tst = stateClause_getPostTestFunction (cl);
		      sRefSet rfs = stateClause_getRefs (cl);
		      
		      sRefSet_elements (rfs, el)
			{
			  sRef base = sRef_getRootBase (el);
			  
			  if (sRef_isResult (base))
			    {
			      /* 
			      ** This is checked for return transfers. 
			      */

			      ; 
			    }
			  else if (sRef_isParam (base))
			    {
			      sRef sr = sRef_updateSref (base);
			      sr = sRef_fixBase (el, sr);
			      
			      if (tst != NULL && !tst (sr))
				{
				  if (optgenerror 
				      (stateClause_postErrorCode (cl),
				       message ("%s storage %qcorresponds to "
						"storage listed in %q clause",
						stateClause_postErrorString (cl, sr),
						sRef_unparseOpt (sr),
						stateClause_unparseKind (cl)),
				       g_currentloc))
				    {
				      sRefShower ss = stateClause_getPostTestShower (cl);
				      
				      if (ss != NULL)
					{
					  ss (sr);
					}
				      
				      DPRINTF (("Storage: %s", sRef_unparseFull (sr)));
				    }  
				}
			    }
			  else
			    {
			      if (sRef_isMeaningful (el))
				{
				  BADBRANCH;
				}
			    }
			} end_sRefSet_elements ;
		    }
		}
	    } end_stateClauseList_elements ;
	}
      
      /*
      ** check parameters on return
      */

      uentryList_elements (params, arg)
	{
	  if (!uentry_isElipsisMarker (arg))
	    {
	      ctype rt = ctype_realType (uentry_getType (arg));

	      if (ctype_isMutable (rt) || ctype_isSU (rt))
		{
		  uentry param = usymtab_lookupQuiet (utab, uentry_rawName (arg));
		  DPRINTF (("Check param return: %s", uentry_unparseFull (param)));
		  transferChecks_paramReturn (param);
		}
	    }
	} end_uentryList_elements;
      
      DPRINTF (("Check global return: %s",
		globSet_unparse (sglobs)));

      globSet_allElements (sglobs, el)
	{
	  sRef orig = el; /*! sRef_updateSref (el); */ /*!!!*/
	  uentry current = sRef_getUentry (el);

	  DPRINTF (("Check global return: %s / %s", sRef_unparseFull (el),
		    uentry_unparseFull (current)));
	  
	  if (uentry_isVariable (current) && !uentry_isRealFunction (current))
	    {
	      checkGlobalReturn (current, orig);
	    }
	} end_globSet_allElements;

      globSet_allElements (uglobs, el)
	{
	  if (!globSet_member (sglobs, el))
	    {
	      uentry current = sRef_getUentry (el);
	      
	      if (uentry_isVariable (current)
		  && !uentry_isRealFunction (current))
		{
		  checkGlobalReturn (current, sRef_undefined);
		}
	    }
	} end_globSet_allElements;
    }  
}

void
usymtab_quietExitScope (fileloc loc) 
   /*@globals utab, globtab, filetab; @*/ 
   /*@modifies utab@*/
{
  usymtab t = utab->env;

  DPRINTF (("Quiet exit scope [%p]", utab));

  if (utab->reftable != NULL)
    {
      int i;

      for (i = 0; i < utab->nentries; i++)
	{
	  uentry current = utab->entries[i];	  
	  uentry old = usymtab_lookupAux (t, uentry_rawName (current));

	  uentry_mergeState (old, current, loc, FALSE, FALSE, FALSE, NOCLAUSE);
	}
    }

  llassert (t != NULL);

  if (t->lexlevel > paramsScope)
    {
      t->guards = guardSet_levelUnion (t->guards, utab->guards, t->lexlevel);
      t->aliases = aliasTable_levelUnionSeq (t->aliases, utab->aliases, 
					     t->lexlevel);
      utab->aliases = aliasTable_undefined;
    }

  t->mustBreak = utab->mustBreak;
  t->exitCode = utab->exitCode;

  DPRINTF (("Free level [%p]", utab));
  usymtab_freeLevel (utab);

  utab = t;

# ifdef DEBUGSPLINT
  usymtab_checkAllValid ();
# endif
}

/*
** Exit a scope with no checking, lose alias states.
** (When should this be used?)
*/

void usymtab_quietPlainExitScope (void)
     /*@globals utab, globtab, filetab@*/
     /*@modifies utab@*/
{
  usymtab t = utab->env;

  llassert (t != NULL);
  llassert (NOALIAS (utab->aliases, t->aliases));
  usymtab_freeLevel (utab);
  utab = t;
}

void usymtab_exitScope (exprNode expr)
  /*@globals utab, filetab, globtab@*/
  /*@modifies utab, globtab@*/
{
  usymtab ctab = usymtab_undefined;
  usymtab lctab = usymtab_undefined;
  bool mustReturn = exprNode_mustEscape (expr);

  DPRINTF (("Exit scope [%p]", utab));

  if (utab->kind == US_CBRANCH)
    {
      /*
      ** save the case branches, remove the first non-cbranch
      */

      ctab = utab;

      while (utab->kind == US_CBRANCH) 
	{
	  lctab = utab;
	  utab = utab->env;
	  llassert (utab != GLOBAL_ENV);
	}
    }
  
  if (utab->kind == US_TBRANCH || utab->kind == US_FBRANCH
      || utab->kind == US_CBRANCH || utab->kind == US_SWITCH) 
    {
      if (context_inMacro ()) 
	{
	  /* evs 2000-07-25 */
	  /* Unparseable macro may end inside nested scope.  Deal with it. */
	  
	  llerror (FLG_SYNTAX, 
		   message ("Problem parsing macro body of %s (unbalanced scopes). "
			    "Attempting to recover, recommend /*@notfunction@*/ before "
			    "macro definition.", 
			    context_inFunctionName ()));
	  
	  while (utab->kind == US_TBRANCH
		 || utab->kind == US_FBRANCH
		 || utab->kind == US_CBRANCH
		 || utab->kind == US_SWITCH) 
	    {
	      utab = utab->env;
	      llassert (utab != GLOBAL_ENV);
	    }
	} else 
	  {
	    llcontbug (message ("exitScope: in branch: %q", usymtab_unparseStack ()));
	    /*@-branchstate@*/ 
	  } /*@=branchstate@*/
    }
  
  /*
  ** check all variables in scope were used
  */

  /*
  ** bogus errors if this is the normal inside a switch,
  ** since cases have not been merged yet.  Should probably
  ** still check this, but I'm too lazy at the moment...
  */

  llassertfatal (utab->env != GLOBAL_ENV);

  if (utab->env->kind != US_SWITCH)
    {
      usymtab_allUsed ();
    }

  /*
  ** check aliasing: all only params are released (dead)
  **     definition: all out params are defined, all modified params 
  **                     are completely defined
  **
  ** NOTE: note for exiting paramsScope, since checkReturn should be
  ** called first.
  */
  
  if (!mustReturn && (usymtab_lexicalLevel () > functionScope))
    {
      /*
      ** should only call this is end of scope is reachable...
      */

      usymtab_checkFinalScope (FALSE);
    }

  if (usymtab_lexicalLevel () == paramsScope && context_inFunctionLike ())
    {
      /*
      ** leaving a function, need to fix up globals
      */

      uentryList params = context_getParams ();
      globSet    globs = context_getUsedGlobs ();

      uentryList_elements (params, ue)
	{
	  uentry_fixupSref (ue);
	} end_uentryList_elements;

      clearFunctionTypes ();

      DPRINTF (("Fixing up globals: %s", globSet_unparse (globs)));

      globSet_allElements (globs, el)
	{
	  DPRINTF (("Fix: %s", sRef_unparseDebug (el)));

	  if (sRef_isCvar (el))
	    {
	      uentry current;
	      usymId index = sRef_getScopeIndex (el);
	      
	      if (sRef_isFileStatic (el))
		{
		  llassert (usymtab_isDefined (filetab));
		  current = usymtab_fetchIndex (filetab, index);
		}
	      else
		{
		  current = usymtab_fetchIndex (globtab, index);
		}
	      
	      if (uentry_isVariable (current))
		{
		  DPRINTF (("Fixup: %s", uentry_unparse (current)));
		  uentry_fixupSref (current);
		}
	      else
		{
		  DPRINTF (("Clear: %s", uentry_getSref (current)));
		  sRef_clearDerived (uentry_getSref (current));
		}
	    }

	  sRef_clearDerived (el); /* evans 2002-03-14 - this is the likely source of many crashes! */
	} end_globSet_allElements;
    }
  
  usymtab_quietExitScope (exprNode_loc (expr));
  
  if (lctab != usymtab_undefined)
    {
      /*@i@*/ lctab->env = utab;  
      /*@i@*/ utab = ctab;
    /*@-branchstate@*/ } /*@=branchstate@*/
  /*@-globstate@*/


# ifdef DEBUGSPLINT
  usymtab_checkAllValid ();
# endif
}
/*@=globstate@*/

/*
** yikes!  don't let the '170 kids see this one...
*/

usymId
usymtab_directParamNo (uentry ue)
{
  if (uentry_isVar (ue))
    {
      sRef sr = uentry_getSref (ue);

      if (sRef_lexLevel (sr) == functionScope)
	{
	  usymId index = sRef_getScopeIndex (sr);

	  if (index < usymId_fromInt (uentryList_size (context_getParams ())))
	    {
	      return index;
	    }
	}
    }
  return usymId_invalid;
}

/*@dependent@*/ /*@exposed@*/ uentry
  usymtab_getParam (int paramno)
  /*@globals utab@*/
{
  /*
  ** requires in a function context (checked)
  **
  ** depends on no nested functions --- the function
  ** parameters are ALWAYS one scope inside the global scope
  ** and entered in order!
  */
  usymtab s = utab;

  if (!context_inFunctionLike ())
    llfatalbug (message ("usymtab_getParam: not in function context: %q", 
			 context_unparse ()));

  while (s->lexlevel > paramsScope) 
    {
      s = s->env;
    }

  llassert (usymtab_isDefined (s));

  if (paramno >= s->nentries)
    {
      /*  
      ** Parse errors lead to this. 
      */

      uentry err = uentry_makeVariableLoc (cstring_makeLiteralTemp (""),
					   ctype_unknown);
      
      uentry_markOwned (err);
      return (err);
    }

  return (s->entries[paramno]);
}

static /*@dependent@*/ /*@exposed@*/ uentry 
usymtab_getRefTab (/*@notnull@*/ usymtab u, int level, usymId index)
{
  uentry ue;

  ue = usymtab_getRefNoisy (u, level, index);

  if (uentry_isUndefined (ue))
    {
      llbug (message ("usymtab_getRef: out of range: %d. level = %d",
		    index, level));
    }
  
  return ue;
}

static /*@dependent@*/ /*@exposed@*/ usymtab 
  usymtab_dropEnv (/*@notnull@*/ usymtab s)
{
  if (s->kind == US_CBRANCH)
    {
      usymtab t = s;

      do 
	{
	  t = s;
	  s = s->env;
	  llassert (s != GLOBAL_ENV);
	} while (s->kind == US_CBRANCH); 
      /* drop all cases (except in nested scopes */ 

      s = t;
      llassert (s != GLOBAL_ENV);
    }

  if (s->kind == US_FBRANCH)
    {
      s = s->env; /* skip the true branch */
      llassert (usymtab_isDefined (s));
      llassert (s->kind == US_TBRANCH);
    }

  llassert (s != GLOBAL_ENV);
  s = s->env;

  return s;
}

/*@dependent@*/ /*@exposed@*/ uentry
  usymtab_getRefQuiet (int level, usymId index)
  /*@globals utab@*/
{
  usymtab s = utab;
  
  
  llassert (s != NULL);
  llassert (index >= 0);

  if (level > s->lexlevel)
    {            
      return uentry_undefined;
    }

  llassertprint (level <= s->lexlevel, ("level: %d / lexlevel: %d", 
					level, s->lexlevel)); 

  while (s->lexlevel > level)
    {
      if (usymtab_isBranch (s))
	{
	  int eindex = refTable_lookup (s, level, index);

	  if (eindex != NOT_FOUND)
	    {
	      return (s->entries[eindex]);
	    }
	}

      s = usymtab_dropEnv (s);
    }

  while (usymtab_isBranch (s) && s->lexlevel == level)
    {
      int eindex = refTable_lookup (s, level, index);
      
      if (eindex != NOT_FOUND)
	{
	  return (s->entries[eindex]);
	}

      s = usymtab_dropEnv (s);
    }
 
  if (index >= usymId_fromInt (s->nentries))
    {
      return uentry_undefined;
    }

  llassert (!uentry_isUndefined (s->entries[index]));

  return s->entries[index];
}

static /*@dependent@*/ /*@exposed@*/ uentry
usymtab_getRefNoisy (/*@notnull@*/ usymtab s, int level, usymId index)
{
  usymtab otab = s;
  uentry ue = uentry_undefined;
  
  llassert (index >= 0);
  
  while (s->lexlevel > level)
    {
      if (usymtab_isBranch (s))
	{
	  int eindex = refTable_lookup (s, level, index);

	  if (eindex != NOT_FOUND)
	    {
	      ue = s->entries[eindex];

	      if (s != otab)
		{
		  while (!usymtab_isBranch (otab))
		    {
		      otab = usymtab_dropEnv (otab);
		      llassert (otab != GLOBAL_ENV);
		    }
		
		  if (refTable_lookup (otab, level, index) == NOT_FOUND)
		    {
		      ue = usymtab_addRefEntry (otab, uentry_rawName (ue));
		    }
		  else
		    {
		      ;
		    }
		}
	      
	      return ue;
	    }
	}

      s = usymtab_dropEnv (s);
    }

  llassert (usymtab_isDefined (s));

  while (usymtab_isBranch (s) && s->lexlevel == level)
    {
      int eindex = refTable_lookup (s, level, index);
      
      if (eindex != NOT_FOUND)
	{
	  ue = s->entries[eindex];
	  
	  if (s != otab)
	    {
	      while (!usymtab_isBranch (otab))
		{
		  otab = usymtab_dropEnv (otab);
		  llassert (otab != GLOBAL_ENV);
		}

	      ue = usymtab_addRefEntry (otab, uentry_rawName (ue));
	    }
	  else
	    {
	      ;
	    } 

	  return ue;
	}

      s = usymtab_dropEnv (s);
          }

  if (s->lexlevel == level && (index < usymId_fromInt (s->nentries)))
    {
      ue = s->entries[index];
      
      if (uentry_isValid (ue))
	{
	  if (s != otab)
	    {
	      while (!usymtab_isBranch (otab))
		{
		  otab = usymtab_dropEnv (otab);
		  
		  if (otab == GLOBAL_ENV)
		    {
		      return ue;
		    }
		}
	      
	      ue = usymtab_addRefEntry (otab, uentry_rawName (ue));
	    }
	  else
	    {
	    }
	}
      
      return ue;
    }

  
  if (index >= usymId_fromInt (s->nentries))
    {
      return uentry_undefined;
    }

  llassert (!uentry_isUndefined (s->entries[index]));

  return s->entries[index];
}

/*
** looking up entries
**
** If entry is inside a branch, then copy it, and put it into 
** the branch table.
*/

static
int refTable_lookup (/*@notnull@*/ usymtab ut, int level, usymId index)
{
  refTable rt = ut->reftable;
  int i;

  llassert (rt != NULL);

  for (i = 0; i < ut->nentries; i++)
    {
      if (rt[i]->level == level && rt[i]->index == usymId_toInt (index))
	{
	  return i;
	}
    }
  
  return NOT_FOUND;
}
  
static
/*@only@*/ refentry refentry_create (int level, int index)
{
  refentry r = (refentry) dmalloc (sizeof (*r));

  r->level = level;
  r->index = index;

  return r;
}

static /*@dependent@*/ /*@exposed@*/ uentry
usymtab_addRefEntry (/*@notnull@*/ usymtab s, cstring k)
{
  usymtab ut = s;

  if (ut->reftable == NULL) 
    {
      DPRINTF (("Adding ref entry without reftable: %s", k));
      return uentry_undefined;
    }

  llassert (ut->reftable != NULL);
  
  while (s != GLOBAL_ENV)
    {
      usymId eindex = usymtab_getIndex (s, k);
      
      if (usymtab_indexFound (eindex))
	{
	  uentry current = s->entries[eindex];

	  if (uentry_isVar (current) && !ctype_isFunction (uentry_getType (current)))
	    {
	      uentry ue;

	      DPRINTF (("Here: copying %s", uentry_unparse (current)));
	      if (uentry_isNonLocal (current))
		{
		  ue = uentry_copy (current);
		}
	      else
		{
		  ue = uentry_copyNoSave (current);
		}

	      DPRINTF (("Here: copying %s", uentry_unparse (ue)));
	      usymtab_addEntryQuiet (ut, ue);
	      DPRINTF (("Okay..."));
	      
	      if (s->reftable != NULL)
		{
		  refentry ref = s->reftable[eindex];
		  
		  ut->reftable[ut->nentries - 1] 
		    = refentry_create (ref->level, ref->index);
		}
	      else
		{
		  ut->reftable[ut->nentries - 1] 
		    = refentry_create (s->lexlevel, usymId_toInt (eindex));
		}
	      
	      return (ue);
	    }
	  else
	    {
	      return (current);
	    }
	}

      s = usymtab_dropEnv (s);
    }

  return uentry_undefined;
}

static uentry usymtab_lookupAux (usymtab s, cstring k)
{
  DPRINTF (("Lookup: %s", k));

  while (s != GLOBAL_ENV)
    {
      usymId eindex = usymtab_getIndex (s, k);

      if (usymtab_indexFound (eindex))
	{
	  uentry ret = s->entries[eindex];
# if 0	  

	  
	  if (s->kind == US_TBRANCH 
	      || s->kind == US_FBRANCH
	      || s->kind == US_CBRANCH)
	      /* uentry_isGlobalVariable (ret) && os->lexlevel > fileScope) */
	    {
	      uentry ret;
	      DPRINTF (("Adding global ref entry: %s", k));
	      ret = usymtab_addRefEntry (os, k);
	      DPRINTF (("Adding ref entry: %s", uentry_unparseFull (ret)));
	      return ret;
	    }

# endif
	  DPRINTF (("Found: %s", uentry_unparseFull (ret)));
	  return (ret);
	}
      
      if (s->kind == US_TBRANCH || s->kind == US_FBRANCH 
	  || s->kind == US_CBRANCH)
	{
	  /* why isn't this os??? */
	  uentry ret = usymtab_addRefEntry (s, k);
	  DPRINTF (("Adding ref entry: %s", uentry_unparseFull (ret)));
	  return ret;
	}
      
      s = s->env;
    }
  
  return uentry_undefined;
}

static /*@dependent@*/ /*@exposed@*/ uentry
usymtab_lookupQuietAux (usymtab s, cstring k, bool noalt)
{
  while (s != GLOBAL_ENV)
    {
      usymId eindex = usymtab_getIndex (s, k);
      
      if (usymtab_indexFound (eindex))
	{
	  uentry ret = s->entries[eindex];
	  return (ret);
	}
      
      if (noalt && usymtab_isBranch (s))
	{
	  s = usymtab_dropEnv (s);
	}
      else
	{
	  llassert (s != NULL); 
	  s = s->env;
	}
    }

  return uentry_undefined;
}

static /*@exposed@*/ /*@dependent@*/ uentry 
usymtab_lookupQuiet (usymtab s, cstring k)
{
  return usymtab_lookupQuietAux (s, k, FALSE);
}

static /*@exposed@*/ /*@dependent@*/ uentry 
usymtab_lookupQuietNoAlt (usymtab s, cstring k)
{
  return usymtab_lookupQuietAux (s, k, TRUE);
}

/*@dependent@*/ /*@observer@*/ uentry
  usymtab_lookupSafe (cstring k)
  /*@globals utab@*/
{
  DPRINTF (("Lookup safe: %s", k));
  return (usymtab_lookupAux (utab, k));
}

/*@dependent@*/ /*@observer@*/ uentry
  usymtab_lookupSafeScope (cstring k, int lexlevel)
  /*@globals utab@*/
{
  /*
  ** This is necessary to deal with shadowed variables that are referenced
  ** through aliases inside the shadowed scope.  It would be better if
  ** lookup could take an sRef as a parameter.
  */

  usymtab tab = utab;

  while (tab != GLOBAL_ENV && tab->lexlevel > lexlevel) {
    uentry ret = usymtab_lookupAux (tab, k);
    
    if (uentry_isValid (ret)) {
      sRef sr = uentry_getSref (ret);
      
      if (sRef_isCvar (sr) && sRef_lexLevel (sr) > lexlevel) {
	tab = usymtab_dropEnv (tab);
      } else {
	return ret;
      }
    }
  }

  return uentry_undefined;
}

uentry
  usymtab_lookupExpose (cstring k)
  /*@globals utab@*/
{
  uentry ce = usymtab_lookupAux (utab, k);

  if (uentry_isUndefined (ce))
    {
      llfatalbug (message ("usymtab_lookup: not found: *%s*", k));
    }

  if (uentry_isPriv (ce))
    {
      llfatalbug (message ("usymtab_lookup: private: *%s*", k));
    }

  return ce;
}

uentry usymtab_lookupExposeGlob (cstring k)
{
  return (usymtab_lookupGlobSafe (k));
}

uentry usymtab_lookupGlob (cstring k)
  /*@globals globtab@*/
{
  uentry ce = usymtab_lookupAux (globtab, k);

  if (uentry_isUndefined (ce))
    llfatalbug (message ("usymtab_lookup: not found: %s", k));

  if (uentry_isPriv (ce))
    llfatalbug (message ("usymtab_lookup: private: %s", k));

  DPRINTF (("Lookup global: %s", uentry_unparseFull (ce)));
  return ce;
}

/*@observer@*/ uentry
  usymtab_lookupGlobSafe (cstring k)
  /*@globals globtab@*/
{
  uentry ce = usymtab_lookupAux (globtab, k);
  DPRINTF (("Lookup global: %s", uentry_unparseFull (ce)));
  return ce;
}

uentry usymtab_lookupEither (cstring k)
   /*@globals utab@*/
{
  uentry ce = usymtab_lookupSafe (k);

  if (uentry_isUndefined (ce))
    llfatalerror (message ("usymtab_lookup: not found: %s", k));

  DPRINTF (("Lookup either: %s", uentry_unparseFull (ce)));
  return ce;
}

ctype
usymtab_lookupType (cstring k)
   /*@globals globtab@*/
{
  typeId uid = usymtab_getTypeId (k);

  if (typeId_isInvalid (uid))
    {
      llcontbug (message ("usymtab_lookupType: not found: %s", k));
      return ctype_unknown;
    }
  
  return (uentry_getRealType (usymtab_getTypeEntry (uid)));
}

ctype
usymtab_lookupAbstractType (cstring k) /*@globals globtab@*/
{
  typeId uid = usymtab_getTypeId (k);

  if (typeId_isInvalid (uid))
    {
      llcontbug (message ("usymtab_lookupType: not found: %s", k));
      return ctype_unknown; 
    }
  
  return (uentry_getAbstractType (usymtab_getTypeEntry (uid)));
}
  
/*
** if there is an unnamed lcl-specified struct tag matching
** the uentryList, return its datatype.  Otherwise, returns
** ctype_undefined.
*/

ctype
usymtab_structFieldsType (uentryList f)
   /*@globals globtab@*/
{
  return (usymtab_suFieldsType (f, TRUE));
}

ctype
usymtab_unionFieldsType (uentryList f)
   /*@globals globtab@*/
{
  return (usymtab_suFieldsType (f, FALSE));
}

static ctype
usymtab_suFieldsType (uentryList f, bool isStruct)
  /*@globals globtab@*/
{
  int i;

  DPRINTF (("Fields: %s", uentryList_unparse (f)));

  if (fileloc_isSpec (g_currentloc)) 
    {
      return (ctype_undefined);
    }

  for (i = 0; i < globtab->nentries; i++)
    {
      uentry current = globtab->entries[i];

      if ((isStruct 
	   ? uentry_isStructTag (current) : uentry_isUnionTag (current)))
	{
	  if (isFakeTag (uentry_rawName (current)))
	    {
	      ctype ct = uentry_getType (current);
	      
	      DPRINTF (("Check: %s", ctype_unparse (ct)));

	      if ((isStruct ? ctype_isStruct (ct) : ctype_isUnion (ct))
		  && 
		  (uentry_isSpecified (current)
		   && uentryList_equivFields (f, ctype_getFields (ct))))
		{
		  return uentry_getAbstractType (current);
		}
	      else
		{
		  ;
		}
	    }
	}
    }
  
    return ctype_undefined;
}

ctype
  usymtab_enumEnumNameListType (enumNameList f)
  /*@globals globtab@*/
{
  int i;

  for (i = 0; i < globtab->nentries; i++)
    {
      uentry current = globtab->entries[i];

      if (uentry_isEnumTag (current))
	{
	  if (isFakeTag (uentry_rawName (current)))
	    {
	      ctype ct = uentry_getType (current);

	      if (ctype_isEnum (ct) && (enumNameList_match (f, ctype_elist (ct))))
		{
		  return uentry_getType (current);
		}
	    }
	}
    }
  
  return ctype_undefined;
}

bool
usymtab_exists (cstring k)
   /*@globals utab@*/
{
  uentry ce = usymtab_lookupSafe (k);
  return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)));
}

bool
usymtab_existsReal (cstring k)
   /*@globals utab@*/
{
  uentry ce = usymtab_lookupSafe (k);

  return (!(uentry_isUndefined (ce)) 
	  && !(uentry_isPriv (ce))
	  && !(uentry_isExpandedMacro (ce)));
}

bool
  usymtab_existsGlob (cstring k)
  /*@globals globtab@*/
{
  uentry ce = usymtab_lookupAux (globtab, k);

  return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)));
}

bool
usymtab_existsEither (cstring k)
  /*@globals utab@*/
{
  uentry ce = usymtab_lookupAux (utab, k);
  
  return (uentry_isValid (ce));
}

bool
  usymtab_existsGlobEither (cstring k)
  /*@globals globtab@*/
{
  uentry ce = usymtab_lookupAux (globtab, k);
  
  return (uentry_isValid (ce));
}

bool
usymtab_existsType (cstring k)
  /*@globals globtab@*/
{
  uentry ce = usymtab_lookupAux (globtab, k);

  return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)) && uentry_isDatatype (ce));
}

bool
usymtab_existsTypeEither (cstring k)
  /*@globals globtab@*/
{
  uentry ce;
  ce = usymtab_lookupAux (globtab, k);
  return (uentry_isValid (ce) && uentry_isDatatype (ce));
}

bool
usymtab_existsStructTag (cstring k) /*@globals globtab@*/
{
  cstring sname = makeStruct (k);
  uentry ce = usymtab_lookupAux (globtab, sname);
  cstring_free (sname);  
  return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)));
}

bool
usymtab_existsUnionTag (cstring k) /*@globals globtab@*/
{
  cstring uname = makeUnion (k);
  uentry ce = usymtab_lookupAux (globtab, uname);

  cstring_free (uname);

  return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)));
}

bool
usymtab_existsEnumTag (cstring k) /*@globals globtab@*/
{
  cstring ename = makeEnum (k);
  uentry ce = usymtab_lookupAux (globtab, ename);

  cstring_free (ename);
  return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)));
}

bool usymtab_existsVar (cstring k)
   /*@globals utab@*/
{
  uentry ce = usymtab_lookupSafe (k);

  return (!(uentry_isUndefined (ce)) && !(uentry_isPriv (ce)) && (uentry_isVar (ce)));
}

/*
** destructors
*/

static void
refTable_free (/*@only@*/ /*@null@*/ refTable x, int nentries)
{
  if (x != NULL)
    {
      int i;

      for (i = 0; i < nentries; i++)
	{
	  sfree (x[i]);
	}
      
      sfree (x);
    }
}
  
static void
usymtab_freeLevel (/*@notnull@*/ /*@only@*/ usymtab u)
  /*@globals globtab, utab, filetab@*/
{
  int i;

  DPRINTF (("Free level [%p]", u));
  aliasTable_free (u->aliases);

  refTable_free (u->reftable, u->nentries);

  if (u == filetab || u == globtab)
    {
      for (i = 0; i < u->nentries; i++)
	{
	  DPRINTF (("Free complete: %d", i));
	  DPRINTF (("Uentry: %s", uentry_unparse (u->entries[i])));
	  uentry_freeComplete (u->entries[i]);
	  u->entries[i] = uentry_undefined;
	}
    }
  else
    {
      for (i = 0; i < u->nentries; i++)
	{
	  uentry_free (u->entries[i]);
	  u->entries[i] = uentry_undefined;
	}
    }

  guardSet_free (u->guards);
  sfree (u->entries);

  if (u != globtab 
      && u != utab
      && u != filetab)
    {
      llassert (!cstringTable_isDefined (u->htable));
    }

  sfree (u); /* evans 2002-07-12: was inside if */
}

static void
usymtab_freeAux (/*@only@*/ usymtab u)
   /*@globals globtab, utab, filetab@*/
   /*@modifies u@*/
{
  while (u != GLOBAL_ENV)
    {
      usymtab t = u->env;
      usymtab_freeLevel (u);
      u = t;
      /*@-branchstate@*/ 
    } 
  /*@=branchstate@*/
}

void usymtab_free () 
  /*@globals killed utab, globtab, filetab@*/ 
  /*@modifies utab@*/
{
  dbgfree = TRUE;
  usymtab_freeAux (utab);
  utab = usymtab_undefined;
  /*@-globstate@*/
} /*@=globstate@*/ /* Splint cannot tell that utab is killed */

static int usymtab_lexicalLevel (void) /*@globals utab@*/
{
  return (utab->lexlevel);
}

bool usymtab_inGlobalScope () /*@globals utab, globtab@*/
{
  return (utab == globtab);
}

bool usymtab_inFileScope () /*@globals utab@*/
{
  return (utab->lexlevel == fileScope);
}

bool usymtab_inFunctionScope () /*@globals utab@*/
{
  return (utab->lexlevel == functionScope);
}

void
usymtab_replaceEntry (uentry s)
  /*@globals utab, globtab@*/
  /*@modifies utab, s@*/
{
  usymtab_replaceEntryAux (utab, s);
}

bool
usymtab_matchForwardStruct (typeId u1, typeId u2)
   /*@globals globtab@*/
{
  uentry ue1 = usymtab_getTypeEntry (u1);
  uentry ue2 = usymtab_getTypeEntry (u2);

  if (uentry_isAnyTag (ue2))
    {
      ctype reptype = uentry_getType (ue1);
      
      if (ctype_isPointer (reptype))
	{
	  ctype repbase = ctype_getBaseType (reptype);
  
	  if (ctype_isUA (repbase))
	    {
	      typeId rtuid = ctype_typeId (repbase);

	      if (u2 == rtuid) return TRUE;
	      
	      if (typeId_isValid (rtuid))
		{
		  reptype = uentry_getType (usymtab_getTypeEntry (rtuid));		  
		  return (ctype_isUA (reptype) && (u2 == (ctype_typeId (reptype))));
		}
	    }
	}
    }
  
  return FALSE;
}

void usymtab_addGuards (guardSet guards)
  /*@modifies utab@*/
{
  utab->guards = guardSet_union (utab->guards, guards);
  }

static bool usymtab_isGuardedAux (sRef s)
  /*@globals utab@*/
{
  usymtab tab = utab;
  sRef base = sRef_getRootBase (s);
  int lowlevel = paramsScope;
  int baselevel = sRef_lexLevel (base);

  if (sRef_isCvar (base))
    {
      lowlevel = baselevel;
      if (lowlevel < paramsScope) lowlevel = paramsScope;
    }
  
  while (tab->lexlevel >= lowlevel)
    {
      DPRINTF (("Is guarded? [%s] %s", 
		guardSet_unparse (tab->guards),
		sRef_unparseFull (s)));

      if (guardSet_isGuarded (tab->guards, s))
	{
	  /*
	  if (!sRef_definitelyNull (s))
	    {
	      sRef_setNotNull (s, fileloc_undefined);
	    }
	    */
	  return TRUE;
	}

      tab = usymtab_dropEnv (tab);
    }
  
  return FALSE;
}

void usymtab_unguard (sRef s) /*@modifies utab@*/
{
  usymtab tab = utab;
  sRef base = sRef_getRootBase (s);
  int lowlevel = paramsScope;
  int baselevel = sRef_lexLevel (base);
  
  if (sRef_isCvar (base))
    {
      lowlevel = baselevel;
      if (lowlevel < paramsScope) lowlevel = paramsScope;
    }

  while (tab->lexlevel >= lowlevel)
    {
      if (guardSet_isGuarded (tab->guards, s))
	{
	  guardSet_delete (tab->guards, s);
	}
      
      tab = usymtab_dropEnv (tab);
    }
}

bool usymtab_isGuarded (sRef s)
{
  DPRINTF (("Is guarded? %s", sRef_unparseFull (s)));
  return (sRef_aliasCompleteSimplePred (usymtab_isGuardedAux, s));
}

bool usymtab_isDefinitelyNull (sRef s)
{
  return (sRef_aliasCheckSimplePred (usymtab_isDefinitelyNullAux, s));
}

bool usymtab_isDefinitelyNullDeep (sRef s)
{
  return (sRef_deepPred (usymtab_isDefinitelyNull, s));
}

static bool usymtab_isDefinitelyNullAux (sRef s)
  /*@globals utab@*/
{
  usymtab tab = utab;
  sRef base = sRef_getRootBase (s);
  int  lowlevel = paramsScope;
  
  if (sRef_isCvar (base))
    {
      lowlevel = sRef_lexLevel (base);
      if (lowlevel < paramsScope) lowlevel = paramsScope;
    }
  
  while (tab->lexlevel >= lowlevel)
    {
      if (guardSet_mustBeNull (tab->guards, s))
	{
	  return TRUE;
	}
      
      while (tab->kind == US_CBRANCH) 
	{
	  tab = tab->env;
	}

      llassert (usymtab_isDefined (tab));

      if (tab->kind == US_FBRANCH)
	{
	  tab = tab->env;
	  llassert (tab->kind == US_TBRANCH);
	}
      
      tab = tab->env;
    }

  return FALSE;
}

void
usymtab_printGuards ()
  /*@globals utab, globtab@*/
{
  usymtab ttab = utab;

  while (ttab != globtab)
    {
      llmsg (message ("Guards [%d]: %q", ttab->lexlevel,
		      guardSet_unparse (ttab->guards)));
      ttab = ttab->env;
    }
}

void
usymtab_displayAllUses ()
  /*@globals utab, globtab@*/
{
  usymtab copy;

  /* only in top scope */
  llassert (utab == globtab);

  /* need a copy, so order is not messed up by sort! */  
  copy = usymtab_shallowCopy (globtab); 
  
  qsort (copy->entries, (size_t)copy->nentries, 
	 sizeof (*copy->entries), (int (*)(const void *, const void *)) uentry_xcompareuses);

  usymtab_entries (copy, ue)
    {
      if (uentry_isValid (ue) && !uentry_isGlobalMarker (ue))
	{
	  filelocList uses = uentry_getUses (ue);
	  int size = filelocList_realSize (uses);

	  if (fileloc_isDefined (uentry_whereDefined (ue)) 
	      && !fileloc_isLib (uentry_whereDefined (ue))
	      && (size > 0))
	    {
	      llmsg (message ("%q (%q), %d use%&:\n   %q", 
			      uentry_getName (ue),
			      fileloc_unparse (uentry_whereDefined (ue)),
			      size, filelocList_unparseUses (uses)));
	    }
	}
    } end_usymtab_entries;
  
  usymtab_shallowFree (copy);
}

static /*@dependent@*/ /*@exposed@*/ usymtab
usymtab_getFileTab ()
  /*@globals filetab@*/
{
  llassert (filetab != NULL);

  return filetab;
}

/*@only@*/ cstring
usymtab_unparseStack ()
  /*@globals utab@*/
{
  return (usymtab_unparseStackTab (utab));
}
 
static /*@only@*/ cstring
usymtab_unparseStackTab (usymtab t)
{
  bool firstOne = TRUE;
  cstring ret = cstring_makeLiteral ("[");

  while (t != GLOBAL_ENV)
    {
      if (firstOne)
	{
	  ret = message ("%q %q", ret, usymtab_typeName (t));
	  firstOne = FALSE;
	}
      else
	{
	  ret = message ("%q, %q", ret, usymtab_typeName (t));
	}
      t = t->env;
    }

  ret = message ("%q ]", ret);
  return ret;
}

static /*@only@*/ cstring
usymtab_typeName (/*@notnull@*/ usymtab t)
{
  switch (t->kind)
    {
    case US_GLOBAL:  return cstring_makeLiteral ("global");
    case US_NORMAL:  return cstring_makeLiteral ("normal");
    case US_TBRANCH: return cstring_makeLiteral ("true");
    case US_FBRANCH: return cstring_makeLiteral ("false");
    case US_CBRANCH: return cstring_makeLiteral ("case");
    case US_SWITCH:  return cstring_makeLiteral ("switch");
    }
  
  BADEXIT;
}

void usymtab_addMustAlias (/*@exposed@*/ sRef s, /*@exposed@*/ sRef al)
  /*@modifies utab@*/
{
  if (!sRef_similar (s, al))
    {
      usymtab_addForceMustAlias (s, al);
    }
}

/*
** Same as usymtab_addMustAlias, except does not check sRef_isSimilar.
*/

void usymtab_addForceMustAlias (/*@exposed@*/ sRef s, /*@exposed@*/ sRef al)
  /*@modifies utab@*/
{
  /* evans 2002-03-3: was sRef_isMeaningful -- but we need to keep aliases for new storage also! */
  if (sRef_isMeaningful (s) 
      && sRef_isMeaningful (al)
      && !(sRef_isConst (s) || sRef_isConst (al))
      && !(sRef_isAddress (al) && sRef_isDirectParam (sRef_getBase (al))))
    {
      utab->aliases = aliasTable_addMustAlias (utab->aliases, s, al); 
      DPRINTF (("Must alias: %s", aliasTable_unparse (utab->aliases)));

      /*
      ** for local variable, aliasing is symmetric 
      */
      
      if (sRef_isLocalVar (s) && sRef_isLocalVar (al))
	{
	  utab->aliases = aliasTable_addMustAlias (utab->aliases, al, s); 
	}
    }
  else
    {
      DPRINTF (("Not aliasing! %s / %s", sRef_unparseFull (s), sRef_unparseFull (al)));
      DPRINTF (("meaningful: %d %d", sRef_isMeaningful (s), sRef_isMeaningful (al)));
    }
}

void usymtab_addReallyForceMustAlias (/*@exposed@*/ sRef s, /*@exposed@*/ sRef al)
  /*@modifies utab@*/
{
  utab->aliases = aliasTable_addMustAlias (utab->aliases, s, al); 
}

void usymtab_clearAlias (sRef s)
  /*@modifies utab, s@*/
{
  
  aliasTable_clearAliases (utab->aliases, s); 
}

sRefSet usymtab_allAliases (sRef s)
   /*@globals utab@*/  
{
  if (sRef_isSomewhatMeaningful (s))
    {
      sRefSet ret;
            
      ret = sRefSet_unionFree (aliasTable_aliasedBy (utab->aliases, s),
			       aliasTable_canAlias (utab->aliases, s));
      return (ret);
    }
  else
    {
      DPRINTF (("NOT A MEANINGFUL SREF!"));
      return sRefSet_undefined;
    }
}

/*@only@*/ sRefSet usymtab_canAlias (sRef s)
     /*@globals utab@*/
{
  if (sRef_isSomewhatMeaningful (s))
    {
      sRefSet res = aliasTable_canAlias (utab->aliases, s);
      return res;
    }
  
  return sRefSet_undefined;
}

/*@only@*/ sRefSet usymtab_aliasedBy (sRef s)
     /*@globals utab@*/
{
  return (aliasTable_aliasedBy (utab->aliases, s));
}

/*@only@*/ cstring usymtab_unparseAliases ()
  /*@globals utab@*/
{
  return (aliasTable_unparse (utab->aliases));
}

/*
** Debugging routines:
**    okay to leak storage here, only for debugging 
*/

/*@-mustfree@*/ 

void
usymtab_printOut (void)
  /*@globals utab@*/
{
  int i;
  usymtab s = utab;
  int depth = 0;
  char *ind = mstring_copy ("               ");

  fprintf (g_warningstream, "<<< [symbol table] >>>\n");
  
  while (s != GLOBAL_ENV && s->env != GLOBAL_ENV)
    {
      cstring tname = usymtab_typeName (s);

      if (depth < 5)
	{
	  ind[depth * 3 + 1] = '\0';
	}
     
      fprintf (g_warningstream, "level: %d (%s)\n", s->lexlevel,
	       cstring_toCharsSafe (tname));

      cstring_free (tname);

      for (i = 0; i < s->nentries; i++)
	{
	  cstring us = uentry_unparseFull (s->entries[i]);
	  fprintf (g_warningstream, "%s\n", cstring_toCharsSafe (us));
	  cstring_free (us);
	}
      
      if (s->reftable != NULL && s->nentries > 0)
	{
	  fprintf (g_warningstream, "\t<< Ref table >>\n");

	  for (i = 0; i < s->nentries; i++)
	    {
	      fprintf (g_warningstream, "\t%s %3d: %d, %d\n", ind, i, 
		       s->reftable[i]->level,
		       s->reftable[i]->index);
	    }
	}

      ind[depth * 3 + 1] = ' ';
      depth++;
      s = s->env;
    }
  fprintf (g_warningstream, "<<< end usymtab >>>\n");
  mstring_free (ind);
  return;
}

void
usymtab_printTypes ()
  /*@globals globtab@*/
{
  usymtab_printAllAux (globtab);
}

void 
usymtab_printAll (void)
  /*@globals utab@*/
{
  usymtab_printAllAux (utab);
}

static void
usymtab_printAllAux (usymtab s)
   /*@modifies g_warningstream@*/
{
  int i;
  int depth = 0;
  char *ind = mstring_copy ("               ");

  printf ("[[[ usymtab ]]]");

  while (s != GLOBAL_ENV)
    {
      if (depth < 5)
	ind[depth * 3 + 1] = '\0';
      
      if (s->env == GLOBAL_ENV)
	{
	  int looplow;

	  printf ("level: %d / break: %s / exit: %s\n", s->lexlevel,
		  cstring_toCharsSafe (bool_unparse (s->mustBreak)), 
		  cstring_toCharsSafe (exitkind_unparse (s->exitCode)));

	  looplow = 0;

	  for (i = looplow; i < s->nentries; i++)
	    {
	      printf ("%s%3d. %s\n", ind, i, 
		      cstring_toCharsSafe (uentry_unparseFull (s->entries[i])));
	    }
	}
      else
	{
	  printf ("level: %d / break: %s / exit: %s\n", s->lexlevel,
		  cstring_toCharsSafe (bool_unparse (s->mustBreak)),
		  cstring_toCharsSafe (exitkind_unparse (s->exitCode)));

	  for (i = 0; i < s->nentries; i++)
	    {
	      printf ("%s%3d %s\n", ind, i, 
		     cstring_toCharsSafe (uentry_unparseFull (s->entries[i])));
	    }
	}
      
      ind[depth * 3 + 1] = ' ';
      depth++;
      s = s->env;
    }
  printf ("----------\n");
}

void
usymtab_printComplete ()
  /*@globals utab@*/
{
  int i;
  int depth = 0;
  char *ind = mstring_copy ("               ");
  usymtab s = utab;

  while (s != GLOBAL_ENV)
    {
      if (depth < 5)
	{
	  ind[depth * 3 + 1] = '\0';
	}
      
      if (s->env == GLOBAL_ENV)
	{
	  int looplow;

	  printf ("level: %d\n", s->lexlevel);

	  looplow = 0;

	  for (i = looplow; i < s->nentries; i++)
	    {
	      printf ("%s%3d %s\n", ind, i, 
		      cstring_toCharsSafe (uentry_unparseFull (s->entries[i])));
	    }
	}
      else
	{
	  printf ("level: %d\n", s->lexlevel);
	  for (i = 0; i < s->nentries; i++)
	    {
	      printf ("%s%3d %s\n", ind, i, 
		     cstring_toCharsSafe (uentry_unparseFull (s->entries[i])));
	    }
	}
      
      ind[depth * 3 + 1] = ' ';
      depth++;
      s = s->env;
    }

  printf ("----------\n");
  mstring_free (ind);
}

# ifdef S_SPLINT_S
static /*@only@*/ cstring /*@unused@*/ 
usymtab_unparseLocalAux (/*@notnull@*/ usymtab s)
{
  cstring c = message ("lexlevel: %d\n", s->lexlevel);
  int i;

  for (i = 0; i < s->nentries; i++)
    {
      c = message ("%q\n%q", c, uentry_unparseFull (s->entries[i]));
    }

  c = message ("%q\n=========", c);
  return (c);
}

static cstring /*@unused@*/ /*@only@*/ 
usymtab_unparseLocalList (/*@notnull@*/ usymtab s)
{
  cstring c = message ("[%d/%s/%s] ", s->lexlevel, 
		       bool_unparse (s->mustBreak), 
		       exitkind_unparse (s->exitCode));
  int i;

  for (i = 0; i < s->nentries; i++)
    {
      sRef sr = uentry_getSref (s->entries[i]);

      if (i == 0)
	{
	  c = message ("%q: %q [%b]", c, uentry_getName (s->entries[i]), 
		       sRef_isStateDefined (sr));
	}
      else
	{
	  c = message ("%q, %q [%b]", c, uentry_getName (s->entries[i]), 
		       sRef_isStateDefined (sr));
	}

    }

  return (c);
}
# endif

void
usymtab_printLocal (void)
  /*@globals utab@*/
{
  int i;
  usymtab s = utab;

  printf ("lexlevel: %d\n", s->lexlevel);

  for (i = 0; i < s->nentries; i++)
    {
      printf ("%s\n", cstring_toCharsSafe (uentry_unparseFull (s->entries[i])));
    }
  
  while (s->lexlevel > 1)
    {
      s = s->env;
    }

  llassert (usymtab_isDefined (s));

  printf ("Params:\n");

  for (i = 0; i < s->nentries; i++)
    {
      printf ("%d: %s\n", i, 
	      cstring_toCharsSafe (uentry_unparseFull (s->entries[i])));
    }
}
/*@=mustfree@*/

static bool checkDistinctExternalName (uentry e)
  /*@globals globtab@*/
  /*@modifies *g_warningstream@*/
{
  size_t checklen = size_fromInt (context_getValue (FLG_EXTERNALNAMELEN));
  bool ignorecase = context_getFlag (FLG_EXTERNALNAMECASEINSENSITIVE);
  bool gotone = FALSE;
  bool extras = FALSE;
  bool hasError = FALSE;
  cstring name = uentry_rawName (e);
  usymtab st = globtab;

  if (checklen == 0)
    {
      ;
    }
  else
    {
      if (uentry_isAnyTag (e)) 
	{
	  checklen++;  /* the tag marker doesn't count */
	}
    }

  usymtab_entries (st, oe)
    {
      if (uentry_sameObject (oe, e))
	{
	  continue;
	}

      if (checklen == 0)
	{
	  if (cstring_equalCaseInsensitive (uentry_rawName (oe), name))
	    {
	      if (gotone)
		{
		  extras = TRUE;
		  break;
		}
	      
	      if (optgenerror 
		  (FLG_DISTINCTEXTERNALNAMES,
		   message 
		   ("External identifier %q is not distinguishable from %q "
		    "because alphabetical case is ignored",
		    uentry_getName (e),
		    uentry_getName (oe)),
		   uentry_whereLast (e)))
		{
		  uentry_showWhereAny (oe);
		  uentry_setHasNameError (oe);
		  gotone = TRUE;
		}
	    }
	}
      else
	{
	  if (ignorecase)
	    {
	      if (cstring_equalLenCaseInsensitive (uentry_rawName (oe),
						   name, checklen))
		{
		  if (gotone)
		    {
		      extras = TRUE;
		      break;
		    }
		  
		  if (cstring_equalLen (uentry_rawName (oe), name, checklen))
		    {
		      if (optgenerror 
			  (FLG_DISTINCTEXTERNALNAMES,
			   /*@-sefparams@*/
			   message 
			   ("External identifier %q is not distinguishable from %q "
			    "in the first %d characters (%q)",
			    uentry_getName (e),
			    uentry_getName (oe),
			    size_toInt (checklen),
			    cstring_clip (uentry_getName (e), checklen)),
			   /*@=sefparams@*/
			   uentry_whereLast (e)))
			{
			  uentry_showWhereAny (oe);
			  uentry_setHasNameError (oe);
			  gotone = TRUE;
			}
		    }
		  else
		    {
		      if (gotone)
			{
			  extras = TRUE;
			  break;
			}
		      
		      if (optgenerror 
			  (FLG_DISTINCTEXTERNALNAMES,
			   message 
			   ("External identifier %q is not distinguishable from %q "
			    "in the first %d characters because alphabetical case "
			    "is ignored",
			    uentry_getName (e),
			    uentry_getName (oe),
			    size_toInt (checklen)),
			   uentry_whereLast (e)))
			{
			  uentry_showWhereAny (oe);
			  uentry_setHasNameError (oe);
			  gotone = TRUE;
			}
		    }
		}
	    }
	  else if (cstring_equalLen (uentry_rawName (oe), name, checklen))
	    {
	      if (gotone)
		{
		  extras = TRUE;
		  break;
		}
	      
	      if (optgenerror 
		  (FLG_DISTINCTEXTERNALNAMES,
		   /*@-sefparams@*/
		   message 
		   ("External identifier %q is not distinguishable from %q "
		    "in the first %d characters (%q)",
		    uentry_getName (e),
		    uentry_getName (oe),
		    size_toInt (checklen),
		    cstring_clip (uentry_getName (e), checklen)),
		   /*@=sefparams@*/
		   uentry_whereLast (e)))
		{
		  uentry_showWhereAny (oe);
		  uentry_setHasNameError (oe);
		  gotone = TRUE;
		}
	    }
	  else
	    {
	      ; /* okay */
	    }
	}
    } end_usymtab_entries ;

  hasError = gotone;
  
  if (extras)
    {
      llgenindentmsgnoloc
	(cstring_makeLiteral ("One or more additional "
			      "indistinguishable external "
			      "names not reported"));
    }

  return hasError;
}

static bool checkDistinctInternalName (uentry e)
  /*@globals utab@*/
  /*@modifies *g_warningstream@*/
{
  usymtab ttab = utab;
  cstring name = uentry_rawName (e);
  size_t numchars = size_fromInt (context_getValue (FLG_INTERNALNAMELEN));
  bool caseinsensitive = context_getFlag (FLG_INTERNALNAMECASEINSENSITIVE);
  bool lookalike = context_getFlag (FLG_INTERNALNAMELOOKALIKE);

  if (uentry_isAnyTag (e) && (numchars != 0))
    {
      numchars++;  /* the tag marker doesn't count */
    }
  
  while (usymtab_isDefined (ttab))
    {
      usymtab_entries (ttab, oe)
	{
	  if (uentry_sameObject (oe, e))
	    {
	      /*@innercontinue@*/ continue;
	    }

	  switch (cstring_genericEqual
		  (name, uentry_rawName (oe),
		   numchars, caseinsensitive, lookalike))
	    {
	    case CGE_DISTINCT: /* okay */
	      /*@switchbreak@*/ 
	      break;
	    case CGE_SAME:
	      if (cstring_equal (name, uentry_rawName (oe)))
		{
		  ; /* got a shadow error */
		}
	      else
		{
		  if (optgenerror 
		      (FLG_DISTINCTINTERNALNAMES,
		       /*@-sefparams@*/
		       message 
		       ("Internal identifier %q is not distinguishable from %q "
			"in the first %d characters (%q)",
			uentry_getName (e),
			uentry_getName (oe),
			size_toInt (numchars),
			cstring_clip (uentry_getName (e), numchars)),
		       /*@=sefparams@*/
		       uentry_whereLast (e)))
		    {
		      uentry_showWhereAny (oe);
		      uentry_setHasNameError (oe);
		      return TRUE;
		    }
		}
	      /*@switchbreak@*/
	      break;
	    case CGE_CASE:
	      if (numchars == 0 || (cstring_length (name) <= numchars))
		{
		  if (optgenerror 
		      (FLG_DISTINCTINTERNALNAMES,
		       message 
		       ("Internal identifier %q is not distinguishable from %q "
			"without case sensitivity",
			uentry_getName (e),
			uentry_getName (oe)),
		       uentry_whereLast (e)))
		    {
		      uentry_showWhereAny (oe);
		      uentry_setHasNameError (oe);
		      return TRUE;
		    }
		}
	      else 
		{
		  if (optgenerror 
		      (FLG_DISTINCTINTERNALNAMES,
		       message 
		       ("Internal identifier %q is not distinguishable from %q "
			"in the first %d characters without case sensitivity",
			uentry_getName (e),
			uentry_getName (oe),
			size_toInt (numchars)),
		       uentry_whereLast (e)))
		    {
		      uentry_showWhereAny (oe);
		      uentry_setHasNameError (oe);
		      return TRUE;
		    }
		}
	      /*@switchbreak@*/ 
	      break;
	    case CGE_LOOKALIKE:
	      if (numchars == 0 
		  || (cstring_length (name) <= numchars))
		{
		  if (optgenerror 
		      (FLG_DISTINCTINTERNALNAMES,
		       message 
		       ("Internal identifier %q is not distinguishable from %q "
			"except by lookalike characters",
			uentry_getName (e),
			uentry_getName (oe)),
		       uentry_whereLast (e)))
		    {
		      uentry_showWhereAny (oe);
		      uentry_setHasNameError (oe);
		      return TRUE;
		    }
		}
	      else 
		{
		  if (optgenerror 
		      (FLG_DISTINCTINTERNALNAMES,
		       message 
		       ("Internal identifier %q is not distinguishable from %q "
			"in the first %d characters except by lookalike characters",
			uentry_getName (e),
			uentry_getName (oe),
			size_toInt (numchars)),
		       uentry_whereLast (e)))
		    {
		      uentry_showWhereAny (oe);
		      uentry_setHasNameError (oe);
		      return TRUE;
		    }
		}
	    }
	} end_usymtab_entries ;
      
      ttab = ttab->env;
    }

  return FALSE;
}

void usymtab_checkDistinctName (uentry e, int scope)
   /*@globals utab, globtab@*/
{
  bool hasError = FALSE;
  fileloc where = uentry_whereLast (e);

  if (!fileloc_isPreproc (where)  && !fileloc_isBuiltin (where))
    {
      if (scope == globScope)
	{
	  if (context_getFlag (FLG_DISTINCTEXTERNALNAMES))
	    {
	      hasError = checkDistinctExternalName (e);
	    }
	}
      
      if (!hasError && context_getFlag (FLG_DISTINCTINTERNALNAMES))
	{
	  hasError = checkDistinctInternalName (e);
	}
    }

  if (hasError)
    {
      uentry_setHasNameError (e);
    }
}

/*@exposed@*/ sRef usymtab_lookupGlobalMarker (void) /*@globals utab@*/
{
  uentry ue;

  ue = usymtab_lookupAux (utab, GLOBAL_MARKER_NAME);
  llassert (uentry_isValid (ue));

  return uentry_getSref (ue);
}


# ifdef DEBUGSPLINT
/*
** For debugging only
*/

void
usymtab_checkAllValid () /*@globals utab@*/ 
{
  usymtab tab = utab;

  while (tab != GLOBAL_ENV)
    {
      int i;

      for (i = 0; i < utab->nentries; i++)
	{
	  uentry e = utab->entries[i];
	  
	  uentry_checkValid (e);
	}

      aliasTable_checkValid (tab->aliases);
      tab = tab->env;
    }
}
# endif






splint-3.1.2.dfsg1/src/multiVal.c0000644021234200000250000002041007706100770014174 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** multiVal.c
*/

# include "splintMacros.nf"
# include "basic.h"

/*@only@*/ multiVal multiVal_unknown ()
{
  return multiVal_undefined;
}

static /*@special@*/ /*@notnull@*/ multiVal multiVal_create (mvkind kind)
   /*@defines result->kind@*/
{
  multiVal mv = (multiVal) dmalloc (sizeof (*mv));

  mv->kind = kind;
  return mv;
}

/*@only@*/ multiVal multiVal_makeInt (long x)
{
  multiVal mv = multiVal_create (MVLONG);

  mv->value.ival = x;
  return mv;
}

/*@only@*/ multiVal multiVal_makeChar (char x)
{
  multiVal mv = multiVal_create (MVCHAR);
  mv->value.cval = x;
  return mv;
}

/*@only@*/ multiVal multiVal_makeDouble (double x)
{
  multiVal mv = multiVal_create (MVDOUBLE);

    mv->value.fval = x;
    return mv;
}

/*@only@*/ multiVal multiVal_makeString (/*@only@*/ cstring s)
{
  multiVal mv = multiVal_create (MVSTRING);

  mv->value.sval = s;
  return mv;
}


/*@only@*/ multiVal multiVal_copy (multiVal m)
{
  multiVal r;

  if (multiVal_isUndefined (m))
    {
      return multiVal_undefined;
    }

  r = multiVal_create (m->kind);
      
  switch (m->kind)
    {
    case MVLONG:
      r->value.ival = m->value.ival;
      break;
    case MVCHAR:
      r->value.cval = m->value.cval;
      break;
    case MVDOUBLE:
      r->value.fval = m->value.fval;
      break;
    case MVSTRING:
      r->value.sval = cstring_copy (m->value.sval);
      break;
    }
  
  return r;
}

multiVal multiVal_invert (multiVal m)
{
  if (multiVal_isUndefined (m))
    {
      return multiVal_undefined;
    }
      
  switch (m->kind)
    {
    case MVLONG:
      return multiVal_makeInt (-1 * m->value.ival);
    case MVCHAR:
      BADBRANCHCONT;
      return multiVal_undefined;
    case MVDOUBLE:
      return multiVal_makeDouble (-1.0 * m->value.fval);
    case MVSTRING:
      BADBRANCHCONT;
      return multiVal_undefined;
    }

  BADEXIT;
}

long multiVal_forceInt (multiVal m)
{
  if (multiVal_isInt (m)) {
    return m->value.ival;
  } else {
    llcontbug (message ("Multival is not int: %s", multiVal_unparse (m)));
    return 0;
  }
}

char multiVal_forceChar (multiVal m)
{
  llassert (multiVal_isChar (m));
  
  return m->value.cval;
}

double multiVal_forceDouble (multiVal m)
{
  llassert (multiVal_isDouble (m));

  return m->value.fval;
}

/*@dependent@*/ /*@observer@*/ cstring multiVal_forceString (multiVal m)
{
  llassert (multiVal_isString (m));

  return m->value.sval;
}

bool multiVal_isInt (multiVal m)
{
  return (multiVal_isDefined (m) && m->kind == MVLONG);
}

bool multiVal_isChar (multiVal m)
{
  return (multiVal_isDefined (m) && m->kind == MVCHAR);
}

bool multiVal_isDouble (multiVal m)
{
  return (multiVal_isDefined (m) && m->kind == MVDOUBLE);
}

bool multiVal_isString (multiVal m)
{
  return (multiVal_isDefined (m) && m->kind == MVSTRING);
}

/*@only@*/ cstring multiVal_unparse (multiVal m)
{
  if (multiVal_isDefined (m))
    {
      switch (m->kind)
	{
	case MVLONG:
	  return message ("%d", (int)m->value.ival);
	case MVCHAR:
	  	  return message ("'%h'", m->value.cval);
	case MVDOUBLE:
	  return message ("%f", (float)m->value.fval);
	case MVSTRING:
	  return message ("%s", m->value.sval);
	}
      BADEXIT;
    }
  else
    {
      return (cstring_makeLiteral ("?"));
    }
}

/*@only@*/ cstring multiVal_dump (multiVal m)
{
  if (multiVal_isDefined (m))
    {
      switch (m->kind)
	{
	case MVLONG:
	  return (message ("i%d", (int)m->value.ival));
	case MVCHAR:
	  return (message ("c%d", (int)m->value.cval));
	case MVDOUBLE:
	  return (message ("d%f", (float)m->value.fval));
	case MVSTRING:
	  return (message ("s%s", m->value.sval));
	}
      BADEXIT;
    }
  else
    {
      return (cstring_undefined);
    }
}

/*@only@*/ multiVal multiVal_undump (char **s)
{
  char tchar = **s;

  switch (tchar)
    {
    case 'i':
      (*s)++;
      return multiVal_makeInt (reader_getInt (s));
    case 'c':
      (*s)++;
      return multiVal_makeChar ((char) reader_getInt (s));
    case 'd':
      (*s)++;
      return multiVal_makeDouble (reader_getDouble (s));
    case 's':
      {
	cstring st = cstring_undefined;

	(*s)++;
	while (**s != '#')
	  {
	    st = cstring_appendChar (st, **s);
	    (*s)++;
	  }

	return multiVal_makeString (st);
      }
    case '@':
    case '#':
      return multiVal_unknown ();
    BADDEFAULT;
    }
  
  BADEXIT;
}

int multiVal_compare (multiVal m1, multiVal m2)
{
  if (multiVal_isUndefined (m1))
    {
      if (multiVal_isUndefined (m2)) 
	{
	  return 0;
	}

      else return -1;
    }
  if (multiVal_isUndefined (m2))
    {
      return -1;
    }

  COMPARERETURN (generic_compare (m1->kind, m2->kind));

  switch (m1->kind)
    {
    case MVLONG:   return (generic_compare (m1->value.ival, m2->value.ival));
    case MVCHAR:   return (generic_compare (m1->value.cval, m2->value.cval));
    case MVDOUBLE: return (generic_compare (m1->value.fval, m2->value.fval));
    case MVSTRING: return (cstring_compare (m1->value.sval, m2->value.sval));
    }

  BADEXIT;
}

multiVal multiVal_add (multiVal m1, multiVal m2)
{
  if (multiVal_isUndefined (m1) || multiVal_isUndefined (m2) || m1->kind != m2->kind)
    {
      return multiVal_undefined;
    }

  switch (m1->kind)
    {
    case MVLONG:   return (multiVal_makeInt (m1->value.ival + m2->value.ival));
    case MVCHAR:   return (multiVal_makeChar ((char) (m1->value.cval + m2->value.cval)));
    case MVDOUBLE: return (multiVal_makeDouble (m1->value.fval + m2->value.fval));
    case MVSTRING: return multiVal_undefined;
    }

  BADEXIT;
}

multiVal multiVal_subtract (multiVal m1, multiVal m2)
{
  if (multiVal_isUndefined (m1) || multiVal_isUndefined (m2) || m1->kind != m2->kind)
    {
      return multiVal_undefined;
    }

  switch (m1->kind)
    {
    case MVLONG:   return (multiVal_makeInt (m1->value.ival - m2->value.ival));
    case MVCHAR:   return (multiVal_makeChar ((char) (m1->value.cval - m2->value.cval)));
    case MVDOUBLE: return (multiVal_makeDouble (m1->value.fval - m2->value.fval));
    case MVSTRING: return multiVal_undefined;
    }

  BADEXIT;
}

multiVal multiVal_multiply (multiVal m1, multiVal m2)
{
  if (multiVal_isUndefined (m1) || multiVal_isUndefined (m2) || m1->kind != m2->kind)
    {
      return multiVal_undefined;
    }

  switch (m1->kind)
    {
    case MVLONG:   return (multiVal_makeInt (m1->value.ival * m2->value.ival));
    case MVCHAR:   return (multiVal_makeChar ((char) (m1->value.cval * m2->value.cval)));
    case MVDOUBLE: return (multiVal_makeDouble (m1->value.fval * m2->value.fval));
    case MVSTRING: return multiVal_undefined;
    }

  BADEXIT;
}

multiVal multiVal_divide (multiVal m1, multiVal m2)
{
  if (multiVal_isUndefined (m1) || multiVal_isUndefined (m2) || m1->kind != m2->kind)
    {
      return multiVal_undefined;
    }

  switch (m1->kind)
    {
    case MVLONG: 
      if (m2->value.ival != 0)
	{
	  return (multiVal_makeInt (m1->value.ival / m2->value.ival));
	}
      else
	{
	  return multiVal_undefined;
	}
    case MVCHAR:   
      if (m2->value.cval != (char) 0)
	{
	  return (multiVal_makeChar ((char) (m1->value.cval / m2->value.cval)));
	}
      else
	{
	  return multiVal_undefined;
	}
    case MVDOUBLE:
      return multiVal_undefined; /* Don't attempt to divide floats */
    case MVSTRING: return multiVal_undefined;
    }

  BADEXIT;
}

void multiVal_free (/*@only@*/ multiVal m)
{
  if (multiVal_isDefined (m))
    {
      if (m->kind == MVSTRING)
	{
	  cstring_free (m->value.sval);
	}
      
      sfree (m);
    }
}




splint-3.1.2.dfsg1/src/lltok.c0000644021234200000250000001650107670427301013534 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** lltok.c
*/

# include "splintMacros.nf"
# include "basic.h"

# include "cgrammar.h"
# include "cgrammar_tokens.h"

bool
lltok_isSemi (lltok tok)
{
  return (tok->tok == TSEMI);
}

bool
lltok_isMult (lltok tok)
{
  return (tok->tok == TMULT);
}

bool lltok_isIncOp (lltok tok)
{
  return (tok->tok == INC_OP);
}

bool lltok_isDecOp  (lltok tok)
{
  return (tok->tok == DEC_OP);
}


/* DRL added this function 10/23/2000 for boolean stuff */
bool lltok_isEqOp (lltok tok)
{
  return (tok->tok == EQ_OP);
}

bool lltok_isNotEqOp (lltok tok)
{
  return (tok->tok == NE_OP);
}

/* DRL added this function 10/25/2000 for boolean stuff */
bool lltok_isAndOp (lltok tok)
{
  return (tok->tok == AND_OP);
}

bool lltok_isOrOp (lltok tok)
{
  return (tok->tok == OR_OP);
}

bool lltok_isNotOp (lltok tok)
{
  return (tok->tok ==  TEXCL);
}
/*drl7x added this function 11/20/00 */

bool lltok_isLt_Op (lltok tok)
{
  return (tok->tok ==  TLT);
}

bool lltok_isGt_Op (lltok tok)
{
  return (tok->tok ==  TGT);
}
  
bool lltok_isGe_Op (lltok tok)
{
  return (tok->tok ==  GE_OP);
}

bool lltok_isLe_Op (lltok tok)
{
  return (tok->tok ==  LE_OP);
}

/* end drl7x added */


/*drl7x added 11 30 2000*/
bool  lltok_isPlus_Op (lltok tok)
{
  return (tok->tok ==  TPLUS);
}

bool  lltok_isMinus_Op (lltok tok)
{
  return (tok->tok ==  TMINUS);
}

/*drl7x added 6 6 2001 */


bool  lltok_isAmpersand_Op (lltok tok)
{
  return (tok->tok == TAMPERSAND);
}

/*end drl added */

/*drl7x added 6 15 2001 */

bool  lltok_isExcl_Op (lltok tok)
{
  return (tok->tok == TEXCL);
}

bool  lltok_isTilde_Op (lltok tok)
{
  return (tok->tok == TTILDE);
}
/*end drl added */


bool lltok_isEnsures (lltok tok)
{
  return (tok->tok == QPOSTCLAUSE);
}

bool lltok_isRequires (lltok tok)
{
  return (tok->tok == QPRECLAUSE);
}

cstring
lltok_unparse (lltok tok)
{
  char *lit;

  switch (tok->tok)
    {
    case BREAK:      lit = "break"; break;
    case CASE:       lit = "case"; break;
    case CONTINUE:   lit = "continue"; break;
    case DEFAULT:    lit = "default"; break;
    case DO:         lit = "do"; break;
    case CDOUBLE:    lit = "double"; break;
    case CELSE:      lit = "else"; break;
    case CFOR:       lit = "for"; break;
    case GOTO:       lit = "goto"; break;
    case CIF:        lit = "if"; break;
    case RETURN:     lit = "return"; break;
    case CSIZEOF:    lit = "sizeof"; break;
    case SWITCH:     lit = "switch"; break;
    case WHILE:      lit = "while"; break;
    case CSTRUCT:    lit = "struct"; break;
    case CTYPEDEF:   lit = "typedef"; break;
    case CUNION:     lit = "union"; break;
    case CENUM:      lit = "enum"; break;
    case QEXTERN:     lit = "extern"; break;
    case QAUTO:       lit = "auto"; break;
    case QSTATIC:     lit = "static"; break;
    case RIGHT_ASSIGN: lit = ">>="; break;
    case LEFT_ASSIGN:  lit = "<<="; break;
    case ADD_ASSIGN: lit = "+="; break;
    case SUB_ASSIGN: lit = "-="; break;
    case MUL_ASSIGN: lit = "*="; break;
    case DIV_ASSIGN: lit = "/="; break;
    case MOD_ASSIGN: lit = "%="; break;
    case AND_ASSIGN: lit = "&="; break;
    case XOR_ASSIGN: lit = "^="; break;
    case OR_ASSIGN:  lit = "|="; break;
    case RIGHT_OP:   lit = ">>"; break;
    case LEFT_OP:    lit = "<<"; break;
    case INC_OP:     lit = "++"; break; 
    case DEC_OP:     lit = "--"; break;
    case ARROW_OP:   lit = "->"; break;
    case AND_OP:     lit = "&&"; break;
    case OR_OP:      lit = "||"; break;
    case LE_OP:      lit = "<="; break;
    case GE_OP:      lit = ">="; break;
    case EQ_OP:      lit = "=="; break;
    case NE_OP:      lit = "!="; break;
    case TSEMI:      lit = ";"; break;
    case TLBRACE:    lit = "{"; break;
    case TRBRACE:    lit = "}"; break;
    case TCOMMA:     lit = ","; break;
    case TCOLON:     lit = ":"; break;
    case TASSIGN:    lit = "="; break;
    case TLPAREN:    lit = "("; break;
    case TRPAREN:    lit = ")"; break;
    case TLSQBR:     lit = "["; break;
    case TRSQBR:     lit = "]"; break;
    case TDOT:       lit = "."; break; /* evans 2003-05-31: Fix reported by psanzani. */
    case TAMPERSAND: lit = "&"; break;
    case TEXCL:      lit = "!"; break;
    case TTILDE:     lit = "~"; break;
    case TMINUS:     lit = "-"; break;
    case TPLUS:      lit = "+"; break;
    case TMULT:      lit = "*"; break;
    case TDIV:       lit = "/"; break;
    case TPERCENT:   lit = "%"; break;
    case TLT:        lit = "<"; break;
    case TGT:        lit = ">"; break;
    case TCIRC:      lit = "^"; break;
    case TBAR:       lit = "|"; break;
    case TQUEST:     lit = "?"; break;  
    case QOUT:       lit = "out"; break;
    case QONLY:      lit = "only"; break;
    case QKEEP:      lit = "keep"; break;
    case QKEPT:      lit = "kept"; break;
    case QTEMP:      lit = "temp"; break;
    case QSHARED:    lit = "shared"; break;
    case QUNIQUE:    lit = "unique"; break;
    case QREF:       lit = "ref"; break;
    case QCHECKED:   lit = "checked"; break;
    case QCHECKEDSTRICT: lit = "checkedstrict"; break;
    case QCHECKMOD:  lit = "checkmod"; break;
    case QUNCHECKED: lit = "unchecked"; break;
    case QPRECLAUSE: lit = "requires"; break;
    case QPOSTCLAUSE: lit = "ensures"; break;
    case QTRUENULL:  lit = "truenull"; break;
    case QFALSENULL: lit = "falsenull"; break;
    case QRETURNED:  lit = "returned"; break;
    case QEXPOSED:   lit = "exposed"; break;
    case QNULL:      lit = "null"; break;
    case QRELNULL:   lit = "refnull"; break;
    case QOBSERVER:  lit = "observer"; break;
    case QPARTIAL:   lit = "partial"; break;
    case QSPECIAL:   lit = "special"; break;
    case QUSES:      lit = "uses"; break;
    case QDEFINES:   lit = "defines"; break;
    case QALLOCATES: lit = "allocates"; break;
    case QSETS:      lit = "sets"; break;
    case QRELEASES:  lit = "releases"; break;
    case QSETBUFFERSIZE: lit = "setBufferSize"; break;
    case QSETSTRINGLENGTH: lit = "setStringLength"; break;
    BADDEFAULT;
    }
 
  return cstring_makeLiteralTemp (lit);
}

lltok
lltok_create (int tok, fileloc loc)
{
  lltok l = (lltok) dmalloc (sizeof (*l));

  l->tok = tok;
  l->loc = loc;
  DPRINTF (("Create: %s [%p]", lltok_unparse (l), loc));
  return (l);
}

void lltok_free (lltok t) 
{
  fileloc_free (t->loc);
  sfree (t);
}

void lltok_free2 (lltok t1, lltok t2) 
{
  lltok_free (t1);
  lltok_free (t2);
}

void lltok_free3 (lltok t1, lltok t2, lltok t3) 
{
  lltok_free (t1);
  lltok_free (t2);
  lltok_free (t3);
}

splint-3.1.2.dfsg1/src/sRef.c0000644021234200000250000065672710102766473013332 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** storeRef.c
**
** Memory management:
**    storeRef's are kept in allRefs for each function scope, and all are
**    free'd at the end of the function.  This relies on the constraint that
**    no storeRef created while checking a function is used outside that
**    function.
**
**    storeRefs in the file and global scopes are free'd by the uentry.
**
*/

# include "splintMacros.nf"
# include "basic.h"
# include "exprChecks.h"
# include "transferChecks.h"
# include "sRefTable.h"
# include "structNames.h"

/*
** Predicate functions that evaluate both arguments in order.
*/

/*@notfunction@*/
# define OR(a,b)  (a ? (b, TRUE) : b)

/*@notfunction@*/
# define AND(a,b) (a ? b : (b, FALSE))

static void sRef_checkValidAux (sRef p_s, sRefSet p_checkedsofar) /*@modifies p_checkedsofar@*/ ;

static bool sRef_isDerived (sRef p_s) /*@*/ ;

static /*@exposed@*/ sRef sRef_fixDirectBase (sRef p_s, sRef p_base) 
   /*@modifies p_base@*/ ;

static void sRef_updateNullState (sRef p_res, sRef p_other) /*@modifies p_res@*/ ;

static bool sRef_isAllocatedStorage (sRef p_s) /*@*/ ;
static void sRef_setNullErrorLoc (sRef p_s, fileloc) /*@*/ ;
static void sRef_setNullStateN (sRef p_s, nstate p_n) /*@modifies p_s@*/ ;

static int sRef_depth (sRef p_s) /*@*/ ;

static void
  sRef_innerAliasSetComplete (void (p_predf) (sRef, fileloc), sRef p_s, 
			      fileloc p_loc)
  /*@modifies p_s@*/ ;

static void
sRef_innerAliasSetCompleteParam (void (p_predf) (sRef, sRef), sRef p_s, sRef p_t)
     /*@modifies p_s@*/ ;
     
static speckind speckind_fromInt (int p_i);
static bool sRef_equivalent (sRef p_s1, sRef p_s2);
static bool sRef_isDeepUnionField (sRef p_s);
static void sRef_addDeriv (/*@notnull@*/ sRef p_s, /*@notnull@*/ /*@exposed@*/ sRef p_t);
static bool sRef_checkModify (sRef p_s, sRefSet p_sl) /*@*/ ;

/*
** If s is definitely null, it has no memory state.
*/

static void sRef_resetAliasKind (/*@notnull@*/ sRef s) /*@modifies s->aliaskind@*/
{
  if (s->nullstate == NS_DEFNULL)
    {
      /* s->aliaskind = AK_ERROR; */
    }
}

# ifdef DEBUGSPLINT
extern void sRef_checkCompletelyReasonable (sRef s) /*@*/ 
{
  DPRINTF (("Check sRef: [%p] %s / %s", s, sRef_unparse (s),
	    sRefSet_unparse (sRef_derivedFields (s))));

  if (sRef_isReasonable (s))
    {
      sRefSet_elements (s->deriv, el)
	{
	  llassert (el != s);
	  sRef_checkCompletelyReasonable (el);
	} end_sRefSet_elements ;
    }
}
# endif

/*@falsewhennull@*/ bool sRef_isReasonable (sRef s) /*@*/
{
  if (sRef_isValid (s))
    {
# ifdef DEBUGSPLINT
      if (!bool_isReasonable (s->safe)
	  || !bool_isReasonable (s->modified)
	  || !bool_isReasonable (s->immut))
	{
	  llcontbug (message ("Unreasonable sRef [%p]", s));
	  return FALSE;
	}

      if (!sstate_isValid (s->defstate))
	{
	  llcontbug (message ("Unreasonable sRef [%p]", s));
	  return FALSE;
	}

      if (!nstate_isValid (s->nullstate))
	{
	  llcontbug (message ("Unreasonable sRef [%p]", s));
	  return FALSE;
	}

      if (!alkind_isValid (s->aliaskind)
	  || !alkind_isValid (s->oaliaskind))
	{
	  llcontbug (message ("Unreasonable sRef [%p]", s));
	  return FALSE;
	}

      if (!exkind_isValid (s->expkind)
	  || !exkind_isValid (s->oexpkind))
	{
	  llcontbug (message ("Unreasonable sRef [%p]", s));
	  return FALSE;
	}
# endif

      return TRUE;
    }

  return FALSE;
}

static /*@nullwhentrue@*/ bool sRef_isUnreasonable (sRef s) /*@*/
{
  return (!sRef_isReasonable (s));
}

static void sRef_checkMutable (/*@unused@*/ sRef s)
{
  if (sRef_isReasonable (s) && s->immut)
    {
      llcontbug (message ("Modification to sRef marked immutable: %q", 
			  sRef_unparseFull (s)));
    }
}

static bool skind_isSimple (skind sk)
{
  switch (sk)
    {
    case SK_PARAM: case SK_CVAR: case SK_CONST:
    case SK_OBJECT: case SK_UNKNOWN: case SK_NEW:
      return TRUE;
    default:
      return FALSE;
    }
}

static void sinfo_free (/*@special@*/ /*@temp@*/ /*@notnull@*/ sRef p_s)
   /*@uses p_s->kind, p_s->info@*/
   /*@releases p_s->info@*/ ;

static /*@null@*/ sinfo sinfo_copy (/*@notnull@*/ sRef p_s) /*@*/ ;
static void sRef_setPartsFromUentry (sRef p_s, uentry p_ue)
   /*@modifies p_s@*/ ;
static bool checkDeadState (/*@notnull@*/ sRef p_el, /*@null@*/ sRef p_e2, 
			    bool p_tbranch, fileloc p_loc);
static /*@dependent@*/ sRef sRef_constructPointerAux (/*@notnull@*/ /*@exposed@*/ sRef p_t) /*@*/ ;

static void 
  sRef_combineExKinds (/*@notnull@*/ sRef p_res, /*@notnull@*/ sRef p_other)
  /*@modifies p_res@*/ ;

static void 
  sRef_combineAliasKinds (/*@notnull@*/ sRef p_res, /*@notnull@*/ sRef p_other, 
			  clause p_cl, fileloc p_loc)
  /*@modifies p_res@*/ ;

static void
  sRef_combineNullState (/*@notnull@*/ sRef p_res, /*@notnull@*/ sRef p_other)
  /*@modifies p_res@*/ ;

static void
  sRef_combineDefState (/*@notnull@*/ sRef p_res, /*@notnull@*/ sRef p_other)
  /*@modifies p_res@*/ ;

static void sRef_setStateFromAbstractUentry (sRef p_s, uentry p_ue) 
  /*@modifies p_s@*/ ;

static void 
  sinfo_update (/*@notnull@*/ /*@exposed@*/ sRef p_res, 
		/*@notnull@*/ /*@exposed@*/ sRef p_other);
static void sRef_setDefinedAux (sRef p_s, fileloc p_loc, bool p_clear)
   /*@modifies p_s@*/ ;
static void sRef_setDefinedNoClear (sRef p_s, fileloc p_loc)
   /*@modifies p_s@*/ ;
static void sRef_setStateAux (sRef p_s, sstate p_ss, fileloc p_loc)
   /*@modifies p_s@*/;

static /*@exposed@*/ sRef 
  sRef_buildNCField (/*@exposed@*/ sRef p_rec, /*@exposed@*/ cstring p_f);

static void 
  sRef_mergeStateAux (/*@notnull@*/ sRef p_res, /*@notnull@*/ sRef p_other, 
		      clause p_cl, bool p_opt, fileloc p_loc,
		      bool p_doDerivs)
  /*@modifies p_res, p_other@*/ ;

static /*@null@*/ sinfo sinfo_fullCopy (/*@notnull@*/ sRef p_s);
static bool sRef_doModify (sRef p_s, sRefSet p_sl) /*@modifies p_s@*/ ;
static bool sRef_doModifyVal (sRef p_s, sRefSet p_sl) /*@modifies p_s@*/;
static bool sRef_checkModifyVal (sRef p_s, sRefSet p_sl) /*@*/ ;

static /*@only@*/ sRefSet
  sRef_mergeDerivs (/*@only@*/ sRefSet p_res, sRefSet p_other, 
		    bool p_opt, clause p_cl, fileloc p_loc);

static /*@only@*/ sRefSet
  sRef_mergeUnionDerivs (/*@only@*/ sRefSet p_res, 
			 /*@exposed@*/ sRefSet p_other,
			 bool p_opt, clause p_cl, fileloc p_loc);

static /*@only@*/ sRefSet 
  sRef_mergePdefinedDerivs (/*@only@*/ sRefSet p_res, sRefSet p_other, bool p_opt,
			    clause p_cl, fileloc p_loc);

static /*@only@*/ cstring sRef_unparseWithArgs (sRef p_s, uentryList p_args);
static /*@only@*/ cstring sRef_unparseNoArgs (sRef p_s);

static /*@exposed@*/ sRef sRef_findDerivedPointer (sRef p_s);
static /*@exposed@*/ sRef sRef_findDerivedArrayFetch (/*@notnull@*/ sRef, bool, int, bool) ;
static /*@exposed@*/ sRef sRef_findDerivedField (/*@notnull@*/ sRef p_rec, cstring p_f);
static /*@exposed@*/ sRef
  sRef_getDeriv (/*@notnull@*/ /*@returned@*/ sRef p_set, sRef p_guide);

static bool inFunction = FALSE;
static /*@only@*/ sRefTable allRefs;

/* # define DEBUGREFS  */

# ifdef DEBUGREFS
static nsrefs = 0;
static totnsrefs = 0;
static maxnsrefs = 0;
static ntotrefers = 0;
static nrefers = 0;
# endif

static /*@checked@*/ bool protectDerivs = FALSE;

/*
** Result of sRef_alloc is dependent since allRefs may
** reference it.  It is only if !inFunction.
*/

static /*@dependent@*/ /*@out@*/ /*@notnull@*/ sRef
sRef_alloc (void)
{
  sRef s = (sRef) dmalloc (sizeof (*s));

  s->immut = FALSE;

  DPRINTF (("Alloc sref: [%p]", s));

  if (inFunction)
    {
      allRefs = sRefTable_add (allRefs, s);
      /*@-branchstate@*/ 
    }
  else
    {
      DPRINTF (("Not in function!"));
    }

  /*@=branchstate@*/

# ifdef DEBUGREFS
  if (nsrefs >= maxnsrefs)
    {
      maxnsrefs = nsrefs;
    }

  totnsrefs++;
  nsrefs++;
# endif

  /*@-mustfree@*/ /*@-freshtrans@*/
  return s;
  /*@=mustfree@*/ /*@=freshtrans@*/
}

static void sRef_checkValidAux (sRef s, sRefSet checkedsofar)
{
  llassert (FALSE);

  if (!sRef_isReasonable (s)) return;

  if (sRefSet_containsSameObject (checkedsofar, s))
    {
      return;
    }

  /*@-temptrans@*/
  checkedsofar = sRefSet_insert (checkedsofar, s);
  /*@=temptrans@*/ /* checksofar will be destroyed before checkValid returns */

  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
      llassert (cstring_length (s->info->fname) < 100);
      break;

    case SK_CVAR:
      llassert (s->info->cvar->lexlevel >= 0);
      /* llassert (s->info->cvar->lexlevel <= usymtab_getCurrentDepth ()); */
      break;

    case SK_PARAM:
      llassert (s->info->paramno >= -1);
      llassert (s->info->paramno <= 999); /* sanity check */
      break;

    case SK_ARRAYFETCH:
      sRef_checkValidAux (s->info->arrayfetch->arr, checkedsofar);
      break;

    case SK_FIELD:
      sRef_checkValidAux (s->info->field->rec, checkedsofar);
      llassert (cstring_length (s->info->field->field) < 100);
      break;

    case SK_PTR:
      sRef_checkValidAux (s->info->ref, checkedsofar);
      break;
 
   case SK_ADR:
      sRef_checkValidAux (s->info->ref, checkedsofar);
      break;

    case SK_OBJECT:
      /* check ctype s->info->object */
      break;

    case SK_CONJ:
      sRef_checkValidAux (s->info->conj->a, checkedsofar);
      sRef_checkValidAux (s->info->conj->b, checkedsofar);
      break;

    case SK_NEW:
      llassert (cstring_length (s->info->fname) < 100);
      break;

    case SK_DERIVED:
      sRef_checkValidAux (s->info->ref, checkedsofar);
      break;

    case SK_EXTERNAL:
      sRef_checkValidAux (s->info->ref, checkedsofar);
      break;

    case SK_TYPE:
    case SK_CONST:
    case SK_RESULT:
      /* check ctyp s->type */
      break;

    case SK_SPECIAL:
      llassert (s->info->spec == SR_NOTHING 
		|| s->info->spec == SR_INTERNAL
		|| s->info->spec == SR_SPECSTATE 
		|| s->info->spec == SR_SYSTEM);
      break;

    case SK_UNKNOWN:
      break;

      BADDEFAULT;
    }
  

  sRefSet_elements (s->deriv, el)
    {
      sRef_checkValidAux (el, checkedsofar);
    } end_sRefSet_elements ;
}

void sRef_checkValid (/*@unused@*/ sRef s)
{
  return;
  /*
  sRefSet checkedsofar = sRefSet_new ();
  sRef_checkValidAux (s, checkedsofar);
  */
}

static /*@dependent@*/ /*@notnull@*/ /*@special@*/ sRef
  sRef_new (void)
  /*@defines result@*/
  /*@ensures isnull result->aliasinfo, result->definfo,
                    result->expinfo, result->info, result->deriv, result->state@*/
{
  sRef s = sRef_alloc ();

  s->kind = SK_UNKNOWN;
  s->safe = TRUE;
  s->modified = FALSE;
  s->immut = FALSE;
  s->val = multiVal_undefined;

  s->type = ctype_unknown;
  s->defstate = SS_UNKNOWN;

  /* start modifications */
  s->bufinfo.bufstate = BB_NOTNULLTERMINATED;
  s->bufinfo.size = -1; 
  s->bufinfo.len = -1; 
  /* end modifications */

  s->aliaskind = AK_UNKNOWN;
  s->oaliaskind = AK_UNKNOWN;

  s->nullstate = NS_UNKNOWN;

  s->expkind = XO_UNKNOWN;
  s->oexpkind = XO_UNKNOWN;

  s->aliasinfo = stateInfo_undefined;
  s->definfo = stateInfo_undefined;
  s->nullinfo = stateInfo_undefined;
  s->expinfo = stateInfo_undefined;

  s->info = NULL;
  s->deriv = sRefSet_undefined;

  s->state = valueTable_undefined;

  return s;
}

static /*@dependent@*/ /*@notnull@*/ /*@special@*/ sRef
  sRef_newRef (void)
  /*@defines result@*/
  /*@ensures isnull result->aliasinfo, result->definfo,
                    result->expinfo, result->info, result->deriv@*/
{
  sRef res = sRef_new ();
  res->immut = FALSE;
  res->state = valueTable_undefined;
  return res;
}


void sRef_protectDerivs (void) /*@modifies protectDerivs@*/
{
  llassert (!protectDerivs);
  protectDerivs = TRUE;
}

void sRef_clearProtectDerivs (void) /*@modifies protectDerivs@*/
{
  llassert (protectDerivs);
  protectDerivs = FALSE;
}

/*
** hmmm...here be kind of a hack.  This function mysteriously appeared
** in my code, but I'm sure I didn't write it.
*/

bool
sRef_isRecursiveField (sRef s)
{
  if (sRef_isField (s))
    {
      if (sRef_depth (s) > 13)
	{
	  sRef base;
	  cstring fieldname;
	  
	  fieldname = sRef_getField (s);
	  base = sRef_getBase (s);
	  
	  while (sRef_isReasonable (base))
	    {
	      if (sRef_isField (base))
		{
		  if (cstring_equal (fieldname, sRef_getField (base)))
		    {
		      return TRUE;
		    }
		}
	      
	      base = sRef_getBaseSafe (base);
	    }
	}
    }

  return FALSE;
}

static void
sRef_addDeriv (/*@notnull@*/ sRef s, /*@notnull@*/ /*@exposed@*/ sRef t)
{
  if (!context_inProtectVars () 
      && !protectDerivs
      && sRef_isReasonable (s)
      && sRef_isReasonable (t)
      && !sRef_isConst (s))
    {
      int sd = sRef_depth (s);
      int td = sRef_depth (t);
      
      if (sd >= td)
	{
	  return;
	}

      /* This sometimes fails: (evans 2001-07-12)
      if (sRef_isArrayFetch (t))
	{
	  DPRINTF (("Derived fetch: %s / %s / %s",
		    sRef_unparseFull (s), sRef_unparseFull (t),
		    sRef_unparseFull (t->info->arrayfetch->arr)));
	  llassert (t->info->arrayfetch->arr == s);
	}
      */

      if (sRef_isFileOrGlobalScope (s))
	{
	  if (context_inFunctionLike () 
	      && ctype_isKnown (sRef_getType (s))
	      && !ctype_isFunction (sRef_getType (s)))
	    {
	      globSet g = context_getUsedGlobs ();

	      if (!globSet_member (g, s))
		{
		  /* 
		  ** don't report as a bug 
		  ** 

		  llcontbug 
			(message ("sRef_addDeriv: global variable not in used "
				  "globs: %q / %s / %q",
				  sRef_unparse (s), 
				  ctype_unparse (sRef_getType (s)),
				  sRefSet_unparse (s->deriv)));
		  */
		}
	      else
		{
		  DPRINTF (("Add deriv: [%p] %s / [%p] %s",
			    s, sRef_unparse (s),
			    t, sRef_unparse (t)));
		  
		  s->deriv = sRefSet_insert (s->deriv, t);
		}
	    }
	}
      else
	{
	  DPRINTF (("Add deriv: [%p] %s / [%p] %s",
		    s, sRef_unparse (s),
		    t, sRef_unparse (t)));

	  s->deriv = sRefSet_insert (s->deriv, t);
	}
    }
}

bool
sRef_deepPred (bool (predf) (sRef), sRef s)
{
  if (sRef_isReasonable (s))
    {
      if ((*predf)(s)) return TRUE;

      switch (s->kind)
	{
	case SK_PTR:
	  return (sRef_deepPred (predf, s->info->ref));
	case SK_ARRAYFETCH:
	  return (sRef_deepPred (predf, s->info->arrayfetch->arr));
	case SK_FIELD:
	  return (sRef_deepPred (predf, s->info->field->rec));
	case SK_CONJ:
	  return (sRef_deepPred (predf, s->info->conj->a)
		  || sRef_deepPred (predf, s->info->conj->b));
	default:
	  return FALSE;
	}
    }

  return FALSE;
}

bool sRef_modInFunction (void)
{
  return inFunction;
}

void sRef_setStateFromType (sRef s, ctype ct)
{
  if (sRef_isReasonable (s))
    {
      if (ctype_isUser (ct))
	{
	  DPRINTF (("Here we are: %s", sRef_unparseFull (s)));
	  sRef_setStateFromUentry 
	    (s, usymtab_getTypeEntry (ctype_typeId (ct)));
	}
      else if (ctype_isAbstract (ct))
	{
	  DPRINTF (("Here we are: %s", sRef_unparseFull (s)));
	  sRef_setStateFromAbstractUentry 
	    (s, usymtab_getTypeEntry (ctype_typeId (ct)));
	}
      else
	{
	  ; /* not a user type */
	}
    }
}

static void sRef_setTypeState (sRef s)
{
  if (sRef_isReasonable (s))
    {
      sRef_setStateFromType (s, s->type);
    }
}

bool sRef_hasAliasInfoLoc (sRef s)
{
  return (sRef_isReasonable (s) && (s->aliasinfo != NULL)
	  && (fileloc_isDefined (s->aliasinfo->loc)));
}

/*@falsewhennull@*/ bool sRef_hasStateInfoLoc (sRef s)
{
  return (sRef_isReasonable (s) && (s->definfo != NULL) 
	  && (fileloc_isDefined (s->definfo->loc)));
}

/*@falsewhennull@*/ bool sRef_hasExpInfoLoc (sRef s)
{
  return (sRef_isReasonable (s) 
	  && (s->expinfo != NULL) && (fileloc_isDefined (s->expinfo->loc)));
}

# if 0
static /*@observer@*/ /*@unused@*/ stateInfo sRef_getInfo (sRef s, cstring key)
{
  stateValue sv;
  
  if (!sRef_isReasonable (s)) {
    return stateInfo_undefined;
  }
  
  sv = valueTable_lookup (s->state, key);
  
  if (stateValue_isDefined (sv)) 
    {
      return stateValue_getInfo (sv);
    }
  
  return stateInfo_undefined;
}
# endif

static bool
sRef_hasNullInfoLoc (sRef s)
{
  return (sRef_isReasonable (s) && s->nullinfo != NULL
	  && (fileloc_isDefined (s->nullinfo->loc)));
}

bool
sRef_hasAliasInfoRef (sRef s)
{
  return (sRef_isReasonable (s) && (s->aliasinfo != NULL) 
	  && (sRef_isReasonable (s->aliasinfo->ref)));
}

static /*@observer@*/ fileloc
sRef_getAliasInfoLoc (/*@exposed@*/ sRef s)
{
  llassert (sRef_isReasonable (s) && s->aliasinfo != NULL
	    && (fileloc_isDefined (s->aliasinfo->loc)));
  return (s->aliasinfo->loc);
}

static /*@observer@*/ fileloc
sRef_getStateInfoLoc (/*@exposed@*/ sRef s)
{
  llassert (sRef_isReasonable (s) && s->definfo != NULL 
	    && (fileloc_isDefined (s->definfo->loc)));
  return (s->definfo->loc);
}

static /*@observer@*/ fileloc
sRef_getExpInfoLoc (/*@exposed@*/ sRef s)
{
  llassert (sRef_isReasonable (s) && s->expinfo != NULL 
	    && (fileloc_isDefined (s->expinfo->loc)));
  return (s->expinfo->loc);
}

static /*@observer@*/ fileloc
sRef_getNullInfoLoc (/*@exposed@*/ sRef s)
{
  llassert (sRef_isReasonable (s) && s->nullinfo != NULL 
	    && (fileloc_isDefined (s->nullinfo->loc)));
  return (s->nullinfo->loc);
}

/*@observer@*/ sRef
  sRef_getAliasInfoRef (/*@temp@*/ sRef s)
{
  llassert (sRef_isReasonable (s) && s->aliasinfo != NULL);
  return (s->aliasinfo->ref);
}

bool sRef_inGlobalScope ()
{
  return !inFunction;
}

/*
** This function should be called before new sRefs are created
** somewhere where they will have a lifetime greater than the
** current function scope.
*/

void sRef_setGlobalScope ()
{
  llassert (inFunction);
  DPRINTF (("leave function"));
  inFunction = FALSE;
}

void sRef_clearGlobalScope ()
{
  llassert (!inFunction);
  DPRINTF (("enter function"));
  inFunction = TRUE;
}

static bool oldInFunction = FALSE;
static int nestedScope = 0;

void sRef_setGlobalScopeSafe ()
{
  if (nestedScope == 0)
    {
      oldInFunction = inFunction;
    }
  
  nestedScope++;
  DPRINTF (("leave function safe"));
  inFunction = FALSE;
}

void sRef_clearGlobalScopeSafe ()
{
  nestedScope--;
  llassert (nestedScope >= 0);
  
  if (nestedScope == 0)
    {
      inFunction = oldInFunction;
    }

  DPRINTF (("clear function: %s", bool_unparse (inFunction)));
}

void sRef_enterFunctionScope ()
{
  /* evans 2001-09-09 - cleanup if we are in a macro! */
  if (context_inMacro ())
    {
      if (inFunction) {
	sRef_exitFunctionScope ();
      }
    }

  llassert (!inFunction);
  llassert (sRefTable_isEmpty (allRefs));
  inFunction = TRUE;
  DPRINTF (("enter function"));
}

void sRef_exitFunctionScope ()
{  
  if (inFunction)
    {
      DPRINTF (("Exit function scope."));
      sRefTable_clear (allRefs);
      DPRINTF (("Exit function scope done."));
      inFunction = FALSE;
    }
  else
    {
      llbuglit ("sRef_exitFunctionScope: not in function");
    }
}
  
void sRef_destroyMod () /*@globals killed allRefs;@*/
{
# ifdef DEBUGREFS  
  llmsg (message ("Live: %d / %d ", nsrefs, totnsrefs));  
# endif

  sRefTable_free (allRefs);
}


static /*@notnull@*/ /*@exposed@*/ sRef
sRef_fixConj (/*@notnull@*/ sRef s)
{
  if (sRef_isConj (s))
    {
      do {
	s = sRef_getConjA (s);
      } while (sRef_isConj (s));
      
      llassert (sRef_isReasonable (s));
      return s; /* don't need to ref */
    }
  else
    {
      return s;
    }
}

static bool 
sRef_isExternallyVisibleAux (sRef s)
{
  bool res = FALSE;
  sRef base = sRef_getRootBase (s);

  if (sRef_isReasonable (base))
    {
      res = sRef_isParam (base) || sRef_isFileOrGlobalScope (base) || sRef_isExternal (base);
    }

  return res;
}

bool 
  sRef_isExternallyVisible (sRef s)
{
  return (sRef_aliasCheckSimplePred (sRef_isExternallyVisibleAux, s));
}

/*@exposed@*/ uentry
sRef_getBaseUentry (sRef s)
{
  sRef base = sRef_getRootBase (s);
  uentry res = uentry_undefined;
  
  if (sRef_isReasonable (base))
    {
      switch (base->kind)
	{
	case SK_PARAM:
	  res = usymtab_getRefQuiet (paramsScope, usymId_fromInt (base->info->paramno));
	  break;

	case SK_CVAR:
	  res = usymtab_getRefQuiet (base->info->cvar->lexlevel, 
				     base->info->cvar->index);
	  break;

	default:
	  break;
	}  
    }

  return res;
}

/*
** lookup the current uentry corresponding to s, and return the corresponding sRef.
** yuk yuk yuk yuk yuk yuk yuk yuk
*/

/*@exposed@*/ sRef
sRef_updateSref (sRef s)
{
  sRef inner;
  sRef ret;
  sRef res;

  if (!sRef_isReasonable (s)) return sRef_undefined;
  
  switch (s->kind)
    {
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_NEW:
    case SK_TYPE:
    case SK_DERIVED:
    case SK_UNCONSTRAINED:
    case SK_CONST:
    case SK_SPECIAL:
    case SK_RESULT:
      return s; 
    case SK_EXTERNAL:
      {
	sRef r = sRef_updateSref (s->info->ref);

	if (r != s->info->ref)
	  {
	    return sRef_makeExternal (r);
	  }
	else
	  {
	    return s;
	  }
      }
    case SK_PARAM:
    case SK_CVAR:
      {
	uentry ue = sRef_getUentry (s);

	/* must be raw name!  (need the marker) */
	/* Must be in the correct scope! */

	ue = usymtab_lookupSafeScope (uentry_rawName (ue), sRef_lexLevel (s));
	
	if (uentry_isUndefined (ue))
	  {
	    return s;
	  }
	else
	  {
	    DPRINTF (("Update sref: %s", uentry_unparseFull (ue)));
	    return (uentry_getSref (ue));
	  }
      }
    case SK_ARRAYFETCH:
      /* special case if ind known */
      inner = s->info->arrayfetch->arr;
      ret = sRef_updateSref (inner);

      if (ret == inner) 
	{
	  res = s; 
	}
      else 
	{
	  res = sRef_makeArrayFetch (ret);
	}

      return res;

    case SK_FIELD:
      inner = s->info->field->rec;
      ret = sRef_updateSref (inner);

      if (ret == inner) 
	{
	  res = s; 
	}
      else 
	{
	  res = (sRef_makeField (ret, s->info->field->field));
	}

      return (res);
    case SK_PTR:
      inner = s->info->ref;
      ret = sRef_updateSref (inner);
      if (ret == inner) 
	{
	  res = s; 
	}
      else
	{
	  res = sRef_makePointer (ret);
	}

      return (res);

    case SK_ADR:
      inner = s->info->ref;
      ret = sRef_updateSref (inner);

      if (ret == inner)
	{
	  res = s; 
	}
      else 
	{
	  res = sRef_makeAddress (ret);
	}

      return (res);

    case SK_CONJ:
      {
	sRef innera = s->info->conj->a;
	sRef innerb = s->info->conj->b;
	sRef reta = sRef_updateSref (innera);
	sRef retb = sRef_updateSref (innerb);

	if (innera == reta && innerb == retb)
	  {
	    res = s;
	  }
	else 
	  {
	    res = sRef_makeConj (reta, retb);
	  }

	return (res);
      }
    }
  
  BADEXIT;
}

uentry
sRef_getUentry (sRef s)
{
  llassert (sRef_isReasonable (s));

  switch (s->kind)
    {
    case SK_PARAM:
      return (usymtab_getRefQuiet (paramsScope, usymId_fromInt (s->info->paramno)));
    case SK_CVAR:
      return (usymtab_getRefQuiet (s->info->cvar->lexlevel, s->info->cvar->index));
    case SK_CONJ:
      {
	if (sRef_isCvar (s->info->conj->a) || sRef_isParam (s->info->conj->a)
	    || sRef_isConj (s->info->conj->a))
	  {
	    return sRef_getUentry (s->info->conj->a);
	  }
	else 
	  {
	    return sRef_getUentry (s->info->conj->b);
	  }
      }
    case SK_FIELD: /* evans 2002-07-17: added case for SK_FIELD */
    case SK_UNKNOWN:
    case SK_SPECIAL:
      return uentry_undefined;
    BADDEFAULT;
    }
}

int
sRef_getParam (sRef s)
{
  llassert (sRef_isReasonable (s));
  llassert (s->kind == SK_PARAM);

  return s->info->paramno;
}

bool
sRef_isModified (sRef s)
{
    return (!sRef_isReasonable (s) || s->modified);
}

void sRef_setModified (sRef s)
{
  if (sRef_isReasonable (s))
    {
      s->modified = TRUE;

      
      if (sRef_isRefsField (s))
	{
	  sRef base = sRef_getBase (s);
	  
	  llassert (s->kind == SK_FIELD);
	  
	  if (sRef_isPointer (base))
	    {
	      base = sRef_getBase (base);
	    }
	  
	  if (sRef_isRefCounted (base))
	    {
	      base->aliaskind = AK_NEWREF;
	    }
	}
    }
}

/*
** note: this side-effects sRefSet to set modified to TRUE
** for any sRef similar to s.
*/

bool
sRef_canModifyVal (sRef s, sRefSet sl)
{
  if (context_getFlag (FLG_MUSTMOD))
    {
      return (sRef_doModifyVal (s, sl));
    }
  else
    {
      return (sRef_checkModifyVal (s, sl));
    }
}

bool
sRef_canModify (sRef s, sRefSet sl)
{
  if (context_getFlag (FLG_MUSTMOD))
    {
      return (sRef_doModify (s, sl));
    }
  else
    {
      return (sRef_checkModify (s, sl));
    }
}

/*
** No side-effects
*/

static
bool sRef_checkModifyVal (sRef s, sRefSet sl)
{
  DPRINTF (("Check modify val: %s", sRef_unparse (s)));

  if (sRef_isInvalid (s))
    {
      return TRUE;
    }
  
  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
    case SK_CONST:
      return TRUE;
    case SK_CVAR:
      DPRINTF (("Modify var: %s", sRef_unparse (s)));

      if (sRef_isFileOrGlobalScope (s))
	{
	  if (context_checkGlobMod (s))
	    {
	      return (sRefSet_member (sl, s));
	    }

	  return TRUE;
	}
      else
	{
	  return TRUE;
	}
    case SK_PARAM:
            return (sRefSet_member (sl, s) 
	      || alkind_isOnly (sRef_getOrigAliasKind (s)));
    case SK_ARRAYFETCH: 
      /* special case if ind known */
      return (sRefSet_member (sl, s) ||
	      sRef_checkModifyVal (s->info->arrayfetch->arr, sl));
    case SK_FIELD:
      return (sRefSet_member (sl, s) || sRef_checkModifyVal (s->info->field->rec, sl));
    case SK_PTR:
      return (sRefSet_member (sl, s) || sRef_checkModifyVal (s->info->ref, sl));
    case SK_ADR:
      return (sRefSet_member (sl, s) || sRef_checkModifyVal (s->info->ref, sl));
    case SK_CONJ:
      return ((sRef_checkModifyVal (s->info->conj->a, sl)) &&
	      (sRef_checkModifyVal (s->info->conj->b, sl)));
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_NEW:
    case SK_TYPE:
    case SK_DERIVED:
      return TRUE;
    case SK_EXTERNAL:
      return TRUE;
    case SK_SPECIAL:
      {
	switch (s->info->spec)
	  {
	  case SR_NOTHING:   return TRUE;
	  case SR_INTERNAL:  
	    if (context_getFlag (FLG_INTERNALGLOBS))
	      {
		return (sRefSet_member (sl, s));
	      }
	    else
	      {
		return TRUE;
	      }
	  case SR_SPECSTATE: return TRUE;
	  case SR_SYSTEM:    return (sRefSet_member (sl, s));
	  case SR_GLOBALMARKER: BADBRANCH;
	  }
      }
    case SK_RESULT: BADBRANCH;
    }
  BADEXIT;
}

/*
** this should probably be elsewhere...
**
** returns TRUE iff sl indicates that s can be modified
*/

static bool sRef_checkModify (sRef s, sRefSet sl)
{
  llassert (sRef_isReasonable (s));

  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
    case SK_CONST:
      return TRUE;
    case SK_CVAR:
      if (sRef_isFileOrGlobalScope (s))
	{
	  if (context_checkGlobMod (s))
	    {
	      return (sRefSet_member (sl, s));
	    }

	  return TRUE;
	}
      else
	{
	  return TRUE;
	}
    case SK_PARAM:
      return TRUE;
    case SK_ARRAYFETCH:
      return (sRefSet_member (sl, s) ||
	      sRef_checkModifyVal (s->info->arrayfetch->arr, sl));
    case SK_FIELD:
      {
	sRef sr = s->info->field->rec;

	if (sr->kind == SK_PARAM)
	  return TRUE; /* structs are copied on call */

	return (sRefSet_member (sl, s) || sRef_checkModifyVal (s->info->field->rec, sl));
      }
    case SK_PTR:
      {
	bool sm;

	sm = sRefSet_member (sl, s);

	if (sm)
	  return TRUE;
	else
	  return (sRef_checkModifyVal (s->info->ref, sl));
      }
    case SK_ADR:
      return (sRefSet_member (sl, s) || sRef_checkModifyVal (s->info->ref, sl));
    case SK_CONJ:
      return ((sRef_checkModify (s->info->conj->a, sl)) &&
	      (sRef_checkModify (s->info->conj->b, sl)));
    case SK_NEW:
    case SK_OBJECT:
    case SK_UNKNOWN:
    case SK_TYPE:
    case SK_DERIVED:
    case SK_EXTERNAL:
      return TRUE;
    case SK_SPECIAL:
      {
	switch (s->info->spec)
	  {
	  case SR_NOTHING:   return TRUE;
	  case SR_INTERNAL:  
	    if (context_getFlag (FLG_INTERNALGLOBS))
	      {
		return (sRefSet_member (sl, s));
	      }
	    else
	      {
		return TRUE;
	      }
	  case SR_SPECSTATE: return TRUE;
	  case SR_SYSTEM:    return (sRefSet_member (sl, s));
	  case SR_GLOBALMARKER: BADBRANCH;
	  }
      }
    case SK_RESULT: BADBRANCH;
    }
  BADEXIT;
}

cstring sRef_stateVerb (sRef s)
{
  if (sRef_isDead (s))
    {
      return cstring_makeLiteralTemp ("released");
    }
  else if (sRef_isKept (s))
    {
      return cstring_makeLiteralTemp ("kept");
    }
  else if (sRef_isDependent (s))
    {
      return cstring_makeLiteralTemp ("dependent");
    }
  else
    {
      BADEXIT;
    }
}

cstring sRef_stateAltVerb (sRef s)
{
  if (sRef_isDead (s))
    {
      return cstring_makeLiteralTemp ("live");
    }
  else if (sRef_isKept (s))
    {
      return cstring_makeLiteralTemp ("not kept");
    }
  else if (sRef_isDependent (s))
    {
      return cstring_makeLiteralTemp ("independent");
    }
  else
    {
      BADEXIT;
    }
}

static 
bool sRef_doModifyVal (sRef s, sRefSet sl)
{
  llassert (sRef_isReasonable (s));

  
  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
    case SK_CONST:
      return TRUE;
    case SK_CVAR:
      if (sRef_isFileOrGlobalScope (s))
	{
	  
	  if (context_checkGlobMod (s))
	    {
	      return (sRefSet_modifyMember (sl, s));
	    }
	  else
	    {
	      (void) sRefSet_modifyMember (sl, s);
	    }

	  	  return TRUE;
	}
      else
	{
	  return TRUE;
	}      
    case SK_PARAM:
      return (sRefSet_modifyMember (sl, s) 
	      || alkind_isOnly (sRef_getOrigAliasKind (s)));
    case SK_ARRAYFETCH:
      /* special case if ind known */
      /* unconditional OR, need side effect */
      return (OR (sRefSet_modifyMember (sl, s),
		  sRef_doModifyVal (s->info->arrayfetch->arr, sl)));
    case SK_FIELD:
      return (OR (sRefSet_modifyMember (sl, s),
		  sRef_doModifyVal (s->info->field->rec, sl)));
    case SK_PTR:
      return (OR (sRefSet_modifyMember (sl, s),
		  sRef_doModifyVal (s->info->ref, sl)));
    case SK_ADR:
      return (OR (sRefSet_modifyMember (sl, s),
		  sRef_doModifyVal (s->info->ref, sl)));
    case SK_CONJ:
      return (AND (sRef_doModifyVal (s->info->conj->a, sl) ,
		   sRef_doModifyVal (s->info->conj->b, sl)));
    case SK_OBJECT:
    case SK_DERIVED:
    case SK_EXTERNAL:
    case SK_UNKNOWN:
    case SK_NEW:
    case SK_TYPE:
      return TRUE;
    case SK_SPECIAL:
      {
	switch (s->info->spec)
	  {
	  case SR_NOTHING:   return TRUE;
	  case SR_INTERNAL:  
	    if (context_getFlag (FLG_INTERNALGLOBS))
	      {
		return (sRefSet_modifyMember (sl, s));
	      }
	    else
	      {
		(void) sRefSet_modifyMember (sl, s);
		return TRUE;
	      }
	  case SR_SPECSTATE: return TRUE;
	  case SR_SYSTEM:    return (sRefSet_modifyMember (sl, s));
	  case SR_GLOBALMARKER: BADBRANCH;

	  }
      }
    case SK_RESULT: BADBRANCH;
    }
  BADEXIT;
}

/*
** this should probably be elsewhere...
**
** returns TRUE iff sl indicates that s can be modified
*/

static 
bool sRef_doModify (sRef s, sRefSet sl)
{
  llassert (sRef_isReasonable (s));
  
  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
    case SK_CONST:
      return TRUE;
    case SK_CVAR:
      if (sRef_isFileOrGlobalScope (s))
	{
	  if (context_checkGlobMod (s))
	    {
	      return (sRefSet_modifyMember (sl, s));
	    }
	  else
	    {
	      (void) sRefSet_modifyMember (sl, s);
	    }

	  return TRUE;
	}
      else
	{
	  return TRUE;
	}
    case SK_PARAM:
      return TRUE;
    case SK_ARRAYFETCH:
            return (OR (sRefSet_modifyMember (sl, s),
		  sRef_doModifyVal (s->info->arrayfetch->arr, sl)));
    case SK_FIELD:
      {
	sRef sr = s->info->field->rec;

	if (sr->kind == SK_PARAM)
	  {
	    return TRUE; /* structs are shallow-copied on call */
	  }
	
	return (OR (sRefSet_modifyMember (sl, s),
		    sRef_doModifyVal (s->info->field->rec, sl)));
      }
    case SK_PTR:
      {
	return (OR (sRefSet_modifyMember (sl, s),
		    sRef_doModifyVal (s->info->ref, sl)));
      }
    case SK_ADR:
      return (OR (sRefSet_modifyMember (sl, s),
		  sRef_doModifyVal (s->info->ref, sl)));
    case SK_CONJ:
      return (AND (sRef_doModify (s->info->conj->a, sl),
		  (sRef_doModify (s->info->conj->b, sl))));
    case SK_UNKNOWN:
    case SK_NEW:
    case SK_TYPE:
      return TRUE;
    case SK_OBJECT:
    case SK_DERIVED:
    case SK_EXTERNAL:
      return TRUE;
    case SK_SPECIAL:
      {
	switch (s->info->spec)
	  {
	  case SR_NOTHING:   return TRUE;
	  case SR_INTERNAL:  return TRUE;
	  case SR_SPECSTATE: return TRUE;
	  case SR_SYSTEM:    return (sRefSet_modifyMember (sl, s));
	  case SR_GLOBALMARKER: BADBRANCH;
	  }
      }
    case SK_RESULT: BADBRANCH;
    }
  BADEXIT;
}

static /*@exposed@*/ sRef
  sRef_leastCommon (/*@exposed@*/ sRef s1, sRef s2)
{
  llassert (sRef_similar (s1, s2));
  
  if (!sRef_isReasonable (s1)) return s1;
  if (!sRef_isReasonable (s2)) return s1;

  sRef_combineDefState (s1, s2);
  sRef_combineNullState (s1, s2);
  sRef_combineExKinds (s1, s2);
  
  if (s1->aliaskind != s2->aliaskind)
    {
      if (s1->aliaskind == AK_UNKNOWN)
	{
	  s1->aliaskind = s2->aliaskind;
	}
      else if (s2->aliaskind == AK_UNKNOWN)
	{
	  ;
	}
      else
	{
	  s1->aliaskind = AK_ERROR;
	}
    }

  return s1;
}

int sRef_compare (sRef s1, sRef s2)
{
  if (s1 == s2) return 0;

  if (sRef_isInvalid (s1)) return -1;
  if (sRef_isInvalid (s2)) return 1;
      
  INTCOMPARERETURN (s1->kind, s2->kind);
  INTCOMPARERETURN (s1->defstate, s2->defstate);
  INTCOMPARERETURN (s1->aliaskind, s2->aliaskind);

  DPRINTF (("Compare null state: %s / %s",
	    sRef_unparseFull (s1),
	    sRef_unparseFull (s2)));

  COMPARERETURN (nstate_compare (sRef_getNullState (s1),
				 sRef_getNullState (s2)));

  switch (s1->kind)
    {
    case SK_PARAM:
      return (int_compare (s1->info->paramno, s2->info->paramno));
    case SK_ARRAYFETCH:
      {
	COMPARERETURN (sRef_compare (s1->info->arrayfetch->arr, 
				     s2->info->arrayfetch->arr));
	
	if (s1->info->arrayfetch->indknown && s2->info->arrayfetch->indknown)
	  {
	    return (int_compare (s1->info->arrayfetch->ind, 
				 s2->info->arrayfetch->ind));
	  }
	if (!s1->info->arrayfetch->indknown && !s2->info->arrayfetch->indknown)
	  return 0;
	
	return 1;
      }
    case SK_FIELD:
      {
	COMPARERETURN (sRef_compare (s1->info->field->rec, s2->info->field->rec));
	
	if (cstring_equal (s1->info->field->field, s2->info->field->field))
	  return 0;

	return 1;
      }
    case SK_PTR:
    case SK_ADR:
      return (sRef_compare (s1->info->ref, s2->info->ref));
    case SK_CONJ:
      COMPARERETURN (sRef_compare (s1->info->conj->a, s2->info->conj->a));
      return (sRef_compare (s1->info->conj->b, s2->info->conj->b));
    case SK_UNCONSTRAINED:
      return (cstring_compare (s1->info->fname, s2->info->fname));
    case SK_NEW:
    case SK_CVAR:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_TYPE:
    case SK_DERIVED:
    case SK_EXTERNAL:
    case SK_CONST:
    case SK_RESULT:
      return 0;
    case SK_SPECIAL:
      return (generic_compare (s1->info->spec, s2->info->spec));
    }
  BADEXIT;
}

static bool cref_equal (cref c1, cref c2)
{
  return ((c1->lexlevel == c2->lexlevel) &&
	  (usymId_equal (c1->index, c2->index)));
}

/*
** returns true if s1 could be the same storage as s2.
** i.e., a[?] ~ a[3].  Note its not symmetric ... s1
** should be more specific.
*/

/*
** like similar, but matches objects <-> non-objects
*/

static bool 
sRef_uniqueReference (sRef s)
{
  return (sRef_isFresh (s) || sRef_isUnique (s) 
	  || sRef_isOnly (s) || sRef_isStack (s)
	  || sRef_isAddress (s)); 
}

static bool
sRef_similarRelaxedAux (sRef s1, sRef s2)
{
  if (s1 == s2)
    {
      if (sRef_isUnknownArrayFetch (s1))
	{
	  return FALSE;
	}
      else
	{
	  return TRUE;
	}
    }

  if (sRef_isInvalid (s1) || sRef_isInvalid (s2)) return FALSE;

  if (sRef_isConj (s2)) 
    return (sRef_similarRelaxedAux (s1, sRef_getConjA (s2)) ||
	    sRef_similarRelaxedAux (s1, sRef_getConjB (s2)));

  switch (s1->kind)
    {
    case SK_CVAR:
      return ((s2->kind == SK_CVAR)
	      && (cref_equal (s1->info->cvar, s2->info->cvar)));
    case SK_PARAM:
      return ((s2->kind == SK_PARAM)
	      && (s1->info->paramno == s2->info->paramno));
    case SK_ARRAYFETCH:
      if (s2->kind == SK_ARRAYFETCH)
	{
	  if (sRef_similarRelaxedAux (s1->info->arrayfetch->arr,
				      s2->info->arrayfetch->arr))
	    {
	      if (s1->info->arrayfetch->indknown)
		{
		  if (s2->info->arrayfetch->indknown)
		    {
		      return (s1->info->arrayfetch->ind == s2->info->arrayfetch->ind);
		    }
		  else 
		    {
		      return FALSE;
		    }
		}
	      else
		{
		  return FALSE;
		}
	    }
	}
      return FALSE;
    case SK_FIELD:
      return ((s2->kind == SK_FIELD
	       && (sRef_similarRelaxedAux (s1->info->field->rec,
					   s2->info->field->rec)
		   && cstring_equal (s1->info->field->field,
				     s2->info->field->field))));
    case SK_PTR:
      return ((s2->kind == SK_PTR)
	      && sRef_similarRelaxedAux (s1->info->ref, s2->info->ref));
    case SK_ADR:
      return ((s2->kind == SK_ADR)
	      && sRef_similarRelaxedAux (s1->info->ref, s2->info->ref));
    case SK_CONJ:
      return ((sRef_similarRelaxedAux (s1->info->conj->a, s2) ||
	      (sRef_similarRelaxedAux (s1->info->conj->b, s2))));
    case SK_SPECIAL:
      return (s1->info->spec == s2->info->spec);
    case SK_UNCONSTRAINED:
      return (cstring_equal (s1->info->fname, s2->info->fname));
    case SK_DERIVED:
    case SK_CONST:
    case SK_TYPE:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_EXTERNAL:
    case SK_RESULT:
      return FALSE;
    }
  BADEXIT;
}

bool
sRef_similarRelaxed (sRef s1, sRef s2)
{
  bool us1, us2;

  if (s1 == s2) 
    {
      if (sRef_isThroughArrayFetch (s1))
	{
	  return FALSE;
	}
      else
	{
	  return TRUE;
	}
    }

  if (sRef_isInvalid (s1) || sRef_isInvalid (s2)) return FALSE;

  us1 = sRef_uniqueReference (s1);
  us2 = sRef_uniqueReference (s2);

  if ((s1->kind == SK_EXTERNAL && (s2->kind != SK_EXTERNAL && !us2))
      || (s2->kind == SK_EXTERNAL && (s1->kind != SK_EXTERNAL && !us1)))
    {
      /*
      ** Previously, also:
      **   || (sRef_isExposed (s1) && !us2) || (sRef_isExposed (s2) && !us1)) ???? 
      **
      ** No clue why this was there?!
      */


      if (sRef_isExposed (s1) && sRef_isCvar (s1))
	{
	  uentry ue1 = sRef_getUentry (s1);

	  if (uentry_isRefParam (ue1))
	    {
	      return sRef_similarRelaxedAux (s1, s2);
	    }
	}
      
      if (sRef_isExposed (s2) && sRef_isCvar (s2))
	{
	  uentry ue2 = sRef_getUentry (s2);

	  if (uentry_isRefParam (ue2))
	    {
	      return sRef_similarRelaxedAux (s1, s2);
	    }
	}
      
            return (ctype_match (s1->type, s2->type));
    }
  else
    {
            return sRef_similarRelaxedAux (s1, s2);
    }
}

bool
sRef_similar (sRef s1, sRef s2)
{
  if (s1 == s2) return TRUE;
  if (sRef_isInvalid (s1) || sRef_isInvalid (s2)) return FALSE;

  if (sRef_isConj (s2)) 
    {
      return (sRef_similar (s1, sRef_getConjA (s2)) ||
	      sRef_similar (s1, sRef_getConjB (s2)));
    }

  if (sRef_isDerived (s2))
   {
     return (sRef_includedBy (s1, s2->info->ref));
   }

  switch (s1->kind)
    {
    case SK_CVAR:
      return ((s2->kind == SK_CVAR)
	      && (cref_equal (s1->info->cvar, s2->info->cvar)));
    case SK_PARAM:
      return ((s2->kind == SK_PARAM)
	      && (s1->info->paramno == s2->info->paramno));
    case SK_ARRAYFETCH:
      if (s2->kind == SK_ARRAYFETCH)
	{
	  if (sRef_similar (s1->info->arrayfetch->arr,
			    s2->info->arrayfetch->arr))
	    {
	      if (s1->info->arrayfetch->indknown)
		{
		  if (s2->info->arrayfetch->indknown)
		    {
		      return (s1->info->arrayfetch->ind == s2->info->arrayfetch->ind);
		    }
		  else 
		    {
		      return TRUE;
		    }
		}
	      else
		{
		  return TRUE;
		}
	    }
	}
      else 
	{
	  if (s2->kind == SK_PTR)
	    {
	      if (sRef_similar (s1->info->arrayfetch->arr,
				s2->info->ref))
		{
		  return TRUE; 
		}
	    }
	}

      return FALSE;
    case SK_FIELD:
      return ((s2->kind == SK_FIELD
	       && (sRef_similar (s1->info->field->rec,
				 s2->info->field->rec)
		   && cstring_equal (s1->info->field->field,
				     s2->info->field->field))));
    case SK_PTR:
      if (s2->kind == SK_PTR)
	{
	  return sRef_similar (s1->info->ref, s2->info->ref);
	}
      else 
	{
	  if (s2->kind == SK_ARRAYFETCH)
	    {
	      if (sRef_similar (s2->info->arrayfetch->arr,
				s1->info->ref))
		{
		  return TRUE; 
		}
	    }
	}

      return FALSE;
    case SK_ADR:
      return ((s2->kind == SK_ADR)
	      && sRef_similar (s1->info->ref, s2->info->ref));
    case SK_CONJ:
      return ((sRef_similar (s1->info->conj->a, s2) ||
	      (sRef_similar (s1->info->conj->b, s2))));
    case SK_DERIVED:
      return (sRef_includedBy (s2, s1->info->ref));
    case SK_UNCONSTRAINED:
      return (s2->kind == SK_UNCONSTRAINED
	      && cstring_equal (s1->info->fname, s2->info->fname));
    case SK_CONST:
    case SK_TYPE:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_EXTERNAL:
    case SK_RESULT:
      return FALSE;
    case SK_SPECIAL:
      return (s2->kind == SK_SPECIAL 
	      && (s1->info->spec == s2->info->spec));
    }

  /*@notreached@*/ DPRINTF (("Fell through for: %s / %s", sRef_unparse (s1), sRef_unparse (s2)));
  BADEXIT;
}

/*
** return TRUE iff small can be derived from big.
**
** (e.g. x, x.a is includedBy x;
**       x.a is included By x.a;
*/

bool
sRef_includedBy (sRef small, sRef big)
{
  if (small == big) return TRUE;
  if (sRef_isInvalid (small) || sRef_isInvalid (big)) return FALSE;

  if (sRef_isConj (big)) 
    return (sRef_similar (small, sRef_getConjA (big)) ||
	    sRef_similar (small, sRef_getConjB (big)));

  switch (small->kind)
    {
    case SK_CVAR:
    case SK_PARAM:
      return (sRef_same (small, big));
    case SK_ARRAYFETCH:
      if (big->kind == SK_ARRAYFETCH)
	{
	  if (sRef_same (small->info->arrayfetch->arr, big->info->arrayfetch->arr))
	    {
	      if (small->info->arrayfetch->indknown)
		{
		  if (big->info->arrayfetch->indknown)
		    {
		      return (small->info->arrayfetch->ind == big->info->arrayfetch->ind);
		    }
		  else 
		    {
		      return TRUE;
		    }
		}
	      else
		{
		  return TRUE;
		}
	    }
	}
      return (sRef_includedBy (small->info->arrayfetch->arr, big));
    case SK_FIELD:
      if (big->kind == SK_FIELD)
	{
	  return 
	    (sRef_same (small->info->field->rec, big->info->field->rec) &&
	     cstring_equal (small->info->field->field, big->info->field->field));
	}
      else
	{
	  return (sRef_includedBy (small->info->field->rec, big));
	}

    case SK_PTR:
      if (big->kind == SK_PTR)
	{
	  return sRef_same (small->info->ref, big->info->ref);
	}
      else
	{
	  return (sRef_includedBy (small->info->ref, big));
	}

    case SK_ADR:
      return ((big->kind == SK_ADR) && sRef_similar (small->info->ref, big->info->ref));
    case SK_CONJ:
      return ((sRef_includedBy (small->info->conj->a, big) ||
	      (sRef_includedBy (small->info->conj->b, big))));
    case SK_DERIVED:
      return (sRef_includedBy (small->info->ref, big));
    case SK_UNCONSTRAINED:
    case SK_CONST:
    case SK_TYPE:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_EXTERNAL:
    case SK_RESULT:
      return FALSE;
    case SK_SPECIAL:
      switch (small->info->spec)
	{
	case SR_NOTHING: return TRUE;
	case SR_SPECSTATE:
	case SR_INTERNAL: return (sRef_isSpecInternalState (big) ||
				  sRef_isFileStatic (big));
	case SR_SYSTEM: return (sRef_isSystemState (big));
	case SR_GLOBALMARKER: BADBRANCH;
	}
    }
  BADEXIT;
}

/*
** Same is similar to similar, but not quite the same. 
** same and realSame aren't the same, but they are really similar.
** similarly, same is the same as same. but realSame is
** not really the same as same, or similar to similar.
**
** Similarly to similar, same checks if two sRefs are the same.
** The similarities end, however, when same compares arrays
** with unknown indexes.  Similar returns false; same returns true.
**
** Similarly to similar and same, realSame is the same as same,
** except they do not behave the same when face with unknown
** sRefs.  Same thinks they are not the same, but realSame thinks
** the are.
**
*/

bool
sRef_realSame (sRef s1, sRef s2)
{
  if (s1 == s2) return TRUE;
  
  if (sRef_isUnreasonable (s1) 
      || sRef_isUnreasonable (s2)) 
    {
      return FALSE;
    }

  switch (s1->kind)
    {
    case SK_CVAR:
      return ((s2->kind == SK_CVAR) && (cref_equal (s1->info->cvar, s2->info->cvar)));
    case SK_PARAM:
      return ((s2->kind == SK_PARAM) && (s1->info->paramno == s2->info->paramno));
    case SK_ARRAYFETCH:
      if (s2->kind == SK_ARRAYFETCH)
	{
	  if (sRef_realSame (s1->info->arrayfetch->arr, s2->info->arrayfetch->arr))
	    {
	      if (s1->info->arrayfetch->indknown && s2->info->arrayfetch->indknown)
		{
		  return (s1->info->arrayfetch->ind == s2->info->arrayfetch->ind);
		}
	      if (!s1->info->arrayfetch->indknown && !s2->info->arrayfetch->indknown)
		{
		  return TRUE;
		}
	      return FALSE;
	    }
	}
      return FALSE;
    case SK_FIELD:
      return ((s2->kind == SK_FIELD &&
	       (sRef_realSame (s1->info->field->rec, s2->info->field->rec) &&
		cstring_equal (s1->info->field->field, s2->info->field->field))));
    case SK_PTR:
      return ((s2->kind == SK_PTR) && sRef_realSame (s1->info->ref, s2->info->ref));
    case SK_ADR:
      return ((s2->kind == SK_ADR) && sRef_realSame (s1->info->ref, s2->info->ref));
    case SK_CONJ:
      return ((sRef_realSame (s1->info->conj->a, s2) ||
	      (sRef_realSame (s1->info->conj->b, s2))));
    case SK_OBJECT:
      return ((s2->kind == SK_OBJECT) 
	      && ctype_match (s1->info->object, s2->info->object));
    case SK_EXTERNAL:
      return ((s2->kind == SK_EXTERNAL) 
	      && sRef_realSame (s1->info->ref, s2->info->ref));
    case SK_SPECIAL:
      return ((s2->kind == SK_SPECIAL) && s1->info->spec == s2->info->spec);
    case SK_DERIVED:
      return ((s2->kind == SK_DERIVED) && sRef_realSame (s1->info->ref, s2->info->ref));
    case SK_UNCONSTRAINED:
      return ((s2->kind == SK_UNCONSTRAINED) 
	      && (cstring_equal (s1->info->fname, s2->info->fname)));
    case SK_TYPE:
    case SK_CONST:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_RESULT:
      return TRUE; /* changed this! was false */
    }
  BADEXIT;
}

bool
sRef_sameObject (sRef s1, sRef s2)
{
  return (s1 == s2);
}

/*
** same is similar to similar, but not quite the same. 
**
** Similarly to similar, same checks is two sRefs are the same.
** The similarities end, however, when same compares arrays
** with unknown indexes.  Similar returns false; same returns true.
*/

bool
sRef_same (sRef s1, sRef s2)
{
  if (s1 == s2) return TRUE;
  if (sRef_isInvalid (s1) || sRef_isInvalid (s2)) return FALSE;

  switch (s1->kind)
    {
    case SK_CVAR:
      return ((s2->kind == SK_CVAR) && (cref_equal (s1->info->cvar, s2->info->cvar)));
    case SK_PARAM:
      return ((s2->kind == SK_PARAM) && (s1->info->paramno == s2->info->paramno));
    case SK_ARRAYFETCH:
      if (s2->kind == SK_ARRAYFETCH)
	{
	  llassert (s1->info->field->rec != s1);
	  if (sRef_same (s1->info->arrayfetch->arr, s2->info->arrayfetch->arr))
	    {
	      if (s1->info->arrayfetch->indknown && s2->info->arrayfetch->indknown)
		{
		  return (s1->info->arrayfetch->ind == s2->info->arrayfetch->ind);
		}
	      return TRUE;
	    }
	}
      return FALSE;
    case SK_FIELD:
      {
	llassert (s1->info->field->rec != s1);
	return ((s2->kind == SK_FIELD &&
		 (sRef_same (s1->info->field->rec, s2->info->field->rec) &&
		  cstring_equal (s1->info->field->field, s2->info->field->field))));
      }
    case SK_PTR:
      {
	llassert (s1->info->ref != s1);
	return ((s2->kind == SK_PTR) && sRef_same (s1->info->ref, s2->info->ref));
      }
    case SK_ADR:
      {
	llassert (s1->info->ref != s1);
	return ((s2->kind == SK_ADR) && sRef_same (s1->info->ref, s2->info->ref));
      }
    case SK_CONJ:
      llassert (s1->info->conj->a != s1);
      llassert (s1->info->conj->b != s1);
      return ((sRef_same (s1->info->conj->a, s2)) && /* or or and? */
	      (sRef_same (s1->info->conj->b, s2)));
    case SK_SPECIAL:
      return ((s2->kind == SK_SPECIAL) && s1->info->spec == s2->info->spec);
    case SK_DERIVED:
      llassert (s1->info->ref != s1);
      return ((s2->kind == SK_DERIVED) && sRef_same (s1->info->ref, s2->info->ref));
    case SK_CONST:
    case SK_UNCONSTRAINED:
    case SK_TYPE:
    case SK_UNKNOWN:
    case SK_NEW:
    case SK_OBJECT:
    case SK_EXTERNAL:
    case SK_RESULT:
      return FALSE; 
    }
  BADEXIT;
}

/*
** sort of similar, for use in def/use
*/

static bool
sRef_closeEnough (sRef s1, sRef s2)
{
  if (s1 == s2) return TRUE;
  if (sRef_isInvalid (s1) || sRef_isInvalid (s2)) return FALSE;

  switch (s1->kind)
    {
    case SK_CVAR:
      return (((s2->kind == SK_CVAR) &&
	       (cref_equal (s1->info->cvar, s2->info->cvar))) ||
	      (s2->kind == SK_UNCONSTRAINED && s1->info->cvar->lexlevel == 0));
    case SK_UNCONSTRAINED:
      return (s2->kind == SK_UNCONSTRAINED
	      || ((s2->kind == SK_CVAR) && (s2->info->cvar->lexlevel == 0)));
    case SK_PARAM:
      return ((s2->kind == SK_PARAM) 
	      && (s1->info->paramno == s2->info->paramno));
    case SK_ARRAYFETCH:
      if (s2->kind == SK_ARRAYFETCH)
	{
	  if (sRef_closeEnough (s1->info->arrayfetch->arr, s2->info->arrayfetch->arr))
	    {
	      if (s1->info->arrayfetch->indknown && s2->info->arrayfetch->indknown)
		{
		  return (s1->info->arrayfetch->ind == s2->info->arrayfetch->ind);
		}
	      return TRUE;
	    }
	}
      return FALSE;
    case SK_FIELD:
      return ((s2->kind == SK_FIELD &&
	       (sRef_closeEnough (s1->info->field->rec, s2->info->field->rec) &&
		cstring_equal (s1->info->field->field, s2->info->field->field))));
    case SK_PTR:
      return ((s2->kind == SK_PTR) && sRef_closeEnough (s1->info->ref, s2->info->ref));
    case SK_ADR:
      return ((s2->kind == SK_ADR) && sRef_closeEnough (s1->info->ref, s2->info->ref));
    case SK_DERIVED:
      return ((s2->kind == SK_DERIVED) && sRef_closeEnough (s1->info->ref, s2->info->ref));
    case SK_CONJ:
      return ((sRef_closeEnough (s1->info->conj->a, s2)) ||
	      (sRef_closeEnough (s1->info->conj->b, s2)));
    case SK_SPECIAL:
      return ((s2->kind == SK_SPECIAL) && s1->info->spec == s2->info->spec);
    case SK_TYPE:
    case SK_CONST:
    case SK_UNKNOWN:
    case SK_NEW:
    case SK_OBJECT:
    case SK_EXTERNAL:
    case SK_RESULT:

      return FALSE;
    }
  BADEXIT;
}

/*
  drl add 12/24/2000
  s is an sRef of a formal paramenter in a function call constraint
  we trys to return a constraint expression derived from the actual parementer of a function call.
*/

/*@only@*/ constraintExpr sRef_fixConstraintParam (/*@observer@*/  sRef s, /*@observer@*/ /*@temp@*/ exprNodeList args)
{
  constraintExpr ce;

  if (sRef_isInvalid (s))
    llfatalbug((message("Invalid sRef")));

  switch (s->kind)
    {
    case SK_RESULT:
      {
	ce = constraintExpr_makeTermsRef (s);
	return ce;
      }
    case SK_FIELD:
      {
	sRef temp;
	
	temp = (sRef_makeField (sRef_fixBaseParam (s->info->field->rec, args),
			      s->info->field->field));
	ce = constraintExpr_makeTermsRef (temp);
	return ce;
      }
    case SK_PTR:
      {
	sRef temp;
	temp = (sRef_makePointer (sRef_fixBaseParam (s->info->ref, args)));
	ce = constraintExpr_makeTermsRef (temp);
	return ce;
      }

    case SK_ARRAYFETCH:
       {
	sRef temp;
	temp = sRef_saveCopy(s);
	temp = sRef_fixBaseParam (temp, args);
	ce = constraintExpr_makeTermsRef (temp);

	sRef_free(temp);
	return ce;
      }
    case SK_CVAR:
      {
	sRef temp;
	temp = sRef_saveCopy(s);
	ce = constraintExpr_makeTermsRef (temp);
	sRef_free(temp);
	return ce;
      }
    case SK_PARAM:
      {
	exprNode e;
	llassert (exprNodeList_size (args) > s->info->paramno);
	e = exprNodeList_nth (args, s->info->paramno);
	
	llassert (!(exprNode_isError (e)));
	ce = constraintExpr_makeExprNode (e);
	return ce;
      }

    default:
      {
	sRef temp;
	llcontbug (message ("Trying to do fixConstraintParam on nonparam, nonglobal: %q for function with arguments %q",
			    sRef_unparse (s), exprNodeList_unparse(args)));
      temp = sRef_saveCopy(s);
      ce = constraintExpr_makeTermsRef (temp);

      sRef_free(temp);
      return ce;
      }
    }
}

/*@exposed@*/ sRef
sRef_fixBaseParam (/*@returned@*/ sRef s, exprNodeList args)
{
  if (sRef_isInvalid (s)) return (sRef_undefined);

  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
    case SK_CVAR:
      return s;
    case SK_PARAM:
      {
	if (exprNodeList_size (args) > s->info->paramno)
	  {
	    exprNode e = exprNodeList_nth (args, s->info->paramno);

	    if (exprNode_isError (e))
	      {
		return sRef_makeUnknown ();
	      }
	    
	    return (exprNode_getSref (e));
	  }
	else
	  {
	    return sRef_makeUnknown ();
	  }
      }
    case SK_ARRAYFETCH:

      if (s->info->arrayfetch->indknown)
	{
	  return (sRef_makeArrayFetchKnown 
		  (sRef_fixBaseParam (s->info->arrayfetch->arr, args),
		   s->info->arrayfetch->ind));
	}
      else
	{
	  return (sRef_makeArrayFetch 
		  (sRef_fixBaseParam (s->info->arrayfetch->arr, args)));
	}
    case SK_FIELD:
      {
	sRef res;
	DPRINTF (("Fix field: %s", sRef_unparseFull (s)));
	res = sRef_makeField (sRef_fixBaseParam (s->info->field->rec, args),
			      s->info->field->field);
	DPRINTF (("Returns: %s", sRef_unparseFull (res)));
	return res;
      }
    case SK_PTR:
      return (sRef_makePointer (sRef_fixBaseParam (s->info->ref, args)));

    case SK_ADR:
      return (sRef_makeAddress (sRef_fixBaseParam (s->info->ref, args)));

    case SK_CONJ:
      return (sRef_makeConj (sRef_fixBaseParam (s->info->conj->a, args),
			     sRef_fixBaseParam (s->info->conj->b, args)));
    case SK_DERIVED:
    case SK_SPECIAL:
    case SK_TYPE:
    case SK_CONST:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_EXTERNAL:
    case SK_RESULT:
      return s;
    }
  BADEXIT;
}

/*@exposed@*/ sRef
sRef_undumpGlobal (char **c)
{
  char p = **c;

  (*c)++;

  switch (p)
    {
    case 'g':
      {
	usymId uid = usymId_fromInt (reader_getInt (c));
	sstate defstate;
	nstate nullstate;
	sRef ret;

	reader_checkChar (c, '@');
	defstate = sstate_fromInt (reader_getInt (c));

	reader_checkChar (c, '@');
	nullstate = nstate_fromInt (reader_getInt (c));

	ret = sRef_makeGlobal (uid, ctype_unknown, stateInfo_currentLoc ());
	sRef_setNullStateN (ret, nullstate);
	ret->defstate = defstate;
	return ret;
      }
    case 's':
      {
	int i = reader_getInt (c);
	speckind sk = speckind_fromInt (i);

	switch (sk)
	  {
	  case SR_NOTHING:   return (sRef_makeNothing ());
	  case SR_INTERNAL:  return (sRef_makeInternalState ());
	  case SR_SPECSTATE: return (sRef_makeSpecState ());
	  case SR_SYSTEM:    return (sRef_makeSystemState ());
	  case SR_GLOBALMARKER: BADBRANCH;
	  }
	BADEXIT;
      }
    case '-':
      return sRef_undefined;
    case 'u':
      return sRef_makeUnknown ();
    case 'x':
      return sRef_makeUnknown ();
    default:
      llfatalerror (message ("sRef_undumpGlobal: bad line: %s",
			     cstring_fromChars (*c)));
    }
  BADEXIT;
}

static /*@exposed@*/ sRef sRef_undumpBody (char **c)
{
  char p = **c;

  (*c)++;

  switch (p)
    {
    case 'g':
      return (sRef_makeGlobal (usymId_fromInt (reader_getInt (c)), 
			       ctype_unknown, stateInfo_currentLoc ()));
    case 'p':
      return (sRef_makeParam (reader_getInt (c), ctype_unknown, 
			      stateInfo_makeLoc (g_currentloc, SA_DECLARED)));
    case 'r':
      return (sRef_makeResult (ctype_undump (c)));
    case 'a':
      {
	if ((**c >= '0' && **c <= '9') || **c == '-')
	  {
	    int i = reader_getInt (c);
	    sRef arr = sRef_undump (c);
	    sRef ret = sRef_buildArrayFetchKnown (arr, i);

	    return ret;
	  }
	else
	  {
	    sRef arr = sRef_undump (c);
	    sRef ret = sRef_buildArrayFetch (arr);

	    return ret;
	  }
      }
    case 'f':
      {
	cstring fname = cstring_undefined;
	sRef ret;

	while (**c != '.')
	  {
	    fname = cstring_appendChar (fname, **c);
	    (*c)++;
	  }
	(*c)++;

	ret = sRef_buildField (sRef_undump (c), fname);
	cstring_markOwned (fname);
	return (ret);
      }
    case 's':
      {
	int i = reader_getInt (c);
	speckind sk = speckind_fromInt (i);

	switch (sk)
	  {
	  case SR_NOTHING:   return (sRef_makeNothing ());
	  case SR_INTERNAL:  return (sRef_makeInternalState ());
	  case SR_SPECSTATE: return (sRef_makeSpecState ());
	  case SR_SYSTEM:    return (sRef_makeSystemState ());
	  case SR_GLOBALMARKER: BADBRANCH;
	  }
	BADEXIT;
      }
    case 't':
      {
	sRef ptr = sRef_undump (c);
	sRef ret = sRef_makePointer (ptr);

	return (ret);
      }
    case 'd':
      {
	sRef adr = sRef_undump (c);
	sRef ret = sRef_makeAddress (adr);

	return (ret);
      }
    case 'o':
      {
	return (sRef_makeObject (ctype_undump (c)));
      }
    case 'c':
      {
	sRef s1 = sRef_undump (c);
	sRef s2 = ((*c)++, sRef_undump (c));
	sRef ret = sRef_makeConj (s1, s2);

	return (ret);
      }
    case '-':
      return sRef_undefined;
    case 'u':
      return sRef_makeUnknown ();
    case 'x':
      return sRef_makeUnknown ();
    default:
      llfatalerror (message ("sRef_undump: bad line: %s", cstring_fromChars (*c)));
    }
  BADEXIT;
}

/*@exposed@*/ sRef sRef_undump (char **c)
{
  sRef res = sRef_undumpBody (c);

  if (reader_optCheckChar (c, '='))
    {
      multiVal mv = multiVal_undump (c);
      sRef_setValue (res, mv);
      reader_checkChar (c, '=');
    }

  return res;
}

static /*@only@*/ cstring sRef_dumpBody (sRef s)
{
  if (sRef_isInvalid (s))
    {
      return (cstring_makeLiteral ("-"));
    }
  else
    {
      switch (s->kind)
	{
	case SK_PARAM:
	  return (message ("p%d", s->info->paramno));
	case SK_ARRAYFETCH:
	  if (s->info->arrayfetch->indknown)
	    {
	      return (message ("a%d%q", s->info->arrayfetch->ind,
			       sRef_dump (s->info->arrayfetch->arr)));
	    }
	  else
	    {
	      return (message ("a%q", sRef_dump (s->info->arrayfetch->arr)));
	    }
	case SK_FIELD:
	  return (message ("f%s.%q", s->info->field->field, 
			   sRef_dump (s->info->field->rec)));
	case SK_PTR:
	  return (message ("t%q", sRef_dump (s->info->ref)));
	case SK_ADR:
	  return (message ("d%q", sRef_dump (s->info->ref)));
	case SK_OBJECT:
	  return (message ("o%q", ctype_dump (s->info->object)));
	case SK_SPECIAL:
	  return (message ("s%d", (int) s->info->spec));
	case SK_CONJ:
	  return (message ("c%q.%q",
			   sRef_dump (s->info->conj->a),
			   sRef_dump (s->info->conj->b)));
	case SK_CVAR:
	  if (sRef_isFileOrGlobalScope (s))
	    {
	      return (message ("g%d", 
			       usymtab_convertId (s->info->cvar->index)));
	    }
	  else
	    {
	      llcontbug (message ("Dumping local variable: %q",
				  sRef_unparseDebug (s)));
	      return (cstring_makeLiteral ("u"));
	    }
	case SK_UNKNOWN:
	  return (cstring_makeLiteral ("u"));
	case SK_RESULT:
	  return (message ("r%q", ctype_dump (s->type)));
	case SK_TYPE:
	case SK_CONST:
	case SK_EXTERNAL:
	case SK_DERIVED:
	case SK_NEW:
	case SK_UNCONSTRAINED:
	  llcontbug (message ("sRef_dump: bad kind: %q",
			      sRef_unparseFull (s)));
	  return (cstring_makeLiteral ("x"));
	}
    }
     
  BADEXIT;
}

/*@only@*/ cstring sRef_dump (sRef s)
{
  cstring res = sRef_dumpBody (s);

  if (sRef_hasValue (s))
    {
      res = message ("%q=%q=", res, multiVal_dump (sRef_getValue (s)));
    }

  return res;
}

cstring sRef_dumpGlobal (sRef s)
{
  llassert (!sRef_hasValue (s));

  if (sRef_isInvalid (s))
    {
      return (cstring_makeLiteral ("-"));
    }
  else
    {
      switch (s->kind)
	{
	case SK_CVAR:
	  if (sRef_isFileOrGlobalScope (s))
	    {
	      return (message ("g%d@%d@%d", 
			       usymtab_convertId (s->info->cvar->index),
			       (int) s->defstate,
			       (int) sRef_getNullState (s)));
	    }
	  else
	    {
	      llcontbug (message ("Dumping local variable: %q",
				  sRef_unparseDebug (s)));
	      return (cstring_makeLiteral ("u"));
	    }
	case SK_UNKNOWN:
	  return (cstring_makeLiteral ("u"));
	case SK_SPECIAL:
	  return (message ("s%d", (int) s->info->spec));
	default:
	  llcontbug (message ("sRef_dumpGlobal: bad kind: %q",
			      sRef_unparseFull (s)));
	  return (cstring_makeLiteral ("x"));
	}
    }
     
  BADEXIT;
}

ctype
sRef_deriveType (sRef s, uentryList cl)
{
  if (sRef_isInvalid (s)) return ctype_unknown;

  switch (s->kind)
    {
    case SK_CVAR:
      return (uentry_getType (usymtab_getRefQuiet (s->info->cvar->lexlevel, 
					      s->info->cvar->index)));
    case SK_UNCONSTRAINED:
      return (ctype_unknown);
    case SK_PARAM:
      if (s->info->paramno >= 0) 
	{
	  return uentry_getType (uentryList_getN (cl, s->info->paramno));
	}
      else
	{
	  return ctype_unknown;
	}
    case SK_ARRAYFETCH:
      {
	ctype ca = sRef_deriveType (s->info->arrayfetch->arr, cl);
	
	if (ctype_isArray (ca))
	  {
	    return (ctype_baseArrayPtr (ca));
	  }
	else if (ctype_isUnknown (ca))
	  {
	    return (ca);
	  }
	else
	  {
	    llcontbuglit ("sRef_deriveType: inconsistent array type");
	    return ca;
	  }
      }
    case SK_FIELD:
      {
	ctype ct = sRef_deriveType (s->info->field->rec, cl);
	
	if (ctype_isStructorUnion (ct))
	  {
	    uentry ue = uentryList_lookupField (ctype_getFields (ct), 
					       s->info->field->field);
	    
	    if (uentry_isValid (ue))
	      {
		return (uentry_getType (ue));
	      }
	    else
	      {
		llcontbuglit ("sRef_deriveType: bad field");
		return ctype_unknown;
	      }
	  }
	else if (ctype_isUnknown (ct))
	  {
	    return (ct);
	  }
	else
	  {
	    llcontbuglit ("sRef_deriveType: inconsistent field type");
	    return (ct);
	  }
      }
    case SK_PTR:
      {
	ctype ct = sRef_deriveType (s->info->ref, cl);
	
	if (ctype_isUnknown (ct)) return ct;
	if (ctype_isPointer (ct)) return (ctype_baseArrayPtr (ct));
	else
	  {
	    llcontbuglit ("sRef_deriveType: inconsistent pointer type");
	    return (ct);
	  }
      }
    case SK_ADR:
      {
	ctype ct = sRef_deriveType (s->info->ref, cl);
	
	if (ctype_isUnknown (ct)) return ct;
	return ctype_makePointer (ct);
      }
    case SK_DERIVED:
      {
	return sRef_deriveType (s->info->ref, cl);
      }
    case SK_OBJECT:
      {
	return (s->info->object);
      }
    case SK_CONJ:
      {
	return (ctype_makeConj (sRef_deriveType (s->info->conj->a, cl),
			       sRef_deriveType (s->info->conj->b, cl)));
      }
    case SK_RESULT:
    case SK_CONST:
    case SK_TYPE:
      {
	return (s->type);
      }
    case SK_SPECIAL:
    case SK_UNKNOWN:
    case SK_EXTERNAL:
    case SK_NEW:
      return ctype_unknown;
    }
  BADEXIT;
}

ctype
sRef_getType (sRef s)
{
  if (sRef_isInvalid (s)) return ctype_unknown;
  return s->type;
}


/*@only@*/ cstring
sRef_unparseOpt (sRef s)
{
  sRef rb = sRef_getRootBase (s);

  if (sRef_isMeaningful (rb) && !sRef_isConst (rb))
    {
      cstring ret = sRef_unparse (s);
      
      llassertprint (!cstring_equalLit (ret, "?"), ("print: %s", sRef_unparseDebug (s)));

      if (!cstring_isEmpty (ret))
	{
	  return (cstring_appendChar (ret, ' '));
	}
      else
	{
	  return ret;
	}
    }

  return cstring_undefined;
}

cstring
sRef_unparsePreOpt (sRef s)
{
  sRef rb = sRef_getRootBase (s);

  if (sRef_isMeaningful (rb) && !sRef_isConst (rb))
    {
      cstring ret = sRef_unparse (s);
      
      llassertprint (!cstring_equalLit (ret, "?"), ("print: %s", sRef_unparseDebug (s)));
      return (cstring_prependCharO (' ', ret));
    }

  return cstring_undefined;
}

/*@only@*/ cstring
sRef_unparse (sRef s)
{
  if (sRef_isInvalid (s)) return (cstring_makeLiteral ("?"));

  if (context_inFunctionLike ())
    {
      return (sRef_unparseWithArgs (s, context_getParams ()));
    }
  else
    {
      DPRINTF (("Not in function like: %s", context_unparse ()));
      return (sRef_unparseNoArgs (s));
    }
}

static /*@only@*/ cstring
sRef_unparseWithArgs (sRef s, uentryList args)
{
  if (sRef_isInvalid (s))
    {
      return (cstring_makeLiteral ("?"));
    }

  switch (s->kind)
    {
    case SK_CVAR:
      return (uentry_getName (usymtab_getRefQuiet (s->info->cvar->lexlevel,
						   s->info->cvar->index)));
    case SK_UNCONSTRAINED:
      return (cstring_copy (s->info->fname));
    case SK_PARAM:
      {
	if (s->info->paramno < uentryList_size (args)
	    && s->info->paramno >= 0)
	  {
	    uentry ue = uentryList_getN (args, s->info->paramno);
	    
	    if (uentry_isValid (ue))
	      return uentry_getName (ue);
	  }

	return (message ("parameter %d", s->info->paramno + 1));
      }
    case SK_ARRAYFETCH:
      if (s->info->arrayfetch->indknown)
	{
	  return (message ("%q[%d]", sRef_unparseWithArgs (s->info->arrayfetch->arr, args),
				s->info->arrayfetch->ind));
	}
      else
	{
	  return (message ("%q[]", sRef_unparseWithArgs (s->info->arrayfetch->arr, args)));
	}
    case SK_FIELD:
      if (s->info->field->rec->kind == SK_PTR)
	{
	  sRef ptr = s->info->field->rec;

	  return (message ("%q->%s", sRef_unparseWithArgs (ptr->info->ref, args),
			   s->info->field->field));	  
	}
      return (message ("%q.%s", sRef_unparseWithArgs (s->info->field->rec, args),
		       s->info->field->field));

    case SK_PTR:
      {
	sRef ref = sRef_fixConj (s->info->ref);
	skind sk = ref->kind;
	cstring ret;

	if (sk == SK_NEW)
	  {
	    ret = message ("storage pointed to by %q",
			   sRef_unparseWithArgs (ref, args));
	  }
	else if (skind_isSimple (sk) || sk == SK_PTR)
	  {
	    ret = message ("*%q", sRef_unparseWithArgs (ref, args));
	  }
	else
	  {
	    ret = message ("*(%q)", sRef_unparseWithArgs (ref, args));
	  }

	return ret;
      }
    case SK_ADR:
      return (message ("&%q", sRef_unparseWithArgs (s->info->ref, args)));
    case SK_OBJECT:
      return (cstring_copy (ctype_unparse (s->info->object)));
    case SK_CONJ:
      return (sRef_unparseWithArgs (sRef_getConjA (s), args));
    case SK_NEW:
      if (cstring_isDefined (s->info->fname))
	{
	  return (message ("[result of %s]", s->info->fname));
	}
      else
	{
	  return (cstring_makeLiteral (""));
	}
    case SK_UNKNOWN:
      return (cstring_makeLiteral ("?"));
    case SK_DERIVED:
      return (message ("", sRef_unparse (s->info->ref)));
    case SK_EXTERNAL:
      return (message ("", sRef_unparse (s->info->ref)));
    case SK_TYPE:
      return (message ("", ctype_unparse (s->type)));
    case SK_CONST:
      return (message ("", ctype_unparse (s->type)));
    case SK_SPECIAL:
      switch (s->info->spec)
	{
	case SR_NOTHING: return cstring_makeLiteral ("nothing");
	case SR_INTERNAL: return cstring_makeLiteral ("internal state");
	case SR_SPECSTATE: return cstring_makeLiteral ("spec state");
	case SR_SYSTEM: return cstring_makeLiteral ("file system state");
	case SR_GLOBALMARKER: return cstring_makeLiteral ("");
	}
      BADBRANCH;
    case SK_RESULT:
      return cstring_makeLiteral ("result");
    default:
      {
	llbug (message ("Bad sref, kind = %d", (int) s->kind));
      }
    }

  BADEXIT;
}

/*@only@*/ cstring
sRef_unparseDebug (sRef s)
{
  if (sRef_isInvalid (s)) 
    {
      return (cstring_makeLiteral (""));
    }


  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
      return (message ("", s->info->fname));
    case SK_CVAR:
      {
	uentry ce;

	ce = usymtab_getRefQuiet (s->info->cvar->lexlevel, s->info->cvar->index);

	if (uentry_isInvalid (ce))
	  {
	    return (message ("", 
			     s->info->cvar->lexlevel,
			     s->info->cvar->index));
	  }
	else
	  {
	    return (message ("", 
			     s->info->cvar->lexlevel,
			     s->info->cvar->index,
			     uentry_getName (ce)));
	  }

      }
    case SK_PARAM:
      {
	return (message ("", s->info->paramno + 1));
      }
    case SK_ARRAYFETCH:
      if (s->info->arrayfetch->indknown)
	{
	  return (message ("%q[%d]", sRef_unparseDebug (s->info->arrayfetch->arr),
			   s->info->arrayfetch->ind));
	}
      else
	{
	  return (message ("%q[]", sRef_unparseDebug (s->info->arrayfetch->arr)));
	}
    case SK_FIELD:
      return (message ("%q.%s", sRef_unparseDebug (s->info->field->rec),
		       s->info->field->field));
    case SK_PTR:
      if (sRef_isField (s->info->ref)) 
	{
	  sRef fld = s->info->ref;

	  return (message ("%q->%s", sRef_unparseDebug (fld->info->field->rec),
			   fld->info->field->field));
	}
      else
	{
	  return (message ("*(%q)", sRef_unparseDebug (s->info->ref)));
	}
    case SK_ADR:
      return (message ("&%q", sRef_unparseDebug (s->info->ref)));
    case SK_OBJECT:
      return (message ("", ctype_unparse (s->info->object)));
    case SK_CONJ:
      return (message ("%q | %q", sRef_unparseDebug (s->info->conj->a),
		       sRef_unparseDebug (s->info->conj->b)));
    case SK_NEW:
      return message ("", s->info->fname);
    case SK_DERIVED:
      return (message ("", sRef_unparseDebug (s->info->ref)));
    case SK_EXTERNAL:
      return (message ("", sRef_unparseDebug (s->info->ref)));
    case SK_TYPE:
      return (message ("", ctype_unparse (s->type)));
    case SK_CONST:
      if (sRef_hasValue (s))
	{
	  return (message ("", ctype_unparse (s->type), multiVal_unparse (sRef_getValue (s))));
	}
      else
	{
	  return (message ("", ctype_unparse (s->type)));
	}
    case SK_RESULT:
      return (message ("", ctype_unparse (s->type)));
    case SK_SPECIAL:
      return (message ("",
		       cstring_makeLiteralTemp
		       (s->info->spec == SR_NOTHING ? "nothing"
			: s->info->spec == SR_INTERNAL ? "internalState"
			: s->info->spec == SR_SPECSTATE ? "spec state"
			: s->info->spec == SR_SYSTEM ? "fileSystem"
			: "error")));
    case SK_UNKNOWN:
      return cstring_makeLiteral ("");
    }

  BADEXIT;
}

static /*@only@*/ cstring
sRef_unparseNoArgs (sRef s)
{
  if (sRef_isInvalid (s)) return (cstring_makeLiteral ("?"));

  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
      return (cstring_copy (s->info->fname));
    case SK_CVAR:
      {
	uentry ce = usymtab_getRefQuiet (s->info->cvar->lexlevel, 
					 s->info->cvar->index);

	if (uentry_isInvalid (ce))
	  {
	    llcontbug (message ("sRef_unparseNoArgs: bad cvar: %q", 
				sRef_unparseDebug (s)));
	    return (sRef_unparseDebug (s)); 
	  }
	else
	  {
	    return (uentry_getName (ce));
	  }
      }
    case SK_ARRAYFETCH:
      if (s->info->arrayfetch->indknown)
	{
	  return (message ("%q[%d]", sRef_unparseNoArgs (s->info->arrayfetch->arr),
			   s->info->arrayfetch->ind));
	}
      else
	{
	  return (message ("%q[]", sRef_unparseNoArgs (s->info->arrayfetch->arr)));
	}
    case SK_FIELD:
      return (message ("%q.%s", sRef_unparseNoArgs (s->info->field->rec),
		       s->info->field->field));
    case SK_PTR:
      {
	sRef ref = sRef_fixConj (s->info->ref);
	skind sk = ref->kind;
	cstring ret;

	if (skind_isSimple (sk) || sk == SK_PTR)
	  {
	    ret = message ("*%q", sRef_unparseNoArgs (ref));
	  }
	else
	  {
	    ret = message ("*(%q)", sRef_unparseNoArgs (ref));
	  }

	return (ret);
      }
    case SK_ADR:
      return (message ("&%q", sRef_unparseNoArgs (s->info->ref)));
    case SK_OBJECT:
      return (cstring_copy (ctype_unparse (s->info->object)));
    case SK_CONJ:
      return (sRef_unparseNoArgs (s->info->conj->a));
    case SK_NEW:
      return (message ("result of %s", s->info->fname));
    case SK_DERIVED:
      return (message ("", sRef_unparseNoArgs (s->info->ref)));
    case SK_EXTERNAL:
      return message ("", sRef_unparseNoArgs (s->info->ref));
    case SK_SPECIAL:
      return (cstring_makeLiteral
	      (s->info->spec == SR_NOTHING ? "nothing"
	       : s->info->spec == SR_INTERNAL ? "internal state"
	       : s->info->spec == SR_SPECSTATE ? "spec state"
	       : s->info->spec == SR_SYSTEM ? "file system state"
	       : ""));
    case SK_RESULT:
      return cstring_makeLiteral ("result");
    case SK_CONST:
    case SK_TYPE:
    case SK_UNKNOWN:
      return cstring_makeLiteral ("?");
    case SK_PARAM:
      /* llcontbug (message ("sRef_unparseNoArgs: bad case: %q", sRef_unparseDebug (s))); */
      return (sRef_unparseDebug (s));
    }
  BADEXIT;
}

/*@dependent@*/ sRef sRef_makeUnconstrained (cstring fname)
{
  sRef s = sRef_new ();

  s->kind = SK_UNCONSTRAINED;
  s->info = (sinfo) dmalloc (sizeof (*s->info));
  s->info->fname = cstring_copy (fname); /* evans 2002-07-12: this was exposed, causing memory errors */

  return (s);
}

cstring sRef_unconstrainedName (sRef s)
{
  llassert (sRef_isUnconstrained (s));

  return s->info->fname;
}

bool sRef_isUnconstrained (sRef s) 
{
  return (sRef_isReasonable(s) && s->kind == SK_UNCONSTRAINED);
}

static /*@dependent@*/ /*@notnull@*/ sRef 
  sRef_makeCvarAux (int level, usymId index, ctype ct, /*@only@*/ stateInfo stinfo)
{
  sRef s = sRef_newRef ();
  
  s->kind = SK_CVAR;
  s->info = (sinfo) dmalloc (sizeof (*s->info));

  s->info->cvar = (cref) dmalloc (sizeof (*s->info->cvar));
  s->info->cvar->lexlevel = level;
  s->info->cvar->index = index;

  /* for now, all globals are defined; all locals, aren't */

  if (level <= fileScope)
    {
      s->defstate = SS_UNKNOWN;
    }
  else 
    {
      ctype rct = ctype_realType (ct);

      if (level != paramsScope
	  && (ctype_isStructorUnion (rct) || ctype_isRealArray (rct)))
	{
	  s->defstate = SS_ALLOCATED; 
	  s->oaliaskind = s->aliaskind = AK_STACK;
	}
      else
	{
	  s->defstate = SS_UNDEFINED;
	  s->oaliaskind = s->aliaskind = AK_LOCAL;
	}
    }

  s->type = ct;

  llassert (level >= globScope);
  llassert (usymId_isValid (index));

  DPRINTF (("Made cvar: [%p] %s", s, sRef_unparseDebug (s)));
  llassert (valueTable_isUndefined (s->state));
  s->state = context_createValueTable (s, stinfo); 
  return s;
}

/*@dependent@*/ sRef sRef_makeCvar (int level, usymId index, ctype ct, /*@only@*/ stateInfo stinfo)
{
  return (sRef_makeCvarAux (level, index, ct, stinfo));
}

int sRef_lexLevel (sRef s)
{
  if (sRef_isReasonable (s))
    {
      sRef conj;

      conj = sRef_fixConj (s);
      s = sRef_getRootBase (conj);
      
      if (sRef_isReasonable (s) && s->kind == SK_CVAR)
	{
	  return (s->info->cvar->lexlevel);
	}
    }

  return globScope;
}

sRef
sRef_makeGlobal (usymId l, ctype ct, /*@only@*/ stateInfo stinfo)
{
  return (sRef_makeCvar (globScope, l, ct, stinfo));
}

void
sRef_setParamNo (sRef s, int l)
{
  llassert (sRef_isReasonable (s) && s->kind == SK_PARAM);
  s->info->paramno = l;
  llassert (l >= -1);
}

/*@dependent@*/ sRef
sRef_makeParam (int l, ctype ct, stateInfo stinfo)
{
  sRef s = sRef_new ();

  s->kind = SK_PARAM;
  s->type = ct;

  s->info = (sinfo) dmalloc (sizeof (*s->info));
  s->info->paramno = l; 
  llassert (l >= -1);
  s->defstate = SS_UNKNOWN; 
  /* (probably defined, unless its an out parameter) */

  llassert (valueTable_isUndefined (s->state));
  s->state = context_createValueTable (s, stinfo);
  return s;
}

bool
sRef_isIndexKnown (sRef arr)
{
  bool res;

  llassert (sRef_isReasonable (arr));
  arr = sRef_fixConj (arr);
  
  llassert (arr->kind == SK_ARRAYFETCH);  
  res = arr->info->arrayfetch->indknown;
  return (res);
}

int
sRef_getIndex (sRef arr)
{
  int result;

  llassert (sRef_isReasonable (arr));
  arr = sRef_fixConj (arr);

  llassert (arr->kind == SK_ARRAYFETCH);  

  if (!arr->info->arrayfetch->indknown)
    {
      llcontbug (message ("sRef_getIndex: unknown: %q", sRef_unparse (arr)));
      result = 0; 
    }
  else
    {
      result = arr->info->arrayfetch->ind;
    }

  return result;
}

static bool sRef_isZerothArrayFetch (/*@notnull@*/ sRef s)
{
  return (s->kind == SK_ARRAYFETCH
	  && s->info->arrayfetch->indknown
	  && (s->info->arrayfetch->ind == 0));
}

/*@exposed@*/ sRef sRef_makeAddress (/*@exposed@*/ sRef t)
{
  
  if (sRef_isInvalid (t)) return sRef_undefined;

  if (sRef_isPointer (t))
    {
      return (t->info->ref);
    }
  else if (sRef_isZerothArrayFetch (t))
    {
      return (t->info->arrayfetch->arr);
    }
  else
    {
      sRef s = sRef_newRef ();
      
      s->kind = SK_ADR;
      s->type = ctype_makePointer (t->type);
      s->info = (sinfo) dmalloc (sizeof (*s->info));
      s->info->ref = t; 
      
      if (t->defstate == SS_UNDEFINED) 
	/* no! it is allocated even still: && !ctype_isPointer (t->type)) */
	{
	  s->defstate = SS_ALLOCATED;
	}
      else
	{
	  s->defstate = t->defstate;
	}

      if (t->aliaskind == AK_LOCAL)
	{
	  if (sRef_isLocalVar (t))
	    {
	      s->aliaskind = AK_STACK;
	    }
	}

      llassert (valueTable_isUndefined (s->state));
      s->state = context_createValueTable (s, 
					   stateInfo_makeLoc (g_currentloc, SA_CREATED));
      return s;
    }
}

cstring sRef_getField (sRef s)
{
  cstring res;

  llassert (sRef_isReasonable (s));
  s = sRef_fixConj (s);

  llassertprint (sRef_isReasonable (s) && (s->kind == SK_FIELD),
		 ("s = %s", sRef_unparseDebug (s)));

  res = s->info->field->field;
  return (res);
}

sRef sRef_getBase (sRef s)
{
  sRef res;

  if (sRef_isInvalid (s)) return (sRef_undefined);

  s = sRef_fixConj (s);

  switch (s->kind)
    {
    case SK_ADR:
    case SK_PTR:
    case SK_DERIVED:
    case SK_EXTERNAL:
      res = s->info->ref;
      break;
    case SK_FIELD:
      res = s->info->field->rec;
      break;

    case SK_ARRAYFETCH:
      res = s->info->arrayfetch->arr;
      break;

    default:
      res = sRef_undefined; /* shouldn't need it */
    }

  return (res);
}

/*
** same as getBase, except returns invalid
** (and doesn't use adr's)                   
*/

sRef
sRef_getBaseSafe (sRef s)
{
  sRef res;

  if (sRef_isInvalid (s)) { return sRef_undefined; }

  s = sRef_fixConj (s);

  switch (s->kind)
    {
    case SK_PTR:
            res = s->info->ref; 
      break;
    case SK_FIELD:
            res = s->info->field->rec; break;
    case SK_ARRAYFETCH:
            res = s->info->arrayfetch->arr; 
      break;
    default:
      res = sRef_undefined; break;
    }

  return res;
}

/*@constant int MAXBASEDEPTH;@*/
# define MAXBASEDEPTH 25

static /*@exposed@*/ sRef 
sRef_getRootBaseAux (sRef s, int depth)
{
  if (sRef_isInvalid (s)) return sRef_undefined;

  if (depth > MAXBASEDEPTH)
    {
      llgenmsg (message 
		("Warning: reference base limit exceeded for %q. "
		 "This either means there is a variable with at least "
		 "%d indirections from this reference, or "
		 "there is a bug in Splint.",
		 sRef_unparse (s),
		 MAXBASEDEPTH),
		g_currentloc);

      return sRef_undefined;
    }

  switch (s->kind)
    {
    case SK_ADR:
    case SK_PTR:
      return (sRef_getRootBaseAux (s->info->ref, depth + 1));
    case SK_FIELD:
      return (sRef_getRootBaseAux (s->info->field->rec, depth + 1));
    case SK_ARRAYFETCH:
      return (sRef_getRootBaseAux (s->info->arrayfetch->arr, depth + 1));
    case SK_CONJ:
      return (sRef_getRootBaseAux (sRef_fixConj (s), depth + 1));
    default:
      return s;
    }
}

sRef sRef_getRootBase (sRef s)
{
  return (sRef_getRootBaseAux (s, 0));
}

static bool sRef_isDeep (sRef s)
{
  if (sRef_isInvalid (s)) return FALSE;
  
  switch (s->kind)
    {
    case SK_ADR:
    case SK_PTR:
    case SK_FIELD:
    case SK_ARRAYFETCH:
      return TRUE;
    case SK_CONJ:
      return (sRef_isDeep (sRef_fixConj (s)));
    default:
      return FALSE;
    }
}

static int sRef_depth (sRef s)
{
  if (sRef_isInvalid (s)) return 0;
  
  switch (s->kind)
    {
    case SK_ADR:
    case SK_PTR:
    case SK_DERIVED:
    case SK_EXTERNAL:
      return 1 + sRef_depth (s->info->ref);
    case SK_FIELD:
      return 1 + sRef_depth (s->info->field->rec);
    case SK_ARRAYFETCH:
      return 1 + sRef_depth (s->info->arrayfetch->arr);
    case SK_CONJ:
      return (sRef_depth (sRef_fixConj (s)));
    default:
      return 1;
    }
}

sRef
sRef_makeObject (ctype o)
{
  sRef s = sRef_newRef (); 

  s->kind = SK_OBJECT;
  s->info = (sinfo) dmalloc (sizeof (*s->info));
  s->info->object = o;
  llassert (valueTable_isUndefined (s->state));
  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
  return s;
}

/*
** This is used to represent storage referenced by a parameter.
*/

sRef sRef_makeExternal (sRef t)
{
  sRef s = sRef_newRef ();

  llassert (sRef_isReasonable (t));

  s->kind = SK_EXTERNAL;
  s->info = (sinfo) dmalloc (sizeof (*s->info));
  s->type = t->type;
  s->info->ref = t;
  llassert (valueTable_isUndefined (s->state));
  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_DECLARED));
  return s;
}

/*@dependent@*/ sRef sRef_makeDerived (/*@exposed@*/ sRef t)
{
  if (sRef_isReasonable (t))
    {
      sRef s = sRef_newRef ();
      
      s->kind = SK_DERIVED;
      s->info = (sinfo) dmalloc (sizeof (*s->info));
      s->info->ref = t;
      
      s->type = t->type;
      llassert (valueTable_isUndefined (s->state));
      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
      return s;
    }
  else
    {
      return sRef_undefined;
    }
}

/*
** definitely NOT symmetric:
**
**   res fills in unknown state information from other
*/

void
sRef_mergeStateQuiet (sRef res, sRef other)
{
  llassert (sRef_isReasonable (res));
  llassert (sRef_isReasonable (other));

  res->modified = res->modified || other->modified;
  res->safe = res->safe && other->safe;

  if (res->defstate == SS_UNKNOWN) 
    {
      res->defstate = other->defstate;
      res->definfo = stateInfo_update (res->definfo, other->definfo);
    }

  if (res->aliaskind == AK_UNKNOWN || 
      (res->aliaskind == AK_LOCAL && alkind_isKnown (other->aliaskind)))
    {
      res->aliaskind = other->aliaskind;
      res->oaliaskind = other->oaliaskind;
      res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
    }

  if (res->expkind == XO_UNKNOWN)
    {
      res->expkind = other->expkind;
      res->oexpkind = other->oexpkind;
      res->expinfo = stateInfo_update (res->expinfo, other->expinfo);
    }
  
  /* out takes precedence over implicitly defined */
  if (res->defstate == SS_DEFINED && other->defstate != SS_UNKNOWN) 
    {
      res->defstate = other->defstate;
      res->definfo = stateInfo_update (res->definfo, other->definfo);
    }

  if (sRef_getNullState (other) == NS_ERROR || sRef_getNullState (res) == NS_ERROR) 
    {
      sRef_setNullState (res, NS_ERROR, fileloc_undefined);
    }
  else
    {
      if (sRef_getNullState (other) != NS_UNKNOWN 
	  && (sRef_getNullState (res) == NS_UNKNOWN || sRef_getNullState (res) == NS_NOTNULL 
	      || sRef_getNullState (res) == NS_MNOTNULL))
	{
	  sRef_updateNullState (res, other);
	}
    }
}

/*
** definitely NOT symmetric:
**
**   res fills in known state information from other
*/

void
sRef_mergeStateQuietReverse (/*@dependent@*/ sRef res, /*@dependent@*/ sRef other)
{
  bool changed = FALSE;

  llassert (sRef_isReasonable (res));
  llassert (sRef_isReasonable (other));
  sRef_checkMutable (res);

  if (res->kind != other->kind)
    {
      changed = TRUE;

      sinfo_free (res);

      res->kind = other->kind;
      res->type = other->type;
      res->info = sinfo_fullCopy (other);
    }
  else
    {
      if (!ctype_equal (res->type, other->type))
	{
	  changed = TRUE;
	  res->type = other->type;
	}
      
      sinfo_update (res, other);
    }

  res->modified = res->modified || other->modified;
  res->safe = res->safe && other->safe;

  if (res->aliaskind != other->aliaskind
      && (res->aliaskind == AK_UNKNOWN
	  || ((res->aliaskind == AK_LOCAL 
	       || (res->aliaskind == AK_REFCOUNTED
		   && other->aliaskind != AK_LOCAL))
	      && other->aliaskind != AK_UNKNOWN)))
    {
      changed = TRUE;
      res->aliaskind = other->aliaskind;
      res->oaliaskind = other->oaliaskind;
      res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
    }

  if (other->expkind != XO_UNKNOWN && other->expkind != res->expkind)
    {
      changed = TRUE;
      res->expkind = other->expkind;
      res->expinfo = stateInfo_update (res->expinfo, other->expinfo);
    }

  if (other->oexpkind != XO_UNKNOWN)
    {
      res->oexpkind = other->oexpkind;
    }

  /* out takes precedence over implicitly defined */

  if (res->defstate != other->defstate)
    {
      if (other->defstate != SS_UNKNOWN)
	{
	  res->defstate = other->defstate;
	  res->definfo = stateInfo_update (res->definfo, other->definfo);
	}
    }

  if (sRef_getNullState (other) == NS_ERROR || sRef_getNullState (res) == NS_ERROR)
    {
      if (sRef_getNullState (res) != NS_ERROR)
	{
	  sRef_setNullStateN (res, NS_ERROR);
	  changed = TRUE;
	}
    }
  else
    {
      if (sRef_getNullState (other) != NS_UNKNOWN 
	  && sRef_getNullState (other) != sRef_getNullState (res))
	{
	  changed = TRUE;
	  sRef_updateNullState (res, other);
	}
    }

  if (changed)
    {
      sRef_clearDerived (res); 
    }
}

void 
sRef_mergeState (sRef res, sRef other, clause cl, fileloc loc)
{
  if (sRef_isReasonable (res) && sRef_isReasonable (other))
    {
      sRef_mergeStateAux (res, other, cl, FALSE, loc, TRUE);
    }
  else
    {
      if (sRef_isInvalid (res))
	{
	  llbug (message ("sRef_mergeState: invalid res sRef: %q", 
			  sRef_unparseDebug (other)));
	}
      else 
	{
	  llbug (message ("sRef_mergeState: invalid other sRef: %q", 
			  sRef_unparseDebug (res)));
	}
    }
}

void 
sRef_mergeOptState (sRef res, sRef other, clause cl, fileloc loc)
{
  if (sRef_isReasonable (res) && sRef_isReasonable (other))
    {
      sRef_mergeStateAux (res, other, cl, TRUE, loc, TRUE);
    }
  else
    {
      if (sRef_isInvalid (res))
	{
	  llbug (message ("sRef_mergeOptState: invalid res sRef: %q", 
			  sRef_unparseDebug (other)));
	}
      else 
	{
	  llbug (message ("sRef_mergeOptState: invalid other sRef: %q", 
			  sRef_unparseDebug (res)));
	}
    }
}

static void
sRef_mergeStateAux (/*@notnull@*/ sRef res, /*@notnull@*/ sRef other, 
		    clause cl, bool opt, fileloc loc,
		    bool doDerivs)
   /*@modifies res@*/ 
{
  llassertfatal (sRef_isReasonable (res));
  llassertfatal (sRef_isReasonable (other));
  
  DPRINTF (("Merge aux: %s / %s",
	    sRef_unparseFull (res),
	    sRef_unparseFull (other)));

  sRef_checkMutable (res);
  sRef_checkMutable (other);

  res->modified = res->modified || other->modified;

  if (res->kind == other->kind 
      || (other->kind == SK_UNKNOWN || res->kind == SK_UNKNOWN))
    {
      sstate odef = other->defstate;
      sstate rdef = res->defstate;
      nstate onull = sRef_getNullState (other);
      
      /*
      ** yucky stuff to handle 
      **
      **   if (s) free (s);
      */

      if (other->defstate == SS_DEAD 
	  && ((sRef_isOnly (res) && sRef_definitelyNull (res))
	      || (res->defstate == SS_UNDEFINED
		  || res->defstate == SS_UNUSEABLE)))
	{
	  if (res->defstate == SS_UNDEFINED
	      || res->defstate == SS_UNUSEABLE)
	    {
	      res->defstate = SS_UNUSEABLE;
	    }
	  else
	    {
	      res->defstate = SS_DEAD;
	    }

	  res->definfo = stateInfo_update (res->definfo, other->definfo);
	  sRef_clearDerived (other);
	  sRef_clearDerived (res);
	}
      else if (res->defstate == SS_DEAD 
	       && ((sRef_isOnly (other) && sRef_definitelyNull (other))
		   || (other->defstate == SS_UNDEFINED
		       || other->defstate == SS_UNUSEABLE)))
	{
	  if (other->defstate == SS_UNDEFINED
	      || other->defstate == SS_UNUSEABLE)
	    {
	      res->defstate = SS_UNUSEABLE;
	    }
	  else
	    {
	      res->defstate = SS_DEAD;
	    }
	  
	  res->definfo = stateInfo_update (res->definfo, other->definfo);
	  sRef_clearDerived (other);
	  sRef_clearDerived (res);
	}
      else if (res->defstate == SS_DEFINED 
	       && (other->defstate == SS_ALLOCATED 
		   && sRef_definitelyNull (other)))
	{
	  other->defstate = SS_DEFINED; /* definitely null! */
	}
      else if (other->defstate == SS_DEFINED
	       && (res->defstate == SS_ALLOCATED && sRef_definitelyNull (res)))
	{
	  res->defstate = SS_DEFINED;
	  res->definfo = stateInfo_update (res->definfo, other->definfo);
	}
      else
	{
	  ; /* okay */
	}

      if (res->defstate == SS_DEAD && other->defstate == SS_DEAD)
	{
	  sRef_clearDerived (other);
	  sRef_clearDerived (res);
	}

      /*
      ** only & dead isn't really an only!
      */

      if (alkind_isOnly (other->aliaskind) && other->defstate == SS_DEAD)
	{
	  other->aliaskind = AK_UNKNOWN;
	}

      if (alkind_isOnly (res->aliaskind) && res->defstate == SS_DEAD)
	{
	  res->aliaskind = AK_UNKNOWN;
	}

      /*
      ** Dead and dependent -> dead
      */
      
      if (alkind_isDependent (other->aliaskind) && res->defstate == SS_DEAD)
	{
	  other->aliaskind = AK_UNKNOWN;
	  other->defstate = SS_DEAD;
	  sRef_clearDerived (res);
	  sRef_clearDerived (other);
	}
      
      if (alkind_isDependent (res->aliaskind) && other->defstate == SS_DEAD)
	{
	  res->aliaskind = AK_UNKNOWN;
	  res->defstate = SS_DEAD;
	  sRef_clearDerived (res);
	  sRef_clearDerived (other);
	}

      /*
      ** must do alias combine first, since it depends on 
      ** original values of state and null.
      */

      sRef_combineAliasKinds (res, other, cl, loc);
      sRef_combineDefState (res, other);
      sRef_combineNullState (res, other);

      if (rdef == SS_ALLOCATED || rdef == SS_SPECIAL)
	{
	  if (odef == SS_DEFINED)
	    {
	      if (onull == NS_DEFNULL || onull == NS_CONSTNULL)
		{
		  res->deriv = sRefSet_copyInto (res->deriv, other->deriv);
		  DPRINTF (("Copy derivs: %s", sRef_unparseFull (res)));
		}	      	      	      
	    }
	  else if (odef == SS_ALLOCATED || odef == SS_SPECIAL)
	    {
	      
	      if (doDerivs)
		{
		  if (ctype_isUnion (ctype_realType (sRef_getType (res))))
		    {
		      res->deriv = sRef_mergeUnionDerivs (res->deriv, 
							  other->deriv, 
							  opt, cl, loc);
		      DPRINTF (("Copy derivs: %s", sRef_unparseFull (res)));
		    }
		  else
		    {
		      res->deriv = sRef_mergeDerivs (res->deriv, other->deriv, 
						     opt, cl, loc);
		      DPRINTF (("Copy derivs: %s", sRef_unparseFull (res)));
		    }
		}
	    }
	  else
	    {
	      if (doDerivs)
		{
		  res->deriv = sRef_mergeDerivs (res->deriv, other->deriv, 
						 opt, cl, loc);
		  DPRINTF (("Copy derivs: %s", sRef_unparseFull (res)));
		}
	      else
		{
		  ;
		}
	    }
	}
      else
	{
	  if (rdef == SS_PDEFINED
	      || (rdef == SS_DEFINED && odef == SS_PDEFINED))
	    {
		if (doDerivs)
		    {
		      res->deriv = sRef_mergePdefinedDerivs (res->deriv, other->deriv, 
							     opt, cl, loc);
		      DPRINTF (("Copy derivs: %s", sRef_unparseFull (res)));
		    }
	    }
	  else
	    {
	      if ((rdef == SS_DEFINED  || rdef == SS_UNKNOWN)
		  && res->defstate == SS_ALLOCATED)
		{
		  res->deriv = sRefSet_copyInto (res->deriv, other->deriv);
		}
	      else
		{
		  if (doDerivs)
		    {
		      res->deriv = sRef_mergeDerivs (res->deriv, other->deriv, 
						     opt, cl, loc);
		      DPRINTF (("Copy derivs: %s", sRef_unparseFull (res)));
		    }
		}
	    }
	}
      
      
      sRef_combineExKinds (res, other);
    }
  else
    {
      if (res->kind == SK_ARRAYFETCH && other->kind == SK_PTR)
	{
	  sRef nother = sRef_buildArrayFetchKnown (sRef_getBase (other), 0);

	  sRef_copyState (nother, other);
	  sRef_mergeStateAux (res, nother, cl, opt, loc, doDerivs);
	}
      else if (res->kind == SK_PTR && other->kind == SK_ARRAYFETCH)
	{
	  sRef nother = sRef_buildPointer (sRef_getBase (other));

	  if (sRef_isReasonable (nother))
	    {
	      sRef_copyState (nother, other);
	      sRef_mergeStateAux (res, nother, cl, opt, loc, doDerivs);
	    }
	}
      else
	{
	  llcontbug (message ("merge conj: %q / %q", sRef_unparseFull (res), 
			      sRef_unparseFull (other)));
	  
	}
    }

  /* 
  ** Merge value table states
  */

# if 0
  /*
  ** This doesn't do anything.  And its broken too...
  */

  valueTable_elements (res->state, key, sv) 
    {
      stateValue os = valueTable_lookup (other->state, key);
      /*@unused@*/ int val;
      /*@unused@*/ char *msg;

      llassert (stateValue_isDefined (os));
      
      DPRINTF (("Merge state: %s / %s", 
		cstring_toCharsSafe (stateValue_unparse (sv)), 
		cstring_toCharsSafe (stateValue_unparse (os))));
      /*
	val = valueMatix_lookup (key, 
	stateValue_getValue (os),
	stateValue_getValue (sv), 
	&msg);
	DPRINTF (("Val: %d / %s", val, msg));
      */
  } end_valueTable_elements ; 
# endif

  DPRINTF (("Merge aux: %s / %s",
	    sRef_unparseFull (res),
	    sRef_unparseFull (other)));
}

static sRefSet
sRef_mergeUnionDerivs (/*@only@*/ sRefSet res, 
		       /*@exposed@*/ sRefSet other, bool opt,
		       clause cl, fileloc loc)
{
  if (sRefSet_isEmpty (res))
    {
      return sRefSet_copyInto (res, other);
    }
  else
    {
      sRefSet_allElements (other, el)
	{
	  if (sRef_isReasonable (el))
	    {
	      sRef e2 = sRefSet_lookupMember (other, el);
	      
	      if (sRef_isReasonable (e2))
		{
		  sRef_mergeStateAux (el, e2, cl, opt, loc, FALSE);
		}
	      else
		{
		  res = sRefSet_insert (res, el);
		}
	    }
	} end_sRefSet_allElements ;

      return res;
    }
}

static /*@only@*/ sRefSet
sRef_mergeDerivs (/*@only@*/ sRefSet res, sRefSet other, 
		  bool opt, clause cl, fileloc loc)
{
  sRefSet ret = sRefSet_new ();

  sRefSet_allElements (res, el)
    {
      if (sRef_isReasonable (el))
	{
	  sRef e2 = sRefSet_lookupMember (other, el);

	  if (sRef_isReasonable (e2))
	    {
	      if (el->defstate == SS_ALLOCATED &&
		  e2->defstate == SS_PDEFINED)
		{
		  e2->defstate = SS_ALLOCATED;
		}
	      else if (e2->defstate == SS_ALLOCATED &&
		       el->defstate == SS_PDEFINED)
		{
		  el->defstate = SS_ALLOCATED;
		  el->definfo = stateInfo_update (el->definfo, e2->definfo);
		  sRef_clearDerived (el);
		}
	      else if ((el->defstate == SS_DEAD || sRef_isKept (el)) &&
		       (e2->defstate == SS_DEFINED && !sRef_isKept (e2)))
		{
		  DPRINTF (("Checking dead: %s / %s", sRef_unparseFull (el),
			    sRef_unparseFull (e2)));

		  if (checkDeadState (el, e2, TRUE, loc))
		    {
		      if (sRef_isThroughArrayFetch (el))
			{
			  sRef_maybeKill (el, loc);
			  sRef_maybeKill (e2, loc);
			}
		    }
		}
	      else if ((e2->defstate == SS_DEAD || sRef_isKept (e2)) &&
		       (el->defstate == SS_DEFINED && !sRef_isKept (el)))
		{
		  DPRINTF (("Checking dead: %s / %s", sRef_unparseFull (el),
			    sRef_unparseFull (e2)));

		  if (checkDeadState (e2, el, FALSE, loc))
		    {
		      if (sRef_isThroughArrayFetch (el))
			{
			  sRef_maybeKill (el, loc);
			  sRef_maybeKill (e2, loc);
			}
		    }
		}
	      else if (el->defstate == SS_DEFINED &&
		       e2->defstate == SS_PDEFINED)
		{
		  DPRINTF (("set pdefined: %s", sRef_unparseFull (el)));
		  el->defstate = SS_PDEFINED;
		  el->definfo = stateInfo_update (el->definfo, e2->definfo);
		}
	      else if (e2->defstate == SS_DEFINED &&
		       el->defstate == SS_PDEFINED)
		{
		  DPRINTF (("set pdefined: %s", sRef_unparseFull (e2)));
		  e2->defstate = SS_PDEFINED;
		  e2->definfo = stateInfo_update (e2->definfo, el->definfo);
		}
	      else
		{
		  ; /* okay */
		}

	      if (ctype_isUnion (ctype_realType (sRef_getType (el))))
		{
		  el->deriv = sRef_mergeUnionDerivs (el->deriv, e2->deriv, 
						     opt, cl, loc); 
		}
	      else
		{
		  el->deriv = sRef_mergeDerivs (el->deriv, e2->deriv, opt, cl, loc); 
		}
	      
	      if (sRef_equivalent (el, e2))
		{
		  ret = sRefSet_insert (ret, el);
		}
	      else
		{
		  sRef sr = sRef_leastCommon (el, e2);

		  if (sRef_isReasonable (sr))
		    {
		      ret = sRefSet_insert (ret, sr);
		    }
		  else
		    {
		      ;
		    }
		}
	      
	      (void) sRefSet_delete (other, e2);
	    }
	  else /* not defined */
	    {
	      DPRINTF (("Checking dead: %s", sRef_unparseFull (el)));
	      (void) checkDeadState (el, e2, TRUE, loc);
	    }
	}
    } end_sRefSet_allElements;

  sRefSet_allElements (other, el)
    {
      if (sRef_isReasonable (el))
	{
	  DPRINTF (("Checking dead: %s", sRef_unparseFull (el)));
	  (void) checkDeadState (el, sRef_undefined, FALSE, loc);
	}
    } end_sRefSet_allElements;
    
  sRefSet_free (res); 
  return (ret);
}

/*
** Returns TRUE is there is an error.
*/

static bool checkDeadState (/*@notnull@*/ sRef el, sRef e2, bool tbranch, fileloc loc)
{
  /*
  ** usymtab_isGuarded --- the utab should still be in the
  ** state of the alternate branch.
  **
  ** tbranch TRUE means el is released in the last branch, e.g.
  **     if (x != NULL) { ; } else { sfree (x); }
  ** so, if x is null in the other branch no error is reported.
  **
  ** tbranch FALSE means this is the other branch:
  **     if (x != NULL) { sfree (x); } else { ; }
  ** so, if x is null in this branch there is no error.
  */

  
  if ((sRef_isDead (el) || sRef_isKept (el))
      && !sRef_isDeepUnionField (el) 
      && !sRef_isThroughArrayFetch (el))
    {
       
      if (!tbranch)
	{
	  if (usymtab_isDefinitelyNullDeep (el))
	    {
	      return TRUE;
	    }
	}
      else
	{
	  if (usymtab_isAltDefinitelyNullDeep (el))
	    {
	      return TRUE;
	    }
	}
      
      if (optgenerror
	  (FLG_BRANCHSTATE,
	   message ("Storage %q is %q in one path, but live in another.",
		    sRef_unparse (el),
		    cstring_makeLiteral (sRef_isKept (el) 
					 ? "kept" : "released")),
	   loc))
	{
	  if (sRef_isKept (el))
	    {
	      sRef_showAliasInfo (el);      
	    }
	  else
	    {
	      sRef_showStateInfo (el);
	    }

	  if (sRef_isValid (e2))
	    {
	      if (sRef_isKept (e2))
		{
		  sRef_showAliasInfo (e2);      
		}
	      else
		{
		  sRef_showStateInfo (e2);
		}
	    }

	  /* prevent further errors */
	  el->defstate = SS_UNKNOWN; 
	  sRef_setAliasKind (el, AK_ERROR, fileloc_undefined);	  
	  return FALSE;
	}
    }

  return TRUE;
}

static void 
checkDerivDeadState (/*@notnull@*/ sRef el, bool tbranch, fileloc loc)
{
  if (checkDeadState (el, sRef_undefined, tbranch, loc))
    {
      sRefSet_allElements (el->deriv, t)
	{
	  if (sRef_isReasonable (t))
	    {
	      checkDerivDeadState (t, tbranch, loc);
	    }
	} end_sRefSet_allElements;
    }
}

static sRefSet
  sRef_mergePdefinedDerivs (sRefSet res, sRefSet other, bool opt, 
			    clause cl, fileloc loc)
{
  sRefSet ret = sRefSet_new ();

  sRefSet_allElements (res, el)
    {
      if (sRef_isReasonable (el))
	{
	  sRef e2 = sRefSet_lookupMember (other, el);
	  
	  if (sRef_isReasonable (e2))
	    {
	      if (sRef_isAllocated (el) && !sRef_isAllocated (e2))
		{
		  ;
		}
	      else if (sRef_isAllocated (e2) && !sRef_isAllocated (el))
		{
		  el->deriv = sRefSet_copyInto (el->deriv, e2->deriv); 
		}
	      else
		{
		  el->deriv = sRef_mergePdefinedDerivs (el->deriv, e2->deriv, 
							opt, cl, loc);
		}

	      sRef_mergeStateAux (el, e2, cl, opt, loc, FALSE);
	      
	      ret = sRefSet_insert (ret, el);
	      (void) sRefSet_delete (other, e2);
	    }
	  else
	    {
	      if (!opt)
		{
		  checkDerivDeadState (el, (cl == FALSECLAUSE), loc);
		}

	      ret = sRefSet_insert (ret, el);
	    }
	}
    } end_sRefSet_allElements;
  
  sRefSet_allElements (other, el)
    {
      if (sRef_isReasonable (el))
	{
	  if (!sRefSet_member (ret, el))
	    {
	      	      	      /* was cl == FALSECLAUSE */
	      checkDerivDeadState (el, FALSE, loc);
	      ret = sRefSet_insert (ret, el);
	    }
	  else
	    {
	      /*
	      ** it's okay --- member is a different equality test 
	      */
	    }
	}
    } end_sRefSet_allElements;

  sRefSet_free (res);
  return (ret);
}

sRef sRef_makeConj (/*@exposed@*/ /*@returned@*/ sRef a, /*@exposed@*/ sRef b)
{
  llassert (sRef_isReasonable (a));
  llassert (sRef_isReasonable (b));
      
  if (!sRef_equivalent (a, b))
    {
      sRef s = sRef_newRef ();
      
      s->kind = SK_CONJ;
      s->info = (sinfo) dmalloc (sizeof (*s->info));
      s->info->conj = (cjinfo) dmalloc (sizeof (*s->info->conj));
      s->info->conj->a = a;
      s->info->conj->b = b;
      
      if (ctype_equal (a->type, b->type)) s->type = a->type;
      else s->type = ctype_makeConj (a->type, b->type);
      
      if (a->defstate == b->defstate)
	{
	  s->defstate = a->defstate;
	  s->definfo = stateInfo_update (s->definfo, a->definfo);
	  s->definfo = stateInfo_update (s->definfo, b->definfo);
	}
      else
	{
	  s->defstate = SS_UNKNOWN; 
	}
      
      sRef_setNullStateN (s, NS_UNKNOWN);
      
      s->safe = a->safe && b->safe;
      s->aliaskind = alkind_resolve (a->aliaskind, b->aliaskind);

      llassert (valueTable_isUndefined (s->state));
      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_MERGED));
      return s;
    }
  else
    {
      /*@-exposetrans@*/ return a; /*@=exposetrans@*/
    }
}

/*@dependent@*/ sRef
sRef_makeUnknown ()
{
  sRef s = sRef_new ();

  s->kind = SK_UNKNOWN;
  return s;
}

static /*@owned@*/ /*@notnull@*/ sRef
sRef_makeSpecial (speckind sk) /*@*/
{
  sRef s = sRef_new ();

  s->kind = SK_SPECIAL;
  s->info = (sinfo) dmalloc (sizeof (*s->info));
  s->info->spec = sk;
  /*@-dependenttrans@*/
  return s;
  /*@=dependenttrans@*/
}

static /*@owned@*/ sRef srnothing = sRef_undefined;
static /*@owned@*/ sRef srinternal = sRef_undefined;
static /*@owned@*/ sRef srsystem = sRef_undefined;
static /*@owned@*/ sRef srspec = sRef_undefined;

/*@dependent@*/ sRef
sRef_makeNothing (void)
{
  if (sRef_isInvalid (srnothing))
    {
      srnothing = sRef_makeSpecial (SR_NOTHING);
    }

  return srnothing;
}

sRef
sRef_makeInternalState (void)
{
  if (sRef_isInvalid (srinternal))
    {
      srinternal = sRef_makeSpecial (SR_INTERNAL);
    }

  return srinternal;
}

sRef
sRef_makeSpecState (void)
{
  if (sRef_isInvalid (srspec))
    {
      srspec = sRef_makeSpecial (SR_SPECSTATE);
    }

  return srspec;
}

sRef
sRef_makeSystemState (void)
{
  if (sRef_isInvalid (srsystem))
    {
      srsystem = sRef_makeSpecial (SR_SYSTEM);
    }

  return srsystem;
}

sRef
sRef_makeGlobalMarker (void)
{
  sRef s = sRef_makeSpecial (SR_GLOBALMARKER);
  llassert (valueTable_isUndefined (s->state));
  s->state = context_createGlobalMarkerValueTable (stateInfo_undefined);
  return s;
}

sRef
sRef_makeResult (ctype c)
{
  sRef s = sRef_newRef ();
  
  s->kind = SK_RESULT;
  s->type = c;
  s->defstate = SS_UNKNOWN; 
  s->aliaskind = AK_UNKNOWN;
  sRef_setNullStateN (s, NS_UNKNOWN);
  llassert (valueTable_isUndefined (s->state));
  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_DECLARED));

  DPRINTF (("Result: [%p] %s", s, sRef_unparseFull (s)));
  return s;
}


bool
sRef_isNothing (sRef s)
{
  return (sRef_isKindSpecial (s) && s->info->spec == SR_NOTHING);
}

bool
sRef_isInternalState (sRef s)
{
  return (sRef_isKindSpecial (s) && s->info->spec == SR_INTERNAL);
}

bool
sRef_isSpecInternalState (sRef s)
{
  return (sRef_isKindSpecial (s) 
	  && (s->info->spec == SR_INTERNAL || s->info->spec == SR_SPECSTATE));
}

bool
sRef_isSpecState (sRef s)
{
  return (sRef_isKindSpecial (s) && s->info->spec == SR_SPECSTATE);
}

bool
sRef_isResult (sRef s)
{
  return (sRef_isReasonable (s) && s->kind == SK_RESULT);
}

bool
sRef_isSystemState (sRef s)
{
  return (sRef_isKindSpecial (s) && s->info->spec == SR_SYSTEM);
}

bool
sRef_isGlobalMarker (sRef s)
{
  return (sRef_isKindSpecial (s) && s->info->spec == SR_GLOBALMARKER);
}

usymId
sRef_getScopeIndex (sRef s)
{
  llassert (sRef_isReasonable (s));
  llassert (sRef_isCvar (s));

  return (s->info->cvar->index);
}

void
sRef_makeSafe (sRef s)
{
  if (sRef_isReasonable (s)) 
    {
      s->safe = TRUE;
    }
}

void
sRef_makeUnsafe (sRef s)
{
  if (sRef_isReasonable (s)) 
    {
      s->safe = FALSE;
    }
}

/*
** memory state operations
*/

/*@only@*/ cstring sRef_unparseFull (sRef s)
{
  if (sRef_isInvalid (s)) return (cstring_undefined);

  return (message ("[%p] %q - %q { %q } [%s] { %q } < %q >", 
		   s,
		   sRef_unparseDebug (s), 
		   sRef_unparseState (s),
		   stateInfo_unparse (s->definfo),
		   exkind_unparse (s->oexpkind),
		   sRefSet_unparseDebug (s->deriv),
		   valueTable_unparse (s->state)));
}

/*@unused@*/ cstring sRef_unparseDeep (sRef s)
{
  cstring st = cstring_undefined;

  st = message ("%q:", sRef_unparseFull (s));

  if (sRef_isReasonable (s))
    {
      sRefSet_allElements (s->deriv, el)
	{
	  st = message("%q\n%q", st, sRef_unparseDeep (el));
	} end_sRefSet_allElements ;
    }

  return st;
}

/*@only@*/ cstring sRef_unparseState (sRef s)
{
  if (sRef_isConj (s))
    {
      return (message ("%q | %q", 
		       sRef_unparseState (s->info->conj->a),
		       sRef_unparseState (s->info->conj->b)));
    }

  if (sRef_isInvalid (s))
    {
      return (cstring_makeLiteral (""));
    }

  return (message ("%s.%s.%s.%s", 
		   alkind_unparse (s->aliaskind), 
		   nstate_unparse (sRef_getNullState (s)),
		   exkind_unparse (s->expkind),
		   sstate_unparse (s->defstate)));
}

bool sRef_isNotUndefined (sRef s)
{
  return (sRef_isInvalid (s)
	  || (s->defstate != SS_UNDEFINED
	      && s->defstate != SS_UNUSEABLE
	      && s->defstate != SS_DEAD));
}

ynm sRef_isWriteable (sRef s)
{
  if (sRef_isInvalid (s)) return MAYBE;

  if (sRef_isConj (s) && s->defstate == SS_UNKNOWN)
    {
      if (ynm_toBoolStrict (sRef_isWriteable (sRef_getConjA (s))))
	{
	  if (ynm_toBoolStrict (sRef_isWriteable (sRef_getConjB (s))))
	    {
	      return YES;
	    }
	  return MAYBE;
	}
      else
	{
	  if (ynm_toBoolStrict (sRef_isWriteable (sRef_getConjB (s))))
	    {
	      return MAYBE;
	    }
	  return NO;
	}
    }

  return (ynm_fromBool (s->defstate != SS_UNUSEABLE));
}

bool sRef_hasNoStorage (sRef s)
{
  return (!sRef_isAllocatedStorage (s) || sRef_isDefinitelyNull (s));
}

bool sRef_isStrictReadable (sRef s)
{
  return (ynm_toBoolStrict (sRef_isValidLvalue (s)));
}

/*
** Is this what is does?
** Returns YES if s can be used as an rvalue,
**         MAYBE if its not clear
**         NO if s cannot be safely used as an rvalue.
*/

ynm sRef_isValidLvalue (sRef s)
{
  sstate ss;

  if (sRef_isInvalid (s)) return YES;

  ss = s->defstate;
  
  if (sRef_isConj (s) && s->defstate == SS_UNKNOWN)
    {
      if (ynm_toBoolStrict (sRef_isValidLvalue (sRef_getConjA (s))))
	{
	  if (ynm_toBoolStrict (sRef_isValidLvalue (sRef_getConjB (s))))
	    {
	      return YES;
	    }
	  return MAYBE;
	}
      else
	{
	  if (ynm_toBoolStrict (sRef_isValidLvalue (sRef_getConjB (s))))
	    {
	      return MAYBE;
	    }
	  return NO;
	}
    }
  else if (ss == SS_HOFFA)
    {
      if (context_getFlag (FLG_STRICTUSERELEASED))
	{
	  return MAYBE;
	}
      else
	{
	  return YES;
	}
    }
  else
    {
      return (ynm_fromBool (ss == SS_DEFINED 
			    || ss == SS_FIXED 
			    || ss == SS_RELDEF 
			    || ss == SS_PDEFINED 
			    || ss == SS_PARTIAL 
			    || ss == SS_SPECIAL
			    || ss == SS_ALLOCATED 
			    || ss == SS_KILLED /* evans 2001-05-26: added this for killed globals */
			    || ss == SS_UNKNOWN));
    }
}

static /*@exposed@*/ sRef whatUndefined (/*@exposed@*/ sRef fref, int depth)
{
  ctype ct;

  
  if (depth > MAXDEPTH)
    {
      llgenmsg (message 
		("Warning: check definition limit exceeded, checking %q. "
		 "This either means there is a variable with at least "
		 "%d indirections apparent in the program text, or "
		 "there is a bug in Splint.",
		 sRef_unparse (fref),
		 MAXDEPTH),
		g_currentloc);

      return sRef_undefined;
    }

  if (!sRef_isKnown (fref) || sRef_isAnyDefined (fref))
    {
      return sRef_undefined;
    }

  if (sRef_isUnuseable (fref) || sRef_isStateUndefined (fref))
    {
      return fref;
    }

  ct = ctype_realType (sRef_getType (fref));
  
  if (ctype_isUnknown (ct))
    {
      return sRef_undefined;
    }
  else if (ctype_isPointer (ct) || ctype_isArray (ct))
    {
      if (sRef_isStateUnknown (fref))
	{
	  return sRef_undefined;
	}
      else
	{
	  sRef fptr = sRef_constructDeref (fref);

	  return (whatUndefined (fptr, depth + 1));
	}
    }
  else if (ctype_isStruct (ct))
    {
      bool hasOneDefined = FALSE;
      
      if (sRef_isStateUnknown (fref))
	{
	  return fref;
	}
	  
      if (sRef_isPdefined (fref) || sRef_isAnyDefined (fref))
	{
	  sRefSet_realElements (sRef_derivedFields (fref), sr)
	    {
	      hasOneDefined = TRUE;
	      
	      if (sRef_isField (sr))
		{
		  cstring fieldname = sRef_getField (sr);
		  sRef fldref = sRef_makeField (fref, fieldname);
		  bool shouldCheck = !sRef_isRecursiveField (fldref);
		  
		  if (shouldCheck)
		    {
		      sRef wdef = whatUndefined (fldref, depth + 1);

		      if (sRef_isReasonable (wdef))
			{
			  return wdef;
			}
		    }
		}
	    } end_sRefSet_realElements;
	}
      else if (sRef_isAllocated (fref))
	{
	  /*
	  ** for structures, each field must be completely defined
	  */
	  
	  uentryList fields = ctype_getFields (ct);
	      
	  uentryList_elements (fields, ue)
	    {
	      cstring name = uentry_getRealName (ue);
	      sRef ffield = sRef_makeField (fref, name);
	      bool shouldCheck = !sRef_isRecursiveField (ffield);

	      if (sRef_isRelDef (uentry_getSref (ue)))
		{
		  ; /* no error */
		}
	      else
		{
		  if (shouldCheck)
		    {
		      sRef wdef = whatUndefined (ffield, depth + 1);

		      if (sRef_isInvalid (wdef))
			{
			  return wdef;
			}
		    }
		}
	    } end_uentryList_elements;
	}
      else
	{
	  ;
	}
    }
  else if (ctype_isUnion (ct))
    {
      ; 
    }
  else
    {
      ;
    }

  return sRef_undefined;
}

static bool checkDefined (/*@temp@*/ sRef sr)
{
  /*@-temptrans@*/ /* the result from whatUndefined is lost */
  return (sRef_isInvalid (whatUndefined (sr, 0)));
  /*@=temptrans@*/ 
}

bool sRef_isReallyDefined (sRef s)
{
  if (sRef_isReasonable (s))
    {
      if (sRef_isAnyDefined (s))
	{
	  return TRUE;
	}
      else
	{
	  if (sRef_isAllocated (s) || sRef_isPdefined (s))
	    {
	      return checkDefined (s);
	    }
	  else
	    {
	      return FALSE;
	    }
	}
    }
  else
    {
      return TRUE;
    }
}

void sRef_showNotReallyDefined (sRef s)
{
  if (sRef_isReasonable (s))
    {
      if (sRef_isAnyDefined (s))
	{
	  BADBRANCH;
	}
      else
	{
	  if (sRef_isAllocated (s) || sRef_isPdefined (s))
	    {
	      /*@-temptrans@*/ /* the result of whatUndefined is lost */
	      sRef ref = whatUndefined (s, 0);

	      llassert (sRef_isReasonable (ref));

	      if (ref != s)
		{
		  llgenindentmsgnoloc
		    (message ("This sub-reference is %s: %q",
			      sstate_unparse (sRef_getDefState (ref)),
			      sRef_unparse (ref)));
		}
	    }
	  else
	    {
	      ;
	    }
	}
    }
  else
    {
      BADBRANCH;
    }
}

sstate sRef_getDefState (sRef s)
{
  if (sRef_isInvalid (s)) return (SS_UNKNOWN);
  return (s->defstate);
}

void sRef_setDefState (sRef s, sstate defstate, fileloc loc)
{
  sRef_checkMutable (s);  
  sRef_setStateAux (s, defstate, loc);
}

static void sRef_clearAliasStateAux (sRef s, fileloc loc)
{
  sRef_checkMutable (s);  
  sRef_setAliasKind (s, AK_ERROR, loc);
}

void sRef_clearAliasState (sRef s, fileloc loc)
{
  sRef_checkMutable (s);  
  sRef_aliasSetComplete (sRef_clearAliasStateAux, s, loc);
}

void sRef_setAliasKindComplete (sRef s, alkind kind, fileloc loc)
{
  sRef_checkMutable (s);  
  sRef_aliasSetCompleteAlkParam (sRef_setAliasKind, s, kind, loc); 
}

void sRef_setAliasKind (sRef s, alkind kind, fileloc loc)
{
  sRef_checkMutable (s);  

  if (sRef_isReasonable (s))
    {
      sRef_clearDerived (s);

      if ((kind != s->aliaskind && kind != s->oaliaskind)
	  && fileloc_isDefined (loc))
	{
	  s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, stateAction_fromAlkind (kind), loc);
	}
      
      s->aliaskind = kind;
    }
}

void sRef_setOrigAliasKind (sRef s, alkind kind)
{
  sRef_checkMutable (s);  

  if (sRef_isReasonable (s))
    {
      s->oaliaskind = kind;
    }
}

exkind sRef_getExKind (sRef s)
{
  if (sRef_isReasonable (s))
    {
      return (s->expkind);
    }
  else
    {
      return XO_UNKNOWN;
    }
}

exkind sRef_getOrigExKind (sRef s)
{
  if (sRef_isReasonable (s))
    {
      return (s->oexpkind);
    }
  else
    {
      return XO_UNKNOWN;
    }
}

static void sRef_clearExKindAux (sRef s, fileloc loc)
{
  sRef_checkMutable (s);  
  sRef_setExKind (s, XO_UNKNOWN, loc);
}

void sRef_setObserver (sRef s, fileloc loc) 
{
  sRef_checkMutable (s);  
  sRef_setExKind (s, XO_OBSERVER, loc);
}

void sRef_setExposed (sRef s, fileloc loc) 
{
  sRef_checkMutable (s);  
  sRef_setExKind (s, XO_EXPOSED, loc);
}

void sRef_clearExKindComplete (sRef s, fileloc loc)
{
  (void) sRef_aliasSetComplete (sRef_clearExKindAux, s, loc);
}

void sRef_setExKind (sRef s, exkind exp, fileloc loc)
{
  sRef_checkMutable (s);

  if (sRef_isReasonable (s))
    {
      if (s->expkind != exp)
	{
	  s->expinfo = stateInfo_updateLoc (s->expinfo, stateAction_fromExkind (exp), loc);
	}
      
      s->expkind = exp;
    }
}

/*
** s1->derived = s2->derived
*/

static void sRef_copyRealDerived (sRef s1, sRef s2)
{
  DPRINTF (("Copy real: %s / %s", sRef_unparse (s1), sRef_unparse (s2)));
  sRef_checkMutable (s1);

  if (sRef_isReasonable (s1) && sRef_isReasonable (s2))
    {
      sRef sb = sRef_getRootBase (s1);

      sRefSet_clear (s1->deriv);

      sRefSet_allElements (s2->deriv, el)
	{
	  if (sRef_isReasonable (el))
	    {
	      sRef rb = sRef_getRootBase (el);
	      
	      if (!sRef_same (rb, sb))
		{
		  sRef fb = sRef_fixDirectBase (el, s1);
		  
		  if (sRef_isReasonable (fb))
		    {
		      sRef_copyRealDerived (fb, el);
		      sRef_addDeriv (s1, fb);
		    }
		}
	      else
		{
		  sRef_addDeriv (s1, el);
		}
	    }
	} end_sRefSet_allElements ;
    }
  
  }

void sRef_copyRealDerivedComplete (sRef s1, sRef s2)
{
  sRef_innerAliasSetCompleteParam (sRef_copyRealDerived, s1, s2);
}

void sRef_setUndefined (sRef s, fileloc loc)
{
  sRef_checkMutable (s);

  if (sRef_isReasonable (s))
    {
      s->defstate = SS_UNDEFINED;
      s->definfo = stateInfo_updateLoc (s->definfo, SA_UNDEFINED, loc);

      sRef_clearDerived (s);
    }
}

static void sRef_setDefinedAux (sRef s, fileloc loc, bool clear)
{
  sRef_checkMutable (s);
  if (sRef_isInvalid (s)) return;

  DPRINTF (("Set defined: %s", sRef_unparseFull (s)));

  s->definfo = stateInfo_updateLoc (s->definfo, SA_DEFINED, loc);  
  s->defstate = SS_DEFINED;
  
  DPRINTF (("Set defined: %s", sRef_unparseFull (s)));

  /* e.g., if x is allocated, *x = 3 defines x */
  
  if (s->kind == SK_PTR)
    {
      sRef p = s->info->ref;
      sRef arr;

      if (p->defstate == SS_ALLOCATED
	  || p->defstate == SS_SPECIAL) /* evans 2001-07-12: shouldn't need this */
	{
	  sRef_setDefinedAux (p, loc, clear);
	}

      /* 
      ** Defines a[0] also:
      */

      arr = sRef_findDerivedArrayFetch (p, FALSE, 0, FALSE);

      if (sRef_isReasonable (arr))
	{
	  sRef_setDefinedAux (arr, loc, clear);
	}
    }
  else if (s->kind == SK_ARRAYFETCH) 
    {
      if (!s->info->arrayfetch->indknown
	  || (s->info->arrayfetch->ind == 0))
	{
	  sRef p = s->info->arrayfetch->arr;
	  sRef ptr = sRef_constructPointer (p);

	  if (sRef_isReasonable (ptr))
	    {
	      if (ptr->defstate == SS_ALLOCATED 
		  || ptr->defstate == SS_UNDEFINED
		  || ptr->defstate == SS_SPECIAL) /* evans 2001-07-12: shouldn't need this */
		{
		  sRef_setDefinedAux (ptr, loc, clear);
		}
	    }
	  
	  if (p->defstate == SS_RELDEF) 
	    {
	      ;
	    }
	  else if (p->defstate == SS_ALLOCATED || p->defstate == SS_PDEFINED
		   || p->defstate == SS_SPECIAL) /* evans 2001-07-12: shouldn't need this */
	    {
	      p->defstate = SS_DEFINED;
	    }
	  else
	    {
	    }
	}
    }
  else if (s->kind == SK_FIELD)
    {
      sRef parent = s->info->field->rec;
      
      if (sRef_isReasonable (parent))
	{
	  if (ctype_isUnion (ctype_realType (parent->type)))
	    {
	      /*
	      ** Should not clear derived from here.
	      */
	      
	      sRef_setDefinedNoClear (parent, loc);
	    }
	  else
	    {
	      ; /* Nothing to do for structures. */
	    }
	}

          }
  else
    {
      ;
    }

  if (clear)
    {
      sRef_clearDerived (s);
    } 
  else
    {
      /* evans 2001-07-12: need to define the derived references */
      sRefSet_elements (s->deriv, el)
	{
	  llassert (sRef_isReasonable (el));
	  el->defstate = SS_DEFINED;
	} end_sRefSet_elements ;
    }
  
  DPRINTF (("Set defined: %s", sRef_unparseFull (s)));
}

static void sRef_setPartialDefined (sRef s, fileloc loc)
{
  sRef_checkMutable (s);

  if (!sRef_isPartial (s))
    {
      sRef_setDefined (s, loc);
    }
}

void sRef_setPartialDefinedComplete (sRef s, fileloc loc)
{
  sRef_innerAliasSetComplete (sRef_setPartialDefined, s, loc);
}

void sRef_setDefinedComplete (sRef s, fileloc loc)
{
  sRef_innerAliasSetComplete (sRef_setDefined, s, loc);
}

void sRef_setDefinedCompleteDirect (sRef s, fileloc loc)
{
  sRefSet aliases;
  
  aliases = usymtab_allAliases (s);
  DPRINTF (("Set defined complete: %s", sRef_unparseFull (s)));
  DPRINTF (("All aliases: %s", sRefSet_unparseFull (aliases)));
  
  sRef_setDefined (s, loc);

  sRefSet_realElements (aliases, current)
    {
      if (sRef_isReasonable (current))
	{
	  current = sRef_updateSref (current);
	  sRef_setDefined (current, loc);
	}
    } end_sRefSet_realElements;
  
  sRefSet_free (aliases);
  sRef_innerAliasSetComplete (sRef_setDefined, s, loc);
}

void sRef_setDefined (sRef s, fileloc loc)
{
  sRef_checkMutable (s);
  sRef_setDefinedAux (s, loc, TRUE);
}

static void sRef_setDefinedNoClear (sRef s, fileloc loc)
{
  sRef_checkMutable (s);
  DPRINTF (("Defining: %s", sRef_unparseFull (s)));
  sRef_setDefinedAux (s, loc, FALSE);
  DPRINTF (("==> %s", sRef_unparseFull (s)));
}

void sRef_setDefinedNCComplete (sRef s, fileloc loc)
{
  sRef_checkMutable (s);
  DPRINTF (("Set Defined Complete: %s", sRef_unparseFull (s)));
  sRef_innerAliasSetComplete (sRef_setDefinedNoClear, s, loc);
  DPRINTF (("==> %s", sRef_unparseFull (s)));
}

static bool sRef_isDeepUnionField (sRef s)
{
  return (sRef_deepPred (sRef_isUnionField, s));
}

bool sRef_isUnionField (sRef s)
{
  if (sRef_isReasonable (s) && s->kind == SK_FIELD)
    {
      /*
       ** defining one field of a union defines the union
       */
      
      sRef base = s->info->field->rec;

      if (sRef_isReasonable (base))
	{
	  return (ctype_isUnion (ctype_realType (base->type)));
	}
    }

  return FALSE;
}

void sRef_setPdefined (sRef s, fileloc loc)
{
  sRef_checkMutable (s);
  if (sRef_isReasonable (s) && !sRef_isPartial (s))
    {
      sRef base = sRef_getBaseSafe (s);

      if (s->defstate == SS_ALLOCATED)
	{
	  return;
	}
      
      s->definfo = stateInfo_updateLoc (s->definfo, SA_PDEFINED, loc);
      s->defstate = SS_PDEFINED;
      
      /* e.g., if x is allocated, *x = 3 defines x */
      
      while (sRef_isReasonable (base) && sRef_isKnown (base))
	{
	  if (base->defstate == SS_DEFINED)
	    { 
	      sRef nb;
	      
	      DPRINTF (("set pdefined: %s", sRef_unparseFull (base)));
	      base->defstate = SS_PDEFINED; 
	      nb = sRef_getBaseSafe (base); 
	      base = nb;
	    }
	  else 
	    { 
	      break; 
	    }
	}      
    }
}

static void sRef_setStateAux (sRef s, sstate ss, fileloc loc)
{
  sRef_checkMutable (s);

  DPRINTF (("Set state: %s => %s", sRef_unparseFull (s), sstate_unparse (ss)));

  if (sRef_isReasonable (s))
    {
      /* if (s->defstate == SS_RELDEF) return; */

      if (s->defstate != ss && fileloc_isDefined (loc))
	{
	  s->definfo = stateInfo_updateLoc (s->definfo, 
					    stateAction_fromSState (ss), loc);
	}

      s->defstate = ss;
      sRef_clearDerived (s); 

      if (ss == SS_ALLOCATED)
	{
	  sRef base = sRef_getBaseSafe (s);
	  
	  while (sRef_isReasonable (base) && sRef_isKnown (base))
	    {
	      if (base->defstate == SS_DEFINED) 
		{ 
		  sRef nb;

		  DPRINTF (("set pdefined: %s", sRef_unparseFull (s)));		  
		  base->defstate = SS_PDEFINED; 
		  nb = sRef_getBaseSafe (base); 
		  base = nb;
		}
	      else 
		{ 
		  break; 
		}
	    }
	}
    }
}

void sRef_setAllocatedComplete (sRef s, fileloc loc)
{
  sRef_innerAliasSetComplete (sRef_setAllocated, s, loc);
}

static void sRef_setAllocatedShallow (sRef s, fileloc loc)
{
  sRef_checkMutable (s);

  if (sRef_isReasonable (s))
    {
      if (s->defstate == SS_DEAD || s->defstate == SS_UNDEFINED)
	{
	  s->defstate = SS_ALLOCATED;
	  s->definfo = stateInfo_updateLoc (s->definfo, SA_ALLOCATED, loc);
	}
    }
}

void sRef_setAllocatedShallowComplete (sRef s, fileloc loc)
{
  sRef_innerAliasSetComplete (sRef_setAllocatedShallow, s, loc);
}

void sRef_setAllocated (sRef s, fileloc loc)
{
  sRef_checkMutable (s);
  sRef_setStateAux (s, SS_ALLOCATED, loc);
}

void sRef_setPartial (sRef s, fileloc loc)
{
  sRef_checkMutable (s);
  sRef_setStateAux (s, SS_PARTIAL, loc);
}

void sRef_setShared (sRef s, fileloc loc)
{
  sRef_checkMutable (s);

  if (sRef_isReasonable (s))
    {
      if (s->aliaskind != AK_SHARED && fileloc_isDefined (loc))
	{
	  s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_SHARED, loc);
	}

      s->aliaskind = AK_SHARED;
      /* don't! sRef_clearDerived (s); */
    }
}

void sRef_setLastReference (sRef s, /*@exposed@*/ sRef ref, fileloc loc)
{
  sRef_checkMutable (s);

  if (sRef_isReasonable (s))
    {
      s->aliaskind = sRef_getAliasKind (ref);
      s->aliasinfo = stateInfo_updateRefLoc (s->aliasinfo, ref, stateAction_fromAlkind (s->aliaskind), loc);
    }
}

static
void sRef_setNullStateAux (/*@notnull@*/ sRef s, nstate ns, fileloc loc)
{
  sRef_checkMutable (s);
  s->nullstate = ns;
  sRef_resetAliasKind (s);

  if (fileloc_isDefined (loc))
    {
      s->nullinfo = stateInfo_updateLoc (s->nullinfo, stateAction_fromNState (ns), loc);
    }
}

void sRef_setNotNull (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s))
    {
      sRef_setNullStateAux (s, NS_NOTNULL, loc);
    }
}

void sRef_setNullStateN (sRef s, nstate n)
{
  if (sRef_isReasonable (s))
    {
      sRef_checkMutable (s);
      s->nullstate = n;
      DPRINTF (("Set null state ==> %s", sRef_unparseFull (s)));
      sRef_resetAliasKind (s);
    }
}

void sRef_setNullState (sRef s, nstate n, fileloc loc)
{
  if (sRef_isReasonable (s))
    {
      sRef_setNullStateAux (s, n, loc);
    }
}

void sRef_setNullTerminatedStateInnerComplete (sRef s, struct s_bbufinfo b, /*@unused@*/ fileloc loc) 
{
  switch (b.bufstate) {
  case BB_NULLTERMINATED:
    sRef_setNullTerminatedState (s);
    sRef_setLen (s, b.len);
    break;
  case BB_POSSIBLYNULLTERMINATED:
    sRef_setPossiblyNullTerminatedState(s);
    break;
  case BB_NOTNULLTERMINATED:
    sRef_setNotNullTerminatedState (s);
    break;
  }

  sRef_setSize (s, b.size);
  
  /* PL: TO BE DONE : Aliases are not modified right now, have to be similar to
   * setNullStateInnerComplete.
   */
}

void sRef_setNullStateInnerComplete (sRef s, nstate n, fileloc loc)
{
  DPRINTF (("Set null state: %s", nstate_unparse (n)));
  
  sRef_setNullState (s, n, loc);
  
  switch (n)
    {
    case NS_POSNULL:
      sRef_innerAliasSetComplete (sRef_setPosNull, s, loc);
      break;
    case NS_DEFNULL:
      sRef_innerAliasSetComplete (sRef_setDefNull, s, loc);
      break;
    case NS_UNKNOWN:
      sRef_innerAliasSetComplete (sRef_setNullUnknown, s, loc);
      break;
    case NS_NOTNULL:
      sRef_innerAliasSetComplete (sRef_setNotNull, s, loc);
      break;
    case NS_MNOTNULL:
      sRef_innerAliasSetComplete (sRef_setNotNull, s, loc);
      break;
    case NS_RELNULL:
      sRef_innerAliasSetComplete (sRef_setNullUnknown, s, loc);
      break;
    case NS_CONSTNULL:
      sRef_innerAliasSetComplete (sRef_setDefNull, s, loc);
      break;
    case NS_ABSNULL:
      sRef_innerAliasSetComplete (sRef_setNullUnknown, s, loc);
      break;
    case NS_ERROR:
      sRef_innerAliasSetComplete (sRef_setNullErrorLoc, s, loc);
      break;
    }
}

void sRef_setPosNull (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s))
    {
      sRef_setNullStateAux (s, NS_POSNULL, loc);
    }
}
  
void sRef_setDefNull (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s))
    {
      sRef_setNullStateAux (s, NS_DEFNULL, loc);
    }
}

void sRef_setNullUnknown (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s))
    {
      sRef_setNullStateAux (s, NS_UNKNOWN, loc);
    }
}

void sRef_setNullError (sRef s)
{
  if (sRef_isReasonable (s) && !sRef_isConst (s))
    {
      sRef_setNullStateAux (s, NS_UNKNOWN, fileloc_undefined);
    }
}

void sRef_setNullErrorLoc (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s) && !sRef_isConst (s))
    {
      sRef_setNullStateAux (s, NS_UNKNOWN, loc);
    }
}

void sRef_setOnly (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s) && s->aliaskind != AK_ONLY)
    {
      sRef_checkMutable (s);
      s->aliaskind = AK_ONLY;
      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_ONLY, loc);
    }
}

void sRef_setDependent (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s) && !sRef_isConst (s) && (s->aliaskind != AK_DEPENDENT))
    {
      sRef_checkMutable (s);
      DPRINTF (("Setting dependent: %s", sRef_unparseFull (s)));
      s->aliaskind = AK_DEPENDENT;
      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_DEPENDENT, loc);
    }
}

void sRef_setOwned (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s) && !sRef_isConst (s) && (s->aliaskind != AK_OWNED))
    {
      sRef_checkMutable (s);
      s->aliaskind = AK_OWNED;
      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_OWNED, loc);
    }
}

void sRef_setKept (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s) && !sRef_isConst (s) && (s->aliaskind != AK_KEPT))
    {
      sRef base = sRef_getBaseSafe (s);  
 
      while (sRef_isReasonable (base) && sRef_isKnown (base))
	{
	  if (base->defstate == SS_DEFINED) 
	    {
	      sRef_checkMutable (base);
	      base->defstate = SS_PDEFINED; 
	      base = sRef_getBaseSafe (base); 
	    }
	  else 
	    {
	      break; 
	    }
	}

      sRef_checkMutable (s);
      s->aliaskind = AK_KEPT;
      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_KEPT, loc);
    }
}

static void sRef_setKeptAux (sRef s, fileloc loc)
{
  if (!sRef_isShared (s))
    {
      sRef_setKept (s, loc);
    }
}

static void sRef_setDependentAux (sRef s, fileloc loc)
{
  if (!sRef_isShared (s))
    {
      sRef_setDependent (s, loc);
    }
}

void sRef_setKeptComplete (sRef s, fileloc loc)
{
  sRef_aliasSetComplete (sRef_setKeptAux, s, loc);
}

void sRef_setDependentComplete (sRef s, fileloc loc)
{
  sRef_aliasSetComplete (sRef_setDependentAux, s, loc);
}

void sRef_setFresh (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s) && !sRef_isConst (s))
    {
      sRef_checkMutable (s);
      s->aliaskind = AK_FRESH;
      s->aliasinfo = stateInfo_updateLoc (s->aliasinfo, SA_CREATED, loc);
      DPRINTF (("SetFresh: %s", sRef_unparseFull (s)));
    }
}

void sRef_kill (sRef s, fileloc loc)
{
  DPRINTF (("Kill: %s", sRef_unparseFull (s)));

  if (sRef_isReasonable (s) && !sRef_isShared (s) && !sRef_isConst (s))
    {
      sRef base = sRef_getBaseSafe (s);  
      sRef_checkMutable (s);
	
      while (sRef_isReasonable (base) && sRef_isKnown (base))
	{
	  if (base->defstate == SS_DEFINED) 
	    {
	      sRef_checkMutable (base);
	      base->defstate = SS_PDEFINED; 
	      base = sRef_getBaseSafe (base); 
	    }
	  else 
	    {
	      break; 
	    }
	}
      
      s->aliaskind = s->oaliaskind;
      s->defstate = SS_DEAD;
      s->definfo = stateInfo_updateLoc (s->definfo, SA_KILLED, loc);
      DPRINTF (("State info: %s", stateInfo_unparse (s->definfo)));
      sRef_clearDerived (s);
    }
}

void sRef_maybeKill (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s))
    {
      sRef base = sRef_getBaseSafe (s);  
      sRef_checkMutable (s);
            
      while (sRef_isReasonable (base) && sRef_isKnown (base))
	{
	  if (base->defstate == SS_DEFINED || base->defstate == SS_RELDEF)
	    {
	      sRef_checkMutable (base);
	      base->defstate = SS_PDEFINED; 
	      base = sRef_getBaseSafe (base); 
	    }
	  else 
	    {
	      break; 
	    }
	  
	}
      
      s->aliaskind = s->oaliaskind;
      s->defstate = SS_HOFFA; 
      s->definfo = stateInfo_updateLoc (s->definfo, SA_PKILLED, loc);
      DPRINTF (("State info: %s / %s", sRef_unparse (s), 
		stateInfo_unparse (s->definfo)));
      sRef_clearDerived (s); 
    }

  }

/*
** just for type checking...
*/

static void sRef_killAux (sRef s, fileloc loc)
{
  if (sRef_isReasonable (s) && !sRef_isShared (s))
    {
      if (sRef_isUnknownArrayFetch (s))
	{
	  sRef_maybeKill (s, loc);
	}
      else
	{
	  sRef_kill (s, loc);
	}
    }
}

/*
** kills s and all aliases to s
*/

void sRef_killComplete (sRef s, fileloc loc)
{
  DPRINTF (("Kill complete: %s", sRef_unparseFull (s)));
  sRef_aliasSetComplete (sRef_killAux, s, loc);
}

static bool sRef_equivalent (sRef s1, sRef s2)
{
  return (sRef_compare (s1, s2) == 0);
}

/*
** returns an sRef that will not be free'd on function exit.
*/

/*@only@*/ sRef sRef_saveCopy (sRef s)
{
  sRef ret;

  if (sRef_isReasonable (s))
    {
      bool old = inFunction;

      /*
      ** Exit the function scope, so this sRef is not
      ** stored in the deallocation table.
      */
      
      inFunction = FALSE;
      DPRINTF (("Copying sref: %s", sRef_unparseFull(s)));
      ret = sRef_copy (s);
      DPRINTF (("Copying ===>: %s", sRef_unparseFull(ret)));
      inFunction = old;
    }
  else
    {
      ret = sRef_undefined;
    }

  /*@-dependenttrans@*/ 
  return ret;
  /*@=dependenttrans@*/ 
}

sRef sRef_copy (sRef s)
{
  if (sRef_isKindSpecial (s) && !sRef_isGlobalMarker (s))
    {
      /*@-retalias@*/
      return s; /* don't copy specials (except for global markers) */
      /*@=retalias@*/
    }

  if (sRef_isReasonable (s))
    {
      sRef t = sRef_alloc ();

      DPRINTF (("Copying: [%p] %s", s, sRef_unparse (s)));
      DPRINTF (("Full: %s", sRef_unparseFull (s)));

      t->kind = s->kind;
      t->safe = s->safe;
      t->modified = s->modified;
      t->immut = FALSE; /* Note mutability is not copied. */
      t->type = s->type;
      t->val = multiVal_copy (s->val);

      t->info = sinfo_copy (s);
      t->defstate = s->defstate;
      t->nullstate = s->nullstate;
      DPRINTF (("Set null state==> %s", sRef_unparseFull (t)));

 
      /* start modifications */
      t->bufinfo.bufstate = s->bufinfo.bufstate;
      t->bufinfo.len = s->bufinfo.len;
      t->bufinfo.size = s->bufinfo.size;
      /* end modifications */

      t->aliaskind = s->aliaskind;
      t->oaliaskind = s->oaliaskind;

      t->expkind = s->expkind;
      t->oexpkind = s->oexpkind;

      t->nullinfo = stateInfo_copy (s->nullinfo);
      t->aliasinfo = stateInfo_copy (s->aliasinfo);
      t->definfo = stateInfo_copy (s->definfo);
      t->expinfo = stateInfo_copy (s->expinfo);

      t->deriv = sRefSet_newDeepCopy (s->deriv);
      t->state = valueTable_copy (s->state);
      
      DPRINTF (("Made copy: %s => %s", sRef_unparseFull (s), sRef_unparseFull (t)));
      return t;
    }
  else
    {
      return sRef_undefined;
    }
}

/*@notfunction@*/
# define PREDTEST(func,s) \
   do { if (sRef_isInvalid (s)) { return FALSE; } \
        else { if (sRef_isConj (s)) \
                  { return (func (sRef_getConjA (s)) \
		            || func (sRef_getConjB (s))); }}} while (FALSE);

bool sRef_isAddress (sRef s)
{
  PREDTEST (sRef_isAddress, s);
  return (s->kind == SK_ADR);
}
	  
/*
** pretty weak... maybe a flag should control this.
*/

bool sRef_isThroughArrayFetch (sRef s)
{
  if (sRef_isReasonable (s))
    {
      sRef tref = s;

      do 
	{
	  sRef lt;

	  if (sRef_isArrayFetch (tref)) 
	    {
	      return TRUE;
	    }
	  
	  lt = sRef_getBase (tref);
	  tref = lt;
	} while (sRef_isReasonable (tref));
    } 

  return FALSE;
}

bool sRef_isArrayFetch (sRef s)
{
  PREDTEST (sRef_isArrayFetch, s);
  return (s->kind == SK_ARRAYFETCH);
}

bool sRef_isMacroParamRef (sRef s)
{
  if (context_inMacro () && sRef_isCvar (s))
    {
      uentry ue = sRef_getUentry (s);
      cstring pname = makeParam (uentry_rawName (ue));
      uentry mac = usymtab_lookupSafe (pname);

      cstring_free (pname);
      return (uentry_isValid (mac));
    }

  return FALSE;
}
      
bool sRef_isCvar (sRef s) 
{
  PREDTEST (sRef_isCvar, s);
  return (s->kind == SK_CVAR);
}

bool sRef_isConst (sRef s) 
{
  PREDTEST (sRef_isConst, s);
  return (s->kind == SK_CONST);
}

bool sRef_isObject (sRef s) 
{
  PREDTEST (sRef_isObject, s);
  return (s->kind == SK_OBJECT);
}

bool sRef_isExternal (sRef s) 
{
  PREDTEST (sRef_isExternal, s);
  return (s->kind == SK_EXTERNAL);
}

static bool sRef_isDerived (sRef s) 
{
  PREDTEST (sRef_isDerived, s);
  return (s->kind == SK_DERIVED);
}

bool sRef_isField (sRef s)
{
  PREDTEST (sRef_isField, s);
  return (s->kind == SK_FIELD);
}

static bool sRef_isIndex (sRef s)
{
  PREDTEST (sRef_isIndex, s);
  return (s->kind == SK_ARRAYFETCH);
}

bool sRef_isAnyParam (sRef s)
{
  PREDTEST (sRef_isAnyParam, s);
  return (s->kind == SK_PARAM);  
}

bool sRef_isParam (sRef s)
{
  PREDTEST (sRef_isParam, s);
  return (s->kind == SK_PARAM);
}

bool sRef_isDirectParam (sRef s)
{
  PREDTEST (sRef_isDirectParam, s);

  return ((s->kind == SK_CVAR) &&
	  (s->info->cvar->lexlevel == functionScope) &&
	  (context_inFunction () && 
	   (s->info->cvar->index <= usymId_fromInt (uentryList_size (context_getParams ())))));
}

bool sRef_isPointer (sRef s)
{
  PREDTEST (sRef_isPointer, s);
  return (s->kind == SK_PTR);
}

/*
** returns true if storage referenced by s is visible
*/

bool sRef_isReference (sRef s)
{
  PREDTEST (sRef_isReference, s);

  return (sRef_isPointer (s) || sRef_isIndex (s) || sRef_isFileOrGlobalScope (s)
	  || (sRef_isField (s) && (sRef_isReference (s->info->field->rec))));
}

bool sRef_isIReference (sRef s)
{
  return (sRef_isPointer (s) || sRef_isAddress (s) || sRef_isIndex (s)
	  || sRef_isField (s) || sRef_isArrayFetch (s));
}

bool sRef_isFileOrGlobalScope (sRef s)
{
  return (sRef_isCvar (s) && (s->info->cvar->lexlevel <= fileScope));
}

bool sRef_isRealGlobal (sRef s)
{
  return (sRef_isCvar (s) && (s->info->cvar->lexlevel == globScope));
}

bool sRef_isFileStatic (sRef s)
{
  return (sRef_isCvar (s) && (s->info->cvar->lexlevel == fileScope));
}

bool sRef_isAliasCheckedGlobal (sRef s)
{
  if (sRef_isFileOrGlobalScope (s))
    {
      uentry ue = sRef_getUentry (s);

      return context_checkAliasGlob (ue);
    }
  else
    {
      return FALSE;
    }
}

void sRef_free (/*@only@*/ sRef s)
{
  if (s != sRef_undefined && s->kind != SK_SPECIAL)
    {
      DPRINTF (("Free sref: [%p]", s));

      sRef_checkValid (s);
      
      multiVal_free (s->val); /* evans 2002-07-12 */

      stateInfo_free (s->expinfo);
      stateInfo_free (s->aliasinfo);
      stateInfo_free (s->definfo);
      stateInfo_free (s->nullinfo);

      sRefSet_free (s->deriv);
      s->deriv = sRefSet_undefined;

      valueTable_free (s->state); 
      sinfo_free (s);
      
      
      /* drl added to help locate use after release*/
      s->expinfo = stateInfo_undefined;
      s->aliasinfo = stateInfo_undefined;
      s->definfo = stateInfo_undefined;
      s->nullinfo = stateInfo_undefined;

      sfree (s);
    }
}

void sRef_setType (sRef s, ctype t)
{
  if (sRef_isReasonable (s))
    {
      sRef_checkMutable (s); 
      s->type = t;
    }
}

void sRef_setTypeFull (sRef s, ctype t)
{
  if (sRef_isReasonable (s))
    {
      sRef_checkMutable (s);
      s->type = t;

      sRefSet_allElements (s->deriv, current)
	{
	  sRef_setTypeFull (current, ctype_unknown);
	} end_sRefSet_allElements ;
    }
}

/*@exposed@*/ sRef
  sRef_buildField (/*@exposed@*/ sRef rec, /*@dependent@*/ cstring f)
{
  return (sRef_buildNCField (rec, f)); 
}

static /*@exposed@*/ sRef
sRef_findDerivedField (/*@notnull@*/ sRef rec, cstring f)
{
  sRefSet_allElements (sRef_derivedFields (rec), sr)
    {
      if (sRef_isReasonable (sr))
	{
	  if (sRef_isReasonable (sr))
	    {
	      if (sr->info != NULL) 
		{
		  if (sr->kind == SK_FIELD && cstring_equal (sr->info->field->field, f))
		    {
		      return sr;
		    }
		}
	    }
	  else
	    {
	      llcontbug (message ("Invalid sRef as derived field of %s", sRef_unparse (rec)));
	    }
	}
    } end_sRefSet_allElements;

  return sRef_undefined;
}

/*@dependent@*/ /*@observer@*/ sRefSet sRef_derivedFields (/*@temp@*/ sRef rec)
{
  if (sRef_isReasonable (rec))
    {
      sRefSet ret;
      ret = rec->deriv;
      return (ret);
    }
  else
    {
      return (sRefSet_undefined);
    }
}

static /*@exposed@*/ sRef
  sRef_findDerivedPointer (sRef s)
{
  if (sRef_isReasonable (s))
    {
      sRefSet_realElements (s->deriv, sr)
	{
	  if (sRef_isReasonable (sr) && sr->kind == SK_PTR)
	    {
	      return sr;
	    }
	} end_sRefSet_realElements;
    }

  return sRef_undefined;
}

bool
sRef_isUnknownArrayFetch (sRef s)
{
  return (sRef_isReasonable (s) 
	  && s->kind == SK_ARRAYFETCH
	  && !s->info->arrayfetch->indknown);
}

static /*@exposed@*/ sRef
sRef_findDerivedArrayFetch (/*@notnull@*/ sRef s, bool isknown, int idx, bool dead)
{
  
  if (isknown) 
    {
      sRefSet_realElements (s->deriv, sr)
	{
	  if (sRef_isReasonable (sr)
	      && sr->kind == SK_ARRAYFETCH
	      && sr->info->arrayfetch->indknown
	      && (sr->info->arrayfetch->ind == idx))
	    {
	      return sr;
	    }
	} end_sRefSet_realElements;
    }
  else
    {
      sRefSet_realElements (s->deriv, sr)
	{
	  if (sRef_isReasonable (sr)
	      && sr->kind == SK_ARRAYFETCH
	      && (!sr->info->arrayfetch->indknown
		  || (sr->info->arrayfetch->indknown && 
		      sr->info->arrayfetch->ind == 0)))
	    {
	      if (sRef_isDead (sr) || sRef_isKept (sr))
		{
		  if (dead || context_getFlag (FLG_STRICTUSERELEASED))
		    {
		      return sr;
		    }
		}
	      else
		{
		  return sr;
		}
	    }
	} end_sRefSet_realElements;
    }

  return sRef_undefined;
}

static /*@exposed@*/ sRef 
sRef_buildNCField (/*@exposed@*/ sRef rec, /*@exposed@*/ cstring f)
{
  sRef s;

  DPRINTF (("Build nc field: %s / %s",
	    sRef_unparseFull (rec), f));

  if (sRef_isInvalid (rec))
    {
      return sRef_undefined;
    }
      
  /*
  ** check if the field already has been referenced 
  */

  s = sRef_findDerivedField (rec, f);
  
  if (sRef_isReasonable (s))
    {
      return s;
    }
  else
    {
      ctype ct = ctype_realType (rec->type);
      
      DPRINTF (("Field of: %s", sRef_unparse (rec)));
      
      s = sRef_newRef ();      
      s->kind = SK_FIELD;
      s->info = (sinfo) dmalloc (sizeof (*s->info));
      s->info->field = (fldinfo) dmalloc (sizeof (*s->info->field));
      s->info->field->rec = rec;
      s->info->field->field = f; /* doesn't copy f */
      
      if (ctype_isKnown (ct) && ctype_isSU (ct))
	{
	  uentry ue = uentryList_lookupField (ctype_getFields (ct), f);
	
	  if (!uentry_isUndefined (ue))
	    {
	      DPRINTF (("lookup: %s for %s", uentry_unparseFull (ue),
			ctype_unparse (ct)));
	      
	      s->type = uentry_getType (ue);

	      if (ctype_isMutable (s->type)
		  && rec->aliaskind != AK_STACK 
		  && !alkind_isStatic (rec->aliaskind))
		{
		  s->aliaskind = rec->aliaskind;
		}
	      else
		{
		  s->aliaskind = AK_UNKNOWN;
		}

	      if (sRef_isStateDefined (rec) || sRef_isStateUnknown (rec) 
		  || sRef_isPdefined (rec))
		{
		  sRef_setStateFromUentry (s, ue);
		}
	      else
		{
		  sRef_setPartsFromUentry (s, ue);
		}
	      
	      s->oaliaskind = s->aliaskind;
	      s->oexpkind = s->expkind;

	      DPRINTF (("sref: %s", sRef_unparseFull (s)));
	    }
	  else
	    {
	      /*
		Never report this as an error.  It can happen whenever there
		is casting involved.

	      if (report)
		{
		  llcontbug (message ("buildNCField --- no field %s: %q / %s",
				      f, sRef_unparse (s), ctype_unparse (ct)));
		}
		*/

	      return sRef_undefined;
	    }
	}
      
      if (rec->defstate == SS_DEFINED 
	  && (s->defstate == SS_UNDEFINED || s->defstate == SS_UNKNOWN))
	{
	  s->defstate = SS_DEFINED;
	}
      else if (rec->defstate == SS_PARTIAL)
	{
	  s->defstate = SS_PARTIAL;
	}
      else if (rec->defstate == SS_ALLOCATED) 
	{
	  if (ctype_isStackAllocated (ct) && ctype_isStackAllocated (s->type))
	    {
	      s->defstate = SS_ALLOCATED;
	    }
	  else
	    {
	      s->defstate = SS_UNDEFINED;
	    }
	}
      else if (s->defstate == SS_UNKNOWN)
	{
	  s->defstate = rec->defstate;
	}
      else
	{
	  ; /* no change */
	}

      if (s->defstate == SS_UNDEFINED)
	{
	  ctype rt = ctype_realType (s->type);
	  
	  if (ctype_isArray (rt) || ctype_isSU (rt))
	    {
	      s->defstate = SS_ALLOCATED;
	    }
	}

      sRef_addDeriv (rec, s);
      DPRINTF (("Add deriv: %s", sRef_unparseFull (rec)));

      if (ctype_isInt (s->type) && cstring_equal (f, REFSNAME))
	{
	  s->aliaskind = AK_REFS;
	  s->oaliaskind = AK_REFS;
	}

      DPRINTF (("Build field ==> %s", sRef_unparseFull (s)));
      return s;
    }
}

bool
sRef_isStackAllocated (sRef s)
{
  return (sRef_isReasonable(s) 
	  && s->defstate == SS_ALLOCATED && ctype_isStackAllocated (s->type));
}
	  
static
void sRef_setArrayFetchState (/*@notnull@*/ /*@exposed@*/ sRef s, 
			      /*@notnull@*/ /*@exposed@*/ sRef arr)
{
  sRef_checkMutable (s);

  if (ctype_isRealAP (arr->type))
    {
      s->type = ctype_baseArrayPtr (arr->type);
    }

  /* a hack, methinks... makeArrayFetch (&a[0]) ==> a[] */
  /* evans - 2001-08-27: not sure where this was necessary - it
  ** causes an assertion in in aliasCheckPred to fail.
  */

  if (sRef_isAddress (arr)) 
    {
      sRef t = arr->info->ref;
      
      if (sRef_isArrayFetch (t))
	{
	  s->info->arrayfetch->arr = t->info->arrayfetch->arr;
	}
    }
  else if (ctype_isRealPointer (arr->type))
    {
      sRef sp = sRef_findDerivedPointer (arr);
      
      if (sRef_isReasonable (sp))
	{
	  
	  if (ctype_isMutable (s->type))
	    {
	      s->expkind = sRef_getExKind (sp);
	      s->expinfo = stateInfo_copy (sp->expinfo);
	      
	      s->aliaskind = sp->aliaskind;
	      s->aliasinfo = stateInfo_copy (sp->aliasinfo);
	    }

	  s->defstate = sp->defstate;

	  if (s->defstate == SS_DEFINED) 
	    {
	      if (!context_getFlag (FLG_STRICTDESTROY))
		{
		  s->defstate = SS_PARTIAL;
		}
	    }

	  DPRINTF (("Set null state: %s / %s", sRef_unparseFull (s), sRef_unparseFull (sp)));
	  sRef_setNullStateN (s, sRef_getNullState (sp));
	}
      else
	{
	  if (arr->defstate == SS_UNDEFINED)
	    {
	      s->defstate = SS_UNUSEABLE;
	    }
	  else if ((arr->defstate == SS_ALLOCATED) && !ctype_isSU (s->type))
	    {
	      s->defstate = SS_UNDEFINED;
	    }
	  else
	    {
	      if (!context_getFlag (FLG_STRICTDESTROY))
		{
		  s->defstate = SS_PARTIAL;
		}
	      else
		{
		  s->defstate = SS_DEFINED;
		}

	      /*
	      ** Very weak checking for array elements.
	      ** Was:
	      **     s->defstate = arr->defstate;
	      */
	    }

	  s->expkind = sRef_getExKind (arr);
	  s->expinfo = stateInfo_copy (arr->expinfo);
	  
	  if (arr->aliaskind == AK_LOCAL || arr->aliaskind == AK_FRESH)
	    {
	      s->aliaskind = AK_LOCAL;
	    }
	  else
	    {
	      s->aliaskind = AK_UNKNOWN;
	    }
	  
	  sRef_setTypeState (s);
	}
    }
  else
    {
      if (arr->defstate == SS_DEFINED)
	{
	  /*
	  ** Very weak checking for array elements.
	  ** Was:
	  **     s->defstate = arr->defstate;
	  */

	  if (context_getFlag (FLG_STRICTDESTROY))
	    {
	      s->defstate = SS_DEFINED;
	    }
	  else
	    {
	      s->defstate = SS_PARTIAL;
	    }
	}
      else if (arr->defstate == SS_ALLOCATED)
	{
	  if (ctype_isRealArray (s->type))
	    {
	      s->defstate = SS_ALLOCATED;
	    }
	  else 
	    {
	      if (!s->info->arrayfetch->indknown)
		{
		  /*
		  ** is index is unknown, elements is defined or 
		  ** allocated is any element is!
		  */
		  
		  s->defstate = SS_UNDEFINED;
		  
		  sRefSet_allElements (arr->deriv, sr)
		    {
		      if (sRef_isReasonable (sr))
			{
			  if (sRef_isReasonable (sr))
			    {
			      if (sr->defstate == SS_ALLOCATED)
				{
				  s->defstate = SS_ALLOCATED;
				}
			      else 
				{
				  if (sr->defstate == SS_DEFINED)
				    {
				      if (context_getFlag (FLG_STRICTDESTROY))
					{
					  s->defstate = SS_DEFINED;
					}
				      else
					{
					  s->defstate = SS_PARTIAL;
					}
				      
				      break;
				    }
				}
			    }
			  else
			    {
			      llcontbug (message ("Invalid sRef as derived element of %s", sRef_unparse (arr)));
			    }
			}
		    } end_sRefSet_allElements;
		}
	      else
		{
		  s->defstate = SS_UNDEFINED;
		}
	    }
	}
      else
	{
	  s->defstate = arr->defstate;
	}
      
      
      /*
      ** kludgey way to guess where aliaskind applies
      */
      
      if (ctype_isMutable (s->type) 
	  && !ctype_isPointer (arr->type) 
	  && !alkind_isStatic (arr->aliaskind)
	  && !alkind_isStack (arr->aliaskind)) /* evs - 2000-06-20: don't pass stack allocation to members */
	{
	  s->aliaskind = arr->aliaskind;
	}
      else
	{
	  s->aliaskind = AK_UNKNOWN;
	}
    
      sRef_setTypeState (s);
    }

  if (sRef_isObserver (arr)) 
    {
      s->expkind = XO_OBSERVER;
      s->expinfo = stateInfo_copy (arr->expinfo);
    }
}  

/*@exposed@*/ sRef sRef_buildArrayFetch (/*@exposed@*/ sRef arr)
{
  sRef s;

  if (!sRef_isReasonable (arr)) {
    /*@-nullret@*/ return arr /*@=nullret@*/;
  }

  if (ctype_isRealPointer (arr->type))
    {
      (void) sRef_buildPointer (arr); /* do this to define arr! */
    }
  
  s = sRef_findDerivedArrayFetch (arr, FALSE, 0, FALSE);
  
  if (sRef_isReasonable (s))
    {
      /* evans 2001-07-12: this is bogus, clean-up hack */
      if (s->info->arrayfetch->arr != arr)
	{
	  sRef res;
	  check (sRefSet_delete (arr->deriv, s));
	  res = sRef_buildArrayFetch (arr);
	  sRef_copyState (res, s);
	  llassert (res->info->arrayfetch->arr == arr); 
	  return res;
	}

      s->expkind = sRef_getExKind (arr);
      s->expinfo = stateInfo_copy (arr->expinfo);

      return s;
    }
  else
    {
      s = sRef_newRef ();

      s->kind = SK_ARRAYFETCH;
      s->info = (sinfo) dmalloc (sizeof (*s->info));
      s->info->arrayfetch = (ainfo) dmalloc (sizeof (*s->info->arrayfetch));
      s->info->arrayfetch->indknown = FALSE;
      s->info->arrayfetch->ind = 0;
      s->info->arrayfetch->arr = arr;

      sRef_setArrayFetchState (s, arr);

      s->oaliaskind = s->aliaskind;
      s->oexpkind = s->expkind;

      if (!context_inProtectVars ())
	{
	  sRef_addDeriv (arr, s);
	}
      
      if (valueTable_isUndefined (s->state))
	{
	  s->state = context_createValueTable 
	    (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
	}
      
      return (s);
    }
}

/*@exposed@*/ sRef
  sRef_buildArrayFetchKnown (/*@exposed@*/ sRef arr, int i)
{
  sRef s;

  if (!sRef_isReasonable (arr)) {
    /*@-nullret@*/ return arr /*@=nullret@*/;
  }

  if (ctype_isRealPointer (arr->type))
    {
      (void) sRef_buildPointer (arr); /* do this to define arr! */
    }

  s = sRef_findDerivedArrayFetch (arr, TRUE, i, FALSE);

  if (sRef_isReasonable (s))
    {
      /* evans 2001-07-12: this is bogus, clean-up hack */
      if (s->info->arrayfetch->arr != arr)
	{
	  sRef res;

	  check (sRefSet_delete (arr->deriv, s));
	  res = sRef_buildArrayFetchKnown (arr, i);

	  llassert (res->info->arrayfetch->arr == arr);
	  sRef_copyState (res, s);
	  llassert (res->info->arrayfetch->arr == arr);
	  return res;
	}

      s->expkind = sRef_getExKind (arr);
      s->expinfo = stateInfo_copy (arr->expinfo);

      llassert (s->info->arrayfetch->arr == arr);
      return s;
    }
  else
    {
      s = sRef_newRef ();
      
      s->kind = SK_ARRAYFETCH;
      s->info = (sinfo) dmalloc (sizeof (*s->info));
      s->info->arrayfetch = (ainfo) dmalloc (sizeof (*s->info->arrayfetch));
      s->info->arrayfetch->arr = arr;
      s->info->arrayfetch->indknown = TRUE;
      s->info->arrayfetch->ind = i;

      sRef_setArrayFetchState (s, arr);
      /* evans 2001-08-27 no: can change this - llassert (s->info->arrayfetch->arr == arr); */

      s->oaliaskind = s->aliaskind;
      s->oexpkind = s->expkind;
      sRef_addDeriv (arr, s);

      llassert (valueTable_isUndefined (s->state));
      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
      return (s);
    }
}

/*
** sets everything except for defstate
*/

static void
sRef_setPartsFromUentry (sRef s, uentry ue)
{    
  sRef uref = uentry_getSref (ue);

  llassert (sRef_isReasonable (s));

  s->aliaskind = alkind_derive (s->aliaskind, uentry_getAliasKind (ue));
  s->oaliaskind = s->aliaskind;

  if (s->expkind == XO_UNKNOWN)
    {
      s->expkind = uentry_getExpKind (ue);
    }
  
  s->oexpkind = s->expkind;
  
  if (sRef_getNullState (s) == NS_UNKNOWN)
    {
      DPRINTF (("Set null state: %s / %s", sRef_unparseFull (s), uentry_unparseFull (ue)));
      sRef_setNullStateN (s, sRef_getNullState (uentry_getSref (ue)));
    }
  else
    {
      DPRINTF (("Skipping null null state!"));
    }

  if (s->aliaskind == AK_IMPONLY && (sRef_isExposed (s) || sRef_isObserver (s)))
    {
      s->oaliaskind = s->aliaskind = AK_IMPDEPENDENT;
    } 

  if (sRef_isReasonable (uref))
    {
      valueTable utable = uref->state;
      valueTable_free (s->state);
      s->state = valueTable_copy (utable);
    }
}

static void
sRef_setStateFromAbstractUentry (sRef s, uentry ue)
{
  llassert (sRef_isReasonable (s));
  sRef_checkMutable (s);

  sRef_setPartsFromUentry (s, ue);

  s->aliaskind = alkind_derive (s->aliaskind, uentry_getAliasKind (ue));
  s->oaliaskind = s->aliaskind;

  if (s->expkind == XO_UNKNOWN)
    {
      s->expkind = uentry_getExpKind (ue);
    }

  s->oexpkind = s->expkind;
}

void
sRef_setStateFromUentry (sRef s, uentry ue)
{
  sstate defstate;

  sRef_checkMutable (s);
  llassert (sRef_isReasonable (s));
  
  sRef_setPartsFromUentry (s, ue);

  defstate = uentry_getDefState (ue);

  if (sstate_isKnown (defstate))
    {
      s->defstate = defstate;
    }
  else
    {
      ;
    }
}

/*@exposed@*/ sRef
  sRef_buildPointer (/*@exposed@*/ sRef t)
{
  DPRINTF (("build pointer: %s", sRef_unparse (t)));

  if (sRef_isInvalid (t)) return sRef_undefined;

  if (sRef_isAddress (t))
    {
      DPRINTF (("Return ref: %s", sRef_unparse (t->info->ref)));
      return (t->info->ref);
    }
  else
    {
      sRef s = sRef_findDerivedPointer (t);

      DPRINTF (("find derived: %s", sRef_unparse (s)));

      if (sRef_isReasonable (s))
	{
	  s->expkind = sRef_getExKind (t);
	  s->expinfo = stateInfo_copy (t->expinfo);	  

	  s->oaliaskind = s->aliaskind;
	  s->oexpkind = s->expkind;

	  return s;
	}
      else
	{
	  s = sRef_constructPointerAux (t);
	  
	  DPRINTF (("construct: %s", sRef_unparse (s)));

	  if (sRef_isReasonable (s))
	    {
	      sRef_addDeriv (t, s);

	      s->oaliaskind = s->aliaskind;
	      s->oexpkind = s->expkind;
	    }
	  
	  return s;
	}
    }
}

/*@exposed@*/ sRef
sRef_constructPointer (/*@exposed@*/ sRef t)
   /*@modifies t@*/
{
  return sRef_buildPointer (t);
}

static /*@exposed@*/ sRef sRef_constructDerefAux (sRef t, bool isdead)
{
  if (sRef_isReasonable (t))
    {
      sRef s;
      
      /*
      ** if there is a derived t[?], return that.  Otherwise, *t.
      */
      
      s = sRef_findDerivedArrayFetch (t, FALSE, 0, isdead);
      
      if (sRef_isReasonable (s))
	{
	  DPRINTF (("Found array fetch: %s", sRef_unparseFull (s)));
	  return s;
	}
      else
	{
	  sRef ret = sRef_constructPointer (t);

	  DPRINTF (("Constructed pointer: %s", sRef_unparseFull (ret)));

	  return ret;
	}
    }
  else
    {
      return sRef_undefined;
    }
}

sRef sRef_constructDeref (sRef t)
{
  return sRef_constructDerefAux (t, FALSE);
}

sRef sRef_constructDeadDeref (sRef t)
{
  return sRef_constructDerefAux (t, TRUE);
}

static sRef
sRef_constructPointerAux (/*@notnull@*/ /*@exposed@*/ sRef t)
{
  sRef s = sRef_newRef ();
  ctype rt = t->type;
  ctype st;
  
  llassert (valueTable_isUndefined (s->state));

  s->kind = SK_PTR;
  s->info = (sinfo) dmalloc (sizeof (*s->info));
  s->info->ref = t; 
  
  if (ctype_isRealAP (rt))
    {
      s->type = ctype_baseArrayPtr (rt);
    }
  
  st = ctype_realType (s->type);  

  if (t->defstate == SS_UNDEFINED)
    {
      s->defstate = SS_UNUSEABLE;
      s->definfo = stateInfo_copy (t->definfo);
    }
  else if ((t->defstate == SS_ALLOCATED) && !ctype_isSU (st))
    {
      s->defstate = SS_UNDEFINED;
      s->definfo = stateInfo_copy (t->definfo);
    }
  else
    {
      s->defstate = t->defstate;
      s->definfo = stateInfo_copy (t->definfo);
    }
  
  if (t->aliaskind == AK_LOCAL || t->aliaskind == AK_FRESH)
    {
      s->aliaskind = AK_LOCAL;
    }
  else
    {
      s->aliaskind = AK_UNKNOWN;
    }

  s->expkind = sRef_getExKind (t);
  s->expinfo = stateInfo_copy (t->expinfo);

  sRef_setTypeState (s);

  s->oaliaskind = s->aliaskind;
  s->oexpkind = s->expkind;

  if (valueTable_isUndefined (s->state))
    {
      s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));
    }

  DPRINTF (("pointer: %s", sRef_unparseFull (s)));
  return s;
}

bool sRef_hasDerived (sRef s)
{
  return (sRef_isReasonable (s) && !sRefSet_isEmpty (s->deriv));
}

void
sRef_clearDerived (sRef s)
{
  if (sRef_isReasonable (s))
    {
      DPRINTF (("Clear derived: [%p] %s", s, sRef_unparseDebug (s)));
      sRefSet_clear (s->deriv); 
    }
}

void
sRef_clearDerivedComplete (sRef s)
{
  if (sRef_isReasonable (s))
    {
      sRef base = sRef_getBaseSafe (s);
      
      while (sRef_isReasonable (base))
	{
	  DPRINTF (("Clear derived: [%p] %s", base, sRef_unparse (base)));
	  sRefSet_clear (base->deriv); 
	  base = sRef_getBaseSafe (base);
	}

      DPRINTF (("Clear derived: [%p] %s", s, sRef_unparse (s)));
      sRefSet_clear (s->deriv); 
    }
}

/*@exposed@*/ sRef sRef_makePointer (/*@exposed@*/ sRef s)
     /*@modifies s@*/
{
  sRef res = sRef_buildPointer (s); 

  DPRINTF (("Res: %s", sRef_unparseFull (res)));
  return res;
}

/*
** &a[] => a (this is for out params)
*/

/*@exposed@*/ sRef
sRef_makeAnyArrayFetch (/*@exposed@*/ sRef arr)
{  
  if (sRef_isAddress (arr))
    {
      return (arr->info->ref);
    }
  else
    {
      return (sRef_buildArrayFetch (arr));
    }
}

/*@exposed@*/ sRef
sRef_makeArrayFetch (/*@exposed@*/ sRef arr)
{
  return (sRef_buildArrayFetch (arr));
}

/*@exposed@*/ sRef
sRef_makeArrayFetchKnown (/*@exposed@*/ sRef arr, int i)
{
  return (sRef_buildArrayFetchKnown (arr, i));
}

/*@exposed@*/ sRef
sRef_makeField (sRef rec, /*@dependent@*/ cstring f)
{
  sRef ret;
  ret = sRef_buildField (rec, f);
  return ret;
}

/*@exposed@*/ sRef
sRef_makeNCField (/*@exposed@*/ sRef rec, /*@dependent@*/ cstring f)
{
  return (sRef_buildNCField (rec, f));
}

/*@only@*/ cstring
sRef_unparseKindName (sRef s)
{
  cstring result;

  if (s == sRef_undefined) return cstring_makeLiteral ("");

  s = sRef_fixConj (s);

  switch (s->kind)
    {
    case SK_CVAR: 
      if (sRef_isLocalVar (s)) 
	{
	  result = cstring_makeLiteral ("Variable");
	}
      else
	{
	  result = cstring_makeLiteral ("Undef global");
	}
      break;
    case SK_PARAM:
      result = cstring_makeLiteral ("Out parameter");
      break;
    case SK_ARRAYFETCH:
      if (sRef_isAnyParam (s->info->arrayfetch->arr)) 
	{
	  result = cstring_makeLiteral ("Out parameter");
	}
      else if (sRef_isIndexKnown (s))
	{
	  result = cstring_makeLiteral ("Array element");
	}
      else
	{
	  result = cstring_makeLiteral ("Value");
	}
      break;
    case SK_PTR:
      if (sRef_isAnyParam (s->info->ref)) 
	{
	  result = cstring_makeLiteral ("Out parameter");
	}
      else
	{
	  result = cstring_makeLiteral ("Value");
	}
      break;
    case SK_ADR:
      result = cstring_makeLiteral ("Value");
      break;
    case SK_FIELD:
      result = cstring_makeLiteral ("Field");
      break;
    case SK_OBJECT:
      result = cstring_makeLiteral ("Object");
      break;
    case SK_UNCONSTRAINED:
      result = cstring_makeLiteral ("");
      break;
    case SK_RESULT:
    case SK_SPECIAL:
    case SK_UNKNOWN:
    case SK_EXTERNAL:
    case SK_DERIVED:
    case SK_CONST:
    case SK_TYPE:
      result = cstring_makeLiteral ("");
      break;
    case SK_CONJ:
      result = cstring_makeLiteral ("");
      break;
    case SK_NEW:
      result = cstring_makeLiteral ("Storage");
      break;
    }
  
  return result;
}

/*@only@*/ cstring
sRef_unparseKindNamePlain (sRef s)
{
  cstring result;

  if (s == sRef_undefined) return cstring_makeLiteral ("");

  s = sRef_fixConj (s);

  switch (s->kind)
    {
    case SK_CVAR: 
      if (sRef_isLocalVar (s)) 
	{
	  result = cstring_makeLiteral ("Variable");
	}
      else 
	{
	  result = cstring_makeLiteral ("Global");
	}
      break;
    case SK_PARAM:
      result = cstring_makeLiteral ("Parameter");
      break;
    case SK_ARRAYFETCH:
      if (sRef_isAnyParam (s->info->arrayfetch->arr)) 
	{
	  result = cstring_makeLiteral ("Parameter");
	}
      else if (sRef_isIndexKnown (s))
	{
	  result = cstring_makeLiteral ("Array element");
	}
      else 
	{
	  result = cstring_makeLiteral ("Value");
	}
      break;
    case SK_PTR:
      if (sRef_isAnyParam (s->info->ref))
	{
	  result = cstring_makeLiteral ("Parameter");
	}
      else
	{
	  result = cstring_makeLiteral ("Value");
	}
      break;
    case SK_ADR:
      result = cstring_makeLiteral ("Value");
      break;
    case SK_FIELD:
      result = cstring_makeLiteral ("Field");
      break;
    case SK_OBJECT:
      result = cstring_makeLiteral ("Object");
      break;
    case SK_NEW:
      result = cstring_makeLiteral ("Storage");
      break;
    case SK_UNCONSTRAINED:
      result = cstring_makeLiteral ("");
      break;
    case SK_RESULT:
    case SK_TYPE:
    case SK_CONST:
    case SK_EXTERNAL:
    case SK_DERIVED:
    case SK_UNKNOWN:
    case SK_SPECIAL:
      result = cstring_makeLiteral ("");
      break;
    case SK_CONJ:
      result = cstring_makeLiteral ("");
      break;
    }
  
  return result;
}

/*
** s1 <- s2
*/

void
sRef_copyState (sRef s1, sRef s2)
{
  if (sRef_isReasonable (s1) && sRef_isReasonable (s2))
    {
      s1->defstate = s2->defstate;
      
      /* start modifications */
      s1->bufinfo.bufstate = s2->bufinfo.bufstate;
      s1->bufinfo.len = s2->bufinfo.len;
      s1->bufinfo.size = s2->bufinfo.size;
      /* end modifications */

      s1->aliaskind = s2->aliaskind;
      s1->aliasinfo = stateInfo_update (s1->aliasinfo, s2->aliasinfo);

      s1->expkind = s2->expkind;
      s1->expinfo = stateInfo_update (s1->expinfo, s2->expinfo);

      s1->nullstate = s2->nullstate;
      DPRINTF (("Set null state==> %s", sRef_unparseFull (s1)));
      s1->nullinfo = stateInfo_update (s1->nullinfo, s2->nullinfo);

      valueTable_free (s1->state);  
      s1->state = valueTable_copy (s2->state);
      s1->safe = s2->safe;
    }
}

sRef
sRef_makeNew (ctype ct, sRef t, cstring name)
{
  sRef s = sRef_newRef ();

  s->kind = SK_NEW;
  s->type = ct;

  llassert (sRef_isReasonable (t));
  s->defstate = t->defstate;

  s->aliaskind = t->aliaskind;
  s->oaliaskind = s->aliaskind;
  s->nullstate = t->nullstate;
  
  s->expkind = t->expkind;
  s->oexpkind = s->expkind;
  
  s->info = (sinfo) dmalloc (sizeof (*s->info));
  s->info->fname = name;

  /* start modifications */
  s->bufinfo.bufstate = t->bufinfo.bufstate;
  /* end modifications */
  
  llassert (valueTable_isUndefined (s->state));
  s->state = valueTable_copy (t->state);

  DPRINTF (("==> Copying state: %s", valueTable_unparse (s->state)));
  DPRINTF (("==> new: %s", sRef_unparseFull (s)));
  return s;
}

sRef
sRef_makeType (ctype ct)
{
  sRef s = sRef_newRef ();

  sRef_checkMutable (s);

  s->kind = SK_TYPE;
  s->type = ct;

  s->defstate = SS_UNKNOWN; 
  s->aliaskind = AK_UNKNOWN;
  sRef_setNullStateN (s, NS_UNKNOWN);

  /* start modification */
  s->bufinfo.bufstate = BB_NOTNULLTERMINATED;
  /* end modification */

    
  if (ctype_isUA (ct))
    {
      typeId uid = ctype_typeId (ct);
      uentry ue = usymtab_getTypeEntrySafe (uid);

      if (uentry_isValid (ue))
	{
	  sRef_mergeStateQuiet (s, uentry_getSref (ue));
	}
    }
  
  s->oaliaskind = s->aliaskind;
  s->oexpkind = s->expkind;
  llassert (valueTable_isUndefined (s->state));
  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));

  DPRINTF (("Create: %s", sRef_unparseFull (s)));
  return s;
}

sRef
sRef_makeConst (ctype ct)
{
  sRef s = sRef_newRef ();
  
  s->kind = SK_CONST;
  s->type = ct;

  s->defstate = SS_UNKNOWN;
  s->aliaskind = AK_UNKNOWN;
  sRef_setNullStateN (s, NS_UNKNOWN);

  /* start modification */
  s->bufinfo.bufstate = BB_NULLTERMINATED;
  /* end modification */

  /* evans 2002-04-22: added isManifestBool to avoid errors for -boolfalse initializations */
  if (!ctype_isManifestBool (ct) && ctype_isUA (ct)) 
    {
      typeId uid = ctype_typeId (ct);
      uentry te = usymtab_getTypeEntrySafe (uid);
      
      if (uentry_isValid (te))
	{
	  sRef_mergeStateQuiet (s, uentry_getSref (te));
	}
    }
  
  s->oaliaskind = s->aliaskind;
  s->oexpkind = s->expkind;

  llassert (valueTable_isUndefined (s->state));
  s->state = context_createValueTable (s, stateInfo_makeLoc (g_currentloc, SA_CREATED));

  return s;
}

bool sRef_hasName (sRef s)
{
  if (sRef_isInvalid (s))
    {
      return (FALSE);
    }

  switch (s->kind)
    {
    case SK_CVAR:
      {
	uentry u = usymtab_getRefQuiet (s->info->cvar->lexlevel,
					 s->info->cvar->index);
	return (uentry_hasName (u));
      }
    case SK_PARAM:
      {
	if (s->info->paramno >= 0)
	  {
	    uentry u = uentryList_getN (context_getParams (), 
					s->info->paramno);
	    
	    return (uentry_hasName (u));
	  }
	else
	  {
	    llassert (s->info->paramno == PARAMUNKNOWN);
	    return FALSE;
	  }
      }
    default:
      return TRUE;
    }
}

bool
sRef_sameName (sRef s1, sRef s2)
{
  if (sRef_isInvalid (s1))
    {
      return sRef_isInvalid (s2);
    }

  if (sRef_isInvalid (s2))
    {
      return (FALSE);
    }

  switch (s1->kind)
    {
    case SK_CVAR:
      if (s2->kind == SK_CVAR)
	{
	  return (s1->info->cvar->lexlevel == s2->info->cvar->lexlevel
		  && s1->info->cvar->index == s2->info->cvar->index);
	}
      else if (s2->kind == SK_PARAM)
	{
	  if (context_inFunctionLike ())
	    {
	      if (s2->info->paramno != PARAMUNKNOWN)
		{
		  uentry u1 = usymtab_getRefQuiet (s1->info->cvar->lexlevel,
						   s1->info->cvar->index);
		  uentry u2 = uentryList_getN (context_getParams (), 
					       s2->info->paramno);
		  
		  return (cstring_equalFree (uentry_getName (u1),
					     uentry_getName (u2)));
		}
	      else
		{
		  return s1->info->paramno == PARAMUNKNOWN;
		}
	    }
	  else 
	    {
	      return FALSE;
	    }
	}
      else
	{
	  return FALSE;
	}
    case SK_PARAM:
      {
	if (s2->kind == SK_PARAM)
	  {
	    return (s1->info->paramno == s2->info->paramno);
	  }
	else if (s2->kind == SK_CVAR)
	  {
	    if (context_inFunctionLike ())
	      {
		if (s1->info->paramno == PARAMUNKNOWN)
		  {
		    return FALSE;
		  }
		else
		  {
		    uentry u1 = uentryList_getN (context_getParams (), 
						 s1->info->paramno);
		    uentry u2 = usymtab_getRefQuiet (s2->info->cvar->lexlevel,
						     s2->info->cvar->index);
		    
		    
		    return (cstring_equalFree (uentry_getName (u1),
					       uentry_getName (u2)));
		  }
	      }
	    else 
	      {
		return FALSE;
	      }
	  }
	else
	  {
	    return FALSE;
	  }
      }

    case SK_UNCONSTRAINED:
      return FALSE;

    case SK_ARRAYFETCH:
      if (s2->kind == SK_ARRAYFETCH)
	{
	  if (bool_equal (s1->info->arrayfetch->indknown,
			  s2->info->arrayfetch->indknown))
	    {
	      if (!s1->info->arrayfetch->indknown 
		  || (s1->info->arrayfetch->ind == s2->info->arrayfetch->ind))
		{
		  return sRef_sameName (s1->info->arrayfetch->arr,
					s2->info->arrayfetch->arr);
		}
	    }
	}

      return FALSE;
    case SK_FIELD:
      if (s2->kind == SK_FIELD)
	{
	  if (cstring_equal (s1->info->field->field,
			     s2->info->field->field))
	    {
	      return sRef_sameName (s1->info->field->rec,
				    s2->info->field->rec);
	    }

	}
      return FALSE;
    case SK_PTR:
    case SK_ADR:
    case SK_DERIVED:
    case SK_EXTERNAL:
      if (s2->kind == s1->kind)
	{
	  return sRef_sameName (s1->info->ref,
				s2->info->ref);
	}

      return FALSE;
    case SK_OBJECT:
      return FALSE;
    case SK_CONJ:
      return sRef_sameName (sRef_getConjA (s1), s2);
    case SK_NEW:
      return FALSE;
    case SK_UNKNOWN:
      return (s2->kind == SK_UNKNOWN);
    case SK_TYPE:
    case SK_CONST:
      if (s2->kind == s1->kind)
	{
	  return (ctype_equal (s1->type, s2->type));
	}
      
      return FALSE;
    case SK_SPECIAL:
      if (s2->kind == SK_SPECIAL)
	{
	  return (s1->info->spec == s2->info->spec);
	}
      return FALSE;
    case SK_RESULT:
      return (s2->kind == SK_RESULT);
    default:
      return FALSE;
    }
  BADEXIT;
}
		
sRef
sRef_fixOuterRef (/*@returned@*/ sRef s)
{
  sRef root = sRef_getRootBase (s);

  if (sRef_isCvar (root))
    {
      uentry ue = usymtab_getRefQuiet (root->info->cvar->lexlevel, 
				       root->info->cvar->index);

      if (uentry_isValid (ue))
	{
	  sRef uref = uentry_getSref (ue);
	  sRef sr = sRef_fixBase (s, uref);

	  return (sr);
	}
      else
	{
	  llcontbug (message ("sRef_fixOuterRef: undefined: %q", sRef_unparseDebug (s)));
	  return (s);
	}
    }

  return (s);
}

void
sRef_storeState (sRef s)
{
  if (sRef_isInvalid (s)) return;

  sRef_checkMutable (s);
  s->oaliaskind = s->aliaskind;
  s->oexpkind = s->expkind;
}
  
static void sRef_resetStateAux (sRef s, /*@unused@*/ fileloc loc)
{
  sRef_resetState (s);
}

void
sRef_resetState (sRef s)
{
  bool changed = FALSE;
  if (sRef_isInvalid (s)) return;

  
  if (s->oaliaskind == AK_KILLREF && !sRef_isParam (s))
    {
      /*
      ** killref is used in a kludgey way, to save having to add
      ** another alias kind (see usymtab_handleParams)
      */
 
      if (s->expkind != s->oexpkind)
	{
	  changed = TRUE;
	  s->expkind = s->oexpkind;
	}
    }
  else
    {
      if (s->expkind != s->oexpkind)
	{
	  changed = TRUE;
	  s->expkind = s->oexpkind;	  
	}

      if (s->aliaskind != s->oaliaskind
	  && s->aliaskind != AK_REFCOUNTED
	  && s->aliaskind != AK_REFS)
	{
	  changed = TRUE;
	  s->aliaskind = s->oaliaskind;
	}
    }

  if (changed)
    {
      sRef_clearDerived (s);
    }
  
  }

void
sRef_resetStateComplete (sRef s)
{
  sRef_innerAliasSetComplete (sRef_resetStateAux, s, fileloc_undefined);
}

/*@exposed@*/ sRef
sRef_fixBase (/*@returned@*/ sRef s, /*@returned@*/ sRef base)
{
  sRef tmp = sRef_undefined;
  sRef ret;

  if (sRef_isInvalid (s)) return s;
  if (sRef_isInvalid (base)) return base;

  switch (s->kind)
    {
    case SK_RESULT:
    case SK_PARAM:
    case SK_CVAR:
      ret = base;
      break;
    case SK_ARRAYFETCH:
      tmp = sRef_fixBase (s->info->arrayfetch->arr, base);

      if (s->info->arrayfetch->indknown)
	{
	  ret = sRef_makeArrayFetchKnown (tmp, s->info->arrayfetch->ind);
	}
      else
	{
	  ret = sRef_makeArrayFetch (tmp);
	}
      break;
    case SK_FIELD:
      tmp = sRef_fixBase (s->info->field->rec, base);
      ret = sRef_buildNCField (tmp, s->info->field->field);
      break;
    case SK_PTR:
      tmp = sRef_fixBase (s->info->ref, base);
      ret = sRef_makePointer (tmp);
      break;
    case SK_ADR:
      tmp = sRef_fixBase (s->info->ref, base);
      ret = sRef_makeAddress (tmp);
      break;
    case SK_CONJ:
      {
	sRef tmpb;

	tmp = sRef_fixBase (s->info->conj->a, base);
	tmpb = sRef_fixBase (s->info->conj->b, base);

	ret = sRef_makeConj (tmp, tmpb);
	break;
      }
      BADDEFAULT;
    }

  return ret;
}

static /*@exposed@*/ sRef 
sRef_fixDirectBase (sRef s, sRef base)
{
  sRef ret;

  
  if (sRef_isInvalid (s))
    {
      return sRef_undefined;
    }
  
  switch (s->kind)
    {
    case SK_ARRAYFETCH:
      if (s->info->arrayfetch->indknown)
	{
	  ret = sRef_makeArrayFetchKnown (base, s->info->arrayfetch->ind);
	}
      else
	{
	  ret = sRef_makeArrayFetch (base);
	}
      break;
    case SK_FIELD:
      ret = sRef_buildNCField (base, s->info->field->field);
      break;
    case SK_PTR:
            ret = sRef_makePointer (base);
            break;
    case SK_ADR:
      ret = sRef_makeAddress (base);
      break;
    case SK_CONJ:
      {
	sRef tmpa, tmpb;

	tmpa = sRef_fixDirectBase (s->info->conj->a, base);
	tmpb = sRef_fixDirectBase (s->info->conj->b, base);

	ret = sRef_makeConj (tmpa, tmpb);
	break;
      }
      BADDEFAULT;
    }

    sRef_copyState (ret, s);
    return ret;
}

bool
sRef_isAllocIndexRef (sRef s)
{
  return (sRef_isArrayFetch (s) && !(s->info->arrayfetch->indknown) 
	  && sRef_isAllocated (s->info->arrayfetch->arr));
}

void
sRef_showRefLost (sRef s)
{
  if (sRef_hasAliasInfoLoc (s))
    {
      llgenindentmsg (cstring_makeLiteral ("Original reference lost"),
		      sRef_getAliasInfoLoc (s));
    }
}

void
sRef_showRefKilled (sRef s)
{
  if (sRef_isValid (s)) 
    {
      DPRINTF (("Killed: %s", sRef_unparseFull (s)));
      if (context_getLocIndentSpaces () == 0) {
	stateInfo_display (s->definfo, message ("  Storage %q", sRef_unparseOpt (s)));
      } else {
	stateInfo_display (s->definfo, message ("Storage %q", sRef_unparseOpt (s)));
      }
    }
}

void
sRef_showStateInconsistent (sRef s)
{
  if (sRef_hasStateInfoLoc (s))
    {
      llgenindentmsg
	(message ("Storage %qbecomes inconsistent (released on one branch)",
		  sRef_unparseOpt (s)), 
	 sRef_getStateInfoLoc (s));
    }
}

void
sRef_showStateInfo (sRef s)
{
  if (sRef_isValid (s)) {
    if (context_getLocIndentSpaces () == 0) {
      stateInfo_display (s->definfo, message ("   Storage %q", sRef_unparseOpt (s)));
    } else {
      stateInfo_display (s->definfo, message ("Storage %q", sRef_unparseOpt (s)));
    }
  }
}

void
sRef_showExpInfo (sRef s)
{
  if (sRef_isValid (s)) {
    if (context_getLocIndentSpaces () == 0) {
      stateInfo_display (s->expinfo, message ("   Storage %q", sRef_unparseOpt (s)));
    } else {
      stateInfo_display (s->expinfo, message ("Storage %q", sRef_unparseOpt (s)));
    }
  }
}

void
sRef_showMetaStateInfo (sRef s, cstring key)
{
  stateValue val;
  metaStateInfo minfo = context_lookupMetaStateInfo (key);

  llassert (sRef_isReasonable (s));
  llassert (valueTable_isDefined (s->state));
  llassert (metaStateInfo_isDefined (minfo));

  val = valueTable_lookup (s->state, key);
  
  if (stateValue_hasLoc (val))
    {
      llgenindentmsg 
	(message ("%qbecomes %q", sRef_unparseOpt (s), 
		  stateValue_unparseValue (val, minfo)),
	 stateValue_getLoc (val));
    }
}

void
sRef_showNullInfo (sRef s)
{
  DPRINTF (("Show null info: %s", sRef_unparseFull (s)));

  if (sRef_hasNullInfoLoc (s) && sRef_isKnown (s))
    {
      DPRINTF (("has null info: %s",
		fileloc_unparse (sRef_getNullInfoLoc (s))));

      switch (sRef_getNullState (s))
	{
	case NS_CONSTNULL:
	  {
	    fileloc loc = sRef_getNullInfoLoc (s);
	    
	    if (fileloc_isDefined (loc) && !fileloc_isLib (loc))
	      {
		llgenindentmsg 
		  (message ("Storage %qbecomes null", sRef_unparseOpt (s)),
		   loc);
	      }
	    break;
	  }
	case NS_DEFNULL:
	  {
	    fileloc loc = sRef_getNullInfoLoc (s);
	    
	    if (fileloc_isDefined (loc) && !fileloc_isLib (loc))
	      {
		llgenindentmsg (message ("Storage %qbecomes null", sRef_unparseOpt (s)),
				loc);
	      }
	    break;
	  }
	case NS_ABSNULL:
	case NS_POSNULL:
	  llgenindentmsg
	    (message ("Storage %qmay become null", sRef_unparseOpt (s)),
	     sRef_getNullInfoLoc (s));
	  break;
	case NS_NOTNULL:
	case NS_MNOTNULL:
	  llgenindentmsg
	    (message ("Storage %qbecomes not null", sRef_unparseOpt (s)),
	     sRef_getNullInfoLoc (s));
	  break;
	case NS_UNKNOWN:
	  llgenindentmsg
	    (message ("Storage %qnull state becomes unknown",
		      sRef_unparseOpt (s)),
	     sRef_getNullInfoLoc (s));
	  break;

	case NS_ERROR:
	  BADBRANCHCONT;
	  break;

	default:
	  llgenindentmsg
	    (message (" Storage %q becomes %s",
		      sRef_unparse (s), 
		      nstate_unparse (sRef_getNullState (s))),
	     sRef_getNullInfoLoc (s));
	  
	  break;
	}
    }
}

void
sRef_showAliasInfo (sRef s)
{
  if (sRef_isValid (s)) 
    {
      if (sRef_isFresh (s))
	{
	  if (context_getLocIndentSpaces () == 0) {
	    stateInfo_display (s->aliasinfo, message ("   Fresh storage %q", sRef_unparseOpt (s)));
	  } else {
	    stateInfo_display (s->aliasinfo, message ("Fresh storage %q", sRef_unparseOpt (s)));
	  }
	}
      else
	{
	  if (context_getLocIndentSpaces () == 0) {
	    stateInfo_display (s->aliasinfo, message ("   Storage %q", sRef_unparseOpt (s))); 
	  } else {
	    stateInfo_display (s->aliasinfo, message ("Storage %q", sRef_unparseOpt (s)));
	  }
	}
    }
}

void
sRef_mergeNullState (sRef s, nstate n)
{
  if (sRef_isReasonable (s))
    {
      nstate old;
      
      old = sRef_getNullState (s);
      
      if (n != old && n != NS_UNKNOWN)
	{	  	  
	  sRef_setNullState (s, n, g_currentloc);
	}
    }
  else
    {
      llbuglit ("sRef_mergeNullState: invalid");
    }
}

bool
sRef_possiblyNull (sRef s)
{
  if (sRef_isReasonable (s))
    {
      if (sRef_getNullState (s) == NS_ABSNULL)
	{
	  ctype rct = ctype_realType (s->type);
	  
	  if (ctype_isAbstract (rct))
	    {
	      return FALSE;
	    }
	  else
	    {
	      if (ctype_isUser (rct))
		{
		  uentry ue = usymtab_getTypeEntry (ctype_typeId (rct));
		  
		  return (nstate_possiblyNull
			  (sRef_getNullState (uentry_getSref (ue))));
		}
	      else
		{
		  return FALSE;
		}
	    }
	}
      else
	{
	  return nstate_possiblyNull (sRef_getNullState (s));
	}
    }
  
  return FALSE;
}

cstring
sRef_getScopeName (sRef s)
{
  sRef base = sRef_getRootBase (s);

  if (sRef_isRealGlobal (base))
    {
      return (cstring_makeLiteralTemp ("Global"));
    }
  else if (sRef_isFileStatic (base))
    {
      return (cstring_makeLiteralTemp ("Static"));
    }
  else
    {
      return (cstring_makeLiteralTemp ("Local"));
    }
}

cstring
sRef_unparseScope (sRef s)
{
  sRef base = sRef_getRootBase (s);

  if (sRef_isRealGlobal (base))
    {
      return (cstring_makeLiteralTemp ("global"));
    }
  else if (sRef_isFileStatic (base))
    {
      return (cstring_makeLiteralTemp ("file static"));
    }
  else
    {
      BADEXIT;
    }
}

int
sRef_getScope (sRef s)
{
  llassert (sRef_isReasonable (s));

  if (sRef_isCvar (s))
    {
      return s->info->cvar->lexlevel;
    }
  else if (sRef_isParam (s))
    {
      return paramsScope;
    }
  else
    {
      return fileScope;
    }
}

bool
sRef_isDead (sRef s)
{
  return (sRef_isReasonable (s) && (s)->defstate == SS_DEAD);
}

bool
sRef_isDeadStorage (sRef s)
{
  if (sRef_isReasonable (s))
    {
      if (s->defstate == SS_DEAD
	  || s->defstate == SS_UNUSEABLE
	  || s->defstate == SS_UNDEFINED
	  || s->defstate == SS_UNKNOWN)
	{
	  return TRUE;
	}
      else 
	{
	  return (sRef_isDefinitelyNull (s));
	}
    }
  else
    {
      return FALSE;
    }
}

bool
sRef_isPossiblyDead (sRef s)
{
  return (sRef_isReasonable (s) && s->defstate == SS_HOFFA);
}

bool sRef_isStateLive (sRef s)
{
  if (sRef_isReasonable (s))
    {
      sstate ds = s->defstate;

      return (!(ds == SS_UNDEFINED 
		|| ds == SS_DEAD
		|| ds == SS_UNUSEABLE
		|| ds == SS_HOFFA));
    }
  else
    {
      return FALSE;
    }
}


bool sRef_isStateUndefined (sRef s)
{
  return ((sRef_isReasonable(s)) && ((s)->defstate == SS_UNDEFINED));
}

bool sRef_isJustAllocated (sRef s)
{
  if (sRef_isAllocated (s))
    {
      sRefSet_allElements (s->deriv, el)
	{
	  if (!(sRef_isStateUndefined (el) || sRef_isUnuseable (el)))
	    {
	      return FALSE;
	    }
	} end_sRefSet_allElements ;

      return TRUE;
    }

  return FALSE;
}

static bool
sRef_isAllocatedStorage (sRef s)
{
  if (sRef_isReasonable (s) && ynm_toBoolStrict (sRef_isValidLvalue (s)))
    {
      return (ctype_isVisiblySharable (sRef_getType (s)));
    }
  else
    {
      return FALSE;
    }
}

bool
sRef_isUnuseable (sRef s)
{
  return ((sRef_isValid(s)) && ((s)->defstate == SS_UNUSEABLE));
}

bool
sRef_perhapsNull (sRef s)
{
  if (sRef_isReasonable (s))
    {
      if (sRef_getNullState (s) == NS_ABSNULL)
	{
	  ctype rct = ctype_realType (s->type);

	  if (ctype_isAbstract (rct))
	    {
	      return FALSE;
	    }
	  else
	    {
	      if (ctype_isUser (rct))
		{
		  uentry ue = usymtab_getTypeEntry (ctype_typeId (rct));

		  return (nstate_perhapsNull 
			  (sRef_getNullState (uentry_getSref (ue))));
		}
	      else
		{
		  return FALSE;
		}
	    }
	}
      else
	{
	  return nstate_perhapsNull (sRef_getNullState (s));
	}
    }

  return FALSE;
}

/*
** definitelyNull --- called when TRUE is good
*/

bool 
sRef_definitelyNull (sRef s)
{
  return (sRef_isReasonable (s)
	  && (sRef_getNullState (s) == NS_DEFNULL || sRef_getNullState (s) == NS_CONSTNULL));
}

/*
** based on sRef_similar
*/

void
sRef_setDerivNullState (sRef set, sRef guide, nstate ns)
{
  if (sRef_isReasonable (set))
    {
      sRef deriv = sRef_getDeriv (set, guide);
      
      if (sRef_isReasonable (deriv))
	{
	  sRef_setNullStateN (deriv, ns);
	}
    }
}

static /*@exposed@*/ sRef
sRef_getDeriv (/*@returned@*/ /*@notnull@*/ sRef set, sRef guide)
{
  llassert (sRef_isReasonable (set));
  llassert (sRef_isReasonable (guide));

  switch (guide->kind)
    {
    case SK_CVAR:
      llassert (set->kind == SK_CVAR);      
      return set;

    case SK_PARAM:
      llassert (set->kind == guide->kind);
      llassert (set->info->paramno == guide->info->paramno);
      return set;

    case SK_ARRAYFETCH:

      if (set->kind == SK_ARRAYFETCH
	  && (sRef_similar (set->info->arrayfetch->arr,
			    guide->info->arrayfetch->arr)))
	{
	  return set;
	}
      else
	{
	  return (sRef_makeAnyArrayFetch 
		  (sRef_getDeriv (set, guide->info->arrayfetch->arr)));
	}

    case SK_PTR:
      
      if (set->kind == SK_PTR && sRef_similar (set->info->ref, guide->info->ref))
	{
	  return set;
	}
      else
	{
	  return (sRef_makePointer (sRef_getDeriv (set, guide->info->ref)));
	}
      
    case SK_FIELD:
      
      if ((set->kind == SK_FIELD &&
	   (sRef_similar (set->info->field->rec, guide->info->field->rec) &&
	    cstring_equal (set->info->field->field, guide->info->field->field))))
	{
	  return set;
	}
      else
	{
	  return (sRef_makeField (sRef_getDeriv (set, guide->info->field->rec),
				  guide->info->field->field));
	}
    case SK_ADR:
      
      if ((set->kind == SK_ADR) && sRef_similar (set->info->ref, guide->info->ref))
	{
	  return set;
	}
      else
	{
	  return (sRef_makeAddress (sRef_getDeriv (set, guide->info->ref)));
	}

    case SK_CONJ:
      
            return sRef_undefined;

    case SK_RESULT:
    case SK_SPECIAL:
    case SK_UNCONSTRAINED:
    case SK_TYPE:
    case SK_CONST:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_DERIVED:
    case SK_EXTERNAL:
      return sRef_undefined;
    }

  BADEXIT;
}
      
/*
** sRef_aliasCheckPred
**
** A confusing but spiffy function:
**
**    Calls predf (s, e, text, ) on s and all of s's aliases
**    (unless checkAliases (s) is FALSE).
**
**    For alias calls, calls as
**          predf (alias, e, text, s)
*/

void
sRef_aliasCheckPred (bool (predf) (sRef, exprNode, sRef, exprNode),
		     /*@null@*/ bool (checkAliases) (sRef),
		     sRef s, exprNode e, exprNode err)
{
  bool error = (*predf)(s, e, sRef_undefined, err);
  
  
  if (checkAliases != NULL && !(checkAliases (s)))
    {
      /* don't check aliases */
    }
  else
    {
      sRefSet aliases = usymtab_allAliases (s);
      
      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      if (sRef_isReasonable (current))
		{
		  if (!sRef_similar (current, s)
		      || (error && sRef_sameName (current, s)))
		    {
		      (void) (*predf)(current, e, s, err);
		    }
		}
	      else
		{
		  llcontbug (message ("Invalid sRef as alias field of %s", sRef_unparse (s)));
		}
	    }
	} end_sRefSet_realElements;

      sRefSet_free (aliases);
    }
}

/*
** return TRUE iff predf (s) is true for s or any alias of s
*/

bool
sRef_aliasCheckSimplePred (sRefTest predf, sRef s)
{
    
  if ((*predf)(s))
    {
      return TRUE;
    }
  else
    {
      sRefSet aliases;

      aliases = usymtab_allAliases (s);
      
      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      sRef cref = sRef_updateSref (current);
	      
	      /* Whoa! a very kludgey way to make sure the right sref is used
	      ** where there is a conditional symbol table.  I am beginning
	      ** to think that having a conditional symbol table wasn't such
	      ** a great idea.  ;(
	      */
	      
	      if ((*predf)(cref))
		{
		  DPRINTF (("Checking alias: %s", sRef_unparseFull (cref)));
		  sRefSet_free (aliases);
		  return TRUE;
		}
	    }
	} end_sRefSet_realElements;

      sRefSet_free (aliases);
    }
  return FALSE;
}

bool
sRef_aliasCompleteSimplePred (bool (predf) (sRef), sRef s)
{
  sRefSet aliases;
  bool result = FALSE;
  
  
  aliases = usymtab_allAliases (s);
  
  if ((*predf)(s)) result = TRUE;

  
  sRefSet_realElements (aliases, current)
    {
      if (sRef_isReasonable (current))
	{
	  current = sRef_updateSref (current);
	  if ((*predf)(current)) result = TRUE;
	}
    } end_sRefSet_realElements;
  
  sRefSet_free (aliases);
  return result;
}

void
sRef_aliasSetComplete (void (predf) (sRef, fileloc), sRef s, fileloc loc)
{
  sRefSet aliases;
  
  aliases = usymtab_allAliases (s);

  DPRINTF (("All aliases: %s --> %s", sRef_unparseFull (s), sRefSet_unparseFull (aliases)));

  (*predf)(s, loc);

  sRefSet_realElements (aliases, current)
    {
      if (sRef_isReasonable (current))
	{
	  DPRINTF (("Update: %s", sRef_unparseFull (current)));
	  current = sRef_updateSref (current);
	  DPRINTF (("Updated ==> %s", sRef_unparseFull (current)));
	  ((*predf)(current, loc));
	  DPRINTF (("Killed: %s", sRef_unparseFull (current)));
	}
    } end_sRefSet_realElements;

  sRefSet_free (aliases);
}

void
sRef_aliasSetCompleteParam (void (predf) (sRef, int, fileloc), sRef s, 
			    int kind, fileloc loc)
{
  sRefSet aliases;
  
  if (sRef_isDeep (s))
    {
      aliases = usymtab_allAliases (s);
    }
  else
    {
      aliases = usymtab_aliasedBy (s);
    }

  (*predf)(s, kind, loc);

  sRefSet_realElements (aliases, current)
    {
      if (sRef_isReasonable (current))
	{
	  current = sRef_updateSref (current);
	  ((*predf)(current, kind, loc));
	}
    } end_sRefSet_realElements;

  sRefSet_free (aliases);
}

/*
** Version of aliasSetCompleteParam for alkind parameters
*/

void
sRef_aliasSetCompleteAlkParam (void (predf) (sRef, alkind, fileloc), sRef s, 
			       alkind kind, fileloc loc)
{
  sRefSet aliases;
  
  if (sRef_isDeep (s))
    {
      aliases = usymtab_allAliases (s);
    }
  else
    {
      aliases = usymtab_aliasedBy (s);
    }

  (*predf)(s, kind, loc);

  sRefSet_realElements (aliases, current)
    {
      if (sRef_isReasonable (current))
	{
	  current = sRef_updateSref (current);
	  ((*predf)(current, kind, loc));
	}
    } end_sRefSet_realElements;

  sRefSet_free (aliases);
}

static void
sRef_innerAliasSetComplete (void (predf) (sRef, fileloc), sRef s, fileloc loc)
{
  sRef inner;
  sRefSet aliases;
  ctype ct;

  if (!sRef_isReasonable (s)) return;

  /*
  ** Type equivalence checking is necessary --- there might be casting.
  */

  (*predf)(s, loc);

  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
    case SK_CVAR:
    case SK_PARAM:
      break;
    case SK_PTR:
      inner = s->info->ref;
      aliases = usymtab_allAliases (inner);
      ct = sRef_getType (inner);
      
      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      current = sRef_updateSref (current);
	      
	      if (ctype_equal (ct, sRef_getType (current)))
		{
		  sRef ptr = sRef_makePointer (current);
		  ((*predf)(ptr, loc));
		}
	    }
	} end_sRefSet_realElements;

      sRefSet_free (aliases);
      break;
    case SK_ARRAYFETCH:
      inner = s->info->arrayfetch->arr;
      aliases = usymtab_allAliases (inner);
      ct = sRef_getType (inner);

      DPRINTF (("Array fetch: %s", sRefSet_unparse (aliases)));

      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      current = sRef_updateSref (current);
	      DPRINTF (("Current: %s", sRef_unparseFull (current)));

	      if (ctype_equal (ct, sRef_getType (current)))
		{
		  if (s->info->arrayfetch->indknown)
		    {
		      sRef af = sRef_makeArrayFetchKnown (current, s->info->arrayfetch->ind);
		      DPRINTF (("Defining: %s", sRef_unparseFull (af)));
		      /* evans 2001-08-27 This isn't true:
			   llassert (af->info->arrayfetch->arr == current);
			 see comments in buildArrayFetchKnown
		      */
		      ((*predf)(af, loc));
		    }
		  else
		    {
		      sRef af = sRef_makeArrayFetch (current);
		      /* evans 2001-08-27 This isn't true:
			 llassert (af->info->arrayfetch->arr == current);
			 see comments in buildArrayFetch
		      */ 
		      DPRINTF (("Defining: %s", sRef_unparseFull (af)));
		      ((*predf)(af, loc));
		    }
		}
	      else
		{
		  DPRINTF (("Type mismatch: %s / %s",
			    ctype_unparse (ct),
			    ctype_unparse (sRef_getType (current))));
		}
	    }
	} end_sRefSet_realElements;

      sRefSet_free (aliases);
      break;
    case SK_FIELD:
      inner = s->info->field->rec;
      aliases = usymtab_allAliases (inner);
      ct = sRef_getType (inner);
      
      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      current = sRef_updateSref (current);
	      
	      if (ctype_equal (ct, sRef_getType (current)))
		{
		  sRef f = sRef_makeField (current, s->info->field->field);
		  
		  ((*predf)(f, loc));
		}
	    }
	} end_sRefSet_realElements;
      
      sRefSet_free (aliases);
      break;
    case SK_CONJ:
      sRef_innerAliasSetComplete (predf, s->info->conj->a, loc);
      sRef_innerAliasSetComplete (predf, s->info->conj->b, loc);
      break;
    case SK_SPECIAL:
    case SK_ADR:
    case SK_TYPE:
    case SK_CONST:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_DERIVED:
    case SK_EXTERNAL:
    case SK_RESULT:
      break;
    }
}

static void
sRef_innerAliasSetCompleteParam (void (predf) (sRef, sRef), sRef s, sRef t)
{
  sRef inner;
  sRefSet aliases;
  ctype ct;

  if (!sRef_isReasonable (s)) return;

  /*
  ** Type equivalence checking is necessary --- there might be casting.
  */

  (*predf)(s, t);

  switch (s->kind)
    {
    case SK_UNCONSTRAINED:
    case SK_CVAR:
    case SK_PARAM:
      break;
    case SK_PTR:
      inner = s->info->ref;
      aliases = usymtab_allAliases (inner);
      ct = sRef_getType (inner);
            
      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      current = sRef_updateSref (current);
	      
	      if (ctype_equal (ct, sRef_getType (current)))
		{
		  sRef ptr = sRef_makePointer (current);
		  
		  ((*predf)(ptr, t));
		}
	    }
	} end_sRefSet_realElements;

      sRefSet_free (aliases);
      break;
    case SK_ARRAYFETCH:
      inner = s->info->arrayfetch->arr;
      aliases = usymtab_allAliases (inner);
      ct = sRef_getType (inner);

      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      current = sRef_updateSref (current);
	      
	      if (ctype_equal (ct, sRef_getType (current)))
		{
		  		  
		  if (s->info->arrayfetch->indknown)
		    {
		      sRef af = sRef_makeArrayFetchKnown (current, s->info->arrayfetch->ind);
		      
		      ((*predf)(af, t));
		    }
		  else
		    {
		      sRef af = sRef_makeArrayFetch (current);
		      
		      ((*predf)(af, t));
		    }
		}
	    }
	} end_sRefSet_realElements;

      sRefSet_free (aliases);
      break;
    case SK_FIELD:
      inner = s->info->field->rec;
      aliases = usymtab_allAliases (inner);
      ct = sRef_getType (inner);

      
      sRefSet_realElements (aliases, current)
	{
	  if (sRef_isReasonable (current))
	    {
	      current = sRef_updateSref (current);
	      
	      if (ctype_equal (ct, sRef_getType (current)))
		{
		  sRef f = sRef_makeField (current, s->info->field->field);
		  
		  ((*predf)(f, t));
		}
	    }
	} end_sRefSet_realElements;
      
      sRefSet_free (aliases);
      break;
    case SK_CONJ:
      sRef_innerAliasSetCompleteParam (predf, s->info->conj->a, t);
      sRef_innerAliasSetCompleteParam (predf, s->info->conj->b, t);
      break;
    case SK_SPECIAL:
    case SK_ADR:
    case SK_TYPE:
    case SK_CONST:
    case SK_NEW:
    case SK_UNKNOWN:
    case SK_OBJECT:
    case SK_DERIVED:
    case SK_EXTERNAL:
    case SK_RESULT:
      break;
    }
}

static void sRef_combineExKinds (/*@notnull@*/ sRef res, /*@notnull@*/ sRef other)
{
  exkind a1 = sRef_getExKind (res);
  exkind a2 = sRef_getExKind (other);

  if (a1 == a2 || a2 == XO_UNKNOWN) 
    {
      ;
    }
  else if (a1 == XO_UNKNOWN) 
    { 
      res->expinfo = stateInfo_update (res->expinfo, other->expinfo);
      res->expkind = a2;
    }
  else
    {
      res->expkind = XO_OBSERVER;
    }
}

/*
** Currently, this is a very ad hoc implementation, with lots of fixes to
** make real code work okay.  I need to come up with some more general
** rules or principles here.
*/

static void 
  sRef_combineAliasKindsError (/*@notnull@*/ sRef res, 
			       /*@notnull@*/ sRef other, 
			       clause cl, fileloc loc)
{
  bool hasError = FALSE;
  alkind ares = sRef_getAliasKind (res);
  alkind aother = sRef_getAliasKind (other);

  sRef_checkMutable (res);

  if (alkind_isDependent (ares))
    {
      if (aother == AK_KEPT)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	  res->aliaskind = AK_KEPT;      
	}
      else 
	{
	  if (aother == AK_LOCAL || aother == AK_STATIC 
	      || alkind_isTemp (aother))
	    {
	      DPRINTF (("Setting dependent: %s", sRef_unparseFull (res)));
	      res->aliaskind = AK_DEPENDENT;
	    }
	}
    }
  else if (alkind_isDependent (aother))
    {
      if (ares == AK_KEPT)
	{
	  res->aliaskind = AK_KEPT;      
	}
      else 
	{
	  if (ares == AK_LOCAL || ares == AK_STATIC || alkind_isTemp (ares))
	    {
	      DPRINTF (("Setting dependent: %s", sRef_unparseFull (res)));
	      res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	      res->aliaskind = AK_DEPENDENT;
	    }
	}
    }
  else if ((ares == AK_LOCAL || ares == AK_UNIQUE
	    || ares == AK_STATIC || alkind_isTemp (ares))
	   && sRef_isFresh (other))
    {
      /*
      ** cases like: if (s == NULL) s = malloc...;
      **    don't generate errors
      */
      
      if (usymtab_isAltDefinitelyNullDeep (res))
	{
	  res->aliaskind = ares;
	}
      else
	{
	  hasError = TRUE; 
	}
    }
  else if ((aother == AK_LOCAL || aother == AK_UNIQUE
	    || aother == AK_STATIC || alkind_isTemp (aother))
	   && sRef_isFresh (res))
    {
      /*
      ** cases like: if (s == NULL) s = malloc...;
      **    don't generate errors
      */
      
      if (usymtab_isDefinitelyNullDeep (other))
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	  res->aliaskind = aother;
	}
      else
	{
	  hasError = TRUE;
	}
    }
  else if (ares == AK_NEWREF && aother == AK_REFCOUNTED 
	   && sRef_isConst (other))
    {
      res->aliaskind = AK_NEWREF;
    }
  else if (aother == AK_NEWREF && ares == AK_REFCOUNTED
	   && sRef_isConst (res))
    {
      res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
      res->aliaskind = AK_NEWREF;
    }
  else if (sRef_isLocalVar (res)
	   && ((ares == AK_KEPT && aother == AK_LOCAL)
	       || (aother == AK_KEPT && ares == AK_LOCAL)))
    {
      res->aliaskind = AK_KEPT;
    }
  else if ((ares == AK_OWNED && aother == AK_ONLY)
	   || (aother == AK_OWNED && ares == AK_ONLY))
    {
      res->aliaskind = AK_OWNED;

      if (aother == AK_OWNED)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	}
    }
  else
    {
      hasError = TRUE;
    }

  if (hasError)
    {
      if (sRef_isThroughArrayFetch (res))
	{
	  if (optgenerror2 
	      (FLG_BRANCHSTATE, FLG_STRICTBRANCHSTATE,
	       message
	       ("Clauses exit with %q possibly referencing %s storage %s, "
		"%s storage %s", 
		sRef_unparse (res),
		alkind_unparse (aother),
		clause_nameTaken (cl),
		alkind_unparse (ares),
		clause_nameAlternate (cl)),
	       loc))
	    {
	      sRef_showAliasInfo (res);
	      sRef_showAliasInfo (other);
	      res->aliaskind = AK_ERROR;
	    }
	  else
	    {
	      if (ares == AK_KEPT || aother == AK_KEPT)
		{
		  sRef_maybeKill (res, loc);
		}
	    }
	}
      else 
	{
	  if (optgenerror 
	      (FLG_BRANCHSTATE,
	       message ("Clauses exit with %q referencing %s storage %s, "
			"%s storage %s", 
			sRef_unparse (res),
			alkind_unparse (aother),
			clause_nameTaken (cl),
			alkind_unparse (ares),
			clause_nameAlternate (cl)),
	       loc))
	    {
	      sRef_showAliasInfo (res);
	      sRef_showAliasInfo (other);
	      
	      res->aliaskind = AK_ERROR;
	    }
	}
      
      res->aliaskind = (sRef_isLocalVar (res) ? AK_LOCAL : AK_UNKNOWN);
    }
}

static void 
  sRef_combineAliasKinds (/*@notnull@*/ sRef res, /*@notnull@*/ sRef other, 
			  clause cl, fileloc loc)
{
  alkind ares = sRef_getAliasKind (res);
  alkind aother = sRef_getAliasKind (other);

  sRef_checkMutable (res);

  DPRINTF (("Combine alias kinds: \n\t%s / \n\t%s",
	    sRef_unparseFull (res), sRef_unparseFull (other)));
  if (alkind_equal (ares, aother)
      || aother == AK_UNKNOWN
      || aother == AK_ERROR)
    {
      ; /* keep current state */
    }
  else if (sRef_isDead (res) || sRef_isDead (other))
    {
      /* dead error reported (or storage is dead) */
      res ->aliaskind = AK_ERROR; 
    }
  else if (ares == AK_UNKNOWN || ares == AK_ERROR
	   || sRef_isStateUndefined (res)
	   || sRef_isDefinitelyNull (res))
    { 
      res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
      res->aliaskind = aother;  
    }
  else if (sRef_isStateUndefined (other)
	   || sRef_isDefinitelyNull (other))
    {
      ;
    }
  else if (((ares == AK_UNIQUE || alkind_isTemp (ares))
	    && aother == AK_LOCAL) 
	   || ((aother == AK_UNIQUE || alkind_isTemp (aother))
	       && ares == AK_LOCAL))
    {
      if (ares != AK_LOCAL)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	}

      res->aliaskind = AK_LOCAL;
    }
  else if ((ares == AK_OWNED && aother == AK_FRESH) 
	   || (aother == AK_OWNED && ares == AK_FRESH))
    {
      if (ares != AK_FRESH)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	}
      
      res->aliaskind = AK_FRESH;
    }
  else if ((ares == AK_KEEP && aother == AK_FRESH) ||
	   (aother == AK_KEEP && ares == AK_FRESH))
    {
      if (ares != AK_KEEP)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	}
      
      res->aliaskind = AK_KEEP;
    }
  else if ((ares == AK_LOCAL && aother == AK_STACK) ||
	   (aother == AK_LOCAL && ares == AK_STACK))
    {
      if (ares != AK_STACK)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	}

      res->aliaskind = AK_STACK;
    }
  else if ((ares == AK_LOCAL
	    && (aother == AK_OWNED && sRef_isLocalVar (other)))
	   || (aother == AK_LOCAL 
	       && (ares == AK_OWNED && sRef_isLocalVar (res))))
    {
      if (ares != AK_LOCAL)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	}

      res->aliaskind = AK_LOCAL;
    }
  else if ((ares == AK_FRESH && alkind_isOnly (aother))
	   || (aother == AK_FRESH && alkind_isOnly (ares)))
    {
      res->aliaskind = AK_FRESH;
    }
  else if ((aother == AK_FRESH && sRef_definitelyNull (res))
	   || (ares == AK_FRESH && sRef_definitelyNull (other)))
    {
      if (ares != AK_FRESH)
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	  res->aliaskind = AK_FRESH;
	}
    }
  else if ((sRef_isFresh (res) && sRef_isConst (other))
	   || (sRef_isFresh (other) && sRef_isConst (res)))
    {
      /*
      ** for NULL constantants
      ** this is bogus!
      */

      if (!sRef_isFresh (res))
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	}

      res->aliaskind = AK_FRESH;
    }
  else if ((alkind_isStatic (aother) && sRef_isConst (res))
	   || (alkind_isStatic (ares) && sRef_isConst (other)))
    {
      if (!alkind_isStatic (ares))
	{
	  res->aliasinfo = stateInfo_update (res->aliasinfo, other->aliasinfo);
	  res->aliaskind = AK_STATIC;
	}
    }
  else
    {
      sRef_combineAliasKindsError (res, other, cl, loc);
    }
}

static void sRef_combineDefState (/*@notnull@*/ sRef res, 
				  /*@notnull@*/ sRef other)
{
  sstate s1 = res->defstate;
  sstate s2 = other->defstate;
  bool flip = FALSE;

  sRef_checkMutable (res);

  if (s1 == s2 || s2 == SS_UNKNOWN)
    {
      ;
    }
  else if (s1 == SS_UNKNOWN)
    {
      flip = TRUE;
    }
  else
    {
      switch (s1)
	{
	case SS_FIXED:   
	  if (s2 == SS_DEFINED) 
	    {
	      break;
	    }
	  else
	    {
	      llcontbuglit ("ssfixed: not implemented");
	      flip = TRUE;
	    }
	  break;
	case SS_DEFINED: 
	  flip = TRUE;
	  break;
	case SS_PDEFINED:
	case SS_ALLOCATED: 
	  flip = (s2 != SS_DEFINED);
	  break;
	case SS_HOFFA:
	case SS_RELDEF:
	case SS_UNUSEABLE: 
	case SS_UNDEFINED: 
	case SS_PARTIAL:
	case SS_UNDEFGLOB:
	case SS_KILLED:
	case SS_DEAD:      
	case SS_SPECIAL: 
	  break;
	BADDEFAULT;
	}
    }

  if (flip)
    {
      res->definfo = stateInfo_update (res->definfo, other->definfo);
      res->defstate = s2;
    }
}

extern /*@notnull@*/ sRef sRef_getConjA (sRef s)
{
  sRef ret;
  llassert (sRef_isConj (s));

  ret = s->info->conj->a;
  llassert (ret != NULL);
  return ret;
}

extern /*@notnull@*/ sRef sRef_getConjB (sRef s)
{
  sRef ret;
  llassert (sRef_isConj (s));

  ret = s->info->conj->b;
  llassert (ret != NULL);
  return ret;
}
  
extern /*@exposed@*/ sRef sRef_makeArrow (sRef s, /*@dependent@*/ cstring f)
{
  sRef p;
  sRef ret;
  
  p = sRef_makePointer (s);
  ret = sRef_makeField (p, f);
  DPRINTF (("Arrow: %s => %s",
	    sRef_unparseFull (s), sRef_unparseFull (ret)));
  return ret;
}

extern /*@exposed@*/ sRef sRef_buildArrow (sRef s, cstring f)
{
  sRef p;
  sRef ret;

  p = sRef_buildPointer (s);
  ret = sRef_buildField (p, f);
  
  return ret;
}

static /*@null@*/ sinfo sinfo_copy (/*@notnull@*/ sRef s)
{
  sinfo ret;

  switch (s->kind)
    {
    case SK_CVAR:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->cvar = (cref) dmalloc (sizeof (*ret->cvar));
      ret->cvar->lexlevel = s->info->cvar->lexlevel; 
      ret->cvar->index = s->info->cvar->index; 
      break;

    case SK_PARAM:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->paramno = s->info->paramno; 
      llassert (ret->paramno >= -1);
      break;

    case SK_ARRAYFETCH:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->arrayfetch = (ainfo) dmalloc (sizeof (*ret->arrayfetch));
      ret->arrayfetch->indknown = s->info->arrayfetch->indknown;
      ret->arrayfetch->ind = s->info->arrayfetch->ind;
      ret->arrayfetch->arr = s->info->arrayfetch->arr; 
      break;

    case SK_FIELD:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->field = (fldinfo) dmalloc (sizeof (*ret->field));
      ret->field->rec = s->info->field->rec; 
      ret->field->field = s->info->field->field; 
      break;

    case SK_OBJECT:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->object = s->info->object;
      break;

    case SK_PTR:
    case SK_ADR:
    case SK_DERIVED:
    case SK_EXTERNAL:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->ref = s->info->ref; /* Ref_copy (s->info->ref); */
      break;

    case SK_CONJ:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->conj = (cjinfo) dmalloc (sizeof (*ret->conj));
      ret->conj->a = s->info->conj->a; /* sRef_copy (s->info->conj->a); */
      ret->conj->b = s->info->conj->b; /* sRef_copy (s->info->conj->b);*/
      break;
    case SK_SPECIAL:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->spec = s->info->spec;
      break;

    case SK_UNCONSTRAINED:
    case SK_NEW:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->fname = s->info->fname;
      break;

    case SK_RESULT:
    case SK_CONST:
    case SK_TYPE:
    case SK_UNKNOWN:
      llassertprint (s->info == NULL, ("s = %s", sRef_unparse (s)));
      ret = NULL;
      break;
    }

  return ret;
}

static /*@null@*/ sinfo sinfo_fullCopy (/*@notnull@*/ sRef s)
{
  sinfo ret;

  /*
  ** Since its a full copy, only storage is assigned
  ** to dependent fields.
  */
  /*@-onlytrans@*/

  switch (s->kind)
    {
    case SK_CVAR:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->cvar = (cref) dmalloc (sizeof (*ret->cvar));
      ret->cvar->lexlevel = s->info->cvar->lexlevel; 
      ret->cvar->index = s->info->cvar->index; 
      break;

    case SK_PARAM:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->paramno = s->info->paramno; 
      llassert (ret->paramno >= -1);
      break;

    case SK_ARRAYFETCH:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->arrayfetch = (ainfo) dmalloc (sizeof (*ret->arrayfetch));
      ret->arrayfetch->indknown = s->info->arrayfetch->indknown;
      ret->arrayfetch->ind = s->info->arrayfetch->ind;
      ret->arrayfetch->arr = sRef_saveCopy (s->info->arrayfetch->arr);
      break;

    case SK_FIELD:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->field = (fldinfo) dmalloc (sizeof (*ret->field));
      ret->field->rec = sRef_saveCopy (s->info->field->rec);
      ret->field->field = s->info->field->field; 
      break;

    case SK_OBJECT:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->object = s->info->object;
      break;

    case SK_PTR:
    case SK_ADR:
    case SK_DERIVED:
    case SK_EXTERNAL:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->ref = sRef_saveCopy (s->info->ref);	 
      break;

    case SK_CONJ:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->conj = (cjinfo) dmalloc (sizeof (*ret->conj));
      ret->conj->a = sRef_saveCopy (s->info->conj->a);
      ret->conj->b = sRef_saveCopy (s->info->conj->b);
      break;
    case SK_SPECIAL:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->spec = s->info->spec;
      break;
    case SK_NEW:
    case SK_UNCONSTRAINED:
      ret = (sinfo) dmalloc (sizeof (*ret));
      ret->fname = s->info->fname;
      break;
    case SK_CONST:
    case SK_TYPE:
    case SK_RESULT:
    case SK_UNKNOWN:
      llassert (s->info == NULL);
      ret = NULL;
      break;
    }
  /*@=onlytrans@*/ 
  return ret;
}


static void 
  sinfo_update (/*@notnull@*/ /*@exposed@*/ sRef res, 
		/*@notnull@*/ /*@exposed@*/ sRef other)
{
  llassert (res->kind == other->kind);

  switch (res->kind)
    {
    case SK_CVAR:
      res->info->cvar->lexlevel = other->info->cvar->lexlevel; 
      res->info->cvar->index = other->info->cvar->index; 
      break;

    case SK_PARAM:
      res->info->paramno = other->info->paramno; 
      llassert (res->info->paramno >= -1);
      break;

    case SK_ARRAYFETCH:
      res->info->arrayfetch->indknown = other->info->arrayfetch->indknown;
      res->info->arrayfetch->ind = other->info->arrayfetch->ind;
      res->info->arrayfetch->arr = other->info->arrayfetch->arr;
      break;

    case SK_FIELD:
      res->info->field->rec = other->info->field->rec;
      res->info->field->field = other->info->field->field; 
      break;

    case SK_OBJECT:
      res->info->object = other->info->object;
      break;

    case SK_PTR:
    case SK_ADR:
    case SK_DERIVED:
    case SK_EXTERNAL:
      res->info->ref = other->info->ref;	 
      break;

    case SK_CONJ:
      res->info->conj->a = other->info->conj->a;
      res->info->conj->b = other->info->conj->b;
      break;

    case SK_SPECIAL:
      res->info->spec = other->info->spec;
      break;

    case SK_NEW:
    case SK_UNCONSTRAINED:
      res->info->fname = other->info->fname;
      break;

    case SK_CONST:
    case SK_TYPE:
    case SK_UNKNOWN:
    case SK_RESULT:
      llassert (res->info == NULL);
      break;
    }
}

static void sinfo_free (/*@special@*/ /*@temp@*/ /*@notnull@*/ sRef s)
   /*@uses s->kind, s->info@*/
   /*@releases s->info@*/ 
{
  switch (s->kind)
    {
    case SK_CVAR:
      DPRINTF (("Free sinfo: [%p]", s->info->cvar));
      sfree (s->info->cvar);
      break;

    case SK_PARAM:
      break;

    case SK_ARRAYFETCH:
      DPRINTF (("Free sinfo: [%p]", s->info->arrayfetch));
      sfree (s->info->arrayfetch);
      break;

    case SK_FIELD:
      DPRINTF (("Free sinfo: [%p]", s->info->field));
      sfree (s->info->field); 
      break;

    case SK_OBJECT:
      break;

    case SK_PTR:
    case SK_ADR:
    case SK_DERIVED:
    case SK_EXTERNAL: /* is copy now! */
      break;

    case SK_CONJ:
      DPRINTF (("Free sinfo: [%p]", s->info->conj));
      sfree (s->info->conj);
      break;

    case SK_UNCONSTRAINED:
    case SK_SPECIAL:
    case SK_CONST:
    case SK_NEW:
    case SK_TYPE:
    case SK_UNKNOWN:
    case SK_RESULT:
      break;
    }

  if (s->info != NULL) {
      DPRINTF (("Free sinfo: [%p]", s->info));
  }

  sfree (s->info);
}

bool sRef_isNSLocalVar (sRef s)  
{
  if (sRef_isLocalVar (s))
    {
      uentry ue = sRef_getUentry (s);

      return (!uentry_isStatic (ue));
    }
  else
    {
      return FALSE;
    }
}

bool sRef_isLocalVar (sRef s)  
{
  if (sRef_isValid(s))
    {
      return (s->kind == SK_CVAR 
	      && (s->info->cvar->lexlevel > fileScope));
    }
  
  return FALSE;
}

bool sRef_isRealLocalVar (sRef s)  
{
  if (sRef_isValid(s))
    {
      if (s->kind == SK_CVAR)
	{
	  if (s->info->cvar->lexlevel == functionScope)
	    {
	      uentry ue = sRef_getUentry (s);

	      if (uentry_isAnyParam (ue)
		  || uentry_isRefParam (ue))
		{
		  return FALSE;
		}
	      else
		{
		  return TRUE;
		}
	    }
	  else
	    {
	      return (s->info->cvar->lexlevel > functionScope);
	    }
	}
    }
  
  return FALSE;
}

bool sRef_isLocalParamVar (sRef s)  
{
  if (sRef_isValid(s))
    {
      return (s->kind == SK_PARAM
	      || (s->kind == SK_CVAR 
		  && (s->info->cvar->lexlevel > fileScope)));
    }
  
  return FALSE;
}

static speckind speckind_fromInt (int i)
{
  /*@+enumint@*/ 
  llassert (i >= SR_NOTHING && i <= SR_SYSTEM); 
  /*@=enumint@*/

  return ((speckind) i);
}


static void sRef_updateNullState (/*@notnull@*/ sRef res, /*@notnull@*/ sRef other)
     /*@modifies res@*/
{
  res->nullstate = other->nullstate;
  DPRINTF (("update null state==> %s", sRef_unparseFull (res)));
  res->nullinfo = stateInfo_update (res->nullinfo, other->nullinfo);
  sRef_resetAliasKind (res);
}

void sRef_combineNullState (/*@notnull@*/ sRef res, /*@notnull@*/ sRef other)
{
  nstate n1 = sRef_getNullState (res);
  nstate n2 = sRef_getNullState (other);
  bool flip = FALSE;
  nstate nn = n1;

  if (n1 == n2 || n2 == NS_UNKNOWN)
    {
      ;
    }
  else
    {
      /* note: n2 is not unknown or defnull */

      switch (n1)
	{
	case NS_ERROR:   nn = NS_ERROR; break;
	case NS_UNKNOWN: flip = TRUE; nn = n2; break; 
	case NS_POSNULL: break;
	case NS_DEFNULL: nn = NS_POSNULL; break;
	case NS_RELNULL: break;
	case NS_NOTNULL:  
	  if (n2 == NS_MNOTNULL)
	    {
	      ;
	    }
	  else 
	    { 
	      flip = TRUE;
	      nn = NS_POSNULL; 
	    }
	  break;
	case NS_MNOTNULL: 
	  if (n2 == NS_NOTNULL) 
	    {
	      nn = NS_NOTNULL; 
	    }
	  else 
	    {
	      flip = TRUE;
	      nn = NS_POSNULL; 
	    }
	  break;
	case NS_CONSTNULL:
	case NS_ABSNULL:
	  flip = TRUE;
	  nn = n2;
	}
    }
  
  if (flip)
    {
      res->nullinfo = stateInfo_update (res->nullinfo, other->nullinfo);      
    }

  res->nullstate = nn;
  DPRINTF (("update null state==> %s", sRef_unparseFull (res)));
  sRef_resetAliasKind (res);
}

cstring sRef_nullMessage (sRef s)
{
  llassert (sRef_isReasonable (s));

  switch (sRef_getNullState (s))
    {
    case NS_DEFNULL:
    case NS_CONSTNULL:
      return (cstring_makeLiteralTemp ("null"));
    default:
      return (cstring_makeLiteralTemp ("possibly null"));
    }
  BADEXIT;
}

/*@observer@*/ cstring sRef_ntMessage (sRef s)
{
  llassert (sRef_isReasonable (s));

  switch (s->nullstate)
    {
    case NS_DEFNULL:
    case NS_CONSTNULL:
      return (cstring_makeLiteralTemp ("not nullterminated"));
    default:
      return (cstring_makeLiteralTemp ("possibly non-nullterminated"));
    }
  BADEXIT;
}



sRef sRef_fixResultType (/*@returned@*/ sRef s, ctype typ, uentry ue)
{
  sRef tmp = sRef_undefined;
  sRef ret;

  llassert (sRef_isReasonable (s));

  switch (s->kind)
    {
    case SK_RESULT:
      s->type = typ;
      ret = s;
      break;
    case SK_ARRAYFETCH:
      {
	ctype ct;
	tmp = sRef_fixResultType (s->info->arrayfetch->arr, typ, ue);

	ct = ctype_realType (sRef_getType (tmp));

	
	if (ctype_isKnown (ct))
	  {
	    if (ctype_isAP (ct))
	      {
		;
	      }
	    else
	      {
		voptgenerror 
		  (FLG_TYPE,
		   message
		   ("Special clause indexes non-array (%t): *%q",
		    ct, sRef_unparse (s->info->arrayfetch->arr)),
		   uentry_whereLast (ue));
	      }
	  }

	tmp = sRef_fixResultType (s->info->arrayfetch->arr, typ, ue);

	if (s->info->arrayfetch->indknown)
	  {
	    ret = sRef_makeArrayFetchKnown (tmp, s->info->arrayfetch->ind);
	  }
	else
	  {
	    ret = sRef_makeArrayFetch (tmp);
	  }
      }
      break;
    case SK_FIELD:
      {
	sRef rec = sRef_fixResultType (s->info->field->rec, typ, ue);
	ctype ct = ctype_realType (sRef_getType (rec));

	if (ctype_isKnown (ct))
	  {
	    if (ctype_isSU (ct))
	      {
		if (uentry_isValid (uentryList_lookupField (ctype_getFields (ct), 
							    s->info->field->field)))
		  {
		    ;
		  }
		else
		  {
		    voptgenerror 
		      (FLG_TYPE,
		       message
		       ("Special clause accesses non-existent field of result: %q.%s",
			sRef_unparse (rec), s->info->field->field),
		       uentry_whereLast (ue));
		  }
	      }
	    else
	      {
		voptgenerror 
		  (FLG_TYPE,
		   message
		   ("Special clause accesses field of non-struct or union result (%t): %q.%s",
		    ct, sRef_unparse (rec), s->info->field->field),
		   uentry_whereLast (ue));
	      }
	  }
	
	ret = sRef_makeField (tmp, s->info->field->field);
	break;
      }
    case SK_PTR:
      {
	ctype ct;
	tmp = sRef_fixResultType (s->info->ref, typ, ue);

	ct = ctype_realType (sRef_getType (tmp));

	if (ctype_isKnown (ct))
	  {
	    if (ctype_isAP (ct))
	      {
		;
	      }
	    else
	      {
		voptgenerror 
		  (FLG_TYPE,
		   message
		   ("Special clause dereferences non-pointer (%t): *%q",
		    ct, sRef_unparse (s->info->ref)),
		   uentry_whereLast (ue));
	      }
	  }
	
	ret = sRef_makePointer (tmp);
	break;
      }
    case SK_ADR:
      voptgenerror 
	(FLG_TYPE,
	 message
	 ("Special clause uses & operator (not allowed): &%q", sRef_unparse (s->info->ref)),
	 uentry_whereLast (ue));
      ret = s;
      break;
    BADDEFAULT;
    }

  return ret;
}

bool sRef_isOnly (sRef s)
{
  return (sRef_isValid(s) && alkind_isOnly (s->aliaskind));
}

bool sRef_isDependent (sRef s) 
{
  return (sRef_isValid(s) && alkind_isDependent (s->aliaskind));
}

bool sRef_isOwned (sRef s)
{
  return (sRef_isReasonable (s) && (s->aliaskind == AK_OWNED));
}

bool sRef_isKeep (sRef s) 
{
  return (sRef_isReasonable (s) && (s->aliaskind == AK_KEEP));
}

bool sRef_isTemp (sRef s)
{
  return (sRef_isReasonable (s) && alkind_isTemp (s->aliaskind));
}

bool sRef_isLocalState (sRef s) 
{
  return (sRef_isReasonable (s) && (s->aliaskind == AK_LOCAL));
}

bool sRef_isUnique (sRef s)
{
  return (sRef_isReasonable (s) && (s->aliaskind == AK_UNIQUE));
}

bool sRef_isShared (sRef s) 
{
  return (sRef_isReasonable (s) && (s->aliaskind == AK_SHARED));
}

bool sRef_isExposed (sRef s) 
{
  return (sRef_isReasonable (s) && (s->expkind == XO_EXPOSED));
}

bool sRef_isObserver (sRef s) 
{
  return (sRef_isReasonable (s) && (s->expkind == XO_OBSERVER));
}

bool sRef_isFresh (sRef s) 
{
  return (sRef_isReasonable (s) && (s->aliaskind == AK_FRESH));
}

bool sRef_isDefinitelyNull (sRef s) 
{
  return (sRef_isReasonable (s) && (sRef_getNullState (s) == NS_DEFNULL 
			       || sRef_getNullState (s) == NS_CONSTNULL));
}

bool sRef_isAllocated (sRef s)
{
  return (sRef_isReasonable (s) && (s->defstate == SS_ALLOCATED));
}

bool sRef_isStack (sRef s)
{
  return (sRef_isReasonable (s) && (s->aliaskind == AK_STACK));
}

bool sRef_isNotNull (sRef s)
{
  return (sRef_isValid(s) && (sRef_getNullState (s) == NS_MNOTNULL 
			      || sRef_getNullState (s) == NS_NOTNULL));
}

alkind sRef_getAliasKind (sRef s)
{
  if (sRef_isValid(s)) {
    llassert (alkind_isValid (s->aliaskind));
    return s->aliaskind;
  }

  return AK_ERROR;
}

nstate sRef_getNullState (sRef s)
{
  if (sRef_isReasonable (s)) {
    llassert (nstate_isValid (s->nullstate));
    return s->nullstate;
  }
  
  return NS_UNKNOWN;
}

void sRef_reflectAnnotation (sRef s, annotationInfo a, fileloc loc)
{
  if (sRef_isReasonable (s))
    {
      if (!valueTable_isDefined (s->state))
	{
	  s->state = valueTable_create (1);
	  valueTable_insert
	    (s->state, 
	     cstring_copy (metaStateInfo_getName (annotationInfo_getState (a))),
	     stateValue_create (annotationInfo_getValue (a), 
				stateInfo_makeLoc (loc, SA_DECLARED)));
	}
      else
	{
	  DPRINTF (("reflect loc: %s", fileloc_unparse (loc)));
	  valueTable_update 
	    (s->state,
	     metaStateInfo_getName (annotationInfo_getState (a)),
	     stateValue_create (annotationInfo_getValue (a),
				stateInfo_makeLoc (loc, SA_DECLARED)));
	  
	  DPRINTF (("sref: %s", sRef_unparse (s)));
	  DPRINTF (("sref: %s", sRef_unparseFull (s)));
	}
    }
}

void sRef_setMetaStateValueComplete (sRef s, cstring key, int value, fileloc loc)
{
  sRefSet aliases = usymtab_allAliases (s);

  sRef_setMetaStateValue (s, key, value, loc);

  sRefSet_realElements (aliases, current)
    {
      if (sRef_isReasonable (current))
	{
	  current = sRef_updateSref (current);
	  sRef_setMetaStateValue (current, key, value, loc);
	}
    } end_sRefSet_realElements ;

  sRefSet_free (aliases);
}

void sRef_setMetaStateValue (sRef s, cstring key, int value, fileloc loc)
{
  sRef_checkMutable (s);

  if (sRef_isReasonable (s))
    {
      if (!valueTable_isDefined (s->state))
	{
	  DPRINTF (("inserting state: %s: %s %d", sRef_unparse (s), key, value));
	  s->state = valueTable_create (1);
	  valueTable_insert (s->state, cstring_copy (key),
			     stateValue_create (value, 
						stateInfo_makeLoc (loc, SA_CHANGED)));
	}
      else
	{
	  DPRINTF (("Updating state: %s: %s %d / %s", sRef_unparse (s), key, value,
		    fileloc_unparse (loc)));
	  if (valueTable_contains (s->state, key))
	    {
	      valueTable_update 
		(s->state, key, stateValue_create (value,
						   stateInfo_makeLoc (loc, SA_CHANGED)));
	    }
	  else
	    {
	      valueTable_insert 
		(s->state, cstring_copy (key),
		 stateValue_create (value, stateInfo_makeLoc (loc, SA_CHANGED)));
	    }

	  DPRINTF (("After: %s", sRef_unparseFull (s)));
	}
    }
}

bool sRef_checkMetaStateValue (sRef s, cstring key, int value)
{
  if (sRef_isReasonable (s))
    {
      if (valueTable_isDefined (s->state))
	{
	  stateValue val;
	  
	  DPRINTF (("check state: %s: %s %d", sRef_unparse (s), key, value));
	  
	  val = valueTable_lookup (s->state, key);
	  llassert (stateValue_isDefined (val));
	  return (stateValue_isError (val)
		  || stateValue_getValue (val) == value);
	}
      else
	{
	  return TRUE;
	}
    }
  else
    {
      return TRUE;
    }
}

/*@observer@*/ stateValue sRef_getMetaStateValue (sRef s, cstring key)
{
  if (sRef_isReasonable (s))
    {
      if (valueTable_isDefined (s->state))
	{
	  stateValue val;
	  
	  val = valueTable_lookup (s->state, key);
	  /* Okay if its not defined, just returns stateValue_undefined */
	  return val;
	}
      else
	{
	  return stateValue_undefined;
	}
    }
  else
    {
      return stateValue_undefined;
    }
}

/*@observer@*/ valueTable sRef_getValueTable (sRef s) 
{
  DPRINTF (("Get value table: %s", sRef_unparse (s)));

  if (sRef_isReasonable (s)) 
    {
      llassert (sRef_isReasonable (s));
      DPRINTF (("Value table: %s", valueTable_unparse (s->state)));
      return s->state;
    }  
  else 
    {
      DPRINTF (("No value table!"));
      return valueTable_undefined;
    }
}

bool sRef_makeStateSpecial (sRef s)
{
  /*
  ** Default defined state can be made special.
  */

  llassert (sRef_isReasonable (s));

  if (s->defstate == SS_UNKNOWN || s->defstate == SS_DEFINED || s->defstate == SS_SPECIAL)
    {
      /* s->aliaskind = AK_IMPTEMP; */ /* evans 2001-07-23 shouldn't effect alias state */
      s->defstate = SS_SPECIAL;
      DPRINTF (("Made special: %s", sRef_unparseFull (s)));
      return TRUE;
    }
  else
    {
      /* s->aliaskind = AK_IMPTEMP; */
      s->defstate = SS_SPECIAL;
      return FALSE;
    }
}

void sRef_markImmutable (sRef s)
{
  if (sRef_isReasonable (s))
    {
      DPRINTF (("Mark immutable: %s", sRef_unparseFull (s)));
      s->immut = TRUE;
    }
}

bool sRef_definitelyNullContext (sRef s)
{
  return (sRef_definitelyNull (s)
	  || usymtab_isDefinitelyNullDeep (s));
}

bool sRef_definitelyNullAltContext (sRef s)
{
  return (sRef_definitelyNull (s)
	  || usymtab_isAltDefinitelyNullDeep (s));
}


/* start modifications */
struct s_bbufinfo sRef_getNullTerminatedState (sRef p_s) {
   struct s_bbufinfo BUFSTATE_UNKNOWN;
   BUFSTATE_UNKNOWN.bufstate = BB_NOTNULLTERMINATED;
   BUFSTATE_UNKNOWN.size = 0;
   BUFSTATE_UNKNOWN.len = 0;
   
   if (sRef_isValid(p_s))
      return p_s->bufinfo;
   return BUFSTATE_UNKNOWN; 
}

void sRef_setNullTerminatedState(sRef p_s) {
   if(sRef_isReasonable (p_s)) {
      p_s->bufinfo.bufstate = BB_NULLTERMINATED;
   } else {
      llfatalbug( message("sRef_setNT passed a invalid sRef\n"));
   }
}


void sRef_setPossiblyNullTerminatedState(sRef p_s) {
   if( sRef_isReasonable (p_s)) {
      p_s->bufinfo.bufstate = BB_POSSIBLYNULLTERMINATED;
   } else {
      llfatalbug( message("sRef_setPossNT passed a invalid sRef\n"));
   }
}

void sRef_setNotNullTerminatedState(sRef p_s) {
   if( sRef_isReasonable (p_s)) {
      p_s->bufinfo.bufstate = BB_NOTNULLTERMINATED;
   } else {
      llfatalbug( message("sRef_unsetNT passed a invalid sRef\n"));
   }
}

void sRef_setLen(sRef p_s, int len) {
   if (sRef_isReasonable (p_s) && sRef_isNullTerminated(p_s)) 
     {
       p_s->bufinfo.len = len;
     } 
   else 
     {
       llfatalbug( message("sRef_setLen passed an invalid sRef\n"));
     }
}
    

void sRef_setSize(sRef p_s, int size) {
   if( sRef_isValid(p_s)) 
     {
       p_s->bufinfo.size = size;
     } 
   else
     {
       llfatalbug( message("sRef_setSize passed a invalid sRef\n"));
     }
}

void sRef_resetLen(sRef p_s) {
  if (sRef_isReasonable (p_s)) 
    {
      p_s->bufinfo.len = 0;
    }
  else
    {
      llfatalbug (message ("sRef_setLen passed an invalid sRef\n"));
    }
}

/*drl7x 11/28/2000 */

bool sRef_isFixedArray (sRef p_s) /*@*/ {
  ctype c;
  c = sRef_getType (p_s);
  return ( ctype_isFixedArray (c) );
}

size_t sRef_getArraySize (sRef p_s) /*@*/ 
{
  ctype c;
  llassert (sRef_isFixedArray(p_s) );
  DPRINTF (( message ("sRef_getArraySize getting array size for %s", sRef_unparse(p_s) )  ));
  
  c = sRef_getType (p_s);
  return (ctype_getArraySize (c));
}

void sRef_setValue (sRef s, multiVal val)
{
  if (!sRef_isReasonable (s))
    {
      llcontbuglit ("Unreasonable sRef");
      llcontbug (message ("sRef: %s", sRef_unparse (s)));
      return;
    }

  multiVal_free (s->val);
  s->val = val;
}

bool sRef_hasValue (sRef s)
{
  return (sRef_isReasonable (s)
	  && multiVal_isDefined (s->val));
}

multiVal sRef_getValue (sRef s)
{
  if (sRef_isReasonable (s))
    {
      return s->val;
    }

  return multiVal_undefined;
}
splint-3.1.2.dfsg1/src/lcllib.c0000644021234200000250000003261610052457403013647 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** lcllib.c
**
** routines for loading and creating library files
**
** this is a brute-force implementation, a more efficient
** representation should be designed.
**
*/

/*
 * Herbert 02/17/2002:
 * - fixed the recognition of Posix headers for OS/2
 */

# include "splintMacros.nf"
# include "basic.h"
# include "osd.h"
# include "version.h"

# include "gram.h"
# include "lclscan.h"

# include "lcllib.h"
# include "llmain.h"

/*@-incondefs@*/ /*@-redecl@*/
extern /*:open:*/ /*@dependent@*/ FILE *yyin;
/*@=incondefs@*/ /*@=redecl@*/

/*@constant int NUMLIBS; @*/
# define NUMLIBS 25

/*@constant int NUMPOSIXLIBS; @*/
# define NUMPOSIXLIBS 18

static ob_mstring posixlibs[NUMPOSIXLIBS] = 
{
  "dirent",
  "fcntl",
  "grp",
  "pwd",
  "regex",
  "sys/stat",
  "sys/times",
  "sys/types", 
  "netdb", /* unix */
  "netinet/in", /* unix */
  "sys/resource", /* unix */
  "sys/socket", /* not posix */
  "sys/syslog", /* not posix */
  "sys/utsname",
  "sys/wait",
  "termios",
  "unistd",
  "utime"
} ;

static ob_mstring stdlibs[NUMLIBS] =
{
  "assert", 
  "complex"
  "ctype",
  "errno",
  "fenv",
  "float",
  "inttypes",
  "iso646",
  "limits",
  "locale",
  "math", 
  "setjmp",
  "signal",
  "stdarg",
  "stdbool",
  "stddef",
  "stdint",
  "stdio",
  "stdlib",
  "string",
  "strings", /* some systems use this...they shouldn't */
  "tgmath",
  "time",
  "wchar",
  "wctype"
} ;

static bool loadLCDFile (FILE * p_f, cstring p_name);

bool
lcllib_isSkipHeader (cstring sname)
{
  int i;
  bool posixlib = FALSE;
  char *libname;
  char *matchname;
  cstring xname;

  llassert (cstring_isDefined (sname));
  xname = fileLib_withoutExtension (sname, cstring_makeLiteralTemp (".h"));

  DPRINTF (("Include? %s", sname));

  /*@access cstring@*/
  llassert (cstring_isDefined (xname));
# if defined (OS2)
  {
    /* Posixlibs use forward slashes, so we use them here, too */
    cstring_replaceAll (xname, '\\', '/');
    libname = strrchr (xname, '/');
    DPRINTF (("libname: %s", libname));
  }
# else
  libname = strrchr (xname, CONNECTCHAR);
# endif
  matchname = libname;

  if (libname == NULL) 
    {
      libname = xname;
    }
  else
    {
      libname++;
      /*@-branchstate@*/
    }
  /*@=branchstate@*/

  if (mstring_equal (libname, "varargs"))
    {
      fileloc tmp = fileloc_makePreprocPrevious (g_currentloc);
      
      voptgenerror 
	(FLG_USEVARARGS,
	 message ("Include file <%s.h> is inconsistent with "
		  "ANSI library (should use )",
		  cstring_fromChars (libname)),
	 tmp);
      
      fileloc_free (tmp);
      cstring_free (xname);
      return TRUE;
    }

  if (context_getFlag (FLG_SKIPISOHEADERS)
      && context_usingAnsiLibrary ())
    {
      for (i = 0; i < NUMLIBS; i++)
	{
	  if (mstring_equal (libname, stdlibs[i]))
	    {
	      sfree (xname);
	      return TRUE;
	    }
	}
    }

  for (i = 0; i < NUMPOSIXLIBS; i++)
    {
      if (strchr (posixlibs[i], CONNECTCHAR) != NULL
# if defined (OS2)
	  || strchr (posixlibs[i], ALTCONNECTCHAR) != NULL
# endif
	  )
	{
	  char *ptr;
	  
	  DPRINTF (("xname: %s, posix: %s", xname, posixlibs[i]));
	  if ((ptr = strstr (xname, posixlibs[i])) != NULL) 
	    {
	      if (ptr[strlen (posixlibs[i])] == '\0')
		{
		  posixlib = TRUE;
		  matchname = ptr;
		  break;
		}
	      else
		{
		  ; /* no match */
		}
	    }
	}
      else
	{
	  if (mstring_equal (libname, posixlibs[i]))
	    {
	      posixlib = TRUE;
	      matchname = libname;
	      break;
	    }
	  /*@-branchstate@*/ 
	}
    } /*@=branchstate@*/
  
  if (posixlib)
    {
      if (context_usingPosixLibrary ())
	{
	  if (context_getFlag (FLG_SKIPPOSIXHEADERS))
	    {
	      cstring_free (xname);
	      /*@-nullstate@*/ 
	      return TRUE; 
	      /*@=nullstate@*/

	      /* evans 2002-03-02: 
		   the returned reference is possibly null,
  		   but this should not change the null state of the parameter
	      */
	    }
	}
      else
	{	
	  fileloc tmp = fileloc_makePreprocPrevious (g_currentloc);	      
	  
	  voptgenerror 
	    (FLG_WARNPOSIX,
	     message ("Include file <%s.h> matches the name of a "
		      "POSIX library, but the POSIX library is "
		      "not being used.  Consider using +posixlib "
		      "or +posixstrictlib to select the POSIX "
		      "library, or -warnposix "
		      "to suppress this message.",
		      cstring_fromChars (matchname)),
	     tmp);
	  
	  fileloc_free (tmp);
	}
    }

  cstring_free (xname);
  /*@noaccess cstring@*/
  /*@-nullstate@*/ /* same problem as above */
  return FALSE;
  /*@=nullstate@*/
}

static void printDot (void)
{
  displayScanContinue (cstring_makeLiteralTemp ("."));
}

void
dumpState (cstring cfname)
{
  FILE *f;
  cstring fname = fileLib_addExtension (cfname, cstring_makeLiteralTemp (DUMP_SUFFIX));
  
  f = fileTable_openWriteFile (context_fileTable (), fname);

  displayScanOpen (message ("Dumping to %s ", fname)); 
  
  if (f == NULL)
    {
      lldiagmsg (message ("Cannot open dump file for writing: %s", fname));
    }
  else
    {
      /*
      ** sequence is convulted --- must call usymtab_prepareDump before
      **    dumping ctype table to convert type uid's
      */

      printDot ();

      /*
      DPRINTF (("Before prepare dump:"));
      ctype_printTable ();
      DPRINTF (("Preparing dump..."));
      */

      usymtab_prepareDump ();

      /*
      ** Be careful, these lines must match loadLCDFile checking.
      */

      fprintf (f, "%s %s\n", LIBRARY_MARKER, cstring_toCharsSafe (fname));
      fprintf (f, ";;Splint %f\n", SPLINT_LIBVERSION);
      fprintf (f, ";;lib:%d\n", (int) context_getLibrary ());
      fprintf (f, ";;ctTable\n");
      
      DPRINTF (("Dumping types..."));
      printDot ();
      ctype_dumpTable (f);
      printDot ();
      
      DPRINTF (("Dumping type sets..."));
      fprintf (f, ";;tistable\n");
      typeIdSet_dumpTable (f);
      printDot ();
      
      DPRINTF (("Dumping usymtab..."));
      fprintf (f, ";;symTable\n");
      usymtab_dump (f);
      printDot ();

      DPRINTF (("Dumping modules..."));
      fprintf (f, ";; Modules access\n");
      context_dumpModuleAccess (f);
      fprintf (f, ";;End\n");
      check (fileTable_closeFile (context_fileTable (), f));
    }

  displayScanClose ();
  cstring_free (fname);
}

bool
loadStandardState ()
{
  cstring fpath;
  FILE *stdlib;
  bool result;
  cstring libname = fileLib_addExtension (context_selectedLibrary (), 
					  cstring_makeLiteralTemp (DUMP_SUFFIX));
  
  if (osd_findOnLarchPath (libname, &fpath) != OSD_FILEFOUND)
    {
      lldiagmsg (message ("Cannot find %sstandard library: %s", 
			  cstring_makeLiteralTemp 
			  (context_getFlag (FLG_STRICTLIB) ? "strict " 
			   : (context_getFlag (FLG_UNIXLIB) ? "unix " : "")),
			  libname));
      lldiagmsg (cstring_makeLiteral ("     Check LARCH_PATH environment variable."));
      result = FALSE;
    }
  else
    {
      stdlib = fileTable_openReadFile (context_fileTable (), fpath);

      if (stdlib == NULL)
	{
	  lldiagmsg (message ("Cannot read standard library: %s",
			      fpath));
	  lldiagmsg (cstring_makeLiteral ("     Check LARCH_PATH environment variable."));

	  result = FALSE;
	}
      else
	{
	  if (context_getFlag (FLG_WHICHLIB))
	    {
	      char *t = mstring_create (MAX_NAME_LENGTH);
	      char *ot = t;

	      if ((t = reader_readLine (stdlib, t, MAX_NAME_LENGTH)) == NULL)
		{
		  llfatalerror (cstring_makeLiteral ("Standard library format invalid"));
		}

	      if ((t = reader_readLine (stdlib, t, MAX_NAME_LENGTH)) != NULL)
		{
		  if (*t == ';' && *(t + 1) == ';') 
		    {
		      t += 2;
		    }
		}

	      if (t == NULL)
		{
		  lldiagmsg (message ("Standard library: %s ", 
				      fpath));
		}
	      else
		{
		  char *tt;

		  tt = strrchr (t, '\n');
		  if (tt != NULL)
		    *tt = '\0';

		  lldiagmsg (message ("Standard library: %s", fpath));
		  /* evans 2004-01-13: removed this (it is the libversion which is confusing) */
		  /*   lldiagmsg (message ("   (created using %s)", cstring_fromChars (t)));		    */
		}

	      sfree (ot);
	      
	      check (fileTable_closeFile (context_fileTable (), stdlib));
	      stdlib = fileTable_openReadFile (context_fileTable (), fpath);
	    }

	  llassert (stdlib != NULL);

	  fileloc_reallyFree (g_currentloc);
	  g_currentloc = fileloc_createLib (libname);

	  DPRINTF (("Loading: %s", fpath));

	  displayScanOpen (message ("loading standard library %s ", fpath));
	  result = loadLCDFile (stdlib, fpath);
	  displayScanClose ();

	  check (fileTable_closeFile (context_fileTable (), stdlib));
	}
    }

  cstring_free (libname);
  return result;
}

/*@constant int BUFLEN;@*/
# define BUFLEN 128

static bool
loadLCDFile (FILE *f, cstring name)
{
  char buf[BUFLEN];
  
  /*
  ** Check version.  Should be >= SPLINT_LIBVERSION
  */

  if (reader_readLine (f, buf, BUFLEN) == NULL
      || !mstring_equalPrefix (buf, LIBRARY_MARKER))
    {
      loadllmsg (message ("Load library %s is not in Splint library format.  Attempting "
			  "to continue without library.", name));
      return FALSE;
    }
  
  if (reader_readLine (f, buf, BUFLEN) != NULL)
    {
      if (!mstring_equalPrefix (buf, ";;"))
	{
	  loadllmsg (message ("Load library %s is not in Splint library format.  Attempting "
			      "to continue without library.", name));
	  return FALSE;
	}
      else if (mstring_equalPrefix (buf, ";;ctTable"))
	{
	  loadllmsg (message ("Load library %s is in obsolete Splint library format.  Attempting "
			      "to continue anyway, but results may be incorrect.  Rebuild "
			      "the library with this version of splint.", 
			      name));
	}
      else 
	{
	  float version = 0.0;

	  if (sscanf (buf, ";;Splint %f", &version) != 1
	      && (sscanf (buf, ";;LCLint %f", &version) != 1))
	    {
	      loadllmsg (message ("Load library %s is not in Splint library format (missing version "
				  "number).  Attempting "
				  "to continue without library.", name));
	      return FALSE;
	    }
	  else
	    {
	      if ((SPLINT_LIBVERSION - version) >= FLT_EPSILON)
		{
		  cstring vname;
		  char *nl = strchr (buf, '\n');

		  *nl = '\0';

		  vname = cstring_fromChars (buf + 9);

		  loadllmsg (message ("Load library %s is in obsolete Splint library "
				      "format (version %f (%s), expecting version %f).  Attempting "
				      "to continue anyway, but results may be incorrect.  Rebuild "
				      "the library with this version of splint.", 
				      name, 
				      version,
				      vname, 
				      SPLINT_LIBVERSION));
		}
	      else
		{
		  if (reader_readLine (f, buf, BUFLEN) == NULL)
		    {
		      loadllmsg (message ("Load library %s is not in Splint library "
					  "format (missing library code). Attempting "
					  "to continue without library.", name));
		      return FALSE;
		    }
		  else 
		    {
		      int lib;
		      
		      if (sscanf (buf, ";;lib:%d", &lib) != 1)
			{
			  loadllmsg (message ("Load library %s is not in Splint library "
					      "format (missing library code). Attempting "
					      "to continue without library.", name));
			  return FALSE;
			}
		      else
			{
			  flagcode code = (flagcode) lib;

			  if (flagcode_isLibraryFlag (code))
			    {
			      if (context_doMerge ()) 
				{
				  context_setLibrary (code);
				}
			    }
			  else
			    {
			      loadllmsg (message ("Load library %s has invalid library code (%s).  "
						  "Attempting to continue without library.",
						  name,
						  flagcode_unparse (code)));
			      
			      return FALSE;
			    }
			}
		    }
		}
	    }
	}
    }
  else
    {
      loadllmsg (message ("Load library %s is not in Splint library format (missing lines).  "
			  "Attempting to continue without library.", name));
      return FALSE;
    }
  
  ctype_loadTable (f);
  printDot ();
  
  typeIdSet_loadTable (f);
  printDot ();
  
  usymtab_load (f);
  printDot ();
  
  context_loadModuleAccess (f);
  printDot ();
  
  return TRUE;
}

/*
** load state from file created by dumpState
*/

void
loadState (cstring cfname)
{
  FILE *f;
  cstring fname = fileLib_addExtension (cfname, cstring_makeLiteralTemp (DUMP_SUFFIX));

  f = fileTable_openReadFile (context_fileTable (), fname);

  if (f == NULL)
    {
      displayScanClose ();
      llfatalerror (message ("Cannot open dump file for loading: %s", 
			     fname));
    }
  else
    {
      fileloc_reallyFree (g_currentloc);
      g_currentloc = fileloc_createLib (cfname);

      if (!loadLCDFile (f, cfname)) 
	{
	  if (!loadStandardState ()) 
	    {
	      ctype_initTable ();
	    }
	}
      
      check (fileTable_closeFile (context_fileTable (), f));
    }

  /* usymtab_printAll (); */
  cstring_free (fname);
}

splint-3.1.2.dfsg1/src/randomNumbers.c0000644021234200000250000000220507630461221015212 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** randomNumbers.c
*/

# include "randomNumbers.h"

/*@+ignoresigns@*/
unsigned int g_randomNumbers[NUM_RANDOM] =
{
#include "256_random_numbers.nf"
} ;
/*@=ignoresigns@*/
splint-3.1.2.dfsg1/src/fileLib.c0000644021234200000250000001112707650622512013753 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** fileLib.c
*/

# include "splintMacros.nf"
# include "basic.h"
# include "osd.h"

bool
fileLib_isCExtension (cstring ext)
{
  return (cstring_equalLit (ext, ".c") 
	  || cstring_equalLit (ext, ".C") 
	  || cstring_equalLit (ext, ".h")
	  || cstring_equalLit (ext, ".lh")
	  || cstring_equalLit (ext, ".xh")
	  || cstring_equalLit (ext, ".H")
	  || cstring_equalLit (ext, ".y")
	  || cstring_equalLit (ext, ".l"));
}

bool
fileLib_isLCLFile (cstring s)
{
  return (fileLib_hasExtension (s, LCL_EXTENSION));
}

/*@only@*/ cstring fileLib_withoutExtension (/*@temp@*/ cstring s, cstring suffix)
{
  /*@access cstring@*/
  char *t;
  char *s2;

  if (cstring_isUndefined (s)) {
    return cstring_undefined;
  }

  t = strrchr (s, '.');
  if (t == (char *) 0 || !mstring_equal (t, suffix))
    {
      return mstring_copy (s);
    }

  /*@-mods@*/ 
  *t = '\0';
  s2 = mstring_copy (s);
  *t = '.';
  /*@=mods@*/  /* Modification is undone. */
  return s2;
  /*@noaccess cstring@*/
}

/*@only@*/ cstring fileLib_removePath (cstring s)
{
  /*@access cstring@*/
  char *t;

  if (cstring_isUndefined (s)) {
    return cstring_undefined;
  }

  t = strrchr (s, CONNECTCHAR);

  if (t == NULL) return (mstring_copy (s));
  else return (mstring_copy (t + 1));
  /*@noaccess cstring@*/
}

/*@only@*/ cstring
fileLib_removePathFree (/*@only@*/ cstring s)
{
  /*@access cstring@*/
  char *t;


  if (cstring_isUndefined (s)) {
    return cstring_undefined;
  }

  t = strrchr (s, CONNECTCHAR);

# ifdef ALTCONNECTCHAR
  {
    char *at = strrchr (s, ALTCONNECTCHAR);
    if (t == NULL || (at > t)) {
      t = at;
    }
  }
# endif

  if (t == NULL) 
    {
      return (s);
    }
  else
    {
      char *res = mstring_copy (t + 1);
      mstring_free (s);
      return res;
    }
  /*@noaccess cstring@*/
}

/*@only@*/ cstring
fileLib_removeAnyExtension (cstring s)
{
  /*@access cstring@*/
  char *ret;
  char *t;


  if (cstring_isUndefined (s)) {
    return cstring_undefined;
  } 

  t = strrchr (s, '.');

  if (t == (char *) 0)
    {
      return mstring_copy (s);
    }

  /*@-mods@*/
  *t = '\0';
  ret = mstring_copy (s);
  *t = '.';
  /*@=mods@*/ /* modification is undone */

  return ret;
  /*@noaccess cstring@*/
}

/*@only@*/ cstring
fileLib_addExtension (/*@temp@*/ cstring s, cstring suffix)
{
  /*@access cstring@*/
  llassert (cstring_isDefined (s));

  if (strrchr (s, '.') == (char *) 0)
    {
      /* <<< was mstring_concatFree1 --- bug detected by splint >>> */
      return (cstring_concat (s, suffix));
    }
  else
    {
      return cstring_copy (s);
    }
}

bool fileLib_hasExtension (cstring s, cstring ext)
{
  return cstring_equal (fileLib_getExtension (s), ext);
}

/*@observer@*/ cstring fileLib_getExtension (/*@returned@*/ cstring s)
{
  llassert (cstring_isDefined (s));

  /*@access cstring@*/
  return (strrchr(s, '.'));
  /*@noaccess cstring@*/
}

cstring removePreDirs (cstring s)
{
  /*@access cstring@*/

  llassert (cstring_isDefined (s));

  while (*s == '.' && *(s + 1) == CONNECTCHAR) 
    {
      s += 2;
    }

# if defined(OS2) || defined(MSDOS)
  /* remove remainders from double path delimiters... */
  while (*s == CONNECTCHAR) 
    {
      ++s;
    }
# endif /* !defined(OS2) && !defined(MSDOS) */

  return s;
  /*@noaccess cstring@*/
}

bool isHeaderFile (cstring fname)
{
  cstring ext = fileLib_getExtension (fname);
  
  return (cstring_equalLit (ext, ".h")
	  || cstring_equalLit (ext, ".H")
	  || cstring_equal (ext, LH_EXTENSION));
}

cstring fileLib_cleanName (cstring s)
{
  if (cstring_equalPrefixLit (s, "./")) 
    {
      cstring res = cstring_copySegment (s, 2, cstring_length (s) - 1);
      cstring_free (s);
      return res;
    }

  return s;
}
splint-3.1.2.dfsg1/src/globals.c0000644021234200000250000000442207630461221014024 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** globals.c
*/

# include "splintMacros.nf"
# include "basic.h"

fileloc g_currentloc;

symtable g_symtab;
/*@only@*/ lsymbolSet g_currentImports = lsymbolSet_undefined;

cstring g_codeFile = cstring_undefined;
int g_codeLine = 0;

cstring g_prevCodeFile = cstring_undefined;
int g_prevCodeLine = 0;

/*
** These are initialized in llmain.c.
*/

FILE *g_warningstream = NULL;
FILE *g_messagestream = NULL;
FILE *g_errorstream = NULL;
FILE *g_csvstream = NULL;

/*
** These were in llmain.c.  Most should not be globals...
*/

/*@observer@*/ char *g_localSpecPath = ".";

/*@only@*/ cstring g_currentSpec;
/*@only@*/ char *g_currentSpecName;

void printCodePoint (void)
{
  static bool incode = FALSE;

  if (incode) {
    fprintf (stderr, "[[[ in code! ]]]\n");
  }

  incode = TRUE;

  if (cstring_isDefined (g_codeFile))
    {
      cstring temps = fileloc_unparseRaw (g_codeFile, g_codeLine);

      fprintf (stderr, "*** Last code point: %s\n", 
	       cstring_toCharsSafe (temps));

      cstring_free (temps);

      if (cstring_isDefined (g_prevCodeFile))
	{
	  temps = fileloc_unparseRaw (g_prevCodeFile, g_prevCodeLine);
	  fprintf (stderr, "*** Previous code point: %s\n", 
		   cstring_toCharsSafe (temps));

	  cstring_free (temps);
	}
    }

  incode = FALSE;
}

# ifdef WIN32
int yywrap (void)
{
  return 1;
}
# endif



splint-3.1.2.dfsg1/src/flags.c0000644021234200000250000013270410101544327013476 0ustar  fax/*
** Splint - annotation-assisted static program checker
** Copyright (C) 1994-2003 University of Virginia,
**         Massachusetts Institute of Technology
**
** This program is free software; you can redistribute it and/or modify it
** under the terms of the GNU General Public License as published by the
** Free Software Foundation; either version 2 of the License, or (at your
** option) any later version.
** 
** This program is distributed in the hope that it will be useful, but
** WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
** General Public License for more details.
** 
** The GNU General Public License is available from http://www.gnu.org/ or
** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
** MA 02111-1307, USA.
**
** For information on splint: info@splint.org
** To report a bug: splint-bug@splint.org
** For more information: http://www.splint.org
*/
/*
** flags.c
*/

# include "splintMacros.nf"
# include "basic.h"
# include "osd.h"
# include "rcfiles.h"
# include "lslinit.h"
# include "llmain.h"

/*
** from the CC man page:
**
**  -Idir          Search for #include files whose names do not begin with a
**                    slash (/) in the following order: (1) in the directory of
**                    the dir argument, (2) in the directories specified by -I
**                    options, (3) in the standard directory (/usr/include).
*/

/* needed for string literals literals */

typedef struct { 
  flagkind kind;
  /*@null@*/ /*@observer@*/ char *name;
  /*@null@*/ /*@observer@*/ char *describe;
} flagcatinfo;

static flagcatinfo categories[] =
{
  { FK_ABSTRACT, "abstract", "abstraction violations, representation access" } ,
  { FK_ALIAS, "aliasing", "unexpected or dangerous aliasing" } ,
  { FK_USE, "alluse", "all declarations are used" } ,
  { FK_ANSI, "ansi", "violations of constraints imposed by ANSI/ISO standard" } ,
  { FK_ARRAY, "arrays", "special checking involving arrays" } ,
  { FK_BOOL, "booleans", "checking and naming of boolean types" } ,
  { FK_COMMENTS, "comments", "warnings about (normal) comments" } ,
  { FK_SYNCOMMENTS, "syncomments", "interpretation of annotation comments" } ,
  { FK_COMPLETE, "complete", "completely defined, used, or specified system" } ,
  { FK_CONTROL, "controlflow", "suspicious control structures" } ,
  { FK_DEBUG, "debug", "flags for debugging splint" } ,
  { FK_DECL, "declarations", "consistency of declarations" } ,
  { FK_DEF, "definition", "undefined storage errors" } ,
  { FK_DIRECT, "directories", "set directores" } ,
  { FK_DISPLAY, "display", "control what is displayed" } ,
  { FK_EFFECT, "effect", "statements with no effects" } ,
  { FK_ERRORS, "errors", "control expected errors, summary reporting" } ,
  { FK_EXPORT, "export", "control what may be exported" } ,
  { FK_EXPOSURE, "exposure", "representation exposure" } ,
  { FK_EXTENSIBLE, "extensible", "user-defined checks and annotations" },
  { FK_FILES, "files", "control system files" } ,
  { FK_FORMAT, "format", "control format of warning messages" } ,
  { FK_GLOBALS, "globals", "use of global and file static variables" },
  { FK_HEADERS, "headers", "control inclusion and generation of header files" },
  { FK_HELP, "help", "on-line help" },
  { FK_BOUNDS, "memorybounds", "out-of-bounds memory accesses" },
  { FK_HINTS, "hints", "control display of warning hints" },
  { FK_SYSTEMFUNCTIONS, "systemfunctions", "special properties of exit and main" },
  { FK_IMPLICIT, "implicit", "control implicit annotations and interpretations" } ,
  { FK_INIT, "initializations", "initialization files" } ,
  { FK_ITER, "iterators", "checking iterator definitions and uses" } ,
  { FK_LEAK, "leaks", "memory leaks" } ,
  { FK_LIBS, "libraries", "loading and dumping of user and standard libraries" } ,
  { FK_LIMITS, "limits", "violations of set limits" } ,
  { FK_MACROS, "macros", "expansion, definition and use of macros" },
  { FK_MEMORY, "memory", "memory management" } ,
  { FK_MODIFIES, "modification", "modification errors" } ,
  { FK_NAMES, "names", "naming conventions and limits" } ,
  { FK_NULL, "null", "misuses of null pointers" } ,
  { FK_NUMBERS, "numbers", "control type-checking of numeric types" } ,
  { FK_OPS, "operations", "checking of primitive operations" } ,
  { FK_PARAMS, "parameters", "function and macro parameters" } ,
  { FK_SPEED, "performance", "speeding up checking" } ,
  { FK_POINTER, "pointers", "pointers" } ,
  { FK_PRED, "predicates", "condition test expressions" } ,
  { FK_PREFIX, "prefixes", "set naming prefixes and control checking" } ,
  { FK_PREPROC, "preproc", "defines and undefines for the preprocessor" } ,
  { FK_PROTOS, "prototypes", "function prototypes" } ,
  { FK_DEAD, "released", "using storage that has been deallocated" } ,
  { FK_IGNORERET, "returnvals", "ignored return values" },
  { FK_SECURITY, "security", "possible security vulnerability" },
  { FK_SPEC, "specifications", "checks involving .lcl specifications" } ,
  { FK_SUPPRESS, "suppress", "local and global suppression of messages" } ,
  { FK_TYPEEQ, "typeequivalence", "control what types are equivalent" } ,
  { FK_BEHAVIOR, "undefined", "code with undefined or implementation-defined behavior" } ,
  { FK_UNRECOG, "unrecognized", "unrecognized identifiers" } ,
  { FK_UNSPEC, "unconstrained", "checking in the presence of unconstrained functions" } ,
  { FK_WARNUSE, "warnuse", "use of possibly problematic function" } ,
  { FK_ITS4, "its4", "its4 compatibility flags (report warnings for uses of possibly insecure functions)" } ,
  { FK_SYNTAX, NULL, NULL } ,
  { FK_TYPE, NULL, NULL } ,
  { FK_SECRET, NULL, NULL } ,
  { FK_OBSOLETE, NULL, NULL } ,
  { FK_NONE, NULL, NULL }  /* must be last */
} ; 

typedef enum {
  ARG_NONE,
  ARG_NUMBER,    /* number */
  ARG_CHAR,      /* char */
  ARG_STRING,    /* string */
  ARG_FILE,      /* filename (also a string) */
  ARG_DIRECTORY, /* directory (also a string) */
  ARG_PATH,      /* path */
  ARG_SPECIAL   /* ? */
} argcode;

# ifdef WIN32
/* Make Microsoft VC++ happy */
# pragma warning (disable:4715)
# endif

static /*@observer@*/ cstring argcode_unparse (argcode arg)
{
  switch (arg) 
    {
    case ARG_STRING: return cstring_makeLiteralTemp ("string"); 
    case ARG_FILE: return cstring_makeLiteralTemp ("filename"); 
    case ARG_DIRECTORY: return cstring_makeLiteralTemp ("directory");
    case ARG_PATH: return cstring_makeLiteralTemp ("path"); 
    case ARG_NUMBER: return cstring_makeLiteralTemp ("number");
    case ARG_CHAR: return cstring_makeLiteralTemp ("character");
    case ARG_NONE: 
      BADBRANCH;
    case ARG_SPECIAL:
      BADBRANCH;
    }
}      

# ifdef WIN32
# pragma warning (default : 4715)
# endif

typedef struct { 
  flagkind main;
  flagkind sub;
  bool isSpecial;  /* setting this flag may set other flags (or values) */
  bool isIdem;     /* idempotent - always sets to TRUE */
  bool isGlobal;   /* cannot be set locally (using control comments) */
  bool isModeFlag; /* set by modes */
  argcode argtype;
  /*@observer@*/ char *flag;
  flagcode code; 
  /*@observer@*/ /*@null@*/ char *desc;
  bn_mstring hint; 
  int nreported; 
  int nsuppressed; 
} fflag;

typedef fflag flaglist[];

# include "flags.def"

/*@iter allFlags (yield observer fflag f); @*/
# define allFlags(m_f) \
  { /*@+enumint@*/ flagcode m_i; for (m_i = 0; m_i < NUMFLAGS; m_i++) { fflag m_f = flags[m_i]; /*@=enumint@*/
# define end_allFlags }}

static bn_mstring mode_names[] =
{ 
  "weak", "standard", "checks", "strict", NULL, 
};

/*@iter allModes (yield bn_mstring modename)@*/
# define allModes(m_m) \
  { int m_ii = 0; while (mstring_isDefined (mode_names[m_ii])) \
      { bn_mstring m_m = mode_names[m_ii]; m_ii++; 

# define end_allModes }}

/*@+enumint@*/

static cstring getFlagModeSettings (flagcode p_flag) /*@modifies internalState@*/ ;
static cstring describeFlagCode (flagcode p_flag) /*@*/ ;
static cstringSList sortedFlags (void) /*@*/ ;
static /*@observer@*/ cstring categoryName (flagkind p_kind) /*@*/ ;

static flagcode flags_identifyFlagAux (cstring p_s, bool p_quiet) /*@modifies g_warningstream@*/ ;

# if 0
static /*@unused@*/ cstring listModes (void) /*@*/ ;
# endif

bool flagcode_isSpecialFlag (flagcode f)
{
  return (flags[f].isSpecial);
}

bool flagcode_isGlobalFlag (flagcode f)
{
  return (flags[f].isGlobal);
}

bool flagcode_isIdemFlag (flagcode f)
{
  return (flags[f].isIdem);
}

bool flagcode_isModeFlag (flagcode f)
{
  return (flags[f].isModeFlag);
}

bool flagcode_isNameChecksFlag (flagcode f)
{
  return (flags[f].main == FK_NAMES);
}

bool flagcode_isHelpFlag (flagcode f)
{
  return f == FLG_HELP;
}

bool flagcode_isMessageControlFlag (flagcode f)
{
  /*
  ** True if opt controls the display of messages.
  ** These flags must be processed first.
  */

  return (f == FLG_SHOWSCAN 
	  || f == FLG_WARNRC 
	  || f == FLG_PARENFILEFORMAT
	  || f == FLG_MESSAGESTREAMSTDERR
	  || f == FLG_MESSAGESTREAMSTDOUT
	  || f == FLG_WARNINGSTREAMSTDERR
	  || f == FLG_WARNINGSTREAMSTDOUT
	  || f == FLG_ERRORSTREAMSTDERR
	  || f == FLG_ERRORSTREAMSTDOUT
	  || f == FLG_MESSAGESTREAM
	  || f == FLG_WARNINGSTREAM
	  || f == FLG_ERRORSTREAM
	  || f == FLG_STREAMOVERWRITE);
}

/*
** Internal consistency check on the flags.
*/

void flags_initMod ()
{
  allFlagCodes (code)
    {
      /*@+enumint@*/
      if (flags[code].code != code)
	{
	  fprintf (stderr, 
		   "*** ERROR: inconsistent flag %s / %d / %d", 
		   flags[code].flag,
		   flags[code].code, code);
	  
	  llbug (message ("*** ERROR: inconsistent flag %s / %d / %d", 
			  cstring_fromChars (flags[code].flag),
			  flags[code].code, code));
	}
      /*@=enumint@*/
    } end_allFlagCodes;
}

void
summarizeErrors ()
{
  bool hadOne = FALSE;
  int sumrep = 0;
  int sumsup = 0;

  char *buf = mstring_create (128);

  allFlags (f)
    {
      if (f.nreported > 0 || f.nsuppressed > 0)
	{
	  int nrep = f.nreported;
	  int nsup = f.nsuppressed;
	  cstring fs = cstring_fill (cstring_fromChars (f.flag), 23);

	  if (!hadOne)
	    {
	      llmsgplain (cstring_makeLiteral
			  ("\nError Type                Reported  Suppressed\n"
			   "===================       ========  ========="));
	      hadOne = TRUE;
	    }

	  (void) snprintf (buf, 128, "%s%7d   %9d", cstring_toCharsSafe (fs), nrep, nsup);

	  sumrep += nrep;
	  sumsup += nsup;
	  
	  cstring_free (fs);
	  llmsg (cstring_copy (cstring_fromChars (buf)));
	}
    } end_allFlags;

  if (hadOne)
    {
      cstring ts = cstring_fill (cstring_makeLiteralTemp ("Total"), 23);

      llmsglit ("                          ========  =========");

      (void) snprintf (buf, 128, "%s%7d   %9d", cstring_toCharsSafe (ts), sumrep, sumsup);
      cstring_free (ts);
      llmsgplain (cstring_copy (cstring_fromChars (buf)));
    }

  sfree (buf);
}

/*@+enumindex@*/

void
flagcode_recordError (flagcode f)
{
  if (f != INVALID_FLAG)
    {
      if (f == FLG_WARNFLAGS)
	{
	  ; /* don't count these */
	}
      else
	{
	  flags[f].nreported = flags[f].nreported + 1;
	}
    }
  else
    {
      llcontbug (message ("flagcode_recordError: invalid flag: %d", (int) f));
    }
}

void
flagcode_recordSuppressed (flagcode f)
{
  llassertprint (f != INVALID_FLAG, ("flagcode: %s", flagcode_unparse (f)));

  flags[f].nsuppressed = flags[f].nsuppressed + 1;
}

int
flagcode_numReported (flagcode f)
{
  llassert (f != INVALID_FLAG);

  return (flags[f].nreported);
}

/*@observer@*/ cstring
flagcodeHint (flagcode f)
{
  llassert (f != INVALID_FLAG);

  if (mstring_isDefined (flags[f].hint))
    {
      return (cstring_fromChars (flags[f].hint));
    }
  else
    {
      return (cstring_fromChars (flags[f].desc));
    }
}

static int categorySize (flagkind kind) /*@*/ 
{
  int n = 0;

  
  allFlags (f)
    {
      if (f.main == kind || f.sub == kind)
	{
	  	  n++;
	}
    } end_allFlags;

  return n;
}

flagkind identifyCategory (cstring s)
{
  int i;

  for (i = 0; categories[i].kind != FK_NONE; i++)
    {
      if (mstring_isDefined (categories[i].name))
	{
	  if (cstring_equalLit (s, categories[i].name))
	    {
	      return categories[i].kind;
	    }
	}
    }

  return FK_NONE;
}

static /*@observer@*/ cstring categoryName (flagkind kind)
{
  int i;

  for (i = 0; categories[i].kind != FK_NONE; i++)
    {
      if (categories[i].kind == kind)
	{
	  return (cstring_fromChars (categories[i].name));
	}
    }
  
  return (cstring_makeLiteralTemp (""));
}

static int categoryIndex (flagkind kind)
{
  int i;

  for (i = 0; categories[i].kind != FK_NONE; i++)
    {
      if (categories[i].kind == kind)
	{
	  return i;
	}
    }

  return -1;
}

void printCategory (flagkind kind)
{
  int index = categoryIndex (kind);

  llassert (index >= 0);
  llmsg (message ("%s (%d flags)\n\3%s\n\n", 
		  cstring_fromChars (categories[index].name), 
		  categorySize (kind),
		  cstring_fromChars (categories[index].describe)));

  allFlags (f)
    {
      if (f.main == kind || f.sub == kind)
	{
	  llmsg (message ("   %s\n\6%q", cstring_fromChars (f.flag), 
			  describeFlagCode (f.code)));
	}
    } end_allFlags;
}

void 
listAllCategories (void)
{
  int i;

  for (i = 0; categories[i].kind != FK_NONE; i++)
    {
      flagkind kind = categories[i].kind ;

      if (categories[i].describe != NULL)
	{
	  llmsg (message ("%s (%d flags)\n\3%s", 
			  categoryName (kind), 
			  categorySize (kind),
			  cstring_fromChars (categories[i].describe)));
	}
    }
}

void
printAllFlags (bool desc, bool full)
{
  if (full)
    {
      cstringSList fl = sortedFlags ();

      cstringSList_elements (fl, el)
	{
	  cstring tmp;
	  tmp = cstring_copy(el);
	  llmsg (message ("%q\n\n", describeFlag (tmp)));
	  cstring_free(tmp);
	} end_cstringSList_elements ;

      cstringSList_free (fl);
    }
  else
    {
      allFlags (f)
	{
	  if (f.code != INVALID_FLAG && f.main != FK_OBSOLETE)
	    {
	      if (mstring_isDefined (f.desc))
		{
		  if (desc)
		    {
		      llmsg (message ("%s --- %s", cstring_fromChars (f.flag),
				      cstring_fromChars (f.desc)));
		    }
		}
	    }
	} end_allFlags;
    }
}

void
printFlagManual (bool html)
{
  /*
  ** Prints all flags by category, in order they appear in flags.def
  */

  flagkind lastCategory = FK_NONE;

  allFlags (f) {
    cstring flagname;
    cstring flagtype = cstring_undefined;

    if (f.main != lastCategory)
      {
	if (html)
	  {
	    llmsg (message ("\n

%s

\n", categoryName (f.main))); } else { llmsg (message ("\n%s\n%s\n", categoryName (f.main), cstring_makeLiteralTemp ("==================================="))); } lastCategory = f.main; } if (f.argtype == ARG_NONE || f.argtype == ARG_SPECIAL) { if (html) { flagname = message ("%s", cstring_fromChars (f.flag)); } else { flagname = cstring_fromCharsNew (f.flag); } } else { if (flagcode_hasString (f.code)) { if (html) { flagname = message ("%s <%s>", cstring_fromChars (f.flag), argcode_unparse (f.argtype)); } else { flagname = message ("%s <%s>", cstring_fromChars (f.flag), argcode_unparse (f.argtype)); } if (cstring_isDefined (context_getString (f.code))) { if (html) { flagname = message ("%q [%s]", flagname, context_getString (f.code)); } else { flagname = message ("%q [%s]", flagname, context_getString (f.code)); } } } else if (f.argtype == ARG_CHAR) { if (html) { flagname = message ("%s <%s> [%c]", cstring_fromChars (f.flag), argcode_unparse (f.argtype), (char) context_getValue (f.code)); } else { flagname = message ("%s <%s> [%c]", cstring_fromChars (f.flag), argcode_unparse (f.argtype), (char) context_getValue (f.code)); } } else { llassert (f.argtype == ARG_NUMBER); if (html) { flagname = message ("%s <%s> [%d]", cstring_fromChars (f.flag), argcode_unparse (f.argtype), context_getValue (f.code)); } else { flagname = message ("%s <%s> [%d]", cstring_fromChars (f.flag), argcode_unparse (f.argtype), context_getValue (f.code)); } } } if (f.isIdem) { if (html) { flagtype = message("%q-", flagtype); } else { flagtype = message("%q<->", flagtype); } } if (f.isGlobal) { if (html) { flagtype = message ("%qglobal", flagtype); } else { flagtype = message ("%q", flagtype); } } if (f.isSpecial) { if (html) { flagtype = message ("%qshortcut", flagtype); } else { flagtype = message("%q", flagtype); } } if (f.isModeFlag) { if (html) { flagtype = message ("%q mode:%q>", flagtype, getFlagModeSettings (f.code)); } else { flagtype = message ("%q", flagtype, getFlagModeSettings (f.code)); } } else /* its a plain flag */ { if (html) { flagtype = message ("%q plain:%s", flagtype, cstring_makeLiteralTemp (context_getFlag (f.code) ? "+" : "-")); } else { flagtype = message ("%q", flagtype, cstring_makeLiteralTemp (context_getFlag (f.code) ? "+" : "-")); } } llmsg (message ("%s: %s", flagname, flagtype)); if (html) { llgenindentmsgnoloc (cstring_makeLiteral ("
")); } if (mstring_isDefined (f.hint)) { llgenindentmsgnoloc (cstring_fromCharsNew (f.hint)); } else { llgenindentmsgnoloc (message ("%q.", cstring_capitalize (cstring_fromChars (f.desc)))); } if (html) { llgenindentmsgnoloc (cstring_makeLiteral ("
")); } } end_allFlags ; } cstring describeMode (cstring mode) { cstringSList sflags = sortedFlags (); cstring res = message ("Predefined mode %s sets: ", mode); llassert (flags_isModeName (mode)); context_setMode (mode); cstringSList_elements (sflags, flagname) { flagcode code = flags_identifyFlag (flagname); fflag currentflag = flags[code]; if (mstring_isDefined (currentflag.desc) && flagcode_isModeFlag (code)) { if (context_getFlag (code)) { res = message ("%q\n +%s", res, cstring_fromChars (currentflag.flag)); } else { res = message ("%q\n -%s", res, cstring_fromChars (currentflag.flag)); } } } end_cstringSList_elements; cstringSList_free (sflags); res = cstring_appendChar (res, '\n'); return (res); } cstring describeFlagCode (flagcode flag) { cstring ret = cstring_undefined; fflag f; if (flagcode_isInvalid (flag)) { return (cstring_makeLiteral ("")); } if (flagcode_isModeName (flag)) { return (cstring_makeLiteral ("")); } context_resetAllFlags (); f = flags[flag]; ret = cstring_copy (cstring_fromChars (f.desc)); if (f.sub != FK_NONE) { ret = message ("%q\nCategories: %s, %s", ret, categoryName (f.main), categoryName (f.sub)); } else { if (f.main != FK_NONE) { cstring cname = categoryName (f.main); if (cstring_isDefined (cname)) { ret = message ("%q\nCategory: %s", ret, cname); } } } if (f.isModeFlag) { ret = message ("%q\nMode Settings: %q", ret, getFlagModeSettings (flag)); } else { ret = message ("%q\nDefault Setting: %s", ret, cstring_makeLiteralTemp (context_getFlag (flag) ? "+" : "-")); } if (f.isGlobal) { ret = message("%q\nSet globally only", ret); } else { ret = message("%q\nSet locally", ret); } switch (f.argtype) { case ARG_NONE: case ARG_SPECIAL: break; case ARG_NUMBER: ret = message("%q\nNumeric Argument. Default: %d", ret, context_getValue (flag)); break; case ARG_CHAR: ret = message("%q\nCharacter Argument. Default: %h", ret, (char) context_getValue (flag)); break; case ARG_STRING: case ARG_FILE: case ARG_PATH: case ARG_DIRECTORY: { if (cstring_isDefined (context_getString (flag))) { ret = message("%q\n%q argument. Default: %s", ret, cstring_capitalize (argcode_unparse (f.argtype)), context_getString (flag)); } else { ret = message("%q\n%s argument. No default.", ret, cstring_capitalize (argcode_unparse (f.argtype))); } break; } } if (mstring_isDefined (f.hint)) { ret = message("%q\n\3%s", ret, cstring_fromChars (f.hint)); } return ret; } static cstring getFlagModeSettings (flagcode flag) { cstring res = cstring_undefined; allModes (mname) { context_setModeNoWarn (cstring_fromChars (mname)); res = message ("%q%s", res, cstring_makeLiteralTemp (context_getFlag (flag) ? "+" : "-")); } end_allModes; return res; } cstring describeFlag (cstring flagname) { cstring oflagname = cstring_copy (flagname); flagcode f = flags_identifyFlag (flagname); if (flagcode_isSkip (f)) { cstring_free (oflagname); return cstring_undefined; } else if (flagcode_isValid (f)) { if (cstring_equal (flagname, oflagname)) { cstring_free (oflagname); return (message ("%s\n\3%q", flagname, describeFlagCode (f))); } else { return (message ("%q (standardized name: %s)\n\3%q", oflagname, flagname, describeFlagCode (f))); } } else { if (flags_isModeName (flagname)) { cstring_free (oflagname); return describeMode (flagname); } else { return (message ("%q: ", oflagname)); } } } static cstringSList sortedFlags (void) { cstringSList s = cstringSList_new (); allFlags (f) { if (f.desc != NULL) { s = cstringSList_add (s, cstring_fromChars (f.flag)); } } end_allFlags; cstringSList_alphabetize (s); return s; } void printAlphaFlags () { cstringSList fl = sortedFlags (); cstringSList_printSpaced (fl, 3, 1, context_getLineLen () - 25); cstringSList_free (fl); } /*@observer@*/ cstring flagcode_unparse (flagcode code) { if (code == INVALID_FLAG) { return cstring_makeLiteralTemp (""); } return cstring_fromChars (flags[code].flag); } /* ** Transforms a flag into its cannonical form. ** ** The following transformations are made: ** ** function -> fcn ** variable -> var ** constant -> const ** iterator -> iter ** parameter -> param ** unrecognized -> unrecog ** qualifier -> qual ** declaration -> decl ** globalias -> (no change) ** global -> glob ** modifies -> mods ** modify -> mod ** pointer -> ptr ** implies -> imp ** implicit -> imp ** implied -> imp ** unconstrained -> unspec ** unconst -> unspec ** memory -> mem ** length -> len */ static /*@only@*/ cstring canonicalizeFlag (cstring s) { int i = 0; cstring res = cstring_copy (s); static bn_mstring transform[] = { "function", "fcn", "variable", "var", "constant", "const", "iterator", "iter", "parameter", "param", "unrecognized", "unrecog", "qualifier", "qual", "declaration", "decl", "globals", "globs", "modifies", "mods", "modify", "mod", "pointer", "ptr", "implies", "imp", "implicit", "imp", "implied", "imp", "unconstrained", "uncon", "unconst", "uncon", "memory", "mem", "length", "len", "return", "ret", "system", "sys", NULL } ; char *current; while ((current = transform[i]) != NULL) { if (cstring_containsLit (res, current)) { cstring_replaceLit (res, current, transform[i+1]); } i += 2; } /* remove whitespace, -'s, and _'s */ cstring_stripChars (res, " -_"); return res; } flagcode flags_identifyFlag (cstring s) { return flags_identifyFlagAux (s, FALSE); } flagcode flags_identifyFlagQuiet (cstring s) { return flags_identifyFlagAux (s, TRUE); } static flagcode flags_identifyFlagAux (cstring s, bool quiet) { cstring cflag; flagcode res; if (cstring_length (s) == 0) { /* evs 2000-06-25: A malformed flag. */ return INVALID_FLAG; } if (cstring_firstChar (s) == 'I') { return FLG_INCLUDEPATH; /* no space required after -I */ } if (cstring_firstChar (s) == 'S') { return FLG_SPECPATH; /* no space required after -S */ } if (cstring_firstChar (s) == 'D') { return FLG_DEFINE; /* no space required after -D */ } if (cstring_firstChar (s) == 'U') { return FLG_UNDEFINE; /* no space required after -D */ } cflag = canonicalizeFlag (s); res = INVALID_FLAG; allFlags (f) { if (cstring_equal (cstring_fromChars (f.flag), cflag)) { res = f.code; break; } } end_allFlags; if (res == INVALID_FLAG) { /* ** Synonyms */ if (cstring_equalLit (cflag, "pred")) { res = FLG_PREDBOOL; } else if (cstring_equalLit (cflag, "modobserverstrict")) { res = FLG_MODOBSERVERUNCON; } else if (cstring_equalLit (cflag, "czechnames")) { res = FLG_CZECH; } else if (cstring_equalLit (cflag, "slovaknames")) { res = FLG_SLOVAK; } else if (cstring_equalLit (cflag, "czechoslovaknames")) { res = FLG_CZECHOSLOVAK; } else if (cstring_equalLit (cflag, "globunspec") || cstring_equalLit (cflag, "globuncon")) { res = FLG_GLOBUNSPEC; } else if (cstring_equalLit (cflag, "modglobsunspec") || cstring_equalLit (cflag, "modglobsuncon") || cstring_equalLit (cflag, "modglobsnomods")) { res = FLG_MODGLOBSUNSPEC; } else if (cstring_equalLit (cflag, "export")) { res = FLG_EXPORTANY; } else if (cstring_equalLit (cflag, "macrospec")) { res = FLG_MACRODECL; } else if (cstring_equalLit (cflag, "ansireservedlocal")) { res = FLG_ISORESERVEDLOCAL; } else if (cstring_equalLit (cflag, "warnposix")) { res = FLG_WARNPOSIX; } else if (cstring_equalLit (cflag, "defuse")) { res = FLG_USEDEF; } else if (cstring_equalLit (cflag, "macroundef")) { res = FLG_MACROUNDEF; } else if (cstring_equalLit (cflag, "showcol")) { res = FLG_SHOWCOL; } else if (cstring_equalLit (cflag, "intbool")) { res = FLG_BOOLINT; } else if (cstring_equalLit (cflag, "intchar")) { res = FLG_CHARINT; } else if (cstring_equalLit (cflag, "intenum")) { res = FLG_ENUMINT; } else if (cstring_equalLit (cflag, "intlong")) { res = FLG_LONGINT; } else if (cstring_equalLit (cflag, "intshort")) { res = FLG_SHORTINT; } /* ** Backwards compatibility for our American friends... */ else if (cstring_equalLit (cflag, "ansilib")) { res = FLG_ANSILIB; } else if (cstring_equalLit (cflag, "ansistrictlib")) { res = FLG_STRICTLIB; } else if (cstring_equalLit (cflag, "skipansiheaders")) { res = FLG_SKIPISOHEADERS; } else if (cstring_equalLit (cflag, "ansireserved")) { res = FLG_ISORESERVED; } else if (cstring_equalLit (cflag, "ansireservedinternal")) { res = FLG_ISORESERVEDLOCAL; } /* ** Obsolete Flags */ else if (cstring_equalLit (cflag, "accessunspec")) { if (!quiet) { llerror_flagWarning (cstring_makeLiteral ("accessunspec flag is no longer supported. It has been replaced by accessmodule, accessfile and " "accessfunction to provide more precise control of accessibility " "of representations. For more information, " "see splint -help accessmodule")); } res = SKIP_FLAG; } else if (cstring_equalLit (cflag, "ansilimits")) { llerror_flagWarning (cstring_makeLiteral ("ansilimits flag is no longer supported. It has been replaced by ansi89limits and " "iso99limits to select either the lower translation limits imposed by the ANSI89 " "standard or the typically higher limits prescribed by ISO C99.")); res = SKIP_FLAG; } else if (cstring_equalLit (cflag, "staticmods")) { if (!quiet) { llerror_flagWarning (cstring_makeLiteral ("staticmods flag is obsolete. You probably " "want impcheckmodstatics. For more information, " "see splint -help impcheckmodstatics")); } res = SKIP_FLAG; } else if (cstring_equalLit (cflag, "bool")) { if (!quiet) { llerror_flagWarning (cstring_makeLiteral ("bool flag is obsolete. It never really " "made sense in the first place.")); } res = SKIP_FLAG; } else if (cstring_equalLit (cflag, "shiftsigned")) { if (!quiet) { llerror_flagWarning (cstring_makeLiteral ("shiftsigned flag is obsolete. You probably " "want bitwisesigned, shiftnegative or shiftimplementation.")); } res = SKIP_FLAG; } else if (cstring_equalLit (cflag, "ansi")) { if (!quiet) { llerror_flagWarning (cstring_makeLiteral ("ansi flag is obsolete. You probably " "want noparams and/or oldstyle.")); } res = SKIP_FLAG; } else if (cstring_equalLit (cflag, "usestderr")) { if (!quiet) { llerror_flagWarning (cstring_makeLiteral ("usestderr flag is obsolete. This has been replaced " "by more precise flags for controlling the warning, " "status message and fatal error streams independently: message-stream-stdout, " "message-stream-stderr, message-stream , " "warning-stream-stdout, warning-stream-stderr, warning-stream , " "error-stream-stdout, error-stream-stderr, error-stream .")); } res = SKIP_FLAG; } else if (cstring_equalLit (cflag, "stdio")) { if (!quiet) { llerror_flagWarning (cstring_makeLiteral ("stdio flag is obsolete. You may " "want strictlib or one of the gloabls " "checking flags. For more information, " "see splint -help strictlib or splint -help flags globals")); } res = SKIP_FLAG; } else if (flags_isModeName (cflag)) { res = MODENAME_FLAG; } else { res = INVALID_FLAG; } } cstring_free (cflag); return res; } void flags_setValueFlag (flagcode opt, cstring arg) { switch (opt) { case FLG_EXPECT: case FLG_LCLEXPECT: case FLG_LIMIT: case FLG_LINELEN: case FLG_INDENTSPACES: case FLG_LOCINDENTSPACES: case FLG_BUGSLIMIT: case FLG_EXTERNALNAMELEN: case FLG_INTERNALNAMELEN: case FLG_CONTROLNESTDEPTH: case FLG_STRINGLITERALLEN: case FLG_NUMSTRUCTFIELDS: case FLG_NUMENUMMEMBERS: case FLG_INCLUDENEST: { int val = cstring_toPosInt (arg); if (val < 0) { llerror (FLG_BADFLAG, message ("Flag %s must be followed by a positive number number. " "Followed by %s", flagcode_unparse (opt), arg)); } else { context_setValueAndFlag (opt, val); } } break; case FLG_COMMENTCHAR: { if (cstring_length (arg) != 1) { llfatalerrorLoc (message ("Flag %s should be followed by a single character. Followed by %s", flagcode_unparse (opt), arg)); } else { context_setCommentMarkerChar (cstring_firstChar (arg)); } } break; BADDEFAULT; } } void flags_setStringFlag (flagcode opt, /*@only@*/ cstring arg) { switch (opt) { case FLG_TMPDIR: { if (cstring_lastChar (arg) == CONNECTCHAR) { context_setString (opt, arg); } else { context_setString (opt, cstring_appendChar (arg, CONNECTCHAR)); } break; } default: { context_setString (opt, arg); break; } } } cstring describeModes () { cstring s = cstring_makeLiteral ("Flag "); cstringSList sflags = sortedFlags (); allModes (modename) { s = message ("%q%9s", s, cstring_fromChars (modename)); } end_allModes; s = message ("%q\n", s); cstringSList_elements (sflags, flagname) { flagcode code = flags_identifyFlag (flagname); fflag currentflag = flags[code]; if (mstring_isDefined (currentflag.desc) && flagcode_isModeFlag (code)) { s = message ("%q\n%27s", s, cstring_fromChars (currentflag.flag)); allModes (modename) { context_setMode (cstring_fromChars (modename)); if (context_getFlag (code)) { s = message ("%q%9s", s, cstring_makeLiteralTemp ("+")); } else { s = message ("%q%9s", s, cstring_makeLiteralTemp (" ")); } context_resetModeFlags (); } end_allModes; } } end_cstringSList_elements; cstringSList_free (sflags); s = cstring_appendChar (s, '\n'); return (s); } # if 0 static /*@unused@*/ cstring listModes (void) { cstring s = cstring_makeLiteral ("\t"); int i = 0; allModes (modename) { if (i != 0 && (i % 4 == 0)) { s = message ("%q\n\t%15s", s, cstring_fromChars (modename)); } else { s = message ("%q%15s", s, cstring_fromChars (modename)); } i++; } end_allModes; return s; } # endif bool flags_isModeName (cstring s) { allModes (modename) { if (mstring_isDefined (modename)) { if (cstring_equalLit (s, modename)) { return TRUE; } } } end_allModes; return FALSE; } extern bool flagcode_hasArgument (flagcode f) { return (flags[f].argtype != ARG_NONE); } extern bool flagcode_hasNumber (flagcode f) { return (flags[f].argtype == ARG_NUMBER); } extern bool flagcode_hasChar (flagcode f) { return (flags[f].argtype == ARG_CHAR); } extern bool flagcode_hasString (flagcode f) { return (flags[f].argtype == ARG_STRING || flags[f].argtype == ARG_FILE || flags[f].argtype == ARG_DIRECTORY || flags[f].argtype == ARG_PATH); } extern int flagcode_valueIndex (flagcode f) { /*@unchecked@*/ static bool initialized = FALSE; int i; /*@unchecked@*/ static flagcode valueFlags[NUMVALUEFLAGS]; if (!initialized) { int nv = 0; allFlagCodes (code) { if (flagcode_hasNumber (code) || flagcode_hasChar (code)) { llassert (nv < NUMVALUEFLAGS); DPRINTF (("Value flag: %s [%d]", flagcode_unparse (code), (int) code)); valueFlags[nv] = code; nv++; } } end_allFlagCodes; llassertprint (nv == NUMVALUEFLAGS, ("Number of value flags: %d (expected %d)", nv, (int) NUMVALUEFLAGS)); initialized = TRUE; } for (i = 0; i < NUMVALUEFLAGS; i++) { /* static valueFlags must be defined */ /*@-usedef@*/ if (f == valueFlags[i]) /*@=usedef@*/ { return i; } } fprintf (stderr, "Cannot find value flag: %d", (int) f); exit (EXIT_FAILURE); /* Cannot do this...might call recursively... llfatalbug (message ("Cannot fine value flag: %d", (int) f)); BADEXIT; */ } extern int flagcode_stringIndex (flagcode f) { /*@unchecked@*/ static bool initialized = FALSE; /*@unchecked@*/ static flagcode stringFlags[NUMSTRINGFLAGS]; int i; if (!initialized) { int nv = 0; allFlagCodes (code) { if (flagcode_hasString (code)) { llassertprint (nv < NUMSTRINGFLAGS, ("Incorrect number of string flags: %d (need at least %d)", NUMSTRINGFLAGS, nv)); stringFlags[nv] = code; nv++; } } end_allFlagCodes; llassertprint (nv == NUMSTRINGFLAGS, ("number of string flags: %d (expected %d)", nv, NUMSTRINGFLAGS)); initialized = TRUE; } for (i = 0; i < NUMSTRINGFLAGS; i++) { /*@-usedef@*/ if (f == stringFlags[i]) /*@=usedef@*/ { return i; } } llbug (message ("Bad string flag: %s", flagcode_unparse (f))); BADEXIT; } bool flagcode_isNamePrefixFlag (flagcode f) { switch (f) { case FLG_MACROVARPREFIX: case FLG_TAGPREFIX: case FLG_ENUMPREFIX: case FLG_FILESTATICPREFIX: case FLG_GLOBPREFIX: case FLG_TYPEPREFIX: case FLG_EXTERNALPREFIX: case FLG_LOCALPREFIX: case FLG_UNCHECKEDMACROPREFIX: case FLG_CONSTPREFIX: case FLG_ITERPREFIX: case FLG_DECLPARAMPREFIX: return TRUE; default: return FALSE; } } static cstring findLarchPathFile (/*@temp@*/ cstring s) { cstring pathName; filestatus status; status = osd_getPath (context_getLarchPath (), s, &pathName); if (status == OSD_FILEFOUND) { return pathName; } else if (status == OSD_FILENOTFOUND) { showHerald (); lldiagmsg (message ("Cannot find file on LARCH_PATH: %s", s)); } else if (status == OSD_PATHTOOLONG) { /* Directory and filename are too long. Report error. */ llbuglit ("soure_getPath: Filename plus directory from search path too long"); } else { BADBRANCH; } return cstring_undefined; } static void addLarchPathFile (fileIdList files, /*@temp@*/ cstring s) { cstring pathName = findLarchPathFile (s); if (cstring_isDefined (pathName)) { if (fileTable_exists (context_fileTable (), pathName)) { showHerald (); lldiagmsg (message ("File listed multiple times: %s", pathName)); cstring_free (pathName); } else { fileIdList_add (files, fileTable_addFileOnly (context_fileTable (), pathName)); } } } static void addFile (fileIdList files, /*@only@*/ cstring s) { if (fileTable_exists (context_fileTable (), s)) { showHerald (); lldiagmsg (message ("File listed multiple times: %s", s)); cstring_free (s); } else { fileIdList_add (files, fileTable_addFileOnly (context_fileTable (), s)); } } static void addXHFile (fileIdList files, /*@temp@*/ cstring s) { cstring pathName = findLarchPathFile (s); if (cstring_isDefined (pathName)) { if (fileTable_exists (context_fileTable (), pathName)) { showHerald (); lldiagmsg (message ("File listed multiple times: %s", s)); } else { fileIdList_add (files, fileTable_addXHFile (context_fileTable (), pathName)); } } cstring_free (pathName); } void flags_processFlags (bool inCommandLine, fileIdList xfiles, fileIdList cfiles, fileIdList lclfiles, fileIdList mtfiles, cstringList *passThroughArgs, int argc, char **argv) { int i; cstringSList fl = cstringSList_undefined; for (i = 0; i < argc; i++) { char *thisarg; llassert (argv != NULL); thisarg = argv[i]; DPRINTF (("process thisarg [%d]: %s", i, thisarg)); if (*thisarg == '-' || *thisarg == '+') { bool set = (*thisarg == '+'); cstring flagname; flagcode opt; if (*(thisarg + 1) == '-') { /* allow -- before flags */ flagname = cstring_fromChars (thisarg + 2); } else { flagname = cstring_fromChars (thisarg + 1); } opt = flags_identifyFlag (flagname); DPRINTF (("Flag [%s]: %s", flagname, flagcode_unparse (opt))); if (flagcode_isInvalid (opt)) { DPRINTF (("Error!")); voptgenerror (FLG_BADFLAG, message ("Unrecognized option: %s", cstring_fromChars (thisarg)), g_currentloc); } else if (flagcode_isHelpFlag (opt)) { if (inCommandLine) { voptgenerror (FLG_BADFLAG, message ("Help flag must be first on the command line: %s", cstring_fromChars (thisarg)), g_currentloc); } else { voptgenerror (FLG_BADFLAG, message ("Help flags can only be used on the command line: %s", cstring_fromChars (thisarg)), g_currentloc); } } else if (flagcode_isPassThrough (opt)) /* preprocessor flag: -D or -U */ { /* ** Following space is optional, don't include the - */ *passThroughArgs = cstringList_add (*passThroughArgs, cstring_fromCharsNew (thisarg + 1)); } else if (opt == FLG_INCLUDEPATH || opt == FLG_SPECPATH) { if (mstring_length (thisarg) < 2) { BADBRANCH; } else { if (mstring_equal (thisarg, "-I-")) { cppAddIncludeDir (cstring_fromChars (thisarg)); /* Need to handle this specially. */ } else { cstring dir = cstring_suffix (cstring_fromChars (thisarg), 2); /* skip over -I */ DPRINTF (("Length of thisarg [%s] %d", thisarg, cstring_length (thisarg))); if (cstring_length (dir) == 0) { DPRINTF (("space after directory: ")); if (++i < argc) { dir = cstring_fromChars (argv[i]); } else { voptgenerror (FLG_BADFLAG, message ("Flag %s must be followed by a directory name", flagcode_unparse (opt)), g_currentloc); } } DPRINTF (("Got directory: [%s]", dir)); switch (opt) { case FLG_INCLUDEPATH: cppAddIncludeDir (dir); /*@switchbreak@*/ break; case FLG_SPECPATH: /*@-mustfree@*/ g_localSpecPath = cstring_toCharsSafe (message ("%s%h%s", cstring_fromChars (g_localSpecPath), PATH_SEPARATOR, dir)); /*@=mustfree@*/ /*@switchbreak@*/ break; BADDEFAULT; } } } } else if (flagcode_isModeName (opt)) { context_setMode (flagname); } else if (inCommandLine && flagcode_isMessageControlFlag (opt)) { /* ** Processed on first pass */ if (flagcode_hasArgument (opt)) { ++i; } } else { /* ** A normal control flag */ context_userSetFlag (opt, set); if (flagcode_hasArgument (opt)) { if (flagcode_hasNumber (opt)) { if (++i < argc) { flags_setValueFlag (opt, cstring_fromCharsNew (argv[i])); } else { voptgenerror (FLG_BADFLAG, message ("Flag %s must be followed by a number", flagcode_unparse (opt)), g_currentloc); } } else if (flagcode_hasChar (opt)) { if (++i < argc) { flags_setValueFlag (opt, cstring_fromCharsNew (argv[i])); } else { voptgenerror (FLG_BADFLAG, message ("Flag %s must be followed by a character", flagcode_unparse (opt)), g_currentloc); } } else if (flagcode_hasString (opt) || opt == FLG_INIT || opt == FLG_OPTF) { if (++i < argc) { /*drl 10/21/2002 Changed this because arg can be freed when it's passed to lslinit_setInitFile and freeing argv[i] causes a seg fault */ cstring arg = cstring_fromCharsNew (argv[i]); if (opt == FLG_OPTF) { if (inCommandLine) { ; /* -f already processed */ } else { (void) rcfiles_read (arg, passThroughArgs, TRUE); } } else if (opt == FLG_INIT) { lslinit_setInitFile (inputStream_create (arg, cstring_makeLiteralTemp (LCLINIT_SUFFIX), FALSE)); break; } else { DPRINTF (("String flag: %s / %s", flagcode_unparse (opt), arg)); if (opt == FLG_MTSFILE) { /* ** arg identifies mts files */ cstring tmp = message ("%s%s", arg, MTS_EXTENSION); addLarchPathFile (mtfiles, tmp); cstring_free (tmp); tmp = message ("%s%s", arg, XH_EXTENSION); addXHFile (xfiles, tmp); cstring_free (tmp); } else { flags_setStringFlag (opt, cstring_copy (arg)); } } } else { voptgenerror (FLG_BADFLAG, message ("Flag %s must be followed by a string", flagcode_unparse (opt)), g_currentloc); } } else { /* no argument */ } } } } else /* its a filename */ { DPRINTF (("Adding filename: %s", thisarg)); fl = cstringSList_add (fl, cstring_fromChars (thisarg)); } } /* ** create lists of C and LCL files */ if (inCommandLine) { cstringSList_elements (fl, current) { cstring ext = fileLib_getExtension (current); if (cstring_isUndefined (ext)) { /* no extension --- both C and LCL with default extensions */ addFile (cfiles, message ("%s%s", current, C_EXTENSION)); addFile (lclfiles, message ("%s%s", current, LCL_EXTENSION)); } else if (cstring_equal (ext, XH_EXTENSION)) { addXHFile (xfiles, current); } else if (cstring_equal (ext, PP_EXTENSION)) { if (!context_getFlag (FLG_NOPP)) { voptgenerror (FLG_FILEEXTENSIONS, message ("File extension %s used without +nopp flag (will be processed as C source code): %s", ext, current), g_currentloc); } addFile (cfiles, cstring_copy (current)); } else if (cstring_equal (ext, LCL_EXTENSION)) { addFile (lclfiles, cstring_copy (current)); } else if (fileLib_isCExtension (ext)) { addFile (cfiles, cstring_copy (current)); } else if (cstring_equal (ext, MTS_EXTENSION)) { addLarchPathFile (mtfiles, current); } else { voptgenerror (FLG_FILEEXTENSIONS, message ("Unrecognized file extension: %s (assuming %s is C source code)", current, ext), g_currentloc); addFile (cfiles, cstring_copy (current)); } } end_cstringSList_elements; } else { if (cstringSList_size (fl) != 0) { /* Cannot list files in .splintrc files */ voptgenerror (FLG_BADFLAG, message ("Cannot list files in .splintrc files: %s (probable missing + or -)", cstringSList_unparse (fl)), g_currentloc); } } cstringSList_free (fl); /* evans 2002-07-12: why wasn't this reported!?? */ } int flagcode_priority (/*@unused@*/ flagcode code) { /* ** For now, we do a really simple prioritization: all are 1 */ return 1; } splint-3.1.2.dfsg1/src/general.c0000644021234200000250000002032307650621400014013 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** general.c */ # include "splintMacros.nf" # include "basic.h" # undef malloc # undef realloc # undef calloc # ifdef USEDMALLOC # include "dmalloc.h" # endif # include "osd.h" /* ** redefine undef'd memory ops */ # ifndef USEDMALLOC /*@-mustdefine@*/ void sfree (void *x) { if (x != NULL) { /* fprintf (stderr, "Freeing: %p\n", x); */ /* if ((unsigned long) x > 0xbf000000) { fprintf (stderr, "Looks bad!\n"); } */ free (x); /* fprintf (stderr, "Done.\n"); */ } } # endif void sfreeEventually (void *x) { if (x != NULL) { ; /* should keep in a table */ } /*@-mustfree@*/ } /*@=mustfree@*/ /* ** all memory should be allocated from dimalloc */ static long unsigned size_toLongUnsigned (size_t x) { long unsigned res = (long unsigned) x; llassert ((size_t) res == x); return res; } /*@out@*/ void *dimalloc (size_t size, const char *name, int line) /*@ensures maxSet(result) == (size - 1); @*/ { /* static void *lastaddr = 0; static int numallocs = 0; static int numbad = 0; */ /* was malloc, use calloc to initialize to zero */ void *ret = (void *) calloc (1, size); /* numallocs++; if (ret < lastaddr) { numbad++; fprintf (stderr, "Bad alloc: %d / %d\n", numbad, numallocs); } lastaddr = ret; */ if (ret == NULL) { if (size == 0) { llcontbug (message ("Zero allocation at %q.", fileloc_unparseRaw (cstring_fromChars (name), line))); /* ** evans 2002-03-01 ** Return some allocated storage...hope we get lucky. */ return dimalloc (16, name, line); } else { /* drl fix this so message doesn't run out of memory*/ llbuglit("Out of memory"); llfatalerrorLoc (message ("Out of memory. Allocating %w bytes at %s:%d.", size_toLongUnsigned (size), cstring_fromChars (name), line)); } } /*@-null@*/ /* null okay for size = 0 */ /* fprintf (stderr, "%s:%d: Allocating: [%p / %d]\n", name, line, ret, size); */ return ret; /*@=null@*/ } void *dicalloc (size_t num, size_t size, const char *name, int line) { void *ret = (void *) calloc (num, size); if (ret == NULL) { llfatalerrorLoc (message ("Out of memory. Allocating %w bytes at %s:%d.", size_toLongUnsigned (size), cstring_fromChars (name), line)); } return ret; } void *direalloc (/*@out@*/ /*@null@*/ void *x, size_t size, char *name, int line) { void *ret; if (x == NULL) { ret = (void *) dmalloc (size); } else { ret = (void *) realloc (x, size); } if (ret == NULL) { llfatalerrorLoc (message ("Out of memory. Allocating %w bytes at %s:%d.", size_toLongUnsigned (size), cstring_fromChars (name), line)); } return ret; } /*@=mustdefine@*/ bool firstWord (char *s, char *w) { llassert (s != NULL); llassert (w != NULL); for (; *w != '\0'; w++, s++) { if (*w != *s || *s == '\0') return FALSE; } return TRUE; } void mstring_markFree (char *s) { sfreeEventually (s); } char *mstring_spaces (int n) { int i; char *ret; char *ptr; llassert (n >= 0); ret = (char *) dmalloc (size_fromInt (n + 1)); ptr = ret; for (i = 0; i < n; i++) { *ptr++ = ' '; } *ptr = '\0'; return ret; } bool mstring_containsChar (const char *s, char c) { if (mstring_isDefined (s)) { return (strchr (s, c) != NULL); } else { return FALSE; } } bool mstring_containsString (const char *s, const char *c) { if (mstring_isDefined (s)) { return (strstr (s, c) != NULL); } else { return FALSE; } } char *mstring_concat (const char *s1, const char *s2) { char *s = (char *) dmalloc (strlen (s1) + strlen (s2) + 1); strcpy (s, s1); strcat (s, s2); return s; } extern /*@only@*/ char * mstring_concatFree (/*@only@*/ char *s1, /*@only@*/ char *s2) { /* like mstring_concat but deallocates old strings */ char *s = (char *) dmalloc (strlen (s1) + strlen (s2) + 1); strcpy (s, s1); strcat (s, s2); sfree (s1); sfree (s2); return s; } extern /*@only@*/ char * mstring_concatFree1 (/*@only@*/ char *s1, const char *s2) { char *s = (char *) dmalloc (strlen (s1) + strlen (s2) + 1); strcpy (s, s1); strcat (s, s2); sfree (s1); return s; } extern /*@only@*/ char * mstring_append (/*@only@*/ char *s1, char c) { size_t l = strlen (s1); char *s; s = (char *) dmalloc (sizeof (*s) * (l + 2)); strcpy (s, s1); *(s + l) = c; *(s + l + 1) = '\0'; sfree (s1); return s; } extern char *mstring_copy (char *s1) /*@ensures maxRead(result) == maxRead(s1) /\ maxSet(result) == maxSet(s1) @*/ { if (s1 == NULL) { return NULL; } else { char *s = (char *) dmalloc ((strlen (s1) + 1) * sizeof (*s)); strcpy (s, s1); return s; } } extern char *mstring_safePrint (char *s) { if (s == NULL) { return (""); } else { return s; } } extern char *mstring_create (size_t n) { char *s; s = dmalloc (sizeof (*s) * (n + 1)); *s = '\0'; return s; } void fputline (FILE *out, char *s) { if (strlen (s) > 0) { check (fputs (s, out) != EOF); } check (fputc ('\n', out) == (int) '\n'); } unsigned int int_toNonNegative (int x) /*@*/ { llassert (x >= 0); return (unsigned) x; } int int_log (int x) { int ret = 1; while (x > 10) { ret++; x /= 10; } return ret; } /*@-czechfcns@*/ long unsigned int longUnsigned_fromInt (int x) { llassert (x >= 0); return (long unsigned) x; } size_t size_fromInt (int x) /*@ensures result==x@*/ { size_t res = (size_t) x; llassert ((int) res == x); return res; } size_t size_fromLong (long x) /*@ensures result==x@*/ { size_t res = (size_t) x; llassert ((long) res == x); return res; } size_t size_fromLongUnsigned (unsigned long x) /*@ensures result==x@*/ { size_t res = (size_t) x; llassert ((unsigned long) res == x); return res; } int size_toInt (size_t x) { int res = (int) x; llassert ((size_t) res == x); return res; } long size_toLong (size_t x) { long res = (long) x; llassert ((size_t) res == x); return res; } /*@=czechfcns@*/ char char_fromInt (int x) { /* ** evans 2001-09-28 - changed assertion in response to Anthony Giorgio's comment ** that the old assertions failed for EBCDIC character set. Now we just check ** that the result is equal. */ char res = (char) x; llassert ((int) res == x); return res; } /*@-czechfcns@*/ int longUnsigned_toInt (long unsigned int x) { int res = (int) x; llassert ((long unsigned) res == x); return res; } int long_toInt (long int x) { int res = (int) x; /*@+ignorequals@*/ llassert (res == x); /*@=ignorequals@*/ return res; } /*@+czechfcns@*/ bool mstring_equalPrefix (const char *c1, const char *c2) { llassert (c1 != NULL); llassert (c2 != NULL); if (strncmp(c1, c2, strlen(c2)) == 0) { return TRUE; } else { return FALSE; } } bool mstring_equal (/*@null@*/ const char *s1, /*@null@*/ const char *s2) { if (s1 == NULL) { return (s2 == NULL); } else { if (s2 == NULL) { return FALSE; } else { return (strcmp(s1, s2) == 0); } } } splint-3.1.2.dfsg1/src/osd.c0000644021234200000250000006717510645775054013220 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** osd.c ** ** Provide a system-independent interface to system-dependent ** file operations. */ /* * Modified by Herbert 04/19/97: * - added conditional 'OS2' to conditional 'MSDOS' * - added include of new header portab.h. * - changed '/' to macro. * - added DOS / OS/2 specific stuff in osd_getPath. * Herbert 06/12/2000: * - added OS/2 specific includes before osd_getPid() * - handle files like in WIN32 for OS/2 in osd_fileExists() * Herbert 02/17/2002: * - added OS/2 support to absolute file names */ /*@-allmacros*/ /*@ignore@*/ # include # include /* Fix suggested by Lars Rasmussen */ # include /* POSIX platforms should defined getpid in unistd.h */ # if defined (WIN32) || (defined(OS2) && defined(__IBMC__)) # include # include # define getcwd _getcwd # else # include # endif /*@end@*/ /*@=allmacros*/ # include "splintMacros.nf" # include "basic.h" # include "osd.h" /* from stat.h */ /*@ignore@*/ extern int stat (const char *, /*@out@*/ struct stat *); /*@end@*/ static bool osd_executableFileExists (char *); static bool nextdir (char **p_current_dir, /*@out@*/ char **p_dir, /*@out@*/ size_t *p_len); extern cstring LSLRootName (cstring filespec) { /*@access cstring@*/ char *result, *startName, *tail; size_t nameLength; llassert (cstring_isDefined (filespec)); tail = strrchr (filespec, CONNECTCHAR); startName = (tail == NULL ? filespec : &tail[1]); tail = strrchr (startName, '.'); nameLength = (tail == NULL ? strlen (startName) : size_fromInt (tail - startName)); result = dmalloc (nameLength + 1); strncpy (result, startName, nameLength); result[(int) nameLength] = '\0'; return result; /*@noaccess cstring@*/ } extern /*@observer@*/ cstring osd_getEnvironment (cstring env, /*@returned@*/ cstring def) { /*@access cstring@*/ char *ret = osd_getEnvironmentVariable (env); if (ret == NULL) { return def; } else { return ret; } /*@noaccess cstring@*/ } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** This function attempts to locate a file in a search list. On VMS, it ** just concatinates the path and file names, and then lets RMS do the ** searching. On Ultrix, it searches for the file on the path. ** ** FORMAL PARAMETERS: ** ** path: search path where to look for the file. ** file: name of file to search for. ** returnPath: if a file is found, this is where the concatenated ** directory and file name are returned. ** ** RETURN VALUE: ** ** OSD_FILEFOUND: the file was found on the search list. ** OSD_FILENOTFOUND the file was not found. ** OSD_PATHTOOLONG the concatenated directory and file name are too ** long. ** ** SIDE EFFECTS: ** ** None ** ** PRECONDITIONS: ** ** Requires that parameters, path and file, are valid C strings. ** ** **-- */ extern /*@observer@*/ cstring osd_getHomeDir () { /* Would something different be better for windows? */ return (osd_getEnvironmentVariable (cstring_makeLiteralTemp ("HOME"))); } filestatus osd_findOnLarchPath (cstring file, cstring *returnPath) { return (osd_getPath (context_getLarchPath (), file, returnPath)); } extern filestatus osd_getPath (cstring path, cstring file, cstring *returnPath) { char *fullPath; char *dirPtr; size_t dirLen; char aPath[MAXPATHLEN]; filestatus rVal = OSD_FILENOTFOUND; /* assume file not found. */ /*@access cstring@*/ fullPath = path; llassert (cstring_isDefined (file)); /* 2002-01-01: make sure returnPath gets defined even when there are errors. ** (fixed splint checking detected this) */ *returnPath = cstring_undefined; if (fullPath == NULL || # if defined(OS2) || defined(MSDOS) || defined(WIN32) /* under OS/2 and MSDOS the includePath may be empty, if so, search * the current directory. */ *fullPath == '\0' || (*file == CONNECTCHAR || (file[0] != '\0' && file[1] == ':')) # else (*file == CONNECTCHAR) # endif ) { /* No path specified. Look for it in the current directory. */ strcpy (&aPath[0], file); if (osd_fileExists (&aPath[0])) { rVal = OSD_FILEFOUND; *returnPath = dmalloc (strlen (&aPath[0]) + 1); strcpy (*returnPath, &aPath[0]); } } else { /* Path specified. Loop through directories in path looking for the */ /* first occurrence of the file. */ while (nextdir (&fullPath, &dirPtr, &dirLen) && rVal == OSD_FILENOTFOUND) { if ((dirLen + strlen (file) + 2) <= MAXPATHLEN) { /* Cat directory and filename, and see if file exists. */ strncpy (&aPath[0], dirPtr, dirLen); strcpy (&aPath[0] + dirLen, ""); /* Null terminate aPath. */ strcat (&aPath[0], CONNECTSTR); strcat (&aPath[0], file); if (osd_fileExists (&aPath[0])) { rVal = OSD_FILEFOUND; *returnPath = (char *) dmalloc (strlen (&aPath[0]) + 1); strcpy (*returnPath, &aPath[0]); } } else { rVal = OSD_PATHTOOLONG; } } } return rVal; /*@noaccess cstring@*/ } extern filestatus osd_getExePath (cstring path, cstring file, cstring *returnPath) { char *fullPath; char *dirPtr; size_t dirLen; char aPath[MAXPATHLEN]; filestatus rVal = OSD_FILENOTFOUND; /* assume file not found. */ /*@access cstring@*/ *returnPath = cstring_undefined; fullPath = osd_getEnvironmentVariable (path); if (fullPath == NULL) { /* No path specified. Look for it in the current directory. */ llassert (cstring_isDefined (file)); strcpy (&aPath[0], file); if (osd_fileExists (&aPath[0])) { rVal = OSD_FILEFOUND; *returnPath = dmalloc (strlen (&aPath[0]) + 1); strcpy (*returnPath, &aPath[0]); } } else { /* ** Path specified. Loop through directories in path looking ** for the first occurrence of the file. */ while (nextdir (&fullPath, &dirPtr, &dirLen) && rVal == OSD_FILENOTFOUND) { llassert (cstring_isDefined (file)); if ((dirLen + cstring_length (file) + 2) <= MAXPATHLEN) { /* Cat directory and filename, and see if file exists. */ strncpy (&aPath[0], dirPtr, dirLen); strcpy (&aPath[0] + dirLen, ""); /* Null terminate aPath. */ strcat (&aPath[0], CONNECTSTR); strcat (&aPath[0], file); if (osd_executableFileExists (&aPath[0])) { rVal = OSD_FILEFOUND; *returnPath = dmalloc (strlen (&aPath[0]) + 1); strcpy (*returnPath, &aPath[0]); } } else { rVal = OSD_PATHTOOLONG; } } } return rVal; /*@noaccess cstring@*/ } bool osd_fileExists (cstring filespec) { # ifdef UNIX struct stat buf; /*@i3@*/ return (stat (cstring_toCharsSafe (filespec), &buf) == 0); /* spurious */ # else # if defined (WIN32) || defined (OS2) FILE *test = fileTable_openReadFile (context_fileTable (), filespec); if (test != NULL) { (void) fileTable_closeFile (context_fileTable (),test); return TRUE; } else { return FALSE; } # else return FALSE; # endif # endif } # if defined(__IBMC__) && defined(OS2) # define S_IFMT (unsigned short)0xFFFF # endif /* ** Works form Win32 at least... */ # ifndef S_IXUSR /*@-macrounrecog@*/ # define S_IXUSR _S_IEXEC /*@=macrounrecog@*/ # endif bool osd_executableFileExists (/*@unused@*/ char *filespec) { /*@-compdestroy@*/ /* possible memory leaks here? */ # ifdef UNIX struct stat buf; if (stat (filespec, &buf) == 0) { /* mask by file type */ /*@-type@*/ /* confusion about __mode_t and mode_t types */ if ((buf.st_mode & S_IFMT) != S_IFDIR) /* not a directory */ /*@=type@*/ { /* as long as it is an executable file */ # if defined(__IBMC__) && defined(OS2) int com_or_exe_pos = strlen( filespec) - 4; return stricmp( &filespec[com_or_exe_pos], ".exe") == 0 || stricmp( &filespec[com_or_exe_pos], ".com") == 0 || stricmp( &filespec[com_or_exe_pos], ".bat") == 0 || stricmp( &filespec[com_or_exe_pos], ".cmd") == 0; # else return (((buf.st_mode & S_IXUSR) # if defined (S_IXGRP) && defined (S_IXOTH) | (buf.st_mode & S_IXGRP) | (buf.st_mode & S_IXOTH) # endif ) != 0); /* spurious */ # endif } } # endif return (FALSE); /*@=compdestroy@*/ } /* **++ ** FUNCTIONAL DESCRIPTION: ** ** Find the next directory from a directory path. ** ** FORMAL PARAMETERS: ** ** char ** current_dir : ** Points to the current position in the path string. The first time ** you call this routine, this should point to the first character of ** the path. On return, this will be updated to point to the ** terminating \0 or : of the first directory found. You can then pass ** it unchanged for subsequent calls; this routine will correctly skip ** over the :. ** ** char ** dir : ** On exit, this will point to the first character of the directory ** that was found. This will be a pointer directly into the client's ** path string. ** ** unsigned int * len : ** On exit, this will contain the length of the directory that was ** found, not counting any terminating \0 or :. If no directory was ** found, this will be 0. ** ** RETURN VALUE: ** TRUE if we found another directory. ** FALSE otherwise. ** ** DESIGN: ** ** We return a pointer and length, rather than a string, because of a) ** historical reasons; and b) this avoids having to allocate storage. ** ** ** **-- */ static bool nextdir (d_char *current_dir, d_char *dir, size_t *len) { char *tchar; if (**current_dir == '\0') { *len = 0; *dir = NULL; return FALSE; } *dir = (**current_dir == PATH_SEPARATOR ? *current_dir + 1 : *current_dir); /* Find next ':' or end of string */ for (tchar = *dir; *tchar != '\0' && *tchar != PATH_SEPARATOR; tchar++) { ; } *current_dir = tchar; *len = size_fromInt (tchar - *dir); return TRUE; } /*@observer@*/ /*@null@*/ cstring osd_getEnvironmentVariable (cstring var) { /* evans - 2001-08-26 fixed OS instead of OS2 bug, reported by Alexander Mai */ # if defined(UNIX) || defined(OS2) || defined(MSDOS) || defined(WIN32) char *val = getenv (cstring_toCharsSafe (var)); if (val == NULL) { return cstring_undefined; } else { return cstring_makeLiteralTemp (val); } # else return cstring_undefined; # endif } # if defined (WIN32) || defined (OS2) && defined (__IBMC__) extern /*@external@*/ int _flushall (void) /*@modifies fileSystem@*/ ; # endif # ifndef system extern /*@external@*/ int system (const char *) /*@modifies fileSystem@*/ ; # endif int osd_system (cstring cmd) { int res; /* system ("printenv"); */ # if defined (WIN32) || defined (OS2) && defined (__IBMC__) (void) _flushall (); # endif res = system (cstring_toCharsSafe (cmd)); return res; } # ifndef unlink /* This should be defined by unistd.h */ /*@-redecl@*/ extern /*@external@*/ int unlink (const char *) /*@modifies fileSystem@*/ ; /*@=redecl@*/ # endif static bool s_tempError = FALSE; void osd_setTempError (void) { s_tempError = TRUE; } int osd_unlink (cstring fname) { int res; res = unlink (cstring_toCharsSafe (fname)); if (res != 0) { if (!s_tempError) { llcontbug (message ("Cannot remove temporary file: %s (%s)", fname, cstring_fromChars (strerror (errno)))); } } return res; } # if defined (WIN32) || defined (OS2) && defined (__IBMC__) int # else int /* pid_t */ # endif osd_getPid () { # if defined (WIN32) || defined (OS2) && defined (__IBMC__) int pid = _getpid (); # else __pid_t pid = getpid (); # endif return (int) pid; } cstring osd_fixDefine (cstring x) { /*@access cstring@*/ llassert (cstring_isDefined (x)); # ifdef UNIX if (strchr (x, '\'') != NULL) { /* ** If there is a single quote, check for ='' and ** produce = */ char *eqs = strchr (x, '='); if (eqs != NULL) { if (eqs[1] == '\'') { char *endqu = strrchr (x, '\''); if (endqu != NULL) { if (*(endqu - 1) != '\\') { if (*(endqu + 1) == '\0') { cstring res; cstring def; *endqu = '\0'; def = cstring_fromChars (eqs + 2); eqs[1] = '\0'; res = cstring_concat (cstring_fromChars (x), def); return res; } } } } } } # endif return cstring_copy (x); /*@noaccess cstring@*/ } bool osd_fileIsReadable (cstring f) { FILE *fl = fileTable_openReadFile (context_fileTable (), f); if (fl != NULL) { check (fileTable_closeFile (context_fileTable (), fl)); return (TRUE); } else { return (FALSE); } } bool osd_isConnectChar (char c) { if (c == CONNECTCHAR) { return TRUE; } # ifdef HASALTCONNECTCHAR if (c == ALTCONNECTCHAR) { return TRUE; } # endif return FALSE; } /* ** Returns true if c2 starts with the same path as c1 ** ** This is called by context_isSystemDir to determine if a ** directory is on the system path. ** ** In unix, this is just a string comparison. For Win32 and OS2, we need a more ** complex comparison. */ bool osd_equalCanonicalPrefix (cstring dirpath, cstring prefixpath) { llassert (cstring_isDefined (prefixpath)); if (cstring_isEmpty (dirpath)) { return (cstring_isEmpty (prefixpath)); } # if defined (WIN32) || defined (OS2) /*@access cstring@*/ /* Moved this from cstring - should abstract it... */ /* ** If one has a drive specification, but the other doesn't, skip it. */ if (strchr (dirpath, ':') == NULL && strchr (prefixpath, ':') != NULL) { prefixpath = strchr (prefixpath, ':') + 1; } else { if (strchr (prefixpath, ':') == NULL && strchr (dirpath, ':') != NULL) { dirpath = strchr (dirpath, ':') + 1; } } { int len = size_toInt (strlen (prefixpath)); int i = 0; int slen = 0; for (i = 0, slen = 0; i < len; i++, slen++) { /* Allow any number of connect characters in any combination: * c:/usr//src\/foo == c:\\usr/src\/foo * After this we'll be at the last of such a sequence */ if (osd_isConnectChar (dirpath[slen]) && osd_isConnectChar (prefixpath[i])) { /* Skip one or more connect chars */ for (; osd_isConnectChar (dirpath[slen+1]); ++slen) { ; } for (; osd_isConnectChar (prefixpath[i+1]); ++i) { ; } } /* Windows, MSDOS and OS/2 use case-insensitive path specs! */ else if (toupper (dirpath[slen]) != toupper (prefixpath[i])) { return FALSE; } } } /*@noaccess cstring@*/ return TRUE; # else return (cstring_equalPrefix (dirpath, prefixpath)); # endif } # if 0 /* ** This code provided by Herbert Martin Dietze, to canonicalize path names. */ char *osd_getcwd (/*@returned@*/ char *str, size_t size) { return getcwd (str, size); } /*@null@*/ /*@observer@*/ char * osd_dirNext (char *str) { char *p1 = strchr (str, '/'); char *p2 = strchr (str, '\\'); if (p1 == NULL) { if (p2 != NULL) { return p2 + 1; } else { return NULL; } } else if (p2 == NULL) { return p1 + 1; } else /* both not null */ { return (p1 < p2 ? p1 : p2) + 1; } } static void osd_dirShift (char *str, size_t num) /*@modifies str@*/ { int i; assert (num <= strlen (str)); for (i = 0; str[i] != '\0'; i++) { str[i] = str[i + num]; } } bool osd_dirDotdot (char *str) { return str[0] == '.' && str[1] == '.' && osd_isConnectChar (str[2]); } void osd_dirNormalize (char *str) { char *pos1, *pos2; for (; osd_isConnectChar (str[0]); str++) { } for (; str != NULL && osd_dirDotdot (str); str = osd_dirNext (str)) { } for (pos1 = pos2 = str; pos1 != NULL; pos2 = pos1, pos1 = osd_dirNext (pos1)) { /* remove redundant `./' entry */ while (pos1[0] == '.' && osd_isConnectChar (pos1[1])) { osd_dirShift (pos1, 2); } /* remove redundant `foo/../' entry */ if (osd_dirDotdot (pos1) && pos2 < pos1) { osd_dirShift (pos2, pos1 - pos2 + 1); osd_dirNormalize (str); } } } /*@null@*/ char * osd_dirAbsolute (char *str) { char *ret = NULL; size_t size = PATH_MAX * sizeof (*ret); DPRINTF (("Absolute for: %s", str)); # if defined (WIN32) || defined (OS2) || defined (MSDOS) if (strlen (str) > 1 && str[1] == ':') { /* ** Its a drive letter */ ret = dmalloc ((strlen (str) + 1) * sizeof (*ret)); strcpy (ret, str); } else # endif if (osd_isConnectChar (str[0])) { ret = dmalloc ((strlen (str) + 1) * sizeof (*ret)); strcpy (ret, str); } else { ret = dmalloc (size); ret = osd_getcwd (ret, size); ret = realloc (ret, (strlen (str) + strlen (ret) + 2) * sizeof (*ret)); if (ret == NULL) { return NULL; } strcat (ret, CONNECTSTR); strcat (ret, str); } osd_dirNormalize (ret); return ret; } # endif /* ** absolute paths ** ** This code is adapted from: ** ** http://src.openresources.com/debian/src/devel/HTML/S/altgcc_2.7.2.2.orig%20altgcc-2.7.2.2.orig%20protoize.c.html#1297 ** ** ** Protoize program - Original version by Ron Guilmette (rfg@segfault.us.com). ** Copyright (C) 1989, 1992, 1993, 1994, 1995 Free Software Foundation, Inc. ** ** This file is part of GNU CC. ** ** GNU CC is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. ** ** GNU CC is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with GNU CC; see the file COPYING. If not, write to ** the Free Software Foundation, 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. */ /* ** Return the absolutized filename for the given relative ** filename. Note that if that filename is already absolute, it may ** still be returned in a modified form because this routine also ** eliminates redundant slashes and single dots and eliminates double ** dots to get a shortest possible filename from the given input ** filename. The absolutization of relative filenames is made by ** assuming that the given filename is to be taken as relative to ** the first argument (cwd) or to the current directory if cwd is ** NULL. */ /* A pointer to the current directory filename (used by abspath). */ static /*@only@*/ cstring osd_cwd = cstring_undefined; static void osd_setWorkingDirectory (void) { # if defined (UNIX) || defined (OS2) char *buf = dmalloc (sizeof (*buf) * MAXPATHLEN); char *cwd = getcwd (buf, MAXPATHLEN); llassert (cstring_isUndefined (osd_cwd)); if (cwd == NULL) { lldiagmsg (message ("Cannot get working directory: %s\n", lldecodeerror (errno))); osd_cwd = cstring_makeLiteral (""); } else { osd_cwd = cstring_fromCharsNew (cwd); } sfree (buf); # else ; /* Don't know how to do this for non-POSIX platforms */ # endif } void osd_initMod (void) { osd_setWorkingDirectory (); } void osd_destroyMod (void) { cstring_free (osd_cwd); osd_cwd = cstring_undefined; } cstring osd_absolutePath (cstring cwd, cstring filename) { # if defined (UNIX) || defined (OS2) /* Setup the current working directory as needed. */ cstring cwd2 = cstring_isDefined (cwd) ? cwd : osd_cwd; char *abs_buffer; char *endp, *outp, *inp; /*@access cstring@*/ llassert (cstring_isDefined (cwd2)); llassert (cstring_isDefined (filename)); abs_buffer = (char *) dmalloc (cstring_length (cwd2) + cstring_length (filename) + 2); endp = abs_buffer; /* ** Copy the filename (possibly preceded by the current working ** directory name) into the absolutization buffer. */ { const char *src_p; if (!osd_isConnectChar (filename[0]) # ifdef OS2 && !(isalpha (filename[0]) && filename[1] == ':') # endif ) { src_p = cwd2; while ((*endp++ = *src_p++) != '\0') { continue; } *(endp-1) = CONNECTCHAR; /* overwrite null */ } src_p = filename; while ((*endp++ = *src_p++) != '\0') { continue; } } /* Now make a copy of abs_buffer into abs_buffer, shortening the filename (by taking out slashes and dots) as we go. */ outp = inp = abs_buffer; *outp++ = *inp++; /* copy first slash */ #ifdef apollo if (inp[0] == '/') *outp++ = *inp++; /* copy second slash */ #endif for (;;) { if (inp[0] == '\0') { break; } else if (osd_isConnectChar (inp[0]) && osd_isConnectChar (outp[-1])) { inp++; continue; } else if (inp[0] == '.' && osd_isConnectChar (outp[-1])) { if (inp[1] == '\0') { break; } else if (osd_isConnectChar (inp[1])) { inp += 2; continue; } else if ((inp[1] == '.') && (inp[2] == '\0' || osd_isConnectChar (inp[2]))) { inp += (osd_isConnectChar (inp[2])) ? 3 : 2; outp -= 2; while (outp >= abs_buffer && !osd_isConnectChar (*outp)) { outp--; } if (outp < abs_buffer) { /* Catch cases like /.. where we try to backup to a point above the absolute root of the logical file system. */ llfatalbug (message ("Invalid file name: %s", filename)); } *++outp = '\0'; continue; } else { ; } } else { ; } *outp++ = *inp++; } /* On exit, make sure that there is a trailing null, and make sure that the last character of the returned string is *not* a slash. */ *outp = '\0'; if (osd_isConnectChar (outp[-1])) *--outp = '\0'; /*@noaccess cstring@*/ return cstring_fromChars (abs_buffer); # else DPRINTF (("Here: %s", filename)); return cstring_copy (filename); # endif } /* ** Given a filename (and possibly a directory name from which the filename ** is relative) return a string which is the shortest possible ** equivalent for the corresponding full (absolutized) filename. The ** shortest possible equivalent may be constructed by converting the ** absolutized filename to be a relative filename (i.e. relative to ** the actual current working directory). However if a relative filename ** is longer, then the full absolute filename is returned. ** ** KNOWN BUG: subpart of the original filename is actually a symbolic link. ** ** this is really horrible code...surely someone has written a less buggy version of this! */ cstring osd_outputPath (cstring filename) { # if defined (UNIX) || defined (OS2) char *rel_buffer; char *rel_buf_p; cstring cwd_p = osd_cwd; char *path_p; int unmatched_slash_count = 0; size_t filename_len = cstring_length (filename); llassertretval (filename_len > 0, filename); /*@access cstring@*/ path_p = filename; rel_buffer = (char *) dmalloc (filename_len); rel_buf_p = rel_buffer; *rel_buf_p = '\0'; if (cwd_p == NULL) { /* Need to prevent recursive assertion failures */ return cstring_copy (filename); } llassert (cwd_p != NULL); llassert (path_p != NULL); while ((*cwd_p != '\0') && (*cwd_p == *path_p)) { cwd_p++; path_p++; } if ((*cwd_p == '\0') && (*path_p == '\0' || osd_isConnectChar (*path_p))) /* whole pwd matched */ { if (*path_p == '\0') /* input *is* the current path! */ { cstring_free (rel_buffer); return cstring_makeLiteral ("."); } else { cstring_free (rel_buffer); return cstring_fromCharsNew (path_p + 1); } } else { /* drl 2002-10/14 I had to put this code back*/ /* the case that needs it is when splint is given an absolute path name of a file outside of the current directory and the subdirectories below the current directory. e.g. cd /home/; splint /tmp/prog.c */ /* evans 2002-02-05 This is horrible code, which I've removed. I couldn't find any ** test cases that need it, so I hope I'm not breaking anything. */ /*#if 0*/ if (*path_p != '\0') { --cwd_p; --path_p; while (cwd_p >= osd_cwd && !osd_isConnectChar (*cwd_p)) /* backup to last slash */ { --cwd_p; --path_p; } cwd_p++; path_p++; unmatched_slash_count++; } /* Find out how many directory levels in cwd were *not* matched. */ while (*cwd_p != '\0') { if (osd_isConnectChar (*cwd_p++)) unmatched_slash_count++; } /* Now we know how long the "short name" will be. Reject it if longer than the input. */ if (unmatched_slash_count * 3 + strlen (path_p) >= filename_len) { cstring_free (rel_buffer); /* fprintf (stderr, "Returning filename: %s [%p]\n", filename); */ return cstring_copy (filename); } /*drl 10-14-2002 end previously removed code */ /*#endif*/ /* For each of them, put a `../' at the beginning of the short name. */ while (unmatched_slash_count-- > 0) { /* Give up if the result gets to be longer than the absolute path name. */ char * temp_rel_buf_p; /*drl This comment is necessary because for some reason Splint does not realize that the pasts where rel_buf_p is released do not reach here*/ /*@-usereleased@*/ temp_rel_buf_p = rel_buf_p; /*@-usereleased@*/ if (rel_buffer + filename_len <= temp_rel_buf_p + 3) { sfree (rel_buffer); return cstring_copy (filename); } *rel_buf_p++ = '.'; *rel_buf_p++ = '.'; *rel_buf_p++ = CONNECTCHAR; } /* Then tack on the unmatched part of the desired file's name. */ do { if (rel_buffer + filename_len <= rel_buf_p) { cstring_free (rel_buffer); return cstring_copy (filename); } } /*@-usereleased@*/ while ((*rel_buf_p++ = *path_p++) != '\0') ; /*@=usereleased@*/ /* Splint limitation: shouldn't need these */ --rel_buf_p; if (osd_isConnectChar (*(rel_buf_p-1))) *--rel_buf_p = '\0'; /* fprintf (stderr, "Returning buffer: %s [%p]\n", rel_buffer, rel_buffer); */ return rel_buffer; } /*@noaccess cstring@*/ # else return cstring_copy (filename); # endif } cstring osd_getCurrentDirectory () { # if defined(MSDOS) || defined(OS2) return cstring_makeLiteralTemp (""); # else return cstring_makeLiteralTemp ("./"); # endif } splint-3.1.2.dfsg1/src/reader.c0000644021234200000250000001013607630461221013642 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** reader.c */ # include "splintMacros.nf" # include "basic.h" int reader_getInt (char **s) { bool gotOne = FALSE; int i = 0; while (**s == ' ') { (*s)++; } if (**s == '-') { (*s)++; if (**s < '0' || **s > '9') { llbug (message ("getInt: bad int: %s", cstring_fromChars (*s))); } else { i = -1 * (int) (**s - '0'); gotOne = TRUE; } (*s)++; } while (**s >= '0' && **s <= '9') { i *= 10; i += (int) (**s - '0'); (*s)++; gotOne = TRUE; } if (!gotOne) { llbug (message ("No int to read: %s", cstring_fromChars (*s))); } while (**s == '\n' || **s == ' ' || **s == '\t') { (*s)++; } return i; } char reader_loadChar (char **s) { char ret; while (**s == ' ') { (*s)++; } ret = **s; (*s)++; return ret; } /* ** not sure if this works... */ double reader_getDouble (char **s) { char *end = mstring_createEmpty (); double ret; ret = strtod (*s, &end); *s = end; return ret; } /* ** read to ' ', '\t'. '\n', '#', ',' or '\0' */ char * reader_getWord (char **s) { char *res; char *t = *s; char c; while ((c = **s) != '\0' && (c != ' ') && (c != ',') && (c != '\n') && (c != '\t') && (c != '#')) { (*s)++; } if (*s == t) { return NULL; } **s = '\0'; res = mstring_copy (t); **s = c; return res; } /* ** read up to x */ cstring reader_readUntil (char **s, char x) { cstring res; char *t = *s; char c; while ((c = **s) != '\0' && (c != x)) { (*s)++; } llassert (**s != '\0'); llassert (*s != t); **s = '\0'; res = cstring_fromChars (mstring_copy (t)); **s = c; return res; } cstring reader_readUntilOne (char **s, char *x) { cstring res; char *t = *s; char c; while ((c = **s) != '\0' && (!mstring_containsChar (x, c))) { (*s)++; } llassert (**s != '\0'); llassert (*s != t); **s = '\0'; res = cstring_fromChars (mstring_copy (t)); **s = c; return res; } bool reader_optCheckChar (char **s, char c) { if (**s == c) { (*s)++; return TRUE; } else { return FALSE; } } void reader_doCheckChar (char **s, char c, char *file, int line) { /*@unchecked@*/ static int nbadchars = 0; if (**s == c) { (*s)++; } else { nbadchars++; if (nbadchars > 5) { llfatalbug (cstring_makeLiteral ("checkChar: Too many errors. Check library is up to date.")); } else { llbug (message ("checkChar: %q: Bad char, expecting %h: %s", fileloc_unparseRaw (cstring_fromChars (file), line), c, cstring_fromChars (*s))); } } } void reader_checkUngetc (int c, FILE *f) { int res; llassert (c != EOF); res = ungetc (c, f); llassert (res == c); } char *reader_readLine (FILE *f, char *s, int max) { char *res = fgets (s, MAX_DUMP_LINE_LENGTH, f); if (res != NULL) { if (strlen (res) == size_fromInt (MAX_DUMP_LINE_LENGTH - 1)) { llfatalerrorLoc (message ("Maximum line length exceeded (%d): %s", max, cstring_fromChars (s))); } incLine (); } return res; } splint-3.1.2.dfsg1/src/mtreader.c0000644021234200000250000000522007646432516014215 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtreader.c ** ** Controls reading of .mts files. */ # include "splintMacros.nf" # include "basic.h" # include "mtgrammar.h" # include "mtscanner.h" void mtreader_readFile (cstring infile) { inputStream sourceFile; fileId fid; cstring fname; sourceFile = inputStream_create (infile, cstring_undefined, FALSE); if (!inputStream_getPath (context_getLarchPath (), sourceFile)) { lldiagmsg (message ("Cannot find metastate file: %s", inputStream_fileName (sourceFile))); inputStream_free (sourceFile); return; } if (!inputStream_open (sourceFile)) { lldiagmsg (message ("Cannot open metastate file: %s", inputStream_fileName (sourceFile))); inputStream_free (sourceFile); return; } fname = inputStream_fileName (sourceFile); if (fileTable_exists (context_fileTable (), fname)) { fid = fileTable_lookup (context_fileTable (), fname); } else { fid = fileTable_addMetastateFile (context_fileTable (), fname); } context_setFileId (fid); displayScan (message ("reading metastate %s", fname)); mtscanner_reset (sourceFile); context_enterMTfile (); (void) mtparse (); context_exitMTfile (); check (inputStream_close (sourceFile)); inputStream_free (sourceFile); } void mtreader_processDeclaration (mtDeclarationNode decl) { DPRINTF (("Processing state %s", mtDeclarationNode_unparse (decl))); mtDeclarationNode_process (decl, FALSE); mtDeclarationNode_free (decl); } void mtreader_processGlobalDeclaration (mtDeclarationNode decl) { DPRINTF (("Processing state %s", mtDeclarationNode_unparse (decl))); mtDeclarationNode_process (decl, TRUE); mtDeclarationNode_free (decl); } splint-3.1.2.dfsg1/src/clauseStack.c0000644021234200000250000000713007630461220014641 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** clauseStack.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" clauseStack clauseStack_new () { clauseStack s = (clauseStack) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = clauseStackBASESIZE; s->elements = (clause *) dmalloc (sizeof (*s->elements) * clauseStackBASESIZE); s->current = 0; return (s); } static void clauseStack_grow (clauseStack s) { int i; clause *newelements; s->nspace += clauseStackBASESIZE; newelements = (clause *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (clause *) 0) { llfatalerror (cstring_makeLiteral ("clauseStack_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void clauseStack_push (clauseStack s, clause el) { if (s->nspace <= 0) clauseStack_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } void clauseStack_pop (clauseStack s) { s->nelements--; s->nspace++; } clause clauseStack_top (clauseStack s) { return (s->elements[s->nelements - 1]); } void clauseStack_switchTop (clauseStack s, clause x) { llassert (s->nelements > 0); s->elements[s->nelements - 1] = x; } void clauseStack_removeFirst (clauseStack s, clause key) { if (clauseStack_top (s) == key) { clauseStack_pop (s); } else { int i; for (i = s->nelements - 2; i >= 0; i--) { clause el = s->elements[i]; if (el == key) { int j; for (j = i; j < s->nelements - 1; j++) { s->elements[j] = s->elements[j + 1]; } s->nelements--; s->nspace++; return; } } llbuglit ("clauseStack_removeFirst: not found"); } } int clauseStack_controlDepth (clauseStack s) { int depth = 0; int i; for (i = 0; i < s->nelements; i++) { clause current = s->elements[i]; if (clause_isConditional (current)) { depth++; } } return depth; } cstring clauseStack_unparse (clauseStack s) { int i; cstring st = cstring_makeLiteral ("["); for (i = 0; i < s->nelements; i++) { if (i == 0) { st = message ("%q %s", st, clause_unparse (s->elements[i])); } else st = message ("%q, %s", st, clause_unparse (s->elements[i])); } st = message ("%q ]", st); return st; } void clauseStack_clear (clauseStack s) { s->nspace += s->nelements; s->nelements = 0; } void clauseStack_free (clauseStack s) { sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/filelocStack.c0000644021234200000250000001123007644147721015012 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** filelocStack.c (from slist_template.c) */ # include "splintMacros.nf" # include "basic.h" # include "filelocStack.h" static /*@notnull@*/ /*@only@*/ filelocStack filelocStack_newEmpty (void) { filelocStack s = (filelocStack) dmalloc (sizeof (*s)); s->nelements = 0; s->free = filelocStackBASESIZE; s->elements = (fileloc *) dmalloc (sizeof (*s->elements) * filelocStackBASESIZE); return (s); } filelocStack filelocStack_new () { return (filelocStack_newEmpty ()); } static void filelocStack_grow (/*@notnull@*/ filelocStack s) { o_fileloc *oldelements = s->elements; int i; s->free += filelocStackBASESIZE; s->elements = (fileloc *) dmalloc (sizeof (*s->elements) * (s->nelements + s->free)); for (i = 0; i < s->nelements; i++) { s->elements[i] = oldelements[i]; } sfree (oldelements); } static void filelocStack_push (/*@returned@*/ filelocStack s, /*@keep@*/ fileloc el) /*@modifies s@*/ { llassert (filelocStack_isDefined (s)); if (s->free <= 0) { filelocStack_grow (s); } s->free--; s->elements[s->nelements] = el; s->nelements++; } fileloc filelocStack_nextTop (filelocStack s) { llassert (filelocStack_isDefined (s) && s->nelements > 1); return (s->elements[s->nelements - 2]); } void filelocStack_clear (filelocStack s) { if (filelocStack_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { fileloc_free (s->elements[i]); } s->free += s->nelements; s->nelements = 0; } } /* ** Returns TRUE of el is a new file. */ bool filelocStack_popPushFile (filelocStack s, fileloc el) { int i; llassert (filelocStack_isDefined (s)); for (i = s->nelements - 1; i >= 0; i--) { if (fileloc_sameBaseFile (s->elements[i], el)) { int j; for (j = i; j < s->nelements; j++) { fileloc_free (s->elements[j]); } s->elements[i] = el; s->nelements = i + 1; return FALSE; } } filelocStack_push (s, el); return TRUE; } /*@only@*/ cstring filelocStack_unparse (filelocStack s) { int i; cstring st = cstring_makeLiteral ("["); if (filelocStack_isDefined (s)) { for (i = s->nelements - 1; i >= 0; i--) { if (i == s->nelements - 1) { st = message ("%q %q", st, fileloc_unparse (s->elements[i])); } else { st = message ("%q, %q", st, fileloc_unparse (s->elements[i])); } } } st = message ("%q ]", st); return st; } int filelocStack_includeDepth (filelocStack s) { int depth = 0; int i; if (filelocStack_isDefined (s)) { /* the zeroth element doesn't count! */ for (i = s->nelements - 1; i > 0; i--) { if (!fileloc_isSpecialFile (s->elements[i])) { depth++; } } } return depth; } void filelocStack_printIncludes (filelocStack s) { if (filelocStack_isDefined (s)) { int i; bool prep = context_isPreprocessing (); if (prep) { /* need to do this for messages */ context_clearPreprocessing (); } /* don't show last two files pushed */ for (i = s->nelements - 3; i >= 0; i--) { if (i == 0 || !fileloc_isSpecialFile (s->elements[i])) { llgenindentmsg (cstring_makeLiteral ("Include site"), s->elements[i]); } } if (prep) { context_setPreprocessing (); } } } void filelocStack_free (/*@only@*/ filelocStack s) { if (filelocStack_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { fileloc_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/cstringList.c0000644021234200000250000001574407646432514014731 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cstringList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" cstringList cstringList_new () { return cstringList_undefined; } static /*@notnull@*/ cstringList cstringList_newEmpty (void) { cstringList s = (cstringList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = cstringListBASESIZE; s->elements = (cstring *) dmalloc (sizeof (*s->elements) * cstringListBASESIZE); return (s); } static /*@notnull@*/ cstringList cstringList_newPredict (int size) { cstringList s = (cstringList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = size; s->elements = (cstring *) dmalloc (sizeof (*s->elements) * size); return (s); } static void cstringList_grow (/*@notnull@*/ cstringList s) { int i; cstring *newelements; s->nspace += cstringListBASESIZE; newelements = (cstring *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (cstring *) 0) { llfatalerror (cstring_makeLiteral ("cstringList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } cstringList cstringList_single (/*@keep@*/ cstring el) { cstringList s = cstringList_new (); s = cstringList_add (s, el); return s; } cstringList cstringList_add (cstringList s, /*@keep@*/ cstring el) { if (!cstringList_isDefined (s)) { s = cstringList_newEmpty (); } if (s->nspace <= 0) { cstringList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } cstringList cstringList_prepend (cstringList s, /*@keep@*/ cstring el) { int i; DPRINTF (("Prepend: %s + %s", cstringList_unparse (s), cstring_toCharsSafe (el))); if (!cstringList_isDefined (s)) { return cstringList_single (el); } if (s->nspace <= 0) { cstringList_grow (s); } s->nspace--; for (i = s->nelements; i > 0; i--) { s->elements[i] = s->elements [i - 1]; } s->elements[0] = el; s->nelements++; return s; } cstring cstringList_unparse (cstringList s) { return cstringList_unparseSep (s, cstring_makeLiteralTemp (", ")); } cstring cstringList_unparseSep (cstringList s, cstring sep) { cstring st = cstring_undefined; if (cstringList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (s->elements[i]); } else st = message ("%q%s%s", st, sep, s->elements[i]); } } return st; } void cstringList_printSpaced (cstringList s, size_t indent, size_t gap, int linelen) { if (cstringList_isDefined (s)) { cstring line = cstring_undefined; cstring istring = cstring_fill (cstring_undefined, indent); cstring gstring = cstring_fill (cstring_undefined, gap); int numcol; size_t longest = 0; int i; /* ** find the longest string */ for (i = 0; i < s->nelements; i++) { size_t len = cstring_length (s->elements[i]); if (len > longest) { longest = len; } } numcol = size_toInt ((linelen - indent) / (longest + gap)); if (numcol <= 1) { numcol = 1; } for (i = 0; i < s->nelements; i++) { if (i % numcol == 0) { if (i != 0) { llmsg (line); } line = message ("%s%q", istring, cstring_fill (s->elements[i], longest)); } else { line = message ("%q%s%q", line, gstring, cstring_fill (s->elements[i], longest)); } } cstring_free (line); cstring_free (istring); cstring_free (gstring); } } /*@only@*/ cstring cstringList_unparseAbbrev (cstringList s) { cstring st = cstring_undefined; if (cstringList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (s->elements[i]); } else if (i > 3 && s->nelements > 5) { st = message ("%q, ...", st); break; } else { st = message ("%q, %s", st, s->elements[i]); } } } return st; } void cstringList_free (cstringList s) { if (cstringList_isDefined (s)) { int i; DPRINTF (("cstringList free: [%p] %s", s, cstringList_unparse (s))); /* evans 2002-07-12: this was missing, not detected because of reldef */ for (i = 0; i < s->nelements; i++) { cstring_free (s->elements[i]); } sfree (s->elements); sfree (s); } } void cstringList_alphabetize (cstringList s) { if (cstringList_isDefined (s)) { /*@-modobserver@*/ qsort (s->elements, (size_t) s->nelements, sizeof (*s->elements), (int (*)(const void *, const void *)) cstring_xcompare); /*@=modobserver@*/ } } int cstringList_getIndex (cstringList s, cstring key) { int index = 0; cstringList_elements (s, el) { if (cstring_equal (el, key)) { return index; } index++; } end_cstringList_elements ; BADBRANCHRET (0); } bool cstringList_contains (cstringList s, cstring key) { int index = 0; cstringList_elements (s, el) { if (cstring_equal (el, key)) { return TRUE; } index++; } end_cstringList_elements ; return FALSE; } cstringList cstringList_copy (cstringList s) { cstringList res = cstringList_newPredict (cstringList_size (s)); cstringList_elements (s, el) { res = cstringList_add (res, cstring_copy (el)); } end_cstringList_elements ; return res; } cstring cstringList_get (cstringList s, int index) { llassertretnull (s != NULL); llassertretnull (index >= 0); llassertretnull (index < s->nelements); return s->elements[index]; } ob_cstring * cstringList_getElements (cstringList s) { if (cstringList_isDefined (s)) { /*@-compmempass@*/ return s->elements; /*@=compmempass@*/ /* This is exposed */ } else { return NULL; } } splint-3.1.2.dfsg1/src/cstringSList.c0000644021234200000250000001244107630461220015030 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cstringSList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" cstringSList cstringSList_new () { return cstringSList_undefined; } static /*@notnull@*/ cstringSList cstringSList_newEmpty (void) { cstringSList s = (cstringSList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = cstringSListBASESIZE; s->elements = (cstring *) dmalloc (sizeof (*s->elements) * cstringSListBASESIZE); return (s); } static void cstringSList_grow (/*@notnull@*/ cstringSList s) { int i; cstring *newelements; s->nspace += cstringSListBASESIZE; newelements = (cstring *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (cstring *) 0) { llfatalerror (cstring_makeLiteral ("cstringSList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } cstringSList cstringSList_single (/*@exposed@*/ cstring el) { cstringSList s = cstringSList_new (); s = cstringSList_add (s, el); return s; } cstringSList cstringSList_add (cstringSList s, /*@exposed@*/ cstring el) { if (!cstringSList_isDefined (s)) { s = cstringSList_newEmpty (); } if (s->nspace <= 0) { cstringSList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } cstring cstringSList_get (cstringSList s, int index) { llassert (s != NULL); llassert (index < s->nelements); return s->elements[index]; } cstring cstringSList_unparse (cstringSList s) { return cstringSList_unparseSep (s, cstring_makeLiteralTemp (", ")); } cstring cstringSList_unparseSep (cstringSList s, cstring sep) { cstring st = cstring_undefined; if (cstringSList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (s->elements[i]); } else st = message ("%q%s%s", st, sep, s->elements[i]); } } return st; } void cstringSList_printSpaced (cstringSList s, size_t indent, size_t gap, int linelen) { if (cstringSList_isDefined (s)) { cstring line = cstring_undefined; cstring istring = cstring_fill (cstring_undefined, indent); cstring gstring = cstring_fill (cstring_undefined, gap); int numcol; size_t longest = 0; int i; /* ** find the longest string */ for (i = 0; i < s->nelements; i++) { size_t len = cstring_length (s->elements[i]); if (len > longest) { longest = len; } } numcol = size_toInt ((linelen - indent) / (longest + gap)); if (numcol <= 1) { numcol = 1; } for (i = 0; i < s->nelements; i++) { if (i % numcol == 0) { if (i != 0) { llmsg (line); } line = message ("%s%q", istring, cstring_fill (s->elements[i], longest)); } else { line = message ("%q%s%q", line, gstring, cstring_fill (s->elements[i], longest)); } } cstring_free (line); cstring_free (istring); cstring_free (gstring); } } /*@only@*/ cstring cstringSList_unparseAbbrev (cstringSList s) { cstring st = cstring_undefined; if (cstringSList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (s->elements[i]); } else if (i > 3 && s->nelements > 5) { st = message ("%q, ...", st); break; } else { st = message ("%q, %s", st, s->elements[i]); } } } return st; } void cstringSList_free (cstringSList s) { if (cstringSList_isDefined (s)) { /* ** A modification of observer message is reported here, since ** *s->elements is an observer. But sfree doesn't REALLY modify ** the value of this object. */ /*@-modobserver@*/ sfree (s->elements); /*@=modobserver@*/ sfree (s); } } void cstringSList_alphabetize (cstringSList s) { if (cstringSList_isDefined (s)) { /*@-modobserver@*/ qsort (s->elements, (size_t) s->nelements, sizeof (*s->elements), (int (*)(const void *, const void *)) cstring_xcompare); /*@=modobserver@*/ } } splint-3.1.2.dfsg1/src/sRefSetList.c0000644021234200000250000000453507630461221014615 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sRefSetList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" static /*@notnull@*/ /*@only@*/ sRefSetList sRefSetList_newEmpty (void) { sRefSetList s = (sRefSetList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = sRefSetListBASESIZE; s->elements = (sRefSet *) dmalloc (sizeof (*s->elements) * sRefSetListBASESIZE); return (s); } static void sRefSetList_grow (/*@notnull@*/ sRefSetList s) { int i; sRefSet *newelements; s->nspace += sRefSetListBASESIZE; newelements = (sRefSet *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } sRefSetList sRefSetList_add (sRefSetList s, /*@dependent@*/ sRefSet el) { if (sRefSetList_isUndefined (s)) { s = sRefSetList_newEmpty (); } if (s->nspace <= 0) { sRefSetList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } void sRefSetList_clear (sRefSetList s) { if (sRefSetList_isDefined (s)) { s->nspace += s->nelements; s->nelements = 0; } } void sRefSetList_free (sRefSetList s) { if (sRefSetList_isDefined (s)) { sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/ctypeList.c0000644021234200000250000000631107630461220014357 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** ctypeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ ctypeList ctypeList_new () { ctypeList s = (ctypeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = ctypeListBASESIZE; s->elements = (ctype *) dmalloc (sizeof (*s->elements) * ctypeListBASESIZE); return (s); } static void ctypeList_grow (/*@notnull@*/ ctypeList s) { int i; ctype *newelements; s->nspace += ctypeListBASESIZE; newelements = (ctype *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (ctype *) 0) { llfatalerror (cstring_makeLiteral ("ctypeList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void ctypeList_addh (ctypeList s, ctype el) { llassert (ctypeList_isDefined (s)); llassert (ctypeListBASESIZE > 0); if (s->nspace <= 0) ctypeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } ctypeList ctypeList_add (ctypeList s, ctype el) { llassert (ctypeListBASESIZE > 0); if (ctypeList_isUndefined (s)) { s = ctypeList_new (); } ctypeList_addh (s, el); return s; } ctypeList ctypeList_append (ctypeList s1, ctypeList s2) { ctypeList res = s1; ctypeList_elements (s2, el) { res = ctypeList_add (res, el); } end_ctypeList_elements; return res; } /*@only@*/ cstring ctypeList_unparse (ctypeList ct) { cstring s = cstring_undefined; int i; bool first = TRUE; if (ctypeList_isUndefined (ct) || ctypeList_size (ct) == 0) { return (cstring_makeLiteral ("void")); } for (i = 0; i < ct->nelements; i++) { if (first) { s = cstring_copy (ctype_unparse (ct->elements[i])); first = FALSE; } else { s = message ("%q, %s", s, ctype_unparse (ct->elements[i])); } } return s; } void ctypeList_free (/*@only@*/ ctypeList s) { if (ctypeList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { /* ctype_free (s->elements[i]); */ } sfree (s->elements); /* not quite!!! */ sfree (s); } } splint-3.1.2.dfsg1/src/enumNameList.c0000644021234200000250000001241407644147721015015 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** enumNameList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse ** ** used to be cenum.c */ # include "splintMacros.nf" # include "basic.h" enumNameList enumNameList_new () { enumNameList s = (enumNameList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = enumNameListBASESIZE; s->elements = (enumName *) dmalloc (sizeof (*s->elements) * enumNameListBASESIZE); return (s); } /*@only@*/ enumNameList enumNameList_single (/*@keep@*/ enumName t) { enumNameList s = (enumNameList) dmalloc (sizeof (*s)); s->nelements = 1; s->nspace = enumNameListBASESIZE - 1; s->elements = (enumName *) dmalloc (sizeof (*s->elements) * enumNameListBASESIZE); s->elements[0] = t; return (s); } bool enumNameList_match (enumNameList e1, enumNameList e2) { int i; if (e1->nelements != e2->nelements) return FALSE; for (i = 0; i < e1->nelements; i++) { if (!cstring_equal (e1->elements[i], e2->elements[i])) return FALSE; } return TRUE; } static void enumNameList_grow (enumNameList s) { int i; enumName *newelements; s->nspace += enumNameListBASESIZE; newelements = (enumName *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (enumName *) 0) { llfatalerror (cstring_makeLiteral ("enumNameList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void enumNameList_addh (enumNameList s, /*@keep@*/ enumName el) { if (s->nspace <= 0) enumNameList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } enumNameList enumNameList_push (/*@returned@*/ enumNameList s, /*@only@*/ enumName el) { enumNameList_addh (s, el); return s; } /*@only@*/ enumNameList enumNameList_copy (enumNameList s) { enumNameList r = enumNameList_new (); enumNameList_elements (s, x) { enumNameList_addh (r, cstring_copy (x)); } end_enumNameList_elements; return r; } bool enumNameList_member (enumNameList s, cstring m) { enumNameList_elements (s, x) { if (cstring_equal (m, x)) return TRUE; } end_enumNameList_elements; return FALSE; } /*@only@*/ enumNameList enumNameList_subtract (enumNameList source, enumNameList del) { enumNameList ret = enumNameList_new (); enumNameList_elements (source, el) { if (!enumNameList_member (del, el)) { enumNameList_addh (ret, cstring_copy (el)); } } end_enumNameList_elements; return ret; } cstring enumNameList_unparse (enumNameList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (s->elements[i]); } else { st = message ("%q, %s", st, s->elements[i]); } } return st; } cstring enumNameList_unparseBrief (enumNameList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (s->elements[i]); } else if (i == 3 && s->nelements > 5) { st = message ("%q, ...", st); i = s->nelements - 2; } else { st = message ("%q, %s", st, s->elements[i]); } } return st; } /*@only@*/ cstring enumNameList_dump (enumNameList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (s->elements[i]); } else st = message ("%q,%s", st, s->elements[i]); } return st; } /*@only@*/ enumNameList enumNameList_undump (d_char *s) { enumNameList e = enumNameList_new (); if (**s == '}') (*s)++; else { while (TRUE) { char *t = strchr (*s, ','); char mt; if (t == NULL) { t = strchr (*s, '}'); if (t == NULL) { llcontbug (message ("enumNameList_undump: bad line: %s", cstring_fromChars (*s))); return e; } } mt = *t; *t = '\0'; enumNameList_addh (e, cstring_fromChars (mstring_copy (*s))); *s = t + 1; if (mt == '}') break; } } return e; } void enumNameList_free (enumNameList s) { int i; for (i = 0; i < s->nelements; i++) { cstring_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/enumNameSList.c0000644021234200000250000000240007630461220015116 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** enumNameList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse ** ** used to be cenum.c */ # include "splintMacros.nf" # include "basic.h" /*@access enumNameList@*/ void enumNameSList_free (enumNameSList s) { sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/exprNodeList.c0000644021234200000250000001053707630461220015024 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** exprNodeList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ exprNodeList exprNodeList_new () { exprNodeList s = (exprNodeList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = exprNodeListBASESIZE; s->elements = (exprNode *) dmalloc (sizeof (*s->elements) * exprNodeListBASESIZE); s->current = 0; return (s); } static void exprNodeList_grow (exprNodeList s) { int i; exprNode *newelements; int numnew; if (s->nelements < exprNodeListBASESIZE) { numnew = exprNodeListBASESIZE; } else { numnew = s->nelements; } s->nspace = numnew + s->nspace; newelements = (exprNode *) dmalloc (sizeof (*newelements) * (s->nelements + numnew)); if (newelements == (exprNode *) 0) { llfatalerror (cstring_makeLiteral ("exprNodeList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void exprNodeList_addh (exprNodeList s, /*@only@*/ exprNode el) { llassert (exprNodeListBASESIZE > 0); if (s->nspace <= 0) exprNodeList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } void exprNodeList_reset (exprNodeList s) { s->current = 0; } void exprNodeList_advance (exprNodeList s) { s->current++; llassert (s->current <= s->nelements); } /*@observer@*/ exprNode exprNodeList_head (exprNodeList s) { llassert (s->nelements > 0); return (s->elements[0]); } /*@observer@*/ exprNode exprNodeList_current (exprNodeList s) { llassert (s->current >= 0 && s->current < s->nelements); return (s->elements[s->current]); } exprNode exprNodeList_getN (exprNodeList s, int n) { llassert (n >= 0 && n < s->nelements); return (s->elements[n]); } /*@only@*/ exprNodeList exprNodeList_singleton (/*@only@*/ exprNode e) { exprNodeList s = (exprNodeList) dmalloc (sizeof (*s)); s->nelements = 1; s->nspace = exprNodeListBASESIZE - 1; s->elements = (exprNode *) dmalloc (sizeof (*s->elements) * exprNodeListBASESIZE); s->elements[0] = e; s->current = 0; DPRINTF (("List: %s", exprNode_unparse (e))); return (s); } exprNodeList exprNodeList_push (/*@returned@*/ exprNodeList args, /*@only@*/ exprNode e) { exprNodeList_addh (args, e); return (args); } /*@exposed@*/ exprNode exprNodeList_nth (exprNodeList args, int n) { if (n >= exprNodeList_size (args) || n < 0) { llcontbug (message ("exprNodeList_nth: out of range: %q arg %d\n", exprNodeList_unparse (args), n)); return exprNode_undefined; } return args->elements[n]; } /*@only@*/ cstring exprNodeList_unparse (exprNodeList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (exprNode_unparse (s->elements[i])); } else st = message ("%q, %s", st, exprNode_unparse (s->elements[i])); } return st; } void exprNodeList_free (exprNodeList s) { int i; for (i = 0; i < s->nelements; i++) { exprNode_free (s->elements[i]); } sfree (s->elements); sfree (s); } void exprNodeList_freeShallow (/*@only@*/ exprNodeList s) { int i; for (i = 0; i < s->nelements; i++) { exprNode_freeShallow (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/exprNodeSList.c0000644021234200000250000000626307630461220015150 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** exprNodeSList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" # include "exprNodeSList.h" exprNodeSList exprNodeSList_new () { exprNodeSList s = (exprNodeSList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = exprNodeSListBASESIZE; s->elements = (exprNode *) dmalloc (sizeof (*s->elements) * exprNodeSListBASESIZE); return (s); } static void exprNodeSList_grow (exprNodeSList s) { int i; exprNode *newelements; s->nspace += exprNodeSListBASESIZE; newelements = (exprNode *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (exprNode *) 0) { llfatalerror (cstring_makeLiteral ("exprNodeSList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void exprNodeSList_addh (exprNodeSList s, /*@exposed@*/ /*@dependent@*/ exprNode el) { llassert (exprNodeSListBASESIZE > 0); if (s->nspace <= 0) exprNodeSList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; } /* ** appends s2 to s1 */ exprNodeSList exprNodeSList_append (/*@returned@*/ exprNodeSList s1, /*@only@*/ exprNodeSList s2) { exprNodeSList_elements (s2, x) { exprNodeSList_addh (s1, x); } end_exprNodeSList_elements; exprNodeSList_free (s2); return s1; } /*@only@*/ exprNodeSList exprNodeSList_singleton (/*@exposed@*/ /*@dependent@*/ exprNode e) { exprNodeSList s = (exprNodeSList) dmalloc (sizeof (*s)); s->nelements = 1; s->nspace = exprNodeSListBASESIZE - 1; s->elements = (exprNode *) dmalloc (sizeof (*s->elements) * exprNodeSListBASESIZE); s->elements[0] = e; return (s); } /*@only@*/ cstring exprNodeSList_unparse (exprNodeSList s) { int i; cstring st = cstring_undefined; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = cstring_copy (exprNode_unparse (s->elements[i])); } else st = message ("%q, %s", st, exprNode_unparse (s->elements[i])); } return st; } void exprNodeSList_free (exprNodeSList s) { sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/uentryList.c0000644021234200000250000004211007646432516014573 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** uentryList.c (from slist_template.c) */ # include "splintMacros.nf" # include "basic.h" /*@only@*/ /*@notnull@*/ uentryList uentryList_new () { uentryList s = (uentryList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = uentryListBASESIZE; s->elements = (uentry *) dmalloc (sizeof (*s->elements) * uentryListBASESIZE); s->current = 0; return (s); } /*@only@*/ uentryList uentryList_single (/*@keep@*/ uentry el) { uentryList s = (uentryList) dmalloc (sizeof (*s)); s->nelements = 1; s->nspace = uentryListBASESIZE - 1; s->elements = (uentry *) dmalloc (sizeof (*s->elements) * uentryListBASESIZE); s->elements[0] = el; s->current = 0; return (s); } static void uentryList_grow (uentryList s) { int i; uentry *newelements; llassert (!uentryList_isUndefined (s)); s->nspace += uentryListBASESIZE; newelements = (uentry *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } void uentryList_clear (uentryList s) { if (uentryList_isUndefined (s)) { ; } else { s->nspace += s->nelements; s->nelements = 0; } } uentryList uentryList_add (uentryList s, /*@keep@*/ uentry el) { if (uentryList_isUndefined (s)) { s = uentryList_new (); } if (s->nspace <= 0) uentryList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring uentryList_unparse (uentryList s) { cstring st = cstring_undefined; int i; if (uentryList_isDefined (s)) { for (i = 0; i < uentryList_size (s); i++) { if (i == 0) { st = message ("%q;", uentry_unparse (s->elements[i])); } else st = message ("%q %q;", st, uentry_unparse (s->elements[i])); } } return (st); } /*@unused@*/ /*@only@*/ cstring uentryList_unparseFull (uentryList s) { cstring st = cstring_undefined; int i; if (uentryList_isDefined (s)) { for (i = 0; i < uentryList_size (s); i++) { if (i == 0) { st = message ("%q;", uentry_unparseFull (s->elements[i])); } else { st = message ("%q %q;", st, uentry_unparseFull (s->elements[i])); } } } return (st); } cstring uentryList_unparseParams (uentryList s) { int i; cstring st = cstring_undefined; if (uentryList_isUndefined (s)) { return st; } else if (uentryList_isVoid (s)) { return (cstring_makeLiteral ("void")); } else { for (i = 0; i < uentryList_size (s); i++) { if (i == 0) { st = message ("%s", ctype_unparse (uentry_getType (s->elements[i]))); } else { st = message ("%q, %s", st, ctype_unparse (uentry_getType (s->elements[i]))); } } return st; } } bool uentryList_matchParams (uentryList p1, uentryList p2, bool force, bool arg) { int sz1 = uentryList_size (p1); int sz2 = uentryList_size (p2); int i; if (p1 == p2) return TRUE; if (uentryList_isMissingParams (p1) || uentryList_isMissingParams (p2)) { return TRUE; } if (sz1 != sz2) return FALSE; for (i = 0; i < sz1; i++) { if (!ctype_genMatch (uentry_getType (p1->elements[i]), uentry_getType (p2->elements[i]), force, arg, FALSE, FALSE)) { return FALSE; } } return TRUE; } /*@only@*/ cstring uentryList_unparseAbbrev (uentryList p) { bool first = TRUE; cstring s = cstring_undefined; int i = 0; if (uentryList_isUndefined (p)) return s; if (uentryList_size (p) == 0) return cstring_makeLiteral ("void"); for (i = 0; i < p->nelements && i < uentryList_abbrevBreadth; i++) { if (first) { s = message ("%q;", uentry_unparseAbbrev (p->elements[i])); first = FALSE; } else { s = message ("%q %q;", s, uentry_unparseAbbrev (p->elements[i])); } } if (i != uentryList_size (p)) s = message ("%q, ...", s); return (s); } static int uentryList_lookupDirectName (uentryList s, cstring name) { if (uentryList_isDefined (s)) { int i; for (i = 0; i < uentryList_size (s); i++) { if (cstring_equal (name, uentry_rawName (s->elements[i]))) { return i; } } } return -1; } int uentryList_lookupRealName (uentryList s, cstring name) { if (uentryList_isDefined (s)) { int i; for (i = 0; i < uentryList_size (s); i++) { cstring uname = uentry_getName (s->elements[i]); if (cstring_equal (name, uname)) { cstring_free (uname); return i; } cstring_free (uname); } } return -1; } uentryList uentryList_copy (uentryList s) { if (uentryList_isDefined (s)) { uentryList t = (uentryList) dmalloc (sizeof (*t)); int i; t->nelements = s->nelements; t->nspace = 0; t->current = s->current; if (s->nelements > 0) { t->elements = (uentry *) dmalloc (sizeof (*t->elements) * t->nelements); for (i = 0; i < s->nelements; i++) { t->elements[i] = uentry_copy (s->elements[i]); } } else { t->elements = NULL; } return t; } else { return uentryList_undefined; } } void uentryList_free (uentryList s) { if (!uentryList_isUndefined (s)) { int i; for (i = 0; i < s->nelements; i++) { uentry_free (s->elements[i]); } sfree (s->elements); sfree (s); } } void uentryList_freeShallow (uentryList s) { if (!uentryList_isUndefined (s)) { /*@-mustfree@*/ /* free shallow does not free the element */ sfree (s->elements); /*@=mustfree@*/ sfree (s); } } bool uentryList_isVoid (uentryList cl) { if (cl != NULL && cl->nelements == 1) { return (ctype_isVoid (ctype_realType (uentry_getType (cl->elements[0])))); } return FALSE; } /*@exposed@*/ uentry uentryList_getN (uentryList p, int n) { llassert (uentryList_isDefined (p)); if (n < 0 || (n >= uentryList_size (p))) { llcontbug (message ("uentryList_getN: out of range: %d (size %d)", n, uentryList_size (p))); return uentry_undefined; } return (p->elements[n]); } void uentryList_fixMissingNames (uentryList cl) { uentryList_elements (cl, ce) { if (!uentry_hasRealName (ce)) { ctype ct = uentry_getType (ce); if (ctype_isUA (ct)) { uentry_setName (ce, usymtab_getTypeEntryName (ctype_typeId (ct))); } else { llbug (message ("uentryList_fixMissingNames: not UA: %s", ctype_unparse (ct))); } uentry_setType (ce, ctype_int); } } end_uentryList_elements; } void uentryList_fixImpParams (uentryList cl) { if (context_getFlag (FLG_PARAMIMPTEMP)) { uentryList_elements (cl, ce) { sRef s = uentry_getSref (ce); alkind ak = sRef_getAliasKind (s); if (alkind_isUnknown (ak) || alkind_isImplicit (ak)) { exkind ek = sRef_getExKind (s); if (exkind_isKnown (ek)) { sRef_setAliasKind (s, AK_IMPDEPENDENT, fileloc_undefined); } else { sRef_setAliasKind (s, AK_IMPTEMP, fileloc_undefined); } } else { } } end_uentryList_elements; } } int uentryList_compareParams (uentryList s, uentryList t) { int i, sz; if (s == t) return 0; if (uentryList_isUndefined (s)) return 1; if (uentryList_isUndefined (t)) return -1; sz = uentryList_size (s); INTCOMPARERETURN (uentryList_size (t), sz); for (i = 0; i < sz; i++) { COMPARERETURN (uentry_compare (s->elements[i], t->elements[i])); } return 0; } int uentryList_compareStrict (uentryList s, uentryList t) { int i, sz; if (s == t) { return 0; } if (uentryList_isMissingParams (s)) { if (uentryList_isMissingParams (t)) { return 0; } else { return 1; } } else { if (uentryList_isMissingParams (t)) { return -1; } else { sz = uentryList_size (s); INTCOMPARERETURN (uentryList_size (t), sz); for (i = 0; i < sz; i++) { COMPARERETURN (uentry_compareStrict (s->elements[i], t->elements[i])); } return 0; } } } int uentryList_compareFields (uentryList s, uentryList t) { int i, sz; if (s == t) return 0; if (uentryList_isUndefined (s)) return 1; if (uentryList_isUndefined (t)) return -1; sz = uentryList_size (s); if (uentryList_size (t) != sz) { return (int_compare (sz, uentryList_size (t))); } for (i = 0; i < sz; i++) { uentry se = s->elements[i]; uentry te = t->elements[i]; int namecmp = cstring_compare (uentry_rawName (se), uentry_rawName (te)); if (namecmp == 0) { int uc = uentry_compare (s->elements[i], t->elements[i]); if (uc != 0) { DPRINTF (("Bad compare: %s / %s", uentry_unparseFull (s->elements [i]), uentry_unparseFull (t->elements [i]))); return uc; } } else { return (namecmp); } } return 0; } /*@exposed@*/ uentry uentryList_current (uentryList s) { llassert (uentryList_isDefined (s)); llassert (!(s->current < 0 || (s->current >= s->nelements))); return (s->elements[s->current]); } cstring uentryList_dumpParams (uentryList s) { cstring st = cstring_undefined; if (uentryList_isUndefined (s)) return st; uentryList_elements (s, current) { DPRINTF (("Dump param: %s", uentry_unparse (current))); st = message ("%q%q,", st, uentry_dumpParam (current)); } end_uentryList_elements; return st; } /*@only@*/ cstring uentryList_dumpFields (uentryList s) { cstring st = cstring_undefined; if (uentryList_isUndefined (s)) return st; uentryList_elements (s, current) { if (!uentry_isVariable (current)) { llassert (uentry_isFunction (current)); DPRINTF (("Dump field: %s", uentry_unparse (current))); st = message ("%q!%q,", st, uentry_dump (current)); } else { DPRINTF (("Dump field: %s", uentry_unparse (current))); st = message ("%q%q,", st, uentry_dump (current)); } } end_uentryList_elements; return st; } /*@only@*/ uentryList uentryList_undumpFields (char **s, fileloc loc) { uentryList ul = uentryList_new (); while (**s != '\0' && **s != '}') { if (**s == '!') { reader_checkChar (s, '!'); ul = uentryList_add (ul, uentry_undump (ekind_function, loc, s)); } else { ul = uentryList_add (ul, uentry_undump (ekind_variable, loc, s)); } reader_checkChar (s, ','); } reader_checkChar (s, '}'); return ul; } /*@only@*/ uentryList uentryList_undump (char **s) { char c; uentryList pn = uentryList_new (); int paramno = 0; c = **s; while (c != '#' && c != '@' && c != ')') { uentry ue = uentry_undump (ekind_variable, g_currentloc, s); if (!uentry_isUndefined (ue)) { pn = uentryList_add (pn, ue); } else { uentry_free (ue); } reader_checkChar (s, ','); c = **s; paramno++; } reader_checkChar (s, ')'); return pn; } void uentryList_reset (uentryList s) { if (uentryList_isUndefined (s)) return; s->current = 0; } bool uentryList_isFinished (uentryList s) { if (uentryList_isUndefined (s)) return TRUE; return (s->current > s->nelements - 1); } void uentryList_advanceSafe (uentryList s) { if (uentryList_isUndefined (s)) return; s->current++; if (s->current > s->nelements) { s->current = s->nelements; } } int uentryList_size (uentryList s) { if (uentryList_isUndefined (s)) return 0; if (uentryList_isVoid (s)) return 0; return s->nelements; } bool uentryList_isMissingParams (uentryList s) { return (uentryList_isUndefined (s) || s->nelements == 0); } bool uentryList_hasReturned (uentryList ul) { uentryList_elements (ul, current) { if (uentry_isReturned (current)) return TRUE; } end_uentryList_elements; return FALSE; } /*@exposed@*/ uentry uentryList_lookupField (uentryList f, cstring name) { int i = uentryList_lookupDirectName (f, name); if (i >= 0) { return (uentryList_getN (f, i)); } else { uentryList_elements (f, el) { if (uentry_isUnnamedVariable (el)) { ctype ct = uentry_getType (el); if (ctype_isStruct (ct) || ctype_isUnion (ct)) { uentryList fields = ctype_getFields (ct); uentry ue = uentryList_lookupField (fields, name); if (uentry_isValid (ue)) { return ue; } } } } end_uentryList_elements ; return uentry_undefined; } } /*@only@*/ uentryList uentryList_mergeFields (/*@only@*/ uentryList f1, /*@only@*/ uentryList f2) { DPRINTF (("Merge: %s + %s", uentryList_unparse (f1), uentryList_unparse (f2))); if (uentryList_isUndefined (f1)) { return (f2); } if (uentryList_isDefined (f2)) { uentryList_elements (f2, current) { uentry old = uentryList_lookupField (f1, uentry_rawName (current)); if (uentry_isValid (old)) { voptgenerror (FLG_SYNTAX, message ("Field name reused: %s", uentry_rawName (current)), uentry_whereDefined (current)); llgenmsg (message ("Previous use of %s", uentry_rawName (current)), uentry_whereDefined (old)); } /* okay to use exposed current since f2 is killed */ /*@-exposetrans@*/ /*@-dependenttrans@*/ f1 = uentryList_add (f1, current); /*@=exposetrans@*/ /*@=dependenttrans@*/ } end_uentryList_elements; sfree (f2->elements); sfree (f2); } return (f1); } void uentryList_showFieldDifference (uentryList p1, uentryList p2) { uentry cp1, cp2; int index; llassert (NOALIAS (p1, p2)); llassert (uentryList_isDefined (p1)); llassert (uentryList_isDefined (p2)); for (index = 0; index < p1->nelements; index++) { cp1 = p1->elements[index]; if (index == p2->nelements) { llgenindentmsg (message ("Field present in %s, missing in %rdeclaration: %q", uentry_specDeclName (cp1), uentry_isDeclared (cp1), uentry_unparse (cp1)), uentry_whereEither (cp1)); return; } cp2 = p2->elements[index]; if (!(cstring_equal (uentry_rawName (cp1), uentry_rawName (cp2)))) { llgenindentmsg (message ("Field %s in %s corresponds to %s in %rdeclaration", uentry_rawName (cp1), uentry_specOrDefName (cp1), uentry_rawName (cp2), uentry_isCodeDefined (cp1)), uentry_whereDefined (cp2)); uentry_showWhereLastPlain (cp1); return; } else { /* evs 2000-07-25 was ctype_match, should match uentryList_matchFields */ if (!ctype_almostEqual (uentry_getType (cp1), uentry_getType (cp2))) { llgenindentmsg (message ("Field %s %rdeclared as %s, %s as %s", uentry_rawName (cp2), uentry_isCodeDefined (cp1), ctype_unparse (uentry_getType (cp1)), uentry_specOrDefName (cp2), ctype_unparse (uentry_getType (cp2))), uentry_whereDefined (cp2)); uentry_showWhereLastPlain (cp1); return; } } } if (index != p2->nelements) { cp2 = p2->elements[index]; llgenindentmsg (message ("Extra field in new declaration: %q", uentry_unparse (cp2)), uentry_whereEither (cp2)); return; } llbug (message ("uentryList_showFieldDifference: match: %q / %q", uentryList_unparse (p1), uentryList_unparse (p2))); } bool uentryList_equivFields (uentryList p1, uentryList p2) { return (uentryList_compareFields (p1, p2) == 0); } bool uentryList_matchFields (uentryList p1, uentryList p2) { int index; uentry cp1, cp2; if (p1 == p2) { return (TRUE); } if (uentryList_isEmpty (p1) || uentryList_isEmpty (p2)) { return (TRUE); } if (uentryList_size (p1) != uentryList_size (p2)) { return FALSE; } for (index = 0; index < p1->nelements; index++) { cp1 = p1->elements[index]; cp2 = p2->elements[index]; /* ** Should compare uentry's --- need to fix report errors too. */ if (!(cstring_equal (uentry_rawName (cp1), uentry_rawName (cp2)) && (ctype_almostEqual (uentry_getType (cp1), uentry_getType (cp2))))) { return FALSE; } } return TRUE; } splint-3.1.2.dfsg1/src/fileIdList.c0000644021234200000250000000211307630461220014423 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** fileIdList.c */ # include "splintMacros.nf" # include "basic.h" /* ** No code needed (all from ctypeList) */ splint-3.1.2.dfsg1/src/filelocList.c0000644021234200000250000001440607630461220014654 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** filelocList.c (from slist_template.c) */ # include "splintMacros.nf" # include "basic.h" # include "filelocList.h" /* ** Invariant: If any member of the list is fileloc_undefined, then ** the 0th member is fileloc_undefined. */ filelocList filelocList_new () { return (filelocList_undefined); } static /*@notnull@*/ /*@only@*/ filelocList filelocList_newEmpty (void) { filelocList s = (filelocList) dmalloc (sizeof (*s)); s->nelements = 0; s->free = filelocListBASESIZE; s->elements = (fileloc *) dmalloc (sizeof (*s->elements) * filelocListBASESIZE); return (s); } static void filelocList_grow (/*@notnull@*/ filelocList s) { int i; o_fileloc *oldelements = s->elements; s->free += filelocListBASESIZE; s->elements = (fileloc *) dmalloc (sizeof (*s->elements) * (s->nelements + s->free)); for (i = 0; i < s->nelements; i++) { s->elements[i] = oldelements[i]; } sfree (oldelements); } filelocList filelocList_append (/*@returned@*/ filelocList s, /*@only@*/ filelocList t) { llassert (NOALIAS (s, t)); if (filelocList_isUndefined (t) || filelocList_isEmpty (t)) return s; if (filelocList_isUndefined (s)) { s = filelocList_newEmpty (); } filelocList_elements (t, fl) { /* Okay to use exposed storage here, t is begin eaten. */ /*@-exposetrans@*/ /*@-dependenttrans@*/ s = filelocList_add (s, fl); /*@=exposetrans@*/ /*@=dependenttrans@*/ } end_filelocList_elements; sfree (t->elements); sfree (t); return s; } filelocList filelocList_addUndefined (/*@returned@*/ filelocList s) { if (filelocList_isUndefined (s) || s->nelements == 0 || fileloc_isDefined (s->elements[0])) { return (filelocList_add (s, fileloc_undefined)); } else { return s; } } static bool filelocList_hasUndefinedLoc (filelocList s) { return (filelocList_isDefined (s) && s->nelements > 0 && fileloc_isUndefined (s->elements[0])); } filelocList filelocList_addDifferentFile (/*@returned@*/ filelocList s, fileloc where, fileloc loc) { if (filelocList_hasUndefinedLoc (s) || filelocList_size (s) >= 2) { return s; } else { if (fileloc_sameModule (where, loc)) { if (filelocList_isEmpty (s)) { return filelocList_add (s, fileloc_copy (loc)); } else { return s; } } else { return filelocList_addUndefined (s); } } } filelocList filelocList_add (/*@returned@*/ filelocList s, /*@only@*/ fileloc el) { if (filelocList_isUndefined (s)) { s = filelocList_newEmpty (); } if (s->free <= 0) { filelocList_grow (s); } s->free--; s->elements[s->nelements] = el; if (fileloc_isUndefined (el)) { s->elements[s->nelements] = s->elements[0]; s->elements[0] = fileloc_undefined; } s->nelements++; return s; } /*@only@*/ cstring filelocList_unparse (filelocList s) { int i; cstring st = cstring_makeLiteral ("["); if (filelocList_isDefined (s)) { for (i = 0; i < filelocList_size (s); i++) { if (i == 0) { st = message ("%q %q", st, fileloc_unparse (s->elements[i])); } else st = message ("%q, %q", st, fileloc_unparse (s->elements[i])); } } st = message ("%q ]", st); return st; } int filelocList_realSize (filelocList s) { int size = 0; filelocList_elements (s, el) { if (fileloc_isDefined (el)) { size++; } } end_filelocList_elements; return size; } cstring filelocList_unparseUses (filelocList s) { int i; size_t linelen = 0; int maxlen = context_getLineLen () - 3; cstring st = cstring_undefined; fileId lastFile = fileId_invalid; bool parenFormat = context_getFlag (FLG_PARENFILEFORMAT); if (filelocList_isDefined (s)) { bool firstone = TRUE; for (i = 0; i < filelocList_size (s); i++) { if (fileloc_isDefined (s->elements[i])) { if (firstone) { st = fileloc_unparse (s->elements[i]); lastFile = fileloc_fileId (s->elements[i]); linelen = 3 + cstring_length (st); firstone = FALSE; } else { if (fileId_equal (fileloc_fileId (s->elements[i]), lastFile)) { if (linelen + 7 > size_fromInt (maxlen)) { st = message ("%q\n ", st); linelen = 6; } else { st = message ("%q, ", st); } if (parenFormat) { st = message ("%q(%d,%d)", st, fileloc_lineno (s->elements[i]), fileloc_column (s->elements[i])); } else { st = message ("%q%d:%d", st, fileloc_lineno (s->elements[i]), fileloc_column (s->elements[i])); } linelen += 3 + int_log (fileloc_lineno (s->elements[i])) + int_log (fileloc_column (s->elements[i])); } else { cstring fl = fileloc_unparse (s->elements[i]); st = message ("%q\n %s", st, fl); lastFile = fileloc_fileId (s->elements[i]); linelen = 3 + cstring_length (fl); cstring_free (fl); } } } } } return st; } void filelocList_free (/*@only@*/ filelocList s) { if (filelocList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { fileloc_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/qualList.c0000644021234200000250000001037607630461221014204 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** qualList.c (from slist_template.c) */ # include "splintMacros.nf" # include "basic.h" qualList qualList_new () { return qualList_undefined; } static /*@only@*/ /*@notnull@*/ qualList qualList_newEmpty (void) { qualList s = (qualList) dmalloc (sizeof (*s)); s->nelements = 0; s->free = qualListBASESIZE; s->elements = (qual *) dmalloc (sizeof (*s->elements) * qualListBASESIZE); return (s); } void qualList_clear (qualList q) { if (qualList_isDefined (q)) { q->free += q->nelements; q->nelements = 0; } } static void qualList_grow (/*@notnull@*/ qualList s) { int i; qual *oldelements = s->elements; s->free += qualListBASESIZE; s->elements = (qual *) dmalloc (sizeof (*s->elements) * (s->nelements + s->free)); for (i = 0; i < s->nelements; i++) { s->elements[i] = oldelements[i]; } sfree (oldelements); } qualList qualList_single (qual el) { /*@-unqualifiedtrans@*/ /* must be only */ return (qualList_add (qualList_undefined, el)); /*@=unqualifiedtrans@*/ } qualList qualList_add (qualList s, qual el) { if (qualList_isUndefined (s)) { s = qualList_newEmpty (); } if (s->free <= 0) qualList_grow (s); s->free--; s->elements[s->nelements] = el; s->nelements++; return (s); } qualList qualList_appendList (qualList s, qualList t) { qualList_elements (t, current) { s = qualList_add (s, current); } end_qualList_elements; return s; } qualList qualList_copy (qualList s) { qualList t = qualList_new (); qualList_elements (s, current) { t = qualList_add (t, current); } end_qualList_elements; return t; } /*@only@*/ cstring qualList_unparse (qualList s) { int i; cstring st = cstring_undefined; if (qualList_isDefined (s)) { for (i = 0; i < qualList_size (s); i++) { if (i == 0) { st = message ("%q%s ", st, qual_unparse (s->elements[i])); } else st = message ("%q%s ", st, qual_unparse (s->elements[i])); } } return st; } /*@only@*/ cstring qualList_toCComments (qualList s) { int i; cstring st = cstring_undefined; if (qualList_isDefined (s)) { for (i = 0; i < qualList_size (s); i++) { if (i == 0) { st = message ("%q/*@%s@*/ ", st, qual_unparse (s->elements[i])); } else st = message ("%q/*@%s@*/ ", st, qual_unparse (s->elements[i])); } } return st; } bool qualList_hasAliasQualifier (qualList s) { if (qualList_isDefined (s)) { qualList_elements (s, q) { if (qual_isAliasQual (q)) return TRUE; } end_qualList_elements; } return FALSE; } bool qualList_hasExposureQualifier (qualList s) { if (qualList_isDefined (s)) { qualList_elements (s, q) { if (qual_isExQual (q)) return TRUE; } end_qualList_elements; } return FALSE; } void qualList_free (/*@only@*/ qualList s) { if (qualList_isDefined (s)) { sfree (s->elements); sfree (s); } } /* start modifications */ /* requires: p is defined returns: true if qual is present in qualList modifies: none */ bool qualList_hasNullTerminatedQualifier(qualList s) { qualList_elements(s, qu) { if( qual_isNullTerminated(qu) ) return TRUE; } end_qualList_elements ; return FALSE; } /* end modification/s */ splint-3.1.2.dfsg1/src/sRefList.c0000644021234200000250000000565307630461221014143 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sRefList.c (from slist_template.c) */ # include "splintMacros.nf" # include "basic.h" sRefList sRefList_new () { return sRefList_undefined; } static /*@only@*/ /*@notnull@*/ sRefList sRefList_newEmpty (void) { sRefList s = (sRefList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = sRefListBASESIZE; s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefListBASESIZE); return (s); } /*@only@*/ sRefList sRefList_single (sRef el) { sRefList res = sRefList_newEmpty (); res = sRefList_add (res, el); return res; } static void sRefList_grow (/*@notnull@*/ sRefList s) { int i; sRef *oldelements = s->elements; s->nspace += sRefListBASESIZE; s->elements = (sRef *) dmalloc (sizeof (*s->elements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { s->elements[i] = oldelements[i]; } sfree (oldelements); } /*@notnull@*/ sRefList sRefList_add (sRefList s, sRef el) { if (sRefList_isUndefined (s)) { s = sRefList_newEmpty (); } if (s->nspace <= 0) sRefList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return (s); } sRefList sRefList_copy (sRefList s) { sRefList t = sRefList_new (); sRefList_elements (s, current) { t = sRefList_add (t, sRef_copy (current)); } end_sRefList_elements; return t; } /*@only@*/ cstring sRefList_unparse (sRefList s) { int i; cstring st = cstring_undefined; if (sRefList_isDefined (s)) { for (i = 0; i < sRefList_size (s); i++) { if (i == 0) { st = message ("%q%q ", st, sRef_unparse (s->elements[i])); } else st = message ("%q%q ", st, sRef_unparse (s->elements[i])); } } return st; } int sRefList_size (sRefList s) { if (sRefList_isUndefined (s)) return 0; return s->nelements; } void sRefList_free (/*@only@*/ sRefList s) { if (sRefList_isDefined (s)) { sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/flagMarkerList.c0000644021234200000250000002701207630461220015307 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** flagMarkerList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse ** ** invariant: flagMarker's are listed in order */ # include "splintMacros.nf" # include "basic.h" static int flagMarkerList_lastBeforeLoc (flagMarkerList p_s, fileloc p_loc) /*@*/ ; static bool flagMarkerList_contains (flagMarkerList p_s, flagMarker p_fm) /*@*/ ; flagMarkerList flagMarkerList_new () { flagMarkerList s = (flagMarkerList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = flagMarkerListBASESIZE; s->elements = (flagMarker *) dmalloc (sizeof (*s->elements) * flagMarkerListBASESIZE); return (s); } static void flagMarkerList_grow (flagMarkerList s) { int i; flagMarker *newelements; s->nspace += flagMarkerListBASESIZE; newelements = (flagMarker *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } bool flagMarkerList_add (flagMarkerList s, flagMarker fm) { int i = s->nelements - 1; int lastloc; DPRINTF (("Add: %s", flagMarker_unparse (fm))); if (flagMarkerList_contains (s, fm)) { flagMarker_free (fm); DPRINTF (("List contains: %s", flagMarkerList_unparse (s))); return FALSE; } if (i > 0) { flagMarker last = s->elements[i]; if (flagMarker_isIgnoreCount (last)) { if (!flagMarker_isIgnoreOff (fm)) { if (flagMarker_isLocalSet (fm)) { if (llforceerror (FLG_WARNFLAGS, cstring_makeLiteral ("Cannot set flag inside ignore " "count region."), flagMarker_getLoc (fm))) { llgenindentmsg (cstring_makeLiteral ("Ignore count region starts"), flagMarker_getLoc (last)); } } else { if (flagMarker_isIgnoreOn (fm)) { if (llforceerror (FLG_WARNFLAGS, cstring_makeLiteral ("Cannot nest ignore regions."), flagMarker_getLoc (fm))) { llgenindentmsg (cstring_makeLiteral ("Previous ignore region starts"), flagMarker_getLoc (last)); } } } flagMarker_free (fm); return FALSE; } } else { if (flagMarker_isIgnoreOff (last)) { flagMarker nlast = s->elements [i - 1]; if (flagMarker_isIgnoreCount (nlast)) { if (fileloc_sameFileAndLine (flagMarker_getLoc (fm), flagMarker_getLoc (nlast))) { if (flagMarker_isLocalSet (fm)) { if (llforceerror (FLG_WARNFLAGS, cstring_makeLiteral ("Cannot set flag inside ignore " "count region."), flagMarker_getLoc (fm))) { llgenindentmsg (cstring_makeLiteral ("Ignore count region starts"), flagMarker_getLoc (nlast)); DPRINTF (("Last: %s / %s", fileloc_unparse (flagMarker_getLoc (last)), fileloc_unparse (flagMarker_getLoc (fm)))); } } else { if (flagMarker_isIgnoreOn (fm)) { if (llforceerror (FLG_WARNFLAGS, cstring_makeLiteral ("Cannot nest ignore regions."), flagMarker_getLoc (fm))) { llgenindentmsg (cstring_makeLiteral ("Previous ignore region starts"), flagMarker_getLoc (nlast)); } } } flagMarker_free (fm); return FALSE; } } } } } /* ** Need to insert this flag in the right place (after the last before loc flag) */ lastloc = flagMarkerList_lastBeforeLoc (s, flagMarker_getLoc (fm)); if (s->nspace <= 0) { flagMarkerList_grow (s); } s->nspace--; if (lastloc == -1) { /* Add it to the end of the list */ s->elements[s->nelements] = fm; } else { DPRINTF (("Inserting: %s in %s", flagMarker_unparse (fm), flagMarkerList_unparse (s))); /* Insert it at location lastloc + 1, push other flags down */ for (i = s->nelements; i > lastloc + 1; i--) { s->elements [i] = s->elements [i - 1]; } s->elements [lastloc + 1] = fm; } s->nelements++; return TRUE; } void flagMarkerList_checkSuppressCounts (flagMarkerList s) { int nexpected = 0; int nsuppressed = 0; fileloc loc = fileloc_undefined; bool inCount = FALSE; int i; for (i = 0; i < s->nelements; i++) { flagMarker current = s->elements[i]; DPRINTF (("flagMarker: %s / %s", flagMarker_unparse (current), bool_unparse (inCount))); if (flagMarker_isIgnoreCount (current)) { llassert (!inCount); inCount = TRUE; nexpected = flagMarker_getCount (current); loc = flagMarker_getLoc (current); nsuppressed = 0; } else if (flagMarker_isIgnoreOff (current)) { if (inCount) { inCount = FALSE; llassert (fileloc_isDefined (loc)); if (nexpected > 0 && nexpected != nsuppressed) { /* Must use forceerror to prevent self-suppression! */ llforceerror (FLG_SUPCOUNTS, message ("Line expects to suppress %d error%&, found %d error%&", nexpected, nsuppressed), loc); } } } else if (flagMarker_isSuppress (current)) { nsuppressed++; } else { ; } } llassert (!inCount); } static void flagMarkerList_splice (flagMarkerList s, int index, /*@keep@*/ flagMarker fm) { fileloc loc = flagMarker_getLoc (fm); fileloc beforeloc, afterloc; int i; llassert (index >= 0 && (index + 1 < s->nelements)); beforeloc = flagMarker_getLoc (s->elements[index]); afterloc = flagMarker_getLoc (s->elements[index + 1]);; llassert (fileloc_sameFile (beforeloc, loc)); llassert (fileloc_sameFile (afterloc, loc)); if (s->nspace <= 0) { flagMarkerList_grow (s); } for (i = s->nelements; i > index + 1; i--) { s->elements[i] = s->elements[i - 1]; } s->elements[index + 1] = fm; s->nelements++; s->nspace--; } /*@only@*/ cstring flagMarkerList_unparse (flagMarkerList s) { int i; cstring st = cstring_makeLiteral ("["); for (i = 0; i < s->nelements; i++) { if (i == 0) { st = message ("%q %q", st, flagMarker_unparse (s->elements[i])); } else st = message ("%q, %q", st, flagMarker_unparse (s->elements[i])); } st = message ("%q ]", st); return st; } void flagMarkerList_free (flagMarkerList s) { int i; for (i = 0; i < s->nelements; i++) { flagMarker_free (s->elements[i]); } sfree (s->elements); sfree (s); } static int flagMarkerList_lastBeforeLoc (flagMarkerList s, fileloc loc) { int i; for (i = s->nelements - 1; i >= 0; i--) { flagMarker current = s->elements[i]; if (fileloc_sameFile (current->loc, loc) && (!flagMarker_beforeMarker (current, loc))) { return i; } } return -1; } static bool flagMarkerList_contains (flagMarkerList s, flagMarker fm) { int i; for (i = s->nelements - 1; i >= 0; i--) { flagMarker current = s->elements[i]; if (flagMarker_equal (current, fm)) { return TRUE; } } return FALSE; } /* ** returns YES iff ** > in ignore region (there is an ignore ON marker not followed by OFF) ** > code is OFF (-) ** ** returns NO iff ** > not in ignore region ** > code is ON (+) ** ** returns MAYBE iff ** > not in ignore region ** > code is unset or = ** ** requires: invariant for flagMarkerList: ** flagMarker's are sorted by line and col */ ynm flagMarkerList_suppressError (flagMarkerList s, flagcode code, fileloc loc) { int i; bool ignoreOff = FALSE; bool nameChecksOff = FALSE; bool flagOff = FALSE; ynm flagSet = MAYBE; bool islib = FALSE; bool isNameChecksFlag = flagcode_isNameChecksFlag (code); if (fileloc_isLib (loc)) { i = s->nelements - 1; islib = TRUE; } else { i = flagMarkerList_lastBeforeLoc (s, loc); } if (i < 0) { DPRINTF (("RETURNING!")); return MAYBE; } /* ** Go backwards through the remaining flagMarkers in this file. */ for (; i >= 0; i--) { flagMarker current = s->elements[i]; DPRINTF (("Check current: %s", flagMarker_unparse (current))); if (!islib && !flagMarker_sameFile (current, loc)) { DPRINTF (("Not same file: %s", fileloc_unparse (loc))); break; } if (flagMarker_isIgnoreOff (current)) { ignoreOff = TRUE; } else if (flagMarker_isIgnoreOn (current)) { if (!ignoreOff) { return YES; } } else if (flagMarker_isIgnoreCount (current)) { if (!ignoreOff) { flagMarkerList_splice (s, i, flagMarker_createSuppress (code, loc)); return YES; } } else if (flagMarker_isLocalSet (current)) { if (!flagOff && flagMarker_getCode (current) == code) { ynm set = flagMarker_getSet (current); if (ynm_isOff (set)) { return YES; } else { if (ynm_isOn (set)) { flagOff = TRUE; flagSet = NO; } else { flagOff = TRUE; flagSet = MAYBE; } if (ignoreOff) { if (isNameChecksFlag && !nameChecksOff) { ; } else { return flagSet; } } } } if (flagMarker_getCode (current) == FLG_NAMECHECKS && !nameChecksOff && isNameChecksFlag) { ynm set = flagMarker_getSet (current); if (ynm_isOff (set)) { return YES; } else { if (ynm_isOn (set)) { nameChecksOff = TRUE; flagSet = NO; } else { nameChecksOff = TRUE; flagSet = MAYBE; } if (ignoreOff && flagOff) { return flagSet; } } } } else { llassert (flagMarker_isSuppress (current)); } } return flagSet; } bool flagMarkerList_inIgnore (flagMarkerList s, fileloc loc) { int i; if (fileloc_isLib (loc)) { return FALSE; } i = flagMarkerList_lastBeforeLoc (s, loc); /* ** Go backwards through the remaining flagMarkers in this file. */ for (; i >= 0; i--) { flagMarker current = s->elements[i]; if (!flagMarker_sameFile (current, loc)) { break; } if (flagMarker_isIgnoreOff (current)) { return FALSE;; } else if (flagMarker_isIgnoreOn (current)) { return TRUE; } else if (flagMarker_isIgnoreCount (current)) { flagMarkerList_splice (s, i, flagMarker_createSuppress (SKIP_FLAG, loc)); return TRUE; } else { llassert (flagMarker_isLocalSet (current) || flagMarker_isSuppress (current)); } } return FALSE; } splint-3.1.2.dfsg1/src/idDeclList.c0000644021234200000250000000476507630461221014433 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** idDeclList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" idDeclList idDeclList_singleton (/*@only@*/ idDecl e) { idDeclList s = (idDeclList) dmalloc (sizeof (*s)); s->nelements = 1; s->nspace = idDeclListBASESIZE - 1; s->elements = (idDecl *) dmalloc (sizeof (*s->elements) * idDeclListBASESIZE); s->elements[0] = e; return (s); } static void idDeclList_grow (idDeclList s) { int i; idDecl *newelements; s->nspace += idDeclListBASESIZE; newelements = (idDecl *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } idDeclList idDeclList_add (idDeclList s, /*@only@*/ idDecl el) { if (s->nspace <= 0) idDeclList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /*@only@*/ cstring idDeclList_unparse (idDeclList s) { int i; cstring st = cstring_makeLiteral ("["); for (i = 0; i < s->nelements; i++) { if (i == 0) { st = message ("%q %q", st, idDecl_unparse (s->elements[i])); } else st = message ("%q, %q", st, idDecl_unparse (s->elements[i])); } st = message ("%q ]", st); return st; } void idDeclList_free (idDeclList s) { int i; for (i = 0; i < s->nelements; i++) { idDecl_free (s->elements[i]); } sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/flagSpec.c0000644021234200000250000001070407630461220014124 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** flagSpec.c */ # include "splintMacros.nf" # include "basic.h" static /*@only@*/ flagSpecItem flagSpecItem_create (/*@only@*/ cstring fname) { flagSpecItem res = (flagSpecItem) dmalloc (sizeof (*res)); DPRINTF (("Creating item: [%p]", fname)); DPRINTF (("The name is: %s", fname)); res->name = fname; res->code = flags_identifyFlag (fname); /* Invalid flag okay for now... */ return res; } static void flagSpecItem_free (/*@only@*/ flagSpecItem fitem) { cstring_free (fitem->name); sfree (fitem); } static /*@only@*/ flagSpec flagSpec_create (/*@only@*/ flagSpecItem fitem, /*@only@*/ flagSpec frest) { flagSpec res = (flagSpec) dmalloc (sizeof (*res)); res->tspec = fitem; res->trest = frest; DPRINTF (("New flag spec: %s", flagSpec_unparse (res))); return res; } flagSpec flagSpec_createPlain (cstring fname) { flagSpecItem fitem = flagSpecItem_create (fname); flagSpec res = flagSpec_create (fitem, flagSpec_undefined); DPRINTF (("New flag spec: %s", flagSpec_unparse (res))); return res; } flagSpec flagSpec_createOr (cstring fname, flagSpec f) { return flagSpec_create (flagSpecItem_create (fname), f); } void flagSpec_free (flagSpec f) { if (flagSpec_isDefined (f)) { flagSpecItem_free (f->tspec); if (flagSpec_isDefined (f->trest)) { flagSpec_free (f->trest); } sfree (f); } } flagSpec flagSpec_copy (flagSpec f) { if (flagSpec_isDefined (f)) { if (flagSpec_isDefined (f->trest)) { return flagSpec_createOr (cstring_copy (f->tspec->name), flagSpec_copy (f->trest)); } else { return flagSpec_createPlain (cstring_copy (f->tspec->name)); } } else { return flagSpec_undefined; } } cstring flagSpec_unparse (flagSpec f) { if (flagSpec_isDefined (f)) { if (flagSpec_isDefined (f->trest)) { return message ("%s | %q", f->tspec->name, flagSpec_unparse (f->trest)); } else { return cstring_copy (f->tspec->name); } } else { return cstring_makeLiteral ("<*** flagSpec undefined ***>"); } } cstring flagSpec_dump (flagSpec f) { llassert (flagSpec_isDefined (f)); llassert (!cstring_containsChar (f->tspec->name, '|')); llassert (!cstring_containsChar (f->tspec->name, '#')); if (flagSpec_isDefined (f->trest)) { return message ("%s|%q", f->tspec->name, flagSpec_dump (f->trest)); } else { return cstring_copy (f->tspec->name); } } flagSpec flagSpec_undump (char **s) { cstring flagname; flagname = reader_readUntilOne (s, "#|"); if (reader_optCheckChar (s, '|')) { return flagSpec_createOr (flagname, flagSpec_undump (s)); } else { return flagSpec_createPlain (flagname); } } flagcode flagSpec_getDominant (flagSpec fs) { llassert (flagSpec_isDefined (fs)); /* Invalid flags? */ return fs->tspec->code; } bool flagSpec_isOn (flagSpec fs, fileloc loc) { llassert (flagSpec_isDefined (fs)); if (context_flagOn (fs->tspec->code, loc)) { return TRUE; } else if (flagSpec_isDefined (fs->trest)) { return flagSpec_isOn (fs->trest, loc); } else { return FALSE; } } flagcode flagSpec_getFirstOn (flagSpec fs, fileloc loc) { llassert (flagSpec_isDefined (fs)); if (context_flagOn (fs->tspec->code, loc)) { return fs->tspec->code; } else if (flagSpec_isDefined (fs->trest)) { return flagSpec_getFirstOn (fs->trest, loc); } else { BADBRANCH; } BADBRANCHRET (INVALID_FLAG); } splint-3.1.2.dfsg1/src/globSet.c0000644021234200000250000000634507630461221014006 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** globSet.c */ # include "splintMacros.nf" # include "basic.h" globSet globSet_new () { return (globSet_undefined); } void globSet_clear (globSet g) { sRefSet_clear (g); } globSet globSet_insert (/*@returned@*/ globSet s, /*@exposed@*/ sRef el) { if (sRef_isKnown (el) && !sRef_isConst (el) && !sRef_isType (el)) { llassertprint (sRef_isFileOrGlobalScope (el) || sRef_isKindSpecial (el), ("el: %s", sRef_unparse (el))); return (sRefSet_insert (s, el)); } else { return s; } } globSet globSet_single (/*@exposed@*/ sRef el) { globSet res = globSet_new (); return globSet_insert (res, el); } void globSet_markImmutable (globSet g) { sRefSet_markImmutable (g); } globSet globSet_copyInto (/*@returned@*/ globSet s1, /*@exposed@*/ globSet s2) { return (sRefSet_copyInto (s1, s2)); } /*@only@*/ globSet globSet_newCopy (globSet s) { return (sRefSet_newCopy (s)); } bool globSet_member (globSet s, sRef el) { return (sRefSet_member (s, el)); } /*@exposed@*/ sRef globSet_lookup (globSet s, sRef el) { sRefSet_allElements (s, e) { if (sRef_similar (e, el)) { return e; } } end_sRefSet_allElements; return sRef_undefined; } bool globSet_hasStatic (globSet s) { sRefSet_allElements (s, el) { if (sRef_isFileStatic (el)) { return TRUE; } } end_sRefSet_allElements; return FALSE; } void globSet_free (/*@only@*/ globSet s) { sRefSet_free (s); } /*@only@*/ cstring globSet_dump (globSet lset) { cstring st = cstring_undefined; bool first = TRUE; sRefSet_allElements (lset, el) { if (!first) { st = cstring_appendChar (st, ','); } else { first = FALSE; } st = cstring_concatFree (st, sRef_dumpGlobal (el)); } end_sRefSet_allElements; return st; } globSet globSet_undump (char **s) { char c; sRefSet sl = sRefSet_new (); while ((c = **s) != '#' && c != '@' && c != '$' && c != '&') { sl = sRefSet_insert (sl, sRef_undumpGlobal (s)); if (**s == ',') { (*s)++; } } return sl; } /*@only@*/ cstring globSet_unparse (globSet ll) { /* return (sRefSet_unparseFull (ll)); */ return (sRefSet_unparsePlain (ll)); } int globSet_compare (globSet l1, globSet l2) { return (sRefSet_compare (l1, l2)); } splint-3.1.2.dfsg1/src/intSet.c0000644021234200000250000000643007630461221013650 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** intSet.c ** ** based on set_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" # include "intSet.h" /*@only@*/ intSet intSet_new () { intSet s = (intSet) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = intSetBASESIZE; s->elements = (int *) dmalloc (sizeof (*s->elements) * intSetBASESIZE); return (s); } static void intSet_grow (intSet s) { int i; int *newelements; s->nspace = intSetBASESIZE; newelements = (int *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace)); for (i = 0; i < s->entries; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } /* ** Ensures: if *e \in *s ** then unchanged (*s) & result = false ** else *s' = insert (*s, *e) & result = true ** Modifies: *s */ bool intSet_insert (intSet s, int el) { int i; for (i = 0; i < s->entries; i++) { if (s->elements[i] >= el) break; } if (s->entries > 0 && s->elements[i] == el) { return FALSE; } else { if (s->nspace <= 0) intSet_grow (s); s->nspace--; if (i == (s->entries - 1)) { s->elements[s->entries] = el; } else { int j; for (j = s->entries; j > i; j--) { s->elements[j] = s->elements[j-1]; } s->elements[i] = el; } s->entries++; return TRUE; } } bool intSet_member (intSet s, int el) { int i; for (i = 0; i < s->entries; i++) { if (el == s->elements[i]) { return TRUE; } if (el > s->elements[i]) { return FALSE; } } return FALSE; } /*@only@*/ cstring intSet_unparseText (intSet s) { int i; cstring st = cstring_undefined; int lastentry = s->entries - 1; for (i = 0; i < s->entries; i++) { if (i == 0) st = message ("%d", s->elements[i]); else if (i == lastentry) st = message ("%q or %d", st, s->elements[i]); else st = message ("%q, %d", st, s->elements[i]); } return st; } /*@only@*/ cstring intSet_unparse (intSet s) { int i; cstring st = cstring_makeLiteral ("{"); for (i = 0; i < s->entries; i++) { st = message ("%q %d", st, s->elements[i]); } st = message ("%q}", st); return st; } void intSet_free (intSet s) { sfree (s->elements); sfree (s); } splint-3.1.2.dfsg1/src/typeIdSet.c0000644021234200000250000001426307646432516014333 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** typeIdSet.c */ # include "splintMacros.nf" # include "basic.h" /*@constant int TISTABLEBASESIZE;@*/ # define TISTABLEBASESIZE LARGEBASESIZE static int tistableentries = 0; static int tistablefree = 0; typedef /*@only@*/ usymIdSet o_usymIdSet; static /*@only@*/ o_usymIdSet *tistable; static void tistable_addDirectEntry (/*@only@*/ usymIdSet p_s) /*@modifies tistable, tistableentries, tistablefree@*/; void typeIdSet_initMod (void) /*@globals undef tistable;@*/ /*@modifies tistable, tistablefree;@*/ { llassert (tistableentries == 0 && tistablefree == 0); tistablefree = TISTABLEBASESIZE; tistable = (usymIdSet *) dmalloc (sizeof (tistable) * tistablefree); tistable[0] = usymIdSet_undefined; tistableentries = 1; tistablefree--; } void typeIdSet_destroyMod (void) /*@globals killed tistable, tistableentries@*/ { int i; for (i = 0; i < tistableentries; i++) { usymIdSet_free (tistable[i]); } sfree (tistable); tistableentries = 0; } void typeIdSet_dumpTable (FILE *fout) { int i; /* ** Don't dump 0th entry */ for (i = 1; i < tistableentries; i++) { cstring s = usymIdSet_dump (tistable[i]); fprintf (fout, "%s\n", cstring_toCharsSafe (s)); cstring_free (s); } } # if 0 static /*@unused@*/ void tistable_printOut (void) { int i; /* ** Don't dump 0th entry */ for (i = 1; i < tistableentries; i++) { cstring s = usymIdSet_unparse (tistable[i]); fprintf (g_warningstream, "%d: %s\n", i, cstring_toCharsSafe (s)); cstring_free (s); } } # endif void typeIdSet_loadTable (FILE *fin) { char *s = mstring_create (MAX_DUMP_LINE_LENGTH); char *os = s; llassert (tistableentries == 1); s = reader_readLine (fin, s, MAX_DUMP_LINE_LENGTH); while (s != NULL && *s != ';') { usymIdSet u = usymIdSet_undump (&s); llassert (*s == '\0' || *s == '\n'); tistable_addDirectEntry (u); s = reader_readLine (fin, os, MAX_DUMP_LINE_LENGTH); } } static void tistable_grow (void) { o_usymIdSet *oldtable = tistable; int newsize = tistableentries + TISTABLEBASESIZE; int i; llassert (tistablefree == 0); tistable = (usymIdSet *) dmalloc (sizeof (tistable) * newsize); for (i = 0; i < tistableentries; i++) { tistable[i] = oldtable[i]; } tistablefree = TISTABLEBASESIZE; sfree (oldtable); } static void tistable_addDirectEntry (/*@only@*/ usymIdSet s) { if (tistablefree == 0) { tistable_grow (); } tistable[tistableentries] = s; tistableentries++; tistablefree--; } static int tistable_addEntry (/*@only@*/ usymIdSet s) { int i; for (i = 0; i < tistableentries; i++) { if (usymIdSet_compare (tistable[i], s) == 0) { /*@access usymIdSet@*/ llassert (i == 0 || s != tistable[i]); /*@noaccess usymIdSet@*/ usymIdSet_free (s); return i; } } tistable_addDirectEntry (s); return (tistableentries - 1); } static /*@observer@*/ usymIdSet tistable_fetch (typeIdSet t) /*@globals tistableentries, tistable@*/ /*@modifies nothing;@*/ { llassert (t >= 0 && t < tistableentries); return tistable[t]; } typeIdSet typeIdSet_emptySet (void) { if (tistableentries == 0) { int val = tistable_addEntry (usymIdSet_new ()); llassert (val == 0); } llassert (usymIdSet_isUndefined (tistable[0])); return 0; } bool typeIdSet_member (typeIdSet t, typeId el) { usymIdSet u = tistable_fetch (t); return usymIdSet_member (u, typeId_toUsymId (el)); } bool typeIdSet_isEmpty (typeIdSet t) { return (t == 0); } typeIdSet typeIdSet_single (typeId t) { return (tistable_addEntry (usymIdSet_single (typeId_toUsymId (t)))); } typeIdSet typeIdSet_singleOpt (typeId t) { if (typeId_isValid (t)) { return (tistable_addEntry (usymIdSet_single (typeId_toUsymId (t)))); } else { return typeIdSet_empty; } } typeIdSet typeIdSet_insert (typeIdSet t, typeId el) { usymIdSet u = tistable_fetch (t); if (usymIdSet_member (u, typeId_toUsymId (el))) { return t; } else { return (tistable_addEntry (usymIdSet_add (u, typeId_toUsymId (el)))); } } typeIdSet typeIdSet_removeFresh (typeIdSet t, typeId el) { return (tistable_addEntry (usymIdSet_removeFresh (tistable_fetch (t), typeId_toUsymId (el)))); } cstring typeIdSet_unparse (typeIdSet t) { return (usymIdSet_unparse (tistable_fetch (t))); } int typeIdSet_compare (typeIdSet t1, typeIdSet t2) { return (int_compare (t1, t2)); } typeIdSet typeIdSet_subtract (typeIdSet s, typeIdSet t) { if (typeIdSet_isEmpty (t)) { return s; } else { return (tistable_addEntry (usymIdSet_subtract (tistable_fetch (s), tistable_fetch (t)))); } } cstring typeIdSet_dump (typeIdSet t) { return (message ("%d", t)); } typeIdSet typeIdSet_undump (char **s) { int i; i = reader_getInt (s); llassert (i >= 0 && i < tistableentries); return (typeIdSet) i; } typeIdSet typeIdSet_union (typeIdSet t1, typeIdSet t2) { if (t1 == typeIdSet_undefined) { return t2; } else if (t2 == typeIdSet_undefined) { return t1; } else { return (tistable_addEntry (usymIdSet_newUnion (tistable_fetch (t1), tistable_fetch (t2)))); } } splint-3.1.2.dfsg1/src/guardSet.c0000644021234200000250000001643307630461221014164 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** guardSet.c ** ** if x is in true guards, then x is not null on this branch, ** and x is "probably" null on the other branch. ** if x is in false guards, then x is "probably" null on this branch, ** and x is not null on the other branch. ** ** Either guards is obsolete and should be removed soon. */ # include "splintMacros.nf" # include "basic.h" guardSet guardSet_new () { return guardSet_undefined; } static /*@notnull@*/ /*@special@*/ guardSet guardSet_newEmpty (void) /*@defines result@*/ /*@post:isnull result->tguard, result->fguard@*/ { guardSet g = (guardSet) dmalloc (sizeof (*g)); g->tguard = sRefSet_undefined; g->fguard = sRefSet_undefined; return g; } sRefSet guardSet_getTrueGuards (guardSet g) { if (guardSet_isDefined (g)) { return (g->tguard); } else { return (sRefSet_undefined); } } void guardSet_delete (guardSet g, sRef s) { bool res; llassert (guardSet_isDefined (g)); res = sRefSet_delete (g->tguard, s); /* ** This assertion is no longer always true: ** llassert (res); */ } /*@dependent@*/ /*@exposed@*/ sRefSet guardSet_getFalseGuards (guardSet g) { if (guardSet_isDefined (g)) { return (g->fguard); } else { return (sRefSet_undefined); } } guardSet guardSet_or (/*@returned@*/ /*@unique@*/ guardSet s, guardSet t) { llassert (NOALIAS (s, t)); if (s == guardSet_undefined) { if (t == guardSet_undefined) { return s; } s = guardSet_newEmpty (); } if (t == guardSet_undefined) { sRefSet_free (s->tguard); s->tguard = sRefSet_new (); } else { sRefSet last; s->tguard = sRefSet_intersect (last = s->tguard, t->tguard); sRefSet_free (last); s->fguard = sRefSet_union (s->fguard, t->fguard); } return s; } guardSet guardSet_and (/*@returned@*/ /*@unique@*/ guardSet s, guardSet t) { llassert (NOALIAS (s, t)); if (s == guardSet_undefined) { if (t == guardSet_undefined) { return s; } s = guardSet_newEmpty (); } if (t == guardSet_undefined) { sRefSet_free (s->fguard); s->fguard = sRefSet_new (); } else { sRefSet last; s->tguard = sRefSet_union (s->tguard, t->tguard); s->fguard = sRefSet_intersect (last = s->fguard, t->fguard); sRefSet_free (last); } return s; } /*@only@*/ guardSet guardSet_union (/*@only@*/ guardSet s, guardSet t) { if (t == guardSet_undefined) return s; llassert (NOALIAS (s, t)); if (guardSet_isDefined (s)) { s->tguard = sRefSet_union (s->tguard, t->tguard); s->fguard = sRefSet_union (s->fguard, t->fguard); } else { s = guardSet_newEmpty (); s->tguard = sRefSet_newCopy (t->tguard); s->fguard = sRefSet_newCopy (t->fguard); } return s; } guardSet guardSet_levelUnion (/*@only@*/ guardSet s, guardSet t, int lexlevel) { if (t == guardSet_undefined) return s; llassert (NOALIAS (s, t)); if (guardSet_isDefined (s)) { s->tguard = sRefSet_levelUnion (s->tguard, t->tguard, lexlevel); s->fguard = sRefSet_levelUnion (s->fguard, t->fguard, lexlevel); } else { s = guardSet_newEmpty (); /* should be necessary! */ sRefSet_free (s->tguard); sRefSet_free (s->fguard); s->tguard = sRefSet_levelCopy (t->tguard, lexlevel); s->fguard = sRefSet_levelCopy (t->fguard, lexlevel); } return s; } guardSet guardSet_levelUnionFree (/*@returned@*/ /*@unique@*/ guardSet s, /*@only@*/ guardSet t, int lexlevel) { if (t == guardSet_undefined) return s; if (guardSet_isDefined (s)) { s->tguard = sRefSet_levelUnion (s->tguard, t->tguard, lexlevel); s->fguard = sRefSet_levelUnion (s->fguard, t->fguard, lexlevel); } else { s = guardSet_newEmpty (); /* should be necessary! */ sRefSet_free (s->tguard); sRefSet_free (s->fguard); s->tguard = sRefSet_levelCopy (t->tguard, lexlevel); s->fguard = sRefSet_levelCopy (t->fguard, lexlevel); } guardSet_free (t); return s; } void guardSet_flip (guardSet g) { if (g != guardSet_undefined) { sRefSet tmp = g->tguard; g->tguard = g->fguard; g->fguard = tmp; } } /*@only@*/ guardSet guardSet_invert (/*@temp@*/ guardSet g) { if (g != guardSet_undefined) { guardSet ret = guardSet_newEmpty (); ret->tguard = sRefSet_newCopy (g->fguard); ret->fguard = sRefSet_newCopy (g->tguard); return ret; } return guardSet_undefined; } /*@only@*/ guardSet guardSet_copy (/*@temp@*/ guardSet g) { if (g != guardSet_undefined) { guardSet ret = guardSet_newEmpty (); ret->tguard = sRefSet_newCopy (g->tguard); ret->fguard = sRefSet_newCopy (g->fguard); return ret; } return guardSet_undefined; } guardSet guardSet_addTrueGuard (/*@returned@*/ guardSet g, /*@exposed@*/ sRef s) { if (sRef_isMeaningful (s)) { if (g == guardSet_undefined) { g = guardSet_newEmpty (); } g->tguard = sRefSet_insert (g->tguard, s); } return g; } guardSet guardSet_addFalseGuard (/*@returned@*/ guardSet g, /*@exposed@*/ sRef s) { if (sRef_isMeaningful (s)) { if (g == guardSet_undefined) { g = guardSet_newEmpty (); } g->fguard = sRefSet_insert (g->fguard, s); } return g; } /*@only@*/ cstring guardSet_unparse (guardSet g) { if (g == guardSet_undefined) { return (cstring_makeLiteral ("")); } else { return (message ("not null: %q / prob null: %q", sRefSet_unparseDebug (g->tguard), sRefSet_unparseDebug (g->fguard))); } } void guardSet_free (/*@only@*/ guardSet g) { if (g == guardSet_undefined) return; sRefSet_free (g->tguard); sRefSet_free (g->fguard); sfree (g); } bool guardSet_isGuarded (guardSet g, sRef s) { if (g == guardSet_undefined) return FALSE; return (sRefSet_member (g->tguard, s)); } bool guardSet_mustBeNull (guardSet g, sRef s) { bool ret; if (g == guardSet_undefined) return FALSE; ret = sRefSet_member (g->fguard, s); return ret; } bool guardSet_isEmpty (guardSet g) { if (guardSet_isDefined (g)) { return (sRefSet_isEmpty (g->tguard) && sRefSet_isEmpty (g->fguard)); } else { return TRUE; } } splint-3.1.2.dfsg1/src/usymIdSet.c0000644021234200000250000001574207630461222014337 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** usymIdSet.c ** ** based on set_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" usymIdSet usymIdSet_new () { return usymIdSet_undefined; } static /*@notnull@*/ /*@only@*/ usymIdSet usymIdSet_newEmpty (void) { usymIdSet s = (usymIdSet) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = usymIdSetBASESIZE; s->elements = (usymId *) dmalloc (sizeof (*s->elements) * usymIdSetBASESIZE); return (s); } static void usymIdSet_grow (/*@notnull@*/ usymIdSet s) { int i; usymId *newelements; s->nspace = usymIdSetBASESIZE; newelements = (usymId *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace)); for (i = 0; i < s->entries; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } /*@only@*/ usymIdSet usymIdSet_single (usymId t) { usymIdSet s = (usymIdSet) dmalloc (sizeof (*s)); s->entries = 1; s->nspace = usymIdSetBASESIZE - 1; s->elements = (usymId *) dmalloc (sizeof (*s->elements) * usymIdSetBASESIZE); s->elements[0] = t; return (s); } static usymIdSet usymIdSet_insert (/*@returned@*/ usymIdSet s, usymId el) { if (usymIdSet_isUndefined (s)) { s = usymIdSet_newEmpty (); } if (usymIdSet_member (s, el)) { return s; } else { if (s->nspace <= 0) usymIdSet_grow (s); s->nspace--; s->elements[s->entries] = el; s->entries++; return s; } } static usymIdSet usymIdSet_copy (/*@notnull@*/ usymIdSet s) { int size = s->entries + 1; usymIdSet t = (usymIdSet) dmalloc (sizeof (*t)); int i; t->entries = s->entries; t->nspace = 1; t->elements = (usymId *) dmalloc (sizeof (*t->elements) * size); for (i = 0; i < s->entries; i++) { t->elements[i] = s->elements[i]; } return t; } usymIdSet usymIdSet_add (usymIdSet s, usymId el) { if (usymIdSet_isDefined (s)) { llassert (!usymIdSet_member (s, el)); return (usymIdSet_insert (usymIdSet_copy (s), el)); } else { return (usymIdSet_single (el)); } } usymIdSet usymIdSet_removeFresh (/*@temp@*/ usymIdSet s, usymId el) { if (usymIdSet_isDefined (s)) { usymIdSet t = usymIdSet_newEmpty (); int i; for (i = 0; i < s->entries; i++) { if (!usymId_equal (el, s->elements[i])) { t = usymIdSet_insert (t, s->elements[i]); } } return t; } else { return usymIdSet_undefined; } } usymIdSet usymIdSet_newUnion (usymIdSet s1, usymIdSet s2) { usymIdSet t = usymIdSet_new (); usymIdSet_elements (s1, current) { t = usymIdSet_insert (t, current); } end_usymIdSet_elements; usymIdSet_elements (s2, current) { t = usymIdSet_insert (t, current); } end_usymIdSet_elements; return t; } /* ** returns a new usymIdSet comprised of all elements ** in s which are not in t. */ usymIdSet usymIdSet_subtract (usymIdSet s, usymIdSet t) { usymIdSet r = usymIdSet_new (); usymIdSet_elements (s, current) { if (!usymIdSet_member (t, current)) { r = usymIdSet_insert (r, current); } } end_usymIdSet_elements; return r; } bool usymIdSet_member (usymIdSet s, usymId el) { if (usymIdSet_isUndefined (s)) { return FALSE; } else { int i; for (i = 0; i < s->entries; i++) { if (usymId_equal (el, s->elements[i])) return TRUE; } return FALSE; } } void usymIdSet_free (/*@only@*/ usymIdSet s) { if (!usymIdSet_isUndefined (s)) { int i; for (i = 0; i < s->entries; i++) { /* usymId_free (s->elements[i]); */ } sfree (s->elements); sfree (s); } } cstring usymIdSet_dump (usymIdSet lset) { cstring st = cstring_undefined; if (!usymIdSet_isUndefined (lset)) { bool first = TRUE; int i; for (i = 0; i < lset->entries; i++) { usymId current = lset->elements[i]; if (!usymId_isInvalid (current)) { current = usymtab_convertId (current); if (first) { st = message ("%d", current); first = FALSE; } else { st = message ("%q,%d", st, current); } } } } return (st); } /* ** end of list is '@' or '\0' */ usymIdSet usymIdSet_undump (char **s) { usymIdSet t = usymIdSet_new (); char *olds = *s; char c; while ((c = **s) != '\0' && c != '@' && c != '#' && c != '\n') { int tid = 0; while (c != '@' && c != '#' && c != ',' && c != '\0' && c != '\n') { while (c >= '0' && c <= '9') { tid *= 10; tid += (int) (c - '0'); (*s)++; c = **s; } if (*s == olds) { llcontbug (message ("usymIdSet_undump: loop: %s", cstring_fromChars (*s))); while (**s != '\0') { (*s)++; } /*@innerbreak@*/ break; } olds = *s; t = usymIdSet_insert (t, usymId_fromInt (tid)); } if (c == ',') { (*s)++; } } return t; } /*@only@*/ cstring usymIdSet_unparse (usymIdSet ll) { cstring s = cstring_undefined; if (!usymIdSet_isUndefined (ll)) { int i; for (i = 0; i < ll->entries; i++) { usymId current = ll->elements[i]; if (i == 0) s = uentry_getName (usymtab_getGlobalEntry (current)); else s = message ("%q, %q", s, uentry_getName (usymtab_getGlobalEntry (current))); } } return s; } int usymIdSet_compare (usymIdSet l1, usymIdSet l2) { if (usymIdSet_isUndefined (l1)) { return (usymIdSet_size (l2) == 0 ? 0 : 1); } if (usymIdSet_isUndefined (l2)) { return (usymIdSet_size (l1) == 0 ? 0 : 1); } { int li1 = l1->entries; int li2 = l2->entries; int leastelements = (li1 < li2) ? li1 : li2; int i = 0; while (i < leastelements) { if (usymId_equal (l1->elements[i], l2->elements[i])) { i++; } else { if (l1->elements[i] > l2->elements[i]) { return 1; } else { return -1; } } } return (int_compare (li1, li2)); } } splint-3.1.2.dfsg1/src/sRefSet.c0000644021234200000250000004274407747261242013777 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** sRefSet.c ** ** based on set_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" sRefSet sRefSet_new () { return sRefSet_undefined; } static /*@notnull@*/ /*@only@*/ sRefSet sRefSet_newEmpty (void) { sRefSet s = (sRefSet) dmalloc (sizeof (*s)); s->entries = 0; s->nspace = sRefSetBASESIZE; s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefSetBASESIZE); return (s); } /*@only@*/ sRefSet sRefSet_single (/*@exposed@*/ sRef sr) { sRefSet s = (sRefSet) dmalloc (sizeof (*s)); s->entries = 1; s->nspace = sRefSetBASESIZE - 1; s->elements = (sRef *) dmalloc (sizeof (*s->elements) * sRefSetBASESIZE); s->elements[0] = sr; return (s); } static void sRefSet_grow (/*@notnull@*/ sRefSet s) { int i; sRef *newelements; s->nspace = sRefSetBASESIZE; newelements = (sRef *) dmalloc (sizeof (*newelements) * (s->entries + s->nspace)); for (i = 0; i < s->entries; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } sRefSet sRefSet_insert (sRefSet s, /*@exposed@*/ sRef el) { if (sRefSet_isUndefined (s)) { s = sRefSet_newEmpty (); } if (!sRefSet_isSameMember (s, el)) { if (s->nspace <= 0) sRefSet_grow (s); s->nspace--; llassert (s->elements != NULL); s->elements[s->entries] = el; s->entries++; } else { ; } return s; } void sRefSet_clear (sRefSet s) { if (sRefSet_isDefined (s)) { s->nspace += s->entries; s->entries = 0; } } /* ** slow algorithm...but it doesn't matter */ void sRefSet_clearStatics (sRefSet s) { if (sRefSet_isDefined (s)) { int i; for (i = 0; i < s->entries; i++) { sRef current = s->elements[i]; if (sRef_isFileStatic (sRef_getRootBase (current))) { int j; for (j = i; j < s->entries - 1; j++) { s->elements[j] = s->elements[j+1]; } s->entries--; s->nspace++; i--; } } } } bool sRefSet_delete (sRefSet s, sRef el) { int i; if (sRefSet_isUndefined (s)) return FALSE; if (s->elements != NULL) { for (i = 0; i < s->entries; i++) { sRef current = s->elements[i]; if (sRef_realSame (el, current)) { int j; for (j = i; j < s->entries - 1; j++) { s->elements[j] = s->elements[j+1]; } s->entries--; s->nspace++; return TRUE; } } } return FALSE; } /*@exposed@*/ sRef sRefSet_choose (sRefSet s) { llassert (sRefSet_isDefined (s)); llassert (s->entries > 0); llassert (s->elements != NULL); return (s->elements[0]); } /*@exposed@*/ sRef sRefSet_mergeIntoOne (sRefSet s) { sRef res; int i; if (sRefSet_isUndefined (s)) return sRef_undefined; if (s->entries == 0) return sRef_undefined; llassert (s->elements != NULL); res = s->elements[0]; for (i = 1; i < s->entries; i++) { sRef tmp; tmp = sRef_makeConj (res, s->elements[i]); res = tmp; } return res; } /* ** this is really yucky...but it works... */ bool sRefSet_deleteBase (sRefSet s, sRef base) { int i = 0; int offset = 0; if (sRefSet_isUndefined (s) || (s->elements == NULL)) { return FALSE; } ; while (i + offset < s->entries) { sRef current = s->elements[i + offset]; while (sRef_includedBy (current, base)) { offset++; if (i + offset >= s->entries) goto doneLoop; current = s->elements [i + offset]; } if (offset > 0) { s->elements [i] = current; } i++; } doneLoop: s->entries -= offset; s->nspace += offset; return (offset > 0); } /* ** modifies *s1 */ sRefSet sRefSet_unionFree (/*@returned@*/ sRefSet s1, sRefSet s2) { sRefSet res = sRefSet_union (s1, s2); sRefSet_free (s2); return res; } sRefSet sRefSet_union (/*@returned@*/ sRefSet s1, sRefSet s2) { if (s1 == s2) { return s1; } if (sRefSet_isEmpty (s1)) { s1 = sRefSet_copyInto (s1, s2); } else { sRefSet_allElements (s2, el) { s1 = sRefSet_insert (s1, el); } end_sRefSet_allElements; } return s1; } /* ** s1 <- s1 U (s2 - ex - params) */ sRefSet sRefSet_unionExcept (/*@returned@*/ sRefSet s1, sRefSet s2, sRef ex) { if (s1 == s2) return s1; sRefSet_allElements (s2, el) { if (sRef_same (el, ex)) { ; } else { s1 = sRefSet_insert (s1, el); } } end_sRefSet_allElements; return s1; } /*@only@*/ sRefSet sRefSet_realNewUnion (sRefSet s1, sRefSet s2) { llassert (NOALIAS (s1, s2)); if (sRefSet_isUndefined (s1)) { return (sRefSet_newCopy (s2)); } else { sRefSet ret = sRefSet_newCopy (s1); sRefSet_allElements (s2, el) { ret = sRefSet_insert (ret, el); } end_sRefSet_allElements; return ret; } } /* slow! */ /*@only@*/ sRefSet sRefSet_intersect (sRefSet s1, sRefSet s2) { sRefSet s = sRefSet_new (); llassert (NOALIAS (s1, s2)); sRefSet_allElements (s1, el) { if (sRefSet_member (s2, el)) { s = sRefSet_insert (s, el); } } end_sRefSet_allElements; return s; } sRefSet sRefSet_levelUnion (/*@returned@*/ sRefSet sr, sRefSet s, int lexlevel) { llassert (NOALIAS (sr, s)); sRefSet_allElements (s, el) { if (sRef_lexLevel (el) <= lexlevel) { sr = sRefSet_insert (sr, el); } } end_sRefSet_allElements; return sr; } void sRefSet_levelPrune (sRefSet s, int lexlevel) { if (sRefSet_isDefined (s)) { int i; int backcount = sRefSet_size (s) - 1; for (i = 0; i <= backcount; i++) { sRef el = s->elements[i]; if (sRef_lexLevel (el) > lexlevel) { int j; for (j = backcount; j > i; j--) { backcount--; s->entries--; s->nspace++; if (sRef_lexLevel (s->elements[j]) <= lexlevel) { s->elements[i] = s->elements[j]; if (backcount == i) s->entries++; /*@innerbreak@*/ break; } } if (backcount == i) { s->entries--; } } } } } /* ** s1 <- s2 */ sRefSet sRefSet_copyInto (/*@returned@*/ sRefSet s1, /*@exposed@*/ sRefSet s2) { int origentries; llassert (NOALIAS (s1, s2)); if (sRefSet_isUndefined (s1)) { if (sRefSet_isEmpty (s2)) { return s1; } else { s1 = sRefSet_newEmpty (); } } origentries = s1->entries; s1->nspace = s1->entries + s1->nspace; s1->entries = 0; sRefSet_allElements (s2, el) { if (s1->nspace == 0) { sRefSet_grow (s1); } s1->elements[s1->entries] = el; s1->nspace--; s1->entries++; } end_sRefSet_allElements; return s1; } /*@only@*/ sRefSet sRefSet_newCopy (/*@exposed@*/ sRefSet s) { if (sRefSet_isEmpty (s)) { return sRefSet_undefined; } else { sRefSet r = (sRefSet) dmalloc (sizeof (*r)); int i; r->entries = s->entries; r->nspace = s->nspace; r->elements = (sRef *) dmalloc (sizeof (*r->elements) * (s->entries + s->nspace)); for (i = 0; i < s->entries; i++) { r->elements[i] = s->elements[i]; } return r; } } /*@only@*/ sRefSet sRefSet_levelCopy (/*@exposed@*/ sRefSet s, int lexlevel) { if (sRefSet_isEmpty (s)) { return sRefSet_undefined; } else { sRefSet r = (sRefSet) dmalloc (sizeof (*r)); int i; r->nspace = s->entries; r->entries = 0; r->elements = (sRef *) dmalloc (sizeof (*r->elements) * (s->entries)); for (i = 0; i < s->entries; i++) { if (sRef_lexLevel (s->elements[i]) <= lexlevel) { r->elements[r->entries] = s->elements[i]; r->entries++; r->nspace--; } } return r; } } /*@only@*/ sRefSet sRefSet_newDeepCopy (sRefSet s) { if (sRefSet_isUndefined (s)) { return sRefSet_newEmpty (); } else { sRefSet r = (sRefSet) dmalloc (sizeof (*r)); int i; r->entries = s->entries; r->nspace = s->nspace; r->elements = (sRef *) dmalloc (sizeof (*r->elements) * (s->entries + s->nspace)); for (i = 0; i < s->entries; i++) { r->elements[i] = sRef_copy (s->elements[i]); } return r; } } static bool sRefSet_isElementCompare (bool (*test)(sRef, sRef), sRefSet s, sRef el) { sRefSet_allElements (s, e) { if ((test)(el, e)) { return TRUE; } } end_sRefSet_allElements; return FALSE; } static bool sRefSet_isElementTest (bool (*test)(sRef), sRefSet s) { sRefSet_allElements (s, e) { if ((test)(e)) { return TRUE; } } end_sRefSet_allElements; return FALSE; } bool sRefSet_hasRealElement (sRefSet s) { sRefSet_allElements (s, e) { if (sRef_isMeaningful (e) && !sRef_isUnconstrained (e)) { return TRUE; } } end_sRefSet_allElements; return FALSE; } bool sRefSet_containsSameObject (sRefSet s, sRef el) { return (sRefSet_isElementCompare (sRef_sameObject, s, el)); } bool sRefSet_isSameMember (sRefSet s, sRef el) { return (sRefSet_isElementCompare (sRef_realSame, s, el)); } bool sRefSet_isSameNameMember (sRefSet s, sRef el) { return (sRefSet_isElementCompare (sRef_sameName, s, el)); } bool sRefSet_member (sRefSet s, sRef el) { return (sRefSet_isElementCompare (sRef_similar, s, el)); } bool sRefSet_hasStatic (sRefSet s) { return (sRefSet_isElementTest (sRef_isFileStatic, s)); } bool sRefSet_hasUnconstrained (sRefSet s) { return (sRefSet_isElementTest (sRef_isUnconstrained, s)); } cstring sRefSet_unparseUnconstrained (sRefSet s) { int num = 0; cstring res = cstring_undefined; sRefSet_allElements (s, el) { if (sRef_isUnconstrained (el)) { if (cstring_isUndefined (res)) { res = cstring_copy (sRef_unconstrainedName (el)); } else { res = message ("%q, %s", res, sRef_unconstrainedName (el)); } num++; } } end_sRefSet_allElements ; if (num == 0) { llassert (cstring_isUndefined (res)); return (cstring_makeLiteral ("")); } else if (num == 1) { return (message ("unconstrained function %q", res)); } else { return (message ("unconstrained functions %q", res)); } } cstring sRefSet_unparseUnconstrainedPlain (sRefSet s) { cstring res = cstring_undefined; sRefSet_allElements (s, el) { if (sRef_isUnconstrained (el)) { if (cstring_isUndefined (res)) { res = cstring_copy (sRef_unconstrainedName (el)); } else { res = message ("%q, %s", res, sRef_unconstrainedName (el)); } } } end_sRefSet_allElements ; return res; } bool sRefSet_modifyMember (sRefSet s, sRef m) { bool ret = FALSE; sRefSet_allElements (s, e) { if (sRef_similar (m, e)) { sRef_setModified (e); ret = TRUE; } } end_sRefSet_allElements; return ret; } /*@exposed@*/ sRef sRefSet_lookupMember (sRefSet s, sRef el) { sRefSet_allElements (s, e) { if (sRef_similar (el, e)) { return e; } } end_sRefSet_allElements; return sRef_undefined; } int sRefSet_size (sRefSet s) { if (sRefSet_isUndefined (s)) return 0; return s->entries; } /*@only@*/ cstring sRefSet_unparse (sRefSet s) { int i; cstring st = cstring_makeLiteral ("{"); if (sRefSet_isDefined (s)) { for (i = 0; i < sRefSet_size (s); i++) { if (i == 0) st = message ("%q %q", st, sRef_unparse (s->elements[i])); else st = message ("%q, %q", st, sRef_unparse (s->elements[i])); } } st = message ("%q }", st); return st; } cstring sRefSet_unparsePlain (sRefSet s) { int i; cstring st = cstring_undefined; if (sRefSet_isDefined (s)) { for (i = 0; i < sRefSet_size (s); i++) { if (i == 0) st = sRef_unparse (s->elements[i]); else st = message ("%q, %q", st, sRef_unparse (s->elements[i])); } } return st; } cstring sRefSet_unparseDebug (sRefSet s) { int i; cstring st = cstring_makeLiteral ("{"); if (sRefSet_isDefined (s)) { for (i = 0; i < sRefSet_size (s); i++) { if (i == 0) { st = message ("%q %q", st, sRef_unparseDebug (s->elements[i])); } else { st = message ("%q, %q", st, sRef_unparseDebug (s->elements[i])); } } } st = message ("%q }", st); return st; } cstring sRefSet_unparseFull (sRefSet s) { int i; cstring st = cstring_makeLiteral ("{"); if (sRefSet_isDefined (s)) { for (i = 0; i < sRefSet_size (s); i++) { if (i == 0) { st = message ("%q %q", st, sRef_unparseFull (s->elements[i])); } else { st = message ("%q, %q", st, sRef_unparseFull (s->elements[i])); } } } st = message ("%q }", st); return st; } void sRefSet_fixSrefs (sRefSet s) { if (sRefSet_isDefined (s)) { int i; for (i = 0; i < sRefSet_size (s); i++) { sRef current = s->elements[i]; if (sRef_isLocalVar (current)) { s->elements[i] = uentry_getSref (sRef_getUentry (current)); } } } } void sRefSet_free (/*@only@*/ sRefSet s) { if (!sRefSet_isUndefined (s)) { /* evans 2003-10-20: increase size sanity limit from 1000 */ llassertprint (s->entries < 99999, ("sRefSet free size: %d", s->entries)); sfree (s->elements); sfree (s); } } sRefSet sRefSet_removeIndirection (sRefSet s) { /* ** returns a NEW sRefSet containing references to all sRef's in s */ sRefSet t = sRefSet_new (); sRefSet_allElements (s, el) { if (!sRef_isAddress (el)) { t = sRefSet_insert (t, sRef_makeAddress (el)); } } end_sRefSet_allElements; return t; } sRefSet sRefSet_addIndirection (sRefSet s) { /* ** returns a NEW sRefSet containing references to all sRef's in s */ sRefSet t = sRefSet_new (); sRefSet_allElements (s, el) { ctype ct = ctype_realType (sRef_getType (el)); if ((ctype_isArrayPtr (ct))) { sRef a = sRef_constructPointer (el); t = sRefSet_insert (t, a); } } end_sRefSet_allElements; return t; } sRefSet sRefSet_accessField (sRefSet s, /*@observer@*/ cstring f) { /* ** returns a NEW sRefSet containing references to all sRef's in s */ sRefSet t = sRefSet_new (); sRefSet_allElements (s, el) { ctype ct = ctype_realType (sRef_getType (el)); if ((ctype_isStruct (ct) || ctype_isUnion (ct)) && (!uentry_isUndefined (uentryList_lookupField (ctype_getFields (ct), f)))) { t = sRefSet_insert (t, sRef_makeNCField (el, f)); } } end_sRefSet_allElements; return t; } sRefSet sRefSet_fetchUnknown (sRefSet s) { sRefSet t = sRefSet_new (); sRefSet_allElements (s, el) { ctype ct = ctype_realType (sRef_getType (el)); if (ctype_isArrayPtr (ct)) { t = sRefSet_insert (t, sRef_makeArrayFetch (el)); } } end_sRefSet_allElements; return t; } sRefSet sRefSet_fetchKnown (sRefSet s, int i) { sRefSet t = sRefSet_new (); sRefSet_allElements (s, el) { ctype ct = ctype_realType (sRef_getType (el)); if (ctype_isArrayPtr (ct)) { t = sRefSet_insert (t, sRef_makeArrayFetchKnown (el, i)); } } end_sRefSet_allElements; return t; } int sRefSet_compare (sRefSet s1, sRefSet s2) { sRefSet_allElements (s1, el) { if (!sRefSet_isSameMember (s2, el)) { return -1; } } end_sRefSet_allElements; sRefSet_allElements (s2, el) { if (!sRefSet_isSameMember (s1, el)) { return 1; } } end_sRefSet_allElements; return 0; } bool sRefSet_equal (sRefSet s1, sRefSet s2) { sRefSet_allElements (s1, el) { if (!sRefSet_isSameMember (s2, el)) { return FALSE; } } end_sRefSet_allElements; sRefSet_allElements (s2, el) { if (!sRefSet_isSameMember (s1, el)) { return FALSE; } } end_sRefSet_allElements; return TRUE; } /*@only@*/ sRefSet sRefSet_undump (char **s) { char c; sRefSet sl = sRefSet_new (); while ((c = **s) != '#' && c != '@' && c != '$' && c != '&') { sl = sRefSet_insert (sl, sRef_undump (s)); if (**s == ',') { (*s)++; } } return sl; } /*@only@*/ cstring sRefSet_dump (sRefSet sl) { cstring st = cstring_undefined; bool first = TRUE; sRefSet_allElements (sl, el) { if (!first) { st = cstring_appendChar (st, ','); } else { first = FALSE; } st = cstring_concatFree (st, sRef_dump (el)); } end_sRefSet_allElements; return st; } void sRefSet_markImmutable (sRefSet s) { sRefSet_allElements (s, el) { sRef_markImmutable (el); } end_sRefSet_allElements; } splint-3.1.2.dfsg1/src/stateInfo.c0000644021234200000250000003225707653353207014355 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ # include "splintMacros.nf" # include "basic.h" # ifdef WIN32 /* ** Make Microsoft VC++ happy: its control checking produces too ** many spurious warnings. */ # pragma warning (disable:4715) # endif static /*@observer@*/ cstring stateAction_unparse (stateAction p_sa) /*@*/ ; void stateInfo_free (/*@only@*/ stateInfo a) { if (a != NULL) { fileloc_free (a->loc); sfree (a); } } /*@only@*/ stateInfo stateInfo_update (/*@only@*/ stateInfo old, stateInfo newinfo) /* ** returns an stateInfo with the same value as new. May reuse the ** storage of old. (i.e., same effect as copy, but more ** efficient.) */ { if (old == NULL) { DPRINTF (("Update state ==> %s", stateInfo_unparse (newinfo))); return stateInfo_copy (newinfo); } else if (newinfo == NULL) { stateInfo_free (old); return NULL; } else { if (fileloc_equal (old->loc, newinfo->loc) && old->action == newinfo->action /*@-abstractcompare@*/ && old->ref == newinfo->ref /*@=abstractcompare@*/) { /* ** Duplicate (change through alias most likely) ** don't add this info */ return old; } else { stateInfo snew = stateInfo_makeRefLoc (newinfo->ref, newinfo->loc, newinfo->action); llassert (snew->previous == NULL); snew->previous = old; DPRINTF (("Update state ==> %s", stateInfo_unparse (snew))); return snew; } } } static /*@observer@*/ stateInfo stateInfo_sort (/*@temp@*/ stateInfo stinfo) /* Sorts in reverse location order */ { DPRINTF (("Sorting: %s", stateInfo_unparse (stinfo))); if (stinfo == NULL || stinfo->previous == NULL) { return stinfo; } else { stateInfo snext = stateInfo_sort (stinfo->previous); stateInfo sfirst = snext; DPRINTF (("stinfo/sext: %s // %s", stateInfo_unparse (stinfo), stateInfo_unparse (snext))); llassert (snext != NULL); if (!fileloc_lessthan (stinfo->loc, snext->loc)) { /*@i2@*/ stinfo->previous = sfirst; /* spurious? */ DPRINTF (("Sorted ==> %s", stateInfo_unparse (stinfo))); /*@i2@*/ return stinfo; /* spurious? */ } else { while (snext != NULL && fileloc_lessthan (stinfo->loc, snext->loc)) { /* ** swap the order */ fileloc tloc = snext->loc; stateAction taction = snext->action; sRef tref = snext->ref; DPRINTF (("in while: stinfo/sext: %s // %s", stateInfo_unparse (stinfo), stateInfo_unparse (snext))); snext->loc = stinfo->loc; snext->action = stinfo->action; /*@-modobserver@*/ snext->ref = stinfo->ref; /* Doesn't actually modifie sfirst */ /*@=modobserver@*/ stinfo->loc = tloc; stinfo->action = taction; stinfo->ref = tref; /*@-mustfreeonly@*/ stinfo->previous = snext->previous; /*@=mustfreeonly@*/ snext = snext->previous; DPRINTF (("in while: stinfo/sext: %s // %s", stateInfo_unparse (stinfo), stateInfo_unparse (snext))); } DPRINTF (("Sorted ==> %s", stateInfo_unparse (sfirst))); /*@-compmempass@*/ return sfirst; /*@=compmempass@*/ } } } /*@only@*/ stateInfo stateInfo_updateLoc (/*@only@*/ stateInfo old, stateAction action, fileloc loc) { if (fileloc_isUndefined (loc)) { loc = fileloc_copy (g_currentloc); } if (old != NULL && fileloc_equal (old->loc, loc) && old->action == action) { /* ** Duplicate (change through alias most likely) ** don't add this info */ return old; } else { stateInfo snew = stateInfo_makeLoc (loc, action); llassert (snew->previous == NULL); snew->previous = old; DPRINTF (("Update state ==> %s", stateInfo_unparse (snew))); return snew; } } /*@only@*/ stateInfo stateInfo_updateRefLoc (/*@only@*/ stateInfo old, /*@exposed@*/ sRef ref, stateAction action, fileloc loc) { if (fileloc_isUndefined (loc)) { loc = fileloc_copy (g_currentloc); } if (old != NULL && fileloc_equal (old->loc, loc) && old->action == action /*@-abstractcompare*/ && old->ref == ref /*@=abstractcompare@*/) { /* ** Duplicate (change through alias most likely) ** don't add this info */ return old; } else { stateInfo snew = stateInfo_makeRefLoc (ref, loc, action); llassert (snew->previous == NULL); snew->previous = old; DPRINTF (("Update state ==> %s", stateInfo_unparse (snew))); return snew; } } /*@only@*/ stateInfo stateInfo_copy (stateInfo a) { if (a == NULL) { return NULL; } else { stateInfo ret = (stateInfo) dmalloc (sizeof (*ret)); ret->loc = fileloc_copy (a->loc); /*< should report bug without copy! >*/ ret->ref = a->ref; ret->action = a->action; ret->previous = stateInfo_copy (a->previous); return ret; } } /*@only@*/ /*@notnull@*/ stateInfo stateInfo_currentLoc (void) { return stateInfo_makeLoc (g_currentloc, SA_DECLARED); } /*@only@*/ /*@notnull@*/ stateInfo stateInfo_makeLoc (fileloc loc, stateAction action) { stateInfo ret = (stateInfo) dmalloc (sizeof (*ret)); if (fileloc_isUndefined (loc)) { ret->loc = fileloc_copy (g_currentloc); } else { ret->loc = fileloc_copy (loc); } ret->ref = sRef_undefined; ret->action = action; ret->previous = stateInfo_undefined; DPRINTF (("Make loc ==> %s", stateInfo_unparse (ret))); return ret; } /*@only@*/ /*@notnull@*/ stateInfo stateInfo_makeRefLoc (/*@exposed@*/ sRef ref, fileloc loc, stateAction action) /*@post:isnull result->previous@*/ { stateInfo ret = (stateInfo) dmalloc (sizeof (*ret)); if (fileloc_isUndefined (loc)) { ret->loc = fileloc_copy (g_currentloc); } else { ret->loc = fileloc_copy (loc); } ret->ref = ref; ret->action = action; ret->previous = stateInfo_undefined; return ret; } /*@only@*/ cstring stateInfo_unparse (stateInfo s) { cstring res = cstring_makeLiteral (""); while (stateInfo_isDefined (s)) { res = message ("%q%q: ", res, fileloc_unparse (s->loc)); if (sRef_isValid (s->ref)) { res = message ("%q through alias %q ", res, sRef_unparse (s->ref)); } res = message ("%q%s; ", res, stateAction_unparse (s->action)); s = s->previous; } return res; } fileloc stateInfo_getLoc (stateInfo info) { if (stateInfo_isDefined (info)) { return info->loc; } return fileloc_undefined; } stateAction stateAction_fromNState (nstate ns) { switch (ns) { case NS_ERROR: case NS_UNKNOWN: return SA_UNKNOWN; case NS_NOTNULL: case NS_MNOTNULL: return SA_BECOMESNONNULL; case NS_RELNULL: case NS_CONSTNULL: return SA_DECLARED; case NS_POSNULL: return SA_BECOMESPOSSIBLYNULL; case NS_DEFNULL: return SA_BECOMESNULL; case NS_ABSNULL: return SA_BECOMESPOSSIBLYNULL; } } stateAction stateAction_fromExkind (exkind ex) { switch (ex) { case XO_UNKNOWN: case XO_NORMAL: return SA_UNKNOWN; case XO_EXPOSED: return SA_EXPOSED; case XO_OBSERVER: return SA_OBSERVER; } BADBRANCH; /*@notreached@*/ return SA_UNKNOWN; } stateAction stateAction_fromAlkind (alkind ak) { switch (ak) { case AK_UNKNOWN: case AK_ERROR: return SA_UNKNOWN; case AK_ONLY: return SA_ONLY; case AK_IMPONLY: return SA_IMPONLY; case AK_KEEP: return SA_KEEP; case AK_KEPT: return SA_KEPT; case AK_TEMP: return SA_TEMP; case AK_IMPTEMP: return SA_IMPTEMP; case AK_SHARED: return SA_SHARED; case AK_UNIQUE: case AK_RETURNED: return SA_DECLARED; case AK_FRESH: return SA_FRESH; case AK_STACK: return SA_XSTACK; case AK_REFCOUNTED: return SA_REFCOUNTED; case AK_REFS: return SA_REFS; case AK_KILLREF: return SA_KILLREF; case AK_NEWREF: return SA_NEWREF; case AK_OWNED: return SA_OWNED; case AK_DEPENDENT: return SA_DEPENDENT; case AK_IMPDEPENDENT: return SA_IMPDEPENDENT; case AK_STATIC: return SA_STATIC; case AK_LOCAL: return SA_LOCAL; } BADBRANCH; /*@notreached@*/ return SA_UNKNOWN; } stateAction stateAction_fromSState (sstate ss) { switch (ss) { case SS_UNKNOWN: return SA_DECLARED; case SS_UNUSEABLE: return SA_KILLED; case SS_UNDEFINED: return SA_UNDEFINED; case SS_MUNDEFINED: return SA_MUNDEFINED; case SS_ALLOCATED: return SA_ALLOCATED; case SS_PDEFINED: return SA_PDEFINED; case SS_DEFINED: return SA_DEFINED; case SS_PARTIAL: return SA_PDEFINED; case SS_DEAD: return SA_RELEASED; case SS_HOFFA: return SA_PKILLED; case SS_SPECIAL: return SA_DECLARED; case SS_RELDEF: return SA_DECLARED; case SS_FIXED: case SS_UNDEFGLOB: case SS_KILLED: case SS_UNDEFKILLED: case SS_LAST: llbug (message ("Unexpected sstate: %s", sstate_unparse (ss))); /*@notreached@*/ return SA_UNKNOWN; } } static /*@observer@*/ cstring stateAction_unparse (stateAction sa) { switch (sa) { case SA_UNKNOWN: return cstring_makeLiteralTemp ("changed "); case SA_CHANGED: return cstring_makeLiteralTemp ("changed"); case SA_CREATED: return cstring_makeLiteralTemp ("created"); case SA_DECLARED: return cstring_makeLiteralTemp ("declared"); case SA_DEFINED: return cstring_makeLiteralTemp ("defined"); case SA_PDEFINED: return cstring_makeLiteralTemp ("partially defined"); case SA_RELEASED: return cstring_makeLiteralTemp ("released"); case SA_ALLOCATED: return cstring_makeLiteralTemp ("allocated"); case SA_KILLED: return cstring_makeLiteralTemp ("released"); case SA_PKILLED: return cstring_makeLiteralTemp ("possibly released"); case SA_MERGED: return cstring_makeLiteralTemp ("merged"); case SA_UNDEFINED: return cstring_makeLiteralTemp ("becomes undefined"); case SA_MUNDEFINED: return cstring_makeLiteralTemp ("possibly undefined"); case SA_SHARED: return cstring_makeLiteralTemp ("becomes shared"); case SA_ONLY: return cstring_makeLiteralTemp ("becomes only"); case SA_IMPONLY: return cstring_makeLiteralTemp ("becomes implicitly only"); case SA_OWNED: return cstring_makeLiteralTemp ("becomes owned"); case SA_DEPENDENT: return cstring_makeLiteralTemp ("becomes dependent"); case SA_IMPDEPENDENT: return cstring_makeLiteralTemp ("becomes implicitly dependent"); case SA_KEPT: return cstring_makeLiteralTemp ("becomes kept"); case SA_KEEP: return cstring_makeLiteralTemp ("becomes keep"); case SA_FRESH: return cstring_makeLiteralTemp ("becomes fresh"); case SA_TEMP: return cstring_makeLiteralTemp ("becomes temp"); case SA_IMPTEMP: return cstring_makeLiteralTemp ("becomes implicitly temp"); case SA_XSTACK: return cstring_makeLiteralTemp ("becomes stack-allocated storage"); case SA_STATIC: return cstring_makeLiteralTemp ("becomes static"); case SA_LOCAL: return cstring_makeLiteralTemp ("becomes local"); case SA_REFCOUNTED: return cstring_makeLiteralTemp ("becomes refcounted"); case SA_REFS: return cstring_makeLiteralTemp ("becomes refs"); case SA_NEWREF: return cstring_makeLiteralTemp ("becomes newref"); case SA_KILLREF: return cstring_makeLiteralTemp ("becomes killref"); case SA_OBSERVER: return cstring_makeLiteralTemp ("becomes observer"); case SA_EXPOSED: return cstring_makeLiteralTemp ("becomes exposed"); case SA_BECOMESNULL: return cstring_makeLiteralTemp ("becomes null"); case SA_BECOMESNONNULL: return cstring_makeLiteralTemp ("becomes non-null"); case SA_BECOMESPOSSIBLYNULL: return cstring_makeLiteralTemp ("becomes possibly null"); } DPRINTF (("Bad state action: %d", sa)); BADBRANCH; } void stateInfo_display (stateInfo s, cstring sname) { bool showdeep = context_flagOn (FLG_SHOWDEEPHISTORY, g_currentloc); s = stateInfo_sort (s); while (stateInfo_isDefined (s)) { cstring msg = message ("%s%s", sname, stateAction_unparse (s->action)); if (sRef_isValid (s->ref)) { msg = message ("%q (through alias %q)", msg, sRef_unparse (s->ref)); } llgenindentmsg (msg, s->loc); if (!showdeep) { break; } s = s->previous; } cstring_free (sname); } splint-3.1.2.dfsg1/src/stateCombinationTable.c0000644021234200000250000001212407646432516016666 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** stateCombinationTable.c ** ** A stateCombinationTable is a mapping from keys to value tables. */ # include "splintMacros.nf" # include "basic.h" /* ** (key, value, value) => value */ static stateEntry stateEntry_create (void) { stateEntry res = (stateEntry) dmalloc (sizeof (*res)); res->value = 0; res->msg = cstring_undefined; return res; } static cstring stateEntry_unparse (stateEntry e) { if (cstring_isDefined (e->msg)) { return message ("[%d: %s]", e->value, e->msg); } else { return message ("%d", e->value); } } stateCombinationTable stateCombinationTable_create (int size) { stateCombinationTable res = (stateCombinationTable) dmalloc (sizeof (*res)); int i; res->size = size; res->rows = (stateRow *) dmalloc (sizeof (*(res->rows)) * size); for (i = 0; i < size; i++) { int j; res->rows[i] = (stateRow) dmalloc (sizeof (*res->rows[i])); res->rows[i]->size = size; /* Rows have an extra entry (for lose ref transfers) */ res->rows[i]->entries = (stateEntry *) dmalloc (sizeof (*res->rows[i]->entries) * (size + 1)); for (j = 0; j < size + 1; j++) { stateEntry s = stateEntry_create (); /* Default transfer changes no state and is permitted without error. */ s->value = i; llassert (cstring_isUndefined (s->msg)); /*@-usedef@*/ res->rows[i]->entries[j] = s; /*@=usedef@*/ } } /*@-compmempass@*/ /*@-compdef@*/ return res; /*@=compmempass@*/ /*@=compdef@*/ } cstring stateCombinationTable_unparse (stateCombinationTable t) { int i; cstring res = cstring_newEmpty (); for (i = 0; i < t->size; i++) { int j; for (j = 0; j < (t->size + 1); j++) { if (j == 0) { res = message ("%q[%d: ] %q", res, i, stateEntry_unparse (t->rows[i]->entries[j])); } else { res = message ("%q . %q", res, stateEntry_unparse (t->rows[i]->entries[j])); } } res = cstring_appendChar (res, '\n'); } return res; } static void stateEntry_free (/*@only@*/ stateEntry s) { cstring_free (s->msg); sfree (s); } static void stateRow_free (/*@only@*/ stateRow r) { int i; for (i = 0; i < r->size + 1; i++) { stateEntry_free (r->entries[i]); } sfree (r->entries); sfree (r); } void stateCombinationTable_free (/*@only@*/ stateCombinationTable t) { int i; for (i = 0; i < t->size; i++) { stateRow_free (t->rows[i]); } sfree (t->rows); sfree (t); } static /*@exposed@*/ stateEntry stateCombintationTable_getEntry (stateCombinationTable h, int rkey, int ckey) { llassert (rkey < h->size); llassert (ckey < h->size + 1); return h->rows[rkey]->entries[ckey]; } void stateCombinationTable_set (stateCombinationTable h, int p_from, int p_to, int value, cstring msg) { stateEntry entry = stateCombintationTable_getEntry (h, p_from, p_to); llassert (entry != NULL); entry->value = value; llassert (cstring_isUndefined (entry->msg)); entry->msg = msg; DPRINTF (("Set entry: [%p] %d / %d => %s", entry, p_from, p_to, cstring_toCharsSafe (msg))); } /* ** Like set, but may already have value. ** (Only different is error checking.) */ void stateCombinationTable_update (stateCombinationTable h, int p_from, int p_to, int value, cstring msg) { stateEntry entry = stateCombintationTable_getEntry (h, p_from, p_to); llassert (entry != NULL); entry->value = value; cstring_free (entry->msg); entry->msg = msg; DPRINTF (("Update entry: [%p] %d / %d => %s", entry, p_from, p_to, cstring_toCharsSafe (msg))); } int stateCombinationTable_lookup (stateCombinationTable h, int p_from, int p_to, /*@out@*/ ob_cstring *msg) { stateEntry entry; llassert (p_from != stateValue_error); llassert (p_to != stateValue_error); entry = stateCombintationTable_getEntry (h, p_from, p_to); llassert (entry != NULL); *msg = entry->msg; return entry->value; } extern int stateCombinationTable_lookupLoseReference (stateCombinationTable h, int from, /*@out@*/ /*@observer@*/ cstring *msg) { return stateCombinationTable_lookup (h, from, h->size, msg); } splint-3.1.2.dfsg1/src/metaStateTable.c0000644021234200000250000000315007630461221015275 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** metaStateTable.c ** Based on genericTable.c */ # include "splintMacros.nf" # include "basic.h" # include "randomNumbers.h" extern void metaStateTable_insert (metaStateTable h, /*@only@*/ cstring key, /*@only@*/ metaStateInfo metaState) { llassert (metaStateInfo_isDefined (metaState)); genericTable_insert ((genericTable) h, key, (void *) metaState); } cstring metaStateTable_unparse (metaStateTable h) { cstring res = cstring_newEmpty (); metaStateTable_elements (h, key, el) { res = cstring_concatFree (res, message ("%s: %x\n", key, metaStateInfo_unparse (el))); } end_metaStateTable_elements ; return res; } splint-3.1.2.dfsg1/src/metaStateInfo.c0000644021234200000250000001343507630461221015150 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** metaStateInfo.c */ # include "splintMacros.nf" # include "basic.h" /*@notnull@*/ metaStateInfo metaStateInfo_create (cstring name, cstringList valueNames, mtContextNode context, stateCombinationTable sctable, stateCombinationTable mergetable, fileloc loc) { metaStateInfo res = (metaStateInfo) dmalloc (sizeof (*res)); int i; res->name = name; res->valueNames = valueNames; res->context = context; res->sctable = sctable; res->mergetable = mergetable; res->loc = loc; for (i = 0; i < MTC_NUMCONTEXTS; i++) { res->defaultValue[i] = stateValue_error; } llassert (stateCombinationTable_size (res->sctable) == cstringList_size (res->valueNames)); return res; } void metaStateInfo_free (/*@only@*/ metaStateInfo msinfo) { if (metaStateInfo_isDefined (msinfo)) { cstring_free (msinfo->name); cstringList_free (msinfo->valueNames); stateCombinationTable_free (msinfo->sctable); stateCombinationTable_free (msinfo->mergetable); fileloc_free (msinfo->loc); mtContextNode_free (msinfo->context); /* evans 2002-01-03 */ sfree (msinfo); } } cstring metaStateInfo_unparse (metaStateInfo info) { llassert (metaStateInfo_isDefined (info)); return message ("%s: %q\n%q", info->name, cstringList_unparse (info->valueNames), stateCombinationTable_unparse (info->sctable)); } cstring metaStateInfo_unparseValue (metaStateInfo info, int value) { llassert (metaStateInfo_isDefined (info)); DPRINTF (("unparse value: %s / %d", metaStateInfo_unparse (info), value)); if (value < 0) { llassert (value == stateValue_error); return cstring_makeLiteralTemp ("error"); } llassert (value < cstringList_size (info->valueNames)); return cstringList_get (info->valueNames, value); } /*@observer@*/ mtContextNode metaStateInfo_getContext (metaStateInfo info) { llassert (metaStateInfo_isDefined (info)); return info->context; } /*@observer@*/ cstring metaStateInfo_getName (metaStateInfo info) { llassert (metaStateInfo_isDefined (info)); return info->name; } /*@observer@*/ fileloc metaStateInfo_getLoc (metaStateInfo info) { llassert (metaStateInfo_isDefined (info)); return info->loc; } extern /*@exposed@*/ stateCombinationTable metaStateInfo_getTransferTable (metaStateInfo info) /*@*/ { llassert (metaStateInfo_isDefined (info)); return info->sctable; } extern /*@exposed@*/ stateCombinationTable metaStateInfo_getMergeTable (metaStateInfo info) /*@*/ { llassert (metaStateInfo_isDefined (info)); return info->mergetable; } /*@+enumindex@*/ /* allow context kinds to reference array */ extern int metaStateInfo_getDefaultValueContext (metaStateInfo info, mtContextKind context) { llassert (metaStateInfo_isDefined (info)); return info->defaultValue [context]; } extern int metaStateInfo_getDefaultValue (metaStateInfo info, sRef s) { llassert (metaStateInfo_isDefined (info)); if (sRef_isParam (s) && (info->defaultValue [MTC_PARAM] != stateValue_error)) { return info->defaultValue [MTC_PARAM]; } else if (sRef_isResult (s) && (info->defaultValue [MTC_RESULT] != stateValue_error)) { return info->defaultValue [MTC_RESULT]; } else if (sRef_isConst (s) && (info->defaultValue [MTC_LITERAL] != stateValue_error)) { return info->defaultValue [MTC_LITERAL]; } else { llassert (mtContextNode_matchesRef (metaStateInfo_getContext (info), s)); return info->defaultValue [MTC_REFERENCE]; } } extern int metaStateInfo_getDefaultGlobalValue (metaStateInfo info) { llassert (metaStateInfo_isDefined (info)); return info->defaultValue [MTC_REFERENCE]; } void metaStateInfo_setDefaultValueContext (metaStateInfo info, mtContextKind context, int val) { llassert (metaStateInfo_isDefined (info)); /*@-type@*/ llassert (context >= 0 && context < MTC_NUMCONTEXTS); /*@=type@*/ llassert (metaStateInfo_getDefaultValueContext (info, context) == stateValue_error); info->defaultValue [context] = val; } /*@=enumindex@*/ \ void metaStateInfo_setDefaultRefValue (metaStateInfo info, int val) { metaStateInfo_setDefaultValueContext (info, MTC_REFERENCE, val); } void metaStateInfo_setDefaultResultValue (metaStateInfo info, int val) { metaStateInfo_setDefaultValueContext (info, MTC_RESULT, val); } void metaStateInfo_setDefaultParamValue (metaStateInfo info, int val) { metaStateInfo_setDefaultValueContext (info, MTC_PARAM, val); } int metaStateInfo_getDefaultRefValue (metaStateInfo info) { return metaStateInfo_getDefaultValueContext (info, MTC_REFERENCE); } int metaStateInfo_getDefaultResultValue (metaStateInfo info) { return metaStateInfo_getDefaultValueContext (info, MTC_RESULT); } int metaStateInfo_getDefaultParamValue (metaStateInfo info) { return metaStateInfo_getDefaultValueContext (info, MTC_PARAM); } splint-3.1.2.dfsg1/src/annotationTable.c0000644021234200000250000000322507630461220015522 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** annotationTable.c ** Based on genericTable.c */ # include "splintMacros.nf" # include "basic.h" # include "randomNumbers.h" cstring annotationTable_unparse (annotationTable h) { cstring res = cstring_newEmpty (); annotationTable_elements (h, key, el) { res = cstring_concatFree (res, message ("%s: %s\n", key, annotationInfo_unparse (el))); } end_annotationTable_elements ; return res; } void annotationTable_insert (annotationTable h, annotationInfo annotation) { cstring name = cstring_copy (annotationInfo_getName (annotation)); llassert (annotationInfo_isDefined (annotation)); genericTable_insert ((genericTable) h, name, (void *) annotation); } splint-3.1.2.dfsg1/src/annotationInfo.c0000644021234200000250000001114407630461220015365 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** annotationInfo.c */ # include "splintMacros.nf" # include "basic.h" annotationInfo annotationInfo_create (cstring name, metaStateInfo state, mtContextNode context, int value, fileloc loc) { annotationInfo res = (annotationInfo) dmalloc (sizeof (*res)); res->name = name; res->state = state; res->context = context; res->value = value; res->loc = loc; return res; } void annotationInfo_free (annotationInfo a) { if (annotationInfo_isDefined (a)) { cstring_free (a->name); fileloc_free (a->loc); mtContextNode_free (a->context); /* evans 2002-01-03 */ sfree (a); } } cstring annotationInfo_getName (annotationInfo a) { llassert (annotationInfo_isDefined (a)); return a->name; } /*@observer@*/ cstring annotationInfo_unparse (annotationInfo a) { return annotationInfo_getName (a); } /*@observer@*/ metaStateInfo annotationInfo_getState (annotationInfo a) /*@*/ { llassert (annotationInfo_isDefined (a)); return a->state; } /*@observer@*/ fileloc annotationInfo_getLoc (annotationInfo a) /*@*/ { llassert (annotationInfo_isDefined (a)); return a->loc; } int annotationInfo_getValue (annotationInfo a) /*@*/ { llassert (annotationInfo_isDefined (a)); return a->value; } bool annotationInfo_matchesContext (annotationInfo a, uentry ue) { /* ** Returns true iff the annotation context matches the uentry. */ mtContextNode mcontext; llassert (annotationInfo_isDefined (a)); mcontext = a->context; if (mtContextNode_matchesEntry (mcontext, ue)) { /* Matches annotation context, must also match meta state context. */ metaStateInfo minfo = a->state; if (mtContextNode_matchesEntry (metaStateInfo_getContext (minfo), ue)) { return TRUE; } else { return FALSE; } } else { return FALSE; } } bool annotationInfo_matchesContextRef (annotationInfo a, sRef sr) { /* ** Returns true iff the annotation context matches the uentry. */ mtContextNode mcontext; llassert (annotationInfo_isDefined (a)); mcontext = a->context; if (mtContextNode_matchesRef (mcontext, sr)) { /* Matches annotation context, must also match meta state context. */ metaStateInfo minfo = a->state; if (mtContextNode_matchesRef (metaStateInfo_getContext (minfo), sr)) { return TRUE; } else { return FALSE; } } else { return FALSE; } } cstring annotationInfo_dump (annotationInfo a) { llassert (annotationInfo_isDefined (a)); return a->name; } /*@observer@*/ annotationInfo annotationInfo_undump (char **s) { cstring mname = reader_readUntil (s, '.'); annotationInfo a; llassert (cstring_isDefined (mname)); a = context_lookupAnnotation (mname); if (annotationInfo_isUndefined (a)) { llfatalerrorLoc (message ("Library uses undefined annotation %s. Must use same -mts flags as when library was created.", mname)); } else { cstring_free (mname); return a; } BADBRANCHRET (annotationInfo_undefined); } void annotationInfo_showContextRefError (annotationInfo a, sRef sr) { mtContextNode mcontext; llassert (!annotationInfo_matchesContextRef (a, sr)); llassert (annotationInfo_isDefined (a)); mcontext = a->context; if (mtContextNode_matchesRef (mcontext, sr)) { /* Matches annotation context, must also match meta state context. */ metaStateInfo minfo = a->state; if (mtContextNode_matchesRef (metaStateInfo_getContext (minfo), sr)) { BADBRANCH; } else { mtContextNode_showRefError (metaStateInfo_getContext (minfo), sr); } } else { mtContextNode_showRefError (mcontext, sr); } } splint-3.1.2.dfsg1/src/mttok.c0000644021234200000250000001011207630461221013530 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mttok.c - based on lltok.c */ # include "splintMacros.nf" # include "basic.h" # include "mtgrammar.h" cstring mttok_unparse (mttok tok) { char *lit; switch (tok->tok) { case EOF: lit = ""; break; case MT_STATE: lit = "attribute"; break; case MT_GLOBAL: lit = "global"; break; case MT_CONTEXT: lit = "context"; break; case MT_ONEOF: lit = "oneof"; break; case MT_AS: lit = "as"; break; case MT_END: lit = "end"; break; case MT_DEFAULTS: lit = "defaults"; break; case MT_DEFAULT: lit = "default"; break; case MT_REFERENCE: lit = "reference"; break; case MT_PARAMETER: lit = "parameter"; break; case MT_RESULT: lit = "result"; break; case MT_CLAUSE: lit = "clause"; break; case MT_LITERAL: lit = "literal"; break; case MT_NULL: lit = "null"; break; case MT_ANNOTATIONS: lit = "annotations"; break; case MT_ARROW: lit = "==>"; break; case MT_MERGE: lit = "merge"; break; case MT_TRANSFERS: lit = "transfers"; break; case MT_PRECONDITIONS: lit = "preconditions"; break; case MT_POSTCONDITIONS: lit = "postconditions"; break; case MT_ERROR: lit = "error"; break; case MT_PLUS: lit = "+"; break; case MT_STAR: lit = "*"; break; case MT_LPAREN: lit = "("; break; case MT_RPAREN: lit = ")"; break; case MT_LBRACE: lit = "{"; break; case MT_RBRACE: lit = "}"; break; case MT_LBRACKET: lit = "["; break; case MT_RBRACKET: lit = "]"; break; case MT_COMMA: lit =","; break; case MT_BAR: lit = "|"; break; case MT_CHAR: lit = "char"; break; case MT_INT: lit = "int"; break; case MT_FLOAT: lit = "float"; break; case MT_DOUBLE: lit = "double"; break; case MT_VOID: lit = "void"; break; case MT_ANYTYPE: lit = "anytype"; break; case MT_INTEGRALTYPE: lit = "integraltype"; break; case MT_UNSIGNEDINTEGRALTYPE: lit = "unsignedintegraltype"; break; case MT_SIGNEDINTEGRALTYPE: lit = "signedintegraltype"; break; case MT_CONST: lit = "const"; break; case MT_VOLATILE: lit = "volatile"; break; case MT_IDENT: return (message ("identifier: <%s>", tok->text)); case MT_STRINGLIT: return (message ("literal: <%s>", tok->text)); case MT_BADTOK: lit = ""; break; default: DPRINTF (("Bad token: [%d]", tok->tok)); BADBRANCH; /* BADDEFAULT; */ } return cstring_makeLiteral (lit); } mttok mttok_create (int tok, cstring text, fileloc loc) { mttok l = (mttok) dmalloc (sizeof (*l)); l->tok = tok; l->text = text; l->loc = loc; return (l); } fileloc mttok_stealLoc (mttok t) { fileloc res = t->loc; t->loc = fileloc_undefined; return res; } void mttok_free (mttok t) { fileloc_free (t->loc); cstring_free (t->text); sfree (t); } bool mttok_isError (mttok t) { return ((t)->tok == MT_ERROR); } bool mttok_isIdentifier (mttok t) { return ((t)->tok == MT_IDENT); } splint-3.1.2.dfsg1/src/mtDeclarationNode.c0000644021234200000250000004506707646432515016022 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtDeclarationNode.c */ # include "splintMacros.nf" # include "basic.h" extern mtDeclarationNode mtDeclarationNode_create (mttok name, mtDeclarationPieces pieces) /*@*/ { mtDeclarationNode res = (mtDeclarationNode) dmalloc (sizeof (*res)); res->name = mttok_getText (name); res->loc = mttok_stealLoc (name); res->pieces = pieces; mttok_free (name); return res; } extern cstring mtDeclarationNode_unparse (mtDeclarationNode node) /*@*/ { return message ("state %s %q", node->name, mtDeclarationPieces_unparse (node->pieces)); } extern void mtDeclarationNode_process (mtDeclarationNode node, bool isglobal) { int i; int j; mtDeclarationPieces pieces; mtDeclarationPiece mtp; mtContextNode mtcontext; stateCombinationTable tsc; stateCombinationTable tmerge; cstringList mvals; metaStateInfo msinfo; int nvalues; cstring defaultMergeMessage = cstring_makeLiteralTemp ("Incompatible state merge (default behavior)"); pieces = node->pieces; /* ** First, we need to find the values piece. */ mtp = mtDeclarationPieces_findPiece (pieces, MTP_VALUES); if (mtDeclarationPiece_isUndefined (mtp)) { voptgenerror (FLG_SYNTAX, message ("Metastate declaration missing values clause: %s", mtDeclarationNode_getName (node)), mtDeclarationNode_getLoc (node)); return; } else { mtValuesNode mtv = mtDeclarationPiece_getValues (mtp); mvals = mtValuesNode_getValues (mtv); } /*@-usedef@*/ /* splint should figure this out... */ nvalues = cstringList_size (mvals); /*@=usedef@*/ mtp = mtDeclarationPieces_findPiece (pieces, MTP_CONTEXT); if (mtDeclarationPiece_isUndefined (mtp)) { ; /* No context, assume anywhere is okay. */ mtcontext = mtContextNode_createAny (); } else { mtcontext = mtDeclarationPiece_stealContext (mtp); } if (isglobal) { /* ** For global state, instead of a transfers piece, we have constraints. */ mtp = mtDeclarationPieces_findPiece (pieces, MTP_TRANSFERS); if (!mtDeclarationPiece_isUndefined (mtp)) { voptgenerror (FLG_SYNTAX, message ("Global state declaration uses transfers clause. Should use preconditions and postconsitions clauses instead: %s", mtDeclarationNode_getName (node)), mtDeclarationNode_getLoc (node)); mtContextNode_free (mtcontext); return; } mtp = mtDeclarationPieces_findPiece (pieces, MTP_PRECONDITIONS); if (mtDeclarationPiece_isUndefined (mtp)) { voptgenerror (FLG_SYNTAX, message ("Metastate declaration missing preconditions clause: %s", mtDeclarationNode_getName (node)), mtDeclarationNode_getLoc (node)); mtContextNode_free (mtcontext); return; } else { mtTransferClauseList mtransfers = mtDeclarationPiece_getPreconditions (mtp); tsc = stateCombinationTable_create (nvalues); mtTransferClauseList_elements (mtransfers, transfer) { cstring tfrom = mtTransferClause_getFrom (transfer); cstring tto = mtTransferClause_getTo (transfer); mtTransferAction taction = mtTransferClause_getAction (transfer); cstring vname = mtTransferAction_getValue (taction); int fromindex; int toindex; int vindex; DPRINTF (("Transfer: %s", mtTransferClause_unparse (transfer))); if (cstringList_contains (mvals, tfrom)) { fromindex = cstringList_getIndex (mvals, tfrom); } else { voptgenerror (FLG_SYNTAX, message ("Precondition clause uses unrecognized caller value %s: %q", tfrom, mtTransferClause_unparse (transfer)), mtTransferClause_getLoc (transfer)); continue; } if (cstringList_contains (mvals, tto)) { toindex = cstringList_getIndex (mvals, tto); } else { voptgenerror (FLG_SYNTAX, message ("Precondition clause uses unrecognized constraint value %s: %q", tto, mtTransferClause_unparse (transfer)), mtTransferClause_getLoc (transfer)); continue; } if (mtTransferAction_isError (taction)) { vindex = metaState_error; } else { if (cstringList_contains (mvals, vname)) { vindex = cstringList_getIndex (mvals, vname); } else { voptgenerror (FLG_SYNTAX, message ("Precondition clause uses unrecognized result state %s: %q", vname, mtTransferClause_unparse (transfer)), mtTransferClause_getLoc (transfer)); continue; } } if (mtTransferAction_isError (taction)) { stateCombinationTable_set (tsc, fromindex, toindex, vindex, cstring_copy (mtTransferAction_getMessage (taction))); } else { stateCombinationTable_set (tsc, fromindex, toindex, vindex, cstring_undefined); } } end_mtTransferClauseList_elements ; } } else { mtp = mtDeclarationPieces_findPiece (pieces, MTP_PRECONDITIONS); if (!mtDeclarationPiece_isUndefined (mtp)) { voptgenerror (FLG_SYNTAX, message ("Non-global state declaration uses preconditions clause. " "Should use transfers clause instead: %s", mtDeclarationNode_getName (node)), mtDeclarationNode_getLoc (node)); mtContextNode_free (mtcontext); return; } mtp = mtDeclarationPieces_findPiece (pieces, MTP_POSTCONDITIONS); if (!mtDeclarationPiece_isUndefined (mtp)) { voptgenerror (FLG_SYNTAX, message ("Non-global state declaration uses postconditions clause. " "Should use transfers clause instead: %s", mtDeclarationNode_getName (node)), mtDeclarationNode_getLoc (node)); mtContextNode_free (mtcontext); return; } mtp = mtDeclarationPieces_findPiece (pieces, MTP_TRANSFERS); if (mtDeclarationPiece_isUndefined (mtp)) { voptgenerror (FLG_SYNTAX, message ("Metastate declaration missing transfers clause: %s", mtDeclarationNode_getName (node)), mtDeclarationNode_getLoc (node)); mtContextNode_free (mtcontext); return; } else { mtTransferClauseList mtransfers = mtDeclarationPiece_getTransfers (mtp); tsc = stateCombinationTable_create (nvalues); mtTransferClauseList_elements (mtransfers, transfer) { cstring tfrom = mtTransferClause_getFrom (transfer); cstring tto = mtTransferClause_getTo (transfer); mtTransferAction taction = mtTransferClause_getAction (transfer); cstring vname = mtTransferAction_getValue (taction); int fromindex; int toindex; int vindex; DPRINTF (("Transfer: %s", mtTransferClause_unparse (transfer))); if (cstringList_contains (mvals, tfrom)) { fromindex = cstringList_getIndex (mvals, tfrom); } else { voptgenerror (FLG_SYNTAX, message ("Transfer clause uses unrecognized from value %s: %q", tfrom, mtTransferClause_unparse (transfer)), mtTransferClause_getLoc (transfer)); continue; } if (cstringList_contains (mvals, tto)) { toindex = cstringList_getIndex (mvals, tto); } else { voptgenerror (FLG_SYNTAX, message ("Transfer clause uses unrecognized to value %s: %q", tto, mtTransferClause_unparse (transfer)), mtTransferClause_getLoc (transfer)); continue; } if (mtTransferAction_isError (taction)) { vindex = metaState_error; } else { if (cstringList_contains (mvals, vname)) { vindex = cstringList_getIndex (mvals, vname); } else { voptgenerror (FLG_SYNTAX, message ("Transfer clause uses unrecognized result state %s: %q", vname, mtTransferClause_unparse (transfer)), mtTransferClause_getLoc (transfer)); continue; } } if (mtTransferAction_isError (taction)) { stateCombinationTable_set (tsc, fromindex, toindex, vindex, cstring_copy (mtTransferAction_getMessage (taction))); } else { stateCombinationTable_set (tsc, fromindex, toindex, vindex, cstring_undefined); } } end_mtTransferClauseList_elements ; } } mtp = mtDeclarationPieces_findPiece (pieces, MTP_LOSERS); if (mtDeclarationPiece_isDefined (mtp)) { mtLoseReferenceList mlosers = mtDeclarationPiece_getLosers (mtp); mtLoseReferenceList_elements (mlosers, loseref) { cstring tfrom = mtLoseReference_getFrom (loseref); mtTransferAction taction = mtLoseReference_getAction (loseref); int fromindex; /* Losing reference is represented by transfer to nvalues */ int toindex = nvalues; int vindex = metaState_error; llassert (mtTransferAction_isError (taction)); if (cstringList_contains (mvals, tfrom)) { fromindex = cstringList_getIndex (mvals, tfrom); } else { voptgenerror (FLG_SYNTAX, message ("Lose reference uses unrecognized from value %s: %q", tfrom, mtLoseReference_unparse (loseref)), mtLoseReference_getLoc (loseref)); continue; } /*@-usedef@*/ stateCombinationTable_set (tsc, fromindex, toindex, vindex, cstring_copy (mtTransferAction_getMessage (taction))); /*@=usedef@*/ } end_mtLoseReferenceList_elements ; } tmerge = stateCombinationTable_create (nvalues); /* Default merge is to make all incompatible mergers errors. */ for (i = 0; i < nvalues; i++) { for (j = 0; j < nvalues; j++) { if (i != j) { stateCombinationTable_set (tmerge, i, j, metaState_error, cstring_copy (defaultMergeMessage)); } } } mtp = mtDeclarationPieces_findPiece (pieces, MTP_MERGE); if (mtDeclarationPiece_isDefined (mtp)) { mtMergeNode mtmerge = mtDeclarationPiece_getMerge (mtp); mtMergeClauseList mclauses = mtMergeNode_getClauses (mtmerge); DPRINTF (("Merge node: %s", mtMergeNode_unparse (mtmerge))); mtMergeClauseList_elements (mclauses, merge) { mtMergeItem item1 = mtMergeClause_getItem1 (merge); mtMergeItem item2 = mtMergeClause_getItem2 (merge); mtTransferAction taction = mtMergeClause_getAction (merge); int low1index, high1index; int low2index, high2index; int vindex; DPRINTF (("Merge %s X %s => %s", mtMergeItem_unparse (item1), mtMergeItem_unparse (item2), mtTransferAction_unparse (taction))); if (!mtMergeItem_isStar (item1)) { if (cstringList_contains (mvals, mtMergeItem_getValue (item1))) { low1index = cstringList_getIndex (mvals, mtMergeItem_getValue (item1)); high1index = low1index; } else { voptgenerror (FLG_SYNTAX, message ("Merge clause uses unrecognized first value %s: %q", mtMergeItem_getValue (item1), mtMergeClause_unparse (merge)), mtMergeClause_getLoc (merge)); continue; } } else { low1index = 0; high1index = nvalues - 1; } if (!mtMergeItem_isStar (item2)) { if (cstringList_contains (mvals, mtMergeItem_getValue (item2))) { low2index = cstringList_getIndex (mvals, mtMergeItem_getValue (item2)); high2index = low2index; } else { voptgenerror (FLG_SYNTAX, message ("Merge clause uses unrecognized second value %s: %q", mtMergeItem_getValue (item2), mtMergeClause_unparse (merge)), mtMergeItem_getLoc (item2)); continue; } } else { low2index = 0; high2index = nvalues - 1; } if (mtTransferAction_isError (taction)) { vindex = metaState_error; } else { cstring vname = mtTransferAction_getValue (taction); if (cstringList_contains (mvals, vname)) { vindex = cstringList_getIndex (mvals, vname); } else { voptgenerror (FLG_SYNTAX, message ("Merge clause uses unrecognized result state %s: %q", vname, mtMergeClause_unparse (merge)), mtTransferAction_getLoc (taction)); continue; } } for (i = low1index; i <= high1index; i++) { for (j = low2index; j <= high2index; j++) { /* Need to add checks for multiple definitions! */ if (mtTransferAction_isError (taction)) { stateCombinationTable_update (tmerge, i, j, vindex, cstring_copy (mtTransferAction_getMessage (taction))); } else { stateCombinationTable_update (tmerge, i, j, vindex, cstring_undefined); } } } /* ** Unless otherwise indicated, merging is symmetric: */ for (i = low1index; i <= high1index; i++) { for (j = low2index; j <= high2index; j++) { cstring msg; if (stateCombinationTable_lookup (tmerge, j, i, &msg) == metaState_error) { if (cstring_equal (msg, defaultMergeMessage)) { /* Override the default action */ if (mtTransferAction_isError (taction)) { stateCombinationTable_update (tmerge, j, i, vindex, cstring_copy (mtTransferAction_getMessage (taction))); } else { stateCombinationTable_update (tmerge, j, i, vindex, cstring_undefined); } } } } } } end_mtMergeClauseList_elements ; } msinfo = metaStateInfo_create (cstring_copy (mtDeclarationNode_getName (node)), cstringList_copy (mvals), mtcontext, /*@-usedef@*/ tsc, /*@=usedef@*/ tmerge, fileloc_copy (mtDeclarationNode_getLoc (node))); mtp = mtDeclarationPieces_findPiece (pieces, MTP_ANNOTATIONS); if (mtDeclarationPiece_isDefined (mtp)) { mtAnnotationsNode mtannots = mtDeclarationPiece_getAnnotations (mtp); mtAnnotationList mtalist = mtAnnotationsNode_getAnnotations (mtannots); DPRINTF (("Has annotations: %s", mtAnnotationList_unparse (mtalist))); mtAnnotationList_elements (mtalist, annot) { cstring aname = mtAnnotationDecl_getName (annot); cstring avalue = mtAnnotationDecl_getValue (annot); DPRINTF (("Process annotation: %s", mtAnnotationDecl_unparse (annot))); if (cstringList_contains (mvals, avalue)) { int vindex = cstringList_getIndex (mvals, avalue); mtContextNode acontext = mtAnnotationDecl_stealContext (annot); context_addAnnotation (annotationInfo_create (cstring_copy (aname), msinfo, acontext, vindex, fileloc_copy (mtAnnotationDecl_getLoc (annot)))); } else { voptgenerror (FLG_SYNTAX, message ("Annotation declaration uses unrecognized value name %s: %q", avalue, mtAnnotationDecl_unparse (annot)), mtAnnotationDecl_getLoc (annot)); } } end_mtAnnotationList_elements ; } mtp = mtDeclarationPieces_findPiece (pieces, MTP_DEFAULTS); if (mtDeclarationPiece_isDefined (mtp)) { mtDefaultsNode mdn = mtDeclarationPiece_getDefaults (mtp); mtDefaultsDeclList mdecls = mtDefaultsNode_getDecls (mdn); llassert (!isglobal); mtDefaultsDeclList_elements (mdecls, mdecl) { mtContextNode mcontext = mtDefaultsDecl_getContext (mdecl); cstring mvalue = mtDefaultsDecl_getValue (mdecl); if (cstringList_contains (mvals, mvalue)) { int vindex = cstringList_getIndex (mvals, mvalue); mtContextKind mkind; if (mtContextNode_isReference (mcontext)) { mkind = MTC_REFERENCE; } else if (mtContextNode_isParameter (mcontext)) { mkind = MTC_PARAM; } else if (mtContextNode_isResult (mcontext)) { mkind = MTC_RESULT; } else if (mtContextNode_isLiteral (mcontext)) { mkind = MTC_LITERAL; } else if (mtContextNode_isNull (mcontext)) { mkind = MTC_NULL; } else { DPRINTF (("Bad: %s", mtContextNode_unparse (mcontext))); BADBRANCH; } if (metaStateInfo_getDefaultValueContext (msinfo, mkind) != stateValue_error) { voptgenerror (FLG_SYNTAX, message ("Duplicate defaults declaration for context %q: %q", mtContextNode_unparse (mcontext), mtDefaultsDecl_unparse (mdecl)), mtDefaultsDecl_getLoc (mdecl)); } else { metaStateInfo_setDefaultValueContext (msinfo, mkind, vindex); } } else { voptgenerror (FLG_SYNTAX, message ("Defaults declaration uses unrecognized value name %s: %q", mvalue, mtDefaultsDecl_unparse (mdecl)), mtDefaultsDecl_getLoc (mdecl)); } } end_mtDefaultsDeclList_elements ; } mtp = mtDeclarationPieces_findPiece (pieces, MTP_DEFAULTVALUE); if (mtDeclarationPiece_isDefined (mtp)) { cstring mvalue = mtDeclarationPiece_getDefaultValue (mtp); llassert (isglobal); if (cstringList_contains (mvals, mvalue)) { int vindex = cstringList_getIndex (mvals, mvalue); if (metaStateInfo_getDefaultRefValue (msinfo) != stateValue_error) { voptgenerror (FLG_SYNTAX, message ("Duplicate default value declaration for global state: %s", mvalue), mtDeclarationNode_getLoc (node)); } else { metaStateInfo_setDefaultRefValue (msinfo, vindex); } } else { voptgenerror (FLG_SYNTAX, message ("Default value declaration uses unrecognized value name: %s", mvalue), mtDeclarationNode_getLoc (node)); } } context_addMetaState (cstring_copy (mtDeclarationNode_getName (node)), msinfo); } extern void mtDeclarationNode_free (/*@only@*/ mtDeclarationNode node) { mtDeclarationPieces_free (node->pieces); cstring_free (node->name); fileloc_free (node->loc); sfree (node); } extern fileloc mtDeclarationNode_getLoc (mtDeclarationNode node) { return node->loc; } extern /*@observer@*/ cstring mtDeclarationNode_getName (mtDeclarationNode node) { return node->name; } splint-3.1.2.dfsg1/src/mtDeclarationPieces.c0000644021234200000250000000601407646432515016332 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtDeclarationPieces.c */ # include "splintMacros.nf" # include "basic.h" extern mtDeclarationPieces mtDeclarationPieces_create (void) /*@*/ { return mtDeclarationPieces_undefined; } extern mtDeclarationPieces mtDeclarationPieces_append (mtDeclarationPieces node, /*@only@*/ mtDeclarationPiece piece) /*@modifies node*/ { mtDeclarationPieces tnode = node; mtDeclarationPieces res = (mtDeclarationPieces) dmalloc (sizeof (*node)); res->thisPiece = piece; res->rest = mtDeclarationPieces_undefined; if (mtDeclarationPieces_isUndefined (node)) { return res; } while (mtDeclarationPieces_isDefined (tnode->rest)) { tnode = tnode->rest; } tnode->rest = res; return node; } extern cstring mtDeclarationPieces_unparse (mtDeclarationPieces node) /*@*/ { cstring res = cstring_newEmpty (); while (mtDeclarationPieces_isDefined (node)) { res = message ("%q%q; ", res, mtDeclarationPiece_unparse (node->thisPiece)); node = node->rest; } return res; } mtDeclarationPiece mtDeclarationPieces_findPiece (mtDeclarationPieces pieces, mtPieceKind kind) { bool foundone = FALSE; mtDeclarationPiece res = mtDeclarationPiece_undefined; while (mtDeclarationPieces_isDefined (pieces)) { if (mtDeclarationPiece_matchKind (pieces->thisPiece, kind)) { if (foundone) { llassert (mtDeclarationPiece_isDefined (res)); voptgenerror (FLG_SYNTAX, message ("Metastate declaration has duplicate pieces: %q / %q", mtDeclarationPiece_unparse (res), mtDeclarationPiece_unparse (pieces->thisPiece)), g_currentloc); } else { foundone = TRUE; llassert (mtDeclarationPiece_isUndefined (res)); res = pieces->thisPiece; } } pieces = pieces->rest; } return res; } extern void mtDeclarationPieces_free (/*@only@*/ mtDeclarationPieces node) { if (mtDeclarationPieces_isDefined (node)) { mtDeclarationPiece_free (node->thisPiece); mtDeclarationPieces_free (node->rest); } sfree (node); } splint-3.1.2.dfsg1/src/mtDeclarationPiece.c0000644021234200000250000002172007646432515016150 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtDeclarationPiece.c */ # include "splintMacros.nf" # include "basic.h" static mtDeclarationPiece mtDeclarationPiece_create (mtPieceKind kind, /*@null@*/ /*@only@*/ void *node) { mtDeclarationPiece res = (mtDeclarationPiece) dmalloc (sizeof (*res)); res->kind = kind; res->node = node; return res; } extern mtDeclarationPiece mtDeclarationPiece_createContext (mtContextNode node) /*@*/ { return mtDeclarationPiece_create (MTP_CONTEXT, (void *) node); } extern mtDeclarationPiece mtDeclarationPiece_createValues (mtValuesNode node) /*@*/ { return mtDeclarationPiece_create (MTP_VALUES, (void *) node); } extern mtDeclarationPiece mtDeclarationPiece_createDefaults (mtDefaultsNode node) /*@*/ { return mtDeclarationPiece_create (MTP_DEFAULTS, (void *) node); } extern mtDeclarationPiece mtDeclarationPiece_createValueDefault (mttok node) /*@*/ { llassert (mttok_isIdentifier (node)); return mtDeclarationPiece_create (MTP_DEFAULTVALUE, (void *) node); } extern mtDeclarationPiece mtDeclarationPiece_createAnnotations (mtAnnotationsNode node) /*@*/ { return mtDeclarationPiece_create (MTP_ANNOTATIONS, (void *) node); } extern mtDeclarationPiece mtDeclarationPiece_createMerge (mtMergeNode node) /*@*/ { return mtDeclarationPiece_create (MTP_MERGE, (void *) node); } extern mtDeclarationPiece mtDeclarationPiece_createTransfers (mtTransferClauseList node) /*@*/ { return mtDeclarationPiece_create (MTP_TRANSFERS, (void *) node); } extern mtDeclarationPiece mtDeclarationPiece_createPreconditions (mtTransferClauseList node) /*@*/ { return mtDeclarationPiece_create (MTP_PRECONDITIONS, (void *) node); } mtDeclarationPiece mtDeclarationPiece_createPostconditions (mtTransferClauseList node) /*@*/ { return mtDeclarationPiece_create (MTP_POSTCONDITIONS, (void *) node); } mtDeclarationPiece mtDeclarationPiece_createLosers (mtLoseReferenceList node) /*@*/ { return mtDeclarationPiece_create (MTP_LOSERS, (void *) node); } /*@only@*/ cstring mtDeclarationPiece_unparse (mtDeclarationPiece p) { if (mtDeclarationPiece_isUndefined (p)) { return cstring_undefined; } switch (p->kind) { case MTP_CONTEXT: /*@access mtContextNode@*/ return mtContextNode_unparse ((mtContextNode) p->node); /*@noaccess mtContextNode@*/ case MTP_VALUES: /*@access mtValuesNode@*/ return mtValuesNode_unparse ((mtValuesNode) p->node); /*@noaccess mtValuesNode@*/ case MTP_DEFAULTS: /*@access mtDefaultsNode@*/ return mtDefaultsNode_unparse ((mtDefaultsNode) p->node); /*@noaccess mtDefaultsNode@*/ case MTP_DEFAULTVALUE: /*@access mttok@*/ return message ("default %q", mttok_getText ((mttok) p->node)); /*@noaccess mttok@*/ case MTP_ANNOTATIONS: /*@access mtAnnotationsNode@*/ return mtAnnotationsNode_unparse ((mtAnnotationsNode) p->node); /*@noaccess mtAnnotationsNode@*/ case MTP_MERGE: /*@access mtMergeNode@*/ return mtMergeNode_unparse ((mtMergeNode) p->node); /*@noaccess mtMergeNode@*/ case MTP_TRANSFERS: case MTP_PRECONDITIONS: case MTP_POSTCONDITIONS: /*@access mtTransferClauseList@*/ return mtTransferClauseList_unparse ((mtTransferClauseList) p->node); /*@noaccess mtTransferClauseList@*/ case MTP_LOSERS: /*@access mtLoseReferenceList@*/ return mtLoseReferenceList_unparse ((mtLoseReferenceList) p->node); /*@noaccess mtLoseReferenceList@*/ case MTP_DEAD: return cstring_makeLiteral ("Dead Piece"); } BADBRANCHRET (cstring_undefined); } extern bool mtDeclarationPiece_matchKind (mtDeclarationPiece p, mtPieceKind kind) /*@*/ { if (mtDeclarationPiece_isDefined (p)) { return (p->kind == kind); } else { return FALSE; } } extern mtContextNode mtDeclarationPiece_getContext (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_CONTEXT); /*@-abstract@*/ return (mtContextNode) node->node; /*@=abstract@*/ } extern mtContextNode mtDeclarationPiece_stealContext (mtDeclarationPiece node) { mtContextNode res; llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_CONTEXT); /*@-abstract@*/ res = (mtContextNode) node->node; /*@=abstract@*/ node->kind = MTP_DEAD; node->node = NULL; return res; } extern mtDefaultsNode mtDeclarationPiece_getDefaults (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_DEFAULTS); /*@-abstract@*/ return (mtDefaultsNode) node->node; /*@=abstract@*/ } extern cstring mtDeclarationPiece_getDefaultValue (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_DEFAULTVALUE); /*@-abstract@*/ return mttok_observeText ((mttok) node->node); /*@=abstract@*/ } extern mtAnnotationsNode mtDeclarationPiece_getAnnotations (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_ANNOTATIONS); /*@-abstract@*/ return (mtAnnotationsNode) node->node; /*@=abstract@*/ } extern mtMergeNode mtDeclarationPiece_getMerge (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_MERGE); /*@-abstract@*/ return (mtMergeNode) node->node; /*@=abstract@*/ } extern mtTransferClauseList mtDeclarationPiece_getTransfers (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_TRANSFERS); /*@-abstract@*/ return (mtTransferClauseList) node->node; /*@=abstract@*/ } extern mtTransferClauseList mtDeclarationPiece_getPreconditions (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_PRECONDITIONS); /*@-abstract@*/ return (mtTransferClauseList) node->node; /*@=abstract@*/ } extern mtTransferClauseList mtDeclarationPiece_getPostconditions (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_POSTCONDITIONS); /*@-abstract@*/ return (mtTransferClauseList) node->node; /*@=abstract@*/ } extern mtLoseReferenceList mtDeclarationPiece_getLosers (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_LOSERS); /*@-abstract@*/ return (mtLoseReferenceList) node->node; /*@=abstract@*/ } extern mtValuesNode mtDeclarationPiece_getValues (mtDeclarationPiece node) { llassert (mtDeclarationPiece_isDefined (node)); llassert (node->kind == MTP_VALUES); /*@-abstract@*/ return (mtValuesNode) node->node; /*@=abstract@*/ } extern void mtDeclarationPiece_free (/*@only@*/ mtDeclarationPiece node) { if (node != NULL) { switch (node->kind) { case MTP_DEAD: llassert (node->node == NULL); break; case MTP_CONTEXT: /*@access mtContextNode@*/ mtContextNode_free ((mtContextNode) node->node); break; /*@noaccess mtContextNode@*/ case MTP_VALUES: /*@access mtValuesNode@*/ mtValuesNode_free ((mtValuesNode) node->node); break; /*@noaccess mtValuesNode@*/ case MTP_DEFAULTS: /*@access mtDefaultsNode@*/ mtDefaultsNode_free ((mtDefaultsNode) node->node); break; /*@noaccess mtDefaultsNode@*/ case MTP_DEFAULTVALUE: /*@access mttok@*/ mttok_free ((mttok) node->node); break; /*@noaccess mttok@*/ case MTP_ANNOTATIONS: /*@access mtAnnotationsNode@*/ mtAnnotationsNode_free ((mtAnnotationsNode) node->node); break; /*@noaccess mtAnnotationsNode@*/ case MTP_MERGE: /*@access mtMergeNode@*/ mtMergeNode_free ((mtMergeNode) node->node); break; /*@noaccess mtMergeNode@*/ case MTP_TRANSFERS: case MTP_PRECONDITIONS: case MTP_POSTCONDITIONS: /*@access mtTransferClauseList@*/ mtTransferClauseList_free ((mtTransferClauseList) node->node); break; /*@noaccess mtTransferClauseList@*/ case MTP_LOSERS: /*@access mtLoseReferenceList@*/ mtLoseReferenceList_free ((mtLoseReferenceList) node->node); break; /*@noaccess mtLoseReferenceList@*/ } sfree (node); } } splint-3.1.2.dfsg1/src/mtContextNode.c0000644021234200000250000001764207630461221015204 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtContextNode.c */ # include "splintMacros.nf" # include "basic.h" static bool mtContextNode_matchesType (mtContextNode, ctype) /*@*/ ; static /*@observer@*/ cstring mtContextKind_unparse (mtContextKind ck) { switch (ck) { case MTC_ANY: return cstring_makeLiteralTemp ("any"); case MTC_PARAM: return cstring_makeLiteralTemp ("parameter"); case MTC_RESULT: return cstring_makeLiteralTemp ("result"); case MTC_REFERENCE: return cstring_makeLiteralTemp ("reference"); case MTC_CLAUSE: return cstring_makeLiteralTemp ("clause"); case MTC_LITERAL: return cstring_makeLiteralTemp ("literal"); case MTC_NULL: return cstring_makeLiteralTemp ("null"); } BADBRANCHRET (cstring_undefined); } static mtContextNode mtContextNode_create (mtContextKind context, ctype ct) { mtContextNode res = (mtContextNode) dmalloc (sizeof (*res)); res->context = context; res->type = ct; DPRINTF (("Create: %s", mtContextNode_unparse (res))); return res; } extern mtContextNode mtContextNode_createAny () { return mtContextNode_create (MTC_ANY, ctype_unknown); } extern mtContextNode mtContextNode_createParameter (ctype ct) { return mtContextNode_create (MTC_PARAM, ct); } extern mtContextNode mtContextNode_createResult (ctype ct) { return mtContextNode_create (MTC_RESULT, ct); } extern mtContextNode mtContextNode_createReference (ctype ct) { return mtContextNode_create (MTC_REFERENCE, ct); } extern mtContextNode mtContextNode_createClause (ctype ct) { return mtContextNode_create (MTC_CLAUSE, ct); } extern mtContextNode mtContextNode_createLiteral (ctype ct) { return mtContextNode_create (MTC_LITERAL, ct); } extern mtContextNode mtContextNode_createNull (ctype ct) { return mtContextNode_create (MTC_NULL, ct); } extern void mtContextNode_free (/*@only@*/ mtContextNode node) { sfree (node); } bool mtContextNode_matchesEntry (mtContextNode context, uentry ue) { ctype ct; llassert (mtContextNode_isDefined (context)); DPRINTF (("Matches context: %s / %s", mtContextNode_unparse (context), uentry_unparse (ue))); switch (context->context) { case MTC_ANY: break; /* everything matches */ case MTC_RESULT: if (!uentry_isFunction (ue)) { return FALSE; } break; case MTC_PARAM: if (!uentry_isAnyParam (ue)) { DPRINTF (("not param: %s", uentry_unparseFull (ue))); return FALSE; } break; case MTC_LITERAL: case MTC_NULL: return FALSE; case MTC_REFERENCE: break; case MTC_CLAUSE: BADBRANCH; } if (uentry_isFunction (ue)) { ct = ctype_getReturnType (uentry_getType (ue)); } else { ct = uentry_getType (ue); } return mtContextNode_matchesType (context, ct); } bool mtContextNode_matchesRef (mtContextNode context, sRef sr) { ctype ct; llassert (mtContextNode_isDefined (context)); DPRINTF (("Matches context: %s / %s", mtContextNode_unparse (context), sRef_unparse (sr))); switch (context->context) { case MTC_ANY: break; /* everything matches */ case MTC_RESULT: DPRINTF (("Result? %s / %s", sRef_unparseFull (sr), bool_unparse (sRef_isResult (sr)))); return sRef_isResult (sr); case MTC_PARAM: if (!sRef_isParam (sr)) { return FALSE; } break; case MTC_LITERAL: DPRINTF (("Literal: %s", sRef_unparse (sr))); if (!sRef_isConst (sr)) { return FALSE; } break; case MTC_NULL: case MTC_REFERENCE: break; case MTC_CLAUSE: BADBRANCH; } ct = sRef_getType (sr); return mtContextNode_matchesType (context, ct); } bool mtContextNode_matchesRefStrict (mtContextNode context, sRef s) { if (mtContextNode_isDefined (context) && mtContextNode_matchesRef (context, s)) { if (ctype_isKnown (context->type) && (ctype_isUnknown (sRef_getType (s)) || ctype_isVoidPointer (sRef_getType (s)))) { return FALSE; } else { return TRUE; } } return FALSE; } bool mtContextNode_matchesType (mtContextNode context, ctype ct) { DPRINTF (("Context type...")); llassert (mtContextNode_isDefined (context)); if (!ctype_match (context->type, ct)) { DPRINTF (("Type mismatch: %s / %s", ctype_unparse (context->type), ctype_unparse (ct))); return FALSE; } else { /* evans 2001-08-21 - don't match if only one type is unknown */ if (ctype_isUnknown (ct) && !ctype_isUnknown (context->type)) { return FALSE; } DPRINTF (("Type okay: %s / %s", ctype_unparse (context->type), ctype_unparse (ct))); } return TRUE; } cstring mtContextNode_unparse (mtContextNode node) { llassert (mtContextNode_isDefined (node)); if (ctype_isKnown (node->type)) { return message ("%s %s", mtContextKind_unparse (node->context), ctype_unparse (node->type)); } else { return message ("%s", mtContextKind_unparse (node->context)); } } bool mtContextNode_isClause (mtContextNode n) { llassert (mtContextNode_isDefined (n)); return (n->context == MTC_CLAUSE); } bool mtContextNode_isParameter (mtContextNode n) { llassert (mtContextNode_isDefined (n)); return (n->context == MTC_PARAM); } bool mtContextNode_isReference (mtContextNode n) { llassert (mtContextNode_isDefined (n)); return (n->context == MTC_REFERENCE); } bool mtContextNode_isResult (mtContextNode n) { llassert (mtContextNode_isDefined (n)); return (n->context == MTC_RESULT); } bool mtContextNode_isLiteral (mtContextNode n) { llassert (mtContextNode_isDefined (n)); return (n->context == MTC_LITERAL); } bool mtContextNode_isNull (mtContextNode n) { llassert (mtContextNode_isDefined (n)); return (n->context == MTC_NULL); } void mtContextNode_showRefError (mtContextNode context, sRef sr) { ctype ct; llassert (mtContextNode_isDefined (context)); llassert (!mtContextNode_matchesRef (context, sr)); DPRINTF (("Matches context: %s / %s", mtContextNode_unparse (context), sRef_unparse (sr))); switch (context->context) { case MTC_ANY: break; /* everything matches */ case MTC_RESULT: if (!sRef_isResult (sr)) { llgenindentmsgnoloc (message ("Context is result, doesn't match %q", sRef_unparse (sr))); return; } break; case MTC_PARAM: if (!sRef_isResult (sr)) { llgenindentmsgnoloc (message ("Context is parameter, doesn't match %q", sRef_unparse (sr))); return; } break; case MTC_LITERAL: DPRINTF (("Literal: %s", sRef_unparse (sr))); if (!sRef_isConst (sr)) { llgenindentmsgnoloc (message ("Context is literal, doesn't match %q", sRef_unparse (sr))); return; } break; case MTC_NULL: case MTC_REFERENCE: break; case MTC_CLAUSE: BADBRANCH; } ct = sRef_getType (sr); if (!mtContextNode_matchesType (context, ct)) { llgenindentmsgnoloc (message ("Context type is %s, doesn't match type %s", ctype_unparse (context->type), ctype_unparse (ct))); } else { BADBRANCH; } } splint-3.1.2.dfsg1/src/mtValuesNode.c0000644021234200000250000000311607630461221015006 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtValuesNode.c */ # include "splintMacros.nf" # include "basic.h" extern mtValuesNode mtValuesNode_create (cstringList values) { mtValuesNode res = (mtValuesNode) dmalloc (sizeof (*res)); DPRINTF (("Values node: %s", cstringList_unparse (values))); res->values = values; return res; } void mtValuesNode_free (mtValuesNode node) { DPRINTF (("Free values: %s", mtValuesNode_unparse (node))); cstringList_free (node->values); /*! why shouldn't we free this? */ sfree (node); } extern cstring mtValuesNode_unparse (mtValuesNode node) { return message ("values %q", cstringList_unparse (node->values)); } splint-3.1.2.dfsg1/src/mtDefaultsNode.c0000644021234200000250000000304607630461221015320 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtDefaultsNode.c */ # include "splintMacros.nf" # include "basic.h" extern mtDefaultsNode mtDefaultsNode_create (mttok t, mtDefaultsDeclList decls) { mtDefaultsNode res = (mtDefaultsNode) dmalloc (sizeof (*res)); res->decls = decls; res->loc = mttok_stealLoc (t); mttok_free (t); return res; } void mtDefaultsNode_free (mtDefaultsNode node) { mtDefaultsDeclList_free (node->decls); fileloc_free (node->loc); sfree (node); } extern cstring mtDefaultsNode_unparse (mtDefaultsNode node) { return message ("defaults %q", mtDefaultsDeclList_unparse (node->decls)); } splint-3.1.2.dfsg1/src/mtAnnotationsNode.c0000644021234200000250000000277407630461221016055 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtAnnotationsNode.c */ # include "splintMacros.nf" # include "basic.h" extern mtAnnotationsNode mtAnnotationsNode_create (mtAnnotationList annots) { mtAnnotationsNode res = (mtAnnotationsNode) dmalloc (sizeof (*res)); res->annots = annots; return res; } extern void mtAnnotationsNode_free (/*@only@*/ mtAnnotationsNode node) { mtAnnotationList_free (node->annots); sfree (node); } extern cstring mtAnnotationsNode_unparse (mtAnnotationsNode node) { return message ("annotations %q", mtAnnotationList_unparse (node->annots)); } splint-3.1.2.dfsg1/src/mtMergeNode.c0000644021234200000250000000276307630461221014615 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtMergeNode.c */ # include "splintMacros.nf" # include "basic.h" extern mtMergeNode mtMergeNode_create (mtMergeClauseList mlist) { mtMergeNode res = (mtMergeNode) dmalloc (sizeof (*res)); res->mlist = mlist; DPRINTF (("merge node: %s", mtMergeNode_unparse (res))); return res; } void mtMergeNode_free (/*@only@*/ mtMergeNode node) { mtMergeClauseList_free (node->mlist); sfree (node); } extern cstring mtMergeNode_unparse (mtMergeNode node) { return message ("merge %q", mtMergeClauseList_unparse (node->mlist)); } splint-3.1.2.dfsg1/src/mtAnnotationList.c0000644021234200000250000000723107646432515015724 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtAnnotationList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" mtAnnotationList mtAnnotationList_new () { return mtAnnotationList_undefined; } static /*@notnull@*/ mtAnnotationList mtAnnotationList_newEmpty (void) { mtAnnotationList s = (mtAnnotationList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = mtAnnotationListBASESIZE; s->elements = (mtAnnotationDecl *) dmalloc (sizeof (*s->elements) * mtAnnotationListBASESIZE); return (s); } static void mtAnnotationList_grow (/*@notnull@*/ mtAnnotationList s) { int i; mtAnnotationDecl *newelements; s->nspace += mtAnnotationListBASESIZE; newelements = (mtAnnotationDecl *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (mtAnnotationDecl *) 0) { llfatalerror (cstring_makeLiteral ("mtAnnotationList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } mtAnnotationList mtAnnotationList_single (/*@only@*/ mtAnnotationDecl el) { mtAnnotationList s = mtAnnotationList_new (); s = mtAnnotationList_add (s, el); return s; } mtAnnotationList mtAnnotationList_add (mtAnnotationList s, mtAnnotationDecl el) { if (!mtAnnotationList_isDefined (s)) { s = mtAnnotationList_newEmpty (); } if (s->nspace <= 0) { mtAnnotationList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } mtAnnotationList mtAnnotationList_prepend (mtAnnotationList s, mtAnnotationDecl el) { int i; if (!mtAnnotationList_isDefined (s)) { return mtAnnotationList_single (el); } if (s->nspace <= 0) { mtAnnotationList_grow (s); } s->nspace--; for (i = s->nelements; i > 0; i--) { s->elements[i] = s->elements [i - 1]; } s->elements[0] = el; s->nelements++; return s; } cstring mtAnnotationList_unparse (mtAnnotationList s) { return mtAnnotationList_unparseSep (s, cstring_makeLiteralTemp (" ")); } cstring mtAnnotationList_unparseSep (mtAnnotationList s, cstring sep) { cstring st = cstring_undefined; if (mtAnnotationList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = mtAnnotationDecl_unparse (s->elements[i]); } else st = message ("%q%s%q", st, sep, mtAnnotationDecl_unparse (s->elements[i])); } } return st; } void mtAnnotationList_free (mtAnnotationList s) { if (mtAnnotationList_isDefined (s)) { sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/mtAnnotationDecl.c0000644021234200000250000000345507630461221015651 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtAnnotationDecl.c */ # include "splintMacros.nf" # include "basic.h" extern mtAnnotationDecl mtAnnotationDecl_create (mttok id, mtContextNode c, mttok value) { mtAnnotationDecl res = (mtAnnotationDecl) dmalloc (sizeof (*res)); llassert (mttok_isIdentifier (id)); res->name = mttok_getText (id); res->context = c; res->loc = mttok_stealLoc (id); llassert (mttok_isIdentifier (value)); res->value = mttok_getText (value); mttok_free (id); mttok_free (value); return res; } mtContextNode mtAnnotationDecl_stealContext (mtAnnotationDecl annot) { mtContextNode mtc = annot->context; annot->context = mtContextNode_undefined; return mtc; } extern cstring mtAnnotationDecl_unparse (mtAnnotationDecl node) { return message ("%s %q ==> %s", node->name, mtContextNode_unparse (node->context), node->value); } splint-3.1.2.dfsg1/src/mtTransferClauseList.c0000644021234200000250000000763507646432515016543 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtTransferClauseList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" mtTransferClauseList mtTransferClauseList_new () { return mtTransferClauseList_undefined; } static /*@notnull@*/ mtTransferClauseList mtTransferClauseList_newEmpty (void) { mtTransferClauseList s = (mtTransferClauseList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = mtTransferClauseListBASESIZE; s->elements = (mtTransferClause *) dmalloc (sizeof (*s->elements) * mtTransferClauseListBASESIZE); return (s); } static void mtTransferClauseList_grow (/*@notnull@*/ mtTransferClauseList s) { int i; mtTransferClause *newelements; s->nspace += mtTransferClauseListBASESIZE; newelements = (mtTransferClause *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (mtTransferClause *) 0) { llfatalerror (cstring_makeLiteral ("mtTransferClauseList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } mtTransferClauseList mtTransferClauseList_single (mtTransferClause el) { mtTransferClauseList s = mtTransferClauseList_new (); s = mtTransferClauseList_add (s, el); return s; } mtTransferClauseList mtTransferClauseList_add (mtTransferClauseList s, /*@keep@*/ mtTransferClause el) { if (!mtTransferClauseList_isDefined (s)) { s = mtTransferClauseList_newEmpty (); } if (s->nspace <= 0) { mtTransferClauseList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } mtTransferClauseList mtTransferClauseList_prepend (mtTransferClauseList s, mtTransferClause el) { int i; if (!mtTransferClauseList_isDefined (s)) { return mtTransferClauseList_single (el); } if (s->nspace <= 0) { mtTransferClauseList_grow (s); } s->nspace--; for (i = s->nelements; i > 0; i--) { s->elements[i] = s->elements [i - 1]; } s->elements[0] = el; s->nelements++; return s; } cstring mtTransferClauseList_unparse (mtTransferClauseList s) { return mtTransferClauseList_unparseSep (s, cstring_makeLiteralTemp (" ")); } cstring mtTransferClauseList_unparseSep (mtTransferClauseList s, cstring sep) { cstring st = cstring_undefined; if (mtTransferClauseList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = mtTransferClause_unparse (s->elements[i]); } else st = message ("%q%s%q", st, sep, mtTransferClause_unparse (s->elements[i])); } } return st; } void mtTransferClauseList_free (mtTransferClauseList s) { if (mtTransferClauseList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { mtTransferClause_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/mtTransferClause.c0000644021234200000250000000403607630461221015664 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtTransferClause.c */ # include "splintMacros.nf" # include "basic.h" extern mtTransferClause mtTransferClause_create (mttok fromname, mttok toname, mtTransferAction action) { mtTransferClause res = (mtTransferClause) dmalloc (sizeof (*res)); llassert (mttok_isIdentifier (fromname)); res->fromname = mttok_getText (fromname); llassert (mttok_isIdentifier (toname)); res->toname = mttok_getText (toname); res->action = action; res->loc = mttok_stealLoc (fromname); if (fileloc_isUndefined (res->loc)) { llbug (message ("Not fileloc: %q", mttok_unparse (fromname))); } mttok_free (fromname); mttok_free (toname); return res; } extern void mtTransferClause_free (mtTransferClause transfer) { cstring_free (transfer->fromname); cstring_free (transfer->toname); fileloc_free (transfer->loc); mtTransferAction_free (transfer->action); sfree (transfer); } extern cstring mtTransferClause_unparse (mtTransferClause node) { return message ("%s as %s ==> %q", node->fromname, node->toname, mtTransferAction_unparse (node->action)); } splint-3.1.2.dfsg1/src/mtTransferAction.c0000644021234200000250000000525007630461221015664 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtTransferAction.c */ # include "splintMacros.nf" # include "basic.h" extern mtTransferAction mtTransferAction_createValue (mttok value) { mtTransferAction res = (mtTransferAction) dmalloc (sizeof (*res)); res->kind = MTAK_VALUE; llassert (mttok_isIdentifier (value)); res->value = mttok_getText (value); res->message = cstring_undefined; res->loc = mttok_stealLoc (value); mttok_free (value); return res; } extern mtTransferAction mtTransferAction_createError (mttok tok) { mtTransferAction res = (mtTransferAction) dmalloc (sizeof (*res)); res->kind = MTAK_ERROR; res->value = cstring_undefined; res->message = cstring_undefined; res->loc = mttok_stealLoc (tok); mttok_free (tok); return res; } extern mtTransferAction mtTransferAction_createErrorMessage (mttok message) { mtTransferAction res = (mtTransferAction) dmalloc (sizeof (*res)); res->kind = MTAK_ERROR; res->message = mttok_getText (message); res->value = cstring_undefined; res->loc = mttok_stealLoc (message); mttok_free (message); return res; } extern cstring mtTransferAction_getMessage (mtTransferAction node) { llassert (node->kind == MTAK_ERROR); return node->message; } extern cstring mtTransferAction_unparse (mtTransferAction node) { switch (node->kind) { case MTAK_VALUE: return cstring_copy (node->value); case MTAK_ERROR: if (cstring_isDefined (node->message)) { return message ("error \"%s\"", node->message); } else { return cstring_makeLiteral (""); } BADDEFAULT; } BADBRANCH; } extern void mtTransferAction_free (/*@only@*/ mtTransferAction node) { cstring_free (node->value); cstring_free (node->message); fileloc_free (node->loc); sfree (node); } splint-3.1.2.dfsg1/src/mtLoseReferenceList.c0000644021234200000250000000755307646432515016342 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtLoseReferenceList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" mtLoseReferenceList mtLoseReferenceList_new () { return mtLoseReferenceList_undefined; } static /*@notnull@*/ mtLoseReferenceList mtLoseReferenceList_newEmpty (void) { mtLoseReferenceList s = (mtLoseReferenceList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = mtLoseReferenceListBASESIZE; s->elements = (mtLoseReference *) dmalloc (sizeof (*s->elements) * mtLoseReferenceListBASESIZE); return (s); } static void mtLoseReferenceList_grow (/*@notnull@*/ mtLoseReferenceList s) { int i; mtLoseReference *newelements; s->nspace += mtLoseReferenceListBASESIZE; newelements = (mtLoseReference *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (mtLoseReference *) 0) { llfatalerror (cstring_makeLiteral ("mtLoseReferenceList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } mtLoseReferenceList mtLoseReferenceList_single (mtLoseReference el) { mtLoseReferenceList s = mtLoseReferenceList_new (); s = mtLoseReferenceList_add (s, el); return s; } mtLoseReferenceList mtLoseReferenceList_add (mtLoseReferenceList s, /*@keep@*/ mtLoseReference el) { if (!mtLoseReferenceList_isDefined (s)) { s = mtLoseReferenceList_newEmpty (); } if (s->nspace <= 0) { mtLoseReferenceList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } mtLoseReferenceList mtLoseReferenceList_prepend (mtLoseReferenceList s, mtLoseReference el) { int i; if (!mtLoseReferenceList_isDefined (s)) { return mtLoseReferenceList_single (el); } if (s->nspace <= 0) { mtLoseReferenceList_grow (s); } s->nspace--; for (i = s->nelements; i > 0; i--) { s->elements[i] = s->elements [i - 1]; } s->elements[0] = el; s->nelements++; return s; } cstring mtLoseReferenceList_unparse (mtLoseReferenceList s) { return mtLoseReferenceList_unparseSep (s, cstring_makeLiteralTemp (" ")); } cstring mtLoseReferenceList_unparseSep (mtLoseReferenceList s, cstring sep) { cstring st = cstring_undefined; if (mtLoseReferenceList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = mtLoseReference_unparse (s->elements[i]); } else st = message ("%q%s%q", st, sep, mtLoseReference_unparse (s->elements[i])); } } return st; } void mtLoseReferenceList_free (mtLoseReferenceList s) { if (mtLoseReferenceList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { mtLoseReference_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/mtLoseReference.c0000644021234200000250000000354707630461221015472 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtLoseReference.c */ # include "splintMacros.nf" # include "basic.h" extern mtLoseReference mtLoseReference_create (mttok fromname, mtTransferAction action) { mtLoseReference res = (mtLoseReference) dmalloc (sizeof (*res)); llassert (mttok_isIdentifier (fromname)); res->fromname = mttok_getText (fromname); res->action = action; res->loc = mttok_stealLoc (fromname); if (fileloc_isUndefined (res->loc)) { llbug (message ("Not fileloc: %q", mttok_unparse (fromname))); } mttok_free (fromname); return res; } extern void mtLoseReference_free (mtLoseReference transfer) { cstring_free (transfer->fromname); fileloc_free (transfer->loc); mtTransferAction_free (transfer->action); sfree (transfer); } extern cstring mtLoseReference_unparse (mtLoseReference node) { return message ("%s ==> %q", node->fromname, mtTransferAction_unparse (node->action)); } splint-3.1.2.dfsg1/src/mtDefaultsDeclList.c0000644021234200000250000000751707646432515016160 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtDefaultsDeclList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" mtDefaultsDeclList mtDefaultsDeclList_new () { return mtDefaultsDeclList_undefined; } static /*@notnull@*/ mtDefaultsDeclList mtDefaultsDeclList_newEmpty (void) { mtDefaultsDeclList s = (mtDefaultsDeclList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = mtDefaultsDeclListBASESIZE; s->elements = (mtDefaultsDecl *) dmalloc (sizeof (*s->elements) * mtDefaultsDeclListBASESIZE); return (s); } static void mtDefaultsDeclList_grow (/*@notnull@*/ mtDefaultsDeclList s) { int i; mtDefaultsDecl *newelements; s->nspace += mtDefaultsDeclListBASESIZE; newelements = (mtDefaultsDecl *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (mtDefaultsDecl *) 0) { llfatalerror (cstring_makeLiteral ("mtDefaultsDeclList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } mtDefaultsDeclList mtDefaultsDeclList_single (/*@keep@*/ mtDefaultsDecl el) { mtDefaultsDeclList s = mtDefaultsDeclList_new (); s = mtDefaultsDeclList_add (s, el); return s; } mtDefaultsDeclList mtDefaultsDeclList_add (mtDefaultsDeclList s, /*@keep@*/ mtDefaultsDecl el) { if (!mtDefaultsDeclList_isDefined (s)) { s = mtDefaultsDeclList_newEmpty (); } if (s->nspace <= 0) { mtDefaultsDeclList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } mtDefaultsDeclList mtDefaultsDeclList_prepend (mtDefaultsDeclList s, /*@keep@*/ mtDefaultsDecl el) { int i; if (!mtDefaultsDeclList_isDefined (s)) { return mtDefaultsDeclList_single (el); } if (s->nspace <= 0) { mtDefaultsDeclList_grow (s); } s->nspace--; for (i = s->nelements; i > 0; i--) { s->elements[i] = s->elements [i - 1]; } s->elements[0] = el; s->nelements++; return s; } cstring mtDefaultsDeclList_unparse (mtDefaultsDeclList s) { return mtDefaultsDeclList_unparseSep (s, cstring_makeLiteralTemp (" ")); } cstring mtDefaultsDeclList_unparseSep (mtDefaultsDeclList s, cstring sep) { cstring st = cstring_undefined; if (mtDefaultsDeclList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = mtDefaultsDecl_unparse (s->elements[i]); } else st = message ("%q%s%q", st, sep, mtDefaultsDecl_unparse (s->elements[i])); } } return st; } void mtDefaultsDeclList_free (mtDefaultsDeclList s) { if (mtDefaultsDeclList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { mtDefaultsDecl_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/mtDefaultsDecl.c0000644021234200000250000000332707630461221015304 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtDefaultsDecl.c */ # include "splintMacros.nf" # include "basic.h" extern mtDefaultsDecl mtDefaultsDecl_create (/*@only@*/ mtContextNode context, /*@only@*/ mttok value) { mtDefaultsDecl res = (mtDefaultsDecl) dmalloc (sizeof (*res)); llassert (mttok_isIdentifier (value)); res->context = context; res->loc = fileloc_copy (mttok_getLoc (value)); res->value = mttok_getText (value); mttok_free (value); return res; } extern void mtDefaultsDecl_free (mtDefaultsDecl dd) { cstring_free (dd->value); fileloc_free (dd->loc); mtContextNode_free (dd->context); sfree (dd); } extern cstring mtDefaultsDecl_unparse (mtDefaultsDecl node) { return message ("%s %q", node->value, mtContextNode_unparse (node->context)); } splint-3.1.2.dfsg1/src/mtMergeItem.c0000644021234200000250000000376207630461221014626 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtMergeItem.c */ # include "splintMacros.nf" # include "basic.h" extern mtMergeItem mtMergeItem_createValue (mttok value) { mtMergeItem res = (mtMergeItem) dmalloc (sizeof (*res)); res->kind = MTMK_VALUE; llassert (mttok_isIdentifier (value)); res->value = mttok_getText (value); res->loc = mttok_stealLoc (value); mttok_free (value); return res; } extern mtMergeItem mtMergeItem_createStar (mttok value) { mtMergeItem res = (mtMergeItem) dmalloc (sizeof (*res)); res->kind = MTMK_STAR; res->loc = mttok_stealLoc (value); res->value = cstring_undefined; mttok_free (value); DPRINTF (("Made star!")); llassert (mtMergeItem_isStar (res)); return res; } extern cstring mtMergeItem_unparse (mtMergeItem node) { switch (node->kind) { case MTMK_VALUE: return cstring_copy (node->value); case MTMK_STAR: return cstring_makeLiteral ("{*}"); BADDEFAULT; } BADBRANCH; } extern void mtMergeItem_free (/*@only@*/ mtMergeItem node) { cstring_free (node->value); fileloc_free (node->loc); sfree (node); } splint-3.1.2.dfsg1/src/mtMergeClause.c0000644021234200000250000000327607630461221015144 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtMergeClause.c */ # include "splintMacros.nf" # include "basic.h" extern mtMergeClause mtMergeClause_create (mtMergeItem item1, mtMergeItem item2, mtTransferAction action) { mtMergeClause res = (mtMergeClause) dmalloc (sizeof (*res)); res->item1 = item1; res->item2 = item2; res->action = action; return res; } extern void mtMergeClause_free (mtMergeClause merge) { mtMergeItem_free (merge->item1); mtMergeItem_free (merge->item2); mtTransferAction_free (merge->action); sfree (merge); } extern cstring mtMergeClause_unparse (mtMergeClause node) { return message ("%q X %q ==> %q", mtMergeItem_unparse (node->item1), mtMergeItem_unparse (node->item2), mtTransferAction_unparse (node->action)); } splint-3.1.2.dfsg1/src/mtMergeClauseList.c0000644021234200000250000000743507646432515016014 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** mtMergeClauseList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" mtMergeClauseList mtMergeClauseList_new () { return mtMergeClauseList_undefined; } static /*@notnull@*/ mtMergeClauseList mtMergeClauseList_newEmpty (void) { mtMergeClauseList s = (mtMergeClauseList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = mtMergeClauseListBASESIZE; s->elements = (mtMergeClause *) dmalloc (sizeof (*s->elements) * mtMergeClauseListBASESIZE); return (s); } static void mtMergeClauseList_grow (/*@notnull@*/ mtMergeClauseList s) { int i; mtMergeClause *newelements; s->nspace += mtMergeClauseListBASESIZE; newelements = (mtMergeClause *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); if (newelements == (mtMergeClause *) 0) { llfatalerror (cstring_makeLiteral ("mtMergeClauseList_grow: out of memory!")); } for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } mtMergeClauseList mtMergeClauseList_single (/*@keep@*/ mtMergeClause el) { mtMergeClauseList s = mtMergeClauseList_new (); s = mtMergeClauseList_add (s, el); return s; } mtMergeClauseList mtMergeClauseList_add (mtMergeClauseList s, /*@keep@*/ mtMergeClause el) { if (!mtMergeClauseList_isDefined (s)) { s = mtMergeClauseList_newEmpty (); } if (s->nspace <= 0) { mtMergeClauseList_grow (s); } s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } mtMergeClauseList mtMergeClauseList_prepend (mtMergeClauseList s, /*@keep@*/ mtMergeClause el) { int i; if (!mtMergeClauseList_isDefined (s)) { return mtMergeClauseList_single (el); } if (s->nspace <= 0) { mtMergeClauseList_grow (s); } s->nspace--; for (i = s->nelements; i > 0; i--) { s->elements[i] = s->elements [i - 1]; } s->elements[0] = el; s->nelements++; return s; } cstring mtMergeClauseList_unparse (mtMergeClauseList s) { return mtMergeClauseList_unparseSep (s, cstring_makeLiteralTemp (" ")); } cstring mtMergeClauseList_unparseSep (mtMergeClauseList s, cstring sep) { cstring st = cstring_undefined; if (mtMergeClauseList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { if (i == 0) { st = mtMergeClause_unparse (s->elements[i]); } else st = message ("%q%s%q", st, sep, mtMergeClause_unparse (s->elements[i])); } } return st; } void mtMergeClauseList_free (mtMergeClauseList s) { if (mtMergeClauseList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { mtMergeClause_free (s->elements[i]); } sfree (s->elements); sfree (s); } } splint-3.1.2.dfsg1/src/exprNode.c0000644021234200000250000102671210000622320014154 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** exprNode.c */ # include /* for isdigit */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cscanner.h" # include "cscannerHelp.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "transferChecks.h" # include "exprNodeSList.h" static bool exprNode_sameStorage (exprNode p_e1, exprNode p_e2) /*@*/ ; static bool exprNode_isEmptyStatement (exprNode p_e); static /*@exposed@*/ exprNode exprNode_firstStatement (/*@returned@*/ exprNode p_e); static bool exprNode_isFalseConstant (exprNode p_e) /*@*/ ; static bool exprNode_isStatement (exprNode p_e); static void checkGlobUse (uentry p_glob, bool p_isCall, /*@notnull@*/ exprNode p_e); static void exprNode_addUse (exprNode p_e, /*@exposed@*/ sRef p_s); static bool exprNode_matchArgType (ctype p_ct, exprNode p_e); static exprNode exprNode_fakeCopy (exprNode p_e) /*@*/ ; static exprNode exprNode_statementError (/*@only@*/ exprNode p_e, /*@only@*/ lltok p_t); static bool exprNode_matchTypes (exprNode p_e1, exprNode p_e2); static void checkUniqueParams (exprNode p_fcn, /*@notnull@*/ exprNode p_current, exprNodeList p_args, int p_paramno, uentry p_ucurrent); static void updateAliases (/*@notnull@*/ exprNode p_e1, /*@notnull@*/ exprNode p_e2); static bool abstractOpError (ctype p_tr1, ctype p_tr2, lltok p_op, /*@notnull@*/ exprNode p_e1, /*@notnull@*/ exprNode p_e2, fileloc p_loc1, fileloc p_loc2) /*@modifies g_warningstream@*/ ; static ctype checkNumerics (ctype p_tr1, ctype p_tr2, ctype p_te1, ctype p_te2, /*@notnull@*/ exprNode p_e1, /*@notnull@*/ exprNode p_e2, lltok p_op); static void doAssign (/*@notnull@*/ exprNode p_e1, /*@notnull@*/ exprNode p_e2, bool p_isInit); static void checkSafeUse (exprNode p_e, /*@exposed@*/ sRef p_s); static void reflectNullTest (/*@notnull@*/ exprNode p_e, bool p_isnull); static void checkMacroParen (exprNode p_e); static exprNodeSList exprNode_flatten (/*@dependent@*/ exprNode p_e); static void exprNode_checkSetAny (exprNode p_e, /*@dependent@*/ cstring p_name); static void exprNode_checkUse (exprNode p_e, /*@exposed@*/ sRef p_s, fileloc p_loc); static void exprNode_mergeUSs (exprNode p_res, exprNode p_other); static void exprNode_mergeCondUSs (exprNode p_res, exprNode p_other1, exprNode p_other2); static /*@only@*/ /*@notnull@*/ exprNode exprNode_fromIdentifierAux (/*@observer@*/ uentry p_c); static void checkAnyCall (/*@notnull@*/ /*@dependent@*/ exprNode p_fcn, /*@dependent@*/ cstring p_fname, uentryList p_pn, exprNodeList p_args, bool p_hasMods, sRefSet p_mods, bool p_isSpec, int p_specialArgs); static void checkOneArg (uentry p_ucurrent, /*@notnull@*/ exprNode p_current, /*@dependent@*/ exprNode p_fcn, bool p_isSpec, int p_argno, int p_totargs); static void checkUnspecCall (/*@notnull@*/ /*@dependent@*/ exprNode p_fcn, uentryList p_params, exprNodeList p_args); static /*@only@*/ exprNode exprNode_effect (exprNode p_e) /*@globals internalState@*/ ; static /*@only@*/ cstring exprNode_doUnparse (exprNode p_e); static /*@observer@*/ cstring exprNode_rootVarName (exprNode p_e); static /*@exposed@*/ exprNode exprNode_lastStatement (/*@returned@*/ exprNode p_e); static /*@only@*/ exprNode s_mustExitNode = exprNode_undefined; static int checkArgsReal (uentry p_fcn, /*@dependent@*/ exprNode p_f, uentryList p_cl, exprNodeList p_args, bool p_isIter, exprNode p_ret); static bool inEffect = FALSE; static int nowalloc = 0; static int totalloc = 0; static int maxalloc = 0; static /*@only@*/ uentry regArg; static /*@only@*/ uentry outArg; static /*@only@*/ uentry outStringArg; static /*@exposed@*/ sRef stdinRef; static /*@exposed@*/ sRef stdoutRef; static /*@only@*/ uentry csArg; static /*@only@*/ uentry csOnlyArg; static ctype cstringType; static ctype ctypeType; static ctype filelocType; static bool initMod = FALSE; /*@function void exprNode_swap (sef exprNode, sef exprNode)@*/ /*@-macroassign@*/ # define exprNode_swap(e1,e2) do { exprNode m_tmp = (e1); (e1) = (e2); (e2) = m_tmp; } while (FALSE) /*@=macroassign@*/ static void exprNode_defineConstraints(/*@sef@*/ /*@special@*/ /*@notnull@*/ exprNode e) /*@defines e->requiresConstraints, e->ensuresConstraints, e->trueEnsuresConstraints, e->falseEnsuresConstraints @*/ { e->requiresConstraints = constraintList_makeNew (); e->ensuresConstraints = constraintList_makeNew (); e->trueEnsuresConstraints = constraintList_makeNew (); e->falseEnsuresConstraints = constraintList_makeNew (); } /* ** must occur after library has been read */ void exprNode_initMod (void) /*@globals undef regArg, undef outArg, undef outStringArg, undef csOnlyArg, undef csArg; @*/ { uentry ue; idDecl tmp; initMod = TRUE; cstringType = ctype_unknown; ctypeType = ctype_unknown; filelocType = ctype_unknown; if (usymtab_existsType (cstring_makeLiteralTemp ("cstring"))) { cstringType = usymtab_lookupAbstractType (cstring_makeLiteralTemp ("cstring")); } if (usymtab_existsType (cstring_makeLiteralTemp ("ctype"))) { ctypeType = usymtab_lookupAbstractType (cstring_makeLiteralTemp ("ctype")); } if (usymtab_existsType (cstring_makeLiteralTemp ("fileloc"))) { filelocType = usymtab_lookupAbstractType (cstring_makeLiteralTemp ("fileloc")); } if (usymtab_existsGlob (cstring_makeLiteralTemp ("stdin"))) { ue = usymtab_lookupGlob (cstring_makeLiteralTemp ("stdin")); } else /* define stdin */ { ue = uentry_makeVariable (cstring_makeLiteralTemp ("stdin"), ctype_unknown, fileloc_getBuiltin (), FALSE); uentry_setHasNameError (ue); ue = usymtab_supGlobalEntryReturn (ue); } stdinRef = sRef_makePointer (uentry_getSref (ue)); if (usymtab_existsGlob (cstring_makeLiteralTemp ("stdout"))) { ue = usymtab_lookupGlob (cstring_makeLiteralTemp ("stdout")); } else { ue = uentry_makeVariable (cstring_makeLiteralTemp ("stdout"), ctype_unknown, fileloc_getBuiltin (), FALSE); uentry_setHasNameError (ue); ue = usymtab_supGlobalEntryReturn (ue); } stdoutRef = sRef_makePointer (uentry_getSref (ue)); tmp = idDecl_create (cstring_undefined, qtype_create (ctype_unknown)); regArg = uentry_makeParam (tmp, PARAMUNKNOWN); idDecl_setTyp (tmp, qtype_addQual (qtype_create (ctype_makePointer (ctype_unknown)), qual_createOut ())); outArg = uentry_makeParam (tmp, PARAMUNKNOWN); idDecl_setTyp (tmp, qtype_addQual (qtype_create (ctype_string), qual_createOut ())); outStringArg = uentry_makeParam (tmp, PARAMUNKNOWN); idDecl_setTyp (tmp, qtype_addQual (qtype_addQual (qtype_create (cstringType), qual_createOnly ()), qual_createNull ())); csOnlyArg = uentry_makeParam (tmp, PARAMUNKNOWN); idDecl_setTyp (tmp, qtype_addQual (qtype_create (cstringType), qual_createNull ())); csArg = uentry_makeParam (tmp, PARAMUNKNOWN); idDecl_free (tmp); } void exprNode_destroyMod (void) /*@globals killed regArg, killed outArg, killed outStringArg, killed s_mustExitNode, initMod @*/ { if (initMod) { /* evans 2002-07-12: changed uentry_free to uentry_freeComplete */ uentry_freeComplete (regArg); uentry_freeComplete (outArg); uentry_freeComplete (outStringArg); exprNode_free (s_mustExitNode); initMod = FALSE; /*@-branchstate@*/ } /*@=branchstate@*/ } static void exprNode_resetSref (/*@notnull@*/ exprNode e) { e->sref = sRef_undefined; } exprNode exprNode_fakeCopy (exprNode e) { /*@-temptrans@*/ /*@-retalias@*/ return e; /*@=temptrans@*/ /*@=retalias@*/ } static bool isFlagKey (char key) { return (key == '-' || key == '+' || key == ' ' || key == '#'); } static void exprNode_combineControl (/*@notnull@*/ exprNode ret, /*@notnull@*/ exprNode ifclause, /*@notnull@*/ exprNode elseclause) { ret->canBreak = ifclause->canBreak || elseclause->canBreak; ret->mustBreak = (ifclause->mustBreak || exprNode_mustEscape (ifclause)) && (elseclause->mustBreak || exprNode_mustEscape (elseclause)); ret->exitCode = exitkind_combine (ifclause->exitCode, elseclause->exitCode); } /* ** For exprNode's returned by exprNode_effect. */ static bool shallowKind (exprKind kind) { return (kind == XPR_STRINGLITERAL || kind == XPR_NUMLIT || kind == XPR_EMPTY || kind == XPR_BODY || kind == XPR_NODE); } static void exprNode_freeIniter (/*@only@*/ exprNode e) { if (!exprNode_isError (e)) { switch (e->kind) { case XPR_FACCESS: /* ** Its a fake copy, don't free the field->rec and field->field ** fields. */ /*@-compdestroy@*/ sfree (e->edata->field); /*@=compdestroy@*/ sfree (e->edata); break; case XPR_FETCH: exprNode_free (e->edata->op->b); /*@-compdestroy@*/ sfree (e->edata->op); /*@=compdestroy@*/ sfree (e->edata); break; default: llbug (message ("other: %s", exprNode_unparse (e))); } multiVal_free (e->val); cstring_free (e->etext); fileloc_free (e->loc); sRefSet_free (e->uses); sRefSet_free (e->sets); sRefSet_free (e->msets); guardSet_free (e->guards); constraintList_free(e->requiresConstraints); constraintList_free(e->ensuresConstraints); constraintList_free(e->trueEnsuresConstraints); constraintList_free(e->falseEnsuresConstraints); e->requiresConstraints = NULL; e->ensuresConstraints = NULL; e->trueEnsuresConstraints = NULL; e->falseEnsuresConstraints = NULL; sfree (e); } } void exprNode_freeShallow (/*@only@*/ exprNode e) { if (!exprNode_isError (e)) { if (shallowKind (e->kind)) { } else { if (!inEffect) { if (e->kind == XPR_EMPTY || e->kind == XPR_BODY || e->kind == XPR_STRINGLITERAL || e->kind == XPR_NUMLIT || e->kind == XPR_NODE || e->kind == XPR_OFFSETOF || e->kind == XPR_ALIGNOFT || e->kind == XPR_ALIGNOF || e->kind == XPR_SIZEOFT || e->kind == XPR_SIZEOF) { /* don't free anything */ } else { /* multiVal_free (e->val); */ cstring_free (e->etext); fileloc_free (e->loc); sRefSet_free (e->uses); sRefSet_free (e->sets); sRefSet_free (e->msets); guardSet_free (e->guards); exprData_freeShallow (e->edata, e->kind); nowalloc--; /*@-compdestroy@*/ sfree (e); /*@=compdestroy@*/ /*@-branchstate@*/ } } } /*@=branchstate@*/ } } void exprNode_free (exprNode e) { if (!exprNode_isError (e)) { if (!inEffect) { multiVal_free (e->val); cstring_free (e->etext); fileloc_free (e->loc); sRefSet_free (e->uses); sRefSet_free (e->sets); sRefSet_free (e->msets); guardSet_free (e->guards); exprData_free (e->edata, e->kind); constraintList_free(e->requiresConstraints); constraintList_free(e->ensuresConstraints); constraintList_free(e->trueEnsuresConstraints); constraintList_free(e->falseEnsuresConstraints); e->requiresConstraints = NULL; e->ensuresConstraints = NULL; e->trueEnsuresConstraints = NULL; e->falseEnsuresConstraints = NULL; nowalloc--; sfree (e); /*@-branchstate@*/ } /*@=branchstate@*/ } } exprNode exprNode_makeError () { return exprNode_undefined; } static /*@out@*/ /*@only@*/ /*@notnull@*/ exprNode exprNode_new (void) { exprNode ret = (exprNode) dmalloc (sizeof (*ret)); /* static int lastexpnodes = 0; */ nowalloc++; totalloc++; if (nowalloc > maxalloc) { maxalloc = nowalloc; } return ret; } static /*@notnull@*/ /*@special@*/ exprNode exprNode_createPlain (ctype c) /*@defines result@*/ /*@ensures isnull result->edata, result->loc, result->val, result->guards, result->uses, result->sets, result->msets, result->etext @*/ /*@*/ { exprNode e = exprNode_new (); e->typ = c; e->kind = XPR_EMPTY; e->val = multiVal_undefined; e->sref = sRef_undefined; e->etext = cstring_undefined; e->loc = fileloc_undefined; e->guards = guardSet_undefined; e->uses = sRefSet_undefined; e->sets = sRefSet_undefined; e->msets = sRefSet_undefined; e->edata = exprData_undefined; e->exitCode = XK_NEVERESCAPE; e->canBreak = FALSE; e->mustBreak = FALSE; e->isJumpPoint = FALSE; exprNode_defineConstraints(e); return (e); } /*@observer@*/ exprNode exprNode_makeMustExit (void) { if (exprNode_isUndefined (s_mustExitNode)) { s_mustExitNode = exprNode_createPlain (ctype_unknown); s_mustExitNode->exitCode = XK_MUSTEXIT; } return s_mustExitNode; } static /*@notnull@*/ /*@special@*/ exprNode exprNode_create (ctype c) /*@defines result@*/ /*@post:isnull result->edata, result->guards, result->val, result->uses, result->sets, result->msets@*/ /*@*/ { exprNode e = exprNode_createPlain (c); e->loc = fileloc_copy (g_currentloc); return (e); } static /*@notnull@*/ /*@special@*/ exprNode exprNode_createUnknown (void) /*@defines result@*/ /*@post:isnull result->edata, result->guards, result->uses, result->sets, result->msets@*/ /*@*/ { return (exprNode_create (ctype_unknown)); } static /*@notnull@*/ /*@special@*/ exprNode exprNode_createLoc (ctype c, /*@keep@*/ fileloc loc) /*@defines result@*/ /*@post:isnull result->edata, result->guards, result->val, result->uses, result->sets, result->msets@*/ /*@*/ { exprNode e = exprNode_createPlain (c); e->loc = loc; return (e); } static void exprNode_copySets (/*@special@*/ /*@notnull@*/ exprNode ret, exprNode e) /*@defines ret->guards, ret->uses, ret->sets, ret->msets@*/ { if (exprNode_isDefined (e)) { ret->guards = guardSet_copy (e->guards); ret->uses = sRefSet_newCopy (e->uses); ret->sets = sRefSet_newCopy (e->sets); ret->msets = sRefSet_newCopy (e->msets); } else { ret->guards = guardSet_undefined; ret->uses = sRefSet_undefined; ret->sets = sRefSet_undefined; ret->msets = sRefSet_undefined; } } static /*@notnull@*/ /*@special@*/ exprNode exprNode_createPartialLocCopy (exprNode e, /*@only@*/ fileloc loc) /*@defines result@*/ /*@post:isnull result->edata, result->etext@*/ /*@*/ { exprNode ret = exprNode_new (); if (exprNode_isError (e)) { ret->typ = ctype_unknown; ret->val = multiVal_undefined; ret->loc = loc; ret->guards = guardSet_undefined; ret->uses = sRefSet_undefined; ret->sets = sRefSet_undefined; ret->msets = sRefSet_undefined; } else { ret->typ = e->typ; ret->val = multiVal_copy (e->val); ret->loc = loc; ret->guards = guardSet_copy (e->guards); ret->uses = sRefSet_newCopy (e->uses); ret->sets = sRefSet_newCopy (e->sets); ret->msets = sRefSet_newCopy (e->msets); } ret->kind = XPR_EMPTY; ret->sref = sRef_undefined; ret->etext = cstring_undefined; ret->exitCode = XK_NEVERESCAPE; ret->canBreak = FALSE; ret->mustBreak = FALSE; ret->isJumpPoint = FALSE; ret->edata = exprData_undefined; exprNode_defineConstraints(ret); return (ret); } static /*@notnull@*/ /*@special@*/ exprNode exprNode_createPartialCopy (exprNode e) /*@defines result@*/ /*@post:isnull result->edata, result->etext@*/ /*@*/ { return (exprNode_createPartialLocCopy (e, fileloc_copy (exprNode_loc (e)))); } static /*@notnull@*/ /*@special@*/ exprNode exprNode_createPartialNVCopy (exprNode e) /*@defines result@*/ /*@post:isnull result->edata, result->etext, result->val @*/ /*@*/ { exprNode ret = exprNode_new (); if (exprNode_isError (e)) { ret->typ = ctype_unknown; ret->loc = fileloc_undefined; ret->guards = guardSet_undefined; ret->uses = sRefSet_undefined; ret->sets = sRefSet_undefined; ret->msets = sRefSet_undefined; } else { ret->typ = e->typ; ret->loc = fileloc_copy (e->loc); ret->guards = guardSet_copy (e->guards); ret->uses = sRefSet_newCopy (e->uses); ret->sets = sRefSet_newCopy (e->sets); ret->msets = sRefSet_newCopy (e->msets); } ret->val = multiVal_undefined; ret->kind = XPR_EMPTY; ret->sref = sRef_undefined; ret->etext = cstring_undefined; ret->exitCode = XK_NEVERESCAPE; ret->canBreak = FALSE; ret->mustBreak = FALSE; ret->isJumpPoint = FALSE; ret->edata = exprData_undefined; exprNode_defineConstraints(ret); return (ret); } static /*@notnull@*/ /*@special@*/ exprNode exprNode_createSemiCopy (exprNode e) /*@defines result@*/ /*@post:isnull result->edata, result->etext, result->sets, result->msets, result->uses, result->guards@*/ /*@*/ { if (exprNode_isError (e)) { return exprNode_createPlain (ctype_unknown); } else { exprNode ret = exprNode_new (); ret->typ = e->typ; ret->val = multiVal_copy (e->val); ret->loc = fileloc_copy (e->loc); ret->guards = guardSet_undefined; ret->uses = sRefSet_undefined; ret->sets = sRefSet_undefined; ret->msets = sRefSet_undefined; ret->kind = XPR_EMPTY; ret->sref = sRef_undefined; ret->etext = cstring_undefined; ret->exitCode = XK_NEVERESCAPE; ret->canBreak = FALSE; ret->mustBreak = FALSE; ret->isJumpPoint = FALSE; ret->edata = exprData_undefined; exprNode_defineConstraints(ret); return (ret); } } bool exprNode_isNullValue (exprNode e) { if (exprNode_isDefined (e)) { multiVal m = exprNode_getValue (e); if (multiVal_isInt (m)) { return (multiVal_forceInt (m) == 0); } } return FALSE; } static bool exprNode_isUnknownConstant (/*@notnull@*/ exprNode e) { while (e->kind == XPR_PARENS) { e = exprData_getUopNode (e->edata); if (!exprNode_isDefined (e)) { return FALSE; } /* evans 2002-02-05: was llassert (exprNode_isDefined (e)); but this can fail */ } if (e->kind == XPR_CONST) { multiVal m = exprNode_getValue (e); if (multiVal_isUnknown (m)) { return TRUE; } } return FALSE; } /*@only@*/ exprNode exprNode_numLiteral (ctype c, /*@temp@*/ cstring t, /*@only@*/ fileloc loc, long val) { exprNode e = exprNode_createLoc (c, loc); e->kind = XPR_NUMLIT; llassert (multiVal_isUndefined (e->val)); e->val = multiVal_makeInt (val); e->edata = exprData_makeLiteral (cstring_copy (t)); if (val == 0) { e->sref = sRef_makeUnknown (); sRef_setDefNull (e->sref, e->loc); } DPRINTF (("Num lit: %s / %s", exprNode_unparse (e), ctype_unparse (exprNode_getType (e)))); return (e); } /*@only@*/ exprNode exprNode_charLiteral (char c, cstring text, /*@only@*/ fileloc loc) { exprNode e = exprNode_createLoc (ctype_char, loc); if (context_getFlag (FLG_CHARINTLITERAL)) { e->typ = ctype_makeConj (ctype_char, ctype_int); } e->kind = XPR_NUMLIT; e->val = multiVal_makeChar (c); e->edata = exprData_makeLiteral (cstring_copy (text)); return (e); } /*@only@*/ exprNode exprNode_floatLiteral (double d, ctype ct, cstring text, /*@only@*/ fileloc loc) { exprNode e = exprNode_createLoc (ct, loc); e->kind = XPR_NUMLIT; e->val = multiVal_makeDouble (d); e->edata = exprData_makeLiteral (cstring_copy (text)); return (e); } multiVal exprNode_getValue (exprNode e) { while (exprNode_isInParens (e)) { if (e->edata != NULL) { e = exprData_getUopNode (e->edata); } else { break; } } if (exprNode_isDefined (e)) { return e->val; } else { return multiVal_undefined; } } /*@only@*/ exprNode exprNode_combineLiterals (exprNode e, exprNode rest) { cstring ns; /* Both must be string literals. */ if (exprNode_isUndefined (rest) || exprNode_isUndefined (e)) { exprNode_free (rest); return e; } if (!exprNode_isStringLiteral (e)) { voptgenerror (FLG_SYNTAX, message ("Constant concatentation is ungrammatical: %s %s", exprNode_unparse (e), exprNode_unparse (rest)), e->loc); exprNode_free (rest); return e; } if (!exprNode_isStringLiteral (rest)) { voptgenerror (FLG_SYNTAX, message ("Constant concatentation is ungrammatical: %s %s", exprNode_unparse (e), exprNode_unparse (rest)), rest->loc); exprNode_free (rest); return e; } ns = cstring_concat (multiVal_forceString (exprNode_getValue (e)), multiVal_forceString (exprNode_getValue (rest))); multiVal_free (e->val); exprData_free (e->edata, e->kind); e->edata = exprData_makeLiteral (cstring_copy (ns)); e->val = multiVal_makeString (ns); exprNode_free (rest); return e; } /*@only@*/ exprNode exprNode_rawStringLiteral (/*@only@*/ cstring t, /*@only@*/ fileloc loc) { exprNode e = exprNode_createLoc (ctype_string, loc); size_t len = cstring_length (t); if (context_getFlag (FLG_STRINGLITERALLEN)) { if (len > size_fromInt (context_getValue (FLG_STRINGLITERALLEN))) { voptgenerror (FLG_STRINGLITERALLEN, message ("String literal length (%d) exceeds maximum " "length (%d): \"%s\"", size_toInt (len), context_getValue (FLG_STRINGLITERALLEN), t), e->loc); } } e->kind = XPR_STRINGLITERAL; e->val = multiVal_makeString (cstring_copy (t)); e->edata = exprData_makeLiteral (t); e->sref = sRef_makeConst (ctype_string); if (context_getFlag (FLG_READONLYSTRINGS)) { sRef_setAliasKind (e->sref, AK_STATIC, fileloc_undefined); sRef_setExKind (e->sref, XO_OBSERVER, loc); } else { sRef_setAliasKind (e->sref, AK_ERROR, fileloc_undefined); } return (e); /* s released */ } /*@only@*/ exprNode exprNode_wideStringLiteral (/*@only@*/ cstring t, /*@only@*/ fileloc loc) { exprNode res = exprNode_stringLiteral (t, loc); res->typ = ctype_makeWideString (); return res; } /*@only@*/ exprNode exprNode_stringLiteral (/*@only@*/ cstring t, /*@only@*/ fileloc loc) { size_t len = size_fromInt (size_toInt (cstring_length (t)) - 2); char *ts = cstring_toCharsSafe (t); char *s = cstring_toCharsSafe (cstring_create (len + 1)); llassert (*ts == '\"' && *(ts + len + 1) == '\"'); strncpy (s, ts+1, len); *(s + len) = '\0'; cstring_free (t); return exprNode_rawStringLiteral (cstring_fromCharsO (s), loc); } exprNode exprNode_fromUIO (cstring c) { fileloc loc = context_getSaveLocation (); exprNode e = exprNode_createPlain (ctype_unknown); e->kind = XPR_VAR; if (fileloc_isUndefined (loc)) { loc = fileloc_copy (g_currentloc); } e->loc = loc; /* save loc was mangled */ e->sref = sRef_undefined; if (usymtab_exists (c)) { uentry ue = usymtab_lookupEither (c); if (uentry_isDatatype (ue) && uentry_isSpecified (ue)) { llfatalerror (message ("%q: Specified datatype %s used in code, but not defined. " "(Cannot continue reasonably from this error.)", fileloc_unparse (e->loc), c)); } else { BADBRANCH; } } llassertprint (!usymtab_exists (c), ("Entry exists: %s", c)); /* ** was supercedeGlobalEntry...is this better? */ if (!context_inIterEnd ()) { if (context_inMacro ()) { if (context_getFlag (FLG_UNRECOG)) { voptgenerror (FLG_MACROUNDEF, message ("Unrecognized identifier in macro definition: %s", c), e->loc); } else { flagcode_recordSuppressed (FLG_UNRECOG); } } else { voptgenerror (FLG_UNRECOG, message ("Unrecognized identifier: %s", c), e->loc); } } e->edata = exprData_makeId (uentry_makeUnrecognized (c, fileloc_copy (loc))); /* No alias errors for unrecognized identifiers */ sRef_setAliasKind (e->sref, AK_ERROR, loc); return (e); } exprNode exprNode_makeConstantString (cstring c, /*@only@*/ fileloc loc) { exprNode e = exprNode_createPlain (ctype_unknown); e->kind = XPR_VAR; e->loc = loc; e->sref = sRef_makeConst (ctype_string); e->edata = exprData_makeId (uentry_makeUnrecognized (c, fileloc_copy (loc))); e->typ = ctype_string; /* No alias errors for unrecognized identifiers */ sRef_setAliasKind (e->sref, AK_STATIC, loc); sRef_setExKind (e->sref, XO_OBSERVER, loc); return (e); } exprNode exprNode_createId (/*@observer@*/ uentry c) { if (uentry_isValid (c)) { exprNode e = exprNode_new (); DPRINTF (("create id: %s", uentry_unparse (c))); e->typ = uentry_getType (c); if (uentry_isFunction (c) && !sRef_isLocalVar (uentry_getSref (c))) { e->sref = sRef_undefined; } else { e->sref = uentry_getSref (c); } if (sRef_isStateUnknown (e->sref) && uentry_isNonLocal (c)) { sRef_setDefined (e->sref, fileloc_undefined); } /* ** yoikes! leaving this out was a heinous bug...that would have been ** caught if i had splint working first. gag! */ e->etext = cstring_undefined; if (uentry_isEitherConstant (c)) { e->kind = XPR_CONST; e->val = multiVal_copy (uentry_getConstantValue (c)); } else { e->kind = XPR_VAR; e->val = multiVal_unknown (); } e->edata = exprData_makeId (c); e->loc = context_getSaveLocation (); if (fileloc_isUndefined (e->loc)) { fileloc_free (e->loc); e->loc = fileloc_copy (g_currentloc); } e->guards = guardSet_new (); e->sets = sRefSet_new (); e->msets = sRefSet_new (); e->uses = sRefSet_new (); /*> missing fields, detected by splint <*/ e->exitCode = XK_NEVERESCAPE; e->isJumpPoint = FALSE; e->canBreak = FALSE; e->mustBreak = FALSE; exprNode_defineConstraints (e); return e; } else { return exprNode_createUnknown (); } } /*@notnull@*/ exprNode exprNode_fromIdentifier (/*@observer@*/ uentry c) { exprNode ret; if (context_justPopped ()) /* watch out! c could be dead */ { uentry ce = usymtab_lookupSafe (cscannerHelp_observeLastIdentifier ()); if (uentry_isValid (ce)) { c = ce; } else { llbuglit ("Looks like Aunt Millie forgot to walk to dog again."); } } ret = exprNode_fromIdentifierAux (c); return ret; } static void exprNode_checkStringLiteralLength (ctype t1, exprNode e2) { multiVal mval = exprNode_getValue (e2); cstring slit; size_t len; if (ctype_isFixedArray (t1)) { size_t nelements = ctype_getArraySize (t1); llassert (multiVal_isString (mval)); slit = multiVal_forceString (mval); len = cstring_lengthExpandEscapes (slit); llassert (exprNode_isDefined (e2)); if (len == nelements) { mstring temp; temp = cstring_expandEscapes (slit); if (temp[len-1] == '\0') { voptgenerror (FLG_STRINGLITNOROOMFINALNULL, message ("String literal with %d character%& " "is assigned to %s (no room for final null terminator): %s", size_toInt (len + 1), ctype_unparse (t1), exprNode_unparse (e2)), e2->loc); } else { voptgenerror (FLG_STRINGLITNOROOM, message ("String literal with %d character%& " "is assigned to %s (no room for null terminator): %s", size_toInt (len + 1), ctype_unparse (t1), exprNode_unparse (e2)), e2->loc); } } else if (len > nelements) { voptgenerror (FLG_STRINGLITTOOLONG, message ("String literal with %d character%& (counting null terminator) " "is assigned to %s (insufficient storage available): %s", size_toInt (len + 1), ctype_unparse (t1), exprNode_unparse (e2)), e2->loc); } else if (len < nelements - 1) { voptgenerror (FLG_STRINGLITSMALLER, message ("String literal with %d character%& is assigned to %s (possible waste of storage): %s", size_toInt (len + 1), ctype_unparse (t1), exprNode_unparse (e2)), e2->loc); } else { ; /* okay */ } } } static /*@only@*/ /*@notnull@*/ exprNode exprNode_fromIdentifierAux (/*@observer@*/ uentry c) { exprNode e = exprNode_createId (c); sRef sr = e->sref; uentry_setUsed (c, e->loc); if (uentry_isVar (c) && sRef_isFileOrGlobalScope (sr)) { checkGlobUse (c, FALSE, e); } return (e); } static bool exprNode_isZero (exprNode e) { if (exprNode_isDefined (e)) { multiVal m = exprNode_getValue (e); if (multiVal_isInt (m)) { return (multiVal_forceInt (m) == 0); } } return FALSE; } static bool exprNode_isNonNegative (exprNode e) { if (exprNode_isDefined (e)) { multiVal m = exprNode_getValue (e); if (multiVal_isInt (m)) { return (multiVal_forceInt (m) >= 0); } /* ** This is not always true if programmer defines enum ** values, but then the constant should be known. */ if (ctype_isEnum (ctype_realType (e->typ))) { return TRUE; } } return FALSE; } /* ** a[x] - uses a but NOT a[] ** result sref = a[] (set/use in assignment) ** ** The syntax x[a] is also legal in C, and has the same ** semantics. If ind is an array, and arr is an int, flip ** the arguments. */ /*@only@*/ exprNode exprNode_arrayFetch (/*@only@*/ exprNode e1, /*@only@*/ exprNode e2) { /* ** error in arr, error propagates (no new messages) ** error in ind, assume valid and continue */ DPRINTF (("Array fetch: %s / %s", exprNode_unparse (e1), exprNode_unparse (e2))); if (exprNode_isError (e1)) { exprNode_free (e2); return (exprNode_makeError ()); } else { exprNode arr; exprNode ind; ctype carr = exprNode_getType (e1); ctype crarr = ctype_realType (carr); /* ** this sets up funny aliasing, that leads to spurious ** splint errors. Hence, the i2 comments. */ /* evans 2001-09-09 added ctype_isKnown so there is no swap when e1 type is unknown */ if (ctype_isKnown (crarr) && !ctype_isRealArray (crarr) && ctype_isRealNumeric (crarr) && !exprNode_isError (e2) && ctype_isRealAP (exprNode_getType (e2))) /* fetch like 3[a] */ { arr = e2; ind = e1; carr = exprNode_getType (arr); crarr = ctype_realType (carr); } else { arr = e1; ind = e2; } DPRINTF (("arr: %s", exprNode_unparse (arr))); if (sRef_possiblyNull (arr->sref)) { if (!usymtab_isGuarded (arr->sref)) { if (!context_inSizeof() ) { if (optgenerror (FLG_NULLDEREF, message ("Index of %s pointer %q: %s", sRef_nullMessage (arr->sref), sRef_unparse (arr->sref), exprNode_unparse (arr)), arr->loc)) { DPRINTF (("ref: %s", sRef_unparseFull (arr->sref))); sRef_showNullInfo (arr->sref); /* suppress future messages */ sRef_setNullError (arr->sref); } } } } if (exprNode_isError (ind)) { if ((ctype_isArrayPtr (crarr) && !ctype_isFunction (crarr)) || ctype_isUnknown (carr)) { exprNode ret = exprNode_createPartialCopy (arr); if (ctype_isKnown (carr)) { ret->typ = ctype_baseArrayPtr (crarr); } else { ret->typ = ctype_unknown; } ret->sref = sRef_makeArrayFetch (arr->sref); ret->kind = XPR_FETCH; /* ** Because of funny aliasing (when arr and ind are ** flipped) spurious errors would be reported here. */ /*@i2@*/ ret->edata = exprData_makePair (arr, ind); checkSafeUse (ret, arr->sref); return (ret); } else { voptgenerror (FLG_TYPE, message ("Array fetch from non-array (%t): %s[%s]", carr, exprNode_unparse (e1), exprNode_unparse (e2)), arr->loc); exprNode_free (arr); return (exprNode_makeError ()); } } else { if (!ctype_isForceRealInt (&(ind->typ))) { ctype rt = ctype_realType (ind->typ); if (ctype_isChar (rt)) { vnoptgenerror (FLG_CHARINDEX, message ("Array fetch using non-integer, %t: %s[%s]", ind->typ, exprNode_unparse (e1), exprNode_unparse (e2)), arr->loc); } else if (ctype_isEnum (rt)) { vnoptgenerror (FLG_ENUMINDEX, message ("Array fetch using non-integer, %t: %s[%s]", ind->typ, exprNode_unparse (e1), exprNode_unparse (e2)), arr->loc); } else if (ctype_isNumAbstract (rt)) { vnoptgenerror (FLG_NUMABSTRACTINDEX, message ("Array fetch using numabstract type, %t: %s[%s]", ind->typ, exprNode_unparse (e1), exprNode_unparse (e2)), arr->loc); } else { voptgenerror (FLG_TYPE, message ("Array fetch using non-integer, %t: %s[%s]", ind->typ, exprNode_unparse (e1), exprNode_unparse (e2)), arr->loc); } multiVal_free (ind->val); ind->val = multiVal_unknown (); } if (ctype_isArrayPtr (crarr) && !ctype_isFunction (crarr)) { exprNode ret = exprNode_createSemiCopy (arr); multiVal m = exprNode_getValue (ind); ret->typ = ctype_baseArrayPtr (crarr); ret->kind = XPR_FETCH; if (multiVal_isInt (m)) { int i = (int) multiVal_forceInt (m); if (sRef_isValid (arr->sref)) { ret->sref = sRef_makeArrayFetchKnown (arr->sref, i); } else { ret->sref = sRef_undefined; } } else { ret->sref = sRef_makeArrayFetch (arr->sref); } ret->sets = sRefSet_realNewUnion (arr->sets, ind->sets); ret->msets = sRefSet_realNewUnion (arr->msets, ind->msets); ret->uses = sRefSet_realNewUnion (arr->uses, ind->uses); /* (see comment on spurious errors above) */ /*@i2@*/ ret->edata = exprData_makePair (arr, ind); exprNode_checkUse (ret, ind->sref, ind->loc); exprNode_checkUse (ret, arr->sref, arr->loc); return (ret); } else { if (ctype_isUnknown (carr)) { exprNode ret = exprNode_createPartialCopy (arr); ret->kind = XPR_FETCH; ret->typ = ctype_unknown; ret->sets = sRefSet_union (ret->sets, ind->sets); ret->msets = sRefSet_union (ret->msets, ind->msets); ret->uses = sRefSet_union (ret->uses, ind->uses); /* (see comment on spurious errors above) */ /*@i2@*/ ret->edata = exprData_makePair (arr, ind); exprNode_checkUse (ret, ind->sref, ind->loc); exprNode_checkUse (ret, arr->sref, arr->loc); return (ret); } else { voptgenerror (FLG_TYPE, message ("Array fetch from non-array (%t): %s[%s]", carr, exprNode_unparse (e1), exprNode_unparse (e2)), arr->loc); exprNode_free (arr); exprNode_free (ind); return (exprNode_makeError ()); } } } } BADEXIT; } static int checkArgs (uentry fcn, /*@dependent@*/ exprNode f, ctype t, exprNodeList args, exprNode ret) { return (checkArgsReal (fcn, f, ctype_argsFunction (t), args, FALSE, ret)); } /* ** checkPrintfArgs --- checks arguments for printf-like functions ** Arguments before ... have already been checked. ** The argument before the ... is a char *. ** argno is the format string argument. */ static void checkPrintfArgs (/*@notnull@*/ /*@dependent@*/ exprNode f, uentry fcn, exprNodeList args, exprNode ret, int argno) { /* ** the last argument before the elips is the format string */ int i = argno; fileloc formatloc; int nargs = exprNodeList_size (args); uentryList params = uentry_getParams (fcn); exprNode a; /* ** These should be ensured by checkSpecialFunction */ llassert (uentryList_size (params) == argno + 1); llassert (uentry_isElipsisMarker (uentryList_getN (params, argno))); a = exprNodeList_getN (args, argno - 1); formatloc = fileloc_copy (exprNode_loc (a)); if (exprNode_isDefined (a) && exprNode_isStringLiteral (a) && exprNode_knownStringValue (a)) { char *format = cstring_toCharsSafe (multiVal_forceString (exprNode_getValue (a))); char *code = format; char *ocode = code; nargs = exprNodeList_size (args); while ((code = strchr (code, '%')) != NULL) { char *origcode = code; cstring codetext = cstring_newEmpty (); char key = *(++code); ctype modtype = ctype_int; bool modified = FALSE; fileloc_addColumn (formatloc, code - ocode); codetext = cstring_appendChar (codetext, key); /* ignore flags */ while (isFlagKey (key)) { key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } if (key == 'm') /* skipped in syslog */ { continue; } /* ignore field width */ while (isdigit ((int) key) != 0) { key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } /* ignore precision */ if (key == '.') { key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); /* ** In printf, '*' means: read the next arg as an int for the ** field width. This seems to be missing from my copy of the ** standard x3.159-1989. Setion 4.9.6.1 refers to * (described ** later) but never does. */ if (key == '*') { ; /* don't do anything --- handle later */ } else { while (isdigit ((int) key) != 0) { key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } } } if (key == 'h') { modtype = ctype_sint; /* short */ key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } else if (key == 'l' || key == 'L') { modtype = ctype_lint; /* long */ key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); if (key == 'l' || key == 'L') { modtype = ctype_llint; /* long long */ key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } } else { ; /* no modifier */ } /* now, key = type of conversion to apply */ ++code; fileloc_incColumn (formatloc); if (key != '%') { if (i >= nargs) { if (optgenerror (FLG_TYPE, message ("No argument corresponding to %q format " "code %d (%%%s): \"%s\"", uentry_getName (fcn), i, codetext, cstring_fromChars (format)), f->loc)) { if (fileloc_isDefined (formatloc) && context_getFlag (FLG_SHOWCOL)) { llgenindentmsg (cstring_makeLiteral ("Corresponding format code"), formatloc); } } i++; } else { a = exprNodeList_getN (args, i); i++; if (!exprNode_isError (a)) { ctype expecttype; switch (key) { case '*': /* int argument for fieldwidth */ expecttype = ctype_int; *(--code) = '%'; /* convert it for next code */ fileloc_subColumn (formatloc, 1); /*@switchbreak@*/ break; case 'u': case 'o': expecttype = ctype_combine (ctype_uint, modtype); /*@switchbreak@*/ break; case 'i': /* int argument */ case 'd': expecttype = ctype_combine (ctype_int, modtype); /*@switchbreak@*/ break; case 'x': /* unsigned int */ case 'X': expecttype = ctype_combine (ctype_uint, modtype); /*@switchbreak@*/ break; case 'e': case 'E': case 'g': case 'G': case 'f': /* double */ expecttype = ctype_combine (ctype_double, modtype); /*@switchbreak@*/ break; case 'c': /* int converted to char (check its a char?) */ expecttype = ctype_makeConj (ctype_int, ctype_makeConj (ctype_char, ctype_uchar)); /* evans 2001-10-05 - changed to reflect correct ISO spec: int converted to char */ /*@switchbreak@*/ break; case 's': /* string */ expecttype = ctype_string; /*@switchbreak@*/ break; case '[': /* skip to ']' */ while (((key = *(++code)) != ']') && (key != '\0')) { codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } if (key == '\0') { llfatalerrorLoc (message ("Bad character set format: %s", cstring_fromChars (origcode))); } expecttype = ctype_string; /*@switchbreak@*/ break; case 'p': /* pointer */ expecttype = ctype_makePointer (ctype_void); /* need not be defined */ uentry_setDefState (regArg, SS_RELDEF); sRef_setPosNull (uentry_getSref (regArg), fileloc_undefined); /* could be null */ /*@switchbreak@*/ break; case 'n': /* pointer to int, modified by call! */ expecttype = ctype_combine (ctype_makePointer (ctype_int), modtype); modified = TRUE; uentry_setDefState (regArg, SS_ALLOCATED); /* corresponds to out */ /*@switchbreak@*/ break; case 'm': /* in a syslog, it doesn't consume an argument */ /* should check we're really doing syslog */ /*@switchbreak@*/ break; default: expecttype = ctype_unknown; voptgenerror (FLG_FORMATCODE, message ("Unrecognized format code: %s", cstring_fromChars (origcode)), fileloc_isDefined (formatloc) ? formatloc : g_currentloc); /*@switchbreak@*/ break; } if (!(exprNode_matchArgType (expecttype, a))) { if (ctype_isVoidPointer (expecttype) && ctype_isRealAbstract (a->typ) && (context_getFlag (FLG_ABSTVOIDP))) { ; } else { if (llgenformattypeerror (expecttype, exprNode_undefined, a->typ, a, message ("Format argument %d to %q (%%%s) expects " "%t gets %t: %s", i - argno, uentry_getName (fcn), codetext, expecttype, a->typ, exprNode_unparse (a)), a->loc)) { if (fileloc_isDefined (formatloc) && context_getFlag (FLG_SHOWCOL)) { llgenindentmsg (cstring_makeLiteral ("Corresponding format code"), formatloc); } } } } uentry_setType (regArg, expecttype); checkOneArg (regArg, a, f, FALSE, i+1, nargs); if (ctype_equal (expecttype, ctype_string)) { exprNode_checkUse (a, sRef_makePointer (a->sref), a->loc); } uentry_setType (regArg, ctype_unknown); uentry_fixupSref (regArg); if (modified) { exprNode_checkCallModifyVal (a->sref, args, f, ret); } } else { ; } } } ocode = code; cstring_free (codetext); } if (i < nargs) { voptgenerror (FLG_TYPE, message ("Format string for %q has %d arg%&, given %d", uentry_getName (fcn), i - argno, nargs - argno), f->loc); } } else { /* no checking possible for compile-time unknown format strings */ if (exprNode_isDefined (a)) { voptgenerror (FLG_FORMATCONST, message ("Format string parameter to %s is not a compile-time constant: %s", exprNode_unparse (f), exprNode_unparse (a)), f->loc); } } fileloc_free (formatloc); } static void checkScanfArgs (/*@notnull@*/ /*@dependent@*/ exprNode f, uentry fcn, exprNodeList args, exprNode ret, int argno) { int i = argno; fileloc formatloc; int nargs = exprNodeList_size (args); uentryList params = uentry_getParams (fcn); exprNode a; /* ** These should be ensured by checkSpecialFunction */ llassert (uentryList_size (params) == argno + 1); llassert (uentry_isElipsisMarker (uentryList_getN (params, argno))); a = exprNodeList_getN (args, argno - 1); formatloc = fileloc_copy (exprNode_loc (a)); if (exprNode_isDefined (a) && exprNode_isStringLiteral (a) && exprNode_knownStringValue (a)) { char *format = cstring_toCharsSafe (multiVal_forceString (exprNode_getValue (a))); char *code = format; char *ocode = code; nargs = exprNodeList_size (args); while ((code = strchr (code, '%')) != NULL) { char *origcode = code; char key = *(++code); cstring codetext = cstring_newEmpty (); ctype modtype = ctype_int; char modifier = '\0'; bool modified = TRUE; bool ignore = FALSE; codetext = cstring_appendChar (codetext, key); fileloc_addColumn (formatloc, code - ocode); /* ** this is based on ANSI standard library description of fscanf ** (from ANSI standard X3.159-1989, 4.9.6.1) */ /* '*' suppresses assignment (does not need match argument) */ if (key == '*') { key = *(++code); codetext = cstring_appendChar (codetext, key); modified = FALSE; ignore = TRUE; fileloc_incColumn (formatloc); } /* ignore field width */ while (isdigit ((int) key) != 0) { key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } if (key == 'h') { modtype = ctype_sint; /* short */ key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } else if (key == 'l' || key == 'L') { modtype = ctype_lint; /* long */ modifier = key; key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); if (key == 'l' || key == 'L') { modtype = ctype_llint; /* long long */ key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } } else { ; /* no modifier */ } /* now, key = type of conversion to apply */ ++code; fileloc_incColumn (formatloc); if (key != '%') { if (ignore) { ; } else { if (i >= nargs) { if (optgenerror (FLG_TYPE, message ("No argument corresponding to %q format " "code %d (%%%s): \"%s\"", uentry_getName (fcn), i, codetext, cstring_fromChars (format)), f->loc)) { if (fileloc_isDefined (formatloc) && context_getFlag (FLG_SHOWCOL)) { llgenindentmsg (cstring_makeLiteral ("Corresponding format code"), formatloc); } } i++; } else { a = exprNodeList_getN (args, i); i++; if (!exprNode_isError (a)) { ctype expecttype; switch (key) { case '*': /* int argument for fieldwidth */ expecttype = ctype_makePointer (ctype_int); *(--code) = '%'; /* convert it for next code */ fileloc_subColumn (formatloc, 1); /*@switchbreak@*/ break; case 'u': case 'o': expecttype = ctype_makePointer (ctype_combine (ctype_uint, modtype)); /*@switchbreak@*/ break; case 'i': case 'd': expecttype = ctype_makePointer (ctype_combine (ctype_int, modtype)); /*@switchbreak@*/ break; case 'x': case 'X': /* unsigned int */ expecttype = ctype_makePointer (ctype_combine (ctype_uint, modtype)); /*@switchbreak@*/ break; case 'e': case 'E': case 'g': case 'G': case 'f': /* printf is double, scanf is float! */ if (modifier == 'l') { expecttype = ctype_makePointer (ctype_double); } else if (modifier == 'L') { expecttype = ctype_makePointer (ctype_ldouble); } else { llassert (modifier == '\0'); expecttype = ctype_makePointer (ctype_float); } /*@switchbreak@*/ break; case 'c': /* int converted to char (check its a char?) */ expecttype = ctype_makePointer (ctype_makeConj (ctype_char, ctype_uchar)); /*@switchbreak@*/ break; case 's': /* string */ expecttype = ctype_string; /*@switchbreak@*/ break; case '[': /* skip to ']' */ while (((key = *(++code)) != ']') && (key != '\0')) { codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } if (key == '\0') { llfatalerrorLoc (message ("Bad character set format: %s", cstring_fromChars (origcode))); } expecttype = ctype_string; /*@switchbreak@*/ break; case 'p': /* pointer */ voptgenerror (FLG_FORMATCODE, message ("Format code should not be used in scanf: %s", cstring_fromChars (origcode)), fileloc_isDefined (formatloc) ? formatloc : g_currentloc); expecttype = ctype_unknown; /*@switchbreak@*/ break; case 'n': /* pointer to int, modified by call! */ expecttype = ctype_makePointer (ctype_int); /*@switchbreak@*/ break; default: expecttype = ctype_unknown; voptgenerror (FLG_FORMATCODE, message ("Unrecognized format code: %s", cstring_fromChars (origcode)), fileloc_isDefined (formatloc) ? formatloc : g_currentloc); /*@switchbreak@*/ break; } if (!(exprNode_matchArgType (expecttype, a))) { if (ctype_isVoidPointer (expecttype) && ctype_isRealAbstract (a->typ) && (context_getFlag (FLG_ABSTVOIDP))) { ; } else { if (llgenformattypeerror (expecttype, exprNode_undefined, a->typ, a, message ("Format argument %d to %q (%%%s) expects " "%t gets %t: %s", i - argno, uentry_getName (fcn), codetext, expecttype, a->typ, exprNode_unparse (a)), a->loc)) { if (fileloc_isDefined (formatloc) && context_getFlag (FLG_SHOWCOL)) { llgenindentmsg (cstring_makeLiteral ("Corresponding format code"), formatloc); } } } } uentry_setType (outArg, expecttype); checkOneArg (outArg, a, f, FALSE, i+1, nargs); uentry_setType (outArg, ctype_unknown); uentry_fixupSref (outArg); if (modified) { exprNode_checkCallModifyVal (a->sref, args, f, ret); } } else { /* a->sref = sRef_undefined; */ } } } } ocode = code; cstring_free (codetext); } if (i < nargs) { voptgenerror (FLG_TYPE, message ("Format string for %q has %d arg%&, given %d", uentry_getName (fcn), i - argno, nargs - argno), f->loc); } } else { /* no checking possible for compile-time unknown format strings */ } fileloc_free (formatloc); } static void checkMessageArgs (/*@notnull@*/ /*@dependent@*/ exprNode f, uentry fcn, exprNodeList args, /*@unused@*/ int argno) { /* ** the last argument before the elips is the format string */ int nargs = exprNodeList_size (args); int i = argno; fileloc formatloc; exprNode a; a = exprNodeList_getN (args, argno - 1); formatloc = fileloc_copy (exprNode_loc (a)); if (ctype_isUnknown (cstringType)) { if (usymtab_existsType (cstring_makeLiteralTemp ("cstring"))) { cstringType = usymtab_lookupAbstractType (cstring_makeLiteralTemp ("cstring")); } } if (ctype_isUnknown (ctypeType)) { if (usymtab_existsType (cstring_makeLiteralTemp ("ctype"))) { ctypeType = usymtab_lookupAbstractType (cstring_makeLiteralTemp ("ctype")); } } if (ctype_isUnknown (filelocType)) { if (usymtab_existsType (cstring_makeLiteralTemp ("fileloc"))) { filelocType = usymtab_lookupAbstractType (cstring_makeLiteralTemp ("fileloc")); } } if (exprNode_isDefined (a) && exprNode_isStringLiteral (a) && exprNode_knownStringValue (a)) { cstring format = multiVal_forceString (exprNode_getValue (a)); char *code = cstring_toCharsSafe (format); char *ocode = code; nargs = exprNodeList_size (args); while ((code = strchr (code, '%')) != NULL) { char *origcode = code; char key = *(++code); cstring codetext = cstring_newEmpty (); bool isOnly = FALSE; codetext = cstring_appendChar (codetext, key); fileloc_addColumn (formatloc, code - ocode); while (key >= '0' && key <= '9') { key = *(++code); codetext = cstring_appendChar (codetext, key); fileloc_incColumn (formatloc); } ++code; fileloc_incColumn (formatloc); if (key != '%') { if (key == '&') /* plural marker */ { goto nextKey; } if (i >= nargs) { voptgenerror (FLG_TYPE, message ("Message missing format arg %d (%%%s): \"%s\"", i + 1, codetext, format), f->loc); i++; } else { a = exprNodeList_getN (args, i); i++; nextKey: if (!exprNode_isError (a)) { ctype expecttype; /*@-loopswitchbreak@*/ switch (key) { case 'c': case 'h': expecttype = ctype_char; break; case 's': expecttype = cstringType; break; case 'q': expecttype = cstringType; isOnly = TRUE; break; case 'x': expecttype = cstringType; isOnly = TRUE; break; case 'd': expecttype = ctype_int; break; case 'u': expecttype = ctype_uint; break; case 'w': expecttype = ctype_ulint; break; case 'f': expecttype = ctype_float; break; case 'b': expecttype = ctype_bool; break; case 't': expecttype = ctypeType; break; case 'p': expecttype = ctype_makePointer (ctype_void); /* need not be defined */ uentry_setDefState (regArg, SS_RELDEF); sRef_setPosNull (uentry_getSref (regArg), fileloc_undefined); /* could be null */ /*@switchbreak@*/ break; case 'l': expecttype = filelocType; break; case '&': /* a wee bit of a hack methinks */ expecttype = ctype_int; break; case 'r': expecttype = ctype_bool; break; default: expecttype = ctype_unknown; voptgenerror (FLG_FORMATCODE, message ("Unrecognized format code: %s", cstring_fromChars (origcode)), fileloc_isDefined (formatloc) ? formatloc : g_currentloc); break; } /*@=loopswitchbreak@*/ if (!(exprNode_matchArgType (expecttype, a))) { if (ctype_isVoidPointer (expecttype) && ctype_isRealAbstract (a->typ) && (context_getFlag (FLG_ABSTVOIDP))) { ; } else { if (llgenformattypeerror (expecttype, exprNode_undefined, a->typ, a, message ("Format argument %d to %q (%%%s) expects " "%t gets %t: %s", i - argno, uentry_getName (fcn), codetext, expecttype, a->typ, exprNode_unparse (a)), a->loc)) { if (fileloc_isDefined (formatloc) && context_getFlag (FLG_SHOWCOL)) { llgenindentmsg (cstring_makeLiteral ("Corresponding format code"), formatloc); } } } } if (ctype_equal (expecttype, cstringType)) { if (isOnly) { checkOneArg (csOnlyArg, a, f, FALSE, i+1, nargs); uentry_fixupSref (csOnlyArg); } else { checkOneArg (csArg, a, f, FALSE, i+1, nargs); uentry_fixupSref (csArg); } } else { checkOneArg (regArg, a, f, FALSE, i+1, nargs); uentry_fixupSref (regArg); } } } } cstring_free (codetext); } if (i < nargs) { voptgenerror (FLG_TYPE, message ("Format string for %q has %d arg%&, given %d", uentry_getName (fcn), i - argno, nargs -argno), f->loc); } } else { /* no checking possible for compile-time unknown format strings */ } fileloc_free (formatloc); } static void checkExpressionDefinedAux (/*@notnull@*/ exprNode e1, /*@notnull@*/ exprNode e2, sRefSet sets1, sRefSet sets2, lltok op, flagcode flag) { bool hadUncon = FALSE; if (sRef_isFileOrGlobalScope (sRef_getRootBase (e1->sref)) && sRefSet_hasUnconstrained (sets2)) { voptgenerror (FLG_EVALORDERUNCON, message ("Expression may have undefined behavior (%q used in right operand " "may set global variable %q used in left operand): %s %s %s", sRefSet_unparseUnconstrained (sets2), sRef_unparse (sRef_getRootBase (e1->sref)), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } if (sRef_isFileOrGlobalScope (sRef_getRootBase (e2->sref)) && sRefSet_hasUnconstrained (sets1)) { voptgenerror (FLG_EVALORDERUNCON, message ("Expression has undefined behavior (%q used in left operand " "may set global variable %q used in right operand): %s %s %s", sRefSet_unparseUnconstrained (sets1), sRef_unparse (e2->sref), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } sRefSet_realElements (e1->uses, sr) { if (sRef_isMeaningful (sr) && sRefSet_member (sets2, sr)) { voptgenerror (FLG_EVALORDER, message ("Expression has undefined behavior (left operand uses %q, " "modified by right operand): %s %s %s", sRef_unparse (sr), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } } end_sRefSet_realElements; sRefSet_realElements (sets1, sr) { if (sRef_isMeaningful (sr)) { if (sRef_same (sr, e2->sref)) { voptgenerror (flag, message ("Expression has undefined behavior (value of right operand " "modified by left operand): %s %s %s", exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } else if (sRefSet_member (e2->uses, sr)) { voptgenerror (flag, message ("Expression has undefined behavior (left operand modifies %q, " "used by right operand): %s %s %s", sRef_unparse (sr), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } else { if (sRefSet_member (sets2, sr)) { if (sRef_isUnconstrained (sr)) { if (hadUncon) { ; } else { hadUncon = optgenerror (FLG_EVALORDERUNCON, message ("Expression may have undefined behavior. Left operand " "calls %q; right operand calls %q. The unconstrained " "functions may modify global state used by " "the other operand): %s %s %s", sRefSet_unparseUnconstrained (sets1), sRefSet_unparseUnconstrained (sets2), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } } else { voptgenerror (flag, message ("Expression has undefined behavior (both " "operands modify %q): %s %s %s", sRef_unparse (sr), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } } } } } end_sRefSet_realElements; } static void checkExpressionDefined (exprNode e1, exprNode e2, lltok op) { bool hasError = FALSE; if (exprNode_isError (e1) || exprNode_isError (e2)) { return; } if (sRefSet_member (e2->sets, e1->sref)) { if (e2->kind == XPR_CALL) { ; } else { hasError = optgenerror (FLG_EVALORDER, message ("Expression has undefined behavior " "(value of left operand %s is modified " "by right operand %s): %s %s %s", exprNode_unparse (e1), exprNode_unparse (e2), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } } if (context_getFlag (FLG_EVALORDERUNCON)) { if (sRefSet_member (e2->msets, e1->sref)) { if (e2->kind == XPR_CALL) { ; } else { hasError = optgenerror (FLG_EVALORDER, message ("Expression has undefined behavior (value of left " "operand may be modified by right operand): %s %s %s", exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } } } if (!hasError) { checkExpressionDefinedAux (e1, e2, e1->sets, e2->sets, op, FLG_EVALORDER); if (context_maybeSet (FLG_EVALORDERUNCON)) { checkExpressionDefinedAux (e1, e2, e1->msets, e2->msets, op, FLG_EVALORDERUNCON); } } } static void checkSequencing (exprNode p_f, exprNodeList p_args); static int checkArgsReal (uentry fcn, /*@dependent@*/ exprNode f, uentryList cl, exprNodeList args, bool isIter, exprNode ret) { int special = 0; if (!exprNode_isError (f)) { if (!uentryList_isMissingParams (cl)) { int nargs = exprNodeList_size (args); int expectargs = uentryList_size (cl); ctype last; int i = 0; if (expectargs == 0) { if (nargs != 0) { if (isIter) { voptgenerror (FLG_TYPE, message ("Iter %q invoked with %d args, " "declared void", uentry_getName (fcn), nargs), f->loc); } else { voptgenerror (FLG_TYPE, message ("Function %s called with %d args, " "declared void", exprNode_unparse (f), nargs), f->loc); } } return special; } last = uentry_getType (uentryList_getN (cl, expectargs - 1)); exprNodeList_reset (args); uentryList_elements (cl, current) { ctype ct = uentry_getType (current); exprNode a; if (ctype_isElips (ct)) { /* ** do special checking for printf/scanf library functions ** ** this is kludgey code, just for handling the special case ** */ if (uentry_isPrintfLike (fcn)) { checkPrintfArgs (f, fcn, args, ret, i); special = i; } else if (uentry_isScanfLike (fcn)) { checkScanfArgs (f, fcn, args, ret, i); special = i; } else if (uentry_isMessageLike (fcn)) { checkMessageArgs (f, fcn, args, i); special = i; } else { llassert (!uentry_isSpecialFunction (fcn)); } nargs = expectargs; /* avoid errors */ break; } else { if (i >= nargs) break; a = exprNodeList_current (args); exprNodeList_advance (args); i++; if (exprNode_isError (a)) { ; } else { /* probably necessary? I'm not sure about this one checkMacroParen (a); */ f->guards = guardSet_union (f->guards, a->guards); DPRINTF (("match arg: %s / %s", ctype_unparse (ct), ctype_unparse (a->typ))); if (!(exprNode_matchArgType (ct, a))) { DPRINTF (("Args mismatch!")); if (ctype_isVoidPointer (ct) && (ctype_isPointer (a->typ) && (ctype_isRealAbstract (ctype_baseArrayPtr (a->typ))))) { vnoptgenerror (FLG_ABSTVOIDP, message ("Pointer to abstract type (%t) used " "as void pointer " "(arg %d to %q): %s", a->typ, i, uentry_getName (fcn), exprNode_unparse (a)), a->loc); } else { if (isIter) { (void) gentypeerror (ct, exprNode_undefined, a->typ, a, message ("Iter %q expects arg %d to " "be %t gets %t: %s", uentry_getName (fcn), i, ct, a->typ, exprNode_unparse (a)), a->loc); } else { if (gentypeerror (ct, exprNode_undefined, a->typ, a, message ("Function %q expects arg %d to be %t gets %t: %s", uentry_getName (fcn), i, ct, a->typ, exprNode_unparse (a)), a->loc)) { DPRINTF (("Types: %s / %s", ctype_unparse (ct), ctype_unparse (a->typ))); } /* ** Clear null marker for abstract types. ** (It is not revealed, so suppress future messages.) */ if (ctype_isAbstract (a->typ)) { sRef_setNullUnknown (exprNode_getSref (a), a->loc); } } } } } } } end_uentryList_elements ; if (expectargs != nargs) /* note: not != since we may have ... */ { if (ctype_isElips (last)) { voptgenerror (FLG_TYPE, message ("Function %s called with %d args, expects at least %d", exprNode_unparse (f), nargs, expectargs - 1), f->loc); } else { if (isIter) { voptgenerror (FLG_TYPE, message ("Iter %q invoked with %d args, expects %d", uentry_getName (fcn), nargs, expectargs), f->loc); } else { voptgenerror (FLG_TYPE, message ("Function %s called with %d args, expects %d", exprNode_unparse (f), nargs, expectargs), f->loc); } } } } } return special; } /* ** Check for undefined code sequences in function arguments: ** ** one parameter sets something used by another parameter ** one parameter sets something set by another parameter */ static void checkSequencingOne (exprNode f, exprNodeList args, /*@notnull@*/ exprNode el, int argno) { /* ** Do second loop, iff +undefunspec */ int checkloop; int numloops = context_maybeSet (FLG_EVALORDERUNCON) ? 2 : 1; for (checkloop = 0; checkloop < numloops; checkloop++) { sRefSet thissets; if (checkloop == 0) { thissets = el->sets; } else { llassert (checkloop == 1); thissets = el->msets; } sRefSet_realElements (thissets, thisset) { int j; /*@access exprNodeList@*/ for (j = 0; j < args->nelements; j++) { exprNode jl = args->elements[j]; int thisargno = j + 1; if (thisargno != argno && exprNode_isDefined (jl)) { sRefSet otheruses = jl->uses; if (sRef_isFileOrGlobalScope (sRef_getRootBase (jl->sref)) && sRefSet_hasUnconstrained (thissets)) { voptgenerror (FLG_EVALORDERUNCON, /*@-sefparams@*/ message ("%q used in argument %d may set " "global variable %q used by argument %d: %s(%q)", cstring_capitalizeFree (sRefSet_unparseUnconstrained (thissets)), /*@=sefparams@*/ argno, sRef_unparse (sRef_getRootBase (jl->sref)), thisargno, exprNode_unparse (f), exprNodeList_unparse (args)), el->loc); } if (sRefSet_member (otheruses, thisset)) { if (sRef_isUnconstrained (thisset)) { voptgenerror (FLG_EVALORDERUNCON, message ("Unconstrained functions used in arguments %d (%q) " "and %d (%s) may modify " "or use global state in undefined way: %s(%q)", argno, sRefSet_unparseUnconstrainedPlain (otheruses), thisargno, sRef_unconstrainedName (thisset), exprNode_unparse (f), exprNodeList_unparse (args)), el->loc); } else { voptgenerror (FLG_EVALORDER, message ("Argument %d modifies %q, used by argument %d " "(order of evaluation of actual parameters is " "undefined): %s(%q)", argno, sRef_unparse (thisset), thisargno, exprNode_unparse (f), exprNodeList_unparse (args)), el->loc); } } else { sRefSet othersets = jl->sets; if (sRefSet_member (othersets, thisset)) { if (sRef_isUnconstrained (thisset)) { voptgenerror (FLG_EVALORDERUNCON, message ("Unconstrained functions used in " "arguments %d (%q) and %d (%s) may modify " "or use global state in undefined way: %s(%q)", argno, sRefSet_unparseUnconstrainedPlain (othersets), thisargno, sRef_unconstrainedName (thisset), exprNode_unparse (f), exprNodeList_unparse (args)), el->loc); } else { voptgenerror (FLG_EVALORDER, message ("Argument %d modifies %q, set by argument %d (order of" " evaluation of actual parameters is undefined): %s(%q)", argno, sRef_unparse (thisset), thisargno, exprNode_unparse (f), exprNodeList_unparse (args)), el->loc); } } } } } /*@noaccess exprNodeList@*/ } end_sRefSet_realElements; } } static void checkSequencing (exprNode f, exprNodeList args) { if (exprNodeList_size (args) > 1) { int i; exprNode el; /*@access exprNodeList*/ for (i = 0; i < args->nelements; i++) { el = args->elements[i]; if (!exprNode_isError (el)) { checkSequencingOne (f, args, el, i + 1); } } /*@noaccess exprNodeList*/ } } /* ** requires le = exprNode_getUentry (f) */ static void checkGlobMods (/*@notnull@*/ /*@dependent@*/ exprNode f, uentry le, exprNodeList args, /*@notnull@*/ exprNode ret, int specialArgs) { bool isSpec = FALSE; bool hasMods = FALSE; cstring fname; globSet usesGlobs = globSet_undefined; sRefSet mods = sRefSet_undefined; bool freshMods = FALSE; uentryList params = uentryList_undefined; DPRINTF (("Check glob mods: %s", exprNode_unparse (ret))); /* ** check globals and modifies */ setCodePoint (); if (!uentry_isValid (le)) { ctype fr = ctype_realType (f->typ); if (ctype_isFunction (fr)) { params = ctype_argsFunction (fr); } else { params = uentryList_missingParams; } if (!context_getFlag (FLG_MODNOMODS) && !context_getFlag (FLG_GLOBUNSPEC)) { checkUnspecCall (f, params, args); } return; } fname = uentry_rawName (le); setCodePoint (); if (uentry_isFunction (le)) { params = uentry_getParams (le); mods = uentry_getMods (le); hasMods = uentry_hasMods (le); usesGlobs = uentry_getGlobs (le); isSpec = uentry_isSpecified (le); } else /* not a function */ { ctype ct = ctype_realType (uentry_getType (le)); llassertprint (uentry_isVar (le) && ctype_isFunction (ct), ("checkModGlobs: uentry not a function: %s", uentry_unparse (le))); params = ctype_argsFunction (ct); return; /* No checking for non-function */ } /* ** check globals */ setCodePoint (); globSet_allElements (usesGlobs, el) { if (sRef_isValid (el)) { if (sRef_isInternalState (el) || sRef_isSystemState (el)) { context_usedGlobal (el); exprNode_checkUse (f, el, f->loc); if (context_checkInternalUse ()) { if (!context_globAccess (el)) { if (sRef_isSystemState (el) && !context_getFlag (FLG_MODFILESYSTEM)) { ; } else { voptgenerror (FLG_INTERNALGLOBS, message ("Called procedure %s may access %q, but " "globals list does not include globals %s", exprNode_unparse (f), sRef_unparse (el), cstring_makeLiteralTemp (sRef_isInternalState (el) ? "internalState" : "fileSystem")), f->loc); } } } } else if (sRef_isNothing (el) || sRef_isSpecState (el)) { ; } else { uentry gle = sRef_getUentry (el); sRef sr = sRef_updateSref (el); if (sRef_isUndefGlob (el)) { sRef_setDefined (sr, f->loc); exprNode_checkSet (f, sr); } else { /* ** check definition */ if (sRef_isAllocated (el)) { exprNode_checkSet (f, sr); } else { if (sRef_isStateUndefined (sr)) { voptgenerror (FLG_GLOBSTATE, message ("%s %q used by function undefined before call: %s", sRef_getScopeName (sr), sRef_unparse (sr), exprNode_unparse (f)), f->loc); sRef_setDefined (sr, f->loc); } exprNode_checkUse (f, sr, f->loc); } checkGlobUse (gle, TRUE, f); } if (sRef_isKilledGlob (el)) { sRef_kill (sr, f->loc); context_usedGlobal (sr); } } } } end_globSet_allElements; /* ** check modifies */ if (context_hasMods () || context_getFlag (FLG_MODNOMODS)) { sRefSet smods = sRefSet_undefined; /* ** NEED to check for modifies anything */ /* ** check each sRef that called function modifies (ml), is ** modifiable by tl */ setCodePoint (); sRefSet_allElements (mods, s) /* s is something which may be modified */ { DPRINTF (("Check modify: %s", sRef_unparse (s))); if (sRef_isKindSpecial (s)) { if (sRef_isSpecInternalState (s)) { if (context_getFlag (FLG_MODINTERNALSTRICT)) { exprNode_checkCallModifyVal (s, args, f, ret); } else { sRefSet mmods = context_modList (); sRefSet_allElements (mmods, el) { if (sRef_isInternalState (el)) { sRef_setModified (el); } } end_sRefSet_allElements ; } } else { exprNode_checkCallModifyVal (s, args, f, ret); } } else { sRef rb = sRef_getRootBase (s); if (sRef_isFileOrGlobalScope (rb)) { context_usedGlobal (rb); } if (sRef_isFileStatic (s) && !fileId_equal (fileloc_fileId (f->loc), fileloc_fileId (uentry_whereDefined (le)))) { smods = sRefSet_insert (smods, s); } else { exprNode_checkCallModifyVal (s, args, f, ret); } } } end_sRefSet_allElements; setCodePoint (); /* ** Static elements in modifies set can have nasty consequences. ** (I think...have not been able to reproduce a possible bug.) */ if (!sRefSet_isDefined (smods)) { mods = sRefSet_newCopy (mods); freshMods = TRUE; sRefSet_allElements (smods, el) { bool res = sRefSet_delete (mods, el); llassert (res); } end_sRefSet_allElements; sRefSet_free (smods); /*@-branchstate@*/ } /*@=branchstate@*/ } else if (sRefSet_isDefined (mods)) { /* just check observers */ setCodePoint (); sRefSet_allElements (mods, s) /* s is something which may be modified */ { sRef rb = sRef_getRootBase (s); setCodePoint (); if (sRef_isParam (rb)) { sRef b = sRef_fixBaseParam (s, args); if (sRef_isObserver (b)) { exprNode e = exprNodeList_nth (args, sRef_getParam (rb)); if (optgenerror (FLG_MODOBSERVER, message ("Function call may modify observer%q: %s", sRef_unparsePreOpt (b), exprNode_unparse (e)), exprNode_loc (e))) { sRef_showExpInfo (b); } } } } end_sRefSet_allElements; } else { if (!hasMods) /* no specified modifications */ { if (context_getFlag (FLG_MODOBSERVERUNCON)) { exprNodeList_elements (args, e) { if (exprNode_isDefined (e)) { sRef s = exprNode_getSref (e); if (sRef_isObserver (s) && ctype_isMutable (sRef_getType (s))) { if (optgenerror (FLG_MODOBSERVERUNCON, message ("Call to unconstrained function %s may modify observer%q: %s", exprNode_unparse (f), sRef_unparsePreOpt (s), exprNode_unparse (e)), exprNode_loc (e))) { sRef_showExpInfo (s); } } } } end_exprNodeList_elements; } } } checkAnyCall (f, fname, params, args, hasMods, mods, isSpec, specialArgs); ret->uses = sRefSet_union (ret->uses, f->uses); ret->sets = sRefSet_union (ret->sets, f->sets); ret->msets = sRefSet_union (ret->msets, f->msets); if (freshMods) { /* ** Spurious errors reported, because splint can't tell ** mods must be fresh if freshMods is true. */ /*@i@*/ sRefSet_free (mods); } setCodePoint (); } void checkGlobUse (uentry glob, bool isCall, /*@notnull@*/ exprNode e) { if (uentry_isVar (glob)) { if (context_inFunctionLike ()) { sRef sr = uentry_getSref (glob); context_usedGlobal (sr); if (context_checkGlobUse (glob)) { if (!context_globAccess (sr)) { if (isCall) { voptgenerror (FLG_GLOBALS, message ("Called procedure %s may access %s %q", exprNode_unparse (e), sRef_unparseScope (sr), uentry_getName (glob)), e->loc); } else { voptgenerror (FLG_GLOBALS, message ("Undocumented use of %s %s", sRef_unparseScope (sr), exprNode_unparse (e)), e->loc); } } } } } else { llbug (message ("Global not variable: %q", uentry_unparse (glob))); } } static void reflectEnsuresClause (exprNode ret, uentry le, exprNode f, exprNodeList args) { DPRINTF (("Reflect ensures clause: %s(%s) / %s / %s", exprNode_unparse (f), exprNodeList_unparse (args), uentry_unparseFull (le), stateClauseList_unparse (uentry_getStateClauseList (le)))); if (uentry_isValid (le) && uentry_isFunction (le)) { stateClauseList sclauses = uentry_getStateClauseList (le); if (stateClauseList_isDefined (sclauses)) { DPRINTF (("Reflect ensures: %s / %s / %s", uentry_unparse (le), exprNode_unparse (f), exprNodeList_unparse (args))); stateClauseList_elements (sclauses, cl) { if (stateClause_hasEnsures (cl)) { /* Same in usymtab.c:1904 */ if (stateClause_setsMetaState (cl)) { qual q = stateClause_getMetaQual (cl); annotationInfo ainfo = qual_getAnnotationInfo (q); metaStateInfo minfo = annotationInfo_getState (ainfo); cstring key = metaStateInfo_getName (minfo); int mvalue = annotationInfo_getValue (ainfo); sRefSet osrs = sRefSet_undefined; sRefSet srs; if (stateClause_isGlobal (cl)) { srs = sRefSet_single (usymtab_lookupGlobalMarker ()); osrs = srs; } else { srs = stateClause_getRefs (cl); } DPRINTF (("Reflect ensures clause: %s", stateClause_unparse (cl))); DPRINTF (("Sets meta state! %s", stateClause_unparse (cl))); sRefSet_elements (srs, sel) { sRef s; if (sRef_isResult (sRef_getRootBase (sel))) { s = exprNode_getSref (ret); } else { s = sRef_fixBaseParam (sel, args); } DPRINTF (("Reflecting state clause on: %s / %s", sRef_unparse (sel), sRef_unparse (s))); sRef_setMetaStateValueComplete (s, key, mvalue, exprNode_loc (f)); } end_sRefSet_elements; sRefSet_free (osrs); } else { sRefSet srs = stateClause_getRefs (cl); sRefModVal modf = stateClause_getEnsuresFunction (cl); int eparam = stateClause_getStateParameter (cl); llassert (modf != NULL); DPRINTF (("Reflect after clause: %s / %s", stateClause_unparse (cl), sRefSet_unparse (srs))); sRefSet_elements (srs, sel) { sRef s; DPRINTF (("elements: %s", sRef_unparse (sel))); DPRINTF (("elements: %s", sRef_unparseFull (sel))); if (sRef_isResult (sRef_getRootBase (sel))) { DPRINTF (("Fix base: %s / %s", sRef_unparse (sel), sRef_unparse (exprNode_getSref (ret)))); s = sRef_fixBase (sel, exprNode_getSref (ret)); DPRINTF (("==> %s", sRef_unparseFull (s))); } else { s = sRef_fixBaseParam (sel, args); } DPRINTF (("elements: %s", sRef_unparse (s))); DPRINTF (("elements: %s", sRef_unparseFull (s))); DPRINTF (("Reflecting state clause on: %s / %s", sRef_unparseFull (sel), sRef_unparseFull (s))); /* evans 2001-08-24 - added aliasSetCompleteParam */ sRef_aliasSetCompleteParam (modf, s, eparam, exprNode_loc (f)); DPRINTF (("After reflecting state clause on: %s / %s", sRef_unparseFull (sel), sRef_unparseFull (s))); } end_sRefSet_elements; } } } end_stateClauseList_elements ; } DPRINTF (("Here: %s / %s", uentry_unparseFull (le), bool_unparse (uentry_hasMetaStateEnsures (le)))); if (uentry_hasMetaStateEnsures (le)) { fileloc loc = exprNode_loc (f); metaStateConstraintList mscl = uentry_getMetaStateEnsures (le); metaStateConstraintList_elements (mscl, msc) { metaStateSpecifier msspec = metaStateConstraint_getSpecifier (msc); metaStateInfo msinfo = metaStateSpecifier_getMetaStateInfo (msspec); metaStateExpression msexpr = metaStateConstraint_getExpression (msc); cstring key = metaStateInfo_getName (msinfo); sRef mlsr = metaStateSpecifier_getSref (msspec); sRef s; sRef lastref = sRef_undefined; stateValue sval = stateValue_undefined; DPRINTF (("Meta state constraint for %s: %s", uentry_unparse (le), metaStateConstraint_unparse (msc))); DPRINTF (("Matches left: %s", sRef_unparseDebug (mlsr))); if (sRef_isResult (sRef_getRootBase (mlsr))) { s = exprNode_getSref (ret); } else { s = sRef_fixBaseParam (mlsr, args); } DPRINTF (("Setting state: %s", sRef_unparseFull (s))); while (metaStateExpression_isDefined (msexpr)) { metaStateSpecifier ms = metaStateExpression_getSpecifier (msexpr); metaStateInfo msi = metaStateSpecifier_getMetaStateInfo (ms); sRef msr, fs; DPRINTF (("Check expression: %s", metaStateExpression_unparse (msexpr))); if (metaStateExpression_isMerge (msexpr)) { msexpr = metaStateExpression_getRest (msexpr); } else { msexpr = metaStateExpression_undefined; } if (metaStateInfo_isDefined (msi)) { /* Must match lhs state */ llassert (metaStateInfo_equal (msinfo, msi)); } if (metaStateSpecifier_isElipsis (ms)) { /* ** For elipsis, we need to merge all the relevant elipsis parameters ** */ uentryList params = uentry_getParams (le); int paramno = uentryList_size (params) - 1; if (!uentry_isElipsisMarker (uentryList_getN (params, paramno))) { voptgenerror (FLG_TYPE, message ("Ensures clauses uses ... for function without ... in parameter list: %q", uentry_getName (le)), uentry_whereLast (le)); /*@innerbreak@*/ break; } while (paramno < exprNodeList_size (args)) { exprNode arg = exprNodeList_getN (args, paramno); fs = exprNode_getSref (arg); DPRINTF (("Merge arg: %s", exprNode_unparse (arg))); /* cut and pasted... gack*/ if (stateValue_isDefined (sval)) { /* Use combination table to merge old state value with new one: */ stateValue tval = sRef_getMetaStateValue (fs, key); if (stateValue_isDefined (tval)) { stateCombinationTable sctable = metaStateInfo_getMergeTable (msinfo); cstring msg = cstring_undefined; int nval = stateCombinationTable_lookup (sctable, stateValue_getValue (sval), stateValue_getValue (tval), &msg); DPRINTF (("Combining: %s + %s -> %d", stateValue_unparseValue (sval, msinfo), stateValue_unparseValue (tval, msinfo), nval)); if (nval == stateValue_error) { if (optgenerror (FLG_STATEMERGE, message ("Attributes merged in ensures clause in states that " "cannot be combined (%q is %q, %q is %q)%q", sRef_unparse (lastref), stateValue_unparseValue (sval, msinfo), sRef_unparse (fs), stateValue_unparseValue (tval, msinfo), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), exprNode_loc (f))) { sRef_showMetaStateInfo (fs, key); } } stateValue_updateValueLoc (sval, nval, fileloc_undefined); loc = exprNode_loc (arg); } else { DPRINTF (("No value for: %s:%s", sRef_unparse (fs), key)); } } else { sval = sRef_getMetaStateValue (fs, key); } lastref = fs; if (stateValue_isError (sval)) { /*@innerbreak@*/ break; /* Don't merge any more values if here was an error */ } paramno++; } } else { msr = metaStateSpecifier_getSref (ms); llassert (sRef_isParam (sRef_getRootBase (msr))); fs = sRef_fixBaseParam (msr, args); if (stateValue_isDefined (sval)) { /* Use combination table to merge old state value with new one: */ stateValue tval = sRef_getMetaStateValue (fs, key); if (stateValue_isDefined (tval)) { stateCombinationTable sctable = metaStateInfo_getMergeTable (msinfo); cstring msg = cstring_undefined; int nval = stateCombinationTable_lookup (sctable, stateValue_getValue (sval), stateValue_getValue (tval), &msg); DPRINTF (("Combining: %s + %s -> %d", stateValue_unparseValue (sval, msinfo), stateValue_unparseValue (tval, msinfo), nval)); if (nval == stateValue_error) { if (optgenerror (FLG_STATEMERGE, message ("Attributes merged in ensures clause in states that " "cannot be combined (%q is %q, %q is %q)%q", sRef_unparse (lastref), stateValue_unparseValue (sval, msinfo), sRef_unparse (fs), stateValue_unparseValue (tval, msinfo), cstring_isDefined (msg) ? message (": %s", msg) : cstring_undefined), exprNode_loc (f))) { sRef_showMetaStateInfo (fs, key); } } stateValue_updateValueLoc (sval, nval, fileloc_undefined); } else { DPRINTF (("No value for: %s:%s", sRef_unparse (fs), key)); } } else { sval = sRef_getMetaStateValue (fs, key); } lastref = fs; if (stateValue_isError (sval)) { /*@innerbreak@*/ break; /* Don't merge any more values if here was an error */ } } } DPRINTF (("Setting: %s:%s <- %s", sRef_unparse (s), key, stateValue_unparse (sval))); if (stateValue_isDefined (sval)) { sRef_setMetaStateValueComplete (s, key, stateValue_getValue (sval), loc); } else { DPRINTF (("Undefined state: %s", cstring_toCharsSafe (sRef_unparse (s)))); } } end_metaStateConstraintList_elements ; metaStateConstraintList_free (mscl); } } } static void checkRequiresClause (uentry le, exprNode f, exprNodeList args) { DPRINTF (("Check requires clause: %s(%s) / %s / %s", exprNode_unparse (f), exprNodeList_unparse (args), uentry_unparseFull (le), stateClauseList_unparse (uentry_getStateClauseList (le)))); if (uentry_isValid (le) && uentry_isFunction (le)) { stateClauseList sclauses = uentry_getStateClauseList (le); if (stateClauseList_isDefined (sclauses)) { DPRINTF (("Check requires: %s / %s / %s", uentry_unparse (le), exprNode_unparse (f), exprNodeList_unparse (args))); stateClauseList_elements (sclauses, cl) { DPRINTF (("Check clause: %s / %s", stateClause_unparse (cl), bool_unparse (stateClause_hasRequires (cl)))); if (stateClause_hasRequires (cl)) { sRefSet osrs = sRefSet_undefined; sRefSet srs; if (stateClause_isGlobal (cl)) { srs = sRefSet_single (usymtab_lookupGlobalMarker ()); osrs = srs; } else { srs = stateClause_getRefs (cl); } DPRINTF (("Refs: %s", sRefSet_unparse (srs))); if (stateClause_setsMetaState (cl)) { qual q = stateClause_getMetaQual (cl); annotationInfo ainfo = qual_getAnnotationInfo (q); metaStateInfo minfo = annotationInfo_getState (ainfo); cstring key = metaStateInfo_getName (minfo); int mvalue = annotationInfo_getValue (ainfo); DPRINTF (("Requires meta state! %s = %d", key, mvalue)); sRefSet_elements (srs, sel) { sRef s = sRef_fixBaseParam (sel, args); if (sRef_isResult (sRef_getRootBase (sel))) { BADBRANCH; } else { DPRINTF (("Checking state clause on: %s / %s / %s = %d", sRef_unparseFull (sel), sRef_unparseFull (s), key, mvalue)); if (!sRef_checkMetaStateValue (s, key, mvalue)) { DPRINTF (("HERE: %s", sRef_unparse (s))); if (optgenerror (FLG_STATETRANSFER, message ("Requires clause of called function %q not satisfied%q (state is %q): %q", uentry_getName (le), sRef_isGlobalMarker (s) ? message ("") : message (" by %q", sRef_unparse (s)), stateValue_unparseValue (sRef_getMetaStateValue (s, key), minfo), stateClause_unparse (cl)), exprNode_loc (f))) { sRef_showAliasInfo (s); } else { DPRINTF (("Error supressed!")); DPRINTF (("Loc: %s", fileloc_unparse (exprNode_loc (f)))); DPRINTF (("Context supress: %s", bool_unparse (context_suppressFlagMsg (FLG_STATETRANSFER, exprNode_loc (f))))); } } } } end_sRefSet_elements; } else { sRefModVal modf = stateClause_getRequiresBodyFunction (cl); int eparam = stateClause_getStateParameter (cl); DPRINTF (("Reflect after clause: %s / %s", stateClause_unparse (cl), sRefSet_unparse (srs))); llassert (modf != NULL); sRefSet_elements (srs, sel) { sRef s; DPRINTF (("elements: %s", sRef_unparse (sel))); DPRINTF (("elements: %s", sRef_unparseFull (sel))); s = sRef_fixBaseParam (sel, args); DPRINTF (("elements: %s", sRef_unparse (s))); DPRINTF (("elements: %s", sRef_unparseFull (s))); if (sRef_isResult (sRef_getRootBase (sel))) { ; /* what do we do about results? */ } else { DPRINTF (("Reflecting state clause on: %s / %s", sRef_unparse (sel), sRef_unparse (s))); modf (s, eparam, exprNode_loc (f)); } } end_sRefSet_elements; } sRefSet_free (osrs); } } end_stateClauseList_elements ; } } } static /*@only@*/ exprNode functionCallSafe (/*@only@*/ /*@notnull@*/ exprNode f, ctype t, /*@keep@*/ exprNodeList args) { /* requires f is a non-error exprNode, with type function */ cstring fname = exprNode_unparse (f); uentry le = exprNode_getUentry (f); exprNode ret = exprNode_createPartialCopy (f); int special; setCodePoint (); DPRINTF (("Call: %s %s",exprNode_unparse (f), exprNodeList_unparse (args))); ret->typ = ctype_getReturnType (t); ret->kind = XPR_CALL; ret->edata = exprData_makeCall (f, args); /* ** Order of these steps is very important! ** ** Must check for argument dependencies before messing up uses and sets. */ if (context_getFlag (FLG_EVALORDER)) { exprNodeList_elements (args, current) { if (exprNode_isDefined (current)) { exprNode_addUse (current, current->sref); } } end_exprNodeList_elements; if (context_maybeSet (FLG_EVALORDER) || context_maybeSet (FLG_EVALORDERUNCON)) { checkSequencing (f, args); } exprNodeList_elements (args, current) { if (exprNode_isDefined (current) && sRef_isMeaningful (current->sref)) { exprNode_addUse (ret, sRef_makeDerived (current->sref)); } } end_exprNodeList_elements ; } special = checkArgs (le, f, t, args, ret); checkGlobMods (f, le, args, ret, special); checkRequiresClause (le, f, args); setCodePoint (); if (uentry_isValid (le) && (uentry_isFunction (le) || (uentry_isVariable (le) && ctype_isFunction (uentry_getType (le))))) { exitkind exk = uentry_getExitCode (le); /* f->typ is already set to the return type */ DPRINTF (("Function: %s", uentry_unparseFull (le))); ret->sref = uentry_returnedRef (le, args, exprNode_loc (f)); DPRINTF (("Returned: %s / %s", uentry_unparseFull (le), sRef_unparseFull (ret->sref))); if (uentry_isFunction (le) && exprNodeList_size (args) >= 1) { qual nullPred = uentry_nullPred (le); if (qual_isTrueNull (nullPred)) { exprNode arg = exprNodeList_head (args); if (exprNode_isDefined (arg)) { ret->guards = guardSet_addFalseGuard (ret->guards, arg->sref); } } else if (qual_isFalseNull (nullPred)) { exprNode arg = exprNodeList_head (args); if (exprNode_isDefined (arg)) { ret->guards = guardSet_addTrueGuard (ret->guards, arg->sref); } } else { llassert (qual_isUnknown (nullPred)); } } if (exitkind_isConditionalExit (exk)) { /* ** True exit is: ** if (arg0) then { exit! } else { ; } ** False exit is: ** if (arg0) then { ; } else { exit! } */ exprNode firstArg; llassert (!exprNodeList_isEmpty (args)); firstArg = exprNodeList_head (args); if (exprNode_isDefined (firstArg) && !guardSet_isEmpty (firstArg->guards)) { usymtab_trueBranch (guardSet_undefined); usymtab_altBranch (guardSet_undefined); if (exitkind_isTrueExit (exk)) { usymtab_popBranches (firstArg, exprNode_makeMustExit (), exprNode_undefined, TRUE, TRUEEXITCLAUSE); } else { usymtab_popBranches (firstArg, exprNode_undefined, exprNode_makeMustExit (), TRUE, FALSEEXITCLAUSE); } } ret->exitCode = XK_MAYEXIT; } else if (exitkind_mustExit (exk)) { ret->exitCode = XK_MUSTEXIT; } else if (exitkind_couldExit (exk)) { ret->exitCode = XK_MAYEXIT; } else { ; } if (cstring_equalLit (fname, "exit")) { if (exprNodeList_size (args) == 1) { exprNode arg = exprNodeList_head (args); if (exprNode_isDefined (arg) && exprNode_knownIntValue (arg)) { long int val = multiVal_forceInt (exprNode_getValue (arg)); if (val != 0) { voptgenerror (FLG_EXITARG, message ("Argument to exit has implementation defined behavior: %s", exprNode_unparse (arg)), exprNode_loc (arg)); } } } } } else { ret->sref = sRef_undefined; exprNode_checkSetAny (ret, uentry_rawName (le)); } DPRINTF (("Before reflect: %s", sRef_unparseFull (ret->sref))); DPRINTF (("Reflect: %s", uentry_unparseFull (le))); reflectEnsuresClause (ret, le, f, args); setCodePoint (); DPRINTF (("Here: %s", sRef_unparseFull (ret->sref))); return (ret); } /* ** this is yucky! should keep the uentry as part of exprNode! */ uentry exprNode_getUentry (exprNode e) { if (exprNode_isError (e)) { return uentry_undefined; } else { cstring s = exprNode_rootVarName (e); uentry ue = usymtab_lookupSafe (s); return ue; } } /* ** Returns true iff e1 and e2 are both exactly the same storage ** (conservative). */ static bool exprNode_sameStorage (exprNode e1, exprNode e2) { sRef s1 = exprNode_getSref (e1); sRef s2 = exprNode_getSref (e2); return (sRef_realSame (s1, s2)); } exprNode exprNode_makeInitBlock (lltok brace, /*@only@*/ exprNodeList inits) { exprNode ret = exprNode_createPlain (ctype_unknown); ret->kind = XPR_INITBLOCK; ret->edata = exprData_makeCall (exprNode_undefined, inits); ret->loc = fileloc_update (ret->loc, lltok_getLoc (brace)); return (ret); } exprNode exprNode_functionCall (/*@only@*/ exprNode f, /*@only@*/ exprNodeList args) { ctype t; # ifdef DEBUGSPLINT usymtab_checkAllValid (); # endif if (exprNode_isUndefined (f)) { exprNode_free (f); exprNodeList_free (args); return exprNode_undefined; } t = exprNode_getType (f); if (sRef_isLocalVar (f->sref)) { exprNode_checkUse (f, f->sref, f->loc); if (sRef_possiblyNull (f->sref)) { if (!usymtab_isGuarded (f->sref)) { if (optgenerror (FLG_NULLDEREF, message ("Function call using %s pointer %q", sRef_nullMessage (f->sref), sRef_unparse (f->sref)), f->loc)) { sRef_showNullInfo (f->sref); sRef_setNullError (f->sref); } } } } setCodePoint (); if (ctype_isRealFunction (t)) { exprNode ret = functionCallSafe (f, t, args); setCodePoint (); return ret; } else if (ctype_isUnknown (t)) { exprNode ret = exprNode_createPartialCopy (f); cstring tstring; setCodePoint (); ret->typ = t; exprNodeList_elements (args, current) { if (exprNode_isDefined (current)) { exprNode_checkUse (ret, current->sref, ret->loc); /* ** also, anything derivable from current->sref may be used */ exprNode_addUse (ret, sRef_makeDerived (current->sref)); exprNode_mergeUSs (ret, current); } } end_exprNodeList_elements; ret->edata = exprData_makeCall (f, args); ret->kind = XPR_CALL; tstring = cstring_copy (exprNode_unparse (f)); cstring_markOwned (tstring); exprNode_checkSetAny (ret, tstring); return (ret); } else { voptgenerror (FLG_TYPE, message ("Call to non-function (type %t): %s", t, exprNode_unparse (f)), f->loc); exprNode_free (f); exprNodeList_free (args); return (exprNode_makeError ()); } } static exprNode exprNode_fieldAccessAux (/*@only@*/ exprNode s, /*@observer@*/ fileloc loc, /*@only@*/ cstring f) { exprNode ret = exprNode_createPartialCopy (s); ret->kind = XPR_FACCESS; if (exprNode_isError (s)) { ret->edata = exprData_makeField (s, f); return ret; } else { ctype t = exprNode_getType (s); ctype tr = ctype_realType (t); checkMacroParen (s); ret->edata = exprData_makeField (s, f); if (ctype_isStructorUnion (tr)) { uentry tf = uentryList_lookupField (ctype_getFields (tr), f); if (uentry_isUndefined (tf)) { voptgenerror (FLG_TYPE, message ("Access non-existent field %s of %t: %s", f, t, exprNode_unparse (ret)), loc); /*! cstring_free (f); */ /* evans 2001-03-25 self-detect */ return (ret); } else { uentry_setUsed (tf, exprNode_loc (ret)); ret->typ = uentry_getType (tf); checkSafeUse (ret, s->sref); ret->sref = sRef_makeField (s->sref, uentry_rawName (tf)); /*!? exprNode_free (s); */ /* evans 2001-03-25 self-detect */ return (ret); } } else /* isStructorUnion */ { if (ctype_isRealAbstract (tr)) { voptgenerror (FLG_ABSTRACT, message ("Access field of abstract type (%t): %s.%s", t, exprNode_unparse (s), f), loc); ret->typ = ctype_unknown; } else { if (ctype_isKnown (tr)) { voptgenerror (FLG_TYPE, message ("Access field of non-struct or union (%t): %s.%s", t, exprNode_unparse (s), f), loc); ret->typ = ctype_unknown; } else { cstring sn = cstring_copy (f); checkSafeUse (ret, s->sref); cstring_markOwned (sn); ret->sref = sRef_makeField (s->sref, sn); return (ret); } } return (ret); } } BADEXIT; } exprNode exprNode_fieldAccess (/*@only@*/ exprNode s, /*@only@*/ lltok dot, /*@only@*/ cstring f) { exprNode res = exprNode_fieldAccessAux (s, lltok_getLoc (dot), f); lltok_free (dot); return res; } exprNode exprNode_addParens (/*@only@*/ lltok lpar, /*@only@*/ exprNode e) { exprNode ret = exprNode_createPartialCopy (e); ret->loc = fileloc_update (ret->loc, lltok_getLoc (lpar)); ret->kind = XPR_PARENS; ret->edata = exprData_makeUop (e, lpar); if (!exprNode_isError (e)) { ret->exitCode = e->exitCode; ret->canBreak = e->canBreak; ret->mustBreak = e->mustBreak; ret->isJumpPoint = e->isJumpPoint; ret->sref = e->sref; } return ret; } static exprNode exprNode_arrowAccessAux (/*@only@*/ exprNode s, /*@observer@*/ fileloc loc, /*@only@*/ cstring f) { exprNode ret = exprNode_createPartialCopy (s); ret->edata = exprData_makeField (s, f); ret->kind = XPR_ARROW; if (exprNode_isError (s)) { return (ret); } else { ctype t = exprNode_getType (s); ctype tr = ctype_realType (t); checkMacroParen (s); (void) ctype_fixArrayPtr (tr); /* REWRITE THIS */ if (ctype_isRealPointer (tr)) { ctype b = ctype_realType (ctype_baseArrayPtr (tr)); if (ctype_isStructorUnion (b)) { uentry fentry = uentryList_lookupField (ctype_getFields (b), f); if (sRef_isKnown (s->sref) && sRef_possiblyNull (s->sref)) { if (!usymtab_isGuarded (s->sref) && !context_inProtectVars ()) { if (optgenerror (FLG_NULLDEREF, message ("Arrow access from %s pointer%q: %s", sRef_nullMessage (s->sref), sRef_unparsePreOpt (s->sref), exprNode_unparse (ret)), loc)) { sRef_showNullInfo (s->sref); sRef_setNullError (s->sref); } } } if (uentry_isUndefined (fentry)) { voptgenerror (FLG_TYPE, message ("Access non-existent field %s of %t: %s", f, t, exprNode_unparse (ret)), loc); ret->typ = ctype_unknown; return (ret); } else { /* ** was safeUse: shouldn't be safe! ** ** to do rec->field ** rec must be defined, ** *rec must be allocated ** rec->field need only be defined it if is an rvalue */ uentry_setUsed (fentry, exprNode_loc (ret)); ret->typ = uentry_getType (fentry); exprNode_checkUse (ret, s->sref, s->loc); /* exprNode_checkUse (ret, sRef_makePointer (s->sref), s->loc); */ ret->sref = sRef_makeArrow (s->sref, uentry_rawName (fentry)); return (ret); } } else /* Pointer to something that is not a struct or union*/ { if (ctype_isRealAbstract (tr)) { ctype xrt = ctype_forceRealType (tr); voptgenerror (FLG_ABSTRACT, message ("Arrow access field of abstract type (%t): %s->%s", t, exprNode_unparse (s), f), loc); /* ** Set the state correctly, as if the abstraction is broken. */ if (ctype_isRealPointer (xrt) && (b = ctype_realType (ctype_baseArrayPtr (xrt)), ctype_isStructorUnion (b))) { uentry fentry = uentryList_lookupField (ctype_getFields (b), f); ret->typ = uentry_getType (fentry); ret->sref = sRef_makeArrow (s->sref, uentry_rawName (fentry)); } else { ret->typ = ctype_unknown; ret->sref = sRef_undefined; } } else /* not a struct, union or abstract */ { if (ctype_isUnknown (tr)) { cstring sn = cstring_copy (f); DPRINTF (("Here: %s", exprNode_unparse (s))); exprNode_checkUse (ret, s->sref, s->loc); exprNode_checkUse (ret, sRef_makePointer (s->sref), s->loc); cstring_markOwned (sn); ret->sref = sRef_makeArrow (s->sref, sn); ret->kind = XPR_ARROW; return (ret); } else { voptgenerror (FLG_TYPE, message ("Arrow access field of non-struct or union " "pointer (%t): %s->%s", t, exprNode_unparse (s), f), loc); ret->typ = ctype_unknown; ret->sref = sRef_undefined; } } } } else /* its not a pointer */ { if (!ctype_isUnknown (tr)) { voptgenerror (FLG_TYPE, message ("Arrow access of non-pointer (%t): %s->%s", t, exprNode_unparse (s), f), loc); ret->typ = ctype_unknown; ret->sref = sRef_undefined; } else { cstring sn = cstring_copy (f); DPRINTF (("Here: %s", exprNode_unparse (s))); exprNode_checkUse (ret, s->sref, s->loc); exprNode_checkUse (ret, sRef_makePointer (s->sref), s->loc); cstring_markOwned (sn); ret->sref = sRef_makeArrow (s->sref, sn); ret->kind = XPR_ARROW; return (ret); } } return (ret); } BADEXIT; } exprNode exprNode_arrowAccess (/*@only@*/ exprNode s, /*@only@*/ lltok arrow, /*@only@*/ cstring f) { exprNode res = exprNode_arrowAccessAux (s, lltok_getLoc (arrow), f); lltok_free (arrow); return res; } /* ** only postOp's in C: i++ and i-- */ exprNode exprNode_postOp (/*@only@*/ exprNode e, /*@only@*/ lltok op) { /* check modification also */ /* cstring opname = lltok_unparse (op);*/ ctype t; exprNode ret = exprNode_createPartialCopy (e); ret->loc = fileloc_update (ret->loc, lltok_getLoc (op)); ret->kind = XPR_POSTOP; ret->edata = exprData_makeUop (e, op); if (!exprNode_isDefined (e)) { return ret; } checkMacroParen (e); exprNode_checkUse (ret, e->sref, e->loc); exprNode_checkSet (ret, e->sref); t = exprNode_getType (e); if (sRef_isUnsafe (e->sref)) { voptgenerror (FLG_MACROPARAMS, message ("Operand of %s is macro parameter (non-functional): %s%s", lltok_unparse (op), exprNode_unparse (e), lltok_unparse (op)), e->loc); sRef_makeSafe (e->sref); sRef_makeSafe (ret->sref); } if (ctype_isForceRealNumeric (&t) || ctype_isRealAP (t)) { ret->typ = e->typ; } else { if (ctype_isRealAbstract (t)) { if (ctype_isRealNumAbstract (t)) { ; /* Allow operations on numabstract types */ } else { voptgenerror (FLG_ABSTRACT, message ("Operand of %s is abstract type (%t): %s", lltok_unparse (op), t, exprNode_unparse (e)), e->loc); } } else { voptgenerror (FLG_TYPE, message ("Operand of %s is non-numeric (%t): %s", lltok_unparse (op), t, exprNode_unparse (e)), e->loc); } ret->typ = ctype_unknown; } /* if (ctype_isZero (t)) e->typ = ctype_int; */ exprNode_checkModify (e, ret); /* added 7/11/2000 D.L */ /* updateEnvironmentForPostOp (e); */ /* start modifications */ /* added by Seejo on 4/16/2000 */ /* Arithmetic operations on pointers wil modify the size/len/null terminated status */ if ((sRef_isPossiblyNullTerminated (e->sref)) || (sRef_isNullTerminated(e->sref))) { ret->sref = sRef_copy (e->sref); /* Operator : ++ */ if (lltok_getTok (op) == INC_OP) { if (sRef_getSize(e->sref) > 0) { sRef_setSize (ret->sref, sRef_getSize(e->sref) - 1); if (sRef_getLen(e->sref) == 1) { /* i.e. the first character is \0 */ /* Assumption: there is only 1 \0 in the buffer */ /* This will not be correct if there are 2 \0's in the buffer */ sRef_setNotNullTerminatedState(ret->sref); sRef_resetLen(ret->sref); } else { sRef_setNullTerminatedState(ret->sref); sRef_setLen (ret->sref, sRef_getLen(e->sref) - 1); } if (sRef_isNullTerminated (ret->sref)) printf ("ret->sref is Null Terminated\n"); else if (sRef_isPossiblyNullTerminated (ret->sref)) printf ("ret->sref is Possibly Null Terminated\n"); else if (sRef_isNotNullTerminated (ret->sref)) printf ("ret->sref is Not Null Terminated\n"); else {} } } /* Operator : -- */ if (lltok_getTok (op) == DEC_OP) { if (sRef_getSize(e->sref) >= 0) { sRef_setSize (ret->sref, sRef_getSize(e->sref) + 1); sRef_setLen (ret->sref, sRef_getLen(e->sref) + 1); } } } /* end modifications */ return ret; } exprNode exprNode_preOp (/*@only@*/ exprNode e, /*@only@*/ lltok op) { bool checkMod = FALSE; ctype te, tr; int opid = lltok_getTok (op); exprNode ret = exprNode_createSemiCopy (e); exprNode_copySets (ret, e); multiVal_free (ret->val); ret->val = multiVal_undefined; ret->loc = fileloc_update (ret->loc, lltok_getLoc (op)); ret->kind = XPR_PREOP; ret->edata = exprData_makeUop (e, op); if (exprNode_isError (e)) { return ret; } checkMacroParen (e); te = exprNode_getType (e); tr = ctype_realType (te); if (opid != TAMPERSAND) { exprNode_checkUse (ret, e->sref, e->loc); if (ctype_isRealAbstract (tr) && (!(ctype_isRealBool (te) && (opid == TEXCL)))) { if (ctype_isRealNumAbstract (tr)) { ; /* no warning for numabstract types */ } else { if (optgenerror (FLG_ABSTRACT, message ("Operand of %s is abstract type (%t): %s", lltok_unparse (op), tr, exprNode_unparse (ret)), e->loc)) { tr = te = ctype_unknown; ret->typ = ctype_unknown; sRef_setNullError (e->sref); } } } } switch (opid) { case INC_OP: case DEC_OP: /* should also check modification! */ if (sRef_isMacroParamRef (e->sref)) { voptgenerror (FLG_MACROPARAMS, message ("Operand of %s is macro parameter (non-functional): %s", lltok_unparse (op), exprNode_unparse (ret)), e->loc); } else { exprNode_checkSet (ret, e->sref); } if (ctype_isForceRealNumeric (&tr) || ctype_isRealAP (tr)) { } else { if (context_msgStrictOps ()) { voptgenerror (FLG_STRICTOPS, message ("Operand of %s is non-numeric (%t): %s", lltok_unparse (op), te, exprNode_unparse (ret)), e->loc); } ret->typ = ctype_int; } /* start modifications */ /* added by Seejo on 4/16/2000 */ /* Arithmetic operations on pointers wil modify the size/len/null terminated status */ if ((sRef_isPossiblyNullTerminated (e->sref)) || (sRef_isNullTerminated(e->sref))) { ret->sref = sRef_copy (e->sref); /* Operator : ++ */ if (lltok_getTok (op) == INC_OP) { if (sRef_getSize(e->sref) > 0) { sRef_setSize (ret->sref, sRef_getSize(e->sref) - 1); if (sRef_getLen(e->sref) == 1) { /* i.e. the first character is \0 */ /* Assumption: there is only 1 \0 in the buffer */ /* This will not be correct if there are 2 \0's in the buffer */ sRef_setNotNullTerminatedState(ret->sref); sRef_resetLen (ret->sref); } else { sRef_setNullTerminatedState(ret->sref); sRef_setLen (ret->sref, sRef_getLen(e->sref) - 1); } } } /* Operator : -- */ if (lltok_getTok (op) == DEC_OP) { if (sRef_getSize(e->sref) >= 0) { sRef_setSize (ret->sref, sRef_getSize(e->sref) + 1); sRef_setLen (ret->sref, sRef_getLen(e->sref) + 1); } } } /* end modifications */ checkMod = TRUE; break; case TMINUS: case TPLUS: if (ctype_isForceRealNumeric (&tr)) { if (opid == TMINUS) { ret->val = multiVal_invert (exprNode_getValue (e)); } else { ret->val = multiVal_copy (exprNode_getValue (e)); } } else { if (context_msgStrictOps ()) { voptgenerror (FLG_STRICTOPS, message ("Operand of %s is non-numeric (%t): %s", lltok_unparse (op), te, exprNode_unparse (ret)), e->loc); } ret->typ = ctype_int; } break; case TEXCL: /* maybe this should be restricted */ guardSet_flip (ret->guards); if (ctype_isRealBool (te) || ctype_isUnknown (te)) { ; } else { if (ctype_isRealPointer (tr)) { if (sRef_isKnown (e->sref)) { ret->guards = guardSet_addFalseGuard (ret->guards, e->sref); } voptgenerror2n (FLG_BOOLOPS, FLG_PTRNEGATE, message ("Operand of %s is non-boolean (%t): %s", lltok_unparse (op), te, exprNode_unparse (ret)), e->loc); } else { voptgenerror (FLG_BOOLOPS, message ("Operand of %s is non-boolean (%t): %s", lltok_unparse (op), te, exprNode_unparse (ret)), e->loc); } ret->typ = ctype_bool; } break; case TTILDE: if (ctype_isForceRealInt (&tr)) { } else { if (context_msgStrictOps ()) { voptgenerror (FLG_STRICTOPS, message ("Operand of %s is non-integer (%t): %s", lltok_unparse (op), te, exprNode_unparse (ret)), e->loc); } if (ctype_isInt (e->typ)) { ret->typ = e->typ; } else { ret->typ = ctype_int; } } break; case TAMPERSAND: ret->typ = ctype_makePointer (e->typ); if (sRef_isKnown (e->sref)) { ret->sref = sRef_makeAddress (e->sref); } break; case TMULT: if (ctype_isAP (tr)) { ret->typ = ctype_baseArrayPtr (e->typ); } else { if (ctype_isKnown (te)) { if (ctype_isFunction (te)) { ret->typ = e->typ; voptgenerror (FLG_FCNDEREF, message ("Dereference of function type (%t): %s", te, exprNode_unparse (ret)), e->loc); } else { voptgenerror (FLG_TYPE, message ("Dereference of non-pointer (%t): %s", te, exprNode_unparse (ret)), e->loc); ret->typ = ctype_unknown; } } else { ret->typ = ctype_unknown; } } if (sRef_isKnown (e->sref)) { DPRINTF (("Checking possibly null: %s", sRef_unparseFull (e->sref))); if (sRef_possiblyNull (e->sref)) { DPRINTF (("Checking possibly null: %s", sRef_unparse (e->sref))); if (!usymtab_isGuarded (e->sref) && !context_inProtectVars ()) { if (optgenerror (FLG_NULLDEREF, message ("Dereference of %s pointer %q: %s", sRef_nullMessage (e->sref), sRef_unparse (e->sref), exprNode_unparse (ret)), e->loc)) { sRef_showNullInfo (e->sref); sRef_setNotNull (e->sref, e->loc); /* suppress future messages */ } } } ret->sref = sRef_makePointer (e->sref); } break; default: llbug (message ("exprNode_preOp: unhandled op: %s", lltok_unparse (op))); } if (checkMod) { exprNode_checkModify (e, ret); } return ret; } /* ** any reason to disallow sizeof (abstract type) ? */ /* ** used by both sizeof */ static ctype sizeof_resultType (void) { static ctype sizet = ctype_unknown; if (ctype_isUnknown (sizet)) { if (usymtab_existsType (cstring_makeLiteralTemp ("size_t"))) { sizet = uentry_getAbstractType (usymtab_lookup (cstring_makeLiteralTemp ("size_t"))); } else { sizet = ctype_ulint; } } return sizet; } exprNode exprNode_sizeofType (/*@only@*/ qtype qt) { exprNode ret = exprNode_create (sizeof_resultType ()); ctype ct = qtype_getType (qt); ret->kind = XPR_SIZEOFT; ret->edata = exprData_makeSizeofType (qt); voptgenerror (FLG_SIZEOFTYPE, message ("Parameter to sizeof is type %s: %s", ctype_unparse (ct), exprNode_unparse (ret)), ret->loc); return (ret); } exprNode exprNode_alignofType (/*@only@*/ qtype qt) { exprNode ret = exprNode_create (sizeof_resultType ()); ctype ct = qtype_getType (qt); ret->kind = XPR_ALIGNOFT; ret->edata = exprData_makeSizeofType (qt); voptgenerror (FLG_SIZEOFTYPE, message ("Parameter to alignof is type %s: %s", ctype_unparse (ct), exprNode_unparse (ret)), ret->loc); return (ret); } exprNode exprNode_offsetof (qtype qt, cstringList s) { exprNode ret = exprNode_create (sizeof_resultType ()); ctype ct = qtype_getType (qt); ret->kind = XPR_OFFSETOF; ret->edata = exprData_makeOffsetof (qt, s); if (!ctype_isRealSU (ct)) { voptgenerror (FLG_TYPE, message ("First parameter to offsetof is not a " "struct or union type (type %s): %s", ctype_unparse (ct), exprNode_unparse (ret)), ret->loc); } else { ctype lt = ct; cstringList_elements (s, el) { uentryList fields; uentry fld; if (ctype_isUndefined (lt)) { break; } else if (!ctype_isRealSU (lt)) { voptgenerror (FLG_TYPE, message ("Inner offsetof type is not a " "struct or union type (type %s before field %s): %s", ctype_unparse (lt), el, exprNode_unparse (ret)), ret->loc); break; } else { fields = ctype_getFields (ctype_realType (lt)); fld = uentryList_lookupField (fields, el); DPRINTF (("Try: %s / %s", ctype_unparse (lt), el)); if (uentry_isUndefined (fld)) { if (ctype_equal (lt, ct)) { voptgenerror (FLG_TYPE, message ("Field %s in offsetof is not the " "name of a field of %s: %s", el, ctype_unparse (ct), exprNode_unparse (ret)), ret->loc); } else { voptgenerror (FLG_TYPE, message ("Deep field %s in offsetof is not the " "name of a field of %s: %s", el, ctype_unparse (lt), exprNode_unparse (ret)), ret->loc); } } else { lt = uentry_getType (fld); } } } end_cstringList_elements; /* Should report error if its a bit field - behavior is undefined! */ } return (ret); } /*@only@*/ exprNode exprNode_sizeofExpr (/*@only@*/ exprNode e) { exprNode ret; if (exprNode_isUndefined (e)) { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); ret->edata = exprData_makeSingle (e); ret->typ = sizeof_resultType (); ret->kind = XPR_SIZEOF; } else { uentry u = exprNode_getUentry (e); ret = exprNode_createPartialCopy (e); ret->edata = exprData_makeSingle (e); ret->typ = sizeof_resultType (); ret->kind = XPR_SIZEOF; if (uentry_isValid (u) && uentry_isRefParam (u) && ctype_isRealArray (uentry_getType (u))) { voptgenerror (FLG_SIZEOFFORMALARRAY, message ("Parameter to sizeof is an array-type function parameter: %s", exprNode_unparse (ret)), ret->loc); } } /* ** sizeof (x) doesn't "really" use x */ return (ret); } /*@only@*/ exprNode exprNode_alignofExpr (/*@only@*/ exprNode e) { exprNode ret; if (exprNode_isUndefined (e)) { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); } else { ret = exprNode_createPartialCopy (e); } ret->edata = exprData_makeSingle (e); ret->typ = sizeof_resultType (); ret->kind = XPR_ALIGNOF; /* ** sizeof (x) doesn't "really" use x */ return (ret); } /*@only@*/ exprNode exprNode_cast (/*@only@*/ lltok tok, /*@only@*/ exprNode e, /*@only@*/ qtype q) { ctype c; ctype t; exprNode ret; if (exprNode_isError (e)) { qtype_free (q); lltok_free (tok); return exprNode_undefined; } checkMacroParen (e); c = qtype_getType (q); t = exprNode_getType (e); ret = exprNode_createPartialCopy (e); ret->loc = fileloc_update (ret->loc, lltok_getLoc (tok)); ret->typ = c; ret->kind = XPR_CAST; ret->edata = exprData_makeCast (tok, e, q); ret->sref = sRef_copy (e->sref); DPRINTF (("Cast: -> %s", sRef_unparseFull (ret->sref))); if (!sRef_isConst (e->sref)) { usymtab_addForceMustAlias (ret->sref, e->sref); } DPRINTF (("Cast 2: -> %s", sRef_unparseFull (ret->sref))); sRef_setTypeFull (ret->sref, c); DPRINTF (("Cast 2: -> %s", sRef_unparseFull (ret->sref))); /* ** we allow ** abstract -> void ** 0 <-> abstract * ** void * <-> abstract * (if FLG_ABSTVOIDP) ** abstract * <-> void * (if FLG_ABSTVOIDP) */ if (ctype_isVoid (c)) /* cast to void is always okay --- discard value */ { /* evans 2002-07-19: added this warning */ DPRINTF (("Checking: %s / %s", exprNode_unparse (ret), sRef_unparseFull (ret->sref))); if (sRef_isFresh (ret->sref)) { voptgenerror (FLG_MUSTFREEFRESH, message ("New fresh storage %q(type %s) cast to void (not released): %s", sRef_unparseOpt (ret->sref), ctype_unparse (exprNode_getType (ret)), exprNode_unparse (ret)), exprNode_loc (ret)); } } else if (ctype_isRealAP (c)) /* casting to array or pointer */ { ctype bc = ctype_getBaseType (c); ctype bt = ctype_getBaseType (t); ctype rt = ctype_realType (t); if (ctype_isFunction (ctype_baseArrayPtr (ctype_realType (c))) && (ctype_isArrayPtr (rt) && !ctype_isFunction (ctype_realType (ctype_baseArrayPtr (rt))))) { voptgenerror (FLG_CASTFCNPTR, message ("Cast from function pointer type (%t) to " "non-function pointer (%t): %s", c, t, exprNode_unparse (ret)), e->loc); } if (!ctype_isFunction (ctype_baseArrayPtr (c)) && (ctype_isArrayPtr (rt) && ctype_isFunction (ctype_realType (ctype_baseArrayPtr (rt))))) { voptgenerror (FLG_CASTFCNPTR, message ("Cast from non-function pointer type (%t) to " "function pointer (%t): %s", c, t, exprNode_unparse (ret)), e->loc); } if (exprNode_isZero (e) && context_getFlag (FLG_ZEROPTR) && !(ctype_isRealAbstract (bc) && context_hasAccess (ctype_typeId (bc)))) { ; /* okay to cast zero */ } else { if (ctype_isRealAbstract (bc) && !context_hasAccess (ctype_typeId (bc))) { if (ctype_isVoidPointer (t) || ctype_isUnknown (t)) { vnoptgenerror (FLG_ABSTVOIDP, message ("Cast to underlying abstract type %t: %s", c, exprNode_unparse (ret)), e->loc); } else { voptgenerror (FLG_ABSTRACT, message ("Cast to underlying abstract type %t: %s", c, exprNode_unparse (ret)), e->loc); } } if (ctype_isRealAbstract (bt) && !context_hasAccess (ctype_typeId (bt))) { if (ctype_isUnknown (c) || ctype_isVoidPointer (c)) { vnoptgenerror (FLG_ABSTVOIDP, message ("Cast from underlying abstract type %t: %s", t, exprNode_unparse (ret)), e->loc); } else { voptgenerror (FLG_ABSTRACT, message ("Cast from underlying abstract type %t: %s", t, exprNode_unparse (ret)), e->loc); } } } } else { ctype bt = ctype_realType (ctype_getBaseType (t)); ctype bc = ctype_realType (ctype_getBaseType (c)); if (ctype_isAbstract (bt) && !context_hasAccess (ctype_typeId (bt))) { if (ctype_match (c, t)) { if (ctype_equal (c, t)) { voptgenerror (FLG_TYPE, message ("Redundant cast involving abstract type %t: %s", bt, exprNode_unparse (ret)), e->loc); } } else { voptgenerror (FLG_ABSTRACT, message ("Cast from abstract type %t: %s", bt, exprNode_unparse (ret)), e->loc); } } if (ctype_isAbstract (bc) && !context_hasAccess (ctype_typeId (bc))) { if (ctype_match (c, t)) { ; } else { if (ctype_isNumAbstract (bc)) { if (exprNode_isNumLiteral (e)) { voptgenerror (FLG_NUMABSTRACTCAST, message ("Cast from literal to numabstract type %t: %s", bc, exprNode_unparse (ret)), e->loc); } else { voptgenerror (FLG_NUMABSTRACT, message ("Cast to numabstract type %t: %s", bc, exprNode_unparse (ret)), e->loc); } } else { DPRINTF (("No access to: %s / %d", ctype_unparse (bc), ctype_typeId (bc))); DPRINTF (("Context %s %s", bool_unparse (context_inFunctionLike ()), context_unparse ())); voptgenerror (FLG_ABSTRACT, message ("Cast to abstract type %t: %s", bc, exprNode_unparse (ret)), e->loc); } } } } if (ctype_isAbstract (c)) { if (sRef_isExposed (e->sref) || sRef_isOnly (e->sref)) { /* okay, cast exposed to abstract */ sRef_clearExKindComplete (ret->sref, fileloc_undefined); } else { if (ctype_isVisiblySharable (t) && sRef_isExternallyVisible (e->sref) && !(ctype_isAbstract (t) && context_hasAccess (ctype_typeId (t)))) { voptgenerror (FLG_CASTEXPOSE, message ("Cast to abstract type from externally visible " "mutable storage exposes rep of %s: %s", ctype_unparse (c), exprNode_unparse (e)), e->loc); } } } return (ret); } static bool evaluationOrderUndefined (lltok op) { int opid = lltok_getTok (op); return (opid != AND_OP && opid != OR_OP); } static bool checkIntegral (/*@notnull@*/ exprNode e1, /*@notnull@*/ exprNode e2, /*@notnull@*/ exprNode ret, lltok op) { bool error = FALSE; ctype te1 = exprNode_getType (e1); ctype te2 = exprNode_getType (e2); ctype tr1 = ctype_realishType (te1); ctype tr2 = ctype_realishType (te2); if (ctype_isForceRealInt (&tr1) && ctype_isForceRealInt (&tr2)) { ; } else { if (context_msgStrictOps ()) { if (!ctype_isInt (tr1) && !ctype_isInt (tr2)) { if (ctype_sameName (te1, te2)) { error = optgenerror (FLG_STRICTOPS, message ("Operands of %s are non-integer (%t): %s", lltok_unparse (op), te1, exprNode_unparse (ret)), e1->loc); } else { error = optgenerror (FLG_STRICTOPS, message ("Operands of %s are non-integers (%t, %t): %s", lltok_unparse (op), te1, te2, exprNode_unparse (ret)), e1->loc); } } else if (!ctype_isInt (tr1)) { error = optgenerror (FLG_STRICTOPS, message ("Left operand of %s is non-integer (%t): %s", lltok_unparse (op), te1, exprNode_unparse (ret)), e1->loc); } else /* !ctype_isInt (te2) */ { error = optgenerror (FLG_STRICTOPS, message ("Right operand of %s is non-integer (%t): %s", lltok_unparse (op), te2, exprNode_unparse (ret)), e2->loc); } } } return !error; } /* ** returns exprNode representing e1 op e2 ** ** uses msg if there are errors ** can be used for both assignment ops and regular ops ** ** modifies e1 */ static /*@only@*/ /*@notnull@*/ exprNode exprNode_makeOp (/*@keep@*/ exprNode e1, /*@keep@*/ exprNode e2, /*@keep@*/ lltok op) { ctype te1, te2, tr1, tr2, tret; int opid = lltok_getTok (op); bool hasError = FALSE; exprNode ret; if (exprNode_isError (e1)) { ret = exprNode_createPartialNVCopy (e2); } else { ret = exprNode_createPartialNVCopy (e1); } ret->val = multiVal_undefined; ret->kind = XPR_OP; ret->edata = exprData_makeOp (e1, e2, op); if (exprNode_isError (e1) || exprNode_isError (e2)) { if (opid == TLT || opid == TGT || opid == LE_OP || opid == GE_OP || opid == EQ_OP || opid == NE_OP || opid == AND_OP || opid == OR_OP) { ret->typ = ctype_bool; } if (exprNode_isDefined (e1)) { exprNode_checkUse (ret, e1->sref, e1->loc); } if (exprNode_isDefined (e2)) { exprNode_mergeUSs (ret, e2); exprNode_checkUse (ret, e2->sref, e2->loc); } return ret; } tret = ctype_unknown; te1 = exprNode_getType (e1); DPRINTF (("te1 = %s / %s", exprNode_unparse (e1), ctype_unparse (te1))); te2 = exprNode_getType (e2); tr1 = ctype_realishType (te1); tr2 = ctype_realishType (te2); if (opid == OR_OP) { exprNode_produceGuards (e2); ret->guards = guardSet_or (ret->guards, e2->guards); } else if (opid == AND_OP) { exprNode_produceGuards (e2); /* evans 2003-08-13: need to produce guards for expression */ /* Shouldn't this have already happened? */ DPRINTF (("Anding guards: %s / %s", guardSet_unparse (ret->guards), guardSet_unparse (e2->guards))); ret->guards = guardSet_and (ret->guards, e2->guards); } else { /* no guards */ } if (opid == EQ_OP || opid == NE_OP) { exprNode temp1 = e1, temp2 = e2; /* could do NULL == x */ if (exprNode_isNullValue (e1) || exprNode_isUnknownConstant (e1)) { temp1 = e2; temp2 = e1; } if (exprNode_isNullValue (temp2) || exprNode_isUnknownConstant (temp2)) { reflectNullTest (temp1, (opid == NE_OP)); guardSet_free (ret->guards); ret->guards = guardSet_copy (temp1->guards); } } if (opid == TLT || opid == TGT || opid == LE_OP || opid == GE_OP || opid == EQ_OP || opid == NE_OP || opid == AND_OP || opid == OR_OP) { tret = ctype_bool; } if (anyAbstract (tr1, tr2) && (!((ctype_isRealBool (te1) || ctype_isRealBool (te2)) && (opid == AND_OP || opid == OR_OP || opid == EQ_OP || opid == NE_OP)))) { if (abstractOpError (tr1, tr2, op, e1, e2, e1->loc, e2->loc)) { tret = ctype_unknown; goto skiprest; } } if (ctype_isUnknown (te1) || ctype_isUnknown (te2)) { /* unknown types, no comparisons possible */ goto skiprest; } switch (opid) { case TMULT: /* multiplication and division: */ case TDIV: /* */ case MUL_ASSIGN: /* numeric, numeric -> numeric */ case DIV_ASSIGN: /* */ if (opid == TMULT || opid == MUL_ASSIGN) { ret->val = multiVal_multiply (exprNode_getValue (e1), exprNode_getValue (e2)); } else { ret->val = multiVal_divide (exprNode_getValue (e1), exprNode_getValue (e2)); } tret = checkNumerics (tr1, tr2, te1, te2, e1, e2, op); break; case TPLUS: /* addition and subtraction: */ case TMINUS: /* pointer, int -> pointer */ case SUB_ASSIGN: /* int, pointer -> pointer */ case ADD_ASSIGN: /* numeric, numeric -> numeric */ if (opid == TPLUS || opid == ADD_ASSIGN) { ret->val = multiVal_add (exprNode_getValue (e1), exprNode_getValue (e2)); } else { ret->val = multiVal_subtract (exprNode_getValue (e1), exprNode_getValue (e2)); } tr1 = ctype_fixArrayPtr (tr1); if ((ctype_isRealPointer (tr1) && !exprNode_isNullValue (e1)) && (!ctype_isRealPointer (tr2) && ctype_isRealInt (tr2))) { /* pointer + int */ if (context_msgPointerArith ()) { voptgenerror (FLG_POINTERARITH, message ("Pointer arithmetic (%t, %t): %s", te1, te2, exprNode_unparse (ret)), e1->loc); } /* ** Swap terms so e1 is always the pointer */ if (ctype_isRealPointer (tr1)) { ; } else { exprNode_swap (e1, e2); } if (sRef_possiblyNull (e1->sref) && !usymtab_isGuarded (e1->sref)) { voptgenerror (FLG_NULLPOINTERARITH, message ("Pointer arithmetic involving possibly " "null pointer %s: %s", exprNode_unparse (e1), exprNode_unparse (ret)), e1->loc); } ret->sref = sRef_copy (e1->sref); /* start modifications */ /* added by Seejo on 4/16/2000 */ /* Arithmetic operations on pointers wil modify the size/len/null terminated status */ if ((sRef_isPossiblyNullTerminated (e1->sref)) || (sRef_isNullTerminated(e1->sref))) { int val; /*drl 1-4-2002 added ugly fixed to stop program from crashing on point + int +int one day I'll fix this or ask Seejo wtf the codes supposed to do. */ if (!multiVal_isInt (e2->val) ) break; /*end drl*/ val = (int) multiVal_forceInt (e2->val); /* Operator : + or += */ if ((lltok_getTok (op) == TPLUS) || (lltok_getTok(op) == ADD_ASSIGN)) { if (sRef_getSize(e1->sref) >= val) {/* Incrementing the pointer by val should not result in a size < 0 (size = 0 is ok !) */ sRef_setSize (ret->sref, sRef_getSize(e1->sref) - val); if (sRef_getLen(e1->sref) == val) { /* i.e. the character at posn val is \0 */ sRef_setNotNullTerminatedState(ret->sref); sRef_resetLen (ret->sref); } else { sRef_setNullTerminatedState(ret->sref); sRef_setLen (ret->sref, sRef_getLen(e1->sref) - val); } } } /* Operator : - or -= */ if ((lltok_getTok (op) == TMINUS) || (lltok_getTok (op) == SUB_ASSIGN)) { if (sRef_getSize(e1->sref) >= 0) { sRef_setSize (ret->sref, sRef_getSize(e1->sref) + val); sRef_setLen (ret->sref, sRef_getLen(e1->sref) + val); } } } /* end modifications */ sRef_setNullError (ret->sref); /* ** Fixed for 2.2c: the alias state of ptr + int is dependent, ** since is points to storage that should not be deallocated ** through this pointer. */ if (sRef_isOnly (ret->sref) || sRef_isFresh (ret->sref)) { sRef_setAliasKind (ret->sref, AK_DEPENDENT, exprNode_loc (ret)); } tret = e1->typ; } else if ((!ctype_isRealPointer(tr1) && ctype_isRealInt (tr1)) && (ctype_isRealPointer (tr2) && !exprNode_isNullValue (e2))) { if (context_msgPointerArith ()) { voptgenerror (FLG_POINTERARITH, message ("Pointer arithmetic (%t, %t): %s", te1, te2, exprNode_unparse (ret)), e1->loc); } if (sRef_possiblyNull (e1->sref) && !usymtab_isGuarded (e1->sref)) { voptgenerror (FLG_NULLPOINTERARITH, message ("Pointer arithmetic involving possibly " "null pointer %s: %s", exprNode_unparse (e2), exprNode_unparse (ret)), e2->loc); } ret->sref = sRef_copy (e2->sref); /* start modifications */ /* added by Seejo on 4/16/2000 */ /* Arithmetic operations on pointers wil modify the size/len/null terminated status */ if ((sRef_isPossiblyNullTerminated (e2->sref)) || (sRef_isNullTerminated(e2->sref))) { if (multiVal_isDefined (e1->val)) { int val = (int) multiVal_forceInt (e1->val); /* Operator : + or += */ if ((lltok_getTok (op) == TPLUS) || (lltok_getTok(op) == ADD_ASSIGN)) { if (sRef_getSize(e2->sref) >= val) {/* Incrementing the pointer by val should not result in a size < 0 (size = 0 is ok !) */ sRef_setSize (ret->sref, sRef_getSize(e2->sref) - val); if (sRef_getLen(e2->sref) == val) { /* i.e. the character at posn val is \0 */ sRef_setNotNullTerminatedState(ret->sref); sRef_resetLen (ret->sref); } else { sRef_setNullTerminatedState(ret->sref); sRef_setLen (ret->sref, sRef_getLen(e2->sref) - val); } } } /* Operator : - or -= */ if ((lltok_getTok (op) == TMINUS) || (lltok_getTok (op) == SUB_ASSIGN)) { if (sRef_getSize(e2->sref) >= 0) { sRef_setSize (ret->sref, sRef_getSize(e2->sref) + val); sRef_setLen (ret->sref, sRef_getLen(e2->sref) + val); } } } } /* end modifications */ sRef_setNullError (ret->sref); /* ** Fixed for 2.2c: the alias state of ptr + int is dependent, ** since is points to storage that should not be deallocated ** through this pointer. */ if (sRef_isOnly (ret->sref) || sRef_isFresh (ret->sref)) { sRef_setAliasKind (ret->sref, AK_DEPENDENT, exprNode_loc (ret)); } tret = e2->typ; ret->sref = e2->sref; } else { tret = checkNumerics (tr1, tr2, te1, te2, e1, e2, op); } break; case LEFT_ASSIGN: case RIGHT_ASSIGN: case LEFT_OP: case RIGHT_OP: case TAMPERSAND: /* bitwise & */ case AND_ASSIGN: case TCIRC: /* ^ (XOR) */ case TBAR: case XOR_ASSIGN: case OR_ASSIGN: { bool reported = FALSE; /* ** Shift Operator */ if (opid == LEFT_OP || opid == LEFT_ASSIGN || opid == RIGHT_OP || opid == RIGHT_ASSIGN) { /* ** evans 2002-01-01: fixed this to follow ISO 6.5.7. */ if (!ctype_isUnsigned (tr2) && !exprNode_isNonNegative (e2)) { reported = optgenerror (FLG_SHIFTNEGATIVE, message ("Right operand of %s may be negative (%t): %s", lltok_unparse (op), te2, exprNode_unparse (ret)), e2->loc); } if (!ctype_isUnsigned (tr1) && !exprNode_isNonNegative (e1)) { reported = optgenerror (FLG_SHIFTIMPLEMENTATION, message ("Left operand of %s may be negative (%t): %s", lltok_unparse (op), te1, exprNode_unparse (ret)), e1->loc); } /* ** Should check size of right operand also... */ } else { if (!ctype_isUnsigned (tr1)) { if (exprNode_isNonNegative (e1)) { ; } else { reported = optgenerror (FLG_BITWISEOPS, message ("Left operand of %s is not unsigned value (%t): %s", lltok_unparse (op), te1, exprNode_unparse (ret)), e1->loc); if (reported) { te1 = ctype_uint; } } } else { if (!ctype_isUnsigned (tr2)) { if (!exprNode_isNonNegative (e2)) { reported = optgenerror (FLG_BITWISEOPS, message ("Right operand of %s is not unsigned value (%t): %s", lltok_unparse (op), te2, exprNode_unparse (ret)), e2->loc); } } } } if (!reported) { if (!checkIntegral (e1, e2, ret, op)) { te1 = ctype_unknown; } } DPRINTF (("Set: %s", ctype_unparse (te1))); /* ** tret is the widest type of te1 and te2 */ tret = ctype_widest (te1, te2); break; } case MOD_ASSIGN: case TPERCENT: if (checkIntegral (e1, e2, ret, op)) { tret = te1; } else { tret = ctype_unknown; } break; case EQ_OP: case NE_OP: case TLT: /* comparisons */ case TGT: /* numeric, numeric -> bool */ DPRINTF (("Here we go: %s / %s", ctype_unparse (tr1), ctype_unparse (tr2))); if ((ctype_isReal (tr1) && !ctype_isInt (tr1)) || (ctype_isReal (tr2) && !ctype_isInt (tr2))) { ctype rtype = tr1; bool fepsilon = FALSE; if (!ctype_isReal (rtype) || ctype_isInt (rtype)) { rtype = tr2; } if (opid == TLT || opid == TGT) { uentry ue1 = exprNode_getUentry (e1); uentry ue2 = exprNode_getUentry (e2); /* ** FLT_EPSILON, etc. really is a variable, not ** a constant. */ if (uentry_isVariable (ue1)) { cstring uname = uentry_rawName (ue1); if (cstring_equalLit (uname, "FLT_EPSILON") || cstring_equalLit (uname, "DBL_EPSILON") || cstring_equalLit (uname, "LDBL_EPSILON")) { fepsilon = TRUE; } } if (uentry_isVariable (ue2)) { cstring uname = uentry_rawName (ue2); if (cstring_equalLit (uname, "FLT_EPSILON") || cstring_equalLit (uname, "DBL_EPSILON") || cstring_equalLit (uname, "LDBL_EPSILON")) { fepsilon = TRUE; } } } if (fepsilon) { ; /* Don't complain. */ } else { if (opid == EQ_OP || opid == NE_OP) { voptgenerror (FLG_REALCOMPARE, message ("Dangerous equality comparison involving %s types: %s", ctype_unparse (rtype), exprNode_unparse (ret)), ret->loc); } else { voptgenerror (FLG_REALRELATECOMPARE, message ("Possibly dangerous relational comparison involving %s types: %s", ctype_unparse (rtype), exprNode_unparse (ret)), ret->loc); } } } /*@fallthrough@*/ case LE_OP: case GE_OP: /* ** Types should match. */ DPRINTF (("Match types: %s / %s", exprNode_unparse (e1), exprNode_unparse (e2))); if (!exprNode_matchTypes (e1, e2)) { hasError = gentypeerror (te1, e1, te2, e2, message ("Operands of %s have incompatible types (%t, %t): %s", lltok_unparse (op), te1, te2, exprNode_unparse (ret)), e1->loc); } if (hasError || (ctype_isForceRealNumeric (&tr1) && ctype_isForceRealNumeric (&tr2)) || (ctype_isRealPointer (tr1) && ctype_isRealPointer (tr2))) { ; /* okay */ } else { if ((ctype_isRealNumeric (tr1) && ctype_isRealPointer (tr2)) || (ctype_isRealPointer (tr1) && ctype_isRealNumeric (tr2))) { voptgenerror (FLG_PTRNUMCOMPARE, message ("Comparison of pointer and numeric (%t, %t): %s", te1, te2, exprNode_unparse (ret)), e1->loc); } else { (void) checkNumerics (tr1, tr2, te1, te2, e1, e2, op); } tret = ctype_bool; } /* certain comparisons on unsigned's and zero look suspicious */ if (opid == TLT || opid == LE_OP || opid == GE_OP) { if ((ctype_isUnsigned (tr1) && exprNode_isZero (e2)) || (ctype_isUnsigned (tr2) && exprNode_isZero (e1))) { voptgenerror (FLG_UNSIGNEDCOMPARE, message ("Comparison of unsigned value involving zero: %s", exprNode_unparse (ret)), e1->loc); } } /* EQ_OP should NOT be used with booleans (unless one is FALSE) */ if ((opid == EQ_OP || opid == NE_OP) && ctype_isDirectBool (tr1) && ctype_isDirectBool (tr2)) { /* ** is one a variable? */ if (uentry_isVariable (exprNode_getUentry (e1)) || uentry_isVariable (exprNode_getUentry (e2))) { /* ** comparisons with FALSE are okay */ if (exprNode_isFalseConstant (e1) || exprNode_isFalseConstant (e2)) { ; } else { voptgenerror (FLG_BOOLCOMPARE, message ("Use of %q with %s variables (risks inconsistency because " "of multiple true values): %s", cstring_makeLiteral ((opid == EQ_OP) ? "==" : "!="), context_printBoolName (), exprNode_unparse (ret)), e1->loc); } } } break; case AND_OP: /* bool, bool -> bool */ case OR_OP: if (ctype_isForceRealBool (&tr1) && ctype_isForceRealBool (&tr2)) { ; } else { if (context_maybeSet (FLG_BOOLOPS)) { if (!ctype_isRealBool (te1) && !ctype_isRealBool (te2)) { if (ctype_sameName (te1, te2)) { voptgenerror (FLG_BOOLOPS, message ("Operands of %s are non-boolean (%t): %s", lltok_unparse (op), te1, exprNode_unparse (ret)), e1->loc); } else { voptgenerror (FLG_BOOLOPS, message ("Operands of %s are non-booleans (%t, %t): %s", lltok_unparse (op), te1, te2, exprNode_unparse (ret)), e1->loc); } } else if (!ctype_isRealBool (te1)) { voptgenerror (FLG_BOOLOPS, message ("Left operand of %s is non-boolean (%t): %s", lltok_unparse (op), te1, exprNode_unparse (ret)), e1->loc); } else if (!ctype_isRealBool (te2)) { voptgenerror (FLG_BOOLOPS, message ("Right operand of %s is non-boolean (%t): %s", lltok_unparse (op), te2, exprNode_unparse (ret)), e2->loc); } else { ; } } tret = ctype_bool; } break; default: llfatalbug (cstring_makeLiteral ("There has been a problem in the parser. This is believed to result " "from a problem with bison v. 1.25. Please try rebuidling Splint " "using the pre-compiled grammar files by commenting out the " "BISON= line in the top-level Makefile.")); } skiprest: ret->typ = tret; DPRINTF (("Return type %s: %s", exprNode_unparse (ret), ctype_unparse (tret))); exprNode_checkUse (ret, e1->sref, e1->loc); exprNode_mergeUSs (ret, e2); exprNode_checkUse (ret, e2->sref, e2->loc); return ret; } /*@only@*/ exprNode exprNode_op (/*@only@*/ exprNode e1, /*@keep@*/ exprNode e2, /*@only@*/ lltok op) { exprNode ret; checkMacroParen (e1); checkMacroParen (e2); if (evaluationOrderUndefined (op) && context_maybeSet (FLG_EVALORDER)) { checkExpressionDefined (e1, e2, op); } ret = exprNode_makeOp (e1, e2, op); return (ret); } static void exprNode_checkAssignMod (exprNode e1, exprNode ret) { /* ** This is somewhat bogus! ** ** Assigning to a nested observer in a non-observer datatype ** should not produce an error. */ sRef ref = exprNode_getSref (e1); DPRINTF (("Check assign mod: %s", sRef_unparseFull (ref))); if (sRef_isObserver (ref) || ((sRef_isFileStatic (ref) || sRef_isFileOrGlobalScope (ref)) && ctype_isArray (ctype_realType (sRef_getType (ref))))) { sRef base = sRef_getBase (ref); if (sRef_isValid (base) && sRef_isObserver (base)) { exprNode_checkModify (e1, ret); } else { exprNode_checkModifyVal (e1, ret); } } else { exprNode_checkModify (e1, ret); } } exprNode exprNode_assign (/*@only@*/ exprNode e1, /*@only@*/ exprNode e2, /*@only@*/ lltok op) { bool isalloc = FALSE; bool isjustalloc = FALSE; bool noalias = FALSE; exprNode ret; DPRINTF (("%s [%s] <- %s [%s]", exprNode_unparse (e1), ctype_unparse (e1->typ), exprNode_unparse (e2), ctype_unparse (e2->typ))); if (lltok_getTok (op) != TASSIGN) { ret = exprNode_makeOp (e1, e2, op); DPRINTF (("Here goes: %s %s", ctype_unparse (e1->typ), ctype_unparse (e2->typ))); if (exprNode_isDefined (e1) && exprNode_isDefined (e2)) { if (ctype_isNumeric (e2->typ) || ctype_isNumeric (e1->typ)) { /* Its a pointer arithmetic expression like ptr += i */ noalias = TRUE; } } } else { ret = exprNode_createPartialCopy (e1); ret->kind = XPR_ASSIGN; ret->edata = exprData_makeOp (e1, e2, op); if (!exprNode_isError (e2)) { ret->sets = sRefSet_union (ret->sets, e2->sets); ret->msets = sRefSet_union (ret->msets, e2->msets); ret->uses = sRefSet_union (ret->uses, e2->uses); } } checkExpressionDefined (e1, e2, op); if (exprNode_isError (e1)) { if (!exprNode_isError (e2)) { ret->loc = fileloc_update (ret->loc, e2->loc); } else { ret->loc = fileloc_update (ret->loc, g_currentloc); } } if (!exprNode_isError (e2)) { checkMacroParen (e2); } if (exprNode_isDefined (e1)) { if (sRef_isMacroParamRef (e1->sref)) { if (context_inIterDef ()) { uentry ue = sRef_getUentry (e1->sref); if (uentry_isYield (ue)) { ; } else { if (fileloc_isDefined (e1->loc)) { voptgenerror (FLG_MACROPARAMS, message ("Assignment to non-yield iter parameter: %q", sRef_unparse (e1->sref)), e1->loc); } else { voptgenerror (FLG_MACROPARAMS, message ("Assignment to non-yield iter parameter: %q", sRef_unparse (e1->sref)), g_currentloc); } } } else { if (fileloc_isDefined (e1->loc)) { voptgenerror (FLG_MACROASSIGN, message ("Assignment to macro parameter: %q", sRef_unparse (e1->sref)), e1->loc); } else { voptgenerror (FLG_MACROASSIGN, message ("Assignment to macro parameter: %q", sRef_unparse (e1->sref)), g_currentloc); } exprNode_checkAssignMod (e1, ret); /* evans 2001-07-22 */ } } else { exprNode_checkAssignMod (e1, ret); } if (exprNode_isDefined (e2)) { if (lltok_getTok (op) == TASSIGN) { ctype te1 = exprNode_getType (e1); ctype te2 = exprNode_getType (e2); if (ctype_isVoid (te2)) { (void) gentypeerror (te2, e2, te1, e1, message ("Assignment of void value to %t: %s %s %s", te1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e1->loc); } else if (!ctype_forceMatch (te1, te2)) { if (exprNode_matchLiteral (te1, e2)) { DPRINTF (("Literals match: %s / %s", ctype_unparse (te1), exprNode_unparse (e2))); if (ctype_isNumAbstract (te1)) { if (!context_flagOn (FLG_NUMABSTRACTLIT, e1->loc)) { (void) llgenhinterror (FLG_NUMABSTRACT, message ("Assignment of %t literal to numabstract type %t: %s %s %s", te2, te1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), cstring_makeLiteral ("Use +numabstractlit to allow numeric literals to be used as numabstract values"), e1->loc); } } } else { (void) gentypeerror (te2, e2, te1, e1, message ("Assignment of %t to %t: %s %s %s", te2, te1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e1->loc); } } else { /* Type checks okay */ } } exprNode_mergeUSs (ret, e2); exprNode_checkUse (ret, e2->sref, e2->loc); DPRINTF (("Do assign! %s %s", exprNode_unparse (e1), exprNode_unparse (e2))); if (noalias) { ; } else { doAssign (e1, e2, FALSE); } ret->sref = e1->sref; } else { if (exprNode_isDefined (e2)) { exprNode_mergeUSs (ret, e2); exprNode_checkUse (ret, e2->sref, e2->loc); } } if (sRef_isPointer (e1->sref) && !sRef_isMacroParamRef (e1->sref)) { exprNode_checkUse (ret, sRef_getBase (e1->sref), e1->loc); } isjustalloc = sRef_isJustAllocated (e1->sref); isalloc = sRef_isAllocated (e1->sref); if (sRef_isField (e1->sref)) { sRef root = sRef_getRootBase (sRef_getBase (e1->sref)); if (!sRef_isAllocated (root) && !sRef_isMacroParamRef (root)) { exprNode_checkUse (ret, root, e1->loc); } } /* ** be careful! this defines e1->sref. */ /* evans 2001-07-22: removed if (!sRef_isMacroParamRef (e1->sref)) */ DPRINTF (("Setting: %s -> %s", exprNode_unparse (ret), sRef_unparse (e1->sref))); exprNode_checkSet (ret, e1->sref); if (isjustalloc) { sRef_setAllocatedComplete (e1->sref, exprNode_isDefined (e2) ? e2->loc : e1->loc); } else { if (isalloc) { sRef_setAllocatedShallowComplete (e1->sref, exprNode_loc (e2)); } } } return ret; } exprNode exprNode_cond (/*@keep@*/ exprNode pred, /*@keep@*/ exprNode ifclause, /*@keep@*/ exprNode elseclause) { exprNode ret; if (!exprNode_isError (pred)) { ret = exprNode_createPartialCopy (pred); checkMacroParen (pred); exprNode_checkPred (cstring_makeLiteralTemp ("conditional"), pred); if (!exprNode_isError (ifclause)) { checkMacroParen (ifclause); /* update macro counts! */ if (!exprNode_isError (elseclause)) { checkMacroParen (elseclause); if (!exprNode_matchTypes (ifclause, elseclause)) { if (gentypeerror (exprNode_getType (ifclause), ifclause, exprNode_getType (elseclause), elseclause, message ("Conditional clauses are not of same type: " "%s (%t), %s (%t)", exprNode_unparse (ifclause), exprNode_getType (ifclause), exprNode_unparse (elseclause), exprNode_getType (elseclause)), ifclause->loc)) { ret->sref = sRef_undefined; ret->typ = ctype_unknown; } } else { /* for now...should merge the states */ ret->sref = ifclause->sref; ret->typ = ifclause->typ; if (exprNode_isNullValue (ifclause)) { ret->typ = elseclause->typ; } } exprNode_checkUse (ret, pred->sref, pred->loc); exprNode_checkUse (ifclause, ifclause->sref, ifclause->loc); exprNode_checkUse (elseclause, elseclause->sref, elseclause->loc); exprNode_mergeCondUSs (ret, ifclause, elseclause); } else { ret->typ = ifclause->typ; exprNode_checkUse (pred, pred->sref, pred->loc); exprNode_checkUse (ifclause, ifclause->sref, ifclause->loc); exprNode_mergeCondUSs (ret, ifclause, exprNode_undefined); } } else { if (!exprNode_isError (elseclause)) { ret->typ = elseclause->typ; exprNode_checkUse (pred, pred->sref, pred->loc); exprNode_checkUse (elseclause, elseclause->sref, elseclause->loc); exprNode_mergeCondUSs (ret, exprNode_undefined, elseclause); } } } else /* pred is error */ { if (!exprNode_isError (ifclause)) { ret = exprNode_createSemiCopy (ifclause); checkMacroParen (ifclause); /* update macro counts! */ if (!exprNode_isError (elseclause)) { checkMacroParen (elseclause); ret->typ = ifclause->typ; if (!ctype_forceMatch (ifclause->typ, elseclause->typ)) { if (gentypeerror (exprNode_getType (ifclause), ifclause, exprNode_getType (elseclause), elseclause, message ("Conditional clauses are not of same type: " "%s (%t), %s (%t)", exprNode_unparse (ifclause), exprNode_getType (ifclause), exprNode_unparse (elseclause), exprNode_getType (elseclause)), ifclause->loc)) { ret->typ = ctype_unknown; } } exprNode_checkUse (ifclause, ifclause->sref, ifclause->loc); exprNode_checkUse (elseclause, elseclause->sref, elseclause->loc); exprNode_mergeCondUSs (ret, ifclause, elseclause); } } else if (!exprNode_isError (elseclause)) /* pred, if errors */ { ret = exprNode_createSemiCopy (ifclause); ret->typ = elseclause->typ; checkMacroParen (elseclause); exprNode_checkUse (elseclause, elseclause->sref, elseclause->loc); exprNode_mergeCondUSs (ret, exprNode_undefined, elseclause); } else /* all errors! */ { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); } } ret->kind = XPR_COND; ret->edata = exprData_makeCond (pred, ifclause, elseclause); if (exprNode_isDefined (ifclause) && exprNode_isDefined (elseclause)) { exprNode_combineControl (ret, ifclause, elseclause); } return (ret); } exprNode exprNode_condIfOmit (/*@keep@*/ exprNode pred, /*@keep@*/ exprNode elseclause) { exprNode ifclause = exprNode_createPartialCopy (pred); if (!context_flagOn (FLG_GNUEXTENSIONS, exprNode_loc (pred))) { (void) llgenhinterror (FLG_SYNTAX, message ("Conditionals with Omitted Operands is not supported by ISO C99"), message ("Use +gnuextensions to allow compound statement " "expressions (and other GNU language extensions) " "without this warning"), exprNode_loc (pred)); } return exprNode_cond(pred, ifclause, elseclause); } exprNode exprNode_vaArg (/*@only@*/ lltok tok, /*@only@*/ exprNode arg, /*@only@*/ qtype qt) { ctype totype = qtype_getType (qt); exprNode ret = exprNode_createPartialLocCopy (arg, fileloc_copy (lltok_getLoc (tok))); ctype targ; /* ** check use of va_arg : , type -> type */ if (exprNode_isError (arg)) { } else { targ = exprNode_getType (arg); /* ** arg should have be a pointer */ if (!ctype_isUA (targ) || (!typeId_equal (ctype_typeId (targ), usymtab_getTypeId (cstring_makeLiteralTemp ("va_list"))))) { voptgenerror (FLG_TYPE, message ("First argument to va_arg is not a va_list (type %t): %s", targ, exprNode_unparse (arg)), arg->loc); } exprNode_checkSet (ret, arg->sref); } /* ** return type is totype */ ret->typ = totype; ret->kind = XPR_VAARG; ret->edata = exprData_makeCast (tok, arg, qt); return (ret); } exprNode exprNode_labelMarker (/*@only@*/ cstring label) { exprNode ret = exprNode_createPlain (ctype_undefined); ret->kind = XPR_LABEL; ret->edata = exprData_makeLiteral (label); ret->isJumpPoint = TRUE; return (ret); /* for now, ignore label */ } exprNode exprNode_notReached (/*@returned@*/ exprNode stmt) { if (exprNode_isDefined (stmt)) { stmt->isJumpPoint = TRUE; /* This prevent stray no return path errors, etc. */ stmt->exitCode = XK_MUSTEXIT; } return (stmt); } bool exprNode_isDefaultMarker (exprNode e) { if (exprNode_isDefined (e)) { return (e->kind == XPR_DEFAULT || e->kind == XPR_FTDEFAULT); } return FALSE; } bool exprNode_isCaseMarker (exprNode e) { if (exprNode_isDefined (e)) { return (e->kind == XPR_FTCASE || e->kind == XPR_CASE); } return FALSE; } bool exprNode_isLabelMarker (exprNode e) { if (exprNode_isDefined (e)) { return (e->kind == XPR_LABEL); } return FALSE; } exprNode exprNode_caseMarker (/*@only@*/ exprNode test, bool fallThrough) { exprNode ret = exprNode_createPartialCopy (test); ret->kind = fallThrough ? XPR_FTCASE : XPR_CASE; if (exprNode_isError (test)) { return ret; } exprNode_checkUse (ret, test->sref, test->loc); usymtab_setExitCode (ret->exitCode); if (ret->mustBreak) { usymtab_setMustBreak (); } ret->edata = exprData_makeSingle (test); ret->isJumpPoint = TRUE; return ret; } # if 0 exprNode exprNode_caseStatement (/*@only@*/ exprNode test, /*@only@*/ exprNode stmt, bool fallThrough) { exprNode ret = exprNode_createPartialCopy (test); ret->kind = fallThrough ? XPR_FTCASE : XPR_CASE; ret->edata = exprData_makePair (test, stmt); ret->isJumpPoint = TRUE; if (exprNode_isError (test)) { return ret; } exprNode_checkUse (ret, test->sref, test->loc); if (exprNode_isError (stmt)) { return ret; } exprNode_mergeUSs (ret, stmt); ret->exitCode = stmt->exitCode; ret->mustBreak = stmt->mustBreak; ret->canBreak = stmt->canBreak; usymtab_setExitCode (ret->exitCode); if (ret->mustBreak) { usymtab_setMustBreak (); } return ret; } # endif /*@notnull@*/ /*@only@*/ exprNode exprNode_defaultMarker (/*@only@*/ lltok def, bool fallThrough) { exprNode ret = exprNode_createTok (def); ret->isJumpPoint = TRUE; ret->kind = fallThrough ? XPR_FTDEFAULT : XPR_DEFAULT; return (ret); } bool exprNode_mayEscape (exprNode e) { if (exprNode_isDefined (e)) { return exitkind_couldEscape (e->exitCode); } return FALSE; } static bool exprNode_mustBreak (exprNode e) { if (exprNode_isDefined (e)) { return e->mustBreak; } return FALSE; } bool exprNode_mustEscape (exprNode e) { if (exprNode_isDefined (e)) { return exitkind_mustEscape (e->exitCode) || exprNode_mustBreak (e); } return FALSE; } bool exprNode_errorEscape (exprNode e) { if (exprNode_isDefined (e)) { return exitkind_isError (e->exitCode); } return FALSE; } exprNode exprNode_concat (/*@only@*/ exprNode e1, /*@only@*/ exprNode e2) { exprNode ret = exprNode_createPartialCopy (e1); DPRINTF (("Concat: %s / %s", exprNode_unparse (e1), exprNode_unparse (e2))); ret->edata = exprData_makePair (e1, e2); ret->kind = XPR_STMTLIST; if (exprNode_isDefined (e1)) { ret->isJumpPoint = e1->isJumpPoint; ret->canBreak = e1->canBreak; } else { if (exprNode_isDefined (e2)) { ret->loc = fileloc_update (ret->loc, e2->loc); } } if (exprNode_isDefined (e2)) { ret->exitCode = e2->exitCode; ret->mustBreak = e2->mustBreak; if (e2->canBreak) ret->canBreak = TRUE; } /* ** if e1 must return, then e2 is unreachable! */ if (exprNode_isDefined (e1) && exprNode_isDefined (e2)) { if ((exprNode_mustEscape (e1) || exprNode_mustBreak (e1)) && !(e2->isJumpPoint)) { if (context_getFlag (FLG_UNREACHABLE)) { exprNode nr = e2; if (e2->kind == XPR_STMT) { nr = exprData_getUopNode (e2->edata); } if ((nr->kind == XPR_TOK && lltok_isSemi (exprData_getTok (nr->edata)))) { /* okay to have unreachable ";" */ ret->exitCode = XK_MUSTEXIT; ret->canBreak = TRUE; } else { if (optgenerror (FLG_UNREACHABLE, message ("Unreachable code: %s", exprNode_unparseFirst (nr)), exprNode_loc (nr))) { ret->isJumpPoint = TRUE; ret->mustBreak = FALSE; ret->exitCode = XK_ERROR; DPRINTF (("Jump point: %s", exprNode_unparse (ret))); } else { ret->exitCode = XK_MUSTEXIT; ret->canBreak = TRUE; } } } } else { if ((e2->kind == XPR_CASE || e2->kind == XPR_DEFAULT)) { /* ** We want a warning anytime we have: ** case xxx: ... ** yyy; <<<- no break or return ** case zzz: ... */ exprNode lastStmt = exprNode_lastStatement (e1); if (exprNode_isDefined (lastStmt) && !exprNode_mustEscape (lastStmt) && !exprNode_mustBreak (lastStmt) && !exprNode_isCaseMarker (lastStmt) && !exprNode_isDefaultMarker (lastStmt) && !exprNode_isLabelMarker (lastStmt)) { voptgenerror (FLG_CASEBREAK, cstring_makeLiteral ("Fall through case (no preceding break)"), e2->loc); } } } } exprNode_mergeUSs (ret, e2); usymtab_setExitCode (ret->exitCode); if (ret->mustBreak) { usymtab_setMustBreak (); } DPRINTF (("==> %s", exprNode_unparse (ret))); return ret; } exprNode exprNode_createTok (/*@only@*/ lltok t) { exprNode ret = exprNode_create (ctype_unknown); ret->kind = XPR_TOK; ret->edata = exprData_makeTok (t); return ret; } exprNode exprNode_statement (/*@only@*/ exprNode e, /*@only@*/ lltok t) { if (!exprNode_isError (e)) { exprChecks_checkStatementEffect(e); } return (exprNode_statementError (e, t)); } static exprNode exprNode_statementError (/*@only@*/ exprNode e, /*@only@*/ lltok t) { exprNode ret = exprNode_createPartialCopy (e); if (!exprNode_isError (e)) { if (e->kind != XPR_ASSIGN) { exprNode_checkUse (ret, e->sref, e->loc); } ret->exitCode = e->exitCode; ret->canBreak = e->canBreak; ret->mustBreak = e->mustBreak; } ret->edata = exprData_makeUop (e, t); ret->kind = XPR_STMT; return ret; } exprNode exprNode_checkExpr (/*@returned@*/ exprNode e) { if (!exprNode_isError (e)) { if (e->kind != XPR_ASSIGN) { exprNode_checkUse (e, e->sref, e->loc); } } return e; } void exprNode_produceGuards (exprNode pred) { if (!exprNode_isError (pred)) { if (ctype_isRealPointer (pred->typ)) { pred->guards = guardSet_addTrueGuard (pred->guards, pred->sref); } exprNode_checkUse (pred, pred->sref, pred->loc); exprNode_resetSref (pred); } } exprNode exprNode_compoundStatementExpression (/*@only@*/ lltok tlparen, /*@only@*/ exprNode e) { exprNode laststmt; DPRINTF (("Compound: %s", exprNode_unparse (e))); if (!context_flagOn (FLG_GNUEXTENSIONS, exprNode_loc (e))) { (void) llgenhinterror (FLG_SYNTAX, message ("Compound statement expressions is not supported by ISO C99"), message ("Use +gnuextensions to allow compound statement expressions (and other GNU language extensions) " "without this warning"), exprNode_loc (e)); } /* ** The type of a compoundStatementExpression is the type of the last statement */ llassert (exprNode_isBlock (e)); laststmt = exprNode_lastStatement (e); DPRINTF (("Last statement: %s / %s", exprNode_unparse (laststmt), ctype_unparse (exprNode_getType (laststmt)))); DPRINTF (("e: %s", exprNode_unparse (e))); e->typ = exprNode_getType (laststmt); return exprNode_addParens (tlparen, e); } exprNode exprNode_makeBlock (/*@only@*/ exprNode e) { exprNode ret = exprNode_createPartialCopy (e); if (!exprNode_isError (e)) { ret->exitCode = e->exitCode; ret->canBreak = e->canBreak; ret->mustBreak = e->mustBreak; } DPRINTF (("Block e: %s", exprNode_unparse (e))); ret->edata = exprData_makeSingle (e); ret->kind = XPR_BLOCK; DPRINTF (("Block: %s", exprNode_unparse (ret))); return ret; } bool exprNode_isBlock (exprNode e) { return (exprNode_isDefined (e) && ((e)->kind == XPR_BLOCK)); } bool exprNode_isStatement (exprNode e) { return (exprNode_isDefined (e) && ((e)->kind == XPR_STMT)); } bool exprNode_isAssign (exprNode e) { if (exprNode_isDefined (e)) { return (e->kind == XPR_ASSIGN); } return FALSE; } bool exprNode_isEmptyStatement (exprNode e) { return (exprNode_isDefined (e) && (e->kind == XPR_TOK) && (lltok_isSemi (exprData_getTok (e->edata)))); } bool exprNode_isMultiStatement (exprNode e) { return (exprNode_isDefined (e) && ((e->kind == XPR_FOR) || (e->kind == XPR_FORPRED) || (e->kind == XPR_IF) || (e->kind == XPR_IFELSE) || (e->kind == XPR_WHILE) || (e->kind == XPR_WHILEPRED) || (e->kind == XPR_DOWHILE) || (e->kind == XPR_BLOCK) || (e->kind == XPR_STMT) || (e->kind == XPR_STMTLIST) || (e->kind == XPR_SWITCH))); } void exprNode_checkIfPred (exprNode pred) { exprNode_checkPred (cstring_makeLiteralTemp ("if"), pred); } exprNode exprNode_if (/*@only@*/ exprNode pred, /*@only@*/ exprNode tclause) { exprNode ret; bool emptyErr = FALSE; if (context_maybeSet (FLG_IFEMPTY)) { if (exprNode_isEmptyStatement (tclause)) { emptyErr = optgenerror (FLG_IFEMPTY, cstring_makeLiteral ("Body of if statement is empty"), exprNode_loc (tclause)); } } if (!emptyErr && context_maybeSet (FLG_IFBLOCK)) { if (exprNode_isDefined (tclause) && !exprNode_isBlock (tclause)) { voptgenerror (FLG_IFBLOCK, message ("Body of if statement is not a block: %s", exprNode_unparse (tclause)), exprNode_loc (tclause)); } } if (exprNode_isError (pred)) { if (exprNode_isError (tclause)) { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); } else { ret = exprNode_createPartialCopy (tclause); } } else { if (exprNode_mustEscape (pred)) { voptgenerror (FLG_UNREACHABLE, message ("Predicate always exits: %s", exprNode_unparse (pred)), exprNode_loc (pred)); } exprNode_checkUse (pred, pred->sref, pred->loc); if (!exprNode_isError (tclause)) { exprNode_mergeCondUSs (pred, tclause, exprNode_undefined); } ret = exprNode_createPartialCopy (pred); } ret->kind = XPR_IF; ret->edata = exprData_makePair (pred, tclause); ret->exitCode = XK_UNKNOWN; if (exprNode_isDefined (tclause)) { ret->exitCode = exitkind_makeConditional (tclause->exitCode); ret->canBreak = tclause->canBreak; ret->sets = sRefSet_union (ret->sets, tclause->sets); ret->msets = sRefSet_union (ret->msets, tclause->msets); ret->uses = sRefSet_union (ret->uses, tclause->uses); } ret->mustBreak = FALSE; return ret; } exprNode exprNode_ifelse (/*@only@*/ exprNode pred, /*@only@*/ exprNode tclause, /*@only@*/ exprNode eclause) { exprNode ret; bool tEmptyErr = FALSE; bool eEmptyErr = FALSE; if (context_maybeSet (FLG_IFEMPTY)) { if (exprNode_isEmptyStatement (tclause)) { tEmptyErr = optgenerror (FLG_IFEMPTY, cstring_makeLiteral ("Body of if clause of if statement is empty"), exprNode_loc (tclause)); } if (exprNode_isEmptyStatement (eclause)) { eEmptyErr = optgenerror (FLG_IFEMPTY, cstring_makeLiteral ("Body of else clause of if statement is empty"), exprNode_loc (eclause)); } } if (context_maybeSet (FLG_IFBLOCK)) { if (!tEmptyErr && exprNode_isDefined (tclause) && !exprNode_isBlock (tclause)) { voptgenerror (FLG_IFBLOCK, message ("Body of if clause of if statement is not a block: %s", exprNode_unparse (tclause)), exprNode_loc (tclause)); } if (!eEmptyErr && exprNode_isDefined (eclause) && !exprNode_isBlock (eclause) && !(eclause->kind == XPR_IF) && !(eclause->kind == XPR_IFELSE)) { voptgenerror (FLG_IFBLOCK, message ("Body of else clause of if statement is not a block: %s", exprNode_unparse (eclause)), exprNode_loc (eclause)); } } if (context_maybeSet (FLG_ELSEIFCOMPLETE)) { if (exprNode_isDefined (eclause) && (eclause->kind == XPR_IF)) { voptgenerror (FLG_ELSEIFCOMPLETE, message ("Incomplete else if logic (no final else): %s", exprNode_unparse (eclause)), exprNode_loc (eclause)); } } if (exprNode_isError (pred)) { if (exprNode_isError (tclause)) { if (exprNode_isError (eclause)) { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); } else { ret = exprNode_createPartialCopy (eclause); } } else { ret = exprNode_createPartialCopy (tclause); } } else /* pred is okay */ { ret = exprNode_createPartialCopy (pred); if (exprNode_mustEscape (pred)) { voptgenerror (FLG_UNREACHABLE, message ("Predicate always exits: %s", exprNode_unparse (pred)), exprNode_loc (pred)); } exprNode_checkUse (ret, pred->sref, pred->loc); exprNode_mergeCondUSs (ret, tclause, eclause); } ret->kind = XPR_IFELSE; ret->edata = exprData_makeCond (pred, tclause, eclause); if (exprNode_isDefined (tclause) && exprNode_isDefined (eclause)) { exprNode_combineControl (ret, tclause, eclause); ret->loc = fileloc_update (ret->loc, eclause->loc); } return ret; } /* ** *allpaths <- TRUE iff all executions paths must go through the switch */ static bool checkSwitchExpr (exprNode test, /*@dependent@*/ exprNode e, /*@out@*/ bool *allpaths) { exprNodeSList el = exprNode_flatten (e); bool mustReturn = TRUE; /* find a branch that doesn't */ bool thisReturn = FALSE; bool hasDefault = FALSE; bool hasAllMembers = FALSE; bool inSwitch = FALSE; bool isEnumSwitch = FALSE; bool canBreak = FALSE; bool fallThrough = FALSE; ctype ct = ctype_unknown; enumNameSList usedEnums; enumNameList enums; if (exprNode_isDefined (test)) { ctype ttype; ct = test->typ; ttype = ctype_realType (ct); if (ctype_isEnum (ttype)) { isEnumSwitch = TRUE; enums = ctype_elist (ttype); usedEnums = enumNameSList_new (); } } exprNodeSList_elements (el, current) { DPRINTF ((message("checkSwitchExpr current = %s ", exprNode_unparse(current) ) )); if (exprNode_isDefined (current)) { switch (current->kind) { case XPR_FTDEFAULT: case XPR_DEFAULT: if (hasDefault) { voptgenerror (FLG_DUPLICATECASES, message ("Duplicate default cases in switch"), exprNode_loc (current)); } /*@fallthrough@*/ case XPR_FTCASE: case XPR_CASE: if (current->kind == XPR_DEFAULT || current->kind == XPR_FTDEFAULT) { hasDefault = TRUE; } else { if (isEnumSwitch) { exprNode st = exprData_getSingle (current->edata); uentry ue = exprNode_getUentry (st); if (uentry_isValid (ue)) { cstring cname = uentry_rawName (ue); if (enumNameList_member (/*@-usedef@*/enums/*@=usedef@*/, cname)) { if (enumNameSList_member (/*@-usedef@*/usedEnums/*@=usedef@*/, cname)) { voptgenerror (FLG_DUPLICATECASES, message ("Duplicate case in switch: %s", cname), current->loc); } else { enumNameSList_addh (usedEnums, cname); } } else { voptgenerror (FLG_TYPE, message ("Case in switch not %s member: %s", ctype_unparse (ct), cname), current->loc); } } } } if (inSwitch && !fallThrough) { if (!thisReturn || canBreak) { mustReturn = FALSE; } } fallThrough = TRUE; inSwitch = TRUE; thisReturn = FALSE; canBreak = FALSE; /*@switchbreak@*/ break; default: thisReturn = thisReturn || exprNode_mustEscape (current); canBreak = canBreak || current->canBreak; if (canBreak) fallThrough = FALSE; } } } end_exprNodeSList_elements; if (inSwitch) /* check the last one! */ { if (!thisReturn || canBreak) { mustReturn = FALSE; } } if (isEnumSwitch) { if (!hasDefault && (enumNameSList_size (/*@-usedef@*/usedEnums/*@=usedef@*/) != enumNameList_size (/*@-usedef@*/enums/*@=usedef@*/))) { enumNameSList unused = enumNameSList_subtract (enums, usedEnums); voptgenerror (FLG_MISSCASE, message ("Missing case%s in switch: %q", cstring_makeLiteralTemp ((enumNameSList_size (unused) > 1) ? "s" : ""), enumNameSList_unparse (unused)), g_currentloc); enumNameSList_free (unused); *allpaths = FALSE; /* evans 2002-01-01 */ } else { hasAllMembers = TRUE; *allpaths = TRUE; } enumNameSList_free (usedEnums); } else { *allpaths = hasDefault; } exprNodeSList_free (el); return ((hasDefault || hasAllMembers) && mustReturn); } exprNode exprNode_switch (/*@only@*/ exprNode e, /*@only@*/ exprNode s) { exprNode ret = exprNode_createPartialCopy (e); bool allpaths; DPRINTF (("Switch: %s", exprNode_unparse (s))); ret->kind = XPR_SWITCH; ret->edata = exprData_makePair (e, s); if (!exprNode_isError (s)) { exprNode fs = exprNode_firstStatement (s); ret->loc = fileloc_update (ret->loc, s->loc); if (exprNode_isUndefined (fs) || exprNode_isCaseMarker (fs) || exprNode_isLabelMarker (fs) || exprNode_isDefaultMarker (fs)) { ; } else { voptgenerror (FLG_FIRSTCASE, message ("Statement after switch is not a case: %s", exprNode_unparse (fs)), fs->loc); } } if (!exprNode_isError (e)) { if (checkSwitchExpr (e, s, &allpaths)) { ret->exitCode = XK_MUSTRETURN; } else { ret->exitCode = e->exitCode; } ret->canBreak = e->canBreak; ret->mustBreak = e->mustBreak; } /* ** forgot this! ** exprNode.c:3883,32: Variable allpaths used before definition */ else { allpaths = FALSE; } DPRINTF (("Context exit switch!")); context_exitSwitch (ret, allpaths); DPRINTF (("Context exit switch done!")); return ret; } static void checkInfiniteLoop (/*@notnull@*/ exprNode test, /*@notnull@*/ exprNode body) { sRefSet tuses = test->uses; if (!sRefSet_isEmpty (test->uses)) { sRefSet sets = sRefSet_newCopy (body->sets); bool hasError = TRUE; bool innerState = FALSE; sRefSet tuncon = sRefSet_undefined; sets = sRefSet_union (sets, test->sets); sets = sRefSet_union (sets, body->msets); sets = sRefSet_union (sets, test->msets); sRefSet_allElements (tuses, el) { if (sRef_isUnconstrained (el)) { tuncon = sRefSet_insert (tuncon, el); } else { if (sRefSet_member (sets, el)) { hasError = FALSE; break; } } if (sRef_isInternalState (el) || sRef_isFileStatic (sRef_getRootBase (el))) { innerState = TRUE; } } end_sRefSet_allElements ; if (hasError) { sRefSet suncon = sRefSet_undefined; bool sinner = FALSE; sRefSet_allElements (sets, el) { if (sRef_isUnconstrained (el)) { suncon = sRefSet_insert (suncon, el); } else if (sRef_isInternalState (el)) { sinner = TRUE; } else { ; } } end_sRefSet_allElements ; if (sinner && innerState) { ; } else if (sRefSet_isEmpty (tuncon) && sRefSet_isEmpty (suncon)) { voptgenerror (FLG_INFLOOPS, message ("Suspected infinite loop. No value used in loop test (%q) " "is modified by test or loop body.", sRefSet_unparsePlain (tuses)), test->loc); } else { if (sRefSet_isEmpty (tuncon)) { voptgenerror (FLG_INFLOOPSUNCON, message ("Suspected infinite loop. No condition values " "modified. Modification possible through " "unconstrained calls: %q", sRefSet_unparsePlain (suncon)), test->loc); } else { voptgenerror (FLG_INFLOOPSUNCON, message ("Suspected infinite loop. No condition values " "modified. Possible undetected dependency through " "unconstrained calls in loop test: %q", sRefSet_unparsePlain (tuncon)), test->loc); } } } sRefSet_free (sets); } } exprNode exprNode_while (/*@keep@*/ exprNode t, /*@keep@*/ exprNode b) { exprNode ret; bool emptyErr = FALSE; if (context_maybeSet (FLG_WHILEEMPTY)) { if (exprNode_isEmptyStatement (b)) { emptyErr = optgenerror (FLG_WHILEEMPTY, cstring_makeLiteral ("Body of while statement is empty"), exprNode_loc (b)); } } if (!emptyErr && context_maybeSet (FLG_WHILEBLOCK)) { if (exprNode_isDefined (b) && !exprNode_isBlock (b)) { if (context_inIterDef () && (b->kind == XPR_STMTLIST || b->kind == XPR_TOK)) { ; /* no error */ } else { voptgenerror (FLG_WHILEBLOCK, message ("Body of while statement is not a block: %s", exprNode_unparse (b)), exprNode_loc (b)); } } } if (exprNode_isError (t)) { if (exprNode_isError (b)) { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); } else { ret = exprNode_createPartialCopy (b); } } else { exprNode test; ret = exprNode_createPartialCopy (t); llassert (t->kind == XPR_WHILEPRED); test = exprData_getSingle (t->edata); if (!exprNode_isError (b) && exprNode_isDefined (test)) { if (context_maybeSet (FLG_INFLOOPS) || context_maybeSet (FLG_INFLOOPSUNCON)) { /* ** check that some variable in the predicate is set by the body ** if the predicate uses any variables */ checkInfiniteLoop (test, b); } exprNode_mergeUSs (ret, b); if (exprNode_isDefined (b)) { ret->exitCode = exitkind_makeConditional (b->exitCode); } } } ret->edata = exprData_makePair (t, b); ret->kind = XPR_WHILE; if (exprNode_isDefined (t) && exprNode_mustEscape (t)) { voptgenerror (FLG_ALWAYSEXITS, message ("Predicate always exits: %s", exprNode_unparse (t)), exprNode_loc (t)); } ret->exitCode = XK_NEVERESCAPE; /* ** If loop is infinite, and there is no break inside, ** exit code is never reach. */ if (exprNode_knownIntValue (t)) { if (!exprNode_isZero (t)) { if (exprNode_isDefined (b)) { if (!b->canBreak) { /* Really, it means never reached. */ ret->exitCode = XK_MUSTEXIT; } } } } else { ; } ret->canBreak = FALSE; ret->mustBreak = FALSE; return ret; } /* ** do { b } while (t); ** ** note: body passed as first argument */ exprNode exprNode_doWhile (/*@only@*/ exprNode b, /*@only@*/ exprNode t) { exprNode ret; DPRINTF (("Do while: %s / %s", exprNode_unparse (b), exprNode_unparse (t))); if (exprNode_isError (t)) { if (exprNode_isError (b)) { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); } else { ret = exprNode_createPartialCopy (b); ret->exitCode = exitkind_makeConditional (b->exitCode); exprNode_checkUse (ret, b->sref, b->loc); ret->exitCode = b->exitCode; ret->canBreak = b->canBreak; ret->mustBreak = FALSE; } } else { DPRINTF (("Do while: %s / %s", exitkind_unparse (t->exitCode), exitkind_unparse (b->exitCode))); ret = exprNode_createPartialCopy (t); exprNode_checkPred (cstring_makeLiteralTemp ("while"), t); if (!exprNode_isError (b)) { /* ** forgot the copy's --- why wasn't this detected?? */ ret->sets = sRefSet_copyInto (ret->sets, b->sets); ret->msets = sRefSet_copyInto (ret->msets, b->msets); ret->uses = sRefSet_copyInto (ret->uses, b->uses); /* left this out --- causes and aliasing bug (infinite loop) should be detected?? */ exprNode_checkUse (ret, b->sref, b->loc); exprNode_mergeUSs (ret, t); exprNode_checkUse (ret, t->sref, t->loc); /* evans 2001-10-05: while loop can break */ ret->exitCode = exitkind_makeConditional (b->exitCode); DPRINTF (("Do while: %s", exitkind_unparse (ret->exitCode))); ret->canBreak = b->canBreak; /* Always FALSE for doWhile loops - break's when test is false */ ret->mustBreak = FALSE; /* b->mustBreak; */ } } context_exitDoWhileClause (t); ret->kind = XPR_DOWHILE; ret->edata = exprData_makePair (t, b); return ret; } bool exprNode_loopMustExec (exprNode forPred) { /* ** Returns true if it is obvious that the loop always executes at least once ** ** For now, we only identify the most obvious cases. Should be true anytime ** we can prove init => !test. */ if (exprNode_isDefined (forPred)) { exprNode init, test, inc; exprData edata; llassert (forPred->kind == XPR_FORPRED); edata = forPred->edata; init = exprData_getTripleInit (edata); test = exprData_getTripleTest (edata); inc = exprData_getTripleInc (edata); if (exprNode_isAssign (init)) { exprNode loopVar = exprData_getOpA (init->edata); exprNode loopInit = exprData_getOpB (init->edata); if (exprNode_isDefined (test) && test->kind == XPR_OP) { exprNode testVar = exprData_getOpA (test->edata); exprNode testVal = exprData_getOpB (test->edata); lltok comp = exprData_getOpTok (test->edata); int opid = lltok_getTok (comp); DPRINTF (("Same storage: %s / %s", exprNode_unparse (loopVar), exprNode_unparse (testVar))); if (exprNode_sameStorage (loopVar, testVar)) { multiVal valinit = exprNode_getValue (loopInit); multiVal valtest = exprNode_getValue (testVal); DPRINTF (("Values: %s / %s", multiVal_unparse (valinit), multiVal_unparse (valtest))); if (multiVal_isInt (valinit) && multiVal_isInt (valtest)) { long v1 = multiVal_forceInt (valinit); long v2 = multiVal_forceInt (valtest); DPRINTF (("Here: %ld %ld", v1, v2)); if ((opid == EQ_OP && v1 < v2) || (opid == NE_OP && v1 != v2) || (opid == TLT && v1 <= v2) || (opid == TGT && v1 >= v2) || (opid == LE_OP && v1 < v2) || (opid == GE_OP && v1 > v2)) { DPRINTF (("mustexec if inc")); return TRUE; } } } } } } DPRINTF (("loop must exec: FALSE")); return FALSE; } exprNode exprNode_for (/*@keep@*/ exprNode inc, /*@keep@*/ exprNode body) { exprNode ret; bool emptyErr = FALSE; if (context_maybeSet (FLG_FOREMPTY)) { if (exprNode_isEmptyStatement (body)) { emptyErr = optgenerror (FLG_FOREMPTY, cstring_makeLiteral ("Body of for statement is empty"), exprNode_loc (body)); } } if (!emptyErr && context_maybeSet (FLG_FORBLOCK)) { if (exprNode_isDefined (body) && !exprNode_isBlock (body)) { if (context_inIterDef () && (body->kind == XPR_STMTLIST || body->kind == XPR_TOK)) { ; /* no error */ } else { voptgenerror (FLG_FORBLOCK, message ("Body of for statement is not a block: %s", exprNode_unparse (body)), exprNode_loc (body)); } } } /* ** for ud purposes: (alreadly) init -> test -> (now) LOOP: body + inc + test */ if (exprNode_isError (body)) { ret = exprNode_createPartialCopy (inc); } else { ret = exprNode_createPartialCopy (body); ret->exitCode = exitkind_makeConditional (body->exitCode); exprNode_mergeUSs (inc, body); if (exprNode_isDefined (inc)) { exprNode tmp; context_setMessageAnnote (cstring_makeLiteral ("in post loop increment")); tmp = exprNode_effect (exprData_getTripleInc (inc->edata)); exprNode_freeShallow (tmp); context_clearMessageAnnote (); context_setMessageAnnote (cstring_makeLiteral ("in post loop test")); tmp = exprNode_effect (exprData_getTripleTest (inc->edata)); exprNode_freeShallow (tmp); context_clearMessageAnnote (); ret->uses = sRefSet_copyInto (ret->uses, inc->uses); ret->sets = sRefSet_copyInto (ret->sets, inc->sets); ret->msets = sRefSet_copyInto (ret->msets, inc->msets); } } ret->kind = XPR_FOR; ret->edata = exprData_makePair (inc, body); if (exprNode_isDefined (inc)) { exprNode test = exprData_getTripleTest (inc->edata); if (exprNode_isUndefined (test)) { if (exprNode_isDefined (body)) { if (!body->canBreak) { /* Really, it means never reached. */ ret->exitCode = XK_MUSTEXIT; } } } } return (ret); } /* ** for (init; test; inc) ** ==> ** init; ** while (test) { body; inc; } ** ** Now: check use of init (may set vars for test) ** check use of test ** no checks on inc _*/ /*@observer@*/ guardSet exprNode_getForGuards (exprNode pred) { exprNode test; if (exprNode_isError (pred)) return guardSet_undefined; llassert (pred->kind == XPR_FORPRED); test = exprData_getTripleTest (pred->edata); if (!exprNode_isError (test)) { return (test->guards); } return guardSet_undefined; } exprNode exprNode_whilePred (/*@only@*/ exprNode test) { exprNode ret = exprNode_createSemiCopy (test); if (exprNode_isDefined (test)) { exprNode_copySets (ret, test); exprNode_checkPred (cstring_makeLiteralTemp ("while"), test); exprNode_checkUse (ret, test->sref, test->loc); exprNode_produceGuards (test); ret->guards = guardSet_copy (test->guards); } ret->edata = exprData_makeSingle (test); ret->kind = XPR_WHILEPRED; return ret; } exprNode exprNode_forPred (/*@only@*/ exprNode init, /*@only@*/ exprNode test, /*@only@*/ exprNode inc) { exprNode ret; /* ** for ud purposes: init -> test -> LOOP: [ body, inc ] */ exprNode_checkPred (cstring_makeLiteralTemp ("for"), test); if (!exprNode_isError (inc)) { ret = exprNode_createPartialCopy (inc); } else { if (!exprNode_isError (init)) { ret = exprNode_createPartialCopy (init); } else if (!exprNode_isError (test)) { ret = exprNode_createPartialCopy (test); } else { ret = exprNode_createUnknown (); } } exprNode_mergeUSs (ret, init); if (exprNode_isDefined (init)) { exprNode_checkUse (ret, init->sref, init->loc); } exprNode_mergeUSs (ret, test); if (exprNode_isDefined (test)) { exprNode_checkUse (ret, test->sref, test->loc); } ret->kind = XPR_FORPRED; ret->edata = exprData_makeFor (init, test, inc); return (ret); } /*@notnull@*/ /*@only@*/ exprNode exprNode_goto (/*@only@*/ cstring label) { exprNode ret = exprNode_createUnknown (); if (context_inMacro ()) { voptgenerror (FLG_MACROSTMT, message ("Macro %s uses goto (not functional)", context_inFunctionName ()), g_currentloc); } ret->kind = XPR_GOTO; ret->edata = exprData_makeLiteral (label); ret->mustBreak = TRUE; ret->exitCode = XK_GOTO; ret->canBreak = TRUE; return ret; } exprNode exprNode_continue (/*@only@*/ lltok l, int qcontinue) { exprNode ret = exprNode_createLoc (ctype_unknown, fileloc_copy (lltok_getLoc (l))); ret->kind = XPR_CONTINUE; ret->edata = exprData_makeTok (l); ret->canBreak = TRUE; ret->mustBreak = TRUE; if (qcontinue == QSAFEBREAK) { ; /* no checking */ } else if (qcontinue == QINNERCONTINUE) { if (!context_inDeepLoop ()) { voptgenerror (FLG_LOOPLOOPCONTINUE, cstring_makeLiteral ("Continue statement marked with innercontinue " "is not inside a nested loop"), exprNode_loc (ret)); } } else if (qcontinue == BADTOK) { if (context_inDeepLoop ()) { voptgenerror (FLG_LOOPLOOPCONTINUE, cstring_makeLiteral ("Continue statement in nested loop"), exprNode_loc (ret)); } } else { llbuglit ("exprNode_continue: bad qcontinue"); } return ret; } exprNode exprNode_break (/*@only@*/ lltok l, int bqual) { exprNode ret = exprNode_createLoc (ctype_unknown, fileloc_copy (lltok_getLoc (l))); clause breakClause = context_breakClause (); ret->kind = XPR_BREAK; ret->edata = exprData_makeTok (l); ret->canBreak = TRUE; ret->mustBreak = TRUE; if (breakClause == NOCLAUSE) { voptgenerror (FLG_SYNTAX, cstring_makeLiteral ("Break not inside while, for or switch statement"), exprNode_loc (ret)); } else { if (bqual != BADTOK) { switch (bqual) { case QSAFEBREAK: break; case QINNERBREAK: if (breakClause == SWITCHCLAUSE) { if (!context_inDeepSwitch ()) { voptgenerror (FLG_SYNTAX, cstring_makeLiteral ("Break preceded by innerbreak is not in a deep switch"), exprNode_loc (ret)); } } else { if (!context_inDeepLoop ()) { voptgenerror (FLG_SYNTAX, cstring_makeLiteral ("Break preceded by innerbreak is not in a deep loop"), exprNode_loc (ret)); } } break; case QLOOPBREAK: if (breakClause == SWITCHCLAUSE) { voptgenerror (FLG_SYNTAX, cstring_makeLiteral ("Break preceded by loopbreak is breaking a switch"), exprNode_loc (ret)); } break; case QSWITCHBREAK: if (breakClause != SWITCHCLAUSE) { voptgenerror (FLG_SYNTAX, message ("Break preceded by switchbreak is breaking %s", cstring_makeLiteralTemp ((breakClause == WHILECLAUSE || breakClause == DOWHILECLAUSE) ? "a while loop" : (breakClause == FORCLAUSE) ? "a for loop" : (breakClause == ITERCLAUSE) ? "an iterator" : "")), exprNode_loc (ret)); } break; BADDEFAULT; } } else { if (breakClause == SWITCHCLAUSE) { clause nextBreakClause = context_nextBreakClause (); switch (nextBreakClause) { case NOCLAUSE: break; case WHILECLAUSE: case DOWHILECLAUSE: case FORCLAUSE: case ITERCLAUSE: voptgenerror (FLG_LOOPSWITCHBREAK, cstring_makeLiteral ("Break statement in switch inside loop"), exprNode_loc (ret)); break; case SWITCHCLAUSE: voptgenerror (FLG_SWITCHSWITCHBREAK, cstring_makeLiteral ("Break statement in switch inside switch"), exprNode_loc (ret)); break; BADDEFAULT; } } else { if (context_inDeepLoop ()) { voptgenerror (FLG_LOOPLOOPBREAK, cstring_makeLiteral ("Break statement in nested loop"), exprNode_loc (ret)); } else { if (context_inDeepLoopSwitch ()) { voptgenerror (FLG_SWITCHLOOPBREAK, cstring_makeLiteral ("Break statement in loop inside switch"), exprNode_loc (ret)); } } } } } return ret; } exprNode exprNode_nullReturn (/*@only@*/ lltok t) { fileloc loc = lltok_getLoc (t); exprNode ret = exprNode_createLoc (ctype_unknown, fileloc_copy (loc)); context_returnFunction (); exprChecks_checkNullReturn (loc); ret->kind = XPR_NULLRETURN; ret->edata = exprData_makeTok (t); ret->exitCode = XK_MUSTRETURN; return ret; } exprNode exprNode_return (/*@only@*/ exprNode e) { exprNode ret; if (exprNode_isError (e)) { ret = exprNode_createUnknown (); } else { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (e->loc)); exprNode_checkUse (ret, e->sref, e->loc); exprNode_checkReturn (e); } context_returnFunction (); ret->kind = XPR_RETURN; ret->edata = exprData_makeSingle (e); ret->exitCode = XK_MUSTRETURN; return (ret); } exprNode exprNode_comma (/*@only@*/ exprNode e1, /*@only@*/ exprNode e2) { exprNode ret; if (exprNode_isError (e1)) { if (exprNode_isError (e2)) { ret = exprNode_createLoc (ctype_unknown, fileloc_copy (g_currentloc)); } else { ret = exprNode_createPartialCopy (e2); exprNode_checkUse (ret, e2->sref, e2->loc); ret->sref = e2->sref; } } else { ret = exprNode_createPartialCopy (e1); exprNode_checkUse (ret, e1->sref, e1->loc); if (!exprNode_isError (e2)) { exprNode_mergeUSs (ret, e2); exprNode_checkUse (ret, e2->sref, e2->loc); ret->sref = e2->sref; } } ret->kind = XPR_COMMA; ret->edata = exprData_makePair (e1, e2); if (exprNode_isDefined (e1)) { if (exprNode_isDefined (e2)) { ret->typ = e2->typ; if (exprNode_mustEscape (e1) || e1->mustBreak) { voptgenerror (FLG_UNREACHABLE, message ("Second clause of comma expression is unreachable: %s", exprNode_unparse (e2)), exprNode_loc (e2)); } ret->exitCode = exitkind_combine (e1->exitCode, e2->exitCode); ret->mustBreak = e1->mustBreak || e2->mustBreak; ret->canBreak = e1->canBreak || e2->canBreak; } else { if (exprNode_mustEscape (e1) || e1->mustBreak) { voptgenerror (FLG_UNREACHABLE, message ("Second clause of comma expression is unreachable: %s", exprNode_unparse (e2)), exprNode_loc (e2)); } ret->exitCode = e1->exitCode; ret->canBreak = e1->canBreak; } } else { if (exprNode_isDefined (e2)) { ret->exitCode = e2->exitCode; ret->mustBreak = e2->mustBreak; ret->canBreak = e2->canBreak; } } return (ret); } static bool exprNode_checkOneInit (/*@notnull@*/ exprNode el, exprNode val) { ctype t1 = exprNode_getType (el); ctype t2 = exprNode_getType (val); bool hasError = FALSE; DPRINTF (("Check one init: %s / %s", exprNode_unparse (el), exprNode_unparse (val))); if (ctype_isUnknown (t1)) { voptgenerror (FLG_IMPTYPE, message ("Variable has unknown (implicitly int) type: %s", exprNode_unparse (el)), el->loc); t1 = ctype_int; el->typ = ctype_int; } if (exprNode_isDefined (val) && val->kind == XPR_INITBLOCK) { exprNodeList vals = exprData_getArgs (val->edata); DPRINTF (("Check one init: %s", exprNodeList_unparse (vals))); DPRINTF (("Type: %s", ctype_unparse (t1))); if (ctype_isRealAP (t1)) { int i = 0; int nerrors = 0; if (ctype_isFixedArray (t1)) { size_t nelements = ctype_getArraySize (t1); DPRINTF (("Checked array: %s / %d", ctype_unparse (t1), nelements)); if (exprNode_isStringLiteral (val)) { exprNode_checkStringLiteralLength (t1, val); } else { if (exprNodeList_size (vals) != size_toInt (nelements)) { hasError = optgenerror (exprNodeList_size (vals) > size_toInt (nelements) ? FLG_INITSIZE : FLG_INITALLELEMENTS, message ("Initializer block for " "%s has %d element%&, but declared as %s: %q", exprNode_unparse (el), exprNodeList_size (vals), ctype_unparse (t1), exprNodeList_unparse (vals)), val->loc); } } } exprNodeList_elements (vals, oneval) { cstring istring = message ("%d", i); exprNode newel = exprNode_arrayFetch (exprNode_fakeCopy (el), exprNode_numLiteral (ctype_int, istring, fileloc_copy (el->loc), i)); if (exprNode_isDefined (newel)) { if (exprNodeList_size (vals) == 1 && ctype_isString (exprNode_getType (oneval)) && ctype_isChar (exprNode_getType (newel))) { exprNode_freeIniter (newel); } else { if (exprNode_checkOneInit (newel, oneval)) { hasError = TRUE; nerrors++; if (nerrors > 3 && exprNodeList_size (vals) > 6) { llgenmsg (message ("Additional initialization errors " "for %s not reported", exprNode_unparse (el)), exprNode_loc (el)); exprNode_freeIniter (newel); break; } else { exprNode_freeIniter (newel); } } else { exprNode_freeIniter (newel); } } } cstring_free (istring); i++; /*@-branchstate@*/ } end_exprNodeList_elements; /*@=branchstate@*/ } else if (ctype_isStruct (ctype_realType (t1))) { uentryList fields = ctype_getFields (t1); int i = 0; if (uentryList_size (fields) != exprNodeList_size (vals)) { if (uentryList_size (fields) > exprNodeList_size (vals)) { hasError = optgenerror (FLG_FULLINITBLOCK, message ("Initializer block for " "%s has %d field%&, but %s has %d field%&: %q", exprNode_unparse (el), exprNodeList_size (vals), ctype_unparse (t1), uentryList_size (fields), exprNodeList_unparse (vals)), val->loc); } else { hasError = optgenerror (FLG_TYPE, message ("Initializer block for " "%s has %d field%&, but %s has %d field%&: %q", exprNode_unparse (el), exprNodeList_size (vals), ctype_unparse (t1), uentryList_size (fields), exprNodeList_unparse (vals)), val->loc); } } else { exprNodeList_elements (vals, oneval) { uentry thisfield = uentryList_getN (fields, i); exprNode newel = exprNode_fieldAccessAux (exprNode_fakeCopy (el), exprNode_loc (el), uentry_getName (thisfield)); if (exprNode_isDefined (newel)) { if (exprNode_checkOneInit (newel, oneval)) { hasError = TRUE; } exprNode_freeIniter (newel); } i++; } end_exprNodeList_elements; } } /* evans 2001-12-30: added to fix bug reported by Jim Zelenka */ else if (ctype_isUnion (ctype_realType (t1))) { uentryList fields = ctype_getFields (t1); int i = 0; /* ** Union initializers set the first member always. */ DPRINTF (("Union initializer: %s / %s", exprNode_unparse (el), ctype_unparse (ctype_realType (t1)))); if (exprNodeList_size (vals) != 1) { hasError = optgenerror (FLG_TYPE, message ("Initializer block for union " "%s has %d elements, union initializers should have one element: %q", exprNode_unparse (el), exprNodeList_size (vals), exprNodeList_unparse (vals)), val->loc); } else { exprNode oneval = exprNodeList_head (vals); uentry thisfield = uentryList_getN (fields, i); exprNode newel = exprNode_fieldAccessAux (exprNode_fakeCopy (el), exprNode_loc (el), uentry_getName (thisfield)); if (exprNode_isDefined (newel)) { if (exprNode_checkOneInit (newel, oneval)) { hasError = TRUE; } exprNode_freeIniter (newel); } } } else { hasError = optgenerror (FLG_TYPE, message ("Initializer block used for " "%s where %t is expected: %s", exprNode_unparse (el), t1, exprNode_unparse (val)), val->loc); } } else { if (exprNode_isDefined (val)) { doAssign (el, val, TRUE); if (!exprNode_matchType (t1, val)) { hasError = gentypeerror (t1, val, t2, el, message ("Initial value of %s is type %t, " "expects %t: %s", exprNode_unparse (el), t2, t1, exprNode_unparse (val)), val->loc); } } } return hasError; } static /*@notnull@*/ exprNode exprNode_makeInitializationAux (/*@temp@*/ idDecl t) { exprNode ret; DPRINTF (("Initialization: %s", idDecl_unparse (t))); if (usymtab_exists (idDecl_observeId (t))) { uentry ue = usymtab_lookup (idDecl_observeId (t)); ret = exprNode_createId (ue); } else { uentry ue; DPRINTF (("Unrecognized: %s", idDecl_unparse (t))); ue = uentry_makeUnrecognized (idDecl_observeId (t), fileloc_copy (g_currentloc)); ret = exprNode_fromIdentifierAux (ue); /* ** No error - this happens in old style declarations: voptgenerror (FLG_UNRECOG, message ("Unrecognized identifier in intializer: %s", idDecl_observeId (t)), g_currentloc); ** */ } exprData_free (ret->edata, ret->kind); ret->edata = exprData_undefined; ret->exitCode = XK_NEVERESCAPE; ret->mustBreak = FALSE; ret->kind = XPR_INIT; return ret; } exprNode exprNode_makeEmptyInitialization (/*@only@*/ idDecl t) { exprNode ret = exprNode_makeInitializationAux (t); llassert (ret->edata == exprData_undefined); ret->edata = exprData_makeInit (t, exprNode_undefined); return ret; } exprNode exprNode_makeInitialization (/*@only@*/ idDecl t, /*@only@*/ exprNode e) { uentry ue = usymtab_lookup (idDecl_observeId (t)); exprNode ret = exprNode_makeInitializationAux (t); fileloc loc = exprNode_loc (e); DPRINTF (("initialization: %s = %s", idDecl_unparse (t), exprNode_unparse (e))); if (exprNode_isError (e)) { e = exprNode_createUnknown (); /* error: assume initializer is defined */ sRef_setDefined (ret->sref, g_currentloc); ret->edata = exprData_makeInit (t, e); } else { ctype ct = ctype_realishType (ret->typ); /* ** evs - 9 Apr 1995 ** ** was addSafeUse --- what's the problem? ** ** int x = 3, y = x ? */ exprData_free (ret->edata, ret->kind); ret->edata = exprData_makeInit (t, e); DPRINTF (("ret: %s", exprNode_unparse (ret))); exprNode_checkUse (ret, e->sref, e->loc); if (ctype_isUnknown (e->typ) && uentry_isValid (ue)) { exprNode lhs = exprNode_createId (ue); /* ** static storage should be undefined before initializing */ if (uentry_isStatic (ue)) { sRef_setDefState (lhs->sref, SS_PARTIAL, fileloc_undefined); } (void) exprNode_checkOneInit (lhs, e); if (uentry_isStatic (ue)) { sRef_setDefState (lhs->sref, SS_DEFINED, fileloc_undefined); } exprNode_free (lhs); } else { if (!exprNode_matchType (ct, e)) { if (exprNode_isZero (e) && ctype_isArrayPtr (ct)) { ; } else { (void) gentypeerror (exprNode_getType (e), e, exprNode_getType (ret), ret, message ("Variable %q initialized to type %t, expects %t: %s", uentry_getName (ue), exprNode_getType (e), exprNode_getType (ret), exprNode_unparse (e)), e->loc); } } } if (uentry_isStatic (ue)) { sRef_setDefState (ret->sref, SS_PARTIAL, fileloc_undefined); } if (exprNode_isStringLiteral (e) && (ctype_isArray (ct)) && (ctype_isChar (ctype_realType (ctype_baseArrayPtr (ct))))) { /* ** If t is a char [], the literal is copied. */ exprNode_checkStringLiteralLength (ct, e); sRef_setDefState (ret->sref, SS_DEFINED, e->loc); ret->val = multiVal_copy (e->val); sRef_setNullTerminatedState (ret->sref); if (multiVal_isDefined (e->val)) { cstring slit = multiVal_forceString (e->val); sRef_setLen (ret->sref, size_toInt (cstring_length (slit) + 1)); } if (ctype_isFixedArray (ct)) { sRef_setSize (ret->sref, size_toInt (ctype_getArraySize (ct))); } } else { doAssign (ret, e, TRUE); } if (uentry_isStatic (ue)) { sRef_setDefState (ret->sref, SS_DEFINED, fileloc_undefined); } } if (context_inIterDef ()) { /* should check if it is yield */ uentry_setUsed (ue, loc); } else { ; } exprNode_mergeUSs (ret, e); DPRINTF (("Ret: %s %p %p", exprNode_unparse (ret), ret->requiresConstraints, ret->ensuresConstraints)); DPRINTF (("Ret: %s %s %s", exprNode_unparse (ret), constraintList_unparse (ret->requiresConstraints), constraintList_unparse (ret->ensuresConstraints))); return ret; } exprNode exprNode_iter (/*@observer@*/ uentry name, /*@only@*/ exprNodeList alist, /*@only@*/ exprNode body, /*@observer@*/ uentry end) { exprNode ret; cstring iname; llassert (uentry_isValid (name)); uentry_setUsed (name, exprNode_loc (body)); ret = exprNode_createPartialCopy (body); iname = uentry_getName (name); if (uentry_isInvalid (end)) { llerror (FLG_ITERBALANCE, message ("Iter %s not balanced with end_%s", iname, iname)); } else { cstring ename = uentry_getName (end); if (!cstring_equalPrefixLit (ename, "end_")) { llerror (FLG_ITERBALANCE, message ("Iter %s not balanced with end_%s: %s", iname, iname, ename)); } else { if (!cstring_equal (iname, cstring_suffix (ename, 4))) { llerror (FLG_ITERBALANCE, message ("Iter %s not balanced with end_%s: %s", iname, iname, ename)); } } cstring_free (ename); } context_exitIterClause (body); ret->kind = XPR_ITER; ret->edata = exprData_makeIter (name, alist, body, end); if (uentry_isIter (name)) { (void) checkArgsReal (name, body, uentry_getParams (name), alist, TRUE, ret); } cstring_free (iname); return ret; } exprNode exprNode_iterNewId (/*@only@*/ cstring s) { exprNode e = exprNode_new (); uentry ue = uentryList_getN (uentry_getParams (getCurrentIter ()), iterParamNo ()); llassert (processingIterVars ()); e->loc = context_getSaveLocation (); if (fileloc_isUndefined (e->loc)) { fileloc_free (e->loc); e->loc = fileloc_copy (g_currentloc); } e->uses = sRefSet_new (); e->sets = sRefSet_new (); e->msets = sRefSet_new (); e->kind = XPR_VAR; e->val = multiVal_unknown (); e->guards = guardSet_new (); e->sref = sRef_undefined; e->isJumpPoint = FALSE; e->exitCode = XK_NEVERESCAPE; /*> missing fields, detected by splint <*/ e->canBreak = FALSE; e->mustBreak = FALSE; e->etext = cstring_undefined; if (uentry_isYield (ue)) { uentry uue = uentry_makeVariable (s, uentry_getType (ue), fileloc_copy (e->loc), FALSE); sRef sr; uue = usymtab_supEntrySrefReturn (uue); sr = uentry_getSref (uue); sRef_mergeStateQuiet (sr, uentry_getSref (ue)); sr = uentry_getSref (uue); sRef_setDefined (sr, e->loc); e->typ = uentry_getType (uue); e->sref = sr; e->edata = exprData_makeId (uue); uentry_setUsed (uue, g_currentloc); } else { uentry uue; sRef_setGlobalScope (); uue = uentry_makeVariableLoc (s, ctype_unknown); e->typ = ctype_unknown; e->edata = exprData_makeId (uue); uentry_setUsed (uue, e->loc); uentry_setHasNameError (uue); if (context_getFlag (FLG_REPEATUNRECOG)) { uentry_markOwned (uue); } else { usymtab_supGlobalEntry (uue); } sRef_clearGlobalScope (); voptgenerror (FLG_UNRECOG, message ("Unrecognized identifier: %s", s), e->loc); } cstring_free (s); exprNode_defineConstraints(e); return (e); } exprNode exprNode_iterExpr (/*@returned@*/ exprNode e) { if (!processingIterVars ()) { llcontbuglit ("checkIterParam: not in iter"); return e; } if (uentry_isYield (uentryList_getN (uentry_getParams (getCurrentIter ()), iterParamNo ()))) { if (exprNode_isDefined (e)) { if (fileloc_isDefined (e->loc)) { voptgenerror (FLG_ITERYIELD, message ("Yield parameter is not simple identifier: %s", exprNode_unparse (e)), e->loc); } else { voptgenerror (FLG_ITERYIELD, message ("Yield parameter is not simple identifier: %s", exprNode_unparse (e)), g_currentloc); } } } return e; } exprNode exprNode_iterId (/*@observer@*/ uentry c) { uentry ue; llassert (processingIterVars ()); ue = uentryList_getN (uentry_getParams (getCurrentIter ()), iterParamNo ()); if (uentry_isYield (ue)) { ctype ct = uentry_getType (ue); exprNode e = exprNode_createPlain (ct); cstring name = uentry_getName (c); uentry le = uentry_makeVariable (name, ct, fileloc_undefined, FALSE); uentry_setUsed (ue, g_currentloc); uentry_setHasNameError (ue); cstring_free (name); e->kind = XPR_VAR; e->edata = exprData_makeId (le); e->loc = context_getSaveLocation (); e->sref = uentry_getSref (le); usymtab_supEntrySref (le); if (!context_inHeader ()) { if (optgenerror (FLG_ITERYIELD, message ("Yield parameter shadows local declaration: %q", uentry_getName (c)), fileloc_isDefined (e->loc) ? e->loc : g_currentloc)) { uentry_showWhereDeclared (c); } } return e; } return (exprNode_fromIdentifierAux (c)); } exprNode exprNode_iterStart (/*@observer@*/ uentry name, /*@only@*/ exprNodeList alist) { exprNode ret = exprNode_create (ctype_unknown); ret->kind = XPR_ITERCALL; ret->edata = exprData_makeIterCall (name, alist); if (uentry_isIter (name)) { uentryList params = uentry_getParams (name); if (context_inIterDef () && uentryList_size (params) == exprNodeList_size (alist)) { int i = 0; exprNodeList_elements (alist, arg) { uentry parg = uentryList_getN (params, i); if (uentry_isYield (parg)) { uentry ue = exprNode_getUentry (arg); if (uentry_isValid (ue)) { ; } } i++; } end_exprNodeList_elements; } (void) checkArgsReal (name, ret, params, alist, TRUE, ret); checkUnspecCall (ret, params, alist); } return ret; } /*@exposed@*/ sRef exprNode_getSref (exprNode e) { if (exprNode_isDefined (e)) { if (sRef_isInvalid (e->sref)) { /*@-mods@*/ e->sref = sRef_makeUnknown (); sRef_setAliasKind (e->sref, AK_ERROR, fileloc_undefined); /*@=mods@*/ return e->sref; } else { return e->sref; } } else { return sRef_undefined; } } /*@observer@*/ cstring exprNode_unparseFirst (exprNode e) { if (exprNode_isDefined (e)) { cstring ret; if (e->kind == XPR_STMTLIST || e->kind == XPR_COMMA || e->kind == XPR_COND) { exprNode first = exprData_getPairA (e->edata); if (exprNode_isDefined (first)) { return (exprNode_unparseFirst (exprData_getPairA (e->edata))); } else { return (cstring_makeLiteralTemp ("...")); } } ret = cstring_elide (exprNode_unparse (e), 20); cstring_markOwned (ret); return (ret); } else { return cstring_makeLiteralTemp (""); } } /*@observer@*/ cstring exprNode_unparse (/*@temp@*/ exprNode e) { if (exprNode_isError (e)) { return cstring_makeLiteralTemp (""); } if (cstring_isDefined (e->etext)) { return e->etext; } else { cstring ret = exprNode_doUnparse (e); /*@-modifies@*/ /* benevolent */ e->etext = ret; /*@=modifies@*/ return ret; } } /*@observer@*/ fileloc exprNode_loc (exprNode e) { if (exprNode_isError (e)) { return (g_currentloc); } else { return (e->loc); } } /* ** executes exprNode e ** recursively rexecutes as though in original parse using ** information in e->edata */ static /*@only@*/ exprNodeList exprNodeList_effect (exprNodeList e) { exprNodeList ret = exprNodeList_new (); exprNodeList_elements (e, current) { exprNodeList_addh (ret, exprNode_effect (current)); } end_exprNodeList_elements; return ret; } static /*@only@*/ exprNode exprNode_effect (exprNode e) /*@globals internalState@*/ { bool innerEffect = inEffect; exprNode ret; exprData data; inEffect = TRUE; context_clearJustPopped (); if (exprNode_isError (e)) { ret = exprNode_undefined; } else { /* ** Turn off expose and dependent transfer checking. ** Need to pass exposed internal nodes, ** [ copying would be a waste! ] ** [ Actually, I think I wasted a lot more time than its worth ] ** [ trying to do this. ] */ /*@-exposetrans@*/ /*@-observertrans@*/ /*@-dependenttrans@*/ data = e->edata; switch (e->kind) { case XPR_PARENS: ret = exprNode_addParens (exprData_getUopTok (data), exprNode_effect (exprData_getUopNode (data))); break; case XPR_ASSIGN: ret = exprNode_assign (exprNode_effect (exprData_getOpA (data)), exprNode_effect (exprData_getOpB (data)), exprData_getOpTok (data)); break; case XPR_INITBLOCK: ret = exprNode_undefined; break; case XPR_CALL: ret = exprNode_functionCall (exprNode_effect (exprData_getFcn (data)), exprNodeList_effect (exprData_getArgs (data))); break; case XPR_EMPTY: ret = e; break; case XPR_LABEL: ret = e; break; case XPR_CONST: case XPR_VAR: { cstring id = exprData_getId (data); uentry ue = usymtab_lookupSafe (id); ret = exprNode_fromIdentifierAux (ue); ret->loc = fileloc_update (ret->loc, e->loc); break; } case XPR_BODY: ret = e; break; case XPR_FETCH: ret = exprNode_arrayFetch (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_OP: /* ** evans 2002-03-15: for && and ||, need to do the guards also ** this is what cgrammar.y does - should be ** able to avoid duplication, but need to ** time with grammar productions. */ DPRINTF (("Effect: %s", exprNode_unparse (e))); if (lltok_getTok (exprData_getOpTok (data)) == AND_OP) { exprNode e1 = exprNode_effect (exprData_getOpA (data)); exprNode e2; exprNode_produceGuards (e1); context_enterAndClause (e1); e2 = exprNode_effect (exprData_getOpB (data)); ret = exprNode_op (e1, e2, exprData_getOpTok (data)); context_exitAndClause (ret, e2); } else if (lltok_getTok (exprData_getOpTok (data)) == OR_OP) { exprNode e1 = exprNode_effect (exprData_getOpA (data)); exprNode e2; exprNode_produceGuards (e1); context_enterOrClause (e1); e2 = exprNode_effect (exprData_getOpB (data)); ret = exprNode_op (e1, e2, exprData_getOpTok (data)); context_exitOrClause (ret, e2); } else { ret = exprNode_op (exprNode_effect (exprData_getOpA (data)), exprNode_effect (exprData_getOpB (data)), exprData_getOpTok (data)); } break; case XPR_POSTOP: ret = exprNode_postOp (exprNode_effect (exprData_getUopNode (data)), exprData_getUopTok (data)); break; case XPR_PREOP: ret = exprNode_preOp (exprNode_effect (exprData_getUopNode (data)), exprData_getUopTok (data)); break; case XPR_OFFSETOF: case XPR_SIZEOFT: case XPR_SIZEOF: case XPR_ALIGNOFT: case XPR_ALIGNOF: ret = e; break; case XPR_VAARG: ret = exprNode_vaArg (exprData_getCastTok (data), exprNode_effect (exprData_getCastNode (data)), exprData_getCastType (data)); break; case XPR_CAST: ret = exprNode_cast (exprData_getCastTok (data), exprNode_effect (exprData_getCastNode (data)), exprData_getCastType (data)); break; case XPR_ITERCALL: ret = exprNode_iterStart (exprData_getIterCallIter (data), exprNodeList_effect (exprData_getIterCallArgs (data))); break; case XPR_ITER: ret = exprNode_iter (exprData_getIterSname (data), exprNodeList_effect (exprData_getIterAlist (data)), exprNode_effect (exprData_getIterBody (data)), exprData_getIterEname (data)); break; case XPR_FOR: ret = exprNode_for (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_FORPRED: ret = exprNode_forPred (exprNode_effect (exprData_getTripleInit (data)), exprNode_effect (exprData_getTripleTest (data)), exprNode_effect (exprData_getTripleInc (data))); break; case XPR_TOK: ret = exprNode_createTok (exprData_getTok (data)); break; case XPR_GOTO: ret = exprNode_goto (exprData_getLiteral (data)); ret->loc = fileloc_update (ret->loc, e->loc); break; case XPR_CONTINUE: ret = exprNode_continue (exprData_getTok (data), QSAFEBREAK); break; case XPR_BREAK: ret = exprNode_break (exprData_getTok (data), QSAFEBREAK); break; case XPR_RETURN: ret = exprNode_return (exprNode_effect (exprData_getSingle (data))); break; case XPR_NULLRETURN: ret = exprNode_nullReturn (exprData_getTok (data)); break; case XPR_COMMA: ret = exprNode_comma (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_COND: ret = exprNode_cond (exprNode_effect (exprData_getTriplePred (data)), exprNode_effect (exprData_getTripleTrue (data)), exprNode_effect (exprData_getTripleFalse (data))); break; case XPR_IF: ret = exprNode_if (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_IFELSE: ret = exprNode_ifelse (exprNode_effect (exprData_getTriplePred (data)), exprNode_effect (exprData_getTripleTrue (data)), exprNode_effect (exprData_getTripleFalse (data))); break; case XPR_WHILEPRED: ret = exprNode_whilePred (exprData_getSingle (data)); break; case XPR_WHILE: ret = exprNode_while (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_DOWHILE: ret = exprNode_doWhile (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_BLOCK: ret = exprNode_makeBlock (exprNode_effect (exprData_getSingle (data))); break; case XPR_STMT: ret = exprNode_statement (exprNode_effect (exprData_getUopNode (data)), exprData_getUopTok (data)); break; case XPR_STMTLIST: ret = exprNode_concat (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_FTCASE: case XPR_CASE: ret = exprNode_caseMarker (exprNode_effect (exprData_getSingle (data)), TRUE); break; case XPR_FTDEFAULT: case XPR_DEFAULT: ret = exprNode_createTok (exprData_getTok (data)); break; case XPR_SWITCH: ret = exprNode_switch (exprNode_effect (exprData_getPairA (data)), exprNode_effect (exprData_getPairB (data))); break; case XPR_INIT: ret = exprNode_makeInitialization (exprData_getInitId (data), exprNode_effect (exprData_getInitNode (data))); break; case XPR_FACCESS: ret = exprNode_fieldAccessAux (exprNode_effect (exprData_getFieldNode (data)), exprNode_loc (exprData_getFieldNode (data)), cstring_copy (exprData_getFieldName (data))); break; case XPR_ARROW: ret = exprNode_arrowAccessAux (exprNode_effect (exprData_getFieldNode (data)), exprNode_loc (exprData_getFieldNode (data)), cstring_copy (exprData_getFieldName (data))); break; case XPR_STRINGLITERAL: ret = e; break; case XPR_NUMLIT: ret = e; break; case XPR_NODE: ret = e; break; /*@-branchstate@*/ } /*@=branchstate@*/ /*@=observertrans@*/ /*@=exposetrans@*/ /*@=dependenttrans@*/ } if (!innerEffect) { inEffect = FALSE; } return ret; } static /*@observer@*/ cstring exprNode_rootVarName (exprNode e) { cstring ret; exprData data; if (exprNode_isError (e)) { return cstring_undefined; } data = e->edata; switch (e->kind) { case XPR_PARENS: ret = exprNode_rootVarName (exprData_getUopNode (data)); break; case XPR_ASSIGN: ret = exprNode_rootVarName (exprData_getOpA (data)); break; case XPR_CONST: case XPR_VAR: ret = exprData_getId (data); break; case XPR_INIT: ret = idDecl_getName (exprData_getInitId (data)); break; case XPR_LABEL: case XPR_TOK: case XPR_ITERCALL: case XPR_EMPTY: case XPR_CALL: case XPR_INITBLOCK: case XPR_BODY: case XPR_FETCH: case XPR_OP: case XPR_POSTOP: case XPR_PREOP: case XPR_OFFSETOF: case XPR_ALIGNOFT: case XPR_ALIGNOF: case XPR_SIZEOFT: case XPR_SIZEOF: case XPR_VAARG: case XPR_CAST: case XPR_ITER: case XPR_FOR: case XPR_FORPRED: case XPR_BREAK: case XPR_RETURN: case XPR_NULLRETURN: case XPR_COMMA: case XPR_COND: case XPR_IF: case XPR_IFELSE: case XPR_WHILE: case XPR_WHILEPRED: case XPR_DOWHILE: case XPR_GOTO: case XPR_CONTINUE: case XPR_FTDEFAULT: case XPR_DEFAULT: case XPR_SWITCH: case XPR_FTCASE: case XPR_CASE: case XPR_BLOCK: case XPR_STMT: case XPR_STMTLIST: case XPR_FACCESS: case XPR_ARROW: case XPR_NODE: case XPR_NUMLIT: case XPR_STRINGLITERAL: ret = cstring_undefined; break; } return ret; } static /*@only@*/ cstring exprNode_doUnparse (exprNode e) { cstring ret; exprData data; if (exprNode_isError (e)) { static /*@only@*/ cstring error = cstring_undefined; if (!cstring_isDefined (error)) { error = cstring_makeLiteral (""); } return error; } data = e->edata; switch (e->kind) { case XPR_PARENS: ret = message ("(%s)", exprNode_unparse (exprData_getUopNode (e->edata))); break; case XPR_ASSIGN: ret = message ("%s %s %s", exprNode_unparse (exprData_getOpA (data)), lltok_unparse (exprData_getOpTok (data)), exprNode_unparse (exprData_getOpB (data))); break; case XPR_CALL: ret = message ("%s(%q)", exprNode_unparse (exprData_getFcn (data)), exprNodeList_unparse (exprData_getArgs (data))); break; case XPR_INITBLOCK: ret = message ("{ %q }", exprNodeList_unparse (exprData_getArgs (data))); break; case XPR_EMPTY: ret = cstring_undefined; break; case XPR_LABEL: ret = message ("%s:", exprData_getId (data)); break; case XPR_CONST: case XPR_VAR: ret = cstring_copy (exprData_getId (data)); break; case XPR_FETCH: ret = message ("%s[%s]", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); break; case XPR_BODY: ret = message (""); break; case XPR_OP: ret = message ("%s %s %s", exprNode_unparse (exprData_getOpA (data)), lltok_unparse (exprData_getOpTok (data)), exprNode_unparse (exprData_getOpB (data))); break; case XPR_PREOP: ret = message ("%s%s", lltok_unparse (exprData_getUopTok (data)), exprNode_unparse (exprData_getUopNode (data))); break; case XPR_POSTOP: ret = message ("%s%s", exprNode_unparse (exprData_getUopNode (data)), lltok_unparse (exprData_getUopTok (data))); break; case XPR_OFFSETOF: ret = message ("offsetof(%s,%q)", ctype_unparse (qtype_getType (exprData_getOffsetType (data))), cstringList_unparseSep (exprData_getOffsetName (data), cstring_makeLiteralTemp ("."))); break; case XPR_SIZEOFT: ret = message ("sizeof(%s)", ctype_unparse (qtype_getType (exprData_getType (data)))); break; case XPR_SIZEOF: ret = message ("sizeof(%s)", exprNode_unparse (exprData_getSingle (data))); break; case XPR_ALIGNOFT: ret = message ("alignof(%s)", ctype_unparse (qtype_getType (exprData_getType (data)))); break; case XPR_ALIGNOF: ret = message ("alignof(%s)", exprNode_unparse (exprData_getSingle (data))); break; case XPR_VAARG: ret = message ("va_arg(%s, %q)", exprNode_unparse (exprData_getCastNode (data)), qtype_unparse (exprData_getCastType (data))); break; case XPR_ITERCALL: ret = message ("%q(%q)", uentry_getName (exprData_getIterCallIter (data)), exprNodeList_unparse (exprData_getIterCallArgs (data))); break; case XPR_ITER: ret = message ("%q(%q) %s %q", uentry_getName (exprData_getIterSname (data)), exprNodeList_unparse (exprData_getIterAlist (data)), exprNode_unparse (exprData_getIterBody (data)), uentry_getName (exprData_getIterEname (data))); break; case XPR_CAST: ret = message ("(%q)%s", qtype_unparse (exprData_getCastType (data)), exprNode_unparse (exprData_getCastNode (data))); break; case XPR_FOR: ret = message ("%s %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); break; case XPR_FORPRED: ret = message ("for (%s; %s; %s)", exprNode_unparse (exprData_getTripleInit (data)), exprNode_unparse (exprData_getTripleTest (data)), exprNode_unparse (exprData_getTripleInc (data))); break; case XPR_GOTO: ret = message ("goto %s", exprData_getLiteral (data)); break; case XPR_CONTINUE: ret = cstring_makeLiteral ("continue"); break; case XPR_BREAK: ret = cstring_makeLiteral ("break"); break; case XPR_RETURN: ret = message ("return %s", exprNode_unparse (exprData_getSingle (data))); break; case XPR_NULLRETURN: ret = cstring_makeLiteral ("return"); break; case XPR_COMMA: ret = message ("%s, %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); break; case XPR_COND: ret = message ("%s ? %s : %s", exprNode_unparse (exprData_getTriplePred (data)), exprNode_unparse (exprData_getTripleTrue (data)), exprNode_unparse (exprData_getTripleFalse (data))); break; case XPR_IF: ret = message ("if (%s) %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); break; case XPR_IFELSE: ret = message ("if (%s) %s else %s", exprNode_unparse (exprData_getTriplePred (data)), exprNode_unparse (exprData_getTripleTrue (data)), exprNode_unparse (exprData_getTripleFalse (data))); break; case XPR_WHILE: ret = message ("while (%s) %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); break; case XPR_WHILEPRED: ret = cstring_copy (exprNode_unparse (exprData_getSingle (data))); break; case XPR_TOK: ret = cstring_copy (lltok_unparse (exprData_getTok (data))); break; case XPR_DOWHILE: ret = message ("do { %s } while (%s)", exprNode_unparse (exprData_getPairB (data)), exprNode_unparse (exprData_getPairA (data))); break; case XPR_BLOCK: ret = message ("{ %s }", exprNode_unparse (exprData_getSingle (data))); /* evans 2002-02-20 was unparseFirst! */ break; case XPR_STMT: ret = message ("%s;", exprNode_unparse (exprData_getUopNode (data))); break; case XPR_STMTLIST: if (exprNode_isStatement (exprData_getPairA (data))) { /* ** statement expressions already print the ; */ ret = message ("%s %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); } else { ret = message ("%s; %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); } break; case XPR_FTDEFAULT: case XPR_DEFAULT: ret = cstring_makeLiteral ("default:"); break; case XPR_SWITCH: ret = message ("switch (%s) %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))); break; case XPR_FTCASE: case XPR_CASE: ret = message ("case %s:", exprNode_unparse (exprData_getSingle (data))); break; case XPR_INIT: if (exprNode_isError (exprData_getInitNode (data))) { ret = message ("%q", idDecl_unparseC (exprData_getInitId (data))); } else { ret = message ("%q = %s", idDecl_unparseC (exprData_getInitId (data)), exprNode_unparse (exprData_getInitNode (data))); } break; case XPR_FACCESS: ret = message ("%s.%s", exprNode_unparse (exprData_getFieldNode (data)), exprData_getFieldName (data)); break; case XPR_ARROW: ret = message ("%s->%s", exprNode_unparse (exprData_getFieldNode (data)), exprData_getFieldName (data)); break; case XPR_STRINGLITERAL: if (ctype_isWideString (e->typ)) { ret = message ("L\"%s\"", exprData_getLiteral (data)); } else { ret = message ("\"%s\"", exprData_getLiteral (data)); } break; case XPR_NUMLIT: ret = cstring_copy (exprData_getLiteral (data)); break; case XPR_NODE: ret = cstring_makeLiteral (""); break; } return ret; } bool exprNode_isInitializer (exprNode e) { return (exprNode_isDefined (e) && e->kind == XPR_INIT); } bool exprNode_isCharLiteral (exprNode e) { if (exprNode_isDefined (e)) { return (multiVal_isChar (exprNode_getValue (e))); } else { return FALSE; } } bool exprNode_isNumLiteral (exprNode e) { if (exprNode_isDefined (e)) { return (multiVal_isInt (exprNode_getValue (e))); } else { return FALSE; } } static bool exprNode_isFalseConstant (exprNode e) { if (exprNode_isDefined (e)) { cstring s = exprNode_rootVarName (e); if (cstring_equal (s, context_getFalseName ())) { return TRUE; } } return FALSE; } bool exprNode_matchLiteral (ctype expected, exprNode e) { if (exprNode_isDefined (e)) { multiVal m = exprNode_getValue (e); if (multiVal_isDefined (m)) { if (multiVal_isInt (m)) { long int val = multiVal_forceInt (m); if (ctype_isNumAbstract (expected) && context_flagOn (FLG_NUMABSTRACTLIT, exprNode_loc (e))) { return TRUE; } if (ctype_isDirectBool (ctype_realishType (expected))) { if (val == 0) { return FALSE; /* really?! return TRUE; allow use of 0 for FALSE */ } else { return FALSE; } } if (ctype_isRealInt (expected)) { /* ** unsigned <- [ constant >= 0 is okay ] */ if (ctype_isUnsigned (expected)) { if (val < 0) { return FALSE; } } /* ** No checks on sizes of integers...maybe add ** these later. */ DPRINTF (("Here: %s => %s", exprNode_unparse (e), ctype_unparse (expected))); DPRINTF (("Type: %s / %s", ctype_unparse (exprNode_getType (e)), bool_unparse (ctype_isInt (exprNode_getType (e))))); if (context_getFlag (FLG_NUMLITERAL) && (ctype_isRegularInt (exprNode_getType (e)) || val == 0)) { return TRUE; } else { if (val == 0) { return TRUE; } else { return FALSE; /* evs 2000-05-17: previously, always returned TRUE */ } } } else if (ctype_isChar (expected)) { return FALSE; } else if (ctype_isArrayPtr (expected)) { /* ** evans 2001-10-14: We allow 0 to match any pointer, but only if the type matches or is void *. */ if (val == 0) { if (ctype_match (exprNode_getType (e), expected) || ctype_isVoidPointer (exprNode_getType (e))) { return TRUE; } } else { return FALSE; } } else if (ctype_isAnyFloat (expected)) { return (context_getFlag (FLG_NUMLITERAL)); } else { return FALSE; } } else if (multiVal_isDouble (m)) { if (ctype_isAnyFloat (expected)) { return TRUE; } } else if (multiVal_isChar (m)) { /*signed? */ char val = multiVal_forceChar (m); if (ctype_isChar (expected)) { if (ctype_isUnsigned (expected) && ((int) val) < 0) { return FALSE; } else { return TRUE; } } } else { return FALSE; } } } return FALSE; } bool exprNode_matchType (ctype expected, exprNode e) { ctype actual; if (!exprNode_isDefined (e)) return TRUE; actual = ctype_realishType (exprNode_getType (e)); if (ctype_match (ctype_realishType (expected), actual)) { return TRUE; } llassert (!exprNode_isError (e)); return (exprNode_matchLiteral (expected, e)); } static bool exprNode_matchTypes (exprNode e1, exprNode e2) { ctype t1; ctype t2; if (!exprNode_isDefined (e1)) return TRUE; if (!exprNode_isDefined (e2)) return TRUE; /* ** realish type --- keep bools, bools */ t1 = ctype_realishType (exprNode_getType (e1)); t2 = ctype_realishType (exprNode_getType (e2)); if (ctype_match (t1, t2)) { return TRUE; } DPRINTF (("Matching literal! %s %s %s %s", ctype_unparse (t1), exprNode_unparse (e2), ctype_unparse (t2), exprNode_unparse (e1))); return (exprNode_matchLiteral (t1, e2) || exprNode_matchLiteral (t2, e1)); } /* ** pass e as ct */ static bool exprNode_matchArgType (ctype ct, exprNode e) { ctype et; if (!exprNode_isDefined (e)) { return TRUE; } et = ctype_realType (exprNode_getType (e)); if (ctype_matchArg (ct, et)) return TRUE; llassert (!exprNode_isError (e)); return (exprNode_matchLiteral (ct, e)); } static /*@only@*/ exprNodeSList exprNode_flatten (/*@dependent@*/ exprNode e) /*@*/ { if (exprNode_isDefined (e)) { if (e->kind == XPR_STMTLIST) { return (exprNodeSList_append (exprNode_flatten (exprData_getPairA (e->edata)), exprNode_flatten (exprData_getPairB (e->edata)))); } else if (e->kind == XPR_BLOCK) { return (exprNode_flatten (exprData_getSingle (e->edata))); } else { return (exprNodeSList_singleton (e)); } } return exprNodeSList_new (); } static /*@exposed@*/ exprNode exprNode_lastStatement (/*@returned@*/ exprNode e) { if (exprNode_isDefined (e)) { if (e->kind == XPR_STMTLIST) { exprNode b = exprData_getPairB (e->edata); if (exprNode_isDefined (b)) { return exprNode_lastStatement (b); } else { return exprNode_lastStatement (exprData_getPairA (e->edata)); } } else if (e->kind == XPR_BLOCK) { return (exprNode_lastStatement (exprData_getSingle (e->edata))); } else { return (e); } } return exprNode_undefined; } static /*@exposed@*/ exprNode exprNode_firstStatement (/*@returned@*/ exprNode e) { if (exprNode_isDefined (e)) { if (e->kind == XPR_STMTLIST) { exprNode b = exprData_getPairA (e->edata); if (exprNode_isDefined (b)) { return exprNode_firstStatement (b); } else { return exprNode_firstStatement (exprData_getPairB (e->edata)); } } else if (e->kind == XPR_BLOCK) { return (exprNode_firstStatement (exprData_getSingle (e->edata))); } else { return (e); } } return exprNode_undefined; } static void exprNode_mergeUSs (exprNode res, exprNode other) { if (exprNode_isDefined (res) && exprNode_isDefined (other)) { res->msets = sRefSet_union (res->msets, other->msets); res->sets = sRefSet_union (res->sets, other->sets); res->uses = sRefSet_union (res->uses, other->uses); } } static void exprNode_mergeCondUSs (exprNode res, exprNode other1, exprNode other2) { if (exprNode_isDefined (res)) { if (exprNode_isDefined (other1)) { res->sets = sRefSet_union (res->sets, other1->sets); res->msets = sRefSet_union (res->msets, other1->msets); res->uses = sRefSet_union (res->uses, other1->uses); } if (exprNode_isDefined (other2)) { res->sets = sRefSet_union (res->sets, other2->sets); res->msets = sRefSet_union (res->msets, other2->msets); res->uses = sRefSet_union (res->uses, other2->uses); } } } /* ** modifies e->uses ** ** Reports errors is s is not defined. */ static void exprNode_addUse (exprNode e, /*@exposed@*/ sRef s) { if (exprNode_isDefined (e)) { e->uses = sRefSet_insert (e->uses, s); } } void exprNode_checkUse (exprNode e, /*@exposed@*/ sRef s, fileloc loc) { if (sRef_isKnown (s) && !sRef_isConst (s)) { /* ** need to check all outer types are useable */ DPRINTF (("Check use: %s / %s", exprNode_unparse (e), sRef_unparse (s))); exprNode_addUse (e, s); if (!context_inProtectVars ()) { /* ** only report the deepest error */ sRef errorRef = sRef_undefined; sRef lastRef = sRef_undefined; bool deadRef = FALSE; bool unuseable = FALSE; bool errorMaybe = FALSE; while (sRef_isValid (s) && sRef_isKnown (s)) { ynm readable = sRef_isValidLvalue (s); DPRINTF (("Readable: %s / %s", sRef_unparseFull (s), ynm_unparse (readable))); if (!(ynm_toBoolStrict (readable))) { if (ynm_isMaybe (readable)) { lastRef = errorRef; errorRef = s; DPRINTF (("Setting ERROR: %s", sRef_unparseFull (s))); deadRef = sRef_isPossiblyDead (errorRef); unuseable = sRef_isUnuseable (errorRef); errorMaybe = TRUE; } else { lastRef = errorRef; errorRef = s; DPRINTF (("Setting ERROR: %s", sRef_unparseFull (s))); deadRef = sRef_isDead (errorRef); unuseable = sRef_isUnuseable (errorRef); errorMaybe = FALSE; } /* if (!sRef_isPartial (s)) { DPRINTF (("Defining! %s", sRef_unparseFull (s))); sRef_setDefined (s, loc); DPRINTF (("Defining! %s", sRef_unparseFull (s))); } */ } s = sRef_getBaseSafe (s); } /* end while */ if (sRef_isValid (errorRef)) { if (sRef_isValid (lastRef) && sRef_isField (lastRef) && sRef_isPointer (errorRef)) { errorRef = lastRef; DPRINTF (("errorRef: %s", sRef_unparseFull (errorRef))); } if (deadRef) { if (sRef_isThroughArrayFetch (errorRef)) { if (optgenerror (FLG_STRICTUSERELEASED, message ("%q %q may be used after being released", sRef_unparseKindNamePlain (errorRef), sRef_unparse (errorRef)), loc)) { sRef_showRefKilled (errorRef); if (sRef_isKept (errorRef)) { sRef_clearAliasState (errorRef, loc); } } } else { DPRINTF (("HERE: %s", sRef_unparseFull (errorRef))); if (optgenerror (FLG_USERELEASED, message ("%q %q %qused after being released", sRef_unparseKindNamePlain (errorRef), sRef_unparse (errorRef), cstring_makeLiteral (errorMaybe ? "may be " : "")), loc)) { sRef_showRefKilled (errorRef); if (sRef_isKept (errorRef)) { sRef_clearAliasState (errorRef, loc); } } } } else if (unuseable) { if (optgenerror (FLG_USEDEF, message ("%q %q%qused in inconsistent state", sRef_unparseKindName (errorRef), sRef_unparseOpt (errorRef), cstring_makeLiteral (errorMaybe ? "may be " : "")), loc)) { sRef_showStateInconsistent (errorRef); } } else { DPRINTF (("HERE: %s", sRef_unparseFull (errorRef))); if (optgenerror (FLG_USEDEF, message ("%q %q%qused before definition", sRef_unparseKindName (errorRef), sRef_unparseOpt (errorRef), cstring_makeLiteral (errorMaybe ? "may be " : "")), loc)) { ; } DPRINTF (("Error: %s", sRef_unparseFull (errorRef))); } sRef_setDefined (errorRef, loc); if (sRef_isAddress (errorRef)) { sRef_setDefined (sRef_getRootBase (errorRef), loc); } } /* end is error */ } } setCodePoint (); } static void checkSafeUse (exprNode e, /*@exposed@*/ sRef s) { if (exprNode_isDefined (e) && sRef_isKnown (s)) { e->uses = sRefSet_insert (e->uses, s); } } static void exprNode_checkSetAny (exprNode e, /*@dependent@*/ cstring name) { if (exprNode_isDefined (e)) { e->sets = sRefSet_insert (e->sets, sRef_makeUnconstrained (name)); } } void exprNode_checkSet (exprNode e, /*@exposed@*/ sRef s) { sRef defines = sRef_undefined; if (sRef_isValid (s) && !sRef_isNothing (s)) { uentry ue = sRef_getBaseUentry (s); if (uentry_isValid (ue)) { uentry_setLset (ue); } if (!ynm_toBoolStrict (sRef_isWriteable (s))) { voptgenerror (FLG_USEDEF, message ("Attempt to set unuseable storage: %q", sRef_unparse (s)), exprNode_loc (e)); } if (sRef_isMeaningful (s)) { if (sRef_isDead (s)) { sRef base = sRef_getBaseSafe (s); if (sRef_isValid (base) && sRef_isDead (base)) { sRef_setPartial (s, exprNode_loc (e)); } defines = s; /* okay - modifies for only param */ } else if (sRef_isPartial (s)) { sRef eref = exprNode_getSref (e); if (!sRef_isPartial (eref)) { /* ** should do something different here??? */ sRef_setDefinedComplete (eref, exprNode_loc (e)); } else { sRef_setPartialDefinedComplete (eref, exprNode_loc (e)); } if (sRef_isMeaningful (eref)) { defines = eref; } else { defines = s; } } else if (sRef_isAllocated (s)) { sRef eref = exprNode_getSref (e); if (!sRef_isAllocated (eref)) { sRef_setDefinedComplete (eref, exprNode_loc (e)); } else { sRef base = sRef_getBaseSafe (eref); if (sRef_isValid (base)) { sRef_setPdefined (base, exprNode_loc (e)); } } defines = s; } else { sRef_setDefinedNCComplete (s, exprNode_loc (e)); defines = s; } } else /* not meaningful...but still need to insert it */ { defines = s; } } if (exprNode_isDefined (e) && sRef_isValid (defines)) { e->sets = sRefSet_insert (e->sets, defines); } } void exprNode_checkMSet (exprNode e, /*@exposed@*/ sRef s) { if (sRef_isValid (s) && !sRef_isNothing (s)) { uentry ue = sRef_getBaseUentry (s); if (uentry_isValid (ue)) { uentry_setLset (ue); } if (!ynm_toBoolStrict (sRef_isWriteable (s))) { voptgenerror (FLG_USEDEF, message ("Attempt to set unuseable storage: %q", sRef_unparse (s)), exprNode_loc (e)); } if (sRef_isMeaningful (s)) { sRef_setDefinedComplete (s, exprNode_loc (e)); } if (exprNode_isDefined (e)) { e->msets = sRefSet_insert (e->msets, s); } } } static void checkUnspecCall (/*@notnull@*/ /*@dependent@*/ exprNode fcn, uentryList params, exprNodeList args) { checkAnyCall (fcn, cstring_undefined, params, args, FALSE, sRefSet_undefined, FALSE, 0); } static void checkOneArg (uentry ucurrent, /*@notnull@*/ exprNode current, /*@dependent@*/ exprNode fcn, bool isSpec, int argno, int totargs) { setCodePoint (); if (uentry_isYield (ucurrent)) { sRef_setDefined (exprNode_getSref (current), exprNode_loc (current)); exprNode_checkSet (current, current->sref); } else { if (uentry_isSefParam (ucurrent)) { sRefSet sets = current->sets; sRef ref = exprNode_getSref (current); if (sRef_isMacroParamRef (ref)) { uentry ue = sRef_getUentry (ref); if (!uentry_isSefParam (ue)) { voptgenerror (FLG_SEFPARAMS, message ("Parameter %d to %s is declared sef, but " "the argument is a macro parameter declared " "without sef: %s", argno, exprNode_unparse (fcn), exprNode_unparse (current)), exprNode_loc (current)); } } if (!sRefSet_isEmpty (sets)) { sRefSet reported = sRefSet_undefined; sRefSet_realElements (current->sets, el) { if (sRefSet_isSameNameMember (reported, el)) { ; /* don't report again */ } else { if (sRef_isUnconstrained (el)) { voptgenerror (FLG_SEFUNSPEC, message ("Parameter %d to %s is declared sef, but " "the argument calls unconstrained function %s " "(no guarantee it will not modify something): %s", argno, exprNode_unparse (fcn), sRef_unconstrainedName (el), exprNode_unparse (current)), exprNode_loc (current)); } else { voptgenerror (FLG_SEFPARAMS, message ("Parameter %d to %s is declared sef, but " "the argument may modify %q: %s", argno, exprNode_unparse (fcn), sRef_unparse (el), exprNode_unparse (current)), exprNode_loc (current)); } } } end_sRefSet_realElements; } } transferChecks_passParam (current, ucurrent, isSpec, fcn, argno, totargs); exprNode_mergeUSs (fcn, current); } } static void checkAnyCall (/*@dependent@*/ exprNode fcn, /*@dependent@*/ cstring fname, uentryList pn, exprNodeList args, bool hasMods, sRefSet mods, bool isSpec, int specialArgs) { int paramno = 0; int nargs = exprNodeList_size (args); setCodePoint (); /* ** concat all args ud's to f, add each arg sref as a use unless ** it was specified as "out", in which case it is a def. */ uentryList_reset (pn); /* ** aliasing checks: ** ** if paramn is only or unique, no other arg may alias argn */ exprNodeList_elements (args, current) { paramno++; if (exprNode_isDefined (current)) { if ((!uentryList_isUndefined (pn) && !uentryList_isFinished (pn))) { uentry ucurrent = uentryList_current (pn); if (specialArgs == 0 || (paramno < specialArgs)) { checkOneArg (ucurrent, current, fcn, isSpec, paramno, nargs); if (context_maybeSet (FLG_ALIASUNIQUE)) { if (uentry_isOnly (ucurrent) || uentry_isUnique (ucurrent)) { checkUniqueParams (fcn, current, args, paramno, ucurrent); } } } } else /* uentry is undefined */ { if (specialArgs == 0) { exprNode_checkUseParam (current); } exprNode_mergeUSs (fcn, current); } } uentryList_advanceSafe (pn); } end_exprNodeList_elements; if (hasMods) { setCodePoint (); sRefSet_allElements (mods, s) { sRef fb; sRef rb = sRef_getRootBase (s); if (sRef_isFileOrGlobalScope (rb)) { context_usedGlobal (rb); } fb = sRef_fixBaseParam (s, args); if (!sRef_isMacroParamRef (fb)) { if (sRef_isNothing (fb)) { ; } else { if (sRef_isValid (fb)) { uentry ue = sRef_getBaseUentry (s); if (uentry_isValid (ue)) { uentry_setLset (ue); } } fcn->sets = sRefSet_insert (fcn->sets, fb); } } sRef_clearDerivedComplete (s); } end_sRefSet_allElements; setCodePoint (); } else { if (context_hasMods ()) { if (context_maybeSet (FLG_MODUNCON)) { voptgenerror (FLG_MODUNCON, message ("Undetected modification possible " "from call to unconstrained function %s: %s", fname, exprNode_unparse (fcn)), exprNode_loc (fcn)); } } else { if (context_maybeSet (FLG_MODUNCONNOMODS) && !(context_inIterDef () || context_inIterEnd ())) { voptgenerror (FLG_MODUNCONNOMODS, message ("Undetected modification possible " "from call to unconstrained function %s: %s", fname, exprNode_unparse (fcn)), exprNode_loc (fcn)); } } exprNode_checkSetAny (fcn, fname); } } void exprNode_checkUseParam (exprNode current) { if (exprNode_isDefined (current)) { exprNode_checkUse (current, current->sref, current->loc); } } static ctype checkNumerics (ctype tr1, ctype tr2, ctype te1, ctype te2, /*@notnull@*/ exprNode e1, /*@notnull@*/ exprNode e2, lltok op) { ctype ret = tr1; if (!ctype_match (tr1, tr2)) { if ((ctype_isRealInt (tr1) || ctype_isReal (tr1)) && (ctype_isRealInt (tr2) || ctype_isReal (tr2))) { DPRINTF (("No error: [%s] %s / [%s] %s", exprNode_unparse (e1), ctype_unparse (tr1), exprNode_unparse (e2), ctype_unparse (tr2))); /* ** evans 2003-06-15: changed this so if either type is a literal, ** the other type is used. ** (Need to look at the ISO C99 rules on this...) */ if (exprNode_isNumLiteral (e1)) { ret = tr2; } else if (exprNode_isNumLiteral (e2)) { ret = tr1; } else { ret = ctype_biggerType (tr1, tr2); } } else { if (ctype_isNumAbstract (tr1) && exprNode_isNumLiteral (e2) && context_flagOn (FLG_NUMABSTRACTLIT, e1->loc)) { ret = tr1; /* No error */ } else if (ctype_isNumAbstract (tr2) && exprNode_isNumLiteral (e1) && context_flagOn (FLG_NUMABSTRACTLIT, e1->loc)) { ret = tr2; } else { if (gentypeerror (tr1, e1, tr2, e2, message ("Incompatible types for %s (%s, %s): %s %s %s", lltok_unparse (op), ctype_unparse (te1), ctype_unparse (te2), exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e1->loc)) { ret = ctype_unknown; } else { ret = ctype_biggerType (tr1, tr2); } } } } else { if (ctype_isNumAbstract (tr1)) { ret = tr1; } else if (ctype_isForceRealNumeric (&tr1) && ctype_isForceRealNumeric (&tr2)) { ret = ctype_resolveNumerics (tr1, tr2); } else if (!context_msgStrictOps ()) { if (ctype_isPointer (tr1)) { if (ctype_isPointer (tr2) && !exprNode_isNullValue (e2)) { ret = ctype_int; } else if (ctype_isInt (tr2)) { ret = te1; } else { ret = ctype_unknown; } } else if (ctype_isPointer (tr2)) { if (ctype_isPointer (tr1)) { ret = ctype_int; } else if (ctype_isInt (tr1)) { ret = te2; } else { ret = ctype_unknown; } } else { ret = ctype_resolveNumerics (tr1, tr2); } } else { int opid = lltok_getTok (op); bool comparop = (opid == EQ_OP || opid == NE_OP || opid == TLT || opid == TGT || opid == LE_OP || opid == GE_OP); if (!ctype_isNumeric (tr1) && !ctype_isNumeric (tr2)) { if (comparop && ((ctype_isEnum (tr1) && ctype_isEnum (tr2)) || (ctype_isBool (tr1) && ctype_isBool (tr2)) || (ctype_isChar (tr1) && ctype_isChar (tr2)))) { ; /* no error */ } else { if (ctype_sameName (te1, te2)) { voptgenerror (FLG_STRICTOPS, message ("Operands of %s are non-numeric (%t): %s %s %s", lltok_unparse (op), te1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e1->loc); } else { voptgenerror (FLG_STRICTOPS, message ("Operands of %s are non-numerics (%t, %t): %s %s %s", lltok_unparse (op), te1, te2, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e1->loc); } } } else if (!ctype_isNumeric (tr1)) { voptgenerror (FLG_STRICTOPS, message ("Right operand of %s is non-numeric (%t): %s %s %s", lltok_unparse (op), te1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e1->loc); } else { if (!ctype_isNumeric (tr2)) { voptgenerror (FLG_STRICTOPS, message ("Left operand of %s is non-numeric (%t): %s %s %s", lltok_unparse (op), te2, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), e2->loc); } } ret = ctype_unknown; } } return ret; } static bool abstractOpError (ctype tr1, ctype tr2, lltok op, /*@notnull@*/ exprNode e1, /*@notnull@*/ exprNode e2, fileloc loc1, fileloc loc2) { if (ctype_isRealAbstract (tr1) && ctype_isRealAbstract (tr2)) { if (ctype_match (tr1, tr2)) { if (ctype_isRealNumAbstract (tr1)) { ; /* No warning for numabstract types */ } else { if (lltok_isEqOp (op) || lltok_isNotEqOp (op)) { return optgenerror (FLG_ABSTRACTCOMPARE, message ("Object equality comparison (%s) on objects of abstract type (%t): %s %s %s", lltok_unparse (op), tr1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), loc1); } else { return optgenerror (FLG_ABSTRACT, message ("Operands of %s are abstract type (%t): %s %s %s", lltok_unparse (op), tr1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), loc1); } } } else { if (ctype_isRealNumAbstract (tr1) && ctype_isRealNumAbstract (tr2)) { return optgenerror (FLG_NUMABSTRACT, message ("Operands of %s are different numabstract types (%t, %t): %s %s %s", lltok_unparse (op), tr1, tr2, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), loc1); } else { return optgenerror (FLG_ABSTRACT, message ("Operands of %s are abstract types (%t, %t): %s %s %s", lltok_unparse (op), tr1, tr2, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), loc1); } } } else if (ctype_isRealAbstract (tr1) && !ctype_isRealNumAbstract (tr1)) { return optgenerror (FLG_ABSTRACT, message ("Left operand of %s is abstract type (%t): %s %s %s", lltok_unparse (op), tr1, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), loc1); } else { if (ctype_isRealAbstract (tr2) && !ctype_isRealNumAbstract (tr2)) { return optgenerror (FLG_ABSTRACT, message ("Right operand of %s is abstract type (%t): %s %s %s", lltok_unparse (op), tr2, exprNode_unparse (e1), lltok_unparse (op), exprNode_unparse (e2)), loc2); } } return FALSE; } /* ** e1 <= e2 ** ** requies e1 and e2 and not error exprNode's. ** ** Checks: ** ** If e1 is a component of an abstract type, and e2 is mutable and client-visible, ** the rep of the abstract type is exposed. ** ** The order is very important: ** ** check rep expose (move into check transfer) ** check transfer ** setup aliases */ /* ** This isn't really a sensible procedure, but the indententation ** was getting too deep. */ static void checkOneRepExpose (sRef ysr, sRef base, /*@notnull@*/ exprNode e1, /*@notnull@*/ exprNode e2, ctype ct, sRef s2b) { if (!(sRef_isOnly (ysr) || sRef_isKeep (ysr) || sRef_isOwned (ysr) || sRef_isExposed (ysr))) { if (sRef_isAnyParam (base) && !sRef_isExposed (base) && !sRef_isObserver (base)) /* evans 2001-07-11: added isObserver */ { if (sRef_isIReference (ysr)) { if (sRef_sameName (base, sRef_getRootBase (e2->sref))) { voptgenerror (FLG_ASSIGNEXPOSE, message ("Assignment of mutable component of parameter %q " "to component of abstract " "type %s exposes rep: %s = %s", sRef_unparse (base), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } else { voptgenerror (FLG_ASSIGNEXPOSE, message ("Assignment of mutable component of parameter %q " "(through alias %q) to component of abstract " "type %s exposes rep: %s = %s", sRef_unparse (base), sRef_unparse (e2->sref), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } } else { if (sRef_sameName (base, sRef_getRootBase (e2->sref))) { voptgenerror (FLG_ASSIGNEXPOSE, message ("Assignment of mutable parameter %q " "to component of abstract type %s " "exposes rep: %s = %s", sRef_unparse (base), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } else { voptgenerror (FLG_ASSIGNEXPOSE, message ("Assignment of mutable parameter %q " "(through alias %q) to " "component of abstract type %s exposes " "rep: %s = %s", sRef_unparse (base), sRef_unparse (e2->sref), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } } } if (sRef_isFileOrGlobalScope (s2b)) { if (sRef_sameName (base, sRef_getRootBase (e2->sref))) { voptgenerror (FLG_REPEXPOSE, message ("Assignment of global %q " "to component of " "abstract type %s exposes rep: %s = %s", sRef_unparse (base), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } else { voptgenerror (FLG_REPEXPOSE, message ("Assignment of global %q (through alias %q) " "to component of " "abstract type %s exposes rep: %s = %s", sRef_unparse (base), sRef_unparse (e2->sref), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } } } } static void doAssign (/*@notnull@*/ exprNode e1, /*@notnull@*/ exprNode e2, bool isInit) { DPRINTF (("Do assign: %s <- %s", exprNode_unparse (e1), exprNode_unparse (e2))); DPRINTF (("Ctype: %s", ctype_unparse (exprNode_getType (e1)))); if (ctype_isRealFunction (exprNode_getType (e1)) && !ctype_isRealPointer (exprNode_getType (e1))) { voptgenerror (FLG_TYPE, message ("Invalid left-hand side of assignment (function type %s): %s", ctype_unparse (exprNode_getType (e1)), exprNode_unparse (e1)), e1->loc); } if (context_getFlag (FLG_ASSIGNEXPOSE) && ctype_isMutable (e2->typ)) { ctype t2 = exprNode_getType (e2); sRef sr = sRef_getRootBase (e1->sref); ctype ct = sRef_getType (sr); if (ctype_isAbstract (t2) && !ctype_isNumAbstract (t2) && !(uentry_isMutableDatatype (usymtab_getTypeEntry (ctype_typeId (t2))))) { /* it is immutable, okay to reference */ goto donerepexpose; } if (ctype_isAbstract (ct) && sRef_isIReference (e1->sref)) { sRef s2b = sRef_getRootBase (e2->sref); sRef s1 = e1->sref; sRef s1b = sRef_getRootBase (s1); sRefSet aliases; aliases = usymtab_canAlias (e2->sref); if (!sRef_similar (s2b, s1b) && !sRef_isExposed (s1) && !(sRef_isOnly (s2b) || sRef_isKeep (s2b) || sRef_isExposed (s2b))) { if (sRef_isAnyParam (s2b) && !sRef_isOnly (s2b) && !sRef_isOwned (s2b) && !sRef_isKeep (s2b) && !sRef_isExposed (s2b)) { if (sRef_isIReference (e2->sref)) { voptgenerror (FLG_ASSIGNEXPOSE, message ("Assignment of mutable component of parameter %q " "to component of abstract type %s exposes rep: %s = %s", sRef_unparse (s2b), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } else { voptgenerror (FLG_ASSIGNEXPOSE, message ("Assignment of mutable parameter %q to " "component of abstract type %s exposes rep: %s = %s", sRef_unparse (s2b), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } } if (sRef_isFileOrGlobalScope (s2b)) { voptgenerror (FLG_ASSIGNEXPOSE, message ("Assignment of global %q to component of " "abstract type %s exposes rep: %s = %s", sRef_unparse (s2b), ctype_unparse (ct), exprNode_unparse (e1), exprNode_unparse (e2)), e1->loc); } sRefSet_realElements (aliases, ysr) { sRef base = sRef_getRootBase (ysr); if (sRef_similar (ysr, s2b) || sRef_similar (s1b, base) || sRef_sameName (base, s1b)) { ; /* error already reported or same sref */ } else { checkOneRepExpose (ysr, base, e1, e2, ct, s2b); } } end_sRefSet_realElements; } sRefSet_free (aliases); } } donerepexpose: /* ** function variables don't really work... */ if (!ctype_isFunction (ctype_realType (e2->typ))) { if (isInit) { DPRINTF (("Check init: %s / %s", exprNode_unparse (e1), exprNode_unparse (e2))); transferChecks_initialization (e1, e2); } else { transferChecks_assign (e1, e2); } } else { sRef fref = e2->sref; sRef_setDefState (e1->sref, sRef_getDefState (fref), e1->loc); sRef_setNullState (e1->sref, sRef_getNullState (fref), e1->loc); /* Need to typecheck the annotation on the parameters */ if (ctype_isRealFunction (e1->typ)) { uentryList e1p = ctype_argsFunction (ctype_realType (e1->typ)); uentryList e2p = ctype_argsFunction (ctype_realType (e2->typ)); if (!uentryList_isMissingParams (e1p) && !uentryList_isMissingParams (e2p) && uentryList_size (e1p) > 0) { if (uentryList_size (e1p) == uentryList_size (e2p)) { int n = 0; uentryList_elements (e1p, el1) { uentry el2; el2 = uentryList_getN (e2p, n); n++; uentry_checkMatchParam (el1, el2, n, e2); } end_uentryList_elements; } } } } if (exprNode_isStringLiteral (e2)) { exprNode_checkStringLiteralLength (exprNode_getType (e1), e2); } if (isInit && sRef_isFileOrGlobalScope (e1->sref)) { ; } else { DPRINTF (("Update aliases: %s / %s", exprNode_unparse (e1), exprNode_unparse (e2))); updateAliases (e1, e2); } } static void checkMacroParen (exprNode e) { if (exprNode_isError (e) || e->kind == XPR_CAST) { ; } else { if (sRef_isUnsafe (e->sref) && !exprNode_isInParens (e)) { voptgenerror (FLG_MACROPARENS, message ("Macro parameter used without parentheses: %s", exprNode_unparse (e)), e->loc); } } } static void reflectNullTest (/*@notnull@*/ exprNode e, bool isnull) { if (isnull) { e->guards = guardSet_addTrueGuard (e->guards, e->sref); } else { e->guards = guardSet_addFalseGuard (e->guards, e->sref); } } /* ** e1 <= e2 ** ** if e2 is a parameter or global derived location which ** can be modified (that is, e2 is a mutable abstract type, ** or a derived pointer), then e1 can alias e2. ** ** e1 can alias everything which e2 can alias. ** ** Also, if e1 is guarded, remove from guard sets! */ static void updateAliases (/*@notnull@*/ exprNode e1, /*@notnull@*/ exprNode e2) { if (!context_inProtectVars ()) { /* ** depends on types of e1 and e2 */ sRef s1 = e1->sref; sRef s2 = e2->sref; ctype t1 = exprNode_getType (e1); /* handle pointer sRefs, record fields, arrays, etc... */ if (!ctype_isRealSU (t1)) { DPRINTF (("Copying real! %s", ctype_unparse (t1))); sRef_copyRealDerivedComplete (s1, s2); } else { /* ** Fields should alias */ DPRINTF (("Not COPYING!: %s", ctype_unparse (t1))); } if (ctype_isMutable (t1) && sRef_isKnown (s1)) { usymtab_clearAlias (s1); usymtab_addMustAlias (s1, s2); DPRINTF (("Add must alias: %s / %s", sRef_unparse (s1), sRef_unparse (s2))); } else { DPRINTF (("Not mutable: %s", ctype_unparse (t1))); } if (sRef_possiblyNull (s1) && usymtab_isGuarded (s1)) { usymtab_unguard (s1); } } } exprNode exprNode_updateLocation (/*@returned@*/ exprNode e, /*@temp@*/ fileloc loc) { if (exprNode_isDefined (e)) { e->loc = fileloc_update (e->loc, loc); } else { e = exprNode_createLoc (ctype_unknown, fileloc_copy (loc)); } return (e); } static void checkUniqueParams (exprNode fcn, /*@notnull@*/ exprNode current, exprNodeList args, int paramno, uentry ucurrent) { int iparamno = 0; sRef thisref = exprNode_getSref (current); /* ** Check if any argument could match this argument. */ exprNodeList_elements (args, icurrent) { iparamno++; if (iparamno != paramno) { sRef sr = exprNode_getSref (icurrent); if (sRef_similarRelaxed (thisref, sr)) { if (!sRef_isConst (thisref) && !sRef_isConst (sr)) { voptgenerror (FLG_ALIASUNIQUE, message ("Parameter %d (%s) to function %s is declared %s but " "is aliased by parameter %d (%s)", paramno, exprNode_unparse (current), exprNode_unparse (fcn), alkind_unparse (uentry_getAliasKind (ucurrent)), iparamno, exprNode_unparse (icurrent)), current->loc); } } else { sRefSet aliases = usymtab_canAlias (sr); sRefSet_allElements (aliases, asr) { if (ctype_isUnknown (sRef_getType (thisref))) { sRef_setType (thisref, uentry_getType (ucurrent)); } if (sRef_similarRelaxed (thisref, asr)) { if (sRef_isExternal (asr)) { if (sRef_isLocalState (thisref)) { ; /* okay */ } else { sRef base = sRef_getRootBase (asr); if (!sRef_similar (sRef_getBase (asr), thisref)) { if (sRef_isUnique (base) || sRef_isOnly (base) || sRef_isKept (base) || (sRef_isAddress (asr) && sRef_isLocalVar (base)) || (sRef_isAddress (thisref) && sRef_isLocalVar (sRef_getRootBase (thisref)))) { ; /* okay, no error */ } else { voptgenerror (FLG_MAYALIASUNIQUE, message ("Parameter %d (%s) to function %s is declared %s but " "may be aliased externally by parameter %d (%s)", paramno, exprNode_unparse (current), exprNode_unparse (fcn), alkind_unparse (uentry_getAliasKind (ucurrent)), iparamno, exprNode_unparse (icurrent)), current->loc); } } } } else { voptgenerror (FLG_ALIASUNIQUE, message ("Parameter %d (%s) to function %s is declared %s but " "is aliased externally by parameter %d (%s) through " "alias %q", paramno, exprNode_unparse (current), exprNode_unparse (fcn), alkind_unparse (uentry_getAliasKind (ucurrent)), iparamno, exprNode_unparse (icurrent), sRef_unparse (asr)), current->loc); } } } end_sRefSet_allElements; sRefSet_free (aliases); } } } end_exprNodeList_elements; } long exprNode_getLongValue (exprNode e) { long value; if (exprNode_hasValue (e) && multiVal_isInt (exprNode_getValue (e))) { value = multiVal_forceInt (exprNode_getValue (e)); } else { value = 0; /* Unknown value */ } return value; } /*@only@*/ fileloc exprNode_getNextSequencePoint (exprNode e) { /* ** Returns the location of the sequence point following e. ** ** Only works for statements (for now). */ if (exprNode_isDefined (e) && e->kind == XPR_STMT) { lltok t = exprData_getUopTok (e->edata); return fileloc_copy(lltok_getLoc (t)); } else { /* drl possible problem : warning fix llcontbug (message ("Cannot get next sequence point: %s", exprNode_unparse (e))); */ return fileloc_undefined; } } exprNode exprNode_createNew(ctype c) { exprNode ret; ret = exprNode_createPlain (c); return ret; } bool exprNode_isInitBlock (exprNode e) { return (exprNode_isDefined(e) && e->kind == XPR_INITBLOCK); } /*drl 3/2/2003 moved this function out of constraint.c */ exprNode exprNode_copyConstraints (/*@returned@*/ exprNode dst, exprNode src) { llassert (exprNode_isDefined (dst) ); llassert (exprNode_isDefined (src) ); constraintList_free (dst->ensuresConstraints); constraintList_free (dst->requiresConstraints); constraintList_free (dst->trueEnsuresConstraints); constraintList_free (dst->falseEnsuresConstraints); dst->ensuresConstraints = constraintList_copy (src->ensuresConstraints); dst->requiresConstraints = constraintList_copy (src->requiresConstraints); dst->trueEnsuresConstraints = constraintList_copy (src->trueEnsuresConstraints); dst->falseEnsuresConstraints = constraintList_copy (src->falseEnsuresConstraints); return dst; } void exprNode_revealState (exprNode e) { if (exprNode_isDefined (e)) { llmsg (message ("%s: State of %s: %s", fileloc_unparse (exprNode_loc (e)), exprNode_unparse (e), sRef_unparseFull (e->sref))); } else { llmsg (message ("%s: Reveal state undefined", fileloc_unparse (g_currentloc))); } } splint-3.1.2.dfsg1/src/exprChecks.c0000644021234200000250000011340407671271604014512 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** exprChecks.c */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "transferChecks.h" # include "exprChecks.h" /* ** for now, allow exprChecks to access exprNode. ** may remove this in future */ /*@access exprNode@*/ static bool checkCallModifyAux (/*@exposed@*/ sRef p_s, exprNode p_f, sRef p_alias, exprNode p_err); static bool checkModifyValAux (/*@exposed@*/ sRef p_s, exprNode p_f, sRef p_alias, exprNode p_err); static bool checkModifyAux (/*@exposed@*/ sRef p_s, exprNode p_f, sRef p_alias, exprNode p_err); static void checkSafeReturnExpr (/*@notnull@*/ exprNode p_e); /* ** called at end of expression statement ** ** of e->kind is not an assign, empty, body or modop ** verify the the value is void ** */ static int inCompoundStatementExpression = 0; void exprChecks_inCompoundStatementExpression (void) { inCompoundStatementExpression++; } void exprChecks_leaveCompoundStatementExpression (void) { inCompoundStatementExpression--; llassert (inCompoundStatementExpression >= 0); } void exprChecks_checkStatementEffect (exprNode e) { bool hasError = FALSE; if (inCompoundStatementExpression > 0) { /* ** Okay to have effectless statments in compound statement expression (should check ** it is the last statement, but we don't for now). */ return; } if (!exprNode_isError (e)) { exprKind ek = e->kind; if (ek == XPR_CALL && !(ctype_isRealVoid (e->typ))) { if (ctype_isKnown (e->typ)) { if (ctype_isManifestBool (ctype_realishType (e->typ))) { hasError = optgenerror (FLG_RETVALBOOL, message ("Return value (type %t) ignored: %s", e->typ, exprNode_unparseFirst (e)), e->loc); } else if (ctype_isDirectInt (e->typ)) { hasError = optgenerror (FLG_RETVALINT, message ("Return value (type %t) ignored: %s", e->typ, exprNode_unparseFirst (e)), e->loc); } else { hasError = optgenerror (FLG_RETVALOTHER, message ("Return value (type %t) ignored: %s", e->typ, exprNode_unparseFirst (e)), e->loc); } } } if (!hasError && !(exprNode_mayEscape (e)) && !(e->canBreak)) /* control changes are effects too! */ { if (sRefSet_hasRealElement (e->sets) || sRefSet_hasRealElement (e->msets)) { ; /* okay */ } else { if (sRefSet_isEmpty (e->sets) && sRefSet_isEmpty (e->msets)) { voptgenerror (FLG_NOEFFECT, message ("Statement has no effect: %s", exprNode_unparseFirst (e)), e->loc); } else { if (context_maybeSet (FLG_NOEFFECTUNCON)) { if (sRefSet_hasUnconstrained (e->sets)) { voptgenerror (FLG_NOEFFECTUNCON, message ("Statement has no effect (possible " "undected modification through " "call to %q): %s", sRefSet_unparseUnconstrained (e->sets), exprNode_unparseFirst (e)), e->loc); } else if (sRefSet_hasUnconstrained (e->msets)) { voptgenerror (FLG_NOEFFECTUNCON, message ("Statement has no effect (possible " "undected modification through " "call to %q): %s", sRefSet_unparseUnconstrained (e->msets), exprNode_unparseFirst (e)), e->loc); } else { ; /* statement has unknown modification */ } } } } } } } static bool checkRepExposed (sRef base, /*@notnull@*/ exprNode e, sRef alias, /*@unused@*/ exprNode unused) { ctype btype; if (sRef_isInvalid (alias) || sRef_sameName (base, alias)) { btype = sRef_getType (base); if (ctype_isAbstract (btype) && ctype_isVisiblySharable (e->typ)) { voptgenerror (FLG_RETEXPOSE, message ("Return value exposes rep of %s: %s", ctype_unparse (btype), exprNode_unparse (e)), e->loc); return TRUE; } } else { sRef rbase = sRef_getRootBase (base); btype = sRef_getType (rbase); if (ctype_isAbstract (btype) && ctype_isVisiblySharable (e->typ)) { voptgenerror (FLG_RETEXPOSE, message ("Return value may expose rep of %s through alias %q: %s", ctype_unparse (btype), sRef_unparse (rbase), exprNode_unparse (e)), e->loc); return TRUE; } } return FALSE; } static bool checkRefGlobParam (sRef base, /*@notnull@*/ exprNode e, sRef alias, /*@unused@*/ exprNode unused) { if (sRef_isInvalid (alias) || sRef_sameName (base, alias)) { ctype ct = e->typ; if (ctype_isUnknown (ct)) { ct = sRef_getType (base); } if (ctype_isVisiblySharable (ct)) { if (sRef_isFileOrGlobalScope (base)) { uentry fcn = context_getHeader (); bool noerror = FALSE; if (uentry_isValid (fcn) && uentry_isFunction (fcn)) { sRef res = uentry_getSref (fcn); /* If result is dependent and global is owned, this is okay... */ if (sRef_isDependent (res) && sRef_isOwned (base)) { noerror = TRUE; } } if (!noerror) { voptgenerror (FLG_RETALIAS, message ("Function returns reference to global %q: %s", sRef_unparse (base), exprNode_unparse (e)), e->loc); } return TRUE; } else if (sRef_isAnyParam (base)) { uentryList params = context_getParams (); int paramno = sRef_getParam (base); if (paramno < uentryList_size (params)) { uentry arg = uentryList_getN (params, paramno); sRef ref = uentry_getSref (arg); if (uentry_isReturned (arg) || sRef_isOnly (ref) || sRef_isExposed (ref) || sRef_isRefCounted (ref)) { ; /* okay */ } else { voptgenerror (FLG_RETALIAS, message ("Function returns reference to parameter %q: %s", sRef_unparse (base), exprNode_unparse (e)), e->loc); } } else { llbuglit ("ret alias: bad paramno"); } return TRUE; } else { return FALSE; } } } else { if (ctype_isVisiblySharable (e->typ)) { if (sRef_isFileOrGlobalScope (base)) { voptgenerror (FLG_RETALIAS, message ("Function may return reference to global %q through alias %q: %s", sRef_unparse (alias), sRef_unparse (base), exprNode_unparse (e)), e->loc); return TRUE; } else if (sRef_isAnyParam (base) && !(sRef_isOnly (base))) { uentryList params = context_getParams (); int paramno = sRef_getParam (base); if (paramno < uentryList_size (params)) { uentry arg = uentryList_getN (params, paramno); if (!uentry_isReturned (arg)) { voptgenerror (FLG_RETALIAS, message ("Function may return reference to parameter %q through alias %q: %s", sRef_unparse (base), sRef_unparse (alias), exprNode_unparse (e)), e->loc); return TRUE; } } else { voptgenerror (FLG_RETALIAS, message ("Function may return reference to parameter %q through alias %q: %s", sRef_unparse (base), sRef_unparse (alias), exprNode_unparse (e)), e->loc); return TRUE; } } else { return FALSE; } } } return FALSE; } void exprNode_checkModify (exprNode e, exprNode err) { llassert (exprNode_isDefined (e)); DPRINTF (("Check modify: %s", exprNode_unparse (e))); if (sRef_isValid (e->sref)) { sRef_aliasCheckPred (checkModifyAux, sRef_isReference, e->sref, e, err); } } void exprNode_checkModifyVal (exprNode e, exprNode err) { llassert (exprNode_isDefined (e)); DPRINTF (("Check modify val: %s", exprNode_unparse (e))); if (sRef_isValid (e->sref)) { sRef_aliasCheckPred (checkModifyValAux, sRef_isReference, e->sref, e, err); } } void exprChecks_checkNullReturn (fileloc loc) { if (!context_inRealFunction ()) { /* llmsg ("exprChecks_checkNullReturnExpr: not in function context"); */ return; } else { if (ctype_isFunction (context_currentFunctionType ())) { ctype tr = ctype_getReturnType (context_currentFunctionType ()); if (!ctype_isFirstVoid (tr)) { if (ctype_isUnknown (tr)) { voptgenerror (FLG_EMPTYRETURN, cstring_makeLiteral ("Empty return in function declared to implicitly return int"), loc); } else { voptgenerror (FLG_EMPTYRETURN, message ("Empty return in function declared to return %t", tr), loc); } } } } } void exprNode_checkReturn (exprNode e) { if (!exprNode_isError (e)) { if (!context_inRealFunction ()) { if (context_inMacro ()) { llerror (FLG_MACRORETURN, message ("Macro %s uses return (not functional)", context_inFunctionName ())); } else { /* llbuglit ("exprNode_checkReturn: not in function context"); */ } } else { if (ctype_isFunction (context_currentFunctionType ())) { checkSafeReturnExpr (e); } else { ; } } } } void exprNode_checkPred (cstring c, exprNode e) { ctype ct; if (exprNode_isError (e)) return; ct = exprNode_getType (e); if (exprNode_isAssign (e)) { voptgenerror (FLG_PREDASSIGN, message ("Test expression for %s is assignment expression: %s", c, exprNode_unparse (e)), e->loc); } if (ctype_isRealBool (ct) || ctype_isUnknown (ct)) /* evs 2000-12-20 added || ctype_isUnknown to avoid spurious messages */ { ; } else if (ctype_isRealPointer (ct)) { voptgenerror (FLG_PREDBOOLPTR, message ("Test expression for %s not %s, type %t: %s", c, context_printBoolName (), ct, exprNode_unparse (e)), e->loc); } else if (ctype_isRealInt (ct)) { voptgenerror (FLG_PREDBOOLINT, message ("Test expression for %s not %s, type %t: %s", c, context_printBoolName (), ct, exprNode_unparse (e)), e->loc); } else { voptgenerror (FLG_PREDBOOLOTHERS, message ("Test expression for %s not %s, type %t: %s", c, context_printBoolName (), ct, exprNode_unparse (e)), e->loc); } } void exprChecks_checkUsedGlobs (globSet decl, globSet used) { fileloc fl = uentry_whereSpecified (context_getHeader ()); if (fileloc_isUndefined (fl)) { fl = uentry_whereDeclared (context_getHeader ()); } globSet_allElements (decl, el) { if (!globSet_member (used, el)) { if (sRef_isSpecInternalState (el) || sRef_isNothing (el)) { ; } else { cstring sname = sRef_unparse (el); if (fileloc_isLib (fl)) { voptgenerror (FLG_USEALLGLOBS, message ("Global %s listed (%q) but not used", sname, fileloc_unparse (fl)), g_currentloc); } else { voptgenerror (FLG_USEALLGLOBS, message ("Global %s listed but not used", sname), fl); } cstring_free (sname); } } } end_globSet_allElements; } void exprNode_checkAllMods (sRefSet mods, uentry ue) { bool realParams = FALSE; uentry le = context_getHeader (); fileloc fl = uentry_whereSpecified (le); uentryList specParamNames = uentryList_undefined; uentryList paramNames = context_getParams (); if (uentry_isFunction (le)) { specParamNames = uentry_getParams (le); if (uentryList_isUndefined (specParamNames)) { ; /* unknown params */ } else if (uentryList_size (paramNames) != uentryList_size (specParamNames)) { llbug (message ("exprNode_checkAllMods: parameter lists have different sizes: " "%q (%d) / %q (%d)", uentryList_unparse (paramNames), uentryList_size (paramNames), uentryList_unparse (specParamNames), uentryList_size (specParamNames))); } else if (uentryList_size (paramNames) > 0 && !uentry_hasRealName (uentryList_getN (specParamNames, 0))) { /* loaded from a library */ } else { realParams = TRUE; } } sRefSet_allElements (mods, sr) { if (sRef_isNothing (sr) || sRef_isSpecState (sr)) { ; /* should report on anything? */ } else if (sRef_isInternalState (sr)) { if (!sRef_isModified (sr)) { if (sRefSet_hasStatic (mods)) { ; /* okay */ } else { if (optgenerror (FLG_MUSTMOD, message ("Function %s specified to modify internal state " "but no internal state is modified", uentry_rawName (ue)), uentry_whereLast (ue))) { uentry_showWhereSpecified (le); } } } } else { if (!sRef_isModified (sr)) { cstring sname = realParams ? sRef_unparse (sr) : sRef_unparse (sr); if (fileloc_isLib (fl) && !realParams) { voptgenerror (FLG_MUSTMOD, message ("Suspect object listed (%q) in modifies " "clause of %s not modified: %s", fileloc_unparse (fl), uentry_rawName (ue), sname), uentry_whereLast (ue)); } else { if (optgenerror (FLG_MUSTMOD, message ("Suspect object listed in modifies of %s " "not modified: %s", uentry_rawName (ue), sname), uentry_whereLast (ue))) { uentry_showWhereSpecified (le); } } cstring_free (sname); } } } end_sRefSet_allElements; } void exprNode_checkMacroBody (/*@only@*/ exprNode e) { if (!exprNode_isError (e)) { uentry hdr; if (!(context_inFunctionLike () || context_inMacroConstant () || context_inUnknownMacro ())) { llcontbug (message ("exprNode_checkMacroBody: not in macro function or constant: %q", context_unparse ())); exprNode_free (e); return; } hdr = context_getHeader (); if (e->kind == XPR_STMTLIST || e->kind == XPR_BODY) { voptgenerror (FLG_MACROSTMT, message ("Macro %q definition is statement list (recommend " "do { ... } while (0) constuction to ensure multiple " "statement macro is syntactic function)", uentry_getName (hdr)), fileloc_isDefined (e->loc) ? e->loc : g_currentloc); } if (context_inMacroConstant ()) { ctype t = uentry_getType (hdr); uentry_setDefined (hdr, e->loc); if (!(exprNode_matchType (t, e))) { cstring uname = uentry_getName (hdr); if (cstring_equal (uname, context_getTrueName ()) || cstring_equal (uname, context_getFalseName ())) { /* ** We need to do something special to allow FALSE and TRUE ** to be defined without reporting errors. This is a tad ** bogus, but otherwise lots of things would break. */ llassert (ctype_isManifestBool (t)); /* Should also check type of e is a reasonable (?) bool type. */ } else { if (optgenerror (FLG_INCONDEFS, message ("Constant %q specified as %s, but defined as %s: %s", uentry_getName (hdr), ctype_unparse (t), ctype_unparse (e->typ), exprNode_unparse (e)), e->loc)) { uentry_showWhereSpecified (hdr); } } cstring_free (uname); } else { if (context_maybeSet (FLG_NULLSTATE) && ctype_isUA(t) && ctype_isRealPointer (t) && exprNode_isNullValue (e)) { uentry ue = usymtab_getTypeEntry (ctype_typeId (t)); sRef sr = uentry_getSref (ue); if (!sRef_possiblyNull (sr)) { vgenhinterror (FLG_NULLSTATE, message ("Constant %q of non-null type %s defined " "as null: %s", uentry_getName (hdr), ctype_unparse (t), exprNode_unparse (e)), message ("If %s can be null, add a /*@null@*/ " "qualifer to its typedef.", ctype_unparse (t)), e->loc); } uentry_mergeConstantValue (hdr, e->val); e->val = multiVal_undefined; } } } else if (context_inMacroFunction () || context_inUnknownMacro ()) { ctype rettype = context_getRetType (); if (context_isMacroMissingParams ()) { llassert (context_inMacroFunction ()); /* ** # define newname oldname ** ** newname is a function ** specification of oldname should match ** specification of newname. */ if (!ctype_isFunction (e->typ)) { voptgenerror (FLG_INCONDEFS, message ("Function %s defined by unparameterized " "macro not corresponding to function", context_inFunctionName ()), e->loc); } else { uentry ue = exprNode_getUentry (e); if (uentry_isValid (ue)) { /* ** Okay, for now --- should check for consistency */ /* ** uentry oldue = usymtab_lookup (cfname); */ /* check var conformance here! */ } else { voptgenerror (FLG_INCONDEFS, message ("Function %s defined by unparameterized " "macro not corresponding to function", context_inFunctionName ()), e->loc); } e->typ = ctype_getReturnType (e->typ); rettype = e->typ; /* avoid aditional errors */ } } if (ctype_isVoid (rettype) || ctype_isUnknown (rettype)) { ; /* don't complain when void macros have values */ } else if (!exprNode_matchType (rettype, e)) { if (optgenerror (FLG_INCONDEFS, message ("Function %q specified to return %s, " "implemented as macro having type %s: %s", uentry_getName (hdr), ctype_unparse (rettype), ctype_unparse (e->typ), exprNode_unparse (e)), e->loc)) { uentry_showWhereSpecified (hdr); } } else { switch (e->kind) { /* these expressions have values: */ case XPR_PARENS: case XPR_ASSIGN: case XPR_EMPTY: case XPR_VAR: case XPR_OP: case XPR_POSTOP: case XPR_PREOP: case XPR_CALL: case XPR_SIZEOFT: case XPR_SIZEOF: case XPR_ALIGNOFT: case XPR_ALIGNOF: case XPR_CAST: case XPR_FETCH: case XPR_COMMA: case XPR_COND: case XPR_ARROW: case XPR_CONST: case XPR_STRINGLITERAL: case XPR_NUMLIT: case XPR_FACCESS: case XPR_OFFSETOF: transferChecks_return (e, hdr); break; /* these expressions don't */ case XPR_LABEL: case XPR_VAARG: case XPR_ITER: case XPR_FOR: case XPR_FORPRED: case XPR_GOTO: case XPR_CONTINUE: case XPR_BREAK: case XPR_RETURN: case XPR_NULLRETURN: case XPR_IF: case XPR_IFELSE: case XPR_DOWHILE: case XPR_WHILE: case XPR_STMT: case XPR_STMTLIST: case XPR_SWITCH: case XPR_INIT: case XPR_BODY: case XPR_NODE: case XPR_ITERCALL: case XPR_TOK: case XPR_CASE: case XPR_FTCASE: case XPR_FTDEFAULT: case XPR_DEFAULT: case XPR_WHILEPRED: case XPR_BLOCK: case XPR_INITBLOCK: if (optgenerror (FLG_INCONDEFS, message ("Function %q specified to return %s, " "implemented as macro with no result: %s", uentry_getName (hdr), ctype_unparse (rettype), exprNode_unparse (e)), e->loc)) { uentry_showWhereSpecified (hdr); } } } usymtab_checkFinalScope (FALSE); } else { llbug (message ("exprNode_checkMacroBody: not in macro function: %q", context_unparse ())); } exprNode_free (e); } context_exitFunction (); return; } void exprNode_checkFunctionBody (exprNode body) { if (!exprNode_isError (body)) { bool noret = context_getFlag (FLG_NORETURN); bool checkret = exprNode_mustEscape (body); if (!checkret && noret && !exprNode_errorEscape (body) && context_inRealFunction () && ctype_isFunction (context_currentFunctionType ())) { ctype tr = ctype_getReturnType (context_currentFunctionType ()); if (!ctype_isFirstVoid (tr)) { if (ctype_isUnknown (tr)) { voptgenerror (FLG_NORETURN, cstring_makeLiteral ("Path with no return in function declared to implicity return int"), g_currentloc); } else { voptgenerror (FLG_NORETURN, message ("Path with no return in function declared to return %t", tr), g_currentloc); } } } if (!checkret) { context_returnFunction (); } } } /*drl modified */ void exprNode_checkFunction (/*@unused@*/ uentry ue, /*@only@*/ exprNode body) { constraintList c, t, post; constraintList c2, fix; context_enterInnerContext (); llassert (exprNode_isDefined (body)); DPRINTF (("Checking body: %s", exprNode_unparse (body))); /* if we're not going to be printing any errors for buffer overflows we can skip the checking to improve performance FLG_DEBUGFUNCTIONCONSTRAINT controls wheather we perform the check anyway in order to find potential problems like assert failures and seg faults... */ if (!(context_getFlag (FLG_DEBUGFUNCTIONCONSTRAINT) || context_getFlag (FLG_BOUNDSWRITE) || context_getFlag (FLG_BOUNDSREAD) || context_getFlag (FLG_LIKELYBOUNDSWRITE) || context_getFlag (FLG_LIKELYBOUNDSREAD) || context_getFlag (FLG_CHECKPOST) || context_getFlag (FLG_ALLOCMISMATCH))) { exprNode_free (body); context_exitInnerPlain(); return; } exprNode_generateConstraints (body); /* evans 2002-03-02: this should not be declared to take a dependent... fix it! */ c = uentry_getFcnPreconditions (ue); if (constraintList_isDefined (c)) { DPRINTF (("Function preconditions are %s", constraintList_unparseDetailed (c))); body->requiresConstraints = constraintList_reflectChangesFreePre (body->requiresConstraints, c); c2 = constraintList_copy (c); fix = constraintList_makeFixedArrayConstraints (body->uses); c2 = constraintList_reflectChangesFreePre (c2, fix); constraintList_free (fix); if (context_getFlag (FLG_ORCONSTRAINT)) { t = constraintList_reflectChangesOr (body->requiresConstraints, c2 ); } else { t = constraintList_reflectChanges(body->requiresConstraints, c2); } constraintList_free (body->requiresConstraints); DPRINTF ((message ("The body has the required constraints: %s", constraintList_unparseDetailed (t) ) ) ); body->requiresConstraints = t; t = constraintList_mergeEnsures (c, body->ensuresConstraints); constraintList_free(body->ensuresConstraints); body->ensuresConstraints = t; DPRINTF ((message ("The body has the ensures constraints: %s", constraintList_unparseDetailed (t) ) ) ); constraintList_free(c2); } if (constraintList_isDefined(c)) { DPRINTF ((message ("The Function %s has the preconditions %s", uentry_unparse(ue), constraintList_unparseDetailed(c)))); } else { DPRINTF((message ("The Function %s has no preconditions", uentry_unparse(ue)))); } if (context_getFlag (FLG_IMPBOUNDSCONSTRAINTS)) { constraintList implicitFcnConstraints = context_getImplicitFcnConstraints (ue); if (constraintList_isDefined (implicitFcnConstraints)) { DPRINTF (("Implicit constraints: %s", constraintList_unparse (implicitFcnConstraints))); body->requiresConstraints = constraintList_reflectChangesFreePre (body->requiresConstraints, implicitFcnConstraints); constraintList_free (implicitFcnConstraints); } else { DPRINTF (("No implicit constraints")); } } body->requiresConstraints = constraintList_sort (body->requiresConstraints); constraintList_printError(body->requiresConstraints, g_currentloc); post = uentry_getFcnPostconditions (ue); if (context_getFlag (FLG_CHECKPOST)) { if (constraintList_isDefined (post)) { constraintList post2; DPRINTF ((message ("The declared function postconditions are %s \n\n\n\n\n", constraintList_unparseDetailed (post) ) ) ); post = constraintList_reflectChangesFreePre (post, body->ensuresConstraints); post2 = constraintList_copy (post); fix = constraintList_makeFixedArrayConstraints (body->uses); post2 = constraintList_reflectChangesFreePre (post2, fix); constraintList_free(fix); if ( context_getFlag (FLG_ORCONSTRAINT) ) { t = constraintList_reflectChangesOr (post2, body->ensuresConstraints); } else { t = constraintList_reflectChanges(post2, body->ensuresConstraints); } constraintList_free(post2); constraintList_free(post); post = t; printf("Unresolved post conditions\n"); constraintList_printErrorPostConditions(post, g_currentloc); } } if (constraintList_isDefined (post)) { constraintList_free (post); } body->ensuresConstraints = constraintList_sort(body->ensuresConstraints); if ( context_getFlag (FLG_FUNCTIONPOST) ) { constraintList_printError(body->ensuresConstraints, g_currentloc); } /* ConPrint (message ("Unable to resolve function constraints:\n%s", constraintList_printDetailed(body->requiresConstraints) ), g_currentloc); ConPrint (message ("Splint has found function post conditions:\n%s", constraintList_printDetailed(body->ensuresConstraints) ), g_currentloc); printf ("The required constraints are:\n%s", constraintList_printDetailed(body->requiresConstraints) ); printf ("The ensures constraints are:\n%s", constraintList_unparseDetailed(body->ensuresConstraints) ); */ if (constraintList_isDefined (c)) constraintList_free(c); context_exitInnerPlain(); /* is it okay not to free this? */ DPRINTF (("Done checking constraints...")); exprNode_free (body); } void exprChecks_checkEmptyMacroBody (void) { uentry hdr; if (!(context_inFunctionLike () || context_inMacroConstant () || context_inUnknownMacro ())) { llcontbug (message ("exprNode_checkEmptyMacroBody: not in macro function or constant: %q", context_unparse ())); return; } hdr = context_getHeader (); beginLine (); if (uentry_isFunction (hdr)) { voptgenerror (FLG_MACROEMPTY, message ("Macro definition for %q is empty", uentry_getName (hdr)), g_currentloc); usymtab_checkFinalScope (FALSE); } context_exitFunction (); return; } void exprNode_checkIterBody (/*@only@*/ exprNode body) { context_exitAllClauses (); context_exitFunction (); exprNode_free (body); } void exprNode_checkIterEnd (/*@only@*/ exprNode body) { context_exitAllClauses (); context_exitFunction (); exprNode_free (body); } static bool checkModifyAuxAux (/*@exposed@*/ sRef s, exprNode f, sRef alias, exprNode err) { bool hasMods = context_hasMods (); flagcode errCode = hasMods ? FLG_MODIFIES : FLG_MODNOMODS; if (exprNode_isDefined (f)) { f->sets = sRefSet_insert (f->sets, s); } if (context_getFlag (FLG_MODIFIES) && (hasMods || context_getFlag (FLG_MODNOMODS))) { sRefSet mods = context_modList (); if (!sRef_canModify (s, mods)) { sRef rb = sRef_getRootBase (s); if (sRef_isFileOrGlobalScope (rb)) { if (!context_checkGlobMod (rb)) { return FALSE; } } if (sRef_isInvalid (alias) || sRef_sameName (s, alias)) { if (sRef_isLocalVar (sRef_getRootBase (s))) { voptgenerror (errCode, message ("Undocumented modification of internal state (%q): %s", sRef_unparse (s), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } else { if (sRef_isSystemState (s)) { if (errCode == FLG_MODNOMODS) { if (context_getFlag (FLG_MODNOMODS)) { errCode = FLG_MODFILESYSTEM; } } else { errCode = FLG_MODFILESYSTEM; } } voptgenerror (errCode, message ("Undocumented modification of %q: %s", sRef_unparse (s), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } return TRUE; } else { if (sRef_isReference (s) && !sRef_isAddress (alias)) { voptgenerror (errCode, message ("Possible undocumented modification of %q through alias %q: %s", sRef_unparse (s), sRef_unparse (alias), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); return TRUE; } } } } else { if (context_maybeSet (FLG_MUSTMOD)) { (void) sRef_canModify (s, context_modList ()); } if (sRef_isRefsField (s)) { sRef_setModified (s); } } return FALSE; } static bool checkModifyAux (/*@exposed@*/ sRef s, exprNode f, sRef alias, exprNode err) { DPRINTF (("Check modify aux: %s", sRef_unparseFull (s))); if (sRef_isReference (s) && sRef_isObserver (s) && context_maybeSet (FLG_MODOBSERVER)) { cstring sname; if (sRef_isPointer (s)) { sRef base = sRef_getBase (s); sname = sRef_unparse (base); } else { if (sRef_isAddress (s)) { sRef p = sRef_constructPointer (s); sname = sRef_unparse (p); } else { sname = sRef_unparse (s); } } if (!sRef_isValid (alias) || sRef_sameName (s, alias)) { if (sRef_isMeaningful (s)) { if (optgenerror (FLG_MODOBSERVER, message ("Suspect modification of observer %s: %s", sname, exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc)) { sRef_showExpInfo (s); } } else { voptgenerror (FLG_MODOBSERVER, message ("Suspect modification of observer returned by " "function call: %s", exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } } else { if (optgenerror (FLG_MODOBSERVER, message ("Suspect modification of observer %s through alias %q: %s", sname, sRef_unparse (alias), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc)) { sRef_showExpInfo (s); } } cstring_free (sname); } (void) checkModifyAuxAux (s, f, alias, err); return FALSE; } static bool checkModifyValAux (/*@exposed@*/ sRef s, exprNode f, sRef alias, exprNode err) { (void) checkModifyAuxAux (s, f, alias, err); return FALSE; } static bool checkCallModifyAux (/*@exposed@*/ sRef s, exprNode f, sRef alias, exprNode err) { bool result = FALSE; DPRINTF (("Check modify aux: %s / %s", sRef_unparse (s), sRef_unparse (alias))); if (sRef_isObserver (s) && context_maybeSet (FLG_MODOBSERVER)) { sRef p = sRef_isAddress (s) ? sRef_constructPointer (s) : s; cstring sname = sRef_unparse (p); if (!sRef_isValid (alias) || sRef_sameName (s, alias)) { if (sRef_isMeaningful (s)) { result = optgenerror (FLG_MODOBSERVER, message ("Suspect modification of observer %s: %s", sname, exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } else { result = optgenerror (FLG_MODOBSERVER, message ("Suspect modification of observer returned by " "function call: %s", exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } } else { result = optgenerror (FLG_MODOBSERVER, message ("Suspect modification of observer %s through alias %q: %s", sname, sRef_unparse (alias), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } cstring_free (sname); } else if (context_maybeSet (FLG_MODIFIES)) { DPRINTF (("can modify: %s / %s", sRef_unparse (s), sRefSet_unparse (context_modList ()))); if (!(sRef_canModifyVal (s, context_modList ()))) { sRef p = sRef_isAddress (s) ? sRef_constructPointer (s) : s; cstring sname = sRef_unparse (p); bool hasMods = context_hasMods (); sRef rb = sRef_getRootBase (s); flagcode errCode = hasMods ? FLG_MODIFIES : FLG_MODNOMODS; bool check = TRUE; DPRINTF (("Can't modify! %s", sRef_unparse (s))); if (sRef_isFileOrGlobalScope (rb)) { uentry ue = sRef_getUentry (rb); /* be more specific here! */ if (!uentry_isCheckedModify (ue)) { check = FALSE; } } if (check) { if (!sRef_isValid (alias) || sRef_sameName (s, alias)) { if (sRef_isLocalVar (sRef_getRootBase (s))) { voptgenerror (errCode, message ("Undocumented modification of internal " "state (%q) through call to %s: %s", sRef_unparse (s), exprNode_unparse (f), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } else { if (sRef_isSystemState (s)) { if (errCode == FLG_MODNOMODS) { if (context_getFlag (FLG_MODNOMODS)) { errCode = FLG_MODFILESYSTEM; } } else { errCode = FLG_MODFILESYSTEM; } } result = optgenerror (errCode, message ("Undocumented modification of %s " "possible from call to %s: %s", sname, exprNode_unparse (f), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } } else { result = optgenerror (errCode, message ("Undocumented modification of %s possible " "from call to %s (through alias %q): %s", sname, exprNode_unparse (f), sRef_unparse (alias), exprNode_unparse (err)), exprNode_isDefined (f) ? f->loc : g_currentloc); } } cstring_free (sname); } } else { if (context_maybeSet (FLG_MUSTMOD)) { (void) sRef_canModifyVal (s, context_modList ()); } } return result; } void exprNode_checkCallModifyVal (sRef s, exprNodeList args, exprNode f, exprNode err) { s = sRef_fixBaseParam (s, args); DPRINTF (("Check call modify: %s", sRef_unparse (s))); sRef_aliasCheckPred (checkCallModifyAux, NULL, s, f, err); } void exprChecks_checkExport (uentry e) { if (context_checkExport (e)) { fileloc fl = uentry_whereDeclared (e); if (fileloc_isHeader (fl) && !fileloc_isLib (fl) && !fileloc_isImport (fl) && !uentry_isStatic (e)) { if (uentry_isFunction (e) || (uentry_isVariable (e) && ctype_isFunction (uentry_getType (e)))) { voptgenerror (FLG_EXPORTFCN, message ("Function exported, but not specified: %q", uentry_getName (e)), fl); } else if (uentry_isExpandedMacro (e)) { voptgenerror (FLG_EXPORTMACRO, message ("Expanded macro exported, but not specified: %q", uentry_getName (e)), fl); } else if (uentry_isVariable (e) && !uentry_isParam (e)) { voptgenerror (FLG_EXPORTVAR, message ("Variable exported, but not specified: %q", uentry_getName (e)), fl); } else if (uentry_isEitherConstant (e)) { voptgenerror (FLG_EXPORTCONST, message ("Constant exported, but not specified: %q", uentry_getName (e)), fl); } else if (uentry_isIter (e) || uentry_isEndIter (e)) { voptgenerror (FLG_EXPORTITER, message ("Iterator exported, but not specified: %q", uentry_getName (e)), fl); } else if (uentry_isDatatype (e)) { ; /* error already reported */ } else { BADEXIT; } } } } static void checkSafeReturnExpr (/*@notnull@*/ exprNode e) { ctype tr = ctype_getReturnType (context_currentFunctionType ()); ctype te = exprNode_getType (e); /* evans 2001-08-21: added test to warn about void returns from void functions */ if (ctype_isVoid (tr)) { (void) gentypeerror (te, e, tr, exprNode_undefined, message ("Return expression from function declared void: %s", exprNode_unparse (e)), e->loc); return; } if (!ctype_forceMatch (tr, te) && !exprNode_matchLiteral (tr, e)) { (void) gentypeerror (te, e, tr, exprNode_undefined, message ("Return value type %t does not match declared type %t: %s", te, tr, exprNode_unparse (e)), e->loc); } else { sRef ret = e->sref; uentry rval = context_getHeader (); sRef resultref = uentry_getSref (rval); DPRINTF (("Check return: %s / %s / %s", exprNode_unparse (e), sRef_unparseFull (e->sref), uentry_unparse (rval))); transferChecks_return (e, rval); DPRINTF (("After return: %s / %s / %s", exprNode_unparse (e), sRef_unparseFull (e->sref), uentry_unparse (rval))); if (!(sRef_isExposed (uentry_getSref (context_getHeader ())) || sRef_isObserver (uentry_getSref (context_getHeader ()))) && (context_getFlag (FLG_RETALIAS) || context_getFlag (FLG_RETEXPOSE))) { sRef base = sRef_getRootBase (ret); ctype rtype = e->typ; if (ctype_isUnknown (rtype)) { rtype = tr; } if (ctype_isVisiblySharable (rtype)) { if (context_getFlag (FLG_RETALIAS)) { sRef_aliasCheckPred (checkRefGlobParam, NULL, base, e, exprNode_undefined); } if (context_getFlag (FLG_RETEXPOSE) && sRef_isIReference (ret) && !sRef_isExposed (resultref) && !sRef_isObserver (resultref)) { sRef_aliasCheckPred (checkRepExposed, NULL, base, e, exprNode_undefined); } } } } } splint-3.1.2.dfsg1/src/llmain.c0000644021234200000250000010111310052457403013647 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** llmain.c ** ** Main module for Splint annotation-assisted program checker */ # include # include /* ** Ensure that WIN32 and _WIN32 are both defined or both undefined. */ # ifdef WIN32 # ifndef _WIN32 # error "Inconsistent definitions." # endif # else # ifdef _WIN32 # error "Inconsistent definitions." # endif # endif # ifdef WIN32 # include # include # endif # include "splintMacros.nf" # include "basic.h" # include "osd.h" # include "help.h" # include "gram.h" # include "lclscan.h" # include "scanline.h" # include "lclscanline.h" # include "lclsyntable.h" # include "lcltokentable.h" # include "lslparse.h" # include "scan.h" # include "syntable.h" # include "tokentable.h" # include "lslinit.h" # include "lclinit.h" # include "lh.h" # include "imports.h" # include "Headers/version.h" /* Visual C++ finds the wrong version.h */ # include "lcllib.h" # include "cgrammar.h" # include "rcfiles.h" # include "llmain.h" extern /*@external@*/ int yydebug; static void cleanupFiles (void); /* ** evans 2002-07-03: renamed from interrupt to avoid conflict with WATCOM compiler keyword ** (Suggested by Adam Clarke) */ static void llinterrupt (int p_i); static void describeVars (void); static bool specialFlagsHelp (char *p_next); static bool hasShownHerald = FALSE; static char *specFullName (char *p_specfile, /*@out@*/ char **p_inpath) /*@modifies *p_inpath@*/ ; static bool anylcl = FALSE; static clock_t inittime; static fileIdList preprocessFiles (fileIdList, bool) /*@modifies fileSystem@*/ ; static void warnSysFiles(fileIdList p_files) /*@modifies fileSystem@*/; static void lslCleanup (void) /*@globals killed g_symtab@*/ /*@modifies internalState, g_symtab@*/ { /* ** Cleanup all the LCL/LSL. */ static bool didCleanup = FALSE; llassert (!didCleanup); llassert (anylcl); didCleanup = TRUE; lsymbol_destroyMod (); LCLSynTableCleanup (); LCLTokenTableCleanup (); LCLScanLineCleanup (); LCLScanCleanup (); /* clean up LSL parsing */ lsynTableCleanup (); ltokenTableCleanup (); lscanLineCleanup (); LSLScanCleanup (); symtable_free (g_symtab); sort_destroyMod (); } static void lslProcess (fileIdList lclfiles) /*@globals undef g_currentSpec, undef g_currentSpecName, g_currentloc, undef killed g_symtab; @*/ /*@modifies g_currentSpec, g_currentSpecName, g_currentloc, internalState, fileSystem; @*/ { char *path = NULL; bool parser_status = FALSE; bool overallStatus = FALSE; lslinit_process (); inittime = clock (); context_resetSpecLines (); fileIdList_elements (lclfiles, fid) { cstring actualName = cstring_undefined; cstring fname = fileTable_fileName (fid); if (osd_getPath (cstring_fromChars (g_localSpecPath), fname, &actualName) == OSD_FILENOTFOUND) { if (mstring_equal (g_localSpecPath, ".")) { lldiagmsg (message ("Spec file not found: %q", osd_outputPath (fname))); } else { lldiagmsg (message ("Spec file not found: %q (on %s)", osd_outputPath (fname), cstring_fromChars (g_localSpecPath))); } } else { inputStream specFile; /*@access cstring@*/ char *namePtr = actualName; while (*namePtr == '.' && *(namePtr + 1) == CONNECTCHAR) { namePtr += 2; } /*@noaccess cstring@*/ g_currentSpec = cstring_fromCharsNew (namePtr); specFile = inputStream_create (cstring_copy (g_currentSpec), LCL_EXTENSION, TRUE); llassert (inputStream_isDefined (specFile)); g_currentSpecName = specFullName (cstring_toCharsSafe (g_currentSpec), &path); setSpecFileId (fid); displayScan (message ("reading spec %s", g_currentSpec)); /* Open the source file */ if (!inputStream_open (specFile)) { lldiagmsg (message ("Cannot open file: %q", osd_outputPath (inputStream_fileName (specFile)))); inputStream_free (specFile); } else { scopeInfo dummy_scope = (scopeInfo) dmalloc (sizeof (*dummy_scope)); dummy_scope->kind = SPE_INVALID; lhInit (specFile); LCLScanReset (specFile); /* ** Minor hacks to allow more than one LCL file to ** be scanned, while keeping initializations */ symtable_enterScope (g_symtab, dummy_scope); resetImports (cstring_fromChars (g_currentSpecName)); context_enterLCLfile (); (void) lclHadNewError (); parser_status = (ylparse () != 0); context_exitLCLfile (); lhCleanup (); overallStatus = parser_status || lclHadNewError (); if (context_getFlag (FLG_DOLCS)) { if (overallStatus) { outputLCSFile (path, "%FAILED Output from ", g_currentSpecName); } else { outputLCSFile (path, "%PASSED Output from ", g_currentSpecName); } } (void) inputStream_close (specFile); inputStream_free (specFile); symtable_exitScope (g_symtab); } } cstring_free (actualName); } end_fileIdList_elements; /* Can cleanup lsl stuff right away */ lslCleanup (); g_currentSpec = cstring_undefined; g_currentSpecName = NULL; } static void handlePassThroughFlag (char *arg) { char *curarg = arg; char *quotechar = strchr (curarg, '\"'); int offset = 0; bool open = FALSE; char *freearg = NULL; while (quotechar != NULL) { if (*(quotechar - 1) == '\\') { char *tp = quotechar - 2; bool escape = TRUE; while (*tp == '\\') { escape = !escape; tp--; } if (escape) { curarg = quotechar + 1; quotechar = strchr (curarg, '\"'); continue; } } llassert (quotechar != NULL); *quotechar = '\0'; offset = (quotechar - arg) + 2; if (open) { arg = cstring_toCharsSafe (message ("%s\"\'%s", cstring_fromChars (arg), cstring_fromChars (quotechar + 1))); freearg = arg; open = FALSE; } else { arg = cstring_toCharsSafe (message ("%s\'\"%s", cstring_fromChars (arg), cstring_fromChars (quotechar + 1))); freearg = arg; open = TRUE; } curarg = arg + offset; quotechar = strchr (curarg, '\"'); } if (open) { showHerald (); voptgenerror (FLG_BADFLAG, message ("Unclosed quote in flag: %s", cstring_fromChars (arg)), g_currentloc); } else { if (arg[0] == 'D') { cstring def; /* ** If the value is surrounded by single quotes ('), remove ** them. This is an artifact of UNIX command line? */ def = osd_fixDefine (cstring_fromChars (arg + 1)); DPRINTF (("Do define: %s", def)); cppDoDefine (def); DPRINTF (("After define")); cstring_free (def); } else if (arg[0] == 'U') { cppDoUndefine (cstring_fromChars (arg + 1)); } else { BADBRANCH; } } sfree (freearg); } void showHerald (void) { if (hasShownHerald || context_getFlag (FLG_QUIET)) { return; } else { fprintf (g_messagestream, "%s\n\n", SPLINT_VERSION); hasShownHerald = TRUE; llflush (); } } /* ** Disable MSVC++ warning about return value. Methinks humbly splint control ** comments are a mite more legible. */ # ifdef WIN32 # pragma warning (disable:4035) # endif int main (int argc, char *argv[]) /*@globals killed undef g_currentloc, killed g_localSpecPath, killed undef g_currentSpec, killed undef g_currentSpecName, killed undef yyin, undef g_warningstream, g_messagestream, g_errorstream; @*/ /*@modifies g_currentloc, g_localSpecPath, g_currentSpec, g_currentSpecName, fileSystem, yyin; @*/ { bool first_time = TRUE; bool expsuccess; inputStream sourceFile = inputStream_undefined; fileIdList dercfiles; cstringList passThroughArgs = cstringList_undefined; fileIdList cfiles, xfiles, lclfiles, mtfiles; clock_t before, lcltime, libtime, pptime, cptime, rstime; int i = 0; # ifdef __EMX__ _wildcard (&argc, &argv); # endif g_warningstream = stdout; g_messagestream = stderr; g_errorstream = stderr; (void) signal (SIGINT, llinterrupt); (void) signal (SIGSEGV, llinterrupt); flags_initMod (); qual_initMod (); clabstract_initMod (); typeIdSet_initMod (); osd_initMod (); cppReader_initMod (); setCodePoint (); g_currentloc = fileloc_createBuiltin (); before = clock (); context_initMod (); context_setInCommandLine (); if (argc <= 1) { help_showAvailableHelp (); llexit (LLSUCCESS); } /* -help must be the first flag to get help */ if (flagcode_isHelpFlag (flags_identifyFlag (cstring_fromChars (argv[1])))) { /* ** Skip first flag and help flag */ help_processFlags (argc - 2, argv + 2); llexit (LLSUCCESS); } setCodePoint (); yydebug = 0; /* ** Add include directories from environment. */ { cstring incval = cstring_copy (osd_getEnvironmentVariable (INCLUDEPATH_VAR)); cstring oincval = incval; if (cstring_isDefined (incval)) { /* ** Each directory on the include path is a system include directory. */ DPRINTF (("include: %s", incval)); context_setString (FLG_SYSTEMDIRS, cstring_copy (incval)); while (cstring_isDefined (incval)) { /*@access cstring@*/ char *nextsep = strchr (incval, PATH_SEPARATOR); if (nextsep != NULL) { cstring dir; *nextsep = '\0'; dir = cstring_copy (incval); if (cstring_length (dir) == 0 || !isalpha ((int) cstring_firstChar (dir))) { /* ** win32 environment values can have special values, ** ignore them */ } else { cppAddIncludeDir (dir); } *nextsep = PATH_SEPARATOR; incval = cstring_fromChars (nextsep + 1); cstring_free (dir); } else { break; } /*@noaccess cstring@*/ } } else /* 2001-09-09: herbert */ { /* Put C_INCLUDE_PATH directories in sysdirs */ cstring cincval = osd_getEnvironmentVariable (cstring_makeLiteralTemp ("C_INCLUDE_PATH")); if (cstring_isDefined (cincval)) { context_setString (FLG_SYSTEMDIRS, cstring_copy (cincval)); } } /* /herbert */ cstring_free (oincval); } /* ** check RCFILE for default flags */ /* ** Process command line message formatting flags before reading rc file */ { cstring home = osd_getHomeDir (); cstring fname = cstring_undefined; bool defaultf = TRUE; bool nof = FALSE; for (i = 1; i < argc; i++) { char *thisarg; thisarg = argv[i]; if (*thisarg == '-' || *thisarg == '+') { bool set = (*thisarg == '+'); flagcode opt; thisarg++; /* ** Don't report warnings this time */ opt = flags_identifyFlagQuiet (cstring_fromChars (thisarg)); if (opt == FLG_NOF) { nof = TRUE; } else if (flagcode_isMessageControlFlag (opt)) { /* ** Need to set it immediately, so rc file scan is displayed */ context_userSetFlag (opt, set); if (flagcode_hasArgument (opt)) { llassert (flagcode_hasString (opt)); if (++i < argc) { fname = cstring_fromChars (argv[i]); flags_setStringFlag (opt, fname); } else { voptgenerror (FLG_BADFLAG, message ("Flag %s must be followed by a string", flagcode_unparse (opt)), g_currentloc); } } } else if (opt == FLG_OPTF) { if (++i < argc) { defaultf = FALSE; fname = cstring_fromChars (argv[i]); (void) rcfiles_read (fname, &passThroughArgs, TRUE); } else llfatalerror (cstring_makeLiteral ("Flag f to select options file " "requires an argument")); } else { ; /* wait to process later */ } } } setCodePoint (); if (!nof && defaultf) { /* ** No explicit rc file, first try reading ~/.splintrc */ if (cstring_isUndefined (fname)) { if (!cstring_isEmpty (home)) { bool readhomerc, readaltrc; cstring homename, altname; homename = message ("%s%h%s", home, CONNECTCHAR, cstring_fromChars (RCFILE)); readhomerc = rcfiles_read (homename, &passThroughArgs, FALSE); /* ** Try ~/.splintrc also for historical accuracy */ altname = message ("%s%h%s", home, CONNECTCHAR, cstring_fromChars (ALTRCFILE)); readaltrc = rcfiles_read (altname, &passThroughArgs, FALSE); if (readhomerc && readaltrc) { voptgenerror (FLG_WARNRC, message ("Found both %s and %s files. Using both files, " "but recommend using only %s to avoid confusion.", homename, altname, homename), g_currentloc); } cstring_free (homename); cstring_free (altname); } } /* ** Next, read .splintrc in the current working directory */ { cstring rcname = message ("%s%s",osd_getCurrentDirectory (), cstring_fromChars (RCFILE)); cstring altname = message ("%s%s",osd_getCurrentDirectory (), cstring_fromChars (ALTRCFILE)); bool readrc, readaltrc; readrc = rcfiles_read (rcname, &passThroughArgs, FALSE); readaltrc = rcfiles_read (altname, &passThroughArgs, FALSE); if (readrc && readaltrc) { voptgenerror (FLG_WARNRC, message ("Found both %s and %s files. Using both files, " "but recommend using only %s to avoid confusion.", rcname, altname, rcname), g_currentloc); } cstring_free (rcname); cstring_free (altname); } } } setCodePoint (); llassert (fileloc_isBuiltin (g_currentloc)); cfiles = fileIdList_create (); xfiles = fileIdList_create (); lclfiles = fileIdList_create (); mtfiles = fileIdList_create (); /* argv[0] is the program name, don't pass it to flags_processFlags */ flags_processFlags (TRUE, xfiles, cfiles, lclfiles, mtfiles, &passThroughArgs, argc - 1, argv + 1); showHerald (); if (context_getFlag (FLG_CSV)) { cstring fname = context_getString (FLG_CSV); if (cstring_isDefined (fname)) { if (osd_fileExists (fname) && !context_getFlag (FLG_CSVOVERWRITE)) { lldiagmsg (message ("Specified CSV output file already exists (use +csvoverwrite to automatically overwrite): %s", fname)); } else { g_csvstream = fopen (cstring_toCharsSafe (fname), "w"); DPRINTF (("Creating: %s", fname)); if (g_csvstream == NULL) { lldiagmsg (message ("Cannot open file for CSV output: %s", fname)); } else { displayScan (message ("Starting CSV output file: %s", context_getString (FLG_CSV))); fprintf (g_csvstream, "Warning, Flag Code, Flag Name, Priority, File, Line, Column, Warning Text, Additional Text\n"); } } } } # ifdef DOANNOTS initAnnots (); # endif inittime = clock (); context_resetErrors (); context_clearInCommandLine (); anylcl = !fileIdList_isEmpty (lclfiles); if (context_doMerge ()) { cstring m = context_getMerge (); displayScanOpen (message ("< loading %s ", m)); loadState (m); displayScanClose (); if (!usymtab_existsType (context_getBoolName ())) { usymtab_initBool (); } } else { if (!context_getFlag (FLG_NOLIB) && loadStandardState ()) { ; } else { ctype_initTable (); } /* setup bool type and constants */ usymtab_initBool (); } fileloc_free (g_currentloc); g_currentloc = fileloc_createBuiltin (); /* ** Read metastate files (must happen before loading libraries) */ fileIdList_elements (mtfiles, mtfile) { context_setFileId (mtfile); displayScan (message ("processing %s", fileTable_rootFileName (mtfile))); mtreader_readFile (cstring_copy (fileTable_fileName (mtfile))); } end_fileIdList_elements; libtime = clock (); if (anylcl) { lslProcess (lclfiles); } usymtab_initGlobalMarker (); /* ** pre-processing ** ** call the pre-preprocessor and /lib/cpp to generate appropriate ** files ** */ context_setInCommandLine (); DPRINTF (("Pass through: %s", cstringSList_unparse (passThroughArgs))); cstringList_elements (passThroughArgs, thisarg) { handlePassThroughFlag (cstring_toCharsSafe (thisarg)); } end_cstringList_elements; cstringList_free (passThroughArgs); cleanupMessages (); DPRINTF (("Initializing cpp reader!")); cppReader_initialize (); cppReader_saveDefinitions (); context_clearInCommandLine (); if (!context_getFlag (FLG_NOPP)) { fileIdList tfiles; llflush (); displayScanOpen (cstring_makeLiteral ("preprocessing")); lcltime = clock (); context_setPreprocessing (); dercfiles = preprocessFiles (xfiles, TRUE); tfiles = preprocessFiles (cfiles, FALSE); warnSysFiles(cfiles); dercfiles = fileIdList_append (dercfiles, tfiles); fileIdList_free (tfiles); context_clearPreprocessing (); fileIdList_free (cfiles); displayScanClose (); pptime = clock (); } else { lcltime = clock (); dercfiles = fileIdList_append (cfiles, xfiles); pptime = clock (); } /* ** now, check all the corresponding C files ** ** (for now these are just .c, but after pre-processing ** will be ..c) */ /* Why was this here? It is always a bug... */ # if 0 { # if defined (WIN32) || defined (OS2) && defined (__IBMC__) int nfiles = /*@-unrecog@*/ _fcloseall (); /*@=unrecog@*/ if (nfiles != 0) { llbug (message ("Files unclosed: %d", nfiles)); } # endif } # endif DPRINTF (("Initializing...")); exprNode_initMod (); DPRINTF (("Okay...")); fileIdList_elements (dercfiles, fid) { sourceFile = inputStream_create (cstring_copy (fileTable_fileName (fid)), C_EXTENSION, TRUE); context_setFileId (fid); /* Open source file */ if (inputStream_isUndefined (sourceFile) || (!inputStream_open (sourceFile))) { /* previously, this was ignored ?! */ llbug (message ("Could not open temp file: %s", fileTable_fileName (fid))); } else { yyin = inputStream_getFile (sourceFile); /*< shared <- only */ llassert (yyin != NULL); displayScan (message ("checking %q", osd_outputPath (fileTable_rootFileName (fid)))); /* ** Every time, except the first time, through the loop, ** need to call yyrestart to clean up the parse buffer. */ if (!first_time) { (void) yyrestart (yyin); } else { first_time = FALSE; } DPRINTF (("Entering...")); context_enterFile (); (void) yyparse (); context_exitCFile (); (void) inputStream_close (sourceFile); } inputStream_free (sourceFile); /* evans 2002-07-12: why no warning without this?!! */ } end_fileIdList_elements; fileIdList_free (dercfiles); /* evans 2002-07-12: why no warning without this?!! */ cptime = clock (); /* process any leftover macros */ context_processAllMacros (); /* check everything that was specified was defined */ /* don't check if no c files were processed ? ** is this correct behaviour? */ displayScan (cstring_makeLiteral ("global checks")); cleanupMessages (); if (context_getLinesProcessed () > 0) { usymtab_allDefined (); } if (context_maybeSet (FLG_TOPUNUSED)) { uentry ue = usymtab_lookupSafe (cstring_makeLiteralTemp ("main")); if (uentry_isValid (ue)) { uentry_setUsed (ue, fileloc_observeBuiltin ()); } usymtab_allUsed (); } if (context_maybeSet (FLG_EXPORTLOCAL)) { usymtab_exportLocal (); } if (context_maybeSet (FLG_EXPORTHEADER)) { usymtab_exportHeader (); } if (context_getFlag (FLG_SHOWUSES)) { usymtab_displayAllUses (); } context_checkSuppressCounts (); if (context_doDump ()) { cstring dump = context_getDump (); dumpState (dump); } # ifdef DOANNOTS printAnnots (); # endif cleanupFiles (); if (g_csvstream != NULL) { displayScan (message ("Closing CSV file: %s", context_getString (FLG_CSV))); check (fclose (g_csvstream) == 0); } if (context_getFlag (FLG_SHOWSUMMARY)) { summarizeErrors (); } { bool isQuiet = context_getFlag (FLG_QUIET); cstring specErrors = cstring_undefined; int nspecErrors = lclNumberErrors (); expsuccess = TRUE; if (context_neednl ()) fprintf (g_warningstream, "\n"); if (nspecErrors > 0) { if (nspecErrors == context_getLCLExpect ()) { specErrors = message ("%d spec warning%&, as expected\n ", nspecErrors); } else { if (context_getLCLExpect () > 0) { specErrors = message ("%d spec warning%&, expected %d\n ", nspecErrors, (int) context_getLCLExpect ()); } else { specErrors = message ("%d spec warning%&\n ", nspecErrors); expsuccess = FALSE; } } } else { if (context_getLCLExpect () > 0) { specErrors = message ("No spec warnings, expected %d\n ", (int) context_getLCLExpect ()); expsuccess = FALSE; } } if (context_anyErrors ()) { if (context_numErrors () == context_getExpect ()) { if (!isQuiet) { llmsg (message ("Finished checking --- " "%s%d code warning%&, as expected", specErrors, context_numErrors ())); } } else { if (context_getExpect () > 0) { if (!isQuiet) { llmsg (message ("Finished checking --- " "%s%d code warning%&, expected %d", specErrors, context_numErrors (), (int) context_getExpect ())); } expsuccess = FALSE; } else { if (!isQuiet) { llmsg (message ("Finished checking --- " "%s%d code warning%&", specErrors, context_numErrors ())); } expsuccess = FALSE; } } } else { if (context_getExpect () > 0) { if (!isQuiet) { llmsg (message ("Finished checking --- " "%sno code warnings, expected %d", specErrors, (int) context_getExpect ())); } expsuccess = FALSE; } else { if (context_getLinesProcessed () > 0) { if (cstring_isEmpty (specErrors)) { if (!isQuiet) { llmsg (message ("Finished checking --- no warnings")); } } else { if (!isQuiet) { llmsg (message ("Finished checking --- %sno code warnings", specErrors)); } } } else { if (!isQuiet) { llmsg (message ("Finished checking --- %sno code processed", specErrors)); } } } } cstring_free (specErrors); if (context_numBugs () > 0) { expsuccess = FALSE; if (!isQuiet) { llmsg (message (" %d internal bugs reported", context_numBugs ())); } } } if (context_getFlag (FLG_STATS)) { clock_t ttime = clock () - before; int specLines = context_getSpecLinesProcessed (); cstring specmsg = cstring_undefined; rstime = clock (); if (specLines > 0) { specmsg = message ("%d spec, ", specLines); } /* The clock might wrap around, not platform-independent easy way to deal with this... */ if (ttime > 0) { # ifndef CLOCKS_PER_SEC lldiagmsg (message ("%s%d source lines in %d time steps (steps/sec unknown)\n", specmsg, context_getLinesProcessed (), (int) ttime)); # else lldiagmsg (message ("%s%d source lines in %f s.\n", specmsg, context_getLinesProcessed (), (double) ttime / CLOCKS_PER_SEC)); DPRINTF (("Time: %ld [%ld - %ld]", ttime, rstime, before)); # endif } else { lldiagmsg (message ("%s%d source lines\n", specmsg, context_getLinesProcessed ())); } } else { rstime = clock (); } if (context_getFlag (FLG_TIMEDIST)) { clock_t ttime = clock () - before; if (ttime > 0) { char *msg = (char *) dmalloc (256 * sizeof (*msg)); if (anylcl) { /* Gack: really should figure out how to make configure find snprintf... */ # ifdef WIN32 (void) _snprintf (msg, 256, # else (void) snprintf (msg, 256, # endif "Time distribution (percent): initialize %.2f / lcl %.2f / " "pre-process %.2f / c check %.2f / finalize %.2f \n", (100.0 * (double) (libtime - before) / ttime), (100.0 * (double) (lcltime - libtime) / ttime), (100.0 * (double) (pptime - lcltime) / ttime), (100.0 * (double) (cptime - pptime) / ttime), (100.0 * (double) (rstime - cptime) / ttime)); } else { # ifdef WIN32 (void) _snprintf (msg, 256, # else (void) snprintf (msg, 256, # endif "Time distribution (percent): initialize %.2f / " "pre-process %.2f / c check %.2f / finalize %.2f \n", (100.0 * (double) (libtime - before) / ttime), (100.0 * (double) (pptime - libtime) / ttime), (100.0 * (double) (cptime - pptime) / ttime), (100.0 * (double) (rstime - cptime) / ttime)); } llgenindentmsgnoloc (cstring_fromCharsO (msg)); } } llexit (expsuccess ? LLSUCCESS : LLFAILURE); BADBRANCHRET (LLFAILURE); } # ifdef WIN32 /* ** Reenable return value warnings. */ # pragma warning (default:4035) # endif void llinterrupt (int i) { switch (i) { case SIGINT: fprintf (g_errorstream, "*** Interrupt\n"); llexit (LLINTERRUPT); case SIGSEGV: { cstring loc; /* Cheat when there are parse errors */ checkParseError (); fprintf (g_errorstream, "*** Segmentation Violation\n"); /* Don't catch it if fileloc_unparse causes a signal */ (void) signal (SIGSEGV, NULL); loc = fileloc_unparse (g_currentloc); fprintf (g_errorstream, "*** Location (not trusted): %s\n", cstring_toCharsSafe (loc)); cstring_free (loc); printCodePoint (); fprintf (g_errorstream, "*** Please report bug to %s\n*** A useful bug report should include everything we need to reproduce the bug.\n", SPLINT_MAINTAINER); exit (LLGIVEUP); } default: fprintf (g_errorstream, "*** Signal: %d\n", i); /*@-mustfree@*/ fprintf (g_errorstream, "*** Location (not trusted): %s\n", cstring_toCharsSafe (fileloc_unparse (g_currentloc))); /*@=mustfree@*/ printCodePoint (); fprintf (g_errorstream, "*** Please report bug to %s\n*** A useful bug report should include everything we need to reproduce the bug.", SPLINT_MAINTAINER); exit (LLGIVEUP); } } void cleanupFiles (void) { static bool doneCleanup = FALSE; /* make sure this is only called once! */ if (doneCleanup) return; setCodePoint (); /* ** Close all open files ** (There should only be open files, if we exited after a fatal error.) */ fileTable_closeAll (context_fileTable ()); if (context_getFlag (FLG_KEEP)) { check (fputs ("Temporary files kept:\n", g_messagestream) != EOF); fileTable_printTemps (context_fileTable ()); } else { # if defined (WIN32) || defined (OS2) && defined (__IBMC__) int nfiles = /*@-unrecog@*/ _fcloseall (); /*@=unrecog@*/ if (nfiles != 0) { llbug (message ("Files unclosed: %d", nfiles)); } # endif fileTable_cleanup (context_fileTable ()); } doneCleanup = TRUE; } /* ** cleans up temp files (if necessary) and exits */ /*@noreturn@*/ void llexit (int status) { DPRINTF (("llexit: %d", status)); # if defined (WIN32) || defined (OS2) && defined (__IBMC__) if (status == LLFAILURE) { _fcloseall (); } # endif cleanupFiles (); if (status != LLFAILURE) { usymtab_destroyMod (); /*drl I'm commenting this line out because it is causing Splint to crash when built with 2.95 I'm not sure if this is a compiler bug or if if has to do with bool Any way if we're going to exist the program why do we bother freeing stuff... */ /* context_destroyMod (); */ exprNode_destroyMod (); cppReader_destroyMod (); sRef_destroyMod (); uentry_destroyMod (); typeIdSet_destroyMod (); qual_destroyMod (); osd_destroyMod (); fileloc_destroyMod (); # ifdef USEDMALLOC dmalloc_shutdown (); # endif } exit ((status == LLSUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE); } static fileIdList preprocessFiles (fileIdList fl, bool xhfiles) /*@modifies fileSystem@*/ { bool msg = (context_getFlag (FLG_SHOWSCAN) && fileIdList_size (fl) > 10); int skip = (fileIdList_size (fl) / 5); int filesprocessed = 0; fileIdList dfiles = fileIdList_create (); fileloc_free (g_currentloc); g_currentloc = fileloc_createBuiltin (); fileIdList_elements (fl, fid) { cstring ppfname = fileTable_fileName (fid); if (!(osd_fileIsReadable (ppfname))) { lldiagmsg (message ("Cannot open file: %q", osd_outputPath (ppfname))); ppfname = cstring_undefined; } if (cstring_isDefined (ppfname)) { fileId dfile = fileTable_addCTempFile (context_fileTable (), fid); if (xhfiles) { llassert (fileTable_isXHFile (context_fileTable (), dfile)); } llassert (cstring_isNonEmpty (ppfname)); if (msg) { if ((filesprocessed % skip) == 0) { if (filesprocessed == 0) { displayScanContinue (cstring_makeLiteral (" ")); } else { displayScanContinue (cstring_makeLiteral (".")); } } filesprocessed++; } DPRINTF (("outfile: %s", fileTable_fileName (dfile))); if (cppProcess (ppfname, fileTable_fileName (dfile)) != 0) { llfatalerror (message ("Preprocessing error for file: %s", fileTable_rootFileName (fid))); } fileIdList_add (dfiles, dfile); } } end_fileIdList_elements; return dfiles; } /* This should be in an lclUtils.c file... */ char *specFullName (char *specfile, /*@out@*/ char **inpath) { /* extract the path and the specname associated with the given file */ char *specname = (char *) dmalloc (sizeof (*specname) * (strlen (specfile) + 9)); char *ospecname = specname; char *path = (char *) dmalloc (sizeof (*path) * (strlen (specfile))); size_t size; long int i, j; /* initialized path to empty string or may have accidental garbage */ *path = '\0'; /*@-mayaliasunique@*/ strcpy (specname, specfile); /*@=mayaliasunique@*/ /* trim off pathnames in specfile */ size = strlen (specname); for (i = size_toInt (size) - 1; i >= 0; i--) { if (specname[i] == CONNECTCHAR) { /* strcpy (specname, (char *)specname+i+1); */ for (j = 0; j <= i; j++) /* include '/' */ { path[j] = specname[j]; } path[i + 1] = '\0'; specname += i + 1; break; } } /* ** also remove .lcl file extension, assume it's the last extension ** of the file name */ size = strlen (specname); for (i = size_toInt (size) - 1; i >= 0; i--) { if (specname[i] == '.') { specname[i] = '\0'; break; } } *inpath = path; /* ** If specname no longer points to the original char, ** we need to allocate a new pointer and copy the string. */ if (specname != ospecname) { char *rspecname = (char *) dmalloc (sizeof (*rspecname) * (strlen (specname) + 1)); strcpy (rspecname, specname); /* evs 2000-05-16: Bug: was ospecname! */ sfree (ospecname); return rspecname; } return specname; } void warnSysFiles(fileIdList files) { fileIdList_elements (files, file) { if (fileTable_isSystemFile (context_fileTable (), file) ) { if (!context_getFlag( FLG_SYSTEMDIRERRORS ) ) { voptgenerror (FLG_WARNSYSFILES, message ("Warning %s is a considered a system file. No errors in this file will be reported.", fileTable_rootFileName (file) ), g_currentloc); } } } end_fileIdList_elements; } splint-3.1.2.dfsg1/src/help.c0000644021234200000250000005141410102766473013341 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** help.c */ # include "splintMacros.nf" # include "basic.h" # include "help.h" # include "osd.h" # include "llmain.h" # include "version.h" static void describeVars (void) { cstring eval; cstring def; eval = context_getLarchPath (); def = osd_getEnvironmentVariable (LARCH_PATH); if (cstring_isDefined (def) || !cstring_equal (eval, cstring_fromChars (DEFAULT_LARCHPATH))) { llmsg (message ("LARCH_PATH = %s", eval)); } else { llmsg (message ("LARCH_PATH = (default = %s)", cstring_fromChars (DEFAULT_LARCHPATH))); } llmsglit (" --- path used to find larch initialization files and LSL traits"); eval = context_getLCLImportDir (); def = osd_getEnvironmentVariable (cstring_makeLiteralTemp (LCLIMPORTDIR)); if (cstring_isDefined (def) || !cstring_equal (eval, cstring_fromChars (DEFAULT_LCLIMPORTDIR))) { llmsg (message ("%q = %s", cstring_makeLiteral (LCLIMPORTDIR), eval)); } else { llmsg (message ("%s = ", cstring_makeLiteralTemp (LCLIMPORTDIR), cstring_makeLiteralTemp (DEFAULT_LCLIMPORTDIR))); } llmsglit (" --- directory containing lcl standard library files " "(import with < ... >)");; llmsg (message ("include path = %q (set by environment variable %s and -I flags)", cppReader_getIncludePath (), INCLUDEPATH_VAR)); llmsglit (" --- path used to find #include'd files"); llmsg (message ("systemdirs = %s (set by -systemdirs or environment variable %s)", context_getString (FLG_SYSTEMDIRS), INCLUDEPATH_VAR)); llmsglit (" --- if file is found on this path, it is treated as a system file for error reporting"); } static void printAnnotations (void) { llmsglit ("Annotations"); llmsglit ("-----------"); llmsglit (""); llmsglit ("Annotations are semantic comments that document certain " "assumptions about functions, variables, parameters, and types. "); llmsglit (""); llmsglit ("They may be used to indicate where the representation of a " "user-defined type is hidden, to limit where a global variable may " "be used or modified, to constrain what a function implementation " "may do to its parameters, and to express checked assumptions about " "variables, types, structure fields, function parameters, and " "function results."); llmsglit (""); llmsglit ("Annotations are introduced by \"/*@\". The role of the @ may be " "played by any printable character, selected using -commentchar ."); llmsglit (""); llmsglit ("Consult the User's Guide for descriptions of checking associated with each annotation."); llmsglit (""); llmsglit ("Globals: (in function declarations)"); llmsglit (" /*@globals ,+ @*/"); llmsglit (" globitem is an identifier, internalState or fileSystem"); llmsglit (""); llmsglit ("Modifies: (in function declarations)"); llmsglit (" /*@modifies ,+ @*/"); llmsglit (" moditem is an lvalue"); llmsglit (" /*@modifies nothing @*/"); llmsglit (" /*@*/ (Abbreviation for no globals and modifies nothing.)"); llmsglit (""); llmsglit ("Iterators:"); llmsglit (" /*@iter () @*/ - declare an iterator"); llmsglit (""); llmsglit ("Constants:"); llmsglit (" /*@constant @*/ - declares a constant"); llmsglit (""); llmsglit ("Alternate Types:"); llmsglit (" /*@alt ,+ @*/"); llmsglit (" (e.g., int /*@alt char@*/ is a type matching either int or char)"); llmsglit (""); llmsglit ("Declarator Annotations"); llmsglit (""); llmsglit ("Type Definitions:"); llmsglit (" /*@abstract@*/ - representation is hidden from clients"); llmsglit (" /*@concrete@*/ - representation is visible to clients"); llmsglit (" /*@immutable@*/ - instances of the type cannot change value"); llmsglit (" /*@mutable@*/ - instances of the type can change value"); llmsglit (" /*@refcounted@*/ - reference counted type"); llmsglit (""); llmsglit ("Global Variables:"); llmsglit (" /*@unchecked@*/ - weakest checking for global use"); llmsglit (" /*@checkmod@*/ - check modification by not use of global"); llmsglit (" /*@checked@*/ - check use and modification of global"); llmsglit (" /*@checkedstrict@*/ - check use of global strictly"); llmsglit (""); llmsglit ("Memory Management:"); llmsglit (" /*@dependent@*/ - a reference to externally-owned storage"); llmsglit (" /*@keep@*/ - a parameter that is kept by the called function"); llmsglit (" /*@killref@*/ - a refcounted parameter, killed by the call"); llmsglit (" /*@only@*/ - an unshared reference"); llmsglit (" /*@owned@*/ - owner of storage that may be shared by /*@dependent@*/ references"); llmsglit (" /*@shared@*/ - shared reference that is never deallocated"); llmsglit (" /*@temp@*/ - temporary parameter"); llmsglit (""); llmsglit ("Aliasing:"); llmsglit (" /*@unique@*/ - may not be aliased by any other visible reference"); llmsglit (" /*@returned@*/ - may be aliased by the return value"); llmsglit (""); llmsglit ("Exposure:"); llmsglit (" /*@observer@*/ - reference that cannot be modified"); llmsglit (" /*@exposed@*/ - exposed reference to storage in another object"); llmsglit (""); llmsglit ("Definition State:"); llmsglit (" /*@out@*/ - storage reachable from reference need not be defined"); llmsglit (" /*@in@*/ - all storage reachable from reference must be defined"); llmsglit (" /*@partial@*/ - partially defined, may have undefined fields"); llmsglit (" /*@reldef@*/ - relax definition checking"); llmsglit (""); llmsglit ("Global State: (for globals lists, no /*@, since list is already in /*@\'s)"); llmsglit (" undef - variable is undefined before the call"); llmsglit (" killed - variable is undefined after the call"); llmsglit (""); llmsglit ("Null State:"); llmsglit (" /*@null@*/ - possibly null pointer"); llmsglit (" /*@notnull@*/ - definitely non-null pointer"); llmsglit (" /*@relnull@*/ - relax null checking"); llmsglit (""); llmsglit ("Null Predicates:"); llmsglit (" /*@nullwhentrue@*/ - if result is TRUE, first parameter is NULL"); llmsglit (" /*@falsewhennull@*/ - if result is TRUE, first parameter is not NULL"); llmsglit (""); llmsglit ("Execution:"); llmsglit (" /*@noreturn@*/ - function never returns"); llmsglit (" /*@maynotreturn@*/ - function may or may not return"); llmsglit (" /*@noreturnwhentrue@*/ - function does not return if first parameter is TRUE"); llmsglit (" /*@noreturnwhenfalse@*/ - function does not return if first parameter if FALSE"); llmsglit (" /*@alwaysreturns@*/ - function always returns"); llmsglit (""); llmsglit ("Side-Effects:"); llmsglit (" /*@sef@*/ - corresponding actual parameter has no side effects"); llmsglit (""); llmsglit ("Declaration:"); llmsglit (" /*@unused@*/ - need not be used (no unused errors reported)"); llmsglit (" /*@external@*/ - defined externally (no undefined error reported)"); llmsglit (""); llmsglit ("Case:"); llmsglit (" /*@fallthrough@*/ - fall-through case"); llmsglit (""); llmsglit ("Break:"); llmsglit (" /*@innerbreak@*/ - break is breaking an inner loop or switch"); llmsglit (" /*@loopbreak@*/ - break is breaking a loop"); llmsglit (" /*@switchbreak@*/ - break is breaking a switch"); llmsglit (" /*@innercontinue@*/ - continue is continuing an inner loop"); llmsglit (""); llmsglit ("Unreachable Code:"); llmsglit (" /*@notreached@*/ - statement may be unreachable."); llmsglit (""); llmsglit ("Special Functions:"); llmsglit (" /*@printflike@*/ - check variable arguments like printf"); llmsglit (" /*@scanflike@*/ - check variable arguments like scanf"); } static void printComments (void) { llmsglit ("Control Comments"); llmsglit ("----------------"); llmsglit (""); llmsglit ("Setting Flags"); llmsglit (""); llmsglit ("Most flags (all except those characterized as \"globally-settable only\") can be set locally using control comments. A control comment can set flags locally to override the command line settings. The original flag settings are restored before processing the next file."); llmsglit (""); llmsglit ("The syntax for setting flags in control comments is the same as that of the command line, except that flags may also be preceded by = to restore their setting to the original command-line value. For instance,"); llmsglit (" /*@+boolint -modifies =showfunc@*/"); llmsglit ("sets boolint on (this makes bool and int indistinguishable types), sets modifies off (this prevents reporting of modification errors), and sets showfunc to its original setting (this controls whether or not the name of a function is displayed before a message)."); llmsglit (""); llmsglit ("Error Suppression"); llmsglit (""); llmsglit ("Several comments are provided for suppressing messages. In general, it is usually better to use specific flags to suppress a particular error permanently, but the general error suppression flags may be more convenient for quickly suppressing messages for code that will be corrected or documented later."); llmsglit (""); llmsglit ("/*@ignore@*/ ... /*@end@*/"); llgenindentmsgnoloc (cstring_makeLiteral ("No errors will be reported in code regions between /*@ignore@*/ and /*@end@*/. These comments can be used to easily suppress an unlimited number of messages.")); llmsglit ("/*@i@*/"); llgenindentmsgnoloc (cstring_makeLiteral ("No errors will be reported from an /*@i@*/ comment to the end of the line.")); llmsglit ("/*@i@*/"); llgenindentmsgnoloc (cstring_makeLiteral ("No errors will be reported from an /*@i@*/ (e.g., /*@i3@*/) comment to the end of the line. If there are not exactly n errors suppressed from the comment point to the end of the line, Splint will report an error.")); llmsglit ("/*@t@*/, /*@t@*/"); llgenindentmsgnoloc (cstring_makeLiteral ("Like i and i, except controlled by +tmpcomments flag. These can be used to temporarily suppress certain errors. Then, -tmpcomments can be set to find them again.")); llmsglit (""); llmsglit ("Type Access"); llmsglit (""); llmsglit ("/*@access @*/"); llmsglit (" Allows the following code to access the representation of "); llmsglit ("/*@noaccess @*/"); llmsglit (" Hides the representation of "); llmsglit (""); llmsglit ("Macro Expansion"); llmsglit (""); llmsglit ("/*@notfunction@*/"); llgenindentmsgnoloc (cstring_makeLiteral ("Indicates that the next macro definition is not intended to be a " "function, and should be expanded in line instead of checked as a " "macro function definition.")); } static void printFlags (void) { llmsglit ("Flag Categories"); llmsglit ("---------------"); listAllCategories (); llmsglit ("\nTo see the flags in a flag category, do\n splint -help flags "); llmsglit ("To see a list of all flags in alphabetical order, do\n splint -help flags alpha"); llmsglit ("To see a full description of all flags, do\n splint -help flags full"); } static void printMaintainer (void) { llmsg (message ("Maintainer: %s", cstring_makeLiteralTemp (SPLINT_MAINTAINER))); llmsglit (LCL_COMPILE); } static void printMail (void) { llmsglit ("Mailing Lists"); llmsglit ("-------------"); llmsglit (""); llmsglit ("There are two mailing lists associated with Splint: "); llmsglit (""); llmsglit (" splint-announce@cs.virginia.edu"); llmsglit (""); llmsglit (" Reserved for announcements of new releases and bug fixes."); llmsglit (""); llmsglit (" splint-discuss@virginia.edu"); llmsglit (""); llmsglit (" Informal discussions on the use and development of Splint."); llmsglit (""); llmsglit ("To subscribe or view archives, visit http://www.splint.org/lists.html"); } static void printReferences (void) { llmsglit ("References"); llmsglit ("----------"); llmsglit (""); llmsglit ("For more information, see the Splint web site: http://www.splint.org"); } static void describePrefixCodes (void) { llmsglit ("Prefix Codes"); llmsglit ("------------"); llmsglit (""); llmsglit ("These characters have special meaning in name prefixes:"); llmsglit (""); llmsg (message (" %h Any uppercase letter [A-Z]", PFX_UPPERCASE)); llmsg (message (" %h Any lowercase letter [a-z]", PFX_LOWERCASE)); llmsg (message (" %h Any character (valid in a C identifier)", PFX_ANY)); llmsg (message (" %h Any digit [0-9]", PFX_DIGIT)); llmsg (message (" %h Any non-uppercase letter [a-z0-9_]", PFX_NOTUPPER)); llmsg (message (" %h Any non-lowercase letter [A-Z0-9_]", PFX_NOTLOWER)); llmsg (message (" %h Any letter [A-Za-z]", PFX_ANYLETTER)); llmsg (message (" %h Any letter or digit [A-Za-z0-9]", PFX_ANYLETTERDIGIT)); llmsglit (" * Zero or more repetitions of the previous character class until the end of the name"); } void help_showAvailableHelp (void) { showHerald (); llmsg (message ("Source files are .c, .h and %s files. If there is no suffix,", LCL_EXTENSION)); llmsg (message (" Splint will look for .c and %s.", LCL_EXTENSION)); llmsglit (""); llmsglit ("Use splint -help for more information"); llmsglit (""); llmsglit ("Topics:"); llmsglit (""); llmsglit (" annotations (describes source-code annotations)"); llmsglit (" comments (describes control comments)"); llmsglit (" flags (describes flag categories)"); llmsglit (" flags (describes flags in category)"); llmsglit (" flags all (short description of all flags)"); llmsglit (" flags alpha (list all flags alphabetically)"); llmsglit (" flags full (full description of all flags)"); llmsglit (" mail (information on mailing lists)"); llmsglit (" modes (show mode settings)"); llmsglit (" parseerrors (help on handling parser errors)"); llmsglit (" prefixcodes (character codes in namespace prefixes)"); llmsglit (" references (sources for more information)"); llmsglit (" vars (environment variables)"); llmsglit (" version (information on compilation, maintainer)"); llmsglit (""); } static bool specialFlagsHelp (char *next) { if ((next != NULL) && (*next != '-') && (*next != '+')) { if (mstring_equal (next, "alpha")) { printAlphaFlags (); return TRUE; } else if (mstring_equal (next, "all")) { printAllFlags (TRUE, FALSE); return TRUE; } else if (mstring_equal (next, "categories") || mstring_equal (next, "cats")) { listAllCategories (); return TRUE; } else if (mstring_equal (next, "full")) { printAllFlags (FALSE, TRUE); return TRUE; } else if (mstring_equal (next, "manual")) { printFlagManual (FALSE); return TRUE; } else if (mstring_equal (next, "webmanual")) { printFlagManual (TRUE); return TRUE; } else { return FALSE; } } else { return FALSE; } } static void printParseErrors (void) { llmsglit ("Parse Errors"); llmsglit ("------------"); llmsglit (""); llmsglit ("Splint will sometimes encounter a parse error for code that " "can be parsed with a local compiler. There are a few likely " "causes for this and a number of techniques that can be used " "to work around the problem."); llmsglit (""); llmsglit ("Compiler extensions --- compilers sometimes extend the C " "language with compiler-specific keywords and syntax. While " "it is not advisible to use these, oftentimes one has no choice " "when the system header files use compiler extensions. "); llmsglit (""); llmsglit ("Splint supports some of the GNU (gcc) compiler extensions, " "if the +gnuextensions flag is set. You may be able to workaround " "other compiler extensions by using a pre-processor define. " "Alternately, you can surround the unparseable code with"); llmsglit (""); llmsglit (" # ifndef S_SPLINT_S"); llmsglit (" ..."); llmsglit (" # endif"); llmsglit (""); /* evans 2000-12-21 fixed typo reported by Jeroen Ruigrok/Asmodai */ llmsglit ("Missing type definitions --- an undefined type name will usually " "lead to a parse error. This often occurs when a standard header " "file defines some type that is not part of the standard library. "); llmsglit ("By default, Splint does not process the local files corresponding " "to standard library headers, but uses a library specification " "instead so dependencies on local system headers can be detected. " "If another system header file that does not correspond to a " "standard library header uses one of these superfluous types, " "a parse error will result."); llmsglit (""); llmsglit ("If the parse error is inside a posix standard header file, the " "first thing to try is +posixlib. This makes Splint use " "the posix library specification instead of reading the posix " "header files."); llmsglit (""); llmsglit ("Otherwise, you may need to either manually define the problematic " "type (e.g., add -Dmlink_t=int to your .splintrc file) or force " "splint to process the header file that defines it. This is done " "by setting -skipisoheaders or -skipposixheaders before " "the file that defines the type is #include'd."); llmsglit ("(See splint -help " "skipisoheaders and splint -help skipposixheaders for a list of " "standard headers.) For example, if uses a type " "defined by posix header but not defined by the " "posix library, we might do: "); llmsglit (""); llmsglit (" /*@-skipposixheaders@*/"); llmsglit (" # include "); llmsglit (" /*@=skipposixheaders@*/"); llmsglit (" # include "); llmsglit (""); llmsglit ("to force Splint to process ."); llmsglit (""); llmsglit ("At last resort, +trytorecover can be used to make Splint attempt " "to continue after a parse error. This is usually not successful " "and the author does not consider assertion failures when +trytorecover " "is used to be bugs."); } void help_processFlags (int argc, char **argv) { int i; showHerald (); if (argc == 0) { help_showAvailableHelp (); } for (i = 0; i < argc; i++) { char *thisarg = argv[i]; if (*thisarg == '-' || *thisarg == '+') { thisarg++; /* skip '-' */ } if (mstring_equal (thisarg, "modes")) { llmsg (describeModes ()); } else if (mstring_equal (thisarg, "vars") || mstring_equal (thisarg, "env")) { describeVars (); } else if (mstring_equal (thisarg, "annotations")) { printAnnotations (); } else if (mstring_equal (thisarg, "parseerrors")) { printParseErrors (); } else if (mstring_equal (thisarg, "comments")) { printComments (); } else if (mstring_equal (thisarg, "prefixcodes")) { describePrefixCodes (); } else if (mstring_equal (thisarg, "references") || mstring_equal (thisarg, "refs")) { printReferences (); } else if (mstring_equal (thisarg, "mail")) { printMail (); } else if (mstring_equal (thisarg, "maintainer") || mstring_equal (thisarg, "version")) { printMaintainer (); } else if (flags_isModeName (cstring_fromChars (thisarg))) { llmsg (describeMode (cstring_fromChars (thisarg))); } else if (mstring_equal (thisarg, "flags")) { if (i + 1 < argc) { char *next = argv[i + 1]; if (specialFlagsHelp (next)) { i++; } else { flagkind k = identifyCategory (cstring_fromChars (next)); if (k != FK_NONE) { printCategory (k); i++; } } } else { printFlags (); } } else { cstring s = describeFlag (cstring_fromChars (thisarg)); if (cstring_isDefined (s)) { llmsg (s); } } } } splint-3.1.2.dfsg1/src/rcfiles.c0000644021234200000250000001074707646432516014053 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** rcfiles.c */ # include "splintMacros.nf" # include "basic.h" # include "rcfiles.h" static void rcfiles_loadFile (FILE *p_rcfile, cstringList *p_passThroughArgs) /*@modifies *p_passThroughArgs, p_rcfile@*/ /*@ensures closed p_rcfile@*/ ; bool rcfiles_read (cstring fname, cstringList *passThroughArgs, bool report) { bool res = FALSE; if (fileTable_exists (context_fileTable (), fname)) { if (report) { voptgenerror (FLG_WARNRC, message ("Multiple attempts to read options file: %s", fname), g_currentloc); } } else { FILE *innerf = fileTable_openReadFile (context_fileTable (), fname); if (innerf != NULL) { fileloc fc = g_currentloc; g_currentloc = fileloc_createRc (fname); displayScan (message ("reading options from %q", fileloc_outputFilename (g_currentloc))); rcfiles_loadFile (innerf, passThroughArgs); fileloc_reallyFree (g_currentloc); g_currentloc = fc; res = TRUE; } else { if (report) { voptgenerror (FLG_WARNRC, message ("Cannot open options file: %s", fname), g_currentloc); } } } return res; } static void rcfiles_loadFile (/*:open:*/ FILE *rcfile, cstringList *passThroughArgs) /*@modifies rcfile@*/ /*@ensures closed rcfile@*/ { char *s = mstring_create (MAX_LINE_LENGTH); char *os = s; cstringList args = cstringList_new (); DPRINTF (("Loading rc file...")); s = os; while (reader_readLine (rcfile, s, MAX_LINE_LENGTH) != NULL) { char c; DPRINTF (("Line: %s", s)); DPRINTF (("args: %s", cstringList_unparse (args))); while (*s == ' ' || *s == '\t') { s++; incColumn (); } while (*s != '\0') { char *thisflag; bool escaped = FALSE; bool quoted = FALSE; c = *s; /* comment characters */ if (c == '#' || c == ';' || c == '\n') { /*@innerbreak@*/ break; } thisflag = s; while ((c = *s) != '\0') { /* remember to handle spaces and quotes in -D and -U ... */ if (escaped) { escaped = FALSE; } else if (quoted) { if (c == '\\') { escaped = TRUE; } else if (c == '\"') { quoted = FALSE; } else { ; } } else if (c == '\"') { quoted = TRUE; } else { if (c == ' ' || c == '\t' || c == '\n') { /*@innerbreak@*/ break; } } s++; incColumn (); } DPRINTF (("Nulling: %c", *s)); *s = '\0'; if (mstring_isEmpty (thisflag)) { llfatalerror (message ("Missing flag: %s", cstring_fromChars (os))); } else { args = cstringList_add (args, cstring_fromCharsNew (thisflag)); DPRINTF (("args: %s", cstringList_unparse (args))); } *s = c; DPRINTF (("Pass through: %s", cstringList_unparse (*passThroughArgs))); while ((c == ' ') || (c == '\t')) { c = *(++s); incColumn (); } } s = os; } sfree (os); DPRINTF (("args: %s", cstringList_unparse (args))); flags_processFlags (FALSE, fileIdList_undefined, fileIdList_undefined, fileIdList_undefined, fileIdList_undefined, passThroughArgs, cstringList_size (args), /*@-nullstate@*/ /*@-type@*/ /* exposes cstring type */ cstringList_getElements (args) /*@=nullstate@*/ /*@=type@*/ ); cstringList_free (args); check (fileTable_closeFile (context_fileTable (), rcfile)); } splint-3.1.2.dfsg1/src/constraintList.c0000644021234200000250000003576007671271603015442 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2000 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** constraintList.c ** ** based on list_template.c ** ** where T has T_equal (or change this) and T_unparse */ # include "splintMacros.nf" # include "basic.h" /*@iter constraintList_elements_private_only (sef constraintList x, yield only constraint el); @*/ # define constraintList_elements_private_only(x, m_el) \ { if (constraintList_isDefined (x)) { int m_ind; constraint *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { constraint m_el = *(m_elements++); # define end_constraintList_elements_private_only }}} /*@iter constraintList_elements_private (sef constraintList x, yield constraint el); @*/ # define constraintList_elements_private(x, m_el) \ { if (constraintList_isDefined (x)) { int m_ind; constraint *m_elements = &((x)->elements[0]); \ for (m_ind = 0 ; m_ind < (x)->nelements; m_ind++) \ { constraint m_el = *(m_elements++); # define end_constraintList_elements_private }}} /*@only@*/ constraintList constraintList_makeNew () { constraintList s = (constraintList) dmalloc (sizeof (*s)); s->nelements = 0; s->nspace = constraintListBASESIZE; s->elements = (constraint *) dmalloc (sizeof (*s->elements) * constraintListBASESIZE); return (s); } static void constraintList_grow (constraintList s) { int i; constraint *newelements; llassert (constraintList_isDefined (s)); s->nspace += constraintListBASESIZE; newelements = (constraint *) dmalloc (sizeof (*newelements) * (s->nelements + s->nspace)); for (i = 0; i < s->nelements; i++) { newelements[i] = s->elements[i]; } sfree (s->elements); s->elements = newelements; } constraintList constraintList_add (/*@returned@*/ constraintList s, /*@only@*/ constraint el) { llassert (constraintList_isDefined (s)); /*drl7x */ if (constraintList_resolve (el, s)) { DPRINTF (("Resolved constraint: %s", constraint_unparse (el))); constraint_free (el); return s; } DPRINTF (("Adding constraint: %s", constraint_unparse (el))); if (s->nspace <= 0) constraintList_grow (s); s->nspace--; s->elements[s->nelements] = el; s->nelements++; return s; } /* frees everything but actual constraints */ /* This function should only be used if you have other references to unshared constraints */ static void constraintList_freeShallow (/*@only@*/ constraintList c) { if (constraintList_isDefined(c) ) { free (c->elements); c->elements = NULL; c->nelements = -1; c->nspace = -1; } free (c); c = NULL; } /*@only@*/ constraintList constraintList_addList (/*@only@*/ /*@returned@*/ constraintList s, /*@observer@*/ /*@temp@*/ constraintList newList) { llassert(constraintList_isDefined (s)); llassert(constraintList_isDefined (newList)); if (newList == constraintList_undefined) return s; constraintList_elements (newList, elem) { s = constraintList_add (s, constraint_copy(elem)); } end_constraintList_elements; return s; } constraintList constraintList_addListFree (/*@returned@*/ constraintList s, /*@only@*/ constraintList newList) { if (constraintList_isUndefined (newList)) return s; llassert (constraintList_isDefined (s)); llassert (constraintList_isDefined (newList)); constraintList_elements_private_only(newList, elem) { s = constraintList_add (s, elem); } end_constraintList_elements_private_only; constraintList_freeShallow (newList); return s; } constraintList constraintList_removeSurpressed (/*@only@*/ constraintList s) { constraintList ret; fileloc loc; llassert (constraintList_isDefined (s)); ret = constraintList_makeNew(); constraintList_elements_private_only (s, elem) { loc = constraint_getFileloc(elem); if (fileloc_isUndefined(loc)) { ret = constraintList_add (ret, elem); } else if (context_suppressFlagMsg(FLG_BOUNDSWRITE, loc) ) { DPRINTF ((message ("constraintList_removeSurpressed getting rid of surpressed constraint %q", constraint_unparse(elem)))); constraint_free(elem); } else if (!constraint_hasMaxSet(elem) && context_suppressFlagMsg(FLG_BOUNDSREAD, loc)) { DPRINTF ((message("constraintList_removeSurpressed getting rid of surpressed constraint %q", constraint_unparse(elem)))); constraint_free(elem); } else { ret = constraintList_add (ret, elem); } fileloc_free(loc); } end_constraintList_elements_private_only; constraintList_freeShallow(s); return ret; } # if 0 static /*@only@*/ cstring constraintList_unparseLocation (/*@temp@*/ constraintList s) /*@*/ { int i; cstring st = cstring_undefined; bool first = TRUE; if (!constraintList_isDefined (s)) { return cstring_makeLiteral (""); } if (s->nelements == 0) { st = cstring_makeLiteral(""); return st; } for (i = 0; i < s->nelements; i++) { cstring type = cstring_undefined; constraint current = s->elements[i]; if (constraint_isDefined(current) ) { cstring temp1; temp1 = constraint_unparseLocation(current); type = message ("%q %q\n", type, temp1 ); } if (first) { st = type; first = FALSE; } else { st = message ("%q, %q", st, type); } } return st; } # endif /*@only@*/ cstring constraintList_unparse (/*@temp@*/ constraintList s) /*@*/ { int i; cstring st = cstring_undefined; bool first = TRUE; if (!constraintList_isDefined (s)) { return cstring_makeLiteral (""); } if (s->nelements == 0) { st = cstring_makeLiteral(""); return st; } for (i = 0; i < s->nelements; i++) { cstring type = cstring_undefined; constraint current = s->elements[i]; if (constraint_isDefined(current) ) { cstring temp1; if (context_getFlag (FLG_ORCONSTRAINT)) { temp1 = constraint_unparseOr (current); } else { temp1 = constraint_unparse (current); } type = message ("%q %q\n", type, temp1 ); } if (first) { st = type; first = FALSE; } else { st = message ("%q, %q", st, type); } } return st; } void constraintList_printErrorPostConditions (constraintList s, fileloc loc) { constraintList_elements (s, elem) { if (constraint_isDefined(elem)) { constraint_printErrorPostCondition (elem, loc); } } end_constraintList_elements; return; } void constraintList_printError (constraintList s, fileloc loc) { constraintList_elements (s, elem) { if (constraint_isDefined(elem) ) { if (constraint_isPost(elem) ) constraint_printErrorPostCondition (elem, loc); else constraint_printError (elem, loc); } } end_constraintList_elements; return; } cstring constraintList_unparseDetailed (constraintList s) { int i; cstring st = cstring_undefined; bool first = TRUE; if (!constraintList_isDefined (s)) { return cstring_makeLiteral (""); } if (s->nelements == 0) { st = cstring_makeLiteral(""); return st; } for (i = 0; i < s->nelements; i++) { cstring type = cstring_undefined; constraint current = s->elements[i]; if (constraint_isDefined(current ) ) { cstring temp1 = constraint_unparseDetailed (current); type = message ("%s %s\n", type, temp1 ); cstring_free(temp1); } if (first) { st = type; first = FALSE; type = NULL; } else { st = message ("%q %q", st, type); } } return st; } /*{ x: constraint | (x in l1 -> resolve (x, l2) || (x in l2 -> resolve (x, l1) } */ constraintList constraintList_logicalOr (/*@observer@*/ constraintList l1, /*@observer@*/ constraintList l2) { constraint temp; constraintList ret; DPRINTF ((message ("Logical or on %s and %s", constraintList_unparse(l1), constraintList_unparse(l2)) ) ); ret = constraintList_makeNew(); constraintList_elements (l1, el) { temp = constraint_substitute (el, l2); if (constraintList_resolve (el, l2) || constraintList_resolve(temp,l2) ) { /*avoid redundant constraints*/ if (!constraintList_resolve (el, ret) ) { constraint temp2; temp2 = constraint_copy(el); ret = constraintList_add (ret, temp2); } } constraint_free(temp); } end_constraintList_elements; constraintList_elements (l2, el) { temp = constraint_substitute (el, l1); if (constraintList_resolve (el, l1) || constraintList_resolve(temp,l1) ) { /*avoid redundant constraints*/ if (!constraintList_resolve (el, ret) ) { constraint temp2; temp2 = constraint_copy(el); ret = constraintList_add (ret, temp2); } } constraint_free(temp); } end_constraintList_elements; return ret; } void constraintList_free (/*@only@*/ constraintList s) { if (constraintList_isDefined (s)) { int i; for (i = 0; i < s->nelements; i++) { constraint_free (s->elements[i]); } sfree (s->elements); s->elements = NULL; s->nelements = -1; s->nspace = -1; sfree (s); s = NULL; } } constraintList constraintList_copy (/*@observer@*/ /*@temp@*/ constraintList s) { constraintList ret = constraintList_makeNew (); constraintList_elements (s, el) { ret = constraintList_add (ret, constraint_copy (el)); } end_constraintList_elements; return ret; } constraintList constraintList_preserveOrig (constraintList c) { DPRINTF((message("constraintList_preserveOrig preserving the originial constraints for %s ", constraintList_unparse (c) ) )); constraintList_elements_private (c, el) { el = constraint_preserveOrig (el); } end_constraintList_elements_private; return c; } constraintList constraintList_preserveCallInfo (/*@returned@*/ constraintList c,/*@observer@*/ /*@dependent@*/ /*@observer@*/ exprNode fcn) { DPRINTF((message("constraintList_preserveCallInfo %s ", constraintList_unparse (c) ) )); constraintList_elements_private (c, el) { el = constraint_setFcnPre(el); el = constraint_origAddGeneratingExpr (el, fcn); } end_constraintList_elements_private; return c; } constraintList constraintList_single (constraint c) { constraintList res; res = constraintList_makeNew(); res = constraintList_add (res, c); return res; } constraintList constraintList_addGeneratingExpr (constraintList c,/*@dependent@*/ exprNode e) { DPRINTF ((message ("entering constraintList_addGeneratingExpr for %s ", exprNode_unparse(e) ) )); constraintList_elements_private (c, el) { DPRINTF ((message ("setting generatingExpr for %s to %s", constraint_unparse(el), exprNode_unparse(e) ) )); el = constraint_addGeneratingExpr (el, e); } end_constraintList_elements_private; return c; } /*@only@*/ constraintList constraintList_doFixResult (/*@only@*/constraintList postconditions, exprNode fcnCall) { constraintList ret; ret = constraintList_makeNew(); constraintList_elements_private (postconditions, el) { ret = constraintList_add (ret, constraint_doFixResult (el, fcnCall) ); } end_constraintList_elements_private; constraintList_free(postconditions); return ret; } /* Commenting out because function is not yet stable / *@only@* / constraintList constraintList_doSRefFixStructConstraint(constraintList invars, sRef s, ctype ct ) { constraintList ret; ret = constraintList_makeNew(); constraintList_elements (invars, el) { ret = constraintList_add(ret, constraint_doSRefFixInvarConstraint (el, s, ct) ); } end_constraintList_elements; / * constraintList_free (invars);* / return ret; } */ /*@only@*/ constraintList constraintList_doSRefFixConstraintParam (constraintList preconditions, /*@temp@*/ /*@observer@*/ exprNodeList arglist) { constraintList ret; ret = constraintList_makeNew(); constraintList_elements (preconditions, el) { ret = constraintList_add(ret, constraint_doSRefFixConstraintParam (el, arglist) ); } end_constraintList_elements; constraintList_free (preconditions); return ret; } constraintList constraintList_doSRefFixBaseParam (constraintList preconditions, /*@observer@*/ exprNodeList arglist) { constraintList ret; constraint temp; ret = constraintList_makeNew(); constraintList_elements (preconditions, el) { temp = constraint_copy(el); ret = constraintList_add(ret, constraint_doSRefFixBaseParam (temp, arglist) ); } end_constraintList_elements; return ret; } constraintList constraintList_togglePost (/*@returned@*/ constraintList c) { constraintList_elements_private (c, el) { el = constraint_togglePost(el); if (constraint_hasOrig(el) ) { el = constraint_togglePostOrig (el); } } end_constraintList_elements_private; return c; } /*@only@*/ constraintList constraintList_undump (FILE *f) { constraintList ret; char *s; char *os; ret = constraintList_makeNew(); os = mstring_create (MAX_DUMP_LINE_LENGTH); s = fgets (os, MAX_DUMP_LINE_LENGTH, f); while (s != NULL && *s != ';') { constraint temp; char * c; c = reader_getWord(&s); if (! mstring_isDefined(c) ) { llfatalbug(message("Library file is corrupted") ); } if (strcmp (c, "C") != 0) { llfatalbug(message("Error reading library. File may be corrupted")); } temp = constraint_undump (f); ret = constraintList_add (ret, temp); s = fgets (os, MAX_DUMP_LINE_LENGTH, f); free(c); } free(s); return ret; } void constraintList_dump (/*@observer@*/ constraintList c, FILE *f) { constraintList_elements (c, el) { fprintf(f, "C\n"); constraint_dump (el, f); } end_constraintList_elements; ; } constraintList constraintList_sort (/*@returned@*/ constraintList ret) { if (constraintList_isUndefined(ret) ) { llassert(FALSE); return ret; } qsort (ret->elements, (size_t) ret->nelements, (sizeof (*ret->elements)), (int (*)(const void *, const void *)) constraint_compare); DPRINTF((message("onstraint_sort returning") )); return ret; } splint-3.1.2.dfsg1/src/constraintResolve.c0000644021234200000250000011520307765024013016130 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* * ** constraintResolve.c */ /* #define DEBUGPRINT 1 */ # include /* for isdigit */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" /*@access constraint, exprNode @*/ /*!!! NO! Don't do this so recklessly - design your code more carefully so you don't need to! */ static constraint inequalitySubstitute (/*@returned@*/ constraint p_c, constraintList p_p); static bool rangeCheck (arithType p_ar1, /*@observer@*/ constraintExpr p_expr1, arithType p_ar2, /*@observer@*/ constraintExpr p_expr2); static constraint inequalitySubstituteUnsound (/*@returned@*/ constraint p_c, constraintList p_p); static constraint inequalitySubstituteStrong (/*@returned@*/ constraint p_c, constraintList p_p); static constraint constraint_searchandreplace (/*@returned@*/ constraint p_c, constraintExpr p_old, constraintExpr p_newExpr); static constraint constraint_addOr (/*@returned@*/ constraint p_orig, /*@observer@*/ constraint p_orConstr); static bool resolveOr (/*@temp@*/constraint p_c, /*@observer@*/ /*@temp@*/ constraintList p_list); static /*@only@*/ constraintList reflectChangesEnsuresFree1 (/*@only@*/ constraintList p_pre2, constraintList p_post1); /*@only@*/ constraintList constraintList_mergeEnsuresFreeFirst (constraintList list1, constraintList list2) { constraintList ret; ret = constraintList_mergeEnsures (list1, list2); constraintList_free(list1); return ret; } /*@only@*/ constraintList constraintList_mergeEnsures (constraintList list1, constraintList list2) { constraintList ret; constraintList temp; llassert(constraintList_isDefined(list1) ); llassert(constraintList_isDefined(list2) ); DPRINTF(( message ("constraintList_mergeEnsures: list1 %s list2 %s", constraintList_unparse(list1), constraintList_unparse(list2) ))); ret = constraintList_fixConflicts (list1, list2); ret = reflectChangesEnsuresFree1 (ret, list2); temp = constraintList_subsumeEnsures (ret, list2); constraintList_free(ret); ret = temp; temp = constraintList_subsumeEnsures (list2, ret); temp = constraintList_addList (temp, ret); constraintList_free(ret); DPRINTF(( message ("constraintList_mergeEnsures: returning %s ", constraintList_unparse(temp) ) )); return temp; } /*@only@*/ constraintList constraintList_mergeRequiresFreeFirst (/*@only@*/ constraintList list1, constraintList list2) { constraintList ret; ret = constraintList_mergeRequires(list1, list2); constraintList_free(list1); return ret; } /*@only@*/ constraintList constraintList_mergeRequires (constraintList list1, constraintList list2) { constraintList ret; constraintList temp; DPRINTF((message ("constraintList_mergeRequires: merging %s and %s ", constraintList_unparse (list1), constraintList_unparse(list2) ) ) ); if (context_getFlag (FLG_REDUNDANTCONSTRAINTS) ) { ret = constraintList_copy(list1); ret = constraintList_addList(ret, list2); return ret; } /* get constraints in list1 not satified by list2 */ temp = constraintList_reflectChanges(list1, list2); DPRINTF((message ("constraintList_mergeRequires: temp = %s", constraintList_unparse(temp) ) ) ); /*get constraints in list2 not satified by temp*/ ret = constraintList_reflectChanges(list2, temp); DPRINTF((message ("constraintList_mergeRequires: ret = %s", constraintList_unparse(ret) ) ) ); ret = constraintList_addListFree (ret, temp); DPRINTF((message ("constraintList_mergeRequires: returning %s", constraintList_unparse(ret) ) ) ); return ret; } /* old name mergeResolve renamed for czech naming convention */ void exprNode_mergeResolve (exprNode parent, exprNode child1, exprNode child2) { constraintList temp, temp2; DPRINTF((message ("magically merging constraint into parent:%s for", exprNode_unparse (parent) )) ); DPRINTF((message (" children: %s and %s", exprNode_unparse (child1), exprNode_unparse(child2) ) ) ); if (exprNode_isUndefined(parent) ) { llassert (exprNode_isDefined(parent) ); return; } if (exprNode_isError (child1) || exprNode_isError(child2) ) { if (exprNode_isError (child1) && !exprNode_isError(child2) ) { constraintList_free(parent->requiresConstraints); parent->requiresConstraints = constraintList_copy (child2->requiresConstraints); constraintList_free(parent->ensuresConstraints); parent->ensuresConstraints = constraintList_copy (child2->ensuresConstraints); DPRINTF((message ("Copied child constraints: pre: %s and post: %s", constraintList_unparse( child2->requiresConstraints), constraintList_unparse (child2->ensuresConstraints) ) )); return; } else { llassert(exprNode_isError(child2) ); return; } } llassert(!exprNode_isError (child1) && ! exprNode_isError(child2) ); DPRINTF((message ("Child constraints are %s %s and %s %s", constraintList_unparse (child1->requiresConstraints), constraintList_unparse (child1->ensuresConstraints), constraintList_unparse (child2->requiresConstraints), constraintList_unparse (child2->ensuresConstraints) ) ) ); constraintList_free(parent->requiresConstraints); parent->requiresConstraints = constraintList_copy (child1->requiresConstraints); if ( context_getFlag (FLG_ORCONSTRAINT) ) temp = constraintList_reflectChangesOr (child2->requiresConstraints, child1->ensuresConstraints); else temp = constraintList_reflectChanges(child2->requiresConstraints, child1->ensuresConstraints); temp2 = constraintList_mergeRequires (parent->requiresConstraints, temp); constraintList_free(parent->requiresConstraints); constraintList_free(temp); parent->requiresConstraints = temp2; DPRINTF((message ("Parent requires constraints are %s ", constraintList_unparse (parent->requiresConstraints) ) ) ); constraintList_free(parent->ensuresConstraints); parent->ensuresConstraints = constraintList_mergeEnsures(child1->ensuresConstraints, child2->ensuresConstraints); DPRINTF((message ("Parent constraints are %s and %s ", constraintList_unparse (parent->requiresConstraints), constraintList_unparse (parent->ensuresConstraints) ) ) ); } /*@only@*/ constraintList constraintList_subsumeEnsures (constraintList list1, constraintList list2) { constraintList ret; ret = constraintList_makeNew(); constraintList_elements (list1, el) { DPRINTF ((message ("Examining %s", constraint_unparse (el) ) ) ); if (!constraintList_resolve (el, list2) ) { constraint temp; temp = constraint_copy(el); ret = constraintList_add (ret, temp); } else { DPRINTF ((message ("Subsuming %s", constraint_unparse (el) ) ) ); } } end_constraintList_elements; return ret; } /*used to be reflectChangesFreePre renamed for Czech naming conventino*/ /* tries to resolve constraints in list pre2 using post1 */ /*@only@*/ constraintList constraintList_reflectChangesFreePre (/*@only@*/ constraintList pre2, /*@observer@*/ constraintList post1) { constraintList ret; ret = constraintList_reflectChanges(pre2, post1); constraintList_free (pre2); return ret; } /* tries to resolve constraints in list pre2 using post1 */ static /*@only@*/ constraintList reflectChangesNoOr (/*@observer@*/ /*@temp@*/ constraintList pre2, /*@observer@*/ /*@temp@*/ constraintList post1) { constraintList ret; constraint temp; constraint temp2; llassert (! context_getFlag (FLG_ORCONSTRAINT) ); ret = constraintList_makeNew(); DPRINTF((message ("reflectChanges: lists %s and %s", constraintList_unparse(pre2), constraintList_unparse(post1) ))); constraintList_elements (pre2, el) { if (!constraintList_resolve (el, post1) ) { temp = constraint_substitute (el, post1); if (!constraintList_resolve (temp, post1) ) { /* try inequality substitution the inequality substitution may cause us to lose information so we don't want to store the result but we do it anyway */ temp2 = constraint_copy (temp); temp2 = inequalitySubstitute (temp2, post1); if (!constraintList_resolve (temp2, post1) ) { temp2 = inequalitySubstituteUnsound (temp2, post1); if (!constraintList_resolve (temp2, post1) ) ret = constraintList_add (ret, temp2); else constraint_free(temp2); } else { constraint_free(temp2); } } constraint_free(temp); } } end_constraintList_elements; DPRINTF((message ("reflectChanges: returning %s", constraintList_unparse(ret) ) ) ); return ret; } /* tries to resolve constraints in list pre2 using post1 */ /*@only@*/ constraintList constraintList_reflectChanges(/*@observer@*/ constraintList pre2, /*@observer@*/ constraintList post1) { constraintList temp; if ( context_getFlag (FLG_ORCONSTRAINT) ) temp = constraintList_reflectChangesOr (pre2, post1); else temp = reflectChangesNoOr(pre2, post1); return temp; } static constraint constraint_addOr (/*@returned@*/ constraint orig, /*@observer@*/ constraint orConstr) { constraint c; llassert(constraint_isDefined(orig) ); c = orig; DPRINTF((message("constraint_addor: oring %s onto %s", constraint_unparseOr(orConstr), constraint_unparseOr(orig) ) )); while (c->or != NULL) { c = c->or; } c->or = constraint_copy(orConstr); DPRINTF((message("constraint_addor: returning %s",constraint_unparseOr(orig) ) )); return orig; } static bool resolveOr ( /*@temp@*/ constraint c, /*@observer@*/ /*@temp@*/ constraintList list) { constraint temp; int numberOr; numberOr = 0; llassert(constraint_isDefined(c) ); DPRINTF(( message("resolveOr: constraint %s and list %s", constraint_unparseOr(c), constraintList_unparse(list) ) )); temp = c; do { if (constraintList_resolve (temp, list) ) return TRUE; temp = temp->or; numberOr++; llassert(numberOr <= 10); } while (constraint_isDefined(temp)); return FALSE; } /*This is a "helper" function for doResolveOr */ static /*@only@*/ constraint doResolve (/*@only@*/ constraint c, constraintList post1, bool * resolved) { constraint temp; llassert(constraint_isDefined (c ) ); DPRINTF((message("doResolve:: call on constraint c = : %q and constraintList %q", constraint_unparseOr(c), constraintList_unparse(post1) ) )); if (!resolveOr (c, post1) ) { temp = constraint_substitute (c, post1); DPRINTF((message("doResolve:: after substitute temp is %q", constraint_unparseOr(temp) ) )); if (!resolveOr (temp, post1) ) { /* try inequality substitution */ constraint temp2; /* the inequality substitution may cause us to lose information so we don't want to store the result but we do anyway */ temp2 = constraint_copy (c); temp2 = inequalitySubstitute (temp2, post1); if (!resolveOr (temp2, post1) ) { constraint temp3; temp3 = constraint_copy(temp2); temp3 = inequalitySubstituteStrong (temp3, post1); if (!resolveOr (temp3, post1) ) { temp2 = inequalitySubstituteUnsound (temp2, post1); if (!resolveOr (temp2, post1) ) { if (!constraint_same (temp, temp2) ) { /* drl added 8/28/2002*/ /*make sure that the information from a post condition like i = i + 1 is transfered */ constraint tempSub; tempSub = constraint_substitute (temp2, post1); DPRINTF(( message("doResolve: adding %s ", constraint_unparseOr(tempSub) ) )); DPRINTF(( message("doResolve: not adding %s ", constraint_unparseOr(temp2) ) )); temp = constraint_addOr (temp, tempSub); constraint_free(tempSub); } if (!constraint_same (temp, temp3) && !constraint_same (temp3, temp2) ) { /* drl added 8/28/2002*/ /*make sure that the information from a post condition like i = i + 1 is transfered */ constraint tempSub; tempSub = constraint_substitute (temp3, post1); DPRINTF(( message("doResolve: adding %s ", constraint_unparseOr(tempSub) ) )); DPRINTF(( message("doResolve: not adding %s ", constraint_unparseOr(temp3) ) )); temp = constraint_addOr (temp, tempSub); constraint_free(tempSub); } *resolved = FALSE; constraint_free(temp2); constraint_free(temp3); constraint_free(c); return temp; } constraint_free(temp2); constraint_free(temp3); } else { constraint_free(temp2); constraint_free(temp3); } } else { constraint_free(temp2); } } constraint_free(temp); } constraint_free(c); *resolved = TRUE; return NULL; } static /*@only@*/ constraint doResolveOr (/*@observer@*/ /*@temp@*/ constraint c, constraintList post1, /*@out@*/bool * resolved) { constraint ret; constraint next; constraint curr; DPRINTF(( message("doResolveOr: constraint %s and list %s", constraint_unparseOr(c), constraintList_unparse(post1) ) )); *resolved = FALSE; llassert(constraint_isDefined(c) ); ret = constraint_copy(c); llassert(constraint_isDefined(ret) ); if (constraintList_isEmpty(post1) ) { return ret; } next = ret->or; ret->or = NULL; ret = doResolve (ret, post1, resolved); if (*resolved) { if (next != NULL) constraint_free(next); /*we don't need to free ret when resolved is false because ret is null*/ llassert(ret == NULL); return NULL; } while (next != NULL) { curr = next; next = curr->or; curr->or = NULL; curr = doResolve (curr, post1, resolved); if (*resolved) { /* curr is null so we don't try to free it*/ llassert(curr == NULL); if (next != NULL) constraint_free(next); constraint_free(ret); return NULL; } ret = constraint_addOr (ret, curr); constraint_free(curr); } DPRINTF(( message("doResolveOr: returning ret = %s", constraint_unparseOr(ret) ) )); return ret; } /* tries to resolve constraints in list pr2 using post1 */ /*@only@*/ constraintList constraintList_reflectChangesOr (constraintList pre2, constraintList post1) { bool resolved; constraintList ret; constraint temp; ret = constraintList_makeNew(); DPRINTF((message ("constraintList_reflectChangesOr: lists %s and %s", constraintList_unparse(pre2), constraintList_unparse(post1) ))); constraintList_elements (pre2, el) { temp = doResolveOr (el, post1, &resolved); if (!resolved) { ret = constraintList_add(ret, temp); } else { /* we don't need to free temp when resolved is false because temp is null */ llassert(temp == NULL); } } end_constraintList_elements; DPRINTF((message ("constraintList_reflectChangesOr: returning %s", constraintList_unparse(ret) ) ) ); return ret; } static /*@only@*/ constraintList reflectChangesEnsures (/*@observer@*/ constraintList pre2, constraintList post1) { constraintList ret; constraint temp; ret = constraintList_makeNew(); constraintList_elements (pre2, el) { if (!constraintList_resolve (el, post1) ) { temp = constraint_substitute (el, post1); llassert (temp != NULL); if (!constraintList_resolve (temp, post1) ) ret = constraintList_add (ret, temp); else constraint_free(temp); } else { DPRINTF ((message ("Resolved away %s ", constraint_unparse(el) ) ) ); } } end_constraintList_elements; return ret; } static /*@only@*/ constraintList reflectChangesEnsuresFree1 (/*@only@*/ constraintList pre2, constraintList post1) { constraintList ret; ret = reflectChangesEnsures (pre2, post1); constraintList_free(pre2); return ret; } static bool constraint_conflict (constraint c1, constraint c2) { if (!constraint_isDefined(c1) || !constraint_isDefined(c2)) { return FALSE; } if (constraintExpr_similar (c1->lexpr, c2->lexpr)) { if (c1->ar == EQ) if (c1->ar == c2->ar) { DPRINTF (("%s conflicts with %s", constraint_unparse (c1), constraint_unparse (c2))); return TRUE; } } /* This is a slight kludge to prevent circular constraints like strlen(str) == maxRead(s) + strlen(str); */ /*this code is functional but it may be worth cleaning up at some point. */ if (c1->ar == EQ) if (c1->ar == c2->ar) { if (constraintExpr_search (c1->lexpr, c2->expr) ) if (constraintExpr_isTerm(c1->lexpr) ) { constraintTerm term; term = constraintExpr_getTerm(c1->lexpr); if (constraintTerm_isExprNode(term) ) { DPRINTF ((message ("%s conflicts with %s ", constraint_unparse (c1), constraint_unparse(c2) ) ) ); return TRUE; } } } if (constraint_tooDeep(c1) || constraint_tooDeep(c2) ) { DPRINTF ((message ("%s conflicts with %s (constraint is too deep", constraint_unparse (c1), constraint_unparse(c2) ) ) ); return TRUE; } DPRINTF ((message ("%s doesn't conflict with %s ", constraint_unparse (c1), constraint_unparse(c2) ) ) ); return FALSE; } static void constraint_fixConflict (/*@temp@*/ constraint good, /*@temp@*/ /*@observer@*/ constraint conflicting) /*@modifies good@*/ { llassert(constraint_isDefined(conflicting) ); if (conflicting->ar == EQ) { llassert (constraint_isDefined(good)); DPRINTF (("Replacing here!")); good->expr = constraintExpr_searchandreplace (good->expr, conflicting->lexpr, conflicting->expr); good = constraint_simplify (good); } } static bool conflict (constraint c, constraintList list) { constraintList_elements (list, el) { if ( constraint_conflict(el, c) ) { constraint_fixConflict (el, c); return TRUE; } } end_constraintList_elements; return FALSE; } /* check if constraint in list1 conflicts with constraints in List2. If so we remove form list1 and change list2. */ constraintList constraintList_fixConflicts (constraintList list1, constraintList list2) { constraintList ret; ret = constraintList_makeNew(); llassert(constraintList_isDefined(list1) ); constraintList_elements (list1, el) { if (! conflict (el, list2) ) { constraint temp; temp = constraint_copy(el); ret = constraintList_add (ret, temp); } } end_constraintList_elements; return ret; } /*returns true if constraint post satisfies cosntriant pre */ static bool constraintResolve_satisfies (constraint pre, constraint post) { if (!constraint_isDefined (pre)) { return TRUE; } if (!constraint_isDefined(post)) { return FALSE; } if (constraint_isAlwaysTrue (pre)) return TRUE; if (!constraintExpr_similar (pre->lexpr, post->lexpr) ) { return FALSE; } if (constraintExpr_isUndefined(post->expr)) { llassert(FALSE); return FALSE; } return rangeCheck (pre->ar, pre->expr, post->ar, post->expr); } bool constraintList_resolve (/*@temp@*/ /*@observer@*/ constraint c, /*@temp@*/ /*@observer@*/ constraintList p) { DPRINTF (("[resolve] Trying to resolve constraint: %s using %s", constraint_unparse (c), constraintList_unparse (p))); constraintList_elements (p, el) { if (constraintResolve_satisfies (c, el)) { DPRINTF (("constraintList_resolve: %s satifies %s", constraint_unparse (el), constraint_unparse (c))); return TRUE; } DPRINTF (("constraintList_resolve: %s does not satify %s\n ", constraint_unparse (el), constraint_unparse (c))); } end_constraintList_elements; DPRINTF (("No constraints satify: %s", constraint_unparse (c))); return FALSE; } static bool arithType_canResolve (arithType ar1, arithType ar2) { switch (ar1) { case GTE: case GT: if ((ar2 == GT) || (ar2 == GTE) || (ar2 == EQ)) { return TRUE; } break; case EQ: if (ar2 == EQ) return TRUE; break; case LT: case LTE: if ((ar2 == LT) || (ar2 == LTE) || (ar2 == EQ)) return TRUE; break; default: return FALSE; } return FALSE; } /*checks for the case expr2 == sizeof buf1 and buf1 is a fixed array*/ static bool sizeofBufComp(constraintExpr buf1, constraintExpr expr2) { constraintTerm ct; exprNode e, t; sRef s1, s2; llassert(constraintExpr_isDefined(buf1) && constraintExpr_isDefined(expr2) ); /*@access constraintExpr@*/ if ((expr2->kind != term) && (buf1->kind != term) ) return FALSE; ct = constraintExprData_termGetTerm(expr2->data); if (!constraintTerm_isExprNode(ct) ) return FALSE; e = constraintTerm_getExprNode(ct); llassert (exprNode_isDefined(e)); if (! (exprNode_isDefined(e))) return FALSE; if (e->kind != XPR_SIZEOF) return FALSE; t = exprData_getSingle (e->edata); s1 = exprNode_getSref (t); s2 = constraintTerm_getsRef(constraintExprData_termGetTerm(buf1->data) ); /*drl this may be the wronge thing to test for but this seems to work correctly*/ if (sRef_similarRelaxed(s1, s2) || sRef_sameName (s1, s2) ) { /* origly checked that ctype_isFixedArray(sRef_getType(s2)) but removed that test */ return TRUE; } return FALSE; } /* look for the special case of maxSet(buf) >= sizeof(buf) - 1 */ /*drl eventually it would be good to check that buf is of type char.*/ static bool sizeOfMaxSet( /*@observer@*/ /*@temp@*/ constraint c) { constraintExpr l, r, buf1, buf2, con; DPRINTF(( message("sizeOfMaxSet: checking %s ", constraint_unparse(c) ) )); llassert (constraint_isDefined(c) ); l = c->lexpr; r = c->expr; if (!((c->ar == EQ) || (c->ar == GTE) || (c->ar == LTE) ) ) return FALSE; llassert (constraintExpr_isDefined(l) ); llassert (constraintExpr_isDefined(r) ); /*check if the constraintExpr is MaxSet(buf) */ if (l->kind == unaryExpr) { if (constraintExprData_unaryExprGetOp(l->data) == MAXSET) { buf1 = constraintExprData_unaryExprGetExpr(l->data); } else return FALSE; } else return FALSE; if (r->kind != binaryexpr) return FALSE; buf2 = constraintExprData_binaryExprGetExpr1(r->data); con = constraintExprData_binaryExprGetExpr2(r->data); if (constraintExprData_binaryExprGetOp(r->data) == BINARYOP_MINUS) { if (constraintExpr_canGetValue(con) ) { long i; i = constraintExpr_getValue(con); if (i != 1) { return FALSE; } } else return FALSE; } if (constraintExprData_binaryExprGetOp(r->data) == BINARYOP_PLUS) { if (constraintExpr_canGetValue(con) ) { long i; i = constraintExpr_getValue(con); if (i != -1) { return FALSE; } } else return FALSE; } if (sizeofBufComp(buf1, buf2)) { return TRUE; } else { return FALSE; } } /*@noaccess constraintExpr@*/ /* We look for constraint which are tautologies */ bool constraint_isAlwaysTrue (/*@observer@*/ /*@temp@*/ constraint c) { constraintExpr l, r; bool rHasConstant; int rConstant; llassert (constraint_isDefined(c) ); l = c->lexpr; r = c->expr; DPRINTF(( message("constraint_IsAlwaysTrue:examining %s", constraint_unparse(c) ) )); if (sizeOfMaxSet(c) ) return TRUE; if (constraintExpr_canGetValue(l) && constraintExpr_canGetValue(r) ) { int cmp; cmp = constraintExpr_compare (l, r); switch (c->ar) { case EQ: return (cmp == 0); case GT: return (cmp > 0); case GTE: return (cmp >= 0); case LTE: return (cmp <= 0); case LT: return (cmp < 0); default: BADEXIT; /*@notreached@*/ break; } } if (constraintExpr_similar (l,r)) { switch (c->ar) { case EQ: case GTE: case LTE: return TRUE; case GT: case LT: break; default: BADEXIT; /*@notreached@*/ break; } } l = constraintExpr_copy (c->lexpr); r = constraintExpr_copy (c->expr); r = constraintExpr_propagateConstants (r, &rHasConstant, &rConstant); if (constraintExpr_similar (l,r) && (rHasConstant ) ) { DPRINTF(( message("constraint_IsAlwaysTrue: after removing constants %s and %s are similar", constraintExpr_unparse(l), constraintExpr_unparse(r) ) )); DPRINTF(( message("constraint_IsAlwaysTrue: rconstant is %d", rConstant ) )); constraintExpr_free(l); constraintExpr_free(r); switch (c->ar) { case EQ: return (rConstant == 0); case LT: return (rConstant > 0); case LTE: return (rConstant >= 0); case GTE: return (rConstant <= 0); case GT: return (rConstant < 0); default: BADEXIT; /*@notreached@*/ break; } } else { constraintExpr_free(l); constraintExpr_free(r); DPRINTF(( message("Constraint %s is not always true", constraint_unparse(c) ) )); return FALSE; } BADEXIT; } static bool rangeCheck (arithType ar1, /*@observer@*/ constraintExpr expr1, arithType ar2, /*@observer@*/ constraintExpr expr2) { DPRINTF (("Doing range check %s and %s", constraintExpr_unparse (expr1), constraintExpr_unparse (expr2))); if (!arithType_canResolve (ar1, ar2)) return FALSE; switch (ar1) { case GTE: if (constraintExpr_similar (expr1, expr2) ) return TRUE; /*@fallthrough@*/ case GT: if (! (constraintExpr_canGetValue (expr1) && constraintExpr_canGetValue (expr2) ) ) { constraintExpr e1, e2; bool p1, p2; int const1, const2; e1 = constraintExpr_copy(expr1); e2 = constraintExpr_copy(expr2); e1 = constraintExpr_propagateConstants (e1, &p1, &const1); e2 = constraintExpr_propagateConstants (e2, &p2, &const2); if (p1 || p2) { if (!p1) const1 = 0; if (!p2) const2 = 0; if (const1 <= const2) if (constraintExpr_similar (e1, e2) ) { constraintExpr_free(e1); constraintExpr_free(e2); return TRUE; } } DPRINTF(("Can't Get value")); constraintExpr_free(e1); constraintExpr_free(e2); return FALSE; } if (constraintExpr_compare (expr2, expr1) >= 0) return TRUE; return FALSE; case EQ: if (constraintExpr_similar (expr1, expr2) ) return TRUE; return FALSE; case LTE: if (constraintExpr_similar (expr1, expr2) ) return TRUE; /*@fallthrough@*/ case LT: if (! (constraintExpr_canGetValue (expr1) && constraintExpr_canGetValue (expr2) ) ) { constraintExpr e1, e2; bool p1, p2; int const1, const2; e1 = constraintExpr_copy(expr1); e2 = constraintExpr_copy(expr2); e1 = constraintExpr_propagateConstants (e1, &p1, &const1); e2 = constraintExpr_propagateConstants (e2, &p2, &const2); if (p1 || p2) { if (!p1) const1 = 0; if (!p2) const2 = 0; if (const1 >= const2) if (constraintExpr_similar (e1, e2) ) { constraintExpr_free(e1); constraintExpr_free(e2); return TRUE; } } constraintExpr_free(e1); constraintExpr_free(e2); DPRINTF(("Can't Get value")); return FALSE; } if (constraintExpr_compare (expr2, expr1) <= 0) return TRUE; return FALSE; default: llcontbug((message("Unhandled case in switch: %q", arithType_print(ar1) ) ) ); } BADEXIT; } static constraint constraint_searchandreplace (/*@returned@*/ constraint c, constraintExpr old, constraintExpr newExpr) { llassert (constraint_isDefined(c)); DPRINTF (("Starting replace lexpr [%p]: %s < %s ==> %s > in %s", c, constraintExpr_unparse (c->lexpr), constraintExpr_unparse (old), constraintExpr_unparse (newExpr), constraint_unparse (c))); c->lexpr = constraintExpr_searchandreplace (c->lexpr, old, newExpr); DPRINTF (("Finished replace lexpr [%p]: %s", c, constraintExpr_unparse (c->lexpr))); c->expr = constraintExpr_searchandreplace (c->expr, old, newExpr); return c; } bool constraint_search (constraint c, constraintExpr old) /*@*/ { bool ret; ret = FALSE; llassert (constraint_isDefined (c)); ret = constraintExpr_search (c->lexpr, old); ret = ret || constraintExpr_search (c->expr, old); return ret; } /* adjust file locs and stuff */ static constraint constraint_adjust (/*@returned@*/ constraint substitute, /*@observer@*/ constraint old) { fileloc loc1, loc2, loc3; DPRINTF ((message("Start adjust on %s and %s", constraint_unparse(substitute), constraint_unparse(old)) )); llassert(constraint_isDefined(substitute)); llassert(constraint_isDefined(old)); loc1 = constraint_getFileloc (old); loc2 = constraintExpr_loc (substitute->lexpr); loc3 = constraintExpr_loc (substitute->expr); /* special case of an equality that "contains itself" */ if (constraintExpr_search (substitute->expr, substitute->lexpr) ) if (fileloc_closer (loc1, loc3, loc2)) { constraintExpr temp; DPRINTF ((message("Doing adjust on %s", constraint_unparse(substitute) ) )); temp = substitute->lexpr; substitute->lexpr = substitute->expr; substitute->expr = temp; substitute = constraint_simplify(substitute); } fileloc_free (loc1); fileloc_free (loc2); fileloc_free (loc3); return substitute; } /* If function preforms substitutes based on inequality It uses the rule x >= y && b < y ===> x >= b + 1 Warning this is sound but throws out information */ constraint inequalitySubstitute (/*@returned@*/ constraint c, constraintList p) { llassert(constraint_isDefined(c) ); if (c->ar != GTE) return c; constraintList_elements (p, el) { llassert(constraint_isDefined(el) ); if ((el->ar == LT ) ) { constraintExpr temp2; if (constraintExpr_same (el->expr, c->expr) ) { DPRINTF((message ("inequalitySubstitute Replacing %q in %q with %q", constraintExpr_print (c->expr), constraint_unparse (c), constraintExpr_print (el->expr) ) )); temp2 = constraintExpr_copy (el->lexpr); constraintExpr_free(c->expr); c->expr = constraintExpr_makeIncConstraintExpr (temp2); } } } end_constraintList_elements; c = constraint_simplify(c); return c; } /* drl7x 7/26/001 THis function is like inequalitySubstitute but it adds the rule added the rules x >= y && y <= b ===> x >= b x >= y && y < b ===> x >= b + 1 This is sound but sonce it throws out additional information it should only one used if we're oring constraints. */ static constraint inequalitySubstituteStrong (/*@returned@*/ constraint c, constraintList p) { DPRINTF (( message ("inequalitySubstituteStrong examining substituting for %q", constraint_unparse(c) ) )); llassert(constraint_isDefined(c) ); if (! (constraint_isDefined(c) ) ) { return c; } if (c->ar != GTE) return c; DPRINTF (( message ("inequalitySubstituteStrong examining substituting for %q with %q", constraint_unparse(c), constraintList_unparse(p) ) )); constraintList_elements (p, el) { DPRINTF (( message ("inequalitySubstituteStrong examining substituting %s on %s", constraint_unparse(el), constraint_unparse(c) ) )); llassert(constraint_isDefined(el) ); if ((el->ar == LT ) || (el->ar == LTE ) ) { constraintExpr temp2; if (constraintExpr_same (el->lexpr, c->expr) ) { DPRINTF((message ("inequalitySubstitute Replacing %s in %s with %s", constraintExpr_print (c->expr), constraint_unparse (c), constraintExpr_print (el->expr) ) )); temp2 = constraintExpr_copy (el->expr); constraintExpr_free(c->expr); if ((el->ar == LTE ) ) { c->expr = temp2; } else { c->expr = constraintExpr_makeIncConstraintExpr (temp2); } } } } end_constraintList_elements; c = constraint_simplify(c); return c; } /* This function performs substitutions based on the rule: for a constraint of the form expr1 >= expr2; a < b => a = b -1 for all a in expr1. This will work in most cases. Like inequalitySubstitute we're throwing away some information */ static constraint inequalitySubstituteUnsound (/*@returned@*/ constraint c, constraintList p) { DPRINTF (( message ("Doing inequalitySubstituteUnsound " ) )); llassert(constraint_isDefined(c) ); if (c->ar != GTE) return c; constraintList_elements (p, el) { llassert(constraint_isDefined(el) ); DPRINTF (( message ("inequalitySubstituteUnsound examining substituting %s on %s", constraint_unparse(el), constraint_unparse(c) ) )); if (( el->ar == LTE) || (el->ar == LT) ) { constraintExpr temp2; temp2 = constraintExpr_copy (el->expr); if (el->ar == LT) temp2 = constraintExpr_makeDecConstraintExpr (temp2); DPRINTF((message ("Replacing %s in %s with %s", constraintExpr_print (el->lexpr), constraintExpr_print (c->lexpr), constraintExpr_print (temp2) ) )); c->lexpr = constraintExpr_searchandreplace (c->lexpr, el->lexpr, temp2); constraintExpr_free(temp2); } } end_constraintList_elements; c = constraint_simplify(c); return c; } /*@only@*/ constraint constraint_substitute (/*@observer@*/ /*@temp@*/ constraint c, constraintList p) { constraint ret = constraint_copy (c); constraintList_elements (p, el) { if (constraint_isDefined (el)) { if ( el->ar == EQ) if (!constraint_conflict (ret, el)) { constraint temp = constraint_copy(el); temp = constraint_adjust(temp, ret); llassert(constraint_isDefined(temp) ); DPRINTF (("constraint_substitute :: Substituting in %s using %s", constraint_unparse (ret), constraint_unparse (temp))); ret = constraint_searchandreplace (ret, temp->lexpr, temp->expr); DPRINTF (("constraint_substitute :: The new constraint is %s", constraint_unparse (ret)));; constraint_free(temp); } } } end_constraintList_elements; ret = constraint_simplify (ret); DPRINTF(( message (" constraint_substitute :: The final new constraint is %s", constraint_unparse (ret) ) )); return ret; } /*@only@*/ constraintList constraintList_substituteFreeTarget (/*@only@*/ constraintList target, /*@observer@*/ constraintList subList) { constraintList ret; ret = constraintList_substitute (target, subList); constraintList_free(target); return ret; } /* we try to do substitutions on each constraint in target using the constraint in sublist*/ /*@only@*/ constraintList constraintList_substitute (constraintList target,/*2observer@*/ constraintList subList) { constraintList ret; ret = constraintList_makeNew(); constraintList_elements(target, el) { constraint temp; /* drl possible problem : warning make sure that a side effect is not expected */ temp = constraint_substitute(el, subList); ret = constraintList_add (ret, temp); } end_constraintList_elements; return ret; } static constraint constraint_solve (/*@returned@*/ constraint c) { llassert(constraint_isDefined(c) ); DPRINTF((message ("Solving %s\n", constraint_unparse(c) ) ) ); c->expr = constraintExpr_solveBinaryExpr (c->lexpr, c->expr); DPRINTF((message ("Solved and got %s\n", constraint_unparse(c) ) ) ); return c; } static arithType flipAr (arithType ar) { switch (ar) { case LT: return GT; case LTE: return GTE; case EQ: return EQ; case GT: return LT; case GTE: return LTE; default: llcontbug (message("unexpected value: case not handled")); } BADEXIT; } static constraint constraint_swapLeftRight (/*@returned@*/ constraint c) { constraintExpr temp; llassert(constraint_isDefined(c) ); c->ar = flipAr (c->ar); temp = c->lexpr; c->lexpr = c->expr; c->expr = temp; DPRINTF(("Swaped left and right sides of constraint")); return c; } constraint constraint_simplify ( /*@returned@*/ constraint c) { llassert(constraint_isDefined(c) ); DPRINTF(( message("constraint_simplify on %q ", constraint_unparse(c) ) )); if (constraint_tooDeep(c)) { DPRINTF(( message("constraint_simplify: constraint to complex aborting %q ", constraint_unparse(c) ) )); return c; } c->lexpr = constraintExpr_simplify (c->lexpr); c->expr = constraintExpr_simplify (c->expr); if (constraintExpr_isBinaryExpr (c->lexpr) ) { c = constraint_solve (c); c->lexpr = constraintExpr_simplify (c->lexpr); c->expr = constraintExpr_simplify (c->expr); } if (constraintExpr_isLit(c->lexpr) && (!constraintExpr_isLit(c->expr) ) ) { c = constraint_swapLeftRight(c); /*I don't think this will be an infinate loop*/ c = constraint_simplify(c); } DPRINTF(( message("constraint_simplify returning %q ", constraint_unparse(c) ) )); return c; } /* returns true if fileloc for term1 is closer to file for term2 than term3*/ bool fileloc_closer (fileloc loc1, fileloc loc2, fileloc loc3) { if (!fileloc_isDefined (loc1) ) return FALSE; if (!fileloc_isDefined (loc2) ) return FALSE; if (!fileloc_isDefined (loc3) ) return TRUE; if (fileloc_equal (loc2, loc3) ) return FALSE; if (fileloc_equal (loc1, loc2) ) return TRUE; if (fileloc_equal (loc1, loc3) ) return FALSE; if ( fileloc_lessthan (loc1, loc2) ) { if (fileloc_lessthan (loc2, loc3) ) { llassert (fileloc_lessthan (loc1, loc3) ); return TRUE; } else { return FALSE; } } if ( !fileloc_lessthan (loc1, loc2) ) { if (!fileloc_lessthan (loc2, loc3) ) { llassert (!fileloc_lessthan (loc1, loc3) ); return TRUE; } else { return FALSE; } } llassert(FALSE); return FALSE; } splint-3.1.2.dfsg1/src/constraintGeneration.c0000644021234200000250000021104107765024013016601 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** constraintGeneration.c */ /* #define DEBUGPRINT 1 */ # include /* for isdigit */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" /*drl We need to access the internal representation of exprNode because these functions walk down the parse tree and need a richer information than is accessible through the exprNode interface.*/ /*@access exprNode@*/ static /*@nullwhentrue@*/ bool exprNode_handleError (/*@temp@*/ exprNode p_e); static void exprNode_stmt (/*@temp@*/ /*@temp@*/ exprNode p_e); static void exprNode_multiStatement (/*@temp@*/ exprNode p_e); static constraintList exprNode_traverseTrueEnsuresConstraints (/*@temp@*/ exprNode p_e); static constraintList exprNode_traverseFalseEnsuresConstraints (/*@temp@*/ exprNode p_e); static void checkArgumentList (/*@out@*/ exprNode p_temp, exprNodeList p_arglist, fileloc p_sequencePoint) /*@modifies p_temp @*/; static constraintList checkCall (/*@temp@*/ exprNode p_fcn, exprNodeList p_arglist); static bool exprNode_isUnhandled (/*@temp@*/ /*@observer@*/ exprNode e) { llassert(exprNode_isDefined(e)); switch (e->kind) { case XPR_INITBLOCK: case XPR_EMPTY: case XPR_LABEL: case XPR_CONST: case XPR_VAR: case XPR_BODY: case XPR_OFFSETOF: case XPR_ALIGNOFT: case XPR_ALIGNOF: case XPR_VAARG: case XPR_ITERCALL: case XPR_ITER: case XPR_GOTO: case XPR_CONTINUE: case XPR_BREAK: case XPR_COMMA: case XPR_COND: case XPR_TOK: case XPR_FTDEFAULT: case XPR_DEFAULT: case XPR_FTCASE: case XPR_CASE: case XPR_NODE: DPRINTF((message ("Warning current constraint generation does not handle expression %s", exprNode_unparse(e)))); return TRUE; /*@notreached@*/ break; default: return FALSE; } /*not reached*/ return FALSE; } /*@nullwhentrue@*/ bool exprNode_handleError (exprNode e) { if (exprNode_isError (e) || exprNode_isUnhandled (e)) { return TRUE; } return FALSE; } /* evans 2002-03-2 - parameter was dependent */ bool /*@alt void@*/ exprNode_generateConstraints (/*@temp@*/ exprNode e) { if (exprNode_isError (e)) return FALSE; if (exprNode_isUnhandled (e)) { DPRINTF((message("Warning ignoring %s", exprNode_unparse (e)))); return FALSE; } DPRINTF ((message ("exprNode_generateConstraints Analyzing %s at %s", exprNode_unparse(e), fileloc_unparse(exprNode_loc (e))))); if (exprNode_isMultiStatement (e)) { exprNode_multiStatement(e); } else { /* fileloc loc; */ /* loc = exprNode_getNextSequencePoint(e); */ /* exprNode_exprTraverse(e, FALSE, FALSE, loc); */ /* fileloc_free(loc); */ exprNode_stmt(e); return FALSE; } { constraintList c; c = constraintList_makeFixedArrayConstraints (e->uses); e->requiresConstraints = constraintList_reflectChangesFreePre (e->requiresConstraints, c); constraintList_free(c); } DPRINTF ((message ("e->requiresConstraints %s", constraintList_unparseDetailed (e->requiresConstraints)))); return FALSE; } static void exprNode_stmt (/*@temp@*/ exprNode e) { exprNode snode; fileloc loc; DPRINTF (("Generating constraint for: %s", exprNode_unparse (e))); if (exprNode_isError(e)) { return; } /*e->requiresConstraints = constraintList_makeNew(); e->ensuresConstraints = constraintList_makeNew(); */ /*!! s = exprNode_unparse (e); */ if (e->kind == XPR_INIT) { constraintList tempList; DPRINTF (("Init: %s ", exprNode_unparse (e))); loc = exprNode_getNextSequencePoint (e); /* reduces to an expression */ DPRINTF (("Location: %s", fileloc_unparse (loc))); DPRINTF (("Ensures before: %s", constraintList_unparse (e->ensuresConstraints))); exprNode_exprTraverse (e, FALSE, FALSE, loc); DPRINTF (("Ensures after: %s", constraintList_unparse (e->ensuresConstraints))); DPRINTF (("After traversing...")); fileloc_free(loc); tempList = e->requiresConstraints; DPRINTF (("Requires before: %s", constraintList_unparse (e->requiresConstraints))); e->requiresConstraints = exprNode_traverseRequiresConstraints (e); DPRINTF (("Requires after: %s", constraintList_unparse (e->requiresConstraints))); constraintList_free(tempList); tempList = e->ensuresConstraints; DPRINTF (("Ensures before: %s", constraintList_unparse (e->ensuresConstraints))); e->ensuresConstraints = exprNode_traverseEnsuresConstraints(e); DPRINTF (("Ensures before: %s", constraintList_unparse (e->ensuresConstraints))); constraintList_free(tempList); return; } /*drl 2/13/002 patched bug so return statement will be checked*/ /*return is a stmt not not expression ...*/ if (e->kind == XPR_RETURN) { constraintList tempList; loc = exprNode_getNextSequencePoint(e); /* reduces to an expression */ exprNode_exprTraverse (exprData_getSingle (e->edata), FALSE, TRUE, loc); fileloc_free(loc); tempList = e->requiresConstraints; e->requiresConstraints = exprNode_traverseRequiresConstraints(e); constraintList_free(tempList); } if (e->kind != XPR_STMT) { DPRINTF (("Not Stmt")); DPRINTF ((message ("%s ", exprNode_unparse (e)))); if (exprNode_isMultiStatement (e)) { exprNode_multiStatement (e); /* evans 2001-08-21: spurious return removed */ } else { loc = exprNode_getNextSequencePoint(e); /* reduces to an expression */ exprNode_exprTraverse (e, FALSE, TRUE, loc); fileloc_free(loc); } return; } DPRINTF (("Stmt")); DPRINTF ((message ("%s ", exprNode_unparse (e)))); snode = exprData_getUopNode (e->edata); /* could be stmt involving multiple statements: i.e. if, while for ect. */ if (exprNode_isMultiStatement (snode)) { exprNode_multiStatement (snode); (void) exprNode_copyConstraints (e, snode); return; } loc = exprNode_getNextSequencePoint(e); /* reduces to an expression */ exprNode_exprTraverse (snode, FALSE, FALSE, loc); fileloc_free(loc); constraintList_free (e->requiresConstraints); e->requiresConstraints = exprNode_traverseRequiresConstraints(snode); constraintList_free (e->ensuresConstraints); e->ensuresConstraints = exprNode_traverseEnsuresConstraints(snode); DPRINTF ((message ("smtlist constraints are: pre: %s \n and \t post %s\n", constraintList_unparse(e->requiresConstraints), constraintList_unparse(e->ensuresConstraints)))); return; } static void exprNode_stmtList (/*@dependent@*/ exprNode e) { exprNode stmt1, stmt2; if (exprNode_isError (e)) { return; } /* Handle case of stmtList with only one statement: The parse tree stores this as stmt instead of stmtList */ if (e->kind != XPR_STMTLIST) { exprNode_stmt(e); return; } llassert (e->kind == XPR_STMTLIST); DPRINTF(("exprNode_stmtList STMTLIST:")); DPRINTF ((cstring_toCharsSafe (exprNode_unparse(e)))); stmt1 = exprData_getPairA (e->edata); stmt2 = exprData_getPairB (e->edata); DPRINTF(("exprNode_stmtlist ")); DPRINTF ((message("XW%s | %s", exprNode_unparse(stmt1), exprNode_unparse(stmt2)))); exprNode_stmt (stmt1); DPRINTF(("\nstmt after stmtList call ")); exprNode_stmt (stmt2); exprNode_mergeResolve (e, stmt1, stmt2); DPRINTF ((message ("smtlist constraints are: pre: %s \n and \t post %s\n", constraintList_unparse(e->requiresConstraints), constraintList_unparse(e->ensuresConstraints)))); return; } static exprNode doIf (/*@returned@*/ exprNode e, /*@dependent@*/ exprNode test, /*@dependent@*/ exprNode body) { constraintList temp; DPRINTF ((message ("doIf: %s ", exprNode_unparse(e)))); llassert (exprNode_isDefined(test)); llassert (exprNode_isDefined (e)); llassert (exprNode_isDefined (body)); DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->ensuresConstraints)))); DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->ensuresConstraints)))); DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->trueEnsuresConstraints)))); DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->falseEnsuresConstraints)))); DPRINTF((message ("ensures constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->ensuresConstraints)))); DPRINTF((message ("Requires constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->ensuresConstraints)))); DPRINTF((message ("trueEnsures constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->trueEnsuresConstraints)))); DPRINTF((message ("falseEnsures constraints for %s are %s", exprNode_unparse(test), constraintList_unparseDetailed(test->falseEnsuresConstraints)))); temp = test->trueEnsuresConstraints; test->trueEnsuresConstraints = exprNode_traverseTrueEnsuresConstraints(test); constraintList_free(temp); temp = test->ensuresConstraints; test->ensuresConstraints = exprNode_traverseEnsuresConstraints (test); constraintList_free(temp); temp = test->requiresConstraints; test->requiresConstraints = exprNode_traverseRequiresConstraints (test); constraintList_free(temp); test->trueEnsuresConstraints = constraintList_substituteFreeTarget(test->trueEnsuresConstraints, test->ensuresConstraints); DPRINTF ((message ("doIf: test ensures %s ", constraintList_unparse(test->ensuresConstraints)))); DPRINTF ((message ("doIf: test true ensures %s ", constraintList_unparse(test->trueEnsuresConstraints)))); constraintList_free(e->requiresConstraints); e->requiresConstraints = constraintList_reflectChanges(body->requiresConstraints, test->trueEnsuresConstraints); e->requiresConstraints = constraintList_reflectChangesFreePre (e->requiresConstraints, test->ensuresConstraints); temp = e->requiresConstraints; e->requiresConstraints = constraintList_mergeRequires (e->requiresConstraints, test->requiresConstraints); constraintList_free(temp); /* drl possible problem : warning bad */ constraintList_free(e->ensuresConstraints); e->ensuresConstraints = constraintList_copy (test->ensuresConstraints); if (exprNode_mayEscape (body)) { DPRINTF ((message("doIf: the if statement body %s returns or exits", exprNode_unparse(body)))); e->ensuresConstraints = constraintList_mergeEnsuresFreeFirst (e->ensuresConstraints, test->falseEnsuresConstraints); } DPRINTF ((message ("doIf: if requiers %s ", constraintList_unparse(e->requiresConstraints)))); return e; } /*drl added 3/4/2001 Also used for condition i.e. ?: operation Precondition This function assumes that p, trueBranch, falseBranch have have all been traversed for constraints i.e. we assume that exprNode_traverseEnsuresConstraints, exprNode_traverseRequiresConstraints, exprNode_traverseTrueEnsuresConstraints, exprNode_traverseFalseEnsuresConstraints have all been run */ static exprNode doIfElse (/*@returned@*/ exprNode e, /*@dependent@*/ exprNode p, /*@dependent@*/ exprNode trueBranch, /*@dependent@*/ exprNode falseBranch) { constraintList c1, cons, t, t2, f, f2; llassert (exprNode_isDefined (e)); llassert (exprNode_isDefined (p)); llassert (exprNode_isDefined (trueBranch)); llassert (exprNode_isDefined (falseBranch)); DPRINTF ((message ("doIfElse: %s ", exprNode_unparse(e)))); /* do requires clauses */ c1 = constraintList_copy (p->ensuresConstraints); t = constraintList_reflectChanges(trueBranch->requiresConstraints, p->trueEnsuresConstraints); t = constraintList_reflectChangesFreePre (t, p->ensuresConstraints); cons = constraintList_reflectChanges(falseBranch->requiresConstraints, p->falseEnsuresConstraints); cons = constraintList_reflectChangesFreePre (cons, c1); constraintList_free (e->requiresConstraints); e->requiresConstraints = constraintList_mergeRequiresFreeFirst (t, cons); e->requiresConstraints = constraintList_mergeRequiresFreeFirst (e->requiresConstraints, p->requiresConstraints); /* do ensures clauses find the the ensures lists for each subbranch */ t = constraintList_mergeEnsures (p->trueEnsuresConstraints, trueBranch->ensuresConstraints); t2 = t; t = constraintList_mergeEnsures (p->ensuresConstraints, t); constraintList_free(t2); f = constraintList_mergeEnsures (p->falseEnsuresConstraints, falseBranch->ensuresConstraints); f2 = f; f = constraintList_mergeEnsures (p->ensuresConstraints, f); constraintList_free(f2); /* find ensures for whole if/else statement */ constraintList_free(e->ensuresConstraints); e->ensuresConstraints = constraintList_logicalOr (t, f); constraintList_free(t); constraintList_free(f); constraintList_free(cons); constraintList_free(c1); DPRINTF ((message ("doIfElse: if requires %q ", constraintList_unparse(e->requiresConstraints)))); DPRINTF ((message ("doIfElse: if ensures %q ", constraintList_unparse(e->ensuresConstraints)))); return e; } static exprNode doWhile (/*@returned@*/ exprNode e, /*@dependent@*/ exprNode test, /*@dependent@*/ exprNode body) { DPRINTF ((message ("doWhile: %s ", exprNode_unparse(e)))); return doIf (e, test, body); } /*@only@*/ constraintList constraintList_makeFixedArrayConstraints (/*@observer@*/ sRefSet s) { constraintList ret; constraint con; ret = constraintList_makeNew(); sRefSet_elements (s, el) { if (sRef_isFixedArray(el)) { size_t size; DPRINTF((message("%s is a fixed array", sRef_unparse(el)))); size = sRef_getArraySize(el); DPRINTF((message("%s is a fixed array with size %d", sRef_unparse(el), (int)size))); con = constraint_makeSRefSetBufferSize (el, size_toLong (size - 1)); ret = constraintList_add(ret, con); } else { DPRINTF((message("%s is not a fixed array", sRef_unparse(el)))); if (sRef_isExternallyVisible (el)) { /* DPRINTF((message("%s is externally visible", sRef_unparse(el)))); con = constraint_makeSRefWriteSafeInt(el, 0); ret = constraintList_add(ret, con); con = constraint_makeSRefReadSafeInt(el, 0); ret = constraintList_add(ret, con); */ } } } end_sRefSet_elements ; DPRINTF((message("constraintList_makeFixedArrayConstraints returning %s", constraintList_unparse(ret)))); return ret; } # if 0 exprNode makeDataTypeConstraints (/*@returned@*/ exprNode e) { constraintList c; DPRINTF(("makeDataTypeConstraints")); c = constraintList_makeFixedArrayConstraints (e->uses); e->ensuresConstraints = constraintList_addListFree (e->ensuresConstraints, c); return e; } # endif static void doFor (/*@dependent@*/ exprNode e, /*@dependent@*/ exprNode forPred, /*@dependent@*/ exprNode forBody) { exprNode init, test, inc; /* merge the constraints: modle as if statement */ /* init if (test) for body inc */ llassert (exprNode_isDefined (e)); llassert (exprNode_isDefined (forPred)); llassert (exprNode_isDefined (forBody)); init = exprData_getTripleInit (forPred->edata); test = exprData_getTripleTest (forPred->edata); inc = exprData_getTripleInc (forPred->edata); if (((exprNode_isError (test) /*|| (exprNode_isError(init))*/) || (exprNode_isError (inc)))) { DPRINTF ((message ("strange for statement:%s, ignoring it", exprNode_unparse(e)))); return; } exprNode_forLoopHeuristics(e, forPred, forBody); constraintList_free(e->requiresConstraints); e->requiresConstraints = constraintList_reflectChanges(forBody->requiresConstraints, test->ensuresConstraints); e->requiresConstraints = constraintList_reflectChangesFreePre (e->requiresConstraints, test->trueEnsuresConstraints); e->requiresConstraints = constraintList_reflectChangesFreePre (e->requiresConstraints, forPred->ensuresConstraints); if (!forBody->canBreak) { e->ensuresConstraints = constraintList_addListFree(e->ensuresConstraints, constraintList_copy(forPred->ensuresConstraints)); e->ensuresConstraints = constraintList_addListFree(e->ensuresConstraints,constraintList_copy(test->falseEnsuresConstraints)); } else { DPRINTF(("Can break")); } } static /*@dependent@*/ exprNode exprNode_makeDependent(/*@returned@*/ exprNode e) { /* !!! DRL - this is ridiculous! Read the manual on memory annotations please! */ return e; } static void exprNode_doGenerateConstraintSwitch (/*@dependent@*/ exprNode switchExpr, /*@dependent@*/ exprNode body, /*@special@*/ constraintList *currentRequires, /*@special@*/ constraintList *currentEnsures, /*@special@*/ constraintList *savedRequires, /*@special@*/ constraintList *savedEnsures) /*@post:only *currentRequires, *currentEnsures, *savedRequires, *savedEnsures @*/ /*@sets *currentRequires, *currentEnsures, *savedRequires, *savedEnsures @*/ { exprNode stmt, stmtList; DPRINTF((message("exprNode_doGenerateConstraintSwitch: (switch %s) %s", exprNode_unparse(switchExpr), exprNode_unparse(body) ))); if (exprNode_isError(body)) { *currentRequires = constraintList_makeNew (); *currentEnsures = constraintList_makeNew (); *savedRequires = constraintList_makeNew (); *savedEnsures = constraintList_makeNew (); /*@-onlytrans@*/ return; /*@=onlytrans@*/ } if (body->kind != XPR_STMTLIST) { DPRINTF((message("exprNode_doGenerateConstraintSwitch: non stmtlist: %s", exprNode_unparse(body)))); stmt = body; stmtList = exprNode_undefined; stmt = exprNode_makeDependent(stmt); stmtList = exprNode_makeDependent(stmtList); } else { stmt = exprData_getPairB(body->edata); stmtList = exprData_getPairA(body->edata); stmt = exprNode_makeDependent(stmt); stmtList = exprNode_makeDependent(stmtList); } DPRINTF((message("exprNode_doGenerateConstraintSwitch: stmtlist: %s stmt: %s", exprNode_unparse(stmtList), exprNode_unparse(stmt)) )); exprNode_doGenerateConstraintSwitch (switchExpr, stmtList, currentRequires, currentEnsures, savedRequires, savedEnsures); if (exprNode_isError(stmt)) /*@-onlytrans@*/ return; /*@=onlytrans@*/ exprNode_stmt(stmt); switchExpr = exprNode_makeDependent (switchExpr); if (! exprNode_isCaseMarker(stmt)) { constraintList temp; DPRINTF ((message("Got normal statement %s (requires %s ensures %s)", exprNode_unparse(stmt), constraintList_unparse(stmt->requiresConstraints), constraintList_unparse(stmt->ensuresConstraints)))); temp = constraintList_reflectChanges (stmt->requiresConstraints, *currentEnsures); *currentRequires = constraintList_mergeRequiresFreeFirst( *currentRequires, temp); constraintList_free(temp); *currentEnsures = constraintList_mergeEnsuresFreeFirst (*currentEnsures, stmt->ensuresConstraints); DPRINTF((message("returning from exprNode_doGenerateConstraintSwitch: (switch %s) %s currentRequires:" "%s currentEnsures:%s", exprNode_unparse(switchExpr), exprNode_unparse(body), constraintList_unparse(*currentRequires), constraintList_unparse(*currentEnsures) ))); /*@-onlytrans@*/ return; /*@=onlytrans@*/ } if (exprNode_isCaseMarker(stmt) && exprNode_mustEscape(stmtList)) { /* ** merge current and saved constraint with Logical Or... ** make a constraint for ensures */ constraintList temp; constraint con; DPRINTF ((message("Got case marker"))); if (constraintList_isUndefined(*savedEnsures) && constraintList_isUndefined(*savedRequires)) { llassert(constraintList_isUndefined(*savedEnsures)); llassert(constraintList_isUndefined(*savedRequires)); *savedEnsures = constraintList_copy(*currentEnsures); *savedRequires = constraintList_copy(*currentRequires); } else { DPRINTF ((message("Doing logical or"))); temp = constraintList_logicalOr (*savedEnsures, *currentEnsures); constraintList_free (*savedEnsures); *savedEnsures = temp; *savedRequires = constraintList_mergeRequiresFreeFirst (*savedRequires, *currentRequires); } con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle (stmt->edata), exprNode_loc (stmt)); constraintList_free (*currentEnsures); *currentEnsures = constraintList_makeNew(); *currentEnsures = constraintList_add(*currentEnsures, con); constraintList_free(*currentRequires); *currentRequires = constraintList_makeNew(); DPRINTF (("exprNode_doGenerateConstraintSwitch: (switch %s) %s savedRequires:" "%s savedEnsures:%s", exprNode_unparse(switchExpr), exprNode_unparse(body), constraintList_unparse(*savedRequires), constraintList_unparse(*savedEnsures) )); } else if (exprNode_isCaseMarker(stmt)) /* prior case has no break. */ { /* We don't do anything to the sved constraints because the case hasn't ended The new ensures constraints for the case will be: the constraint for the case statement (CASE_LABEL == SWITCH_EXPR) logicalOr currentEnsures */ constraintList temp; constraint con; constraintList ensuresTemp; con = constraint_makeEnsureEqual (switchExpr, exprData_getSingle (stmt->edata), exprNode_loc (stmt)); ensuresTemp = constraintList_makeNew (); ensuresTemp = constraintList_add (ensuresTemp, con); if (exprNode_isError (stmtList)) { constraintList_free (*currentEnsures); *currentEnsures = constraintList_copy (ensuresTemp); constraintList_free (ensuresTemp); } else { temp = constraintList_logicalOr (*currentEnsures, ensuresTemp); constraintList_free (*currentEnsures); constraintList_free (ensuresTemp); *currentEnsures = temp; } constraintList_free (*currentRequires); *currentRequires = constraintList_makeNew(); } else { /* we handle the case of ! exprNode_isCaseMarker above the else if clause should always be true. */ BADEXIT; } DPRINTF (("returning from exprNode_doGenerateConstraintSwitch: (switch %s) %s currentRequires:" "%s currentEnsures:%s", exprNode_unparse(switchExpr), exprNode_unparse(body), constraintList_unparse(*currentRequires), constraintList_unparse(*currentEnsures) )); /*@-onlytrans@*/ return; /*@=onlytrans@*/ } static void exprNode_generateConstraintSwitch (/*@notnull@*/ exprNode switchStmt) { constraintList constraintsRequires; constraintList constraintsEnsures; constraintList lastRequires; constraintList lastEnsures; exprNode body; exprNode switchExpr; switchExpr = exprData_getPairA (switchStmt->edata); body = exprData_getPairB (switchStmt->edata); if (!exprNode_isDefined (body)) { return; } DPRINTF((message(""))); if (body->kind == XPR_BLOCK) body = exprData_getSingle(body->edata); constraintsRequires = constraintList_undefined; constraintsEnsures = constraintList_undefined; lastRequires = constraintList_makeNew(); lastEnsures = constraintList_makeNew(); /*@-mustfree@*/ /* evans 2002-01-01: spurious warnings for these becuase of stack allocated storage */ exprNode_doGenerateConstraintSwitch (switchExpr, body, &lastRequires, &lastEnsures, &constraintsRequires, &constraintsEnsures); /*@=mustfree@*/ /* merge current and saved constraint with Logical Or... make a constraint for ensures */ constraintList_free(switchStmt->requiresConstraints); constraintList_free(switchStmt->ensuresConstraints); if (constraintList_isDefined(constraintsEnsures) && constraintList_isDefined(constraintsRequires)) { switchStmt->ensuresConstraints = constraintList_logicalOr(constraintsEnsures, lastEnsures); switchStmt->requiresConstraints = constraintList_mergeRequires(constraintsRequires, lastRequires); constraintList_free (constraintsRequires); constraintList_free (constraintsEnsures); } else { switchStmt->ensuresConstraints = constraintList_copy(lastEnsures); switchStmt->requiresConstraints = constraintList_copy(lastRequires); } constraintList_free (lastRequires); constraintList_free (lastEnsures); DPRINTF(((message(" exprNode_generateConstraintSwitch returning requires: %s and ensures %s", constraintList_unparse(switchStmt->requiresConstraints), constraintList_unparse(switchStmt->ensuresConstraints) ) ))); } static exprNode doSwitch (/*@returned@*/ /*@notnull@*/ exprNode e) { exprNode body; exprData data; data = e->edata; DPRINTF ((message ("doSwitch for: switch (%s) %s", exprNode_unparse (exprData_getPairA (data)), exprNode_unparse (exprData_getPairB (data))))); body = exprData_getPairB (data); exprNode_generateConstraintSwitch (e); return e; } void exprNode_multiStatement (/*@dependent@*/ exprNode e) { bool ret; exprData data; exprNode e1, e2; exprNode p, trueBranch, falseBranch; exprNode forPred, forBody; exprNode test; constraintList temp; DPRINTF((message ("exprNode_multistatement Analysising %s %s at", exprNode_unparse(e), fileloc_unparse(exprNode_getfileloc(e))))); if (exprNode_handleError (e)) { return; } data = e->edata; ret = TRUE; switch (e->kind) { case XPR_FOR: forPred = exprData_getPairA (data); forBody = exprData_getPairB (data); /* First generate the constraints */ exprNode_generateConstraints (forPred); exprNode_generateConstraints (forBody); doFor (e, forPred, forBody); break; case XPR_FORPRED: exprNode_generateConstraints (exprData_getTripleInit (data)); test = exprData_getTripleTest (data); exprNode_exprTraverse (test,FALSE, FALSE, exprNode_loc(e)); exprNode_generateConstraints (exprData_getTripleInc (data)); if (!exprNode_isError(test)) { constraintList temp2; temp2 = test->trueEnsuresConstraints; test->trueEnsuresConstraints = exprNode_traverseTrueEnsuresConstraints(test); constraintList_free(temp2); } exprNode_generateConstraints (exprData_getTripleInc (data)); break; case XPR_WHILE: e1 = exprData_getPairA (data); e2 = exprData_getPairB (data); exprNode_exprTraverse (e1, FALSE, FALSE, exprNode_loc(e1)); exprNode_generateConstraints (e2); e = doWhile (e, e1, e2); break; case XPR_IF: DPRINTF(("IF:")); DPRINTF ((exprNode_unparse(e))); e1 = exprData_getPairA (data); e2 = exprData_getPairB (data); exprNode_exprTraverse (e1, FALSE, FALSE, exprNode_loc(e1)); exprNode_generateConstraints (e2); e = doIf (e, e1, e2); break; case XPR_IFELSE: DPRINTF(("Starting IFELSE")); p = exprData_getTriplePred (data); trueBranch = exprData_getTripleTrue (data); falseBranch = exprData_getTripleFalse (data); exprNode_exprTraverse (p, FALSE, FALSE, exprNode_loc(p)); exprNode_generateConstraints (trueBranch); exprNode_generateConstraints (falseBranch); llassert (exprNode_isDefined (p)); temp = p->ensuresConstraints; p->ensuresConstraints = exprNode_traverseEnsuresConstraints (p); constraintList_free(temp); temp = p->requiresConstraints; p->requiresConstraints = exprNode_traverseRequiresConstraints (p); constraintList_free(temp); temp = p->trueEnsuresConstraints; p->trueEnsuresConstraints = exprNode_traverseTrueEnsuresConstraints(p); constraintList_free(temp); DPRINTF((message("p->trueEnsuresConstraints before substitue %s", constraintList_unparse(p->trueEnsuresConstraints) ) )); /*drl 10/10/2002 this is a bit of a hack but the reason why we do this is so that any function post conditions or similar things get applied correctly to each branch. e.g. in strlen(s) < 5 we want the trueEnsures to be maxRead(s) < 5*/ p->trueEnsuresConstraints = constraintList_substituteFreeTarget (p->trueEnsuresConstraints, p->ensuresConstraints); DPRINTF(( message ("p->trueEnsuresConstraints after substitue %s", constraintList_unparse(p->trueEnsuresConstraints) ) )); temp = p->falseEnsuresConstraints; p->falseEnsuresConstraints = exprNode_traverseFalseEnsuresConstraints(p); constraintList_free(temp); /*See comment on trueEnsures*/ p->falseEnsuresConstraints = constraintList_substituteFreeTarget (p->falseEnsuresConstraints, p->ensuresConstraints); e = doIfElse (e, p, trueBranch, falseBranch); DPRINTF(("Done IFELSE")); break; case XPR_DOWHILE: e2 = (exprData_getPairB (data)); e1 = (exprData_getPairA (data)); DPRINTF((message ("do { %s } while (%s)", exprNode_unparse(e2), exprNode_unparse(e1)))); exprNode_generateConstraints (e2); exprNode_generateConstraints (e1); e = exprNode_copyConstraints (e, e2); DPRINTF ((message ("e = %s ", constraintList_unparse(e->requiresConstraints)))); break; case XPR_BLOCK: { exprNode tempExpr; tempExpr = exprData_getSingle (data); exprNode_generateConstraints (tempExpr); if (exprNode_isDefined(tempExpr) ) { constraintList_free(e->requiresConstraints); e->requiresConstraints = constraintList_copy (tempExpr->requiresConstraints); constraintList_free(e->ensuresConstraints); e->ensuresConstraints = constraintList_copy (tempExpr->ensuresConstraints); } else { llassert(FALSE); } } break; case XPR_SWITCH: e = doSwitch (e); break; case XPR_STMT: case XPR_STMTLIST: exprNode_stmtList (e); return ; /*@notreached@*/ break; default: ret=FALSE; } return; } static bool lltok_isBoolean_Op (lltok tok) { /*this should really be a switch statement but I don't want to violate the abstraction maybe this should go in lltok.c */ if (lltok_isEqOp (tok)) { return TRUE; } if (lltok_isAndOp (tok)) { return TRUE; } if (lltok_isOrOp (tok)) { return TRUE; } if (lltok_isGt_Op (tok)) { return TRUE; } if (lltok_isLt_Op (tok)) { return TRUE; } if (lltok_isLe_Op (tok)) { return TRUE; } if (lltok_isGe_Op (tok)) { return TRUE; } return FALSE; } static void exprNode_booleanTraverse (/*@dependent@*/ exprNode e, /*@unused@*/ bool definatelv, /*@unused@*/ bool definaterv, fileloc sequencePoint) { constraint cons; exprNode t1, t2; exprData data; lltok tok; constraintList tempList, temp; if (exprNode_isUndefined(e) ) { llassert (exprNode_isDefined(e) ); return; } data = e->edata; tok = exprData_getOpTok (data); t1 = exprData_getOpA (data); t2 = exprData_getOpB (data); /* drl 3/2/2003 we know this because of the type of expression*/ llassert( exprNode_isDefined(t1) && exprNode_isDefined(t2) ); tempList = constraintList_undefined; /* arithmetic tests */ if (lltok_isEqOp (tok)) { cons = constraint_makeEnsureEqual (t1, t2, sequencePoint); e->trueEnsuresConstraints = constraintList_add(e->trueEnsuresConstraints, cons); } if (lltok_isLt_Op (tok)) { cons = constraint_makeEnsureLessThan (t1, t2, sequencePoint); e->trueEnsuresConstraints = constraintList_add(e->trueEnsuresConstraints, cons); cons = constraint_makeEnsureGreaterThanEqual (t1, t2, sequencePoint); e->falseEnsuresConstraints = constraintList_add(e->falseEnsuresConstraints, cons); } if (lltok_isGe_Op (tok)) { cons = constraint_makeEnsureGreaterThanEqual (t1, t2, sequencePoint); e->trueEnsuresConstraints = constraintList_add(e->trueEnsuresConstraints, cons); cons = constraint_makeEnsureLessThan (t1, t2, sequencePoint); e->falseEnsuresConstraints = constraintList_add(e->falseEnsuresConstraints, cons); } if (lltok_isGt_Op (tok)) { cons = constraint_makeEnsureGreaterThan (t1, t2, sequencePoint); e->trueEnsuresConstraints = constraintList_add(e->trueEnsuresConstraints, cons); cons = constraint_makeEnsureLessThanEqual (t1, t2, sequencePoint); e->falseEnsuresConstraints = constraintList_add(e->falseEnsuresConstraints, cons); } if (lltok_isLe_Op (tok)) { cons = constraint_makeEnsureLessThanEqual (t1, t2, sequencePoint); e->trueEnsuresConstraints = constraintList_add(e->trueEnsuresConstraints, cons); cons = constraint_makeEnsureGreaterThan (t1, t2, sequencePoint); e->falseEnsuresConstraints = constraintList_add(e->falseEnsuresConstraints, cons); } /* Logical operations */ if (lltok_isAndOp (tok)) { /* true ensures */ tempList = constraintList_copy (t1->trueEnsuresConstraints); tempList = constraintList_addList (tempList, t2->trueEnsuresConstraints); e->trueEnsuresConstraints = constraintList_addListFree(e->trueEnsuresConstraints, tempList); /* false ensures: fens t1 or tens t1 and fens t2 */ tempList = constraintList_copy (t1->trueEnsuresConstraints); tempList = constraintList_addList (tempList, t2->falseEnsuresConstraints); temp = tempList; tempList = constraintList_logicalOr (tempList, t1->falseEnsuresConstraints); constraintList_free (temp); /* evans - was constraintList_addList - memory leak detected by splint */ e->falseEnsuresConstraints = constraintList_addListFree (e->falseEnsuresConstraints, tempList); } else if (lltok_isOrOp (tok)) { /* false ensures */ tempList = constraintList_copy (t1->falseEnsuresConstraints); tempList = constraintList_addList (tempList, t2->falseEnsuresConstraints); e->falseEnsuresConstraints = constraintList_addListFree(e->falseEnsuresConstraints, tempList); /* true ensures: tens t1 or fens t1 and tens t2 */ tempList = constraintList_copy (t1->falseEnsuresConstraints); tempList = constraintList_addList (tempList, t2->trueEnsuresConstraints); temp = tempList; tempList = constraintList_logicalOr (tempList, t1->trueEnsuresConstraints); constraintList_free(temp); e->trueEnsuresConstraints = constraintList_addListFree(e->trueEnsuresConstraints, tempList); tempList = constraintList_undefined; } else { DPRINTF((message("%s is not a boolean operation", lltok_unparse(tok)))); } } void exprNode_exprTraverse (/*@dependent@*/ exprNode e, bool definatelv, bool definaterv, /*@observer@*/ /*@temp@*/ fileloc sequencePoint) { exprNode t1, t2, fcn; lltok tok; exprData data; constraint cons; constraintList temp; if (exprNode_isError(e)) { return; } DPRINTF (("exprNode_exprTraverse analyzing %s at %s", exprNode_unparse (e), fileloc_unparse (exprNode_loc (e)))); if (exprNode_isUnhandled (e)) { return; } data = e->edata; switch (e->kind) { case XPR_WHILEPRED: t1 = exprData_getSingle (data); exprNode_exprTraverse (t1, definatelv, definaterv, sequencePoint); e = exprNode_copyConstraints (e, t1); break; case XPR_FETCH: if (definatelv) { t1 = (exprData_getPairA (data)); t2 = (exprData_getPairB (data)); cons = constraint_makeWriteSafeExprNode (t1, t2); } else { t1 = (exprData_getPairA (data)); t2 = (exprData_getPairB (data)); cons = constraint_makeReadSafeExprNode (t1, t2); } e->requiresConstraints = constraintList_add(e->requiresConstraints, cons); cons = constraint_makeEnsureMaxReadAtLeast (t1, t2, sequencePoint); e->ensuresConstraints = constraintList_add(e->ensuresConstraints, cons); cons = constraint_makeEnsureLteMaxRead (t2, t1); e->trueEnsuresConstraints = constraintList_add(e->trueEnsuresConstraints, cons); exprNode_exprTraverse (exprData_getPairA (data), FALSE, TRUE, sequencePoint); exprNode_exprTraverse (exprData_getPairB (data), FALSE, TRUE, sequencePoint); break; case XPR_PARENS: exprNode_exprTraverse (exprData_getUopNode (e->edata), definatelv, definaterv, sequencePoint); break; case XPR_INIT: { t2 = exprData_getInitNode (data); DPRINTF (("initialization ==> %s",exprNode_unparse (t2))); exprNode_exprTraverse (t2, definatelv, TRUE, sequencePoint); /* This test is nessecary because some expressions generate a null expression node. function pointer do that -- drl */ if (!exprNode_isError (e) && !exprNode_isError (t2)) { cons = constraint_makeEnsureEqual (e, t2, sequencePoint); e->ensuresConstraints = constraintList_add(e->ensuresConstraints, cons); } } break; case XPR_ASSIGN: t1 = exprData_getOpA (data); t2 = exprData_getOpB (data); DPRINTF (("Assignment constraints t1: %s", constraintList_unparse (t1->ensuresConstraints))); DPRINTF (("Assignment constraints t2: %s", constraintList_unparse (t2->ensuresConstraints))); exprNode_exprTraverse (t1, TRUE, definaterv, sequencePoint); DPRINTF (("Assignment constraints t1: %s", constraintList_unparse (t1->ensuresConstraints))); DPRINTF (("Assignment constraints t2: %s", constraintList_unparse (t2->ensuresConstraints))); exprNode_exprTraverse (t2, definatelv, TRUE, sequencePoint); DPRINTF (("Assignment constraints t1: %s", constraintList_unparse (t1->ensuresConstraints))); DPRINTF (("Assignment constraints t2: %s", constraintList_unparse (t2->ensuresConstraints))); /* this test is nessecary because some expressions generate a null expression node. function pointer do that -- drl */ if ((!exprNode_isError (t1)) && (!exprNode_isError(t2))) { cons = constraint_makeEnsureEqual (t1, t2, sequencePoint); DPRINTF (("Ensure equal constraint: %s", constraint_unparse (cons))); e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons); DPRINTF (("Assignment constraints: %s", constraintList_unparse (e->ensuresConstraints))); } break; case XPR_OP: t1 = exprData_getOpA (data); t2 = exprData_getOpB (data); tok = exprData_getOpTok (data); if (lltok_getTok (tok) == ADD_ASSIGN) { exprNode_exprTraverse (t1, TRUE, definaterv, sequencePoint); exprNode_exprTraverse (t2, definatelv, TRUE, sequencePoint); cons = constraint_makeAddAssign (t1, t2, sequencePoint); e->ensuresConstraints = constraintList_add(e->ensuresConstraints, cons); } else if (lltok_getTok (tok) == SUB_ASSIGN) { exprNode_exprTraverse (t1, TRUE, definaterv, sequencePoint); exprNode_exprTraverse (t2, definatelv, TRUE, sequencePoint); cons = constraint_makeSubtractAssign (t1, t2, sequencePoint); e->ensuresConstraints = constraintList_add(e->ensuresConstraints, cons); } else { exprNode_exprTraverse (t1, definatelv, definaterv, sequencePoint); exprNode_exprTraverse (t2, definatelv, definaterv, sequencePoint); } if (lltok_isBoolean_Op (tok)) exprNode_booleanTraverse (e, definatelv, definaterv, sequencePoint); break; case XPR_SIZEOFT: /*drl 4-11-03 I think this is the same as the next case...*/ break; case XPR_SIZEOF: /* drl 7-16-01 C standard says operand to sizeof isn't evaluated unless its a variable length array. So we don't generate constraints. */ break; case XPR_CALL: fcn = exprData_getFcn(data); exprNode_exprTraverse (fcn, definatelv, definaterv, sequencePoint); DPRINTF (("Got call that %s (%s)", exprNode_unparse(fcn), exprNodeList_unparse (exprData_getArgs (data)))); llassert( exprNode_isDefined(fcn) ); fcn->requiresConstraints = constraintList_addListFree (fcn->requiresConstraints, checkCall (fcn, exprData_getArgs (data))); fcn->ensuresConstraints = constraintList_addListFree (fcn->ensuresConstraints, exprNode_getPostConditions(fcn, exprData_getArgs (data),e )); t1 = exprNode_createNew (exprNode_getType (e)); checkArgumentList (t1, exprData_getArgs(data), sequencePoint); exprNode_mergeResolve (e, t1, fcn); exprNode_free(t1); break; case XPR_RETURN: exprNode_exprTraverse (exprData_getSingle (data), definatelv, definaterv, sequencePoint); break; case XPR_NULLRETURN: break; case XPR_FACCESS: exprNode_exprTraverse (exprData_getFieldNode (data), definatelv, definaterv, sequencePoint); break; case XPR_ARROW: exprNode_exprTraverse (exprData_getFieldNode (data), definatelv, definaterv, sequencePoint); break; case XPR_STRINGLITERAL: break; case XPR_NUMLIT: break; case XPR_PREOP: t1 = exprData_getUopNode(data); /* drl 3/2/2003 we know this because of the type of expression*/ llassert( exprNode_isDefined(t1) ); tok = (exprData_getUopTok (data)); exprNode_exprTraverse (t1, definatelv, definaterv, sequencePoint); /*handle * pointer access */ if (lltok_isIncOp (tok)) { DPRINTF(("doing ++(var)")); t1 = exprData_getUopNode (data); cons = constraint_makeMaxSetSideEffectPostIncrement (t1, sequencePoint); e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons); } else if (lltok_isDecOp (tok)) { DPRINTF(("doing --(var)")); t1 = exprData_getUopNode (data); cons = constraint_makeMaxSetSideEffectPostDecrement (t1, sequencePoint); e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons); } else if (lltok_isMult(tok )) { if (definatelv) { cons = constraint_makeWriteSafeInt (t1, 0); } else { cons = constraint_makeReadSafeInt (t1, 0); } e->requiresConstraints = constraintList_add(e->requiresConstraints, cons); } else if (lltok_isNotOp (tok)) /* ! expr */ { constraintList_free(e->trueEnsuresConstraints); e->trueEnsuresConstraints = constraintList_copy (t1->falseEnsuresConstraints); constraintList_free(e->falseEnsuresConstraints); e->falseEnsuresConstraints = constraintList_copy (t1->trueEnsuresConstraints); } else if (lltok_isAmpersand_Op (tok)) { break; } else if (lltok_isMinus_Op (tok)) { break; } else if (lltok_isExcl_Op (tok)) { break; } else if (lltok_isTilde_Op (tok)) { break; } else { llcontbug (message("Unsupported preop in %s", exprNode_unparse(e))); BADEXIT; } break; case XPR_POSTOP: exprNode_exprTraverse (exprData_getUopNode (data), TRUE, definaterv, sequencePoint); if (lltok_isIncOp (exprData_getUopTok (data))) { DPRINTF(("doing ++")); t1 = exprData_getUopNode (data); cons = constraint_makeMaxSetSideEffectPostIncrement (t1, sequencePoint); e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons); } if (lltok_isDecOp (exprData_getUopTok (data))) { DPRINTF(("doing --")); t1 = exprData_getUopNode (data); cons = constraint_makeMaxSetSideEffectPostDecrement (t1, sequencePoint); e->ensuresConstraints = constraintList_add (e->ensuresConstraints, cons); } break; case XPR_CAST: { t2 = exprData_getCastNode (data); DPRINTF ((message ("Examining cast (%q)%s", qtype_unparse (exprData_getCastType (data)), exprNode_unparse (t2)) )); exprNode_exprTraverse (t2, definatelv, definaterv, sequencePoint); } break; case XPR_COND: { exprNode pred, trueBranch, falseBranch; llassert(FALSE); pred = exprData_getTriplePred (data); trueBranch = exprData_getTripleTrue (data); falseBranch = exprData_getTripleFalse (data); llassert (exprNode_isDefined (pred)); llassert (exprNode_isDefined (trueBranch)); llassert (exprNode_isDefined (falseBranch)); exprNode_exprTraverse (pred, FALSE, TRUE, sequencePoint); temp = pred->ensuresConstraints; pred->ensuresConstraints = exprNode_traverseEnsuresConstraints(pred); constraintList_free(temp); temp = pred->requiresConstraints; pred->requiresConstraints = exprNode_traverseRequiresConstraints(pred); constraintList_free(temp); temp = pred->trueEnsuresConstraints; pred->trueEnsuresConstraints = exprNode_traverseTrueEnsuresConstraints(pred); constraintList_free(temp); temp = pred->falseEnsuresConstraints; pred->falseEnsuresConstraints = exprNode_traverseFalseEnsuresConstraints(pred); constraintList_free(temp); exprNode_exprTraverse (trueBranch, FALSE, TRUE, sequencePoint); temp = trueBranch->ensuresConstraints; trueBranch->ensuresConstraints = exprNode_traverseEnsuresConstraints(trueBranch); constraintList_free(temp); temp = trueBranch->requiresConstraints; trueBranch->requiresConstraints = exprNode_traverseRequiresConstraints(trueBranch); constraintList_free(temp); temp = trueBranch->trueEnsuresConstraints; trueBranch->trueEnsuresConstraints = exprNode_traverseTrueEnsuresConstraints(trueBranch); constraintList_free(temp); temp = trueBranch->falseEnsuresConstraints; trueBranch->falseEnsuresConstraints = exprNode_traverseFalseEnsuresConstraints(trueBranch); constraintList_free(temp); exprNode_exprTraverse (falseBranch, FALSE, TRUE, sequencePoint); temp = falseBranch->ensuresConstraints; falseBranch->ensuresConstraints = exprNode_traverseEnsuresConstraints(falseBranch); constraintList_free(temp); temp = falseBranch->requiresConstraints; falseBranch->requiresConstraints = exprNode_traverseRequiresConstraints(falseBranch); constraintList_free(temp); temp = falseBranch->trueEnsuresConstraints; falseBranch->trueEnsuresConstraints = exprNode_traverseTrueEnsuresConstraints(falseBranch); constraintList_free(temp); temp = falseBranch->falseEnsuresConstraints; falseBranch->falseEnsuresConstraints = exprNode_traverseFalseEnsuresConstraints(falseBranch); constraintList_free(temp); /* if pred is true e equals true otherwise pred equals false */ cons = constraint_makeEnsureEqual (e, trueBranch, sequencePoint); trueBranch->ensuresConstraints = constraintList_add(trueBranch->ensuresConstraints, cons); cons = constraint_makeEnsureEqual (e, trueBranch, sequencePoint); falseBranch->ensuresConstraints = constraintList_add(falseBranch->ensuresConstraints, cons); e = doIfElse (e, pred, trueBranch, falseBranch); } break; case XPR_COMMA: llassert(FALSE); t1 = exprData_getPairA (data); t2 = exprData_getPairB (data); /* we essiantially treat this like expr1; expr2 of course sequencePoint isn't adjusted so this isn't completely accurate problems... */ exprNode_exprTraverse (t1, FALSE, FALSE, sequencePoint); exprNode_exprTraverse (t2, definatelv, definaterv, sequencePoint); exprNode_mergeResolve (e, t1, t2); break; default: break; } e->requiresConstraints = constraintList_preserveOrig (e->requiresConstraints); e->ensuresConstraints = constraintList_preserveOrig (e->ensuresConstraints); e->requiresConstraints = constraintList_addGeneratingExpr (e->requiresConstraints, e); e->ensuresConstraints = constraintList_addGeneratingExpr (e->ensuresConstraints, e); e->requiresConstraints = constraintList_removeSurpressed (e->requiresConstraints); DPRINTF (("ensures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed (e->ensuresConstraints))); DPRINTF (("Requires constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->ensuresConstraints))); DPRINTF (("trueEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->trueEnsuresConstraints))); DPRINTF (("falseEnsures constraints for %s are %s", exprNode_unparse(e), constraintList_unparseDetailed(e->falseEnsuresConstraints))); return; } constraintList exprNode_traverseTrueEnsuresConstraints (exprNode e) { exprNode t1; bool handledExprNode; exprData data; constraintList ret; if (exprNode_handleError (e)) { ret = constraintList_makeNew(); return ret; } ret = constraintList_copy (e->trueEnsuresConstraints); handledExprNode = TRUE; data = e->edata; switch (e->kind) { case XPR_WHILEPRED: t1 = exprData_getSingle (data); ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (t1)); break; case XPR_FETCH: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getPairA (data))); ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getPairB (data))); break; case XPR_PREOP: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_PARENS: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_INIT: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getInitNode (data))); break; case XPR_ASSIGN: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getOpB (data))); break; case XPR_OP: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getOpB (data))); break; case XPR_SIZEOFT: break; case XPR_SIZEOF: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getSingle (data))); break; case XPR_CALL: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getFcn (data))); break; case XPR_RETURN: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getSingle (data))); break; case XPR_NULLRETURN: break; case XPR_FACCESS: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getFieldNode (data))); break; case XPR_ARROW: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getFieldNode (data))); break; case XPR_STRINGLITERAL: break; case XPR_NUMLIT: break; case XPR_POSTOP: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_CAST: ret = constraintList_addListFree (ret, exprNode_traverseTrueEnsuresConstraints (exprData_getCastNode (data))); break; default: break; } return ret; } constraintList exprNode_traverseFalseEnsuresConstraints (exprNode e) { exprNode t1; bool handledExprNode; exprData data; constraintList ret; if (exprNode_handleError (e)) { ret = constraintList_makeNew(); return ret; } ret = constraintList_copy (e->falseEnsuresConstraints); handledExprNode = TRUE; data = e->edata; switch (e->kind) { case XPR_WHILEPRED: t1 = exprData_getSingle (data); ret = constraintList_addListFree (ret,exprNode_traverseFalseEnsuresConstraints (t1)); break; case XPR_FETCH: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getPairA (data))); ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getPairB (data))); break; case XPR_PREOP: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_PARENS: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_INIT: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints ( exprData_getInitNode (data))); break; case XPR_ASSIGN: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getOpB (data))); break; case XPR_OP: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getOpB (data))); break; case XPR_SIZEOFT: break; case XPR_SIZEOF: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getSingle (data))); break; case XPR_CALL: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getFcn (data))); break; case XPR_RETURN: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getSingle (data))); break; case XPR_NULLRETURN: break; case XPR_FACCESS: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getFieldNode (data))); break; case XPR_ARROW: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getFieldNode (data))); break; case XPR_STRINGLITERAL: break; case XPR_NUMLIT: break; case XPR_POSTOP: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_CAST: ret = constraintList_addListFree (ret, exprNode_traverseFalseEnsuresConstraints (exprData_getCastNode (data))); break; default: break; } return ret; } /* walk down the tree and get all requires Constraints in each subexpression*/ /*@only@*/ constraintList exprNode_traverseRequiresConstraints (exprNode e) { exprNode t1; bool handledExprNode; exprData data; constraintList ret; if (exprNode_handleError (e)) { ret = constraintList_makeNew(); return ret; } ret = constraintList_copy (e->requiresConstraints); handledExprNode = TRUE; data = e->edata; switch (e->kind) { case XPR_WHILEPRED: t1 = exprData_getSingle (data); ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (t1)); break; case XPR_FETCH: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getPairA (data))); ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getPairB (data))); break; case XPR_PREOP: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getUopNode (data))); break; case XPR_PARENS: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getUopNode (data))); break; case XPR_INIT: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getInitNode (data))); break; case XPR_ASSIGN: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getOpB (data))); break; case XPR_OP: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getOpB (data))); break; case XPR_SIZEOFT: break; case XPR_SIZEOF: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getSingle (data))); break; case XPR_CALL: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getFcn (data))); break; case XPR_RETURN: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getSingle (data))); break; case XPR_NULLRETURN: break; case XPR_FACCESS: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getFieldNode (data))); break; case XPR_ARROW: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getFieldNode (data))); break; case XPR_STRINGLITERAL: break; case XPR_NUMLIT: break; case XPR_POSTOP: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getUopNode (data))); break; case XPR_CAST: ret = constraintList_addListFree (ret, exprNode_traverseRequiresConstraints (exprData_getCastNode (data))); break; default: break; } return ret; } /* walk down the tree and get all Ensures Constraints in each subexpression*/ /*@only@*/ constraintList exprNode_traverseEnsuresConstraints (exprNode e) { exprNode t1; bool handledExprNode; exprData data; constraintList ret; if (exprNode_handleError (e)) { ret = constraintList_makeNew(); return ret; } ret = constraintList_copy (e->ensuresConstraints); handledExprNode = TRUE; data = e->edata; DPRINTF ((message ("exprnode_traversEnsuresConstraints call for %s with " "constraintList of %s", exprNode_unparse (e), constraintList_unparse(e->ensuresConstraints) ) )); switch (e->kind) { case XPR_WHILEPRED: t1 = exprData_getSingle (data); ret = constraintList_addListFree (ret,exprNode_traverseEnsuresConstraints (t1)); break; case XPR_FETCH: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getPairA (data))); ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getPairB (data))); break; case XPR_PREOP: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_PARENS: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_INIT: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getInitNode (data))); break; case XPR_ASSIGN: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getOpB (data))); break; case XPR_OP: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getOpA (data))); ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getOpB (data))); break; case XPR_SIZEOFT: break; case XPR_SIZEOF: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getSingle (data))); break; case XPR_CALL: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getFcn (data))); break; case XPR_RETURN: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getSingle (data))); break; case XPR_NULLRETURN: break; case XPR_FACCESS: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getFieldNode (data))); break; case XPR_ARROW: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getFieldNode (data))); break; case XPR_STRINGLITERAL: break; case XPR_NUMLIT: break; case XPR_POSTOP: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getUopNode (data))); break; case XPR_CAST: ret = constraintList_addListFree (ret, exprNode_traverseEnsuresConstraints (exprData_getCastNode (data))); break; default: break; } DPRINTF((message ("exprnode_traversEnsuresConstraints call for %s with " "constraintList of is returning %s", exprNode_unparse (e), constraintList_unparse(ret)))); return ret; } /*drl moved out of constraintResolve.c 07-02-001 */ void checkArgumentList (/*@out@*/ exprNode temp, exprNodeList arglist, fileloc sequencePoint) { llassert(temp != NULL ); temp->requiresConstraints = constraintList_makeNew(); temp->ensuresConstraints = constraintList_makeNew(); temp->trueEnsuresConstraints = constraintList_makeNew(); temp->falseEnsuresConstraints = constraintList_makeNew(); exprNodeList_elements (arglist, el) { constraintList temp2; llassert(exprNode_isDefined(el) ); exprNode_exprTraverse (el, FALSE, FALSE, sequencePoint); temp2 = el->requiresConstraints; el->requiresConstraints = exprNode_traverseRequiresConstraints(el); constraintList_free(temp2); temp2 = el->ensuresConstraints; el->ensuresConstraints = exprNode_traverseEnsuresConstraints(el); constraintList_free(temp2); temp->requiresConstraints = constraintList_addList(temp->requiresConstraints, el->requiresConstraints); temp->ensuresConstraints = constraintList_addList(temp->ensuresConstraints, el->ensuresConstraints); } end_exprNodeList_elements; } /*drl moved out of constraintResolve.c 07-03-001 */ constraintList exprNode_getPostConditions (exprNode fcn, exprNodeList arglist, exprNode fcnCall) { constraintList postconditions; uentry temp; DPRINTF((message ("Got call that %s (%s) ", exprNode_unparse(fcn), exprNodeList_unparse (arglist)))); temp = exprNode_getUentry (fcn); postconditions = uentry_getFcnPostconditions (temp); if (constraintList_isDefined (postconditions)) { postconditions = constraintList_doSRefFixConstraintParam (postconditions, arglist); postconditions = constraintList_doFixResult (postconditions, fcnCall); } else { postconditions = constraintList_makeNew(); } return postconditions; } /* comment this out for now we'll include it in a production release when its stable... void findStructs (exprNodeList arglist) { ctype ct, rt; DPRINTF(( message("doing findStructs: %s", exprNodeList_unparse(arglist)) )); exprNodeList_elements(arglist, expr) { ct = exprNode_getType(expr); rt = ctype_realType (ct); if (ctype_isStruct (rt)) DPRINTF((message("Found structure %s", exprNode_unparse(expr)) )); if (hasInvariants(ct)) { constraintList invars; invars = getInvariants(ct); DPRINTF((message ("findStructs has invariants %s ", constraintList_unparse (invars)) )); invars = constraintList_doSRefFixStructConstraint(invars, exprNode_getSref(expr), ct); DPRINTF((message ("findStructs finded invariants to be %s ", constraintList_unparse (invars)) )); } } end_exprNodeList_elements; } */ /*drl moved out of constraintResolve.c 07-02-001 */ constraintList checkCall (/*@dependent@*/ exprNode fcn, exprNodeList arglist) { constraintList preconditions; uentry temp; DPRINTF((message ("Got call that %s (%s) ", exprNode_unparse(fcn), exprNodeList_unparse (arglist)))); temp = exprNode_getUentry (fcn); preconditions = uentry_getFcnPreconditions (temp); if (constraintList_isDefined(preconditions)) { preconditions = constraintList_togglePost (preconditions); preconditions = constraintList_preserveCallInfo(preconditions, fcn); preconditions = constraintList_doSRefFixConstraintParam (preconditions, arglist); } else { if (constraintList_isUndefined(preconditions)) preconditions = constraintList_makeNew(); } if (context_getFlag (FLG_IMPBOUNDSCONSTRAINTS)) { /* uentryList_elements (arglist, el) { sRef s; DPRINTF((message("setImplicitfcnConstraints doing: %s", uentry_unparse(el) ) )); s = uentry_getSref(el); if (sRef_isReference (s) ) { DPRINTF((message ("%s is a pointer", sRef_unparse(s) ) )); } else { DPRINTF((message ("%s is NOT a pointer", sRef_unparse(s) ) )); } //drl 4/26/01 //chagned this from MaxSet(s) == 0 to MaxSet(s) >= 0 c = constraint_makeSRefWriteSafeInt (s, 0); implicitFcnConstraints = constraintList_add(implicitFcnConstraints , c); //drl 10/23/2002 added support for out if (!uentry_isOut(el) ) { c = constraint_makeSRefReadSafeInt (s, 0); implicitFcnConstraints = constraintList_add(implicitFcnConstraints , c); } } */ } DPRINTF ((message("Done checkCall\n"))); DPRINTF ((message("Returning list %q ", constraintList_unparseDetailed(preconditions)))); /* drl we're going to comment this out for now we'll include it if we're sure it's working findStructs(arglist); */ return preconditions; } /*drl added this function 10.29.001 takes an exprNode of the form const + const and sets the value */ /*drl I'm a bit nervous about modifying the exprNode but this is the easy way to do this If I have time I'd like to cause the exprNode to get created correctly in the first place */ void exprNode_findValue(exprNode e) { exprData data; exprNode t1, t2; lltok tok; llassert(exprNode_isDefined(e) ); data = e->edata; if (exprNode_hasValue(e)) return; if (e->kind == XPR_OP) { t1 = exprData_getOpA (data); t2 = exprData_getOpB (data); tok = exprData_getOpTok (data); exprNode_findValue(t1); exprNode_findValue(t2); if (!(exprNode_knownIntValue(t1) && (exprNode_knownIntValue(t2)))) return; if (lltok_isPlus_Op (tok)) { long v1, v2; v1 = exprNode_getLongValue(t1); v2 = exprNode_getLongValue(t2); if (multiVal_isDefined(e->val)) multiVal_free (e->val); e->val = multiVal_makeInt (v1 + v2); } if (lltok_isMinus_Op (tok)) { long v1, v2; v1 = exprNode_getLongValue(t1); v2 = exprNode_getLongValue(t2); if (multiVal_isDefined(e->val)) { multiVal_free (e->val); } e->val = multiVal_makeInt (v1 - v2); } /*drl I should really do * and / at some point */ } } splint-3.1.2.dfsg1/src/constraintTerm.c0000644021234200000250000003732507671022267015435 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** constraintTerm.c */ /* #define DEBUGPRINT 1 */ # include /* for isdigit */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" bool constraintTerm_isDefined (constraintTerm t) { return t != NULL; } void constraintTerm_free (/*@only@*/ constraintTerm term) { llassert (constraintTerm_isDefined (term)); fileloc_free (term->loc); switch (term->kind) { case CTT_EXPR: /* we don't free an exprNode*/ break; case CTT_SREF: /* sref */ sRef_free (term->value.sref); break; case CTT_INTLITERAL: /* don't free an int */ break; case CTT_ERRORBADCONSTRAINTTERMTYPE: default: /* type was set incorrectly */ llcontbug (message("constraintTerm_free type was set incorrectly")); } term->kind = CTT_ERRORBADCONSTRAINTTERMTYPE; free (term); } /*@only@*/ static/*@out@*/ constraintTerm new_constraintTermExpr (void) { constraintTerm ret; ret = dmalloc (sizeof (* ret ) ); ret->value.intlit = 0; return ret; } bool constraintTerm_isIntLiteral (constraintTerm term) { llassert(term != NULL); if (term->kind == CTT_INTLITERAL) return TRUE; return FALSE; } bool constraintTerm_isInitBlock (/*@observer@*/ /*@temp@*/ constraintTerm c) /*@*/ { llassert (c != NULL); if (c->kind == CTT_EXPR) { if (exprNode_isInitBlock (c->value.expr)) { return TRUE; } } return FALSE; } bool constraintTerm_isExprNode (/*@observer@*/ /*@temp@*/ constraintTerm c) /*@*/ { llassert (c != NULL); if (c->kind == CTT_EXPR) { return TRUE; } return FALSE; } /*@access exprNode@*/ int constraintTerm_getInitBlockLength (/*@observer@*/ /*@temp@*/ constraintTerm c) /*@*/ { exprNodeList list; int ret; llassert (c != NULL); llassert (constraintTerm_isInitBlock (c) ); llassert (c->kind == CTT_EXPR); llassert(exprNode_isDefined(c->value.expr) ); if (exprNode_isUndefined(c->value.expr) ) { return 1; } if (c->value.expr->edata == exprData_undefined) { return 1; } list = exprData_getArgs(c->value.expr->edata); ret = exprNodeList_size(list); return ret; } /*@noaccess exprNode@*/ bool constraintTerm_isStringLiteral (constraintTerm c) /*@*/ { llassert (c != NULL); if (c->kind == CTT_EXPR) { if (exprNode_knownStringValue(c->value.expr) ) { return TRUE; } } return FALSE; } cstring constraintTerm_getStringLiteral (constraintTerm c) { llassert (c != NULL); llassert (constraintTerm_isStringLiteral (c) ); llassert (c->kind == CTT_EXPR); return (cstring_copy ( multiVal_forceString (exprNode_getValue (c->value.expr) ) ) ); } constraintTerm constraintTerm_simplify (/*@returned@*/ constraintTerm term) /*@modifies term@*/ { if (term->kind == CTT_EXPR) { if ( exprNode_knownIntValue (term->value.expr ) ) { long int temp; temp = exprNode_getLongValue (term->value.expr); term->value.intlit = (int)temp; term->kind = CTT_INTLITERAL; } } return term; } fileloc constraintTerm_getFileloc (constraintTerm t) { llassert (constraintTerm_isDefined (t)); return (fileloc_copy (t->loc) ); } constraintTermType constraintTerm_getKind (constraintTerm t) { llassert (constraintTerm_isDefined(t) ); return (t->kind); } /*@exposed@*/ sRef constraintTerm_getSRef (constraintTerm t) { llassert (constraintTerm_isDefined(t) ); llassert (t->kind == CTT_SREF); return (t->value.sref); } /*@only@*/ constraintTerm constraintTerm_makeExprNode (/*@dependent@*/ exprNode e) { constraintTerm ret = new_constraintTermExpr (); ret->loc = fileloc_copy (exprNode_loc (e)); ret->value.expr = e; ret->kind = CTT_EXPR; ret = constraintTerm_simplify (ret); return ret; } /*@only@*/ constraintTerm constraintTerm_makesRef (/*@temp@*/ /*@observer@*/ sRef s) { constraintTerm ret = new_constraintTermExpr(); ret->loc = fileloc_undefined; ret->value.sref = sRef_saveCopy(s); ret->kind = CTT_SREF; ret = constraintTerm_simplify(ret); return ret; } constraintTerm constraintTerm_copy (constraintTerm term) { constraintTerm ret; ret = new_constraintTermExpr(); ret->loc = fileloc_copy (term->loc); switch (term->kind) { case CTT_EXPR: ret->value.expr = term->value.expr; break; case CTT_INTLITERAL: ret->value.intlit = term->value.intlit; break; case CTT_SREF: ret->value.sref = sRef_saveCopy(term->value.sref); break; default: BADEXIT; } ret->kind = term->kind; return ret; } constraintTerm constraintTerm_setFileloc (/*@returned@*/ constraintTerm term, fileloc loc) { llassert(term != NULL); if ( fileloc_isDefined( term->loc ) ) fileloc_free(term->loc); term->loc = fileloc_copy(loc); return term; } static cstring constraintTerm_getName (constraintTerm term) { cstring s; s = cstring_undefined; llassert (term != NULL); switch (term->kind) { case CTT_EXPR: s = message ("%s", exprNode_unparse (term->value.expr) ); break; case CTT_INTLITERAL: s = message (" %d ", (int) term->value.intlit); break; case CTT_SREF: s = message ("%q", sRef_unparse (term->value.sref) ); break; default: BADEXIT; /*@notreached@*/ break; } return s; } constraintTerm constraintTerm_doSRefFixBaseParam (/*@returned@*/constraintTerm term, exprNodeList arglist) /*@modifies term@*/ { llassert (term != NULL); switch (term->kind) { case CTT_EXPR: break; case CTT_INTLITERAL: break; case CTT_SREF: term->value.sref = sRef_fixBaseParam (term->value.sref, arglist); break; default: BADEXIT; } return term; } cstring constraintTerm_unparse (constraintTerm term) /*@*/ { cstring s; s = cstring_undefined; llassert (term != NULL); switch (term->kind) { case CTT_EXPR: s = message ("%s @ %q", exprNode_unparse (term->value.expr), fileloc_unparse (term->loc) ); break; case CTT_INTLITERAL: s = message ("%d", (int)term->value.intlit); break; case CTT_SREF: s = message ("%q", sRef_unparseDebug (term->value.sref) ); break; default: BADEXIT; } return s; } constraintTerm constraintTerm_makeIntLiteral (long i) { constraintTerm ret = new_constraintTermExpr(); ret->value.intlit = i; ret->kind = CTT_INTLITERAL; ret->loc = fileloc_undefined; return ret; } bool constraintTerm_canGetValue (constraintTerm term) { if (term->kind == CTT_INTLITERAL) { return TRUE; } else if (term->kind == CTT_SREF) { if (sRef_hasValue (term->value.sref)) { multiVal mval = sRef_getValue (term->value.sref); return multiVal_isInt (mval); /* for now, only try to deal with int values */ } else { return FALSE; } } else if (term->kind == CTT_EXPR) { return FALSE; } else { return FALSE; } } void constraintTerm_setValue (constraintTerm term, long value) { if (term->kind == CTT_INTLITERAL) { term->value.intlit = value; } else { BADBRANCH; } } long constraintTerm_getValue (constraintTerm term) { llassert (constraintTerm_canGetValue (term)); if (term->kind == CTT_INTLITERAL) { return term->value.intlit; } else if (term->kind == CTT_SREF) { if (sRef_hasValue (term->value.sref)) { multiVal mval = sRef_getValue (term->value.sref); return multiVal_forceInt (mval); /* for now, only try to deal with int values */ } else { BADBRANCH; } } else if (term->kind == CTT_EXPR) { BADBRANCH; } else { BADBRANCH; } BADEXIT; } /*drl added this 10.30.001 */ /*@exposed@*/ exprNode constraintTerm_getExprNode (constraintTerm t) { llassert (t != NULL); llassert (t->kind == CTT_EXPR); return t->value.expr; } /*@exposed@*/ sRef constraintTerm_getsRef (constraintTerm t) { llassert (t != NULL); if (t->kind == CTT_EXPR) { return exprNode_getSref(t->value.expr); } if (t->kind == CTT_SREF) { return t->value.sref; } return sRef_undefined; } bool constraintTerm_probSame (constraintTerm term1, constraintTerm term2) { cstring s1, s2; llassert (term1 !=NULL && term2 !=NULL); DPRINTF ((message ("Comparing srefs for %s and %s ", constraintTerm_print(term1), constraintTerm_print(term2) ) ) ); s1 = constraintTerm_getName (term1); s2 = constraintTerm_getName (term2); if (cstring_equal (s1, s2) ) { DPRINTF ((message (" %q and %q are same", s1, s2 ) ) ); return TRUE; } else { DPRINTF ((message (" %q and %q are not same", s1, s2 ) ) ); return FALSE; } } bool constraintTerm_similar (constraintTerm term1, constraintTerm term2) { sRef s1, s2; llassert (term1 !=NULL && term2 !=NULL); if (constraintTerm_canGetValue (term1) && constraintTerm_canGetValue (term2)) /*3/30/2003 comment updated to reflect name change form INTLITERAL to CTT_INTLITERAL*/ /* evans 2001-07-24: was (term1->kind == CTT_INTLITERAL) && (term2->kind == CTT_INTLITERAL) ) */ { long t1, t2; t1 = constraintTerm_getValue (term1); t2 = constraintTerm_getValue (term2); return (t1 == t2); } /*drl this if statement handles the case where constraintTerm_canGetValue only returns true for term1 or term2 but no both if constraintTerm_canGetValue returned tru for both we would have returned in the previous if statement I suppose this could be done with xor but I've never used xor and don't feel like starting now besides this way is more effecient. */ if (constraintTerm_canGetValue (term1) || constraintTerm_canGetValue (term2)) { return FALSE; } s1 = constraintTerm_getsRef (term1); s2 = constraintTerm_getsRef (term2); if (!(sRef_isValid(s1) && sRef_isValid(s2))) { return FALSE; } DPRINTF((message ("Comparing srefs for %s and %s ", constraintTerm_print(term1), constraintTerm_print(term2) ) ) ); if (sRef_similarRelaxed(s1, s2) || sRef_sameName (s1, s2) ) { DPRINTF ((message (" %s and %s are same", constraintTerm_print(term1), constraintTerm_print(term2) ) )); return TRUE; } else { DPRINTF ((message (" %s and %s are not same", constraintTerm_print(term1), constraintTerm_print(term2) ) )); return FALSE; } } void constraintTerm_dump (/*@observer@*/ constraintTerm t, FILE *f) { fileloc loc; constraintTermValue value; constraintTermType kind; uentry u; loc = t->loc; value = t->value; kind = t->kind; fprintf(f, "%d\n", (int) kind); switch (kind) { case CTT_EXPR: u = exprNode_getUentry(t->value.expr); fprintf (f, "%s\n", cstring_toCharsSafe (uentry_rawName (u))); break; case CTT_SREF: { sRef s; s = t->value.sref; if (sRef_isResult (s ) ) { fprintf(f, "Result\n"); } else if (sRef_isParam (s)) { int param; ctype ct; cstring ctString; ct = sRef_getType (s); param = sRef_getParam(s); ctString = ctype_dump(ct); fprintf(f, "Param %s %d\n", cstring_toCharsSafe(ctString), (int) param ); cstring_free(ctString); } else if (sRef_isField (s) ) { fprintf(f, "sRef_dump %s\n", cstring_toCharsSafe(sRef_dump(s)) ); } else { u = sRef_getUentry(s); fprintf (f, "%s\n", cstring_toCharsSafe (uentry_rawName (u))); } } break; case CTT_INTLITERAL: fprintf (f, "%ld\n", t->value.intlit); break; default: BADEXIT; } } /*@only@*/ constraintTerm constraintTerm_undump (FILE *f) { constraintTermType kind; constraintTerm ret; uentry ue; char *str; char *os; os = mstring_create (MAX_DUMP_LINE_LENGTH); str = fgets (os, MAX_DUMP_LINE_LENGTH, f); llassert (str != NULL); kind = (constraintTermType) reader_getInt(&str); str = fgets(os, MAX_DUMP_LINE_LENGTH, f); llassert (str != NULL); switch (kind) { case CTT_SREF: { sRef s; char * term; term = reader_getWord(&str); if (term == NULL) { llfatalbug (message ("Library file appears to be corrupted.") ); } if (strcmp (term, "Result") == 0 ) { s = sRef_makeResult (ctype_unknown); } else if (strcmp (term, "Param" ) == 0 ) { int param; char *str2, *ostr2; ctype t; reader_checkChar(&str, ' '); str2 = reader_getWord(&str); param = reader_getInt(&str); if (str2 == NULL) { llfatalbug (message ("Library file appears to be corrupted.") ); } ostr2 = str2; t = ctype_undump(&str2) ; s = sRef_makeParam (param, t, stateInfo_makeLoc (g_currentloc, SA_CREATED)); free (ostr2); } else if (strcmp (term, "sRef_dump" ) == 0 ) { reader_checkChar(&str, ' '); s = sRef_undump (&str); } else /* This must be an identified that we can search for in usymTab */ { cstring termStr = cstring_makeLiteralTemp(term); ue = usymtab_lookup (termStr); s = uentry_getSref(ue); } ret = constraintTerm_makesRef(s); free(term); } break; case CTT_EXPR: { sRef s; char * term; cstring termStr; term = reader_getWord(&str); if (term == NULL) { llfatalbug (message ("Library file appears to be corrupted.") ); } /* This must be an identifier that we can search for in usymTab */ termStr = cstring_makeLiteralTemp(term); ue = usymtab_lookup (termStr); s = uentry_getSref(ue); ret = constraintTerm_makesRef(s); free (term); } break; case CTT_INTLITERAL: { int i; i = reader_getInt(&str); ret = constraintTerm_makeIntLiteral (i); } break; default: BADEXIT; } free (os); return ret; } /* drl added sometime before 10/17/001*/ ctype constraintTerm_getCType (constraintTerm term) { ctype ct; switch (term->kind) { case CTT_EXPR: ct = exprNode_getType (term->value.expr); break; case CTT_INTLITERAL: ct = ctype_signedintegral; break; case CTT_SREF: ct = sRef_getType (term->value.sref) ; break; default: BADEXIT; } return ct; } bool constraintTerm_isConstantOnly (constraintTerm term) { switch (term->kind) { case CTT_EXPR: if (exprNode_isNumLiteral (term->value.expr) || exprNode_isStringLiteral (term->value.expr) || exprNode_isCharLiteral (term->value.expr) ) { return TRUE; } else { return FALSE; } case CTT_INTLITERAL: return TRUE; case CTT_SREF: if ( sRef_isConst (term->value.sref) ) { return TRUE; } else { return FALSE; } default: BADEXIT; } BADEXIT; } splint-3.1.2.dfsg1/src/constraintExprData.c0000644021234200000250000001426407671271603016233 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** constraintExprData.c */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" static /*@out@*/ constraintExprData constraintExprData_alloc (void) { constraintExprData ret; ret = dmalloc (sizeof (*ret) ); return ret; } static /*@out@*/ constraintExprData constraintExprData_allocBinaryOp (void) { constraintExprData ret; ret = constraintExprData_alloc(); ret->binaryOp.expr1 = constraintExpr_undefined; ret->binaryOp.expr2 = constraintExpr_undefined; return ret; } static /*@out@*/ constraintExprData constraintExprData_allocUnaryOp (void) { constraintExprData ret; ret = constraintExprData_alloc(); ret->unaryOp.expr = constraintExpr_undefined; return ret; } static /*@out@*/ constraintExprData constraintExprData_allocTerm (void) { constraintExprData ret; ret = constraintExprData_alloc(); ret->term = NULL; return ret; } void constraintExprData_freeBinaryExpr (/*@only@*/constraintExprData data) { constraintExpr_free (data->binaryOp.expr1); constraintExpr_free (data->binaryOp.expr2); free(data); } constraintExprData constraintExprData_copyBinaryExpr(/*@observer@*/ constraintExprData data) { constraintExprData ret; llassert(constraintExprData_isDefined(data)); ret = constraintExprData_allocBinaryOp(); ret->binaryOp.binaryOp = data->binaryOp.binaryOp; ret->binaryOp.expr1 = constraintExpr_copy (data->binaryOp.expr1); ret->binaryOp.expr2 = constraintExpr_copy (data->binaryOp.expr2); return ret; } void constraintExprData_freeUnaryExpr (/*@only@*/constraintExprData data) { constraintExpr_free (data->unaryOp.expr); free(data); } constraintExprData constraintExprData_copyUnaryExpr(/*@observer@*/ constraintExprData data) { constraintExprData ret; llassert(constraintExprData_isDefined(data)); ret = constraintExprData_allocUnaryOp(); ret->unaryOp.unaryOp = data->unaryOp.unaryOp; ret->unaryOp.expr = constraintExpr_copy (data->unaryOp.expr); return ret; } void constraintExprData_freeTerm (/*@only@*/constraintExprData data) { constraintTerm_free (data->term); free(data); } constraintExprData constraintExprData_copyTerm (/*@observer@*/ constraintExprData data) { constraintExprData ret; llassert(constraintExprData_isDefined(data)); ret = constraintExprData_allocTerm(); ret->term = constraintTerm_copy (data->term); return ret; } constraintExprData constraintExprData_termSetTerm (/*@returned@*/ constraintExprData data, /*@only@*/ constraintTerm term) { llassert (constraintExprData_isDefined (data)); if (constraintTerm_isDefined (data->term)) { constraintTerm_free (data->term); } data->term = term; return data; } /*@exposed@*/ constraintTerm constraintExprData_termGetTerm (/*@observer@*/ constraintExprData data) { llassert (constraintExprData_isDefined (data)); return data->term; } constraintExprUnaryOpKind constraintExprData_unaryExprGetOp (/*@observer@*/ constraintExprData data) { llassert (constraintExprData_isDefined (data)); return (data->unaryOp.unaryOp); } constraintExpr constraintExprData_unaryExprGetExpr (/*@observer@*/ constraintExprData data) { llassert (constraintExprData_isDefined (data)); return (data->unaryOp.expr); } constraintExprData constraintExprData_unaryExprSetOp (/*@returned@*/ constraintExprData data, constraintExprUnaryOpKind op) { llassert (constraintExprData_isDefined (data)); data->unaryOp.unaryOp = op; return data; } constraintExprData constraintExprData_unaryExprSetExpr (constraintExprData data, /*@only@*/ constraintExpr expr) { llassert (constraintExprData_isDefined (data)); if (constraintExpr_isDefined (data->unaryOp.expr)) { constraintExpr_free (data->unaryOp.expr); } data->unaryOp.expr = expr; return data; } /* ** binaryExpr stuff */ constraintExprBinaryOpKind constraintExprData_binaryExprGetOp (constraintExprData data) { llassert (constraintExprData_isDefined (data)); return (data->binaryOp.binaryOp); } constraintExpr constraintExprData_binaryExprGetExpr1 (constraintExprData data) { llassert (constraintExprData_isDefined (data)); return (data->binaryOp.expr1); } constraintExpr constraintExprData_binaryExprGetExpr2 (constraintExprData data) { llassert (constraintExprData_isDefined(data)); return (data->binaryOp.expr2); } constraintExprData constraintExprData_binaryExprSetExpr1 (/*@returned@*/ constraintExprData data, /*@only@*/ constraintExpr expr) { llassert (constraintExprData_isDefined (data)); if (constraintExpr_isDefined (data->binaryOp.expr1)) constraintExpr_free(data->binaryOp.expr1); data->binaryOp.expr1 = expr; return data; } constraintExprData constraintExprData_binaryExprSetExpr2 (constraintExprData data, constraintExpr expr) { llassert (constraintExprData_isDefined (data)); if (constraintExpr_isDefined (data->binaryOp.expr2)) constraintExpr_free (data->binaryOp.expr2); data->binaryOp.expr2 = expr; return data; } constraintExprData constraintExprData_binaryExprSetOp (constraintExprData data, constraintExprBinaryOpKind op) { llassert (constraintExprData_isDefined (data)); data->binaryOp.binaryOp = op; return data; } splint-3.1.2.dfsg1/src/constraintExpr.c0000644021234200000250000020666707765024013015446 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** constraintExpr.c */ /* #define DEBUGPRINT 1 */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" static ctype constraintExpr_getOrigType (constraintExpr p_e); static bool constraintExpr_hasTypeChange(constraintExpr p_e) /*@*/; static /*@only@*/ constraintExpr constraintExpr_makeBinaryOpConstraintExprIntLiteral (/*@only@*/constraintExpr p_expr, int p_literal); /*@only@*/ static constraintExpr doSRefFixInvarConstraintTerm (/*@only@*/ constraintExpr p_e, sRef p_s, ctype p_ct); /*@only@*/ static constraintExpr doSRefFixConstraintParamTerm (/*@only@*/ constraintExpr p_e, /*@temp@*/ /*@observer@*/ exprNodeList p_arglist) /*@modifies p_e@*/; static /*@only@*/ constraintExpr doFixResultTerm (/*@only@*/ constraintExpr p_e, /*@exposed@*/ exprNode p_fcnCall) /*@modifies p_e@*/; static bool constraintExpr_canGetCType (constraintExpr p_e) /*@*/; static ctype constraintExpr_getCType (constraintExpr p_e); static /*@only@*/ constraintExpr constraintExpr_adjustMaxSetForCast (/*@only@*/ constraintExpr p_e, ctype p_tfrom, ctype p_tto, fileloc p_loc); /*@special@*/ /*@notnull@*/ static constraintExpr constraintExpr_makeBinaryOp (void) /* @allocates result->data @ @sets result->kind @ */ ; void constraintExpr_free (/*@only@*/ constraintExpr expr) { if (constraintExpr_isDefined(expr) ) { switch (expr->kind) { case unaryExpr: constraintExprData_freeUnaryExpr(expr->data); break; case binaryexpr: constraintExprData_freeBinaryExpr(expr->data); break; case term: constraintExprData_freeTerm(expr->data); break; default: BADEXIT; } expr->data = NULL; free (expr); } else { llcontbug(message("attempted to free null pointer in constraintExpr_free")); } } bool constraintExpr_isLit (constraintExpr expr) { llassert (expr != NULL); if (expr->kind == term) { constraintTerm term = constraintExprData_termGetTerm (expr->data); if (constraintTerm_isIntLiteral (term) ) { return TRUE; } } return FALSE; } static bool isZeroBinaryOp (constraintExpr expr) { constraintExpr e2; llassert (expr != NULL); /* evans 2001-07-18 */ if (!constraintExpr_isBinaryExpr (expr) ) { return FALSE; } e2 = constraintExprData_binaryExprGetExpr2(expr->data); llassert (e2 != NULL); /* evans 2001-07-18 */ if (constraintExpr_isBinaryExpr (e2) ) { constraintExpr e1; constraintExprBinaryOpKind op; op = constraintExprData_binaryExprGetOp (e2->data); e1 = constraintExprData_binaryExprGetExpr1(e2->data); if (constraintExpr_isLit(e1) ) { if (constraintExpr_getValue(e1) == 0 ) { return TRUE; } } } return FALSE; } /* change expr + (o - expr) to (expr -expr) */ /*@only@*/ /*@notnull@*/ static constraintExpr removeZero (/*@only@*/ /*@returned@*/ constraintExpr expr) { constraintExpr expr1, expr2; constraintExpr temp; constraintExprBinaryOpKind op; constraintExprBinaryOpKind tempOp; llassert (expr != NULL); /* evans 2001-07-18 */ if (!isZeroBinaryOp(expr) ) return expr; expr1 = constraintExprData_binaryExprGetExpr1(expr->data); expr2 = constraintExprData_binaryExprGetExpr2(expr->data); op = constraintExprData_binaryExprGetOp(expr->data); llassert( constraintExpr_isBinaryExpr(expr2) ); temp = constraintExprData_binaryExprGetExpr2 (expr2->data); temp = constraintExpr_copy (temp); tempOp = constraintExprData_binaryExprGetOp (expr2->data); if (op == BINARYOP_PLUS) op = tempOp; else if (op == BINARYOP_MINUS) { if (tempOp == BINARYOP_PLUS) op = BINARYOP_MINUS; else if (tempOp == BINARYOP_MINUS) op = BINARYOP_PLUS; else BADEXIT; } else BADEXIT; expr->data = constraintExprData_binaryExprSetExpr2(expr->data, temp); expr->data = constraintExprData_binaryExprSetOp(expr->data, op); return expr; } /*@only@*//*@notnull@*/ constraintExpr constraintExpr_propagateConstants (/*@only@*/ constraintExpr expr, /*@out@*/ bool * propagate, /*@out@*/ int *literal) { constraintExpr expr1; constraintExpr expr2; bool propagate1, propagate2; int literal1, literal2; constraintExprBinaryOpKind op; propagate1 = FALSE; propagate2 = FALSE; literal1 = 0; literal2 = 0; *propagate = FALSE; *literal = 0; llassert (expr != NULL); /* we simplify unaryExpr elsewhere */ if (expr->kind != binaryexpr) return expr; op = constraintExprData_binaryExprGetOp (expr->data); DPRINTF((message("constraintExpr_propagateConstants: binaryexpr: %s", constraintExpr_unparse(expr) ) ) ); expr = removeZero(expr); expr1 = constraintExprData_binaryExprGetExpr1(expr->data); expr2 = constraintExprData_binaryExprGetExpr2(expr->data); expr1 = constraintExpr_copy(expr1); expr2 = constraintExpr_copy(expr2); expr1 = constraintExpr_propagateConstants (expr1, &propagate1, &literal1); expr2 = constraintExpr_propagateConstants (expr2, &propagate2, &literal2); expr1 = removeZero(expr1); expr2 = removeZero(expr2); *propagate = propagate1 || propagate2; if (op == BINARYOP_PLUS) *literal = literal1 + literal2; else if (op == BINARYOP_MINUS) *literal = literal1 - literal2; else BADEXIT; if ( constraintExpr_isLit (expr1) && constraintExpr_isLit (expr2) ) { long t1, t2; t1 = constraintExpr_getValue (expr1); t2 = constraintExpr_getValue (expr2); llassert(*propagate == FALSE); *propagate = FALSE; constraintExpr_free (expr); constraintExpr_free (expr1); constraintExpr_free (expr2); if (op == BINARYOP_PLUS ) return (constraintExpr_makeIntLiteral ((t1+t2) )); else if (op == BINARYOP_MINUS) return (constraintExpr_makeIntLiteral ((t1-t2) )); else BADEXIT; } if (constraintExpr_isLit (expr1) ) { *propagate = TRUE; *literal += constraintExpr_getValue (expr1); if (op == BINARYOP_PLUS) { constraintExpr_free(expr1); constraintExpr_free(expr); return expr2; } else if (op == BINARYOP_MINUS) { constraintExpr temp; /* this is an ugly kludge to deal with not having a unary minus operation...*/ temp = constraintExpr_makeIntLiteral (0); temp = constraintExpr_makeSubtractExpr (temp, expr2); constraintExpr_free(expr1); constraintExpr_free(expr); llassert (constraintExpr_isDefined(temp) ); return temp; } else { BADBRANCH; /* evans 2001-07-18 */ } } if (constraintExpr_isLit (expr2) ) { *propagate = TRUE; if ( op == BINARYOP_PLUS ) *literal += constraintExpr_getValue (expr2); else if (op == BINARYOP_MINUS) *literal -= constraintExpr_getValue (expr2); else BADEXIT; constraintExpr_free(expr2); constraintExpr_free(expr); return expr1; } DPRINTF((message("constraintExpr_propagateConstants returning: %s", constraintExpr_unparse(expr) ) ) ); expr->data = constraintExprData_binaryExprSetExpr1 (expr->data, expr1); expr->data = constraintExprData_binaryExprSetExpr2 (expr->data, expr2); expr = removeZero(expr); return expr; } /*@notnull@*/ /*@only@*/ static constraintExpr constraintExpr_combineConstants (/*@only@*/ constraintExpr expr ) /*@modifies expr@*/ { bool propagate; int literal; DPRINTF ((message ("Before combine %s", constraintExpr_unparse(expr) ) ) ); expr = constraintExpr_propagateConstants (expr, &propagate, &literal); if (propagate) { constraintExpr ret; if (literal != 0) { ret = constraintExpr_makeBinaryOpConstraintExprIntLiteral (expr, literal); expr = ret; } } DPRINTF ((message ("After combine %s", constraintExpr_unparse(expr) ) ) ); llassert(constraintExpr_isDefined(expr) ); return expr; } /*@special@*/ static /*@notnull@*/ constraintExpr constraintExpr_alloc (void) /*@post:isnull result->data@*/ { constraintExpr ret; ret = dmalloc (sizeof (*ret) ); ret->kind = term; ret->data = NULL; ret->ct = FALSE; ret->origType = ctype_undefined; return ret; } /*@only@*/ static constraintExprData copyExprData (/*@observer@*/ constraintExprData data, constraintExprKind kind) { constraintExprData ret; llassert(constraintExprData_isDefined(data)); switch (kind) { case binaryexpr: ret = constraintExprData_copyBinaryExpr(data); break; case unaryExpr: ret = constraintExprData_copyUnaryExpr(data); break; case term: ret = constraintExprData_copyTerm(data); break; default: BADEXIT; } return ret; } constraintExpr constraintExpr_copy (constraintExpr expr) { constraintExpr ret; ret = constraintExpr_alloc (); /*drl 03/02/2003 this shouldn't be used to copy a null expression but handle things cleanly if it is*/ llassert (!constraintExpr_isUndefined(expr) ); if (constraintExpr_isUndefined(expr) ) { return constraintExpr_undefined; } ret->kind = expr->kind; ret->data = copyExprData (expr->data, expr->kind); ret->ct = expr->ct; ret->origType = expr->origType; return ret; } /*@only@*/ static constraintExpr oldconstraintExpr_makeTermExprNode ( /*@dependent@*/ exprNode e) { constraintExpr ret; constraintTerm t; ret = constraintExpr_alloc(); ret->kind = term; ret->data = dmalloc (sizeof *(ret->data) ); t = constraintTerm_makeExprNode (e); ret->data = constraintExprData_termSetTerm (ret->data, t); ret->ct = FALSE; ret->origType = ctype_undefined; return ret; } /*@access exprNode@*/ constraintExpr constraintExpr_makeExprNode (exprNode e) { sRef s; constraintExpr ret, ce1, ce2; exprData data; exprNode t, t1, t2; lltok tok; if (exprNode_isUndefined (e)) { return constraintExpr_undefined; } data = e->edata; switch (e->kind) { case XPR_SIZEOF: t = exprData_getSingle (data); while (exprNode_isInParens (t) ) { t = exprData_getUopNode (t->edata); } s = exprNode_getSref (t); if (sRef_isFixedArray(s) ) { int size; size = (int) sRef_getArraySize(s); ret = constraintExpr_makeIntLiteral (size); } else if (exprNode_isStringLiteral (t)) { cstring str = multiVal_forceString (exprNode_getValue(t)); ret = constraintExpr_makeIntLiteral (size_toLong (cstring_length (str) + 1)); } else { DPRINTF ((message ("could not determine the size of %s", exprNode_unparse (e) ) ) ); ret = oldconstraintExpr_makeTermExprNode (e); } break; case XPR_OP: DPRINTF ((message ("Examining operation %s", exprNode_unparse (e) ) ) ); t1 = exprData_getOpA (data); t2 = exprData_getOpB (data); tok = exprData_getOpTok (data); if (lltok_isPlus_Op (tok) || lltok_isMinus_Op (tok) ) { ce1 = constraintExpr_makeExprNode (t1); ce2 = constraintExpr_makeExprNode (t2); ret = constraintExpr_parseMakeBinaryOp (ce1, tok, ce2); } /* define this block to activate the cheesy heuristic for handling sizeof expressions*/ #if 0 /* drl 8-11-001 We handle expressions containing sizeof with the rule (sizeof type ) * Expr = Expr This is the total wronge way to do this but... it may be better than nothing */ else if (lltok_isMult(tok) ) { if ((t1->kind == XPR_SIZEOF) || (t1->kind == XPR_SIZEOFT) ) { ret = constraintExpr_makeExprNode(t2); } else if ((t2->kind == XPR_SIZEOF) || (t2->kind == XPR_SIZEOFT) ) { ret = constraintExpr_makeExprNode(t1); } else { ret = oldconstraintExpr_makeTermExprNode (e); } } #endif else ret = oldconstraintExpr_makeTermExprNode (e); break; case XPR_PARENS: t = exprData_getUopNode (data); ret = constraintExpr_makeExprNode (t); break; case XPR_PREOP: t = exprData_getUopNode (data); tok = exprData_getUopTok (data); if (lltok_isIncOp (tok)) { constraintExpr temp; temp = constraintExpr_makeExprNode(t); ret = constraintExpr_makeIncConstraintExpr(temp); } else if (lltok_isDecOp (tok)) { constraintExpr temp; temp = constraintExpr_makeExprNode(t); ret = constraintExpr_makeDecConstraintExpr(temp); } else ret = oldconstraintExpr_makeTermExprNode (e); break; case XPR_POSTOP: t = exprData_getUopNode (data); ret = constraintExpr_makeExprNode (t); break; case XPR_CAST: t = exprData_getCastNode (data); ret = constraintExpr_makeExprNode (t); break; case XPR_COMMA: t = exprData_getPairA (data); ret = constraintExpr_makeExprNode(t); break; default: ret = oldconstraintExpr_makeTermExprNode (e); } return ret; } /*@noaccess exprNode@*/ /*@only@*/ constraintExpr constraintExpr_makeTermExprNode (/*@exposed@*/ exprNode e) { return oldconstraintExpr_makeTermExprNode(e); } static constraintExpr constraintExpr_makeTerm (/*@only@*/ constraintTerm t) { constraintExpr ret; ret = constraintExpr_alloc(); ret->kind = term; ret->data = dmalloc (sizeof *(ret->data) ); ret->data->term = NULL; ret->data = constraintExprData_termSetTerm (ret->data, t); ret->ct = FALSE; ret->origType = ctype_undefined; return ret; } constraintExpr constraintExpr_makeTermsRef (/*@temp@*/ sRef s) { constraintExpr ret; constraintTerm t; ret = constraintExpr_alloc(); ret->kind = term; ret->data = dmalloc (sizeof *(ret->data) ); t = constraintTerm_makesRef (s); ret->data = constraintExprData_termSetTerm (ret->data, t); ret->ct = FALSE; ret->origType = ctype_undefined; return ret; } /*@special@*/ /*@notnull@*/ static constraintExpr makeUnaryOpGeneric (void) /*@allocates result->data@*/ /*@defines result->kind@*/ { constraintExpr ret; ret = constraintExpr_alloc(); ret->kind = unaryExpr; ret->data = dmalloc (sizeof *(ret->data)); ret->data->unaryOp.expr = constraintExpr_undefined; return ret; } /*@notnull@*/ /*@only@*/ static constraintExpr constraintExpr_makeUnaryOpConstraintExpr (/*@only@*/ constraintExpr cexpr) { constraintExpr ret; ret = makeUnaryOpGeneric(); /*@-uniondef@*/ /*@-compdef@*/ ret->data = constraintExprData_unaryExprSetExpr (ret->data, cexpr); ret->data = constraintExprData_unaryExprSetOp (ret->data, UNARYOP_UNDEFINED); return ret; /*@=compdef@*/ /*@=uniondef@*/ } /*@only@*/ /*@notnull@*/ static constraintExpr constraintExpr_makeUnaryOp (/*@only@*/ constraintExpr cexpr, constraintExprUnaryOpKind Op) { constraintExpr ret; ret = makeUnaryOpGeneric(); ret->data = constraintExprData_unaryExprSetExpr (ret->data, cexpr); ret->data = constraintExprData_unaryExprSetOp (ret->data, Op); ret->ct = FALSE; ret->origType = ctype_undefined; return ret; } /*@only@*/ /*@notnull@*/ static constraintExpr constraintExpr_makeUnaryOpExprNode (/*@exposed@*/ exprNode expr) { constraintExpr ret; constraintExpr sub; sub = constraintExpr_makeExprNode (expr); ret = constraintExpr_makeUnaryOpConstraintExpr(sub); return ret; } /*@only@*/ /*@notnull@*/ static constraintExpr constraintExpr_makeMaxSetConstraintExpr (/*@only@*/ constraintExpr c) { constraintExpr ret; ret = constraintExpr_makeUnaryOp (c, MAXSET); return ret; } /*@only@*/ /*@notnull@*/ static constraintExpr constraintExpr_makeSRefUnaryOp (/*@temp@*/ /*@observer@*/ sRef s, constraintExprUnaryOpKind op) { constraintExpr ret; constraintExpr t; t = constraintExpr_makeTermsRef (s); ret = constraintExpr_makeUnaryOpConstraintExpr (t); ret->data = constraintExprData_unaryExprSetOp (ret->data, op); return ret; } /*@only@*/ constraintExpr constraintExpr_makeSRefMaxRead( sRef s) { return (constraintExpr_makeSRefUnaryOp (s, MAXREAD) ); } /*@only@*/ constraintExpr constraintExpr_makeSRefMaxset ( sRef s) { return (constraintExpr_makeSRefUnaryOp (s, MAXSET) ); } /*@only@*/ constraintExpr constraintExpr_parseMakeUnaryOp (lltok op, constraintExpr cexpr) { constraintExpr ret; ret = constraintExpr_makeUnaryOpConstraintExpr ( cexpr); switch (lltok_getTok (op)) { case QMAXSET: ret->data = constraintExprData_unaryExprSetOp (ret->data, MAXSET); break; case QMAXREAD: ret->data = constraintExprData_unaryExprSetOp (ret->data, MAXREAD); break; default: llfatalbug (message ("Unhandled operation in constraint: %s", lltok_unparse (op))); } return ret; } /*@only@*/ constraintExpr constraintExpr_makeMaxSetExpr (/*@exposed@*/ exprNode expr) { constraintExpr ret; ret = constraintExpr_makeExprNode (expr); ret = constraintExpr_makeMaxSetConstraintExpr (ret); llassert (ret != NULL); return ret; } /*@only@*/ constraintExpr constraintExpr_makeMaxReadExpr (exprNode expr) { constraintExpr ret; ret = constraintExpr_makeUnaryOpExprNode(expr); ret->data = constraintExprData_unaryExprSetOp (ret->data, MAXREAD); return ret; } # if 0 /*@only@*/ /*@unused@*/ static constraintExpr constraintExpr_makeMinSetExpr (/*@exposed@*/ exprNode expr) { constraintExpr ret; ret = constraintExpr_makeUnaryOpExprNode(expr); ret->data = constraintExprData_unaryExprSetOp (ret->data, MINSET); return ret; } /*@only@*/ /*@unused@*/ static constraintExpr constraintExpr_makeMinReadExpr (/*@exposed@*/ exprNode expr) { constraintExpr ret; ret = constraintExpr_makeUnaryOpExprNode(expr); ret->data = constraintExprData_unaryExprSetOp (ret->data, MINREAD); return ret; } # endif /*@only@*/ constraintExpr constraintExpr_makeValueExpr (/*@exposed@*/ exprNode expr) { constraintExpr ret; ret = constraintExpr_makeExprNode (expr); return ret; } /*@only@*/ /*@notnull@*/ constraintExpr constraintExpr_makeIntLiteral (long i) { constraintExpr ret; constraintTerm t; ret = constraintExpr_alloc(); ret->kind = term; ret->data = dmalloc (sizeof *(ret->data) ); t = constraintTerm_makeIntLiteral (i); ret->data = constraintExprData_termSetTerm (ret->data, t); ret->ct = FALSE; ret->origType = ctype_undefined; return ret; } /* constraintExpr constraintExpr_makeValueInt (int i) { return constraintExpr_makeIntLiteral (i); } */ /*@only@*/ /*@notnull@*/ /*@special@*/ static constraintExpr constraintExpr_makeBinaryOp (void) /*@allocates result->data @*/ /*@sets result->kind @*/ { constraintExpr ret; ret = constraintExpr_alloc(); ret->kind = binaryexpr; ret->data = dmalloc ( sizeof *(ret->data) ); ret->data->binaryOp.expr1 = constraintExpr_undefined; ret->data->binaryOp.expr2 = constraintExpr_undefined; return ret; } static /*@notnull@*/ /*@only@*/ constraintExpr constraintExpr_makeBinaryOpConstraintExpr (/*@only@*/constraintExpr expr1, /*@only@*/ constraintExpr expr2) { constraintExpr ret; ret = constraintExpr_makeBinaryOp(); ret->data = constraintExprData_binaryExprSetExpr1 (ret->data, expr1); ret->data = constraintExprData_binaryExprSetExpr2 (ret->data, expr2); ret->data = constraintExprData_binaryExprSetOp (ret->data, BINARYOP_UNDEFINED); ret->ct = FALSE; ret->origType = ctype_undefined; return ret; } /*@only@*/ constraintExpr constraintExpr_parseMakeBinaryOp (/*@only@*/ constraintExpr expr1, lltok op,/*@only@*/ constraintExpr expr2) { constraintExpr ret; ret = constraintExpr_makeBinaryOpConstraintExpr (expr1, expr2); if (lltok_getTok (op) == TPLUS) { ret->data = constraintExprData_binaryExprSetOp(ret->data, BINARYOP_PLUS); } else if (lltok_getTok (op) == TMINUS) { ret->data = constraintExprData_binaryExprSetOp(ret->data, BINARYOP_MINUS); } else { llassert (FALSE); } return ret; } # if 0 /*@only@*/ /*@unused@*/ static constraintExpr constraintExpr_makeBinaryOpExprNode (/*@exposed@*/ exprNode expr1, /*@exposed@*/ exprNode expr2) { constraintExpr ret; constraintExpr sub1, sub2; sub1 = constraintExpr_makeTermExprNode (expr1); sub2 = constraintExpr_makeTermExprNode (expr2); ret = constraintExpr_makeBinaryOpConstraintExpr(sub1, sub2); return ret; } # endif static /*@notnull@*/ /*@only@*/ constraintExpr constraintExpr_makeBinaryOpConstraintExprIntLiteral (/*@only@*/ constraintExpr expr, int literal) { constraintExpr ret; constraintExpr constExpr; constExpr = constraintExpr_makeIntLiteral (literal); ret = constraintExpr_makeBinaryOpConstraintExpr (expr, constExpr); ret->data = constraintExprData_binaryExprSetOp(ret->data, BINARYOP_PLUS); return ret; } /*@only@*/ constraintExpr constraintExpr_makeDecConstraintExpr (/*@only@*/constraintExpr expr) { constraintExpr ret; constraintExpr inc; inc = constraintExpr_makeIntLiteral (1); ret = constraintExpr_makeBinaryOpConstraintExpr (expr, inc); ret->data = constraintExprData_binaryExprSetOp(ret->data, BINARYOP_MINUS); return ret; } /*@only@*/ constraintExpr constraintExpr_makeSubtractExpr (/*@only@*/ constraintExpr expr, /*@only@*/ constraintExpr addent) { constraintExpr ret; DPRINTF ((message ("Making subtract expression") ) ); ret = constraintExpr_makeBinaryOpConstraintExpr (expr, addent); ret->data = constraintExprData_binaryExprSetOp (ret->data, BINARYOP_MINUS); return ret; } /*@only@*/ constraintExpr constraintExpr_makeAddExpr (/*@only@*/ constraintExpr expr, /*@only@*/ constraintExpr addent) { constraintExpr ret; DPRINTF ((message ("Doing addTerm simplification") ) ); ret = constraintExpr_makeBinaryOpConstraintExpr (expr, addent); ret->data = constraintExprData_binaryExprSetOp (ret->data, BINARYOP_PLUS); return ret; } /*@only@*/ constraintExpr constraintExpr_makeIncConstraintExpr (/*@only@*/ constraintExpr expr) { constraintExpr ret; constraintExpr inc; inc = constraintExpr_makeIntLiteral (1); ret = constraintExpr_makeBinaryOpConstraintExpr (expr, inc); ret->data = constraintExprData_binaryExprSetOp(ret->data, BINARYOP_PLUS); return ret; } /*@only@*/ static cstring constraintExprUnaryOpKind_print (constraintExprUnaryOpKind op) { switch (op) { case MAXSET: return message("maxSet"); case MINSET: return message("minSet"); case MAXREAD: return message("maxRead"); case MINREAD: return message("minRead"); default: llassert(FALSE); return message ("<(Unary OP OTHER>"); } } /*@only@*/ static cstring constraintExprBinaryOpKind_print (constraintExprBinaryOpKind op) { switch (op) { case BINARYOP_PLUS: return message("+"); case BINARYOP_MINUS: return message("-"); default: llassert(FALSE); return message (""); } } bool constraintExpr_similar (constraintExpr expr1, constraintExpr expr2) { constraintExprKind kind; llassert (expr1 != NULL); llassert (expr2 != NULL); if (expr1->kind != expr2->kind) return FALSE; kind = expr1->kind; switch (kind) { case term: return constraintTerm_similar (constraintExprData_termGetTerm(expr1->data), constraintExprData_termGetTerm(expr2->data) ); /*@notreached@*/ break; case unaryExpr: if (constraintExprData_unaryExprGetOp (expr1->data) != constraintExprData_unaryExprGetOp (expr2->data) ) return FALSE; return (constraintExpr_similar ( constraintExprData_unaryExprGetExpr (expr1->data), constraintExprData_unaryExprGetExpr (expr2->data) )); case binaryexpr: if (constraintExprData_binaryExprGetOp (expr1->data) != constraintExprData_binaryExprGetOp (expr2->data) ) return FALSE; if (! constraintExpr_similar (constraintExprData_binaryExprGetExpr1 (expr1->data), constraintExprData_binaryExprGetExpr1 (expr2->data)) ) return FALSE; if (! constraintExpr_similar (constraintExprData_binaryExprGetExpr2 (expr1->data), constraintExprData_binaryExprGetExpr2 (expr2->data)) ) return FALSE; else return TRUE; /*@notreached@*/ break; default: llassert(FALSE); return FALSE; } /*@notreached@*/ return FALSE; } bool constraintExpr_same (constraintExpr expr1, constraintExpr expr2) { constraintExprKind kind; llassert (expr1 != NULL); llassert (expr2 != NULL); if (expr1->kind != expr2->kind) return FALSE; kind = expr1->kind; switch (kind) { case term: return constraintTerm_similar (constraintExprData_termGetTerm(expr1->data), constraintExprData_termGetTerm(expr2->data) ); /*@notreached@*/ break; case unaryExpr: if (constraintExprData_unaryExprGetOp (expr1->data) != constraintExprData_unaryExprGetOp (expr2->data) ) return FALSE; return (constraintExpr_same ( constraintExprData_unaryExprGetExpr (expr1->data), constraintExprData_unaryExprGetExpr (expr2->data) )); case binaryexpr: if (constraintExprData_binaryExprGetOp (expr1->data) != constraintExprData_binaryExprGetOp (expr2->data) ) return FALSE; if (! constraintExpr_same (constraintExprData_binaryExprGetExpr1 (expr1->data), constraintExprData_binaryExprGetExpr1 (expr2->data)) ) return FALSE; if (! constraintExpr_same (constraintExprData_binaryExprGetExpr2 (expr1->data), constraintExprData_binaryExprGetExpr2 (expr2->data)) ) return FALSE; else return TRUE; /*@notreached@*/ break; default: llassert(FALSE); return FALSE; } /*@notreached@*/ BADEXIT; } bool constraintExpr_search (/*@observer@*/ constraintExpr c, /*@observer@*/ constraintExpr old) { bool ret = FALSE; constraintExprKind kind; constraintExpr temp; if (constraintExpr_similar (c, old)) { DPRINTF (("Found %q", constraintExpr_unparse (old))); return TRUE; } llassert (constraintExpr_isDefined (c) && constraintExpr_isDefined(old) ); if ( !(constraintExpr_isDefined (c) && constraintExpr_isDefined(old) ) ) return FALSE; kind = c->kind; switch (kind) { case term: break; case unaryExpr: temp = constraintExprData_unaryExprGetExpr (c->data); ret = ret || constraintExpr_search (temp, old); break; case binaryexpr: temp = constraintExprData_binaryExprGetExpr1 (c->data); ret = ret || constraintExpr_search(temp, old); temp = constraintExprData_binaryExprGetExpr2 (c->data); ret = ret || constraintExpr_search(temp, old); break; default: llassert(FALSE); } return ret; } /*@only@*/ constraintExpr constraintExpr_searchandreplace (/*@only@*/ /*@unique@*/ constraintExpr c, /*@temp@*/ constraintExpr old, /*@temp@*/ constraintExpr newExpr ) { constraintExprKind kind; constraintExpr temp; constraintExpr ret; llassert (constraintExpr_isDefined (newExpr) && (constraintExpr_isDefined (old) && constraintExpr_isDefined(c) ) ); if (constraintExpr_similar (c, old)) { ctype newType = ctype_unknown; ctype cType = ctype_unknown; ret = constraintExpr_copy (newExpr); llassert(constraintExpr_isDefined(ret) ); /*drl if newExpr != NULL then ret will != NULL*/ DPRINTF (("Replacing %s with %s in %s", constraintExpr_unparse (old), constraintExpr_unparse (newExpr), constraintExpr_unparse (c))); if (constraintExpr_canGetCType (c) && constraintExpr_canGetCType (newExpr)) { cType = constraintExpr_getCType(c); newType = constraintExpr_getCType (newExpr); if (ctype_match (cType,newType)) { DPRINTF (("constraintExpr_searchandreplace: replacing " " %s with type %s with %s with type %s", constraintExpr_unparse (c), ctype_unparse(cType), constraintExpr_unparse (newExpr), ctype_unparse(newType))); ret->ct = TRUE; ret->origType = cType; DPRINTF (("Type: %s", ctype_unparse (constraintExpr_getCType (ret)))); } } if (constraintExpr_hasMaxSet (c)) { if (constraintExpr_hasTypeChange (c)) { fileloc loc = constraintExpr_loc (c); DPRINTF (("constraintExpr_searchandreplace: encountered " "MaxSet with changed type %s ", constraintExpr_unparse (c))); if (c->kind == unaryExpr) { constraintExpr ce = constraintExprData_unaryExprGetExpr (c->data); DPRINTF (("Its a unary! %s / %s", ctype_unparse (constraintExpr_getCType (ce)), ctype_unparse (constraintExpr_getOrigType (ce)))); ret = constraintExpr_adjustMaxSetForCast (ret, constraintExpr_getCType (ce), constraintExpr_getOrigType (ce), loc); } else { /* fix this with a conversation */ DPRINTF (("Types: %s / %s", ctype_unparse (newType), ctype_unparse (cType))); ret = constraintExpr_adjustMaxSetForCast (ret, constraintExpr_getCType (c), constraintExpr_getOrigType(c), loc); } } } constraintExpr_free (c); DPRINTF (("ret: %s", constraintExpr_unparse (ret))); return ret; } kind = c->kind; switch (kind) { case term: break; case unaryExpr: DPRINTF (("Making unary expression!")); temp = constraintExprData_unaryExprGetExpr (c->data); temp = constraintExpr_copy (temp); temp = constraintExpr_searchandreplace (temp, old, newExpr); c->data = constraintExprData_unaryExprSetExpr (c->data, temp); break; case binaryexpr: DPRINTF (("Making binary expression!")); temp = constraintExprData_binaryExprGetExpr1 (c->data); temp = constraintExpr_copy (temp); temp = constraintExpr_searchandreplace (temp, old, newExpr); c->data = constraintExprData_binaryExprSetExpr1 (c->data, temp); temp = constraintExprData_binaryExprGetExpr2 (c->data); temp = constraintExpr_copy (temp); temp = constraintExpr_searchandreplace (temp, old, newExpr); c->data = constraintExprData_binaryExprSetExpr2 (c->data, temp); break; default: llassert (FALSE); } DPRINTF (("ret: %s", constraintExpr_unparse (c))); return c; } /*@notnull@*/ static constraintExpr constraintExpr_simplifyChildren (/*@returned@*/ /*@notnull@*/ constraintExpr c) { constraintExprKind kind; constraintExpr temp; kind = c->kind; switch (kind) { case term: break; case unaryExpr: temp = constraintExprData_unaryExprGetExpr (c->data); temp = constraintExpr_copy(temp); temp = constraintExpr_simplify (temp); c->data = constraintExprData_unaryExprSetExpr (c->data, temp); break; case binaryexpr: DPRINTF((message("constraintExpr_simplfiyChildren: simplify binary expression: %s",constraintExpr_unparse(c) ) ) ); temp = constraintExprData_binaryExprGetExpr1 (c->data); temp = constraintExpr_copy(temp); temp = constraintExpr_simplify (temp); c->data = constraintExprData_binaryExprSetExpr1 (c->data, temp); temp = constraintExprData_binaryExprGetExpr2 (c->data); temp = constraintExpr_copy(temp); temp = constraintExpr_simplify (temp); c->data = constraintExprData_binaryExprSetExpr2 (c->data, temp); break; default: llassert(FALSE); } return c; } constraintExpr constraintExpr_setFileloc (/*@returned@*/ constraintExpr c, fileloc loc) /*@modifies c @*/ { constraintTerm t; constraintExpr temp; llassert(c != NULL); switch (c->kind) { case term: t = constraintExprData_termGetTerm (c->data); t = constraintTerm_copy(t); t = constraintTerm_setFileloc (t, loc); c->data = constraintExprData_termSetTerm (c->data, t); break; case binaryexpr: temp = constraintExprData_binaryExprGetExpr1 (c->data); temp = constraintExpr_copy(temp); temp = constraintExpr_setFileloc (temp, loc); c->data = constraintExprData_binaryExprSetExpr1 (c->data, temp); temp = constraintExprData_binaryExprGetExpr2 (c->data); temp = constraintExpr_copy(temp); temp = constraintExpr_setFileloc (temp, loc); c->data = constraintExprData_binaryExprSetExpr2 (c->data, temp); break; case unaryExpr: temp = constraintExprData_unaryExprGetExpr (c->data); temp = constraintExpr_copy(temp); temp = constraintExpr_setFileloc (temp, loc); c->data = constraintExprData_unaryExprSetExpr (c->data, temp); break; } return c; } static /*@only@*/ constraintExpr constraintExpr_simplifybinaryExpr (/*@only@*/ /*@notnull@*/ constraintExpr c) { constraintExpr e1, e2; constraintExprBinaryOpKind op; e1 = constraintExprData_binaryExprGetExpr1 (c->data); e2 = constraintExprData_binaryExprGetExpr2 (c->data); if (constraintExpr_canGetValue (e1) && constraintExpr_canGetValue(e2) ) { long i; i = constraintExpr_getValue(e1) + constraintExpr_getValue (e2); constraintExpr_free(c); c = constraintExpr_makeIntLiteral (i); } else { op = constraintExprData_binaryExprGetOp (c->data); if (op == BINARYOP_MINUS) if (constraintExpr_similar(e1, e2) ) { constraintExpr_free(c); c = constraintExpr_makeIntLiteral (0); } } return c; } /* this thing takes the lexpr and expr of a constraint and modifies lexpr and returns a (possiblly new) value for expr */ /* if lexpr is a binary express say x + y, we set lexpr to x and return a value for expr such as expr_old - y */ /* the approach is a little Kludgy but seems to work. I should probably use something cleaner at some point ... */ /*@only@*/ constraintExpr constraintExpr_solveBinaryExpr (constraintExpr lexpr, /*@only@*/ constraintExpr expr) { constraintExpr expr1, expr2; constraintExprBinaryOpKind op; llassert(constraintExpr_isDefined (lexpr) && constraintExpr_isDefined (expr) ); if (lexpr->kind != binaryexpr) return expr; expr2 = constraintExprData_binaryExprGetExpr2 (lexpr->data); expr1 = constraintExprData_binaryExprGetExpr1 (lexpr->data); op = constraintExprData_binaryExprGetOp (lexpr->data); expr1 = constraintExpr_copy(expr1); expr2 = constraintExpr_copy(expr2); llassert(constraintExpr_isDefined (expr1) && constraintExpr_isDefined (expr2) ); /* drl possible problem : warning make sure this works */ lexpr->kind = expr1->kind; sfree (lexpr->data); lexpr->data = copyExprData (expr1->data, expr1->kind); constraintExpr_free(expr1); if (op == BINARYOP_PLUS) expr = constraintExpr_makeSubtractExpr (expr, expr2); else if (op == BINARYOP_MINUS) expr = constraintExpr_makeAddExpr (expr, expr2); else BADEXIT; return expr; /* #warning this needs to be checked expr = constraintExpr_solveBinaryExpr (expr1, expr); expr = constraintExpr_solveBinaryExpr (expr2, expr); return expr; */ } static /*@only@*/ constraintExpr constraintExpr_simplifyunaryExpr (/*@only@*/ constraintExpr c) { constraintExpr exp; llassert(constraintExpr_isDefined (c) ); llassert (c->kind == unaryExpr); DPRINTF ((message ("Doing constraintExpr_simplifyunaryExpr:%s", constraintExpr_unparse (c) ) ) ); if ((constraintExprData_unaryExprGetOp (c->data) != MAXSET) && (constraintExprData_unaryExprGetOp (c->data) != MAXREAD) ) { return c; } exp = constraintExprData_unaryExprGetExpr (c->data); exp = constraintExpr_copy(exp); llassert(constraintExpr_isDefined (exp) ); if (exp->kind == term) { constraintTerm cterm; cterm = constraintExprData_termGetTerm (exp->data); if (constraintTerm_isStringLiteral(cterm) ) { cstring val; val = constraintTerm_getStringLiteral (cterm); if (constraintExprData_unaryExprGetOp (c->data) == MAXSET) { constraintExpr temp; temp = constraintExpr_makeIntLiteral ((int)strlen (cstring_toCharsSafe(val) ) ); cstring_free(val); constraintExpr_free(c); constraintExpr_free(exp); return temp; } if (constraintExprData_unaryExprGetOp (c->data) == MAXREAD) { constraintExpr temp; temp = constraintExpr_makeIntLiteral ((int)strlen (cstring_toCharsSafe(val) ) ); cstring_free(val); constraintExpr_free(c); constraintExpr_free(exp); return temp; } BADEXIT; } /* slight Kludge to handle var [] = { , , }; ** type syntax I don't think this is sound but it should be good ** enough. The C standard is very confusing about initialization ** -- DRL 7/25/01 */ if (constraintTerm_isInitBlock(cterm) ) { constraintExpr temp; int len; len = constraintTerm_getInitBlockLength(cterm); /* -- drl 12/08/2003 : decrementing to fix off by one error */ len--; temp = constraintExpr_makeIntLiteral (len ); constraintExpr_free(c); DPRINTF(( message("Changed to %q", constraintExpr_print(temp) ) )); constraintExpr_free(exp); return temp; } constraintExpr_free(exp); return c; } if (exp->kind != binaryexpr) { constraintExpr_free(exp); return c; } if (constraintExprData_binaryExprGetOp (exp->data) == BINARYOP_PLUS ) { /* if (constraintExpr_canGetValue (constraintExprData_binaryExprGetExpr2 (exp->data) ) ) */ { constraintExpr temp, temp2; DPRINTF ((message ("Doing fancy simplification") ) ); temp = constraintExprData_binaryExprGetExpr2 (exp->data); temp2 = constraintExprData_binaryExprGetExpr1 (exp->data); temp2 = constraintExpr_copy(temp2); c->data = constraintExprData_unaryExprSetExpr (c->data, temp2); temp = constraintExpr_copy (temp); c = constraintExpr_makeSubtractExpr (c, temp); DPRINTF ((message ("Done fancy simplification:%s", constraintExpr_unparse (c) ) ) ); } } DPRINTF ((message ("constraintExpr_simplifyUnaryExpr: Done simplification:%s", constraintExpr_unparse (c) ) ) ); constraintExpr_free(exp); return c; } /*@only@*/ constraintExpr constraintExpr_simplify (/*@only@*/ constraintExpr c) { constraintExprKind kind; constraintExpr ret; constraintTerm t; DPRINTF ((message ("Doing constraintExpr_simplify:%s", constraintExpr_unparse (c) ) ) ); llassert ( constraintExpr_isDefined (c) ); if (constraintExpr_isUndefined (c) ) { return constraintExpr_undefined; } ret = constraintExpr_copy(c); llassert(constraintExpr_isDefined (ret) ); constraintExpr_free(c); ret = constraintExpr_simplifyChildren (ret); ret = constraintExpr_combineConstants (ret); ret = constraintExpr_simplifyChildren (ret); kind = ret->kind; switch (kind) { case term: t = constraintExprData_termGetTerm (ret->data); t = constraintTerm_copy(t); t = constraintTerm_simplify (t); ret->data = constraintExprData_termSetTerm (ret->data, t); break; case unaryExpr: ret = constraintExpr_simplifyunaryExpr (ret); break; case binaryexpr: ret = constraintExpr_simplifybinaryExpr (ret); break; default: llassert(FALSE); } DPRINTF ((message ("constraintExpr_simplify returning :%s", constraintExpr_unparse (ret) ) ) ); return ret; } /*@only@*/ cstring constraintExpr_unparse (/*@temp@*/ constraintExpr ex) /*@*/ { cstring st; constraintExprKind kind; llassert (ex != NULL); kind = ex->kind; switch (kind) { case term: if (context_getFlag (FLG_PARENCONSTRAINT) ) { st = message ("(%q) ", constraintTerm_unparse (constraintExprData_termGetTerm (ex->data))); } else { st = message ("%q", constraintTerm_unparse (constraintExprData_termGetTerm (ex->data))); } break; case unaryExpr: st = message ("%q(%q)", constraintExprUnaryOpKind_print (constraintExprData_unaryExprGetOp (ex->data) ), constraintExpr_unparse (constraintExprData_unaryExprGetExpr (ex->data) ) ); break; case binaryexpr: if (context_getFlag (FLG_PARENCONSTRAINT) ) { st = message ("(%q) %q (%q)", constraintExpr_unparse (constraintExprData_binaryExprGetExpr1 (ex->data) ), constraintExprBinaryOpKind_print (constraintExprData_binaryExprGetOp (ex->data)), constraintExpr_unparse (constraintExprData_binaryExprGetExpr2 (ex->data) ) ); } else { st = message ("%q %q %q", constraintExpr_unparse (constraintExprData_binaryExprGetExpr1 (ex->data)), constraintExprBinaryOpKind_print (constraintExprData_binaryExprGetOp (ex->data)), constraintExpr_unparse (constraintExprData_binaryExprGetExpr2 (ex->data)) ); } break; default: llassert(FALSE); st = message ("error"); } DPRINTF((message ("constraintExpr_unparse: '%s'",st) ) ); return st; } constraintExpr constraintExpr_doSRefFixBaseParam (/*@returned@*/ constraintExpr expr, exprNodeList arglist) { constraintTerm Term; constraintExprKind kind; constraintExpr expr1, expr2; constraintExprData data; llassert (expr != NULL); data = expr->data; kind = expr->kind; switch (kind) { case term: Term = constraintExprData_termGetTerm(data); Term = constraintTerm_copy(Term); Term = constraintTerm_doSRefFixBaseParam (Term, arglist); data = constraintExprData_termSetTerm(data, Term); break; case unaryExpr: expr1 = constraintExprData_unaryExprGetExpr (data); expr1 = constraintExpr_copy(expr1); expr1 = constraintExpr_doSRefFixBaseParam (expr1, arglist); data = constraintExprData_unaryExprSetExpr (data, expr1); break; case binaryexpr: expr1 = constraintExprData_binaryExprGetExpr1 (data); expr2 = constraintExprData_binaryExprGetExpr2 (data); expr1 = constraintExpr_copy(expr1); expr2 = constraintExpr_copy(expr2); expr1 = constraintExpr_doSRefFixBaseParam (expr1, arglist); data = constraintExprData_binaryExprSetExpr1 (data, expr1); expr2 = constraintExpr_doSRefFixBaseParam (expr2, arglist); data = constraintExprData_binaryExprSetExpr2 (data, expr2); break; default: llassert(FALSE); data = NULL; } return expr; } /* / *@only@* / constraintExpr constraintExpr_doSRefFixInvarConstraint (/ *@only@* / constraintExpr expr, sRef s, ctype ct) { constraintExprKind kind; constraintExpr expr1, expr2; constraintExprData data; llassert (expr != NULL); data = expr->data; kind = expr->kind; switch (kind) { case term: expr = doSRefFixInvarConstraintTerm (expr, s, ct); break; case unaryExpr: expr1 = constraintExprData_unaryExprGetExpr (data); expr1 = constraintExpr_copy(expr1); expr1 = constraintExpr_doSRefFixInvarConstraint (expr1, s, ct); data = constraintExprData_unaryExprSetExpr (data, expr1); break; case binaryexpr: expr1 = constraintExprData_binaryExprGetExpr1 (data); expr2 = constraintExprData_binaryExprGetExpr2 (data); expr1 = constraintExpr_copy(expr1); expr2 = constraintExpr_copy(expr2); expr1 = constraintExpr_doSRefFixInvarConstraint (expr1, s, ct); data = constraintExprData_binaryExprSetExpr1 (data, expr1); expr2 = constraintExpr_doSRefFixInvarConstraint (expr2, s, ct); data = constraintExprData_binaryExprSetExpr2 (data, expr2); break; default: llassert(FALSE); data = NULL; } return expr; } */ /*@only@*/ constraintExpr constraintExpr_doSRefFixConstraintParam (/*@only@*/ constraintExpr expr, exprNodeList arglist) /*@modifies expr@*/ { constraintExprKind kind; constraintExpr expr1, expr2; constraintExprData data; llassert (expr != NULL); data = expr->data; kind = expr->kind; switch (kind) { case term: expr = doSRefFixConstraintParamTerm (expr, arglist); break; case unaryExpr: expr1 = constraintExprData_unaryExprGetExpr (data); expr1 = constraintExpr_copy(expr1); expr1 = constraintExpr_doSRefFixConstraintParam (expr1, arglist); data = constraintExprData_unaryExprSetExpr (data, expr1); break; case binaryexpr: expr1 = constraintExprData_binaryExprGetExpr1 (data); expr2 = constraintExprData_binaryExprGetExpr2 (data); expr1 = constraintExpr_copy(expr1); expr2 = constraintExpr_copy(expr2); expr1 = constraintExpr_doSRefFixConstraintParam (expr1, arglist); data = constraintExprData_binaryExprSetExpr1 (data, expr1); expr2 = constraintExpr_doSRefFixConstraintParam (expr2, arglist); data = constraintExprData_binaryExprSetExpr2 (data, expr2); break; default: llassert(FALSE); data = NULL; } return expr; } /*@only@*/ constraintExpr constraintExpr_doFixResult (/*@only@*/ constraintExpr expr, /*@observer@*/ exprNode fcnCall) { constraintExprKind kind; constraintExpr expr1, expr2; constraintExprData data; llassert (expr != NULL); data = expr->data; kind = expr->kind; switch (kind) { case term: expr = doFixResultTerm (expr, fcnCall); break; case unaryExpr: expr1 = constraintExprData_unaryExprGetExpr (data); expr1 = constraintExpr_copy(expr1); expr1 = constraintExpr_doFixResult (expr1, fcnCall); data = constraintExprData_unaryExprSetExpr (data, expr1); break; case binaryexpr: expr1 = constraintExprData_binaryExprGetExpr1 (data); expr2 = constraintExprData_binaryExprGetExpr2 (data); expr1 = constraintExpr_copy(expr1); expr2 = constraintExpr_copy(expr2); expr1 = constraintExpr_doFixResult (expr1, fcnCall); data = constraintExprData_binaryExprSetExpr1 (data, expr1); expr2 = constraintExpr_doFixResult (expr2, fcnCall); data = constraintExprData_binaryExprSetExpr2 (data, expr2); break; default: llassert(FALSE); data = NULL; } return expr; } cstring constraintExpr_print (constraintExpr expr) /*@*/ { return constraintExpr_unparse (expr); } bool constraintExpr_hasMaxSet (constraintExpr expr) /*@*/ { cstring t; t = constraintExpr_unparse(expr); if (cstring_containsLit(t, "maxSet") != NULL ) { cstring_free(t); return (TRUE); } else { cstring_free(t); return FALSE; } } /*returns 1 0 -1 like strcmp 1 => expr1 > expr2 0 => expr1 == expr2 -1 => expr1 < expr2 */ int constraintExpr_compare (constraintExpr expr1, constraintExpr expr2) { long value1, value2; if (constraintExpr_similar (expr1, expr2) ) { return 0; } value1 = constraintExpr_getValue(expr1); value2 = constraintExpr_getValue(expr2); if (value1 > value2) return 1; if (value1 == value2) return 0; else return -1; } long constraintExpr_getValue (constraintExpr expr) { llassert (constraintExpr_isDefined(expr) ); llassert (expr->kind == term); return (constraintTerm_getValue (constraintExprData_termGetTerm (expr->data))); } bool constraintExpr_canGetValue (constraintExpr expr) { llassert ( constraintExpr_isDefined (expr) ); if (constraintExpr_isUndefined (expr) ) { return FALSE; } switch (expr->kind) { case term: return constraintTerm_canGetValue (constraintExprData_termGetTerm (expr->data) ); default: return FALSE; } BADEXIT; } fileloc constraintExpr_loc (constraintExpr expr) { constraintExpr e; constraintTerm t; constraintExprKind kind; llassert ( constraintExpr_isDefined (expr) ); if (constraintExpr_isUndefined (expr) ) { return fileloc_undefined; } kind = expr->kind; switch (kind) { case term: t = constraintExprData_termGetTerm (expr->data); return (constraintTerm_getFileloc (t) ); /*@notreached@*/ break; case unaryExpr: e = constraintExprData_unaryExprGetExpr (expr->data); return (constraintExpr_loc (e) ); /*@notreached@*/ break; case binaryexpr: e = constraintExprData_binaryExprGetExpr1 (expr->data); return (constraintExpr_loc (e) ); /*@notreached@*/ break; } llassert (FALSE); return (fileloc_undefined); } /*drl moved from constriantTerm.c 5/20/001*/ static /*@only@*/ constraintExpr doFixResultTerm (/*@only@*/ constraintExpr e, /*@exposed@*/ exprNode fcnCall) { constraintTerm t; sRef s; constraintExprData data; constraintExprKind kind; constraintExpr ret; llassert (constraintExpr_isDefined (e) ); data = e->data; kind = e->kind; llassert (kind == term); t = constraintExprData_termGetTerm (data); llassert (constraintTerm_isDefined (t)); ret = e; switch (constraintTerm_getKind (t)) { case CTT_EXPR: case CTT_INTLITERAL: break; case CTT_SREF: s = constraintTerm_getSRef(t); if (sRef_isResult (s)) { ret = constraintExpr_makeExprNode(fcnCall); constraintExpr_free(e); e = NULL; } else { e = NULL; } break; default: BADEXIT; } return ret; } #if 0 /*to be used for structure checking */ / *@only@* / static constraintExpr doSRefFixInvarConstraintTerm (/ *@only@* / constraintExpr e, sRef s, ctype ct) { constraintTerm t; constraintExprData data = e->data; constraintExprKind kind = e->kind; constraintExpr ret; llassert(kind == term); t = constraintExprData_termGetTerm (data); llassert (constraintTerm_isDefined(t) ); ret = e; DPRINTF (("Fixing: %s", constraintExpr_print (e))); switch (constraintTerm_getKind(t)) { case CTT_EXPR: DPRINTF((message ("%q @ %q ", constraintTerm_unparse(t), fileloc_unparse (constraintTerm_getFileloc(t) ) ) )); break; case CTT_INTLITERAL: DPRINTF((message (" %q ", constraintTerm_unparse (t)) )); break; case CTT_SREF: / * evans 2001-07-24: constants should use the original term * / if (!constraintTerm_canGetValue (t)) { sRef snew; DPRINTF ((message("Doing sRef_fixInvarConstraint for %q ", constraintTerm_unparse (t) ) )); snew = fixSref (ct, s, constraintTerm_getSRef(t)); ret = constraintExpr_makeTermsRef(snew); constraintExpr_free (e); DPRINTF (( message("After Doing sRef_fixConstraintParam constraintExpr is %q ", constraintExpr_print (ret) ) )); / *@-branchstate@* / } / *@=branchstate@* / break; default: BADEXIT; } return ret; } #endif /*drl moved from constriantTerm.c 5/20/001*/ /*@only@*/ static constraintExpr doSRefFixConstraintParamTerm (/*@only@*/ constraintExpr e, /*@observer@*/ /*@temp@*/ exprNodeList arglist) { constraintTerm t; constraintExprData data; constraintExprKind kind; constraintExpr ret; llassert(constraintExpr_isDefined (e) ); data = e->data; kind = e->kind; llassert(kind == term); t = constraintExprData_termGetTerm (data); llassert (constraintTerm_isDefined(t) ); ret = e; DPRINTF (("Fixing: %s", constraintExpr_print (e))); switch (constraintTerm_getKind(t)) { case CTT_EXPR: DPRINTF((message ("%q @ %q ", constraintTerm_unparse(t), fileloc_unparse (constraintTerm_getFileloc(t) ) ) )); break; case CTT_INTLITERAL: DPRINTF((message (" %q ", constraintTerm_unparse (t)) )); break; case CTT_SREF: /* evans 2001-07-24: constants should use the original term */ if (!constraintTerm_canGetValue (t)) { DPRINTF ((message("Doing sRef_fixConstraintParam for %q ", constraintTerm_unparse (t) ) )); ret = sRef_fixConstraintParam (constraintTerm_getSRef(t), arglist); constraintExpr_free (e); DPRINTF (( message("After Doing sRef_fixConstraintParam constraintExpr is %q ", constraintExpr_print (ret) ) )); /*@-branchstate@*/ } /*@=branchstate@*/ break; default: BADEXIT; } return ret; } #if 0 bool constraintExpr_includesTerm (constraintExpr expr, constraintTerm term) { if (constraintTerm_hasTerm (expr->term, term) ) return TRUE; if ((expr->expr) != NULL) { return ( constraintExpr_includesTerm (expr->expr, term) ); } return FALSE; } #endif /*drl added 6/11/01 */ bool constraintExpr_isBinaryExpr (/*@observer@*/ constraintExpr c) { llassert(constraintExpr_isDefined (c) ); if ( ! (constraintExpr_isDefined (c) ) ) return FALSE; if (c->kind == binaryexpr) return TRUE; else return FALSE; } /*drl added 8/08/001 */ bool constraintExpr_isTerm (/*@observer@*/ constraintExpr c) /*@*/ { llassert(constraintExpr_isDefined (c) ); if (c->kind == term) return TRUE; else return FALSE; } /*@observer@*/ /*@temp@*/ constraintTerm constraintExpr_getTerm ( /*@temp@*/ /*@observer@*/ constraintExpr c) /*@*/ { constraintTerm term; llassert(constraintExpr_isDefined (c) ); llassert(constraintExpr_isTerm(c) ); term = constraintExprData_termGetTerm(c->data); return term; } static void binaryExpr_dump (/*@observer@*/ constraintExprData data, FILE *f) { constraintExpr expr1; constraintExprBinaryOpKind binaryOp; constraintExpr expr2; binaryOp = constraintExprData_binaryExprGetOp (data); fprintf(f, "%d\n", (int) binaryOp); expr1 = constraintExprData_binaryExprGetExpr1 (data); expr2 = constraintExprData_binaryExprGetExpr2 (data); fprintf(f, "e1\n"); constraintExpr_dump(expr1, f); fprintf(f, "e2\n"); constraintExpr_dump(expr2, f); } static constraintExpr binaryExpr_undump (FILE *f) { constraintExpr expr1; constraintExprBinaryOpKind binaryOp; constraintExpr expr2; constraintExpr ret; char * str; char * os; os = mstring_create (MAX_DUMP_LINE_LENGTH); str = fgets(os, MAX_DUMP_LINE_LENGTH, f); if (! mstring_isDefined(str) ) { llfatalbug(message("Library file is corrupted") ); } binaryOp = (constraintExprBinaryOpKind) reader_getInt(&str); str = fgets(os, MAX_DUMP_LINE_LENGTH, f); if (! mstring_isDefined(str) ) { llfatalbug(message("Library file is corrupted") ); } reader_checkChar (&str, 'e'); reader_checkChar (&str, '1'); expr1 = constraintExpr_undump (f); str = fgets(os, MAX_DUMP_LINE_LENGTH, f); reader_checkChar (&str, 'e'); reader_checkChar (&str, '2'); expr2 = constraintExpr_undump (f); ret = constraintExpr_makeBinaryOpConstraintExpr (expr1, expr2); ret->data = constraintExprData_binaryExprSetOp(ret->data, binaryOp); free(os); return ret; } static void unaryExpr_dump (/*@observer@*/ constraintExprData data, FILE *f) { constraintExpr expr; constraintExprUnaryOpKind unaryOp; unaryOp = constraintExprData_unaryExprGetOp (data); fprintf(f, "%d\n", (int) unaryOp); expr = constraintExprData_unaryExprGetExpr (data); constraintExpr_dump(expr, f); } static constraintExpr unaryExpr_undump ( FILE *f) { constraintExpr expr; constraintExprUnaryOpKind unaryOp; constraintExpr ret; char * str; char * os; str = mstring_create (MAX_DUMP_LINE_LENGTH); os = str; str = fgets(os, MAX_DUMP_LINE_LENGTH, f); if (! mstring_isDefined(str) ) { llfatalbug(message("Library file is corrupted") ); } unaryOp = (constraintExprUnaryOpKind) reader_getInt(&str); expr = constraintExpr_undump (f); ret = constraintExpr_makeUnaryOp (expr, unaryOp); free(os); return ret; } void constraintExpr_dump (/*@observer@*/ constraintExpr expr, FILE *f) { constraintExprKind kind; constraintTerm t; llassert(constraintExpr_isDefined(expr) ); DPRINTF((message("constraintExpr_dump:: dumping constraintExpr %s", constraintExpr_unparse(expr) ) )); kind = expr->kind; fprintf(f,"%d\n", (int) kind); switch (kind) { case term: t = constraintExprData_termGetTerm (expr->data); constraintTerm_dump (t, f); break; case unaryExpr: unaryExpr_dump (expr->data, f); break; case binaryexpr: binaryExpr_dump (expr->data, f); break; } } /*@only@*/ constraintExpr constraintExpr_undump (FILE *f) { constraintExprKind kind; constraintTerm t; constraintExpr ret; char * s; char * os; s = mstring_create (MAX_DUMP_LINE_LENGTH); os = s; s = fgets(os, MAX_DUMP_LINE_LENGTH, f); if (! mstring_isDefined(s) ) { llfatalbug(message("Library file is corrupted") ); } kind = (constraintExprKind) reader_getInt(&s); free (os); switch (kind) { case term: t = constraintTerm_undump (f); ret = constraintExpr_makeTerm(t); break; case unaryExpr: ret = unaryExpr_undump (f); break; case binaryexpr: ret = binaryExpr_undump (f); break; } return ret; } int constraintExpr_getDepth (constraintExpr ex) { int ret; constraintExprKind kind; llassert (ex != NULL); kind = ex->kind; switch (kind) { case term: ret = 1; break; case unaryExpr: ret = constraintExpr_getDepth (constraintExprData_unaryExprGetExpr (ex->data) ); ret++; break; case binaryexpr: ret = 0; ret = constraintExpr_getDepth (constraintExprData_binaryExprGetExpr1 (ex->data) ); ret++; ret += constraintExpr_getDepth (constraintExprData_binaryExprGetExpr2 (ex->data) ); break; default: BADEXIT; } return ret; } bool constraintExpr_canGetCType (constraintExpr e) /*@*/ { if (constraintExpr_isUndefined(e)) return FALSE; if (e->kind == term) { return TRUE; } else { DPRINTF (("constraintExpr_canGetCType: can't get type for %s", constraintExpr_unparse (e))); return FALSE; } } ctype constraintExpr_getCType (constraintExpr e) /*@*/ { constraintTerm t; llassert (constraintExpr_isDefined (e)); llassert (constraintExpr_canGetCType (e)); switch (e->kind) { case term: t = constraintExprData_termGetTerm (e->data); return (constraintTerm_getCType(t) ); /* assume that a unary expression will be an int ... */ case unaryExpr: return ctype_unknown; /* was ctype_signedintegral; */ /* drl for just return type of first operand */ case binaryexpr: return (constraintExpr_getCType (constraintExprData_binaryExprGetExpr1 (e->data))); default: BADEXIT; } BADEXIT; } /* drl add 10-5-001 */ static bool constraintExpr_hasTypeChange (constraintExpr e) { llassert(constraintExpr_isDefined(e)); if (constraintExpr_isDefined((e)) && (e->ct == TRUE)) { return TRUE; } if (e->kind == unaryExpr) { if (constraintExprData_unaryExprGetOp (e->data) == MAXSET) { constraintExpr ce = constraintExprData_unaryExprGetExpr(e->data); DPRINTF (("Unary type change: [%x] %s", ce, constraintExpr_unparse (ce))); DPRINTF (("Types: %s / %s", ctype_unparse (constraintExpr_getCType (ce)), ctype_unparse (constraintExpr_getOrigType (ce)))); return (constraintExpr_hasTypeChange(ce)); } } return FALSE; } /* drl add 10-5-001 */ static ctype constraintExpr_getOrigType (constraintExpr e) { llassert (constraintExpr_isDefined (e)); llassert (constraintExpr_hasTypeChange (e)); if (e->ct == TRUE) { return e->origType; } if (e->kind == unaryExpr) { if (constraintExprData_unaryExprGetOp (e->data) == MAXSET) { constraintExpr ce = constraintExprData_unaryExprGetExpr (e->data); return (constraintExpr_getOrigType(ce)); } } BADEXIT; } /*drl added these around 10/18/001*/ static /*@only@*/ constraintExpr constraintExpr_div (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc) { int sizefrom = ctype_getSize (tfrom); int sizeto = ctype_getSize (tto); DPRINTF (("constraintExpr_div: %s", constraintExpr_unparse (e))); DPRINTF (("Types: %s / %s", ctype_unparse (tfrom), ctype_unparse (tto))); if (sizefrom == -1) { llbug (message ("constraintExpr_div: type size unknown: %s", ctype_unparse (tfrom))); } if (sizeto == -1) { llbug (message ("constraintExpr_div: type size unknown: %s", ctype_unparse (tto))); } if (sizeto == sizefrom) { DPRINTF (("Sizes match: %d / %d", sizeto, sizefrom)); ; /* Sizes match, a-ok */ } else { float scale = (float) sizefrom / (float) sizeto; constraintTerm ct; long val; float fnewval; long newval; llassert (e != NULL); llassert (e->kind == term); ct = constraintExprData_termGetTerm (e->data); DPRINTF (("constraint: %s / %s", constraintExpr_unparse (e), constraintTerm_unparse (ct))); llassert (constraintTerm_canGetValue (ct)); val = constraintTerm_getValue (ct); DPRINTF (("Scaling constraints by: %ld * %f", val, scale)); fnewval = ((float) val) * scale; newval = (long) fnewval; DPRINTF (("Values: %f / %ld", fnewval, newval)); if ((fnewval - (float) newval) > FLT_EPSILON) { voptgenerror (FLG_ALLOCMISMATCH, message ("Allocated memory is converted to type %s of (size %d), " "which is not divisible into original allocation of space " "for %d elements of type %s (size %d)", ctype_unparse (tto), sizeto, long_toInt (val), ctype_unparse (tfrom), sizefrom), loc); } constraintTerm_setValue (ct, newval); } DPRINTF (("After div: %s", constraintExpr_unparse (e))); return e; } /*@access exprNode@*/ static /*@only@*/ constraintExpr constraintTerm_simpleDivTypeExprNode (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc) { exprData data; exprNode t1, t2, expr; lltok tok; constraintTerm t; llassert (constraintExpr_isDefined(e) ); DPRINTF (("constraintTerm_simpleDivTypeExprNode e=%s [%s => %s]", constraintExpr_print(e), ctype_unparse(tfrom), ctype_unparse (tto))); t = constraintExprData_termGetTerm (e->data); expr = constraintTerm_getExprNode (t); llassert (constraintExpr_isDefined(e)); llassert (exprNode_isDefined(expr)); if (expr->kind == XPR_OP) { data = expr->edata; t1 = exprData_getOpA (data); t2 = exprData_getOpB (data); tok = exprData_getOpTok (data); if (lltok_isMult (tok)) { /* ** If the sizeof is first, flip them. */ llassert (exprNode_isDefined(t1) && exprNode_isDefined(t2)); if (t2->kind == XPR_SIZEOF || t2->kind == XPR_SIZEOFT) { exprNode tmp = t1; t1 = t2; t2 = tmp; } /*drl 3/2/2003 we know this from the fact that it's a multiplication operation...*/ if (t1->kind == XPR_SIZEOF || t1->kind == XPR_SIZEOFT) { ctype multype; if (t1->kind == XPR_SIZEOFT) { multype = qtype_getType (exprData_getType (t1->edata)); } else { exprNode tempE = exprData_getSingle (t1->edata); multype = exprNode_getType (tempE); } DPRINTF (("Here we go sizeof: %s / %s / %s", ctype_unparse (multype), ctype_unparse (tfrom), ctype_unparse (tto))); llassert (ctype_isPointer (tfrom)); if (ctype_almostEqual (ctype_makePointer (multype), tto)) { /* this is a bit sloopy but ... */ constraintExpr_free (e); DPRINTF (("Sizeof types match okay!")); return constraintExpr_makeExprNode (t2); } else { int sizemul = ctype_getSize (multype); ctype tobase = ctype_baseArrayPtr (tto); int sizeto = ctype_getSize (tobase); DPRINTF (("Types: %s / %s / %s", ctype_unparse (tfrom), ctype_unparse (tto), ctype_unparse (multype))); voptgenerror (FLG_ALLOCMISMATCH, message ("Allocated memory is used as a different type (%s) from the sizeof type (%s)", ctype_unparse (tobase), ctype_unparse (multype)), loc); if (sizemul == sizeto) { constraintExpr_free (e); DPRINTF (("Sizeof types match okay!")); return constraintExpr_makeExprNode (t2); } else { /* nothing was here */ DPRINTF (("MISMATCHING TYPES!")); return (constraintExpr_div (constraintExpr_makeExprNode (t2), multype, tto, loc)); } } } else { DPRINTF (("NOT A SIZEOF!")); /* empty */ } } else { DPRINTF (("Not a mult: %s", constraintExpr_unparse (e))); } } return (constraintExpr_div (e, tfrom, tto, loc)); } /*@noaccess exprNode@*/ static /*@only@*/ constraintExpr simpleDivType (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc) { DPRINTF (("simpleDiv got %s", constraintExpr_unparse(e))); DPRINTF (("Types: %s / %s", ctype_unparse (tfrom), ctype_unparse (tto))); llassert (constraintExpr_isDefined(e)); switch (e->kind) { case term: { constraintTerm t = constraintExprData_termGetTerm (e->data); DPRINTF (("Term: %s", constraintTerm_unparse (t))); if (constraintTerm_isExprNode (t)) { return constraintTerm_simpleDivTypeExprNode (e, tfrom, tto, loc); /* search for * size of ct and remove */ } DPRINTF (("Here: %s / %s -> %s", constraintExpr_unparse (e), ctype_unparse (tfrom), ctype_unparse (tto))); return constraintExpr_div (e, tfrom, tto, loc); } case binaryexpr: { constraintExpr temp; temp = constraintExprData_binaryExprGetExpr1 (e->data); temp = constraintExpr_copy(temp); temp = simpleDivType (temp, tfrom, tto, loc); e->data = constraintExprData_binaryExprSetExpr1 (e->data, temp); temp = constraintExprData_binaryExprGetExpr2 (e->data); temp = constraintExpr_copy(temp); temp = simpleDivType (temp, tfrom, tto, loc); e->data = constraintExprData_binaryExprSetExpr2 (e->data, temp); DPRINTF (("simpleDiv binaryexpr returning %s ", constraintExpr_unparse(e))); return e; } case unaryExpr: { return constraintExpr_div (e, tfrom, tto, loc); } default: BADEXIT; } } static /*@only@*/ constraintExpr constraintExpr_adjustMaxSetForCast (/*@only@*/ constraintExpr e, ctype tfrom, ctype tto, fileloc loc) { DPRINTF (("constraintExpr_adjustMaxSetForCast got %s [%s => %s]", constraintExpr_unparse(e), ctype_unparse (tfrom), ctype_unparse (tto))); e = constraintExpr_makeIncConstraintExpr (e); e = constraintExpr_simplify (e); e = simpleDivType (e, tfrom, tto, loc); e = constraintExpr_makeDecConstraintExpr (e); e = constraintExpr_simplify (e); DPRINTF (("constraintExpr_adjustMaxSetForCast returning %s ", constraintExpr_unparse(e))); return e; } bool constraintExpr_isConstantOnly (constraintExpr e) { DPRINTF (("constraintExpr_isConstantOnly %s ", constraintExpr_unparse(e))); llassert (constraintExpr_isDefined(e)); switch (e->kind) { case term: { constraintTerm t = constraintExprData_termGetTerm(e->data); if (constraintTerm_isConstantOnly (t)) { return TRUE; } else { return FALSE; } } case binaryexpr: { constraintExpr temp1 = constraintExprData_binaryExprGetExpr1 (e->data); constraintExpr temp2 = constraintExprData_binaryExprGetExpr2 (e->data); if (constraintExpr_isConstantOnly(temp1) && constraintExpr_isConstantOnly(temp2) ) { return TRUE; } else { return FALSE; } } case unaryExpr: { constraintExpr temp; temp = constraintExprData_unaryExprGetExpr (e->data ); if (constraintExpr_isConstantOnly(temp) ) { return TRUE; } else { return FALSE; } } default: BADEXIT; } } splint-3.1.2.dfsg1/src/constraint.c0000644021234200000250000006721207671271603014603 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** constraint.c */ /* #define DEBUGPRINT 1 */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" static /*@only@*/ cstring constraint_unparseDetailedPostCondition (/*@observer@*/ /*@temp@*/ constraint p_c); static /*@notnull@*/ /*@special@*/ constraint constraint_makeNew (void) /*@post:isnull result->or, result->orig, result->generatingExpr, result->fcnPre @*/ /*@defines result->or, result->generatingExpr, result->orig, result->fcnPre @*/; static void advanceField (char **s) { reader_checkChar (s, '@'); } bool constraint_same (constraint c1, constraint c2) { llassert (c1 != NULL); llassert (c2 != NULL); if (c1->ar != c2->ar) { return FALSE; } if (!constraintExpr_similar (c1->lexpr, c2->lexpr)) { return FALSE; } if (!constraintExpr_similar (c1->expr, c2->expr)) { return FALSE; } return TRUE; } constraint makeConstraintParse3 (constraintExpr l, lltok relOp, constraintExpr r) { constraint ret; ret = constraint_makeNew (); llassert (constraintExpr_isDefined (l)); ret->lexpr = constraintExpr_copy (l); if (lltok_getTok (relOp) == GE_OP) { ret->ar = GTE; } else if (lltok_getTok (relOp) == LE_OP) { ret->ar = LTE; } else if (lltok_getTok (relOp) == EQ_OP) { ret->ar = EQ; } else llfatalbug ( message ("Unsupported relational operator")); ret->expr = constraintExpr_copy (r); ret->post = TRUE; ret->orig = constraint_copy (ret); ret = constraint_simplify (ret); /* ret->orig = ret; */ DPRINTF (("GENERATED CONSTRAINT:")); DPRINTF ((message ("%s", constraint_unparse (ret)))); return ret; } constraint constraint_copy (/*@temp@*/ /*@observer@*/ constraint c) { if (!constraint_isDefined (c)) { return constraint_undefined; } else { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_copy (c->lexpr); ret->ar = c->ar; ret->expr = constraintExpr_copy (c->expr); ret->post = c->post; /*@-assignexpose@*/ ret->generatingExpr = c->generatingExpr; /*@=assignexpose@*/ if (c->orig != NULL) ret->orig = constraint_copy (c->orig); else ret->orig = NULL; if (c->or != NULL) ret->or = constraint_copy (c->or); else ret->or = NULL; ret->fcnPre = c->fcnPre; return ret; } } /*like copy except it doesn't allocate memory for the constraint*/ void constraint_overWrite (constraint c1, constraint c2) { llassert (constraint_isDefined (c1) && constraint_isDefined (c2)); llassert (c1 != c2); DPRINTF ((message ("OverWriteing constraint %q with %q", constraint_unparse (c1), constraint_unparse (c2)))); constraintExpr_free (c1->lexpr); constraintExpr_free (c1->expr); c1->lexpr = constraintExpr_copy (c2->lexpr); c1->ar = c2->ar; c1->expr = constraintExpr_copy (c2->expr); c1->post = c2->post; if (c1->orig != NULL) constraint_free (c1->orig); if (c2->orig != NULL) c1->orig = constraint_copy (c2->orig); else c1->orig = NULL; if (c1->or != NULL) constraint_free (c1->or); if (c2->or != NULL) c1->or = constraint_copy (c2->or); else c1->or = NULL; c1->fcnPre = c2->fcnPre; /*@-assignexpose@*/ c1->generatingExpr = c2->generatingExpr; /*@=assignexpose@*/ } static /*@notnull@*/ /*@special@*/ constraint constraint_makeNew (void) /*@post:isnull result->or, result->orig, result->generatingExpr, result->fcnPre @*/ /*@defines result->or, result->generatingExpr, result->orig, result->fcnPre @*/ { constraint ret; ret = dmalloc (sizeof (*ret)); ret->lexpr = NULL; ret->expr = NULL; ret->ar = LT; ret->post = FALSE; ret->orig = NULL; ret->or = NULL; ret->generatingExpr = NULL; ret->fcnPre = NULL; return ret; } /*@access exprNode@*/ constraint constraint_addGeneratingExpr (/*@returned@*/ constraint c, /*@exposed@*/ exprNode e) { if (!constraint_isDefined (c)) { return c; } if (c->generatingExpr == NULL) { c->generatingExpr = e; DPRINTF ((message ("setting generatingExpr for %s to %s", constraint_unparse (c), exprNode_unparse (e)) )); } else { DPRINTF ((message ("Not setting generatingExpr for %s to %s", constraint_unparse (c), exprNode_unparse (e)) )); } return c; } /*@noaccess exprNode@*/ constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint c, exprNode e) { llassert (constraint_isDefined (c) ); if (c->orig != constraint_undefined) { c->orig = constraint_addGeneratingExpr (c->orig, e); } else { DPRINTF ((message ("constraint_origAddGeneratingExpr: Not setting generatingExpr for %s to %s", constraint_unparse (c), exprNode_unparse (e)) )); } return c; } constraint constraint_setFcnPre (/*@returned@*/ constraint c) { llassert (constraint_isDefined (c) ); if (c->orig != constraint_undefined) { c->orig->fcnPre = TRUE; } else { c->fcnPre = TRUE; DPRINTF (( message ("Warning Setting fcnPre directly"))); } return c; } fileloc constraint_getFileloc (constraint c) { llassert (constraint_isDefined (c) ); if (exprNode_isDefined (c->generatingExpr)) return (fileloc_copy (exprNode_loc (c->generatingExpr))); return (constraintExpr_loc (c->lexpr)); } static bool checkForMaxSet (constraint c) { llassert (constraint_isDefined (c)); return (constraintExpr_hasMaxSet (c->lexpr) || constraintExpr_hasMaxSet (c->expr)); } bool constraint_hasMaxSet (constraint c) { llassert (constraint_isDefined (c) ); if (checkForMaxSet (c)) return TRUE; if (c->orig != NULL) { if (checkForMaxSet (c->orig)) return TRUE; } return FALSE; } constraint constraint_makeReadSafeExprNode (exprNode po, exprNode ind) { constraint ret = constraint_makeNew (); po = po; ind = ind; ret->lexpr = constraintExpr_makeMaxReadExpr (po); ret->ar = GTE; ret->expr = constraintExpr_makeValueExpr (ind); ret->post = FALSE; return ret; } constraint constraint_makeWriteSafeInt (exprNode po, int ind) { constraint ret = constraint_makeNew (); ret->lexpr =constraintExpr_makeMaxSetExpr (po); ret->ar = GTE; ret->expr = constraintExpr_makeIntLiteral (ind); /*@i1*/ return ret; } constraint constraint_makeSRefSetBufferSize (sRef s, long int size) { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_makeSRefMaxset (s); ret->ar = EQ; ret->expr = constraintExpr_makeIntLiteral ((int)size); ret->post = TRUE; return ret; } constraint constraint_makeSRefWriteSafeInt (sRef s, int ind) { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_makeSRefMaxset ( s); ret->ar = GTE; ret->expr = constraintExpr_makeIntLiteral (ind); ret->post = TRUE; return ret; } /* drl added 01/12/2000 ** makes the constraint: Ensures index <= MaxRead (buffer) */ constraint constraint_makeEnsureLteMaxRead (exprNode index, exprNode buffer) { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_makeValueExpr (index); ret->ar = LTE; ret->expr = constraintExpr_makeMaxReadExpr (buffer); ret->post = TRUE; return ret; } constraint constraint_makeWriteSafeExprNode (exprNode po, exprNode ind) { constraint ret = constraint_makeNew (); ret->lexpr =constraintExpr_makeMaxSetExpr (po); ret->ar = GTE; ret->expr = constraintExpr_makeValueExpr (ind); /*@i1*/return ret; } constraint constraint_makeReadSafeInt (exprNode t1, int index) { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_makeMaxReadExpr (t1); ret->ar = GTE; ret->expr = constraintExpr_makeIntLiteral (index); ret->post = FALSE; return ret; } constraint constraint_makeSRefReadSafeInt (sRef s, int ind) { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_makeSRefMaxRead (s); ret->ar = GTE; ret->expr = constraintExpr_makeIntLiteral (ind); ret->post = TRUE; return ret; } constraint constraint_makeEnsureMaxReadAtLeast (exprNode t1, exprNode t2, fileloc sequencePoint) { constraint ret = constraint_makeReadSafeExprNode (t1, t2); llassert (constraint_isDefined (ret)); ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); ret->post = TRUE; return ret; } static constraint constraint_makeEnsuresOpConstraintExpr (/*@only@*/ constraintExpr c1, /*@only@*/ constraintExpr c2, fileloc sequencePoint, arithType ar) { if (constraintExpr_isDefined (c1) && constraintExpr_isDefined (c2)) { constraint ret = constraint_makeNew (); ret->lexpr = c1; ret->ar = ar; ret->post = TRUE; ret->expr = c2; ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); return ret; } else { return constraint_undefined; } } static constraint constraint_makeEnsuresOp (/*@dependent@*/ exprNode e1, /*@dependent@*/ exprNode e2, fileloc sequencePoint, arithType ar) { constraintExpr c1, c2; if (!(exprNode_isDefined (e1) && exprNode_isDefined (e2))) { llcontbug (message ("Invalid exprNode, Exprnodes are %s and %s", exprNode_unparse (e1), exprNode_unparse (e2))); } c1 = constraintExpr_makeValueExpr (e1); c2 = constraintExpr_makeValueExpr (e2); return constraint_makeEnsuresOpConstraintExpr (c1, c2, sequencePoint, ar); } /* make constraint ensures e1 == e2 */ constraint constraint_makeEnsureEqual (exprNode e1, exprNode e2, fileloc sequencePoint) { return (constraint_makeEnsuresOp (e1, e2, sequencePoint, EQ)); } /* make constraint ensures e1 < e2 */ constraint constraint_makeEnsureLessThan (exprNode e1, exprNode e2, fileloc sequencePoint) { constraintExpr t1, t2; constraint t3; t1 = constraintExpr_makeValueExpr (e1); t2 = constraintExpr_makeValueExpr (e2); /* change this to e1 <= (e2 -1) */ t2 = constraintExpr_makeDecConstraintExpr (t2); t3 = constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, LTE); t3 = constraint_simplify (t3); return (t3); } constraint constraint_makeEnsureLessThanEqual (exprNode e1, exprNode e2, fileloc sequencePoint) { return (constraint_makeEnsuresOp (e1, e2, sequencePoint, LTE)); } constraint constraint_makeEnsureGreaterThan (exprNode e1, exprNode e2, fileloc sequencePoint) { constraintExpr t1, t2; constraint t3; t1 = constraintExpr_makeValueExpr (e1); t2 = constraintExpr_makeValueExpr (e2); /* change this to e1 >= (e2 + 1) */ t2 = constraintExpr_makeIncConstraintExpr (t2); t3 = constraint_makeEnsuresOpConstraintExpr (t1, t2, sequencePoint, GTE); t3 = constraint_simplify(t3); return t3; } constraint constraint_makeEnsureGreaterThanEqual (exprNode e1, exprNode e2, fileloc sequencePoint) { return ( constraint_makeEnsuresOp (e1, e2, sequencePoint, GTE)); } /* Makes the constraint e = e + f */ constraint constraint_makeAddAssign (exprNode e, exprNode f, fileloc sequencePoint) { constraintExpr x1, x2, y; constraint ret; ret = constraint_makeNew (); x1 = constraintExpr_makeValueExpr (e); x2 = constraintExpr_copy (x1); y = constraintExpr_makeValueExpr (f); ret->lexpr = x1; ret->ar = EQ; ret->post = TRUE; ret->expr = constraintExpr_makeAddExpr (x2, y); ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); return ret; } /* Makes the constraint e = e - f */ constraint constraint_makeSubtractAssign (exprNode e, exprNode f, fileloc sequencePoint) { constraintExpr x1, x2, y; constraint ret; ret = constraint_makeNew (); x1 = constraintExpr_makeValueExpr (e); x2 = constraintExpr_copy (x1); y = constraintExpr_makeValueExpr (f); ret->lexpr = x1; ret->ar = EQ; ret->post = TRUE; ret->expr = constraintExpr_makeSubtractExpr (x2, y); ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); return ret; } constraint constraint_makeMaxSetSideEffectPostDecrement (exprNode e, fileloc sequencePoint) { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_makeValueExpr (e); ret->ar = EQ; ret->post = TRUE; ret->expr = constraintExpr_makeValueExpr (e); ret->expr = constraintExpr_makeDecConstraintExpr (ret->expr); ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); return ret; } constraint constraint_makeMaxSetSideEffectPostIncrement (exprNode e, fileloc sequencePoint) { constraint ret = constraint_makeNew (); ret->lexpr = constraintExpr_makeValueExpr (e); ret->ar = EQ; ret->post = TRUE; ret->expr = constraintExpr_makeValueExpr (e); ret->expr = constraintExpr_makeIncConstraintExpr (ret->expr); ret->lexpr = constraintExpr_setFileloc (ret->lexpr, sequencePoint); return ret; } void constraint_free (/*@only@*/ constraint c) { if (constraint_isDefined (c)) { constraint_free (c->orig); c->orig = NULL; constraint_free (c->or); c->or = NULL; constraintExpr_free (c->lexpr); c->lexpr = NULL; constraintExpr_free (c->expr); c->expr = NULL; free (c); } } cstring arithType_print (arithType ar) /*@*/ { cstring st = cstring_undefined; switch (ar) { case LT: st = cstring_makeLiteral ("<"); break; case LTE: st = cstring_makeLiteral ("<="); break; case GT: st = cstring_makeLiteral (">"); break; case GTE: st = cstring_makeLiteral (">="); break; case EQ: st = cstring_makeLiteral ("=="); break; case NONNEGATIVE: st = cstring_makeLiteral ("NONNEGATIVE"); break; case POSITIVE: st = cstring_makeLiteral ("POSITIVE"); break; default: llassert (FALSE); break; } return st; } void constraint_printErrorPostCondition (constraint c, fileloc loc) { cstring string; fileloc errorLoc, temp; string = constraint_unparseDetailedPostCondition (c); errorLoc = loc; loc = NULL; temp = constraint_getFileloc (c); if (context_getFlag (FLG_BOUNDSCOMPACTERRORMESSAGES)) { string = cstring_replaceChar (string, '\n', ' '); } if (fileloc_isDefined (temp)) { errorLoc = temp; voptgenerror (FLG_CHECKPOST, string, errorLoc); fileloc_free (temp); } else { voptgenerror (FLG_CHECKPOST, string, errorLoc); } } /*drl added 8-11-001*/ cstring constraint_printLocation (/*@observer@*/ /*@temp@*/ constraint c) /*@*/ { cstring string, ret; fileloc errorLoc; string = constraint_unparse (c); errorLoc = constraint_getFileloc (c); ret = message ("constraint: %q @ %q", string, fileloc_unparse (errorLoc)); fileloc_free (errorLoc); return ret; } void constraint_printError (constraint c, fileloc loc) { cstring string; fileloc errorLoc, temp; bool isLikely; llassert (constraint_isDefined (c) ); /*drl 11/26/2001 avoid printing tautological constraints */ if (constraint_isAlwaysTrue (c)) { return; } string = constraint_unparseDetailed (c); errorLoc = loc; temp = constraint_getFileloc (c); if (fileloc_isDefined (temp)) { errorLoc = temp; } else { llassert (FALSE); DPRINTF (("constraint %s had undefined fileloc %s", constraint_unparse (c), fileloc_unparse (temp))); fileloc_free (temp); errorLoc = fileloc_copy (errorLoc); } if (context_getFlag (FLG_BOUNDSCOMPACTERRORMESSAGES)) { string = cstring_replaceChar(string, '\n', ' '); } /*drl added 12/19/2002 print a different error fro "likely" bounds-errors*/ isLikely = constraint_isConstantOnly (c); if (isLikely) { if (c->post) { voptgenerror (FLG_FUNCTIONPOST, string, errorLoc); } else { if (constraint_hasMaxSet (c)) { voptgenerror (FLG_LIKELYBOUNDSWRITE, string, errorLoc); } else { voptgenerror (FLG_LIKELYBOUNDSREAD, string, errorLoc); } } } else if (c->post) { voptgenerror (FLG_FUNCTIONPOST, string, errorLoc); } else { if (constraint_hasMaxSet (c)) { voptgenerror (FLG_BOUNDSWRITE, string, errorLoc); } else { voptgenerror (FLG_BOUNDSREAD, string, errorLoc); } } fileloc_free(errorLoc); } static cstring constraint_unparseDeep (constraint c) { cstring genExpr; cstring st; llassert (constraint_isDefined (c)); st = constraint_unparse (c); if (c->orig != constraint_undefined) { st = cstring_appendChar (st, '\n'); genExpr = exprNode_unparse (c->orig->generatingExpr); if (!c->post) { if (c->orig->fcnPre) { st = cstring_concatFree (st, message (" derived from %s precondition: %q", genExpr, constraint_unparseDeep (c->orig))); } else { st = cstring_concatFree (st, message (" needed to satisfy precondition:\n%q", constraint_unparseDeep (c->orig))); } } else { st = cstring_concatFree (st, message ("derived from: %q", constraint_unparseDeep (c->orig))); } } return st; } static /*@only@*/ cstring constraint_unparseDetailedPostCondition (/*@observer@*/ /*@temp@*/ constraint c) { cstring st = cstring_undefined; cstring genExpr; llassert (constraint_isDefined (c) ); st = message ("Unsatisfied ensures constraint condition:\nSplint is unable to verify the constraint %q", constraint_unparseDeep (c)); genExpr = exprNode_unparse (c->generatingExpr); if (context_getFlag (FLG_CONSTRAINTLOCATION)) { cstring temp; temp = message ("\nOriginal Generating expression %q: %s\n", fileloc_unparse (exprNode_loc (c->generatingExpr)), genExpr); st = cstring_concatFree (st, temp); if (constraint_hasMaxSet (c)) { temp = message ("Has MaxSet\n"); st = cstring_concatFree (st, temp); } } return st; } cstring constraint_unparseDetailed (constraint c) { cstring st = cstring_undefined; cstring temp = cstring_undefined; cstring genExpr; bool isLikely; llassert (constraint_isDefined (c)); if (!c->post) { st = message ("Unable to resolve constraint:\n%q", constraint_unparseDeep (c)); } else { st = message ("Block Post condition:\nThis function block has the post condition %q", constraint_unparseDeep (c)); } isLikely = constraint_isConstantOnly (c); if (isLikely) { if (constraint_hasMaxSet (c)) { temp = cstring_makeLiteral ("Likely out-of-bounds store: "); } else { temp = cstring_makeLiteral ("Likely out-of-bounds read: "); } } else { if (constraint_hasMaxSet (c)) { temp = cstring_makeLiteral ("Possible out-of-bounds store: "); } else { temp = cstring_makeLiteral ("Possible out-of-bounds read: "); } } genExpr = exprNode_unparse (c->generatingExpr); if (context_getFlag (FLG_CONSTRAINTLOCATION)) { cstring temp2; temp2 = message ("%s\n", genExpr); temp = cstring_concatFree (temp, temp2); } st = cstring_concatFree (temp,st); return st; } /*@only@*/ cstring constraint_unparse (constraint c) /*@*/ { cstring st = cstring_undefined; cstring type = cstring_undefined; llassert (c !=NULL); if (c->post) { if (context_getFlag (FLG_PARENCONSTRAINT)) { type = cstring_makeLiteral ("ensures: "); } else { type = cstring_makeLiteral ("ensures"); } } else { if (context_getFlag (FLG_PARENCONSTRAINT)) { type = cstring_makeLiteral ("requires: "); } else { type = cstring_makeLiteral ("requires"); } } if (context_getFlag (FLG_PARENCONSTRAINT)) { st = message ("%q: %q %q %q", type, constraintExpr_print (c->lexpr), arithType_print (c->ar), constraintExpr_print (c->expr)); } else { st = message ("%q %q %q %q", type, constraintExpr_print (c->lexpr), arithType_print (c->ar), constraintExpr_print (c->expr)); } return st; } cstring constraint_unparseOr (constraint c) /*@*/ { cstring ret; constraint temp; ret = cstring_undefined; llassert (constraint_isDefined (c) ); temp = c; ret = cstring_concatFree (ret, constraint_unparse (temp)); temp = temp->or; while ( constraint_isDefined (temp)) { ret = cstring_concatFree (ret, cstring_makeLiteral (" OR ")); ret = cstring_concatFree (ret, constraint_unparse (temp)); temp = temp->or; } return ret; } /*@only@*/ constraint constraint_doSRefFixBaseParam (/*@returned@*/ /*@only@*/ constraint precondition, exprNodeList arglist) { llassert (constraint_isDefined (precondition) ); precondition->lexpr = constraintExpr_doSRefFixBaseParam (precondition->lexpr, arglist); precondition->expr = constraintExpr_doSRefFixBaseParam (precondition->expr, arglist); return precondition; } constraint constraint_doFixResult (constraint postcondition, /*@dependent@*/ exprNode fcnCall) { postcondition = constraint_copy (postcondition); llassert (constraint_isDefined (postcondition) ); postcondition->lexpr = constraintExpr_doFixResult (postcondition->lexpr, fcnCall); postcondition->expr = constraintExpr_doFixResult (postcondition->expr, fcnCall); return postcondition; } /*Commenting out temporally / *@only@* /constraint constraint_doSRefFixInvarConstraint(constraint invar, sRef s, ctype ct ) { invar = constraint_copy (invar); invar->lexpr = constraintExpr_doSRefFixInvarConstraint (invar->lexpr, s, ct); invar->expr = constraintExpr_doSRefFixInvarConstraint (invar->expr, s, ct); return invar; } */ /*@only@*/ constraint constraint_doSRefFixConstraintParam (constraint precondition, exprNodeList arglist) { precondition = constraint_copy (precondition); llassert (constraint_isDefined (precondition) ); precondition->lexpr = constraintExpr_doSRefFixConstraintParam (precondition->lexpr, arglist); precondition->expr = constraintExpr_doSRefFixConstraintParam (precondition->expr, arglist); precondition->fcnPre = FALSE; return constraint_simplify(precondition); } constraint constraint_preserveOrig (/*@returned@*/ constraint c) /*@modifies c @*/ { if (constraint_isDefined (c)) { DPRINTF (("Doing constraint_preserverOrig for %q", constraint_printDetailed (c))); if (c->orig == constraint_undefined) { c->orig = constraint_copy (c); } else if (c->orig->fcnPre) { constraint temp = c->orig; /* avoid infinite loop */ c->orig = NULL; c->orig = constraint_copy (c); /*drl 03/2/2003 if c != NULL then the copy of c will != null*/ llassert (constraint_isDefined (c->orig) ); if (c->orig->orig == NULL) { c->orig->orig = temp; temp = NULL; } else { llcontbug ((message ("Expected c->orig->orig to be null"))); constraint_free (c->orig->orig); c->orig->orig = temp; temp = NULL; } } else { DPRINTF (("Not changing constraint")); } } DPRINTF ((message ("After Doing constraint_preserverOrig for %q ", constraint_unparseDetailed (c)))); return c; } constraint constraint_togglePost (/*@returned@*/ constraint c) { llassert (constraint_isDefined (c)); c->post = !c->post; return c; } constraint constraint_togglePostOrig (/*@returned@*/ constraint c) { llassert (constraint_isDefined (c)); if (c->orig != NULL) { c->orig = constraint_togglePost (c->orig); } return c; } bool constraint_hasOrig ( /*@observer@*/ /*@temp@*/ constraint c) { llassert (constraint_isDefined (c)); return (c->orig != NULL); } constraint constraint_undump (FILE *f) { constraint c; bool fcnPre, post; arithType ar; constraintExpr lexpr, expr; char *s, *os; os = mstring_create (MAX_DUMP_LINE_LENGTH); s = fgets (os, MAX_DUMP_LINE_LENGTH, f); if (!mstring_isDefined (s)) { llfatalbug (message ("Library file is corrupted") ); } fcnPre = (bool) reader_getInt (&s); advanceField (&s); post = (bool) reader_getInt (&s); advanceField (&s); ar = (arithType) reader_getInt (&s); s = fgets (os, MAX_DUMP_LINE_LENGTH, f); if (! mstring_isDefined(s) ) { llfatalbug(message("Library file is corrupted") ); } reader_checkChar (&s, 'l'); lexpr = constraintExpr_undump (f); s = fgets (os, MAX_DUMP_LINE_LENGTH, f); reader_checkChar (&s, 'r'); if (! mstring_isDefined(s) ) { llfatalbug(message("Library file is corrupted") ); } expr = constraintExpr_undump (f); c = constraint_makeNew (); c->fcnPre = fcnPre; c->post = post; c->ar = ar; c->lexpr = lexpr; c->expr = expr; free (os); c = constraint_preserveOrig (c); return c; } void constraint_dump (/*@observer@*/ constraint c, FILE *f) { bool fcnPre; bool post; arithType ar; constraintExpr lexpr; constraintExpr expr; llassert (constraint_isDefined (c) ); fcnPre = c->fcnPre; post = c->post; ar = c->ar; lexpr = c->lexpr; expr = c->expr; fprintf (f, "%d@%d@%d\n", (int) fcnPre, (int) post, (int) ar); fprintf (f,"l\n"); constraintExpr_dump (lexpr, f); fprintf (f,"r\n"); constraintExpr_dump (expr, f); } int constraint_compare (/*@observer@*/ /*@temp@*/ const constraint * c1, /*@observer@*/ /*@temp@*/ const constraint * c2) /*@*/ { fileloc loc1, loc2; int ret; llassert (constraint_isDefined (*c1)); llassert (constraint_isDefined (*c2)); if (constraint_isUndefined (*c1)) { if (constraint_isUndefined (*c2)) return 0; else return 1; } if (constraint_isUndefined (*c2)) { return -1; } loc1 = constraint_getFileloc (*c1); loc2 = constraint_getFileloc (*c2); ret = fileloc_compare (loc1, loc2); fileloc_free (loc1); fileloc_free (loc2); return ret; } bool constraint_isPost (/*@observer@*/ /*@temp@*/ constraint c) { llassert (constraint_isDefined (c)); if (constraint_isUndefined (c)) return FALSE; return (c->post); } static int constraint_getDepth (/*@observer@*/ /*@temp@*/ constraint c) { int l , r; llassert (constraint_isDefined (c) ); l = constraintExpr_getDepth (c->lexpr); r = constraintExpr_getDepth (c->expr); if (l > r) { DPRINTF (( message ("constraint depth returning %d for %s", l, constraint_unparse (c)))); return l; } else { DPRINTF (( message ("constraint depth returning %d for %s", r, constraint_unparse (c)))); return r; } } bool constraint_tooDeep (/*@observer@*/ /*@temp@*/ constraint c) { int temp; temp = constraint_getDepth (c); if (temp >= 20) { return TRUE; } return FALSE; } /*drl added 12/19/2002*/ /*whether constraints consist only of terms which are constants*/ bool constraint_isConstantOnly (constraint c) { bool l, r; llassert (constraint_isDefined (c) ); l = constraintExpr_isConstantOnly(c->lexpr); r = constraintExpr_isConstantOnly(c->expr); if (l && r) { return TRUE; } else { return FALSE; } } splint-3.1.2.dfsg1/src/loopHeuristics.c0000644021234200000250000003265407765024013015430 0ustar fax/* ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** loopHeuristics.c */ /*This file was formerly called forjunk.c C renamed Oct 8, 2001 - DRL */ /* #define DEBUGPRINT 1 */ # include /* for isdigit */ # include "splintMacros.nf" # include "basic.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "exprChecks.h" # include "exprNodeSList.h" /* this file was created to split the loop heuristics functionality out of constraintGeneration.c and constraint.c*/ /*We need to access the internal representation of constraint see above for an explanation. */ /*@access constraint @*/ static bool isInc (/*@observer@*/ constraintExpr p_c) /*@*/; static bool incVar (/*@notnull@*/ constraint p_c) /*@*/; static bool increments (/*@observer@*/ constraint c, /*@observer@*/ constraintExpr var) { llassert (constraint_isDefined (c) ); if (constraint_isUndefined (c) ) { return FALSE; } llassert (incVar (c)); if (constraintExpr_similar (c->lexpr, var) ) return TRUE; else return FALSE; } static /*@only@*/ constraintList getLessThanConstraints (/*@observer@*/ constraintList c) { constraintList ret; ret = constraintList_makeNew (); constraintList_elements (c, el) { llassert (constraint_isDefined (el)); if ( constraint_isUndefined (el) ) continue; if (el->ar == LT || el->ar == LTE) { constraint temp; temp = constraint_copy (el); ret = constraintList_add (ret, temp); } } end_constraintList_elements; return ret; } static /*@only@*/ constraintList getIncConstraints (/*@observer@*/ constraintList c) { constraintList ret; ret = constraintList_makeNew (); constraintList_elements (c, el) { llassert (constraint_isDefined (el)); if (incVar (el) ) { constraint temp; temp = constraint_copy (el); ret = constraintList_add (ret, temp); } } end_constraintList_elements; return ret; } /*@access exprNode@*/ static bool canGetForTimes (/*@notnull@*/ exprNode forPred, /*@notnull@*/ exprNode forBody) { exprNode init, test, inc, t1, t2; lltok tok; llassert (exprNode_isDefined (forPred) ); llassert (exprNode_isDefined (forBody) ); init = exprData_getTripleInit (forPred->edata); test = exprData_getTripleTest (forPred->edata); inc = exprData_getTripleInc (forPred->edata); llassert (exprNode_isDefined (test) ); if (exprNode_isUndefined (test) ) { return FALSE; } llassert (exprNode_isDefined (inc) ); if (exprNode_isUndefined (inc) ) { return FALSE; } if (test->kind != XPR_PREOP) return FALSE; tok = (exprData_getUopTok (test->edata)); if (!lltok_isMult (tok) ) { return FALSE; } /* should check preop too */ if (inc->kind != XPR_POSTOP) { return FALSE; } tok = (exprData_getUopTok (inc->edata)); if (lltok_isIncOp (tok) ) { t1 = exprData_getUopNode (test->edata); t2 = exprData_getUopNode (inc->edata); llassert (exprNode_isDefined (t2) && exprNode_isDefined (t2) ); if (exprNode_isUndefined (t1) || exprNode_isUndefined (t2) ) { return FALSE; } if (sRef_sameName (t1->sref, t2->sref) ) { return TRUE; } } return FALSE; } /*@noaccess exprNode@*/ /*@access exprNode@*/ static /*@only@*/ constraintExpr getForTimes (/*@notnull@*/ exprNode forPred, /*@notnull@*/ exprNode forBody) { exprNode init, test, inc, t1, t2; constraintList ltCon; constraintList incCon; constraintExpr ret; lltok tok; init = exprData_getTripleInit (forPred->edata); test = exprData_getTripleTest (forPred->edata); inc = exprData_getTripleInc (forPred->edata); llassert (exprNode_isDefined (test) ); llassert (exprNode_isDefined (inc) ); ltCon = getLessThanConstraints (test->trueEnsuresConstraints); incCon = getIncConstraints (inc->ensuresConstraints); DPRINTF (( message ("getForTimes: ltCon: %s from %s", constraintList_unparse (ltCon), constraintList_unparse (test->trueEnsuresConstraints) ) )); DPRINTF (( message ("getForTimes: incCon: %s from %s", constraintList_unparse (incCon), constraintList_unparse (inc->ensuresConstraints) ) )); constraintList_elements (ltCon, el) { constraintList_elements (incCon, el2) { llassert(constraint_isDefined (el ) ); if ( (constraint_isDefined (el ) ) && ( increments (el2, el->lexpr) ) ) { DPRINTF (( message ("getForTimes: %s increments %s", constraint_print (el2), constraint_print (el) ) )); ret = constraintExpr_copy (el->expr); constraintList_free (ltCon); constraintList_free (incCon); return ret; } else { ; DPRINTF (( message ("getForTimes: %s doesn't increment %s", constraint_print (el2), constraint_print (el) ) )); } } end_constraintList_elements; } end_constraintList_elements; constraintList_free (ltCon); constraintList_free (incCon); DPRINTF (( message ("getForTimes: %s %s resorting to ugly hack", exprNode_unparse (forPred), exprNode_unparse (forBody) ) )); if (! canGetForTimes (forPred, forBody) ) { return NULL; } if (test->kind != XPR_PREOP) llassert (FALSE); tok = (exprData_getUopTok (test->edata)); if (!lltok_isMult (tok) ) { llassert ( FALSE ); } /* should check preop too */ if (inc->kind != XPR_POSTOP) { llassert (FALSE ); } tok = (exprData_getUopTok (inc->edata)); if (lltok_isIncOp (tok) ) { t1 = exprData_getUopNode (test->edata); t2 = exprData_getUopNode (inc->edata); llassert(exprNode_isDefined(t1) && exprNode_isDefined(t2) ); if (sRef_sameName (t1->sref, t2->sref) ) { return (constraintExpr_makeMaxSetExpr (t1) ); } } llassert ( FALSE); BADEXIT; } /*@noaccess exprNode@*/ /*@access constraintExpr @*/ static /*@only@*/ constraintExpr constraintExpr_searchAndAdd (/*@only@*/ constraintExpr c, /*@observer@*/ constraintExpr find, /*@observer@*/ constraintExpr add) { constraintExprKind kind; constraintExpr temp; llassert (constraintExpr_isDefined (c) ); DPRINTF (( message ("Doing constraintExpr_searchAndAdd %s %s %s ", constraintExpr_unparse (c), constraintExpr_unparse (find), constraintExpr_unparse (add) ) ) ); if ( constraintExpr_similar (c, find) ) { constraintExpr newExpr; cstring cPrint; cPrint = constraintExpr_unparse (c); newExpr = constraintExpr_makeAddExpr (c, constraintExpr_copy (add) ); DPRINTF ((message ("Replacing %q with %q", cPrint, constraintExpr_unparse (newExpr) ))); return newExpr; } kind = c->kind; switch (kind) { case term: break; case unaryExpr: temp = constraintExprData_unaryExprGetExpr (c->data); temp = constraintExpr_searchAndAdd (constraintExpr_copy (temp), find, add); c->data = constraintExprData_unaryExprSetExpr (c->data, temp); break; case binaryexpr: temp = constraintExprData_binaryExprGetExpr1 (c->data); temp = constraintExpr_searchAndAdd (constraintExpr_copy (temp), find, add); c->data = constraintExprData_binaryExprSetExpr1 (c->data, temp); temp = constraintExprData_binaryExprGetExpr2 (c->data); temp = constraintExpr_searchAndAdd (constraintExpr_copy (temp), find, add); c->data = constraintExprData_binaryExprSetExpr2 (c->data, temp); break; default: llassert (FALSE); } return c; } /*@noaccess constraintExpr @*/ static constraint constraint_searchAndAdd (/*@returned@*/ constraint c, /*@observer@*/ constraintExpr find, /*@observer@*/ constraintExpr add) { llassert (constraint_isDefined (c) ); llassert (constraint_search (c, find) ); DPRINTF (( message ("Doing constraint_searchAndAdd %s %s %s ", constraint_print (c), constraintExpr_unparse (find), constraintExpr_unparse (add) ) ) ); c->lexpr = constraintExpr_searchAndAdd (c->lexpr, find, add); c->expr = constraintExpr_searchAndAdd (c->expr, find, add); c = constraint_simplify (c); c = constraint_simplify (c); return c; } static constraintList constraintList_searchAndAdd (/*@returned@*/ constraintList list, /*@observer@*/ constraintExpr find, /*@observer@*/ constraintExpr add) { constraintList newConstraints; constraintList ret; newConstraints = constraintList_makeNew (); constraintList_elements (list, el) { if (constraint_search (el, find) ) { constraint newExpr; newExpr = constraint_copy (el); newExpr = constraint_searchAndAdd (newExpr, find, add); DPRINTF (( (message ("Adding constraint %s ", constraint_print (newExpr)) ) )); newConstraints = constraintList_add (newConstraints, newExpr); } } end_constraintList_elements; ret = constraintList_addListFree (list, newConstraints); return ret; } /*@access exprNode@*/ static void doAdjust (/*@unused@*/ exprNode e, /*@unused@*/ exprNode forPred, /*@observer@*/ exprNode forBody, /*@observer@*/ constraintExpr iterations) { llassert (exprNode_isDefined (forBody) ); constraintList_elements (forBody->ensuresConstraints, el) { /* look for var = var + 1 */ if (constraint_isDefined (el) && incVar (el) ) { DPRINTF ((message ("Found inc variable constraint : %s", constraint_print (el) ) )); forBody->requiresConstraints = constraintList_searchAndAdd (forBody->requiresConstraints, el->lexpr, iterations); } } end_constraintList_elements; } /*@access exprNode@*/ static void forLoopHeuristicsImpl ( exprNode e, exprNode forPred, /*@observer@*/ exprNode forBody) { exprNode init, test, inc; constraintExpr iterations; llassert (exprNode_isDefined(forPred) ); llassert (exprNode_isDefined(forBody) ); init = exprData_getTripleInit (forPred->edata); test = exprData_getTripleTest (forPred->edata); inc = exprData_getTripleInc (forPred->edata); if (exprNode_isError (test) || exprNode_isError (inc) ) return; iterations = getForTimes (forPred, forBody ); if (constraintExpr_isDefined (iterations) ) { doAdjust ( e, forPred, forBody, iterations); constraintExpr_free (iterations); } } /*@noaccess exprNode@*/ void exprNode_forLoopHeuristics ( exprNode e, exprNode forPred, exprNode forBody) { forLoopHeuristicsImpl (e, forPred, forBody); } /*@access constraintExpr @*/ static bool isInc (/*@observer@*/ constraintExpr c) /*@*/ { llassert (constraintExpr_isDefined (c) ); if (c->kind == binaryexpr ) { constraintExprBinaryOpKind binOP; constraintExpr t1, t2; t1 = constraintExprData_binaryExprGetExpr1 (c->data); t2 = constraintExprData_binaryExprGetExpr2 (c->data); binOP = constraintExprData_binaryExprGetOp (c->data); if (binOP == BINARYOP_PLUS) if (constraintExpr_isLit (t2) && constraintExpr_getValue (t2) == 1 ) { return TRUE; } } return FALSE; } /*@noaccess constraintExpr @*/ /*@access constraintExpr @*/ /* look for constraints like cexrp = cexrp + 1 */ static bool incVar (/*@notnull@*/ constraint c) /*@*/ { constraintExpr t1; if (c->ar != EQ) { return FALSE; } if (! isInc (c->expr ) ) return FALSE; llassert (constraintExpr_isDefined (c->expr) ); llassert (c->expr->kind == binaryexpr); t1 = constraintExprData_binaryExprGetExpr1 (c->expr->data); if (constraintExpr_similar (c->lexpr, t1) ) return TRUE; return FALSE; } /*@noaccess constraintExpr @*/ /* else */ /* { */ /* DPRINTF (("Can't get for time ")); */ /* } */ /* if (exprNode_isError (init) ) */ /* { */ /* return; */ /* } */ /* if (init->kind == XPR_ASSIGN) */ /* { */ /* t1 = exprData_getOpA (init->edata); */ /* t2 = exprData_getOpB (init->edata); */ /* if (! (t1->kind == XPR_VAR) ) */ /* return; */ /* } */ /* else */ /* return; */ /* if (test->kind == XPR_FETCH) */ /* { */ /* t3 = exprData_getPairA (test->edata); */ /* t4 = exprData_getPairB (test->edata); */ /* if (sRef_sameName (t1->sref, t4->sref) ) */ /* { */ /* DPRINTF ((message ("Found a for loop matching heuristic:%s", exprNode_unparse (forPred) ) )); */ /* con = constraint_makeEnsureLteMaxRead (t1, t3); */ /* forPred->ensuresConstraints = constraintList_add (forPred->ensuresConstraints, con); */ /* } */ /* else */ /* { */ /* DPRINTF ((message ("Didn't Find a for loop matching heuristic:%s %s and %s differ", exprNode_unparse (forPred), exprNode_unparse (t1), exprNode_unparse (t3) ) )); */ /* } */ /* return; */ /* } */ splint-3.1.2.dfsg1/src/signature.c.der0000644021234200000250000016121310645776226015173 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 1 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse lslparse #define yylex lsllex #define yyerror lslerror #define yylval lsllval #define yychar lslchar #define yydebug lsldebug #define yynerrs lslnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { LST_SIMPLEID = 258, LST_LOGICALOP = 259, LST_EQOP = 260, LST_SIMPLEOP = 261, LST_MAPSYM = 262, LST_FIELDMAPSYM = 263, LST_MARKERSYM = 264, LST_ifTOKEN = 265, LST_thenTOKEN = 266, LST_elseTOKEN = 267, LST_LBRACKET = 268, LST_RBRACKET = 269, LST_SELECTSYM = 270, LST_SEPSYM = 271, LST_OPENSYM = 272, LST_CLOSESYM = 273, LST_COLON = 274, LST_COMMA = 275, LST_EOL = 276, LST_COMMENTSYM = 277, LST_WHITESPACE = 278, LST_QUANTIFIERSYM = 279, LST_EQUATIONSYM = 280, LST_EQSEPSYM = 281, LST_COMPOSESYM = 282, LST_LPAR = 283, LST_RPAR = 284, LST_assertsTOKEN = 285, LST_assumesTOKEN = 286, LST_byTOKEN = 287, LST_convertsTOKEN = 288, LST_enumerationTOKEN = 289, LST_equationsTOKEN = 290, LST_exemptingTOKEN = 291, LST_forTOKEN = 292, LST_generatedTOKEN = 293, LST_impliesTOKEN = 294, LST_includesTOKEN = 295, LST_introducesTOKEN = 296, LST_ofTOKEN = 297, LST_partitionedTOKEN = 298, LST_traitTOKEN = 299, LST_tupleTOKEN = 300, LST_unionTOKEN = 301, LST_BADTOKEN = 302 }; #endif /* Tokens. */ #define LST_SIMPLEID 258 #define LST_LOGICALOP 259 #define LST_EQOP 260 #define LST_SIMPLEOP 261 #define LST_MAPSYM 262 #define LST_FIELDMAPSYM 263 #define LST_MARKERSYM 264 #define LST_ifTOKEN 265 #define LST_thenTOKEN 266 #define LST_elseTOKEN 267 #define LST_LBRACKET 268 #define LST_RBRACKET 269 #define LST_SELECTSYM 270 #define LST_SEPSYM 271 #define LST_OPENSYM 272 #define LST_CLOSESYM 273 #define LST_COLON 274 #define LST_COMMA 275 #define LST_EOL 276 #define LST_COMMENTSYM 277 #define LST_WHITESPACE 278 #define LST_QUANTIFIERSYM 279 #define LST_EQUATIONSYM 280 #define LST_EQSEPSYM 281 #define LST_COMPOSESYM 282 #define LST_LPAR 283 #define LST_RPAR 284 #define LST_assertsTOKEN 285 #define LST_assumesTOKEN 286 #define LST_byTOKEN 287 #define LST_convertsTOKEN 288 #define LST_enumerationTOKEN 289 #define LST_equationsTOKEN 290 #define LST_exemptingTOKEN 291 #define LST_forTOKEN 292 #define LST_generatedTOKEN 293 #define LST_impliesTOKEN 294 #define LST_includesTOKEN 295 #define LST_introducesTOKEN 296 #define LST_ofTOKEN 297 #define LST_partitionedTOKEN 298 #define LST_traitTOKEN 299 #define LST_tupleTOKEN 300 #define LST_unionTOKEN 301 #define LST_BADTOKEN 302 /* Copy the first part of user declarations. */ # include # include "splintMacros.nf" # include "basic.h" # include "lslparse.h" # include "signature.h" static void lslerror (char *); extern int lsllex (); /*@dependent@*/ /*@null@*/ lslOp importedlslOp; /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); /*@=noparams@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) # define YYDEBUG 1 /*@-redef@*/ /*@-readonlytrans@*/ /*@-nullassign@*/ /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { ltoken ltok; /* a leaf is also an ltoken */ unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ opFormNode opform; /*@owned@*/ sigNode signature; /*@only@*/ nameNode name; /*@owned@*/ lslOp operator; /*@only@*/ lslOpList operators; /*@-redef@*/ /*@-matchfields@*/ } /* Line 193 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 28 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 54 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 48 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 15 /* YYNRULES -- Number of rules. */ #define YYNRULES 39 /* YYNRULES -- Number of states. */ #define YYNSTATES 62 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 302 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint8 yyprhs[] = { 0, 0, 3, 5, 7, 10, 14, 16, 18, 25, 27, 30, 33, 37, 41, 46, 51, 57, 61, 66, 71, 77, 80, 84, 88, 90, 92, 94, 95, 97, 99, 103, 105, 107, 111, 112, 114, 116, 120, 122 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int8 yyrhs[] = { 49, 0, -1, 50, -1, 51, -1, 50, 51, -1, 52, 19, 58, -1, 62, -1, 53, -1, 10, 9, 11, 9, 12, 9, -1, 54, -1, 9, 54, -1, 54, 9, -1, 9, 54, 9, -1, 17, 55, 18, -1, 9, 17, 55, 18, -1, 17, 55, 18, 9, -1, 9, 17, 55, 18, 9, -1, 13, 55, 14, -1, 9, 13, 55, 14, -1, 13, 55, 14, 9, -1, 9, 13, 55, 14, 9, -1, 15, 3, -1, 9, 15, 3, -1, 9, 8, 3, -1, 6, -1, 4, -1, 5, -1, -1, 56, -1, 9, -1, 56, 57, 9, -1, 20, -1, 16, -1, 59, 7, 61, -1, -1, 60, -1, 61, -1, 60, 20, 61, -1, 3, -1, 3, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 139, 139, 142, 147, 152, 159, 161, 166, 168, 170, 172, 174, 176, 178, 180, 182, 185, 188, 191, 194, 197, 200, 205, 210, 212, 214, 219, 220, 224, 226, 230, 232, 236, 241, 242, 246, 248, 252, 259 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "LST_SIMPLEID", "LST_LOGICALOP", "LST_EQOP", "LST_SIMPLEOP", "LST_MAPSYM", "LST_FIELDMAPSYM", "LST_MARKERSYM", "LST_ifTOKEN", "LST_thenTOKEN", "LST_elseTOKEN", "LST_LBRACKET", "LST_RBRACKET", "LST_SELECTSYM", "LST_SEPSYM", "LST_OPENSYM", "LST_CLOSESYM", "LST_COLON", "LST_COMMA", "LST_EOL", "LST_COMMENTSYM", "LST_WHITESPACE", "LST_QUANTIFIERSYM", "LST_EQUATIONSYM", "LST_EQSEPSYM", "LST_COMPOSESYM", "LST_LPAR", "LST_RPAR", "LST_assertsTOKEN", "LST_assumesTOKEN", "LST_byTOKEN", "LST_convertsTOKEN", "LST_enumerationTOKEN", "LST_equationsTOKEN", "LST_exemptingTOKEN", "LST_forTOKEN", "LST_generatedTOKEN", "LST_impliesTOKEN", "LST_includesTOKEN", "LST_introducesTOKEN", "LST_ofTOKEN", "LST_partitionedTOKEN", "LST_traitTOKEN", "LST_tupleTOKEN", "LST_unionTOKEN", "LST_BADTOKEN", "$accept", "top", "operatorList", "operator", "name", "opForm", "anyOp", "middle", "placeList", "separator", "signature", "domain", "sortList", "sortId", "opId", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint8 yyr1[] = { 0, 48, 49, 50, 50, 51, 52, 52, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 54, 54, 54, 55, 55, 56, 56, 57, 57, 58, 59, 59, 60, 60, 61, 62 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 1, 1, 2, 3, 1, 1, 6, 1, 2, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 2, 3, 3, 1, 1, 1, 0, 1, 1, 3, 1, 1, 3, 0, 1, 1, 3, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint8 yydefact[] = { 0, 39, 25, 26, 24, 0, 0, 27, 0, 27, 0, 2, 3, 0, 7, 9, 6, 0, 27, 0, 27, 10, 0, 29, 0, 28, 21, 0, 1, 4, 34, 11, 23, 0, 22, 0, 12, 0, 17, 32, 31, 0, 13, 38, 5, 0, 35, 36, 18, 14, 0, 19, 30, 15, 0, 0, 20, 16, 0, 33, 37, 8 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int8 yydefgoto[] = { -1, 10, 11, 12, 13, 14, 15, 24, 25, 41, 44, 45, 46, 47, 16 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -34 static const yytype_int8 yypact[] = { -3, -34, -34, -34, -34, 11, -4, 2, 10, 2, 23, -3, -34, 6, -34, 18, -34, 26, 2, 27, 2, 22, 21, -34, 19, -12, -34, 16, -34, -34, 32, -34, -34, 24, -34, 25, -34, 28, 30, -34, -34, 31, 33, -34, -34, 29, 34, -34, 35, 36, 37, -34, -34, -34, 32, 32, -34, -34, 38, -34, -34, -34 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int8 yypgoto[] = { -34, -34, -34, 39, -34, -34, 41, 0, -34, -34, -34, -34, -34, -33, -34 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -1 static const yytype_uint8 yytable[] = { 1, 2, 3, 4, 39, 22, 5, 6, 40, 27, 7, 23, 8, 26, 9, 2, 3, 4, 33, 17, 35, 59, 60, 28, 18, 30, 19, 31, 20, 32, 34, 36, 37, 38, 42, 43, 54, 50, 48, 51, 52, 0, 53, 49, 56, 57, 21, 61, 0, 58, 29, 0, 0, 0, 55 }; static const yytype_int8 yycheck[] = { 3, 4, 5, 6, 16, 9, 9, 10, 20, 9, 13, 9, 15, 3, 17, 4, 5, 6, 18, 8, 20, 54, 55, 0, 13, 19, 15, 9, 17, 3, 3, 9, 11, 14, 18, 3, 7, 9, 14, 9, 9, -1, 9, 18, 9, 9, 5, 9, -1, 12, 11, -1, -1, -1, 20 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint8 yystos[] = { 0, 3, 4, 5, 6, 9, 10, 13, 15, 17, 49, 50, 51, 52, 53, 54, 62, 8, 13, 15, 17, 54, 9, 9, 55, 56, 3, 55, 0, 51, 19, 9, 3, 55, 3, 55, 9, 11, 14, 16, 20, 57, 18, 3, 58, 59, 60, 61, 14, 18, 9, 9, 9, 9, 7, 20, 9, 9, 12, 61, 61, 9 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) #else # define YYLEX yylex (&yylval) #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: { lslOpList_free ((yyvsp[(1) - (1)].operators)); ;} break; case 3: { lslOpList x = lslOpList_new (); g_importedlslOp = (yyvsp[(1) - (1)].operator); lslOpList_add (x, (yyvsp[(1) - (1)].operator)); (yyval.operators) = x; ;} break; case 4: { lslOpList_add ((yyvsp[(1) - (2)].operators), (yyvsp[(2) - (2)].operator)); (yyval.operators) = (yyvsp[(1) - (2)].operators); ;} break; case 5: { (yyval.operator) = makelslOpNode ((yyvsp[(1) - (3)].name), (yyvsp[(3) - (3)].signature)); ;} break; case 6: { (yyval.name) = makeNameNodeId ((yyvsp[(1) - (1)].ltok)); ;} break; case 7: { (yyval.name) = makeNameNodeForm ((yyvsp[(1) - (1)].opform)); ;} break; case 8: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (6)].ltok), OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ;} break; case 9: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (1)].ltok), OPF_ANYOP, opFormUnion_createAnyOp ((yyvsp[(1) - (1)].ltok)), ltoken_undefined); ;} break; case 10: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_MANYOP, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 11: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_ANYOPM, opFormUnion_createAnyOp ((yyvsp[(1) - (2)].ltok)), ltoken_undefined); ;} break; case 12: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MANYOPM, opFormUnion_createAnyOp ((yyvsp[(2) - (3)].ltok)), ltoken_undefined); ;} break; case 13: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 14: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (4)].ltok), OPF_MMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 15: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_MIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 16: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_MMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 17: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_BMIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 18: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (4)].ltok), OPF_BMMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 19: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_BMIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 20: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_BMMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 21: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_SELECT, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 22: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MSELECT, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 23: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MMAP, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 24: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 25: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 26: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 27: { (yyval.count) = 0; ;} break; case 28: { (yyval.count) = (yyvsp[(1) - (1)].count); ;} break; case 29: { (yyval.count) = 1; ;} break; case 30: { (yyval.count) = (yyvsp[(1) - (3)].count) + 1; ;} break; case 31: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 32: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; case 33: { (yyval.signature) = makesigNode ((yyvsp[(2) - (3)].ltok), (yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 34: { (yyval.ltokenList) = ltokenList_new (); ;} break; case 35: { (yyval.ltokenList) = (yyvsp[(1) - (1)].ltokenList); ;} break; case 36: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 37: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 38: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setText ((yyval.ltok), processTraitSortId (ltoken_getText ((yyvsp[(1) - (1)].ltok)))); ;} break; case 39: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ;} break; /* Line 1267 of yacc.c. */ default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } # include "bison.reset" extern char *yytext; void lslerror (char *s) { llfatalbug (cstring_makeLiteral ("There has been a problem in the parser with LSL signatures. This is believed to result " "from a problem with bison v. 1.25. Please try rebuidling Splint " "using the pre-compiled grammar files by commenting out the " "BISON= line in the top-level Makefile.")); } static void yyprint (FILE *file, int type, YYSTYPE value) { fprintf (file, " (%u:%u type: %d; text: %s) ", ltoken_getLine (value.ltok), ltoken_getCol (value.ltok), type, ltoken_getRawTextChars (value.ltok)); } extern void PrintToken (ltoken tok) { char *codStr; switch (ltoken_getCode (tok)) { case NOTTOKEN: codStr = "*** NOTTOKEN ***"; break; case LST_QUANTIFIERSYM: codStr = "QUANTIFIERSYM"; break; case LST_LOGICALOP: codStr = "LOGICALOP: "; break; case LST_SELECTSYM: codStr = "LST_SELECTSYM"; break; case LST_OPENSYM: codStr = "LST_OPENSYM"; break; case LST_SEPSYM: codStr = "SEPSYM"; break; case LST_CLOSESYM: codStr = "LST_CLOSESYM"; break; case LST_SIMPLEID: codStr = "LST_SIMPLEID"; break; case LST_MAPSYM: codStr = "MAPSYM"; break; case LST_MARKERSYM: codStr = "LST_MARKERSYM"; break; case LST_COMMENTSYM: codStr = "COMMENTSYM"; break; case LST_SIMPLEOP: codStr = "SIMPLEOP"; break; case LST_COLON: codStr = "LST_COLON"; break; case LST_COMMA: codStr = "COMMA"; break; case LST_LBRACKET: codStr = "LST_LBRACKET"; break; case LST_LPAR: codStr = "LST_LPAR"; break; case LST_RBRACKET: codStr = "LST_RBRACKET"; break; case LST_RPAR: codStr = "LST_RPAR"; break; case LST_EQOP: codStr = "LST_EQOP"; break; case LST_WHITESPACE: codStr = "WHITESPACE,"; break; case LST_EOL: codStr = "LST_EOL"; break; case LST_elseTOKEN: codStr = "elseTOKEN"; break; case LST_ifTOKEN: codStr = "ifTOKEN"; break; case LST_thenTOKEN: codStr = "thenTOKEN"; break; case LST_BADTOKEN: codStr = "*** BADTOKEN ***"; break; case LEOFTOKEN: /* can't reach LEOFTOKEN easily */ codStr = "LEOFTOKEN"; break; default: codStr = "*** invalid token code ***"; break; } /* end switch */ /* only used for debugging */ printf ("%u:%u: Token Code (%u): %s", ltoken_getLine (tok), ltoken_getCol (tok), ltoken_getCode (tok), codStr); if (ltoken_getRawText (tok) != 0) { printf (", Token String (%lu): %s\n", ltoken_getRawText (tok), ltoken_getRawTextChars (tok)); } else printf ("\n"); } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/cgrammar.c.der0000644021234200000250000111704310645776225014765 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { BADTOK = 258, SKIPTOK = 259, CTOK_ELIPSIS = 260, CASE = 261, DEFAULT = 262, CIF = 263, CELSE = 264, SWITCH = 265, WHILE = 266, DO = 267, CFOR = 268, GOTO = 269, CONTINUE = 270, BREAK = 271, RETURN = 272, TSEMI = 273, TLBRACE = 274, TRBRACE = 275, TCOMMA = 276, TCOLON = 277, TASSIGN = 278, TLPAREN = 279, TRPAREN = 280, TLSQBR = 281, TRSQBR = 282, TDOT = 283, TAMPERSAND = 284, TEXCL = 285, TTILDE = 286, TMINUS = 287, TPLUS = 288, TMULT = 289, TDIV = 290, TPERCENT = 291, TLT = 292, TGT = 293, TCIRC = 294, TBAR = 295, TQUEST = 296, CSIZEOF = 297, CALIGNOF = 298, CTYPEOF = 299, ARROW_OP = 300, CTYPEDEF = 301, COFFSETOF = 302, INC_OP = 303, DEC_OP = 304, LEFT_OP = 305, RIGHT_OP = 306, LE_OP = 307, GE_OP = 308, EQ_OP = 309, NE_OP = 310, AND_OP = 311, OR_OP = 312, MUL_ASSIGN = 313, DIV_ASSIGN = 314, MOD_ASSIGN = 315, ADD_ASSIGN = 316, SUB_ASSIGN = 317, LEFT_ASSIGN = 318, RIGHT_ASSIGN = 319, AND_ASSIGN = 320, XOR_ASSIGN = 321, OR_ASSIGN = 322, CSTRUCT = 323, CUNION = 324, CENUM = 325, VA_ARG = 326, VA_DCL = 327, QWARN = 328, QGLOBALS = 329, QMODIFIES = 330, QNOMODS = 331, QCONSTANT = 332, QFUNCTION = 333, QITER = 334, QDEFINES = 335, QUSES = 336, QALLOCATES = 337, QSETS = 338, QRELEASES = 339, QPRECLAUSE = 340, QPOSTCLAUSE = 341, QINVARIANT = 342, QALT = 343, QUNDEF = 344, QKILLED = 345, QENDMACRO = 346, LLMACRO = 347, LLMACROITER = 348, LLMACROEND = 349, TENDMACRO = 350, QDREVEALSTATE = 351, QSWITCHBREAK = 352, QLOOPBREAK = 353, QINNERBREAK = 354, QSAFEBREAK = 355, QINNERCONTINUE = 356, QFALLTHROUGH = 357, QLINTNOTREACHED = 358, QLINTFALLTHROUGH = 359, QLINTFALLTHRU = 360, QARGSUSED = 361, QPRINTFLIKE = 362, QLINTPRINTFLIKE = 363, QSCANFLIKE = 364, QMESSAGELIKE = 365, QNOTREACHED = 366, QCONST = 367, QRESTRICT = 368, QVOLATILE = 369, QINLINE = 370, QEXTENSION = 371, QEXTERN = 372, QSTATIC = 373, QAUTO = 374, QREGISTER = 375, QOUT = 376, QIN = 377, QYIELD = 378, QONLY = 379, QTEMP = 380, QSHARED = 381, QREF = 382, QUNIQUE = 383, QCHECKED = 384, QUNCHECKED = 385, QCHECKEDSTRICT = 386, QCHECKMOD = 387, QKEEP = 388, QKEPT = 389, QPARTIAL = 390, QSPECIAL = 391, QOWNED = 392, QDEPENDENT = 393, QRETURNED = 394, QEXPOSED = 395, QNULL = 396, QOBSERVER = 397, QISNULL = 398, QEXITS = 399, QMAYEXIT = 400, QNEVEREXIT = 401, QTRUEEXIT = 402, QFALSEEXIT = 403, QLONG = 404, QSIGNED = 405, QUNSIGNED = 406, QSHORT = 407, QUNUSED = 408, QSEF = 409, QNOTNULL = 410, QRELNULL = 411, QABSTRACT = 412, QNUMABSTRACT = 413, QCONCRETE = 414, QMUTABLE = 415, QIMMUTABLE = 416, QTRUENULL = 417, QFALSENULL = 418, QEXTERNAL = 419, QREFCOUNTED = 420, QREFS = 421, QNEWREF = 422, QTEMPREF = 423, QKILLREF = 424, QRELDEF = 425, CGCHAR = 426, CBOOL = 427, CINT = 428, CGFLOAT = 429, CDOUBLE = 430, CVOID = 431, QANYTYPE = 432, QINTEGRALTYPE = 433, QUNSIGNEDINTEGRALTYPE = 434, QSIGNEDINTEGRALTYPE = 435, QNULLTERMINATED = 436, QSETBUFFERSIZE = 437, QSETSTRINGLENGTH = 438, QMAXSET = 439, QMAXREAD = 440, QTESTINRANGE = 441, TCAND = 442, IDENTIFIER = 443, NEW_IDENTIFIER = 444, TYPE_NAME_OR_ID = 445, CANNOTATION = 446, CCONSTANT = 447, ITER_NAME = 448, ITER_ENDNAME = 449, TYPE_NAME = 450, METASTATE_NAME = 451 }; #endif /* Tokens. */ #define BADTOK 258 #define SKIPTOK 259 #define CTOK_ELIPSIS 260 #define CASE 261 #define DEFAULT 262 #define CIF 263 #define CELSE 264 #define SWITCH 265 #define WHILE 266 #define DO 267 #define CFOR 268 #define GOTO 269 #define CONTINUE 270 #define BREAK 271 #define RETURN 272 #define TSEMI 273 #define TLBRACE 274 #define TRBRACE 275 #define TCOMMA 276 #define TCOLON 277 #define TASSIGN 278 #define TLPAREN 279 #define TRPAREN 280 #define TLSQBR 281 #define TRSQBR 282 #define TDOT 283 #define TAMPERSAND 284 #define TEXCL 285 #define TTILDE 286 #define TMINUS 287 #define TPLUS 288 #define TMULT 289 #define TDIV 290 #define TPERCENT 291 #define TLT 292 #define TGT 293 #define TCIRC 294 #define TBAR 295 #define TQUEST 296 #define CSIZEOF 297 #define CALIGNOF 298 #define CTYPEOF 299 #define ARROW_OP 300 #define CTYPEDEF 301 #define COFFSETOF 302 #define INC_OP 303 #define DEC_OP 304 #define LEFT_OP 305 #define RIGHT_OP 306 #define LE_OP 307 #define GE_OP 308 #define EQ_OP 309 #define NE_OP 310 #define AND_OP 311 #define OR_OP 312 #define MUL_ASSIGN 313 #define DIV_ASSIGN 314 #define MOD_ASSIGN 315 #define ADD_ASSIGN 316 #define SUB_ASSIGN 317 #define LEFT_ASSIGN 318 #define RIGHT_ASSIGN 319 #define AND_ASSIGN 320 #define XOR_ASSIGN 321 #define OR_ASSIGN 322 #define CSTRUCT 323 #define CUNION 324 #define CENUM 325 #define VA_ARG 326 #define VA_DCL 327 #define QWARN 328 #define QGLOBALS 329 #define QMODIFIES 330 #define QNOMODS 331 #define QCONSTANT 332 #define QFUNCTION 333 #define QITER 334 #define QDEFINES 335 #define QUSES 336 #define QALLOCATES 337 #define QSETS 338 #define QRELEASES 339 #define QPRECLAUSE 340 #define QPOSTCLAUSE 341 #define QINVARIANT 342 #define QALT 343 #define QUNDEF 344 #define QKILLED 345 #define QENDMACRO 346 #define LLMACRO 347 #define LLMACROITER 348 #define LLMACROEND 349 #define TENDMACRO 350 #define QDREVEALSTATE 351 #define QSWITCHBREAK 352 #define QLOOPBREAK 353 #define QINNERBREAK 354 #define QSAFEBREAK 355 #define QINNERCONTINUE 356 #define QFALLTHROUGH 357 #define QLINTNOTREACHED 358 #define QLINTFALLTHROUGH 359 #define QLINTFALLTHRU 360 #define QARGSUSED 361 #define QPRINTFLIKE 362 #define QLINTPRINTFLIKE 363 #define QSCANFLIKE 364 #define QMESSAGELIKE 365 #define QNOTREACHED 366 #define QCONST 367 #define QRESTRICT 368 #define QVOLATILE 369 #define QINLINE 370 #define QEXTENSION 371 #define QEXTERN 372 #define QSTATIC 373 #define QAUTO 374 #define QREGISTER 375 #define QOUT 376 #define QIN 377 #define QYIELD 378 #define QONLY 379 #define QTEMP 380 #define QSHARED 381 #define QREF 382 #define QUNIQUE 383 #define QCHECKED 384 #define QUNCHECKED 385 #define QCHECKEDSTRICT 386 #define QCHECKMOD 387 #define QKEEP 388 #define QKEPT 389 #define QPARTIAL 390 #define QSPECIAL 391 #define QOWNED 392 #define QDEPENDENT 393 #define QRETURNED 394 #define QEXPOSED 395 #define QNULL 396 #define QOBSERVER 397 #define QISNULL 398 #define QEXITS 399 #define QMAYEXIT 400 #define QNEVEREXIT 401 #define QTRUEEXIT 402 #define QFALSEEXIT 403 #define QLONG 404 #define QSIGNED 405 #define QUNSIGNED 406 #define QSHORT 407 #define QUNUSED 408 #define QSEF 409 #define QNOTNULL 410 #define QRELNULL 411 #define QABSTRACT 412 #define QNUMABSTRACT 413 #define QCONCRETE 414 #define QMUTABLE 415 #define QIMMUTABLE 416 #define QTRUENULL 417 #define QFALSENULL 418 #define QEXTERNAL 419 #define QREFCOUNTED 420 #define QREFS 421 #define QNEWREF 422 #define QTEMPREF 423 #define QKILLREF 424 #define QRELDEF 425 #define CGCHAR 426 #define CBOOL 427 #define CINT 428 #define CGFLOAT 429 #define CDOUBLE 430 #define CVOID 431 #define QANYTYPE 432 #define QINTEGRALTYPE 433 #define QUNSIGNEDINTEGRALTYPE 434 #define QSIGNEDINTEGRALTYPE 435 #define QNULLTERMINATED 436 #define QSETBUFFERSIZE 437 #define QSETSTRINGLENGTH 438 #define QMAXSET 439 #define QMAXREAD 440 #define QTESTINRANGE 441 #define TCAND 442 #define IDENTIFIER 443 #define NEW_IDENTIFIER 444 #define TYPE_NAME_OR_ID 445 #define CANNOTATION 446 #define CCONSTANT 447 #define ITER_NAME 448 #define ITER_ENDNAME 449 #define TYPE_NAME 450 #define METASTATE_NAME 451 /* Copy the first part of user declarations. */ /* ** ** cgrammar.y ** ** Yacc/Bison grammar for extended ANSI C used by Splint. ** ** original grammar by Nate Osgood --- ** hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993 ** ** changes for Splint --- handle typedef names correctly ** fix struct/union parsing bug (empty struct is accepted) ** add productions to handle macros --- require ** error correction --- main source of conflicts in grammar. ** need to process initializations sequentially, L->R ** ** production names are cryptic, so more productions fit on one line ** ** conflicts: 87 shift/reduce, 18 reduce/reduce ** most of these are due to handling macros ** a few are due to handling type expressions */ /*@=allmacros@*/ extern int yylex (); extern void yyerror (char *); # include "splintMacros.nf" # include "basic.h" # include "cscanner.h" # include "cscannerHelp.h" # include "cgrammar.h" # include "exprChecks.h" /*@-allmacros@*/ /*@-matchfields@*/ # define SHOWCSYM FALSE /* ** This is necessary, or else when the bison-generated code #include's malloc.h, ** there will be a parse error. ** ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations ** in bison-generated files under Win32. */ # ifdef WIN32 # undef malloc # undef calloc # undef realloc # endif /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined cgrammar_YYSTYPE && ! defined cgrammar_YYSTYPE_IS_DECLARED typedef union cgrammar_YYSTYPE { lltok tok; int count; qual typequal; qualList tquallist; ctype ctyp; /*@dependent@*/ sRef sr; /*@only@*/ sRef osr; /*@only@*/ functionClauseList funcclauselist; /*@only@*/ functionClause funcclause; /*@only@*/ flagSpec flagspec; /*@only@*/ globalsClause globsclause; /*@only@*/ modifiesClause modsclause; /*@only@*/ warnClause warnclause; /*@only@*/ stateClause stateclause; /*@only@*/ pointers pointers; /*@only@*/ functionConstraint fcnconstraint; /*@only@*/ metaStateConstraint msconstraint; /*@only@*/ metaStateSpecifier msspec; /*@only@*/ metaStateExpression msexpr; /*@observer@*/ metaStateInfo msinfo; /*@only@*/ sRefList srlist; /*@only@*/ globSet globset; /*@only@*/ qtype qtyp; /*@only@*/ cstring cname; /*@observer@*/ annotationInfo annotation; /*@only@*/ idDecl ntyp; /*@only@*/ idDeclList ntyplist; /*@only@*/ uentryList flist; /*@owned@*/ uentryList entrylist; /*@observer@*/ /*@dependent@*/ uentry entry; /*@only@*/ uentry oentry; /*@only@*/ exprNode expr; /*@only@*/ enumNameList enumnamelist; /*@only@*/ exprNodeList exprlist; /*@only@*/ sRefSet srset; /*@only@*/ cstringList cstringlist; /*drl added 1/19/2001 */ constraint con; constraintList conL; constraintExpr conE; /* drl */ } /* Line 193 of yacc.c. */ cgrammar_YYSTYPE; # define yystype cgrammar_YYSTYPE /* obsolescent; will be withdrawn */ # define cgrammar_YYSTYPE_IS_DECLARED 1 # define cgrammar_YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined cgrammar_YYSTYPE_IS_TRIVIAL && cgrammar_YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; cgrammar_YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (cgrammar_YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 262 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 6819 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 197 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 276 /* YYNRULES -- Number of rules. */ #define YYNRULES 719 /* YYNRULES -- Number of states. */ #define YYNSTATES 1264 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 451 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 6, 8, 11, 14, 16, 18, 20, 22, 24, 26, 28, 37, 49, 50, 56, 58, 62, 64, 67, 69, 76, 80, 87, 88, 95, 96, 104, 106, 113, 117, 124, 125, 132, 133, 141, 142, 143, 154, 158, 162, 166, 169, 171, 175, 176, 181, 182, 187, 189, 193, 195, 197, 199, 203, 205, 209, 211, 213, 215, 217, 219, 221, 226, 232, 234, 236, 238, 240, 244, 249, 252, 256, 260, 264, 266, 268, 270, 271, 274, 275, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 305, 306, 311, 313, 316, 317, 321, 323, 327, 329, 331, 332, 335, 339, 342, 344, 348, 351, 352, 355, 357, 359, 361, 363, 365, 367, 369, 371, 373, 375, 377, 379, 381, 383, 385, 387, 391, 392, 396, 397, 398, 403, 406, 409, 411, 413, 415, 417, 421, 426, 429, 433, 437, 441, 443, 445, 447, 451, 453, 455, 459, 464, 467, 471, 475, 479, 480, 482, 484, 488, 490, 492, 494, 498, 500, 502, 503, 508, 510, 515, 519, 524, 531, 537, 543, 546, 549, 557, 559, 563, 565, 568, 571, 574, 577, 580, 583, 586, 589, 593, 595, 599, 604, 606, 616, 617, 621, 622, 623, 628, 631, 636, 639, 641, 646, 648, 652, 656, 660, 662, 666, 670, 672, 676, 680, 682, 686, 690, 694, 698, 700, 704, 708, 710, 714, 716, 720, 722, 726, 728, 729, 734, 736, 737, 742, 744, 745, 746, 753, 754, 755, 763, 765, 769, 773, 777, 781, 785, 789, 793, 797, 801, 805, 809, 811, 815, 816, 818, 820, 822, 824, 826, 830, 831, 841, 842, 854, 856, 858, 861, 862, 869, 870, 879, 884, 889, 890, 891, 894, 896, 901, 904, 906, 911, 912, 917, 919, 923, 928, 931, 934, 937, 939, 942, 946, 949, 951, 955, 957, 959, 961, 963, 965, 968, 969, 976, 979, 982, 983, 990, 991, 997, 999, 1001, 1003, 1005, 1007, 1009, 1011, 1013, 1015, 1017, 1019, 1021, 1023, 1025, 1027, 1029, 1031, 1033, 1035, 1037, 1039, 1041, 1043, 1045, 1047, 1049, 1051, 1053, 1055, 1057, 1059, 1061, 1063, 1065, 1067, 1069, 1071, 1073, 1075, 1077, 1079, 1081, 1083, 1085, 1087, 1089, 1091, 1093, 1095, 1097, 1099, 1101, 1103, 1106, 1109, 1112, 1115, 1118, 1121, 1124, 1127, 1130, 1133, 1136, 1139, 1142, 1145, 1148, 1151, 1154, 1157, 1160, 1163, 1166, 1169, 1172, 1175, 1178, 1181, 1185, 1187, 1192, 1194, 1198, 1201, 1204, 1207, 1208, 1210, 1211, 1212, 1213, 1226, 1227, 1228, 1240, 1247, 1254, 1255, 1256, 1267, 1268, 1269, 1280, 1286, 1292, 1297, 1302, 1303, 1305, 1307, 1310, 1316, 1320, 1323, 1328, 1330, 1334, 1339, 1346, 1347, 1356, 1361, 1363, 1367, 1370, 1372, 1377, 1379, 1381, 1384, 1387, 1389, 1392, 1394, 1397, 1399, 1401, 1403, 1405, 1408, 1410, 1413, 1416, 1420, 1422, 1426, 1428, 1432, 1434, 1436, 1440, 1441, 1444, 1445, 1450, 1455, 1457, 1459, 1462, 1464, 1466, 1469, 1470, 1472, 1478, 1481, 1485, 1489, 1494, 1498, 1503, 1508, 1514, 1516, 1518, 1520, 1522, 1524, 1526, 1528, 1530, 1532, 1534, 1539, 1541, 1543, 1545, 1548, 1551, 1559, 1566, 1569, 1570, 1571, 1582, 1583, 1590, 1592, 1594, 1596, 1598, 1601, 1603, 1605, 1607, 1609, 1611, 1613, 1615, 1619, 1621, 1622, 1626, 1629, 1632, 1634, 1636, 1638, 1640, 1642, 1644, 1646, 1648, 1650, 1652, 1656, 1658, 1660, 1662, 1665, 1668, 1669, 1672, 1673, 1678, 1679, 1686, 1687, 1691, 1692, 1698, 1702, 1705, 1709, 1710, 1711, 1712, 1713, 1714, 1716, 1719, 1722, 1726, 1729, 1733, 1737, 1742, 1745, 1748, 1752, 1756, 1761, 1763, 1766, 1768, 1771, 1773, 1777, 1779, 1784, 1786, 1789, 1791, 1794, 1796, 1799, 1801, 1806, 1809, 1810, 1816, 1817, 1824, 1829, 1834, 1835, 1836, 1847, 1849, 1850, 1855, 1857, 1859, 1861, 1863, 1865, 1868, 1870, 1874, 1876, 1881, 1885, 1890, 1897, 1903, 1909, 1912, 1915, 1917, 1920, 1923, 1926, 1929, 1932, 1935, 1938, 1941, 1943, 1945, 1950, 1952, 1956, 1960, 1964, 1966, 1970, 1974, 1976, 1980, 1984, 1986, 1990, 1994, 1998, 2002, 2004, 2008, 2012, 2014, 2018, 2020, 2024, 2026, 2030, 2032, 2036, 2038, 2042, 2044, 2045, 2046, 2053, 2054, 2055, 2063, 2065, 2069, 2073, 2077, 2081, 2085, 2089, 2093, 2097, 2101, 2105, 2109, 2111, 2112, 2114, 2117, 2125, 2128, 2131, 2139, 2146, 2149, 2153, 2156, 2160, 2163, 2167, 2171, 2175, 2179, 2182, 2186, 2187, 2189, 2190, 2192, 2194, 2196, 2198, 2200, 2202, 2204, 2206, 2208, 2213 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 198, 0, -1, -1, 199, -1, 200, -1, 199, 200, -1, 261, 468, -1, 201, -1, 202, -1, 212, -1, 215, -1, 303, -1, 18, -1, 1, -1, 77, 347, 361, 371, 361, 468, 312, 91, -1, 77, 347, 361, 371, 361, 23, 312, 319, 318, 468, 91, -1, -1, 78, 203, 204, 468, 91, -1, 205, -1, 347, 361, 205, -1, 209, -1, 375, 209, -1, 471, -1, 312, 24, 361, 371, 312, 25, -1, 206, 26, 27, -1, 206, 26, 312, 302, 27, 361, -1, -1, 206, 313, 24, 25, 207, 233, -1, -1, 206, 313, 24, 372, 25, 208, 233, -1, 471, -1, 312, 24, 361, 205, 312, 25, -1, 209, 26, 27, -1, 209, 26, 312, 302, 27, 361, -1, -1, 209, 313, 24, 25, 210, 234, -1, -1, 209, 313, 24, 372, 25, 211, 234, -1, -1, -1, 79, 471, 24, 372, 25, 213, 234, 214, 468, 91, -1, 92, 403, 95, -1, 93, 389, 95, -1, 94, 390, 95, -1, 92, 95, -1, 256, -1, 218, 23, 221, -1, -1, 230, 219, 22, 222, -1, -1, 5, 220, 22, 222, -1, 218, -1, 218, 40, 221, -1, 196, -1, 187, -1, 56, -1, 225, 223, 224, -1, 225, -1, 228, 227, 228, -1, 184, -1, 185, -1, 53, -1, 52, -1, 54, -1, 229, -1, 231, 24, 228, 25, -1, 24, 228, 232, 228, 25, -1, 230, -1, 192, -1, 470, -1, 189, -1, 230, 26, 27, -1, 230, 26, 192, 27, -1, 34, 230, -1, 24, 230, 25, -1, 230, 28, 471, -1, 230, 45, 471, -1, 226, -1, 33, -1, 32, -1, -1, 235, 233, -1, -1, 236, 234, -1, 237, -1, 241, -1, 240, -1, 325, -1, 328, -1, 247, -1, 238, -1, 242, -1, 240, -1, 326, -1, 330, -1, 248, -1, 238, 91, -1, -1, 74, 239, 249, 468, -1, 76, -1, 242, 91, -1, -1, 75, 243, 262, -1, 245, -1, 245, 40, 244, -1, 189, -1, 247, -1, -1, 248, 91, -1, 73, 244, 442, -1, 73, 244, -1, 250, -1, 249, 21, 250, -1, 251, 252, -1, -1, 253, 251, -1, 470, -1, 189, -1, 303, -1, 89, -1, 90, -1, 121, -1, 122, -1, 135, -1, 80, -1, 81, -1, 82, -1, 83, -1, 84, -1, 85, -1, 86, -1, 371, -1, 347, 361, 371, -1, -1, 19, 258, 420, -1, -1, -1, 259, 424, 260, 413, -1, 216, 257, -1, 265, 468, -1, 468, -1, 470, -1, 189, -1, 190, -1, 263, 26, 27, -1, 263, 26, 264, 27, -1, 34, 263, -1, 24, 263, 25, -1, 263, 28, 471, -1, 263, 45, 471, -1, 263, -1, 442, -1, 263, -1, 265, 21, 263, -1, 470, -1, 189, -1, 266, 26, 27, -1, 266, 26, 264, 27, -1, 34, 266, -1, 24, 266, 25, -1, 266, 28, 471, -1, 266, 45, 471, -1, -1, 268, -1, 266, -1, 268, 21, 266, -1, 470, -1, 189, -1, 442, -1, 24, 300, 25, -1, 190, -1, 116, -1, -1, 24, 270, 413, 25, -1, 269, -1, 271, 26, 300, 27, -1, 271, 24, 25, -1, 271, 24, 272, 25, -1, 71, 24, 299, 21, 383, 25, -1, 271, 361, 28, 471, 312, -1, 271, 361, 45, 471, 312, -1, 271, 48, -1, 271, 49, -1, 24, 383, 25, 19, 425, 469, 20, -1, 299, -1, 272, 21, 299, -1, 271, -1, 48, 273, -1, 49, 273, -1, 29, 281, -1, 34, 281, -1, 33, 281, -1, 32, 281, -1, 31, 281, -1, 30, 281, -1, 278, 276, 279, -1, 275, -1, 274, 28, 471, -1, 274, 26, 300, 27, -1, 471, -1, 47, 312, 24, 383, 361, 21, 274, 25, 312, -1, -1, 312, 277, 280, -1, -1, -1, 42, 24, 383, 25, -1, 42, 273, -1, 43, 24, 383, 25, -1, 43, 273, -1, 273, -1, 24, 383, 25, 281, -1, 281, -1, 282, 34, 281, -1, 282, 35, 281, -1, 282, 36, 281, -1, 282, -1, 283, 33, 282, -1, 283, 32, 282, -1, 283, -1, 284, 50, 283, -1, 284, 51, 283, -1, 284, -1, 285, 37, 284, -1, 285, 38, 284, -1, 285, 52, 284, -1, 285, 53, 284, -1, 285, -1, 286, 54, 285, -1, 286, 55, 285, -1, 286, -1, 287, 29, 286, -1, 287, -1, 288, 39, 287, -1, 288, -1, 289, 40, 288, -1, 289, -1, -1, 290, 56, 291, 289, -1, 290, -1, -1, 292, 57, 293, 290, -1, 292, -1, -1, -1, 292, 41, 295, 22, 296, 294, -1, -1, -1, 292, 41, 297, 300, 22, 298, 294, -1, 294, -1, 273, 23, 299, -1, 273, 58, 299, -1, 273, 59, 299, -1, 273, 60, 299, -1, 273, 61, 299, -1, 273, 62, 299, -1, 273, 63, 299, -1, 273, 64, 299, -1, 273, 65, 299, -1, 273, 66, 299, -1, 273, 67, 299, -1, 299, -1, 300, 21, 299, -1, -1, 300, -1, 294, -1, 304, -1, 72, -1, 310, -1, 347, 312, 18, -1, -1, 347, 361, 371, 361, 305, 312, 318, 18, 312, -1, -1, 347, 361, 371, 361, 23, 306, 312, 319, 318, 18, 312, -1, 308, -1, 195, -1, 371, 361, -1, -1, 371, 361, 23, 309, 312, 319, -1, -1, 46, 347, 311, 361, 316, 312, 246, 18, -1, 46, 347, 312, 18, -1, 46, 314, 312, 18, -1, -1, -1, 315, 312, -1, 308, -1, 314, 21, 361, 308, -1, 317, 312, -1, 307, -1, 316, 21, 361, 307, -1, -1, 318, 21, 361, 308, -1, 299, -1, 19, 323, 20, -1, 19, 323, 21, 20, -1, 320, 319, -1, 321, 23, -1, 471, 22, -1, 322, -1, 321, 322, -1, 26, 302, 27, -1, 28, 471, -1, 319, -1, 323, 21, 319, -1, 117, -1, 115, -1, 118, -1, 119, -1, 120, -1, 326, 91, -1, -1, 254, 361, 327, 268, 468, 312, -1, 330, 91, -1, 255, 361, -1, -1, 329, 336, 331, 267, 468, 312, -1, -1, 329, 332, 333, 468, 312, -1, 224, -1, 217, -1, 144, -1, 145, -1, 147, -1, 148, -1, 146, -1, 129, -1, 132, -1, 130, -1, 131, -1, 137, -1, 138, -1, 123, -1, 125, -1, 124, -1, 133, -1, 134, -1, 126, -1, 128, -1, 141, -1, 143, -1, 156, -1, 155, -1, 140, -1, 142, -1, 181, -1, 191, -1, 139, -1, 154, -1, 153, -1, 164, -1, 162, -1, 163, -1, 157, -1, 158, -1, 159, -1, 160, -1, 161, -1, 165, -1, 166, -1, 169, -1, 170, -1, 167, -1, 168, -1, 152, -1, 149, -1, 150, -1, 151, -1, 121, -1, 122, -1, 135, -1, 136, -1, 112, 312, -1, 114, 312, -1, 113, 312, -1, 343, 312, -1, 336, 312, -1, 334, 312, -1, 337, 312, -1, 335, 312, -1, 339, 312, -1, 338, 312, -1, 340, 312, -1, 341, 312, -1, 171, 361, -1, 173, 361, -1, 172, 361, -1, 174, 361, -1, 175, 361, -1, 176, 361, -1, 177, 361, -1, 178, 361, -1, 179, 361, -1, 180, 361, -1, 472, 361, -1, 352, 361, -1, 366, 361, -1, 342, 361, -1, 312, 347, 312, -1, 349, -1, 349, 88, 348, 91, -1, 383, -1, 383, 21, 348, -1, 324, 350, -1, 344, 350, -1, 345, 350, -1, -1, 347, -1, -1, -1, -1, 361, 68, 471, 312, 19, 353, 417, 362, 418, 354, 20, 351, -1, -1, -1, 361, 69, 471, 312, 19, 355, 417, 362, 418, 356, 20, -1, 361, 68, 471, 312, 19, 20, -1, 361, 69, 471, 312, 19, 20, -1, -1, -1, 361, 68, 312, 19, 357, 417, 362, 418, 358, 20, -1, -1, -1, 361, 69, 312, 19, 359, 417, 362, 418, 360, 20, -1, 361, 68, 312, 19, 20, -1, 361, 69, 312, 19, 20, -1, 361, 68, 471, 361, -1, 361, 69, 471, 361, -1, -1, 363, -1, 215, -1, 362, 363, -1, 347, 361, 364, 312, 18, -1, 347, 312, 18, -1, 365, 361, -1, 364, 21, 365, 361, -1, 371, -1, 22, 312, 302, -1, 371, 22, 312, 302, -1, 361, 70, 19, 368, 20, 312, -1, -1, 361, 70, 471, 19, 367, 368, 20, 312, -1, 361, 70, 471, 312, -1, 369, -1, 368, 21, 369, -1, 368, 21, -1, 471, -1, 471, 23, 312, 302, -1, 206, -1, 385, -1, 375, 195, -1, 375, 370, -1, 206, -1, 375, 206, -1, 378, -1, 361, 376, -1, 112, -1, 113, -1, 114, -1, 373, -1, 374, 373, -1, 34, -1, 34, 374, -1, 34, 375, -1, 34, 374, 375, -1, 377, -1, 377, 21, 5, -1, 471, -1, 377, 21, 471, -1, 5, -1, 379, -1, 379, 21, 5, -1, -1, 380, 382, -1, -1, 379, 21, 381, 382, -1, 312, 347, 370, 312, -1, 471, -1, 346, -1, 346, 384, -1, 375, -1, 386, -1, 375, 386, -1, -1, 386, -1, 312, 24, 361, 384, 25, -1, 26, 27, -1, 26, 302, 27, -1, 386, 26, 27, -1, 386, 26, 302, 27, -1, 312, 24, 25, -1, 312, 24, 378, 25, -1, 386, 312, 24, 25, -1, 386, 312, 24, 378, 25, -1, 405, -1, 407, -1, 410, -1, 413, -1, 428, -1, 431, -1, 465, -1, 436, -1, 467, -1, 388, -1, 96, 24, 300, 25, -1, 391, -1, 389, -1, 398, -1, 391, 398, -1, 435, 391, -1, 464, 404, 11, 24, 300, 25, 18, -1, 464, 404, 11, 24, 300, 25, -1, 393, 398, -1, -1, -1, 13, 24, 301, 18, 301, 18, 394, 301, 395, 25, -1, -1, 193, 415, 24, 397, 439, 25, -1, 194, -1, 405, -1, 407, -1, 410, -1, 401, 424, -1, 401, -1, 402, -1, 428, -1, 399, -1, 392, -1, 396, -1, 467, -1, 24, 398, 25, -1, 1, -1, -1, 430, 400, 398, -1, 415, 19, -1, 419, 20, -1, 404, -1, 423, -1, 405, -1, 407, -1, 410, -1, 414, -1, 429, -1, 431, -1, 436, -1, 466, -1, 24, 404, 25, -1, 467, -1, 388, -1, 1, -1, 471, 22, -1, 111, 387, -1, -1, 102, 406, -1, -1, 6, 302, 408, 22, -1, -1, 102, 406, 6, 302, 409, 22, -1, -1, 7, 411, 22, -1, -1, 102, 406, 7, 412, 22, -1, 24, 413, 25, -1, 415, 421, -1, 415, 422, 416, -1, -1, -1, -1, -1, -1, 20, -1, 111, 20, -1, 427, 20, -1, 427, 111, 20, -1, 424, 20, -1, 424, 111, 20, -1, 424, 427, 20, -1, 424, 427, 111, 20, -1, 19, 420, -1, 19, 20, -1, 19, 423, 20, -1, 19, 424, 20, -1, 19, 424, 427, 20, -1, 404, -1, 423, 404, -1, 303, -1, 424, 303, -1, 426, -1, 425, 21, 426, -1, 299, -1, 19, 425, 469, 20, -1, 387, -1, 427, 387, -1, 18, -1, 300, 18, -1, 18, -1, 300, 18, -1, 300, -1, 8, 24, 300, 25, -1, 430, 387, -1, -1, 430, 387, 9, 432, 387, -1, -1, 10, 24, 300, 433, 25, 387, -1, 11, 24, 300, 25, -1, 11, 24, 300, 25, -1, -1, -1, 193, 437, 415, 24, 438, 439, 25, 413, 463, 416, -1, 441, -1, -1, 439, 440, 21, 441, -1, 462, -1, 470, -1, 190, -1, 189, -1, 192, -1, 442, 192, -1, 442, -1, 24, 300, 25, -1, 443, -1, 271, 26, 300, 27, -1, 271, 24, 25, -1, 271, 24, 272, 25, -1, 71, 24, 299, 21, 383, 25, -1, 271, 361, 28, 471, 312, -1, 271, 361, 45, 471, 312, -1, 271, 48, -1, 271, 49, -1, 444, -1, 48, 273, -1, 49, 273, -1, 29, 281, -1, 34, 281, -1, 33, 281, -1, 32, 281, -1, 31, 281, -1, 30, 281, -1, 276, -1, 445, -1, 24, 383, 25, 281, -1, 446, -1, 282, 34, 281, -1, 282, 35, 281, -1, 282, 36, 281, -1, 447, -1, 283, 33, 282, -1, 283, 32, 282, -1, 448, -1, 284, 50, 283, -1, 284, 51, 283, -1, 449, -1, 285, 37, 284, -1, 285, 38, 284, -1, 285, 52, 284, -1, 285, 53, 284, -1, 450, -1, 286, 54, 285, -1, 286, 55, 285, -1, 451, -1, 287, 29, 286, -1, 452, -1, 288, 39, 287, -1, 453, -1, 289, 40, 288, -1, 454, -1, 290, 56, 289, -1, 455, -1, 292, 57, 290, -1, 456, -1, -1, -1, 292, 41, 458, 22, 459, 294, -1, -1, -1, 292, 41, 460, 300, 22, 461, 294, -1, 457, -1, 273, 23, 299, -1, 273, 58, 299, -1, 273, 59, 299, -1, 273, 60, 299, -1, 273, 61, 299, -1, 273, 62, 299, -1, 273, 63, 299, -1, 273, 64, 299, -1, 273, 65, 299, -1, 273, 66, 299, -1, 273, 67, 299, -1, 194, -1, -1, 12, -1, 434, 387, -1, 464, 387, 11, 24, 300, 25, 18, -1, 393, 387, -1, 434, 404, -1, 464, 404, 11, 24, 300, 25, 18, -1, 464, 404, 11, 24, 300, 25, -1, 393, 404, -1, 14, 471, 18, -1, 15, 18, -1, 101, 15, 18, -1, 16, 18, -1, 97, 16, 18, -1, 98, 16, 18, -1, 99, 16, 18, -1, 100, 16, 18, -1, 17, 18, -1, 17, 300, 18, -1, -1, 18, -1, -1, 21, -1, 188, -1, 189, -1, 193, -1, 194, -1, 470, -1, 190, -1, 195, -1, 190, -1, 44, 24, 300, 25, -1, 44, 24, 383, 25, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 327, 327, 329, 333, 334, 338, 339, 340, 341, 342, 343, 344, 345, 349, 351, 356, 356, 365, 371, 376, 377, 382, 383, 385, 387, 405, 404, 436, 435, 465, 466, 468, 472, 490, 489, 502, 501, 516, 517, 515, 524, 525, 526, 527, 531, 535, 540, 540, 545, 545, 553, 554, 558, 564, 565, 569, 570, 574, 580, 581, 585, 586, 587, 591, 592, 593, 599, 600, 604, 606, 608, 610, 619, 621, 623, 625, 642, 646, 647, 654, 655, 665, 666, 671, 672, 673, 674, 675, 676, 680, 681, 682, 683, 684, 685, 689, 693, 693, 702, 706, 711, 710, 725, 727, 732, 736, 737, 741, 745, 751, 756, 757, 761, 765, 766, 770, 771, 772, 776, 777, 778, 779, 780, 784, 785, 786, 787, 788, 792, 793, 797, 804, 809, 809, 815, 816, 815, 826, 837, 838, 842, 843, 844, 845, 846, 847, 848, 849, 850, 854, 855, 860, 861, 865, 867, 869, 870, 871, 872, 873, 875, 880, 881, 885, 891, 904, 905, 906, 907, 908, 909, 910, 910, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 930, 931, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 949, 950, 952, 956, 962, 962, 966, 969, 973, 974, 975, 976, 982, 983, 988, 989, 990, 991, 995, 996, 997, 1001, 1002, 1003, 1007, 1008, 1009, 1010, 1011, 1015, 1016, 1017, 1021, 1022, 1026, 1027, 1031, 1032, 1036, 1038, 1037, 1049, 1051, 1050, 1063, 1065, 1067, 1064, 1069, 1070, 1069, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1090, 1091, 1095, 1096, 1100, 1106, 1107, 1108, 1112, 1127, 1126, 1138, 1137, 1146, 1147, 1151, 1156, 1156, 1161, 1161, 1164, 1165, 1169, 1173, 1177, 1181, 1182, 1186, 1190, 1191, 1195, 1196, 1200, 1201, 1202, 1203, 1211, 1212, 1217, 1218, 1222, 1223, 1227, 1229, 1239, 1240, 1241, 1242, 1243, 1247, 1252, 1251, 1267, 1271, 1276, 1275, 1290, 1289, 1321, 1322, 1326, 1327, 1328, 1329, 1330, 1334, 1335, 1336, 1337, 1341, 1342, 1343, 1344, 1345, 1346, 1347, 1348, 1349, 1350, 1351, 1352, 1353, 1354, 1355, 1356, 1357, 1361, 1362, 1366, 1367, 1371, 1372, 1376, 1377, 1378, 1379, 1380, 1384, 1385, 1386, 1387, 1388, 1389, 1393, 1394, 1395, 1396, 1400, 1401, 1402, 1403, 1407, 1408, 1409, 1410, 1411, 1412, 1413, 1414, 1415, 1416, 1417, 1418, 1426, 1427, 1428, 1429, 1430, 1431, 1432, 1433, 1434, 1435, 1436, 1437, 1438, 1439, 1443, 1448, 1449, 1454, 1455, 1460, 1461, 1462, 1466, 1467, 1471, 1478, 1480, 1478, 1484, 1486, 1484, 1489, 1491, 1493, 1495, 1493, 1498, 1500, 1498, 1503, 1505, 1507, 1508, 1512, 1516, 1517, 1518, 1522, 1524, 1529, 1531, 1536, 1537, 1538, 1543, 1545, 1545, 1547, 1551, 1553, 1555, 1559, 1564, 1572, 1573, 1574, 1580, 1585, 1586, 1591, 1592, 1596, 1597, 1598, 1602, 1603, 1607, 1608, 1609, 1610, 1614, 1615, 1619, 1620, 1624, 1625, 1626, 1630, 1630, 1631, 1631, 1636, 1648, 1665, 1666, 1670, 1671, 1672, 1676, 1677, 1681, 1683, 1684, 1686, 1687, 1689, 1691, 1693, 1695, 1702, 1703, 1704, 1705, 1706, 1707, 1708, 1709, 1710, 1711, 1715, 1719, 1723, 1727, 1728, 1733, 1735, 1737, 1739, 1745, 1745, 1744, 1753, 1752, 1756, 1760, 1761, 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, 1770, 1771, 1772, 1776, 1776, 1783, 1787, 1791, 1792, 1796, 1797, 1798, 1799, 1800, 1801, 1802, 1803, 1804, 1805, 1806, 1807, 1811, 1812, 1820, 1821, 1828, 1828, 1830, 1830, 1835, 1835, 1837, 1837, 1842, 1843, 1848, 1852, 1856, 1860, 1864, 1868, 1872, 1873, 1874, 1875, 1877, 1878, 1880, 1882, 1889, 1894, 1896, 1898, 1900, 1905, 1906, 1910, 1911, 1915, 1916, 1920, 1921, 1925, 1926, 1930, 1931, 1935, 1936, 1937, 1941, 1955, 1960, 1960, 1965, 1965, 1970, 1976, 1980, 1981, 1980, 1991, 1992, 1992, 1997, 1998, 1999, 2010, 2018, 2019, 2023, 2024, 2028, 2029, 2030, 2031, 2032, 2034, 2035, 2036, 2037, 2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2054, 2055, 2059, 2060, 2061, 2062, 2066, 2067, 2068, 2072, 2073, 2074, 2078, 2079, 2080, 2081, 2082, 2086, 2087, 2088, 2092, 2093, 2097, 2098, 2102, 2103, 2107, 2108, 2112, 2113, 2117, 2118, 2119, 2118, 2121, 2122, 2121, 2127, 2128, 2129, 2130, 2131, 2132, 2133, 2134, 2135, 2136, 2137, 2138, 2142, 2143, 2147, 2151, 2153, 2155, 2160, 2161, 2163, 2165, 2169, 2170, 2171, 2173, 2174, 2175, 2176, 2177, 2178, 2179, 2182, 2184, 2187, 2189, 2193, 2197, 2198, 2199, 2200, 2201, 2205, 2206, 2207, 2208 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "BADTOK", "SKIPTOK", "CTOK_ELIPSIS", "CASE", "DEFAULT", "CIF", "CELSE", "SWITCH", "WHILE", "DO", "CFOR", "GOTO", "CONTINUE", "BREAK", "RETURN", "TSEMI", "TLBRACE", "TRBRACE", "TCOMMA", "TCOLON", "TASSIGN", "TLPAREN", "TRPAREN", "TLSQBR", "TRSQBR", "TDOT", "TAMPERSAND", "TEXCL", "TTILDE", "TMINUS", "TPLUS", "TMULT", "TDIV", "TPERCENT", "TLT", "TGT", "TCIRC", "TBAR", "TQUEST", "CSIZEOF", "CALIGNOF", "CTYPEOF", "ARROW_OP", "CTYPEDEF", "COFFSETOF", "INC_OP", "DEC_OP", "LEFT_OP", "RIGHT_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP", "OR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "MOD_ASSIGN", "ADD_ASSIGN", "SUB_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN", "OR_ASSIGN", "CSTRUCT", "CUNION", "CENUM", "VA_ARG", "VA_DCL", "QWARN", "QGLOBALS", "QMODIFIES", "QNOMODS", "QCONSTANT", "QFUNCTION", "QITER", "QDEFINES", "QUSES", "QALLOCATES", "QSETS", "QRELEASES", "QPRECLAUSE", "QPOSTCLAUSE", "QINVARIANT", "QALT", "QUNDEF", "QKILLED", "QENDMACRO", "LLMACRO", "LLMACROITER", "LLMACROEND", "TENDMACRO", "QDREVEALSTATE", "QSWITCHBREAK", "QLOOPBREAK", "QINNERBREAK", "QSAFEBREAK", "QINNERCONTINUE", "QFALLTHROUGH", "QLINTNOTREACHED", "QLINTFALLTHROUGH", "QLINTFALLTHRU", "QARGSUSED", "QPRINTFLIKE", "QLINTPRINTFLIKE", "QSCANFLIKE", "QMESSAGELIKE", "QNOTREACHED", "QCONST", "QRESTRICT", "QVOLATILE", "QINLINE", "QEXTENSION", "QEXTERN", "QSTATIC", "QAUTO", "QREGISTER", "QOUT", "QIN", "QYIELD", "QONLY", "QTEMP", "QSHARED", "QREF", "QUNIQUE", "QCHECKED", "QUNCHECKED", "QCHECKEDSTRICT", "QCHECKMOD", "QKEEP", "QKEPT", "QPARTIAL", "QSPECIAL", "QOWNED", "QDEPENDENT", "QRETURNED", "QEXPOSED", "QNULL", "QOBSERVER", "QISNULL", "QEXITS", "QMAYEXIT", "QNEVEREXIT", "QTRUEEXIT", "QFALSEEXIT", "QLONG", "QSIGNED", "QUNSIGNED", "QSHORT", "QUNUSED", "QSEF", "QNOTNULL", "QRELNULL", "QABSTRACT", "QNUMABSTRACT", "QCONCRETE", "QMUTABLE", "QIMMUTABLE", "QTRUENULL", "QFALSENULL", "QEXTERNAL", "QREFCOUNTED", "QREFS", "QNEWREF", "QTEMPREF", "QKILLREF", "QRELDEF", "CGCHAR", "CBOOL", "CINT", "CGFLOAT", "CDOUBLE", "CVOID", "QANYTYPE", "QINTEGRALTYPE", "QUNSIGNEDINTEGRALTYPE", "QSIGNEDINTEGRALTYPE", "QNULLTERMINATED", "QSETBUFFERSIZE", "QSETSTRINGLENGTH", "QMAXSET", "QMAXREAD", "QTESTINRANGE", "TCAND", "IDENTIFIER", "NEW_IDENTIFIER", "TYPE_NAME_OR_ID", "CANNOTATION", "CCONSTANT", "ITER_NAME", "ITER_ENDNAME", "TYPE_NAME", "METASTATE_NAME", "$accept", "file", "externalDefs", "externalDef", "constantDecl", "fcnDecl", "@1", "plainFcn", "plainNamedDecl", "namedDeclBase", "@2", "@3", "plainNamedDeclBase", "@4", "@5", "iterDecl", "@6", "@7", "macroDef", "fcnDefHdr", "metaStateConstraint", "metaStateSpecifier", "@8", "@9", "metaStateExpression", "metaStateName", "constraintSeperator", "BufConstraintList", "BufConstraint", "bufferModifier", "relationalOp", "BufConstraintExpr", "BufConstraintTerm", "BufConstraintSrefExpr", "BufUnaryOp", "BufBinaryOp", "functionClauses", "functionClausesPlain", "functionClause", "functionClausePlain", "globalsClause", "globalsClausePlain", "@10", "nomodsClause", "modifiesClause", "modifiesClausePlain", "@11", "flagSpec", "flagId", "optWarnClause", "warnClause", "warnClausePlain", "globIdList", "globIdListExpr", "optGlobQuals", "globId", "globQual", "stateTag", "conditionTag", "fcnDefHdrAux", "fcnBody", "@12", "@13", "@14", "fcnDef", "locModifies", "modListExpr", "mExpr", "modList", "specClauseListExpr", "optSpecClauseList", "specClauseList", "primaryExpr", "@15", "postfixExpr", "argumentExprList", "unaryExpr", "fieldDesignator", "offsetofExpr", "sizeofExpr", "@16", "processSizeof", "endprocessSizeof", "sizeofExprAux", "castExpr", "timesExpr", "plusExpr", "shiftExpr", "relationalExpr", "equalityExpr", "bitandExpr", "xorExpr", "bitorExpr", "andExpr", "@17", "orExpr", "@18", "conditionalExpr", "@19", "@20", "@21", "@22", "assignExpr", "expr", "optExpr", "constantExpr", "initializer", "instanceDecl", "@23", "@24", "namedInitializerType", "namedInitializer", "@25", "typeDecl", "@26", "IsType", "PushType", "namedInitializerList", "namedInitializerListAux", "namedInitializerTypeList", "namedInitializerTypeListAux", "optDeclarators", "init", "designation", "designatorList", "designator", "initList", "storageSpecifier", "stateClause", "stateClausePlain", "@27", "conditionClause", "startConditionClause", "conditionClausePlain", "@28", "@29", "functionConstraint", "exitsQualifier", "checkQualifier", "stateQualifier", "paramQualifier", "visibilityQualifier", "returnQualifier", "typedefQualifier", "refcountQualifier", "typeModifier", "definedQualifier", "typeQualifier", "typeSpecifier", "completeType", "completeTypeSpecifier", "altType", "completeTypeSpecifierAux", "optCompleteType", "optStructInvariant", "suSpc", "@30", "@31", "@32", "@33", "@34", "@35", "@36", "@37", "NotType", "structDeclList", "structDecl", "structNamedDeclList", "structNamedDecl", "enumSpc", "@38", "enumeratorList", "enumerator", "optNamedDecl", "namedDecl", "genericParamList", "innerMods", "innerModsList", "pointers", "paramIdList", "idList", "paramTypeList", "paramList", "@39", "@40", "paramDecl", "typeExpression", "abstractDecl", "optAbstractDeclBase", "abstractDeclBase", "stmt", "debugStmt", "iterBody", "endBody", "iterDefStmtList", "iterDefIterationStmt", "forPred", "@41", "@42", "partialIterStmt", "@43", "iterDefStmt", "iterSelectionStmt", "@44", "openScope", "closeScope", "macroBody", "stmtErr", "labeledStmt", "optExtraFallThroughs", "caseStmt", "@45", "@46", "defaultStmt", "@47", "@48", "compoundStmt", "compoundStmtErr", "CreateInnerScope", "DeleteInnerScope", "CreateStructInnerScope", "DeleteStructInnerScope", "DeleteInnerScopeSafe", "compoundStmtRest", "compoundStmtAux", "compoundStmtAuxErr", "stmtListErr", "initializerList", "typeInitializerList", "typeInitializer", "stmtList", "expressionStmt", "expressionStmtErr", "ifPred", "selectionStmt", "@49", "@50", "whilePred", "iterWhilePred", "iterStmt", "@51", "@52", "iterArgList", "@53", "iterArgExpr", "cconstantExpr", "primaryIterExpr", "postfixIterExpr", "unaryIterExpr", "castIterExpr", "timesIterExpr", "plusIterExpr", "shiftIterExpr", "relationalIterExpr", "equalityIterExpr", "bitandIterExpr", "xorIterExpr", "bitorIterExpr", "andIterExpr", "orIterExpr", "conditionalIterExpr", "@54", "@55", "@56", "@57", "assignIterExpr", "endIter", "doHeader", "iterationStmt", "iterationStmtErr", "jumpStmt", "optSemi", "optComma", "id", "newId", "typeName", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 197, 198, 198, 199, 199, 200, 200, 200, 200, 200, 200, 200, 200, 201, 201, 203, 202, 204, 204, 205, 205, 206, 206, 206, 206, 207, 206, 208, 206, 209, 209, 209, 209, 210, 209, 211, 209, 213, 214, 212, 215, 215, 215, 215, 216, 217, 219, 218, 220, 218, 221, 221, 222, 223, 223, 224, 224, 225, 226, 226, 227, 227, 227, 228, 228, 228, 229, 229, 230, 230, 230, 230, 230, 230, 230, 230, 231, 232, 232, 233, 233, 234, 234, 235, 235, 235, 235, 235, 235, 236, 236, 236, 236, 236, 236, 237, 239, 238, 240, 241, 243, 242, 244, 244, 245, 246, 246, 247, 248, 248, 249, 249, 250, 251, 251, 252, 252, 252, 253, 253, 253, 253, 253, 254, 254, 254, 254, 254, 255, 255, 256, 256, 258, 257, 259, 260, 257, 261, 262, 262, 263, 263, 263, 263, 263, 263, 263, 263, 263, 264, 264, 265, 265, 266, 266, 266, 266, 266, 266, 266, 266, 267, 267, 268, 268, 269, 269, 269, 269, 269, 269, 270, 269, 271, 271, 271, 271, 271, 271, 271, 271, 271, 271, 272, 272, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 274, 274, 274, 275, 277, 276, 278, 279, 280, 280, 280, 280, 281, 281, 282, 282, 282, 282, 283, 283, 283, 284, 284, 284, 285, 285, 285, 285, 285, 286, 286, 286, 287, 287, 288, 288, 289, 289, 290, 291, 290, 292, 293, 292, 294, 295, 296, 294, 297, 298, 294, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 300, 300, 301, 301, 302, 303, 303, 303, 304, 305, 304, 306, 304, 307, 307, 308, 309, 308, 311, 310, 310, 310, 312, 313, 314, 315, 315, 316, 317, 317, 318, 318, 319, 319, 319, 319, 320, 320, 321, 321, 322, 322, 323, 323, 324, 324, 324, 324, 324, 325, 327, 326, 328, 329, 331, 330, 332, 330, 333, 333, 334, 334, 334, 334, 334, 335, 335, 335, 335, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 336, 337, 337, 338, 338, 339, 339, 340, 340, 340, 340, 340, 341, 341, 341, 341, 341, 341, 342, 342, 342, 342, 343, 343, 343, 343, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 344, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 345, 346, 347, 347, 348, 348, 349, 349, 349, 350, 350, 351, 353, 354, 352, 355, 356, 352, 352, 352, 357, 358, 352, 359, 360, 352, 352, 352, 352, 352, 361, 362, 362, 362, 363, 363, 364, 364, 365, 365, 365, 366, 367, 366, 366, 368, 368, 368, 369, 369, 370, 370, 370, 370, 371, 371, 372, 372, 373, 373, 373, 374, 374, 375, 375, 375, 375, 376, 376, 377, 377, 378, 378, 378, 380, 379, 381, 379, 382, 382, 383, 383, 384, 384, 384, 385, 385, 386, 386, 386, 386, 386, 386, 386, 386, 386, 387, 387, 387, 387, 387, 387, 387, 387, 387, 387, 388, 389, 390, 391, 391, 392, 392, 392, 392, 394, 395, 393, 397, 396, 396, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 400, 399, 401, 402, 403, 403, 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, 404, 405, 405, 406, 406, 408, 407, 409, 407, 411, 410, 412, 410, 413, 413, 414, 415, 416, 417, 418, 419, 420, 420, 420, 420, 420, 420, 420, 420, 421, 422, 422, 422, 422, 423, 423, 424, 424, 425, 425, 426, 426, 427, 427, 428, 428, 429, 429, 429, 430, 431, 432, 431, 433, 431, 434, 435, 437, 438, 436, 439, 440, 439, 441, 441, 441, 441, 442, 442, 443, 443, 444, 444, 444, 444, 444, 444, 444, 444, 444, 445, 445, 445, 445, 445, 445, 445, 445, 445, 445, 446, 446, 447, 447, 447, 447, 448, 448, 448, 449, 449, 449, 450, 450, 450, 450, 450, 451, 451, 451, 452, 452, 453, 453, 454, 454, 455, 455, 456, 456, 457, 458, 459, 457, 460, 461, 457, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 462, 463, 463, 464, 465, 465, 465, 466, 466, 466, 466, 467, 467, 467, 467, 467, 467, 467, 467, 467, 467, 468, 468, 469, 469, 470, 471, 471, 471, 471, 471, 472, 472, 472, 472 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 1, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, 8, 11, 0, 5, 1, 3, 1, 2, 1, 6, 3, 6, 0, 6, 0, 7, 1, 6, 3, 6, 0, 6, 0, 7, 0, 0, 10, 3, 3, 3, 2, 1, 3, 0, 4, 0, 4, 1, 3, 1, 1, 1, 3, 1, 3, 1, 1, 1, 1, 1, 1, 4, 5, 1, 1, 1, 1, 3, 4, 2, 3, 3, 3, 1, 1, 1, 0, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 4, 1, 2, 0, 3, 1, 3, 1, 1, 0, 2, 3, 2, 1, 3, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 0, 3, 0, 0, 4, 2, 2, 1, 1, 1, 1, 3, 4, 2, 3, 3, 3, 1, 1, 1, 3, 1, 1, 3, 4, 2, 3, 3, 3, 0, 1, 1, 3, 1, 1, 1, 3, 1, 1, 0, 4, 1, 4, 3, 4, 6, 5, 5, 2, 2, 7, 1, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 3, 4, 1, 9, 0, 3, 0, 0, 4, 2, 4, 2, 1, 4, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 1, 0, 4, 1, 0, 4, 1, 0, 0, 6, 0, 0, 7, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 3, 0, 1, 1, 1, 1, 1, 3, 0, 9, 0, 11, 1, 1, 2, 0, 6, 0, 8, 4, 4, 0, 0, 2, 1, 4, 2, 1, 4, 0, 4, 1, 3, 4, 2, 2, 2, 1, 2, 3, 2, 1, 3, 1, 1, 1, 1, 1, 2, 0, 6, 2, 2, 0, 6, 0, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 4, 1, 3, 2, 2, 2, 0, 1, 0, 0, 0, 12, 0, 0, 11, 6, 6, 0, 0, 10, 0, 0, 10, 5, 5, 4, 4, 0, 1, 1, 2, 5, 3, 2, 4, 1, 3, 4, 6, 0, 8, 4, 1, 3, 2, 1, 4, 1, 1, 2, 2, 1, 2, 1, 2, 1, 1, 1, 1, 2, 1, 2, 2, 3, 1, 3, 1, 3, 1, 1, 3, 0, 2, 0, 4, 4, 1, 1, 2, 1, 1, 2, 0, 1, 5, 2, 3, 3, 4, 3, 4, 4, 5, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1, 1, 1, 2, 2, 7, 6, 2, 0, 0, 10, 0, 6, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 3, 1, 0, 3, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 1, 2, 2, 0, 2, 0, 4, 0, 6, 0, 3, 0, 5, 3, 2, 3, 0, 0, 0, 0, 0, 1, 2, 2, 3, 2, 3, 3, 4, 2, 2, 3, 3, 4, 1, 2, 1, 2, 1, 3, 1, 4, 1, 2, 1, 2, 1, 2, 1, 4, 2, 0, 5, 0, 6, 4, 4, 0, 0, 10, 1, 0, 4, 1, 1, 1, 1, 1, 2, 1, 3, 1, 4, 3, 4, 6, 5, 5, 2, 2, 1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 1, 4, 1, 3, 3, 3, 1, 3, 3, 1, 3, 3, 1, 3, 3, 3, 3, 1, 3, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 0, 0, 6, 0, 0, 7, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 1, 0, 1, 2, 7, 2, 2, 7, 6, 2, 3, 2, 3, 2, 3, 3, 3, 3, 2, 3, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 0, 13, 12, 459, 0, 426, 266, 426, 16, 0, 0, 0, 0, 282, 282, 282, 305, 304, 306, 307, 308, 367, 368, 331, 333, 332, 336, 337, 325, 327, 328, 326, 334, 335, 369, 370, 329, 330, 346, 342, 338, 343, 339, 320, 321, 324, 322, 323, 364, 365, 366, 363, 348, 347, 341, 340, 352, 353, 354, 355, 356, 350, 351, 349, 357, 358, 361, 362, 359, 360, 426, 426, 426, 426, 426, 426, 426, 426, 426, 426, 344, 710, 711, 715, 345, 712, 713, 716, 0, 0, 4, 7, 8, 450, 9, 10, 135, 45, 706, 11, 265, 267, 0, 405, 282, 282, 282, 282, 282, 282, 282, 282, 426, 282, 405, 405, 426, 398, 426, 0, 426, 131, 282, 714, 22, 426, 454, 455, 456, 457, 460, 461, 282, 285, 282, 282, 278, 426, 717, 426, 426, 715, 0, 547, 203, 556, 0, 0, 0, 688, 0, 0, 0, 0, 203, 593, 0, 203, 203, 203, 203, 203, 203, 282, 203, 203, 0, 44, 0, 0, 0, 0, 0, 0, 550, 203, 171, 167, 170, 614, 604, 174, 186, 209, 196, 282, 211, 215, 218, 221, 226, 229, 231, 233, 235, 238, 241, 248, 260, 595, 546, 0, 0, 581, 536, 537, 538, 539, 0, 0, 540, 203, 541, 0, 542, 168, 0, 543, 545, 166, 0, 529, 0, 591, 0, 563, 516, 0, 0, 0, 525, 0, 526, 505, 524, 521, 522, 517, 518, 519, 0, 0, 523, 530, 0, 0, 527, 504, 0, 371, 373, 372, 383, 385, 384, 386, 387, 388, 389, 390, 391, 392, 1, 5, 282, 0, 133, 138, 426, 707, 6, 426, 406, 402, 376, 378, 375, 377, 380, 379, 381, 382, 396, 374, 403, 404, 0, 282, 282, 394, 282, 282, 0, 395, 451, 393, 458, 462, 282, 167, 170, 0, 426, 476, 0, 166, 426, 0, 284, 426, 0, 275, 282, 706, 18, 20, 0, 426, 282, 30, 470, 209, 264, 552, 0, 203, 203, 203, 203, 0, 697, 699, 704, 0, 563, 0, 0, 0, 189, 194, 193, 192, 191, 190, 0, 282, 187, 188, 203, 203, 0, 0, 0, 0, 0, 550, 0, 282, 549, 501, 203, 492, 493, 494, 495, 0, 496, 497, 203, 499, 203, 498, 500, 563, 203, 203, 181, 182, 0, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 204, 201, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 236, 245, 239, 594, 203, 695, 41, 0, 564, 582, 597, 692, 615, 0, 548, 203, 0, 0, 0, 592, 42, 506, 510, 583, 426, 520, 532, 533, 0, 0, 0, 43, 24, 203, 470, 426, 426, 282, 268, 132, 0, 400, 0, 426, 0, 426, 0, 282, 0, 718, 282, 203, 0, 478, 477, 479, 719, 282, 281, 282, 280, 276, 426, 0, 282, 0, 426, 282, 21, 467, 0, 0, 452, 468, 282, 0, 557, 0, 600, 0, 263, 0, 696, 705, 563, 0, 169, 203, 544, 282, 0, 0, 0, 700, 701, 702, 703, 698, 551, 203, 558, 0, 691, 426, 561, 689, 0, 0, 176, 0, 184, 0, 0, 0, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 195, 0, 212, 213, 214, 217, 216, 219, 220, 222, 223, 224, 225, 227, 228, 230, 232, 234, 203, 0, 203, 203, 261, 577, 717, 581, 0, 426, 562, 598, 0, 0, 528, 514, 282, 584, 531, 0, 0, 26, 0, 568, 203, 589, 134, 426, 203, 563, 282, 269, 399, 282, 416, 0, 424, 419, 0, 425, 0, 441, 444, 438, 440, 397, 484, 0, 470, 480, 203, 0, 286, 274, 288, 273, 282, 282, 282, 706, 17, 32, 203, 470, 282, 19, 453, 463, 465, 38, 472, 426, 471, 475, 553, 596, 0, 602, 203, 173, 203, 210, 426, 0, 282, 502, 554, 0, 560, 576, 0, 605, 203, 177, 175, 282, 282, 203, 203, 202, 237, 243, 0, 240, 578, 579, 203, 203, 203, 603, 203, 426, 203, 426, 80, 28, 569, 572, 203, 203, 570, 203, 590, 137, 0, 271, 282, 401, 422, 565, 408, 423, 565, 411, 282, 443, 282, 0, 485, 488, 282, 0, 486, 0, 470, 426, 107, 287, 203, 282, 282, 0, 34, 0, 282, 0, 82, 469, 282, 481, 203, 0, 203, 587, 708, 585, 0, 0, 0, 559, 203, 203, 185, 179, 180, 282, 206, 282, 208, 203, 246, 580, 599, 0, 282, 203, 203, 203, 203, 203, 203, 203, 203, 0, 167, 170, 186, 209, 636, 215, 218, 221, 226, 229, 231, 233, 235, 238, 0, 608, 607, 168, 618, 627, 637, 639, 643, 646, 649, 654, 657, 659, 661, 663, 665, 667, 674, 610, 166, 0, 25, 0, 97, 101, 99, 124, 125, 126, 127, 128, 129, 130, 27, 80, 84, 0, 86, 85, 0, 89, 0, 426, 426, 87, 0, 88, 316, 0, 80, 573, 574, 203, 571, 23, 282, 290, 426, 414, 565, 426, 415, 565, 437, 442, 203, 0, 0, 489, 487, 490, 0, 282, 0, 106, 203, 203, 0, 292, 277, 203, 0, 298, 0, 203, 0, 426, 82, 36, 0, 464, 466, 39, 82, 90, 92, 91, 95, 93, 94, 473, 446, 0, 282, 481, 447, 482, 601, 511, 708, 203, 0, 0, 178, 555, 0, 608, 0, 0, 244, 203, 694, 0, 0, 189, 194, 193, 192, 191, 190, 187, 188, 203, 203, 203, 181, 182, 0, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 203, 671, 203, 515, 0, 509, 105, 110, 103, 114, 706, 81, 96, 100, 108, 310, 313, 309, 0, 314, 312, 29, 575, 203, 0, 428, 426, 426, 427, 426, 426, 426, 445, 282, 483, 491, 289, 279, 302, 0, 0, 301, 295, 296, 299, 297, 290, 14, 33, 35, 82, 31, 706, 83, 470, 474, 448, 449, 203, 0, 586, 183, 0, 199, 0, 563, 205, 207, 247, 693, 169, 203, 0, 176, 0, 0, 0, 0, 675, 676, 677, 678, 679, 680, 681, 682, 683, 684, 685, 212, 213, 214, 217, 216, 219, 220, 222, 223, 224, 225, 227, 228, 230, 232, 234, 664, 0, 203, 666, 203, 508, 109, 0, 119, 120, 121, 122, 123, 706, 111, 426, 114, 0, 0, 142, 143, 102, 152, 706, 140, 141, 0, 49, 0, 0, 59, 60, 70, 68, 319, 0, 318, 57, 77, 0, 64, 67, 0, 706, 69, 162, 290, 282, 426, 0, 282, 429, 417, 426, 420, 426, 439, 293, 203, 300, 706, 37, 0, 282, 512, 588, 282, 203, 0, 690, 687, 210, 282, 177, 175, 282, 282, 669, 0, 609, 104, 114, 98, 117, 113, 118, 116, 115, 0, 146, 0, 0, 0, 0, 139, 0, 0, 155, 164, 706, 154, 0, 0, 67, 0, 73, 0, 55, 54, 0, 62, 61, 63, 0, 0, 0, 0, 0, 0, 282, 706, 163, 0, 270, 282, 431, 282, 282, 426, 434, 0, 409, 0, 412, 294, 303, 0, 40, 282, 0, 200, 0, 197, 686, 564, 0, 179, 180, 203, 672, 112, 147, 144, 150, 0, 151, 148, 149, 153, 0, 158, 0, 0, 0, 0, 282, 0, 79, 78, 0, 74, 0, 51, 46, 47, 56, 67, 58, 71, 0, 75, 76, 0, 0, 317, 282, 282, 291, 203, 282, 0, 432, 282, 418, 0, 421, 0, 15, 513, 198, 606, 178, 670, 203, 145, 159, 156, 0, 160, 161, 165, 311, 53, 50, 0, 0, 72, 48, 65, 315, 272, 435, 426, 430, 203, 407, 413, 673, 157, 66, 52, 433, 436, 410 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 88, 89, 90, 91, 92, 140, 313, 314, 93, 665, 809, 315, 847, 975, 94, 707, 977, 950, 96, 1064, 1202, 1147, 1131, 1203, 1243, 1139, 1066, 1067, 1068, 1143, 1069, 1070, 1206, 1072, 1199, 793, 852, 794, 853, 795, 854, 934, 855, 798, 856, 935, 932, 933, 833, 800, 801, 1043, 1044, 1045, 1114, 1046, 802, 803, 97, 267, 443, 268, 580, 98, 1051, 1183, 1184, 1053, 1128, 1150, 1129, 181, 334, 182, 517, 183, 987, 184, 749, 534, 185, 533, 650, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 551, 196, 554, 197, 552, 730, 553, 880, 198, 227, 489, 323, 431, 100, 677, 815, 605, 606, 609, 101, 309, 102, 265, 134, 135, 607, 608, 949, 839, 840, 841, 842, 964, 103, 804, 858, 1056, 806, 807, 859, 1075, 943, 1073, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 303, 432, 448, 117, 273, 1263, 118, 819, 1224, 822, 1226, 680, 1160, 683, 1162, 119, 952, 953, 1157, 1158, 120, 688, 591, 592, 863, 137, 479, 129, 130, 122, 617, 618, 480, 481, 482, 709, 623, 336, 827, 865, 463, 358, 359, 228, 248, 229, 230, 360, 983, 1169, 232, 661, 233, 234, 436, 235, 236, 202, 417, 361, 356, 362, 483, 719, 363, 324, 638, 364, 207, 365, 561, 817, 1082, 241, 577, 512, 416, 209, 578, 715, 716, 579, 366, 210, 211, 367, 658, 627, 368, 244, 369, 373, 722, 760, 929, 761, 215, 763, 764, 765, 766, 767, 768, 769, 770, 771, 772, 773, 774, 775, 776, 777, 1031, 1178, 1032, 1233, 778, 1174, 370, 371, 217, 372, 270, 871, 305, 220, 125 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -1033 static const yytype_int16 yypact[] = { 2259, -1033, -1033, 357, 60, 5469, -1033, 6624, -1033, 677, 1966, 3655, 3655, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 805, -1033, -1033, -1033, -1033, 118, 2441, -1033, -1033, -1033, 331, -1033, -1033, 87, -1033, 134, -1033, -1033, -1033, 101, 6210, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 6210, 6210, 151, 57, -1033, 666, -1033, -1033, 677, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 357, -1033, 1900, -1033, 185, -1033, 151, -1033, -1033, -1033, 5469, -1033, 210, -1033, 5716, -1033, 219, 230, 293, -1033, 300, 677, 348, 362, 879, -1033, 2827, 5716, 5716, 5716, 5716, 5716, 5716, -1033, 5748, 5748, 388, -1033, 395, 371, 456, 463, 487, 417, 415, 4875, -1033, 500, 532, -1033, 543, -1033, 652, 1193, -1033, -1033, -1033, 668, 145, 254, 678, 474, 571, 569, 585, 579, 50, -1033, -1033, 55, -1033, 3458, 549, 560, -1033, -1033, -1033, -1033, 649, 3217, -1033, 4875, -1033, 3458, -1033, 501, 3458, -1033, -1033, 699, 702, -1033, 690, -1033, 3022, 543, 704, 205, 656, 3611, -1033, 3655, -1033, -1033, -1033, 5934, -1033, -1033, -1033, -1033, 740, 762, -1033, -1033, 3655, 3458, -1033, -1033, 669, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 759, 765, -1033, -1033, 6486, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 773, 995, -1033, -1033, 677, 677, 14, -1033, 331, -1033, -1033, -1033, 5310, -1033, -1033, 94, 6624, 414, 777, -1033, -1033, 787, -1033, -1033, 813, 827, 995, 134, -1033, 548, 798, -1033, 677, -1033, 263, -1033, -1033, -1033, 814, 5716, 5716, 5716, 1299, 842, -1033, -1033, -1033, 346, 844, 593, 862, 867, -1033, -1033, -1033, -1033, -1033, -1033, 851, 5310, -1033, -1033, 5716, 5716, 876, 926, 929, 938, 960, 415, 529, 5337, -1033, -1033, 4875, -1033, -1033, -1033, -1033, 883, -1033, -1033, 4875, -1033, 4875, -1033, -1033, -1033, 5641, 5716, -1033, -1033, 85, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, -1033, -1033, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, -1033, 892, -1033, -1033, 5716, -1033, -1033, 2632, -1033, -1033, 930, -1033, -1033, 958, -1033, 5716, 618, 972, 998, -1033, -1033, -1033, -1033, -1033, 151, 5934, -1033, -1033, 3655, 3261, 999, -1033, -1033, 5716, 368, 3808, 4959, 995, -1033, 384, 944, 1025, 1030, 1033, 1036, 1033, 677, 1038, 475, -1033, -1033, 5652, 1039, 567, -1033, 659, -1033, 995, -1033, 884, -1033, -1033, -1033, 973, 1049, 1041, -1033, 995, 548, -1033, 677, 1057, -1033, 1062, 677, 1064, -1033, 483, 1063, 562, 1063, 1072, -1033, -1033, 844, 1066, -1033, 5364, -1033, -1033, 1071, 1079, 577, -1033, -1033, -1033, -1033, -1033, -1033, 5716, -1033, 1076, -1033, 3808, -1033, -1033, 1093, 1081, -1033, 638, -1033, 311, 677, 677, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 631, -1033, -1033, -1033, 668, 668, 145, 145, 254, 254, 254, 254, 678, 678, 474, 571, 569, 5716, 1086, 5716, 5716, -1033, -1033, 2174, -1033, 3414, 3998, -1033, -1033, 1087, 692, -1033, -1033, 995, -1033, -1033, 1100, 1101, -1033, 1102, -1033, 4378, -1033, -1033, 4188, 4422, 844, -1033, 1106, -1033, -1033, 1110, 1113, -1033, 1115, 1114, -1033, 741, -1033, 1121, -1033, -1033, -1033, -1033, 1111, 626, 659, 5684, 1123, -1033, -1033, -1033, -1033, 1116, -1033, -1033, 310, -1033, -1033, 5716, 502, 995, -1033, -1033, 1128, -1033, -1033, 1145, 6624, -1033, -1033, -1033, -1033, 1127, -1033, 1299, -1033, 5385, -1033, -1033, 1134, -1033, -1033, -1033, 1133, -1033, -1033, 1136, -1033, 5716, -1033, -1033, -1033, -1033, 5775, 5819, -1033, 585, -1033, 750, 579, -1033, -1033, 4529, 4875, 5716, -1033, 5853, -1033, 5716, -1033, 1496, -1033, -1033, -1033, 4573, 4680, -1033, 4724, -1033, -1033, 1131, -1033, -1033, -1033, -1033, -1033, 1138, -1033, -1033, 1142, -1033, 677, -1033, 677, -1033, -1033, 132, 1144, -1033, 1150, 98, -1033, 1088, -1033, 3549, -1033, -1033, 1152, -1033, 1147, -1033, 325, 1496, -1033, 677, 925, 4875, 1164, 5385, -1033, 1165, -1033, 1169, 1173, 1182, -1033, 5716, 5853, -1033, -1033, -1033, 5310, -1033, 5310, -1033, 5716, -1033, -1033, -1033, 698, 5310, 5716, 5716, 5716, 5716, 5716, 5716, 5748, 5748, 1139, 712, 732, 739, 1489, -1033, 983, 783, 802, 761, 909, 1176, 1167, 1168, 1151, 107, 1185, -1033, 45, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 758, 775, -1033, 1037, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 1496, -1033, 1146, -1033, -1033, 1148, -1033, 1149, -1033, -1033, -1033, 1153, -1033, 1313, 1155, 1496, -1033, -1033, 4831, -1033, -1033, -1033, -1033, 6348, -1033, -1033, 6348, -1033, -1033, -1033, -1033, 5716, 966, 1200, -1033, -1033, -1033, 1202, 884, 1211, -1033, 3549, 5716, 677, -1033, -1033, 3549, 519, -1033, 1225, 3549, 1157, -1033, 1496, -1033, 1208, -1033, -1033, -1033, 1496, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 331, 1226, -1033, 1007, -1033, 659, -1033, -1033, 1165, 3701, 1244, 677, -1033, -1033, 782, 1240, 1241, 1242, -1033, 5716, 1250, 803, 1245, 804, 822, 824, 848, 855, 857, 864, 880, 5716, 5673, 5716, 896, 908, 109, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 5716, 1252, 5716, -1033, 1254, 1259, -1033, 1090, 1238, 11, 301, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 453, -1033, -1033, -1033, -1033, 3549, 376, -1033, 151, 5121, -1033, 6348, 5121, 6348, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 993, 1256, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 1496, -1033, 134, -1033, 233, -1033, -1033, -1033, 5705, 1264, -1033, -1033, 258, -1033, 1267, 844, 1134, 1134, -1033, -1033, 913, 5364, 1258, 915, 921, 358, 677, 677, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 933, 940, 941, 1188, 1196, 874, 898, 84, 363, 455, 530, 91, 552, 106, 165, 477, 585, 1265, 5716, 579, 5853, -1033, 501, 1037, -1033, -1033, -1033, -1033, -1033, 399, -1033, 6072, 11, 164, 164, -1033, -1033, -1033, 317, 442, -1033, -1033, 63, -1033, 982, 90, -1033, -1033, -1033, -1033, -1033, 1263, -1033, 43, -1033, 1008, -1033, 76, 1274, 134, -1033, 63, -1033, -1033, -1033, 1270, 133, -1033, -1033, 5121, -1033, 5121, -1033, -1033, 5289, -1033, 467, -1033, 1209, 240, -1033, -1033, -1033, 5716, 677, -1033, 1105, 949, -1033, 951, 959, -1033, -1033, -1033, 1003, -1033, -1033, 11, -1033, -1033, -1033, -1033, -1033, -1033, 498, 317, 793, 677, 677, 164, -1033, 63, 63, -1033, 416, 491, -1033, 1279, 1004, 581, 90, 421, 58, -1033, -1033, 982, -1033, -1033, -1033, 982, 22, 677, 677, 1282, 982, -1033, 134, 1284, 612, -1033, 995, -1033, -1033, 1285, -1033, 1286, 1287, -1033, 1289, -1033, -1033, -1033, 1219, -1033, 587, 1288, -1033, 447, -1033, -1033, -1033, 1290, 971, 984, 5716, -1033, -1033, -1033, -1033, 317, 1291, 501, -1033, -1033, 317, 639, 416, 850, 677, 677, 63, -1033, 1118, -1033, -1033, 982, -1033, 581, 1272, -1033, 421, -1033, 421, -1033, -1033, 1293, -1033, -1033, 1118, 1297, -1033, -1033, -1033, -1033, 5716, 133, 1298, -1033, -1033, -1033, 1304, -1033, 1306, -1033, -1033, -1033, -1033, 986, -1033, 5716, -1033, -1033, -1033, 1300, -1033, -1033, 416, -1033, -1033, -1033, 1311, 58, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 5716, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -1033, -1033, -1033, 1248, -1033, -1033, -1033, -1033, -403, -118, -1033, -1033, 1020, -1033, -1033, -1033, -1033, -1033, 64, -1033, -1033, 397, -1033, -1033, 96, 130, -1033, 206, -1033, -1033, -1033, -938, -1033, -886, -1033, -1033, -620, -778, -1033, -1033, -1033, -610, -1033, -594, -1033, -577, -1033, 312, -1033, -1033, 654, -668, -1033, 242, 308, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -898, 166, -1033, -1032, -1033, 280, -1033, -1033, -636, 466, 1132, -1033, -1033, 1178, -1033, -1033, -1033, -1033, -117, -381, -345, -322, -372, -388, -347, -353, -535, -551, -1033, -626, -1033, -76, -1033, -1033, -1033, -1033, 1013, 1218, -602, -433, 6, -1033, -1033, -1033, 533, -3, -1033, -1033, -1033, 634, -254, -1033, -1033, -1033, -1033, -911, -806, -1033, -1033, 523, -1033, -1033, -1033, -554, -1033, -1033, -1033, -384, -1033, -1033, -1033, -1033, -1033, 559, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 801, 784, -1033, 889, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 224, -684, -890, -1033, 148, -1033, -1033, 683, 687, 511, 1, -395, 1246, -1033, 17, -1033, -1033, -578, -1033, -1033, -1033, 670, -125, 1074, -1033, -448, 1141, 26, 1366, -1033, 1137, -1033, 744, -1033, -1033, -1033, -1033, -173, -1033, -1033, -1033, -1033, -1033, 20, 799, 1028, 1251, -1033, -1033, 1261, -1033, -1033, -311, -1033, 617, 211, -423, -737, -1033, 869, -1033, -1033, 969, -187, 673, 518, -493, 127, -1033, 180, 40, -1033, -1033, 173, -1033, 337, -1033, -1033, 667, -1033, 356, -639, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, -1033, 1401, -1033, -1033, 1588, -295, 522, 0, 19, -1033 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -718 static const yytype_int16 yytable[] = { 123, 121, 133, 654, 294, 123, 99, 304, 571, 123, 219, 219, 219, 600, 538, 539, 651, 548, 471, 124, 131, 692, 762, 493, 124, 747, 598, 712, 142, 963, 203, 546, 547, 454, 967, 759, 200, 1052, 971, 857, 338, 339, 340, 341, 342, 343, 509, 573, 433, 1208, 212, 425, 540, 541, 550, 796, 429, 1071, 430, 549, 1090, 473, 1081, 1057, 95, 1081, -616, 657, 322, 974, -616, 797, 616, 411, 637, 978, 412, 542, 543, 544, 545, 444, 1134, 762, 132, 670, 747, 1125, 799, 123, 121, 409, 1059, 1189, 1190, 99, 759, 1126, -47, 1137, 1038, 1039, 1144, 477, 1145, -650, 266, 410, 124, -650, 758, 805, -655, 520, 1134, 412, -655, 831, 262, 457, 1132, 1146, 123, 830, 1059, 271, 757, -658, 399, 400, 521, -658, 1040, 1041, 397, 398, 955, 1001, 242, 242, 123, 124, 1076, 401, 402, 288, 1042, 297, 926, 1118, 1119, 123, 269, 95, 1002, 1156, 219, 318, 459, 319, 403, 404, 1240, 449, 927, 1152, 3, 3, 694, -282, 329, 758, 1133, 1135, 936, 219, 337, 395, 396, 857, 702, 509, 200, 213, 796, 857, -660, 757, 1047, 946, -660, 243, 243, 1081, 405, 1081, 212, 1091, 1048, 796, 797, 219, 81, 82, 141, 1207, 306, 85, 86, 219, 1213, 219, 705, 219, 1209, 797, 219, 799, 1084, 704, 498, 413, 473, 427, 219, 1188, 412, 200, 560, 219, 1138, 219, 799, 419, 320, 200, 421, 420, 477, 200, 805, 212, 200, 325, 219, 219, 81, 1062, 1201, 212, 1204, 81, 1127, 212, 326, 805, 212, -426, 690, -426, 820, 1244, 866, 569, 429, 438, 459, -426, 477, 674, 1083, 200, 1085, 754, 3, 535, 536, 537, 81, 1062, 750, 808, 1165, 1096, 1097, 212, 1098, 123, 447, 753, 123, 123, 123, 1036, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 397, 398, 124, 857, 756, 451, 453, 455, 123, 470, 755, 701, 751, 327, 123, 269, 461, 81, 82, 141, 328, 1047, 85, 86, 269, 213, 850, 124, 412, 700, 754, 1048, 282, 319, 645, 752, 287, 750, 289, 1120, 293, 1121, 1161, 214, 1163, 295, 753, 242, 81, 1049, 1050, -283, 242, 264, 242, 1204, 219, 311, 1122, 312, 491, 322, 330, 412, 219, 756, 219, 242, 633, 477, 213, 755, 1033, 751, 632, 412, 331, 1094, 213, 322, -651, 1104, 213, 350, -651, 213, 1030, 3, 957, 572, 1077, 762, 954, 1078, 747, 956, 752, 692, -426, 965, 243, -426, 378, -426, 759, 243, 808, 243, 348, 397, 398, 219, 866, 269, 213, 349, 1111, -426, -426, -426, 243, 808, -426, -426, 81, 82, 141, 322, 354, 85, 86, 558, 219, 219, -282, 568, 459, 200, 1191, 219, 1192, 123, 581, 1144, 3, 1145, 568, -426, -426, -426, 123, 212, -426, -426, 1057, 449, 269, 1193, 603, 1123, 124, 123, 1146, 123, 412, 126, 127, 128, 351, 593, 1229, 123, -652, 1058, 123, 352, -652, 1185, 123, 758, 124, 269, 124, 1059, 1078, 81, 1049, 1050, 318, 214, 319, 445, 412, 619, -662, 757, 494, 624, -662, 353, 412, 397, 398, 477, 626, 269, 718, 219, 1194, 81, 82, 141, 406, 355, 85, 86, 123, 123, -711, 1181, 1120, 322, 1121, 703, 403, 404, 465, 1017, 1018, 467, 1027, 507, 508, 322, 214, 646, 647, 475, 968, 1122, 478, 836, 214, 837, 1025, 1026, 214, -653, 1185, 214, -715, -653, -426, -426, -426, 219, 219, -426, -426, 242, 242, -712, 568, 123, 662, 1019, 1020, 1029, -283, -656, 472, 219, 1028, -656, 219, 219, 397, 398, 214, 412, 568, 200, 124, 628, 213, 399, 400, -282, 861, 459, 1021, 1022, 1023, 1024, 412, 212, 405, 877, 636, 878, 401, 402, 1200, 1144, 406, 1145, 883, 411, -478, 459, 412, 123, 243, 243, 494, 884, 885, 886, 887, 888, 889, 407, 1146, 208, 240, 240, 1216, 477, 318, 1078, 319, 408, 427, 1060, 1061, 412, 1054, 81, 1062, 494, 414, 1063, 754, 249, 250, 251, -426, 690, -426, 750, 879, -534, 567, 219, 219, 643, -426, 779, 753, 644, 1235, 1191, 478, 1192, 415, 219, 219, 582, 219, 648, 649, 587, 374, 590, 375, 1100, -426, 756, 1092, -282, 1193, 601, 123, 755, 123, 751, -426, -426, -426, 420, 610, -426, -426, -426, 615, 219, 376, 377, 392, 393, 394, 593, 123, 593, 461, 123, 123, 219, 752, 412, 423, 399, 400, 660, 843, 412, 600, -714, 779, 881, 422, 851, -713, 864, 624, 124, 401, 402, 213, -613, 290, 291, 292, -613, 274, 275, 276, 277, 278, 279, 280, 281, 861, 283, 1112, 322, 286, 428, 214, -612, 201, 231, 231, -612, 1124, 434, 322, 685, 686, 893, 439, 894, 302, -426, 307, 308, 310, 412, 731, 208, 316, 81, 82, 141, 1149, -611, 85, 86, 435, -611, -426, 1251, 440, 895, 896, 442, 302, 446, 1014, 1015, 1016, 1166, 412, 344, 916, 917, 930, 116, 464, 412, 993, 466, 136, 989, 139, 204, 237, 237, 219, 918, 919, 912, 913, 1047, 208, 391, 1182, 1262, 474, 691, 412, -630, 208, 1048, 995, -630, 208, 468, 123, 208, 1195, 219, 484, 123, 478, -717, 219, 240, 426, -635, 219, -634, 240, -635, 240, -634, 469, 124, 914, 915, 843, 1215, 966, 717, 302, 843, 490, 240, 208, 843, 123, 81, 82, 141, 492, -633, 85, 86, 123, -633, 1047, 497, -632, 1236, -631, 1101, -632, 864, -631, 124, 1048, -628, 582, 495, 781, -628, 116, 988, 496, -717, 501, -647, 214, 332, 441, -647, 201, -629, 511, 298, 272, -629, 395, 396, 157, 158, 159, 160, 161, 162, -242, 272, 272, -625, 3, -648, 832, -625, 302, -648, 450, 452, 163, 164, 165, -626, 395, 396, 302, -626, -617, 1055, -620, 460, -617, 562, -620, 317, 643, 1074, 502, 201, 1103, 503, 219, -282, 166, 459, 316, 201, -640, 204, 504, 201, -640, 3, 201, -641, -642, 920, 921, -641, -642, 843, 231, 563, -638, 897, -621, 231, -638, 231, -621, 1175, 505, 302, -619, 81, 1049, 1050, -619, 179, 958, 686, 231, 201, 515, 302, -623, -717, -717, 176, -623, 565, -717, -717, 204, 123, 123, 284, 285, -624, 1058, -622, 204, -624, 570, -622, 204, 1087, 1088, 204, 1059, 909, 910, 911, 1105, 1106, 566, 237, 412, 1179, 940, 941, 237, 3, 237, -282, 208, 459, 779, 583, 1197, 1198, 81, 1049, 1050, 3, 179, 237, 204, 1116, 584, 1055, 1055, 585, 294, 1115, -282, 240, 240, 588, 1130, 594, 1074, 1074, 1140, 1141, 1142, 599, 611, 614, 286, 81, 299, 300, 973, 179, 81, 82, 141, 1130, 612, 85, 86, 604, 123, 1159, 620, 621, 412, 586, 625, 589, 219, 595, 629, 630, 596, 123, 581, 460, 634, 602, 123, 124, 635, 639, 1232, 458, 641, 642, 613, 843, 652, 316, 1168, 659, 124, 81, 82, 141, 622, 1172, 85, 86, 1055, 123, 123, 1055, 663, 1130, 1130, 666, 664, 676, 679, 302, 681, 684, 1074, 682, 1074, 696, 689, 1074, 1186, 1187, 322, 1074, 687, 123, 123, 695, 1074, 706, 708, 1217, 711, 631, 123, 720, 814, 1257, 818, 201, 721, 782, 821, 892, 1210, 1211, 1060, 1061, 123, 828, 81, 1062, 848, 124, 1063, 1080, 208, 829, 322, 846, 231, 231, 868, 81, 82, 141, 870, 124, 85, 86, 872, 1055, 123, 123, 1130, 81, 82, 141, 873, 1074, 85, 86, 981, 1093, 874, 922, 923, 925, 924, -645, 928, 1238, 1239, -645, 204, 675, 379, -644, 302, 123, 1159, -644, 392, 393, 394, 959, 931, 960, 199, 962, 392, 393, 394, 976, 602, 237, 237, 937, 124, 938, 939, 697, 698, 699, 942, 1074, 945, 970, 972, 316, 979, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 205, 238, 238, 986, 990, 991, 992, 994, 302, 996, 206, 239, 239, -668, 1034, 321, 1035, 1037, 1102, 724, 725, 179, 1089, 1095, 1099, 1136, 1107, 1155, 321, 321, 321, 321, 321, 321, 391, 346, 347, 1148, 1173, 1167, 1196, 1154, 201, 1212, 1194, 1219, 1223, 1222, 1225, 1227, 816, 1245, 1228, 1242, 1231, 1253, -262, 1234, 823, 1246, 825, 1248, 298, 1255, 460, 1256, 1258, 157, 158, 159, 160, 161, 162, 844, 845, 1259, 263, 476, 849, 1065, 1260, 1247, 622, 862, 1205, 163, 164, 165, 1110, 301, 834, 418, 1180, 1117, 1151, 391, 1237, 204, 999, 302, 499, 302, 390, 969, 961, 944, 1252, 678, 302, 166, 826, 333, 824, 335, 982, 296, 462, 247, 860, 640, 437, 1221, 506, 559, 1230, 869, 518, 985, 876, 1109, 984, 522, 523, 524, 525, 526, 527, 528, 529, 530, 531, 532, 0, 0, 0, 0, 205, 0, 0, 0, 216, 245, 245, 0, 176, 0, 206, 0, 199, 0, 0, 0, 710, 0, 555, 0, 199, 0, 0, 0, 199, 0, 0, 199, 0, 23, 24, 25, 26, 0, 27, 424, 0, 0, 0, 32, 33, 0, 948, 36, 37, 205, 39, 40, 41, 42, 0, 0, 0, 205, 0, 206, 199, 205, 0, 0, 205, 54, 55, 206, 0, 0, 0, 206, 238, 1261, 206, 0, 0, 238, 0, 238, 0, 0, 239, 0, 81, 299, 300, 239, 179, 239, 0, 80, 238, 205, 980, 862, 0, 602, 510, 0, 0, 84, 239, 206, 0, 0, 513, 0, 514, 898, 0, 0, 0, 456, 0, 0, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 0, 0, 485, 486, 487, 488, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, 216, 0, 0, 0, 0, 0, 456, 0, 0, 0, 500, 0, 782, 783, 784, 785, 321, 0, 456, 786, 787, 788, 789, 790, 791, 792, 0, 576, 1079, 0, 0, 0, 0, 0, 321, 1086, 519, 0, 0, 0, 0, 218, 246, 246, 0, 216, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 0, 216, 0, 0, 216, 951, 0, 0, 951, 0, 0, 0, 245, 0, 321, 0, 0, 245, 0, 245, 199, 0, 0, 0, 0, 0, 321, 0, 564, 0, 0, 714, 245, 216, 0, 0, 0, 0, 0, 576, 0, 0, 0, 723, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, 0, 391, 0, 0, 0, 0, 0, 0, 0, 206, 0, 0, 0, 0, 0, 0, 321, 0, 0, 321, 238, 238, 0, 0, 0, 0, 0, 0, 0, 0, 239, 239, 0, 0, 576, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1153, 838, 0, 0, 0, 0, 0, 0, 576, 673, 0, 0, 0, 0, 0, 714, 862, 0, 0, 1170, 0, 0, 321, 0, 0, 302, 0, 0, 1176, 1177, 0, 0, 0, 218, 321, 0, 0, 0, 0, 0, 0, 0, 951, 0, 951, 951, 951, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 653, 0, 0, 0, 0, 0, 199, 0, 0, 727, 729, 0, 1214, 0, 0, 0, 0, 0, 218, 1218, 1220, 0, 748, 0, 0, 0, 218, 673, 733, 0, 218, 862, 0, 218, 0, 0, 0, 0, 0, 205, 673, 246, 0, 0, 0, 216, 246, 0, 246, 206, 0, 0, 0, 0, 0, 0, 0, 0, 1241, 0, 0, 246, 218, 0, 0, 0, 245, 245, 0, 0, 0, 0, 0, 0, 0, 0, 488, 838, 1249, 1250, 0, 867, 838, 748, 0, 1254, 838, 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 321, 321, 321, 321, 321, 321, 890, 891, 0, 734, 0, 0, 0, 780, 0, 714, 951, 0, 951, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 997, 518, 0, 0, 0, 0, 1003, 1004, 1005, 1006, 1007, 1008, 1009, 1010, 1011, 1012, 1013, 0, 0, 298, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 875, 0, 0, -203, -203, 456, 0, 456, 163, 164, 165, 0, 0, 0, 882, 0, 0, 0, 321, 0, 0, 216, 838, 0, 0, 0, 0, 0, 143, 321, 0, 0, 166, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 0, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 218, 0, 0, 0, 0, -203, -203, 0, 0, 321, 163, 164, 165, 176, 0, 0, 0, 0, 0, 0, 0, 246, 246, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 0, 0, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 321, 0, 321, 0, 167, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 838, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 218, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 0, 0, 748, 0, 0, 0, 0, 0, 0, 0, 0, -170, 0, 0, 0, 0, -170, -170, -170, 0, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -715, -170, -170, 0, -170, 488, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 0, -170, 0, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, -170, 0, 0, 0, -170, 0, 0, 0, 0, 1108, 0, 0, 0, 0, 0, 0, 0, 0, -2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, -170, -170, -170, -170, -170, -170, -170, 2, 0, 0, 0, 0, 0, -282, 0, -170, 0, 0, 0, 0, -170, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 321, 0, 0, 0, 0, 1171, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 6, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 321, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, -170, -170, -170, 321, -170, -170, -170, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 321, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, -3, 1, 0, 0, 0, 0, 81, 82, 83, 84, 0, 85, 86, 87, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, -282, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 6, 0, 0, 0, 0, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 82, 83, 84, 143, 85, 86, 87, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 556, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 143, 0, 0, 0, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -172, 0, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, -282, 0, 0, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -282, -282, -282, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, -282, -282, -282, -282, 176, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, 0, 0, 0, 0, 0, 81, 177, 178, -282, 179, 180, 86, -282, 221, 0, 0, 0, 0, 144, 145, 146, 0, 0, 222, 149, 150, 151, 152, 153, 154, 223, -172, -567, 0, 0, 0, 224, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, -282, 0, 0, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -282, -282, -282, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, -282, -282, -282, -282, 176, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, -282, 0, 0, 0, 0, 0, 0, 81, 177, 178, -282, 179, 225, 226, -282, 143, 0, 0, 0, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 0, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 221, 0, 163, 164, 165, 144, 145, 146, 0, 0, 222, 149, 150, 151, 152, 153, 154, 223, -507, -507, 0, 0, 0, 224, -507, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, 0, 163, 164, 165, 0, -535, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -507, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 143, 0, 0, 0, 0, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 655, 0, 0, 0, 156, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 81, 177, 178, 0, 179, 225, 226, -203, -203, 0, 143, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 155, -563, 0, 0, 0, 0, 156, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 835, 175, 0, 0, 0, 298, 176, 836, 0, 837, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 164, 165, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 221, 0, 0, 0, 0, 144, 145, 146, 166, 0, 222, 149, 150, 151, 152, 153, 154, 223, -563, -567, 0, 0, 0, 224, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 81, 177, 178, 0, 179, 180, 86, -203, -203, 0, 221, 0, 163, 164, 165, 144, 145, 146, 0, 176, 222, 149, 150, 151, 152, 153, 154, 223, -563, -567, 0, 0, 0, 224, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, 0, 163, 164, 165, 0, -503, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 713, -709, 175, 0, 0, 298, 166, 176, 0, 0, 157, 158, 159, 160, 161, 162, 0, 81, 177, 178, 0, 179, 85, 86, 0, 0, 0, 0, 163, 164, 165, 0, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 0, 176, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 225, 226, 0, 0, 0, 0, 0, 0, 0, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 574, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 81, 177, 178, 0, 179, 225, 226, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 575, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 656, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 668, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 4, 0, 5, 163, 164, 165, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 669, 13, 14, 15, 16, 176, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 177, 557, 84, 179, 180, 86, 87, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 667, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 671, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 672, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 732, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 810, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 811, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 813, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 812, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 144, 145, 146, 176, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 947, 0, 0, 0, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 144, 145, 146, 0, 147, 148, 149, 150, 151, 152, 153, 154, 223, -563, 0, 0, 0, 0, 357, 0, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 163, 164, 165, 0, 0, 168, 169, 170, 171, 172, 173, 174, 0, 0, 0, 0, 0, 0, 0, 0, 175, 0, 0, 0, 166, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 168, 169, 170, 171, 172, 173, 174, -136, 0, 0, 0, 0, -136, 0, 0, 175, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 0, 179, 180, 86, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, -566, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 835, 1164, 0, 138, 84, 298, 0, 836, 87, 837, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, -172, 0, 0, 0, 0, 298, 0, 163, 164, 165, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 0, 0, -172, 163, 164, 165, 166, 357, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, -203, -203, 166, 0, 631, 163, 164, 165, 0, 298, 0, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 713, 176, 0, 0, 166, 298, 0, 163, 164, 165, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 176, 0, 0, 0, 0, 0, 163, 164, 165, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 0, 0, 166, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 177, 178, 176, 179, 85, 86, 0, 0, 0, 0, 0, 0, 0, 0, 0, -282, 0, 0, 0, 0, 81, 299, 300, 176, 179, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 81, 82, 83, 84, 0, 85, 86, 87, 298, 516, 0, 0, 0, 157, 158, 159, 160, 161, 162, 298, 0, 0, 597, 0, 157, 158, 159, 160, 161, 162, 0, 163, 164, 165, 0, 0, 0, 0, 0, 0, 298, 998, 163, 164, 165, 157, 158, 159, 160, 161, 162, 298, 0, 0, 693, 166, 157, 158, 159, 160, 161, 162, 0, 163, 164, 165, 166, 0, 0, 0, 0, 0, 298, -262, 163, 164, 165, 157, 158, 159, 160, 161, 162, 298, 0, 0, 0, 166, 157, 158, 159, 160, 161, 162, 0, 163, 164, 165, 166, 0, 176, 0, 0, 0, 0, 0, 163, 164, 165, 0, 0, 176, 0, 0, 0, 345, 0, 0, 0, 166, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 166, 0, 176, 0, 0, 0, 0, 0, 163, 164, 165, 0, 726, 176, 0, 0, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 0, 0, 166, 0, 176, 163, 164, 165, 0, 0, 0, 0, 81, 299, 300, 176, 179, 0, 0, 0, 0, 0, 0, 81, 299, 300, 728, 179, 0, 166, 0, 157, 158, 159, 160, 161, 162, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 176, 179, 163, 164, 165, 0, 0, 0, 81, 299, 300, 0, 179, 735, 0, 0, 0, 0, 736, 737, 738, 739, 740, 741, 0, 0, 166, 176, 0, 81, 299, 300, 0, 179, 0, 0, 163, 742, 743, 0, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 744, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 176, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 299, 300, 0, 179, 0, 176, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 6, 81, 299, 300, 0, 179, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81, 745, 746, 0, 179, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 5, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 0, 0, 0, 0, 81, 1113, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -426, -426, -426, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 10, 11, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 5, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 4, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 14, 15, 16, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 0, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 0, 0, 0, 0, 0, 0, 0, 0, 138, 84, 0, 0, 0, 87 }; static const yytype_int16 yycheck[] = { 0, 0, 5, 554, 122, 5, 0, 132, 441, 9, 10, 11, 12, 461, 395, 396, 551, 405, 313, 0, 3, 599, 661, 334, 5, 661, 459, 629, 9, 835, 10, 403, 404, 19, 840, 661, 10, 935, 844, 707, 157, 158, 159, 160, 161, 162, 357, 442, 235, 27, 10, 224, 397, 398, 407, 665, 229, 943, 231, 406, 971, 315, 952, 5, 0, 955, 21, 560, 144, 847, 25, 665, 475, 18, 507, 853, 21, 399, 400, 401, 402, 268, 24, 722, 24, 578, 722, 24, 665, 89, 89, 41, 34, 1125, 1126, 89, 722, 34, 22, 56, 89, 90, 26, 5, 28, 21, 19, 57, 89, 25, 661, 665, 21, 28, 24, 21, 25, 695, 0, 25, 1058, 45, 122, 25, 34, 24, 661, 21, 37, 38, 45, 25, 121, 122, 50, 51, 820, 28, 11, 12, 140, 122, 948, 52, 53, 88, 135, 130, 41, 1047, 1048, 151, 18, 89, 45, 22, 156, 140, 26, 140, 54, 55, 1194, 288, 57, 1076, 34, 34, 601, 18, 151, 722, 1058, 1059, 794, 175, 156, 32, 33, 847, 613, 492, 156, 10, 794, 853, 21, 722, 24, 809, 25, 11, 12, 1083, 29, 1085, 156, 975, 34, 809, 794, 201, 188, 189, 190, 1143, 21, 193, 194, 209, 1148, 211, 615, 213, 192, 809, 216, 794, 955, 614, 345, 201, 476, 18, 224, 1123, 21, 201, 415, 229, 187, 231, 809, 213, 24, 209, 216, 192, 5, 213, 794, 201, 216, 24, 244, 245, 188, 189, 1134, 209, 1136, 188, 189, 213, 24, 809, 216, 24, 25, 26, 683, 1199, 710, 436, 437, 245, 26, 34, 5, 580, 954, 245, 956, 661, 34, 392, 393, 394, 188, 189, 661, 665, 1088, 25, 26, 245, 28, 287, 287, 661, 290, 291, 292, 932, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 50, 51, 287, 975, 661, 290, 291, 292, 312, 312, 661, 610, 661, 24, 318, 18, 303, 188, 189, 190, 24, 24, 193, 194, 18, 156, 5, 312, 21, 23, 722, 34, 112, 318, 27, 661, 116, 722, 118, 26, 120, 28, 1083, 10, 1085, 125, 722, 224, 188, 189, 190, 24, 229, 26, 231, 1245, 360, 137, 45, 139, 18, 441, 18, 21, 368, 722, 370, 244, 497, 5, 201, 722, 927, 722, 495, 21, 18, 983, 209, 459, 21, 27, 213, 16, 25, 216, 925, 34, 825, 25, 18, 1034, 819, 21, 1034, 822, 722, 979, 18, 836, 224, 21, 182, 23, 1034, 229, 794, 231, 24, 50, 51, 415, 864, 18, 245, 24, 21, 188, 189, 190, 244, 809, 193, 194, 188, 189, 190, 507, 15, 193, 194, 415, 436, 437, 24, 433, 26, 415, 26, 443, 28, 445, 445, 26, 34, 28, 444, 188, 189, 190, 454, 415, 193, 194, 5, 584, 18, 45, 465, 21, 445, 465, 45, 467, 21, 112, 113, 114, 16, 454, 27, 475, 21, 24, 478, 16, 25, 1120, 482, 1034, 465, 18, 467, 34, 21, 188, 189, 190, 475, 156, 475, 271, 21, 478, 21, 1034, 25, 482, 25, 16, 21, 50, 51, 5, 25, 18, 635, 511, 21, 188, 189, 190, 39, 102, 193, 194, 520, 521, 22, 25, 26, 601, 28, 25, 54, 55, 306, 912, 913, 309, 922, 6, 7, 613, 201, 520, 521, 317, 23, 45, 320, 26, 209, 28, 920, 921, 213, 21, 1191, 216, 22, 25, 188, 189, 190, 559, 560, 193, 194, 436, 437, 22, 560, 567, 567, 914, 915, 924, 24, 21, 26, 575, 923, 25, 578, 579, 50, 51, 245, 21, 578, 559, 567, 25, 415, 37, 38, 24, 710, 26, 916, 917, 918, 919, 21, 559, 29, 726, 25, 728, 52, 53, 25, 26, 39, 28, 735, 18, 25, 26, 21, 615, 436, 437, 25, 736, 737, 738, 739, 740, 741, 40, 45, 10, 11, 12, 18, 5, 615, 21, 615, 56, 18, 184, 185, 21, 935, 188, 189, 25, 95, 192, 1034, 13, 14, 15, 24, 25, 26, 1034, 730, 95, 432, 657, 658, 21, 34, 661, 1034, 25, 25, 26, 442, 28, 19, 669, 670, 447, 672, 42, 43, 451, 24, 453, 26, 990, 28, 1034, 977, 24, 45, 26, 686, 1034, 688, 1034, 188, 189, 190, 192, 470, 193, 194, 45, 474, 699, 48, 49, 34, 35, 36, 686, 706, 688, 691, 709, 710, 711, 1034, 21, 24, 37, 38, 25, 699, 21, 1168, 22, 722, 25, 22, 706, 22, 710, 709, 710, 52, 53, 559, 21, 68, 69, 70, 25, 104, 105, 106, 107, 108, 109, 110, 111, 864, 113, 1043, 825, 116, 95, 415, 21, 10, 11, 12, 25, 1053, 19, 836, 20, 21, 24, 95, 26, 132, 28, 134, 135, 136, 21, 22, 156, 140, 188, 189, 190, 1073, 21, 193, 194, 20, 25, 45, 1218, 27, 48, 49, 24, 156, 18, 909, 910, 911, 1090, 21, 163, 37, 38, 25, 0, 25, 21, 880, 18, 5, 25, 7, 10, 11, 12, 812, 52, 53, 32, 33, 24, 201, 185, 27, 1254, 24, 599, 21, 21, 209, 34, 25, 25, 213, 18, 832, 216, 1129, 835, 22, 837, 614, 34, 840, 224, 225, 21, 844, 21, 229, 25, 231, 25, 23, 832, 50, 51, 835, 1150, 837, 633, 224, 840, 18, 244, 245, 844, 864, 188, 189, 190, 24, 21, 193, 194, 872, 25, 24, 24, 21, 27, 21, 996, 25, 864, 25, 864, 34, 21, 662, 25, 664, 25, 89, 872, 25, 88, 18, 21, 559, 18, 264, 25, 156, 21, 19, 24, 103, 25, 32, 33, 29, 30, 31, 32, 33, 34, 22, 114, 115, 21, 34, 21, 696, 25, 288, 25, 290, 291, 47, 48, 49, 21, 32, 33, 298, 25, 21, 935, 21, 303, 25, 9, 25, 140, 21, 943, 18, 201, 25, 18, 948, 24, 71, 26, 318, 209, 21, 156, 18, 213, 25, 34, 216, 21, 21, 54, 55, 25, 25, 948, 224, 11, 21, 747, 21, 229, 25, 231, 25, 1102, 18, 345, 21, 188, 189, 190, 25, 192, 20, 21, 244, 245, 373, 357, 21, 188, 189, 116, 25, 25, 193, 194, 201, 1001, 1002, 114, 115, 21, 24, 21, 209, 25, 11, 25, 213, 20, 21, 216, 34, 34, 35, 36, 1001, 1002, 24, 224, 21, 22, 802, 803, 229, 34, 231, 24, 415, 26, 1034, 91, 32, 33, 188, 189, 190, 34, 192, 244, 245, 1045, 21, 1047, 1048, 19, 1168, 1045, 19, 436, 437, 19, 1056, 19, 1058, 1059, 52, 53, 54, 24, 91, 24, 432, 188, 189, 190, 846, 192, 188, 189, 190, 1075, 27, 193, 194, 195, 1080, 1080, 25, 21, 21, 451, 22, 453, 1088, 455, 18, 25, 458, 1093, 1093, 461, 25, 463, 1098, 1080, 21, 25, 1178, 302, 11, 24, 472, 1088, 22, 475, 1093, 24, 1093, 188, 189, 190, 482, 1098, 193, 194, 1120, 1121, 1122, 1123, 24, 1125, 1126, 25, 27, 23, 20, 497, 19, 19, 1134, 20, 1136, 21, 27, 1139, 1121, 1122, 1218, 1143, 23, 1145, 1146, 24, 1148, 21, 5, 1154, 25, 19, 1154, 22, 25, 1233, 20, 415, 24, 73, 20, 24, 1145, 1146, 184, 185, 1168, 25, 188, 189, 25, 1154, 192, 951, 559, 27, 1254, 27, 436, 437, 18, 188, 189, 190, 21, 1168, 193, 194, 21, 1191, 1192, 1193, 1194, 188, 189, 190, 25, 1199, 193, 194, 195, 979, 22, 29, 39, 56, 40, 21, 25, 1192, 1193, 25, 415, 581, 23, 21, 584, 1219, 1219, 25, 34, 35, 36, 25, 189, 25, 10, 18, 34, 35, 36, 25, 600, 436, 437, 91, 1219, 91, 91, 607, 608, 609, 91, 1245, 91, 22, 91, 615, 24, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 10, 11, 12, 20, 25, 25, 25, 18, 635, 25, 10, 11, 12, 22, 21, 144, 18, 40, 21, 646, 647, 192, 27, 20, 18, 23, 22, 18, 157, 158, 159, 160, 161, 162, 661, 164, 165, 24, 194, 91, 22, 1078, 559, 22, 21, 21, 20, 22, 20, 91, 677, 40, 25, 196, 25, 18, 18, 27, 685, 27, 687, 25, 24, 20, 691, 20, 27, 29, 30, 31, 32, 33, 34, 700, 701, 25, 89, 318, 705, 943, 1245, 1212, 709, 710, 1139, 47, 48, 49, 1037, 132, 697, 211, 1111, 1046, 1075, 722, 1191, 559, 893, 726, 348, 728, 185, 841, 832, 807, 1219, 584, 735, 71, 688, 154, 686, 156, 864, 130, 303, 12, 709, 511, 244, 1158, 355, 415, 1174, 713, 374, 870, 722, 1034, 869, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, -1, -1, -1, -1, 156, -1, -1, -1, 10, 11, 12, -1, 116, -1, 156, -1, 201, -1, -1, -1, 622, -1, 412, -1, 209, -1, -1, -1, 213, -1, -1, 216, -1, 123, 124, 125, 126, -1, 128, 224, -1, -1, -1, 133, 134, -1, 815, 137, 138, 201, 140, 141, 142, 143, -1, -1, -1, 209, -1, 201, 245, 213, -1, -1, 216, 155, 156, 209, -1, -1, -1, 213, 224, 1252, 216, -1, -1, 229, -1, 231, -1, -1, 224, -1, 188, 189, 190, 229, 192, 231, -1, 181, 244, 245, 863, 864, -1, 866, 360, -1, -1, 191, 244, 245, -1, -1, 368, -1, 370, 23, -1, -1, -1, 298, -1, -1, -1, -1, -1, -1, -1, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, -1, -1, -1, 325, 326, 327, 328, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 156, -1, -1, -1, -1, -1, 345, -1, -1, -1, 349, -1, 73, 74, 75, 76, 441, -1, 357, 80, 81, 82, 83, 84, 85, 86, -1, 443, 951, -1, -1, -1, -1, -1, 459, 958, 375, -1, -1, -1, -1, 10, 11, 12, -1, 201, -1, -1, -1, -1, -1, -1, -1, 209, -1, -1, -1, 213, -1, -1, 216, 817, -1, -1, 820, -1, -1, -1, 224, -1, 495, -1, -1, 229, -1, 231, 415, -1, -1, -1, -1, -1, 507, -1, 423, -1, -1, 631, 244, 245, -1, -1, -1, -1, -1, 511, -1, -1, -1, 643, -1, -1, -1, -1, -1, -1, -1, -1, -1, 415, -1, 1034, -1, -1, -1, -1, -1, -1, -1, 415, -1, -1, -1, -1, -1, -1, 551, -1, -1, 554, 436, 437, -1, -1, -1, -1, -1, -1, -1, -1, 436, 437, -1, -1, 560, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1077, 699, -1, -1, -1, -1, -1, -1, 578, 579, -1, -1, -1, -1, -1, 713, 1093, -1, -1, 1096, -1, -1, 601, -1, -1, 1102, -1, -1, 1105, 1106, -1, -1, -1, 156, 613, -1, -1, -1, -1, -1, -1, -1, 952, -1, 954, 955, 956, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 553, -1, -1, -1, -1, -1, 559, -1, -1, 648, 649, -1, 1149, -1, -1, -1, -1, -1, 201, 1156, 1157, -1, 661, -1, -1, -1, 209, 657, 658, -1, 213, 1168, -1, 216, -1, -1, -1, -1, -1, 559, 670, 224, -1, -1, -1, 415, 229, -1, 231, 559, -1, -1, -1, -1, -1, -1, -1, -1, 1195, -1, -1, 244, 245, -1, -1, -1, 436, 437, -1, -1, -1, -1, -1, -1, -1, -1, 629, 835, 1215, 1216, -1, 711, 840, 722, -1, 1222, 844, -1, -1, -1, -1, 730, -1, -1, -1, -1, -1, 736, 737, 738, 739, 740, 741, 742, 743, -1, 659, -1, -1, -1, 663, -1, 870, 1083, -1, 1085, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 892, 893, -1, -1, -1, -1, 898, 899, 900, 901, 902, 903, 904, 905, 906, 907, 908, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, 721, -1, -1, 42, 43, 726, -1, 728, 47, 48, 49, -1, -1, -1, 735, -1, -1, -1, 825, -1, -1, 559, 948, -1, -1, -1, -1, -1, 1, 836, -1, -1, 71, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 415, -1, -1, -1, -1, 42, 43, -1, -1, 880, 47, 48, 49, 116, -1, -1, -1, -1, -1, -1, -1, 436, 437, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, -1, 927, -1, 95, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, 1088, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 894, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 996, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 559, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, -1, 1034, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, -1, 26, 983, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, -1, 45, -1, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, -1, -1, -1, 71, -1, -1, -1, -1, 1032, -1, -1, -1, -1, -1, -1, -1, -1, 0, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, 18, -1, -1, -1, -1, -1, 24, -1, 111, -1, -1, -1, -1, 116, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, 1178, -1, -1, -1, -1, 1097, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, 72, -1, -1, -1, -1, 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1218, 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, 1233, 192, 193, 194, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 1254, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 0, 1, -1, -1, -1, -1, 188, 189, 190, 191, -1, 193, 194, 195, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, 72, -1, -1, -1, -1, 77, 78, 79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 1, 193, 194, 195, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, -1, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 1, -1, -1, -1, -1, 6, 7, 8, -1, -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, -1, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, 1, -1, 47, 48, 49, 6, 7, 8, -1, -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, 25, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, 47, 48, 49, -1, 95, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 1, -1, -1, -1, -1, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, 188, 189, 190, -1, 192, 193, 194, 42, 43, -1, 1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, 19, 111, -1, -1, -1, 24, 116, 26, -1, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 48, 49, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 1, -1, -1, -1, -1, 6, 7, 8, 71, -1, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, 188, 189, 190, -1, 192, 193, 194, 42, 43, -1, 1, -1, 47, 48, 49, 6, 7, 8, -1, 116, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, -1, 47, 48, 49, -1, 95, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, 19, 20, 111, -1, -1, 24, 71, 116, -1, -1, 29, 30, 31, 32, 33, 34, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, 47, 48, 49, -1, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, 116, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, -1, -1, -1, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, 188, 189, 190, -1, 192, 193, 194, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 44, -1, 46, 47, 48, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, 192, 193, 194, 195, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, 6, 7, 8, 116, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, -1, -1, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, 6, 7, 8, -1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, -1, -1, -1, -1, 24, -1, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, 47, 48, 49, -1, -1, 96, 97, 98, 99, 100, 101, 102, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, 71, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, 97, 98, 99, 100, 101, 102, 19, -1, -1, -1, -1, 24, -1, -1, 111, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 193, 194, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 20, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, 19, 20, -1, 190, 191, 24, -1, 26, 195, 28, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, 24, -1, 47, 48, 49, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, -1, -1, 19, 47, 48, 49, 71, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 42, 43, 71, -1, 19, 47, 48, 49, -1, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, 19, 116, -1, -1, 71, 24, -1, 47, 48, 49, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, 47, 48, 49, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, 116, 192, 193, 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, 188, 189, 190, 116, 192, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, 188, 189, 190, 191, -1, 193, 194, 195, 24, 25, -1, -1, -1, 29, 30, 31, 32, 33, 34, 24, -1, -1, 27, -1, 29, 30, 31, 32, 33, 34, -1, 47, 48, 49, -1, -1, -1, -1, -1, -1, 24, 25, 47, 48, 49, 29, 30, 31, 32, 33, 34, 24, -1, -1, 27, 71, 29, 30, 31, 32, 33, 34, -1, 47, 48, 49, 71, -1, -1, -1, -1, -1, 24, 25, 47, 48, 49, 29, 30, 31, 32, 33, 34, 24, -1, -1, -1, 71, 29, 30, 31, 32, 33, 34, -1, 47, 48, 49, 71, -1, 116, -1, -1, -1, -1, -1, 47, 48, 49, -1, -1, 116, -1, -1, -1, 24, -1, -1, -1, 71, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, 71, -1, 116, -1, -1, -1, -1, -1, 47, 48, 49, -1, 24, 116, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, 116, 47, 48, 49, -1, -1, -1, -1, 188, 189, 190, 116, 192, -1, -1, -1, -1, -1, -1, 188, 189, 190, 24, 192, -1, 71, -1, 29, 30, 31, 32, 33, 34, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, 116, 192, 47, 48, 49, -1, -1, -1, 188, 189, 190, -1, 192, 24, -1, -1, -1, -1, 29, 30, 31, 32, 33, 34, -1, -1, 71, 116, -1, 188, 189, 190, -1, 192, -1, -1, 47, 48, 49, -1, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, 72, 188, 189, 190, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 188, 189, 190, -1, 192, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, 46, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, -1, -1, -1, -1, 188, 189, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 69, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 93, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, 46, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 44, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, 113, 114, 115, -1, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, -1, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, -1, -1, -1, -1, -1, -1, -1, -1, 190, 191, -1, -1, -1, 195 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 1, 18, 34, 44, 46, 72, 77, 78, 79, 92, 93, 94, 112, 113, 114, 115, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 188, 189, 190, 191, 193, 194, 195, 198, 199, 200, 201, 202, 206, 212, 215, 216, 256, 261, 303, 304, 310, 312, 324, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 347, 349, 352, 361, 366, 371, 375, 470, 471, 472, 112, 113, 114, 373, 374, 375, 24, 308, 314, 315, 347, 371, 190, 347, 203, 190, 471, 1, 6, 7, 8, 10, 11, 12, 13, 14, 15, 16, 17, 18, 24, 29, 30, 31, 32, 33, 34, 47, 48, 49, 71, 95, 96, 97, 98, 99, 100, 101, 102, 111, 116, 189, 190, 192, 193, 269, 271, 273, 275, 278, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 292, 294, 299, 300, 388, 393, 403, 404, 405, 407, 410, 414, 415, 423, 429, 430, 431, 434, 436, 442, 464, 466, 467, 470, 471, 1, 11, 18, 24, 193, 194, 300, 389, 391, 392, 393, 396, 398, 399, 401, 402, 405, 407, 410, 415, 419, 428, 430, 435, 464, 467, 389, 390, 312, 312, 312, 361, 361, 361, 361, 361, 361, 361, 361, 361, 361, 0, 200, 26, 313, 19, 257, 259, 18, 468, 24, 347, 350, 312, 312, 312, 312, 312, 312, 312, 312, 361, 312, 350, 350, 312, 361, 88, 361, 68, 69, 70, 361, 206, 361, 373, 375, 24, 189, 190, 300, 312, 346, 383, 470, 21, 312, 312, 311, 312, 361, 361, 204, 205, 209, 312, 347, 375, 471, 24, 273, 294, 302, 411, 24, 24, 24, 24, 471, 18, 18, 18, 300, 270, 300, 383, 404, 281, 281, 281, 281, 281, 281, 312, 24, 273, 273, 24, 24, 16, 16, 16, 16, 15, 102, 406, 24, 387, 388, 393, 405, 407, 410, 413, 415, 428, 431, 434, 436, 464, 465, 467, 437, 24, 26, 48, 49, 361, 23, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 276, 312, 34, 35, 36, 32, 33, 50, 51, 37, 38, 52, 53, 54, 55, 29, 39, 40, 56, 41, 57, 18, 21, 404, 95, 19, 422, 404, 387, 404, 192, 404, 22, 24, 300, 398, 415, 18, 95, 398, 398, 303, 347, 424, 19, 20, 400, 391, 404, 95, 27, 312, 24, 258, 424, 361, 18, 371, 348, 383, 312, 471, 312, 471, 19, 471, 300, 25, 347, 26, 312, 375, 384, 386, 25, 361, 18, 361, 18, 23, 371, 468, 26, 313, 24, 361, 209, 5, 361, 372, 378, 379, 380, 408, 22, 300, 300, 300, 300, 301, 18, 18, 24, 413, 25, 25, 25, 24, 383, 299, 300, 18, 18, 18, 18, 18, 406, 6, 7, 413, 387, 19, 421, 387, 387, 415, 25, 272, 299, 300, 28, 45, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 279, 277, 281, 281, 281, 282, 282, 283, 283, 284, 284, 284, 284, 285, 285, 286, 287, 288, 291, 295, 297, 293, 299, 20, 190, 404, 423, 424, 416, 9, 11, 300, 25, 24, 361, 303, 398, 11, 302, 25, 372, 20, 111, 387, 420, 424, 427, 260, 371, 361, 91, 21, 19, 312, 361, 19, 312, 361, 368, 369, 471, 19, 312, 312, 27, 302, 24, 386, 26, 312, 308, 195, 307, 308, 316, 317, 309, 361, 91, 27, 312, 24, 361, 205, 376, 377, 471, 25, 21, 312, 382, 471, 22, 25, 433, 25, 18, 25, 19, 281, 383, 25, 21, 25, 302, 412, 25, 420, 11, 24, 21, 25, 27, 471, 471, 42, 43, 280, 289, 22, 300, 290, 20, 20, 427, 432, 24, 25, 397, 371, 24, 27, 207, 25, 20, 20, 111, 427, 20, 111, 387, 413, 312, 23, 305, 348, 20, 357, 19, 20, 359, 19, 20, 21, 23, 367, 27, 25, 361, 378, 27, 302, 24, 21, 312, 312, 312, 23, 468, 302, 25, 372, 205, 21, 213, 5, 381, 347, 25, 301, 19, 299, 425, 426, 361, 383, 409, 22, 24, 438, 299, 312, 312, 24, 273, 24, 273, 296, 22, 20, 387, 300, 24, 29, 30, 31, 32, 33, 34, 48, 49, 71, 189, 190, 271, 273, 276, 282, 283, 284, 285, 286, 287, 288, 289, 290, 292, 439, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 462, 470, 300, 361, 73, 74, 75, 76, 80, 81, 82, 83, 84, 85, 86, 233, 235, 237, 238, 240, 241, 242, 247, 248, 254, 255, 325, 326, 328, 329, 330, 208, 20, 20, 111, 20, 25, 306, 312, 417, 20, 353, 417, 20, 355, 312, 369, 312, 368, 384, 25, 27, 25, 378, 361, 246, 247, 19, 26, 28, 299, 319, 320, 321, 322, 471, 312, 312, 27, 210, 25, 312, 5, 471, 234, 236, 238, 240, 242, 248, 326, 330, 382, 206, 312, 370, 375, 385, 386, 387, 18, 425, 21, 469, 21, 25, 22, 300, 439, 383, 383, 294, 298, 25, 300, 383, 281, 281, 281, 281, 281, 281, 273, 273, 24, 24, 26, 48, 49, 361, 23, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 34, 35, 36, 32, 33, 50, 51, 37, 38, 52, 53, 54, 55, 29, 39, 40, 56, 41, 57, 25, 440, 25, 189, 244, 245, 239, 243, 233, 91, 91, 91, 361, 361, 91, 332, 336, 91, 233, 20, 312, 318, 215, 347, 362, 363, 417, 362, 417, 302, 20, 25, 25, 307, 18, 319, 323, 302, 471, 319, 23, 322, 22, 319, 91, 361, 234, 211, 25, 214, 234, 24, 312, 195, 370, 394, 469, 426, 20, 274, 471, 25, 25, 25, 25, 294, 18, 25, 25, 299, 25, 272, 300, 28, 45, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 299, 281, 281, 281, 282, 282, 283, 283, 284, 284, 284, 284, 285, 285, 286, 287, 288, 289, 458, 460, 290, 21, 18, 442, 40, 89, 90, 121, 122, 135, 249, 250, 251, 253, 24, 34, 189, 190, 262, 263, 265, 468, 470, 327, 5, 24, 34, 184, 185, 189, 192, 217, 218, 224, 225, 226, 228, 229, 230, 231, 333, 470, 331, 319, 18, 21, 312, 361, 363, 418, 362, 418, 362, 312, 20, 21, 27, 318, 234, 468, 361, 301, 20, 25, 26, 28, 18, 413, 281, 21, 25, 27, 471, 471, 22, 300, 441, 244, 21, 468, 189, 252, 303, 470, 251, 263, 263, 26, 28, 45, 21, 468, 24, 34, 189, 266, 268, 470, 220, 228, 230, 24, 230, 23, 56, 187, 223, 52, 53, 54, 227, 26, 28, 45, 219, 24, 468, 267, 268, 318, 312, 361, 18, 22, 364, 365, 371, 358, 418, 360, 418, 20, 319, 468, 91, 375, 395, 312, 300, 471, 194, 463, 383, 312, 312, 459, 22, 250, 25, 27, 263, 264, 442, 471, 471, 263, 266, 266, 26, 28, 45, 21, 468, 22, 32, 33, 232, 25, 230, 218, 221, 230, 224, 230, 228, 27, 192, 471, 471, 22, 228, 312, 468, 18, 308, 312, 21, 312, 361, 22, 20, 354, 20, 356, 91, 25, 27, 416, 25, 294, 461, 27, 25, 27, 264, 471, 471, 266, 312, 196, 222, 228, 40, 27, 222, 25, 312, 312, 302, 365, 18, 312, 20, 20, 294, 27, 25, 221, 361, 302, 351 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, cgrammar_YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; cgrammar_YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, cgrammar_YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; cgrammar_YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (cgrammar_YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) cgrammar_YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, cgrammar_YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; cgrammar_YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ cgrammar_YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ cgrammar_YYSTYPE yyvsa[YYINITDEPTH]; cgrammar_YYSTYPE *yyvs = yyvsa; cgrammar_YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ cgrammar_YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ cgrammar_YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 4: { context_checkGlobalScope (); ;} break; case 5: { context_checkGlobalScope (); ;} break; case 6: { uentry_clearDecl (); ;} break; case 7: { uentry_clearDecl (); ;} break; case 8: { uentry_clearDecl (); ;} break; case 9: { uentry_clearDecl (); ;} break; case 10: { uentry_clearDecl (); ;} break; case 11: { uentry_checkDecl (); exprNode_free ((yyvsp[(1) - (1)].expr)); ;} break; case 12: { uentry_clearDecl (); lltok_free ((yyvsp[(1) - (1)].tok)); /* evans 2002-02-08: okay to have a null statement */ ;} break; case 13: { uentry_clearDecl (); ;} break; case 14: { checkConstant ((yyvsp[(2) - (8)].qtyp), (yyvsp[(4) - (8)].ntyp)); lltok_free2 ((yyvsp[(1) - (8)].tok), (yyvsp[(8) - (8)].tok)); ;} break; case 15: { checkValueConstant ((yyvsp[(2) - (11)].qtyp), (yyvsp[(4) - (11)].ntyp), (yyvsp[(8) - (11)].expr)); lltok_free3 ((yyvsp[(1) - (11)].tok), (yyvsp[(6) - (11)].tok), (yyvsp[(11) - (11)].tok)); ;} break; case 16: { context_enterFunctionHeader (); ;} break; case 17: { declareStaticFunction ((yyvsp[(3) - (5)].ntyp)); context_quietExitFunction (); context_exitFunctionHeader (); lltok_free2 ((yyvsp[(1) - (5)].tok), (yyvsp[(5) - (5)].tok)); /*!*/ ;} break; case 18: { qtype qint = qtype_create (ctype_int); (yyval.ntyp) = idDecl_fixBase ((yyvsp[(1) - (1)].ntyp), qint); qtype_free (qint); ;} break; case 19: { (yyval.ntyp) = idDecl_fixBase ((yyvsp[(3) - (3)].ntyp), (yyvsp[(1) - (3)].qtyp)); ;} break; case 21: { (yyval.ntyp) = (yyvsp[(2) - (2)].ntyp); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), idDecl_getTyp ((yyval.ntyp))); ;} break; case 22: { (yyval.ntyp) = idDecl_create ((yyvsp[(1) - (1)].cname), qtype_unknown ()); ;} break; case 23: { (yyval.ntyp) = idDecl_expectFunction ((yyvsp[(4) - (6)].ntyp)); lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(6) - (6)].tok)); ;} break; case 24: { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (3)].ntyp), ctype_makeInnerArray (idDecl_getCtype ((yyvsp[(1) - (3)].ntyp)))); lltok_free2 ((yyvsp[(2) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 25: { exprNode_findValue ((yyvsp[(4) - (6)].expr)); idDecl_notExpectingFunction ((yyvsp[(1) - (6)].ntyp)); if (exprNode_hasValue ((yyvsp[(4) - (6)].expr))) { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ctype_makeInnerFixedArray (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), exprNode_getLongValue ((yyvsp[(4) - (6)].expr)))); } else { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ctype_makeInnerArray (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)))); } lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(5) - (6)].tok)); ;} break; case 26: { setCurrentParams (uentryList_missingParams); ;} break; case 27: { /* need to support globals and modifies here! */ functionClauseList fcl; ctype ct = ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), uentryList_makeMissingParams ()); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ct); /*drl 7/25/01 added*/ setImplicitfcnConstraints(); DPRINTF((message("namedDeclBase PushType TLPAREN TRPAREN...:\n adding implict constraints to functionClause List: %s", functionClauseList_unparse((yyvsp[(6) - (6)].funcclauselist)) ) )); fcl = functionClauseList_setImplicitConstraints((yyvsp[(6) - (6)].funcclauselist)); idDecl_addClauses ((yyval.ntyp), fcl); DPRINTF((message("1 added fuctionClause List: %s to the Id", functionClauseList_unparse(fcl) ) )); context_popLoc (); lltok_free2 ((yyvsp[(3) - (6)].tok), (yyvsp[(4) - (6)].tok)); ;} break; case 28: { setCurrentParams ((yyvsp[(4) - (5)].entrylist)); ;} break; case 29: { functionClauseList fcl; setImplicitfcnConstraints (); clearCurrentParams (); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (7)].ntyp), ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (7)].ntyp)), (yyvsp[(4) - (7)].entrylist))); DPRINTF((message("namedDeclBase PushType TLPAREN genericParamList TRPAREN...:\n adding implict constraints to functionClause List: %s", functionClauseList_unparse((yyvsp[(7) - (7)].funcclauselist)) ) )) ; fcl = functionClauseList_setImplicitConstraints((yyvsp[(7) - (7)].funcclauselist)); idDecl_addClauses ((yyval.ntyp), fcl); DPRINTF((message("added fuctionClause List: %s to the Id", functionClauseList_unparse(fcl) ) )); context_popLoc (); lltok_free2 ((yyvsp[(3) - (7)].tok), (yyvsp[(5) - (7)].tok)); ;} break; case 30: { (yyval.ntyp) = idDecl_create ((yyvsp[(1) - (1)].cname), qtype_unknown ()); ;} break; case 31: { (yyval.ntyp) = idDecl_expectFunction ((yyvsp[(4) - (6)].ntyp)); lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(6) - (6)].tok)); ;} break; case 32: { (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (3)].ntyp), ctype_makeInnerArray (idDecl_getCtype ((yyvsp[(1) - (3)].ntyp)))); lltok_free2 ((yyvsp[(2) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 33: { int value; if (exprNode_hasValue ((yyvsp[(4) - (6)].expr)) && multiVal_isInt (exprNode_getValue ((yyvsp[(4) - (6)].expr)))) { value = (int) multiVal_forceInt (exprNode_getValue ((yyvsp[(4) - (6)].expr))); } else { value = 0; } (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ctype_makeInnerFixedArray (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), value)); lltok_free2 ((yyvsp[(2) - (6)].tok), (yyvsp[(5) - (6)].tok)); ;} break; case 34: { setCurrentParams (uentryList_missingParams); ;} break; case 35: { ctype ct = ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (6)].ntyp)), uentryList_makeMissingParams ()); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (6)].ntyp), ct); idDecl_addClauses ((yyval.ntyp), (yyvsp[(6) - (6)].funcclauselist)); context_popLoc (); lltok_free2 ((yyvsp[(3) - (6)].tok), (yyvsp[(4) - (6)].tok)); ;} break; case 36: { setCurrentParams ((yyvsp[(4) - (5)].entrylist)); ;} break; case 37: { clearCurrentParams (); (yyval.ntyp) = idDecl_replaceCtype ((yyvsp[(1) - (7)].ntyp), ctype_makeFunction (idDecl_getCtype ((yyvsp[(1) - (7)].ntyp)), (yyvsp[(4) - (7)].entrylist))); idDecl_addClauses ((yyval.ntyp), (yyvsp[(7) - (7)].funcclauselist)); context_popLoc (); lltok_free ((yyvsp[(3) - (7)].tok)); /*!! lltok_free2 ($3, $5); */ ;} break; case 38: { setCurrentParams ((yyvsp[(4) - (5)].entrylist)); ;} break; case 39: { clearCurrentParams (); ;} break; case 40: { declareCIter ((yyvsp[(2) - (10)].cname), (yyvsp[(4) - (10)].entrylist)); lltok_free3 ((yyvsp[(1) - (10)].tok), (yyvsp[(3) - (10)].tok), (yyvsp[(5) - (10)].tok)); ;} break; case 41: { exprNode_checkMacroBody ((yyvsp[(2) - (3)].expr)); lltok_free2 ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 42: { exprNode_checkIterBody ((yyvsp[(2) - (3)].expr)); lltok_free2 ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].tok)); ;} break; case 43: { exprNode_checkIterEnd ((yyvsp[(2) - (3)].expr)); lltok_free2 ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].tok));;} break; case 44: { exprChecks_checkEmptyMacroBody (); lltok_free2 ((yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].tok)); ;} break; case 45: { clabstract_declareFunction ((yyvsp[(1) - (1)].ntyp)); ;} break; case 46: { (yyval.msconstraint) = metaStateConstraint_create ((yyvsp[(1) - (3)].msspec), (yyvsp[(3) - (3)].msexpr)); lltok_free ((yyvsp[(2) - (3)].tok)); ;} break; case 47: { cscannerHelp_expectingMetaStateName (); ;} break; case 48: { cscannerHelp_clearExpectingMetaStateName (); (yyval.msspec) = metaStateSpecifier_create ((yyvsp[(1) - (4)].sr), (yyvsp[(4) - (4)].msinfo)); lltok_free ((yyvsp[(3) - (4)].tok)); ;} break; case 49: { cscannerHelp_expectingMetaStateName (); ;} break; case 50: { cscannerHelp_clearExpectingMetaStateName (); (yyval.msspec) = metaStateSpecifier_createElipsis ((yyvsp[(4) - (4)].msinfo)); lltok_free2 ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].tok)); ;} break; case 51: { (yyval.msexpr) = metaStateExpression_create ((yyvsp[(1) - (1)].msspec)); ;} break; case 52: { (yyval.msexpr) = metaStateExpression_createMerge ((yyvsp[(1) - (3)].msspec), (yyvsp[(3) - (3)].msexpr)); lltok_free ((yyvsp[(2) - (3)].tok)); ;} break; case 56: { (yyval.conL) = constraintList_add ((yyvsp[(3) - (3)].conL), (yyvsp[(1) - (3)].con)); ;} break; case 57: { (yyval.conL) = constraintList_single ((yyvsp[(1) - (1)].con)); ;} break; case 58: { (yyval.con) = makeConstraintParse3 ((yyvsp[(1) - (3)].conE), (yyvsp[(2) - (3)].tok), (yyvsp[(3) - (3)].conE)); DPRINTF(("Done BufConstraint1\n")); ;} break; case 65: {(yyval.conE) = constraintExpr_parseMakeUnaryOp ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].conE)); DPRINTF( ("Got BufConstraintExpr UNary Op ") ); ;} break; case 66: { DPRINTF( ("Got BufConstraintExpr BINary Op ") ); (yyval.conE) = constraintExpr_parseMakeBinaryOp ((yyvsp[(2) - (5)].conE), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].conE)); ;} break; case 67: { (yyval.conE) = constraintExpr_makeTermsRef ((yyvsp[(1) - (1)].sr));;} break; case 68: { (yyval.conE) = constraintExpr_makeIntLiteral (exprNode_getLongValue ((yyvsp[(1) - (1)].expr))); ;} break; case 69: { /*@-onlytrans@*/ (yyval.sr) = checkbufferConstraintClausesId ((yyvsp[(1) - (1)].entry)); /*@=onlytrans@*/ /*@i523@*/ ;} break; case 70: { (yyval.sr) = fixStateClausesId ((yyvsp[(1) - (1)].cname)); ;} break; case 71: { (yyval.sr) = sRef_makeAnyArrayFetch ((yyvsp[(1) - (3)].sr)); ;} break; case 72: { /* char *t; int c; t = cstring_toCharsSafe (exprNode_unparse($3)); c = atoi( t ); */ (yyval.sr) = sRef_makeArrayFetchKnown ((yyvsp[(1) - (4)].sr), exprNode_getLongValue ((yyvsp[(3) - (4)].expr))); ;} break; case 73: { (yyval.sr) = sRef_constructPointer ((yyvsp[(2) - (2)].sr)); ;} break; case 74: { (yyval.sr) = (yyvsp[(2) - (3)].sr); ;} break; case 75: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_buildField ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 76: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_makeArrow ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 80: { (yyval.funcclauselist) = functionClauseList_new (); ;} break; case 81: { (yyval.funcclauselist) = functionClauseList_prepend ((yyvsp[(2) - (2)].funcclauselist), (yyvsp[(1) - (2)].funcclause)); ;} break; case 82: { (yyval.funcclauselist) = functionClauseList_new (); ;} break; case 83: { (yyval.funcclauselist) = functionClauseList_prepend ((yyvsp[(2) - (2)].funcclauselist), (yyvsp[(1) - (2)].funcclause)); ;} break; case 84: { (yyval.funcclause) = functionClause_createGlobals ((yyvsp[(1) - (1)].globsclause)); ;} break; case 85: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 86: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 87: { (yyval.funcclause) = functionClause_createState ((yyvsp[(1) - (1)].stateclause)); ;} break; case 88: { (yyval.funcclause) = (yyvsp[(1) - (1)].funcclause); ;} break; case 89: { (yyval.funcclause) = functionClause_createWarn ((yyvsp[(1) - (1)].warnclause)); ;} break; case 90: { (yyval.funcclause) = functionClause_createGlobals ((yyvsp[(1) - (1)].globsclause)); ;} break; case 91: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 92: { (yyval.funcclause) = functionClause_createModifies ((yyvsp[(1) - (1)].modsclause)); ;} break; case 93: { (yyval.funcclause) = functionClause_createState ((yyvsp[(1) - (1)].stateclause)); ;} break; case 94: { (yyval.funcclause) = (yyvsp[(1) - (1)].funcclause); ;} break; case 95: { (yyval.funcclause) = functionClause_createWarn ((yyvsp[(1) - (1)].warnclause)); ;} break; case 96: { (yyval.globsclause) = (yyvsp[(1) - (2)].globsclause); ;} break; case 97: { setProcessingGlobalsList (); ;} break; case 98: { unsetProcessingGlobals (); (yyval.globsclause) = globalsClause_create ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].globset)); ;} break; case 99: { (yyval.modsclause) = modifiesClause_createNoMods ((yyvsp[(1) - (1)].tok)); ;} break; case 100: { (yyval.modsclause) = (yyvsp[(1) - (2)].modsclause); ;} break; case 101: { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 102: { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); (yyval.modsclause) = modifiesClause_create ((yyvsp[(1) - (3)].tok), (yyvsp[(3) - (3)].srset)); ;} break; case 103: { (yyval.flagspec) = flagSpec_createPlain ((yyvsp[(1) - (1)].cname)); ;} break; case 104: { (yyval.flagspec) = flagSpec_createOr ((yyvsp[(1) - (3)].cname), (yyvsp[(3) - (3)].flagspec)); ;} break; case 107: { (yyval.warnclause) = warnClause_undefined; ;} break; case 108: { (yyval.warnclause) = (yyvsp[(1) - (2)].warnclause); ;} break; case 109: { llassert (exprNode_knownStringValue ((yyvsp[(3) - (3)].expr))); (yyval.warnclause) = warnClause_create ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].flagspec), cstring_copy (multiVal_forceString (exprNode_getValue ((yyvsp[(3) - (3)].expr))))); exprNode_free ((yyvsp[(3) - (3)].expr)); ;} break; case 110: { (yyval.warnclause) = warnClause_create ((yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].flagspec), cstring_undefined); ;} break; case 111: { (yyval.globset) = globSet_single ((yyvsp[(1) - (1)].sr)); ;} break; case 112: { (yyval.globset) = globSet_insert ((yyvsp[(1) - (3)].globset), (yyvsp[(3) - (3)].sr)); ;} break; case 113: { (yyval.sr) = clabstract_createGlobal ((yyvsp[(2) - (2)].sr), (yyvsp[(1) - (2)].tquallist)); ;} break; case 114: { (yyval.tquallist) = qualList_undefined; ;} break; case 115: { (yyval.tquallist) = qualList_add ((yyvsp[(2) - (2)].tquallist), (yyvsp[(1) - (2)].typequal)); ;} break; case 116: { (yyval.sr) = uentry_getSref ((yyvsp[(1) - (1)].entry)); ;} break; case 117: { (yyval.sr) = clabstract_unrecognizedGlobal ((yyvsp[(1) - (1)].cname)); ;} break; case 118: { (yyval.sr) = clabstract_checkGlobal ((yyvsp[(1) - (1)].expr)); ;} break; case 119: { (yyval.typequal) = qual_createUndef (); ;} break; case 120: { (yyval.typequal) = qual_createKilled (); ;} break; case 121: { (yyval.typequal) = qual_createOut (); ;} break; case 122: { (yyval.typequal) = qual_createIn (); ;} break; case 123: { (yyval.typequal) = qual_createPartial (); ;} break; case 131: { /**!!! deal with fred; fred (int); declarations! **/ qtype qint = qtype_create (ctype_int); (yyval.ntyp) = idDecl_fixBase ((yyvsp[(1) - (1)].ntyp), qint); qtype_free (qint); ;} break; case 132: { (yyval.ntyp) = idDecl_fixBase ((yyvsp[(3) - (3)].ntyp), (yyvsp[(1) - (3)].qtyp)); ;} break; case 133: { checkDoneParams (); context_enterInnerContext (); ;} break; case 134: { exprNode_checkFunctionBody ((yyvsp[(3) - (3)].expr)); (yyval.expr) = (yyvsp[(3) - (3)].expr); context_exitInner ((yyvsp[(3) - (3)].expr)); ;} break; case 135: { context_enterOldStyleScope (); ;} break; case 136: { oldStyleDoneParams (); context_enterInnerContext (); ;} break; case 137: { exprNode_checkFunctionBody ((yyvsp[(4) - (4)].expr)); (yyval.expr) = (yyvsp[(4) - (4)].expr); /* oldstyle */ context_exitInner ((yyvsp[(4) - (4)].expr)); ;} break; case 138: { context_setFunctionDefined (exprNode_loc ((yyvsp[(2) - (2)].expr))); exprNode_checkFunction (context_getHeader (), (yyvsp[(2) - (2)].expr)); /* DRL 8 8 2000 */ context_exitFunction (); ;} break; case 139: { (yyval.srset) = (yyvsp[(1) - (2)].srset); ;} break; case 140: { (yyval.srset) = sRefSet_new (); ;} break; case 141: { (yyval.sr) = uentry_getSref ((yyvsp[(1) - (1)].entry)); checkModifiesId ((yyvsp[(1) - (1)].entry)); ;} break; case 142: { (yyval.sr) = fixModifiesId ((yyvsp[(1) - (1)].cname)); ;} break; case 143: { (yyval.sr) = fixModifiesId ((yyvsp[(1) - (1)].cname)); ;} break; case 144: { (yyval.sr) = modListArrayFetch ((yyvsp[(1) - (3)].sr), sRef_undefined); ;} break; case 145: { (yyval.sr) = modListArrayFetch ((yyvsp[(1) - (4)].sr), (yyvsp[(3) - (4)].sr)); ;} break; case 146: { (yyval.sr) = modListPointer ((yyvsp[(2) - (2)].sr)); ;} break; case 147: { (yyval.sr) = (yyvsp[(2) - (3)].sr); ;} break; case 148: { (yyval.sr) = modListFieldAccess ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 149: { (yyval.sr) = modListArrowAccess ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 150: { (yyval.sr) = (yyvsp[(1) - (1)].sr); ;} break; case 151: { (yyval.sr) = sRef_makeUnknown (); /* sRef_makeConstant ($1); ? */ ;} break; case 152: { (yyval.srset) = sRefSet_single ((yyvsp[(1) - (1)].sr)); ;} break; case 153: { (yyval.srset) = sRefSet_insert ((yyvsp[(1) - (3)].srset), (yyvsp[(3) - (3)].sr)); ;} break; case 154: { (yyval.sr) = checkStateClausesId ((yyvsp[(1) - (1)].entry)); ;} break; case 155: { (yyval.sr) = fixStateClausesId ((yyvsp[(1) - (1)].cname)); ;} break; case 156: { (yyval.sr) = sRef_makeAnyArrayFetch ((yyvsp[(1) - (3)].sr)); ;} break; case 157: { (yyval.sr) = sRef_makeAnyArrayFetch ((yyvsp[(1) - (4)].sr)); ;} break; case 158: { (yyval.sr) = sRef_constructPointer ((yyvsp[(2) - (2)].sr)); ;} break; case 159: { (yyval.sr) = (yyvsp[(2) - (3)].sr); ;} break; case 160: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_buildField ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 161: { cstring_markOwned ((yyvsp[(3) - (3)].cname)); (yyval.sr) = sRef_makeArrow ((yyvsp[(1) - (3)].sr), (yyvsp[(3) - (3)].cname)); ;} break; case 162: { DPRINTF ((message("Empty optSpecClauseList") )); (yyval.srset) = sRefSet_undefined ;} break; case 164: { if (sRef_isValid ((yyvsp[(1) - (1)].sr))) { (yyval.srset) = sRefSet_single ((yyvsp[(1) - (1)].sr)); } else { DPRINTF((message("returning sRefSEt_undefined ") )); (yyval.srset) = sRefSet_undefined; } ;} break; case 165: { if (sRef_isValid ((yyvsp[(3) - (3)].sr))) { (yyval.srset) = sRefSet_insert ((yyvsp[(1) - (3)].srset), (yyvsp[(3) - (3)].sr)); } else { (yyval.srset) = (yyvsp[(1) - (3)].srset); } ;} break; case 166: { (yyval.expr) = exprNode_fromIdentifier ((yyvsp[(1) - (1)].entry)); ;} break; case 167: { (yyval.expr) = exprNode_fromUIO ((yyvsp[(1) - (1)].cname)); ;} break; case 169: { (yyval.expr) = exprNode_addParens ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].expr)); ;} break; case 170: { (yyval.expr) = exprNode_fromIdentifier (cscannerHelp_coerceId ((yyvsp[(1) - (1)].cname))); ;} break; case 171: { (yyval.expr) = exprNode_makeError (); ;} break; case 172: { exprChecks_inCompoundStatementExpression (); ;} break; case 173: { exprChecks_leaveCompoundStatementExpression (); (yyval.expr) = exprNode_compoundStatementExpression ((yyvsp[(1) - (4)].tok), (yyvsp[(3) - (4)].expr)); ;} break; case 175: { (yyval.expr) = exprNode_arrayFetch ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;} break; case 176: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (3)].expr), exprNodeList_new ()); ;} break; case 177: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].exprlist)); ;} break; case 178: { (yyval.expr) = exprNode_vaArg ((yyvsp[(1) - (6)].tok), (yyvsp[(3) - (6)].expr), (yyvsp[(5) - (6)].qtyp)); ;} break; case 179: { (yyval.expr) = exprNode_fieldAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 180: { (yyval.expr) = exprNode_arrowAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 181: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 182: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 183: { /* added for C99 */ (yyval.expr) = exprNode_undefined; /*@i87 no checking */ ;} break; case 184: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 185: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (3)].exprlist), (yyvsp[(3) - (3)].expr)); ;} break; case 187: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 188: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 189: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 190: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 191: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 192: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 193: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 194: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 195: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 196: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 197: { (yyval.cstringlist) = cstringList_add ((yyvsp[(1) - (3)].cstringlist), (yyvsp[(3) - (3)].cname)); lltok_free ((yyvsp[(2) - (3)].tok)); ;} break; case 198: { (yyval.cstringlist) = (yyvsp[(1) - (4)].cstringlist); lltok_free2 ((yyvsp[(2) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 199: { (yyval.cstringlist) = cstringList_single ((yyvsp[(1) - (1)].cname)); ;} break; case 200: { (yyval.expr) = exprNode_offsetof ((yyvsp[(4) - (9)].qtyp), (yyvsp[(7) - (9)].cstringlist)); lltok_free3 ((yyvsp[(1) - (9)].tok), (yyvsp[(3) - (9)].tok), (yyvsp[(6) - (9)].tok)); lltok_free ((yyvsp[(8) - (9)].tok)); ;} break; case 201: { context_setProtectVars (); ;} break; case 202: { context_sizeofReleaseVars (); (yyval.expr) = (yyvsp[(3) - (3)].expr); ;} break; case 203: {context_enterSizeof();} break; case 204: {context_leaveSizeof();} break; case 205: { (yyval.expr) = exprNode_sizeofType ((yyvsp[(3) - (4)].qtyp)); lltok_free3 ((yyvsp[(1) - (4)].tok), (yyvsp[(2) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 206: { (yyval.expr) = exprNode_sizeofExpr ((yyvsp[(2) - (2)].expr)); lltok_free ((yyvsp[(1) - (2)].tok)); ;} break; case 207: { (yyval.expr) = exprNode_alignofType ((yyvsp[(3) - (4)].qtyp)); lltok_free3 ((yyvsp[(1) - (4)].tok), (yyvsp[(2) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 208: { (yyval.expr) = exprNode_alignofExpr ((yyvsp[(2) - (2)].expr)); lltok_free ((yyvsp[(1) - (2)].tok)); ;} break; case 210: { (yyval.expr) = exprNode_cast ((yyvsp[(1) - (4)].tok), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].qtyp)); lltok_free ((yyvsp[(3) - (4)].tok)); ;} break; case 212: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 213: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 214: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 216: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 217: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 219: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 220: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 222: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 223: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 224: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 225: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 227: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 228: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 230: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 232: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 234: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 236: { exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterAndClause ((yyvsp[(1) - (2)].expr)); ;} break; case 237: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].tok)); context_exitAndClause ((yyval.expr), (yyvsp[(4) - (4)].expr)); ;} break; case 239: { exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterOrClause ((yyvsp[(1) - (2)].expr)); ;} break; case 240: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].tok)); context_exitOrClause ((yyval.expr), (yyvsp[(4) - (4)].expr)); ;} break; case 242: { /* GCC extension: conditional with empty if */ exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 243: { context_enterFalseClause ((yyvsp[(1) - (4)].expr)); ;} break; case 244: { (yyval.expr) = exprNode_condIfOmit ((yyvsp[(1) - (6)].expr), (yyvsp[(6) - (6)].expr)); context_exitClause ((yyvsp[(1) - (6)].expr), exprNode_undefined, (yyvsp[(6) - (6)].expr)); ;} break; case 245: { exprNode_produceGuards ((yyvsp[(1) - (2)].expr)); context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 246: { context_enterFalseClause ((yyvsp[(1) - (5)].expr)); ;} break; case 247: { (yyval.expr) = exprNode_cond ((yyvsp[(1) - (7)].expr), (yyvsp[(4) - (7)].expr), (yyvsp[(7) - (7)].expr)); context_exitClause ((yyvsp[(1) - (7)].expr), (yyvsp[(4) - (7)].expr), (yyvsp[(7) - (7)].expr)); ;} break; case 249: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 250: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 251: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 252: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 253: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 254: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 255: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 256: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 257: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 258: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 259: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 261: { (yyval.expr) = exprNode_comma ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 262: { (yyval.expr) = exprNode_undefined; ;} break; case 265: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 266: { doVaDcl (); (yyval.expr) = exprNode_makeError (); ;} break; case 267: { (yyval.expr) = exprNode_makeError (); ;} break; case 268: { (yyval.expr) = exprNode_makeError (); ;} break; case 269: { setProcessingVars ((yyvsp[(1) - (4)].qtyp)); processNamedDecl ((yyvsp[(3) - (4)].ntyp)); ;} break; case 270: { unsetProcessingVars (); (yyval.expr) = exprNode_makeEmptyInitialization ((yyvsp[(3) - (9)].ntyp)); DPRINTF (("Empty initialization: %s", exprNode_unparse ((yyval.expr)))); ;} break; case 271: { setProcessingVars ((yyvsp[(1) - (5)].qtyp)); processNamedDecl ((yyvsp[(3) - (5)].ntyp)); ;} break; case 272: { (yyval.expr) = exprNode_concat ((yyvsp[(9) - (11)].expr), exprNode_makeInitialization ((yyvsp[(3) - (11)].ntyp), (yyvsp[(8) - (11)].expr))); unsetProcessingVars (); ;} break; case 273: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 274: { (yyval.expr) = exprNode_fromIdentifier (usymtab_getTypeEntry (ctype_typeId ((yyvsp[(1) - (1)].ctyp)))); ;} break; case 275: { processNamedDecl ((yyvsp[(1) - (2)].ntyp)); (yyval.expr) = exprNode_makeEmptyInitialization ((yyvsp[(1) - (2)].ntyp)); ;} break; case 276: { processNamedDecl ((yyvsp[(1) - (3)].ntyp)); ;} break; case 277: { (yyval.expr) = exprNode_makeInitialization ((yyvsp[(1) - (6)].ntyp), (yyvsp[(6) - (6)].expr)); ;} break; case 278: { setProcessingTypedef ((yyvsp[(2) - (2)].qtyp)); ;} break; case 279: { clabstract_declareType ((yyvsp[(5) - (8)].exprlist), (yyvsp[(7) - (8)].warnclause)); ;} break; case 280: { /* in the ANSI grammar, semantics unclear */ ;} break; case 281: { /* in the ANSI grammar, semantics unclear */ ;} break; case 282: { cscannerHelp_setExpectingTypeName (); ;} break; case 283: { cscannerHelp_setExpectingTypeName (); context_pushLoc (); ;} break; case 284: { (yyval.exprlist) = (yyvsp[(1) - (2)].exprlist); ;} break; case 285: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 286: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (4)].exprlist), (yyvsp[(4) - (4)].expr)); ;} break; case 287: { (yyval.exprlist) = (yyvsp[(1) - (2)].exprlist); ;} break; case 288: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 289: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (4)].exprlist), (yyvsp[(4) - (4)].expr)); ;} break; case 290: { (yyval.expr) = exprNode_makeError (); ;} break; case 291: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (4)].expr), (yyvsp[(4) - (4)].expr)); ;} break; case 293: { (yyval.expr) = exprNode_makeInitBlock ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].exprlist)); lltok_free ((yyvsp[(3) - (3)].tok)); ;} break; case 294: { (yyval.expr) = exprNode_makeInitBlock ((yyvsp[(1) - (4)].tok), (yyvsp[(2) - (4)].exprlist)); lltok_free2 ((yyvsp[(3) - (4)].tok), (yyvsp[(4) - (4)].tok)); ;} break; case 295: { (yyval.expr) = exprNode_undefined; ;} break; case 296: { (yyval.expr) = (yyvsp[(1) - (2)].expr); ;} break; case 297: { (yyval.expr) = exprNode_undefined; /* gcc extension, obsolete since 2.5 */ ;} break; case 298: { (yyval.expr) = exprNode_undefined; ;} break; case 299: { (yyval.expr) = exprNode_undefined; ;} break; case 300: { (yyval.expr) = exprNode_undefined; ;} break; case 301: { (yyval.expr) = exprNode_undefined; ;} break; case 302: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 303: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (3)].exprlist), (yyvsp[(3) - (3)].expr)); ;} break; case 304: { setStorageClass (SCEXTERN); (yyval.typequal) = qual_createExtern (); ;} break; case 305: { (yyval.typequal) = qual_createInline (); ;} break; case 306: { setStorageClass (SCSTATIC); (yyval.typequal) = qual_createStatic (); ;} break; case 307: { (yyval.typequal) = qual_createAuto (); ;} break; case 308: { (yyval.typequal) = qual_createRegister (); ;} break; case 309: { (yyval.stateclause) = (yyvsp[(1) - (2)].stateclause); ;} break; case 310: { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 311: { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); (yyval.stateclause) = stateClause_createPlain ((yyvsp[(1) - (6)].tok), (yyvsp[(4) - (6)].srset)); ;} break; case 312: { (yyval.funcclause) = (yyvsp[(1) - (2)].funcclause); ;} break; case 313: { (yyval.tok) = (yyvsp[(1) - (2)].tok); context_enterFunctionHeader (); ;} break; case 314: { context_exitFunctionHeader (); context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 315: { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); (yyval.funcclause) = functionClause_createState (stateClause_create ((yyvsp[(1) - (6)].tok), (yyvsp[(2) - (6)].typequal), (yyvsp[(4) - (6)].srset))); ;} break; case 316: { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); ;} break; case 317: { context_exitFunctionHeader (); exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); DPRINTF (("done optGlobBufConstraintsAux\n")); if (lltok_isEnsures ((yyvsp[(1) - (5)].tok))) { (yyval.funcclause) = functionClause_createEnsures ((yyvsp[(3) - (5)].fcnconstraint)); } else if (lltok_isRequires ((yyvsp[(1) - (5)].tok))) { (yyval.funcclause) = functionClause_createRequires ((yyvsp[(3) - (5)].fcnconstraint)); } else { BADBRANCH; } DPRINTF (("FunctionclauseS: %s", functionClause_unparse ((yyval.funcclause)))); ;} break; case 318: { (yyval.fcnconstraint) = functionConstraint_createBufferConstraint ((yyvsp[(1) - (1)].conL)); ;} break; case 319: { (yyval.fcnconstraint) = functionConstraint_createMetaStateConstraint ((yyvsp[(1) - (1)].msconstraint)); DPRINTF (("Made constraint: %s", functionConstraint_unparse ((yyval.fcnconstraint)))); ;} break; case 320: { (yyval.typequal) = qual_createExits (); ;} break; case 321: { (yyval.typequal) = qual_createMayExit (); ;} break; case 322: { (yyval.typequal) = qual_createTrueExit (); ;} break; case 323: { (yyval.typequal) = qual_createFalseExit (); ;} break; case 324: { (yyval.typequal) = qual_createNeverExit (); ;} break; case 325: { (yyval.typequal) = qual_createChecked (); ;} break; case 326: { (yyval.typequal) = qual_createCheckMod (); ;} break; case 327: { (yyval.typequal) = qual_createUnchecked (); ;} break; case 328: { (yyval.typequal) = qual_createCheckedStrict (); ;} break; case 329: { (yyval.typequal) = qual_createOwned (); ;} break; case 330: { (yyval.typequal) = qual_createDependent (); ;} break; case 331: { (yyval.typequal) = qual_createYield (); ;} break; case 332: { (yyval.typequal) = qual_createTemp (); ;} break; case 333: { (yyval.typequal) = qual_createOnly (); ;} break; case 334: { (yyval.typequal) = qual_createKeep (); ;} break; case 335: { (yyval.typequal) = qual_createKept (); ;} break; case 336: { (yyval.typequal) = qual_createShared (); ;} break; case 337: { (yyval.typequal) = qual_createUnique (); ;} break; case 338: { (yyval.typequal) = qual_createNull (); ;} break; case 339: { (yyval.typequal) = qual_createIsNull (); ;} break; case 340: { (yyval.typequal) = qual_createRelNull (); ;} break; case 341: { (yyval.typequal) = qual_createNotNull (); ;} break; case 342: { (yyval.typequal) = qual_createExposed (); ;} break; case 343: { (yyval.typequal) = qual_createObserver (); ;} break; case 344: { (yyval.typequal) = qual_createNullTerminated (); ;} break; case 345: { (yyval.typequal) = qual_createMetaState ((yyvsp[(1) - (1)].annotation)); ;} break; case 346: { (yyval.typequal) = qual_createReturned (); ;} break; case 347: { (yyval.typequal) = qual_createSef (); ;} break; case 348: { (yyval.typequal) = qual_createUnused (); ;} break; case 349: { (yyval.typequal) = qual_createExternal (); ;} break; case 350: { (yyval.typequal) = qual_createTrueNull (); ;} break; case 351: { (yyval.typequal) = qual_createFalseNull (); ;} break; case 352: { (yyval.typequal) = qual_createAbstract (); ;} break; case 353: { (yyval.typequal) = qual_createNumAbstract (); ;} break; case 354: { (yyval.typequal) = qual_createConcrete (); ;} break; case 355: { (yyval.typequal) = qual_createMutable (); ;} break; case 356: { (yyval.typequal) = qual_createImmutable (); ;} break; case 357: { (yyval.typequal) = qual_createRefCounted (); ;} break; case 358: { (yyval.typequal) = qual_createRefs (); ;} break; case 359: { (yyval.typequal) = qual_createKillRef (); ;} break; case 360: { (yyval.typequal) = qual_createRelDef (); ;} break; case 361: { (yyval.typequal) = qual_createNewRef (); ;} break; case 362: { (yyval.typequal) = qual_createTempRef (); ;} break; case 363: { (yyval.typequal) = qual_createShort (); ;} break; case 364: { (yyval.typequal) = qual_createLong (); ;} break; case 365: { (yyval.typequal) = qual_createSigned (); ;} break; case 366: { (yyval.typequal) = qual_createUnsigned (); ;} break; case 367: { (yyval.typequal) = qual_createOut (); ;} break; case 368: { (yyval.typequal) = qual_createIn (); ;} break; case 369: { (yyval.typequal) = qual_createPartial (); ;} break; case 370: { (yyval.typequal) = qual_createSpecial (); ;} break; case 371: { (yyval.typequal) = qual_createConst (); ;} break; case 372: { (yyval.typequal) = qual_createVolatile (); ;} break; case 373: { (yyval.typequal) = qual_createRestrict (); ;} break; case 374: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 375: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 376: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 377: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 378: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 379: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 380: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 381: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 382: { (yyval.typequal) = (yyvsp[(1) - (2)].typequal); ;} break; case 389: { (yyval.ctyp) = ctype_makeAnytype (); ;} break; case 390: { (yyval.ctyp) = ctype_anyintegral; ;} break; case 391: { (yyval.ctyp) = ctype_unsignedintegral; ;} break; case 392: { (yyval.ctyp) = ctype_signedintegral; ;} break; case 396: { (yyval.ctyp) = ctype_fromQual ((yyvsp[(1) - (2)].typequal)); ;} break; case 397: { (yyval.qtyp) = qtype_resolve ((yyvsp[(2) - (3)].qtyp)); ;} break; case 398: { (yyval.qtyp) = (yyvsp[(1) - (1)].qtyp); ;} break; case 399: { (yyval.qtyp) = qtype_mergeAlt ((yyvsp[(1) - (4)].qtyp), (yyvsp[(3) - (4)].qtyp)); ;} break; case 401: { (yyval.qtyp) = qtype_mergeAlt ((yyvsp[(1) - (3)].qtyp), (yyvsp[(3) - (3)].qtyp)); ;} break; case 402: { (yyval.qtyp) = qtype_addQual ((yyvsp[(2) - (2)].qtyp), (yyvsp[(1) - (2)].typequal)); ;} break; case 403: { (yyval.qtyp) = qtype_addQual ((yyvsp[(2) - (2)].qtyp), (yyvsp[(1) - (2)].typequal)); ;} break; case 404: { (yyval.qtyp) = qtype_combine ((yyvsp[(2) - (2)].qtyp), (yyvsp[(1) - (2)].ctyp)); ;} break; case 405: { (yyval.qtyp) = qtype_unknown (); ;} break; case 406: { (yyval.qtyp) = (yyvsp[(1) - (1)].qtyp); ;} break; case 407: { (yyval.conL) = constraintList_undefined; ;} break; case 408: { sRef_setGlobalScopeSafe (); ;} break; case 409: { sRef_clearGlobalScopeSafe (); ;} break; case 410: { ctype ct; ct = declareStruct ((yyvsp[(3) - (12)].cname), (yyvsp[(8) - (12)].flist)); /* context_setGlobalStructInfo(ct, $12); */ (yyval.ctyp) = ct; ;} break; case 411: { sRef_setGlobalScopeSafe (); ;} break; case 412: { sRef_clearGlobalScopeSafe (); ;} break; case 413: { (yyval.ctyp) = declareUnion ((yyvsp[(3) - (11)].cname), (yyvsp[(8) - (11)].flist)); ;} break; case 414: { (yyval.ctyp) = declareStruct ((yyvsp[(3) - (6)].cname), uentryList_new ()); ;} break; case 415: { (yyval.ctyp) = declareUnion ((yyvsp[(3) - (6)].cname), uentryList_new ()); ;} break; case 416: { sRef_setGlobalScopeSafe (); ;} break; case 417: { sRef_clearGlobalScopeSafe (); ;} break; case 418: { (yyval.ctyp) = declareUnnamedStruct ((yyvsp[(7) - (10)].flist)); ;} break; case 419: { sRef_setGlobalScopeSafe (); ;} break; case 420: { sRef_clearGlobalScopeSafe (); ;} break; case 421: { (yyval.ctyp) = declareUnnamedUnion ((yyvsp[(7) - (10)].flist)); ;} break; case 422: { (yyval.ctyp) = ctype_createUnnamedStruct (uentryList_new ()); ;} break; case 423: { (yyval.ctyp) = ctype_createUnnamedUnion (uentryList_new ()); ;} break; case 424: { (yyval.ctyp) = handleStruct ((yyvsp[(3) - (4)].cname)); ;} break; case 425: { (yyval.ctyp) = handleUnion ((yyvsp[(3) - (4)].cname)); ;} break; case 426: { cscannerHelp_clearExpectingTypeName (); ;} break; case 428: { (yyval.flist) = uentryList_undefined; /* bogus! */ ;} break; case 429: { (yyval.flist) = uentryList_mergeFields ((yyvsp[(1) - (2)].flist), (yyvsp[(2) - (2)].flist)); ;} break; case 430: { (yyval.flist) = fixUentryList ((yyvsp[(3) - (5)].ntyplist), (yyvsp[(1) - (5)].qtyp)); ;} break; case 431: { (yyval.flist) = fixUnnamedDecl ((yyvsp[(1) - (3)].qtyp)); ;} break; case 432: { (yyval.ntyplist) = idDeclList_singleton ((yyvsp[(1) - (2)].ntyp)); ;} break; case 433: { (yyval.ntyplist) = idDeclList_add ((yyvsp[(1) - (4)].ntyplist), (yyvsp[(3) - (4)].ntyp)); ;} break; case 434: { (yyval.ntyp) = (yyvsp[(1) - (1)].ntyp); ;} break; case 435: { (yyval.ntyp) = idDecl_undefined; ;} break; case 436: { (yyval.ntyp) = (yyvsp[(1) - (4)].ntyp); ;} break; case 437: { (yyval.ctyp) = declareUnnamedEnum ((yyvsp[(4) - (6)].enumnamelist)); ;} break; case 438: { context_pushLoc (); ;} break; case 439: { context_popLoc (); (yyval.ctyp) = declareEnum ((yyvsp[(3) - (8)].cname), (yyvsp[(6) - (8)].enumnamelist)); ;} break; case 440: { (yyval.ctyp) = handleEnum ((yyvsp[(3) - (4)].cname)); ;} break; case 441: { (yyval.enumnamelist) = enumNameList_single ((yyvsp[(1) - (1)].cname)); ;} break; case 442: { (yyval.enumnamelist) = enumNameList_push ((yyvsp[(1) - (3)].enumnamelist), (yyvsp[(3) - (3)].cname)); ;} break; case 444: { uentry ue = uentry_makeEnumConstant ((yyvsp[(1) - (1)].cname), ctype_unknown); usymtab_supGlobalEntry (ue); (yyval.cname) = (yyvsp[(1) - (1)].cname); ;} break; case 445: { uentry ue = uentry_makeEnumInitializedConstant ((yyvsp[(1) - (4)].cname), ctype_unknown, (yyvsp[(4) - (4)].expr)); usymtab_supGlobalEntry (ue); (yyval.cname) = (yyvsp[(1) - (4)].cname); ;} break; case 447: { (yyval.ntyp) = idDecl_create (cstring_undefined, qtype_create ((yyvsp[(1) - (1)].ctyp))); ;} break; case 448: { qtype qt = qtype_unknown (); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), qt); (yyval.ntyp) = idDecl_create (cstring_copy (cscannerHelp_observeLastIdentifier ()), qt); ;} break; case 449: { (yyval.ntyp) = (yyvsp[(2) - (2)].ntyp); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), idDecl_getTyp ((yyval.ntyp))); ;} break; case 451: { (yyval.ntyp) = (yyvsp[(2) - (2)].ntyp); qtype_adjustPointers ((yyvsp[(1) - (2)].pointers), idDecl_getTyp ((yyval.ntyp))); ;} break; case 452: { (yyval.entrylist) = handleParamTypeList ((yyvsp[(1) - (1)].entrylist)); ;} break; case 453: { (yyval.entrylist) = handleParamIdList ((yyvsp[(2) - (2)].entrylist)); ;} break; case 454: { (yyval.typequal) = qual_createConst (); ;} break; case 455: { (yyval.typequal) = qual_createRestrict (); ;} break; case 456: { (yyval.typequal) = qual_createVolatile (); ;} break; case 457: { (yyval.tquallist) = qualList_single ((yyvsp[(1) - (1)].typequal)); ;} break; case 458: { (yyval.tquallist) = qualList_add ((yyvsp[(1) - (2)].tquallist), (yyvsp[(2) - (2)].typequal)); ;} break; case 459: { (yyval.pointers) = pointers_create ((yyvsp[(1) - (1)].tok)); ;} break; case 460: { (yyval.pointers) = pointers_createMods ((yyvsp[(1) - (2)].tok), (yyvsp[(2) - (2)].tquallist)); ;} break; case 461: { (yyval.pointers) = pointers_extend (pointers_create ((yyvsp[(1) - (2)].tok)), (yyvsp[(2) - (2)].pointers)); ;} break; case 462: { (yyval.pointers) = pointers_extend (pointers_createMods ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].tquallist)), (yyvsp[(3) - (3)].pointers)); ;} break; case 464: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (3)].entrylist), uentry_makeElipsisMarker ()); ;} break; case 465: { (yyval.entrylist) = uentryList_single (uentry_makeVariableLoc ((yyvsp[(1) - (1)].cname), ctype_int)); ;} break; case 466: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (3)].entrylist), uentry_makeVariableLoc ((yyvsp[(3) - (3)].cname), ctype_int)); ;} break; case 467: { (yyval.entrylist) = uentryList_single (uentry_makeElipsisMarker ()); ;} break; case 469: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (3)].entrylist), uentry_makeElipsisMarker ()); ;} break; case 470: { storeLoc (); ;} break; case 471: { (yyval.entrylist) = uentryList_single ((yyvsp[(2) - (2)].oentry)); ;} break; case 472: { storeLoc (); ;} break; case 473: { (yyval.entrylist) = uentryList_add ((yyvsp[(1) - (4)].entrylist), (yyvsp[(4) - (4)].oentry)); ;} break; case 474: { if (isFlipOldStyle ()) { llparseerror (cstring_makeLiteral ("Inconsistent function parameter syntax (mixing old and new style declaration)")); } else { setNewStyle (); } (yyval.oentry) = makeCurrentParam (idDecl_fixParamBase ((yyvsp[(3) - (4)].ntyp), (yyvsp[(2) - (4)].qtyp))); ;} break; case 475: { idDecl tparam = idDecl_create ((yyvsp[(1) - (1)].cname), qtype_unknown ()); if (isNewStyle ()) { llparseerror (message ("Inconsistent function parameter syntax: %q", idDecl_unparse (tparam))); } setFlipOldStyle (); (yyval.oentry) = makeCurrentParam (tparam); idDecl_free (tparam); ;} break; case 477: { (yyval.qtyp) = qtype_newBase ((yyvsp[(1) - (2)].qtyp), (yyvsp[(2) - (2)].ctyp)); ;} break; case 478: { (yyval.ctyp) = ctype_adjustPointers ((yyvsp[(1) - (1)].pointers), ctype_unknown); ;} break; case 480: { (yyval.ctyp) = ctype_adjustPointers ((yyvsp[(1) - (2)].pointers), (yyvsp[(2) - (2)].ctyp)); ;} break; case 481: { (yyval.ctyp) = ctype_unknown; ;} break; case 483: { (yyval.ctyp) = ctype_expectFunction ((yyvsp[(4) - (5)].ctyp)); ;} break; case 484: { (yyval.ctyp) = ctype_makeArray (ctype_unknown); ;} break; case 485: { (yyval.ctyp) = ctype_makeFixedArray (ctype_unknown, exprNode_getLongValue ((yyvsp[(2) - (3)].expr))); ;} break; case 486: { (yyval.ctyp) = ctype_makeInnerArray ((yyvsp[(1) - (3)].ctyp)); ;} break; case 487: { (yyval.ctyp) = ctype_makeInnerFixedArray ((yyvsp[(1) - (4)].ctyp), exprNode_getLongValue ((yyvsp[(3) - (4)].expr))); ;} break; case 488: { (yyval.ctyp) = ctype_makeFunction (ctype_unknown, uentryList_makeMissingParams ()); ;} break; case 489: { (yyval.ctyp) = ctype_makeParamsFunction (ctype_unknown, (yyvsp[(3) - (4)].entrylist)); ;} break; case 490: { (yyval.ctyp) = ctype_makeFunction ((yyvsp[(1) - (4)].ctyp), uentryList_makeMissingParams ()); ;} break; case 491: { (yyval.ctyp) = ctype_makeParamsFunction ((yyvsp[(1) - (5)].ctyp), (yyvsp[(4) - (5)].entrylist)); ;} break; case 502: { exprNode_revealState ((yyvsp[(3) - (4)].expr)); (yyval.expr) = exprNode_undefined; ;} break; case 503: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 506: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 507: { (yyval.expr) = exprNode_while ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 508: { (yyval.expr) = exprNode_doWhile ((yyvsp[(2) - (7)].expr), (yyvsp[(5) - (7)].expr)); ;} break; case 509: { (yyval.expr) = exprNode_doWhile ((yyvsp[(2) - (6)].expr), (yyvsp[(5) - (6)].expr)); ;} break; case 510: { (yyval.expr) = exprNode_for ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 511: { context_setProtectVars (); ;} break; case 512: { context_sizeofReleaseVars (); ;} break; case 513: { (yyval.expr) = exprNode_forPred ((yyvsp[(3) - (10)].expr), (yyvsp[(5) - (10)].expr), (yyvsp[(8) - (10)].expr)); context_enterForClause ((yyvsp[(5) - (10)].expr)); ;} break; case 514: { setProcessingIterVars ((yyvsp[(1) - (3)].entry)); ;} break; case 515: { (yyval.expr) = exprNode_iterStart ((yyvsp[(1) - (6)].entry), (yyvsp[(5) - (6)].exprlist)); ;} break; case 516: { (yyval.expr) = exprNode_createId ((yyvsp[(1) - (1)].entry)); ;} break; case 520: { (yyval.expr) = (yyvsp[(1) - (2)].expr); DPRINTF (("def stmt: %s", exprNode_unparse ((yyval.expr)))); ;} break; case 528: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 529: { (yyval.expr) = exprNode_makeError (); ;} break; case 530: { exprNode_checkIfPred ((yyvsp[(1) - (1)].expr)); ;} break; case 531: { /* don't: context_exitTrueClause ($1, $2); */ (yyval.expr) = exprNode_if ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 532: { (yyval.expr) = exprNode_createTok ((yyvsp[(2) - (2)].tok)); ;} break; case 533: { (yyval.expr) = exprNode_createTok ((yyvsp[(2) - (2)].tok)); ;} break; case 544: { (yyval.expr) = exprNode_addParens ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].expr)); ;} break; case 547: { (yyval.expr) = exprNode_makeError (); ;} break; case 548: { (yyval.expr) = exprNode_labelMarker ((yyvsp[(1) - (2)].cname)); ;} break; case 549: { (yyval.expr) = exprNode_notReached ((yyvsp[(2) - (2)].expr)); ;} break; case 550: { ; ;} break; case 551: { ; ;} break; case 552: { context_enterCaseClause ((yyvsp[(2) - (2)].expr)); ;} break; case 553: { (yyval.expr) = exprNode_caseMarker ((yyvsp[(2) - (4)].expr), FALSE); ;} break; case 554: { context_enterCaseClause ((yyvsp[(4) - (4)].expr)); ;} break; case 555: { (yyval.expr) = exprNode_caseMarker ((yyvsp[(4) - (6)].expr), TRUE); ;} break; case 556: { context_enterCaseClause (exprNode_undefined); ;} break; case 557: { (yyval.expr) = exprNode_defaultMarker ((yyvsp[(1) - (3)].tok), FALSE); ;} break; case 558: { context_enterCaseClause (exprNode_undefined); ;} break; case 559: { (yyval.expr) = exprNode_defaultMarker ((yyvsp[(3) - (5)].tok), TRUE); ;} break; case 560: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 561: { (yyval.expr) = (yyvsp[(2) - (2)].expr); context_exitInner ((yyvsp[(2) - (2)].expr)); ;} break; case 562: { (yyval.expr) = (yyvsp[(2) - (3)].expr); ;} break; case 563: { context_enterInnerContext (); ;} break; case 564: { context_exitInnerPlain (); ;} break; case 565: { context_enterStructInnerContext (); ;} break; case 566: { context_exitStructInnerContext (); ;} break; case 567: { context_exitInnerSafe (); ;} break; case 568: { (yyval.expr) = exprNode_createTok ((yyvsp[(1) - (1)].tok)); ;} break; case 569: { (yyval.expr) = exprNode_notReached (exprNode_createTok ((yyvsp[(2) - (2)].tok))); ;} break; case 570: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(1) - (2)].expr), lltok_getLoc ((yyvsp[(2) - (2)].tok))); ;} break; case 571: { (yyval.expr) = exprNode_notReached (exprNode_updateLocation ((yyvsp[(1) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok)))); ;} break; case 572: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(1) - (2)].expr), lltok_getLoc ((yyvsp[(2) - (2)].tok))); ;} break; case 573: { (yyval.expr) = exprNode_notReached (exprNode_updateLocation ((yyvsp[(1) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok)))); ;} break; case 574: { (yyval.expr) = exprNode_updateLocation (exprNode_concat ((yyvsp[(1) - (3)].expr), (yyvsp[(2) - (3)].expr)), lltok_getLoc ((yyvsp[(3) - (3)].tok))); ;} break; case 575: { (yyval.expr) = exprNode_notReached (exprNode_updateLocation (exprNode_concat ((yyvsp[(1) - (4)].expr), (yyvsp[(2) - (4)].expr)), lltok_getLoc ((yyvsp[(3) - (4)].tok)))); ;} break; case 576: { (yyval.expr) = exprNode_makeBlock ((yyvsp[(2) - (2)].expr)); ;} break; case 577: { (yyval.expr) = exprNode_createTok ((yyvsp[(2) - (2)].tok)); ;} break; case 578: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(2) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok))); ;} break; case 579: { (yyval.expr) = exprNode_updateLocation ((yyvsp[(2) - (3)].expr), lltok_getLoc ((yyvsp[(3) - (3)].tok))); ;} break; case 580: { (yyval.expr) = exprNode_updateLocation (exprNode_concat ((yyvsp[(2) - (4)].expr), (yyvsp[(3) - (4)].expr)), lltok_getLoc ((yyvsp[(4) - (4)].tok))); ;} break; case 582: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 583: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 584: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 585: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 586: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr)); ;} break; case 587: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 588: { (yyval.expr) = (yyvsp[(2) - (4)].expr); ;} break; case 589: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 590: { (yyval.expr) = exprNode_concat ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 591: { (yyval.expr) = exprNode_createTok ((yyvsp[(1) - (1)].tok)); ;} break; case 592: { (yyval.expr) = exprNode_statement ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 593: { (yyval.expr) = exprNode_createTok ((yyvsp[(1) - (1)].tok)); ;} break; case 594: { (yyval.expr) = exprNode_statement ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 595: { (yyval.expr) = exprNode_checkExpr ((yyvsp[(1) - (1)].expr)); ;} break; case 596: { exprNode_produceGuards ((yyvsp[(3) - (4)].expr)); context_enterTrueClause ((yyvsp[(3) - (4)].expr)); exprNode_checkIfPred ((yyvsp[(3) - (4)].expr)); (yyval.expr) = (yyvsp[(3) - (4)].expr); ;} break; case 597: { context_exitTrueClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); (yyval.expr) = exprNode_if ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 598: { context_enterFalseClause ((yyvsp[(1) - (3)].expr)); ;} break; case 599: { context_exitClause ((yyvsp[(1) - (5)].expr), (yyvsp[(2) - (5)].expr), (yyvsp[(5) - (5)].expr)); (yyval.expr) = exprNode_ifelse ((yyvsp[(1) - (5)].expr), (yyvsp[(2) - (5)].expr), (yyvsp[(5) - (5)].expr)); ;} break; case 600: { context_enterSwitch ((yyvsp[(3) - (3)].expr)); ;} break; case 601: { (yyval.expr) = exprNode_switch ((yyvsp[(3) - (6)].expr), (yyvsp[(6) - (6)].expr)); ;} break; case 602: { (yyval.expr) = exprNode_whilePred ((yyvsp[(3) - (4)].expr)); context_enterWhileClause ((yyvsp[(3) - (4)].expr)); ;} break; case 603: { (yyval.expr) = exprNode_whilePred((yyvsp[(3) - (4)].expr)); ;} break; case 604: { context_enterIterClause (); ;} break; case 605: { setProcessingIterVars ((yyvsp[(1) - (4)].entry)); ;} break; case 606: { (yyval.expr) = exprNode_iter ((yyvsp[(1) - (10)].entry), (yyvsp[(6) - (10)].exprlist), (yyvsp[(8) - (10)].expr), (yyvsp[(9) - (10)].entry)); ;} break; case 607: { (yyval.exprlist) = exprNodeList_singleton ((yyvsp[(1) - (1)].expr)); ;} break; case 608: { nextIterParam (); ;} break; case 609: { (yyval.exprlist) = exprNodeList_push ((yyvsp[(1) - (4)].exprlist), (yyvsp[(4) - (4)].expr)); ;} break; case 610: { (yyval.expr) = exprNode_iterExpr ((yyvsp[(1) - (1)].expr)); ;} break; case 611: { (yyval.expr) = exprNode_iterId ((yyvsp[(1) - (1)].entry)); ;} break; case 612: { uentry ue = cscannerHelp_coerceIterId ((yyvsp[(1) - (1)].cname)); if (uentry_isValid (ue)) { (yyval.expr) = exprNode_iterId (ue); } else { (yyval.expr) = exprNode_iterNewId (cstring_copy (cscannerHelp_observeLastIdentifier ())); } ;} break; case 613: { (yyval.expr) = exprNode_iterNewId ((yyvsp[(1) - (1)].cname)); ;} break; case 615: { (yyval.expr) = exprNode_combineLiterals ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 617: { (yyval.expr) = exprNode_addParens ((yyvsp[(1) - (3)].tok), (yyvsp[(2) - (3)].expr)); ;} break; case 619: { (yyval.expr) = exprNode_arrayFetch ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].expr)); ;} break; case 620: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (3)].expr), exprNodeList_new ()); ;} break; case 621: { (yyval.expr) = exprNode_functionCall ((yyvsp[(1) - (4)].expr), (yyvsp[(3) - (4)].exprlist)); ;} break; case 622: { (yyval.expr) = exprNode_vaArg ((yyvsp[(1) - (6)].tok), (yyvsp[(3) - (6)].expr), (yyvsp[(5) - (6)].qtyp)); ;} break; case 623: { (yyval.expr) = exprNode_fieldAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 624: { (yyval.expr) = exprNode_arrowAccess ((yyvsp[(1) - (5)].expr), (yyvsp[(3) - (5)].tok), (yyvsp[(4) - (5)].cname)); ;} break; case 625: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 626: { (yyval.expr) = exprNode_postOp ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].tok)); ;} break; case 628: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 629: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 630: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 631: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 632: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 633: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 634: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 635: { (yyval.expr) = exprNode_preOp ((yyvsp[(2) - (2)].expr), (yyvsp[(1) - (2)].tok)); ;} break; case 636: { (yyval.expr) = (yyvsp[(1) - (1)].expr); ;} break; case 638: { (yyval.expr) = exprNode_cast ((yyvsp[(1) - (4)].tok), (yyvsp[(4) - (4)].expr), (yyvsp[(2) - (4)].qtyp)); ;} break; case 640: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 641: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 642: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 644: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 645: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 647: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 648: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 650: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 651: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 652: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 653: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 655: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 656: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 658: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 660: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 662: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 664: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 666: { (yyval.expr) = exprNode_op ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 668: { context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 669: { context_enterFalseClause ((yyvsp[(1) - (4)].expr)); ;} break; case 670: { (yyval.expr) = exprNode_condIfOmit ((yyvsp[(1) - (6)].expr), (yyvsp[(6) - (6)].expr)); ;} break; case 671: { context_enterTrueClause ((yyvsp[(1) - (2)].expr)); ;} break; case 672: { context_enterFalseClause ((yyvsp[(1) - (5)].expr)); ;} break; case 673: { (yyval.expr) = exprNode_cond ((yyvsp[(1) - (7)].expr), (yyvsp[(4) - (7)].expr), (yyvsp[(7) - (7)].expr)); ;} break; case 675: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 676: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 677: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 678: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 679: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 680: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 681: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 682: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 683: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 684: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 685: { (yyval.expr) = exprNode_assign ((yyvsp[(1) - (3)].expr), (yyvsp[(3) - (3)].expr), (yyvsp[(2) - (3)].tok)); ;} break; case 686: { (yyval.entry) = (yyvsp[(1) - (1)].entry); ;} break; case 687: { (yyval.entry) = uentry_undefined; ;} break; case 688: { context_enterDoWhileClause (); (yyval.tok) = (yyvsp[(1) - (1)].tok); ;} break; case 689: { (yyval.expr) = exprNode_while ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitWhileClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 690: { (yyval.expr) = exprNode_statement (exprNode_doWhile ((yyvsp[(2) - (7)].expr), (yyvsp[(5) - (7)].expr)), (yyvsp[(7) - (7)].tok)); ;} break; case 691: { (yyval.expr) = exprNode_for ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitForClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 692: { (yyval.expr) = exprNode_while ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitWhileClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 693: { (yyval.expr) = exprNode_statement (exprNode_doWhile ((yyvsp[(2) - (7)].expr), (yyvsp[(5) - (7)].expr)), (yyvsp[(7) - (7)].tok)); ;} break; case 694: { (yyval.expr) = exprNode_doWhile ((yyvsp[(2) - (6)].expr), (yyvsp[(5) - (6)].expr)); ;} break; case 695: { (yyval.expr) = exprNode_for ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); context_exitForClause ((yyvsp[(1) - (2)].expr), (yyvsp[(2) - (2)].expr)); ;} break; case 696: { (yyval.expr) = exprNode_goto ((yyvsp[(2) - (3)].cname)); ;} break; case 697: { (yyval.expr) = exprNode_continue ((yyvsp[(1) - (2)].tok), BADTOK); ;} break; case 698: { (yyval.expr) = exprNode_continue ((yyvsp[(1) - (3)].tok), QINNERCONTINUE); ;} break; case 699: { (yyval.expr) = exprNode_break ((yyvsp[(1) - (2)].tok), BADTOK); ;} break; case 700: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QSWITCHBREAK); ;} break; case 701: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QLOOPBREAK); ;} break; case 702: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QINNERBREAK); ;} break; case 703: { (yyval.expr) = exprNode_break ((yyvsp[(2) - (3)].tok), QSAFEBREAK); ;} break; case 704: { (yyval.expr) = exprNode_nullReturn ((yyvsp[(1) - (2)].tok)); ;} break; case 705: { (yyval.expr) = exprNode_return ((yyvsp[(2) - (3)].expr)); ;} break; case 707: { ; ;} break; case 709: { ; ;} break; case 712: { (yyval.cname) = uentry_getName ((yyvsp[(1) - (1)].entry)); ;} break; case 713: { (yyval.cname) = uentry_getName ((yyvsp[(1) - (1)].entry)); ;} break; case 714: { (yyval.cname) = uentry_getName ((yyvsp[(1) - (1)].entry)); ;} break; case 715: { (yyval.cname) = (yyvsp[(1) - (1)].cname); ;} break; case 717: { (yyval.ctyp) = ctype_unknown; ;} break; case 718: { (yyval.ctyp) = exprNode_getType ((yyvsp[(3) - (4)].expr)); exprNode_free ((yyvsp[(3) - (4)].expr)); ;} break; case 719: { (yyval.ctyp) = qtype_getType ((yyvsp[(3) - (4)].qtyp)); ;} break; /* Line 1267 of yacc.c. */ default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } /*@-redecl@*/ /*@-namechecks@*/ extern char *yytext; /*@=redecl@*/ /*@=namechecks@*/ # include "bison.reset" void yyerror (/*@unused@*/ char *s) { static bool givehint = FALSE; if (context_inIterDef ()) { llerror (FLG_SYNTAX, message ("Iter syntax not parseable: %s", context_inFunctionName ())); } else if (context_inIterEnd ()) { llerror (FLG_SYNTAX, message ("Iter finalizer syntax not parseable: %s", context_inFunctionName ())); } else if (context_inMacro ()) { llerror (FLG_SYNTAX, message ("Macro syntax not parseable: %s", context_inFunctionName ())); if (context_inUnknownMacro ()) { if (!givehint) { llhint (cstring_makeLiteral ("Precede macro definition with /*@notfunction@*/ " "to suppress checking and force expansion")); givehint = TRUE; } } cscannerHelp_swallowMacro (); context_exitAllClausesQuiet (); } else { llparseerror (cstring_undefined); } } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/mtgrammar.c.der0000644021234200000250000014311310102766473015147 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /* < end of bison.head > */ /* A Bison parser, made from mtgrammar.y by GNU bison 1.35. */ #define YYBISON 1 /* Identify Bison output. */ #define yyparse mtparse #define yylex mtlex #define yyerror mterror #define yylval mtlval #define yychar mtchar #define yydebug mtdebug #define yynerrs mtnerrs # define MT_BADTOK 257 # define MT_END 258 # define MT_STATE 259 # define MT_GLOBAL 260 # define MT_CONTEXT 261 # define MT_ONEOF 262 # define MT_DEFAULTS 263 # define MT_DEFAULT 264 # define MT_REFERENCE 265 # define MT_PARAMETER 266 # define MT_RESULT 267 # define MT_CLAUSE 268 # define MT_LITERAL 269 # define MT_NULL 270 # define MT_ANNOTATIONS 271 # define MT_ARROW 272 # define MT_MERGE 273 # define MT_TRANSFERS 274 # define MT_PRECONDITIONS 275 # define MT_POSTCONDITIONS 276 # define MT_LOSEREFERENCE 277 # define MT_AS 278 # define MT_ERROR 279 # define MT_PLUS 280 # define MT_STAR 281 # define MT_BAR 282 # define MT_LPAREN 283 # define MT_RPAREN 284 # define MT_LBRACKET 285 # define MT_RBRACKET 286 # define MT_LBRACE 287 # define MT_RBRACE 288 # define MT_COMMA 289 # define MT_CHAR 290 # define MT_INT 291 # define MT_FLOAT 292 # define MT_DOUBLE 293 # define MT_VOID 294 # define MT_ANYTYPE 295 # define MT_INTEGRALTYPE 296 # define MT_UNSIGNEDINTEGRALTYPE 297 # define MT_SIGNEDINTEGRALTYPE 298 # define MT_CONST 299 # define MT_VOLATILE 300 # define MT_RESTRICT 301 # define MT_STRINGLIT 302 # define MT_IDENT 303 # include "bison.reset" # include "splintMacros.nf" # include "basic.h" # ifndef S_SPLINT_S extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ; # endif /*@i523@*/ /* can't include these here # include "mtgrammar.h" # include "mtscanner.h" */ static /*@noreturn@*/ void mterror (char *); /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ extern int mtlex () ; static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); /*@=noparams@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) # define YYDEBUG 1 # include "bison.head" #ifndef YYSTYPE typedef union { mttok tok; mtDeclarationNode mtdecl; mtDeclarationPiece mtpiece; mtDeclarationPieces mtpieces; mtContextNode mtcontext; mtValuesNode mtvalues; mtDefaultsNode mtdefaults; mtDefaultsDeclList mtdeflist; mtAnnotationsNode mtannotations; mtAnnotationList mtannotlist; mtAnnotationDecl mtannotdecl; mtMergeNode mtmerge; mtMergeItem mtmergeitem; mtMergeClauseList mtmergeclauselist; mtMergeClause mtmergeclause; mtTransferClauseList mttransferclauselist; mtTransferClause mttransferclause; mtTransferAction mttransferaction; mtLoseReferenceList mtlosereferencelist; mtLoseReference mtlosereference; pointers pointers; /*@only@*/ cstringList cstringlist; ctype ctyp; /*@only@*/ qtype qtyp; qual qual; qualList quals; } yystype; # define YYSTYPE yystype # define YYSTYPE_IS_TRIVIAL 1 #endif #ifndef YYDEBUG # define YYDEBUG 1 #endif #define YYFINAL 136 #define YYFLAG -32768 #define YYNTBASE 50 /* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */ #define YYTRANSLATE(x) ((unsigned)(x) <= 303 ? yytranslate[x] : 93) /* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */ static const char yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49 }; #if YYDEBUG static const short yyprhs[] = { 0, 0, 1, 3, 7, 12, 15, 16, 19, 21, 23, 25, 27, 29, 31, 33, 35, 37, 39, 42, 43, 45, 48, 51, 54, 57, 60, 63, 64, 66, 68, 71, 73, 77, 80, 81, 83, 85, 87, 90, 92, 95, 98, 102, 104, 106, 108, 110, 113, 117, 120, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 149, 151, 155, 158, 161, 165, 170, 173, 175, 178, 183, 186, 188, 191, 197, 199, 201, 204, 207, 210, 213, 215, 218, 222, 224, 227, 233, 235, 237, 239, 242 }; static const short yyrhs[] = { -1, 51, 0, 5, 52, 4, 0, 6, 5, 52, 4, 0, 49, 53, 0, 0, 54, 53, 0, 55, 0, 70, 0, 73, 0, 72, 0, 75, 0, 78, 0, 84, 0, 82, 0, 83, 0, 85, 0, 7, 57, 0, 0, 57, 0, 12, 58, 0, 11, 58, 0, 13, 58, 0, 14, 58, 0, 15, 58, 0, 16, 58, 0, 0, 59, 0, 60, 0, 60, 63, 0, 61, 0, 60, 28, 59, 0, 68, 62, 0, 0, 60, 0, 64, 0, 67, 0, 64, 67, 0, 27, 0, 27, 66, 0, 27, 64, 0, 27, 66, 64, 0, 45, 0, 46, 0, 47, 0, 65, 0, 66, 65, 0, 29, 63, 30, 0, 31, 32, 0, 67, 31, 32, 0, 36, 0, 37, 0, 38, 0, 39, 0, 40, 0, 41, 0, 42, 0, 43, 0, 44, 0, 69, 0, 49, 0, 8, 71, 0, 49, 0, 49, 35, 71, 0, 10, 92, 0, 9, 74, 0, 57, 18, 92, 0, 57, 18, 92, 74, 0, 17, 76, 0, 77, 0, 77, 76, 0, 49, 56, 18, 92, 0, 19, 79, 0, 80, 0, 80, 79, 0, 81, 26, 81, 18, 90, 0, 92, 0, 27, 0, 21, 88, 0, 22, 88, 0, 20, 88, 0, 23, 86, 0, 87, 0, 87, 86, 0, 92, 18, 91, 0, 89, 0, 89, 88, 0, 92, 24, 92, 18, 90, 0, 92, 0, 91, 0, 25, 0, 25, 48, 0, 49, 0 }; #endif #if YYDEBUG /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const short yyrline[] = { 0, 160, 161, 165, 167, 172, 177, 178, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 196, 201, 202, 206, 207, 208, 209, 210, 211, 219, 220, 224, 225, 229, 230, 235, 239, 240, 244, 245, 246, 250, 251, 252, 253, 257, 258, 259, 263, 264, 268, 269, 270, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 294, 298, 302, 303, 308, 312, 316, 318, 323, 327, 328, 333, 338, 342, 343, 347, 352, 353, 357, 361, 365, 369, 373, 374, 378, 382, 383, 387, 392, 393, 397, 398, 402 }; #endif #if (YYDEBUG) || defined YYERROR_VERBOSE /* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */ static const char *const yytname[] = { "$", "error", "$undefined.", "MT_BADTOK", "MT_END", "MT_STATE", "MT_GLOBAL", "MT_CONTEXT", "MT_ONEOF", "MT_DEFAULTS", "MT_DEFAULT", "MT_REFERENCE", "MT_PARAMETER", "MT_RESULT", "MT_CLAUSE", "MT_LITERAL", "MT_NULL", "MT_ANNOTATIONS", "MT_ARROW", "MT_MERGE", "MT_TRANSFERS", "MT_PRECONDITIONS", "MT_POSTCONDITIONS", "MT_LOSEREFERENCE", "MT_AS", "MT_ERROR", "MT_PLUS", "MT_STAR", "MT_BAR", "MT_LPAREN", "MT_RPAREN", "MT_LBRACKET", "MT_RBRACKET", "MT_LBRACE", "MT_RBRACE", "MT_COMMA", "MT_CHAR", "MT_INT", "MT_FLOAT", "MT_DOUBLE", "MT_VOID", "MT_ANYTYPE", "MT_INTEGRALTYPE", "MT_UNSIGNEDINTEGRALTYPE", "MT_SIGNEDINTEGRALTYPE", "MT_CONST", "MT_VOLATILE", "MT_RESTRICT", "MT_STRINGLIT", "MT_IDENT", "file", "mtsDeclaration", "declarationNode", "declarationPieces", "declarationPiece", "contextDeclaration", "optContextSelection", "contextSelection", "optType", "typeExpression", "completeType", "completeTypeAux", "optCompleteType", "abstractDecl", "pointers", "innerMods", "innerModsList", "abstractDeclBase", "typeSpecifier", "typeName", "valuesDeclaration", "valuesList", "defaultNode", "defaultsDeclaration", "defaultDeclarationList", "annotationsDeclaration", "annotationsDeclarationList", "annotationDeclaration", "mergeDeclaration", "mergeClauses", "mergeClause", "mergeItem", "preconditionsDeclaration", "postconditionsDeclaration", "transfersDeclaration", "loseReferenceDeclaration", "lostClauses", "lostClause", "transferClauses", "transferClause", "transferAction", "errorAction", "valueChoice", 0 }; #endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const short yyr1[] = { 0, 50, 50, 51, 51, 52, 53, 53, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54, 55, 56, 56, 57, 57, 57, 57, 57, 57, 58, 58, 59, 59, 60, 60, 61, 62, 62, 63, 63, 63, 64, 64, 64, 64, 65, 65, 65, 66, 66, 67, 67, 67, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 69, 70, 71, 71, 72, 73, 74, 74, 75, 76, 76, 77, 78, 79, 79, 80, 81, 81, 82, 83, 84, 85, 86, 86, 87, 88, 88, 89, 90, 90, 91, 91, 92 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const short yyr2[] = { 0, 0, 1, 3, 4, 2, 0, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 1, 3, 2, 0, 1, 1, 1, 2, 1, 2, 2, 3, 1, 1, 1, 1, 2, 3, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 3, 2, 2, 3, 4, 2, 1, 2, 4, 2, 1, 2, 5, 1, 1, 2, 2, 2, 2, 1, 2, 3, 1, 2, 5, 1, 1, 1, 2, 1 }; /* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const short yydefact[] = { 1, 0, 0, 2, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 6, 8, 9, 11, 10, 12, 13, 15, 16, 14, 17, 3, 0, 27, 27, 27, 27, 27, 27, 18, 63, 62, 0, 66, 93, 65, 19, 69, 70, 78, 73, 74, 0, 77, 81, 86, 0, 79, 80, 82, 83, 0, 7, 4, 51, 52, 53, 54, 55, 56, 57, 58, 59, 61, 22, 28, 29, 31, 34, 60, 21, 23, 24, 25, 26, 0, 0, 0, 20, 71, 75, 0, 87, 0, 84, 0, 39, 0, 0, 0, 30, 36, 37, 35, 33, 64, 67, 0, 0, 0, 91, 85, 43, 44, 45, 41, 46, 40, 32, 0, 49, 38, 0, 68, 72, 0, 0, 92, 42, 47, 48, 50, 76, 90, 89, 88, 0, 0, 0 }; static const short yydefgoto[] = { 134, 3, 5, 17, 18, 19, 85, 40, 72, 73, 74, 75, 102, 98, 99, 114, 115, 100, 76, 77, 20, 39, 21, 22, 41, 23, 45, 46, 24, 48, 49, 50, 25, 26, 27, 28, 57, 58, 52, 53, 130, 131, 54 }; static const short yypact[] = { 21, -29, 30,-32768, 2, 33, -29, 52, -9, 52, -8, -3, -19, -8, -8, -8, -8,-32768, 2,-32768, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, 54, 13, 13, 13, 13, 13, 13,-32768, 24,-32768, 43,-32768,-32768,-32768, 52,-32768, -3,-32768,-32768, -19, 34,-32768,-32768, -8, 46,-32768,-32768,-32768, -8, 57, -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 16,-32768, 13,-32768,-32768,-32768, -32768,-32768,-32768, -9, -8, 58,-32768,-32768,-32768, -19, -32768, -8,-32768, 47, -14, 13, 42, 45,-32768, 5, 49, 50,-32768,-32768, 52, -8, 64, 65, 36,-32768, -32768,-32768,-32768,-32768,-32768, -14,-32768, 55,-32768, 49, 56,-32768,-32768, -20, -20,-32768,-32768,-32768,-32768,-32768, -32768,-32768,-32768,-32768, 86, 87,-32768 }; static const short yypgoto[] = { -32768,-32768, 83, 72,-32768,-32768,-32768, -6, -18, -4, 17,-32768,-32768, -2, -87, -23,-32768, -1,-32768,-32768, -32768, 14,-32768,-32768, -5,-32768, 59,-32768,-32768, 51, -32768, 7,-32768,-32768,-32768,-32768, 44,-32768, -11,-32768, -21, 8, -10 }; #define YYLAST 114 static const short yytable[] = { 43, 37, 51, 55, 56, 108, 59, 113, 47, 7, 8, 9, 10, 94, 78, 79, 80, 81, 82, 11, 4, 12, 13, 14, 15, 16, 1, 2, 126, 42, 42, 110, 111, 112, 96, 6, 97, 29, 86, 51, 38, 42, 90, 94, 95, 96, 44, 97, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 61, 83, 89, 84, 71, 31, 32, 33, 34, 35, 36, 94, 91, 96, 108, 97, 104, 93, 105, 118, 95, 51, 120, 107, 123, 124, 125, 128, 135, 136, 129, 30, 60, 116, 127, 101, 117, 122, 106, 103, 119, 121, 88, 109, 92, 133, 0, 87, 0, 0, 0, 0, 0, 0, 0, 132, 132 }; static const short yycheck[] = { 10, 7, 12, 14, 15, 25, 16, 94, 27, 7, 8, 9, 10, 27, 32, 33, 34, 35, 36, 17, 49, 19, 20, 21, 22, 23, 5, 6, 115, 49, 49, 45, 46, 47, 29, 5, 31, 4, 44, 49, 49, 49, 53, 27, 28, 29, 49, 31, 58, 36, 37, 38, 39, 40, 41, 42, 43, 44, 4, 35, 26, 18, 49, 11, 12, 13, 14, 15, 16, 27, 24, 29, 25, 31, 84, 18, 18, 32, 28, 89, 31, 91, 18, 18, 48, 30, 0, 0, 32, 6, 18, 95, 115, 76, 96, 105, 89, 83, 99, 104, 49, 93, 58, 124, -1, 46, -1, -1, -1, -1, -1, -1, -1, 123, 124 }; #define YYPURE 1 /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* Skeleton output parser for bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. */ /* This is the parser code that is written into each bison parser when the %semantic_parser declaration is not specified in the grammar. It was written by Richard Stallman by simplifying the hairy parser used when %semantic_parser is specified. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ #if ! defined (yyoverflow) || defined (YYERROR_VERBOSE) /* The parser invokes alloca or malloc; define the necessary symbols. */ # if YYSTACK_USE_ALLOCA # define YYSTACK_ALLOC alloca # else # ifndef YYSTACK_USE_ALLOCA # if defined (alloca) || defined (_ALLOCA_H) # define YYSTACK_ALLOC alloca # else # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (0) # else # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif # define YYSTACK_ALLOC malloc # define YYSTACK_FREE free # endif #endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */ #if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { short yyss; YYSTYPE yyvs; # if YYLSP_NEEDED YYLTYPE yyls; # endif }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # if YYLSP_NEEDED # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \ + 2 * YYSTACK_GAP_MAX) # else # define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAX) # endif /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0) #endif #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__) # define YYSIZE_T __SIZE_TYPE__ #endif #if ! defined (YYSIZE_T) && defined (size_t) # define YYSIZE_T size_t #endif #if ! defined (YYSIZE_T) # if defined (__STDC__) || defined (__cplusplus) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # endif #endif #if ! defined (YYSIZE_T) # define YYSIZE_T unsigned int #endif #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY -2 #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrlab1 /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yychar1 = YYTRANSLATE (yychar); \ YYPOPSTACK; \ goto yybackup; \ } \ else \ { \ yyerror ("syntax error: cannot back up"); \ YYERROR; \ } \ while (0) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Compute the default location (before the actions are run). When YYLLOC_DEFAULT is run, CURRENT is set the location of the first token. By default, to implement support for ranges, extend its range to the last symbol. */ #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ Current.last_line = Rhs[N].last_line; \ Current.last_column = Rhs[N].last_column; #endif /* YYLEX -- calling `yylex' with the right arguments. */ #if YYPURE # if YYLSP_NEEDED # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM) # else # define YYLEX yylex (&yylval, &yylloc) # endif # else /* !YYLSP_NEEDED */ # ifdef YYLEX_PARAM # define YYLEX yylex (&yylval, YYLEX_PARAM) # else # define YYLEX yylex (&yylval) # endif # endif /* !YYLSP_NEEDED */ #else /* !YYPURE */ # define YYLEX yylex () #endif /* !YYPURE */ /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (0) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #if YYMAXDEPTH == 0 # undef YYMAXDEPTH #endif #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #ifdef YYERROR_VERBOSE # ifndef yystrlen # if defined (__GLIBC__) && defined (_STRING_H) # define yystrlen strlen # else /* Return the length of YYSTR. */ static YYSIZE_T # if defined (__STDC__) || defined (__cplusplus) yystrlen (const char *yystr) # else yystrlen (yystr) const char *yystr; # endif { register const char *yys = yystr; while (*yys++ != '\0') continue; return yys - yystr - 1; } # endif # endif # ifndef yystpcpy # if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE) # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ static char * # if defined (__STDC__) || defined (__cplusplus) yystpcpy (char *yydest, const char *yysrc) # else yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; # endif { register char *yyd = yydest; register const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif #endif /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. It should actually point to an object. Grammar actions can access the variable by casting it to the proper pointer type. */ #ifdef YYPARSE_PARAM # if defined (__STDC__) || defined (__cplusplus) # define YYPARSE_PARAM_ARG void *YYPARSE_PARAM # define YYPARSE_PARAM_DECL # else # define YYPARSE_PARAM_ARG YYPARSE_PARAM # define YYPARSE_PARAM_DECL void *YYPARSE_PARAM; # endif #else /* !YYPARSE_PARAM */ # define YYPARSE_PARAM_ARG # define YYPARSE_PARAM_DECL #endif /* !YYPARSE_PARAM */ /* Prevent warning if -Wstrict-prototypes. */ #ifdef __GNUC__ # ifdef YYPARSE_PARAM int yyparse (void *); # else int yyparse (void); # endif #endif /* YY_DECL_VARIABLES -- depending whether we use a pure parser, variables are global, or local to YYPARSE. */ #define YY_DECL_NON_LSP_VARIABLES \ /* The lookahead symbol. */ \ int yychar; \ \ /* The semantic value of the lookahead symbol. */ \ YYSTYPE yylval; \ \ /* Number of parse errors so far. */ \ int yynerrs; #if YYLSP_NEEDED # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES \ \ /* Location data for the lookahead symbol. */ \ YYLTYPE yylloc; #else # define YY_DECL_VARIABLES \ YY_DECL_NON_LSP_VARIABLES #endif /* If nonreentrant, generate the variables here. */ #if !YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ int yyparse (YYPARSE_PARAM_ARG) YYPARSE_PARAM_DECL { /* If reentrant, generate the variables here. */ #if YYPURE YY_DECL_VARIABLES #endif /* !YYPURE */ register int yystate; register int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Lookahead token as an internal (translated) token number. */ int yychar1 = 0; /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ short yyssa[YYINITDEPTH]; short *yyss = yyssa; register short *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; register YYSTYPE *yyvsp; #if YYLSP_NEEDED /* The location stack. */ YYLTYPE yylsa[YYINITDEPTH]; YYLTYPE *yyls = yylsa; YYLTYPE *yylsp; #endif #if YYLSP_NEEDED # define YYPOPSTACK (yyvsp--, yyssp--, yylsp--) #else # define YYPOPSTACK (yyvsp--, yyssp--) #endif YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYLSP_NEEDED YYLTYPE yyloc; #endif /* When reducing, the number of symbols on the RHS of the reduced rule. */ int yylen; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; #if YYLSP_NEEDED yylsp = yyls; #endif goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. so pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyssp >= yyss + yystacksize - 1) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; short *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. */ # if YYLSP_NEEDED YYLTYPE *yyls1 = yyls; /* This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yyls1, yysize * sizeof (*yylsp), &yystacksize); yyls = yyls1; # else yyoverflow ("parser stack overflow", &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); # endif yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyoverflowlab; # else /* Extend the stack our own way. */ if (yystacksize >= YYMAXDEPTH) goto yyoverflowlab; yystacksize *= 2; if (yystacksize > YYMAXDEPTH) yystacksize = YYMAXDEPTH; { short *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyoverflowlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # if YYLSP_NEEDED YYSTACK_RELOCATE (yyls); # endif # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; #if YYLSP_NEEDED yylsp = yyls + yysize - 1; #endif YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyssp >= yyss + yystacksize - 1) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. */ /* Read a lookahead token if we need one and don't already have one. */ /* yyresume: */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYFLAG) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* yychar is either YYEMPTY or YYEOF or a valid token in external form. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } /* Convert token to internal form (in yychar1) for indexing tables with */ if (yychar <= 0) /* This means end of input. */ { yychar1 = 0; yychar = YYEOF; /* Don't call YYLEX any more */ YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yychar1 = YYTRANSLATE (yychar); #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { YYFPRINTF (stderr, "Next token is %d (%s", yychar, yytname[yychar1]); /* Give the individual parser a way to print the precise meaning of a token, for further debugging info. */ # ifdef YYPRINT YYPRINT (stderr, yychar, yylval); # endif YYFPRINTF (stderr, ")\n"); } #endif } yyn += yychar1; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1) goto yydefault; yyn = yytable[yyn]; /* yyn is what to do for this token type in this state. Negative => reduce, -yyn is rule number. Positive => shift, yyn is new state. New state is final state => don't bother to shift, just return success. 0, or most negative number => error. */ if (yyn < 0) { if (yyn == YYFLAG) goto yyerrlab; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrlab; if (yyn == YYFINAL) YYACCEPT; /* Shift the lookahead token. */ YYDPRINTF ((stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1])); /* Discard the token being shifted unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; yystate = yyn; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to the semantic value of the lookahead token. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; #if YYLSP_NEEDED /* Similarly for the default location. Let the user run additional commands if for instance locations are ranges. */ yyloc = yylsp[1-yylen]; YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen); #endif #if YYDEBUG /* We have to keep this `#if YYDEBUG', since we use variables which are defined only if `YYDEBUG' is set. */ if (yydebug) { int yyi; YYFPRINTF (stderr, "Reducing via rule %d (line %d), ", yyn, yyrline[yyn]); /* Print the symbols being reduced, and their result. */ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++) YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]); YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]); } #endif switch (yyn) { case 1: {; break;} case 2: {; break;} case 3: { mtreader_processDeclaration (yyvsp[-1].mtdecl); ; break;} case 4: { mtreader_processGlobalDeclaration (yyvsp[-1].mtdecl); ; break;} case 5: { yyval.mtdecl = mtDeclarationNode_create (yyvsp[-1].tok, yyvsp[0].mtpieces); ; break;} case 6: { yyval.mtpieces = mtDeclarationPieces_create (); ; break;} case 7: { yyval.mtpieces = mtDeclarationPieces_append (yyvsp[0].mtpieces, yyvsp[-1].mtpiece); ; break;} case 8: { yyval.mtpiece = mtDeclarationPiece_createContext (yyvsp[0].mtcontext); ; break;} case 9: { yyval.mtpiece = mtDeclarationPiece_createValues (yyvsp[0].mtvalues); ; break;} case 10: { yyval.mtpiece = mtDeclarationPiece_createDefaults (yyvsp[0].mtdefaults); ; break;} case 11: { yyval.mtpiece = mtDeclarationPiece_createValueDefault (yyvsp[0].tok); ; break;} case 12: { yyval.mtpiece = mtDeclarationPiece_createAnnotations (yyvsp[0].mtannotations); ; break;} case 13: { yyval.mtpiece = mtDeclarationPiece_createMerge (yyvsp[0].mtmerge); ; break;} case 14: { yyval.mtpiece = mtDeclarationPiece_createTransfers (yyvsp[0].mttransferclauselist); ; break;} case 15: { yyval.mtpiece = mtDeclarationPiece_createPreconditions (yyvsp[0].mttransferclauselist); ; break;} case 16: { yyval.mtpiece = mtDeclarationPiece_createPostconditions (yyvsp[0].mttransferclauselist); ; break;} case 17: { yyval.mtpiece = mtDeclarationPiece_createLosers (yyvsp[0].mtlosereferencelist); ; break;} case 18: { yyval.mtcontext = yyvsp[0].mtcontext; ; break;} case 19: { yyval.mtcontext = mtContextNode_createAny (); ; break;} case 21: { yyval.mtcontext = mtContextNode_createParameter (yyvsp[0].ctyp); ; break;} case 22: { yyval.mtcontext = mtContextNode_createReference (yyvsp[0].ctyp); ; break;} case 23: { yyval.mtcontext = mtContextNode_createResult (yyvsp[0].ctyp); ; break;} case 24: { yyval.mtcontext = mtContextNode_createClause (yyvsp[0].ctyp); ; break;} case 25: { yyval.mtcontext = mtContextNode_createLiteral (yyvsp[0].ctyp); ; break;} case 26: { yyval.mtcontext = mtContextNode_createNull (yyvsp[0].ctyp); ; break;} case 27: { yyval.ctyp = ctype_unknown; ; break;} case 28: { DPRINTF (("Type: %s", qtype_unparse (yyvsp[0].qtyp))); yyval.ctyp = qtype_getType (yyvsp[0].qtyp); ; break;} case 30: { yyval.qtyp = qtype_newBase (yyvsp[-1].qtyp, yyvsp[0].ctyp); ; break;} case 31: { yyval.qtyp = yyvsp[0].qtyp; ; break;} case 32: { yyval.qtyp = qtype_mergeAlt (yyvsp[-2].qtyp, yyvsp[0].qtyp); ; break;} case 33: { yyval.qtyp = qtype_combine (yyvsp[0].qtyp, yyvsp[-1].ctyp); ; break;} case 34: { yyval.qtyp = qtype_unknown (); ; break;} case 35: { yyval.qtyp = yyvsp[0].qtyp; ; break;} case 36: { yyval.ctyp = ctype_adjustPointers (yyvsp[0].pointers, ctype_unknown); ; break;} case 38: { yyval.ctyp = ctype_adjustPointers (yyvsp[-1].pointers, yyvsp[0].ctyp); ; break;} case 39: { yyval.pointers = pointers_createMt (yyvsp[0].tok); ; break;} case 40: { yyval.pointers = pointers_createModsMt (yyvsp[-1].tok, yyvsp[0].quals); ; break;} case 41: { yyval.pointers = pointers_extend (pointers_createMt (yyvsp[-1].tok), yyvsp[0].pointers); ; break;} case 42: { yyval.pointers = pointers_extend (pointers_createModsMt (yyvsp[-2].tok, yyvsp[-1].quals), yyvsp[0].pointers); ; break;} case 43: { yyval.qual = qual_createConst (); ; break;} case 44: { yyval.qual = qual_createVolatile (); ; break;} case 45: { yyval.qual = qual_createRestrict (); ; break;} case 46: { yyval.quals = qualList_single (yyvsp[0].qual); ; break;} case 47: { yyval.quals = qualList_add (yyvsp[-1].quals, yyvsp[0].qual); ; break;} case 48: { yyval.ctyp = ctype_expectFunction (yyvsp[-1].ctyp); ; break;} case 49: { yyval.ctyp = ctype_makeArray (ctype_unknown); ; break;} case 50: { yyval.ctyp = ctype_makeArray (yyvsp[-2].ctyp); ; break;} case 51: { yyval.ctyp = ctype_char; ; break;} case 52: { yyval.ctyp = ctype_int; ; break;} case 53: { yyval.ctyp = ctype_float; ; break;} case 54: { yyval.ctyp = ctype_double; ; break;} case 55: { yyval.ctyp = ctype_void; ; break;} case 56: { yyval.ctyp = ctype_unknown; ; break;} case 57: { yyval.ctyp = ctype_anyintegral; ; break;} case 58: { yyval.ctyp = ctype_unsignedintegral; ; break;} case 59: { yyval.ctyp = ctype_signedintegral; ; break;} case 61: { yyval.ctyp = mtscanner_lookupType (yyvsp[0].tok); ; break;} case 62: { yyval.mtvalues = mtValuesNode_create (yyvsp[0].cstringlist); ; break;} case 63: { yyval.cstringlist = cstringList_single (mttok_getText (yyvsp[0].tok)); ; break;} case 64: { yyval.cstringlist = cstringList_prepend (yyvsp[0].cstringlist, mttok_getText (yyvsp[-2].tok)); ; break;} case 65: { yyval.tok = yyvsp[0].tok; ; break;} case 66: { yyval.mtdefaults = mtDefaultsNode_create (yyvsp[-1].tok, yyvsp[0].mtdeflist); ; break;} case 67: { yyval.mtdeflist = mtDefaultsDeclList_single (mtDefaultsDecl_create (yyvsp[-2].mtcontext, yyvsp[0].tok)); ; break;} case 68: { yyval.mtdeflist = mtDefaultsDeclList_prepend (yyvsp[0].mtdeflist, mtDefaultsDecl_create (yyvsp[-3].mtcontext, yyvsp[-1].tok)); ; break;} case 69: { yyval.mtannotations = mtAnnotationsNode_create (yyvsp[0].mtannotlist); ; break;} case 70: { yyval.mtannotlist = mtAnnotationList_single (yyvsp[0].mtannotdecl); ; break;} case 71: { yyval.mtannotlist = mtAnnotationList_prepend (yyvsp[0].mtannotlist, yyvsp[-1].mtannotdecl); ; break;} case 72: { yyval.mtannotdecl = mtAnnotationDecl_create (yyvsp[-3].tok, yyvsp[-2].mtcontext, yyvsp[0].tok); ; break;} case 73: { yyval.mtmerge = mtMergeNode_create (yyvsp[0].mtmergeclauselist); ; break;} case 74: { yyval.mtmergeclauselist = mtMergeClauseList_single (yyvsp[0].mtmergeclause); ; break;} case 75: { yyval.mtmergeclauselist = mtMergeClauseList_prepend (yyvsp[0].mtmergeclauselist, yyvsp[-1].mtmergeclause); ; break;} case 76: { yyval.mtmergeclause = mtMergeClause_create (yyvsp[-4].mtmergeitem, yyvsp[-2].mtmergeitem, yyvsp[0].mttransferaction); ; break;} case 77: { yyval.mtmergeitem = mtMergeItem_createValue (yyvsp[0].tok); ; break;} case 78: { yyval.mtmergeitem = mtMergeItem_createStar (yyvsp[0].tok); ; break;} case 79: { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; break;} case 80: { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; break;} case 81: { yyval.mttransferclauselist = yyvsp[0].mttransferclauselist; ; break;} case 82: { yyval.mtlosereferencelist = yyvsp[0].mtlosereferencelist; ; break;} case 83: { yyval.mtlosereferencelist = mtLoseReferenceList_single (yyvsp[0].mtlosereference); ; break;} case 84: { yyval.mtlosereferencelist = mtLoseReferenceList_prepend (yyvsp[0].mtlosereferencelist, yyvsp[-1].mtlosereference); ; break;} case 85: { yyval.mtlosereference = mtLoseReference_create (yyvsp[-2].tok, yyvsp[0].mttransferaction); ; break;} case 86: { yyval.mttransferclauselist = mtTransferClauseList_single (yyvsp[0].mttransferclause); ; break;} case 87: { yyval.mttransferclauselist = mtTransferClauseList_prepend (yyvsp[0].mttransferclauselist, yyvsp[-1].mttransferclause); ; break;} case 88: { yyval.mttransferclause = mtTransferClause_create (yyvsp[-4].tok, yyvsp[-2].tok, yyvsp[0].mttransferaction); ; break;} case 89: { yyval.mttransferaction = mtTransferAction_createValue (yyvsp[0].tok); ; break;} case 90: { yyval.mttransferaction = yyvsp[0].mttransferaction; ; break;} case 91: { yyval.mttransferaction = mtTransferAction_createError (yyvsp[0].tok); ; break;} case 92: { yyval.mttransferaction = mtTransferAction_createErrorMessage (yyvsp[0].tok); ; break;} } yyvsp -= yylen; yyssp -= yylen; #if YYLSP_NEEDED yylsp -= yylen; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif *++yyvsp = yyval; #if YYLSP_NEEDED *++yylsp = yyloc; #endif /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTBASE] + *yyssp; if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTBASE]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #ifdef YYERROR_VERBOSE yyn = yypact[yystate]; if (yyn > YYFLAG && yyn < YYLAST) { YYSIZE_T yysize = 0; char *yymsg; int yyx, yycount; yycount = 0; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) yysize += yystrlen (yytname[yyx]) + 15, yycount++; yysize += yystrlen ("parse error, unexpected ") + 1; yysize += yystrlen (yytname[YYTRANSLATE (yychar)]); yymsg = (char *) YYSTACK_ALLOC (yysize); if (yymsg != 0) { char *yyp = yystpcpy (yymsg, "parse error, unexpected "); yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]); if (yycount < 5) { yycount = 0; for (yyx = yyn < 0 ? -yyn : 0; yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++) if (yycheck[yyx + yyn] == yyx) { const char *yyq = ! yycount ? ", expecting " : " or "; yyp = yystpcpy (yyp, yyq); yyp = yystpcpy (yyp, yytname[yyx]); yycount++; } } yyerror (yymsg); YYSTACK_FREE (yymsg); } else yyerror ("parse error; also virtual memory exhausted"); } else #endif /* defined (YYERROR_VERBOSE) */ yyerror ("parse error"); } goto yyerrlab1; /*--------------------------------------------------. | yyerrlab1 -- error raised explicitly by an action | `--------------------------------------------------*/ yyerrlab1: if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ /* return failure if at end of input */ if (yychar == YYEOF) YYABORT; YYDPRINTF ((stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1])); yychar = YYEMPTY; } /* Else will try to reuse lookahead token after shifting the error token. */ yyerrstatus = 3; /* Each real token shifted decrements this */ goto yyerrhandle; /*-------------------------------------------------------------------. | yyerrdefault -- current state does not do anything special for the | | error token. | `-------------------------------------------------------------------*/ yyerrdefault: #if 0 /* This is wrong; only states that explicitly want error tokens should shift them. */ /* If its default is to accept any token, ok. Otherwise pop it. */ yyn = yydefact[yystate]; if (yyn) goto yydefault; #endif /*---------------------------------------------------------------. | yyerrpop -- pop the current state because it cannot handle the | | error token | `---------------------------------------------------------------*/ yyerrpop: if (yyssp == yyss) YYABORT; yyvsp--; yystate = *--yyssp; #if YYLSP_NEEDED yylsp--; #endif #if YYDEBUG if (yydebug) { short *yyssp1 = yyss - 1; YYFPRINTF (stderr, "Error: state stack now"); while (yyssp1 != yyssp) YYFPRINTF (stderr, " %d", *++yyssp1); YYFPRINTF (stderr, "\n"); } #endif /*--------------. | yyerrhandle. | `--------------*/ yyerrhandle: yyn = yypact[yystate]; if (yyn == YYFLAG) goto yyerrdefault; yyn += YYTERROR; if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR) goto yyerrdefault; yyn = yytable[yyn]; if (yyn < 0) { if (yyn == YYFLAG) goto yyerrpop; yyn = -yyn; goto yyreduce; } else if (yyn == 0) goto yyerrpop; if (yyn == YYFINAL) YYACCEPT; YYDPRINTF ((stderr, "Shifting error token, ")); *++yyvsp = yylval; #if YYLSP_NEEDED *++yylsp = yylloc; #endif yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; /*---------------------------------------------. | yyoverflowab -- parser overflow comes here. | `---------------------------------------------*/ yyoverflowlab: yyerror ("parser stack overflow"); yyresult = 2; /* Fall through. */ yyreturn: #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif return yyresult; } # include "bison.reset" extern char *yytext; static void mterror (char *s) { if (s != NULL) { llparseerror (message ("Parse error in meta-state file: %s", cstring_fromChars (s))); } else { llparseerror (message ("Parse error in meta-state file")); } } static void yyprint (FILE *file, int type, YYSTYPE value) { cstring tname = mttok_unparse (value.tok); fprintf (file, " (%s)", cstring_toCharsSafe (tname)); cstring_free (tname); } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ splint-3.1.2.dfsg1/src/llgrammar.c.der0000644021234200000250000056412710645776225015162 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ /* A Bison parser, made by GNU Bison 2.3. */ /* Skeleton implementation for Bison's Yacc-like parsers in C Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ /* As a special exception, you may create a larger work that contains part or all of the Bison parser skeleton and distribute that work under terms of your choice, so long as that work isn't itself a parser generator using the skeleton or a modified version thereof as a parser skeleton. Alternatively, if you modify or redistribute the parser skeleton itself, you may (at your option) remove this special exception, which will cause the skeleton and the resulting Bison output files to be licensed under the GNU General Public License without this special exception. This special exception was added by the Free Software Foundation in version 2.2 of Bison. */ /* C LALR(1) parser skeleton written by Richard Stallman, by simplifying the original so-called "semantic" parser. */ /* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. */ /* Identify Bison output. */ #define YYBISON 1 /* Bison version. */ #define YYBISON_VERSION "2.3" /* Skeleton name. */ #define YYSKELETON_NAME "yacc.c" /* Pure parsers. */ #define YYPURE 0 /* Using locations. */ #define YYLSP_NEEDED 0 /* Substitute the variable and function names. */ #define yyparse ylparse #define yylex yllex #define yyerror ylerror #define yylval yllval #define yychar ylchar #define yydebug yldebug #define yynerrs ylnerrs /* Tokens. */ #ifndef YYTOKENTYPE # define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { simpleOp = 258, PREFIX_OP = 259, POSTFIX_OP = 260, LLT_MULOP = 261, LLT_SEMI = 262, LLT_VERTICALBAR = 263, ITERATION_OP = 264, selectSym = 265, LLT_LBRACKET = 266, LLT_LPAR = 267, LLT_IF_THEN_ELSE = 268, logicalOp = 269, eqSepSym = 270, equationSym = 271, commentSym = 272, LLT_WHITESPACE = 273, LLT_EOL = 274, LLT_TYPEDEF_NAME = 275, quantifierSym = 276, openSym = 277, closeSym = 278, sepSym = 279, simpleId = 280, mapSym = 281, markerSym = 282, preSym = 283, postSym = 284, anySym = 285, LLT_COLON = 286, LLT_COMMA = 287, LLT_EQUALS = 288, LLT_LBRACE = 289, LLT_RBRACE = 290, LLT_RBRACKET = 291, LLT_RPAR = 292, LLT_QUOTE = 293, eqOp = 294, LLT_CCHAR = 295, LLT_CFLOAT = 296, LLT_CINTEGER = 297, LLT_LCSTRING = 298, LLT_ALL = 299, LLT_ANYTHING = 300, LLT_BE = 301, LLT_BODY = 302, LLT_CLAIMS = 303, LLT_CHECKS = 304, LLT_CONSTANT = 305, LLT_ELSE = 306, LLT_ENSURES = 307, LLT_FOR = 308, LLT_FRESH = 309, LLT_IF = 310, LLT_IMMUTABLE = 311, LLT_IMPORTS = 312, LLT_CONSTRAINT = 313, LLT_ISSUB = 314, LLT_LET = 315, LLT_MODIFIES = 316, LLT_MUTABLE = 317, LLT_NOTHING = 318, LLT_INTERNAL = 319, LLT_FILESYS = 320, LLT_OBJ = 321, LLT_OUT = 322, LLT_SEF = 323, LLT_ONLY = 324, LLT_PARTIAL = 325, LLT_OWNED = 326, LLT_DEPENDENT = 327, LLT_KEEP = 328, LLT_KEPT = 329, LLT_TEMP = 330, LLT_SHARED = 331, LLT_UNIQUE = 332, LLT_UNUSED = 333, LLT_EXITS = 334, LLT_MAYEXIT = 335, LLT_NEVEREXIT = 336, LLT_TRUEEXIT = 337, LLT_FALSEEXIT = 338, LLT_UNDEF = 339, LLT_KILLED = 340, LLT_CHECKMOD = 341, LLT_CHECKED = 342, LLT_UNCHECKED = 343, LLT_CHECKEDSTRICT = 344, LLT_TRUENULL = 345, LLT_FALSENULL = 346, LLT_LNULL = 347, LLT_LNOTNULL = 348, LLT_RETURNED = 349, LLT_OBSERVER = 350, LLT_EXPOSED = 351, LLT_REFCOUNTED = 352, LLT_REFS = 353, LLT_RELNULL = 354, LLT_RELDEF = 355, LLT_KILLREF = 356, LLT_NULLTERMINATED = 357, LLT_TEMPREF = 358, LLT_NEWREF = 359, LLT_PRIVATE = 360, LLT_REQUIRES = 361, LLT_RESULT = 362, LLT_SIZEOF = 363, LLT_SPEC = 364, LLT_TAGGEDUNION = 365, LLT_THEN = 366, LLT_TYPE = 367, LLT_TYPEDEF = 368, LLT_UNCHANGED = 369, LLT_USES = 370, LLT_CHAR = 371, LLT_CONST = 372, LLT_DOUBLE = 373, LLT_ENUM = 374, LLT_FLOAT = 375, LLT_INT = 376, LLT_ITER = 377, LLT_YIELD = 378, LLT_LONG = 379, LLT_SHORT = 380, LLT_SIGNED = 381, LLT_UNKNOWN = 382, LLT_STRUCT = 383, LLT_TELIPSIS = 384, LLT_UNION = 385, LLT_UNSIGNED = 386, LLT_VOID = 387, LLT_VOLATILE = 388, LLT_PRINTFLIKE = 389, LLT_SCANFLIKE = 390, LLT_MESSAGELIKE = 391 }; #endif /* Tokens. */ #define simpleOp 258 #define PREFIX_OP 259 #define POSTFIX_OP 260 #define LLT_MULOP 261 #define LLT_SEMI 262 #define LLT_VERTICALBAR 263 #define ITERATION_OP 264 #define selectSym 265 #define LLT_LBRACKET 266 #define LLT_LPAR 267 #define LLT_IF_THEN_ELSE 268 #define logicalOp 269 #define eqSepSym 270 #define equationSym 271 #define commentSym 272 #define LLT_WHITESPACE 273 #define LLT_EOL 274 #define LLT_TYPEDEF_NAME 275 #define quantifierSym 276 #define openSym 277 #define closeSym 278 #define sepSym 279 #define simpleId 280 #define mapSym 281 #define markerSym 282 #define preSym 283 #define postSym 284 #define anySym 285 #define LLT_COLON 286 #define LLT_COMMA 287 #define LLT_EQUALS 288 #define LLT_LBRACE 289 #define LLT_RBRACE 290 #define LLT_RBRACKET 291 #define LLT_RPAR 292 #define LLT_QUOTE 293 #define eqOp 294 #define LLT_CCHAR 295 #define LLT_CFLOAT 296 #define LLT_CINTEGER 297 #define LLT_LCSTRING 298 #define LLT_ALL 299 #define LLT_ANYTHING 300 #define LLT_BE 301 #define LLT_BODY 302 #define LLT_CLAIMS 303 #define LLT_CHECKS 304 #define LLT_CONSTANT 305 #define LLT_ELSE 306 #define LLT_ENSURES 307 #define LLT_FOR 308 #define LLT_FRESH 309 #define LLT_IF 310 #define LLT_IMMUTABLE 311 #define LLT_IMPORTS 312 #define LLT_CONSTRAINT 313 #define LLT_ISSUB 314 #define LLT_LET 315 #define LLT_MODIFIES 316 #define LLT_MUTABLE 317 #define LLT_NOTHING 318 #define LLT_INTERNAL 319 #define LLT_FILESYS 320 #define LLT_OBJ 321 #define LLT_OUT 322 #define LLT_SEF 323 #define LLT_ONLY 324 #define LLT_PARTIAL 325 #define LLT_OWNED 326 #define LLT_DEPENDENT 327 #define LLT_KEEP 328 #define LLT_KEPT 329 #define LLT_TEMP 330 #define LLT_SHARED 331 #define LLT_UNIQUE 332 #define LLT_UNUSED 333 #define LLT_EXITS 334 #define LLT_MAYEXIT 335 #define LLT_NEVEREXIT 336 #define LLT_TRUEEXIT 337 #define LLT_FALSEEXIT 338 #define LLT_UNDEF 339 #define LLT_KILLED 340 #define LLT_CHECKMOD 341 #define LLT_CHECKED 342 #define LLT_UNCHECKED 343 #define LLT_CHECKEDSTRICT 344 #define LLT_TRUENULL 345 #define LLT_FALSENULL 346 #define LLT_LNULL 347 #define LLT_LNOTNULL 348 #define LLT_RETURNED 349 #define LLT_OBSERVER 350 #define LLT_EXPOSED 351 #define LLT_REFCOUNTED 352 #define LLT_REFS 353 #define LLT_RELNULL 354 #define LLT_RELDEF 355 #define LLT_KILLREF 356 #define LLT_NULLTERMINATED 357 #define LLT_TEMPREF 358 #define LLT_NEWREF 359 #define LLT_PRIVATE 360 #define LLT_REQUIRES 361 #define LLT_RESULT 362 #define LLT_SIZEOF 363 #define LLT_SPEC 364 #define LLT_TAGGEDUNION 365 #define LLT_THEN 366 #define LLT_TYPE 367 #define LLT_TYPEDEF 368 #define LLT_UNCHANGED 369 #define LLT_USES 370 #define LLT_CHAR 371 #define LLT_CONST 372 #define LLT_DOUBLE 373 #define LLT_ENUM 374 #define LLT_FLOAT 375 #define LLT_INT 376 #define LLT_ITER 377 #define LLT_YIELD 378 #define LLT_LONG 379 #define LLT_SHORT 380 #define LLT_SIGNED 381 #define LLT_UNKNOWN 382 #define LLT_STRUCT 383 #define LLT_TELIPSIS 384 #define LLT_UNION 385 #define LLT_UNSIGNED 386 #define LLT_VOID 387 #define LLT_VOLATILE 388 #define LLT_PRINTFLIKE 389 #define LLT_SCANFLIKE 390 #define LLT_MESSAGELIKE 391 /* Copy the first part of user declarations. */ # include "splintMacros.nf" # include "basic.h" # include "lclscan.h" # include "checking.h" # include "lslparse.h" # include "lh.h" # include "usymtab_interface.h" /*@-noparams@*/ static /*@unused@*/ void yyprint (); /*@=noparams@*/ /*@-redecl@*/ void ylerror (char *) /*@modifies *g_warningstream@*/ ; /*@=redecl@*/ bool g_inTypeDef = FALSE; /*@constant int YYDEBUG;@*/ # define YYDEBUG 1 /*@notfunction@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) /* ** This is necessary, or else when the bison-generated code #include's malloc.h, ** there will be a parse error. ** ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations ** in bison-generated files under Win32. */ # ifdef WIN32 # undef malloc # undef calloc # undef realloc # endif /* Enabling traces. */ #ifndef YYDEBUG # define YYDEBUG 1 #endif /* Enabling verbose error messages. */ #ifdef YYERROR_VERBOSE # undef YYERROR_VERBOSE # define YYERROR_VERBOSE 1 #else # define YYERROR_VERBOSE 0 #endif /* Enabling the token table. */ #ifndef YYTOKEN_TABLE # define YYTOKEN_TABLE 0 #endif #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED typedef union YYSTYPE { ltoken ltok; /* a leaf is also an ltoken */ qual typequal; unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ abstDeclaratorNode abstDecl; /*@only@*/ declaratorNode declare; /*@only@*/ declaratorNodeList declarelist; /*@only@*/ typeExpr typeexpr; /*@only@*/ arrayQualNode array; /*@only@*/ quantifierNode quantifier; /*@only@*/ quantifierNodeList quantifiers; /*@only@*/ varNode var; /*@only@*/ varNodeList vars; /*@only@*/ storeRefNode storeref; /*@only@*/ storeRefNodeList storereflist; /*@only@*/ termNode term; /*@only@*/ termNodeList termlist; /*@only@*/ programNode program; /*@only@*/ stmtNode stmt; /*@only@*/ claimNode claim; /*@only@*/ typeNode type; /*@only@*/ iterNode iter; /*@only@*/ fcnNode fcn; /*@only@*/ fcnNodeList fcns; /*@only@*/ letDeclNode letdecl; /*@only@*/ letDeclNodeList letdecls; /*@only@*/ lclPredicateNode lclpredicate; /*@only@*/ modifyNode modify; /*@only@*/ paramNode param; /*@only@*/ paramNodeList paramlist; /*@only@*/ declaratorInvNodeList declaratorinvs; /*@only@*/ declaratorInvNode declaratorinv; /*@only@*/ abstBodyNode abstbody; /*@only@*/ abstractNode abstract; /*@only@*/ exposedNode exposed; /*@only@*/ pointers pointers; /* taggedUnionNode taggedunion; */ /*@only@*/ globalList globals; /*@only@*/ constDeclarationNode constdeclaration; /*@only@*/ varDeclarationNode vardeclaration; /*@only@*/ varDeclarationNodeList vardeclarationlist; /*@only@*/ initDeclNodeList initdecls; /*@only@*/ initDeclNode initdecl; /*@only@*/ stDeclNodeList structdecls; /*@only@*/ stDeclNode structdecl; /*@only@*/ strOrUnionNode structorunion; /*@only@*/ enumSpecNode enumspec; /*@only@*/ lclTypeSpecNode lcltypespec; /*@only@*/ typeNameNode typname; /*@only@*/ opFormNode opform; /*@only@*/ sigNode signature; /*@only@*/ nameNode name; /*@only@*/ typeNameNodeList namelist; /*@only@*/ replaceNode replace; /*@only@*/ replaceNodeList replacelist; /*@only@*/ renamingNode renaming; /*@only@*/ traitRefNode traitref; /*@only@*/ traitRefNodeList traitreflist; /*@only@*/ importNode import; /*@only@*/ importNodeList importlist; /*@only@*/ interfaceNode iface; /*@only@*/ interfaceNodeList interfacelist; /*@only@*/ CTypesNode ctypes; /*@-redef@*/ } /* Line 193 of yacc.c. */ YYSTYPE; # define yystype YYSTYPE /* obsolescent; will be withdrawn */ # define YYSTYPE_IS_DECLARED 1 # define YYSTYPE_IS_TRIVIAL 1 #endif /* Copy the second part of user declarations. */ /* Line 216 of yacc.c. */ #ifdef short # undef short #endif #ifdef YYTYPE_UINT8 typedef YYTYPE_UINT8 yytype_uint8; #else typedef unsigned char yytype_uint8; #endif #ifdef YYTYPE_INT8 typedef YYTYPE_INT8 yytype_int8; #elif (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) typedef signed char yytype_int8; #else typedef short int yytype_int8; #endif #ifdef YYTYPE_UINT16 typedef YYTYPE_UINT16 yytype_uint16; #else typedef unsigned short int yytype_uint16; #endif #ifdef YYTYPE_INT16 typedef YYTYPE_INT16 yytype_int16; #else typedef short int yytype_int16; #endif #ifndef YYSIZE_T # ifdef __SIZE_TYPE__ # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else # define YYSIZE_T unsigned int # endif #endif #define YYSIZE_MAXIMUM ((YYSIZE_T) -1) #ifndef YY_ # if YYENABLE_NLS # if ENABLE_NLS # include /* INFRINGES ON USER NAME SPACE */ # define YY_(msgid) dgettext ("bison-runtime", msgid) # endif # endif # ifndef YY_ # define YY_(msgid) msgid # endif #endif /* Suppress unused-variable warnings by "using" E. */ #if ! defined lint || defined __GNUC__ # define YYUSE(e) ((void) (e)) #else # define YYUSE(e) /* empty */ #endif /* Identity function, used to suppress warnings about constant conditions. */ #ifndef lint # define YYID(n) (n) #else #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static int YYID (int i) #else static int YYID (i) int i; #endif { return i; } #endif #if ! defined yyoverflow || YYERROR_VERBOSE /* The parser invokes alloca or malloc; define the necessary symbols. */ # ifdef YYSTACK_USE_ALLOCA # if YYSTACK_USE_ALLOCA # ifdef __GNUC__ # define YYSTACK_ALLOC __builtin_alloca # elif defined __BUILTIN_VA_ARG_INCR # include /* INFRINGES ON USER NAME SPACE */ # elif defined _AIX # define YYSTACK_ALLOC __alloca # elif defined _MSC_VER # include /* INFRINGES ON USER NAME SPACE */ # define alloca _alloca # else # define YYSTACK_ALLOC alloca # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # endif # endif # endif # ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */ # define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0)) # ifndef YYSTACK_ALLOC_MAXIMUM /* The OS might guarantee only one guard page at the bottom of the stack, and a page size can be as small as 4096 bytes. So we cannot safely invoke alloca (N) if N exceeds 4096. Use a slightly smaller number to allow for a few compiler-allocated temporary stack slots. */ # define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */ # endif # else # define YYSTACK_ALLOC YYMALLOC # define YYSTACK_FREE YYFREE # ifndef YYSTACK_ALLOC_MAXIMUM # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM # endif # if (defined __cplusplus && ! defined _STDLIB_H \ && ! ((defined YYMALLOC || defined malloc) \ && (defined YYFREE || defined free))) # include /* INFRINGES ON USER NAME SPACE */ # ifndef _STDLIB_H # define _STDLIB_H 1 # endif # endif # ifndef YYMALLOC # define YYMALLOC malloc # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */ # endif # endif # ifndef YYFREE # define YYFREE free # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) void free (void *); /* INFRINGES ON USER NAME SPACE */ # endif # endif # endif #endif /* ! defined yyoverflow || YYERROR_VERBOSE */ #if (! defined yyoverflow \ && (! defined __cplusplus \ || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL))) /* A type that is properly aligned for any stack member. */ union yyalloc { yytype_int16 yyss; YYSTYPE yyvs; }; /* The size of the maximum gap between one aligned stack and the next. */ # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) /* The size of an array large to enough to hold all stacks, each with N elements. */ # define YYSTACK_BYTES(N) \ ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM) /* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */ # ifndef YYCOPY # if defined __GNUC__ && 1 < __GNUC__ # define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From))) # else # define YYCOPY(To, From, Count) \ do \ { \ YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (YYID (0)) # endif # endif /* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */ # define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (YYID (0)) #endif /* YYFINAL -- State number of the termination state. */ #define YYFINAL 3 /* YYLAST -- Last index in YYTABLE. */ #define YYLAST 3314 /* YYNTOKENS -- Number of terminals. */ #define YYNTOKENS 137 /* YYNNTS -- Number of nonterminals. */ #define YYNNTS 155 /* YYNRULES -- Number of rules. */ #define YYNRULES 414 /* YYNRULES -- Number of states. */ #define YYNSTATES 684 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */ #define YYUNDEFTOK 2 #define YYMAXUTOK 391 #define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK) /* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */ static const yytype_uint8 yytranslate[] = { 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136 }; #if YYDEBUG /* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */ static const yytype_uint16 yyprhs[] = { 0, 0, 3, 4, 8, 9, 12, 14, 16, 17, 20, 23, 24, 27, 29, 31, 33, 37, 41, 43, 45, 47, 49, 51, 53, 60, 61, 63, 65, 69, 72, 74, 75, 79, 81, 83, 85, 87, 92, 96, 101, 106, 108, 110, 112, 114, 116, 117, 131, 132, 147, 148, 162, 167, 168, 169, 176, 177, 178, 186, 187, 188, 196, 197, 198, 205, 206, 207, 214, 217, 220, 222, 226, 228, 232, 234, 236, 240, 242, 244, 248, 250, 255, 259, 266, 268, 272, 274, 276, 280, 282, 286, 288, 292, 296, 300, 305, 307, 309, 311, 313, 315, 319, 321, 325, 326, 329, 333, 336, 339, 340, 343, 348, 349, 353, 355, 359, 365, 369, 371, 372, 376, 377, 381, 382, 386, 390, 394, 396, 400, 402, 404, 407, 409, 411, 412, 416, 417, 421, 422, 424, 426, 428, 432, 434, 438, 439, 444, 450, 452, 456, 459, 463, 467, 472, 476, 482, 489, 491, 495, 497, 499, 502, 505, 509, 513, 517, 522, 524, 528, 533, 537, 538, 541, 542, 544, 545, 552, 554, 558, 559, 563, 564, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 593, 595, 597, 599, 601, 603, 605, 607, 609, 611, 613, 615, 617, 619, 621, 623, 625, 627, 629, 631, 633, 635, 637, 639, 641, 643, 645, 647, 649, 651, 653, 655, 657, 659, 661, 663, 665, 667, 669, 671, 673, 675, 678, 684, 686, 689, 691, 694, 695, 702, 703, 710, 713, 716, 717, 719, 721, 724, 728, 730, 734, 735, 737, 744, 747, 749, 753, 755, 757, 759, 763, 766, 769, 773, 778, 780, 784, 787, 790, 794, 799, 801, 804, 807, 811, 816, 819, 822, 825, 828, 832, 834, 835, 837, 841, 844, 846, 848, 851, 855, 859, 864, 867, 871, 878, 880, 883, 886, 890, 894, 899, 904, 910, 914, 919, 924, 930, 933, 936, 940, 944, 946, 948, 950, 952, 954, 956, 958, 959, 961, 963, 967, 969, 971, 976, 977, 979, 981, 985, 987, 989, 996, 998, 1002, 1004, 1009, 1013, 1017, 1019, 1022, 1025, 1027, 1029, 1031, 1034, 1036, 1039, 1042, 1046, 1048, 1050, 1053, 1056, 1060, 1062, 1065, 1069, 1071, 1077, 1081, 1086, 1089, 1093, 1096, 1098, 1102, 1106, 1108, 1113, 1115, 1118, 1122, 1126, 1130, 1135, 1139, 1141, 1145, 1147, 1149, 1151, 1153, 1155, 1157, 1162, 1167, 1172, 1177, 1184, 1189, 1191, 1193, 1195, 1197, 1199, 1202, 1203, 1207, 1209, 1213, 1217, 1222, 1224, 1226, 1228, 1230, 1232, 1234, 1236, 1238 }; /* YYRHS -- A `-1'-separated list of the rules' RHS. */ static const yytype_int16 yyrhs[] = { 138, 0, -1, -1, 140, 139, 142, -1, -1, 140, 141, -1, 145, -1, 146, -1, -1, 147, 143, -1, 152, 143, -1, -1, 143, 144, -1, 147, -1, 152, -1, 146, -1, 57, 176, 7, -1, 115, 180, 7, -1, 155, -1, 156, -1, 157, -1, 159, -1, 162, -1, 148, -1, 122, 286, 12, 149, 37, 7, -1, -1, 150, -1, 151, -1, 150, 32, 151, -1, 123, 245, -1, 245, -1, -1, 109, 153, 154, -1, 155, -1, 156, -1, 157, -1, 159, -1, 50, 228, 190, 7, -1, 228, 190, 7, -1, 117, 228, 190, 7, -1, 133, 228, 190, 7, -1, 164, -1, 173, -1, 134, -1, 135, -1, 136, -1, -1, 228, 241, 192, 160, 34, 194, 196, 200, 201, 202, 205, 206, 35, -1, -1, 158, 228, 241, 192, 161, 34, 194, 196, 200, 201, 202, 205, 206, 35, -1, -1, 48, 288, 12, 207, 37, 192, 163, 34, 196, 201, 210, 205, 35, -1, 48, 285, 288, 7, -1, -1, -1, 62, 165, 112, 20, 166, 215, -1, -1, -1, 62, 167, 97, 112, 20, 168, 215, -1, -1, -1, 97, 62, 169, 112, 20, 170, 215, -1, -1, -1, 56, 171, 112, 20, 172, 215, -1, -1, -1, 113, 228, 174, 220, 175, 7, -1, 231, 7, -1, 239, 7, -1, 177, -1, 176, 32, 177, -1, 179, -1, 3, 179, 3, -1, 43, -1, 179, -1, 178, 32, 179, -1, 284, -1, 181, -1, 180, 32, 181, -1, 290, -1, 290, 12, 183, 37, -1, 12, 182, 37, -1, 12, 182, 37, 12, 183, 37, -1, 290, -1, 182, 32, 290, -1, 185, -1, 184, -1, 184, 32, 185, -1, 246, -1, 184, 32, 246, -1, 186, -1, 185, 32, 186, -1, 246, 53, 224, -1, 246, 53, 187, -1, 246, 53, 187, 257, -1, 291, -1, 250, -1, 189, -1, 261, -1, 191, -1, 190, 32, 191, -1, 241, -1, 241, 33, 188, -1, -1, 192, 193, -1, 228, 190, 7, -1, 64, 7, -1, 65, 7, -1, -1, 194, 195, -1, 105, 228, 190, 7, -1, -1, 60, 197, 7, -1, 198, -1, 197, 32, 198, -1, 286, 31, 199, 46, 261, -1, 286, 46, 261, -1, 228, -1, -1, 49, 260, 7, -1, -1, 106, 260, 7, -1, -1, 61, 63, 7, -1, 61, 45, 7, -1, 61, 203, 7, -1, 204, -1, 203, 32, 204, -1, 261, -1, 229, -1, 66, 229, -1, 64, -1, 65, -1, -1, 52, 260, 7, -1, -1, 48, 260, 7, -1, -1, 208, -1, 209, -1, 129, -1, 209, 32, 129, -1, 245, -1, 209, 32, 245, -1, -1, 47, 34, 211, 35, -1, 47, 34, 211, 7, 35, -1, 212, -1, 12, 211, 37, -1, 211, 6, -1, 211, 8, 211, -1, 211, 7, 211, -1, 285, 12, 213, 37, -1, 285, 12, 37, -1, 286, 33, 285, 12, 37, -1, 286, 33, 285, 12, 213, 37, -1, 214, -1, 213, 32, 214, -1, 278, -1, 286, -1, 3, 214, -1, 214, 3, -1, 214, 3, 214, -1, 12, 214, 37, -1, 285, 12, 37, -1, 285, 12, 213, 37, -1, 7, -1, 34, 216, 35, -1, 34, 178, 35, 7, -1, 34, 35, 7, -1, -1, 216, 159, -1, -1, 218, -1, -1, 58, 219, 280, 12, 260, 37, -1, 221, -1, 220, 32, 221, -1, -1, 241, 222, 223, -1, -1, 34, 217, 35, -1, 132, -1, 116, -1, 118, -1, 120, -1, 121, -1, 124, -1, 125, -1, 126, -1, 131, -1, 127, -1, 224, -1, 225, 224, -1, 20, -1, 225, -1, 67, -1, 78, -1, 68, -1, 69, -1, 71, -1, 72, -1, 73, -1, 74, -1, 95, -1, 79, -1, 80, -1, 82, -1, 83, -1, 81, -1, 75, -1, 76, -1, 77, -1, 87, -1, 88, -1, 89, -1, 90, -1, 91, -1, 99, -1, 100, -1, 97, -1, 98, -1, 104, -1, 101, -1, 92, -1, 93, -1, 94, -1, 96, -1, 70, -1, 102, -1, 84, -1, 85, -1, 226, -1, 231, -1, 239, -1, 227, 228, -1, 8, 229, 31, 229, 8, -1, 228, -1, 228, 230, -1, 6, -1, 230, 6, -1, -1, 128, 234, 232, 34, 235, 35, -1, -1, 130, 234, 233, 34, 235, 35, -1, 128, 287, -1, 130, 287, -1, -1, 287, -1, 236, -1, 235, 236, -1, 228, 237, 7, -1, 241, -1, 237, 32, 241, -1, -1, 32, -1, 119, 234, 34, 240, 238, 35, -1, 119, 287, -1, 25, -1, 240, 32, 25, -1, 243, -1, 242, -1, 286, -1, 12, 242, 37, -1, 6, 242, -1, 242, 249, -1, 242, 12, 37, -1, 242, 12, 208, 37, -1, 20, -1, 12, 243, 37, -1, 6, 243, -1, 243, 249, -1, 243, 12, 37, -1, 243, 12, 208, 37, -1, 20, -1, 6, 244, -1, 244, 249, -1, 244, 12, 37, -1, 244, 12, 208, 37, -1, 228, 244, -1, 228, 242, -1, 228, 247, -1, 228, 247, -1, 66, 228, 247, -1, 250, -1, -1, 248, -1, 12, 248, 37, -1, 6, 248, -1, 6, -1, 249, -1, 248, 249, -1, 248, 12, 37, -1, 12, 208, 37, -1, 248, 12, 208, 37, -1, 11, 36, -1, 11, 189, 36, -1, 55, 27, 111, 27, 51, 27, -1, 253, -1, 27, 253, -1, 253, 27, -1, 27, 253, 27, -1, 251, 254, 252, -1, 27, 251, 254, 252, -1, 251, 254, 252, 27, -1, 27, 251, 254, 252, 27, -1, 11, 254, 36, -1, 11, 254, 36, 27, -1, 27, 11, 254, 36, -1, 27, 11, 254, 36, 27, -1, 10, 284, -1, 26, 284, -1, 27, 10, 284, -1, 27, 26, 284, -1, 22, -1, 34, -1, 23, -1, 35, -1, 265, -1, 14, -1, 39, -1, -1, 255, -1, 27, -1, 255, 256, 27, -1, 32, -1, 24, -1, 31, 258, 26, 289, -1, -1, 259, -1, 289, -1, 259, 32, 289, -1, 261, -1, 262, -1, 55, 262, 111, 262, 51, 262, -1, 263, -1, 262, 14, 262, -1, 264, -1, 279, 12, 260, 37, -1, 264, 39, 264, -1, 264, 33, 264, -1, 266, -1, 269, 267, -1, 269, 268, -1, 3, -1, 6, -1, 269, -1, 265, 266, -1, 265, -1, 267, 265, -1, 265, 269, -1, 268, 265, 269, -1, 274, -1, 270, -1, 270, 274, -1, 274, 270, -1, 274, 270, 274, -1, 271, -1, 271, 274, -1, 272, 31, 289, -1, 272, -1, 11, 273, 36, 31, 289, -1, 11, 273, 36, -1, 11, 36, 31, 289, -1, 11, 36, -1, 251, 273, 252, -1, 251, 252, -1, 261, -1, 273, 256, 261, -1, 12, 262, 37, -1, 286, -1, 291, 12, 275, 37, -1, 277, -1, 274, 276, -1, 274, 10, 284, -1, 274, 26, 284, -1, 274, 11, 36, -1, 274, 11, 275, 36, -1, 274, 31, 289, -1, 262, -1, 275, 32, 262, -1, 28, -1, 29, -1, 30, -1, 38, -1, 278, -1, 107, -1, 54, 12, 275, 37, -1, 114, 12, 44, 37, -1, 114, 12, 203, 37, -1, 108, 12, 261, 37, -1, 59, 12, 261, 32, 261, 37, -1, 108, 12, 228, 37, -1, 42, -1, 43, -1, 40, -1, 41, -1, 280, -1, 279, 280, -1, -1, 21, 281, 282, -1, 283, -1, 282, 32, 283, -1, 286, 31, 199, -1, 286, 31, 66, 199, -1, 25, -1, 20, -1, 25, -1, 25, -1, 284, -1, 284, -1, 284, -1, 284, -1, 284, -1 }; /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const yytype_uint16 yyrline[] = { 0, 382, 382, 382, 387, 388, 392, 393, 397, 398, 399, 403, 404, 408, 409, 410, 414, 421, 426, 428, 430, 432, 434, 436, 441, 446, 447, 451, 453, 458, 459, 463, 463, 468, 470, 472, 474, 479, 484, 486, 488, 493, 494, 498, 499, 500, 504, 504, 512, 512, 526, 525, 530, 535, 535, 535, 537, 538, 537, 540, 541, 540, 543, 543, 543, 548, 549, 548, 551, 553, 570, 572, 577, 578, 580, 584, 585, 589, 594, 596, 601, 603, 605, 607, 612, 613, 617, 619, 621, 625, 627, 631, 633, 637, 638, 639, 644, 645, 648, 651, 655, 657, 662, 663, 668, 669, 674, 675, 676, 680, 681, 685, 690, 691, 695, 696, 700, 701, 704, 708, 709, 713, 714, 718, 719, 720, 721, 725, 726, 730, 731, 732, 733, 734, 738, 739, 743, 744, 748, 749, 753, 754, 755, 759, 760, 764, 765, 766, 770, 771, 774, 779, 785, 794, 796, 798, 800, 805, 806, 810, 811, 812, 813, 814, 815, 816, 818, 823, 824, 825, 826, 830, 831, 835, 836, 840, 840, 850, 851, 856, 856, 861, 862, 866, 867, 868, 869, 870, 871, 872, 873, 874, 875, 884, 885, 891, 893, 900, 901, 902, 903, 904, 905, 906, 907, 908, 909, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 930, 931, 932, 933, 934, 935, 939, 941, 943, 945, 947, 957, 958, 964, 965, 970, 969, 974, 973, 977, 979, 984, 985, 989, 990, 996, 1000, 1002, 1007, 1008, 1012, 1014, 1019, 1020, 1031, 1032, 1036, 1037, 1038, 1039, 1040, 1041, 1045, 1046, 1047, 1048, 1049, 1050, 1060, 1061, 1062, 1063, 1064, 1071, 1072, 1073, 1084, 1085, 1086, 1092, 1093, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1108, 1109, 1113, 1115, 1117, 1119, 1121, 1124, 1126, 1128, 1130, 1132, 1134, 1142, 1144, 1146, 1149, 1152, 1155, 1161, 1162, 1166, 1167, 1171, 1172, 1173, 1177, 1178, 1182, 1183, 1187, 1188, 1192, 1196, 1197, 1201, 1202, 1206, 1210, 1217, 1219, 1220, 1224, 1225, 1230, 1232, 1237, 1238, 1239, 1243, 1244, 1248, 1249, 1253, 1254, 1258, 1259, 1263, 1264, 1265, 1266, 1267, 1268, 1269, 1273, 1274, 1278, 1281, 1283, 1287, 1292, 1293, 1297, 1298, 1302, 1304, 1306, 1308, 1309, 1311, 1313, 1315, 1318, 1320, 1325, 1326, 1330, 1331, 1332, 1333, 1337, 1338, 1339, 1340, 1341, 1342, 1347, 1353, 1364, 1365, 1366, 1367, 1371, 1373, 1378, 1378, 1386, 1387, 1391, 1392, 1396, 1397, 1401, 1402, 1403, 1404, 1405, 1406, 1407 }; #endif #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE /* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM. First, the terminals, then, starting at YYNTOKENS, nonterminals. */ static const char *const yytname[] = { "$end", "error", "$undefined", "simpleOp", "PREFIX_OP", "POSTFIX_OP", "LLT_MULOP", "LLT_SEMI", "LLT_VERTICALBAR", "ITERATION_OP", "selectSym", "LLT_LBRACKET", "LLT_LPAR", "LLT_IF_THEN_ELSE", "logicalOp", "eqSepSym", "equationSym", "commentSym", "LLT_WHITESPACE", "LLT_EOL", "LLT_TYPEDEF_NAME", "quantifierSym", "openSym", "closeSym", "sepSym", "simpleId", "mapSym", "markerSym", "preSym", "postSym", "anySym", "LLT_COLON", "LLT_COMMA", "LLT_EQUALS", "LLT_LBRACE", "LLT_RBRACE", "LLT_RBRACKET", "LLT_RPAR", "LLT_QUOTE", "eqOp", "LLT_CCHAR", "LLT_CFLOAT", "LLT_CINTEGER", "LLT_LCSTRING", "LLT_ALL", "LLT_ANYTHING", "LLT_BE", "LLT_BODY", "LLT_CLAIMS", "LLT_CHECKS", "LLT_CONSTANT", "LLT_ELSE", "LLT_ENSURES", "LLT_FOR", "LLT_FRESH", "LLT_IF", "LLT_IMMUTABLE", "LLT_IMPORTS", "LLT_CONSTRAINT", "LLT_ISSUB", "LLT_LET", "LLT_MODIFIES", "LLT_MUTABLE", "LLT_NOTHING", "LLT_INTERNAL", "LLT_FILESYS", "LLT_OBJ", "LLT_OUT", "LLT_SEF", "LLT_ONLY", "LLT_PARTIAL", "LLT_OWNED", "LLT_DEPENDENT", "LLT_KEEP", "LLT_KEPT", "LLT_TEMP", "LLT_SHARED", "LLT_UNIQUE", "LLT_UNUSED", "LLT_EXITS", "LLT_MAYEXIT", "LLT_NEVEREXIT", "LLT_TRUEEXIT", "LLT_FALSEEXIT", "LLT_UNDEF", "LLT_KILLED", "LLT_CHECKMOD", "LLT_CHECKED", "LLT_UNCHECKED", "LLT_CHECKEDSTRICT", "LLT_TRUENULL", "LLT_FALSENULL", "LLT_LNULL", "LLT_LNOTNULL", "LLT_RETURNED", "LLT_OBSERVER", "LLT_EXPOSED", "LLT_REFCOUNTED", "LLT_REFS", "LLT_RELNULL", "LLT_RELDEF", "LLT_KILLREF", "LLT_NULLTERMINATED", "LLT_TEMPREF", "LLT_NEWREF", "LLT_PRIVATE", "LLT_REQUIRES", "LLT_RESULT", "LLT_SIZEOF", "LLT_SPEC", "LLT_TAGGEDUNION", "LLT_THEN", "LLT_TYPE", "LLT_TYPEDEF", "LLT_UNCHANGED", "LLT_USES", "LLT_CHAR", "LLT_CONST", "LLT_DOUBLE", "LLT_ENUM", "LLT_FLOAT", "LLT_INT", "LLT_ITER", "LLT_YIELD", "LLT_LONG", "LLT_SHORT", "LLT_SIGNED", "LLT_UNKNOWN", "LLT_STRUCT", "LLT_TELIPSIS", "LLT_UNION", "LLT_UNSIGNED", "LLT_VOID", "LLT_VOLATILE", "LLT_PRINTFLIKE", "LLT_SCANFLIKE", "LLT_MESSAGELIKE", "$accept", "interface", "@1", "externals", "external", "optDeclarations", "declarations", "declaration", "imports", "uses", "export", "iter", "iterParamList", "realIterParamList", "iterParam", "private", "@2", "private2", "constDeclaration", "varDeclaration", "type", "special", "fcn", "@3", "@4", "claim", "@5", "abstract", "@6", "@7", "@8", "@9", "@10", "@11", "@12", "@13", "exposed", "@14", "@15", "importNameList", "importName", "interfaceNameList", "interfaceName", "traitRefNodeList", "traitRef", "traitIdList", "renaming", "nameList", "replaceNodeList", "replace", "name", "initializer", "constLclExpr", "initDecls", "initDecl", "globals", "globalDecl", "privateInits", "privateInit", "optLetDecl", "beDeclList", "beDecl", "sortSpec", "optChecks", "optRequire", "optModify", "storeRefList", "storeRef", "optEnsure", "optClaim", "optParamList", "realParamList", "paramList", "optBody", "callExpr", "stmt", "valueList", "value", "abstBody", "fcns", "optTypeInv", "typeInv", "@16", "declaratorInvs", "declaratorInv", "@17", "optExposedBody", "CType", "CTypes", "typeSpecifier", "specialQualifier", "lclTypeSpec", "lclType", "pointers", "structOrUnionSpec", "@18", "@19", "optTagId", "structDecls", "structDecl", "declaratorList", "optCOMMA", "enumSpec", "enumeratorList", "declarator", "notype_decl", "after_type_decl", "parameter_decl", "param", "typeName", "optAbstDeclarator", "abstDeclarator", "arrayQual", "opForm", "open", "close", "anyOp", "middle", "placeList", "separator", "signature", "domain", "sortList", "lclPredicate", "term", "term0", "equalityTerm", "simpleOpTerm", "simpleOp2", "prefixOpTerm", "postfixOps", "infixOpPart", "secondary", "bracketed", "sqBracketed", "matched", "args", "primary", "termList", "stateFcn", "lclPrimary", "cLiteral", "quantifiers", "quantifier", "@20", "quantifiedList", "quantified", "simpleIdOrTypedefName", "fcnId", "varId", "tagId", "claimId", "sortId", "traitId", "opId", 0 }; #endif # ifdef YYPRINT /* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to token YYLEX-NUM. */ static const yytype_uint16 yytoknum[] = { 0, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391 }; # endif /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */ static const yytype_uint16 yyr1[] = { 0, 137, 139, 138, 140, 140, 141, 141, 142, 142, 142, 143, 143, 144, 144, 144, 145, 146, 147, 147, 147, 147, 147, 147, 148, 149, 149, 150, 150, 151, 151, 153, 152, 154, 154, 154, 154, 155, 156, 156, 156, 157, 157, 158, 158, 158, 160, 159, 161, 159, 163, 162, 162, 165, 166, 164, 167, 168, 164, 169, 170, 164, 171, 172, 164, 174, 175, 173, 173, 173, 176, 176, 177, 177, 177, 178, 178, 179, 180, 180, 181, 181, 181, 181, 182, 182, 183, 183, 183, 184, 184, 185, 185, 186, 186, 186, 187, 187, 188, 189, 190, 190, 191, 191, 192, 192, 193, 193, 193, 194, 194, 195, 196, 196, 197, 197, 198, 198, 199, 200, 200, 201, 201, 202, 202, 202, 202, 203, 203, 204, 204, 204, 204, 204, 205, 205, 206, 206, 207, 207, 208, 208, 208, 209, 209, 210, 210, 210, 211, 211, 211, 211, 211, 212, 212, 212, 212, 213, 213, 214, 214, 214, 214, 214, 214, 214, 214, 215, 215, 215, 215, 216, 216, 217, 217, 219, 218, 220, 220, 222, 221, 223, 223, 224, 224, 224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 226, 226, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 227, 228, 228, 228, 228, 228, 229, 229, 230, 230, 232, 231, 233, 231, 231, 231, 234, 234, 235, 235, 236, 237, 237, 238, 238, 239, 239, 240, 240, 241, 241, 242, 242, 242, 242, 242, 242, 243, 243, 243, 243, 243, 243, 244, 244, 244, 244, 244, 245, 245, 245, 246, 246, 246, 247, 247, 248, 248, 248, 248, 248, 248, 248, 248, 249, 249, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 250, 251, 251, 252, 252, 253, 253, 253, 254, 254, 255, 255, 256, 256, 257, 258, 258, 259, 259, 260, 261, 262, 262, 262, 263, 263, 263, 263, 264, 264, 264, 265, 265, 266, 266, 267, 267, 268, 268, 269, 269, 269, 269, 269, 269, 269, 270, 270, 271, 271, 271, 271, 272, 272, 273, 273, 274, 274, 274, 274, 274, 274, 274, 274, 274, 274, 275, 275, 276, 276, 276, 276, 277, 277, 277, 277, 277, 277, 277, 277, 278, 278, 278, 278, 279, 279, 281, 280, 282, 282, 283, 283, 284, 284, 285, 286, 287, 288, 289, 290, 291 }; /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */ static const yytype_uint8 yyr2[] = { 0, 2, 0, 3, 0, 2, 1, 1, 0, 2, 2, 0, 2, 1, 1, 1, 3, 3, 1, 1, 1, 1, 1, 1, 6, 0, 1, 1, 3, 2, 1, 0, 3, 1, 1, 1, 1, 4, 3, 4, 4, 1, 1, 1, 1, 1, 0, 13, 0, 14, 0, 13, 4, 0, 0, 6, 0, 0, 7, 0, 0, 7, 0, 0, 6, 0, 0, 6, 2, 2, 1, 3, 1, 3, 1, 1, 3, 1, 1, 3, 1, 4, 3, 6, 1, 3, 1, 1, 3, 1, 3, 1, 3, 3, 3, 4, 1, 1, 1, 1, 1, 3, 1, 3, 0, 2, 3, 2, 2, 0, 2, 4, 0, 3, 1, 3, 5, 3, 1, 0, 3, 0, 3, 0, 3, 3, 3, 1, 3, 1, 1, 2, 1, 1, 0, 3, 0, 3, 0, 1, 1, 1, 3, 1, 3, 0, 4, 5, 1, 3, 2, 3, 3, 4, 3, 5, 6, 1, 3, 1, 1, 2, 2, 3, 3, 3, 4, 1, 3, 4, 3, 0, 2, 0, 1, 0, 6, 1, 3, 0, 3, 0, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 5, 1, 2, 1, 2, 0, 6, 0, 6, 2, 2, 0, 1, 1, 2, 3, 1, 3, 0, 1, 6, 2, 1, 3, 1, 1, 1, 3, 2, 2, 3, 4, 1, 3, 2, 2, 3, 4, 1, 2, 2, 3, 4, 2, 2, 2, 2, 3, 1, 0, 1, 3, 2, 1, 1, 2, 3, 3, 4, 2, 3, 6, 1, 2, 2, 3, 3, 4, 4, 5, 3, 4, 4, 5, 2, 2, 3, 3, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 3, 1, 1, 4, 0, 1, 1, 3, 1, 1, 6, 1, 3, 1, 4, 3, 3, 1, 2, 2, 1, 1, 1, 2, 1, 2, 2, 3, 1, 1, 2, 2, 3, 1, 2, 3, 1, 5, 3, 4, 2, 3, 2, 1, 3, 3, 1, 4, 1, 2, 3, 3, 3, 4, 3, 1, 3, 1, 1, 1, 1, 1, 1, 4, 4, 4, 4, 6, 4, 1, 1, 1, 1, 1, 2, 0, 3, 1, 3, 3, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state STATE-NUM when YYTABLE doesn't specify something else to do. Zero means the default is an error. */ static const yytype_uint16 yydefact[] = { 4, 0, 2, 1, 0, 0, 8, 5, 6, 7, 0, 407, 406, 74, 0, 70, 72, 77, 0, 0, 78, 413, 80, 0, 195, 0, 0, 62, 53, 197, 199, 200, 229, 201, 202, 203, 204, 211, 212, 213, 198, 206, 207, 210, 208, 209, 231, 232, 214, 215, 216, 217, 218, 225, 226, 227, 205, 228, 221, 222, 219, 220, 224, 230, 223, 31, 0, 184, 0, 185, 248, 186, 187, 0, 188, 189, 190, 192, 248, 248, 191, 183, 0, 43, 44, 45, 3, 11, 23, 11, 18, 19, 20, 0, 21, 22, 41, 42, 193, 196, 233, 0, 0, 234, 235, 0, 16, 0, 0, 84, 17, 0, 0, 221, 238, 0, 234, 235, 408, 411, 0, 0, 0, 0, 0, 0, 59, 0, 65, 0, 0, 410, 258, 409, 0, 242, 246, 244, 247, 0, 9, 10, 0, 194, 236, 0, 0, 269, 0, 100, 104, 262, 261, 263, 68, 69, 73, 71, 0, 82, 79, 345, 346, 0, 322, 320, 315, 0, 0, 316, 321, 0, 0, 0, 87, 86, 91, 286, 89, 285, 322, 299, 319, 240, 239, 0, 0, 138, 0, 102, 0, 0, 0, 0, 32, 33, 34, 35, 36, 0, 0, 0, 25, 0, 0, 0, 12, 15, 13, 14, 104, 265, 271, 0, 0, 38, 0, 0, 46, 0, 0, 266, 0, 272, 85, 0, 311, 324, 0, 323, 312, 0, 322, 0, 322, 300, 0, 286, 81, 0, 0, 290, 0, 283, 287, 291, 0, 0, 301, 241, 0, 52, 141, 0, 139, 140, 286, 143, 37, 63, 54, 0, 0, 66, 177, 179, 39, 259, 255, 0, 0, 26, 27, 30, 0, 0, 40, 48, 264, 270, 101, 0, 0, 400, 409, 396, 397, 394, 395, 0, 0, 0, 387, 0, 0, 103, 98, 0, 99, 334, 336, 338, 0, 342, 347, 354, 358, 361, 353, 373, 386, 0, 398, 414, 371, 0, 0, 0, 0, 105, 0, 296, 0, 267, 0, 273, 0, 0, 307, 327, 326, 0, 313, 0, 314, 0, 302, 0, 284, 88, 90, 92, 0, 289, 0, 0, 0, 292, 94, 93, 97, 96, 317, 318, 303, 237, 104, 0, 290, 0, 275, 281, 280, 282, 0, 0, 57, 60, 0, 0, 181, 256, 0, 29, 0, 0, 0, 0, 250, 0, 0, 365, 368, 0, 0, 0, 0, 0, 0, 0, 0, 367, 0, 0, 0, 0, 348, 347, 349, 343, 344, 355, 359, 0, 0, 0, 0, 382, 383, 384, 0, 385, 356, 374, 0, 399, 0, 107, 108, 109, 0, 297, 268, 274, 83, 308, 325, 309, 304, 0, 294, 288, 293, 0, 329, 95, 305, 50, 142, 144, 276, 290, 0, 277, 167, 171, 64, 55, 0, 0, 178, 67, 173, 180, 260, 257, 24, 28, 0, 253, 243, 251, 245, 109, 0, 363, 0, 370, 401, 402, 0, 380, 0, 0, 0, 195, 0, 0, 0, 132, 133, 0, 0, 127, 130, 129, 366, 337, 341, 340, 351, 350, 0, 412, 360, 375, 377, 0, 376, 379, 357, 0, 333, 0, 112, 106, 310, 306, 0, 295, 0, 330, 331, 0, 278, 0, 0, 0, 75, 0, 58, 61, 175, 0, 174, 252, 0, 112, 364, 0, 369, 0, 0, 0, 388, 0, 0, 393, 391, 389, 131, 0, 390, 352, 378, 339, 372, 0, 0, 110, 119, 298, 0, 0, 112, 279, 170, 0, 0, 168, 172, 0, 0, 182, 254, 119, 362, 403, 0, 404, 118, 381, 0, 0, 128, 0, 114, 0, 0, 0, 121, 328, 332, 121, 76, 169, 104, 0, 121, 405, 335, 392, 113, 0, 0, 0, 0, 0, 0, 123, 145, 0, 123, 115, 0, 117, 111, 120, 0, 0, 134, 0, 134, 0, 134, 0, 122, 0, 0, 0, 0, 136, 0, 0, 176, 136, 116, 125, 124, 126, 0, 0, 0, 0, 409, 0, 148, 0, 0, 51, 0, 135, 0, 47, 0, 150, 0, 0, 146, 0, 0, 49, 137, 0, 149, 147, 152, 151, 0, 0, 154, 0, 157, 159, 0, 160, 408, 0, 161, 0, 0, 153, 162, 0, 0, 164, 158, 163, 165, 0, 155, 0, 166, 156 }; /* YYDEFGOTO[NTERM-NUM]. */ static const yytype_int16 yydefgoto[] = { -1, 1, 6, 2, 7, 86, 140, 206, 8, 207, 208, 88, 270, 271, 272, 209, 127, 194, 90, 91, 92, 93, 94, 318, 380, 95, 513, 96, 124, 365, 125, 448, 193, 449, 123, 364, 97, 199, 369, 14, 15, 517, 16, 19, 20, 108, 173, 174, 175, 176, 348, 295, 296, 148, 149, 218, 319, 504, 549, 550, 575, 576, 569, 580, 599, 610, 482, 483, 621, 632, 253, 344, 255, 612, 656, 636, 661, 662, 446, 519, 523, 524, 562, 263, 264, 370, 453, 98, 99, 100, 101, 256, 484, 184, 116, 203, 204, 130, 377, 378, 458, 372, 117, 268, 189, 151, 152, 362, 257, 178, 243, 244, 245, 179, 297, 354, 181, 228, 229, 466, 435, 510, 511, 501, 502, 299, 300, 301, 302, 303, 399, 400, 304, 305, 306, 307, 383, 308, 472, 413, 309, 310, 311, 312, 385, 468, 469, 313, 664, 314, 132, 121, 494, 22, 315 }; /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing STATE-NUM. */ #define YYPACT_NINF -607 static const yytype_int16 yypact[] = { -607, 50, -29, -607, 198, 89, 1350, -607, -607, -607, 208, -607, -607, -607, 65, -607, -607, -607, 208, 110, -607, -607, 45, 2903, -607, 276, 2903, -607, 18, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, 85, -607, -607, -607, -607, -607, -607, -607, 2903, -607, 2903, -607, 208, -607, -607, 133, -607, -607, -607, -607, 208, 208, -607, -607, 2903, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, 2903, -607, -607, -607, -607, -607, 399, -607, 2903, 336, 155, 192, 185, -607, 198, 268, -607, -607, 89, 1152, -607, 213, 199, -607, -607, 297, -607, 208, 305, 336, 240, 242, 273, -607, 1445, -607, 336, 333, -607, 359, -607, 369, -607, 359, -607, 359, 336, 1247, 1247, 336, -607, -607, 336, 336, -607, 139, -607, 145, 416, 422, -607, -607, -607, -607, -607, 208, 388, -607, -607, -607, 208, 360, -607, -607, 208, 471, -607, -607, 376, 2903, 398, 393, 406, -607, 347, 387, -607, 360, 445, -607, -607, 456, 2903, 476, 2319, 143, 457, 474, 484, 397, 404, -607, -607, -607, -607, -607, 336, 150, 481, 2414, 477, 488, 166, -607, -607, -607, -607, -607, 416, 422, 239, 279, -607, 336, 3150, 1836, 272, 1933, -607, 2030, -607, -607, 1152, -607, -607, 482, 224, -607, 208, 360, 208, 360, 501, 418, 347, -607, 1152, 1152, 347, 1741, -607, 433, -607, 453, 118, -607, -607, 524, -607, -607, 496, -607, 503, 435, -607, -607, -607, -607, 517, 519, 508, -607, -607, -607, -607, 509, 2903, 505, 512, -607, -607, 2903, 2903, -607, 1836, -607, -607, -607, 3059, 3150, -607, 297, -607, -607, -607, -607, 533, 3150, 534, -607, 535, 536, -607, -607, 3033, -607, 537, -607, 304, 3200, -607, 329, 1155, 1155, 521, 654, -607, -607, 188, -607, -607, -607, 538, 547, 548, 522, -607, 336, -607, 523, -607, 527, -607, 528, 529, 540, -607, -607, 541, -607, 525, -607, 118, -607, 543, -607, 406, 387, -607, 387, 433, 539, 292, 2127, -607, 544, -607, -607, -607, -607, -607, 545, -607, -607, 2509, 435, 1644, -607, 416, 446, -607, 35, 35, -607, -607, 336, 553, 549, 556, 551, -607, 580, 2414, 336, 2611, -607, 2713, 554, 559, -607, 381, 44, 133, 3150, -1, 3150, 1022, 762, -607, 375, 3150, 3200, 3200, -607, -607, 335, 329, 329, 236, 236, 208, 208, 3109, 208, -607, -607, -607, 208, -607, 1155, -607, 3150, -607, 3150, -607, -607, -607, 189, -607, -607, -607, -607, -607, -607, 564, 565, 550, -607, -607, -607, 557, 208, -607, -607, 1836, -607, -607, 446, 459, 2224, -607, -607, 182, -607, -607, 35, 35, -607, -607, 542, -607, -607, -607, -607, -607, 197, -607, -607, -607, -607, -607, 208, 567, 3150, -607, 563, -607, 568, 537, 293, 3150, 570, 584, 566, 573, 574, -607, -607, 2903, 312, -607, -607, -607, -607, -607, -607, -607, -607, -607, 335, -607, -607, -607, -607, 394, -607, -607, 236, 575, -607, 331, -15, -607, -607, -607, 578, -607, 588, 583, -607, 582, -607, 586, 610, 247, -607, 1547, -607, -607, -607, 585, -607, -607, 336, -15, -607, 208, -607, 133, 2808, 3150, -607, 25, 3150, -607, -607, -607, -607, 892, -607, -607, -607, -607, -607, 133, 2903, -607, 577, -607, 208, 208, 569, -607, -607, 208, 617, -607, -607, 336, 606, -607, -607, 577, -607, -607, 2903, -607, -607, 537, 3150, 594, -607, 270, -607, 77, 336, 3150, 530, -607, -607, 530, -607, -607, -607, 625, 530, -607, 537, -607, -607, 133, 2903, 3150, 278, 634, 3150, 581, 592, 3150, 581, -607, 599, -607, -607, -607, 639, 632, 595, 614, 595, 612, 595, 3150, -607, 643, 644, 288, 3150, 607, 181, 621, -607, 607, -607, -607, -607, -607, 651, 3150, 624, 181, 648, 126, -607, 649, 629, -607, 628, -607, 660, -607, 48, -607, 299, 181, -607, 212, 645, -607, -607, 181, -607, -607, 661, -607, 202, 202, -607, 351, 665, -607, 659, -607, -607, 666, -607, 43, 202, -607, 246, 379, 411, -607, 665, -607, -607, 358, -607, 365, -607, -607 }; /* YYPGOTO[NTERM-NUM]. */ static const yytype_int16 yypgoto[] = { -607, -607, -607, -607, -607, -607, 590, -607, -607, 679, 683, -607, -607, -607, 315, 687, -607, -607, 591, 608, 611, -607, -123, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, -607, 587, -607, -8, -607, 626, -607, 516, -607, 504, 502, -607, -607, 526, -110, 531, -190, -607, 281, -607, -483, -607, 156, -520, 190, -159, 152, 157, 220, -353, 142, -607, -182, -607, -607, -554, -607, -185, -606, -322, -607, -607, -607, -607, -607, 401, -607, -607, -91, -607, -607, -607, -5, -20, -607, 29, -607, -607, 417, 497, -6, -607, -607, 54, -607, -95, -119, 353, 413, -178, 261, -137, -210, -22, 532, -14, -248, 609, -121, -607, 546, -607, -607, -607, -528, -203, -265, -607, 108, -101, 478, -607, -607, -280, 468, -607, -607, 489, -269, -285, -607, -607, -308, -607, -305, -607, -607, 248, 5, -25, -40, 434, 668, -369, 16, 552 }; /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If positive, shift that token. If negative, reduce the rule which number is the opposite. If zero, do what YYDEFACT says. If YYTABLE_NINF, syntax error. */ #define YYTABLE_NINF -409 static const yytype_int16 yytable[] = { 120, 102, 105, 115, 198, 254, 415, 150, 143, 17, 21, 182, 188, 393, 298, 17, 298, 384, 114, 200, 277, 122, 397, 21, 273, 387, 211, 213, 4, 205, 119, 343, 345, 134, 109, 103, 401, 402, 324, 393, 326, 499, 444, 447, 565, 547, 672, 210, 589, 391, 3, 597, 668, 669, 645, 653, 647, 112, 393, 247, 104, 128, 153, 129, 676, 512, 677, 182, 635, 445, 608, 583, 106, 613, 604, 131, 572, 139, 382, 644, 675, 467, 153, 131, 131, 654, 5, 428, 142, 153, 548, 373, 630, 657, 382, 528, 144, 107, 180, 153, 338, 18, 153, 642, 265, 153, 153, 177, 594, 11, 473, 333, 17, 335, 12, -56, 21, 110, 490, 363, 497, 471, 102, 595, 182, 119, 520, 521, 487, 221, 223, 503, 645, 646, 647, 102, 102, 361, 182, 182, 471, 352, 111, 500, 486, 182, 215, 126, 343, 345, 258, 471, -102, 353, 234, 349, 103, 266, 133, 153, 566, 648, 154, 21, 433, 250, 437, 237, 226, 103, 103, 216, 230, 276, 224, 216, 153, -102, 217, 439, 114, 104, 216, 581, 582, 474, 477, 485, 156, 221, 223, 221, 223, 633, 104, 104, 505, 273, 216, 155, 414, 10, 11, 398, 525, 658, 634, 12, 535, 283, 420, 180, 543, 320, 659, 658, 153, 516, 11, 183, 177, 216, 347, 12, 659, 180, 180, 634, 11, 526, 185, 343, 180, 12, 177, 177, 332, 634, 334, 211, 213, 13, 285, 286, 287, 288, 404, 405, 329, 660, 219, 220, 285, 286, 287, 288, 330, 587, 659, 623, 515, 625, 406, 530, 407, 408, 409, 410, 571, 376, 376, 634, 320, 265, 411, 161, 278, 592, 162, 557, 153, 459, 558, 281, 282, 606, 285, 286, 287, 288, 219, 222, 11, 283, 166, 629, 11, 284, 491, 492, 158, 118, 593, 219, 346, 159, 169, 590, 321, -406, 216, 633, 285, 286, 287, 288, 279, 187, 153, 153, 541, 347, 211, 347, 634, 533, 289, 290, 153, 431, 534, 291, 161, 573, 655, 162, 153, 394, 485, 221, 443, 663, 145, 395, 541, 470, 281, 282, 146, 542, 663, 663, 190, 241, 191, 11, 147, 166, 219, 242, 284, 133, 663, 533, 663, 663, 663, 201, 546, 169, 192, 461, 376, 461, 376, 285, 286, 287, 288, 292, 293, 202, 658, 670, 476, 114, 294, 227, 671, 289, 670, 659, 605, -249, 291, 682, 560, 670, 352, 329, 225, 153, 683, 236, 634, 329, 485, 330, 493, 495, 353, 498, 626, 330, 658, 493, 678, 465, 443, 285, 286, 287, 288, 659, 600, 239, 533, 219, 220, 602, 544, 564, 320, 219, 222, 238, 634, 518, 240, 493, 246, 358, 292, 293, 219, 346, 219, 359, 680, 294, 17, 285, 286, 287, 288, 360, 161, 219, 442, 162, 133, 540, 249, 163, 164, 441, 586, 165, 596, 493, 219, 359, 248, 11, 161, 166, 114, 162, 12, 167, 168, 231, 232, 251, 133, 165, 153, 169, 679, 681, 217, 470, 170, 166, 259, 135, 137, 233, 212, 214, 340, 342, 488, 489, 260, 169, 267, 577, 171, 261, 170, 274, 136, 138, 561, 67, 262, 69, 328, 71, 72, 153, 275, 74, 75, 76, 77, 570, 336, 337, 80, 81, 355, 356, 493, 357, 114, 366, 153, 367, 368, 371, 374, 578, 375, 386, 388, 389, 390, 584, 416, 393, 403, 577, 417, 418, 419, 493, 493, 421, 451, 427, 17, 570, 422, 423, 424, 425, 426, 67, 429, 69, 436, 71, 72, 434, 430, 74, 75, 76, 77, 454, 638, 452, 80, 81, 455, 456, 463, 570, 464, 506, 507, 638, 509, 531, -407, 637, 529, 532, 522, 508, 536, 537, 114, 551, 638, 638, 637, 665, 538, 539, 545, 638, 552, 553, 554, 556, 665, 665, 563, 637, 637, 555, 585, 667, 579, 283, 637, 547, 665, 591, 665, 665, 665, 161, 598, 601, 162, 611, 23, 607, 609, 281, 282, 615, 616, 620, 622, 624, 627, 628, 475, 283, 166, 631, 639, 284, 641, 643, -408, 649, 650, 651, 404, 405, 169, 652, 672, 647, 666, 673, 285, 286, 287, 288, 166, 617, 674, 141, 406, 9, 407, 408, 409, 410, 289, 290, 169, 87, 457, 291, 411, 89, 157, 618, 479, 480, 481, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 195, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 196, 64, 160, 197, 292, 293, 327, 341, 339, 527, 322, 294, 280, 67, 603, 69, 70, 71, 72, 614, 588, 74, 75, 76, 77, 78, 574, 79, 80, 81, 161, 619, 640, 162, 450, 23, 440, 379, 281, 282, 331, 412, 235, 350, 567, 396, 0, 475, 283, 166, 0, 392, 284, 186, 0, 0, 0, 0, 0, 0, 0, 169, 0, 351, 0, 0, 0, 285, 286, 287, 288, 478, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 290, 0, 0, 0, 291, 0, 0, 0, 0, 479, 480, 481, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 23, 0, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 475, 283, 166, 0, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 290, 0, 0, 0, 291, 0, 0, 0, 0, 479, 480, 481, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 23, 0, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 475, 283, 166, 0, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 290, 0, 0, 0, 291, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 23, 0, 163, 164, 0, 0, 165, 282, 0, 0, 0, 0, 24, 0, 166, 11, 0, 0, 167, 168, 284, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 170, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 171, 0, 289, 0, 0, 0, 0, 291, 0, 0, 0, 172, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 292, 293, 0, 0, 0, 24, 67, 294, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 26, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 65, 0, 23, 0, 66, 0, 5, 67, 68, 69, 70, 71, 72, 73, 24, 74, 75, 76, 77, 78, 0, 79, 80, 81, 82, 83, 84, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 26, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 65, 0, 0, 0, 66, 0, 24, 67, 68, 69, 70, 71, 72, 73, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 82, 83, 84, 85, 0, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0, 0, 0, 0, 27, 0, 0, 0, 0, 0, 28, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 23, 0, 0, 66, 0, 0, 67, 68, 69, 70, 71, 72, 24, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 82, 83, 84, 85, 559, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 441, 64, 23, 0, 0, 219, 359, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 133, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 83, 84, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 241, 64, 23, 0, 0, 219, 242, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 316, 317, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 323, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 325, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 432, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 23, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 24, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 514, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 252, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 269, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 67, 0, 69, 70, 71, 72, 24, 0, 74, 75, 76, 77, 78, 438, 79, 80, 81, 0, 0, 0, 0, 460, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 67, 0, 69, 70, 71, 72, 24, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 462, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 568, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 23, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 0, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 113, 59, 60, 61, 62, 63, 0, 64, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 67, 0, 69, 70, 71, 72, 0, 0, 74, 75, 76, 77, 78, 0, 79, 80, 81, 161, 0, 0, 162, 0, 0, 0, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 11, 283, 166, 352, 0, 284, 0, 0, 0, 161, 0, 0, 162, 0, 169, 353, 0, 281, 282, 0, 285, 286, 287, 288, 0, 0, 11, 283, 166, 0, 0, 284, 0, 0, 289, 290, 0, 0, 0, 291, 169, 0, 381, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, 289, 290, 162, 0, 0, 291, 0, 281, 282, 0, 0, 0, 0, 0, 0, 0, 11, 283, 166, 0, 0, 284, 0, 0, 0, 0, 0, 292, 293, 0, 169, 0, 496, 0, 294, 0, 285, 286, 287, 288, 161, 0, 0, 162, 0, 0, 0, 0, 281, 282, 289, 290, 0, 292, 293, 291, 0, 11, 283, 166, 294, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 161, 289, 290, 162, 0, 0, 291, 0, 281, 282, 0, 0, 0, 292, 293, 0, 0, 11, 0, 166, 294, 0, 284, 0, 0, 0, 0, 0, 0, 0, 0, 169, 0, 0, 0, 0, 0, 285, 286, 287, 288, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 289, 0, 0, 292, 293, 291, 0, 0, 0, 0, 294, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 292, 293, 0, 0, 0, 0, 0, 294 }; static const yytype_int16 yycheck[] = { 25, 6, 10, 23, 127, 187, 311, 102, 99, 4, 5, 112, 122, 14, 217, 10, 219, 282, 23, 129, 210, 26, 302, 18, 202, 290, 145, 146, 57, 139, 25, 241, 242, 73, 18, 6, 305, 306, 220, 14, 222, 410, 7, 365, 527, 60, 3, 142, 568, 297, 0, 579, 658, 659, 6, 7, 8, 12, 14, 180, 6, 66, 102, 68, 670, 434, 672, 168, 622, 34, 598, 554, 7, 601, 594, 70, 51, 82, 281, 633, 37, 37, 122, 78, 79, 37, 115, 335, 93, 129, 105, 269, 620, 647, 297, 464, 101, 32, 112, 139, 237, 12, 142, 631, 199, 145, 146, 112, 31, 20, 111, 232, 107, 234, 25, 97, 111, 7, 398, 256, 405, 386, 127, 46, 225, 120, 448, 449, 393, 151, 152, 416, 6, 7, 8, 140, 141, 256, 239, 240, 405, 23, 32, 412, 392, 246, 7, 62, 358, 359, 7, 416, 7, 35, 168, 246, 127, 7, 25, 199, 529, 35, 7, 158, 346, 185, 356, 172, 163, 140, 141, 32, 167, 7, 158, 32, 216, 32, 33, 357, 185, 127, 32, 552, 553, 388, 389, 390, 3, 211, 212, 213, 214, 12, 140, 141, 7, 375, 32, 7, 12, 3, 20, 304, 7, 3, 25, 25, 473, 21, 320, 225, 492, 218, 12, 3, 256, 35, 20, 6, 225, 32, 244, 25, 12, 239, 240, 25, 20, 32, 31, 441, 246, 25, 239, 240, 231, 25, 233, 358, 359, 43, 40, 41, 42, 43, 10, 11, 24, 37, 11, 12, 40, 41, 42, 43, 32, 562, 12, 612, 442, 614, 26, 466, 28, 29, 30, 31, 533, 274, 275, 25, 277, 368, 38, 3, 37, 7, 6, 32, 320, 376, 35, 11, 12, 7, 40, 41, 42, 43, 11, 12, 20, 21, 22, 7, 20, 25, 399, 400, 32, 25, 32, 11, 12, 37, 34, 572, 36, 12, 32, 12, 40, 41, 42, 43, 37, 12, 358, 359, 32, 343, 441, 345, 25, 32, 54, 55, 368, 37, 37, 59, 3, 536, 35, 6, 376, 33, 541, 361, 362, 649, 6, 39, 32, 385, 11, 12, 12, 37, 658, 659, 112, 6, 112, 20, 20, 22, 11, 12, 25, 25, 670, 32, 672, 673, 674, 34, 37, 34, 97, 377, 377, 379, 379, 40, 41, 42, 43, 107, 108, 12, 3, 32, 389, 390, 114, 27, 37, 54, 32, 12, 595, 34, 59, 37, 519, 32, 23, 24, 12, 441, 37, 27, 25, 24, 609, 32, 403, 404, 35, 406, 615, 32, 3, 410, 37, 36, 440, 40, 41, 42, 43, 12, 583, 32, 32, 11, 12, 588, 36, 526, 437, 11, 12, 37, 25, 445, 32, 434, 53, 6, 107, 108, 11, 12, 11, 12, 37, 114, 445, 40, 41, 42, 43, 20, 3, 11, 12, 6, 25, 481, 6, 10, 11, 6, 561, 14, 578, 464, 11, 12, 27, 20, 3, 22, 481, 6, 25, 26, 27, 10, 11, 7, 25, 14, 526, 34, 673, 674, 33, 531, 39, 22, 20, 78, 79, 26, 145, 146, 239, 240, 394, 395, 20, 34, 25, 547, 55, 112, 39, 34, 78, 79, 519, 116, 112, 118, 36, 120, 121, 561, 34, 124, 125, 126, 127, 532, 27, 111, 131, 132, 8, 37, 529, 32, 541, 20, 578, 20, 32, 32, 37, 548, 32, 12, 12, 12, 12, 557, 12, 14, 31, 593, 7, 7, 34, 552, 553, 36, 7, 36, 557, 568, 37, 37, 37, 27, 27, 116, 27, 118, 27, 120, 121, 31, 37, 124, 125, 126, 127, 25, 622, 34, 131, 132, 35, 7, 34, 594, 31, 27, 27, 633, 37, 32, 12, 622, 31, 31, 58, 51, 32, 37, 609, 27, 646, 647, 633, 649, 37, 37, 37, 653, 26, 32, 34, 7, 658, 659, 35, 646, 647, 37, 7, 650, 49, 21, 653, 60, 670, 37, 672, 673, 674, 3, 106, 12, 6, 47, 8, 7, 61, 11, 12, 46, 7, 52, 34, 37, 7, 7, 20, 21, 22, 48, 35, 25, 7, 35, 12, 12, 33, 35, 10, 11, 34, 7, 3, 8, 25, 12, 40, 41, 42, 43, 22, 45, 12, 89, 26, 2, 28, 29, 30, 31, 54, 55, 34, 6, 375, 59, 38, 6, 107, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 127, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 127, 104, 111, 127, 107, 108, 225, 240, 239, 463, 219, 114, 216, 116, 593, 118, 119, 120, 121, 602, 565, 124, 125, 126, 127, 128, 541, 130, 131, 132, 3, 609, 625, 6, 368, 8, 358, 275, 11, 12, 229, 308, 168, 246, 531, 302, -1, 20, 21, 22, -1, 297, 25, 120, -1, -1, -1, -1, -1, -1, -1, 34, -1, 246, -1, -1, -1, 40, 41, 42, 43, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, 55, -1, -1, -1, 59, -1, -1, -1, -1, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, 55, -1, -1, -1, 59, -1, -1, -1, -1, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, 55, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, 8, -1, 10, 11, -1, -1, 14, 12, -1, -1, -1, -1, 20, -1, 22, 20, -1, -1, 26, 27, 25, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, 39, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, 54, -1, -1, -1, -1, 59, -1, -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, 107, 108, -1, -1, -1, 20, 116, 114, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, 50, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, 109, -1, 8, -1, 113, -1, 115, 116, 117, 118, 119, 120, 121, 122, 20, 124, 125, 126, 127, 128, -1, 130, 131, 132, 133, 134, 135, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48, -1, 50, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, 109, -1, -1, -1, 113, -1, 20, 116, 117, 118, 119, 120, 121, 122, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 133, 134, 135, 136, -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, 8, -1, -1, 113, -1, -1, 116, 117, 118, 119, 120, 121, 20, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 133, 134, 135, 136, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 6, 104, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, 25, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, 134, 135, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 6, 104, 8, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, 65, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, 20, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, 123, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, 116, -1, 118, 119, 120, 121, 20, -1, 124, 125, 126, 127, 128, 129, 130, 131, 132, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1, 116, -1, 118, 119, 120, 121, 20, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 8, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, -1, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, -1, 104, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, 118, 119, 120, 121, -1, -1, 124, 125, 126, 127, 128, -1, 130, 131, 132, 3, -1, -1, 6, -1, -1, -1, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, 23, -1, 25, -1, -1, -1, 3, -1, -1, 6, -1, 34, 35, -1, 11, 12, -1, 40, 41, 42, 43, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, 54, 55, -1, -1, -1, 59, 34, -1, 36, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 54, 55, 6, -1, -1, 59, -1, 11, 12, -1, -1, -1, -1, -1, -1, -1, 20, 21, 22, -1, -1, 25, -1, -1, -1, -1, -1, 107, 108, -1, 34, -1, 36, -1, 114, -1, 40, 41, 42, 43, 3, -1, -1, 6, -1, -1, -1, -1, 11, 12, 54, 55, -1, 107, 108, 59, -1, 20, 21, 22, 114, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, 54, 55, 6, -1, -1, 59, -1, 11, 12, -1, -1, -1, 107, 108, -1, -1, 20, -1, 22, 114, -1, 25, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, 40, 41, 42, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, 107, 108, 59, -1, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, 108, -1, -1, -1, -1, -1, 114 }; /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing symbol of state STATE-NUM. */ static const yytype_uint16 yystos[] = { 0, 138, 140, 0, 57, 115, 139, 141, 145, 146, 3, 20, 25, 43, 176, 177, 179, 284, 12, 180, 181, 284, 290, 8, 20, 48, 50, 56, 62, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 104, 109, 113, 116, 117, 118, 119, 120, 121, 122, 124, 125, 126, 127, 128, 130, 131, 132, 133, 134, 135, 136, 142, 147, 148, 152, 155, 156, 157, 158, 159, 162, 164, 173, 224, 225, 226, 227, 228, 231, 239, 179, 7, 32, 182, 290, 7, 32, 12, 97, 228, 229, 231, 239, 25, 284, 285, 288, 228, 171, 165, 167, 62, 153, 228, 228, 234, 284, 287, 25, 286, 234, 287, 234, 287, 228, 143, 143, 228, 224, 228, 6, 12, 20, 190, 191, 241, 242, 243, 286, 7, 7, 3, 177, 32, 37, 181, 3, 6, 10, 11, 14, 22, 26, 27, 34, 39, 55, 66, 183, 184, 185, 186, 228, 246, 250, 251, 253, 265, 6, 230, 31, 288, 12, 190, 241, 112, 112, 97, 169, 154, 155, 156, 157, 159, 174, 190, 34, 12, 232, 233, 190, 144, 146, 147, 152, 241, 242, 243, 242, 243, 7, 32, 33, 192, 11, 12, 249, 12, 249, 290, 12, 284, 27, 254, 255, 284, 10, 11, 26, 251, 253, 27, 228, 37, 32, 32, 6, 12, 247, 248, 249, 53, 254, 27, 6, 229, 7, 129, 207, 208, 209, 228, 245, 7, 20, 20, 112, 112, 220, 221, 241, 7, 25, 240, 123, 149, 150, 151, 245, 34, 34, 7, 192, 37, 37, 191, 11, 12, 21, 25, 40, 41, 42, 43, 54, 55, 59, 107, 108, 114, 188, 189, 251, 261, 262, 263, 264, 265, 266, 269, 270, 271, 272, 274, 277, 278, 279, 280, 284, 286, 291, 64, 65, 160, 193, 228, 36, 189, 37, 208, 37, 208, 183, 36, 24, 32, 256, 284, 254, 284, 254, 27, 111, 247, 185, 246, 186, 246, 248, 208, 248, 12, 249, 187, 224, 250, 291, 23, 35, 252, 8, 37, 32, 6, 12, 20, 242, 244, 247, 172, 166, 20, 20, 32, 175, 222, 32, 238, 245, 37, 32, 228, 235, 236, 235, 161, 36, 261, 273, 262, 281, 12, 262, 12, 12, 12, 252, 273, 14, 33, 39, 266, 269, 265, 267, 268, 274, 274, 31, 10, 11, 26, 28, 29, 30, 31, 38, 270, 276, 12, 280, 12, 7, 7, 34, 190, 36, 37, 37, 37, 27, 27, 36, 252, 27, 37, 37, 37, 208, 31, 257, 27, 192, 129, 245, 244, 6, 12, 249, 7, 34, 215, 215, 168, 170, 221, 7, 34, 223, 25, 35, 7, 151, 237, 241, 35, 236, 35, 34, 31, 36, 256, 37, 282, 283, 286, 262, 275, 111, 261, 20, 228, 261, 44, 64, 65, 66, 203, 204, 229, 261, 252, 262, 264, 264, 269, 265, 265, 284, 289, 284, 36, 275, 284, 289, 274, 260, 261, 275, 194, 7, 27, 27, 51, 37, 258, 259, 289, 163, 37, 208, 35, 178, 179, 216, 215, 215, 58, 217, 218, 7, 32, 194, 289, 31, 261, 32, 31, 32, 37, 262, 32, 37, 37, 37, 229, 32, 37, 269, 36, 37, 37, 60, 105, 195, 196, 27, 26, 32, 34, 37, 7, 32, 35, 35, 159, 228, 219, 35, 241, 196, 289, 283, 66, 199, 228, 262, 51, 261, 204, 197, 198, 286, 228, 49, 200, 289, 289, 196, 179, 7, 241, 280, 200, 199, 262, 37, 7, 32, 31, 46, 190, 260, 106, 201, 201, 12, 201, 198, 199, 261, 7, 7, 260, 61, 202, 47, 210, 260, 202, 46, 7, 45, 63, 203, 52, 205, 34, 205, 37, 205, 261, 7, 7, 7, 260, 48, 206, 12, 25, 211, 212, 285, 286, 35, 206, 7, 260, 35, 211, 6, 7, 8, 35, 12, 33, 35, 7, 7, 37, 35, 211, 211, 3, 12, 37, 213, 214, 278, 285, 286, 25, 285, 214, 214, 32, 37, 3, 12, 12, 37, 214, 214, 37, 213, 37, 213, 37, 37 }; #define yyerrok (yyerrstatus = 0) #define yyclearin (yychar = YYEMPTY) #define YYEMPTY (-2) #define YYEOF 0 #define YYACCEPT goto yyacceptlab #define YYABORT goto yyabortlab #define YYERROR goto yyerrorlab /* Like YYERROR except do call yyerror. This remains here temporarily to ease the transition to the new meaning of YYERROR, for GCC. Once GCC version 2 has supplanted version 1, this can go. */ #define YYFAIL goto yyerrlab #define YYRECOVERING() (!!yyerrstatus) #define YYBACKUP(Token, Value) \ do \ if (yychar == YYEMPTY && yylen == 1) \ { \ yychar = (Token); \ yylval = (Value); \ yytoken = YYTRANSLATE (yychar); \ YYPOPSTACK (1); \ goto yybackup; \ } \ else \ { \ yyerror (YY_("syntax error: cannot back up")); \ YYERROR; \ } \ while (YYID (0)) #define YYTERROR 1 #define YYERRCODE 256 /* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N]. If N is 0, then set CURRENT to the empty location which ends the previous symbol: RHS[0] (always defined). */ #define YYRHSLOC(Rhs, K) ((Rhs)[K]) #ifndef YYLLOC_DEFAULT # define YYLLOC_DEFAULT(Current, Rhs, N) \ do \ if (YYID (N)) \ { \ (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \ (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \ (Current).last_line = YYRHSLOC (Rhs, N).last_line; \ (Current).last_column = YYRHSLOC (Rhs, N).last_column; \ } \ else \ { \ (Current).first_line = (Current).last_line = \ YYRHSLOC (Rhs, 0).last_line; \ (Current).first_column = (Current).last_column = \ YYRHSLOC (Rhs, 0).last_column; \ } \ while (YYID (0)) #endif /* YY_LOCATION_PRINT -- Print the location on the stream. This macro was not mandated originally: define only if we know we won't break user code: when these are the locations we know. */ #ifndef YY_LOCATION_PRINT # if YYLTYPE_IS_TRIVIAL # define YY_LOCATION_PRINT(File, Loc) \ fprintf (File, "%d.%d-%d.%d", \ (Loc).first_line, (Loc).first_column, \ (Loc).last_line, (Loc).last_column) # else # define YY_LOCATION_PRINT(File, Loc) ((void) 0) # endif #endif /* YYLEX -- calling `yylex' with the right arguments. */ #ifdef YYLEX_PARAM # define YYLEX yylex (YYLEX_PARAM) #else # define YYLEX yylex () #endif /* Enable debugging if requested. */ #if YYDEBUG # ifndef YYFPRINTF # include /* INFRINGES ON USER NAME SPACE */ # define YYFPRINTF fprintf # endif # define YYDPRINTF(Args) \ do { \ if (yydebug) \ YYFPRINTF Args; \ } while (YYID (0)) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \ do { \ if (yydebug) \ { \ YYFPRINTF (stderr, "%s ", Title); \ yy_symbol_print (stderr, \ Type, Value); \ YYFPRINTF (stderr, "\n"); \ } \ } while (YYID (0)) /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_value_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (!yyvaluep) return; # ifdef YYPRINT if (yytype < YYNTOKENS) YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep); # else YYUSE (yyoutput); # endif switch (yytype) { default: break; } } /*--------------------------------. | Print this symbol on YYOUTPUT. | `--------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep) #else static void yy_symbol_print (yyoutput, yytype, yyvaluep) FILE *yyoutput; int yytype; YYSTYPE const * const yyvaluep; #endif { if (yytype < YYNTOKENS) YYFPRINTF (yyoutput, "token %s (", yytname[yytype]); else YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]); yy_symbol_value_print (yyoutput, yytype, yyvaluep); YYFPRINTF (yyoutput, ")"); } /*------------------------------------------------------------------. | yy_stack_print -- Print the state stack from its BOTTOM up to its | | TOP (included). | `------------------------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) #else static void yy_stack_print (bottom, top) yytype_int16 *bottom; yytype_int16 *top; #endif { YYFPRINTF (stderr, "Stack now"); for (; bottom <= top; ++bottom) YYFPRINTF (stderr, " %d", *bottom); YYFPRINTF (stderr, "\n"); } # define YY_STACK_PRINT(Bottom, Top) \ do { \ if (yydebug) \ yy_stack_print ((Bottom), (Top)); \ } while (YYID (0)) /*------------------------------------------------. | Report that the YYRULE is going to be reduced. | `------------------------------------------------*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yy_reduce_print (YYSTYPE *yyvsp, int yyrule) #else static void yy_reduce_print (yyvsp, yyrule) YYSTYPE *yyvsp; int yyrule; #endif { int yynrhs = yyr2[yyrule]; int yyi; unsigned long int yylno = yyrline[yyrule]; YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n", yyrule - 1, yylno); /* The symbols being reduced. */ for (yyi = 0; yyi < yynrhs; yyi++) { fprintf (stderr, " $%d = ", yyi + 1); yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], &(yyvsp[(yyi + 1) - (yynrhs)]) ); fprintf (stderr, "\n"); } } # define YY_REDUCE_PRINT(Rule) \ do { \ if (yydebug) \ yy_reduce_print (yyvsp, Rule); \ } while (YYID (0)) /* Nonzero means print parse trace. It is left uninitialized so that multiple parsers can coexist. */ int yydebug; #else /* !YYDEBUG */ # define YYDPRINTF(Args) # define YY_SYMBOL_PRINT(Title, Type, Value, Location) # define YY_STACK_PRINT(Bottom, Top) # define YY_REDUCE_PRINT(Rule) #endif /* !YYDEBUG */ /* YYINITDEPTH -- initial size of the parser's stacks. */ #ifndef YYINITDEPTH # define YYINITDEPTH 200 #endif /* YYMAXDEPTH -- maximum size the stacks can grow to (effective only if the built-in stack extension method is used). Do not make this value too large; the results are undefined if YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH) evaluated with infinite-precision integer arithmetic. */ #ifndef YYMAXDEPTH # define YYMAXDEPTH 10000 #endif #if YYERROR_VERBOSE # ifndef yystrlen # if defined __GLIBC__ && defined _STRING_H # define yystrlen strlen # else /* Return the length of YYSTR. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static YYSIZE_T yystrlen (const char *yystr) #else static YYSIZE_T yystrlen (yystr) const char *yystr; #endif { YYSIZE_T yylen; for (yylen = 0; yystr[yylen]; yylen++) continue; return yylen; } # endif # endif # ifndef yystpcpy # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE # define yystpcpy stpcpy # else /* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in YYDEST. */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static char * yystpcpy (char *yydest, const char *yysrc) #else static char * yystpcpy (yydest, yysrc) char *yydest; const char *yysrc; #endif { char *yyd = yydest; const char *yys = yysrc; while ((*yyd++ = *yys++) != '\0') continue; return yyd - 1; } # endif # endif # ifndef yytnamerr /* Copy to YYRES the contents of YYSTR after stripping away unnecessary quotes and backslashes, so that it's suitable for yyerror. The heuristic is that double-quoting is unnecessary unless the string contains an apostrophe, a comma, or backslash (other than backslash-backslash). YYSTR is taken from yytname. If YYRES is null, do not copy; instead, return the length of what the result would have been. */ static YYSIZE_T yytnamerr (char *yyres, const char *yystr) { if (*yystr == '"') { YYSIZE_T yyn = 0; char const *yyp = yystr; for (;;) switch (*++yyp) { case '\'': case ',': goto do_not_strip_quotes; case '\\': if (*++yyp != '\\') goto do_not_strip_quotes; /* Fall through. */ default: if (yyres) yyres[yyn] = *yyp; yyn++; break; case '"': if (yyres) yyres[yyn] = '\0'; return yyn; } do_not_strip_quotes: ; } if (! yyres) return yystrlen (yystr); return yystpcpy (yyres, yystr) - yyres; } # endif /* Copy into YYRESULT an error message about the unexpected token YYCHAR while in state YYSTATE. Return the number of bytes copied, including the terminating null byte. If YYRESULT is null, do not copy anything; just return the number of bytes that would be copied. As a special case, return 0 if an ordinary "syntax error" message will do. Return YYSIZE_MAXIMUM if overflow occurs during size calculation. */ static YYSIZE_T yysyntax_error (char *yyresult, int yystate, int yychar) { int yyn = yypact[yystate]; if (! (YYPACT_NINF < yyn && yyn <= YYLAST)) return 0; else { int yytype = YYTRANSLATE (yychar); YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]); YYSIZE_T yysize = yysize0; YYSIZE_T yysize1; int yysize_overflow = 0; enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 }; char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM]; int yyx; # if 0 /* This is so xgettext sees the translatable formats that are constructed on the fly. */ YY_("syntax error, unexpected %s"); YY_("syntax error, unexpected %s, expecting %s"); YY_("syntax error, unexpected %s, expecting %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s"); YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"); # endif char *yyfmt; char const *yyf; static char const yyunexpected[] = "syntax error, unexpected %s"; static char const yyexpecting[] = ", expecting %s"; static char const yyor[] = " or %s"; char yyformat[sizeof yyunexpected + sizeof yyexpecting - 1 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2) * (sizeof yyor - 1))]; char const *yyprefix = yyexpecting; /* Start YYX at -YYN if negative to avoid negative indexes in YYCHECK. */ int yyxbegin = yyn < 0 ? -yyn : 0; /* Stay within bounds of both yycheck and yytname. */ int yychecklim = YYLAST - yyn + 1; int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS; int yycount = 1; yyarg[0] = yytname[yytype]; yyfmt = yystpcpy (yyformat, yyunexpected); for (yyx = yyxbegin; yyx < yyxend; ++yyx) if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR) { if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM) { yycount = 1; yysize = yysize0; yyformat[sizeof yyunexpected - 1] = '\0'; break; } yyarg[yycount++] = yytname[yyx]; yysize1 = yysize + yytnamerr (0, yytname[yyx]); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; yyfmt = yystpcpy (yyfmt, yyprefix); yyprefix = yyor; } yyf = YY_(yyformat); yysize1 = yysize + yystrlen (yyf); yysize_overflow |= (yysize1 < yysize); yysize = yysize1; if (yysize_overflow) return YYSIZE_MAXIMUM; if (yyresult) { /* Avoid sprintf, as that infringes on the user's name space. Don't have undefined behavior even if the translation produced a string with the wrong number of "%s"s. */ char *yyp = yyresult; int yyi = 0; while ((*yyp = *yyf) != '\0') { if (*yyp == '%' && yyf[1] == 's' && yyi < yycount) { yyp += yytnamerr (yyp, yyarg[yyi++]); yyf += 2; } else { yyp++; yyf++; } } } return yysize; } } #endif /* YYERROR_VERBOSE */ /*-----------------------------------------------. | Release the memory associated to this symbol. | `-----------------------------------------------*/ /*ARGSUSED*/ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) static void yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep) #else static void yydestruct (yymsg, yytype, yyvaluep) const char *yymsg; int yytype; YYSTYPE *yyvaluep; #endif { YYUSE (yyvaluep); if (!yymsg) yymsg = "Deleting"; YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp); switch (yytype) { default: break; } } /* Prevent warnings from -Wmissing-prototypes. */ #ifdef YYPARSE_PARAM #if defined __STDC__ || defined __cplusplus int yyparse (void *YYPARSE_PARAM); #else int yyparse (); #endif #else /* ! YYPARSE_PARAM */ #if defined __STDC__ || defined __cplusplus int yyparse (void); #else int yyparse (); #endif #endif /* ! YYPARSE_PARAM */ /* The look-ahead symbol. */ int yychar; /* The semantic value of the look-ahead symbol. */ YYSTYPE yylval; /* Number of syntax errors so far. */ int yynerrs; /*----------. | yyparse. | `----------*/ #ifdef YYPARSE_PARAM #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; int yyn; int yyresult; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* Look-ahead token as an internal (translated) token number. */ int yytoken = 0; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif /* Three stacks and their tools: `yyss': related to states, `yyvs': related to semantic values, `yyls': related to locations. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss = yyssa; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs = yyvsa; YYSTYPE *yyvsp; #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) YYSIZE_T yystacksize = YYINITDEPTH; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; YYDPRINTF ((stderr, "Starting parse\n")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_("memory exhausted"), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss); YYSTACK_RELOCATE (yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, "Stack size increased to %lu\n", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, "Entering state %d\n", yystate)); goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a look-ahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to look-ahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a look-ahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, "Reading a token: ")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, "Now at end of input.\n")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } if (yyn == YYFINAL) YYACCEPT; /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the look-ahead token. */ YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); /* Discard the shifted token unless it is eof. */ if (yychar != YYEOF) yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 2: { lhExternals ((yyvsp[(1) - (1)].interfacelist)); ;} break; case 3: { interfaceNodeList_free ((yyvsp[(1) - (3)].interfacelist)); interfaceNodeList_free ((yyvsp[(3) - (3)].interfacelist)); ;} break; case 4: { (yyval.interfacelist) = interfaceNodeList_new (); ;} break; case 5: { (yyval.interfacelist) = interfaceNodeList_addh ((yyvsp[(1) - (2)].interfacelist), (yyvsp[(2) - (2)].iface));;} break; case 8: { (yyval.interfacelist) = interfaceNodeList_new (); ;} break; case 9: { (yyval.interfacelist) = consInterfaceNode ((yyvsp[(1) - (2)].iface), (yyvsp[(2) - (2)].interfacelist));;} break; case 10: { (yyval.interfacelist) = consInterfaceNode ((yyvsp[(1) - (2)].iface), (yyvsp[(2) - (2)].interfacelist));;} break; case 11: { (yyval.interfacelist) = interfaceNodeList_new (); ;} break; case 12: { (yyval.interfacelist) = interfaceNodeList_addh ((yyvsp[(1) - (2)].interfacelist), (yyvsp[(2) - (2)].iface));;} break; case 16: { (yyval.iface) = makeInterfaceNodeImports ((yyvsp[(2) - (3)].importlist)); /* assume subspecs are already processed, symbol table info in external file */ ;} break; case 17: { (yyval.iface) = makeInterfaceNodeUses ((yyvsp[(2) - (3)].traitreflist)); readlsignatures ((yyval.iface));;} break; case 18: { declareConstant ((yyvsp[(1) - (1)].constdeclaration)); (yyval.iface) = interfaceNode_makeConst ((yyvsp[(1) - (1)].constdeclaration)); ;} break; case 19: { declareVar ((yyvsp[(1) - (1)].vardeclaration)); (yyval.iface) = interfaceNode_makeVar ((yyvsp[(1) - (1)].vardeclaration)); ;} break; case 20: { declareType ((yyvsp[(1) - (1)].type)); (yyval.iface) = interfaceNode_makeType ((yyvsp[(1) - (1)].type)); ;} break; case 21: { declareFcn ((yyvsp[(1) - (1)].fcn), typeId_invalid); (yyval.iface) = interfaceNode_makeFcn ((yyvsp[(1) - (1)].fcn)); ;} break; case 22: { (yyval.iface) = interfaceNode_makeClaim ((yyvsp[(1) - (1)].claim)); ;} break; case 23: { declareIter ((yyvsp[(1) - (1)].iter)); (yyval.iface) = interfaceNode_makeIter ((yyvsp[(1) - (1)].iter)); ;} break; case 24: { (yyval.iter) = makeIterNode ((yyvsp[(2) - (6)].ltok), (yyvsp[(4) - (6)].paramlist)); ;} break; case 25: { (yyval.paramlist) = paramNodeList_new (); ;} break; case 26: { (yyval.paramlist) = (yyvsp[(1) - (1)].paramlist); ;} break; case 27: { (yyval.paramlist) = paramNodeList_add (paramNodeList_new (), (yyvsp[(1) - (1)].param)); ;} break; case 28: { (yyval.paramlist) = paramNodeList_add ((yyvsp[(1) - (3)].paramlist),(yyvsp[(3) - (3)].param)); ;} break; case 29: { (yyval.param) = markYieldParamNode ((yyvsp[(2) - (2)].param)); ;} break; case 30: { (yyval.param) = (yyvsp[(1) - (1)].param); ;} break; case 31: { symtable_export (g_symtab, FALSE); ;} break; case 32: { (yyval.iface) = (yyvsp[(3) - (3)].iface); symtable_export (g_symtab, TRUE); ;} break; case 33: { declarePrivConstant ((yyvsp[(1) - (1)].constdeclaration)); (yyval.iface) = interfaceNode_makePrivConst ((yyvsp[(1) - (1)].constdeclaration)); ;} break; case 34: { declarePrivVar ((yyvsp[(1) - (1)].vardeclaration)); (yyval.iface) = interfaceNode_makePrivVar ((yyvsp[(1) - (1)].vardeclaration)); ;} break; case 35: { declarePrivType ((yyvsp[(1) - (1)].type)); (yyval.iface) = interfaceNode_makePrivType ((yyvsp[(1) - (1)].type)); ;} break; case 36: { declarePrivFcn ((yyvsp[(1) - (1)].fcn), typeId_invalid); (yyval.iface) = interfaceNode_makePrivFcn ((yyvsp[(1) - (1)].fcn)); ;} break; case 37: { (yyval.constdeclaration) = makeConstDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls)); ;} break; case 38: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].initdecls), FALSE, FALSE); (yyval.vardeclaration)->qualifier = QLF_NONE; ;} break; case 39: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls), FALSE, FALSE); (yyval.vardeclaration)->qualifier = QLF_CONST; ;} break; case 40: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls), FALSE, FALSE); (yyval.vardeclaration)->qualifier = QLF_VOLATILE; ;} break; case 41: { (yyval.type) = makeAbstractTypeNode ((yyvsp[(1) - (1)].abstract)); ;} break; case 42: { (yyval.type) = makeExposedTypeNode ((yyvsp[(1) - (1)].exposed)); ;} break; case 43: { (yyval.typequal) = qual_createPrintfLike (); ;} break; case 44: { (yyval.typequal) = qual_createScanfLike (); ;} break; case 45: { (yyval.typequal) = qual_createMessageLike (); ;} break; case 46: { enteringFcnScope ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].declare), (yyvsp[(3) - (3)].globals)); ;} break; case 47: { (yyval.fcn) = makeFcnNode (qual_createUnknown (), (yyvsp[(1) - (13)].lcltypespec), (yyvsp[(2) - (13)].declare), (yyvsp[(3) - (13)].globals), (yyvsp[(6) - (13)].vardeclarationlist), (yyvsp[(7) - (13)].letdecls), (yyvsp[(8) - (13)].lclpredicate), (yyvsp[(9) - (13)].lclpredicate), (yyvsp[(10) - (13)].modify), (yyvsp[(11) - (13)].lclpredicate), (yyvsp[(12) - (13)].lclpredicate)); /* type, declarator, glovbls, privateinits, lets, checks, requires, modifies, ensures, claims */ symtable_exitScope (g_symtab); ;} break; case 48: { enteringFcnScope ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].declare), (yyvsp[(4) - (4)].globals)); ;} break; case 49: { (yyval.fcn) = makeFcnNode ((yyvsp[(1) - (14)].typequal), (yyvsp[(2) - (14)].lcltypespec), (yyvsp[(3) - (14)].declare), (yyvsp[(4) - (14)].globals), (yyvsp[(7) - (14)].vardeclarationlist), (yyvsp[(8) - (14)].letdecls), (yyvsp[(9) - (14)].lclpredicate), (yyvsp[(10) - (14)].lclpredicate), (yyvsp[(11) - (14)].modify), (yyvsp[(12) - (14)].lclpredicate), (yyvsp[(13) - (14)].lclpredicate)); /* type, declarator, glovbls, privateinits, lets, checks, requires, modifies, ensures, claims */ symtable_exitScope (g_symtab); ;} break; case 50: { enteringClaimScope ((yyvsp[(4) - (6)].paramlist), (yyvsp[(6) - (6)].globals)); ;} break; case 51: { (yyval.claim) = makeClaimNode ((yyvsp[(2) - (13)].ltok), (yyvsp[(4) - (13)].paramlist), (yyvsp[(6) - (13)].globals), (yyvsp[(9) - (13)].letdecls), (yyvsp[(10) - (13)].lclpredicate), (yyvsp[(11) - (13)].program), (yyvsp[(12) - (13)].lclpredicate)); symtable_exitScope (g_symtab); ;} break; case 52: { (yyval.claim) = (claimNode) 0; ;} break; case 53: {g_inTypeDef = TRUE; ;} break; case 54: {g_inTypeDef = FALSE; ;} break; case 55: { (yyval.abstract) = makeAbstractNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(4) - (6)].ltok), TRUE, FALSE, (yyvsp[(6) - (6)].abstbody)); ;} break; case 56: {g_inTypeDef = TRUE; ;} break; case 57: {g_inTypeDef = FALSE; ;} break; case 58: { (yyval.abstract) = makeAbstractNode ((yyvsp[(1) - (7)].ltok), (yyvsp[(5) - (7)].ltok), TRUE, TRUE, (yyvsp[(7) - (7)].abstbody)); ;} break; case 59: {g_inTypeDef = TRUE; ;} break; case 60: {g_inTypeDef = FALSE; ;} break; case 61: { (yyval.abstract) = makeAbstractNode ((yyvsp[(2) - (7)].ltok), (yyvsp[(5) - (7)].ltok), TRUE, TRUE, (yyvsp[(7) - (7)].abstbody)); ;} break; case 62: {g_inTypeDef = TRUE; ;} break; case 63: {g_inTypeDef = FALSE; ;} break; case 64: { (yyval.abstract) = makeAbstractNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(4) - (6)].ltok), FALSE, FALSE, (yyvsp[(6) - (6)].abstbody)); ;} break; case 65: { g_inTypeDef = TRUE; setExposedType ((yyvsp[(2) - (2)].lcltypespec)); ;} break; case 66: { g_inTypeDef = FALSE; ;} break; case 67: { (yyval.exposed) = makeExposedNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(2) - (6)].lcltypespec), (yyvsp[(4) - (6)].declaratorinvs)); /* to support mutually recursive types */ ;} break; case 68: { (yyval.exposed) = makeExposedNode ((yyvsp[(2) - (2)].ltok), makeLclTypeSpecNodeSU ((yyvsp[(1) - (2)].structorunion)), declaratorInvNodeList_new ()); ;} break; case 69: { (yyval.exposed) = makeExposedNode ((yyvsp[(2) - (2)].ltok), makeLclTypeSpecNodeEnum ((yyvsp[(1) - (2)].enumspec)), declaratorInvNodeList_new ()); ;} break; case 70: { (yyval.importlist) = importNodeList_add (importNodeList_new (), (yyvsp[(1) - (1)].import)); ;} break; case 71: { (yyval.importlist) = importNodeList_add ((yyvsp[(1) - (3)].importlist), (yyvsp[(3) - (3)].import)); ;} break; case 72: { (yyval.import) = importNode_makePlain ((yyvsp[(1) - (1)].ltok)); ;} break; case 73: { checkBrackets ((yyvsp[(1) - (3)].ltok), (yyvsp[(3) - (3)].ltok)); (yyval.import) = importNode_makeBracketed ((yyvsp[(2) - (3)].ltok)); ;} break; case 74: { (yyval.import) = importNode_makeQuoted ((yyvsp[(1) - (1)].ltok)); ;} break; case 75: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 76: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 78: { (yyval.traitreflist) = traitRefNodeList_add (traitRefNodeList_new (), (yyvsp[(1) - (1)].traitref)); ;} break; case 79: { (yyval.traitreflist) = traitRefNodeList_add ((yyvsp[(1) - (3)].traitreflist), (yyvsp[(3) - (3)].traitref)); ;} break; case 80: { (yyval.traitref) = makeTraitRefNode (ltokenList_singleton ((yyvsp[(1) - (1)].ltok)), (renamingNode)0); ;} break; case 81: { (yyval.traitref) = makeTraitRefNode (ltokenList_singleton ((yyvsp[(1) - (4)].ltok)), (yyvsp[(3) - (4)].renaming)); ;} break; case 82: { (yyval.traitref) = makeTraitRefNode ((yyvsp[(2) - (3)].ltokenList), (renamingNode)0); ;} break; case 83: { (yyval.traitref) = makeTraitRefNode ((yyvsp[(2) - (6)].ltokenList), (yyvsp[(5) - (6)].renaming)); ;} break; case 84: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 85: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 86: { (yyval.renaming) = makeRenamingNode (typeNameNodeList_new (), (yyvsp[(1) - (1)].replacelist)); ;} break; case 87: { (yyval.renaming) = makeRenamingNode ((yyvsp[(1) - (1)].namelist), replaceNodeList_new ()); ;} break; case 88: { (yyval.renaming) = makeRenamingNode ((yyvsp[(1) - (3)].namelist), (yyvsp[(3) - (3)].replacelist)); ;} break; case 89: { (yyval.namelist) = typeNameNodeList_add (typeNameNodeList_new (), (yyvsp[(1) - (1)].typname)); ;} break; case 90: { (yyval.namelist) = typeNameNodeList_add ((yyvsp[(1) - (3)].namelist), (yyvsp[(3) - (3)].typname)); ;} break; case 91: { (yyval.replacelist) = replaceNodeList_add (replaceNodeList_new (), (yyvsp[(1) - (1)].replace)); ;} break; case 92: { (yyval.replacelist) = replaceNodeList_add ((yyvsp[(1) - (3)].replacelist), (yyvsp[(3) - (3)].replace)); ;} break; case 93: { (yyval.replace) = makeReplaceNode ((yyvsp[(2) - (3)].ltok), (yyvsp[(1) - (3)].typname), TRUE, (yyvsp[(3) - (3)].ltok), NULL, NULL); ;} break; case 94: { (yyval.replace) = makeReplaceNameNode ((yyvsp[(2) - (3)].ltok), (yyvsp[(1) - (3)].typname), (yyvsp[(3) - (3)].name)); ;} break; case 95: { (yyval.replace) = makeReplaceNode ((yyvsp[(2) - (4)].ltok), (yyvsp[(1) - (4)].typname), FALSE, ltoken_undefined, (yyvsp[(3) - (4)].name), (yyvsp[(4) - (4)].signature)); ;} break; case 96: { (yyval.name) = makeNameNodeId ((yyvsp[(1) - (1)].ltok)); ;} break; case 97: { (yyval.name) = makeNameNodeForm ((yyvsp[(1) - (1)].opform)); ;} break; case 100: { (yyval.initdecls) = initDeclNodeList_add (initDeclNodeList_new (), (yyvsp[(1) - (1)].initdecl)); ;} break; case 101: { (yyval.initdecls) = initDeclNodeList_add ((yyvsp[(1) - (3)].initdecls), (yyvsp[(3) - (3)].initdecl)); ;} break; case 102: { (yyval.initdecl) = makeInitDeclNode ((yyvsp[(1) - (1)].declare), (termNode)0); ;} break; case 103: { (yyval.initdecl) = makeInitDeclNode ((yyvsp[(1) - (3)].declare), (yyvsp[(3) - (3)].term)); ;} break; case 104: { (yyval.globals) = varDeclarationNodeList_new (); ;} break; case 105: { varDeclarationNodeList_addh ((yyvsp[(1) - (2)].globals), (yyvsp[(2) - (2)].vardeclaration)); (yyval.globals) = (yyvsp[(1) - (2)].globals); ;} break; case 106: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].initdecls), TRUE, FALSE); ;} break; case 107: { (yyval.vardeclaration) = makeInternalStateNode (); ;} break; case 108: { (yyval.vardeclaration) = makeFileSystemNode (); ;} break; case 109: { (yyval.vardeclarationlist) = varDeclarationNodeList_new (); ;} break; case 110: { varDeclarationNodeList_addh ((yyvsp[(1) - (2)].vardeclarationlist), (yyvsp[(2) - (2)].vardeclaration)); (yyval.vardeclarationlist) = (yyvsp[(1) - (2)].vardeclarationlist); ;} break; case 111: { (yyval.vardeclaration) = makeVarDeclarationNode ((yyvsp[(2) - (4)].lcltypespec), (yyvsp[(3) - (4)].initdecls), FALSE, TRUE); ;} break; case 112: { (yyval.letdecls) = letDeclNodeList_new (); ;} break; case 113: { (yyval.letdecls) = (yyvsp[(2) - (3)].letdecls); ;} break; case 114: { (yyval.letdecls) = letDeclNodeList_add (letDeclNodeList_new (), (yyvsp[(1) - (1)].letdecl)); ;} break; case 115: { (yyval.letdecls) = letDeclNodeList_add ((yyvsp[(1) - (3)].letdecls), (yyvsp[(3) - (3)].letdecl)); ;} break; case 116: { (yyval.letdecl) = makeLetDeclNode ((yyvsp[(1) - (5)].ltok), (yyvsp[(3) - (5)].lcltypespec), (yyvsp[(5) - (5)].term)); ;} break; case 117: { (yyval.letdecl) = makeLetDeclNode ((yyvsp[(1) - (3)].ltok), (lclTypeSpecNode)0, (yyvsp[(3) - (3)].term)); ;} break; case 119: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 120: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeChecksNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); ;} break; case 121: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 122: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeRequiresNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate));;} break; case 123: { (yyval.modify) = (modifyNode)0; ;} break; case 124: { (yyval.modify) = makeModifyNodeSpecial ((yyvsp[(1) - (3)].ltok), TRUE); ;} break; case 125: { (yyval.modify) = makeModifyNodeSpecial ((yyvsp[(1) - (3)].ltok), FALSE); ;} break; case 126: { (yyval.modify) = makeModifyNodeRef ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].storereflist)); ;} break; case 127: { (yyval.storereflist) = storeRefNodeList_add (storeRefNodeList_new (), (yyvsp[(1) - (1)].storeref)); ;} break; case 128: { (yyval.storereflist) = storeRefNodeList_add ((yyvsp[(1) - (3)].storereflist), (yyvsp[(3) - (3)].storeref)); ;} break; case 129: { (yyval.storeref) = makeStoreRefNodeTerm ((yyvsp[(1) - (1)].term)); ;} break; case 130: { (yyval.storeref) = makeStoreRefNodeType ((yyvsp[(1) - (1)].lcltypespec), FALSE); ;} break; case 131: { (yyval.storeref) = makeStoreRefNodeType ((yyvsp[(2) - (2)].lcltypespec), TRUE); ;} break; case 132: { (yyval.storeref) = makeStoreRefNodeInternal (); ;} break; case 133: { (yyval.storeref) = makeStoreRefNodeSystem (); ;} break; case 134: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 135: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeEnsuresNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate));;} break; case 136: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 137: { checkLclPredicate ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); (yyval.lclpredicate) = makeIntraClaimNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate));;} break; case 138: { (yyval.paramlist) = paramNodeList_new (); ;} break; case 139: { (yyval.paramlist) = (yyvsp[(1) - (1)].paramlist); ;} break; case 141: { (yyval.paramlist) = paramNodeList_add (paramNodeList_new (), paramNode_elipsis ()); ;} break; case 142: { (yyval.paramlist) = paramNodeList_add ((yyvsp[(1) - (3)].paramlist), paramNode_elipsis ()); ;} break; case 143: { (yyval.paramlist) = paramNodeList_single ((yyvsp[(1) - (1)].param)); ;} break; case 144: { (yyval.paramlist) = paramNodeList_add ((yyvsp[(1) - (3)].paramlist), (yyvsp[(3) - (3)].param)); ;} break; case 145: { (yyval.program) = (programNode)0; ;} break; case 146: { (yyval.program) = (yyvsp[(3) - (4)].program); ;} break; case 147: { (yyval.program) = (yyvsp[(3) - (5)].program); ;} break; case 148: { (yyval.program) = makeProgramNode ((yyvsp[(1) - (1)].stmt)); ;} break; case 149: { (yyval.program) = (yyvsp[(2) - (3)].program); (yyval.program)->wrapped = (yyval.program)->wrapped + 1; ;} break; case 150: { programNodeList x = programNodeList_new (); programNodeList_addh (x, (yyvsp[(1) - (2)].program)); (yyval.program) = makeProgramNodeAction (x, ACT_ITER); ;} break; case 151: { programNodeList x = programNodeList_new (); programNodeList_addh (x, (yyvsp[(1) - (3)].program)); programNodeList_addh (x, (yyvsp[(3) - (3)].program)); (yyval.program) = makeProgramNodeAction (x, ACT_ALTERNATE); ;} break; case 152: { programNodeList x = programNodeList_new (); programNodeList_addh (x, (yyvsp[(1) - (3)].program)); programNodeList_addh (x, (yyvsp[(3) - (3)].program)); (yyval.program) = makeProgramNodeAction (x, ACT_SEQUENCE); ;} break; case 153: { (yyval.stmt) = makeStmtNode (ltoken_undefined, (yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].termlist)); ;} break; case 154: { (yyval.stmt) = makeStmtNode (ltoken_undefined, (yyvsp[(1) - (3)].ltok), termNodeList_new ()); ;} break; case 155: { (yyval.stmt) = makeStmtNode ((yyvsp[(1) - (5)].ltok), (yyvsp[(3) - (5)].ltok), termNodeList_new ()); ;} break; case 156: { (yyval.stmt) = makeStmtNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(3) - (6)].ltok), (yyvsp[(5) - (6)].termlist)); ;} break; case 157: { (yyval.termlist) = termNodeList_push (termNodeList_new (), (yyvsp[(1) - (1)].term)); ;} break; case 158: { (yyval.termlist) = termNodeList_push ((yyvsp[(1) - (3)].termlist), (yyvsp[(3) - (3)].term)); ;} break; case 160: { (yyval.term) = makeSimpleTermNode ((yyvsp[(1) - (1)].ltok)); ;} break; case 161: { (yyval.term) = makePrefixTermNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].term)); ;} break; case 162: { (yyval.term) = makePostfixTermNode2 ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].ltok)); ;} break; case 163: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term)); ;} break; case 164: { (yyval.term) = (yyvsp[(2) - (3)].term); (yyval.term)->wrapped = (yyval.term)->wrapped + 1; ;} break; case 165: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].ltok), termNodeList_new (), (yyvsp[(3) - (3)].ltok)); ;} break; case 166: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)); ;} break; case 167: { (yyval.abstbody) = (abstBodyNode)0; ;} break; case 168: { (yyval.abstbody) = makeAbstBodyNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].fcns)); ;} break; case 169: { (yyval.abstbody) = makeAbstBodyNode2 ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltokenList)); ;} break; case 170: { (yyval.abstbody) = (abstBodyNode)0; ;} break; case 171: { (yyval.fcns) = fcnNodeList_new (); ;} break; case 172: { (yyval.fcns) = fcnNodeList_add ((yyvsp[(1) - (2)].fcns), (yyvsp[(2) - (2)].fcn)); ;} break; case 173: { (yyval.lclpredicate) = (lclPredicateNode)0; ;} break; case 175: { g_inTypeDef = FALSE; ;} break; case 176: { (yyvsp[(5) - (6)].lclpredicate)->tok = (yyvsp[(1) - (6)].ltok); (yyvsp[(5) - (6)].lclpredicate)->kind = LPD_CONSTRAINT; checkLclPredicate ((yyvsp[(1) - (6)].ltok), (yyvsp[(5) - (6)].lclpredicate)); (yyval.lclpredicate) = (yyvsp[(5) - (6)].lclpredicate); symtable_exitScope (g_symtab); g_inTypeDef = TRUE; ;} break; case 177: { (yyval.declaratorinvs) = declaratorInvNodeList_add (declaratorInvNodeList_new (), (yyvsp[(1) - (1)].declaratorinv)); ;} break; case 178: { (yyval.declaratorinvs) = declaratorInvNodeList_add ((yyvsp[(1) - (3)].declaratorinvs), (yyvsp[(3) - (3)].declaratorinv)); ;} break; case 179: { declareForwardType ((yyvsp[(1) - (1)].declare)); ;} break; case 180: { (yyval.declaratorinv) = makeDeclaratorInvNode ((yyvsp[(1) - (3)].declare), (yyvsp[(3) - (3)].abstbody)); ;} break; case 181: { (yyval.abstbody) = (abstBodyNode)0; ;} break; case 182: { (yyval.abstbody) = makeExposedBodyNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].lclpredicate)); ;} break; case 183: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_VOID, 0)); ;} break; case 184: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_CHAR, 0)); ;} break; case 185: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_DOUBLE, 0)); ;} break; case 186: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_FLOAT, 0)); ;} break; case 187: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_INT, 0)); ;} break; case 188: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_LONG, 0)); ;} break; case 189: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_SHORT, 0)); ;} break; case 190: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_SIGNED, 0)); ;} break; case 191: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_UNSIGNED, 0)); ;} break; case 192: { (yyval.ltok) = (yyvsp[(1) - (1)].ltok); ltoken_setIntField ((yyval.ltok), fixBits (TS_UNKNOWN, 0)); ;} break; case 193: { (yyval.ctypes) = makeCTypesNode ((CTypesNode)0, (yyvsp[(1) - (1)].ltok)); ;} break; case 194: { (yyval.ctypes) = makeCTypesNode ((yyvsp[(1) - (2)].ctypes), (yyvsp[(2) - (2)].ltok)); ;} break; case 195: { (yyval.ctypes) = makeTypeSpecifier ((yyvsp[(1) - (1)].ltok)); ;} break; case 196: { (yyval.ctypes) = (yyvsp[(1) - (1)].ctypes); (yyval.ctypes)->sort = sort_lookupName (lclctype_toSort ((yyvsp[(1) - (1)].ctypes)->intfield)); ;} break; case 197: { (yyval.typequal) = qual_createOut (); ;} break; case 198: { (yyval.typequal) = qual_createUnused (); ;} break; case 199: { (yyval.typequal) = qual_createSef (); ;} break; case 200: { (yyval.typequal) = qual_createOnly (); ;} break; case 201: { (yyval.typequal) = qual_createOwned (); ;} break; case 202: { (yyval.typequal) = qual_createDependent (); ;} break; case 203: { (yyval.typequal) = qual_createKeep (); ;} break; case 204: { (yyval.typequal) = qual_createKept (); ;} break; case 205: { (yyval.typequal) = qual_createObserver (); ;} break; case 206: { (yyval.typequal) = qual_createExits (); ;} break; case 207: { (yyval.typequal) = qual_createMayExit (); ;} break; case 208: { (yyval.typequal) = qual_createTrueExit (); ;} break; case 209: { (yyval.typequal) = qual_createFalseExit (); ;} break; case 210: { (yyval.typequal) = qual_createNeverExit (); ;} break; case 211: { (yyval.typequal) = qual_createOnly (); ;} break; case 212: { (yyval.typequal) = qual_createShared (); ;} break; case 213: { (yyval.typequal) = qual_createUnique (); ;} break; case 214: { (yyval.typequal) = qual_createChecked (); ;} break; case 215: { (yyval.typequal) = qual_createUnchecked (); ;} break; case 216: { (yyval.typequal) = qual_createCheckedStrict (); ;} break; case 217: { (yyval.typequal) = qual_createTrueNull (); ;} break; case 218: { (yyval.typequal) = qual_createFalseNull (); ;} break; case 219: { (yyval.typequal) = qual_createRelNull (); ;} break; case 220: { (yyval.typequal) = qual_createRelDef (); ;} break; case 221: { (yyval.typequal) = qual_createRefCounted (); ;} break; case 222: { (yyval.typequal) = qual_createRefs (); ;} break; case 223: { (yyval.typequal) = qual_createNewRef (); ;} break; case 224: { (yyval.typequal) = qual_createKillRef (); ;} break; case 225: { (yyval.typequal) = qual_createNull (); ;} break; case 226: { (yyval.typequal) = qual_createNotNull (); ;} break; case 227: { (yyval.typequal) = qual_createReturned (); ;} break; case 228: { (yyval.typequal) = qual_createExposed (); ;} break; case 229: { (yyval.typequal) = qual_createPartial (); ;} break; case 230: { (yyval.typequal) = qual_createNullTerminated () ; ;} break; case 231: { (yyval.typequal) = qual_createUndef (); ;} break; case 232: { (yyval.typequal) = qual_createKilled (); ;} break; case 233: { (yyval.lcltypespec) = makeLclTypeSpecNodeType ((yyvsp[(1) - (1)].ctypes)); ;} break; case 234: { (yyval.lcltypespec) = makeLclTypeSpecNodeSU ((yyvsp[(1) - (1)].structorunion)); ;} break; case 235: { (yyval.lcltypespec) = makeLclTypeSpecNodeEnum ((yyvsp[(1) - (1)].enumspec)); ;} break; case 236: { (yyval.lcltypespec) = lclTypeSpecNode_addQual ((yyvsp[(2) - (2)].lcltypespec), (yyvsp[(1) - (2)].typequal)); ;} break; case 237: { (yyval.lcltypespec) = makeLclTypeSpecNodeConj ((yyvsp[(2) - (5)].lcltypespec), (yyvsp[(4) - (5)].lcltypespec)); ;} break; case 239: { llassert (lclTypeSpecNode_isDefined ((yyvsp[(1) - (2)].lcltypespec))); (yyvsp[(1) - (2)].lcltypespec)->pointers = (yyvsp[(2) - (2)].pointers); (yyval.lcltypespec) = (yyvsp[(1) - (2)].lcltypespec); ;} break; case 240: { (yyval.pointers) = pointers_createLt ((yyvsp[(1) - (1)].ltok)); ;} break; case 241: { (yyval.pointers) = pointers_extend ((yyvsp[(1) - (2)].pointers), pointers_createLt ((yyvsp[(2) - (2)].ltok))); ;} break; case 242: { (void) checkAndEnterTag (TAG_FWDSTRUCT, ltoken_copy ((yyvsp[(2) - (2)].ltok))); ;} break; case 243: { (yyval.structorunion) = makestrOrUnionNode ((yyvsp[(1) - (6)].ltok), SU_STRUCT, (yyvsp[(2) - (6)].ltok), (yyvsp[(5) - (6)].structdecls)); ;} break; case 244: { (void) checkAndEnterTag (TAG_FWDUNION, ltoken_copy ((yyvsp[(2) - (2)].ltok))); ;} break; case 245: { (yyval.structorunion) = makestrOrUnionNode ((yyvsp[(1) - (6)].ltok), SU_UNION, (yyvsp[(2) - (6)].ltok), (yyvsp[(5) - (6)].structdecls)); ;} break; case 246: { (yyval.structorunion) = makeForwardstrOrUnionNode ((yyvsp[(1) - (2)].ltok), SU_STRUCT, (yyvsp[(2) - (2)].ltok)); ;} break; case 247: { (yyval.structorunion) = makeForwardstrOrUnionNode ((yyvsp[(1) - (2)].ltok), SU_UNION, (yyvsp[(2) - (2)].ltok)); ;} break; case 248: { (yyval.ltok) = ltoken_undefined; ;} break; case 250: { (yyval.structdecls) = stDeclNodeList_add (stDeclNodeList_new (), (yyvsp[(1) - (1)].structdecl)); ;} break; case 251: { (yyval.structdecls) = stDeclNodeList_add ((yyvsp[(1) - (2)].structdecls), (yyvsp[(2) - (2)].structdecl)); ;} break; case 252: { (yyval.structdecl) = makestDeclNode ((yyvsp[(1) - (3)].lcltypespec), (yyvsp[(2) - (3)].declarelist)); ;} break; case 253: { (yyval.declarelist) = declaratorNodeList_add (declaratorNodeList_new (), (yyvsp[(1) - (1)].declare)); ;} break; case 254: { (yyval.declarelist) = declaratorNodeList_add ((yyvsp[(1) - (3)].declarelist), (yyvsp[(3) - (3)].declare)); ;} break; case 255: { ; ;} break; case 256: { ; ;} break; case 257: { (yyval.enumspec) = makeEnumSpecNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(2) - (6)].ltok), (yyvsp[(4) - (6)].ltokenList)); ;} break; case 258: { (yyval.enumspec) = makeEnumSpecNode2 ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].ltok)); ;} break; case 259: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 260: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 261: { (yyval.declare) = makeDeclaratorNode ((yyvsp[(1) - (1)].typeexpr)); ;} break; case 262: { (yyval.declare) = makeDeclaratorNode ((yyvsp[(1) - (1)].typeexpr)); ;} break; case 263: { (yyval.typeexpr) = makeTypeExpr ((yyvsp[(1) - (1)].ltok)); ;} break; case 264: { (yyval.typeexpr) = (yyvsp[(2) - (3)].typeexpr); (yyval.typeexpr)->wrapped = (yyval.typeexpr)->wrapped + 1; ;} break; case 265: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 266: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 267: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 268: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 269: { (yyval.typeexpr) = makeTypeExpr ((yyvsp[(1) - (1)].ltok)); ;} break; case 270: { (yyval.typeexpr) = (yyvsp[(2) - (3)].typeexpr); (yyval.typeexpr)->wrapped = (yyval.typeexpr)->wrapped + 1; ;} break; case 271: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 272: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 273: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 274: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 275: { (yyval.typeexpr) = makeTypeExpr ((yyvsp[(1) - (1)].ltok)); ;} break; case 276: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 277: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 278: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 279: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 280: { (yyval.param) = makeParamNode ((yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 281: { (yyval.param) = makeParamNode ((yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 282: { (yyval.param) = makeParamNode ((yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].abstDecl)); ;} break; case 283: { (yyval.typname) = makeTypeNameNode (FALSE, (yyvsp[(1) - (2)].lcltypespec), (yyvsp[(2) - (2)].abstDecl)); ;} break; case 284: { (yyval.typname) = makeTypeNameNode (TRUE, (yyvsp[(2) - (3)].lcltypespec), (yyvsp[(3) - (3)].abstDecl)); ;} break; case 285: { (yyval.typname) = makeTypeNameNodeOp ((yyvsp[(1) - (1)].opform)); ;} break; case 286: { (yyval.abstDecl) = (abstDeclaratorNode)0; ;} break; case 287: { (yyval.abstDecl) = (abstDeclaratorNode)(yyvsp[(1) - (1)].typeexpr); ;} break; case 288: { (yyval.typeexpr) = (yyvsp[(2) - (3)].typeexpr); (yyval.typeexpr)->wrapped = (yyval.typeexpr)->wrapped + 1; ;} break; case 289: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].typeexpr)); ;} break; case 290: { (yyval.typeexpr) = makePointerNode ((yyvsp[(1) - (1)].ltok), (typeExpr)0); ;} break; case 291: { (yyval.typeexpr) = makeArrayNode ((typeExpr)0, (yyvsp[(1) - (1)].array)); ;} break; case 292: { (yyval.typeexpr) = makeArrayNode ((yyvsp[(1) - (2)].typeexpr), (yyvsp[(2) - (2)].array)); ;} break; case 293: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (3)].typeexpr), paramNodeList_new ()); ;} break; case 294: { (yyval.typeexpr) = makeFunctionNode ((typeExpr)0, (yyvsp[(2) - (3)].paramlist)); ;} break; case 295: { (yyval.typeexpr) = makeFunctionNode ((yyvsp[(1) - (4)].typeexpr), (yyvsp[(3) - (4)].paramlist)); ;} break; case 296: { (yyval.array) = makeArrayQualNode ((yyvsp[(1) - (2)].ltok), (termNode)0); ;} break; case 297: { (yyval.array) = makeArrayQualNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].term)); ;} break; case 298: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (6)].ltok), OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); ;} break; case 299: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (1)].ltok), OPF_ANYOP, opFormUnion_createAnyOp ((yyvsp[(1) - (1)].ltok)), ltoken_undefined); ;} break; case 300: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_MANYOP, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 301: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_ANYOPM, opFormUnion_createAnyOp ((yyvsp[(1) - (2)].ltok)), ltoken_undefined); ;} break; case 302: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MANYOPM, opFormUnion_createAnyOp ((yyvsp[(2) - (3)].ltok)), ltoken_undefined); ;} break; case 303: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 304: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_MMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 305: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_MIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 306: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_MMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 307: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_BMIDDLE, opFormUnion_createMiddle ((yyvsp[(2) - (3)].count)), (yyvsp[(3) - (3)].ltok)); ;} break; case 308: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (4)].ltok), OPF_BMIDDLEM, opFormUnion_createMiddle ((yyvsp[(2) - (4)].count)), (yyvsp[(3) - (4)].ltok)); ;} break; case 309: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (4)].ltok), OPF_BMMIDDLE, opFormUnion_createMiddle ((yyvsp[(3) - (4)].count)), (yyvsp[(4) - (4)].ltok)); ;} break; case 310: { (yyval.opform) = makeOpFormNode ((yyvsp[(2) - (5)].ltok), OPF_BMMIDDLEM, opFormUnion_createMiddle ((yyvsp[(3) - (5)].count)), (yyvsp[(4) - (5)].ltok)); ;} break; case 311: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_SELECT, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 312: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (2)].ltok), OPF_MAP, opFormUnion_createAnyOp ((yyvsp[(2) - (2)].ltok)), ltoken_undefined); ;} break; case 313: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MSELECT, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 314: { (yyval.opform) = makeOpFormNode ((yyvsp[(1) - (3)].ltok), OPF_MMAP, opFormUnion_createAnyOp ((yyvsp[(3) - (3)].ltok)), ltoken_undefined); ;} break; case 322: { (yyval.count) = 0; ;} break; case 324: { (yyval.count) = 1; ;} break; case 325: { (yyval.count) = (yyvsp[(1) - (3)].count) + 1; ;} break; case 328: { (yyval.signature) = makesigNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltokenList), (yyvsp[(4) - (4)].ltok)); ;} break; case 329: { (yyval.ltokenList) = ltokenList_new (); ;} break; case 331: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 332: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (3)].ltokenList), (yyvsp[(3) - (3)].ltok)); ;} break; case 333: { (yyval.lclpredicate) = makeLclPredicateNode (ltoken_undefined, (yyvsp[(1) - (1)].term), LPD_PLAIN);;} break; case 334: { (yyval.term) = checkSort ((yyvsp[(1) - (1)].term)); ;} break; case 335: { (yyval.term) = makeIfTermNode ((yyvsp[(1) - (6)].ltok),(yyvsp[(2) - (6)].term),(yyvsp[(3) - (6)].ltok),(yyvsp[(4) - (6)].term),(yyvsp[(5) - (6)].ltok),(yyvsp[(6) - (6)].term)); ;} break; case 337: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term)); ;} break; case 339: { checkLclPredicate ((yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].lclpredicate)); (yyval.term) = makeQuantifiedTermNode ((yyvsp[(1) - (4)].quantifiers), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].lclpredicate)->predicate, (yyvsp[(4) - (4)].ltok)); symtable_exitScope (g_symtab); ;} break; case 340: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term));;} break; case 341: { (yyval.term) = makeInfixTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term));;} break; case 343: { (yyval.term) = makePostfixTermNode ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].ltokenList)); ;} break; case 344: { (yyval.term) = CollapseInfixTermNode ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].termlist)); ;} break; case 348: { (yyval.term) = makePrefixTermNode ((yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].term)); ;} break; case 349: { (yyval.ltokenList) = ltokenList_singleton ((yyvsp[(1) - (1)].ltok)); ;} break; case 350: { (yyval.ltokenList) = ltokenList_push ((yyvsp[(1) - (2)].ltokenList), (yyvsp[(2) - (2)].ltok)); ;} break; case 351: { (yyval.termlist) = pushInfixOpPartNode (termNodeList_new (), (yyvsp[(1) - (2)].ltok), (yyvsp[(2) - (2)].term)); ;} break; case 352: { (yyval.termlist) = pushInfixOpPartNode ((yyvsp[(1) - (3)].termlist), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].term)); ;} break; case 354: { (yyval.term) = computePossibleSorts ((yyvsp[(1) - (1)].term)); ;} break; case 355: { (yyval.term) = updateMatchedNode ((termNode)0, (yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].term)); ;} break; case 356: { (yyval.term) = updateMatchedNode ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].term), (termNode)0); ;} break; case 357: { (yyval.term) = updateMatchedNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].term), (yyvsp[(3) - (3)].term)); ;} break; case 358: { (yyval.term) = computePossibleSorts ((yyvsp[(1) - (1)].term)); ;} break; case 359: { (yyval.term) = updateSqBracketedNode ((termNode)0, (yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].term)); ;} break; case 360: { (yyval.term) = (yyvsp[(1) - (3)].term); (yyval.term)->sort = sort_lookupName (ltoken_getText ((yyvsp[(3) - (3)].ltok))); ;} break; case 362: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (5)].ltok), (yyvsp[(2) - (5)].termlist), (yyvsp[(3) - (5)].ltok)); (yyval.term)->given = sort_lookupName (ltoken_getText ((yyvsp[(5) - (5)].ltok))); ;} break; case 363: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].termlist), (yyvsp[(3) - (3)].ltok)); ;} break; case 364: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (4)].ltok), termNodeList_new (), (yyvsp[(2) - (4)].ltok)); (yyval.term)->given = sort_lookupName (ltoken_getText ((yyvsp[(4) - (4)].ltok))); ;} break; case 365: { (yyval.term) = makeSqBracketedNode ((yyvsp[(1) - (2)].ltok), termNodeList_new (), (yyvsp[(2) - (2)].ltok)); ;} break; case 366: { (yyval.term) = makeMatchedNode ((yyvsp[(1) - (3)].ltok), (yyvsp[(2) - (3)].termlist), (yyvsp[(3) - (3)].ltok)); ;} break; case 367: { (yyval.term) = makeMatchedNode ((yyvsp[(1) - (2)].ltok), termNodeList_new (), (yyvsp[(2) - (2)].ltok)); ;} break; case 368: { (yyval.termlist) = termNodeList_push (termNodeList_new (), (yyvsp[(1) - (1)].term)); ;} break; case 369: { (yyval.termlist) = termNodeList_push ((yyvsp[(1) - (3)].termlist), (yyvsp[(3) - (3)].term)); ;} break; case 370: { (yyval.term) = (yyvsp[(2) - (3)].term); (yyval.term)->wrapped = (yyval.term)->wrapped + 1; ;} break; case 371: { (yyval.term) = makeSimpleTermNode ((yyvsp[(1) - (1)].ltok)); ;} break; case 372: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)); ;} break; case 374: { (yyval.term) = makePostfixTermNode2 ((yyvsp[(1) - (2)].term), (yyvsp[(2) - (2)].ltok)); ;} break; case 375: { ltoken_markOwned ((yyvsp[(3) - (3)].ltok)); (yyval.term) = makeSelectTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].ltok)); ;} break; case 376: { ltoken_markOwned ((yyvsp[(3) - (3)].ltok)); (yyval.term) = makeMapTermNode ((yyvsp[(1) - (3)].term), (yyvsp[(2) - (3)].ltok), (yyvsp[(3) - (3)].ltok)); ;} break; case 377: { (yyval.term) = updateSqBracketedNode ((yyvsp[(1) - (3)].term), makeSqBracketedNode ((yyvsp[(2) - (3)].ltok), termNodeList_new (), (yyvsp[(3) - (3)].ltok)), (termNode)0); ;} break; case 378: { (yyval.term) = updateSqBracketedNode ((yyvsp[(1) - (4)].term), makeSqBracketedNode ((yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)), (termNode)0); ;} break; case 379: { (yyval.term) = (yyvsp[(1) - (3)].term); (yyval.term)->given = sort_lookupName (ltoken_getText ((yyvsp[(3) - (3)].ltok))); ;} break; case 380: { (yyval.termlist) = termNodeList_push (termNodeList_new (), (yyvsp[(1) - (1)].term)); ;} break; case 381: { (yyval.termlist) = termNodeList_push ((yyvsp[(1) - (3)].termlist), (yyvsp[(3) - (3)].term)); ;} break; case 387: { (yyval.term) = makeSimpleTermNode ((yyvsp[(1) - (1)].ltok)); ;} break; case 388: { (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), (yyvsp[(3) - (4)].termlist), (yyvsp[(4) - (4)].ltok)); ;} break; case 389: { (yyval.term) = makeUnchangedTermNode1 ((yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].ltok)); ;} break; case 390: { (yyval.term) = makeUnchangedTermNode2 ((yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].storereflist)); ;} break; case 391: { termNodeList x = termNodeList_new (); termNodeList_addh (x, (yyvsp[(3) - (4)].term)); (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(2) - (4)].ltok), x, (yyvsp[(4) - (4)].ltok)); ;} break; case 392: { termNodeList x = termNodeList_new (); termNodeList_addh (x, (yyvsp[(3) - (6)].term)); termNodeList_addh (x, (yyvsp[(5) - (6)].term)); (yyval.term) = makeOpCallTermNode ((yyvsp[(1) - (6)].ltok), (yyvsp[(2) - (6)].ltok), x, (yyvsp[(6) - (6)].ltok)); ;} break; case 393: { (yyval.term) = makeSizeofTermNode ((yyvsp[(1) - (4)].ltok), (yyvsp[(3) - (4)].lcltypespec)); ;} break; case 394: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortInt); ;} break; case 395: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortCstring); ;} break; case 396: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortChar); ;} break; case 397: { (yyval.term) = makeLiteralTermNode ((yyvsp[(1) - (1)].ltok), g_sortDouble); ;} break; case 398: { (yyval.quantifiers) = quantifierNodeList_add (quantifierNodeList_new (), (yyvsp[(1) - (1)].quantifier)); ;} break; case 399: { (yyval.quantifiers) = quantifierNodeList_add ((yyvsp[(1) - (2)].quantifiers), (yyvsp[(2) - (2)].quantifier)); ;} break; case 400: { scopeInfo si = (scopeInfo) dmalloc (sizeof (*si)); si->kind = SPE_QUANT; symtable_enterScope (g_symtab, si); ;} break; case 401: { (yyval.quantifier) = makeQuantifierNode ((yyvsp[(3) - (3)].vars), (yyvsp[(1) - (3)].ltok)); ;} break; case 402: { (yyval.vars) = varNodeList_add (varNodeList_new (), (yyvsp[(1) - (1)].var)); ;} break; case 403: { (yyval.vars) = varNodeList_add ((yyvsp[(1) - (3)].vars), (yyvsp[(3) - (3)].var)); ;} break; case 404: { (yyval.var) = makeVarNode ((yyvsp[(1) - (3)].ltok), FALSE, (yyvsp[(3) - (3)].lcltypespec)); ;} break; case 405: { (yyval.var) = makeVarNode ((yyvsp[(1) - (4)].ltok), TRUE, (yyvsp[(4) - (4)].lcltypespec)); ;} break; /* Line 1267 of yacc.c. */ default: break; } YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_("syntax error")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_("syntax error")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse look-ahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct ("Error: discarding", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse look-ahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct ("Error: popping", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } if (yyn == YYFINAL) YYACCEPT; *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #ifndef yyoverflow /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_("memory exhausted")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEOF && yychar != YYEMPTY) yydestruct ("Cleanup: discarding lookahead", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct ("Cleanup: popping", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } # include "bison.reset" /* ** yytext is set in lex scanner ** extern YYSTYPE yylval; ** yylval is defined by code generated by bison */ void ylerror (char *s) { /* ** This resetting of the left context is very important when multiple ** files are to be parsed. We do not want failures to propagate. ** Lex/Yacc does not reset the flags when the parsing goes bad. ** BEGIN 0; **/ /*@-mustfree@*/ lclfatalerror (yllval.ltok, message ("%s: Token code: %s, Token String: %s", cstring_fromChars (s), ltoken_unparseCodeName (yllval.ltok), ltoken_getRawString (yllval.ltok))); /*@=mustfree@*/ } static void yyprint (FILE *f, int t, YYSTYPE value) { fprintf (f, " type: %d (%s)", t, cstring_toCharsSafe (ltoken_getRawString (value.ltok))); } /* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/cgrammar.y0000644021234200000250000020102610000622320014177 0ustar fax/*;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ %{ /* ** ** cgrammar.y ** ** Yacc/Bison grammar for extended ANSI C used by Splint. ** ** original grammar by Nate Osgood --- ** hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993 ** ** changes for Splint --- handle typedef names correctly ** fix struct/union parsing bug (empty struct is accepted) ** add productions to handle macros --- require ** error correction --- main source of conflicts in grammar. ** need to process initializations sequentially, L->R ** ** production names are cryptic, so more productions fit on one line ** ** conflicts: 87 shift/reduce, 18 reduce/reduce ** most of these are due to handling macros ** a few are due to handling type expressions */ /*@=allmacros@*/ extern int yylex (); extern void yyerror (char *); # include "splintMacros.nf" # include "basic.h" # include "cscanner.h" # include "cscannerHelp.h" # include "cgrammar.h" # include "exprChecks.h" /*@-allmacros@*/ /*@-matchfields@*/ # define SHOWCSYM FALSE /* ** This is necessary, or else when the bison-generated code #include's malloc.h, ** there will be a parse error. ** ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations ** in bison-generated files under Win32. */ # ifdef WIN32 # undef malloc # undef calloc # undef realloc # endif %} %union { lltok tok; int count; qual typequal; qualList tquallist; ctype ctyp; /*@dependent@*/ sRef sr; /*@only@*/ sRef osr; /*@only@*/ functionClauseList funcclauselist; /*@only@*/ functionClause funcclause; /*@only@*/ flagSpec flagspec; /*@only@*/ globalsClause globsclause; /*@only@*/ modifiesClause modsclause; /*@only@*/ warnClause warnclause; /*@only@*/ stateClause stateclause; /*@only@*/ pointers pointers; /*@only@*/ functionConstraint fcnconstraint; /*@only@*/ metaStateConstraint msconstraint; /*@only@*/ metaStateSpecifier msspec; /*@only@*/ metaStateExpression msexpr; /*@observer@*/ metaStateInfo msinfo; /*@only@*/ sRefList srlist; /*@only@*/ globSet globset; /*@only@*/ qtype qtyp; /*@only@*/ cstring cname; /*@observer@*/ annotationInfo annotation; /*@only@*/ idDecl ntyp; /*@only@*/ idDeclList ntyplist; /*@only@*/ uentryList flist; /*@owned@*/ uentryList entrylist; /*@observer@*/ /*@dependent@*/ uentry entry; /*@only@*/ uentry oentry; /*@only@*/ exprNode expr; /*@only@*/ enumNameList enumnamelist; /*@only@*/ exprNodeList exprlist; /*@only@*/ sRefSet srset; /*@only@*/ cstringList cstringlist; /*drl added 1/19/2001 */ constraint con; constraintList conL; constraintExpr conE; /* drl */ } /* standard C tokens */ %token BADTOK SKIPTOK %token CTOK_ELIPSIS CASE DEFAULT CIF CELSE SWITCH WHILE DO CFOR %token GOTO CONTINUE BREAK RETURN %token TSEMI TLBRACE TRBRACE TCOMMA TCOLON TASSIGN TLPAREN %token TRPAREN TLSQBR TRSQBR TDOT TAMPERSAND TEXCL TTILDE %token TMINUS TPLUS TMULT TDIV TPERCENT TLT TGT TCIRC TBAR TQUEST %token CSIZEOF CALIGNOF CTYPEOF ARROW_OP CTYPEDEF COFFSETOF %token INC_OP DEC_OP LEFT_OP RIGHT_OP %token LE_OP GE_OP EQ_OP NE_OP AND_OP OR_OP %token MUL_ASSIGN DIV_ASSIGN MOD_ASSIGN ADD_ASSIGN SUB_ASSIGN %token LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN %token CSTRUCT CUNION CENUM %token VA_ARG VA_DCL %token QWARN %token QGLOBALS %token QMODIFIES %token QNOMODS %token QCONSTANT %token QFUNCTION %token QITER %token QDEFINES %token QUSES %token QALLOCATES %token QSETS %token QRELEASES %token QPRECLAUSE %token QPOSTCLAUSE %token QINVARIANT %token QALT %token QUNDEF QKILLED %token QENDMACRO /* additional tokens introduced by splint pre-processor. */ %token LLMACRO LLMACROITER LLMACROEND TENDMACRO /* For debugging purposes */ %token QDREVEALSTATE /* break comments: */ %token QSWITCHBREAK QLOOPBREAK QINNERBREAK QSAFEBREAK %token QINNERCONTINUE /* case fall-through marker: */ %token QFALLTHROUGH /* used in scanner only */ %token QLINTNOTREACHED %token QLINTFALLTHROUGH %token QLINTFALLTHRU %token QARGSUSED %token QPRINTFLIKE QLINTPRINTFLIKE QSCANFLIKE QMESSAGELIKE /* not-reached marker: (used like a label) */ %token QNOTREACHED /* type qualifiers: */ %token QCONST QRESTRICT QVOLATILE QINLINE QEXTENSION QEXTERN QSTATIC QAUTO QREGISTER %token QOUT QIN QYIELD QONLY QTEMP QSHARED QREF QUNIQUE %token QCHECKED QUNCHECKED QCHECKEDSTRICT QCHECKMOD %token QKEEP QKEPT QPARTIAL QSPECIAL QOWNED QDEPENDENT %token QRETURNED QEXPOSED QNULL QOBSERVER QISNULL %token QEXITS QMAYEXIT QNEVEREXIT QTRUEEXIT QFALSEEXIT %token QLONG QSIGNED QUNSIGNED QSHORT QUNUSED QSEF QNOTNULL QRELNULL %token QABSTRACT QNUMABSTRACT QCONCRETE QMUTABLE QIMMUTABLE %token QTRUENULL QFALSENULL QEXTERNAL %token QREFCOUNTED QREFS QNEWREF QTEMPREF QKILLREF QRELDEF %token CGCHAR CBOOL CINT CGFLOAT CDOUBLE CVOID %token QANYTYPE QINTEGRALTYPE QUNSIGNEDINTEGRALTYPE QSIGNEDINTEGRALTYPE %token QNULLTERMINATED %token QSETBUFFERSIZE %token QSETSTRINGLENGTH %token QMAXSET %token QMAXREAD %token QTESTINRANGE %token TCAND /* identifiers, literals */ %token IDENTIFIER %token NEW_IDENTIFIER TYPE_NAME_OR_ID %token CANNOTATION %token CCONSTANT %type flagId %type flagSpec %type cconstantExpr %token ITER_NAME ITER_ENDNAME %type endIter %type functionClauses functionClausesPlain %type functionClause functionClausePlain %type globalsClause globalsClausePlain %type modifiesClause modifiesClausePlain nomodsClause %type warnClause warnClausePlain optWarnClause %type conditionClause conditionClausePlain %type stateClause stateClausePlain %type metaStateConstraint %type functionConstraint %type metaStateSpecifier %type metaStateExpression %type globId globIdListExpr %type globIdList %token TYPE_NAME %token METASTATE_NAME %type metaStateName %type enumerator newId /*@-varuse@*/ /* yacc declares yytranslate here */ %type pointers /*@=varuse@*/ %type doHeader stateTag conditionTag startConditionClause %type exitsQualifier checkQualifier stateQualifier paramQualifier returnQualifier visibilityQualifier typedefQualifier refcountQualifier definedQualifier /* type construction */ %type abstractDecl abstractDeclBase optAbstractDeclBase %type suSpc enumSpc typeName typeSpecifier %type namedDecl namedDeclBase optNamedDecl %type plainNamedDecl plainNamedDeclBase %type structNamedDecl %type fcnDefHdrAux plainFcn %type paramDecl %type id %type structNamedDeclList %type genericParamList paramTypeList paramList idList paramIdList %type argumentExprList iterArgList %type initList namedInitializerList namedInitializerListAux namedInitializerTypeList namedInitializerTypeListAux %type structDeclList structDecl %type locModifies modList specClauseList optSpecClauseList %type mExpr modListExpr specClauseListExpr /*drl*/ %type BufConstraint %type relationalOp %type BufBinaryOp %type bufferModifier %type BufConstraintExpr %type BufConstraintTerm %type BufConstraintSrefExpr %type BufConstraintList %type optStructInvariant %type BufUnaryOp /*drl 1/6/2002 either /\ or && */ %type constraintSeperator %type enumeratorList %type fieldDesignator %type sizeofExpr sizeofExprAux offsetofExpr %type openScope closeScope %type instanceDecl namedInitializer optDeclarators namedInitializerType %type primaryExpr postfixExpr primaryIterExpr postfixIterExpr %type unaryExpr castExpr timesExpr plusExpr %type unaryIterExpr castIterExpr timesIterExpr plusIterExpr %type shiftExpr relationalExpr equalityExpr bitandExpr %type xorExpr bitorExpr andExpr %type orExpr conditionalExpr assignExpr %type shiftIterExpr relationalIterExpr equalityIterExpr bitandIterExpr %type xorIterExpr bitorIterExpr andIterExpr %type orIterExpr conditionalIterExpr assignIterExpr iterArgExpr %type expr optExpr constantExpr %type init macroBody iterBody endBody partialIterStmt iterSelectionStmt %type stmt stmtList fcnBody iterStmt iterDefStmt iterDefStmtList debugStmt %type labeledStmt caseStmt defaultStmt %type compoundStmt compoundStmtAux compoundStmtRest compoundStmtAuxErr %type expressionStmt selectionStmt iterationStmt jumpStmt iterDefIterationStmt %type stmtErr stmtListErr compoundStmtErr expressionStmtErr %type iterationStmtErr initializerList typeInitializerList initializer %type ifPred whilePred forPred iterWhilePred typeInitializer %type designator designatorList designation %type storageSpecifier typeQualifier typeModifier globQual innerMods %type optGlobQuals innerModsList %type completeType completeTypeSpecifier optCompleteType %type completeTypeSpecifierAux altType typeExpression %start file %% file : | externalDefs ; externalDefs : externalDef { context_checkGlobalScope (); } | externalDefs externalDef { context_checkGlobalScope (); } ; externalDef : fcnDef optSemi { uentry_clearDecl (); } | constantDecl { uentry_clearDecl (); } | fcnDecl { uentry_clearDecl (); } | iterDecl { uentry_clearDecl (); } | macroDef { uentry_clearDecl (); } | initializer { uentry_checkDecl (); exprNode_free ($1); } | TSEMI { uentry_clearDecl (); lltok_free ($1); /* evans 2002-02-08: okay to have a null statement */ } | error { uentry_clearDecl (); } ; constantDecl : QCONSTANT completeTypeSpecifier NotType namedDecl NotType optSemi IsType QENDMACRO { checkConstant ($2, $4); lltok_free2 ($1, $8); } | QCONSTANT completeTypeSpecifier NotType namedDecl NotType TASSIGN IsType init optDeclarators optSemi QENDMACRO { checkValueConstant ($2, $4, $8); lltok_free3 ($1, $6, $11); } ; fcnDecl : QFUNCTION { context_enterFunctionHeader (); } plainFcn optSemi QENDMACRO { declareStaticFunction ($3); context_quietExitFunction (); context_exitFunctionHeader (); lltok_free2 ($1, $5); /*!*/ } ; plainFcn : plainNamedDecl { qtype qint = qtype_create (ctype_int); $$ = idDecl_fixBase ($1, qint); qtype_free (qint); } | completeTypeSpecifier NotType plainNamedDecl { $$ = idDecl_fixBase ($3, $1); } ; plainNamedDecl : plainNamedDeclBase | pointers plainNamedDeclBase { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); } ; namedDeclBase : newId { $$ = idDecl_create ($1, qtype_unknown ()); } | IsType TLPAREN NotType namedDecl IsType TRPAREN { $$ = idDecl_expectFunction ($4); lltok_free2 ($2, $6); } | namedDeclBase TLSQBR TRSQBR { $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1))); lltok_free2 ($2, $3); } | namedDeclBase TLSQBR IsType constantExpr TRSQBR NotType { exprNode_findValue ($4); idDecl_notExpectingFunction ($1); if (exprNode_hasValue ($4)) { $$ = idDecl_replaceCtype ($1, ctype_makeInnerFixedArray (idDecl_getCtype ($1), exprNode_getLongValue ($4))); } else { $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1))); } lltok_free2 ($2, $5); } | namedDeclBase PushType TLPAREN TRPAREN { setCurrentParams (uentryList_missingParams); } functionClauses { /* need to support globals and modifies here! */ functionClauseList fcl; ctype ct = ctype_makeFunction (idDecl_getCtype ($1), uentryList_makeMissingParams ()); $$ = idDecl_replaceCtype ($1, ct); /*drl 7/25/01 added*/ setImplicitfcnConstraints(); DPRINTF((message("namedDeclBase PushType TLPAREN TRPAREN...:\n adding implict constraints to functionClause List: %s", functionClauseList_unparse($6) ) )); fcl = functionClauseList_setImplicitConstraints($6); idDecl_addClauses ($$, fcl); DPRINTF((message("1 added fuctionClause List: %s to the Id", functionClauseList_unparse(fcl) ) )); context_popLoc (); lltok_free2 ($3, $4); } | namedDeclBase PushType TLPAREN genericParamList TRPAREN { setCurrentParams ($4); } functionClauses { functionClauseList fcl; setImplicitfcnConstraints (); clearCurrentParams (); $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4)); DPRINTF((message("namedDeclBase PushType TLPAREN genericParamList TRPAREN...:\n adding implict constraints to functionClause List: %s", functionClauseList_unparse($7) ) )) ; fcl = functionClauseList_setImplicitConstraints($7); idDecl_addClauses ($$, fcl); DPRINTF((message("added fuctionClause List: %s to the Id", functionClauseList_unparse(fcl) ) )); context_popLoc (); lltok_free2 ($3, $5); } ; plainNamedDeclBase : newId { $$ = idDecl_create ($1, qtype_unknown ()); } | IsType TLPAREN NotType plainNamedDecl IsType TRPAREN { $$ = idDecl_expectFunction ($4); lltok_free2 ($2, $6); } | plainNamedDeclBase TLSQBR TRSQBR { $$ = idDecl_replaceCtype ($1, ctype_makeInnerArray (idDecl_getCtype ($1))); lltok_free2 ($2, $3); } | plainNamedDeclBase TLSQBR IsType constantExpr TRSQBR NotType { int value; if (exprNode_hasValue ($4) && multiVal_isInt (exprNode_getValue ($4))) { value = (int) multiVal_forceInt (exprNode_getValue ($4)); } else { value = 0; } $$ = idDecl_replaceCtype ($1, ctype_makeInnerFixedArray (idDecl_getCtype ($1), value)); lltok_free2 ($2, $5); } | plainNamedDeclBase PushType TLPAREN TRPAREN { setCurrentParams (uentryList_missingParams); } functionClausesPlain { ctype ct = ctype_makeFunction (idDecl_getCtype ($1), uentryList_makeMissingParams ()); $$ = idDecl_replaceCtype ($1, ct); idDecl_addClauses ($$, $6); context_popLoc (); lltok_free2 ($3, $4); } | plainNamedDeclBase PushType TLPAREN genericParamList TRPAREN { setCurrentParams ($4); } functionClausesPlain { clearCurrentParams (); $$ = idDecl_replaceCtype ($1, ctype_makeFunction (idDecl_getCtype ($1), $4)); idDecl_addClauses ($$, $7); context_popLoc (); lltok_free ($3); /*!! lltok_free2 ($3, $5); */ } ; iterDecl : QITER newId TLPAREN genericParamList TRPAREN { setCurrentParams ($4); } functionClausesPlain { clearCurrentParams (); } optSemi QENDMACRO { declareCIter ($2, $4); lltok_free3 ($1, $3, $5); } ; macroDef : LLMACRO macroBody TENDMACRO { exprNode_checkMacroBody ($2); lltok_free2 ($1, $3); } | LLMACROITER iterBody TENDMACRO { exprNode_checkIterBody ($2); lltok_free2 ($1, $3); } | LLMACROEND endBody TENDMACRO { exprNode_checkIterEnd ($2); lltok_free2 ($1, $3);} | LLMACRO TENDMACRO /* no stmt */ { exprChecks_checkEmptyMacroBody (); lltok_free2 ($1, $2); } ; fcnDefHdr : fcnDefHdrAux { clabstract_declareFunction ($1); } ; metaStateConstraint : metaStateSpecifier TASSIGN metaStateExpression { $$ = metaStateConstraint_create ($1, $3); lltok_free ($2); } ; metaStateSpecifier : BufConstraintSrefExpr { cscannerHelp_expectingMetaStateName (); } TCOLON metaStateName { cscannerHelp_clearExpectingMetaStateName (); $$ = metaStateSpecifier_create ($1, $4); lltok_free ($3); } | CTOK_ELIPSIS { cscannerHelp_expectingMetaStateName (); } TCOLON metaStateName { cscannerHelp_clearExpectingMetaStateName (); $$ = metaStateSpecifier_createElipsis ($4); lltok_free2 ($1, $3); } ; metaStateExpression : metaStateSpecifier { $$ = metaStateExpression_create ($1); } | metaStateSpecifier TBAR metaStateExpression { $$ = metaStateExpression_createMerge ($1, $3); lltok_free ($2); } ; metaStateName : METASTATE_NAME ; /*drl*/ constraintSeperator : TCAND | AND_OP ; BufConstraintList : BufConstraint constraintSeperator BufConstraintList { $$ = constraintList_add ($3, $1); } | BufConstraint { $$ = constraintList_single ($1); } ; BufConstraint : BufConstraintExpr relationalOp BufConstraintExpr { $$ = makeConstraintParse3 ($1, $2, $3); DPRINTF(("Done BufConstraint1\n")); } ; bufferModifier : QMAXSET | QMAXREAD ; relationalOp : GE_OP | LE_OP | EQ_OP ; BufConstraintExpr : BufConstraintTerm | BufUnaryOp TLPAREN BufConstraintExpr TRPAREN {$$ = constraintExpr_parseMakeUnaryOp ($1, $3); DPRINTF( ("Got BufConstraintExpr UNary Op ") ); } | TLPAREN BufConstraintExpr BufBinaryOp BufConstraintExpr TRPAREN { DPRINTF( ("Got BufConstraintExpr BINary Op ") ); $$ = constraintExpr_parseMakeBinaryOp ($2, $3, $4); } ; BufConstraintTerm : BufConstraintSrefExpr { $$ = constraintExpr_makeTermsRef ($1);} | CCONSTANT { $$ = constraintExpr_makeIntLiteral (exprNode_getLongValue ($1)); } ; BufConstraintSrefExpr : id { /*@-onlytrans@*/ $$ = checkbufferConstraintClausesId ($1); /*@=onlytrans@*/ /*@i523@*/ } | NEW_IDENTIFIER { $$ = fixStateClausesId ($1); } | BufConstraintSrefExpr TLSQBR TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); } | BufConstraintSrefExpr TLSQBR CCONSTANT TRSQBR { /* char *t; int c; t = cstring_toCharsSafe (exprNode_unparse($3)); c = atoi( t ); */ $$ = sRef_makeArrayFetchKnown ($1, exprNode_getLongValue ($3)); } | TMULT BufConstraintSrefExpr { $$ = sRef_constructPointer ($2); } | TLPAREN BufConstraintSrefExpr TRPAREN { $$ = $2; } | BufConstraintSrefExpr TDOT newId { cstring_markOwned ($3); $$ = sRef_buildField ($1, $3); } | BufConstraintSrefExpr ARROW_OP newId { cstring_markOwned ($3); $$ = sRef_makeArrow ($1, $3); } /* | BufConstraintTerm TLSQBR TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); } | specClauseListExpr TLSQBR mExpr TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); } | TLPAREN specClauseListExpr TRPAREN { $$ = $2; } | specClauseListExpr TDOT newId { cstring_markOwned ($3); $$ = sRef_buildField ($1, $3); } */ ; /*BufConstraintExpr : BufConstraintTerm */ BufUnaryOp : bufferModifier ; BufBinaryOp : TPLUS | TMINUS ; /* ** Function clauses can appear in any order. */ functionClauses : { $$ = functionClauseList_new (); } | functionClause functionClauses { $$ = functionClauseList_prepend ($2, $1); } ; /* ** Inside macro definitions, there are no end macros. */ functionClausesPlain : { $$ = functionClauseList_new (); } | functionClausePlain functionClausesPlain { $$ = functionClauseList_prepend ($2, $1); } ; functionClause : globalsClause { $$ = functionClause_createGlobals ($1); } | modifiesClause { $$ = functionClause_createModifies ($1); } | nomodsClause { $$ = functionClause_createModifies ($1); } | stateClause { $$ = functionClause_createState ($1); } | conditionClause { $$ = $1; } | warnClause { $$ = functionClause_createWarn ($1); } ; functionClausePlain : globalsClausePlain { $$ = functionClause_createGlobals ($1); } | modifiesClausePlain { $$ = functionClause_createModifies ($1); } | nomodsClause { $$ = functionClause_createModifies ($1); } | stateClausePlain { $$ = functionClause_createState ($1); } | conditionClausePlain { $$ = $1; } | warnClausePlain { $$ = functionClause_createWarn ($1); } ; globalsClause : globalsClausePlain QENDMACRO { $$ = $1; } ; globalsClausePlain : QGLOBALS { setProcessingGlobalsList (); } globIdList optSemi { unsetProcessingGlobals (); $$ = globalsClause_create ($1, $3); } ; nomodsClause : QNOMODS { $$ = modifiesClause_createNoMods ($1); } ; modifiesClause : modifiesClausePlain QENDMACRO { $$ = $1; } ; modifiesClausePlain : QMODIFIES { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); } locModifies { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); $$ = modifiesClause_create ($1, $3); } ; flagSpec : flagId { $$ = flagSpec_createPlain ($1); } | flagId TBAR flagSpec { $$ = flagSpec_createOr ($1, $3); } ; flagId : NEW_IDENTIFIER ; optWarnClause : warnClause | /* empty */ { $$ = warnClause_undefined; } ; warnClause : warnClausePlain QENDMACRO { $$ = $1; } ; warnClausePlain : QWARN flagSpec cconstantExpr { llassert (exprNode_knownStringValue ($3)); $$ = warnClause_create ($1, $2, cstring_copy (multiVal_forceString (exprNode_getValue ($3)))); exprNode_free ($3); } | QWARN flagSpec { $$ = warnClause_create ($1, $2, cstring_undefined); } ; globIdList : globIdListExpr { $$ = globSet_single ($1); } | globIdList TCOMMA globIdListExpr { $$ = globSet_insert ($1, $3); } ; globIdListExpr : optGlobQuals globId { $$ = clabstract_createGlobal ($2, $1); } ; optGlobQuals : /* empty */ { $$ = qualList_undefined; } | globQual optGlobQuals { $$ = qualList_add ($2, $1); } ; globId : id { $$ = uentry_getSref ($1); } | NEW_IDENTIFIER { $$ = clabstract_unrecognizedGlobal ($1); } | initializer { $$ = clabstract_checkGlobal ($1); } ; globQual : QUNDEF { $$ = qual_createUndef (); } | QKILLED { $$ = qual_createKilled (); } | QOUT { $$ = qual_createOut (); } | QIN { $$ = qual_createIn (); } | QPARTIAL { $$ = qual_createPartial (); } ; stateTag : QDEFINES | QUSES | QALLOCATES | QSETS | QRELEASES ; conditionTag : QPRECLAUSE | QPOSTCLAUSE ; fcnDefHdrAux : namedDecl { /**!!! deal with fred; fred (int); declarations! **/ qtype qint = qtype_create (ctype_int); $$ = idDecl_fixBase ($1, qint); qtype_free (qint); } | completeTypeSpecifier NotType namedDecl { $$ = idDecl_fixBase ($3, $1); } ; fcnBody : TLBRACE { checkDoneParams (); context_enterInnerContext (); } compoundStmtRest { exprNode_checkFunctionBody ($3); $$ = $3; context_exitInner ($3); } | { context_enterOldStyleScope (); } initializerList { oldStyleDoneParams (); context_enterInnerContext (); } compoundStmt { exprNode_checkFunctionBody ($4); $$ = $4; /* oldstyle */ context_exitInner ($4); } ; fcnDef : fcnDefHdr fcnBody { context_setFunctionDefined (exprNode_loc ($2)); exprNode_checkFunction (context_getHeader (), $2); /* DRL 8 8 2000 */ context_exitFunction (); } ; locModifies : modList optSemi { $$ = $1; } | optSemi { $$ = sRefSet_new (); } ; modListExpr : id { $$ = uentry_getSref ($1); checkModifiesId ($1); } | NEW_IDENTIFIER { $$ = fixModifiesId ($1); } | TYPE_NAME_OR_ID { $$ = fixModifiesId ($1); } | modListExpr TLSQBR TRSQBR { $$ = modListArrayFetch ($1, sRef_undefined); } | modListExpr TLSQBR mExpr TRSQBR { $$ = modListArrayFetch ($1, $3); } | TMULT modListExpr { $$ = modListPointer ($2); } | TLPAREN modListExpr TRPAREN { $$ = $2; } | modListExpr TDOT newId { $$ = modListFieldAccess ($1, $3); } | modListExpr ARROW_OP newId { $$ = modListArrowAccess ($1, $3); } ; mExpr : modListExpr { $$ = $1; } | cconstantExpr { $$ = sRef_makeUnknown (); /* sRef_makeConstant ($1); ? */ } /* arithmetic? */ ; modList : modListExpr { $$ = sRefSet_single ($1); } | modList TCOMMA modListExpr { $$ = sRefSet_insert ($1, $3); } ; specClauseListExpr : id { $$ = checkStateClausesId ($1); } | NEW_IDENTIFIER { $$ = fixStateClausesId ($1); } | specClauseListExpr TLSQBR TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); } | specClauseListExpr TLSQBR mExpr TRSQBR { $$ = sRef_makeAnyArrayFetch ($1); } | TMULT specClauseListExpr { $$ = sRef_constructPointer ($2); } | TLPAREN specClauseListExpr TRPAREN { $$ = $2; } | specClauseListExpr TDOT newId { cstring_markOwned ($3); $$ = sRef_buildField ($1, $3); } | specClauseListExpr ARROW_OP newId { cstring_markOwned ($3); $$ = sRef_makeArrow ($1, $3); } ; optSpecClauseList : /* empty */ { DPRINTF ((message("Empty optSpecClauseList") )); $$ = sRefSet_undefined } | specClauseList ; specClauseList : specClauseListExpr { if (sRef_isValid ($1)) { $$ = sRefSet_single ($1); } else { DPRINTF((message("returning sRefSEt_undefined ") )); $$ = sRefSet_undefined; } } | specClauseList TCOMMA specClauseListExpr { if (sRef_isValid ($3)) { $$ = sRefSet_insert ($1, $3); } else { $$ = $1; } } ; primaryExpr : id { $$ = exprNode_fromIdentifier ($1); } | NEW_IDENTIFIER { $$ = exprNode_fromUIO ($1); } | cconstantExpr | TLPAREN expr TRPAREN { $$ = exprNode_addParens ($1, $2); } | TYPE_NAME_OR_ID { $$ = exprNode_fromIdentifier (cscannerHelp_coerceId ($1)); } | QEXTENSION { $$ = exprNode_makeError (); } | TLPAREN { exprChecks_inCompoundStatementExpression (); } compoundStmt TRPAREN { exprChecks_leaveCompoundStatementExpression (); $$ = exprNode_compoundStatementExpression ($1, $3); } ; postfixExpr : primaryExpr | postfixExpr TLSQBR expr TRSQBR { $$ = exprNode_arrayFetch ($1, $3); } | postfixExpr TLPAREN TRPAREN { $$ = exprNode_functionCall ($1, exprNodeList_new ()); } | postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); } | VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN { $$ = exprNode_vaArg ($1, $3, $5); } | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $3, $4); } | postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $3, $4); } | postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); } | postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); } | TLPAREN typeExpression TRPAREN TLBRACE typeInitializerList optComma TRBRACE { /* added for C99 */ $$ = exprNode_undefined; /*@i87 no checking */ } ; argumentExprList : assignExpr { $$ = exprNodeList_singleton ($1); } | argumentExprList TCOMMA assignExpr { $$ = exprNodeList_push ($1, $3); } ; unaryExpr : postfixExpr | INC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); } | DEC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); } | TAMPERSAND castExpr { $$ = exprNode_preOp ($2, $1); } | TMULT castExpr { $$ = exprNode_preOp ($2, $1); } | TPLUS castExpr { $$ = exprNode_preOp ($2, $1); } | TMINUS castExpr { $$ = exprNode_preOp ($2, $1); } | TTILDE castExpr { $$ = exprNode_preOp ($2, $1); } | TEXCL castExpr { $$ = exprNode_preOp ($2, $1); } | processSizeof sizeofExpr endprocessSizeof { $$ = $2; } | offsetofExpr { $$ = $1; } ; fieldDesignator : fieldDesignator TDOT newId { $$ = cstringList_add ($1, $3); lltok_free ($2); } | fieldDesignator TLSQBR expr TRSQBR { $$ = $1; lltok_free2 ($2, $4); } /* evans 2002-07-02: offsetof designators can use array indexes */ | newId { $$ = cstringList_single ($1); } ; offsetofExpr : COFFSETOF IsType TLPAREN typeExpression NotType TCOMMA fieldDesignator TRPAREN IsType { $$ = exprNode_offsetof ($4, $7); lltok_free3 ($1, $3, $6); lltok_free ($8); } ; sizeofExpr : IsType { context_setProtectVars (); } sizeofExprAux { context_sizeofReleaseVars (); $$ = $3; } ; processSizeof: {context_enterSizeof()}; endprocessSizeof: {context_leaveSizeof()}; sizeofExprAux : CSIZEOF TLPAREN typeExpression TRPAREN { $$ = exprNode_sizeofType ($3); lltok_free3 ($1, $2, $4); } | CSIZEOF unaryExpr { $$ = exprNode_sizeofExpr ($2); lltok_free ($1); } | CALIGNOF TLPAREN typeExpression TRPAREN { $$ = exprNode_alignofType ($3); lltok_free3 ($1, $2, $4); } | CALIGNOF unaryExpr { $$ = exprNode_alignofExpr ($2); lltok_free ($1); } ; castExpr : unaryExpr | TLPAREN typeExpression TRPAREN castExpr { $$ = exprNode_cast ($1, $4, $2); lltok_free ($3); } ; timesExpr : castExpr | timesExpr TMULT castExpr { $$ = exprNode_op ($1, $3, $2); } | timesExpr TDIV castExpr { $$ = exprNode_op ($1, $3, $2); } | timesExpr TPERCENT castExpr { $$ = exprNode_op ($1, $3, $2); } ; plusExpr : timesExpr | plusExpr TPLUS timesExpr { $$ = exprNode_op ($1, $3, $2); } | plusExpr TMINUS timesExpr { $$ = exprNode_op ($1, $3, $2); } ; shiftExpr : plusExpr | shiftExpr LEFT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); } | shiftExpr RIGHT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); } ; relationalExpr : shiftExpr | relationalExpr TLT shiftExpr { $$ = exprNode_op ($1, $3, $2); } | relationalExpr TGT shiftExpr { $$ = exprNode_op ($1, $3, $2); } | relationalExpr LE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); } | relationalExpr GE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); } ; equalityExpr : relationalExpr | equalityExpr EQ_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); } | equalityExpr NE_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); } ; bitandExpr : equalityExpr | bitandExpr TAMPERSAND equalityExpr { $$ = exprNode_op ($1, $3, $2); } ; xorExpr : bitandExpr | xorExpr TCIRC bitandExpr { $$ = exprNode_op ($1, $3, $2); } ; bitorExpr : xorExpr | bitorExpr TBAR xorExpr { $$ = exprNode_op ($1, $3, $2); } ; andExpr : bitorExpr | andExpr AND_OP { exprNode_produceGuards ($1); context_enterAndClause ($1); } bitorExpr { $$ = exprNode_op ($1, $4, $2); context_exitAndClause ($$, $4); } ; orExpr : andExpr | orExpr OR_OP { exprNode_produceGuards ($1); context_enterOrClause ($1); } andExpr { $$ = exprNode_op ($1, $4, $2); context_exitOrClause ($$, $4); } ; conditionalExpr : orExpr | orExpr TQUEST { /* GCC extension: conditional with empty if */ exprNode_produceGuards ($1); context_enterTrueClause ($1); } TCOLON { context_enterFalseClause ($1); } conditionalExpr { $$ = exprNode_condIfOmit ($1, $6); context_exitClause ($1, exprNode_undefined, $6); } | orExpr TQUEST { exprNode_produceGuards ($1); context_enterTrueClause ($1); } expr TCOLON { context_enterFalseClause ($1); } conditionalExpr { $$ = exprNode_cond ($1, $4, $7); context_exitClause ($1, $4, $7); } ; assignExpr : conditionalExpr | unaryExpr TASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr MUL_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr DIV_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr MOD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr ADD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr SUB_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr LEFT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr RIGHT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr AND_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr XOR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr OR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } ; expr : assignExpr | expr TCOMMA assignExpr { $$ = exprNode_comma ($1, $3); } ; optExpr : /* empty */ { $$ = exprNode_undefined; } | expr ; constantExpr : conditionalExpr ; /* instance_orTypeDecl_and_possible_initialization */ initializer : instanceDecl { $$ = $1; } | VA_DCL { doVaDcl (); $$ = exprNode_makeError (); } | typeDecl { $$ = exprNode_makeError (); } ; instanceDecl : completeTypeSpecifier IsType TSEMI { $$ = exprNode_makeError (); } /* ** This causes r/r conflicts with function definitions. ** Instead we need to snarf one first. (gack) ** ** | completeTypeSpecifier { setProcessingVars ($1); } ** NotType ** namedInitializerList IsType TSEMI ** { unsetProcessingVars (); } **; ** ** the solution is pretty ugly: */ | completeTypeSpecifier NotType namedDecl NotType { setProcessingVars ($1); processNamedDecl ($3); } IsType optDeclarators TSEMI IsType { unsetProcessingVars (); $$ = exprNode_makeEmptyInitialization ($3); DPRINTF (("Empty initialization: %s", exprNode_unparse ($$))); } | completeTypeSpecifier NotType namedDecl NotType TASSIGN { setProcessingVars ($1); processNamedDecl ($3); } IsType init optDeclarators TSEMI IsType { $$ = exprNode_concat ($9, exprNode_makeInitialization ($3, $8)); unsetProcessingVars (); } ; namedInitializerType : namedInitializer { $$ = $1; } | TYPE_NAME { $$ = exprNode_fromIdentifier (usymtab_getTypeEntry (ctype_typeId ($1))); } ; namedInitializer : namedDecl NotType { processNamedDecl ($1); $$ = exprNode_makeEmptyInitialization ($1); } | namedDecl NotType TASSIGN { processNamedDecl ($1); } IsType init { $$ = exprNode_makeInitialization ($1, $6); } ; typeDecl : CTYPEDEF completeTypeSpecifier { setProcessingTypedef ($2); } NotType namedInitializerTypeList IsType optWarnClause TSEMI { clabstract_declareType ($5, $7); } | CTYPEDEF completeTypeSpecifier IsType TSEMI { /* in the ANSI grammar, semantics unclear */ } | CTYPEDEF namedInitializerList IsType TSEMI { /* in the ANSI grammar, semantics unclear */ } ; IsType : { cscannerHelp_setExpectingTypeName (); } ; PushType : { cscannerHelp_setExpectingTypeName (); context_pushLoc (); } ; namedInitializerList : namedInitializerListAux IsType { $$ = $1; } ; namedInitializerListAux : namedInitializer { $$ = exprNodeList_singleton ($1); } | namedInitializerList TCOMMA NotType namedInitializer { $$ = exprNodeList_push ($1, $4); } ; namedInitializerTypeList : namedInitializerTypeListAux IsType { $$ = $1; } ; namedInitializerTypeListAux : namedInitializerType { $$ = exprNodeList_singleton ($1); } | namedInitializerTypeList TCOMMA NotType namedInitializerType { $$ = exprNodeList_push ($1, $4); } ; optDeclarators : /* empty */ { $$ = exprNode_makeError (); } | optDeclarators TCOMMA NotType namedInitializer { $$ = exprNode_concat ($1, $4); } ; init : assignExpr | TLBRACE initList TRBRACE { $$ = exprNode_makeInitBlock ($1, $2); lltok_free ($3); } | TLBRACE initList TCOMMA TRBRACE { $$ = exprNode_makeInitBlock ($1, $2); lltok_free2 ($3, $4); } | designation init { $$ = exprNode_undefined; } ; /* ** Splint parses these (added in ISO C99), but no checking yet... */ designation : designatorList TASSIGN { $$ = $1; } | newId TCOLON { $$ = exprNode_undefined; /* gcc extension, obsolete since 2.5 */ } ; designatorList : designator { $$ = exprNode_undefined; } | designatorList designator { $$ = exprNode_undefined; } ; designator : TLSQBR constantExpr TRSQBR { $$ = exprNode_undefined; } | TDOT newId { $$ = exprNode_undefined; } ; initList : init { $$ = exprNodeList_singleton ($1); } | initList TCOMMA init { $$ = exprNodeList_push ($1, $3); } ; /* ** need to do the storage class global hack so tags are ** declared with the right storage class. */ storageSpecifier : QEXTERN { setStorageClass (SCEXTERN); $$ = qual_createExtern (); } | QINLINE { $$ = qual_createInline (); } | QSTATIC { setStorageClass (SCSTATIC); $$ = qual_createStatic (); } | QAUTO { $$ = qual_createAuto (); } | QREGISTER { $$ = qual_createRegister (); } ; stateClause : stateClausePlain QENDMACRO { $$ = $1; } ; stateClausePlain : stateTag NotType { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); } specClauseList optSemi IsType { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); $$ = stateClause_createPlain ($1, $4); } ; conditionClause : conditionClausePlain QENDMACRO { $$ = $1; } ; startConditionClause : conditionTag NotType { $$ = $1; context_enterFunctionHeader (); } ; conditionClausePlain : startConditionClause stateQualifier { context_exitFunctionHeader (); context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); } optSpecClauseList optSemi IsType { exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); $$ = functionClause_createState (stateClause_create ($1, $2, $4)); } | startConditionClause { context_setProtectVars (); enterParamsTemp (); sRef_setGlobalScopeSafe (); } functionConstraint optSemi IsType { context_exitFunctionHeader (); exitParamsTemp (); sRef_clearGlobalScopeSafe (); context_releaseVars (); DPRINTF (("done optGlobBufConstraintsAux\n")); if (lltok_isEnsures ($1)) { $$ = functionClause_createEnsures ($3); } else if (lltok_isRequires ($1)) { $$ = functionClause_createRequires ($3); } else { BADBRANCH; } DPRINTF (("FunctionclauseS: %s", functionClause_unparse ($$))); } ; functionConstraint : BufConstraintList { $$ = functionConstraint_createBufferConstraint ($1); } | metaStateConstraint { $$ = functionConstraint_createMetaStateConstraint ($1); DPRINTF (("Made constraint: %s", functionConstraint_unparse ($$))); } ; exitsQualifier : QEXITS { $$ = qual_createExits (); } | QMAYEXIT { $$ = qual_createMayExit (); } | QTRUEEXIT { $$ = qual_createTrueExit (); } | QFALSEEXIT { $$ = qual_createFalseExit (); } | QNEVEREXIT { $$ = qual_createNeverExit (); } ; checkQualifier : QCHECKED { $$ = qual_createChecked (); } | QCHECKMOD { $$ = qual_createCheckMod (); } | QUNCHECKED { $$ = qual_createUnchecked (); } | QCHECKEDSTRICT { $$ = qual_createCheckedStrict (); } ; stateQualifier : QOWNED { $$ = qual_createOwned (); } | QDEPENDENT { $$ = qual_createDependent (); } | QYIELD { $$ = qual_createYield (); } | QTEMP { $$ = qual_createTemp (); } | QONLY { $$ = qual_createOnly (); } | QKEEP { $$ = qual_createKeep (); } | QKEPT { $$ = qual_createKept (); } | QSHARED { $$ = qual_createShared (); } | QUNIQUE { $$ = qual_createUnique (); } | QNULL { $$ = qual_createNull (); } | QISNULL { $$ = qual_createIsNull (); } | QRELNULL { $$ = qual_createRelNull (); } | QNOTNULL { $$ = qual_createNotNull (); } | QEXPOSED { $$ = qual_createExposed (); } | QOBSERVER { $$ = qual_createObserver (); } | QNULLTERMINATED { $$ = qual_createNullTerminated (); } | CANNOTATION { $$ = qual_createMetaState ($1); } ; paramQualifier : QRETURNED { $$ = qual_createReturned (); } | QSEF { $$ = qual_createSef (); } ; visibilityQualifier : QUNUSED { $$ = qual_createUnused (); } | QEXTERNAL { $$ = qual_createExternal (); } ; returnQualifier : QTRUENULL { $$ = qual_createTrueNull (); } | QFALSENULL { $$ = qual_createFalseNull (); } ; typedefQualifier : QABSTRACT { $$ = qual_createAbstract (); } | QNUMABSTRACT { $$ = qual_createNumAbstract (); } | QCONCRETE { $$ = qual_createConcrete (); } | QMUTABLE { $$ = qual_createMutable (); } | QIMMUTABLE { $$ = qual_createImmutable (); } ; refcountQualifier : QREFCOUNTED { $$ = qual_createRefCounted (); } | QREFS { $$ = qual_createRefs (); } | QKILLREF { $$ = qual_createKillRef (); } | QRELDEF { $$ = qual_createRelDef (); } | QNEWREF { $$ = qual_createNewRef (); } | QTEMPREF { $$ = qual_createTempRef (); } ; typeModifier : QSHORT { $$ = qual_createShort (); } | QLONG { $$ = qual_createLong (); } | QSIGNED { $$ = qual_createSigned (); } | QUNSIGNED { $$ = qual_createUnsigned (); } ; definedQualifier : QOUT { $$ = qual_createOut (); } | QIN { $$ = qual_createIn (); } | QPARTIAL { $$ = qual_createPartial (); } | QSPECIAL { $$ = qual_createSpecial (); } ; typeQualifier : QCONST IsType { $$ = qual_createConst (); } | QVOLATILE IsType { $$ = qual_createVolatile (); } | QRESTRICT IsType { $$ = qual_createRestrict (); } | definedQualifier IsType { $$ = $1; } | stateQualifier IsType { $$ = $1; } | exitsQualifier IsType { $$ = $1; } | paramQualifier IsType { $$ = $1; } | checkQualifier IsType { $$ = $1; } | returnQualifier IsType { $$ = $1; } | visibilityQualifier IsType { $$ = $1; } | typedefQualifier IsType { $$ = $1; } | refcountQualifier IsType { $$ = $1; } ; /* ** This is copied into the mtgrammar! */ typeSpecifier : CGCHAR NotType | CINT NotType | CBOOL NotType | CGFLOAT NotType | CDOUBLE NotType | CVOID NotType | QANYTYPE NotType { $$ = ctype_makeAnytype (); } | QINTEGRALTYPE NotType { $$ = ctype_anyintegral; } | QUNSIGNEDINTEGRALTYPE NotType { $$ = ctype_unsignedintegral; } | QSIGNEDINTEGRALTYPE NotType { $$ = ctype_signedintegral; } | typeName NotType | suSpc NotType | enumSpc NotType | typeModifier NotType { $$ = ctype_fromQual ($1); } ; completeType : IsType completeTypeSpecifier IsType { $$ = qtype_resolve ($2); } ; completeTypeSpecifier : completeTypeSpecifierAux { $$ = $1; } | completeTypeSpecifierAux QALT altType QENDMACRO { $$ = qtype_mergeAlt ($1, $3); } ; altType : typeExpression | typeExpression TCOMMA altType { $$ = qtype_mergeAlt ($1, $3); } ; completeTypeSpecifierAux : storageSpecifier optCompleteType { $$ = qtype_addQual ($2, $1); } | typeQualifier optCompleteType { $$ = qtype_addQual ($2, $1); } | typeSpecifier optCompleteType { $$ = qtype_combine ($2, $1); } ; optCompleteType : /* empty */ { $$ = qtype_unknown (); } | completeTypeSpecifier { $$ = $1; } ; optStructInvariant : /* empty */ { $$ = constraintList_undefined; } /* drl commenting before a CVS commit | QINVARIANT BufConstraintList QENDMACRO { $$ = $2 } */ ; suSpc : NotType CSTRUCT newId IsType TLBRACE { sRef_setGlobalScopeSafe (); } CreateStructInnerScope structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } TRBRACE optStructInvariant { ctype ct; ct = declareStruct ($3, $8); /* context_setGlobalStructInfo(ct, $12); */ $$ = ct; } | NotType CUNION newId IsType TLBRACE { sRef_setGlobalScopeSafe (); } CreateStructInnerScope structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } TRBRACE { $$ = declareUnion ($3, $8); } | NotType CSTRUCT newId IsType TLBRACE TRBRACE { $$ = declareStruct ($3, uentryList_new ()); } | NotType CUNION newId IsType TLBRACE TRBRACE { $$ = declareUnion ($3, uentryList_new ()); } | NotType CSTRUCT IsType TLBRACE { sRef_setGlobalScopeSafe (); } CreateStructInnerScope structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } TRBRACE { $$ = declareUnnamedStruct ($7); } | NotType CUNION IsType TLBRACE { sRef_setGlobalScopeSafe (); } CreateStructInnerScope structDeclList DeleteStructInnerScope { sRef_clearGlobalScopeSafe (); } TRBRACE { $$ = declareUnnamedUnion ($7); } | NotType CSTRUCT IsType TLBRACE TRBRACE { $$ = ctype_createUnnamedStruct (uentryList_new ()); } | NotType CUNION IsType TLBRACE TRBRACE { $$ = ctype_createUnnamedUnion (uentryList_new ()); } | NotType CSTRUCT newId NotType { $$ = handleStruct ($3); } | NotType CUNION newId NotType { $$ = handleUnion ($3); } ; NotType : { cscannerHelp_clearExpectingTypeName (); } ; structDeclList : structDecl | macroDef { $$ = uentryList_undefined; /* bogus! */ } | structDeclList structDecl { $$ = uentryList_mergeFields ($1, $2); } ; structDecl : completeTypeSpecifier NotType structNamedDeclList IsType TSEMI { $$ = fixUentryList ($3, $1); } | completeTypeSpecifier IsType TSEMI { $$ = fixUnnamedDecl ($1); } ; structNamedDeclList : structNamedDecl NotType { $$ = idDeclList_singleton ($1); } | structNamedDeclList TCOMMA structNamedDecl NotType { $$ = idDeclList_add ($1, $3); } ; structNamedDecl /* hack to get around namespace problems */ : namedDecl { $$ = $1; } | TCOLON IsType constantExpr { $$ = idDecl_undefined; } | namedDecl TCOLON IsType constantExpr { $$ = $1; } /* Need the IsType in case there is a cast in the constant expression. */ ; enumSpc : NotType CENUM TLBRACE enumeratorList TRBRACE IsType { $$ = declareUnnamedEnum ($4); } | NotType CENUM newId TLBRACE { context_pushLoc (); } enumeratorList TRBRACE IsType { context_popLoc (); $$ = declareEnum ($3, $6); } | NotType CENUM newId IsType { $$ = handleEnum ($3); } ; enumeratorList : enumerator { $$ = enumNameList_single ($1); } | enumeratorList TCOMMA enumerator { $$ = enumNameList_push ($1, $3); } | enumeratorList TCOMMA ; enumerator : newId { uentry ue = uentry_makeEnumConstant ($1, ctype_unknown); usymtab_supGlobalEntry (ue); $$ = $1; } | newId TASSIGN IsType constantExpr { uentry ue = uentry_makeEnumInitializedConstant ($1, ctype_unknown, $4); usymtab_supGlobalEntry (ue); $$ = $1; } ; optNamedDecl : namedDeclBase | optAbstractDeclBase { $$ = idDecl_create (cstring_undefined, qtype_create ($1)); } | pointers TYPE_NAME { qtype qt = qtype_unknown (); qtype_adjustPointers ($1, qt); $$ = idDecl_create (cstring_copy (cscannerHelp_observeLastIdentifier ()), qt); } | pointers optNamedDecl { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); } ; namedDecl : namedDeclBase | pointers namedDeclBase { $$ = $2; qtype_adjustPointers ($1, idDecl_getTyp ($$)); } ; genericParamList : paramTypeList { $$ = handleParamTypeList ($1); } | NotType paramIdList { $$ = handleParamIdList ($2); } ; innerMods : QCONST { $$ = qual_createConst (); } | QRESTRICT { $$ = qual_createRestrict (); } | QVOLATILE { $$ = qual_createVolatile (); } ; innerModsList : innerMods { $$ = qualList_single ($1); } | innerModsList innerMods { $$ = qualList_add ($1, $2); } ; pointers : TMULT { $$ = pointers_create ($1); } | TMULT innerModsList { $$ = pointers_createMods ($1, $2); } | TMULT pointers { $$ = pointers_extend (pointers_create ($1), $2); } | TMULT innerModsList pointers { $$ = pointers_extend (pointers_createMods ($1, $2), $3); } ; paramIdList : idList | idList TCOMMA CTOK_ELIPSIS { $$ = uentryList_add ($1, uentry_makeElipsisMarker ()); } ; idList : newId { $$ = uentryList_single (uentry_makeVariableLoc ($1, ctype_int)); } | idList TCOMMA newId { $$ = uentryList_add ($1, uentry_makeVariableLoc ($3, ctype_int)); } ; paramTypeList : CTOK_ELIPSIS { $$ = uentryList_single (uentry_makeElipsisMarker ()); } | paramList | paramList TCOMMA CTOK_ELIPSIS { $$ = uentryList_add ($1, uentry_makeElipsisMarker ()); } ; paramList : { storeLoc (); } paramDecl { $$ = uentryList_single ($2); } | paramList TCOMMA { storeLoc (); } paramDecl { $$ = uentryList_add ($1, $4); } ; paramDecl : IsType completeTypeSpecifier optNamedDecl IsType { if (isFlipOldStyle ()) { llparseerror (cstring_makeLiteral ("Inconsistent function parameter syntax (mixing old and new style declaration)")); } else { setNewStyle (); } $$ = makeCurrentParam (idDecl_fixParamBase ($3, $2)); } | newId /* its an old-style declaration */ { idDecl tparam = idDecl_create ($1, qtype_unknown ()); if (isNewStyle ()) { llparseerror (message ("Inconsistent function parameter syntax: %q", idDecl_unparse (tparam))); } setFlipOldStyle (); $$ = makeCurrentParam (tparam); idDecl_free (tparam); } ; typeExpression : completeType | completeType abstractDecl { $$ = qtype_newBase ($1, $2); } ; abstractDecl : pointers { $$ = ctype_adjustPointers ($1, ctype_unknown); } | abstractDeclBase | pointers abstractDeclBase { $$ = ctype_adjustPointers ($1, $2); } ; optAbstractDeclBase : /* empty */ { $$ = ctype_unknown; } | abstractDeclBase ; abstractDeclBase : IsType TLPAREN NotType abstractDecl TRPAREN { $$ = ctype_expectFunction ($4); } | TLSQBR TRSQBR { $$ = ctype_makeArray (ctype_unknown); } | TLSQBR constantExpr TRSQBR { $$ = ctype_makeFixedArray (ctype_unknown, exprNode_getLongValue ($2)); } | abstractDeclBase TLSQBR TRSQBR { $$ = ctype_makeInnerArray ($1); } | abstractDeclBase TLSQBR constantExpr TRSQBR { $$ = ctype_makeInnerFixedArray ($1, exprNode_getLongValue ($3)); } | IsType TLPAREN TRPAREN { $$ = ctype_makeFunction (ctype_unknown, uentryList_makeMissingParams ()); } | IsType TLPAREN paramTypeList TRPAREN { $$ = ctype_makeParamsFunction (ctype_unknown, $3); } | abstractDeclBase IsType TLPAREN TRPAREN { $$ = ctype_makeFunction ($1, uentryList_makeMissingParams ()); } | abstractDeclBase IsType TLPAREN paramTypeList TRPAREN { $$ = ctype_makeParamsFunction ($1, $4); } ; /* statement */ stmt : labeledStmt | caseStmt | defaultStmt | compoundStmt | expressionStmt | selectionStmt | iterationStmt | iterStmt | jumpStmt | debugStmt ; debugStmt : QDREVEALSTATE TLPAREN expr TRPAREN { exprNode_revealState ($3); $$ = exprNode_undefined; } ; iterBody : iterDefStmtList { $$ = $1; } ; endBody : iterBody ; iterDefStmtList : iterDefStmt | iterDefStmtList iterDefStmt { $$ = exprNode_concat ($1, $2); } ; iterDefIterationStmt : iterWhilePred iterDefStmtList { $$ = exprNode_while ($1, $2); } | doHeader stmtErr WHILE TLPAREN expr TRPAREN TSEMI { $$ = exprNode_doWhile ($2, $5); } | doHeader stmtErr WHILE TLPAREN expr TRPAREN { $$ = exprNode_doWhile ($2, $5); } | forPred iterDefStmt { $$ = exprNode_for ($1, $2); } ; forPred : CFOR TLPAREN optExpr TSEMI optExpr TSEMI { context_setProtectVars (); } optExpr { context_sizeofReleaseVars (); } TRPAREN { $$ = exprNode_forPred ($3, $5, $8); context_enterForClause ($5); } ; partialIterStmt : ITER_NAME CreateInnerScope TLPAREN { setProcessingIterVars ($1); } iterArgList TRPAREN { $$ = exprNode_iterStart ($1, $5); } | ITER_ENDNAME { $$ = exprNode_createId ($1); } ; iterDefStmt : labeledStmt | caseStmt | defaultStmt | openScope initializerList { $$ = $1; DPRINTF (("def stmt: %s", exprNode_unparse ($$))); } | openScope | closeScope | expressionStmt | iterSelectionStmt | iterDefIterationStmt | partialIterStmt | jumpStmt | TLPAREN iterDefStmt TRPAREN { $$ = $2; } | error { $$ = exprNode_makeError (); } ; iterSelectionStmt : ifPred { exprNode_checkIfPred ($1); } iterDefStmt { /* don't: context_exitTrueClause ($1, $2); */ $$ = exprNode_if ($1, $3); } ; openScope : CreateInnerScope TLBRACE { $$ = exprNode_createTok ($2); } ; closeScope : DeleteInnerScopeSafe TRBRACE { $$ = exprNode_createTok ($2); } ; macroBody : stmtErr | stmtListErr ; stmtErr : labeledStmt | caseStmt | defaultStmt | compoundStmtErr | expressionStmtErr | selectionStmt | iterStmt | iterationStmtErr | TLPAREN stmtErr TRPAREN { $$ = exprNode_addParens ($1, $2); } | jumpStmt | debugStmt | error { $$ = exprNode_makeError (); } ; labeledStmt : newId TCOLON { $$ = exprNode_labelMarker ($1); } | QNOTREACHED stmt { $$ = exprNode_notReached ($2); } ; /* ** We allow more than one QFALLTHROUGH token to support mixed lint/splint markers. */ optExtraFallThroughs : /* empty */ { ; } | QFALLTHROUGH optExtraFallThroughs { ; } ; /* Note that we can semantically check that the object to the case is indeed constant. In this case, we may not want to go through this effort */ caseStmt : CASE constantExpr { context_enterCaseClause ($2); } TCOLON { $$ = exprNode_caseMarker ($2, FALSE); } | QFALLTHROUGH optExtraFallThroughs CASE constantExpr { context_enterCaseClause ($4); } TCOLON { $$ = exprNode_caseMarker ($4, TRUE); } ; defaultStmt : DEFAULT { context_enterCaseClause (exprNode_undefined); } TCOLON { $$ = exprNode_defaultMarker ($1, FALSE); } | QFALLTHROUGH optExtraFallThroughs DEFAULT { context_enterCaseClause (exprNode_undefined); } TCOLON { $$ = exprNode_defaultMarker ($3, TRUE); } ; compoundStmt : TLPAREN compoundStmt TRPAREN { $$ = $2; } | CreateInnerScope compoundStmtAux { $$ = $2; context_exitInner ($2); } ; compoundStmtErr : CreateInnerScope compoundStmtAuxErr DeleteInnerScope { $$ = $2; } ; CreateInnerScope : { context_enterInnerContext (); } ; DeleteInnerScope : { context_exitInnerPlain (); } ; CreateStructInnerScope : { context_enterStructInnerContext (); } ; DeleteStructInnerScope : { context_exitStructInnerContext (); } ; DeleteInnerScopeSafe : { context_exitInnerSafe (); } ; compoundStmtRest : TRBRACE { $$ = exprNode_createTok ($1); } | QNOTREACHED TRBRACE { $$ = exprNode_notReached (exprNode_createTok ($2)); } | stmtList TRBRACE { $$ = exprNode_updateLocation ($1, lltok_getLoc ($2)); } | stmtList QNOTREACHED TRBRACE { $$ = exprNode_notReached (exprNode_updateLocation ($1, lltok_getLoc ($3))); } | initializerList TRBRACE { $$ = exprNode_updateLocation ($1, lltok_getLoc ($2)); } | initializerList QNOTREACHED TRBRACE { $$ = exprNode_notReached (exprNode_updateLocation ($1, lltok_getLoc ($3))); } | initializerList stmtList TRBRACE { $$ = exprNode_updateLocation (exprNode_concat ($1, $2), lltok_getLoc ($3)); } | initializerList stmtList QNOTREACHED TRBRACE { $$ = exprNode_notReached (exprNode_updateLocation (exprNode_concat ($1, $2), lltok_getLoc ($3))); } ; compoundStmtAux : TLBRACE compoundStmtRest { $$ = exprNode_makeBlock ($2); } ; compoundStmtAuxErr : TLBRACE TRBRACE { $$ = exprNode_createTok ($2); } | TLBRACE stmtListErr TRBRACE { $$ = exprNode_updateLocation ($2, lltok_getLoc ($3)); } | TLBRACE initializerList TRBRACE { $$ = exprNode_updateLocation ($2, lltok_getLoc ($3)); } | TLBRACE initializerList stmtList TRBRACE { $$ = exprNode_updateLocation (exprNode_concat ($2, $3), lltok_getLoc ($4)); } ; stmtListErr : stmtErr | stmtListErr stmtErr { $$ = exprNode_concat ($1, $2); } ; initializerList : initializer { $$ = $1; } | initializerList initializer { $$ = exprNode_concat ($1, $2); } ; typeInitializerList : typeInitializer { $$ = $1; } | typeInitializerList TCOMMA typeInitializer { $$ = exprNode_concat ($1, $3); } ; typeInitializer : assignExpr { $$ = $1; } | TLBRACE typeInitializerList optComma TRBRACE { $$ = $2; } ; stmtList : stmt { $$ = $1; } | stmtList stmt { $$ = exprNode_concat ($1, $2); } ; expressionStmt : TSEMI { $$ = exprNode_createTok ($1); } | expr TSEMI { $$ = exprNode_statement ($1, $2); } ; expressionStmtErr : TSEMI { $$ = exprNode_createTok ($1); } | expr TSEMI { $$ = exprNode_statement ($1, $2); } | expr { $$ = exprNode_checkExpr ($1); } ; ifPred : CIF TLPAREN expr TRPAREN { exprNode_produceGuards ($3); context_enterTrueClause ($3); exprNode_checkIfPred ($3); $$ = $3; } /* ** not ANSI: | CIF TLPAREN compoundStmt TRPAREN ** { $$ = $3; context_enterTrueClause (); } */ ; selectionStmt : ifPred stmt { context_exitTrueClause ($1, $2); $$ = exprNode_if ($1, $2); } | ifPred stmt CELSE { context_enterFalseClause ($1); } stmt { context_exitClause ($1, $2, $5); $$ = exprNode_ifelse ($1, $2, $5); } | SWITCH TLPAREN expr { context_enterSwitch ($3); } TRPAREN stmt { $$ = exprNode_switch ($3, $6); } ; whilePred : WHILE TLPAREN expr TRPAREN { $$ = exprNode_whilePred ($3); context_enterWhileClause ($3); } /* not ANSI: | WHILE TLPAREN compoundStmt TRPAREN stmt { $$ = exprNode_while ($3, $5); } */ ; iterWhilePred : WHILE TLPAREN expr TRPAREN { $$ = exprNode_whilePred($3); } ; iterStmt : ITER_NAME { context_enterIterClause (); } CreateInnerScope TLPAREN { setProcessingIterVars ($1); } iterArgList TRPAREN compoundStmt endIter DeleteInnerScope { $$ = exprNode_iter ($1, $6, $8, $9); } ; iterArgList : iterArgExpr { $$ = exprNodeList_singleton ($1); } | iterArgList { nextIterParam (); } TCOMMA iterArgExpr { $$ = exprNodeList_push ($1, $4); } ; iterArgExpr : assignIterExpr { $$ = exprNode_iterExpr ($1); } | id { $$ = exprNode_iterId ($1); } | TYPE_NAME_OR_ID { uentry ue = cscannerHelp_coerceIterId ($1); if (uentry_isValid (ue)) { $$ = exprNode_iterId (ue); } else { $$ = exprNode_iterNewId (cstring_copy (cscannerHelp_observeLastIdentifier ())); } } | NEW_IDENTIFIER { $$ = exprNode_iterNewId ($1); } ; /* ** everything is the same, EXCEPT it cannot be a NEW_IDENTIFIER */ cconstantExpr : CCONSTANT | cconstantExpr CCONSTANT { $$ = exprNode_combineLiterals ($1, $2); } ; primaryIterExpr : cconstantExpr | TLPAREN expr TRPAREN { $$ = exprNode_addParens ($1, $2); } ; postfixIterExpr : primaryIterExpr | postfixExpr TLSQBR expr TRSQBR { $$ = exprNode_arrayFetch ($1, $3); } | postfixExpr TLPAREN TRPAREN { $$ = exprNode_functionCall ($1, exprNodeList_new ()); } | postfixExpr TLPAREN argumentExprList TRPAREN { $$ = exprNode_functionCall ($1, $3); } | VA_ARG TLPAREN assignExpr TCOMMA typeExpression TRPAREN { $$ = exprNode_vaArg ($1, $3, $5); } | postfixExpr NotType TDOT newId IsType { $$ = exprNode_fieldAccess ($1, $3, $4); } | postfixExpr NotType ARROW_OP newId IsType { $$ = exprNode_arrowAccess ($1, $3, $4); } | postfixExpr INC_OP { $$ = exprNode_postOp ($1, $2); } | postfixExpr DEC_OP { $$ = exprNode_postOp ($1, $2); } ; unaryIterExpr : postfixIterExpr | INC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); } | DEC_OP unaryExpr { $$ = exprNode_preOp ($2, $1); } | TAMPERSAND castExpr { $$ = exprNode_preOp ($2, $1); } | TMULT castExpr { $$ = exprNode_preOp ($2, $1); } | TPLUS castExpr { $$ = exprNode_preOp ($2, $1); } | TMINUS castExpr { $$ = exprNode_preOp ($2, $1); } | TTILDE castExpr { $$ = exprNode_preOp ($2, $1); } | TEXCL castExpr { $$ = exprNode_preOp ($2, $1); } | sizeofExpr { $$ = $1; } ; castIterExpr : unaryIterExpr | TLPAREN typeExpression TRPAREN castExpr { $$ = exprNode_cast ($1, $4, $2); } ; timesIterExpr : castIterExpr | timesExpr TMULT castExpr { $$ = exprNode_op ($1, $3, $2); } | timesExpr TDIV castExpr { $$ = exprNode_op ($1, $3, $2); } | timesExpr TPERCENT castExpr { $$ = exprNode_op ($1, $3, $2); } ; plusIterExpr : timesIterExpr | plusExpr TPLUS timesExpr { $$ = exprNode_op ($1, $3, $2); } | plusExpr TMINUS timesExpr { $$ = exprNode_op ($1, $3, $2); } ; shiftIterExpr : plusIterExpr | shiftExpr LEFT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); } | shiftExpr RIGHT_OP plusExpr { $$ = exprNode_op ($1, $3, $2); } ; relationalIterExpr : shiftIterExpr | relationalExpr TLT shiftExpr { $$ = exprNode_op ($1, $3, $2); } | relationalExpr TGT shiftExpr { $$ = exprNode_op ($1, $3, $2); } | relationalExpr LE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); } | relationalExpr GE_OP shiftExpr { $$ = exprNode_op ($1, $3, $2); } ; equalityIterExpr : relationalIterExpr | equalityExpr EQ_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); } | equalityExpr NE_OP relationalExpr { $$ = exprNode_op ($1, $3, $2); } ; bitandIterExpr : equalityIterExpr | bitandExpr TAMPERSAND equalityExpr { $$ = exprNode_op ($1, $3, $2); } ; xorIterExpr : bitandIterExpr | xorExpr TCIRC bitandExpr { $$ = exprNode_op ($1, $3, $2); } ; bitorIterExpr : xorIterExpr | bitorExpr TBAR xorExpr { $$ = exprNode_op ($1, $3, $2); } ; andIterExpr : bitorIterExpr | andExpr AND_OP bitorExpr { $$ = exprNode_op ($1, $3, $2); } ; orIterExpr : andIterExpr | orExpr OR_OP andExpr { $$ = exprNode_op ($1, $3, $2); } ; conditionalIterExpr : orIterExpr | orExpr TQUEST { context_enterTrueClause ($1); } TCOLON { context_enterFalseClause ($1); } conditionalExpr { $$ = exprNode_condIfOmit ($1, $6); } | orExpr TQUEST { context_enterTrueClause ($1); } expr TCOLON { context_enterFalseClause ($1); } conditionalExpr { $$ = exprNode_cond ($1, $4, $7); } ; assignIterExpr : conditionalIterExpr | unaryExpr TASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr MUL_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr DIV_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr MOD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr ADD_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr SUB_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr LEFT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr RIGHT_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr AND_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr XOR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } | unaryExpr OR_ASSIGN assignExpr { $$ = exprNode_assign ($1, $3, $2); } ; endIter : ITER_ENDNAME { $$ = $1; } | /* empty */ { $$ = uentry_undefined; } ; doHeader : DO { context_enterDoWhileClause (); $$ = $1; } ; iterationStmt : whilePred stmt { $$ = exprNode_while ($1, $2); context_exitWhileClause ($1, $2); } | doHeader stmt WHILE TLPAREN expr TRPAREN TSEMI { $$ = exprNode_statement (exprNode_doWhile ($2, $5), $7); } | forPred stmt { $$ = exprNode_for ($1, $2); context_exitForClause ($1, $2); } ; iterationStmtErr : whilePred stmtErr { $$ = exprNode_while ($1, $2); context_exitWhileClause ($1, $2); } | doHeader stmtErr WHILE TLPAREN expr TRPAREN TSEMI { $$ = exprNode_statement (exprNode_doWhile ($2, $5), $7); } | doHeader stmtErr WHILE TLPAREN expr TRPAREN { $$ = exprNode_doWhile ($2, $5); } | forPred stmtErr { $$ = exprNode_for ($1, $2); context_exitForClause ($1, $2); } ; jumpStmt : GOTO newId TSEMI { $$ = exprNode_goto ($2); } | CONTINUE TSEMI { $$ = exprNode_continue ($1, BADTOK); } | QINNERCONTINUE CONTINUE TSEMI { $$ = exprNode_continue ($1, QINNERCONTINUE); } | BREAK TSEMI { $$ = exprNode_break ($1, BADTOK); } | QSWITCHBREAK BREAK TSEMI { $$ = exprNode_break ($2, QSWITCHBREAK); } | QLOOPBREAK BREAK TSEMI { $$ = exprNode_break ($2, QLOOPBREAK); } | QINNERBREAK BREAK TSEMI { $$ = exprNode_break ($2, QINNERBREAK); } | QSAFEBREAK BREAK TSEMI { $$ = exprNode_break ($2, QSAFEBREAK); } | RETURN TSEMI { $$ = exprNode_nullReturn ($1); } | RETURN expr TSEMI { $$ = exprNode_return ($2); } ; optSemi : | TSEMI { ; } ; optComma : | TCOMMA { ; } ; id : IDENTIFIER ; newId : NEW_IDENTIFIER | ITER_NAME { $$ = uentry_getName ($1); } | ITER_ENDNAME { $$ = uentry_getName ($1); } | id { $$ = uentry_getName ($1); } | TYPE_NAME_OR_ID { $$ = $1; } ; typeName : TYPE_NAME | TYPE_NAME_OR_ID { $$ = ctype_unknown; } | CTYPEOF TLPAREN expr TRPAREN { $$ = exprNode_getType ($3); exprNode_free ($3); } | CTYPEOF TLPAREN typeExpression TRPAREN { $$ = qtype_getType ($3); } ; %% /*@-redecl@*/ /*@-namechecks@*/ extern char *yytext; /*@=redecl@*/ /*@=namechecks@*/ # include "bison.reset" void yyerror (/*@unused@*/ char *s) { static bool givehint = FALSE; if (context_inIterDef ()) { llerror (FLG_SYNTAX, message ("Iter syntax not parseable: %s", context_inFunctionName ())); } else if (context_inIterEnd ()) { llerror (FLG_SYNTAX, message ("Iter finalizer syntax not parseable: %s", context_inFunctionName ())); } else if (context_inMacro ()) { llerror (FLG_SYNTAX, message ("Macro syntax not parseable: %s", context_inFunctionName ())); if (context_inUnknownMacro ()) { if (!givehint) { llhint (cstring_makeLiteral ("Precede macro definition with /*@notfunction@*/ " "to suppress checking and force expansion")); givehint = TRUE; } } cscannerHelp_swallowMacro (); context_exitAllClausesQuiet (); } else { llparseerror (cstring_undefined); } } splint-3.1.2.dfsg1/src/llgrammar.y0000644021234200000250000013656607646432515014437 0ustar fax/*;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: splint@cs.virginia.edu ** To report a bug: splint-bug@cs.virginia.edu ** For more information: http://www.splint.org */ /* ** Original author: Yang Meng Tan, Massachusetts Institute of Technology */ %{ # include "splintMacros.nf" # include "basic.h" # include "lclscan.h" # include "checking.h" # include "lslparse.h" # include "lh.h" # include "usymtab_interface.h" /*@-noparams@*/ static /*@unused@*/ void yyprint (); /*@=noparams@*/ /*@-redecl@*/ void ylerror (char *) /*@modifies *g_warningstream@*/ ; /*@=redecl@*/ bool g_inTypeDef = FALSE; /*@constant int YYDEBUG;@*/ # define YYDEBUG 1 /*@notfunction@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) /* ** This is necessary, or else when the bison-generated code #include's malloc.h, ** there will be a parse error. ** ** Unfortunately, it means the error checking on malloc, etc. is lost for allocations ** in bison-generated files under Win32. */ # ifdef WIN32 # undef malloc # undef calloc # undef realloc # endif %} /*@-readonlytrans@*/ %union { ltoken ltok; /* a leaf is also an ltoken */ qual typequal; unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ abstDeclaratorNode abstDecl; /*@only@*/ declaratorNode declare; /*@only@*/ declaratorNodeList declarelist; /*@only@*/ typeExpr typeexpr; /*@only@*/ arrayQualNode array; /*@only@*/ quantifierNode quantifier; /*@only@*/ quantifierNodeList quantifiers; /*@only@*/ varNode var; /*@only@*/ varNodeList vars; /*@only@*/ storeRefNode storeref; /*@only@*/ storeRefNodeList storereflist; /*@only@*/ termNode term; /*@only@*/ termNodeList termlist; /*@only@*/ programNode program; /*@only@*/ stmtNode stmt; /*@only@*/ claimNode claim; /*@only@*/ typeNode type; /*@only@*/ iterNode iter; /*@only@*/ fcnNode fcn; /*@only@*/ fcnNodeList fcns; /*@only@*/ letDeclNode letdecl; /*@only@*/ letDeclNodeList letdecls; /*@only@*/ lclPredicateNode lclpredicate; /*@only@*/ modifyNode modify; /*@only@*/ paramNode param; /*@only@*/ paramNodeList paramlist; /*@only@*/ declaratorInvNodeList declaratorinvs; /*@only@*/ declaratorInvNode declaratorinv; /*@only@*/ abstBodyNode abstbody; /*@only@*/ abstractNode abstract; /*@only@*/ exposedNode exposed; /*@only@*/ pointers pointers; /* taggedUnionNode taggedunion; */ /*@only@*/ globalList globals; /*@only@*/ constDeclarationNode constdeclaration; /*@only@*/ varDeclarationNode vardeclaration; /*@only@*/ varDeclarationNodeList vardeclarationlist; /*@only@*/ initDeclNodeList initdecls; /*@only@*/ initDeclNode initdecl; /*@only@*/ stDeclNodeList structdecls; /*@only@*/ stDeclNode structdecl; /*@only@*/ strOrUnionNode structorunion; /*@only@*/ enumSpecNode enumspec; /*@only@*/ lclTypeSpecNode lcltypespec; /*@only@*/ typeNameNode typname; /*@only@*/ opFormNode opform; /*@only@*/ sigNode signature; /*@only@*/ nameNode name; /*@only@*/ typeNameNodeList namelist; /*@only@*/ replaceNode replace; /*@only@*/ replaceNodeList replacelist; /*@only@*/ renamingNode renaming; /*@only@*/ traitRefNode traitref; /*@only@*/ traitRefNodeList traitreflist; /*@only@*/ importNode import; /*@only@*/ importNodeList importlist; /*@only@*/ interfaceNode iface; /*@only@*/ interfaceNodeList interfacelist; /*@only@*/ CTypesNode ctypes; /*@-redef@*/ } /*@=redef@*/ /* Order of precedence is increasing going down the list */ %left simpleOp %right PREFIX_OP %left POSTFIX_OP %left LLT_MULOP /* as arithmetic binary operator, or as iteration construct in claims */ %left LLT_SEMI %left LLT_VERTICALBAR %nonassoc ITERATION_OP /* two * cannot follow each other */ %left LLT_LPAR LLT_LBRACKET selectSym /* to allow mixing if-then-else with other kinds of terms */ %left LLT_IF_THEN_ELSE %left logicalOp /* Note: the grammar parses b = p /\ q as (b = p) /\ q, that is, = has higher precedence than logicalOp. Reminder: = > logicalOp >= if_then_else > == (present in LSL) */ /* Precedence of claim operators: ( > * > | >; (| and; left-assoc) */ /* These are not needed in the grammar, but needed in init files and lclscanline.c */ %token eqSepSym /* \eqsep */ %token equationSym /* \equals or == */ %token commentSym /* \comment */ %token LLT_WHITESPACE %token LLT_EOL /*@-varuse@*/ /* yacc declares yytranslate here */ /* used to bypass parsing problems in C types */ %token LLT_TYPEDEF_NAME /*@=varuse@*/ /* LSL reserved extension symbols */ %token quantifierSym /* \forall */ %token logicalOp /* \implies, \and, \not, \or */ %token selectSym /* \select */ %token openSym /* \( */ %token closeSym /* \) */ %token sepSym /* \, */ %token simpleId /* \: id-char +, Ordinary Identifier */ %token mapSym /* \arrow, -> */ %token markerSym /* \marker, __ */ %token preSym /* \pre */ %token postSym /* \post */ %token anySym /* \any */ /* Generic LSL operators */ %token simpleOp /* opSym - reserved */ /* Reserved special symbols */ %token LLT_COLON /* : */ %token LLT_COMMA /* , */ %token LLT_EQUALS /* = */ %token LLT_LBRACE /* { */ %token LLT_RBRACE /* } */ %token LLT_LBRACKET /* [ */ %token LLT_RBRACKET /* ] */ %token LLT_LPAR /* ( */ %token LLT_RPAR /* ) */ %token LLT_QUOTE /* ' */ %token LLT_SEMI /*; */ %token LLT_VERTICALBAR /* | */ /* C operator tokens and Combined C/LSL operator tokens */ %token eqOp /* \eq, \neq, ==, != */ %token LLT_MULOP /* * */ /* LCL C literal tokens */ %token LLT_CCHAR %token LLT_CFLOAT %token LLT_CINTEGER %token LLT_LCSTRING /* LCL reserved words */ %token LLT_ALL %token LLT_ANYTHING %token LLT_BE %token LLT_BODY %token LLT_CLAIMS %token LLT_CHECKS %token LLT_CONSTANT %token LLT_ELSE %token LLT_ENSURES %token LLT_FOR %token LLT_FRESH %token LLT_IF %token LLT_IMMUTABLE %token LLT_IMPORTS %token LLT_CONSTRAINT /* was INVARIANT */ %token LLT_ISSUB %token LLT_LET %token LLT_MODIFIES %token LLT_MUTABLE %token LLT_NOTHING %token LLT_INTERNAL %token LLT_FILESYS %token LLT_OBJ %token LLT_OUT %token LLT_SEF %token LLT_ONLY LLT_PARTIAL LLT_OWNED LLT_DEPENDENT LLT_KEEP LLT_KEPT LLT_TEMP %token LLT_SHARED LLT_UNIQUE LLT_UNUSED %token LLT_EXITS LLT_MAYEXIT LLT_NEVEREXIT LLT_TRUEEXIT LLT_FALSEEXIT %token LLT_UNDEF LLT_KILLED %token LLT_CHECKMOD LLT_CHECKED LLT_UNCHECKED LLT_CHECKEDSTRICT %token LLT_TRUENULL %token LLT_FALSENULL %token LLT_LNULL %token LLT_LNOTNULL %token LLT_RETURNED %token LLT_OBSERVER %token LLT_EXPOSED %token LLT_REFCOUNTED %token LLT_REFS %token LLT_RELNULL %token LLT_RELDEF %token LLT_KILLREF %token LLT_NULLTERMINATED %token LLT_TEMPREF %token LLT_NEWREF %token LLT_PRIVATE %token LLT_REQUIRES %token LLT_RESULT %token LLT_SIZEOF %token LLT_SPEC %token LLT_TAGGEDUNION /* keep it for other parts of LCL checker */ %token LLT_THEN %token LLT_TYPE %token LLT_TYPEDEF %token LLT_UNCHANGED %token LLT_USES /* LCL C keywords */ %token LLT_CHAR %token LLT_CONST %token LLT_DOUBLE %token LLT_ENUM %token LLT_FLOAT %token LLT_INT %token LLT_ITER %token LLT_YIELD %token LLT_LONG %token LLT_SHORT %token LLT_SIGNED %token LLT_UNKNOWN %token LLT_STRUCT %token LLT_TELIPSIS %token LLT_UNION %token LLT_UNSIGNED %token LLT_VOID %token LLT_VOLATILE %token LLT_PRINTFLIKE LLT_SCANFLIKE LLT_MESSAGELIKE %type interface externals optDeclarations declarations %type external declaration imports uses export private private2 %type type %type fcn %type fcns %type claim %type iter %type varDeclaration globalDecl privateInit %type globals %type interfaceNameList traitIdList domain sortList %type importName %type importNameList %type traitRefNodeList %type traitRef %type renaming %type nameList %type name %type replaceNodeList %type replace %type opForm %type signature %type typeName %type middle placeList %type pointers %type optAbstDeclarator %type lclTypeSpec lclType sortSpec %type enumeratorList postfixOps %type CTypes typeSpecifier %type structOrUnionSpec %type enumSpec %type declarator %type notype_decl after_type_decl abstDeclarator parameter_decl %type declaratorList %type structDecls %type structDecl %type constDeclaration %type initDecls %type initDecl %type privateInits %type abstract %type exposed %type declaratorInvs %type declaratorInv %type abstBody optExposedBody %type optClaim optEnsure optRequire optChecks lclPredicate %type optTypeInv typeInv %type optModify %type optLetDecl beDeclList %type beDecl %type term constLclExpr initializer value equalityTerm %type simpleOpTerm prefixOpTerm secondary primary lclPrimary %type bracketed sqBracketed matched term0 cLiteral %type args infixOpPart valueList termList %type optBody callExpr %type stmt %type storeRefList %type storeRef %type quantified %type quantifiedList %type quantifier %type quantifiers %type arrayQual %type optParamList paramList realParamList iterParamList realIterParamList %type param iterParam %type open close anyOp separator simpleOp2 stateFcn %type interfaceName %type varId fcnId tagId claimId sortId traitId opId CType optTagId %type simpleIdOrTypedefName %type specialQualifier special /* ** Conventions in calling static semantic routines: ** The inputs are in strict order (in AST) as well as in the position of ** the call to the static semantic routine. */ /*@=redef@*/ /*@=readonlytrans@*/ %% interface : externals { lhExternals ($1); } optDeclarations { interfaceNodeList_free ($1); interfaceNodeList_free ($3); } ; externals : /* empty */ { $$ = interfaceNodeList_new (); } | externals external { $$ = interfaceNodeList_addh ($1, $2);} ; external : imports | uses ; optDeclarations : /* empty */ { $$ = interfaceNodeList_new (); } | export declarations { $$ = consInterfaceNode ($1, $2);} | private declarations { $$ = consInterfaceNode ($1, $2);} ; declarations : /* empty */ { $$ = interfaceNodeList_new (); } | declarations declaration { $$ = interfaceNodeList_addh ($1, $2);} ; declaration : export | private | uses ; imports : LLT_IMPORTS importNameList LLT_SEMI { $$ = makeInterfaceNodeImports ($2); /* assume subspecs are already processed, symbol table info in external file */ } ; uses : LLT_USES traitRefNodeList LLT_SEMI { $$ = makeInterfaceNodeUses ($2); readlsignatures ($$);} ; export : constDeclaration { declareConstant ($1); $$ = interfaceNode_makeConst ($1); } | varDeclaration { declareVar ($1); $$ = interfaceNode_makeVar ($1); } | type { declareType ($1); $$ = interfaceNode_makeType ($1); } | fcn { declareFcn ($1, typeId_invalid); $$ = interfaceNode_makeFcn ($1); } | claim { $$ = interfaceNode_makeClaim ($1); } | iter { declareIter ($1); $$ = interfaceNode_makeIter ($1); } ; iter : LLT_ITER varId LLT_LPAR iterParamList LLT_RPAR LLT_SEMI { $$ = makeIterNode ($2, $4); } ; iterParamList : /* empty */ { $$ = paramNodeList_new (); } | realIterParamList { $$ = $1; } ; realIterParamList : iterParam { $$ = paramNodeList_add (paramNodeList_new (), $1); } | realIterParamList LLT_COMMA iterParam { $$ = paramNodeList_add ($1,$3); } ; iterParam : LLT_YIELD param { $$ = markYieldParamNode ($2); } | param { $$ = $1; } ; private : LLT_SPEC { symtable_export (g_symtab, FALSE); } private2 { $$ = $3; symtable_export (g_symtab, TRUE); } ; private2 : constDeclaration { declarePrivConstant ($1); $$ = interfaceNode_makePrivConst ($1); } | varDeclaration { declarePrivVar ($1); $$ = interfaceNode_makePrivVar ($1); } | type { declarePrivType ($1); $$ = interfaceNode_makePrivType ($1); } | fcn { declarePrivFcn ($1, typeId_invalid); $$ = interfaceNode_makePrivFcn ($1); } ; constDeclaration : LLT_CONSTANT lclTypeSpec initDecls LLT_SEMI { $$ = makeConstDeclarationNode ($2, $3); } ; varDeclaration : lclTypeSpec initDecls LLT_SEMI { $$ = makeVarDeclarationNode ($1, $2, FALSE, FALSE); $$->qualifier = QLF_NONE; } | LLT_CONST lclTypeSpec initDecls LLT_SEMI { $$ = makeVarDeclarationNode ($2, $3, FALSE, FALSE); $$->qualifier = QLF_CONST; } | LLT_VOLATILE lclTypeSpec initDecls LLT_SEMI { $$ = makeVarDeclarationNode ($2, $3, FALSE, FALSE); $$->qualifier = QLF_VOLATILE; } ; type : abstract { $$ = makeAbstractTypeNode ($1); } | exposed { $$ = makeExposedTypeNode ($1); } ; special : LLT_PRINTFLIKE { $$ = qual_createPrintfLike (); } | LLT_SCANFLIKE { $$ = qual_createScanfLike (); } | LLT_MESSAGELIKE { $$ = qual_createMessageLike (); } ; fcn : lclTypeSpec declarator globals { enteringFcnScope ($1, $2, $3); } LLT_LBRACE privateInits optLetDecl optChecks optRequire optModify optEnsure optClaim LLT_RBRACE { $$ = makeFcnNode (qual_createUnknown (), $1, $2, $3, $6, $7, $8, $9, $10, $11, $12); /* type, declarator, glovbls, privateinits, lets, checks, requires, modifies, ensures, claims */ symtable_exitScope (g_symtab); } | special lclTypeSpec declarator globals { enteringFcnScope ($2, $3, $4); } LLT_LBRACE privateInits optLetDecl optChecks optRequire optModify optEnsure optClaim LLT_RBRACE { $$ = makeFcnNode ($1, $2, $3, $4, $7, $8, $9, $10, $11, $12, $13); /* type, declarator, glovbls, privateinits, lets, checks, requires, modifies, ensures, claims */ symtable_exitScope (g_symtab); } ; claim : LLT_CLAIMS claimId LLT_LPAR optParamList LLT_RPAR globals { enteringClaimScope ($4, $6); } LLT_LBRACE optLetDecl optRequire optBody optEnsure LLT_RBRACE { $$ = makeClaimNode ($2, $4, $6, $9, $10, $11, $12); symtable_exitScope (g_symtab); } | LLT_CLAIMS fcnId claimId LLT_SEMI { $$ = (claimNode) 0; } ; abstract : LLT_MUTABLE {g_inTypeDef = TRUE; } LLT_TYPE LLT_TYPEDEF_NAME {g_inTypeDef = FALSE; } abstBody { $$ = makeAbstractNode ($1, $4, TRUE, FALSE, $6); } | LLT_MUTABLE {g_inTypeDef = TRUE; } LLT_REFCOUNTED LLT_TYPE LLT_TYPEDEF_NAME {g_inTypeDef = FALSE; } abstBody { $$ = makeAbstractNode ($1, $5, TRUE, TRUE, $7); } | LLT_REFCOUNTED LLT_MUTABLE {g_inTypeDef = TRUE; } LLT_TYPE LLT_TYPEDEF_NAME {g_inTypeDef = FALSE; } abstBody { $$ = makeAbstractNode ($2, $5, TRUE, TRUE, $7); } | LLT_IMMUTABLE {g_inTypeDef = TRUE; } LLT_TYPE LLT_TYPEDEF_NAME {g_inTypeDef = FALSE; } abstBody { $$ = makeAbstractNode ($1, $4, FALSE, FALSE, $6); } ; exposed : LLT_TYPEDEF lclTypeSpec { g_inTypeDef = TRUE; setExposedType ($2); } declaratorInvs { g_inTypeDef = FALSE; } LLT_SEMI { $$ = makeExposedNode ($1, $2, $4); /* to support mutually recursive types */ } | structOrUnionSpec LLT_SEMI { $$ = makeExposedNode ($2, makeLclTypeSpecNodeSU ($1), declaratorInvNodeList_new ()); } | enumSpec LLT_SEMI { $$ = makeExposedNode ($2, makeLclTypeSpecNodeEnum ($1), declaratorInvNodeList_new ()); } /* evs - 26 Feb 1995 (changed to be consistent with C grammar) | STRUCT tagId LLT_SEMI { (void) checkAndEnterTag (TAG_FWDSTRUCT, ltoken_copy ($2)); lhForwardStruct ($2); $$ = (exposedNode)0; } | UNION tagId LLT_SEMI { (void) checkAndEnterTag (TAG_FWDUNION, ltoken_copy ($2)); lhForwardUnion ($2); $$ = (exposedNode)0; } */ ; importNameList : importName { $$ = importNodeList_add (importNodeList_new (), $1); } | importNameList LLT_COMMA importName { $$ = importNodeList_add ($1, $3); } ; importName : interfaceName { $$ = importNode_makePlain ($1); } | simpleOp interfaceName simpleOp { checkBrackets ($1, $3); $$ = importNode_makeBracketed ($2); } | LLT_LCSTRING { $$ = importNode_makeQuoted ($1); } ; interfaceNameList : interfaceName { $$ = ltokenList_singleton ($1); } | interfaceNameList LLT_COMMA interfaceName { $$ = ltokenList_push ($1, $3); } ; interfaceName : simpleIdOrTypedefName /* to allow module names to be the same as LCL type names */ ; traitRefNodeList : traitRef { $$ = traitRefNodeList_add (traitRefNodeList_new (), $1); } | traitRefNodeList LLT_COMMA traitRef { $$ = traitRefNodeList_add ($1, $3); } ; traitRef : traitId { $$ = makeTraitRefNode (ltokenList_singleton ($1), (renamingNode)0); } | traitId LLT_LPAR renaming LLT_RPAR { $$ = makeTraitRefNode (ltokenList_singleton ($1), $3); } | LLT_LPAR traitIdList LLT_RPAR { $$ = makeTraitRefNode ($2, (renamingNode)0); } | LLT_LPAR traitIdList LLT_RPAR LLT_LPAR renaming LLT_RPAR { $$ = makeTraitRefNode ($2, $5); } ; traitIdList : traitId { $$ = ltokenList_singleton ($1); } | traitIdList LLT_COMMA traitId { $$ = ltokenList_push ($1, $3); } ; renaming : replaceNodeList { $$ = makeRenamingNode (typeNameNodeList_new (), $1); } | nameList { $$ = makeRenamingNode ($1, replaceNodeList_new ()); } | nameList LLT_COMMA replaceNodeList { $$ = makeRenamingNode ($1, $3); } ; nameList : typeName { $$ = typeNameNodeList_add (typeNameNodeList_new (), $1); } | nameList LLT_COMMA typeName { $$ = typeNameNodeList_add ($1, $3); } ; replaceNodeList : replace { $$ = replaceNodeList_add (replaceNodeList_new (), $1); } | replaceNodeList LLT_COMMA replace { $$ = replaceNodeList_add ($1, $3); } ; replace : typeName LLT_FOR CType { $$ = makeReplaceNode ($2, $1, TRUE, $3, NULL, NULL); } | typeName LLT_FOR name { $$ = makeReplaceNameNode ($2, $1, $3); } | typeName LLT_FOR name signature { $$ = makeReplaceNode ($2, $1, FALSE, ltoken_undefined, $3, $4); } ; name : opId { $$ = makeNameNodeId ($1); } | opForm { $$ = makeNameNodeForm ($1); } ; initializer : constLclExpr ; constLclExpr : term ; initDecls : initDecl { $$ = initDeclNodeList_add (initDeclNodeList_new (), $1); } | initDecls LLT_COMMA initDecl { $$ = initDeclNodeList_add ($1, $3); } ; initDecl : declarator { $$ = makeInitDeclNode ($1, (termNode)0); } | declarator LLT_EQUALS initializer { $$ = makeInitDeclNode ($1, $3); } ; globals : /* empty */ /* has the same structure */ { $$ = varDeclarationNodeList_new (); } | globals globalDecl { varDeclarationNodeList_addh ($1, $2); $$ = $1; } ; globalDecl : lclTypeSpec initDecls LLT_SEMI { $$ = makeVarDeclarationNode ($1, $2, TRUE, FALSE); } | LLT_INTERNAL LLT_SEMI { $$ = makeInternalStateNode (); } | LLT_FILESYS LLT_SEMI { $$ = makeFileSystemNode (); } ; privateInits : /* empty */ { $$ = varDeclarationNodeList_new (); } | privateInits privateInit { varDeclarationNodeList_addh ($1, $2); $$ = $1; } ; privateInit : LLT_PRIVATE lclTypeSpec initDecls LLT_SEMI { $$ = makeVarDeclarationNode ($2, $3, FALSE, TRUE); } ; optLetDecl : /* empty */ { $$ = letDeclNodeList_new (); } | LLT_LET beDeclList LLT_SEMI { $$ = $2; } ; beDeclList : beDecl { $$ = letDeclNodeList_add (letDeclNodeList_new (), $1); } | beDeclList LLT_COMMA beDecl { $$ = letDeclNodeList_add ($1, $3); } ; beDecl : varId LLT_COLON sortSpec LLT_BE term { $$ = makeLetDeclNode ($1, $3, $5); } | varId LLT_BE term { $$ = makeLetDeclNode ($1, (lclTypeSpecNode)0, $3); } ; sortSpec : lclTypeSpec ; optChecks : /* empty */ { $$ = (lclPredicateNode)0; } | LLT_CHECKS lclPredicate LLT_SEMI { checkLclPredicate ($1, $2); $$ = makeChecksNode ($1, $2); } ; optRequire : /* empty */ { $$ = (lclPredicateNode)0; } | LLT_REQUIRES lclPredicate LLT_SEMI { checkLclPredicate ($1, $2); $$ = makeRequiresNode ($1, $2);} ; optModify : /* empty */ { $$ = (modifyNode)0; } | LLT_MODIFIES LLT_NOTHING LLT_SEMI { $$ = makeModifyNodeSpecial ($1, TRUE); } | LLT_MODIFIES LLT_ANYTHING LLT_SEMI { $$ = makeModifyNodeSpecial ($1, FALSE); } | LLT_MODIFIES storeRefList LLT_SEMI { $$ = makeModifyNodeRef ($1, $2); } ; storeRefList : storeRef { $$ = storeRefNodeList_add (storeRefNodeList_new (), $1); } | storeRefList LLT_COMMA storeRef { $$ = storeRefNodeList_add ($1, $3); } ; storeRef : term { $$ = makeStoreRefNodeTerm ($1); } | lclType { $$ = makeStoreRefNodeType ($1, FALSE); } | LLT_OBJ lclType { $$ = makeStoreRefNodeType ($2, TRUE); } | LLT_INTERNAL { $$ = makeStoreRefNodeInternal (); } | LLT_FILESYS { $$ = makeStoreRefNodeSystem (); } ; optEnsure : /* empty */ { $$ = (lclPredicateNode)0; } | LLT_ENSURES lclPredicate LLT_SEMI { checkLclPredicate ($1, $2); $$ = makeEnsuresNode ($1, $2);} ; optClaim : /* empty */ { $$ = (lclPredicateNode)0; } | LLT_CLAIMS lclPredicate LLT_SEMI { checkLclPredicate ($1, $2); $$ = makeIntraClaimNode ($1, $2);} ; optParamList : /* empty */ { $$ = paramNodeList_new (); } | realParamList { $$ = $1; } ; realParamList : paramList | LLT_TELIPSIS { $$ = paramNodeList_add (paramNodeList_new (), paramNode_elipsis ()); } | paramList LLT_COMMA LLT_TELIPSIS { $$ = paramNodeList_add ($1, paramNode_elipsis ()); } ; paramList : param { $$ = paramNodeList_single ($1); } | paramList LLT_COMMA param { $$ = paramNodeList_add ($1, $3); } ; optBody : /* empty */ { $$ = (programNode)0; } | LLT_BODY LLT_LBRACE callExpr LLT_RBRACE { $$ = $3; } | LLT_BODY LLT_LBRACE callExpr LLT_SEMI LLT_RBRACE { $$ = $3; } ; callExpr : stmt { $$ = makeProgramNode ($1); } | LLT_LPAR callExpr LLT_RPAR /* may need to make a copy of $2 */ { $$ = $2; $$->wrapped = $$->wrapped + 1; } | callExpr LLT_MULOP %prec ITERATION_OP { programNodeList x = programNodeList_new (); programNodeList_addh (x, $1); $$ = makeProgramNodeAction (x, ACT_ITER); } | callExpr LLT_VERTICALBAR callExpr { programNodeList x = programNodeList_new (); programNodeList_addh (x, $1); programNodeList_addh (x, $3); $$ = makeProgramNodeAction (x, ACT_ALTERNATE); } | callExpr LLT_SEMI callExpr { programNodeList x = programNodeList_new (); programNodeList_addh (x, $1); programNodeList_addh (x, $3); $$ = makeProgramNodeAction (x, ACT_SEQUENCE); } ; stmt : fcnId LLT_LPAR valueList LLT_RPAR { $$ = makeStmtNode (ltoken_undefined, $1, $3); } | fcnId LLT_LPAR LLT_RPAR { $$ = makeStmtNode (ltoken_undefined, $1, termNodeList_new ()); } | varId LLT_EQUALS fcnId LLT_LPAR LLT_RPAR { $$ = makeStmtNode ($1, $3, termNodeList_new ()); } | varId LLT_EQUALS fcnId LLT_LPAR valueList LLT_RPAR { $$ = makeStmtNode ($1, $3, $5); } ; valueList : value { $$ = termNodeList_push (termNodeList_new (), $1); } | valueList LLT_COMMA value { $$ = termNodeList_push ($1, $3); } ; value : cLiteral | varId { $$ = makeSimpleTermNode ($1); } | simpleOp value %prec PREFIX_OP { $$ = makePrefixTermNode ($1, $2); } | value simpleOp %prec POSTFIX_OP { $$ = makePostfixTermNode2 ($1, $2); } | value simpleOp value /* infix */ { $$ = makeInfixTermNode ($1, $2, $3); } | LLT_LPAR value LLT_RPAR { $$ = $2; $$->wrapped = $$->wrapped + 1; } | fcnId LLT_LPAR LLT_RPAR { $$ = makeOpCallTermNode ($1, $2, termNodeList_new (), $3); } | fcnId LLT_LPAR valueList LLT_RPAR { $$ = makeOpCallTermNode ($1, $2, $3, $4); } ; abstBody : LLT_SEMI { $$ = (abstBodyNode)0; } | LLT_LBRACE fcns LLT_RBRACE { $$ = makeAbstBodyNode ($1, $2); } | LLT_LBRACE interfaceNameList LLT_RBRACE LLT_SEMI { $$ = makeAbstBodyNode2 ($1, $2); } | LLT_LBRACE LLT_RBRACE LLT_SEMI { $$ = (abstBodyNode)0; } ; fcns : /* empty */ { $$ = fcnNodeList_new (); } | fcns fcn { $$ = fcnNodeList_add ($1, $2); } ; optTypeInv : /* empty */ { $$ = (lclPredicateNode)0; } | typeInv ; typeInv : LLT_CONSTRAINT { g_inTypeDef = FALSE; } quantifier LLT_LPAR lclPredicate LLT_RPAR { $5->tok = $1; $5->kind = LPD_CONSTRAINT; checkLclPredicate ($1, $5); $$ = $5; symtable_exitScope (g_symtab); g_inTypeDef = TRUE; } ; declaratorInvs : declaratorInv { $$ = declaratorInvNodeList_add (declaratorInvNodeList_new (), $1); } | declaratorInvs LLT_COMMA declaratorInv { $$ = declaratorInvNodeList_add ($1, $3); } ; declaratorInv : declarator { declareForwardType ($1); } optExposedBody { $$ = makeDeclaratorInvNode ($1, $3); } ; optExposedBody : /* empty */ { $$ = (abstBodyNode)0; } | LLT_LBRACE optTypeInv LLT_RBRACE { $$ = makeExposedBodyNode ($1, $2); } ; CType : LLT_VOID { $$ = $1; ltoken_setIntField ($$, fixBits (TS_VOID, 0)); } | LLT_CHAR { $$ = $1; ltoken_setIntField ($$, fixBits (TS_CHAR, 0)); } | LLT_DOUBLE { $$ = $1; ltoken_setIntField ($$, fixBits (TS_DOUBLE, 0)); } | LLT_FLOAT { $$ = $1; ltoken_setIntField ($$, fixBits (TS_FLOAT, 0)); } | LLT_INT { $$ = $1; ltoken_setIntField ($$, fixBits (TS_INT, 0)); } | LLT_LONG { $$ = $1; ltoken_setIntField ($$, fixBits (TS_LONG, 0)); } | LLT_SHORT { $$ = $1; ltoken_setIntField ($$, fixBits (TS_SHORT, 0)); } | LLT_SIGNED { $$ = $1; ltoken_setIntField ($$, fixBits (TS_SIGNED, 0)); } | LLT_UNSIGNED { $$ = $1; ltoken_setIntField ($$, fixBits (TS_UNSIGNED, 0)); } | LLT_UNKNOWN { $$ = $1; ltoken_setIntField ($$, fixBits (TS_UNKNOWN, 0)); } ; /* ** CTypes allow "unsigned short int" but we drop all C type qualifiers ** and storage class except TYPEDEF */ CTypes : CType { $$ = makeCTypesNode ((CTypesNode)0, $1); } | CTypes CType { $$ = makeCTypesNode ($1, $2); } ; /* Add abstract type names and typedef names */ typeSpecifier : LLT_TYPEDEF_NAME { $$ = makeTypeSpecifier ($1); } | CTypes { $$ = $1; $$->sort = sort_lookupName (lclctype_toSort ($1->intfield)); } ; /* Add struct and enum types */ specialQualifier : LLT_OUT { $$ = qual_createOut (); } | LLT_UNUSED { $$ = qual_createUnused (); } | LLT_SEF { $$ = qual_createSef (); } | LLT_ONLY { $$ = qual_createOnly (); } | LLT_OWNED { $$ = qual_createOwned (); } | LLT_DEPENDENT { $$ = qual_createDependent (); } | LLT_KEEP { $$ = qual_createKeep (); } | LLT_KEPT { $$ = qual_createKept (); } | LLT_OBSERVER { $$ = qual_createObserver (); } | LLT_EXITS { $$ = qual_createExits (); } | LLT_MAYEXIT { $$ = qual_createMayExit (); } | LLT_TRUEEXIT { $$ = qual_createTrueExit (); } | LLT_FALSEEXIT { $$ = qual_createFalseExit (); } | LLT_NEVEREXIT { $$ = qual_createNeverExit (); } | LLT_TEMP { $$ = qual_createOnly (); } | LLT_SHARED { $$ = qual_createShared (); } | LLT_UNIQUE { $$ = qual_createUnique (); } | LLT_CHECKED { $$ = qual_createChecked (); } | LLT_UNCHECKED { $$ = qual_createUnchecked (); } | LLT_CHECKEDSTRICT { $$ = qual_createCheckedStrict (); } | LLT_TRUENULL { $$ = qual_createTrueNull (); } | LLT_FALSENULL { $$ = qual_createFalseNull (); } | LLT_RELNULL { $$ = qual_createRelNull (); } | LLT_RELDEF { $$ = qual_createRelDef (); } | LLT_REFCOUNTED{ $$ = qual_createRefCounted (); } | LLT_REFS { $$ = qual_createRefs (); } | LLT_NEWREF { $$ = qual_createNewRef (); } | LLT_KILLREF { $$ = qual_createKillRef (); } | LLT_LNULL { $$ = qual_createNull (); } | LLT_LNOTNULL { $$ = qual_createNotNull (); } | LLT_RETURNED { $$ = qual_createReturned (); } | LLT_EXPOSED { $$ = qual_createExposed (); } | LLT_PARTIAL { $$ = qual_createPartial (); } | LLT_NULLTERMINATED { $$ = qual_createNullTerminated () ; } | LLT_UNDEF { $$ = qual_createUndef (); } | LLT_KILLED { $$ = qual_createKilled (); } ; lclTypeSpec : typeSpecifier { $$ = makeLclTypeSpecNodeType ($1); } /* does not process CONST at all */ | structOrUnionSpec { $$ = makeLclTypeSpecNodeSU ($1); } | enumSpec { $$ = makeLclTypeSpecNodeEnum ($1); } | specialQualifier lclTypeSpec { $$ = lclTypeSpecNode_addQual ($2, $1); } | LLT_VERTICALBAR lclType LLT_COLON lclType LLT_VERTICALBAR { $$ = makeLclTypeSpecNodeConj ($2, $4); } ; /* ** Add pointers to the right, only used in StoreRef, maybe should throw ** out and replace its use in StoreRef by CTypeName */ lclType : lclTypeSpec | lclTypeSpec pointers { llassert (lclTypeSpecNode_isDefined ($1)); $1->pointers = $2; $$ = $1; } ; pointers : LLT_MULOP { $$ = pointers_createLt ($1); } | pointers LLT_MULOP { $$ = pointers_extend ($1, pointers_createLt ($2)); } ; structOrUnionSpec : LLT_STRUCT optTagId { (void) checkAndEnterTag (TAG_FWDSTRUCT, ltoken_copy ($2)); } LLT_LBRACE structDecls LLT_RBRACE { $$ = makestrOrUnionNode ($1, SU_STRUCT, $2, $5); } | LLT_UNION optTagId { (void) checkAndEnterTag (TAG_FWDUNION, ltoken_copy ($2)); } LLT_LBRACE structDecls LLT_RBRACE { $$ = makestrOrUnionNode ($1, SU_UNION, $2, $5); } | LLT_STRUCT tagId { $$ = makeForwardstrOrUnionNode ($1, SU_STRUCT, $2); } | LLT_UNION tagId { $$ = makeForwardstrOrUnionNode ($1, SU_UNION, $2); } ; optTagId : /* empty */ { $$ = ltoken_undefined; } | tagId ; structDecls : structDecl { $$ = stDeclNodeList_add (stDeclNodeList_new (), $1); } | structDecls structDecl { $$ = stDeclNodeList_add ($1, $2); } ; /* We don't allow specification of field size */ structDecl : lclTypeSpec declaratorList LLT_SEMI { $$ = makestDeclNode ($1, $2); } ; declaratorList : declarator { $$ = declaratorNodeList_add (declaratorNodeList_new (), $1); } | declaratorList LLT_COMMA declarator { $$ = declaratorNodeList_add ($1, $3); } ; optCOMMA : /* empty */ { ; } | LLT_COMMA { ; } ; enumSpec : LLT_ENUM optTagId LLT_LBRACE enumeratorList optCOMMA LLT_RBRACE { $$ = makeEnumSpecNode ($1, $2, $4); } | LLT_ENUM tagId { $$ = makeEnumSpecNode2 ($1, $2); } ; enumeratorList : simpleId { $$ = ltokenList_singleton ($1); } | enumeratorList LLT_COMMA simpleId { $$ = ltokenList_push ($1, $3); } ; /* This part of declarator rules is adapted from GCC (2.2.1)'s C grammar */ /* An after_type_decl is a declarator that is allowed only after an explicit typeSpecifier, an id can be typedef'd here. A notype_decl is a declarator that may not have seen a typeSpecifier preceding it; it cannot typedef'd an id. */ declarator : after_type_decl { $$ = makeDeclaratorNode ($1); } | notype_decl { $$ = makeDeclaratorNode ($1); } ; notype_decl : varId { $$ = makeTypeExpr ($1); } | LLT_LPAR notype_decl LLT_RPAR { $$ = $2; $$->wrapped = $$->wrapped + 1; } | LLT_MULOP notype_decl { $$ = makePointerNode ($1, $2); } | notype_decl arrayQual { $$ = makeArrayNode ($1, $2); } | notype_decl LLT_LPAR LLT_RPAR { $$ = makeFunctionNode ($1, paramNodeList_new ()); } | notype_decl LLT_LPAR realParamList LLT_RPAR { $$ = makeFunctionNode ($1, $3); } ; after_type_decl : LLT_TYPEDEF_NAME { $$ = makeTypeExpr ($1); } | LLT_LPAR after_type_decl LLT_RPAR { $$ = $2; $$->wrapped = $$->wrapped + 1; } | LLT_MULOP after_type_decl { $$ = makePointerNode ($1, $2); } | after_type_decl arrayQual { $$ = makeArrayNode ($1, $2); } | after_type_decl LLT_LPAR LLT_RPAR { $$ = makeFunctionNode ($1, paramNodeList_new ()); } | after_type_decl LLT_LPAR realParamList LLT_RPAR { $$ = makeFunctionNode ($1, $3); } ; /* A parameter_decl is a decl that can appear in a parameter list. We disallow the old C way of giving only the id names without types. A parameter_decl is like an after_type_decl except that it does not allow a TYPEDEF_NAME to appear in parens. It will conflict with a a function with that typedef as an argument */ parameter_decl : LLT_TYPEDEF_NAME { $$ = makeTypeExpr ($1); } | LLT_MULOP parameter_decl /* %prec UNARY */ { $$ = makePointerNode ($1, $2); } | parameter_decl arrayQual { $$ = makeArrayNode ($1, $2); } | parameter_decl LLT_LPAR LLT_RPAR { $$ = makeFunctionNode ($1, paramNodeList_new ()); } | parameter_decl LLT_LPAR realParamList LLT_RPAR { $$ = makeFunctionNode ($1, $3); } ; /* param : the last production allows C types to be generated without the parameter name */ param : lclTypeSpec parameter_decl { $$ = makeParamNode ($1, $2); } | lclTypeSpec notype_decl { $$ = makeParamNode ($1, $2); } | lclTypeSpec optAbstDeclarator { $$ = makeParamNode ($1, $2); } /* ** | OUT lclTypeSpec parameter_decl { $$ = makeOutParamNode ($1, $2, $3); } ** | OUT lclTypeSpec notype_decl { $$ = makeOutParamNode ($1, $2, $3); } ** | OUT lclTypeSpec optAbstDeclarator { $$ = makeOutParamNode ($1, $2, $3); } */ ; /* typeName is only used in trait parameter renaming */ typeName : lclTypeSpec optAbstDeclarator { $$ = makeTypeNameNode (FALSE, $1, $2); } | LLT_OBJ lclTypeSpec optAbstDeclarator { $$ = makeTypeNameNode (TRUE, $2, $3); } | opForm { $$ = makeTypeNameNodeOp ($1); } ; /* Abstract declarator is like a declarator, but with no identifier */ optAbstDeclarator : /* empty */ { $$ = (abstDeclaratorNode)0; } | abstDeclarator { $$ = (abstDeclaratorNode)$1; } ; abstDeclarator : LLT_LPAR abstDeclarator LLT_RPAR { $$ = $2; $$->wrapped = $$->wrapped + 1; } | LLT_MULOP abstDeclarator { $$ = makePointerNode ($1, $2); } | LLT_MULOP { $$ = makePointerNode ($1, (typeExpr)0); } | arrayQual { $$ = makeArrayNode ((typeExpr)0, $1); } | abstDeclarator arrayQual { $$ = makeArrayNode ($1, $2); } | abstDeclarator LLT_LPAR LLT_RPAR { $$ = makeFunctionNode ($1, paramNodeList_new ()); } | LLT_LPAR realParamList LLT_RPAR { $$ = makeFunctionNode ((typeExpr)0, $2); } | abstDeclarator LLT_LPAR realParamList LLT_RPAR { $$ = makeFunctionNode ($1, $3); } ; arrayQual : LLT_LBRACKET LLT_RBRACKET { $$ = makeArrayQualNode ($1, (termNode)0); } | LLT_LBRACKET constLclExpr LLT_RBRACKET { $$ = makeArrayQualNode ($1, $2); } ; opForm : LLT_IF markerSym LLT_THEN markerSym LLT_ELSE markerSym { $$ = makeOpFormNode ($1, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); } | anyOp { $$ = makeOpFormNode ($1, OPF_ANYOP, opFormUnion_createAnyOp ($1), ltoken_undefined); } | markerSym anyOp { $$ = makeOpFormNode ($1, OPF_MANYOP, opFormUnion_createAnyOp ($2), ltoken_undefined); } | anyOp markerSym { $$ = makeOpFormNode ($1, OPF_ANYOPM, opFormUnion_createAnyOp ($1), ltoken_undefined); } | markerSym anyOp markerSym { $$ = makeOpFormNode ($1, OPF_MANYOPM, opFormUnion_createAnyOp ($2), ltoken_undefined); } | open middle close { $$ = makeOpFormNode ($1, OPF_MIDDLE, opFormUnion_createMiddle ($2), $3); } | markerSym open middle close { $$ = makeOpFormNode ($1, OPF_MMIDDLE, opFormUnion_createMiddle ($3), $4); } | open middle close markerSym { $$ = makeOpFormNode ($1, OPF_MIDDLEM, opFormUnion_createMiddle ($2), $3); } | markerSym open middle close markerSym { $$ = makeOpFormNode ($2, OPF_MMIDDLEM, opFormUnion_createMiddle ($3), $4); } | LLT_LBRACKET middle LLT_RBRACKET { $$ = makeOpFormNode ($1, OPF_BMIDDLE, opFormUnion_createMiddle ($2), $3); } | LLT_LBRACKET middle LLT_RBRACKET markerSym { $$ = makeOpFormNode ($1, OPF_BMIDDLEM, opFormUnion_createMiddle ($2), $3); } /* added the next 6 productions (wrt old checker) to complete LSL grammar ** LSL treats '[' and '{' as openSym but LCL treats them as LLT_LBRACKET and ** LLT_LBRACE, and hence the need for these separate productions */ | markerSym LLT_LBRACKET middle LLT_RBRACKET { $$ = makeOpFormNode ($2, OPF_BMMIDDLE, opFormUnion_createMiddle ($3), $4); } | markerSym LLT_LBRACKET middle LLT_RBRACKET markerSym { $$ = makeOpFormNode ($2, OPF_BMMIDDLEM, opFormUnion_createMiddle ($3), $4); } | selectSym simpleIdOrTypedefName { $$ = makeOpFormNode ($1, OPF_SELECT, opFormUnion_createAnyOp ($2), ltoken_undefined); } | mapSym simpleIdOrTypedefName { $$ = makeOpFormNode ($1, OPF_MAP, opFormUnion_createAnyOp ($2), ltoken_undefined); } | markerSym selectSym simpleIdOrTypedefName { $$ = makeOpFormNode ($1, OPF_MSELECT, opFormUnion_createAnyOp ($3), ltoken_undefined); } | markerSym mapSym simpleIdOrTypedefName { $$ = makeOpFormNode ($1, OPF_MMAP, opFormUnion_createAnyOp ($3), ltoken_undefined); } ; open : openSym | LLT_LBRACE ; close : closeSym | LLT_RBRACE ; anyOp : simpleOp2 | logicalOp | eqOp ; middle : /* empty */ { $$ = 0; } | placeList ; placeList : markerSym { $$ = 1; } | placeList separator markerSym { $$ = $1 + 1; } ; separator : LLT_COMMA | sepSym ; signature : LLT_COLON domain mapSym sortId { $$ = makesigNode ($1, $2, $4); } ; domain : /* empty */ { $$ = ltokenList_new (); } | sortList ; sortList : sortId { $$ = ltokenList_singleton ($1); } | sortList LLT_COMMA sortId { $$ = ltokenList_push ($1, $3); } ; lclPredicate : term { $$ = makeLclPredicateNode (ltoken_undefined, $1, LPD_PLAIN);} ; term : term0 { $$ = checkSort ($1); } ; /* When "if then else . " shift instead of reduce */ term0 : LLT_IF term0 LLT_THEN term0 LLT_ELSE term0 %prec LLT_IF_THEN_ELSE { $$ = makeIfTermNode ($1,$2,$3,$4,$5,$6); } | equalityTerm | term0 logicalOp term0 { $$ = makeInfixTermNode ($1, $2, $3); } ; equalityTerm : simpleOpTerm /* was | quantifiers LLT_LPAR term LLT_RPAR */ | quantifiers LLT_LPAR lclPredicate LLT_RPAR /* temp fix, should change interface in future, add lclPredicateKind too */ { checkLclPredicate ($2, $3); $$ = makeQuantifiedTermNode ($1, $2, $3->predicate, $4); symtable_exitScope (g_symtab); } | simpleOpTerm eqOp simpleOpTerm { $$ = makeInfixTermNode ($1, $2, $3);} | simpleOpTerm LLT_EQUALS simpleOpTerm { $$ = makeInfixTermNode ($1, $2, $3);} ; simpleOpTerm : prefixOpTerm | secondary postfixOps { $$ = makePostfixTermNode ($1, $2); } | secondary infixOpPart { $$ = CollapseInfixTermNode ($1, $2); } ; simpleOp2 : simpleOp | LLT_MULOP ; prefixOpTerm : secondary | simpleOp2 prefixOpTerm { $$ = makePrefixTermNode ($1, $2); } ; postfixOps : simpleOp2 { $$ = ltokenList_singleton ($1); } | postfixOps simpleOp2 { $$ = ltokenList_push ($1, $2); } ; infixOpPart : simpleOp2 secondary { $$ = pushInfixOpPartNode (termNodeList_new (), $1, $2); } | infixOpPart simpleOp2 secondary { $$ = pushInfixOpPartNode ($1, $2, $3); } ; secondary : primary | bracketed { $$ = computePossibleSorts ($1); } | bracketed primary { $$ = updateMatchedNode ((termNode)0, $1, $2); } | primary bracketed { $$ = updateMatchedNode ($1, $2, (termNode)0); } | primary bracketed primary { $$ = updateMatchedNode ($1, $2, $3); } | sqBracketed { $$ = computePossibleSorts ($1); } | sqBracketed primary { $$ = updateSqBracketedNode ((termNode)0, $1, $2); } ; bracketed : matched LLT_COLON sortId { $$ = $1; $$->sort = sort_lookupName (ltoken_getText ($3)); } | matched ; sqBracketed : LLT_LBRACKET args LLT_RBRACKET LLT_COLON sortId { $$ = makeSqBracketedNode ($1, $2, $3); $$->given = sort_lookupName (ltoken_getText ($5)); } | LLT_LBRACKET args LLT_RBRACKET { $$ = makeSqBracketedNode ($1, $2, $3); } | LLT_LBRACKET LLT_RBRACKET LLT_COLON sortId { $$ = makeSqBracketedNode ($1, termNodeList_new (), $2); $$->given = sort_lookupName (ltoken_getText ($4)); } | LLT_LBRACKET LLT_RBRACKET { $$ = makeSqBracketedNode ($1, termNodeList_new (), $2); } ; matched : open args close { $$ = makeMatchedNode ($1, $2, $3); } | open close { $$ = makeMatchedNode ($1, termNodeList_new (), $2); } ; args : term { $$ = termNodeList_push (termNodeList_new (), $1); } | args separator term { $$ = termNodeList_push ($1, $3); } ; primary : LLT_LPAR term0 LLT_RPAR /* may need to make a copy of $2 */ { $$ = $2; $$->wrapped = $$->wrapped + 1; } | varId { $$ = makeSimpleTermNode ($1); } | opId LLT_LPAR termList LLT_RPAR { $$ = makeOpCallTermNode ($1, $2, $3, $4); } | lclPrimary | primary stateFcn { $$ = makePostfixTermNode2 ($1, $2); } | primary selectSym simpleIdOrTypedefName { ltoken_markOwned ($3); $$ = makeSelectTermNode ($1, $2, $3); } | primary mapSym simpleIdOrTypedefName { ltoken_markOwned ($3); $$ = makeMapTermNode ($1, $2, $3); } | primary LLT_LBRACKET LLT_RBRACKET { $$ = updateSqBracketedNode ($1, makeSqBracketedNode ($2, termNodeList_new (), $3), (termNode)0); } | primary LLT_LBRACKET termList LLT_RBRACKET { $$ = updateSqBracketedNode ($1, makeSqBracketedNode ($2, $3, $4), (termNode)0); } | primary LLT_COLON sortId { $$ = $1; $$->given = sort_lookupName (ltoken_getText ($3)); } ; termList : term0 { $$ = termNodeList_push (termNodeList_new (), $1); } | termList LLT_COMMA term0 { $$ = termNodeList_push ($1, $3); } ; stateFcn : preSym | postSym | anySym | LLT_QUOTE ; lclPrimary : cLiteral | LLT_RESULT { $$ = makeSimpleTermNode ($1); } | LLT_FRESH LLT_LPAR termList LLT_RPAR { $$ = makeOpCallTermNode ($1, $2, $3, $4); } | LLT_UNCHANGED LLT_LPAR LLT_ALL LLT_RPAR { $$ = makeUnchangedTermNode1 ($1, $3); } | LLT_UNCHANGED LLT_LPAR storeRefList LLT_RPAR { $$ = makeUnchangedTermNode2 ($1, $3); } | LLT_SIZEOF LLT_LPAR term LLT_RPAR { termNodeList x = termNodeList_new (); termNodeList_addh (x, $3); $$ = makeOpCallTermNode ($1, $2, x, $4); } | LLT_ISSUB LLT_LPAR term LLT_COMMA term LLT_RPAR { termNodeList x = termNodeList_new (); termNodeList_addh (x, $3); termNodeList_addh (x, $5); $$ = makeOpCallTermNode ($1, $2, x, $6); } | LLT_SIZEOF LLT_LPAR lclTypeSpec LLT_RPAR { $$ = makeSizeofTermNode ($1, $3); } ; /* removed 94-Mar-25: ** | MODIFIES LLT_LPAR term LLT_RPAR ** {termNodeList x = termNodeList_new (); ** termNodeList_addh (x, $3); ** $$ = makeOpCallTermNode ($1, $2, x, $4); } */ cLiteral : LLT_CINTEGER { $$ = makeLiteralTermNode ($1, g_sortInt); } | LLT_LCSTRING { $$ = makeLiteralTermNode ($1, g_sortCstring); } | LLT_CCHAR { $$ = makeLiteralTermNode ($1, g_sortChar); } | LLT_CFLOAT { $$ = makeLiteralTermNode ($1, g_sortDouble); } ; quantifiers : quantifier { $$ = quantifierNodeList_add (quantifierNodeList_new (), $1); } | quantifiers quantifier { $$ = quantifierNodeList_add ($1, $2); } ; quantifier : quantifierSym { scopeInfo si = (scopeInfo) dmalloc (sizeof (*si)); si->kind = SPE_QUANT; symtable_enterScope (g_symtab, si); } quantifiedList { $$ = makeQuantifierNode ($3, $1); } ; quantifiedList : quantified { $$ = varNodeList_add (varNodeList_new (), $1); } | quantifiedList LLT_COMMA quantified { $$ = varNodeList_add ($1, $3); } ; quantified : varId LLT_COLON sortSpec { $$ = makeVarNode ($1, FALSE, $3); } | varId LLT_COLON LLT_OBJ sortSpec { $$ = makeVarNode ($1, TRUE, $4); } ; simpleIdOrTypedefName : simpleId | LLT_TYPEDEF_NAME ; /* a different name space from varId/fcnId/typeId */ fcnId : simpleId ; varId : simpleId ; tagId : simpleIdOrTypedefName ; claimId : simpleIdOrTypedefName ; sortId : simpleIdOrTypedefName ; traitId : simpleIdOrTypedefName ; opId : simpleIdOrTypedefName ; %% # include "bison.reset" /* ** yytext is set in lex scanner ** extern YYSTYPE yylval; ** yylval is defined by code generated by bison */ void ylerror (char *s) { /* ** This resetting of the left context is very important when multiple ** files are to be parsed. We do not want failures to propagate. ** Lex/Yacc does not reset the flags when the parsing goes bad. ** BEGIN 0; **/ /*@-mustfree@*/ lclfatalerror (yllval.ltok, message ("%s: Token code: %s, Token String: %s", cstring_fromChars (s), ltoken_unparseCodeName (yllval.ltok), ltoken_getRawString (yllval.ltok))); /*@=mustfree@*/ } static void yyprint (FILE *f, int t, YYSTYPE value) { fprintf (f, " type: %d (%s)", t, cstring_toCharsSafe (ltoken_getRawString (value.ltok))); } splint-3.1.2.dfsg1/src/mtgrammar.y0000644021234200000250000002675307646432516014445 0ustar fax/*;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: splint@cs.virginia.edu ** To report a bug: splint-bug@cs.virginia.edu ** For more information: http://www.splint.org */ /* ** mtgrammar.y ** ** Grammar for .mts files. */ %{ # include "bison.reset" # include "splintMacros.nf" # include "basic.h" # ifndef S_SPLINT_S extern ctype mtscanner_lookupType (mttok p_tok) /*@modifies p_tok@*/ ; # endif /*@i523@*/ /* can't include these here # include "mtgrammar.h" # include "mtscanner.h" */ static /*@noreturn@*/ void mterror (char *); /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ extern int mtlex () ; static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); /*@=noparams@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) # define YYDEBUG 1 # include "bison.head" %} %pure_parser %union { mttok tok; mtDeclarationNode mtdecl; mtDeclarationPiece mtpiece; mtDeclarationPieces mtpieces; mtContextNode mtcontext; mtValuesNode mtvalues; mtDefaultsNode mtdefaults; mtDefaultsDeclList mtdeflist; mtAnnotationsNode mtannotations; mtAnnotationList mtannotlist; mtAnnotationDecl mtannotdecl; mtMergeNode mtmerge; mtMergeItem mtmergeitem; mtMergeClauseList mtmergeclauselist; mtMergeClause mtmergeclause; mtTransferClauseList mttransferclauselist; mtTransferClause mttransferclause; mtTransferAction mttransferaction; mtLoseReferenceList mtlosereferencelist; mtLoseReference mtlosereference; pointers pointers; /*@only@*/ cstringList cstringlist; ctype ctyp; /*@only@*/ qtype qtyp; qual qual; qualList quals; } /* Don't forget to enter all tokens in mtscanner.c */ %token MT_BADTOK %token MT_END %token MT_STATE MT_GLOBAL %token MT_CONTEXT %token MT_ONEOF %token MT_DEFAULTS MT_DEFAULT %token MT_REFERENCE MT_PARAMETER MT_RESULT MT_CLAUSE MT_LITERAL MT_NULL %token MT_ANNOTATIONS %token MT_ARROW %token MT_MERGE %token MT_TRANSFERS MT_PRECONDITIONS MT_POSTCONDITIONS %token MT_LOSEREFERENCE %token MT_AS %token MT_ERROR %token MT_PLUS MT_STAR MT_BAR %token MT_LPAREN MT_RPAREN %token MT_LBRACKET MT_RBRACKET %token MT_LBRACE MT_RBRACE %token MT_COMMA %token MT_CHAR MT_INT MT_FLOAT MT_DOUBLE MT_VOID MT_ANYTYPE MT_INTEGRALTYPE MT_UNSIGNEDINTEGRALTYPE %token MT_SIGNEDINTEGRALTYPE %token MT_CONST MT_VOLATILE MT_RESTRICT %token MT_STRINGLIT %token MT_IDENT %type pointers %type optType typeSpecifier typeName abstractDecl abstractDeclBase %type typeExpression %type completeType completeTypeAux optCompleteType %type declarationPiece %type contextDeclaration %type contextSelection optContextSelection %type valuesDeclaration %type defaultNode %type defaultsDeclaration %type defaultDeclarationList %type annotationsDeclaration %type annotationsDeclarationList %type annotationDeclaration %type mergeDeclaration %type mergeItem %type mergeClauses %type mergeClause %type transfersDeclaration transferClauses preconditionsDeclaration postconditionsDeclaration %type transferClause %type transferAction errorAction %type loseReferenceDeclaration lostClauses %type lostClause %type valuesList %type declarationNode %type declarationPieces %type valueChoice %type innerModsList %type innerMods %start file %% file : {} | mtsDeclaration {} ; mtsDeclaration : MT_STATE declarationNode MT_END { mtreader_processDeclaration ($2); } | MT_GLOBAL MT_STATE declarationNode MT_END { mtreader_processGlobalDeclaration ($3); } ; declarationNode : MT_IDENT declarationPieces { $$ = mtDeclarationNode_create ($1, $2); } ; declarationPieces : { $$ = mtDeclarationPieces_create (); } | declarationPiece declarationPieces { $$ = mtDeclarationPieces_append ($2, $1); } ; declarationPiece : contextDeclaration { $$ = mtDeclarationPiece_createContext ($1); } | valuesDeclaration { $$ = mtDeclarationPiece_createValues ($1); } | defaultsDeclaration { $$ = mtDeclarationPiece_createDefaults ($1); } | defaultNode { $$ = mtDeclarationPiece_createValueDefault ($1); } | annotationsDeclaration { $$ = mtDeclarationPiece_createAnnotations ($1); } | mergeDeclaration { $$ = mtDeclarationPiece_createMerge ($1); } | transfersDeclaration { $$ = mtDeclarationPiece_createTransfers ($1); } | preconditionsDeclaration { $$ = mtDeclarationPiece_createPreconditions ($1); } | postconditionsDeclaration { $$ = mtDeclarationPiece_createPostconditions ($1); } | loseReferenceDeclaration { $$ = mtDeclarationPiece_createLosers ($1); } ; contextDeclaration : MT_CONTEXT contextSelection { $$ = $2; } /* ??? should it be a list? */ ; optContextSelection : /* empty */ { $$ = mtContextNode_createAny (); } | contextSelection ; contextSelection : MT_PARAMETER optType { $$ = mtContextNode_createParameter ($2); } | MT_REFERENCE optType { $$ = mtContextNode_createReference ($2); } | MT_RESULT optType { $$ = mtContextNode_createResult ($2); } | MT_CLAUSE optType { $$ = mtContextNode_createClause ($2); } | MT_LITERAL optType { $$ = mtContextNode_createLiteral ($2); } | MT_NULL optType { $$ = mtContextNode_createNull ($2); } ; /* ** Wish I could share the C grammar here...cut-and-paste instead. */ optType : /* empty */ { $$ = ctype_unknown; } | typeExpression { DPRINTF (("Type: %s", qtype_unparse ($1))); $$ = qtype_getType ($1); } ; typeExpression : completeType | completeType abstractDecl { $$ = qtype_newBase ($1, $2); } ; completeType : completeTypeAux { $$ = $1; } | completeType MT_BAR typeExpression { $$ = qtype_mergeAlt ($1, $3); } ; completeTypeAux : typeSpecifier optCompleteType { $$ = qtype_combine ($2, $1); } ; optCompleteType : /* empty */ { $$ = qtype_unknown (); } | completeType { $$ = $1; } ; abstractDecl : pointers { $$ = ctype_adjustPointers ($1, ctype_unknown); } | abstractDeclBase | pointers abstractDeclBase { $$ = ctype_adjustPointers ($1, $2); } ; pointers : MT_STAR { $$ = pointers_createMt ($1); } | MT_STAR innerModsList { $$ = pointers_createModsMt ($1, $2); } | MT_STAR pointers { $$ = pointers_extend (pointers_createMt ($1), $2); } | MT_STAR innerModsList pointers { $$ = pointers_extend (pointers_createModsMt ($1, $2), $3); } ; innerMods : MT_CONST { $$ = qual_createConst (); } | MT_VOLATILE { $$ = qual_createVolatile (); } | MT_RESTRICT { $$ = qual_createRestrict (); } ; innerModsList : innerMods { $$ = qualList_single ($1); } | innerModsList innerMods { $$ = qualList_add ($1, $2); } ; abstractDeclBase : MT_LPAREN abstractDecl MT_RPAREN { $$ = ctype_expectFunction ($2); } | MT_LBRACKET MT_RBRACKET { $$ = ctype_makeArray (ctype_unknown); } | abstractDeclBase MT_LBRACKET MT_RBRACKET { $$ = ctype_makeArray ($1); } /* | abstractDeclBase MT_LBRACKET constantExpr MT_RBRACKET { $$ = ctype_makeFixedArray ($1, exprNode_getLongValue ($3)); } */ ; typeSpecifier : MT_CHAR { $$ = ctype_char; } | MT_INT { $$ = ctype_int; } | MT_FLOAT { $$ = ctype_float; } | MT_DOUBLE { $$ = ctype_double; } | MT_VOID { $$ = ctype_void; } | MT_ANYTYPE { $$ = ctype_unknown; } | MT_INTEGRALTYPE { $$ = ctype_anyintegral; } | MT_UNSIGNEDINTEGRALTYPE { $$ = ctype_unsignedintegral; } | MT_SIGNEDINTEGRALTYPE { $$ = ctype_signedintegral; } | typeName /* | suSpc | enumSpc | typeModifier NotType { $$ = ctype_fromQual ($1); } */ ; typeName : MT_IDENT { $$ = mtscanner_lookupType ($1); } ; valuesDeclaration : MT_ONEOF valuesList { $$ = mtValuesNode_create ($2); } ; valuesList : MT_IDENT { $$ = cstringList_single (mttok_getText ($1)); } | MT_IDENT MT_COMMA valuesList { $$ = cstringList_prepend ($3, mttok_getText ($1)); } ; defaultNode : MT_DEFAULT valueChoice { $$ = $2; } ; defaultsDeclaration : MT_DEFAULTS defaultDeclarationList { $$ = mtDefaultsNode_create ($1, $2); } ; defaultDeclarationList : contextSelection MT_ARROW valueChoice { $$ = mtDefaultsDeclList_single (mtDefaultsDecl_create ($1, $3)); } | contextSelection MT_ARROW valueChoice defaultDeclarationList { $$ = mtDefaultsDeclList_prepend ($4, mtDefaultsDecl_create ($1, $3)); } ; annotationsDeclaration : MT_ANNOTATIONS annotationsDeclarationList { $$ = mtAnnotationsNode_create ($2); } ; annotationsDeclarationList : annotationDeclaration { $$ = mtAnnotationList_single ($1); } | annotationDeclaration annotationsDeclarationList { $$ = mtAnnotationList_prepend ($2, $1); } ; annotationDeclaration : MT_IDENT optContextSelection MT_ARROW valueChoice { $$ = mtAnnotationDecl_create ($1, $2, $4); } ; mergeDeclaration : MT_MERGE mergeClauses { $$ = mtMergeNode_create ($2); } ; mergeClauses : mergeClause { $$ = mtMergeClauseList_single ($1); } | mergeClause mergeClauses { $$ = mtMergeClauseList_prepend ($2, $1); } ; mergeClause : mergeItem MT_PLUS mergeItem MT_ARROW transferAction { $$ = mtMergeClause_create ($1, $3, $5); } ; mergeItem : valueChoice { $$ = mtMergeItem_createValue ($1); } | MT_STAR { $$ = mtMergeItem_createStar ($1); } ; preconditionsDeclaration : MT_PRECONDITIONS transferClauses { $$ = $2; } ; postconditionsDeclaration : MT_POSTCONDITIONS transferClauses { $$ = $2; } ; transfersDeclaration : MT_TRANSFERS transferClauses { $$ = $2; } ; loseReferenceDeclaration : MT_LOSEREFERENCE lostClauses { $$ = $2; } ; lostClauses : lostClause { $$ = mtLoseReferenceList_single ($1); } | lostClause lostClauses { $$ = mtLoseReferenceList_prepend ($2, $1); } ; lostClause : valueChoice MT_ARROW errorAction { $$ = mtLoseReference_create ($1, $3); } ; transferClauses : transferClause { $$ = mtTransferClauseList_single ($1); } | transferClause transferClauses { $$ = mtTransferClauseList_prepend ($2, $1); } ; transferClause : valueChoice MT_AS valueChoice MT_ARROW transferAction { $$ = mtTransferClause_create ($1, $3, $5); } ; transferAction : valueChoice { $$ = mtTransferAction_createValue ($1); } | errorAction { $$ = $1; } ; errorAction : MT_ERROR { $$ = mtTransferAction_createError ($1); } | MT_ERROR MT_STRINGLIT { $$ = mtTransferAction_createErrorMessage ($2); } ; valueChoice : MT_IDENT ; %% # include "bison.reset" extern char *yytext; static void mterror (char *s) { if (s != NULL) { llparseerror (message ("Parse error in meta-state file: %s", cstring_fromChars (s))); } else { llparseerror (message ("Parse error in meta-state file")); } } static void yyprint (FILE *file, int type, YYSTYPE value) { cstring tname = mttok_unparse (value.tok); fprintf (file, " (%s)", cstring_toCharsSafe (tname)); cstring_free (tname); } splint-3.1.2.dfsg1/src/signature.y0000644021234200000250000002505310645765525014451 0ustar fax/*;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: splint@cs.virginia.edu ** To report a bug: splint-bug@cs.virginia.edu ** For more information: http://www.splint.org */ /* ** signature.y ** ** Grammar for parsing LSL signatures. ** ** Original author: Yang Meng Tan, Massachusetts Institute of Technology */ %{ # include # include "splintMacros.nf" # include "basic.h" # include "lslparse.h" # include "signature.h" static void lslerror (char *); extern int lsllex (); /*@dependent@*/ /*@null@*/ lslOp importedlslOp; /*@-noparams@*/ /* Can't list params since YYSTYPE isn't defined yet. */ static void yyprint (/*FILE *p_file, int p_type, YYSTYPE p_value */); /*@=noparams@*/ # define YYPRINT(file, type, value) yyprint (file, type, value) # define YYDEBUG 1 /*@-redef@*/ /*@-readonlytrans@*/ /*@-nullassign@*/ %} %pure_parser /* CONVENTIONS: Reserved words are in ALL CAPS (plus markerSym) Characters appearing in the grammar are reserved: % ( ) , : \ */ /* Changes made - added LBRACKET stuff in OpForm (missing in LSL) - dif from LCL: open vs openSym, close vs closeSym - yylval vs yylval.tok */ %union { ltoken ltok; /* a leaf is also an ltoken */ unsigned int count; /*@only@*/ ltokenList ltokenList; /*@only@*/ opFormNode opform; /*@owned@*/ sigNode signature; /*@only@*/ nameNode name; /*@owned@*/ lslOp operator; /*@only@*/ lslOpList operators; /*@-redef@*/ /*@-matchfields@*/ } /*@=redef@*/ /*@=matchfields@*/ %token LST_SIMPLEID %token LST_LOGICALOP /* \implies, \and, \not, \or */ %token LST_EQOP /* \eq, \neq, ==, != */ %token LST_SIMPLEOP /* opSym - reserved */ %token LST_MAPSYM /* LSL's -> */ /* FIELDMAPSYM = "\\field_arrow", only for LCL symtable import */ %token LST_FIELDMAPSYM /* LCL's struct field operator -> */ %token LST_MARKERSYM /* \marker, __ */ %token LST_ifTOKEN LST_thenTOKEN LST_elseTOKEN /* different from LSL: separate LBRACKET from openSym and RBRACKET from closeSym */ %token LST_LBRACKET LST_RBRACKET %token LST_SELECTSYM /* \select or . */ %token LST_SEPSYM LST_OPENSYM LST_CLOSESYM %token LST_COLON /* : */ %token LST_COMMA /* , */ %token LST_EOL LST_COMMENTSYM LST_WHITESPACE /* %token LST_WHITESPACE */ /* Duplicate tokey removed */ %token LST_QUANTIFIERSYM %token LST_EQUATIONSYM %token LST_EQSEPSYM %token LST_COMPOSESYM %token LST_LPAR %token LST_RPAR %token LST_assertsTOKEN %token LST_assumesTOKEN %token LST_byTOKEN %token LST_convertsTOKEN %token LST_enumerationTOKEN %token LST_equationsTOKEN %token LST_exemptingTOKEN %token LST_forTOKEN %token LST_generatedTOKEN %token LST_impliesTOKEN %token LST_includesTOKEN %token LST_introducesTOKEN %token LST_ofTOKEN %token LST_partitionedTOKEN %token LST_traitTOKEN %token LST_tupleTOKEN %token LST_unionTOKEN %token LST_BADTOKEN %type anyOp separator sortId opId %type middle placeList %type domain sortList %type opForm %type signature %type name %type operator %type operatorList top %% top: operatorList { lslOpList_free ($1); } ; operatorList: operator { lslOpList x = lslOpList_new (); g_importedlslOp = $1; lslOpList_add (x, $1); $$ = x; } | operatorList operator { lslOpList_add ($1, $2); $$ = $1; } ; operator: name LST_COLON signature { $$ = makelslOpNode ($1, $3); } /* The next production is never used in the output of lsl -syms | name { $$ = makelslOpNode ($1, (sigNode)0); } */ ; name: opId /* check for the case of if_then_else */ { $$ = makeNameNodeId ($1); } | opForm { $$ = makeNameNodeForm ($1); } ; opForm : LST_ifTOKEN LST_MARKERSYM LST_thenTOKEN LST_MARKERSYM LST_elseTOKEN LST_MARKERSYM { $$ = makeOpFormNode ($1, OPF_IF, opFormUnion_createMiddle (0), ltoken_undefined); } | anyOp { $$ = makeOpFormNode ($1, OPF_ANYOP, opFormUnion_createAnyOp ($1), ltoken_undefined); } | LST_MARKERSYM anyOp { $$ = makeOpFormNode ($1, OPF_MANYOP, opFormUnion_createAnyOp ($2), ltoken_undefined); } | anyOp LST_MARKERSYM { $$ = makeOpFormNode ($1, OPF_ANYOPM, opFormUnion_createAnyOp ($1), ltoken_undefined); } | LST_MARKERSYM anyOp LST_MARKERSYM { $$ = makeOpFormNode ($1, OPF_MANYOPM, opFormUnion_createAnyOp ($2), ltoken_undefined); } | LST_OPENSYM middle LST_CLOSESYM { $$ = makeOpFormNode ($1, OPF_MIDDLE, opFormUnion_createMiddle ($2), $3); } | LST_MARKERSYM LST_OPENSYM middle LST_CLOSESYM { $$ = makeOpFormNode ($2, OPF_MMIDDLE, opFormUnion_createMiddle ($3), $4); } | LST_OPENSYM middle LST_CLOSESYM LST_MARKERSYM { $$ = makeOpFormNode ($1, OPF_MIDDLEM, opFormUnion_createMiddle ($2), $3); } | LST_MARKERSYM LST_OPENSYM middle LST_CLOSESYM LST_MARKERSYM { $$ = makeOpFormNode ($2, OPF_MMIDDLEM, opFormUnion_createMiddle ($3), $4); } | LST_LBRACKET middle LST_RBRACKET { $$ = makeOpFormNode ($1, OPF_BMIDDLE, opFormUnion_createMiddle ($2), $3); } | LST_MARKERSYM LST_LBRACKET middle LST_RBRACKET { $$ = makeOpFormNode ($2, OPF_BMMIDDLE, opFormUnion_createMiddle ($3), $4); } | LST_LBRACKET middle LST_RBRACKET LST_MARKERSYM { $$ = makeOpFormNode ($1, OPF_BMIDDLEM, opFormUnion_createMiddle ($2), $3); } | LST_MARKERSYM LST_LBRACKET middle LST_RBRACKET LST_MARKERSYM { $$ = makeOpFormNode ($2, OPF_BMMIDDLEM, opFormUnion_createMiddle ($3), $4); } | LST_SELECTSYM LST_SIMPLEID { $$ = makeOpFormNode ($1, OPF_SELECT, opFormUnion_createAnyOp ($2), ltoken_undefined); } | LST_MARKERSYM LST_SELECTSYM LST_SIMPLEID { $$ = makeOpFormNode ($1, OPF_MSELECT, opFormUnion_createAnyOp ($3), ltoken_undefined); } /* not in LSL, need FILEDMAPSYM to distinguish it from MAPSYM */ /* LST_FIELDMAPSYM = "\\field_arrow", only for LCL symtable import */ | LST_MARKERSYM LST_FIELDMAPSYM LST_SIMPLEID { $$ = makeOpFormNode ($1, OPF_MMAP, opFormUnion_createAnyOp ($3), ltoken_undefined); } ; anyOp: LST_SIMPLEOP { $$ = $1; } | LST_LOGICALOP { $$ = $1; } | LST_EQOP { $$ = $1; } ; middle: /* empty */ { $$ = 0; } | placeList { $$ = $1; } ; placeList: LST_MARKERSYM { $$ = 1; } | placeList separator LST_MARKERSYM { $$ = $1 + 1; } ; separator: LST_COMMA { $$ = $1; } | LST_SEPSYM { $$ = $1; } ; signature: domain LST_MAPSYM sortId { $$ = makesigNode ($2, $1, $3); } ; domain: /* empty */ { $$ = ltokenList_new (); } | sortList { $$ = $1; } ; sortList: sortId { $$ = ltokenList_singleton ($1); } | sortList LST_COMMA sortId { $$ = ltokenList_push ($1, $3); } ; sortId: LST_SIMPLEID { $$ = $1; ltoken_setText ($$, processTraitSortId (ltoken_getText ($1))); } ; opId: LST_SIMPLEID { $$ = $1; } ; %% # include "bison.reset" extern char *yytext; void lslerror (char *s) { llfatalbug (cstring_makeLiteral ("There has been a problem in the parser with LSL signatures. This is believed to result " "from a problem with bison v. 1.25. Please try rebuidling Splint " "using the pre-compiled grammar files by commenting out the " "BISON= line in the top-level Makefile.")); } static void yyprint (FILE *file, int type, YYSTYPE value) { fprintf (file, " (%u:%u type: %d; text: %s) ", ltoken_getLine (value.ltok), ltoken_getCol (value.ltok), type, ltoken_getRawTextChars (value.ltok)); } extern void PrintToken (ltoken tok) { char *codStr; switch (ltoken_getCode (tok)) { case NOTTOKEN: codStr = "*** NOTTOKEN ***"; break; case LST_QUANTIFIERSYM: codStr = "QUANTIFIERSYM"; break; case LST_LOGICALOP: codStr = "LOGICALOP: "; break; case LST_SELECTSYM: codStr = "LST_SELECTSYM"; break; case LST_OPENSYM: codStr = "LST_OPENSYM"; break; case LST_SEPSYM: codStr = "SEPSYM"; break; case LST_CLOSESYM: codStr = "LST_CLOSESYM"; break; case LST_SIMPLEID: codStr = "LST_SIMPLEID"; break; case LST_MAPSYM: codStr = "MAPSYM"; break; case LST_MARKERSYM: codStr = "LST_MARKERSYM"; break; case LST_COMMENTSYM: codStr = "COMMENTSYM"; break; case LST_SIMPLEOP: codStr = "SIMPLEOP"; break; case LST_COLON: codStr = "LST_COLON"; break; case LST_COMMA: codStr = "COMMA"; break; case LST_LBRACKET: codStr = "LST_LBRACKET"; break; case LST_LPAR: codStr = "LST_LPAR"; break; case LST_RBRACKET: codStr = "LST_RBRACKET"; break; case LST_RPAR: codStr = "LST_RPAR"; break; case LST_EQOP: codStr = "LST_EQOP"; break; case LST_WHITESPACE: codStr = "WHITESPACE,"; break; case LST_EOL: codStr = "LST_EOL"; break; case LST_elseTOKEN: codStr = "elseTOKEN"; break; case LST_ifTOKEN: codStr = "ifTOKEN"; break; case LST_thenTOKEN: codStr = "thenTOKEN"; break; case LST_BADTOKEN: codStr = "*** BADTOKEN ***"; break; case LEOFTOKEN: /* can't reach LEOFTOKEN easily */ codStr = "LEOFTOKEN"; break; default: codStr = "*** invalid token code ***"; break; } /* end switch */ /* only used for debugging */ printf ("%u:%u: Token Code (%u): %s", ltoken_getLine (tok), ltoken_getCol (tok), ltoken_getCode (tok), codStr); if (ltoken_getRawText (tok) != 0) { printf (", Token String (%lu): %s\n", ltoken_getRawText (tok), ltoken_getRawTextChars (tok)); } else printf ("\n"); } splint-3.1.2.dfsg1/src/bison.head0000644021234200000250000000170410645767447014215 0ustar fax/* ** Inserted at beginning of c files generated by bison ** REMEMBER: Change bison.reset too. */ /*@-allmacros@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macroparams@*/ /*@-macroundef@*/ /*@-unreachable@*/ /*@-macrospec@*/ /*@-varuse@*/ /*@+ignorequals@*/ /*@-macrostmt@*/ /*@-noeffect@*/ /*@-shadow@*/ /*@-exitarg@*/ /*@-macroredef@*/ /*@-uniondef@*/ /*@-compdef@*/ /*@-matchfields@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-typeuse@*/ /*@-redecl@*/ /*@-redef@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-fielduse@*/ /*@-ifblock@*/ /*@-elseifcomplete@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-branchstate@*/ /*@-readonlytrans@*/ /*@-namechecks@*/ /*@-usedef@*/ /*@-systemunrecog@*/ /*@-dependenttrans@*/ /*@-unqualifiedtrans@*/ /*@-nullassign@*/ /*@-nullpass@*/ /*@-nullptrarith*/ /*@-usereleased@*/ /*@-declundef@*/ /*drl added 11/27/2001*/ /*@-bounds@*/ /*drl added 12/11/2002*/ /*@-type@*/ /*@-enummemuse@*/ /* < end of bison.head > */ splint-3.1.2.dfsg1/src/bison.reset0000644021234200000250000000144510645767461014434 0ustar fax/* ** Resets all flags in bison.head */ /*@=allmacros@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macroparams@*/ /*@=macroundef@*/ /*@=unreachable@*/ /*@=macrospec@*/ /*@=varuse@*/ /*@=ignorequals@*/ /*@=macrostmt@*/ /*@=noeffect@*/ /*@=shadow@*/ /*@=exitarg@*/ /*@=macroredef@*/ /*@=uniondef@*/ /*@=compdef@*/ /*@=matchfields@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=typeuse@*/ /*@=redecl@*/ /*@=redef@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=fielduse@*/ /*@=ifblock@*/ /*@=elseifcomplete@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=branchstate@*/ /*@=readonlytrans@*/ /*@=namechecks@*/ /*@=usedef@*/ /*@=systemunrecog@*/ /*@=dependenttrans@*/ /*@=unqualifiedtrans@*/ /*@=declundef@*/ /*drl added 11/27/2001*/ /*@=bounds@*/ /*drl added 12/11/2002*/ /*@=type@*/ /*@=enummemuse@*/ splint-3.1.2.dfsg1/src/flags.def0000644021234200000250000036736210102766473014035 0ustar fax/*;-*-C-*-; ** ** flags.def ** ** This file is used to generate the flag header files. ** ** Don't forget to regenerate flag_codes.gen. (lost the Makefile...bleech!) */ /* spec idem global mode args */ /*@-namechecks@*/ /*@notfunction@*/ # define modeFlag FALSE, FALSE, FALSE, TRUE, ARG_NONE /*@notfunction@*/ # define plainFlag FALSE, FALSE, FALSE, FALSE, ARG_NONE /*@notfunction@*/ # define specialFlag TRUE, FALSE, FALSE, FALSE, ARG_NONE /*@notfunction@*/ # define plainSpecialFlag TRUE, FALSE, FALSE, FALSE, ARG_NONE /*@notfunction@*/ # define idemSpecialFlag TRUE, TRUE, FALSE, FALSE, ARG_NONE /*@notfunction@*/ # define valueFlag FALSE, FALSE, FALSE, FALSE, ARG_NUMBER /*@notfunction@*/ # define charFlag FALSE, FALSE, FALSE, FALSE, ARG_CHAR /*@notfunction@*/ # define modeValueFlag FALSE, FALSE, FALSE, TRUE, ARG_NUMBER /*@notfunction@*/ # define specialValueFlag TRUE, FALSE, FALSE, FALSE, ARG_NUMBER /*@notfunction@*/ # define debugFlag FALSE, TRUE, FALSE, FALSE, ARG_NONE /*@notfunction@*/ # define debugValueFlag FALSE, TRUE, FALSE, FALSE, ARG_NUMBER /*@notfunction@*/ # define specialDebugFlag TRUE, TRUE, FALSE, FALSE, ARG_NONE /*@notfunction@*/ # define globalFlag FALSE, FALSE, TRUE, FALSE, ARG_NONE /*@notfunction@*/ # define idemGlobalFlag FALSE, TRUE, TRUE, FALSE, ARG_NONE /*@notfunction@*/ # define globalValueFlag FALSE, FALSE, TRUE, FALSE, ARG_NUMBER /* Note: type argument missing */ /*@notfunction@*/ # define regStringFlag FALSE, FALSE, FALSE, FALSE /*@notfunction@*/ # define idemStringFlag FALSE, TRUE, FALSE, FALSE /*@notfunction@*/ # define globalStringFlag FALSE, FALSE, TRUE, FALSE /*@notfunction@*/ # define extraArgFlag FALSE, FALSE, FALSE, FALSE, ARG_SPECIAL /*@notfunction@*/ # define globalExtraArgFlag FALSE, FALSE, TRUE, FALSE, ARG_SPECIAL /*@notfunction@*/ # define globalFileFlag FALSE, TRUE, TRUE, FALSE, ARG_FILE /*@=namechecks@*/ /* ** Note: the flag code must be on a separate line, since I'm ** too stupid to write an awk/sed/whatever script that can separate ** the lines. */ static flaglist flags = { /* ** Null Dereferences (Manual Section 2) */ { FK_NULL, FK_MEMORY, specialFlag, "null", FLG_NULL, "misuses of null pointer", "A possibly null pointer is misused (sets nullderef, nullpass, " "nullref, nullassign, and nullstate).", 0, 0 }, { FK_NULL, FK_MEMORY, modeFlag, "nullderef", FLG_NULLDEREF, "possible dereferencce of null pointer", "A possibly null pointer is dereferenced. Value is " "either the result of a function which may return null " "(in which case, code should check it is not null), or a " "global, parameter or structure field declared with the " "null qualifier.", 0, 0 }, { FK_NULL, FK_MEMORY, modeFlag, "nullpass", FLG_NULLPASS, "possibly null pointer passed as formal with no null annotation", "A possibly null pointer is passed as a parameter corresponding to " "a formal parameter with no /*@null@*/ annotation. If NULL " "may be used for this parameter, add a /*@null@*/ annotation " "to the function parameter declaration.", 0, 0 }, { FK_NULL, FK_MEMORY, modeFlag, "nullret", FLG_NULLRET, "possibly null pointer returned as result with no null annotation", "Function returns a possibly null pointer, but is not declared " "using /*@null@*/ annotation of result. If function may " "return NULL, add /*@null@*/ annotation to the return " "value declaration.", 0, 0 }, { FK_NULL, FK_MEMORY, modeFlag, "nullstate", FLG_NULLSTATE, "possibly null pointer reachable from a reference with no null annotation", "A possibly null pointer is reachable from a parameter or global " "variable that is not declared using a /*@null@*/ annotation.", 0, 0 }, { FK_NULL, FK_MEMORY, modeFlag, "nullassign", FLG_NULLASSIGN, "inconsistent assignment or initialization involving null pointer", "A reference with no null annotation is assigned or initialized " "to NULL. Use /*@null@*/ to declare the reference as " "a possibly null pointer.", 0, 0 }, { FK_NULL, FK_MEMORY, plainFlag, "nullinit", FLG_NULLINIT, "inconsistent initialization involving null pointer", "A reference with no null annotation is initialized " "to NULL. Use /*@null@*/ to declare the reference as " "a possibly null pointer.", 0, 0 }, /* ** Undefined Values (Section 3) */ { FK_DEF, FK_NONE, modeFlag, "usedef", FLG_USEDEF, "use before definition", "An rvalue is used that may not be initialized to a value on some execution path.", 0, 0 }, { FK_MEMORY, FK_DEF, modeFlag, "mustdefine", FLG_MUSTDEFINE, "out storage not defined before return or scope exit", "An out parameter or global is not defined before control is transferred.", 0, 0 }, { FK_MEMORY, FK_DEF, modeFlag, "uniondef", FLG_UNIONDEF, "at least one field of a union must be defined", "No field of a union is defined. Generally, one field of a union is " "expected to be defined.", 0, 0 }, { FK_MEMORY, FK_DEF, modeFlag, "compdef", FLG_COMPDEF, "parameter, return value or global completely defined", "Storage derivable from a parameter, return value or global is " "not defined. Use /*@out@*/ to denote passed or returned " "storage which need not be defined.", 0, 0 }, { FK_DEF, FK_NONE, plainFlag, "fullinitblock", FLG_FULLINITBLOCK, "initializer sets all fields", "Initializer does not set every field in the structure.", 0, 0 }, { FK_DEF, FK_NONE, plainFlag, "initallelements", FLG_INITALLELEMENTS, "initializer defines all array elements", "Initializer does not define all elements of a declared array.", 0, 0 }, { FK_DEF, FK_NONE, plainFlag, "initsize", FLG_INITSIZE, "initializer defines extra array elements", "Initializer block contains more elements than the size of a declared array.", 0, 0 }, { FK_DEF, FK_IMPLICIT, modeFlag, "impouts", FLG_IMPOUTS, "pointer parameters to unspecified functions may be implicit out parameters", NULL, 0, 0 }, /* ** Types (Section 4) */ { FK_DECL, FK_TYPE, modeFlag, "incondefs", FLG_INCONDEFS, "function, variable or constant redefined with inconsistent type", "A function, variable or constant is redefined with a different type.", 0, 0 }, { FK_DECL, FK_TYPE, modeFlag, "matchfields", FLG_MATCHFIELDS, "struct or enum type redefined with inconsistent fields or members", "A struct, union or enum type is redefined with inconsistent fields or members.", 0, 0 }, { FK_TYPE, FK_NONE, modeFlag, "fcnderef", FLG_FCNDEREF, "dereferencce of a function type", "A function type is dereferenced. The ANSI standard allows this " "because of implicit conversion of function designators, however the " "dereference is unnecessary.", 0, 0 }, { FK_OPS, FK_NONE, modeFlag, "realcompare", FLG_REALCOMPARE, "dangerous equality comparison between reals (dangerous because of inexact " "floating point representations)", "Two real (float, double, or long double) values are compared " "directly using == or != primitive. " "This may produce unexpected results since floating point " "representations are inexact. Instead, compare the difference to " "FLT_EPSILON or DBL_EPSILON.", 0, 0, }, { FK_OPS, FK_NONE, modeFlag, "realrelatecompare", FLG_REALRELATECOMPARE, "possibly dangerous relational comparison between reals (dangerous because of inexact " "floating point representations)", "Two real (float, double, or long double) values are compared " "directly using < or >. " "This may produce unexpected results since floating point " "representations are inexact. Instead, compare the difference to " "FLT_EPSILON or DBL_EPSILON.", 0, 0, }, { FK_OPS, FK_NONE, modeFlag, "unsignedcompare", FLG_UNSIGNEDCOMPARE, "comparison using <, <=, >= between an unsigned integral and zero constant", "An unsigned value is used in a comparison with zero in a way that is either a bug or confusing.", 0, 0, }, { FK_OPS, FK_POINTER, modeFlag, "ptrarith", FLG_POINTERARITH, "arithmetic involving pointer and integer", "Pointer arithmetic using pointer and integer.", 0, 0 }, { FK_OPS, FK_POINTER, modeFlag, "nullptrarith", FLG_NULLPOINTERARITH, "arithmetic involving possibly null pointer and integer", "Pointer arithmetic using a possibly null pointer and integer.", 0, 0 }, { FK_OPS, FK_POINTER, modeFlag, "ptrcompare", FLG_PTRNUMCOMPARE, "comparison between pointer and number", "A pointer is compared to a number.", 0, 0 }, { FK_OPS, FK_TYPE, modeFlag, "strictops", FLG_STRICTOPS, "primitive operation does not type check strictly", "A primitive operation does not type check strictly.", 0, 0 }, { FK_OPS, FK_TYPE, modeFlag, "bitwisesigned", FLG_BITWISEOPS, "a bitwise logical operator does not have unsigned operands", "An operand to a bitwise operator is not an unsigned values. This " "may have unexpected results depending on the signed " "representations.", 0, 0 }, { FK_OPS, FK_TYPE, modeFlag, "shiftnegative", FLG_SHIFTNEGATIVE, "a shift right operand may be negative", "The right operand to a shift operator may be negative (behavior undefined).", 0, 0 }, { FK_OPS, FK_TYPE, modeFlag, "shiftimplementation", FLG_SHIFTIMPLEMENTATION, "a shift left operand may be negative", "The left operand to a shift operator may be negative (behavior is implementation-defined).", 0, 0 }, { FK_OPS, FK_TYPE, modeFlag, "sizeoftype", FLG_SIZEOFTYPE, "sizeof operator has a type argument", "Operand of sizeof operator is a type. (Safer to use expression, " "int *x = sizeof (*x); instead of sizeof (int).)", 0, 0 }, { FK_OPS, FK_TYPE, plainFlag, "sizeofformalarray", FLG_SIZEOFFORMALARRAY, "sizeof operator has an array formal parameter argument", "Operand of a sizeof operator is a function parameter declared as " "an array. The value of sizeof will be the size of a pointer to the " "element type, not the number of elements in the array.", 0, 0 }, { FK_DECL, FK_TYPE, plainFlag, "fixedformalarray", FLG_FIXEDFORMALARRAY, "formal parameter of type array is declared with size", "A formal parameter is declared as an array with size. The size of the array " "is ignored in this context, since the array formal parameter is treated " "as a pointer.", 0, 0 }, { FK_DECL, FK_TYPE, plainFlag, "incompletetype", FLG_INCOMPLETETYPE, "formal parameter has an incomplete type", "A formal parameter is declared with an incomplete type.", 0, 0 }, { FK_DECL, FK_TYPE, plainFlag, "formalarray", FLG_FORMALARRAY, "formal parameter is an array", "A formal parameter is declared as an array. This can be confusing, since " "a formal array parameter is treated as a pointer.", 0, 0 }, /* ** Booleans (4.2) */ { FK_BOOL, FK_NONE, regStringFlag, ARG_STRING, "booltype", FLG_BOOLTYPE, "set name of boolean type (default bool)", NULL, 0, 0 }, { FK_BOOL, FK_NONE, regStringFlag, ARG_STRING, "boolfalse", FLG_BOOLFALSE, "set name of boolean false (default false)", NULL, 0, 0 }, { FK_BOOL, FK_NONE, regStringFlag, ARG_STRING, "booltrue", FLG_BOOLTRUE, "set name of boolean true (default true)", NULL, 0, 0 }, { FK_BOOL, FK_HELP, plainFlag, "likelybool", FLG_LIKELYBOOL, "type name is probably a boolean type but does not match default " "boolean type name, \"bool\", and alternate name is not set", "Use the -booltype, -boolfalse and -booltrue flags to change the " "name of the default boolean type.", 0, 0 }, { FK_BOOL, FK_OPS, modeFlag, "boolcompare", FLG_BOOLCOMPARE, "comparison between bools (dangerous because of multiple true values)", "Two bool values are compared directly using a C primitive. This " "may produce unexpected results since all non-zero values are " "considered true, so different true values may not be equal. " "The file bool.h (included in splint/lib) provides bool_equal " "for safe bool comparisons.", 0, 0 }, { FK_BOOL, FK_OPS, modeFlag, "boolops", FLG_BOOLOPS, "primitive operation (!, && or ||) does not has a boolean argument", "The operand of a boolean operator is not a boolean. Use +ptrnegate " "to allow ! to be used on pointers.", 0, 0 }, { FK_BOOL, FK_POINTER, modeFlag, "ptrnegate", FLG_PTRNEGATE, "allow ! to be used on pointer operand", "The operand of ! operator is a pointer.", 0, 0 }, { FK_BOOL, FK_PRED,plainFlag, "predassign", FLG_PREDASSIGN, "condition test (if, while or for) is an assignment", "The condition test is an assignment expression. Probably, you mean " "to use == instead of =. If an assignment is intended, add an " "extra parentheses nesting (e.g., if ((a = b)) ...) to suppress " "this message.", 0, 0 }, { FK_BOOL, FK_PRED, specialFlag, "predbool", FLG_PREDBOOL, "type of condition test (if, while or for) not bool (sets predboolint, " "predboolptr and predboolothers)", "Test expression type is not boolean.", 0, 0 }, { FK_PRED, FK_BOOL, modeFlag, "predboolint", FLG_PREDBOOLINT, "type of condition test (if, while or for) is an integral type", "Test expression type is not boolean or int.", 0, 0 }, { FK_BOOL, FK_PRED, modeFlag, "predboolptr", FLG_PREDBOOLPTR, "type of condition test (if, while or for) is a pointer", "Test expression type is not boolean.", 0, 0 }, { FK_BOOL, FK_PRED, modeFlag, "predboolothers", FLG_PREDBOOLOTHERS, "type of condition test (if, while or for) not bool, int or pointer", "Test expression type is not boolean.", 0, 0 }, /* ** 4.3 Abstract types */ { FK_ABSTRACT, FK_NONE, plainFlag, "abstract", FLG_ABSTRACT, "data abstraction barriers", "An abstraction barrier is broken. If necessary, use /*@access @*/ to allow access to an abstract type.", 0, 0 }, { FK_ABSTRACT, FK_NONE, modeFlag, "abstractcompare", FLG_ABSTRACTCOMPARE, "object equality comparison on abstract type operands", "An object comparison (== or !=) is used on operands of abstract type.", 0, 0 }, { FK_ABSTRACT, FK_NONE, plainFlag, "numabstract", FLG_NUMABSTRACT, "data abstraction barriers", "An abstraction barrier involving a numabstract type is broken. If necessary, use /*@access @*/ to allow access to a numabstract type.", 0, 0 }, { FK_ABSTRACT, FK_NONE, modeFlag, "numabstractcast", FLG_NUMABSTRACTCAST, "numeric literal cast to numabstract type", "A numeric literal is cast to a numabstract type.", 0, 0 }, { FK_ABSTRACT, FK_NONE, modeFlag, "numabstractlit", FLG_NUMABSTRACTLIT, "numeric literal can used as numabstract type", "To allow a numeric literal to be used as a numabstract type, use +numabstractlit.", 0, 0 }, { FK_ABSTRACT, FK_TYPEEQ, modeFlag, "numabstractindex", FLG_NUMABSTRACTINDEX, "a numabstract type can be used to index an array", "To allow numabstract types to index arrays, use +numabstractindex.", 0, 0 }, { FK_ABSTRACT, FK_NONE, modeFlag, "numabstractprint", FLG_NUMABSTRACTPRINT, "a numabstract value is printed using %d format code", "A numabstract value is printed usind %d format code in a printf.", 0, 0 }, { FK_ABSTRACT, FK_IMPLICIT, plainFlag, "impabstract", FLG_IMPABSTRACT, "assume user type definitions are abstract (unless /*@concrete@*/ is used)", NULL, 0, 0 }, /* 4.3.1 Access */ { FK_ABSTRACT, FK_NAMES, plainFlag, "accessmodule", FLG_ACCESSMODULE, "allow access to abstract types in definition module", "The representation of an abstract type defined in . is " "accessible anywhere in a file named ..", 0, 0 }, { FK_ABSTRACT, FK_NAMES, plainFlag, "accessfile", FLG_ACCESSFILE, "allow access to abstract types by file name convention", "The representation of an abstract type named is " "accessible anywhere in a file named ..", 0, 0 }, { FK_ABSTRACT, FK_NAMES, plainFlag, "accessczech", FLG_ACCESSCZECH, "allow access to abstract types by czech naming convention", "The representation of an abstract type named is accessible " "in the definition of a function or constant named _", 0, 0 }, { FK_ABSTRACT, FK_NAMES, plainFlag, "accessslovak", FLG_ACCESSSLOVAK, "allow access to abstract types by slovak naming convention", "The representation of an abstract type named is accessible " "in the definition of a function or constant named ", 0, 0 }, { FK_ABSTRACT, FK_NAMES, plainFlag, "accessczechoslovak", FLG_ACCESSCZECHOSLOVAK, "allow access to abstract types by czechoslovak naming convention", "The representation of an abstract type named is accessible " "in the definition of a function or constant named _ or ", 0, 0 }, { FK_ABSTRACT, FK_NAMES, specialFlag, "accessall", FLG_ACCESSALL, "set accessmodule, accessfile and accessczech", "Sets accessmodule, accessfile and accessczech", 0, 0 }, /* 4.3.2 Mutability */ { FK_ABSTRACT, FK_NONE, modeFlag, "mutrep", FLG_MUTREP, "representation of mutable type has sharing semantics", "LCL semantics requires that a mutable type exhibits sharing semantics. " "In order for objects to be shared a indirection is necessary in the representation. " "A mutable type may be represented by a pointer or an abstract mutable type. Handles " "into static data are fine, too, but will generate this error message unless it is suppressed.", 0, 0 }, /* ** Memory Management (5) */ /* Deallocation Errors */ { FK_MEMORY, FK_LEAK, modeFlag, "mustfreefresh", FLG_MUSTFREEFRESH, "freshly allocated storage not released before return or scope exit", "A memory leak has been detected. Storage allocated locally " "is not released before the last reference to it is lost.", 0, 0 }, { FK_MEMORY, FK_LEAK, modeFlag, "mustfreeonly", FLG_MUSTFREEONLY, "only storage not released before return or scope exit", "A memory leak has been detected. Only-qualified storage is not released before the last " "reference to it is lost.", 0, 0 }, { FK_MEMORY, FK_LEAK, specialFlag, "mustfree", FLG_MUSTFREE, "fresh or only storage not released before return or scope exit (sets mustfreefresh and mustfreeonly)", "A memory leak has been detected.", 0, 0 }, { FK_MEMORY, FK_DEAD, modeFlag, "usereleased", FLG_USERELEASED, "storage used after release", "Memory is used after it has been released (either by passing " "as an only param or assigning to an only global).", 0, 0 }, { FK_MEMORY, FK_DEAD, modeFlag, "strictusereleased", FLG_STRICTUSERELEASED, "element used after it may have been released", "Memory (through fetch) is used after it may have been released " "(either by passing as an only param or assigning to an only global).", 0, 0 }, { FK_MEMORY, FK_LEAK, modeFlag, "compdestroy", FLG_COMPDESTROY, "all only references derivable from void pointer out only parameter are released", "A storage leak due to incomplete deallocation of a structure or deep " "pointer is suspected. Unshared storage that is reachable from " "a reference that is being deallocated has not yet been deallocated. " "Splint assumes when an object is passed " "as an out only void pointer that the outer object will be " "deallocated, but the inner objects will not.", 0, 0 }, { FK_MEMORY, FK_LEAK, modeFlag, "strictdestroy", FLG_STRICTDESTROY, "report complete destruction errors for array elements that " "may have been released", NULL, 0, 0 }, { FK_MEMORY, FK_ARRAY, modeFlag, "deparrays", FLG_DEPARRAYS, "array elements are dependent storage", "When an element is fetched from an array, Splint analysis is " "not able to determine if the same element is reused. " "If +deparrays, Splint will mark local storage assigned from " "array fetches as dependent.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "branchstate", FLG_BRANCHSTATE, "storage has inconsistent states of alternate paths through a branch", "The state of a variable is different depending on which branch " "is taken. This means no annotation can sensibly be applied " "to the storage.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "strictbranchstate", FLG_STRICTBRANCHSTATE, "storage through array fetch has inconsistent states of alternate " "paths through a branch", "The state of a variable through an array fetch is different depending " "on which branch is taken. This means no annotation can sensibly be applied " "to the storage.", 0, 0 }, { FK_MEMORY, FK_NONE, specialFlag, "memchecks", FLG_MEMCHECKS, "sets all dynamic memory checking flags (memimplicit, mustfree, mustdefine, " "mustnotalias, null, memtrans)", NULL, 0, 0 }, { FK_MEMORY, FK_DEF, modeFlag, "compmempass", FLG_COMPMEMPASS, "actual parameter matches alias kind of formal parameter completely ", "Storage derivable from a parameter does not match the alias kind " "expected for the formal parameter.", 0, 0 }, { FK_MEMORY, FK_DEAD, modeFlag, "stackref", FLG_RETSTACK, "external reference to stack-allocated storage is created", "A stack reference is pointed to by an external reference when the " "function returns. The stack-allocated storage is destroyed " "after the call, leaving a dangling reference.", 0, 0 }, { FK_MEMORY, FK_NONE, specialFlag, "memtrans", FLG_MEMTRANS, "memory transfer errors (sets all *trans flags)", "Memory is transferred in a way that violates annotations.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "dependenttrans", FLG_DEPENDENTTRANS, "dependent transfer errors", "Dependent storage is transferred to a non-dependent reference.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "newreftrans", FLG_NEWREFTRANS, "new reference transfer to reference counted reference", "A new reference is transferred to a reference counted reference.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "onlytrans", FLG_ONLYTRANS, "only storage transferred to non-only reference (memory leak)", "The only reference to this storage is transferred to another " "reference (e.g., by returning it) that does not have the " "only annotation. This may lead to a memory leak, since the " "new reference is not necessarily released.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "onlyunqglobaltrans", FLG_ONLYUNQGLOBALTRANS, "only storage transferred to an unqualified global or " "static reference (memory leak)", "The only reference to this storage is transferred to another " "reference that does not have an aliasing annotation. " "This may lead to a memory leak, since the " "new reference is not necessarily released.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "ownedtrans", FLG_OWNEDTRANS, "owned storage transferred to non-owned reference (memory leak)", "The owned reference to this storage is transferred to another " "reference (e.g., by returning it) that does not have the " "owned annotation. This may lead to a memory leak, since the " "new reference is not necessarily released.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "freshtrans", FLG_FRESHTRANS, "fresh storage transferred to non-only reference (memory leak)", "Fresh storage (newly allocated in this function) is transferred " "in a way that the obligation to release storage is not " "propagated. Use the /*@only@*/ annotation to indicate " "the a return value is the only reference to the returned " "storage.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "sharedtrans", FLG_SHAREDTRANS, "shared storage transferred to non-shared reference", "Shared storage is transferred to a non-shared reference. The other " "reference may release storage needed by this reference.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "temptrans", FLG_TEMPTRANS, "temp storage transferred to non-temporary reference", "Temp storage (associated with a formal parameter) is transferred " "to a non-temporary reference. The storage may be released " "or new aliases created.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "kepttrans", FLG_KEPTTRANS, "kept storage transferred to non-temporary reference", "storage is transferred " "to a non-temporary reference after being passed as keep parameter. The storage may be released " "or new aliases created.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "keeptrans", FLG_KEEPTRANS, "keep storage transferred inconsistently", "Keep storage is transferred inconsistently --- either in a way " "that may add a new alias to it, or release it.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "immediatetrans", FLG_IMMEDIATETRANS, "an immediate address (result of &) is transferred inconsistently", "An immediate address (result of & operator) is transferred " "inconsistently.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "refcounttrans", FLG_REFCOUNTTRANS, "reference counted storage is transferred in an inconsistent way", "Reference counted storage is transferred in a way that may not " "be consistent with the reference count.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "statictrans", FLG_STATICTRANS, "static storage is transferred in an inconsistent way", "Static storage is transferred in an inconsistent way.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "unqualifiedtrans", FLG_UNKNOWNTRANS, "unqualified storage is transferred in an inconsistent way", "Unqualified storage is transferred in an inconsistent way.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "staticinittrans", FLG_STATICINITTRANS, "static storage is used as an initial value in an inconsistent way", "Static storage is used as an initial value in an inconsistent way.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "unqualifiedinittrans", FLG_UNKNOWNINITTRANS, "unqualified storage is used as an initial value in an inconsistent way", "Unqualified storage is used as an initial value in an inconsistent way.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "readonlytrans", FLG_READONLYTRANS, "report memory transfer errors for initializations to read-only string literals", "A read-only string literal is assigned to a non-observer reference.", 0, 0 }, { FK_MEMORY, FK_PARAMS, modeFlag, "passunknown", FLG_PASSUNKNOWN, "passing a value as an un-annotated parameter clears its annotation", NULL, 0, 0 }, /* 5.3 Implicit Memory Annotations */ { FK_MEMORY, FK_NONE, modeFlag, "readonlystrings", FLG_READONLYSTRINGS, "string literals are read-only (error if one is modified or released)", "String literals are read-only. An error is reported " "if a string literal may be modified or released.", 0, 0 }, { FK_MEMORY, FK_IMPLICIT, modeFlag, "memimp", FLG_MEMIMPLICIT, "memory errors for unqualified storage", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, plainFlag, "paramimptemp", FLG_PARAMIMPTEMP, "assume unannotated parameter is temp", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, specialFlag, "allimponly", FLG_ALLIMPONLY, "sets globimponly, retimponly, structimponly, specglobimponly, " "specretimponly and specstructimponly", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, specialFlag, "codeimponly", FLG_CODEIMPONLY, "sets globimponly, retimponly and structimponly", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, specialFlag, "specimponly", FLG_SPECALLIMPONLY, "sets specglobimponly, specretimponly and specstructimponly", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, plainFlag, "globimponly", FLG_GLOBIMPONLY, "assume unannotated global storage is only", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, plainFlag, "retimponly", FLG_RETIMPONLY, "assume unannotated returned storage is only", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, plainFlag, "structimponly", FLG_STRUCTIMPONLY, "assume unannotated structure field is only", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, plainFlag, "specglobimponly", FLG_SPECGLOBIMPONLY, "assume unannotated global storage is only", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, plainFlag, "specretimponly", FLG_SPECRETIMPONLY, "assume unannotated returned storage is only", NULL, 0, 0 }, { FK_MEMORY, FK_IMPLICIT, plainFlag, "specstructimponly", FLG_SPECSTRUCTIMPONLY, "assume unannotated structure field is only", NULL, 0, 0 }, /* Reference Counting */ /* ** 6. Sharing */ /* 6.1 Aliasing warnings */ { FK_ALIAS, FK_MEMORY, modeFlag, "aliasunique", FLG_ALIASUNIQUE, "unique parameter is aliased", "A unique or only parameter is aliased by some other parameter or visible global.", 0, 0 }, { FK_ALIAS, FK_MEMORY, modeFlag, "mayaliasunique", FLG_MAYALIASUNIQUE, "unique parameter may be aliased", "A unique or only parameter may be aliased by some other parameter or visible global.", 0, 0 }, { FK_ALIAS, FK_MEMORY, modeFlag, "mustnotalias", FLG_MUSTNOTALIAS, "temp storage aliased at return point or scope exit", "An alias has been added to a temp-qualifier parameter or global that is visible externally when the function returns. If the aliasing is needed, use the /*@shared@*/ annotation to indicate that new aliases to the parameter may be created.", 0, 0 }, { FK_ALIAS, FK_NONE, modeFlag, "retalias", FLG_RETALIAS, "function returns alias to parameter or global", "The returned value shares storage with a parameter or global. If a parameter is to be returned, use the returned qualifier. If the result is not modified, use the observer qualifier on the result type. Otherwise, exposed can be used, but limited checking is done.", 0, 0 }, /* Global aliasing */ { FK_ALIAS, FK_GLOBALS, specialFlag, "globalias", FLG_GLOBALIAS, "function returns with global aliasing external state (sets " "checkstrictglobalias, checkedglobalias, checkmodglobalias and " "uncheckedglobalias)", "A global variable aliases externally-visible state when the function returns.", 0, 0 }, { FK_ALIAS, FK_GLOBALS, modeFlag, "checkstrictglobalias", FLG_CHECKSTRICTGLOBALIAS, "function returns with a checkstrict global aliasing external state", "A global variable aliases externally-visible state when the function returns.", 0, 0 }, { FK_ALIAS, FK_GLOBALS, modeFlag, "checkedglobalias", FLG_CHECKEDGLOBALIAS, "function returns with a checked global aliasing external state", "A global variable aliases externally-visible state when the function returns.", 0, 0 }, { FK_ALIAS, FK_GLOBALS, modeFlag, "checkmodglobalias", FLG_CHECKMODGLOBALIAS, "function returns with a checkmod global aliasing external state", "A global variable aliases externally-visible state when the function returns.", 0, 0 }, { FK_ALIAS, FK_GLOBALS, modeFlag, "uncheckedglobalias", FLG_UNCHECKEDGLOBALIAS, "function returns with an unchecked global aliasing external state", "A global variable aliases externally-visible state when the function returns.", 0, 0 }, /* 6.2 Exposure */ { FK_MEMORY, FK_NONE, modeFlag, "exposetrans", FLG_EXPOSETRANS, "exposure transfer errors", "Exposed storage is transferred to a non-exposed, non-observer reference.", 0, 0 }, { FK_MEMORY, FK_NONE, modeFlag, "observertrans", FLG_OBSERVERTRANS, "observer transfer errors", "Observer storage is transferred to a non-observer reference.", 0, 0 }, { FK_EXPOSURE, FK_ABSTRACT, specialFlag, "repexpose", FLG_REPEXPOSE, "abstract representation is exposed (sets assignexpose, retexpose, and castexpose)", "The internal representation of an abstract type is visible to the " "caller. This means clients may have access to a pointer " "into the abstract representation.", 0, 0 }, { FK_EXPOSURE, FK_ABSTRACT, modeFlag, "retexpose", FLG_RETEXPOSE, "abstract representation is exposed (return values only)", "The return value shares storage with an instance of an abstract " "type. This means clients may have access to a pointer into " "the abstract representation. Use the observer qualifier to " "return exposed storage that may not be modified by the " "client. Use the exposed qualifier to return modifiable " "(but not deallocatable) exposed storage (dangerous).", 0, 0 }, { FK_EXPOSURE, FK_ABSTRACT, modeFlag, "assignexpose", FLG_ASSIGNEXPOSE, "abstract representation is exposed (assignments only)", "Storage internal to the representation of an abstract type is " "assigned to an external pointer. This means clients may " "have access to a pointer into the abstract representation. " "If the external pointer is a parameter, the exposed qualifier " "can be used to allow the assignment, however, this is " "considered dangerous programming practice.", 0, 0 }, { FK_EXPOSURE, FK_ABSTRACT, modeFlag, "castexpose", FLG_CASTEXPOSE, "abstract representation is exposed through a cast", "Storage internal to the representation of an abstract type is exposed " "through a type cast. This means clients may have access to a " "pointer into the abstract representation.", 0, 0 }, { FK_DECL, FK_TYPE, modeFlag, "redundantsharequal", FLG_REDUNDANTSHAREQUAL, "declaration uses observer qualifier that is always true", "A declaration of an immutable object uses a redundant observer qualifier.", 0, 0 } , { FK_DECL, FK_TYPE, modeFlag, "misplacedsharequal", FLG_MISPLACEDSHAREQUAL, "declaration of unsharable storage uses sharing annotation", "A declaration of an unsharable object uses a sharing annotation.", 0, 0 } , /* ** 7. Function Interfaces */ /* 7.1 Modifications */ { FK_MODIFIES, FK_SPEC, plainFlag, "mods", FLG_MODIFIES, "unspecified modification of caller-visible state", "An externally-visible object is modified by a function, but not " "listed in its modifies clause.", 0, 0 }, { FK_MODIFIES, FK_SPEC, modeFlag, "mustmod", FLG_MUSTMOD, "specified modification is not detected", "An object listed in the modifies clause is not modified by the " "implementation of the function. The modification may not " "be detected if it is done through a call to an unspecified " "function.", 0, 0 }, { FK_MODIFIES, FK_MEMORY, plainFlag, "modobserver", FLG_MODOBSERVER, "possible modification of observer storage", "Storage declared with observer is possibly modified. Observer " "storage may not be modified.", 0, 0 }, { FK_MODIFIES, FK_MEMORY, modeFlag, "modobserveruncon", FLG_MODOBSERVERUNCON, "possible modification of observer storage through unconstrained call", "Storage declared with observer may be modified through a call to an " "unconstrained function.", 0, 0 }, { FK_MODIFIES, FK_MEMORY, modeFlag, "modinternalstrict", FLG_MODINTERNALSTRICT, "possible modification of internal storage through function call", "A function that modifies internalState is called from a function that " "does not list internalState in its modifies clause", 0, 0 }, { FK_MODIFIES, FK_UNSPEC, modeFlag, "modfilesys", FLG_MODFILESYSTEM, "report undocumented file system modifications (applies to unspecified " "functions if modnomods is set)", NULL, 0, 0 }, { FK_MODIFIES, FK_UNSPEC, specialFlag, "modunspec", FLG_MODUNSPEC, "modification in unspecified functions (sets modnomods, " "modglobunspec and modstrictglobsunspec)", NULL, 0, 0 }, { FK_MODIFIES, FK_UNSPEC, modeFlag, "modnomods", FLG_MODNOMODS, "modification in a function with no modifies clause", "An externally-visible object is modified by a function with no " "/*@modifies@*/ comment. The /*@modifies ... @*/ control " "comment can be used to give a modifies list for an " "unspecified function.", 0, 0 }, { FK_MODIFIES, FK_UNSPEC, modeFlag, "moduncon", FLG_MODUNCON, "possible modification through a call to an unconstrained function", "An unconstrained function is called in a function body where " "modifications are checked. Since the unconstrained function " "may modify anything, there may be undetected modifications in " "the checked function.", 0, 0 }, { FK_MODIFIES, FK_UNSPEC, modeFlag, "modunconnomods", FLG_MODUNCONNOMODS, "possible modification through a call to an unconstrained function in " "a function with no modifies clause", "An unconstrained function is called in a function body where " "modifications are checked. Since the unconstrained function " "may modify anything, there may be undetected modifications in " "the checked function.", 0, 0 }, { FK_MODIFIES, FK_GLOBALS, modeFlag, "globsimpmodsnothing", FLG_GLOBALSIMPMODIFIESNOTHING, "functions declared with a globals list but no modifies clause are " "assumed to modify nothing", "An implicit modifies nothing clause is assumed for a function " "declared with a globals list but not modifies clause.", 0, 0 }, { FK_MODIFIES, FK_GLOBALS, modeFlag, "modsimpnoglobs", FLG_MODIFIESIMPNOGLOBALS, "functions declared with a modifies clause but no globals list " "are assumed to use no globals", "An implicit empty globals list is assumed for a function " "declared with a modifies clause but no globals list.", 0, 0 }, /* ** Globals */ { FK_GLOBALS, FK_NONE, modeFlag, "globstate", FLG_GLOBSTATE, "returns with global in inconsistent state (null or undefined)", "A global variable does not satisfy its annotations when control is transferred.", 0, 0 }, { FK_GLOBALS, FK_SPEC, plainFlag, "globs", FLG_GLOBALS, "undocumented use of a checked global variable", "A checked global variable is used in the function, but not listed in " "its globals clause. By default, only globals specified in .lcl " "files are checked. To check all globals, use +allglobals. To " "check globals selectively use /*@checked@*/ in the global " "declaration.", 0, 0 }, { FK_GLOBALS, FK_SPEC, modeFlag, "globuse", FLG_USEALLGLOBS, "global listed for a function not used", "A global variable listed in the function's globals list is not used " "in the body of the function.", 0, 0 }, { FK_GLOBALS, FK_NONE, modeFlag, "internalglobs", FLG_INTERNALGLOBS, "use of internalState", "A called function uses internal state, but the globals list for the " "function being checked does not include internalState", 0, 0 }, { FK_GLOBALS, FK_NONE, modeFlag, "internalglobsnoglobs", FLG_INTERNALGLOBSNOGLOBS, "use of internalState (in function with no globals list)", "A called function uses internal state, but the function being checked " "has no globals list", 0, 0 }, { FK_GLOBALS, FK_MODIFIES, modeFlag, "warnmissingglobs", FLG_WARNMISSINGGLOBALS, "global variable used in modifies clause is not listed in globals list", "A global variable is used in the modifies clause, but it is not listed in " "the globals list. The variable will be added to the globals list.", 0, 0 }, { FK_GLOBALS, FK_MODIFIES, modeFlag, "warnmissingglobsnoglobs", FLG_WARNMISSINGGLOBALSNOGLOBS, "global variable used in modifies clause in a function with no globals list", "A global variable is used in the modifies clause, but the function " "has no globals list. The variable will be added to the globals list.", 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "globnoglobs", FLG_GLOBUNSPEC, "use of checked global in a function with no globals list or specification", "A specified global variable is used in the function, but not listed " "in its globals list. Without +globnoglobs, only globals " "declared with /*@checkedstrict@*/ will produce use " "errors in functions without globals " "lists. The /*@globals ... @*/ control comment can be used to give " "a globals list for an unspecified function.", 0, 0 }, { FK_GLOBALS, FK_IMPLICIT, modeFlag, "allglobs", FLG_ALLGLOBALS, "report use and modification errors for globals not annotated with unchecked", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "checkstrictglobs", FLG_CHECKSTRICTGLOBALS, "report use and modification errors for checkedstrict globals", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckedspecglobs", FLG_IMPCHECKEDSPECGLOBALS, "assume checked qualifier for unqualified global declarations in .lcl files", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckmodspecglobs", FLG_IMPCHECKMODSPECGLOBALS, "assume checkmod qualifier for unqualified global declarations in .lcl files", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckedstrictspecglobs", FLG_IMPCHECKEDSTRICTSPECGLOBALS, "assume checkmod qualifier for unqualified global declarations in .lcl files", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckedglobs", FLG_IMPCHECKEDGLOBALS, "assume checked qualifier for unqualified global declarations", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckmodglobs", FLG_IMPCHECKMODGLOBALS, "assume checkmod qualifier for unqualified global declarations", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckedstrictglobs", FLG_IMPCHECKEDSTRICTGLOBALS, "assume checkedstrict qualifier for unqualified global declarations", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckedstatics", FLG_IMPCHECKEDSTATICS, "assume checked qualifier for unqualified file static declarations", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckmodstatics", FLG_IMPCHECKMODSTATICS, "assume checkmod qualifier for unqualified file static declarations", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckmodinternals", FLG_IMPCHECKMODINTERNALS, "assume checkmod qualifier for unqualified local " "static declarations (for internal state modifications)", NULL, 0, 0 }, { FK_GLOBALS, FK_UNSPEC, modeFlag, "impcheckedstrictstatics", FLG_IMPCHECKEDSTRICTSTATICS, "assume checkedstrict qualifier for unqualified file static declarations", NULL, 0, 0 }, { FK_GLOBALS, FK_MODIFIES, modeFlag, "modglobs", FLG_MODGLOBS, "undocumented modification of a checked global variable", "A checked global variable is modified by the function, but not listed in " "its modifies clause.", 0, 0 }, { FK_GLOBALS, FK_MODIFIES, modeFlag, "modglobsnomods", FLG_MODGLOBSUNSPEC, "undocumented modification of a checked global variable in a function " "declared with no modifies clause", "A checked global variable is modified by the function, but not listed in " "its modifies clause.", 0, 0 }, { FK_GLOBALS, FK_MODIFIES, modeFlag, "modstrictglobsnomods", FLG_MODSTRICTGLOBSUNSPEC, "undocumented modification of a strict checked global variable in a " "function declared with no modifies clause", "A checked global variable is modified by the function, but not listed in " "its modifies clause.", 0, 0 }, { FK_GLOBALS, FK_MODIFIES, modeFlag, "modglobsunchecked", FLG_MODGLOBSUNCHECKED, "undocumented modification of an unchecked checked global variable", "An unchecked global variable is modified by the function, but not listed in " "its modifies clause.", 0, 0 }, /* ** State Clauses */ /* ** 8. Control Flow */ /* 8.1 Execution */ { FK_CONTROL, FK_NONE, modeFlag, "noret", FLG_NORETURN, "path with no return detected in non-void function", "There is a path through a function declared to return a value on " "which there is no return statement. This means the execution " "may fall through without returning a meaningful result to " "the caller.", 0, 0 }, { FK_CONTROL, FK_NONE, plainFlag, "emptyret", FLG_EMPTYRETURN, "empty return in function declared to return value", NULL, 0, 0 }, { FK_CONTROL, FK_NONE, plainFlag, "alwaysexits", FLG_ALWAYSEXITS, "loop predicate always exits", NULL, 0, 0 }, { FK_CONTROL, FK_MEMORY, specialFlag, "loopexec", FLG_LOOPEXEC, "assume all loops execute at least once (sets forloopexec, whileloopexec and iterloopexec)", NULL, 0, 0 }, { FK_CONTROL, FK_MEMORY, plainFlag, "forloopexec", FLG_FORLOOPEXEC, "assume all for loops execute at least once", NULL, 0, 0 }, { FK_CONTROL, FK_MEMORY, plainFlag, "whileloopexec", FLG_WHILELOOPEXEC, "assume all while loops execute at least once", NULL, 0, 0 }, { FK_CONTROL, FK_MEMORY, plainFlag, "iterloopexec", FLG_ITERLOOPEXEC, "assume all iterator loops execute at least once", NULL, 0, 0 }, { FK_CONTROL, FK_MEMORY, plainFlag, "obviousloopexec", FLG_OBVIOUSLOOPEXEC, "assume loop that can be determined to always execute always does", NULL, 0, 0 }, /* 8.2 Undefined Behavior */ { FK_BEHAVIOR, FK_ANSI, modeFlag, "evalorder", FLG_EVALORDER, "code has unspecified or implementation-dependent behavior " "because of order of evaluation", "Code has unspecified behavior. " "Order of evaluation of function parameters or subexpressions " "is not defined, so if a value is used and modified in different " "places not separated by a sequence point constraining " "evaluation order, then the result of the expression is " "unspecified.", 0, 0 }, { FK_BEHAVIOR, FK_ANSI, modeFlag, "evalorderuncon", FLG_EVALORDERUNCON, "code involving call to unspecified function has undefined or implementation-dependent behavior", "Code involving a call to function with no modifies or globals clause " "may have undefined or implementation-dependent behavior (Splint assumes the " "unconstrained call may modify any reachable state or use any global). Add a " "specification for the function.", 0, 0 }, /* 8.3 Problematic Control Structures */ /* 8.3.1 Infinite Loops */ { FK_CONTROL, FK_NONE, modeFlag, "infloops", FLG_INFLOOPS, "likely infinite loop is detected", "This appears to be an infinite loop. Nothing in the body of the " "loop or the loop test modifies the value of the loop test. " "Perhaps the specification of a function called in the loop " "body is missing a modification.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "infloopsuncon", FLG_INFLOOPSUNCON, "likely infinite loop is detected (may result from unconstrained function)", "This appears to be an infinite loop. Nothing in the body of the " "loop or the loop test modifies the value of the loop test. " "There may be a modification through a call to an unconstrained " "function, or an unconstrained function in the loop test may use " "a global variable modified by the loop body.", 0, 0 }, /* 8.3.2 Switches */ { FK_CONTROL, FK_NONE, modeFlag, "casebreak", FLG_CASEBREAK, "non-empty case in a switch without preceding break", "Execution falls through from the previous case (use /*@fallthrough@*/ to mark fallthrough cases).", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "misscase", FLG_MISSCASE, "switch on enum type missing case for some value", "Not all values in an enumeration are present as cases in the switch.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "firstcase", FLG_FIRSTCASE, "first statement in switch is not a case", "The first statement after a switch is not a case.", 0, 0 }, { FK_CONTROL, FK_NONE, plainFlag, "duplicatecases", FLG_DUPLICATECASES, "duplicate cases in switch", "Duplicate cases in switch.", 0, 0 }, /* 8.3.3 Deep Breaks */ { FK_CONTROL, FK_NONE, specialFlag, "deepbreak", FLG_DEEPBREAK, "break inside nested while or for or switch", "A break statement appears inside the body of a nested while, for or " "switch statement. Sets looploopbreak, loopswitchbreak, " "switchloopbreak, switchswitchbreak, and looploopcontinue.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "looploopbreak", FLG_LOOPLOOPBREAK, "break inside nested while or for", "A break statement appears inside the body of a nested while or for " "statement. This is perfectly reasonable code, but check that " "the break is intended to break only the inner loop. The " "break statement may be preceded by /*@innerbreak@*/ to suppress " "the message for this break only.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "switchloopbreak", FLG_SWITCHLOOPBREAK, "break in loop inside switch", "A break statement appears inside the body of a while or for " "statement within a switch. This is perfectly reasonable code, but check that " "the break is intended to break only the inner loop. The " "break statement may be preceded by /*@loopbreak@*/ to suppress " "the message for this break only.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "loopswitchbreak", FLG_LOOPSWITCHBREAK, "break in switch inside loop", "A break statement appears inside a switch statement within a while or " "for loop. This is perfectly reasonable code, but check that " "the break is intended to break only the inner loop. The " "break statement may be preceded by /*@switchbreak@*/ to suppress " "the message for this break only.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "switchswitchbreak", FLG_SWITCHSWITCHBREAK, "break in switch inside switch", "A break statement appears inside a switch statement within another " "switch statement. This is perfectly reasonable code, but check that " "the break is intended to break only the inner switch. The " "break statement may be preceded by /*@innerbreak@*/ to suppress " "the message for this break only.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "looploopcontinue", FLG_LOOPLOOPCONTINUE, "continue inside nested loop", "A continue statement appears inside a loop within a loop. " "This is perfectly reasonable code, but check that " "the continue is intended to continue only the inner loop. The " "continue statement may be preceded by /*@innercontinue@*/ to suppress " "the message for this continue only.", 0, 0 }, /* 8.3.4 Loop and If Bodies */ { FK_CONTROL, FK_NONE, modeFlag, "whileempty", FLG_WHILEEMPTY, "a while statement has no body", "While statement has no body.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "whileblock", FLG_WHILEBLOCK, "the body of a while statement is not a block", "While body is a single statement, not a compound block.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "forempty", FLG_FOREMPTY, "a for statement has no body", "For statement has no body.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "forblock", FLG_FORBLOCK, "the body of a for statement is not a block", "Loop body is a single statement, not a compound block.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "ifempty", FLG_IFEMPTY, "an if statement has no body", "If statement has no body.", 0, 0 }, { FK_CONTROL, FK_NONE, modeFlag, "ifblock", FLG_IFBLOCK, "the body of an if statement is not a block", "If body is a single statement, not a compound block.", 0, 0 }, { FK_CONTROL, FK_NONE, specialFlag, "allempty", FLG_ALLEMPTY, "an if, while or for statement has no body (sets ifempty, " "whileempty and forempty", NULL, 0, 0 }, { FK_CONTROL, FK_NONE, specialFlag, "allblock", FLG_ALLBLOCK, "the body of an if, while or for statement is not a block " "(sets ifblock, whileblock and forblock)", "Body is a single statement, not a compound block.", 0, 0 }, /* 8.3.5 Complete Logic */ { FK_CONTROL, FK_NONE, modeFlag, "elseifcomplete", FLG_ELSEIFCOMPLETE, "if ... else if chains must have final else", "There is no final else following an else if construct.", 0, 0 }, /* 8.4 Suspicious Statements */ { FK_CONTROL, FK_NONE, modeFlag, "unreachable", FLG_UNREACHABLE, "unreachable code detected", "This code will never be reached on any possible execution.", 0, 0 }, /* 8.4.1 Statements with No Effects */ { FK_EFFECT, FK_CONTROL, modeFlag, "noeffect", FLG_NOEFFECT, "statement with no effect", "Statement has no visible effect --- no values are modified.", 0, 0 }, { FK_EFFECT, FK_CONTROL, modeFlag, "noeffectuncon", FLG_NOEFFECTUNCON, "statement with no effect (except possibly through call to " "unconstrained function)", "Statement has no visible effect --- no values are modified. It may " "modify something through a call to an unconstrained function.", 0, 0 }, /* 8.4.2 Ignored Return Values */ { FK_IGNORERET, FK_NONE, specialFlag, "retval", FLG_RETVAL, "return value ignored (sets retvalint, retvalbool and retvalother)", "Result returned by function call is not used. If this is intended, " "cast result to (void) to eliminate message.", 0, 0 }, { FK_IGNORERET, FK_BOOL, modeFlag, "retvalother", FLG_RETVALOTHER, "return value of type other than bool or int ignored", "Result returned by function call is not used. If this is intended, " "can cast result to (void) to eliminate message.", 0, 0 }, { FK_IGNORERET, FK_BOOL, modeFlag, "retvalbool", FLG_RETVALBOOL, "return value of manifest type bool ignored", "Result returned by function call is not used. If this is intended, " "can cast result to (void) to eliminate message.", 0, 0 }, { FK_IGNORERET, FK_NONE, modeFlag, "retvalint", FLG_RETVALINT, "return value of type int ignored", "Result returned by function call is not used. If this is intended, " "can cast result to (void) to eliminate message.", 0, 0 }, /* ** 9. Buffer Sizes */ { FK_BOUNDS, FK_MEMORY, modeFlag, "nullterminated", FLG_NULLTERMINATED, "misuse of nullterminated allocation", "A possibly non-nullterminated string/memory is used/referenced as a nullterminated one.", 0, 0 }, { FK_BOUNDS, FK_MEMORY, specialFlag, "bounds", FLG_BOUNDS, "memory bounds checking (sets boundsread and boundswrite)", "Memory read or write may be out of bounds of allocated storage.", 0, 0 }, { FK_BOUNDS, FK_MEMORY, specialFlag, "likelybounds", FLG_LIKELYBOUNDS, "memory bounds checking (sets likelyboundsread and likelyboundswrite)", "Memory read or write may be out of bounds of allocated storage.", 0, 0 }, { FK_BOUNDS, FK_MEMORY, modeFlag, "likelyboundsread", FLG_LIKELYBOUNDSREAD, "likely out of bounds read", "A memory read references memory beyond the allocated storage.", 0, 0 }, { FK_BOUNDS, FK_MEMORY, modeFlag, "likelyboundswrite", FLG_LIKELYBOUNDSWRITE, "likely buffer overflow from an out of bounds write", "A memory write may write to an address beyond the allocated buffer.", 0, 0 }, { FK_BOUNDS, FK_MEMORY, modeFlag, "boundsread", FLG_BOUNDSREAD, "possible out of bounds read", "A memory read references memory beyond the allocated storage.", 0, 0 }, { FK_BOUNDS, FK_MEMORY, modeFlag, "boundswrite", FLG_BOUNDSWRITE, "possible buffer overflow from an out of bounds write", "A memory write may write to an address beyond the allocated buffer.", 0, 0 }, { FK_BOUNDS, FK_DISPLAY, plainFlag, "fcnpost", FLG_FUNCTIONPOST, "display function post conditions", "Display function post conditions.", 0, 0 }, { FK_BOUNDS, FK_DISPLAY, plainFlag, "redundantconstraints", FLG_REDUNDANTCONSTRAINTS, "display seemingly redundant constraints", "Display seemingly redundant constraints", 0, 0 }, /*drl7x added 6/18/01 */ { FK_BOUNDS, FK_MEMORY, modeFlag, "checkpost", FLG_CHECKPOST, "unable to verify predicate in ensures clause", "The function implementation may not satisfy a post condition given in an ensures clause.", 0, 0 }, { FK_BOUNDS, FK_MEMORY, plainFlag, "impboundsconstraints", FLG_IMPBOUNDSCONSTRAINTS, "generate implicit constraints for functions", NULL, 0, 0 }, /*drl7x added 4/29/01 */ { FK_BOUNDS, FK_MEMORY, plainFlag, "orconstraint", FLG_ORCONSTRAINT, "use limited OR expressions to resolve constraints", NULL, 0, 0 }, { FK_BOUNDS, FK_DISPLAY, plainFlag, "showconstraintparens", FLG_PARENCONSTRAINT, "display parentheses around constraint terms", NULL, 0, 0 }, /*drl added 2/4/2002*/ { FK_BOUNDS, FK_DISPLAY, plainFlag, "boundscompacterrormessages", FLG_BOUNDSCOMPACTERRORMESSAGES, "Display fewer new lines in bounds checking error messages", NULL, 0, 0 }, { FK_BOUNDS, FK_DISPLAY, plainFlag, "showconstraintlocation", FLG_CONSTRAINTLOCATION, "display location for every constraint generated", NULL, 0, 0 }, /*drl added flag 4/26/01*/ { /* evans added 2003-06-08 */ FK_BOUNDS, FK_MEMORY, modeFlag, "allocmismatch", FLG_ALLOCMISMATCH, "type conversion involves storage of non-divisble size", NULL, 0, 0 }, /* ** 10. Extensible Checking */ { FK_EXTENSIBLE, FK_FILES, globalStringFlag, ARG_FILE, "mts", FLG_MTSFILE, "load meta state declaration and corresponding xh file", NULL, 0, 0 }, { FK_EXTENSIBLE, FK_MEMORY, modeFlag, "statetransfer", FLG_STATETRANSFER, "storage has been transfered with invalid state", "Transfer violates user-defined state rules.", 0, 0 }, { FK_EXTENSIBLE, FK_MEMORY, modeFlag, "statemerge", FLG_STATEMERGE, "control paths merge with storage in incompatible states", "Control path merge violates user-defined state merge rules.", 0, 0 }, /* ** 11. Macros */ { FK_MACROS, FK_NONE, modeFlag, "macroredef", FLG_MACROREDEF, "macro redefined", "A macro is defined in more than one place.", 0, 0 }, { FK_MACROS, FK_UNRECOG, modeFlag, "macrounrecog", FLG_MACROUNDEF, "unrecognized identifier in macro", "An unrecognized identifier appears in a macro. If the identifier " "is defined before the macro is used, then this is okay.", 0, 0 }, /* 11.1 Constant Macros */ { FK_MACROS, FK_PROTOS, modeFlag, "macroconstdecl", FLG_MACROCONSTDECL, "non-parameterized macro without prototype or specification", "Macro constant has no declaration. Use /*@constant ...@*/ to " "declare the macro.", 0, 0 }, { FK_MACROS, FK_PROTOS, plainFlag, "macroconstdistance", FLG_MACROCONSTDIST, "macro constant name does not match nearby name", "Macro constant name does matches name of a previous declaration, but they are not near each other.", 0, 0 }, /* 11.2 Function-like Macros */ { FK_MACROS, FK_NONE, modeFlag, "macrostmt", FLG_MACROSTMT, "macro definition is syntactically not equivalent to function", "A macro is defined in a way that may cause syntactic problems. " "If the macro returns a value, use commas to separate expressions; " "otherwise, use do { } while (FALSE) construct.", 0, 0 }, { FK_MACROS, FK_NONE, modeFlag, "macroempty", FLG_MACROEMPTY, "macro definition for is empty", "A macro definition has no body.", 0, 0 }, { FK_MACROS, FK_PARAMS, modeFlag, "macroparams", FLG_MACROPARAMS, "macro parameter not used exactly once", "A macro parameter is not used exactly once in all possible " "invocations of the macro. To behave like a function, " "each macro parameter must be used exactly once on all " "invocations of the macro so that parameters with " "side-effects are evaluated exactly once. Use /*@sef@*/ to " "denote parameters that must be side-effect free.", 0, 0 }, { FK_MACROS, FK_CONTROL, modeFlag, "macroret", FLG_MACRORETURN, "return statement in macro body", "The body of a macro declared as a function uses a return statement. " "This exhibits behavior that " "could not be implemented by a function.", 0, 0 }, { FK_MACROS, FK_PARAMS, modeFlag, "macroassign", FLG_MACROASSIGN, "assignment to a macro parameter", "A macro parameter is used as the left side of an " "assignment expression. This exhibits behavior that " "could not be implemented by a function.", 0, 0 }, { FK_MACROS, FK_NONE, modeFlag, "macroparens", FLG_MACROPARENS, "macro parameter used without parentheses (in potentially dangerous context)", "A macro parameter is used without parentheses. This could be " "dangerous if the macro is invoked with a complex expression " "and precedence rules will change the evaluation inside the macro.", 0, 0 }, { FK_MACROS, FK_PROTOS, modeFlag, "macrodecl", FLG_MACRODECL, "macro without prototype or specification (sets macrofcndecl and macroconstdecl)", "Argument checking cannot be done well for macros without prototypes " "or specifications, since the types of the arguments are unknown.", 0, 0 }, { FK_MACROS, FK_PROTOS, modeFlag, "macrofcndecl", FLG_MACROFCNDECL, "parameterized macro without prototype or specification", "Function macro has no declaration.", 0, 0 }, /* 11.2.1 Side Effect Free Parameters */ { FK_MACROS, FK_PARAMS, modeFlag, "sefparams", FLG_SEFPARAMS, "a parameter with side-effects is passed as a sef parameter", "An actual parameter corresponding to a sef parameter may have a side-effect.", 0, 0 }, { FK_MACROS, FK_PARAMS, modeFlag, "sefuncon", FLG_SEFUNSPEC, "a parameter with unconstrained side-effects is passed as a sef parameter", "An actual parameter corresponding to a sef parameter involves a call " "to a procedure with no modifies clause that may have a side-effect.", 0, 0 }, /* 11.3 Controlling Macro Checking */ { FK_MACROS, FK_NONE, plainFlag, "constmacros", FLG_CONSTMACROS, "check all macros without parameter lists as constants", "Every non-parameterized macro (not preceded by /*@notfunction@*/) " "is checked as a constant.", 0, 0 }, { FK_MACROS, FK_NONE, plainFlag, "fcnmacros", FLG_FCNMACROS, "check all macros with parameter lists as functions", "Every parameterized macro (not preceded by /*@notfunction@*/) " "is checked as a function.", 0, 0 }, { FK_MACROS, FK_NONE, plainSpecialFlag, "allmacros", FLG_ALLMACROS, "sets fcnmacros and constmacros", "All macros (not preceded by /*@notfunction@*/) are checked as functions or " "constants depending on whether or not they have parameter lists.", 0, 0 }, { FK_MACROS, FK_NONE, plainFlag, "libmacros", FLG_LIBMACROS, "check all macros with declarations in library as functions", "Every macro declared in the load library is checked.", 0, 0 }, { FK_MACROS, FK_NONE, plainFlag, "specmacros", FLG_SPECMACROS, "check all macros corresponding to specified functions or constants", "Every macro declared a specification file is checked.", 0, 0 }, { FK_MACROS, FK_NONE, modeFlag, "macromatchname", FLG_MACROMATCHNAME, "macro definition does not match iter or constant declaration", "A iter or constant macro is defined using a different name from the " "one used in the previous syntactic comment", 0, 0 }, { FK_MACROS, FK_NONE, plainFlag, "nextlinemacros", FLG_MACRONEXTLINE, "the line after a constant or iter declaration must be a macro definition", "A constant or iter declaration is not immediately followed by a macro definition.", 0, 0 }, /* 11.4 Iterators */ { FK_ITER, FK_NONE, plainFlag, "iterbalance", FLG_ITERBALANCE, "iter is not balanced with end_", NULL, 0, 0 }, { FK_ITER, FK_NONE, plainFlag, "iteryield", FLG_ITERYIELD, "iter yield parameter is inappropriate", NULL, 0, 0 }, { FK_ITER, FK_NONE, plainFlag, "hasyield", FLG_HASYIELD, "iter declaration has no yield parameters", "An iterator has been declared with no parameters annotated with " "yield. This may be what you want, if the iterator is meant " "to do something a fixed number of times, but returns no " "information to the calling context. Probably, a parameter " "is missing the yield annotation to indicate that it is " "assigned a value in the calling context.", 0, 0 }, /* ** 12. Naming Conventions */ { FK_NAMES, FK_ABSTRACT, plainFlag, "namechecks", FLG_NAMECHECKS, "controls name checking without changing other settings", NULL, 0, 0 }, /* 12.1.1 Czech Names */ { FK_NAMES, FK_ABSTRACT, specialFlag, "czech", FLG_CZECH, "czech naming convention (sets accessczech, czechfunctions, czechvars, " "czechconstants, czechenums, and czechmacros)", "Name is not consistent with Czech naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechfcns", FLG_CZECHFUNCTIONS, "czech naming convention violated in a function or iterator declaration", "Function or iterator name is not consistent with Czech naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechvars", FLG_CZECHVARS, "czech naming convention violated in a variable declaration", "Variable name is not consistent with Czech naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechmacros", FLG_CZECHMACROS, "czech naming convention violated in an expanded macro name", "Expanded macro name is not consistent with Czech naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechconsts", FLG_CZECHCONSTANTS, "czech naming convention violated in a constant declaration", "Constant name is not consistent with Czech naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechtypes", FLG_CZECHTYPES, "czech naming convention violated in a user-defined type definition", "Type name is not consistent with Czech naming convention. Czech type " "names must not use the underscore character.", 0, 0 }, /* 12.1.2 Slovak Names */ { FK_NAMES, FK_ABSTRACT, specialFlag, "slovak", FLG_SLOVAK, "slovak naming convention violated", "Name is not consistent with Slovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "slovakfcns", FLG_SLOVAKFUNCTIONS, "slovak naming convention violated in a function or iterator declaration", "Function or iterator name is not consistent with Slovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "slovakmacros", FLG_SLOVAKMACROS, "slovak naming convention violated in an expanded macro name", "Expanded macro name is not consistent with Slovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "slovakvars", FLG_SLOVAKVARS, "slovak naming convention violated in a variable declaration", "Variable name is not consistent with Slovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "slovakconsts", FLG_SLOVAKCONSTANTS, "slovak naming convention violated in a constant declaration", "Constant name is not consistent with Slovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "slovaktypes", FLG_SLOVAKTYPES, "slovak naming convention violated in a use-defined type definition", "Type name is not consistent with Slovak naming convention. Slovak type " "names may not include uppercase letters.", 0, 0 }, /* 12.1.3 Czechoslovak Names */ { FK_NAMES, FK_ABSTRACT, specialFlag, "czechoslovak", FLG_CZECHOSLOVAK, "czech or slovak naming convention violated", "Name is not consistent with either Czech or Slovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechoslovakfcns", FLG_CZECHOSLOVAKFUNCTIONS, "czechoslovak naming convention violated in a function or iterator declaration", "Function name is not consistent with Czechoslovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechoslovakmacros", FLG_CZECHOSLOVAKMACROS, "czechoslovak naming convention violated in an expanded macro name", "Expanded macro name is not consistent with Czechoslovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechoslovakvars", FLG_CZECHOSLOVAKVARS, "czechoslovak naming convention violated in a variable declaration", "Variable name is not consistent with Czechoslovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechoslovakconsts", FLG_CZECHOSLOVAKCONSTANTS, "czechoslovak naming convention violated in a constant declaration", "Constant name is not consistent with Czechoslovak naming convention.", 0, 0 }, { FK_NAMES, FK_ABSTRACT, plainFlag, "czechoslovaktypes", FLG_CZECHOSLOVAKTYPES, "czechoslovak naming convention violated in a user-defined type definition", "Type name is not consistent with Czechoslovak naming convention. Czechoslovak " "type names may not include uppercase letters or the underscore character.", 0, 0 }, /* 12.2 Namespace Prefixes */ { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "macrovarprefix", FLG_MACROVARPREFIX, "set namespace prefix for variables declared in a macro body", "A variable declared in a macro body does not start with the macrovarprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "macrovarprefixexclude", FLG_MACROVARPREFIXEXCLUDE, "the macrovarprefix may not be used for non-macro variables", "A variable declared outside a macro body starts with the macrovarprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "tagprefix", FLG_TAGPREFIX, "set namespace prefix for struct, union and enum tags", "A tag identifier does not start with the tagprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "tagprefixexclude", FLG_TAGPREFIXEXCLUDE, "the tagprefix may not be used for non-tag identifiers", "An identifier that is not a tag starts with the tagprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "enumprefix", FLG_ENUMPREFIX, "set namespace prefix for enum members", "An enum member does not start with the enumprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "enumprefixexclude", FLG_ENUMPREFIXEXCLUDE, "the enumprefix may not be used for non-enum member identifiers", "An identifier that is not an enum member starts with the enumprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "filestaticprefix", FLG_FILESTATICPREFIX, "set namespace prefix for file static declarations", "A file-static identifier does not start with the filestaticprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "filestaticprefixexclude", FLG_FILESTATICPREFIXEXCLUDE, "the filestaticprefix may not be used for identifiers that are not file static", "An identifier that is not file static starts with the filestaticprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "globalprefix", FLG_GLOBPREFIX, "set namespace prefix for global variables", "A global variable does not start with the globalprefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "globalprefixexclude", FLG_GLOBPREFIXEXCLUDE, "the globalprefix may not be used for non-global identifiers", "An identifier that is not a global variable starts with the globalprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "typeprefix", FLG_TYPEPREFIX, "set namespace prefix for user-defined types", "A user-defined type does not start with the typeprefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "typeprefixexclude", FLG_TYPEPREFIXEXCLUDE, "the typeprefix may not be used for identifiers that are not type names", "An identifier that is not a type name starts with the typeprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "externalprefix", FLG_EXTERNALPREFIX, "set namespace prefix for external identifiers", "An external identifier does not start with the externalprefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "externalprefixexclude", FLG_EXTERNALPREFIXEXCLUDE, "the externalprefix may not be used for non-external identifiers", "An identifier that is not external starts with the externalprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "localprefix", FLG_LOCALPREFIX, "set namespace prefix for local variables", "A local variable does not start with the localprefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "localprefixexclude", FLG_LOCALPREFIXEXCLUDE, "the localprefix may not be used for non-local identifiers", "An identifier that is not a local variable starts with the localprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "uncheckedmacroprefix", FLG_UNCHECKEDMACROPREFIX, "set namespace prefix for unchecked macros", "An unchecked macro name does not start with the uncheckedmacroprefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "uncheckedmacroprefixexclude", FLG_UNCHECKEDMACROPREFIXEXCLUDE, "the uncheckmacroprefix may not be used for identifiers that are not " "unchecked macros", "An identifier that is not the name of an unchecked macro " "starts with the uncheckedmacroprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "constprefix", FLG_CONSTPREFIX, "set namespace prefix for constants", "A constant does not start with the constantprefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "constprefixexclude", FLG_CONSTPREFIXEXCLUDE, "the constprefix may not be used for non-constant identifiers", "An identifier that is not a constant starts with the constantprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "iterprefix", FLG_ITERPREFIX, "set namespace prefix for iterators", "An iter does not start with the iterator prefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "iterprefixexclude", FLG_ITERPREFIXEXCLUDE, "the iterprefix may not be used for non-iter identifiers", "An identifier that is not a iter starts with the iterprefix.", 0, 0 } , { FK_NAMES, FK_PREFIX, idemStringFlag, ARG_STRING, "protoparamprefix", FLG_DECLPARAMPREFIX, "set namespace prefix for parameters in function prototype declarations", "A parameter name in a function prototype declaration does not start with the " "declaration parameter prefix", 0, 0 } , /* 12.3 Naming Restrictions */ { FK_NAMES, FK_ANSI, modeFlag, "isoreserved", FLG_ISORESERVED, "external name conflicts with name reserved for system or standard library", "External name is reserved for system use by ISO C99 standard.", 0, 0 }, { FK_NAMES, FK_ANSI, modeFlag, "cppnames", FLG_CPPNAMES, "external or internal name is a C++ keyword or reserved word", "External name is a C++ keyword or reserved word. " "This could lead to problems if the " "code is compiled with a C++ compiler.", 0, 0 }, { FK_NAMES, FK_ANSI, modeFlag, "isoreservedinternal", FLG_ISORESERVEDLOCAL, "internal name conflicts with name reserved for system or standard library", "Internal name is reserved for system in ISO C99 standard (this should not be necessary unless you are worried about C library implementations that violate the standard and use macros).", 0, 0 }, { FK_NAMES, FK_ANSI, plainFlag, "distinctexternalnames", FLG_DISTINCTEXTERNALNAMES, "external name is not distinguishable from another external name using " "the number of significant characters", "An external name is not distinguishable from another external name " "using the number of significant characters. According to " "ANSI Standard (3.1), an implementation may only consider the first 6 " "characters significant, and ignore alphabetical case " "distinctions (ISO C99 requires 31). The " "+externalnamelen flag may be used to change the number " "of significant characters, and -externalnamecaseinsensitive to make " "alphabetical case significant in external names.", 0, 0 }, { FK_NAMES, FK_ANSI, specialValueFlag, "externalnamelen", FLG_EXTERNALNAMELEN, "set the number of significant characters in an external name", "Sets the number of significant characters in an external name (default is 6 for old " "ANSI89 limit, C99 requires 31). " "Sets +distinctexternalnames.", 0, 0 }, { FK_NAMES, FK_ANSI, plainSpecialFlag, "externalnamecaseinsensitive", FLG_EXTERNALNAMECASEINSENSITIVE, "alphabetic comparisons for external names are case-insensitive", "Make alphabetic case insignificant in external names. By ANSI89 " "standard, case need not be significant in an external name. " "If +distinctexternalnames is not set, sets " "+distinctexternalnames with unlimited external name length.", 0, 0 }, { FK_NAMES, FK_ANSI, plainFlag, "distinctinternalnames", FLG_DISTINCTINTERNALNAMES, "internal name is not distinguishable from another internal name using " "the number of significant characters", "An internal name is not distinguishable from another internal name " "using the number of significant characters. According to " "ANSI89 Standard (3.1), an implementation may only consider the first 31 " "characters significant (ISO C99 specified 63). The " "+internalnamelen flag changes the number " "of significant characters, -internalnamecaseinsensitive to makes " "alphabetical case significant, and " "+internalnamelookalike to make similar-looking characters " "non-distinct.", 0, 0 }, { FK_NAMES, FK_ANSI, specialValueFlag, "internalnamelen", FLG_INTERNALNAMELEN, "set the number of significant characters in an internal name", "Sets the number of significant characters in an internal name (ANSI89 " "default is 31.) Sets +distinctinternalnames.", 0, 0 }, { FK_NAMES, FK_ANSI, plainSpecialFlag, "internalnamecaseinsensitive", FLG_INTERNALNAMECASEINSENSITIVE, "set whether case is significant an internal names " "(-internalnamecaseinsensitive means case is significant)" , "Set whether case is significant an internal names " "(-internalnamecaseinsensitive " "means case is significant). By ANSI89 default, case is not " "significant. If +distinctinternalnames is not set, sets " "+distinctinternalnames with unlimited internal name length.", 0, 0 }, { FK_NAMES, FK_ANSI, plainSpecialFlag, "internalnamelookalike", FLG_INTERNALNAMELOOKALIKE, "lookalike characters match in internal names", "Set whether similar looking characters (e.g., \"1\" and \"l\") " "match in internal names.", 0, 0 }, { FK_NAMES, FK_PREFIX, modeFlag, "protoparamname", FLG_DECLPARAMNAME, "a parameter in a function prototype has a name", "A parameter in a function prototype has a name. This is dangerous, " "since a macro definition could be visible here.", 0, 0 } , { FK_NAMES, FK_PREFIX, modeFlag, "protoparammatch", FLG_DECLPARAMMATCH, "the name of a parameter in a function prototype and corresponding " "declaration must match (after removing the protoparamprefix", "A parameter in a function definition does not have the same name as " "the corresponding in the declaration of the function after " "removing the protoparamprefix", 0, 0 } , { FK_NAMES, FK_PREFIX, plainFlag, "protoparamprefixexclude", FLG_DECLPARAMPREFIXEXCLUDE, "the protoparamprefix may not be used for non-declaraction parameter identifiers", "An identifier that is not a parameter name in a function prototype " "starts with the protoparamprefix.", 0, 0 } , /* ** 13. Completeness */ /* 13.1 Unused Declarations */ { FK_USE, FK_COMPLETE, modeFlag, "topuse", FLG_TOPUNUSED, "declaration at top level not used", "An external declaration not used in any source file.", 0, 0 }, { FK_USE, FK_EXPORT, modeFlag, "exportlocal", FLG_EXPORTLOCAL, "a declaration is exported but not used outside this module", "A declaration is exported, but not used outside this module. " "Declaration can use static qualifier.", 0, 0 }, { FK_USE, FK_EXPORT, modeFlag, "exportheader", FLG_EXPORTHEADER, "a declaration is exported but does not appear in a header file", "A declaration is exported, but does not appear in a header file.", 0, 0 }, { FK_USE, FK_EXPORT, modeFlag, "exportheadervar", FLG_EXPORTHEADERVAR, "a variable declaration is exported but does not appear in a header file", "A variable declaration is exported, but does not appear in a header " "file. (Used with exportheader.)", 0, 0 }, { FK_USE, FK_NONE, modeFlag, "fielduse", FLG_FIELDUNUSED, "field of structure type not used", "A field is present in a structure type but never used. Use /*@unused@*/ in front of field declaration to suppress message.", 0, 0 }, { FK_USE, FK_NONE, modeFlag, "enummemuse", FLG_ENUMMEMUNUSED, "member of an enum type not used", "A member of an enum type is never used.", 0, 0 }, { FK_USE, FK_NONE, modeFlag, "constuse", FLG_CONSTUNUSED, "constant declared but not used", "A constant is declared but not used. Use unused in the constant declaration to suppress message.", 0, 0 }, { FK_USE, FK_NONE, modeFlag, "fcnuse", FLG_FUNCUNUSED, "function declared but not used", "A function is declared but not used. Use /*@unused@*/ in front of function header to suppress message.", 0, 0 }, { FK_USE, FK_PARAMS, modeFlag, "paramuse", FLG_PARAMUNUSED, "function parameter not used ", "A function parameter is not used in the body of the function. If the argument is needed for type compatibility or future plans, use /*@unused@*/ in the argument declaration.", 0, 0 }, { FK_USE, FK_TYPE, modeFlag, "typeuse", FLG_TYPEUNUSED, "type declared but not used", "A type is declared but not used. Use /*@unused@*/ in front of typedef to suppress messages.", 0, 0 }, { FK_USE, FK_NONE, modeFlag, "varuse", FLG_VARUNUSED, "variable declared but not used", "A variable is declared but never used. Use /*@unused@*/ in front " "of declaration to suppress message.", 0, 0 }, { FK_USE, FK_COMPLETE, modeFlag, "unusedspecial", FLG_UNUSEDSPECIAL, "unused declaration in special file (corresponding to .l or .y file)", NULL, 0, 0 } , /* 13.2 Complete Programs */ { FK_COMPLETE, FK_NONE, modeFlag, "declundef", FLG_DECLUNDEF, "function or variable declared but never defined", "A function or variable is declared, but not defined in any source code file.", 0, 0 }, { FK_COMPLETE, FK_SPEC, modeFlag, "specundef", FLG_SPECUNDEF, "function or variable specified but never defined", "A function or variable is declared in an .lcl file, but not defined in any source code file.", 0, 0 }, { FK_COMPLETE, FK_SPEC, plainFlag, "specundecl", FLG_SPECUNDECL, "function or variable specified but never declared in a source file", "A function or variable is declared in an .lcl file, but not declared " "in any source code file.", 0, 0 }, { FK_DECL, FK_LIBS, plainFlag, "newdecl", FLG_NEWDECL, "report new global declarations in source files", "There is a new declaration that is not declared in a loaded library " "or earlier file. (Use this flag to check for consistency " "against a library.)", 0, 0 }, { FK_INIT, FK_SPEC, plainFlag, "needspec", FLG_NEEDSPEC, "information in specifications is not also included in syntactic comments", "There is information in the specification that is not duplicated " "in syntactic comments. Normally, this is not an " "error, but it may be useful to detect it to make " "sure checking incomplete systems without the specifications will " "still use this information.", 0, 0 }, /* ** 14. Libraries and Header File Inclusion */ /* 14.1 Standard Libraries */ { FK_LIBS, FK_INIT, idemGlobalFlag, "nolib", FLG_NOLIB, "do not load standard library", NULL, 0, 0 }, { FK_LIBS, FK_INIT, idemGlobalFlag, "isolib", FLG_ANSILIB, "use normal standard library", "Library based on the ISO standard library specification is used.", 0, 0 }, { FK_LIBS, FK_INIT, idemGlobalFlag, "strictlib", FLG_STRICTLIB, "interpret standard library strictly", "Stricter version of the standard library is used. (The default " "library is standard.lcd; strict library is strict.lcd.)", 0, 0 }, { FK_LIBS, FK_INIT, idemGlobalFlag, "unixlib", FLG_UNIXLIB, "use UNIX (sort-of) standard library", "UNIX version of the standard library is used.", 0, 0 }, { FK_LIBS, FK_INIT, idemGlobalFlag, "unixstrictlib", FLG_UNIXSTRICTLIB, "use strict version of UNIX (sort-of) library", "strict version of the UNIX library is used.", 0, 0 }, { FK_LIBS, FK_INIT, idemGlobalFlag, "posixlib", FLG_POSIXLIB, "use POSIX standard library", "POSIX version of the standard library is used.", 0, 0 }, { FK_LIBS, FK_INIT, idemGlobalFlag, "posixstrictlib", FLG_POSIXSTRICTLIB, "use strict POSIX standard library", "POSIX version of the strict standard library is used.", 0, 0 }, { FK_LIBS, FK_INIT, idemGlobalFlag, "whichlib", FLG_WHICHLIB, "show standard library filename", NULL, 0, 0 }, { FK_LIBS, FK_ANSI, plainFlag, "warnposixheaders", FLG_WARNPOSIX, "a POSIX header is included, but the POSIX library is not used", "Header name matches a POSIX header, but the POSIX library is not selected.", 0, 0 }, { FK_LIBS, FK_ANSI, plainFlag, "warnunixlib", FLG_WARNUNIXLIB, "warn when the unix library is used", "Unix library may not be compatible with all platforms", 0, 0 }, { FK_LIBS, FK_ANSI, plainFlag, "usevarargs", FLG_USEVARARGS, "non-standard included", "Header is not part of ANSI Standard. " "Should use instead.", 0, 0 }, { FK_HEADERS, FK_FILES, plainFlag, "caseinsensitivefilenames", FLG_CASEINSENSITIVEFILENAMES, "file names are case insensitive (file.h and FILE.H are the same file)", NULL, 0, 0 }, /* 14.2 Generating Libraries */ { FK_LIBS, FK_FILES, globalStringFlag, ARG_FILE, "dump", FLG_DUMP, "save state for merging (default suffix .lcd)", NULL, 0, 0 }, { FK_LIBS, FK_FILES, globalStringFlag, ARG_FILE, "load", FLG_MERGE, "load state from dump file (default suffix .lcd)", NULL, 0, 0 }, /* 14.3 Header File Inclusion */ { FK_HEADERS, FK_SPEED, globalFlag, "singleinclude", FLG_SINGLEINCLUDE, "optimize header inclusion to eliminate redundant includes", "When checking multiple files, each header file is processed only " "once. This may change the meaning of the code, if the " "same header file is included in different contexts (e.g., the " "header file includes #if directives and the values are " "different when it is included in different places.)", 0, 0 }, { FK_HEADERS, FK_SPEED, globalFlag, "neverinclude", FLG_NEVERINCLUDE, "optimize header inclusion to not include any header files", "Ignore header includes. Only works if relevant information is " "loaded from a library.", 0, 0 }, { FK_HEADERS, FK_SPEED, globalFlag, "skipsysheaders", FLG_SKIPSYSHEADERS, "do not include header files in system directories (set by -sysdirs)", "Do not include header files in system directories (set by -sysdirs)", 0, 0 }, /* ** A. Operation? */ /* ** Syntax */ { FK_SYNTAX, FK_ANSI, plainFlag, "gnuextensions", FLG_GNUEXTENSIONS, "support some gnu (gcc) language extensions", "ANSI C does not allow some language features supported by gcc and other compilers. " "Use +gnuextensions to allow some of these extensions.", 0, 0 }, /* Prototypes */ { FK_PROTOS, FK_ANSI, modeFlag, "noparams", FLG_NOPARAMS, "function declaration has no parameter list", "A function declaration does not have a parameter list.", 0, 0 }, { FK_PROTOS, FK_ANSI, modeFlag, "oldstyle", FLG_OLDSTYLE, "old style function definition", "Function definition is in old style syntax. Standard prototype " "syntax is preferred.", 0, 0 }, /* ** System functions */ { FK_SYSTEMFUNCTIONS, FK_TYPE, plainFlag, "maintype", FLG_MAINTYPE, "type of main does not match expected type", "The function main does not match the expected type.", 0, 0 }, { FK_SYSTEMFUNCTIONS, FK_BEHAVIOR, modeFlag, "exitarg", FLG_EXITARG, "argument to exit has implementation defined behavior", "The argument to exit should be 0, EXIT_SUCCESS or EXIT_FAILURE", 0, 0 }, { FK_DECL, FK_NONE, modeFlag, "shadow", FLG_SHADOW, "declaration reuses name visible in outer scope", "An outer declaration is shadowed by the local declaration.", 0, 0 }, { FK_DECL, FK_LIBS, modeFlag, "incondefslib", FLG_INCONDEFSLIB, "function, variable or constant defined in a library is redefined with inconsistent type", "A function, variable or constant previously defined in a library is " "redefined with a different type.", 0, 0 }, { FK_DECL, FK_LIBS, modeFlag, "overload", FLG_WARNOVERLOAD, "library function overloaded", "A function, variable or constant defined in the library is redefined " "with a different type.", 0, 0 }, { FK_DECL, FK_NONE, modeFlag, "nestedextern", FLG_NESTEDEXTERN, "an extern declaration is inside a function scope", "An extern declaration is used inside a function scope.", 0, 0 }, { FK_DECL, FK_NONE, modeFlag, "redecl", FLG_REDECL, "function or variable redeclared", "A function or variable is declared in more than one place. This is " "not necessarily a problem, since the declarations are consistent.", 0, 0 }, { FK_DECL, FK_NONE, plainFlag, "redef", FLG_REDEF, "function or variable redefined", "A function or variable is redefined. One of the declarations should use extern.", 0, 0 }, { FK_DECL, FK_TYPE, modeFlag, "imptype", FLG_IMPTYPE, "variable declaration has unknown (implicitly int) type", "A variable declaration has no explicit type. The type is implicitly int.", 0, 0 }, { FK_DIRECT, FK_FILES, globalStringFlag, ARG_DIRECTORY, "tmpdir", FLG_TMPDIR, "set directory for writing temp files", NULL, 0, 0 }, { FK_DIRECT, FK_FILES, globalStringFlag, ARG_PATH, "larchpath", FLG_LARCHPATH, "set path for searching for library files (overrides LARCH_PATH environment variable)", NULL, 0, 0 }, { FK_DIRECT, FK_FILES, globalStringFlag, ARG_DIRECTORY, "lclimportdir", FLG_LCLIMPORTDIR, "set directory to search for LCL import files (overrides LCLIMPORTDIR)", NULL, 0, 0 }, { FK_DIRECT, FK_FILES, globalStringFlag, ARG_PATH, "sysdirs", FLG_SYSTEMDIRS, "set directories for system files (default /usr/include). Separate " "directories with path separator (colons in Unix, semi-colons in Windows). " "Flag settings propagate to files in a system directory. If " "-sysdirerrors is set, no errors are reported for files in " "system directories.", NULL, 0, 0 }, { FK_DIRECT, FK_FILES, plainFlag, "skipisoheaders", FLG_SKIPISOHEADERS, "prevent inclusion of header files in a system directory with " "names that match standard ANSI headers. The symbolic information " "in the standard library is used instead. Flag in effect only " "if a library including the ANSI library is loaded. The ANSI " "headers are: assert, ctype, errno, float, limits, locale, math, " "setjmp, signal, stdarg, stddef, stdio, stdlib, strings, string, " "time, and wchar.", NULL, 0, 0 }, { FK_DIRECT, FK_FILES, plainFlag, "skipposixheaders", FLG_SKIPPOSIXHEADERS, "prevent inclusion of header files in a system directory with " "names that match standard POSIX headers. The symbolic information " "in the posix library is used instead. The POSIX headers are: " "dirent, fcntl, grp, pwd, termios, sys/stat, sys/times, " "sys/types, sys/utsname, sys/wait, unistd, and utime.", NULL, 0, 0 }, { FK_DIRECT, FK_SUPPRESS, modeFlag, "sysdirerrors", FLG_SYSTEMDIRERRORS, "report errors in files in system directories (set by -sysdirs)", NULL, 0, 0 }, { FK_DIRECT, FK_MACROS, plainFlag, "sysdirexpandmacros", FLG_SYSTEMDIREXPAND, "expand macros in system directories regardless of other settings, " "except for macros corresponding to names defined in a load library", NULL, 0, 0 }, { FK_DIRECT, FK_HEADERS, globalExtraArgFlag, "I", FLG_INCLUDEPATH, "add to C include path", NULL, 0, 0 }, { FK_DIRECT, FK_SPEC, globalExtraArgFlag, "S", FLG_SPECPATH, "add to spec path", NULL, 0, 0 }, { FK_EXPORT, FK_SPEC, specialFlag, "exportany", FLG_EXPORTANY, "variable, function or type exported but not specified", "A variable, function or type is exported, but not specified.", 0, 0 }, { FK_EXPORT, FK_SPEC, modeFlag, "exportfcn", FLG_EXPORTFCN, "function exported but not specified", "A function is exported, but not specified.", 0, 0 }, { FK_EXPORT, FK_SPEC, modeFlag, "exportmacro", FLG_EXPORTMACRO, "expanded macro exported but not specified", "A macro is exported, but not specified.", 0, 0 }, { FK_EXPORT, FK_SPEC, modeFlag, "exporttype", FLG_EXPORTTYPE, "type definition exported but not specified", "A type is exported, but not specified.", 0, 0 }, { FK_EXPORT, FK_SPEC, modeFlag, "exportvar", FLG_EXPORTVAR, "variable exported but not specified", "A variable is exported, but not specified.", 0, 0 }, { FK_EXPORT, FK_SPEC, modeFlag, "exportconst", FLG_EXPORTCONST, "constant exported but not specified", "A constant is exported, but not specified.", 0, 0 }, { FK_EXPORT, FK_SPEC, modeFlag, "exportiter", FLG_EXPORTITER, "constant exported but not specified", "A constant is exported, but not specified.", 0, 0 }, { FK_FORMAT, FK_DISPLAY, valueFlag, "linelen", FLG_LINELEN, "set length of messages (number of chars)", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, valueFlag, "indentspaces", FLG_INDENTSPACES, "set number of spaces to indent sub-messages", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, valueFlag, "locindentspaces", FLG_LOCINDENTSPACES, "set number of spaces to indent sub-messages that start with file locations", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, plainFlag, "showdeephistory", FLG_SHOWDEEPHISTORY, "show all available information about storage mentioned in warnings", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, plainFlag, "showcolumn", FLG_SHOWCOL, "show column number where error is found", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, plainFlag, "showloadloc", FLG_SHOWLOADLOC, "show location information for load files", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, globalFileFlag, "csv", FLG_CSV, "produce comma-separated values (CSV) warnings output file", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, plainFlag, "csvoverwrite", FLG_CSVOVERWRITE, "overwrite exisiting CVS output file", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, plainFlag, "parenfileformat", FLG_PARENFILEFORMAT, "show column number where error is found", NULL, 0, 0 }, { FK_FORMAT, FK_DISPLAY, plainFlag, "htmlfileformat", FLG_HTMLFILEFORMAT, "show file locations as links", NULL, 0, 0 }, { FK_FORMAT, FK_NONE, plainFlag, "showfunc", FLG_SHOWFUNC, "show name of function containing error", NULL, 0, 0 }, { FK_FORMAT, FK_NONE, plainFlag, "showallconjs", FLG_SHOWALLCONJS, "show all possible types", "When a library function is declared with multiple possible type, the " "alternate types are shown only if +showallconjs.", 0, 0 }, { FK_LIBS, FK_NONE, plainFlag, "impconj", FLG_IMPCONJ, "make all alternate types implicit (useful for making system libraries", NULL, 0, 0 } , { FK_GLOBAL, FK_ERRORS, globalValueFlag, "expect", FLG_EXPECT, "expect code errors", NULL, 0, 0 }, { FK_GLOBAL, FK_ERRORS, globalValueFlag, "lclexpect", FLG_LCLEXPECT, "expect spec errors", NULL, 0, 0 }, { FK_GLOBAL, FK_USE, idemSpecialFlag, "partial", FLG_PARTIAL, "check as partial system (-specundef, -declundef, -exportlocal, " "don't check macros in headers without corresponding .c files)", NULL, 0, 0 }, /* ** Appendix D. Specifications */ { FK_HEADERS, FK_SPEC, globalFlag, "lh", FLG_DOLH, "generate .lh files", NULL, 0, 0 }, { FK_HEADERS, FK_SPEC, globalFlag, "lcs", FLG_DOLCS, "generate .lcs files", NULL, 0, 0 }, /* ** 1. Operation */ { FK_HELP, FK_NONE, plainFlag, "warnflags", FLG_WARNFLAGS, "warn when command line sets flag in abnormal way", "Command line sets flag in abnormal way", 0, 0 }, { FK_HELP, FK_NONE, plainFlag, "warnrc", FLG_WARNRC, "warn when there are problems with reading the initialization files", "There was a problem reading an initialization file", 0, 0 }, { FK_HELP, FK_NONE, plainFlag, "badflag", FLG_BADFLAG, "warn about bad command line flags", "A flag is not recognized or used in an incorrect way", 0, 0 }, { FK_HELP, FK_NONE, plainFlag, "fileextensions", FLG_FILEEXTENSIONS, "warn when command line file does not have a recognized extension", NULL, 0, 0 }, { FK_HELP, FK_NONE, globalExtraArgFlag, "help", FLG_HELP, "-help will describe flags", "Display help", 0, 0 }, { FK_INIT, FK_FILES, globalFileFlag, "f", FLG_OPTF, "read an options file (default ~/.splintrc not loaded)", "Read an options file (instead of loading default ~/.splintc)", 0, 0 }, { FK_INIT, FK_FILES, globalFileFlag, "i", FLG_INIT, "set LCL initilization file", NULL, 0, 0 }, { FK_INIT, FK_FILES, globalFlag, "nof", FLG_NOF, "do not read options file", "Do not read the default options file (~/.splintrc)", 0, 0 }, { FK_INIT, FK_COMMENTS, charFlag, "commentchar", FLG_COMMENTCHAR, "set marker character for syntactic comments (default is '@')", "Set the marker character for syntactic comments. Comments beginning " "with /* are interpreted by Splint, where is the " "comment marker character.", 0, 0 }, /* ** Limits */ { FK_LIMITS, FK_ANSI, modeValueFlag, "controlnestdepth", FLG_CONTROLNESTDEPTH, "set maximum nesting depth of compound statements, iteration control " "structures, and selection control structures (ANSI89 minimum is 15; ISO99 is 63)", "Maximum number of control levels exceeded.", 0, 0 }, { FK_LIMITS, FK_ANSI, modeValueFlag, "stringliterallen", FLG_STRINGLITERALLEN, "set maximum length of string literals (ANSI89 minimum is 509; ISO99 is 4095)", "Maximum length of string literal exceeded.", 0, 0 }, { FK_LIMITS, FK_ANSI, modeValueFlag, "numstructfields", FLG_NUMSTRUCTFIELDS, "set maximum number of fields in a struct or union (ANSI89 minimum is 127; ISO99 is 1023)", "Maximum number of fields in a struct or union exceeded.", 0, 0 }, { FK_LIMITS, FK_ANSI, modeValueFlag, "numenummembers", FLG_NUMENUMMEMBERS, "set maximum number of members of an enum (ANSI89 minimum is 127; ISO99 is 1023)", "Limit on maximum number of members of an enum is exceeded.", 0, 0 }, { FK_LIMITS, FK_ANSI, modeValueFlag, "includenest", FLG_INCLUDENEST, "set maximum number of nested #include files (ANSI89 minimum is 8; ISO99 is 63)", "Maximum number of nested #include files exceeded.", 0, 0 }, { FK_LIMITS, FK_ANSI, specialFlag, "ansi89limits", FLG_ANSI89LIMITS, "check for violations of standard limits (controlnestdepth, " "stringliterallen, includenest, numstructfields, numenummembers) based on ANSI89 standard", NULL, 0, 0 }, { FK_LIMITS, FK_ANSI, specialFlag, "iso99limits", FLG_ISO99LIMITS, "check for violations of standard limits (controlnestdepth, " "stringliterallen, includenest, numstructfields, numenummembers) based on ISO99 standard", NULL, 0, 0 }, { FK_PREPROC, FK_NONE, globalExtraArgFlag, "D", FLG_DEFINE, "passed to pre-processor", NULL, 0, 0 }, { FK_PREPROC, FK_NONE, globalExtraArgFlag, "U", FLG_UNDEFINE, "passed to pre-processor", NULL, 0, 0 }, { FK_PREPROC, FK_SYNTAX, plainFlag, "unrecogdirective", FLG_UNRECOGDIRECTIVE, "unrecognized pre-processor directive", "Pre-processor directive is not recognized.", 0, 0 }, { FK_SUPPRESS, FK_COMMENTS, globalFlag, "supcounts", FLG_SUPCOUNTS, "The number of errors detected does not match number in /*@i@*/.", NULL, 0, 0 }, { FK_SUPPRESS, FK_ERRORS, valueFlag, "limit", FLG_LIMIT, "limit consecutive repeated errors", NULL, 0, 0 }, { FK_SYNTAX, FK_NONE, plainFlag, "syntax", FLG_SYNTAX, "syntax error in parsing", "Code cannot be parsed. For help on parse errors, see splint -help parseerrors.", 0, 0 }, { FK_SYNTAX, FK_NONE, plainFlag, "trytorecover", FLG_TRYTORECOVER, "try to recover from parse error", "Try to recover from parse error. It really means try - this doesn't usually work.", 0, 0 }, { FK_SYNTAX, FK_PREPROC, plainFlag, "preproc", FLG_PREPROC, "preprocessing error", "Preprocessing error.", 0, 0 }, { FK_TYPE, FK_NONE, plainFlag, "type", FLG_TYPE, "type mismatch", "Types are incompatible.", 0, 0 }, { FK_TYPE, FK_NONE, plainFlag, "stringliteraltoolong", FLG_STRINGLITTOOLONG, "string literal too long for character array", "A string literal is assigned to a char array too small to hold it.", 0, 0 }, { FK_TYPE, FK_NONE, modeFlag, "stringliteralnoroomfinalnull", FLG_STRINGLITNOROOMFINALNULL, "string literal leaves no room for null terminator", "A string literal is assigned to a char array that is not big enough to hold the final null terminator. This may not be a problem because a null character has been explictedly included in the string literal using an escape sequence", 0, 0 }, { FK_TYPE, FK_NONE, modeFlag, "stringliteralnoroom", FLG_STRINGLITNOROOM, "string literal leaves no room for null terminator", "A string literal is assigned to a char array that is not big enough to hold the null terminator.", 0, 0 }, { FK_TYPE, FK_NONE, modeFlag, "stringliteralsmaller", FLG_STRINGLITSMALLER, "string literal is smaller than the char array it is assigned to", "A string literal is assigned to a char array that smaller than the string literal needs.", 0, 0 }, { FK_TYPE, FK_NONE, modeFlag, "enummembers", FLG_ENUMMEMBERS, "enum members must be int values", "Type of initial values for enum members must be int.", 0, 0 }, { FK_TYPE, FK_NONE, plainFlag, "formattype", FLG_FORMATTYPE, "type-mismatch in parameter corresponding to format code in a printf or scanf-like function", "Type of parameter is not consistent with corresponding code in format string.", 0, 0 }, { FK_TYPE, FK_NONE, modeFlag, "formatconst", FLG_FORMATCONST, "format parameter is not a string constant (hence variable arguments cannot be typechecked)", "Format parameter is not known at compile-time. This can lead to security vulnerabilities because the arguments cannot be type checked.", 0, 0 }, { FK_TYPE, FK_NONE, plainFlag, "formatcode", FLG_FORMATCODE, "invalid format code in format string for printf or scanf-like function", "Format code in a format string is not valid.", 0, 0 }, { FK_TYPEEQ, FK_ABSTRACT, modeFlag, "forwarddecl", FLG_FORWARDDECL, "forward declarations of pointers to abstract representation match abstract type", NULL, 0, 0 }, { FK_TYPEEQ, FK_ABSTRACT, modeFlag, "voidabstract", FLG_ABSTVOIDP, "void * matches pointers to abstract types, casting ok (dangerous)", "A pointer to void is cast to a pointer to an abstract type (or vice versa).", 0, 0 }, { FK_TYPEEQ, FK_POINTER, plainFlag, "castfcnptr", FLG_CASTFCNPTR, "a pointer to a function is cast to a pointer to void (or vice versa)", "A pointer to a function is cast to (or used as) a pointer to void (or vice versa).", 0, 0 }, { FK_TYPEEQ, FK_ARRAY, modeFlag, "charindex", FLG_CHARINDEX, "char can be used to index arrays", "To allow char types to index arrays, use +charindex.", 0, 0 }, { FK_TYPEEQ, FK_ARRAY, modeFlag, "enumindex", FLG_ENUMINDEX, "enum can be used to index arrays", "To allow enum types to index arrays, use +enumindex.", 0, 0 }, { FK_TYPEEQ, FK_BOOL, modeFlag, "boolint", FLG_BOOLINT, "bool and int are equivalent", "To make bool and int types equivalent, use +boolint.", 0, 0 }, { FK_TYPEEQ, FK_NONE, modeFlag, "charint", FLG_CHARINT, "char and int are equivalent", "To make char and int types equivalent, use +charint.", 0, 0 }, { FK_TYPEEQ, FK_NONE, modeFlag, "enumint", FLG_ENUMINT, "enum and int are equivalent", "To make enum and int types equivalent, use +enumint.", 0, 0 }, { FK_TYPEEQ, FK_NONE, modeFlag, "longint", FLG_LONGINT, "long int and int are equivalent", "To make long int and int types equivalent, use +longint.", 0, 0 }, { FK_TYPEEQ, FK_NONE, modeFlag, "shortint", FLG_SHORTINT, "short int and int are equivalent", "To make short int and int types equivalent, use +shortint.", 0, 0 }, { FK_TYPEEQ, FK_NONE, modeFlag, "floatdouble", FLG_FLOATDOUBLE, "float and double are equivalent", "To make float and double types equivalent, use +floatdouble.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "ignorequals", FLG_IGNOREQUALS, "ignore type qualifiers (long, short, unsigned)", "To ignore type qualifiers in type comparisons use +ignorequals.", 0, 0 }, { FK_TYPEEQ, FK_SYNTAX, plainFlag, "duplicatequals", FLG_DUPLICATEQUALS, "report duplicate type qualifiers (e.g., unsigned unsigned)", "Duplicate type qualifiers not supported by ISO standard.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "ignoresigns", FLG_IGNORESIGNS, "ignore signs in type comparisons (unsigned matches signed)", "To ignore signs in type comparisons use +ignoresigns", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "numliteral", FLG_NUMLITERAL, "int literals can be reals", "An int literal is used as any numeric type (including float and long long). Use +numliteral to " "allow int literals to be used as any numeric type.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "charintliteral", FLG_CHARINTLITERAL, "character constants (e.g., 'a') can be used as ints", "A character constant is used as an int. Use +charintliteral to " "allow character constants to be used as ints. (This is safe " "since the actual type of a char constant is int.)", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "relaxquals", FLG_RELAXQUALS, "report qualifier mismatches only if dangerous", "To allow qualifier mismatches that are not dangerous, use +relaxquals.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "relaxtypes", FLG_RELAXTYPES, "allow all numeric types to match", "To allow all numeric types to match, use +relaxtypes.", 0, 0 }, { FK_TYPEEQ, FK_NONE, modeFlag, "charunsignedchar", FLG_CHARUNSIGNEDCHAR, "allow char and unsigned char types to match", "To allow char and unsigned char types to match use +charunsignedchar.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "matchanyintegral", FLG_MATCHANYINTEGRAL, "allow any intergral type to match an arbitrary integral type (e.g., dev_t)", "To allow arbitrary integral types to match any integral type, use +matchanyintegral.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "longunsignedintegral", FLG_LONGUNSIGNEDINTEGRAL, "allow long unsigned type to match an arbitrary integral type (e.g., dev_t)", "To allow arbitrary integral types to match long unsigned, use +longunsignedintegral.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "longintegral", FLG_LONGINTEGRAL, "allow long type to match an arbitrary integral type (e.g., dev_t)", "To allow arbitrary integral types to match long unsigned, use +longintegral.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "longunsignedunsignedintegral", FLG_LONGUNSIGNEDUNSIGNEDINTEGRAL, "allow long unsigned type to match an arbitrary unsigned integral type (e.g., size_t)", "To allow arbitrary unsigned integral types to match long unsigned, " "use +longunsignedunsignedintegral.", 0, 0 }, { FK_TYPEEQ, FK_NUMBERS, modeFlag, "longsignedintegral", FLG_LONGSIGNEDINTEGRAL, "allow long type to match an arbitrary signed integral type (e.g., ssize_t)", "To allow arbitrary signed integral types to match long unsigned, use +longsignedintegral.", 0, 0 }, { FK_TYPEEQ, FK_POINTER, plainFlag, "zeroptr", FLG_ZEROPTR, "treat 0 as a pointer", NULL, 0, 0 }, { FK_TYPEEQ, FK_BOOL, modeFlag, "zerobool", FLG_ZEROBOOL, "treat 0 as a boolean", NULL, 0, 0 }, { FK_UNRECOG, FK_DISPLAY, plainFlag, "repeatunrecog", FLG_REPEATUNRECOG, "do not suppress repeated unrecognized identifier messages (instead of only reporting the first error)", "Identifier used in code has not been declared. (Message repeated for future uses in this file.)", 0, 0 }, { FK_UNRECOG, FK_DISPLAY, plainFlag, "sysunrecog", FLG_SYSTEMUNRECOG, "report unrecognized identifiers with system (__) prefix", "Identifier used in code has not been declared. (Message repeated for " "future uses in this file.) Use +gnuextensions to make Splint " "recognize some keywords that are gnu extensions.", 0, 0 }, { FK_UNRECOG, FK_NONE, plainFlag, "unrecog", FLG_UNRECOG, "unrecognized identifier", "Identifier used in code has not been declared.", 0, 0 }, { FK_DECL, FK_TYPE, plainFlag, "annotationerror", FLG_ANNOTATIONERROR, "annotation is used in inconsistent location", "A declaration uses an invalid annotation.", 0, 0 } , { FK_DECL, FK_TYPE, plainFlag, "commenterror", FLG_COMMENTERROR, "inconsistent syntactic comment", "A syntactic comment is used inconsistently.", 0, 0 } , /* ** Use Warnings */ { FK_WARNUSE, FK_NONE, plainFlag, "warnuse", FLG_WARNUSE, "warn when declaration marked with warn is used", "Declaration marked with warn clause is used (can be suppresed by more specific flags).", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "bufferoverflow", FLG_BUFFEROVERFLOW, "possible buffer overflow vulnerability", "Use of function that may lead to buffer overflow.", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "bufferoverflowhigh", FLG_BUFFEROVERFLOWHIGH, "likely buffer overflow vulnerability", "Use of function that may lead to buffer overflow.", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "implementationoptional", FLG_IMPLEMENTATIONOPTIONAL, "declarator is implementation optional (ISO99 does not require an implementation to provide it)", "Use of a declarator that is implementation optional, not required by ISO99.", 0, 0 }, { FK_WARNUSE, FK_NONE, modeFlag, "legacy", FLG_LEGACY, "legacy declaration in Unix Standard", "Use of a declarator that is marked as a legacy entry in the Unix Standard.", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "multithreaded", FLG_MULTITHREADED, "function is not reentrant", "Non-reentrant function should not be used in multithreaded code.", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "portability", FLG_PORTABILITY, "function may have undefined behavior", "Use of function that may have implementation-dependent behavior.", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "superuser", FLG_SUPERUSER, "function is restricted to superusers", "Call to function restricted to superusers.", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "toctou", FLG_TOCTOU, "possible time of check, time of use vulnerability", "Possible time of check, time of use vulnerability.", 0, 0 }, { FK_WARNUSE, FK_SECURITY, modeFlag, "unixstandard", FLG_UNIXSTANDARD, "function is not required in Standard UNIX Specification", "Use of function that need not be provided by UNIX implementations", 0, 0 }, /* ** ITS4 Compability Flags ** ** These flags flags must appear in order (most severe -> weakest). */ { FK_ITS4, FK_SECURITY, specialFlag, "its4mostrisky", FLG_ITS4MOSTRISKY, "most risky security vulnerabilities (from its4 database)", "Security vulnerability classified as most risky in its4 database.", 0, 0 }, { FK_ITS4, FK_SECURITY, specialFlag, "its4veryrisky", FLG_ITS4VERYRISKY, "very risky security vulnerabilities (from its4 database)", "Security vulnerability classified as very risky in its4 database.", 0, 0 }, { FK_ITS4, FK_SECURITY, specialFlag, "its4risky", FLG_ITS4RISKY, "risky security vulnerabilities (from its4 database)", "Security vulnerability classified as risky in its4 database.", 0, 0 }, { FK_ITS4, FK_SECURITY, specialFlag, "its4moderate", FLG_ITS4MODERATERISK, "moderately risky security vulnerabilities (from its4 database)", "Security vulnerability classified as moderate risk in its4 database.", 0, 0 }, { FK_ITS4, FK_SECURITY, specialFlag, "its4low", FLG_ITS4LOWRISK, "risky security vulnerabilities (from its4 database)", "Security vulnerability classified as risky in its4 database.", 0, 0 }, /* ** Syntactic comments */ { FK_SYNCOMMENTS, FK_SUPPRESS, plainFlag, "nocomments", FLG_NOCOMMENTS, "ignore all stylized comments", NULL, 0, 0 }, { FK_SYNCOMMENTS, FK_ABSTRACT, plainFlag, "noaccess", FLG_NOACCESS, "ignore access comments", NULL, 0, 0 }, { FK_SYNCOMMENTS, FK_SYNTAX, plainFlag, "unrecogcomments", FLG_UNRECOGCOMMENTS, "stylized comment is unrecognized", "Word after a stylized comment marker does not correspond to a " "stylized comment.", 0, 0 }, { FK_SYNCOMMENTS, FK_SYNTAX, plainFlag, "unrecogflagcomments", FLG_UNRECOGFLAGCOMMENTS, "stylized flag comment uses an unrecognized flag", "Semantic comment attempts to set a flag that is not recognized.", 0, 0 }, { FK_SYNCOMMENTS, FK_SUPPRESS, modeFlag, "tmpcomments", FLG_TMPCOMMENTS, "interpret t comments (ignore errors in lines marked with /*@t@*/", NULL, 0, 0 }, { FK_SYNCOMMENTS, FK_SUPPRESS, plainFlag, "lintcomments", FLG_LINTCOMMENTS, "interpret traditional lint comments (/*FALLTHROUGH*/, /*NOTREACHED*/)", NULL, 0, 0 }, { FK_SYNCOMMENTS, FK_SUPPRESS, modeFlag, "warnlintcomments", FLG_WARNLINTCOMMENTS, "warn when a traditional lint comment is used", "A traditional lint comment is used. Some traditional lint comments " "are interpreted by Splint to enable easier checking of legacy " "code. It is preferable to replace these comments with the " "suggested Splint alternative.", 0, 0 }, /* ** Comments */ { FK_COMMENTS, FK_SYNTAX, plainFlag, "continuecomment", FLG_CONTINUECOMMENT, "line continuation marker (\\) in comment before */ on same line", "A line continuation marker (\\) appears inside a comment on the same " "line as the comment close. Preprocessors should handle this " "correctly, but it causes problems for some preprocessors.", 0, 0 }, { FK_COMMENTS, FK_SYNTAX, plainFlag, "slashslashcomment", FLG_SLASHSLASHCOMMENT, "use of // comment", "A // comment is used. ISO C99 allows // comments, but earlier standards did not.", 0, 0 }, { FK_COMMENTS, FK_SYNTAX, plainFlag, "nestcomment", FLG_NESTCOMMENT, "comment begins inside comment", "A comment open sequence (/*) appears within a comment. This usually " "means an earlier comment was not closed.", 0, 0 }, /* ** Flags for controlling warning message printing. */ /* Display */ { FK_DISPLAY, FK_ERRORS, plainFlag, "quiet", FLG_QUIET, "suppress herald and error count", NULL, 0, 0 }, /* ** Default is to send messages, warnings and errors to stderr */ { FK_DISPLAY, FK_ERRORS, idemGlobalFlag, "messagestreamstdout", FLG_MESSAGESTREAMSTDOUT, "send status messages to standard output stream", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, idemGlobalFlag, "messagestreamstderr", FLG_MESSAGESTREAMSTDERR, "send status messages to standard error stream", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, globalStringFlag, ARG_FILE, "messagestream", FLG_MESSAGESTREAM, "send status messages to ", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, idemGlobalFlag, "warningstreamstdout", FLG_WARNINGSTREAMSTDOUT, "send warnings to standard output stream", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, idemGlobalFlag, "warningstreamstderr", FLG_WARNINGSTREAMSTDERR, "send warnings to standard error stream", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, globalStringFlag, ARG_FILE, "warningstream", FLG_WARNINGSTREAM, "send warnings to ", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, idemGlobalFlag, "errorstreamstdout", FLG_ERRORSTREAMSTDOUT, "send fatal errors to standard output stream", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, idemGlobalFlag, "errorstreamstderr", FLG_ERRORSTREAMSTDERR, "send fatal errors to standard error stream", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, globalStringFlag, ARG_FILE, "errorstream", FLG_ERRORSTREAM, "send fatal errors to ", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, globalFlag, "streamoverwrite", FLG_STREAMOVERWRITE, "warn and exit if a stream output file would overwrite an existing file", NULL, 0, 0 }, { FK_DISPLAY, FK_ERRORS, plainFlag, "showsummary", FLG_SHOWSUMMARY, "show summary of all errors reported and suppressed", NULL, 0, 0 }, { FK_DISPLAY, FK_FILES, plainFlag, "showscan", FLG_SHOWSCAN, "show file names are they are processed", NULL, 0, 0 }, { FK_DISPLAY, FK_FILES, plainFlag, "warnsysfiles", FLG_WARNSYSFILES, "Splint has been run on a system file, by default no errors are reported for system files. Use +systemdirerrors if you want splint to report errors in system files. A file is considered a system file if it is in a system directory or a subdirectory of a system directory. The sysdirs flag can be used to control the directories treated as system directories.", NULL, 0, 0 }, { FK_DISPLAY, FK_NONE, globalFlag, "stats", FLG_STATS, "display lines processed and time", NULL, 0, 0 }, { FK_DISPLAY, FK_NONE, globalFlag, "timedist", FLG_TIMEDIST, "display time distribution", NULL, 0, 0 }, { FK_DISPLAY, FK_USE, globalFlag, "showalluses", FLG_SHOWUSES, "show sorted list of uses of all globals", NULL, 0, 0 }, /* Hints */ { FK_HINTS, FK_FORMAT, plainFlag, "hints", FLG_HINTS, "provide a hint the first time a particular warning appears", "Provide a hint the first time a particular warning appears", 0, 0 }, { FK_HINTS, FK_FORMAT, plainFlag, "forcehints", FLG_FORCEHINTS, "provide a hint for every warnings", "Provide a hint for every warning", 0, 0 }, /* ** Flags for debugging */ { FK_DEBUG, FK_NONE, valueFlag, "bugslimit", FLG_BUGSLIMIT, "set maximum number of bugs detected before giving up", NULL, 0, 0 }, { FK_DEBUG, FK_BOUNDS, plainFlag, "debugfcnconstraint", FLG_DEBUGFUNCTIONCONSTRAINT, "debug function constraints", "Perform buffer overflow checking even if the errors would be surpressed.", 0, 0 }, { FK_DEBUG, FK_NONE, specialDebugFlag, "grammar", FLG_GRAMMAR, "debug parsing", NULL, 0, 0 }, { FK_DEBUG, FK_NONE, debugFlag, "keep", FLG_KEEP, "do not delete temporary files", NULL, 0, 0 }, { FK_DEBUG, FK_NONE, debugFlag, "nopp", FLG_NOPP, "do not pre-process input files", NULL, 0, 0 }, { FK_DEBUG, FK_NONE, debugFlag, "showsourceloc", FLG_SHOWSOURCELOC, "display the source code location where a warning is produced", NULL, 0, 0 }, } ; splint-3.1.2.dfsg1/src/cscanner.l0000644021234200000250000005502007706100770014211 0ustar fax/*;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: splint@cs.virginia.edu ** To report a bug: splint-bug@cs.virginia.edu ** For more information: http://www.splint.org */ /* ** cscanner.l ** ** Flex lexer for C. ** Based on a C lexer by Nate Osgood ** from hacrat@catfish.lcs.mit.edu Mon Jun 14 13:06:32 1993 */ /* ** Modified by Herbert 08/19/97: ** - added #include for IBM's OS/2 compiler. ** - fixed weird bug with lookup of tmp files (OS/2 and MSDOS only). */ /* ** Modified by Mike Smith ** Corrected missing 'line' in scanf() calls in handleSpecial(). ** Without this, I get an error when Splint hits a '#line' directive ** in the pre-pre-processed source files. For safety, I have made these ** conditional on OS2 and MSDOS because I don't understand why noone else ** has seen this problem. ** ** Modified by Mike Smith, 4th June 1997 ** Finally resolved the #line problem. The scanf() calls have been fixed to ** allow the following #line forms:- ** ** #line 123 "filename" ** #line 123 ** # 123 "filename" ** # 123 ** ** The last two are generated by the GNU pre-processor, apparently */ Digit [0-9] Letter [a-zA-Z_$] H [a-fA-F0-9] E [Ee][+-]?{Digit}+ U (u|U) L (l|L) FS (f|F|l|L) IS (u|U|l|L)* ULSuffix ({U}{L}|{L}{U}) %{ # include "splintMacros.nf" # if defined(OS2) && defined(__IBMC__) /* needed for isatty()... */ # include # else /* ** Win32 doesn't have unistd.h */ # ifndef WIN32 # include # endif # endif # include "basic.h" # include "cscannerHelp.h" # include "cgrammar.h" # include "cgrammar_tokens.h" # include "osd.h" /*@notfunction@*/ # define yyinput() (incColumn (), getc (yyin)) # include "flex.head" %} %% "/*" { llfatalerror (cstring_makeLiteral ("Comment in pre-processor output")); } "#"{Letter}({Letter}|{Digit})* { context_saveLocation (); cscannerHelp_setTokLength (longUnsigned_toInt (mstring_length (yytext))); if (cscannerHelp_processHashIdentifier (cscannerHelp_makeIdentifier (yytext + 1))) { return cscannerHelp_returnString (cstring_makeLiteral ("\"\"")); } else { if (cscannerHelp_handleSpecial (yytext)) { cscannerHelp_setTokLength (1); return cscannerHelp_returnToken (0); } } } "#" { if (cscannerHelp_handleSpecial (yytext)) { cscannerHelp_setTokLength (1); return cscannerHelp_returnToken (0); } } "..." { cscannerHelp_setTokLength (3); return cscannerHelp_returnToken (CTOK_ELIPSIS); } "break" { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (BREAK); } "case" { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (CASE); } "continue" { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (CONTINUE); } "default" { cscannerHelp_setTokLength (7); return cscannerHelp_returnToken (DEFAULT); } "do" { cscannerHelp_setTokLength (2); return cscannerHelp_returnToken (DO); } "else" { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (CELSE); } "for" { cscannerHelp_setTokLength (3); return cscannerHelp_returnToken (CFOR); } "goto" { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (GOTO); } "if" { cscannerHelp_setTokLength (2); return cscannerHelp_returnToken (CIF); } "return" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (RETURN); } "sizeof" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (CSIZEOF); } "offsetof" { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (COFFSETOF); } "switch" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (SWITCH); } "while" { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (WHILE); } "va_arg" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (VA_ARG); } "va_dcl" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (VA_DCL); } "inline" { /* gcc extension...this might not be appropriate */ cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QINLINE); } "struct" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (CSTRUCT); } "typedef" { cscannerHelp_setTokLength (7); return cscannerHelp_returnToken (CTYPEDEF); } "union" { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (CUNION); } "enum" { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (CENUM); } "void" { cscannerHelp_setTokLength (4); return cscannerHelp_returnType (CVOID, ctype_void); } "int" { cscannerHelp_setTokLength (3); return cscannerHelp_returnType (CINT, ctype_int); } "double" { cscannerHelp_setTokLength (6); return cscannerHelp_returnType (CDOUBLE, ctype_double); } "char" { cscannerHelp_setTokLength (4); return cscannerHelp_returnType (CGCHAR, ctype_char); } "float" { cscannerHelp_setTokLength (5); return cscannerHelp_returnType (CGFLOAT, ctype_float); } "long" { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (QLONG); } "short" { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (QSHORT); } "unsigned" { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QUNSIGNED); } "signed" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QSIGNED); } "volatile" { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QVOLATILE); } "const" { cscannerHelp_setTokLength (5); return cscannerHelp_returnToken (QCONST); } "restrict" { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QRESTRICT); } /* some systems expect this! [gack!] */ "__const" { cscannerHelp_setTokLength (7); return cscannerHelp_returnToken (QCONST); } "extern" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QEXTERN); } "auto" { cscannerHelp_setTokLength (4); return cscannerHelp_returnToken (QAUTO); } "register" { cscannerHelp_setTokLength (8); return cscannerHelp_returnToken (QREGISTER); } "static" { cscannerHelp_setTokLength (6); return cscannerHelp_returnToken (QSTATIC); } \"(\\.|[^\\"])*\"([ \t\n]*\"(\\.|[^\\"])*\")* { return cscannerHelp_returnExpr (cscannerHelp_processString ()); } L\"(\\.|[^\\"])*\"([ \t\n]*\"(\\.|[^\\"])*\")* { return cscannerHelp_returnExpr (cscannerHelp_processWideString ()); } "out" { return (cscannerHelp_processSpec (QOUT)); } "in" { return (cscannerHelp_processSpec (QIN)); } "partial" { return (cscannerHelp_processSpec (QPARTIAL)); } "special" { return (cscannerHelp_processSpec (QSPECIAL)); } "anytype" { return (cscannerHelp_processSpec (QANYTYPE)); } "integraltype" { return (cscannerHelp_processSpec (QINTEGRALTYPE)); } "unsignedintegraltype" { return (cscannerHelp_processSpec (QUNSIGNEDINTEGRALTYPE)); } "signedintegraltype" { return (cscannerHelp_processSpec (QSIGNEDINTEGRALTYPE)); } "keep" { return (cscannerHelp_processSpec (QKEEP)); } "null" { return (cscannerHelp_processSpec (QNULL)); } "notnull" { return (cscannerHelp_processSpec (QNOTNULL)); } "isnull" { return (cscannerHelp_processSpec (QISNULL)); } "truenull" { return (cscannerHelp_processSpec (QTRUENULL)); } "falsenull" { return (cscannerHelp_processSpec (QFALSENULL)); } "nullwhentrue" { return (cscannerHelp_processSpec (QTRUENULL)); } "nullwhenfalse" { return (cscannerHelp_processSpec (QFALSENULL)); } "relnull" { return (cscannerHelp_processSpec (QRELNULL)); } "reldef" { return (cscannerHelp_processSpec (QRELDEF)); } "exposed" { return (cscannerHelp_processSpec (QEXPOSED)); } "newref" { return (cscannerHelp_processSpec (QNEWREF)); } "tempref" { return (cscannerHelp_processSpec (QTEMPREF)); } "killref" { return (cscannerHelp_processSpec (QKILLREF)); } "refcounted" { return (cscannerHelp_processSpec (QREFCOUNTED)); } "checked" { return (cscannerHelp_processSpec (QCHECKED)); } "checkmod" { return (cscannerHelp_processSpec (QCHECKMOD)); } "checkedstrict" { return (cscannerHelp_processSpec (QCHECKEDSTRICT)); } "unchecked" { return (cscannerHelp_processSpec (QUNCHECKED)); } "only" { return (cscannerHelp_processSpec (QONLY)); } "owned" { return (cscannerHelp_processSpec (QOWNED)); } "observer" { return (cscannerHelp_processSpec (QOBSERVER)); } "dependent" { return (cscannerHelp_processSpec (QDEPENDENT)); } "unused" { return (cscannerHelp_processSpec (QUNUSED)); } "external" { return (cscannerHelp_processSpec (QEXTERNAL)); } "sef" { return (cscannerHelp_processSpec (QSEF)); } "shared" { return (cscannerHelp_processSpec (QSHARED)); } "yield" { return (cscannerHelp_processSpec (QYIELD)); } "undef" { return (cscannerHelp_processSpec (QUNDEF)); } "killed" { return (cscannerHelp_processSpec (QKILLED)); } "nullterminated" { return (cscannerHelp_processSpec (QNULLTERMINATED));} "MaxSet" { return (cscannerHelp_processSpec (QMAXSET));} "MaxRead" { return (cscannerHelp_processSpec (QMAXREAD));} "maxSet" { return (cscannerHelp_processSpec (QMAXSET));} "maxRead" { return (cscannerHelp_processSpec (QMAXREAD));} {Letter}({Letter}|{Digit})* { int tok = cscannerHelp_processTextIdentifier (yytext); if (tok != BADTOK) { return (tok); } } 0[xX]{H}+ { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_int, cscannerHelp_processHex ()); /* evs 2000-05-17 was ctype_uint */ } 0[xX]{H}+{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_lint, cscannerHelp_processHex ()); } 0[xX]{H}+{L}{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_llint, cscannerHelp_processHex ()); } 0[xX]{H}+{U} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_uint, cscannerHelp_processHex ()); } 0[xX]{H}+{ULSuffix} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ulint, cscannerHelp_processHex ()); } 0[xX]{H}+{U}{L}{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processHex ()); } 0[xX]{H}+{L}{L}{U} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processHex ()); } 0{Digit}+ { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_int, cscannerHelp_processOctal ()); } 0{Digit}+{U} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_uint, cscannerHelp_processOctal ()); } 0{Digit}+{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_lint, cscannerHelp_processOctal ()); } 0{Digit}+{L}{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_llint, cscannerHelp_processOctal ()); } 0{Digit}+{ULSuffix} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ulint, cscannerHelp_processOctal ()); } 0{Digit}+{U}{L}{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processOctal ()); } 0{Digit}+{L}{L}{U} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processOctal ()); } {Digit}+ { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_int, cscannerHelp_processDec ()); } {Digit}+{U} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_uint, cscannerHelp_processDec ()); } {Digit}+{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_lint, cscannerHelp_processDec ()); } {Digit}+{L}{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_llint, cscannerHelp_processDec ()); } {Digit}+{ULSuffix} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ulint, cscannerHelp_processDec ()); } {Digit}+{U}{L}{L} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processDec ()); } {Digit}+{L}{L}{U} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnInt (ctype_ullint, cscannerHelp_processDec ()); } '(\\.|[^\\'])+' { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnChar (cscannerHelp_processChar ()); } L'(\\.|[^\\'])+' { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnChar (cscannerHelp_processChar ()); } {Digit}+{E}[fF] { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_float, cscannerHelp_processFloat ()); } {Digit}+{E}[lL] { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_ldouble, cscannerHelp_processFloat ()); } {Digit}+{E} { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_double, cscannerHelp_processFloat ()); } {Digit}*"."{Digit}+({E})?[fF] { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_float, cscannerHelp_processFloat ()); } {Digit}*"."{Digit}+({E})?[lL] { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_ldouble, cscannerHelp_processFloat ()); } {Digit}*"."{Digit}+({E})? { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_double, cscannerHelp_processFloat ()); } {Digit}+"."{Digit}*({E})?[fF] { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_float, cscannerHelp_processFloat ()); } {Digit}+"."{Digit}*({E})?[lL] { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_ldouble, cscannerHelp_processFloat ()); } {Digit}+"."{Digit}*({E})? { cscannerHelp_setTokLengthT (mstring_length (yytext)); return cscannerHelp_returnFloat (ctype_double, cscannerHelp_processFloat ()); } ">>=" { return cscannerHelp_returnTokenLength (RIGHT_ASSIGN, 3); } "<<=" { return cscannerHelp_returnTokenLength (LEFT_ASSIGN, 3); } "+=" { return cscannerHelp_returnTokenLength (ADD_ASSIGN, 2); } "-=" { return cscannerHelp_returnTokenLength (SUB_ASSIGN, 2); } "*=" { return cscannerHelp_returnTokenLength (MUL_ASSIGN, 2); } "/=" { return cscannerHelp_returnTokenLength (DIV_ASSIGN, 2); } "%=" { return cscannerHelp_returnTokenLength (MOD_ASSIGN, 2); } "&=" { return cscannerHelp_returnTokenLength (AND_ASSIGN, 2); } "^=" { return cscannerHelp_returnTokenLength (XOR_ASSIGN, 2); } "|=" { return cscannerHelp_returnTokenLength (OR_ASSIGN, 2); } ">>" { return cscannerHelp_returnTokenLength (RIGHT_OP, 2); } "<<" { return cscannerHelp_returnTokenLength (LEFT_OP, 2); } "++" { return cscannerHelp_returnTokenLength (INC_OP, 2); } "--" { return cscannerHelp_returnTokenLength (DEC_OP, 2); } "->" { return cscannerHelp_returnTokenLength (ARROW_OP, 2); } "&&" { return cscannerHelp_returnTokenLength (AND_OP, 2); } "||" { return cscannerHelp_returnTokenLength (OR_OP, 2); } "/\\" { return cscannerHelp_returnTokenLength (TCAND, 2); } "<=" { return cscannerHelp_returnTokenLength (LE_OP, 2); } ">=" { return cscannerHelp_returnTokenLength (GE_OP, 2); } "==" { return cscannerHelp_returnTokenLength (EQ_OP, 2); } "!=" { return cscannerHelp_returnTokenLength (NE_OP, 2); } ";" { return cscannerHelp_returnTokenLength (TSEMI, 1); } "{" { return cscannerHelp_returnTokenLength (TLBRACE, 1); } "}" { return cscannerHelp_returnTokenLength (TRBRACE, 1); } "," { return cscannerHelp_returnTokenLength (TCOMMA, 1); } ":" { return cscannerHelp_returnTokenLength (TCOLON, 1); } "=" { return cscannerHelp_returnTokenLength (TASSIGN, 1); } "(" { return cscannerHelp_returnTokenLength (TLPAREN, 1); } ")" { return cscannerHelp_returnTokenLength (TRPAREN, 1); } "[" { return cscannerHelp_returnTokenLength (TLSQBR, 1); } "]" { return cscannerHelp_returnTokenLength (TRSQBR, 1); } "." { return cscannerHelp_returnTokenLength (TDOT, 1); } "&" { return cscannerHelp_returnTokenLength (TAMPERSAND, 1); } "!" { return cscannerHelp_returnTokenLength (TEXCL, 1); } "~" { return cscannerHelp_returnTokenLength (TTILDE, 1); } "-" { return cscannerHelp_returnTokenLength (TMINUS, 1); } "+" { return cscannerHelp_returnTokenLength (TPLUS, 1); } "*" { return cscannerHelp_returnTokenLength (TMULT, 1); } "/" { return cscannerHelp_returnTokenLength (TDIV, 1); } "%" { return cscannerHelp_returnTokenLength (TPERCENT, 1); } "<" { return cscannerHelp_returnTokenLength (TLT, 1); } ">" { return cscannerHelp_returnTokenLength (TGT, 1); } "^" { return cscannerHelp_returnTokenLength (TCIRC, 1); } "|" { return cscannerHelp_returnTokenLength (TBAR, 1); } "?" { return cscannerHelp_returnTokenLength (TQUEST, 1); } [ \t\v\f] { incColumn (); } \n { int tok = cscannerHelp_handleNewLine (); if (tok != BADTOK) return tok; } "@@MR@@" { cscannerHelp_setTokLength (6); if (cscannerHelp_processMacro ()) { if (context_inIterDef ()) { return cscannerHelp_returnToken (LLMACROITER); } if (context_inIterEnd ()) { return cscannerHelp_returnToken (LLMACROEND); } if (context_inMacro ()) { return cscannerHelp_returnToken (LLMACRO); } } } "@QLMR" { if (context_inHeader () || context_inFunction ()) { cscannerHelp_handleMacro (); } else { int nspchar = cscannerHelp_ninput (); int nspaces; /* ** This is a hack to get the column number correct. */ llassert (nspchar >= '0' && nspchar <= '9'); nspaces = nspchar - '0'; cscannerHelp_setTokLength (5 + nspaces); if (cscannerHelp_processMacro ()) { DPRINTF (("Here we are: %s", context_unparse ())); if (context_inIterDef ()) { return cscannerHelp_returnToken (LLMACROITER); } if (context_inIterEnd ()) { return cscannerHelp_returnToken (LLMACROEND); } if (context_inMacro ()) { return cscannerHelp_returnToken (LLMACRO); } } } } "@.CT" { cscannerHelp_setTokLength (4); lldiagmsg (ctype_unparseTable ()); } "@.FA" { cscannerHelp_setTokLength (4); lldiagmsg (message ("Access types: %q", typeIdSet_unparse (context_fileAccessTypes ()))); } "@.F" { cscannerHelp_setTokLength (3); lldiagmsg (message ("%q: *** marker ***", fileloc_unparse (g_currentloc))); } "@.L" { cscannerHelp_setTokLength (3); usymtab_printLocal (); } "@.A" { cscannerHelp_setTokLength (3); lldiagmsg (usymtab_unparseAliases ()); } "@.C" { cscannerHelp_setTokLength (3); lldiagmsg (context_unparse ()); } "@.W" { cscannerHelp_setTokLength (3); lldiagmsg (context_unparseClauses ()); } "@.G" { cscannerHelp_setTokLength (3); usymtab_printGuards (); } "@.S" { cscannerHelp_setTokLength (3); usymtab_printOut (); } "@.X" { cscannerHelp_setTokLength (3); usymtab_printAll (); } "@.Z" { cscannerHelp_setTokLength (3); usymtab_printComplete (); } "@.T" { cscannerHelp_setTokLength (3); usymtab_printTypes (); } "@.K" { cscannerHelp_setTokLength (3); lldiagmsg (usymtab_unparseStack ()); } "@.R" { cscannerHelp_setTokLength (3); return cscannerHelp_returnToken (QDREVEALSTATE); } "@.M" { cscannerHelp_setTokLength (3); lldiagmsg (message ("Can modify: %q", sRefSet_unparse (context_modList ()))); } "%{" { /* BEFORE_COMMENT_MARKER */ int tok; incColumn (); incColumn (); tok = cscannerHelp_handleLlSpecial (); if (tok != BADTOK) { if (tok == CANNOTATION) { return (tok); } else { /* Beware - this bashes yylval! */ return cscannerHelp_returnToken (tok); } } } "%}" { /* AFTER_COMMENT_MARKER */ cscannerHelp_setTokLength (2); cscannerHelp_exitSpecPart (); return cscannerHelp_returnToken (QENDMACRO); } "\\" { incColumn (); cscannerHelp_setContinueLine (); } . { incColumn (); if ((int) *yytext == 13 ) { ; } else { voptgenerror (FLG_SYNTAX, message ("Invalid character (ascii: %d), skipping character", (int)(*yytext)), g_currentloc); } } %% /* ** These need to go here, after flex-generated code defined input and unput. */ int cscanner_input (void) { return input (); /* input is a static procedure defined by flex-generated code */ } void cscanner_unput (int c) { unput (c); /* unput is a static procedure defined by flex-generated code */ } splint-3.1.2.dfsg1/src/flex.head0000644021234200000250000000270407536414703014027 0ustar fax/* ** Inserted at beginning of c files generated by flex ** REMEMBER: Change flex.reset too. */ /*@-allmacros@*/ /*@-pred@*/ /*@-globstate@*/ /*@-null@*/ /*@+boolint@*/ /*@+charint@*/ /*@-macrospec@*/ /*@-macroredef@*/ /*@-exitarg@*/ /*@-compdef@*/ /*@-uniondef@*/ /*@+ignorequals@*/ /*@-noreturn@*/ /*@-mustfree@*/ /*@-compdestroy@*/ /*@-branchstate@*/ /*@-unreachable@*/ /*@-varuse@*/ /*@-fcnuse@*/ /*@-exportlocal@*/ /*@-evalorderuncon@*/ /*@-exportheader@*/ /*@-redecl@*/ /*@-loopswitchbreak@*/ /*@-switchswitchbreak@*/ /*@-sizeoftype@*/ /*@-czechfcns@*/ /*@-noparams@*/ /*@-ansireserved@*/ /*@-ifblock@*/ /*@-whileblock@*/ /*@-forblock@*/ /*@-elseifcomplete@*/ /*@+ptrnegate@*/ /*@-onlytrans@*/ /*@-temptrans@*/ /*@-immediatetrans@*/ /*@-namechecks@*/ /*@+matchanyintegral@*/ /*@-statictrans@*/ /*@-compmempass@*/ /*@-forempty@*/ /*@-evalorder@*/ /*@-retalias@*/ /*@-dependenttrans@*/ /*@-noeffect@*/ /*@-protoparammatch@*/ /*@-casebreak@*/ /*@-retvalother@*/ /*@-exportheader@*/ /*drl added 11/27/2001*/ # ifdef __LCLINT__ /*@-redecl@*/ /*@-type@*/ extern int lsllex (void); /*@=redecl@*/ /*@=type@*/ /* ** Need to do this because ECHO is defined by the Posix library. ** flex shouldn't use it. */ /*@notfunction@*/ # define ECHO \ fwrite (yytext, yyleng, 1, yyout) # ifndef DEFFILENO extern /*@external@*/ int fileno (/* FILE *stream */); # define DEFFILENO # endif # endif # ifdef OSF # undef __GNUC__ # endif /*@-redecl@*/ /* < end of flex.head > */ splint-3.1.2.dfsg1/src/flex.reset0000644021234200000250000000156707421472760014256 0ustar fax/* ** Resets flags set by flex.head. */ /*@=allmacros@*/ /*@=pred@*/ /*@=globstate@*/ /*@=null@*/ /*@=boolint@*/ /*@=charint@*/ /*@=macrospec@*/ /*@=macroredef@*/ /*@=exitarg@*/ /*@=compdef@*/ /*@=uniondef@*/ /*@=ignorequals@*/ /*@=noreturn@*/ /*@=mustfree@*/ /*@=compdestroy@*/ /*@=branchstate@*/ /*@=unreachable@*/ /*@=varuse@*/ /*@=fcnuse@*/ /*@=exportlocal@*/ /*@=evalorderuncon@*/ /*@=exportheader@*/ /*@=redecl@*/ /*@=loopswitchbreak@*/ /*@=switchswitchbreak@*/ /*@=sizeoftype@*/ /*@=czechfcns@*/ /*@=noparams@*/ /*@=ansireserved@*/ /*@=ifblock@*/ /*@=whileblock@*/ /*@=forblock@*/ /*@=elseifcomplete@*/ /*@=ptrnegate@*/ /*@=onlytrans@*/ /*@=temptrans@*/ /*@=immediatetrans@*/ /*@=namechecks@*/ /*@=matchanyintegral@*/ /*@=statictrans@*/ /*@=compmempass@*/ /*@=forempty@*/ /*@=evalorder@*/ /*@=retalias@*/ /*@=redecl@*/ /*@=retvalother@*/ # ifdef OSF # define __GNUC__ # endif splint-3.1.2.dfsg1/src/ctbase.i0000644021234200000250000020124707747261241013665 0ustar fax/* ;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: splint@cs.virginia.edu ** To report a bug: splint-bug@cs.virginia.edu ** For more information: http://www.splint.org */ /* ** ctbase.i ** ** NOTE: This is not a stand-alone source file, but is included in ctype.c. ** (This is necessary because there is no other way in C to have a ** hidden scope, besides at the file level.) */ /*@access cprim*/ abst_typedef /*@null@*/ struct s_ctbase *ctbase; /*@function static bool ctuid_isAnyUserType (sef ctuid p_cid) @*/ /*@-macrofcndecl@*/ /*@-macroparams@*/ # define ctuid_isAnyUserType(cid) \ ((cid) == CT_ABST || (cid) == CT_USER || (cid) == CT_NUMABST) /*@=macrofcndecl@*/ /*@=macroparams@*/ /*:private:*/ typedef struct { ctkind kind; ctbase ctbase; ctype base; /* type I point to (or element of array) */ ctype ptr; /* type of pointer to me */ ctype array; /* type of array of me */ cstring unparse; /* unparse me, if memoized */ } *ctentry ; typedef /*@only@*/ ctentry o_ctentry; typedef struct { int size; int nspace; /*@relnull@*/ /*@only@*/ o_ctentry *entries; /* memoize matches...maybe in context? */ } cttable ; extern bool ctentry_isBogus (/*@sef@*/ ctentry p_c) /*@*/; # define ctentry_isBogus(c) \ ((c)->kind == CTK_INVALID || (c)->kind == CTK_DNE) static cttable cttab = { 0, 0, NULL }; static /*@notnull@*/ /*@only@*/ ctbase ctbase_createAbstract (typeId p_u); static /*@notnull@*/ /*@only@*/ ctbase ctbase_createNumAbstract (typeId p_u); static /*@observer@*/ cstring ctentry_doUnparse (ctentry p_c) /*@modifies p_c@*/; static /*@only@*/ ctentry ctentry_make (ctkind p_ctk, /*@keep@*/ ctbase p_c, ctype p_base, ctype p_ptr, ctype p_array, /*@keep@*/ cstring p_unparse); static /*@only@*/ ctentry ctentry_makeNew (ctkind p_ctk, /*@only@*/ ctbase p_c); static /*@only@*/ cstring ctentry_unparse (ctentry p_c) /*@*/ ; static void cttable_grow (void); static ctype cttable_addDerived (ctkind p_ctk, /*@keep@*/ ctbase p_cnew, ctype p_base); static ctype cttable_addFull (/*@keep@*/ ctentry p_cnew); static bool ctentry_isInteresting (ctentry p_c) /*@*/; static /*@notnull@*/ /*@only@*/ ctbase ctbase_makeFixedArray (ctype p_b, size_t p_size) /*@*/ ; static bool ctbase_isAnytype (/*@notnull@*/ ctbase p_b) /*@*/ ; /* ** These are file-static macros (used in ctype.c). No way to ** declare them as static in C. */ /*@-allmacros@*/ /*@-macrospec@*/ /*@-namechecks@*/ # define ctentry_getBase(c) ((c)->base) # define ctentry_getKind(c) ((c)->kind) # define ctentry_getArray(c) ((c)->array) # define ctentry_getPtr(c) ((c)->ptr) # define ctentry_isArray(c) ((c)->kind == CTK_ARRAY) # define ctentry_isComplex(c) ((c)->kind == CTK_COMPLEX) # define ctentry_isPlain(c) ((c)->kind == CTK_PLAIN) # define ctentry_isPointer(c) ((c)->kind == CTK_PTR) # define ctentry_setArray(c,b) ((c)->array = (b)) # define ctentry_setPtr(c,b) ((c)->ptr = (b)) # define ctbase_fixUser(c) (c = ctbase_realType(c)) /*@=allmacros@*/ /*@=macrospec@*/ /*@=namechecks@*/ static ctype cttable_addComplex (/*@notnull@*/ /*@only@*/ ctbase p_cnew); static /*@observer@*/ ctbase ctype_getCtbase (ctype p_c) /*@*/ ; static ctype ctype_makeConjAux (ctype p_c1, ctype p_c2, bool p_isExplicit) /*@*/ ; static /*@notnull@*/ /*@observer@*/ ctbase ctype_getCtbaseSafe (ctype p_c) /*@*/ ; static /*@observer@*/ ctentry ctype_getCtentry (ctype p_c) /*@*/ ; static /*@observer@*/ /*@notnull@*/ ctbase ctbase_realType (/*@notnull@*/ ctbase p_c) /*@*/ ; static bool ctbase_isPointer (/*@notnull@*/ /*@dependent@*/ ctbase p_c) /*@*/ ; static bool ctbase_isEitherArray (/*@notnull@*/ /*@dependent@*/ ctbase p_c) /*@*/ ; static /*@observer@*/ enumNameList ctbase_elist (ctbase p_c) /*@*/ ; static /*@only@*/ cstring ctbase_unparse (ctbase p_c) /*@*/ ; static /*@only@*/ cstring ctbase_unparseDeep (ctbase p_c) /*@*/ ; static /*@only@*/ /*@notnull@*/ ctbase ctbase_copy (/*@notnull@*/ ctbase p_c) /*@*/ ; static void ctbase_free (/*@only@*/ ctbase p_c); static /*@notnull@*/ /*@only@*/ ctbase ctbase_createPrim (cprim p_p) /*@*/ ; static /*@notnull@*/ /*@only@*/ ctbase ctbase_createBool (void) /*@*/ ; static /*@notnull@*/ /*@observer@*/ ctbase ctbase_getBool (void) /*@*/ ; static /*@notnull@*/ /*@only@*/ ctbase ctbase_createUser (typeId p_u) /*@*/ ; static /*@notnull@*/ /*@only@*/ ctbase ctbase_createStruct (/*@only@*/ cstring p_n, /*@only@*/ uentryList p_f); static /*@notnull@*/ /*@only@*/ ctbase ctbase_createUnion (/*@keep@*/ cstring p_n, /*@only@*/ uentryList p_f); static /*@notnull@*/ /*@only@*/ ctbase ctbase_createEnum (/*@keep@*/ cstring p_etag, /*@keep@*/ enumNameList p_emembers); static /*@notnull@*/ /*@only@*/ ctbase ctbase_createUnknown (void); static bool ctbase_match (ctbase p_c1, ctbase p_c2) /*@modifies nothing@*/; static bool ctbase_matchDef (ctbase p_c1, ctbase p_c2) /*@modifies nothing@*/; static bool ctbase_genMatch (ctbase p_c1, ctbase p_c2, bool p_force, bool p_arg, bool p_def, bool p_deep); static bool ctbase_isAbstract (/*@notnull@*/ ctbase p_c) /*@*/ ; static /*@notnull@*/ /*@only@*/ ctbase ctbase_makePointer (ctype p_b) /*@*/ ; static /*@notnull@*/ /*@only@*/ ctbase ctbase_makeArray (ctype p_b) /*@*/ ; static /*@notnull@*/ ctype ctbase_makeFunction (ctype p_b, /*@only@*/ uentryList p_p) /*@*/ ; static /*@notnull@*/ /*@observer@*/ ctbase ctbase_realFunction (/*@notnull@*/ /*@dependent@*/ ctbase p_c) /*@*/ ; static ctype ctbase_baseArrayPtr (/*@notnull@*/ ctbase p_c) /*@*/ ; static ctype ctbase_baseFunction (/*@notnull@*/ ctbase p_c) /*@*/ ; static /*@observer@*/ uentryList ctbase_argsFunction (/*@notnull@*/ ctbase p_c) /*@*/ ; static /*@observer@*/ uentryList ctbase_getuentryList (/*@notnull@*/ ctbase p_c) /*@*/ ; static ctype ctbase_newBase (ctype p_c, ctype p_p) /*@*/ ; static ctype ctbase_newBaseExpFcn (ctype p_c, ctype p_p) /*@*/ ; static bool ctbase_isFixedArray (/*@notnull@*/ ctbase p_c) /*@*/ ; /*@-macroundef@*/ extern int cttable_lastIndex(); # define cttable_lastIndex() (cttab.size - 1) /*@=macroundef@*/ typedef struct { ctype rval; /*@only@*/ uentryList params; } *cfcn; typedef struct { cstring name; uentryList fields; } *tsu; typedef struct { ctype a; ctype b; bool isExplicit; } *tconj; typedef struct { cstring tag; enumNameList members; } *tenum; typedef struct { ctype base; size_t size; } *tfixed; typedef union { cprim prim; /* primitive */ typeId tid; /* abstract, user */ ctype base; /* ptr, array */ cfcn fcn; /* function */ tsu su; /* struct union */ tenum cenum; /* enum */ tconj conj; /* conj */ tfixed farray; /* fixed array */ } uconts; struct s_ctbase { ctuid type; uconts contents; } ; static /*@falsenull@*/ bool ctbase_isUA (ctbase p_c) /*@*/ ; static bool ctbase_isBaseUA(ctbase p_c) /*@*/ ; static typeId ctbase_typeBaseUid(ctbase p_c) /*@*/ ; static bool ctbase_isKind (/*@notnull@*/ ctbase p_c, ctuid p_kind) /*@*/ ; static bool ctbase_isKind2 (/*@notnull@*/ ctbase p_c, ctuid p_kind1, ctuid p_kind2) /*@*/ ; static /*@only@*/ /*@notnull@*/ ctbase ctbase_getBaseType (/*@notnull@*/ ctbase p_c) /*@*/ ; static /*@falsenull@*/ bool ctbase_isFunction(ctbase p_c) /*@*/ ; /*@constant null ctbase ctbase_undefined; @*/ # define ctbase_undefined ((ctbase)0) static /*@owned@*/ ctbase ctbase_bool = ctbase_undefined; static /*@owned@*/ ctbase ctbase_unknown = ctbase_undefined; static /*@falsenull@*/ bool ctbase_isDefined (ctbase c) /*@*/ { return ((c) != ctbase_undefined); } static /*@truenull@*/ bool ctbase_isUndefined (ctbase c) { return ((c) == ctbase_undefined); } static ctkind ctype_getCtKind (ctype c) { ctentry ce = ctype_getCtentry (c); return ctentry_getKind (ce); } static bool ctbase_isUser (ctbase c) { if (ctbase_isDefined (c)) { return (ctbase_isKind (c, CT_USER)); } else { return FALSE; } } static bool ctbase_isEnum (ctbase c) { if (ctbase_isDefined (c)) { return (ctbase_isKind (c, CT_ENUM)); } else { return FALSE; } } static bool ctbase_isExpFcn (ctbase c) { if (ctbase_isDefined (c)) { return (c->type == CT_EXPFCN); } else { return FALSE; } } static /*@falsenull@*/ bool ctbase_isConj (ctbase c) { if (ctbase_isDefined (c)) { return (c->type == CT_CONJ); } else { return FALSE; } } static bool ctuid_isAP (ctuid c) /*@*/ { return (c == CT_ARRAY || c == CT_PTR); } static typeId ctbase_typeId (ctbase p_c); static /*@only@*/ cstring ctbase_dump (ctbase p_c); static /*@only@*/ ctbase ctbase_undump (char **p_c) /*@requires maxRead(*p_c) >= 2 @*/; static int ctbase_compare (ctbase p_c1, ctbase p_c2, bool p_strict); static bool ctbase_matchArg (ctbase p_c1, ctbase p_c2); static /*@notnull@*/ /*@only@*/ ctbase ctbase_makeConj (ctype p_c1, ctype p_c2, bool p_isExplicit) /*@*/ ; static ctype ctbase_getConjA (/*@notnull@*/ ctbase p_c) /*@*/ ; static ctype ctbase_getConjB (/*@notnull@*/ ctbase p_c) /*@*/ ; static bool ctbase_isExplicitConj (/*@notnull@*/ ctbase p_c) /*@*/ ; static bool ctbase_forceMatch (ctbase p_c1, ctbase p_c2) /*@modifies p_c1, p_c2@*/ ; static /*@notnull@*/ /*@only@*/ ctbase ctbase_expectFunction (ctype p_c); static bool ctbase_isVoidPointer(/*@notnull@*/ /*@dependent@*/ ctbase p_c) /*@*/ ; static bool ctbase_isUnion (/*@notnull@*/ /*@temp@*/ ctbase p_c) /*@*/ ; static bool ctbase_isStruct (/*@notnull@*/ /*@temp@*/ ctbase p_c) /*@*/ ; static /*@observer@*/ cstring ctbase_enumTag (/*@notnull@*/ ctbase p_ct) /*@*/ ; static /*@only@*/ cstring ctbase_unparseNotypes (ctbase p_c) /*@*/ ; static /*@out@*/ /*@notnull@*/ /*@only@*/ ctbase ctbase_new (void) /*@*/ ; static int nctbases = 0; static /*@notnull@*/ /*@only@*/ ctbase ctbase_makeLiveFunction (ctype p_b, /*@only@*/ uentryList p_p); static bool ctbase_isUnnamedSU (ctbase c) { return (ctbase_isDefined (c) && (ctbase_isStruct (c) || ctbase_isUnion (c)) && isFakeTag (c->contents.su->name)); } static /*@observer@*/ ctbase ctbase_realType (ctbase c) { if (ctbase_isUA (c)) { typeId uid = ctbase_typeId (c); if (usymtab_isBoolType (uid)) { return ctbase_getBool (); } else { ctbase ret = ctype_getCtbase (uentry_getRealType (usymtab_getTypeEntry (ctbase_typeId (c)))); llassert (ret != ctbase_undefined); return ret; } } else { return c; } } static bool ctbase_isVoidPointer (/*@dependent@*/ /*@notnull@*/ ctbase c) { ctbase r = ctbase_realType (c); return (ctbase_isKind (r, CT_PTR) && ctype_isVoid (r->contents.base)); } static bool ctbase_isPointer (/*@notnull@*/ /*@dependent@*/ ctbase c) { ctbase r = ctbase_realType (c); return (ctbase_isKind (r, CT_PTR)); } static bool ctbase_isEitherArray (/*@notnull@*/ ctbase c) { ctbase r = ctbase_realType (c); return (ctbase_isKind (r, CT_ARRAY) || ctbase_isKind (r, CT_FIXEDARRAY)); } static bool ctbase_isFixedArray (/*@notnull@*/ ctbase c) { ctbase r = ctbase_realType (c); return (ctbase_isKind (r, CT_FIXEDARRAY)); } static bool ctbase_isStruct (/*@notnull@*/ ctbase c) { ctbase r = ctbase_realType (c); return (ctbase_isKind (r, CT_STRUCT)); } static bool ctbase_isUnion (/*@notnull@*/ ctbase c) { ctbase r = ctbase_realType (c); return (ctbase_isKind (r, CT_UNION)); } /* ** clean this up -> typeTable should store ctype */ static typeId ctbase_typeBaseUid (ctbase c) { ctuid ct; if (ctbase_isDefined (c)) { ct = c->type; if (ctuid_isAP (ct)) { return ctbase_typeBaseUid (ctype_getCtbase (c->contents.base)); } else if (ct == CT_USER || ct == CT_ABST || ct == CT_NUMABST) { return c->contents.tid; } else if (ct == CT_FIXEDARRAY) { return ctbase_typeBaseUid (ctype_getCtbase (c->contents.farray->base)); } else { llcontbuglit ("ctbase_typeBaseUid: bad call"); return typeId_invalid; } } return typeId_invalid; } static bool ctbase_isBaseUA (ctbase c) { ctuid ct; if (ctbase_isDefined (c)) { ct = c->type; if (ctuid_isAP (ct)) { return ctbase_isBaseUA (ctype_getCtbase (c->contents.base)); } else if (ct == CT_FIXEDARRAY) { return ctbase_isBaseUA (ctype_getCtbase (c->contents.farray->base)); } else return (ct == CT_USER || ct == CT_ABST || ct == CT_NUMABST); } return FALSE; } static typeId ctbase_typeId (ctbase c) { if (ctbase_isUA (c)) { return c->contents.tid; } else { if (ctbase_isConj (c)) { if (ctype_isUA (ctbase_getConjA (c))) { return ctbase_typeId (ctype_getCtbase (ctbase_getConjA (c))); } else if (ctype_isUA (ctbase_getConjB (c))) { return ctbase_typeId (ctype_getCtbase (ctbase_getConjB (c))); } else { llcontbug (message ("ctbase_typeId: bad call: %q", ctbase_unparse (c))); return typeId_invalid; } } else { llcontbug (message ("ctbase_typeId: bad call: %q", ctbase_unparse (c))); return typeId_invalid; } } } static /*@only@*/ cstring ctbase_unparse (ctbase c) { if (ctbase_isUndefined (c)) { return cstring_makeLiteral ("<>"); } switch (c->type) { case CT_UNKNOWN: return cstring_makeLiteral ("?"); case CT_BOOL: return cstring_copy (context_printBoolName ()); case CT_PRIM: return (cprim_unparse (c->contents.prim)); case CT_USER: case CT_ABST: case CT_NUMABST: return (usymtab_getTypeEntryName (c->contents.tid)); case CT_EXPFCN: return (message ("", c->contents.base)); case CT_PTR: /* no spaces for multiple pointers */ if (ctype_isPointer (c->contents.base)) { return (cstring_appendChar (cstring_copy (ctype_unparse (c->contents.base)), '*')); } else { return (message ("%t *", c->contents.base)); } case CT_FIXEDARRAY: /* ** C prints out array declarations backwards, if ** base is an array need to print out in reverse order. */ if (ctype_isArray (c->contents.farray->base)) { ctype base = c->contents.farray->base; cstring res = message ("[%d]", (int) c->contents.farray->size); while (ctype_isArray (base)) { if (ctype_isFixedArray (base)) { res = message ("%q[%d]", res, (int) ctype_getArraySize (base)); } else { res = message ("%q[]", res); } base = ctype_baseArrayPtr (base); } return (message ("%t %q", base, res)); } else { return (message ("%t [%d]", c->contents.farray->base, (int) c->contents.farray->size)); } case CT_ARRAY: if (ctype_isArray (c->contents.base)) { ctype base = c->contents.base; cstring res = cstring_makeLiteral ("[]"); while (ctype_isArray (base)) { if (ctype_isFixedArray (base)) { res = message ("%q[%d]", res, (int) ctype_getArraySize (base)); } else { res = message ("%q[]", res); } base = ctype_baseArrayPtr (base); } return (message ("%t %q", base, res)); } else { return (message ("%t []", c->contents.base)); } case CT_FCN: return (message ("[function (%q) returns %t]", uentryList_unparseParams (c->contents.fcn->params), c->contents.fcn->rval)); case CT_STRUCT: if (cstring_isDefined (c->contents.su->name) && !cstring_isEmpty (c->contents.su->name) && !isFakeTag (c->contents.su->name)) { return (message ("struct %s", c->contents.su->name)); } else { return (message ("struct { %q }", uentryList_unparseAbbrev (c->contents.su->fields))); } case CT_UNION: if (cstring_isDefined (c->contents.su->name) && !cstring_isEmpty (c->contents.su->name) && !isFakeTag (c->contents.su->name)) { return (message ("union %s", c->contents.su->name)); } else { return (message ("union { %q }", uentryList_unparseAbbrev (c->contents.su->fields))); } case CT_ENUM: if (isFakeTag (c->contents.cenum->tag)) { return (message ("enum { %q }", enumNameList_unparseBrief (c->contents.cenum->members))); } else { return (message ("enum %s { %q }", c->contents.cenum->tag, enumNameList_unparseBrief (c->contents.cenum->members))); } case CT_CONJ: if (ctbase_isAnytype (c)) { return (cstring_makeLiteral ("")); } else if (c->contents.conj->isExplicit || context_getFlag (FLG_SHOWALLCONJS)) { if (!ctype_isSimple (c->contents.conj->a) || !ctype_isSimple (c->contents.conj->b)) { return (message ("<%t> | <%t>", c->contents.conj->a, c->contents.conj->b)); } else { return (message ("%t | %t", c->contents.conj->a, c->contents.conj->b)); } } else { return (cstring_copy (ctype_unparse (c->contents.conj->a))); } BADDEFAULT; } BADEXIT; } static /*@only@*/ cstring ctbase_unparseDeep (ctbase c) { if (ctbase_isUndefined (c)) { return cstring_makeLiteral ("<>"); } switch (c->type) { case CT_UNKNOWN: return cstring_makeLiteral ("?"); case CT_BOOL: return cstring_copy (context_printBoolName ()); case CT_PRIM: return (cprim_unparse (c->contents.prim)); case CT_ENUM: if (cstring_isNonEmpty (c->contents.cenum->tag)) { return (message ("enum %s { %q }", c->contents.cenum->tag, enumNameList_unparse (c->contents.cenum->members))); } else { return (message ("enum { %q }", enumNameList_unparse (c->contents.cenum->members))); } case CT_USER: case CT_ABST: case CT_NUMABST: return (usymtab_getTypeEntryName (c->contents.tid)); case CT_EXPFCN: return (message ("", c->contents.base)); case CT_PTR: return (message ("%t *", c->contents.base)); case CT_FIXEDARRAY: return (message ("%t [%d]", c->contents.farray->base, (int) c->contents.farray->size)); case CT_ARRAY: return (message ("%t []", c->contents.base)); case CT_FCN: return (message ("[function (%q) returns %t]", uentryList_unparse (c->contents.fcn->params), c->contents.fcn->rval)); case CT_STRUCT: return (message ("struct %s { ... } ", c->contents.su->name)); case CT_UNION: return (message ("union %s { ... }", c->contents.su->name)); case CT_CONJ: if (ctbase_isAnytype (c)) { return (cstring_makeLiteral ("")); } else { return (message ("%t", c->contents.conj->a)); } BADDEFAULT; } BADEXIT; } static /*@only@*/ cstring ctbase_unparseNotypes (ctbase c) { llassert (ctbase_isDefined (c)); switch (c->type) { case CT_UNKNOWN: return cstring_makeLiteral ("?"); case CT_BOOL: return cstring_copy (context_printBoolName ()); case CT_PRIM: return (cprim_unparse (c->contents.prim)); case CT_ENUM: if (typeId_isInvalid (c->contents.tid)) { return cstring_makeLiteral ("enum"); } else { return (message ("T#%d", c->contents.tid)); } case CT_USER: return (message ("uT#%d", c->contents.tid)); case CT_ABST: return (message ("aT#%d", c->contents.tid)); case CT_NUMABST: return (message ("nT#%d", c->contents.tid)); case CT_EXPFCN: return (message ("", ctbase_unparseNotypes (ctype_getCtbase (c->contents.base)))); case CT_PTR: return (message ("%q *", ctbase_unparseNotypes (ctype_getCtbase (c->contents.base)))); case CT_ARRAY: return (message ("%q []", ctbase_unparseNotypes (ctype_getCtbase (c->contents.base)))); case CT_FCN: return (message ("[function (%d) returns %q]", uentryList_size (c->contents.fcn->params), ctbase_unparseNotypes (ctype_getCtbase (c->contents.fcn->rval)))); case CT_STRUCT: return (message ("struct %s", c->contents.su->name)); case CT_UNION: return (message ("union %s", c->contents.su->name)); case CT_ENUMLIST: return (message ("[enumlist]")); case CT_CONJ: if (ctbase_isAnytype (c)) { return (cstring_makeLiteral ("")); } else { return (message ("%q/%q", ctbase_unparseNotypes (ctype_getCtbase (c->contents.conj->a)), ctbase_unparseNotypes (ctype_getCtbase (c->contents.conj->b)))); } BADDEFAULT; } BADEXIT; } static /*@only@*/ cstring ctbase_unparseDeclaration (ctbase c, /*@only@*/ cstring name) /*@*/ { if (ctbase_isUndefined (c)) { return name; } switch (c->type) { case CT_UNKNOWN: return (message ("? %q", name)); case CT_BOOL: return (message ("%s %q", context_printBoolName (), name)); case CT_PRIM: return (message ("%q %q", cprim_unparse (c->contents.prim), name)); case CT_USER: case CT_ABST: case CT_NUMABST: return (message ("%q %q", usymtab_getTypeEntryName (c->contents.tid), name)); case CT_EXPFCN: llcontbuglit ("ctbase_unparseDeclaration: expfcn"); return name; case CT_PTR: if (ctype_isFunction (c->contents.base)) { return ctbase_unparseDeclaration (ctype_getCtbase (c->contents.base), name); } else { cstring s = cstring_prependChar ('*', name); cstring ret = ctbase_unparseDeclaration (ctype_getCtbase (c->contents.base), s); cstring_free (name); return (ret); } case CT_FIXEDARRAY: return (message ("%q[%d]", ctbase_unparseDeclaration (ctype_getCtbase (c->contents.farray->base), name), (int) c->contents.farray->size)); case CT_ARRAY: return (message ("%q[]", ctbase_unparseDeclaration (ctype_getCtbase (c->contents.base), name))); case CT_FCN: { cstring s = message ("%q(%q)", name, uentryList_unparseParams (c->contents.fcn->params)); return (ctbase_unparseDeclaration (ctype_getCtbase (c->contents.fcn->rval), s)); } case CT_STRUCT: if (cstring_isDefined (c->contents.su->name) && !cstring_isEmpty (c->contents.su->name) && !isFakeTag (c->contents.su->name)) { return (message ("struct %s %q", c->contents.su->name, name)); } else { return (message ("struct { %q } %q", uentryList_unparseAbbrev (c->contents.su->fields), name)); } case CT_UNION: if (cstring_isDefined (c->contents.su->name) && !cstring_isEmpty (c->contents.su->name) && !isFakeTag (c->contents.su->name)) { return (message ("union %s %q", c->contents.su->name, name)); } else { return (message ("union { %q } %q", uentryList_unparseAbbrev (c->contents.su->fields), name)); } case CT_ENUM: if (isFakeTag (c->contents.cenum->tag)) { return (message ("enum { %q } %q", enumNameList_unparseBrief (c->contents.cenum->members), name)); } else { return (message ("enum %s { %q } %q", c->contents.cenum->tag, enumNameList_unparseBrief (c->contents.cenum->members), name)); } case CT_CONJ: if (ctbase_isAnytype (c)) { return (message (" %q", name)); } else if (c->contents.conj->isExplicit || context_getFlag (FLG_SHOWALLCONJS)) { if (!ctype_isSimple (c->contents.conj->a) || !ctype_isSimple (c->contents.conj->b)) { cstring name1 = cstring_copy (name); return (message ("<%q> | <%q>", ctbase_unparseDeclaration (ctype_getCtbase (c->contents.conj->a), name1), ctbase_unparseDeclaration (ctype_getCtbase (c->contents.conj->b), name))); } else { cstring s1 = ctbase_unparseDeclaration (ctype_getCtbase (c->contents.conj->a), cstring_copy (name)); return (message ("%q | %q", s1, ctbase_unparseDeclaration (ctype_getCtbase (c->contents.conj->b), name))); } } else { cstring_free (name); return (cstring_copy (ctype_unparse (c->contents.conj->a))); } BADDEFAULT; } BADEXIT; } static ctbase ctbase_undump (d_char *c) /*@requires maxRead(*c) >= 2 @*/ { ctbase res; char p = **c; (*c)++; switch (p) { case '?': return (ctbase_undefined); case 'u': return (ctbase_createUnknown ()); case 'b': return (ctbase_createBool ()); case 'p': res = ctbase_createPrim (cprim_fromInt (reader_getInt (c))); reader_checkChar (c, '|'); return res; case 's': res = ctbase_createUser (typeId_fromInt (reader_getInt (c))); reader_checkChar (c, '|'); return res; case 'a': res = ctbase_createAbstract (typeId_fromInt (reader_getInt (c))); reader_checkChar (c, '|'); return res; case 'n': res = ctbase_createNumAbstract (typeId_fromInt (reader_getInt (c))); reader_checkChar (c, '|'); return res; case 't': res = ctbase_makePointer (ctype_undump (c)); reader_checkChar (c, '|'); return res; case 'y': res = ctbase_makeArray (ctype_undump (c)); reader_checkChar (c, '|'); return res; case 'F': { ctype ct = ctype_undump (c); size_t size; reader_checkChar (c, '/'); size = size_fromInt (reader_getInt (c)); reader_checkChar (c, '|'); return (ctbase_makeFixedArray (ct, size)); } case 'f': { ctype ct; char *lp = strchr (*c, '('); llassertfatal (lp != NULL); *lp = '\0'; ct = ctype_undump (c); *c = lp + 1; return (ctbase_makeLiveFunction (ct, uentryList_undump (c))); } case 'S': { uentryList fields; ctbase ctb; char *sname; char *lc = strchr (*c, '{'); llassert (lc != NULL); *lc = '\0'; sname = mstring_copy (*c); *c = lc + 1; if (*sname == '!') { unsigned int i; i = (unsigned) atoi (sname + 1); setTagNo (i); } fields = uentryList_undumpFields (c, g_currentloc); ctb = ctbase_createStruct (cstring_fromCharsO (sname), fields); return ctb; } case 'U': { char *sname; char *lc = strchr (*c, '{'); llassert (lc != NULL); *lc = '\0'; sname = mstring_copy (*c); llassert (sname != NULL); *c = lc + 1; if (*sname == '!') { unsigned int i; i = (unsigned) atoi (sname + 1); setTagNo (i); } return (ctbase_createUnion (cstring_fromCharsO (sname), uentryList_undumpFields (c, g_currentloc))); } case 'e': { ctbase ret; char *sname; char *lc = strchr (*c, '{'); llassert (lc != NULL); *lc = '\0'; sname = mstring_copy (*c); *c = lc + 1; if (*sname == '!') { unsigned int i; i = (unsigned) atoi (sname + 1); setTagNo (i); } ret = ctbase_createEnum (cstring_fromCharsO (sname), enumNameList_undump (c)); return ret; } case 'C': { bool isExplicit; ctype c1, c2; isExplicit = bool_fromInt (reader_getInt (c)); reader_checkChar (c, '.'); c1 = ctype_undump (c); reader_checkChar (c, '/'); c2 = ctype_undump (c); reader_checkChar (c, '|'); return (ctbase_makeConj (c1, c2, isExplicit)); } default: (*c)--; llerror (FLG_SYNTAX, message ("Bad Library line (type): %s", cstring_fromChars (*c))); /*drl bee: pbr*/ while (**c != '\0') { (*c)++; } return ctbase_createUnknown (); } } /* first letter of c encodes type: */ /* u unknown */ /* b bool */ /* p prim */ /* e enum */ /* l enumList */ /* s uSer */ /* a abstract */ /* t poinTer */ /* y arraY */ /* F Fixed array */ /* f function */ /* S structure */ /* U union */ /* C conj */ static /*@only@*/ cstring ctbase_dump (ctbase c) { if (!ctbase_isDefined (c)) { return cstring_makeLiteral ("?"); } switch (c->type) { case CT_UNKNOWN: return cstring_makeLiteral ("u"); case CT_BOOL: return cstring_makeLiteral ("b"); case CT_PRIM: return (message ("p%d|", c->contents.prim)); case CT_USER: return (message ("s%d|", usymtab_convertTypeId (c->contents.tid))); case CT_ABST: return (message ("a%d|", usymtab_convertTypeId (c->contents.tid))); case CT_NUMABST: return (message ("n%d|", usymtab_convertTypeId (c->contents.tid))); case CT_PTR: return (message ("t%q|", ctype_dump (c->contents.base))); case CT_ARRAY: return (message ("y%q|", ctype_dump (c->contents.base))); case CT_FIXEDARRAY: return (message ("F%q/%d|", ctype_dump (c->contents.farray->base), (int) c->contents.farray->size)); case CT_FCN: DPRINTF (("Dump function: %s", ctbase_unparse (c))); return (message ("f%q (%q)", ctype_dump (c->contents.fcn->rval), uentryList_dumpParams (c->contents.fcn->params))); case CT_STRUCT: return (message ("S%s{%q}", c->contents.su->name, uentryList_dumpFields (c->contents.su->fields))); case CT_UNION: return (message ("U%s{%q}", c->contents.su->name, uentryList_dumpFields (c->contents.su->fields))); case CT_ENUM: { cstring s; if (cstring_isNonEmpty (c->contents.cenum->tag)) { s = message ("e%s{%q}", c->contents.cenum->tag, enumNameList_dump (c->contents.cenum->members)); } else { s = message ("e{%q}", enumNameList_dump (c->contents.cenum->members)); } return (s); } case CT_CONJ: return (message ("C%d.%q/%q|", bool_toInt (c->contents.conj->isExplicit), ctype_dump (c->contents.conj->a), ctype_dump (c->contents.conj->b))); case CT_EXPFCN: /* should clean them up! */ return (cstring_makeLiteral ("?")); case CT_ENUMLIST: llcontbug (message ("Cannot dump: %q", ctbase_unparse (c))); return (message ("u")); BADDEFAULT; } BADEXIT; } static /*@only@*/ ctbase ctbase_copy (/*@notnull@*/ ctbase c) { switch (c->type) { case CT_UNKNOWN: return (ctbase_createUnknown ()); case CT_BOOL: return (ctbase_createBool ()); case CT_ENUM: return (ctbase_createEnum (cstring_copy (c->contents.cenum->tag), enumNameList_copy (c->contents.cenum->members))); case CT_PRIM: return (ctbase_createPrim (c->contents.prim)); case CT_USER: return (ctbase_createUser (c->contents.tid)); case CT_ABST: return (ctbase_createAbstract (c->contents.tid)); case CT_NUMABST: return (ctbase_createNumAbstract (c->contents.tid)); case CT_EXPFCN: return (ctbase_expectFunction (c->contents.base)); case CT_PTR: return (ctbase_makePointer (c->contents.base)); case CT_ARRAY: return (ctbase_makeArray (c->contents.base)); case CT_FCN: return (ctbase_makeLiveFunction (c->contents.fcn->rval, uentryList_copy (c->contents.fcn->params))); case CT_STRUCT: return (ctbase_createStruct (cstring_copy (c->contents.su->name), uentryList_copy (c->contents.su->fields))); case CT_UNION: return (ctbase_createUnion (cstring_copy (c->contents.su->name), uentryList_copy (c->contents.su->fields))); case CT_CONJ: /*@i@*/ return (c); /* not a real copy for conj's */ default: llbug (message ("ctbase_copy: %q", ctbase_unparse (c))); } BADEXIT; } static enumNameList ctbase_elist (ctbase c) { llassert (ctbase_isDefined (c)); llassert (c->type == CT_ENUM); return (c->contents.cenum->members); } static void ctbase_free (/*@only@*/ ctbase c) { if (c == ctbase_bool || c == ctbase_unknown) { /*@-mustfree@*/ return; /*@=mustfree@*/ } --nctbases; if (ctbase_isDefined (c)) { switch (c->type) { case CT_UNKNOWN: sfree (c); break; case CT_PRIM: sfree (c); break; case CT_ENUM: sfree (c); break; case CT_ENUMLIST: /* sfree list? */ sfree (c); break; case CT_USER: case CT_ABST: case CT_NUMABST: sfree (c); break; case CT_PTR: case CT_ARRAY: sfree (c); break; case CT_FCN: /* Cannot free params: uentryList_free (c->contents.fcn->params); */ uentryList_freeShallow (c->contents.fcn->params); sfree (c); break; case CT_STRUCT: case CT_UNION: cstring_free (c->contents.su->name); uentryList_free (c->contents.su->fields); sfree (c); break; case CT_CONJ: /* Don't bree conj's, */ break; default: sfree (c); break; } } } /* ** c should be * */ static /*@only@*/ ctbase ctbase_expectFunction (ctype c) { ctbase f = ctbase_new (); f->type = CT_EXPFCN; f->contents.base = c; return (f); } static bool ctbase_isExpectFunction (/*@notnull@*/ ctbase ct) /*@*/ { return (ct->type == CT_EXPFCN); } static ctype ctbase_getExpectFunction (/*@notnull@*/ ctbase ct) { llassert (ctbase_isExpectFunction (ct)); return ct->contents.base; } static bool ctbase_genMatch (ctbase c1, ctbase c2, bool force, bool arg, bool def, bool deep) { ctuid c1tid, c2tid; /* undefined types never match */ if (ctbase_isUndefined (c1) || ctbase_isUndefined (c2)) return FALSE; /* abstract types match user types of same name */ c1 = ctbase_realType (c1); c2 = ctbase_realType (c2); DPRINTF (("Matching: %s / %s", ctbase_unparse (c1), ctbase_unparse (c2))); c1tid = c1->type; c2tid = c2->type; if (c1tid == CT_CONJ) { return (ctbase_genMatch (ctype_getCtbase (c1->contents.conj->a), c2, force, arg, def, deep) || ctbase_genMatch (ctype_getCtbase (c1->contents.conj->b), c2, force, arg, def, deep)); } if (c2tid == CT_CONJ) { return (ctbase_genMatch (c1, ctype_getCtbase (c2->contents.conj->a), force, arg, def, deep) || ctbase_genMatch (c1, ctype_getCtbase (c2->contents.conj->b), force, arg, def, deep)); } /* ** if the types don't match, there are some special cases... */ if (c1tid != c2tid) { /* unknowns match anything */ if (c1tid == CT_UNKNOWN || c2tid == CT_UNKNOWN) { return TRUE; } if (c1tid == CT_FIXEDARRAY && (c2tid == CT_ARRAY || (!def && c2tid == CT_PTR))) { if (ctype_isVoid (c2->contents.base)) { return (context_getFlag (FLG_ABSTVOIDP) || (!(ctype_isRealAbstract (c1->contents.farray->base)) && !(ctype_isRealAbstract (c2->contents.base)))); } return (ctbase_genMatch (ctype_getCtbase (c1->contents.farray->base), ctype_getCtbase (c2->contents.base), force, arg, def, deep)); } if (c2tid == CT_FIXEDARRAY && (c1tid == CT_ARRAY || (!def && c1tid == CT_PTR))) { if (ctype_isVoid (c1->contents.base)) { return (context_getFlag (FLG_ABSTVOIDP) || (!(ctype_isRealAbstract (c2->contents.farray->base)) && !(ctype_isRealAbstract (c1->contents.base)))); } return (ctbase_genMatch (ctype_getCtbase (c1->contents.base), ctype_getCtbase (c2->contents.farray->base), force, arg, def, deep)); } /* evs 2000-07-25: Bool's may match user/abstract types */ if ((c1tid == CT_BOOL && (c2tid == CT_PRIM && cprim_isInt (c2->contents.prim))) || (c2tid == CT_BOOL && (c1tid == CT_PRIM && cprim_isInt (c1->contents.prim)))) { return (context_msgBoolInt ()); } if ((c1tid == CT_BOOL && (ctuid_isAnyUserType (c2tid)))) { ctype t2c = c2->contents.base; return (ctype_isBool (t2c)); } if ((c2tid == CT_BOOL && (ctuid_isAnyUserType (c1tid)))) { ctype t1c = c1->contents.base; return (ctype_isBool (t1c)); } if ((c1tid == CT_ENUM && (c2tid == CT_PRIM && cprim_isInt (c2->contents.prim))) || (c2tid == CT_ENUM && (c1tid == CT_PRIM && cprim_isInt (c1->contents.prim)))) { return (context_msgEnumInt ()); } /* ** arrays and pointers...yuk! ** ** Considered equivalent except in definitions. ** (e.g., function parameters are equivalent) ** */ if (!def) { if (ctuid_isAP (c1tid) && ctuid_isAP (c2tid)) { c2tid = c1tid; } } /* ** Function pointers can be removed. ** ** [function ..] is equivalent to [function ..] * */ if (c1tid == CT_PTR && c2tid == CT_FCN) { if (ctype_isFunction (ctype_realType (c1->contents.base))) { c1 = ctbase_realType (ctype_getCtbaseSafe (c1->contents.base)); c1tid = c1->type; } } if (c2tid == CT_PTR && c1tid == CT_FCN) { if (ctype_isFunction (ctype_realType (c2->contents.base))) { c2 = ctbase_realType (ctype_getCtbaseSafe (c2->contents.base)); c2tid = c2->type; } } /* ** we allow forward declarations to structures like, ** ** typedef struct _t *t; ** ** to allow, ** struct _t * to match t */ if (context_getFlag (FLG_FORWARDDECL)) { if (ctuid_isAnyUserType (c1tid)) { if (ctuid_isAP (c2tid)) { ctype ts = c2->contents.base; if (ctype_isUA (ts)) { typeId ttid = ctype_typeId (ts); typeId ctid = c1->contents.tid ; if (usymtab_matchForwardStruct (ctid, ttid)) { return TRUE; } } } } if (ctuid_isAnyUserType (c2tid)) { if (ctuid_isAP (c1tid)) { ctype ts = c1->contents.base; if (ctype_isUA (ts)) { typeId ttid = ctype_typeId (ts); typeId ctid = c2->contents.tid ; if (usymtab_matchForwardStruct (ctid, ttid)) { return TRUE; } } } } } } if (c1tid != c2tid) return FALSE; switch (c1tid) { case CT_UNKNOWN: return (TRUE); case CT_PRIM: if (deep) { return (cprim_closeEnoughDeep (c1->contents.prim, c2->contents.prim)); } else { return (cprim_closeEnough (c1->contents.prim, c2->contents.prim)); } case CT_BOOL: return (TRUE); case CT_ABST: case CT_NUMABST: case CT_USER: return (typeId_equal (c1->contents.tid, c2->contents.tid)); case CT_ENUM: return (cstring_equal (c1->contents.cenum->tag, c2->contents.cenum->tag)); case CT_PTR: if (ctype_isVoid (c1->contents.base) || (ctype_isVoid (c2->contents.base))) { if (ctype_isFunction (ctype_realType (c1->contents.base)) || ctype_isFunction (ctype_realType (c2->contents.base))) { return (!context_getFlag (FLG_CASTFCNPTR)); } else { return (context_getFlag (FLG_ABSTVOIDP) || (!(ctype_isRealAbstract (c1->contents.base)) && !(ctype_isRealAbstract (c2->contents.base)))); } } else { /* Only allow one implicit function pointer. */ if (!bool_equal (ctype_isRealPointer (c1->contents.base), ctype_isRealPointer (c2->contents.base)) && (ctype_isRealFunction (c1->contents.base) || ctype_isRealFunction (c2->contents.base))) { return FALSE; } return (ctype_genMatch (c1->contents.base, c2->contents.base, force, arg, def, TRUE)); } case CT_FIXEDARRAY: if (ctype_isVoid (c1->contents.farray->base) || ctype_isVoid (c2->contents.farray->base)) return TRUE; return (ctype_genMatch (c1->contents.farray->base, c2->contents.farray->base, force, arg, def, deep)); case CT_ARRAY: if (ctype_isVoid (c1->contents.base) || ctype_isVoid (c2->contents.base)) return TRUE; return (ctype_genMatch (c1->contents.base, c2->contents.base, force, arg, def, TRUE)); case CT_FCN: return (ctype_genMatch (c1->contents.fcn->rval, c2->contents.fcn->rval, force, arg, def, TRUE) && uentryList_matchParams (c1->contents.fcn->params, c2->contents.fcn->params, force, TRUE)); case CT_STRUCT: case CT_UNION: DPRINTF (("Struct: %s / %s", c1->contents.su->name, c2->contents.su->name)); if (isFakeTag (c1->contents.su->name) && isFakeTag (c2->contents.su->name)) { /* Both fake tags, check structure */ if (cstring_equal (c1->contents.su->name, c2->contents.su->name)) { return TRUE; } else { return uentryList_matchFields (c1->contents.su->fields, c2->contents.su->fields); } } else { if (!cstring_isEmpty (c1->contents.su->name)) { return (cstring_equal (c1->contents.su->name, c2->contents.su->name)); } else { if (!cstring_isEmpty (c2->contents.su->name)) { return FALSE; } llcontbuglit ("ctbase_genMatch: match fields"); return (FALSE); } } default: llcontbug (message ("ctbase_genMatch: unknown type: %d\n", (int)c1tid)); return (FALSE); } } /* ** like ctbase_match, except for conjuncts: ** modifies conjuncts to match only */ static bool ctbase_forceMatch (ctbase c1, ctbase c2) /*@modifies c1, c2@*/ { return (ctbase_genMatch (c1, c2, TRUE, FALSE, FALSE, FALSE)); } static bool ctbase_match (ctbase c1, ctbase c2) /*@modifies nothing@*/ { return (ctbase_genMatch (c1, c2, FALSE, FALSE, FALSE, FALSE)); } static bool ctbase_matchDef (ctbase c1, ctbase c2) /*@modifies nothing@*/ { return (ctbase_genMatch (c1, c2, FALSE, FALSE, TRUE, FALSE)); } static bool ctbase_matchArg (ctbase c1, ctbase c2) { return (ctbase_genMatch (c1, c2, FALSE, TRUE, FALSE, FALSE)); } static /*@out@*/ /*@only@*/ /*@notnull@*/ ctbase ctbase_new () { ctbase c = (ctbase) dmalloc (sizeof (*c)); nctbases++; /* if (nctbases % 100 == 0 && nctbases > lastnc) { llmsg (message ("ctbases: %d", nctbases)); lastnc = nctbases; } */ return (c); } static /*@only@*/ ctbase ctbase_createPrim (cprim p) { ctbase c = ctbase_new (); c->type = CT_PRIM; c->contents.prim = p; return (c); } static /*@observer@*/ ctbase ctbase_getBool (void) { /*@i@*/ return ctbase_createBool (); } static ctbase ctbase_createBool () { if (!ctbase_isDefined (ctbase_bool)) { ctbase_bool = ctbase_new (); ctbase_bool->type = CT_BOOL; ctbase_bool->contents.prim = CTX_BOOL; } /*@-retalias@*/ /*@-globstate@*/ return ctbase_bool; /*@=retalias@*/ /*@=globstate@*/ } static /*@only@*/ ctbase ctbase_createUser (typeId u) { ctbase c = ctbase_new (); c->type = CT_USER; c->contents.tid = u; llassert (typeId_isValid (u)); return (c); } static /*@only@*/ ctbase ctbase_createEnum (/*@keep@*/ cstring etag, /*@keep@*/ enumNameList emembers) { ctbase c = ctbase_new (); c->type = CT_ENUM; if (cstring_isUndefined (etag)) { llcontbuglit ("Undefined enum tag!"); etag = fakeTag (); } c->contents.cenum = (tenum) dmalloc (sizeof (*c->contents.cenum)); c->contents.cenum->tag = etag; c->contents.cenum->members = emembers; return (c); } static /*@observer@*/ cstring ctbase_enumTag (/*@notnull@*/ ctbase ct) { return (ct->contents.cenum->tag); } static /*@only@*/ ctbase ctbase_createAbstract (typeId u) { ctbase c = ctbase_new (); c->type = CT_ABST; c->contents.tid = u; /* also check its abstract? */ llassert (typeId_isValid (c->contents.tid)); return (c); } static /*@only@*/ ctbase ctbase_createNumAbstract (typeId u) { ctbase c = ctbase_new (); c->type = CT_NUMABST; c->contents.tid = u; /* also check its abstract? */ llassert (typeId_isValid (c->contents.tid)); return (c); } static /*@only@*/ ctbase ctbase_createUnknown (void) { if (!ctbase_isDefined (ctbase_unknown)) { ctbase_unknown = ctbase_new (); ctbase_unknown->type = CT_UNKNOWN; ctbase_unknown->contents.prim = CTX_UNKNOWN; } /*@-retalias@*/ /*@-globstate@*/ return ctbase_unknown; /*@=retalias@*/ /*@=globstate@*/ } /* ** requires: result is not assigned to b ** (should copy, but no way to reclaim storage) */ static /*@only@*/ ctbase ctbase_makePointer (ctype b) { ctbase c = ctbase_new (); c->type = CT_PTR; c->contents.base = b; return (c); } static /*@only@*/ ctbase ctbase_makeArray (ctype b) { ctbase c = ctbase_new (); c->type = CT_ARRAY; c->contents.base = b; return (c); } static /*@notnull@*/ /*@only@*/ ctbase ctbase_makeFixedArray (ctype b, size_t size) { ctbase c = ctbase_new (); c->type = CT_FIXEDARRAY; c->contents.farray = (tfixed) dmalloc (sizeof (*c->contents.farray)); c->contents.farray->base = b; c->contents.farray->size = size; return (c); } static ctype ctbase_makeFunction (ctype b, /*@only@*/ uentryList p) { ctbase c = ctbase_new (); ctype ct; c->type = CT_FCN; c->contents.fcn = (cfcn) dmalloc (sizeof (*c->contents.fcn)); if (ctype_isFunction (b)) /* was: && ctype_isPointer (b)) */ { ctbase ctb; ctype rval; if (ctype_isPointer (b)) { ctb = ctype_getCtbase (ctype_baseArrayPtr (b)); } else { ctb = ctype_getCtbase (b); } llassert (ctbase_isDefined (ctb)); llassert (ctb->type == CT_FCN); rval = ctype_makeFunction (ctb->contents.fcn->rval, p); c->contents.fcn->rval = rval; c->contents.fcn->params = uentryList_copy (ctb->contents.fcn->params); /* no copy before */ } else { c->contents.fcn->rval = b; c->contents.fcn->params = uentryList_copy (p); /* no copy before */ /*@-branchstate@*/ /* p is really released on this branch */ } /*@=branchstate@*/ ct = cttable_addComplex (c); return (ct); /* was: ctype_makePointer (ct)); */ } static ctype ctbase_makeNFFunction (ctype b, /*@only@*/ uentryList p) { ctbase c = ctbase_new (); ctype ct; c->type = CT_FCN; c->contents.fcn = (cfcn) dmalloc (sizeof (*c->contents.fcn)); if (ctype_isFunction (b)) /* was && ctype_isPointer (b)) */ { ctbase ctb; ctype rval; if (ctype_isPointer (b)) { ctb = ctype_getCtbase (ctype_baseArrayPtr (b)); } else { ctb = ctype_getCtbase (b); } llassert (ctbase_isDefined (ctb)); llassert (ctb->type == CT_FCN); rval = ctype_makeNFParamsFunction (ctb->contents.fcn->rval, p); c->contents.fcn->rval = rval; c->contents.fcn->params = uentryList_copy (ctb->contents.fcn->params); } else { c->contents.fcn->rval = b; c->contents.fcn->params = uentryList_copy (p); /*@-branchstate@*/ } /*@=branchstate@*/ ct = cttable_addComplex (c); return (ct); /* was: ctype_makePointer (ct)); */ } static /*@only@*/ ctbase ctbase_makeLiveFunction (ctype b, /*@only@*/ uentryList p) { ctbase c = ctbase_new (); c->type = CT_FCN; c->contents.fcn = (cfcn) dmalloc (sizeof (*c->contents.fcn)); c->contents.fcn->rval = b; c->contents.fcn->params = p; /*@-mustfree@*/ return (c); /*@=mustfree@*/ } static /*@observer@*/ /*@notnull@*/ ctbase ctbase_realFunction (/*@dependent@*/ /*@notnull@*/ ctbase c) { ctbase res; if (c->type == CT_FCN) { return c; } llassert (ctbase_isFunction (c)); res = ctype_getCtbase (c->contents.base); llassert (ctbase_isDefined (res)); return (res); } static bool ctbase_isFunction (ctbase c) { llassert (c != ctbase_undefined); if (c->type == CT_FCN) { return TRUE; } else { if (c->type == CT_PTR) { ctbase fcn = ctype_getCtbase (ctbase_baseArrayPtr (c)); return (ctbase_isDefined (fcn) && fcn->type == CT_FCN); } return FALSE; } } /* doesn't copy c1 and c2 */ static /*@only@*/ ctbase ctbase_makeConj (ctype c1, ctype c2, bool isExplicit) { ctbase c = ctbase_new (); c->type = CT_CONJ; c->contents.conj = (tconj) dmalloc (sizeof (*c->contents.conj)); c->contents.conj->a = c1; c->contents.conj->b = c2; c->contents.conj->isExplicit = isExplicit; return (c); } static bool ctbase_isAnytype (/*@notnull@*/ ctbase b) { /* ** A unknown|dne conj is a special representation for an anytype. */ if (b->type == CT_CONJ) { /*@access ctype@*/ return (b->contents.conj->a == ctype_unknown && b->contents.conj->b == ctype_dne); /*@noaccess ctype@*/ } return FALSE; } static ctype ctbase_getConjA (/*@notnull@*/ ctbase c) { llassert (c->type == CT_CONJ); return (c->contents.conj->a); } static ctype ctbase_getConjB (/*@notnull@*/ ctbase c) { llassert (c->type == CT_CONJ); return (c->contents.conj->b); } static bool ctbase_isExplicitConj (/*@notnull@*/ ctbase c) { llassert (c->type == CT_CONJ); return (c->contents.conj->isExplicit); } static /*@only@*/ ctbase ctbase_createStruct (/*@only@*/ cstring n, /*@only@*/ uentryList f) { ctbase c = ctbase_new (); c->type = CT_STRUCT; c->contents.su = (tsu) dmalloc (sizeof (*c->contents.su)); c->contents.su->name = n; c->contents.su->fields = f; return (c); } static /*@observer@*/ uentryList ctbase_getuentryList (/*@notnull@*/ ctbase c) { c = ctbase_realType (c); if (!(c->type == CT_STRUCT || c->type == CT_UNION)) llfatalbug (message ("ctbase_getuentryList: bad invocation: %q", ctbase_unparse (c))); return (c->contents.su->fields); } static ctbase ctbase_createUnion (/*@keep@*/ cstring n, /*@only@*/ uentryList f) { ctbase c = ctbase_new (); c->type = CT_UNION; c->contents.su = (tsu) dmalloc (sizeof (*c->contents.su)); c->contents.su->name = n; c->contents.su->fields = f; return (c); } static ctype ctbase_baseArrayPtr (/*@notnull@*/ ctbase c) { ctuid ct; c = ctbase_realType (c); ct = c->type; if (ct == CT_FIXEDARRAY) { return c->contents.farray->base; } else { llassert (ctuid_isAP (ct)); return c->contents.base; } } static ctype ctbase_baseFunction (/*@notnull@*/ ctbase c) { ctbase_fixUser (c); c = ctbase_realFunction (c); if (c->type != CT_FCN) { llfatalbug (message ("ctbase_baseFunction: bad call: %q", ctbase_unparse (c))); } return (c->contents.fcn->rval); } static uentryList ctbase_argsFunction (/*@notnull@*/ ctbase c) { ctbase_fixUser (c); c = ctbase_realFunction (c); if (c->type != CT_FCN) { llfatalbug (message ("ctbase_argsFunction: bad call: %q", ctbase_unparse (c))); } return (c->contents.fcn->params); } static bool ctbase_baseisExpFcn (ctype c) { ctbase cb; c = ctype_removePointers (c); cb = ctype_getCtbase (c); llassert (ctbase_isDefined (cb)); if (cb->type == CT_FCN) { c = ctype_removePointers (ctype_getReturnType (c)); cb = ctype_getCtbase (c); llassert (ctbase_isDefined (cb)); return (cb->type == CT_EXPFCN); } return FALSE; } /* ** ctbase_newBase behaves specially when p is a CONJ: ** ** c -> conj (newBase (c, p.a), p.b) */ static ctype ctbase_newBase (ctype c, ctype p) { ctbase cb; DPRINTF (("New base: %s / %s", ctype_unparse (c), ctype_unparse (p))); if (ctype_isUndefined (c) || ctype_isUnknown (c)) { return p; } cb = ctype_getCtbase (c); if (ctype_isConj (p)) { ctbase pb = ctype_getCtbase (p); llassert (ctbase_isDefined (pb)); if (pb->contents.conj->isExplicit) { return (ctype_makeExplicitConj (ctype_newBase (c, pb->contents.conj->a), pb->contents.conj->b)); } else { return (ctype_makeConj (ctype_newBase (c, pb->contents.conj->a), pb->contents.conj->b)); } } if (ctbase_baseisExpFcn (c)) { return (ctbase_newBaseExpFcn (c, p)); } llassert (ctbase_isDefined (cb)); switch (cb->type) { case CT_UNKNOWN: case CT_PRIM: case CT_USER: case CT_ENUM: case CT_ABST: case CT_NUMABST: case CT_STRUCT: case CT_UNION: case CT_EXPFCN: return (p); case CT_PTR: { ctype ret; ctype cbn; cbn = ctbase_newBase (cb->contents.base, p); ret = ctype_makePointer (cbn); return ret; } case CT_FIXEDARRAY: return (ctype_makeFixedArray (ctbase_newBase (cb->contents.farray->base, p), cb->contents.farray->size)); case CT_ARRAY: return (ctype_makeArray (ctbase_newBase (cb->contents.base, p))); case CT_FCN: return (ctype_makeRawFunction (ctbase_newBase (cb->contents.fcn->rval, p), cb->contents.fcn->params)); case CT_CONJ: return (ctype_makeConjAux (ctbase_newBase (cb->contents.conj->a, p), ctbase_newBase (cb->contents.conj->b, p), cb->contents.conj->isExplicit)); default: llcontbug (message ("ctbase_newBase: bad ctbase: %q", ctbase_unparse (cb))); return (p); } BADEXIT; } static ctype ctbase_newBaseExpFcn (ctype c, ctype p) { ctbase cb = ctype_getCtbase (c); ctbase tcb; ctype ret, tmpct; ctype fp = ctype_unknown; uentryList ctargs = ctype_argsFunction (c); /* ** okay, this is really ugly... ** ** pointers inside mean pointers to the function; ** pointers outside are pointers to the return value; ** because its a function there is one superfluous pointer. */ /* ** bf is a ctype, used to derived structure of cb */ if (!ctbase_isFunction (cb)) llbuglit ("ctbase_newBaseExpFcn: expFcn -> not a function"); tmpct = ctype_getBaseType (ctype_getReturnType (c)); /* ** pointers before expfcn -> p are pointers to function, not result ** */ tcb = ctype_getCtbase (tmpct); llassert (ctbase_isDefined (tcb)); tmpct = tcb->contents.base; /* ** record pointers to base in fp */ while (!ctype_isUnknown (tmpct)) { if (ctype_isExpFcn (tmpct)) { ctbase ttcb = ctype_getCtbase (tmpct); /* ** evs 2000-05-16: This is necessary to deal with function pointers in parens. ** The whole function pointer parsing is a major kludge, but it seems to work, ** and I'm only embarrassed by it when I haven't look at the C spec recently... */ llassert (ctbase_isDefined (ttcb)); tmpct = ttcb->contents.base; llassert (!ctype_isUnknown (tmpct)); } switch (ctype_getCtKind (tmpct)) { case CTK_PTR: fp = ctype_makePointer (fp); /*@switchbreak@*/ break; case CTK_ARRAY: fp = ctype_makeArray (fp); /*@switchbreak@*/ break; case CTK_COMPLEX: { ctbase fbase = ctype_getCtbase (tmpct); if (ctbase_isFunction (fbase)) { fp = ctype_makeFunction (fp, uentryList_copy (ctargs)); ctargs = ctbase_argsFunction (fbase); } else { llbug (message ("ctbase_newBaseExpFcn: fixing expfunction: bad complex type: %s [base: %q]", ctype_unparse (tmpct), ctbase_unparse (fbase))); } goto exitLoop; } default: { llcontbug (message ("ctbase_newBaseExpFcn: fixing expfunction: bad type: %s", ctype_unparse (tmpct))); goto exitLoop; } } tmpct = ctype_baseArrayPtr (tmpct); } exitLoop: tmpct = ctype_getReturnType (c); /* ** pointers to expf are pointers to return value */ while (!ctype_isExpFcn (tmpct)) { switch (ctype_getCtKind (tmpct)) { case CTK_PTR: p = ctype_makePointer (p); /*@switchbreak@*/ break; case CTK_ARRAY: p = ctype_makeArray (p); /*@switchbreak@*/ break; case CTK_COMPLEX: { ctbase fbase = ctype_getCtbase (tmpct); if (ctbase_isFunction (fbase)) { p = ctype_makeFunction (p, uentryList_copy (ctbase_argsFunction (fbase))); } else { llbug (message ("ctbase_newBaseExpFcn: fixing expfunction: bad complex type: %s", ctype_unparse (tmpct))); } goto exitLoop2; } default: { llcontbug (message ("ctbase_newBaseExpFcn: fixing expfunction2: bad type: %t", tmpct)); goto exitLoop2; } } tmpct = ctype_baseArrayPtr (tmpct); } exitLoop2: /* ** pointers to fp are pointers to function type */ ret = ctype_makeRawFunction (p, uentryList_copy (ctargs)); while (ctype_getCtKind (fp) > CTK_PLAIN) { switch (ctype_getCtKind (fp)) { case CTK_PTR: ret = ctype_makePointer (ret); /*@switchbreak@*/ break; case CTK_ARRAY: ret = ctype_makeArray (ret); /*@switchbreak@*/ break; case CTK_COMPLEX: { ctbase fbase = ctype_getCtbase (fp); if (ctbase_isFunction (fbase)) { ret = ctype_makeFunction (ret, uentryList_copy (ctbase_argsFunction (fbase))); } else { BADBRANCH; } goto exitLoop3; } default: { llcontbug (message ("post-fixing expfunction: bad type: %t", fp)); goto exitLoop3; } } fp = ctype_baseArrayPtr (fp); } exitLoop3: return (ret); } /* ** returns lowest level base of c: plain type */ static /*@notnull@*/ /*@only@*/ ctbase ctbase_getBaseType (/*@notnull@*/ ctbase c) { switch (c->type) { case CT_UNKNOWN: case CT_PRIM: case CT_USER: case CT_ENUM: case CT_ENUMLIST: case CT_BOOL: case CT_ABST: case CT_NUMABST: case CT_FCN: case CT_STRUCT: case CT_UNION: return (ctbase_copy (c)); case CT_PTR: case CT_ARRAY: return (ctbase_getBaseType (ctype_getCtbaseSafe (c->contents.base))); case CT_FIXEDARRAY: return (ctbase_getBaseType (ctype_getCtbaseSafe (c->contents.farray->base))); case CT_CONJ: /* base type of A conj branch? */ return (ctbase_getBaseType (ctype_getCtbaseSafe (c->contents.conj->a))); case CT_EXPFCN: return (ctbase_copy (c)); default: llfatalbug (message ("ctbase_getBaseType: bad ctbase: %q", ctbase_unparse (c))); } BADEXIT; } static int ctbase_compare (ctbase c1, ctbase c2, bool strict) { ctuid c1tid, c2tid; if (ctbase_isUndefined (c1) || ctbase_isUndefined (c2)) { llcontbuglit ("ctbase_compare: undefined ctbase"); return -1; } c1tid = c1->type; c2tid = c2->type; if (c1tid < c2tid) return -1; if (c1tid > c2tid) return 1; switch (c1tid) { case CT_UNKNOWN: return 0; case CT_PRIM: return (int_compare (c1->contents.prim, c2->contents.prim)); case CT_BOOL: return 0; case CT_USER: return (typeId_compare (c1->contents.tid, c2->contents.tid)); case CT_ENUMLIST: return 1; case CT_ENUM: /* for now, keep like abstract */ case CT_ABST: case CT_NUMABST: return (typeId_compare (c1->contents.tid, c2->contents.tid)); case CT_PTR: return (ctype_compare (c1->contents.base, c2->contents.base)); case CT_FIXEDARRAY: INTCOMPARERETURN (c1->contents.farray->size, c2->contents.farray->size); return (ctype_compare (c1->contents.farray->base, c2->contents.farray->base)); case CT_ARRAY: return (ctype_compare (c1->contents.base, c2->contents.base)); case CT_FCN: { COMPARERETURN (ctype_compare (c1->contents.fcn->rval, c2->contents.fcn->rval)); if (strict) { return (uentryList_compareStrict (c1->contents.fcn->params, c2->contents.fcn->params)); } else { return (uentryList_compareParams (c1->contents.fcn->params, c2->contents.fcn->params)); } } case CT_EXPFCN: return (ctype_compare (c1->contents.base, c2->contents.base)); case CT_STRUCT: case CT_UNION: /* evs 2000-07-28: this block was missing! */ if (strict) { int ncmp = cstring_compare (c1->contents.su->name, c2->contents.su->name); if (ncmp != 0) { if (isFakeTag (c1->contents.su->name) && isFakeTag (c2->contents.su->name)) { ; /* If they are both fake struct tags, don't require match. */ } else { return ncmp; } } } DPRINTF (("Comparing fields: %s / %s", ctbase_unparse (c1), ctbase_unparse (c2))); return (uentryList_compareFields (c1->contents.su->fields, c2->contents.su->fields)); case CT_CONJ: { COMPARERETURN (ctype_compare (c1->contents.conj->a, c2->contents.conj->a)); COMPARERETURN (ctype_compare (c1->contents.conj->b, c2->contents.conj->b)); return (bool_compare (c1->contents.conj->isExplicit, c2->contents.conj->isExplicit)); } } BADEXIT; } static int ctbase_compareStrict (/*@notnull@*/ ctbase c1, /*@notnull@*/ ctbase c2) { return (ctbase_compare (c1, c2, TRUE)); } static bool ctbase_equivStrict (/*@notnull@*/ ctbase c1, /*@notnull@*/ ctbase c2) { return (ctbase_compareStrict (c1,c2) == 0); } static bool ctbase_equiv (/*@notnull@*/ ctbase c1, /*@notnull@*/ ctbase c2) { return (ctbase_compare (c1, c2, FALSE) == 0); } static bool ctbase_isKind (/*@notnull@*/ ctbase c, ctuid kind) { ctuid ck = c->type; if (ck == kind) return TRUE; if (ck == CT_CONJ) return (ctbase_isKind (ctype_getCtbaseSafe (c->contents.conj->a), kind) || ctbase_isKind (ctype_getCtbaseSafe (c->contents.conj->b), kind)); return FALSE; } static bool ctbase_isKind2 (/*@notnull@*/ ctbase c, ctuid kind1, ctuid kind2) { ctuid ck = c->type; if (ck == kind1 || ck == kind2) return TRUE; if (ck == CT_CONJ) return (ctbase_isKind2 (ctype_getCtbaseSafe (c->contents.conj->a), kind1, kind2) || ctbase_isKind2 (ctype_getCtbaseSafe (c->contents.conj->b), kind1, kind2)); return FALSE; } static bool ctbase_isAbstract (/*@notnull@*/ ctbase c) { return (c->type == CT_ABST || c->type == CT_NUMABST); } static bool ctbase_isNumAbstract (/*@notnull@*/ ctbase c) { return (c->type == CT_NUMABST); } static bool ctbase_isUA (ctbase c) { return (ctbase_isDefined (c) && (ctuid_isAnyUserType (c->type))); } static bool ctbase_almostEqual (ctbase c1, ctbase c2) { ctuid c1tid, c2tid; /* undefined types never match */ if (ctbase_isUndefined (c1) || ctbase_isUndefined (c2)) return FALSE; c1tid = c1->type; c2tid = c2->type; if (c1tid == CT_FIXEDARRAY && c2tid == CT_ARRAY) { return (ctbase_almostEqual (ctype_getCtbase (c1->contents.farray->base), ctype_getCtbase (c2->contents.base))); } if (c2tid == CT_FIXEDARRAY && c1tid == CT_ARRAY) { return (ctbase_almostEqual (ctype_getCtbase (c1->contents.base), ctype_getCtbase (c2->contents.farray->base))); } if (c1tid != c2tid) return FALSE; switch (c1tid) { case CT_UNKNOWN: return TRUE; case CT_PRIM: return (cprim_equal (c1->contents.prim, c2->contents.prim)); case CT_BOOL: return TRUE; case CT_ABST: case CT_NUMABST: case CT_USER: return (typeId_equal (c1->contents.tid, c2->contents.tid)); case CT_ENUM: return (cstring_equal (c1->contents.cenum->tag, c2->contents.cenum->tag)); case CT_PTR: return (ctype_almostEqual (c1->contents.base, c2->contents.base)); case CT_FIXEDARRAY: return (ctype_almostEqual (c1->contents.farray->base, c2->contents.farray->base)); case CT_ARRAY: return (ctype_almostEqual (c1->contents.base, c2->contents.base)); case CT_FCN: return (ctype_almostEqual (c1->contents.fcn->rval, c2->contents.fcn->rval) && uentryList_matchParams (c1->contents.fcn->params, c2->contents.fcn->params, FALSE, TRUE)); case CT_STRUCT: case CT_UNION: if (!cstring_isEmpty (c1->contents.su->name)) { return (cstring_equal (c1->contents.su->name, c2->contents.su->name)); } else { if (!cstring_isEmpty (c2->contents.su->name)) { return FALSE; } llcontbuglit ("ctbase_almostEqual: match fields"); return (FALSE); } default: llcontbug (message ("ctbase_almostEqual: unknown type: %d\n", (int)c1tid)); return (FALSE); } } /*drl added July 02, 001 called by ctype_getArraySize */ size_t ctbase_getArraySize (ctbase ctb) { /*drl 1/25/2002 fixed discovered by Jim Francis */ ctbase r; llassert (ctbase_isDefined (ctb) ); r = ctbase_realType (ctb); llassert (ctbase_isFixedArray(r) ); return (r->contents.farray->size); } bool ctbase_isBigger (ctbase ct1, ctbase ct2) { if (ct1 != NULL && ct2 != NULL && (ct1->type == CT_PRIM && ct2->type == CT_PRIM)) { /* Only compare sizes for primitives */ cprim cp1 = ct1->contents.prim; cprim cp2 = ct2->contents.prim; int nbits1 = cprim_getExpectedBits (cp1); int nbits2 = cprim_getExpectedBits (cp2); if (nbits1 > nbits2) { return TRUE; } else { return FALSE; } } else { return FALSE; } } int ctbase_getSize (ctbase ct) { if (ct == NULL) { return 0; } switch (ct->type) { case CT_UNKNOWN: case CT_BOOL: case CT_PRIM: { cprim cp = ct->contents.prim; int nbits = cprim_getExpectedBits (cp); return nbits; } case CT_USER: case CT_ABST: case CT_NUMABST: case CT_EXPFCN: { return 0; } case CT_PTR: { /* Malloc returns void *, but they are bytes. Normal void * is pointer size. */ if (ctype_isVoid (ct->contents.base)) { return 8; } else { return ctype_getSize (ct->contents.base); } } case CT_FIXEDARRAY: case CT_ARRAY: case CT_FCN: case CT_STRUCT: case CT_UNION: case CT_ENUM: case CT_CONJ: break; BADDEFAULT; } return 0; } splint-3.1.2.dfsg1/src/cttable.i0000644021234200000250000003067707646432514014052 0ustar fax/* ;-*-C-*-; ** Splint - annotation-assisted static program checker ** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it ** under the terms of the GNU General Public License as published by the ** Free Software Foundation; either version 2 of the License, or (at your ** option) any later version. ** ** This program is distributed in the hope that it will be useful, but ** WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** General Public License for more details. ** ** The GNU General Public License is available from http://www.gnu.org/ or ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** ** For information on splint: info@splint.org ** To report a bug: splint-bug@splint.org ** For more information: http://www.splint.org */ /* ** cttable.i ** ** NOTE: This is not a stand-alone source file, but is included in ctype.c. ** (This is necessary becuase there is no other way in C to have a ** hidden scope, besides at the file level.) */ /*@access ctype@*/ /* ** type definitions and forward declarations in ctbase.i */ static void ctentry_free (/*@only@*/ ctentry c) { ctbase_free (c->ctbase); cstring_free (c->unparse); sfree (c); } static void cttable_reset (void) /*@globals cttab@*/ /*@modifies cttab@*/ { if (cttab.entries != NULL) { int i; for (i = 0; i < cttab.size; i++) { /*drl bee: si*/ ctentry_free (cttab.entries[i]); } /*@-compdestroy@*/ sfree (cttab.entries); /*@=compdestroy@*/ cttab.entries = NULL; } cttab.size = 0 ; cttab.nspace = 0 ; } static ctentry ctentry_makeNew (ctkind ctk, /*@only@*/ ctbase c) { return (ctentry_make (ctk, c, ctype_dne, ctype_dne, ctype_dne, cstring_undefined)); } static /*@only@*/ ctentry ctentry_make (ctkind ctk, /*@keep@*/ ctbase c, ctype base, ctype ptr, ctype array, /*@keep@*/ cstring unparse) /*@*/ { ctentry cte = (ctentry) dmalloc (sizeof (*cte)); cte->kind = ctk; cte->ctbase = c; cte->base = base; cte->ptr = ptr; cte->array = array; cte->unparse = unparse; return cte; } static cstring ctentry_unparse (ctentry c) { return (message ("%20s [%d] [%d] [%d]", (cstring_isDefined (c->unparse) ? c->unparse : cstring_makeLiteral ("")), c->base, c->ptr, c->array)); } static bool ctentry_isInteresting (ctentry c) { return (cstring_isNonEmpty (c->unparse)); } static /*@only@*/ cstring ctentry_dump (ctentry c) { DPRINTF (("Dumping: %s", ctentry_unparse (c))); if (c->ptr == ctype_dne && c->array == ctype_dne && c->base == ctype_dne) { return (message ("%d %q&", ctkind_toInt (c->kind), ctbase_dump (c->ctbase))); } else if (c->base == ctype_undefined && c->array == ctype_dne) { if (c->ptr == ctype_dne) { return (message ("%d %q!", ctkind_toInt (c->kind), ctbase_dump (c->ctbase))); } else { return (message ("%d %q^%d", ctkind_toInt (c->kind), ctbase_dump (c->ctbase), c->ptr)); } } else if (c->ptr == ctype_dne && c->array == ctype_dne) { return (message ("%d %q%d&", ctkind_toInt (c->kind), ctbase_dump (c->ctbase), c->base)); } else { return (message ("%d %q%d %d %d", ctkind_toInt (c->kind), ctbase_dump (c->ctbase), c->base, c->ptr, c->array)); } } static /*@only@*/ ctentry ctentry_undump (/*@dependent@*/ char *s) /*@requires maxRead(s) >= 2 @*/ { int base, ptr, array; ctkind kind; ctbase ct; kind = ctkind_fromInt (reader_getInt (&s)); ct = ctbase_undump (&s); if (reader_optCheckChar (&s, '&')) { base = ctype_dne; ptr = ctype_dne; array = ctype_dne; } else if (reader_optCheckChar (&s, '!')) { base = ctype_undefined; ptr = ctype_dne; array = ctype_dne; } else if (reader_optCheckChar (&s, '^')) { base = ctype_undefined; ptr = reader_getInt (&s); array = ctype_dne; } else { base = reader_getInt (&s); if (reader_optCheckChar (&s, '&')) { ptr = ctype_dne; array = ctype_dne; } else { ptr = reader_getInt (&s); array = reader_getInt (&s); } } /* can't unparse w/o typeTable */ return (ctentry_make (kind, ct, base, ptr, array, cstring_undefined)); } static /*@observer@*/ cstring ctentry_doUnparse (ctentry c) /*@modifies c@*/ { if (cstring_isDefined (c->unparse)) { return (c->unparse); } else { cstring s = ctbase_unparse (c->ctbase); if (!cstring_isEmpty (s) && !cstring_containsChar (s, '<')) { c->unparse = s; } else { cstring_markOwned (s); } return (s); } } static /*@observer@*/ cstring ctentry_doUnparseDeep (ctentry c) { if (cstring_isDefined (c->unparse)) { return (c->unparse); } else { c->unparse = ctbase_unparseDeep (c->ctbase); return (c->unparse); } } /* ** cttable operations */ static /*@only@*/ cstring cttable_unparse (void) { int i; cstring s = cstring_undefined; /*@access ctbase@*/ for (i = 0; i < cttab.size; i++) { /*drl bee: si*/ ctentry cte = cttab.entries[i]; if (ctentry_isInteresting (cte)) { if (ctbase_isUA (cte->ctbase)) { s = message ("%s%d\t%q [%d]\n", s, i, ctentry_unparse (cttab.entries[i]), cte->ctbase->contents.tid); } else { s = message ("%s%d\t%q\n", s, i, ctentry_unparse (cttab.entries[i])); } } } /*@noaccess ctbase@*/ return (s); } void cttable_print (void) { int i; /*@access ctbase@*/ for (i = 0; i < cttab.size; i++) { /*drl bee: si*/ ctentry cte = cttab.entries[i]; if (TRUE) /* ctentry_isInteresting (cte)) */ { if (ctbase_isUA (cte->ctbase)) { fprintf (g_warningstream, "%3d: %s [%d]\n", i, cstring_toCharsSafe (ctentry_doUnparse (cttab.entries[i])), cte->ctbase->contents.tid); } else { fprintf (g_warningstream, "%3d: %s\n", i, cstring_toCharsSafe (ctentry_doUnparse (cttab.entries[i]))); } } else { /* fprintf (g_warningstream, "%3d: \n", i); */ } } /*@noaccess ctbase@*/ } /* ** cttable_dump ** ** Output cttable for dump file */ static void cttable_dump (FILE *fout) { bool showdots = FALSE; int showdotstride = 0; int i; if (context_getFlag (FLG_SHOWSCAN) && cttab.size > 5000) { displayScanClose (); displayScanOpen (message ("Dumping type table (%d types)", cttab.size)); showdotstride = cttab.size / 5; showdots = TRUE; } for (i = 0; i < cttab.size; i++) { cstring s; /*drl bee: si*/ s = ctentry_dump (cttab.entries[i]); DPRINTF (("[%d] = %s", i, ctentry_unparse (cttab.entries[i]))); llassert (cstring_length (s) < MAX_DUMP_LINE_LENGTH); fputline (fout, cstring_toCharsSafe (s)); cstring_free (s); if (showdots && (i != 0 && ((i - 1) % showdotstride == 0))) { (void) fflush (g_warningstream); displayScanContinue (cstring_makeLiteralTemp (".")); (void) fflush (stderr); } } if (showdots) { displayScanClose (); displayScanOpen (cstring_makeLiteral ("Continuing dump ")); } } /* ** load cttable from init file */ static void cttable_load (FILE *f) /*@globals cttab @*/ /*@modifies cttab, f @*/ { char *s = mstring_create (MAX_DUMP_LINE_LENGTH); char *os = s; ctentry cte; cttable_reset (); /* DPRINTF (("Loading cttable: ")); cttable_print (); */ while (reader_readLine (f, s, MAX_DUMP_LINE_LENGTH) != NULL && *s == ';') { ; } if (mstring_length (s) == (MAX_DUMP_LINE_LENGTH - 1)) { llbug (message ("Library line too long: %s\n", cstring_fromChars (s))); } while (s != NULL && *s != ';' && *s != '\0') { ctype ct; /*drl bee: tcf*/ cte = ctentry_undump (s); ct = cttable_addFull (cte); DPRINTF (("Type: %d: %s", ct, ctype_unparse (ct))); if (ctbase_isConj (cte->ctbase) && !(ctbase_isExplicitConj (cte->ctbase))) { ctype_recordConj (ct); } s = reader_readLine (f, s, MAX_DUMP_LINE_LENGTH); } sfree (os); /* DPRINTF (("Done loading cttable: ")); cttable_print (); */ } /* ** cttable_init ** ** fill up the cttable with basic types, and first order derivations. ** this is done without using our constructors for efficiency reasons ** (probably bogus) ** */ /*@access cprim@*/ static void cttable_init (void) /*@globals cttab@*/ /*@modifies cttab@*/ { ctkind i; cprim j; ctbase ct = ctbase_undefined; llassert (cttab.size == 0); /* do for plain, pointer, arrayof */ for (i = CTK_PLAIN; i <= CTK_ARRAY; i++) { for (j = CTX_UNKNOWN; j <= CTX_LAST; j++) { if (i == CTK_PLAIN) { if (j == CTX_BOOL) { ct = ctbase_createBool (); /* why different? */ } else if (j == CTX_UNKNOWN) { ct = ctbase_createUnknown (); } else { ct = ctbase_createPrim ((cprim)j); } (void) cttable_addFull (ctentry_make (CTK_PLAIN, ct, ctype_undefined, j + CTK_PREDEFINED, j + CTK_PREDEFINED2, ctbase_unparse (ct))); } else { switch (i) { case CTK_PTR: ct = ctbase_makePointer (j); /*@switchbreak@*/ break; case CTK_ARRAY: ct = ctbase_makeArray (j); /*@switchbreak@*/ break; default: llbugexitlit ("cttable_init: base case"); } (void) cttable_addDerived (i, ct, j); } } } /**** reserve a slot for userBool ****/ (void) cttable_addFull (ctentry_make (CTK_INVALID, ctbase_undefined, ctype_undefined, ctype_dne, ctype_dne, cstring_undefined)); } /*@noaccess cprim@*/ static void cttable_grow () { int i; o_ctentry *newentries ; cttab.nspace = CTK_BASESIZE; newentries = (ctentry *) dmalloc (sizeof (*newentries) * (cttab.size + cttab.nspace)); if (newentries == NULL) { llfatalerror (message ("cttable_grow: out of memory. Size: %d", cttab.size)); } for (i = 0; i < cttab.size; i++) { /*drl bee: dm*/ /*drl bee: si*/ newentries[i] = cttab.entries[i]; } /*@-compdestroy@*/ sfree (cttab.entries); /*@=compdestroy@*/ cttab.entries = newentries; /*@-compdef@*/ } /*@=compdef@*/ static ctype cttable_addDerived (ctkind ctk, /*@keep@*/ ctbase cnew, ctype base) { if (cttab.nspace == 0) cttable_grow (); /*drl bee: si*/ cttab.entries[cttab.size] = ctentry_make (ctk, cnew, base, ctype_dne, ctype_dne, cstring_undefined); cttab.nspace--; return (cttab.size++); } static ctype cttable_addComplex (/*@only@*/ ctbase cnew) /*@modifies cttab; @*/ { /*@access ctbase@*/ if (cnew->type != CT_FCN && cnew->type != CT_EXPFCN) { ctype i; int ctstop = cttable_lastIndex () - DEFAULT_OPTLEVEL; if (ctstop < LAST_PREDEFINED) { ctstop = LAST_PREDEFINED; } for (i = cttable_lastIndex (); i >= ctstop; i--) /* better to go from back... */ { ctbase ctb; ctb = ctype_getCtbase (i); /* is this optimization really worthwhile? */ if (ctbase_isDefined (ctb) && ctbase_equivStrict (cnew, ctb)) { DPRINTF (("EQUIV!! %s / %s", ctbase_unparse (cnew), ctbase_unparse (ctb))); ctbase_free (cnew); return i; } } } if (cttab.nspace == 0) cttable_grow (); /*drl bee: si*/ cttab.entries[cttab.size] = ctentry_make (CTK_COMPLEX, cnew, ctype_undefined, ctype_dne, ctype_dne, cstring_undefined); cttab.nspace--; return (cttab.size++); /*@noaccess ctbase@*/ } static ctype cttable_addFull (ctentry cnew) { if (cttab.nspace == 0) { cttable_grow (); } /*drl bee: si*/ cttab.entries[cttab.size] = cnew; cttab.nspace--; return (cttab.size++); } static ctype cttable_addFullSafe (/*@only@*/ ctentry cnew) { int i; ctbase cnewbase = cnew->ctbase; llassert (ctbase_isDefined (cnewbase)); for (i = cttable_lastIndex (); i >= CT_FIRST; i--) { ctbase ctb = ctype_getCtbase (i); if (ctbase_isDefined (ctb) && ctbase_equiv (cnewbase, ctype_getCtbaseSafe (i))) { ctentry_free (cnew); return i; } } if (cttab.nspace == 0) cttable_grow (); /*drl bee: si*/ cttab.entries[cttab.size] = cnew; cttab.nspace--; return (cttab.size++); } splint-3.1.2.dfsg1/src/exprDataQuite.i0000644021234200000250000000377007305327777015214 0ustar fax /*this is a fake function so that compilers will not generate warning about functions that are defined but not used I should probablymake an exprData api instead but this a simpler and it restricts access to exprData */ /*@ignore@*/ static void fakeQuite1 (int x) { void* f; x = 1; x = x +6; llfatalbug ("fake function fakeQuite1 called"); f = (void *) fakeQuite1; f = (void *) exprData_free; f = (void *) exprData_freeShallow; f = (void *) exprData_getInitNode; f = (void *) exprData_getInitId; f = (void *) exprData_getIterSname; f = (void *) exprData_getIterAlist; f = (void *) exprData_getIterBody; f = (void *) exprData_getIterEname; f = (void *) exprData_getIterCallIter; f = (void *) exprData_getIterCallArgs; f = (void *) exprData_getCastNode; f = (void *) exprData_getCastTok; f = (void *) exprData_getCastType; f = (void *) exprData_getId; f = (void *) exprData_getTok; f = (void *) exprData_getOffsetType; f = (void *) exprData_getOffsetName; f = (void *) exprData_makeOp; f = (void *) exprData_makeUop; f = (void *) exprData_makeSingle; f = (void *) exprData_makeTok; f = (void *) exprData_makeIter; f = (void *) exprData_makeCall; f = (void *) exprData_makeIterCall; f = (void *) exprData_makeField; f = (void *) exprData_makeOffsetof; f = (void *) exprData_makeSizeofType; f = (void *) exprData_makeCast; f = (void *) exprData_makeInit; f = (void *) exprData_makeCond; f = (void *) exprData_makeFor; f = (void *) exprData_getPairA; f = (void *) exprData_getPairB; f = (void *) exprData_getFcn; f = (void *) exprData_getArgs; f = (void *) exprData_getTriplePred; f = (void *) exprData_getTripleInit; f = (void *) exprData_getTripleTrue; f = (void *) exprData_getTripleTest; f = (void *) exprData_getTripleFalse; f = (void *) exprData_getTripleInc; f = (void *) exprData_getFieldNode; f = (void *) exprData_getFieldName; f = (void *) exprData_getUopTok; f = (void *) exprData_getLiteral; f = (void *) exprData_getType; } /*@end@*/ splint-3.1.2.dfsg1/src/.splintrc0000644021234200000250000000245107646432513014105 0ustar fax-IHeaders -DDEBUGPRINT -systemdirs /usr/include:/usr/local/lib/:/usr/lib +allmacros # check all macros +checks # checks mode (moderately strict checking) ### Display Flags -locindentspaces 0 +showdeephistory +showscan +showsummary +stats +timedist +charindex -allglobals -export +voidabstract +forwarddecl +relaxquals +allmacros ### Assume all while and for loops execute at least once +loopexec ### Naming Convention +czech -czechconstants -enumprefix ~~* -uncheckedmacroprefix ~* ### global variables should start with g_ -globalprefix g_ +globalprefixexclude ### parameters in declarations should start with p_ -protoparamprefix p_ +protoparamprefixexclude ### these flags slow down checking a lot, ### only use on special occasions. ### +distinctinternalnames -internalnamecaseinsensitive +internalnamelookalike # -externalnamelen 24 +sizeoftype +repeatunrecog +topuse +deepbreak +needspec +evalorderuncon -mustmod +iso99limits +allempty +whileblock +forblock +elseifcomplete ### Limit maximimum include nesting -includenest 5 +posixlib ### this should be builtin to pp? -D__i386__ -D_M_IX86 -booltype bool -booltrue TRUE -boolfalse FALSE +numliteral +numabstractindex +numabstractlit -numabstractprint -indentspaces 3 #drl add 11-15-2001 +slashslashcomment splint-3.1.2.dfsg1/src/LICENSE0000644021234200000250000000005207121317325013235 0ustar faxSee ../LICENSE for licensing information. splint-3.1.2.dfsg1/lib/0000755021234200000250000000000010645776250012225 5ustar faxsplint-3.1.2.dfsg1/lib/Makefile.am0000644021234200000250000000371707512352620014257 0ustar fax## Note: starting comments with ## means they don't end up in Makefile ### Make phony, always remake everything. .PHONY: all standard.lcd standardstrict.lcd posix.lcd posixstrict.lcd unix.lcd unixstrict.lcd AUTOMAKE_OPTIONS = 1.5 foreign ## Put these files in $prefix/share/splint/lib splintlibdir = $(pkgdatadir)/lib UnixHeaders = stdio.h stdlib.h ## List of files splintlib_DATA = \ standard.h standard.lcd standardstrict.lcd posix.h posix.lcd posixstrict.lcd \ unix.h unix.lcd unixstrict.lcd CTrait.syms CTraitGen.lcl bool.h \ file.mts file.xh filerw.mts filerw.xh \ lclinit.lci linux.h lslinit.lsi tainted.mts tainted.xh \ stdio.h stdlib.h $(UnixHeaders) ## Include them in the distribution EXTRA_DIST = $(splintlib_DATA) ##get rid of lcd files if the user does a make clean CLEANFILES = posix.lcd standard.lcd unix.lcd \ posixstrict.lcd standardstrict.lcd unixstrict.lcd ## Rules to make splint & the dumps SPLINT = $(top_builddir)/src/splint$(EXEEXT) $(SPLINT): cd $(top_builddir)/src; $(MAKE) all: standard.lcd standardstrict.lcd posix.lcd posixstrict.lcd unix.lcd unixstrict.lcd standard.lcd: standard.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj standard.h -dump standard @touch $@ standardstrict.lcd: standard.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj -DSTRICT standard.h -dump standardstrict @touch $@ posix.lcd: standard.h posix.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj standard.h posix.h -dump posix @touch $@ posixstrict.lcd: standard.h posix.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj -DSTRICT standard.h posix.h -dump posixstrict @touch $@ unix.lcd: standard.h posix.h unix.h $(UnixHeaders) $(SPLINT) -$(SPLINT) -supcounts -nof -incondefs -nolib +impconj standard.h posix.h unix.h stdio.h stdlib.h -dump unix @touch $@ unixstrict.lcd: standard.h posix.h unix.h $(UnixHeaders) $(SPLINT) -$(SPLINT) -supcounts -nof -incondefs -nolib +impconj -DSTRICT standard.h posix.h unix.h stdio.h stdlib.h -dump unixstrict @touch $@ splint-3.1.2.dfsg1/lib/Makefile.in0000644021234200000250000001773610645765160014306 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ ### Make phony, always remake everything. SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.5 foreign splintlibdir = $(pkgdatadir)/lib UnixHeaders = stdio.h stdlib.h splintlib_DATA = \ standard.h standard.lcd standardstrict.lcd posix.h posix.lcd posixstrict.lcd \ unix.h unix.lcd unixstrict.lcd CTrait.syms CTraitGen.lcl bool.h \ file.mts file.xh filerw.mts filerw.xh \ lclinit.lci linux.h lslinit.lsi tainted.mts tainted.xh \ stdio.h stdlib.h $(UnixHeaders) EXTRA_DIST = $(splintlib_DATA) CLEANFILES = posix.lcd standard.lcd unix.lcd \ posixstrict.lcd standardstrict.lcd unixstrict.lcd SPLINT = $(top_builddir)/src/splint$(EXEEXT) subdir = lib mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(splintlib_DATA) DIST_COMMON = Makefile.am Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: splintlibDATA_INSTALL = $(INSTALL_DATA) install-splintlibDATA: $(splintlib_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(splintlibdir) @list='$(splintlib_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(splintlibDATA_INSTALL) $$d$$p $(DESTDIR)$(splintlibdir)/$$f"; \ $(splintlibDATA_INSTALL) $$d$$p $(DESTDIR)$(splintlibdir)/$$f; \ done uninstall-splintlibDATA: @$(NORMAL_UNINSTALL) @list='$(splintlib_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(splintlibdir)/$$f"; \ rm -f $(DESTDIR)$(splintlibdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(splintlibdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-splintlibDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-info-am uninstall-splintlibDATA .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-splintlibDATA install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ uninstall uninstall-am uninstall-info-am \ uninstall-splintlibDATA .PHONY: all standard.lcd standardstrict.lcd posix.lcd posixstrict.lcd unix.lcd unixstrict.lcd $(SPLINT): cd $(top_builddir)/src; $(MAKE) all: standard.lcd standardstrict.lcd posix.lcd posixstrict.lcd unix.lcd unixstrict.lcd standard.lcd: standard.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj standard.h -dump standard @touch $@ standardstrict.lcd: standard.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj -DSTRICT standard.h -dump standardstrict @touch $@ posix.lcd: standard.h posix.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj standard.h posix.h -dump posix @touch $@ posixstrict.lcd: standard.h posix.h $(SPLINT) -$(SPLINT) -nof -nolib +impconj -DSTRICT standard.h posix.h -dump posixstrict @touch $@ unix.lcd: standard.h posix.h unix.h $(UnixHeaders) $(SPLINT) -$(SPLINT) -supcounts -nof -incondefs -nolib +impconj standard.h posix.h unix.h stdio.h stdlib.h -dump unix @touch $@ unixstrict.lcd: standard.h posix.h unix.h $(UnixHeaders) $(SPLINT) -$(SPLINT) -supcounts -nof -incondefs -nolib +impconj -DSTRICT standard.h posix.h unix.h stdio.h stdlib.h -dump unixstrict @touch $@ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/lib/standard.h0000644021234200000250000011453410125301726014167 0ustar fax/* ** standard.h --- ISO C99 Standard Library for Splint. ** ** Process with -DSTRICT to get strict library. */ /*@-nextlinemacros@*/ /*@+allimponly@*/ /*@+globsimpmodifiesnothing@*/ /* ** errno.h */ /*@constant int EDOM;@*/ /*@constant int ERANGE;@*/ /*@constant int EILSEQ;@*/ # ifdef STRICT /*@checkedstrict@*/ int errno; # else /*@unchecked@*/ int errno; # endif /* ** stdbool.h */ /*@-likelybool@*/ typedef _Bool bool; /*@=likelybool@*/ /*@constant bool true@*/ /*@constant bool false@*/ /*@constant int __bool_true_false_are_defined = 1@*/ /* ** types */ typedef /*@integraltype@*/ ptrdiff_t; typedef /*@unsignedintegraltype@*/ size_t; typedef /*@signedintegraltype@*/ ssize_t; typedef /*@integraltype@*/ wchar_t; /* ** Added by Amendment 1 to ISO. */ typedef /*@integraltype@*/ wint_t; typedef /*@abstract@*/ mbstate_t; /*@constant null anytype NULL = 0;@*/ /* ** assert.h */ /*@constant _Bool NDEBUG;@*/ # ifdef STRICT /*@falseexit@*/ void assert (/*@sef@*/ _Bool e) /*@*/ ; # else /*@falseexit@*/ void assert (/*@sef@*/ _Bool /*@alt int@*/ e) /*@*/ ; # endif /* ** ctype.h */ # ifdef STRICT _Bool isalnum (int c) /*@*/ ; _Bool isalpha (int c) /*@*/ ; _Bool iscntrl (int c) /*@*/ ; _Bool isdigit (int c) /*@*/ ; _Bool isgraph (int c) /*@*/ ; _Bool islower (int c) /*@*/ ; _Bool isprint (int c) /*@*/ ; _Bool ispunct (int c) /*@*/ ; _Bool isspace (int c) /*@*/ ; _Bool isupper (int c) /*@*/ ; _Bool isxdigit (int c) /*@*/ ; char tolower (int c) /*@*/ ; char toupper (int c) /*@*/ ; # else /* ** evans 2002-01-03: added alt char (was alt unsigned char) */ _Bool /*@alt int@*/ isalnum (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ isalpha (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ iscntrl (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ isdigit (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ isgraph (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ islower (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ isprint (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ ispunct (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ isspace (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ isupper (int /*@alt char, unsigned char@*/ c) /*@*/ ; _Bool /*@alt int@*/ isxdigit (int /*@alt char, unsigned char@*/ c) /*@*/ ; char /*@alt int@*/ tolower (int /*@alt char, unsigned char@*/ c) /*@*/ ; char /*@alt int@*/ toupper (int /*@alt char, unsigned char@*/ c) /*@*/ ; # endif /* ** locale.h */ struct lconv { char *decimal_point; char *thousands_sep; char *grouping; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_precedes; char n_sep_by_space; char p_sign_posn; char n_sign_posn; } ; /*@constant int LC_ALL;@*/ /*@constant int LC_COLLATE;@*/ /*@constant int LC_CTYPE;@*/ /*@constant int LC_MONETARY;@*/ /*@constant int LC_NUMERIC;@*/ /*@constant int LC_TIME;@*/ /*@observer@*/ /*@null@*/ char *setlocale (int category, /*@null@*/ char *locale) /*@modifies internalState, errno@*/ ; struct lconv *localeconv (void) /*@*/ ; /* ** float.h */ /* ** Note, these are defined by macros, but NOT necessarily ** constants. They may be used as lvalues. */ /*@unchecked@*/ int DBL_DIG; /*@unchecked@*/ double DBL_EPSILON; /*@unchecked@*/ int DBL_MANT_DIG; /*@unchecked@*/ double DBL_MAX; /*@unchecked@*/ int DBL_MAX_10_EXP; /*@unchecked@*/ int DBL_MAX_EXP; /*@unchecked@*/ double DBL_MIN; /*@unchecked@*/ int DBL_MIN_10_EXP; /*@unchecked@*/ int DBL_MIN_EXP; /*@unchecked@*/ int FLT_DIG; /*@unchecked@*/ float FLT_EPSILON; /*@unchecked@*/ int FLT_MANT_DIG; /*@unchecked@*/ float FLT_MAX; /*@unchecked@*/ int FLT_MAX_10_EXP; /*@unchecked@*/ int FLT_MAX_EXP; /*@unchecked@*/ float FLT_MIN; /*@unchecked@*/ int FLT_MIN_10_EXP; /*@unchecked@*/ int FLT_MIN_EXP; /*@constant int FLT_RADIX@*/ /*@unchecked@*/ int FLT_ROUNDS; /*@unchecked@*/ int LDBL_DIG; /*@unchecked@*/ long double LDBL_EPSILON; /*@unchecked@*/ int LDBL_MANT_DIG; /*@unchecked@*/ long double LDBL_MAX; /*@unchecked@*/ int LDBL_MAX_10_EXP; /*@unchecked@*/ int LDBL_MAX_EXP; /*@unchecked@*/ long double LDBL_MIN; /*@unchecked@*/ int LDBL_MIN_10_EXP; /*@unchecked@*/ int LDBL_MIN_EXP; /* ** limits.h */ /*@constant int CHAR_BIT; @*/ /*@constant char CHAR_MAX; @*/ /*@constant char CHAR_MIN; @*/ /*@constant int INT_MAX; @*/ /*@constant int INT_MIN; @*/ /*@constant long int LONG_MAX; @*/ /*@constant long int LONG_MIN; @*/ /*@constant long int MB_LEN_MAX@*/ /*@constant signed char SCHAR_MAX; @*/ /*@constant signed char SCHAR_MIN; @*/ /*@constant short SHRT_MAX; @*/ /*@constant short SHRT_MIN; @*/ /*@constant unsigned char UCHAR_MAX; @*/ /*@constant unsigned char UCHAR_MIN; @*/ /*@constant unsigned int UINT_MAX; @*/ /*@constant unsigned long ULONG_MAX; @*/ /*@constant unsigned short USHRT_MAX; @*/ /* ** math.h ** ** evans 2002-07-03: updated from ISO C99 (http://www.vmunix.com/~gabor/c/draft.html) */ typedef float float_t; typedef double double_t; /*@constant double HUGE_VAL; @*/ /*@constant float HUGE_VALF; @*/ /*@constant long double HUGE_VALL; @*/ /*@constant float INFINITY; @*/ /*@constant float NAN; @*/ /*:warn implementationoptional "NAN is defined if and only if the implementation supports quiet float type NaNs.":*/ ; /*@constant int FP_INFINITE;@*/ /*@constant int FP_NAN;@*/ /*@constant int FP_NORMAL;@*/ /*@constant int FP_SUBNORMAL;@*/ /*@constant int FP_ZERO;@*/ /*@constant int FP_ILOGB0;@*/ /*@constant int FP_ILOGBNAN;@*/ /*@constant int DECIMAL_DIG;@*/ /* Defined for specs only - this type is any real type */ typedef float /*@alt double, long double@*/ s_real_t; int fpclassify (/*@sef@*/ s_real_t) /*@*/ ; int signbit (/*@sef@*/ s_real_t) /*@*/ ; int isfinite (/*@sef@*/ s_real_t) /*@*/ ; int isnormal (/*@sef@*/ s_real_t) /*@*/ ; int isnan (/*@sef@*/ s_real_t) /*@*/ ; int isinf (/*@sef@*/ s_real_t) /*@*/ ; /* ** math functions that may have a range error modify errno (implementation defined). */ double acos (double x) /*@modifies errno@*/ ; double asin (double x) /*@modifies errno@*/ ; double atan (double x) /*@*/ ; double atan2 (double y, double x) /*@*/ ; double cos (double x) /*@*/ ; double sin (double x) /*@*/ ; double tan (double x) /*@*/ ; double cosh (double x) /*@modifies errno@*/ ; double sinh (double x) /*@modifies errno@*/ ; double tanh (double x) /*@*/ ; double acosh (double x) /*@modifies errno@*/ ; double asinh (double x) /*@modifies errno@*/ ; double atanh (double x) /*@modifies errno@*/ ; double exp (double x) /*@modifies errno@*/ ; double frexp (double x, /*@out@*/ int *xp) /*@modifies *xp;@*/ ; double ldexp (double x, int n) /*@modifies errno@*/ ; double log (double x) /*@modifies errno@*/ ; double log10 (double x) /*@modifies errno@*/ ; double modf (double x, /*@out@*/ double *ip) /*@modifies *ip;@*/ ; double exp2 (double x) /*@modifies errno@*/ ; double expm1 (double x) /*@modifies errno@*/ ; double log1p (double x) /*@modifies errno@*/ ; double log2 (double x) /*@modifies errno@*/ ; double logb (double x) /*@modifies errno@*/ ; double scalbn (double x, int n) /*@modifies errno@*/ ; double scalbln (double x, long int n) /*@modifies errno@*/ ; long double scalblnl(long double x, long int n) /*@modifies errno@*/ ; int ilogb (double x) /*@modifies errno@*/ ; int ilogbf (float x) /*@modifies errno@*/ ; int ilogbl (long double x) /*@modifies errno@*/ ; double fabs (double x) /*@*/ ; float fabsf (float x) /*@*/ ; long double fabsl (long double x) /*@*/ ; double pow (double x, double y) /*@modifies errno@*/ ; float powf(float x, float y) /*@modifies errno@*/ ; long double powl(long double x, long double y) /*@modifies errno@*/ ; double sqrt (double x) /*@modifies errno@*/ ; float sqrtf(float x) /*@modifies errno@*/ ; long double sqrtl (long double x) /*@modifies errno@*/ ; double cbrt (double x) /*@*/ ; float cbrtf (float x) /*@*/ ; long double cbrtl (long double x) /*@*/ ; double hypot (double x, double y) /*@modifies errno@*/ ; float hypotf (float x, float y) /*@modifies errno@*/ ; long double hypotl (long double x, long double y) /*@modifies errno@*/ ; double erf (double x) /*@*/ ; double erfc (double x) /*@*/ ; float erff (float x) /*@*/ ; long double erfl (long double x) /*@*/ ; float erfcf (float x) /*@*/ ; long double erfcl (long double x) /*@*/ ; double gamma (double x) /*@modifies errno@*/ ; float gammaf(float x) /*@modifies errno@*/ ; long double gammal (long double x) /*@modifies errno@*/ ; double lgamma (double x) /*@modifies errno@*/ ; float lgammaf (float x) /*@modifies errno@*/ ; long double lgammal (long double x) /*@modifies errno@*/ ; double ceil (double x) /*@*/ ; float ceilf(float x) /*@*/ ; long double ceill(long double x) /*@*/ ; double floor (double x) /*@*/ ; float floorf (float x) /*@*/ ; long double floorl (long double x) /*@*/ ; double nearbyint (double x) /*@*/ ; float nearbyintf (float x) /*@*/ ; long double nearbyintl (long double x) /*@*/ ; double rint (double x) /*@*/; float rintf (float x) /*@*/ ; long double rintl (long double x) /*@*/ ; long int lrint (double x) /*@modifies errno@*/ ; long int lrintf (float x) /*@modifies errno@*/ ; long int lrintl (long double x) /*@modifies errno@*/ ; long long llrint (double x) /*@modifies errno@*/ ; long long llrintf(float x) /*@modifies errno@*/ ; long long llrintl(long double x) /*@modifies errno@*/ ; double round (double x) /*@*/ ; long int lround (double x) /*@modifies errno@*/ ; long long llround (double x) /*@modifies errno@*/ ; double trunc (double x) /*@*/ ; double fmod (double x, double y) /*@*/ ; double remainder (double x, double y) /*@*/ ; double remquo (double x, double y, /*@out@*/ int *quo) /*@modifies *quo@*/ ; double copysign (double x, double y) /*@*/ ; double nan (/*@nullterminated@*/ const char *tagp) /*@*/ ; double nextafter (double x, double y) /*@*/ ; double nextafterx (double x, long double y) /*@*/ ; double fdim (double x, double y) /*@modifies errno@*/ ; double fmax (double x, double y) /*@*/ ; double fmin (double x, double y) /*@*/ ; double fma (double x, double y, double z) /*@*/ ; int isgreater (s_real_t x, s_real_t y) /*@*/ ; int isgreaterequal (s_real_t x, s_real_t y) /*@*/ ; int isless (s_real_t x, s_real_t y) /*@*/ ; int islessequal (s_real_t x, s_real_t y) /*@*/ ; int islessgreater (s_real_t x, s_real_t y) /*@*/ ; int isunordered (s_real_t x, s_real_t y) /*@*/ ; /* ** These functions are optional in iso C. An implementation does not ** have to provide them. They are included in comments here, but ** are not required to be part of the standard library. */ # ifdef OPTIONAL_MATH float acosf (float x) /*@modifies errno@*/ ; long double acosl (long double x) /*@modifies errno@*/ ; float asinf (float x) /*@modifies errno@*/ ; long double asinl (long double x) /*@modifies errno@*/ ; float atanf (float x) /*@*/ ; long double atanl (long double x) /*@*/ ; float atan2f (float y, float x) /*@*/ ; long double atan2l (long double y, long double x) /*@*/ ; float ceilf (float x) /*@*/ ; long double ceill (long double x) /*@*/ ; float cosf (float x) /*@*/ ; long double cosl (long double x) /*@*/ ; float coshf (float x) /*@modifies errno@*/ ; long double coshl (long double x) /*@modifies errno@*/ ; float expf (float x) /*@modifies errno@*/ ; long double expl (long double x) /*@modifies errno@*/; float fabsf (float x) /*@*/ ; long double fabsl (long double x) /*@*/ ; float floorf (float x) /*@*/ ; long double floorl (long double x) /*@*/ ; float fmodf (float x, float y) /*@*/ ; long double fmodl (long double x, long double y) /*@*/ ; float frexpf (float x, /*@out@*/ int *xp) /*@modifies *xp@*/; long double frexpl (long double x, /*@out@*/ int *xp) /*@modifies *xp@*/; float ldexpf (float x, int n) /*@modifies errno@*/ ; long double ldexpl (long double x, int n) /*@modifies errno@*/ ; float logf (float x) /*@modifies errno@*/ ; long double logl (long double x) /*@modifies errno@*/ ; float log10f (float x) /*@modifies errno@*/; long double log10l (long double x) /*@modifies errno@*/; float modff (float x, /*@out@*/ float *xp) /*@modifies *xp@*/ ; long double modfl (long double x, /*@out@*/ long double *xp) /*@modifies *xp@*/ ; float powf (float x, float y) /*@modifies errno@*/ ; long double powl (long double x, long double y) /*@modifies errno@*/ ; float sinf (float x) /*@*/ ; long double sinl (long double x) /*@*/ ; float sinhf (float x) /*@*/ ; long double sinhl (long double x) /*@*/ ; float sqrtf (float x) /*@modifies errno@*/ ; long double sqrtl (long double x) /*@modifies errno@*/ ; float tanf (float x) /*@*/ ; long double tanl (long double x) /*@*/ ; float tanhf (float x) /*@*/ ; long double tanhl (long double x) /*@*/ ; # endif /* ** setjmp.h */ typedef /*@abstract@*/ /*@mutable@*/ void *jmp_buf; int setjmp (/*@out@*/ jmp_buf env) /*@modifies env;@*/ ; /*@mayexit@*/ void longjmp (jmp_buf env, int val) /*@*/ ; /* ** signal.h */ /*@constant int SIGABRT; @*/ /*@constant int SIGFPE; @*/ /*@constant int SIGILL; @*/ /*@constant int SIGINT; @*/ /*@constant int SIGSEGV; @*/ /*@constant int SIGTERM; @*/ typedef /*@integraltype@*/ sig_atomic_t; /*@constant void (*SIG_DFL)(int); @*/ /*@constant void (*SIG_ERR)(int); @*/ /*@constant void (*SIG_IGN)(int); @*/ /* ** signal takes an int, and a function takes int returns void, and ** returns the function (or NULL if unsuccessful). */ /*@null@*/ void (*signal (int sig, /*@null@*/ void (*func)(int))) (int) /*@modifies internalState, errno;@*/ ; /*@mayexit@*/ int raise (int sig) ; /* ** stdarg.h */ typedef /*@abstract@*/ /*@mutable@*/ void *va_list; void va_start (/*@out@*/ va_list ap, ...) /*@modifies ap;@*/ ; void va_end (va_list va) /*@modifies va;@*/ ; void va_copy (/*@out@*/ va_list dest, va_list src) /*modifies dest;@*/ ; /* ** va_arg is builtin */ /* ** stdio.h */ typedef /*@abstract@*/ /*@mutable@*/ void *FILE; typedef /*@abstract@*/ /*@mutable@*/ void *fpos_t; /*@constant size_t _IOFBF; @*/ /*@constant size_t _IOLBF; @*/ /*@constant size_t _IONBF; @*/ /*@constant size_t BUFSIZ; @*/ /* evans 2002-02-27 change suggested by Walter Briscoe */ /*@constant int EOF; @*/ /*@constant int FOPEN_MAX; @*/ /*@constant int FILENAME_MAX; @*/ /*@constant int L_tmpnam; @*/ /*@constant int SEEK_CUR; @*/ /*@constant int SEEK_END; @*/ /*@constant int SEEK_SET; @*/ /*@constant int TMP_MAX; @*/ # ifdef STRICT /*@checked@*/ FILE *stderr; /*@checked@*/ FILE *stdin; /*@checked@*/ FILE *stdout; # else /*@unchecked@*/ FILE *stderr; /*@unchecked@*/ FILE *stdin; /*@unchecked@*/ FILE *stdout; # endif int remove (char *filename) /*@modifies fileSystem, errno@*/ ; int rename (char *old, char *new) /*@modifies fileSystem, errno@*/ ; /*@dependent@*/ /*@null@*/ FILE *tmpfile (void) /*@modifies fileSystem, errno@*/ ; /*@observer@*/ char * tmpnam (/*@out@*/ /*@null@*/ /*@returned@*/ char *s) /*@modifies *s, internalState@*/ ; int fclose (FILE *stream) /*@modifies *stream, errno, fileSystem;@*/ ; int fflush (/*@null@*/ FILE *stream) /*@modifies *stream, errno, fileSystem;@*/ ; /*@null@*/ /*@dependent@*/ FILE *fopen (char *filename, char *mode) /*@modifies fileSystem@*/ ; /*@dependent@*/ /*@null@*/ FILE *freopen (char *filename, char *mode, FILE *stream) /*@modifies *stream, fileSystem, errno@*/ ; void setbuf (FILE *stream, /*@null@*/ /*@exposed@*/ /*@out@*/ char *buf) /*@modifies fileSystem, *stream, *buf@*/ /*:errorcode != 0*/ ; /*:requires maxSet(buf) >= (BUFSIZ - 1):*/ ; int setvbuf (FILE *stream, /*@null@*/ /*@exposed@*/ /*@out@*/ char *buf, int mode, size_t size) /*@modifies fileSystem, *stream, *buf@*/ /*@requires maxSet(buf) >= (size - 1) @*/ ; # ifdef STRICT /*@printflike@*/ int fprintf (FILE *stream, char *format, ...) /*@modifies fileSystem, *stream@*/ ; # else /*@printflike@*/ int /*@alt void@*/ fprintf (FILE *stream, char *format, ...) /*@modifies fileSystem, *stream@*/ ; # endif /*@scanflike@*/ int fscanf (FILE *stream, char *format, ...) /*@modifies fileSystem, *stream, errno@*/ ; # ifdef STRICT /*@printflike@*/ int printf (char *format, ...) /*@globals stdout@*/ /*@modifies fileSystem, *stdout@*/ ; # else /*@printflike@*/ int /*@alt void@*/ printf (char *format, ...) /*@globals stdout@*/ /*@modifies fileSystem, *stdout@*/ ; # endif /*@scanflike@*/ int scanf(char *format, ...) /*@globals stdin@*/ /*@modifies fileSystem, *stdin, errno@*/ ; /*drl added errno 09-19-2001 */ ; # ifdef STRICT /*@printflike@*/ int sprintf (/*@out@*/ char *s, char *format, ...) /*@warn bufferoverflowhigh "Buffer overflow possible with sprintf. Recommend using snprintf instead"@*/ /*@modifies *s@*/ ; # else /*@printflike@*/ int /*@alt void@*/ sprintf (/*@out@*/ char *s, char *format, ...) /*@warn bufferoverflowhigh "Buffer overflow possible with sprintf. Recommend using snprintf instead"@*/ /*@modifies *s@*/ ; # endif /* evans 2002-07-09: snprintf added to standard.h (from unix.h) */ /*@printflike@*/ int snprintf (/*@out@*/ char * restrict s, size_t n, const char * restrict format, ...) /*@modifies s@*/ /*@requires maxSet(s) >= (n - 1)@*/ ; /*@scanflike@*/ int sscanf (/*@out@*/ char *s, char *format, ...) /*@modifies errno@*/ ; /* modifies extra arguments */ int vprintf (const char *format, va_list arg) /*@globals stdout@*/ /*@modifies fileSystem, *stdout@*/ ; int vfprintf (FILE *stream, char *format, va_list arg) /*@modifies fileSystem, *stream, arg, errno@*/ ; int vsprintf (/*@out@*/ char *str, const char *format, va_list ap) /*@warn bufferoverflowhigh "Use vsnprintf instead"@*/ /*@modifies str@*/ ; int vsnprintf (/*@out@*/ char *str, size_t size, const char *format, va_list ap) /*@requires maxSet(str) >= (size - 1)@*/ /* drl - this was size, size-1 in stdio.h */ /*@modifies str@*/ ; int fgetc (FILE *stream) /*@modifies fileSystem, *stream, errno@*/ ; /*@null@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, FILE *stream) /*@modifies fileSystem, *s, *stream, errno@*/ /*@requires maxSet(s) >= (n -1); @*/ /*@ensures maxRead(s) <= (n -1) /\ maxRead(s) >= 0; @*/ ; int fputc (int /*@alt char@*/ c, FILE *stream) /*:errorcode EOF:*/ /*@modifies fileSystem, *stream, errno@*/ ; int fputs (char *s, FILE *stream) /*@modifies fileSystem, *stream@*/ ; /* note use of sef --- stream may be evaluated more than once */ int getc (/*@sef@*/ FILE *stream) /*@modifies fileSystem, *stream, errno@*/ ; int getchar (void) /*@globals stdin@*/ /*@modifies fileSystem, *stdin, errno@*/ ; /*@null@*/ char *gets (/*@out@*/ char *s) /*@warn bufferoverflowhigh "Use of gets leads to a buffer overflow vulnerability. Use fgets instead"@*/ /*@globals stdin@*/ /*@modifies fileSystem, *s, *stdin, errno@*/ ; int putc (int /*@alt char@*/ c, /*@sef@*/ FILE *stream) /*:errorcode EOF:*/ /*@modifies fileSystem, *stream, errno;@*/ ; int putchar (int /*@alt char@*/ c) /*:errorcode EOF:*/ /*@globals stdout@*/ /*@modifies fileSystem, *stdout, errno@*/ ; int puts (const char *s) /*:errorcode EOF:*/ /*@globals stdout@*/ /*@modifies fileSystem, *stdout, errno@*/ ; int ungetc (int /*@alt char@*/ c, FILE *stream) /*@modifies fileSystem, *stream@*/ ; /*drl REMOVED errno 09-19-2001*/ size_t fread (/*@out@*/ void *ptr, size_t size, size_t nobj, FILE *stream) /*@modifies fileSystem, *ptr, *stream, errno@*/ /*requires maxSet(ptr) >= (size - 1) @*/ /*@ensures maxRead(ptr) == (size - 1) @*/ ; size_t fwrite (void *ptr, size_t size, size_t nobj, FILE *stream) /*@modifies fileSystem, *stream, errno@*/ /*@requires maxRead(ptr) >= size @*/ ; int fgetpos (FILE *stream, /*@out@*/ fpos_t *pos) /*@modifies *pos, errno@*/ /*@requires maxSet(pos) >= 0@*/ /*@ensures maxRead(pos) >= 0 @*/; int fseek (FILE *stream, long int offset, int whence) /*:errorcode -1:*/ /*@modifies fileSystem, *stream, errno@*/ ; int fsetpos (FILE *stream, fpos_t *pos) /*@modifies fileSystem, *stream, errno@*/ ; long int ftell(FILE *stream) /*:errorcode -1:*/ /*@modifies errno*/ ; void rewind (FILE *stream) /*@modifies *stream@*/ ; void clearerr (FILE *stream) /*@modifies *stream@*/ ; int feof (FILE *stream) /*@modifies errno@*/ ; int ferror (FILE *stream) /*@modifies errno@*/ ; void perror (/*@null@*/ char *s) /*@globals errno, stderr@*/ /*@modifies fileSystem, *stderr@*/ ; /* ** stdlib.h */ double atof (char *s) /*@*/ ; int atoi (char *s) /*@*/ ; long int atol (char *s) /*@*/ ; double strtod (char *s, /*@null@*/ /*@out@*/ char **endp) /*@modifies *endp, errno@*/ ; long strtol (char *s, /*@null@*/ /*@out@*/ char **endp, int base) /*@modifies *endp, errno@*/ ; unsigned long strtoul (char *s, /*@null@*/ /*@out@*/ char **endp, int base) /*@modifies *endp, errno@*/ ; /*@constant int RAND_MAX; @*/ int rand (void) /*@modifies internalState@*/ ; void srand (unsigned int seed) /*@modifies internalState@*/ ; /* drl changed 12/29/2000 */ /*@null@*/ /*@only@*/ void *calloc (size_t nobj, size_t size) /*@*/ /*@ensures maxSet(result) == (nobj - 1); @*/ ; /*@null@*/ /*@out@*/ /*@only@*/ void *malloc (size_t size) /*@*/ /*@ensures maxSet(result) == (size - 1); @*/ ; /*end drl changed */ /* 11 June 1997: removed out on return value */ # if 0 /*@null@*/ /*@only@*/ void * realloc (/*@null@*/ /*@only@*/ /*@special@*/ void *p, size_t size) /*@releases p@*/ /*@modifies *p@*/ /*@ensures maxSet(result) == (size - 1) @*/; # endif /* ** LCLint annotations cannot fully describe realloc. The semantics we ** want are: ** realloc returns null: ownership of parameter is not changed ** realloc returns non-null: ownership of parameter is transferred to return value ** ** Otherwise, storage is in the same state before and after the call. */ /*@null@*/ /*@only@*/ void * realloc (/*@null@*/ /*@only@*/ /*@out@*/ /*@returned@*/ void *p, size_t size) /*@modifies *p@*/ /*@ensures maxSet(result) >= (size - 1) @*/; void free (/*@null@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies p@*/ ; /*@constant int EXIT_FAILURE; @*/ /*@constant int EXIT_SUCCESS; @*/ /*@exits@*/ void abort (void) /*@*/ ; /*@exits@*/ void exit (int status) /*@*/ ; int atexit (void (*func)(void)) /*@modifies internalState@*/ ; /*@observer@*/ /*@null@*/ char *getenv (char *name) /*@*/ ; int system (/*@null@*/ char *s) /*@modifies fileSystem@*/ ; /*@null@*/ /*@dependent@*/ void * bsearch (void *key, void *base, size_t n, size_t size, int (*compar)(void *, void *)) /*@*/ ; void qsort (void *base, size_t n, size_t size, int (*compar)(void *, void *)) /*@modifies *base, errno@*/ ; int abs (int n) /*@*/ ; typedef /*@concrete@*/ struct { int quot; int rem; } div_t ; div_t div (int num, int denom) /*@*/ ; long int labs (long int n) /*@*/ ; typedef /*@concrete@*/ struct { long int quot; long int rem; } ldiv_t ; ldiv_t ldiv (long num, long denom) /*@*/ ; /*@constant size_t MB_CUR_MAX; @*/ /* ** wchar_t and wint_t functions added by Amendment 1 to ISO. */ /*@constant int WCHAR_MAX@*/ /*@constant int WCHAR_MIN@*/ /*@constant wint_t WEOF@*/ wint_t btowc (int c) /*@*/ ; wint_t fgetwc (FILE *fp) /*@modifies fileSystem, *fp*/ ; /*@null@*/ wchar_t *fgetws (/*@returned@*/ wchar_t *s, int n, FILE *stream) /*@modifies fileSystem, *s, *stream@*/; wint_t fputwc (wchar_t c, FILE *stream) /*@modifies fileSystem, *stream@*/; int fputws (const wchar_t *s, FILE *stream) /*@modifies fileSystem, *stream@*/ ; int fwide (FILE *stream, int mode) /*@*/ ; /* does not modify the stream */ /*@printflike@*/ int fwprintf (FILE *stream, const wchar_t *format, ...) /*@modifies *stream, fileSystem@*/ ; /*@scanflike@*/ int fwscanf (FILE *stream, const wchar_t *format, ...) /*@modifies *stream, fileSystem@*/ ; /* note use of sef --- stream may be evaluated more than once */ wint_t getwc (/*@sef@*/ FILE *stream) /*@modifies fileSystem, *stream@*/ ; wint_t getwchar (void) /*@modifies fileSystem, *stdin@*/; size_t mbrlen (const char *s, size_t n, /*@null@*/ mbstate_t *ps) /*@*/ ; size_t mbrtowc (/*@null@*/ wchar_t *pwc, const char *s, size_t n, /*@null@*/ mbstate_t *ps) /*@modifies *pwc@*/ ; int mbsinit (/*@null@*/ const mbstate_t *ps) /*@*/ ; size_t mbsrtowcs (/*@null@*/ wchar_t *dst, const char **src, size_t len, /*@null@*/ mbstate_t *ps) /*@modifies *dst@*/ ; /* note use of sef --- stream may be evaluated more than once */ wint_t putwc (wchar_t c, /*@sef@*/ FILE *stream) /*@modifies fileSystem, *stream@*/ ; wint_t putwchar (wchar_t c) /*@modifies fileSystem, *stdout@*/ ; /*@printflike@*/ int swprintf (wchar_t *s, size_t n, const wchar_t *format, ...) /*@modifies *s@*/ ; /*@scanflike@*/ int swscanf (const wchar_t *s, const wchar_t *format, ...) /*@modifies *stdin@*/ ; wint_t ungetwc (wint_t c, FILE *stream) /*@modifies fileSystem, *stream@*/ ; int vfwprintf (FILE *stream, const wchar_t *format, va_list arg) /*@modifies fileSystem, *stream@*/ ; int vswprintf (wchar_t *s, size_t n, const wchar_t *format, va_list arg) /*@modifies *s@*/ ; int vwprintf (const wchar_t *format, va_list arg) /*@modifies fileSystem, *stdout@*/ ; size_t wcrtomb (/*@null@*/ /*@out@*/ char *s, wchar_t wc, /*@null@*/ mbstate_t *ps) /*@modifies *s@*/; void /*@alt wchar_t *@*/ wcscat (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2) /*@modifies *s1@*/ ; /*@exposed@*/ /*@null@*/ wchar_t * wcschr (/*@returned@*/ const wchar_t *s, wchar_t c) /*@*/ ; int wcscmp (const wchar_t *s1, const wchar_t *s2) /*@*/ ; int wcscoll (const wchar_t *s1, const wchar_t *s2) /*@*/ ; void /*@alt wchar_t *@*/ wcscpy (/*@unique@*/ /*@out@*/ /*@returned@*/ wchar_t *s1, const wchar_t *s2) /*@modifies *s1@*/ ; size_t wcscspn (const wchar_t *s1, const wchar_t *s2) /*@*/ ; size_t wcsftime (/*@out@*/ wchar_t *s, size_t maxsize, const wchar_t *format, const struct tm *timeptr) /*@modifies *s@*/ ; size_t wcslen (const wchar_t *s) /*@*/ ; void /*@alt wchar_t *@*/ wcsncat (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2, size_t n) /*@modifies *s1@*/ ; int wcsncmp (const wchar_t *s1, const wchar_t *s2, size_t n) /*@*/ ; void /*@alt wchar_t *@*/ wcsncpy (/*@unique@*/ /*@returned@*/ /*@out@*/ wchar_t *s1, const wchar_t *s2, size_t n) /*@modifies *s1@*/ ; /*@null@*/ wchar_t * wcspbrk (/*@returned@*/ const wchar_t *s1, const wchar_t *s2) /*@*/ ; /*@null@*/ wchar_t * wcsrchr (/*@returned@*/ const wchar_t *s, wchar_t c) /*@*/ ; size_t wcsrtombs (/*@null@*/ char *dst, const wchar_t **src, size_t len, /*@null@*/ mbstate_t *ps) /*@modifies *src@*/ ; size_t wcsspn (const wchar_t *s1, const wchar_t *s2) /*@*/ ; /*@null@*/ wchar_t *wcsstr (const wchar_t *s1, const wchar_t *s2) /*@*/ ; double wcstod (const wchar_t *nptr, /*@null@*/ wchar_t **endptr) /*@modifies *endptr@*/ ; /*@null@*/ wchar_t * wcstok (/*@null@*/ wchar_t *s1, const wchar_t *s2, wchar_t **ptr) /*@modifies *ptr@*/; long wcstol (const wchar_t *nptr, /*@null@*/ wchar_t **endptr, int base) /*@modifies *endptr@*/; unsigned long wcstoul (const wchar_t *nptr, /*@null@*/ wchar_t **endptr, int base) /*@modifies *endptr@*/; size_t wcsxfrm (/*@null@*/ wchar_t *s1, const wchar_t *s2, size_t n) /*@modifies *s1@*/; int wctob (wint_t c) /*@*/; /*@null@*/ wchar_t *wmemchr (const wchar_t *s, wchar_t c, size_t n) /*@*/ ; int wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n) /*@*/ ; wchar_t *wmemcpy (/*@returned@*/ wchar_t *s1, const wchar_t *s2, size_t n) /*@modifies *s1@*/; wchar_t *wmemmove (/*@returned@*/ wchar_t *s1, const wchar_t *s2, size_t n) /*@modifies *s1@*/; wchar_t *wmemset (/*@returned@*/ wchar_t *s, wchar_t c, size_t n) /*@modifies *s@*/; /*@printflike@*/ int wprintf (const wchar_t *format, ...) /*@globals stdout@*/ /*@modifies errno, *stdout@*/; /*@scanflike@*/ int wscanf (const wchar_t *format, ...) /*@globals stdin@*/ /*@modifies errno, *stdin@*/; /* ** wctype.h (added by Amendment 1) */ /* Warning: not sure about these (maybe abstract?): */ typedef /*@integraltype@*/ wctype_t; typedef /*@integraltype@*/ wctrans_t; # ifdef STRICT _Bool iswalnum (wint_t c) /*@*/ ; _Bool iswalpha (wint_t c) /*@*/ ; _Bool iswcntrl (wint_t c) /*@*/ ; _Bool iswctype (wint_t c, wctype_t ctg) /*@*/ ; _Bool iswdigit (wint_t c) /*@*/ ; _Bool iswgraph (wint_t c) /*@*/ ; _Bool iswlower (wint_t c) /*@*/ ; _Bool iswprint (wint_t c) /*@*/ ; _Bool iswpunct (wint_t c) /*@*/ ; _Bool iswspace (wint_t c) /*@*/ ; _Bool iswupper (wint_t c) /*@*/ ; _Bool iswxdigit (wint_t c) /*@*/ ; wint_t towctrans (wint_t c, wctrans_t ctg) /*@*/ ; wint_t towlower (wint_t c) /*@*/ ; wint_t towupper (wint_t c) /*@*/ ; # else _Bool /*@alt int@*/ iswalnum (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswalpha (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswcntrl (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswctype (wint_t c, wctype_t ctg) /*@*/ ; _Bool /*@alt int@*/ iswdigit (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswgraph (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswlower (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswprint (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswpunct (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswspace (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswupper (wint_t c) /*@*/ ; _Bool /*@alt int@*/ iswxdigit (wint_t c) /*@*/ ; wint_t /*@alt int@*/ towctrans (wint_t c, wctrans_t ctg) /*@*/ ; wint_t /*@alt int@*/ towlower (wint_t c) /*@*/ ; wint_t /*@alt int@*/ towupper (wint_t c) /*@*/ ; # endif wctrans_t wctrans (const char *property) /*@*/ ; wctype_t wctype (const char *property) /*@*/ ; int mblen (char *s, size_t n) /*@*/ ; int mbtowc (/*@null@*/ wchar_t *pwc, /*@null@*/ char *s, size_t n) /*@modifies *pwc@*/ ; int wctomb (/*@out@*/ /*@null@*/ char *s, wchar_t wchar) /*@modifies *s@*/ ; size_t mbstowcs (/*@out@*/ wchar_t *pwcs, char *s, size_t n) /*@modifies *pwcs@*/ ; size_t wcstombs (/*@out@*/ char *s, wchar_t *pwcs, size_t n) /*@modifies *s@*/ ; /* ** string.h */ void /*@alt void * @*/ memcpy (/*@unique@*/ /*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n) /*@modifies *s1@*/ /*@requires maxRead(s2) >= (n - 1) /\ maxSet(s1) >= (n - 1); @*/ ; void /*@alt void * @*/ memmove (/*@returned@*/ /*@out@*/ void *s1, void *s2, size_t n) /*@modifies *s1@*/ /*@requires maxRead(s2) >= (n - 1) /\ maxSet(s1) >= (n - 1); @*/ ; /* drl modifed 12/29/2000 */ void /*@alt char * @*/ strcpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2) /*@modifies *s1@*/ /*@requires maxSet(s1) >= maxRead(s2) @*/ /*@ensures maxRead(s1) == maxRead (s2) /\ maxRead(result) == maxRead(s2) /\ maxSet(result) == maxSet(s1); @*/; void /*@alt char * @*/ strncpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2, size_t n) /*@modifies *s1@*/ /*@requires maxSet(s1) >= ( n - 1 ); @*/ /*@ensures maxRead (s2) >= maxRead(s1) /\ maxRead (s1) <= n; @*/ ; void /*@alt char * @*/ strcat (/*@unique@*/ /*@returned@*/ char *s1, char *s2) /*@modifies *s1@*/ /*@requires maxSet(s1) >= (maxRead(s1) + maxRead(s2) );@*/ /*@ensures maxRead(result) == (maxRead(s1) + maxRead(s2) );@*/; void /*@alt char * @*/ strncat (/*@unique@*/ /*@returned@*/ char *s1, char *s2, size_t n) /*@modifies *s1@*/ /*@requires maxSet(s1) >= ( maxRead(s1) + n); @*/ /*@ensures maxRead(s1) >= (maxRead(s1) + n); @*/; /*drl end*/ int memcmp (void *s1, void *s2, size_t n) /*@*/ ; int strcmp (char *s1, char *s2) /*@*/ ; int strcoll (char *s1, char *s2) /*@*/ ; int strncmp (char *s1, char *s2, size_t n) /*@*/ ; size_t strxfrm (/*@out@*/ /*@null@*/ char *s1, char *s2, size_t n) /*@modifies *s1@*/ ; /* s1 may be null only if n == 0 */ /*@null@*/ void *memchr (void *s, int c, size_t n) /*@*/ ; # ifdef STRICT /*@exposed@*/ /*@null@*/ char * strchr (/*@returned@*/ char *s, char c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 @*/ ; # else /*@exposed@*/ /*@null@*/ char * strchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0; @*/ ; # endif size_t strcspn (char *s1, char *s2) /*@*/ ; /*@null@*/ /*@exposed@*/ char * strpbrk (/*@returned@*/ char *s, char *t) /*@*/ ; # ifdef STRICT /*@null@*/ /*@exposed@*/ char * strrchr (/*@returned@*/ char *s, char c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 @*/ ; # else /*@null@*/ /*@exposed@*/ char * strrchr (/*@returned@*/ char *s, int /*@alt char@*/ c) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 @*/ ; # endif size_t strspn (char *s, char *t) /*@*/ ; /*@null@*/ /*@exposed@*/ char * strstr (/*@returned@*/ const char *s, const char *t) /*@*/ /*@ensures maxSet(result) >= 0 /\ maxSet(result) <= maxSet(s) /\ maxRead (result) <= maxRead(s) /\ maxRead(result) >= 0 /\ maxRead(result) >= maxRead(t) /\ maxSet(result) >= maxRead(t)@*/ ; /*@null@*/ /*@exposed@*/ char * strtok (/*@returned@*/ /*@null@*/ char *s, char *t) /*@modifies *s, internalState, errno@*/ ; void /*@alt void *@*/ memset (/*@out@*/ /*@returned@*/ void *s, int c, size_t n) /*@modifies *s@*/ /*@requires maxSet(s) >= (n - 1) @*/ /*@ensures maxRead(s) >= (n - 1) @*/ ; /*@observer@*/ char *strerror (int errnum) /*@*/ ; /*drl */ size_t strlen (char *s) /*@*/ /*@ensures result == maxRead(s); @*/; /* ** time.h */ /*@constant int CLOCKS_PER_SEC;@*/ typedef /*@integraltype@*/ clock_t; typedef /*@integraltype@*/ time_t; struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; } ; clock_t clock (void) /*@modifies internalState@*/ ; double difftime (time_t time1, time_t time0) /*@*/ ; time_t mktime (struct tm *timeptr) /*@*/ ; time_t time (/*@null@*/ /*@out@*/ time_t *tp) /*@modifies *tp@*/ ; /*@observer@*/ char *asctime (struct tm *timeptr) /*@modifies errno*/ /*@ensures maxSet(result) == 25 /\ maxRead(result) == 25; @*/ ; /*@observer@*/ char *ctime (time_t *tp) /*@*/ /*@ensures maxSet(result) == 25 /\ maxRead(result) == 25; @*/; /* 2003-11-01: remove null annotation: gmtima and localtime cannot return null */ /*@observer@*/ struct tm *gmtime (time_t *tp) /*@*/ ; /*@observer@*/ struct tm *localtime (time_t *tp) /*@modifies errno@*/ ; size_t strftime (/*@out@*/ char *s, size_t smax, char *fmt, struct tm *timeptr) /*@modifies *s@*/ ; /* ** ISO c99: 7.18 Integer types */ /* ** These types are OPTIONAL. Provide warnings on use. */ typedef /*@integraltype@*/ int8_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least8_t instead."@*/ ; typedef /*@integraltype@*/ int16_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least16_t instead."@*/ ; typedef /*@integraltype@*/ int32_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least32_t instead."@*/ ; typedef /*@integraltype@*/ int64_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider int_least64_t instead."@*/ ; typedef /*@unsignedintegraltype@*/ uint8_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least8_t instead."@*/ ; typedef /*@unsignedintegraltype@*/ uint16_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least16_t instead."@*/ ; typedef /*@unsignedintegraltype@*/ uint32_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least32_t instead."@*/ ; typedef /*@unsignedintegraltype@*/ uint64_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide. Consider uint_least64_t instead."@*/ ; typedef /*@integraltype@*/ int_least8_t; typedef /*@integraltype@*/ int_least16_t; typedef /*@integraltype@*/ int_least32_t; typedef /*@integraltype@*/ int_least64_t; typedef /*@unsignedintegraltype@*/ uint_least8_t; typedef /*@unsignedintegraltype@*/ uint_least16_t; typedef /*@unsignedintegraltype@*/ uint_least32_t; typedef /*@unsignedintegraltype@*/ uint_least64_t; typedef /*@integraltype@*/ int_fast8_t; typedef /*@integraltype@*/ int_fast16_t; typedef /*@integraltype@*/ int_fast32_t; typedef /*@integraltype@*/ int_fast64_t; typedef /*@unsignedintegraltype@*/ uint_fast8_t; typedef /*@unsignedintegraltype@*/ uint_fast16_t; typedef /*@unsignedintegraltype@*/ uint_fast32_t; typedef /*@unsignedintegraltype@*/ uint_fast64_t; /* Corrections to intptr_t and uintptr_t decparations provided by David Sanderson */ typedef /*@signedintegraltype@*/ intptr_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide."@*/ ; typedef /*@unsignedintegraltype@*/ uintptr_t /*@warn implementationoptional "ISO99 specifies as optional type, implementation need not provide."@*/ ; typedef /*@signedintegraltype@*/ intmax_t; typedef /*@unsignedintegraltype@*/ uintmax_t; /* ** What should the types be here? */ /*#*/ /*@constant int INT8_MIN@*/ /*@constant int INT16_MIN@*/ /*@constant int INT32_MIN@*/ /*@constant int INT64_MIN@*/ /*@constant int INT8_MAX@*/ /*@constant int INT16_MAX@*/ /*@constant int INT32_MAX@*/ /*@constant int INT64_MAX@*/ /*@constant int UINT8_MIN@*/ /*@constant int UINT16_MIN@*/ /*@constant int UINT32_MIN@*/ /*@constant int UINT64_MIN@*/ /*@constant int INT_LEAST8_MIN@*/ /*@constant int INT_LEAST16_MIN@*/ /*@constant int INT_LEAST32_MIN@*/ /*@constant int INT_LEAST64_MIN@*/ /*@constant int INT_LEAST8_MAX@*/ /*@constant int INT_LEAST16_MAX@*/ /*@constant int INT_LEAST32_MAX@*/ /*@constant int INT_LEAST64_MAX@*/ /*@constant int UINT_LEAST8_MAX@*/ /*@constant int UINT_LEAST16_MAX@*/ /*@constant int UINT_LEAST32_MAX@*/ /*@constant int UINT_LEAST64_MAX@*/ /*@constant int INT_FAST8_MIN@*/ /*@constant int INT_FAST16_MIN@*/ /*@constant int INT_FAST32_MIN@*/ /*@constant int INT_FAST64_MIN@*/ /*@constant int INT_FAST8_MAX@*/ /*@constant int INT_FAST16_MAX@*/ /*@constant int INT_FAST32_MAX@*/ /*@constant int INT_FAST64_MAX@*/ /*@constant int UINT_FAST8_MAX@*/ /*@constant int UINT_FAST16_MAX@*/ /*@constant int UINT_FAST32_MAX@*/ /*@constant int UINT_FAST64_MAX@*/ /*@constant size_t INTPTR_MIN@*/ /*@constant size_t INTPTR_MAX@*/ splint-3.1.2.dfsg1/lib/standard.lcd0000644021234200000250000010616710645776246014531 0ustar fax;;; Splint Library standard.lcd ;;Splint 3.018000 ;;lib:310 ;;ctTable 0 u-2 19 38 0 p1|-2 20 39 0 b-2 21 40 0 p3|-2 22 41 0 p4|-2 23 42 0 p5|-2 24 43 0 p6|-2 25 44 0 p7|-2 26 45 0 p8|-2 27 46 0 p9|-2 28 47 0 p10|-2 29 48 0 p11|-2 30 49 0 p12|-2 31 50 0 p13|-2 32 51 0 p14|-2 33 52 0 p15|-2 34 53 0 p16|-2 35 54 0 p17|-2 36 55 0 p18|-2 37 56 1 t0|0 485 -1 1 t1|1& 1 t2|2& 1 t3|3& 1 t4|4 486 -1 1 t5|5& 1 t6|6& 1 t7|7& 1 t8|8& 1 t9|9& 1 t10|10& 1 t11|11& 1 t12|12& 1 t13|13& 1 t14|14& 1 t15|15& 1 t16|16& 1 t17|17& 1 t18|18& 2 y0|0& 2 y1|1& 2 y2|2& 2 y3|3& 2 y4|4& 2 y5|5& 2 y6|6& 2 y7|7& 2 y8|8& 2 y9|9& 2 y10|10& 2 y11|11& 2 y12|12& 2 y13|13& 2 y14|14& 2 y15|15& 2 y16|16& 2 y17|17& 2 y18|18& -2 ?! 0 a0|& 0 s11|& 0 s12|& 0 s13|& 0 s27|& 0 s29|& 0 s30|& 0 s31|& 0 s32|-1 554 -1 0 s33|& 0 a34|-1 572 -1 3 C0.5/20|! 3 C0.69/2|! 3 C0.2/5|! 3 f0 (71|@7|$#,)! 3 f1 (71|@7|$#,)! 3 C0.4/3|! 3 C0.5/74|! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 C0.2/5|! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f88 (75|$#,)! 3 C0.5/74|! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 C0.2/5|! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f105 (92|$#,)! 3 C0.5/74|! 3 f0 (109|$#,)! 3 f2 (109|$#,)! 3 f105 (109|$#,)! 3 C0.4/5|! 3 f0 (109|$#,)! 3 f4 (109|$#,)! 3 f113 (109|$#,)! 3 f0 (109|$#,)! 3 f4 (109|$#,)! 3 f113 (109|$#,)! 3 Slconv{23|@1|0@0@3&#decimal_point,23|@1|0@0@3&#thousands_sep,23|@1|0@0@3&#grouping,23|@1|0@0@3&#int_curr_symbol,23|@1|0@0@3&#currency_symbol,23|@1|0@0@3&#mon_decimal_point,23|@1|0@0@3&#mon_thousands_sep,23|@1|0@0@3&#mon_grouping,23|@1|0@0@3&#positive_sign,23|@1|0@0@3&#negative_sign,4|@1|^#int_frac_digits,4|@1|^#frac_digits,4|@1|^#p_cs_precedes,4|@1|^#p_sep_by_space,4|@1|^#n_cs_precedes,4|@1|^#n_sep_by_space,4|@1|^#p_sign_posn,4|@1|^#n_sign_posn,}! 0 s51|-1 127 -1 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f23 (5|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 1 t121|121& 3 f127 ()! 0 s106|& 0 s107|& 3 C0.17/18|! 3 C0.16/131|! 0 s121|& 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,24|4@0@7&#,)! 3 f17 (17|$#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,36|4@0@7&#,)! 3 f17 (17|$#,36|4@0@7&#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,9|$#,)! 3 f17 (17|$#,9|$#,)! 3 f0 (18|$#,9|$#,)! 3 f18 (18|$#,9|$#,)! 3 f0 (17|$#,)! 3 f5 (17|$#,)! 3 f0 (16|$#,)! 3 f5 (16|$#,)! 3 f0 (18|$#,)! 3 f5 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (16|$#,)! 3 f9 (16|$#,)! 3 f0 (18|$#,)! 3 f9 (18|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (16|$#,)! 3 f11 (16|$#,)! 3 f0 (18|$#,)! 3 f11 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,24|4@0@7&#,)! 3 f17 (17|$#,17|$#,24|4@0@7&#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,18|$#,)! 3 f17 (17|$#,18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,17|$#,)! 3 f17 (17|$#,17|$#,17|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 0 a224|& 3 f0 (338|4@0@7&#,)! 3 f5 (338|4@0@7&#,)! 3 f0 (338|$#,5|$#,)! 3 f1 (338|$#,5|$#,)! 0 s233|& 3 ?! 3 f344 (5|$#,)! 3 f1 (5|$#,)^347 1 t346|346& 3 ?! 3 f348 (5|$#,)! 3 f1 (5|$#,)^351 1 t350|350& 3 ?! 3 f352 (5|$#,)! 3 f1 (5|$#,)^355 1 t354|354& 3 ?! 3 f356 (5|$#,)! 3 f1 (5|$#,)^359 1 t358|358& 3 f0 (5|$#,359|0@5@7&#,)! 3 f19 (5|$#,359|0@5@7&#,)^362 1 t361|361& 3 ?! 3 f363 (5|$#,)! 3 f19 (5|$#,)! 3 f1 (5|$#,359|0@5@7&#,)! 3 f1 (5|$#,)! 3 f367 (5|$#,359|0@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 a239|& 3 f0 (371|4@0@7&#,!.,)! 3 f1 (371|4@0@7&#,!.,)! 3 f0 (371|$#,)! 3 f1 (371|$#,)! 3 f0 (371|4@0@7&#,371|$#,)! 3 f1 (371|4@0@7&#,371|$#,)! 0 a243|-1 380 -1 0 a244|-1 460 -1 1 t378|378& 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f19 ()! 3 f380 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|0@5@7&#,)! 3 f5 (380|0@5@7&#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f380 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,380|$#,)! 3 f19 (23|$#,23|$#,380|$#,)! 3 f380 (23|$#,23|$#,380|$#,)! 3 f0 (380|$#,23|4@5@19@2@0#,)! 3 f1 (380|$#,23|4@5@19@2@0#,)! 3 f0 (380|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f5 (380|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 C0.5/1|! 3 f0 (380|$#,23|$#,!.,)! 3 f5 (380|$#,23|$#,!.,)! 3 f405 (380|$#,23|$#,!.,)! 3 f0 (380|$#,23|$#,!.,)! 3 f5 (380|$#,23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f405 (23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f405 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|$#,371|$#,)! 3 f5 (23|$#,371|$#,)! 3 f0 (380|$#,23|$#,371|$#,)! 3 f5 (380|$#,23|$#,371|$#,)! 3 f0 (23|4@0@7&#,23|$#,371|$#,)! 3 f5 (23|4@0@7&#,23|$#,371|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,371|$#,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,371|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 f19 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 f23 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 C0.5/4|! 3 f0 (436|$#,380|$#,)! 3 f5 (436|$#,380|$#,)! 3 f0 (23|$#,380|$#,)! 3 f5 (23|$#,380|$#,)! 3 f0 (380|@7|$#,)! 3 f5 (380|@7|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|4@0@7&#,)! 3 f19 (23|4@0@7&#,)! 3 f23 (23|4@0@7&#,)! 3 f0 (436|$#,380|@7|$#,)! 3 f5 (436|$#,380|@7|$#,)! 3 f0 (436|$#,)! 3 f5 (436|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (436|$#,380|$#,)! 3 f5 (436|$#,380|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f0 (20|$#,64|$#,64|$#,380|$#,)! 3 f64 (20|$#,64|$#,64|$#,380|$#,)! 1 t379|379& 3 f0 (380|$#,460|4@0@7&#,)! 3 f5 (380|$#,460|4@0@7&#,)! 3 f0 (380|$#,9|$#,5|$#,)! 3 f5 (380|$#,9|$#,5|$#,)! 3 f0 (380|$#,460|$#,)! 3 f5 (380|$#,460|$#,)! 3 f0 (380|$#,)! 3 f9 (380|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (23|0@5@7&#,)! 3 f1 (23|0@5@7&#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 1 t19|19& 1 t23|23& 3 f0 (23|$#,486|4@5@7&#,)! 3 f17 (23|$#,486|4@5@7&#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f9 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f10 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (20|4@5@2&#,)! 3 f1 (20|4@5@2&#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 ?! 3 f512 ()! 3 f1 ()^515 1 t514|514& 3 f0 (515|$#,)! 3 f5 (515|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 ?! 3 f523 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^526 1 t525|525& 3 f0 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 ?! 3 f530 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^533 1 t532|532& 3 f0 (20|$#,64|$#,64|$#,533|$#,)! 3 f1 (20|$#,64|$#,64|$#,533|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 S!2{5|@1|^#quot,5|@1|^#rem,}! 0 s324|& 0 s325|& 3 f0 (5|$#,5|$#,)! 3 f540 (5|$#,5|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 3 S!3{9|@1|^#quot,9|@1|^#rem,}! 0 s328|& 0 s329|& 3 f0 (9|$#,9|$#,)! 3 f547 (9|$#,9|$#,)! 3 f0 (5|$#,)! 3 f67 (5|$#,)! 3 f0 (380|$#,)! 3 f67 (380|$#,)! 1 t66|66 636 -1 3 f0 (554|@5|$#,5|$#,380|$#,)! 3 f19 (554|@5|$#,5|$#,380|$#,)! 3 f554 (554|@5|$#,5|$#,380|$#,)! 3 f0 (66|$#,380|$#,)! 3 f67 (66|$#,380|$#,)! 3 f0 (554|$#,380|$#,)! 3 f5 (554|$#,380|$#,)! 3 f0 (380|$#,5|$#,)! 3 f5 (380|$#,5|$#,)! 3 f0 (380|$#,554|$#,!.,)! 3 f5 (380|$#,554|$#,!.,)! 3 f0 (380|$#,554|$#,!.,)! 3 f5 (380|$#,554|$#,!.,)! 3 f0 (380|@7|$#,)! 3 f67 (380|@7|$#,)! 3 f0 ()! 3 f67 ()! 1 t68|68& 3 f0 (23|$#,64|$#,572|0@5@7&#,)! 3 f64 (23|$#,64|$#,572|0@5@7&#,)! 3 f0 (554|0@5@7&#,23|$#,64|$#,572|0@5@7&#,)! 3 f64 (554|0@5@7&#,23|$#,64|$#,572|0@5@7&#,)! 3 f0 (572|0@5@7&#,)! 3 f5 (572|0@5@7&#,)! 3 f0 (554|0@5@7&#,486|$#,64|$#,572|0@5@7&#,)! 3 f64 (554|0@5@7&#,486|$#,64|$#,572|0@5@7&#,)! 3 f0 (66|$#,380|@7|$#,)! 3 f67 (66|$#,380|@7|$#,)! 3 f0 (66|$#,)! 3 f67 (66|$#,)! 3 f0 (554|$#,64|$#,554|$#,!.,)! 3 f5 (554|$#,64|$#,554|$#,!.,)! 3 f0 (554|$#,554|$#,!.,)! 3 f5 (554|$#,554|$#,!.,)! 3 f0 (67|$#,380|$#,)! 3 f67 (67|$#,380|$#,)! 3 f0 (380|$#,554|$#,371|$#,)! 3 f5 (380|$#,554|$#,371|$#,)! 3 f0 (554|$#,64|$#,554|$#,371|$#,)! 3 f5 (554|$#,64|$#,554|$#,371|$#,)! 3 f0 (554|$#,371|$#,)! 3 f5 (554|$#,371|$#,)! 3 f0 (23|4@5@7&#,66|$#,572|0@5@7&#,)! 3 f64 (23|4@5@7&#,66|$#,572|0@5@7&#,)! 3 C0.1/554|! 3 f0 (554|@5|4@0@9&#,554|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,)! 3 f599 (554|@5|4@0@9&#,554|$#,)! 3 f0 (554|@5|$#,66|$#,)! 3 f19 (554|@5|$#,66|$#,)! 3 f554 (554|@5|$#,66|$#,)! 3 f0 (554|$#,554|$#,)! 3 f5 (554|$#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f5 (554|$#,554|$#,)! 3 f0 (554|@5|4@0@9&#,554|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,)! 3 f599 (554|@5|4@0@9&#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f64 (554|$#,554|$#,)! 0 s364|-1 616 -1 1 t615|615& 3 f0 (554|4@0@7&#,64|$#,554|$#,616|$#,)! 3 f64 (554|4@0@7&#,64|$#,554|$#,616|$#,)! 3 f0 (554|$#,)! 3 f64 (554|$#,)! 3 C0.1/554|! 3 f0 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f621 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f0 (554|$#,554|$#,64|$#,)! 3 f5 (554|$#,554|$#,64|$#,)! 3 f0 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f621 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,)! 3 f19 (554|@5|$#,554|$#,)! 3 f554 (554|@5|$#,554|$#,)! 3 f0 (554|@5|$#,66|$#,)! 3 f19 (554|@5|$#,66|$#,)! 3 f554 (554|@5|$#,66|$#,)! 1 t554|554& 3 f0 (23|0@5@7&#,636|$#,64|$#,572|0@5@7&#,)! 3 f64 (23|0@5@7&#,636|$#,64|$#,572|0@5@7&#,)! 3 f0 (554|$#,554|$#,)! 3 f64 (554|$#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f19 (554|$#,554|$#,)! 3 f554 (554|$#,554|$#,)! 3 f0 (554|$#,636|0@5@7&#,)! 3 f17 (554|$#,636|0@5@7&#,)! 3 f0 (554|0@5@7&#,554|$#,636|$#,)! 3 f19 (554|0@5@7&#,554|$#,636|$#,)! 3 f554 (554|0@5@7&#,554|$#,636|$#,)! 3 f0 (554|$#,636|0@5@7&#,5|$#,)! 3 f9 (554|$#,636|0@5@7&#,5|$#,)! 3 f0 (554|$#,636|0@5@7&#,5|$#,)! 3 f10 (554|$#,636|0@5@7&#,5|$#,)! 3 f0 (554|0@5@7&#,554|$#,64|$#,)! 3 f64 (554|0@5@7&#,554|$#,64|$#,)! 3 f0 (67|$#,)! 3 f5 (67|$#,)! 3 f0 (554|$#,66|$#,64|$#,)! 3 f19 (554|$#,66|$#,64|$#,)! 3 f554 (554|$#,66|$#,64|$#,)! 3 f0 (554|$#,554|$#,64|$#,)! 3 f5 (554|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,64|$#,)! 3 f19 (554|@5|$#,554|$#,64|$#,)! 3 f554 (554|@5|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,64|$#,)! 3 f19 (554|@5|$#,554|$#,64|$#,)! 3 f554 (554|@5|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,66|$#,64|$#,)! 3 f19 (554|@5|$#,66|$#,64|$#,)! 3 f554 (554|@5|$#,66|$#,64|$#,)! 3 f0 (554|$#,!.,)! 3 f5 (554|$#,!.,)! 3 f0 (554|$#,!.,)! 3 f5 (554|$#,!.,)! 0 s388|& 0 s389|& 3 C0.2/5|! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,675|$#,)! 3 f2 (67|$#,675|$#,)! 3 f677 (67|$#,675|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 C0.2/5|! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 C0.2/5|! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f712 (67|$#,)! 3 C0.67/5|! 3 f0 (67|$#,676|$#,)! 3 f67 (67|$#,676|$#,)! 3 f716 (67|$#,676|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f716 (67|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f716 (67|$#,)! 3 f0 (23|$#,)! 3 f676 (23|$#,)! 3 f0 (23|$#,)! 3 f675 (23|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (554|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (554|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! 3 f0 (554|4@0@7&#,23|$#,64|$#,)! 3 f64 (554|4@0@7&#,23|$#,64|$#,)! 3 f0 (23|4@0@7&#,554|$#,64|$#,)! 3 f64 (23|4@0@7&#,554|$#,64|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f740 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f0 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f740 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 C0.1/23|! 3 f0 (23|@5|4@0@9&#,23|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,)! 3 f747 (23|@5|4@0@9&#,23|$#,)! 3 f0 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f747 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,)! 3 f747 (23|@5|0@0@9&#,23|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f747 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f0 (20|$#,20|$#,64|$#,)! 3 f5 (20|$#,20|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (23|4@5@7&#,23|$#,64|$#,)! 3 f64 (23|4@5@7&#,23|$#,64|$#,)! 3 f0 (20|$#,5|$#,64|$#,)! 3 f19 (20|$#,5|$#,64|$#,)! 3 f20 (20|$#,5|$#,64|$#,)! 3 f0 (23|@5|$#,436|$#,)! 3 f19 (23|@5|$#,436|$#,)! 3 f23 (23|@5|$#,436|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|$#,436|$#,)! 3 f19 (23|@5|$#,436|$#,)! 3 f23 (23|@5|$#,436|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|0@5@7&#,23|$#,)! 3 f19 (23|@5|0@5@7&#,23|$#,)! 3 f23 (23|@5|0@5@7&#,23|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f792 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f64 (23|$#,)! 0 s435|& 0 s436|-1 810 -1 3 Stm{5|@1|^#tm_sec,5|@1|^#tm_min,5|@1|^#tm_hour,5|@1|^#tm_mday,5|@1|^#tm_mon,5|@1|^#tm_year,5|@1|^#tm_wday,5|@1|^#tm_yday,5|@1|^#tm_isdst,}! 3 f0 ()! 3 f801 ()! 3 f0 (802|$#,802|$#,)! 3 f17 (802|$#,802|$#,)! 3 f0 (616|$#,)! 3 f802 (616|$#,)! 1 t802|802& 3 f0 (810|4@5@7&#,)! 3 f802 (810|4@5@7&#,)! 3 f0 (616|$#,)! 3 f19 (616|$#,)! 3 f23 (616|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f23 (810|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f616 (810|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f616 (810|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,616|$#,)! 3 f64 (23|4@0@7&#,64|$#,23|$#,616|$#,)! 0 s446|& 0 s447|& 0 s448|& 0 s449|& 0 s450|& 0 s451|& 0 s452|& 0 s453|& 0 s454|& 0 s455|& 0 s456|& 0 s457|& 0 s458|& 0 s459|& 0 s460|& 0 s461|& 0 s462|& 0 s463|& 0 s464|& 0 s465|& 0 s466|& 0 s467|& 0 s468|& 0 s469|& 0 s470|& 0 s471|& 0 s472|& 0 s473|& ;;tistable 0 34 34,224 224 34,224,239 239 34,224,239,243 243 34,224,239,243,244 244 ;;symTable *0 (Datatype) ^0 2@a@-@0@0@0@0@2#_Bool *1 (Constant) ^1 2@i0@0@6#false ^2 2@i1@0@0#true *11 (GlobalMarker) *1 (Constant) ^4 5$#__LINE__ ^5 23$#__DATE__#__FILE__#__BASE_FILE__#__func__ ^9 5$#__INCLUDE_LEVEL__ ^10 23$#__VERSION__ *0 (Datatype) ^11 13@c@-@0@0@0@0@59#__SIZE_TYPE__ ^12 13@c@-@0@0@0@0@60#__PTRDIFF_TYPE__ ^13 13@c@-@0@0@0@0@61#__WCHAR_TYPE__ *1 (Constant) ^14 23$#__USER_LABEL_PREFIX__#__REGISTER_PREFIX__#__TIME__ ^17 5$#__STDC__#S_SPLINT_S#__LCLINT__#__i686 *3 (Variable) ^21 380|@1|6@0@0@0@1#stdin#stdout *1 (Constant) ^23 5$#EDOM#ERANGE#EILSEQ *3 (Variable) ^26 5|@1|6@0@0@0@1#errno *0 (Datatype) ^27 2@-@-@0@0@0@0@62#bool *1 (Constant) ^28 5@i1@0@0#__bool_true_false_are_defined *0 (Datatype) ^29 13@-@-@0@0@0@0@63#ptrdiff_t ^30 14@-@-@0@0@0@0@64#size_t ^31 15@-@-@0@0@0@0@65#ssize_t ^32 13@-@-@0@0@0@0@66#wchar_t ^33 13@-@-@0@0@0@0@67#wint_t ^34 0@a@=@0@0@0@0@68#mbstate_t *1 (Constant) ^35 0@i0@0@6#NULL ^36 2$#NDEBUG *4 (Function) ^37 73@6@0@8@0@0^$@0#assert ^38 78$^$@0#isalnum ^39 81$^$@0#isalpha ^40 84$^$@0#iscntrl ^41 87$^$@0#isdigit ^42 91$^$@0#isgraph ^43 95$^$@0#islower ^44 98$^$@0#isprint ^45 101$^$@0#ispunct ^46 104$^$@0#isspace ^47 108$^$@0#isupper ^48 112$^$@0#isxdigit ^49 116$^$@0#tolower ^50 119$^$@0#toupper *7 (Struct tag) ^51 120@121#@lconv *1 (Constant) ^52 5$#LC_ALL#LC_COLLATE#LC_CTYPE#LC_MONETARY#LC_NUMERIC#LC_TIME *4 (Function) ^58 124@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@19@3@0#setlocale ^59 128$^@3@0@0#localeconv *3 (Variable) ^60 5|@1|6@0@0@0@1#DBL_DIG ^61 17|@1|6@0@0@0@1#DBL_EPSILON ^62 5|@1|6@0@0@0@1#DBL_MANT_DIG ^63 17|@1|6@0@0@0@1#DBL_MAX ^64 5|@1|6@0@0@0@1#DBL_MAX_10_EXP#DBL_MAX_EXP ^66 17|@1|6@0@0@0@1#DBL_MIN ^67 5|@1|6@0@0@0@1#DBL_MIN_10_EXP#DBL_MIN_EXP#FLT_DIG ^70 16|@1|6@0@0@0@1#FLT_EPSILON ^71 5|@1|6@0@0@0@1#FLT_MANT_DIG ^72 16|@1|6@0@0@0@1#FLT_MAX ^73 5|@1|6@0@0@0@1#FLT_MAX_10_EXP#FLT_MAX_EXP ^75 16|@1|6@0@0@0@1#FLT_MIN ^76 5|@1|6@0@0@0@1#FLT_MIN_10_EXP#FLT_MIN_EXP *1 (Constant) ^78 5$#FLT_RADIX *3 (Variable) ^79 5|@1|6@0@0@0@1#FLT_ROUNDS#LDBL_DIG ^81 18|@1|6@0@0@0@1#LDBL_EPSILON ^82 5|@1|6@0@0@0@1#LDBL_MANT_DIG ^83 18|@1|6@0@0@0@1#LDBL_MAX ^84 5|@1|6@0@0@0@1#LDBL_MAX_10_EXP#LDBL_MAX_EXP ^86 18|@1|6@0@0@0@1#LDBL_MIN ^87 5|@1|6@0@0@0@1#LDBL_MIN_10_EXP#LDBL_MIN_EXP *1 (Constant) ^89 5$#CHAR_BIT ^90 4$#CHAR_MAX#CHAR_MIN ^92 5$#INT_MAX#INT_MIN ^94 9$#LONG_MAX#LONG_MIN#MB_LEN_MAX ^97 4$#SCHAR_MAX#SCHAR_MIN ^99 7$#SHRT_MAX#SHRT_MIN ^101 3$#UCHAR_MAX#UCHAR_MIN ^103 6$#UINT_MAX ^104 10$#ULONG_MAX ^105 8$#USHRT_MAX *0 (Datatype) ^106 16@-@-@0@0@0@0@129#float_t ^107 17@-@-@0@0@0@0@130#double_t *1 (Constant) ^108 17$#HUGE_VAL ^109 16$#HUGE_VALF ^110 18$#HUGE_VALL ^111 16$#INFINITY#NAN ^113 5$#FP_INFINITE#FP_NAN#FP_NORMAL#FP_SUBNORMAL#FP_ZERO#FP_ILOGB0#FP_ILOGBNAN#DECIMAL_DIG *0 (Datatype) ^121 132@-@-@0@0@0@0@133#s_real_t *4 (Function) ^122 135$^$@0#fpclassify ^123 137$^$@0#signbit ^124 139$^$@0#isfinite ^125 141$^$@0#isnormal ^126 143$^$@0#isnan ^127 145$^$@0#isinf ^128 147$@0@g26@6@0@1@g26$@0#acos ^129 149$@0@g26@6@0@1@g26$@0#asin ^130 151$^$@0#atan ^131 153$^$@0#atan2 ^132 155$^$@0#cos ^133 157$^$@0#sin ^134 159$^$@0#tan ^135 161$@0@g26@6@0@1@g26$@0#cosh ^136 163$@0@g26@6@0@1@g26$@0#sinh ^137 165$^$@0#tanh ^138 167$@0@g26@6@0@1@g26$@0#acosh ^139 169$@0@g26@6@0@1@g26$@0#asinh ^140 171$@0@g26@6@0@1@g26$@0#atanh ^141 173$@0@g26@6@0@1@g26$@0#exp ^142 175$@0@@1@tp1$@0#frexp ^143 177$@0@g26@6@0@1@g26$@0#ldexp ^144 179$@0@g26@6@0@1@g26$@0#log ^145 181$@0@g26@6@0@1@g26$@0#log10 ^146 183$@0@@1@tp1$@0#modf ^147 185$@0@g26@6@0@1@g26$@0#exp2 ^148 187$@0@g26@6@0@1@g26$@0#expm1 ^149 189$@0@g26@6@0@1@g26$@0#log1p ^150 191$@0@g26@6@0@1@g26$@0#log2 ^151 193$@0@g26@6@0@1@g26$@0#logb ^152 195$@0@g26@6@0@1@g26$@0#scalbn ^153 197$@0@g26@6@0@1@g26$@0#scalbln ^154 199$@0@g26@6@0@1@g26$@0#scalblnl ^155 201$@0@g26@6@0@1@g26$@0#ilogb ^156 203$@0@g26@6@0@1@g26$@0#ilogbf ^157 205$@0@g26@6@0@1@g26$@0#ilogbl ^158 207$^$@0#fabs ^159 209$^$@0#fabsf ^160 211$^$@0#fabsl ^161 213$@0@g26@6@0@1@g26$@0#pow ^162 215$@0@g26@6@0@1@g26$@0#powf ^163 217$@0@g26@6@0@1@g26$@0#powl ^164 219$@0@g26@6@0@1@g26$@0#sqrt ^165 221$@0@g26@6@0@1@g26$@0#sqrtf ^166 223$@0@g26@6@0@1@g26$@0#sqrtl ^167 225$^$@0#cbrt ^168 227$^$@0#cbrtf ^169 229$^$@0#cbrtl ^170 231$@0@g26@6@0@1@g26$@0#hypot ^171 233$@0@g26@6@0@1@g26$@0#hypotf ^172 235$@0@g26@6@0@1@g26$@0#hypotl ^173 237$^$@0#erf ^174 239$^$@0#erfc ^175 241$^$@0#erff ^176 243$^$@0#erfl ^177 245$^$@0#erfcf ^178 247$^$@0#erfcl ^179 249$@0@g26@6@0@1@g26$@0#gamma ^180 251$@0@g26@6@0@1@g26$@0#gammaf ^181 253$@0@g26@6@0@1@g26$@0#gammal ^182 255$@0@g26@6@0@1@g26$@0#lgamma ^183 257$@0@g26@6@0@1@g26$@0#lgammaf ^184 259$@0@g26@6@0@1@g26$@0#lgammal ^185 261$^$@0#ceil ^186 263$^$@0#ceilf ^187 265$^$@0#ceill ^188 267$^$@0#floor ^189 269$^$@0#floorf ^190 271$^$@0#floorl ^191 273$^$@0#nearbyint ^192 275$^$@0#nearbyintf ^193 277$^$@0#nearbyintl ^194 279$^$@0#rint ^195 281$^$@0#rintf ^196 283$^$@0#rintl ^197 285$@0@g26@6@0@1@g26$@0#lrint ^198 287$@0@g26@6@0@1@g26$@0#lrintf ^199 289$@0@g26@6@0@1@g26$@0#lrintl ^200 291$@0@g26@6@0@1@g26$@0#llrint ^201 293$@0@g26@6@0@1@g26$@0#llrintf ^202 295$@0@g26@6@0@1@g26$@0#llrintl ^203 297$^$@0#round ^204 299$@0@g26@6@0@1@g26$@0#lround ^205 301$@0@g26@6@0@1@g26$@0#llround ^206 303$^$@0#trunc ^207 305$^$@0#fmod ^208 307$^$@0#remainder ^209 309$@0@@1@tp2$@0#remquo ^210 311$^$@0#copysign ^211 313$^$@0#nan ^212 315$^$@0#nextafter ^213 317$^$@0#nextafterx ^214 319$@0@g26@6@0@1@g26$@0#fdim ^215 321$^$@0#fmax ^216 323$^$@0#fmin ^217 325$^$@0#fma ^218 327$^$@0#isgreater ^219 329$^$@0#isgreaterequal ^220 331$^$@0#isless ^221 333$^$@0#islessequal ^222 335$^$@0#islessgreater ^223 337$^$@0#isunordered *0 (Datatype) ^224 20@a@+@0@0@0@0@338#jmp_buf *4 (Function) ^225 340$@0@@1@p0$@0#setjmp ^226 342@6@0@5@0@0^$@0#longjmp *1 (Constant) ^227 5$#SIGABRT#SIGFPE#SIGILL#SIGINT#SIGSEGV#SIGTERM *0 (Datatype) ^233 13@-@-@0@0@0@0@343#sig_atomic_t *1 (Constant) ^234 347$#SIG_DFL ^235 351$#SIG_ERR ^236 355$#SIG_IGN *4 (Function) ^237 368@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26$@0#signal ^238 370@6@0@5@0@0$$@0#raise *0 (Datatype) ^239 20@a@+@0@0@0@0@371#va_list *4 (Function) ^240 373$@0@@1@p0$@0#va_start ^241 375$@0@@1@p0$@0#va_end ^242 377$$$@0#va_copy *0 (Datatype) ^243 20@a@+@0@0@0@0@378#FILE ^244 20@a@+@0@0@0@0@379#fpos_t *1 (Constant) ^245 64$#_IOFBF#_IOLBF#_IONBF#BUFSIZ ^249 5$#EOF#FOPEN_MAX#FILENAME_MAX#L_tmpnam#SEEK_CUR#SEEK_END#SEEK_SET#TMP_MAX *3 (Variable) ^257 380|@1|6@0@0@0@1#stderr *4 (Function) ^258 382$@0@s3,g26@6@0@1@s3,g26$@0#remove ^259 384$@0@s3,g26@6@0@1@s3,g26$@0#rename ^260 387@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#tmpfile ^261 390$@0@s1@1@tp0,s1@19@3@0#tmpnam ^262 392$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fclose ^263 394$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fflush ^264 397@6@5@1@0@0@0@s3@1@s3@18@0@0#fopen ^265 400@6@5@1@0@0@0@s3,g26@6@0@1@tp2,s3,g26@18@0@0#freopen ^266 402$@0@s3@1@s3,tp0,tp1$@0#setbuf ^267 404$@0@s3@1@s3,tp0,tp1$@0#setvbuf ^268 408@6@0@1@1@0@0@s3@1@s3,tp0$@0#fprintf ^269 410@6@0@1@2@0@0@s3,g26@6@0@1@s3,tp0,g26$@0#fscanf ^270 413@6@0@1@1@0@1@g22@6@0,s3@1@s3,tg22$@0#printf ^271 415@6@0@1@2@0@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#scanf ^272 418@6@0@1@1@0@0@@1@tp0$@0@W:bufferoverflowhigh#Buffer overflow possible with sprintf. Recommend using snprintf instead##sprintf ^273 420@6@0@1@1@0@0@@1@p0$@0#snprintf ^274 422@6@0@1@2@0@0@g26@6@0@1@g26$@0#sscanf ^275 424$@1@g22@6@0,s3@1@s3,tg22$@0#vprintf ^276 426$@0@s3,g26@6@0@1@s3,tp0,p2,g26$@0#vfprintf ^277 428$@0@@1@p0$@0@W:bufferoverflowhigh#Use vsnprintf instead##vsprintf ^278 430$@0@@1@p0$@0#vsnprintf ^279 432$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fgetc ^280 435@6@5@1@0@0@0@s3,g26@6@0@1@s3,tp0,tp2,g26$@0#fgets ^281 438$@0@s3,g26@6@0@1@s3,tp1,g26$@0#fputc ^282 440$@0@s3@1@s3,tp1$@0#fputs ^283 442$@0@s3,g26@6@0@1@s3,tp0,g26$@0#getc ^284 444$@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#getchar ^285 447@6@5@1@0@0@1@g21@6@0,s3,g26@6@0@1@s3,tp0,tg21,g26@3@0@0@W:bufferoverflowhigh#Use of gets leads to a buffer overflow vulnerability. Use fgets instead##gets ^286 449$@0@s3,g26@6@0@1@s3,tp1,g26$@0#putc ^287 451$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#putchar ^288 453$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#puts ^289 455$@0@s3@1@s3,tp1$@0#ungetc ^290 457$@0@s3,g26@6@0@1@s3,tp0,tp3,g26$@0#fread ^291 459$@0@s3,g26@6@0@1@s3,tp3,g26$@0#fwrite ^292 462$@0@g26@6@0@1@tp1,g26$@0#fgetpos ^293 464$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fseek ^294 466$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fsetpos ^295 468$@0@g26@6@0@1@g26$@0#ftell ^296 470$@0@@1@tp0$@0#rewind ^297 472$@0@@1@tp0$@0#clearerr ^298 474$@0@g26@6@0@1@g26$@0#feof ^299 476$@0@g26@6@0@1@g26$@0#ferror ^300 478$@1@g26@6@0,g257@6@0,s3@1@s3,tg257$@0#perror ^301 480$^$@0#atof ^302 482$^$@0#atoi ^303 484$^$@0#atol ^304 488$@0@g26@6@0@1@tp1,g26$@0#strtod ^305 490$@0@g26@6@0@1@tp1,g26$@0#strtol ^306 492$@0@g26@6@0@1@tp1,g26$@0#strtoul *1 (Constant) ^307 5$#RAND_MAX *4 (Function) ^308 494$@0@s1@1@s1$@0#rand ^309 496$@0@s1@1@s1$@0#srand ^310 499@6@5@1@0@0^@2@0@0#calloc ^311 502@4@5@1@0@0^@2@0@0#malloc ^312 505@6@5@1@0@0@0@@1@tp0@2@0@0#realloc ^313 507$@0@@1@p0$@0#free *1 (Constant) ^314 5$#EXIT_FAILURE#EXIT_SUCCESS *4 (Function) ^316 509@6@0@6@0@0^$@0#abort ^317 511@6@0@6@0@0^$@0#exit ^318 517$@0@s1@1@s1$@0#atexit ^319 520@6@5@1@0@0^@19@3@0#getenv ^320 522$@0@s3@1@s3$@0#system ^321 529@6@5@1@0@0^@18@0@0#bsearch ^322 535$@0@g26@6@0@1@tp0,g26$@0#qsort ^323 537$^$@0#abs *7 (Struct tag) ^324 538@539#@!2 *0 (Datatype) ^325 538@c@-@0@0@0@0@540#div_t *4 (Function) ^326 542$^$@0#div ^327 544$^$@0#labs *7 (Struct tag) ^328 545@546#@!3 *0 (Datatype) ^329 545@c@-@0@0@0@0@547#ldiv_t *4 (Function) ^330 549$^$@0#ldiv *1 (Constant) ^331 64$#MB_CUR_MAX ^332 5$#WCHAR_MAX#WCHAR_MIN ^334 67$#WEOF *4 (Function) ^335 551$^$@0#btowc ^336 553$@0@s3@1@s3,tp0$@0#fgetwc ^337 557@6@5@1@0@0@0@s3@1@s3,tp0,tp2$@0#fgetws ^338 559$@0@s3@1@s3,tp1$@0#fputwc ^339 561$@0@s3@1@s3,tp1$@0#fputws ^340 563$^$@0#fwide ^341 565@6@0@1@1@0@0@s3@1@tp0,s3$@0#fwprintf ^342 567@6@0@1@2@0@0@s3@1@tp0,s3$@0#fwscanf ^343 569$@0@s3@1@s3,tp0$@0#getwc ^344 571$@0@s3,g21@6@0@1@s3,tg21$@0#getwchar ^345 574$^$@0#mbrlen ^346 576$@0@@1@tp0$@0#mbrtowc ^347 578$^$@0#mbsinit ^348 580$@0@@1@tp0$@0#mbsrtowcs ^349 582$@0@s3@1@s3,tp1$@0#putwc ^350 584$@0@s3,g22@6@0@1@s3,tg22$@0#putwchar ^351 586@6@0@1@1@0@0@@1@tp0$@0#swprintf ^352 588@6@0@1@2@0@0@g21@6@0@1@tg21$@0#swscanf ^353 590$@0@s3@1@s3,tp1$@0#ungetwc ^354 592$@0@s3@1@s3,tp0$@0#vfwprintf ^355 594$@0@@1@tp0$@0#vswprintf ^356 596$@0@s3,g22@6@0@1@s3,tg22$@0#vwprintf ^357 598$@0@@1@tp0$@0#wcrtomb ^358 602$@0@@1@tp0$@0#wcscat ^359 605@6@5@1@0@0^@19@2@0#wcschr ^360 607$^$@0#wcscmp ^361 609$^$@0#wcscoll ^362 612$@0@@1@tp0$@0#wcscpy ^363 614$^$@0#wcscspn *7 (Struct tag) ^364 803@615#@tm *4 (Function) ^365 618$@0@@1@tp0$@0#wcsftime ^366 620$^$@0#wcslen ^367 624$@0@@1@tp0$@0#wcsncat ^368 626$^$@0#wcsncmp ^369 629$@0@@1@tp0$@0#wcsncpy ^370 632@6@5@1@0@0^$@0#wcspbrk ^371 635@6@5@1@0@0^$@0#wcsrchr ^372 638$@0@@1@tp1$@0#wcsrtombs ^373 640$^$@0#wcsspn ^374 643@6@5@1@0@0^@3@0@0#wcsstr ^375 645$@0@@1@tp1$@0#wcstod ^376 648@6@5@1@0@0@0@@1@tp2@3@0@0#wcstok ^377 650$@0@@1@tp1$@0#wcstol ^378 652$@0@@1@tp1$@0#wcstoul ^379 654$@0@@1@tp0$@0#wcsxfrm ^380 656$^$@0#wctob ^381 659@6@5@1@0@0^@3@0@0#wmemchr ^382 661$^$@0#wmemcmp ^383 664$@0@@1@tp0$@0#wmemcpy ^384 667$@0@@1@tp0$@0#wmemmove ^385 670$@0@@1@tp0$@0#wmemset ^386 672@6@0@1@1@0@1@g22@6@0,g26@6@0@1@g26,tg22$@0#wprintf ^387 674@6@0@1@2@0@1@g21@6@0,g26@6@0@1@g26,tg21$@0#wscanf *0 (Datatype) ^388 13@-@-@0@0@0@0@675#wctype_t ^389 13@-@-@0@0@0@0@676#wctrans_t *4 (Function) ^390 680$^$@0#iswalnum ^391 683$^$@0#iswalpha ^392 686$^$@0#iswcntrl ^393 689$^$@0#iswctype ^394 692$^$@0#iswdigit ^395 696$^$@0#iswgraph ^396 699$^$@0#iswlower ^397 702$^$@0#iswprint ^398 705$^$@0#iswpunct ^399 708$^$@0#iswspace ^400 711$^$@0#iswupper ^401 715$^$@0#iswxdigit ^402 719$^$@0#towctrans ^403 722$^$@0#towlower ^404 725$^$@0#towupper ^405 727$^$@0#wctrans ^406 729$^$@0#wctype ^407 731$^$@0#mblen ^408 733$@0@@1@tp0$@0#mbtowc ^409 735$@0@@1@tp0$@0#wctomb ^410 737$@0@@1@tp0$@0#mbstowcs ^411 739$@0@@1@tp0$@0#wcstombs ^412 743$@0@@1@tp0$@0#memcpy ^413 746$@0@@1@tp0$@0#memmove ^414 750$@0@@1@tp0$@0#strcpy ^415 753$@0@@1@tp0$@0#strncpy ^416 756$@0@@1@tp0$@0#strcat ^417 759$@0@@1@tp0$@0#strncat ^418 761$^$@0#memcmp ^419 763$^$@0#strcmp ^420 765$^$@0#strcoll ^421 767$^$@0#strncmp ^422 769$@0@@1@tp0$@0#strxfrm ^423 772@6@5@1@0@0^@3@0@0#memchr ^424 775@6@5@1@0@0^@19@2@0#strchr ^425 777$^$@0#strcspn ^426 780@6@5@1@0@0^@19@2@0#strpbrk ^427 783@6@5@1@0@0^@19@2@0#strrchr ^428 785$^$@0#strspn ^429 788@6@5@1@0@0^@19@2@0#strstr ^430 791@6@5@1@0@0@0@s1,g26@6@0@1@tp0,s1,g26@19@2@0#strtok ^431 795$@0@@1@tp0$@0#memset ^432 798$^@19@3@0#strerror ^433 800$^$@0#strlen *1 (Constant) ^434 5$#CLOCKS_PER_SEC *0 (Datatype) ^435 13@-@-@0@0@0@0@801#clock_t ^436 13@-@-@0@0@0@0@802#time_t *4 (Function) ^437 805$@0@s1@1@s1$@0#clock ^438 807$^$@0#difftime ^439 809$^$@0#mktime ^440 812$@0@@1@tp0$@0#time ^441 815$@0@g26@6@0@1@g26@19@3@0#asctime ^442 818$^@19@3@0#ctime ^443 821$^@19@3@0#gmtime ^444 824$@0@g26@6@0@1@g26@19@3@0#localtime ^445 826$@0@@1@tp0$@0#strftime *0 (Datatype) ^446 13@-@-@0@0@0@0@827#int8_t ^447 13@-@-@0@0@0@0@828#int16_t ^448 13@-@-@0@0@0@0@829#int32_t ^449 13@-@-@0@0@0@0@830#int64_t ^450 14@-@-@0@0@0@0@831#uint8_t ^451 14@-@-@0@0@0@0@832#uint16_t ^452 14@-@-@0@0@0@0@833#uint32_t ^453 14@-@-@0@0@0@0@834#uint64_t ^454 13@-@-@0@0@0@0@835#int_least8_t ^455 13@-@-@0@0@0@0@836#int_least16_t ^456 13@-@-@0@0@0@0@837#int_least32_t ^457 13@-@-@0@0@0@0@838#int_least64_t ^458 14@-@-@0@0@0@0@839#uint_least8_t ^459 14@-@-@0@0@0@0@840#uint_least16_t ^460 14@-@-@0@0@0@0@841#uint_least32_t ^461 14@-@-@0@0@0@0@842#uint_least64_t ^462 13@-@-@0@0@0@0@843#int_fast8_t ^463 13@-@-@0@0@0@0@844#int_fast16_t ^464 13@-@-@0@0@0@0@845#int_fast32_t ^465 13@-@-@0@0@0@0@846#int_fast64_t ^466 14@-@-@0@0@0@0@847#uint_fast8_t ^467 14@-@-@0@0@0@0@848#uint_fast16_t ^468 14@-@-@0@0@0@0@849#uint_fast32_t ^469 14@-@-@0@0@0@0@850#uint_fast64_t ^470 15@-@-@0@0@0@0@851#intptr_t ^471 14@-@-@0@0@0@0@852#uintptr_t ^472 15@-@-@0@0@0@0@853#intmax_t ^473 14@-@-@0@0@0@0@854#uintmax_t *1 (Constant) ^474 5$#INT8_MIN#INT16_MIN#INT32_MIN#INT64_MIN#INT8_MAX#INT16_MAX#INT32_MAX#INT64_MAX#UINT8_MIN#UINT16_MIN#UINT32_MIN#UINT64_MIN#INT_LEAST8_MIN#INT_LEAST16_MIN#INT_LEAST32_MIN#INT_LEAST64_MIN#INT_LEAST8_MAX#INT_LEAST16_MAX#INT_LEAST32_MAX#INT_LEAST64_MAX#UINT_LEAST8_MAX#UINT_LEAST16_MAX#UINT_LEAST32_MAX#UINT_LEAST64_MAX#INT_FAST8_MIN#INT_FAST16_MIN#INT_FAST32_MIN#INT_FAST64_MIN#INT_FAST8_MAX#INT_FAST16_MAX#INT_FAST32_MAX#INT_FAST64_MAX#UINT_FAST8_MAX#UINT_FAST16_MAX#UINT_FAST32_MAX#UINT_FAST64_MAX ^510 64$#INTPTR_MIN#INTPTR_MAX ;; Library constraints start_Buffer_Constraints setvbuf pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 3 e2 2 3 -1 ;; end precondition constraints post:EMPTY snprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY vsnprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY fgets pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 0 C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints fread pre:EMPTY post: C 0@1@4 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints fwrite pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY fgetpos pre: C 0@1@3 l 1 1 2 2 Param 460 1 r 2 3 0 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 460 1 r 2 3 0 ;; end precondition constraints calloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints malloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints realloc pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints memcpy pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memmove pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY strcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@4 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints strncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints strcat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 3 2 2 Result r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints strncat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints strchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strrchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strstr pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints memset pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints strlen pre:EMPTY post: C 0@1@4 l 2 2 Result r 1 3 2 2 Param 23 0 ;; end precondition constraints asctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ;; Modules access _Bool#1@ types#1@ standard#9@ ;;End splint-3.1.2.dfsg1/lib/standardstrict.lcd0000644021234200000250000010460310645776246015753 0ustar fax;;; Splint Library standardstrict.lcd ;;Splint 3.018000 ;;lib:310 ;;ctTable 0 u-2 19 38 0 p1|-2 20 39 0 b-2 21 40 0 p3|-2 22 41 0 p4|-2 23 42 0 p5|-2 24 43 0 p6|-2 25 44 0 p7|-2 26 45 0 p8|-2 27 46 0 p9|-2 28 47 0 p10|-2 29 48 0 p11|-2 30 49 0 p12|-2 31 50 0 p13|-2 32 51 0 p14|-2 33 52 0 p15|-2 34 53 0 p16|-2 35 54 0 p17|-2 36 55 0 p18|-2 37 56 1 t0|0 460 -1 1 t1|1& 1 t2|2& 1 t3|3& 1 t4|4 461 -1 1 t5|5& 1 t6|6& 1 t7|7& 1 t8|8& 1 t9|9& 1 t10|10& 1 t11|11& 1 t12|12& 1 t13|13& 1 t14|14& 1 t15|15& 1 t16|16& 1 t17|17& 1 t18|18& 2 y0|0& 2 y1|1& 2 y2|2& 2 y3|3& 2 y4|4& 2 y5|5& 2 y6|6& 2 y7|7& 2 y8|8& 2 y9|9& 2 y10|10& 2 y11|11& 2 y12|12& 2 y13|13& 2 y14|14& 2 y15|15& 2 y16|16& 2 y17|17& 2 y18|18& -2 ?! 0 a0|& 0 s11|& 0 s12|& 0 s13|& 0 s27|& 0 s29|& 0 s30|& 0 s31|& 0 s32|-1 529 -1 0 s33|& 0 a34|-1 547 -1 3 C0.5/20|! 3 C0.69/2|! 3 f0 (2|@7|$#,)! 3 f1 (2|@7|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f4 (5|$#,)! 3 f0 (5|$#,)! 3 f4 (5|$#,)! 3 Slconv{23|@1|0@0@3&#decimal_point,23|@1|0@0@3&#thousands_sep,23|@1|0@0@3&#grouping,23|@1|0@0@3&#int_curr_symbol,23|@1|0@0@3&#currency_symbol,23|@1|0@0@3&#mon_decimal_point,23|@1|0@0@3&#mon_thousands_sep,23|@1|0@0@3&#mon_grouping,23|@1|0@0@3&#positive_sign,23|@1|0@0@3&#negative_sign,4|@1|^#int_frac_digits,4|@1|^#frac_digits,4|@1|^#p_cs_precedes,4|@1|^#p_sep_by_space,4|@1|^#n_cs_precedes,4|@1|^#n_sep_by_space,4|@1|^#p_sign_posn,4|@1|^#n_sign_posn,}! 0 s51|-1 106 -1 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f23 (5|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 1 t100|100& 3 f106 ()! 0 s106|& 0 s107|& 3 C0.17/18|! 3 C0.16/110|! 0 s121|& 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,24|4@0@7&#,)! 3 f17 (17|$#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,36|4@0@7&#,)! 3 f17 (17|$#,36|4@0@7&#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,9|$#,)! 3 f17 (17|$#,9|$#,)! 3 f0 (18|$#,9|$#,)! 3 f18 (18|$#,9|$#,)! 3 f0 (17|$#,)! 3 f5 (17|$#,)! 3 f0 (16|$#,)! 3 f5 (16|$#,)! 3 f0 (18|$#,)! 3 f5 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (16|$#,)! 3 f9 (16|$#,)! 3 f0 (18|$#,)! 3 f9 (18|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (16|$#,)! 3 f11 (16|$#,)! 3 f0 (18|$#,)! 3 f11 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,24|4@0@7&#,)! 3 f17 (17|$#,17|$#,24|4@0@7&#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,18|$#,)! 3 f17 (17|$#,18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,17|$#,)! 3 f17 (17|$#,17|$#,17|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 0 a224|& 3 f0 (317|4@0@7&#,)! 3 f5 (317|4@0@7&#,)! 3 f0 (317|$#,5|$#,)! 3 f1 (317|$#,5|$#,)! 0 s233|& 3 ?! 3 f323 (5|$#,)! 3 f1 (5|$#,)^326 1 t325|325& 3 ?! 3 f327 (5|$#,)! 3 f1 (5|$#,)^330 1 t329|329& 3 ?! 3 f331 (5|$#,)! 3 f1 (5|$#,)^334 1 t333|333& 3 ?! 3 f335 (5|$#,)! 3 f1 (5|$#,)^338 1 t337|337& 3 f0 (5|$#,338|0@5@7&#,)! 3 f19 (5|$#,338|0@5@7&#,)^341 1 t340|340& 3 ?! 3 f342 (5|$#,)! 3 f19 (5|$#,)! 3 f1 (5|$#,338|0@5@7&#,)! 3 f1 (5|$#,)! 3 f346 (5|$#,338|0@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 a239|& 3 f0 (350|4@0@7&#,!.,)! 3 f1 (350|4@0@7&#,!.,)! 3 f0 (350|$#,)! 3 f1 (350|$#,)! 3 f0 (350|4@0@7&#,350|$#,)! 3 f1 (350|4@0@7&#,350|$#,)! 0 a243|-1 359 -1 0 a244|-1 435 -1 1 t357|357& 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f19 ()! 3 f359 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|0@5@7&#,)! 3 f5 (359|0@5@7&#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f359 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,359|$#,)! 3 f19 (23|$#,23|$#,359|$#,)! 3 f359 (23|$#,23|$#,359|$#,)! 3 f0 (359|$#,23|4@5@19@2@0#,)! 3 f1 (359|$#,23|4@5@19@2@0#,)! 3 f0 (359|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f5 (359|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f0 (359|$#,23|$#,!.,)! 3 f5 (359|$#,23|$#,!.,)! 3 f0 (359|$#,23|$#,!.,)! 3 f5 (359|$#,23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|$#,350|$#,)! 3 f5 (23|$#,350|$#,)! 3 f0 (359|$#,23|$#,350|$#,)! 3 f5 (359|$#,23|$#,350|$#,)! 3 f0 (23|4@0@7&#,23|$#,350|$#,)! 3 f5 (23|4@0@7&#,23|$#,350|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,350|$#,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,350|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 f19 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 f23 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 C0.5/4|! 3 f0 (411|$#,359|$#,)! 3 f5 (411|$#,359|$#,)! 3 f0 (23|$#,359|$#,)! 3 f5 (23|$#,359|$#,)! 3 f0 (359|@7|$#,)! 3 f5 (359|@7|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|4@0@7&#,)! 3 f19 (23|4@0@7&#,)! 3 f23 (23|4@0@7&#,)! 3 f0 (411|$#,359|@7|$#,)! 3 f5 (411|$#,359|@7|$#,)! 3 f0 (411|$#,)! 3 f5 (411|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (411|$#,359|$#,)! 3 f5 (411|$#,359|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f0 (20|$#,64|$#,64|$#,359|$#,)! 3 f64 (20|$#,64|$#,64|$#,359|$#,)! 1 t358|358& 3 f0 (359|$#,435|4@0@7&#,)! 3 f5 (359|$#,435|4@0@7&#,)! 3 f0 (359|$#,9|$#,5|$#,)! 3 f5 (359|$#,9|$#,5|$#,)! 3 f0 (359|$#,435|$#,)! 3 f5 (359|$#,435|$#,)! 3 f0 (359|$#,)! 3 f9 (359|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (23|0@5@7&#,)! 3 f1 (23|0@5@7&#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 1 t19|19& 1 t23|23& 3 f0 (23|$#,461|4@5@7&#,)! 3 f17 (23|$#,461|4@5@7&#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f9 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f10 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (20|4@5@2&#,)! 3 f1 (20|4@5@2&#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 ?! 3 f487 ()! 3 f1 ()^490 1 t489|489& 3 f0 (490|$#,)! 3 f5 (490|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 ?! 3 f498 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^501 1 t500|500& 3 f0 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 ?! 3 f505 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^508 1 t507|507& 3 f0 (20|$#,64|$#,64|$#,508|$#,)! 3 f1 (20|$#,64|$#,64|$#,508|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 S!2{5|@1|^#quot,5|@1|^#rem,}! 0 s324|& 0 s325|& 3 f0 (5|$#,5|$#,)! 3 f515 (5|$#,5|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 3 S!3{9|@1|^#quot,9|@1|^#rem,}! 0 s328|& 0 s329|& 3 f0 (9|$#,9|$#,)! 3 f522 (9|$#,9|$#,)! 3 f0 (5|$#,)! 3 f67 (5|$#,)! 3 f0 (359|$#,)! 3 f67 (359|$#,)! 1 t66|66 611 -1 3 f0 (529|@5|$#,5|$#,359|$#,)! 3 f19 (529|@5|$#,5|$#,359|$#,)! 3 f529 (529|@5|$#,5|$#,359|$#,)! 3 f0 (66|$#,359|$#,)! 3 f67 (66|$#,359|$#,)! 3 f0 (529|$#,359|$#,)! 3 f5 (529|$#,359|$#,)! 3 f0 (359|$#,5|$#,)! 3 f5 (359|$#,5|$#,)! 3 f0 (359|$#,529|$#,!.,)! 3 f5 (359|$#,529|$#,!.,)! 3 f0 (359|$#,529|$#,!.,)! 3 f5 (359|$#,529|$#,!.,)! 3 f0 (359|@7|$#,)! 3 f67 (359|@7|$#,)! 3 f0 ()! 3 f67 ()! 1 t68|68& 3 f0 (23|$#,64|$#,547|0@5@7&#,)! 3 f64 (23|$#,64|$#,547|0@5@7&#,)! 3 f0 (529|0@5@7&#,23|$#,64|$#,547|0@5@7&#,)! 3 f64 (529|0@5@7&#,23|$#,64|$#,547|0@5@7&#,)! 3 f0 (547|0@5@7&#,)! 3 f5 (547|0@5@7&#,)! 3 f0 (529|0@5@7&#,461|$#,64|$#,547|0@5@7&#,)! 3 f64 (529|0@5@7&#,461|$#,64|$#,547|0@5@7&#,)! 3 f0 (66|$#,359|@7|$#,)! 3 f67 (66|$#,359|@7|$#,)! 3 f0 (66|$#,)! 3 f67 (66|$#,)! 3 f0 (529|$#,64|$#,529|$#,!.,)! 3 f5 (529|$#,64|$#,529|$#,!.,)! 3 f0 (529|$#,529|$#,!.,)! 3 f5 (529|$#,529|$#,!.,)! 3 f0 (67|$#,359|$#,)! 3 f67 (67|$#,359|$#,)! 3 f0 (359|$#,529|$#,350|$#,)! 3 f5 (359|$#,529|$#,350|$#,)! 3 f0 (529|$#,64|$#,529|$#,350|$#,)! 3 f5 (529|$#,64|$#,529|$#,350|$#,)! 3 f0 (529|$#,350|$#,)! 3 f5 (529|$#,350|$#,)! 3 f0 (23|4@5@7&#,66|$#,547|0@5@7&#,)! 3 f64 (23|4@5@7&#,66|$#,547|0@5@7&#,)! 3 C0.1/529|! 3 f0 (529|@5|4@0@9&#,529|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,)! 3 f574 (529|@5|4@0@9&#,529|$#,)! 3 f0 (529|@5|$#,66|$#,)! 3 f19 (529|@5|$#,66|$#,)! 3 f529 (529|@5|$#,66|$#,)! 3 f0 (529|$#,529|$#,)! 3 f5 (529|$#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f5 (529|$#,529|$#,)! 3 f0 (529|@5|4@0@9&#,529|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,)! 3 f574 (529|@5|4@0@9&#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f64 (529|$#,529|$#,)! 0 s364|-1 591 -1 1 t590|590& 3 f0 (529|4@0@7&#,64|$#,529|$#,591|$#,)! 3 f64 (529|4@0@7&#,64|$#,529|$#,591|$#,)! 3 f0 (529|$#,)! 3 f64 (529|$#,)! 3 C0.1/529|! 3 f0 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f596 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f0 (529|$#,529|$#,64|$#,)! 3 f5 (529|$#,529|$#,64|$#,)! 3 f0 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f596 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,)! 3 f19 (529|@5|$#,529|$#,)! 3 f529 (529|@5|$#,529|$#,)! 3 f0 (529|@5|$#,66|$#,)! 3 f19 (529|@5|$#,66|$#,)! 3 f529 (529|@5|$#,66|$#,)! 1 t529|529& 3 f0 (23|0@5@7&#,611|$#,64|$#,547|0@5@7&#,)! 3 f64 (23|0@5@7&#,611|$#,64|$#,547|0@5@7&#,)! 3 f0 (529|$#,529|$#,)! 3 f64 (529|$#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f19 (529|$#,529|$#,)! 3 f529 (529|$#,529|$#,)! 3 f0 (529|$#,611|0@5@7&#,)! 3 f17 (529|$#,611|0@5@7&#,)! 3 f0 (529|0@5@7&#,529|$#,611|$#,)! 3 f19 (529|0@5@7&#,529|$#,611|$#,)! 3 f529 (529|0@5@7&#,529|$#,611|$#,)! 3 f0 (529|$#,611|0@5@7&#,5|$#,)! 3 f9 (529|$#,611|0@5@7&#,5|$#,)! 3 f0 (529|$#,611|0@5@7&#,5|$#,)! 3 f10 (529|$#,611|0@5@7&#,5|$#,)! 3 f0 (529|0@5@7&#,529|$#,64|$#,)! 3 f64 (529|0@5@7&#,529|$#,64|$#,)! 3 f0 (67|$#,)! 3 f5 (67|$#,)! 3 f0 (529|$#,66|$#,64|$#,)! 3 f19 (529|$#,66|$#,64|$#,)! 3 f529 (529|$#,66|$#,64|$#,)! 3 f0 (529|$#,529|$#,64|$#,)! 3 f5 (529|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,64|$#,)! 3 f19 (529|@5|$#,529|$#,64|$#,)! 3 f529 (529|@5|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,64|$#,)! 3 f19 (529|@5|$#,529|$#,64|$#,)! 3 f529 (529|@5|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,66|$#,64|$#,)! 3 f19 (529|@5|$#,66|$#,64|$#,)! 3 f529 (529|@5|$#,66|$#,64|$#,)! 3 f0 (529|$#,!.,)! 3 f5 (529|$#,!.,)! 3 f0 (529|$#,!.,)! 3 f5 (529|$#,!.,)! 0 s388|& 0 s389|& 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,650|$#,)! 3 f2 (67|$#,650|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,651|$#,)! 3 f67 (67|$#,651|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f0 (23|$#,)! 3 f651 (23|$#,)! 3 f0 (23|$#,)! 3 f650 (23|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (529|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (529|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! 3 f0 (529|4@0@7&#,23|$#,64|$#,)! 3 f64 (529|4@0@7&#,23|$#,64|$#,)! 3 f0 (23|4@0@7&#,529|$#,64|$#,)! 3 f64 (23|4@0@7&#,529|$#,64|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f696 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f0 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f696 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 C0.1/23|! 3 f0 (23|@5|4@0@9&#,23|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,)! 3 f703 (23|@5|4@0@9&#,23|$#,)! 3 f0 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f703 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,)! 3 f703 (23|@5|0@0@9&#,23|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f703 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f0 (20|$#,20|$#,64|$#,)! 3 f5 (20|$#,20|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (23|4@5@7&#,23|$#,64|$#,)! 3 f64 (23|4@5@7&#,23|$#,64|$#,)! 3 f0 (20|$#,5|$#,64|$#,)! 3 f19 (20|$#,5|$#,64|$#,)! 3 f20 (20|$#,5|$#,64|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|0@5@7&#,23|$#,)! 3 f19 (23|@5|0@5@7&#,23|$#,)! 3 f23 (23|@5|0@5@7&#,23|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f748 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f64 (23|$#,)! 0 s435|& 0 s436|-1 766 -1 3 Stm{5|@1|^#tm_sec,5|@1|^#tm_min,5|@1|^#tm_hour,5|@1|^#tm_mday,5|@1|^#tm_mon,5|@1|^#tm_year,5|@1|^#tm_wday,5|@1|^#tm_yday,5|@1|^#tm_isdst,}! 3 f0 ()! 3 f757 ()! 3 f0 (758|$#,758|$#,)! 3 f17 (758|$#,758|$#,)! 3 f0 (591|$#,)! 3 f758 (591|$#,)! 1 t758|758& 3 f0 (766|4@5@7&#,)! 3 f758 (766|4@5@7&#,)! 3 f0 (591|$#,)! 3 f19 (591|$#,)! 3 f23 (591|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f23 (766|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f591 (766|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f591 (766|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,591|$#,)! 3 f64 (23|4@0@7&#,64|$#,23|$#,591|$#,)! 0 s446|& 0 s447|& 0 s448|& 0 s449|& 0 s450|& 0 s451|& 0 s452|& 0 s453|& 0 s454|& 0 s455|& 0 s456|& 0 s457|& 0 s458|& 0 s459|& 0 s460|& 0 s461|& 0 s462|& 0 s463|& 0 s464|& 0 s465|& 0 s466|& 0 s467|& 0 s468|& 0 s469|& 0 s470|& 0 s471|& 0 s472|& 0 s473|& ;;tistable 0 34 34,224 224 34,224,239 239 34,224,239,243 243 34,224,239,243,244 244 ;;symTable *0 (Datatype) ^0 2@a@-@0@0@0@0@2#_Bool *1 (Constant) ^1 2@i0@0@6#false ^2 2@i1@0@0#true *11 (GlobalMarker) *1 (Constant) ^4 5$#__LINE__ ^5 23$#__DATE__#__FILE__#__BASE_FILE__#__func__ ^9 5$#__INCLUDE_LEVEL__ ^10 23$#__VERSION__ *0 (Datatype) ^11 13@c@-@0@0@0@0@59#__SIZE_TYPE__ ^12 13@c@-@0@0@0@0@60#__PTRDIFF_TYPE__ ^13 13@c@-@0@0@0@0@61#__WCHAR_TYPE__ *1 (Constant) ^14 23$#__USER_LABEL_PREFIX__#__REGISTER_PREFIX__#__TIME__ ^17 5$#__STDC__#S_SPLINT_S#__LCLINT__#__i686 *3 (Variable) ^21 359|@1|6@0@0@0@2#stdin#stdout *1 (Constant) ^23 5$#EDOM#ERANGE#EILSEQ *3 (Variable) ^26 5|@1|6@0@0@0@4#errno *0 (Datatype) ^27 2@-@-@0@0@0@0@62#bool *1 (Constant) ^28 5@i1@0@0#__bool_true_false_are_defined *0 (Datatype) ^29 13@-@-@0@0@0@0@63#ptrdiff_t ^30 14@-@-@0@0@0@0@64#size_t ^31 15@-@-@0@0@0@0@65#ssize_t ^32 13@-@-@0@0@0@0@66#wchar_t ^33 13@-@-@0@0@0@0@67#wint_t ^34 0@a@=@0@0@0@0@68#mbstate_t *1 (Constant) ^35 0@i0@0@6#NULL ^36 2$#NDEBUG *4 (Function) ^37 72@6@0@8@0@0^$@0#assert ^38 74$^$@0#isalnum ^39 76$^$@0#isalpha ^40 78$^$@0#iscntrl ^41 80$^$@0#isdigit ^42 82$^$@0#isgraph ^43 84$^$@0#islower ^44 86$^$@0#isprint ^45 88$^$@0#ispunct ^46 90$^$@0#isspace ^47 92$^$@0#isupper ^48 94$^$@0#isxdigit ^49 96$^$@0#tolower ^50 98$^$@0#toupper *7 (Struct tag) ^51 99@100#@lconv *1 (Constant) ^52 5$#LC_ALL#LC_COLLATE#LC_CTYPE#LC_MONETARY#LC_NUMERIC#LC_TIME *4 (Function) ^58 103@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@19@3@0#setlocale ^59 107$^@3@0@0#localeconv *3 (Variable) ^60 5|@1|6@0@0@0@1#DBL_DIG ^61 17|@1|6@0@0@0@1#DBL_EPSILON ^62 5|@1|6@0@0@0@1#DBL_MANT_DIG ^63 17|@1|6@0@0@0@1#DBL_MAX ^64 5|@1|6@0@0@0@1#DBL_MAX_10_EXP#DBL_MAX_EXP ^66 17|@1|6@0@0@0@1#DBL_MIN ^67 5|@1|6@0@0@0@1#DBL_MIN_10_EXP#DBL_MIN_EXP#FLT_DIG ^70 16|@1|6@0@0@0@1#FLT_EPSILON ^71 5|@1|6@0@0@0@1#FLT_MANT_DIG ^72 16|@1|6@0@0@0@1#FLT_MAX ^73 5|@1|6@0@0@0@1#FLT_MAX_10_EXP#FLT_MAX_EXP ^75 16|@1|6@0@0@0@1#FLT_MIN ^76 5|@1|6@0@0@0@1#FLT_MIN_10_EXP#FLT_MIN_EXP *1 (Constant) ^78 5$#FLT_RADIX *3 (Variable) ^79 5|@1|6@0@0@0@1#FLT_ROUNDS#LDBL_DIG ^81 18|@1|6@0@0@0@1#LDBL_EPSILON ^82 5|@1|6@0@0@0@1#LDBL_MANT_DIG ^83 18|@1|6@0@0@0@1#LDBL_MAX ^84 5|@1|6@0@0@0@1#LDBL_MAX_10_EXP#LDBL_MAX_EXP ^86 18|@1|6@0@0@0@1#LDBL_MIN ^87 5|@1|6@0@0@0@1#LDBL_MIN_10_EXP#LDBL_MIN_EXP *1 (Constant) ^89 5$#CHAR_BIT ^90 4$#CHAR_MAX#CHAR_MIN ^92 5$#INT_MAX#INT_MIN ^94 9$#LONG_MAX#LONG_MIN#MB_LEN_MAX ^97 4$#SCHAR_MAX#SCHAR_MIN ^99 7$#SHRT_MAX#SHRT_MIN ^101 3$#UCHAR_MAX#UCHAR_MIN ^103 6$#UINT_MAX ^104 10$#ULONG_MAX ^105 8$#USHRT_MAX *0 (Datatype) ^106 16@-@-@0@0@0@0@108#float_t ^107 17@-@-@0@0@0@0@109#double_t *1 (Constant) ^108 17$#HUGE_VAL ^109 16$#HUGE_VALF ^110 18$#HUGE_VALL ^111 16$#INFINITY#NAN ^113 5$#FP_INFINITE#FP_NAN#FP_NORMAL#FP_SUBNORMAL#FP_ZERO#FP_ILOGB0#FP_ILOGBNAN#DECIMAL_DIG *0 (Datatype) ^121 111@-@-@0@0@0@0@112#s_real_t *4 (Function) ^122 114$^$@0#fpclassify ^123 116$^$@0#signbit ^124 118$^$@0#isfinite ^125 120$^$@0#isnormal ^126 122$^$@0#isnan ^127 124$^$@0#isinf ^128 126$@0@g26@6@0@1@g26$@0#acos ^129 128$@0@g26@6@0@1@g26$@0#asin ^130 130$^$@0#atan ^131 132$^$@0#atan2 ^132 134$^$@0#cos ^133 136$^$@0#sin ^134 138$^$@0#tan ^135 140$@0@g26@6@0@1@g26$@0#cosh ^136 142$@0@g26@6@0@1@g26$@0#sinh ^137 144$^$@0#tanh ^138 146$@0@g26@6@0@1@g26$@0#acosh ^139 148$@0@g26@6@0@1@g26$@0#asinh ^140 150$@0@g26@6@0@1@g26$@0#atanh ^141 152$@0@g26@6@0@1@g26$@0#exp ^142 154$@0@@1@tp1$@0#frexp ^143 156$@0@g26@6@0@1@g26$@0#ldexp ^144 158$@0@g26@6@0@1@g26$@0#log ^145 160$@0@g26@6@0@1@g26$@0#log10 ^146 162$@0@@1@tp1$@0#modf ^147 164$@0@g26@6@0@1@g26$@0#exp2 ^148 166$@0@g26@6@0@1@g26$@0#expm1 ^149 168$@0@g26@6@0@1@g26$@0#log1p ^150 170$@0@g26@6@0@1@g26$@0#log2 ^151 172$@0@g26@6@0@1@g26$@0#logb ^152 174$@0@g26@6@0@1@g26$@0#scalbn ^153 176$@0@g26@6@0@1@g26$@0#scalbln ^154 178$@0@g26@6@0@1@g26$@0#scalblnl ^155 180$@0@g26@6@0@1@g26$@0#ilogb ^156 182$@0@g26@6@0@1@g26$@0#ilogbf ^157 184$@0@g26@6@0@1@g26$@0#ilogbl ^158 186$^$@0#fabs ^159 188$^$@0#fabsf ^160 190$^$@0#fabsl ^161 192$@0@g26@6@0@1@g26$@0#pow ^162 194$@0@g26@6@0@1@g26$@0#powf ^163 196$@0@g26@6@0@1@g26$@0#powl ^164 198$@0@g26@6@0@1@g26$@0#sqrt ^165 200$@0@g26@6@0@1@g26$@0#sqrtf ^166 202$@0@g26@6@0@1@g26$@0#sqrtl ^167 204$^$@0#cbrt ^168 206$^$@0#cbrtf ^169 208$^$@0#cbrtl ^170 210$@0@g26@6@0@1@g26$@0#hypot ^171 212$@0@g26@6@0@1@g26$@0#hypotf ^172 214$@0@g26@6@0@1@g26$@0#hypotl ^173 216$^$@0#erf ^174 218$^$@0#erfc ^175 220$^$@0#erff ^176 222$^$@0#erfl ^177 224$^$@0#erfcf ^178 226$^$@0#erfcl ^179 228$@0@g26@6@0@1@g26$@0#gamma ^180 230$@0@g26@6@0@1@g26$@0#gammaf ^181 232$@0@g26@6@0@1@g26$@0#gammal ^182 234$@0@g26@6@0@1@g26$@0#lgamma ^183 236$@0@g26@6@0@1@g26$@0#lgammaf ^184 238$@0@g26@6@0@1@g26$@0#lgammal ^185 240$^$@0#ceil ^186 242$^$@0#ceilf ^187 244$^$@0#ceill ^188 246$^$@0#floor ^189 248$^$@0#floorf ^190 250$^$@0#floorl ^191 252$^$@0#nearbyint ^192 254$^$@0#nearbyintf ^193 256$^$@0#nearbyintl ^194 258$^$@0#rint ^195 260$^$@0#rintf ^196 262$^$@0#rintl ^197 264$@0@g26@6@0@1@g26$@0#lrint ^198 266$@0@g26@6@0@1@g26$@0#lrintf ^199 268$@0@g26@6@0@1@g26$@0#lrintl ^200 270$@0@g26@6@0@1@g26$@0#llrint ^201 272$@0@g26@6@0@1@g26$@0#llrintf ^202 274$@0@g26@6@0@1@g26$@0#llrintl ^203 276$^$@0#round ^204 278$@0@g26@6@0@1@g26$@0#lround ^205 280$@0@g26@6@0@1@g26$@0#llround ^206 282$^$@0#trunc ^207 284$^$@0#fmod ^208 286$^$@0#remainder ^209 288$@0@@1@tp2$@0#remquo ^210 290$^$@0#copysign ^211 292$^$@0#nan ^212 294$^$@0#nextafter ^213 296$^$@0#nextafterx ^214 298$@0@g26@6@0@1@g26$@0#fdim ^215 300$^$@0#fmax ^216 302$^$@0#fmin ^217 304$^$@0#fma ^218 306$^$@0#isgreater ^219 308$^$@0#isgreaterequal ^220 310$^$@0#isless ^221 312$^$@0#islessequal ^222 314$^$@0#islessgreater ^223 316$^$@0#isunordered *0 (Datatype) ^224 20@a@+@0@0@0@0@317#jmp_buf *4 (Function) ^225 319$@0@@1@p0$@0#setjmp ^226 321@6@0@5@0@0^$@0#longjmp *1 (Constant) ^227 5$#SIGABRT#SIGFPE#SIGILL#SIGINT#SIGSEGV#SIGTERM *0 (Datatype) ^233 13@-@-@0@0@0@0@322#sig_atomic_t *1 (Constant) ^234 326$#SIG_DFL ^235 330$#SIG_ERR ^236 334$#SIG_IGN *4 (Function) ^237 347@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26$@0#signal ^238 349@6@0@5@0@0$$@0#raise *0 (Datatype) ^239 20@a@+@0@0@0@0@350#va_list *4 (Function) ^240 352$@0@@1@p0$@0#va_start ^241 354$@0@@1@p0$@0#va_end ^242 356$$$@0#va_copy *0 (Datatype) ^243 20@a@+@0@0@0@0@357#FILE ^244 20@a@+@0@0@0@0@358#fpos_t *1 (Constant) ^245 64$#_IOFBF#_IOLBF#_IONBF#BUFSIZ ^249 5$#EOF#FOPEN_MAX#FILENAME_MAX#L_tmpnam#SEEK_CUR#SEEK_END#SEEK_SET#TMP_MAX *3 (Variable) ^257 359|@1|6@0@0@0@2#stderr *4 (Function) ^258 361$@0@s3,g26@6@0@1@s3,g26$@0#remove ^259 363$@0@s3,g26@6@0@1@s3,g26$@0#rename ^260 366@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#tmpfile ^261 369$@0@s1@1@tp0,s1@19@3@0#tmpnam ^262 371$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fclose ^263 373$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fflush ^264 376@6@5@1@0@0@0@s3@1@s3@18@0@0#fopen ^265 379@6@5@1@0@0@0@s3,g26@6@0@1@tp2,s3,g26@18@0@0#freopen ^266 381$@0@s3@1@s3,tp0,tp1$@0#setbuf ^267 383$@0@s3@1@s3,tp0,tp1$@0#setvbuf ^268 385@6@0@1@1@0@0@s3@1@s3,tp0$@0#fprintf ^269 387@6@0@1@2@0@0@s3,g26@6@0@1@s3,tp0,g26$@0#fscanf ^270 389@6@0@1@1@0@1@g22@6@0,s3@1@s3,tg22$@0#printf ^271 391@6@0@1@2@0@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#scanf ^272 393@6@0@1@1@0@0@@1@tp0$@0@W:bufferoverflowhigh#Buffer overflow possible with sprintf. Recommend using snprintf instead##sprintf ^273 395@6@0@1@1@0@0@@1@p0$@0#snprintf ^274 397@6@0@1@2@0@0@g26@6@0@1@g26$@0#sscanf ^275 399$@1@g22@6@0,s3@1@s3,tg22$@0#vprintf ^276 401$@0@s3,g26@6@0@1@s3,tp0,p2,g26$@0#vfprintf ^277 403$@0@@1@p0$@0@W:bufferoverflowhigh#Use vsnprintf instead##vsprintf ^278 405$@0@@1@p0$@0#vsnprintf ^279 407$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fgetc ^280 410@6@5@1@0@0@0@s3,g26@6@0@1@s3,tp0,tp2,g26$@0#fgets ^281 413$@0@s3,g26@6@0@1@s3,tp1,g26$@0#fputc ^282 415$@0@s3@1@s3,tp1$@0#fputs ^283 417$@0@s3,g26@6@0@1@s3,tp0,g26$@0#getc ^284 419$@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#getchar ^285 422@6@5@1@0@0@1@g21@6@0,s3,g26@6@0@1@s3,tp0,tg21,g26@3@0@0@W:bufferoverflowhigh#Use of gets leads to a buffer overflow vulnerability. Use fgets instead##gets ^286 424$@0@s3,g26@6@0@1@s3,tp1,g26$@0#putc ^287 426$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#putchar ^288 428$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#puts ^289 430$@0@s3@1@s3,tp1$@0#ungetc ^290 432$@0@s3,g26@6@0@1@s3,tp0,tp3,g26$@0#fread ^291 434$@0@s3,g26@6@0@1@s3,tp3,g26$@0#fwrite ^292 437$@0@g26@6@0@1@tp1,g26$@0#fgetpos ^293 439$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fseek ^294 441$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fsetpos ^295 443$@0@g26@6@0@1@g26$@0#ftell ^296 445$@0@@1@tp0$@0#rewind ^297 447$@0@@1@tp0$@0#clearerr ^298 449$@0@g26@6@0@1@g26$@0#feof ^299 451$@0@g26@6@0@1@g26$@0#ferror ^300 453$@1@g26@6@0,g257@6@0,s3@1@s3,tg257$@0#perror ^301 455$^$@0#atof ^302 457$^$@0#atoi ^303 459$^$@0#atol ^304 463$@0@g26@6@0@1@tp1,g26$@0#strtod ^305 465$@0@g26@6@0@1@tp1,g26$@0#strtol ^306 467$@0@g26@6@0@1@tp1,g26$@0#strtoul *1 (Constant) ^307 5$#RAND_MAX *4 (Function) ^308 469$@0@s1@1@s1$@0#rand ^309 471$@0@s1@1@s1$@0#srand ^310 474@6@5@1@0@0^@2@0@0#calloc ^311 477@4@5@1@0@0^@2@0@0#malloc ^312 480@6@5@1@0@0@0@@1@tp0@2@0@0#realloc ^313 482$@0@@1@p0$@0#free *1 (Constant) ^314 5$#EXIT_FAILURE#EXIT_SUCCESS *4 (Function) ^316 484@6@0@6@0@0^$@0#abort ^317 486@6@0@6@0@0^$@0#exit ^318 492$@0@s1@1@s1$@0#atexit ^319 495@6@5@1@0@0^@19@3@0#getenv ^320 497$@0@s3@1@s3$@0#system ^321 504@6@5@1@0@0^@18@0@0#bsearch ^322 510$@0@g26@6@0@1@tp0,g26$@0#qsort ^323 512$^$@0#abs *7 (Struct tag) ^324 513@514#@!2 *0 (Datatype) ^325 513@c@-@0@0@0@0@515#div_t *4 (Function) ^326 517$^$@0#div ^327 519$^$@0#labs *7 (Struct tag) ^328 520@521#@!3 *0 (Datatype) ^329 520@c@-@0@0@0@0@522#ldiv_t *4 (Function) ^330 524$^$@0#ldiv *1 (Constant) ^331 64$#MB_CUR_MAX ^332 5$#WCHAR_MAX#WCHAR_MIN ^334 67$#WEOF *4 (Function) ^335 526$^$@0#btowc ^336 528$@0@s3@1@s3,tp0$@0#fgetwc ^337 532@6@5@1@0@0@0@s3@1@s3,tp0,tp2$@0#fgetws ^338 534$@0@s3@1@s3,tp1$@0#fputwc ^339 536$@0@s3@1@s3,tp1$@0#fputws ^340 538$^$@0#fwide ^341 540@6@0@1@1@0@0@s3@1@tp0,s3$@0#fwprintf ^342 542@6@0@1@2@0@0@s3@1@tp0,s3$@0#fwscanf ^343 544$@0@s3@1@s3,tp0$@0#getwc ^344 546$@0@s3,g21@6@0@1@s3,tg21$@0#getwchar ^345 549$^$@0#mbrlen ^346 551$@0@@1@tp0$@0#mbrtowc ^347 553$^$@0#mbsinit ^348 555$@0@@1@tp0$@0#mbsrtowcs ^349 557$@0@s3@1@s3,tp1$@0#putwc ^350 559$@0@s3,g22@6@0@1@s3,tg22$@0#putwchar ^351 561@6@0@1@1@0@0@@1@tp0$@0#swprintf ^352 563@6@0@1@2@0@0@g21@6@0@1@tg21$@0#swscanf ^353 565$@0@s3@1@s3,tp1$@0#ungetwc ^354 567$@0@s3@1@s3,tp0$@0#vfwprintf ^355 569$@0@@1@tp0$@0#vswprintf ^356 571$@0@s3,g22@6@0@1@s3,tg22$@0#vwprintf ^357 573$@0@@1@tp0$@0#wcrtomb ^358 577$@0@@1@tp0$@0#wcscat ^359 580@6@5@1@0@0^@19@2@0#wcschr ^360 582$^$@0#wcscmp ^361 584$^$@0#wcscoll ^362 587$@0@@1@tp0$@0#wcscpy ^363 589$^$@0#wcscspn *7 (Struct tag) ^364 759@590#@tm *4 (Function) ^365 593$@0@@1@tp0$@0#wcsftime ^366 595$^$@0#wcslen ^367 599$@0@@1@tp0$@0#wcsncat ^368 601$^$@0#wcsncmp ^369 604$@0@@1@tp0$@0#wcsncpy ^370 607@6@5@1@0@0^$@0#wcspbrk ^371 610@6@5@1@0@0^$@0#wcsrchr ^372 613$@0@@1@tp1$@0#wcsrtombs ^373 615$^$@0#wcsspn ^374 618@6@5@1@0@0^@3@0@0#wcsstr ^375 620$@0@@1@tp1$@0#wcstod ^376 623@6@5@1@0@0@0@@1@tp2@3@0@0#wcstok ^377 625$@0@@1@tp1$@0#wcstol ^378 627$@0@@1@tp1$@0#wcstoul ^379 629$@0@@1@tp0$@0#wcsxfrm ^380 631$^$@0#wctob ^381 634@6@5@1@0@0^@3@0@0#wmemchr ^382 636$^$@0#wmemcmp ^383 639$@0@@1@tp0$@0#wmemcpy ^384 642$@0@@1@tp0$@0#wmemmove ^385 645$@0@@1@tp0$@0#wmemset ^386 647@6@0@1@1@0@1@g22@6@0,g26@6@0@1@g26,tg22$@0#wprintf ^387 649@6@0@1@2@0@1@g21@6@0,g26@6@0@1@g26,tg21$@0#wscanf *0 (Datatype) ^388 13@-@-@0@0@0@0@650#wctype_t ^389 13@-@-@0@0@0@0@651#wctrans_t *4 (Function) ^390 653$^$@0#iswalnum ^391 655$^$@0#iswalpha ^392 657$^$@0#iswcntrl ^393 659$^$@0#iswctype ^394 661$^$@0#iswdigit ^395 663$^$@0#iswgraph ^396 665$^$@0#iswlower ^397 667$^$@0#iswprint ^398 669$^$@0#iswpunct ^399 671$^$@0#iswspace ^400 673$^$@0#iswupper ^401 675$^$@0#iswxdigit ^402 677$^$@0#towctrans ^403 679$^$@0#towlower ^404 681$^$@0#towupper ^405 683$^$@0#wctrans ^406 685$^$@0#wctype ^407 687$^$@0#mblen ^408 689$@0@@1@tp0$@0#mbtowc ^409 691$@0@@1@tp0$@0#wctomb ^410 693$@0@@1@tp0$@0#mbstowcs ^411 695$@0@@1@tp0$@0#wcstombs ^412 699$@0@@1@tp0$@0#memcpy ^413 702$@0@@1@tp0$@0#memmove ^414 706$@0@@1@tp0$@0#strcpy ^415 709$@0@@1@tp0$@0#strncpy ^416 712$@0@@1@tp0$@0#strcat ^417 715$@0@@1@tp0$@0#strncat ^418 717$^$@0#memcmp ^419 719$^$@0#strcmp ^420 721$^$@0#strcoll ^421 723$^$@0#strncmp ^422 725$@0@@1@tp0$@0#strxfrm ^423 728@6@5@1@0@0^@3@0@0#memchr ^424 731@6@5@1@0@0^@19@2@0#strchr ^425 733$^$@0#strcspn ^426 736@6@5@1@0@0^@19@2@0#strpbrk ^427 739@6@5@1@0@0^@19@2@0#strrchr ^428 741$^$@0#strspn ^429 744@6@5@1@0@0^@19@2@0#strstr ^430 747@6@5@1@0@0@0@s1,g26@6@0@1@tp0,s1,g26@19@2@0#strtok ^431 751$@0@@1@tp0$@0#memset ^432 754$^@19@3@0#strerror ^433 756$^$@0#strlen *1 (Constant) ^434 5$#CLOCKS_PER_SEC *0 (Datatype) ^435 13@-@-@0@0@0@0@757#clock_t ^436 13@-@-@0@0@0@0@758#time_t *4 (Function) ^437 761$@0@s1@1@s1$@0#clock ^438 763$^$@0#difftime ^439 765$^$@0#mktime ^440 768$@0@@1@tp0$@0#time ^441 771$@0@g26@6@0@1@g26@19@3@0#asctime ^442 774$^@19@3@0#ctime ^443 777$^@19@3@0#gmtime ^444 780$@0@g26@6@0@1@g26@19@3@0#localtime ^445 782$@0@@1@tp0$@0#strftime *0 (Datatype) ^446 13@-@-@0@0@0@0@783#int8_t ^447 13@-@-@0@0@0@0@784#int16_t ^448 13@-@-@0@0@0@0@785#int32_t ^449 13@-@-@0@0@0@0@786#int64_t ^450 14@-@-@0@0@0@0@787#uint8_t ^451 14@-@-@0@0@0@0@788#uint16_t ^452 14@-@-@0@0@0@0@789#uint32_t ^453 14@-@-@0@0@0@0@790#uint64_t ^454 13@-@-@0@0@0@0@791#int_least8_t ^455 13@-@-@0@0@0@0@792#int_least16_t ^456 13@-@-@0@0@0@0@793#int_least32_t ^457 13@-@-@0@0@0@0@794#int_least64_t ^458 14@-@-@0@0@0@0@795#uint_least8_t ^459 14@-@-@0@0@0@0@796#uint_least16_t ^460 14@-@-@0@0@0@0@797#uint_least32_t ^461 14@-@-@0@0@0@0@798#uint_least64_t ^462 13@-@-@0@0@0@0@799#int_fast8_t ^463 13@-@-@0@0@0@0@800#int_fast16_t ^464 13@-@-@0@0@0@0@801#int_fast32_t ^465 13@-@-@0@0@0@0@802#int_fast64_t ^466 14@-@-@0@0@0@0@803#uint_fast8_t ^467 14@-@-@0@0@0@0@804#uint_fast16_t ^468 14@-@-@0@0@0@0@805#uint_fast32_t ^469 14@-@-@0@0@0@0@806#uint_fast64_t ^470 15@-@-@0@0@0@0@807#intptr_t ^471 14@-@-@0@0@0@0@808#uintptr_t ^472 15@-@-@0@0@0@0@809#intmax_t ^473 14@-@-@0@0@0@0@810#uintmax_t *1 (Constant) ^474 5$#INT8_MIN#INT16_MIN#INT32_MIN#INT64_MIN#INT8_MAX#INT16_MAX#INT32_MAX#INT64_MAX#UINT8_MIN#UINT16_MIN#UINT32_MIN#UINT64_MIN#INT_LEAST8_MIN#INT_LEAST16_MIN#INT_LEAST32_MIN#INT_LEAST64_MIN#INT_LEAST8_MAX#INT_LEAST16_MAX#INT_LEAST32_MAX#INT_LEAST64_MAX#UINT_LEAST8_MAX#UINT_LEAST16_MAX#UINT_LEAST32_MAX#UINT_LEAST64_MAX#INT_FAST8_MIN#INT_FAST16_MIN#INT_FAST32_MIN#INT_FAST64_MIN#INT_FAST8_MAX#INT_FAST16_MAX#INT_FAST32_MAX#INT_FAST64_MAX#UINT_FAST8_MAX#UINT_FAST16_MAX#UINT_FAST32_MAX#UINT_FAST64_MAX ^510 64$#INTPTR_MIN#INTPTR_MAX ;; Library constraints start_Buffer_Constraints setvbuf pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 3 e2 2 3 -1 ;; end precondition constraints post:EMPTY snprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY vsnprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY fgets pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 0 C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints fread pre:EMPTY post: C 0@1@4 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints fwrite pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY fgetpos pre: C 0@1@3 l 1 1 2 2 Param 435 1 r 2 3 0 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 435 1 r 2 3 0 ;; end precondition constraints calloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints malloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints realloc pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints memcpy pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memmove pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY strcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@4 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints strncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints strcat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 3 2 2 Result r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints strncat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints strchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strrchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strstr pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints memset pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints strlen pre:EMPTY post: C 0@1@4 l 2 2 Result r 1 3 2 2 Param 23 0 ;; end precondition constraints asctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ;; Modules access _Bool#1@ types#1@ standard#9@ ;;End splint-3.1.2.dfsg1/lib/posix.h0000644021234200000250000005613610053376261013542 0ustar fax/* ** posix.h ** ** This file should be processed with one of the standard libraries ** (standard.h or strict.h) to produce posix.lcd or posixstrict.lcd. */ /*@-nextlinemacros@*/ /*@+allimponly@*/ /*@+globsimpmodifiesnothing@*/ /* * LCLint ISO C + POSIX Library * * $Id: posix.h,v 1.19 2004/05/21 12:57:21 evans1629 Exp $ */ /* * In 1988, IEEE Std 1003.1-1988, commonly known as "POSIX" or the * "IEEE Portable Operating System Interface for Computing Environments" * was published as an American National Standard. In 1990, IEEE Std * 1003.1-1990 was published as an International Standard. The two * standards differ slightly, and where they do, the 1990 International * standard was used for this lclint library. The differences are: * * 1988: cuserid() * 1990: -removed- (but still in this lclint library) * * 1988: int read (int, void*, unsigned int) * 1990: ssize_t read (int, void*, size_t) * * 1988: int write (int, const void*, unsigned int) * 1990: ssize_t write (int, const void*, size_t) * * The other differences are in the semantics of functions. */ /* * The reference for the ISO C part of this library was * Plauger, Brodie's "Standard C - A Reference", Prentice Hall. * The reference for the POSIX part of this library was * Donald Lewine's "POSIX Programmer's Guide", O'Reilly. * Transcription by Jens Schweikhardt */ /* * Note that Amendment 1 to ISO C was published in 1995 after POSIX was out. * Amendment 1 basically adds support for wide characters and iso 646 * source character sets. In particular, there are three new headers: * , , and */ /* * Each header has annotations in this order: * * 1) type definitions (if any) * 2) constant definitions (if any) * 3) structure definitions (if any) * 4) function prototypes and externals (if any) * * 5) type definitions augmented by POSIX (if any) * 6) constant definitions augmented by POSIX (if any) * 7) structure definitions augmented by POSIX (if any) * 8) function prototypes and externals augmented by POSIX (if any) * * Builtins are mentioned in the header where they appear according to ISO. */ /* ** sys/types.h */ typedef /*@integraltype@*/ dev_t; typedef /*@integraltype@*/ gid_t; typedef /*@unsignedintegraltype@*/ ino_t; /*: is this definitely unsigned? */ typedef /*@integraltype@*/ mode_t; typedef /*@integraltype@*/ nlink_t; typedef /*@integraltype@*/ off_t; typedef /*@integraltype@*/ pid_t; typedef /*@integraltype@*/ uid_t; /* ** dirent.h */ typedef /*@abstract@*/ /*@mutable@*/ void *DIR; struct dirent { char d_name[]; }; extern int closedir (DIR *dirp) /*@modifies errno@*/; /*drl 1/4/2001 added the dependent annotation as suggested by Ralf Wildenhues */ extern /*@null@*/ /*@dependent@*/ DIR *opendir (const char *dirname) /*@modifies errno, fileSystem@*/; extern /*@dependent@*/ /*@null@*/ struct dirent *readdir (DIR *dirp) /*@modifies errno@*/; extern void rewinddir (DIR *dirp) /*@*/; /* ** errno.h */ /*@constant int E2BIG@*/ /*@constant int EACCES@*/ /*@constant int EAGAIN@*/ /*@constant int EBADF@*/ /*@constant int EBUSY@*/ /*@constant int ECHILD@*/ /*@constant int EDEADLK@*/ /*@constant int EEXIST@*/ /*@constant int EFAULT@*/ /*@constant int EFBIG@*/ /*@constant int EINTR@*/ /*@constant int EINVAL@*/ /*@constant int EIO@*/ /*@constant int EISDIR@*/ /*@constant int EMFILE@*/ /*@constant int EMLINK@*/ /*@constant int ENAMETOOLONG@*/ /*@constant int ENFILE@*/ /*@constant int ENODEV@*/ /*@constant int ENOENT@*/ /*@constant int ENOEXEC@*/ /*@constant int ENOLCK@*/ /*@constant int ENOMEM@*/ /*@constant int ENOSPC@*/ /*@constant int ENOSYS@*/ /*@constant int ENOTDIR@*/ /*@constant int ENOTEMPTY@*/ /*@constant int ENOTTY@*/ /*@constant int ENXIO@*/ /*@constant int EPERM@*/ /*@constant int EPIPE@*/ /*@constant int EROFS@*/ /*@constant int ESPIPE@*/ /*@constant int ESRCH@*/ /*@constant int EXDEV@*/ /* ** fcntl.h */ /*@constant int FD_CLOEXEC@*/ /*@constant int F_DUPFD@*/ /*@constant int F_GETFD@*/ /*@constant int F_GETFL@*/ /*@constant int F_GETLK@*/ /*@constant int F_RDLCK@*/ /*@constant int F_SETFD@*/ /*@constant int F_SETFL@*/ /*@constant int F_SETLK@*/ /*@constant int F_SETLKW@*/ /*@constant int F_UNLCK@*/ /*@constant int F_WRLCK@*/ /*@constant int O_ACCMODE@*/ /*@constant int O_APPEND@*/ /*@constant int O_CREAT@*/ /*@constant int O_EXCL@*/ /*@constant int O_NOCTTY@*/ /*@constant int O_NONBLOCK@*/ /*@constant int O_RDONLY@*/ /*@constant int O_RDWR@*/ /*@constant int O_TRUNC@*/ /*@constant int O_WRONLY@*/ /*@constant int SEEK_CUR@*/ /*@constant int SEEK_END@*/ /*@constant int SEEK_SET@*/ /*@constant mode_t S_IFMT@*/ /*@constant mode_t S_IFBLK@*/ /*@constant mode_t S_IFCHR@*/ /*@constant mode_t S_IFIFO@*/ /*@constant mode_t S_IFREG@*/ /*@constant mode_t S_IFDIR@*/ /*@constant mode_t S_IFLNK@*/ /*@constant mode_t S_IRWXU@*/ /*@constant mode_t S_IRUSR@*/ /*@constant mode_t S_IRGRP@*/ /*@constant mode_t S_IROTH@*/ /*@constant mode_t S_IUSR@*/ /*@constant mode_t S_IWXG@*/ /*@constant mode_t S_IWXO@*/ /*@constant mode_t S_IWXU@*/ /*@constant mode_t S_ISGID@*/ /*@constant mode_t S_ISUID@*/ /*@constant mode_t S_IWGRP@*/ /*@constant mode_t S_IWOTH@*/ /*@constant mode_t S_IWUSR@*/ /*@constant mode_t S_IXGRP@*/ /*@constant mode_t S_IXOTH@*/ /*@constant mode_t S_IXUSR@*/ struct flock { short l_type; short l_whence; off_t l_start; off_t l_len; pid_t l_pid; }; extern int creat (const char *path, mode_t mode) /*@modifies errno@*/; extern int fcntl (int fd, int cmd, ...) /*@modifies errno@*/; extern int open (const char *path, int oflag, ...) /*:checkerror -1 - returns -1 on error */ /* the ... is one mode_t param */ /*@modifies errno@*/ ; /* ** grp.h */ struct group { char *gr_name; gid_t gr_gid; char **gr_mem; }; /* evans 2002-07-09: added observer annotation (reported by Enrico Scholz). */ /*@observer@*/ /*@null@*/ struct group * getgrgid (gid_t gid) /*@modifies errno@*/; /*@observer@*/ /*@null@*/ struct group *getgrnam (const char *nm) /*@modifies errno@*/; /* ** limits.h */ /* These are always defined: */ /*@constant int CHAR_BIT@*/ /*@constant char CHAR_MIN@*/ /*@constant char CHAR_MAX@*/ /*@constant int INT_MIN@*/ /*@constant int INT_MAX@*/ /*@constant long LONG_MIN@*/ /*@constant long LONG_MAX@*/ /*@constant int MB_LEN_MAX@*/ /*@constant signed char SCHAR_MIN@*/ /*@constant signed char SCHAR_MAX@*/ /*@constant short SHRT_MIN@*/ /*@constant short SHRT_MAX@*/ /*@constant unsigned char UCHAR_MAX@*/ /*@constant unsigned int UINT_MAX@*/ /*@constant unsigned long ULONG_MAX@*/ /*@constant unsigned short USHRT_MAX@*/ /* When _POSIX_SOURCE is defined */ /*@constant long ARG_MAX@*/ /*@constant long CHILD_MAX@*/ /*@constant long LINK_MAX@*/ /*@constant long MAX_CANON@*/ /*@constant size_t MAX_INPUT@*/ /* evans 2001-10-15 changed type to size_t from long */ /*@constant size_t NAME_MAX@*/ /* evans 2001-10-15 changed type to size_t from long */ /*@constant long NGROUPS_MAX@*/ /*@constant long OPEN_MAX@*/ /*@constant size_t PATH_MAX@*/ /* evans 2001-10-15 changed type to size_t from long */ /*@constant size_t PIPE_BUF@*/ /* evans 2001-10-15 changed type to size_t from long */ /*@constant long SSIZE_MAX@*/ /*@constant long STREAM_MAX@*/ /*@constant long TZNAME_MAX@*/ /*@constant long _POSIX_ARG_MAX@*/ /*@constant long _POSIX_CHILD_MAX@*/ /*@constant long _POSIX_LINK_MAX@*/ /*@constant long _POSIX_MAX_CANON@*/ /*@constant long _POSIX_MAX_INPUT@*/ /*@constant long _POSIX_NAME_MAX@*/ /*@constant long _POSIX_NGROUPS_MAX@*/ /*@constant long _POSIX_OPEN_MAX@*/ /*@constant long _POSIX_PATH_MAX@*/ /*@constant long _POSIX_PIPE_BUF@*/ /*@constant long _POSIX_SSIZE@*/ /*@constant long _POSIX_STREAM@*/ /*@constant long _POSIX_TZNAME_MAX@*/ /* ** pwd.h */ struct passwd { char *pw_name; uid_t pw_uid; gid_t pw_gid; char *pw_dir; char *pw_shell; } ; /*@observer@*/ /*@null@*/ struct passwd *getpwnam (const char *) /*@modifies errno@*/ /*@ensures maxRead(result) == 0 /\ maxSet(result) == 0 @*/; /*@observer@*/ /*@null@*/ struct passwd *getpwuid (uid_t uid) /*@modifies errno@*/ /*@ensures maxRead(result) == 0 /\ maxSet(result) == 0 @*/; /* ** setjmp.h */ typedef /*@abstract@*/ /*@mutable@*/ void *sigjmp_buf; /*@mayexit@*/ void siglongjmp (sigjmp_buf env, int val) /*@*/; int sigsetjmp (/*@out@*/ sigjmp_buf env, int savemask) /*@modifies env@*/; /* ** moved up from signal.h */ typedef /*@abstract@*/ sigset_t; typedef struct { void *ss_sp; size_t ss_size; int ss_flags; } stack_t; /* ** ucontext.h */ typedef /*@abstract@*/ mcontext_t; typedef struct s_ucontext_t { /*@null@*/ struct s_ucontext_t *uc_link; sigset_t uc_sigmask; stack_t uc_stack; mcontext_t uc_mcontext; } ucontext_t; int getcontext(ucontext_t *); int setcontext(const ucontext_t *); void makecontext(ucontext_t *, void (*)(void), int, ...); int swapcontext(ucontext_t *restrict, const ucontext_t *restrict); /* ** signal.h */ /*@constant int SA_NOCLDSTOP@*/ /*@constant int SIG_BLOCK@*/ /*@constant int SIG_SETMASK@*/ /*@constant int SIG_UNBLOCK@*/ /*@constant int SIGALRM@*/ /*@constant int SIGCHLD@*/ /*@constant int SIGCONT@*/ /*@constant int SIGHUP@*/ /*@constant int SIGKILL@*/ /*@constant int SIGPIPE@*/ /*@constant int SIGQUIT@*/ /*@constant int SIGSTOP@*/ /*@constant int SIGTSTP@*/ /*@constant int SIGTTIN@*/ /*@constant int SIGTTOU@*/ /*@constant int SIGUSR1@*/ /*@constant int SIGUSR2@*/ struct sigstack { int ss_onstack; void *ss_sp; } ; typedef struct { int si_signo; int si_errno; int si_code; pid_t si_pid; uid_t si_uid; void *si_addr; int si_status; long si_band; union sigval si_value; } siginfo_t; typedef union { int sival_int; void *sival_ptr; } sigval; struct sigaction { void (*sa_handler)(); sigset_t sa_mask; int sa_flags; void (*sa_sigaction)(int, siginfo_t *, void *); /* Added 2003-06-13: Noticed by Jerry James */ } ; extern /*@mayexit@*/ int kill (pid_t pid, int sig) /*@modifies errno@*/; extern int sigaction (int sig, const struct sigaction *act, /*@out@*/ /*@null@*/ struct sigaction *oact) /*@modifies *oact, errno, systemState@*/; extern int sigaddset (sigset_t *set, int signo) /*@modifies *set, errno@*/; extern int sigdelset (sigset_t *set, int signo) /*@modifies *set, errno@*/; extern int sigemptyset (/*@out@*/ sigset_t *set) /*@modifies *set, errno@*/; extern int sigfillset (/*@out@*/ sigset_t *set) /*@modifies *set, errno@*/; extern int sigismember (const sigset_t *set, int signo) /*@modifies errno@*/; extern int sigpending (/*@out@*/ sigset_t *set) /*@modifies *set, errno@*/; extern int sigprocmask (int how, /*@null@*/ const sigset_t *set, /*@null@*/ /*@out@*/ sigset_t *oset) /*@modifies *oset, errno, systemState@*/; extern int sigsuspend (const sigset_t *sigmask) /*@modifies errno, systemState@*/; /* ** stdio.h */ /*@constant int L_ctermid@*/ /*@constant int L_cuserid@*/ /*@constant int STREAM_MAX@*/ extern /*@null@*/ /*@dependent@*/ FILE *fdopen (int fd, const char *type) /*@modifies errno, fileSystem@*/; extern int fileno (FILE *fp) /*@modifies errno@*/; /* ** sys/stat.h */ struct stat { mode_t st_mode; ino_t st_ino; dev_t st_dev; nlink_t st_nlink; uid_t st_uid; gid_t st_gid; off_t st_size; time_t st_atime; /* evans 2001-08-23 - these were previously st_st_atime - POSIX spec says st_atime */ time_t st_mtime; /* evans 2001-08-23 - these were previously st_st_mtime - POSIX spec says st_mtime */ time_t st_ctime; /* evans 2001-08-23 - these were previously st_st_ctime - POSIX spec says st_ctime */ } ; /* ** evans 2004-05-19: dependent annotations atted for time_t fields. Could not find ** any clear documetation on this, but it seems to be correct. */ /* ** POSIX does not require that the S_I* be functions. They're ** macros virtually everywhere. */ # ifdef STRICT /*@notfunction@*/ # define SBOOLINT _Bool /*@alt int@*/ # else /*@notfunction@*/ # define SBOOLINT _Bool # endif extern SBOOLINT S_ISBLK (/*@sef@*/ mode_t m) /*@*/ ; extern SBOOLINT S_ISCHR (/*@sef@*/ mode_t m) /*@*/ ; extern SBOOLINT S_ISDIR (/*@sef@*/ mode_t m) /*@*/ ; extern SBOOLINT S_ISFIFO (/*@sef@*/ mode_t m) /*@*/ ; extern SBOOLINT S_ISREG (/*@sef@*/ mode_t m) /*@*/ ; int chmod (const char *path, mode_t mode) /*@modifies fileSystem, errno@*/ ; int fstat (int fd, /*@out@*/ struct stat *buf) /*@modifies errno, *buf@*/ ; int mkdir (const char *path, mode_t mode) /*@modifies fileSystem, errno@*/; int mkfifo (const char *path, mode_t mode) /*@modifies fileSystem, errno@*/; int stat (const char *path, /*@out@*/ struct stat *buf) /*:errorcode -1*/ /*@modifies errno, *buf@*/; int umask (mode_t cmask) /*@modifies systemState@*/; /* ** sys/times.h */ struct tms { clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; }; extern clock_t times (/*@out@*/ struct tms *tp) /*@modifies *tp@*/; /* ** sys/utsname.h */ struct utsname { char sysname[]; char nodename[]; char release[]; char version[]; char machine[]; }; extern int uname (/*@out@*/ struct utsname *name) /*@modifies *name, errno@*/ ; /* ** sys/wait.h */ extern int WEXITSTATUS (int status) /*@*/ ; extern int WIFEXITED (int status) /*@*/ ; extern int WIFSIGNALED (int status) /*@*/ ; extern int WIFSTOPPED (int status) /*@*/ ; extern int WSTOPSIG (int status) /*@*/ ; extern int WTERMSIG (int status) /*@*/ ; /*@constant int WUNTRACED@*/ /* These are in Unix spec, are they in POSIX? */ /*@constant int WCONTINUED@*/ /*@constant int WNOHANG@*/ pid_t wait (/*@out@*/ /*@null@*/ int *st) /*@modifies *st, errno, systemState@*/; pid_t waitpid (pid_t pid, /*@out@*/ /*@null@*/ int *st, int opt) /*@modifies *st, errno, systemState@*/; /* ** termios.h */ typedef unsigned char /*@alt unsigned short@*/ cc_t; typedef unsigned long /*@alt long@*/ speed_t; typedef unsigned long /*@alt long@*/ tcflag_t; /*@constant int B0@*/ /*@constant int B50@*/ /*@constant int B75@*/ /*@constant int B110@*/ /*@constant int B134@*/ /*@constant int B150@*/ /*@constant int B200@*/ /*@constant int B300@*/ /*@constant int B600@*/ /*@constant int B1200@*/ /*@constant int B1800@*/ /*@constant int B2400@*/ /*@constant int B4800@*/ /*@constant int B9600@*/ /*@constant int B19200@*/ /*@constant int B38400@*/ /*@constant int BRKINT@*/ /*@constant int CLOCAL@*/ /*@constant int CREAD@*/ /*@constant int CS5@*/ /*@constant int CS6@*/ /*@constant int CS7@*/ /*@constant int CS8@*/ /*@constant int CSIZE@*/ /*@constant int CSTOPB@*/ /*@constant int ECHO@*/ /*@constant int ECHOE@*/ /*@constant int ECHOK@*/ /*@constant int ECHONL@*/ /*@constant int HUPCL@*/ /*@constant int ICANON@*/ /*@constant int ICRNL@*/ /*@constant int IEXTEN@*/ /*@constant int IGNBRK@*/ /*@constant int IGNCR@*/ /*@constant int IGNPAR@*/ /*@constant int IGNLCR@*/ /*@constant int INPCK@*/ /*@constant int ISIG@*/ /*@constant int ISTRIP@*/ /*@constant int IXOFF@*/ /*@constant int IXON@*/ /*@constant int NCCS@*/ /*@constant int NOFLSH@*/ /*@constant int OPOST@*/ /*@constant int PARENB@*/ /*@constant int PARMRK@*/ /*@constant int PARODD@*/ /*@constant int TCIFLUSH@*/ /*@constant int TCIOFF@*/ /*@constant int TCIOFLUSH@*/ /*@constant int TCION@*/ /*@constant int TCOFLUSH@*/ /*@constant int TCSADRAIN@*/ /*@constant int TCSAFLUSH@*/ /*@constant int TCSANOW@*/ /*@constant int TOSTOP@*/ /*@constant int VEOF@*/ /*@constant int VEOL@*/ /*@constant int VERASE@*/ /*@constant int VINTR@*/ /*@constant int VKILL@*/ /*@constant int VMIN@*/ /*@constant int VQUIT@*/ /*@constant int VSTART@*/ /*@constant int VSTOP@*/ /*@constant int VSUSP@*/ /*@constant int VTIME@*/ struct termios { tcflag_t c_iflag; tcflag_t c_oflag; tcflag_t c_cflag; tcflag_t c_lflag; cc_t c_cc; } ; extern speed_t cfgetispeed (const struct termios *p) /*@*/; extern speed_t cfgetospeed (const struct termios *p) /*@*/; extern int cfsetispeed (struct termios *p) /*@modifies *p@*/; extern int cfsetospeed (struct termios *p) /*@modifies *p@*/; extern int tcdrain (int fd) /*@modifies errno@*/; extern int tcflow (int fd, int action) /*@modifies errno@*/; extern int tcflush (int fd, int qs) /*@modifies errno@*/; extern int tcgetattr (int fd, /*@out@*/ struct termios *p) /*@modifies errno, *p@*/; extern int tcsendbreak (int fd, int d) /*@modifies errno@*/; extern int tcsetattr (int fd, int opt, const struct termios *p) /*@modifies errno@*/; /* ** time.h */ /* Environ must be known before it can be used in `globals' clauses. */ /*@unchecked@*/ extern char **environ; /*@constant int CLK_TCK@*/ extern void tzset (void) /*@globals environ@*/ /*@modifies systemState@*/; /* ** unistd.h */ /*@constant int F_OK@*/ /*@constant int R_OK@*/ /*@constant int SEEK_CUR@*/ /*@constant int SEEK_END@*/ /*@constant int SEEK_SET@*/ /*@constant int STDERR_FILENO@*/ /*@constant int STDIN_FILENO@*/ /*@constant int STDOUT_FILENO@*/ /*@constant int W_OK@*/ /*@constant int X_OK@*/ /*@constant int _PC_CHOWN_RESTRUCTED@*/ /*@constant int _PC_MAX_CANON@*/ /*@constant int _PC_MAX_INPUT@*/ /*@constant int _PC_NAME_MAX@*/ /*@constant int _PC_NO_TRUNC@*/ /*@constant int _PC_PATH_MAX@*/ /*@constant int _PC_PIPE_BUF@*/ /*@constant int _PC_VDISABLE@*/ /*@constant int _POSIX_CHOWN_RESTRICTED@*/ /*@constant int _POSIX_JOB_CONTROL@*/ /*@constant int _POSIX_NO_TRUNC@*/ /*@constant int _POSIX_SAVED_IDS@*/ /*@constant int _POSIX_VDISABLE@*/ /*@constant int _POSIX_VERSION@*/ /*@constant int _SC_ARG_MAX@*/ /*@constant int _SC_CHILD_MAX@*/ /*@constant int _SC_CLK_TCK@*/ /*@constant int _SC_JOB_CONTROL@*/ /*@constant int _SC_NGROUPS_MAX@*/ /*@constant int _SC_OPEN_MAX@*/ /*@constant int _SC_SAVED_IDS@*/ /*@constant int _SC_STREAM_MAX@*/ /*@constant int _SC_TZNAME_MAX@*/ /*@constant int _SC_VERSION@*/ extern /*@exits@*/ void _exit (int status) /*@*/; extern int access (const char *path, int mode) /*@modifies errno@*/; extern unsigned int alarm (unsigned int) /*@modifies systemState@*/; extern int chdir (const char *path) /*@modifies errno@*/; extern int chown (const char *path, uid_t owner, gid_t group) /*@modifies fileSystem, errno@*/; extern int close (int fd) /*@modifies fileSystem, errno, systemState@*/; /* state: record locks are unlocked */ extern char * ctermid (/*@returned@*/ /*@out@*/ /*@null@*/ char *s) /*@modifies *s, systemState@*/; /* cuserid is in the 1988 version of POSIX but removed in 1990 */ extern char * cuserid (/*@null@*/ /*@out@*/ char *s) /*@modifies *s@*/; extern int dup2 (int fd, int fd2) /*@modifies errno, fileSystem@*/; extern int dup (int fd) /*@modifies errno, fileSystem@*/; extern /*@mayexit@*/ int execl (const char *path, const char *arg, ...) /*@modifies errno@*/; extern /*@mayexit@*/ int execle (const char *file, const char *arg, ...) /*@modifies errno@*/; extern /*@mayexit@*/ int execlp (const char *file, const char *arg, ...) /*@modifies errno@*/; extern /*@mayexit@*/ int execv (const char *path, char *const argv[]) /*@modifies errno@*/; extern /*@mayexit@*/ int execve (const char *path, char *const argv[], char *const *envp) /*@modifies errno@*/; extern /*@mayexit@*/ int execvp (const char *file, char *const argv[]) /*@modifies errno@*/; extern pid_t fork (void) /*@modifies fileSystem, errno@*/; extern long fpathconf (int fd, int name) /*@modifies errno@*/; extern /*@null@*/ char *getcwd (/*@returned@*/ /*@out@*/ /*@notnull@*/ char *buf, size_t size) /*@requires maxSet(buf) >= (size - 1)@*/ /*@ensures maxRead(buf) <= (size - 1)@*/ /*@modifies errno, *buf@*/ ; extern gid_t getegid (void) /*@*/; extern uid_t geteuid (void) /*@*/; extern gid_t getgid (void) /*@*/; extern int getgroups (int gs, /*@out@*/ gid_t gl[]) /*@modifies errno, gl[]@*/; extern /*@observer@*/ char * getlogin (void) /*@*/; extern pid_t getpgrp (void) /*@*/; extern pid_t getpid (void) /*@*/; extern pid_t getppid (void) /*@*/; extern uid_t getuid (void) /*@*/; extern int isatty (int fd) /*@*/; extern int link (const char *o, const char *n) /*@modifies errno, fileSystem@*/; extern off_t lseek (int fd, off_t offset, int whence) /*@modifies errno@*/; extern long pathconf (const char *path, int name) /*@modifies errno@*/; extern int pause (void) /*@modifies errno@*/; extern int pipe (/*@out@*/ int fd[]) /* Out parameter noticed by Marc Espie. */ /*@modifies errno@*/; extern ssize_t read (int fd, /*@out@*/ void *buf, size_t nbyte) /*@modifies errno, *buf@*/ /*@requires maxSet(buf) >= (nbyte - 1) @*/ /*@ensures maxRead(buf) >= nbyte @*/ ; extern int rmdir (const char *path) /*@modifies fileSystem, errno@*/; extern int setgid (gid_t gid) /*@modifies errno, systemState@*/; extern int setpgid (pid_t pid, pid_t pgid) /*@modifies errno, systemState@*/; extern pid_t setsid (void) /*@modifies systemState@*/; extern int setuid (uid_t uid) /*@modifies errno, systemState@*/; unsigned int sleep (unsigned int sec) /*@modifies systemState@*/ ; extern long sysconf (int name) /*@modifies errno@*/; extern pid_t tcgetpgrp (int fd) /*@modifies errno@*/; extern int tcsetpgrp (int fd, pid_t pgrpid) /*@modifies errno, systemState@*/; /* Q: observer ok? */ extern /*@null@*/ /*@observer@*/ char *ttyname (int fd) /*@modifies errno@*/; extern int unlink (const char *path) /*@modifies fileSystem, errno@*/; extern ssize_t write (int fd, const void *buf, size_t nbyte) /*@requires maxRead(buf) >= nbyte@*/ /*@modifies errno@*/; /* ** utime.h */ struct utimbuf { time_t actime; time_t modtime; } ; extern int utime (const char *path, /*@null@*/ const struct utimbuf *times) /*@modifies fileSystem, errno@*/; /* ** regex.h */ typedef /*@abstract@*/ /*@mutable@*/ void *regex_t; typedef /*@integraltype@*/ regoff_t; typedef struct { regoff_t rm_so; regoff_t rm_eo; } regmatch_t; int regcomp (/*@out@*/ regex_t *preg, /*@nullterminated@*/ const char *regex, int cflags) /*:statusreturn@*/ /*@modifies preg@*/ ; int regexec (const regex_t *preg, /*@nullterminated@*/ const char *string, size_t nmatch, /*@out@*/ regmatch_t pmatch[], int eflags) /*@requires maxSet(pmatch) >= nmatch@*/ /*@modifies pmatch@*/ ; size_t regerror (int errcode, const regex_t *preg, /*@out@*/ char *errbuf, size_t errbuf_size) /*@requires maxSet(errbuf) >= errbuf_size@*/ /*@modifies errbuf@*/ ; void regfree (/*@only@*/ regex_t *preg) ; /* regcomp flags */ /*@constant int REG_BASIC@*/ /*@constant int REG_EXTENDED@*/ /*@constant int REG_ICASE@*/ /*@constant int REG_NOSUB@*/ /*@constant int REG_NEWLINE@*/ /*@constant int REG_NOSPEC@*/ /*@constant int REG_PEND@*/ /*@constant int REG_DUMP@*/ /* regerror flags */ /*@constant int REG_NOMATCH@*/ /*@constant int REG_BADPAT@*/ /*@constant int REG_ECOLLATE@*/ /*@constant int REG_ECTYPE@*/ /*@constant int REG_EESCAPE@*/ /*@constant int REG_ESUBREG@*/ /*@constant int REG_EBRACK@*/ /*@constant int REG_EPAREN@*/ /*@constant int REG_EBRACE@*/ /*@constant int REG_BADBR@*/ /*@constant int REG_ERANGE@*/ /*@constant int REG_ESPACE@*/ /*@constant int REG_BADRPT@*/ /*@constant int REG_EMPTY@*/ /*@constant int REG_ASSERT@*/ /*@constant int REG_INVARG@*/ /*@constant int REG_ATOI@*/ /* non standard */ /*@constant int REG_ITOA@*/ /* non standard */ /* regexec flags */ /*@constant int REG_NOTBOL@*/ /*@constant int REG_NOTEOL@*/ /*@constant int REG_STARTEND@*/ /*@constant int REG_TRACE@*/ /*@constant int REG_LARGE@*/ /*@constant int REG_BACKR@*/ splint-3.1.2.dfsg1/lib/posix.lcd0000644021234200000250000014636310645776247014076 0ustar fax;;; Splint Library posix.lcd ;;Splint 3.018000 ;;lib:310 ;;ctTable 0 u-2 19 38 0 p1|-2 20 39 0 b-2 21 40 0 p3|-2 22 41 0 p4|-2 23 42 0 p5|-2 24 43 0 p6|-2 25 44 0 p7|-2 26 45 0 p8|-2 27 46 0 p9|-2 28 47 0 p10|-2 29 48 0 p11|-2 30 49 0 p12|-2 31 50 0 p13|-2 32 51 0 p14|-2 33 52 0 p15|-2 34 53 0 p16|-2 35 54 0 p17|-2 36 55 0 p18|-2 37 56 1 t0|0 485 1089 1 t1|1& 1 t2|2& 1 t3|3& 1 t4|4 486 1090 1 t5|5& 1 t6|6& 1 t7|7& 1 t8|8& 1 t9|9& 1 t10|10& 1 t11|11& 1 t12|12& 1 t13|13& 1 t14|14& 1 t15|15& 1 t16|16& 1 t17|17& 1 t18|18& 2 y0|0& 2 y1|1& 2 y2|2& 2 y3|3& 2 y4|4& 2 y5|5& 2 y6|6& 2 y7|7& 2 y8|8& 2 y9|9& 2 y10|10& 2 y11|11& 2 y12|12& 2 y13|13& 2 y14|14& 2 y15|15& 2 y16|16& 2 y17|17& 2 y18|18& -2 ?! 0 a0|& 0 s11|& 0 s12|& 0 s13|& 0 s27|& 0 s29|& 0 s30|& 0 s31|& 0 s32|-1 554 -1 0 s33|& 0 a34|-1 572 -1 3 C0.5/20|! 3 C0.69/2|! 3 C0.2/5|! 3 f0 (71|@7|$#,)! 3 f1 (71|@7|$#,)! 3 C0.4/3|! 3 C0.5/74|! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 C0.2/5|! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f88 (75|$#,)! 3 C0.5/74|! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 C0.2/5|! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f105 (92|$#,)! 3 C0.5/74|! 3 f0 (109|$#,)! 3 f2 (109|$#,)! 3 f105 (109|$#,)! 3 C0.4/5|! 3 f0 (109|$#,)! 3 f4 (109|$#,)! 3 f113 (109|$#,)! 3 f0 (109|$#,)! 3 f4 (109|$#,)! 3 f113 (109|$#,)! 3 Slconv{23|@1|0@0@3&#decimal_point,23|@1|0@0@3&#thousands_sep,23|@1|0@0@3&#grouping,23|@1|0@0@3&#int_curr_symbol,23|@1|0@0@3&#currency_symbol,23|@1|0@0@3&#mon_decimal_point,23|@1|0@0@3&#mon_thousands_sep,23|@1|0@0@3&#mon_grouping,23|@1|0@0@3&#positive_sign,23|@1|0@0@3&#negative_sign,4|@1|^#int_frac_digits,4|@1|^#frac_digits,4|@1|^#p_cs_precedes,4|@1|^#p_sep_by_space,4|@1|^#n_cs_precedes,4|@1|^#n_sep_by_space,4|@1|^#p_sign_posn,4|@1|^#n_sign_posn,}! 0 s51|-1 127 -1 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f23 (5|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 1 t121|121& 3 f127 ()! 0 s106|& 0 s107|& 3 C0.17/18|! 3 C0.16/131|! 0 s121|& 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,24|4@0@7&#,)! 3 f17 (17|$#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,36|4@0@7&#,)! 3 f17 (17|$#,36|4@0@7&#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,9|$#,)! 3 f17 (17|$#,9|$#,)! 3 f0 (18|$#,9|$#,)! 3 f18 (18|$#,9|$#,)! 3 f0 (17|$#,)! 3 f5 (17|$#,)! 3 f0 (16|$#,)! 3 f5 (16|$#,)! 3 f0 (18|$#,)! 3 f5 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (16|$#,)! 3 f9 (16|$#,)! 3 f0 (18|$#,)! 3 f9 (18|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (16|$#,)! 3 f11 (16|$#,)! 3 f0 (18|$#,)! 3 f11 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,24|4@0@7&#,)! 3 f17 (17|$#,17|$#,24|4@0@7&#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,18|$#,)! 3 f17 (17|$#,18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,17|$#,)! 3 f17 (17|$#,17|$#,17|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 0 a224|& 3 f0 (338|4@0@7&#,)! 3 f5 (338|4@0@7&#,)! 3 f0 (338|$#,5|$#,)! 3 f1 (338|$#,5|$#,)! 0 s233|& 3 ?! 3 f344 (5|$#,)! 3 f1 (5|$#,)^347 1 t346|346& 3 ?! 3 f348 (5|$#,)! 3 f1 (5|$#,)^351 1 t350|350& 3 ?! 3 f352 (5|$#,)! 3 f1 (5|$#,)^355 1 t354|354& 3 ?! 3 f356 (5|$#,)! 3 f1 (5|$#,)^359 1 t358|358& 3 f0 (5|$#,359|0@5@7&#,)! 3 f19 (5|$#,359|0@5@7&#,)^362 1 t361|361& 3 ?! 3 f363 (5|$#,)! 3 f19 (5|$#,)! 3 f1 (5|$#,359|0@5@7&#,)! 3 f1 (5|$#,)! 3 f367 (5|$#,359|0@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 a239|& 3 f0 (371|4@0@7&#,!.,)! 3 f1 (371|4@0@7&#,!.,)! 3 f0 (371|$#,)! 3 f1 (371|$#,)! 3 f0 (371|4@0@7&#,371|$#,)! 3 f1 (371|4@0@7&#,371|$#,)! 0 a243|-1 380 -1 0 a244|-1 460 -1 1 t378|378& 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f19 ()! 3 f380 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|0@5@7&#,)! 3 f5 (380|0@5@7&#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f380 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,380|$#,)! 3 f19 (23|$#,23|$#,380|$#,)! 3 f380 (23|$#,23|$#,380|$#,)! 3 f0 (380|$#,23|4@5@19@2@0#,)! 3 f1 (380|$#,23|4@5@19@2@0#,)! 3 f0 (380|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f5 (380|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 C0.5/1|! 3 f0 (380|$#,23|$#,!.,)! 3 f5 (380|$#,23|$#,!.,)! 3 f405 (380|$#,23|$#,!.,)! 3 f0 (380|$#,23|$#,!.,)! 3 f5 (380|$#,23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f405 (23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f405 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|$#,371|$#,)! 3 f5 (23|$#,371|$#,)! 3 f0 (380|$#,23|$#,371|$#,)! 3 f5 (380|$#,23|$#,371|$#,)! 3 f0 (23|4@0@7&#,23|$#,371|$#,)! 3 f5 (23|4@0@7&#,23|$#,371|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,371|$#,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,371|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 f19 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 f23 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 C0.5/4|! 3 f0 (436|$#,380|$#,)! 3 f5 (436|$#,380|$#,)! 3 f0 (23|$#,380|$#,)! 3 f5 (23|$#,380|$#,)! 3 f0 (380|@7|$#,)! 3 f5 (380|@7|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|4@0@7&#,)! 3 f19 (23|4@0@7&#,)! 3 f23 (23|4@0@7&#,)! 3 f0 (436|$#,380|@7|$#,)! 3 f5 (436|$#,380|@7|$#,)! 3 f0 (436|$#,)! 3 f5 (436|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (436|$#,380|$#,)! 3 f5 (436|$#,380|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f0 (20|$#,64|$#,64|$#,380|$#,)! 3 f64 (20|$#,64|$#,64|$#,380|$#,)! 1 t379|379& 3 f0 (380|$#,460|4@0@7&#,)! 3 f5 (380|$#,460|4@0@7&#,)! 3 f0 (380|$#,9|$#,5|$#,)! 3 f5 (380|$#,9|$#,5|$#,)! 3 f0 (380|$#,460|$#,)! 3 f5 (380|$#,460|$#,)! 3 f0 (380|$#,)! 3 f9 (380|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (23|0@5@7&#,)! 3 f1 (23|0@5@7&#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 1 t19|19& 1 t23|23& 3 f0 (23|$#,486|4@5@7&#,)! 3 f17 (23|$#,486|4@5@7&#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f9 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f10 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (20|4@5@2&#,)! 3 f1 (20|4@5@2&#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 ?! 3 f512 ()! 3 f1 ()^515 1 t514|514& 3 f0 (515|$#,)! 3 f5 (515|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 ?! 3 f523 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^526 1 t525|525& 3 f0 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 ?! 3 f530 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^533 1 t532|532& 3 f0 (20|$#,64|$#,64|$#,533|$#,)! 3 f1 (20|$#,64|$#,64|$#,533|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 S!2{5|@1|^#quot,5|@1|^#rem,}! 0 s324|& 0 s325|& 3 f0 (5|$#,5|$#,)! 3 f540 (5|$#,5|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 3 S!3{9|@1|^#quot,9|@1|^#rem,}! 0 s328|& 0 s329|& 3 f0 (9|$#,9|$#,)! 3 f547 (9|$#,9|$#,)! 3 f0 (5|$#,)! 3 f67 (5|$#,)! 3 f0 (380|$#,)! 3 f67 (380|$#,)! 1 t66|66 636 -1 3 f0 (554|@5|$#,5|$#,380|$#,)! 3 f19 (554|@5|$#,5|$#,380|$#,)! 3 f554 (554|@5|$#,5|$#,380|$#,)! 3 f0 (66|$#,380|$#,)! 3 f67 (66|$#,380|$#,)! 3 f0 (554|$#,380|$#,)! 3 f5 (554|$#,380|$#,)! 3 f0 (380|$#,5|$#,)! 3 f5 (380|$#,5|$#,)! 3 f0 (380|$#,554|$#,!.,)! 3 f5 (380|$#,554|$#,!.,)! 3 f0 (380|$#,554|$#,!.,)! 3 f5 (380|$#,554|$#,!.,)! 3 f0 (380|@7|$#,)! 3 f67 (380|@7|$#,)! 3 f0 ()! 3 f67 ()! 1 t68|68& 3 f0 (23|$#,64|$#,572|0@5@7&#,)! 3 f64 (23|$#,64|$#,572|0@5@7&#,)! 3 f0 (554|0@5@7&#,23|$#,64|$#,572|0@5@7&#,)! 3 f64 (554|0@5@7&#,23|$#,64|$#,572|0@5@7&#,)! 3 f0 (572|0@5@7&#,)! 3 f5 (572|0@5@7&#,)! 3 f0 (554|0@5@7&#,486|$#,64|$#,572|0@5@7&#,)! 3 f64 (554|0@5@7&#,486|$#,64|$#,572|0@5@7&#,)! 3 f0 (66|$#,380|@7|$#,)! 3 f67 (66|$#,380|@7|$#,)! 3 f0 (66|$#,)! 3 f67 (66|$#,)! 3 f0 (554|$#,64|$#,554|$#,!.,)! 3 f5 (554|$#,64|$#,554|$#,!.,)! 3 f0 (554|$#,554|$#,!.,)! 3 f5 (554|$#,554|$#,!.,)! 3 f0 (67|$#,380|$#,)! 3 f67 (67|$#,380|$#,)! 3 f0 (380|$#,554|$#,371|$#,)! 3 f5 (380|$#,554|$#,371|$#,)! 3 f0 (554|$#,64|$#,554|$#,371|$#,)! 3 f5 (554|$#,64|$#,554|$#,371|$#,)! 3 f0 (554|$#,371|$#,)! 3 f5 (554|$#,371|$#,)! 3 f0 (23|4@5@7&#,66|$#,572|0@5@7&#,)! 3 f64 (23|4@5@7&#,66|$#,572|0@5@7&#,)! 3 C0.1/554|! 3 f0 (554|@5|4@0@9&#,554|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,)! 3 f599 (554|@5|4@0@9&#,554|$#,)! 3 f0 (554|@5|$#,66|$#,)! 3 f19 (554|@5|$#,66|$#,)! 3 f554 (554|@5|$#,66|$#,)! 3 f0 (554|$#,554|$#,)! 3 f5 (554|$#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f5 (554|$#,554|$#,)! 3 f0 (554|@5|4@0@9&#,554|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,)! 3 f599 (554|@5|4@0@9&#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f64 (554|$#,554|$#,)! 0 s364|-1 616 -1 1 t615|615& 3 f0 (554|4@0@7&#,64|$#,554|$#,616|$#,)! 3 f64 (554|4@0@7&#,64|$#,554|$#,616|$#,)! 3 f0 (554|$#,)! 3 f64 (554|$#,)! 3 C0.1/554|! 3 f0 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f621 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f0 (554|$#,554|$#,64|$#,)! 3 f5 (554|$#,554|$#,64|$#,)! 3 f0 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f621 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,)! 3 f19 (554|@5|$#,554|$#,)! 3 f554 (554|@5|$#,554|$#,)! 3 f0 (554|@5|$#,66|$#,)! 3 f19 (554|@5|$#,66|$#,)! 3 f554 (554|@5|$#,66|$#,)! 1 t554|554& 3 f0 (23|0@5@7&#,636|$#,64|$#,572|0@5@7&#,)! 3 f64 (23|0@5@7&#,636|$#,64|$#,572|0@5@7&#,)! 3 f0 (554|$#,554|$#,)! 3 f64 (554|$#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f19 (554|$#,554|$#,)! 3 f554 (554|$#,554|$#,)! 3 f0 (554|$#,636|0@5@7&#,)! 3 f17 (554|$#,636|0@5@7&#,)! 3 f0 (554|0@5@7&#,554|$#,636|$#,)! 3 f19 (554|0@5@7&#,554|$#,636|$#,)! 3 f554 (554|0@5@7&#,554|$#,636|$#,)! 3 f0 (554|$#,636|0@5@7&#,5|$#,)! 3 f9 (554|$#,636|0@5@7&#,5|$#,)! 3 f0 (554|$#,636|0@5@7&#,5|$#,)! 3 f10 (554|$#,636|0@5@7&#,5|$#,)! 3 f0 (554|0@5@7&#,554|$#,64|$#,)! 3 f64 (554|0@5@7&#,554|$#,64|$#,)! 3 f0 (67|$#,)! 3 f5 (67|$#,)! 3 f0 (554|$#,66|$#,64|$#,)! 3 f19 (554|$#,66|$#,64|$#,)! 3 f554 (554|$#,66|$#,64|$#,)! 3 f0 (554|$#,554|$#,64|$#,)! 3 f5 (554|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,64|$#,)! 3 f19 (554|@5|$#,554|$#,64|$#,)! 3 f554 (554|@5|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,64|$#,)! 3 f19 (554|@5|$#,554|$#,64|$#,)! 3 f554 (554|@5|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,66|$#,64|$#,)! 3 f19 (554|@5|$#,66|$#,64|$#,)! 3 f554 (554|@5|$#,66|$#,64|$#,)! 3 f0 (554|$#,!.,)! 3 f5 (554|$#,!.,)! 3 f0 (554|$#,!.,)! 3 f5 (554|$#,!.,)! 0 s388|& 0 s389|& 3 C0.2/5|! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,675|$#,)! 3 f2 (67|$#,675|$#,)! 3 f677 (67|$#,675|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 C0.2/5|! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 C0.2/5|! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f712 (67|$#,)! 3 C0.67/5|! 3 f0 (67|$#,676|$#,)! 3 f67 (67|$#,676|$#,)! 3 f716 (67|$#,676|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f716 (67|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f716 (67|$#,)! 3 f0 (23|$#,)! 3 f676 (23|$#,)! 3 f0 (23|$#,)! 3 f675 (23|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (554|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (554|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! 3 f0 (554|4@0@7&#,23|$#,64|$#,)! 3 f64 (554|4@0@7&#,23|$#,64|$#,)! 3 f0 (23|4@0@7&#,554|$#,64|$#,)! 3 f64 (23|4@0@7&#,554|$#,64|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f740 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f0 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f740 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 C0.1/23|! 3 f0 (23|@5|4@0@9&#,23|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,)! 3 f747 (23|@5|4@0@9&#,23|$#,)! 3 f0 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f747 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,)! 3 f747 (23|@5|0@0@9&#,23|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f747 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f0 (20|$#,20|$#,64|$#,)! 3 f5 (20|$#,20|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (23|4@5@7&#,23|$#,64|$#,)! 3 f64 (23|4@5@7&#,23|$#,64|$#,)! 3 f0 (20|$#,5|$#,64|$#,)! 3 f19 (20|$#,5|$#,64|$#,)! 3 f20 (20|$#,5|$#,64|$#,)! 3 f0 (23|@5|$#,436|$#,)! 3 f19 (23|@5|$#,436|$#,)! 3 f23 (23|@5|$#,436|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|$#,436|$#,)! 3 f19 (23|@5|$#,436|$#,)! 3 f23 (23|@5|$#,436|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|0@5@7&#,23|$#,)! 3 f19 (23|@5|0@5@7&#,23|$#,)! 3 f23 (23|@5|0@5@7&#,23|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f792 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f64 (23|$#,)! 0 s435|& 0 s436|-1 810 -1 3 Stm{5|@1|^#tm_sec,5|@1|^#tm_min,5|@1|^#tm_hour,5|@1|^#tm_mday,5|@1|^#tm_mon,5|@1|^#tm_year,5|@1|^#tm_wday,5|@1|^#tm_yday,5|@1|^#tm_isdst,}! 3 f0 ()! 3 f801 ()! 3 f0 (802|$#,802|$#,)! 3 f17 (802|$#,802|$#,)! 3 f0 (616|$#,)! 3 f802 (616|$#,)! 1 t802|802& 3 f0 (810|4@5@7&#,)! 3 f802 (810|4@5@7&#,)! 3 f0 (616|$#,)! 3 f19 (616|$#,)! 3 f23 (616|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f23 (810|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f616 (810|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f616 (810|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,616|$#,)! 3 f64 (23|4@0@7&#,64|$#,23|$#,616|$#,)! 0 s446|& 0 s447|& 0 s448|& 0 s449|& 0 s450|& 0 s451|& 0 s452|& 0 s453|& 0 s454|& 0 s455|& 0 s456|& 0 s457|& 0 s458|& 0 s459|& 0 s460|& 0 s461|& 0 s462|& 0 s463|& 0 s464|& 0 s465|& 0 s466|& 0 s467|& 0 s468|& 0 s469|& 0 s470|& 0 s471|& 0 s472|& 0 s473|& 0 s512|& 0 s513|-1 -1 1110 0 s514|& 0 s515|& 0 s516|& 0 s517|& 0 s518|& 0 s519|& 0 a520|-1 866 -1 3 Sdirent{42|@1|^#d_name,}! 0 s521|-1 874 -1 1 t863|863& 3 f0 (866|$#,)! 3 f5 (866|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f866 (23|$#,)! 3 f0 (866|$#,)! 3 f19 (866|$#,)! 1 t865|865& 3 f874 (866|$#,)! 3 f0 (866|$#,)! 3 f1 (866|$#,)! 3 Sflock{7|@1|^#l_type,7|@1|^#l_whence,860|@1|^#l_start,860|@1|^#l_len,861|@1|^#l_pid,}! 0 s606|& 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 3 f0 (5|$#,5|$#,!.,)! 3 f5 (5|$#,5|$#,!.,)! 3 f0 (23|$#,5|$#,!.,)! 3 f5 (23|$#,5|$#,!.,)! 3 Sgroup{23|@1|0@0@3&#gr_name,856|@1|^#gr_gid,486|@1|0@0@3&#gr_mem,}! 0 s610|-1 890 -1 3 f0 (856|$#,)! 3 f19 (856|$#,)! 1 t887|887& 3 f890 (856|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f890 (23|$#,)! 3 Spasswd{23|@1|0@0@3&#pw_name,862|@1|^#pw_uid,856|@1|^#pw_gid,23|@1|0@0@3&#pw_dir,23|@1|0@0@3&#pw_shell,}! 0 s639|-1 899 -1 3 f0 (23|$#,)! 3 f19 (23|$#,)! 1 t896|896& 3 f899 (23|$#,)! 3 f0 (862|$#,)! 3 f19 (862|$#,)! 3 f899 (862|$#,)! 0 a642|& 3 f0 (904|$#,5|$#,)! 3 f1 (904|$#,5|$#,)! 3 f0 (904|4@0@7&#,5|$#,)! 3 f5 (904|4@0@7&#,5|$#,)! 0 a645|-1 956 -1 3 S!4{20|@1|0@0@3&#ss_sp,64|@1|^#ss_size,5|@1|^#ss_flags,}! 0 s646|& 0 s647|& 0 a648|& 0 s649|-1 915 -1 1 t914|914& 3 Ss_ucontext_t{915|@1|0@5@3&#uc_link,909|@1|0@0@3&#uc_sigmask,912|@1|^#uc_stack,913|@1|0@0@3&#uc_mcontext,}! 0 s650|-1 918 -1 1 t917|917& 3 f0 (918|$#,)! 3 f5 (918|$#,)! 3 f0 (918|$#,)! 3 f5 (918|$#,)! 3 ?! 3 f923 ()! 3 f1 ()^926 1 t925|925& 3 f0 (918|$#,926|$#,5|$#,!.,)! 3 f1 (918|$#,926|$#,5|$#,!.,)! 3 f0 (918|$#,918|$#,)! 3 f5 (918|$#,918|$#,)! 3 Ssigstack{5|@1|^#ss_onstack,20|@1|0@0@3&#ss_sp,}! 0 s672|& 0 s673|& 3 S!5{5|@1|^#si_signo,5|@1|^#si_errno,5|@1|^#si_code,861|@1|^#si_pid,862|@1|^#si_uid,20|@1|0@0@3&#si_addr,5|@1|^#si_status,9|@1|^#si_band,933|@1|0@0@3&#si_value,}! 0 s674|& 0 s675|-1 945 -1 3 U!6{5|@1|^#sival_int,20|@1|0@0@3&#sival_ptr,}! 0 s676|& 0 s677|& 3 ?! 3 f940 ()! 3 f1 ()^943 1 t942|942& 3 ?! 1 t936|936& 3 f944 (5|$#,945|$#,20|$#,)! 3 f1 (5|$#,945|$#,20|$#,)^948 1 t947|947& 3 Ssigaction{!943$$$@0#sa_handler,909|@1|0@0@3&#sa_mask,5|@1|^#sa_flags,!948$$$@0#sa_sigaction,}! 0 s678|-1 953 -1 3 f0 (861|$#,5|$#,)! 3 f5 (861|$#,5|$#,)! 1 t950|950& 3 f0 (5|$#,953|$#,953|4@5@7&#,)! 3 f5 (5|$#,953|$#,953|4@5@7&#,)! 1 t909|909& 3 f0 (956|$#,5|$#,)! 3 f5 (956|$#,5|$#,)! 3 f0 (956|$#,5|$#,)! 3 f5 (956|$#,5|$#,)! 3 f0 (956|4@0@7&#,)! 3 f5 (956|4@0@7&#,)! 3 f0 (956|4@0@7&#,)! 3 f5 (956|4@0@7&#,)! 3 f0 (956|$#,5|$#,)! 3 f5 (956|$#,5|$#,)! 3 f0 (956|4@0@7&#,)! 3 f5 (956|4@0@7&#,)! 3 f0 (5|$#,956|0@5@7&#,956|4@5@7&#,)! 3 f5 (5|$#,956|0@5@7&#,956|4@5@7&#,)! 3 f0 (956|$#,)! 3 f5 (956|$#,)! 3 f0 (5|$#,23|$#,)! 3 f19 (5|$#,23|$#,)! 3 f380 (5|$#,23|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 Sstat{858|@1|^#st_mode,857|@1|^#st_ino,855|@1|^#st_dev,859|@1|^#st_nlink,862|@1|^#st_uid,856|@1|^#st_gid,860|@1|^#st_size,802|@1|^#st_atime,802|@1|^#st_mtime,802|@1|^#st_ctime,}! 0 s693|-1 992 -1 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 1 t979|979& 3 f0 (5|$#,992|4@0@7&#,)! 3 f5 (5|$#,992|4@0@7&#,)! 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 3 f0 (23|$#,992|4@0@7&#,)! 3 f5 (23|$#,992|4@0@7&#,)! 3 f0 (858|$#,)! 3 f5 (858|$#,)! 3 Stms{801|@1|^#tms_utime,801|@1|^#tms_stime,801|@1|^#tms_cutime,801|@1|^#tms_cstime,}! 0 s705|-1 1005 -1 1 t1004|1004& 3 f0 (1005|4@0@7&#,)! 3 f801 (1005|4@0@7&#,)! 3 Sutsname{42|@1|^#sysname,42|@1|^#nodename,42|@1|^#release,42|@1|^#version,42|@1|^#machine,}! 0 s707|-1 1010 -1 1 t1009|1009& 3 f0 (1010|4@0@7&#,)! 3 f5 (1010|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (24|4@5@7&#,)! 3 f861 (24|4@5@7&#,)! 3 f0 (861|$#,24|4@5@7&#,5|$#,)! 3 f861 (861|$#,24|4@5@7&#,5|$#,)! 3 C0.4/8|! 3 C0.3/8|! 0 s720|& 3 C0.9/9|! 3 C0.10/9|! 0 s721|& 0 s722|& 3 Stermios{1035|@1|^#c_iflag,1035|@1|^#c_oflag,1035|@1|^#c_cflag,1035|@1|^#c_lflag,1031|@1|^#c_cc,}! 0 s791|-1 1038 -1 1 t1037|1037& 3 f0 (1038|$#,)! 3 f1034 (1038|$#,)! 3 f0 (1038|$#,)! 3 f1034 (1038|$#,)! 3 f0 (1038|$#,)! 3 f5 (1038|$#,)! 3 f0 (1038|$#,)! 3 f5 (1038|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,1038|4@0@7&#,)! 3 f5 (5|$#,1038|4@0@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,1038|$#,)! 3 f5 (5|$#,5|$#,1038|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,862|$#,856|$#,)! 3 f5 (23|$#,862|$#,856|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|4@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 2 y19|19& 2 y23|23& 3 f0 (23|$#,1090|$#,)! 3 f5 (23|$#,1090|$#,)! 3 f0 (23|$#,1090|$#,486|$#,)! 3 f5 (23|$#,1090|$#,486|$#,)! 3 f0 (23|$#,1090|$#,)! 3 f5 (23|$#,1090|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (5|$#,5|$#,)! 3 f9 (5|$#,5|$#,)! 3 f0 (23|@5|4@2@7&#,64|$#,)! 3 f19 (23|@5|4@2@7&#,64|$#,)! 3 f23 (23|@5|4@2@7&#,64|$#,)! 3 f0 ()! 3 f856 ()! 3 f0 ()! 3 f862 ()! 3 f0 ()! 3 f856 ()! 2 y856|856& 3 f0 (5|$#,1110|4@0@7&#,)! 3 f5 (5|$#,1110|4@0@7&#,)! 3 f0 ()! 3 f19 ()! 3 f23 ()! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f862 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (5|$#,860|$#,5|$#,)! 3 f860 (5|$#,860|$#,5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f9 (23|$#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (43|4@0@7&#,)! 3 f5 (43|4@0@7&#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (856|$#,)! 3 f5 (856|$#,)! 3 f0 (861|$#,861|$#,)! 3 f5 (861|$#,861|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (862|$#,)! 3 f5 (862|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (5|$#,)! 3 f9 (5|$#,)! 3 f0 (5|$#,)! 3 f861 (5|$#,)! 3 f0 (5|$#,861|$#,)! 3 f5 (5|$#,861|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (5|$#,20|$#,64|$#,)! 3 f65 (5|$#,20|$#,64|$#,)! 3 Sutimbuf{802|@1|^#actime,802|@1|^#modtime,}! 0 s883|-1 1165 -1 1 t1164|1164& 3 f0 (23|$#,1165|0@5@7&#,)! 3 f5 (23|$#,1165|0@5@7&#,)! 0 a885|-1 1173 -1 0 s886|& 3 S!7{1169|@1|^#rm_so,1169|@1|^#rm_eo,}! 0 s887|& 0 s888|-1 -1 1176 1 t1168|1168& 3 f0 (1173|4@0@7&#,23|$#,5|$#,)! 3 f5 (1173|4@0@7&#,23|$#,5|$#,)! 2 y1172|1172& 3 f0 (1173|$#,23|$#,64|$#,1176|4@0@7&#,5|$#,)! 3 f5 (1173|$#,23|$#,64|$#,1176|4@0@7&#,5|$#,)! 3 f0 (5|$#,1173|$#,23|4@0@7&#,64|$#,)! 3 f64 (5|$#,1173|$#,23|4@0@7&#,64|$#,)! 3 f0 (1173|0@0@2&#,)! 3 f1 (1173|0@0@2&#,)! ;;tistable 0 34 34,224 224 34,224,239 239 34,224,239,243 243 34,224,239,243,244 244 520 520,642 642 520,642,645 645 520,642,645,648 648 520,642,645,648,885 885 ;;symTable *0 (Datatype) ^0 2@a@-@0@0@0@0@2#_Bool *1 (Constant) ^1 2@i0@0@6#false ^2 2@i1@0@0#true *11 (GlobalMarker) *1 (Constant) ^4 5$#__LINE__ ^5 23$#__DATE__#__FILE__#__BASE_FILE__#__func__ ^9 5$#__INCLUDE_LEVEL__ ^10 23$#__VERSION__ *0 (Datatype) ^11 13@c@-@0@0@0@0@59#__SIZE_TYPE__ ^12 13@c@-@0@0@0@0@60#__PTRDIFF_TYPE__ ^13 13@c@-@0@0@0@0@61#__WCHAR_TYPE__ *1 (Constant) ^14 23$#__USER_LABEL_PREFIX__#__REGISTER_PREFIX__#__TIME__ ^17 5$#__STDC__#S_SPLINT_S#__LCLINT__#__i686 *3 (Variable) ^21 380|@1|6@0@0@0@1#stdin#stdout *1 (Constant) ^23 5$#EDOM#ERANGE#EILSEQ *3 (Variable) ^26 5|@1|6@0@0@0@1#errno *0 (Datatype) ^27 2@-@-@0@0@0@0@62#bool *1 (Constant) ^28 5@i1@0@0#__bool_true_false_are_defined *0 (Datatype) ^29 13@-@-@0@0@0@0@63#ptrdiff_t ^30 14@-@-@0@0@0@0@64#size_t ^31 15@-@-@0@0@0@0@65#ssize_t ^32 13@-@-@0@0@0@0@66#wchar_t ^33 13@-@-@0@0@0@0@67#wint_t ^34 0@a@=@0@0@0@0@68#mbstate_t *1 (Constant) ^35 0@i0@0@6#NULL ^36 2$#NDEBUG *4 (Function) ^37 73@6@0@8@0@0^$@0#assert ^38 78$^$@0#isalnum ^39 81$^$@0#isalpha ^40 84$^$@0#iscntrl ^41 87$^$@0#isdigit ^42 91$^$@0#isgraph ^43 95$^$@0#islower ^44 98$^$@0#isprint ^45 101$^$@0#ispunct ^46 104$^$@0#isspace ^47 108$^$@0#isupper ^48 112$^$@0#isxdigit ^49 116$^$@0#tolower ^50 119$^$@0#toupper *7 (Struct tag) ^51 120@121#@lconv *1 (Constant) ^52 5$#LC_ALL#LC_COLLATE#LC_CTYPE#LC_MONETARY#LC_NUMERIC#LC_TIME *4 (Function) ^58 124@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@19@3@0#setlocale ^59 128$^@3@0@0#localeconv *3 (Variable) ^60 5|@1|6@0@0@0@1#DBL_DIG ^61 17|@1|6@0@0@0@1#DBL_EPSILON ^62 5|@1|6@0@0@0@1#DBL_MANT_DIG ^63 17|@1|6@0@0@0@1#DBL_MAX ^64 5|@1|6@0@0@0@1#DBL_MAX_10_EXP#DBL_MAX_EXP ^66 17|@1|6@0@0@0@1#DBL_MIN ^67 5|@1|6@0@0@0@1#DBL_MIN_10_EXP#DBL_MIN_EXP#FLT_DIG ^70 16|@1|6@0@0@0@1#FLT_EPSILON ^71 5|@1|6@0@0@0@1#FLT_MANT_DIG ^72 16|@1|6@0@0@0@1#FLT_MAX ^73 5|@1|6@0@0@0@1#FLT_MAX_10_EXP#FLT_MAX_EXP ^75 16|@1|6@0@0@0@1#FLT_MIN ^76 5|@1|6@0@0@0@1#FLT_MIN_10_EXP#FLT_MIN_EXP *1 (Constant) ^78 5$#FLT_RADIX *3 (Variable) ^79 5|@1|6@0@0@0@1#FLT_ROUNDS#LDBL_DIG ^81 18|@1|6@0@0@0@1#LDBL_EPSILON ^82 5|@1|6@0@0@0@1#LDBL_MANT_DIG ^83 18|@1|6@0@0@0@1#LDBL_MAX ^84 5|@1|6@0@0@0@1#LDBL_MAX_10_EXP#LDBL_MAX_EXP ^86 18|@1|6@0@0@0@1#LDBL_MIN ^87 5|@1|6@0@0@0@1#LDBL_MIN_10_EXP#LDBL_MIN_EXP *1 (Constant) ^89 5$#CHAR_BIT ^90 4$#CHAR_MAX#CHAR_MIN ^92 5$#INT_MAX#INT_MIN ^94 9$#LONG_MAX#LONG_MIN#MB_LEN_MAX ^97 4$#SCHAR_MAX#SCHAR_MIN ^99 7$#SHRT_MAX#SHRT_MIN ^101 3$#UCHAR_MAX#UCHAR_MIN ^103 6$#UINT_MAX ^104 10$#ULONG_MAX ^105 8$#USHRT_MAX *0 (Datatype) ^106 16@-@-@0@0@0@0@129#float_t ^107 17@-@-@0@0@0@0@130#double_t *1 (Constant) ^108 17$#HUGE_VAL ^109 16$#HUGE_VALF ^110 18$#HUGE_VALL ^111 16$#INFINITY#NAN ^113 5$#FP_INFINITE#FP_NAN#FP_NORMAL#FP_SUBNORMAL#FP_ZERO#FP_ILOGB0#FP_ILOGBNAN#DECIMAL_DIG *0 (Datatype) ^121 132@-@-@0@0@0@0@133#s_real_t *4 (Function) ^122 135$^$@0#fpclassify ^123 137$^$@0#signbit ^124 139$^$@0#isfinite ^125 141$^$@0#isnormal ^126 143$^$@0#isnan ^127 145$^$@0#isinf ^128 147$@0@g26@6@0@1@g26$@0#acos ^129 149$@0@g26@6@0@1@g26$@0#asin ^130 151$^$@0#atan ^131 153$^$@0#atan2 ^132 155$^$@0#cos ^133 157$^$@0#sin ^134 159$^$@0#tan ^135 161$@0@g26@6@0@1@g26$@0#cosh ^136 163$@0@g26@6@0@1@g26$@0#sinh ^137 165$^$@0#tanh ^138 167$@0@g26@6@0@1@g26$@0#acosh ^139 169$@0@g26@6@0@1@g26$@0#asinh ^140 171$@0@g26@6@0@1@g26$@0#atanh ^141 173$@0@g26@6@0@1@g26$@0#exp ^142 175$@0@@1@tp1$@0#frexp ^143 177$@0@g26@6@0@1@g26$@0#ldexp ^144 179$@0@g26@6@0@1@g26$@0#log ^145 181$@0@g26@6@0@1@g26$@0#log10 ^146 183$@0@@1@tp1$@0#modf ^147 185$@0@g26@6@0@1@g26$@0#exp2 ^148 187$@0@g26@6@0@1@g26$@0#expm1 ^149 189$@0@g26@6@0@1@g26$@0#log1p ^150 191$@0@g26@6@0@1@g26$@0#log2 ^151 193$@0@g26@6@0@1@g26$@0#logb ^152 195$@0@g26@6@0@1@g26$@0#scalbn ^153 197$@0@g26@6@0@1@g26$@0#scalbln ^154 199$@0@g26@6@0@1@g26$@0#scalblnl ^155 201$@0@g26@6@0@1@g26$@0#ilogb ^156 203$@0@g26@6@0@1@g26$@0#ilogbf ^157 205$@0@g26@6@0@1@g26$@0#ilogbl ^158 207$^$@0#fabs ^159 209$^$@0#fabsf ^160 211$^$@0#fabsl ^161 213$@0@g26@6@0@1@g26$@0#pow ^162 215$@0@g26@6@0@1@g26$@0#powf ^163 217$@0@g26@6@0@1@g26$@0#powl ^164 219$@0@g26@6@0@1@g26$@0#sqrt ^165 221$@0@g26@6@0@1@g26$@0#sqrtf ^166 223$@0@g26@6@0@1@g26$@0#sqrtl ^167 225$^$@0#cbrt ^168 227$^$@0#cbrtf ^169 229$^$@0#cbrtl ^170 231$@0@g26@6@0@1@g26$@0#hypot ^171 233$@0@g26@6@0@1@g26$@0#hypotf ^172 235$@0@g26@6@0@1@g26$@0#hypotl ^173 237$^$@0#erf ^174 239$^$@0#erfc ^175 241$^$@0#erff ^176 243$^$@0#erfl ^177 245$^$@0#erfcf ^178 247$^$@0#erfcl ^179 249$@0@g26@6@0@1@g26$@0#gamma ^180 251$@0@g26@6@0@1@g26$@0#gammaf ^181 253$@0@g26@6@0@1@g26$@0#gammal ^182 255$@0@g26@6@0@1@g26$@0#lgamma ^183 257$@0@g26@6@0@1@g26$@0#lgammaf ^184 259$@0@g26@6@0@1@g26$@0#lgammal ^185 261$^$@0#ceil ^186 263$^$@0#ceilf ^187 265$^$@0#ceill ^188 267$^$@0#floor ^189 269$^$@0#floorf ^190 271$^$@0#floorl ^191 273$^$@0#nearbyint ^192 275$^$@0#nearbyintf ^193 277$^$@0#nearbyintl ^194 279$^$@0#rint ^195 281$^$@0#rintf ^196 283$^$@0#rintl ^197 285$@0@g26@6@0@1@g26$@0#lrint ^198 287$@0@g26@6@0@1@g26$@0#lrintf ^199 289$@0@g26@6@0@1@g26$@0#lrintl ^200 291$@0@g26@6@0@1@g26$@0#llrint ^201 293$@0@g26@6@0@1@g26$@0#llrintf ^202 295$@0@g26@6@0@1@g26$@0#llrintl ^203 297$^$@0#round ^204 299$@0@g26@6@0@1@g26$@0#lround ^205 301$@0@g26@6@0@1@g26$@0#llround ^206 303$^$@0#trunc ^207 305$^$@0#fmod ^208 307$^$@0#remainder ^209 309$@0@@1@tp2$@0#remquo ^210 311$^$@0#copysign ^211 313$^$@0#nan ^212 315$^$@0#nextafter ^213 317$^$@0#nextafterx ^214 319$@0@g26@6@0@1@g26$@0#fdim ^215 321$^$@0#fmax ^216 323$^$@0#fmin ^217 325$^$@0#fma ^218 327$^$@0#isgreater ^219 329$^$@0#isgreaterequal ^220 331$^$@0#isless ^221 333$^$@0#islessequal ^222 335$^$@0#islessgreater ^223 337$^$@0#isunordered *0 (Datatype) ^224 20@a@+@0@0@0@0@338#jmp_buf *4 (Function) ^225 340$@0@@1@p0$@0#setjmp ^226 342@6@0@5@0@0^$@0#longjmp *1 (Constant) ^227 5$#SIGABRT#SIGFPE#SIGILL#SIGINT#SIGSEGV#SIGTERM *0 (Datatype) ^233 13@-@-@0@0@0@0@343#sig_atomic_t *1 (Constant) ^234 347$#SIG_DFL ^235 351$#SIG_ERR ^236 355$#SIG_IGN *4 (Function) ^237 368@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26$@0#signal ^238 370@6@0@5@0@0$$@0#raise *0 (Datatype) ^239 20@a@+@0@0@0@0@371#va_list *4 (Function) ^240 373$@0@@1@p0$@0#va_start ^241 375$@0@@1@p0$@0#va_end ^242 377$$$@0#va_copy *0 (Datatype) ^243 20@a@+@0@0@0@0@378#FILE ^244 20@a@+@0@0@0@0@379#fpos_t *1 (Constant) ^245 64$#_IOFBF#_IOLBF#_IONBF#BUFSIZ ^249 5$#EOF#FOPEN_MAX#FILENAME_MAX#L_tmpnam#SEEK_CUR#SEEK_END#SEEK_SET#TMP_MAX *3 (Variable) ^257 380|@1|6@0@0@0@1#stderr *4 (Function) ^258 382$@0@s3,g26@6@0@1@s3,g26$@0#remove ^259 384$@0@s3,g26@6@0@1@s3,g26$@0#rename ^260 387@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#tmpfile ^261 390$@0@s1@1@tp0,s1@19@3@0#tmpnam ^262 392$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fclose ^263 394$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fflush ^264 397@6@5@1@0@0@0@s3@1@s3@18@0@0#fopen ^265 400@6@5@1@0@0@0@s3,g26@6@0@1@tp2,s3,g26@18@0@0#freopen ^266 402$@0@s3@1@s3,tp0,tp1$@0#setbuf ^267 404$@0@s3@1@s3,tp0,tp1$@0#setvbuf ^268 408@6@0@1@1@0@0@s3@1@s3,tp0$@0#fprintf ^269 410@6@0@1@2@0@0@s3,g26@6@0@1@s3,tp0,g26$@0#fscanf ^270 413@6@0@1@1@0@1@g22@6@0,s3@1@s3,tg22$@0#printf ^271 415@6@0@1@2@0@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#scanf ^272 418@6@0@1@1@0@0@@1@tp0$@0@W:bufferoverflowhigh#Buffer overflow possible with sprintf. Recommend using snprintf instead##sprintf ^273 420@6@0@1@1@0@0@@1@p0$@0#snprintf ^274 422@6@0@1@2@0@0@g26@6@0@1@g26$@0#sscanf ^275 424$@1@g22@6@0,s3@1@s3,tg22$@0#vprintf ^276 426$@0@s3,g26@6@0@1@s3,tp0,p2,g26$@0#vfprintf ^277 428$@0@@1@p0$@0@W:bufferoverflowhigh#Use vsnprintf instead##vsprintf ^278 430$@0@@1@p0$@0#vsnprintf ^279 432$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fgetc ^280 435@6@5@1@0@0@0@s3,g26@6@0@1@s3,tp0,tp2,g26$@0#fgets ^281 438$@0@s3,g26@6@0@1@s3,tp1,g26$@0#fputc ^282 440$@0@s3@1@s3,tp1$@0#fputs ^283 442$@0@s3,g26@6@0@1@s3,tp0,g26$@0#getc ^284 444$@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#getchar ^285 447@6@5@1@0@0@1@g21@6@0,s3,g26@6@0@1@s3,tp0,tg21,g26@3@0@0@W:bufferoverflowhigh#Use of gets leads to a buffer overflow vulnerability. Use fgets instead##gets ^286 449$@0@s3,g26@6@0@1@s3,tp1,g26$@0#putc ^287 451$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#putchar ^288 453$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#puts ^289 455$@0@s3@1@s3,tp1$@0#ungetc ^290 457$@0@s3,g26@6@0@1@s3,tp0,tp3,g26$@0#fread ^291 459$@0@s3,g26@6@0@1@s3,tp3,g26$@0#fwrite ^292 462$@0@g26@6@0@1@tp1,g26$@0#fgetpos ^293 464$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fseek ^294 466$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fsetpos ^295 468$@0@g26@6@0@1@g26$@0#ftell ^296 470$@0@@1@tp0$@0#rewind ^297 472$@0@@1@tp0$@0#clearerr ^298 474$@0@g26@6@0@1@g26$@0#feof ^299 476$@0@g26@6@0@1@g26$@0#ferror ^300 478$@1@g26@6@0,g257@6@0,s3@1@s3,tg257$@0#perror ^301 480$^$@0#atof ^302 482$^$@0#atoi ^303 484$^$@0#atol ^304 488$@0@g26@6@0@1@tp1,g26$@0#strtod ^305 490$@0@g26@6@0@1@tp1,g26$@0#strtol ^306 492$@0@g26@6@0@1@tp1,g26$@0#strtoul *1 (Constant) ^307 5$#RAND_MAX *4 (Function) ^308 494$@0@s1@1@s1$@0#rand ^309 496$@0@s1@1@s1$@0#srand ^310 499@6@5@1@0@0^@2@0@0#calloc ^311 502@4@5@1@0@0^@2@0@0#malloc ^312 505@6@5@1@0@0@0@@1@tp0@2@0@0#realloc ^313 507$@0@@1@p0$@0#free *1 (Constant) ^314 5$#EXIT_FAILURE#EXIT_SUCCESS *4 (Function) ^316 509@6@0@6@0@0^$@0#abort ^317 511@6@0@6@0@0^$@0#exit ^318 517$@0@s1@1@s1$@0#atexit ^319 520@6@5@1@0@0^@19@3@0#getenv ^320 522$@0@s3@1@s3$@0#system ^321 529@6@5@1@0@0^@18@0@0#bsearch ^322 535$@0@g26@6@0@1@tp0,g26$@0#qsort ^323 537$^$@0#abs *7 (Struct tag) ^324 538@539#@!2 *0 (Datatype) ^325 538@c@-@0@0@0@0@540#div_t *4 (Function) ^326 542$^$@0#div ^327 544$^$@0#labs *7 (Struct tag) ^328 545@546#@!3 *0 (Datatype) ^329 545@c@-@0@0@0@0@547#ldiv_t *4 (Function) ^330 549$^$@0#ldiv *1 (Constant) ^331 64$#MB_CUR_MAX ^332 5$#WCHAR_MAX#WCHAR_MIN ^334 67$#WEOF *4 (Function) ^335 551$^$@0#btowc ^336 553$@0@s3@1@s3,tp0$@0#fgetwc ^337 557@6@5@1@0@0@0@s3@1@s3,tp0,tp2$@0#fgetws ^338 559$@0@s3@1@s3,tp1$@0#fputwc ^339 561$@0@s3@1@s3,tp1$@0#fputws ^340 563$^$@0#fwide ^341 565@6@0@1@1@0@0@s3@1@tp0,s3$@0#fwprintf ^342 567@6@0@1@2@0@0@s3@1@tp0,s3$@0#fwscanf ^343 569$@0@s3@1@s3,tp0$@0#getwc ^344 571$@0@s3,g21@6@0@1@s3,tg21$@0#getwchar ^345 574$^$@0#mbrlen ^346 576$@0@@1@tp0$@0#mbrtowc ^347 578$^$@0#mbsinit ^348 580$@0@@1@tp0$@0#mbsrtowcs ^349 582$@0@s3@1@s3,tp1$@0#putwc ^350 584$@0@s3,g22@6@0@1@s3,tg22$@0#putwchar ^351 586@6@0@1@1@0@0@@1@tp0$@0#swprintf ^352 588@6@0@1@2@0@0@g21@6@0@1@tg21$@0#swscanf ^353 590$@0@s3@1@s3,tp1$@0#ungetwc ^354 592$@0@s3@1@s3,tp0$@0#vfwprintf ^355 594$@0@@1@tp0$@0#vswprintf ^356 596$@0@s3,g22@6@0@1@s3,tg22$@0#vwprintf ^357 598$@0@@1@tp0$@0#wcrtomb ^358 602$@0@@1@tp0$@0#wcscat ^359 605@6@5@1@0@0^@19@2@0#wcschr ^360 607$^$@0#wcscmp ^361 609$^$@0#wcscoll ^362 612$@0@@1@tp0$@0#wcscpy ^363 614$^$@0#wcscspn *7 (Struct tag) ^364 803@615#@tm *4 (Function) ^365 618$@0@@1@tp0$@0#wcsftime ^366 620$^$@0#wcslen ^367 624$@0@@1@tp0$@0#wcsncat ^368 626$^$@0#wcsncmp ^369 629$@0@@1@tp0$@0#wcsncpy ^370 632@6@5@1@0@0^$@0#wcspbrk ^371 635@6@5@1@0@0^$@0#wcsrchr ^372 638$@0@@1@tp1$@0#wcsrtombs ^373 640$^$@0#wcsspn ^374 643@6@5@1@0@0^@3@0@0#wcsstr ^375 645$@0@@1@tp1$@0#wcstod ^376 648@6@5@1@0@0@0@@1@tp2@3@0@0#wcstok ^377 650$@0@@1@tp1$@0#wcstol ^378 652$@0@@1@tp1$@0#wcstoul ^379 654$@0@@1@tp0$@0#wcsxfrm ^380 656$^$@0#wctob ^381 659@6@5@1@0@0^@3@0@0#wmemchr ^382 661$^$@0#wmemcmp ^383 664$@0@@1@tp0$@0#wmemcpy ^384 667$@0@@1@tp0$@0#wmemmove ^385 670$@0@@1@tp0$@0#wmemset ^386 672@6@0@1@1@0@1@g22@6@0,g26@6@0@1@g26,tg22$@0#wprintf ^387 674@6@0@1@2@0@1@g21@6@0,g26@6@0@1@g26,tg21$@0#wscanf *0 (Datatype) ^388 13@-@-@0@0@0@0@675#wctype_t ^389 13@-@-@0@0@0@0@676#wctrans_t *4 (Function) ^390 680$^$@0#iswalnum ^391 683$^$@0#iswalpha ^392 686$^$@0#iswcntrl ^393 689$^$@0#iswctype ^394 692$^$@0#iswdigit ^395 696$^$@0#iswgraph ^396 699$^$@0#iswlower ^397 702$^$@0#iswprint ^398 705$^$@0#iswpunct ^399 708$^$@0#iswspace ^400 711$^$@0#iswupper ^401 715$^$@0#iswxdigit ^402 719$^$@0#towctrans ^403 722$^$@0#towlower ^404 725$^$@0#towupper ^405 727$^$@0#wctrans ^406 729$^$@0#wctype ^407 731$^$@0#mblen ^408 733$@0@@1@tp0$@0#mbtowc ^409 735$@0@@1@tp0$@0#wctomb ^410 737$@0@@1@tp0$@0#mbstowcs ^411 739$@0@@1@tp0$@0#wcstombs ^412 743$@0@@1@tp0$@0#memcpy ^413 746$@0@@1@tp0$@0#memmove ^414 750$@0@@1@tp0$@0#strcpy ^415 753$@0@@1@tp0$@0#strncpy ^416 756$@0@@1@tp0$@0#strcat ^417 759$@0@@1@tp0$@0#strncat ^418 761$^$@0#memcmp ^419 763$^$@0#strcmp ^420 765$^$@0#strcoll ^421 767$^$@0#strncmp ^422 769$@0@@1@tp0$@0#strxfrm ^423 772@6@5@1@0@0^@3@0@0#memchr ^424 775@6@5@1@0@0^@19@2@0#strchr ^425 777$^$@0#strcspn ^426 780@6@5@1@0@0^@19@2@0#strpbrk ^427 783@6@5@1@0@0^@19@2@0#strrchr ^428 785$^$@0#strspn ^429 788@6@5@1@0@0^@19@2@0#strstr ^430 791@6@5@1@0@0@0@s1,g26@6@0@1@tp0,s1,g26@19@2@0#strtok ^431 795$@0@@1@tp0$@0#memset ^432 798$^@19@3@0#strerror ^433 800$^$@0#strlen *1 (Constant) ^434 5$#CLOCKS_PER_SEC *0 (Datatype) ^435 13@-@-@0@0@0@0@801#clock_t ^436 13@-@-@0@0@0@0@802#time_t *4 (Function) ^437 805$@0@s1@1@s1$@0#clock ^438 807$^$@0#difftime ^439 809$^$@0#mktime ^440 812$@0@@1@tp0$@0#time ^441 815$@0@g26@6@0@1@g26@19@3@0#asctime ^442 818$^@19@3@0#ctime ^443 821$^@19@3@0#gmtime ^444 824$@0@g26@6@0@1@g26@19@3@0#localtime ^445 826$@0@@1@tp0$@0#strftime *0 (Datatype) ^446 13@-@-@0@0@0@0@827#int8_t ^447 13@-@-@0@0@0@0@828#int16_t ^448 13@-@-@0@0@0@0@829#int32_t ^449 13@-@-@0@0@0@0@830#int64_t ^450 14@-@-@0@0@0@0@831#uint8_t ^451 14@-@-@0@0@0@0@832#uint16_t ^452 14@-@-@0@0@0@0@833#uint32_t ^453 14@-@-@0@0@0@0@834#uint64_t ^454 13@-@-@0@0@0@0@835#int_least8_t ^455 13@-@-@0@0@0@0@836#int_least16_t ^456 13@-@-@0@0@0@0@837#int_least32_t ^457 13@-@-@0@0@0@0@838#int_least64_t ^458 14@-@-@0@0@0@0@839#uint_least8_t ^459 14@-@-@0@0@0@0@840#uint_least16_t ^460 14@-@-@0@0@0@0@841#uint_least32_t ^461 14@-@-@0@0@0@0@842#uint_least64_t ^462 13@-@-@0@0@0@0@843#int_fast8_t ^463 13@-@-@0@0@0@0@844#int_fast16_t ^464 13@-@-@0@0@0@0@845#int_fast32_t ^465 13@-@-@0@0@0@0@846#int_fast64_t ^466 14@-@-@0@0@0@0@847#uint_fast8_t ^467 14@-@-@0@0@0@0@848#uint_fast16_t ^468 14@-@-@0@0@0@0@849#uint_fast32_t ^469 14@-@-@0@0@0@0@850#uint_fast64_t ^470 15@-@-@0@0@0@0@851#intptr_t ^471 14@-@-@0@0@0@0@852#uintptr_t ^472 15@-@-@0@0@0@0@853#intmax_t ^473 14@-@-@0@0@0@0@854#uintmax_t *1 (Constant) ^474 5$#INT8_MIN#INT16_MIN#INT32_MIN#INT64_MIN#INT8_MAX#INT16_MAX#INT32_MAX#INT64_MAX#UINT8_MIN#UINT16_MIN#UINT32_MIN#UINT64_MIN#INT_LEAST8_MIN#INT_LEAST16_MIN#INT_LEAST32_MIN#INT_LEAST64_MIN#INT_LEAST8_MAX#INT_LEAST16_MAX#INT_LEAST32_MAX#INT_LEAST64_MAX#UINT_LEAST8_MAX#UINT_LEAST16_MAX#UINT_LEAST32_MAX#UINT_LEAST64_MAX#INT_FAST8_MIN#INT_FAST16_MIN#INT_FAST32_MIN#INT_FAST64_MIN#INT_FAST8_MAX#INT_FAST16_MAX#INT_FAST32_MAX#INT_FAST64_MAX#UINT_FAST8_MAX#UINT_FAST16_MAX#UINT_FAST32_MAX#UINT_FAST64_MAX ^510 64$#INTPTR_MIN#INTPTR_MAX *0 (Datatype) ^512 13@-@-@0@0@0@0@855#dev_t ^513 13@-@-@0@0@0@0@856#gid_t ^514 14@-@-@0@0@0@0@857#ino_t ^515 13@-@-@0@0@0@0@858#mode_t ^516 13@-@-@0@0@0@0@859#nlink_t ^517 13@-@-@0@0@0@0@860#off_t ^518 13@-@-@0@0@0@0@861#pid_t ^519 13@-@-@0@0@0@0@862#uid_t ^520 20@a@+@0@0@0@0@863#DIR *7 (Struct tag) ^521 864@865#@dirent *4 (Function) ^522 868$@0@g26@6@0@1@g26$@0#closedir ^523 871@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#opendir ^524 875@6@5@1@0@0@0@g26@6@0@1@g26@18@0@0#readdir ^525 877$^$@0#rewinddir *1 (Constant) ^526 5$#E2BIG#EACCES#EAGAIN#EBADF#EBUSY#ECHILD#EDEADLK#EEXIST#EFAULT#EFBIG#EINTR#EINVAL#EIO#EISDIR#EMFILE#EMLINK#ENAMETOOLONG#ENFILE#ENODEV#ENOENT#ENOEXEC#ENOLCK#ENOMEM#ENOSPC#ENOSYS#ENOTDIR#ENOTEMPTY#ENOTTY#ENXIO#EPERM#EPIPE#EROFS#ESPIPE#ESRCH#EXDEV#FD_CLOEXEC#F_DUPFD#F_GETFD#F_GETFL#F_GETLK#F_RDLCK#F_SETFD#F_SETFL#F_SETLK#F_SETLKW#F_UNLCK#F_WRLCK#O_ACCMODE#O_APPEND#O_CREAT#O_EXCL#O_NOCTTY#O_NONBLOCK#O_RDONLY#O_RDWR#O_TRUNC#O_WRONLY ^583 858$#S_IFMT#S_IFBLK#S_IFCHR#S_IFIFO#S_IFREG#S_IFDIR#S_IFLNK#S_IRWXU#S_IRUSR#S_IRGRP#S_IROTH#S_IUSR#S_IWXG#S_IWXO#S_IWXU#S_ISGID#S_ISUID#S_IWGRP#S_IWOTH#S_IWUSR#S_IXGRP#S_IXOTH#S_IXUSR *7 (Struct tag) ^606 878@879#@flock *4 (Function) ^607 881$@0@g26@6@0@1@g26$@0#creat ^608 883$@0@g26@6@0@1@g26$@0#fcntl ^609 885$@0@g26@6@0@1@g26$@0#open *7 (Struct tag) ^610 886@887#@group *4 (Function) ^611 891@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrgid ^612 894@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrnam *1 (Constant) ^613 9$#ARG_MAX#CHILD_MAX#LINK_MAX#MAX_CANON ^617 64$#MAX_INPUT#NAME_MAX ^619 9$#NGROUPS_MAX#OPEN_MAX ^621 64$#PATH_MAX#PIPE_BUF ^623 9$#SSIZE_MAX#STREAM_MAX#TZNAME_MAX#_POSIX_ARG_MAX#_POSIX_CHILD_MAX#_POSIX_LINK_MAX#_POSIX_MAX_CANON#_POSIX_MAX_INPUT#_POSIX_NAME_MAX#_POSIX_NGROUPS_MAX#_POSIX_OPEN_MAX#_POSIX_PATH_MAX#_POSIX_PIPE_BUF#_POSIX_SSIZE#_POSIX_STREAM#_POSIX_TZNAME_MAX *7 (Struct tag) ^639 895@896#@passwd *4 (Function) ^640 900@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwnam ^641 903@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwuid *0 (Datatype) ^642 20@a@+@0@0@0@0@904#sigjmp_buf *4 (Function) ^643 906@6@0@5@0@0^$@0#siglongjmp ^644 908$@0@@1@p0$@0#sigsetjmp *0 (Datatype) ^645 0@a@=@0@0@0@0@909#sigset_t *7 (Struct tag) ^646 910@911#@!4 *0 (Datatype) ^647 910@-@-@0@0@0@0@912#stack_t ^648 0@a@=@0@0@0@0@913#mcontext_t *7 (Struct tag) ^649 916@914#@s_ucontext_t *0 (Datatype) ^650 914@-@+@0@0@0@0@917#ucontext_t *4 (Function) ^651 920$$$@0#getcontext ^652 922$$$@0#setcontext ^653 928$$$@0#makecontext ^654 930$$$@0#swapcontext *1 (Constant) ^655 5$#SA_NOCLDSTOP#SIG_BLOCK#SIG_SETMASK#SIG_UNBLOCK#SIGALRM#SIGCHLD#SIGCONT#SIGHUP#SIGKILL#SIGPIPE#SIGQUIT#SIGSTOP#SIGTSTP#SIGTTIN#SIGTTOU#SIGUSR1#SIGUSR2 *7 (Struct tag) ^672 931@932#@sigstack *8 (Union tag) ^673 0@933#$sigval *7 (Struct tag) ^674 934@935#@!5 *0 (Datatype) ^675 934@-@-@0@0@0@0@936#siginfo_t *8 (Union tag) ^676 937@938#$!6 *0 (Datatype) ^677 937@-@-@0@0@0@0@939#sigval *7 (Struct tag) ^678 949@950#@sigaction *4 (Function) ^679 952@6@0@5@0@0@0@g26@6@0@1@g26$@0#kill ^680 955$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigaction ^681 958$@0@g26@6@0@1@tp0,g26$@0#sigaddset ^682 960$@0@g26@6@0@1@tp0,g26$@0#sigdelset ^683 962$@0@g26@6@0@1@tp0,g26$@0#sigemptyset ^684 964$@0@g26@6@0@1@tp0,g26$@0#sigfillset ^685 966$@0@g26@6@0@1@g26$@0#sigismember ^686 968$@0@g26@6@0@1@tp0,g26$@0#sigpending ^687 970$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigprocmask ^688 972$@0@g26@6@0,s3@1@g26,s3$@0#sigsuspend *1 (Constant) ^689 5$#L_ctermid#L_cuserid *4 (Function) ^691 975@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#fdopen ^692 977$@0@g26@6@0@1@g26$@0#fileno *7 (Struct tag) ^693 978@979#@stat *4 (Function) ^694 981$^$@0#S_ISBLK ^695 983$^$@0#S_ISCHR ^696 985$^$@0#S_ISDIR ^697 987$^$@0#S_ISFIFO ^698 989$^$@0#S_ISREG ^699 991$@0@s3,g26@6@0@1@s3,g26$@0#chmod ^700 994$@0@g26@6@0@1@g26,tp1$@0#fstat ^701 996$@0@s3,g26@6@0@1@s3,g26$@0#mkdir ^702 998$@0@s3,g26@6@0@1@s3,g26$@0#mkfifo ^703 1000$@0@g26@6@0@1@g26,tp1$@0#stat ^704 1002$@0@s3@1@s3$@0#umask *7 (Struct tag) ^705 1003@1004#@tms *4 (Function) ^706 1007$@0@@1@tp0$@0#times *7 (Struct tag) ^707 1008@1009#@utsname *4 (Function) ^708 1012$@0@g26@6@0@1@tp0,g26$@0#uname ^709 1014$^$@0#WEXITSTATUS ^710 1016$^$@0#WIFEXITED ^711 1018$^$@0#WIFSIGNALED ^712 1020$^$@0#WIFSTOPPED ^713 1022$^$@0#WSTOPSIG ^714 1024$^$@0#WTERMSIG *1 (Constant) ^715 5$#WUNTRACED#WCONTINUED#WNOHANG *4 (Function) ^718 1026$@0@g26@6@0,s3@1@tp0,g26,s3$@0#wait ^719 1028$@0@g26@6@0,s3@1@tp1,g26,s3$@0#waitpid *0 (Datatype) ^720 1030@-@-@0@0@0@0@1031#cc_t ^721 1033@-@-@0@0@0@0@1034#speed_t ^722 1033@-@-@0@0@0@0@1035#tcflag_t *1 (Constant) ^723 5$#B0#B50#B75#B110#B134#B150#B200#B300#B600#B1200#B1800#B2400#B4800#B9600#B19200#B38400#BRKINT#CLOCAL#CREAD#CS5#CS6#CS7#CS8#CSIZE#CSTOPB#ECHO#ECHOE#ECHOK#ECHONL#HUPCL#ICANON#ICRNL#IEXTEN#IGNBRK#IGNCR#IGNPAR#IGNLCR#INPCK#ISIG#ISTRIP#IXOFF#IXON#NCCS#NOFLSH#OPOST#PARENB#PARMRK#PARODD#TCIFLUSH#TCIOFF#TCIOFLUSH#TCION#TCOFLUSH#TCSADRAIN#TCSAFLUSH#TCSANOW#TOSTOP#VEOF#VEOL#VERASE#VINTR#VKILL#VMIN#VQUIT#VSTART#VSTOP#VSUSP#VTIME *7 (Struct tag) ^791 1036@1037#@termios *4 (Function) ^792 1040$^$@0#cfgetispeed ^793 1042$^$@0#cfgetospeed ^794 1044$@0@@1@tp0$@0#cfsetispeed ^795 1046$@0@@1@tp0$@0#cfsetospeed ^796 1048$@0@g26@6@0@1@g26$@0#tcdrain ^797 1050$@0@g26@6@0@1@g26$@0#tcflow ^798 1052$@0@g26@6@0@1@g26$@0#tcflush ^799 1054$@0@g26@6@0@1@g26,tp1$@0#tcgetattr ^800 1056$@0@g26@6@0@1@g26$@0#tcsendbreak ^801 1058$@0@g26@6@0@1@g26$@0#tcsetattr *3 (Variable) ^802 486|@1|6@0@0@0@1#environ *1 (Constant) ^803 5$#CLK_TCK *4 (Function) ^804 1060$@1@g802@6@0,s3@1@s3$@0#tzset *1 (Constant) ^805 5$#F_OK#R_OK#STDERR_FILENO#STDIN_FILENO#STDOUT_FILENO#W_OK#X_OK#_PC_CHOWN_RESTRUCTED#_PC_MAX_CANON#_PC_MAX_INPUT#_PC_NAME_MAX#_PC_NO_TRUNC#_PC_PATH_MAX#_PC_PIPE_BUF#_PC_VDISABLE#_POSIX_CHOWN_RESTRICTED#_POSIX_JOB_CONTROL#_POSIX_NO_TRUNC#_POSIX_SAVED_IDS#_POSIX_VDISABLE#_POSIX_VERSION#_SC_ARG_MAX#_SC_CHILD_MAX#_SC_CLK_TCK#_SC_JOB_CONTROL#_SC_NGROUPS_MAX#_SC_OPEN_MAX#_SC_SAVED_IDS#_SC_STREAM_MAX#_SC_TZNAME_MAX#_SC_VERSION *4 (Function) ^836 1062@6@0@6@0@0^$@0#_exit ^837 1064$@0@g26@6@0@1@g26$@0#access ^838 1066$@0@s3@1@s3$@0#alarm ^839 1068$@0@g26@6@0@1@g26$@0#chdir ^840 1070$@0@s3,g26@6@0@1@s3,g26$@0#chown ^841 1072$@0@s3,g26@6@0@1@s3,g26$@0#close ^842 1075$@0@s3@1@tp0,s3$@0#ctermid ^843 1078$@0@@1@tp0@3@0@0#cuserid ^844 1080$@0@g26@6@0,s3@1@g26,s3$@0#dup2 ^845 1082$@0@g26@6@0,s3@1@g26,s3$@0#dup ^846 1084@6@0@5@0@0@0@g26@6@0@1@g26$@0#execl ^847 1086@6@0@5@0@0@0@g26@6@0@1@g26$@0#execle ^848 1088@6@0@5@0@0@0@g26@6@0@1@g26$@0#execlp ^849 1092@6@0@5@0@0@0@g26@6@0@1@g26$@0#execv ^850 1094@6@0@5@0@0@0@g26@6@0@1@g26$@0#execve ^851 1096@6@0@5@0@0@0@g26@6@0@1@g26$@0#execvp ^852 1098$@0@s3,g26@6@0@1@s3,g26$@0#fork ^853 1100$@0@g26@6@0@1@g26$@0#fpathconf ^854 1103@6@5@1@0@0@0@g26@6@0@1@g26,tp0$@0#getcwd ^855 1105$^$@0#getegid ^856 1107$^$@0#geteuid ^857 1109$^$@0#getgid ^858 1112$@0@g26@6@0@1@g26,ap1$@0#getgroups ^859 1115$^@19@3@0#getlogin ^860 1117$^$@0#getpgrp ^861 1119$^$@0#getpid ^862 1121$^$@0#getppid ^863 1123$^$@0#getuid ^864 1125$^$@0#isatty ^865 1127$@0@g26@6@0,s3@1@g26,s3$@0#link ^866 1129$@0@g26@6@0@1@g26$@0#lseek ^867 1131$@0@g26@6@0@1@g26$@0#pathconf ^868 1133$@0@g26@6@0@1@g26$@0#pause ^869 1135$@0@g26@6@0@1@g26$@0#pipe ^870 1137$@0@g26@6@0@1@g26,tp1$@0#read ^871 1139$@0@s3,g26@6@0@1@s3,g26$@0#rmdir ^872 1141$@0@g26@6@0,s3@1@g26,s3$@0#setgid ^873 1143$@0@g26@6@0,s3@1@g26,s3$@0#setpgid ^874 1145$@0@s3@1@s3$@0#setsid ^875 1147$@0@g26@6@0,s3@1@g26,s3$@0#setuid ^876 1149$@0@s3@1@s3$@0#sleep ^877 1151$@0@g26@6@0@1@g26$@0#sysconf ^878 1153$@0@g26@6@0@1@g26$@0#tcgetpgrp ^879 1155$@0@g26@6@0,s3@1@g26,s3$@0#tcsetpgrp ^880 1158@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#ttyname ^881 1160$@0@s3,g26@6@0@1@s3,g26$@0#unlink ^882 1162$@0@g26@6@0@1@g26$@0#write *7 (Struct tag) ^883 1163@1164#@utimbuf *4 (Function) ^884 1167$@0@s3,g26@6@0@1@s3,g26$@0#utime *0 (Datatype) ^885 20@a@+@0@0@0@0@1168#regex_t ^886 13@-@-@0@0@0@0@1169#regoff_t *7 (Struct tag) ^887 1170@1171#@!7 *0 (Datatype) ^888 1170@-@-@0@0@0@0@1172#regmatch_t *4 (Function) ^889 1175$@0@@1@p0$@0#regcomp ^890 1178$@0@@1@p3$@0#regexec ^891 1180$@0@@1@p2$@0#regerror ^892 1182$$$@0#regfree *1 (Constant) ^893 5$#REG_BASIC#REG_EXTENDED#REG_ICASE#REG_NOSUB#REG_NEWLINE#REG_NOSPEC#REG_PEND#REG_DUMP#REG_NOMATCH#REG_BADPAT#REG_ECOLLATE#REG_ECTYPE#REG_EESCAPE#REG_ESUBREG#REG_EBRACK#REG_EPAREN#REG_EBRACE#REG_BADBR#REG_ERANGE#REG_ESPACE#REG_BADRPT#REG_EMPTY#REG_ASSERT#REG_INVARG#REG_ATOI#REG_ITOA#REG_NOTBOL#REG_NOTEOL#REG_STARTEND#REG_TRACE#REG_LARGE#REG_BACKR ;; Library constraints start_Buffer_Constraints setvbuf pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 3 e2 2 3 -1 ;; end precondition constraints post:EMPTY snprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY vsnprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY fgets pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 0 C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints fread pre:EMPTY post: C 0@1@4 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints fwrite pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY fgetpos pre: C 0@1@3 l 1 1 2 2 Param 460 1 r 2 3 0 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 460 1 r 2 3 0 ;; end precondition constraints calloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints malloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints realloc pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints memcpy pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memmove pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY strcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@4 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints strncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints strcat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 3 2 2 Result r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints strncat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints strchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strrchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strstr pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints memset pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints strlen pre:EMPTY post: C 0@1@4 l 2 2 Result r 1 3 2 2 Param 23 0 ;; end precondition constraints asctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints getpwnam pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getpwuid pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getcwd pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints read pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints write pre: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regexec pre: C 0@1@3 l 1 1 2 2 Param 1176 3 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regerror pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 64 3 ;; end precondition constraints post:EMPTY ;; Modules access _Bool#1@ types#1@ standard#9@ posix#18@ ;;End splint-3.1.2.dfsg1/lib/posixstrict.lcd0000644021234200000250000014511010645776247015314 0ustar fax;;; Splint Library posixstrict.lcd ;;Splint 3.018000 ;;lib:310 ;;ctTable 0 u-2 19 38 0 p1|-2 20 39 0 b-2 21 40 0 p3|-2 22 41 0 p4|-2 23 42 0 p5|-2 24 43 0 p6|-2 25 44 0 p7|-2 26 45 0 p8|-2 27 46 0 p9|-2 28 47 0 p10|-2 29 48 0 p11|-2 30 49 0 p12|-2 31 50 0 p13|-2 32 51 0 p14|-2 33 52 0 p15|-2 34 53 0 p16|-2 35 54 0 p17|-2 36 55 0 p18|-2 37 56 1 t0|0 460 1051 1 t1|1& 1 t2|2& 1 t3|3& 1 t4|4 461 1052 1 t5|5& 1 t6|6& 1 t7|7& 1 t8|8& 1 t9|9& 1 t10|10& 1 t11|11& 1 t12|12& 1 t13|13& 1 t14|14& 1 t15|15& 1 t16|16& 1 t17|17& 1 t18|18& 2 y0|0& 2 y1|1& 2 y2|2& 2 y3|3& 2 y4|4& 2 y5|5& 2 y6|6& 2 y7|7& 2 y8|8& 2 y9|9& 2 y10|10& 2 y11|11& 2 y12|12& 2 y13|13& 2 y14|14& 2 y15|15& 2 y16|16& 2 y17|17& 2 y18|18& -2 ?! 0 a0|& 0 s11|& 0 s12|& 0 s13|& 0 s27|& 0 s29|& 0 s30|& 0 s31|& 0 s32|-1 529 -1 0 s33|& 0 a34|-1 547 -1 3 C0.5/20|! 3 C0.69/2|! 3 f0 (2|@7|$#,)! 3 f1 (2|@7|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f4 (5|$#,)! 3 f0 (5|$#,)! 3 f4 (5|$#,)! 3 Slconv{23|@1|0@0@3&#decimal_point,23|@1|0@0@3&#thousands_sep,23|@1|0@0@3&#grouping,23|@1|0@0@3&#int_curr_symbol,23|@1|0@0@3&#currency_symbol,23|@1|0@0@3&#mon_decimal_point,23|@1|0@0@3&#mon_thousands_sep,23|@1|0@0@3&#mon_grouping,23|@1|0@0@3&#positive_sign,23|@1|0@0@3&#negative_sign,4|@1|^#int_frac_digits,4|@1|^#frac_digits,4|@1|^#p_cs_precedes,4|@1|^#p_sep_by_space,4|@1|^#n_cs_precedes,4|@1|^#n_sep_by_space,4|@1|^#p_sign_posn,4|@1|^#n_sign_posn,}! 0 s51|-1 106 -1 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f23 (5|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 1 t100|100& 3 f106 ()! 0 s106|& 0 s107|& 3 C0.17/18|! 3 C0.16/110|! 0 s121|& 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,24|4@0@7&#,)! 3 f17 (17|$#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,36|4@0@7&#,)! 3 f17 (17|$#,36|4@0@7&#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,9|$#,)! 3 f17 (17|$#,9|$#,)! 3 f0 (18|$#,9|$#,)! 3 f18 (18|$#,9|$#,)! 3 f0 (17|$#,)! 3 f5 (17|$#,)! 3 f0 (16|$#,)! 3 f5 (16|$#,)! 3 f0 (18|$#,)! 3 f5 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (16|$#,)! 3 f9 (16|$#,)! 3 f0 (18|$#,)! 3 f9 (18|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (16|$#,)! 3 f11 (16|$#,)! 3 f0 (18|$#,)! 3 f11 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,24|4@0@7&#,)! 3 f17 (17|$#,17|$#,24|4@0@7&#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,18|$#,)! 3 f17 (17|$#,18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,17|$#,)! 3 f17 (17|$#,17|$#,17|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 0 a224|& 3 f0 (317|4@0@7&#,)! 3 f5 (317|4@0@7&#,)! 3 f0 (317|$#,5|$#,)! 3 f1 (317|$#,5|$#,)! 0 s233|& 3 ?! 3 f323 (5|$#,)! 3 f1 (5|$#,)^326 1 t325|325& 3 ?! 3 f327 (5|$#,)! 3 f1 (5|$#,)^330 1 t329|329& 3 ?! 3 f331 (5|$#,)! 3 f1 (5|$#,)^334 1 t333|333& 3 ?! 3 f335 (5|$#,)! 3 f1 (5|$#,)^338 1 t337|337& 3 f0 (5|$#,338|0@5@7&#,)! 3 f19 (5|$#,338|0@5@7&#,)^341 1 t340|340& 3 ?! 3 f342 (5|$#,)! 3 f19 (5|$#,)! 3 f1 (5|$#,338|0@5@7&#,)! 3 f1 (5|$#,)! 3 f346 (5|$#,338|0@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 a239|& 3 f0 (350|4@0@7&#,!.,)! 3 f1 (350|4@0@7&#,!.,)! 3 f0 (350|$#,)! 3 f1 (350|$#,)! 3 f0 (350|4@0@7&#,350|$#,)! 3 f1 (350|4@0@7&#,350|$#,)! 0 a243|-1 359 -1 0 a244|-1 435 -1 1 t357|357& 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f19 ()! 3 f359 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|0@5@7&#,)! 3 f5 (359|0@5@7&#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f359 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,359|$#,)! 3 f19 (23|$#,23|$#,359|$#,)! 3 f359 (23|$#,23|$#,359|$#,)! 3 f0 (359|$#,23|4@5@19@2@0#,)! 3 f1 (359|$#,23|4@5@19@2@0#,)! 3 f0 (359|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f5 (359|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f0 (359|$#,23|$#,!.,)! 3 f5 (359|$#,23|$#,!.,)! 3 f0 (359|$#,23|$#,!.,)! 3 f5 (359|$#,23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|$#,350|$#,)! 3 f5 (23|$#,350|$#,)! 3 f0 (359|$#,23|$#,350|$#,)! 3 f5 (359|$#,23|$#,350|$#,)! 3 f0 (23|4@0@7&#,23|$#,350|$#,)! 3 f5 (23|4@0@7&#,23|$#,350|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,350|$#,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,350|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 f19 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 f23 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 C0.5/4|! 3 f0 (411|$#,359|$#,)! 3 f5 (411|$#,359|$#,)! 3 f0 (23|$#,359|$#,)! 3 f5 (23|$#,359|$#,)! 3 f0 (359|@7|$#,)! 3 f5 (359|@7|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|4@0@7&#,)! 3 f19 (23|4@0@7&#,)! 3 f23 (23|4@0@7&#,)! 3 f0 (411|$#,359|@7|$#,)! 3 f5 (411|$#,359|@7|$#,)! 3 f0 (411|$#,)! 3 f5 (411|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (411|$#,359|$#,)! 3 f5 (411|$#,359|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f0 (20|$#,64|$#,64|$#,359|$#,)! 3 f64 (20|$#,64|$#,64|$#,359|$#,)! 1 t358|358& 3 f0 (359|$#,435|4@0@7&#,)! 3 f5 (359|$#,435|4@0@7&#,)! 3 f0 (359|$#,9|$#,5|$#,)! 3 f5 (359|$#,9|$#,5|$#,)! 3 f0 (359|$#,435|$#,)! 3 f5 (359|$#,435|$#,)! 3 f0 (359|$#,)! 3 f9 (359|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (23|0@5@7&#,)! 3 f1 (23|0@5@7&#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 1 t19|19& 1 t23|23& 3 f0 (23|$#,461|4@5@7&#,)! 3 f17 (23|$#,461|4@5@7&#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f9 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f10 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (20|4@5@2&#,)! 3 f1 (20|4@5@2&#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 ?! 3 f487 ()! 3 f1 ()^490 1 t489|489& 3 f0 (490|$#,)! 3 f5 (490|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 ?! 3 f498 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^501 1 t500|500& 3 f0 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 ?! 3 f505 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^508 1 t507|507& 3 f0 (20|$#,64|$#,64|$#,508|$#,)! 3 f1 (20|$#,64|$#,64|$#,508|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 S!2{5|@1|^#quot,5|@1|^#rem,}! 0 s324|& 0 s325|& 3 f0 (5|$#,5|$#,)! 3 f515 (5|$#,5|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 3 S!3{9|@1|^#quot,9|@1|^#rem,}! 0 s328|& 0 s329|& 3 f0 (9|$#,9|$#,)! 3 f522 (9|$#,9|$#,)! 3 f0 (5|$#,)! 3 f67 (5|$#,)! 3 f0 (359|$#,)! 3 f67 (359|$#,)! 1 t66|66 611 -1 3 f0 (529|@5|$#,5|$#,359|$#,)! 3 f19 (529|@5|$#,5|$#,359|$#,)! 3 f529 (529|@5|$#,5|$#,359|$#,)! 3 f0 (66|$#,359|$#,)! 3 f67 (66|$#,359|$#,)! 3 f0 (529|$#,359|$#,)! 3 f5 (529|$#,359|$#,)! 3 f0 (359|$#,5|$#,)! 3 f5 (359|$#,5|$#,)! 3 f0 (359|$#,529|$#,!.,)! 3 f5 (359|$#,529|$#,!.,)! 3 f0 (359|$#,529|$#,!.,)! 3 f5 (359|$#,529|$#,!.,)! 3 f0 (359|@7|$#,)! 3 f67 (359|@7|$#,)! 3 f0 ()! 3 f67 ()! 1 t68|68& 3 f0 (23|$#,64|$#,547|0@5@7&#,)! 3 f64 (23|$#,64|$#,547|0@5@7&#,)! 3 f0 (529|0@5@7&#,23|$#,64|$#,547|0@5@7&#,)! 3 f64 (529|0@5@7&#,23|$#,64|$#,547|0@5@7&#,)! 3 f0 (547|0@5@7&#,)! 3 f5 (547|0@5@7&#,)! 3 f0 (529|0@5@7&#,461|$#,64|$#,547|0@5@7&#,)! 3 f64 (529|0@5@7&#,461|$#,64|$#,547|0@5@7&#,)! 3 f0 (66|$#,359|@7|$#,)! 3 f67 (66|$#,359|@7|$#,)! 3 f0 (66|$#,)! 3 f67 (66|$#,)! 3 f0 (529|$#,64|$#,529|$#,!.,)! 3 f5 (529|$#,64|$#,529|$#,!.,)! 3 f0 (529|$#,529|$#,!.,)! 3 f5 (529|$#,529|$#,!.,)! 3 f0 (67|$#,359|$#,)! 3 f67 (67|$#,359|$#,)! 3 f0 (359|$#,529|$#,350|$#,)! 3 f5 (359|$#,529|$#,350|$#,)! 3 f0 (529|$#,64|$#,529|$#,350|$#,)! 3 f5 (529|$#,64|$#,529|$#,350|$#,)! 3 f0 (529|$#,350|$#,)! 3 f5 (529|$#,350|$#,)! 3 f0 (23|4@5@7&#,66|$#,547|0@5@7&#,)! 3 f64 (23|4@5@7&#,66|$#,547|0@5@7&#,)! 3 C0.1/529|! 3 f0 (529|@5|4@0@9&#,529|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,)! 3 f574 (529|@5|4@0@9&#,529|$#,)! 3 f0 (529|@5|$#,66|$#,)! 3 f19 (529|@5|$#,66|$#,)! 3 f529 (529|@5|$#,66|$#,)! 3 f0 (529|$#,529|$#,)! 3 f5 (529|$#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f5 (529|$#,529|$#,)! 3 f0 (529|@5|4@0@9&#,529|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,)! 3 f574 (529|@5|4@0@9&#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f64 (529|$#,529|$#,)! 0 s364|-1 591 -1 1 t590|590& 3 f0 (529|4@0@7&#,64|$#,529|$#,591|$#,)! 3 f64 (529|4@0@7&#,64|$#,529|$#,591|$#,)! 3 f0 (529|$#,)! 3 f64 (529|$#,)! 3 C0.1/529|! 3 f0 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f596 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f0 (529|$#,529|$#,64|$#,)! 3 f5 (529|$#,529|$#,64|$#,)! 3 f0 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f596 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,)! 3 f19 (529|@5|$#,529|$#,)! 3 f529 (529|@5|$#,529|$#,)! 3 f0 (529|@5|$#,66|$#,)! 3 f19 (529|@5|$#,66|$#,)! 3 f529 (529|@5|$#,66|$#,)! 1 t529|529& 3 f0 (23|0@5@7&#,611|$#,64|$#,547|0@5@7&#,)! 3 f64 (23|0@5@7&#,611|$#,64|$#,547|0@5@7&#,)! 3 f0 (529|$#,529|$#,)! 3 f64 (529|$#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f19 (529|$#,529|$#,)! 3 f529 (529|$#,529|$#,)! 3 f0 (529|$#,611|0@5@7&#,)! 3 f17 (529|$#,611|0@5@7&#,)! 3 f0 (529|0@5@7&#,529|$#,611|$#,)! 3 f19 (529|0@5@7&#,529|$#,611|$#,)! 3 f529 (529|0@5@7&#,529|$#,611|$#,)! 3 f0 (529|$#,611|0@5@7&#,5|$#,)! 3 f9 (529|$#,611|0@5@7&#,5|$#,)! 3 f0 (529|$#,611|0@5@7&#,5|$#,)! 3 f10 (529|$#,611|0@5@7&#,5|$#,)! 3 f0 (529|0@5@7&#,529|$#,64|$#,)! 3 f64 (529|0@5@7&#,529|$#,64|$#,)! 3 f0 (67|$#,)! 3 f5 (67|$#,)! 3 f0 (529|$#,66|$#,64|$#,)! 3 f19 (529|$#,66|$#,64|$#,)! 3 f529 (529|$#,66|$#,64|$#,)! 3 f0 (529|$#,529|$#,64|$#,)! 3 f5 (529|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,64|$#,)! 3 f19 (529|@5|$#,529|$#,64|$#,)! 3 f529 (529|@5|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,64|$#,)! 3 f19 (529|@5|$#,529|$#,64|$#,)! 3 f529 (529|@5|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,66|$#,64|$#,)! 3 f19 (529|@5|$#,66|$#,64|$#,)! 3 f529 (529|@5|$#,66|$#,64|$#,)! 3 f0 (529|$#,!.,)! 3 f5 (529|$#,!.,)! 3 f0 (529|$#,!.,)! 3 f5 (529|$#,!.,)! 0 s388|& 0 s389|& 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,650|$#,)! 3 f2 (67|$#,650|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,651|$#,)! 3 f67 (67|$#,651|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f0 (23|$#,)! 3 f651 (23|$#,)! 3 f0 (23|$#,)! 3 f650 (23|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (529|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (529|0@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! 3 f0 (529|4@0@7&#,23|$#,64|$#,)! 3 f64 (529|4@0@7&#,23|$#,64|$#,)! 3 f0 (23|4@0@7&#,529|$#,64|$#,)! 3 f64 (23|4@0@7&#,529|$#,64|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f696 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f0 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f696 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 C0.1/23|! 3 f0 (23|@5|4@0@9&#,23|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,)! 3 f703 (23|@5|4@0@9&#,23|$#,)! 3 f0 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f703 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,)! 3 f703 (23|@5|0@0@9&#,23|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f703 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f0 (20|$#,20|$#,64|$#,)! 3 f5 (20|$#,20|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (23|4@5@7&#,23|$#,64|$#,)! 3 f64 (23|4@5@7&#,23|$#,64|$#,)! 3 f0 (20|$#,5|$#,64|$#,)! 3 f19 (20|$#,5|$#,64|$#,)! 3 f20 (20|$#,5|$#,64|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|0@5@7&#,23|$#,)! 3 f19 (23|@5|0@5@7&#,23|$#,)! 3 f23 (23|@5|0@5@7&#,23|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f748 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f64 (23|$#,)! 0 s435|& 0 s436|-1 766 -1 3 Stm{5|@1|^#tm_sec,5|@1|^#tm_min,5|@1|^#tm_hour,5|@1|^#tm_mday,5|@1|^#tm_mon,5|@1|^#tm_year,5|@1|^#tm_wday,5|@1|^#tm_yday,5|@1|^#tm_isdst,}! 3 f0 ()! 3 f757 ()! 3 f0 (758|$#,758|$#,)! 3 f17 (758|$#,758|$#,)! 3 f0 (591|$#,)! 3 f758 (591|$#,)! 1 t758|758& 3 f0 (766|4@5@7&#,)! 3 f758 (766|4@5@7&#,)! 3 f0 (591|$#,)! 3 f19 (591|$#,)! 3 f23 (591|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f23 (766|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f591 (766|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f591 (766|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,591|$#,)! 3 f64 (23|4@0@7&#,64|$#,23|$#,591|$#,)! 0 s446|& 0 s447|& 0 s448|& 0 s449|& 0 s450|& 0 s451|& 0 s452|& 0 s453|& 0 s454|& 0 s455|& 0 s456|& 0 s457|& 0 s458|& 0 s459|& 0 s460|& 0 s461|& 0 s462|& 0 s463|& 0 s464|& 0 s465|& 0 s466|& 0 s467|& 0 s468|& 0 s469|& 0 s470|& 0 s471|& 0 s472|& 0 s473|& 0 s512|& 0 s513|-1 -1 1072 0 s514|& 0 s515|& 0 s516|& 0 s517|& 0 s518|& 0 s519|& 0 a520|-1 822 -1 3 Sdirent{42|@1|^#d_name,}! 0 s521|-1 830 -1 1 t819|819& 3 f0 (822|$#,)! 3 f5 (822|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f822 (23|$#,)! 3 f0 (822|$#,)! 3 f19 (822|$#,)! 1 t821|821& 3 f830 (822|$#,)! 3 f0 (822|$#,)! 3 f1 (822|$#,)! 3 Sflock{7|@1|^#l_type,7|@1|^#l_whence,816|@1|^#l_start,816|@1|^#l_len,817|@1|^#l_pid,}! 0 s606|& 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 3 f0 (5|$#,5|$#,!.,)! 3 f5 (5|$#,5|$#,!.,)! 3 f0 (23|$#,5|$#,!.,)! 3 f5 (23|$#,5|$#,!.,)! 3 Sgroup{23|@1|0@0@3&#gr_name,812|@1|^#gr_gid,461|@1|0@0@3&#gr_mem,}! 0 s610|-1 846 -1 3 f0 (812|$#,)! 3 f19 (812|$#,)! 1 t843|843& 3 f846 (812|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f846 (23|$#,)! 3 Spasswd{23|@1|0@0@3&#pw_name,818|@1|^#pw_uid,812|@1|^#pw_gid,23|@1|0@0@3&#pw_dir,23|@1|0@0@3&#pw_shell,}! 0 s639|-1 855 -1 3 f0 (23|$#,)! 3 f19 (23|$#,)! 1 t852|852& 3 f855 (23|$#,)! 3 f0 (818|$#,)! 3 f19 (818|$#,)! 3 f855 (818|$#,)! 0 a642|& 3 f0 (860|$#,5|$#,)! 3 f1 (860|$#,5|$#,)! 3 f0 (860|4@0@7&#,5|$#,)! 3 f5 (860|4@0@7&#,5|$#,)! 0 a645|-1 912 -1 3 S!4{20|@1|0@0@3&#ss_sp,64|@1|^#ss_size,5|@1|^#ss_flags,}! 0 s646|& 0 s647|& 0 a648|& 0 s649|-1 871 -1 1 t870|870& 3 Ss_ucontext_t{871|@1|0@5@3&#uc_link,865|@1|0@0@3&#uc_sigmask,868|@1|^#uc_stack,869|@1|0@0@3&#uc_mcontext,}! 0 s650|-1 874 -1 1 t873|873& 3 f0 (874|$#,)! 3 f5 (874|$#,)! 3 f0 (874|$#,)! 3 f5 (874|$#,)! 3 ?! 3 f879 ()! 3 f1 ()^882 1 t881|881& 3 f0 (874|$#,882|$#,5|$#,!.,)! 3 f1 (874|$#,882|$#,5|$#,!.,)! 3 f0 (874|$#,874|$#,)! 3 f5 (874|$#,874|$#,)! 3 Ssigstack{5|@1|^#ss_onstack,20|@1|0@0@3&#ss_sp,}! 0 s672|& 0 s673|& 3 S!5{5|@1|^#si_signo,5|@1|^#si_errno,5|@1|^#si_code,817|@1|^#si_pid,818|@1|^#si_uid,20|@1|0@0@3&#si_addr,5|@1|^#si_status,9|@1|^#si_band,889|@1|0@0@3&#si_value,}! 0 s674|& 0 s675|-1 901 -1 3 U!6{5|@1|^#sival_int,20|@1|0@0@3&#sival_ptr,}! 0 s676|& 0 s677|& 3 ?! 3 f896 ()! 3 f1 ()^899 1 t898|898& 3 ?! 1 t892|892& 3 f900 (5|$#,901|$#,20|$#,)! 3 f1 (5|$#,901|$#,20|$#,)^904 1 t903|903& 3 Ssigaction{!899$$$@0#sa_handler,865|@1|0@0@3&#sa_mask,5|@1|^#sa_flags,!904$$$@0#sa_sigaction,}! 0 s678|-1 909 -1 3 f0 (817|$#,5|$#,)! 3 f5 (817|$#,5|$#,)! 1 t906|906& 3 f0 (5|$#,909|$#,909|4@5@7&#,)! 3 f5 (5|$#,909|$#,909|4@5@7&#,)! 1 t865|865& 3 f0 (912|$#,5|$#,)! 3 f5 (912|$#,5|$#,)! 3 f0 (912|$#,5|$#,)! 3 f5 (912|$#,5|$#,)! 3 f0 (912|4@0@7&#,)! 3 f5 (912|4@0@7&#,)! 3 f0 (912|4@0@7&#,)! 3 f5 (912|4@0@7&#,)! 3 f0 (912|$#,5|$#,)! 3 f5 (912|$#,5|$#,)! 3 f0 (912|4@0@7&#,)! 3 f5 (912|4@0@7&#,)! 3 f0 (5|$#,912|0@5@7&#,912|4@5@7&#,)! 3 f5 (5|$#,912|0@5@7&#,912|4@5@7&#,)! 3 f0 (912|$#,)! 3 f5 (912|$#,)! 3 f0 (5|$#,23|$#,)! 3 f19 (5|$#,23|$#,)! 3 f359 (5|$#,23|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 Sstat{814|@1|^#st_mode,813|@1|^#st_ino,811|@1|^#st_dev,815|@1|^#st_nlink,818|@1|^#st_uid,812|@1|^#st_gid,816|@1|^#st_size,758|@1|^#st_atime,758|@1|^#st_mtime,758|@1|^#st_ctime,}! 0 s693|-1 954 -1 3 C0.2/5|! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 1 t935|935& 3 f0 (5|$#,954|4@0@7&#,)! 3 f5 (5|$#,954|4@0@7&#,)! 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 3 f0 (23|$#,954|4@0@7&#,)! 3 f5 (23|$#,954|4@0@7&#,)! 3 f0 (814|$#,)! 3 f5 (814|$#,)! 3 Stms{757|@1|^#tms_utime,757|@1|^#tms_stime,757|@1|^#tms_cutime,757|@1|^#tms_cstime,}! 0 s705|-1 967 -1 1 t966|966& 3 f0 (967|4@0@7&#,)! 3 f757 (967|4@0@7&#,)! 3 Sutsname{42|@1|^#sysname,42|@1|^#nodename,42|@1|^#release,42|@1|^#version,42|@1|^#machine,}! 0 s707|-1 972 -1 1 t971|971& 3 f0 (972|4@0@7&#,)! 3 f5 (972|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (24|4@5@7&#,)! 3 f817 (24|4@5@7&#,)! 3 f0 (817|$#,24|4@5@7&#,5|$#,)! 3 f817 (817|$#,24|4@5@7&#,5|$#,)! 3 C0.4/8|! 3 C0.3/8|! 0 s720|& 3 C0.9/9|! 3 C0.10/9|! 0 s721|& 0 s722|& 3 Stermios{997|@1|^#c_iflag,997|@1|^#c_oflag,997|@1|^#c_cflag,997|@1|^#c_lflag,993|@1|^#c_cc,}! 0 s791|-1 1000 -1 1 t999|999& 3 f0 (1000|$#,)! 3 f996 (1000|$#,)! 3 f0 (1000|$#,)! 3 f996 (1000|$#,)! 3 f0 (1000|$#,)! 3 f5 (1000|$#,)! 3 f0 (1000|$#,)! 3 f5 (1000|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,1000|4@0@7&#,)! 3 f5 (5|$#,1000|4@0@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,1000|$#,)! 3 f5 (5|$#,5|$#,1000|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,818|$#,812|$#,)! 3 f5 (23|$#,818|$#,812|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|4@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 2 y19|19& 2 y23|23& 3 f0 (23|$#,1052|$#,)! 3 f5 (23|$#,1052|$#,)! 3 f0 (23|$#,1052|$#,461|$#,)! 3 f5 (23|$#,1052|$#,461|$#,)! 3 f0 (23|$#,1052|$#,)! 3 f5 (23|$#,1052|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (5|$#,5|$#,)! 3 f9 (5|$#,5|$#,)! 3 f0 (23|@5|4@2@7&#,64|$#,)! 3 f19 (23|@5|4@2@7&#,64|$#,)! 3 f23 (23|@5|4@2@7&#,64|$#,)! 3 f0 ()! 3 f812 ()! 3 f0 ()! 3 f818 ()! 3 f0 ()! 3 f812 ()! 2 y812|812& 3 f0 (5|$#,1072|4@0@7&#,)! 3 f5 (5|$#,1072|4@0@7&#,)! 3 f0 ()! 3 f19 ()! 3 f23 ()! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f818 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (5|$#,816|$#,5|$#,)! 3 f816 (5|$#,816|$#,5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f9 (23|$#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (43|4@0@7&#,)! 3 f5 (43|4@0@7&#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (812|$#,)! 3 f5 (812|$#,)! 3 f0 (817|$#,817|$#,)! 3 f5 (817|$#,817|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (818|$#,)! 3 f5 (818|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (5|$#,)! 3 f9 (5|$#,)! 3 f0 (5|$#,)! 3 f817 (5|$#,)! 3 f0 (5|$#,817|$#,)! 3 f5 (5|$#,817|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (5|$#,20|$#,64|$#,)! 3 f65 (5|$#,20|$#,64|$#,)! 3 Sutimbuf{758|@1|^#actime,758|@1|^#modtime,}! 0 s883|-1 1127 -1 1 t1126|1126& 3 f0 (23|$#,1127|0@5@7&#,)! 3 f5 (23|$#,1127|0@5@7&#,)! 0 a885|-1 1135 -1 0 s886|& 3 S!7{1131|@1|^#rm_so,1131|@1|^#rm_eo,}! 0 s887|& 0 s888|-1 -1 1138 1 t1130|1130& 3 f0 (1135|4@0@7&#,23|$#,5|$#,)! 3 f5 (1135|4@0@7&#,23|$#,5|$#,)! 2 y1134|1134& 3 f0 (1135|$#,23|$#,64|$#,1138|4@0@7&#,5|$#,)! 3 f5 (1135|$#,23|$#,64|$#,1138|4@0@7&#,5|$#,)! 3 f0 (5|$#,1135|$#,23|4@0@7&#,64|$#,)! 3 f64 (5|$#,1135|$#,23|4@0@7&#,64|$#,)! 3 f0 (1135|0@0@2&#,)! 3 f1 (1135|0@0@2&#,)! ;;tistable 0 34 34,224 224 34,224,239 239 34,224,239,243 243 34,224,239,243,244 244 520 520,642 642 520,642,645 645 520,642,645,648 648 520,642,645,648,885 885 ;;symTable *0 (Datatype) ^0 2@a@-@0@0@0@0@2#_Bool *1 (Constant) ^1 2@i0@0@6#false ^2 2@i1@0@0#true *11 (GlobalMarker) *1 (Constant) ^4 5$#__LINE__ ^5 23$#__DATE__#__FILE__#__BASE_FILE__#__func__ ^9 5$#__INCLUDE_LEVEL__ ^10 23$#__VERSION__ *0 (Datatype) ^11 13@c@-@0@0@0@0@59#__SIZE_TYPE__ ^12 13@c@-@0@0@0@0@60#__PTRDIFF_TYPE__ ^13 13@c@-@0@0@0@0@61#__WCHAR_TYPE__ *1 (Constant) ^14 23$#__USER_LABEL_PREFIX__#__REGISTER_PREFIX__#__TIME__ ^17 5$#__STDC__#S_SPLINT_S#__LCLINT__#__i686 *3 (Variable) ^21 359|@1|6@0@0@0@2#stdin#stdout *1 (Constant) ^23 5$#EDOM#ERANGE#EILSEQ *3 (Variable) ^26 5|@1|6@0@0@0@4#errno *0 (Datatype) ^27 2@-@-@0@0@0@0@62#bool *1 (Constant) ^28 5@i1@0@0#__bool_true_false_are_defined *0 (Datatype) ^29 13@-@-@0@0@0@0@63#ptrdiff_t ^30 14@-@-@0@0@0@0@64#size_t ^31 15@-@-@0@0@0@0@65#ssize_t ^32 13@-@-@0@0@0@0@66#wchar_t ^33 13@-@-@0@0@0@0@67#wint_t ^34 0@a@=@0@0@0@0@68#mbstate_t *1 (Constant) ^35 0@i0@0@6#NULL ^36 2$#NDEBUG *4 (Function) ^37 72@6@0@8@0@0^$@0#assert ^38 74$^$@0#isalnum ^39 76$^$@0#isalpha ^40 78$^$@0#iscntrl ^41 80$^$@0#isdigit ^42 82$^$@0#isgraph ^43 84$^$@0#islower ^44 86$^$@0#isprint ^45 88$^$@0#ispunct ^46 90$^$@0#isspace ^47 92$^$@0#isupper ^48 94$^$@0#isxdigit ^49 96$^$@0#tolower ^50 98$^$@0#toupper *7 (Struct tag) ^51 99@100#@lconv *1 (Constant) ^52 5$#LC_ALL#LC_COLLATE#LC_CTYPE#LC_MONETARY#LC_NUMERIC#LC_TIME *4 (Function) ^58 103@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@19@3@0#setlocale ^59 107$^@3@0@0#localeconv *3 (Variable) ^60 5|@1|6@0@0@0@1#DBL_DIG ^61 17|@1|6@0@0@0@1#DBL_EPSILON ^62 5|@1|6@0@0@0@1#DBL_MANT_DIG ^63 17|@1|6@0@0@0@1#DBL_MAX ^64 5|@1|6@0@0@0@1#DBL_MAX_10_EXP#DBL_MAX_EXP ^66 17|@1|6@0@0@0@1#DBL_MIN ^67 5|@1|6@0@0@0@1#DBL_MIN_10_EXP#DBL_MIN_EXP#FLT_DIG ^70 16|@1|6@0@0@0@1#FLT_EPSILON ^71 5|@1|6@0@0@0@1#FLT_MANT_DIG ^72 16|@1|6@0@0@0@1#FLT_MAX ^73 5|@1|6@0@0@0@1#FLT_MAX_10_EXP#FLT_MAX_EXP ^75 16|@1|6@0@0@0@1#FLT_MIN ^76 5|@1|6@0@0@0@1#FLT_MIN_10_EXP#FLT_MIN_EXP *1 (Constant) ^78 5$#FLT_RADIX *3 (Variable) ^79 5|@1|6@0@0@0@1#FLT_ROUNDS#LDBL_DIG ^81 18|@1|6@0@0@0@1#LDBL_EPSILON ^82 5|@1|6@0@0@0@1#LDBL_MANT_DIG ^83 18|@1|6@0@0@0@1#LDBL_MAX ^84 5|@1|6@0@0@0@1#LDBL_MAX_10_EXP#LDBL_MAX_EXP ^86 18|@1|6@0@0@0@1#LDBL_MIN ^87 5|@1|6@0@0@0@1#LDBL_MIN_10_EXP#LDBL_MIN_EXP *1 (Constant) ^89 5$#CHAR_BIT ^90 4$#CHAR_MAX#CHAR_MIN ^92 5$#INT_MAX#INT_MIN ^94 9$#LONG_MAX#LONG_MIN#MB_LEN_MAX ^97 4$#SCHAR_MAX#SCHAR_MIN ^99 7$#SHRT_MAX#SHRT_MIN ^101 3$#UCHAR_MAX#UCHAR_MIN ^103 6$#UINT_MAX ^104 10$#ULONG_MAX ^105 8$#USHRT_MAX *0 (Datatype) ^106 16@-@-@0@0@0@0@108#float_t ^107 17@-@-@0@0@0@0@109#double_t *1 (Constant) ^108 17$#HUGE_VAL ^109 16$#HUGE_VALF ^110 18$#HUGE_VALL ^111 16$#INFINITY#NAN ^113 5$#FP_INFINITE#FP_NAN#FP_NORMAL#FP_SUBNORMAL#FP_ZERO#FP_ILOGB0#FP_ILOGBNAN#DECIMAL_DIG *0 (Datatype) ^121 111@-@-@0@0@0@0@112#s_real_t *4 (Function) ^122 114$^$@0#fpclassify ^123 116$^$@0#signbit ^124 118$^$@0#isfinite ^125 120$^$@0#isnormal ^126 122$^$@0#isnan ^127 124$^$@0#isinf ^128 126$@0@g26@6@0@1@g26$@0#acos ^129 128$@0@g26@6@0@1@g26$@0#asin ^130 130$^$@0#atan ^131 132$^$@0#atan2 ^132 134$^$@0#cos ^133 136$^$@0#sin ^134 138$^$@0#tan ^135 140$@0@g26@6@0@1@g26$@0#cosh ^136 142$@0@g26@6@0@1@g26$@0#sinh ^137 144$^$@0#tanh ^138 146$@0@g26@6@0@1@g26$@0#acosh ^139 148$@0@g26@6@0@1@g26$@0#asinh ^140 150$@0@g26@6@0@1@g26$@0#atanh ^141 152$@0@g26@6@0@1@g26$@0#exp ^142 154$@0@@1@tp1$@0#frexp ^143 156$@0@g26@6@0@1@g26$@0#ldexp ^144 158$@0@g26@6@0@1@g26$@0#log ^145 160$@0@g26@6@0@1@g26$@0#log10 ^146 162$@0@@1@tp1$@0#modf ^147 164$@0@g26@6@0@1@g26$@0#exp2 ^148 166$@0@g26@6@0@1@g26$@0#expm1 ^149 168$@0@g26@6@0@1@g26$@0#log1p ^150 170$@0@g26@6@0@1@g26$@0#log2 ^151 172$@0@g26@6@0@1@g26$@0#logb ^152 174$@0@g26@6@0@1@g26$@0#scalbn ^153 176$@0@g26@6@0@1@g26$@0#scalbln ^154 178$@0@g26@6@0@1@g26$@0#scalblnl ^155 180$@0@g26@6@0@1@g26$@0#ilogb ^156 182$@0@g26@6@0@1@g26$@0#ilogbf ^157 184$@0@g26@6@0@1@g26$@0#ilogbl ^158 186$^$@0#fabs ^159 188$^$@0#fabsf ^160 190$^$@0#fabsl ^161 192$@0@g26@6@0@1@g26$@0#pow ^162 194$@0@g26@6@0@1@g26$@0#powf ^163 196$@0@g26@6@0@1@g26$@0#powl ^164 198$@0@g26@6@0@1@g26$@0#sqrt ^165 200$@0@g26@6@0@1@g26$@0#sqrtf ^166 202$@0@g26@6@0@1@g26$@0#sqrtl ^167 204$^$@0#cbrt ^168 206$^$@0#cbrtf ^169 208$^$@0#cbrtl ^170 210$@0@g26@6@0@1@g26$@0#hypot ^171 212$@0@g26@6@0@1@g26$@0#hypotf ^172 214$@0@g26@6@0@1@g26$@0#hypotl ^173 216$^$@0#erf ^174 218$^$@0#erfc ^175 220$^$@0#erff ^176 222$^$@0#erfl ^177 224$^$@0#erfcf ^178 226$^$@0#erfcl ^179 228$@0@g26@6@0@1@g26$@0#gamma ^180 230$@0@g26@6@0@1@g26$@0#gammaf ^181 232$@0@g26@6@0@1@g26$@0#gammal ^182 234$@0@g26@6@0@1@g26$@0#lgamma ^183 236$@0@g26@6@0@1@g26$@0#lgammaf ^184 238$@0@g26@6@0@1@g26$@0#lgammal ^185 240$^$@0#ceil ^186 242$^$@0#ceilf ^187 244$^$@0#ceill ^188 246$^$@0#floor ^189 248$^$@0#floorf ^190 250$^$@0#floorl ^191 252$^$@0#nearbyint ^192 254$^$@0#nearbyintf ^193 256$^$@0#nearbyintl ^194 258$^$@0#rint ^195 260$^$@0#rintf ^196 262$^$@0#rintl ^197 264$@0@g26@6@0@1@g26$@0#lrint ^198 266$@0@g26@6@0@1@g26$@0#lrintf ^199 268$@0@g26@6@0@1@g26$@0#lrintl ^200 270$@0@g26@6@0@1@g26$@0#llrint ^201 272$@0@g26@6@0@1@g26$@0#llrintf ^202 274$@0@g26@6@0@1@g26$@0#llrintl ^203 276$^$@0#round ^204 278$@0@g26@6@0@1@g26$@0#lround ^205 280$@0@g26@6@0@1@g26$@0#llround ^206 282$^$@0#trunc ^207 284$^$@0#fmod ^208 286$^$@0#remainder ^209 288$@0@@1@tp2$@0#remquo ^210 290$^$@0#copysign ^211 292$^$@0#nan ^212 294$^$@0#nextafter ^213 296$^$@0#nextafterx ^214 298$@0@g26@6@0@1@g26$@0#fdim ^215 300$^$@0#fmax ^216 302$^$@0#fmin ^217 304$^$@0#fma ^218 306$^$@0#isgreater ^219 308$^$@0#isgreaterequal ^220 310$^$@0#isless ^221 312$^$@0#islessequal ^222 314$^$@0#islessgreater ^223 316$^$@0#isunordered *0 (Datatype) ^224 20@a@+@0@0@0@0@317#jmp_buf *4 (Function) ^225 319$@0@@1@p0$@0#setjmp ^226 321@6@0@5@0@0^$@0#longjmp *1 (Constant) ^227 5$#SIGABRT#SIGFPE#SIGILL#SIGINT#SIGSEGV#SIGTERM *0 (Datatype) ^233 13@-@-@0@0@0@0@322#sig_atomic_t *1 (Constant) ^234 326$#SIG_DFL ^235 330$#SIG_ERR ^236 334$#SIG_IGN *4 (Function) ^237 347@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26$@0#signal ^238 349@6@0@5@0@0$$@0#raise *0 (Datatype) ^239 20@a@+@0@0@0@0@350#va_list *4 (Function) ^240 352$@0@@1@p0$@0#va_start ^241 354$@0@@1@p0$@0#va_end ^242 356$$$@0#va_copy *0 (Datatype) ^243 20@a@+@0@0@0@0@357#FILE ^244 20@a@+@0@0@0@0@358#fpos_t *1 (Constant) ^245 64$#_IOFBF#_IOLBF#_IONBF#BUFSIZ ^249 5$#EOF#FOPEN_MAX#FILENAME_MAX#L_tmpnam#SEEK_CUR#SEEK_END#SEEK_SET#TMP_MAX *3 (Variable) ^257 359|@1|6@0@0@0@2#stderr *4 (Function) ^258 361$@0@s3,g26@6@0@1@s3,g26$@0#remove ^259 363$@0@s3,g26@6@0@1@s3,g26$@0#rename ^260 366@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#tmpfile ^261 369$@0@s1@1@tp0,s1@19@3@0#tmpnam ^262 371$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fclose ^263 373$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fflush ^264 376@6@5@1@0@0@0@s3@1@s3@18@0@0#fopen ^265 379@6@5@1@0@0@0@s3,g26@6@0@1@tp2,s3,g26@18@0@0#freopen ^266 381$@0@s3@1@s3,tp0,tp1$@0#setbuf ^267 383$@0@s3@1@s3,tp0,tp1$@0#setvbuf ^268 385@6@0@1@1@0@0@s3@1@s3,tp0$@0#fprintf ^269 387@6@0@1@2@0@0@s3,g26@6@0@1@s3,tp0,g26$@0#fscanf ^270 389@6@0@1@1@0@1@g22@6@0,s3@1@s3,tg22$@0#printf ^271 391@6@0@1@2@0@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#scanf ^272 393@6@0@1@1@0@0@@1@tp0$@0@W:bufferoverflowhigh#Buffer overflow possible with sprintf. Recommend using snprintf instead##sprintf ^273 395@6@0@1@1@0@0@@1@p0$@0#snprintf ^274 397@6@0@1@2@0@0@g26@6@0@1@g26$@0#sscanf ^275 399$@1@g22@6@0,s3@1@s3,tg22$@0#vprintf ^276 401$@0@s3,g26@6@0@1@s3,tp0,p2,g26$@0#vfprintf ^277 403$@0@@1@p0$@0@W:bufferoverflowhigh#Use vsnprintf instead##vsprintf ^278 405$@0@@1@p0$@0#vsnprintf ^279 407$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fgetc ^280 410@6@5@1@0@0@0@s3,g26@6@0@1@s3,tp0,tp2,g26$@0#fgets ^281 413$@0@s3,g26@6@0@1@s3,tp1,g26$@0#fputc ^282 415$@0@s3@1@s3,tp1$@0#fputs ^283 417$@0@s3,g26@6@0@1@s3,tp0,g26$@0#getc ^284 419$@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#getchar ^285 422@6@5@1@0@0@1@g21@6@0,s3,g26@6@0@1@s3,tp0,tg21,g26@3@0@0@W:bufferoverflowhigh#Use of gets leads to a buffer overflow vulnerability. Use fgets instead##gets ^286 424$@0@s3,g26@6@0@1@s3,tp1,g26$@0#putc ^287 426$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#putchar ^288 428$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#puts ^289 430$@0@s3@1@s3,tp1$@0#ungetc ^290 432$@0@s3,g26@6@0@1@s3,tp0,tp3,g26$@0#fread ^291 434$@0@s3,g26@6@0@1@s3,tp3,g26$@0#fwrite ^292 437$@0@g26@6@0@1@tp1,g26$@0#fgetpos ^293 439$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fseek ^294 441$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fsetpos ^295 443$@0@g26@6@0@1@g26$@0#ftell ^296 445$@0@@1@tp0$@0#rewind ^297 447$@0@@1@tp0$@0#clearerr ^298 449$@0@g26@6@0@1@g26$@0#feof ^299 451$@0@g26@6@0@1@g26$@0#ferror ^300 453$@1@g26@6@0,g257@6@0,s3@1@s3,tg257$@0#perror ^301 455$^$@0#atof ^302 457$^$@0#atoi ^303 459$^$@0#atol ^304 463$@0@g26@6@0@1@tp1,g26$@0#strtod ^305 465$@0@g26@6@0@1@tp1,g26$@0#strtol ^306 467$@0@g26@6@0@1@tp1,g26$@0#strtoul *1 (Constant) ^307 5$#RAND_MAX *4 (Function) ^308 469$@0@s1@1@s1$@0#rand ^309 471$@0@s1@1@s1$@0#srand ^310 474@6@5@1@0@0^@2@0@0#calloc ^311 477@4@5@1@0@0^@2@0@0#malloc ^312 480@6@5@1@0@0@0@@1@tp0@2@0@0#realloc ^313 482$@0@@1@p0$@0#free *1 (Constant) ^314 5$#EXIT_FAILURE#EXIT_SUCCESS *4 (Function) ^316 484@6@0@6@0@0^$@0#abort ^317 486@6@0@6@0@0^$@0#exit ^318 492$@0@s1@1@s1$@0#atexit ^319 495@6@5@1@0@0^@19@3@0#getenv ^320 497$@0@s3@1@s3$@0#system ^321 504@6@5@1@0@0^@18@0@0#bsearch ^322 510$@0@g26@6@0@1@tp0,g26$@0#qsort ^323 512$^$@0#abs *7 (Struct tag) ^324 513@514#@!2 *0 (Datatype) ^325 513@c@-@0@0@0@0@515#div_t *4 (Function) ^326 517$^$@0#div ^327 519$^$@0#labs *7 (Struct tag) ^328 520@521#@!3 *0 (Datatype) ^329 520@c@-@0@0@0@0@522#ldiv_t *4 (Function) ^330 524$^$@0#ldiv *1 (Constant) ^331 64$#MB_CUR_MAX ^332 5$#WCHAR_MAX#WCHAR_MIN ^334 67$#WEOF *4 (Function) ^335 526$^$@0#btowc ^336 528$@0@s3@1@s3,tp0$@0#fgetwc ^337 532@6@5@1@0@0@0@s3@1@s3,tp0,tp2$@0#fgetws ^338 534$@0@s3@1@s3,tp1$@0#fputwc ^339 536$@0@s3@1@s3,tp1$@0#fputws ^340 538$^$@0#fwide ^341 540@6@0@1@1@0@0@s3@1@tp0,s3$@0#fwprintf ^342 542@6@0@1@2@0@0@s3@1@tp0,s3$@0#fwscanf ^343 544$@0@s3@1@s3,tp0$@0#getwc ^344 546$@0@s3,g21@6@0@1@s3,tg21$@0#getwchar ^345 549$^$@0#mbrlen ^346 551$@0@@1@tp0$@0#mbrtowc ^347 553$^$@0#mbsinit ^348 555$@0@@1@tp0$@0#mbsrtowcs ^349 557$@0@s3@1@s3,tp1$@0#putwc ^350 559$@0@s3,g22@6@0@1@s3,tg22$@0#putwchar ^351 561@6@0@1@1@0@0@@1@tp0$@0#swprintf ^352 563@6@0@1@2@0@0@g21@6@0@1@tg21$@0#swscanf ^353 565$@0@s3@1@s3,tp1$@0#ungetwc ^354 567$@0@s3@1@s3,tp0$@0#vfwprintf ^355 569$@0@@1@tp0$@0#vswprintf ^356 571$@0@s3,g22@6@0@1@s3,tg22$@0#vwprintf ^357 573$@0@@1@tp0$@0#wcrtomb ^358 577$@0@@1@tp0$@0#wcscat ^359 580@6@5@1@0@0^@19@2@0#wcschr ^360 582$^$@0#wcscmp ^361 584$^$@0#wcscoll ^362 587$@0@@1@tp0$@0#wcscpy ^363 589$^$@0#wcscspn *7 (Struct tag) ^364 759@590#@tm *4 (Function) ^365 593$@0@@1@tp0$@0#wcsftime ^366 595$^$@0#wcslen ^367 599$@0@@1@tp0$@0#wcsncat ^368 601$^$@0#wcsncmp ^369 604$@0@@1@tp0$@0#wcsncpy ^370 607@6@5@1@0@0^$@0#wcspbrk ^371 610@6@5@1@0@0^$@0#wcsrchr ^372 613$@0@@1@tp1$@0#wcsrtombs ^373 615$^$@0#wcsspn ^374 618@6@5@1@0@0^@3@0@0#wcsstr ^375 620$@0@@1@tp1$@0#wcstod ^376 623@6@5@1@0@0@0@@1@tp2@3@0@0#wcstok ^377 625$@0@@1@tp1$@0#wcstol ^378 627$@0@@1@tp1$@0#wcstoul ^379 629$@0@@1@tp0$@0#wcsxfrm ^380 631$^$@0#wctob ^381 634@6@5@1@0@0^@3@0@0#wmemchr ^382 636$^$@0#wmemcmp ^383 639$@0@@1@tp0$@0#wmemcpy ^384 642$@0@@1@tp0$@0#wmemmove ^385 645$@0@@1@tp0$@0#wmemset ^386 647@6@0@1@1@0@1@g22@6@0,g26@6@0@1@g26,tg22$@0#wprintf ^387 649@6@0@1@2@0@1@g21@6@0,g26@6@0@1@g26,tg21$@0#wscanf *0 (Datatype) ^388 13@-@-@0@0@0@0@650#wctype_t ^389 13@-@-@0@0@0@0@651#wctrans_t *4 (Function) ^390 653$^$@0#iswalnum ^391 655$^$@0#iswalpha ^392 657$^$@0#iswcntrl ^393 659$^$@0#iswctype ^394 661$^$@0#iswdigit ^395 663$^$@0#iswgraph ^396 665$^$@0#iswlower ^397 667$^$@0#iswprint ^398 669$^$@0#iswpunct ^399 671$^$@0#iswspace ^400 673$^$@0#iswupper ^401 675$^$@0#iswxdigit ^402 677$^$@0#towctrans ^403 679$^$@0#towlower ^404 681$^$@0#towupper ^405 683$^$@0#wctrans ^406 685$^$@0#wctype ^407 687$^$@0#mblen ^408 689$@0@@1@tp0$@0#mbtowc ^409 691$@0@@1@tp0$@0#wctomb ^410 693$@0@@1@tp0$@0#mbstowcs ^411 695$@0@@1@tp0$@0#wcstombs ^412 699$@0@@1@tp0$@0#memcpy ^413 702$@0@@1@tp0$@0#memmove ^414 706$@0@@1@tp0$@0#strcpy ^415 709$@0@@1@tp0$@0#strncpy ^416 712$@0@@1@tp0$@0#strcat ^417 715$@0@@1@tp0$@0#strncat ^418 717$^$@0#memcmp ^419 719$^$@0#strcmp ^420 721$^$@0#strcoll ^421 723$^$@0#strncmp ^422 725$@0@@1@tp0$@0#strxfrm ^423 728@6@5@1@0@0^@3@0@0#memchr ^424 731@6@5@1@0@0^@19@2@0#strchr ^425 733$^$@0#strcspn ^426 736@6@5@1@0@0^@19@2@0#strpbrk ^427 739@6@5@1@0@0^@19@2@0#strrchr ^428 741$^$@0#strspn ^429 744@6@5@1@0@0^@19@2@0#strstr ^430 747@6@5@1@0@0@0@s1,g26@6@0@1@tp0,s1,g26@19@2@0#strtok ^431 751$@0@@1@tp0$@0#memset ^432 754$^@19@3@0#strerror ^433 756$^$@0#strlen *1 (Constant) ^434 5$#CLOCKS_PER_SEC *0 (Datatype) ^435 13@-@-@0@0@0@0@757#clock_t ^436 13@-@-@0@0@0@0@758#time_t *4 (Function) ^437 761$@0@s1@1@s1$@0#clock ^438 763$^$@0#difftime ^439 765$^$@0#mktime ^440 768$@0@@1@tp0$@0#time ^441 771$@0@g26@6@0@1@g26@19@3@0#asctime ^442 774$^@19@3@0#ctime ^443 777$^@19@3@0#gmtime ^444 780$@0@g26@6@0@1@g26@19@3@0#localtime ^445 782$@0@@1@tp0$@0#strftime *0 (Datatype) ^446 13@-@-@0@0@0@0@783#int8_t ^447 13@-@-@0@0@0@0@784#int16_t ^448 13@-@-@0@0@0@0@785#int32_t ^449 13@-@-@0@0@0@0@786#int64_t ^450 14@-@-@0@0@0@0@787#uint8_t ^451 14@-@-@0@0@0@0@788#uint16_t ^452 14@-@-@0@0@0@0@789#uint32_t ^453 14@-@-@0@0@0@0@790#uint64_t ^454 13@-@-@0@0@0@0@791#int_least8_t ^455 13@-@-@0@0@0@0@792#int_least16_t ^456 13@-@-@0@0@0@0@793#int_least32_t ^457 13@-@-@0@0@0@0@794#int_least64_t ^458 14@-@-@0@0@0@0@795#uint_least8_t ^459 14@-@-@0@0@0@0@796#uint_least16_t ^460 14@-@-@0@0@0@0@797#uint_least32_t ^461 14@-@-@0@0@0@0@798#uint_least64_t ^462 13@-@-@0@0@0@0@799#int_fast8_t ^463 13@-@-@0@0@0@0@800#int_fast16_t ^464 13@-@-@0@0@0@0@801#int_fast32_t ^465 13@-@-@0@0@0@0@802#int_fast64_t ^466 14@-@-@0@0@0@0@803#uint_fast8_t ^467 14@-@-@0@0@0@0@804#uint_fast16_t ^468 14@-@-@0@0@0@0@805#uint_fast32_t ^469 14@-@-@0@0@0@0@806#uint_fast64_t ^470 15@-@-@0@0@0@0@807#intptr_t ^471 14@-@-@0@0@0@0@808#uintptr_t ^472 15@-@-@0@0@0@0@809#intmax_t ^473 14@-@-@0@0@0@0@810#uintmax_t *1 (Constant) ^474 5$#INT8_MIN#INT16_MIN#INT32_MIN#INT64_MIN#INT8_MAX#INT16_MAX#INT32_MAX#INT64_MAX#UINT8_MIN#UINT16_MIN#UINT32_MIN#UINT64_MIN#INT_LEAST8_MIN#INT_LEAST16_MIN#INT_LEAST32_MIN#INT_LEAST64_MIN#INT_LEAST8_MAX#INT_LEAST16_MAX#INT_LEAST32_MAX#INT_LEAST64_MAX#UINT_LEAST8_MAX#UINT_LEAST16_MAX#UINT_LEAST32_MAX#UINT_LEAST64_MAX#INT_FAST8_MIN#INT_FAST16_MIN#INT_FAST32_MIN#INT_FAST64_MIN#INT_FAST8_MAX#INT_FAST16_MAX#INT_FAST32_MAX#INT_FAST64_MAX#UINT_FAST8_MAX#UINT_FAST16_MAX#UINT_FAST32_MAX#UINT_FAST64_MAX ^510 64$#INTPTR_MIN#INTPTR_MAX *0 (Datatype) ^512 13@-@-@0@0@0@0@811#dev_t ^513 13@-@-@0@0@0@0@812#gid_t ^514 14@-@-@0@0@0@0@813#ino_t ^515 13@-@-@0@0@0@0@814#mode_t ^516 13@-@-@0@0@0@0@815#nlink_t ^517 13@-@-@0@0@0@0@816#off_t ^518 13@-@-@0@0@0@0@817#pid_t ^519 13@-@-@0@0@0@0@818#uid_t ^520 20@a@+@0@0@0@0@819#DIR *7 (Struct tag) ^521 820@821#@dirent *4 (Function) ^522 824$@0@g26@6@0@1@g26$@0#closedir ^523 827@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#opendir ^524 831@6@5@1@0@0@0@g26@6@0@1@g26@18@0@0#readdir ^525 833$^$@0#rewinddir *1 (Constant) ^526 5$#E2BIG#EACCES#EAGAIN#EBADF#EBUSY#ECHILD#EDEADLK#EEXIST#EFAULT#EFBIG#EINTR#EINVAL#EIO#EISDIR#EMFILE#EMLINK#ENAMETOOLONG#ENFILE#ENODEV#ENOENT#ENOEXEC#ENOLCK#ENOMEM#ENOSPC#ENOSYS#ENOTDIR#ENOTEMPTY#ENOTTY#ENXIO#EPERM#EPIPE#EROFS#ESPIPE#ESRCH#EXDEV#FD_CLOEXEC#F_DUPFD#F_GETFD#F_GETFL#F_GETLK#F_RDLCK#F_SETFD#F_SETFL#F_SETLK#F_SETLKW#F_UNLCK#F_WRLCK#O_ACCMODE#O_APPEND#O_CREAT#O_EXCL#O_NOCTTY#O_NONBLOCK#O_RDONLY#O_RDWR#O_TRUNC#O_WRONLY ^583 814$#S_IFMT#S_IFBLK#S_IFCHR#S_IFIFO#S_IFREG#S_IFDIR#S_IFLNK#S_IRWXU#S_IRUSR#S_IRGRP#S_IROTH#S_IUSR#S_IWXG#S_IWXO#S_IWXU#S_ISGID#S_ISUID#S_IWGRP#S_IWOTH#S_IWUSR#S_IXGRP#S_IXOTH#S_IXUSR *7 (Struct tag) ^606 834@835#@flock *4 (Function) ^607 837$@0@g26@6@0@1@g26$@0#creat ^608 839$@0@g26@6@0@1@g26$@0#fcntl ^609 841$@0@g26@6@0@1@g26$@0#open *7 (Struct tag) ^610 842@843#@group *4 (Function) ^611 847@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrgid ^612 850@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrnam *1 (Constant) ^613 9$#ARG_MAX#CHILD_MAX#LINK_MAX#MAX_CANON ^617 64$#MAX_INPUT#NAME_MAX ^619 9$#NGROUPS_MAX#OPEN_MAX ^621 64$#PATH_MAX#PIPE_BUF ^623 9$#SSIZE_MAX#STREAM_MAX#TZNAME_MAX#_POSIX_ARG_MAX#_POSIX_CHILD_MAX#_POSIX_LINK_MAX#_POSIX_MAX_CANON#_POSIX_MAX_INPUT#_POSIX_NAME_MAX#_POSIX_NGROUPS_MAX#_POSIX_OPEN_MAX#_POSIX_PATH_MAX#_POSIX_PIPE_BUF#_POSIX_SSIZE#_POSIX_STREAM#_POSIX_TZNAME_MAX *7 (Struct tag) ^639 851@852#@passwd *4 (Function) ^640 856@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwnam ^641 859@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwuid *0 (Datatype) ^642 20@a@+@0@0@0@0@860#sigjmp_buf *4 (Function) ^643 862@6@0@5@0@0^$@0#siglongjmp ^644 864$@0@@1@p0$@0#sigsetjmp *0 (Datatype) ^645 0@a@=@0@0@0@0@865#sigset_t *7 (Struct tag) ^646 866@867#@!4 *0 (Datatype) ^647 866@-@-@0@0@0@0@868#stack_t ^648 0@a@=@0@0@0@0@869#mcontext_t *7 (Struct tag) ^649 872@870#@s_ucontext_t *0 (Datatype) ^650 870@-@+@0@0@0@0@873#ucontext_t *4 (Function) ^651 876$$$@0#getcontext ^652 878$$$@0#setcontext ^653 884$$$@0#makecontext ^654 886$$$@0#swapcontext *1 (Constant) ^655 5$#SA_NOCLDSTOP#SIG_BLOCK#SIG_SETMASK#SIG_UNBLOCK#SIGALRM#SIGCHLD#SIGCONT#SIGHUP#SIGKILL#SIGPIPE#SIGQUIT#SIGSTOP#SIGTSTP#SIGTTIN#SIGTTOU#SIGUSR1#SIGUSR2 *7 (Struct tag) ^672 887@888#@sigstack *8 (Union tag) ^673 0@889#$sigval *7 (Struct tag) ^674 890@891#@!5 *0 (Datatype) ^675 890@-@-@0@0@0@0@892#siginfo_t *8 (Union tag) ^676 893@894#$!6 *0 (Datatype) ^677 893@-@-@0@0@0@0@895#sigval *7 (Struct tag) ^678 905@906#@sigaction *4 (Function) ^679 908@6@0@5@0@0@0@g26@6@0@1@g26$@0#kill ^680 911$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigaction ^681 914$@0@g26@6@0@1@tp0,g26$@0#sigaddset ^682 916$@0@g26@6@0@1@tp0,g26$@0#sigdelset ^683 918$@0@g26@6@0@1@tp0,g26$@0#sigemptyset ^684 920$@0@g26@6@0@1@tp0,g26$@0#sigfillset ^685 922$@0@g26@6@0@1@g26$@0#sigismember ^686 924$@0@g26@6@0@1@tp0,g26$@0#sigpending ^687 926$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigprocmask ^688 928$@0@g26@6@0,s3@1@g26,s3$@0#sigsuspend *1 (Constant) ^689 5$#L_ctermid#L_cuserid *4 (Function) ^691 931@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#fdopen ^692 933$@0@g26@6@0@1@g26$@0#fileno *7 (Struct tag) ^693 934@935#@stat *4 (Function) ^694 939$^$@0#S_ISBLK ^695 942$^$@0#S_ISCHR ^696 945$^$@0#S_ISDIR ^697 948$^$@0#S_ISFIFO ^698 951$^$@0#S_ISREG ^699 953$@0@s3,g26@6@0@1@s3,g26$@0#chmod ^700 956$@0@g26@6@0@1@g26,tp1$@0#fstat ^701 958$@0@s3,g26@6@0@1@s3,g26$@0#mkdir ^702 960$@0@s3,g26@6@0@1@s3,g26$@0#mkfifo ^703 962$@0@g26@6@0@1@g26,tp1$@0#stat ^704 964$@0@s3@1@s3$@0#umask *7 (Struct tag) ^705 965@966#@tms *4 (Function) ^706 969$@0@@1@tp0$@0#times *7 (Struct tag) ^707 970@971#@utsname *4 (Function) ^708 974$@0@g26@6@0@1@tp0,g26$@0#uname ^709 976$^$@0#WEXITSTATUS ^710 978$^$@0#WIFEXITED ^711 980$^$@0#WIFSIGNALED ^712 982$^$@0#WIFSTOPPED ^713 984$^$@0#WSTOPSIG ^714 986$^$@0#WTERMSIG *1 (Constant) ^715 5$#WUNTRACED#WCONTINUED#WNOHANG *4 (Function) ^718 988$@0@g26@6@0,s3@1@tp0,g26,s3$@0#wait ^719 990$@0@g26@6@0,s3@1@tp1,g26,s3$@0#waitpid *0 (Datatype) ^720 992@-@-@0@0@0@0@993#cc_t ^721 995@-@-@0@0@0@0@996#speed_t ^722 995@-@-@0@0@0@0@997#tcflag_t *1 (Constant) ^723 5$#B0#B50#B75#B110#B134#B150#B200#B300#B600#B1200#B1800#B2400#B4800#B9600#B19200#B38400#BRKINT#CLOCAL#CREAD#CS5#CS6#CS7#CS8#CSIZE#CSTOPB#ECHO#ECHOE#ECHOK#ECHONL#HUPCL#ICANON#ICRNL#IEXTEN#IGNBRK#IGNCR#IGNPAR#IGNLCR#INPCK#ISIG#ISTRIP#IXOFF#IXON#NCCS#NOFLSH#OPOST#PARENB#PARMRK#PARODD#TCIFLUSH#TCIOFF#TCIOFLUSH#TCION#TCOFLUSH#TCSADRAIN#TCSAFLUSH#TCSANOW#TOSTOP#VEOF#VEOL#VERASE#VINTR#VKILL#VMIN#VQUIT#VSTART#VSTOP#VSUSP#VTIME *7 (Struct tag) ^791 998@999#@termios *4 (Function) ^792 1002$^$@0#cfgetispeed ^793 1004$^$@0#cfgetospeed ^794 1006$@0@@1@tp0$@0#cfsetispeed ^795 1008$@0@@1@tp0$@0#cfsetospeed ^796 1010$@0@g26@6@0@1@g26$@0#tcdrain ^797 1012$@0@g26@6@0@1@g26$@0#tcflow ^798 1014$@0@g26@6@0@1@g26$@0#tcflush ^799 1016$@0@g26@6@0@1@g26,tp1$@0#tcgetattr ^800 1018$@0@g26@6@0@1@g26$@0#tcsendbreak ^801 1020$@0@g26@6@0@1@g26$@0#tcsetattr *3 (Variable) ^802 461|@1|6@0@0@0@1#environ *1 (Constant) ^803 5$#CLK_TCK *4 (Function) ^804 1022$@1@g802@6@0,s3@1@s3$@0#tzset *1 (Constant) ^805 5$#F_OK#R_OK#STDERR_FILENO#STDIN_FILENO#STDOUT_FILENO#W_OK#X_OK#_PC_CHOWN_RESTRUCTED#_PC_MAX_CANON#_PC_MAX_INPUT#_PC_NAME_MAX#_PC_NO_TRUNC#_PC_PATH_MAX#_PC_PIPE_BUF#_PC_VDISABLE#_POSIX_CHOWN_RESTRICTED#_POSIX_JOB_CONTROL#_POSIX_NO_TRUNC#_POSIX_SAVED_IDS#_POSIX_VDISABLE#_POSIX_VERSION#_SC_ARG_MAX#_SC_CHILD_MAX#_SC_CLK_TCK#_SC_JOB_CONTROL#_SC_NGROUPS_MAX#_SC_OPEN_MAX#_SC_SAVED_IDS#_SC_STREAM_MAX#_SC_TZNAME_MAX#_SC_VERSION *4 (Function) ^836 1024@6@0@6@0@0^$@0#_exit ^837 1026$@0@g26@6@0@1@g26$@0#access ^838 1028$@0@s3@1@s3$@0#alarm ^839 1030$@0@g26@6@0@1@g26$@0#chdir ^840 1032$@0@s3,g26@6@0@1@s3,g26$@0#chown ^841 1034$@0@s3,g26@6@0@1@s3,g26$@0#close ^842 1037$@0@s3@1@tp0,s3$@0#ctermid ^843 1040$@0@@1@tp0@3@0@0#cuserid ^844 1042$@0@g26@6@0,s3@1@g26,s3$@0#dup2 ^845 1044$@0@g26@6@0,s3@1@g26,s3$@0#dup ^846 1046@6@0@5@0@0@0@g26@6@0@1@g26$@0#execl ^847 1048@6@0@5@0@0@0@g26@6@0@1@g26$@0#execle ^848 1050@6@0@5@0@0@0@g26@6@0@1@g26$@0#execlp ^849 1054@6@0@5@0@0@0@g26@6@0@1@g26$@0#execv ^850 1056@6@0@5@0@0@0@g26@6@0@1@g26$@0#execve ^851 1058@6@0@5@0@0@0@g26@6@0@1@g26$@0#execvp ^852 1060$@0@s3,g26@6@0@1@s3,g26$@0#fork ^853 1062$@0@g26@6@0@1@g26$@0#fpathconf ^854 1065@6@5@1@0@0@0@g26@6@0@1@g26,tp0$@0#getcwd ^855 1067$^$@0#getegid ^856 1069$^$@0#geteuid ^857 1071$^$@0#getgid ^858 1074$@0@g26@6@0@1@g26,ap1$@0#getgroups ^859 1077$^@19@3@0#getlogin ^860 1079$^$@0#getpgrp ^861 1081$^$@0#getpid ^862 1083$^$@0#getppid ^863 1085$^$@0#getuid ^864 1087$^$@0#isatty ^865 1089$@0@g26@6@0,s3@1@g26,s3$@0#link ^866 1091$@0@g26@6@0@1@g26$@0#lseek ^867 1093$@0@g26@6@0@1@g26$@0#pathconf ^868 1095$@0@g26@6@0@1@g26$@0#pause ^869 1097$@0@g26@6@0@1@g26$@0#pipe ^870 1099$@0@g26@6@0@1@g26,tp1$@0#read ^871 1101$@0@s3,g26@6@0@1@s3,g26$@0#rmdir ^872 1103$@0@g26@6@0,s3@1@g26,s3$@0#setgid ^873 1105$@0@g26@6@0,s3@1@g26,s3$@0#setpgid ^874 1107$@0@s3@1@s3$@0#setsid ^875 1109$@0@g26@6@0,s3@1@g26,s3$@0#setuid ^876 1111$@0@s3@1@s3$@0#sleep ^877 1113$@0@g26@6@0@1@g26$@0#sysconf ^878 1115$@0@g26@6@0@1@g26$@0#tcgetpgrp ^879 1117$@0@g26@6@0,s3@1@g26,s3$@0#tcsetpgrp ^880 1120@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#ttyname ^881 1122$@0@s3,g26@6@0@1@s3,g26$@0#unlink ^882 1124$@0@g26@6@0@1@g26$@0#write *7 (Struct tag) ^883 1125@1126#@utimbuf *4 (Function) ^884 1129$@0@s3,g26@6@0@1@s3,g26$@0#utime *0 (Datatype) ^885 20@a@+@0@0@0@0@1130#regex_t ^886 13@-@-@0@0@0@0@1131#regoff_t *7 (Struct tag) ^887 1132@1133#@!7 *0 (Datatype) ^888 1132@-@-@0@0@0@0@1134#regmatch_t *4 (Function) ^889 1137$@0@@1@p0$@0#regcomp ^890 1140$@0@@1@p3$@0#regexec ^891 1142$@0@@1@p2$@0#regerror ^892 1144$$$@0#regfree *1 (Constant) ^893 5$#REG_BASIC#REG_EXTENDED#REG_ICASE#REG_NOSUB#REG_NEWLINE#REG_NOSPEC#REG_PEND#REG_DUMP#REG_NOMATCH#REG_BADPAT#REG_ECOLLATE#REG_ECTYPE#REG_EESCAPE#REG_ESUBREG#REG_EBRACK#REG_EPAREN#REG_EBRACE#REG_BADBR#REG_ERANGE#REG_ESPACE#REG_BADRPT#REG_EMPTY#REG_ASSERT#REG_INVARG#REG_ATOI#REG_ITOA#REG_NOTBOL#REG_NOTEOL#REG_STARTEND#REG_TRACE#REG_LARGE#REG_BACKR ;; Library constraints start_Buffer_Constraints setvbuf pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 3 e2 2 3 -1 ;; end precondition constraints post:EMPTY snprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY vsnprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY fgets pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 0 C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints fread pre:EMPTY post: C 0@1@4 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints fwrite pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY fgetpos pre: C 0@1@3 l 1 1 2 2 Param 435 1 r 2 3 0 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 435 1 r 2 3 0 ;; end precondition constraints calloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints malloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints realloc pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints memcpy pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memmove pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY strcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@4 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints strncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints strcat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 3 2 2 Result r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints strncat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints strchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strrchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strstr pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints memset pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints strlen pre:EMPTY post: C 0@1@4 l 2 2 Result r 1 3 2 2 Param 23 0 ;; end precondition constraints asctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints getpwnam pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getpwuid pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getcwd pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints read pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints write pre: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regexec pre: C 0@1@3 l 1 1 2 2 Param 1138 3 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regerror pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 64 3 ;; end precondition constraints post:EMPTY ;; Modules access _Bool#1@ types#1@ standard#9@ posix#18@ ;;End splint-3.1.2.dfsg1/lib/unix.h0000644021234200000250000016704110102766472013363 0ustar fax/* ** unix.h */ /*@-nextlinemacros@*/ /* ** sys/types.h ** ** evans - 2001-08-27: from http://www.opengroup.org/onlinepubs/007908799/xsh/systypes.h.html */ typedef /*@integraltype@*/ blkcnt_t; typedef /*@integraltype@*/ blksize_t; /*@-redef@*/ /* These are also defined by ansi.h: */ typedef /*@integraltype@*/ clock_t; typedef /*@integraltype@*/ dev_t; typedef /*@integraltype@*/ gid_t; typedef /*@unsignedintegraltype@*/ ino_t; typedef /*@integraltype@*/ mode_t; typedef /*@integraltype@*/ nlink_t; typedef /*@integraltype@*/ off_t; typedef /*@integraltype@*/ pid_t; typedef /*@integraltype@*/ time_t; typedef /*@integraltype@*/ uid_t; /*@=redef@*/ typedef /*@integraltype@*/ clockid_t; typedef /*@unsignedintegraltype@*/ fsblkcnt_t; typedef /*@unsignedintegraltype@*/ fsfilcnt_t; typedef /*@integraltype@*/ id_t; typedef /*@integraltype@*/ key_t; typedef /*@integraltype@*/ pthread_attr_t; typedef /*@integraltype@*/ pthread_cond_t; typedef /*@integraltype@*/ pthread_condattr_t; typedef /*@integraltype@*/ pthread_key_t; typedef /*@integraltype@*/ pthread_mutex_t; typedef /*@integraltype@*/ pthread_mutexattr_t; typedef /*@integraltype@*/ pthread_once_t; typedef /*@integraltype@*/ pthread_rwlock_t; typedef /*@integraltype@*/ pthread_rwlockattr_t; typedef /*@integraltype@*/ pthread_t; typedef /*@signedintegraltype@*/ suseconds_t; typedef /*@integraltype@*/ timer_t; typedef /*@unsignedintegraltype@*/ useconds_t; /* ** Extra stuff in some unixen, not in posix. */ extern /*@unchecked@*/ int signgam; /*@-redef@*/ /* Defined by ansi: */ typedef /*@integraltype@*/ clockid_t; /*@=redef@*/ extern void bcopy (char *b1, /*@out@*/ char *b2, int length) /*@modifies *b2@*/ ; /* Yes, the second parameter is the out param! */ extern int /*@alt _Bool@*/ bcmp (char *b1, char *b2, int length) /*@*/ ; /* Return value is NOT like strcmp! */ extern void bzero (/*@out@*/ char *b1, int length) /*@modifies *b1@*/ ; extern int ffs (int i) /*@*/ ; extern int symlink (char *name1, char *name2) /*@modifies fileSystem@*/ ; extern int setvbuf_unlocked (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf, int mode, size_t size) /*@modifies internalState@*/ ; extern void setbuffer (FILE *stream, /*@null@*/ /*@exposed@*/ char *buf, int size) /*@modifies internalState@*/ ; extern void setlinebuf (FILE *stream) /*@modifies internalState@*/ ; extern int strerror_r (int errnum, /*@out@*/ char *strerrbuf, int buflen) /*@modifies strerrbuf@*/ ; extern size_t fread_unlocked (/*@out@*/ void *ptr, size_t size, size_t nitems, FILE *stream) /*@modifies *stream, *ptr;@*/ ; extern size_t fwrite_unlocked (void *pointer, size_t size, size_t num_items, FILE *stream) /*@modifies *stream;@*/ ; extern void /*@alt void * @*/ memccpy (/*@returned@*/ /*@out@*/ void *s1, /*@unique@*/ void *s2, int c, size_t n) /*@modifies *s1@*/ ; extern int strcasecmp (char *s1, char *s2) /*@*/ ; extern int strncasecmp (char *s1, char *s2, int n) /*@*/ ; extern /*@null@*/ /*@only@*/ char *strdup (char *s) /*@*/ ; extern /*@null@*/ /*@dependent@*/ char * index (/*@returned@*/ char *s, char c) /*@*/ ; extern /*@null@*/ /*@dependent@*/ char * rindex (/*@returned@*/ char *s, char c) /*@*/ ; # if 0 These are in ISO C99. Moved to standard.h: extern double cbrt (double x) /*@modifies errno@*/ ; extern double rint (double x) /*@*/ ; extern double trunc (double x) /*@*/ ; # endif /*@constant int ENOTBLK@*/ /*@constant int ETXTBSY@*/ /*@constant int EWOULDBLOCK@*/ /*@constant int EINPROGRESS@*/ /*@constant int EALREADY@*/ /*@constant int ENOTSOCK@*/ /*@constant int EDESTADDRREQ@*/ /*@constant int EMSGSIZE@*/ /*@constant int EPROTOTYPE@*/ /*@constant int ENOPROTOOPT@*/ /*@constant int EPROTONOSUPPORT@*/ /*@constant int ESOCKTNOSUPPORT@*/ /*@constant int EOPNOTSUPP@*/ /*@constant int EPFNOSUPPORT@*/ /*@constant int EAFNOSUPPORT@*/ /*@constant int EADDRINUSE@*/ /*@constant int EADDRNOTAVAIL@*/ /*@constant int ENETDOWN@*/ /*@constant int ENETUNREACH@*/ /*@constant int ENETRESET@*/ /*@constant int ECONNABORTED@*/ /*@constant int ECONNRESET@*/ /*@constant int ENOBUFS@*/ /*@constant int EISCONN@*/ /*@constant int ENOTCONN@*/ /*@constant int ESHUTDOWN@*/ /*@constant int ETOOMANYREFS@*/ /*@constant int ETIMEDOUT@*/ /*@constant int ECONNREFUSED@*/ /*@constant int ENAMETOOLONG@*/ /*@constant int EHOSTDOWN@*/ /*@constant int EHOSTUNREACH@*/ /*@constant int ENOTEMPTY@*/ /*@constant int EPROCLIM@*/ /*@constant int EUSERS@*/ /*@constant int EDQUOT@*/ /*@constant int ESTALE@*/ /*@constant int EREMOTE@*/ /*@constant int ENOMSG@*/ /*@constant int EIDRM@*/ /*@constant int EALIGN@*/ /*@constant int EDEADLK@*/ /*@constant int ENOLCK@*/ /*@constant int ENOSYS@*/ /*@constant int EACTIVE@*/ /*@constant int ENOACTIVE@*/ /*@constant int ENORESOURCES@*/ /*@constant int ENOSYSTEM@*/ /*@constant int ENODUST@*/ /*@constant int EDUPNOCONN@*/ /*@constant int EDUPNODISCONN@*/ /*@constant int EDUPNOTCNTD@*/ /*@constant int EDUPNOTIDLE@*/ /*@constant int EDUPNOTWAIT@*/ /*@constant int EDUPNOTRUN@*/ /*@constant int EDUPBADOPCODE@*/ /*@constant int EDUPINTRANSIT@*/ /*@constant int EDUPTOOMANYCPUS@*/ /*@constant int ELOOP@*/ /*@constant int LOCK_MAX@*/ /*@constant int FCHR_MAX@*/ /*@constant int USI_MAX@*/ /*@constant int WORD_BIT@*/ /*@constant int LONG_BIT@*/ /*@-incondefs@*/ /* some constant are also declared in posix.h*/ /*@constant long NAME_MAX@*/ /*@constant long NGROUPS_MAX@*/ /*@constant long MAX_CANON@*/ /*@constant int MAX_CHAR@*/ /*@constant long OPEN_MAX@*/ /*@constant int PASS_MAX@*/ /*@constant int PID_MAX@*/ /*@constant int SYSPID_MAX@*/ /*@constant long PIPE_BUF@*/ /*@=incondefs@*/ /*@constant int PIPE_MAX@*/ /*@constant int PROC_MAX@*/ /*@constant int STD_BLK@*/ /*@constant int SYS_NMLN@*/ /*@constant int SYS_OPEN@*/ /*@constant int NZERO@*/ /*@constant int UID_MAX@*/ /*@constant long MB_LEN_MAX@*/ /*@constant int NL_ARGMAX@*/ /*@constant int NL_MSGMAX@*/ /*@constant int NL_NMAX@*/ /*@constant int NL_SETMAX@*/ /*@constant int NL_TEXTMAX@*/ /*@constant int NL_LBLMAX@*/ /*@constant int NL_LANGMAX @*/ /*@constant double M_E@*/ /*@constant double M_LOG2E@*/ /*@constant double M_LOG10E@*/ /*@constant double M_LN2@*/ /*@constant double M_LN10@*/ /*@constant double M_PI@*/ /*@constant double M_PI_2@*/ /*@constant double M_PI_4@*/ /*@constant double M_1_PI@*/ /*@constant double M_2_PI@*/ /*@constant double M_2_SQRTPI@*/ /*@constant double M_SQRT2@*/ /*@constant double M_SQRT1_2@*/ /*@constant double MAXFLOAT@*/ /*@constant double HUGE@*/ /*@constant int DOMAIN@*/ /*@constant int SING@*/ /*@constant int OVERFLOW@*/ /*@constant int UNDERFLOW@*/ /*@constant int TLOSS@*/ /*@constant int PLOSS@*/ extern /*@unchecked@*/ int daylight; extern /*@unchecked@*/ long timezone; extern /*@unchecked@*/ char *tzname[]; /*@-incondefs@*/ extern void tzset(void) /*@modifies daylight, timezone, tzname@*/ ; /*@=incondefs@*/ /*@-redef@*/ /* Defined by ansi: */ typedef /*@integraltype@*/ key_t; /*@-incondefs@*/ typedef long timer_t; /*@=incondefs@*/ /*@=redef@*/ typedef unsigned char uchar_t; typedef unsigned short ushort_t; typedef unsigned int uint_t; typedef unsigned long ulong_t; typedef volatile unsigned char vuchar_t; typedef volatile unsigned short vushort_t; typedef volatile unsigned int vuint_t; typedef volatile unsigned long vulong_t; typedef long label_t; typedef int level_t; typedef /*@integraltype@*/ daddr_t; typedef char *caddr_t; typedef long *qaddr_t; typedef char *addr_t; typedef long physadr_t; typedef short cnt_t; typedef int chan_t; typedef int paddr_t; typedef void *mid_t; typedef char slab_t[12]; typedef ulong_t shmatt_t; typedef ulong_t msgqnum_t; typedef ulong_t msglen_t; typedef uchar_t uchar; typedef ushort_t ushort; typedef uint_t uint; typedef ulong_t ulong; typedef uchar_t u_char; typedef ushort_t u_short; typedef uint_t u_int; typedef ulong_t u_long; typedef vuchar_t vu_char; typedef vushort_t vu_short; typedef vuint_t vu_int; typedef vulong_t vu_long; typedef long swblk_t; typedef u_long fixpt_t; typedef long segsz_t; typedef /*@abstract@*/ fd_set; int ioctl (int d, int /*@alt long@*/ request, /*@out@*/ void *arg) /*@modifies *arg, errno@*/ ; /* depends on request! */ pid_t vfork (void) /*@modifies fileSystem@*/ ; /* ** sys/uio.h */ struct iovec { /*@dependent@*/ void *iov_base; size_t iov_len; /*: maxSet(iov_base) = iov_len */ }; /* from limits.h */ /*@constant int UIO_MAXIOV@*/ /* BSD */ /*@constant int IOV_MAX@*/ /* supposedly SVR4 */ ssize_t readv (int fd, const struct iovec *iov, int iovcnt) /*@modifies iov->iov_base, fileSystem, errno@*/; ssize_t writev (int fd, const struct iovec *iov, int iovcnt) /*@modifies errno@*/; /*________________________________________________________________________ * poll.h */ struct poll { int fd; short events; short revents; }; /*@constant short POLLIN@*/ /*@constant short POLLRDNORM@*/ /*@constant short POLLRDBAND@*/ /*@constant short POLLPRI@*/ /*@constant short POLLOUT@*/ /*@constant short POLLWRNORM@*/ /*@constant short POLLWRBAND@*/ /*@constant short POLLERR@*/ /*@constant short POLLHUP@*/ /*@constant short POLLNVAL@*/ extern int poll (struct poll pollfd[], unsigned long nfds, int timeout) /*@modifies pollfd[].revents, errno@*/ ; /* ** free does not take null */ /*@-incondefs@*/ extern void free (/*@notnull@*/ /*@out@*/ /*@only@*/ void *p) /*@modifies *p@*/ ; /*@=incondefs@*/ /*________________________________________________________________________ * sys/socket.h */ /*@constant int SOCK_RDM@*/ /*@constant int SO_USELOOPBACK@*/ /*@constant int SO_REUSEPORT@*/ /*@constant int AF_LOCAL@*/ /*@constant int AF_IMPLINK@*/ /*@constant int AF_PUP@*/ /*@constant int AF_CHAOS@*/ /*@constant int AF_NS@*/ /*@constant int AF_ISO@*/ /*@constant int AF_OSI@*/ /*@constant int AF_ECMA@*/ /*@constant int AF_DATAKIT@*/ /*@constant int AF_CCITT@*/ /*@constant int AF_SNA@*/ /*@constant int AF_DECnet@*/ /*@constant int AF_DLI@*/ /*@constant int AF_LAT@*/ /*@constant int AF_HYLINK@*/ /*@constant int AF_APPLETALK@*/ /*@constant int AF_ROUTE@*/ /*@constant int AF_LINK@*/ /*@constant int pseudo_AF_XTP@*/ /*@constant int AF_COIP@*/ /*@constant int AF_CNT@*/ /*@constant int pseudo_AF_RTIP@*/ /*@constant int AF_IPX@*/ /*@constant int AF_SIP@*/ /*@constant int pseudo_AF_PIP@*/ /*@constant int AF_ISDN@*/ /*@constant int AF_E164@*/ /*@constant int AF_MAX@*/ /*@constant int MSG_DONTWAIT@*/ /*@constant int MSG_EOF@*/ /*@constant int MSG_COMPAT@*/ /*@constant int PF_UNSPEC@*/ /*@constant int PF_LOCAL@*/ /*@constant int PF_UNIX@*/ /*@constant int PF_INET@*/ /*@constant int PF_IMPLINK@*/ /*@constant int PF_PUP@*/ /*@constant int PF_CHAOS@*/ /*@constant int PF_NS@*/ /*@constant int PF_ISO@*/ /*@constant int PF_OSI@*/ /*@constant int PF_ECMA@*/ /*@constant int PF_DATAKIT@*/ /*@constant int PF_CCITT@*/ /*@constant int PF_SNA@*/ /*@constant int PF_DECnet@*/ /*@constant int PF_DLI@*/ /*@constant int PF_LAT@*/ /*@constant int PF_HYLINK@*/ /*@constant int PF_APPLETALK@*/ /*@constant int PF_ROUTE@*/ /*@constant int PF_LINK@*/ /*@constant int PF_XTP@*/ /*@constant int PF_COIP@*/ /*@constant int PF_CNT@*/ /*@constant int PF_SIP@*/ /*@constant int PF_IPX@*/ /*@constant int PF_RTIP@*/ /*@constant int PF_PIP@*/ /*@constant int PF_ISDN@*/ /*@constant int PF_MAX@*/ /*@constant int NET_MAXID@*/ /*@constant int NET_RT_DUMP@*/ /*@constant int NET_RT_FLAGS@*/ /*@constant int NET_RT_IFLIST@*/ /*@constant int NET_RT_MAXID@*/ /*moved this to before socket.h to get splint to parse the header*/ typedef /*@unsignedintegraltype@*/ sa_family_t; /* ** sys/socket.h ** (updated 26 May 2002) */ typedef /*@unsignedintegraltype@*/ __socklen_t; /* not in USB, but needed by linux */ typedef /*@unsignedintegraltype@*/ socklen_t; struct sockaddr { sa_family_t sa_family; /* address family */ char sa_data[]; /* variable length */ }; struct sockaddr_storage { sa_family_t ss_family; } ; struct msghdr { /*@dependent@*/ void *msg_name; socklen_t msg_namelen; /*: maxSet (msg_name) >= msg_namelen */ /*@dependent@*/ struct iovec *msg_iov; /* scatter/gather array */ int msg_iovlen; /* # elements in msg_iov */ /*: maxSet (msg_iov) >= msg_iovlen */ /*@dependent@*/ void *msg_control; /* ancillary data, see below */ socklen_t msg_controllen; /*: maxSet (msg_control) >= msg_controllen */ int msg_flags; /* flags on received message */ } ; struct cmsghdr { socklen_t cmsg_len; /* data byte count, including hdr */ int cmsg_level; /* originating protocol */ int cmsg_type; /* protocol-specific type */ } ; /*@constant int SCM_RIGHTS@*/ /*@exposed@*/ unsigned char *CMSG_DATA (/*@sef@*/ struct cmsghdr *) /*@*/ ; /*@null@*/ /*@exposed@*/ struct cmsghdr *CMSG_NXTHDR (struct msghdr *, struct cmsghdr *) /*@*/ ; /*@null@*/ /*@exposed@*/ struct cmsghdr *CMSG_FIRSTHDR (struct msghdr *) /*@*/ ; struct linger { int l_onoff; int l_linger; }; /*@constant int SOCK_DGRAM@*/ /*@constant int SOCK_RAW@*/ /*@constant int SOCK_SEQPACKET@*/ /*@constant int SOCK_STREAM@*/ /*@constant int SOL_SOCKET@*/ /*@constant int SO_ACCEPTCONN@*/ /*@constant int SO_BROADCAST@*/ /*@constant int SO_DEBUG@*/ /*@constant int SO_DONTROUTE@*/ /*@constant int SO_ERROR@*/ /*@constant int SO_KEEPALIVE@*/ /*@constant int SO_LINGER@*/ /*@constant int SO_OOBINLINE@*/ /*@constant int SO_RCVBUF@*/ /*@constant int SO_RCVLOWAT@*/ /*@constant int SO_RCVTIMEO@*/ /*@constant int SO_REUSEADDR@*/ /*@constant int SO_SNDBUF@*/ /*@constant int SO_SNDLOWAT@*/ /*@constant int SO_SNDTIMEO@*/ /*@constant int SO_TYPE@*/ /*@constant int SOMAXCONN@*/ /*@constant int MSG_CTRUNC@*/ /*@constant int MSG_DONTROUTE@*/ /*@constant int MSG_EOR@*/ /*@constant int MSG_OOB@*/ /*@constant int MSG_PEEK@*/ /*@constant int MSG_TRUNC@*/ /*@constant int MSG_WAITALL@*/ /*@constant int AF_INET@*/ /*@constant int AF_INET6@*/ /*@constant int AF_UNIX@*/ /*@constant int AF_UNSPEC@*/ /*@constant int SHUT_RD@*/ /*@constant int SHUT_RDWR@*/ /*@constant int SHUT_WR@*/ # if 0 /* ** These were in the old unix.h spec, but are not in SUS6 */ struct sockproto { u_short sp_family; /* address family */ u_short sp_protocol; /* protocol */ }; # endif int accept (int s, struct sockaddr *addr, int *addrlen) /*@modifies *addrlen, errno@*/; int bind (int s, const struct sockaddr *name, int namelen) /*@modifies errno, fileSystem@*/; int connect (int s, const struct sockaddr *name, int namelen) /*@modifies errno, internalState@*/; int getpeername (int s, /*@out@*/ struct sockaddr */*restrict*/ name, socklen_t */*restrict*/ namelen) /*drl splint doesn't handle restrict yet*/ /*@modifies *name, *namelen, errno@*/; #ifdef STRICT int getsockname (int s, /*@out@*/ struct sockaddr *address, socklen_t *address_len) /*@i556@*/ /*: can't do this? requires maxSet(address) >= (*address_len) @*/ /*@modifies *address, *address_len, errno@*/; #else int getsockname (int s, /*@out@*/ struct sockaddr *address, socklen_t /*@alt size_t@*/ *address_len) /*@i556@*/ /*: can't do this? requires maxSet(address) >= (*address_len) @*/ /*@modifies *address, *address_len, errno@*/; #endif int getsockopt (int s, int level, int optname, /*@out@*/ void *optval, size_t *optlen) /*@modifies *optval, *optlen, errno@*/; extern int listen (int s, int backlog) /*@modifies errno, internalState@*/; extern ssize_t recv (int s, /*@out@*/ void *buf, size_t len, int flags) /*@modifies *buf, errno@*/; extern ssize_t recvfrom (int s, void *buf, size_t len, int flags, /*@null@*/ struct sockaddr *from, int *fromlen) /*@modifies *buf, *from, *fromlen, errno@*/; extern ssize_t recvmsg (int s, struct msghdr *msg, int flags) /*@modifies msg->msg_iov->iov_base[], errno@*/; extern ssize_t send (int s, const void *msg, size_t len, int flags) /*@modifies errno@*/; extern ssize_t sendto (int s, const void *msg, size_t len, int flags, const struct sockaddr *to, int tolen) /*@modifies errno@*/; extern ssize_t sendmsg (int s, const struct msghdr *msg, int flags) /*@modifies errno@*/; extern int setsockopt (int s, int level, int optname, const void *optval, int optlen) /*@modifies internalState, errno@*/; extern int shutdown (int s, int how) /*@modifies errno@*/; extern int socket (int domain, int type, int protocol) /*@modifies errno@*/; extern int socketpair (int d, int type, int protocol, /*@out@*/ int *sv) /*@modifies errno@*/; /*@constant int BADSIG@*/ /*@constant int SA_ONSTACK@*/ /*@constant int SA_RESTART@*/ /*@constant int SA_DISABLE@*/ /*@constant int SIGBUS@*/ /*@constant int SIGEMT@*/ /*@constant int SIGINFO@*/ /*@constant int SIGIO@*/ /*@constant int SIGIOT@*/ /*@constant int SIGPOLL@*/ /*@constant int SIGPROF@*/ /*@constant int SIGPWR@*/ /*@constant int SIGSYS@*/ /*@constant int SIGTRAP@*/ /*@constant int SIGURG@*/ /*@constant int SIGVTALRM@*/ /*@constant int SIGWINCH@*/ /*@constant int SIGXCPU@*/ /*@constant int SIGXFSZ@*/ extern void psignal (int sig, const char *msg) /*@modifies fileSystem@*/; extern int setenv (const char *name, const char *value, int overwrite) /*@globals environ@*/ /*@modifies *environ, errno@*/; extern void unsetenv (const char *name) /*@globals environ@*/ /*@modifies *environ@*/; /*________________________________________________________________________ * sys/wait.h */ extern int WCOREDUMP (int x) /*@*/; extern int W_EXITCODE (int ret, int sig) /*@*/; extern int W_STOPCODE (int sig) /*@*/; /*@constant int WAIT_ANY@*/ /*@constant int WAIT_MYPGRP@*/ /*@constant int WSTOPPED@*/ extern pid_t wait3 (int *statloc, int options, /*@null@*/ /*@out@*/ struct rusage *rusage) /*@modifies *statloc, *rusage, errno@*/; extern pid_t wait4 (pid_t p, int *statloc, int opt, /*@null@*/ /*@out@*/ struct rusage *r) /*@modifies *statloc, *r, errno@*/; struct timeval { long tv_sec; long tv_usec; } ; struct timespec { long ts_sec; long ts_nsec; } ; struct timezone { int tz_minuteswest; int tz_dsttime; } ; /*@constant int DST_NONE@*/ /*@constant int DST_USA@*/ /*@constant int DST_AUST@*/ /*@constant int DST_WET@*/ /*@constant int DST_MET@*/ /*@constant int DST_EET@*/ /*@constant int DST_CAN@*/ /*@constant int ITIMER_PROF@*/ /*@constant int ITIMER_REAL@*/ /*@constant int ITIMER_VIRTUAL@*/ struct itimerval { struct timeval it_interval; struct timeval it_value; }; struct clockinfo { int hz; int tick; int stathz; int profhz; }; extern int adjtime (const struct timeval *delta, /*@null@*/ /*@out@*/ struct timeval *olddelta) /*@modifies internalState, *olddelta, errno@*/; extern int getitimer (int which, /*@out@*/ struct itimerval *value) /*@modifies errno, *value*/; extern int gettimeofday (/*@null@*/ /*@out@*/ struct timeval *tp, /*@null@*/ /*@out@*/ struct timezone *tzp) /*@modifies *tp, *tzp, errno@*/; extern int setitimer (int which, struct itimerval *val, /*@null@*/ /*@out@*/ struct itimerval *oval) /*@modifies *oval, errno, internalState*/; extern int settimeofday (const struct timeval *t, const struct timezone *z) /*@modifies internalState, errno@*/; extern int utimes (const char *file, /*@null@*/ const struct timeval *times) /*@modifies fileSystem, errno*/; /*________________________________________________________________________ * sys/mman.h */ /*@constant int PROT_READ@*/ /*@constant int PROT_WRITE@*/ /*@constant int PROT_EXEC@*/ /*@constant int MAP_SHARED@*/ /*@constant int MAP_PRIVATE@*/ /*@constant int MAP_COPY@*/ /*@constant int MAP_FIXED@*/ /*@constant int MAP_RENAME@*/ /*@constant int MAP_NORESERVE@*/ /*@constant int MAP_INHERIT@*/ /*@constant int MAP_NOEXTEND@*/ /*@constant int MAP_HASSEMAPHORE@*/ /*@constant int MS_ASYNC@*/ /*@constant int MS_INVALIDATE@*/ /*@constant int MAP_FILE@*/ /*@constant int MAP_ANON@*/ /*@constant int MADV_NORMAL@*/ /*@constant int MADV_RANDOM@*/ /*@constant int MADV_SEQUENTIAL@*/ /*@constant int MADV_WILLNEED@*/ /*@constant int MADV_DONTNEED@*/ extern caddr_t mmap (/*@null@*/ /*@returned@*/ caddr_t addr, size_t len, int prot, int flags, int fd, off_t offset) /*@modifies addr@*/; extern int madvise (caddr_t addr, int len, int behav) /*@*/; extern int mprotect (caddr_t addr, int len, int prot) /*@*/; extern int int munmap (/*@only@*/ caddr_t addr, size_t len) /*@modifies fileSystem, *addr, errno @*/; extern int msync (caddr_t addr, int len, int flags) /*@*/; extern int mlock (caddr_t addr, size_t len) /*@*/; extern int munlock (caddr_t addr, size_t len) /*@*/; /*________________________________________________________________________ * sys/ioctl.h */ struct winsize { unsigned short ws_row; unsigned short ws_col; unsigned short ws_xpixel; unsigned short ws_ypixel; }; /*@constant int TIOCMODG@*/ /*@constant int TIOCMODS@*/ /*@constant int TIOCM_LE@*/ /*@constant int TIOCM_DTR@*/ /*@constant int TIOCM_RTS@*/ /*@constant int TIOCM_ST@*/ /*@constant int TIOCM_SR@*/ /*@constant int TIOCM_CTS@*/ /*@constant int TIOCM_CAR@*/ /*@constant int TIOCM_CD@*/ /*@constant int TIOCM_RNG@*/ /*@constant int TIOCM_RI@*/ /*@constant int TIOCM_DSR@*/ /*@constant int TIOCEXCL@*/ /*@constant int TIOCNXCL@*/ /*@constant int TIOCFLUSH@*/ /*@constant int TIOCGETA@*/ /*@constant int TIOCSETA@*/ /*@constant int TIOCSETAW@*/ /*@constant int TIOCSETAF@*/ /*@constant int TIOCGETD@*/ /*@constant int TIOCSETD@*/ /*@constant int TIOCSBRK@*/ /*@constant int TIOCCBRK@*/ /*@constant int TIOCSDTR@*/ /*@constant int TIOCCDTR@*/ /*@constant int TIOCGPGRP@*/ /*@constant int TIOCSPGRP@*/ /*@constant int TIOCOUTQ@*/ /*@constant int TIOCSTI@*/ /*@constant int TIOCNOTTY@*/ /*@constant int TIOCPKT@*/ /*@constant int TIOCPKT_DATA@*/ /*@constant int TIOCPKT_FLUSHREAD@*/ /*@constant int TIOCPKT_FLUSHWRITE@*/ /*@constant int TIOCPKT_STOP@*/ /*@constant int TIOCPKT_START@*/ /*@constant int TIOCPKT_NOSTOP@*/ /*@constant int TIOCPKT_DOSTOP@*/ /*@constant int TIOCPKT_IOCTL@*/ /*@constant int TIOCSTOP@*/ /*@constant int TIOCSTART@*/ /*@constant int TIOCMSET@*/ /*@constant int TIOCMBIS@*/ /*@constant int TIOCMBIC@*/ /*@constant int TIOCMGET@*/ /*@constant int TIOCREMOTE@*/ /*@constant int TIOCGWINSZ@*/ /*@constant int TIOCSWINSZ@*/ /*@constant int TIOCUCNTL@*/ /*@constant int TIOCSTAT@*/ /*@constant int TIOCCONS@*/ /*@constant int TIOCSCTTY@*/ /*@constant int TIOCEXT@*/ /*@constant int TIOCSIG@*/ /*@constant int TIOCDRAIN@*/ /*@constant int TIOCMSDTRWAIT@*/ /*@constant int TIOCMGDTRWAIT@*/ /*@constant int TIOCTIMESTAMP@*/ /*@constant int TIOCSDRAINWAIT@*/ /*@constant int TIOCGDRAINWAIT@*/ /*@constant int TTYDISC@*/ /*@constant int TABLDISC@*/ /*@constant int SLIPDISC@*/ /*@constant int PPPDISC@*/ /*@constant int MAXHOSTNAMELEN@*/ extern void FD_CLR (/*@sef@*/ int n, /*@sef@*/ fd_set *p) /*@modifies *p@*/ ; extern void FD_COPY (/*@sef@*/ fd_set *f, /*@out@*/ fd_set *t) /*@modifies *t@*/ ; extern int /*@alt _Bool@*/ FD_ISSET (/*@sef@*/ int n, /*@sef@*/ fd_set *p) /*@*/ ; extern void FD_SET (/*@sef@*/ int n, /*@sef@*/ fd_set *p) /*@modifies *p@*/ ; extern void FD_ZERO (/*@sef@*/ fd_set /*@out@*/ *p) /*@modifies *p@*/; extern int fchdir (int fd) /*@modifies internalState, errno@*/; extern int fchown (int fd, uid_t owner, gid_t group) /*@modifies errno, fileSystem@*/; extern int fsync (int fd) /*@modifies errno, fileSystem@*/; extern int ftruncate (int fd, off_t length) /*@modifies errno, fileSystem@*/; int gethostname (/*@out@*/ char *address, size_t address_len) /*:errorstatus@*/ /*@modifies address@*/ ; int initgroups (const char *name, int basegid) /*@modifies internalState@*/; int lchown (const char *path, uid_t owner, gid_t group) /*@modifies errno, fileSystem@*/; int select (int mfd, fd_set /*@null@*/ *r, fd_set /*@null@*/ *w, fd_set /*@null@*/ *e, /*@null@*/ struct timeval *t) /*@modifies *r, *w, *e, *t, errno@*/; /* evans - 2002-05-26: added null for t, bug reported by Enrico Scholz */ int setegid (gid_t egid) /*@modifies errno, internalState@*/; int seteuid (uid_t euid) /*@modifies errno, internalState@*/; int setgroups (int ngroups, const gid_t *gidset) /*@modifies errno, internalState@*/; int setregid (gid_t rgid, gid_t egid) /*@modifies errno, internalState@*/; int setreuid (gid_t ruid, gid_t euid) /*@modifies errno, internalState@*/; void sync (void) /*@modifies fileSystem@*/; int symlink (const char *path, const char *path2) /*@modifies fileSystem@*/; int truncate (const char *name, off_t length) /*@modifies errno, fileSystem@*/; /*@constant int EBADRPC@*/ /*@constant int ERPCMISMATCH@*/ /*@constant int EPROGUNAVAIL@*/ /*@constant int EPROGMISMATCH@*/ /*@constant int EPROCUNAVAIL@*/ /*@constant int EFTYPE@*/ /*@constant int EAUTH@*/ /*@constant int ENEEDAUTH@*/ /*@constant int ELAST@*/ /* ** tar.h */ /*@unchecked@*/ extern char *TMAGIC; /*@constant int TMAGLEN@*/ /*@unchecked@*/ extern char *TVERSION; /*@constant int TVERSLEN@*/ /*@constant int REGTYPE@*/ /*@constant int AREGTYPE@*/ /*@constant int LNKTYPE@*/ /*@constant int SYMTYPE@*/ /*@constant int CHRTYPE@*/ /*@constant int BLKTYPE@*/ /*@constant int DIRTYPE@*/ /*@constant int FIFOTYPE@*/ /*@constant int CONTTYPE@*/ /*@constant int TSUID@*/ /*@constant int TSGID@*/ /*@constant int TSVTX@*/ /*@constant int TUREAD@*/ /*@constant int TUWRITE@*/ /*@constant int TUEXEC@*/ /*@constant int TGREAD@*/ /*@constant int TGWRITE@*/ /*@constant int TGEXEC@*/ /*@constant int TOREAD@*/ /*@constant int TOWRITE@*/ /*@constant int TOEXEC@*/ struct ipc_perm { uid_t uid; /* user id */ gid_t gid; /* group id */ uid_t cuid; /* creator user id */ gid_t cgid; /* creator group id */ mode_t mode; /* r/w permission */ ulong seq; /* slot usage sequence number */ key_t key; /* user specified msg/sem/shm key */ } ; /*@constant int IPC_R@*/ /*@constant int IPC_W@*/ /*@constant int IPC_M@*/ /*@constant int IPC_CREAT@*/ /*@constant int IPC_EXCL@*/ /*@constant int IPC_NOWAIT@*/ /*@constant key_t IPC_PRIVATE@*/ /*@constant int IPC_RMID@*/ /*@constant int IPC_SET@*/ /*@constant int IPC_STAT@*/ /* ** sys/msg.h */ struct msqid_ds { struct ipc_perm msg_perm; /* msg queue permission bits */ struct msg *msg_first; /* first message in the queue */ struct msg *msg_last; /* last message in the queue */ u_long msg_cbytes; /* number of bytes in use on the queue */ u_long msg_qnum; /* number of msgs in the queue */ u_long msg_qbytes; /* max # of bytes on the queue */ pid_t msg_lspid; /* pid of last msgsnd() */ pid_t msg_lrpid; /* pid of last msgrcv() */ time_t msg_stime; /* time of last msgsnd() */ time_t msg_rtime; /* time of last msgrcv() */ time_t msg_ctime; /* time of last msgctl() */ }; struct mymesg { long mtype; /* message type (+ve integer) */ char mtext[]; /* message body */ }; /*@constant int MSG_NOERROR@*/ /*@constant int MSGMAX@*/ /*@constant int MSGMNB@*/ /*@constant int MSGMNI@*/ /*@constant int MSGTQL@*/ extern int msgctl (int id , int cmd, /*@out@*/ struct msqid_ds *buf) /*@modifies errno, *buf@*/; extern int msgget (key_t key, int flag) /*@modifies errno@*/; extern int msgrcv (int id, /*@out@*/ void *ptr, size_t nbytes, long type, int flags) /*@modifies errno, *ptr@*/; extern int msgsnd (int id, const void *ptr, size_t nbytes, int flag) /*@modifies errno@*/; /* ** sys/sem.h */ struct semid_ds { struct ipc_perm sem_perm; struct sem *sem_base; ushort sem_nsems; time_t sem_otime; time_t sem_ctime; }; struct sem { ushort semval; pid_t sempid; ushort semncnt; ushort semzcnt; }; union semun { int val; struct semid_ds *buf; ushort *array; }; struct sembuf { ushort sem_num; short sem_op; short sem_flg; }; /*@constant int SEM_A@*/ /*@constant int SEMAEM@*/ /*@constant int SEMMNI@*/ /*@constant int SEMMNS@*/ /*@constant int SEMMNU@*/ /*@constant int SEMMSL@*/ /*@constant int SEMOPN@*/ /*@constant int SEM_R@*/ /*@constant int SEMUME@*/ /*@constant int SEM_UNDO@*/ /*@constant int SEMVMX@*/ /*@constant int GETVAL@*/ /*@constant int SETVAL@*/ /*@constant int GETPID@*/ /*@constant int GETNCNT@*/ /*@constant int GETZCNT@*/ /*@constant int GETALL@*/ /*@constant int SETALL@*/ /*@constant int ERMID@*/ extern int semctl (int id, int semnum, int cmd, union semun arg) /*@modifies errno@*/; extern int semget (key_t key, int nsems, int flag) /*@modifies errno@*/; extern int semop (int id, struct sembuf *semoparray, size_t nops) /*@modifies errno@*/; /* ** sys/shm.h */ struct shmid_ds { struct ipc_perm shm_perm; int shm_segsz; ushort shm_lkcnt; pid_t shm_lpid; pid_t shm_cpid; ulong shm_nattch; ulong shm_cnattch; time_t shm_atime; time_t shm_dtime; time_t shm_ctime; }; /*@constant int SHMLBA@*/ /*@constant int SHM_LOCK@*/ /*@constant int SHMMAX@*/ /*@constant int SHMMIN@*/ /*@constant int SHMMNI@*/ /*@constant int SHM_R@*/ /*@constant int SHM_RDONLY@*/ /*@constant int SHM_RND@*/ /*@constant int SHMSEG@*/ /*@constant int SHM_W@*/ /*@constant int SHM_UNLOCK@*/ void * shmat (int id, /*@null@*/ void *addr, int flag) /*@modifies errno@*/ ; extern int shmctl (int id, int cmd, /*@out@*/ struct shmid_ds *buf) /*@modifies errno, *buf@*/ ; extern int shmdt (void *addr) /*@modifies errno@*/ ; extern int shmget (key_t key, int size, int flag) /*@modifies errno@*/ ; /* ** stdio.h - in separte file stdio.h */ /* ** syslog.h */ /*@constant int LOG_EMERG@*/ /*@constant int LOG_ALERT@*/ /*@constant int LOG_CRIT@*/ /*@constant int LOG_ERR@*/ /*@constant int LOG_WARNING@*/ /*@constant int LOG_NOTICE@*/ /*@constant int LOG_INFO@*/ /*@constant int LOG_DEBUG@*/ /*@constant int LOG_KERN@*/ /*@constant int LOG_USER@*/ /*@constant int LOG_MAIL@*/ /*@constant int LOG_DAEMON@*/ /*@constant int LOG_AUTH@*/ /*@constant int LOG_SYSLOG@*/ /*@constant int LOG_LPR@*/ /*@constant int LOG_NEWS@*/ /*@constant int LOG_UUCP@*/ /*@constant int LOG_CRON@*/ /*@constant int LOG_AUTHPRIV@*/ /*@constant int LOG_FTP@*/ /*@constant int LOG_LOCAL0@*/ /*@constant int LOG_LOCAL1@*/ /*@constant int LOG_LOCAL2@*/ /*@constant int LOG_LOCAL3@*/ /*@constant int LOG_LOCAL4@*/ /*@constant int LOG_LOCAL5@*/ /*@constant int LOG_LOCAL6@*/ /*@constant int LOG_LOCAL7@*/ /*@constant int LOG_PID@*/ /*@constant int LOG_CONS@*/ /*@constant int LOG_ODELAY@*/ /*@constant int LOG_NDELAY@*/ /*@constant int LOG_NOWAIT@*/ /*@constant int LOG_PERROR@*/ int LOG_MASK (int pri) /*@*/; int LOG_UPTO (int pri) /*@*/; void closelog (void) /*@modifies fileSystem@*/; void openlog (const char *ident, int logopt, int facility) /*@modifies fileSystem@*/; int setlogmask (int maskpri) /*@modifies internalState@*/; void /*@printflike@*/ syslog (int priority, const char *message, ...) /*@modifies fileSystem@*/; void vsyslog (int priority, const char *message, va_list args) /*@modifies fileSystem@*/; /*________________________________________________________________________ * pwd.h */ extern extern void endpwent (void) /*@modifies internalState@*/; extern /*@null@*/ struct passwd * getpwent (void) /*@modifies internalState@*/; extern int setpassent (int stayopen) /*@modifies internalState@*/; extern int setpwent (void) /*@modifies internalState@*/; /* ** grp.h */ void endgrent (void) /*@modifies internalState@*/; /*@null@*/ /*@observer@*/ struct group *getgrent (void) /*@modifies internalState@*/; int setgrent (void) /*@modifies internalState@*/; void setgrfile (const char *name) /*@modifies internalState@*/; int setgroupent (int stayopen) /*@modifies internalState@*/; /* ** sys/stat.h ** ** evans 2001-08-26 - updated from http://www.opengroup.org/onlinepubs/007908799/xsh/sysstat.h.html */ /* ** struct stat replaces POSIX version - more required fields in Unix */ /*@-redef@*/ /*@-matchfields@*/ struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* file serial number */ mode_t st_mode; /* mode of file (see below) */ nlink_t st_nlink; /* number of links to the file */ uid_t st_uid; /* user ID of file */ gid_t st_gid; /* group ID of file */ dev_t st_rdev; /* device ID (if file is character or block special) */ off_t st_size; /* file size in bytes (if file is a regular file) */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last data modification */ time_t st_ctime; /* time of last status change */ blksize_t st_blksize; /* a filesystem-specific preferred I/O block size for this object. In some filesystem types, this may vary from file to file */ blkcnt_t st_blocks; /* number of blocks allocated for this object */ } ; /*@=redef@*/ /*@=matchfields@*/ /*@constant mode_t S_IWUSR@*/ /*@constant mode_t S_IXUSR@*/ /*@constant mode_t S_IRWXG@*/ /*@constant mode_t S_IRGRP@*/ /*@constant mode_t S_IWGRP@*/ /*@constant mode_t S_IXGRP@*/ /*@constant mode_t S_IRWXO@*/ /*@constant mode_t S_IROTH@*/ /*@constant mode_t S_IWOTH@*/ /*@constant mode_t S_IXOTH@*/ /*@constant mode_t S_ISUID@*/ /*@constant mode_t S_ISGID@*/ /*@constant mode_t S_ISVTX@*/ # if 0 /*These are the old definitions - they don't appear to be in the Single UNIX Specification */ /*@constant int S_ISTXT@*/ /*@constant int S_IREAD@*/ /*@constant int S_IWRITE@*/ /*@constant int S_IEXEC@*/ /*@constant int S_IFMT@*/ /*@constant int S_IFIFO@*/ /*@constant int S_IFCHR@*/ /*@constant int S_IFDIR@*/ /*@constant int S_IFBLK@*/ /*@constant int S_IFREG@*/ /*@constant int S_IFLNK@*/ /*@constant int S_IFSOCK@*/ /*@constant int S_ISVTX@*/ /*@constant int S_ISVTX@*/ /*@constant int SF_SETTABLE@*/ /*@constant int SF_ARCHIVED@*/ /*@constant int ACCESSPERMS@*/ /*@constant int ALLPERMS@*/ /*@constant int DEFFILEMODE@*/ /*@constant int S_BLKSIZE@*/ /*@constant int SF_IMMUTABLE@*/ /*@constant int SF_APPEND@*/ /*@constant int UF_NODUMP@*/ /*@constant int UF_IMMUTABLE@*/ /*@constant int UF_APPEND@*/ # endif int /*@alt _Bool@*/ S_ISBLK (/*@sef@*/ __mode_t m) /*@*/; int /*@alt _Bool@*/ S_ISCHR (/*@sef@*/ __mode_t m) /*@*/; int /*@alt _Bool@*/ S_ISDIR (/*@sef@*/ __mode_t m) /*@*/; int /*@alt _Bool@*/ S_ISFIFO (/*@sef@*/ __mode_t m) /*@*/; int /*@alt _Bool@*/ S_ISREG (/*@sef@*/ __mode_t m) /*@*/; int /*@alt _Bool@*/ S_ISLNK (/*@sef@*/ __mode_t m) /*@*/; int /*@alt _Bool@*/ S_TYPEISMQ (/*@sef@*/ struct stat *buf) /*@*/ ; int /*@alt _Bool@*/ S_TYPEISSEM (/*@sef@*/ struct stat *buf) /*@*/ ; int /*@alt _Bool@*/ S_TYPEISSHM (/*@sef@*/ struct stat *buf) /*@*/ ; /* in POSIX: chmod, fstat, mkdir, mkfifo, stat, umask */ int lstat(const char *, /*@out@*/ struct stat *) /*:errorcode -1:*/ /*@modifies errno@*/ ; int mknod (const char *, mode_t, dev_t) /*@warn portability "The only portable use of mknod is to create FIFO-special file. If mode is not S_IFIFO or dev is not 0, the behaviour of mknod() is unspecified."@*/ /*:errorcode -1:*/ /*@modifies errno@*/ ; int chflags (const char *path, u_long flags) /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/ /*@modifies fileSystem, errno@*/; int fchflags (int fd, u_long flags) /*@warn unixstandard "Not in Single UNIX Specification Version 2"@*/ /*@modifies fileSystem, errno@*/; /* evans 2002-03-17: this was missing, reported by Ralf Wildenhues */ int fchmod(int fildes, mode_t mode) /*@modifies fileSystem, errno@*/ ; /* ** sys/statvfs.h ** from http://www.opengroup.org/onlinepubs/007908799/xsh/sysstatvfs.h.html */ struct statvfs { unsigned long f_bsize; unsigned long f_frsize; fsblkcnt_t f_blocks; fsblkcnt_t f_bfree; fsblkcnt_t f_bavail; fsfilcnt_t f_files; fsfilcnt_t f_ffree; fsfilcnt_t f_favail; unsigned long f_fsid; unsigned long f_flag; unsigned long f_namemax; } ; /*@constant unsigned long ST_RDONLY; @*/ /*@constant unsigned long ST_NOSUID; @*/ int fstatvfs (int fildes, /*@out@*/ struct statvfs *buf) /*@modifies buf@*/ ; int statvfs (const char *path, /*@out@*/ struct statvfs *buf) /*@modifies buf@*/ ; /*________________________________________________________________________ * stropts.h */ /*@constant int FMNAMESZ@*/ /*@constant int MSG_BAND@*/ /*@constant int MSG_HIPRI@*/ /*@constant int RS_HIPRI@*/ /*@constant int S_INPUT@*/ /*@constant int S_RDNORM@*/ /*@constant int S_RDBAND@*/ /*@constant int S_BANDURG@*/ /*@constant int S_HIPRI@*/ /*@constant int S_OUTPUT@*/ /*@constant int S_WRNORM@*/ /*@constant int S_WRBAND@*/ /*@constant int S_MSG@*/ /*@constant int S_ERROR@*/ /*@constant int S_HANGUP@*/ struct strbuf { int maxlen; int len; char *buf; } struct str_mlist { char l_name[]; } struct str_list { int sl_nmods; struct str_mlist *sl_modlist; } extern int getmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *f) /*@modifies *c, *d, errno@*/; extern int getpmsg (int fd, /*@out@*/ struct strbuf *c, /*@out@*/ struct strbuf *d, int *b, int *f) /*@modifies *b, *c, *d, errno@*/; extern int putmsg (int fd, const struct strbuf *c, const struct strbuf *d, int *f) /*@modifies internalState, errno@*/; extern int putpmsg (int fd, const struct strbuf *c, const struct strbuf *d, int b, int *f) /*@modifies internalState, errno@*/; /* ** sys/resource.h ** ** Update 2002-07-09 from ** http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/resource.h.html */ /*@constant int PRIO_PROCESS@*/ /*@constant int PRIO_PGRP@*/ /*@constant int PRIO_USER@*/ typedef /*@unsignedintegraltype@*/ rlim_t; /*@constant rlim_t RLIM_INFINITY@*/ /*@constant rlim_t RLIM_SAVED_MAX@*/ /*@constant rlim_t RLIM_SAVED_CUR@*/ /*@constant int RUSAGE_SELF@*/ /*@constant int RUSAGE_CHILDREN@*/ struct rlimit { rlim_t rlim_cur; rlim_t rlim_max; }; struct rusage { struct timeval ru_utime; /* user time used */ struct timeval ru_stime; /* system time used */ /* other members optional */ }; /*@constant int RLIMIT_CORE@*/ /*@constant int RLIMIT_CPU@*/ /*@constant int RLIMIT_DATA@*/ /*@constant int RLIMIT_FSIZE@*/ /*@constant int RLIMIT_NOFILE@*/ /*@constant int RLIMIT_STACK@*/ /*@constant int RLIMIT_AS@*/ int getpriority (int which, id_t who) /*@modifies errno@*/; int getrlimit (int res, /*@out@*/ struct rlimit *rlp) /*@modifies *rlp, errno@*/; int getrusage (int who, /*@out@*/ struct rusage *rusage) /*@modifies *rusage, errno@*/; int setpriority (int which, id_t who, int prio) /*@modifies errno, internalState@*/; int setrlimit (int resource, const struct rlimit *rlp) /*@modifies errno, internalState@*/; /* ** in */ struct servent { /*@observer@*/ char *s_name; /* Official service name. */ /*@observer@*/ char **s_aliases; /* Alias list. */ int s_port; /* Port number. */ /*@observer@*/ char *s_proto; /* Protocol to use. */ } ; /*@observer@*/ /*@dependent@*/ /*@null@*/ struct servent *getservbyname (const char *name, /*@null@*/ const char *proto) /*@warn multithreaded "Unsafe in multithreaded applications, use getsrvbyname_r instead"@*/ ; struct servent *getservbyname_r (const char *name, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen) /*@requires maxSet (buffer) >= buflen@*/ ; /*@observer@*/ /*@dependent@*/ struct servent *getservbyport (int port, /*@null@*/ const char *proto) /*@warn multithreaded "Unsafe in multithreaded applications, use getservbyport_r instead"@*/ ; struct servent *getservbyport_r (int port, /*@null@*/ const char *proto, /*@out@*/ /*@returned@*/ struct servent *result, /*@out@*/ char *buffer, int buflen) /*@requires maxSet (buffer) >= buflen@*/ ; /*@null@*/ struct servent *getservent (void); /*@null@*/ struct servent *getservent_r (struct servent *result, char *buffer, int buflen); int setservent (int stayopen); int endservent (void); extern int h_errno; /*@null@*/ /*@observer@*/ struct hostent *gethostbyname (/*@nullterminated@*/ /*@notnull@*/ const char *name) /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyname_r instead"@*/ /*@modifies h_errno@*/ ; struct hostent *gethostbyname_r (/*@nullterminated@*/ const char *name, /*@notnull@*/ /*@returned@*/ struct hostent *hent, /*@out@*/ /*@exposed@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop) /*@requires maxSet(buffer) >= bufsize@*/ ; /*@null@*/ /*@observer@*/ struct hostent *gethostbyaddr (/*@notnull@*/ const void *addr, size_t addrlen, int type) /*@requires maxRead(addr) == addrlen@*/ /*:i534 ??? is this right? */ /*@warn multithreaded "Unsafe in multithreaded applications, use gethostbyaddr_r instead"@*/ /*@modifies h_errno@*/ ; struct hostent *gethostbyaddr_r (/*@notnull@*/ const void *addr, size_t addrlen, int type, /*@returned@*/ /*@out@*/ struct hostent *hent, /*@exposed@*/ /*@out@*/ char *buffer, int bufsize, /*@out@*/ int *h_errnop) /*@requires maxRead(addr) == addrlen /\ maxSet(buffer) >= bufsize@*/ /*:i534 ??? is this right? */ ; /*@observer@*/ /*@null@*/ struct hostent *gethostent (void) /*@warn multithreaded "Unsafe in multithreaded applications, use gethostent_r instead"@*/ ; struct hostent *gethostent_r (/*@out@*/ /*@returned@*/ struct hostent *hent, /*@exposed@*/ /*@out@*/ char *buffer, int bufsize) /*@requires maxSet(buffer) >= bufsize@*/ ; /*:i534 need to annotate these: */ struct hostent *fgethostent(FILE *f); struct hostent *fgethostent_r(FILE*f, struct hostent *hent, char buffer, int bufsize); void sethostent(int stayopen); void endhostent(void); void herror(const char *string); char *hstrerror(int err); struct hostent { /*@observer@*/ /*@nullterminated@*/ char *h_name; /* official name of host */ /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_aliases; /* alias list */ int h_addrtype; /* host address type*/ int h_length; /* length ofaddress*/ /*@observer@*/ /*@nullterminated@*/ char * /*:observer@*/ /*:nullterminated@*/ *h_addr_list; /* list of addressesfrom name server */ /*@observer@*/ /*@nullterminated@*/ char *h_addr; /* first address in list (backward compatibility) */ } ; /* ** unistd.h ** from http://www.opengroup.org/onlinepubs/007908799/xsh/unistd.h.html */ /*@constant int _POSIX_VERSION@*/ /*@constant int _POSIX2_VERSION@*/ /*@constant int _POSIX2_C_VERSION@*/ /*@constant int _XOPEN_VERSION@*/ /*@constant int _XOPEN_XCU_VERSION@*/ /* for access: */ /*@constant int R_OK@*/ /*@constant int W_OK@*/ /*@constant int X_OK@*/ /*@constant int F_OK@*/ /* for confstr: */ /*@constant int _CS_PATH@*/ /*@constant int _CS_XBS5_ILP32_OFF32_CFLAGS@*/ /*@constant int _CS_XBS5_ILP32_OFF32_LDFLAGS@*/ /*@constant int _CS_XBS5_ILP32_OFF32_LIBS@*/ /*@constant int _CS_XBS5_ILP32_OFF32_LINTFLAGS@*/ /*@constant int _CS_XBS5_ILP32_OFFBIG_CFLAGS@*/ /*@constant int _CS_XBS5_ILP32_OFFBIG_LDFLAGS@*/ /*@constant int _CS_XBS5_ILP32_OFFBIG_LIBS@*/ /*@constant int _CS_XBS5_ILP32_OFFBIG_LINTFLAGS@*/ /*@constant int _CS_XBS5_LP64_OFF64_CFLAGS@*/ /*@constant int _CS_XBS5_LP64_OFF64_LDFLAGS@*/ /*@constant int _CS_XBS5_LP64_OFF64_LIBS@*/ /*@constant int _CS_XBS5_LP64_OFF64_LINTFLAGS@*/ /*@constant int _CS_XBS5_LPBIG_OFFBIG_CFLAGS@*/ /*@constant int _CS_XBS5_LPBIG_OFFBIG_LDFLAGS@*/ /*@constant int _CS_XBS5_LPBIG_OFFBIG_LIBS@*/ /*@constant int _CS_XBS5_LPBIG_OFFBIG_LINTFLAGS@*/ /* name parameters to sysconf: */ /*@constant int _SC_2_C_BIND@*/ /*@constant int _SC_2_C_DEV@*/ /*@constant int _SC_2_C_VERSION@*/ /*@constant int _SC_2_FORT_DEV@*/ /*@constant int _SC_2_FORT_RUN@*/ /*@constant int _SC_2_LOCALEDEF@*/ /*@constant int _SC_2_SW_DEV@*/ /*@constant int _SC_2_UPE@*/ /*@constant int _SC_2_VERSION@*/ /*@constant int _SC_ARG_MAX@*/ /*@constant int _SC_AIO_LISTIO_MAX@*/ /*@constant int _SC_AIO_MAX@*/ /*@constant int _SC_AIO_PRIO_DELTA_MAX@*/ /*@constant int _SC_ASYNCHRONOUS_IO@*/ /*@constant int _SC_ATEXIT_MAX@*/ /*@constant int _SC_BC_BASE_MAX@*/ /*@constant int _SC_BC_DIM_MAX@*/ /*@constant int _SC_BC_SCALE_MAX@*/ /*@constant int _SC_BC_STRING_MAX@*/ /*@constant int _SC_CHILD_MAX@*/ /*@constant int _SC_CLK_TCK@*/ /*@constant int _SC_COLL_WEIGHTS_MAX@*/ /*@constant int _SC_DELAYTIMER_MAX@*/ /*@constant int _SC_EXPR_NEST_MAX@*/ /*@constant int _SC_FSYNC@*/ /*@constant int _SC_GETGR_R_SIZE_MAX@*/ /*@constant int _SC_GETPW_R_SIZE_MAX@*/ /*@constant int _SC_IOV_MAX@*/ /*@constant int _SC_JOB_CONTROL@*/ /*@constant int _SC_LINE_MAX@*/ /*@constant int _SC_LOGIN_NAME_MAX@*/ /*@constant int _SC_MAPPED_FILES@*/ /*@constant int _SC_MEMLOCK@*/ /*@constant int _SC_MEMLOCK_RANGE@*/ /*@constant int _SC_MEMORY_PROTECTION@*/ /*@constant int _SC_MESSAGE_PASSING@*/ /*@constant int _SC_MQ_OPEN_MAX@*/ /*@constant int _SC_MQ_PRIO_MAX@*/ /*@constant int _SC_NGROUPS_MAX@*/ /*@constant int _SC_OPEN_MAX@*/ /*@constant int _SC_PAGESIZE@*/ /*@constant int _SC_PAGE_SIZE@*/ /*@constant int _SC_PASS_MAX@*/ /*@constant int _SC_PRIORITIZED_IO@*/ /*@constant int _SC_PRIORITY_SCHEDULING@*/ /*@constant int _SC_RE_DUP_MAX@*/ /*@constant int _SC_REALTIME_SIGNALS@*/ /*@constant int _SC_RTSIG_MAX@*/ /*@constant int _SC_SAVED_IDS@*/ /*@constant int _SC_SEMAPHORES@*/ /*@constant int _SC_SEM_NSEMS_MAX@*/ /*@constant int _SC_SEM_VALUE_MAX@*/ /*@constant int _SC_SHARED_MEMORY_OBJECTS@*/ /*@constant int _SC_SIGQUEUE_MAX@*/ /*@constant int _SC_STREAM_MAX@*/ /*@constant int _SC_SYNCHRONIZED_IO@*/ /*@constant int _SC_THREADS@*/ /*@constant int _SC_THREAD_ATTR_STACKADDR@*/ /*@constant int _SC_THREAD_ATTR_STACKSIZE@*/ /*@constant int _SC_THREAD_DESTRUCTOR_ITERATIONS@*/ /*@constant int _SC_THREAD_KEYS_MAX@*/ /*@constant int _SC_THREAD_PRIORITY_SCHEDULING@*/ /*@constant int _SC_THREAD_PRIO_INHERIT@*/ /*@constant int _SC_THREAD_PRIO_PROTECT@*/ /*@constant int _SC_THREAD_PROCESS_SHARED@*/ /*@constant int _SC_THREAD_SAFE_FUNCTIONS@*/ /*@constant int _SC_THREAD_STACK_MIN@*/ /*@constant int _SC_THREAD_THREADS_MAX@*/ /*@constant int _SC_TIMERS@*/ /*@constant int _SC_TIMER_MAX@*/ /*@constant int _SC_TTY_NAME_MAX@*/ /*@constant int _SC_TZNAME_MAX@*/ /*@constant int _SC_VERSION@*/ /*@constant int _SC_XOPEN_VERSION@*/ /*@constant int _SC_XOPEN_CRYPT@*/ /*@constant int _SC_XOPEN_ENH_I18N@*/ /*@constant int _SC_XOPEN_SHM@*/ /*@constant int _SC_XOPEN_UNIX@*/ /*@constant int _SC_XOPEN_XCU_VERSION@*/ /*@constant int _SC_XOPEN_LEGACY@*/ /*@constant int _SC_XOPEN_REALTIME@*/ /*@constant int _SC_XOPEN_REALTIME_THREADS@*/ /*@constant int _SC_XBS5_ILP32_OFF32@*/ /*@constant int _SC_XBS5_ILP32_OFFBIG@*/ /*@constant int _SC_XBS5_LP64_OFF64@*/ /*@constant int _SC_XBS5_LPBIG_OFFBIG@*/ int access(const char *, int) /*@modifies errno@*/ /*:errorcode -1:*/ ; unsigned int alarm (unsigned int) /*@modifies internalState@*/ ; int brk(void *) /*@modifies errno@*/ /*:errorcode -1:*/ /*@warn legacy "brk is obsolete"@*/ ; int chdir (const char *) /*@modifies internalState, errno@*/ /*:errorcode -1:*/ ; int chown (const char *, uid_t, gid_t) /*@modifies internalState, errno@*/ /*:errorcode -1:*/ ; int close (int) /*@modifies internalState, errno@*/ /*:errorcode -1:*/ ; size_t confstr(int, /*@null@*/ char *, size_t) /*@globals internalState@*/ /*@modifies errno@*/ /*:errorcode 0:*/ ; /*@dependent@*/ /*@null@*/ char *crypt(const char *, const char *) /*@modifies errno, internalState@*/ ; /*@dependent@*/ /*@null@*/ char *ctermid(/*@returned@*/ /*@null@*/ /*@out@*/ char *s) /*@modifies s@*/ ; /*@null@*/ /*@dependent@*/ char *cuserid (/*@null@*/ /*@returned@*/ char *s) /*@warn legacy "cuserid is obsolete"@*/ /*@modifies s@*/ ; int dup(int) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int dup2(int, int) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; void encrypt(char p_block[], int) /*@requires maxSet(p_block) == 63@*/ /*@modifies p_block, errno@*/ ; extern char **environ; int execl (const char *, const char *, ...) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int execle(const char *, const char *, ...) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int execlp(const char *, const char *, ...) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int execv(const char *, char *const []) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int execve(const char *, char *const [], char *const []) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int execvp(const char *, char *const []) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; /*@exits@*/ void _exit (int); int fchown (int, uid_t, gid_t) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; int fchdir (int) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; int fdatasync (int) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; pid_t fork (void) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; long int fpathconf(int, int) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int fsync(int) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; int ftruncate(int, off_t) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; /*@null@*/ char *getcwd (/*@returned@*/ char *buf, size_t size) /*@requires maxSet(buf) >= size;@*/ /*@modifies errno@*/ ; int getdtablesize (void) /*@warn legacy "getdtablesize is obsolete"@*/ ; gid_t getegid (void) /*@globals internalState*/ ; uid_t geteuid (void) /*@globals internalState*/ ; gid_t getgid (void) /*@globals internalState*/ ; int getgroups (int gidsetsize, gid_t grouplist[]) /*@requires maxSet(grouplist) >= gidsetsize@*/ /*@modifies errno@*/ /*:errorcode -1:*/ ; long gethostid (void) /*@globals internalState@*/ ; /*@null@*/ /*@dependent@*/ char *getlogin (void) /*@modifies errno@*/ ; int getlogin_r (char *name, size_t namesize) /*@requires maxSet(name) >= namesize@*/ /*:errorcode !0:*/ ; extern char *optarg; extern int optind; extern int opterr; extern int optopt; int getopt(int, char * const [], const char *) /*@modifies optind, opterr, optopt, errno@*/ /*:errorcode -1:*/ ; int getpagesize(void) /*@warn legacy "getpagesize is obsolete"@*/ ; /*@dependent@*/ /*@null@*/ char *getpass(/*@nullterminated@*/ const char *) /*@warn legacy "getpass is obsolete"@*/ ; pid_t getpgid(pid_t) /*@modifies errno@*/ /*@globals internalState@*/ /*:errorcode (pid_t)-1:*/ ; pid_t getpgrp(void) /*@globals internalState*/ ; pid_t getpid(void) /*@globals internalState*/ ; pid_t getppid(void) /*@globals internalState*/ ; pid_t getsid(pid_t) /*@modifies errno@*/ /*@globals internalState@*/ /*:errorcode (pid_t)-1:*/ ; uid_t getuid(void) /*@globals internalState@*/ ; /*@null@*/ char *getwd (/*@returned@*/ char *path_name) /*@modifies path_name@*/ ; int isatty(int) /*@globals internalState@*/ /*@modifies errno@*/ /*:errorcode 0:*/ ; int lchown(const char *, uid_t, gid_t) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; int link(const char *, const char *) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; int lockf(int, int, off_t) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; off_t lseek(int, off_t, int) /*@modifies errno, fileSystem@*/ /*:errorcode (off_t)-1:*/ ; int nice(int) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; long int pathconf(const char *, int) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int pause(void) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int pipe(int p[]) /*@requires maxRead(p) == 1@*/ /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; ssize_t pread(int, /*@out@*/ void *buf, size_t nbyte, off_t offset) /*@modifies errno, fileSystem@*/ /*@requires maxSet(buf) >= (nbyte - 1) @*/ /*@ensures maxRead(buf) >= nbyte @*/ /*:errorcode -1:*/ ; int pthread_atfork(void (*)(void), void (*)(void), void(*)(void)) /*@modifies errno, fileSystem@*/ /*:errorcode !0:*/ ; ssize_t pwrite(int, const void *buf, size_t nbyte, off_t) /*@requires maxRead(buf) >= nbyte@*/ /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; /* ssize_t read(int, void *, size_t); in posix.h */ int readlink(const char *, char *buf, size_t bufsize) /*@requires maxSet(buf) >= (bufsize - 1)@*/ /*@modifies errno, fileSystem, *buf@*/ /*:errorcode -1:*/ ; /* int rmdir(const char *); in posix.h */ void *sbrk(intptr_t) /*@modifies errno@*/ /*:errorcode (void *)-1:*/ /*@warn legacy "sbrk is obsolete"@*/ ; /* int setgid(gid_t); int setpgid(pid_t, pid_t); */ pid_t setpgrp(void) /*@modifies internalState@*/ ; int setregid(gid_t, gid_t) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; int setreuid(uid_t, uid_t) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; pid_t setsid(void) /*@modifies errno, internalState@*/ /*:errorcode (pid_t) -1:*/ ; int setuid(uid_t) /*@modifies errno, internalState@*/ /*:errorcode -1:*/ ; unsigned int sleep(unsigned int) /*@modifies systemState@*/ ; void swab(/*@unique@*/ const void *src, /*@unique@*/ void *dest, ssize_t nbytes) /*@requires maxSet(dest) >= (nbytes - 1)@*/ ; int symlink(const char *, const char *) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; void sync(void) /*@modifies systemState@*/ ; long int sysconf(int) /*@modifies errno, systemState@*/ /*:errorcode -1:*/ ; pid_t tcgetpgrp(int) /*@globals systemState@*/ /*@modifies errno@*/ /*:errorcode -1:*/ ; int tcsetpgrp(int, pid_t) /*@modifies errno, systemState@*/ /*:errorcode -1:*/ ; int truncate(const char *, off_t) /*@modifies errno, fileSystem@*/ /*:errorcode -1:*/ ; /*@dependent@*/ /*@null@*/ char *ttyname(int) /*@globals systemState@*/ /*@modifies errno@*/ /*:errorcode -1:*/ ; int ttyname_r(int, char *name, size_t namesize) /*@requires maxSet(name) >= (namesize - 1)@*/ ; /*:errorcode !0:*/ ; useconds_t ualarm(useconds_t, useconds_t) /*@modifies systemState@*/ ; int unlink(const char *) /*@modifies fileSystem, errno@*/ /*:errorcode -1:*/ ; int usleep(useconds_t) /*@modifies fileSystem, errno@*/ /*:errorcode -1:*/ ; pid_t vfork(void) /*@modifies fileSystem, errno@*/ /*:errorcode -1:*/ ; /* in posix.h ssize_t write(int, const void *, size_t); */ int chroot (/*@notnull@*/ /*@nullterminated@*/ const char *path) /*@modifies internalState, errno@*/ /*:errorcode -1:*/ /*@warn superuser "Only super-user processes may call chroot."@*/ ; int fchroot (int fildes) /*:statusreturn@*/ /*@warn superuser "Only super-user processes may call fchroot."@*/ ; /* ** ctype.h ** ** evans 2001-08-26 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/ctype.h.html */ # ifdef STRICT _Bool isascii(int) /*@*/ ; _Bool toascii(int) /*@*/ ; char _toupper(/*@sef@*/ int) /*@*/ ; char _tolower(/*@sef@*/ int) /*@*/ ; # else _Bool /*@alt int@*/ isascii(int /*@alt unsigned char@*/) /*@*/ ; _Bool /*@alt int@*/ toascii(int /*@alt unsigned char@*/); char /*@alt int@*/ _toupper(/*@sef@*/ int /*@alt unsigned char@*/); char /*@alt int@*/ _tolower(/*@sef@*/ int /*@alt unsigned char@*/); # endif /* other ctype.h functions in ansi.h */ /* ** stdlib.h ** ** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/drand48.html */ double drand48 (void) /*@modifies internalState@*/ ; double erand48 (unsigned short int /*@-fixedformalarray@*/ xsubi[3] /*@=fixedformalarray@*/ ) /*@modifies internalState@*/ ; void srand48 (long int seedval) /*@modifies internalState@*/ ; /* ** netinet/in.h ** ** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xns/netinetin.h.html */ typedef /*@unsignedintegraltype@*/ in_port_t; /* An unsigned integral type of exactly 16 bits. */ typedef /*@unsignedintegraltype@*/ in_addr_t; /* An unsigned integral type of exactly 32 bits. */ /* sa_family_t moved earlier */ struct in_addr { in_addr_t s_addr; } ; struct sockaddr_in { sa_family_t sin_family; in_port_t sin_port; struct in_addr sin_addr; unsigned char sin_zero[8]; } ; /* The header defines the following macros for use as values of the level argument of getsockopt() and setsockopt(): */ /*@constant int IPPROTO_IP@*/ /*@constant int IPPROTO_ICMP@*/ /*@constant int IPPROTO_TCP@*/ /*@constant int IPPROTO_UDP@*/ /* The header defines the following macros for use as destination addresses for connect(), sendmsg() and sendto(): */ /*@constant in_addr_t INADDR_ANY@*/ /*@constant in_addr_t INADDR_BROADCAST@*/ /* ** arpa/inet.h */ in_addr_t htonl (in_addr_t hostlong) /*@*/ ; in_port_t htons (in_port_t hostshort) /*@*/ ; in_addr_t ntohl (in_addr_t netlong) /*@*/ ; in_port_t ntohs (in_port_t netshort) /*@*/ ; /* ** dirent.h ** ** evans 2001-08-27 - added from http://www.opengroup.org/onlinepubs/007908799/xsh/dirent.h.html */ /*@-redef@*/ /*@-matchfields@*/ /* Has d_ino field, not in posix (?) */ struct dirent { ino_t d_ino; char d_name[]; } ; /*@=redef@*/ /*@=matchfields@*/ typedef /*@abstract@*/ DIR; /*:i32 need to check annotations on these */ int closedir (DIR *) /*:errorcode -1*/ ; /*@null@*/ /*@dependent@*/ DIR *opendir(const char *) /*@modifies errno, fileSystem@*/ ; /* in posix.h: struct dirent *readdir(DIR *); */ int readdir_r (DIR *, struct dirent *, /*@out@*/ struct dirent **result) /*@modifies *result@*/ /*:errorcode !0:*/ ; void rewinddir(DIR *); void seekdir(DIR *, long int); long int telldir(DIR *); /*drl added these functions stpcpy and stpncpy are found on linux but don't seem to be present on other unixes thanks to Jeff Johnson for pointing out that these functions were in the unix library */ /* this function is like strcpy but it reutrns a pointer to the null terminated character in dest instead of the beginning of dest */ extern char * stpcpy(/*@out@*/ /*@returned@*/ char * dest, const char * src) /*@modifies *dest @*/ /*@requires maxSet(dest) >= maxRead(src) @*/ /*@ensures MaxRead(dest) == MaxRead (src) /\ MaxRead(result) == 0 /\ MaxSet(result) == ( maxSet(dest) - MaxRead(src) ); @*/; extern char * stpncpy(/*@out@*/ /*@returned@*/ char * dest, const char * src, size_t n) /*@modifies *dest @*/ /*@requires MaxSet(dest) >= ( n - 1 ); @*/ /*@ensures MaxRead (src) >= MaxRead(dest) /\ MaxRead (dest) <= n; @*/ ; /* drl added 09-25-001 Alexander Ma pointed out these were missing */ int usleep (useconds_t useconds) /*@modifies systemState, errno@*/ /*error -1 sucess 0 */ /* warn opengroup unix specification recommends using setitimer(), timer_create(), timer_delete(), timer_getoverrun(), timer_gettime() or timer_settime() instead of this interface. */ ; /* drl added 10-27-001 */ /*not sure what the exact size of this is also can IPv6 use this function? */ /*I'm going to assume that the address had the format: "###.###.###.###" which is 16 bytes*/ /*@kept@*/ char *inet_ntoa(struct in_addr in) /*@ensures maxSet(result) <= 15 /\ maxRead(result) <= 15 @*/ ; extern double hypot(double x, double y) /*@modifies errno@*/ /*error errno only*/; extern double j0(double x) /*@modifies errno @*/ /*error 0 or NaN */; extern double j1(double x) /*@modifies errno @*/ /*error 0 or NaN */; extern double jn(int n, double x) /*@modifies errno @*/ /*error 0 or NaN */; extern double y0(double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */ ; extern double y1 (double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */; extern double yn (int n, double x) /*@modifies errno @*/ /*error NaN -HUGE_VAL 0.0 */; extern double acosh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno*/; extern double asinh(double x) /*@modifies errno @*/ /*error NaN and may errno */; extern double atanh(double x) /*@modifies errno @*/ /*error errno and implementation-dependent(NaN if present) */ /*error NaN and may errno */ ; extern double lgamma(double x) /*@modifies errno @*/ /*error NaN or HUGE_VAL may set errno */; extern int signgam ; extern double erf(double x) /*@modifies errno @*/ /*error NaN or 0 may set errno */; extern double erfc (double x) /*@modifies errno @*/ /*error NaN or 0 may set errno */; splint-3.1.2.dfsg1/lib/unix.lcd0000644021234200000250000030711010645776247013704 0ustar fax;;; Splint Library unix.lcd ;;Splint 3.018000 ;;lib:310 ;;ctTable 0 u-2 19 38 0 p1|-2 20 39 0 b-2 21 40 0 p3|-2 22 41 0 p4|-2 23 42 0 p5|-2 24 43 0 p6|-2 25 44 0 p7|-2 26 45 0 p8|-2 27 46 0 p9|-2 28 47 0 p10|-2 29 48 0 p11|-2 30 49 0 p12|-2 31 50 0 p13|-2 32 51 0 p14|-2 33 52 0 p15|-2 34 53 0 p16|-2 35 54 0 p17|-2 36 55 0 p18|-2 37 56 1 t0|0 485 1089 1 t1|1& 1 t2|2& 1 t3|3& 1 t4|4 486 1090 1 t5|5& 1 t6|6& 1 t7|7& 1 t8|8& 1 t9|9& 1 t10|10& 1 t11|11& 1 t12|12& 1 t13|13& 1 t14|14& 1 t15|15& 1 t16|16& 1 t17|17& 1 t18|18& 2 y0|0& 2 y1|1& 2 y2|2& 2 y3|3& 2 y4|4& 2 y5|5& 2 y6|6& 2 y7|7& 2 y8|8& 2 y9|9& 2 y10|10& 2 y11|11& 2 y12|12& 2 y13|13& 2 y14|14& 2 y15|15& 2 y16|16& 2 y17|17& 2 y18|18& -2 ?! 0 a0|& 0 s11|& 0 s12|& 0 s13|& 0 s27|& 0 s29|& 0 s30|-1 1344 -1 0 s31|& 0 s32|-1 554 -1 0 s33|& 0 a34|-1 572 -1 3 C0.5/20|! 3 C0.69/2|! 3 C0.2/5|! 3 f0 (71|@7|$#,)! 3 f1 (71|@7|$#,)! 3 C0.4/3|! 3 C0.5/74|! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f71 (75|$#,)! 3 C0.2/5|! 3 f0 (75|$#,)! 3 f2 (75|$#,)! 3 f88 (75|$#,)! 3 C0.5/74|! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f88 (92|$#,)! 3 C0.2/5|! 3 f0 (92|$#,)! 3 f2 (92|$#,)! 3 f105 (92|$#,)! 3 C0.5/74|! 3 f0 (109|$#,)! 3 f2 (109|$#,)! 3 f105 (109|$#,)! 3 C0.4/5|! 3 f0 (109|$#,)! 3 f4 (109|$#,)! 3 f113 (109|$#,)! 3 f0 (109|$#,)! 3 f4 (109|$#,)! 3 f113 (109|$#,)! 3 Slconv{23|@1|0@0@3&#decimal_point,23|@1|0@0@3&#thousands_sep,23|@1|0@0@3&#grouping,23|@1|0@0@3&#int_curr_symbol,23|@1|0@0@3&#currency_symbol,23|@1|0@0@3&#mon_decimal_point,23|@1|0@0@3&#mon_thousands_sep,23|@1|0@0@3&#mon_grouping,23|@1|0@0@3&#positive_sign,23|@1|0@0@3&#negative_sign,4|@1|^#int_frac_digits,4|@1|^#frac_digits,4|@1|^#p_cs_precedes,4|@1|^#p_sep_by_space,4|@1|^#n_cs_precedes,4|@1|^#n_sep_by_space,4|@1|^#p_sign_posn,4|@1|^#n_sign_posn,}! 0 s51|-1 127 -1 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f23 (5|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 1 t121|121& 3 f127 ()! 0 s106|& 0 s107|& 3 C0.17/18|! 3 C0.16/131|! 0 s121|& 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (133|@7|$#,)! 3 f5 (133|@7|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,24|4@0@7&#,)! 3 f17 (17|$#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,36|4@0@7&#,)! 3 f17 (17|$#,36|4@0@7&#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,9|$#,)! 3 f17 (17|$#,9|$#,)! 3 f0 (18|$#,9|$#,)! 3 f18 (18|$#,9|$#,)! 3 f0 (17|$#,)! 3 f5 (17|$#,)! 3 f0 (16|$#,)! 3 f5 (16|$#,)! 3 f0 (18|$#,)! 3 f5 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (16|$#,)! 3 f9 (16|$#,)! 3 f0 (18|$#,)! 3 f9 (18|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (16|$#,)! 3 f11 (16|$#,)! 3 f0 (18|$#,)! 3 f11 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,24|4@0@7&#,)! 3 f17 (17|$#,17|$#,24|4@0@7&#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,18|$#,)! 3 f17 (17|$#,18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,17|$#,)! 3 f17 (17|$#,17|$#,17|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 3 f0 (133|$#,133|$#,)! 3 f5 (133|$#,133|$#,)! 0 a224|& 3 f0 (338|4@0@7&#,)! 3 f5 (338|4@0@7&#,)! 3 f0 (338|$#,5|$#,)! 3 f1 (338|$#,5|$#,)! 0 s233|& 3 ?! 3 f344 (5|$#,)! 3 f1 (5|$#,)^347 1 t346|346& 3 ?! 3 f348 (5|$#,)! 3 f1 (5|$#,)^351 1 t350|350& 3 ?! 3 f352 (5|$#,)! 3 f1 (5|$#,)^355 1 t354|354& 3 ?! 3 f356 (5|$#,)! 3 f1 (5|$#,)^359 1 t358|358& 3 f0 (5|$#,359|0@5@7&#,)! 3 f19 (5|$#,359|0@5@7&#,)^362 1 t361|361& 3 ?! 3 f363 (5|$#,)! 3 f19 (5|$#,)! 3 f1 (5|$#,359|0@5@7&#,)! 3 f1 (5|$#,)! 3 f367 (5|$#,359|0@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 a239|& 3 f0 (371|4@0@7&#,!.,)! 3 f1 (371|4@0@7&#,!.,)! 3 f0 (371|$#,)! 3 f1 (371|$#,)! 3 f0 (371|4@0@7&#,371|$#,)! 3 f1 (371|4@0@7&#,371|$#,)! 0 a243|-1 380 -1 0 a244|-1 460 -1 1 t378|378& 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f19 ()! 3 f380 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|0@5@7&#,)! 3 f5 (380|0@5@7&#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f380 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,380|$#,)! 3 f19 (23|$#,23|$#,380|$#,)! 3 f380 (23|$#,23|$#,380|$#,)! 3 f0 (380|$#,23|4@5@19@2@0#,)! 3 f1 (380|$#,23|4@5@19@2@0#,)! 3 f0 (380|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f5 (380|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 C0.5/1|! 3 f0 (380|$#,23|$#,!.,)! 3 f5 (380|$#,23|$#,!.,)! 3 f405 (380|$#,23|$#,!.,)! 3 f0 (380|$#,23|$#,!.,)! 3 f5 (380|$#,23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f405 (23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f405 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|$#,371|$#,)! 3 f5 (23|$#,371|$#,)! 3 f0 (380|$#,23|$#,371|$#,)! 3 f5 (380|$#,23|$#,371|$#,)! 3 f0 (23|4@0@7&#,23|$#,371|$#,)! 3 f5 (23|4@0@7&#,23|$#,371|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,371|$#,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,371|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 f19 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 f23 (23|@5|4@0@7&#,5|$#,380|$#,)! 3 C0.5/4|! 3 f0 (436|$#,380|$#,)! 3 f5 (436|$#,380|$#,)! 3 f0 (23|$#,380|$#,)! 3 f5 (23|$#,380|$#,)! 3 f0 (380|@7|$#,)! 3 f5 (380|@7|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|4@0@7&#,)! 3 f19 (23|4@0@7&#,)! 3 f23 (23|4@0@7&#,)! 3 f0 (436|$#,380|@7|$#,)! 3 f5 (436|$#,380|@7|$#,)! 3 f0 (436|$#,)! 3 f5 (436|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (436|$#,380|$#,)! 3 f5 (436|$#,380|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f0 (20|$#,64|$#,64|$#,380|$#,)! 3 f64 (20|$#,64|$#,64|$#,380|$#,)! 1 t379|379& 3 f0 (380|$#,460|4@0@7&#,)! 3 f5 (380|$#,460|4@0@7&#,)! 3 f0 (380|$#,9|$#,5|$#,)! 3 f5 (380|$#,9|$#,5|$#,)! 3 f0 (380|$#,460|$#,)! 3 f5 (380|$#,460|$#,)! 3 f0 (380|$#,)! 3 f9 (380|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (23|0@5@7&#,)! 3 f1 (23|0@5@7&#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 1 t19|19& 1 t23|23& 3 f0 (23|$#,486|4@5@7&#,)! 3 f17 (23|$#,486|4@5@7&#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f9 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f10 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (20|4@2@2&#,)! 3 f1 (20|4@2@2&#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 ?! 3 f512 ()! 3 f1 ()^515 1 t514|514& 3 f0 (515|$#,)! 3 f5 (515|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 ?! 3 f523 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^526 1 t525|525& 3 f0 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,526|$#,)! 3 ?! 3 f530 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^533 1 t532|532& 3 f0 (20|$#,64|$#,64|$#,533|$#,)! 3 f1 (20|$#,64|$#,64|$#,533|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 S!2{5|@1|^#quot,5|@1|^#rem,}! 0 s324|& 0 s325|& 3 f0 (5|$#,5|$#,)! 3 f540 (5|$#,5|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 3 S!3{9|@1|^#quot,9|@1|^#rem,}! 0 s328|& 0 s329|& 3 f0 (9|$#,9|$#,)! 3 f547 (9|$#,9|$#,)! 3 f0 (5|$#,)! 3 f67 (5|$#,)! 3 f0 (380|$#,)! 3 f67 (380|$#,)! 1 t66|66 636 -1 3 f0 (554|@5|$#,5|$#,380|$#,)! 3 f19 (554|@5|$#,5|$#,380|$#,)! 3 f554 (554|@5|$#,5|$#,380|$#,)! 3 f0 (66|$#,380|$#,)! 3 f67 (66|$#,380|$#,)! 3 f0 (554|$#,380|$#,)! 3 f5 (554|$#,380|$#,)! 3 f0 (380|$#,5|$#,)! 3 f5 (380|$#,5|$#,)! 3 f0 (380|$#,554|$#,!.,)! 3 f5 (380|$#,554|$#,!.,)! 3 f0 (380|$#,554|$#,!.,)! 3 f5 (380|$#,554|$#,!.,)! 3 f0 (380|@7|$#,)! 3 f67 (380|@7|$#,)! 3 f0 ()! 3 f67 ()! 1 t68|68& 3 f0 (23|$#,64|$#,572|0@5@7&#,)! 3 f64 (23|$#,64|$#,572|0@5@7&#,)! 3 f0 (554|0@5@7&#,23|$#,64|$#,572|0@5@7&#,)! 3 f64 (554|0@5@7&#,23|$#,64|$#,572|0@5@7&#,)! 3 f0 (572|0@5@7&#,)! 3 f5 (572|0@5@7&#,)! 3 f0 (554|0@5@7&#,486|$#,64|$#,572|0@5@7&#,)! 3 f64 (554|0@5@7&#,486|$#,64|$#,572|0@5@7&#,)! 3 f0 (66|$#,380|@7|$#,)! 3 f67 (66|$#,380|@7|$#,)! 3 f0 (66|$#,)! 3 f67 (66|$#,)! 3 f0 (554|$#,64|$#,554|$#,!.,)! 3 f5 (554|$#,64|$#,554|$#,!.,)! 3 f0 (554|$#,554|$#,!.,)! 3 f5 (554|$#,554|$#,!.,)! 3 f0 (67|$#,380|$#,)! 3 f67 (67|$#,380|$#,)! 3 f0 (380|$#,554|$#,371|$#,)! 3 f5 (380|$#,554|$#,371|$#,)! 3 f0 (554|$#,64|$#,554|$#,371|$#,)! 3 f5 (554|$#,64|$#,554|$#,371|$#,)! 3 f0 (554|$#,371|$#,)! 3 f5 (554|$#,371|$#,)! 3 f0 (23|4@5@7&#,66|$#,572|0@5@7&#,)! 3 f64 (23|4@5@7&#,66|$#,572|0@5@7&#,)! 3 C0.1/554|! 3 f0 (554|@5|4@0@9&#,554|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,)! 3 f599 (554|@5|4@0@9&#,554|$#,)! 3 f0 (554|@5|$#,66|$#,)! 3 f19 (554|@5|$#,66|$#,)! 3 f554 (554|@5|$#,66|$#,)! 3 f0 (554|$#,554|$#,)! 3 f5 (554|$#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f5 (554|$#,554|$#,)! 3 f0 (554|@5|4@0@9&#,554|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,)! 3 f599 (554|@5|4@0@9&#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f64 (554|$#,554|$#,)! 0 s364|-1 616 -1 1 t615|615& 3 f0 (554|4@0@7&#,64|$#,554|$#,616|$#,)! 3 f64 (554|4@0@7&#,64|$#,554|$#,616|$#,)! 3 f0 (554|$#,)! 3 f64 (554|$#,)! 3 C0.1/554|! 3 f0 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f621 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f0 (554|$#,554|$#,64|$#,)! 3 f5 (554|$#,554|$#,64|$#,)! 3 f0 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f1 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f621 (554|@5|4@0@9&#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,)! 3 f19 (554|@5|$#,554|$#,)! 3 f554 (554|@5|$#,554|$#,)! 3 f0 (554|@5|$#,66|$#,)! 3 f19 (554|@5|$#,66|$#,)! 3 f554 (554|@5|$#,66|$#,)! 1 t554|554& 3 f0 (23|0@5@7&#,636|$#,64|$#,572|0@5@7&#,)! 3 f64 (23|0@5@7&#,636|$#,64|$#,572|0@5@7&#,)! 3 f0 (554|$#,554|$#,)! 3 f64 (554|$#,554|$#,)! 3 f0 (554|$#,554|$#,)! 3 f19 (554|$#,554|$#,)! 3 f554 (554|$#,554|$#,)! 3 f0 (554|$#,636|0@5@7&#,)! 3 f17 (554|$#,636|0@5@7&#,)! 3 f0 (554|0@5@7&#,554|$#,636|$#,)! 3 f19 (554|0@5@7&#,554|$#,636|$#,)! 3 f554 (554|0@5@7&#,554|$#,636|$#,)! 3 f0 (554|$#,636|0@5@7&#,5|$#,)! 3 f9 (554|$#,636|0@5@7&#,5|$#,)! 3 f0 (554|$#,636|0@5@7&#,5|$#,)! 3 f10 (554|$#,636|0@5@7&#,5|$#,)! 3 f0 (554|0@5@7&#,554|$#,64|$#,)! 3 f64 (554|0@5@7&#,554|$#,64|$#,)! 3 f0 (67|$#,)! 3 f5 (67|$#,)! 3 f0 (554|$#,66|$#,64|$#,)! 3 f19 (554|$#,66|$#,64|$#,)! 3 f554 (554|$#,66|$#,64|$#,)! 3 f0 (554|$#,554|$#,64|$#,)! 3 f5 (554|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,64|$#,)! 3 f19 (554|@5|$#,554|$#,64|$#,)! 3 f554 (554|@5|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,554|$#,64|$#,)! 3 f19 (554|@5|$#,554|$#,64|$#,)! 3 f554 (554|@5|$#,554|$#,64|$#,)! 3 f0 (554|@5|$#,66|$#,64|$#,)! 3 f19 (554|@5|$#,66|$#,64|$#,)! 3 f554 (554|@5|$#,66|$#,64|$#,)! 3 f0 (554|$#,!.,)! 3 f5 (554|$#,!.,)! 3 f0 (554|$#,!.,)! 3 f5 (554|$#,!.,)! 0 s388|& 0 s389|& 3 C0.2/5|! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,675|$#,)! 3 f2 (67|$#,675|$#,)! 3 f677 (67|$#,675|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f677 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 C0.2/5|! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f695 (67|$#,)! 3 C0.2/5|! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f712 (67|$#,)! 3 C0.67/5|! 3 f0 (67|$#,676|$#,)! 3 f67 (67|$#,676|$#,)! 3 f716 (67|$#,676|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f716 (67|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f716 (67|$#,)! 3 f0 (23|$#,)! 3 f676 (23|$#,)! 3 f0 (23|$#,)! 3 f675 (23|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (554|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (554|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! 3 f0 (554|4@5@7&#,23|$#,64|$#,)! 3 f64 (554|4@5@7&#,23|$#,64|$#,)! 3 f0 (23|4@0@7&#,554|$#,64|$#,)! 3 f64 (23|4@0@7&#,554|$#,64|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f740 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f0 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f740 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 C0.1/23|! 3 f0 (23|@5|4@0@9&#,23|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,)! 3 f747 (23|@5|4@0@9&#,23|$#,)! 3 f0 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f747 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,)! 3 f747 (23|@5|0@0@9&#,23|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f747 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f0 (20|$#,20|$#,64|$#,)! 3 f5 (20|$#,20|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (23|4@5@7&#,23|$#,64|$#,)! 3 f64 (23|4@5@7&#,23|$#,64|$#,)! 3 f0 (20|$#,5|$#,64|$#,)! 3 f19 (20|$#,5|$#,64|$#,)! 3 f20 (20|$#,5|$#,64|$#,)! 3 f0 (23|@5|$#,436|$#,)! 3 f19 (23|@5|$#,436|$#,)! 3 f23 (23|@5|$#,436|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|$#,436|$#,)! 3 f19 (23|@5|$#,436|$#,)! 3 f23 (23|@5|$#,436|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|0@5@7&#,23|$#,)! 3 f19 (23|@5|0@5@7&#,23|$#,)! 3 f23 (23|@5|0@5@7&#,23|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f792 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f64 (23|$#,)! 0 s435|& 0 s436|-1 810 -1 3 Stm{5|@1|^#tm_sec,5|@1|^#tm_min,5|@1|^#tm_hour,5|@1|^#tm_mday,5|@1|^#tm_mon,5|@1|^#tm_year,5|@1|^#tm_wday,5|@1|^#tm_yday,5|@1|^#tm_isdst,}! 3 f0 ()! 3 f801 ()! 3 f0 (802|$#,802|$#,)! 3 f17 (802|$#,802|$#,)! 3 f0 (616|$#,)! 3 f802 (616|$#,)! 1 t802|802& 3 f0 (810|4@5@7&#,)! 3 f802 (810|4@5@7&#,)! 3 f0 (616|$#,)! 3 f19 (616|$#,)! 3 f23 (616|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f23 (810|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f616 (810|$#,)! 3 f0 (810|$#,)! 3 f19 (810|$#,)! 3 f616 (810|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,616|$#,)! 3 f64 (23|4@0@7&#,64|$#,23|$#,616|$#,)! 0 s446|& 0 s447|& 0 s448|& 0 s449|& 0 s450|& 0 s451|& 0 s452|& 0 s453|& 0 s454|& 0 s455|& 0 s456|& 0 s457|& 0 s458|& 0 s459|& 0 s460|& 0 s461|& 0 s462|& 0 s463|& 0 s464|& 0 s465|& 0 s466|& 0 s467|& 0 s468|& 0 s469|& 0 s470|& 0 s471|& 0 s472|& 0 s473|& 0 s512|& 0 s513|-1 1460 1110 0 s514|& 0 s515|& 0 s516|& 0 s517|& 0 s518|& 0 s519|& 0 a520|-1 866 -1 3 Sdirent{42|@1|^#d_name,}! 0 s521|-1 874 -1 1 t863|863& 3 f0 (866|$#,)! 3 f5 (866|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f866 (23|$#,)! 3 f0 (866|$#,)! 3 f19 (866|$#,)! 1 t865|865 1924 -1 3 f874 (866|$#,)! 3 f0 (866|$#,)! 3 f1 (866|$#,)! 3 Sflock{7|@1|^#l_type,7|@1|^#l_whence,860|@1|^#l_start,860|@1|^#l_len,861|@1|^#l_pid,}! 0 s606|& 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 3 f0 (5|$#,5|$#,!.,)! 3 f5 (5|$#,5|$#,!.,)! 3 f0 (23|$#,5|$#,!.,)! 3 f5 (23|$#,5|$#,!.,)! 3 Sgroup{23|@1|0@0@3&#gr_name,856|@1|^#gr_gid,486|@1|0@0@3&#gr_mem,}! 0 s610|-1 890 -1 3 f0 (856|$#,)! 3 f19 (856|$#,)! 1 t887|887& 3 f890 (856|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f890 (23|$#,)! 3 Spasswd{23|@1|0@0@3&#pw_name,862|@1|^#pw_uid,856|@1|^#pw_gid,23|@1|0@0@3&#pw_dir,23|@1|0@0@3&#pw_shell,}! 0 s639|-1 899 -1 3 f0 (23|$#,)! 3 f19 (23|$#,)! 1 t896|896& 3 f899 (23|$#,)! 3 f0 (862|$#,)! 3 f19 (862|$#,)! 3 f899 (862|$#,)! 0 a642|& 3 f0 (904|$#,5|$#,)! 3 f1 (904|$#,5|$#,)! 3 f0 (904|4@0@7&#,5|$#,)! 3 f5 (904|4@0@7&#,5|$#,)! 0 a645|-1 956 -1 3 S!4{20|@1|0@0@3&#ss_sp,64|@1|^#ss_size,5|@1|^#ss_flags,}! 0 s646|& 0 s647|& 0 a648|& 0 s649|-1 915 -1 1 t914|914& 3 Ss_ucontext_t{915|@1|0@5@3&#uc_link,909|@1|0@0@3&#uc_sigmask,912|@1|^#uc_stack,913|@1|0@0@3&#uc_mcontext,}! 0 s650|-1 918 -1 1 t917|917& 3 f0 (918|$#,)! 3 f5 (918|$#,)! 3 f0 (918|$#,)! 3 f5 (918|$#,)! 3 ?! 3 f923 ()! 3 f1 ()^926 1 t925|925& 3 f0 (918|$#,926|$#,5|$#,!.,)! 3 f1 (918|$#,926|$#,5|$#,!.,)! 3 f0 (918|$#,918|$#,)! 3 f5 (918|$#,918|$#,)! 3 Ssigstack{5|@1|^#ss_onstack,20|@1|0@0@3&#ss_sp,}! 0 s672|& 0 s673|& 3 S!5{5|@1|^#si_signo,5|@1|^#si_errno,5|@1|^#si_code,861|@1|^#si_pid,862|@1|^#si_uid,20|@1|0@0@3&#si_addr,5|@1|^#si_status,9|@1|^#si_band,933|@1|0@0@3&#si_value,}! 0 s674|& 0 s675|-1 945 -1 3 U!6{5|@1|^#sival_int,20|@1|0@0@3&#sival_ptr,}! 0 s676|& 0 s677|& 3 ?! 3 f940 ()! 3 f1 ()^943 1 t942|942& 3 ?! 1 t936|936& 3 f944 (5|$#,945|$#,20|$#,)! 3 f1 (5|$#,945|$#,20|$#,)^948 1 t947|947& 3 Ssigaction{!943$$$@0#sa_handler,909|@1|0@0@3&#sa_mask,5|@1|^#sa_flags,!948$$$@0#sa_sigaction,}! 0 s678|-1 953 -1 3 f0 (861|$#,5|$#,)! 3 f5 (861|$#,5|$#,)! 1 t950|950& 3 f0 (5|$#,953|$#,953|4@5@7&#,)! 3 f5 (5|$#,953|$#,953|4@5@7&#,)! 1 t909|909& 3 f0 (956|$#,5|$#,)! 3 f5 (956|$#,5|$#,)! 3 f0 (956|$#,5|$#,)! 3 f5 (956|$#,5|$#,)! 3 f0 (956|4@0@7&#,)! 3 f5 (956|4@0@7&#,)! 3 f0 (956|4@0@7&#,)! 3 f5 (956|4@0@7&#,)! 3 f0 (956|$#,5|$#,)! 3 f5 (956|$#,5|$#,)! 3 f0 (956|4@0@7&#,)! 3 f5 (956|4@0@7&#,)! 3 f0 (5|$#,956|0@5@7&#,956|4@5@7&#,)! 3 f5 (5|$#,956|0@5@7&#,956|4@5@7&#,)! 3 f0 (956|$#,)! 3 f5 (956|$#,)! 3 f0 (5|$#,23|$#,)! 3 f19 (5|$#,23|$#,)! 3 f380 (5|$#,23|$#,)! 3 f0 (380|0@2@7&#,)! 3 f5 (380|0@2@7&#,)! 3 Sstat{858|@1|^#st_mode,857|@1|^#st_ino,855|@1|^#st_dev,859|@1|^#st_nlink,862|@1|^#st_uid,856|@1|^#st_gid,860|@1|^#st_size,802|@1|^#st_atime,802|@1|^#st_mtime,802|@1|^#st_ctime,}! 0 s693|-1 992 -1 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (858|@7|$#,)! 3 f2 (858|@7|$#,)! 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 1 t979|979& 3 f0 (5|$#,992|4@0@7&#,)! 3 f5 (5|$#,992|4@0@7&#,)! 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 3 f0 (23|$#,858|$#,)! 3 f5 (23|$#,858|$#,)! 3 f0 (23|$#,992|4@0@7&#,)! 3 f5 (23|$#,992|4@0@7&#,)! 3 f0 (858|$#,)! 3 f5 (858|$#,)! 3 Stms{801|@1|^#tms_utime,801|@1|^#tms_stime,801|@1|^#tms_cutime,801|@1|^#tms_cstime,}! 0 s705|-1 1005 -1 1 t1004|1004& 3 f0 (1005|4@0@7&#,)! 3 f801 (1005|4@0@7&#,)! 3 Sutsname{42|@1|^#sysname,42|@1|^#nodename,42|@1|^#release,42|@1|^#version,42|@1|^#machine,}! 0 s707|-1 1010 -1 1 t1009|1009& 3 f0 (1010|4@0@7&#,)! 3 f5 (1010|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (24|4@5@7&#,)! 3 f861 (24|4@5@7&#,)! 3 f0 (861|$#,24|4@5@7&#,5|$#,)! 3 f861 (861|$#,24|4@5@7&#,5|$#,)! 3 C0.4/8|! 3 C0.3/8|! 0 s720|& 3 C0.9/9|! 3 C0.10/9|! 0 s721|& 0 s722|& 3 Stermios{1035|@1|^#c_iflag,1035|@1|^#c_oflag,1035|@1|^#c_cflag,1035|@1|^#c_lflag,1031|@1|^#c_cc,}! 0 s791|-1 1038 -1 1 t1037|1037& 3 f0 (1038|$#,)! 3 f1034 (1038|$#,)! 3 f0 (1038|$#,)! 3 f1034 (1038|$#,)! 3 f0 (1038|$#,)! 3 f5 (1038|$#,)! 3 f0 (1038|$#,)! 3 f5 (1038|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,1038|4@0@7&#,)! 3 f5 (5|$#,1038|4@0@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,1038|$#,)! 3 f5 (5|$#,5|$#,1038|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,862|$#,856|$#,)! 3 f5 (23|$#,862|$#,856|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|4@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 2 y19|19& 2 y23|23& 3 f0 (23|$#,1090|$#,)! 3 f5 (23|$#,1090|$#,)! 3 f0 (23|$#,1090|$#,486|$#,)! 3 f5 (23|$#,1090|$#,486|$#,)! 3 f0 (23|$#,1090|$#,)! 3 f5 (23|$#,1090|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (5|$#,5|$#,)! 3 f9 (5|$#,5|$#,)! 3 f0 (23|@5|4@2@7&#,64|$#,)! 3 f19 (23|@5|4@2@7&#,64|$#,)! 3 f23 (23|@5|4@2@7&#,64|$#,)! 3 f0 ()! 3 f856 ()! 3 f0 ()! 3 f862 ()! 3 f0 ()! 3 f856 ()! 2 y856|856& 3 f0 (5|$#,1110|4@0@7&#,)! 3 f5 (5|$#,1110|4@0@7&#,)! 3 f0 ()! 3 f19 ()! 3 f23 ()! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f862 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (5|$#,860|$#,5|$#,)! 3 f860 (5|$#,860|$#,5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f9 (23|$#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (43|4@0@7&#,)! 3 f5 (43|4@0@7&#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (856|$#,)! 3 f5 (856|$#,)! 3 f0 (861|$#,861|$#,)! 3 f5 (861|$#,861|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (862|$#,)! 3 f5 (862|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (5|$#,)! 3 f9 (5|$#,)! 3 f0 (5|$#,)! 3 f861 (5|$#,)! 3 f0 (5|$#,861|$#,)! 3 f5 (5|$#,861|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (5|$#,20|$#,64|$#,)! 3 f65 (5|$#,20|$#,64|$#,)! 3 Sutimbuf{802|@1|^#actime,802|@1|^#modtime,}! 0 s883|-1 1165 -1 1 t1164|1164& 3 f0 (23|$#,1165|0@5@7&#,)! 3 f5 (23|$#,1165|0@5@7&#,)! 0 a885|-1 1173 -1 0 s886|& 3 S!7{1169|@1|^#rm_so,1169|@1|^#rm_eo,}! 0 s887|& 0 s888|-1 -1 1176 1 t1168|1168& 3 f0 (1173|4@0@7&#,23|$#,5|$#,)! 3 f5 (1173|4@0@7&#,23|$#,5|$#,)! 2 y1172|1172& 3 f0 (1173|$#,23|$#,64|$#,1176|4@0@7&#,5|$#,)! 3 f5 (1173|$#,23|$#,64|$#,1176|4@0@7&#,5|$#,)! 3 f0 (5|$#,1173|$#,23|4@0@7&#,64|$#,)! 3 f64 (5|$#,1173|$#,23|4@0@7&#,64|$#,)! 3 f0 (1173|0@0@2&#,)! 3 f1 (1173|0@0@2&#,)! 0 s925|& 0 s926|& 0 s927|& 0 s928|& 0 s929|& 0 s930|& 0 s931|& 0 s932|& 0 s933|& 0 s934|& 0 s935|& 0 s936|& 0 s937|& 0 s938|& 0 s939|& 0 s940|& 0 s941|& 0 s942|& 0 s943|& 0 s944|& 3 f0 (23|$#,23|4@0@7&#,5|$#,)! 3 f1 (23|$#,23|4@0@7&#,5|$#,)! 3 C0.5/2|! 3 f0 (23|$#,23|$#,5|$#,)! 3 f5 (23|$#,23|$#,5|$#,)! 3 f1205 (23|$#,23|$#,5|$#,)! 3 f0 (23|4@0@7&#,5|$#,)! 3 f1 (23|4@0@7&#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (380|$#,23|0@5@19@2@0#,5|$#,64|$#,)! 3 f5 (380|$#,23|0@5@19@2@0#,5|$#,64|$#,)! 3 f0 (380|$#,23|0@5@19@2@0#,5|$#,)! 3 f1 (380|$#,23|0@5@19@2@0#,5|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (5|$#,23|4@0@7&#,5|$#,)! 3 f5 (5|$#,23|4@0@7&#,5|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,380|$#,)! 3 f0 (20|$#,64|$#,64|$#,380|$#,)! 3 f64 (20|$#,64|$#,64|$#,380|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,20|0@0@9&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|0@0@9&#,5|$#,64|$#,)! 3 f1227 (20|@5|4@0@7&#,20|0@0@9&#,5|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,5|$#,)! 3 f5 (23|$#,23|$#,5|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 ()! 3 f1 ()! 0 s1064|& 0 s1065|& 0 s1066|& 0 s1067|& 0 s1068|& 0 s1069|& 0 s1070|& 0 s1071|& 0 s1072|& 0 s1073|& 0 s1074|& 0 s1075|& 0 s1076|& 0 s1077|& 0 s1078|& 0 s1079|& 0 s1080|& 0 s1081|& 0 s1082|& 2 F0/12|0& 2 F4/12|4& 0 s1083|& 0 s1084|& 0 s1085|& 0 s1086|& 0 s1087|& 0 s1088|-1 1496 -1 0 s1089|& 0 s1090|& 0 s1091|& 0 s1092|& 0 s1093|& 0 s1094|& 0 s1095|& 0 s1096|& 0 s1097|& 0 s1098|& 0 s1099|& 0 s1100|& 0 s1101|& 0 a1102|-1 1428 -1 3 C0.5/9|! 3 f0 (5|$#,1287|$#,20|4@0@7&#,)! 3 f5 (5|$#,1287|$#,20|4@0@7&#,)! 3 f0 ()! 3 f861 ()! 3 Siovec{20|@1|0@0@18&#iov_base,64|@1|^#iov_len,}! 0 s1105|-1 1294 -1 1 t1293|1293& 3 f0 (5|$#,1294|$#,5|$#,)! 3 f65 (5|$#,1294|$#,5|$#,)! 3 f0 (5|$#,1294|$#,5|$#,)! 3 f65 (5|$#,1294|$#,5|$#,)! 3 Spoll{5|@1|^#fd,7|@1|^#events,7|@1|^#revents,}! 0 s1110|-1 -1 1301 2 y1300|1300& 3 f0 (1301|$#,10|$#,5|$#,)! 3 f5 (1301|$#,10|$#,5|$#,)! 3 f0 (20|4@2@2&#,)! 3 f1 (20|4@2@2&#,)! 0 s1191|& 0 s1192|& 0 s1193|-1 1337 -1 3 Ssockaddr{1306|@1|^#sa_family,42|@1|^#sa_data,}! 0 s1194|-1 1330 -1 3 Ssockaddr_storage{1306|@1|^#ss_family,}! 0 s1195|& 3 Smsghdr{20|@1|0@0@18&#msg_name,1308|@1|^#msg_namelen,1294|@1|0@0@18&#msg_iov,5|@1|^#msg_iovlen,20|@1|0@0@18&#msg_control,1308|@1|^#msg_controllen,5|@1|^#msg_flags,}! 0 s1196|-1 1321 -1 3 Scmsghdr{1308|@1|^#cmsg_len,5|@1|^#cmsg_level,5|@1|^#cmsg_type,}! 0 s1197|-1 1317 -1 1 t1316|1316& 3 f0 (1317|@7|$#,)! 3 f19 (1317|@7|$#,)! 3 f22 (1317|@7|$#,)! 1 t1314|1314& 3 f0 (1321|$#,1317|$#,)! 3 f19 (1321|$#,1317|$#,)! 3 f1317 (1321|$#,1317|$#,)! 3 f0 (1321|$#,)! 3 f19 (1321|$#,)! 3 f1317 (1321|$#,)! 3 Slinger{5|@1|^#l_onoff,5|@1|^#l_linger,}! 0 s1202|& 1 t1310|1310& 3 f0 (5|$#,1330|$#,24|$#,)! 3 f5 (5|$#,1330|$#,24|$#,)! 3 f0 (5|$#,1330|$#,5|$#,)! 3 f5 (5|$#,1330|$#,5|$#,)! 3 f0 (5|$#,1330|$#,5|$#,)! 3 f5 (5|$#,1330|$#,5|$#,)! 1 t1308|1308& 3 f0 (5|$#,1330|4@0@7&#,1337|$#,)! 3 f5 (5|$#,1330|4@0@7&#,1337|$#,)! 3 C0.1308/64|! 3 C0.1337/64|! 3 f0 (5|$#,1330|4@0@7&#,1341|$#,)! 3 f5 (5|$#,1330|4@0@7&#,1341|$#,)! 1 t64|64& 3 f0 (5|$#,5|$#,5|$#,20|4@0@7&#,1344|$#,)! 3 f5 (5|$#,5|$#,5|$#,20|4@0@7&#,1344|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,5|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,1330|0@5@7&#,24|$#,)! 3 f65 (5|$#,20|$#,64|$#,5|$#,1330|0@5@7&#,24|$#,)! 3 f0 (5|$#,1321|$#,5|$#,)! 3 f65 (5|$#,1321|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,)! 3 f65 (5|$#,20|$#,64|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,1330|$#,5|$#,)! 3 f65 (5|$#,20|$#,64|$#,5|$#,1330|$#,5|$#,)! 3 f0 (5|$#,1321|$#,5|$#,)! 3 f65 (5|$#,1321|$#,5|$#,)! 3 f0 (5|$#,5|$#,5|$#,20|$#,5|$#,)! 3 f5 (5|$#,5|$#,5|$#,20|$#,5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,5|$#,)! 3 f5 (5|$#,5|$#,5|$#,)! 3 f0 (5|$#,5|$#,5|$#,24|4@0@7&#,)! 3 f5 (5|$#,5|$#,5|$#,24|4@0@7&#,)! 3 f0 (5|$#,23|$#,)! 3 f1 (5|$#,23|$#,)! 3 f0 (23|$#,23|$#,5|$#,)! 3 f5 (23|$#,23|$#,5|$#,)! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 s1284|-1 1382 -1 1 t1381|1381& 3 f0 (24|$#,5|$#,1382|4@5@7&#,)! 3 f861 (24|$#,5|$#,1382|4@5@7&#,)! 3 f0 (861|$#,24|$#,5|$#,1382|4@5@7&#,)! 3 f861 (861|$#,24|$#,5|$#,1382|4@5@7&#,)! 3 Stimeval{9|@1|^#tv_sec,9|@1|^#tv_usec,}! 0 s1287|-1 1397 -1 3 Stimespec{9|@1|^#ts_sec,9|@1|^#ts_nsec,}! 0 s1288|& 3 Stimezone{5|@1|^#tz_minuteswest,5|@1|^#tz_dsttime,}! 0 s1289|-1 1403 -1 3 Sitimerval{1388|@1|^#it_interval,1388|@1|^#it_value,}! 0 s1300|-1 1400 -1 3 Sclockinfo{5|@1|^#hz,5|@1|^#tick,5|@1|^#stathz,5|@1|^#profhz,}! 0 s1301|& 1 t1388|1388& 3 f0 (1397|$#,1397|4@5@7&#,)! 3 f5 (1397|$#,1397|4@5@7&#,)! 1 t1394|1394& 3 f0 (5|$#,1400|4@0@7&#,)! 3 f5 (5|$#,1400|4@0@7&#,)! 1 t1392|1392& 3 f0 (1397|4@5@7&#,1403|4@5@7&#,)! 3 f5 (1397|4@5@7&#,1403|4@5@7&#,)! 3 f0 (5|$#,1400|$#,1400|4@5@7&#,)! 3 f5 (5|$#,1400|$#,1400|4@5@7&#,)! 3 f0 (1397|$#,1403|$#,)! 3 f5 (1397|$#,1403|$#,)! 3 f0 (23|$#,1397|0@5@7&#,)! 3 f5 (23|$#,1397|0@5@7&#,)! 3 f0 (1257|@5|0@5@7&#,64|$#,5|$#,5|$#,5|$#,860|$#,)! 3 f1257 (1257|@5|0@5@7&#,64|$#,5|$#,5|$#,5|$#,860|$#,)! 3 f0 (1257|$#,5|$#,5|$#,)! 3 f5 (1257|$#,5|$#,5|$#,)! 3 f0 (1257|$#,5|$#,5|$#,)! 3 f5 (1257|$#,5|$#,5|$#,)! 3 f0 (1257|0@0@2&#,64|$#,)! 3 f5 (1257|0@0@2&#,64|$#,)! 3 f0 (1257|$#,5|$#,5|$#,)! 3 f5 (1257|$#,5|$#,5|$#,)! 3 f0 (1257|$#,64|$#,)! 3 f5 (1257|$#,64|$#,)! 3 f0 (1257|$#,64|$#,)! 3 f5 (1257|$#,64|$#,)! 3 Swinsize{8|@1|^#ws_row,8|@1|^#ws_col,8|@1|^#ws_xpixel,8|@1|^#ws_ypixel,}! 0 s1336|& 1 t1286|1286& 3 f0 (5|@7|$#,1428|@7|$#,)! 3 f1 (5|@7|$#,1428|@7|$#,)! 3 f0 (1428|@7|$#,1428|4@0@7&#,)! 3 f1 (1428|@7|$#,1428|4@0@7&#,)! 3 f0 (5|@7|$#,1428|@7|$#,)! 3 f5 (5|@7|$#,1428|@7|$#,)! 3 f1205 (5|@7|$#,1428|@7|$#,)! 3 f0 (5|@7|$#,1428|@7|$#,)! 3 f1 (5|@7|$#,1428|@7|$#,)! 3 f0 (1428|@7|4@0@7&#,)! 3 f1 (1428|@7|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,862|$#,856|$#,)! 3 f5 (5|$#,862|$#,856|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,860|$#,)! 3 f5 (5|$#,860|$#,)! 3 f0 (23|4@0@7&#,64|$#,)! 3 f5 (23|4@0@7&#,64|$#,)! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (23|$#,862|$#,856|$#,)! 3 f5 (23|$#,862|$#,856|$#,)! 3 f0 (5|$#,1428|0@5@7&#,1428|0@5@7&#,1428|0@5@7&#,1397|0@5@7&#,)! 3 f5 (5|$#,1428|0@5@7&#,1428|0@5@7&#,1428|0@5@7&#,1397|0@5@7&#,)! 3 f0 (856|$#,)! 3 f5 (856|$#,)! 3 f0 (862|$#,)! 3 f5 (862|$#,)! 1 t856|856& 3 f0 (5|$#,1460|$#,)! 3 f5 (5|$#,1460|$#,)! 3 f0 (856|$#,856|$#,)! 3 f5 (856|$#,856|$#,)! 3 f0 (856|$#,856|$#,)! 3 f5 (856|$#,856|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,860|$#,)! 3 f5 (23|$#,860|$#,)! 3 Sipc_perm{862|@1|^#uid,856|@1|^#gid,862|@1|^#cuid,856|@1|^#cgid,858|@1|^#mode,1274|@1|^#seq,1189|@1|^#key,}! 0 s1457|& 0 s1468|-1 1476 -1 1 t1475|1475& 3 Smsqid_ds{1474|@1|^#msg_perm,1476|@1|0@0@3&#msg_first,1476|@1|0@0@3&#msg_last,1278|@1|^#msg_cbytes,1278|@1|^#msg_qnum,1278|@1|^#msg_qbytes,861|@1|^#msg_lspid,861|@1|^#msg_lrpid,802|@1|^#msg_stime,802|@1|^#msg_rtime,802|@1|^#msg_ctime,}! 0 s1469|-1 1481 -1 3 Smymesg{9|@1|^#mtype,42|@1|^#mtext,}! 0 s1470|& 1 t1478|1478& 3 f0 (5|$#,5|$#,1481|4@0@7&#,)! 3 f5 (5|$#,5|$#,1481|4@0@7&#,)! 3 f0 (1189|$#,5|$#,)! 3 f5 (1189|$#,5|$#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,9|$#,5|$#,)! 3 f5 (5|$#,20|4@0@7&#,64|$#,9|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,)! 3 f5 (5|$#,20|$#,64|$#,5|$#,)! 0 s1480|-1 1491 -1 1 t1490|1490& 3 Ssemid_ds{1474|@1|^#sem_perm,1491|@1|0@0@3&#sem_base,1272|@1|^#sem_nsems,802|@1|^#sem_otime,802|@1|^#sem_ctime,}! 0 s1481|-1 1495 -1 3 Ssem{1272|@1|^#semval,861|@1|^#sempid,1272|@1|^#semncnt,1272|@1|^#semzcnt,}! 1 t1493|1493& 1 t1272|1272& 3 Usemun{5|@1|^#val,1495|@1|0@0@3&#buf,1496|@1|0@0@3&#array,}! 0 s1482|& 3 Ssembuf{1272|@1|^#sem_num,7|@1|^#sem_op,7|@1|^#sem_flg,}! 0 s1483|-1 1505 -1 3 f0 (5|$#,5|$#,5|$#,1498|$#,)! 3 f5 (5|$#,5|$#,5|$#,1498|$#,)! 3 f0 (1189|$#,5|$#,5|$#,)! 3 f5 (1189|$#,5|$#,5|$#,)! 1 t1500|1500& 3 f0 (5|$#,1505|$#,64|$#,)! 3 f5 (5|$#,1505|$#,64|$#,)! 3 Sshmid_ds{1474|@1|^#shm_perm,5|@1|^#shm_segsz,1272|@1|^#shm_lkcnt,861|@1|^#shm_lpid,861|@1|^#shm_cpid,1274|@1|^#shm_nattch,1274|@1|^#shm_cnattch,802|@1|^#shm_atime,802|@1|^#shm_dtime,802|@1|^#shm_ctime,}! 0 s1506|-1 1513 -1 3 f0 (5|$#,20|0@5@7&#,5|$#,)! 3 f19 (5|$#,20|0@5@7&#,5|$#,)! 3 f20 (5|$#,20|0@5@7&#,5|$#,)! 1 t1509|1509& 3 f0 (5|$#,5|$#,1513|4@0@7&#,)! 3 f5 (5|$#,5|$#,1513|4@0@7&#,)! 3 f0 (20|$#,)! 3 f5 (20|$#,)! 3 f0 (1189|$#,5|$#,5|$#,)! 3 f5 (1189|$#,5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (23|$#,5|$#,5|$#,)! 3 f1 (23|$#,5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,23|$#,!.,)! 3 f1 (5|$#,23|$#,!.,)! 3 f0 (5|$#,23|$#,371|$#,)! 3 f1 (5|$#,23|$#,371|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 ()! 3 f19 ()! 3 f899 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 ()! 3 f1 ()! 3 f0 ()! 3 f19 ()! 3 f890 ()! 3 f0 ()! 3 f5 ()! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 Sstat{855|@1|^#st_dev,857|@1|^#st_ino,858|@1|^#st_mode,859|@1|^#st_nlink,862|@1|^#st_uid,856|@1|^#st_gid,855|@1|^#st_rdev,860|@1|^#st_size,802|@1|^#st_atime,802|@1|^#st_mtime,802|@1|^#st_ctime,1184|@1|^#st_blksize,1183|@1|^#st_blocks,}! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1205 (0|@7|$#,)! 3 f2 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1205 (0|@7|$#,)! 3 f2 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1205 (0|@7|$#,)! 3 f2 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1205 (0|@7|$#,)! 3 f2 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1205 (0|@7|$#,)! 3 f2 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1205 (0|@7|$#,)! 3 f0 (992|@7|$#,)! 3 f5 (992|@7|$#,)! 3 f1205 (992|@7|$#,)! 3 f0 (992|@7|$#,)! 3 f5 (992|@7|$#,)! 3 f1205 (992|@7|$#,)! 3 f0 (992|@7|$#,)! 3 f5 (992|@7|$#,)! 3 f1205 (992|@7|$#,)! 3 f0 (23|$#,992|4@0@7&#,)! 3 f5 (23|$#,992|4@0@7&#,)! 3 f0 (23|$#,858|$#,855|$#,)! 3 f5 (23|$#,858|$#,855|$#,)! 3 f0 (23|$#,1278|$#,)! 3 f5 (23|$#,1278|$#,)! 3 f0 (5|$#,1278|$#,)! 3 f5 (5|$#,1278|$#,)! 3 f0 (5|$#,858|$#,)! 3 f5 (5|$#,858|$#,)! 3 Sstatvfs{10|@1|^#f_bsize,10|@1|^#f_frsize,1186|@1|^#f_blocks,1186|@1|^#f_bfree,1186|@1|^#f_bavail,1187|@1|^#f_files,1187|@1|^#f_ffree,1187|@1|^#f_favail,10|@1|^#f_fsid,10|@1|^#f_flag,10|@1|^#f_namemax,}! 0 s1584|-1 1599 -1 1 t1598|1598& 3 f0 (5|$#,1599|4@0@7&#,)! 3 f5 (5|$#,1599|4@0@7&#,)! 3 f0 (23|$#,1599|4@0@7&#,)! 3 f5 (23|$#,1599|4@0@7&#,)! 3 Sstrbuf{5|@1|^#maxlen,5|@1|^#len,23|@1|0@0@3&#buf,}! 0 s1604|-1 1611 -1 3 Sstr_mlist{42|@1|^#l_name,}! 0 s1605|-1 1608 -1 1 t1607|1607& 3 Sstr_list{5|@1|^#sl_nmods,1608|@1|0@0@3&#sl_modlist,}! 0 s1606|& 1 t1605|1605& 3 f0 (5|$#,1611|4@0@7&#,1611|4@0@7&#,24|$#,)! 3 f5 (5|$#,1611|4@0@7&#,1611|4@0@7&#,24|$#,)! 3 f0 (5|$#,1611|4@0@7&#,1611|4@0@7&#,24|$#,24|$#,)! 3 f5 (5|$#,1611|4@0@7&#,1611|4@0@7&#,24|$#,24|$#,)! 3 f0 (5|$#,1611|$#,1611|$#,24|$#,)! 3 f5 (5|$#,1611|$#,1611|$#,24|$#,)! 3 f0 (5|$#,1611|$#,1611|$#,5|$#,24|$#,)! 3 f5 (5|$#,1611|$#,1611|$#,5|$#,24|$#,)! 0 s1614|& 3 Srlimit{1620|@1|^#rlim_cur,1620|@1|^#rlim_max,}! 0 s1620|-1 1626 -1 3 Srusage{1388|@1|^#ru_utime,1388|@1|^#ru_stime,}! 3 f0 (5|$#,1188|$#,)! 3 f5 (5|$#,1188|$#,)! 1 t1622|1622& 3 f0 (5|$#,1626|4@0@7&#,)! 3 f5 (5|$#,1626|4@0@7&#,)! 3 f0 (5|$#,1382|4@0@7&#,)! 3 f5 (5|$#,1382|4@0@7&#,)! 3 f0 (5|$#,1188|$#,5|$#,)! 3 f5 (5|$#,1188|$#,5|$#,)! 3 f0 (5|$#,1626|$#,)! 3 f5 (5|$#,1626|$#,)! 3 Sservent{23|@1|0@0@18@3@0#s_name,486|@1|0@0@18@3@0#s_aliases,5|@1|^#s_port,23|@1|0@0@18@3@0#s_proto,}! 0 s1633|-1 1639 -1 3 f0 (23|$#,23|0@5@7&#,)! 3 f19 (23|$#,23|0@5@7&#,)! 1 t1636|1636& 3 f1639 (23|$#,23|0@5@7&#,)! 3 f0 (23|$#,23|0@5@7&#,1639|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f19 (23|$#,23|0@5@7&#,1639|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f1639 (23|$#,23|0@5@7&#,1639|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f1639 (5|$#,23|0@5@7&#,)! 3 f0 (5|$#,23|0@5@7&#,1639|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f19 (5|$#,23|0@5@7&#,1639|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f1639 (5|$#,23|0@5@7&#,1639|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f0 ()! 3 f19 ()! 3 f1639 ()! 3 f0 (1639|$#,23|$#,5|$#,)! 3 f19 (1639|$#,23|$#,5|$#,)! 3 f1639 (1639|$#,23|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f5 ()! 0 s1643|-1 1663 -1 3 f0 (23|0@2@7&#,)! 3 f19 (23|0@2@7&#,)! 1 t1660|1660& 3 f1663 (23|0@2@7&#,)! 3 f0 (23|$#,1663|@5|0@2@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f19 (23|$#,1663|@5|0@2@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f1663 (23|$#,1663|@5|0@2@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f0 (20|0@2@7&#,64|$#,5|$#,)! 3 f19 (20|0@2@7&#,64|$#,5|$#,)! 3 f1663 (20|0@2@7&#,64|$#,5|$#,)! 3 f0 (20|0@2@7&#,64|$#,5|$#,1663|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f19 (20|0@2@7&#,64|$#,5|$#,1663|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f1663 (20|0@2@7&#,64|$#,5|$#,1663|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f0 ()! 3 f19 ()! 3 f1663 ()! 3 f0 (1663|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,)! 3 f19 (1663|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,)! 3 f1663 (1663|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,)! 3 f0 (380|$#,)! 3 f19 (380|$#,)! 3 f1663 (380|$#,)! 3 f0 (380|$#,1663|$#,4|$#,5|$#,)! 3 f19 (380|$#,1663|$#,4|$#,5|$#,)! 3 f1663 (380|$#,1663|$#,4|$#,5|$#,)! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 Shostent{23|@1|0@0@18@3@0#h_name,486|@1|0@0@18@3@0#h_aliases,5|@1|^#h_addrtype,5|@1|^#h_length,486|@1|0@0@18@3@0#h_addr_list,23|@1|0@0@18@3@0#h_addr,}! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (20|$#,)! 3 f5 (20|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,862|$#,856|$#,)! 3 f5 (23|$#,862|$#,856|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,23|0@5@7&#,64|$#,)! 3 f64 (5|$#,23|0@5@7&#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f23 (23|$#,23|$#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|@5|0@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (42|$#,5|$#,)! 3 f1 (42|$#,5|$#,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,1090|$#,)! 3 f5 (23|$#,1090|$#,)! 3 f0 (23|$#,1090|$#,1090|$#,)! 3 f5 (23|$#,1090|$#,1090|$#,)! 3 f0 (23|$#,1090|$#,)! 3 f5 (23|$#,1090|$#,)! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 (5|$#,862|$#,856|$#,)! 3 f5 (5|$#,862|$#,856|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (5|$#,5|$#,)! 3 f9 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,860|$#,)! 3 f5 (5|$#,860|$#,)! 3 f0 (23|@5|$#,64|$#,)! 3 f19 (23|@5|4@2@7&#,64|$#,)! 3 f23 (23|@5|4@2@7&#,64|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 ()! 3 f856 ()! 3 f0 ()! 3 f862 ()! 3 f0 ()! 3 f856 ()! 3 f0 (5|$#,1110|4@0@7&#,)! 3 f5 (5|$#,1110|4@0@7&#,)! 3 f0 ()! 3 f9 ()! 3 f0 ()! 3 f19 ()! 3 f23 ()! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (5|$#,1090|$#,23|$#,)! 3 f5 (5|$#,1090|$#,23|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (861|$#,)! 3 f861 (861|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f861 ()! 3 f0 ()! 3 f861 ()! 3 f0 (861|$#,)! 3 f861 (861|$#,)! 3 f0 ()! 3 f862 ()! 3 f0 (23|@5|$#,)! 3 f19 (23|@5|$#,)! 3 f23 (23|@5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,862|$#,856|$#,)! 3 f5 (23|$#,862|$#,856|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (5|$#,5|$#,860|$#,)! 3 f5 (5|$#,5|$#,860|$#,)! 3 f0 (5|$#,860|$#,5|$#,)! 3 f860 (5|$#,860|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f9 (23|$#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (43|4@0@7&#,)! 3 f5 (43|4@0@7&#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,860|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,860|$#,)! 3 ?! 3 f1815 ()! 3 f1 ()^1818 1 t1817|1817& 3 ?! 3 f1819 ()! 3 f1 ()^1822 1 t1821|1821& 3 ?! 3 f1823 ()! 3 f1 ()^1826 1 t1825|1825& 3 f0 (1818|$#,1822|$#,1826|$#,)! 3 f5 (1818|$#,1822|$#,1826|$#,)! 3 f0 (5|$#,20|$#,64|$#,860|$#,)! 3 f65 (5|$#,20|$#,64|$#,860|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (851|$#,)! 3 f19 (851|$#,)! 3 f20 (851|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (856|$#,856|$#,)! 3 f5 (856|$#,856|$#,)! 3 f0 (862|$#,862|$#,)! 3 f5 (862|$#,862|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (862|$#,)! 3 f5 (862|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (20|0@0@9&#,20|0@0@9&#,65|$#,)! 3 f1 (20|0@0@9&#,20|0@0@9&#,65|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f9 (5|$#,)! 3 f0 (5|$#,)! 3 f861 (5|$#,)! 3 f0 (5|$#,861|$#,)! 3 f5 (5|$#,861|$#,)! 3 f0 (23|$#,860|$#,)! 3 f5 (23|$#,860|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (5|$#,23|$#,64|$#,)! 3 f5 (5|$#,23|$#,64|$#,)! 3 f0 (1202|$#,1202|$#,)! 3 f1202 (1202|$#,1202|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (1202|$#,)! 3 f5 (1202|$#,)! 3 f0 ()! 3 f861 ()! 3 f0 (23|0@2@7&#,)! 3 f5 (23|0@2@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 C0.2/5|! 3 C0.5/3|! 3 f0 (1880|$#,)! 3 f2 (1880|$#,)! 3 f1879 (1880|$#,)! 3 f0 (1880|$#,)! 3 f2 (1880|$#,)! 3 f1879 (1880|$#,)! 3 C0.4/5|! 3 f0 (1880|@7|$#,)! 3 f4 (1880|@7|$#,)! 3 f1887 (1880|@7|$#,)! 3 f0 (1880|@7|$#,)! 3 f4 (1880|@7|$#,)! 3 f1887 (1880|@7|$#,)! 3 f0 ()! 3 f17 ()! 2 F0/3|0& 2 F8/3|8& 3 f0 (1897|$#,)! 3 f17 (1897|$#,)! 3 f0 (9|$#,)! 3 f1 (9|$#,)! 0 s1792|& 0 s1793|& 3 Sin_addr{1903|@1|^#s_addr,}! 0 s1794|& 2 F0/8|0& 2 F3/8|3& 3 Ssockaddr_in{1306|@1|^#sin_family,1902|@1|^#sin_port,1905|@1|^#sin_addr,1907|@1|^#sin_zero,}! 0 s1795|& 3 f0 (1903|$#,)! 3 f1903 (1903|$#,)! 3 f0 (1902|$#,)! 3 f1902 (1902|$#,)! 3 f0 (1903|$#,)! 3 f1903 (1903|$#,)! 3 f0 (1902|$#,)! 3 f1902 (1902|$#,)! 3 Sdirent{857|@1|^#d_ino,42|@1|^#d_name,}! 3 f0 (866|$#,)! 3 f5 (866|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f866 (23|$#,)! 1 t874|874& 3 f0 (866|$#,874|$#,1924|4@0@7&#,)! 3 f5 (866|$#,874|$#,1924|4@0@7&#,)! 3 f0 (866|$#,)! 3 f1 (866|$#,)! 3 f0 (866|$#,9|$#,)! 3 f1 (866|$#,9|$#,)! 3 f0 (866|$#,)! 3 f9 (866|$#,)! 3 f0 (23|@5|4@0@7&#,23|$#,)! 3 f19 (23|@5|4@0@7&#,23|$#,)! 3 f23 (23|@5|4@0@7&#,23|$#,)! 3 f0 (23|@5|4@0@7&#,23|$#,64|$#,)! 3 f19 (23|@5|4@0@7&#,23|$#,64|$#,)! 3 f23 (23|@5|4@0@7&#,23|$#,64|$#,)! 3 f0 (1202|$#,)! 3 f5 (1202|$#,)! 3 f0 (1905|$#,)! 3 f19 (1905|$#,)! 3 f23 (1905|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (5|$#,17|$#,)! 3 f17 (5|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (5|$#,17|$#,)! 3 f17 (5|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (23|@5|0@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,23|$#,)! 3 f19 (5|$#,23|$#,)! 3 f380 (5|$#,23|$#,)! 3 f0 (380|0@2@7&#,)! 3 f5 (380|0@2@7&#,)! 3 f0 (380|0@2@7&#,)! 3 f1 (380|0@2@7&#,)! 3 f0 (380|$#,860|$#,5|$#,)! 3 f5 (380|$#,860|$#,5|$#,)! 3 f0 (380|$#,)! 3 f860 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (5|$#,486|$#,23|$#,)! 3 f5 (5|$#,486|$#,23|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (380|$#,)! 3 f5 (380|$#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f380 (23|$#,23|$#,)! 3 f0 (5|$#,380|$#,)! 3 f5 (5|$#,380|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,380|$#,)! 3 f5 (5|$#,380|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (380|$#,)! 3 f1 (380|$#,)! 3 f0 (23|$#,23|0@5@7&#,)! 3 f19 (23|$#,23|0@5@7&#,)! 3 f23 (23|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 3 f380 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 ?! 3 f2033 ()! 3 f1 ()^2036 1 t2035|2035& 3 f0 (2036|$#,)! 3 f5 (2036|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 3 ?! 3 f2045 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^2048 1 t2047|2047& 3 f0 (20|$#,20|$#,64|$#,64|$#,2048|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,2048|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,2048|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 S!8{5|@1|^#quot,5|@1|^#rem,}! 0 s1835|& 3 f0 (5|$#,5|$#,)! 3 f540 (5|$#,5|$#,)! 3 f0 ()! 3 f17 ()! 3 f0 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f19 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f23 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f19 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f23 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,23|$#,)! 3 f19 (17|$#,5|$#,23|$#,)! 3 f23 (17|$#,5|$#,23|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (486|$#,486|$#,486|4@0@7&#,)! 3 f5 (486|$#,486|$#,486|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (6|$#,23|$#,64|$#,)! 3 f19 (6|$#,23|$#,64|$#,)! 3 f23 (6|$#,23|$#,64|$#,)! 2 F0/3|0& 2 F8/3|8& 3 f0 (2081|$#,)! 3 f9 (2081|$#,)! 3 f0 (9|$#,)! 3 f19 (9|$#,)! 3 f23 (9|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 2 F0/7|0& 2 F8/7|8& 3 f0 (2090|$#,)! 3 f1 (2090|$#,)! 3 S!9{9|@1|^#quot,9|@1|^#rem,}! 0 s1845|& 3 f0 (9|$#,9|$#,)! 3 f547 (9|$#,9|$#,)! 3 f0 ()! 3 f9 ()! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (554|4@5@7&#,23|$#,64|$#,)! 3 f64 (554|4@5@7&#,23|$#,64|$#,)! 3 f0 (554|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (554|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 ()! 3 f9 ()! 2 F0/3|0& 2 F8/3|8& 3 f0 (2116|$#,)! 3 f9 (2116|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|0@0@5&#,)! 3 f5 (23|0@0@5&#,)! 3 ?! 3 f2124 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^2127 1 t2126|2126& 3 f0 (20|$#,64|$#,64|$#,2127|$#,)! 3 f1 (20|$#,64|$#,64|$#,2127|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (25|$#,)! 3 f5 (25|$#,)! 3 f0 ()! 3 f9 ()! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (23|$#,23|4@0@7&#,)! 3 f19 (23|$#,23|4@0@7&#,)! 3 f23 (23|$#,23|4@0@7&#,)! 2 F0/3|0& 2 F8/3|8& 3 f0 (2143|$#,)! 3 f19 (2143|$#,)! 3 f27 (2143|$#,)! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (23|0@0@5&#,)! 3 f19 (23|0@0@5&#,)! 3 f23 (23|0@0@5&#,)! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (9|$#,)! 3 f1 (9|$#,)! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (23|$#,486|4@5@7&#,)! 3 f17 (23|$#,486|4@5@7&#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f9 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 (23|$#,486|4@5@7&#,5|$#,)! 3 f10 (23|$#,486|4@5@7&#,5|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 f0 ()! 3 f5 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (23|4@0@7&#,554|$#,64|$#,)! 3 f64 (23|4@0@7&#,554|$#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! ;;tistable 0 34 34,224 224 34,224,239 239 34,224,239,243 243 34,224,239,243,244 244 520 520,642 642 520,642,645 645 520,642,645,648 648 520,642,645,648,885 885 1102 ;;symTable *0 (Datatype) ^0 2@a@-@0@0@0@0@2#_Bool *1 (Constant) ^1 2@i0@0@6#false ^2 2@i1@0@0#true *11 (GlobalMarker) *1 (Constant) ^4 5$#__LINE__ ^5 23$#__DATE__#__FILE__#__BASE_FILE__#__func__ ^9 5$#__INCLUDE_LEVEL__ ^10 23$#__VERSION__ *0 (Datatype) ^11 13@c@-@0@0@0@0@59#__SIZE_TYPE__ ^12 13@c@-@0@0@0@0@60#__PTRDIFF_TYPE__ ^13 13@c@-@0@0@0@0@61#__WCHAR_TYPE__ *1 (Constant) ^14 23$#__USER_LABEL_PREFIX__#__REGISTER_PREFIX__#__TIME__ ^17 5$#__STDC__#S_SPLINT_S#__LCLINT__#__i686 *3 (Variable) ^21 380|@1|6@0@0@0@1#stdin#stdout *1 (Constant) ^23 5$#EDOM#ERANGE#EILSEQ *3 (Variable) ^26 5|@1|6@0@0@0@1#errno *0 (Datatype) ^27 2@-@-@0@0@0@0@62#bool *1 (Constant) ^28 5@i1@0@0#__bool_true_false_are_defined *0 (Datatype) ^29 13@-@-@0@0@0@0@63#ptrdiff_t ^30 14@-@-@0@0@0@0@64#size_t ^31 15@-@-@0@0@0@0@65#ssize_t ^32 13@-@-@0@0@0@0@66#wchar_t ^33 13@-@-@0@0@0@0@67#wint_t ^34 0@a@=@0@0@0@0@68#mbstate_t *1 (Constant) ^35 0@i0@0@6#NULL ^36 2$#NDEBUG *4 (Function) ^37 73@6@0@8@0@0^$@0#assert ^38 78$^$@0#isalnum ^39 81$^$@0#isalpha ^40 84$^$@0#iscntrl ^41 87$^$@0#isdigit ^42 91$^$@0#isgraph ^43 95$^$@0#islower ^44 98$^$@0#isprint ^45 101$^$@0#ispunct ^46 104$^$@0#isspace ^47 108$^$@0#isupper ^48 112$^$@0#isxdigit ^49 116$^$@0#tolower ^50 119$^$@0#toupper *7 (Struct tag) ^51 120@121#@lconv *1 (Constant) ^52 5$#LC_ALL#LC_COLLATE#LC_CTYPE#LC_MONETARY#LC_NUMERIC#LC_TIME *4 (Function) ^58 124@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@19@3@0#setlocale ^59 128$^@3@0@0#localeconv *3 (Variable) ^60 5|@1|6@0@0@0@1#DBL_DIG ^61 17|@1|6@0@0@0@1#DBL_EPSILON ^62 5|@1|6@0@0@0@1#DBL_MANT_DIG ^63 17|@1|6@0@0@0@1#DBL_MAX ^64 5|@1|6@0@0@0@1#DBL_MAX_10_EXP#DBL_MAX_EXP ^66 17|@1|6@0@0@0@1#DBL_MIN ^67 5|@1|6@0@0@0@1#DBL_MIN_10_EXP#DBL_MIN_EXP#FLT_DIG ^70 16|@1|6@0@0@0@1#FLT_EPSILON ^71 5|@1|6@0@0@0@1#FLT_MANT_DIG ^72 16|@1|6@0@0@0@1#FLT_MAX ^73 5|@1|6@0@0@0@1#FLT_MAX_10_EXP#FLT_MAX_EXP ^75 16|@1|6@0@0@0@1#FLT_MIN ^76 5|@1|6@0@0@0@1#FLT_MIN_10_EXP#FLT_MIN_EXP *1 (Constant) ^78 5$#FLT_RADIX *3 (Variable) ^79 5|@1|6@0@0@0@1#FLT_ROUNDS#LDBL_DIG ^81 18|@1|6@0@0@0@1#LDBL_EPSILON ^82 5|@1|6@0@0@0@1#LDBL_MANT_DIG ^83 18|@1|6@0@0@0@1#LDBL_MAX ^84 5|@1|6@0@0@0@1#LDBL_MAX_10_EXP#LDBL_MAX_EXP ^86 18|@1|6@0@0@0@1#LDBL_MIN ^87 5|@1|6@0@0@0@1#LDBL_MIN_10_EXP#LDBL_MIN_EXP *1 (Constant) ^89 5$#CHAR_BIT ^90 4$#CHAR_MAX#CHAR_MIN ^92 5$#INT_MAX#INT_MIN ^94 9$#LONG_MAX#LONG_MIN#MB_LEN_MAX ^97 4$#SCHAR_MAX#SCHAR_MIN ^99 7$#SHRT_MAX#SHRT_MIN ^101 3$#UCHAR_MAX#UCHAR_MIN ^103 6$#UINT_MAX ^104 10$#ULONG_MAX ^105 8$#USHRT_MAX *0 (Datatype) ^106 16@-@-@0@0@0@0@129#float_t ^107 17@-@-@0@0@0@0@130#double_t *1 (Constant) ^108 17$#HUGE_VAL ^109 16$#HUGE_VALF ^110 18$#HUGE_VALL ^111 16$#INFINITY#NAN ^113 5$#FP_INFINITE#FP_NAN#FP_NORMAL#FP_SUBNORMAL#FP_ZERO#FP_ILOGB0#FP_ILOGBNAN#DECIMAL_DIG *0 (Datatype) ^121 132@-@-@0@0@0@0@133#s_real_t *4 (Function) ^122 135$^$@0#fpclassify ^123 137$^$@0#signbit ^124 139$^$@0#isfinite ^125 141$^$@0#isnormal ^126 143$^$@0#isnan ^127 145$^$@0#isinf ^128 147$@0@g26@6@0@1@g26$@0#acos ^129 149$@0@g26@6@0@1@g26$@0#asin ^130 151$^$@0#atan ^131 153$^$@0#atan2 ^132 155$^$@0#cos ^133 157$^$@0#sin ^134 159$^$@0#tan ^135 161$@0@g26@6@0@1@g26$@0#cosh ^136 163$@0@g26@6@0@1@g26$@0#sinh ^137 165$^$@0#tanh ^138 1959$@0@g26@6@0@1@g26$@0#acosh ^139 1961$@0@g26@6@0@1@g26$@0#asinh ^140 1963$@0@g26@6@0@1@g26$@0#atanh ^141 173$@0@g26@6@0@1@g26$@0#exp ^142 175$@0@@1@tp1$@0#frexp ^143 177$@0@g26@6@0@1@g26$@0#ldexp ^144 179$@0@g26@6@0@1@g26$@0#log ^145 181$@0@g26@6@0@1@g26$@0#log10 ^146 183$@0@@1@tp1$@0#modf ^147 185$@0@g26@6@0@1@g26$@0#exp2 ^148 187$@0@g26@6@0@1@g26$@0#expm1 ^149 189$@0@g26@6@0@1@g26$@0#log1p ^150 191$@0@g26@6@0@1@g26$@0#log2 ^151 193$@0@g26@6@0@1@g26$@0#logb ^152 195$@0@g26@6@0@1@g26$@0#scalbn ^153 197$@0@g26@6@0@1@g26$@0#scalbln ^154 199$@0@g26@6@0@1@g26$@0#scalblnl ^155 201$@0@g26@6@0@1@g26$@0#ilogb ^156 203$@0@g26@6@0@1@g26$@0#ilogbf ^157 205$@0@g26@6@0@1@g26$@0#ilogbl ^158 207$^$@0#fabs ^159 209$^$@0#fabsf ^160 211$^$@0#fabsl ^161 213$@0@g26@6@0@1@g26$@0#pow ^162 215$@0@g26@6@0@1@g26$@0#powf ^163 217$@0@g26@6@0@1@g26$@0#powl ^164 219$@0@g26@6@0@1@g26$@0#sqrt ^165 221$@0@g26@6@0@1@g26$@0#sqrtf ^166 223$@0@g26@6@0@1@g26$@0#sqrtl ^167 225$^$@0#cbrt ^168 227$^$@0#cbrtf ^169 229$^$@0#cbrtl ^170 1945$@0@g26@6@0@1@g26$@0#hypot ^171 233$@0@g26@6@0@1@g26$@0#hypotf ^172 235$@0@g26@6@0@1@g26$@0#hypotl ^173 1967$@1@@1@g26$@0#erf ^174 1969$@1@@1@g26$@0#erfc ^175 241$^$@0#erff ^176 243$^$@0#erfl ^177 245$^$@0#erfcf ^178 247$^$@0#erfcl ^179 249$@0@g26@6@0@1@g26$@0#gamma ^180 251$@0@g26@6@0@1@g26$@0#gammaf ^181 253$@0@g26@6@0@1@g26$@0#gammal ^182 1965$@0@g26@6@0@1@g26$@0#lgamma ^183 257$@0@g26@6@0@1@g26$@0#lgammaf ^184 259$@0@g26@6@0@1@g26$@0#lgammal ^185 261$^$@0#ceil ^186 263$^$@0#ceilf ^187 265$^$@0#ceill ^188 267$^$@0#floor ^189 269$^$@0#floorf ^190 271$^$@0#floorl ^191 273$^$@0#nearbyint ^192 275$^$@0#nearbyintf ^193 277$^$@0#nearbyintl ^194 279$^$@0#rint ^195 281$^$@0#rintf ^196 283$^$@0#rintl ^197 285$@0@g26@6@0@1@g26$@0#lrint ^198 287$@0@g26@6@0@1@g26$@0#lrintf ^199 289$@0@g26@6@0@1@g26$@0#lrintl ^200 291$@0@g26@6@0@1@g26$@0#llrint ^201 293$@0@g26@6@0@1@g26$@0#llrintf ^202 295$@0@g26@6@0@1@g26$@0#llrintl ^203 297$^$@0#round ^204 299$@0@g26@6@0@1@g26$@0#lround ^205 301$@0@g26@6@0@1@g26$@0#llround ^206 303$^$@0#trunc ^207 305$^$@0#fmod ^208 307$^$@0#remainder ^209 309$@0@@1@tp2$@0#remquo ^210 311$^$@0#copysign ^211 313$^$@0#nan ^212 315$^$@0#nextafter ^213 317$^$@0#nextafterx ^214 319$@0@g26@6@0@1@g26$@0#fdim ^215 321$^$@0#fmax ^216 323$^$@0#fmin ^217 325$^$@0#fma ^218 327$^$@0#isgreater ^219 329$^$@0#isgreaterequal ^220 331$^$@0#isless ^221 333$^$@0#islessequal ^222 335$^$@0#islessgreater ^223 337$^$@0#isunordered *0 (Datatype) ^224 20@a@+@0@0@0@0@338#jmp_buf *4 (Function) ^225 340$@0@@1@p0$@0#setjmp ^226 342@6@0@5@0@0^$@0#longjmp *1 (Constant) ^227 5$#SIGABRT#SIGFPE#SIGILL#SIGINT#SIGSEGV#SIGTERM *0 (Datatype) ^233 13@-@-@0@0@0@0@343#sig_atomic_t *1 (Constant) ^234 347$#SIG_DFL ^235 351$#SIG_ERR ^236 355$#SIG_IGN *4 (Function) ^237 368@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26$@0#signal ^238 370@6@0@5@0@0$$@0#raise *0 (Datatype) ^239 20@a@+@0@0@0@0@371#va_list *4 (Function) ^240 373$@0@@1@p0$@0#va_start ^241 375$@0@@1@p0$@0#va_end ^242 377$$$@0#va_copy *0 (Datatype) ^243 20@a@+@0@0@0@0@378#FILE ^244 20@a@+@0@0@0@0@379#fpos_t *1 (Constant) ^245 64$#_IOFBF#_IOLBF#_IONBF#BUFSIZ ^249 5$#EOF#FOPEN_MAX#FILENAME_MAX#L_tmpnam#SEEK_CUR#SEEK_END#SEEK_SET#TMP_MAX *3 (Variable) ^257 380|@1|6@0@0@0@1#stderr *4 (Function) ^258 2013$@0@s3,g26@6@0@1@s3,g26$@0#remove ^259 2015$@0@s3,g26@6@0@1@s3,g26$@0#rename ^260 2023@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#tmpfile ^261 2026$@0@s1@1@tp0,s1@19@3@0#tmpnam ^262 392$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fclose ^263 394$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fflush ^264 397@6@5@1@0@0@0@s3@1@s3@18@0@0#fopen ^265 400@6@5@1@0@0@0@s3,g26@6@0@1@tp2,s3,g26@18@0@0#freopen ^266 402$@0@s3@1@s3,tp0,tp1$@0#setbuf ^267 404$@0@s3@1@s3,tp0,tp1$@0#setvbuf ^268 408@6@0@1@1@0@0@s3@1@s3,tp0$@0#fprintf ^269 410@6@0@1@2@0@0@s3,g26@6@0@1@s3,tp0,g26$@0#fscanf ^270 413@6@0@1@1@0@1@g22@6@0,s3@1@s3,tg22$@0#printf ^271 415@6@0@1@2@0@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#scanf ^272 418@6@0@1@1@0@0@@1@tp0$@0@W:bufferoverflowhigh#Buffer overflow possible with sprintf. Recommend using snprintf instead##sprintf ^273 420@6@0@1@1@0@0@@1@p0$@0#snprintf ^274 422@6@0@1@2@0@0@g26@6@0@1@g26$@0#sscanf ^275 424$@1@g22@6@0,s3@1@s3,tg22$@0#vprintf ^276 426$@0@s3,g26@6@0@1@s3,tp0,p2,g26$@0#vfprintf ^277 428$@0@@1@p0$@0@W:bufferoverflowhigh#Use vsnprintf instead##vsprintf ^278 430$@0@@1@p0$@0#vsnprintf ^279 432$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fgetc ^280 435@6@5@1@0@0@0@s3,g26@6@0@1@s3,tp0,tp2,g26$@0#fgets ^281 438$@0@s3,g26@6@0@1@s3,tp1,g26$@0#fputc ^282 440$@0@s3@1@s3,tp1$@0#fputs ^283 442$@0@s3,g26@6@0@1@s3,tp0,g26$@0#getc ^284 444$@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#getchar ^285 447@6@5@1@0@0@1@g21@6@0,s3,g26@6@0@1@s3,tp0,tg21,g26@3@0@0@W:bufferoverflowhigh#Use of gets leads to a buffer overflow vulnerability. Use fgets instead##gets ^286 449$@0@s3,g26@6@0@1@s3,tp1,g26$@0#putc ^287 451$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#putchar ^288 453$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#puts ^289 455$@0@s3@1@s3,tp1$@0#ungetc ^290 457$@0@s3,g26@6@0@1@s3,tp0,tp3,g26$@0#fread ^291 459$@0@s3,g26@6@0@1@s3,tp3,g26$@0#fwrite ^292 462$@0@g26@6@0@1@tp1,g26$@0#fgetpos ^293 464$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fseek ^294 466$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fsetpos ^295 468$@0@g26@6@0@1@g26$@0#ftell ^296 2017$@0@@1@tp0,g26$@0#rewind ^297 1971$@0@@1@tp0$@0#clearerr ^298 474$@0@g26@6@0@1@g26$@0#feof ^299 476$@0@g26@6@0@1@g26$@0#ferror ^300 478$@1@g26@6@0,g257@6@0,s3@1@s3,tg257$@0#perror ^301 2040$^$@0#atof ^302 2042$^$@0#atoi ^303 2044$^$@0#atol ^304 2159$@0@g26@6@0@1@tp1,g26$@0#strtod ^305 2161$@0@g26@6@0@1@tp1,g26$@0#strtol ^306 2163$@0@g26@6@0@1@tp1,g26$@0#strtoul *1 (Constant) ^307 5$#RAND_MAX *4 (Function) ^308 2131$@0@s1@1@s1$@0#rand ^309 2153$@0@s1@1@s1$@0#srand ^310 2054@6@5@1@0@0^@2@0@0#calloc ^311 2101@4@5@1@0@0@1@@1@g26@2@0@0#malloc ^312 2138@6@5@1@0@0@0@@1@tp0,g26@2@0@0#realloc ^313 1305$@0@@1@p0,tp0$@0#free *1 (Constant) ^314 5$#EXIT_FAILURE#EXIT_SUCCESS *4 (Function) ^316 2030@6@0@6@0@0^$@0#abort ^317 511@6@0@6@0@0^$@0#exit ^318 2038$@0@s1@1@s1$@0#atexit ^319 2072@6@5@1@0@0^@19@3@0#getenv ^320 2165$@0@s3@1@s3,g26$@0#system ^321 2051@6@5@1@0@0^@18@0@0#bsearch ^322 2129$@0@g26@6@0@1@tp0,g26$@0#qsort ^323 2032$^$@0#abs *7 (Struct tag) ^324 538@539#@!2 *0 (Datatype) ^325 538@c@-@0@0@0@0@540#div_t *4 (Function) ^326 2058$^$@0#div ^327 2088$^$@0#labs *7 (Struct tag) ^328 545@546#@!3 *0 (Datatype) ^329 545@c@-@0@0@0@0@547#ldiv_t *4 (Function) ^330 2096$^$@0#ldiv *1 (Constant) ^331 64$#MB_CUR_MAX ^332 5$#WCHAR_MAX#WCHAR_MIN ^334 67$#WEOF *4 (Function) ^335 551$^$@0#btowc ^336 553$@0@s3@1@s3,tp0$@0#fgetwc ^337 557@6@5@1@0@0@0@s3@1@s3,tp0,tp2$@0#fgetws ^338 559$@0@s3@1@s3,tp1$@0#fputwc ^339 561$@0@s3@1@s3,tp1$@0#fputws ^340 563$^$@0#fwide ^341 565@6@0@1@1@0@0@s3@1@tp0,s3$@0#fwprintf ^342 567@6@0@1@2@0@0@s3@1@tp0,s3$@0#fwscanf ^343 569$@0@s3@1@s3,tp0$@0#getwc ^344 571$@0@s3,g21@6@0@1@s3,tg21$@0#getwchar ^345 574$^$@0#mbrlen ^346 576$@0@@1@tp0$@0#mbrtowc ^347 578$^$@0#mbsinit ^348 580$@0@@1@tp0$@0#mbsrtowcs ^349 582$@0@s3@1@s3,tp1$@0#putwc ^350 584$@0@s3,g22@6@0@1@s3,tg22$@0#putwchar ^351 586@6@0@1@1@0@0@@1@tp0$@0#swprintf ^352 588@6@0@1@2@0@0@g21@6@0@1@tg21$@0#swscanf ^353 590$@0@s3@1@s3,tp1$@0#ungetwc ^354 592$@0@s3@1@s3,tp0$@0#vfwprintf ^355 594$@0@@1@tp0$@0#vswprintf ^356 596$@0@s3,g22@6@0@1@s3,tg22$@0#vwprintf ^357 598$@0@@1@tp0$@0#wcrtomb ^358 602$@0@@1@tp0$@0#wcscat ^359 605@6@5@1@0@0^@19@2@0#wcschr ^360 607$^$@0#wcscmp ^361 609$^$@0#wcscoll ^362 612$@0@@1@tp0$@0#wcscpy ^363 614$^$@0#wcscspn *7 (Struct tag) ^364 803@615#@tm *4 (Function) ^365 618$@0@@1@tp0$@0#wcsftime ^366 620$^$@0#wcslen ^367 624$@0@@1@tp0$@0#wcsncat ^368 626$^$@0#wcsncmp ^369 629$@0@@1@tp0$@0#wcsncpy ^370 632@6@5@1@0@0^$@0#wcspbrk ^371 635@6@5@1@0@0^$@0#wcsrchr ^372 638$@0@@1@tp1$@0#wcsrtombs ^373 640$^$@0#wcsspn ^374 643@6@5@1@0@0^@3@0@0#wcsstr ^375 645$@0@@1@tp1$@0#wcstod ^376 648@6@5@1@0@0@0@@1@tp2@3@0@0#wcstok ^377 650$@0@@1@tp1$@0#wcstol ^378 652$@0@@1@tp1$@0#wcstoul ^379 654$@0@@1@tp0$@0#wcsxfrm ^380 656$^$@0#wctob ^381 659@6@5@1@0@0^@3@0@0#wmemchr ^382 661$^$@0#wmemcmp ^383 664$@0@@1@tp0$@0#wmemcpy ^384 667$@0@@1@tp0$@0#wmemmove ^385 670$@0@@1@tp0$@0#wmemset ^386 672@6@0@1@1@0@1@g22@6@0,g26@6@0@1@g26,tg22$@0#wprintf ^387 674@6@0@1@2@0@1@g21@6@0,g26@6@0@1@g26,tg21$@0#wscanf *0 (Datatype) ^388 13@-@-@0@0@0@0@675#wctype_t ^389 13@-@-@0@0@0@0@676#wctrans_t *4 (Function) ^390 680$^$@0#iswalnum ^391 683$^$@0#iswalpha ^392 686$^$@0#iswcntrl ^393 689$^$@0#iswctype ^394 692$^$@0#iswdigit ^395 696$^$@0#iswgraph ^396 699$^$@0#iswlower ^397 702$^$@0#iswprint ^398 705$^$@0#iswpunct ^399 708$^$@0#iswspace ^400 711$^$@0#iswupper ^401 715$^$@0#iswxdigit ^402 719$^$@0#towctrans ^403 722$^$@0#towlower ^404 725$^$@0#towupper ^405 727$^$@0#wctrans ^406 729$^$@0#wctype ^407 2103$@1@@1@g26$@0#mblen ^408 2107$@0@@1@tp0,g26$@0#mbtowc ^409 2176$@0@@1@tp0$@0#wctomb ^410 2105$@0@@1@tp0$@0#mbstowcs ^411 2174$@0@@1@tp0,g26$@0#wcstombs ^412 743$@0@@1@tp0$@0#memcpy ^413 746$@0@@1@tp0$@0#memmove ^414 750$@0@@1@tp0$@0#strcpy ^415 753$@0@@1@tp0$@0#strncpy ^416 756$@0@@1@tp0$@0#strcat ^417 759$@0@@1@tp0$@0#strncat ^418 761$^$@0#memcmp ^419 763$^$@0#strcmp ^420 765$^$@0#strcoll ^421 767$^$@0#strncmp ^422 769$@0@@1@tp0$@0#strxfrm ^423 772@6@5@1@0@0^@3@0@0#memchr ^424 775@6@5@1@0@0^@19@2@0#strchr ^425 777$^$@0#strcspn ^426 780@6@5@1@0@0^@19@2@0#strpbrk ^427 783@6@5@1@0@0^@19@2@0#strrchr ^428 785$^$@0#strspn ^429 788@6@5@1@0@0^@19@2@0#strstr ^430 791@6@5@1@0@0@0@s1,g26@6@0@1@tp0,s1,g26@19@2@0#strtok ^431 795$@0@@1@tp0$@0#memset ^432 798$^@19@3@0#strerror ^433 800$^$@0#strlen *1 (Constant) ^434 5$#CLOCKS_PER_SEC *0 (Datatype) ^435 13@-@-@0@0@0@0@801#clock_t ^436 13@-@-@0@0@0@0@802#time_t *4 (Function) ^437 805$@0@s1@1@s1$@0#clock ^438 807$^$@0#difftime ^439 809$^$@0#mktime ^440 812$@0@@1@tp0$@0#time ^441 815$@0@g26@6@0@1@g26@19@3@0#asctime ^442 818$^@19@3@0#ctime ^443 821$^@19@3@0#gmtime ^444 824$@0@g26@6@0@1@g26@19@3@0#localtime ^445 826$@0@@1@tp0$@0#strftime *0 (Datatype) ^446 13@-@-@0@0@0@0@827#int8_t ^447 13@-@-@0@0@0@0@828#int16_t ^448 13@-@-@0@0@0@0@829#int32_t ^449 13@-@-@0@0@0@0@830#int64_t ^450 14@-@-@0@0@0@0@831#uint8_t ^451 14@-@-@0@0@0@0@832#uint16_t ^452 14@-@-@0@0@0@0@833#uint32_t ^453 14@-@-@0@0@0@0@834#uint64_t ^454 13@-@-@0@0@0@0@835#int_least8_t ^455 13@-@-@0@0@0@0@836#int_least16_t ^456 13@-@-@0@0@0@0@837#int_least32_t ^457 13@-@-@0@0@0@0@838#int_least64_t ^458 14@-@-@0@0@0@0@839#uint_least8_t ^459 14@-@-@0@0@0@0@840#uint_least16_t ^460 14@-@-@0@0@0@0@841#uint_least32_t ^461 14@-@-@0@0@0@0@842#uint_least64_t ^462 13@-@-@0@0@0@0@843#int_fast8_t ^463 13@-@-@0@0@0@0@844#int_fast16_t ^464 13@-@-@0@0@0@0@845#int_fast32_t ^465 13@-@-@0@0@0@0@846#int_fast64_t ^466 14@-@-@0@0@0@0@847#uint_fast8_t ^467 14@-@-@0@0@0@0@848#uint_fast16_t ^468 14@-@-@0@0@0@0@849#uint_fast32_t ^469 14@-@-@0@0@0@0@850#uint_fast64_t ^470 15@-@-@0@0@0@0@851#intptr_t ^471 14@-@-@0@0@0@0@852#uintptr_t ^472 15@-@-@0@0@0@0@853#intmax_t ^473 14@-@-@0@0@0@0@854#uintmax_t *1 (Constant) ^474 5$#INT8_MIN#INT16_MIN#INT32_MIN#INT64_MIN#INT8_MAX#INT16_MAX#INT32_MAX#INT64_MAX#UINT8_MIN#UINT16_MIN#UINT32_MIN#UINT64_MIN#INT_LEAST8_MIN#INT_LEAST16_MIN#INT_LEAST32_MIN#INT_LEAST64_MIN#INT_LEAST8_MAX#INT_LEAST16_MAX#INT_LEAST32_MAX#INT_LEAST64_MAX#UINT_LEAST8_MAX#UINT_LEAST16_MAX#UINT_LEAST32_MAX#UINT_LEAST64_MAX#INT_FAST8_MIN#INT_FAST16_MIN#INT_FAST32_MIN#INT_FAST64_MIN#INT_FAST8_MAX#INT_FAST16_MAX#INT_FAST32_MAX#INT_FAST64_MAX#UINT_FAST8_MAX#UINT_FAST16_MAX#UINT_FAST32_MAX#UINT_FAST64_MAX ^510 64$#INTPTR_MIN#INTPTR_MAX *0 (Datatype) ^512 13@-@-@0@0@0@0@855#dev_t ^513 13@-@-@0@0@0@0@856#gid_t ^514 14@-@-@0@0@0@0@857#ino_t ^515 13@-@-@0@0@0@0@858#mode_t ^516 13@-@-@0@0@0@0@859#nlink_t ^517 13@-@-@0@0@0@0@860#off_t ^518 13@-@-@0@0@0@0@861#pid_t ^519 13@-@-@0@0@0@0@862#uid_t ^520 20@a@+@0@0@0@0@863#DIR *7 (Struct tag) ^521 1918@865#@dirent *4 (Function) ^522 1920$@0@g26@6@0@1@g26$@0#closedir ^523 1923@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#opendir ^524 875@6@5@1@0@0@0@g26@6@0@1@g26@18@0@0#readdir ^525 1928$^$@0#rewinddir *1 (Constant) ^526 5$#E2BIG#EACCES#EAGAIN#EBADF#EBUSY#ECHILD#EDEADLK#EEXIST#EFAULT#EFBIG#EINTR#EINVAL#EIO#EISDIR#EMFILE#EMLINK#ENAMETOOLONG#ENFILE#ENODEV#ENOENT#ENOEXEC#ENOLCK#ENOMEM#ENOSPC#ENOSYS#ENOTDIR#ENOTEMPTY#ENOTTY#ENXIO#EPERM#EPIPE#EROFS#ESPIPE#ESRCH#EXDEV#FD_CLOEXEC#F_DUPFD#F_GETFD#F_GETFL#F_GETLK#F_RDLCK#F_SETFD#F_SETFL#F_SETLK#F_SETLKW#F_UNLCK#F_WRLCK#O_ACCMODE#O_APPEND#O_CREAT#O_EXCL#O_NOCTTY#O_NONBLOCK#O_RDONLY#O_RDWR#O_TRUNC#O_WRONLY ^583 858$#S_IFMT#S_IFBLK#S_IFCHR#S_IFIFO#S_IFREG#S_IFDIR#S_IFLNK#S_IRWXU#S_IRUSR#S_IRGRP#S_IROTH#S_IUSR#S_IWXG#S_IWXO#S_IWXU#S_ISGID#S_ISUID#S_IWGRP#S_IWOTH#S_IWUSR#S_IXGRP#S_IXOTH#S_IXUSR *7 (Struct tag) ^606 878@879#@flock *4 (Function) ^607 881$@0@g26@6@0@1@g26$@0#creat ^608 883$@0@g26@6@0@1@g26$@0#fcntl ^609 885$@0@g26@6@0@1@g26$@0#open *7 (Struct tag) ^610 886@887#@group *4 (Function) ^611 891@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrgid ^612 894@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrnam *1 (Constant) ^613 9$#ARG_MAX#CHILD_MAX#LINK_MAX#MAX_CANON ^617 64$#MAX_INPUT#NAME_MAX ^619 9$#NGROUPS_MAX#OPEN_MAX ^621 64$#PATH_MAX#PIPE_BUF ^623 9$#SSIZE_MAX#STREAM_MAX#TZNAME_MAX#_POSIX_ARG_MAX#_POSIX_CHILD_MAX#_POSIX_LINK_MAX#_POSIX_MAX_CANON#_POSIX_MAX_INPUT#_POSIX_NAME_MAX#_POSIX_NGROUPS_MAX#_POSIX_OPEN_MAX#_POSIX_PATH_MAX#_POSIX_PIPE_BUF#_POSIX_SSIZE#_POSIX_STREAM#_POSIX_TZNAME_MAX *7 (Struct tag) ^639 895@896#@passwd *4 (Function) ^640 900@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwnam ^641 903@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwuid *0 (Datatype) ^642 20@a@+@0@0@0@0@904#sigjmp_buf *4 (Function) ^643 906@6@0@5@0@0^$@0#siglongjmp ^644 908$@0@@1@p0$@0#sigsetjmp *0 (Datatype) ^645 0@a@=@0@0@0@0@909#sigset_t *7 (Struct tag) ^646 910@911#@!4 *0 (Datatype) ^647 910@-@-@0@0@0@0@912#stack_t ^648 0@a@=@0@0@0@0@913#mcontext_t *7 (Struct tag) ^649 916@914#@s_ucontext_t *0 (Datatype) ^650 914@-@+@0@0@0@0@917#ucontext_t *4 (Function) ^651 920$$$@0#getcontext ^652 922$$$@0#setcontext ^653 928$$$@0#makecontext ^654 930$$$@0#swapcontext *1 (Constant) ^655 5$#SA_NOCLDSTOP#SIG_BLOCK#SIG_SETMASK#SIG_UNBLOCK#SIGALRM#SIGCHLD#SIGCONT#SIGHUP#SIGKILL#SIGPIPE#SIGQUIT#SIGSTOP#SIGTSTP#SIGTTIN#SIGTTOU#SIGUSR1#SIGUSR2 *7 (Struct tag) ^672 931@932#@sigstack *8 (Union tag) ^673 0@933#$sigval *7 (Struct tag) ^674 934@935#@!5 *0 (Datatype) ^675 934@-@-@0@0@0@0@936#siginfo_t *8 (Union tag) ^676 937@938#$!6 *0 (Datatype) ^677 937@-@-@0@0@0@0@939#sigval *7 (Struct tag) ^678 949@950#@sigaction *4 (Function) ^679 952@6@0@5@0@0@0@g26@6@0@1@g26$@0#kill ^680 955$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigaction ^681 958$@0@g26@6@0@1@tp0,g26$@0#sigaddset ^682 960$@0@g26@6@0@1@tp0,g26$@0#sigdelset ^683 962$@0@g26@6@0@1@tp0,g26$@0#sigemptyset ^684 964$@0@g26@6@0@1@tp0,g26$@0#sigfillset ^685 966$@0@g26@6@0@1@g26$@0#sigismember ^686 968$@0@g26@6@0@1@tp0,g26$@0#sigpending ^687 970$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigprocmask ^688 972$@0@g26@6@0,s3@1@g26,s3$@0#sigsuspend *1 (Constant) ^689 5$#L_ctermid#L_cuserid *4 (Function) ^691 1980@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#fdopen ^692 1982$@0@g26@6@0@1@g26$@0#fileno *7 (Struct tag) ^693 1554@979#@stat *4 (Function) ^694 1557$^$@0#S_ISBLK ^695 1561$^$@0#S_ISCHR ^696 1565$^$@0#S_ISDIR ^697 1569$^$@0#S_ISFIFO ^698 1573$^$@0#S_ISREG ^699 991$@0@s3,g26@6@0@1@s3,g26$@0#chmod ^700 994$@0@g26@6@0@1@g26,tp1$@0#fstat ^701 996$@0@s3,g26@6@0@1@s3,g26$@0#mkdir ^702 998$@0@s3,g26@6@0@1@s3,g26$@0#mkfifo ^703 1000$@0@g26@6@0@1@g26,tp1$@0#stat ^704 1002$@0@s3@1@s3$@0#umask *7 (Struct tag) ^705 1003@1004#@tms *4 (Function) ^706 1007$@0@@1@tp0$@0#times *7 (Struct tag) ^707 1008@1009#@utsname *4 (Function) ^708 1012$@0@g26@6@0@1@tp0,g26$@0#uname ^709 1014$^$@0#WEXITSTATUS ^710 1016$^$@0#WIFEXITED ^711 1018$^$@0#WIFSIGNALED ^712 1020$^$@0#WIFSTOPPED ^713 1022$^$@0#WSTOPSIG ^714 1024$^$@0#WTERMSIG *1 (Constant) ^715 5$#WUNTRACED#WCONTINUED#WNOHANG *4 (Function) ^718 1026$@0@g26@6@0,s3@1@tp0,g26,s3$@0#wait ^719 1028$@0@g26@6@0,s3@1@tp1,g26,s3$@0#waitpid *0 (Datatype) ^720 1030@-@-@0@0@0@0@1031#cc_t ^721 1033@-@-@0@0@0@0@1034#speed_t ^722 1033@-@-@0@0@0@0@1035#tcflag_t *1 (Constant) ^723 5$#B0#B50#B75#B110#B134#B150#B200#B300#B600#B1200#B1800#B2400#B4800#B9600#B19200#B38400#BRKINT#CLOCAL#CREAD#CS5#CS6#CS7#CS8#CSIZE#CSTOPB#ECHO#ECHOE#ECHOK#ECHONL#HUPCL#ICANON#ICRNL#IEXTEN#IGNBRK#IGNCR#IGNPAR#IGNLCR#INPCK#ISIG#ISTRIP#IXOFF#IXON#NCCS#NOFLSH#OPOST#PARENB#PARMRK#PARODD#TCIFLUSH#TCIOFF#TCIOFLUSH#TCION#TCOFLUSH#TCSADRAIN#TCSAFLUSH#TCSANOW#TOSTOP#VEOF#VEOL#VERASE#VINTR#VKILL#VMIN#VQUIT#VSTART#VSTOP#VSUSP#VTIME *7 (Struct tag) ^791 1036@1037#@termios *4 (Function) ^792 1040$^$@0#cfgetispeed ^793 1042$^$@0#cfgetospeed ^794 1044$@0@@1@tp0$@0#cfsetispeed ^795 1046$@0@@1@tp0$@0#cfsetospeed ^796 1048$@0@g26@6@0@1@g26$@0#tcdrain ^797 1050$@0@g26@6@0@1@g26$@0#tcflow ^798 1052$@0@g26@6@0@1@g26$@0#tcflush ^799 1054$@0@g26@6@0@1@g26,tp1$@0#tcgetattr ^800 1056$@0@g26@6@0@1@g26$@0#tcsendbreak ^801 1058$@0@g26@6@0@1@g26$@0#tcsetattr *3 (Variable) ^802 486|@1|6@0@0@0@1#environ *1 (Constant) ^803 5$#CLK_TCK *4 (Function) ^804 1245$@1@g802@6@0,s3@1@s3,g1061,g1062,g1063$@0#tzset *1 (Constant) ^805 5$#F_OK#R_OK#STDERR_FILENO#STDIN_FILENO#STDOUT_FILENO#W_OK#X_OK#_PC_CHOWN_RESTRUCTED#_PC_MAX_CANON#_PC_MAX_INPUT#_PC_NAME_MAX#_PC_NO_TRUNC#_PC_PATH_MAX#_PC_PIPE_BUF#_PC_VDISABLE#_POSIX_CHOWN_RESTRICTED#_POSIX_JOB_CONTROL#_POSIX_NO_TRUNC#_POSIX_SAVED_IDS#_POSIX_VDISABLE#_POSIX_VERSION#_SC_ARG_MAX#_SC_CHILD_MAX#_SC_CLK_TCK#_SC_JOB_CONTROL#_SC_NGROUPS_MAX#_SC_OPEN_MAX#_SC_SAVED_IDS#_SC_STREAM_MAX#_SC_TZNAME_MAX#_SC_VERSION *4 (Function) ^836 1738@6@0@6@0@0^$@0#_exit ^837 1697$@0@g26@6@0@1@g26$@0#access ^838 1699$@0@s3@1@s3,s1$@0#alarm ^839 1703$@0@g26@6@0@1@g26,s1$@0#chdir ^840 1705$@0@s3,g26@6@0@1@s3,g26,s1$@0#chown ^841 1707$@0@s3,g26@6@0@1@s3,g26,s1$@0#close ^842 1974@6@5@1@0@0@1@s3@1@tp0,s3@18@0@0#ctermid ^843 1977@6@5@1@0@0@0@@1@tp0@18@0@0#cuserid ^844 1722$@0@g26@6@0,s3@1@g26,s3,s1$@0#dup2 ^845 1720$@0@g26@6@0,s3@1@g26,s3,s1$@0#dup ^846 1726@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execl ^847 1728@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execle ^848 1730@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execlp ^849 1732@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execv ^850 1734@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execve ^851 1736@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execvp ^852 1746$@0@s3,g26@6@0@1@s3,g26,s1$@0#fork ^853 1748$@0@g26@6@0@1@g26,s1$@0#fpathconf ^854 1755@6@5@1@0@0@0@g26@6@0@1@g26,tp0$@0#getcwd ^855 1759$^$@0#getegid ^856 1761$^$@0#geteuid ^857 1763$^$@0#getgid ^858 1765$@0@g26@6@0@1@g26,ap1$@0#getgroups ^859 1770@6@5@1@0@0@1@@1@g26@19@3@0#getlogin ^860 1783$^$@0#getpgrp ^861 1785$^$@0#getpid ^862 1787$^$@0#getppid ^863 1791$^$@0#getuid ^864 1796$@1@@1@g26$@0#isatty ^865 1800$@0@g26@6@0,s3@1@g26,s3$@0#link ^866 1804$@0@g26@6@0@1@g26$@0#lseek ^867 1808$@0@g26@6@0@1@g26,s1$@0#pathconf ^868 1810$@0@g26@6@0@1@g26,s1$@0#pause ^869 1812$@0@g26@6@0@1@g26$@0#pipe ^870 1137$@0@g26@6@0@1@g26,tp1$@0#read ^871 1139$@0@s3,g26@6@0@1@s3,g26$@0#rmdir ^872 1141$@0@g26@6@0,s3@1@g26,s3$@0#setgid ^873 1143$@0@g26@6@0,s3@1@g26,s3$@0#setpgid ^874 1843$@0@s3@1@s3,g26,s1$@0#setsid ^875 1845$@0@g26@6@0,s3@1@g26,s3,s1$@0#setuid ^876 1847$@0@s3@1@s3$@0#sleep ^877 1855$@0@g26@6@0@1@g26$@0#sysconf ^878 1857$@1@g26@6@0@1@g26$@0#tcgetpgrp ^879 1859$@0@g26@6@0,s3@1@g26,s3$@0#tcsetpgrp ^880 1864@6@5@1@0@0@1@g26@6@0@1@g26@19@3@0#ttyname ^881 1870$@0@s3,g26@6@0@1@s3,g26$@0#unlink ^882 1162$@0@g26@6@0@1@g26$@0#write *7 (Struct tag) ^883 1163@1164#@utimbuf *4 (Function) ^884 1167$@0@s3,g26@6@0@1@s3,g26$@0#utime *0 (Datatype) ^885 20@a@+@0@0@0@0@1168#regex_t ^886 13@-@-@0@0@0@0@1169#regoff_t *7 (Struct tag) ^887 1170@1171#@!7 *0 (Datatype) ^888 1170@-@-@0@0@0@0@1172#regmatch_t *4 (Function) ^889 1175$@0@@1@p0$@0#regcomp ^890 1178$@0@@1@p3$@0#regexec ^891 1180$@0@@1@p2$@0#regerror ^892 1182$$$@0#regfree *1 (Constant) ^893 5$#REG_BASIC#REG_EXTENDED#REG_ICASE#REG_NOSUB#REG_NEWLINE#REG_NOSPEC#REG_PEND#REG_DUMP#REG_NOMATCH#REG_BADPAT#REG_ECOLLATE#REG_ECTYPE#REG_EESCAPE#REG_ESUBREG#REG_EBRACK#REG_EPAREN#REG_EBRACE#REG_BADBR#REG_ERANGE#REG_ESPACE#REG_BADRPT#REG_EMPTY#REG_ASSERT#REG_INVARG#REG_ATOI#REG_ITOA#REG_NOTBOL#REG_NOTEOL#REG_STARTEND#REG_TRACE#REG_LARGE#REG_BACKR *0 (Datatype) ^925 13@-@-@0@0@0@0@1183#blkcnt_t ^926 13@-@-@0@0@0@0@1184#blksize_t ^927 13@-@-@0@0@0@0@1185#clockid_t ^928 14@-@-@0@0@0@0@1186#fsblkcnt_t ^929 14@-@-@0@0@0@0@1187#fsfilcnt_t ^930 13@-@-@0@0@0@0@1188#id_t ^931 13@-@-@0@0@0@0@1189#key_t ^932 13@-@-@0@0@0@0@1190#pthread_attr_t ^933 13@-@-@0@0@0@0@1191#pthread_cond_t ^934 13@-@-@0@0@0@0@1192#pthread_condattr_t ^935 13@-@-@0@0@0@0@1193#pthread_key_t ^936 13@-@-@0@0@0@0@1194#pthread_mutex_t ^937 13@-@-@0@0@0@0@1195#pthread_mutexattr_t ^938 13@-@-@0@0@0@0@1196#pthread_once_t ^939 13@-@-@0@0@0@0@1197#pthread_rwlock_t ^940 13@-@-@0@0@0@0@1198#pthread_rwlockattr_t ^941 13@-@-@0@0@0@0@1199#pthread_t ^942 15@-@-@0@0@0@0@1200#suseconds_t ^943 13@-@-@0@0@0@0@1201#timer_t ^944 14@-@-@0@0@0@0@1202#useconds_t *3 (Variable) ^945 5|@1|6@0@0@0@1#signgam *4 (Function) ^946 1204$@0@@1@tp1$@0#bcopy ^947 1208$^$@0#bcmp ^948 1210$@0@@1@tp0$@0#bzero ^949 1212$^$@0#ffs ^950 1851$@0@s3@1@s3,g26$@0#symlink ^951 1216$@0@s1@1@s1$@0#setvbuf_unlocked ^952 1218$@0@s1@1@s1$@0#setbuffer ^953 1220$@0@s1@1@s1$@0#setlinebuf ^954 1222$@0@@1@p1$@0#strerror_r ^955 1224$@0@@1@tp3,tp0$@0#fread_unlocked ^956 1226$@0@@1@tp3$@0#fwrite_unlocked ^957 1230$@0@@1@tp0$@0#memccpy ^958 1232$^$@0#strcasecmp ^959 1234$^$@0#strncasecmp ^960 1237@6@5@1@0@0^@2@0@0#strdup ^961 1240@6@5@1@0@0^@18@0@0#index ^962 1243@6@5@1@0@0^@18@0@0#rindex *1 (Constant) ^963 5$#ENOTBLK#ETXTBSY#EWOULDBLOCK#EINPROGRESS#EALREADY#ENOTSOCK#EDESTADDRREQ#EMSGSIZE#EPROTOTYPE#ENOPROTOOPT#EPROTONOSUPPORT#ESOCKTNOSUPPORT#EOPNOTSUPP#EPFNOSUPPORT#EAFNOSUPPORT#EADDRINUSE#EADDRNOTAVAIL#ENETDOWN#ENETUNREACH#ENETRESET#ECONNABORTED#ECONNRESET#ENOBUFS#EISCONN#ENOTCONN#ESHUTDOWN#ETOOMANYREFS#ETIMEDOUT#ECONNREFUSED#EHOSTDOWN#EHOSTUNREACH#EPROCLIM#EUSERS#EDQUOT#ESTALE#EREMOTE#ENOMSG#EIDRM#EALIGN#EACTIVE#ENOACTIVE#ENORESOURCES#ENOSYSTEM#ENODUST#EDUPNOCONN#EDUPNODISCONN#EDUPNOTCNTD#EDUPNOTIDLE#EDUPNOTWAIT#EDUPNOTRUN#EDUPBADOPCODE#EDUPINTRANSIT#EDUPTOOMANYCPUS#ELOOP#LOCK_MAX#FCHR_MAX#USI_MAX#WORD_BIT#LONG_BIT#MAX_CHAR#PASS_MAX#PID_MAX#SYSPID_MAX#PIPE_MAX#PROC_MAX#STD_BLK#SYS_NMLN#SYS_OPEN#NZERO#UID_MAX#NL_ARGMAX#NL_MSGMAX#NL_NMAX#NL_SETMAX#NL_TEXTMAX#NL_LBLMAX#NL_LANGMAX ^1040 17$#M_E#M_LOG2E#M_LOG10E#M_LN2#M_LN10#M_PI#M_PI_2#M_PI_4#M_1_PI#M_2_PI#M_2_SQRTPI#M_SQRT2#M_SQRT1_2#MAXFLOAT#HUGE ^1055 5$#DOMAIN#SING#OVERFLOW#UNDERFLOW#TLOSS#PLOSS *3 (Variable) ^1061 5|@1|6@0@0@0@1#daylight ^1062 9|@1|6@0@0@0@1#timezone ^1063 1090|@1|6@0@0@0@1#tzname *0 (Datatype) ^1064 3@-@-@0@0@0@0@1246#uchar_t ^1065 8@-@-@0@0@0@0@1247#ushort_t ^1066 6@-@-@0@0@0@0@1248#uint_t ^1067 10@-@-@0@0@0@0@1249#ulong_t ^1068 3@-@-@0@0@0@0@1250#vuchar_t ^1069 8@-@-@0@0@0@0@1251#vushort_t ^1070 6@-@-@0@0@0@0@1252#vuint_t ^1071 10@-@-@0@0@0@0@1253#vulong_t ^1072 9@-@-@0@0@0@0@1254#label_t ^1073 5@-@-@0@0@0@0@1255#level_t ^1074 13@-@-@0@0@0@0@1256#daddr_t ^1075 23@-@+@0@0@0@0@1257#caddr_t ^1076 28@-@+@0@0@0@0@1258#qaddr_t ^1077 23@-@+@0@0@0@0@1259#addr_t ^1078 9@-@-@0@0@0@0@1260#physadr_t ^1079 7@-@-@0@0@0@0@1261#cnt_t ^1080 5@-@-@0@0@0@0@1262#chan_t ^1081 5@-@-@0@0@0@0@1263#paddr_t ^1082 20@-@+@0@0@0@0@1264#mid_t ^1083 1266@-@-@0@0@0@0@1267#slab_t ^1084 1249@-@-@0@0@0@0@1268#shmatt_t ^1085 1249@-@-@0@0@0@0@1269#msgqnum_t ^1086 1249@-@-@0@0@0@0@1270#msglen_t ^1087 1246@-@-@0@0@0@0@1271#uchar ^1088 1247@-@-@0@0@0@0@1272#ushort ^1089 1248@-@-@0@0@0@0@1273#uint ^1090 1249@-@-@0@0@0@0@1274#ulong ^1091 1246@-@-@0@0@0@0@1275#u_char ^1092 1247@-@-@0@0@0@0@1276#u_short ^1093 1248@-@-@0@0@0@0@1277#u_int ^1094 1249@-@-@0@0@0@0@1278#u_long ^1095 1250@-@-@0@0@0@0@1279#vu_char ^1096 1251@-@-@0@0@0@0@1280#vu_short ^1097 1252@-@-@0@0@0@0@1281#vu_int ^1098 1253@-@-@0@0@0@0@1282#vu_long ^1099 9@-@-@0@0@0@0@1283#swblk_t ^1100 1278@-@-@0@0@0@0@1284#fixpt_t ^1101 9@-@-@0@0@0@0@1285#segsz_t ^1102 0@a@=@0@0@0@0@1286#fd_set *4 (Function) ^1103 1289$@0@g26@6@0@1@tp2,g26$@0#ioctl ^1104 1874$@0@s3@1@s3,g26$@0#vfork *7 (Struct tag) ^1105 1292@1293#@iovec *1 (Constant) ^1106 5$#UIO_MAXIOV#IOV_MAX *4 (Function) ^1108 1296$@0@s3,g26@6@0@1@fiov_base.tp1,s3,g26$@0#readv ^1109 1298$@0@g26@6@0@1@g26$@0#writev *7 (Struct tag) ^1110 1299@1300#@poll *1 (Constant) ^1111 7$#POLLIN#POLLRDNORM#POLLRDBAND#POLLPRI#POLLOUT#POLLWRNORM#POLLWRBAND#POLLERR#POLLHUP#POLLNVAL *4 (Function) ^1121 1303$@0@g26@6@0@1@frevents.ap0,g26$@0#poll *1 (Constant) ^1122 5$#SOCK_RDM#SO_USELOOPBACK#SO_REUSEPORT#AF_LOCAL#AF_IMPLINK#AF_PUP#AF_CHAOS#AF_NS#AF_ISO#AF_OSI#AF_ECMA#AF_DATAKIT#AF_CCITT#AF_SNA#AF_DECnet#AF_DLI#AF_LAT#AF_HYLINK#AF_APPLETALK#AF_ROUTE#AF_LINK#pseudo_AF_XTP#AF_COIP#AF_CNT#pseudo_AF_RTIP#AF_IPX#AF_SIP#pseudo_AF_PIP#AF_ISDN#AF_E164#AF_MAX#MSG_DONTWAIT#MSG_EOF#MSG_COMPAT#PF_UNSPEC#PF_LOCAL#PF_UNIX#PF_INET#PF_IMPLINK#PF_PUP#PF_CHAOS#PF_NS#PF_ISO#PF_OSI#PF_ECMA#PF_DATAKIT#PF_CCITT#PF_SNA#PF_DECnet#PF_DLI#PF_LAT#PF_HYLINK#PF_APPLETALK#PF_ROUTE#PF_LINK#PF_XTP#PF_COIP#PF_CNT#PF_SIP#PF_IPX#PF_RTIP#PF_PIP#PF_ISDN#PF_MAX#NET_MAXID#NET_RT_DUMP#NET_RT_FLAGS#NET_RT_IFLIST#NET_RT_MAXID *0 (Datatype) ^1191 14@-@-@0@0@0@0@1306#sa_family_t ^1192 14@-@-@0@0@0@0@1307#__socklen_t ^1193 14@-@-@0@0@0@0@1308#socklen_t *7 (Struct tag) ^1194 1309@1310#@sockaddr ^1195 1311@1312#@sockaddr_storage ^1196 1313@1314#@msghdr ^1197 1315@1316#@cmsghdr *1 (Constant) ^1198 5$#SCM_RIGHTS *4 (Function) ^1199 1320$^@19@2@0#CMSG_DATA ^1200 1324@6@5@1@0@0^@19@2@0#CMSG_NXTHDR ^1201 1327@6@5@1@0@0^@19@2@0#CMSG_FIRSTHDR *7 (Struct tag) ^1202 1328@1329#@linger *1 (Constant) ^1203 5$#SOCK_DGRAM#SOCK_RAW#SOCK_SEQPACKET#SOCK_STREAM#SOL_SOCKET#SO_ACCEPTCONN#SO_BROADCAST#SO_DEBUG#SO_DONTROUTE#SO_ERROR#SO_KEEPALIVE#SO_LINGER#SO_OOBINLINE#SO_RCVBUF#SO_RCVLOWAT#SO_RCVTIMEO#SO_REUSEADDR#SO_SNDBUF#SO_SNDLOWAT#SO_SNDTIMEO#SO_TYPE#SOMAXCONN#MSG_CTRUNC#MSG_DONTROUTE#MSG_EOR#MSG_OOB#MSG_PEEK#MSG_TRUNC#MSG_WAITALL#AF_INET#AF_INET6#AF_UNIX#AF_UNSPEC#SHUT_RD#SHUT_RDWR#SHUT_WR *4 (Function) ^1239 1332$@0@g26@6@0@1@tp2,g26$@0#accept ^1240 1334$@0@g26@6@0,s3@1@g26,s3$@0#bind ^1241 1336$@0@g26@6@0,s1@1@g26,s1$@0#connect ^1242 1339$@0@g26@6@0@1@tp1,tp2,g26$@0#getpeername ^1243 1343$@0@g26@6@0@1@tp1,tp2,g26$@0#getsockname ^1244 1346$@0@g26@6@0@1@tp3,tp4,g26$@0#getsockopt ^1245 1348$@0@g26@6@0,s1@1@g26,s1$@0#listen ^1246 1350$@0@g26@6@0@1@tp1,g26$@0#recv ^1247 1352$@0@g26@6@0@1@tp1,tp4,tp5,g26$@0#recvfrom ^1248 1354$@0@g26@6@0@1@afiov_base.tfmsg_iov.tp1,g26$@0#recvmsg ^1249 1356$@0@g26@6@0@1@g26$@0#send ^1250 1358$@0@g26@6@0@1@g26$@0#sendto ^1251 1360$@0@g26@6@0@1@g26$@0#sendmsg ^1252 1362$@0@s1,g26@6@0@1@s1,g26$@0#setsockopt ^1253 1364$@0@g26@6@0@1@g26$@0#shutdown ^1254 1366$@0@g26@6@0@1@g26$@0#socket ^1255 1368$@0@g26@6@0@1@g26$@0#socketpair *1 (Constant) ^1256 5$#BADSIG#SA_ONSTACK#SA_RESTART#SA_DISABLE#SIGBUS#SIGEMT#SIGINFO#SIGIO#SIGIOT#SIGPOLL#SIGPROF#SIGPWR#SIGSYS#SIGTRAP#SIGURG#SIGVTALRM#SIGWINCH#SIGXCPU#SIGXFSZ *4 (Function) ^1275 1370$@0@s3@1@s3$@0#psignal ^1276 1372$@1@g802@6@0,g26@6@0@1@tg802,g26$@0#setenv ^1277 1374$@1@g802@6@0@1@tg802$@0#unsetenv ^1278 1376$^$@0#WCOREDUMP ^1279 1378$^$@0#W_EXITCODE ^1280 1380$^$@0#W_STOPCODE *1 (Constant) ^1281 5$#WAIT_ANY#WAIT_MYPGRP#WSTOPPED *7 (Struct tag) ^1284 1623@1381#@rusage *4 (Function) ^1285 1384$@0@g26@6@0@1@tp0,tp2,g26$@0#wait3 ^1286 1386$@0@g26@6@0@1@tp1,tp3,g26$@0#wait4 *7 (Struct tag) ^1287 1387@1388#@timeval ^1288 1389@1390#@timespec ^1289 1391@1392#@timezone *1 (Constant) ^1290 5$#DST_NONE#DST_USA#DST_AUST#DST_WET#DST_MET#DST_EET#DST_CAN#ITIMER_PROF#ITIMER_REAL#ITIMER_VIRTUAL *7 (Struct tag) ^1300 1393@1394#@itimerval ^1301 1395@1396#@clockinfo *4 (Function) ^1302 1399$@0@s1,g26@6@0@1@s1,tp1,g26$@0#adjtime ^1303 1402$@0@g26@6@0@1@g26,tp1$@0#getitimer ^1304 1405$@0@g26@6@0@1@tp0,tp1,g26$@0#gettimeofday ^1305 1407$@0@g26@6@0,s1@1@tp2,g26,s1$@0#setitimer ^1306 1409$@0@s1,g26@6@0@1@s1,g26$@0#settimeofday ^1307 1411$@0@s3,g26@6@0@1@s3,g26$@0#utimes *1 (Constant) ^1308 5$#PROT_READ#PROT_WRITE#PROT_EXEC#MAP_SHARED#MAP_PRIVATE#MAP_COPY#MAP_FIXED#MAP_RENAME#MAP_NORESERVE#MAP_INHERIT#MAP_NOEXTEND#MAP_HASSEMAPHORE#MS_ASYNC#MS_INVALIDATE#MAP_FILE#MAP_ANON#MADV_NORMAL#MADV_RANDOM#MADV_SEQUENTIAL#MADV_WILLNEED#MADV_DONTNEED *4 (Function) ^1329 1413$@0@@1@p0$@0#mmap ^1330 1415$^$@0#madvise ^1331 1417$^$@0#mprotect ^1332 1419$@0@s3,g26@6@0@1@s3,tp0,g26$@0#munmap ^1333 1421$^$@0#msync ^1334 1423$^$@0#mlock ^1335 1425$^$@0#munlock *7 (Struct tag) ^1336 1426@1427#@winsize *1 (Constant) ^1337 5$#TIOCMODG#TIOCMODS#TIOCM_LE#TIOCM_DTR#TIOCM_RTS#TIOCM_ST#TIOCM_SR#TIOCM_CTS#TIOCM_CAR#TIOCM_CD#TIOCM_RNG#TIOCM_RI#TIOCM_DSR#TIOCEXCL#TIOCNXCL#TIOCFLUSH#TIOCGETA#TIOCSETA#TIOCSETAW#TIOCSETAF#TIOCGETD#TIOCSETD#TIOCSBRK#TIOCCBRK#TIOCSDTR#TIOCCDTR#TIOCGPGRP#TIOCSPGRP#TIOCOUTQ#TIOCSTI#TIOCNOTTY#TIOCPKT#TIOCPKT_DATA#TIOCPKT_FLUSHREAD#TIOCPKT_FLUSHWRITE#TIOCPKT_STOP#TIOCPKT_START#TIOCPKT_NOSTOP#TIOCPKT_DOSTOP#TIOCPKT_IOCTL#TIOCSTOP#TIOCSTART#TIOCMSET#TIOCMBIS#TIOCMBIC#TIOCMGET#TIOCREMOTE#TIOCGWINSZ#TIOCSWINSZ#TIOCUCNTL#TIOCSTAT#TIOCCONS#TIOCSCTTY#TIOCEXT#TIOCSIG#TIOCDRAIN#TIOCMSDTRWAIT#TIOCMGDTRWAIT#TIOCTIMESTAMP#TIOCSDRAINWAIT#TIOCGDRAINWAIT#TTYDISC#TABLDISC#SLIPDISC#PPPDISC#MAXHOSTNAMELEN *4 (Function) ^1403 1430$@0@@1@tp1$@0#FD_CLR ^1404 1432$@0@@1@tp1$@0#FD_COPY ^1405 1435$^$@0#FD_ISSET ^1406 1437$@0@@1@tp1$@0#FD_SET ^1407 1439$@0@@1@tp0$@0#FD_ZERO ^1408 1742$@0@s1,g26@6@0@1@s1,g26$@0#fchdir ^1409 1740$@0@g26@6@0,s3@1@g26,s3$@0#fchown ^1410 1750$@0@g26@6@0,s3@1@g26,s3$@0#fsync ^1411 1752$@0@g26@6@0,s3@1@g26,s3$@0#ftruncate ^1412 1449$@0@@1@p0$@0#gethostname ^1413 1451$@0@s1@1@s1$@0#initgroups ^1414 1798$@0@g26@6@0,s3@1@g26,s3$@0#lchown ^1415 1455$@0@g26@6@0@1@tp1,tp2,tp3,tp4,g26$@0#select ^1416 1457$@0@g26@6@0,s1@1@g26,s1$@0#setegid ^1417 1459$@0@g26@6@0,s1@1@g26,s1$@0#seteuid ^1418 1462$@0@g26@6@0,s1@1@g26,s1$@0#setgroups ^1419 1839$@0@g26@6@0,s1@1@g26,s1$@0#setregid ^1420 1841$@0@g26@6@0,s1@1@g26,s1$@0#setreuid ^1421 1853$@0@s3@1@s3$@0#sync ^1422 1861$@0@g26@6@0,s3@1@g26,s3$@0#truncate *1 (Constant) ^1423 5$#EBADRPC#ERPCMISMATCH#EPROGUNAVAIL#EPROGMISMATCH#EPROCUNAVAIL#EFTYPE#EAUTH#ENEEDAUTH#ELAST *3 (Variable) ^1432 23|@1|6@0@0@0@1#TMAGIC *1 (Constant) ^1433 5$#TMAGLEN *3 (Variable) ^1434 23|@1|6@0@0@0@1#TVERSION *1 (Constant) ^1435 5$#TVERSLEN#REGTYPE#AREGTYPE#LNKTYPE#SYMTYPE#CHRTYPE#BLKTYPE#DIRTYPE#FIFOTYPE#CONTTYPE#TSUID#TSGID#TSVTX#TUREAD#TUWRITE#TUEXEC#TGREAD#TGWRITE#TGEXEC#TOREAD#TOWRITE#TOEXEC *7 (Struct tag) ^1457 1473@1474#@ipc_perm *1 (Constant) ^1458 5$#IPC_R#IPC_W#IPC_M#IPC_CREAT#IPC_EXCL#IPC_NOWAIT ^1464 1189$#IPC_PRIVATE ^1465 5$#IPC_RMID#IPC_SET#IPC_STAT *7 (Struct tag) ^1468 0@1475#@msg ^1469 1477@1478#@msqid_ds ^1470 1479@1480#@mymesg *1 (Constant) ^1471 5$#MSG_NOERROR#MSGMAX#MSGMNB#MSGMNI#MSGTQL *4 (Function) ^1476 1483$@0@g26@6@0@1@g26,tp2$@0#msgctl ^1477 1485$@0@g26@6@0@1@g26$@0#msgget ^1478 1487$@0@g26@6@0@1@g26,tp1$@0#msgrcv ^1479 1489$@0@g26@6@0@1@g26$@0#msgsnd *7 (Struct tag) ^1480 1494@1490#@sem ^1481 1492@1493#@semid_ds *8 (Union tag) ^1482 1497@1498#$semun *7 (Struct tag) ^1483 1499@1500#@sembuf *1 (Constant) ^1484 5$#SEM_A#SEMAEM#SEMMNI#SEMMNS#SEMMNU#SEMMSL#SEMOPN#SEM_R#SEMUME#SEM_UNDO#SEMVMX#GETVAL#SETVAL#GETPID#GETNCNT#GETZCNT#GETALL#SETALL#ERMID *4 (Function) ^1503 1502$@0@g26@6@0@1@g26$@0#semctl ^1504 1504$@0@g26@6@0@1@g26$@0#semget ^1505 1507$@0@g26@6@0@1@g26$@0#semop *7 (Struct tag) ^1506 1508@1509#@shmid_ds *1 (Constant) ^1507 5$#SHMLBA#SHM_LOCK#SHMMAX#SHMMIN#SHMMNI#SHM_R#SHM_RDONLY#SHM_RND#SHMSEG#SHM_W#SHM_UNLOCK *4 (Function) ^1518 1512$@0@g26@6@0@1@g26@3@0@0#shmat ^1519 1515$@0@g26@6@0@1@g26,tp2$@0#shmctl ^1520 1517$@0@g26@6@0@1@g26$@0#shmdt ^1521 1519$@0@g26@6@0@1@g26$@0#shmget *1 (Constant) ^1522 5$#LOG_EMERG#LOG_ALERT#LOG_CRIT#LOG_ERR#LOG_WARNING#LOG_NOTICE#LOG_INFO#LOG_DEBUG#LOG_KERN#LOG_USER#LOG_MAIL#LOG_DAEMON#LOG_AUTH#LOG_SYSLOG#LOG_LPR#LOG_NEWS#LOG_UUCP#LOG_CRON#LOG_AUTHPRIV#LOG_FTP#LOG_LOCAL0#LOG_LOCAL1#LOG_LOCAL2#LOG_LOCAL3#LOG_LOCAL4#LOG_LOCAL5#LOG_LOCAL6#LOG_LOCAL7#LOG_PID#LOG_CONS#LOG_ODELAY#LOG_NDELAY#LOG_NOWAIT#LOG_PERROR *4 (Function) ^1556 1521$^$@0#LOG_MASK ^1557 1523$^$@0#LOG_UPTO ^1558 1525$@0@s3@1@s3$@0#closelog ^1559 1527$@0@s3@1@s3$@0#openlog ^1560 1529$@0@s1@1@s1$@0#setlogmask ^1561 1531@6@0@1@1@0@0@s3@1@s3$@0#syslog ^1562 1533$@0@s3@1@s3$@0#vsyslog ^1563 1535$@0@s1@1@s1$@0#endpwent ^1564 1538@6@5@1@0@0@0@s1@1@s1@3@0@0#getpwent ^1565 1540$@0@s1@1@s1$@0#setpassent ^1566 1542$@0@s1@1@s1$@0#setpwent ^1567 1544$@0@s1@1@s1$@0#endgrent ^1568 1547@6@5@1@0@0@0@s1@1@s1@19@3@0#getgrent ^1569 1549$@0@s1@1@s1$@0#setgrent ^1570 1551$@0@s1@1@s1$@0#setgrfile ^1571 1553$@0@s1@1@s1$@0#setgroupent *1 (Constant) ^1572 858$#S_IRWXG#S_IRWXO#S_ISVTX *4 (Function) ^1575 1577$^$@0#S_ISLNK ^1576 1580$^$@0#S_TYPEISMQ ^1577 1583$^$@0#S_TYPEISSEM ^1578 1586$^$@0#S_TYPEISSHM ^1579 1588$@0@g26@6@0@1@g26$@0#lstat ^1580 1590$@0@g26@6@0@1@g26$@0@W:portability#The only portable use of mknod is to create FIFO-special file. If mode is not S_IFIFO or dev is not 0, the behaviour of mknod() is unspecified.##mknod ^1581 1592$@0@s3,g26@6@0@1@s3,g26$@0@W:unixstandard#Not in Single UNIX Specification Version 2##chflags ^1582 1594$@0@s3,g26@6@0@1@s3,g26$@0@W:unixstandard#Not in Single UNIX Specification Version 2##fchflags ^1583 1596$@0@s3,g26@6@0@1@s3,g26$@0#fchmod *7 (Struct tag) ^1584 1597@1598#@statvfs *1 (Constant) ^1585 10$#ST_RDONLY#ST_NOSUID *4 (Function) ^1587 1601$@0@@1@p1$@0#fstatvfs ^1588 1603$@0@@1@p1$@0#statvfs *1 (Constant) ^1589 5$#FMNAMESZ#MSG_BAND#MSG_HIPRI#RS_HIPRI#S_INPUT#S_RDNORM#S_RDBAND#S_BANDURG#S_HIPRI#S_OUTPUT#S_WRNORM#S_WRBAND#S_MSG#S_ERROR#S_HANGUP *7 (Struct tag) ^1604 1604@1605#@strbuf ^1605 1606@1607#@str_mlist ^1606 1609@1610#@str_list *4 (Function) ^1607 1613$@0@g26@6@0@1@tp1,tp2,g26$@0#getmsg ^1608 1615$@0@g26@6@0@1@tp3,tp1,tp2,g26$@0#getpmsg ^1609 1617$@0@s1,g26@6@0@1@s1,g26$@0#putmsg ^1610 1619$@0@s1,g26@6@0@1@s1,g26$@0#putpmsg *1 (Constant) ^1611 5$#PRIO_PROCESS#PRIO_PGRP#PRIO_USER *0 (Datatype) ^1614 14@-@-@0@0@0@0@1620#rlim_t *1 (Constant) ^1615 1620$#RLIM_INFINITY#RLIM_SAVED_MAX#RLIM_SAVED_CUR ^1618 5$#RUSAGE_SELF#RUSAGE_CHILDREN *7 (Struct tag) ^1620 1621@1622#@rlimit *1 (Constant) ^1621 5$#RLIMIT_CORE#RLIMIT_CPU#RLIMIT_DATA#RLIMIT_FSIZE#RLIMIT_NOFILE#RLIMIT_STACK#RLIMIT_AS *4 (Function) ^1628 1625$@0@g26@6@0@1@g26$@0#getpriority ^1629 1628$@0@g26@6@0@1@tp1,g26$@0#getrlimit ^1630 1630$@0@g26@6@0@1@tp1,g26$@0#getrusage ^1631 1632$@0@g26@6@0,s1@1@g26,s1$@0#setpriority ^1632 1634$@0@g26@6@0,s1@1@g26,s1$@0#setrlimit *7 (Struct tag) ^1633 1635@1636#@servent *4 (Function) ^1634 1640@6@5@1@0@0$@18@3@0@W:multithreaded#Unsafe in multithreaded applications, use getsrvbyname_r instead##getservbyname ^1635 1643$$$@0#getservbyname_r ^1636 1646$$@18@3@0@W:multithreaded#Unsafe in multithreaded applications, use getservbyport_r instead##getservbyport ^1637 1649$$$@0#getservbyport_r ^1638 1652@6@5@1@0@0$@3@0@0#getservent ^1639 1655@6@5@1@0@0$@3@0@0#getservent_r ^1640 1657$$$@0#setservent ^1641 1659$$$@0#endservent *3 (Variable) ^1642 5|@1|6@0@0&#h_errno *7 (Struct tag) ^1643 1695@1660#@hostent *4 (Function) ^1644 1664@6@5@1@0@0@0@g1642@6@0@1@g1642@19@3@0@W:multithreaded#Unsafe in multithreaded applications, use gethostbyname_r instead##gethostbyname ^1645 1667$$$@0#gethostbyname_r ^1646 1670@6@5@1@0@0@0@g1642@6@0@1@g1642@19@3@0@W:multithreaded#Unsafe in multithreaded applications, use gethostbyaddr_r instead##gethostbyaddr ^1647 1673$$$@0#gethostbyaddr_r ^1648 1676@6@5@1@0@0$@19@3@0@W:multithreaded#Unsafe in multithreaded applications, use gethostent_r instead##gethostent ^1649 1679$$$@0#gethostent_r ^1650 1682$$@3@0@0#fgethostent ^1651 1685$$@3@0@0#fgethostent_r ^1652 1687$$$@0#sethostent ^1653 1689$$$@0#endhostent ^1654 1691$$$@0#herror ^1655 1694$$@3@0@0#hstrerror *1 (Constant) ^1656 5$#_POSIX2_VERSION#_POSIX2_C_VERSION#_XOPEN_VERSION#_XOPEN_XCU_VERSION#_CS_PATH#_CS_XBS5_ILP32_OFF32_CFLAGS#_CS_XBS5_ILP32_OFF32_LDFLAGS#_CS_XBS5_ILP32_OFF32_LIBS#_CS_XBS5_ILP32_OFF32_LINTFLAGS#_CS_XBS5_ILP32_OFFBIG_CFLAGS#_CS_XBS5_ILP32_OFFBIG_LDFLAGS#_CS_XBS5_ILP32_OFFBIG_LIBS#_CS_XBS5_ILP32_OFFBIG_LINTFLAGS#_CS_XBS5_LP64_OFF64_CFLAGS#_CS_XBS5_LP64_OFF64_LDFLAGS#_CS_XBS5_LP64_OFF64_LIBS#_CS_XBS5_LP64_OFF64_LINTFLAGS#_CS_XBS5_LPBIG_OFFBIG_CFLAGS#_CS_XBS5_LPBIG_OFFBIG_LDFLAGS#_CS_XBS5_LPBIG_OFFBIG_LIBS#_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS#_SC_2_C_BIND#_SC_2_C_DEV#_SC_2_C_VERSION#_SC_2_FORT_DEV#_SC_2_FORT_RUN#_SC_2_LOCALEDEF#_SC_2_SW_DEV#_SC_2_UPE#_SC_2_VERSION#_SC_AIO_LISTIO_MAX#_SC_AIO_MAX#_SC_AIO_PRIO_DELTA_MAX#_SC_ASYNCHRONOUS_IO#_SC_ATEXIT_MAX#_SC_BC_BASE_MAX#_SC_BC_DIM_MAX#_SC_BC_SCALE_MAX#_SC_BC_STRING_MAX#_SC_COLL_WEIGHTS_MAX#_SC_DELAYTIMER_MAX#_SC_EXPR_NEST_MAX#_SC_FSYNC#_SC_GETGR_R_SIZE_MAX#_SC_GETPW_R_SIZE_MAX#_SC_IOV_MAX#_SC_LINE_MAX#_SC_LOGIN_NAME_MAX#_SC_MAPPED_FILES#_SC_MEMLOCK#_SC_MEMLOCK_RANGE#_SC_MEMORY_PROTECTION#_SC_MESSAGE_PASSING#_SC_MQ_OPEN_MAX#_SC_MQ_PRIO_MAX#_SC_PAGESIZE#_SC_PAGE_SIZE#_SC_PASS_MAX#_SC_PRIORITIZED_IO#_SC_PRIORITY_SCHEDULING#_SC_RE_DUP_MAX#_SC_REALTIME_SIGNALS#_SC_RTSIG_MAX#_SC_SEMAPHORES#_SC_SEM_NSEMS_MAX#_SC_SEM_VALUE_MAX#_SC_SHARED_MEMORY_OBJECTS#_SC_SIGQUEUE_MAX#_SC_SYNCHRONIZED_IO#_SC_THREADS#_SC_THREAD_ATTR_STACKADDR#_SC_THREAD_ATTR_STACKSIZE#_SC_THREAD_DESTRUCTOR_ITERATIONS#_SC_THREAD_KEYS_MAX#_SC_THREAD_PRIORITY_SCHEDULING#_SC_THREAD_PRIO_INHERIT#_SC_THREAD_PRIO_PROTECT#_SC_THREAD_PROCESS_SHARED#_SC_THREAD_SAFE_FUNCTIONS#_SC_THREAD_STACK_MIN#_SC_THREAD_THREADS_MAX#_SC_TIMERS#_SC_TIMER_MAX#_SC_TTY_NAME_MAX#_SC_XOPEN_VERSION#_SC_XOPEN_CRYPT#_SC_XOPEN_ENH_I18N#_SC_XOPEN_SHM#_SC_XOPEN_UNIX#_SC_XOPEN_XCU_VERSION#_SC_XOPEN_LEGACY#_SC_XOPEN_REALTIME#_SC_XOPEN_REALTIME_THREADS#_SC_XBS5_ILP32_OFF32#_SC_XBS5_ILP32_OFFBIG#_SC_XBS5_LP64_OFF64#_SC_XBS5_LPBIG_OFFBIG *4 (Function) ^1753 1701$@0@g26@6@0@1@g26$@0@W:legacy#brk is obsolete##brk ^1754 1709$@1@s1,g26@6@0@1@g26$@0#confstr ^1755 1712@6@5@1@0@0@0@g26@6@0,s1@1@g26,s1@18@0@0#crypt ^1756 1724$@0@g26@6@0@1@p0,g26$@0#encrypt ^1757 1744$@0@g26@6@0,s3@1@g26,s3$@0#fdatasync ^1758 1757$$$@0@W:legacy#getdtablesize is obsolete##getdtablesize ^1759 1767$@1@s1@0@$@0#gethostid ^1760 1772$$$@0#getlogin_r *3 (Variable) ^1761 23|@1|6@0@0@0@1#optarg ^1762 5|@1|6@0@0@0@1#optind#opterr#optopt *4 (Function) ^1765 1998$@1@g1762@6@0,g1763@6@0,g1764@6@0,g26@6@0@1@g1762,g1763,g1764,g26,g1761$@0#getopt ^1766 1776$$$@0@W:legacy#getpagesize is obsolete##getpagesize ^1767 1779@6@5@1@0@0$@18@0@0@W:legacy#getpass is obsolete##getpass ^1768 1781$@1@g26@6@0,s1@1@g26$@0#getpgid ^1769 1789$@1@g26@6@0,s1@1@g26$@0#getsid ^1770 1794@6@5@1@0@0@0@@1@p0$@0#getwd ^1771 1802$@0@g26@6@0,s3@1@g26,s3$@0#lockf ^1772 1806$@0@g26@6@0,s3@1@g26,s3$@0#nice ^1773 1814$@0@g26@6@0,s3@1@g26,s3$@0#pread ^1774 1828$@0@g26@6@0,s3@1@g26,s3$@0#pthread_atfork ^1775 1830$@0@g26@6@0,s3@1@g26,s3$@0#pwrite ^1776 1832$@0@g26@6@0,s3@1@g26,s3,tp1$@0#readlink ^1777 1835$@0@g26@6@0@1@g26@3@0@0@W:legacy#sbrk is obsolete##sbrk ^1778 1837$@0@s1@1@s1$@0#setpgrp ^1779 1849$$$@0#swab ^1780 1866$$$@0#ttyname_r ^1781 1868$@0@s3@1@s3$@0#ualarm ^1782 1940$@0@s3,g26@6@0@1@s3,g26$@0#usleep ^1783 1876$@0@s1,g26@6@0@1@s1,g26$@0@W:superuser#Only super-user processes may call chroot.##chroot ^1784 1878$$$@0@W:superuser#Only super-user processes may call fchroot.##fchroot ^1785 1883$^$@0#isascii ^1786 1886$$$@0#toascii ^1787 1890$$$@0#_toupper ^1788 1893$$$@0#_tolower ^1789 2060$@0@s1@1@s1$@0#drand48 ^1790 1899$@0@s1@1@s1$@0#erand48 ^1791 2155$@0@s1@1@s1$@0#srand48 *0 (Datatype) ^1792 14@-@-@0@0@0@0@1902#in_port_t ^1793 14@-@-@0@0@0@0@1903#in_addr_t *7 (Struct tag) ^1794 1904@1905#@in_addr ^1795 1908@1909#@sockaddr_in *1 (Constant) ^1796 5$#IPPROTO_IP#IPPROTO_ICMP#IPPROTO_TCP#IPPROTO_UDP ^1800 1903$#INADDR_ANY#INADDR_BROADCAST *4 (Function) ^1802 1911$^$@0#htonl ^1803 1913$^$@0#htons ^1804 1915$^$@0#ntohl ^1805 1917$^$@0#ntohs ^1806 1926$@0@@1@tp2$@0#readdir_r ^1807 1930$$$@0#seekdir ^1808 1932$$$@0#telldir ^1809 1935$@0@@1@tp0$@0#stpcpy ^1810 1938$@0@@1@tp0$@0#stpncpy ^1811 1943$$@5@0@0#inet_ntoa ^1812 1947$@0@g26@6@0@1@g26$@0#j0 ^1813 1949$@0@g26@6@0@1@g26$@0#j1 ^1814 1951$@0@g26@6@0@1@g26$@0#jn ^1815 1953$@0@g26@6@0@1@g26$@0#y0 ^1816 1955$@0@g26@6@0@1@g26$@0#y1 ^1817 1957$@0@g26@6@0@1@g26$@0#yn *1 (Constant) ^1818 23$#P_tmpdir *4 (Function) ^1819 1984$@0@s3@1@p0,s3$@0#flockfile ^1820 1986$@0@g26@6@0@1@p0,g26$@0#fseeko ^1821 1988$@0@g26@6@0@1@g26$@0#ftello ^1822 1990$@0@s3,g26@6@0@1@p0,s3,g26$@0#ftrylockfile ^1823 1992$@0@s3@1@p0,s3$@0#funlockfile ^1824 1994$@0@s3,g26@6@0@1@tp0,s3,g26$@0@W:multithreaded#getc_unlocked is a thread unsafe version of getc##getc_unlocked ^1825 1996$@1@g21@6@0,s3@1@tg21,s3$@0@W:multithreaded#getchar_unlocked is a thread unsafe version of getchar##getchar_unlocked *3 (Variable) ^1826 5|@1|6@0@0@0@1#optreset *4 (Function) ^1827 2000$@0@s3,g26@6@0@1@s3,tp0,g26$@0@W:legacy#.##getw ^1828 2002$@0@s3,g26@6@0@1@s3,tp0,g26$@0#pclose ^1829 2005@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#popen ^1830 2007$@0@s3,g26@6@0@1@s3,tp1,g26$@0@W:multithreaded#putc_unlocked is a thread unsafe version of putc##putc_unlocked ^1831 2009$@0@s3,g22@6@0,g26@6@0@1@s3,tg22,g26$@0@W:multithreaded#putchar_unlocked is a thread unsafe version of putchar##putchar_unlocked ^1832 2011$@0@s3,g22@6@0,g26@6@0@1@s3,tg22,g26$@0@W:legacy#.##putw ^1833 2020@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@3@0@0@W:toctou#Between the time a pathname is created and the file is opened, it is possible for some other process to create a file with the same name. Use tmpfile instead.##tempnam ^1834 2028$$$@0#a64l *7 (Struct tag) ^1835 2055@2056#@!8 *4 (Function) ^1836 2063$$@3@0@0#ecvt ^1837 2066$$@3@0@0#fcvt ^1838 2069$$@3@0@0#gcvt ^1839 2074$@0@@1@p0,p2$@0#getsubopt ^1840 2076$@0@s3,g26@6@0@1@s3,g26$@0#grantpt ^1841 2079$@0@s1@1@s1,p1@3@0@0#initstate ^1842 2083$@0@s1@1@s1$@0#jrand48 ^1843 2086$$@3@0@0#l64a ^1844 2092$@0@s1@1@s1$@0#lcong48 *7 (Struct tag) ^1845 2093@2094#@!9 *4 (Function) ^1846 2098$@0@s1@1@s1$@0#lrand48 ^1847 2110$@0@@1@p0@3@0@0#mktemp ^1848 2112$@0@s3@1@p0,s3$@0#mkstemp ^1849 2114$@0@s1@1@s1$@0#mrand48 ^1850 2118$@0@s1@1@s1,p0$@0#nrand48 ^1851 2121$$@18@0@0#ptsname ^1852 2123$@1@g802@6@0,g26@6@0@1@tg802,g26$@0#putenv ^1853 2133$@0@@1@p0$@0#rand_r ^1854 2135$@0@s1@1@s1$@0#random ^1855 2141$$@3@0@0#realpath ^1856 2146$@0@s1@1@s1@3@0@0#seed48 ^1857 2148$@0@s1,g26@6@0@1@s1,g26$@0#setkey ^1858 2151$@0@s1,g26@6@0@1@s1,g26@2@0@0#setstate ^1859 2157$@0@s1@1@s1$@0#srandom ^1860 2167$^$@0#ttyslot ^1861 2169$@0@s3,s1@1@s3,s1$@0#unlockpt ^1862 2172$@0@g26@6@0@1@g26@3@0@0#valloc ;; Library constraints start_Buffer_Constraints setvbuf pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 3 e2 2 3 -1 ;; end precondition constraints post:EMPTY snprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY vsnprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY fgets pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 0 C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints fread pre:EMPTY post: C 0@1@4 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints fwrite pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY fgetpos pre: C 0@1@3 l 1 1 2 2 Param 460 1 r 2 3 0 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 460 1 r 2 3 0 ;; end precondition constraints calloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints malloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints realloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints bsearch pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY qsort pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY mblen pre: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY mbtowc pre: C 0@1@3 l 1 3 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY mbstowcs pre: C 0@1@3 l 1 1 2 2 Param 554 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY wcstombs pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memcpy pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memmove pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY strcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@4 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints strncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints strcat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 3 2 2 Result r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints strncat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints strchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strrchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strstr pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints memset pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints strlen pre:EMPTY post: C 0@1@4 l 2 2 Result r 1 3 2 2 Param 23 0 ;; end precondition constraints asctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints getpwnam pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getpwuid pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getcwd pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 2 2 Param 64 1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints getgroups pre: C 0@1@3 l 1 1 2 2 Param 1110 1 r 2 2 Param 5 0 ;; end precondition constraints post:EMPTY pipe pre: C 0@1@4 l 1 3 2 2 Param 43 0 r 2 3 1 ;; end precondition constraints post:EMPTY read pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints write pre: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regexec pre: C 0@1@3 l 1 1 2 2 Param 1176 3 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regerror pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 64 3 ;; end precondition constraints post:EMPTY getservbyname_r pre: C 0@1@3 l 1 1 2 2 Param 23 3 r 2 2 Param 5 4 ;; end precondition constraints post:EMPTY getservbyport_r pre: C 0@1@3 l 1 1 2 2 Param 23 3 r 2 2 Param 5 4 ;; end precondition constraints post:EMPTY gethostbyname_r pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 5 3 ;; end precondition constraints post:EMPTY gethostbyaddr pre: C 0@1@4 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY gethostbyaddr_r pre: C 0@1@3 l 1 1 2 2 Param 23 4 r 2 2 Param 5 5 C 0@1@4 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY gethostent_r pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 2 2 Param 5 2 ;; end precondition constraints post:EMPTY encrypt pre: C 0@1@4 l 1 1 2 2 Param 42 0 r 2 3 63 ;; end precondition constraints post:EMPTY getlogin_r pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY getopt pre: C 0@1@3 l 1 3 2 2 Param 486 1 r 0 1 e1 2 2 Param 5 0 e2 2 3 -1 ;; end precondition constraints post:EMPTY pread pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints pwrite pre: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY readlink pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY swab pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 65 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY ttyname_r pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY stpcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 0 2 e1 1 1 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints stpncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints inet_ntoa pre:EMPTY post: C 0@1@1 l 1 3 2 2 Result r 2 3 15 C 0@1@1 l 1 1 2 2 Result r 2 3 15 ;; end precondition constraints tempnam pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints gcvt pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 5 1 ;; end precondition constraints post:EMPTY initstate pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY jrand48 pre: C 0@1@3 l 1 1 2 2 Param 2081 0 r 2 3 2 ;; end precondition constraints post:EMPTY l64a pre:EMPTY post: C 0@1@1 l 1 1 2 2 Result r 2 3 5 C 0@1@1 l 1 3 2 2 Result r 2 3 5 ;; end precondition constraints lcong48 pre: C 0@1@3 l 1 3 2 2 Param 2090 0 r 2 3 6 ;; end precondition constraints post:EMPTY nrand48 pre: C 0@1@3 l 1 3 2 2 Param 2116 0 r 2 3 2 C 0@1@3 l 1 1 2 2 Param 2116 0 r 2 3 2 ;; end precondition constraints post:EMPTY seed48 pre: C 0@1@3 l 1 3 2 2 Param 2143 0 r 2 3 2 ;; end precondition constraints post:EMPTY setkey pre: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 63 ;; end precondition constraints post:EMPTY valloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints ;; Modules access _Bool#1@ types#1@ standard#9@ posix#18@ unix#20@ ;;End splint-3.1.2.dfsg1/lib/unixstrict.lcd0000644021234200000250000030537210645776247015145 0ustar fax;;; Splint Library unixstrict.lcd ;;Splint 3.018000 ;;lib:310 ;;ctTable 0 u-2 19 38 0 p1|-2 20 39 0 b-2 21 40 0 p3|-2 22 41 0 p4|-2 23 42 0 p5|-2 24 43 0 p6|-2 25 44 0 p7|-2 26 45 0 p8|-2 27 46 0 p9|-2 28 47 0 p10|-2 29 48 0 p11|-2 30 49 0 p12|-2 31 50 0 p13|-2 32 51 0 p14|-2 33 52 0 p15|-2 34 53 0 p16|-2 35 54 0 p17|-2 36 55 0 p18|-2 37 56 1 t0|0 460 1051 1 t1|1& 1 t2|2& 1 t3|3& 1 t4|4 461 1052 1 t5|5& 1 t6|6& 1 t7|7& 1 t8|8& 1 t9|9& 1 t10|10& 1 t11|11& 1 t12|12& 1 t13|13& 1 t14|14& 1 t15|15& 1 t16|16& 1 t17|17& 1 t18|18& 2 y0|0& 2 y1|1& 2 y2|2& 2 y3|3& 2 y4|4& 2 y5|5& 2 y6|6& 2 y7|7& 2 y8|8& 2 y9|9& 2 y10|10& 2 y11|11& 2 y12|12& 2 y13|13& 2 y14|14& 2 y15|15& 2 y16|16& 2 y17|17& 2 y18|18& -2 ?! 0 a0|& 0 s11|& 0 s12|& 0 s13|& 0 s27|& 0 s29|& 0 s30|-1 1304 -1 0 s31|& 0 s32|-1 529 -1 0 s33|& 0 a34|-1 547 -1 3 C0.5/20|! 3 C0.69/2|! 3 f0 (2|@7|$#,)! 3 f1 (2|@7|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f4 (5|$#,)! 3 f0 (5|$#,)! 3 f4 (5|$#,)! 3 Slconv{23|@1|0@0@3&#decimal_point,23|@1|0@0@3&#thousands_sep,23|@1|0@0@3&#grouping,23|@1|0@0@3&#int_curr_symbol,23|@1|0@0@3&#currency_symbol,23|@1|0@0@3&#mon_decimal_point,23|@1|0@0@3&#mon_thousands_sep,23|@1|0@0@3&#mon_grouping,23|@1|0@0@3&#positive_sign,23|@1|0@0@3&#negative_sign,4|@1|^#int_frac_digits,4|@1|^#frac_digits,4|@1|^#p_cs_precedes,4|@1|^#p_sep_by_space,4|@1|^#n_cs_precedes,4|@1|^#n_sep_by_space,4|@1|^#p_sign_posn,4|@1|^#n_sign_posn,}! 0 s51|-1 106 -1 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f23 (5|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 1 t100|100& 3 f106 ()! 0 s106|& 0 s107|& 3 C0.17/18|! 3 C0.16/110|! 0 s121|& 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (112|@7|$#,)! 3 f5 (112|@7|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,24|4@0@7&#,)! 3 f17 (17|$#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,36|4@0@7&#,)! 3 f17 (17|$#,36|4@0@7&#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,5|$#,)! 3 f17 (17|$#,5|$#,)! 3 f0 (17|$#,9|$#,)! 3 f17 (17|$#,9|$#,)! 3 f0 (18|$#,9|$#,)! 3 f18 (18|$#,9|$#,)! 3 f0 (17|$#,)! 3 f5 (17|$#,)! 3 f0 (16|$#,)! 3 f5 (16|$#,)! 3 f0 (18|$#,)! 3 f5 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (16|$#,16|$#,)! 3 f16 (16|$#,16|$#,)! 3 f0 (18|$#,18|$#,)! 3 f18 (18|$#,18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (16|$#,)! 3 f16 (16|$#,)! 3 f0 (18|$#,)! 3 f18 (18|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (16|$#,)! 3 f9 (16|$#,)! 3 f0 (18|$#,)! 3 f9 (18|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (16|$#,)! 3 f11 (16|$#,)! 3 f0 (18|$#,)! 3 f11 (18|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f9 (17|$#,)! 3 f0 (17|$#,)! 3 f11 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,24|4@0@7&#,)! 3 f17 (17|$#,17|$#,24|4@0@7&#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,18|$#,)! 3 f17 (17|$#,18|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,17|$#,17|$#,)! 3 f17 (17|$#,17|$#,17|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 3 f0 (112|$#,112|$#,)! 3 f5 (112|$#,112|$#,)! 0 a224|& 3 f0 (317|4@0@7&#,)! 3 f5 (317|4@0@7&#,)! 3 f0 (317|$#,5|$#,)! 3 f1 (317|$#,5|$#,)! 0 s233|& 3 ?! 3 f323 (5|$#,)! 3 f1 (5|$#,)^326 1 t325|325& 3 ?! 3 f327 (5|$#,)! 3 f1 (5|$#,)^330 1 t329|329& 3 ?! 3 f331 (5|$#,)! 3 f1 (5|$#,)^334 1 t333|333& 3 ?! 3 f335 (5|$#,)! 3 f1 (5|$#,)^338 1 t337|337& 3 f0 (5|$#,338|0@5@7&#,)! 3 f19 (5|$#,338|0@5@7&#,)^341 1 t340|340& 3 ?! 3 f342 (5|$#,)! 3 f19 (5|$#,)! 3 f1 (5|$#,338|0@5@7&#,)! 3 f1 (5|$#,)! 3 f346 (5|$#,338|0@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 a239|& 3 f0 (350|4@0@7&#,!.,)! 3 f1 (350|4@0@7&#,!.,)! 3 f0 (350|$#,)! 3 f1 (350|$#,)! 3 f0 (350|4@0@7&#,350|$#,)! 3 f1 (350|4@0@7&#,350|$#,)! 0 a243|-1 359 -1 0 a244|-1 435 -1 1 t357|357& 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f19 ()! 3 f359 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|0@5@7&#,)! 3 f5 (359|0@5@7&#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f359 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,359|$#,)! 3 f19 (23|$#,23|$#,359|$#,)! 3 f359 (23|$#,23|$#,359|$#,)! 3 f0 (359|$#,23|4@5@19@2@0#,)! 3 f1 (359|$#,23|4@5@19@2@0#,)! 3 f0 (359|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f5 (359|$#,23|4@5@19@2@0#,5|$#,64|$#,)! 3 f0 (359|$#,23|$#,!.,)! 3 f5 (359|$#,23|$#,!.,)! 3 f0 (359|$#,23|$#,!.,)! 3 f5 (359|$#,23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|$#,!.,)! 3 f5 (23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,!.,)! 3 f0 (23|4@0@7&#,23|$#,!.,)! 3 f5 (23|4@0@7&#,23|$#,!.,)! 3 f0 (23|$#,350|$#,)! 3 f5 (23|$#,350|$#,)! 3 f0 (359|$#,23|$#,350|$#,)! 3 f5 (359|$#,23|$#,350|$#,)! 3 f0 (23|4@0@7&#,23|$#,350|$#,)! 3 f5 (23|4@0@7&#,23|$#,350|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,350|$#,)! 3 f5 (23|4@0@7&#,64|$#,23|$#,350|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 f19 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 f23 (23|@5|4@0@7&#,5|$#,359|$#,)! 3 C0.5/4|! 3 f0 (411|$#,359|$#,)! 3 f5 (411|$#,359|$#,)! 3 f0 (23|$#,359|$#,)! 3 f5 (23|$#,359|$#,)! 3 f0 (359|@7|$#,)! 3 f5 (359|@7|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|4@0@7&#,)! 3 f19 (23|4@0@7&#,)! 3 f23 (23|4@0@7&#,)! 3 f0 (411|$#,359|@7|$#,)! 3 f5 (411|$#,359|@7|$#,)! 3 f0 (411|$#,)! 3 f5 (411|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (411|$#,359|$#,)! 3 f5 (411|$#,359|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f0 (20|$#,64|$#,64|$#,359|$#,)! 3 f64 (20|$#,64|$#,64|$#,359|$#,)! 1 t358|358& 3 f0 (359|$#,435|4@0@7&#,)! 3 f5 (359|$#,435|4@0@7&#,)! 3 f0 (359|$#,9|$#,5|$#,)! 3 f5 (359|$#,9|$#,5|$#,)! 3 f0 (359|$#,435|$#,)! 3 f5 (359|$#,435|$#,)! 3 f0 (359|$#,)! 3 f9 (359|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (23|0@5@7&#,)! 3 f1 (23|0@5@7&#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 1 t19|19& 1 t23|23& 3 f0 (23|$#,461|4@5@7&#,)! 3 f17 (23|$#,461|4@5@7&#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f9 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f10 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (20|4@2@2&#,)! 3 f1 (20|4@2@2&#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 ?! 3 f487 ()! 3 f1 ()^490 1 t489|489& 3 f0 (490|$#,)! 3 f5 (490|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 ?! 3 f498 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^501 1 t500|500& 3 f0 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,501|$#,)! 3 ?! 3 f505 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^508 1 t507|507& 3 f0 (20|$#,64|$#,64|$#,508|$#,)! 3 f1 (20|$#,64|$#,64|$#,508|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 S!2{5|@1|^#quot,5|@1|^#rem,}! 0 s324|& 0 s325|& 3 f0 (5|$#,5|$#,)! 3 f515 (5|$#,5|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 3 S!3{9|@1|^#quot,9|@1|^#rem,}! 0 s328|& 0 s329|& 3 f0 (9|$#,9|$#,)! 3 f522 (9|$#,9|$#,)! 3 f0 (5|$#,)! 3 f67 (5|$#,)! 3 f0 (359|$#,)! 3 f67 (359|$#,)! 1 t66|66 611 -1 3 f0 (529|@5|$#,5|$#,359|$#,)! 3 f19 (529|@5|$#,5|$#,359|$#,)! 3 f529 (529|@5|$#,5|$#,359|$#,)! 3 f0 (66|$#,359|$#,)! 3 f67 (66|$#,359|$#,)! 3 f0 (529|$#,359|$#,)! 3 f5 (529|$#,359|$#,)! 3 f0 (359|$#,5|$#,)! 3 f5 (359|$#,5|$#,)! 3 f0 (359|$#,529|$#,!.,)! 3 f5 (359|$#,529|$#,!.,)! 3 f0 (359|$#,529|$#,!.,)! 3 f5 (359|$#,529|$#,!.,)! 3 f0 (359|@7|$#,)! 3 f67 (359|@7|$#,)! 3 f0 ()! 3 f67 ()! 1 t68|68& 3 f0 (23|$#,64|$#,547|0@5@7&#,)! 3 f64 (23|$#,64|$#,547|0@5@7&#,)! 3 f0 (529|0@5@7&#,23|$#,64|$#,547|0@5@7&#,)! 3 f64 (529|0@5@7&#,23|$#,64|$#,547|0@5@7&#,)! 3 f0 (547|0@5@7&#,)! 3 f5 (547|0@5@7&#,)! 3 f0 (529|0@5@7&#,461|$#,64|$#,547|0@5@7&#,)! 3 f64 (529|0@5@7&#,461|$#,64|$#,547|0@5@7&#,)! 3 f0 (66|$#,359|@7|$#,)! 3 f67 (66|$#,359|@7|$#,)! 3 f0 (66|$#,)! 3 f67 (66|$#,)! 3 f0 (529|$#,64|$#,529|$#,!.,)! 3 f5 (529|$#,64|$#,529|$#,!.,)! 3 f0 (529|$#,529|$#,!.,)! 3 f5 (529|$#,529|$#,!.,)! 3 f0 (67|$#,359|$#,)! 3 f67 (67|$#,359|$#,)! 3 f0 (359|$#,529|$#,350|$#,)! 3 f5 (359|$#,529|$#,350|$#,)! 3 f0 (529|$#,64|$#,529|$#,350|$#,)! 3 f5 (529|$#,64|$#,529|$#,350|$#,)! 3 f0 (529|$#,350|$#,)! 3 f5 (529|$#,350|$#,)! 3 f0 (23|4@5@7&#,66|$#,547|0@5@7&#,)! 3 f64 (23|4@5@7&#,66|$#,547|0@5@7&#,)! 3 C0.1/529|! 3 f0 (529|@5|4@0@9&#,529|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,)! 3 f574 (529|@5|4@0@9&#,529|$#,)! 3 f0 (529|@5|$#,66|$#,)! 3 f19 (529|@5|$#,66|$#,)! 3 f529 (529|@5|$#,66|$#,)! 3 f0 (529|$#,529|$#,)! 3 f5 (529|$#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f5 (529|$#,529|$#,)! 3 f0 (529|@5|4@0@9&#,529|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,)! 3 f574 (529|@5|4@0@9&#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f64 (529|$#,529|$#,)! 0 s364|-1 591 -1 1 t590|590& 3 f0 (529|4@0@7&#,64|$#,529|$#,591|$#,)! 3 f64 (529|4@0@7&#,64|$#,529|$#,591|$#,)! 3 f0 (529|$#,)! 3 f64 (529|$#,)! 3 C0.1/529|! 3 f0 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f596 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f0 (529|$#,529|$#,64|$#,)! 3 f5 (529|$#,529|$#,64|$#,)! 3 f0 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f1 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f596 (529|@5|4@0@9&#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,)! 3 f19 (529|@5|$#,529|$#,)! 3 f529 (529|@5|$#,529|$#,)! 3 f0 (529|@5|$#,66|$#,)! 3 f19 (529|@5|$#,66|$#,)! 3 f529 (529|@5|$#,66|$#,)! 1 t529|529& 3 f0 (23|0@5@7&#,611|$#,64|$#,547|0@5@7&#,)! 3 f64 (23|0@5@7&#,611|$#,64|$#,547|0@5@7&#,)! 3 f0 (529|$#,529|$#,)! 3 f64 (529|$#,529|$#,)! 3 f0 (529|$#,529|$#,)! 3 f19 (529|$#,529|$#,)! 3 f529 (529|$#,529|$#,)! 3 f0 (529|$#,611|0@5@7&#,)! 3 f17 (529|$#,611|0@5@7&#,)! 3 f0 (529|0@5@7&#,529|$#,611|$#,)! 3 f19 (529|0@5@7&#,529|$#,611|$#,)! 3 f529 (529|0@5@7&#,529|$#,611|$#,)! 3 f0 (529|$#,611|0@5@7&#,5|$#,)! 3 f9 (529|$#,611|0@5@7&#,5|$#,)! 3 f0 (529|$#,611|0@5@7&#,5|$#,)! 3 f10 (529|$#,611|0@5@7&#,5|$#,)! 3 f0 (529|0@5@7&#,529|$#,64|$#,)! 3 f64 (529|0@5@7&#,529|$#,64|$#,)! 3 f0 (67|$#,)! 3 f5 (67|$#,)! 3 f0 (529|$#,66|$#,64|$#,)! 3 f19 (529|$#,66|$#,64|$#,)! 3 f529 (529|$#,66|$#,64|$#,)! 3 f0 (529|$#,529|$#,64|$#,)! 3 f5 (529|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,64|$#,)! 3 f19 (529|@5|$#,529|$#,64|$#,)! 3 f529 (529|@5|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,529|$#,64|$#,)! 3 f19 (529|@5|$#,529|$#,64|$#,)! 3 f529 (529|@5|$#,529|$#,64|$#,)! 3 f0 (529|@5|$#,66|$#,64|$#,)! 3 f19 (529|@5|$#,66|$#,64|$#,)! 3 f529 (529|@5|$#,66|$#,64|$#,)! 3 f0 (529|$#,!.,)! 3 f5 (529|$#,!.,)! 3 f0 (529|$#,!.,)! 3 f5 (529|$#,!.,)! 0 s388|& 0 s389|& 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,650|$#,)! 3 f2 (67|$#,650|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,)! 3 f2 (67|$#,)! 3 f0 (67|$#,651|$#,)! 3 f67 (67|$#,651|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f0 (67|$#,)! 3 f67 (67|$#,)! 3 f0 (23|$#,)! 3 f651 (23|$#,)! 3 f0 (23|$#,)! 3 f650 (23|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (529|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (529|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! 3 f0 (529|4@5@7&#,23|$#,64|$#,)! 3 f64 (529|4@5@7&#,23|$#,64|$#,)! 3 f0 (23|4@0@7&#,529|$#,64|$#,)! 3 f64 (23|4@0@7&#,529|$#,64|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f696 (20|@5|4@0@9&#,20|$#,64|$#,)! 3 f0 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 f696 (20|@5|4@0@7&#,20|$#,64|$#,)! 3 C0.1/23|! 3 f0 (23|@5|4@0@9&#,23|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,)! 3 f703 (23|@5|4@0@9&#,23|$#,)! 3 f0 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f703 (23|@5|4@0@9&#,23|$#,64|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,)! 3 f703 (23|@5|0@0@9&#,23|$#,)! 3 f0 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f1 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f703 (23|@5|0@0@9&#,23|$#,64|$#,)! 3 f0 (20|$#,20|$#,64|$#,)! 3 f5 (20|$#,20|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (23|4@5@7&#,23|$#,64|$#,)! 3 f64 (23|4@5@7&#,23|$#,64|$#,)! 3 f0 (20|$#,5|$#,64|$#,)! 3 f19 (20|$#,5|$#,64|$#,)! 3 f20 (20|$#,5|$#,64|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|$#,23|$#,)! 3 f64 (23|$#,23|$#,)! 3 f0 (23|@5|$#,23|$#,)! 3 f19 (23|@5|$#,23|$#,)! 3 f23 (23|@5|$#,23|$#,)! 3 f0 (23|@5|0@5@7&#,23|$#,)! 3 f19 (23|@5|0@5@7&#,23|$#,)! 3 f23 (23|@5|0@5@7&#,23|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f748 (20|@5|4@0@7&#,5|$#,64|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f64 (23|$#,)! 0 s435|& 0 s436|-1 766 -1 3 Stm{5|@1|^#tm_sec,5|@1|^#tm_min,5|@1|^#tm_hour,5|@1|^#tm_mday,5|@1|^#tm_mon,5|@1|^#tm_year,5|@1|^#tm_wday,5|@1|^#tm_yday,5|@1|^#tm_isdst,}! 3 f0 ()! 3 f757 ()! 3 f0 (758|$#,758|$#,)! 3 f17 (758|$#,758|$#,)! 3 f0 (591|$#,)! 3 f758 (591|$#,)! 1 t758|758& 3 f0 (766|4@5@7&#,)! 3 f758 (766|4@5@7&#,)! 3 f0 (591|$#,)! 3 f19 (591|$#,)! 3 f23 (591|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f23 (766|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f591 (766|$#,)! 3 f0 (766|$#,)! 3 f19 (766|$#,)! 3 f591 (766|$#,)! 3 f0 (23|4@0@7&#,64|$#,23|$#,591|$#,)! 3 f64 (23|4@0@7&#,64|$#,23|$#,591|$#,)! 0 s446|& 0 s447|& 0 s448|& 0 s449|& 0 s450|& 0 s451|& 0 s452|& 0 s453|& 0 s454|& 0 s455|& 0 s456|& 0 s457|& 0 s458|& 0 s459|& 0 s460|& 0 s461|& 0 s462|& 0 s463|& 0 s464|& 0 s465|& 0 s466|& 0 s467|& 0 s468|& 0 s469|& 0 s470|& 0 s471|& 0 s472|& 0 s473|& 0 s512|& 0 s513|-1 1420 1072 0 s514|& 0 s515|& 0 s516|& 0 s517|& 0 s518|& 0 s519|& 0 a520|-1 822 -1 3 Sdirent{42|@1|^#d_name,}! 0 s521|-1 830 -1 1 t819|819& 3 f0 (822|$#,)! 3 f5 (822|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f822 (23|$#,)! 3 f0 (822|$#,)! 3 f19 (822|$#,)! 1 t821|821 1877 -1 3 f830 (822|$#,)! 3 f0 (822|$#,)! 3 f1 (822|$#,)! 3 Sflock{7|@1|^#l_type,7|@1|^#l_whence,816|@1|^#l_start,816|@1|^#l_len,817|@1|^#l_pid,}! 0 s606|& 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 3 f0 (5|$#,5|$#,!.,)! 3 f5 (5|$#,5|$#,!.,)! 3 f0 (23|$#,5|$#,!.,)! 3 f5 (23|$#,5|$#,!.,)! 3 Sgroup{23|@1|0@0@3&#gr_name,812|@1|^#gr_gid,461|@1|0@0@3&#gr_mem,}! 0 s610|-1 846 -1 3 f0 (812|$#,)! 3 f19 (812|$#,)! 1 t843|843& 3 f846 (812|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f846 (23|$#,)! 3 Spasswd{23|@1|0@0@3&#pw_name,818|@1|^#pw_uid,812|@1|^#pw_gid,23|@1|0@0@3&#pw_dir,23|@1|0@0@3&#pw_shell,}! 0 s639|-1 855 -1 3 f0 (23|$#,)! 3 f19 (23|$#,)! 1 t852|852& 3 f855 (23|$#,)! 3 f0 (818|$#,)! 3 f19 (818|$#,)! 3 f855 (818|$#,)! 0 a642|& 3 f0 (860|$#,5|$#,)! 3 f1 (860|$#,5|$#,)! 3 f0 (860|4@0@7&#,5|$#,)! 3 f5 (860|4@0@7&#,5|$#,)! 0 a645|-1 912 -1 3 S!4{20|@1|0@0@3&#ss_sp,64|@1|^#ss_size,5|@1|^#ss_flags,}! 0 s646|& 0 s647|& 0 a648|& 0 s649|-1 871 -1 1 t870|870& 3 Ss_ucontext_t{871|@1|0@5@3&#uc_link,865|@1|0@0@3&#uc_sigmask,868|@1|^#uc_stack,869|@1|0@0@3&#uc_mcontext,}! 0 s650|-1 874 -1 1 t873|873& 3 f0 (874|$#,)! 3 f5 (874|$#,)! 3 f0 (874|$#,)! 3 f5 (874|$#,)! 3 ?! 3 f879 ()! 3 f1 ()^882 1 t881|881& 3 f0 (874|$#,882|$#,5|$#,!.,)! 3 f1 (874|$#,882|$#,5|$#,!.,)! 3 f0 (874|$#,874|$#,)! 3 f5 (874|$#,874|$#,)! 3 Ssigstack{5|@1|^#ss_onstack,20|@1|0@0@3&#ss_sp,}! 0 s672|& 0 s673|& 3 S!5{5|@1|^#si_signo,5|@1|^#si_errno,5|@1|^#si_code,817|@1|^#si_pid,818|@1|^#si_uid,20|@1|0@0@3&#si_addr,5|@1|^#si_status,9|@1|^#si_band,889|@1|0@0@3&#si_value,}! 0 s674|& 0 s675|-1 901 -1 3 U!6{5|@1|^#sival_int,20|@1|0@0@3&#sival_ptr,}! 0 s676|& 0 s677|& 3 ?! 3 f896 ()! 3 f1 ()^899 1 t898|898& 3 ?! 1 t892|892& 3 f900 (5|$#,901|$#,20|$#,)! 3 f1 (5|$#,901|$#,20|$#,)^904 1 t903|903& 3 Ssigaction{!899$$$@0#sa_handler,865|@1|0@0@3&#sa_mask,5|@1|^#sa_flags,!904$$$@0#sa_sigaction,}! 0 s678|-1 909 -1 3 f0 (817|$#,5|$#,)! 3 f5 (817|$#,5|$#,)! 1 t906|906& 3 f0 (5|$#,909|$#,909|4@5@7&#,)! 3 f5 (5|$#,909|$#,909|4@5@7&#,)! 1 t865|865& 3 f0 (912|$#,5|$#,)! 3 f5 (912|$#,5|$#,)! 3 f0 (912|$#,5|$#,)! 3 f5 (912|$#,5|$#,)! 3 f0 (912|4@0@7&#,)! 3 f5 (912|4@0@7&#,)! 3 f0 (912|4@0@7&#,)! 3 f5 (912|4@0@7&#,)! 3 f0 (912|$#,5|$#,)! 3 f5 (912|$#,5|$#,)! 3 f0 (912|4@0@7&#,)! 3 f5 (912|4@0@7&#,)! 3 f0 (5|$#,912|0@5@7&#,912|4@5@7&#,)! 3 f5 (5|$#,912|0@5@7&#,912|4@5@7&#,)! 3 f0 (912|$#,)! 3 f5 (912|$#,)! 3 f0 (5|$#,23|$#,)! 3 f19 (5|$#,23|$#,)! 3 f359 (5|$#,23|$#,)! 3 f0 (359|0@2@7&#,)! 3 f5 (359|0@2@7&#,)! 3 Sstat{814|@1|^#st_mode,813|@1|^#st_ino,811|@1|^#st_dev,815|@1|^#st_nlink,818|@1|^#st_uid,812|@1|^#st_gid,816|@1|^#st_size,758|@1|^#st_atime,758|@1|^#st_mtime,758|@1|^#st_ctime,}! 0 s693|-1 954 -1 3 C0.2/5|! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (814|@7|$#,)! 3 f2 (814|@7|$#,)! 3 f936 (814|@7|$#,)! 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 1 t935|935& 3 f0 (5|$#,954|4@0@7&#,)! 3 f5 (5|$#,954|4@0@7&#,)! 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 3 f0 (23|$#,814|$#,)! 3 f5 (23|$#,814|$#,)! 3 f0 (23|$#,954|4@0@7&#,)! 3 f5 (23|$#,954|4@0@7&#,)! 3 f0 (814|$#,)! 3 f5 (814|$#,)! 3 Stms{757|@1|^#tms_utime,757|@1|^#tms_stime,757|@1|^#tms_cutime,757|@1|^#tms_cstime,}! 0 s705|-1 967 -1 1 t966|966& 3 f0 (967|4@0@7&#,)! 3 f757 (967|4@0@7&#,)! 3 Sutsname{42|@1|^#sysname,42|@1|^#nodename,42|@1|^#release,42|@1|^#version,42|@1|^#machine,}! 0 s707|-1 972 -1 1 t971|971& 3 f0 (972|4@0@7&#,)! 3 f5 (972|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (24|4@5@7&#,)! 3 f817 (24|4@5@7&#,)! 3 f0 (817|$#,24|4@5@7&#,5|$#,)! 3 f817 (817|$#,24|4@5@7&#,5|$#,)! 3 C0.4/8|! 3 C0.3/8|! 0 s720|& 3 C0.9/9|! 3 C0.10/9|! 0 s721|& 0 s722|& 3 Stermios{997|@1|^#c_iflag,997|@1|^#c_oflag,997|@1|^#c_cflag,997|@1|^#c_lflag,993|@1|^#c_cc,}! 0 s791|-1 1000 -1 1 t999|999& 3 f0 (1000|$#,)! 3 f996 (1000|$#,)! 3 f0 (1000|$#,)! 3 f996 (1000|$#,)! 3 f0 (1000|$#,)! 3 f5 (1000|$#,)! 3 f0 (1000|$#,)! 3 f5 (1000|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,1000|4@0@7&#,)! 3 f5 (5|$#,1000|4@0@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,1000|$#,)! 3 f5 (5|$#,5|$#,1000|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,818|$#,812|$#,)! 3 f5 (23|$#,818|$#,812|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|4@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 2 y19|19& 2 y23|23& 3 f0 (23|$#,1052|$#,)! 3 f5 (23|$#,1052|$#,)! 3 f0 (23|$#,1052|$#,461|$#,)! 3 f5 (23|$#,1052|$#,461|$#,)! 3 f0 (23|$#,1052|$#,)! 3 f5 (23|$#,1052|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (5|$#,5|$#,)! 3 f9 (5|$#,5|$#,)! 3 f0 (23|@5|4@2@7&#,64|$#,)! 3 f19 (23|@5|4@2@7&#,64|$#,)! 3 f23 (23|@5|4@2@7&#,64|$#,)! 3 f0 ()! 3 f812 ()! 3 f0 ()! 3 f818 ()! 3 f0 ()! 3 f812 ()! 2 y812|812& 3 f0 (5|$#,1072|4@0@7&#,)! 3 f5 (5|$#,1072|4@0@7&#,)! 3 f0 ()! 3 f19 ()! 3 f23 ()! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f818 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (5|$#,816|$#,5|$#,)! 3 f816 (5|$#,816|$#,5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f9 (23|$#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (43|4@0@7&#,)! 3 f5 (43|4@0@7&#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (812|$#,)! 3 f5 (812|$#,)! 3 f0 (817|$#,817|$#,)! 3 f5 (817|$#,817|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (818|$#,)! 3 f5 (818|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (5|$#,)! 3 f9 (5|$#,)! 3 f0 (5|$#,)! 3 f817 (5|$#,)! 3 f0 (5|$#,817|$#,)! 3 f5 (5|$#,817|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (5|$#,20|$#,64|$#,)! 3 f65 (5|$#,20|$#,64|$#,)! 3 Sutimbuf{758|@1|^#actime,758|@1|^#modtime,}! 0 s883|-1 1127 -1 1 t1126|1126& 3 f0 (23|$#,1127|0@5@7&#,)! 3 f5 (23|$#,1127|0@5@7&#,)! 0 a885|-1 1135 -1 0 s886|& 3 S!7{1131|@1|^#rm_so,1131|@1|^#rm_eo,}! 0 s887|& 0 s888|-1 -1 1138 1 t1130|1130& 3 f0 (1135|4@0@7&#,23|$#,5|$#,)! 3 f5 (1135|4@0@7&#,23|$#,5|$#,)! 2 y1134|1134& 3 f0 (1135|$#,23|$#,64|$#,1138|4@0@7&#,5|$#,)! 3 f5 (1135|$#,23|$#,64|$#,1138|4@0@7&#,5|$#,)! 3 f0 (5|$#,1135|$#,23|4@0@7&#,64|$#,)! 3 f64 (5|$#,1135|$#,23|4@0@7&#,64|$#,)! 3 f0 (1135|0@0@2&#,)! 3 f1 (1135|0@0@2&#,)! 0 s925|& 0 s926|& 0 s927|& 0 s928|& 0 s929|& 0 s930|& 0 s931|& 0 s932|& 0 s933|& 0 s934|& 0 s935|& 0 s936|& 0 s937|& 0 s938|& 0 s939|& 0 s940|& 0 s941|& 0 s942|& 0 s943|& 0 s944|& 3 f0 (23|$#,23|4@0@7&#,5|$#,)! 3 f1 (23|$#,23|4@0@7&#,5|$#,)! 3 C0.5/2|! 3 f0 (23|$#,23|$#,5|$#,)! 3 f5 (23|$#,23|$#,5|$#,)! 3 f1167 (23|$#,23|$#,5|$#,)! 3 f0 (23|4@0@7&#,5|$#,)! 3 f1 (23|4@0@7&#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (359|$#,23|0@5@19@2@0#,5|$#,64|$#,)! 3 f5 (359|$#,23|0@5@19@2@0#,5|$#,64|$#,)! 3 f0 (359|$#,23|0@5@19@2@0#,5|$#,)! 3 f1 (359|$#,23|0@5@19@2@0#,5|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (5|$#,23|4@0@7&#,5|$#,)! 3 f5 (5|$#,23|4@0@7&#,5|$#,)! 3 f0 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f64 (20|4@0@7&#,64|$#,64|$#,359|$#,)! 3 f0 (20|$#,64|$#,64|$#,359|$#,)! 3 f64 (20|$#,64|$#,64|$#,359|$#,)! 3 C0.1/20|! 3 f0 (20|@5|4@0@7&#,20|0@0@9&#,5|$#,64|$#,)! 3 f1 (20|@5|4@0@7&#,20|0@0@9&#,5|$#,64|$#,)! 3 f1189 (20|@5|4@0@7&#,20|0@0@9&#,5|$#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,23|$#,5|$#,)! 3 f5 (23|$#,23|$#,5|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 (23|@5|$#,4|$#,)! 3 f19 (23|@5|$#,4|$#,)! 3 f23 (23|@5|$#,4|$#,)! 3 f0 ()! 3 f1 ()! 0 s1064|& 0 s1065|& 0 s1066|& 0 s1067|& 0 s1068|& 0 s1069|& 0 s1070|& 0 s1071|& 0 s1072|& 0 s1073|& 0 s1074|& 0 s1075|& 0 s1076|& 0 s1077|& 0 s1078|& 0 s1079|& 0 s1080|& 0 s1081|& 0 s1082|& 2 F0/12|0& 2 F4/12|4& 0 s1083|& 0 s1084|& 0 s1085|& 0 s1086|& 0 s1087|& 0 s1088|-1 1456 -1 0 s1089|& 0 s1090|& 0 s1091|& 0 s1092|& 0 s1093|& 0 s1094|& 0 s1095|& 0 s1096|& 0 s1097|& 0 s1098|& 0 s1099|& 0 s1100|& 0 s1101|& 0 a1102|-1 1388 -1 3 C0.5/9|! 3 f0 (5|$#,1249|$#,20|4@0@7&#,)! 3 f5 (5|$#,1249|$#,20|4@0@7&#,)! 3 f0 ()! 3 f817 ()! 3 Siovec{20|@1|0@0@18&#iov_base,64|@1|^#iov_len,}! 0 s1105|-1 1256 -1 1 t1255|1255& 3 f0 (5|$#,1256|$#,5|$#,)! 3 f65 (5|$#,1256|$#,5|$#,)! 3 f0 (5|$#,1256|$#,5|$#,)! 3 f65 (5|$#,1256|$#,5|$#,)! 3 Spoll{5|@1|^#fd,7|@1|^#events,7|@1|^#revents,}! 0 s1110|-1 -1 1263 2 y1262|1262& 3 f0 (1263|$#,10|$#,5|$#,)! 3 f5 (1263|$#,10|$#,5|$#,)! 3 f0 (20|4@2@2&#,)! 3 f1 (20|4@2@2&#,)! 0 s1191|& 0 s1192|& 0 s1193|-1 1299 -1 3 Ssockaddr{1268|@1|^#sa_family,42|@1|^#sa_data,}! 0 s1194|-1 1292 -1 3 Ssockaddr_storage{1268|@1|^#ss_family,}! 0 s1195|& 3 Smsghdr{20|@1|0@0@18&#msg_name,1270|@1|^#msg_namelen,1256|@1|0@0@18&#msg_iov,5|@1|^#msg_iovlen,20|@1|0@0@18&#msg_control,1270|@1|^#msg_controllen,5|@1|^#msg_flags,}! 0 s1196|-1 1283 -1 3 Scmsghdr{1270|@1|^#cmsg_len,5|@1|^#cmsg_level,5|@1|^#cmsg_type,}! 0 s1197|-1 1279 -1 1 t1278|1278& 3 f0 (1279|@7|$#,)! 3 f19 (1279|@7|$#,)! 3 f22 (1279|@7|$#,)! 1 t1276|1276& 3 f0 (1283|$#,1279|$#,)! 3 f19 (1283|$#,1279|$#,)! 3 f1279 (1283|$#,1279|$#,)! 3 f0 (1283|$#,)! 3 f19 (1283|$#,)! 3 f1279 (1283|$#,)! 3 Slinger{5|@1|^#l_onoff,5|@1|^#l_linger,}! 0 s1202|& 1 t1272|1272& 3 f0 (5|$#,1292|$#,24|$#,)! 3 f5 (5|$#,1292|$#,24|$#,)! 3 f0 (5|$#,1292|$#,5|$#,)! 3 f5 (5|$#,1292|$#,5|$#,)! 3 f0 (5|$#,1292|$#,5|$#,)! 3 f5 (5|$#,1292|$#,5|$#,)! 1 t1270|1270& 3 f0 (5|$#,1292|4@0@7&#,1299|$#,)! 3 f5 (5|$#,1292|4@0@7&#,1299|$#,)! 3 f0 (5|$#,1292|4@0@7&#,1299|$#,)! 3 f5 (5|$#,1292|4@0@7&#,1299|$#,)! 1 t64|64& 3 f0 (5|$#,5|$#,5|$#,20|4@0@7&#,1304|$#,)! 3 f5 (5|$#,5|$#,5|$#,20|4@0@7&#,1304|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,5|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,1292|0@5@7&#,24|$#,)! 3 f65 (5|$#,20|$#,64|$#,5|$#,1292|0@5@7&#,24|$#,)! 3 f0 (5|$#,1283|$#,5|$#,)! 3 f65 (5|$#,1283|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,)! 3 f65 (5|$#,20|$#,64|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,1292|$#,5|$#,)! 3 f65 (5|$#,20|$#,64|$#,5|$#,1292|$#,5|$#,)! 3 f0 (5|$#,1283|$#,5|$#,)! 3 f65 (5|$#,1283|$#,5|$#,)! 3 f0 (5|$#,5|$#,5|$#,20|$#,5|$#,)! 3 f5 (5|$#,5|$#,5|$#,20|$#,5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,5|$#,5|$#,)! 3 f5 (5|$#,5|$#,5|$#,)! 3 f0 (5|$#,5|$#,5|$#,24|4@0@7&#,)! 3 f5 (5|$#,5|$#,5|$#,24|4@0@7&#,)! 3 f0 (5|$#,23|$#,)! 3 f1 (5|$#,23|$#,)! 3 f0 (23|$#,23|$#,5|$#,)! 3 f5 (23|$#,23|$#,5|$#,)! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 0 s1284|-1 1342 -1 1 t1341|1341& 3 f0 (24|$#,5|$#,1342|4@5@7&#,)! 3 f817 (24|$#,5|$#,1342|4@5@7&#,)! 3 f0 (817|$#,24|$#,5|$#,1342|4@5@7&#,)! 3 f817 (817|$#,24|$#,5|$#,1342|4@5@7&#,)! 3 Stimeval{9|@1|^#tv_sec,9|@1|^#tv_usec,}! 0 s1287|-1 1357 -1 3 Stimespec{9|@1|^#ts_sec,9|@1|^#ts_nsec,}! 0 s1288|& 3 Stimezone{5|@1|^#tz_minuteswest,5|@1|^#tz_dsttime,}! 0 s1289|-1 1363 -1 3 Sitimerval{1348|@1|^#it_interval,1348|@1|^#it_value,}! 0 s1300|-1 1360 -1 3 Sclockinfo{5|@1|^#hz,5|@1|^#tick,5|@1|^#stathz,5|@1|^#profhz,}! 0 s1301|& 1 t1348|1348& 3 f0 (1357|$#,1357|4@5@7&#,)! 3 f5 (1357|$#,1357|4@5@7&#,)! 1 t1354|1354& 3 f0 (5|$#,1360|4@0@7&#,)! 3 f5 (5|$#,1360|4@0@7&#,)! 1 t1352|1352& 3 f0 (1357|4@5@7&#,1363|4@5@7&#,)! 3 f5 (1357|4@5@7&#,1363|4@5@7&#,)! 3 f0 (5|$#,1360|$#,1360|4@5@7&#,)! 3 f5 (5|$#,1360|$#,1360|4@5@7&#,)! 3 f0 (1357|$#,1363|$#,)! 3 f5 (1357|$#,1363|$#,)! 3 f0 (23|$#,1357|0@5@7&#,)! 3 f5 (23|$#,1357|0@5@7&#,)! 3 f0 (1219|@5|0@5@7&#,64|$#,5|$#,5|$#,5|$#,816|$#,)! 3 f1219 (1219|@5|0@5@7&#,64|$#,5|$#,5|$#,5|$#,816|$#,)! 3 f0 (1219|$#,5|$#,5|$#,)! 3 f5 (1219|$#,5|$#,5|$#,)! 3 f0 (1219|$#,5|$#,5|$#,)! 3 f5 (1219|$#,5|$#,5|$#,)! 3 f0 (1219|0@0@2&#,64|$#,)! 3 f5 (1219|0@0@2&#,64|$#,)! 3 f0 (1219|$#,5|$#,5|$#,)! 3 f5 (1219|$#,5|$#,5|$#,)! 3 f0 (1219|$#,64|$#,)! 3 f5 (1219|$#,64|$#,)! 3 f0 (1219|$#,64|$#,)! 3 f5 (1219|$#,64|$#,)! 3 Swinsize{8|@1|^#ws_row,8|@1|^#ws_col,8|@1|^#ws_xpixel,8|@1|^#ws_ypixel,}! 0 s1336|& 1 t1248|1248& 3 f0 (5|@7|$#,1388|@7|$#,)! 3 f1 (5|@7|$#,1388|@7|$#,)! 3 f0 (1388|@7|$#,1388|4@0@7&#,)! 3 f1 (1388|@7|$#,1388|4@0@7&#,)! 3 f0 (5|@7|$#,1388|@7|$#,)! 3 f5 (5|@7|$#,1388|@7|$#,)! 3 f1167 (5|@7|$#,1388|@7|$#,)! 3 f0 (5|@7|$#,1388|@7|$#,)! 3 f1 (5|@7|$#,1388|@7|$#,)! 3 f0 (1388|@7|4@0@7&#,)! 3 f1 (1388|@7|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,818|$#,812|$#,)! 3 f5 (5|$#,818|$#,812|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,816|$#,)! 3 f5 (5|$#,816|$#,)! 3 f0 (23|4@0@7&#,64|$#,)! 3 f5 (23|4@0@7&#,64|$#,)! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (23|$#,818|$#,812|$#,)! 3 f5 (23|$#,818|$#,812|$#,)! 3 f0 (5|$#,1388|0@5@7&#,1388|0@5@7&#,1388|0@5@7&#,1357|0@5@7&#,)! 3 f5 (5|$#,1388|0@5@7&#,1388|0@5@7&#,1388|0@5@7&#,1357|0@5@7&#,)! 3 f0 (812|$#,)! 3 f5 (812|$#,)! 3 f0 (818|$#,)! 3 f5 (818|$#,)! 1 t812|812& 3 f0 (5|$#,1420|$#,)! 3 f5 (5|$#,1420|$#,)! 3 f0 (812|$#,812|$#,)! 3 f5 (812|$#,812|$#,)! 3 f0 (812|$#,812|$#,)! 3 f5 (812|$#,812|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (23|$#,816|$#,)! 3 f5 (23|$#,816|$#,)! 3 Sipc_perm{818|@1|^#uid,812|@1|^#gid,818|@1|^#cuid,812|@1|^#cgid,814|@1|^#mode,1236|@1|^#seq,1151|@1|^#key,}! 0 s1457|& 0 s1468|-1 1436 -1 1 t1435|1435& 3 Smsqid_ds{1434|@1|^#msg_perm,1436|@1|0@0@3&#msg_first,1436|@1|0@0@3&#msg_last,1240|@1|^#msg_cbytes,1240|@1|^#msg_qnum,1240|@1|^#msg_qbytes,817|@1|^#msg_lspid,817|@1|^#msg_lrpid,758|@1|^#msg_stime,758|@1|^#msg_rtime,758|@1|^#msg_ctime,}! 0 s1469|-1 1441 -1 3 Smymesg{9|@1|^#mtype,42|@1|^#mtext,}! 0 s1470|& 1 t1438|1438& 3 f0 (5|$#,5|$#,1441|4@0@7&#,)! 3 f5 (5|$#,5|$#,1441|4@0@7&#,)! 3 f0 (1151|$#,5|$#,)! 3 f5 (1151|$#,5|$#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,9|$#,5|$#,)! 3 f5 (5|$#,20|4@0@7&#,64|$#,9|$#,5|$#,)! 3 f0 (5|$#,20|$#,64|$#,5|$#,)! 3 f5 (5|$#,20|$#,64|$#,5|$#,)! 0 s1480|-1 1451 -1 1 t1450|1450& 3 Ssemid_ds{1434|@1|^#sem_perm,1451|@1|0@0@3&#sem_base,1234|@1|^#sem_nsems,758|@1|^#sem_otime,758|@1|^#sem_ctime,}! 0 s1481|-1 1455 -1 3 Ssem{1234|@1|^#semval,817|@1|^#sempid,1234|@1|^#semncnt,1234|@1|^#semzcnt,}! 1 t1453|1453& 1 t1234|1234& 3 Usemun{5|@1|^#val,1455|@1|0@0@3&#buf,1456|@1|0@0@3&#array,}! 0 s1482|& 3 Ssembuf{1234|@1|^#sem_num,7|@1|^#sem_op,7|@1|^#sem_flg,}! 0 s1483|-1 1465 -1 3 f0 (5|$#,5|$#,5|$#,1458|$#,)! 3 f5 (5|$#,5|$#,5|$#,1458|$#,)! 3 f0 (1151|$#,5|$#,5|$#,)! 3 f5 (1151|$#,5|$#,5|$#,)! 1 t1460|1460& 3 f0 (5|$#,1465|$#,64|$#,)! 3 f5 (5|$#,1465|$#,64|$#,)! 3 Sshmid_ds{1434|@1|^#shm_perm,5|@1|^#shm_segsz,1234|@1|^#shm_lkcnt,817|@1|^#shm_lpid,817|@1|^#shm_cpid,1236|@1|^#shm_nattch,1236|@1|^#shm_cnattch,758|@1|^#shm_atime,758|@1|^#shm_dtime,758|@1|^#shm_ctime,}! 0 s1506|-1 1473 -1 3 f0 (5|$#,20|0@5@7&#,5|$#,)! 3 f19 (5|$#,20|0@5@7&#,5|$#,)! 3 f20 (5|$#,20|0@5@7&#,5|$#,)! 1 t1469|1469& 3 f0 (5|$#,5|$#,1473|4@0@7&#,)! 3 f5 (5|$#,5|$#,1473|4@0@7&#,)! 3 f0 (20|$#,)! 3 f5 (20|$#,)! 3 f0 (1151|$#,5|$#,5|$#,)! 3 f5 (1151|$#,5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (23|$#,5|$#,5|$#,)! 3 f1 (23|$#,5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,23|$#,!.,)! 3 f1 (5|$#,23|$#,!.,)! 3 f0 (5|$#,23|$#,350|$#,)! 3 f1 (5|$#,23|$#,350|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 ()! 3 f19 ()! 3 f855 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 ()! 3 f1 ()! 3 f0 ()! 3 f19 ()! 3 f846 ()! 3 f0 ()! 3 f5 ()! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 Sstat{811|@1|^#st_dev,813|@1|^#st_ino,814|@1|^#st_mode,815|@1|^#st_nlink,818|@1|^#st_uid,812|@1|^#st_gid,811|@1|^#st_rdev,816|@1|^#st_size,758|@1|^#st_atime,758|@1|^#st_mtime,758|@1|^#st_ctime,1146|@1|^#st_blksize,1145|@1|^#st_blocks,}! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1167 (0|@7|$#,)! 3 f936 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1167 (0|@7|$#,)! 3 f936 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1167 (0|@7|$#,)! 3 f936 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1167 (0|@7|$#,)! 3 f936 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1167 (0|@7|$#,)! 3 f936 (0|@7|$#,)! 3 f0 (0|@7|$#,)! 3 f5 (0|@7|$#,)! 3 f1167 (0|@7|$#,)! 3 f0 (954|@7|$#,)! 3 f5 (954|@7|$#,)! 3 f1167 (954|@7|$#,)! 3 f0 (954|@7|$#,)! 3 f5 (954|@7|$#,)! 3 f1167 (954|@7|$#,)! 3 f0 (954|@7|$#,)! 3 f5 (954|@7|$#,)! 3 f1167 (954|@7|$#,)! 3 f0 (23|$#,954|4@0@7&#,)! 3 f5 (23|$#,954|4@0@7&#,)! 3 f0 (23|$#,814|$#,811|$#,)! 3 f5 (23|$#,814|$#,811|$#,)! 3 f0 (23|$#,1240|$#,)! 3 f5 (23|$#,1240|$#,)! 3 f0 (5|$#,1240|$#,)! 3 f5 (5|$#,1240|$#,)! 3 f0 (5|$#,814|$#,)! 3 f5 (5|$#,814|$#,)! 3 Sstatvfs{10|@1|^#f_bsize,10|@1|^#f_frsize,1148|@1|^#f_blocks,1148|@1|^#f_bfree,1148|@1|^#f_bavail,1149|@1|^#f_files,1149|@1|^#f_ffree,1149|@1|^#f_favail,10|@1|^#f_fsid,10|@1|^#f_flag,10|@1|^#f_namemax,}! 0 s1584|-1 1559 -1 1 t1558|1558& 3 f0 (5|$#,1559|4@0@7&#,)! 3 f5 (5|$#,1559|4@0@7&#,)! 3 f0 (23|$#,1559|4@0@7&#,)! 3 f5 (23|$#,1559|4@0@7&#,)! 3 Sstrbuf{5|@1|^#maxlen,5|@1|^#len,23|@1|0@0@3&#buf,}! 0 s1604|-1 1571 -1 3 Sstr_mlist{42|@1|^#l_name,}! 0 s1605|-1 1568 -1 1 t1567|1567& 3 Sstr_list{5|@1|^#sl_nmods,1568|@1|0@0@3&#sl_modlist,}! 0 s1606|& 1 t1565|1565& 3 f0 (5|$#,1571|4@0@7&#,1571|4@0@7&#,24|$#,)! 3 f5 (5|$#,1571|4@0@7&#,1571|4@0@7&#,24|$#,)! 3 f0 (5|$#,1571|4@0@7&#,1571|4@0@7&#,24|$#,24|$#,)! 3 f5 (5|$#,1571|4@0@7&#,1571|4@0@7&#,24|$#,24|$#,)! 3 f0 (5|$#,1571|$#,1571|$#,24|$#,)! 3 f5 (5|$#,1571|$#,1571|$#,24|$#,)! 3 f0 (5|$#,1571|$#,1571|$#,5|$#,24|$#,)! 3 f5 (5|$#,1571|$#,1571|$#,5|$#,24|$#,)! 0 s1614|& 3 Srlimit{1580|@1|^#rlim_cur,1580|@1|^#rlim_max,}! 0 s1620|-1 1586 -1 3 Srusage{1348|@1|^#ru_utime,1348|@1|^#ru_stime,}! 3 f0 (5|$#,1150|$#,)! 3 f5 (5|$#,1150|$#,)! 1 t1582|1582& 3 f0 (5|$#,1586|4@0@7&#,)! 3 f5 (5|$#,1586|4@0@7&#,)! 3 f0 (5|$#,1342|4@0@7&#,)! 3 f5 (5|$#,1342|4@0@7&#,)! 3 f0 (5|$#,1150|$#,5|$#,)! 3 f5 (5|$#,1150|$#,5|$#,)! 3 f0 (5|$#,1586|$#,)! 3 f5 (5|$#,1586|$#,)! 3 Sservent{23|@1|0@0@18@3@0#s_name,461|@1|0@0@18@3@0#s_aliases,5|@1|^#s_port,23|@1|0@0@18@3@0#s_proto,}! 0 s1633|-1 1599 -1 3 f0 (23|$#,23|0@5@7&#,)! 3 f19 (23|$#,23|0@5@7&#,)! 1 t1596|1596& 3 f1599 (23|$#,23|0@5@7&#,)! 3 f0 (23|$#,23|0@5@7&#,1599|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f19 (23|$#,23|0@5@7&#,1599|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f1599 (23|$#,23|0@5@7&#,1599|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f0 (5|$#,23|0@5@7&#,)! 3 f19 (5|$#,23|0@5@7&#,)! 3 f1599 (5|$#,23|0@5@7&#,)! 3 f0 (5|$#,23|0@5@7&#,1599|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f19 (5|$#,23|0@5@7&#,1599|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f1599 (5|$#,23|0@5@7&#,1599|@5|4@0@7&#,23|4@0@7&#,5|$#,)! 3 f0 ()! 3 f19 ()! 3 f1599 ()! 3 f0 (1599|$#,23|$#,5|$#,)! 3 f19 (1599|$#,23|$#,5|$#,)! 3 f1599 (1599|$#,23|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f5 ()! 0 s1643|-1 1623 -1 3 f0 (23|0@2@7&#,)! 3 f19 (23|0@2@7&#,)! 1 t1620|1620& 3 f1623 (23|0@2@7&#,)! 3 f0 (23|$#,1623|@5|0@2@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f19 (23|$#,1623|@5|0@2@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f1623 (23|$#,1623|@5|0@2@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f0 (20|0@2@7&#,64|$#,5|$#,)! 3 f19 (20|0@2@7&#,64|$#,5|$#,)! 3 f1623 (20|0@2@7&#,64|$#,5|$#,)! 3 f0 (20|0@2@7&#,64|$#,5|$#,1623|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f19 (20|0@2@7&#,64|$#,5|$#,1623|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f1623 (20|0@2@7&#,64|$#,5|$#,1623|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,24|4@0@7&#,)! 3 f0 ()! 3 f19 ()! 3 f1623 ()! 3 f0 (1623|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,)! 3 f19 (1623|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,)! 3 f1623 (1623|@5|4@0@7&#,23|4@0@19@2@0#,5|$#,)! 3 f0 (359|$#,)! 3 f19 (359|$#,)! 3 f1623 (359|$#,)! 3 f0 (359|$#,1623|$#,4|$#,5|$#,)! 3 f19 (359|$#,1623|$#,4|$#,5|$#,)! 3 f1623 (359|$#,1623|$#,4|$#,5|$#,)! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 Shostent{23|@1|0@0@18@3@0#h_name,461|@1|0@0@18@3@0#h_aliases,5|@1|^#h_addrtype,5|@1|^#h_length,461|@1|0@0@18@3@0#h_addr_list,23|@1|0@0@18@3@0#h_addr,}! 3 f0 (23|$#,5|$#,)! 3 f5 (23|$#,5|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (20|$#,)! 3 f5 (20|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,818|$#,812|$#,)! 3 f5 (23|$#,818|$#,812|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,23|0@5@7&#,64|$#,)! 3 f64 (5|$#,23|0@5@7&#,64|$#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f23 (23|$#,23|$#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|@5|0@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,5|$#,)! 3 f5 (5|$#,5|$#,)! 3 f0 (42|$#,5|$#,)! 3 f1 (42|$#,5|$#,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,23|$#,!.,)! 3 f5 (23|$#,23|$#,!.,)! 3 f0 (23|$#,1052|$#,)! 3 f5 (23|$#,1052|$#,)! 3 f0 (23|$#,1052|$#,1052|$#,)! 3 f5 (23|$#,1052|$#,1052|$#,)! 3 f0 (23|$#,1052|$#,)! 3 f5 (23|$#,1052|$#,)! 3 f0 (5|$#,)! 3 f1 (5|$#,)! 3 f0 (5|$#,818|$#,812|$#,)! 3 f5 (5|$#,818|$#,812|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (5|$#,5|$#,)! 3 f9 (5|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,816|$#,)! 3 f5 (5|$#,816|$#,)! 3 f0 (23|@5|$#,64|$#,)! 3 f19 (23|@5|4@2@7&#,64|$#,)! 3 f23 (23|@5|4@2@7&#,64|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 ()! 3 f812 ()! 3 f0 ()! 3 f818 ()! 3 f0 ()! 3 f812 ()! 3 f0 (5|$#,1072|4@0@7&#,)! 3 f5 (5|$#,1072|4@0@7&#,)! 3 f0 ()! 3 f9 ()! 3 f0 ()! 3 f19 ()! 3 f23 ()! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (5|$#,1052|$#,23|$#,)! 3 f5 (5|$#,1052|$#,23|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (817|$#,)! 3 f817 (817|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f817 ()! 3 f0 ()! 3 f817 ()! 3 f0 (817|$#,)! 3 f817 (817|$#,)! 3 f0 ()! 3 f818 ()! 3 f0 (23|@5|$#,)! 3 f19 (23|@5|$#,)! 3 f23 (23|@5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,818|$#,812|$#,)! 3 f5 (23|$#,818|$#,812|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (5|$#,5|$#,816|$#,)! 3 f5 (5|$#,5|$#,816|$#,)! 3 f0 (5|$#,816|$#,5|$#,)! 3 f816 (5|$#,816|$#,5|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (23|$#,5|$#,)! 3 f9 (23|$#,5|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (43|4@0@7&#,)! 3 f5 (43|4@0@7&#,)! 3 f0 (5|$#,20|4@0@7&#,64|$#,816|$#,)! 3 f65 (5|$#,20|4@0@7&#,64|$#,816|$#,)! 3 ?! 3 f1775 ()! 3 f1 ()^1778 1 t1777|1777& 3 ?! 3 f1779 ()! 3 f1 ()^1782 1 t1781|1781& 3 ?! 3 f1783 ()! 3 f1 ()^1786 1 t1785|1785& 3 f0 (1778|$#,1782|$#,1786|$#,)! 3 f5 (1778|$#,1782|$#,1786|$#,)! 3 f0 (5|$#,20|$#,64|$#,816|$#,)! 3 f65 (5|$#,20|$#,64|$#,816|$#,)! 3 f0 (23|$#,23|$#,64|$#,)! 3 f5 (23|$#,23|$#,64|$#,)! 3 f0 (807|$#,)! 3 f19 (807|$#,)! 3 f20 (807|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (812|$#,812|$#,)! 3 f5 (812|$#,812|$#,)! 3 f0 (818|$#,818|$#,)! 3 f5 (818|$#,818|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (818|$#,)! 3 f5 (818|$#,)! 3 f0 (6|$#,)! 3 f6 (6|$#,)! 3 f0 (20|0@0@9&#,20|0@0@9&#,65|$#,)! 3 f1 (20|0@0@9&#,20|0@0@9&#,65|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f9 (5|$#,)! 3 f0 (5|$#,)! 3 f817 (5|$#,)! 3 f0 (5|$#,817|$#,)! 3 f5 (5|$#,817|$#,)! 3 f0 (23|$#,816|$#,)! 3 f5 (23|$#,816|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (5|$#,23|$#,64|$#,)! 3 f5 (5|$#,23|$#,64|$#,)! 3 f0 (1164|$#,1164|$#,)! 3 f1164 (1164|$#,1164|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (1164|$#,)! 3 f5 (1164|$#,)! 3 f0 ()! 3 f817 ()! 3 f0 (23|0@2@7&#,)! 3 f5 (23|0@2@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|$#,)! 3 f2 (5|$#,)! 3 f0 (5|@7|$#,)! 3 f4 (5|@7|$#,)! 3 f0 (5|@7|$#,)! 3 f4 (5|@7|$#,)! 3 f0 ()! 3 f17 ()! 2 F0/3|0& 2 F8/3|8& 3 f0 (1850|$#,)! 3 f17 (1850|$#,)! 3 f0 (9|$#,)! 3 f1 (9|$#,)! 0 s1792|& 0 s1793|& 3 Sin_addr{1856|@1|^#s_addr,}! 0 s1794|& 2 F0/8|0& 2 F3/8|3& 3 Ssockaddr_in{1268|@1|^#sin_family,1855|@1|^#sin_port,1858|@1|^#sin_addr,1860|@1|^#sin_zero,}! 0 s1795|& 3 f0 (1856|$#,)! 3 f1856 (1856|$#,)! 3 f0 (1855|$#,)! 3 f1855 (1855|$#,)! 3 f0 (1856|$#,)! 3 f1856 (1856|$#,)! 3 f0 (1855|$#,)! 3 f1855 (1855|$#,)! 3 Sdirent{813|@1|^#d_ino,42|@1|^#d_name,}! 3 f0 (822|$#,)! 3 f5 (822|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f822 (23|$#,)! 1 t830|830& 3 f0 (822|$#,830|$#,1877|4@0@7&#,)! 3 f5 (822|$#,830|$#,1877|4@0@7&#,)! 3 f0 (822|$#,)! 3 f1 (822|$#,)! 3 f0 (822|$#,9|$#,)! 3 f1 (822|$#,9|$#,)! 3 f0 (822|$#,)! 3 f9 (822|$#,)! 3 f0 (23|@5|4@0@7&#,23|$#,)! 3 f19 (23|@5|4@0@7&#,23|$#,)! 3 f23 (23|@5|4@0@7&#,23|$#,)! 3 f0 (23|@5|4@0@7&#,23|$#,64|$#,)! 3 f19 (23|@5|4@0@7&#,23|$#,64|$#,)! 3 f23 (23|@5|4@0@7&#,23|$#,64|$#,)! 3 f0 (1164|$#,)! 3 f5 (1164|$#,)! 3 f0 (1858|$#,)! 3 f19 (1858|$#,)! 3 f23 (1858|$#,)! 3 f0 (17|$#,17|$#,)! 3 f17 (17|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (5|$#,17|$#,)! 3 f17 (5|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (5|$#,17|$#,)! 3 f17 (5|$#,17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (17|$#,)! 3 f17 (17|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (23|@5|0@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|4@5@7&#,)! 3 f23 (23|4@5@7&#,)! 3 f0 (5|$#,23|$#,)! 3 f19 (5|$#,23|$#,)! 3 f359 (5|$#,23|$#,)! 3 f0 (359|0@2@7&#,)! 3 f5 (359|0@2@7&#,)! 3 f0 (359|0@2@7&#,)! 3 f1 (359|0@2@7&#,)! 3 f0 (359|$#,816|$#,5|$#,)! 3 f5 (359|$#,816|$#,5|$#,)! 3 f0 (359|$#,)! 3 f816 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (5|$#,461|$#,23|$#,)! 3 f5 (5|$#,461|$#,23|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (359|$#,)! 3 f5 (359|$#,)! 3 f0 (23|$#,23|$#,)! 3 f19 (23|$#,23|$#,)! 3 f359 (23|$#,23|$#,)! 3 f0 (5|$#,359|$#,)! 3 f5 (5|$#,359|$#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (5|$#,359|$#,)! 3 f5 (5|$#,359|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,23|$#,)! 3 f5 (23|$#,23|$#,)! 3 f0 (359|$#,)! 3 f1 (359|$#,)! 3 f0 (23|$#,23|0@5@7&#,)! 3 f19 (23|$#,23|0@5@7&#,)! 3 f23 (23|$#,23|0@5@7&#,)! 3 f0 ()! 3 f19 ()! 3 f359 ()! 3 f0 (23|@5|4@5@7&#,)! 3 f19 (23|@5|4@5@7&#,)! 3 f23 (23|@5|4@5@7&#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 3 f0 ()! 3 f1 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 ?! 3 f1986 ()! 3 f1 ()^1989 1 t1988|1988& 3 f0 (1989|$#,)! 3 f5 (1989|$#,)! 3 f0 (23|$#,)! 3 f17 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 (23|$#,)! 3 f9 (23|$#,)! 3 ?! 3 f1998 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^2001 1 t2000|2000& 3 f0 (20|$#,20|$#,64|$#,64|$#,2001|$#,)! 3 f19 (20|$#,20|$#,64|$#,64|$#,2001|$#,)! 3 f20 (20|$#,20|$#,64|$#,64|$#,2001|$#,)! 3 f0 (64|$#,64|$#,)! 3 f19 (64|$#,64|$#,)! 3 f20 (64|$#,64|$#,)! 3 S!8{5|@1|^#quot,5|@1|^#rem,}! 0 s1835|& 3 f0 (5|$#,5|$#,)! 3 f515 (5|$#,5|$#,)! 3 f0 ()! 3 f17 ()! 3 f0 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f19 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f23 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f19 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f23 (17|$#,5|$#,24|4@0@7&#,24|4@0@7&#,)! 3 f0 (17|$#,5|$#,23|$#,)! 3 f19 (17|$#,5|$#,23|$#,)! 3 f23 (17|$#,5|$#,23|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (461|$#,461|$#,461|4@0@7&#,)! 3 f5 (461|$#,461|$#,461|4@0@7&#,)! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (6|$#,23|$#,64|$#,)! 3 f19 (6|$#,23|$#,64|$#,)! 3 f23 (6|$#,23|$#,64|$#,)! 2 F0/3|0& 2 F8/3|8& 3 f0 (2034|$#,)! 3 f9 (2034|$#,)! 3 f0 (9|$#,)! 3 f19 (9|$#,)! 3 f23 (9|$#,)! 3 f0 (9|$#,)! 3 f9 (9|$#,)! 2 F0/7|0& 2 F8/7|8& 3 f0 (2043|$#,)! 3 f1 (2043|$#,)! 3 S!9{9|@1|^#quot,9|@1|^#rem,}! 0 s1845|& 3 f0 (9|$#,9|$#,)! 3 f522 (9|$#,9|$#,)! 3 f0 ()! 3 f9 ()! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (23|$#,64|$#,)! 3 f5 (23|$#,64|$#,)! 3 f0 (529|4@5@7&#,23|$#,64|$#,)! 3 f64 (529|4@5@7&#,23|$#,64|$#,)! 3 f0 (529|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f5 (529|4@5@7&#,23|0@5@7&#,64|$#,)! 3 f0 (23|$#,)! 3 f19 (23|$#,)! 3 f23 (23|$#,)! 3 f0 (23|$#,)! 3 f5 (23|$#,)! 3 f0 ()! 3 f9 ()! 2 F0/3|0& 2 F8/3|8& 3 f0 (2069|$#,)! 3 f9 (2069|$#,)! 3 f0 (5|$#,)! 3 f19 (5|$#,)! 3 f23 (5|$#,)! 3 f0 (23|0@0@5&#,)! 3 f5 (23|0@0@5&#,)! 3 ?! 3 f2077 (20|$#,20|$#,)! 3 f5 (20|$#,20|$#,)^2080 1 t2079|2079& 3 f0 (20|$#,64|$#,64|$#,2080|$#,)! 3 f1 (20|$#,64|$#,64|$#,2080|$#,)! 3 f0 ()! 3 f5 ()! 3 f0 (25|$#,)! 3 f5 (25|$#,)! 3 f0 ()! 3 f9 ()! 3 f0 (20|@5|4@5@2&#,64|$#,)! 3 f19 (20|@5|4@5@2&#,64|$#,)! 3 f20 (20|@5|4@5@2&#,64|$#,)! 3 f0 (23|$#,23|4@0@7&#,)! 3 f19 (23|$#,23|4@0@7&#,)! 3 f23 (23|$#,23|4@0@7&#,)! 2 F0/3|0& 2 F8/3|8& 3 f0 (2096|$#,)! 3 f19 (2096|$#,)! 3 f27 (2096|$#,)! 3 f0 (23|$#,)! 3 f1 (23|$#,)! 3 f0 (23|0@0@5&#,)! 3 f19 (23|0@0@5&#,)! 3 f23 (23|0@0@5&#,)! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (9|$#,)! 3 f1 (9|$#,)! 3 f0 (6|$#,)! 3 f1 (6|$#,)! 3 f0 (23|$#,461|4@5@7&#,)! 3 f17 (23|$#,461|4@5@7&#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f9 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 (23|$#,461|4@5@7&#,5|$#,)! 3 f10 (23|$#,461|4@5@7&#,5|$#,)! 3 f0 (23|0@5@7&#,)! 3 f5 (23|0@5@7&#,)! 3 f0 ()! 3 f5 ()! 3 f0 (5|$#,)! 3 f5 (5|$#,)! 3 f0 (64|$#,)! 3 f19 (64|$#,)! 3 f20 (64|$#,)! 3 f0 (23|4@0@7&#,529|$#,64|$#,)! 3 f64 (23|4@0@7&#,529|$#,64|$#,)! 3 f0 (23|4@5@7&#,66|$#,)! 3 f5 (23|4@5@7&#,66|$#,)! ;;tistable 0 34 34,224 224 34,224,239 239 34,224,239,243 243 34,224,239,243,244 244 520 520,642 642 520,642,645 645 520,642,645,648 648 520,642,645,648,885 885 1102 ;;symTable *0 (Datatype) ^0 2@a@-@0@0@0@0@2#_Bool *1 (Constant) ^1 2@i0@0@6#false ^2 2@i1@0@0#true *11 (GlobalMarker) *1 (Constant) ^4 5$#__LINE__ ^5 23$#__DATE__#__FILE__#__BASE_FILE__#__func__ ^9 5$#__INCLUDE_LEVEL__ ^10 23$#__VERSION__ *0 (Datatype) ^11 13@c@-@0@0@0@0@59#__SIZE_TYPE__ ^12 13@c@-@0@0@0@0@60#__PTRDIFF_TYPE__ ^13 13@c@-@0@0@0@0@61#__WCHAR_TYPE__ *1 (Constant) ^14 23$#__USER_LABEL_PREFIX__#__REGISTER_PREFIX__#__TIME__ ^17 5$#__STDC__#S_SPLINT_S#__LCLINT__#__i686 *3 (Variable) ^21 359|@1|6@0@0@0@2#stdin#stdout *1 (Constant) ^23 5$#EDOM#ERANGE#EILSEQ *3 (Variable) ^26 5|@1|6@0@0@0@4#errno *0 (Datatype) ^27 2@-@-@0@0@0@0@62#bool *1 (Constant) ^28 5@i1@0@0#__bool_true_false_are_defined *0 (Datatype) ^29 13@-@-@0@0@0@0@63#ptrdiff_t ^30 14@-@-@0@0@0@0@64#size_t ^31 15@-@-@0@0@0@0@65#ssize_t ^32 13@-@-@0@0@0@0@66#wchar_t ^33 13@-@-@0@0@0@0@67#wint_t ^34 0@a@=@0@0@0@0@68#mbstate_t *1 (Constant) ^35 0@i0@0@6#NULL ^36 2$#NDEBUG *4 (Function) ^37 72@6@0@8@0@0^$@0#assert ^38 74$^$@0#isalnum ^39 76$^$@0#isalpha ^40 78$^$@0#iscntrl ^41 80$^$@0#isdigit ^42 82$^$@0#isgraph ^43 84$^$@0#islower ^44 86$^$@0#isprint ^45 88$^$@0#ispunct ^46 90$^$@0#isspace ^47 92$^$@0#isupper ^48 94$^$@0#isxdigit ^49 96$^$@0#tolower ^50 98$^$@0#toupper *7 (Struct tag) ^51 99@100#@lconv *1 (Constant) ^52 5$#LC_ALL#LC_COLLATE#LC_CTYPE#LC_MONETARY#LC_NUMERIC#LC_TIME *4 (Function) ^58 103@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@19@3@0#setlocale ^59 107$^@3@0@0#localeconv *3 (Variable) ^60 5|@1|6@0@0@0@1#DBL_DIG ^61 17|@1|6@0@0@0@1#DBL_EPSILON ^62 5|@1|6@0@0@0@1#DBL_MANT_DIG ^63 17|@1|6@0@0@0@1#DBL_MAX ^64 5|@1|6@0@0@0@1#DBL_MAX_10_EXP#DBL_MAX_EXP ^66 17|@1|6@0@0@0@1#DBL_MIN ^67 5|@1|6@0@0@0@1#DBL_MIN_10_EXP#DBL_MIN_EXP#FLT_DIG ^70 16|@1|6@0@0@0@1#FLT_EPSILON ^71 5|@1|6@0@0@0@1#FLT_MANT_DIG ^72 16|@1|6@0@0@0@1#FLT_MAX ^73 5|@1|6@0@0@0@1#FLT_MAX_10_EXP#FLT_MAX_EXP ^75 16|@1|6@0@0@0@1#FLT_MIN ^76 5|@1|6@0@0@0@1#FLT_MIN_10_EXP#FLT_MIN_EXP *1 (Constant) ^78 5$#FLT_RADIX *3 (Variable) ^79 5|@1|6@0@0@0@1#FLT_ROUNDS#LDBL_DIG ^81 18|@1|6@0@0@0@1#LDBL_EPSILON ^82 5|@1|6@0@0@0@1#LDBL_MANT_DIG ^83 18|@1|6@0@0@0@1#LDBL_MAX ^84 5|@1|6@0@0@0@1#LDBL_MAX_10_EXP#LDBL_MAX_EXP ^86 18|@1|6@0@0@0@1#LDBL_MIN ^87 5|@1|6@0@0@0@1#LDBL_MIN_10_EXP#LDBL_MIN_EXP *1 (Constant) ^89 5$#CHAR_BIT ^90 4$#CHAR_MAX#CHAR_MIN ^92 5$#INT_MAX#INT_MIN ^94 9$#LONG_MAX#LONG_MIN#MB_LEN_MAX ^97 4$#SCHAR_MAX#SCHAR_MIN ^99 7$#SHRT_MAX#SHRT_MIN ^101 3$#UCHAR_MAX#UCHAR_MIN ^103 6$#UINT_MAX ^104 10$#ULONG_MAX ^105 8$#USHRT_MAX *0 (Datatype) ^106 16@-@-@0@0@0@0@108#float_t ^107 17@-@-@0@0@0@0@109#double_t *1 (Constant) ^108 17$#HUGE_VAL ^109 16$#HUGE_VALF ^110 18$#HUGE_VALL ^111 16$#INFINITY#NAN ^113 5$#FP_INFINITE#FP_NAN#FP_NORMAL#FP_SUBNORMAL#FP_ZERO#FP_ILOGB0#FP_ILOGBNAN#DECIMAL_DIG *0 (Datatype) ^121 111@-@-@0@0@0@0@112#s_real_t *4 (Function) ^122 114$^$@0#fpclassify ^123 116$^$@0#signbit ^124 118$^$@0#isfinite ^125 120$^$@0#isnormal ^126 122$^$@0#isnan ^127 124$^$@0#isinf ^128 126$@0@g26@6@0@1@g26$@0#acos ^129 128$@0@g26@6@0@1@g26$@0#asin ^130 130$^$@0#atan ^131 132$^$@0#atan2 ^132 134$^$@0#cos ^133 136$^$@0#sin ^134 138$^$@0#tan ^135 140$@0@g26@6@0@1@g26$@0#cosh ^136 142$@0@g26@6@0@1@g26$@0#sinh ^137 144$^$@0#tanh ^138 1912$@0@g26@6@0@1@g26$@0#acosh ^139 1914$@0@g26@6@0@1@g26$@0#asinh ^140 1916$@0@g26@6@0@1@g26$@0#atanh ^141 152$@0@g26@6@0@1@g26$@0#exp ^142 154$@0@@1@tp1$@0#frexp ^143 156$@0@g26@6@0@1@g26$@0#ldexp ^144 158$@0@g26@6@0@1@g26$@0#log ^145 160$@0@g26@6@0@1@g26$@0#log10 ^146 162$@0@@1@tp1$@0#modf ^147 164$@0@g26@6@0@1@g26$@0#exp2 ^148 166$@0@g26@6@0@1@g26$@0#expm1 ^149 168$@0@g26@6@0@1@g26$@0#log1p ^150 170$@0@g26@6@0@1@g26$@0#log2 ^151 172$@0@g26@6@0@1@g26$@0#logb ^152 174$@0@g26@6@0@1@g26$@0#scalbn ^153 176$@0@g26@6@0@1@g26$@0#scalbln ^154 178$@0@g26@6@0@1@g26$@0#scalblnl ^155 180$@0@g26@6@0@1@g26$@0#ilogb ^156 182$@0@g26@6@0@1@g26$@0#ilogbf ^157 184$@0@g26@6@0@1@g26$@0#ilogbl ^158 186$^$@0#fabs ^159 188$^$@0#fabsf ^160 190$^$@0#fabsl ^161 192$@0@g26@6@0@1@g26$@0#pow ^162 194$@0@g26@6@0@1@g26$@0#powf ^163 196$@0@g26@6@0@1@g26$@0#powl ^164 198$@0@g26@6@0@1@g26$@0#sqrt ^165 200$@0@g26@6@0@1@g26$@0#sqrtf ^166 202$@0@g26@6@0@1@g26$@0#sqrtl ^167 204$^$@0#cbrt ^168 206$^$@0#cbrtf ^169 208$^$@0#cbrtl ^170 1898$@0@g26@6@0@1@g26$@0#hypot ^171 212$@0@g26@6@0@1@g26$@0#hypotf ^172 214$@0@g26@6@0@1@g26$@0#hypotl ^173 1920$@1@@1@g26$@0#erf ^174 1922$@1@@1@g26$@0#erfc ^175 220$^$@0#erff ^176 222$^$@0#erfl ^177 224$^$@0#erfcf ^178 226$^$@0#erfcl ^179 228$@0@g26@6@0@1@g26$@0#gamma ^180 230$@0@g26@6@0@1@g26$@0#gammaf ^181 232$@0@g26@6@0@1@g26$@0#gammal ^182 1918$@0@g26@6@0@1@g26$@0#lgamma ^183 236$@0@g26@6@0@1@g26$@0#lgammaf ^184 238$@0@g26@6@0@1@g26$@0#lgammal ^185 240$^$@0#ceil ^186 242$^$@0#ceilf ^187 244$^$@0#ceill ^188 246$^$@0#floor ^189 248$^$@0#floorf ^190 250$^$@0#floorl ^191 252$^$@0#nearbyint ^192 254$^$@0#nearbyintf ^193 256$^$@0#nearbyintl ^194 258$^$@0#rint ^195 260$^$@0#rintf ^196 262$^$@0#rintl ^197 264$@0@g26@6@0@1@g26$@0#lrint ^198 266$@0@g26@6@0@1@g26$@0#lrintf ^199 268$@0@g26@6@0@1@g26$@0#lrintl ^200 270$@0@g26@6@0@1@g26$@0#llrint ^201 272$@0@g26@6@0@1@g26$@0#llrintf ^202 274$@0@g26@6@0@1@g26$@0#llrintl ^203 276$^$@0#round ^204 278$@0@g26@6@0@1@g26$@0#lround ^205 280$@0@g26@6@0@1@g26$@0#llround ^206 282$^$@0#trunc ^207 284$^$@0#fmod ^208 286$^$@0#remainder ^209 288$@0@@1@tp2$@0#remquo ^210 290$^$@0#copysign ^211 292$^$@0#nan ^212 294$^$@0#nextafter ^213 296$^$@0#nextafterx ^214 298$@0@g26@6@0@1@g26$@0#fdim ^215 300$^$@0#fmax ^216 302$^$@0#fmin ^217 304$^$@0#fma ^218 306$^$@0#isgreater ^219 308$^$@0#isgreaterequal ^220 310$^$@0#isless ^221 312$^$@0#islessequal ^222 314$^$@0#islessgreater ^223 316$^$@0#isunordered *0 (Datatype) ^224 20@a@+@0@0@0@0@317#jmp_buf *4 (Function) ^225 319$@0@@1@p0$@0#setjmp ^226 321@6@0@5@0@0^$@0#longjmp *1 (Constant) ^227 5$#SIGABRT#SIGFPE#SIGILL#SIGINT#SIGSEGV#SIGTERM *0 (Datatype) ^233 13@-@-@0@0@0@0@322#sig_atomic_t *1 (Constant) ^234 326$#SIG_DFL ^235 330$#SIG_ERR ^236 334$#SIG_IGN *4 (Function) ^237 347@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26$@0#signal ^238 349@6@0@5@0@0$$@0#raise *0 (Datatype) ^239 20@a@+@0@0@0@0@350#va_list *4 (Function) ^240 352$@0@@1@p0$@0#va_start ^241 354$@0@@1@p0$@0#va_end ^242 356$$$@0#va_copy *0 (Datatype) ^243 20@a@+@0@0@0@0@357#FILE ^244 20@a@+@0@0@0@0@358#fpos_t *1 (Constant) ^245 64$#_IOFBF#_IOLBF#_IONBF#BUFSIZ ^249 5$#EOF#FOPEN_MAX#FILENAME_MAX#L_tmpnam#SEEK_CUR#SEEK_END#SEEK_SET#TMP_MAX *3 (Variable) ^257 359|@1|6@0@0@0@2#stderr *4 (Function) ^258 1966$@0@s3,g26@6@0@1@s3,g26$@0#remove ^259 1968$@0@s3,g26@6@0@1@s3,g26$@0#rename ^260 1976@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#tmpfile ^261 1979$@0@s1@1@tp0,s1@19@3@0#tmpnam ^262 371$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fclose ^263 373$@0@g26@6@0,s3@1@tp0,g26,s3$@0#fflush ^264 376@6@5@1@0@0@0@s3@1@s3@18@0@0#fopen ^265 379@6@5@1@0@0@0@s3,g26@6@0@1@tp2,s3,g26@18@0@0#freopen ^266 381$@0@s3@1@s3,tp0,tp1$@0#setbuf ^267 383$@0@s3@1@s3,tp0,tp1$@0#setvbuf ^268 385@6@0@1@1@0@0@s3@1@s3,tp0$@0#fprintf ^269 387@6@0@1@2@0@0@s3,g26@6@0@1@s3,tp0,g26$@0#fscanf ^270 389@6@0@1@1@0@1@g22@6@0,s3@1@s3,tg22$@0#printf ^271 391@6@0@1@2@0@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#scanf ^272 393@6@0@1@1@0@0@@1@tp0$@0@W:bufferoverflowhigh#Buffer overflow possible with sprintf. Recommend using snprintf instead##sprintf ^273 395@6@0@1@1@0@0@@1@p0$@0#snprintf ^274 397@6@0@1@2@0@0@g26@6@0@1@g26$@0#sscanf ^275 399$@1@g22@6@0,s3@1@s3,tg22$@0#vprintf ^276 401$@0@s3,g26@6@0@1@s3,tp0,p2,g26$@0#vfprintf ^277 403$@0@@1@p0$@0@W:bufferoverflowhigh#Use vsnprintf instead##vsprintf ^278 405$@0@@1@p0$@0#vsnprintf ^279 407$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fgetc ^280 410@6@5@1@0@0@0@s3,g26@6@0@1@s3,tp0,tp2,g26$@0#fgets ^281 413$@0@s3,g26@6@0@1@s3,tp1,g26$@0#fputc ^282 415$@0@s3@1@s3,tp1$@0#fputs ^283 417$@0@s3,g26@6@0@1@s3,tp0,g26$@0#getc ^284 419$@1@g21@6@0,s3,g26@6@0@1@s3,tg21,g26$@0#getchar ^285 422@6@5@1@0@0@1@g21@6@0,s3,g26@6@0@1@s3,tp0,tg21,g26@3@0@0@W:bufferoverflowhigh#Use of gets leads to a buffer overflow vulnerability. Use fgets instead##gets ^286 424$@0@s3,g26@6@0@1@s3,tp1,g26$@0#putc ^287 426$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#putchar ^288 428$@1@g22@6@0,s3,g26@6@0@1@s3,tg22,g26$@0#puts ^289 430$@0@s3@1@s3,tp1$@0#ungetc ^290 432$@0@s3,g26@6@0@1@s3,tp0,tp3,g26$@0#fread ^291 434$@0@s3,g26@6@0@1@s3,tp3,g26$@0#fwrite ^292 437$@0@g26@6@0@1@tp1,g26$@0#fgetpos ^293 439$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fseek ^294 441$@0@s3,g26@6@0@1@s3,tp0,g26$@0#fsetpos ^295 443$@0@g26@6@0@1@g26$@0#ftell ^296 1970$@0@@1@tp0,g26$@0#rewind ^297 1924$@0@@1@tp0$@0#clearerr ^298 449$@0@g26@6@0@1@g26$@0#feof ^299 451$@0@g26@6@0@1@g26$@0#ferror ^300 453$@1@g26@6@0,g257@6@0,s3@1@s3,tg257$@0#perror ^301 1993$^$@0#atof ^302 1995$^$@0#atoi ^303 1997$^$@0#atol ^304 2112$@0@g26@6@0@1@tp1,g26$@0#strtod ^305 2114$@0@g26@6@0@1@tp1,g26$@0#strtol ^306 2116$@0@g26@6@0@1@tp1,g26$@0#strtoul *1 (Constant) ^307 5$#RAND_MAX *4 (Function) ^308 2084$@0@s1@1@s1$@0#rand ^309 2106$@0@s1@1@s1$@0#srand ^310 2007@6@5@1@0@0^@2@0@0#calloc ^311 2054@4@5@1@0@0@1@@1@g26@2@0@0#malloc ^312 2091@6@5@1@0@0@0@@1@tp0,g26@2@0@0#realloc ^313 1267$@0@@1@p0,tp0$@0#free *1 (Constant) ^314 5$#EXIT_FAILURE#EXIT_SUCCESS *4 (Function) ^316 1983@6@0@6@0@0^$@0#abort ^317 486@6@0@6@0@0^$@0#exit ^318 1991$@0@s1@1@s1$@0#atexit ^319 2025@6@5@1@0@0^@19@3@0#getenv ^320 2118$@0@s3@1@s3,g26$@0#system ^321 2004@6@5@1@0@0^@18@0@0#bsearch ^322 2082$@0@g26@6@0@1@tp0,g26$@0#qsort ^323 1985$^$@0#abs *7 (Struct tag) ^324 513@514#@!2 *0 (Datatype) ^325 513@c@-@0@0@0@0@515#div_t *4 (Function) ^326 2011$^$@0#div ^327 2041$^$@0#labs *7 (Struct tag) ^328 520@521#@!3 *0 (Datatype) ^329 520@c@-@0@0@0@0@522#ldiv_t *4 (Function) ^330 2049$^$@0#ldiv *1 (Constant) ^331 64$#MB_CUR_MAX ^332 5$#WCHAR_MAX#WCHAR_MIN ^334 67$#WEOF *4 (Function) ^335 526$^$@0#btowc ^336 528$@0@s3@1@s3,tp0$@0#fgetwc ^337 532@6@5@1@0@0@0@s3@1@s3,tp0,tp2$@0#fgetws ^338 534$@0@s3@1@s3,tp1$@0#fputwc ^339 536$@0@s3@1@s3,tp1$@0#fputws ^340 538$^$@0#fwide ^341 540@6@0@1@1@0@0@s3@1@tp0,s3$@0#fwprintf ^342 542@6@0@1@2@0@0@s3@1@tp0,s3$@0#fwscanf ^343 544$@0@s3@1@s3,tp0$@0#getwc ^344 546$@0@s3,g21@6@0@1@s3,tg21$@0#getwchar ^345 549$^$@0#mbrlen ^346 551$@0@@1@tp0$@0#mbrtowc ^347 553$^$@0#mbsinit ^348 555$@0@@1@tp0$@0#mbsrtowcs ^349 557$@0@s3@1@s3,tp1$@0#putwc ^350 559$@0@s3,g22@6@0@1@s3,tg22$@0#putwchar ^351 561@6@0@1@1@0@0@@1@tp0$@0#swprintf ^352 563@6@0@1@2@0@0@g21@6@0@1@tg21$@0#swscanf ^353 565$@0@s3@1@s3,tp1$@0#ungetwc ^354 567$@0@s3@1@s3,tp0$@0#vfwprintf ^355 569$@0@@1@tp0$@0#vswprintf ^356 571$@0@s3,g22@6@0@1@s3,tg22$@0#vwprintf ^357 573$@0@@1@tp0$@0#wcrtomb ^358 577$@0@@1@tp0$@0#wcscat ^359 580@6@5@1@0@0^@19@2@0#wcschr ^360 582$^$@0#wcscmp ^361 584$^$@0#wcscoll ^362 587$@0@@1@tp0$@0#wcscpy ^363 589$^$@0#wcscspn *7 (Struct tag) ^364 759@590#@tm *4 (Function) ^365 593$@0@@1@tp0$@0#wcsftime ^366 595$^$@0#wcslen ^367 599$@0@@1@tp0$@0#wcsncat ^368 601$^$@0#wcsncmp ^369 604$@0@@1@tp0$@0#wcsncpy ^370 607@6@5@1@0@0^$@0#wcspbrk ^371 610@6@5@1@0@0^$@0#wcsrchr ^372 613$@0@@1@tp1$@0#wcsrtombs ^373 615$^$@0#wcsspn ^374 618@6@5@1@0@0^@3@0@0#wcsstr ^375 620$@0@@1@tp1$@0#wcstod ^376 623@6@5@1@0@0@0@@1@tp2@3@0@0#wcstok ^377 625$@0@@1@tp1$@0#wcstol ^378 627$@0@@1@tp1$@0#wcstoul ^379 629$@0@@1@tp0$@0#wcsxfrm ^380 631$^$@0#wctob ^381 634@6@5@1@0@0^@3@0@0#wmemchr ^382 636$^$@0#wmemcmp ^383 639$@0@@1@tp0$@0#wmemcpy ^384 642$@0@@1@tp0$@0#wmemmove ^385 645$@0@@1@tp0$@0#wmemset ^386 647@6@0@1@1@0@1@g22@6@0,g26@6@0@1@g26,tg22$@0#wprintf ^387 649@6@0@1@2@0@1@g21@6@0,g26@6@0@1@g26,tg21$@0#wscanf *0 (Datatype) ^388 13@-@-@0@0@0@0@650#wctype_t ^389 13@-@-@0@0@0@0@651#wctrans_t *4 (Function) ^390 653$^$@0#iswalnum ^391 655$^$@0#iswalpha ^392 657$^$@0#iswcntrl ^393 659$^$@0#iswctype ^394 661$^$@0#iswdigit ^395 663$^$@0#iswgraph ^396 665$^$@0#iswlower ^397 667$^$@0#iswprint ^398 669$^$@0#iswpunct ^399 671$^$@0#iswspace ^400 673$^$@0#iswupper ^401 675$^$@0#iswxdigit ^402 677$^$@0#towctrans ^403 679$^$@0#towlower ^404 681$^$@0#towupper ^405 683$^$@0#wctrans ^406 685$^$@0#wctype ^407 2056$@1@@1@g26$@0#mblen ^408 2060$@0@@1@tp0,g26$@0#mbtowc ^409 2129$@0@@1@tp0$@0#wctomb ^410 2058$@0@@1@tp0$@0#mbstowcs ^411 2127$@0@@1@tp0,g26$@0#wcstombs ^412 699$@0@@1@tp0$@0#memcpy ^413 702$@0@@1@tp0$@0#memmove ^414 706$@0@@1@tp0$@0#strcpy ^415 709$@0@@1@tp0$@0#strncpy ^416 712$@0@@1@tp0$@0#strcat ^417 715$@0@@1@tp0$@0#strncat ^418 717$^$@0#memcmp ^419 719$^$@0#strcmp ^420 721$^$@0#strcoll ^421 723$^$@0#strncmp ^422 725$@0@@1@tp0$@0#strxfrm ^423 728@6@5@1@0@0^@3@0@0#memchr ^424 731@6@5@1@0@0^@19@2@0#strchr ^425 733$^$@0#strcspn ^426 736@6@5@1@0@0^@19@2@0#strpbrk ^427 739@6@5@1@0@0^@19@2@0#strrchr ^428 741$^$@0#strspn ^429 744@6@5@1@0@0^@19@2@0#strstr ^430 747@6@5@1@0@0@0@s1,g26@6@0@1@tp0,s1,g26@19@2@0#strtok ^431 751$@0@@1@tp0$@0#memset ^432 754$^@19@3@0#strerror ^433 756$^$@0#strlen *1 (Constant) ^434 5$#CLOCKS_PER_SEC *0 (Datatype) ^435 13@-@-@0@0@0@0@757#clock_t ^436 13@-@-@0@0@0@0@758#time_t *4 (Function) ^437 761$@0@s1@1@s1$@0#clock ^438 763$^$@0#difftime ^439 765$^$@0#mktime ^440 768$@0@@1@tp0$@0#time ^441 771$@0@g26@6@0@1@g26@19@3@0#asctime ^442 774$^@19@3@0#ctime ^443 777$^@19@3@0#gmtime ^444 780$@0@g26@6@0@1@g26@19@3@0#localtime ^445 782$@0@@1@tp0$@0#strftime *0 (Datatype) ^446 13@-@-@0@0@0@0@783#int8_t ^447 13@-@-@0@0@0@0@784#int16_t ^448 13@-@-@0@0@0@0@785#int32_t ^449 13@-@-@0@0@0@0@786#int64_t ^450 14@-@-@0@0@0@0@787#uint8_t ^451 14@-@-@0@0@0@0@788#uint16_t ^452 14@-@-@0@0@0@0@789#uint32_t ^453 14@-@-@0@0@0@0@790#uint64_t ^454 13@-@-@0@0@0@0@791#int_least8_t ^455 13@-@-@0@0@0@0@792#int_least16_t ^456 13@-@-@0@0@0@0@793#int_least32_t ^457 13@-@-@0@0@0@0@794#int_least64_t ^458 14@-@-@0@0@0@0@795#uint_least8_t ^459 14@-@-@0@0@0@0@796#uint_least16_t ^460 14@-@-@0@0@0@0@797#uint_least32_t ^461 14@-@-@0@0@0@0@798#uint_least64_t ^462 13@-@-@0@0@0@0@799#int_fast8_t ^463 13@-@-@0@0@0@0@800#int_fast16_t ^464 13@-@-@0@0@0@0@801#int_fast32_t ^465 13@-@-@0@0@0@0@802#int_fast64_t ^466 14@-@-@0@0@0@0@803#uint_fast8_t ^467 14@-@-@0@0@0@0@804#uint_fast16_t ^468 14@-@-@0@0@0@0@805#uint_fast32_t ^469 14@-@-@0@0@0@0@806#uint_fast64_t ^470 15@-@-@0@0@0@0@807#intptr_t ^471 14@-@-@0@0@0@0@808#uintptr_t ^472 15@-@-@0@0@0@0@809#intmax_t ^473 14@-@-@0@0@0@0@810#uintmax_t *1 (Constant) ^474 5$#INT8_MIN#INT16_MIN#INT32_MIN#INT64_MIN#INT8_MAX#INT16_MAX#INT32_MAX#INT64_MAX#UINT8_MIN#UINT16_MIN#UINT32_MIN#UINT64_MIN#INT_LEAST8_MIN#INT_LEAST16_MIN#INT_LEAST32_MIN#INT_LEAST64_MIN#INT_LEAST8_MAX#INT_LEAST16_MAX#INT_LEAST32_MAX#INT_LEAST64_MAX#UINT_LEAST8_MAX#UINT_LEAST16_MAX#UINT_LEAST32_MAX#UINT_LEAST64_MAX#INT_FAST8_MIN#INT_FAST16_MIN#INT_FAST32_MIN#INT_FAST64_MIN#INT_FAST8_MAX#INT_FAST16_MAX#INT_FAST32_MAX#INT_FAST64_MAX#UINT_FAST8_MAX#UINT_FAST16_MAX#UINT_FAST32_MAX#UINT_FAST64_MAX ^510 64$#INTPTR_MIN#INTPTR_MAX *0 (Datatype) ^512 13@-@-@0@0@0@0@811#dev_t ^513 13@-@-@0@0@0@0@812#gid_t ^514 14@-@-@0@0@0@0@813#ino_t ^515 13@-@-@0@0@0@0@814#mode_t ^516 13@-@-@0@0@0@0@815#nlink_t ^517 13@-@-@0@0@0@0@816#off_t ^518 13@-@-@0@0@0@0@817#pid_t ^519 13@-@-@0@0@0@0@818#uid_t ^520 20@a@+@0@0@0@0@819#DIR *7 (Struct tag) ^521 1871@821#@dirent *4 (Function) ^522 1873$@0@g26@6@0@1@g26$@0#closedir ^523 1876@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#opendir ^524 831@6@5@1@0@0@0@g26@6@0@1@g26@18@0@0#readdir ^525 1881$^$@0#rewinddir *1 (Constant) ^526 5$#E2BIG#EACCES#EAGAIN#EBADF#EBUSY#ECHILD#EDEADLK#EEXIST#EFAULT#EFBIG#EINTR#EINVAL#EIO#EISDIR#EMFILE#EMLINK#ENAMETOOLONG#ENFILE#ENODEV#ENOENT#ENOEXEC#ENOLCK#ENOMEM#ENOSPC#ENOSYS#ENOTDIR#ENOTEMPTY#ENOTTY#ENXIO#EPERM#EPIPE#EROFS#ESPIPE#ESRCH#EXDEV#FD_CLOEXEC#F_DUPFD#F_GETFD#F_GETFL#F_GETLK#F_RDLCK#F_SETFD#F_SETFL#F_SETLK#F_SETLKW#F_UNLCK#F_WRLCK#O_ACCMODE#O_APPEND#O_CREAT#O_EXCL#O_NOCTTY#O_NONBLOCK#O_RDONLY#O_RDWR#O_TRUNC#O_WRONLY ^583 814$#S_IFMT#S_IFBLK#S_IFCHR#S_IFIFO#S_IFREG#S_IFDIR#S_IFLNK#S_IRWXU#S_IRUSR#S_IRGRP#S_IROTH#S_IUSR#S_IWXG#S_IWXO#S_IWXU#S_ISGID#S_ISUID#S_IWGRP#S_IWOTH#S_IWUSR#S_IXGRP#S_IXOTH#S_IXUSR *7 (Struct tag) ^606 834@835#@flock *4 (Function) ^607 837$@0@g26@6@0@1@g26$@0#creat ^608 839$@0@g26@6@0@1@g26$@0#fcntl ^609 841$@0@g26@6@0@1@g26$@0#open *7 (Struct tag) ^610 842@843#@group *4 (Function) ^611 847@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrgid ^612 850@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getgrnam *1 (Constant) ^613 9$#ARG_MAX#CHILD_MAX#LINK_MAX#MAX_CANON ^617 64$#MAX_INPUT#NAME_MAX ^619 9$#NGROUPS_MAX#OPEN_MAX ^621 64$#PATH_MAX#PIPE_BUF ^623 9$#SSIZE_MAX#STREAM_MAX#TZNAME_MAX#_POSIX_ARG_MAX#_POSIX_CHILD_MAX#_POSIX_LINK_MAX#_POSIX_MAX_CANON#_POSIX_MAX_INPUT#_POSIX_NAME_MAX#_POSIX_NGROUPS_MAX#_POSIX_OPEN_MAX#_POSIX_PATH_MAX#_POSIX_PIPE_BUF#_POSIX_SSIZE#_POSIX_STREAM#_POSIX_TZNAME_MAX *7 (Struct tag) ^639 851@852#@passwd *4 (Function) ^640 856@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwnam ^641 859@6@5@1@0@0@0@g26@6@0@1@g26@19@3@0#getpwuid *0 (Datatype) ^642 20@a@+@0@0@0@0@860#sigjmp_buf *4 (Function) ^643 862@6@0@5@0@0^$@0#siglongjmp ^644 864$@0@@1@p0$@0#sigsetjmp *0 (Datatype) ^645 0@a@=@0@0@0@0@865#sigset_t *7 (Struct tag) ^646 866@867#@!4 *0 (Datatype) ^647 866@-@-@0@0@0@0@868#stack_t ^648 0@a@=@0@0@0@0@869#mcontext_t *7 (Struct tag) ^649 872@870#@s_ucontext_t *0 (Datatype) ^650 870@-@+@0@0@0@0@873#ucontext_t *4 (Function) ^651 876$$$@0#getcontext ^652 878$$$@0#setcontext ^653 884$$$@0#makecontext ^654 886$$$@0#swapcontext *1 (Constant) ^655 5$#SA_NOCLDSTOP#SIG_BLOCK#SIG_SETMASK#SIG_UNBLOCK#SIGALRM#SIGCHLD#SIGCONT#SIGHUP#SIGKILL#SIGPIPE#SIGQUIT#SIGSTOP#SIGTSTP#SIGTTIN#SIGTTOU#SIGUSR1#SIGUSR2 *7 (Struct tag) ^672 887@888#@sigstack *8 (Union tag) ^673 0@889#$sigval *7 (Struct tag) ^674 890@891#@!5 *0 (Datatype) ^675 890@-@-@0@0@0@0@892#siginfo_t *8 (Union tag) ^676 893@894#$!6 *0 (Datatype) ^677 893@-@-@0@0@0@0@895#sigval *7 (Struct tag) ^678 905@906#@sigaction *4 (Function) ^679 908@6@0@5@0@0@0@g26@6@0@1@g26$@0#kill ^680 911$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigaction ^681 914$@0@g26@6@0@1@tp0,g26$@0#sigaddset ^682 916$@0@g26@6@0@1@tp0,g26$@0#sigdelset ^683 918$@0@g26@6@0@1@tp0,g26$@0#sigemptyset ^684 920$@0@g26@6@0@1@tp0,g26$@0#sigfillset ^685 922$@0@g26@6@0@1@g26$@0#sigismember ^686 924$@0@g26@6@0@1@tp0,g26$@0#sigpending ^687 926$@0@g26@6@0,s3@1@tp2,g26,s3$@0#sigprocmask ^688 928$@0@g26@6@0,s3@1@g26,s3$@0#sigsuspend *1 (Constant) ^689 5$#L_ctermid#L_cuserid *4 (Function) ^691 1933@6@5@1@0@0@0@g26@6@0,s3@1@g26,s3@18@0@0#fdopen ^692 1935$@0@g26@6@0@1@g26$@0#fileno *7 (Struct tag) ^693 1514@935#@stat *4 (Function) ^694 1518$^$@0#S_ISBLK ^695 1522$^$@0#S_ISCHR ^696 1526$^$@0#S_ISDIR ^697 1530$^$@0#S_ISFIFO ^698 1534$^$@0#S_ISREG ^699 953$@0@s3,g26@6@0@1@s3,g26$@0#chmod ^700 956$@0@g26@6@0@1@g26,tp1$@0#fstat ^701 958$@0@s3,g26@6@0@1@s3,g26$@0#mkdir ^702 960$@0@s3,g26@6@0@1@s3,g26$@0#mkfifo ^703 962$@0@g26@6@0@1@g26,tp1$@0#stat ^704 964$@0@s3@1@s3$@0#umask *7 (Struct tag) ^705 965@966#@tms *4 (Function) ^706 969$@0@@1@tp0$@0#times *7 (Struct tag) ^707 970@971#@utsname *4 (Function) ^708 974$@0@g26@6@0@1@tp0,g26$@0#uname ^709 976$^$@0#WEXITSTATUS ^710 978$^$@0#WIFEXITED ^711 980$^$@0#WIFSIGNALED ^712 982$^$@0#WIFSTOPPED ^713 984$^$@0#WSTOPSIG ^714 986$^$@0#WTERMSIG *1 (Constant) ^715 5$#WUNTRACED#WCONTINUED#WNOHANG *4 (Function) ^718 988$@0@g26@6@0,s3@1@tp0,g26,s3$@0#wait ^719 990$@0@g26@6@0,s3@1@tp1,g26,s3$@0#waitpid *0 (Datatype) ^720 992@-@-@0@0@0@0@993#cc_t ^721 995@-@-@0@0@0@0@996#speed_t ^722 995@-@-@0@0@0@0@997#tcflag_t *1 (Constant) ^723 5$#B0#B50#B75#B110#B134#B150#B200#B300#B600#B1200#B1800#B2400#B4800#B9600#B19200#B38400#BRKINT#CLOCAL#CREAD#CS5#CS6#CS7#CS8#CSIZE#CSTOPB#ECHO#ECHOE#ECHOK#ECHONL#HUPCL#ICANON#ICRNL#IEXTEN#IGNBRK#IGNCR#IGNPAR#IGNLCR#INPCK#ISIG#ISTRIP#IXOFF#IXON#NCCS#NOFLSH#OPOST#PARENB#PARMRK#PARODD#TCIFLUSH#TCIOFF#TCIOFLUSH#TCION#TCOFLUSH#TCSADRAIN#TCSAFLUSH#TCSANOW#TOSTOP#VEOF#VEOL#VERASE#VINTR#VKILL#VMIN#VQUIT#VSTART#VSTOP#VSUSP#VTIME *7 (Struct tag) ^791 998@999#@termios *4 (Function) ^792 1002$^$@0#cfgetispeed ^793 1004$^$@0#cfgetospeed ^794 1006$@0@@1@tp0$@0#cfsetispeed ^795 1008$@0@@1@tp0$@0#cfsetospeed ^796 1010$@0@g26@6@0@1@g26$@0#tcdrain ^797 1012$@0@g26@6@0@1@g26$@0#tcflow ^798 1014$@0@g26@6@0@1@g26$@0#tcflush ^799 1016$@0@g26@6@0@1@g26,tp1$@0#tcgetattr ^800 1018$@0@g26@6@0@1@g26$@0#tcsendbreak ^801 1020$@0@g26@6@0@1@g26$@0#tcsetattr *3 (Variable) ^802 461|@1|6@0@0@0@1#environ *1 (Constant) ^803 5$#CLK_TCK *4 (Function) ^804 1207$@1@g802@6@0,s3@1@s3,g1061,g1062,g1063$@0#tzset *1 (Constant) ^805 5$#F_OK#R_OK#STDERR_FILENO#STDIN_FILENO#STDOUT_FILENO#W_OK#X_OK#_PC_CHOWN_RESTRUCTED#_PC_MAX_CANON#_PC_MAX_INPUT#_PC_NAME_MAX#_PC_NO_TRUNC#_PC_PATH_MAX#_PC_PIPE_BUF#_PC_VDISABLE#_POSIX_CHOWN_RESTRICTED#_POSIX_JOB_CONTROL#_POSIX_NO_TRUNC#_POSIX_SAVED_IDS#_POSIX_VDISABLE#_POSIX_VERSION#_SC_ARG_MAX#_SC_CHILD_MAX#_SC_CLK_TCK#_SC_JOB_CONTROL#_SC_NGROUPS_MAX#_SC_OPEN_MAX#_SC_SAVED_IDS#_SC_STREAM_MAX#_SC_TZNAME_MAX#_SC_VERSION *4 (Function) ^836 1698@6@0@6@0@0^$@0#_exit ^837 1657$@0@g26@6@0@1@g26$@0#access ^838 1659$@0@s3@1@s3,s1$@0#alarm ^839 1663$@0@g26@6@0@1@g26,s1$@0#chdir ^840 1665$@0@s3,g26@6@0@1@s3,g26,s1$@0#chown ^841 1667$@0@s3,g26@6@0@1@s3,g26,s1$@0#close ^842 1927@6@5@1@0@0@1@s3@1@tp0,s3@18@0@0#ctermid ^843 1930@6@5@1@0@0@0@@1@tp0@18@0@0#cuserid ^844 1682$@0@g26@6@0,s3@1@g26,s3,s1$@0#dup2 ^845 1680$@0@g26@6@0,s3@1@g26,s3,s1$@0#dup ^846 1686@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execl ^847 1688@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execle ^848 1690@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execlp ^849 1692@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execv ^850 1694@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execve ^851 1696@6@0@5@0@0@0@g26@6@0@1@g26,s1$@0#execvp ^852 1706$@0@s3,g26@6@0@1@s3,g26,s1$@0#fork ^853 1708$@0@g26@6@0@1@g26,s1$@0#fpathconf ^854 1715@6@5@1@0@0@0@g26@6@0@1@g26,tp0$@0#getcwd ^855 1719$^$@0#getegid ^856 1721$^$@0#geteuid ^857 1723$^$@0#getgid ^858 1725$@0@g26@6@0@1@g26,ap1$@0#getgroups ^859 1730@6@5@1@0@0@1@@1@g26@19@3@0#getlogin ^860 1743$^$@0#getpgrp ^861 1745$^$@0#getpid ^862 1747$^$@0#getppid ^863 1751$^$@0#getuid ^864 1756$@1@@1@g26$@0#isatty ^865 1760$@0@g26@6@0,s3@1@g26,s3$@0#link ^866 1764$@0@g26@6@0@1@g26$@0#lseek ^867 1768$@0@g26@6@0@1@g26,s1$@0#pathconf ^868 1770$@0@g26@6@0@1@g26,s1$@0#pause ^869 1772$@0@g26@6@0@1@g26$@0#pipe ^870 1099$@0@g26@6@0@1@g26,tp1$@0#read ^871 1101$@0@s3,g26@6@0@1@s3,g26$@0#rmdir ^872 1103$@0@g26@6@0,s3@1@g26,s3$@0#setgid ^873 1105$@0@g26@6@0,s3@1@g26,s3$@0#setpgid ^874 1803$@0@s3@1@s3,g26,s1$@0#setsid ^875 1805$@0@g26@6@0,s3@1@g26,s3,s1$@0#setuid ^876 1807$@0@s3@1@s3$@0#sleep ^877 1815$@0@g26@6@0@1@g26$@0#sysconf ^878 1817$@1@g26@6@0@1@g26$@0#tcgetpgrp ^879 1819$@0@g26@6@0,s3@1@g26,s3$@0#tcsetpgrp ^880 1824@6@5@1@0@0@1@g26@6@0@1@g26@19@3@0#ttyname ^881 1830$@0@s3,g26@6@0@1@s3,g26$@0#unlink ^882 1124$@0@g26@6@0@1@g26$@0#write *7 (Struct tag) ^883 1125@1126#@utimbuf *4 (Function) ^884 1129$@0@s3,g26@6@0@1@s3,g26$@0#utime *0 (Datatype) ^885 20@a@+@0@0@0@0@1130#regex_t ^886 13@-@-@0@0@0@0@1131#regoff_t *7 (Struct tag) ^887 1132@1133#@!7 *0 (Datatype) ^888 1132@-@-@0@0@0@0@1134#regmatch_t *4 (Function) ^889 1137$@0@@1@p0$@0#regcomp ^890 1140$@0@@1@p3$@0#regexec ^891 1142$@0@@1@p2$@0#regerror ^892 1144$$$@0#regfree *1 (Constant) ^893 5$#REG_BASIC#REG_EXTENDED#REG_ICASE#REG_NOSUB#REG_NEWLINE#REG_NOSPEC#REG_PEND#REG_DUMP#REG_NOMATCH#REG_BADPAT#REG_ECOLLATE#REG_ECTYPE#REG_EESCAPE#REG_ESUBREG#REG_EBRACK#REG_EPAREN#REG_EBRACE#REG_BADBR#REG_ERANGE#REG_ESPACE#REG_BADRPT#REG_EMPTY#REG_ASSERT#REG_INVARG#REG_ATOI#REG_ITOA#REG_NOTBOL#REG_NOTEOL#REG_STARTEND#REG_TRACE#REG_LARGE#REG_BACKR *0 (Datatype) ^925 13@-@-@0@0@0@0@1145#blkcnt_t ^926 13@-@-@0@0@0@0@1146#blksize_t ^927 13@-@-@0@0@0@0@1147#clockid_t ^928 14@-@-@0@0@0@0@1148#fsblkcnt_t ^929 14@-@-@0@0@0@0@1149#fsfilcnt_t ^930 13@-@-@0@0@0@0@1150#id_t ^931 13@-@-@0@0@0@0@1151#key_t ^932 13@-@-@0@0@0@0@1152#pthread_attr_t ^933 13@-@-@0@0@0@0@1153#pthread_cond_t ^934 13@-@-@0@0@0@0@1154#pthread_condattr_t ^935 13@-@-@0@0@0@0@1155#pthread_key_t ^936 13@-@-@0@0@0@0@1156#pthread_mutex_t ^937 13@-@-@0@0@0@0@1157#pthread_mutexattr_t ^938 13@-@-@0@0@0@0@1158#pthread_once_t ^939 13@-@-@0@0@0@0@1159#pthread_rwlock_t ^940 13@-@-@0@0@0@0@1160#pthread_rwlockattr_t ^941 13@-@-@0@0@0@0@1161#pthread_t ^942 15@-@-@0@0@0@0@1162#suseconds_t ^943 13@-@-@0@0@0@0@1163#timer_t ^944 14@-@-@0@0@0@0@1164#useconds_t *3 (Variable) ^945 5|@1|6@0@0@0@1#signgam *4 (Function) ^946 1166$@0@@1@tp1$@0#bcopy ^947 1170$^$@0#bcmp ^948 1172$@0@@1@tp0$@0#bzero ^949 1174$^$@0#ffs ^950 1811$@0@s3@1@s3,g26$@0#symlink ^951 1178$@0@s1@1@s1$@0#setvbuf_unlocked ^952 1180$@0@s1@1@s1$@0#setbuffer ^953 1182$@0@s1@1@s1$@0#setlinebuf ^954 1184$@0@@1@p1$@0#strerror_r ^955 1186$@0@@1@tp3,tp0$@0#fread_unlocked ^956 1188$@0@@1@tp3$@0#fwrite_unlocked ^957 1192$@0@@1@tp0$@0#memccpy ^958 1194$^$@0#strcasecmp ^959 1196$^$@0#strncasecmp ^960 1199@6@5@1@0@0^@2@0@0#strdup ^961 1202@6@5@1@0@0^@18@0@0#index ^962 1205@6@5@1@0@0^@18@0@0#rindex *1 (Constant) ^963 5$#ENOTBLK#ETXTBSY#EWOULDBLOCK#EINPROGRESS#EALREADY#ENOTSOCK#EDESTADDRREQ#EMSGSIZE#EPROTOTYPE#ENOPROTOOPT#EPROTONOSUPPORT#ESOCKTNOSUPPORT#EOPNOTSUPP#EPFNOSUPPORT#EAFNOSUPPORT#EADDRINUSE#EADDRNOTAVAIL#ENETDOWN#ENETUNREACH#ENETRESET#ECONNABORTED#ECONNRESET#ENOBUFS#EISCONN#ENOTCONN#ESHUTDOWN#ETOOMANYREFS#ETIMEDOUT#ECONNREFUSED#EHOSTDOWN#EHOSTUNREACH#EPROCLIM#EUSERS#EDQUOT#ESTALE#EREMOTE#ENOMSG#EIDRM#EALIGN#EACTIVE#ENOACTIVE#ENORESOURCES#ENOSYSTEM#ENODUST#EDUPNOCONN#EDUPNODISCONN#EDUPNOTCNTD#EDUPNOTIDLE#EDUPNOTWAIT#EDUPNOTRUN#EDUPBADOPCODE#EDUPINTRANSIT#EDUPTOOMANYCPUS#ELOOP#LOCK_MAX#FCHR_MAX#USI_MAX#WORD_BIT#LONG_BIT#MAX_CHAR#PASS_MAX#PID_MAX#SYSPID_MAX#PIPE_MAX#PROC_MAX#STD_BLK#SYS_NMLN#SYS_OPEN#NZERO#UID_MAX#NL_ARGMAX#NL_MSGMAX#NL_NMAX#NL_SETMAX#NL_TEXTMAX#NL_LBLMAX#NL_LANGMAX ^1040 17$#M_E#M_LOG2E#M_LOG10E#M_LN2#M_LN10#M_PI#M_PI_2#M_PI_4#M_1_PI#M_2_PI#M_2_SQRTPI#M_SQRT2#M_SQRT1_2#MAXFLOAT#HUGE ^1055 5$#DOMAIN#SING#OVERFLOW#UNDERFLOW#TLOSS#PLOSS *3 (Variable) ^1061 5|@1|6@0@0@0@1#daylight ^1062 9|@1|6@0@0@0@1#timezone ^1063 1052|@1|6@0@0@0@1#tzname *0 (Datatype) ^1064 3@-@-@0@0@0@0@1208#uchar_t ^1065 8@-@-@0@0@0@0@1209#ushort_t ^1066 6@-@-@0@0@0@0@1210#uint_t ^1067 10@-@-@0@0@0@0@1211#ulong_t ^1068 3@-@-@0@0@0@0@1212#vuchar_t ^1069 8@-@-@0@0@0@0@1213#vushort_t ^1070 6@-@-@0@0@0@0@1214#vuint_t ^1071 10@-@-@0@0@0@0@1215#vulong_t ^1072 9@-@-@0@0@0@0@1216#label_t ^1073 5@-@-@0@0@0@0@1217#level_t ^1074 13@-@-@0@0@0@0@1218#daddr_t ^1075 23@-@+@0@0@0@0@1219#caddr_t ^1076 28@-@+@0@0@0@0@1220#qaddr_t ^1077 23@-@+@0@0@0@0@1221#addr_t ^1078 9@-@-@0@0@0@0@1222#physadr_t ^1079 7@-@-@0@0@0@0@1223#cnt_t ^1080 5@-@-@0@0@0@0@1224#chan_t ^1081 5@-@-@0@0@0@0@1225#paddr_t ^1082 20@-@+@0@0@0@0@1226#mid_t ^1083 1228@-@-@0@0@0@0@1229#slab_t ^1084 1211@-@-@0@0@0@0@1230#shmatt_t ^1085 1211@-@-@0@0@0@0@1231#msgqnum_t ^1086 1211@-@-@0@0@0@0@1232#msglen_t ^1087 1208@-@-@0@0@0@0@1233#uchar ^1088 1209@-@-@0@0@0@0@1234#ushort ^1089 1210@-@-@0@0@0@0@1235#uint ^1090 1211@-@-@0@0@0@0@1236#ulong ^1091 1208@-@-@0@0@0@0@1237#u_char ^1092 1209@-@-@0@0@0@0@1238#u_short ^1093 1210@-@-@0@0@0@0@1239#u_int ^1094 1211@-@-@0@0@0@0@1240#u_long ^1095 1212@-@-@0@0@0@0@1241#vu_char ^1096 1213@-@-@0@0@0@0@1242#vu_short ^1097 1214@-@-@0@0@0@0@1243#vu_int ^1098 1215@-@-@0@0@0@0@1244#vu_long ^1099 9@-@-@0@0@0@0@1245#swblk_t ^1100 1240@-@-@0@0@0@0@1246#fixpt_t ^1101 9@-@-@0@0@0@0@1247#segsz_t ^1102 0@a@=@0@0@0@0@1248#fd_set *4 (Function) ^1103 1251$@0@g26@6@0@1@tp2,g26$@0#ioctl ^1104 1834$@0@s3@1@s3,g26$@0#vfork *7 (Struct tag) ^1105 1254@1255#@iovec *1 (Constant) ^1106 5$#UIO_MAXIOV#IOV_MAX *4 (Function) ^1108 1258$@0@s3,g26@6@0@1@fiov_base.tp1,s3,g26$@0#readv ^1109 1260$@0@g26@6@0@1@g26$@0#writev *7 (Struct tag) ^1110 1261@1262#@poll *1 (Constant) ^1111 7$#POLLIN#POLLRDNORM#POLLRDBAND#POLLPRI#POLLOUT#POLLWRNORM#POLLWRBAND#POLLERR#POLLHUP#POLLNVAL *4 (Function) ^1121 1265$@0@g26@6@0@1@frevents.ap0,g26$@0#poll *1 (Constant) ^1122 5$#SOCK_RDM#SO_USELOOPBACK#SO_REUSEPORT#AF_LOCAL#AF_IMPLINK#AF_PUP#AF_CHAOS#AF_NS#AF_ISO#AF_OSI#AF_ECMA#AF_DATAKIT#AF_CCITT#AF_SNA#AF_DECnet#AF_DLI#AF_LAT#AF_HYLINK#AF_APPLETALK#AF_ROUTE#AF_LINK#pseudo_AF_XTP#AF_COIP#AF_CNT#pseudo_AF_RTIP#AF_IPX#AF_SIP#pseudo_AF_PIP#AF_ISDN#AF_E164#AF_MAX#MSG_DONTWAIT#MSG_EOF#MSG_COMPAT#PF_UNSPEC#PF_LOCAL#PF_UNIX#PF_INET#PF_IMPLINK#PF_PUP#PF_CHAOS#PF_NS#PF_ISO#PF_OSI#PF_ECMA#PF_DATAKIT#PF_CCITT#PF_SNA#PF_DECnet#PF_DLI#PF_LAT#PF_HYLINK#PF_APPLETALK#PF_ROUTE#PF_LINK#PF_XTP#PF_COIP#PF_CNT#PF_SIP#PF_IPX#PF_RTIP#PF_PIP#PF_ISDN#PF_MAX#NET_MAXID#NET_RT_DUMP#NET_RT_FLAGS#NET_RT_IFLIST#NET_RT_MAXID *0 (Datatype) ^1191 14@-@-@0@0@0@0@1268#sa_family_t ^1192 14@-@-@0@0@0@0@1269#__socklen_t ^1193 14@-@-@0@0@0@0@1270#socklen_t *7 (Struct tag) ^1194 1271@1272#@sockaddr ^1195 1273@1274#@sockaddr_storage ^1196 1275@1276#@msghdr ^1197 1277@1278#@cmsghdr *1 (Constant) ^1198 5$#SCM_RIGHTS *4 (Function) ^1199 1282$^@19@2@0#CMSG_DATA ^1200 1286@6@5@1@0@0^@19@2@0#CMSG_NXTHDR ^1201 1289@6@5@1@0@0^@19@2@0#CMSG_FIRSTHDR *7 (Struct tag) ^1202 1290@1291#@linger *1 (Constant) ^1203 5$#SOCK_DGRAM#SOCK_RAW#SOCK_SEQPACKET#SOCK_STREAM#SOL_SOCKET#SO_ACCEPTCONN#SO_BROADCAST#SO_DEBUG#SO_DONTROUTE#SO_ERROR#SO_KEEPALIVE#SO_LINGER#SO_OOBINLINE#SO_RCVBUF#SO_RCVLOWAT#SO_RCVTIMEO#SO_REUSEADDR#SO_SNDBUF#SO_SNDLOWAT#SO_SNDTIMEO#SO_TYPE#SOMAXCONN#MSG_CTRUNC#MSG_DONTROUTE#MSG_EOR#MSG_OOB#MSG_PEEK#MSG_TRUNC#MSG_WAITALL#AF_INET#AF_INET6#AF_UNIX#AF_UNSPEC#SHUT_RD#SHUT_RDWR#SHUT_WR *4 (Function) ^1239 1294$@0@g26@6@0@1@tp2,g26$@0#accept ^1240 1296$@0@g26@6@0,s3@1@g26,s3$@0#bind ^1241 1298$@0@g26@6@0,s1@1@g26,s1$@0#connect ^1242 1301$@0@g26@6@0@1@tp1,tp2,g26$@0#getpeername ^1243 1303$@0@g26@6@0@1@tp1,tp2,g26$@0#getsockname ^1244 1306$@0@g26@6@0@1@tp3,tp4,g26$@0#getsockopt ^1245 1308$@0@g26@6@0,s1@1@g26,s1$@0#listen ^1246 1310$@0@g26@6@0@1@tp1,g26$@0#recv ^1247 1312$@0@g26@6@0@1@tp1,tp4,tp5,g26$@0#recvfrom ^1248 1314$@0@g26@6@0@1@afiov_base.tfmsg_iov.tp1,g26$@0#recvmsg ^1249 1316$@0@g26@6@0@1@g26$@0#send ^1250 1318$@0@g26@6@0@1@g26$@0#sendto ^1251 1320$@0@g26@6@0@1@g26$@0#sendmsg ^1252 1322$@0@s1,g26@6@0@1@s1,g26$@0#setsockopt ^1253 1324$@0@g26@6@0@1@g26$@0#shutdown ^1254 1326$@0@g26@6@0@1@g26$@0#socket ^1255 1328$@0@g26@6@0@1@g26$@0#socketpair *1 (Constant) ^1256 5$#BADSIG#SA_ONSTACK#SA_RESTART#SA_DISABLE#SIGBUS#SIGEMT#SIGINFO#SIGIO#SIGIOT#SIGPOLL#SIGPROF#SIGPWR#SIGSYS#SIGTRAP#SIGURG#SIGVTALRM#SIGWINCH#SIGXCPU#SIGXFSZ *4 (Function) ^1275 1330$@0@s3@1@s3$@0#psignal ^1276 1332$@1@g802@6@0,g26@6@0@1@tg802,g26$@0#setenv ^1277 1334$@1@g802@6@0@1@tg802$@0#unsetenv ^1278 1336$^$@0#WCOREDUMP ^1279 1338$^$@0#W_EXITCODE ^1280 1340$^$@0#W_STOPCODE *1 (Constant) ^1281 5$#WAIT_ANY#WAIT_MYPGRP#WSTOPPED *7 (Struct tag) ^1284 1583@1341#@rusage *4 (Function) ^1285 1344$@0@g26@6@0@1@tp0,tp2,g26$@0#wait3 ^1286 1346$@0@g26@6@0@1@tp1,tp3,g26$@0#wait4 *7 (Struct tag) ^1287 1347@1348#@timeval ^1288 1349@1350#@timespec ^1289 1351@1352#@timezone *1 (Constant) ^1290 5$#DST_NONE#DST_USA#DST_AUST#DST_WET#DST_MET#DST_EET#DST_CAN#ITIMER_PROF#ITIMER_REAL#ITIMER_VIRTUAL *7 (Struct tag) ^1300 1353@1354#@itimerval ^1301 1355@1356#@clockinfo *4 (Function) ^1302 1359$@0@s1,g26@6@0@1@s1,tp1,g26$@0#adjtime ^1303 1362$@0@g26@6@0@1@g26,tp1$@0#getitimer ^1304 1365$@0@g26@6@0@1@tp0,tp1,g26$@0#gettimeofday ^1305 1367$@0@g26@6@0,s1@1@tp2,g26,s1$@0#setitimer ^1306 1369$@0@s1,g26@6@0@1@s1,g26$@0#settimeofday ^1307 1371$@0@s3,g26@6@0@1@s3,g26$@0#utimes *1 (Constant) ^1308 5$#PROT_READ#PROT_WRITE#PROT_EXEC#MAP_SHARED#MAP_PRIVATE#MAP_COPY#MAP_FIXED#MAP_RENAME#MAP_NORESERVE#MAP_INHERIT#MAP_NOEXTEND#MAP_HASSEMAPHORE#MS_ASYNC#MS_INVALIDATE#MAP_FILE#MAP_ANON#MADV_NORMAL#MADV_RANDOM#MADV_SEQUENTIAL#MADV_WILLNEED#MADV_DONTNEED *4 (Function) ^1329 1373$@0@@1@p0$@0#mmap ^1330 1375$^$@0#madvise ^1331 1377$^$@0#mprotect ^1332 1379$@0@s3,g26@6@0@1@s3,tp0,g26$@0#munmap ^1333 1381$^$@0#msync ^1334 1383$^$@0#mlock ^1335 1385$^$@0#munlock *7 (Struct tag) ^1336 1386@1387#@winsize *1 (Constant) ^1337 5$#TIOCMODG#TIOCMODS#TIOCM_LE#TIOCM_DTR#TIOCM_RTS#TIOCM_ST#TIOCM_SR#TIOCM_CTS#TIOCM_CAR#TIOCM_CD#TIOCM_RNG#TIOCM_RI#TIOCM_DSR#TIOCEXCL#TIOCNXCL#TIOCFLUSH#TIOCGETA#TIOCSETA#TIOCSETAW#TIOCSETAF#TIOCGETD#TIOCSETD#TIOCSBRK#TIOCCBRK#TIOCSDTR#TIOCCDTR#TIOCGPGRP#TIOCSPGRP#TIOCOUTQ#TIOCSTI#TIOCNOTTY#TIOCPKT#TIOCPKT_DATA#TIOCPKT_FLUSHREAD#TIOCPKT_FLUSHWRITE#TIOCPKT_STOP#TIOCPKT_START#TIOCPKT_NOSTOP#TIOCPKT_DOSTOP#TIOCPKT_IOCTL#TIOCSTOP#TIOCSTART#TIOCMSET#TIOCMBIS#TIOCMBIC#TIOCMGET#TIOCREMOTE#TIOCGWINSZ#TIOCSWINSZ#TIOCUCNTL#TIOCSTAT#TIOCCONS#TIOCSCTTY#TIOCEXT#TIOCSIG#TIOCDRAIN#TIOCMSDTRWAIT#TIOCMGDTRWAIT#TIOCTIMESTAMP#TIOCSDRAINWAIT#TIOCGDRAINWAIT#TTYDISC#TABLDISC#SLIPDISC#PPPDISC#MAXHOSTNAMELEN *4 (Function) ^1403 1390$@0@@1@tp1$@0#FD_CLR ^1404 1392$@0@@1@tp1$@0#FD_COPY ^1405 1395$^$@0#FD_ISSET ^1406 1397$@0@@1@tp1$@0#FD_SET ^1407 1399$@0@@1@tp0$@0#FD_ZERO ^1408 1702$@0@s1,g26@6@0@1@s1,g26$@0#fchdir ^1409 1700$@0@g26@6@0,s3@1@g26,s3$@0#fchown ^1410 1710$@0@g26@6@0,s3@1@g26,s3$@0#fsync ^1411 1712$@0@g26@6@0,s3@1@g26,s3$@0#ftruncate ^1412 1409$@0@@1@p0$@0#gethostname ^1413 1411$@0@s1@1@s1$@0#initgroups ^1414 1758$@0@g26@6@0,s3@1@g26,s3$@0#lchown ^1415 1415$@0@g26@6@0@1@tp1,tp2,tp3,tp4,g26$@0#select ^1416 1417$@0@g26@6@0,s1@1@g26,s1$@0#setegid ^1417 1419$@0@g26@6@0,s1@1@g26,s1$@0#seteuid ^1418 1422$@0@g26@6@0,s1@1@g26,s1$@0#setgroups ^1419 1799$@0@g26@6@0,s1@1@g26,s1$@0#setregid ^1420 1801$@0@g26@6@0,s1@1@g26,s1$@0#setreuid ^1421 1813$@0@s3@1@s3$@0#sync ^1422 1821$@0@g26@6@0,s3@1@g26,s3$@0#truncate *1 (Constant) ^1423 5$#EBADRPC#ERPCMISMATCH#EPROGUNAVAIL#EPROGMISMATCH#EPROCUNAVAIL#EFTYPE#EAUTH#ENEEDAUTH#ELAST *3 (Variable) ^1432 23|@1|6@0@0@0@1#TMAGIC *1 (Constant) ^1433 5$#TMAGLEN *3 (Variable) ^1434 23|@1|6@0@0@0@1#TVERSION *1 (Constant) ^1435 5$#TVERSLEN#REGTYPE#AREGTYPE#LNKTYPE#SYMTYPE#CHRTYPE#BLKTYPE#DIRTYPE#FIFOTYPE#CONTTYPE#TSUID#TSGID#TSVTX#TUREAD#TUWRITE#TUEXEC#TGREAD#TGWRITE#TGEXEC#TOREAD#TOWRITE#TOEXEC *7 (Struct tag) ^1457 1433@1434#@ipc_perm *1 (Constant) ^1458 5$#IPC_R#IPC_W#IPC_M#IPC_CREAT#IPC_EXCL#IPC_NOWAIT ^1464 1151$#IPC_PRIVATE ^1465 5$#IPC_RMID#IPC_SET#IPC_STAT *7 (Struct tag) ^1468 0@1435#@msg ^1469 1437@1438#@msqid_ds ^1470 1439@1440#@mymesg *1 (Constant) ^1471 5$#MSG_NOERROR#MSGMAX#MSGMNB#MSGMNI#MSGTQL *4 (Function) ^1476 1443$@0@g26@6@0@1@g26,tp2$@0#msgctl ^1477 1445$@0@g26@6@0@1@g26$@0#msgget ^1478 1447$@0@g26@6@0@1@g26,tp1$@0#msgrcv ^1479 1449$@0@g26@6@0@1@g26$@0#msgsnd *7 (Struct tag) ^1480 1454@1450#@sem ^1481 1452@1453#@semid_ds *8 (Union tag) ^1482 1457@1458#$semun *7 (Struct tag) ^1483 1459@1460#@sembuf *1 (Constant) ^1484 5$#SEM_A#SEMAEM#SEMMNI#SEMMNS#SEMMNU#SEMMSL#SEMOPN#SEM_R#SEMUME#SEM_UNDO#SEMVMX#GETVAL#SETVAL#GETPID#GETNCNT#GETZCNT#GETALL#SETALL#ERMID *4 (Function) ^1503 1462$@0@g26@6@0@1@g26$@0#semctl ^1504 1464$@0@g26@6@0@1@g26$@0#semget ^1505 1467$@0@g26@6@0@1@g26$@0#semop *7 (Struct tag) ^1506 1468@1469#@shmid_ds *1 (Constant) ^1507 5$#SHMLBA#SHM_LOCK#SHMMAX#SHMMIN#SHMMNI#SHM_R#SHM_RDONLY#SHM_RND#SHMSEG#SHM_W#SHM_UNLOCK *4 (Function) ^1518 1472$@0@g26@6@0@1@g26@3@0@0#shmat ^1519 1475$@0@g26@6@0@1@g26,tp2$@0#shmctl ^1520 1477$@0@g26@6@0@1@g26$@0#shmdt ^1521 1479$@0@g26@6@0@1@g26$@0#shmget *1 (Constant) ^1522 5$#LOG_EMERG#LOG_ALERT#LOG_CRIT#LOG_ERR#LOG_WARNING#LOG_NOTICE#LOG_INFO#LOG_DEBUG#LOG_KERN#LOG_USER#LOG_MAIL#LOG_DAEMON#LOG_AUTH#LOG_SYSLOG#LOG_LPR#LOG_NEWS#LOG_UUCP#LOG_CRON#LOG_AUTHPRIV#LOG_FTP#LOG_LOCAL0#LOG_LOCAL1#LOG_LOCAL2#LOG_LOCAL3#LOG_LOCAL4#LOG_LOCAL5#LOG_LOCAL6#LOG_LOCAL7#LOG_PID#LOG_CONS#LOG_ODELAY#LOG_NDELAY#LOG_NOWAIT#LOG_PERROR *4 (Function) ^1556 1481$^$@0#LOG_MASK ^1557 1483$^$@0#LOG_UPTO ^1558 1485$@0@s3@1@s3$@0#closelog ^1559 1487$@0@s3@1@s3$@0#openlog ^1560 1489$@0@s1@1@s1$@0#setlogmask ^1561 1491@6@0@1@1@0@0@s3@1@s3$@0#syslog ^1562 1493$@0@s3@1@s3$@0#vsyslog ^1563 1495$@0@s1@1@s1$@0#endpwent ^1564 1498@6@5@1@0@0@0@s1@1@s1@3@0@0#getpwent ^1565 1500$@0@s1@1@s1$@0#setpassent ^1566 1502$@0@s1@1@s1$@0#setpwent ^1567 1504$@0@s1@1@s1$@0#endgrent ^1568 1507@6@5@1@0@0@0@s1@1@s1@19@3@0#getgrent ^1569 1509$@0@s1@1@s1$@0#setgrent ^1570 1511$@0@s1@1@s1$@0#setgrfile ^1571 1513$@0@s1@1@s1$@0#setgroupent *1 (Constant) ^1572 814$#S_IRWXG#S_IRWXO#S_ISVTX *4 (Function) ^1575 1537$^$@0#S_ISLNK ^1576 1540$^$@0#S_TYPEISMQ ^1577 1543$^$@0#S_TYPEISSEM ^1578 1546$^$@0#S_TYPEISSHM ^1579 1548$@0@g26@6@0@1@g26$@0#lstat ^1580 1550$@0@g26@6@0@1@g26$@0@W:portability#The only portable use of mknod is to create FIFO-special file. If mode is not S_IFIFO or dev is not 0, the behaviour of mknod() is unspecified.##mknod ^1581 1552$@0@s3,g26@6@0@1@s3,g26$@0@W:unixstandard#Not in Single UNIX Specification Version 2##chflags ^1582 1554$@0@s3,g26@6@0@1@s3,g26$@0@W:unixstandard#Not in Single UNIX Specification Version 2##fchflags ^1583 1556$@0@s3,g26@6@0@1@s3,g26$@0#fchmod *7 (Struct tag) ^1584 1557@1558#@statvfs *1 (Constant) ^1585 10$#ST_RDONLY#ST_NOSUID *4 (Function) ^1587 1561$@0@@1@p1$@0#fstatvfs ^1588 1563$@0@@1@p1$@0#statvfs *1 (Constant) ^1589 5$#FMNAMESZ#MSG_BAND#MSG_HIPRI#RS_HIPRI#S_INPUT#S_RDNORM#S_RDBAND#S_BANDURG#S_HIPRI#S_OUTPUT#S_WRNORM#S_WRBAND#S_MSG#S_ERROR#S_HANGUP *7 (Struct tag) ^1604 1564@1565#@strbuf ^1605 1566@1567#@str_mlist ^1606 1569@1570#@str_list *4 (Function) ^1607 1573$@0@g26@6@0@1@tp1,tp2,g26$@0#getmsg ^1608 1575$@0@g26@6@0@1@tp3,tp1,tp2,g26$@0#getpmsg ^1609 1577$@0@s1,g26@6@0@1@s1,g26$@0#putmsg ^1610 1579$@0@s1,g26@6@0@1@s1,g26$@0#putpmsg *1 (Constant) ^1611 5$#PRIO_PROCESS#PRIO_PGRP#PRIO_USER *0 (Datatype) ^1614 14@-@-@0@0@0@0@1580#rlim_t *1 (Constant) ^1615 1580$#RLIM_INFINITY#RLIM_SAVED_MAX#RLIM_SAVED_CUR ^1618 5$#RUSAGE_SELF#RUSAGE_CHILDREN *7 (Struct tag) ^1620 1581@1582#@rlimit *1 (Constant) ^1621 5$#RLIMIT_CORE#RLIMIT_CPU#RLIMIT_DATA#RLIMIT_FSIZE#RLIMIT_NOFILE#RLIMIT_STACK#RLIMIT_AS *4 (Function) ^1628 1585$@0@g26@6@0@1@g26$@0#getpriority ^1629 1588$@0@g26@6@0@1@tp1,g26$@0#getrlimit ^1630 1590$@0@g26@6@0@1@tp1,g26$@0#getrusage ^1631 1592$@0@g26@6@0,s1@1@g26,s1$@0#setpriority ^1632 1594$@0@g26@6@0,s1@1@g26,s1$@0#setrlimit *7 (Struct tag) ^1633 1595@1596#@servent *4 (Function) ^1634 1600@6@5@1@0@0$@18@3@0@W:multithreaded#Unsafe in multithreaded applications, use getsrvbyname_r instead##getservbyname ^1635 1603$$$@0#getservbyname_r ^1636 1606$$@18@3@0@W:multithreaded#Unsafe in multithreaded applications, use getservbyport_r instead##getservbyport ^1637 1609$$$@0#getservbyport_r ^1638 1612@6@5@1@0@0$@3@0@0#getservent ^1639 1615@6@5@1@0@0$@3@0@0#getservent_r ^1640 1617$$$@0#setservent ^1641 1619$$$@0#endservent *3 (Variable) ^1642 5|@1|6@0@0&#h_errno *7 (Struct tag) ^1643 1655@1620#@hostent *4 (Function) ^1644 1624@6@5@1@0@0@0@g1642@6@0@1@g1642@19@3@0@W:multithreaded#Unsafe in multithreaded applications, use gethostbyname_r instead##gethostbyname ^1645 1627$$$@0#gethostbyname_r ^1646 1630@6@5@1@0@0@0@g1642@6@0@1@g1642@19@3@0@W:multithreaded#Unsafe in multithreaded applications, use gethostbyaddr_r instead##gethostbyaddr ^1647 1633$$$@0#gethostbyaddr_r ^1648 1636@6@5@1@0@0$@19@3@0@W:multithreaded#Unsafe in multithreaded applications, use gethostent_r instead##gethostent ^1649 1639$$$@0#gethostent_r ^1650 1642$$@3@0@0#fgethostent ^1651 1645$$@3@0@0#fgethostent_r ^1652 1647$$$@0#sethostent ^1653 1649$$$@0#endhostent ^1654 1651$$$@0#herror ^1655 1654$$@3@0@0#hstrerror *1 (Constant) ^1656 5$#_POSIX2_VERSION#_POSIX2_C_VERSION#_XOPEN_VERSION#_XOPEN_XCU_VERSION#_CS_PATH#_CS_XBS5_ILP32_OFF32_CFLAGS#_CS_XBS5_ILP32_OFF32_LDFLAGS#_CS_XBS5_ILP32_OFF32_LIBS#_CS_XBS5_ILP32_OFF32_LINTFLAGS#_CS_XBS5_ILP32_OFFBIG_CFLAGS#_CS_XBS5_ILP32_OFFBIG_LDFLAGS#_CS_XBS5_ILP32_OFFBIG_LIBS#_CS_XBS5_ILP32_OFFBIG_LINTFLAGS#_CS_XBS5_LP64_OFF64_CFLAGS#_CS_XBS5_LP64_OFF64_LDFLAGS#_CS_XBS5_LP64_OFF64_LIBS#_CS_XBS5_LP64_OFF64_LINTFLAGS#_CS_XBS5_LPBIG_OFFBIG_CFLAGS#_CS_XBS5_LPBIG_OFFBIG_LDFLAGS#_CS_XBS5_LPBIG_OFFBIG_LIBS#_CS_XBS5_LPBIG_OFFBIG_LINTFLAGS#_SC_2_C_BIND#_SC_2_C_DEV#_SC_2_C_VERSION#_SC_2_FORT_DEV#_SC_2_FORT_RUN#_SC_2_LOCALEDEF#_SC_2_SW_DEV#_SC_2_UPE#_SC_2_VERSION#_SC_AIO_LISTIO_MAX#_SC_AIO_MAX#_SC_AIO_PRIO_DELTA_MAX#_SC_ASYNCHRONOUS_IO#_SC_ATEXIT_MAX#_SC_BC_BASE_MAX#_SC_BC_DIM_MAX#_SC_BC_SCALE_MAX#_SC_BC_STRING_MAX#_SC_COLL_WEIGHTS_MAX#_SC_DELAYTIMER_MAX#_SC_EXPR_NEST_MAX#_SC_FSYNC#_SC_GETGR_R_SIZE_MAX#_SC_GETPW_R_SIZE_MAX#_SC_IOV_MAX#_SC_LINE_MAX#_SC_LOGIN_NAME_MAX#_SC_MAPPED_FILES#_SC_MEMLOCK#_SC_MEMLOCK_RANGE#_SC_MEMORY_PROTECTION#_SC_MESSAGE_PASSING#_SC_MQ_OPEN_MAX#_SC_MQ_PRIO_MAX#_SC_PAGESIZE#_SC_PAGE_SIZE#_SC_PASS_MAX#_SC_PRIORITIZED_IO#_SC_PRIORITY_SCHEDULING#_SC_RE_DUP_MAX#_SC_REALTIME_SIGNALS#_SC_RTSIG_MAX#_SC_SEMAPHORES#_SC_SEM_NSEMS_MAX#_SC_SEM_VALUE_MAX#_SC_SHARED_MEMORY_OBJECTS#_SC_SIGQUEUE_MAX#_SC_SYNCHRONIZED_IO#_SC_THREADS#_SC_THREAD_ATTR_STACKADDR#_SC_THREAD_ATTR_STACKSIZE#_SC_THREAD_DESTRUCTOR_ITERATIONS#_SC_THREAD_KEYS_MAX#_SC_THREAD_PRIORITY_SCHEDULING#_SC_THREAD_PRIO_INHERIT#_SC_THREAD_PRIO_PROTECT#_SC_THREAD_PROCESS_SHARED#_SC_THREAD_SAFE_FUNCTIONS#_SC_THREAD_STACK_MIN#_SC_THREAD_THREADS_MAX#_SC_TIMERS#_SC_TIMER_MAX#_SC_TTY_NAME_MAX#_SC_XOPEN_VERSION#_SC_XOPEN_CRYPT#_SC_XOPEN_ENH_I18N#_SC_XOPEN_SHM#_SC_XOPEN_UNIX#_SC_XOPEN_XCU_VERSION#_SC_XOPEN_LEGACY#_SC_XOPEN_REALTIME#_SC_XOPEN_REALTIME_THREADS#_SC_XBS5_ILP32_OFF32#_SC_XBS5_ILP32_OFFBIG#_SC_XBS5_LP64_OFF64#_SC_XBS5_LPBIG_OFFBIG *4 (Function) ^1753 1661$@0@g26@6@0@1@g26$@0@W:legacy#brk is obsolete##brk ^1754 1669$@1@s1,g26@6@0@1@g26$@0#confstr ^1755 1672@6@5@1@0@0@0@g26@6@0,s1@1@g26,s1@18@0@0#crypt ^1756 1684$@0@g26@6@0@1@p0,g26$@0#encrypt ^1757 1704$@0@g26@6@0,s3@1@g26,s3$@0#fdatasync ^1758 1717$$$@0@W:legacy#getdtablesize is obsolete##getdtablesize ^1759 1727$@1@s1@0@$@0#gethostid ^1760 1732$$$@0#getlogin_r *3 (Variable) ^1761 23|@1|6@0@0@0@1#optarg ^1762 5|@1|6@0@0@0@1#optind#opterr#optopt *4 (Function) ^1765 1951$@1@g1762@6@0,g1763@6@0,g1764@6@0,g26@6@0@1@g1762,g1763,g1764,g26,g1761$@0#getopt ^1766 1736$$$@0@W:legacy#getpagesize is obsolete##getpagesize ^1767 1739@6@5@1@0@0$@18@0@0@W:legacy#getpass is obsolete##getpass ^1768 1741$@1@g26@6@0,s1@1@g26$@0#getpgid ^1769 1749$@1@g26@6@0,s1@1@g26$@0#getsid ^1770 1754@6@5@1@0@0@0@@1@p0$@0#getwd ^1771 1762$@0@g26@6@0,s3@1@g26,s3$@0#lockf ^1772 1766$@0@g26@6@0,s3@1@g26,s3$@0#nice ^1773 1774$@0@g26@6@0,s3@1@g26,s3$@0#pread ^1774 1788$@0@g26@6@0,s3@1@g26,s3$@0#pthread_atfork ^1775 1790$@0@g26@6@0,s3@1@g26,s3$@0#pwrite ^1776 1792$@0@g26@6@0,s3@1@g26,s3,tp1$@0#readlink ^1777 1795$@0@g26@6@0@1@g26@3@0@0@W:legacy#sbrk is obsolete##sbrk ^1778 1797$@0@s1@1@s1$@0#setpgrp ^1779 1809$$$@0#swab ^1780 1826$$$@0#ttyname_r ^1781 1828$@0@s3@1@s3$@0#ualarm ^1782 1893$@0@s3,g26@6@0@1@s3,g26$@0#usleep ^1783 1836$@0@s1,g26@6@0@1@s1,g26$@0@W:superuser#Only super-user processes may call chroot.##chroot ^1784 1838$$$@0@W:superuser#Only super-user processes may call fchroot.##fchroot ^1785 1840$^$@0#isascii ^1786 1842$^$@0#toascii ^1787 1844$^$@0#_toupper ^1788 1846$^$@0#_tolower ^1789 2013$@0@s1@1@s1$@0#drand48 ^1790 1852$@0@s1@1@s1$@0#erand48 ^1791 2108$@0@s1@1@s1$@0#srand48 *0 (Datatype) ^1792 14@-@-@0@0@0@0@1855#in_port_t ^1793 14@-@-@0@0@0@0@1856#in_addr_t *7 (Struct tag) ^1794 1857@1858#@in_addr ^1795 1861@1862#@sockaddr_in *1 (Constant) ^1796 5$#IPPROTO_IP#IPPROTO_ICMP#IPPROTO_TCP#IPPROTO_UDP ^1800 1856$#INADDR_ANY#INADDR_BROADCAST *4 (Function) ^1802 1864$^$@0#htonl ^1803 1866$^$@0#htons ^1804 1868$^$@0#ntohl ^1805 1870$^$@0#ntohs ^1806 1879$@0@@1@tp2$@0#readdir_r ^1807 1883$$$@0#seekdir ^1808 1885$$$@0#telldir ^1809 1888$@0@@1@tp0$@0#stpcpy ^1810 1891$@0@@1@tp0$@0#stpncpy ^1811 1896$$@5@0@0#inet_ntoa ^1812 1900$@0@g26@6@0@1@g26$@0#j0 ^1813 1902$@0@g26@6@0@1@g26$@0#j1 ^1814 1904$@0@g26@6@0@1@g26$@0#jn ^1815 1906$@0@g26@6@0@1@g26$@0#y0 ^1816 1908$@0@g26@6@0@1@g26$@0#y1 ^1817 1910$@0@g26@6@0@1@g26$@0#yn *1 (Constant) ^1818 23$#P_tmpdir *4 (Function) ^1819 1937$@0@s3@1@p0,s3$@0#flockfile ^1820 1939$@0@g26@6@0@1@p0,g26$@0#fseeko ^1821 1941$@0@g26@6@0@1@g26$@0#ftello ^1822 1943$@0@s3,g26@6@0@1@p0,s3,g26$@0#ftrylockfile ^1823 1945$@0@s3@1@p0,s3$@0#funlockfile ^1824 1947$@0@s3,g26@6@0@1@tp0,s3,g26$@0@W:multithreaded#getc_unlocked is a thread unsafe version of getc##getc_unlocked ^1825 1949$@1@g21@6@0,s3@1@tg21,s3$@0@W:multithreaded#getchar_unlocked is a thread unsafe version of getchar##getchar_unlocked *3 (Variable) ^1826 5|@1|6@0@0@0@1#optreset *4 (Function) ^1827 1953$@0@s3,g26@6@0@1@s3,tp0,g26$@0@W:legacy#.##getw ^1828 1955$@0@s3,g26@6@0@1@s3,tp0,g26$@0#pclose ^1829 1958@6@5@1@0@0@0@s3,g26@6@0@1@s3,g26@18@0@0#popen ^1830 1960$@0@s3,g26@6@0@1@s3,tp1,g26$@0@W:multithreaded#putc_unlocked is a thread unsafe version of putc##putc_unlocked ^1831 1962$@0@s3,g22@6@0,g26@6@0@1@s3,tg22,g26$@0@W:multithreaded#putchar_unlocked is a thread unsafe version of putchar##putchar_unlocked ^1832 1964$@0@s3,g22@6@0,g26@6@0@1@s3,tg22,g26$@0@W:legacy#.##putw ^1833 1973@6@5@1@0@0@0@s1,g26@6@0@1@s1,g26@3@0@0@W:toctou#Between the time a pathname is created and the file is opened, it is possible for some other process to create a file with the same name. Use tmpfile instead.##tempnam ^1834 1981$$$@0#a64l *7 (Struct tag) ^1835 2008@2009#@!8 *4 (Function) ^1836 2016$$@3@0@0#ecvt ^1837 2019$$@3@0@0#fcvt ^1838 2022$$@3@0@0#gcvt ^1839 2027$@0@@1@p0,p2$@0#getsubopt ^1840 2029$@0@s3,g26@6@0@1@s3,g26$@0#grantpt ^1841 2032$@0@s1@1@s1,p1@3@0@0#initstate ^1842 2036$@0@s1@1@s1$@0#jrand48 ^1843 2039$$@3@0@0#l64a ^1844 2045$@0@s1@1@s1$@0#lcong48 *7 (Struct tag) ^1845 2046@2047#@!9 *4 (Function) ^1846 2051$@0@s1@1@s1$@0#lrand48 ^1847 2063$@0@@1@p0@3@0@0#mktemp ^1848 2065$@0@s3@1@p0,s3$@0#mkstemp ^1849 2067$@0@s1@1@s1$@0#mrand48 ^1850 2071$@0@s1@1@s1,p0$@0#nrand48 ^1851 2074$$@18@0@0#ptsname ^1852 2076$@1@g802@6@0,g26@6@0@1@tg802,g26$@0#putenv ^1853 2086$@0@@1@p0$@0#rand_r ^1854 2088$@0@s1@1@s1$@0#random ^1855 2094$$@3@0@0#realpath ^1856 2099$@0@s1@1@s1@3@0@0#seed48 ^1857 2101$@0@s1,g26@6@0@1@s1,g26$@0#setkey ^1858 2104$@0@s1,g26@6@0@1@s1,g26@2@0@0#setstate ^1859 2110$@0@s1@1@s1$@0#srandom ^1860 2120$^$@0#ttyslot ^1861 2122$@0@s3,s1@1@s3,s1$@0#unlockpt ^1862 2125$@0@g26@6@0@1@g26@3@0@0#valloc ;; Library constraints start_Buffer_Constraints setvbuf pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 3 e2 2 3 -1 ;; end precondition constraints post:EMPTY snprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY vsnprintf pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY fgets pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 0 C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 5 1 e2 2 3 -1 ;; end precondition constraints fread pre:EMPTY post: C 0@1@4 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints fwrite pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY fgetpos pre: C 0@1@3 l 1 1 2 2 Param 435 1 r 2 3 0 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 435 1 r 2 3 0 ;; end precondition constraints calloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints malloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints realloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints bsearch pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY qsort pre: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY mblen pre: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints post:EMPTY mbtowc pre: C 0@1@3 l 1 3 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY mbstowcs pre: C 0@1@3 l 1 1 2 2 Param 529 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY wcstombs pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memcpy pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY memmove pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 C 0@1@3 l 1 3 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY strcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@4 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints strncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints strcat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 3 2 2 Result r 0 1 e1 1 3 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 ;; end precondition constraints strncat pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 23 0 r 0 1 e1 1 3 2 2 Param 23 0 e2 2 2 Param 64 2 ;; end precondition constraints strchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strrchr pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints strstr pre:EMPTY post: C 0@1@3 l 1 1 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 1 3 2 2 Param 23 1 C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@1 l 1 3 2 2 Result r 1 3 2 2 Param 23 0 C 0@1@1 l 1 1 2 2 Result r 1 1 2 2 Param 23 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints memset pre: C 0@1@3 l 1 1 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints strlen pre:EMPTY post: C 0@1@4 l 2 2 Result r 1 3 2 2 Param 23 0 ;; end precondition constraints asctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints ctime pre:EMPTY post: C 0@1@4 l 1 3 2 2 Result r 2 3 25 C 0@1@4 l 1 1 2 2 Result r 2 3 25 ;; end precondition constraints getpwnam pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getpwuid pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Result r 2 3 0 ;; end precondition constraints getcwd pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 2 2 Param 64 1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 1 e2 2 3 -1 ;; end precondition constraints getgroups pre: C 0@1@3 l 1 1 2 2 Param 1072 1 r 2 2 Param 5 0 ;; end precondition constraints post:EMPTY pipe pre: C 0@1@4 l 1 3 2 2 Param 43 0 r 2 3 1 ;; end precondition constraints post:EMPTY read pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints write pre: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regexec pre: C 0@1@3 l 1 1 2 2 Param 1138 3 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY regerror pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 64 3 ;; end precondition constraints post:EMPTY getservbyname_r pre: C 0@1@3 l 1 1 2 2 Param 23 3 r 2 2 Param 5 4 ;; end precondition constraints post:EMPTY getservbyport_r pre: C 0@1@3 l 1 1 2 2 Param 23 3 r 2 2 Param 5 4 ;; end precondition constraints post:EMPTY gethostbyname_r pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 5 3 ;; end precondition constraints post:EMPTY gethostbyaddr pre: C 0@1@4 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY gethostbyaddr_r pre: C 0@1@3 l 1 1 2 2 Param 23 4 r 2 2 Param 5 5 C 0@1@4 l 1 3 2 2 Param 20 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY gethostent_r pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 2 2 Param 5 2 ;; end precondition constraints post:EMPTY encrypt pre: C 0@1@4 l 1 1 2 2 Param 42 0 r 2 3 63 ;; end precondition constraints post:EMPTY getlogin_r pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 2 2 Param 64 1 ;; end precondition constraints post:EMPTY getopt pre: C 0@1@3 l 1 3 2 2 Param 461 1 r 0 1 e1 2 2 Param 5 0 e2 2 3 -1 ;; end precondition constraints post:EMPTY pread pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints pwrite pre: C 0@1@3 l 1 3 2 2 Param 20 1 r 2 2 Param 64 2 ;; end precondition constraints post:EMPTY readlink pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY swab pre: C 0@1@3 l 1 1 2 2 Param 20 1 r 0 1 e1 2 2 Param 65 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY ttyname_r pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY stpcpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints post: C 0@1@4 l 1 1 2 2 Result r 0 2 e1 1 1 2 2 Param 23 0 e2 1 3 2 2 Param 23 1 C 0@1@4 l 1 3 2 2 Result r 2 3 0 C 0@1@4 l 1 3 2 2 Param 23 0 r 1 3 2 2 Param 23 1 ;; end precondition constraints stpncpy pre: C 0@1@3 l 1 1 2 2 Param 23 0 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post: C 0@1@1 l 1 3 2 2 Param 23 0 r 2 2 Param 64 2 C 0@1@3 l 1 3 2 2 Param 23 1 r 1 3 2 2 Param 23 0 ;; end precondition constraints inet_ntoa pre:EMPTY post: C 0@1@1 l 1 3 2 2 Result r 2 3 15 C 0@1@1 l 1 1 2 2 Result r 2 3 15 ;; end precondition constraints tempnam pre:EMPTY post: C 0@1@3 l 1 3 2 2 Result r 2 3 0 C 0@1@3 l 1 1 2 2 Result r 2 3 0 ;; end precondition constraints gcvt pre: C 0@1@3 l 1 1 2 2 Param 23 2 r 2 2 Param 5 1 ;; end precondition constraints post:EMPTY initstate pre: C 0@1@3 l 1 1 2 2 Param 23 1 r 0 1 e1 2 2 Param 64 2 e2 2 3 -1 ;; end precondition constraints post:EMPTY jrand48 pre: C 0@1@3 l 1 1 2 2 Param 2034 0 r 2 3 2 ;; end precondition constraints post:EMPTY l64a pre:EMPTY post: C 0@1@1 l 1 1 2 2 Result r 2 3 5 C 0@1@1 l 1 3 2 2 Result r 2 3 5 ;; end precondition constraints lcong48 pre: C 0@1@3 l 1 3 2 2 Param 2043 0 r 2 3 6 ;; end precondition constraints post:EMPTY nrand48 pre: C 0@1@3 l 1 3 2 2 Param 2069 0 r 2 3 2 C 0@1@3 l 1 1 2 2 Param 2069 0 r 2 3 2 ;; end precondition constraints post:EMPTY seed48 pre: C 0@1@3 l 1 3 2 2 Param 2096 0 r 2 3 2 ;; end precondition constraints post:EMPTY setkey pre: C 0@1@3 l 1 3 2 2 Param 23 0 r 2 3 63 ;; end precondition constraints post:EMPTY valloc pre:EMPTY post: C 0@1@4 l 1 1 2 2 Result r 0 1 e1 2 2 Param 64 0 e2 2 3 -1 ;; end precondition constraints ;; Modules access _Bool#1@ types#1@ standard#9@ posix#18@ unix#20@ ;;End splint-3.1.2.dfsg1/lib/CTrait.syms0000644021234200000250000000525207121317316014321 0ustar faxtrue: -> Bool false: -> Bool \not __: Bool -> Bool __ \and __: Bool, Bool -> Bool __ \or __: Bool, Bool -> Bool __ \implies __: Bool, Bool -> Bool __ \eq __: Bool, Bool -> Bool __ \eq __: Int, Int -> Bool __ \eq __: double, double -> Bool __ \eq __: float, float -> Bool __ \eq __: _char_Vec, _char_Vec -> Bool __ \eq __: char, char -> Bool __ \neq __: Bool, Bool -> Bool __ \neq __: Int, Int -> Bool __ \neq __: double, double -> Bool __ \neq __: float, float -> Bool __ \neq __: _char_Vec, _char_Vec -> Bool __ \neq __: char, char -> Bool if __ then __ else __: Bool, Bool, Bool -> Bool if __ then __ else __: Bool, Int, Int -> Int if __ then __ else __: Bool, double, double -> double if __ then __ else __: Bool, float, float -> float if __ then __ else __: Bool, _char_Vec, _char_Vec -> _char_Vec if __ then __ else __: Bool, char, char -> char __ |- __: _char_Vec, char -> _char_Vec __ -| __: char, _char_Vec -> _char_Vec __ \leq __: Int, Int -> Bool __ \leq __: double, double -> Bool __ \leq __: float, float -> Bool __ \geq __: Int, Int -> Bool __ \geq __: double, double -> Bool __ \geq __: float, float -> Bool succ: Int -> Int pred: Int -> Int - __: Int -> Int __ - __: Int, Int -> Int - __: double -> double __ - __: double, double -> double - __: float -> float __ - __: float, float -> float __ + __: Int, Int -> Int __ + __: double, double -> double __ + __: float, float -> float __ * __: Int, Int -> Int __ * __: double, double -> double __ * __: float, float -> float __ < __: Int, Int -> Bool __ < __: double, double -> Bool __ < __: float, float -> Bool __ > __: Int, Int -> Bool __ > __: double, double -> Bool __ > __: float, float -> Bool abs: Int -> Int abs: double -> double abs: float -> float div: Int, Int -> Int mod: Int, Int -> Int min: Int, Int -> Int max: Int, Int -> Int 0: -> Int 0: -> double 0: -> float 1: -> Int 1: -> double 1: -> float __ \inv: double -> double __ \inv: float -> float __ / __: double, double -> double __ / __: float, float -> float empty: -> _char_Vec __ || __: _char_Vec, _char_Vec -> _char_Vec __ \in __: char, _char_Vec -> Bool count: char, _char_Vec -> Int head: _char_Vec -> char init: _char_Vec -> _char_Vec isEmpty: _char_Vec -> Bool last: _char_Vec -> char len: _char_Vec -> Int prefix: _char_Vec, Int -> _char_Vec removePrefix: _char_Vec, Int -> _char_Vec substring: _char_Vec, Int, Int -> _char_Vec tail: _char_Vec -> _char_Vec null: -> char nullTerminated: _char_Vec -> Bool throughNull: _char_Vec -> _char_Vec sameStr: _char_Vec, _char_Vec -> Bool lenStr: _char_Vec -> Int times10plus: Int, Int -> Int plus1: Int -> Int 2: -> Int 3: -> Int 4: -> Int 5: -> Int 6: -> Int 7: -> Int 8: -> Int 9: -> Int __ [ __ ]: _char_Vec, Int -> char { __ }: char -> _char_Vec splint-3.1.2.dfsg1/lib/CTraitGen.lcl0000644021234200000250000000004407121317316014524 0ustar faxincludes CTrait (char [] for String)splint-3.1.2.dfsg1/lib/bool.h0000644021234200000250000000143707536414700013330 0ustar fax#ifndef BOOL_H #define BOOL_H #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE (!FALSE) #endif /* bool is a keyword in C++ */ /*@-cppnames@*/ typedef int bool; /*@=cppnames@*/ /* ** bool_initMod has no real effect ** Declared with modifies internalState, so no warnings about no effects are ** reported when it is called. */ extern /*@unused@*/ void bool_initMod (void) /*@modifies internalState@*/ ; /*@-mustmod@*/ # define bool_initMod() /*@=mustmod@*/ extern /*@unused@*/ /*@observer@*/ char *bool_unparse (bool) /*@*/ ; # define bool_unparse(b) ((b) ? "true" : "false" ) extern /*@unused@*/ bool bool_not (bool) /*@*/ ; # define bool_not(b) ((b) ? FALSE : TRUE) extern /*@unused@*/ bool bool_equal (bool, bool) /*@*/ ; # define bool_equal(a,b) ((a) ? (b) : !(b)) # endif splint-3.1.2.dfsg1/lib/file.mts0000644021234200000250000000066207337777655013713 0ustar faxattribute openness context reference FILE * oneof closed, open, anyopen annotations open ==> open closed ==> closed anyopen ==> anyopen merge open + closed ==> error transfers open as closed ==> error closed as open ==> error losereference open ==> error "open file not closed" defaults reference ==> open parameter ==> open result ==> open end splint-3.1.2.dfsg1/lib/file.xh0000644021234200000250000000175207337777655013530 0ustar faxextern int fclose (/*@open@*/ FILE *stream) /*:checkerror EOF@*/ /* The fclose function returns zero if the stream was successfully closed or EOF if any errors were detected. */ /*@ensures closed stream@*/ ; /*@open@*/ FILE *fopen (const char *filename, const char *mode); /*@open@*/ FILE *fdopen (int fildes, const char *mode); /* ** File modes: ** "rb" read ** "wb" create, truncate, write ** "ab" create, write, append ** "rb+" read, write ** "wb+" create, truncate, read, write ** "ab+" create, read, write, append */ extern /*@open@*/ FILE *freopen (char *filename, char *mode, /*@anyopen@*/ FILE *stream) /*@ensures open stream@*/ ; extern /*@null@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, /*@open@*/ FILE *stream) /*@modifies fileSystem, *s, *stream, errno@*/ ; /* fgetc fputc fseek ftell */ int ferror (FILE *stream) ; int feof (FILE *stream) ; void clearerr (FILE *stream) ; splint-3.1.2.dfsg1/lib/filerw.mts0000644021234200000250000000142007325160576014236 0ustar faxattribute filerw context reference FILE * oneof rw_none, rw_read, rw_write, rw_either annotations read ==> rw_read write ==> rw_write rweither ==> rw_either rwnone ==> rw_none merge rw_read + rw_write ==> rw_none rw_none + * ==> rw_none rw_either + rw_read ==> rw_read rw_either + rw_write ==> rw_write rw_either + rw_none ==> rw_none transfers rw_read as rw_write ==> error "Must reset file between read and write." rw_write as rw_read ==> error "Must reset file between write and read." rw_none as rw_read ==> error "File in unreadable state." rw_none as rw_write ==> error "File in unwritable state." rw_either as rw_write ==> rw_write rw_either as rw_read ==> rw_read end splint-3.1.2.dfsg1/lib/filerw.xh0000644021234200000250000000047507321147764014063 0ustar faxextern /*@rweither@*/ FILE *fopen (const char *filename, const char *mode) ; extern int fgetc (/*@read@*/ FILE *f) ; extern int fputc (int, /*@write@*/ FILE *f) ; /* fseek resets the rw state of a stream */ int fseek (/*@rweither@*/ FILE *stream, long int offset, int whence) /*@ensures rweither stream@*/ ; splint-3.1.2.dfsg1/lib/lclinit.lci0000644021234200000250000000141207121317316014337 0ustar fax\comment Standard Larch C Interface Language (LCL) init file commentSym // opChar ~!#$&?@| openSym \< \langle closeSym \> \rangle selectSym . simpleId \bot \top synonym int Int synonym double float synonym \and /\ synonym \or \/ synonym \implies => synonym \marker __ synonym = == synonym \neq != synonym \not ! synonym \not not synonym \not ~ synonym \pre ^ synonym \post ' synonym \arrow -> synonym \arrow \ra synonym |- \postcat synonym -| \pretcat synonym |- \vdash synonym -| \dashv synonym \leq <= synonym \geq >= synonym \cap \I synonym \cup \U synonym \diamond \rel synonym \sqcap \lub synonym \sqcup \glb splint-3.1.2.dfsg1/lib/linux.h0000644021234200000250000002040007362163523013524 0ustar fax/* ** linux.h */ /* ** Based on Linux Standard Base Specification 1.0.0 ** http://www.linuxbase.org/spec/gLSB/gLSB/libc-ddefs.html */ /* Data Definitions for libc dirent.h */ typedef struct __dirstream DIR; /* Not in LSB: based on RedHat 7.0: */ struct dirent { #ifndef __USE_FILE_OFFSET64 __ino_t d_ino; __off_t d_off; #else __ino64_t d_ino; __off64_t d_off; #endif unsigned short int d_reclen; unsigned char d_type; char d_name[256]; /* We must not include limits.h! */ } ; /*@i43 struct dirent not in LSB spec why doesn't alphasort64 use struct dirent64's? */ int acct (/*@null@*/ const char *filename) /*:statusreturn@*/ /*@modifies systemState@*/ ; int alphasort (const struct dirent **a, const struct dirent **b) /*@*/ ; int alphasort64(const struct dirent **a, const struct dirent **b) /*@*/ ; /* ftw.h */ typedef int (*__ftw_func_t) (char *__filename, struct stat * __status, int __flag); typedef int (*__ftw64_func_t) (char *__filename, struct stat64 * __status, int __flag); typedef int (*__nftw_func_t) (char *__filename, struct stat * __status, int __flag, struct FTW * __info); typedef int (*__nftw64_func_t) (char *__filename, struct stat64 * __status, int __flag, struct FTW * __info); /* glob.h */ typedef struct { __size_t gl_pathc; char **gl_pathv; __size_t gl_offs; int gl_flags; void (*gl_closedir) (); struct dirent64 *(*gl_readdir) (); void *(*gl_opendir) (); int (*gl_lstat) (); int (*gl_stat) (); } glob_t; typedef struct { __size_t gl_pathc; char **gl_pathv; __size_t gl_offs; int gl_flags; void (*gl_closedir) (); struct dirent64 *(*gl_readdir) (); void *(*gl_opendir) (); int (*gl_lstat) (); int (*gl_stat) (); } glob64_t; /* grp.h */ struct group { char *gr_name; char *gr_passwd; __gid_t gr_gid; char **gr_mem; } ; /* iconv.h */ typedef void *iconv_t; /* inttypes.h */ typedef lldiv_t imaxdiv_t; typedef long long intmax_t; typedef unsigned long long uintmax_t; /* locale.h */ struct lconv { char *decimal_point; char *thousands_sep; char *grouping; char *int_curr_symbol; char *currency_symbol; char *mon_decimal_point; char *mon_thousands_sep; char *mon_grouping; char *positive_sign; char *negative_sign; char int_frac_digits; char frac_digits; char p_cs_precedes; char p_sep_by_space; char n_cs_precedes; char n_sep_by_space; char p_sign_posn; char n_sign_posn; } ; /* nl_types.h */ typedef void *nl_catd; typedef int nl_item; /* pwd.h */ struct passwd { char *pw_name; char *pw_passwd; __uid_t pw_uid; __gid_t pw_gid; char *pw_gecos; char *pw_dir; char *pw_shell; } ; /* regex.h */ typedef unsigned long reg_syntax_t; typedef struct re_pattern_buffer { unsigned char *buffer; unsigned long allocated; unsigned long used; reg_syntax_t syntax; char *fastmap; char *translate; size_t re_nsub; unsigned int can_be_null; unsigned int regs_allocated; unsigned int fastmap_accurate; unsigned int no_sub; unsigned int not_bol; unsigned int not_eol; unsigned int newline_anchor; } regex_t; typedef int regoff_t; typedef struct { regoff_t rm_so; regoff_t rm_eo; } regmatch_t; /* search.h */ typedef enum { FIND, ENTER } ACTION; typedef enum { preorder, postorder, endorder, leaf } VISIT; typedef struct entry { char *key; void *data; } ENTRY; typedef void (*__action_fn_t) (void *__nodep, VISIT __value, int __level); /* setjmp.h */ typedef int __jmp_buf; typedef struct __jmp_buf_tag { __jmp_buf __jmpbuf; int __mask_was_saved; __sigset_t __saved_mask; } jmp_buf; typedef jmp_buf sigjmp_buf; /* signal.h */ typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; typedef void (*__sighandler_t) (); struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; } ; typedef struct { unsigned long __val[1]; } __sigset_t; typedef __sigset_t sigset_t; struct sigaction; typedef struct { int si_band; int si_fd; struct _sifields; struct _sigpoll; } siginfo_t; struct sigaltstack { void *ss_sp; int ss_flags; size_t ss_size; } ; struct sigstack { void *ss_sp; int ss_onstack; } ; /* stdio.h */ typedef struct _IO_FILE FILE; typedef __off_t fpos_t; typedef __off64_t fpos64_t; /* stdlib.h */ typedef struct { long long quot; long long rem; } lldiv_t; typedef struct { int quot; int rem; } div_t; typedef struct { long quot; long rem; } ldiv_t; typedef int (*__compar_fn_t) (); /* sys/sem.h */ struct sembuf { short sem_num; short sem_op; short sem_flg; } ; /* sys/socket.h */ typedef unsigned short sa_family_t; typedef unsigned int socklen_t; struct sockaddr { sa_family_t sa_family; char sa_data[1]; } ; struct msghdr { void *msg_name; socklen_t msg_namelen; struct iovec *msg_iov; size_t msg_iovlen; void *msg_control; size_t msg_controllen; int msg_flags; } ; /* sys/times.h */ struct tms { clock_t tms_utime; clock_t tms_stime; clock_t tms_cutime; clock_t tms_cstime; } ; /* sys/utsname.h */ struct utsname { char sysname[1]; char nodename[1]; char release[1]; char version[1]; char machine[1]; char __domainname[1]; } ; /* sys/wait.h */ typedef enum { P_ALL, P_PID, P_PGID } idtype_t; /* time.h */ typedef long __clock_t; struct timespec { long tv_sec; long tv_nsec; } ; struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long __tm_gmtoff; char *__tm_zone; } ; typedef __clock_t clock_t; typedef __time_t time_t; int adjtime (/*@notnull@*/ const struct timeval *delta, /*@null@*/ struct timeval *olddelta) /*@warn superuser "Only super-user processes may call adjtime."@*/ /*:statusreturn@*/ /*@modifies systemState@*/ ; /* unistd.h */ typedef __ssize_t ssize_t; typedef __pid_t pid_t; typedef __off_t off_t; extern /*@observer@*/ /*@nullterminated@*/ /*@null@*/ char *bindtextdomain (/*@null@*/ /*@nullterminated@*/ const char *domainname, /*@null@*/ /*@nullterminated@*/ const char *dirname) /*@*/ ; /* LSB doesn't specify: taken from http://www.hgmp.mrc.ac.uk/cgi-bin/man.cgi?section=3C&topic=bindtextdomain */ /* utime.h */ struct utimbuf { __time_t actime; __time_t modtime; } ; /* wchar.h */ typedef long wchar_t; typedef unsigned int wint_t; typedef struct { int count; wint_t value; } mbstate_t; /* wctype.h */ typedef unsigned long wctype_t; typedef __int32_t *wctrans_t; /* wordexp.h */ typedef struct { int we_wordc; char **we_wordv; int we_offs; } wordexp_t; /* timex.h */ struct timex { int modes; /* mode selector */ long offset; /* time offset (usec) */ long freq; /* frequency offset (scaled ppm) */ long maxerror; /* maximum error (usec) */ long esterror; /* estimated error (usec) */ int status; /* clock command/status */ long constant; /* pll time constant */ long precision; /* clock precision (usec) (read only) */ long tolerance; /* clock frequency tolerance (ppm) (read only) */ struct timeval time; /* current time (read only) */ long tick; /* usecs between clock ticks */ }; /*@constant int ADJ_OFFSET@*/ /*@constant int ADJ_FREQUENCY@*/ /*@constant int ADJ_MAXERROR@*/ /*@constant int ADJ_ESTERROR@*/ /*@constant int ADJ_STATUS@*/ /*@constant int ADJ_TIMECONST@*/ /*@constant int ADJ_TICK@*/ /*@constant int ADJ_OFFSET_SINGLESHOT@*/ int adjtimex (/*@notnull@*/ struct timex *buf) /*@warn superuser "Only super-user processes may call adjtimex unless the modes field is 0."@*/ /*:statusreturn@*/ /*@modifies systemState@*/ ; /* termios.h */ typedef unsigned char cc_t; typedef unsigned int speed_t; typedef unsigned int tcflag_t; struct termios { tcflag_t c_iflag; /* input mode flags */ tcflag_t c_oflag; /* output mode flags */ tcflag_t c_cflag; /* control mode flags */ tcflag_t c_lflag; /* local mode flags */ cc_t c_cc[NCCS]; /* control characters */ }; int cfmakeraw (/*@out@*/ struct termios *termios_p) /*:statusreturn@*/ ; int cfsetspeed(struct termios *t, speedt speed) /*:statusreturn@*/ ; /* ** Built in */ /*@exits@*/ void __assert_fail (/*@notnull@*/ const char *assertion, /*@notnull@*/ const char *file, unsigned int line, /*@null@*/ const char *function) /*@modifies stderr@*/; splint-3.1.2.dfsg1/lib/lslinit.lsi0000644021234200000250000000160507121317316014403 0ustar fax\comment Standard Larch Shared Language (LSL) init file commentSym % idChar ' opChar ~!#$&?@| singleChar ; \comment for versions of lsl before 3.1, add [ and ] to the \comment openSym and closeSym lists: openSym { \< \langle closeSym } \> \rangle selectSym . simpleId \bot \top synonym \and /\ synonym \or \/ synonym \implies => synonym \not not synonym \not ~ synonym \eq = synonym \neq ~= synonym \arrow -> synonym \marker __ synonym \equals == synonym \forall forall synonym \eqsep ; synonym |- \postcat synonym -| \pretcat synonym |- \vdash synonym -| \dashv synonym \leq <= synonym \geq >= synonym \cap \I synonym \cup \U synonym \diamond \rel synonym \sqcap \lub synonym \sqcup \glb synonym Bool bool synonym Int intsplint-3.1.2.dfsg1/lib/tainted.mts0000644021234200000250000000070507362163523014377 0ustar faxattribute taintedness context reference char * oneof untainted, tainted annotations tainted reference ==> tainted untainted reference ==> untainted anytainted parameter ==> tainted transfers tainted as untainted ==> error "Possibly tainted storage used as untainted." merge tainted + untainted ==> tainted defaults reference ==> tainted literal ==> untainted null ==> untainted end splint-3.1.2.dfsg1/lib/tainted.xh0000644021234200000250000000436007447671264014226 0ustar fax/* ** tainted.xh */ /* Library functions annotated for tainted.mts */ extern int printf (/*@untainted@*/ char *format, ...) ; extern int fprintf (FILE *stream, /*@untainted@*/ char *format, ...) ; extern int sprintf (/*@out@*/ char *s, /*@untainted@*/ char *format, ...) /*@ensures s:taintedness = ...:taintedness@*/ ; extern int snprintf (/*@out@*/ char *s, size_t n, /*@untainted@*/ const char *format, ...) /*@ensures s:taintedness = ...:taintedness@*/ ; extern int vprintf (/*@untainted@*/ const char *format, va_list ap); extern int vfprintf(FILE *stream, /*@untainted@*/ const char *format, va_list ap); extern int vsprintf (/*@out@*/ char *str, /*@untainted@*/ const char *format, va_list ap) /*@ensures tainted str@*/ ; extern int vsnprintf (/*@out@*/ char *str, size_t size, /*@untainted@*/ const char *format, va_list ap) /*@ensures tainted str@*/ ; # if 0 extern int vfwprintf (FILE *stream, /*@untainted@*/ const wchar_t *format, va_list arg); extern int vswprintf (wchar_t *s, size_t n, /*@untainted@*/ const wchar_t *format, va_list arg); extern int vwprintf (/*@untainted@*/ const wchar_t *format, va_list arg); # endif # if 0 extern int remove (/*@untainted@*/ char *filename) /*@modifies fileSystem, errno@*/ ; extern int rename (/*@untainted@*/ char *old, /*@untainted@*/ char *new) ; extern /*@observer@*/ char *tmpnam (/*@untainted@*/ char *s) ; extern FILE *fopen (/*@untainted@*/ char *filename, char *mode) ; extern /*@null@*/ FILE *freopen (/*@untainted@*/ char *filename, char *mode, FILE *stream) ; # endif extern /*@null@*/ /*@tainted@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, FILE *stream) /*@ensures tainted s@*/ /*@modifies *s@*/ ; extern int system (/*@untainted@*/ /*@null@*/ char *s) /*@modifies fileSystem@*/ ; extern void /*@printflike@*/ syslog (int priority, /*@untainted@*/ const char *message, ...) /*@modifies fileSystem@*/ ; extern char *strcpy (/*@returned@*/ /*@anytainted@*/ char *s1, /*@anytainted@*/ char *s2) /*@ensures s1:taintedness = s2:taintedness@*/ ; extern char *strcat (/*@returned@*/ /*@anytainted@*/ char *s1, /*@anytainted@*/ char *s2) /*@ensures s1:taintedness = s1:taintedness | s2:taintedness@*/ /*@ensures result:taintedness = s1:taintedness | s2:taintedness@*/ ; splint-3.1.2.dfsg1/lib/stdio.h0000644021234200000250000001175607650577031013530 0ustar fax/* ** stdio.h - Unix Specification */ /* ** evans 2001-12-30: added from http://www.opengroup.org/onlinepubs/007908799/xsh/stdio.h.html */ /*@constant unsignedintegraltype BUFSIZ@*/ /*@constant unsignedintegraltype FILENAME_MAX@*/ /*@constant unsignedintegraltype FOPEN_MAX@*/ /*@constant _Bool _IOFBF@*/ /*@constant _Bool _IOLBF@*/ /*@constant _Bool _IONBF@*/ /*@constant unsignedintegraltype L_ctermid@*/ /*@constant unsignedintegraltype L_cuserid@*/ /*@constant unsignedintegraltype L_tmpnam@*/ /*@constant unsignedintegraltype SEEK_CUR@*/ /*@constant unsignedintegraltype SEEK_END@*/ /*@constant unsignedintegraltype SEEK_SET@*/ /*@constant unsignedintegraltype TMP_MAX@*/ /*@constant observer char *P_tmpdir@*/ void clearerr (FILE *stream) /*@modifies *stream@*/ ; /*@dependent@*/ char *ctermid (/*@returned@*/ /*@null@*/ char *) /*@*/ ; /* Result may be static pointer if parameter is NULL, otherwise is fresh. */ // *@requires maxSet(s) >= ( L_ctermid - 1) @*/ *ensures maxRead(s) <= ( L_ctermid - 1) /\ maxRead(s) >= 0 */ /*DRL 9-11-2001 I've modified the definition in ansi.h to remove modifies SystemState and I've added a requires and ensures*/ ; /*check returns*/ /* cuserid is in the 1988 version of POSIX but removed in 1990 */ char *cuserid (/*@null@*/ /*@out@*/ /*@returned@*/ char *s) /*@warn legacy "cuserid is obsolete"@*/ /*@modifies *s@*/ // *@requires maxSet(s) >= ( L_ctermid - 1) @*/ *@ensures maxRead(s) <= ( L_ctermid - 1) /\ maxRead(s) >= 0 /\ maxRead(result) <= ( L_ctermid - 1) /\ maxRead(result) >= 0 @*/ ; /* in standard.h: int fclose (FILE *stream) @modifies *stream, errno, fileSystem;@ */ /*@null@*/ /*@dependent@*/ FILE *fdopen (int fd, const char *type) /*@modifies errno, fileSystem@*/; /* feof, ferror fflush, fgetc, fgetpos, fgets - in standard.h */ int fileno (/*@notnull@*/ FILE *) /*:errorcode -1:*/ /*@modifies errno@*/ ; void flockfile (/*@notnull@*/ FILE *f) /*@modifies f, fileSystem@*/ ; /* fopen, fprintf, fputc, fread, frepoen, fscanf, etc. in standard.h */ int fseeko (FILE *stream, off_t offset, int whence) /*:errorcode -1:*/ /*@modifies stream, errno@*/ ; off_t ftello(FILE *stream) /*:errorcode -1:*/ /*@modifies errno*/ ; int ftrylockfile(FILE *stream) /*:errorcode !0:*/ /*@modifies stream, fileSystem, errno*/ ; void funlockfile (FILE *stream) /*@modifies stream, fileSystem*/ ; int getc_unlocked(FILE *stream) /*@warn multithreaded "getc_unlocked is a thread unsafe version of getc"@*/ /*@modifies *stream, fileSystem, errno@*/ ; int getchar_unlocked (void) /*@warn multithreaded "getchar_unlocked is a thread unsafe version of getchar"@*/ /*@globals stdin@*/ /*@modifies *stdin, fileSystem@*/ ; /*@unchecked@*/ char *optarg; /*@unchecked@*/ int optind; /*@unchecked@*/ int optopt; /*@unchecked@*/ int opterr; /*@unchecked@*/ int optreset; int getopt (int argc, char * const *argv, const char *optstring) /*@warn legacy@*/ /*@globals optarg, optind, optopt, opterr, optreset@*/ /*@modifies optarg, optind, optopt@*/ /*@requires maxRead(argv) >= (argc - 1) @*/ ; int getw (FILE *stream) /*@warn legacy@*/ /*:errorcode EOF:*/ /*@modifies fileSystem, *stream, errno@*/ ; int pclose(FILE *stream) /*:errorcode -1:*/ /*@modifies fileSystem, *stream, errno@*/ ; /*@dependent@*/ /*@null@*/ FILE *popen (const char *command, const char *mode) /*:errorcode NULL:*/ /*@modifies fileSystem, errno@*/ ; int putc_unlocked (int, FILE *stream) /*@warn multithreaded "putc_unlocked is a thread unsafe version of putc"@*/ /*:errorcode EOF:*/ /*@modifies fileSystem, *stream, errno@*/ ; int putchar_unlocked(int) /*@warn multithreaded "putchar_unlocked is a thread unsafe version of putchar"@*/ /*:errorcode EOF:*/ /*@modifies fileSystem, *stdout, errno@*/ ; int putw(int, FILE *stream) /*@warn legacy@*/ /*:errorcode EOF:*/ /*@modifies fileSystem, *stdout, errno@*/ ; int remove (char *filename) /*@modifies fileSystem, errno@*/ ; int rename (char *old, char *new) /*@modifies fileSystem, errno@*/ ; void rewind (FILE *stream) /*@modifies *stream, fileSystem, errno@*/ ; /* evans 2002-07-09: snprintf moved to standard.h (its in ISO C99 now) */ /*@null@*/ char *tempnam (char *dir, /*@null@*/ char *pfx) /*@modifies internalState, errno@*/ /*@ensures maxSet(result) >= 0 /\ maxRead(result) >= 0 @*/ /*@warn toctou "Between the time a pathname is created and the file is opened, it is possible for some other process to create a file with the same name. Use tmpfile instead."*/ /*drl added errno 09-19-001 */ ; /*@null@*/ FILE *tmpfile (void) /*@modifies fileSystem, errno@*/ /*drl added errno 09-19-001 */ ; /*@observer@*/ char *tmpnam (/*@out@*/ /*@null@*/ /*@returned@*/ char *s) /*@modifies *s, internalState @*/ // *@requires maxSet(s) >= (L_tmpnam - 1) @* /*@warn toctou "Between the time a pathname is created and the file is opened, another process may create a file with the same name. Use tmpfile instead."*/ ; splint-3.1.2.dfsg1/lib/stdlib.h0000644021234200000250000001577407416213766013675 0ustar fax/*@constant int EXIT_FAILURE; @*/ /*@constant int EXIT_SUCCESS; @*/ /*@constant null anytype NULL = 0;@*/ /*@constant int RAND_MAX; @*/ /*@constant size_t MB_CUR_MAX; @*/ // div_t Structure type returned by div() function. // ldiv_t // Structure type returned by ldiv() function. long a64l(const char *s) ; /*@exits@*/ void abort (void) /*@*/ ; extern int abs (int n) /*@*/ ; int atexit(void (*func)(void)); extern double atof (char *s) /*@*/ ; extern int atoi (char *s) /*@*/ ; extern long int atol (char *s) /*@*/ ; void * bsearch (const void *key, const void *base, size_t nel, size_t size, int (*compar)(const void *, const void *)) /*@*/ /*@requires maxSet(base) >= (nel - 1) @*/ ; extern /*@null@*/ /*@only@*/ void *calloc (size_t nobj, size_t size) /*@*/ /*@ensures MaxSet(result) == (nobj - 1); @*/ ; /* This is defined in ansi.h We include it here for reference drl 1/4/2002 */ /*@-redef@*/ typedef /*@concrete@*/ struct { int quot; int rem; } div_t ; /*@=redef@*/ extern div_t div (int num, int denom) /*@*/ ; double drand48 (void) /*@modifies internalState@*/ ; char *ecvt(double value, int ndigit, /*@out@*/ int *decpt, /*@out@*/ int *sign) ; char *fcvt(double value, int ndigit, /*@out@*/ int *decpt, /*@out@*/int *sign); char *gcvt(double value, int ndigit, char *buf) /*@requires maxSet(buf) >= ndigit @*/ ; extern /*@observer@*/ /*@null@*/ char *getenv (const char *name) /*@*/ ; extern int getsubopt(char **optionp, char * const *tokens, /*@out@*/ char **valuep) /*@modifies optionp, valuep @*/ ; extern int grantpt(int fildes) /*@modifies fileSystem, errno @*/ ; char *initstate(unsigned int seed, char *state, size_t size) /*@modifies internalState, state @*/ /*@requires maxSet(state) >= (size - 1) @*/ /*drl added 09-20-001*/ ; /*drl 1/4/2002: specifying the array sizes is meaningless but we include them to be consistent with the unix specification at opengroup.org */ /*@-fixedformalarray@*/ long int jrand48 (unsigned short int xsubi[3]) /*@modifies internalState@*/ /*@requires maxSet(xsubi) >= 2 @*/ ; char *l64a(long value) /*@ensures maxRead(result) <= 5 /\ maxSet(result) <= 5 @*/ ; extern long int labs (long int n) /*@*/ ; /*@-fixedformalarray@*/ extern void lcong48 (unsigned short int param[7]) /*@modifies internalState@*/ /*@requires maxRead(param) >= 6 @*/ ; /*@=fixedformalarray@*/ /* This is already defined in ansi.h We include it here for reference but comment it out to avoid a warning drl 1/4/2002 */ /*@-redef@*/ typedef /*@concrete@*/ struct { long int quot; long int rem; } ldiv_t ; /*@=redef@*/ extern ldiv_t ldiv (long num, long denom) /*@*/ ; long int lrand48 (void) /*@modifies internalState@*/ ; extern /*@null@*/ /*@out@*/ /*@only@*/ void *malloc (size_t size) /*@modifies errno@*/ /*drl 09-20-001 added errno*/ /*@ensures MaxSet(result) == (size - 1); @*/ ; extern int mblen (char *s, size_t n) /*@modifies errno@*/ /*@requires maxRead(s) >= (n - 1) @*/ /*drl 09-20-001 added errno*/ ; size_t mbstowcs(/*@null@*/ /*@out@*/ wchar_t *pwcs, const char *s, size_t n) /*@requires maxSet(pwcs) >= (n - 1) @*/ /*drl 09-20-001 added errno*/ ; extern int mbtowc (/*@null@*/ /*@out@*/ wchar_t *pwc, /*@null@*/ char *s, size_t n) /*@modifies *pwc, errno@*/ /*@requires maxRead(s) >= (n - 1) @*/ /*drl 09-20-001 added errno*/; extern char *mktemp(char *template) /*@modifies template @*/ /*drl added 09-20-001*/ /*warn use mkstemp */ ; int mkstemp(char *template) /*@modifies template, fileSystem @*/ /*drl added 09-20-001*/ ; long int mrand48 (void) /*@modifies internalState@*/ ; /*drl 1/4/2002: specifying the array size is meaningless but we include it to be consistent with the unix specification at opengroup.org */ /*@-fixedformalarray@*/ long int nrand48 (unsigned short int xsubi[3]) /*@modifies internalState, xsubi @*/ /*@requires maxSet(xsubi) >= 2 /\ maxRead(xsubi) >= 2 @*/ ; /*@=fixedformalarray@*/ extern /*@dependent@*/ /*check dependent */ char *ptsname(int fildes) /*drl added 09-20-01*/ ; extern int putenv (/*@kept@*/ const char *string) /*@globals environ@*/ /*@modifies *environ, errno@*/ /*drl 09-20-01 added kept */ ; extern void qsort (void *base, size_t nel, size_t size, int (*compar)(const void *, const void *) ) /*@requires maxRead(base) >= (nel - 1) @*/ /*@modifies *base, errno@*/ ; /*@constant int RAND_MAX; @*/ extern int rand (void) /*@modifies internalState@*/ ; extern int rand_r(unsigned int *seed) /*@modifies seed@*/ /*drl 09-20-01 added*/ ; long random(void) /*@modifies internalState@*/ ; extern /*@null@*/ /*@only@*/ void * realloc (/*@null@*/ /*@only@*/ /*@out@*/ /*@returned@*/ void *p, size_t size) /*@modifies *p, errno @*/ /*@ensures MaxSet(result) == (size - 1) @*/; extern char *realpath(const char *file_name, /*@out@*/ char *resolved_name) // *@requires maxSet(resolved_name) >= (PATH_MAX - 1) @*/ ; /*drl 1/4/2002: specifying the array sizes is meaningless but we include them to be consistent with the unix specification at opengroup.org */ /*@-fixedformalarray@*/ unsigned short int *seed48 (unsigned short int seed16v[3]) /*@modifies internalState@*/ /*@requires maxRead(seed16v) >= 2 @*/ ; /*@=fixedformalarray@*/ void setkey(const char *key) /*@requires maxRead(key) >= 63 @*/ /*@modifies internalState, errno@*/ ; /*@only@*/ char *setstate(/*@kept@*/ const char *state) /*@modifies internalState, errno@*/ ; extern void srand (unsigned int seed) /*@modifies internalState@*/ ; extern void srand48 (long int seedval) /*@modifies internalState@*/ ; extern void srandom(unsigned int seed) /*@modifies internalState@*/ /*drl added 09-20-001 */ ; extern double strtod (const char *s, /*@null@*/ /*@out@*/ char **endp) /*@modifies *endp, errno@*/ ; extern long strtol (char *s, /*@null@*/ /*@out@*/ char **endp, int base) /*@modifies *endp, errno@*/ ; extern unsigned long strtoul (char *s, /*@null@*/ /*@out@*/ char **endp, int base) /*@modifies *endp, errno@*/ ; extern int system (/*@null@*/ const char *s) /*@modifies fileSystem, errno@*/ /*drl 09-20-01 added errno */ ; extern int ttyslot(void) /*@*/ /*drl added 09-20-001 */ /*legacy*/ ; extern int unlockpt(int fildes) /*@modifies fileSystem, internalState @*/ /*drl added 09-20-001 */ ; extern void *valloc(size_t size)/*@modifies errno@*/ /*drl 09-20-001 */ /*@ensures MaxSet(result) == (size - 1); @*/ /*legacy*/ ; extern size_t wcstombs (/*@out@*/ char *s, wchar_t *pwcs, size_t n) /*@modifies *s, errno@*/ /*@requires maxSet(s) >= (n - 1) @*/ ; extern int wctomb (/*@out@*/ /*@null@*/ char *s, wchar_t wchar) /*@modifies *s@*/ ; splint-3.1.2.dfsg1/imports/0000755021234200000250000000000010645776250013154 5ustar faxsplint-3.1.2.dfsg1/imports/Makefile.am0000644021234200000250000000116107362163523015202 0ustar fax## Note: starting comments with ## means they don't end up in Makefile AUTOMAKE_OPTIONS = 1.5 foreign ## Put these files in $prefix/share/lclint/imports importsdir = $(pkgdatadir)/imports ## List of files imports_DATA = \ assert.lcl assert.lcs ctype.lcl ctype.lcs errno.lcl errno.lcs \ limits.lcl limits.lcs locale.lcl locale.lcs math.lcl math.lcs \ setjmp.lcl setjmp.lcs signal.lcl signal.lcs stdarg.lcl stdarg.lcs \ stdio.lcl stdio.lcs stdlib.lcl stdlib.lcs string.lcl string.lcs \ strings.lcl strings.lcs time.lcl time.lcs ## Include them in the distribution EXTRA_DIST = $(imports_DATA) splint-3.1.2.dfsg1/imports/Makefile.in0000644021234200000250000001520410645765162015223 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.5 foreign importsdir = $(pkgdatadir)/imports imports_DATA = \ assert.lcl assert.lcs ctype.lcl ctype.lcs errno.lcl errno.lcs \ limits.lcl limits.lcs locale.lcl locale.lcs math.lcl math.lcs \ setjmp.lcl setjmp.lcs signal.lcl signal.lcs stdarg.lcl stdarg.lcs \ stdio.lcl stdio.lcs stdlib.lcl stdlib.lcs string.lcl string.lcs \ strings.lcl strings.lcs time.lcl time.lcs EXTRA_DIST = $(imports_DATA) subdir = imports mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DATA = $(imports_DATA) DIST_COMMON = Makefile.am Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign imports/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: importsDATA_INSTALL = $(INSTALL_DATA) install-importsDATA: $(imports_DATA) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(importsdir) @list='$(imports_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " $(importsDATA_INSTALL) $$d$$p $(DESTDIR)$(importsdir)/$$f"; \ $(importsDATA_INSTALL) $$d$$p $(DESTDIR)$(importsdir)/$$f; \ done uninstall-importsDATA: @$(NORMAL_UNINSTALL) @list='$(imports_DATA)'; for p in $$list; do \ f="`echo $$p | sed -e 's|^.*/||'`"; \ echo " rm -f $(DESTDIR)$(importsdir)/$$f"; \ rm -f $(DESTDIR)$(importsdir)/$$f; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: $(mkinstalldirs) $(DESTDIR)$(importsdir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-importsDATA install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-importsDATA uninstall-info-am .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-importsDATA install-info \ install-info-am install-man install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ uninstall uninstall-am uninstall-importsDATA uninstall-info-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/imports/assert.lcl0000644021234200000250000000006307121317316015135 0ustar fax/* ** assert.h */ void assert() { ensures true; } splint-3.1.2.dfsg1/imports/assert.lcs0000644021234200000250000001005007121317316015141 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLSortTableEnd %LCLSymbolTable %LCLop mod :int, int -> int %LCLop min :int, int -> int %LCLop max :int, int -> int %LCLop 0 : -> int %LCLop 0 : -> double %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop count :char, _char_Vec -> int %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop init :_char_Vec -> _char_Vec %LCLop isEmpty :_char_Vec -> bool %LCLop last :_char_Vec -> char %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop lenStr :_char_Vec -> int %LCLop times10plus :int, int -> int %LCLop plus1 :int -> int %LCLop 2 : -> int %LCLop 3 : -> int %LCLop 4 : -> int %LCLop 5 : -> int %LCLop 6 : -> int %LCLop 7 : -> int %LCLop 8 : -> int %LCLop 9 : -> int %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop null : -> char %LCLop NIL : -> __char_Obj_Ptr %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop succ :int -> int %LCLop pred :int -> int %LCLop abs :int -> int %LCLop abs :double -> double %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLfcn assert : -> void %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/ctype.lcl0000644021234200000250000000165007121317316014763 0ustar fax/* ** ctype.h */ | int : bool | isalnum (| int : char | c ) { ensures true; } | int : bool | isalpha (| int : char | c ) { ensures true; } | int : bool | isascii (| int : char | c ) { ensures true; } | int : bool | iscntrl (| int : char | c ) { ensures true; } | int : bool | isdigit (| int : char | c ) { ensures true; } | int : bool | isgraph (| int : char | c ) { ensures true; } | int : bool | islower (| int : char | c ) { ensures true; } | int : bool | isprint (| int : char | c ) { ensures true; } | int : bool | ispunct (| int : char | c ) { ensures true; } | int : bool | isspace (| int : char | c ) { ensures true; } | int : bool | isupper (| int : char | c ) { ensures true; } | int : bool | isxdigit (| int : char | c ) { ensures true; } | int : char | toascii (| int : char | c ) { ensures true; } | int : char | tolower (| int : char | c ) { ensures true; } | int : char | toupper (| int : char | c ) { ensures true; } splint-3.1.2.dfsg1/imports/ctype.lcs0000644021234200000250000001126007121317316014770 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLSortTableEnd %LCLSymbolTable %LCLop mod :int, int -> int %LCLop min :int, int -> int %LCLop max :int, int -> int %LCLop 0 : -> int %LCLop 0 : -> double %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop count :char, _char_Vec -> int %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop init :_char_Vec -> _char_Vec %LCLop isEmpty :_char_Vec -> bool %LCLop last :_char_Vec -> char %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop lenStr :_char_Vec -> int %LCLop times10plus :int, int -> int %LCLop plus1 :int -> int %LCLop 2 : -> int %LCLop 3 : -> int %LCLop 4 : -> int %LCLop 5 : -> int %LCLop 6 : -> int %LCLop 7 : -> int %LCLop 8 : -> int %LCLop 9 : -> int %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop null : -> char %LCLop NIL : -> __char_Obj_Ptr %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop succ :int -> int %LCLop pred :int -> int %LCLop abs :int -> int %LCLop abs :double -> double %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLfcn isalnum : int -> int %LCLfcnGlobals %LCLfcn isalpha : int -> int %LCLfcnGlobals %LCLfcn isascii : int -> int %LCLfcnGlobals %LCLfcn iscntrl : int -> int %LCLfcnGlobals %LCLfcn isdigit : int -> int %LCLfcnGlobals %LCLfcn isgraph : int -> int %LCLfcnGlobals %LCLfcn islower : int -> int %LCLfcnGlobals %LCLfcn isprint : int -> int %LCLfcnGlobals %LCLfcn ispunct : int -> int %LCLfcnGlobals %LCLfcn isspace : int -> int %LCLfcnGlobals %LCLfcn isupper : int -> int %LCLfcnGlobals %LCLfcn isxdigit : int -> int %LCLfcnGlobals %LCLfcn toascii : int -> int %LCLfcnGlobals %LCLfcn tolower : int -> int %LCLfcnGlobals %LCLfcn toupper : int -> int %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/errno.lcl0000644021234200000250000000206507121317316014765 0ustar fax/* ** errno.h */ enum { EPERM, ENOENT, ESRCH, EINTR, EIO, ENXIO, E2BIG ,ENOEXEC,EBADF, ECHILD, EAGAIN, ENOMEM, EACCES, EFAULT, ENOTBLK,EBUSY, EEXIST, EXDEV, ENODEV, ENOTDIR,EISDIR, EINVAL, ENFILE, EMFILE, ENOTTY, ETXTBSY, EFBIG, ENOSPC, ESPIPE, EROFS, EMLINK, EPIPE, EDOM, ERANGE, EWOULDBLOCK, EINPROGRESS, EALREADY, ENOTSOCK, EDESTADDRREQ, EMSGSIZE, EPROTOTYPE, ENOPROTOOPT, EPROTONOSUPPORT, ESOCKTNOSUPPORT, EOPNOTSUPP, EPFNOSUPPORT, EAFNOSUPPORT, EADDRINUSE, EADDRNOTAVAIL, ENETDOWN, ENETUNREACH, ENETRESET, ECONNABORTED, ECONNRESET, ENOBUFS, EISCONN, ENOTCONN, ESHUTDOWN, ETOOMANYREFS, ETIMEDOUT, ECONNREFUSED, ELOOP , ENAMETOOLONG, EHOSTDOWN, EHOSTUNREACH, ENOTEMPTY, EPROCLIM, EUSERS, EDQUOT, ESTALE, EREMOTE, ENOMSG, EIDRM, EALIGN, EDEADLK, ENOLCK, ENOSYS, EACTIVE, ENOACTIVE, ENORESOURCES, ENOSYSTEM, ENODUST, EDUPNOCONN, EDUPNODISCONN, EDUPNOTCNTD, EDUPNOTIDLE, EDUPNOTWAIT, EDUPNOTRUN, EDUPBADOPCODE, EDUPINTRANSIT, EDUPTOOMANYCPUS } _errorcodes ; int errno ;splint-3.1.2.dfsg1/imports/errno.lcs0000644021234200000250000003357707121317316015010 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLSortTableEnd %LCLSymbolTable %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop lenStr :_char_Vec -> int %LCLop times10plus :int, int -> int %LCLop plus1 :int -> int %LCLop 2 : -> int %LCLop 3 : -> int %LCLop 4 : -> int %LCLop 5 : -> int %LCLop 6 : -> int %LCLop 7 : -> int %LCLop 8 : -> int %LCLop 9 : -> int %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop EIO : -> _eerrno0e_Enum %LCLop ENXIO : -> _eerrno0e_Enum %LCLop E2BIG : -> _eerrno0e_Enum %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLop EBADF : -> _eerrno0e_Enum %LCLop ECHILD : -> _eerrno0e_Enum %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop ENOMEM : -> _eerrno0e_Enum %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop EMFILE : -> _eerrno0e_Enum %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop EFBIG : -> _eerrno0e_Enum %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop EPIPE : -> _eerrno0e_Enum %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop ELOOP : -> _eerrno0e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop EUSERS : -> _eerrno0e_Enum %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLenumConst EPERM _eerrno0e_Enum %LCLenumConst ENOENT _eerrno0e_Enum %LCLenumConst ESRCH _eerrno0e_Enum %LCLenumConst EINTR _eerrno0e_Enum %LCLenumConst EIO _eerrno0e_Enum %LCLenumConst ENXIO _eerrno0e_Enum %LCLenumConst E2BIG _eerrno0e_Enum %LCLenumConst ENOEXEC _eerrno0e_Enum %LCLenumConst EBADF _eerrno0e_Enum %LCLenumConst ECHILD _eerrno0e_Enum %LCLenumConst EAGAIN _eerrno0e_Enum %LCLenumConst ENOMEM _eerrno0e_Enum %LCLenumConst EACCES _eerrno0e_Enum %LCLenumConst EFAULT _eerrno0e_Enum %LCLenumConst ENOTBLK _eerrno0e_Enum %LCLenumConst EBUSY _eerrno0e_Enum %LCLenumConst EEXIST _eerrno0e_Enum %LCLenumConst EXDEV _eerrno0e_Enum %LCLenumConst ENODEV _eerrno0e_Enum %LCLenumConst ENOTDIR _eerrno0e_Enum %LCLenumConst EISDIR _eerrno0e_Enum %LCLenumConst EINVAL _eerrno0e_Enum %LCLenumConst ENFILE _eerrno0e_Enum %LCLenumConst EMFILE _eerrno0e_Enum %LCLenumConst ENOTTY _eerrno0e_Enum %LCLenumConst ETXTBSY _eerrno0e_Enum %LCLenumConst EFBIG _eerrno0e_Enum %LCLenumConst ENOSPC _eerrno0e_Enum %LCLenumConst ESPIPE _eerrno0e_Enum %LCLenumConst EROFS _eerrno0e_Enum %LCLenumConst EMLINK _eerrno0e_Enum %LCLenumConst EPIPE _eerrno0e_Enum %LCLenumConst EDOM _eerrno0e_Enum %LCLenumConst ERANGE _eerrno0e_Enum %LCLenumConst EWOULDBLOCK _eerrno0e_Enum %LCLenumConst EINPROGRESS _eerrno0e_Enum %LCLenumConst EALREADY _eerrno0e_Enum %LCLenumConst ENOTSOCK _eerrno0e_Enum %LCLenumConst EDESTADDRREQ _eerrno0e_Enum %LCLenumConst EMSGSIZE _eerrno0e_Enum %LCLenumConst EPROTOTYPE _eerrno0e_Enum %LCLenumConst ENOPROTOOPT _eerrno0e_Enum %LCLenumConst EPROTONOSUPPORT _eerrno0e_Enum %LCLenumConst ESOCKTNOSUPPORT _eerrno0e_Enum %LCLenumConst EOPNOTSUPP _eerrno0e_Enum %LCLenumConst EPFNOSUPPORT _eerrno0e_Enum %LCLenumConst EAFNOSUPPORT _eerrno0e_Enum %LCLenumConst EADDRINUSE _eerrno0e_Enum %LCLenumConst EADDRNOTAVAIL _eerrno0e_Enum %LCLenumConst ENETDOWN _eerrno0e_Enum %LCLenumConst ENETUNREACH _eerrno0e_Enum %LCLenumConst ENETRESET _eerrno0e_Enum %LCLenumConst ECONNABORTED _eerrno0e_Enum %LCLenumConst ECONNRESET _eerrno0e_Enum %LCLenumConst ENOBUFS _eerrno0e_Enum %LCLenumConst EISCONN _eerrno0e_Enum %LCLenumConst ENOTCONN _eerrno0e_Enum %LCLenumConst ESHUTDOWN _eerrno0e_Enum %LCLenumConst ETOOMANYREFS _eerrno0e_Enum %LCLenumConst ETIMEDOUT _eerrno0e_Enum %LCLenumConst ECONNREFUSED _eerrno0e_Enum %LCLenumConst ELOOP _eerrno0e_Enum %LCLenumConst ENAMETOOLONG _eerrno0e_Enum %LCLenumConst EHOSTDOWN _eerrno0e_Enum %LCLenumConst EHOSTUNREACH _eerrno0e_Enum %LCLenumConst ENOTEMPTY _eerrno0e_Enum %LCLenumConst EPROCLIM _eerrno0e_Enum %LCLenumConst EUSERS _eerrno0e_Enum %LCLenumConst EDQUOT _eerrno0e_Enum %LCLenumConst ESTALE _eerrno0e_Enum %LCLenumConst EREMOTE _eerrno0e_Enum %LCLenumConst ENOMSG _eerrno0e_Enum %LCLenumConst EIDRM _eerrno0e_Enum %LCLenumConst EALIGN _eerrno0e_Enum %LCLenumConst EDEADLK _eerrno0e_Enum %LCLenumConst ENOLCK _eerrno0e_Enum %LCLenumConst ENOSYS _eerrno0e_Enum %LCLenumConst EACTIVE _eerrno0e_Enum %LCLenumConst ENOACTIVE _eerrno0e_Enum %LCLenumConst ENORESOURCES _eerrno0e_Enum %LCLenumConst ENOSYSTEM _eerrno0e_Enum %LCLenumConst ENODUST _eerrno0e_Enum %LCLenumConst EDUPNOCONN _eerrno0e_Enum %LCLenumConst EDUPNODISCONN _eerrno0e_Enum %LCLenumConst EDUPNOTCNTD _eerrno0e_Enum %LCLenumConst EDUPNOTIDLE _eerrno0e_Enum %LCLenumConst EDUPNOTWAIT _eerrno0e_Enum %LCLenumConst EDUPNOTRUN _eerrno0e_Enum %LCLenumConst EDUPBADOPCODE _eerrno0e_Enum %LCLenumConst EDUPINTRANSIT _eerrno0e_Enum %LCLenumConst EDUPTOOMANYCPUS _eerrno0e_Enum %LCLvar _errorcodes __eerrno0e_Enum_Obj %LCLvar errno _int_Obj %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/limits.lcl0000644021234200000250000000372407121317316015144 0ustar fax/* ** limits.h */ constant int FLT_RADIX; constant int FLT_ROUNDS; constant int FLT_MANT_DIG; constant int DBL_MANT_DIG; constant int LDBL_MANT_DIG; constant float FLT_EPSILON; constant double DBL_EPSILON; constant double LDBL_EPSILON; constant int FLT_DIG; constant int DBL_DIG; constant int LDBL_DIG; constant int FLT_MIN_EXP; constant int DBL_MIN_EXP; constant int LDBL_MIN_EXP; constant float FLT_MIN; constant double DBL_MIN; constant double LDBL_MIN; constant int FLT_MIN_10_EXP; constant int DBL_MIN_10_EXP; constant int LDBL_MIN_10_EXP; constant int FLT_MAX_EXP; constant int DBL_MAX_EXP; constant int LDBL_MAX_EXP; constant float FLT_MAX; constant double DBL_MAX; constant double LDBL_MAX; constant int FLT_MAX_10_EXP; constant int DBL_MAX_10_EXP; constant int LDBL_MAX_10_EXP; constant int ARG_MAX; constant int CHAR_BIT; constant int CHAR_MIN; constant int CHAR_MAX; constant int UCHAR_MAX; constant int SCHAR_MIN; constant int SCHAR_MAX; constant int CHILD_MAX; constant int FCHR_MAX; constant double HUGE_VAL; constant int LOCK_MAX; constant int LINK_MAX; constant int SHRT_MIN; constant int SHRT_MAX; constant int USHRT_MAX; constant int INT_MIN; constant int INT_MAX; constant int UINT_MAX; constant int LONG_MIN; constant int LONG_MAX; constant int ULONG_MAX; constant int USI_MAX; constant int WORD_BIT; constant int LONG_BIT; constant int NAME_MAX; constant int NGROUPS_MAX; constant int MAX_INPUT; constant int MAX_CANON; constant int MAX_CHAR; constant int OPEN_MAX; constant int PASS_MAX; constant int PATH_MAX; constant int PID_MAX; constant int SYSPID_MAX; constant int PIPE_BUF; constant int PIPE_MAX; constant int PROC_MAX; constant int STD_BLK; constant int SYS_NMLN; constant int SYS_OPEN; constant int TMP_MAX; constant int NZERO; constant int UID_MAX; constant int MB_LEN_MAX; constant int NL_ARGMAX; constant int NL_MSGMAX; constant int NL_NMAX; constant int NL_SETMAX; constant int NL_TEXTMAX; constant int NL_LBLMAX; constant int NL_LANGMAX; splint-3.1.2.dfsg1/imports/limits.lcs0000644021234200000250000003053207121317316015150 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLSortTableEnd %LCLSymbolTable %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop lenStr :_char_Vec -> int %LCLop times10plus :int, int -> int %LCLop plus1 :int -> int %LCLop 2 : -> int %LCLop 3 : -> int %LCLop 4 : -> int %LCLop 5 : -> int %LCLop 6 : -> int %LCLop 7 : -> int %LCLop 8 : -> int %LCLop 9 : -> int %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop EIO : -> _eerrno0e_Enum %LCLop ENXIO : -> _eerrno0e_Enum %LCLop E2BIG : -> _eerrno0e_Enum %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLop EBADF : -> _eerrno0e_Enum %LCLop ECHILD : -> _eerrno0e_Enum %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop ENOMEM : -> _eerrno0e_Enum %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop EMFILE : -> _eerrno0e_Enum %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop EFBIG : -> _eerrno0e_Enum %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop EPIPE : -> _eerrno0e_Enum %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop ELOOP : -> _eerrno0e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop EUSERS : -> _eerrno0e_Enum %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLconst FLT_RADIX int %LCLconst FLT_ROUNDS int %LCLconst FLT_MANT_DIG int %LCLconst DBL_MANT_DIG int %LCLconst LDBL_MANT_DIG int %LCLconst FLT_EPSILON double %LCLconst DBL_EPSILON double %LCLconst LDBL_EPSILON double %LCLconst FLT_DIG int %LCLconst DBL_DIG int %LCLconst LDBL_DIG int %LCLconst FLT_MIN_EXP int %LCLconst DBL_MIN_EXP int %LCLconst LDBL_MIN_EXP int %LCLconst FLT_MIN double %LCLconst DBL_MIN double %LCLconst LDBL_MIN double %LCLconst FLT_MIN_10_EXP int %LCLconst DBL_MIN_10_EXP int %LCLconst LDBL_MIN_10_EXP int %LCLconst FLT_MAX_EXP int %LCLconst DBL_MAX_EXP int %LCLconst LDBL_MAX_EXP int %LCLconst FLT_MAX double %LCLconst DBL_MAX double %LCLconst LDBL_MAX double %LCLconst FLT_MAX_10_EXP int %LCLconst DBL_MAX_10_EXP int %LCLconst LDBL_MAX_10_EXP int %LCLconst ARG_MAX int %LCLconst CHAR_BIT int %LCLconst CHAR_MIN int %LCLconst CHAR_MAX int %LCLconst UCHAR_MAX int %LCLconst SCHAR_MIN int %LCLconst SCHAR_MAX int %LCLconst CHILD_MAX int %LCLconst FCHR_MAX int %LCLconst HUGE_VAL double %LCLconst LOCK_MAX int %LCLconst LINK_MAX int %LCLconst SHRT_MIN int %LCLconst SHRT_MAX int %LCLconst USHRT_MAX int %LCLconst INT_MIN int %LCLconst INT_MAX int %LCLconst UINT_MAX int %LCLconst LONG_MIN int %LCLconst LONG_MAX int %LCLconst ULONG_MAX int %LCLconst USI_MAX int %LCLconst WORD_BIT int %LCLconst LONG_BIT int %LCLconst NAME_MAX int %LCLconst NGROUPS_MAX int %LCLconst MAX_INPUT int %LCLconst MAX_CANON int %LCLconst MAX_CHAR int %LCLconst OPEN_MAX int %LCLconst PASS_MAX int %LCLconst PATH_MAX int %LCLconst PID_MAX int %LCLconst SYSPID_MAX int %LCLconst PIPE_BUF int %LCLconst PIPE_MAX int %LCLconst PROC_MAX int %LCLconst STD_BLK int %LCLconst SYS_NMLN int %LCLconst SYS_OPEN int %LCLconst TMP_MAX int %LCLconst NZERO int %LCLconst UID_MAX int %LCLconst MB_LEN_MAX int %LCLconst NL_ARGMAX int %LCLconst NL_MSGMAX int %LCLconst NL_NMAX int %LCLconst NL_SETMAX int %LCLconst NL_TEXTMAX int %LCLconst NL_LBLMAX int %LCLconst NL_LANGMAX int %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/locale.lcl0000644021234200000250000000140407121317316015073 0ustar fax/* ** locale.h */ constant int LC_ALL; constant int LC_COLLATE; constant int LC_CTYPE; constant int LC_NUMERIC; constant int LC_TIME; constant int LC_MONETARY; /* lcl can't handle just struct lconv... */ typedef struct lconv { char *decimal_point ; char *thousands_sep ; char *grouping ; char *int_curr_symbol ; char *currency_symbol ; char *mon_decimal_point ; char *mon_thousands_sep ; char *mon_grouping ; char *positive_sign ; char *negative_sign ; char int_frac_digits ; char frac_digits ; char p_cs_precedes ; char p_sep_by_space ; char n_cs_precedes ; char n_sep_by_space ; char p_sign_posn ; char n_sign_posn ; } __lconv ; struct lconv *localeconv(void) { ensures true; } char *etlocale(int __category, char *__locale ) { ensures true; } splint-3.1.2.dfsg1/imports/locale.lcs0000644021234200000250000004102707121317316015107 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLSortTableEnd %LCLSymbolTable %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop EIO : -> _eerrno0e_Enum %LCLop ENXIO : -> _eerrno0e_Enum %LCLop E2BIG : -> _eerrno0e_Enum %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLop EBADF : -> _eerrno0e_Enum %LCLop ECHILD : -> _eerrno0e_Enum %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop ENOMEM : -> _eerrno0e_Enum %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop EMFILE : -> _eerrno0e_Enum %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop EFBIG : -> _eerrno0e_Enum %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop EPIPE : -> _eerrno0e_Enum %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLtag lconv struct %LCLop ELOOP : -> _eerrno0e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop EUSERS : -> _eerrno0e_Enum %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLconst LC_ALL int %LCLconst LC_COLLATE int %LCLconst LC_CTYPE int %LCLconst LC_NUMERIC int %LCLconst LC_TIME int %LCLconst LC_MONETARY int %LCLtype __lconv ___lconv exposed %LCLfcn localeconv : -> __lconv_Struct_Ptr %LCLfcnGlobals %LCLfcn etlocale : int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/math.lcl0000644021234200000250000000472007121317316014571 0ustar fax/* ** math.h */ int errno, signgam; typedef struct exception { int ttype ; /* should be type */ char *name ; double arg1 ; double arg2 ; double retval ; } __exception ; double acos(double __x ) { ensures true; } double acosh(double __x ) { ensures true; } double asin(double __x ) { ensures true; } double asinh(double __x ) { ensures true; } double atan(double __x ) { ensures true; } double atanh(double __x) { ensures true; } double atan2(double __x,double __y ) { ensures true; } double cbrt(double __x ) { ensures true; } double ceil(double __x ) { ensures true; } double cos(double __x ) { ensures true; } double cosh(double __x ) { ensures true; } double exp(double __x ) { ensures true; } double fabs(double __x ) { ensures true; } double floor(double __x ) { ensures true; } double fmod(double __x,double __y ) { ensures true; } double frexp(double __value, int *__eptr ) { ensures true; } double ldexp(double __value, int __exp ) { ensures true; } double log(double __x ) { ensures true; } double log10(double __x ) { ensures true; } double modf(double __value,double *__iptr) { ensures true; } double pow(double __x,double __y ) { ensures true; } double rint(double __x ) { ensures true; } double sin(double __x ) { ensures true; } double sinh(double __x ) { ensures true; } double sqrt(double __x ) { ensures true; } double tan(double __x ) { ensures true; } double tanh(double __x ) { ensures true; } double trunc(double __x ) { ensures true; } double j0(double __x ) { ensures true; } double j1(double __x ) { ensures true; } double jn( int __n,double __x ) { ensures true; } double y0(double __x ) { ensures true; } double y1(double __x ) { ensures true; } double yn( int __n,double __x ) { ensures true; } double erf(double __x ) { ensures true; } double erfc(double __x ) { ensures true; } double gamma(double __x ) { ensures true; } double lgamma(double __x ) { ensures true; } double hypot(double __x,double __y ) { ensures true; } | int : bool | isnan() { ensures true; } int matherr(struct exception *__x) { ensures true; } constant double M_E; constant double M_LOG2E; constant double M_LOG10E; constant double M_LN2; constant double M_LN10; constant double M_PI ; constant double M_PI_2 ; constant double M_PI_4 ; constant double M_1_PI ; constant double M_2_PI ; constant double M_2_SQRTPI ; constant double M_SQRT2 ; constant double M_SQRT1_2 ; constant double MAXFLOAT; constant double HUGE; enum { DOMAIN, SING, OVERFLOW, UNDERFLOW, TLOSS, PLOSS } _matherrors; splint-3.1.2.dfsg1/imports/math.lcs0000644021234200000250000005565607121317316014616 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLsort _exception_Struct str exception nil %LCLsort retval strMem _double_Obj nil %LCLsort arg2 strMem _double_Obj nil %LCLsort arg1 strMem _double_Obj nil %LCLsort name strMem ___char_Obj_Ptr_Obj nil %LCLsort ttype strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _double_Obj obj double nil %LCLsort _exception_Struct_Tuple tup _exception_Struct nil %LCLsort __exception_Struct_Ptr ptr _exception_Struct nil %LCLsort __exception_Struct_Arr arr _exception_Struct nil %LCLsort __exception_Struct_Tuple_Vec vec _exception_Struct_Tuple __exception_Struct_Arr %LCLsort ___exception synonym _exception_Struct nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort __double_Obj_Ptr ptr _double_Obj nil %LCLsort __double_Obj_Arr arr _double_Obj nil %LCLsort _double_Vec vec double __double_Obj_Arr %LCLsort _emath1e_Enum enum emath1e nil %LCLsort PLOSS enumMem nil nil %LCLsort TLOSS enumMem nil nil %LCLsort UNDERFLOW enumMem nil nil %LCLsort OVERFLOW enumMem nil nil %LCLsort SING enumMem nil nil %LCLsort DOMAIN enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __emath1e_Enum_Obj obj _emath1e_Enum nil %LCLSortTableEnd %LCLSymbolTable %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLtag exception struct %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop __ \select ttype :_exception_Struct_Tuple -> int %LCLop __ \select ttype :_exception_Struct -> _int_Obj %LCLop EIO : -> _eerrno0e_Enum %LCLop __ \select name :_exception_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select name :_exception_Struct -> ___char_Obj_Ptr_Obj %LCLop ENXIO : -> _eerrno0e_Enum %LCLop __ \field_arrow ttype :__exception_Struct_Ptr -> _int_Obj %LCLop __ \select arg1 :_exception_Struct_Tuple -> double %LCLop __ \select arg1 :_exception_Struct -> _double_Obj %LCLop E2BIG : -> _eerrno0e_Enum %LCLop __ \field_arrow name :__exception_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select arg2 :_exception_Struct_Tuple -> double %LCLop __ \select arg2 :_exception_Struct -> _double_Obj %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLop __ \field_arrow arg1 :__exception_Struct_Ptr -> _double_Obj %LCLop __ \select retval :_exception_Struct_Tuple -> double %LCLop __ \select retval :_exception_Struct -> _double_Obj %LCLop EBADF : -> _eerrno0e_Enum %LCLop __ \field_arrow arg2 :__exception_Struct_Ptr -> _double_Obj %LCLop ECHILD : -> _eerrno0e_Enum %LCLop __ \field_arrow retval :__exception_Struct_Ptr -> _double_Obj %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop __ [] :__exception_Struct_Ptr -> __exception_Struct_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :__double_Obj_Ptr -> __double_Obj_Arr %LCLop ENOMEM : -> _eerrno0e_Enum %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop __ [__] :__exception_Struct_Tuple_Vec, int -> _exception_Struct_Tuple %LCLop __ [__] :__exception_Struct_Arr, int -> _exception_Struct %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :_double_Vec, int -> double %LCLop __ [__] :__double_Obj_Arr, int -> _double_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop [__, __, __, __, __] :double, double, double, __char_Obj_Ptr, int -> _exception_Struct_Tuple %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop EMFILE : -> _eerrno0e_Enum %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop EFBIG : -> _eerrno0e_Enum %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop EPIPE : -> _eerrno0e_Enum %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop NIL : -> __exception_Struct_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> __double_Obj_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop __ + __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ + __ :int, __exception_Struct_Ptr -> __exception_Struct_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ + __ :int, __double_Obj_Ptr -> __double_Obj_Ptr %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop __ - __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ - __ :__exception_Struct_Ptr, __exception_Struct_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ - __ :__double_Obj_Ptr, __double_Obj_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop sizeof :_emath1e_Enum -> int %LCLop DOMAIN : -> _emath1e_Enum %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop SING : -> _emath1e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop OVERFLOW : -> _emath1e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLop isSub :__exception_Struct_Tuple_Vec, int -> bool %LCLop isSub :__exception_Struct_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :_double_Vec, int -> bool %LCLop isSub :__double_Obj_Arr, int -> bool %LCLtag lconv struct %LCLop UNDERFLOW : -> _emath1e_Enum %LCLop ELOOP : -> _eerrno0e_Enum %LCLop TLOSS : -> _emath1e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop PLOSS : -> _emath1e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop EUSERS : -> _eerrno0e_Enum %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLvar errno _int_Obj %LCLvar signgam _int_Obj %LCLtype __exception ___exception exposed %LCLfcn acos : double -> double %LCLfcnGlobals %LCLfcn acosh : double -> double %LCLfcnGlobals %LCLfcn asin : double -> double %LCLfcnGlobals %LCLfcn asinh : double -> double %LCLfcnGlobals %LCLfcn atan : double -> double %LCLfcnGlobals %LCLfcn atanh : double -> double %LCLfcnGlobals %LCLfcn atan2 : double, double -> double %LCLfcnGlobals %LCLfcn cbrt : double -> double %LCLfcnGlobals %LCLfcn ceil : double -> double %LCLfcnGlobals %LCLfcn cos : double -> double %LCLfcnGlobals %LCLfcn cosh : double -> double %LCLfcnGlobals %LCLfcn exp : double -> double %LCLfcnGlobals %LCLfcn fabs : double -> double %LCLfcnGlobals %LCLfcn floor : double -> double %LCLfcnGlobals %LCLfcn fmod : double, double -> double %LCLfcnGlobals %LCLfcn frexp : double, __int_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn ldexp : double, int -> double %LCLfcnGlobals %LCLfcn log : double -> double %LCLfcnGlobals %LCLfcn log10 : double -> double %LCLfcnGlobals %LCLfcn modf : double, __double_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn pow : double, double -> double %LCLfcnGlobals %LCLfcn rint : double -> double %LCLfcnGlobals %LCLfcn sin : double -> double %LCLfcnGlobals %LCLfcn sinh : double -> double %LCLfcnGlobals %LCLfcn sqrt : double -> double %LCLfcnGlobals %LCLfcn tan : double -> double %LCLfcnGlobals %LCLfcn tanh : double -> double %LCLfcnGlobals %LCLfcn trunc : double -> double %LCLfcnGlobals %LCLfcn j0 : double -> double %LCLfcnGlobals %LCLfcn j1 : double -> double %LCLfcnGlobals %LCLfcn jn : int, double -> double %LCLfcnGlobals %LCLfcn y0 : double -> double %LCLfcnGlobals %LCLfcn y1 : double -> double %LCLfcnGlobals %LCLfcn yn : int, double -> double %LCLfcnGlobals %LCLfcn erf : double -> double %LCLfcnGlobals %LCLfcn erfc : double -> double %LCLfcnGlobals %LCLfcn gamma : double -> double %LCLfcnGlobals %LCLfcn lgamma : double -> double %LCLfcnGlobals %LCLfcn hypot : double, double -> double %LCLfcnGlobals %LCLfcn isnan : -> int %LCLfcnGlobals %LCLfcn matherr : __exception_Struct_Ptr -> int %LCLfcnGlobals %LCLconst M_E double %LCLconst M_LOG2E double %LCLconst M_LOG10E double %LCLconst M_LN2 double %LCLconst M_LN10 double %LCLconst M_PI double %LCLconst M_PI_2 double %LCLconst M_PI_4 double %LCLconst M_1_PI double %LCLconst M_2_PI double %LCLconst M_2_SQRTPI double %LCLconst M_SQRT2 double %LCLconst M_SQRT1_2 double %LCLconst MAXFLOAT double %LCLconst HUGE double %LCLenumConst DOMAIN _emath1e_Enum %LCLenumConst SING _emath1e_Enum %LCLenumConst OVERFLOW _emath1e_Enum %LCLenumConst UNDERFLOW _emath1e_Enum %LCLenumConst TLOSS _emath1e_Enum %LCLenumConst PLOSS _emath1e_Enum %LCLvar _matherrors __emath1e_Enum_Obj %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/setjmp.lcl0000644021234200000250000000371707121317316015147 0ustar fax/* ** setjmp.h */ constant int JB_ONSIGSTK; constant int JB_SIGMASK; constant int JB_PC; constant int JB_REGS; constant int JB_ZERO; constant int JB_MAGIC; constant int JB_AT; constant int JB_V0; constant int JB_V1 ; constant int JB_A0 ; constant int JB_A1 ; constant int JB_A2 ; constant int JB_A3 ; constant int JB_T0 ; constant int JB_T1 ; constant int JB_T2 ; constant int JB_T3 ; constant int JB_T4 ; constant int JB_T5 ; constant int JB_T6 ; constant int JB_T7 ; constant int JB_S0 ; constant int JB_S1 ; constant int JB_S2 ; constant int JB_S3 ; constant int JB_S4 ; constant int JB_S5 ; constant int JB_S6 ; constant int JB_S7 ; constant int JB_T8 ; constant int JB_T9 ; constant int JB_K0 ; constant int JB_K1 ; constant int JB_GP ; constant int JB_SP ; constant int JB_S8 ; constant int JB_RA ; constant int JB_FREGS ; constant int JB_F0 ; constant int JB_F1 ; constant int JB_F2 ; constant int JB_F3 ; constant int JB_F4 ; constant int JB_F5 ; constant int JB_F6 ; constant int JB_F7 ; constant int JB_F8 ; constant int JB_F9 ; constant int JB_F10 ; constant int JB_F11 ; constant int JB_F12 ; constant int JB_F13 ; constant int JB_F14 ; constant int JB_F15 ; constant int JB_F16 ; constant int JB_F17 ; constant int JB_F18 ; constant int JB_F19 ; constant int JB_F20 ; constant int JB_F21 ; constant int JB_F22 ; constant int JB_F23 ; constant int JB_F24 ; constant int JB_F25 ; constant int JB_F26 ; constant int JB_F27 ; constant int JB_F28 ; constant int JB_F29 ; constant int JB_F30 ; constant int JB_F31 ; constant int JB_FPC_CSR ; constant int SC_MDLO ; constant int SC_MDHI ; constant int JB_FLAGS ; constant int JBMAGIC ; constant int SIGCONTEXT_PAD; constant int NJBREGS ; typedef int jmp_buf[]; typedef int sigjmp_buf[]; void longjmp( jmp_buf __env, int __val ) { ensures true; } int setjmp( jmp_buf __env ) { ensures true; } int sigsetjmp(sigjmp_buf __env, int __savemask) { ensures true; } void siglongjmp( sigjmp_buf __env, int __val) { ensures true; } splint-3.1.2.dfsg1/imports/setjmp.lcs0000644021234200000250000005424407121317316015157 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLsort _exception_Struct str exception nil %LCLsort retval strMem _double_Obj nil %LCLsort arg2 strMem _double_Obj nil %LCLsort arg1 strMem _double_Obj nil %LCLsort name strMem ___char_Obj_Ptr_Obj nil %LCLsort ttype strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _double_Obj obj double nil %LCLsort _exception_Struct_Tuple tup _exception_Struct nil %LCLsort __exception_Struct_Ptr ptr _exception_Struct nil %LCLsort __exception_Struct_Arr arr _exception_Struct nil %LCLsort __exception_Struct_Tuple_Vec vec _exception_Struct_Tuple __exception_Struct_Arr %LCLsort ___exception synonym _exception_Struct nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort __double_Obj_Ptr ptr _double_Obj nil %LCLsort __double_Obj_Arr arr _double_Obj nil %LCLsort _double_Vec vec double __double_Obj_Arr %LCLsort _emath1e_Enum enum emath1e nil %LCLsort PLOSS enumMem nil nil %LCLsort TLOSS enumMem nil nil %LCLsort UNDERFLOW enumMem nil nil %LCLsort OVERFLOW enumMem nil nil %LCLsort SING enumMem nil nil %LCLsort DOMAIN enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __emath1e_Enum_Obj obj _emath1e_Enum nil %LCLsort _jmp_buf synonym __int_Obj_Arr nil %LCLsort _sigjmp_buf synonym __int_Obj_Arr nil %LCLSortTableEnd %LCLSymbolTable %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLtag exception struct %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop __ \select ttype :_exception_Struct_Tuple -> int %LCLop __ \select ttype :_exception_Struct -> _int_Obj %LCLop EIO : -> _eerrno0e_Enum %LCLop __ \select name :_exception_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select name :_exception_Struct -> ___char_Obj_Ptr_Obj %LCLop ENXIO : -> _eerrno0e_Enum %LCLop __ \field_arrow ttype :__exception_Struct_Ptr -> _int_Obj %LCLop __ \select arg1 :_exception_Struct_Tuple -> double %LCLop __ \select arg1 :_exception_Struct -> _double_Obj %LCLop E2BIG : -> _eerrno0e_Enum %LCLop __ \field_arrow name :__exception_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select arg2 :_exception_Struct_Tuple -> double %LCLop __ \select arg2 :_exception_Struct -> _double_Obj %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLop __ \field_arrow arg1 :__exception_Struct_Ptr -> _double_Obj %LCLop __ \select retval :_exception_Struct_Tuple -> double %LCLop __ \select retval :_exception_Struct -> _double_Obj %LCLop EBADF : -> _eerrno0e_Enum %LCLop __ \field_arrow arg2 :__exception_Struct_Ptr -> _double_Obj %LCLop ECHILD : -> _eerrno0e_Enum %LCLop __ \field_arrow retval :__exception_Struct_Ptr -> _double_Obj %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop __ [] :__exception_Struct_Ptr -> __exception_Struct_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :__double_Obj_Ptr -> __double_Obj_Arr %LCLop ENOMEM : -> _eerrno0e_Enum %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop __ [__] :__exception_Struct_Tuple_Vec, int -> _exception_Struct_Tuple %LCLop __ [__] :__exception_Struct_Arr, int -> _exception_Struct %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :_double_Vec, int -> double %LCLop __ [__] :__double_Obj_Arr, int -> _double_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop [__, __, __, __, __] :double, double, double, __char_Obj_Ptr, int -> _exception_Struct_Tuple %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop EMFILE : -> _eerrno0e_Enum %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop EFBIG : -> _eerrno0e_Enum %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop EPIPE : -> _eerrno0e_Enum %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop NIL : -> __exception_Struct_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> __double_Obj_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop __ + __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ + __ :int, __exception_Struct_Ptr -> __exception_Struct_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ + __ :int, __double_Obj_Ptr -> __double_Obj_Ptr %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop __ - __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ - __ :__exception_Struct_Ptr, __exception_Struct_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ - __ :__double_Obj_Ptr, __double_Obj_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop sizeof :_emath1e_Enum -> int %LCLop DOMAIN : -> _emath1e_Enum %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop SING : -> _emath1e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop OVERFLOW : -> _emath1e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLop isSub :__exception_Struct_Tuple_Vec, int -> bool %LCLop isSub :__exception_Struct_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :_double_Vec, int -> bool %LCLop isSub :__double_Obj_Arr, int -> bool %LCLtag lconv struct %LCLop UNDERFLOW : -> _emath1e_Enum %LCLop ELOOP : -> _eerrno0e_Enum %LCLop TLOSS : -> _emath1e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop PLOSS : -> _emath1e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop EUSERS : -> _eerrno0e_Enum %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLconst JB_ONSIGSTK int %LCLconst JB_SIGMASK int %LCLconst JB_PC int %LCLconst JB_REGS int %LCLconst JB_ZERO int %LCLconst JB_MAGIC int %LCLconst JB_AT int %LCLconst JB_V0 int %LCLconst JB_V1 int %LCLconst JB_A0 int %LCLconst JB_A1 int %LCLconst JB_A2 int %LCLconst JB_A3 int %LCLconst JB_T0 int %LCLconst JB_T1 int %LCLconst JB_T2 int %LCLconst JB_T3 int %LCLconst JB_T4 int %LCLconst JB_T5 int %LCLconst JB_T6 int %LCLconst JB_T7 int %LCLconst JB_S0 int %LCLconst JB_S1 int %LCLconst JB_S2 int %LCLconst JB_S3 int %LCLconst JB_S4 int %LCLconst JB_S5 int %LCLconst JB_S6 int %LCLconst JB_S7 int %LCLconst JB_T8 int %LCLconst JB_T9 int %LCLconst JB_K0 int %LCLconst JB_K1 int %LCLconst JB_GP int %LCLconst JB_SP int %LCLconst JB_S8 int %LCLconst JB_RA int %LCLconst JB_FREGS int %LCLconst JB_F0 int %LCLconst JB_F1 int %LCLconst JB_F2 int %LCLconst JB_F3 int %LCLconst JB_F4 int %LCLconst JB_F5 int %LCLconst JB_F6 int %LCLconst JB_F7 int %LCLconst JB_F8 int %LCLconst JB_F9 int %LCLconst JB_F10 int %LCLconst JB_F11 int %LCLconst JB_F12 int %LCLconst JB_F13 int %LCLconst JB_F14 int %LCLconst JB_F15 int %LCLconst JB_F16 int %LCLconst JB_F17 int %LCLconst JB_F18 int %LCLconst JB_F19 int %LCLconst JB_F20 int %LCLconst JB_F21 int %LCLconst JB_F22 int %LCLconst JB_F23 int %LCLconst JB_F24 int %LCLconst JB_F25 int %LCLconst JB_F26 int %LCLconst JB_F27 int %LCLconst JB_F28 int %LCLconst JB_F29 int %LCLconst JB_F30 int %LCLconst JB_F31 int %LCLconst JB_FPC_CSR int %LCLconst SC_MDLO int %LCLconst SC_MDHI int %LCLconst JB_FLAGS int %LCLconst JBMAGIC int %LCLconst SIGCONTEXT_PAD int %LCLconst NJBREGS int %LCLtype jmp_buf _jmp_buf exposed %LCLtype sigjmp_buf _sigjmp_buf exposed %LCLfcn longjmp : __int_Obj_Arr, int -> void %LCLfcnGlobals %LCLfcn setjmp : __int_Obj_Arr -> int %LCLfcnGlobals %LCLfcn sigsetjmp : __int_Obj_Arr, int -> int %LCLfcnGlobals %LCLfcn siglongjmp : __int_Obj_Arr, int -> void %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/signal.lcl0000644021234200000250000000725107121317316015117 0ustar fax/* ** signal.h */ constant int NSIG; constant int SIGHUP; constant int SIGINT; constant int SIGQUIT; constant int SIGILL; constant int ILL_RESAD_FAULT; constant int ILL_PRIVIN_FAULT; constant int ILL_RESOP_FAULT; constant int ILL_VECOP_FAULT; constant int ILL_VECINST_FAULT; constant int SIGTRAP; constant int SIGIOT; constant int SIGEMT; constant int SIGFPE; constant int FPE_INTOVF_TRAP; constant int FPE_INTDIV_TRAP; constant int FPE_FLTOVF_TRAP; constant int FPE_FLTDIV_TRAP; constant int FPE_FLTUND_TRAP; constant int FPE_DECOVF_TRAP; constant int FPE_SUBRNG_TRAP; constant int FPE_FLTOVF_FAULT; constant int FPE_FLTDIV_FAULT; constant int FPE_FLTUND_FAULT; constant int FPE_VECTOR ; constant int VFPE_FLTUND_TRAP ; constant int VFPE_FLTDIV_TRAP ; constant int VFPE_FLTRSV_TRAP ; constant int VPFE_FLTOVF_FAULT ; constant int VFPE_INTOVF_TRAP ; constant int SIGKILL ; constant int SIGBUS ; constant int SIGSEGV ; constant int SIGSYS ; constant int SIGPIPE ; constant int SIGALRM ; constant int SIGTERM ; constant int TERM_VECT_HARD ; constant int TERM_VECT_TOOMANY ; constant int SIGURG ; constant int SIGSTOP ; constant int SIGTSTP ; constant int SIGCONT ; constant int SIGCHLD ; constant int SIGTTIN ; constant int SIGTTOU ; constant int SIGIO ; constant int SIGXCPU ; constant int SIGXFSZ ; constant int SIGVTALRM ; constant int SIGPROF ; constant int SIGWINCH ; constant int SIGLOST ; constant int SIGUSR1 ; constant int SIGUSR2 ; constant int SIGCLD ; constant int SIGABRT; constant int BRK_USERBP ; constant int BRK_KERNELBP ; constant int BRK_ABORT ; constant int BRK_BD_TAKEN ; constant int BRK_BD_NOTTAKEN ; constant int BRK_SSTEPBP ; constant int BRK_OVERFLOW ; constant int BRK_DIVZERO; constant int BRK_RANGE ; constant int BRK_STACKOVERFLOW; typedef long sig_atomic_t; typedef int sigset_t; typedef struct sigvec { void (*sv_handler)(); sigset_t sv_mask; int sv_flags; } __sigvec; typedef struct sigaction { void (*sa_handler)(); sigset_t sa_mask; int sa_flags; } __sigaction; constant int SV_ONSTACK ; constant int SV_INTERRUPT ; constant int SA_NOCLDSTOP ; constant int SV_OLDSIG ; constant int sv_onstack ; constant int SIG_BLOCK ; constant int SIG_UNBLOCK ; constant int SIG_SETMASK ; typedef struct sigstack { char *ss_sp; int ss_onstack; } __sigstack ; typedef struct sigcontext { int sc_onstack; int sc_mask; int sc_pc; int sc_regs[32]; int sc_mdlo; int sc_mdhi; int sc_ownedfp; int sc_fpregs[32]; int sc_fpc_csr; int sc_fpc_eir; int sc_cause; int sc_badvaddr; int sc_badpaddr; } __sigcontext; typedef void(*__scp)(int); constant __scp BADSIG; constant __scp SIG_ERR; constant __scp SIG_DFL; constant __scp SIG_IGN; typedef int pid_t; /* void (*signal(int __sig, void(*__func)(int)))(int) { ensures true; } */ int raise( int __sig ) { ensures true; } int kill( pid_t __pid, int __sig ) { ensures true; } int sigemptyset( sigset_t *__set ) { ensures true; } int sigfillset( sigset_t *__set ) { ensures true; } int sigaddset( sigset_t *__set, int __signo ) { ensures true; } int sigdelset( sigset_t *__set, int __signo ) { ensures true; } int sigismember( sigset_t *__set, int __signo ) { ensures true; } int sigaction( int __sig, struct sigaction *__act, struct sigaction *__oact ) { ensures true; } int sigprocmask( int __how, sigset_t *__set, sigset_t *__oset ) { ensures true; } int sigpending( sigset_t *__set ) { ensures true; } int sigsuspend( sigset_t *__sigmask ) { ensures true; } int sigmask(int m) { ensures true; } /* i think...? */ splint-3.1.2.dfsg1/imports/signal.lcs0000644021234200000250000010122007121317316015115 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLsort _exception_Struct str exception nil %LCLsort retval strMem _double_Obj nil %LCLsort arg2 strMem _double_Obj nil %LCLsort arg1 strMem _double_Obj nil %LCLsort name strMem ___char_Obj_Ptr_Obj nil %LCLsort ttype strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _double_Obj obj double nil %LCLsort _exception_Struct_Tuple tup _exception_Struct nil %LCLsort __exception_Struct_Ptr ptr _exception_Struct nil %LCLsort __exception_Struct_Arr arr _exception_Struct nil %LCLsort __exception_Struct_Tuple_Vec vec _exception_Struct_Tuple __exception_Struct_Arr %LCLsort ___exception synonym _exception_Struct nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort __double_Obj_Ptr ptr _double_Obj nil %LCLsort __double_Obj_Arr arr _double_Obj nil %LCLsort _double_Vec vec double __double_Obj_Arr %LCLsort _emath1e_Enum enum emath1e nil %LCLsort PLOSS enumMem nil nil %LCLsort TLOSS enumMem nil nil %LCLsort UNDERFLOW enumMem nil nil %LCLsort OVERFLOW enumMem nil nil %LCLsort SING enumMem nil nil %LCLsort DOMAIN enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __emath1e_Enum_Obj obj _emath1e_Enum nil %LCLsort _jmp_buf synonym __int_Obj_Arr nil %LCLsort _sigjmp_buf synonym __int_Obj_Arr nil %LCLsort _sig_atomic_t synonym int nil %LCLsort _sigset_t synonym int nil %LCLsort _sigvec_Struct str sigvec nil %LCLsort sv_flags strMem _int_Obj nil %LCLsort sv_mask strMem _int_Obj nil %LCLsort sv_handler strMem _HOF_sort_43 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_43 hof nil nil %LCLsort _sigvec_Struct_Tuple tup _sigvec_Struct nil %LCLsort __sigvec_Struct_Ptr ptr _sigvec_Struct nil %LCLsort __sigvec_Struct_Arr arr _sigvec_Struct nil %LCLsort __sigvec_Struct_Tuple_Vec vec _sigvec_Struct_Tuple __sigvec_Struct_Arr %LCLsort ___sigvec synonym _sigvec_Struct nil %LCLsort _sigaction_Struct str sigaction nil %LCLsort sa_flags strMem _int_Obj nil %LCLsort sa_mask strMem _int_Obj nil %LCLsort sa_handler strMem _HOF_sort_50 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_50 hof nil nil %LCLsort _sigaction_Struct_Tuple tup _sigaction_Struct nil %LCLsort __sigaction_Struct_Ptr ptr _sigaction_Struct nil %LCLsort __sigaction_Struct_Arr arr _sigaction_Struct nil %LCLsort __sigaction_Struct_Tuple_Vec vec _sigaction_Struct_Tuple __sigaction_Struct_Arr %LCLsort ___sigaction synonym _sigaction_Struct nil %LCLsort _sigstack_Struct str sigstack nil %LCLsort ss_onstack strMem _int_Obj nil %LCLsort ss_sp strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigstack_Struct_Tuple tup _sigstack_Struct nil %LCLsort __sigstack_Struct_Ptr ptr _sigstack_Struct nil %LCLsort __sigstack_Struct_Arr arr _sigstack_Struct nil %LCLsort __sigstack_Struct_Tuple_Vec vec _sigstack_Struct_Tuple __sigstack_Struct_Arr %LCLsort ___sigstack synonym _sigstack_Struct nil %LCLsort _sigcontext_Struct str sigcontext nil %LCLsort sc_badpaddr strMem _int_Obj nil %LCLsort sc_badvaddr strMem _int_Obj nil %LCLsort sc_cause strMem _int_Obj nil %LCLsort sc_fpc_eir strMem _int_Obj nil %LCLsort sc_fpc_csr strMem _int_Obj nil %LCLsort sc_fpregs strMem __int_Obj_Arr nil %LCLsort sc_ownedfp strMem _int_Obj nil %LCLsort sc_mdhi strMem _int_Obj nil %LCLsort sc_mdlo strMem _int_Obj nil %LCLsort sc_regs strMem __int_Obj_Arr nil %LCLsort sc_pc strMem _int_Obj nil %LCLsort sc_mask strMem _int_Obj nil %LCLsort sc_onstack strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigcontext_Struct_Tuple tup _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Ptr ptr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Arr arr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Tuple_Vec vec _sigcontext_Struct_Tuple __sigcontext_Struct_Arr %LCLsort ___sigcontext synonym _sigcontext_Struct nil %LCLsort _HOF_sort_68 hof nil nil %LCLsort ___scp synonym _HOF_sort_68 nil %LCLsort _pid_t synonym int nil %LCLSortTableEnd %LCLSymbolTable %LCLop __ \field_arrow sc_badvaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop __ \field_arrow sc_badpaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLtag exception struct %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLtag sigvec struct %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLtag sigaction struct %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop __ \select ttype :_exception_Struct_Tuple -> int %LCLop __ \select ttype :_exception_Struct -> _int_Obj %LCLop EIO : -> _eerrno0e_Enum %LCLop __ \select name :_exception_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select name :_exception_Struct -> ___char_Obj_Ptr_Obj %LCLop ENXIO : -> _eerrno0e_Enum %LCLop __ \field_arrow ttype :__exception_Struct_Ptr -> _int_Obj %LCLop __ \select arg1 :_exception_Struct_Tuple -> double %LCLop __ \select arg1 :_exception_Struct -> _double_Obj %LCLop E2BIG : -> _eerrno0e_Enum %LCLop __ \field_arrow name :__exception_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select arg2 :_exception_Struct_Tuple -> double %LCLop __ \select arg2 :_exception_Struct -> _double_Obj %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLop __ \field_arrow arg1 :__exception_Struct_Ptr -> _double_Obj %LCLop __ \select retval :_exception_Struct_Tuple -> double %LCLop __ \select retval :_exception_Struct -> _double_Obj %LCLop EBADF : -> _eerrno0e_Enum %LCLop __ \select sv_handler :_sigvec_Struct_Tuple -> _HOF_sort_43 %LCLop __ \select sv_handler :_sigvec_Struct -> _HOF_sort_43 %LCLop __ \field_arrow arg2 :__exception_Struct_Ptr -> _double_Obj %LCLop ECHILD : -> _eerrno0e_Enum %LCLop [__, __] :int, __char_Obj_Ptr -> _sigstack_Struct_Tuple %LCLop __ \select sv_mask :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_mask :_sigvec_Struct -> _int_Obj %LCLop __ \field_arrow retval :__exception_Struct_Ptr -> _double_Obj %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop __ [] :__exception_Struct_Ptr -> __exception_Struct_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :__double_Obj_Ptr -> __double_Obj_Arr %LCLop __ [] :__sigvec_Struct_Ptr -> __sigvec_Struct_Arr %LCLop __ [] :__sigaction_Struct_Ptr -> __sigaction_Struct_Arr %LCLop __ [] :__sigstack_Struct_Ptr -> __sigstack_Struct_Arr %LCLop __ [] :__sigcontext_Struct_Ptr -> __sigcontext_Struct_Arr %LCLop __ \field_arrow sv_handler :__sigvec_Struct_Ptr -> _HOF_sort_43 %LCLop __ \select sv_flags :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_flags :_sigvec_Struct -> _int_Obj %LCLop ENOMEM : -> _eerrno0e_Enum %LCLtag sigstack struct %LCLop __ \field_arrow sv_mask :__sigvec_Struct_Ptr -> _int_Obj %LCLop [__, __, __] :int, int, _HOF_sort_43 -> _sigvec_Struct_Tuple %LCLop [__, __, __] :int, int, _HOF_sort_50 -> _sigaction_Struct_Tuple %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop __ [__] :__exception_Struct_Tuple_Vec, int -> _exception_Struct_Tuple %LCLop __ [__] :__exception_Struct_Arr, int -> _exception_Struct %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :_double_Vec, int -> double %LCLop __ [__] :__double_Obj_Arr, int -> _double_Obj %LCLop __ [__] :__sigvec_Struct_Tuple_Vec, int -> _sigvec_Struct_Tuple %LCLop __ [__] :__sigvec_Struct_Arr, int -> _sigvec_Struct %LCLop __ [__] :__sigaction_Struct_Tuple_Vec, int -> _sigaction_Struct_Tuple %LCLop __ [__] :__sigaction_Struct_Arr, int -> _sigaction_Struct %LCLop __ [__] :__sigstack_Struct_Tuple_Vec, int -> _sigstack_Struct_Tuple %LCLop __ [__] :__sigstack_Struct_Arr, int -> _sigstack_Struct %LCLop __ [__] :__sigcontext_Struct_Tuple_Vec, int -> _sigcontext_Struct_Tuple %LCLop __ [__] :__sigcontext_Struct_Arr, int -> _sigcontext_Struct %LCLop __ \field_arrow sv_flags :__sigvec_Struct_Ptr -> _int_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop [__, __, __, __, __] :double, double, double, __char_Obj_Ptr, int -> _exception_Struct_Tuple %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop __ \select sa_handler :_sigaction_Struct_Tuple -> _HOF_sort_50 %LCLop __ \select sa_handler :_sigaction_Struct -> _HOF_sort_50 %LCLop EMFILE : -> _eerrno0e_Enum %LCLtag sigcontext struct %LCLop __ \select sa_mask :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_mask :_sigaction_Struct -> _int_Obj %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_handler :__sigaction_Struct_Ptr -> _HOF_sort_50 %LCLop __ \select sa_flags :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_flags :_sigaction_Struct -> _int_Obj %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop __ \field_arrow sa_mask :__sigaction_Struct_Ptr -> _int_Obj %LCLop EFBIG : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_flags :__sigaction_Struct_Ptr -> _int_Obj %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop 32 : -> double %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop EPIPE : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __] :int, int, int, int, int, _int_Vec, int, int, int, _int_Vec, int, int, int -> _sigcontext_Struct_Tuple %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop __ \select ss_sp :_sigstack_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select ss_sp :_sigstack_Struct -> ___char_Obj_Ptr_Obj %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \select ss_onstack :_sigstack_Struct_Tuple -> int %LCLop __ \select ss_onstack :_sigstack_Struct -> _int_Obj %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_sp :__sigstack_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_onstack :__sigstack_Struct_Ptr -> _int_Obj %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop NIL : -> __exception_Struct_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> __double_Obj_Ptr %LCLop NIL : -> __sigvec_Struct_Ptr %LCLop NIL : -> __sigaction_Struct_Ptr %LCLop NIL : -> __sigstack_Struct_Ptr %LCLop NIL : -> __sigcontext_Struct_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop __ + __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ + __ :int, __exception_Struct_Ptr -> __exception_Struct_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ + __ :int, __double_Obj_Ptr -> __double_Obj_Ptr %LCLop __ + __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ + __ :int, __sigvec_Struct_Ptr -> __sigvec_Struct_Ptr %LCLop __ + __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ + __ :int, __sigaction_Struct_Ptr -> __sigaction_Struct_Ptr %LCLop __ + __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ + __ :int, __sigstack_Struct_Ptr -> __sigstack_Struct_Ptr %LCLop __ + __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ + __ :int, __sigcontext_Struct_Ptr -> __sigcontext_Struct_Ptr %LCLop __ \select sc_onstack :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_onstack :_sigcontext_Struct -> _int_Obj %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop __ - __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ - __ :__exception_Struct_Ptr, __exception_Struct_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ - __ :__double_Obj_Ptr, __double_Obj_Ptr -> int %LCLop __ - __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ - __ :__sigvec_Struct_Ptr, __sigvec_Struct_Ptr -> int %LCLop __ - __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ - __ :__sigaction_Struct_Ptr, __sigaction_Struct_Ptr -> int %LCLop __ - __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ - __ :__sigstack_Struct_Ptr, __sigstack_Struct_Ptr -> int %LCLop __ - __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ - __ :__sigcontext_Struct_Ptr, __sigcontext_Struct_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop sizeof :_emath1e_Enum -> int %LCLop __ \select sc_mask :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mask :_sigcontext_Struct -> _int_Obj %LCLop DOMAIN : -> _emath1e_Enum %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_onstack :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_pc :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_pc :_sigcontext_Struct -> _int_Obj %LCLop SING : -> _emath1e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mask :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_regs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_regs :_sigcontext_Struct -> __int_Obj_Arr %LCLop OVERFLOW : -> _emath1e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLop isSub :__exception_Struct_Tuple_Vec, int -> bool %LCLop isSub :__exception_Struct_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :_double_Vec, int -> bool %LCLop isSub :__double_Obj_Arr, int -> bool %LCLop isSub :__sigvec_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigvec_Struct_Arr, int -> bool %LCLop isSub :__sigaction_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigaction_Struct_Arr, int -> bool %LCLop isSub :__sigstack_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigstack_Struct_Arr, int -> bool %LCLop isSub :__sigcontext_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigcontext_Struct_Arr, int -> bool %LCLtag lconv struct %LCLop __ \field_arrow sc_pc :__sigcontext_Struct_Ptr -> _int_Obj %LCLop UNDERFLOW : -> _emath1e_Enum %LCLop ELOOP : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_regs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_mdlo :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdlo :_sigcontext_Struct -> _int_Obj %LCLop TLOSS : -> _emath1e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop __ \select sc_mdhi :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdhi :_sigcontext_Struct -> _int_Obj %LCLop PLOSS : -> _emath1e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdlo :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_ownedfp :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_ownedfp :_sigcontext_Struct -> _int_Obj %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdhi :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpregs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_fpregs :_sigcontext_Struct -> __int_Obj_Arr %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLop __ \field_arrow sc_ownedfp :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpc_csr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_csr :_sigcontext_Struct -> _int_Obj %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop __ \field_arrow sc_fpregs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_fpc_eir :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_eir :_sigcontext_Struct -> _int_Obj %LCLop EUSERS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_csr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_cause :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_cause :_sigcontext_Struct -> _int_Obj %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_eir :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badvaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badvaddr :_sigcontext_Struct -> _int_Obj %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop __ \field_arrow sc_cause :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badpaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badpaddr :_sigcontext_Struct -> _int_Obj %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLconst NSIG int %LCLconst SIGHUP int %LCLconst SIGINT int %LCLconst SIGQUIT int %LCLconst SIGILL int %LCLconst ILL_RESAD_FAULT int %LCLconst ILL_PRIVIN_FAULT int %LCLconst ILL_RESOP_FAULT int %LCLconst ILL_VECOP_FAULT int %LCLconst ILL_VECINST_FAULT int %LCLconst SIGTRAP int %LCLconst SIGIOT int %LCLconst SIGEMT int %LCLconst SIGFPE int %LCLconst FPE_INTOVF_TRAP int %LCLconst FPE_INTDIV_TRAP int %LCLconst FPE_FLTOVF_TRAP int %LCLconst FPE_FLTDIV_TRAP int %LCLconst FPE_FLTUND_TRAP int %LCLconst FPE_DECOVF_TRAP int %LCLconst FPE_SUBRNG_TRAP int %LCLconst FPE_FLTOVF_FAULT int %LCLconst FPE_FLTDIV_FAULT int %LCLconst FPE_FLTUND_FAULT int %LCLconst FPE_VECTOR int %LCLconst VFPE_FLTUND_TRAP int %LCLconst VFPE_FLTDIV_TRAP int %LCLconst VFPE_FLTRSV_TRAP int %LCLconst VPFE_FLTOVF_FAULT int %LCLconst VFPE_INTOVF_TRAP int %LCLconst SIGKILL int %LCLconst SIGBUS int %LCLconst SIGSEGV int %LCLconst SIGSYS int %LCLconst SIGPIPE int %LCLconst SIGALRM int %LCLconst SIGTERM int %LCLconst TERM_VECT_HARD int %LCLconst TERM_VECT_TOOMANY int %LCLconst SIGURG int %LCLconst SIGSTOP int %LCLconst SIGTSTP int %LCLconst SIGCONT int %LCLconst SIGCHLD int %LCLconst SIGTTIN int %LCLconst SIGTTOU int %LCLconst SIGIO int %LCLconst SIGXCPU int %LCLconst SIGXFSZ int %LCLconst SIGVTALRM int %LCLconst SIGPROF int %LCLconst SIGWINCH int %LCLconst SIGLOST int %LCLconst SIGUSR1 int %LCLconst SIGUSR2 int %LCLconst SIGCLD int %LCLconst SIGABRT int %LCLconst BRK_USERBP int %LCLconst BRK_KERNELBP int %LCLconst BRK_ABORT int %LCLconst BRK_BD_TAKEN int %LCLconst BRK_BD_NOTTAKEN int %LCLconst BRK_SSTEPBP int %LCLconst BRK_OVERFLOW int %LCLconst BRK_DIVZERO int %LCLconst BRK_RANGE int %LCLconst BRK_STACKOVERFLOW int %LCLtype sig_atomic_t _sig_atomic_t exposed %LCLtype sigset_t _sigset_t exposed %LCLtype __sigvec ___sigvec exposed %LCLtype __sigaction ___sigaction exposed %LCLconst SV_ONSTACK int %LCLconst SV_INTERRUPT int %LCLconst SA_NOCLDSTOP int %LCLconst SV_OLDSIG int %LCLconst sv_onstack int %LCLconst SIG_BLOCK int %LCLconst SIG_UNBLOCK int %LCLconst SIG_SETMASK int %LCLtype __sigstack ___sigstack exposed %LCLtype __sigcontext ___sigcontext exposed %LCLtype __scp ___scp exposed %LCLconst BADSIG _HOF_sort_68 %LCLconst SIG_ERR _HOF_sort_68 %LCLconst SIG_DFL _HOF_sort_68 %LCLconst SIG_IGN _HOF_sort_68 %LCLtype pid_t _pid_t exposed %LCLfcn raise : int -> int %LCLfcnGlobals %LCLfcn kill : int, int -> int %LCLfcnGlobals %LCLfcn sigemptyset : __int_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn sigfillset : __int_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn sigaddset : __int_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn sigdelset : __int_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn sigismember : __int_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn sigaction : int, __sigaction_Struct_Ptr, __sigaction_Struct_Ptr -> int %LCLfcnGlobals %LCLfcn sigprocmask : int, __int_Obj_Ptr, __int_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn sigpending : __int_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn sigsuspend : __int_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn sigmask : int -> int %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/stdarg.lcl0000644021234200000250000000073507121317316015126 0ustar fax/* ** stdarg.h ** ** NOT INCLUDED */ /* typedef char *va_list; void va_end(va_list) { ensures true; } va_list va_start(va_list va, parmN) (list = ((va_list)&parmN + sizeof(parmN))) constant va_arg(list, mode) ((mode *)(list = (va_list) ((((int)list + (__builtin_alignof(mode)<=4?3:7)) & (__builtin_alignof(mode)<=4?-4:-8))+sizeof(mode))))[-1] */ typedef int ptrdiff_t; /* #define offsetof(s_name,m_name) (size_t)&(((s_name*)0))->m_name */ splint-3.1.2.dfsg1/imports/stdarg.lcs0000644021234200000250000007333107121317316015137 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLsort _exception_Struct str exception nil %LCLsort retval strMem _double_Obj nil %LCLsort arg2 strMem _double_Obj nil %LCLsort arg1 strMem _double_Obj nil %LCLsort name strMem ___char_Obj_Ptr_Obj nil %LCLsort ttype strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _double_Obj obj double nil %LCLsort _exception_Struct_Tuple tup _exception_Struct nil %LCLsort __exception_Struct_Ptr ptr _exception_Struct nil %LCLsort __exception_Struct_Arr arr _exception_Struct nil %LCLsort __exception_Struct_Tuple_Vec vec _exception_Struct_Tuple __exception_Struct_Arr %LCLsort ___exception synonym _exception_Struct nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort __double_Obj_Ptr ptr _double_Obj nil %LCLsort __double_Obj_Arr arr _double_Obj nil %LCLsort _double_Vec vec double __double_Obj_Arr %LCLsort _emath1e_Enum enum emath1e nil %LCLsort PLOSS enumMem nil nil %LCLsort TLOSS enumMem nil nil %LCLsort UNDERFLOW enumMem nil nil %LCLsort OVERFLOW enumMem nil nil %LCLsort SING enumMem nil nil %LCLsort DOMAIN enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __emath1e_Enum_Obj obj _emath1e_Enum nil %LCLsort _jmp_buf synonym __int_Obj_Arr nil %LCLsort _sigjmp_buf synonym __int_Obj_Arr nil %LCLsort _sig_atomic_t synonym int nil %LCLsort _sigset_t synonym int nil %LCLsort _sigvec_Struct str sigvec nil %LCLsort sv_flags strMem _int_Obj nil %LCLsort sv_mask strMem _int_Obj nil %LCLsort sv_handler strMem _HOF_sort_43 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_43 hof nil nil %LCLsort _sigvec_Struct_Tuple tup _sigvec_Struct nil %LCLsort __sigvec_Struct_Ptr ptr _sigvec_Struct nil %LCLsort __sigvec_Struct_Arr arr _sigvec_Struct nil %LCLsort __sigvec_Struct_Tuple_Vec vec _sigvec_Struct_Tuple __sigvec_Struct_Arr %LCLsort ___sigvec synonym _sigvec_Struct nil %LCLsort _sigaction_Struct str sigaction nil %LCLsort sa_flags strMem _int_Obj nil %LCLsort sa_mask strMem _int_Obj nil %LCLsort sa_handler strMem _HOF_sort_50 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_50 hof nil nil %LCLsort _sigaction_Struct_Tuple tup _sigaction_Struct nil %LCLsort __sigaction_Struct_Ptr ptr _sigaction_Struct nil %LCLsort __sigaction_Struct_Arr arr _sigaction_Struct nil %LCLsort __sigaction_Struct_Tuple_Vec vec _sigaction_Struct_Tuple __sigaction_Struct_Arr %LCLsort ___sigaction synonym _sigaction_Struct nil %LCLsort _sigstack_Struct str sigstack nil %LCLsort ss_onstack strMem _int_Obj nil %LCLsort ss_sp strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigstack_Struct_Tuple tup _sigstack_Struct nil %LCLsort __sigstack_Struct_Ptr ptr _sigstack_Struct nil %LCLsort __sigstack_Struct_Arr arr _sigstack_Struct nil %LCLsort __sigstack_Struct_Tuple_Vec vec _sigstack_Struct_Tuple __sigstack_Struct_Arr %LCLsort ___sigstack synonym _sigstack_Struct nil %LCLsort _sigcontext_Struct str sigcontext nil %LCLsort sc_badpaddr strMem _int_Obj nil %LCLsort sc_badvaddr strMem _int_Obj nil %LCLsort sc_cause strMem _int_Obj nil %LCLsort sc_fpc_eir strMem _int_Obj nil %LCLsort sc_fpc_csr strMem _int_Obj nil %LCLsort sc_fpregs strMem __int_Obj_Arr nil %LCLsort sc_ownedfp strMem _int_Obj nil %LCLsort sc_mdhi strMem _int_Obj nil %LCLsort sc_mdlo strMem _int_Obj nil %LCLsort sc_regs strMem __int_Obj_Arr nil %LCLsort sc_pc strMem _int_Obj nil %LCLsort sc_mask strMem _int_Obj nil %LCLsort sc_onstack strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigcontext_Struct_Tuple tup _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Ptr ptr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Arr arr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Tuple_Vec vec _sigcontext_Struct_Tuple __sigcontext_Struct_Arr %LCLsort ___sigcontext synonym _sigcontext_Struct nil %LCLsort _HOF_sort_68 hof nil nil %LCLsort ___scp synonym _HOF_sort_68 nil %LCLsort _pid_t synonym int nil %LCLsort _ptrdiff_t synonym int nil %LCLSortTableEnd %LCLSymbolTable %LCLop __ \field_arrow sc_badvaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop __ \field_arrow sc_badpaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLtag exception struct %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLtag sigvec struct %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLtag sigaction struct %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop __ \select ttype :_exception_Struct_Tuple -> int %LCLop __ \select ttype :_exception_Struct -> _int_Obj %LCLop EIO : -> _eerrno0e_Enum %LCLop __ \select name :_exception_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select name :_exception_Struct -> ___char_Obj_Ptr_Obj %LCLop ENXIO : -> _eerrno0e_Enum %LCLop __ \field_arrow ttype :__exception_Struct_Ptr -> _int_Obj %LCLop __ \select arg1 :_exception_Struct_Tuple -> double %LCLop __ \select arg1 :_exception_Struct -> _double_Obj %LCLop E2BIG : -> _eerrno0e_Enum %LCLop __ \field_arrow name :__exception_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select arg2 :_exception_Struct_Tuple -> double %LCLop __ \select arg2 :_exception_Struct -> _double_Obj %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLop __ \field_arrow arg1 :__exception_Struct_Ptr -> _double_Obj %LCLop __ \select retval :_exception_Struct_Tuple -> double %LCLop __ \select retval :_exception_Struct -> _double_Obj %LCLop EBADF : -> _eerrno0e_Enum %LCLop __ \select sv_handler :_sigvec_Struct_Tuple -> _HOF_sort_43 %LCLop __ \select sv_handler :_sigvec_Struct -> _HOF_sort_43 %LCLop __ \field_arrow arg2 :__exception_Struct_Ptr -> _double_Obj %LCLop ECHILD : -> _eerrno0e_Enum %LCLop [__, __] :int, __char_Obj_Ptr -> _sigstack_Struct_Tuple %LCLop __ \select sv_mask :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_mask :_sigvec_Struct -> _int_Obj %LCLop __ \field_arrow retval :__exception_Struct_Ptr -> _double_Obj %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop __ [] :__exception_Struct_Ptr -> __exception_Struct_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :__double_Obj_Ptr -> __double_Obj_Arr %LCLop __ [] :__sigvec_Struct_Ptr -> __sigvec_Struct_Arr %LCLop __ [] :__sigaction_Struct_Ptr -> __sigaction_Struct_Arr %LCLop __ [] :__sigstack_Struct_Ptr -> __sigstack_Struct_Arr %LCLop __ [] :__sigcontext_Struct_Ptr -> __sigcontext_Struct_Arr %LCLop __ \field_arrow sv_handler :__sigvec_Struct_Ptr -> _HOF_sort_43 %LCLop __ \select sv_flags :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_flags :_sigvec_Struct -> _int_Obj %LCLop ENOMEM : -> _eerrno0e_Enum %LCLtag sigstack struct %LCLop __ \field_arrow sv_mask :__sigvec_Struct_Ptr -> _int_Obj %LCLop [__, __, __] :int, int, _HOF_sort_43 -> _sigvec_Struct_Tuple %LCLop [__, __, __] :int, int, _HOF_sort_50 -> _sigaction_Struct_Tuple %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop __ [__] :__exception_Struct_Tuple_Vec, int -> _exception_Struct_Tuple %LCLop __ [__] :__exception_Struct_Arr, int -> _exception_Struct %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :_double_Vec, int -> double %LCLop __ [__] :__double_Obj_Arr, int -> _double_Obj %LCLop __ [__] :__sigvec_Struct_Tuple_Vec, int -> _sigvec_Struct_Tuple %LCLop __ [__] :__sigvec_Struct_Arr, int -> _sigvec_Struct %LCLop __ [__] :__sigaction_Struct_Tuple_Vec, int -> _sigaction_Struct_Tuple %LCLop __ [__] :__sigaction_Struct_Arr, int -> _sigaction_Struct %LCLop __ [__] :__sigstack_Struct_Tuple_Vec, int -> _sigstack_Struct_Tuple %LCLop __ [__] :__sigstack_Struct_Arr, int -> _sigstack_Struct %LCLop __ [__] :__sigcontext_Struct_Tuple_Vec, int -> _sigcontext_Struct_Tuple %LCLop __ [__] :__sigcontext_Struct_Arr, int -> _sigcontext_Struct %LCLop __ \field_arrow sv_flags :__sigvec_Struct_Ptr -> _int_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop [__, __, __, __, __] :double, double, double, __char_Obj_Ptr, int -> _exception_Struct_Tuple %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop __ \select sa_handler :_sigaction_Struct_Tuple -> _HOF_sort_50 %LCLop __ \select sa_handler :_sigaction_Struct -> _HOF_sort_50 %LCLop EMFILE : -> _eerrno0e_Enum %LCLtag sigcontext struct %LCLop __ \select sa_mask :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_mask :_sigaction_Struct -> _int_Obj %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_handler :__sigaction_Struct_Ptr -> _HOF_sort_50 %LCLop __ \select sa_flags :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_flags :_sigaction_Struct -> _int_Obj %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop __ \field_arrow sa_mask :__sigaction_Struct_Ptr -> _int_Obj %LCLop EFBIG : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_flags :__sigaction_Struct_Ptr -> _int_Obj %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop 32 : -> double %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop EPIPE : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __] :int, int, int, int, int, _int_Vec, int, int, int, _int_Vec, int, int, int -> _sigcontext_Struct_Tuple %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop __ \select ss_sp :_sigstack_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select ss_sp :_sigstack_Struct -> ___char_Obj_Ptr_Obj %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \select ss_onstack :_sigstack_Struct_Tuple -> int %LCLop __ \select ss_onstack :_sigstack_Struct -> _int_Obj %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_sp :__sigstack_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_onstack :__sigstack_Struct_Ptr -> _int_Obj %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop NIL : -> __exception_Struct_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> __double_Obj_Ptr %LCLop NIL : -> __sigvec_Struct_Ptr %LCLop NIL : -> __sigaction_Struct_Ptr %LCLop NIL : -> __sigstack_Struct_Ptr %LCLop NIL : -> __sigcontext_Struct_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop __ + __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ + __ :int, __exception_Struct_Ptr -> __exception_Struct_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ + __ :int, __double_Obj_Ptr -> __double_Obj_Ptr %LCLop __ + __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ + __ :int, __sigvec_Struct_Ptr -> __sigvec_Struct_Ptr %LCLop __ + __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ + __ :int, __sigaction_Struct_Ptr -> __sigaction_Struct_Ptr %LCLop __ + __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ + __ :int, __sigstack_Struct_Ptr -> __sigstack_Struct_Ptr %LCLop __ + __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ + __ :int, __sigcontext_Struct_Ptr -> __sigcontext_Struct_Ptr %LCLop __ \select sc_onstack :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_onstack :_sigcontext_Struct -> _int_Obj %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop __ - __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ - __ :__exception_Struct_Ptr, __exception_Struct_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ - __ :__double_Obj_Ptr, __double_Obj_Ptr -> int %LCLop __ - __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ - __ :__sigvec_Struct_Ptr, __sigvec_Struct_Ptr -> int %LCLop __ - __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ - __ :__sigaction_Struct_Ptr, __sigaction_Struct_Ptr -> int %LCLop __ - __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ - __ :__sigstack_Struct_Ptr, __sigstack_Struct_Ptr -> int %LCLop __ - __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ - __ :__sigcontext_Struct_Ptr, __sigcontext_Struct_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop sizeof :_emath1e_Enum -> int %LCLop __ \select sc_mask :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mask :_sigcontext_Struct -> _int_Obj %LCLop DOMAIN : -> _emath1e_Enum %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_onstack :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_pc :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_pc :_sigcontext_Struct -> _int_Obj %LCLop SING : -> _emath1e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mask :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_regs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_regs :_sigcontext_Struct -> __int_Obj_Arr %LCLop OVERFLOW : -> _emath1e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLop isSub :__exception_Struct_Tuple_Vec, int -> bool %LCLop isSub :__exception_Struct_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :_double_Vec, int -> bool %LCLop isSub :__double_Obj_Arr, int -> bool %LCLop isSub :__sigvec_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigvec_Struct_Arr, int -> bool %LCLop isSub :__sigaction_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigaction_Struct_Arr, int -> bool %LCLop isSub :__sigstack_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigstack_Struct_Arr, int -> bool %LCLop isSub :__sigcontext_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigcontext_Struct_Arr, int -> bool %LCLtag lconv struct %LCLop __ \field_arrow sc_pc :__sigcontext_Struct_Ptr -> _int_Obj %LCLop UNDERFLOW : -> _emath1e_Enum %LCLop ELOOP : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_regs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_mdlo :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdlo :_sigcontext_Struct -> _int_Obj %LCLop TLOSS : -> _emath1e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop __ \select sc_mdhi :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdhi :_sigcontext_Struct -> _int_Obj %LCLop PLOSS : -> _emath1e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdlo :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_ownedfp :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_ownedfp :_sigcontext_Struct -> _int_Obj %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdhi :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpregs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_fpregs :_sigcontext_Struct -> __int_Obj_Arr %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLop __ \field_arrow sc_ownedfp :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpc_csr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_csr :_sigcontext_Struct -> _int_Obj %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop __ \field_arrow sc_fpregs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_fpc_eir :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_eir :_sigcontext_Struct -> _int_Obj %LCLop EUSERS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_csr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_cause :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_cause :_sigcontext_Struct -> _int_Obj %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_eir :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badvaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badvaddr :_sigcontext_Struct -> _int_Obj %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop __ \field_arrow sc_cause :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badpaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badpaddr :_sigcontext_Struct -> _int_Obj %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLtype ptrdiff_t _ptrdiff_t exposed %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/stdio.lcl0000644021234200000250000000607207121317316014764 0ustar fax/* ** stdio.lcl ** ** based on /usr/include/stdio.h on red-cross */ imports ; /* ** we need to allow casts to and from these types... ** they should be exposed, but unknown type. */ immutable type FILE; typedef void *va_list; typedef void *fpos_t; FILE *stdin; FILE *stdout; FILE *stderr; constant int EOF ; | int : char | getc (FILE *stream ) { ensures true; } | int : char | getchar (void) { ensures true; } | int : void | putc (| int : char | c, FILE *stream) { ensures true; } int putchar (|int : char| c) { ensures true; } | int : bool | feof (FILE *stream) { ensures true; } | int : bool | ferror (FILE *stream ) { ensures true; } int fileno (FILE *stream) { ensures true; } int _filbuf (FILE *p) { ensures true; } int _flsbuf (unsigned char x, FILE *p) { ensures true; } void clearerr (FILE *stream) { ensures true; } | int : void | fclose (FILE *stream ) { ensures true; } FILE * fdopen (int filedes, char *ttype) { ensures true; } | int : void | fflush (FILE *stream ) { ensures true; } | int : char | fgetc (FILE *stream ) { ensures true; } int fgetpos (FILE *stream, fpos_t *pos ) { ensures true; } char *fgets (char *s, int n, FILE *stream ) { ensures true; } FILE *fopen (char *filename, char *ttype ) { ensures true; } printflike | int : void | fprintf (FILE *stream, char *format, ...) { ensures true; } printflike | int : void | sprintf (FILE *stream, char *format, ...) { ensures true; } | int : void | fputc (| int : char | c, FILE *stream ) { ensures true; } | int : void | fputs( char *s, FILE *stream ) { ensures true; } size_t fread (void *ptr, size_t size, size_t nitems, FILE *stream ) { ensures true; } FILE *freopen (char *filename, char *ttype, FILE *stream) { ensures true; } scanflike int fscanf (FILE *stream, char *format, ... ) { ensures true; } | int : void | fseek (FILE *stream, long offset, int ptrname) { ensures true; } int fsetpos (FILE *stream, fpos_t *pos) { ensures true; } long ftell (FILE *stream) { ensures true; } size_t fwrite (void *ptr, size_t size, size_t nitems, FILE *stream) { ensures true; } char *gets (char *s) { ensures true; } void perror (char *s) { ensures true; } FILE *popen (char *command, char *ttype) { ensures true; } | int : void | ungetc(char c, FILE *stream) { ensures true; } printflike | int : void | printf (char *format, ...) { ensures true; } | int : void | puts (char *s) { ensures true; } | int : bool | remove (char *filename) { ensures true; } | int : bool | rename (char *from, char *to) { ensures true; } void rewind (FILE *stream) { ensures true; } scanflike | int : void | scanf (char *format, ...) { ensures true; } void setbuf (FILE *stream, char *buf) { ensures true; } int setvbuf (FILE *stream, char *buf, int ttype, size_t size ) { ensures true; } scanflike | int : void | sscanf (char *s, char *format, ...) { ensures true; } FILE *tmpfile( void ) { ensures true; } char *tmpnam (char *s) { ensures true; } splint-3.1.2.dfsg1/imports/stdio.lcs0000644021234200000250000004115707121317316014776 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _size_t synonym int nil %LCLsort _wchar_t synonym int nil %LCLsort _sstdlib0s_Struct str sstdlib0s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _int_Obj obj int nil %LCLsort _sstdlib0s_Struct_Tuple tup _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Ptr ptr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Arr arr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Tuple_Vec vec _sstdlib0s_Struct_Tuple __sstdlib0s_Struct_Arr %LCLsort _div_t synonym _sstdlib0s_Struct nil %LCLsort _sstdlib1s_Struct str sstdlib1s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib1s_Struct_Tuple tup _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Ptr ptr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Arr arr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Tuple_Vec vec _sstdlib1s_Struct_Tuple __sstdlib1s_Struct_Arr %LCLsort _ldiv_t synonym _sstdlib1s_Struct nil %LCLsort _void_Obj obj void nil %LCLsort __void_Obj_Ptr ptr _void_Obj nil %LCLsort __void_Obj_Arr arr _void_Obj nil %LCLsort _void_Vec vec void __void_Obj_Arr %LCLsort _HOF_sort_32 hof nil nil %LCLsort _HOF_sort_33 hof nil nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort _HOF_sort_37 hof nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort ____char_Obj_Ptr_Obj_Ptr ptr ___char_Obj_Ptr_Obj nil %LCLsort ____char_Obj_Ptr_Obj_Arr arr ___char_Obj_Ptr_Obj nil %LCLsort ___char_Obj_Ptr_Vec vec __char_Obj_Ptr ____char_Obj_Ptr_Obj_Arr %LCLsort FILE immutable nil nil %LCLsort _va_list synonym __void_Obj_Ptr nil %LCLsort _fpos_t synonym __void_Obj_Ptr nil %LCLsort _FILE_Obj obj FILE nil %LCLsort __FILE_Obj_Ptr ptr _FILE_Obj nil %LCLsort __FILE_Obj_Arr arr _FILE_Obj nil %LCLsort _FILE_Vec vec FILE __FILE_Obj_Arr %LCLsort ___FILE_Obj_Ptr_Obj obj __FILE_Obj_Ptr nil %LCLsort ___void_Obj_Ptr_Obj obj __void_Obj_Ptr nil %LCLsort ____void_Obj_Ptr_Obj_Ptr ptr ___void_Obj_Ptr_Obj nil %LCLsort ____void_Obj_Ptr_Obj_Arr arr ___void_Obj_Ptr_Obj nil %LCLsort ___void_Obj_Ptr_Vec vec __void_Obj_Ptr ____void_Obj_Ptr_Obj_Arr %LCLSortTableEnd %LCLSymbolTable %LCLop mod :int, int -> int %LCLop min :int, int -> int %LCLop max :int, int -> int %LCLop 0 : -> int %LCLop 0 : -> double %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop count :char, _char_Vec -> int %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop init :_char_Vec -> _char_Vec %LCLop isEmpty :_char_Vec -> bool %LCLop last :_char_Vec -> char %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop lenStr :_char_Vec -> int %LCLop times10plus :int, int -> int %LCLop plus1 :int -> int %LCLop 2 : -> int %LCLop 3 : -> int %LCLop 4 : -> int %LCLop 5 : -> int %LCLop 6 : -> int %LCLop 7 : -> int %LCLop 8 : -> int %LCLop 9 : -> int %LCLtag sstdlib0s struct %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLtag sstdlib1s struct %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop [__, __] :int, int -> _sstdlib0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib1s_Struct_Tuple %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Arr %LCLop __ [] :__sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Arr %LCLop __ [] :__void_Obj_Ptr -> __void_Obj_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Arr %LCLop __ [] :__FILE_Obj_Ptr -> __FILE_Obj_Arr %LCLop __ [] :____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Arr %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__sstdlib0s_Struct_Tuple_Vec, int -> _sstdlib0s_Struct_Tuple %LCLop __ [__] :__sstdlib0s_Struct_Arr, int -> _sstdlib0s_Struct %LCLop __ [__] :__sstdlib1s_Struct_Tuple_Vec, int -> _sstdlib1s_Struct_Tuple %LCLop __ [__] :__sstdlib1s_Struct_Arr, int -> _sstdlib1s_Struct %LCLop __ [__] :_void_Vec, int -> void %LCLop __ [__] :__void_Obj_Arr, int -> _void_Obj %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :___char_Obj_Ptr_Vec, int -> __char_Obj_Ptr %LCLop __ [__] :____char_Obj_Ptr_Obj_Arr, int -> ___char_Obj_Ptr_Obj %LCLop __ [__] :_FILE_Vec, int -> FILE %LCLop __ [__] :__FILE_Obj_Arr, int -> _FILE_Obj %LCLop __ [__] :___void_Obj_Ptr_Vec, int -> __void_Obj_Ptr %LCLop __ [__] :____void_Obj_Ptr_Obj_Arr, int -> ___void_Obj_Ptr_Obj %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop __ \select rem :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib1s_Struct -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop __ \select quot :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib1s_Struct -> _int_Obj %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop __ \field_arrow quot :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop null : -> char %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __sstdlib0s_Struct_Ptr %LCLop NIL : -> __sstdlib1s_Struct_Ptr %LCLop NIL : -> __void_Obj_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> ____char_Obj_Ptr_Obj_Ptr %LCLop NIL : -> __FILE_Obj_Ptr %LCLop NIL : -> ____void_Obj_Ptr_Obj_Ptr %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :int, __sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :int, __sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ + __ :int, __void_Obj_Ptr -> __void_Obj_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :int, ____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ + __ :int, __FILE_Obj_Ptr -> __FILE_Obj_Ptr %LCLop __ + __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ + __ :int, ____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ - __ :__sstdlib0s_Struct_Ptr, __sstdlib0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ - __ :__sstdlib1s_Struct_Ptr, __sstdlib1s_Struct_Ptr -> int %LCLop __ - __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ - __ :__void_Obj_Ptr, __void_Obj_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> int %LCLop __ - __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ - __ :__FILE_Obj_Ptr, __FILE_Obj_Ptr -> int %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, ____void_Obj_Ptr_Obj_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :FILE -> int %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__sstdlib0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib1s_Struct_Arr, int -> bool %LCLop isSub :_void_Vec, int -> bool %LCLop isSub :__void_Obj_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :___char_Obj_Ptr_Vec, int -> bool %LCLop isSub :____char_Obj_Ptr_Obj_Arr, int -> bool %LCLop isSub :_FILE_Vec, int -> bool %LCLop isSub :__FILE_Obj_Arr, int -> bool %LCLop isSub :___void_Obj_Ptr_Vec, int -> bool %LCLop isSub :____void_Obj_Ptr_Obj_Arr, int -> bool %LCLop succ :int -> int %LCLop pred :int -> int %LCLop abs :int -> int %LCLop abs :double -> double %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLtype size_t _size_t exposed %LCLtype wchar_t _wchar_t exposed %LCLtype div_t _div_t exposed %LCLtype ldiv_t _ldiv_t exposed %LCLconst NULL __void_Obj_Ptr %LCLconst EXIT_FAILURE int %LCLconst EXIT_SUCCESS int %LCLconst RAND_MAX int %LCLconst MB_CUR_MAX int %LCLfcn abort : -> void %LCLfcnGlobals %LCLfcn abs : int -> int %LCLfcnGlobals %LCLfcn atexit : _HOF_sort_32 -> int %LCLfcnGlobals %LCLfcn atof : __char_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn atoi : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn atol : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn bsearch : __void_Obj_Ptr, __void_Obj_Ptr, int, int, _HOF_sort_33 -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn calloc : int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn div : int, int -> _sstdlib0s_Struct %LCLfcnGlobals %LCLfcn exit : int -> void %LCLfcnGlobals %LCLfcn free : __void_Obj_Ptr -> void %LCLfcnGlobals %LCLfcn getenv : __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn labs : int -> int %LCLfcnGlobals %LCLfcn ldiv : int, int -> _sstdlib1s_Struct %LCLfcnGlobals %LCLfcn malloc : int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn mblen : __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn mbstowcs : __int_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn mbtowc : __int_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn qsort : __void_Obj_Ptr, int, int, _HOF_sort_37 -> void %LCLfcnGlobals %LCLfcn rand : -> int %LCLfcnGlobals %LCLfcn realloc : __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn srand : int -> void %LCLfcnGlobals %LCLfcn strtod : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn strtol : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn strtoul : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn system : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn wcstombs : __char_Obj_Ptr, __int_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn wctomb : __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn bcopy : __char_Obj_Ptr, __char_Obj_Ptr, int -> void %LCLfcnGlobals %LCLfcn bcmp : __char_Obj_Ptr, __char_Obj_Ptr, int -> bool %LCLfcnGlobals %LCLfcn bzero : __char_Obj_Ptr, int -> void %LCLfcnGlobals %LCLfcn ffs : int -> int %LCLfcnGlobals %LCLfcn memccpy : __void_Obj_Ptr, __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memchr : __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memcmp : __void_Obj_Ptr, __void_Obj_Ptr, int -> bool %LCLfcnGlobals %LCLfcn memcpy : __void_Obj_Ptr, __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memset : __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memmove : __void_Obj_Ptr, __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLtype FILE FILE immutable %LCLtype va_list _va_list exposed %LCLtype fpos_t _fpos_t exposed %LCLvar stdin ___FILE_Obj_Ptr_Obj %LCLvar stdout ___FILE_Obj_Ptr_Obj %LCLvar stderr ___FILE_Obj_Ptr_Obj %LCLconst EOF int %LCLfcn getc : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn getchar : -> int %LCLfcnGlobals %LCLfcn putc : int, __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn putchar : int -> int %LCLfcnGlobals %LCLfcn feof : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn ferror : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fileno : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn _filbuf : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn _flsbuf : char, __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn clearerr : __FILE_Obj_Ptr -> void %LCLfcnGlobals %LCLfcn fclose : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fdopen : int, __char_Obj_Ptr -> __FILE_Obj_Ptr %LCLfcnGlobals %LCLfcn fflush : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fgetc : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fgetpos : __FILE_Obj_Ptr, ____void_Obj_Ptr_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fgets : __char_Obj_Ptr, int, __FILE_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn fopen : __char_Obj_Ptr, __char_Obj_Ptr -> __FILE_Obj_Ptr %LCLfcnGlobals %LCLfcn fprintf : __FILE_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn sprintf : __FILE_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fputc : int, __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fputs : __char_Obj_Ptr, __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fread : __void_Obj_Ptr, int, int, __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn freopen : __char_Obj_Ptr, __char_Obj_Ptr, __FILE_Obj_Ptr -> __FILE_Obj_Ptr %LCLfcnGlobals %LCLfcn fscanf : __FILE_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fseek : __FILE_Obj_Ptr, int, int -> int %LCLfcnGlobals %LCLfcn fsetpos : __FILE_Obj_Ptr, ____void_Obj_Ptr_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn ftell : __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn fwrite : __void_Obj_Ptr, int, int, __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn gets : __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn perror : __char_Obj_Ptr -> void %LCLfcnGlobals %LCLfcn popen : __char_Obj_Ptr, __char_Obj_Ptr -> __FILE_Obj_Ptr %LCLfcnGlobals %LCLfcn ungetc : char, __FILE_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn printf : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn puts : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn remove : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn rename : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn rewind : __FILE_Obj_Ptr -> void %LCLfcnGlobals %LCLfcn scanf : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn setbuf : __FILE_Obj_Ptr, __char_Obj_Ptr -> void %LCLfcnGlobals %LCLfcn setvbuf : __FILE_Obj_Ptr, __char_Obj_Ptr, int, int -> int %LCLfcnGlobals %LCLfcn sscanf : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn tmpfile : -> __FILE_Obj_Ptr %LCLfcnGlobals %LCLfcn tmpnam : __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/stdlib.lcl0000644021234200000250000000624507121317316015125 0ustar fax/* ** stdlib.lcl ** ** based on red-cross:/usr/include/stdlib.h ** also includes misc functions from man bcopy ** man memory */ typedef unsigned int size_t; typedef unsigned int wchar_t; typedef struct { int quot; /* quotient */ int rem; /* remainder */ } div_t; /* result of div() */ typedef struct { long quot; /* quotient */ long rem; /* remainder */ } ldiv_t; /* result of ldiv() */ constant null void *NULL; /* should be constant */ constant int EXIT_FAILURE, EXIT_SUCCESS; constant long RAND_MAX; constant int MB_CUR_MAX; void abort(void) { ensures true; } int abs(int i) { ensures result = abs(i); } int atexit (void (*f)()) { ensures true; } double atof (char *nptr) { ensures true ; /* sprintf(result) = nptr^ ? */ } int atoi (char *nptr) { ensures true ; } long atol (char *nptr) { ensures true ; } void *bsearch (void *key, void *base, size_t nel, size_t size, int (*compar)(void *, void *)) { ensures true ; } void *calloc (size_t nelem, size_t size) { ensures true ; } div_t div (int numer, int denom) { ensures true; } void exit(int status) { ensures true; } void free(void *ptr) { modifies *ptr; ensures true; /* trashed(ptr); */ } char *getenv (char *name) { ensures true; } long labs (long j) { ensures true; } ldiv_t ldiv (long numer, long denum) { ensures true; } void *malloc (size_t size) { ensures true; } int mblen (char *s, size_t n) { ensures true; } size_t mbstowcs ( wchar_t *pwcs, char *s, size_t n) { modifies *pwcs; ensures true; } int mbtowc (wchar_t *pwc, char *s, size_t n) { modifies *pwc; ensures true; } void qsort (void *base, size_t nel, size_t width, int (*compar)(void *, void *)) { modifies *base; ensures true; } int rand (void) { ensures true; } void *realloc(void *ptr, size_t size) { ensures true; } void srand (unsigned int seed) { ensures true; } double strtod (char *nptr, char **eptr) { modifies *eptr; ensures true; } long strtol (char *nptr, char **eptr, int base) { modifies *eptr; ensures true; } unsigned long strtoul (char *nptr, char **eptr, int base) { modifies *eptr; ensures true; } int system (char *string) { ensures true; } size_t wcstombs (char *s, wchar_t *pwcs, size_t n) { modifies *s; ensures true; } int wctomb (char *s, wchar_t wchar) { modifies *s; ensures true; } /* ** not part of stdlib.h, but built in to c? */ void bcopy (char *b1, char *b2, int length) { modifies *b2; ensures true; } | bool : int | bcmp (char *b1, char *b2, int length) { ensures true; } void bzero (char *b1, int length) { modifies *b1; ensures true; } int ffs (int i) { ensures true; } void *memccpy (void *s1, void *s2, int c, size_t n) { modifies *s1; ensures true; } void *memchr (void *s, int c, size_t n) { ensures true; } | bool : int | memcmp (void *s1, void *s2, size_t n) { ensures true; } void *memcpy (void *s1, void *s2, size_t n) { modifies *s1; ensures true; } void *memset (void *s, int c, size_t n) { modifies *s; ensures true; } void *memmove (void *s1, void *s2, size_t n) { modifies *s1; ensures true; } splint-3.1.2.dfsg1/imports/stdlib.lcs0000644021234200000250000002752307121317316015136 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _size_t synonym int nil %LCLsort _wchar_t synonym int nil %LCLsort _sstdlib0s_Struct str sstdlib0s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _int_Obj obj int nil %LCLsort _sstdlib0s_Struct_Tuple tup _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Ptr ptr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Arr arr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Tuple_Vec vec _sstdlib0s_Struct_Tuple __sstdlib0s_Struct_Arr %LCLsort _div_t synonym _sstdlib0s_Struct nil %LCLsort _sstdlib1s_Struct str sstdlib1s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib1s_Struct_Tuple tup _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Ptr ptr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Arr arr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Tuple_Vec vec _sstdlib1s_Struct_Tuple __sstdlib1s_Struct_Arr %LCLsort _ldiv_t synonym _sstdlib1s_Struct nil %LCLsort _void_Obj obj void nil %LCLsort __void_Obj_Ptr ptr _void_Obj nil %LCLsort __void_Obj_Arr arr _void_Obj nil %LCLsort _void_Vec vec void __void_Obj_Arr %LCLsort _HOF_sort_32 hof nil nil %LCLsort _HOF_sort_33 hof nil nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort _HOF_sort_37 hof nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort ____char_Obj_Ptr_Obj_Ptr ptr ___char_Obj_Ptr_Obj nil %LCLsort ____char_Obj_Ptr_Obj_Arr arr ___char_Obj_Ptr_Obj nil %LCLsort ___char_Obj_Ptr_Vec vec __char_Obj_Ptr ____char_Obj_Ptr_Obj_Arr %LCLSortTableEnd %LCLSymbolTable %LCLop mod :int, int -> int %LCLop min :int, int -> int %LCLop max :int, int -> int %LCLop 0 : -> int %LCLop 0 : -> double %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop count :char, _char_Vec -> int %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop init :_char_Vec -> _char_Vec %LCLop isEmpty :_char_Vec -> bool %LCLop last :_char_Vec -> char %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop lenStr :_char_Vec -> int %LCLop times10plus :int, int -> int %LCLop plus1 :int -> int %LCLop 2 : -> int %LCLop 3 : -> int %LCLop 4 : -> int %LCLop 5 : -> int %LCLop 6 : -> int %LCLop 7 : -> int %LCLop 8 : -> int %LCLop 9 : -> int %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop { __ } :char -> _char_Vec %LCLop [__, __] :int, int -> _sstdlib0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib1s_Struct_Tuple %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Arr %LCLop __ [] :__sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Arr %LCLop __ [] :__void_Obj_Ptr -> __void_Obj_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Arr %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__sstdlib0s_Struct_Tuple_Vec, int -> _sstdlib0s_Struct_Tuple %LCLop __ [__] :__sstdlib0s_Struct_Arr, int -> _sstdlib0s_Struct %LCLop __ [__] :__sstdlib1s_Struct_Tuple_Vec, int -> _sstdlib1s_Struct_Tuple %LCLop __ [__] :__sstdlib1s_Struct_Arr, int -> _sstdlib1s_Struct %LCLop __ [__] :_void_Vec, int -> void %LCLop __ [__] :__void_Obj_Arr, int -> _void_Obj %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :___char_Obj_Ptr_Vec, int -> __char_Obj_Ptr %LCLop __ [__] :____char_Obj_Ptr_Obj_Arr, int -> ___char_Obj_Ptr_Obj %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop __ \select quot :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib1s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib1s_Struct -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop null : -> char %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __sstdlib0s_Struct_Ptr %LCLop NIL : -> __sstdlib1s_Struct_Ptr %LCLop NIL : -> __void_Obj_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> ____char_Obj_Ptr_Obj_Ptr %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :int, __sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :int, __sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ + __ :int, __void_Obj_Ptr -> __void_Obj_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :int, ____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ - __ :__sstdlib0s_Struct_Ptr, __sstdlib0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ - __ :__sstdlib1s_Struct_Ptr, __sstdlib1s_Struct_Ptr -> int %LCLop __ - __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ - __ :__void_Obj_Ptr, __void_Obj_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__sstdlib0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib1s_Struct_Arr, int -> bool %LCLop isSub :_void_Vec, int -> bool %LCLop isSub :__void_Obj_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :___char_Obj_Ptr_Vec, int -> bool %LCLop isSub :____char_Obj_Ptr_Obj_Arr, int -> bool %LCLop succ :int -> int %LCLop pred :int -> int %LCLop abs :int -> int %LCLop abs :double -> double %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLtype size_t _size_t exposed %LCLtype wchar_t _wchar_t exposed %LCLtype div_t _div_t exposed %LCLtype ldiv_t _ldiv_t exposed %LCLconst NULL __void_Obj_Ptr %LCLconst EXIT_FAILURE int %LCLconst EXIT_SUCCESS int %LCLconst RAND_MAX int %LCLconst MB_CUR_MAX int %LCLfcn abort : -> void %LCLfcnGlobals %LCLfcn abs : int -> int %LCLfcnGlobals %LCLfcn atexit : _HOF_sort_32 -> int %LCLfcnGlobals %LCLfcn atof : __char_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn atoi : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn atol : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn bsearch : __void_Obj_Ptr, __void_Obj_Ptr, int, int, _HOF_sort_33 -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn calloc : int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn div : int, int -> _sstdlib0s_Struct %LCLfcnGlobals %LCLfcn exit : int -> void %LCLfcnGlobals %LCLfcn free : __void_Obj_Ptr -> void %LCLfcnGlobals %LCLfcn getenv : __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn labs : int -> int %LCLfcnGlobals %LCLfcn ldiv : int, int -> _sstdlib1s_Struct %LCLfcnGlobals %LCLfcn malloc : int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn mblen : __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn mbstowcs : __int_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn mbtowc : __int_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn qsort : __void_Obj_Ptr, int, int, _HOF_sort_37 -> void %LCLfcnGlobals %LCLfcn rand : -> int %LCLfcnGlobals %LCLfcn realloc : __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn srand : int -> void %LCLfcnGlobals %LCLfcn strtod : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn strtol : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn strtoul : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn system : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn wcstombs : __char_Obj_Ptr, __int_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn wctomb : __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn bcopy : __char_Obj_Ptr, __char_Obj_Ptr, int -> void %LCLfcnGlobals %LCLfcn bcmp : __char_Obj_Ptr, __char_Obj_Ptr, int -> bool %LCLfcnGlobals %LCLfcn bzero : __char_Obj_Ptr, int -> void %LCLfcnGlobals %LCLfcn ffs : int -> int %LCLfcnGlobals %LCLfcn memccpy : __void_Obj_Ptr, __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memchr : __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memcmp : __void_Obj_Ptr, __void_Obj_Ptr, int -> bool %LCLfcnGlobals %LCLfcn memcpy : __void_Obj_Ptr, __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memset : __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memmove : __void_Obj_Ptr, __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/string.lcl0000644021234200000250000000200307121317316015136 0ustar fax/* ** strings.lcl */ int strcasecmp(char *s1, char *s2) { ensures true ; } int strncasecmp(char *s1, char *s2, int n) { ensures true ; } char *strcat(char *s1, char *s2) { ensures true ; } char *strncat(char *s1, char *s2, int n) { ensures true ; } int strcmp(char *s1, char *s2) { ensures true ; } int strncmp(char *s1, char *s2, int n) { ensures true ; } | char : void | *strcpy(char *s1, char *s2) { ensures true ; } char *strncpy(char *s1, char *s2, int n) { ensures true ; } int strlen(char *s) { ensures true ; } char *strchr(char *s, int c) { ensures true ; } char *strrchr(char *s, int c) { ensures true ; } char *strpbrk(char *s1, char *s2) { ensures true ; } int strspn(char *s1, char *s2) { ensures true ; } int strcspn(char *s1, char *s2) { ensures true ; } char *strtok(char *s1, char *s2) { ensures true ; } char *index(char *s, char c) { ensures true ; } char *rindex(char *s, char c) { ensures true ; } char *strstr(char *s1, char *s2) { ensures true ; } splint-3.1.2.dfsg1/imports/string.lcs0000644021234200000250000012247107121317316015161 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLsort _exception_Struct str exception nil %LCLsort retval strMem _double_Obj nil %LCLsort arg2 strMem _double_Obj nil %LCLsort arg1 strMem _double_Obj nil %LCLsort name strMem ___char_Obj_Ptr_Obj nil %LCLsort ttype strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _double_Obj obj double nil %LCLsort _exception_Struct_Tuple tup _exception_Struct nil %LCLsort __exception_Struct_Ptr ptr _exception_Struct nil %LCLsort __exception_Struct_Arr arr _exception_Struct nil %LCLsort __exception_Struct_Tuple_Vec vec _exception_Struct_Tuple __exception_Struct_Arr %LCLsort ___exception synonym _exception_Struct nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort __double_Obj_Ptr ptr _double_Obj nil %LCLsort __double_Obj_Arr arr _double_Obj nil %LCLsort _double_Vec vec double __double_Obj_Arr %LCLsort _emath1e_Enum enum emath1e nil %LCLsort PLOSS enumMem nil nil %LCLsort TLOSS enumMem nil nil %LCLsort UNDERFLOW enumMem nil nil %LCLsort OVERFLOW enumMem nil nil %LCLsort SING enumMem nil nil %LCLsort DOMAIN enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __emath1e_Enum_Obj obj _emath1e_Enum nil %LCLsort _jmp_buf synonym __int_Obj_Arr nil %LCLsort _sigjmp_buf synonym __int_Obj_Arr nil %LCLsort _sig_atomic_t synonym int nil %LCLsort _sigset_t synonym int nil %LCLsort _sigvec_Struct str sigvec nil %LCLsort sv_flags strMem _int_Obj nil %LCLsort sv_mask strMem _int_Obj nil %LCLsort sv_handler strMem _HOF_sort_43 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_43 hof nil nil %LCLsort _sigvec_Struct_Tuple tup _sigvec_Struct nil %LCLsort __sigvec_Struct_Ptr ptr _sigvec_Struct nil %LCLsort __sigvec_Struct_Arr arr _sigvec_Struct nil %LCLsort __sigvec_Struct_Tuple_Vec vec _sigvec_Struct_Tuple __sigvec_Struct_Arr %LCLsort ___sigvec synonym _sigvec_Struct nil %LCLsort _sigaction_Struct str sigaction nil %LCLsort sa_flags strMem _int_Obj nil %LCLsort sa_mask strMem _int_Obj nil %LCLsort sa_handler strMem _HOF_sort_50 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_50 hof nil nil %LCLsort _sigaction_Struct_Tuple tup _sigaction_Struct nil %LCLsort __sigaction_Struct_Ptr ptr _sigaction_Struct nil %LCLsort __sigaction_Struct_Arr arr _sigaction_Struct nil %LCLsort __sigaction_Struct_Tuple_Vec vec _sigaction_Struct_Tuple __sigaction_Struct_Arr %LCLsort ___sigaction synonym _sigaction_Struct nil %LCLsort _sigstack_Struct str sigstack nil %LCLsort ss_onstack strMem _int_Obj nil %LCLsort ss_sp strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigstack_Struct_Tuple tup _sigstack_Struct nil %LCLsort __sigstack_Struct_Ptr ptr _sigstack_Struct nil %LCLsort __sigstack_Struct_Arr arr _sigstack_Struct nil %LCLsort __sigstack_Struct_Tuple_Vec vec _sigstack_Struct_Tuple __sigstack_Struct_Arr %LCLsort ___sigstack synonym _sigstack_Struct nil %LCLsort _sigcontext_Struct str sigcontext nil %LCLsort sc_badpaddr strMem _int_Obj nil %LCLsort sc_badvaddr strMem _int_Obj nil %LCLsort sc_cause strMem _int_Obj nil %LCLsort sc_fpc_eir strMem _int_Obj nil %LCLsort sc_fpc_csr strMem _int_Obj nil %LCLsort sc_fpregs strMem __int_Obj_Arr nil %LCLsort sc_ownedfp strMem _int_Obj nil %LCLsort sc_mdhi strMem _int_Obj nil %LCLsort sc_mdlo strMem _int_Obj nil %LCLsort sc_regs strMem __int_Obj_Arr nil %LCLsort sc_pc strMem _int_Obj nil %LCLsort sc_mask strMem _int_Obj nil %LCLsort sc_onstack strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigcontext_Struct_Tuple tup _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Ptr ptr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Arr arr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Tuple_Vec vec _sigcontext_Struct_Tuple __sigcontext_Struct_Arr %LCLsort ___sigcontext synonym _sigcontext_Struct nil %LCLsort _HOF_sort_68 hof nil nil %LCLsort ___scp synonym _HOF_sort_68 nil %LCLsort _pid_t synonym int nil %LCLsort _ptrdiff_t synonym int nil %LCLsort _size_t synonym int nil %LCLsort _wchar_t synonym int nil %LCLsort _sstdlib_lcl0s_Struct str sstdlib_lcl0s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib_lcl0s_Struct_Tuple tup _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Ptr ptr _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Arr arr _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Tuple_Vec vec _sstdlib_lcl0s_Struct_Tuple __sstdlib_lcl0s_Struct_Arr %LCLsort _div_t synonym _sstdlib_lcl0s_Struct nil %LCLsort _sstdlib_lcl1s_Struct str sstdlib_lcl1s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib_lcl1s_Struct_Tuple tup _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Ptr ptr _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Arr arr _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Tuple_Vec vec _sstdlib_lcl1s_Struct_Tuple __sstdlib_lcl1s_Struct_Arr %LCLsort _ldiv_t synonym _sstdlib_lcl1s_Struct nil %LCLsort _void_Obj obj void nil %LCLsort __void_Obj_Ptr ptr _void_Obj nil %LCLsort __void_Obj_Arr arr _void_Obj nil %LCLsort _void_Vec vec void __void_Obj_Arr %LCLsort ____vp synonym __void_Obj_Ptr nil %LCLsort _HOF_Sort_33 hof nil nil %LCLsort _HOF_Sort_34 hof nil nil %LCLsort _HOF_Sort_38 hof nil nil %LCLsort ____char_Obj_Ptr_Obj_Ptr ptr ___char_Obj_Ptr_Obj nil %LCLsort ____char_Obj_Ptr_Obj_Arr arr ___char_Obj_Ptr_Obj nil %LCLsort ___char_Obj_Ptr_Vec vec __char_Obj_Ptr ____char_Obj_Ptr_Obj_Arr %LCLsort FILE immutable nil nil %LCLsort _va_list synonym __void_Obj_Ptr nil %LCLsort _fpos_t synonym __void_Obj_Ptr nil %LCLsort _FILE_Obj obj FILE nil %LCLsort __FILE_Obj_Ptr ptr _FILE_Obj nil %LCLsort __FILE_Obj_Arr arr _FILE_Obj nil %LCLsort _FILE_Vec vec FILE __FILE_Obj_Arr %LCLsort ___FILE_Obj_Ptr_Obj obj __FILE_Obj_Ptr nil %LCLsort ___void_Obj_Ptr_Obj obj __void_Obj_Ptr nil %LCLsort ____void_Obj_Ptr_Obj_Ptr ptr ___void_Obj_Ptr_Obj nil %LCLsort ____void_Obj_Ptr_Obj_Arr arr ___void_Obj_Ptr_Obj nil %LCLsort ___void_Obj_Ptr_Vec vec __void_Obj_Ptr ____void_Obj_Ptr_Obj_Arr %LCLsort _sstdlib0s_Struct str sstdlib0s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib0s_Struct_Tuple tup _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Ptr ptr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Arr arr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Tuple_Vec vec _sstdlib0s_Struct_Tuple __sstdlib0s_Struct_Arr %LCLsort _sstdlib1s_Struct str sstdlib1s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib1s_Struct_Tuple tup _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Ptr ptr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Arr arr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Tuple_Vec vec _sstdlib1s_Struct_Tuple __sstdlib1s_Struct_Arr %LCLsort _HOF_sort_119 hof nil nil %LCLsort _HOF_sort_120 hof nil nil %LCLsort _HOF_sort_121 hof nil nil %LCLsort _HOF_sort_122 hof nil nil %LCLsort _HOF_sort_123 hof nil nil %LCLsort _HOF_sort_124 hof nil nil %LCLsort _HOF_sort_125 hof nil nil %LCLsort _HOF_sort_126 hof nil nil %LCLsort _HOF_sort_127 hof nil nil %LCLSortTableEnd %LCLSymbolTable %LCLop __ \field_arrow sc_badvaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop __ \field_arrow sc_badpaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLtag sstdlib_lcl0s struct %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLtag eerrno0e enum %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLtag exception struct %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLtag sstdlib_lcl1s struct %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLtag sigvec struct %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLtag sigaction struct %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \select rem :_sstdlib_lcl0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib_lcl0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib_lcl1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib_lcl1s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib1s_Struct -> _int_Obj %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \select quot :_sstdlib_lcl0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib_lcl0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib_lcl1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib_lcl1s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib1s_Struct -> _int_Obj %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop __ \field_arrow rem :__sstdlib_lcl0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib_lcl1s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop { __ } :char -> _char_Vec %LCLop __ \field_arrow quot :__sstdlib_lcl0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib_lcl1s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLtag sstdlib0s struct %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop __ \select ttype :_exception_Struct_Tuple -> int %LCLop __ \select ttype :_exception_Struct -> _int_Obj %LCLop EIO : -> _eerrno0e_Enum %LCLop __ \select name :_exception_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select name :_exception_Struct -> ___char_Obj_Ptr_Obj %LCLop ENXIO : -> _eerrno0e_Enum %LCLop __ \field_arrow ttype :__exception_Struct_Ptr -> _int_Obj %LCLop __ \select arg1 :_exception_Struct_Tuple -> double %LCLop __ \select arg1 :_exception_Struct -> _double_Obj %LCLop E2BIG : -> _eerrno0e_Enum %LCLop __ \field_arrow name :__exception_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select arg2 :_exception_Struct_Tuple -> double %LCLop __ \select arg2 :_exception_Struct -> _double_Obj %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLtag sstdlib1s struct %LCLop __ \field_arrow arg1 :__exception_Struct_Ptr -> _double_Obj %LCLop __ \select retval :_exception_Struct_Tuple -> double %LCLop __ \select retval :_exception_Struct -> _double_Obj %LCLop EBADF : -> _eerrno0e_Enum %LCLop __ \select sv_handler :_sigvec_Struct_Tuple -> _HOF_sort_43 %LCLop __ \select sv_handler :_sigvec_Struct -> _HOF_sort_43 %LCLop __ \field_arrow arg2 :__exception_Struct_Ptr -> _double_Obj %LCLop ECHILD : -> _eerrno0e_Enum %LCLop [__, __] :int, __char_Obj_Ptr -> _sigstack_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib_lcl0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib_lcl1s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib1s_Struct_Tuple %LCLop __ \select sv_mask :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_mask :_sigvec_Struct -> _int_Obj %LCLop __ \field_arrow retval :__exception_Struct_Ptr -> _double_Obj %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop __ [] :__exception_Struct_Ptr -> __exception_Struct_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :__double_Obj_Ptr -> __double_Obj_Arr %LCLop __ [] :__sigvec_Struct_Ptr -> __sigvec_Struct_Arr %LCLop __ [] :__sigaction_Struct_Ptr -> __sigaction_Struct_Arr %LCLop __ [] :__sigstack_Struct_Ptr -> __sigstack_Struct_Arr %LCLop __ [] :__sigcontext_Struct_Ptr -> __sigcontext_Struct_Arr %LCLop __ [] :__sstdlib_lcl0s_Struct_Ptr -> __sstdlib_lcl0s_Struct_Arr %LCLop __ [] :__sstdlib_lcl1s_Struct_Ptr -> __sstdlib_lcl1s_Struct_Arr %LCLop __ [] :__void_Obj_Ptr -> __void_Obj_Arr %LCLop __ [] :____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Arr %LCLop __ [] :__FILE_Obj_Ptr -> __FILE_Obj_Arr %LCLop __ [] :____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Arr %LCLop __ [] :__sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Arr %LCLop __ [] :__sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Arr %LCLop __ \field_arrow sv_handler :__sigvec_Struct_Ptr -> _HOF_sort_43 %LCLop __ \select sv_flags :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_flags :_sigvec_Struct -> _int_Obj %LCLop ENOMEM : -> _eerrno0e_Enum %LCLtag sigstack struct %LCLop __ \field_arrow sv_mask :__sigvec_Struct_Ptr -> _int_Obj %LCLop [__, __, __] :int, int, _HOF_sort_43 -> _sigvec_Struct_Tuple %LCLop [__, __, __] :int, int, _HOF_sort_50 -> _sigaction_Struct_Tuple %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop __ [__] :__exception_Struct_Tuple_Vec, int -> _exception_Struct_Tuple %LCLop __ [__] :__exception_Struct_Arr, int -> _exception_Struct %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :_double_Vec, int -> double %LCLop __ [__] :__double_Obj_Arr, int -> _double_Obj %LCLop __ [__] :__sigvec_Struct_Tuple_Vec, int -> _sigvec_Struct_Tuple %LCLop __ [__] :__sigvec_Struct_Arr, int -> _sigvec_Struct %LCLop __ [__] :__sigaction_Struct_Tuple_Vec, int -> _sigaction_Struct_Tuple %LCLop __ [__] :__sigaction_Struct_Arr, int -> _sigaction_Struct %LCLop __ [__] :__sigstack_Struct_Tuple_Vec, int -> _sigstack_Struct_Tuple %LCLop __ [__] :__sigstack_Struct_Arr, int -> _sigstack_Struct %LCLop __ [__] :__sigcontext_Struct_Tuple_Vec, int -> _sigcontext_Struct_Tuple %LCLop __ [__] :__sigcontext_Struct_Arr, int -> _sigcontext_Struct %LCLop __ [__] :__sstdlib_lcl0s_Struct_Tuple_Vec, int -> _sstdlib_lcl0s_Struct_Tuple %LCLop __ [__] :__sstdlib_lcl0s_Struct_Arr, int -> _sstdlib_lcl0s_Struct %LCLop __ [__] :__sstdlib_lcl1s_Struct_Tuple_Vec, int -> _sstdlib_lcl1s_Struct_Tuple %LCLop __ [__] :__sstdlib_lcl1s_Struct_Arr, int -> _sstdlib_lcl1s_Struct %LCLop __ [__] :_void_Vec, int -> void %LCLop __ [__] :__void_Obj_Arr, int -> _void_Obj %LCLop __ [__] :___char_Obj_Ptr_Vec, int -> __char_Obj_Ptr %LCLop __ [__] :____char_Obj_Ptr_Obj_Arr, int -> ___char_Obj_Ptr_Obj %LCLop __ [__] :_FILE_Vec, int -> FILE %LCLop __ [__] :__FILE_Obj_Arr, int -> _FILE_Obj %LCLop __ [__] :___void_Obj_Ptr_Vec, int -> __void_Obj_Ptr %LCLop __ [__] :____void_Obj_Ptr_Obj_Arr, int -> ___void_Obj_Ptr_Obj %LCLop __ [__] :__sstdlib0s_Struct_Tuple_Vec, int -> _sstdlib0s_Struct_Tuple %LCLop __ [__] :__sstdlib0s_Struct_Arr, int -> _sstdlib0s_Struct %LCLop __ [__] :__sstdlib1s_Struct_Tuple_Vec, int -> _sstdlib1s_Struct_Tuple %LCLop __ [__] :__sstdlib1s_Struct_Arr, int -> _sstdlib1s_Struct %LCLop __ \field_arrow sv_flags :__sigvec_Struct_Ptr -> _int_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop [__, __, __, __, __] :double, double, double, __char_Obj_Ptr, int -> _exception_Struct_Tuple %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop \A :bool, bool -> bool %LCLop \A :int, bool -> bool %LCLop \A :double, bool -> bool %LCLop \A :_char_Vec, bool -> bool %LCLop \A :char, bool -> bool %LCLop __ \select sa_handler :_sigaction_Struct_Tuple -> _HOF_sort_50 %LCLop __ \select sa_handler :_sigaction_Struct -> _HOF_sort_50 %LCLop EMFILE : -> _eerrno0e_Enum %LCLtag sigcontext struct %LCLop \E :bool, bool -> bool %LCLop \E :int, bool -> bool %LCLop \E :double, bool -> bool %LCLop \E :_char_Vec, bool -> bool %LCLop \E :char, bool -> bool %LCLop __ \select sa_mask :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_mask :_sigaction_Struct -> _int_Obj %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_handler :__sigaction_Struct_Ptr -> _HOF_sort_50 %LCLop __ \select sa_flags :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_flags :_sigaction_Struct -> _int_Obj %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop __ \field_arrow sa_mask :__sigaction_Struct_Ptr -> _int_Obj %LCLop EFBIG : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_flags :__sigaction_Struct_Ptr -> _int_Obj %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop 32 : -> double %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop __ \iff __ :bool, bool -> bool %LCLop EPIPE : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __] :int, int, int, int, int, _int_Vec, int, int, int, _int_Vec, int, int, int -> _sigcontext_Struct_Tuple %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop __ \select ss_sp :_sigstack_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select ss_sp :_sigstack_Struct -> ___char_Obj_Ptr_Obj %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \select ss_onstack :_sigstack_Struct_Tuple -> int %LCLop __ \select ss_onstack :_sigstack_Struct -> _int_Obj %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_sp :__sigstack_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_onstack :__sigstack_Struct_Ptr -> _int_Obj %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop NIL : -> __exception_Struct_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> __double_Obj_Ptr %LCLop NIL : -> __sigvec_Struct_Ptr %LCLop NIL : -> __sigaction_Struct_Ptr %LCLop NIL : -> __sigstack_Struct_Ptr %LCLop NIL : -> __sigcontext_Struct_Ptr %LCLop NIL : -> __sstdlib_lcl0s_Struct_Ptr %LCLop NIL : -> __sstdlib_lcl1s_Struct_Ptr %LCLop NIL : -> __void_Obj_Ptr %LCLop NIL : -> ____char_Obj_Ptr_Obj_Ptr %LCLop NIL : -> __FILE_Obj_Ptr %LCLop NIL : -> ____void_Obj_Ptr_Obj_Ptr %LCLop NIL : -> __sstdlib0s_Struct_Ptr %LCLop NIL : -> __sstdlib1s_Struct_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop __ + __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ + __ :int, __exception_Struct_Ptr -> __exception_Struct_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ + __ :int, __double_Obj_Ptr -> __double_Obj_Ptr %LCLop __ + __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ + __ :int, __sigvec_Struct_Ptr -> __sigvec_Struct_Ptr %LCLop __ + __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ + __ :int, __sigaction_Struct_Ptr -> __sigaction_Struct_Ptr %LCLop __ + __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ + __ :int, __sigstack_Struct_Ptr -> __sigstack_Struct_Ptr %LCLop __ + __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ + __ :int, __sigcontext_Struct_Ptr -> __sigcontext_Struct_Ptr %LCLop __ + __ :__char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :__sstdlib_lcl0s_Struct_Ptr, int -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl0s_Struct_Ptr, __sstdlib_lcl0s_Struct_Ptr -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl1s_Struct_Ptr, int -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl1s_Struct_Ptr, __sstdlib_lcl1s_Struct_Ptr -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ + __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ + __ :__void_Obj_Ptr, __void_Obj_Ptr -> __void_Obj_Ptr %LCLop __ + __ :__int_Obj_Ptr, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ + __ :int, __FILE_Obj_Ptr -> __FILE_Obj_Ptr %LCLop __ + __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ + __ :int, ____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ + __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :int, __sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :int, __sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Ptr %LCLop __ \select sc_onstack :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_onstack :_sigcontext_Struct -> _int_Obj %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop __ - __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ - __ :__exception_Struct_Ptr, __exception_Struct_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ - __ :__double_Obj_Ptr, __double_Obj_Ptr -> int %LCLop __ - __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ - __ :__sigvec_Struct_Ptr, __sigvec_Struct_Ptr -> int %LCLop __ - __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ - __ :__sigaction_Struct_Ptr, __sigaction_Struct_Ptr -> int %LCLop __ - __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ - __ :__sigstack_Struct_Ptr, __sigstack_Struct_Ptr -> int %LCLop __ - __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ - __ :__sigcontext_Struct_Ptr, __sigcontext_Struct_Ptr -> int %LCLop __ - __ :__sstdlib_lcl0s_Struct_Ptr, int -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ - __ :__sstdlib_lcl0s_Struct_Ptr, __sstdlib_lcl0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib_lcl1s_Struct_Ptr, int -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ - __ :__sstdlib_lcl1s_Struct_Ptr, __sstdlib_lcl1s_Struct_Ptr -> int %LCLop __ - __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ - __ :__void_Obj_Ptr, __void_Obj_Ptr -> int %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> int %LCLop __ - __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ - __ :__FILE_Obj_Ptr, __FILE_Obj_Ptr -> int %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, ____void_Obj_Ptr_Obj_Ptr -> int %LCLop __ - __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ - __ :__sstdlib0s_Struct_Ptr, __sstdlib0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ - __ :__sstdlib1s_Struct_Ptr, __sstdlib1s_Struct_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop sizeof :_emath1e_Enum -> int %LCLop sizeof :FILE -> int %LCLop __ \select sc_mask :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mask :_sigcontext_Struct -> _int_Obj %LCLop DOMAIN : -> _emath1e_Enum %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_onstack :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_pc :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_pc :_sigcontext_Struct -> _int_Obj %LCLop SING : -> _emath1e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mask :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_regs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_regs :_sigcontext_Struct -> __int_Obj_Arr %LCLop OVERFLOW : -> _emath1e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLop isSub :__exception_Struct_Tuple_Vec, int -> bool %LCLop isSub :__exception_Struct_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :_double_Vec, int -> bool %LCLop isSub :__double_Obj_Arr, int -> bool %LCLop isSub :__sigvec_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigvec_Struct_Arr, int -> bool %LCLop isSub :__sigaction_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigaction_Struct_Arr, int -> bool %LCLop isSub :__sigstack_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigstack_Struct_Arr, int -> bool %LCLop isSub :__sigcontext_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigcontext_Struct_Arr, int -> bool %LCLop isSub :__sstdlib_lcl0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib_lcl0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib_lcl1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib_lcl1s_Struct_Arr, int -> bool %LCLop isSub :_void_Vec, int -> bool %LCLop isSub :__void_Obj_Arr, int -> bool %LCLop isSub :___char_Obj_Ptr_Vec, int -> bool %LCLop isSub :____char_Obj_Ptr_Obj_Arr, int -> bool %LCLop isSub :_FILE_Vec, int -> bool %LCLop isSub :__FILE_Obj_Arr, int -> bool %LCLop isSub :___void_Obj_Ptr_Vec, int -> bool %LCLop isSub :____void_Obj_Ptr_Obj_Arr, int -> bool %LCLop isSub :__sstdlib0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib1s_Struct_Arr, int -> bool %LCLtag lconv struct %LCLop __ \field_arrow sc_pc :__sigcontext_Struct_Ptr -> _int_Obj %LCLop UNDERFLOW : -> _emath1e_Enum %LCLop ELOOP : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_regs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_mdlo :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdlo :_sigcontext_Struct -> _int_Obj %LCLop TLOSS : -> _emath1e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop __ \select sc_mdhi :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdhi :_sigcontext_Struct -> _int_Obj %LCLop PLOSS : -> _emath1e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdlo :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_ownedfp :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_ownedfp :_sigcontext_Struct -> _int_Obj %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdhi :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpregs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_fpregs :_sigcontext_Struct -> __int_Obj_Arr %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLtag emath1e enum %LCLop __ \field_arrow sc_ownedfp :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpc_csr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_csr :_sigcontext_Struct -> _int_Obj %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop __ \field_arrow sc_fpregs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_fpc_eir :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_eir :_sigcontext_Struct -> _int_Obj %LCLop EUSERS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_csr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_cause :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_cause :_sigcontext_Struct -> _int_Obj %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_eir :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badvaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badvaddr :_sigcontext_Struct -> _int_Obj %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop __ \field_arrow sc_cause :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badpaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badpaddr :_sigcontext_Struct -> _int_Obj %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLfcn strcasecmp : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strncasecmp : __char_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn strcat : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strncat : __char_Obj_Ptr, __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strcmp : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strncmp : __char_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn strcpy : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strncpy : __char_Obj_Ptr, __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strlen : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strchr : __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strrchr : __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strpbrk : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strspn : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strcspn : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strtok : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn index : __char_Obj_Ptr, char -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn rindex : __char_Obj_Ptr, char -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strstr : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/strings.lcl0000644021234200000250000000200307121317316015321 0ustar fax/* ** strings.lcl */ int strcasecmp(char *s1, char *s2) { ensures true ; } int strncasecmp(char *s1, char *s2, int n) { ensures true ; } char *strcat(char *s1, char *s2) { ensures true ; } char *strncat(char *s1, char *s2, int n) { ensures true ; } int strcmp(char *s1, char *s2) { ensures true ; } int strncmp(char *s1, char *s2, int n) { ensures true ; } | char : void | *strcpy(char *s1, char *s2) { ensures true ; } char *strncpy(char *s1, char *s2, int n) { ensures true ; } int strlen(char *s) { ensures true ; } char *strchr(char *s, int c) { ensures true ; } char *strrchr(char *s, int c) { ensures true ; } char *strpbrk(char *s1, char *s2) { ensures true ; } int strspn(char *s1, char *s2) { ensures true ; } int strcspn(char *s1, char *s2) { ensures true ; } char *strtok(char *s1, char *s2) { ensures true ; } char *index(char *s, char c) { ensures true ; } char *rindex(char *s, char c) { ensures true ; } char *strstr(char *s1, char *s2) { ensures true ; } splint-3.1.2.dfsg1/imports/strings.lcs0000644021234200000250000012247107121317316015344 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort EPERM enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLsort _exception_Struct str exception nil %LCLsort retval strMem _double_Obj nil %LCLsort arg2 strMem _double_Obj nil %LCLsort arg1 strMem _double_Obj nil %LCLsort name strMem ___char_Obj_Ptr_Obj nil %LCLsort ttype strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _double_Obj obj double nil %LCLsort _exception_Struct_Tuple tup _exception_Struct nil %LCLsort __exception_Struct_Ptr ptr _exception_Struct nil %LCLsort __exception_Struct_Arr arr _exception_Struct nil %LCLsort __exception_Struct_Tuple_Vec vec _exception_Struct_Tuple __exception_Struct_Arr %LCLsort ___exception synonym _exception_Struct nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort __double_Obj_Ptr ptr _double_Obj nil %LCLsort __double_Obj_Arr arr _double_Obj nil %LCLsort _double_Vec vec double __double_Obj_Arr %LCLsort _emath1e_Enum enum emath1e nil %LCLsort PLOSS enumMem nil nil %LCLsort TLOSS enumMem nil nil %LCLsort UNDERFLOW enumMem nil nil %LCLsort OVERFLOW enumMem nil nil %LCLsort SING enumMem nil nil %LCLsort DOMAIN enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __emath1e_Enum_Obj obj _emath1e_Enum nil %LCLsort _jmp_buf synonym __int_Obj_Arr nil %LCLsort _sigjmp_buf synonym __int_Obj_Arr nil %LCLsort _sig_atomic_t synonym int nil %LCLsort _sigset_t synonym int nil %LCLsort _sigvec_Struct str sigvec nil %LCLsort sv_flags strMem _int_Obj nil %LCLsort sv_mask strMem _int_Obj nil %LCLsort sv_handler strMem _HOF_sort_43 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_43 hof nil nil %LCLsort _sigvec_Struct_Tuple tup _sigvec_Struct nil %LCLsort __sigvec_Struct_Ptr ptr _sigvec_Struct nil %LCLsort __sigvec_Struct_Arr arr _sigvec_Struct nil %LCLsort __sigvec_Struct_Tuple_Vec vec _sigvec_Struct_Tuple __sigvec_Struct_Arr %LCLsort ___sigvec synonym _sigvec_Struct nil %LCLsort _sigaction_Struct str sigaction nil %LCLsort sa_flags strMem _int_Obj nil %LCLsort sa_mask strMem _int_Obj nil %LCLsort sa_handler strMem _HOF_sort_50 nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_50 hof nil nil %LCLsort _sigaction_Struct_Tuple tup _sigaction_Struct nil %LCLsort __sigaction_Struct_Ptr ptr _sigaction_Struct nil %LCLsort __sigaction_Struct_Arr arr _sigaction_Struct nil %LCLsort __sigaction_Struct_Tuple_Vec vec _sigaction_Struct_Tuple __sigaction_Struct_Arr %LCLsort ___sigaction synonym _sigaction_Struct nil %LCLsort _sigstack_Struct str sigstack nil %LCLsort ss_onstack strMem _int_Obj nil %LCLsort ss_sp strMem ___char_Obj_Ptr_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigstack_Struct_Tuple tup _sigstack_Struct nil %LCLsort __sigstack_Struct_Ptr ptr _sigstack_Struct nil %LCLsort __sigstack_Struct_Arr arr _sigstack_Struct nil %LCLsort __sigstack_Struct_Tuple_Vec vec _sigstack_Struct_Tuple __sigstack_Struct_Arr %LCLsort ___sigstack synonym _sigstack_Struct nil %LCLsort _sigcontext_Struct str sigcontext nil %LCLsort sc_badpaddr strMem _int_Obj nil %LCLsort sc_badvaddr strMem _int_Obj nil %LCLsort sc_cause strMem _int_Obj nil %LCLsort sc_fpc_eir strMem _int_Obj nil %LCLsort sc_fpc_csr strMem _int_Obj nil %LCLsort sc_fpregs strMem __int_Obj_Arr nil %LCLsort sc_ownedfp strMem _int_Obj nil %LCLsort sc_mdhi strMem _int_Obj nil %LCLsort sc_mdlo strMem _int_Obj nil %LCLsort sc_regs strMem __int_Obj_Arr nil %LCLsort sc_pc strMem _int_Obj nil %LCLsort sc_mask strMem _int_Obj nil %LCLsort sc_onstack strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigcontext_Struct_Tuple tup _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Ptr ptr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Arr arr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Tuple_Vec vec _sigcontext_Struct_Tuple __sigcontext_Struct_Arr %LCLsort ___sigcontext synonym _sigcontext_Struct nil %LCLsort _HOF_sort_68 hof nil nil %LCLsort ___scp synonym _HOF_sort_68 nil %LCLsort _pid_t synonym int nil %LCLsort _ptrdiff_t synonym int nil %LCLsort _size_t synonym int nil %LCLsort _wchar_t synonym int nil %LCLsort _sstdlib_lcl0s_Struct str sstdlib_lcl0s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib_lcl0s_Struct_Tuple tup _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Ptr ptr _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Arr arr _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Tuple_Vec vec _sstdlib_lcl0s_Struct_Tuple __sstdlib_lcl0s_Struct_Arr %LCLsort _div_t synonym _sstdlib_lcl0s_Struct nil %LCLsort _sstdlib_lcl1s_Struct str sstdlib_lcl1s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib_lcl1s_Struct_Tuple tup _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Ptr ptr _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Arr arr _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Tuple_Vec vec _sstdlib_lcl1s_Struct_Tuple __sstdlib_lcl1s_Struct_Arr %LCLsort _ldiv_t synonym _sstdlib_lcl1s_Struct nil %LCLsort _void_Obj obj void nil %LCLsort __void_Obj_Ptr ptr _void_Obj nil %LCLsort __void_Obj_Arr arr _void_Obj nil %LCLsort _void_Vec vec void __void_Obj_Arr %LCLsort ____vp synonym __void_Obj_Ptr nil %LCLsort _HOF_Sort_33 hof nil nil %LCLsort _HOF_Sort_34 hof nil nil %LCLsort _HOF_Sort_38 hof nil nil %LCLsort ____char_Obj_Ptr_Obj_Ptr ptr ___char_Obj_Ptr_Obj nil %LCLsort ____char_Obj_Ptr_Obj_Arr arr ___char_Obj_Ptr_Obj nil %LCLsort ___char_Obj_Ptr_Vec vec __char_Obj_Ptr ____char_Obj_Ptr_Obj_Arr %LCLsort FILE immutable nil nil %LCLsort _va_list synonym __void_Obj_Ptr nil %LCLsort _fpos_t synonym __void_Obj_Ptr nil %LCLsort _FILE_Obj obj FILE nil %LCLsort __FILE_Obj_Ptr ptr _FILE_Obj nil %LCLsort __FILE_Obj_Arr arr _FILE_Obj nil %LCLsort _FILE_Vec vec FILE __FILE_Obj_Arr %LCLsort ___FILE_Obj_Ptr_Obj obj __FILE_Obj_Ptr nil %LCLsort ___void_Obj_Ptr_Obj obj __void_Obj_Ptr nil %LCLsort ____void_Obj_Ptr_Obj_Ptr ptr ___void_Obj_Ptr_Obj nil %LCLsort ____void_Obj_Ptr_Obj_Arr arr ___void_Obj_Ptr_Obj nil %LCLsort ___void_Obj_Ptr_Vec vec __void_Obj_Ptr ____void_Obj_Ptr_Obj_Arr %LCLsort _sstdlib0s_Struct str sstdlib0s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib0s_Struct_Tuple tup _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Ptr ptr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Arr arr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Tuple_Vec vec _sstdlib0s_Struct_Tuple __sstdlib0s_Struct_Arr %LCLsort _sstdlib1s_Struct str sstdlib1s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib1s_Struct_Tuple tup _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Ptr ptr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Arr arr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Tuple_Vec vec _sstdlib1s_Struct_Tuple __sstdlib1s_Struct_Arr %LCLsort _HOF_sort_119 hof nil nil %LCLsort _HOF_sort_120 hof nil nil %LCLsort _HOF_sort_121 hof nil nil %LCLsort _HOF_sort_122 hof nil nil %LCLsort _HOF_sort_123 hof nil nil %LCLsort _HOF_sort_124 hof nil nil %LCLsort _HOF_sort_125 hof nil nil %LCLsort _HOF_sort_126 hof nil nil %LCLsort _HOF_sort_127 hof nil nil %LCLSortTableEnd %LCLSymbolTable %LCLop __ \field_arrow sc_badvaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop __ \field_arrow sc_badpaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLtag sstdlib_lcl0s struct %LCLop nullTerminated :_char_Vec -> bool %LCLop throughNull :_char_Vec -> _char_Vec %LCLtag eerrno0e enum %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLtag exception struct %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLtag sstdlib_lcl1s struct %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLtag sigvec struct %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop true : -> bool %LCLop false : -> bool %LCLtag sigaction struct %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLop __ \select rem :_sstdlib_lcl0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib_lcl0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib_lcl1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib_lcl1s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib1s_Struct -> _int_Obj %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \select quot :_sstdlib_lcl0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib_lcl0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib_lcl1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib_lcl1s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib1s_Struct -> _int_Obj %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop __ \field_arrow rem :__sstdlib_lcl0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib_lcl1s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop { __ } :char -> _char_Vec %LCLop __ \field_arrow quot :__sstdlib_lcl0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib_lcl1s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLtag sstdlib0s struct %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop __ \select ttype :_exception_Struct_Tuple -> int %LCLop __ \select ttype :_exception_Struct -> _int_Obj %LCLop EIO : -> _eerrno0e_Enum %LCLop __ \select name :_exception_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select name :_exception_Struct -> ___char_Obj_Ptr_Obj %LCLop ENXIO : -> _eerrno0e_Enum %LCLop __ \field_arrow ttype :__exception_Struct_Ptr -> _int_Obj %LCLop __ \select arg1 :_exception_Struct_Tuple -> double %LCLop __ \select arg1 :_exception_Struct -> _double_Obj %LCLop E2BIG : -> _eerrno0e_Enum %LCLop __ \field_arrow name :__exception_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select arg2 :_exception_Struct_Tuple -> double %LCLop __ \select arg2 :_exception_Struct -> _double_Obj %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLtag sstdlib1s struct %LCLop __ \field_arrow arg1 :__exception_Struct_Ptr -> _double_Obj %LCLop __ \select retval :_exception_Struct_Tuple -> double %LCLop __ \select retval :_exception_Struct -> _double_Obj %LCLop EBADF : -> _eerrno0e_Enum %LCLop __ \select sv_handler :_sigvec_Struct_Tuple -> _HOF_sort_43 %LCLop __ \select sv_handler :_sigvec_Struct -> _HOF_sort_43 %LCLop __ \field_arrow arg2 :__exception_Struct_Ptr -> _double_Obj %LCLop ECHILD : -> _eerrno0e_Enum %LCLop [__, __] :int, __char_Obj_Ptr -> _sigstack_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib_lcl0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib_lcl1s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib1s_Struct_Tuple %LCLop __ \select sv_mask :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_mask :_sigvec_Struct -> _int_Obj %LCLop __ \field_arrow retval :__exception_Struct_Ptr -> _double_Obj %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop __ [] :__exception_Struct_Ptr -> __exception_Struct_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :__double_Obj_Ptr -> __double_Obj_Arr %LCLop __ [] :__sigvec_Struct_Ptr -> __sigvec_Struct_Arr %LCLop __ [] :__sigaction_Struct_Ptr -> __sigaction_Struct_Arr %LCLop __ [] :__sigstack_Struct_Ptr -> __sigstack_Struct_Arr %LCLop __ [] :__sigcontext_Struct_Ptr -> __sigcontext_Struct_Arr %LCLop __ [] :__sstdlib_lcl0s_Struct_Ptr -> __sstdlib_lcl0s_Struct_Arr %LCLop __ [] :__sstdlib_lcl1s_Struct_Ptr -> __sstdlib_lcl1s_Struct_Arr %LCLop __ [] :__void_Obj_Ptr -> __void_Obj_Arr %LCLop __ [] :____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Arr %LCLop __ [] :__FILE_Obj_Ptr -> __FILE_Obj_Arr %LCLop __ [] :____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Arr %LCLop __ [] :__sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Arr %LCLop __ [] :__sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Arr %LCLop __ \field_arrow sv_handler :__sigvec_Struct_Ptr -> _HOF_sort_43 %LCLop __ \select sv_flags :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_flags :_sigvec_Struct -> _int_Obj %LCLop ENOMEM : -> _eerrno0e_Enum %LCLtag sigstack struct %LCLop __ \field_arrow sv_mask :__sigvec_Struct_Ptr -> _int_Obj %LCLop [__, __, __] :int, int, _HOF_sort_43 -> _sigvec_Struct_Tuple %LCLop [__, __, __] :int, int, _HOF_sort_50 -> _sigaction_Struct_Tuple %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop __ [__] :__exception_Struct_Tuple_Vec, int -> _exception_Struct_Tuple %LCLop __ [__] :__exception_Struct_Arr, int -> _exception_Struct %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :_double_Vec, int -> double %LCLop __ [__] :__double_Obj_Arr, int -> _double_Obj %LCLop __ [__] :__sigvec_Struct_Tuple_Vec, int -> _sigvec_Struct_Tuple %LCLop __ [__] :__sigvec_Struct_Arr, int -> _sigvec_Struct %LCLop __ [__] :__sigaction_Struct_Tuple_Vec, int -> _sigaction_Struct_Tuple %LCLop __ [__] :__sigaction_Struct_Arr, int -> _sigaction_Struct %LCLop __ [__] :__sigstack_Struct_Tuple_Vec, int -> _sigstack_Struct_Tuple %LCLop __ [__] :__sigstack_Struct_Arr, int -> _sigstack_Struct %LCLop __ [__] :__sigcontext_Struct_Tuple_Vec, int -> _sigcontext_Struct_Tuple %LCLop __ [__] :__sigcontext_Struct_Arr, int -> _sigcontext_Struct %LCLop __ [__] :__sstdlib_lcl0s_Struct_Tuple_Vec, int -> _sstdlib_lcl0s_Struct_Tuple %LCLop __ [__] :__sstdlib_lcl0s_Struct_Arr, int -> _sstdlib_lcl0s_Struct %LCLop __ [__] :__sstdlib_lcl1s_Struct_Tuple_Vec, int -> _sstdlib_lcl1s_Struct_Tuple %LCLop __ [__] :__sstdlib_lcl1s_Struct_Arr, int -> _sstdlib_lcl1s_Struct %LCLop __ [__] :_void_Vec, int -> void %LCLop __ [__] :__void_Obj_Arr, int -> _void_Obj %LCLop __ [__] :___char_Obj_Ptr_Vec, int -> __char_Obj_Ptr %LCLop __ [__] :____char_Obj_Ptr_Obj_Arr, int -> ___char_Obj_Ptr_Obj %LCLop __ [__] :_FILE_Vec, int -> FILE %LCLop __ [__] :__FILE_Obj_Arr, int -> _FILE_Obj %LCLop __ [__] :___void_Obj_Ptr_Vec, int -> __void_Obj_Ptr %LCLop __ [__] :____void_Obj_Ptr_Obj_Arr, int -> ___void_Obj_Ptr_Obj %LCLop __ [__] :__sstdlib0s_Struct_Tuple_Vec, int -> _sstdlib0s_Struct_Tuple %LCLop __ [__] :__sstdlib0s_Struct_Arr, int -> _sstdlib0s_Struct %LCLop __ [__] :__sstdlib1s_Struct_Tuple_Vec, int -> _sstdlib1s_Struct_Tuple %LCLop __ [__] :__sstdlib1s_Struct_Arr, int -> _sstdlib1s_Struct %LCLop __ \field_arrow sv_flags :__sigvec_Struct_Ptr -> _int_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop [__, __, __, __, __] :double, double, double, __char_Obj_Ptr, int -> _exception_Struct_Tuple %LCLop EEXIST : -> _eerrno0e_Enum %LCLop EXDEV : -> _eerrno0e_Enum %LCLop ENODEV : -> _eerrno0e_Enum %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop \A :bool, bool -> bool %LCLop \A :int, bool -> bool %LCLop \A :double, bool -> bool %LCLop \A :_char_Vec, bool -> bool %LCLop \A :char, bool -> bool %LCLop __ \select sa_handler :_sigaction_Struct_Tuple -> _HOF_sort_50 %LCLop __ \select sa_handler :_sigaction_Struct -> _HOF_sort_50 %LCLop EMFILE : -> _eerrno0e_Enum %LCLtag sigcontext struct %LCLop \E :bool, bool -> bool %LCLop \E :int, bool -> bool %LCLop \E :double, bool -> bool %LCLop \E :_char_Vec, bool -> bool %LCLop \E :char, bool -> bool %LCLop __ \select sa_mask :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_mask :_sigaction_Struct -> _int_Obj %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_handler :__sigaction_Struct_Ptr -> _HOF_sort_50 %LCLop __ \select sa_flags :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_flags :_sigaction_Struct -> _int_Obj %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop __ \field_arrow sa_mask :__sigaction_Struct_Ptr -> _int_Obj %LCLop EFBIG : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_flags :__sigaction_Struct_Ptr -> _int_Obj %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop 32 : -> double %LCLop EROFS : -> _eerrno0e_Enum %LCLop EMLINK : -> _eerrno0e_Enum %LCLop __ \iff __ :bool, bool -> bool %LCLop EPIPE : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __] :int, int, int, int, int, _int_Vec, int, int, int, _int_Vec, int, int, int -> _sigcontext_Struct_Tuple %LCLop EDOM : -> _eerrno0e_Enum %LCLop ERANGE : -> _eerrno0e_Enum %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop EALREADY : -> _eerrno0e_Enum %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop __ \select ss_sp :_sigstack_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select ss_sp :_sigstack_Struct -> ___char_Obj_Ptr_Obj %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \select ss_onstack :_sigstack_Struct_Tuple -> int %LCLop __ \select ss_onstack :_sigstack_Struct -> _int_Obj %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_sp :__sigstack_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_onstack :__sigstack_Struct_Ptr -> _int_Obj %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop NIL : -> __exception_Struct_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> __double_Obj_Ptr %LCLop NIL : -> __sigvec_Struct_Ptr %LCLop NIL : -> __sigaction_Struct_Ptr %LCLop NIL : -> __sigstack_Struct_Ptr %LCLop NIL : -> __sigcontext_Struct_Ptr %LCLop NIL : -> __sstdlib_lcl0s_Struct_Ptr %LCLop NIL : -> __sstdlib_lcl1s_Struct_Ptr %LCLop NIL : -> __void_Obj_Ptr %LCLop NIL : -> ____char_Obj_Ptr_Obj_Ptr %LCLop NIL : -> __FILE_Obj_Ptr %LCLop NIL : -> ____void_Obj_Ptr_Obj_Ptr %LCLop NIL : -> __sstdlib0s_Struct_Ptr %LCLop NIL : -> __sstdlib1s_Struct_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop __ + __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ + __ :int, __exception_Struct_Ptr -> __exception_Struct_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ + __ :int, __double_Obj_Ptr -> __double_Obj_Ptr %LCLop __ + __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ + __ :int, __sigvec_Struct_Ptr -> __sigvec_Struct_Ptr %LCLop __ + __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ + __ :int, __sigaction_Struct_Ptr -> __sigaction_Struct_Ptr %LCLop __ + __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ + __ :int, __sigstack_Struct_Ptr -> __sigstack_Struct_Ptr %LCLop __ + __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ + __ :int, __sigcontext_Struct_Ptr -> __sigcontext_Struct_Ptr %LCLop __ + __ :__char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :__sstdlib_lcl0s_Struct_Ptr, int -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl0s_Struct_Ptr, __sstdlib_lcl0s_Struct_Ptr -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl1s_Struct_Ptr, int -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl1s_Struct_Ptr, __sstdlib_lcl1s_Struct_Ptr -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ + __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ + __ :__void_Obj_Ptr, __void_Obj_Ptr -> __void_Obj_Ptr %LCLop __ + __ :__int_Obj_Ptr, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ + __ :int, __FILE_Obj_Ptr -> __FILE_Obj_Ptr %LCLop __ + __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ + __ :int, ____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ + __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :int, __sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :int, __sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Ptr %LCLop __ \select sc_onstack :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_onstack :_sigcontext_Struct -> _int_Obj %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop __ - __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ - __ :__exception_Struct_Ptr, __exception_Struct_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ - __ :__double_Obj_Ptr, __double_Obj_Ptr -> int %LCLop __ - __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ - __ :__sigvec_Struct_Ptr, __sigvec_Struct_Ptr -> int %LCLop __ - __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ - __ :__sigaction_Struct_Ptr, __sigaction_Struct_Ptr -> int %LCLop __ - __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ - __ :__sigstack_Struct_Ptr, __sigstack_Struct_Ptr -> int %LCLop __ - __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ - __ :__sigcontext_Struct_Ptr, __sigcontext_Struct_Ptr -> int %LCLop __ - __ :__sstdlib_lcl0s_Struct_Ptr, int -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ - __ :__sstdlib_lcl0s_Struct_Ptr, __sstdlib_lcl0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib_lcl1s_Struct_Ptr, int -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ - __ :__sstdlib_lcl1s_Struct_Ptr, __sstdlib_lcl1s_Struct_Ptr -> int %LCLop __ - __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ - __ :__void_Obj_Ptr, __void_Obj_Ptr -> int %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> int %LCLop __ - __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ - __ :__FILE_Obj_Ptr, __FILE_Obj_Ptr -> int %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, ____void_Obj_Ptr_Obj_Ptr -> int %LCLop __ - __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ - __ :__sstdlib0s_Struct_Ptr, __sstdlib0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ - __ :__sstdlib1s_Struct_Ptr, __sstdlib1s_Struct_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop sizeof :_emath1e_Enum -> int %LCLop sizeof :FILE -> int %LCLop __ \select sc_mask :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mask :_sigcontext_Struct -> _int_Obj %LCLop DOMAIN : -> _emath1e_Enum %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_onstack :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_pc :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_pc :_sigcontext_Struct -> _int_Obj %LCLop SING : -> _emath1e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mask :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_regs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_regs :_sigcontext_Struct -> __int_Obj_Arr %LCLop OVERFLOW : -> _emath1e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLop isSub :__exception_Struct_Tuple_Vec, int -> bool %LCLop isSub :__exception_Struct_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :_double_Vec, int -> bool %LCLop isSub :__double_Obj_Arr, int -> bool %LCLop isSub :__sigvec_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigvec_Struct_Arr, int -> bool %LCLop isSub :__sigaction_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigaction_Struct_Arr, int -> bool %LCLop isSub :__sigstack_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigstack_Struct_Arr, int -> bool %LCLop isSub :__sigcontext_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigcontext_Struct_Arr, int -> bool %LCLop isSub :__sstdlib_lcl0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib_lcl0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib_lcl1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib_lcl1s_Struct_Arr, int -> bool %LCLop isSub :_void_Vec, int -> bool %LCLop isSub :__void_Obj_Arr, int -> bool %LCLop isSub :___char_Obj_Ptr_Vec, int -> bool %LCLop isSub :____char_Obj_Ptr_Obj_Arr, int -> bool %LCLop isSub :_FILE_Vec, int -> bool %LCLop isSub :__FILE_Obj_Arr, int -> bool %LCLop isSub :___void_Obj_Ptr_Vec, int -> bool %LCLop isSub :____void_Obj_Ptr_Obj_Arr, int -> bool %LCLop isSub :__sstdlib0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib1s_Struct_Arr, int -> bool %LCLtag lconv struct %LCLop __ \field_arrow sc_pc :__sigcontext_Struct_Ptr -> _int_Obj %LCLop UNDERFLOW : -> _emath1e_Enum %LCLop ELOOP : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_regs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_mdlo :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdlo :_sigcontext_Struct -> _int_Obj %LCLop TLOSS : -> _emath1e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop __ \select sc_mdhi :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdhi :_sigcontext_Struct -> _int_Obj %LCLop PLOSS : -> _emath1e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdlo :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_ownedfp :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_ownedfp :_sigcontext_Struct -> _int_Obj %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdhi :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpregs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_fpregs :_sigcontext_Struct -> __int_Obj_Arr %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLtag emath1e enum %LCLop __ \field_arrow sc_ownedfp :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpc_csr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_csr :_sigcontext_Struct -> _int_Obj %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop __ \field_arrow sc_fpregs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_fpc_eir :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_eir :_sigcontext_Struct -> _int_Obj %LCLop EUSERS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_csr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_cause :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_cause :_sigcontext_Struct -> _int_Obj %LCLop EDQUOT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_eir :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badvaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badvaddr :_sigcontext_Struct -> _int_Obj %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop __ \field_arrow sc_cause :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badpaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badpaddr :_sigcontext_Struct -> _int_Obj %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLfcn strcasecmp : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strncasecmp : __char_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn strcat : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strncat : __char_Obj_Ptr, __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strcmp : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strncmp : __char_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn strcpy : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strncpy : __char_Obj_Ptr, __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strlen : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strchr : __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strrchr : __char_Obj_Ptr, int -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strpbrk : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strspn : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strcspn : __char_Obj_Ptr, __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn strtok : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn index : __char_Obj_Ptr, char -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn rindex : __char_Obj_Ptr, char -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn strstr : __char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/imports/time.lcl0000644021234200000250000000260307121317316014574 0ustar fax/* ** time.h */ imports ; typedef struct timeval { long tv_sec; long tv_usec; } __timeval; typedef struct timezone { int tz_minuteswest; int tz_dsttime; } __timezone; enum { DST_NONE, DST_USA, DST_AUST, DST_WET, DST_MET, DST_EET } __timezones; | bool : int | timerisset(struct timeval tvp) { ensures true; } void timerclear(struct timeval tvp); constant int ITIMER_REAL; constant int ITIMER_VIRTUAL; constant int ITIMER_PROF; typedef struct itimerval { struct timeval it_interval; struct timeval it_value; } __itimerval; typedef struct tm { int tm_sec ; int tm_min ; int tm_hour ; int tm_mday ; int tm_mon ; int tm_year ; int tm_wday ; int tm_yday ; int tm_isdst ; long tm_gmtoff ; char *tm_zone ; } __tm; typedef int time_t ; typedef int clock_t ; constant int CLOCKS_PER_SEC ; char * asctime( struct tm *__tm ) { ensures true; } clock_t clock( void ) { ensures true; } char * ctime( time_t *__clock ); double difftime( time_t __time1, time_t __time0 ) { ensures true; } struct tm * gmtime( time_t *__clock ) { ensures true; } struct tm * localtime( time_t *__clock ) { ensures true; } time_t mktime( struct tm *__timeptr ) { ensures true; } size_t strftime( char *__s, size_t __maxsize, char *__format, struct tm *__tm ) { ensures true; } time_t time( time_t *__tloc ) {ensures true; } char *tzname[]; char *timezone() { ensures true; } splint-3.1.2.dfsg1/imports/time.lcs0000644021234200000250000015065307121317316014614 0ustar fax%PASSED Output from LCLint 2.0 %LCLimports %LCLSortTable %LCLsort bool immutable nil nil %LCLsort Bool synonym bool nil %LCLsort int primitive nil nil %LCLsort char primitive nil nil %LCLsort void primitive nil nil %LCLsort _char_Obj obj char nil %LCLsort __char_Obj_Ptr ptr _char_Obj nil %LCLsort __char_Obj_Arr arr _char_Obj nil %LCLsort _char_Vec vec char __char_Obj_Arr %LCLsort float primitive nil nil %LCLsort double primitive nil nil %LCLsort _eerrno0e_Enum enum eerrno0e nil %LCLsort EPERM enumMem nil nil %LCLsort ENOENT enumMem nil nil %LCLsort ESRCH enumMem nil nil %LCLsort EINTR enumMem nil nil %LCLsort EIO enumMem nil nil %LCLsort ENXIO enumMem nil nil %LCLsort E2BIG enumMem nil nil %LCLsort ENOEXEC enumMem nil nil %LCLsort EBADF enumMem nil nil %LCLsort ECHILD enumMem nil nil %LCLsort EAGAIN enumMem nil nil %LCLsort ENOMEM enumMem nil nil %LCLsort EACCES enumMem nil nil %LCLsort EFAULT enumMem nil nil %LCLsort ENOTBLK enumMem nil nil %LCLsort EBUSY enumMem nil nil %LCLsort EEXIST enumMem nil nil %LCLsort EXDEV enumMem nil nil %LCLsort ENODEV enumMem nil nil %LCLsort ENOTDIR enumMem nil nil %LCLsort EISDIR enumMem nil nil %LCLsort EINVAL enumMem nil nil %LCLsort ENFILE enumMem nil nil %LCLsort EMFILE enumMem nil nil %LCLsort ENOTTY enumMem nil nil %LCLsort ETXTBSY enumMem nil nil %LCLsort EFBIG enumMem nil nil %LCLsort ENOSPC enumMem nil nil %LCLsort ESPIPE enumMem nil nil %LCLsort EROFS enumMem nil nil %LCLsort EMLINK enumMem nil nil %LCLsort EPIPE enumMem nil nil %LCLsort EDOM enumMem nil nil %LCLsort ERANGE enumMem nil nil %LCLsort EWOULDBLOCK enumMem nil nil %LCLsort EINPROGRESS enumMem nil nil %LCLsort EALREADY enumMem nil nil %LCLsort ENOTSOCK enumMem nil nil %LCLsort EDESTADDRREQ enumMem nil nil %LCLsort EMSGSIZE enumMem nil nil %LCLsort EPROTOTYPE enumMem nil nil %LCLsort ENOPROTOOPT enumMem nil nil %LCLsort EPROTONOSUPPORT enumMem nil nil %LCLsort ESOCKTNOSUPPORT enumMem nil nil %LCLsort EOPNOTSUPP enumMem nil nil %LCLsort EPFNOSUPPORT enumMem nil nil %LCLsort EAFNOSUPPORT enumMem nil nil %LCLsort EADDRINUSE enumMem nil nil %LCLsort EADDRNOTAVAIL enumMem nil nil %LCLsort ENETDOWN enumMem nil nil %LCLsort ENETUNREACH enumMem nil nil %LCLsort ENETRESET enumMem nil nil %LCLsort ECONNABORTED enumMem nil nil %LCLsort ECONNRESET enumMem nil nil %LCLsort ENOBUFS enumMem nil nil %LCLsort EISCONN enumMem nil nil %LCLsort ENOTCONN enumMem nil nil %LCLsort ESHUTDOWN enumMem nil nil %LCLsort ETOOMANYREFS enumMem nil nil %LCLsort ETIMEDOUT enumMem nil nil %LCLsort ECONNREFUSED enumMem nil nil %LCLsort ELOOP enumMem nil nil %LCLsort ENAMETOOLONG enumMem nil nil %LCLsort EHOSTDOWN enumMem nil nil %LCLsort EHOSTUNREACH enumMem nil nil %LCLsort ENOTEMPTY enumMem nil nil %LCLsort EPROCLIM enumMem nil nil %LCLsort EUSERS enumMem nil nil %LCLsort EDQUOT enumMem nil nil %LCLsort ESTALE enumMem nil nil %LCLsort EREMOTE enumMem nil nil %LCLsort ENOMSG enumMem nil nil %LCLsort EIDRM enumMem nil nil %LCLsort EALIGN enumMem nil nil %LCLsort EDEADLK enumMem nil nil %LCLsort ENOLCK enumMem nil nil %LCLsort ENOSYS enumMem nil nil %LCLsort EACTIVE enumMem nil nil %LCLsort ENOACTIVE enumMem nil nil %LCLsort ENORESOURCES enumMem nil nil %LCLsort ENOSYSTEM enumMem nil nil %LCLsort ENODUST enumMem nil nil %LCLsort EDUPNOCONN enumMem nil nil %LCLsort EDUPNODISCONN enumMem nil nil %LCLsort EDUPNOTCNTD enumMem nil nil %LCLsort EDUPNOTIDLE enumMem nil nil %LCLsort EDUPNOTWAIT enumMem nil nil %LCLsort EDUPNOTRUN enumMem nil nil %LCLsort EDUPBADOPCODE enumMem nil nil %LCLsort EDUPINTRANSIT enumMem nil nil %LCLsort EDUPTOOMANYCPUS enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __eerrno0e_Enum_Obj obj _eerrno0e_Enum nil %LCLsort _int_Obj obj int nil %LCLsort _lconv_Struct str lconv nil %LCLsort decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort int_curr_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort currency_symbol strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_decimal_point strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_thousands_sep strMem ___char_Obj_Ptr_Obj nil %LCLsort mon_grouping strMem ___char_Obj_Ptr_Obj nil %LCLsort positive_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort negative_sign strMem ___char_Obj_Ptr_Obj nil %LCLsort int_frac_digits strMem _char_Obj nil %LCLsort frac_digits strMem _char_Obj nil %LCLsort p_cs_precedes strMem _char_Obj nil %LCLsort p_sep_by_space strMem _char_Obj nil %LCLsort n_cs_precedes strMem _char_Obj nil %LCLsort n_sep_by_space strMem _char_Obj nil %LCLsort p_sign_posn strMem _char_Obj nil %LCLsort n_sign_posn strMem _char_Obj nil %LCLsort strEnd nil nil nil %LCLsort ___char_Obj_Ptr_Obj obj __char_Obj_Ptr nil %LCLsort _lconv_Struct_Tuple tup _lconv_Struct nil %LCLsort __lconv_Struct_Ptr ptr _lconv_Struct nil %LCLsort __lconv_Struct_Arr arr _lconv_Struct nil %LCLsort __lconv_Struct_Tuple_Vec vec _lconv_Struct_Tuple __lconv_Struct_Arr %LCLsort ___lconv synonym _lconv_Struct nil %LCLsort _exception_Struct str exception nil %LCLsort ttype strMem _int_Obj nil %LCLsort name strMem ___char_Obj_Ptr_Obj nil %LCLsort arg1 strMem _double_Obj nil %LCLsort arg2 strMem _double_Obj nil %LCLsort retval strMem _double_Obj nil %LCLsort strEnd nil nil nil %LCLsort _double_Obj obj double nil %LCLsort _exception_Struct_Tuple tup _exception_Struct nil %LCLsort __exception_Struct_Ptr ptr _exception_Struct nil %LCLsort __exception_Struct_Arr arr _exception_Struct nil %LCLsort __exception_Struct_Tuple_Vec vec _exception_Struct_Tuple __exception_Struct_Arr %LCLsort ___exception synonym _exception_Struct nil %LCLsort __int_Obj_Ptr ptr _int_Obj nil %LCLsort __int_Obj_Arr arr _int_Obj nil %LCLsort _int_Vec vec int __int_Obj_Arr %LCLsort __double_Obj_Ptr ptr _double_Obj nil %LCLsort __double_Obj_Arr arr _double_Obj nil %LCLsort _double_Vec vec double __double_Obj_Arr %LCLsort _emath1e_Enum enum emath1e nil %LCLsort DOMAIN enumMem nil nil %LCLsort SING enumMem nil nil %LCLsort OVERFLOW enumMem nil nil %LCLsort UNDERFLOW enumMem nil nil %LCLsort TLOSS enumMem nil nil %LCLsort PLOSS enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __emath1e_Enum_Obj obj _emath1e_Enum nil %LCLsort _jmp_buf synonym __int_Obj_Arr nil %LCLsort _sigjmp_buf synonym __int_Obj_Arr nil %LCLsort _sig_atomic_t synonym int nil %LCLsort _sigset_t synonym int nil %LCLsort _sigvec_Struct str sigvec nil %LCLsort sv_handler strMem _HOF_sort_43 nil %LCLsort sv_mask strMem _int_Obj nil %LCLsort sv_flags strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_43 hof nil nil %LCLsort _sigvec_Struct_Tuple tup _sigvec_Struct nil %LCLsort __sigvec_Struct_Ptr ptr _sigvec_Struct nil %LCLsort __sigvec_Struct_Arr arr _sigvec_Struct nil %LCLsort __sigvec_Struct_Tuple_Vec vec _sigvec_Struct_Tuple __sigvec_Struct_Arr %LCLsort ___sigvec synonym _sigvec_Struct nil %LCLsort _sigaction_Struct str sigaction nil %LCLsort sa_handler strMem _HOF_sort_50 nil %LCLsort sa_mask strMem _int_Obj nil %LCLsort sa_flags strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _HOF_sort_50 hof nil nil %LCLsort _sigaction_Struct_Tuple tup _sigaction_Struct nil %LCLsort __sigaction_Struct_Ptr ptr _sigaction_Struct nil %LCLsort __sigaction_Struct_Arr arr _sigaction_Struct nil %LCLsort __sigaction_Struct_Tuple_Vec vec _sigaction_Struct_Tuple __sigaction_Struct_Arr %LCLsort ___sigaction synonym _sigaction_Struct nil %LCLsort _sigstack_Struct str sigstack nil %LCLsort ss_sp strMem ___char_Obj_Ptr_Obj nil %LCLsort ss_onstack strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigstack_Struct_Tuple tup _sigstack_Struct nil %LCLsort __sigstack_Struct_Ptr ptr _sigstack_Struct nil %LCLsort __sigstack_Struct_Arr arr _sigstack_Struct nil %LCLsort __sigstack_Struct_Tuple_Vec vec _sigstack_Struct_Tuple __sigstack_Struct_Arr %LCLsort ___sigstack synonym _sigstack_Struct nil %LCLsort _sigcontext_Struct str sigcontext nil %LCLsort sc_onstack strMem _int_Obj nil %LCLsort sc_mask strMem _int_Obj nil %LCLsort sc_pc strMem _int_Obj nil %LCLsort sc_regs strMem __int_Obj_Arr nil %LCLsort sc_mdlo strMem _int_Obj nil %LCLsort sc_mdhi strMem _int_Obj nil %LCLsort sc_ownedfp strMem _int_Obj nil %LCLsort sc_fpregs strMem __int_Obj_Arr nil %LCLsort sc_fpc_csr strMem _int_Obj nil %LCLsort sc_fpc_eir strMem _int_Obj nil %LCLsort sc_cause strMem _int_Obj nil %LCLsort sc_badvaddr strMem _int_Obj nil %LCLsort sc_badpaddr strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sigcontext_Struct_Tuple tup _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Ptr ptr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Arr arr _sigcontext_Struct nil %LCLsort __sigcontext_Struct_Tuple_Vec vec _sigcontext_Struct_Tuple __sigcontext_Struct_Arr %LCLsort ___sigcontext synonym _sigcontext_Struct nil %LCLsort _HOF_sort_68 hof nil nil %LCLsort ___scp synonym _HOF_sort_68 nil %LCLsort _pid_t synonym int nil %LCLsort _ptrdiff_t synonym int nil %LCLsort _size_t synonym int nil %LCLsort _wchar_t synonym int nil %LCLsort _sstdlib_lcl0s_Struct str sstdlib_lcl0s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib_lcl0s_Struct_Tuple tup _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Ptr ptr _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Arr arr _sstdlib_lcl0s_Struct nil %LCLsort __sstdlib_lcl0s_Struct_Tuple_Vec vec _sstdlib_lcl0s_Struct_Tuple __sstdlib_lcl0s_Struct_Arr %LCLsort _div_t synonym _sstdlib_lcl0s_Struct nil %LCLsort _sstdlib_lcl1s_Struct str sstdlib_lcl1s nil %LCLsort rem strMem _int_Obj nil %LCLsort quot strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib_lcl1s_Struct_Tuple tup _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Ptr ptr _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Arr arr _sstdlib_lcl1s_Struct nil %LCLsort __sstdlib_lcl1s_Struct_Tuple_Vec vec _sstdlib_lcl1s_Struct_Tuple __sstdlib_lcl1s_Struct_Arr %LCLsort _ldiv_t synonym _sstdlib_lcl1s_Struct nil %LCLsort _void_Obj obj void nil %LCLsort __void_Obj_Ptr ptr _void_Obj nil %LCLsort __void_Obj_Arr arr _void_Obj nil %LCLsort _void_Vec vec void __void_Obj_Arr %LCLsort ____vp synonym __void_Obj_Ptr nil %LCLsort _HOF_Sort_33 hof nil nil %LCLsort _HOF_Sort_34 hof nil nil %LCLsort _HOF_Sort_38 hof nil nil %LCLsort ____char_Obj_Ptr_Obj_Ptr ptr ___char_Obj_Ptr_Obj nil %LCLsort ____char_Obj_Ptr_Obj_Arr arr ___char_Obj_Ptr_Obj nil %LCLsort ___char_Obj_Ptr_Vec vec __char_Obj_Ptr ____char_Obj_Ptr_Obj_Arr %LCLsort FILE immutable nil nil %LCLsort _va_list synonym __void_Obj_Ptr nil %LCLsort _fpos_t synonym __void_Obj_Ptr nil %LCLsort _FILE_Obj obj FILE nil %LCLsort __FILE_Obj_Ptr ptr _FILE_Obj nil %LCLsort __FILE_Obj_Arr arr _FILE_Obj nil %LCLsort _FILE_Vec vec FILE __FILE_Obj_Arr %LCLsort ___FILE_Obj_Ptr_Obj obj __FILE_Obj_Ptr nil %LCLsort ___void_Obj_Ptr_Obj obj __void_Obj_Ptr nil %LCLsort ____void_Obj_Ptr_Obj_Ptr ptr ___void_Obj_Ptr_Obj nil %LCLsort ____void_Obj_Ptr_Obj_Arr arr ___void_Obj_Ptr_Obj nil %LCLsort ___void_Obj_Ptr_Vec vec __void_Obj_Ptr ____void_Obj_Ptr_Obj_Arr %LCLsort _sstdlib0s_Struct str sstdlib0s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib0s_Struct_Tuple tup _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Ptr ptr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Arr arr _sstdlib0s_Struct nil %LCLsort __sstdlib0s_Struct_Tuple_Vec vec _sstdlib0s_Struct_Tuple __sstdlib0s_Struct_Arr %LCLsort _sstdlib1s_Struct str sstdlib1s nil %LCLsort quot strMem _int_Obj nil %LCLsort rem strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _sstdlib1s_Struct_Tuple tup _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Ptr ptr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Arr arr _sstdlib1s_Struct nil %LCLsort __sstdlib1s_Struct_Tuple_Vec vec _sstdlib1s_Struct_Tuple __sstdlib1s_Struct_Arr %LCLsort _HOF_sort_119 hof nil nil %LCLsort _HOF_sort_120 hof nil nil %LCLsort _HOF_sort_121 hof nil nil %LCLsort _HOF_sort_122 hof nil nil %LCLsort _HOF_sort_123 hof nil nil %LCLsort _HOF_sort_124 hof nil nil %LCLsort _HOF_sort_125 hof nil nil %LCLsort _HOF_sort_126 hof nil nil %LCLsort _HOF_sort_127 hof nil nil %LCLsort _timeval_Struct str timeval nil %LCLsort tv_usec strMem _int_Obj nil %LCLsort tv_sec strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _timeval_Struct_Tuple tup _timeval_Struct nil %LCLsort __timeval_Struct_Ptr ptr _timeval_Struct nil %LCLsort __timeval_Struct_Arr arr _timeval_Struct nil %LCLsort __timeval_Struct_Tuple_Vec vec _timeval_Struct_Tuple __timeval_Struct_Arr %LCLsort ___timeval synonym _timeval_Struct nil %LCLsort _timezone_Struct str timezone nil %LCLsort tz_dsttime strMem _int_Obj nil %LCLsort tz_minuteswest strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _timezone_Struct_Tuple tup _timezone_Struct nil %LCLsort __timezone_Struct_Ptr ptr _timezone_Struct nil %LCLsort __timezone_Struct_Arr arr _timezone_Struct nil %LCLsort __timezone_Struct_Tuple_Vec vec _timezone_Struct_Tuple __timezone_Struct_Arr %LCLsort ___timezone synonym _timezone_Struct nil %LCLsort _etime2e_Enum enum etime2e nil %LCLsort DST_EET enumMem nil nil %LCLsort DST_MET enumMem nil nil %LCLsort DST_WET enumMem nil nil %LCLsort DST_AUST enumMem nil nil %LCLsort DST_USA enumMem nil nil %LCLsort DST_NONE enumMem nil nil %LCLsort enumEnd nil nil nil %LCLsort __etime2e_Enum_Obj obj _etime2e_Enum nil %LCLsort _HOF_sort_142 hof nil nil %LCLsort _itimerval_Struct str itimerval nil %LCLsort it_value strMem _timeval_Struct nil %LCLsort it_interval strMem _timeval_Struct nil %LCLsort strEnd nil nil nil %LCLsort _itimerval_Struct_Tuple tup _itimerval_Struct nil %LCLsort __itimerval_Struct_Ptr ptr _itimerval_Struct nil %LCLsort __itimerval_Struct_Arr arr _itimerval_Struct nil %LCLsort __itimerval_Struct_Tuple_Vec vec _itimerval_Struct_Tuple __itimerval_Struct_Arr %LCLsort ___itimerval synonym _itimerval_Struct nil %LCLsort _tm_Struct str tm nil %LCLsort tm_zone strMem ___char_Obj_Ptr_Obj nil %LCLsort tm_gmtoff strMem _int_Obj nil %LCLsort tm_isdst strMem _int_Obj nil %LCLsort tm_yday strMem _int_Obj nil %LCLsort tm_wday strMem _int_Obj nil %LCLsort tm_year strMem _int_Obj nil %LCLsort tm_mon strMem _int_Obj nil %LCLsort tm_mday strMem _int_Obj nil %LCLsort tm_hour strMem _int_Obj nil %LCLsort tm_min strMem _int_Obj nil %LCLsort tm_sec strMem _int_Obj nil %LCLsort strEnd nil nil nil %LCLsort _tm_Struct_Tuple tup _tm_Struct nil %LCLsort __tm_Struct_Ptr ptr _tm_Struct nil %LCLsort __tm_Struct_Arr arr _tm_Struct nil %LCLsort __tm_Struct_Tuple_Vec vec _tm_Struct_Tuple __tm_Struct_Arr %LCLsort ___tm synonym _tm_Struct nil %LCLsort _time_t synonym int nil %LCLsort _clock_t synonym int nil %LCLsort _HOF_sort_157 hof nil nil %LCLSortTableEnd %LCLSymbolTable %LCLop __ \field_arrow sc_badvaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop ENOMSG : -> _eerrno0e_Enum %LCLop mod :int, int -> int %LCLop __ \field_arrow sc_badpaddr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop EIDRM : -> _eerrno0e_Enum %LCLop min :int, int -> int %LCLop EALIGN : -> _eerrno0e_Enum %LCLop max :int, int -> int %LCLop EDEADLK : -> _eerrno0e_Enum %LCLop 0 : -> int %LCLop 0 : -> double %LCLop ENOLCK : -> _eerrno0e_Enum %LCLop 1 : -> int %LCLop 1 : -> double %LCLop if __ then __ else __ :bool, bool, bool -> bool %LCLop if __ then __ else __ :bool, int, int -> int %LCLop if __ then __ else __ :bool, double, double -> double %LCLop if __ then __ else __ :bool, _char_Vec, _char_Vec -> _char_Vec %LCLop if __ then __ else __ :bool, char, char -> char %LCLop ENOSYS : -> _eerrno0e_Enum %LCLop EACTIVE : -> _eerrno0e_Enum %LCLop __ < __ :int, int -> bool %LCLop __ < __ :double, double -> bool %LCLop ENOACTIVE : -> _eerrno0e_Enum %LCLop empty : -> _char_Vec %LCLop __ > __ :int, int -> bool %LCLop __ > __ :double, double -> bool %LCLop ENORESOURCES : -> _eerrno0e_Enum %LCLop ENOSYSTEM : -> _eerrno0e_Enum %LCLtag timezone struct %LCLop ENODUST : -> _eerrno0e_Enum %LCLop count :char, _char_Vec -> int %LCLop EDUPNOCONN : -> _eerrno0e_Enum %LCLop head :_char_Vec -> char %LCLop __ \inv :double -> double %LCLop EDUPNODISCONN : -> _eerrno0e_Enum %LCLop init :_char_Vec -> _char_Vec %LCLop EDUPNOTCNTD : -> _eerrno0e_Enum %LCLop isEmpty :_char_Vec -> bool %LCLop EDUPNOTIDLE : -> _eerrno0e_Enum %LCLop last :_char_Vec -> char %LCLop EDUPNOTWAIT : -> _eerrno0e_Enum %LCLop len :_char_Vec -> int %LCLop __ \implies __ :bool, bool -> bool %LCLop EDUPNOTRUN : -> _eerrno0e_Enum %LCLop prefix :_char_Vec, int -> _char_Vec %LCLop __ / __ :double, double -> double %LCLop EDUPBADOPCODE : -> _eerrno0e_Enum %LCLop removePrefix :_char_Vec, int -> _char_Vec %LCLop EDUPINTRANSIT : -> _eerrno0e_Enum %LCLop substring :_char_Vec, int, int -> _char_Vec %LCLop __ || __ :_char_Vec, _char_Vec -> _char_Vec %LCLop EDUPTOOMANYCPUS : -> _eerrno0e_Enum %LCLop tail :_char_Vec -> _char_Vec %LCLop __ \in __ :char, _char_Vec -> bool %LCLtag sstdlib_lcl0s struct %LCLop nullTerminated :_char_Vec -> bool %LCLop DST_NONE : -> _etime2e_Enum %LCLop throughNull :_char_Vec -> _char_Vec %LCLtag eerrno0e enum %LCLop DST_USA : -> _etime2e_Enum %LCLop sameStr :_char_Vec, _char_Vec -> bool %LCLop DST_AUST : -> _etime2e_Enum %LCLop __ \select decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop lenStr :_char_Vec -> int %LCLop DST_WET : -> _etime2e_Enum %LCLop __ \select thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop times10plus :int, int -> int %LCLop DST_MET : -> _etime2e_Enum %LCLop __ \field_arrow decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop plus1 :int -> int %LCLop DST_EET : -> _etime2e_Enum %LCLop __ \field_arrow thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_curr_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select int_curr_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 2 : -> int %LCLop __ \field_arrow grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select currency_symbol :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select currency_symbol :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 3 : -> int %LCLtag exception struct %LCLop __ \field_arrow int_curr_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_decimal_point :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_decimal_point :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 4 : -> int %LCLtag sstdlib_lcl1s struct %LCLop __ \field_arrow currency_symbol :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_thousands_sep :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_thousands_sep :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 5 : -> int %LCLop __ \field_arrow mon_decimal_point :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select mon_grouping :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select mon_grouping :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 6 : -> int %LCLop __ \select tv_sec :_timeval_Struct_Tuple -> int %LCLop __ \select tv_sec :_timeval_Struct -> _int_Obj %LCLop __ \field_arrow mon_thousands_sep :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select positive_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select positive_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 7 : -> int %LCLop __ \select tv_usec :_timeval_Struct_Tuple -> int %LCLop __ \select tv_usec :_timeval_Struct -> _int_Obj %LCLop __ \field_arrow mon_grouping :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select negative_sign :_lconv_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select negative_sign :_lconv_Struct -> ___char_Obj_Ptr_Obj %LCLop 8 : -> int %LCLtag sigvec struct %LCLop __ \field_arrow tv_sec :__timeval_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow positive_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select int_frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select int_frac_digits :_lconv_Struct -> _char_Obj %LCLop 9 : -> int %LCLop __ \field_arrow tv_usec :__timeval_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow negative_sign :__lconv_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select frac_digits :_lconv_Struct_Tuple -> char %LCLop __ \select frac_digits :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow int_frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select p_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow frac_digits :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select p_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_cs_precedes :_lconv_Struct_Tuple -> char %LCLop __ \select n_cs_precedes :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sep_by_space :_lconv_Struct_Tuple -> char %LCLop __ \select n_sep_by_space :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow n_cs_precedes :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select p_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select p_sign_posn :_lconv_Struct -> _char_Obj %LCLtag itimerval struct %LCLop __ \field_arrow n_sep_by_space :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \select n_sign_posn :_lconv_Struct_Tuple -> char %LCLop __ \select n_sign_posn :_lconv_Struct -> _char_Obj %LCLop __ \field_arrow p_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ \field_arrow n_sign_posn :__lconv_Struct_Ptr -> _char_Obj %LCLop __ * __ :int, int -> int %LCLop __ * __ :double, double -> double %LCLop __ \select tz_minuteswest :_timezone_Struct_Tuple -> int %LCLop __ \select tz_minuteswest :_timezone_Struct -> _int_Obj %LCLop __ \select tz_dsttime :_timezone_Struct_Tuple -> int %LCLop __ \select tz_dsttime :_timezone_Struct -> _int_Obj %LCLop __ \field_arrow tz_minuteswest :__timezone_Struct_Ptr -> _int_Obj %LCLop true : -> bool %LCLop __ \field_arrow tz_dsttime :__timezone_Struct_Ptr -> _int_Obj %LCLop false : -> bool %LCLtag sigaction struct %LCLop __ \and __ :bool, bool -> bool %LCLop __ \or __ :bool, bool -> bool %LCLtag tm struct %LCLop __ \select rem :_sstdlib_lcl0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib_lcl0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib_lcl1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib_lcl1s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select rem :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select rem :_sstdlib1s_Struct -> _int_Obj %LCLop __ \eq __ :bool, bool -> bool %LCLop __ \eq __ :int, int -> bool %LCLop __ \eq __ :double, double -> bool %LCLop __ \eq __ :_char_Vec, _char_Vec -> bool %LCLop __ \eq __ :char, char -> bool %LCLop \not __ :bool -> bool %LCLop __ \select quot :_sstdlib_lcl0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib_lcl0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib_lcl1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib_lcl1s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib0s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib0s_Struct -> _int_Obj %LCLop __ \select quot :_sstdlib1s_Struct_Tuple -> int %LCLop __ \select quot :_sstdlib1s_Struct -> _int_Obj %LCLop __ \neq __ :bool, bool -> bool %LCLop __ \neq __ :int, int -> bool %LCLop __ \neq __ :double, double -> bool %LCLop __ \neq __ :_char_Vec, _char_Vec -> bool %LCLop __ \neq __ :char, char -> bool %LCLop __ \field_arrow rem :__sstdlib_lcl0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib_lcl1s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow rem :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop { __ } :char -> _char_Vec %LCLop __ \field_arrow quot :__sstdlib_lcl0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib_lcl1s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib0s_Struct_Ptr -> _int_Obj %LCLop __ \field_arrow quot :__sstdlib1s_Struct_Ptr -> _int_Obj %LCLop EPERM : -> _eerrno0e_Enum %LCLop ENOENT : -> _eerrno0e_Enum %LCLtag sstdlib0s struct %LCLop ESRCH : -> _eerrno0e_Enum %LCLop EINTR : -> _eerrno0e_Enum %LCLop __ \select ttype :_exception_Struct_Tuple -> int %LCLop __ \select ttype :_exception_Struct -> _int_Obj %LCLop EIO : -> _eerrno0e_Enum %LCLop __ \select name :_exception_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select name :_exception_Struct -> ___char_Obj_Ptr_Obj %LCLop ENXIO : -> _eerrno0e_Enum %LCLop __ \field_arrow ttype :__exception_Struct_Ptr -> _int_Obj %LCLop __ \select arg1 :_exception_Struct_Tuple -> double %LCLop __ \select arg1 :_exception_Struct -> _double_Obj %LCLop E2BIG : -> _eerrno0e_Enum %LCLop __ \field_arrow name :__exception_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop __ \select arg2 :_exception_Struct_Tuple -> double %LCLop __ \select arg2 :_exception_Struct -> _double_Obj %LCLop ENOEXEC : -> _eerrno0e_Enum %LCLtag sstdlib1s struct %LCLop __ \field_arrow arg1 :__exception_Struct_Ptr -> _double_Obj %LCLop __ \select retval :_exception_Struct_Tuple -> double %LCLop __ \select retval :_exception_Struct -> _double_Obj %LCLop EBADF : -> _eerrno0e_Enum %LCLop __ \select sv_handler :_sigvec_Struct_Tuple -> _HOF_sort_43 %LCLop __ \select sv_handler :_sigvec_Struct -> _HOF_sort_43 %LCLop __ \field_arrow arg2 :__exception_Struct_Ptr -> _double_Obj %LCLop ECHILD : -> _eerrno0e_Enum %LCLop [__, __] :int, __char_Obj_Ptr -> _sigstack_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib_lcl0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib_lcl1s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib0s_Struct_Tuple %LCLop [__, __] :int, int -> _sstdlib1s_Struct_Tuple %LCLop [__, __] :int, int -> _timeval_Struct_Tuple %LCLop [__, __] :int, int -> _timezone_Struct_Tuple %LCLop [__, __] :_timeval_Struct_Tuple, _timeval_Struct_Tuple -> _itimerval_Struct_Tuple %LCLop __ \select sv_mask :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_mask :_sigvec_Struct -> _int_Obj %LCLop __ \field_arrow retval :__exception_Struct_Ptr -> _double_Obj %LCLop EAGAIN : -> _eerrno0e_Enum %LCLop __ [] :__char_Obj_Ptr -> __char_Obj_Arr %LCLop __ [] :__lconv_Struct_Ptr -> __lconv_Struct_Arr %LCLop __ [] :__exception_Struct_Ptr -> __exception_Struct_Arr %LCLop __ [] :__int_Obj_Ptr -> __int_Obj_Arr %LCLop __ [] :__double_Obj_Ptr -> __double_Obj_Arr %LCLop __ [] :__sigvec_Struct_Ptr -> __sigvec_Struct_Arr %LCLop __ [] :__sigaction_Struct_Ptr -> __sigaction_Struct_Arr %LCLop __ [] :__sigstack_Struct_Ptr -> __sigstack_Struct_Arr %LCLop __ [] :__sigcontext_Struct_Ptr -> __sigcontext_Struct_Arr %LCLop __ [] :__sstdlib_lcl0s_Struct_Ptr -> __sstdlib_lcl0s_Struct_Arr %LCLop __ [] :__sstdlib_lcl1s_Struct_Ptr -> __sstdlib_lcl1s_Struct_Arr %LCLop __ [] :__void_Obj_Ptr -> __void_Obj_Arr %LCLop __ [] :____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Arr %LCLop __ [] :__FILE_Obj_Ptr -> __FILE_Obj_Arr %LCLop __ [] :____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Arr %LCLop __ [] :__sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Arr %LCLop __ [] :__sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Arr %LCLop __ [] :__timeval_Struct_Ptr -> __timeval_Struct_Arr %LCLop __ [] :__timezone_Struct_Ptr -> __timezone_Struct_Arr %LCLop __ [] :__itimerval_Struct_Ptr -> __itimerval_Struct_Arr %LCLop __ [] :__tm_Struct_Ptr -> __tm_Struct_Arr %LCLop __ \field_arrow sv_handler :__sigvec_Struct_Ptr -> _HOF_sort_43 %LCLop __ \select sv_flags :_sigvec_Struct_Tuple -> int %LCLop __ \select sv_flags :_sigvec_Struct -> _int_Obj %LCLop ENOMEM : -> _eerrno0e_Enum %LCLtag sigstack struct %LCLop __ \field_arrow sv_mask :__sigvec_Struct_Ptr -> _int_Obj %LCLop [__, __, __] :int, int, _HOF_sort_43 -> _sigvec_Struct_Tuple %LCLop [__, __, __] :int, int, _HOF_sort_50 -> _sigaction_Struct_Tuple %LCLop EACCES : -> _eerrno0e_Enum %LCLop __ [__] :_char_Vec, int -> char %LCLop __ [__] :__char_Obj_Arr, int -> _char_Obj %LCLop __ [__] :__lconv_Struct_Tuple_Vec, int -> _lconv_Struct_Tuple %LCLop __ [__] :__lconv_Struct_Arr, int -> _lconv_Struct %LCLop __ [__] :__exception_Struct_Tuple_Vec, int -> _exception_Struct_Tuple %LCLop __ [__] :__exception_Struct_Arr, int -> _exception_Struct %LCLop __ [__] :_int_Vec, int -> int %LCLop __ [__] :__int_Obj_Arr, int -> _int_Obj %LCLop __ [__] :_double_Vec, int -> double %LCLop __ [__] :__double_Obj_Arr, int -> _double_Obj %LCLop __ [__] :__sigvec_Struct_Tuple_Vec, int -> _sigvec_Struct_Tuple %LCLop __ [__] :__sigvec_Struct_Arr, int -> _sigvec_Struct %LCLop __ [__] :__sigaction_Struct_Tuple_Vec, int -> _sigaction_Struct_Tuple %LCLop __ [__] :__sigaction_Struct_Arr, int -> _sigaction_Struct %LCLop __ [__] :__sigstack_Struct_Tuple_Vec, int -> _sigstack_Struct_Tuple %LCLop __ [__] :__sigstack_Struct_Arr, int -> _sigstack_Struct %LCLop __ [__] :__sigcontext_Struct_Tuple_Vec, int -> _sigcontext_Struct_Tuple %LCLop __ [__] :__sigcontext_Struct_Arr, int -> _sigcontext_Struct %LCLop __ [__] :__sstdlib_lcl0s_Struct_Tuple_Vec, int -> _sstdlib_lcl0s_Struct_Tuple %LCLop __ [__] :__sstdlib_lcl0s_Struct_Arr, int -> _sstdlib_lcl0s_Struct %LCLop __ [__] :__sstdlib_lcl1s_Struct_Tuple_Vec, int -> _sstdlib_lcl1s_Struct_Tuple %LCLop __ [__] :__sstdlib_lcl1s_Struct_Arr, int -> _sstdlib_lcl1s_Struct %LCLop __ [__] :_void_Vec, int -> void %LCLop __ [__] :__void_Obj_Arr, int -> _void_Obj %LCLop __ [__] :___char_Obj_Ptr_Vec, int -> __char_Obj_Ptr %LCLop __ [__] :____char_Obj_Ptr_Obj_Arr, int -> ___char_Obj_Ptr_Obj %LCLop __ [__] :_FILE_Vec, int -> FILE %LCLop __ [__] :__FILE_Obj_Arr, int -> _FILE_Obj %LCLop __ [__] :___void_Obj_Ptr_Vec, int -> __void_Obj_Ptr %LCLop __ [__] :____void_Obj_Ptr_Obj_Arr, int -> ___void_Obj_Ptr_Obj %LCLop __ [__] :__sstdlib0s_Struct_Tuple_Vec, int -> _sstdlib0s_Struct_Tuple %LCLop __ [__] :__sstdlib0s_Struct_Arr, int -> _sstdlib0s_Struct %LCLop __ [__] :__sstdlib1s_Struct_Tuple_Vec, int -> _sstdlib1s_Struct_Tuple %LCLop __ [__] :__sstdlib1s_Struct_Arr, int -> _sstdlib1s_Struct %LCLop __ [__] :__timeval_Struct_Tuple_Vec, int -> _timeval_Struct_Tuple %LCLop __ [__] :__timeval_Struct_Arr, int -> _timeval_Struct %LCLop __ [__] :__timezone_Struct_Tuple_Vec, int -> _timezone_Struct_Tuple %LCLop __ [__] :__timezone_Struct_Arr, int -> _timezone_Struct %LCLop __ [__] :__itimerval_Struct_Tuple_Vec, int -> _itimerval_Struct_Tuple %LCLop __ [__] :__itimerval_Struct_Arr, int -> _itimerval_Struct %LCLop __ [__] :__tm_Struct_Tuple_Vec, int -> _tm_Struct_Tuple %LCLop __ [__] :__tm_Struct_Arr, int -> _tm_Struct %LCLop __ \field_arrow sv_flags :__sigvec_Struct_Ptr -> _int_Obj %LCLop EFAULT : -> _eerrno0e_Enum %LCLop __ |- __ :_char_Vec, char -> _char_Vec %LCLop ENOTBLK : -> _eerrno0e_Enum %LCLop EBUSY : -> _eerrno0e_Enum %LCLop __ -| __ :char, _char_Vec -> _char_Vec %LCLop __ \select it_interval :_itimerval_Struct_Tuple -> _timeval_Struct_Tuple %LCLop __ \select it_interval :_itimerval_Struct -> _timeval_Struct %LCLop [__, __, __, __, __] :double, double, double, __char_Obj_Ptr, int -> _exception_Struct_Tuple %LCLop EEXIST : -> _eerrno0e_Enum %LCLop __ \select it_value :_itimerval_Struct_Tuple -> _timeval_Struct_Tuple %LCLop __ \select it_value :_itimerval_Struct -> _timeval_Struct %LCLop EXDEV : -> _eerrno0e_Enum %LCLop __ \field_arrow it_interval :__itimerval_Struct_Ptr -> _timeval_Struct %LCLop ENODEV : -> _eerrno0e_Enum %LCLop __ \field_arrow it_value :__itimerval_Struct_Ptr -> _timeval_Struct %LCLop ENOTDIR : -> _eerrno0e_Enum %LCLop __ \leq __ :int, int -> bool %LCLop __ \leq __ :double, double -> bool %LCLop EISDIR : -> _eerrno0e_Enum %LCLop EINVAL : -> _eerrno0e_Enum %LCLop __ \geq __ :int, int -> bool %LCLop __ \geq __ :double, double -> bool %LCLop ENFILE : -> _eerrno0e_Enum %LCLop \A :bool, bool -> bool %LCLop \A :int, bool -> bool %LCLop \A :double, bool -> bool %LCLop \A :_char_Vec, bool -> bool %LCLop \A :char, bool -> bool %LCLop __ \select sa_handler :_sigaction_Struct_Tuple -> _HOF_sort_50 %LCLop __ \select sa_handler :_sigaction_Struct -> _HOF_sort_50 %LCLop EMFILE : -> _eerrno0e_Enum %LCLtag sigcontext struct %LCLop \E :bool, bool -> bool %LCLop \E :int, bool -> bool %LCLop \E :double, bool -> bool %LCLop \E :_char_Vec, bool -> bool %LCLop \E :char, bool -> bool %LCLop __ \select sa_mask :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_mask :_sigaction_Struct -> _int_Obj %LCLop ENOTTY : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_handler :__sigaction_Struct_Ptr -> _HOF_sort_50 %LCLop __ \select sa_flags :_sigaction_Struct_Tuple -> int %LCLop __ \select sa_flags :_sigaction_Struct -> _int_Obj %LCLop ETXTBSY : -> _eerrno0e_Enum %LCLop null : -> char %LCLop __ \field_arrow sa_mask :__sigaction_Struct_Ptr -> _int_Obj %LCLop EFBIG : -> _eerrno0e_Enum %LCLop __ \field_arrow sa_flags :__sigaction_Struct_Ptr -> _int_Obj %LCLop ENOSPC : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __] :__char_Obj_Ptr, int, int, int, int, int, int, int, int, int, int -> _tm_Struct_Tuple %LCLop __ \select tm_sec :_tm_Struct_Tuple -> int %LCLop __ \select tm_sec :_tm_Struct -> _int_Obj %LCLop ESPIPE : -> _eerrno0e_Enum %LCLop __ \select tm_min :_tm_Struct_Tuple -> int %LCLop __ \select tm_min :_tm_Struct -> _int_Obj %LCLop 32 : -> double %LCLop EROFS : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_sec :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_hour :_tm_Struct_Tuple -> int %LCLop __ \select tm_hour :_tm_Struct -> _int_Obj %LCLop EMLINK : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_min :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_mday :_tm_Struct_Tuple -> int %LCLop __ \select tm_mday :_tm_Struct -> _int_Obj %LCLop __ \iff __ :bool, bool -> bool %LCLop EPIPE : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_hour :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_mon :_tm_Struct_Tuple -> int %LCLop __ \select tm_mon :_tm_Struct -> _int_Obj %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __] :int, int, int, int, int, _int_Vec, int, int, int, _int_Vec, int, int, int -> _sigcontext_Struct_Tuple %LCLop EDOM : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_mday :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_year :_tm_Struct_Tuple -> int %LCLop __ \select tm_year :_tm_Struct -> _int_Obj %LCLop ERANGE : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_mon :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_wday :_tm_Struct_Tuple -> int %LCLop __ \select tm_wday :_tm_Struct -> _int_Obj %LCLop EWOULDBLOCK : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_year :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_yday :_tm_Struct_Tuple -> int %LCLop __ \select tm_yday :_tm_Struct -> _int_Obj %LCLop EINPROGRESS : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_wday :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_isdst :_tm_Struct_Tuple -> int %LCLop __ \select tm_isdst :_tm_Struct -> _int_Obj %LCLop EALREADY : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_yday :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_gmtoff :_tm_Struct_Tuple -> int %LCLop __ \select tm_gmtoff :_tm_Struct -> _int_Obj %LCLop ENOTSOCK : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_isdst :__tm_Struct_Ptr -> _int_Obj %LCLop __ \select tm_zone :_tm_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select tm_zone :_tm_Struct -> ___char_Obj_Ptr_Obj %LCLop EDESTADDRREQ : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_gmtoff :__tm_Struct_Ptr -> _int_Obj %LCLop EMSGSIZE : -> _eerrno0e_Enum %LCLop __ \field_arrow tm_zone :__tm_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop EPROTOTYPE : -> _eerrno0e_Enum %LCLop ENOPROTOOPT : -> _eerrno0e_Enum %LCLop [__, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __] :char, char, char, char, char, char, char, char, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr, __char_Obj_Ptr -> _lconv_Struct_Tuple %LCLop EPROTONOSUPPORT : -> _eerrno0e_Enum %LCLop ESOCKTNOSUPPORT : -> _eerrno0e_Enum %LCLop EOPNOTSUPP : -> _eerrno0e_Enum %LCLop __ \select ss_sp :_sigstack_Struct_Tuple -> __char_Obj_Ptr %LCLop __ \select ss_sp :_sigstack_Struct -> ___char_Obj_Ptr_Obj %LCLop EPFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \select ss_onstack :_sigstack_Struct_Tuple -> int %LCLop __ \select ss_onstack :_sigstack_Struct -> _int_Obj %LCLop EAFNOSUPPORT : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_sp :__sigstack_Struct_Ptr -> ___char_Obj_Ptr_Obj %LCLop EADDRINUSE : -> _eerrno0e_Enum %LCLop __ \field_arrow ss_onstack :__sigstack_Struct_Ptr -> _int_Obj %LCLop EADDRNOTAVAIL : -> _eerrno0e_Enum %LCLop NIL : -> __char_Obj_Ptr %LCLop NIL : -> __lconv_Struct_Ptr %LCLop NIL : -> __exception_Struct_Ptr %LCLop NIL : -> __int_Obj_Ptr %LCLop NIL : -> __double_Obj_Ptr %LCLop NIL : -> __sigvec_Struct_Ptr %LCLop NIL : -> __sigaction_Struct_Ptr %LCLop NIL : -> __sigstack_Struct_Ptr %LCLop NIL : -> __sigcontext_Struct_Ptr %LCLop NIL : -> __sstdlib_lcl0s_Struct_Ptr %LCLop NIL : -> __sstdlib_lcl1s_Struct_Ptr %LCLop NIL : -> __void_Obj_Ptr %LCLop NIL : -> ____char_Obj_Ptr_Obj_Ptr %LCLop NIL : -> __FILE_Obj_Ptr %LCLop NIL : -> ____void_Obj_Ptr_Obj_Ptr %LCLop NIL : -> __sstdlib0s_Struct_Ptr %LCLop NIL : -> __sstdlib1s_Struct_Ptr %LCLop NIL : -> __timeval_Struct_Ptr %LCLop NIL : -> __timezone_Struct_Ptr %LCLop NIL : -> __itimerval_Struct_Ptr %LCLop NIL : -> __tm_Struct_Ptr %LCLop ENETDOWN : -> _eerrno0e_Enum %LCLop ENETUNREACH : -> _eerrno0e_Enum %LCLop ENETRESET : -> _eerrno0e_Enum %LCLop ECONNABORTED : -> _eerrno0e_Enum %LCLop ECONNRESET : -> _eerrno0e_Enum %LCLop ENOBUFS : -> _eerrno0e_Enum %LCLop EISCONN : -> _eerrno0e_Enum %LCLop - __ :int -> int %LCLop - __ :double -> double %LCLop ENOTCONN : -> _eerrno0e_Enum %LCLop __ + __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ + __ :int, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :int, int -> int %LCLop __ + __ :double, double -> double %LCLop __ + __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ + __ :int, __lconv_Struct_Ptr -> __lconv_Struct_Ptr %LCLop __ + __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ + __ :int, __exception_Struct_Ptr -> __exception_Struct_Ptr %LCLop __ + __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ + __ :int, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ + __ :int, __double_Obj_Ptr -> __double_Obj_Ptr %LCLop __ + __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ + __ :int, __sigvec_Struct_Ptr -> __sigvec_Struct_Ptr %LCLop __ + __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ + __ :int, __sigaction_Struct_Ptr -> __sigaction_Struct_Ptr %LCLop __ + __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ + __ :int, __sigstack_Struct_Ptr -> __sigstack_Struct_Ptr %LCLop __ + __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ + __ :int, __sigcontext_Struct_Ptr -> __sigcontext_Struct_Ptr %LCLop __ + __ :__char_Obj_Ptr, __char_Obj_Ptr -> __char_Obj_Ptr %LCLop __ + __ :__sstdlib_lcl0s_Struct_Ptr, int -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl0s_Struct_Ptr, __sstdlib_lcl0s_Struct_Ptr -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl1s_Struct_Ptr, int -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ + __ :__sstdlib_lcl1s_Struct_Ptr, __sstdlib_lcl1s_Struct_Ptr -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ + __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ + __ :__void_Obj_Ptr, __void_Obj_Ptr -> __void_Obj_Ptr %LCLop __ + __ :__int_Obj_Ptr, __int_Obj_Ptr -> __int_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ + __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ + __ :int, __FILE_Obj_Ptr -> __FILE_Obj_Ptr %LCLop __ + __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ + __ :int, ____void_Obj_Ptr_Obj_Ptr -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ + __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :int, __sstdlib0s_Struct_Ptr -> __sstdlib0s_Struct_Ptr %LCLop __ + __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :int, __sstdlib1s_Struct_Ptr -> __sstdlib1s_Struct_Ptr %LCLop __ + __ :__timeval_Struct_Ptr, int -> __timeval_Struct_Ptr %LCLop __ + __ :int, __timeval_Struct_Ptr -> __timeval_Struct_Ptr %LCLop __ + __ :__timezone_Struct_Ptr, int -> __timezone_Struct_Ptr %LCLop __ + __ :int, __timezone_Struct_Ptr -> __timezone_Struct_Ptr %LCLop __ + __ :__itimerval_Struct_Ptr, int -> __itimerval_Struct_Ptr %LCLop __ + __ :int, __itimerval_Struct_Ptr -> __itimerval_Struct_Ptr %LCLop __ + __ :__tm_Struct_Ptr, int -> __tm_Struct_Ptr %LCLop __ + __ :int, __tm_Struct_Ptr -> __tm_Struct_Ptr %LCLop __ \select sc_onstack :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_onstack :_sigcontext_Struct -> _int_Obj %LCLop ESHUTDOWN : -> _eerrno0e_Enum %LCLop __ - __ :__char_Obj_Ptr, int -> __char_Obj_Ptr %LCLop __ - __ :__char_Obj_Ptr, __char_Obj_Ptr -> int %LCLop __ - __ :int, int -> int %LCLop __ - __ :double, double -> double %LCLop __ - __ :__lconv_Struct_Ptr, int -> __lconv_Struct_Ptr %LCLop __ - __ :__lconv_Struct_Ptr, __lconv_Struct_Ptr -> int %LCLop __ - __ :__exception_Struct_Ptr, int -> __exception_Struct_Ptr %LCLop __ - __ :__exception_Struct_Ptr, __exception_Struct_Ptr -> int %LCLop __ - __ :__int_Obj_Ptr, int -> __int_Obj_Ptr %LCLop __ - __ :__int_Obj_Ptr, __int_Obj_Ptr -> int %LCLop __ - __ :__double_Obj_Ptr, int -> __double_Obj_Ptr %LCLop __ - __ :__double_Obj_Ptr, __double_Obj_Ptr -> int %LCLop __ - __ :__sigvec_Struct_Ptr, int -> __sigvec_Struct_Ptr %LCLop __ - __ :__sigvec_Struct_Ptr, __sigvec_Struct_Ptr -> int %LCLop __ - __ :__sigaction_Struct_Ptr, int -> __sigaction_Struct_Ptr %LCLop __ - __ :__sigaction_Struct_Ptr, __sigaction_Struct_Ptr -> int %LCLop __ - __ :__sigstack_Struct_Ptr, int -> __sigstack_Struct_Ptr %LCLop __ - __ :__sigstack_Struct_Ptr, __sigstack_Struct_Ptr -> int %LCLop __ - __ :__sigcontext_Struct_Ptr, int -> __sigcontext_Struct_Ptr %LCLop __ - __ :__sigcontext_Struct_Ptr, __sigcontext_Struct_Ptr -> int %LCLop __ - __ :__sstdlib_lcl0s_Struct_Ptr, int -> __sstdlib_lcl0s_Struct_Ptr %LCLop __ - __ :__sstdlib_lcl0s_Struct_Ptr, __sstdlib_lcl0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib_lcl1s_Struct_Ptr, int -> __sstdlib_lcl1s_Struct_Ptr %LCLop __ - __ :__sstdlib_lcl1s_Struct_Ptr, __sstdlib_lcl1s_Struct_Ptr -> int %LCLop __ - __ :__void_Obj_Ptr, int -> __void_Obj_Ptr %LCLop __ - __ :__void_Obj_Ptr, __void_Obj_Ptr -> int %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, int -> ____char_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____char_Obj_Ptr_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> int %LCLop __ - __ :__FILE_Obj_Ptr, int -> __FILE_Obj_Ptr %LCLop __ - __ :__FILE_Obj_Ptr, __FILE_Obj_Ptr -> int %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, int -> ____void_Obj_Ptr_Obj_Ptr %LCLop __ - __ :____void_Obj_Ptr_Obj_Ptr, ____void_Obj_Ptr_Obj_Ptr -> int %LCLop __ - __ :__sstdlib0s_Struct_Ptr, int -> __sstdlib0s_Struct_Ptr %LCLop __ - __ :__sstdlib0s_Struct_Ptr, __sstdlib0s_Struct_Ptr -> int %LCLop __ - __ :__sstdlib1s_Struct_Ptr, int -> __sstdlib1s_Struct_Ptr %LCLop __ - __ :__sstdlib1s_Struct_Ptr, __sstdlib1s_Struct_Ptr -> int %LCLop __ - __ :__timeval_Struct_Ptr, int -> __timeval_Struct_Ptr %LCLop __ - __ :__timeval_Struct_Ptr, __timeval_Struct_Ptr -> int %LCLop __ - __ :__timezone_Struct_Ptr, int -> __timezone_Struct_Ptr %LCLop __ - __ :__timezone_Struct_Ptr, __timezone_Struct_Ptr -> int %LCLop __ - __ :__itimerval_Struct_Ptr, int -> __itimerval_Struct_Ptr %LCLop __ - __ :__itimerval_Struct_Ptr, __itimerval_Struct_Ptr -> int %LCLop __ - __ :__tm_Struct_Ptr, int -> __tm_Struct_Ptr %LCLop __ - __ :__tm_Struct_Ptr, __tm_Struct_Ptr -> int %LCLop sizeof :bool -> int %LCLop sizeof :int -> int %LCLop sizeof :char -> int %LCLop sizeof :void -> int %LCLop sizeof :float -> int %LCLop sizeof :double -> int %LCLop sizeof :_eerrno0e_Enum -> int %LCLop sizeof :_emath1e_Enum -> int %LCLop sizeof :FILE -> int %LCLop sizeof :_etime2e_Enum -> int %LCLop __ \select sc_mask :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mask :_sigcontext_Struct -> _int_Obj %LCLop DOMAIN : -> _emath1e_Enum %LCLop ETOOMANYREFS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_onstack :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_pc :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_pc :_sigcontext_Struct -> _int_Obj %LCLop SING : -> _emath1e_Enum %LCLop ETIMEDOUT : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mask :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_regs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_regs :_sigcontext_Struct -> __int_Obj_Arr %LCLop OVERFLOW : -> _emath1e_Enum %LCLop ECONNREFUSED : -> _eerrno0e_Enum %LCLop isSub :_char_Vec, int -> bool %LCLop isSub :__char_Obj_Arr, int -> bool %LCLop isSub :__lconv_Struct_Tuple_Vec, int -> bool %LCLop isSub :__lconv_Struct_Arr, int -> bool %LCLop isSub :__exception_Struct_Tuple_Vec, int -> bool %LCLop isSub :__exception_Struct_Arr, int -> bool %LCLop isSub :_int_Vec, int -> bool %LCLop isSub :__int_Obj_Arr, int -> bool %LCLop isSub :_double_Vec, int -> bool %LCLop isSub :__double_Obj_Arr, int -> bool %LCLop isSub :__sigvec_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigvec_Struct_Arr, int -> bool %LCLop isSub :__sigaction_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigaction_Struct_Arr, int -> bool %LCLop isSub :__sigstack_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigstack_Struct_Arr, int -> bool %LCLop isSub :__sigcontext_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sigcontext_Struct_Arr, int -> bool %LCLop isSub :__sstdlib_lcl0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib_lcl0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib_lcl1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib_lcl1s_Struct_Arr, int -> bool %LCLop isSub :_void_Vec, int -> bool %LCLop isSub :__void_Obj_Arr, int -> bool %LCLop isSub :___char_Obj_Ptr_Vec, int -> bool %LCLop isSub :____char_Obj_Ptr_Obj_Arr, int -> bool %LCLop isSub :_FILE_Vec, int -> bool %LCLop isSub :__FILE_Obj_Arr, int -> bool %LCLop isSub :___void_Obj_Ptr_Vec, int -> bool %LCLop isSub :____void_Obj_Ptr_Obj_Arr, int -> bool %LCLop isSub :__sstdlib0s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib0s_Struct_Arr, int -> bool %LCLop isSub :__sstdlib1s_Struct_Tuple_Vec, int -> bool %LCLop isSub :__sstdlib1s_Struct_Arr, int -> bool %LCLop isSub :__timeval_Struct_Tuple_Vec, int -> bool %LCLop isSub :__timeval_Struct_Arr, int -> bool %LCLop isSub :__timezone_Struct_Tuple_Vec, int -> bool %LCLop isSub :__timezone_Struct_Arr, int -> bool %LCLop isSub :__itimerval_Struct_Tuple_Vec, int -> bool %LCLop isSub :__itimerval_Struct_Arr, int -> bool %LCLop isSub :__tm_Struct_Tuple_Vec, int -> bool %LCLop isSub :__tm_Struct_Arr, int -> bool %LCLtag lconv struct %LCLop __ \field_arrow sc_pc :__sigcontext_Struct_Ptr -> _int_Obj %LCLop UNDERFLOW : -> _emath1e_Enum %LCLop ELOOP : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_regs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_mdlo :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdlo :_sigcontext_Struct -> _int_Obj %LCLop TLOSS : -> _emath1e_Enum %LCLop ENAMETOOLONG : -> _eerrno0e_Enum %LCLop __ \select sc_mdhi :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_mdhi :_sigcontext_Struct -> _int_Obj %LCLop PLOSS : -> _emath1e_Enum %LCLop EHOSTDOWN : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdlo :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_ownedfp :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_ownedfp :_sigcontext_Struct -> _int_Obj %LCLop EHOSTUNREACH : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_mdhi :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpregs :_sigcontext_Struct_Tuple -> _int_Vec %LCLop __ \select sc_fpregs :_sigcontext_Struct -> __int_Obj_Arr %LCLop ENOTEMPTY : -> _eerrno0e_Enum %LCLop succ :int -> int %LCLtag emath1e enum %LCLop __ \field_arrow sc_ownedfp :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_fpc_csr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_csr :_sigcontext_Struct -> _int_Obj %LCLop EPROCLIM : -> _eerrno0e_Enum %LCLop pred :int -> int %LCLop __ \field_arrow sc_fpregs :__sigcontext_Struct_Ptr -> __int_Obj_Arr %LCLop __ \select sc_fpc_eir :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_fpc_eir :_sigcontext_Struct -> _int_Obj %LCLop EUSERS : -> _eerrno0e_Enum %LCLop __ \field_arrow sc_fpc_csr :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_cause :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_cause :_sigcontext_Struct -> _int_Obj %LCLop EDQUOT : -> _eerrno0e_Enum %LCLtag timeval struct %LCLop __ \field_arrow sc_fpc_eir :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badvaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badvaddr :_sigcontext_Struct -> _int_Obj %LCLop ESTALE : -> _eerrno0e_Enum %LCLop abs :int -> int %LCLop abs :double -> double %LCLop __ \field_arrow sc_cause :__sigcontext_Struct_Ptr -> _int_Obj %LCLop __ \select sc_badpaddr :_sigcontext_Struct_Tuple -> int %LCLop __ \select sc_badpaddr :_sigcontext_Struct -> _int_Obj %LCLop EREMOTE : -> _eerrno0e_Enum %LCLop div :int, int -> int %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLtype float float exposed %LCLtype bool bool immutable %LCLconst FALSE bool %LCLconst TRUE bool %LCLtype size_t _size_t exposed %LCLtype wchar_t _wchar_t exposed %LCLtype div_t _div_t exposed %LCLtype ldiv_t _ldiv_t exposed %LCLconst NULL __void_Obj_Ptr %LCLconst EXIT_FAILURE int %LCLconst EXIT_SUCCESS int %LCLconst RAND_MAX int %LCLconst MB_CUR_MAX int %LCLfcn abort : -> void %LCLfcnGlobals %LCLfcn abs : int -> int %LCLfcnGlobals %LCLfcn atexit : _HOF_sort_125 -> int %LCLfcnGlobals %LCLfcn atof : __char_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn atoi : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn atol : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn bsearch : __void_Obj_Ptr, __void_Obj_Ptr, int, int, _HOF_sort_126 -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn calloc : int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn div : int, int -> _sstdlib_lcl0s_Struct %LCLfcnGlobals %LCLfcn exit : int -> void %LCLfcnGlobals %LCLfcn free : __void_Obj_Ptr -> void %LCLfcnGlobals %LCLfcn getenv : __char_Obj_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn labs : int -> int %LCLfcnGlobals %LCLfcn ldiv : int, int -> _sstdlib_lcl1s_Struct %LCLfcnGlobals %LCLfcn malloc : int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn mblen : __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn mbstowcs : __int_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn mbtowc : __int_Obj_Ptr, __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn qsort : __void_Obj_Ptr, int, int, _HOF_sort_127 -> void %LCLfcnGlobals %LCLfcn rand : -> int %LCLfcnGlobals %LCLfcn realloc : __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn srand : int -> void %LCLfcnGlobals %LCLfcn strtod : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr -> double %LCLfcnGlobals %LCLfcn strtol : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn strtoul : __char_Obj_Ptr, ____char_Obj_Ptr_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn system : __char_Obj_Ptr -> int %LCLfcnGlobals %LCLfcn wcstombs : __char_Obj_Ptr, __int_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn wctomb : __char_Obj_Ptr, int -> int %LCLfcnGlobals %LCLfcn bcopy : __char_Obj_Ptr, __char_Obj_Ptr, int -> void %LCLfcnGlobals %LCLfcn bcmp : __char_Obj_Ptr, __char_Obj_Ptr, int -> bool %LCLfcnGlobals %LCLfcn bzero : __char_Obj_Ptr, int -> void %LCLfcnGlobals %LCLfcn ffs : int -> int %LCLfcnGlobals %LCLfcn memccpy : __void_Obj_Ptr, __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memchr : __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memcmp : __void_Obj_Ptr, __void_Obj_Ptr, int -> bool %LCLfcnGlobals %LCLfcn memcpy : __void_Obj_Ptr, __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memset : __void_Obj_Ptr, int, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLfcn memmove : __void_Obj_Ptr, __void_Obj_Ptr, int -> __void_Obj_Ptr %LCLfcnGlobals %LCLtype __timeval ___timeval exposed %LCLtype __timezone ___timezone exposed %LCLenumConst DST_NONE _etime2e_Enum %LCLenumConst DST_USA _etime2e_Enum %LCLenumConst DST_AUST _etime2e_Enum %LCLenumConst DST_WET _etime2e_Enum %LCLenumConst DST_MET _etime2e_Enum %LCLenumConst DST_EET _etime2e_Enum %LCLvar __timezones __etime2e_Enum_Obj %LCLfcn timerisset : _timeval_Struct_Tuple -> bool %LCLfcnGlobals %LCLvar timerclear _HOF_sort_142 %LCLconst ITIMER_REAL int %LCLconst ITIMER_VIRTUAL int %LCLconst ITIMER_PROF int %LCLtype __itimerval ___itimerval exposed %LCLtype __tm ___tm exposed %LCLtype time_t _time_t exposed %LCLtype clock_t _clock_t exposed %LCLconst CLOCKS_PER_SEC int %LCLfcn asctime : __tm_Struct_Ptr -> __char_Obj_Ptr %LCLfcnGlobals %LCLfcn clock : -> int %LCLfcnGlobals %LCLvar ctime _HOF_sort_157 %LCLfcn difftime : int, int -> double %LCLfcnGlobals %LCLfcn gmtime : __int_Obj_Ptr -> __tm_Struct_Ptr %LCLfcnGlobals %LCLfcn localtime : __int_Obj_Ptr -> __tm_Struct_Ptr %LCLfcnGlobals %LCLfcn mktime : __tm_Struct_Ptr -> int %LCLfcnGlobals %LCLfcn strftime : __char_Obj_Ptr, int, __char_Obj_Ptr, __tm_Struct_Ptr -> int %LCLfcnGlobals %LCLfcn time : __int_Obj_Ptr -> int %LCLfcnGlobals %LCLvar tzname ____char_Obj_Ptr_Obj_Arr %LCLfcn timezone : -> __char_Obj_Ptr %LCLfcnGlobals %LCLSymbolTableEnd splint-3.1.2.dfsg1/test/0000755021234200000250000000000010654216747012436 5ustar faxsplint-3.1.2.dfsg1/test/conditions/0000755021234200000250000000000010645776270014611 5ustar faxsplint-3.1.2.dfsg1/test/conditions/miroslaw.c0000644021234200000250000000037007320411704016572 0ustar fax#include typedef struct ipp_s *ipp; struct ipp_s { /*@only@*/ /*@notnull@*/ int *ip; }; extern void ipp_delete(/*@special@*/ /*@only@*/ /*@notnull@*/ ipp This) /*@releases *This@*/; void ipp_delete(ipp This) { free(This); } splint-3.1.2.dfsg1/test/conditions/releases.c0000644021234200000250000000040507320411704016537 0ustar fax#include typedef struct ipp_s *ipp; struct ipp_s { /*@only@*/ /*@notnull@*/ int *ip; } ; extern void ipp_delete(/*@only@*/ /*@notnull@*/ ipp This) ; void ipp_delete(ipp This) { free(This); /* should be error for not deleting This->ip! */ } splint-3.1.2.dfsg1/test/conditions/Makefile0000644021234200000250000000016207320411704016230 0ustar fax.PHONY: releases LCLINT = lclint all: releases releases: ${LCLINT} miroslaw.c -expect 1 ${LCLINT} releases.c splint-3.1.2.dfsg1/test/db1/0000755021234200000250000000000010645776270013106 5ustar faxsplint-3.1.2.dfsg1/test/db1/erc.lcl0000644021234200000250000000323107121317337014340 0ustar faximports eref; mutable type erc; mutable type ercIter; erc erc_create(void) { /* ensures fresh(result) /\ result' = { }; */ } void erc_clear(erc c) { /* requires c^.activeIters = 0; */ modifies c; /* ensures c' = { }; */ } void erc_insert(erc c, eref er) { /* requires c^.activeIters = 0 /\ er \neq erefNIL; */ modifies c; /* ensures c' = [insert(er, c^.val), 0]; */ } bool erc_delete(erc c, eref er) { /* requires c^.activeIters = 0; */ modifies c; /* ensures result = er \in c^.val /\ c' = [delete(er, c^.val), 0]; */ } bool erc_member(eref er, erc c) { /* ensures result = er \in c^.val; */ } eref erc_choose(erc c) { /* requires size(c^.val) \neq 0; */ /* ensures result \in c^.val; */ } int erc_size(erc c) { /* ensures result = size(c^.val); */ } ercIter erc_iterStart(erc c) { modifies c; /* ensures fresh(result) /\ result' = [c^.val, c] /\ c' = startIter(c^); */ } eref erc_yield(ercIter it) { modifies it; /* , it^.eObj */ /* ensures if it^.toYield \neq { } then yielded(result, it^, it') /\ (it^.eObj)' = (it^.eObj)^ else result = erefNIL /\ trashed(it) /\ (it^.eObj)' = endIter((it^.eObj)^); */ } void erc_iterFinal(ercIter it) { modifies it; /* , it^.eObj; */ /* ensures trashed(it) /\ (it^.eObj)' = endIter((it^.eObj)^); */ } void erc_join(erc c1, erc c2) { /* requires c1^.activeIters = 0; */ modifies c1; /* ensures c1' = [c1^.val \U c2^.val, 0]; */ } char *erc_sprint(erc c) { /* ensures isSprint(result[]', c^) /\ fresh(result[]); */ } void erc_final(erc c) { modifies c; /* ensures trashed(c); */ } void erc_initMod(void) { ensures true; } splint-3.1.2.dfsg1/test/db1/bool.lcl0000644021234200000250000000010007121317337014512 0ustar faximmutable type bool; constant bool TRUE; constant bool FALSE; splint-3.1.2.dfsg1/test/db1/dbase.lcl0000644021234200000250000000372007121317337014650 0ustar faximports employee, empset, ; typedef struct{gender g; job j; int l; int h;} db_q; typedef enum {db_OK, salERR, genderERR, jobERR, duplERR, missERR} db_status; spec immutable type db; spec db d; claims UniqueKeys (employee e1, employee e2) db d; { /* ensures (e1 \in d\any /\ e2 \in d\any /\ e1.ssNum = e2.ssNum) => (e1 = e2); */ } db_status hire(employee e) db d; { modifies d; /* ensures (if result = db_OK then d' = hire(e, d^) else d' = d^) /\ result = (if e.gen = gender_ANY then genderERR else if e.j = job_ANY then jobERR else if e.salary < 0 then salERR else if employed(d^, e.ssNum) then duplERR else db_OK); */ } void uncheckedHire(employee e) db d; { /* requires e.gen \neq gender_ANY /\ e.j \neq job_ANY /\ e.salary >= 0 /\ ~employed(d^, e.ssNum); */ modifies d; /* ensures d' = hire(e, d^); */ } bool fire(int ssNum) db d; { modifies d; /* ensures result = employed(d^, ssNum) /\ d' = fire(d^, ssNum); */ } int query(db_q q, empset s) db d; { modifies s; /* ensures s' = s^ \U query(d^, q) /\ result = size(query(d^, q)); */ } bool promote(int ssNum) db d; { modifies d; /* ensures result = (employed(d^, ssNum) /\ find(d^, ssNum).j = NONMGR) /\ (if result then d' = promote(d^, ssNum) else d' = d^); */ } db_status setSalary(int ssNum, int sal) db d; { modifies d; /* ensures result = (if employed(d^, ssNum) then (if sal < 0 then salERR else db_OK) else missERR) /\ (if result = db_OK then d' = setSal(d^, ssNum, sal) else d' = d^); */ } void db_print(void) db d; FILE *stdout; { modifies *stdout^; /* ensures \exists s:ioStream ((*stdout^)' = write((*stdout^)^, s) /\ isSprint(d^, s)); */ } void db_initMod(void) db d; { modifies d; /* ensures d' = new; */ } splint-3.1.2.dfsg1/test/db1/employee.lcl0000644021234200000250000000213607121317337015411 0ustar faximports bool; constant int maxEmployeeName; constant int employeePrintSize; typedef enum { MALE, FEMALE, gender_ANY } gender; typedef enum { MGR, NONMGR, job_ANY } job; typedef struct { int ssNum; char name[maxEmployeeName]; int salary; gender gen; job j; } employee; void employee_sprint (out char s[], employee e) { /* requires maxIndex(s) >= employeePrintSize; */ modifies s; /* ensures isSprint(s', e) /\ lenStr(s') = employeePrintSize; */ } bool employee_equal (employee *e1, employee *e2) { /* ensures result = sameStr(e1->name^, e2->name^) /\ (e1->ssNum^ = e2->ssNum^) /\ (e1->salary^ = e2->salary^) /\ (e1->gen^ = e2->gen^) /\ (e1->j^ = e2->j^); */ } bool employee_setName(employee *e, char na[]) { /* requires nullTerminated(na^); */ modifies e->name; /* ensures result = lenStr(na^) < maxEmployeeName /\ (if result then sameStr(e->name', na^) /\ nullTerminated(e->name') else e->name' = e->name^); */ } void employee_initMod(void) { ensures true; } splint-3.1.2.dfsg1/test/db1/empset.lcl0000644021234200000250000000270207121317337015066 0ustar faximports employee; mutable type empset; empset empset_create(void) { /* ensures fresh(result) /\ result' = { }; */ } void empset_final(empset s) { modifies s; /* ensures trashed(s); */ } void empset_clear(empset s) { modifies s; /* ensures s' = { }; */ } bool empset_insert(empset s, employee e) { modifies s; /* ensures result = ~(e \in s^) /\ s' = insert(e, s^); */ } void empset_insertUnique(empset s, employee e) { /* requires ~(e \in s^); */ modifies s; /* ensures s' = insert(e, s^); */ } bool empset_delete(empset s, employee e) { modifies s; /* ensures result = e \in s^ /\ s' = delete(e, s^); */ } empset empset_union(empset s1, empset s2) { /* ensures result' = s1^ \U s2^ /\ fresh(result); */ } empset empset_disjointUnion(empset s1, empset s2) { /* requires s1^ \I s2^ = { }; */ /* ensures result' = s1^ \U s2^ /\ fresh(result); */ } void empset_intersect(empset s1, empset s2) { modifies s1; /* ensures s1' = s1^ \I s2^; */ } int empset_size(empset s) { /* ensures result = size(s^); */ } bool empset_member(employee e, empset s) { /* ensures result = e \in s^; */ } bool empset_subset(empset s1, empset s2) { /* ensures result = s1^ \subseteq s2^; */ } employee empset_choose(empset s) { /* requires s^ \neq { }; */ /* ensures result \in s^; */ } char *empset_sprint(empset s) { /* ensures isSprint(result[]', s^) /\ fresh(result[]); */ } void empset_initMod(void) { ensures true; } splint-3.1.2.dfsg1/test/db1/eref.lcl0000644021234200000250000000132107121317337014506 0ustar faximports employee; immutable type eref; spec immutable type map; spec map m; constant eref erefNIL; eref eref_alloc(void) map m; { modifies m; /* ensures newInd(result, m^, m'); */ } void eref_free(eref er) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = delete(m^, er); */ } void eref_assign(eref er, employee e) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = assign(m^, er, e); */ } employee eref_get(eref er) map m; { /* requires er \in domain(m^); */ /* ensures result = m^[er]; */ } bool eref_equal(eref er1, eref er2) { /* ensures result = (er1 = er2); */ } void eref_initMod(void) map m; { modifies m; /* ensures m' = new; */ } splint-3.1.2.dfsg1/test/db1/ereftab.lcl0000644021234200000250000000101707121317337015177 0ustar faximports employee, eref; mutable type ereftab; ereftab ereftab_create(void) { /* ensures result' = empty; */ } void ereftab_insert(ereftab t, employee e, eref er) { /* requires getERef(t^, e) = erefNIL; */ modifies t; /* ensures t' = add(t^, e, er); */ } bool ereftab_delete(ereftab t, eref er) { modifies t; /* ensures result = in(t^, er) /\ t' = delete(t^, er); */ } eref ereftab_lookup(employee e, ereftab t) { /* ensures result = getERef(t^, e); */ } void ereftab_initMod(void) { ensures true; } splint-3.1.2.dfsg1/test/db1/dbase.c0000644021234200000250000001041707121317337014321 0ustar fax# include # include "dbase.h" # define firstERC mMGRS # define lastERC fNON # define numERCS (lastERC - firstERC + 1) typedef enum { mMGRS, fMGRS, mNON, fNON } employeeKinds; erc db[numERCS]; bool initDone = FALSE; void db_initMod (void) { int i; if (initDone) { return; } bool_initMod (); employee_initMod (); eref_initMod (); erc_initMod (); empset_initMod (); for (i = firstERC; i <= lastERC; i++) { db[i] = erc_create (); } initDone = TRUE; } eref _db_ercKeyGet (erc c, int key) { eref er; ercIter it; for_ercElems (er, it, c) { if (eref_get (er).ssNum == key) { erc_iterReturn (it, er); } } return erefNIL; } eref _db_keyGet (int key) { int i; eref er; for (i = firstERC; i <= lastERC; i++) { er = _db_ercKeyGet (db[i], key); if (!eref_equal (er, erefNIL)) { return er; } } return erefNIL; } int _db_addEmpls (erc c, int l, int h, empset s) { eref er; ercIter it; employee e; int numAdded; numAdded = 0; for_ercElems (er, it, c) { e = eref_get (er); if ((e.salary >= l) && (e.salary <= h)) { empset_insert (s, e); numAdded++; } } return numAdded; } db_status hire (employee e) { if (e.gen == gender_ANY) return genderERR; if (e.j == job_ANY) return jobERR; if (e.salary < 0) return salERR; if (!eref_equal (_db_keyGet (e.ssNum), erefNIL)) return duplERR; uncheckedHire (e); return db_OK; } void uncheckedHire (employee e) { eref er; er = eref_alloc (); eref_assign (er, e); if (e.gen == MALE) if (e.j == MGR) erc_insert (db[mMGRS], er); else erc_insert (db[mNON], er); else if (e.j == MGR) erc_insert (db[fMGRS], er); else erc_insert (db[fNON], er); } bool fire (int ssNum) { int i; eref er; ercIter it; for (i = firstERC; i <= lastERC; i++) for_ercElems (er, it, db[i]) if (eref_get (er).ssNum == ssNum) { erc_iterFinal (it); erc_delete (db[i], er); return TRUE; } return FALSE; } bool promote (int ssNum) { eref er; employee e; gender g; g = MALE; er = _db_ercKeyGet (db[mNON], ssNum); if (eref_equal (er, erefNIL)) { er = _db_ercKeyGet (db[fNON], ssNum); if (eref_equal (er, erefNIL)) return FALSE; g = FEMALE; } e = eref_get (er); e.j = MGR; eref_assign (er, e); if (g == MALE) { erc_delete (db[mNON], er); erc_insert (db[mMGRS], er); } else { erc_delete (db[fNON], er); erc_insert (db[fMGRS], er); } return TRUE; } db_status setSalary (int ssNum, int sal) { eref er; employee e; if (sal < 0) { return salERR; } er = _db_keyGet (ssNum); if (eref_equal (er, erefNIL)) { return missERR; } e = eref_get (er); e.salary = sal; eref_assign (er, e); return db_OK; } int query (db_q q, empset s) { eref er; employee e; int numAdded; int l, h; int i; l = q.l; h = q.h; switch (q.g) { case gender_ANY: switch (q.j) { case job_ANY: numAdded = 0; for (i = firstERC; i <= lastERC; i++) numAdded += _db_addEmpls (db[i], l, h, s); return numAdded; case MGR: numAdded = _db_addEmpls (db[mMGRS], l, h, s); numAdded += _db_addEmpls (db[fMGRS], l, h, s); return numAdded; case NONMGR: numAdded = _db_addEmpls (db[mNON], l, h, s); numAdded += _db_addEmpls (db[fNON], l, h, s); return numAdded; } case MALE: switch (q.j) { case job_ANY: numAdded = _db_addEmpls (db[mMGRS], l, h, s); numAdded += _db_addEmpls (db[mNON], l, h, s); return numAdded; case MGR: return _db_addEmpls (db[mMGRS], l, h, s); case NONMGR: return _db_addEmpls (db[mNON], l, h, s); } case FEMALE: switch (q.j) { case job_ANY: numAdded = _db_addEmpls (db[fMGRS], l, h, s); numAdded += _db_addEmpls (db[fNON], l, h, s); return numAdded; case MGR: return _db_addEmpls (db[fMGRS], l, h, s); case NONMGR: return _db_addEmpls (db[fNON], l, h, s); } } } void db_print (void) { int i; char *printVal; printf ("Employees:\n"); for (i = firstERC; i <= lastERC; i++) { printVal = erc_sprint (db[i]); printf ("%s", printVal); free (printVal); } } splint-3.1.2.dfsg1/test/db1/drive.c0000644021234200000250000000656107121317337014361 0ustar fax/* Part of a driver used to test dbase */ /* Include those modules that export things that are used explicitly here */ # include # include "bool.h" # include "employee.h" # include "empset.h" # include "dbase.h" int main(int argc, char *argv[]) { employee e; empset em1, em2, em3; char na[10000]; char * sprintResult; int i, j; db_q q; /* Initialize all of the LCL-specified modules that were included */ bool_initMod(); employee_initMod(); empset_initMod(); db_initMod(); if (argc != 1) { printf ("FormatPos: Wrong number of arguments. Given %d needs 0.\n", argc - 1); return 1; } /* Unit test empset */ em1 = empset_create(); if (!(empset_size(em1) == 0)) { printf("Size should be 0.\n"); } for (i = 0; i < 500; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); employee_setName(&e, na); empset_insert(em1, e); } if (!(empset_size(em1) == 500)) { printf("Size should be 500.\n"); } for (i = 0; i < 250; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); employee_setName(&e, na); empset_delete(em1, e); } if (!(empset_size(em1) == 250)) { printf("Size should be 250.\n"); } em2 = empset_create(); for (i = 0; i < 100; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); employee_setName(&e, na); empset_insert(em2, e); } em3 = empset_union(em1, em2); if (!(empset_size(em3) == 350)) { printf("Size should be 350.\n"); } empset_intersect(em3, em3); if (!(empset_size(em3) == 350)) { printf("Size should be 350.\n"); } printf("Print two different employees:\n"); for (i = 0; i < 2; i++) { e = empset_choose(em3); employee_sprint(na, e); printf("%s\n", &(na[0])); empset_delete(em3, e); } /* Test dbase */ for (i = 0; i < 20; i++) { e.ssNum = i; e.salary = 10 * i; if (i < 10) e.gen = MALE; else e.gen = FEMALE; if (i < 15) e.j = NONMGR; else e.j = MGR; (void) sprintf(na, "J. Doe %d", i); employee_setName(&e, na); if ((i/2)*2 == i) { hire(e); } else { uncheckedHire(e); j = hire(e); } } printf("Should print 4: %d\n", j); printf("Employees 0 - 19\n"); db_print(); fire(17); q.g = FEMALE; q.j = job_ANY; q.l = 158; q.h = 185; printf("Employees 0 - 16, 18 - 19\n"); db_print(); i = query(q, em1 = empset_create()); sprintResult = empset_sprint(em1); printf("Should get two females: %d\n%s\n", i, sprintResult); free(sprintResult); q.g = MALE; q.j = NONMGR; q.l = 0; q.h = 185; i = query(q, em2 = empset_create()); em3 = empset_disjointUnion(em2, em1); sprintResult = empset_sprint(em3); i = empset_size(em3); printf("Should get two females and ten males: %d\n%s\n", i, sprintResult); free(sprintResult); empset_intersect(em1, em3); sprintResult = empset_sprint(em1); i = empset_size(em1); printf("Should get two females: %d\n%s\n", i, sprintResult); free(sprintResult); fire(empset_choose(em3).ssNum); printf("Should get 18 employees\n"); db_print(); return 0; } splint-3.1.2.dfsg1/test/db1/employee.c0000644021234200000250000000145607323413233015061 0ustar fax# include # include # include "employee.h" bool employee_setName (employee *e, char na []) { int i; for (i = 0; na[i] != '\0'; i++) { if (i == maxEmployeeName) return FALSE; /* e->name is not defined (new error - 2001-07-12) */ } strcpy (e->name, na); return TRUE; } bool employee_equal (employee * e1, employee * e2) { return ((e1->ssNum == e2->ssNum) && (e1->salary == e2->salary) && (e1->gen == e2->gen) && (e1->j == e2->j) && (strncmp (e1->name, e2->name, maxEmployeeName) == 0)); } void employee_sprint (char s[], employee e) { static char *gender[] ={ "male", "female", "?" }; static char *jobs[] = { "manager", "non-manager", "?" }; (void) sprintf (s, employeeFormat, e.ssNum, e.name, gender[e.gen], jobs[e.j], e.salary); } splint-3.1.2.dfsg1/test/db1/empset.c0000644021234200000250000000461607121317337014544 0ustar fax# include "empset.h" static bool initDone = FALSE; eref _empset_get (employee e, erc s) { eref er; ercIter it; employee e1; for_ercElems (er, it, s) { e1 = eref_get (er); if (employee_equal (&e1, &e)) erc_iterReturn (it, er); } return erefNIL; } void empset_clear (empset s) { erc_clear (s); } bool empset_insert (empset s, employee e) { eref er; if (!eref_equal (_empset_get (e, s), erefNIL)) { return FALSE; } empset_insertUnique (s, e); return TRUE; } void empset_insertUnique (empset s, employee e) { eref er; er = ereftab_lookup (e, known); if (eref_equal (er, erefNIL)) { er = eref_alloc ( ); eref_assign (er,e); ereftab_insert (known, e, er); } erc_insert (s, er); } bool empset_delete (empset s, employee e) { eref er; er = _empset_get (e, s); if (eref_equal (er, erefNIL)) { return FALSE; } return erc_delete (s, er); } empset empset_disjointUnion (empset s1, empset s2) { erc result; ercIter it; eref er; empset tmp; result = erc_create ( ); if (erc_size (s1) > erc_size (s2)) { tmp = s1; s1 = s2; s2 = tmp; } erc_join (result, s1); for_ercElems (er, it, s2) empset_insertUnique (result, eref_get (er)); return result; } empset empset_union (empset s1, empset s2) { eref er; ercIter it; erc result; empset tmp; result = erc_create (); if (erc_size (s1) > erc_size (s2)) { tmp = s1; s1 = s2; s2 = tmp; } erc_join (result, s2); for_ercElems (er, it, s1) if (!empset_member (eref_get (er), s2)) erc_insert (result, er); return result; } void empset_intersect (empset s1, empset s2) { eref er; ercIter it; erc toDelete; toDelete = erc_create (); for_ercElems (er, it, s1) if (!empset_member (eref_get (er), s2)) erc_insert (toDelete, er); for_ercElems (er, it, toDelete) erc_delete (s1, er); erc_final (toDelete); } bool empset_subset (empset s1, empset s2) { employee e; eref er; ercIter it; for_ercElems (er, it, s1) if (!empset_member (eref_get (er), s2)) erc_iterReturn (it, FALSE); return TRUE; } void empset_initMod (void) { if (initDone) return; bool_initMod (); employee_initMod (); eref_initMod (); erc_initMod (); ereftab_initMod (); known = ereftab_create (); initDone = TRUE; } splint-3.1.2.dfsg1/test/db1/erc.c0000644021234200000250000000467607320411712014017 0ustar fax# include # include "erc.h" erc erc_create (void) { erc c; c = (erc) malloc (sizeof (ercInfo)); if (c == 0) { printf ("Malloc returned null in erc_create\n"); exit (1); } c->vals = 0; c->size = 0; return c; } void erc_clear (erc c) /*@ensures isnull c->vals, c->elem@*/ { ercList elem; ercList next; for (elem = c->vals; elem != 0; elem = next) { next = elem->next; elem->next = NULL; free (elem); } c->vals = 0; c->size = 0; } void erc_final (erc c) { erc_clear (c); free (c); } bool erc_member (eref er, erc c) { ercList tmpc; for (tmpc = c->vals; tmpc != 0; tmpc = tmpc->next) if (tmpc->val == er) return TRUE; return FALSE; } void erc_insert (erc c, eref er) { ercList newElem; newElem = (ercElem *) malloc (sizeof (ercElem)); if (newElem == 0) { printf ("Malloc returned null in erc_insert\n"); exit (1); } newElem->val = er; newElem->next = c->vals; c->vals = newElem; c->size++; } bool erc_delete (erc c, eref er) { ercList elem; ercList prev; for (prev = 0, elem = c->vals; elem != 0; prev = elem, elem = elem->next) { if (elem->val == er) { if (prev == 0) { c->vals = elem->next; elem->next = 0; } else { prev->next = elem->next; elem->next = 0; } free (elem); c->size--; return TRUE; } } return FALSE; } ercIter erc_iterStart (erc c) { ercIter result; result = (ercIter) malloc (sizeof (ercList)); if (result == 0) { printf ("Malloc returned null in erc_iterStart\n"); exit (1); } *result = c->vals; return result; } eref erc_yield (ercIter it) { eref result; if (*it == 0) { return erefNIL; free (it); } result = (*it)->val; *(it) = (*it)->next; return result; } void erc_join (erc c1, erc c2) { ercList tmpc; for (tmpc = c2->vals; tmpc != 0; tmpc = tmpc->next) erc_insert (c1, tmpc->val); } char *erc_sprint (erc c) { int len; eref er; ercIter it; char *result; result = (char *) malloc (erc_size (c) * (employeePrintSize + 1) + 1); if (result == 0) { printf ("Malloc returned null in erc_sprint\n"); exit (1); } len = 0; for_ercElems (er, it, c) { employee_sprint (&(result[len]), eref_get (er)); len += employeePrintSize; result[len++] = '\n'; } result[len] = '\0'; return result; } splint-3.1.2.dfsg1/test/db1/eref.c0000644021234200000250000000323607650577033014175 0ustar fax# include # include # include "eref.h" eref_ERP eref_Pool; /* private */ static bool needsInit = TRUE; /* private */ eref eref_alloc (void) { int i, res; for (i=0; (eref_Pool.status[i] == used) && (i < eref_Pool.size); i++); res = i; if (res == eref_Pool.size) { eref_Pool.conts = (employee *) realloc (eref_Pool.conts, 2 * eref_Pool.size * sizeof (employee)); if (eref_Pool.conts == 0) { printf ("Malloc returned null in eref_alloc\n"); exit (1); } eref_Pool.status = (eref_status *) realloc (eref_Pool.status, 2 * eref_Pool.size * sizeof (eref_status)); if (eref_Pool.status == 0) { printf ("Malloc returned null in eref_alloc\n"); exit (1); } eref_Pool.size = 2*eref_Pool.size; for (i = res+1; i < eref_Pool.size; i++) eref_Pool.status[i] = avail; } eref_Pool.status[res] = used; return (eref) res; } void eref_initMod (void) { int i; const int size = 16; if (needsInit == false) /* will produce a warning if FALSE is used instead */ { return; } needsInit = FALSE; bool_initMod (); employee_initMod (); eref_Pool.conts = (employee *) malloc (size * sizeof (employee)); if (eref_Pool.conts == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (1); } eref_Pool.status = (eref_status *) malloc (size * sizeof (eref_status)); if (eref_Pool.status == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (1); } eref_Pool.size = size; for (i = 0; i < size; i++) { eref_Pool.status[i] = avail; } } splint-3.1.2.dfsg1/test/db1/ereftab.c0000644021234200000250000000135007121317337014647 0ustar fax/* ** This is not a good implementation. I should probably replace ** the erc with a hash table. */ # include "ereftab.h" ereftab ereftab_create (void) { return erc_create (); } void ereftab_insert (ereftab t, employee e, eref er) { eref_assign (er, e); erc_insert (t, er); } bool ereftab_delete (ereftab t, eref er) { bool result; result = erc_member (er, t); erc_delete (t, er); return result; } eref ereftab_lookup (employee e, ereftab t) { eref er; employee e1; ercIter it; for_ercElems (er, it, t) { e1 = eref_get (er); if (employee_equal (&e, &e1)) return er; } return erefNIL; } void ereftab_initMod (void) { bool_initMod (); eref_initMod (); erc_initMod (); } splint-3.1.2.dfsg1/test/db1/bool.h0000644021234200000250000000136507650577033014215 0ustar fax#ifndef BOOL_H #define BOOL_H #ifndef FALSE #define FALSE false #endif #ifndef TRUE #define TRUE true #endif /*@-cppnames@*/ typedef int bool; /*@=cppnames@*/ /* ** bool_initMod has no real effect ** Declared with modifies internalState, so no noeffect errors are ** reported when it is called.) */ extern /*@unused@*/ void bool_initMod (void) /*@modifies internalState@*/ ; /*@-mustmod@*/ # define bool_initMod() /*@=mustmod@*/ extern /*@unused@*/ /*@observer@*/ char *bool_unparse (bool) /*@*/ ; # define bool_unparse(b) ((b) ? "true" : "false" ) extern /*@unused@*/ bool bool_not (bool) /*@*/ ; # define bool_not(b) ((b) ? FALSE : TRUE) extern /*@unused@*/ bool bool_equal (bool, bool) /*@*/ ; # define bool_equal(a,b) ((a) ? (b) : !(b)) # endif splint-3.1.2.dfsg1/test/db1/dbase.h0000644021234200000250000000014707121317337014325 0ustar fax# ifndef DBASE_H # define DBASE_H # include "eref.h" # include "erc.h" # include "dbase.lh" # endif splint-3.1.2.dfsg1/test/db1/employee.h0000644021234200000250000000111607414547435015074 0ustar fax# ifndef EMPLOYEE_H # define EMPLOYEE_H # define maxEmployeeName (20) # define employeeFormat "%9d %-20s %-6s %-11s %6d.00" # define employeePrintSize (63) # include "employee.lh" /* Override the definition in employee.lh (can't put this in .lcl) */ /*@-incondefs@*/ /*@-redecl@*/ /*@-protoparammatch@*/ extern bool employee_setName (/*@special@*/ employee *p_e, char /* na */[]) /*@sets p_e->name@*/; /* evans 2002-01-01: was defined, bug fix in splint detected error */ /*@=incondefs@*/ /*@=redecl@*/ /*@=protoparammatch@*/ # define employee_initMod() bool_initMod() # endif splint-3.1.2.dfsg1/test/db1/empset.h0000644021234200000250000000143407121317337014544 0ustar fax# ifndef EMPSET_H # define EMPSET_H # include "eref.h" # include "erc.h" # include "ereftab.h" typedef erc empset; ereftab known; /* Abstraction function, toEmpSet: e \in toEmpSet(s) == exists er (count(er, s.val) = 1 /\ getERef(known, e) = er) Rep invariant: forall s: empset (forall er: eref (count(er, s.val) <= 1) /\ s.activeIters = 0 /\ forall er: eref (count(er, s.val) = 1 => in(known, er))) */ # include "empset.lh" # define empset_create() (erc_create()) # define empset_final(s) (erc_final(s)) # define empset_member(e, s) \ (!(eref_equal(_empset_get(e, s), erefNIL))) # define empset_size(es) (erc_size(es)) # define empset_choose(es) (eref_get(erc_choose(es))) # define empset_sprint(es) (erc_sprint(es)) # endif splint-3.1.2.dfsg1/test/db1/erc.h0000644021234200000250000000135507142107145014017 0ustar fax# ifndef ERC_H # define ERC_H # include "eref.h" typedef struct _elem { eref val; struct _elem *next; } ercElem; typedef ercElem *ercList; typedef struct { ercList vals; int size; } ercInfo; typedef ercInfo *erc; typedef ercList *ercIter; # include "erc.lh" # define erc_size(c) ((c)->size) # define erc_choose(c) ((c->vals)->val) # define erc_initMod() \ do { bool_initMod(); employee_initMod();\ eref_initMod(); } while (FALSE) # define erc_iterFinal(it) (free(it)) # define erc_iterReturn(it, result) \ do { erc_iterFinal(it); return result; } while (FALSE) # define for_ercElems(er, it, c)\ for (er = erc_yield (it = erc_iterStart (c)); \ !eref_equal (er, erefNIL); \ er = erc_yield (it)) # endif splint-3.1.2.dfsg1/test/db1/eref.h0000644021234200000250000000110507121317337014163 0ustar fax# ifndef EREF_H # define EREF_H # include "employee.h" typedef int eref; /* Private typedefs used in macros */ typedef enum { used, avail } eref_status; typedef struct { employee *conts; eref_status *status; int size; } eref_ERP; /* Declared here so that macros can use it */ extern eref_ERP eref_Pool; # include "eref.lh" # define erefNIL -1 # define eref_free(er) (eref_Pool.status[er] = avail) # define eref_assign(er, e) (eref_Pool.conts[er] = e) # define eref_get(er) (eref_Pool.conts[er]) # define eref_equal(er1, er2) (er1 == er2) # endif splint-3.1.2.dfsg1/test/db1/ereftab.h0000644021234200000250000000022507121317337014654 0ustar fax/* ereftab.h */ # ifndef EREFTAB_H # define EREFTAB_H # include "erc.h" # include "eref.h" typedef erc ereftab; # include "ereftab.lh" # endif splint-3.1.2.dfsg1/test/db1/Makefile0000644021234200000250000000441507703346625014550 0ustar fax### ### Splint db1 test ### ### Taken from sample, second iteration: weakchecks ### .SUFFIXES: .lcl .lcs .lh .h .c .o .PHONY: check clean ### SHELL = /bin/csh -f SPLINT = splint -booltype bool -booltrue TRUE -boolfalse FALSE LCL = $(SPLINT) -specundef +lh +quiet -nof SPLINTLH = $(SPLINT) +lh LCSFILES = bool.lcs dbase.lcs employee.lcs empset.lcs erc.lcs eref.lcs ereftab.lcs MODULES = bool.lcl employee eref empset ereftab erc dbase drive.c OBJS = dbase.o employee.o empset.o erc.o eref.o ereftab.o test: $(MAKE) -e clean $(MAKE) -e check ### ### Removed +showscan, produces different results on different platforms ### ### evans 2002-12-17: 2 fewer weak errors because of -abstractcompare default in weak check: $(LCSFILES) -$(SPLINT) -showcol -weak $(MODULES) -expect 19 -$(SPLINT) -showcol +strict -bounds -modfilesystem +showsummary $(MODULES) -expect 338 # evans 2002-07-09: 5 bufferoverflowhigh warnings for using sprintf ### The following rules generate .lh and .lcs files from .lcl files. They also ### ensure that .h files appear to be updated whenever the corresponding .lh ### file is updated. .lcl.lh: $(LCL) $*.lcl .lcl.lcs: $(LCL) $*.lcl .lh.h: touch $*.h .c.o: $(GCC) -c $*.c ### ### Clean removes junk and all derived files. ### Tidy removes junk and object and executable files. ### clean: tidy -@rm -f *.c.html *.lcl.html *.h.html *.lh.html *.lcs *.lh 1> /dev/null tidy: -@rm -f ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~ *~ *.o drive 11> /dev/null ### The following dependencies ensure that imported LCL specs ### are checked before the specs that import them. dbase.lcs: employee.lcs empset.lcs empset.lcs: employee.lcs erc.lcs: eref.lcs eref.lcl: employee.lcs ereftab.lcs: employee.lcs eref.lcs ### The following dependencies ensure that a .o file is recompiled when the ### corresponding .c file, or one of the .h files it #includes, is changed. dbase.o: dbase.c bool.h dbase.h employee.h empset.h drive.o: drive.c bool.h dbase.h employee.h empset.h erc.h eref.h ereftab.h employee.o: employee.c employee.h empset.o: empset.c bool.h empset.h erc.h eref.h employee.h employee.h erc.o: erc.c bool.h erc.h eref.h employee.h eref.o: eref.c eref.h employee.h ereftab.o: ereftab.c bool.h ereftab.h erc.h eref.h employee.h splint-3.1.2.dfsg1/test/db2/0000755021234200000250000000000010645776270013107 5ustar faxsplint-3.1.2.dfsg1/test/db2/dbase.lcl0000644021234200000250000000372007121317336014650 0ustar faximports employee, empset, ; typedef struct{gender g; job j; int l; int h;} db_q; typedef enum {db_OK, salERR, genderERR, jobERR, duplERR, missERR} db_status; spec immutable type db; spec db d; claims UniqueKeys (employee e1, employee e2) db d; { /* ensures (e1 \in d\any /\ e2 \in d\any /\ e1.ssNum = e2.ssNum) => (e1 = e2); */ } db_status hire(employee e) db d; { modifies d; /* ensures (if result = db_OK then d' = hire(e, d^) else d' = d^) /\ result = (if e.gen = gender_ANY then genderERR else if e.j = job_ANY then jobERR else if e.salary < 0 then salERR else if employed(d^, e.ssNum) then duplERR else db_OK); */ } void uncheckedHire(employee e) db d; { /* requires e.gen \neq gender_ANY /\ e.j \neq job_ANY /\ e.salary >= 0 /\ ~employed(d^, e.ssNum); */ modifies d; /* ensures d' = hire(e, d^); */ } bool fire(int ssNum) db d; { modifies d; /* ensures result = employed(d^, ssNum) /\ d' = fire(d^, ssNum); */ } int query(db_q q, empset s) db d; { modifies s; /* ensures s' = s^ \U query(d^, q) /\ result = size(query(d^, q)); */ } bool promote(int ssNum) db d; { modifies d; /* ensures result = (employed(d^, ssNum) /\ find(d^, ssNum).j = NONMGR) /\ (if result then d' = promote(d^, ssNum) else d' = d^); */ } db_status setSalary(int ssNum, int sal) db d; { modifies d; /* ensures result = (if employed(d^, ssNum) then (if sal < 0 then salERR else db_OK) else missERR) /\ (if result = db_OK then d' = setSal(d^, ssNum, sal) else d' = d^); */ } void db_print(void) db d; FILE *stdout; { modifies *stdout^; /* ensures \exists s:ioStream ((*stdout^)' = write((*stdout^)^, s) /\ isSprint(d^, s)); */ } void db_initMod(void) db d; { modifies d; /* ensures d' = new; */ } splint-3.1.2.dfsg1/test/db2/employee.lcl0000644021234200000250000000217707121317336015416 0ustar faximports ; constant size_t maxEmployeeName; constant int employeePrintSize; typedef enum { MALE, FEMALE, gender_ANY } gender; typedef enum { MGR, NONMGR, job_ANY } job; typedef struct { int ssNum; char name[maxEmployeeName]; int salary; gender gen; job j; } employee; void employee_sprint (out char s[], employee e) { /* requires maxIndex(s) >= employeePrintSize; */ modifies s; /* ensures isSprint(s', e) /\ lenStr(s') = employeePrintSize; */ } bool employee_equal (employee *e1, employee *e2) { /* ensures result = sameStr(e1->name^, e2->name^) /\ (e1->ssNum^ = e2->ssNum^) /\ (e1->salary^ = e2->salary^) /\ (e1->gen^ = e2->gen^) /\ (e1->j^ = e2->j^); */ } bool employee_setName(employee *e, char na[]) { /* requires nullTerminated(na^); */ modifies e->name; /* ensures result = lenStr(na^) < maxEmployeeName /\ (if result then sameStr(e->name', na^) /\ nullTerminated(e->name') else e->name' = e->name^); */ } void employee_initMod(void) { modifies internalState; ensures true; } splint-3.1.2.dfsg1/test/db2/empset.lcl0000644021234200000250000000304707121317336015071 0ustar faximports employee; mutable type empset; empset empset_create(void) { /* ensures fresh(result) /\ result' = { }; */ } void empset_final(empset s) { modifies s; /* ensures trashed(s); */ } void empset_clear(empset s) { modifies s; /* ensures s' = { }; */ } | bool : void | empset_insert(empset s, employee e) { modifies s; /* ensures result = ~(e \in s^) /\ s' = insert(e, s^); */ } void empset_insertUnique(empset s, employee e) { /* requires ~(e \in s^); */ modifies s; /* ensures s' = insert(e, s^); */ } | bool : void | empset_delete(empset s, employee e) { modifies s; /* ensures result = e \in s^ /\ s' = delete(e, s^); */ } empset empset_union(empset s1, empset s2) { /* ensures result' = s1^ \U s2^ /\ fresh(result); */ } empset empset_disjointUnion(empset s1, empset s2) { /* requires s1^ \I s2^ = { }; */ /* ensures result' = s1^ \U s2^ /\ fresh(result); */ } void empset_intersect(empset s1, empset s2) { modifies s1; /* ensures s1' = s1^ \I s2^; */ } int empset_size(empset s) { /* ensures result = size(s^); */ } bool empset_member(employee e, empset s) { /* ensures result = e \in s^; */ } bool empset_subset(empset s1, empset s2) { /* ensures result = s1^ \subseteq s2^; */ } employee empset_choose(empset s) { /* requires s^ \neq { }; */ /* ensures result \in s^; */ } char *empset_sprint(empset s) { /* ensures isSprint(result[]', s^) /\ fresh(result[]); */ } void empset_initMod(void) { modifies internalState; ensures true; } iter empset_elements (empset s, yield employee x); splint-3.1.2.dfsg1/test/db2/erc.lcl0000644021234200000250000000226107121317336014342 0ustar faximports eref; mutable type erc; erc erc_create(void) { /* ensures fresh(result) /\ result' = { }; */ } void erc_clear(erc c) { /* requires c^.activeIters = 0; */ modifies c; /* ensures c' = { }; */ } void erc_insert(erc c, eref er) { /* requires c^.activeIters = 0 /\ er \neq erefNIL; */ modifies c; /* ensures c' = [insert(er, c^.val), 0]; */ } | bool : void | erc_delete(erc c, eref er) { /* requires c^.activeIters = 0; */ modifies c; /* ensures result = er \in c^.val /\ c' = [delete(er, c^.val), 0]; */ } bool erc_member(eref er, erc c) { /* ensures result = er \in c^.val; */ } eref erc_choose(erc c) { /* requires size(c^.val) \neq 0; */ /* ensures result \in c^.val; */ } int erc_size(erc c) { /* ensures result = size(c^.val); */ } void erc_join(erc c1, erc c2) { /* requires c1^.activeIters = 0; */ modifies c1; /* ensures c1' = [c1^.val \U c2^.val, 0]; */ } char *erc_sprint(erc c) { /* ensures isSprint(result[]', c^) /\ fresh(result[]); */ } void erc_final(erc c) { modifies c; /* ensures trashed(c); */ } void erc_initMod(void) { modifies internalState; ensures true; } iter erc_elements (erc c, yield eref el); splint-3.1.2.dfsg1/test/db2/eref.lcl0000644021234200000250000000132107121317336014506 0ustar faximports employee; immutable type eref; spec immutable type map; spec map m; constant eref erefNIL; eref eref_alloc(void) map m; { modifies m; /* ensures newInd(result, m^, m'); */ } void eref_free(eref er) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = delete(m^, er); */ } void eref_assign(eref er, employee e) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = assign(m^, er, e); */ } employee eref_get(eref er) map m; { /* requires er \in domain(m^); */ /* ensures result = m^[er]; */ } bool eref_equal(eref er1, eref er2) { /* ensures result = (er1 = er2); */ } void eref_initMod(void) map m; { modifies m; /* ensures m' = new; */ } splint-3.1.2.dfsg1/test/db2/ereftab.lcl0000644021234200000250000000113407121317336015177 0ustar faximports employee, eref; mutable type ereftab; ereftab ereftab_create(void) { /* ensures result' = empty; */ } void ereftab_insert(ereftab t, employee e, eref er) { /* requires getERef(t^, e) = erefNIL; */ modifies t; /* ensures t' = add(t^, e, er); */ } bool ereftab_delete(ereftab t, eref er) { modifies t; /* ensures result = in(t^, er) /\ t' = delete(t^, er); */ } eref ereftab_lookup(employee e, ereftab t) { /* ensures result = getERef(t^, e); */ } void ereftab_initMod(void) { modifies internalState; ensures true; } iter ereftab_elements(ereftab s, yield eref x); splint-3.1.2.dfsg1/test/db2/etest.lcl0000644021234200000250000000132107121317336014711 0ustar faximports employee; immutable type eref; spec immutable type map; spec map m; constant eref erefNIL; eref eref_alloc(void) map m; { modifies m; /* ensures newInd(result, m^, m'); */ } void eref_free(eref er) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = delete(m^, er); */ } void eref_assign(eref er, employee e) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = assign(m^, er, e); */ } employee eref_get(eref er) map m; { /* requires er \in domain(m^); */ /* ensures result = m^[er]; */ } bool eref_equal(eref er1, eref er2) { /* ensures result = (er1 = er2); */ } void eref_initMod(void) map m; { modifies m; /* ensures m' = new; */ } splint-3.1.2.dfsg1/test/db2/dbase.c0000644021234200000250000001027107121317336014317 0ustar fax# include # include "dbase.h" # define firstERC mMGRS # define lastERC fNON # define numERCS (lastERC - firstERC + 1) typedef enum { mMGRS, fMGRS, mNON, fNON } employeeKinds; erc db[numERCS]; bool initDone = FALSE; void db_initMod (void) { int i; if (initDone) { return; } bool_initMod (); employee_initMod (); eref_initMod (); erc_initMod (); empset_initMod (); for (i = firstERC; i <= lastERC; i++) { db[i] = erc_create (); } initDone = TRUE; } eref _db_ercKeyGet (erc c, int key) { erc_elements(c, er) { if (eref_get(er).ssNum == key) return (er); } end_erc_elements ; return erefNIL; } eref _db_keyGet (int key) { int i; eref er; for (i = firstERC; i <= lastERC; i++) { er = _db_ercKeyGet (db[i], key); if (!eref_equal (er, erefNIL)) { return er; } } return erefNIL; } int _db_addEmpls (erc c, int l, int h, empset s) { employee e; int numAdded; numAdded = 0; erc_elements (c, er) { e = eref_get(er); if ((e.salary >= l) && (e.salary <= h)) { empset_insert(s, e); numAdded++; } } end_erc_elements ; return numAdded; } db_status hire (employee e) { if (e.gen == gender_ANY) return genderERR; if (e.j == job_ANY) return jobERR; if (e.salary < 0) return salERR; if (!eref_equal (_db_keyGet (e.ssNum), erefNIL)) return duplERR; uncheckedHire (e); return db_OK; } void uncheckedHire (employee e) { eref er; er = eref_alloc (); eref_assign (er, e); if (e.gen == MALE) if (e.j == MGR) erc_insert (db[mMGRS], er); else erc_insert (db[mNON], er); else if (e.j == MGR) erc_insert (db[fMGRS], er); else erc_insert (db[fNON], er); } bool fire (int ssNum) { int i; for (i = firstERC; i <= lastERC; i++) { erc_elements(db[i], er) { if (eref_get(er).ssNum == ssNum) { erc_delete(db[i], er); return TRUE; } } end_erc_elements ; } return FALSE; } bool promote (int ssNum) { eref er; employee e; gender g; g = MALE; er = _db_ercKeyGet (db[mNON], ssNum); if (eref_equal (er, erefNIL)) { er = _db_ercKeyGet (db[fNON], ssNum); if (eref_equal (er, erefNIL)) return FALSE; g = FEMALE; } e = eref_get (er); e.j = MGR; eref_assign (er, e); if (g == MALE) { erc_delete (db[mNON], er); erc_insert (db[mMGRS], er); } else { erc_delete (db[fNON], er); erc_insert (db[fMGRS], er); } return TRUE; } db_status setSalary (int ssNum, int sal) { eref er; employee e; if (sal < 0) { return salERR; } er = _db_keyGet (ssNum); if (eref_equal (er, erefNIL)) { return missERR; } e = eref_get (er); e.salary = sal; eref_assign (er, e); return db_OK; } int query (db_q q, empset s) { int numAdded; int l, h; int i; l = q.l; h = q.h; switch (q.g) { case gender_ANY: switch (q.j) { case job_ANY: numAdded = 0; for (i = firstERC; i <= lastERC; i++) numAdded += _db_addEmpls (db[i], l, h, s); return numAdded; case MGR: numAdded = _db_addEmpls (db[mMGRS], l, h, s); numAdded += _db_addEmpls (db[fMGRS], l, h, s); return numAdded; case NONMGR: numAdded = _db_addEmpls (db[mNON], l, h, s); numAdded += _db_addEmpls (db[fNON], l, h, s); return numAdded; } case MALE: switch (q.j) { case job_ANY: numAdded = _db_addEmpls (db[mMGRS], l, h, s); numAdded += _db_addEmpls (db[mNON], l, h, s); return numAdded; case MGR: return _db_addEmpls (db[mMGRS], l, h, s); case NONMGR: return _db_addEmpls (db[mNON], l, h, s); } case FEMALE: switch (q.j) { case job_ANY: numAdded = _db_addEmpls (db[fMGRS], l, h, s); numAdded += _db_addEmpls (db[fNON], l, h, s); return numAdded; case MGR: return _db_addEmpls (db[fMGRS], l, h, s); case NONMGR: return _db_addEmpls (db[fNON], l, h, s); } } } void db_print (void) { int i; char *printVal; printf ("Employees:\n"); for (i = firstERC; i <= lastERC; i++) { printVal = erc_sprint (db[i]); printf ("%s", printVal); free (printVal); } } splint-3.1.2.dfsg1/test/db2/drive.c0000644021234200000250000000676107121317336014363 0ustar fax/* Part of a driver used to test dbase */ /* Include those modules that export things that are used explicitly here */ # include # include # include "bool.h" # include "employee.h" # include "empset.h" # include "dbase.h" int main (int argc, /*@unused@*/ char *argv[]) { employee e; empset em1, em2, em3; char na[10000]; char * sprintResult; int i, j; db_q q; /* Initialize all of the LCL-specified modules that were included */ bool_initMod(); employee_initMod(); empset_initMod(); db_initMod(); if (argc != 1) { printf ("FormatPos: Wrong number of arguments. Given %d needs 0.\n", argc - 1); return 1; } /* Unit test empset */ em1 = empset_create(); if (!(empset_size(em1) == 0)) { printf("Size should be 0.\n"); } for (i = 0; i < 500; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); check (employee_setName(&e, na)); empset_insert(em1, e); } if (!(empset_size(em1) == 500)) { printf("Size should be 500.\n"); } for (i = 0; i < 250; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); check (employee_setName(&e, na)); empset_delete(em1, e); } if (!(empset_size(em1) == 250)) { printf("Size should be 250.\n"); } em2 = empset_create(); for (i = 0; i < 100; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); check (employee_setName(&e, na)); empset_insert(em2, e); } em3 = empset_union(em1, em2); if (!(empset_size(em3) == 350)) { printf("Size should be 350.\n"); } empset_intersect(em3, em3); if (!(empset_size(em3) == 350)) { printf("Size should be 350.\n"); } printf("Print two different employees:\n"); for (i = 0; i < 2; i++) { e = empset_choose(em3); employee_sprint(na, e); printf("%s\n", &(na[0])); empset_delete(em3, e); } /* Test dbase */ for (i = 0; i < 20; i++) { e.ssNum = i; e.salary = 10 * i; if (i < 10) e.gen = MALE; else e.gen = FEMALE; if (i < 15) e.j = NONMGR; else e.j = MGR; (void) sprintf(na, "J. Doe %d", i); check (employee_setName(&e, na)); if ((i/2)*2 == i) { check (hire(e) == db_OK); } else { uncheckedHire(e); j = hire(e); } } printf("Should print 4: %d\n", /*@-usedef@*/ j /*@=usedef@*/); printf("Employees 0 - 19\n"); db_print(); check (fire(17)); q.g = FEMALE; q.j = job_ANY; q.l = 158; q.h = 185; printf("Employees 0 - 16, 18 - 19\n"); db_print(); i = query(q, em1 = empset_create()); sprintResult = empset_sprint(em1); printf("Should get two females: %d\n%s\n", i, sprintResult); free(sprintResult); q.g = MALE; q.j = NONMGR; q.l = 0; q.h = 185; i = query(q, em2 = empset_create()); em3 = empset_disjointUnion(em2, em1); sprintResult = empset_sprint(em3); i = empset_size(em3); printf("Should get two females and ten males: %d\n%s\n", i, sprintResult); free(sprintResult); empset_intersect(em1, em3); sprintResult = empset_sprint(em1); i = empset_size(em1); printf("Should get two females: %d\n%s\n", i, sprintResult); free(sprintResult); check (fire(empset_choose(em3).ssNum)); printf("Should get 18 employees\n"); db_print(); return 0; } splint-3.1.2.dfsg1/test/db2/employee.c0000644021234200000250000000143007323413234015053 0ustar fax# include # include # include "employee.h" bool employee_setName (employee *e, char na []) { size_t i; for (i = 0; na[i] != '\0'; i++) { if (i == maxEmployeeName) { e->name[0] = '\0'; return FALSE; } } strcpy (e->name, na); return TRUE; } bool employee_equal (employee * e1, employee * e2) { return ((e1->ssNum == e2->ssNum) && (e1->salary == e2->salary) && (e1->gen == e2->gen) && (e1->j == e2->j) && (strncmp (e1->name, e2->name, maxEmployeeName) == 0)); } void employee_sprint (char s[], employee e) { static char *gender[] ={ "male", "female", "?" }; static char *jobs[] = { "manager", "non-manager", "?" }; (void) sprintf (s, employeeFormat, e.ssNum, e.name, gender[e.gen], jobs[e.j], e.salary); } splint-3.1.2.dfsg1/test/db2/empset.c0000644021234200000250000000454107121317336014541 0ustar fax# include "empset.h" static bool initDone = FALSE; eref _empset_get (employee e, erc s) { erc_elements(s, er) { employee e1 = eref_get(er); if (employee_equal(&e1, &e)) return er; } end_erc_elements ; return erefNIL; } void empset_clear (empset s) { erc_clear (s); } bool /*@alt void@*/ empset_insert (empset s, employee e) { if (!eref_equal (_empset_get (e, s), erefNIL)) { return FALSE; } empset_insertUnique (s, e); return TRUE; } void empset_insertUnique (empset s, employee e) { eref er; er = ereftab_lookup (e, known); if (eref_equal (er, erefNIL)) { er = eref_alloc ( ); eref_assign (er,e); ereftab_insert (known, e, er); } erc_insert (s, er); } bool /*@alt void@*/ empset_delete (empset s, employee e) { eref er; er = _empset_get (e, s); if (eref_equal (er, erefNIL)) { return FALSE; } return erc_delete (s, er); } empset empset_disjointUnion (empset s1, empset s2) { erc result; empset tmp; result = erc_create ( ); if (erc_size (s1) > erc_size (s2)) { tmp = s1; s1 = s2; s2 = tmp; } erc_join (result, s1); empset_elements(s2, emp) { empset_insertUnique(result, emp); } end_empset_elements ; return result; } empset empset_union (empset s1, empset s2) { erc result; empset tmp; result = erc_create (); if (erc_size (s1) > erc_size (s2)) { tmp = s1; s1 = s2; s2 = tmp; } erc_join (result, s2); empset_elements (s1, emp) { if (!empset_member(emp, s2)) empset_insert(result, emp); } end_empset_elements ; return result; } void empset_intersect (empset s1, empset s2) { erc toDelete = erc_create(); empset_elements (s2, emp) { if (!empset_member(emp, s2)) empset_insert(toDelete, emp); } end_empset_elements ; empset_elements (toDelete, emp) { empset_delete(s1, emp); } end_empset_elements; erc_final (toDelete); } bool empset_subset (empset s1, empset s2) { empset_elements(s1, emp) { if (!empset_member(emp, s2)) return FALSE; } end_empset_elements ; return TRUE; } void empset_initMod (void) { if (initDone) return; bool_initMod (); employee_initMod (); eref_initMod (); erc_initMod (); ereftab_initMod (); known = ereftab_create (); initDone = TRUE; } splint-3.1.2.dfsg1/test/db2/erc.c0000644021234200000250000000442707320411716014016 0ustar fax# include # include "erc.h" static size_t int_toSize (int x) { size_t res = (size_t) x; if ((int) res != x) { fprintf (stderr, "Error: int_toSize failure: %d", x); return 0; } else { return res; } } erc erc_create (void) { erc c; c = (erc) malloc (sizeof (ercInfo)); if (c == 0) { printf ("Malloc returned null in erc_create\n"); exit (EXIT_FAILURE); } c->vals = 0; c->size = 0; return c; } void erc_clear (erc c) /*@ensures isnull c->vals, c->next@*/ { ercList elem; ercList next; for (elem = c->vals; elem != 0; elem = next) { next = elem->next; elem->next = NULL; free (elem); } c->vals = 0; c->size = 0; } void erc_final (erc c) { erc_clear (c); free (c); } bool erc_member (eref er, erc c) { ercList tmpc; for (tmpc = c->vals; tmpc != 0; tmpc = tmpc->next) if (eref_equal (tmpc->val, er)) return TRUE; return FALSE; } void erc_insert (erc c, eref er) { ercList newElem; newElem = (ercElem *) malloc (sizeof (ercElem)); if (newElem == 0) { printf ("Malloc returned null in erc_insert\n"); exit (EXIT_FAILURE); } newElem->val = er; newElem->next = c->vals; c->vals = newElem; c->size++; } bool erc_delete (erc c, eref er) { ercList elem; ercList prev; for (prev = 0, elem = c->vals; elem != 0; prev = elem, elem = elem->next) { if (eref_equal (elem->val, er)) { if (prev == 0) { c->vals = elem->next; elem->next = NULL; } else { prev->next = elem->next; elem->next = NULL; } free (elem); c->size--; return TRUE; } } return FALSE; } void erc_join (erc c1, erc c2) { ercList tmpc; for (tmpc = c2->vals; tmpc != 0; tmpc = tmpc->next) erc_insert (c1, tmpc->val); } char *erc_sprint (erc c) { int len; char *result; result = (char *) malloc (int_toSize (erc_size (c) * (employeePrintSize + 1) + 1)); if (result == 0) { printf ("Malloc returned null in erc_sprint\n"); exit (EXIT_FAILURE); } len = 0; erc_elements(c, er) { employee_sprint(&(result[len]), eref_get(er)); len += employeePrintSize; result[len++] = '\n'; } end_erc_elements; result[len] = '\0'; return result; } splint-3.1.2.dfsg1/test/db2/eref.c0000644021234200000250000000321307121317336014160 0ustar fax# include # include # include "eref.h" eref_ERP eref_Pool; /* private */ static bool needsInit = TRUE; /* private */ eref eref_alloc (void) { int i, res; for (i=0; (eref_Pool.status[i] == used) && (i < eref_Pool.size); i++); res = i; if (res == eref_Pool.size) { eref_Pool.conts = (employee *) realloc (eref_Pool.conts, 2 * eref_Pool.size * sizeof (employee)); if (eref_Pool.conts == 0) { printf ("Malloc returned null in eref_alloc\n"); exit (EXIT_FAILURE); } eref_Pool.status = (eref_status *) realloc (eref_Pool.status, 2 * eref_Pool.size * sizeof (eref_status)); if (eref_Pool.status == 0) { printf ("Malloc returned null in eref_alloc\n"); exit (EXIT_FAILURE); } eref_Pool.size = 2*eref_Pool.size; for (i = res+1; i < eref_Pool.size; i++) eref_Pool.status[i] = avail; } eref_Pool.status[res] = used; return (eref) res; } void eref_initMod (void) { int i; const int size = 16; if (!needsInit) { return; } needsInit = FALSE; bool_initMod (); employee_initMod (); eref_Pool.conts = (employee *) malloc (size * sizeof (employee)); if (eref_Pool.conts == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (EXIT_FAILURE); } eref_Pool.status = (eref_status *) malloc (size * sizeof (eref_status)); if (eref_Pool.status == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (EXIT_FAILURE); } eref_Pool.size = size; for (i = 0; i < size; i++) { eref_Pool.status[i] = avail; } } splint-3.1.2.dfsg1/test/db2/ereftab.c0000644021234200000250000000133607121317336014653 0ustar fax/* ** This is not a good implementation. I should probably replace ** the erc with a hash table. */ # include "ereftab.h" ereftab ereftab_create (void) { return erc_create (); } void ereftab_insert (ereftab t, employee e, eref er) { eref_assign (er, e); erc_insert (t, er); } bool ereftab_delete (ereftab t, eref er) { bool result; result = erc_member (er, t); erc_delete (t, er); return result; } eref ereftab_lookup (employee e, ereftab t) { employee e1; ereftab_elements(t, er) { e1 = eref_get(er); if (employee_equal(&e, &e1)) return er; } end_ereftab_elements ; return erefNIL; } void ereftab_initMod (void) { bool_initMod (); eref_initMod (); erc_initMod (); } splint-3.1.2.dfsg1/test/db2/etest.c0000644021234200000250000000151607121317336014367 0ustar fax# include # include # include "eref.h" eref_ERP eref_Pool; /* private */ static bool needsInit = TRUE; /* private */ void eref_initMod (void) { int i; const int size = 16; if (!needsInit) { return; } needsInit = FALSE; bool_initMod (); employee_initMod (); eref_Pool.conts = (employee *) malloc (size * sizeof (employee)); if (eref_Pool.conts == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (EXIT_FAILURE); } eref_Pool.status = (eref_status *) malloc (size * sizeof (eref_status)); if (eref_Pool.status == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (EXIT_FAILURE); } eref_Pool.size = size; if (size > 3) { eref_Pool.status[0] = avail; } else { ; } } splint-3.1.2.dfsg1/test/db2/bool.h0000644021234200000250000000153107121317336014200 0ustar fax#ifndef BOOL_H #define BOOL_H #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE (!FALSE) #endif typedef int bool; /* ** bool_initMod has no real effect ** Declared with modifies internalState, so no noeffect errors are ** reported when it is called.) */ extern /*@unused@*/ void bool_initMod (void) /*@modifies internalState@*/ ; /*@-mustmod@*/ # define bool_initMod() /*@=mustmod@*/ extern /*@unused@*/ /*@observer@*/ char *bool_unparse (bool b) /*@*/ ; # define bool_unparse(b) ((b) ? "true" : "false" ) extern /*@unused@*/ bool bool_not (bool b) /*@*/ ; # define bool_not(b) ((b) ? FALSE : TRUE) extern /*@unused@*/ bool bool_equal (bool b1, bool b2) /*@*/ ; # define bool_equal(a,b) ((a) ? (b) : !(b)) extern /*@falseexit@*/ void check (bool x); # define check(x) \ do { bool m_res = x; assert (m_res); } while (FALSE) # endif splint-3.1.2.dfsg1/test/db2/dbase.h0000644021234200000250000000014707121317336014325 0ustar fax# ifndef DBASE_H # define DBASE_H # include "eref.h" # include "erc.h" # include "dbase.lh" # endif splint-3.1.2.dfsg1/test/db2/employee.h0000644021234200000250000000100407414547435015071 0ustar fax# ifndef EMPLOYEE_H # define EMPLOYEE_H # define maxEmployeeName (20) # define employeeFormat "%9d %-20s %-6s %-11s %6d.00" # define employeePrintSize (63) # include "employee.lh" /* Override the definition in employee.lh (can't put this in .lcl) */ /*@-incondefs@*/ /*@-redecl@*/ /*@-protoparammatch@*/ extern bool employee_setName (/*@special@*/ employee *p_e, char /* na */[]) /*@sets p_e->name@*/; /*@=incondefs@*/ /*@=redecl@*/ /*@=protoparammatch@*/ # define employee_initMod() bool_initMod() # endif splint-3.1.2.dfsg1/test/db2/empset.h0000644021234200000250000000165507121317336014551 0ustar fax# ifndef EMPSET_H # define EMPSET_H # include "eref.h" # include "erc.h" # include "ereftab.h" typedef erc empset; ereftab known; /* Abstraction function, toEmpSet: e \in toEmpSet(s) == exists er (count(er, s.val) = 1 /\ getERef(known, e) = er) Rep invariant: forall s: empset (forall er: eref (count(er, s.val) <= 1) /\ s.activeIters = 0 /\ forall er: eref (count(er, s.val) = 1 => in(known, er))) */ # include "empset.lh" # define empset_create() (erc_create()) # define empset_final(s) (erc_final(s)) # define empset_member(e, s) \ (!(eref_equal(_empset_get(e, s), erefNIL))) # define empset_size(es) (erc_size(es)) # define empset_choose(es) (eref_get(erc_choose(es))) # define empset_sprint(es) (erc_sprint(es)) #define empset_elements(e, m_x) \ erc_elements(e, m_y) { employee m_x = eref_get(m_y); #define end_empset_elements } end_erc_elements # endif splint-3.1.2.dfsg1/test/db2/erc.h0000644021234200000250000000120307121317336014012 0ustar fax# ifndef ERC_H # define ERC_H # include "eref.h" typedef struct _elem { eref val; struct _elem *next; } ercElem; typedef ercElem *ercList; typedef struct { ercList vals; int size; } ercInfo; typedef ercInfo *erc; # include "erc.lh" # define erc_size(c) ((c)->size) # define erc_choose(c) (((c)->vals)->val) # define erc_initMod() \ do { bool_initMod(); employee_initMod();\ eref_initMod(); } while (0) # define erc_elements(c, m_x) \ { erc m_c = (c); ercElem *m_ec = (m_c)->vals; int m_i = 0; \ while (m_i < (m_c)->size) { \ eref m_x = m_ec->val; m_ec = m_ec->next; m_i++; # define end_erc_elements }} # endif splint-3.1.2.dfsg1/test/db2/eref.h0000644021234200000250000000111107121317336014160 0ustar fax# ifndef EREF_H # define EREF_H # include "employee.h" typedef int eref; /* Private typedefs used in macros */ typedef enum { used, avail } eref_status; typedef struct { employee *conts; eref_status *status; int size; } eref_ERP; /* Declared here so that macros can use it */ extern eref_ERP eref_Pool; # include "eref.lh" # define erefNIL -1 # define eref_free(er) (eref_Pool.status[er] = avail) # define eref_assign(er, e) (eref_Pool.conts[er] = (e)) # define eref_get(er) (eref_Pool.conts[er]) # define eref_equal(er1, er2) ((er1) == (er2)) # endif splint-3.1.2.dfsg1/test/db2/ereftab.h0000644021234200000250000000040007121317336014647 0ustar fax/* ereftab.h */ # ifndef EREFTAB_H # define EREFTAB_H # include "erc.h" # include "eref.h" typedef erc ereftab; # include "ereftab.lh" # define ereftab_elements(s, m_x) erc_elements(s, m_x) # define end_ereftab_elements end_erc_elements # endif splint-3.1.2.dfsg1/test/db2/Makefile0000644021234200000250000000440007650577033014543 0ustar fax### ### Splint db2 test ### ### Taken from sample, fifth iteration: memchecks1 ### .SUFFIXES: .lcl .lcs .lh .h .c .o .PHONY: check clean ### SHELL = /bin/csh -f SPLINT = splint -booltype "bool" -booltrue TRUE -boolfalse FALSE LCL = $(SPLINT) -specundef +lh +quiet -nof SPLINTLH = $(SPLINT) +lh LCSFILES = dbase.lcs employee.lcs empset.lcs erc.lcs eref.lcs ereftab.lcs MODULES = employee eref empset ereftab erc dbase drive.c OBJS = dbase.o employee.o empset.o erc.o eref.o ereftab.o test: $(MAKE) -e clean $(MAKE) -e check check: $(LCSFILES) -$(SPLINT) -exportlocal -showcol -allimponly -macrovarprefixexclude $(MODULES) -bufferoverflowhigh -expect 15 -$(SPLINT) -exportlocal -showcol +allimponly $(MODULES) -bufferoverflowhigh -expect 25 -$(SPLINT) -exportlocal -showcol -memchecks -macrovarprefixexclude -bufferoverflowhigh $(MODULES) # evans 2002-07-09: added bufferoverflowhigh flags to suppress sprintf warnings ### The following rules generate .lh and .lcs files from .lcl files. They also ### ensure that .h files appear to be updated whenever the corresponding .lh ### file is updated. .lcl.lh: $(LCL) $*.lcl .lcl.lcs: $(LCL) $*.lcl .lh.h: touch $*.h .c.o: $(GCC) -c $*.c ### ### Clean removes junk and all derived files. ### Tidy removes junk and object and executable files. ### clean: tidy -@rm -f *.c.html *.lcl.html *.h.html *.lh.html *.lcs *.lh 1> /dev/null tidy: -@rm -f ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~ *~ *.o drive 1> /dev/null ### The following dependencies ensure that imported LCL specs ### are checked before the specs that import them. dbase.lcs: employee.lcs empset.lcs empset.lcs: employee.lcs erc.lcs: eref.lcs eref.lcl: employee.lcs ereftab.lcs: employee.lcs eref.lcs ### The following dependencies ensure that a .o file is recompiled when the ### corresponding .c file, or one of the .h files it #includes, is changed. dbase.o: dbase.c bool.h dbase.h employee.h empset.h drive.o: drive.c bool.h dbase.h employee.h empset.h erc.h eref.h ereftab.h employee.o: employee.c employee.h empset.o: empset.c bool.h empset.h erc.h eref.h employee.h employee.h erc.o: erc.c bool.h erc.h eref.h employee.h eref.o: eref.c eref.h employee.h ereftab.o: ereftab.c bool.h ereftab.h erc.h eref.h employee.h splint-3.1.2.dfsg1/test/db3/0000755021234200000250000000000010645776270013110 5ustar faxsplint-3.1.2.dfsg1/test/db3/.splintrc0000644021234200000250000000025007413453501014730 0ustar fax-allimponly +allmacros +czech +distinctexternalnames -externalnamelength 14 +distinctinternalnames +internalnamelookalike -uncheckedmacroprefix ^~* -enumprefix ^^~* splint-3.1.2.dfsg1/test/db3/bool.lcl0000644021234200000250000000045407650661456014543 0ustar fax/*immutable type bool; constant bool TRUE; constant bool FALSE; */ void bool_initMod (void) internalState; { modifies internalState; } observer char *bool_unparse (bool b) { modifies nothing; } bool bool_not (bool b) { modifies nothing; } bool bool_equal (bool b1, bool b2) { modifies nothing; } splint-3.1.2.dfsg1/test/db3/check.lcl0000644021234200000250000000010307121317337014641 0ustar faximports bool; falseexit void check (bool x) { modifies nothing; } splint-3.1.2.dfsg1/test/db3/dbase.lcl0000644021234200000250000000413007121317336014645 0ustar faximports employee, empset, ; typedef struct{gender g; job j; int l; int h;} db_q; typedef enum { DBS_OK, DBS_SALERR, DBS_GENDERERR, DBS_JOBERR, DBS_DUPLERR, DBS_MISSERR } db_status; spec immutable type db; spec db d; claims UniqueKeys (employee e1, employee e2) db d; { /* ensures (e1 \in d\any /\ e2 \in d\any /\ e1.ssNum = e2.ssNum) => (e1 = e2); */ } db_status db_hire (employee e) db d; { modifies d; /* ensures (if result = db_OK then d' = hire(e, d^) else d' = d^) /\ result = (if e.gen = gender_ANY then genderERR else if e.j = job_ANY then jobERR else if e.salary < 0 then salERR else if employed(d^, e.ssNum) then duplERR else db_OK); */ } void db_uncheckedHire (employee e) db d; { /* requires e.gen \neq gender_ANY /\ e.j \neq job_ANY /\ e.salary >= 0 /\ ~employed(d^, e.ssNum); */ modifies d; /* ensures d' = hire(e, d^); */ } bool db_fire (int ssNum) db d; internalState; { modifies d, internalState; /* ensures result = employed(d^, ssNum) /\ d' = fire(d^, ssNum); */ } int db_query (db_q q, empset s) db d; internalState; { modifies s, internalState; /* ensures s' = s^ \U query(d^, q) /\ result = size(query(d^, q)); */ } bool db_promote (int ssNum) db d; { modifies d; /* ensures result = (employed(d^, ssNum) /\ find(d^, ssNum).j = NONMGR) /\ (if result then d' = promote(d^, ssNum) else d' = d^); */ } db_status db_setSalary (int ssNum, int sal) db d; { modifies d; /* ensures result = (if employed(d^, ssNum) then (if sal < 0 then salERR else db_OK) else missERR) /\ (if result = db_OK then d' = setSal(d^, ssNum, sal) else d' = d^); */ } void db_print(void) db d; FILE *stdout; { modifies *stdout^; /* ensures \exists s:ioStream ((*stdout^)' = write((*stdout^)^, s) /\ isSprint(d^, s)); */ } void db_initMod(void) db d; internalState; { modifies d, internalState; /* ensures d' = new; */ } splint-3.1.2.dfsg1/test/db3/employee.lcl0000644021234200000250000000223507121317336015412 0ustar faximports ; constant size_t maxEmployeeName; constant int employeePrintSize; typedef enum { MALE, FEMALE, GENDER_UNKNOWN } gender; typedef enum { MGR, NONMGR, JOB_UNKNOWN } job; typedef struct { int ssNum; char name[maxEmployeeName]; int salary; gender gen; job j; } employee; void employee_sprint (out char s[], employee e) { /* requires maxIndex(s) >= employeePrintSize; */ modifies s; /* ensures isSprint(s', e) /\ lenStr(s') = employeePrintSize; */ } bool employee_equal (employee *e1, employee *e2) { /* ensures result = sameStr(e1->name^, e2->name^) /\ (e1->ssNum^ = e2->ssNum^) /\ (e1->salary^ = e2->salary^) /\ (e1->gen^ = e2->gen^) /\ (e1->j^ = e2->j^); */ } bool employee_setName (employee *e, unique char na[]) { /* requires nullTerminated(na^); */ modifies e->name; /* ensures result = lenStr(na^) < maxEmployeeName /\ (if result then sameStr(e->name', na^) /\ nullTerminated(e->name') else e->name' = e->name^); */ } void employee_initMod(void) internalState; { modifies internalState; ensures true; } splint-3.1.2.dfsg1/test/db3/empset.lcl0000644021234200000250000000337307121317336015074 0ustar faximports employee; mutable type empset; only empset empset_create(void) { /* ensures fresh(result) /\ result' = { }; */ } void empset_final (only empset s) { modifies s; /* ensures trashed(s); */ } void empset_clear(empset s) { modifies s; /* ensures s' = { }; */ } | bool : void | empset_insert (empset s, employee e) internalState; { modifies s, internalState; /* ensures result = ~(e \in s^) /\ s' = insert(e, s^); */ } void empset_insertUnique (empset s, employee e) internalState; { /* requires ~(e \in s^); */ modifies s, internalState; /* ensures s' = insert(e, s^); */ } | bool : void | empset_delete(empset s, employee e) { modifies s; /* ensures result = e \in s^ /\ s' = delete(e, s^); */ } only empset empset_union(empset s1, empset s2) internalState; { modifies internalState; /* ensures result' = s1^ \U s2^ /\ fresh(result); */ } only empset empset_disjointUnion (empset s1, empset s2) internalState; { modifies internalState; /* requires s1^ \I s2^ = { }; */ /* ensures result' = s1^ \U s2^ /\ fresh(result); */ } void empset_intersect (empset s1, empset s2) internalState; { modifies s1, internalState; /* ensures s1' = s1^ \I s2^; */ } int empset_size(empset s) { /* ensures result = size(s^); */ } bool empset_member(employee e, empset s) { /* ensures result = e \in s^; */ } bool empset_subset(empset s1, empset s2) { /* ensures result = s1^ \subseteq s2^; */ } employee empset_choose(empset s) { /* requires s^ \neq { }; */ /* ensures result \in s^; */ } only char *empset_sprint(empset s) { /* ensures isSprint(result[]', s^) /\ fresh(result[]); */ } void empset_initMod (void) internalState; { modifies internalState; ensures true; } iter empset_elements (empset s, yield employee x); splint-3.1.2.dfsg1/test/db3/erc.lcl0000644021234200000250000000232007121317336014337 0ustar faximports eref; mutable type erc; only erc erc_create(void) { /* ensures fresh(result) /\ result' = { }; */ } void erc_clear(erc c) { /* requires c^.activeIters = 0; */ modifies c; /* ensures c' = { }; */ } void erc_insert(erc c, eref er) { /* requires c^.activeIters = 0 /\ er \neq erefNIL; */ modifies c; /* ensures c' = [insert(er, c^.val), 0]; */ } | bool : void | erc_delete(erc c, eref er) { /* requires c^.activeIters = 0; */ modifies c; /* ensures result = er \in c^.val /\ c' = [delete(er, c^.val), 0]; */ } bool erc_member(eref er, erc c) { /* ensures result = er \in c^.val; */ } eref erc_choose(erc c) { /* requires size(c^.val) \neq 0; */ /* ensures result \in c^.val; */ } int erc_size(erc c) { /* ensures result = size(c^.val); */ } void erc_join(erc c1, erc c2) { /* requires c1^.activeIters = 0; */ modifies c1; /* ensures c1' = [c1^.val \U c2^.val, 0]; */ } only char *erc_sprint(erc c) { /* ensures isSprint(result[]', c^) /\ fresh(result[]); */ } void erc_final (only erc c) { modifies c; /* ensures trashed(c); */ } void erc_initMod (void) internalState; { modifies internalState; ensures true; } iter erc_elements (erc c, yield eref el); splint-3.1.2.dfsg1/test/db3/eref.lcl0000644021234200000250000000144007121317337014512 0ustar faximports employee; immutable type eref; constant eref eref_undefined; spec immutable type map; spec map m; eref eref_alloc(void) map m; { modifies m; /* ensures newInd(result, m^, m'); */ } bool eref_isDefined (eref er) map m; { } void eref_free(eref er) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = delete(m^, er); */ } void eref_assign(eref er, employee e) map m; { /* requires er \in domain(m^); */ modifies m; /* ensures m' = assign(m^, er, e); */ } employee eref_get(eref er) map m; { /* requires er \in domain(m^); */ /* ensures result = m^[er]; */ } bool eref_equal(eref er1, eref er2) { /* ensures result = (er1 = er2); */ } void eref_initMod(void) map m; internalState; { modifies m, internalState; /* ensures m' = new; */ } splint-3.1.2.dfsg1/test/db3/ereftab.lcl0000644021234200000250000000116007121317337015200 0ustar faximports employee, eref; mutable type ereftab; only ereftab ereftab_create(void) { /* ensures result' = empty; */ } void ereftab_insert(ereftab t, employee e, eref er) { /* requires getERef(t^, e) = erefNIL; */ modifies t; /* ensures t' = add(t^, e, er); */ } bool ereftab_delete(ereftab t, eref er) { modifies t; /* ensures result = in(t^, er) /\ t' = delete(t^, er); */ } eref ereftab_lookup(employee e, ereftab t) { /* ensures result = getERef(t^, e); */ } void ereftab_initMod (void) internalState; { modifies internalState; ensures true; } iter ereftab_elements(ereftab s, yield eref x); splint-3.1.2.dfsg1/test/db3/README0000644021234200000250000000174407121317336013763 0ustar fax This directory contains the specifications and source code for the database example in Chapter 5 of ``Larch: Languages and Tools for Formal Specifications.'' Most of the files in this directory were used to typeset the figures in Chapter 5. As a result, they do not adhere to our usual standards for specifications and code: they lack comments (because they are described in Chapter 5) and their layout is constrained by the horizontal and vertical space limitations of the book. This directory also contains a Makefile, which can serve as a model for constructing Makefiles that can be used to check the specifications and compile the code for other programs. This directory also contains two files, stdio.lcl and file.lsl, which are not shown in Chapter 5. These files are the bare beginnings of an approach to specifying the semantics of the FILE data type in C; they serve little more than to enable the LCL Checker to check the specifications for db_print in dbase.lcl. splint-3.1.2.dfsg1/test/db3/clean0000644021234200000250000000000007320411723014064 0ustar faxsplint-3.1.2.dfsg1/test/db3/tidy0000644021234200000250000000000007320411723013753 0ustar faxsplint-3.1.2.dfsg1/test/db3/dbase.c0000644021234200000250000001302407323413234014315 0ustar fax# include # include "dbase.h" typedef enum { KND_MMGRS, KND_FMGRS, KND_MNON, KND_FNON } employeeKinds; /*@constant static employeeKinds firstERC;@*/ # define firstERC KND_MMGRS /*@constant static employeeKinds lastERC;@*/ # define lastERC KND_FNON /*@constant static int numERCS;@*/ # define numERCS (/*@+enumint@*/ (lastERC - firstERC + 1) /*@=enumint@*/) typedef /*@only@*/ erc o_erc; static o_erc db[numERCS]; /*@iter employeeKinds_all (yield employeeKinds ek); @*/ # define employeeKinds_all(m_ek) \ { employeeKinds m_ek; for (m_ek = firstERC; m_ek <= lastERC; m_ek++) { # define end_employeeKinds_all }} static bool initDone = FALSE; void db_initMod (void) /*@globals initDone, undef db, internalState@*/ /*@modifies initDone, db, internalState@*/ { if (initDone) { /*@-compdef@*/ return; /*@=compdef@*/ } bool_initMod (); employee_initMod (); eref_initMod (); erc_initMod (); empset_initMod (); employeeKinds_all (ek) { /*@-mustfree@*/ db[(int)ek] = erc_create (); /*@=mustfree@*/ } end_employeeKinds_all ; initDone = TRUE; /*@-compdef@*/ /* db[] is really defined */ } /*@=compdef@*/ static eref db_ercKeyGet(erc c, int key) /*@*/ { erc_elements(c, er) { if (eref_get(er).ssNum == key) { return (er); } } end_erc_elements ; return eref_undefined; } static eref db_keyGet (int key) /*@globals db@*/ { eref er; employeeKinds_all (ek) { er = db_ercKeyGet (db[(int) ek], key); if (eref_isDefined (er)) { return er; } } end_employeeKinds_all ; return eref_undefined; } static int db_addEmpls (erc c, int l, int h, empset s) /*@globals internalState@*/ /*@modifies s, internalState@*/ { employee e; int numAdded; numAdded = 0; erc_elements (c, er) { e = eref_get(er); if ((e.salary >= l) && (e.salary <= h)) { empset_insert(s, e); numAdded++; } } end_erc_elements ; return numAdded; } db_status db_hire (employee e) /*@globals db@*/ { if (e.gen == GENDER_UNKNOWN) { return DBS_GENDERERR; } if (e.j == JOB_UNKNOWN) { return DBS_JOBERR; } if (e.salary < 0) { return DBS_SALERR; } if (eref_isDefined (db_keyGet (e.ssNum))) { return DBS_DUPLERR; } db_uncheckedHire (e); return DBS_OK; } void db_uncheckedHire (employee e) /*@globals db@*/ /*@modifies db@*/ { eref er; er = eref_alloc (); eref_assign (er, e); if (e.gen == MALE) { if (e.j == MGR) { erc_insert (db[(int) KND_MMGRS], er); } else { erc_insert (db[(int) KND_MNON], er); } } else { if (e.j == MGR) { erc_insert (db[(int) KND_FMGRS], er); } else { erc_insert (db[(int) KND_FNON], er); } } } bool db_fire (int ssNum) /*@globals db@*/ /*@modifies db@*/ { employeeKinds_all (ek) { erc_elements (db[(int) ek], er) { if (eref_get(er).ssNum == ssNum) { erc_delete (db[(int) ek], er); return TRUE; } } end_erc_elements ; } end_employeeKinds_all ; return FALSE; } bool db_promote (int ssNum) /*@globals db@*/ /*@modifies db@*/ { eref er; employee e; gender g; g = MALE; er = db_ercKeyGet (db[(int) KND_MNON], ssNum); if (!eref_isDefined (er)) { er = db_ercKeyGet (db[(int) KND_FNON], ssNum); if (!eref_isDefined (er)) { return FALSE; } g = FEMALE; } e = eref_get (er); e.j = MGR; eref_assign (er, e); if (g == MALE) { erc_delete (db[(int) KND_MNON], er); erc_insert (db[(int) KND_MMGRS], er); } else { erc_delete (db[(int) KND_FNON], er); erc_insert (db[(int) KND_FMGRS], er); } return TRUE; } db_status db_setSalary (int ssNum, int sal) /*@globals db@*/ { eref er; employee e; if (sal < 0) { return DBS_SALERR; } er = db_keyGet (ssNum); if (!eref_isDefined (er)) { return DBS_MISSERR; } e = eref_get (er); e.salary = sal; eref_assign (er, e); return DBS_OK; } int db_query (db_q q, empset s) /*@globals db@*/ { int numAdded; int l, h; l = q.l; h = q.h; switch (q.g) { case GENDER_UNKNOWN: switch (q.j) { case JOB_UNKNOWN: numAdded = 0; employeeKinds_all (ek) { numAdded += db_addEmpls (db[(int) ek], l, h, s); } end_employeeKinds_all return numAdded; case MGR: numAdded = db_addEmpls (db[(int) KND_MMGRS], l, h, s); numAdded += db_addEmpls (db[(int) KND_FMGRS], l, h, s); return numAdded; case NONMGR: numAdded = db_addEmpls (db[(int) KND_MNON], l, h, s); numAdded += db_addEmpls (db[(int) KND_FNON], l, h, s); return numAdded; } case MALE: switch (q.j) { case JOB_UNKNOWN: numAdded = db_addEmpls (db[(int) KND_MMGRS], l, h, s); numAdded += db_addEmpls (db[(int) KND_MNON], l, h, s); return numAdded; case MGR: return db_addEmpls (db[(int) KND_MMGRS], l, h, s); case NONMGR: return db_addEmpls (db[(int) KND_MNON], l, h, s); } case FEMALE: switch (q.j) { case JOB_UNKNOWN: numAdded = db_addEmpls (db[(int) KND_FMGRS], l, h, s); numAdded += db_addEmpls (db[(int) KND_FNON], l, h, s); return numAdded; case MGR: return db_addEmpls (db[(int) KND_FMGRS], l, h, s); case NONMGR: return db_addEmpls (db[(int) KND_FNON], l, h, s); } } } void db_print (void) /*@globals db@*/ { char *printVal; printf ("Employees:\n"); employeeKinds_all (ek) { printVal = erc_sprint (db[(int) ek]); printf ("%s", printVal); free (printVal); } end_employeeKinds_all ; } splint-3.1.2.dfsg1/test/db3/drive.c0000644021234200000250000000750007121317336014354 0ustar fax/* Part of a driver used to test dbase */ /* Include those modules that export things that are used explicitly here */ # include # include # include "bool.h" # include "employee.h" # include "empset.h" # include "dbase.h" int main (int argc, /*@unused@*/ char *argv[]) /*@globals internalState@*/ /*@modifies internalState@*/ { employee e; empset em1, em2, em3; char na[10000]; char * sprintResult; int i; db_status status; db_q q; /* Initialize all of the LCL-specified modules that were included */ bool_initMod(); employee_initMod(); empset_initMod(); db_initMod(); if (argc != 1) { printf ("FormatPos: Wrong number of arguments. Given %d needs 0.\n", argc - 1); return 1; } /* Unit test empset */ em1 = empset_create(); if (!(empset_size(em1) == 0)) { printf("Size should be 0.\n"); } for (i = 0; i < 500; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); check (employee_setName(&e, na)); empset_insert(em1, e); } if (!(empset_size(em1) == 500)) { printf("Size should be 500.\n"); } for (i = 0; i < 250; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); check (employee_setName(&e, na)); empset_delete(em1, e); } if (!(empset_size(em1) == 250)) { printf("Size should be 250.\n"); } em2 = empset_create(); for (i = 0; i < 100; i++) { e.ssNum = i; e.salary = 100000; e.gen = MALE; e.j = MGR; (void) sprintf(na, "S.S. Doe %d", i); check (employee_setName(&e, na)); empset_insert(em2, e); } em3 = empset_union(em1, em2); if (!(empset_size(em3) == 350)) { printf("Size should be 350.\n"); } empset_intersect(em3, em3); if (!(empset_size(em3) == 350)) { printf("Size should be 350.\n"); } printf("Print two different employees:\n"); for (i = 0; i < 2; i++) { e = empset_choose(em3); employee_sprint(na, e); printf("%s\n", &(na[0])); empset_delete(em3, e); } /* Test dbase */ for (i = 0; i < 20; i++) { e.ssNum = i; e.salary = 10 * i; if (i < 10) { e.gen = MALE; } else { e.gen = FEMALE; } if (i < 15) { e.j = NONMGR; } else { e.j = MGR; } (void) sprintf(na, "J. Doe %d", i); check (employee_setName(&e, na)); if ((i/2)*2 == i) { check (db_hire(e) == DBS_OK); } else { db_uncheckedHire(e); status = db_hire(e); } } printf("Should print true: %s\n", bool_unparse (/*@-usedef@*/ status == DBS_DUPLERR /*@=usedef@*/)); printf("Employees 0 - 19\n"); db_print(); check (db_fire(17)); q.g = FEMALE; q.j = JOB_UNKNOWN; q.l = 158; q.h = 185; printf("Employees 0 - 16, 18 - 19\n"); db_print(); empset_final (em1); i = db_query(q, em1 = empset_create()); sprintResult = empset_sprint(em1); printf("Should get two females: %d\n%s\n", i, sprintResult); free(sprintResult); q.g = MALE; q.j = NONMGR; q.l = 0; q.h = 185; empset_final (em2); i = db_query(q, em2 = empset_create()); empset_final (em3); em3 = empset_disjointUnion(em2, em1); sprintResult = empset_sprint(em3); i = empset_size(em3); printf("Should get two females and ten males: %d\n%s\n", i, sprintResult); free(sprintResult); empset_intersect(em1, em3); sprintResult = empset_sprint(em1); i = empset_size(em1); printf("Should get two females: %d\n%s\n", i, sprintResult); free(sprintResult); check (db_fire(empset_choose(em3).ssNum)); printf("Should get 18 employees\n"); db_print(); empset_final (em1); empset_final (em2); empset_final (em3); return 0; } splint-3.1.2.dfsg1/test/db3/employee.c0000644021234200000250000000152307323413234015057 0ustar fax# include # include # include "employee.h" bool employee_setName (employee *e, char na []) { size_t i; for (i = 0; na[i] != '\0'; i++) { if (i == maxEmployeeName) { e->name[0] = '\0'; return FALSE; } } strcpy (e->name, na); return TRUE; } bool employee_equal (employee * e1, employee * e2) { return ((e1->ssNum == e2->ssNum) && (e1->salary == e2->salary) && (e1->gen == e2->gen) && (e1->j == e2->j) && (strncmp (e1->name, e2->name, maxEmployeeName) == 0)); } typedef /*@observer@*/ char *obscharp; void employee_sprint (char s[], employee e) { static obscharp gender[] ={ "male", "female", "?" }; static obscharp jobs[] = { "manager", "non-manager", "?" }; (void) sprintf (s, FORMATEMPLOYEE, e.ssNum, e.name, gender[(int) e.gen], jobs[(int) e.j], e.salary); } splint-3.1.2.dfsg1/test/db3/empset.c0000644021234200000250000000542707121317336014546 0ustar fax# include "empset.h" static bool initDone = FALSE; static /*@only@*/ ereftab known; static eref empset_get (employee e, erc s) /*@*/ { erc_elements(s, er) { employee e1 = eref_get(er); if (employee_equal(&e1, &e)) { return er; } } end_erc_elements ; return eref_undefined; } bool empset_member (employee e, erc s) { return (eref_isDefined (empset_get (e, s))); } void empset_clear (empset s) { erc_clear (s); } bool /*@alt void@*/ empset_insert (empset s, employee e) /*@globals internalState@*/ /*@modifies internalState@*/ { if (eref_isDefined (empset_get (e, s))) { return FALSE; } empset_insertUnique (s, e); return TRUE; } void empset_insertUnique (empset s, employee e) /*@globals known@*/ /*@modifies known@*/ { eref er; er = ereftab_lookup (e, known); if (!eref_isDefined (er)) { er = eref_alloc ( ); eref_assign (er,e); ereftab_insert (known, e, er); } erc_insert (s, er); } bool /*@alt void@*/ empset_delete (empset s, employee e) { eref er; er = empset_get (e, s); if (!eref_isDefined (er)) { return FALSE; } return erc_delete (s, er); } empset empset_disjointUnion (empset s1, empset s2) /*@globals known@*/ /*@modifies known@*/ { erc result; empset tmp; result = erc_create ( ); if (erc_size (s1) > erc_size (s2)) { tmp = s1; s1 = s2; s2 = tmp; } erc_join (result, s1); empset_elements(s2, emp) { empset_insertUnique(result, emp); } end_empset_elements ; return result; } empset empset_union (empset s1, empset s2) { erc result; empset tmp; result = erc_create (); if (erc_size (s1) > erc_size (s2)) { tmp = s1; s1 = s2; s2 = tmp; } erc_join (result, s2); empset_elements (s1, emp) { if (!empset_member(emp, s2)) { empset_insert(result, emp); } } end_empset_elements ; return result; } void empset_intersect (empset s1, empset s2) { erc toDelete = erc_create(); empset_elements (s2, emp) { if (!empset_member(emp, s2)) { empset_insert(toDelete, emp); } } end_empset_elements ; empset_elements (toDelete, emp) { empset_delete(s1, emp); } end_empset_elements; erc_final (toDelete); } bool empset_subset (empset s1, empset s2) { empset_elements(s1, emp) { if (!empset_member(emp, s2)) { return FALSE; } } end_empset_elements ; return TRUE; } void empset_initMod (void) /*@globals initDone, undef known@*/ /*@modifies initDone, known@*/ { if (initDone) { /*@-globstate@*/ return; /*@=globstate@*/ } bool_initMod (); employee_initMod (); eref_initMod (); erc_initMod (); ereftab_initMod (); known = ereftab_create (); initDone = TRUE; } splint-3.1.2.dfsg1/test/db3/erc.c0000644021234200000250000000467007121317336014021 0ustar fax# include # include "erc.h" static size_t int_toSize (int x) /*@*/ { size_t res = (size_t) x; if ((int) res != x) { fprintf (stderr, "Error: int_toSize failure: %d", x); return 0; } else { return res; } } erc erc_create (void) { erc c; c = (erc) malloc (sizeof (*c)); if (c == 0) { printf ("Malloc returned null in erc_create\n"); exit (EXIT_FAILURE); } c->vals = 0; c->size = 0; return c; } void erc_clear (erc c) { ercList elem; ercList next; for (elem = c->vals; elem != 0; elem = next) { next = elem->next; free (elem); } c->vals = 0; c->size = 0; } void erc_final (erc c) { erc_clear (c); free (c); } bool erc_member (eref er, erc c) { ercList tmpc; for (tmpc = c->vals; tmpc != 0; tmpc = tmpc->next) { if (eref_equal (tmpc->val, er)) { return TRUE; } } return FALSE; } void erc_insert (erc c, eref er) { ercList newElem; newElem = (ercElem *) malloc (sizeof (*newElem)); if (newElem == 0) { printf ("Malloc returned null in erc_insert\n"); exit (EXIT_FAILURE); } newElem->val = er; newElem->next = c->vals; c->vals = newElem; c->size++; } bool erc_delete (erc c, eref er) { ercList elem = c->vals; if (elem != NULL) { if (eref_equal (elem->val, er)) { c->vals = elem->next; free (elem); c->size--; return TRUE; } else { ercList prev = elem; elem = elem->next; for (; elem != 0; prev = elem, elem = elem->next) { if (eref_equal (elem->val, er)) { assert (prev != NULL); prev->next = elem->next; free (elem); c->size--; return TRUE; } } } } return FALSE; } void erc_join (erc c1, erc c2) { ercList tmpc; for (tmpc = c2->vals; tmpc != 0; tmpc = tmpc->next) { erc_insert (c1, tmpc->val); } } char *erc_sprint (erc c) { int len; char *result; result = (char *) malloc (int_toSize (erc_size (c) * (employeePrintSize + 1) + 1)); if (result == 0) { printf ("Malloc returned null in erc_sprint\n"); exit (EXIT_FAILURE); } len = 0; erc_elements(c, er) { employee_sprint(&(result[len]), eref_get(er)); len += employeePrintSize; result[len++] = '\n'; } end_erc_elements; result[len] = '\0'; return result; } eref erc_choose (erc c) { assert (c->vals != NULL); return c->vals->val; } splint-3.1.2.dfsg1/test/db3/eref.c0000644021234200000250000000464307121317336014171 0ustar fax# include # include # include "eref.h" typedef enum { ST_USED, ST_AVAIL } erefStatus; typedef struct { /*@reldef@*/ /*@only@*/ employee *conts; /*@only@*/ erefStatus *status; int size; } erefTable; static erefTable eref_Pool; /* private */ static bool needsInit = TRUE; /* private */ eref eref_alloc (void) /*@globals eref_Pool@*/ /*@modifies eref_Pool@*/ { int i, res; for (i=0; (eref_Pool.status[i] == ST_USED) && (i < eref_Pool.size); i++) { ; } res = i; if (res == eref_Pool.size) { eref_Pool.conts = (employee *) realloc (eref_Pool.conts, 2 * eref_Pool.size * sizeof (*eref_Pool.conts)); if (eref_Pool.conts == 0) { printf ("Malloc returned null in eref_alloc\n"); exit (EXIT_FAILURE); } eref_Pool.status = (erefStatus *) realloc (eref_Pool.status, 2 * eref_Pool.size * sizeof (*eref_Pool.status)); if (eref_Pool.status == 0) { printf ("Malloc returned null in eref_alloc\n"); exit (EXIT_FAILURE); } eref_Pool.size = 2*eref_Pool.size; for (i = res+1; i < eref_Pool.size; i++) { eref_Pool.status[i] = ST_AVAIL; } } eref_Pool.status[res] = ST_USED; return (eref) res; } void eref_initMod (void) /*@globals undef eref_Pool, needsInit, internalState@*/ /*@modifies eref_Pool, needsInit, internalState@*/ { int i; const int size = 16; if (!needsInit) { /*@-compdef@*/ return; /*@=compdef@*/ } needsInit = FALSE; bool_initMod (); employee_initMod (); eref_Pool.conts = (employee *) malloc (size * sizeof (*eref_Pool.conts)); if (eref_Pool.conts == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (EXIT_FAILURE); } eref_Pool.status = (erefStatus *) malloc (size * sizeof (*eref_Pool.status)); if (eref_Pool.status == 0) { printf ("Malloc returned null in eref_initMod\n"); exit (EXIT_FAILURE); } eref_Pool.size = size; /*@+loopexec@*/ for (i = 0; i < size; i++) { eref_Pool.status[i] = ST_AVAIL; } /*@=loopexec@*/ } void eref_free (eref er) /*@globals eref_Pool@*/ /*@modifies eref_Pool@*/ { eref_Pool.status[er] = ST_AVAIL; } void eref_assign (eref er, employee e) /*@globals eref_Pool@*/ /*@modifies eref_Pool@*/ { eref_Pool.conts[er] = e; } employee eref_get (eref er) /*@globals eref_Pool@*/ { return eref_Pool.conts[er]; } splint-3.1.2.dfsg1/test/db3/ereftab.c0000644021234200000250000000136107121317337014653 0ustar fax/* ** This is not a good implementation. I should probably replace ** the erc with a hash table. */ # include "ereftab.h" ereftab ereftab_create (void) { return erc_create (); } void ereftab_insert (ereftab t, employee e, eref er) { eref_assign (er, e); erc_insert (t, er); } bool ereftab_delete (ereftab t, eref er) { bool result; result = erc_member (er, t); erc_delete (t, er); return result; } eref ereftab_lookup (employee e, ereftab t) { employee e1; ereftab_elements(t, er) { e1 = eref_get(er); if (employee_equal(&e, &e1)) { return er; } } end_ereftab_elements ; return eref_undefined; } void ereftab_initMod (void) { bool_initMod (); eref_initMod (); erc_initMod (); } splint-3.1.2.dfsg1/test/db3/bool.h0000644021234200000250000000166407650577034014222 0ustar fax#ifndef BOOL_H #define BOOL_H #ifndef FALSE #define FALSE false #endif #ifndef TRUE #define TRUE true #endif /*@-cppnames@*/ typedef int bool; /*@=cppnames@*/ /* ** bool_initMod has no real effect ** Declared with modifies internalState, so no noeffect errors are ** reported when it is called.) */ extern /*@unused@*/ void bool_initMod (void) /*@globals internalState@*/ /*@modifies internalState@*/ ; /*@-mustmod@*/ # define bool_initMod() do { ; } while (FALSE) /*@=mustmod@*/ extern /*@unused@*/ /*@observer@*/ char *bool_unparse (bool) /*@*/ ; # define bool_unparse(b) ((b) ? "true" : "false" ) extern /*@unused@*/ bool bool_not (bool) /*@*/ ; # define bool_not(b) ((b) ? FALSE : TRUE) extern /*@unused@*/ bool bool_equal (bool, bool) /*@*/ ; # define bool_equal(a,b) ((a) ? (b) : !(b)) /*@noaccess bool@*/ extern /*@falseexit@*/ void check (bool); # define check(x) \ do { bool m_res = x; assert (m_res); } while (FALSE) # endif splint-3.1.2.dfsg1/test/db3/dbase.h0000644021234200000250000000014707121317336014326 0ustar fax# ifndef DBASE_H # define DBASE_H # include "eref.h" # include "erc.h" # include "dbase.lh" # endif splint-3.1.2.dfsg1/test/db3/employee.h0000644021234200000250000000066007414547435015101 0ustar fax# ifndef EMPLOYEE_H # define EMPLOYEE_H # define maxEmployeeName ((size_t) 20) # define employeePrintSize (63) /*@notfunction@*/ # define FORMATEMPLOYEE "%9d %-20s %-6s %-11s %6d.00" # include "employee.lh" /*@-incondefs@*/ /*@-redecl@*/ extern bool employee_setName (/*@special@*/ employee *p_e, char /* na */[]) /*@sets p_e->name@*/; /*@=incondefs@*/ /*@=redecl@*/ # define employee_initMod() bool_initMod() # endif splint-3.1.2.dfsg1/test/db3/empset.h0000644021234200000250000000151507121317336014545 0ustar fax# ifndef F_EMPSET_H # define F_EMPSET_H # include "eref.h" # include "erc.h" # include "ereftab.h" typedef erc empset; /* Abstraction function, toEmpSet: e \in toEmpSet(s) == exists er (count(er, s.val) = 1 /\ getERef(known, e) = er) Rep invariant: forall s: empset (forall er: eref (count(er, s.val) <= 1) /\ s.activeIters = 0 /\ forall er: eref (count(er, s.val) = 1 => in(known, er))) */ # include "empset.lh" # define empset_create() (erc_create()) # define empset_final(s) (erc_final(s)) # define empset_size(es) (erc_size(es)) # define empset_choose(es) (eref_get(erc_choose(es))) # define empset_sprint(es) (erc_sprint(es)) #define empset_elements(e, m_x) \ erc_elements(e, m_y) { employee m_x = eref_get(m_y); #define end_empset_elements } end_erc_elements # endif splint-3.1.2.dfsg1/test/db3/erc.h0000644021234200000250000000142207320411723014012 0ustar fax# ifndef F_ERC_H # define F_ERC_H # include # include "eref.h" /*@-exporttype@*/ /* These types should not be exported, but are used in macros. */ typedef struct s_elem { eref val; /*@null@*/ struct s_elem *next; } ercElem; typedef ercElem *ercList; typedef struct { /*@null@*/ ercList vals; int size; } ercInfo; /*@=exporttype@*/ typedef ercInfo *erc; # include "erc.lh" # define erc_size(c) ((c)->size) # define erc_initMod() \ do { bool_initMod(); employee_initMod();\ eref_initMod(); } while (FALSE) # define erc_elements(c, m_x) \ { erc m_c = (c); ercElem *m_ec = (m_c)->vals; int m_i = 0; \ while (m_i < (m_c)->size) { \ eref m_x; assert (m_ec != NULL); m_x = m_ec->val; m_ec = m_ec->next; m_i++; # define end_erc_elements }} # endif splint-3.1.2.dfsg1/test/db3/eref.h0000644021234200000250000000036007121317336014166 0ustar fax# ifndef F_EREF_H # define F_EREF_H # include "employee.h" typedef int eref; # include "eref.lh" # define eref_undefined -1 # define eref_isDefined(e) ((e) != eref_undefined) # define eref_equal(er1, er2) ((er1) == (er2)) # endif splint-3.1.2.dfsg1/test/db3/ereftab.h0000644021234200000250000000036207121317337014660 0ustar fax# ifndef F_EREFTAB_H # define F_EREFTAB_H # include "erc.h" # include "eref.h" typedef erc ereftab; # include "ereftab.lh" # define ereftab_elements(s, m_x) erc_elements(s, m_x) # define end_ereftab_elements end_erc_elements # endif splint-3.1.2.dfsg1/test/db3/Makefile0000644021234200000250000000442407706100771014543 0ustar fax### ### Splint db3 test ### ### Taken from sample, thirteenth iteration: strictlib ### .SUFFIXES: .lcl .lcs .lh .h .c .o .PHONY: check clean ### SHELL = /bin/csh -f SPLINT = splint SPLINTF = $(SPLINT) -f ./.splintrc LCL = $(SPLINTF) -specundef +lh +quiet -nof SPLINTLH = $(SPLINTF) +lh LCSFILES = dbase.lcs employee.lcs empset.lcs erc.lcs eref.lcs ereftab.lcs bool.lcs check.lcs MODULES = employee eref empset ereftab erc dbase drive.c bool.lcl check.lcl OBJS = dbase.o employee.o empset.o erc.o eref.o ereftab.o test: @$(MAKE) -e check ### Note there is a .splint file used for checking! check: $(LCSFILES) -$(SPLINTF) -showcol $(MODULES) +strict -bounds -modfilesystem +showsummary -exportconstant -exportlocal -protoparamprefix p_ -expect 5 -$(SPLINTF) -showcol $(MODULES) +strict -bounds -modfilesystem +showsummary -exportconstant -exportlocal -protoparamprefix p_ +strictlib -expect 82 # evans 2002-07-09: 5 new sprintf warnings ### The following rules generate .lh and .lcs files from .lcl files. They also ### ensure that .h files appear to be updated whenever the corresponding .lh ### file is updated. .lcl.lh: $(LCL) $*.lcl .lcl.lcs: $(LCL) $*.lcl .lh.h: touch $*.h .c.o: $(GCC) -c $*.c ### ### Clean removes junk and all derived files. ### Tidy removes junk and object and executable files. ### clean: tidy -@rm -f *.c.html *.lcl.html *.h.html *.lh.html *.lcs *.lh >& /dev/null tidy: -@rm -f ,* .,* *.CKP *.BAK .emacs_[0-9]* core a.out *.*~ *~ *.o drive >& /dev/null ### The following dependencies ensure that imported LCL specs ### are checked before the specs that import them. dbase.lcs: employee.lcs empset.lcs empset.lcs: employee.lcs erc.lcs: eref.lcs eref.lcl: employee.lcs ereftab.lcs: employee.lcs eref.lcs ### The following dependencies ensure that a .o file is recompiled when the ### corresponding .c file, or one of the .h files it #includes, is changed. dbase.o: dbase.c bool.h dbase.h employee.h empset.h drive.o: drive.c bool.h dbase.h employee.h empset.h erc.h eref.h ereftab.h employee.o: employee.c employee.h empset.o: empset.c bool.h empset.h erc.h eref.h employee.h employee.h erc.o: erc.c bool.h erc.h eref.h employee.h eref.o: eref.c eref.h employee.h ereftab.o: ereftab.c bool.h ereftab.h erc.h eref.h employee.h splint-3.1.2.dfsg1/test/fileio/0000755021234200000250000000000010645776271013710 5ustar faxsplint-3.1.2.dfsg1/test/fileio/file.c0000644021234200000250000000050707347767230014775 0ustar faxextern FILE *f1; FILE *f (FILE *fin, FILE *fout) /*@ensures closed fin@*/ { FILE *res; int x; x = fgetc (fin); if (x > 65) { (void) fclose (fout); } /* merge incompatible */ if (x > 65) { ; } else { (void) fclose (fin); } /* merge incompatible */ return res; } splint-3.1.2.dfsg1/test/fileio/filebranch.c0000644021234200000250000000022707347767230016152 0ustar faxvoid f (char *fname) { FILE *f; if (fname != NULL) { f = fopen (fname, "r"); if (f != NULL) { (void) fclose (f); } } } splint-3.1.2.dfsg1/test/fileio/filerw.c0000644021234200000250000000046107321224210015317 0ustar faxint f (/*@open@*/ /*@read@*/ FILE *f1, /*@open@*/ /*@write@*/ FILE *f2) { int c; c = fgetc (f1); c = fgetc (f2); /* error: not readable */ (void) fputc ('a', f1); /* error */ (void) fseek (f1, 0, SEEK_CUR); (void) fputc ('a', f1); /* okay */ c = fgetc (f1); /* error */ return c; } splint-3.1.2.dfsg1/test/fileio/Makefile0000644021234200000250000000036307413453501015335 0ustar fax.PHONY: filerw fileopen SPLINT = splint all: filerw fileopen filebranch filerw: ${SPLINT} -mts file -mts filerw filerw.c -expect 3 fileopen: ${SPLINT} -mts file -mts filerw file.c -expect 3 filebranch: ${SPLINT} -mts file filebranch.c splint-3.1.2.dfsg1/test/fileio/eof.mts0000644021234200000250000000004707320411726015172 0ustar faxstate eofchar context reference int splint-3.1.2.dfsg1/test/fileio/file.mts0000644021234200000250000000054007340757351015347 0ustar faxattribute openness context reference FILE * oneof closed, open annotations open ==> open closed ==> closed merge open + closed ==> error transfers open as closed ==> error closed as open ==> error losereference open ==> error "open file not closed" defaults reference ==> open end splint-3.1.2.dfsg1/test/fileio/filerw.mts0000644021234200000250000000142007325160577015717 0ustar faxattribute filerw context reference FILE * oneof rw_none, rw_read, rw_write, rw_either annotations read ==> rw_read write ==> rw_write rweither ==> rw_either rwnone ==> rw_none merge rw_read + rw_write ==> rw_none rw_none + * ==> rw_none rw_either + rw_read ==> rw_read rw_either + rw_write ==> rw_write rw_either + rw_none ==> rw_none transfers rw_read as rw_write ==> error "Must reset file between read and write." rw_write as rw_read ==> error "Must reset file between write and read." rw_none as rw_read ==> error "File in unreadable state." rw_none as rw_write ==> error "File in unwritable state." rw_either as rw_write ==> rw_write rw_either as rw_read ==> rw_read end splint-3.1.2.dfsg1/test/fileio/file.xh0000644021234200000250000000167407320411727015164 0ustar faxextern int fclose (/*@open@*/ FILE *stream) /*:checkerror EOF@*/ /* The fclose function returns zero if the stream was successfully closed or EOF if any errors were detected. */ /*@ensures closed stream@*/ ; extern /*@open@*/ FILE *fopen (const char *filename, const char *mode) /* ** File modes: ** "rb" read ** "wb" create, truncate, write ** "ab" create, write, append ** "rb+" read, write ** "wb+" create, truncate, read, write ** "ab+" create, read, write, append */ ; extern /*@open@*/ FILE *freopen (char *filename, char *mode, /*@closed@*/ FILE *stream) /*@ensures open stream@*/ ; extern /*@null@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, /*@open@*/ FILE *stream) /*@modifies fileSystem, *s, *stream, errno@*/ ; /* fgetc fputc fseek ftell */ int ferror (FILE *stream) ; int feof (FILE *stream) ; void clearerr (FILE *stream) ; splint-3.1.2.dfsg1/test/fileio/filerw.xh0000644021234200000250000000047507320411727015533 0ustar faxextern /*@rweither@*/ FILE *fopen (const char *filename, const char *mode) ; extern int fgetc (/*@read@*/ FILE *f) ; extern int fputc (int, /*@write@*/ FILE *f) ; /* fseek resets the rw state of a stream */ int fseek (/*@rweither@*/ FILE *stream, long int offset, int whence) /*@ensures rweither stream@*/ ; splint-3.1.2.dfsg1/test/for/0000755021234200000250000000000010645776270013226 5ustar faxsplint-3.1.2.dfsg1/test/for/.splintrc0000644021234200000250000000001507413453501015045 0ustar fax+arrayBounds splint-3.1.2.dfsg1/test/for/for.c0000644021234200000250000000022707330314065014144 0ustar faxvoid f() { int j, i; char s[11]; char t[11]; for (j = 0; j <= 10; j++) { s[j] = '\0'; } for (i = 0; i <= 11; i++) { t[i] = '\0'; } } splint-3.1.2.dfsg1/test/for/Makefile0000644021234200000250000000013207416003537014651 0ustar fax.PHONY: check SPLINT = splint -exportlocal check: $(SPLINT) +bounds for.c -expect 1 splint-3.1.2.dfsg1/test/globalbufferannotation/0000755021234200000250000000000010645776270017165 5ustar faxsplint-3.1.2.dfsg1/test/globalbufferannotation/.splintrc0000644021234200000250000000001707413453501021006 0ustar fax+fcnconstraint splint-3.1.2.dfsg1/test/globalbufferannotation/globalvariable.c0000644021234200000250000000050307321242226022257 0ustar fax//#include "/home/drl7x/re/LCLintDev/lib/ansi.h" static char f [12]; extern void /*@alt char * @*/ mstrcpy (/*@unique@*/ /*@out@*/ /*returned*/ char *s1, char *s2) /*@modifies *s1@*/ /*@requires MaxSet(s1) >= MaxRead(s2); @*/; void copyf (char * c) /*@requires MaxSet(c) >= MaxRead(f); @*/ { mstrcpy (c, f); } splint-3.1.2.dfsg1/test/globalbufferannotation/Makefile0000644021234200000250000000013207416003537020610 0ustar fax.PHONY: check SPLINT = splint -exportlocal check: $(SPLINT) +bounds globalvariable.c splint-3.1.2.dfsg1/test/manual/0000755021234200000250000000000010645776273013720 5ustar faxsplint-3.1.2.dfsg1/test/manual/Makefile0000755021234200000250000000737007416664145015366 0ustar fax### ### This Makefile produces the figures included in the Splint Manual. ### .SUFFIXES: .out .expect .c .lcl .h .lh .diff .PHONY: clean SPLINT = splint SPLINTFLAGS = -warnflags -nof -linelen 55 -hints -showcol -booltype bool -showfunc -exportlocal -exportheader RUNTOHTML = cat # /u/evs/lclint/scripts/runtohtmls GENHTML = /u/evs/lclint/scripts/genhtmls CTOHTML = /u/evs/bin/ctohtmlplain BASEDIR = /u/evs/perl/basedir MAKERUNNER = /u/evs/lclint/scripts/makerunner ### SHELL = /bin/csh DIFF = diff all: sample null mstring usedef bool palindrome only stack rstring unique \ exposure modify globals annotglobs clauses order loop switch noeffect \ ignore setChar multiError bounds ### In line example .PHONY: sample sample: sample.c $(SPLINT) $(SPLINTFLAGS) sample.c -expect 2 ### Figure 2: .PHONY: null null: null.c $(SPLINT) $(SPLINTFLAGS) null.c -expect 1 ### Figure 3: .PHONY: mstring mstring: mstring.c $(SPLINT) $(SPLINTFLAGS) mstring.c -expect 0 ### Figure 4: .PHONY: usedef usedef: usedef.c $(SPLINT) $(SPLINTFLAGS) usedef.c -expect 3 $(SPLINT) $(SPLINTFLAGS) usedef.c +impouts -expect 2 ### Figure 5: .PHONY: bool bool: bool.c bool.h $(SPLINT) $(SPLINTFLAGS) bool.c +predboolptr -booltype bool -linelen 70 -expect 7 ### Figure 6: .PHONY: palindrome palindrome: palindrome.c mstring.h bool.h $(SPLINT) $(SPLINTFLAGS) palindrome.c -expect 4 -linelen 45 ### Figure 7: .PHONY: only only: only.c $(SPLINT) $(SPLINTFLAGS) only.c -expect 6 ### Figure 8: .PHONY: stack stack: stack.c $(SPLINT) $(SPLINTFLAGS) stack.c -expect 3 ### Figure 9: ### no code ### Figure 10: .PHONY: rstring rstring: rstring.c $(SPLINT) $(SPLINTFLAGS) rstring.c -expect 1 ### Figure 11: .PHONY: unique unique: unique.c $(SPLINT) $(SPLINTFLAGS) unique.c -expect 1 ### Figure 12: .PHONY: returned returned: returned.c $(SPLINT) $(SPLINTFLAGS) returned.c -expect 1 ### Figure 13: .PHONY: exposure exposure: exposure.c $(SPLINT) $(SPLINTFLAGS) exposure.c -expect 4 +checks -exportlocal -exportheader -linelen 50 ### Figure 14: .PHONY: modify modify: modify.c $(SPLINT) +checks $(SPLINTFLAGS) modify.c -expect 2 ### Figure 15: .PHONY: globals globals: globals.c $(SPLINT) +checks $(SPLINTFLAGS) globals.c -expect 2 ### Figure 16: .PHONY: annotglobals annotglobs: annotglobs.c $(SPLINT) $(SPLINTFLAGS) annotglobs.c -expect 3 ### Figure 17: .PHONY: clauses clauses: clauses.c $(SPLINT) $(SPLINTFLAGS) clauses.c -expect 0 ### Figure 18: .PHONY: order order: order.c $(SPLINT) $(SPLINTFLAGS) order.c +evalorderuncon -expect 4 -linelen 60 $(SPLINT) $(SPLINTFLAGS) order.c -expect 3 ### Figure 19: .PHONY: loop loop: loop.c $(SPLINT) $(SPLINTFLAGS) loop.c +infloopsuncon -expect 2 $(SPLINT) $(SPLINTFLAGS) loop.c -expect 1 ### Figure 20: .PHONY: switch switch: switch.c $(SPLINT) $(SPLINTFLAGS) switch.c -expect 2 ### Figure 21: .PHONY: noeffect noeffect: noeffect.c $(SPLINT) $(SPLINTFLAGS) noeffect.c +noeffectuncon -expect 3 $(SPLINT) $(SPLINTFLAGS) noeffect.c -expect 2 ### Figure 22: .PHONY: ignore ignore: ignore.c $(SPLINT) $(SPLINTFLAGS) bool.h ignore.c -expect 2 $(SPLINT) $(SPLINTFLAGS) bool.h ignore.c -retvalbool -expect 1 $(SPLINT) $(SPLINTFLAGS) bool.h ignore.c -retvalint -expect 1 ### Figure 23: .PHONY: Anames names: names.c $(SPLINT) $(SPLINTFLAGS) names.c +distinctinternalnames +internalnamelookalike +isoreserved -expect 3 ### Figure ???: .PHONY: setChar setChar: setChar.c $(SPLINT) $(SPLINTFLAGS) setChar.c +bounds -exportlocal +showconstraintlocation -expect 1 .PHONY: multiError multiError: multiError.c $(SPLINT) $(SPLINTFLAGS) multiError.c +bounds -exportlocal +showconstraintlocation -expect 1 .PHONY: bounds bounds: bounds.c $(SPLINT) $(SPLINTFLAGS) bounds.c +bounds -exportlocal +showconstraintlocation -expect 1 -linelen 50 clean: -rm -f core a.out *.*~ splint-3.1.2.dfsg1/test/manual/annotglobs.c0000755021234200000250000000050407415257041016220 0ustar faxint globnum; struct { char *firstname, *lastname; int id; } globname; void initialize (/*@only@*/ char *name) /*@globals undef globnum, undef globname @*/ { globname.id = globnum; globname.lastname = name; } void finalize (void) /*@globals killed globname@*/ { free (globname.lastname); } splint-3.1.2.dfsg1/test/manual/bool.c0000755021234200000250000000031607415257041015006 0ustar fax# include "bool.h" int f (int i, char *s, bool b1, bool b2) { if (i = 3) return b1; if (!i || s) return i; if (s) return 7; if (b1 == b2) return 3; return 2; } splint-3.1.2.dfsg1/test/manual/bool.h0000755021234200000250000000045607415257041015020 0ustar fax#ifndef BOOL_H #define BOOL_H #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE (! FALSE) #endif typedef int bool; # define bool_initMod() # define bool_unparse(b) ((b) ? "true" : "false" ) # define bool_not(b) ((b) ? FALSE : TRUE) # define bool_equal(a,b) ((a) ? (b) : !(b)) # endif splint-3.1.2.dfsg1/test/manual/clauses.c0000644021234200000250000000131307415257041015505 0ustar faxtypedef struct { int id; /*@only@*/ char *name; } *record; static /*@special@*/ record record_new (void) /*@defines result->id@*/ { record r = (record) malloc (sizeof (*r)); assert (r != NULL); r->id = 3; return r; } static void record_setName (/*@special@*/ record r, /*@only@*/ char *name) /*@defines r->name@*/ { r->name = name; } record record_create (/*@only@*/ char *name) { record r = record_new (); record_setName (r, name); return r; } void record_clearName (/*@special@*/ record r) /*@releases r->name@*/ /*@ensures isnull r->name@*/ { free (r->name); r->name = NULL; } void record_free (/*@only@*/ record r) { record_clearName (r); free (r); } splint-3.1.2.dfsg1/test/manual/employee.h0000755021234200000250000000010607415257041015674 0ustar faxtypedef /*@abstract@*/ struct { char *name; int *id; } *employee; splint-3.1.2.dfsg1/test/manual/exposure.c0000755021234200000250000000054407415257041015730 0ustar fax# include "employee.h" char * employee_getName (employee e) { return e->name; } /*@observer@*/ char * employee_obsName (employee e) { return e->name; } /*@exposed@*/ char * employee_exposeName (employee e) { return e->name; } void employee_capName (employee e) { char *name; name = employee_obsName (e); *name = toupper (*name); } splint-3.1.2.dfsg1/test/manual/globals.c0000755021234200000250000000011707415257041015475 0ustar faxint glob1, glob2; int f (void) /*@globals glob1;@*/ { return glob2; } splint-3.1.2.dfsg1/test/manual/ignore.c0000755021234200000250000000026707415257041015343 0ustar faxextern int fi (void); extern bool fb (void); extern int /*@alt void@*/ fv (void); int ignore (void) { fi (); (void) fi (); fb (); fv (); return fv (); } splint-3.1.2.dfsg1/test/manual/implicit.c0000755021234200000250000000020107415257041015656 0ustar faxtypedef struct { char *name; int val; } *rec; extern rec rec_last ; extern rec rec_create (char *name, int val); splint-3.1.2.dfsg1/test/manual/intSet.h0000755021234200000250000000016007415257041015323 0ustar faxtypedef /*@abstract@*/ struct { int nelements; int *elements; } *intSet ; extern intSet intSet_new (void); splint-3.1.2.dfsg1/test/manual/list.c0000755021234200000250000000061207415257041015025 0ustar faxtypedef /*@null@*/ struct _list { /*@only@*/ char *this; /*@null@*/ /*@only@*/ struct _list *next; } *list; extern /*@out@*/ /*@only@*/ void * smalloc (size_t); void list_addh (list l, /*@only@*/ char *e) { if (l != NULL) { while (l->next != NULL) { l = l->next; } l->next = (list) smalloc (sizeof (*l->next)); l->next->this = e; } } splint-3.1.2.dfsg1/test/manual/loop.c0000755021234200000250000000036007415257041015023 0ustar faxextern int glob1, glob2; extern int f (void) /*@globals glob1@*/ /*@modifies nothing@*/ ; extern void g (void) /*@modifies glob2@*/ ; extern void h (void) ; void upto (int x) { while (x > f()) g(); while (f() < 3) h(); } splint-3.1.2.dfsg1/test/manual/macros.c0000755021234200000250000000042707415257041015342 0ustar fax/*@notfunction@*/ # define NUMTYPES int /*@alt unsigned int, char, float, double@*/ extern NUMTYPES square (NUMTYPES x); int f (int x, char c, float f, double d, char *s) { x = square (x); c = square (c); square (f); square (d); square (s); return (square (d)); } splint-3.1.2.dfsg1/test/manual/modify.c0000755021234200000250000000021307415257041015336 0ustar faxvoid setx (int *x, int *y) /*@modifies *x@*/ { *y = *x; } void sety (int *x, int *y) /*@modifies *y@*/ { setx (y, x); } splint-3.1.2.dfsg1/test/manual/mstring.c0000755021234200000250000000024707415257041015541 0ustar faxstatic /*@notnull@*/ char *mstring_createNew (int x); char *mstring_space (void) { char *m = mstring_createNew (2); *m = ' '; *(m + 1) = '\0'; return m; } splint-3.1.2.dfsg1/test/manual/mstring.h0000755021234200000250000000005107415257041015537 0ustar faxtypedef /*@abstract@*/ char *mstring; splint-3.1.2.dfsg1/test/manual/mstringnn.c0000755021234200000250000000072407415257041016075 0ustar faxtypedef /*@abstract@*/ /*@null@*/ char *mstring; static mstring mstring_createNew (int x) ; mstring mstring_space1 (void) { mstring m = mstring_createNew (1); /* error, since m could be NULL */ *m = ' '; *(m + 1) = '\0'; return m; } static /*@notnull@*/ mstring mstring_createNewNN (int x) ; mstring mstring_space2 (void) { mstring m = mstring_createNewNN (1); /* no error, because of notnull annotation */ *m = ' '; *(m + 1) = '\0'; return m; } splint-3.1.2.dfsg1/test/manual/multiError.c0000644021234200000250000000012007415702237016207 0ustar faxvoid multiError(char * buf) { buf[0] = 's'; buf[2] = 's'; buf[1] = 's'; } splint-3.1.2.dfsg1/test/manual/names.c0000755021234200000250000000026207415257041015156 0ustar faxchar *stringreverse (char *s); int f (int x) { int lookalike = 1; int looka1ike = 2; if (x > 3) { int x = lookalike; x += looka1ike; } return x; } splint-3.1.2.dfsg1/test/manual/noeffect.c0000755021234200000250000000025107415257041015642 0ustar faxextern void nomodcall (int *x) /*@*/; extern void mysterycall (int *x); int noeffect (int *x, int y) { y == *x; nomodcall (x); mysterycall (x); return *x; } splint-3.1.2.dfsg1/test/manual/null.c0000755021234200000250000000021307415257041015021 0ustar faxchar firstChar1 (/*@null@*/ char *s) { return *s; } char firstChar2 (/*@null@*/ char *s) { if (s == NULL) return '\0'; return *s; } splint-3.1.2.dfsg1/test/manual/only.c0000755021234200000250000000033407415257041015034 0ustar faxextern /*@only@*/ int *glob; /*@only@*/ int * f (/*@only@*/ int *x, int *y, int *z) /*@globals int *glob;@*/ { int *m = (int *) malloc (sizeof (int)); glob = y; free (x); *m = *x; return z; } splint-3.1.2.dfsg1/test/manual/order.c0000755021234200000250000000036507415257041015172 0ustar faxextern int glob; extern int mystery (void); extern int modglob (void) /*@globals glob@*/ /*@modifies glob@*/ ; int f (int x, int y[]) { int i = x++ * x; y[i] = i++; i += modglob() * glob; i += mystery() * glob; return i; } splint-3.1.2.dfsg1/test/manual/palindrome.c0000755021234200000250000000054307415257041016207 0ustar fax# include "bool.h" # include "mstring.h" bool isPalindrome (mstring s) { char *current = (char *) s; int i, len = (int) strlen (s); for (i = 0; i <= (len+1)/2; i++) { if (current[i] != s[len-i-1]) return FALSE; } return TRUE; } bool callPal (void) { return (isPalindrome ("bob")); } splint-3.1.2.dfsg1/test/manual/palindrome.h0000755021234200000250000000012007415257041016203 0ustar fax# include "mstring.h" # include "bool.h" extern bool isPalindrome (mstring s); splint-3.1.2.dfsg1/test/manual/refs.c0000755021234200000250000000014007415257041015005 0ustar fax typedef /*@abstract@*/ /*@refcounted@*/ struct { int refs; char *contents; } *rstring; splint-3.1.2.dfsg1/test/manual/returned.c0000755021234200000250000000077007415257041015707 0ustar fax# include "intSet.h" extern intSet intSet_insert (/*@returned@*/ intSet s, int x); /* ** with returned, no error is reported, since the same ** storage is returned from insert, and returned ** from intSet_singleton as an implicit only result. */ intSet intSet_singleton (int x) { return (intSet_insert (intSet_new (), x)); } /* ** without returned: */ extern intSet intSet_insert2 (intSet s, int x); intSet intSet_singleton2 (int x) { return (intSet_insert2 (intSet_new (), x)); } splint-3.1.2.dfsg1/test/manual/rgb.c0000755021234200000250000000012107415257041014617 0ustar faxtypedef /*@abstract@*/ /*@mutable@*/ struct { int r; int g; int b; } color; splint-3.1.2.dfsg1/test/manual/rstring.c0000755021234200000250000000043607415257041015546 0ustar fax# include "rstring.h" static rstring rstring_ref (rstring r) { r->refs++; return r; } rstring rstring_first (rstring r1, rstring r2) { if (strcmp (r1->contents, r2->contents) < 0) { return r1; } else { return rstring_ref (r2); } } splint-3.1.2.dfsg1/test/manual/rstring.h0000755021234200000250000000015207415257041015546 0ustar faxtypedef /*@abstract@*/ /*@refcounted@*/ struct { /*@refs@*/ int refs; char *contents; } *rstring; splint-3.1.2.dfsg1/test/manual/sample.c0000755021234200000250000000023307415257041015332 0ustar faxtypedef /*@abstract@*/ char *mstring; int faucet (void) { int *x = (int *) malloc (sizeof (int) * 24); /* ** silly program ... */ return 3; } splint-3.1.2.dfsg1/test/manual/setChar.c0000644021234200000250000000006607415702237015445 0ustar faxchar buf[10]; void setChar() { buf[10] = 'x'; } splint-3.1.2.dfsg1/test/manual/setname.c0000755021234200000250000000014507415257041015507 0ustar fax# include "setname.h" void setName (employee e) /*@modifies e->name@*/ { strcpy (e->name, ""); } splint-3.1.2.dfsg1/test/manual/setname.h0000755021234200000250000000015707415257041015517 0ustar faxtypedef /*@abstract@*/ struct { char *name; } *employee; extern void setName (employee e) /*@modifies e@*/; splint-3.1.2.dfsg1/test/manual/special.c0000755021234200000250000000127707415257041015502 0ustar faxtypedef struct { int id; /*@only@*/ char *name; } *record; static /*@special@*/ record record_new (void) /*@defines result->id@*/ { record r = (record) malloc (sizeof (*r)); assert (r != NULL); r->id = 3; return r; } static void record_setName (/*@special@*/ record r, /*@only@*/ char *name) /*@defines r->name@*/ { r->name = name; } record record_create (/*@only@*/ char *name) { record r = record_new (); record_setName (r, name); return r; } void record_clearName (/*@special@*/ record r) /*@releases r->name@*/ /*@post:isnull r->name@*/ { free (r->name); r->name = NULL; } void record_free (/*@only@*/ record r) { record_clearName (r); free (r); } splint-3.1.2.dfsg1/test/manual/stack.c0000755021234200000250000000021107415257041015152 0ustar faxint *glob; /*@dependent@*/ int *f (int **x) { int sa[2] = { 0, 1 }; int loc = 3; glob = &loc; *x = &sa[0]; return &loc; } splint-3.1.2.dfsg1/test/manual/sumsquares.c0000755021234200000250000000030707415257041016263 0ustar faxextern int square (/*@sef@*/ int x); # define square(x) ((x) *(x)) extern int sumsquares (int x, int y); # define sumsquares(x,y) (square(x) + square(y)) int f (int i) { return square (i++); } splint-3.1.2.dfsg1/test/manual/switch.c0000755021234200000250000000040107415257041015347 0ustar faxtypedef enum { YES, NO, DEFINITELY, PROBABLY, MAYBE } ynm; void decide (ynm y) { switch (y) { case PROBABLY: case NO: printf ("No!"); case MAYBE: printf ("Maybe"); /*@fallthrough@*/ case YES: printf ("Yes!"); } } splint-3.1.2.dfsg1/test/manual/testpal.c0000755021234200000250000000056707415257041015537 0ustar fax# include "palindrome.h" int main (void) { printf ("cat: %s\n", bool_unparse (isPalindrome ("cat"))); printf ("catac: %s\n", bool_unparse (isPalindrome ("catac"))); printf ("caac: %s\n", bool_unparse (isPalindrome ("caac"))); printf ("catttac: %s\n", bool_unparse (isPalindrome ("catttac"))); printf ("cabddeac: %s\n", bool_unparse (isPalindrome ("cabddeac"))); } splint-3.1.2.dfsg1/test/manual/types.c0000755021234200000250000000012107415257041015211 0ustar faxtypedef /*@abstract@*/ /*@mutable@*/ struct { int r; int g; int b; } color; splint-3.1.2.dfsg1/test/manual/unique.c0000755021234200000250000000017407415257041015363 0ustar fax# include void capitalize (/*@out@*/ char *s, char *t) { strcpy (s, t); *s = toupper (*s); } splint-3.1.2.dfsg1/test/manual/usedef.c0000755021234200000250000000052107415257041015324 0ustar faxextern void setVal (/*@out@*/ int *x); extern int getVal (/*@in@*/ int *x); extern int mysteryVal (int *x); int dumbfunc (/*@out@*/ int *x, int i) { if (i > 3) return *x; else if (i > 1) return getVal (x); else if (i == 0) return mysteryVal (x); else { setVal (x); return *x; } } splint-3.1.2.dfsg1/test/manual/bounds.c0000644021234200000250000000061107416203555015342 0ustar fax# include # include void updateEnv (char * str) { char * tmp; tmp = getenv("MYENV"); if (tmp != NULL) strcpy (str, tmp); } void updateEnvSafe (char * str, size_t strSize) /*@requires maxSet(str) >= (strSize -1)@*/ { char * tmp; tmp = getenv("MYENV"); if (tmp != NULL) { strncpy (str, tmp, strSize -1); str[strSize -1] = '/0'; } } splint-3.1.2.dfsg1/test/maxset/0000755021234200000250000000000010645776270013741 5ustar faxsplint-3.1.2.dfsg1/test/maxset/.splintrc0000644021234200000250000000000007413453501015552 0ustar faxsplint-3.1.2.dfsg1/test/maxset/maxsetannotations.c0000644021234200000250000000015707332061727017660 0ustar fax void anstrcpy( /*@unique@*/ char * a, char *b) /*@requires MaxSet(a) >= MaxRead (b); @*/ { strcpy (a,b); } splint-3.1.2.dfsg1/test/maxset/maxsetnoannotations.c0000644021234200000250000000010407332061727020205 0ustar faxvoid noancopy(/*@unique@*/ char * a, char *b) { strcpy (a,b); } splint-3.1.2.dfsg1/test/maxset/Makefile0000644021234200000250000000023107416003537015364 0ustar fax.PHONY: check SPLINT = splint -exportlocal check: $(SPLINT) +boundswrite maxsetannotations.c $(SPLINT) +boundswrite maxsetnoannotations.c -expect 1 splint-3.1.2.dfsg1/test/mergestate/0000755021234200000250000000000010645776271014601 5ustar faxsplint-3.1.2.dfsg1/test/mergestate/taintednm.c0000644021234200000250000000070007347767230016725 0ustar faxchar *f (/*@tainted@*/ char *s) { char t[50]; char t2[20]; (void) system ("test"); strcpy (t, "test"); strcpy (t2, "okay"); (void) system (t); t = strcat3 (t, t2, t2); (void) system (t); /* okay */ t = strcat3 (t, t2, s); (void) system (t); /* error */ t = strcat3 (t, t2, t2); (void) system (t); /* error */ t = strcpy (t, s); (void) system (t); /* error */ return t; /* error - tainted, stack-allocated */ } splint-3.1.2.dfsg1/test/mergestate/Makefile0000644021234200000250000000030707413453501016224 0ustar fax.PHONY: tainted SPLINT = splint all: tainted tainted: ${SPLINT} -mts taintednm taintednm.c -mustfree -exportlocal -expect 2 ${SPLINT} -mts tainted taintednm.c -mustfree -exportlocal -expect 4 splint-3.1.2.dfsg1/test/mergestate/tainted.mts0000644021234200000250000000077407347767230016766 0ustar faxattribute taintedness context reference char * oneof untainted, tainted annotations tainted reference ==> tainted untainted reference ==> untainted transfers tainted as untainted ==> error "Possibly tainted storage used as untainted." untainted as tainted ==> untainted merge tainted + untainted ==> tainted defaults reference ==> tainted parameter ==> tainted result ==> tainted literal ==> untainted null ==> untainted end splint-3.1.2.dfsg1/test/mergestate/taintednm.mts0000644021234200000250000000105607347767230017313 0ustar faxattribute taintedness context reference char * oneof untainted, tainted annotations tainted reference ==> tainted untainted reference ==> untainted transfers tainted as untainted ==> error "Possibly tainted storage used as untainted." untainted as tainted ==> untainted merge tainted + untainted ==> tainted untainted + tainted ==> error "bogus merge" defaults reference ==> tainted parameter ==> tainted result ==> tainted literal ==> untainted null ==> untainted end splint-3.1.2.dfsg1/test/mergestate/tainted.xh0000644021234200000250000000005607347767230016573 0ustar fax/* ** tainted.xh */ # include "taintednm.xh" splint-3.1.2.dfsg1/test/mergestate/taintednm.xh0000644021234200000250000000242307347767230017126 0ustar fax/* ** tainted.xh */ /* Library functions annotated for tainted.mts */ extern int remove (/*@untainted@*/ char *filename) /*@modifies fileSystem, errno@*/ ; extern int rename (/*@untainted@*/ char *old, /*@untainted@*/ char *new) ; extern /*@observer@*/ char *tmpnam (/*@untainted@*/ char *s) ; extern FILE *fopen (/*@untainted@*/ char *filename, char *mode) ; extern int printf (/*@untainted@*/ char *format, ...) ; extern /*@null@*/ FILE *freopen (/*@untainted@*/ char *filename, char *mode, FILE *stream) ; extern /*@null@*/ /*@tainted@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, FILE *stream) /*@ensures tainted s@*/ /*@modifies *s@*/ ; extern int system (/*@untainted@*/ /*@null@*/ char *s) /*@modifies fileSystem@*/ ; extern char *strcpy (/*@returned@*/ char *s1, char *s2) /*@ensures s1:taintedness = s2:taintedness@*/ ; extern char *strcat (/*@returned@*/ char *s1, char *s2) /*@ensures s1:taintedness = s1:taintedness | s2:taintedness@*/ /*@ensures result:taintedness = s1:taintedness | s2:taintedness @*/ ; extern char *strcat3 (/*@returned@*/ char *s1, char *s2, char *s3) /*@ensures s1:taintedness = s1:taintedness | s2:taintedness | s3:taintedness@*/ /*@ensures result:taintedness = s1:taintedness | s2:taintedness | s3:taintedness @*/ ; splint-3.1.2.dfsg1/test/metastate/0000755021234200000250000000000010645776271014430 5ustar faxsplint-3.1.2.dfsg1/test/metastate/file.c0000644021234200000250000000121107320411742015467 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); static void checkClosed (/*@closed@*/ /*@null@*/ FILE *); int main (void) { FILE *fle = NULL; char s[10]; checkClosed (fle); /* okay */ checkOpen (fle); /* error */ fle = fopen ("test", "r"); checkClosed (fle); /* error */ checkOpen (fle); /* okay */ (void) fclose (fle); checkOpen (fle); /* error */ checkClosed (fle); /* okay */ return 0; /* error: f is not closed */ } # if 0 @.S (void) fgets (s, 3, fle); (void) fclose (fle); (void) fgets (s, 3, fle); /* error: f is not open */ (void) freopen ("test", "r", fle); (void) fgets (s, 3, fle); # endif splint-3.1.2.dfsg1/test/metastate/file1.c0000644021234200000250000000073507320411742015562 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); static void checkClosed (/*@closed@*/ /*@null@*/ FILE *); int main (void) { FILE *fle = NULL; char s[10]; checkClosed (fle); /* okay */ checkOpen (fle); /* error */ fle = fopen ("test", "r"); if (fle == NULL) { return 0; } checkClosed (fle); /* error */ checkOpen (fle); /* okay */ (void) fclose (fle); checkOpen (fle); /* error */ checkClosed (fle); /* okay */ return 0; } splint-3.1.2.dfsg1/test/metastate/file2.c0000644021234200000250000000041707320411742015560 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); int main (void) { FILE *fle1 = fopen ("test1", "r"); if (fle1 == NULL) { FILE *fle2 = fopen ("test2", "r"); checkOpen (fle2); } /* fle2 not closed */ return 0; /* fle1 not closed */ } splint-3.1.2.dfsg1/test/metastate/file3.c0000644021234200000250000000043707320411742015563 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); static void checkClosed (/*@closed@*/ /*@null@*/ FILE *); int main (void) { FILE *fle1 = fopen ("test1", "r"); if (3 > 4) { (void) fclose (fle1); /* possibly null */ } /* merge inconsistent */ return 0; } splint-3.1.2.dfsg1/test/metastate/file4.c0000644021234200000250000000070607320411742015563 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); static void checkClosed (/*@closed@*/ /*@null@*/ FILE *); void passOpen (/*@open@*/ FILE *f) { (void) fputc (3, f); } /* okay, still open */ int main (void) { FILE *fle = NULL; char s[10]; checkClosed (fle); /* okay */ checkOpen (fle); /* error */ fle = fopen ("test", "r"); if (fle == NULL) { return 0; } passOpen (fle); (void) fclose (fle); return 0; } splint-3.1.2.dfsg1/test/metastate/file5.c0000644021234200000250000000135007320411743015561 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); static void checkClosed (/*@closed@*/ /*@null@*/ FILE *); void passOpen (/*@open@*/ FILE *f) /*@ensures closed f@*/ { (void) fputc (3, f); } /* error: ensures not satisfied, didn't close */ /*@dependent@*/ FILE *returnOpen (char *s) /*@ensures open result@*/ { FILE *fle = fopen (s, "r"); assert (fle != NULL); (void) fclose (fle); return fle; /* error: ensures not satisfied */ } int main (void) { FILE *fle = NULL; char s[10]; checkClosed (fle); /* okay */ checkOpen (fle); /* error */ fle = fopen ("test", "r"); if (fle == NULL) { return 0; } passOpen (fle); (void) fclose (fle); /* error: already closed */ return 0; } splint-3.1.2.dfsg1/test/metastate/file6.c0000644021234200000250000000113407320411743015562 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); static void checkClosed (/*@closed@*/ /*@null@*/ FILE *); /*@open@*/ /*@dependent@*/ FILE *newOpen (char *s) { FILE *res; res = fopen (s, "r"); assert (res != NULL); return res; /* okay: return open as open */ } /*@open@*/ /*@dependent@*/ FILE *newOpenBad (char *s) { FILE *res; res = fopen (s, "r"); assert (res != NULL); (void) fclose (res); return res; /* error: return closed as open */ } int main (void) { FILE *fle; fle = newOpen ("test"); checkOpen (fle); /* okay */ return 0; /* error: fle not closed */ } splint-3.1.2.dfsg1/test/metastate/file7.c0000644021234200000250000000015507320411743015565 0ustar faxvoid *msg; int f (void *p) { return 3; } int g () { msg = malloc (sizeof (*msg)); return f (msg); } splint-3.1.2.dfsg1/test/metastate/filebad.c0000644021234200000250000000022007327162471016146 0ustar faxextern /*@open@*/ int badOpen (/*@closed@*/ FILE *p_f); extern int badEnsures (FILE *p_f, /*@closed@*/ int p_x) /*@ensures open p_x;@*/ ; splint-3.1.2.dfsg1/test/metastate/global.c0000644021234200000250000000012607320411743016015 0ustar fax# include "global.h" void pmsg (char *msg) { fprintf (g_msgstream, "%s\n", msg); } splint-3.1.2.dfsg1/test/metastate/nullbranch.c0000644021234200000250000000104607320411744016710 0ustar faxvoid ftest (char *fname) { FILE *f; f = fopen (fname, "w"); if (f == NULL) { ; } else { fprintf (f, "okay\n"); (void) fclose (f); } } void ftest2 (char *fname) { FILE *f; f = fopen (fname, "w"); if (f != NULL) { ; } else { (void) fclose (f); /* Possibly null */ } } /* Lost open reference */ void ftest3 (char *fname) { FILE *f; f = fopen (fname, "w"); if (f != NULL) { fprintf (f, "okay\n"); (void) fclose (f); } else { } } splint-3.1.2.dfsg1/test/metastate/nullbranch2.c0000644021234200000250000000024507320411744016772 0ustar faxvoid ftest (char *fname) { char *s; s = malloc (sizeof (*s) * 20); if (s == NULL) { ; } else { *s = '4'; free (s); } } splint-3.1.2.dfsg1/test/metastate/nullret.c0000644021234200000250000000067207320411744016251 0ustar faxvoid *direalloc (/*@out@*/ /*@null@*/ void *x, size_t size, char *name, int line) { void *ret; if (x == NULL) { ret = (void *) dmalloc (size); } else { ret = (void *) realloc (x, size); } if (ret == NULL) { llfatalerrorLoc (message ("Out of memory. Allocating %w bytes at %s:%d.", size_toLongUnsigned (size), cstring_fromChars (name), line)); } return ret; } splint-3.1.2.dfsg1/test/metastate/osd.c0000644021234200000250000000030307650577034015353 0ustar faxvoid check (int b); int osd_fileIsReadable (char *f) { FILE *fl = fopen (f, "r"); if (fl != NULL) { fclose (fl); return true; } else { return false; } } splint-3.1.2.dfsg1/test/metastate/sockets.c0000644021234200000250000000215307320411744016233 0ustar faxextern void sockets_initialize (void) /*@requires sockets_uninitialized@*/ /*@ensures sockets_initialized@*/ ; extern void sockets_finalize (void) /*@requires sockets_initialized@*/ /*@ensures sockets_uninitialized@*/ ; extern void useSockets (void) /*@requires sockets_initialized@*/ ; void test1 (void) /*@requires sockets_uninitialized@*/ { useSockets (); /* error */ } void test2 (void) /*@requires sockets_initialized@*/ { useSockets (); /* okay */ } void test3 (void) /*@requires sockets_uninitialized@*/ { sockets_initialize (); useSockets (); /* okay */ } void test4 (void) /*@requires sockets_uninitialized@*/ /*@ensures sockets_uninitialized@*/ { sockets_initialize (); useSockets (); /* okay */ } /* error not finzalized */ void test5 (void) /*@requires sockets_uninitialized@*/ /*@ensures sockets_uninitialized@*/ { sockets_initialize (); sockets_finalize (); useSockets (); /* error */ } /* okay */ void test6 (void) { useSockets (); /* error (default is uninitialized) */ } void test7 (void) { sockets_initialize (); /* okay (default is uninitialized) */ } splint-3.1.2.dfsg1/test/metastate/sockets2.c0000644021234200000250000000110407320411745016311 0ustar faxextern void sockets_initialize (void) /*@requires sockets_uninitialized@*/ /*@ensures sockets_initialized@*/ ; extern void sockets_finalize (void) /*@requires sockets_initialized@*/ /*@ensures sockets_uninitialized@*/ ; extern void useSockets (void) /*@requires sockets_initialized@*/ ; void test1 (int x) /*@requires sockets_uninitialized@*/ { if (x > 3) { sockets_initialize (); } useSockets (); /* okay (error before) */ } void test2 (int x) /*@requires sockets_initialized@*/ { if (x > 3) { sockets_finalize (); } /* error */ } splint-3.1.2.dfsg1/test/metastate/struct.c0000644021234200000250000000030107325700315016075 0ustar faxtypedef struct { /*@only@*/ /*@open@*/ FILE *file; } *source; void source_badClose (source s) { // free (s->file); (void) fclose (s->file); } /* error - scope exits with file closed */ splint-3.1.2.dfsg1/test/metastate/test.c0000644021234200000250000000044207320411746015540 0ustar faxstatic void checkOpen (/*@open@*/ /*@null@*/ FILE *); static void checkClosed (/*@closed@*/ /*@null@*/ FILE *); int main (void) { FILE *fle = NULL; fle = fopen ("test", "r"); checkOpen (fle); /* okay */ checkClosed (fle); /* error */ return 0; /* error: f is not closed */ } splint-3.1.2.dfsg1/test/metastate/voidptr.c0000644021234200000250000000037607320411746016256 0ustar faxvoid *direalloc (/*@out@*/ /*@null@*/ void *x, size_t size, char *name, int line) { void *ret; if (x == NULL) { ret = (void *) malloc (size); } else { ret = (void *) realloc (x, size); } return ret; } splint-3.1.2.dfsg1/test/metastate/global.h0000644021234200000250000000005107320411743016017 0ustar fax/*@only@*/ /*@open@*/ FILE *g_msgstream; splint-3.1.2.dfsg1/test/metastate/Makefile0000644021234200000250000000132707413453501016056 0ustar fax.PHONY: tainted file SPLINT = splint all: file sockets struct nullbranch osd file: ${SPLINT} -mts file file1.c -expect 4 ${SPLINT} -mts file file2.c -varuse -fcnuse -expect 2 ${SPLINT} -mts file file3.c -varuse -fcnuse -expect 2 ${SPLINT} -mts file file4.c -varuse -fcnuse -exportlocal -expect 1 ${SPLINT} -mts file file5.c -varuse -fcnuse -exportlocal -expect 4 ${SPLINT} -mts file file6.c -varuse -fcnuse -exportlocal -expect 2 ${SPLINT} -mts file filebad.c -expect 3 sockets: ${SPLINT} sockets.mts sockets.c -expect 3 ${SPLINT} sockets.mts sockets2.c -expect 2 struct: ${SPLINT} -mts file struct.c -expect 1 nullbranch: ${SPLINT} -mts file nullbranch.c -expect 2 osd: ${SPLINT} -mts file osd.c -expect 2 splint-3.1.2.dfsg1/test/metastate/file.mts0000644021234200000250000000105507325160577016072 0ustar faxattribute file context reference FILE * oneof unopen, open annotations open reference ==> open closed reference ==> unopen merge open + unopen ==> error "files merge in inconsistent state" unopen + open ==> error "files merge in inconsistent state" transfers open as unopen ==> error "open file passed as unopen" unopen as open ==> error "unopen file passed as open" losereference open ==> error "open file not closed" defaults reference ==> unopen parameter ==> open end splint-3.1.2.dfsg1/test/metastate/nullterminated.mts0000644021234200000250000000072607320411744020174 0ustar faxstate nullterminated context reference oneof notnullterminated, nullterminated annotations nullterminated reference ==> nullterminated notnullterminated reference ==> notnullterminated merge notnullterminated + * ==> notnullterminated transfers notnullterminated as nullterminated ==> error "Possibly unterminated storage used as nullterminated." defaults reference notnullterminated parameter nullterminated end splint-3.1.2.dfsg1/test/metastate/sockets.mts0000644021234200000250000000163407325160577016631 0ustar fax/* ** A global attribute is not assosicated with a reference, but rather the ** global state of an execution. ** ** Annotations are used in pre and post conditions (requires/ensures ** clauses). ** */ global attribute sockets oneof uninitialized, initialized annotations sockets_initialized clause ==> initialized sockets_uninitialized clause ==> uninitialized preconditions initialized as uninitialized ==> error "Uninitialized sockets do not satisfy precondition." postconditions initialized as uninitialized ==> error "Sockets initialized, but postcondition requires uninitialized sockets." merge initialized + uninitialized ==> error "Sockets initialized on true branch, uninitialized on false branch." uninitialized + initialized ==> error "Sockets uninitialized on false branch, initialized on true branch." default uninitialized end splint-3.1.2.dfsg1/test/metastate/file.xh0000644021234200000250000000063007320411742015670 0ustar faxextern int fclose (/*@open@*/ FILE *stream) /*@ensures closed stream@*/ ; extern /*@open@*/ FILE *fopen (char *filename, char *mode) ; extern /*@open@*/ FILE *freopen (char *filename, char *mode, /*@closed@*/ FILE *stream) /*@ensures open stream@*/ ; extern /*@null@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, /*@open@*/ FILE *stream) /*@modifies fileSystem, *s, *stream, errno@*/ ; splint-3.1.2.dfsg1/test/moreBufferTests/0000755021234200000250000000000010645776270015557 5ustar faxsplint-3.1.2.dfsg1/test/moreBufferTests/initialization.c0000644021234200000250000000017407321156403020737 0ustar faxvoid initialization (char *d) { char *e = d; { char g = e[22]; char *f = e; e[2] = 'd'; f[2] = 'l'; } } splint-3.1.2.dfsg1/test/moreBufferTests/simplifyTest.c0000644021234200000250000000021207321156403020375 0ustar faxvoid fooSub ( char *s, int i) { s[i] = 'd'; s[i - 2] = 'd'; } void fooAdd ( char *s, int i) { s[i] = 'd'; s[i + 2] = 'd'; } splint-3.1.2.dfsg1/test/moreBufferTests/strncatNotReallyGood.c0000644021234200000250000000032007327332714022031 0ustar fax void NotGoodfunc(char *str) { char buffer[256]; strncat(buffer, str, sizeof(buffer) - 1); return; } splint-3.1.2.dfsg1/test/moreBufferTests/strncatReallyGood.c0000644021234200000250000000137507357772421021371 0ustar faxchar SOME_STRING[1000] = "kdlsjfklds;fjkls;djflksdjflkdsjfklsdjfkl;sjfklsdjfkl;jsdflk;jsdl;fjsdlkfjsdklf;jds;lfjskdl;fjkls;dfjlkds;jfkl;sjdfk;ldsjklnvklsnbklsdnblkdlsjfklds;fjkls;djflksdjflkdsjfklsdjfkl;sjfklsdjfkl;jsdflk;jsdl;fjsdlkfjsdklf;jds;lfjskdl;fjkls;dfjlkds;jfkl;sjdfk;ldsjklnvklsnbklsdnblkdlsjfklds;fjkls;djflksdjflkdsjfklsdjfkl;sjfklsdjfkl;jsdflk;jsdl;fjsdlkfjsdklf;jds;lfjskdl;fjkls;dfjlkds;jfkl;sjdfk;ldsjklnvklsnbklsdnblkdlsjfklds;fjkls;djflksdjflkdsjfklsdjfkl;sjfklsdjfkl;jsdflk;jsdl;fjsdlkfjsdklf;jds;lfjskdl;fjkls;dfjlkds;jfkl;sjdfk;ldsjklnvklsnbklsdnbl"; void funcGood(char *str) { char buffer[256]; strncpy (buffer, SOME_STRING, 255); buffer[255] = '\0'; strncat(buffer, str, (sizeof(buffer) - (strlen(buffer) + 1 ) ) ); return; } splint-3.1.2.dfsg1/test/moreBufferTests/strrchr.c0000644021234200000250000000010207324633434017375 0ustar fax void bar (char * t) { char *tt; tt = strrchr (t, '\n'); } splint-3.1.2.dfsg1/test/moreBufferTests/unrecogCall.c0000644021234200000250000000006407320411752020144 0ustar faxvoid foo () { char *d; d = "df"; bar(d); } splint-3.1.2.dfsg1/test/moreBufferTests/Makefile0000644021234200000250000000026607416003537017212 0ustar fax.PHONY: check SPLINT = splint check: $(SPLINT) -exportlocal +bounds unrecogCall.c strrchr.c initialization.c simplifyTest.c strncatNotReallyGood.c strncatReallyGood.c -expect 8 splint-3.1.2.dfsg1/test/moreBufferTests2/0000755021234200000250000000000010654216730015627 5ustar faxsplint-3.1.2.dfsg1/test/moreBufferTests2/unknownsize.c0000644021234200000250000000030707414723231020364 0ustar fax /*@constant int bSIZE@*/ void uknSize1() { char b[bSIZE]; char c[bSIZE]; c[9] = 'l'; /* error */ b[sizeof b - 1] = 'd'; } void unkSize2() { char b[bSIZE]; b[sizeof b - 1] = 'd'; } splint-3.1.2.dfsg1/test/moreBufferTests2/arrayConstExpr.c0000644021234200000250000000026307401260043020750 0ustar fax /*@constant int MYSIZE=10@*/ void arrayExpr() { char string1[2 + 4]; char string2 [MYSIZE + 1]; string1[5] = 'd'; string2[MYSIZE - 1] = 'w'; string2[MYSIZE] = 'w'; } splint-3.1.2.dfsg1/test/moreBufferTests2/Makefile0000644021234200000250000000034407765024014017271 0ustar fax.PHONY: check #SPLINT = splint check: $(SPLINT) -exportlocal +bounds unknownsize.c arrayConstExpr.c -expect 1 $(SPLINT) -exportlocal +bounds fixedArrayType.c -expect 1 $(SPLINT) -exportlocal +bounds initBlock.c -expect 1 splint-3.1.2.dfsg1/test/moreBufferTests2/fixedArrayType.c0000644021234200000250000000020407435617313020734 0ustar fax#include typedef int Array[10]; int fixedArrayTouch() { Array buffer; buffer[ sizeof(Array)-1] = 1; return 0; } splint-3.1.2.dfsg1/test/moreBufferTests2/initBlock.c0000644021234200000250000000022010654216730017703 0ustar fax int main(void) { int buf[]={0,0,0,0,0,0,0,0,0,0}; int buf1[]={0,0,0,0,0,0,0,0,0,0}; buf[10] = 0; buf1[9] = 0; return 0; } splint-3.1.2.dfsg1/test/nullterminatedtest/0000755021234200000250000000000010645776260016366 5ustar faxsplint-3.1.2.dfsg1/test/nullterminatedtest/buggy1.c0000644021234200000250000005674507124334245017740 0ustar fax/* * Name: * StarZ * Purpose: * File Browser/Getter for World Wide Web Browsers. * Language: * C * Description: * This is a Common Gateway Interface program which when accessed * with an HTTP GET as SCRIPT_URL (see #defines below) will return * a directory listing of files available on the host machine. * * The directory listing is in the shape of an HTML form with a * "checkbox" button for each directory entry. The size of each file * or an indication that it is a directory are given. * * A button for "mode select" is also given. * * The default mode is File Browse. * A selected file is displayed, or a selected directory generates a * new HTML form for that directory. * * The other mode is File Get. * Selected files and/or directories are put in a tar archive and * compressed back to the Web browser program. * Authors: * MJC: Martin Clayton (Starlink) * {enter_new_authors_here} * History: * 14-DEC-1994 (MJC): * Original Version. * 30-DEC-1994 (MJC): * Added a direct "change directory to" text entry field. * Changed note relating to Netscape to reflect change in Company name. * 12-APR-1995 (MJC): * Limited access to directories under /star tree. * {enter_further_changes_here} * Problems: * Nothing checks that a file for browse is a text file. * Default file protections are used, so a remote user can access * any unprotected files on the system hosting this program. * Some large HTML forms are slowly processed by the common * Web browser Mosaic, this is best overcome by using a more advanced * browser such as Netscape Communications' Netscape but remains a general * problem. * The code may well be OSF/1 specific. * {note_further_problems_here} * Bugs: * {note_any_bugs_here} *- */ /*Standard Include files: */ #include #include #include #include #include #include #include /*Local Macros. */ #define MAX_ENTRIES (10240) /* Maximum number of lines in cgi request. */ #define LIST_ENTRIES (10240) /* Maximum number of files in a Get request. */ #define TEXT_BUFSIZE (1024) /* Internal buffer size. */ #define ENT_WID (64) /* Maximum length of a file name. */ #define MODE_FLAG "spoingmode" /*Internal flag for Browse/Get mode. */ #define DEFAULT_DIR "/star" /* First directory to be listed. */ /*Where the program will be placed. */ #define SCRIPT_URL "http://www.star.ucl.ac.uk/mjc-cgi/S.tar.Z" /*Maintenance details. */ #define AUTHOR_NAME "Martin Clayton" #define AUTHOR_URL "mjc@starlink.ucl.ac.uk" /*Structure to hold a cgi request list entry. */ typedef struct { char *name; char *val; } entry; /*Function prototypes, local. */ void html_file( char *a, char *b, int nf ); void html_directory( char *a, int nf ); void dir_dot_parse( char *s, char *d ); void tar_zed( entry *e, int m ); /* *Function prototypes, external. */ char *makeword( char *line, char stop ); char *fmakeword( FILE *f, char stop, int *len ); void unescape_url( char *url ); void plustospace (char *str ); /* *Function prototyping for lclint checking */ /*@nullterminated@*/char *getenv(/*@nullterminated@*/char *); int atoi(/*@nullterminated@*/char *); /*@nullterminated@*/char *strcpy(char *, /*@nullterminated@*/char *); int strcmp(/*@nullterminated@*/ const char *s1, /*@nullterminated@*/ const char *s2); /*@nullterminated@*/char *strcat(/*@nullterminated@*/char *dst, /*@nullterminated@*/const char *src); int stat(/*@nullterminated@*/const char *path, struct stat *buf); int strncmp(const char *s1, const char *s2, size_t n); DIR *opendir(/*@nullterminated@*/const char *dirname); char *strncpy(char *dst, const char *src, size_t n); void qsort(void *base, size_t nel, size_t width, int (*compar) (const void *, const void *)); struct tm *localtime(const time_t *clock); void *memcpy(void *s1, const void *s2, size_t n); int sprintf(char *s, /*@nullterminated@*/const char *format, /* args */ ...); int system(const char *string); /*****************************************************************************/ main() { /* * Local Variables: */ entry entries[MAX_ENTRIES]; int x; int m; /*number of lines in request*/ int cl; char wdir[TEXT_BUFSIZE]; /*@nullterminated@*/ char adir[TEXT_BUFSIZE]; struct stat statbuf; /*. */ /*No request given. */ if ( !getenv( "CONTENT_LENGTH" ) ) { m = -1; /*Move request lines into "entry" array. */ } else { cl = atoi( getenv( "CONTENT_LENGTH" ) ); m = 0; for ( x = 0; cl && ( !feof( stdin ) ); x++ ) { m = x; entries[x].val = fmakeword( stdin, '&', &cl ); plustospace( entries[x].val ); unescape_url( entries[x].val ); entries[x].name = makeword( entries[x].val, '=' ); } } /*No request made. Initial inquiry from remote machine. */ if ( ( m == -1 ) || ( !entries[0].name ) ) { html_directory( "", 0 ); /*Decode the request. */ } else { /* Request for compressed archive data. */ if ( !strcmp( entries[0].name, MODE_FLAG ) ) { tar_zed( &entries[1], m - 1 ); /* Browse request. */ } else if ( !strcmp( entries[0].name, "Explicit" ) ) { /* Check for explicit directory or file name. */ if ( strcmp( entries[0].val, "" ) ) { strcpy( adir, entries[0].val ); } else if ( m > 0 ) { /* Build required file name, first directory part. */ strcpy( adir, entries[1].val ); /* Add in a / if not root directory. */ if ( strcmp( adir, "/" ) ) { strcat( adir, "/" ); } /* Append the actual file name. */ strcat( adir, entries[1].name ); } else { strcpy( adir, DEFAULT_DIR ); } /* Modify the file name if it is . or .. */ dir_dot_parse( adir, wdir ); /* Get file information. */ stat( wdir, &statbuf ); /* Build a directory listing. */ if ( statbuf.st_mode & S_IFDIR) { html_directory( wdir, m - 1 ); /* Display a file's contents. */ } else { html_file( wdir, entries[1].name, m - 1 ); } } } /*Done. */ exit ( EXIT_SUCCESS ); } /*****************************************************************************/ void html_directory( /*+ * Name: * html_directory * Purpose: * Build directory listing in HTML. * Language: * C * Invocation: * html_directory( dirname, nf ) * Arguments: * dirname = char * (Given) * Pointer to name of the directory to be listed. * nf = int (Given) * Total number of files in request. * Authors: * MJC: Martin Clayton (Starlink) * {enter_new_authors_here} * History: * 14-DEC-1994 (MJC): * Original Version. * 20-DEC-1994 (MJC): * Added support for file last modification time to be displayed. * 21-DEC-1994 (MJC): * Removed spurious

from second control button pair. * 21-JAN-1995 (MJC): * Added gopher images to directory listings. * 12-APR-1995 (MJC): * Limited access to directories under /star tree. * {enter_further_changes_here} * Bugs: * {note_any_bugs_here} *- * Arguments Given: */ char *dirname, /* Name of directory to be displayed. */ int nf /* Number of files in request. */ ) { /* * Local Variables: */ DIR *the_directory; struct dirent *the_file; struct stat statbuf; struct tm ttime; char tbuf[128]; char full_path[TEXT_BUFSIZE]; char adir[TEXT_BUFSIZE]; char ent_tab[LIST_ENTRIES][ENT_WID]; int entries; int notvalid = 0; int i; /*. */ /*When not an empty string, use supplied file name. */ if ( *dirname != '\0' ) { strcpy( full_path, dirname ); /*Otherwise set to default directory. */ } else { strcpy( full_path, DEFAULT_DIR ); } /*Make sure request is in /star tree, if not go to default directory. */ if ( strncmp( full_path, DEFAULT_DIR, 5 ) ) { notvalid = 1; strcpy( full_path, DEFAULT_DIR ); } /*Try to open the directory. */ the_directory = opendir( full_path ); /*Start response output. */ www_begin( T_HTML ); /*HTML title. */ www_head( "StarZ: File browser-getter." ); hline( "" ); /*Heading. */ hrule( ); hheading( "StarZ: File browser-getter", 1 ); hrule( ); /*Print error message if unable to open directory. */ if ( !the_directory ) { printf( "Could not open %s directory.%c", full_path, NEW_LINE ); /*Otherwise start to build listing. */ } else { /* Currently, only one directory can be selected for listing. * The first chosen is displayed, others are ignored except that * the following message is displayed. */ if ( nf > 0 ) { printf( "Only first entry in list will be displayed.%c", NEW_LINE ); } /* Print warning that request is not in /star tree. */ if ( notvalid ) { printf( "Your request has been denied, default %s directory selected instead.%c", DEFAULT_DIR, NEW_LINE ); } /* Start HTML FORM. * URL of where script will reside. */ printf( "

%c", SCRIPT_URL, NEW_LINE ); /* Submit and reset buttons. These are duplicated later. */ printf( "%c", NEW_LINE ); printf( "

%c", NEW_LINE ); /* Browse or Get mode-select button. */ printf( " Get or Browse (default) mode
%c", full_path, NEW_LINE); /* Text input field for entry of explicit file or directory name. */ printf( " Change Directory
%c", NEW_LINE ); /* List heading. */ printf( "

Directory of %s

%c", full_path, NEW_LINE ); /* Build directory listing. */ entries = 0; while ( ( the_file = readdir( the_directory ) ) && ( entries < LIST_ENTRIES ) ) { /* Don't include . and .. in list for sort. */ if ( !strcmp( the_file->d_name, "." ) ) { continue; } else if ( !strcmp( the_file->d_name, ".." ) ) { continue; /* Other file names added to list. */ } else { strncpy( ent_tab[entries], the_file->d_name, ENT_WID ); ent_tab[entries][ENT_WID - 1] = '\0'; entries++; } } /* Close the directory. */ closedir( the_directory ); /* Sort the directory list. */ qsort( (void *)(ent_tab), entries + 1, ENT_WID, strcmp ); /* Start output of the listing. */ printf( "
%c", NEW_LINE );

/*    Current directory button.
 */
        printf( "",
                full_path);
        printf( " <-current directory->%c", NEW_LINE );

/*    Parent directory button.
 */
        if ( strcmp( full_path, "/" ) ) {
            printf( "",
                    full_path);
            printf( " <-parent directory%c", NEW_LINE );
        }

/*    Files themselves.
 */
        for ( i = 1; i <= entries; i++ ) {

/*       Start with button.
 */
           printf( "",
                   ent_tab[i], full_path );

/*       Get file information.
 */
           strcpy( adir, full_path );
           if ( strcmp( adir, "/" ) ) {
               strcat( adir, "/" );
           }
           strcat( adir, ent_tab[i] );
           stat( adir, &statbuf );

/*       Mark as a directory if that is the case.
 */
           if ( statbuf.st_mode & S_IFDIR) {
               printf( " " );
               printf( " %-32s", ent_tab[i] );
               printf( "%9s", "directory" );

/*       Otherwise print the size of the file.
 */
           } else {
               if ( extension( ent_tab[i], "html" ) ) {
                   printf( " " );

               } else {
                   printf( " " );
               }
               printf( " %-32s", ent_tab[i] );
               printf( "%9d", (int)( statbuf.st_size ) );
           }

/*       Last modification date/time information.
 */
           (void)(memcpy( &ttime, localtime(&statbuf.st_mtime),
                          sizeof(struct tm)) );
           (void)(strncpy( tbuf, asctime( &ttime ), 26 ) );
           *( tbuf + 24 ) = '\0';
           printf( "  %s%c", tbuf, NEW_LINE );

        }

/*    End of the directory listing.
 */
        printf( "
%c", NEW_LINE ); /* Output a second set of control buttons. */ printf( "%c", NEW_LINE ); printf( "%c", NEW_LINE ); /* End of form. */ printf( "
%c", NEW_LINE ); } /*End main part of response */ hrule( ); /*HTML Address field. */ www_address( AUTHOR_NAME, AUTHOR_URL, NULL ); /*End response. */ hline( "" ); www_end( ); /*Done. */ return; } /*****************************************************************************/ void dir_dot_parse( /*+ * Name: * dir_dot_parse * Purpose: * Finds simplest version of a file specifier with . or .. at end. * Language: * C * Invocation: * dir_dot_parse( indir, outdir ) * Arguments: * indir = char * (Given) * Pointer to the file specification to be checked. * outdir = char * (Given and Returned) * Pointer to space for parsed specification, must be big enough * to hold converted file name. * Authors: * MJC: Martin Clayton (Starlink) * {enter_new_authors_here} * History: * 14-DEC-1994 (MJC): * Original Version. * {enter_further_changes_here} * Bugs: * {note_any_bugs_here} *- * Arguments Given: */ char *indir, char *outdir ) { /* * Local Variables: */ char *cptr; char *eptr; /*. */ /*Mark default return value as a blank string. */ strcpy( outdir, "" ); if ( !strcmp( indir, "" ) ) { return; } /*Find the end of the supplied string. */ cptr = indir; while ( *cptr ) { cptr++; } eptr = cptr; /*Point to last non-null character in string. */ if ( cptr > indir ) { cptr--; } else { return; } /*Does string end in a '.'? */ if ( *cptr == '.' ) { cptr--; /* Current directory, remove /. part of file name. */ if ( *cptr == '/' ) { *cptr++ = '\0'; *cptr = '\0'; } else if ( *cptr == '.' ) { cptr--; /* Parent directory, remove /.. part of file name and * name of the current directory, unless the current * directory is root, in which case just remove the .. */ if ( *cptr == '/' ) { while ( cptr > indir ) { cptr--; if ( *cptr == '/' ) { break; } } if ( cptr > indir) { while ( cptr < eptr ) { *cptr++ = '\0'; } } else { *(indir + 1) = '\0'; } } } } /*Copy the parsed file specifier to output buffer. */ strcpy ( outdir, indir ); /*Done. */ return; } /*****************************************************************************/ void html_file( /*+ * Name: * html_file * Purpose: * Display a text file in an HTML 'wrapper'. * Language: * C * Invocation: * html_file( fname, sname, nf ) * Arguments: * fname = char * (Given) * Pointer to full path of the file to be displayed. * sname = char * (Given) * Pointer to name of the file only. * nf = int (Given) * Total number of files in request. * Authors: * MJC: Martin Clayton (Starlink) * {enter_new_authors_here} * History: * 14-DEC-1994 (MJC): * Original Version. * 21-DEC-1994 (MJC): * Added missing . * {enter_further_changes_here} * Bugs: * {note_any_bugs_here} *- * Arguments Given: */ char *fname, /* Full path of file. */ char *sname, /* Name only of file. */ int nf /* Total number of files in request. */ ) { /* * Local Variables: */ char thecommand[4 * TEXT_BUFSIZE]; char title[1024]; /* Workspace for page title. */ /*. */ /*It's a gif wrap in simple HTML page. */ if ( extension( fname, "gif" ) ) { /* Start response. */ www_begin( T_HTML ); sprintf( title, "StarZ: %s", sname ); www_head( title ); hline( "" ); /*Pointer to image. */ printf( "

%c", fname, NEW_LINE ); /* Attach an address field. */ www_address( AUTHOR_NAME, AUTHOR_URL, NULL ); /* End response. */ hline( "" ); www_end( ); /*If the file appears NOT to be an HTML file, then wrap it in *some appropriate HTML. */ } else if ( !extension( fname, "html" ) ) { /* Start response. */ www_begin( T_HTML ); sprintf( title, "StarZ: %s", sname ); www_head( title ); hline( "" ); /* Only the first file of a multiple-file display request is piped back. */ if ( nf > 0 ) { hline( "Only first entry in list will be displayed." ); } /* Wrap the file in preformatted HTML style. */ hline( "

" );

/*    Flush stdout prior to calling cat to display file.
 */
        fflush( stdout );

/*    Build command line to display the file.
 */
        sprintf( thecommand, "cat %s\0x00", fname );

/*    Pipe out file.
 */
        if ( system ( thecommand ) ) {
            printf( "Could not access file %s%c", fname, NEW_LINE );
        }

/*    End of wrap.
 */
        hline( "
" ); /* Attach an address field. */ www_address( AUTHOR_NAME, AUTHOR_URL, NULL ); /* End response. */ hline( "" ); www_end( ); /*Other case is a file we expect to be in HTML format. */ } else if ( extension( fname, "html" ) ) { /* Start response. */ printf( "Content-type: text/html%c%c", NEW_LINE, NEW_LINE ); /* Only the first file of a multiple-file display request is piped back. */ if ( nf > 0 ) { printf( "Only first entry in list will be displayed.%c", NEW_LINE ); } /* Flush stdout prior to calling cat */ fflush( stdout ); /* Pipe out HTML file. */ sprintf( thecommand, "cat %s\0x00", fname ); if ( system ( thecommand ) ) { printf( "Could not access file %s%c", fname, NEW_LINE ); } } /*Done. */ return; } /*****************************************************************************/ int extension( /*+ * Name: * extension * Purpose: * Compare the last part of a file specifier with a supplied extension. * Language: * C * Invocation: * extension( fname, fext ) * Arguments: * fname = char * (Given) * Pointer to name of the file to be checked. * fext = char * (Given) * Pointer to the extension to be tested for. * Returned: * Returns the result of a strcmp( ) call comparing the relevant * part of the supplied text with the supplied extension. * Authors: * MJC: Martin Clayton (Starlink) * {enter_new_authors_here} * History: * 14-DEC-1994 (MJC): * Original Version. * {enter_further_changes_here} * Bugs: * {note_any_bugs_here} *- * Arguments Given: */ char *fname, /* The file specification. */ char *fext /* A file extension, without ".". */ ) { /* * Local Variables: */ char *cptr; /*. */ /*Find end of file name. */ cptr = fname; while ( *cptr ) { cptr++; } if ( cptr > fname ) { cptr--; } /*Find last . in file name and point to character after it. */ while ( ( *cptr != '.' ) && ( cptr > fname ) ) { cptr--; } if ( cptr > fname ) { cptr++; } /*Compare supplied extension with part of file name. */ return ( !strcmp( cptr, fext) ); } /*****************************************************************************/ void tar_zed( /*+ * Name: * tar_zed * Purpose: * Pipe a compressed tar archive of the requested files to stdout. * Language: * C * Invocation: * tar_zed( ent, n ) * Arguments: * ent = entry * (Given) * Pointer to first item in a list of "entry" structures. * n = int (Given) * Total number of items in list. * Authors: * MJC: Martin Clayton (Starlink) * {enter_new_authors_here} * History: * 14-DEC-1994 (MJC): * Original Version. * {enter_further_changes_here} * Bugs: * {note_any_bugs_here} *- * Arguments Given: */ entry *ent, /* Pointer to start of list. */ int n /* Number of items in list. */ ) { /* * Local Variables: */ char request_text[65536]; /* Buffer for command line. */ int i; /* Loop index. */ /*. */ /*A null request was received, return message. */ if ( n < 1 ) { printf( "Content-type: text/html%c%c", NEW_LINE, NEW_LINE ); printf( "Compressed tar file down-load request detected.

%c", NEW_LINE ); printf( "Your request was empty!%c", NEW_LINE ); /*Otherwise build command line to compress tar file to stdout. */ } else { /* ent[].val is the same foe all entries, the base directory for * the archive build. Mark a "change directory" command for this. */ strcpy( request_text, "cd " ); strcat( request_text, ent[1].val ); /* Add tar command with flags for pipe to stdout and follow soft links. */ strcat( request_text, " ; tar -cfh - " ); /* Now add all the list entries. */ for ( i = 1; i <= n; i++ ) { strcat( request_text, ent[i].name ); strcat( request_text, " " ); } /* Finally, the pipe to compress with flag to send output to stdout. */ strcat( request_text, " | compress -c" ); /* Start transfer. */ printf( "Content-Encoding: x-compress%c%c", NEW_LINE, NEW_LINE ); /* Flush output. */ fflush ( stdout ); /* Execute compress archive command line. */ if ( system( request_text ) ) { printf( "Content-type: text/html%c%c", NEW_LINE, NEW_LINE ); printf( "Transfer failed.

%c", NEW_LINE ); } } /*Done. */ return; } /*End-of-file. */ splint-3.1.2.dfsg1/test/nullterminatedtest/buggy_support1.c0000644021234200000250000000542407124334246021521 0ustar fax#include #define LF 10 #define CR 13 void getword(char *word, char *line, char stop) { int x = 0,y; for(x=0;((line[x]) && (line[x] != stop));x++) word[x] = line[x]; word[x] = '\0'; if(line[x]) ++x; y=0; while(line[y++] = line[x++]); } char *makeword(char *line, char stop) { int x = 0,y; char *word = (char *) malloc(sizeof(char) * (strlen(line) + 1)); for(x=0;((line[x]) && (line[x] != stop));x++) word[x] = line[x]; word[x] = '\0'; if(line[x]) ++x; y=0; while(line[y++] = line[x++]); return word; } char *fmakeword(FILE *f, char stop, int *cl) { int wsize; char *word; int ll; wsize = 102400; ll=0; word = (char *) malloc(sizeof(char) * (wsize + 1)); while(1) { word[ll] = (char)fgetc(f); if(ll==wsize) { wsize+=102400; word = (char *)realloc(word,sizeof(char)*(wsize+1)); } --(*cl); if((word[ll] == stop) || (feof(f)) || (!(*cl))) { if(word[ll] != stop) ll++; word[ll] = '\0'; return word; } ++ll; } } char x2c(char *what) { register char digit; digit = (what[0] >= 'A' ? ((what[0] & 0xdf) - 'A')+10 : (what[0] - '0')); digit *= 16; digit += (what[1] >= 'A' ? ((what[1] & 0xdf) - 'A')+10 : (what[1] - '0')); return(digit); } void unescape_url(char *url) { register int x,y; for(x=0,y=0;url[y];++x,++y) { if((url[x] = url[y]) == '%') { url[x] = x2c(&url[y+1]); y+=2; } } url[x] = '\0'; } void plustospace(char *str) { register int x; for(x=0;str[x];x++) if(str[x] == '+') str[x] = ' '; } int rind(char *s, char c) { register int x; for(x=strlen(s) - 1;x != -1; x--) if(s[x] == c) return x; return -1; } int getline(char *s, int n, FILE *f) { register int i=0; while(1) { s[i] = (char)fgetc(f); if(s[i] == CR) s[i] = fgetc(f); if((s[i] == 0x4) || (s[i] == LF) || (i == (n-1))) { s[i] = '\0'; return (feof(f) ? 1 : 0); } ++i; } } void send_fd(FILE *f, FILE *fd) { int num_chars=0; char c; while (1) { c = fgetc(f); if(feof(f)) return; fputc(c,fd); } } int ind(char *s, char c) { register int x; for(x=0;s[x];x++) if(s[x] == c) return x; return -1; } void escape_shell_cmd(char *cmd) { register int x,y,l; l=strlen(cmd); for(x=0;cmd[x];x++) { if(ind("&;`'\"|*?~<>^()[]{}$\\",cmd[x]) != -1){ for(y=l+1;y>x;y--) cmd[y] = cmd[y-1]; l++; /* length has been increased */ cmd[x] = '\\'; x++; /* skip the character */ } } } splint-3.1.2.dfsg1/test/nullterminatedtest/buggy_support_fmakeword.c0000644021234200000250000000115707124334246023476 0ustar fax //lclint work arround /*@nullterminated@*/ char * strcpy (char * tmp1, /*@nullterminated@*/ char * tmp); /*@nullterminated@*/ char * LCLstrcpy (char * tmp1, /*@nullterminated@*/ char * tmp); #define strcpy LCLstrcpy /*@nullterminated@*/ char * NotdefinedLCLstrcpy (int * tmp1, /*@nullterminated@*/ char * tmp); // char *my_malloc(int); // /*@null@*/ /*@nullterminated@*/char *fmakeword() { // char *word; // // word = my_malloc(1); // word = "df"; // return word; //} /*@nullterminated@*/ char * test1 (char * p1) { // p1 = NotdefinedLCLstrcpy (p1, "bob"); p1 = LCLstrcpy (p1, "bob"); return p1; } splint-3.1.2.dfsg1/test/nullterminatedtest/test1.c0000644021234200000250000000025307124334246017562 0ustar fax#include void fcn1 (/*@nullterminated@*/ char *e); int main (){ /*@unused@*/ char c[]; char *d; c[0] = '\0'; fcn1(c); fcn1("hello"); fcn1(d); return 0; } splint-3.1.2.dfsg1/test/nullterminatedtest/test3.c0000644021234200000250000000070707124334247017571 0ustar fax#include //void free (char * bob); /*@nullterminated@*/ char * strcpy ( char * ch1, /*@nullterminated@*/ char * ch2); char * global; void test2 () { char * y; char * x; strcpy (y, x); strcpy (y, "bob"); x = "bob"; strcpy (y, x); strcpy (y, global); } /*@nullterminated@*/ char * tr ( char * e) { /*@nullterminated@*/ char * c; return (e); } int main () { /*@nullterminated@*/ char * d; d = tr(d); tr(d); free (d); return 0; } splint-3.1.2.dfsg1/test/simplebufferConstraintTests/0000755021234200000250000000000010645776270020213 5ustar faxsplint-3.1.2.dfsg1/test/simplebufferConstraintTests/m.c0000644021234200000250000000027707321242226020603 0ustar faxextern /*@null@*/ /*@out@*/ /*@only@*/ void *mymalloc (size_t size) /*@*/ /*@ensures MaxSet(result) == (size - 1) @*/ ; void t() { char *f; f = mymalloc (3); f[2] = '2'; free (f); } splint-3.1.2.dfsg1/test/simplebufferConstraintTests/sizeof.c0000644021234200000250000000067707321242226021652 0ustar fax extern void /*@alt char * @*/ mystrncpy (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2, size_t n) /*@modifies *s1@*/ /*@requires MaxSet(s1) >= ( n - 1) /\ MaxRead (s2) >= ( n - 1 ); @*/ /*@ensures MaxRead (s1) == MaxRead (s2) /\ MaxRead (s1) <= n; @*/; void f(char *z) /*@requires MaxRead(z) >= 2; @*/ { char x[3]; char y[3]; mystrncpy (x, z, 3); mystrncpy (y, z, 3); x[(sizeof x)] = 'i'; y[((sizeof y) - 1)] = '0'; } splint-3.1.2.dfsg1/test/simplebufferConstraintTests/test3.c0000644021234200000250000000030207247623661021413 0ustar fax void t() { char g [100]; char j [23]; j[22] = 'd'; /*safe */ g[0] = 'd'; /* safe */ g[67] = 'f;'; /* safe */ g[101] = 'g'; /* unsafe */ g[100] = 'f'; /* unsafe */ } splint-3.1.2.dfsg1/test/simplebufferConstraintTests/test7.c0000644021234200000250000000014607247623661021425 0ustar fax void t(char *g, char *j ) { g++; g++; g[2] = 'l'; g[0] = g[2]; j[0] = 'l'; j++; j++; } splint-3.1.2.dfsg1/test/simplebufferConstraintTests/Makefile0000644021234200000250000000016107416003537021640 0ustar fax.PHONY: check SPLINT = splint -exportlocal check: $(SPLINT) +bounds m.c sizeof.c test3.c test7.c -expect 7 splint-3.1.2.dfsg1/test/sizeoftest/0000755021234200000250000000000010645776260014636 5ustar faxsplint-3.1.2.dfsg1/test/sizeoftest/sizeof.c0000644021234200000250000000014107247560705016274 0ustar faxint main() { char x[3]; char y[3]; x[(sizeof x)] = 'i'; y[((sizeof y) - 1)] = '0'; return 0; } splint-3.1.2.dfsg1/test/sizeoftest/sizeofConst.c0000644021234200000250000000023507571770547017316 0ustar fax/*@null@*/ char * f() { char *buf = malloc(sizeof ("1234") ); if (buf == NULL) { return NULL; } strcpy(buf, "1234"); return buf; } splint-3.1.2.dfsg1/test/sizeoftest/Makefile0000644021234200000250000000015307600773421016266 0ustar fax.PHONY: check SPLINT = splint -exportlocal check: $(SPLINT) +bounds sizeof.c sizeofConst.c -expect 1 splint-3.1.2.dfsg1/test/strchr/0000755021234200000250000000000010645776270013745 5ustar faxsplint-3.1.2.dfsg1/test/strchr/.splintrc0000644021234200000250000000000107577744773015610 0ustar fax splint-3.1.2.dfsg1/test/strchr/strchr.c0000644021234200000250000000034007577744773015430 0ustar fax void func () { char *c; c = strchr("dfdfedfd", 'e'); *c = 'd'; /* modification of observer, possibly null */ } void fixline (char * line) { char *p; if ( (p = strchr(line, '\n')) ) { *p = '\0'; } } splint-3.1.2.dfsg1/test/strchr/Makefile0000644021234200000250000000013507416003537015373 0ustar fax.PHONY: check SPLINT = splint -exportlocal check: $(SPLINT) +bounds strchr.c -expect 2 splint-3.1.2.dfsg1/test/suppressfile/0000755021234200000250000000000010645776267015172 5ustar faxsplint-3.1.2.dfsg1/test/suppressfile/test.c0000644021234200000250000000004107320411757016272 0ustar fax# include "test.h" int x = 3.4; splint-3.1.2.dfsg1/test/suppressfile/test.h0000644021234200000250000000001507320411757016300 0ustar faxint x = 2.5; splint-3.1.2.dfsg1/test/tainted/0000755021234200000250000000000010645776271014071 5ustar faxsplint-3.1.2.dfsg1/test/tainted/sprintf.c0000644021234200000250000000070007330126003015672 0ustar faxchar *sp (/*@untainted@*/ char *s1, /*@untainted@*/ char *s2, /*@tainted@*/ char *s3) { char *s; s = (char *) malloc (sizeof (*s) * 100); assert (s != NULL); sprintf (s, "%s %d %s %d", s1, 3, s2, 3); (void) system (s); /* okay */ sprintf (s, "%s %d %s %d", s1, 3, s3, 3); (void) system (s); /* error */ sprintf (s, "%s %d %s %d %s %s %s", s1, 3, s2, 3, s2, s3, s2); (void) system (s); /* error */ return s; /* error */ } splint-3.1.2.dfsg1/test/tainted/t1.c0000644021234200000250000000015307327342254014551 0ustar faxextern char *mtainted (char *s); void test (/*@untainted@*/ char *s) { (void) system (mtainted (s)); } splint-3.1.2.dfsg1/test/tainted/tainted.c0000644021234200000250000000076007327342255015662 0ustar faxextern char *mtainted (char *s); /*@untainted@*/ char *f (/*@tainted@*/ char *s, /*@untainted@*/ char *us) { char *x = f (us, s); /* Error: tainted as untainted */ return f (x, us); } void test (/*@tainted@*/ char *s) { char *t = malloc (sizeof (char) * strlen (s)); (void) system (s); /* error */ assert (t != NULL); strcpy (t, s); /* t is tainted too */ (void) system (t); /* error */ t = mtainted (s); /* default return is tainted! */ (void) system (t); /* error */ } splint-3.1.2.dfsg1/test/tainted/tainted2.c0000644021234200000250000000061307327342255015741 0ustar fax# include /*@untainted@*/ char *test (int fromuser, /*@untainted@*/ char *def) { char *stk = NULL; if (fromuser != 0) { stk = malloc (sizeof (char) * strlen (def)); assert (stk != NULL); strcpy (stk, def); } else { stk = malloc (sizeof (char) * 128); assert (stk != NULL); (void) fgets (stk, 128, stdin); } return stk; } splint-3.1.2.dfsg1/test/tainted/tainted3.c0000644021234200000250000000031507327342255015741 0ustar faxextern void checkUntainted (/*@untainted@*/ char *s) ; extern void checkTainted (/*@tainted@*/ char *s) ; void test (/*@tainted@*/ char *def) { checkTainted (def); checkUntainted (def); /* error */ } splint-3.1.2.dfsg1/test/tainted/tainted4.c0000644021234200000250000000042207327342255015741 0ustar faxtypedef /*@untainted@*/ char *ucharp_t; extern void checkUntainted (ucharp_t *s) ; typedef /*@tainted@*/ char *tcharp_t; extern void checkTainted (tcharp_t *s) ; void test (/*@tainted@*/ char *def) { checkTainted (&def); /* okay */ checkUntainted (&def); /* error */ } splint-3.1.2.dfsg1/test/tainted/tainted5.c0000644021234200000250000000057507327342255015753 0ustar faxtypedef /*@untainted@*/ char *ucharp_t; extern void checkUntainted (ucharp_t *s) ; typedef /*@tainted@*/ char *tcharp_t; extern void checkTainted (tcharp_t *s) ; void test (/*@untainted@*/ char *def) { checkUntainted (&def); checkTainted (&def); /* okay (untainted as tainted) */ } void test2 (ucharp_t *def) { checkUntainted (def); checkTainted (def); /* okay */ } splint-3.1.2.dfsg1/test/tainted/taintedimplicit.c0000644021234200000250000000057107327342255017415 0ustar faxchar *taintme (char *s) /*@ensures result:taintedness = s:taintedness@*/ { char *res = (char *) malloc (sizeof (*res) * strlen (s)); assert (res != NULL); strcpy (res, s); return res; } void safecall (/*@untainted@*/ char *s) { (void) system (taintme (s)); /* okay */ } void dangerouscall (/*@tainted@*/ char *s) { (void) system (taintme (s)); /* error */ } splint-3.1.2.dfsg1/test/tainted/taintedmerge.c0000644021234200000250000000042407327342255016677 0ustar faxchar *f (/*@tainted@*/ char *s) { char t[50]; (void) system ("test"); strcpy (t, "test"); (void) system (t); strcat (t, s); (void) system (t); /* error */ strcpy (t, s); (void) system (t); /* error */ return t; /* error - tainted, stack-allocated */ } splint-3.1.2.dfsg1/test/tainted/taintedx.c0000644021234200000250000000077207327342255016055 0ustar faxextern void checkUntainted (char **s) /*@requires untainted *s@*/; extern void checkUntainted1 (char **s) /*@requires untainted *s@*/; extern void checkTainted (char **s) /*@requires tainted *s@*/; extern void checkTainted1 (char **s) /*@requires tainted *s@*/; void test2 (char **def) /*@requires untainted *def@*/ { checkUntainted (def); checkTainted (def); /* error */ } void test (char *def2) /*@requires untainted def2@*/ { checkUntainted1 (&def2); checkTainted1 (&def2); /* error */ } splint-3.1.2.dfsg1/test/tainted/test.c0000644021234200000250000000027007327342256015206 0ustar faxvoid test (/*@tainted@*/ char *s) { char *t = malloc (sizeof (char) * strlen (s)); assert (t != NULL); strcpy (t, s); /* t is tainted too */ (void) system (t); /* error */ } splint-3.1.2.dfsg1/test/tainted/Makefile0000644021234200000250000000134207512352624015520 0ustar fax.PHONY: tainted SPLINT = splint all: tainted tainted: -${SPLINT} -mts tainted tainted.c -mustfree -exportlocal -expect 4 -${SPLINT} tainted-bad.mts tainted.xh tainted.c -mustfree -exportlocal -expect 9 -${SPLINT} -mts tainted tainted2.c -mustfree -exportlocal -expect 1 -${SPLINT} -mts tainted tainted3.c -mustfree -exportlocal -expect 1 -${SPLINT} -mts tainted tainted4.c -mustfree -exportlocal -expect 1 -${SPLINT} -mts tainted tainted5.c -mustfree -exportlocal -${SPLINT} -mts tainted taintedmerge.c -mustfree -exportlocal -expect 3 -${SPLINT} -mts tainted taintedimplicit.c -mustfree -exportlocal -expect 1 -${SPLINT} -mts tainted sprintf.c -expect 5 # evans 2002-07-09: 3 more warnings for sprintf because of sprintf splint-3.1.2.dfsg1/test/tainted/tainted-bad.mts0000644021234200000250000000114307327342255016763 0ustar faxattribute taintedness context reference oneof untainted, tainted, untainted defaults reference ==> stainted parameter ==> tainted parameter ==> untainted annotations tainted reference ==> tainted untainted reference ==> untainted maybetainted reference ==> blue merge tainted + * ==> tainted tainted + junky ==> error "Splat!" transfers tainted as untainted ==> error "Possibly tainted storage used as untainted." tainted as tainted ==> tainted untainted as tainted ==> peach untainted as untainted ==> untainted end splint-3.1.2.dfsg1/test/tainted/tainted.mts0000644021234200000250000000111607327342255016237 0ustar faxattribute taintedness context reference char * oneof untainted, tainted annotations tainted reference ==> tainted untainted reference ==> untainted transfers tainted as untainted ==> error "Possibly tainted storage used as untainted." untainted as tainted ==> untainted merge tainted + untainted ==> tainted /*untainted + tainted ==> tainted */ defaults reference ==> untainted parameter ==> tainted result ==> tainted /* Different from lib/tainted.mts */ literal ==> untainted null ==> untainted end splint-3.1.2.dfsg1/test/tainted/tainted.xh0000644021234200000250000000222407330126003016035 0ustar fax/* ** tainted.xh */ /* Library functions annotated for tainted.mts */ extern int remove (/*@untainted@*/ char *filename) /*@modifies fileSystem, errno@*/ ; extern int rename (/*@untainted@*/ char *old, /*@untainted@*/ char *new) ; extern /*@observer@*/ char *tmpnam (/*@untainted@*/ char *s) ; extern FILE *fopen (/*@untainted@*/ char *filename, char *mode) ; extern int sprintf (/*@out@*/ char *s, /*@untainted@*/ char *format, ...) /*@ensures s:taintedness = ...:taintedness@*/ ; extern int printf (/*@untainted@*/ char *format, ...) ; extern /*@null@*/ FILE *freopen (/*@untainted@*/ char *filename, char *mode, FILE *stream) ; extern /*@null@*/ /*@tainted@*/ char * fgets (/*@returned@*/ /*@out@*/ char *s, int n, FILE *stream) /*@ensures tainted s@*/ /*@modifies *s@*/ ; extern int system (/*@untainted@*/ /*@null@*/ char *s) /*@modifies fileSystem@*/ ; extern char *strcpy (/*@returned@*/ char *s1, char *s2) /*@ensures s1:taintedness = s2:taintedness@*/ ; extern char *strcat (/*@returned@*/ char *s1, char *s2) /*@ensures s1:taintedness = s1:taintedness | s2:taintedness@*/ /*:ensures result:tainted = s1:tainted, s2:tainted)@*/ ; splint-3.1.2.dfsg1/test/tclauses/0000755021234200000250000000000010645776261014263 5ustar faxsplint-3.1.2.dfsg1/test/tclauses/globals.c0000644021234200000250000000052107320411762016034 0ustar faxextern int glob; /*@function int fg(void) globals glob;@*/ # define fg() (glob + 1) /*@function int fm(void) globals glob; modifies glob;@*/ # define fm() (glob++) int f (void) /*@globals undef glob@*/ ; int f (void) /*@globals undef glob@*/ { return glob; } # if 0 int f2 (void) /*@globals int glob;@*/ { return glob; } # endif splint-3.1.2.dfsg1/test/tclauses/gt.c0000644021234200000250000000011307320411762015020 0ustar faxextern int glob; int f (void) /*@globals undef glob@*/ { return glob; } splint-3.1.2.dfsg1/test/tclauses/modifies.c0000644021234200000250000000015307320411762016211 0ustar faxint f (int *x, int *y) /*@modifies *x;@*/ /*@modifies *y;@*/ { *x = 3; *y = 7; return 3; } splint-3.1.2.dfsg1/test/tclauses/struct.c0000644021234200000250000000006607320411763015742 0ustar fax/* struct st { int x; } ; */ typedef struct st st; splint-3.1.2.dfsg1/test/tclauses/undef.c0000644021234200000250000000043407320411763015516 0ustar faxextern int glob; extern /*@only@*/ int *ogp; int f (void) /*@globals undef glob, killed ogp;@*/ { free (ogp); return glob; } # if 0 static int sglob; static /*@only@*/ int *sogp; int f1 (void) /*@globals undef sglob, killed sogp;@*/ { free (sogp); return sglob; } # endif splint-3.1.2.dfsg1/test/temp/0000755021234200000250000000000010645776270013405 5ustar faxsplint-3.1.2.dfsg1/test/temp/Makefile0000644021234200000250000000006707362336474015050 0ustar faxall: gcc prg.c a.c b.c lint: lclint prg.c a.c b.c splint-3.1.2.dfsg1/test/tests2.2/0000755021234200000250000000000010645776270014024 5ustar faxsplint-3.1.2.dfsg1/test/tests2.2/bool.lcl0000644021234200000250000000002407121317335015433 0ustar faximmutable type bool;splint-3.1.2.dfsg1/test/tests2.2/arbints.c0000644021234200000250000000132107121317335015613 0ustar faxtypedef /*@integraltype@*/ a_int; typedef /*@unsignedintegraltype@*/ u_int; typedef /*@signedintegraltype@*/ s_int; int f (a_int a, u_int u, s_int s) { unsigned long ul; long l; printf ("the values are: %d %ld %ud", a, u, s); /* expect 3 errors */ ul = a; /* Assignment of a_int to unsigned long int: ul = a */ /*@+longunsignedintegral@*/ ul = a; /*@+longintegral@*/ ul = a; if (u == a) printf ("yo!"); /*@+matchanyintegral@*/ if (u == l) printf ("yo!"); if (u == a) printf ("yo!"); /*@=matchanyintegral@*/ /*@+longsignedintegral@*/ printf ("i'm okay: %ld", s); /*@+longunsignedunsignedintegral@*/ printf ("you're not! %ld", u); printf ("you're not! %ud", u); return a; } splint-3.1.2.dfsg1/test/tests2.2/arrayfcn.c0000644021234200000250000000010307121317335015753 0ustar faxchar *text (int i); int main (void) { printf ("%s", text[i]); } splint-3.1.2.dfsg1/test/tests2.2/booldef.c0000644021234200000250000000002407121317335015562 0ustar fax# include "mbool.h" splint-3.1.2.dfsg1/test/tests2.2/boolenum.c0000644021234200000250000000026107121317335015773 0ustar faxtypedef enum { FALSE = 0, TRUE = 1 } BOOLEAN; int main () { BOOLEAN a = TRUE; if (a == TRUE) { return 1; } else { return 0; } } splint-3.1.2.dfsg1/test/tests2.2/boolops.c0000644021234200000250000000053307650577035015646 0ustar fax/*@-booltype Kzam@*/ typedef int Kzam; enum { true, false } ; /* changed to be consistent with ISO true/false */ int main() { Kzam b = true; Kzam b1 = b; b = true; b = b1; b = 12; /* Assignment of int to Kzam: b = 12 */ b = true && false; b = b && false; b = false && b; if ((b && false) == 0) return(0); return(0); } splint-3.1.2.dfsg1/test/tests2.2/break.c0000644021234200000250000000017707121317335015245 0ustar faxint f (/*@null@*/ int *x) { while (3 > 4) { if (x == NULL) continue; *x = 3; } *x = 3; return 5; } splint-3.1.2.dfsg1/test/tests2.2/bstring.c0000644021234200000250000000016707121317335015630 0ustar faxchar *s1 = { "hullo" } ; char *s2 = "hullo"; char *s3 = { 'h', 'u', 'l', 'l', 'o' }; char *s4 = { "hullo", "g'bye" } ; splint-3.1.2.dfsg1/test/tests2.2/decl.c0000644021234200000250000000012007121317335015054 0ustar fax# include struct tm { int x; } int f (struct tm s) { return s.x; } splint-3.1.2.dfsg1/test/tests2.2/enumbool.c0000644021234200000250000000021707121317335015774 0ustar faxtypedef enum { false = 0, true } bool; bool f (bool b) { if (b) { return ( 3 > 4); } else { return false; } } splint-3.1.2.dfsg1/test/tests2.2/extension.c0000644021234200000250000000015307121317335016167 0ustar faxextern void __eprintf (const char *, const char *, unsigned, const char *) __attribute__ ((noreturn)); splint-3.1.2.dfsg1/test/tests2.2/libraries.c0000644021234200000250000000004607121317335016130 0ustar fax# include "sys/types.h" dev_t x = 3; splint-3.1.2.dfsg1/test/tests2.2/modarray.c0000644021234200000250000000030607121317335015771 0ustar faxint main (void) { char buffer[6]; (void) fgets (buffer, (int) sizeof (buffer), stdin); while (buffer[0] != 'x') { (void) fgets (buffer, (int) sizeof (buffer), stdin); } return 3; } splint-3.1.2.dfsg1/test/tests2.2/nestext.c0000644021234200000250000000007507121317335015650 0ustar faxint f (void) { extern int test (void); return test(); } splint-3.1.2.dfsg1/test/tests2.2/offsetof.c0000644021234200000250000000040707121317335015770 0ustar faxtypedef int U_type; static int x; void f3 (/*@null@*/ int *a1, int a2, int *a3, int a4); typedef struct { char sf3 ; } some_struct ; void f2 (int n_bytes) ; void f1 (void) { f2 ((int) offsetof (some_struct, sf3)); f3 (0, 0, (U_type *)&x, 0); } splint-3.1.2.dfsg1/test/tests2.2/posix.c0000644021234200000250000000015207121317335015314 0ustar fax/* ** Should include sys/types is a posix library is not used. */ # include dev_t x = 3; splint-3.1.2.dfsg1/test/tests2.2/realloc.c0000644021234200000250000000010607121317335015572 0ustar faxvoid f (/*@only@*/ char *s) { char *m = realloc (s); free (m); } splint-3.1.2.dfsg1/test/tests2.2/rex.c0000644021234200000250000000047507121317335014760 0ustar fax#include struct rx_hash { struct rx_hash *parent; struct rx_hash *children[13]; }; typedef struct rx_hash regex_t; void regcomp (/*@out@*/ regex_t *re); int main (int, char **) { regex_t re; regcomp (&re); return 2; } int f (void) { /*@-varuse@*/ regex_t re; /*@=varuse@*/ return 3; } splint-3.1.2.dfsg1/test/tests2.2/sizeofarray.c0000644021234200000250000000015307121317335016511 0ustar faxint f (int x[32]) { int a[23]; if (sizeof(x) == 3) { return 1; } return sizeof(a); } splint-3.1.2.dfsg1/test/tests2.2/struct.c0000644021234200000250000000034207121317335015477 0ustar faxextern double read_double (void); typedef struct { float a; } some_type; typedef struct { double a; } another_type; void main (void) { another_type f; double x; x = read_double (); f.a = read_double (); } splint-3.1.2.dfsg1/test/tests2.2/mbool.h0000644021234200000250000000002207121317335015263 0ustar fax# define bool int splint-3.1.2.dfsg1/test/tests2.2/Makefile0000644021234200000250000000177607650577035015477 0ustar fax.PHONY: boolops bool boolenum break bstring decl enumbool extension modarray nestext offestof sizeofarray rex struct SPLINT = splint all: boolops bool boolenum break bstring decl enumbool extension modarray nestext offestof sizeofarray rex struct boolops: -$(SPLINT) boolops.c -expect 1 bool: -$(SPLINT) bool.lcl booldef.c -expect 1 boolenum: -$(SPLINT) boolenum.c -booltype BOOLEAN -booltrue TRUE -boolfalse FALSE -expect 1 break: -$(SPLINT) break.c -expect 1 bstring: -$(SPLINT) bstring.c -expect 2 decl: -$(SPLINT) decl.c -expect 1 enumbool: -$(SPLINT) enumbool.c -booltrue true -boolfalse false -$(SPLINT) enumbool.c -booltrue TRUE -boolfalse FALSE -expect 2 extension: -$(SPLINT) extension.c -$(SPLINT) -gnuextensions extension.c modarray: -$(SPLINT) modarray.c nestext: -$(SPLINT) nestext.c -expect 1 offsetof: -$(SPLINT) offsetof.c sizeofarray: -$(SPLINT) sizeofarray.c -expect 3 rex: -$(SPLINT) rex.c -expect 4 ### 3 new errors reported struct: -$(SPLINT) struct.c -expect 1 splint-3.1.2.dfsg1/test/tests2.2/Makefile.os20000644021234200000250000000210507730061143016147 0ustar fax.PHONY: boolops bool boolenum break bstring decl enumbool extension modarray nestext offestof sizeofarray rex struct SPLINT = splint all: boolops bool boolenum break bstring decl enumbool extension modarray nestext offestof sizeofarray rex struct boolops: $(SPLINT) boolops.c -expect 1 bool: -$(SPLINT) bool.lcl booldef.c -expect 1 boolenum: $(SPLINT) boolenum.c -booltype BOOLEAN -booltrue TRUE -boolfalse FALSE -expect 1 break: $(SPLINT) break.c -expect 1 bstring: $(SPLINT) bstring.c -expect 2 decl: $(SPLINT) decl.c -expect 1 enumbool: $(SPLINT) enumbool.c -booltrue true -boolfalse false # Herbert: TODO -$(SPLINT) enumbool.c -booltrue TRUE -boolfalse FALSE -expect 2 extension: $(SPLINT) extension.c # Herbert: TODO -$(SPLINT) -gnuextensions extension.c modarray: $(SPLINT) modarray.c nestext: $(SPLINT) nestext.c -expect 1 offsetof: $(SPLINT) offsetof.c sizeofarray: $(SPLINT) sizeofarray.c -expect 3 rex: $(SPLINT) rex.c -expect 4 ### 3 new errors reported struct: $(SPLINT) struct.c -expect 1 splint-3.1.2.dfsg1/test/tests2.2a/0000755021234200000250000000000010645776262014166 5ustar faxsplint-3.1.2.dfsg1/test/tests2.2a/addassign.c0000644021234200000250000000021207121317336016246 0ustar faxint hash (char *name) { int h = 0; while (*name != '\0') { h += *name++; /* error in 2.1b */ } return h % 137; } splint-3.1.2.dfsg1/test/tests2.2a/arrayparam.c0000644021234200000250000000051207121317336016453 0ustar faxint f1(int x[2][]) /* bad */ { return x[2][3]; } int f2(int x[][2]) /* okay */ { return x[2][3]; } int f3(int x[][]) /* bad */ { return x[2][3]; } int f4(int x[][][2]) /* bad */ { return x[2][3][1]; } int f5(int x[2][][2]) /* bad */ { return x[2][3][1]; } int f6(int x[][2][2]) /* okay */ { return x[2][3][1]; } splint-3.1.2.dfsg1/test/tests2.2a/bitops.c0000644021234200000250000000073207121317336015620 0ustar faxint f (int i1, int i2, unsigned u1, unsigned u2) { int x = i1 & i2; /* not unsigned */ unsigned u = u1 & i2; short s = i1 & i2; /* not unsigned */ short s2 = i1 + i2; u = u1 | u2; u = i1 << 3; /* left operand not unsigned */ u = u1 >> 4; /* okay */ u = u1 >> i1; u >>= 3; u = i1 ^ u1; /* ! unsigned */ u = u1 ^ i1; /* ! not unsigned */ return x; } /* >>, >>= <<, <<= warn if not unsigned &, &= |, |= ^ (XOR), ^= warn if not unsigned */ splint-3.1.2.dfsg1/test/tests2.2a/boolcomp.c0000644021234200000250000000041707121317336016132 0ustar fax# include "../bool.h" int f (bool a, bool b) { if (a == b) /* 1. */ { return 3; } else if ((a == b) /* 2. */ == (a != b)) /* 3. */ { return 5; } else if ((a == FALSE) == (b == TRUE)) /* 4. */ { return 7; } } splint-3.1.2.dfsg1/test/tests2.2a/boolenum.c0000644021234200000250000000004307121317336016133 0ustar faxtypedef enum { FALSE, TRUE } bool; splint-3.1.2.dfsg1/test/tests2.2a/dobb.c0000644021234200000250000000020307121317336015217 0ustar faxtypedef int t_u_byte; #define TESTVALUE (t_u_byte) 7 typedef enum e_test { e_c1, e_cl = (e_c1 + (((t_u_byte) 7) - 1)), } t_test; splint-3.1.2.dfsg1/test/tests2.2a/duff.c0000644021234200000250000000051407121317336015242 0ustar faxvoid copy ( to, from, count ) char* to; char* from; { int n=(count+7)/8; switch (count%8) do { case 0: *to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n>0); } splint-3.1.2.dfsg1/test/tests2.2a/erik.c0000644021234200000250000000013207121317336015244 0ustar faxint main (void) { float f; double d; scanf("%lf %f",&d, &f); return 0; } splint-3.1.2.dfsg1/test/tests2.2a/floatdouble.c0000644021234200000250000000021607121317336016615 0ustar faxint f (float f, double d) { float f1 = d; /* bad without +floatdouble */ double d1 = f; /* okay relaxed */ f1 = d + f; return 2; } splint-3.1.2.dfsg1/test/tests2.2a/florian.c0000644021234200000250000000007707121317336015754 0ustar faxint foo(bar) /*@modifies *bar*/ int *bar; { return 3; } splint-3.1.2.dfsg1/test/tests2.2a/fred.c0000644021234200000250000000030607121317336015235 0ustar fax#include /* free, EXIT_SUCCESS */ typedef int Bool; #define False 0 static void CheckQualsSub(Bool Found); void CheckQuals(void) { Bool B = False; CheckQualsSub (B); } splint-3.1.2.dfsg1/test/tests2.2a/isalpha.c0000644021234200000250000000010107121317336015727 0ustar fax# include "../bool.h" bool f (char c) { return isalpha (c); } splint-3.1.2.dfsg1/test/tests2.2a/notreached.c0000644021234200000250000000016207121317336016431 0ustar faxint f (int x) { if (x > 3) { /*@notreached@*/ ; } else { return 3; /*@notreached@*/ x = 12; } } splint-3.1.2.dfsg1/test/tests2.2a/obviousloop.c0000644021234200000250000000126607121317336016703 0ustar faxint f (void) { int x = 3; while (TRUE) { x++; if (x == 12) { return 12; } } x = 12; /* unreachable */ } int f1 (void) { int x = 3; while (TRUE) { x++; if (x == 12) { return 12; } if (x == 8) { break; } } x = 12; /* no return */ } int f1b (void) { int x = 3; while (TRUE) { x++; if (x == 12) { return 12; } if (x == 8) { for (x = 2; x < 2; x++) { if (x == 4) { break; } } } } x = 12; /* unreachable */ } int f2 (void) { int x = 3; for (;;) { x++; if (x == 12) { return 12; } } x = 12; /* unreachable */ } splint-3.1.2.dfsg1/test/tests2.2a/popik.c0000644021234200000250000000116107121317336015437 0ustar faxstatic const dummy[] = { 0x0, 0x1, 0x1, 0x2 }; static const short int dummy2[] = { 0x0, 0x1, 0x1, 0x2 }; static const dummy3[] = { 0, 1, 1, 2 }; /* What this means is that there appear to be some problems with lclint 1) doesn't detect the missing typing in the first and last examples - gcc 2.7.2.f.1 doesn't either it compiles this code without a comment 2) changing the declaration from 0x0 to 0 has no effect(I expected this), but changing 0x1 & 0x2 to 1 & 2 did and I don't have any explanation. */ splint-3.1.2.dfsg1/test/tests2.2a/sizeof.c0000644021234200000250000000006307121317336015614 0ustar faxsize_t f (int x) { return sizeof (sizeof (x)); } splint-3.1.2.dfsg1/test/tests2.2a/toralf.c0000644021234200000250000000064107121317336015606 0ustar fax/** fixed, 8 july 1997 */ /* test file for lclint */ # include static void func1 (char *x) { char *s = x; int i1; float f; s += 5; s += 'c'; /* bad types */ i1 += f; /* i1 used before def, f used before def */ } static void func2() { int i1; int i2; i1 = i2; /* i2 used before def */ } int main () { func1 (NULL); /* null passed */ func2 (); return (EXIT_SUCCESS); } splint-3.1.2.dfsg1/test/tests2.4/0000755021234200000250000000000010645776270014026 5ustar faxsplint-3.1.2.dfsg1/test/tests2.4/subdir/0000755021234200000250000000000010645776262015317 5ustar faxsplint-3.1.2.dfsg1/test/tests2.4/subdir/main.lcl0000644021234200000250000000000707121317340016713 0ustar faxint x; splint-3.1.2.dfsg1/test/tests2.4/subdir/main.c0000644021234200000250000000000707121317340016363 0ustar faxint x; splint-3.1.2.dfsg1/test/tests2.4/alignof.c0000644021234200000250000000013107121317340015564 0ustar faxint f (float x) { int m = __alignof__ x; int n = __alignof__ (x); return n + m; } splint-3.1.2.dfsg1/test/tests2.4/array.c0000644021234200000250000000114207320412014015261 0ustar faxint f (int a[], int a2[73] /*legal, but meaningless!*/, int m [] [3] /* int m [][] leads to error for m[1] */ ) { int b[10]; int c[10]; /* int pa[]; illegal!*/ int *p = (int *) malloc (sizeof (int) * 10); a++; a2++; /* b++; illegal! */ printf ("a: %d / a2: %d / b: %d / m: %d / m[0]: %d / p: %d / int: %d\n", sizeof (a), sizeof (a2), sizeof (b), sizeof (m), sizeof (m[1]), sizeof (p), sizeof (int)); /* b = c; illegal*/ /* b = a; illegal */ a = b; /* okay! */ } int main (void) { int a[10]; int m[10][3]; int x = f (a, a, m); { int k[x]; k[2] = 12; } } splint-3.1.2.dfsg1/test/tests2.4/bitfields.c0000644021234200000250000000010107121317337016115 0ustar faxtypedef unsigned S; typedef struct { unsigned u: ((S) 4); } T; splint-3.1.2.dfsg1/test/tests2.4/bug1.c0000644021234200000250000000021007121317337015007 0ustar faxint main( void ) { int a=5,c=1; switch(a) { case 1: while (c>3) { case 3: ++c; } } return 7; } splint-3.1.2.dfsg1/test/tests2.4/bug2.c0000644021234200000250000000051607121317337015021 0ustar faxint main () { int i = 1; switch (i) { printf ("here 1"); /* should complain about this! */ case 1: printf ("here 2"); while (i < 2) { printf ("here 3"); case 2: printf ("here 4"); i++; printf ("here 5"); } printf ("here 6"); case 3: printf ("here 7"); i++; } } splint-3.1.2.dfsg1/test/tests2.4/bug3.c0000644021234200000250000000016607121317340015015 0ustar faxint main () { int i = 1; int j; switch (i) { case 1: j = 2; case 2: } printf ("j = %d", j); } splint-3.1.2.dfsg1/test/tests2.4/chin.c0000644021234200000250000000535307320412014015074 0ustar fax#include #include #include #include #include #include #include #include "FrameL.h" int main(int argc, char *argv[]) /*-------------- main ----*/ { struct FrFile *iFile; struct FrFile *oFile; struct FrameH *iFrame; struct FrameH *oFrame; struct FrAdcData *dmroAdcData; struct FrVect *dmroVector; void *actualData; double *times; /* times at which samples are taken */ char *projectName = ""; unsigned int runNumber = 0; unsigned int frameNumber = 0; unsigned int initialTime = 0; /* start time of 1st frame */ unsigned int finalTime = 0; /* time of end of data * window wanted */ unsigned int startTime = 0; /* start time of current * frame */ unsigned int startTimeResidual = 0; /* nanoseconds */ long debugLevel; int i; /* loop counter */ size_t lastSize; /* size of latest actualData, in units of * sizeof(short) */ /*--- increase the Debug level to see possible errors ---*/ if (argc == 3) { sscanf(argv[2],"%ld",&debugLevel); } else { debugLevel = 1; } FrLibSetLvl(debugLevel); } /* And here's the error message: LCLint 2.4b --- 18 Apr 98 frameread.c: (in function main) frameread.c:50:24: Variable debugLevel used before definition An rvalue is used that may not be initialized to a value on some execution path. (-usedef will suppress message) frameread.c:50:35: *** Internal Bug at exprNode.c:3843: exprNode_preOp: unhandled op: . [errno: 25] *** Last code point: exprNode.c:8474 *** Previous code point: exprNode.c:8474 system error: : Not a typewriter *** Please report bug to lclint-bug@sds.lcs.mit.edu *** (attempting to continue, results may be incorrect) frameread.c:50:23: Format argument 1 to sscanf (%ld) expects long int * gets long int: .debugLevel Type of parameter is not consistent with corresponding code in format string. (-formattype will suppress message) frameread.c:50:20: Corresponding format code frameread.c:50:2: Return value (type int) ignored: sscanf(argv[2], ... Result returned by function call is not used. If this is intended, can cast result to (void) to eliminate message. (-retvalint will suppress message) frameread.c:53:17: *** Internal Bug at exprNode.c:4765: exprNode.c:4765: llassert failed: FALSE: Unexpected default case reached! [errno: 25] *** Last code point: exprNode.c:8474 *** Previous code point: exprNode.c:3216 system error: : Not a typewriter *** Please report bug to lclint-bug@sds.lcs.mit.edu *** (attempting to continue, results may be incorrect) */ splint-3.1.2.dfsg1/test/tests2.4/cpptest.c0000644021234200000250000000007007121317340015631 0ustar faxint test (void) { int x = __P('a'); return x; } splint-3.1.2.dfsg1/test/tests2.4/driverstub.c0000644021234200000250000014651207121317340016354 0ustar fax # 1 "driverstub.c" # 1 "/usr/include/sys/types.h" 1 3 # 1 "/usr/include/features.h" 1 3 # 138 "/usr/include/features.h" 3 # 196 "/usr/include/features.h" 3 # 1 "/usr/include/sys/cdefs.h" 1 3 # 71 "/usr/include/sys/cdefs.h" 3 # 103 "/usr/include/sys/cdefs.h" 3 # 250 "/usr/include/features.h" 2 3 # 1 "/usr/include/gnu/stubs.h" 1 3 # 278 "/usr/include/features.h" 2 3 # 26 "/usr/include/sys/types.h" 2 3 # 1 "/usr/include/bits/types.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3 # 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 typedef unsigned int size_t; # 271 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 29 "/usr/include/bits/types.h" 2 3 typedef unsigned char __u_char; typedef unsigned short __u_short; typedef unsigned int __u_int; typedef unsigned long __u_long; __extension__ typedef unsigned long long int __u_quad_t; __extension__ typedef long long int __quad_t; # 48 "/usr/include/bits/types.h" 3 typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef signed short int __int16_t; typedef unsigned short int __uint16_t; typedef signed int __int32_t; typedef unsigned int __uint32_t; __extension__ typedef signed long long int __int64_t; __extension__ typedef unsigned long long int __uint64_t; typedef __quad_t *__qaddr_t; typedef __u_quad_t __dev_t; typedef __u_int __uid_t; typedef __u_int __gid_t; typedef __u_long __ino_t; typedef __u_int __mode_t; typedef __u_int __nlink_t; typedef long int __off_t; typedef __quad_t __loff_t; typedef int __pid_t; typedef int __ssize_t; typedef long int __rlim_t; typedef __quad_t __rlim64_t; typedef __u_int __id_t; typedef struct { int __val[2]; } __fsid_t; typedef int __daddr_t; typedef char *__caddr_t; typedef long int __time_t; typedef long int __swblk_t; typedef long int __clock_t; typedef unsigned long int __fd_mask; typedef struct { __fd_mask __fds_bits[1024 / (8 * sizeof (__fd_mask)) ]; } __fd_set; typedef int __key_t; typedef unsigned short int __ipc_pid_t; typedef long int __blkcnt_t; typedef __quad_t __blkcnt64_t; typedef __u_long __fsblkcnt_t; typedef __u_quad_t __fsblkcnt64_t; typedef __u_long __fsfilcnt_t; typedef __u_quad_t __fsfilcnt64_t; typedef __u_long __ino64_t; typedef __loff_t __off64_t; typedef long int __t_scalar_t; typedef unsigned long int __t_uscalar_t; typedef int __intptr_t; # 30 "/usr/include/sys/types.h" 2 3 typedef __u_char u_char; typedef __u_short u_short; typedef __u_int u_int; typedef __u_long u_long; typedef __quad_t quad_t; typedef __u_quad_t u_quad_t; typedef __fsid_t fsid_t; typedef __loff_t loff_t; typedef __ino_t ino_t; typedef __dev_t dev_t; typedef __gid_t gid_t; typedef __mode_t mode_t; typedef __nlink_t nlink_t; typedef __uid_t uid_t; typedef __off_t off_t; typedef __pid_t pid_t; typedef __id_t id_t; typedef __ssize_t ssize_t; typedef __daddr_t daddr_t; typedef __caddr_t caddr_t; typedef __key_t key_t; # 1 "/usr/include/time.h" 1 3 # 51 "/usr/include/time.h" 3 # 62 "/usr/include/time.h" 3 typedef __time_t time_t; # 89 "/usr/include/time.h" 3 # 279 "/usr/include/time.h" 3 # 122 "/usr/include/sys/types.h" 2 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3 # 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 188 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 271 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 125 "/usr/include/sys/types.h" 2 3 typedef unsigned long int ulong; typedef unsigned short int ushort; typedef unsigned int uint; # 159 "/usr/include/sys/types.h" 3 typedef int int8_t __attribute__ ((__mode__ ( __QI__ ))) ; typedef int int16_t __attribute__ ((__mode__ ( __HI__ ))) ; typedef int int32_t __attribute__ ((__mode__ ( __SI__ ))) ; typedef int int64_t __attribute__ ((__mode__ ( __DI__ ))) ; typedef unsigned int u_int8_t __attribute__ ((__mode__ ( __QI__ ))) ; typedef unsigned int u_int16_t __attribute__ ((__mode__ ( __HI__ ))) ; typedef unsigned int u_int32_t __attribute__ ((__mode__ ( __SI__ ))) ; typedef unsigned int u_int64_t __attribute__ ((__mode__ ( __DI__ ))) ; typedef int register_t __attribute__ ((__mode__ (__word__))); # 1 "/usr/include/endian.h" 1 3 # 1 "/usr/include/bits/endian.h" 1 3 # 35 "/usr/include/endian.h" 2 3 # 191 "/usr/include/sys/types.h" 2 3 # 1 "/usr/include/sys/select.h" 1 3 # 1 "/usr/include/bits/select.h" 1 3 # 36 "/usr/include/bits/select.h" 3 # 56 "/usr/include/bits/select.h" 3 # 72 "/usr/include/bits/select.h" 3 # 31 "/usr/include/sys/select.h" 2 3 # 1 "/usr/include/bits/sigset.h" 1 3 typedef int __sig_atomic_t; typedef struct { unsigned long int __val[(1024 / (8 * sizeof (unsigned long int))) ]; } __sigset_t; # 125 "/usr/include/bits/sigset.h" 3 # 34 "/usr/include/sys/select.h" 2 3 # 1 "/usr/include/time.h" 1 3 # 51 "/usr/include/time.h" 3 # 62 "/usr/include/time.h" 3 # 73 "/usr/include/time.h" 3 struct timespec { long int tv_sec; long int tv_nsec; }; # 279 "/usr/include/time.h" 3 # 38 "/usr/include/sys/select.h" 2 3 struct timeval; typedef __fd_mask fd_mask; typedef __fd_set fd_set; extern int __select (int __nfds, __fd_set *__readfds, __fd_set *__writefds, __fd_set *__exceptfds, struct timeval *__timeout) ; extern int select (int __nfds, __fd_set *__readfds, __fd_set *__writefds, __fd_set *__exceptfds, struct timeval *__timeout) ; # 91 "/usr/include/sys/select.h" 3 # 194 "/usr/include/sys/types.h" 2 3 # 1 "/usr/include/sys/sysmacros.h" 1 3 # 47 "/usr/include/sys/sysmacros.h" 3 # 197 "/usr/include/sys/types.h" 2 3 typedef __blkcnt_t blkcnt_t; typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; # 1 "driverstub.c" 2 # 1 "/usr/include/sys/ioctl.h" 1 3 # 1 "/usr/include/bits/ioctls.h" 1 3 # 1 "/usr/include/asm/ioctls.h" 1 3 # 1 "/usr/include/asm/ioctl.h" 1 3 # 4 "/usr/include/asm/ioctls.h" 2 3 # 24 "/usr/include/bits/ioctls.h" 2 3 # 27 "/usr/include/sys/ioctl.h" 2 3 # 1 "/usr/include/bits/ioctl-types.h" 1 3 struct winsize { unsigned short int ws_row; unsigned short int ws_col; unsigned short int ws_xpixel; unsigned short int ws_ypixel; }; struct termio { unsigned short int c_iflag; unsigned short int c_oflag; unsigned short int c_cflag; unsigned short int c_lflag; unsigned char c_line; unsigned char c_cc[8 ]; }; # 30 "/usr/include/sys/ioctl.h" 2 3 # 1 "/usr/include/sys/ttydefaults.h" 1 3 # 37 "/usr/include/sys/ioctl.h" 2 3 extern int ioctl (int __fd, unsigned long int __request, ...) ; # 2 "driverstub.c" 2 # 1 "/usr/include/stdlib.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3 # 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 188 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 typedef long int wchar_t; # 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 33 "/usr/include/stdlib.h" 2 3 typedef struct { int quot; int rem; } div_t; typedef struct { long int quot; long int rem; } ldiv_t; # 65 "/usr/include/stdlib.h" 3 extern size_t __ctype_get_mb_cur_max (void) ; extern double atof (__const char *__nptr) ; extern int atoi (__const char *__nptr) ; extern long int atol (__const char *__nptr) ; __extension__ extern long long int atoll (__const char *__nptr) ; extern double strtod (__const char * __nptr, char ** __endptr) ; extern long int strtol (__const char * __nptr, char ** __endptr, int __base) ; extern unsigned long int strtoul (__const char * __nptr, char ** __endptr, int __base) ; __extension__ extern long long int strtoq (__const char * __nptr, char ** __endptr, int __base) ; __extension__ extern unsigned long long int strtouq (__const char * __nptr, char ** __endptr, int __base) ; __extension__ extern long long int strtoll (__const char * __nptr, char ** __endptr, int __base) ; __extension__ extern unsigned long long int strtoull (__const char * __nptr, char ** __endptr, int __base) ; # 190 "/usr/include/stdlib.h" 3 extern double __strtod_internal (__const char * __nptr, char ** __endptr, int __group) ; extern float __strtof_internal (__const char * __nptr, char ** __endptr, int __group) ; extern long double __strtold_internal (__const char * __nptr, char ** __endptr, int __group) ; extern long int __strtol_internal (__const char * __nptr, char ** __endptr, int __base, int __group) ; extern unsigned long int __strtoul_internal (__const char * __nptr, char ** __endptr, int __base, int __group) ; __extension__ extern long long int __strtoll_internal (__const char * __nptr, char ** __endptr, int __base, int __group) ; __extension__ extern unsigned long long int __strtoull_internal (__const char * __nptr, char ** __endptr, int __base, int __group) ; # 326 "/usr/include/stdlib.h" 3 extern char *l64a (long int __n) ; extern long int a64l (__const char *__s) ; extern int32_t random (void) ; extern void srandom (unsigned int __seed) ; extern void * initstate (unsigned int __seed, void * __statebuf, size_t __statelen) ; extern void * setstate (void * __statebuf) ; struct random_data { int32_t *fptr; int32_t *rptr; int32_t *state; int rand_type; int rand_deg; int rand_sep; int32_t *end_ptr; }; extern int random_r (struct random_data * __buf, int32_t * __result) ; extern int srandom_r (unsigned int __seed, struct random_data *__buf) ; extern int initstate_r (unsigned int __seed, void * __statebuf, size_t __statelen, struct random_data * __buf) ; extern int setstate_r (void * __statebuf, struct random_data * __buf) ; extern int rand (void) ; extern void srand (unsigned int __seed) ; extern int rand_r (unsigned int *__seed) ; extern double drand48 (void) ; extern double erand48 (unsigned short int __xsubi[3]) ; extern long int lrand48 (void) ; extern long int nrand48 (unsigned short int __xsubi[3]) ; extern long int mrand48 (void) ; extern long int jrand48 (unsigned short int __xsubi[3]) ; extern void srand48 (long int __seedval) ; extern unsigned short int *seed48 (unsigned short int __seed16v[3]) ; extern void lcong48 (unsigned short int __param[7]) ; struct drand48_data { unsigned short int x[3]; unsigned short int a[3]; unsigned short int c; unsigned short int old_x[3]; int init; }; extern int drand48_r (struct drand48_data * __buffer, double * __result) ; extern int erand48_r (unsigned short int __xsubi[3], struct drand48_data * __buffer, double * __result) ; extern int lrand48_r (struct drand48_data * __buffer, long int * __result) ; extern int nrand48_r (unsigned short int __xsubi[3], struct drand48_data * __buffer, long int * __result) ; extern int mrand48_r (struct drand48_data * __buffer, long int * __result) ; extern int jrand48_r (unsigned short int __xsubi[3], struct drand48_data * __buffer, long int * __result) ; extern int srand48_r (long int __seedval, struct drand48_data *__buffer) ; extern int seed48_r (unsigned short int __seed16v[3], struct drand48_data *__buffer) ; extern int lcong48_r (unsigned short int __param[7], struct drand48_data *__buffer) ; extern void * malloc (size_t __size) ; extern void * calloc (size_t __nmemb, size_t __size) ; extern void * realloc (void * __ptr, size_t __size) ; extern void free (void * __ptr) ; extern void cfree (void * __ptr) ; # 1 "/usr/include/alloca.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3 # 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 188 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 271 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 25 "/usr/include/alloca.h" 2 3 extern void * alloca (size_t __size) ; # 492 "/usr/include/stdlib.h" 2 3 extern void * valloc (size_t __size) ; extern void abort (void) __attribute__ ((__noreturn__)); extern int atexit (void (*__func) (void)) ; extern int __on_exit (void (*__func) (int __status, void * __arg), void * __arg) ; extern int on_exit (void (*__func) (int __status, void * __arg), void * __arg) ; extern void exit (int __status) __attribute__ ((__noreturn__)); extern char *getenv (__const char *__name) ; extern char *__secure_getenv (__const char *__name) ; extern int putenv (char *__string) ; extern int setenv (__const char *__name, __const char *__value, int __replace) ; extern void unsetenv (__const char *__name) ; extern int clearenv (void) ; extern char *mktemp (char *__template) ; extern int mkstemp (char *__template) ; extern int system (__const char *__command) ; extern char *realpath (__const char * __name, char * __resolved) ; typedef int (*__compar_fn_t) (__const void * , __const void * ) ; extern void * bsearch (__const void * __key, __const void * __base, size_t __nmemb, size_t __size, __compar_fn_t __compar) ; extern void qsort (void * __base, size_t __nmemb, size_t __size, __compar_fn_t __compar) ; extern int abs (int __x) __attribute__ ((__const__)); extern long int labs (long int __x) __attribute__ ((__const__)); extern div_t div (int __numer, int __denom) __attribute__ ((__const__)); extern ldiv_t ldiv (long int __numer, long int __denom) __attribute__ ((__const__)); extern char *ecvt (double __value, int __ndigit, int * __decpt, int * __sign) ; extern char *fcvt (double __value, int __ndigit, int * __decpt, int * __sign) ; extern char *gcvt (double __value, int __ndigit, char *__buf) ; extern char *qecvt (long double __value, int __ndigit, int * __decpt, int * __sign) ; extern char *qfcvt (long double __value, int __ndigit, int * __decpt, int * __sign) ; extern char *qgcvt (long double __value, int __ndigit, char *__buf) ; extern int ecvt_r (double __value, int __ndigit, int * __decpt, int * __sign, char * __buf, size_t __len) ; extern int fcvt_r (double __value, int __ndigit, int * __decpt, int * __sign, char * __buf, size_t __len) ; extern int qecvt_r (long double __value, int __ndigit, int * __decpt, int * __sign, char * __buf, size_t __len) ; extern int qfcvt_r (long double __value, int __ndigit, int * __decpt, int * __sign, char * __buf, size_t __len) ; extern int mblen (__const char *__s, size_t __n) ; extern int mbtowc (wchar_t * __pwc, __const char * __s, size_t __n) ; extern int wctomb (char *__s, wchar_t __wchar) ; extern size_t mbstowcs (wchar_t * __pwcs, __const char * __s, size_t __n) ; extern size_t wcstombs (char * __s, __const wchar_t * __pwcs, size_t __n) ; extern int rpmatch (__const char *__response) ; # 732 "/usr/include/stdlib.h" 3 # 756 "/usr/include/stdlib.h" 3 # 766 "/usr/include/stdlib.h" 3 # 3 "driverstub.c" 2 # 1 "/usr/include/string.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3 # 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 188 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 271 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 33 "/usr/include/string.h" 2 3 extern void * memcpy (void * __dest, __const void * __src, size_t __n) ; extern void * memmove (void * __dest, __const void * __src, size_t __n) ; extern void * memccpy (void * __dest, __const void * __src, int __c, size_t __n) ; extern void * memset (void * __s, int __c, size_t __n) ; extern int memcmp (__const void * __s1, __const void * __s2, size_t __n) ; extern void * memchr (__const void * __s, int __c, size_t __n) ; extern char *strcpy (char * __dest, __const char * __src) ; extern char *strncpy (char * __dest, __const char * __src, size_t __n) ; extern char *strcat (char * __dest, __const char * __src) ; extern char *strncat (char * __dest, __const char * __src, size_t __n) ; extern int strcmp (__const char *__s1, __const char *__s2) ; extern int strncmp (__const char *__s1, __const char *__s2, size_t __n) ; extern int strcoll (__const char *__s1, __const char *__s2) ; extern size_t strxfrm (char * __dest, __const char * __src, size_t __n) ; # 107 "/usr/include/string.h" 3 extern char *__strdup (__const char *__s) ; extern char *strdup (__const char *__s) ; # 143 "/usr/include/string.h" 3 extern char *strchr (__const char *__s, int __c) ; extern char *strrchr (__const char *__s, int __c) ; extern size_t strcspn (__const char *__s, __const char *__reject) ; extern size_t strspn (__const char *__s, __const char *__accept) ; extern char *strpbrk (__const char *__s, __const char *__accept) ; extern char *strstr (__const char *__haystack, __const char *__needle) ; extern char *strtok (char * __s, __const char * __delim) ; extern char *__strtok_r (char * __s, __const char * __delim, char ** __save_ptr) ; extern char *strtok_r (char * __s, __const char * __delim, char ** __save_ptr) ; # 203 "/usr/include/string.h" 3 extern size_t strlen (__const char *__s) ; extern char *strerror (int __errnum) ; extern char *__strerror_r (int __errnum, char *__buf, size_t __buflen) ; extern char *strerror_r (int __errnum, char *__buf, size_t __buflen) ; extern void __bzero (void * __s, size_t __n) ; extern void bcopy (__const void * __src, void * __dest, size_t __n) ; extern void bzero (void * __s, size_t __n) ; extern int bcmp (__const void * __s1, __const void * __s2, size_t __n) ; extern char *index (__const char *__s, int __c) ; extern char *rindex (__const char *__s, int __c) ; extern int __ffs (int __i) __attribute__ ((const)); extern int ffs (int __i) __attribute__ ((const)); extern int __strcasecmp (__const char *__s1, __const char *__s2) ; extern int strcasecmp (__const char *__s1, __const char *__s2) ; extern int strncasecmp (__const char *__s1, __const char *__s2, size_t __n) ; # 277 "/usr/include/string.h" 3 extern char *strsep (char ** __stringp, __const char * __delim) ; # 319 "/usr/include/string.h" 3 # 347 "/usr/include/string.h" 3 # 4 "driverstub.c" 2 # 1 "/usr/include/fcntl.h" 1 3 # 1 "/usr/include/bits/fcntl.h" 1 3 struct flock { short int l_type; short int l_whence; __off_t l_start; __off_t l_len; __pid_t l_pid; }; # 131 "/usr/include/bits/fcntl.h" 3 # 33 "/usr/include/fcntl.h" 2 3 extern int __fcntl (int __fd, int __cmd, ...) ; extern int fcntl (int __fd, int __cmd, ...) ; extern int __open (__const char *__file, int __oflag, ...) ; extern int open (__const char *__file, int __oflag, ...) ; extern int creat (__const char *__file, __mode_t __mode) ; extern int lockf (int __fd, int __cmd, __off_t __len) ; # 5 "driverstub.c" 2 # 1 "/usr/include/assert.h" 1 3 # 32 "/usr/include/assert.h" 3 # 56 "/usr/include/assert.h" 3 extern void __assert_fail (__const char *__assertion, __const char *__file, unsigned int __line, __const char *__function) __attribute__ ((__noreturn__)); extern void __assert_perror_fail (int __errnum, __const char *__file, unsigned int __line, __const char *__function) __attribute__ ((__noreturn__)); # 6 "driverstub.c" 2 # 1 "/usr/include/ctype.h" 1 3 enum { _ISupper = (( 0 ) < 8 ? ((1 << ( 0 )) << 8) : ((1 << ( 0 )) >> 8)) , _ISlower = (( 1 ) < 8 ? ((1 << ( 1 )) << 8) : ((1 << ( 1 )) >> 8)) , _ISalpha = (( 2 ) < 8 ? ((1 << ( 2 )) << 8) : ((1 << ( 2 )) >> 8)) , _ISdigit = (( 3 ) < 8 ? ((1 << ( 3 )) << 8) : ((1 << ( 3 )) >> 8)) , _ISxdigit = (( 4 ) < 8 ? ((1 << ( 4 )) << 8) : ((1 << ( 4 )) >> 8)) , _ISspace = (( 5 ) < 8 ? ((1 << ( 5 )) << 8) : ((1 << ( 5 )) >> 8)) , _ISprint = (( 6 ) < 8 ? ((1 << ( 6 )) << 8) : ((1 << ( 6 )) >> 8)) , _ISgraph = (( 7 ) < 8 ? ((1 << ( 7 )) << 8) : ((1 << ( 7 )) >> 8)) , _ISblank = (( 8 ) < 8 ? ((1 << ( 8 )) << 8) : ((1 << ( 8 )) >> 8)) , _IScntrl = (( 9 ) < 8 ? ((1 << ( 9 )) << 8) : ((1 << ( 9 )) >> 8)) , _ISpunct = (( 10 ) < 8 ? ((1 << ( 10 )) << 8) : ((1 << ( 10 )) >> 8)) , _ISalnum = (( 11 ) < 8 ? ((1 << ( 11 )) << 8) : ((1 << ( 11 )) >> 8)) }; extern __const unsigned short int *__ctype_b; extern __const __int32_t *__ctype_tolower; extern __const __int32_t *__ctype_toupper; extern int isalnum (int) ; extern int isalpha (int) ; extern int iscntrl (int) ; extern int isdigit (int) ; extern int islower (int) ; extern int isgraph (int) ; extern int isprint (int) ; extern int ispunct (int) ; extern int isspace (int) ; extern int isupper (int) ; extern int isxdigit (int) ; extern int tolower (int __c) ; extern int toupper (int __c) ; extern int isascii (int __c) ; extern int toascii (int __c) ; extern int _toupper (int) ; extern int _tolower (int) ; # 164 "/usr/include/ctype.h" 3 # 186 "/usr/include/ctype.h" 3 # 273 "/usr/include/ctype.h" 3 # 7 "driverstub.c" 2 # 1 "/usr/include/getopt.h" 1 3 extern char *optarg; extern int optind; extern int opterr; extern int optopt; struct option { const char *name; int has_arg; int *flag; int val; }; extern int getopt (int __argc, char *const *__argv, const char *__shortopts); extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int getopt_long_only (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind); extern int _getopt_internal (int __argc, char *const *__argv, const char *__shortopts, const struct option *__longopts, int *__longind, int __long_only); # 160 "/usr/include/getopt.h" 3 # 8 "driverstub.c" 2 # 1 "/usr/include/netinet/in.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 1 3 # 114 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 3 # 1 "/usr/include/limits.h" 1 3 # 1 "/usr/include/bits/posix1_lim.h" 1 3 # 1 "/usr/include/bits/local_lim.h" 1 3 # 1 "/usr/include/linux/limits.h" 1 3 # 27 "/usr/include/bits/local_lim.h" 2 3 # 126 "/usr/include/bits/posix1_lim.h" 2 3 # 30 "/usr/include/limits.h" 2 3 # 1 "/usr/include/bits/posix2_lim.h" 1 3 # 34 "/usr/include/limits.h" 2 3 # 121 "/usr/include/limits.h" 3 # 117 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 2 3 # 7 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/syslimits.h" 2 3 # 11 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 2 3 # 107 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 3 # 23 "/usr/include/netinet/in.h" 2 3 # 1 "/usr/include/stdint.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3 # 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 190 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 269 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 28 "/usr/include/stdint.h" 2 3 # 1 "/usr/include/bits/wordsize.h" 1 3 # 29 "/usr/include/stdint.h" 2 3 # 47 "/usr/include/stdint.h" 3 typedef unsigned char uint8_t; typedef unsigned short int uint16_t; typedef unsigned int uint32_t; __extension__ typedef unsigned long long int uint64_t; typedef signed char int_least8_t; typedef short int int_least16_t; typedef int int_least32_t; __extension__ typedef long long int int_least64_t; typedef unsigned char uint_least8_t; typedef unsigned short int uint_least16_t; typedef unsigned int uint_least32_t; __extension__ typedef unsigned long long int uint_least64_t; typedef signed char int_fast8_t; typedef int int_fast16_t; typedef int int_fast32_t; __extension__ typedef long long int int_fast64_t; typedef unsigned char uint_fast8_t; typedef unsigned int uint_fast16_t; typedef unsigned int uint_fast32_t; __extension__ typedef unsigned long long int uint_fast64_t; typedef int intptr_t; typedef unsigned int uintptr_t; __extension__ typedef long long int intmax_t; __extension__ typedef unsigned long long int uintmax_t; # 24 "/usr/include/netinet/in.h" 2 3 # 1 "/usr/include/bits/socket.h" 1 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 1 3 # 19 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 61 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 131 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 188 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 271 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 283 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 317 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h" 3 # 29 "/usr/include/bits/socket.h" 2 3 # 1 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 1 3 # 114 "/usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/limits.h" 3 # 31 "/usr/include/bits/socket.h" 2 3 typedef unsigned int socklen_t; enum __socket_type { SOCK_STREAM = 1, SOCK_DGRAM = 2, SOCK_RAW = 3, SOCK_RDM = 4, SOCK_SEQPACKET = 5, SOCK_PACKET = 10 }; # 1 "/usr/include/bits/sockaddr.h" 1 3 typedef unsigned short int sa_family_t; extern int __libc_sa_len (sa_family_t __af) ; # 133 "/usr/include/bits/socket.h" 2 3 struct sockaddr { sa_family_t sa_family ; char sa_data[14]; }; struct sockaddr_storage { sa_family_t __ss_family ; __uint32_t __ss_align; char __ss_padding[(128 - (2 * sizeof (__uint32_t ))) ]; }; enum { MSG_OOB = 0x01, MSG_PEEK = 0x02, MSG_DONTROUTE = 0x04, MSG_CTRUNC = 0x08, MSG_PROXY = 0x10, MSG_TRUNC = 0x20, MSG_DONTWAIT = 0x40, MSG_EOR = 0x80, MSG_WAITALL = 0x100, MSG_FIN = 0x200, MSG_SYN = 0x400, MSG_URG = 0x800, MSG_RST = 0x1000, MSG_ERRQUEUE = 0x2000, MSG_NOSIGNAL = 0x4000 }; struct msghdr { void * msg_name; socklen_t msg_namelen; struct iovec *msg_iov; size_t msg_iovlen; void * msg_control; size_t msg_controllen; int msg_flags; }; struct cmsghdr { size_t cmsg_len; int cmsg_level; int cmsg_type; unsigned char __cmsg_data[0]; }; extern struct cmsghdr *__cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) ; # 270 "/usr/include/bits/socket.h" 3 enum { SCM_RIGHTS = 0x01, SCM_CREDENTIALS = 0x02, __SCM_CONNECT = 0x03 }; struct ucred { pid_t pid; uid_t uid; gid_t gid; }; # 1 "/usr/include/asm/socket.h" 1 3 # 1 "/usr/include/asm/sockios.h" 1 3 # 4 "/usr/include/asm/socket.h" 2 3 # 55 "/usr/include/asm/socket.h" 3 # 295 "/usr/include/bits/socket.h" 2 3 struct linger { int l_onoff; int l_linger; }; # 27 "/usr/include/netinet/in.h" 2 3 enum { IPPROTO_IP = 0, IPPROTO_HOPOPTS = 0, IPPROTO_ICMP = 1, IPPROTO_IGMP = 2, IPPROTO_IPIP = 4, IPPROTO_TCP = 6, IPPROTO_EGP = 8, IPPROTO_PUP = 12, IPPROTO_UDP = 17, IPPROTO_IDP = 22, IPPROTO_TP = 29, IPPROTO_IPV6 = 41, IPPROTO_ROUTING = 43, IPPROTO_FRAGMENT = 44, IPPROTO_RSVP = 46, IPPROTO_GRE = 47, IPPROTO_ESP = 50, IPPROTO_AH = 51, IPPROTO_ICMPV6 = 58, IPPROTO_NONE = 59, IPPROTO_DSTOPTS = 60, IPPROTO_MTP = 92, IPPROTO_ENCAP = 98, IPPROTO_PIM = 103, IPPROTO_COMP = 108, IPPROTO_RAW = 255, IPPROTO_MAX }; enum { IPPORT_ECHO = 7, IPPORT_DISCARD = 9, IPPORT_SYSTAT = 11, IPPORT_DAYTIME = 13, IPPORT_NETSTAT = 15, IPPORT_FTP = 21, IPPORT_TELNET = 23, IPPORT_SMTP = 25, IPPORT_TIMESERVER = 37, IPPORT_NAMESERVER = 42, IPPORT_WHOIS = 43, IPPORT_MTP = 57, IPPORT_TFTP = 69, IPPORT_RJE = 77, IPPORT_FINGER = 79, IPPORT_TTYLINK = 87, IPPORT_SUPDUP = 95, IPPORT_EXECSERVER = 512, IPPORT_LOGINSERVER = 513, IPPORT_CMDSERVER = 514, IPPORT_EFSSERVER = 520, IPPORT_BIFFUDP = 512, IPPORT_WHOSERVER = 513, IPPORT_ROUTESERVER = 520, IPPORT_RESERVED = 1024, IPPORT_USERRESERVED = 5000 }; struct in_addr { uint32_t s_addr; }; struct in6_addr { union { uint8_t u6_addr8[16]; uint16_t u6_addr16[8]; uint32_t u6_addr32[4]; } in6_u; }; extern const struct in6_addr in6addr_any; extern const struct in6_addr in6addr_loopback; struct sockaddr_in { sa_family_t sin_family ; uint16_t sin_port; struct in_addr sin_addr; unsigned char sin_zero[sizeof (struct sockaddr) - (sizeof (unsigned short int)) - sizeof (uint16_t) - sizeof (struct in_addr)]; }; struct sockaddr_in6 { sa_family_t sin6_family ; uint16_t sin6_port; uint32_t sin6_flowinfo; struct in6_addr sin6_addr; }; struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; unsigned int ipv6mr_interface; }; # 1 "/usr/include/bits/in.h" 1 3 struct ip_opts { struct in_addr ip_dst; char ip_opts[40]; }; struct ip_mreq { struct in_addr imr_multiaddr; struct in_addr imr_interface; }; struct ip_mreqn { struct in_addr imr_multiaddr; struct in_addr imr_address; int imr_ifindex; }; struct in_pktinfo { int ipi_ifindex; struct in_addr ipi_spec_dst; struct in_addr ipi_addr; }; # 225 "/usr/include/netinet/in.h" 2 3 extern uint32_t ntohl (uint32_t __netlong) ; extern uint16_t ntohs (uint16_t __netshort) ; extern uint32_t htonl (uint32_t __hostlong) ; extern uint16_t htons (uint16_t __hostshort) ; # 1 "/usr/include/bits/byteswap.h" 1 3 # 40 "/usr/include/bits/byteswap.h" 3 # 68 "/usr/include/bits/byteswap.h" 3 # 79 "/usr/include/bits/byteswap.h" 3 # 242 "/usr/include/netinet/in.h" 2 3 extern int bindresvport (int __sockfd, struct sockaddr_in *__sock_in) ; struct in6_pktinfo { struct in6_addr ipi6_addr; unsigned int ipi6_ifindex; }; # 9 "driverstub.c" 2 # 1 "/usr/include/zlib.h" 1 3 # 1 "/usr/include/zconf.h" 1 3 # 49 "/usr/include/zconf.h" 3 # 155 "/usr/include/zconf.h" 3 # 189 "/usr/include/zconf.h" 3 typedef unsigned char Byte; typedef unsigned int uInt; typedef unsigned long uLong; typedef Byte Bytef; typedef char charf; typedef int intf; typedef uInt uIntf; typedef uLong uLongf; typedef void *voidpf; typedef void *voidp; # 277 "/usr/include/zconf.h" 3 # 34 "/usr/include/zlib.h" 2 3 typedef voidpf (*alloc_func) (voidpf opaque, uInt items, uInt size) ; typedef void (*free_func) (voidpf opaque, voidpf address) ; struct internal_state; typedef struct z_stream_s { Bytef *next_in; uInt avail_in; uLong total_in; Bytef *next_out; uInt avail_out; uLong total_out; char *msg; struct internal_state *state; alloc_func zalloc; free_func zfree; voidpf opaque; int data_type; uLong adler; uLong reserved; } z_stream; typedef z_stream *z_streamp; extern const char * zlibVersion (void) ; extern int deflate (z_streamp strm, int flush) ; extern int deflateEnd (z_streamp strm) ; extern int inflate (z_streamp strm, int flush) ; extern int inflateEnd (z_streamp strm) ; extern int deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength) ; extern int deflateCopy (z_streamp dest, z_streamp source) ; extern int deflateReset (z_streamp strm) ; extern int deflateParams (z_streamp strm, int level, int strategy) ; extern int inflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength) ; extern int inflateSync (z_streamp strm) ; extern int inflateReset (z_streamp strm) ; extern int compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen) ; extern int compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level) ; extern int uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen) ; typedef voidp gzFile; extern gzFile gzopen (const char *path, const char *mode) ; extern gzFile gzdopen (int fd, const char *mode) ; extern int gzsetparams (gzFile file, int level, int strategy) ; extern int gzread (gzFile file, voidp buf, unsigned len) ; extern int gzwrite (gzFile file, const voidp buf, unsigned len) ; extern int gzprintf (gzFile file, const char *format, ...) ; extern int gzputs (gzFile file, const char *s) ; extern char * gzgets (gzFile file, char *buf, int len) ; extern int gzputc (gzFile file, int c) ; extern int gzgetc (gzFile file) ; extern int gzflush (gzFile file, int flush) ; extern long gzseek (gzFile file, long offset, int whence) ; extern int gzrewind (gzFile file) ; extern long gztell (gzFile file) ; extern int gzeof (gzFile file) ; extern int gzclose (gzFile file) ; extern const char * gzerror (gzFile file, int *errnum) ; extern uLong adler32 (uLong adler, const Bytef *buf, uInt len) ; extern uLong crc32 (uLong crc, const Bytef *buf, uInt len) ; extern int deflateInit_ (z_streamp strm, int level, const char *version, int stream_size) ; extern int inflateInit_ (z_streamp strm, const char *version, int stream_size) ; extern int deflateInit2_ (z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size) ; extern int inflateInit2_ (z_streamp strm, int windowBits, const char *version, int stream_size) ; struct internal_state {int dummy;}; extern const char * zError (int err) ; extern int inflateSyncPoint (z_streamp z) ; extern const uLongf * get_crc_table (void) ; # 10 "driverstub.c" 2 # 1 "/usr/include/signal.h" 1 3 # 1 "/usr/include/bits/sigset.h" 1 3 # 33 "/usr/include/bits/sigset.h" 3 # 97 "/usr/include/bits/sigset.h" 3 extern int __sigismember (__const __sigset_t *, int); extern int __sigaddset (__sigset_t *, int); extern int __sigdelset (__sigset_t *, int); # 122 "/usr/include/bits/sigset.h" 3 # 33 "/usr/include/signal.h" 2 3 typedef __sig_atomic_t sig_atomic_t; typedef __sigset_t sigset_t; # 1 "/usr/include/bits/signum.h" 1 3 # 56 "/usr/include/signal.h" 2 3 # 67 "/usr/include/signal.h" 3 typedef void (*__sighandler_t) (int) ; extern __sighandler_t __sysv_signal (int __sig, __sighandler_t __handler) ; extern __sighandler_t signal (int __sig, __sighandler_t __handler) ; # 96 "/usr/include/signal.h" 3 extern int kill (__pid_t __pid, int __sig) ; extern int killpg (__pid_t __pgrp, int __sig) ; extern int raise (int __sig) ; extern __sighandler_t ssignal (int __sig, __sighandler_t __handler) ; extern int gsignal (int __sig) ; extern void psignal (int __sig, __const char *__s) ; extern int __sigpause (int __sig_or_mask, int __is_sig) ; extern int sigpause (int __mask) ; extern int sigblock (int __mask) ; extern int sigsetmask (int __mask) ; extern int siggetmask (void) ; typedef __sighandler_t sig_t; # 1 "/usr/include/time.h" 1 3 # 51 "/usr/include/time.h" 3 # 62 "/usr/include/time.h" 3 # 73 "/usr/include/time.h" 3 # 89 "/usr/include/time.h" 3 # 279 "/usr/include/time.h" 3 # 191 "/usr/include/signal.h" 2 3 # 1 "/usr/include/bits/siginfo.h" 1 3 typedef union sigval { int sival_int; void *sival_ptr; } sigval_t; typedef struct siginfo { int si_signo; int si_errno; int si_code; union { int _pad[((128 / sizeof (int)) - 3) ]; struct { __pid_t si_pid; __uid_t si_uid; } _kill; struct { unsigned int _timer1; unsigned int _timer2; } _timer; struct { __pid_t si_pid; __uid_t si_uid; sigval_t si_sigval; } _rt; struct { __pid_t si_pid; __uid_t si_uid; int si_status; __clock_t si_utime; __clock_t si_stime; } _sigchld; struct { void *si_addr; } _sigfault; struct { int si_band; int si_fd; } _sigpoll; } _sifields; } siginfo_t; enum { SI_SIGIO = -5, SI_ASYNCIO, SI_MESGQ, SI_TIMER, SI_QUEUE, SI_USER }; enum { ILL_ILLOPC = 1, ILL_ILLOPN, ILL_ILLADR, ILL_ILLTRP, ILL_PRVOPC, ILL_PRVREG, ILL_COPROC, ILL_BADSTK }; enum { FPE_INTDIV = 1, FPE_INTOVF, FPE_FLTDIV, FPE_FLTOVF, FPE_FLTUND, FPE_FLTRES, FPE_FLTINV, FPE_FLTSUB }; enum { SEGV_MAPERR = 1, SEGV_ACCERR }; enum { BUS_ADRALN = 1, BUS_ADRERR, BUS_OBJERR }; enum { TRAP_BRKPT = 1, TRAP_TRACE }; enum { CLD_EXITED = 1, CLD_KILLED, CLD_DUMPED, CLD_TRAPPED, CLD_STOPPED, CLD_CONTINUED }; enum { POLL_IN = 1, POLL_OUT, POLL_MSG, POLL_ERR, POLL_PRI, POLL_HUP }; typedef struct sigevent { sigval_t sigev_value; int sigev_signo; int sigev_notify; union { int _pad[((64 / sizeof (int)) - 3) ]; struct { void (*_function) (sigval_t) ; void *_attribute; } _sigev_thread; } _sigev_un; } sigevent_t; enum { SIGEV_SIGNAL = 0, SIGEV_NONE, SIGEV_THREAD }; # 194 "/usr/include/signal.h" 2 3 extern int sigemptyset (sigset_t *__set) ; extern int sigfillset (sigset_t *__set) ; extern int sigaddset (sigset_t *__set, int __signo) ; extern int sigdelset (sigset_t *__set, int __signo) ; extern int sigismember (__const sigset_t *__set, int __signo) ; # 223 "/usr/include/signal.h" 3 # 1 "/usr/include/bits/sigaction.h" 1 3 struct sigaction { union { __sighandler_t sa_handler; void (*sa_sigaction) (int, siginfo_t *, void *) ; } __sigaction_handler; __sigset_t sa_mask; int sa_flags; void (*sa_restorer) (void) ; }; # 227 "/usr/include/signal.h" 2 3 extern int sigprocmask (int __how, __const sigset_t *__set, sigset_t *__oset) ; extern int sigsuspend (__const sigset_t *__set) ; extern int __sigaction (int __sig, __const struct sigaction *__act, struct sigaction *__oact) ; extern int sigaction (int __sig, __const struct sigaction *__act, struct sigaction *__oact) ; extern int sigpending (sigset_t *__set) ; extern int sigwait (__const sigset_t *__set, int *__sig) ; extern int sigwaitinfo (__const sigset_t *__set, siginfo_t *__info) ; extern int sigtimedwait (__const sigset_t *__set, siginfo_t *__info, __const struct timespec *__timeout) ; extern int sigqueue (__pid_t __pid, int __sig, __const union sigval __val) ; extern __const char *__const _sys_siglist[64 ]; extern __const char *__const sys_siglist[64 ]; struct sigvec { __sighandler_t sv_handler; int sv_mask; int sv_flags; }; extern int sigvec (int __sig, __const struct sigvec *__vec, struct sigvec *__ovec) ; # 1 "/usr/include/bits/sigcontext.h" 1 3 # 1 "/usr/include/asm/sigcontext.h" 1 3 struct _fpreg { unsigned short significand[4]; unsigned short exponent; }; struct _fpstate { unsigned long cw, sw, tag, ipoff, cssel, dataoff, datasel; struct _fpreg _st[8]; unsigned long status; }; struct sigcontext { unsigned short gs, __gsh; unsigned short fs, __fsh; unsigned short es, __esh; unsigned short ds, __dsh; unsigned long edi; unsigned long esi; unsigned long ebp; unsigned long esp; unsigned long ebx; unsigned long edx; unsigned long ecx; unsigned long eax; unsigned long trapno; unsigned long err; unsigned long eip; unsigned short cs, __csh; unsigned long eflags; unsigned long esp_at_signal; unsigned short ss, __ssh; struct _fpstate * fpstate; unsigned long oldmask; unsigned long cr2; }; # 28 "/usr/include/bits/sigcontext.h" 2 3 # 300 "/usr/include/signal.h" 2 3 extern int sigreturn (struct sigcontext *__scp) ; extern int siginterrupt (int __sig, int __interrupt) ; # 1 "/usr/include/bits/sigstack.h" 1 3 struct sigstack { void * ss_sp; int ss_onstack; }; enum { SS_ONSTACK = 1, SS_DISABLE }; typedef struct sigaltstack { void * ss_sp; int ss_flags; size_t ss_size; } stack_t; # 315 "/usr/include/signal.h" 2 3 extern int sigstack (struct sigstack *__ss, struct sigstack *__oss) ; extern int sigaltstack (__const struct sigaltstack *__ss, struct sigaltstack *__oss) ; # 350 "/usr/include/signal.h" 3 extern int __libc_current_sigrtmin (void) ; extern int __libc_current_sigrtmax (void) ; # 11 "driverstub.c" 2 splint-3.1.2.dfsg1/test/tests2.4/duffs.c0000644021234200000250000000050307121317337015265 0ustar faxvoid send (int *to, int *from, int count) { int n= (count + 7) / 8; switch (count % 8) { case 0: do {*to = *from++; case 7: *to = *from++; case 6: *to = *from++; case 5: *to = *from++; case 4: *to = *from++; case 3: *to = *from++; case 2: *to = *from++; case 1: *to = *from++; } while (--n>0); } } splint-3.1.2.dfsg1/test/tests2.4/emptycase.c0000644021234200000250000000011707121317337016151 0ustar faxvoid f (int x) { switch (x) { case 1: } switch (x) { default: } } splint-3.1.2.dfsg1/test/tests2.4/enumtest.c0000644021234200000250000000030107121317337016016 0ustar faxvoid (**sig_func)(void); void (**(sig_func1))(void); void s_f (int x) { if (x > 3) { (**sig_func)(); } else { (****sig_func1)(); /* No error - C apparently allows this... */ } } splint-3.1.2.dfsg1/test/tests2.4/error.c0000644021234200000250000000006007121317340015277 0ustar fax# if 0 # error print this # endif int x = 'a'; splint-3.1.2.dfsg1/test/tests2.4/fink.c0000644021234200000250000000037707121317340015110 0ustar faxenum { SCM_RIGHTS = 0x01, /* Transfer file descriptors. */ SCM_ASD = 3.42, __SCM_CONNECT = "asdf" /* Data array is `struct scm_connect'. */ }; __extension__ typedef long long int quad_t; typedef struct { int val[2]; } fsid_t; splint-3.1.2.dfsg1/test/tests2.4/flagequal.c0000644021234200000250000000012207320412014016101 0ustar faxint f (void) { /*@-type@*/ int x1 = 'a'; /*@=type@*/ int x2 = 'b'; } splint-3.1.2.dfsg1/test/tests2.4/forward.c0000644021234200000250000000013307320412015015607 0ustar fax# include "forward.h" /*@-macrofcndecl@*/ # define mmash(x) ((x) + 3) /*@=macrofcndecl@*/ splint-3.1.2.dfsg1/test/tests2.4/hash.c0000644021234200000250000000711107320412015015071 0ustar fax#include #include #include #include #include #include #include "hash.h" static int isprime(int number); static int nextprime(int number); static void hashexpand(hashtable *table); static unsigned chrhash(void *s, int M); static int chrcomp(void *s1, void *s2); static void * chrdupe(void *key); static unsigned inthash(void *s, int M); static int intcomp(void *s1, void *s2); static void * intdupe(void *i); void hashcreate(hashtable *table, keytype typ, int size) { table->size=nextprime(size); table->numkeys=0; if (typ == CHAR) { table->hashfunc=chrhash; table->compfunc=chrcomp; table->dupefunc=chrdupe; } else { /* INT */ table->hashfunc=inthash; table->compfunc=intcomp; table->dupefunc=intdupe; } assert((table->table=(calloc(table->size, sizeof(bucket *)))) != NULL); } void hashinsert(hashtable *table, void *key, void *val) { unsigned h=table->hashfunc(key, table->size); bucket *p; assert((p=(bucket *)malloc(sizeof(bucket))) != NULL); assert((p->key=table->dupefunc(key)) != NULL); p->val=val; for (; (table->table)[h] != NULL; h=(h+1)%table->size) ; (table->table)[h]=p; if (table->numkeys++ > table->size/2) hashexpand(table); } void * hashfind(hashtable *table, void *key) { register unsigned h=table->hashfunc(key, table->size); for (; (table->table)[h] != NULL; h=(h+1)%table->size) if (table->compfunc((table->table)[h]->key, key) == 0) return (table->table)[h]->val; return NULL; } void hashdelete(hashtable *table, void *key) { register unsigned h=table->hashfunc(key, table->size); for (; (table->table)[h] != NULL; h=(h+1)%table->size) { if (table->compfunc((table->table)[h]->key, key) == 0) { free((table->table)[h]->key); free((table->table)[h]->val); (table->table)[h]->key=(table->table)[h]->val=NULL; free((table->table)[h]); (table->table)[h]=NULL; } } } void hashforeach(hashtable *table, void (*func)(void *, void *)) { int l; for (l=0; lsize; l++) if ((table->table)[l] != NULL) func((table->table)[l]->key, (table->table)[l]->val); } void hashempty(hashtable *table) { int l; for (l=0; lsize; l++) { if ((table->table)[l] != NULL) { free((table->table)[l]->key); free((table->table)[l]->val); free((table->table)[l]); (table->table)[l]=NULL; } } table->numkeys=0; } static void hashexpand(hashtable *table) { int size, l; bucket **t; unsigned h; size=nextprime(table->size*2); assert((t=(calloc(size, sizeof(bucket *)))) != NULL); for (l=0; lsize; l++) { if ((table->table)[l] != NULL) { h=table->hashfunc((table->table)[l]->key, size); for (; t[h] != NULL; h=(h+1)%size) ; t[h]=(table->table)[l]; } } free(table->table); table->size=size; table->table=t; } static int nextprime(int number) { for (;!isprime(number);number++) ; return number; } static int isprime(int number) { int sqr, l; sqr=sqrt(number); for (l=2;l<=sqr;l++) if (number%l == 0) return 0; return 1; } static unsigned chrhash(void *p, int M) { register unsigned hashval; register char *s=p; for (hashval=0; *s!='\0'; s++) hashval=*s+31*hashval; return hashval%M; } static int chrcomp(void *s1, void *s2) { return strcmp((char *)s1, (char *)s2); } static void * chrdupe(void *key) { return (void *)strdup((char *)key); } static unsigned inthash(void *i, int M) { return *(int *)i%M; } static int intcomp(void *i1, void *i2) { return *(int *)i1-*(int *)i2; } static void * intdupe(void *i) { int *p; assert((p=(int *)malloc(sizeof(int))) != NULL); *p=*(int *)i; return p; } splint-3.1.2.dfsg1/test/tests2.4/hexconstants.c0000644021234200000250000000013007121317340016665 0ustar faxint f (void) { unsigned int m1 = 0xFF; unsigned int m2 = 0142; return m1 + m2; } splint-3.1.2.dfsg1/test/tests2.4/innercomment.c0000644021234200000250000000010107121317340016640 0ustar fax/* test /* yo */ /* tyohse /* asdfhgkjeh adfjkle */ splint-3.1.2.dfsg1/test/tests2.4/komazi.c0000644021234200000250000000004407121317340015442 0ustar faxvoid func(void) { goto End; End: } splint-3.1.2.dfsg1/test/tests2.4/longlong.c0000644021234200000250000000034707121317340015775 0ustar faxlong long llf (long long llx, long lx, long double lld) { int m = llx; /* int <- long long */ m = 243LL; lld = 3.542L; lx = 5234LL; lx = 5342L; llx = lx; lx = llx; /* long <- long long */ llx = m; return lx; } splint-3.1.2.dfsg1/test/tests2.4/main.c0000644021234200000250000000021507320412015015070 0ustar fax#include /* #include */ main() { int *p = (int *)malloc(sizeof(int)); int *j; *j = 1; printf("Hello"); } splint-3.1.2.dfsg1/test/tests2.4/nothing.c0000644021234200000250000000177507121317340015632 0ustar faxint main() { static void nfunc(void); nfunc(); return 0; } static void nfunc(){} /* From: "Johnson, Nathan E. (AZ76)" To: "'lclint-bug'" Subject: Mishandling of prototypes stated within functions Date: Wed, 26 May 1999 09:00:24 -0700 Importance: low X-Priority: 5 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain Using flags: +singleinclude -warnunixlib +unixlib The following program: ---------------------------- int main() { static void nothing(void); nothing(); return 0; } static void nothing(){} ------------------------------ yields: ------------------------------ LCLint 2.4b --- 18 Apr 98 lbug.c:7:13: File static function nothing declared but not used A function is declared but not used. Use @unused@ in front of function header to suppress message. (-fcnuse will suppress message) lbug.c:7:24: Definition of nothing Finished LCLint checking --- 1 code error found */ splint-3.1.2.dfsg1/test/tests2.4/offsetof.c0000644021234200000250000000035607121317340015771 0ustar fax# include typedef struct _S { union { int i; struct { int m; } s; } u; } S; int f () { size_t t; int m; t = offsetof (S, u.i); m = offsetof (S, u); t = offsetof (S, u.s.m); t = offsetof (S, u.s.k); return m; } splint-3.1.2.dfsg1/test/tests2.4/print.c0000644021234200000250000000015607121317340015310 0ustar fax# include int main (void) { int i; printf ("a%n\n", &i); printf ("%d\n", i); return 0; } splint-3.1.2.dfsg1/test/tests2.4/ric.c0000644021234200000250000000024507320412015014724 0ustar fax#include static void foo() {printf("%s()\n",__PRETTY_FUNCTION__);} int main() { if(bar() == 0) printf("%s()\n",__PRETTY_FUNCTION__); return 0; } splint-3.1.2.dfsg1/test/tests2.4/syncomment.c0000644021234200000250000000001107320412016016333 0ustar fax/*@only splint-3.1.2.dfsg1/test/tests2.4/syslog.c0000644021234200000250000000007707121317340015476 0ustar faxvoid f (char *s) { syslog (LOG_INFO, "error: %m (%s)", s); } splint-3.1.2.dfsg1/test/tests2.4/test0.c0000644021234200000250000000073307121317340015214 0ustar faxvoid test0(int value, int *data, int *result) { int i; int j; *result = 0; switch(value) { case 1: for(i=1;i<100;i++) { for(j=0;j<100;j++) { if(data[j] == i) goto RETURN; } } *result = 1; break; case 3: for(i=1;i<100;i++) { for(j=0;j<100;j++) { if(data[j] == 2*i+1) goto RETURN; } } *result = 2; break; default: *result = -1; break; } RETURN: /* *result = 0; // if this line is not here, lclint fails */ } splint-3.1.2.dfsg1/test/tests2.4/test1.c0000644021234200000250000000072707121317340015220 0ustar faxvoid test1(int value, int *data, int *result) { int i; int j; *result = 0; switch(value) { case 1: for(i=1;i<100;i++) { for(j=0;j<100;j++) { if(data[j] == i) goto RETURN; } } *result = 1; break; case 3: for(i=1;i<100;i++) { for(j=0;j<100;j++) { if(data[j] == 2*i+1) goto RETURN; } } *result = 2; break; default: *result = -1; break; } RETURN: // *result = 0; // if this line is not here, lclint fails } splint-3.1.2.dfsg1/test/tests2.4/test2.c0000644021234200000250000000062407121317340015215 0ustar faxvoid test2(int value, int *data, int *result) { int i; int j; *result = 0; switch(value) { case 1: for(i=1;i<100;i++) { for(j=0;j<100;j++) { if(data[j] == i) goto RETURN; } } *result = 1; break; case 3: for(i=1;i<100;i++) { for(j=0;j<100;j++) { if(data[j] == 2*i+1) goto RETURN; } } *result = 2; break; default: *result = -1; } RETURN: } splint-3.1.2.dfsg1/test/tests2.4/timecard.c0000644021234200000250000007106007320412016015743 0ustar fax/*************************************************************************** Timeclock A small program to collect timecard information ------------------- begin : Tue Feb 22 09:41:09 CST 2000 copyright : (C) 2000 by Stephen Toothman email : stephen.toothman@cicplan.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /*************************************************************************** * * * This is a complete GPL time clock system for small business. It will * * have a time clock, a reporting system, an user management system, and * * an administrative system for setting system options. The timeclock * * section will rely on several external files when it is finished. * * These files will be an administration file that holds the basic * * company information, such as when the pay week begins and when the * * pay week ends and in future versions may allow different payroll * * systems such as bi-monthly and monthly. The second file will hold a * * list of user ids and a flag for the privileges allowed individual * * user. The last file will be the timecard file that holds the * * individual timecard records. * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "timecard.h" int main(int argc, char *argv[]) { int i, j; char userid[4] = "zzz"; /* the user id or employee number */ int usertype = 0; /* the user type used to determine access */ int weekends = 0; i = initializeprogram(&userid[0], &usertype, &weekends); j = startprogram(&userid[0], &usertype, &weekends); return EXIT_SUCCESS; } int initializeprogram(char *puserid1, int *pusertype1, int *pweekends1) { int m, n, loop; char tempuser[4]; int tempusertype, tempweekends; m = getenvironment(&tempweekends); n = getuserid(&tempuser[0], &tempusertype); for( loop = 0; loop < 4; loop++) { *puserid1 = toupper((unsigned char) tempuser[loop]); puserid1 = puserid1 + 1; } *pusertype1 = tempusertype; *pweekends1 = tempweekends; return n; } int getenvironment(int *pweekends2) { FILE *fp; char fieldname[80]; int testvalue; fp = fopen("admin.txt", "r"); while ( !feof(fp)) { fscanf(fp, "%s %02d\n", fieldname, &testvalue); if (strcmp(fieldname, "WEEKENDS") == 0) { *pweekends2 = testvalue; } } fclose(fp); return 0; } int getuserid(char *puserid2, int *pusertype2) { char *z; char name[80]; int w = 0, x = 0, y, loop; FILE *fp; char testuserid[4]; int testrights; while (x == 0) { printf("Enter your user id\n"); z = fgets(name, 80, stdin); y = (z == NULL ? 0 : 1); for( loop = 0; loop < 4; loop++) { if (loop == 3 ) { *puserid2 = '\0'; } else { *puserid2 = toupper((unsigned char) name[loop]); puserid2 = puserid2 + 1; } } puserid2 = puserid2 - loop + 1; fp = fopen("userlist.txt", "r"); while ( !feof(fp) && x == 0) { fscanf(fp, "%s %02d\n", testuserid, &testrights); if (strcmp(puserid2, testuserid) == 0) { x = 1; *pusertype2 = testrights; } } fclose(fp); if ( x == 0 && w >= 1) { printf("You have entered an incorrect user id\n"); printf("Please contact your supervisor for assistance.\n"); printf("Press to exit\n") ; getchar(); exit(1); } if (x == 0 && w < 1) { printf("You have entered an incorrect user id\n"); printf("Please enter your information again.\n"); w += 1; } } return y; } int startprogram(char *puserid, int *pusertype, int *pweekends) { int m, n; char y[80]; printf("Please enter what action you wish to take %s -- %d -- %d\n", puserid, *pusertype, *pweekends); while (m < 1 || m > 4) { switch (*pusertype) { case 1 : printf(" 1 Use Timeclock.\n"); break; case 2 : printf(" 1 Use Timeclock.\n"); printf(" 2 Use Manager functions.\n"); break; case 3 : printf(" 1 Use Timeclock.\n"); printf(" 2 Use Manager functions.\n"); printf(" 3 Use Reporting functions.\n"); break; case 4 : printf(" 1 Use Timeclock.\n"); printf(" 2 Use Manager functions.\n"); printf(" 3 Use Reporting functions.\n"); printf(" 4 Use Administrative functions.\n"); break; default : printf(" 1 Use Timeclock.\n"); break; } printf("\nEnter an item from the list ===> "); fgets(y, 80, stdin); m = atoi(y); /* this if statement checks that an item on the menu was entered */ if (m < 1 || m > 4) { printf("\n"); printf("The number you entered is not valid.\n"); printf("\n"); printf("\n"); printf("the number must be from the list below. \n"); m = 0; } if ( m != 0) { switch (*pusertype) { case 1 : if (m != 1) { m = 99; } break; case 2 : if (m != 1 && m != 2) { m = 99; } break; case 3 : if (m != 1 && m != 2 && m != 3) { m = 99; } break; case 4 : if (m != 1 && m != 2 && m != 3 && m != 4) { m = 99; } break; default : if (m != 1) { m = 99; } break; } } if ( m == 99 ) { printf("\n"); printf("The number you entered is not valid.\n"); printf("That number is not an allowed choice.\n"); printf("\n"); printf("The number must be from the list below. \n"); m = 0; } } switch (m) { case 1 : { n = timecard(puserid, *pusertype, *pweekends); break; } case 2 : { n = manager(puserid, *pusertype, *pweekends); break; } case 3 : { n = reporter(puserid, *pusertype, *pweekends); break; } case 4 : { n = administrator(puserid, *pusertype, *pweekends); break; } default : { n = timecard(puserid, *pusertype, *pweekends); break; } } return 0; } int timecard(char userid[4], int usertype, int weekends) { int j, k, l, n, o, p, loop; /* return and miscellaneous variables */ timecardrecord currentpunch; int itemflag[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ; /* A flag array to hold whether a time card item has been used */ timecardrecord clockpunch[14]; /* an array of structures to hold previous time clock entries */ char weekstring[3]; /* filename portions */ char yearstring[5]; char filename[13]; /* The process works as follows: * * First the user id is obtained from the user * * Next the program gets the current time and gets the filename components * * Next the program generates a filename * * Next the program gets an action, clock in or clock out, from the user * * Finally the timecard record is outputed to a file */ for( loop = 0; loop < 4; loop++) { currentpunch.userid[loop] = userid[loop]; } j = gettimeanddate(¤tpunch, &weekstring[0], &yearstring[0], weekends); k = getfilename(&filename[0], &weekstring[0], &yearstring[0]); o = gettimecarddata(¤tpunch, &clockpunch[0], &itemflag[0], &filename[0]); p = printtimecarddata(¤tpunch, &clockpunch[0]); l = getaction(¤tpunch, &clockpunch[0], &itemflag[0]); n = writerecord(¤tpunch, &filename[0]); return n; } int gettimeanddate(timecardrecord *currentpunch, char *pweekstring, char *pyearstring, int weekends) { time_t now, test; struct tm *timenow, *timetest, *timetemp; int z, adjustfactor; int weekdaynow; int yeartest; char weekstringnow[3], weekstringtest[3]; char yearstringnow[5], yearstringtest[5]; /* get the current time information */ now = time(0); timenow = localtime(&now); /* assigns the time information */ currentpunch->hour = timenow->tm_hour; currentpunch->minute = timenow->tm_min; currentpunch->second = timenow->tm_sec; currentpunch->day = timenow->tm_mday; currentpunch->month = timenow->tm_mon + 1; currentpunch->year = timenow->tm_year + 1900; weekdaynow = timenow->tm_wday; strftime(weekstringnow, 3, "%U", timenow); strftime(yearstringnow, 5, "%Y", timenow); /* Find the adjustment needed to be added to the current time * to return the last day of the pay period */ adjustfactor = ((weekends <= weekdaynow) ? 6 - weekdaynow + weekends : weekends - weekdaynow - 1); /* get the time information of the last day of the payperiod */ timetemp = timenow; timetemp->tm_mday = timetemp->tm_mday + adjustfactor; test = mktime(timetemp); timetest = localtime(&test); yeartest = timetest->tm_year + 1900; strftime(weekstringtest, 3, "%U", timetest); strftime(yearstringtest, 5, "%Y", timetest); /* puts the correct information into the file name components */ strcpy(pweekstring, weekstringtest); if (currentpunch->year == yeartest) { strcpy(pyearstring, yearstringnow); } else { strcpy(pyearstring, yearstringtest); } z = 1; return z; } int getfilename(char *pfilename, char *pweekstring, char *pyearstring) { int z; /* this code generates the complete file name */ sprintf (pfilename, "tc%s%s.tcd", pyearstring, pweekstring); z = 1; return z; } int gettimecarddata(timecardrecord *currentpunch, timecardrecord *clockpunch, int *pitemflag, char *pfilename) { int a, b, c, d, w = 0, z, y; FILE *fp; char testuserid[4]; int testaction, testyear, testmonth, testday, testhour, testminute, testsecond; y = 1; while (w < 14) { strcpy(clockpunch[w].userid, " "); clockpunch[w].action = 0; clockpunch[w].month = 0; clockpunch[w].day = 0; clockpunch[w].year = 0; clockpunch[w].hour = 0; clockpunch[w].minute = 0; clockpunch[w].second = 0; w += 1; } if ((fp = fopen(pfilename, "r")) != NULL) { while ( !feof(fp)) { fscanf(fp, "%s %02d%02d%02d%04d%02d%02d%02d\n", testuserid, &testaction, &testmonth, &testday, &testyear, &testhour, &testminute, &testsecond); a = strcmp(currentpunch->userid, testuserid); b = (currentpunch->month == testmonth ? 0 : 1); c = (currentpunch->day == testday ? 0 : 1); d = (currentpunch->year == testyear ? 0 : 1); y = ((a == 0 && b == 0 && c == 0 && d == 0) ? 0 : 1); if (y == 0) { z = testaction - 1; strcpy(clockpunch[z].userid, testuserid); clockpunch[z].action = testaction; clockpunch[z].month = testmonth; clockpunch[z].day = testday; clockpunch[z].year = testyear; clockpunch[z].hour = testhour; clockpunch[z].minute = testminute; clockpunch[z].second = testsecond; pitemflag[z] = 1; } } fclose(fp); } return 0; } int printtimecarddata(timecardrecord *currentpunch, timecardrecord *clockpunch) { int y = 0, z; clearscreen(); printf("\n\n%s- -%02d-%02d-%04d-%02d-%02d-%02d\n\n", currentpunch->userid, currentpunch->month, currentpunch->day, currentpunch->year, currentpunch->hour, currentpunch->minute, currentpunch->second); while (y < 14) { z = strcmp(clockpunch[y].userid, currentpunch->userid); if (0 == z) { printf("%s-%02d-%02d-%02d-%04d-%02d-%02d-%02d\n", clockpunch[y].userid, clockpunch[y].action, clockpunch[y].month, clockpunch[y].day, clockpunch[y].year, clockpunch[y].hour, clockpunch[y].minute, clockpunch[y].second); } y += 1; } printf("\n"); return 0; } int getaction(timecardrecord *currentpunch, timecardrecord *clockpunch, int *pitemflag) { int u, v = 0, w = 0, x = 0, z; int i = 0; char y[80]; /* This is the action menu */ if (pitemflag[0] == 1) { while (w < 14) { u = (clockpunch[w].hour*10000)+(clockpunch[w].minute*100)+(clockpunch[w].second); if (u >= v) { v = u; x = clockpunch[w].action; } if (clockpunch[w].action == 6) { w = 14; v = 6; } w += 1; } } else { x = 0; } while (i < 1 || i > 14) { printf("Please enter what action you wish to take\n"); switch (x) { case 0 : printf(" 1 Clock in for the day.\n"); break; case 1 : printf(" 2 Clock out for lunch.\n"); printf(" 6 Clock out for the day.\n"); printf(" 7 Clock out for first break.\n"); break; case 2 : printf(" 3 Clock in from lunch.\n"); break; case 3 : printf(" 4 Clock out for dinner.\n"); printf(" 6 Clock out for the day.\n"); if (pitemflag[6] == 0) { printf(" 7 Clock out for first break.\n"); } else if (pitemflag[8] == 0) { printf(" 9 Clock out for second break.\n"); } else if (pitemflag[10] == 0) { printf("11 Clock out for third break.\n"); } else if (pitemflag[12] == 0) { printf("13 Clock out for fourth break.\n"); } break; case 4 : printf(" 5 Clock in from dinner.\n"); break; case 5 : printf(" 6 Clock out for the day.\n"); if (pitemflag[6] == 0) { printf(" 7 Clock out for first break.\n"); } else if (pitemflag[8] == 0) { printf(" 9 Clock out for second break.\n"); } else if (pitemflag[10] == 0) { printf("11 Clock out for third break.\n"); } else if (pitemflag[12] == 0) { printf("13 Clock out for fourth break.\n"); } break; case 6 : printf("\n\nYou have exhausted all of your options for today\n"); printf("Please contact your supervisor if you believe\n"); printf("you have received this message in error or you\n"); printf("are not finished working for today.\n"); printf("Press to exit\n") ; getchar(); exit(1); break; case 7 : printf(" 8 Clock in from first break.\n"); break; case 8 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); printf(" 9 Clock out for second break.\n"); break; case 9 : printf("10 Clock in from second break.\n"); break; case 10 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); printf("11 Clock out for third break.\n"); break; case 11 : printf("12 Clock in from third break.\n"); break; case 12 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); printf("13 Clock out for fourth break.\n"); break; case 13 : printf("14 Clock in from fourth break.\n"); break; case 14 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); break; } printf("\nEnter an item from the list ===> "); fgets(y, 80, stdin); i = atoi(y); /* this if statement checks that an item on the menu was entered */ if (i < 1 || i > 14) { printf("\n"); printf("The number you entered is not valid.\n"); printf("\n"); printf("\n"); printf("the number must be from the list below. \n"); i = 0; } /* This section of code makes sure that a menu item is only used once */ if ( i != 0) { i = (pitemflag[i-1] == 1 ? 98 : i); if ( i == 98 ) { printf("\n"); printf("The number you entered is not valid.\n"); printf("You have already used that action for today\n"); printf("\n"); printf("the number must be from the list below. \n"); i = 0; } } if ( i != 0) { switch (x) { case 0 : if (i != 1) { i = 99; } break; case 1 : if (i != 2 && i != 6 && i != 7) { i = 99; } break; case 2 : if (i != 3) { i = 99; } break; case 3 : if (pitemflag[6] == 0) { if (i != 4 && i != 6 && i != 7) { i = 99; } } else if (pitemflag[8] == 0) { if (i != 4 && i != 6 && i != 9) { i = 99; } } else if (pitemflag[10] == 0) { if (i != 4 && i != 6 && i != 11) { i = 99; } } else if (pitemflag[12] == 0) { if (i != 4 && i != 6 && i != 13) { i = 99; } } break; case 4 : if (i != 5) { i = 99; } break; case 5 : if (pitemflag[6] == 0) { if (i != 6 && i != 7) { i = 99; } } else if (pitemflag[8] == 0) { if (i != 6 && i != 9) { i = 99; } } else if (pitemflag[10] == 0) { if (i != 6 && i != 11) { i = 99; } } else if (pitemflag[12] == 0) { if (i != 6 && i != 13) { i = 99; } } break; case 6 : printf("You have exhausted all of your options for today\n"); printf("Please contact your supervisor if you believe\n"); printf("you have received this message in error or you\n"); printf("are not finished working for today.\n"); printf("Press to exit\n") ; getchar(); exit(1); break; case 7 : if (i != 8) { i = 99; } break; case 8 : if (pitemflag[1] == 0) { if (i != 2 && i != 6 && i != 9) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6 && i != 9) { i = 99; } } break; case 9 : if (i != 10) { i = 99; } break; case 10 : if (pitemflag[1] == 0) { if (i != 2 && i != 6 && i != 11) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6 && i != 11) { i = 99; } } break; case 11 : if (i != 12) { i = 99; } break; case 12 : if (pitemflag[1] == 0) { if (i != 2 && i != 6 && i != 13) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6 && i != 13) { i = 99; } } break; case 13 : if (i != 14) { i = 99; } break; case 14 : if (pitemflag[1] == 0) { if (i != 2 && i != 6) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6) { i = 99; } } break; } if ( i == 99 ) { printf("\n"); printf("The number you entered is not valid.\n"); printf("That number is not an allowed choice.\n"); printf("\n"); printf("The number must be from the list below. \n"); i = 0; } } } /* If everything is correct the program assigns the action code to the pointer */ currentpunch->action = i; z = 1; return z; } int writerecord(timecardrecord *currentpunch, char *pfilename) { int a, b, c, d, e, f, g, h, z, y; FILE *fp; char testuserid[4]; int testaction, testyear, testmonth, testday, testhour, testminute, testsecond; /* opens the file and writes the timecard record to it */ fp = fopen(pfilename, "a"); fprintf(fp, "%s %02d%02d%02d%04d%02d%02d%02d\n", currentpunch->userid, currentpunch->action, currentpunch->month, currentpunch->day, currentpunch->year, currentpunch->hour, currentpunch->minute, currentpunch->second); fclose(fp); /* opens the file and reads back in the record just entered */ fp = fopen(pfilename, "r"); y = 1; while ( y != 0) { fscanf(fp, "%s %02d%02d%02d%04d%02d%02d%02d\n", testuserid, &testaction, &testmonth, &testday, &testyear, &testhour, &testminute, &testsecond); a = strcmp(currentpunch->userid, testuserid); b = (currentpunch->action == testaction ? 0 : 1); c = (currentpunch->month == testmonth ? 0 : 1); d = (currentpunch->day == testday ? 0 : 1); e = (currentpunch->year == testyear ? 0 : 1); f = (currentpunch->hour == testhour ? 0 : 1); g = (currentpunch->minute == testminute ? 0 : 1); h = (currentpunch->second == testsecond ? 0 : 1); y = a + b + c + d + e + f + g + h; } fclose(fp); /* prints both copys of the information for verification */ printf("\nprinted to filename %s - %s-%02d-%02d-%02d-%04d-%02d-%02d-%02d\n", pfilename, currentpunch->userid, currentpunch->action, currentpunch->month, currentpunch->day, currentpunch->year, currentpunch->hour, currentpunch->minute, currentpunch->second); printf("read from filename %s - %s-%02d-%02d-%02d-%04d-%02d-%02d-%02d\n", pfilename, testuserid, testaction, testmonth, testday, testyear, testhour, testminute, testsecond); printf("\n\nPress to exit\n") ; getchar(); z = 1; return z; } int manager(char userid[4], int usertype, int weekends) { clearscreen(); printf("\n\nManager Functions"); printf("\n\nPress to exit\n"); getchar(); return 0; } int reporter(char userid[4], int usertype, int weekends) { char usefile[12]; int a, b; a = usefilename(&usefile[0]); if (a != 1) { b = printhoursreport(usefile, weekends); } exit(0); } int usefilename(char *pusefile) { int h = 0, j; char y[80], z[13]; FILE *fp; while (h == 0) { printf("Enter the name of the file you wish to open\n"); printf("\nThe format for the name is \"tc.tcd\"\n"); printf("This means the third week of the year 2000 would be\n"); printf("written tc200003.scd.\n"); printf("Type \"quit\" to quit the program.\n"); printf("Filename : "); fgets(y, 80, stdin); for (j = 0; j < 13; j++) { if (j == 13) { z[j] = '\0'; } else { if (y[j] != '\n') { z[j] = y[j]; } else { z[j] = '\0'; j = 13; } } } if (!strcmp(y , "quit\n")) { printf("quiting\n"); return 1; } if ( (fp = fopen(z, "r")) != NULL) { h = 1; fclose(fp); strcpy(pusefile, z); } else { printf("There was an error opening %s. Please try\n", pusefile); printf("entering the file name again\n"); h = 0; } } return 0; } int printhoursreport(char usefile[12], int weekends) { int e, f; char reportfile[12]; e = reportfilename(usefile, &reportfile[0]); f = writereportdata(usefile, reportfile, weekends); return 0; } int reportfilename(char usefile[12], char *preportfile) { int y; char z[7]; for (y = 2; y <= 8; y++) { if ( y == 8) { z[y - 2] = '\0'; } else { z[y - 2] = usefile[y]; } } sprintf (preportfile, "th%s.tcr", z); return 0; } int writereportdata(char usefile[12], char reportfile[12], int weekends) { int i,j; daterecord filedates[7]; i = getreportdates(usefile, &filedates[0], weekends); j = generatereport(usefile, reportfile, filedates); return 0; } int getreportdates(char usefile[12], daterecord *pfiledates, int weekends) { time_t now, test; struct tm *timenow, *timetest, *timetemp; int a, y, z = 1; int weekfile, weektest; int yearfile; int weekdaynow; char weekstringfile[3], weekstringtest[3]; char yearstringfile[5]; /* get the first of year time information */ for (y = 2; y <= 6; y++) { if (y == 6) { yearstringfile[y - 2] = '\0'; } else { yearstringfile[y - 2] = usefile[y]; } } for (y = 6; y <= 8; y++) { if (y == 8) { weekstringfile[y - 6] = '\0'; } else { weekstringfile[y - 6] = usefile[y]; } } weekfile = atoi(weekstringfile); yearfile = atoi(yearstringfile); now = time(0); timenow = localtime(&now); timetemp = timenow; timetemp->tm_year = yearfile - 1900; timetemp->tm_mon = 0; timetemp->tm_mday = 1; test = mktime(timetemp); timetest = localtime(&test); weekdaynow = timetest->tm_wday; if (weekdaynow <= weekends) { timetemp->tm_mday = timetemp->tm_mday + (6 - weekdaynow + weekends); test = mktime(timetemp); timetest = localtime(&test); timetemp = timetest; strftime(weekstringtest, 3, "%U", timetest); weektest = atoi(weekstringtest); } else { timetemp->tm_mday = timetemp->tm_mday + (weekends - weekdaynow); test = mktime(timetemp); timetest = localtime(&test); timetemp = timetest; strftime(weekstringtest, 3, "%U", timetest); weektest = atoi(weekstringtest); } while (weektest != weekfile) { timetemp->tm_mday = timetemp->tm_mday + 7; test = mktime(timetemp); timetest = localtime(&test); timetemp = timetest; strftime(weekstringtest, 3, "%U", timetest); weektest = atoi(weekstringtest); } timetemp->tm_mday = timenow->tm_mday - 7; test = mktime(timetemp); timetest = localtime(&test); for (z = 0; z < 7; z++) { timetemp->tm_mday = timetemp->tm_mday + 1; test = mktime(timetemp); timetest = localtime(&test); pfiledates[z].day = timetest->tm_mday; pfiledates[z].month = timetest->tm_mon + 1; pfiledates[z].year = timetest->tm_year + 1900; } return 0; } int generatereport(char usefile[12], char reportfile[12], daterecord filedates[7]) { int a, b, c, d, e, f, y; FILE *fp, *fq, *fr; char testuserid1[4], testuserid2[4]; int testaction, testyear, testmonth, testday, testhour, testminute, testsecond, testrights; float worktime, breaktime; float reporttimes[14] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0} ; /* A flag array to hold whether a time card item has been used */ timecardrecord reportpunch[14]; /* an array of structures to hold previous time clock entries */ fp = fopen("userlist.txt", "r"); fr = fopen(reportfile, "w"); while (!feof(fp)) { fscanf(fp, "%s %02d\n", testuserid1, &testrights); fprintf(fr, "%s\n", testuserid1); fprintf(fr, "Date of Work Work Hours Break Hours\n"); for (a = 0; a < 7; a++) { for (b = 0; b < 14; b++) { strcpy(reportpunch[b].userid, " "); reportpunch[b].action = 0; reportpunch[b].month = 0; reportpunch[b].day = 0; reportpunch[b].year = 0; reportpunch[b].hour = 0; reportpunch[b].minute = 0; reportpunch[b].second = 0; reporttimes[b] = 0.0; } if ((fq = fopen(usefile, "r")) != NULL) { while ( !feof(fq)) { fscanf(fq, "%s %02d%02d%02d%04d%02d%02d%02d\n", testuserid2, &testaction, &testmonth, &testday, &testyear, &testhour, &testminute, &testsecond); e = strcmp(testuserid1, testuserid2); f = (filedates[a].month == testmonth ? 0 : 1); c = (filedates[a].day == testday ? 0 : 1); d = (filedates[a].year == testyear ? 0 : 1); y = ((e == 0 && f == 0 && c == 0 && d == 0) ? 0 : 1); if (y == 0) { strcpy(reportpunch[testaction].userid, testuserid2); reportpunch[testaction - 1].action = testaction; reportpunch[testaction - 1].month = testmonth; reportpunch[testaction - 1].day = testday; reportpunch[testaction - 1].year = testyear; reportpunch[testaction - 1].hour = testhour; reportpunch[testaction - 1].minute = testminute; reportpunch[testaction - 1].second = testsecond; reporttimes[testaction - 1] = (float)(testhour) + (float)(testminute/60.0); reporttimes[testaction - 1] = (((int)(reporttimes[testaction - 1]*100) % 1 >= 5) ? (((reporttimes[testaction - 1]*100)+ 1)/100.0) : (((reporttimes[testaction - 1]*100)+ 0)/100.0)); } } fclose(fq); breaktime = (reporttimes[7]-reporttimes[6]) + (reporttimes[9]-reporttimes[8]) + (reporttimes[11]-reporttimes[10]) + (reporttimes[13]-reporttimes[12]); worktime = (reporttimes[5]-reporttimes[0]) - (reporttimes[2]-reporttimes[1]) - (reporttimes[4]-reporttimes[3]); fprintf(fr, " %02d/%02d/%04d %9.2f %10.2f\n", filedates[a].month, filedates[a].day, filedates[a].year, worktime, breaktime); } } } fclose(fr); fclose(fp); return 0; } int administrator(char userid[4], int usertype, int weekends) { clearscreen(); printf("\n\nAdministrator Functions"); printf("\n\nPress to exit\n"); getchar(); return 0; } void clearscreen(void) { int c, d; for (c = 0; c <= 100; c++) { for (d = 0; d <= 200; d++) { printf(" "); } printf("\n"); } } splint-3.1.2.dfsg1/test/tests2.4/toothman.c0000644021234200000250000007106507320412016016011 0ustar fax/*************************************************************************** Timeclock A small program to collect timecard information ------------------- begin : Tue Feb 22 09:41:09 CST 2000 copyright : (C) 2000 by Stephen Toothman email : stephen.toothman@cicplan.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /*************************************************************************** * * * This is a complete GPL time clock system for small business. It will * * have a time clock, a reporting system, an user management system, and * * an administrative system for setting system options. The timeclock * * section will rely on several external files when it is finished. * * These files will be an administration file that holds the basic * * company information, such as when the pay week begins and when the * * pay week ends and in future versions may allow different payroll * * systems such as bi-monthly and monthly. The second file will hold a * * list of user ids and a flag for the privileges allowed individual * * user. The last file will be the timecard file that holds the * * individual timecard records. * * * ***************************************************************************/ #ifdef HAVE_CONFIG_H #include #endif #include #include #include #include #include #include "timeclock.h" */ int main(int argc, char *argv[]) { int i, j; char userid[4] = "zzz"; /* the user id or employee number */ int usertype = 0; /* the user type used to determine access */ int weekends = 0; i = initializeprogram(&userid[0], &usertype, &weekends); j = startprogram(&userid[0], &usertype, &weekends); return EXIT_SUCCESS; } int initializeprogram(char *puserid1, int *pusertype1, int *pweekends1) { int m, n, loop; char tempuser[4]; int tempusertype, tempweekends; m = getenvironment(&tempweekends); n = getuserid(&tempuser[0], &tempusertype); for( loop = 0; loop < 4; loop++) { *puserid1 = toupper((unsigned char) tempuser[loop]); puserid1 = puserid1 + 1; } *pusertype1 = tempusertype; *pweekends1 = tempweekends; return n; } int getenvironment(int *pweekends2) { FILE *fp; char fieldname[80]; int testvalue; fp = fopen("admin.txt", "r"); while ( !feof(fp)) { fscanf(fp, "%s %02d\n", fieldname, &testvalue); if (strcmp(fieldname, "WEEKENDS") == 0) { *pweekends2 = testvalue; } } fclose(fp); return 0; } int getuserid(char *puserid2, int *pusertype2) { char *z; char name[80]; int w = 0, x = 0, y, loop; FILE *fp; char testuserid[4]; int testrights; while (x == 0) { printf("Enter your user id\n"); z = fgets(name, 80, stdin); y = (z == NULL ? 0 : 1); for( loop = 0; loop < 4; loop++) { if (loop == 3 ) { *puserid2 = '\0'; } else { *puserid2 = toupper((unsigned char) name[loop]); puserid2 = puserid2 + 1; } } puserid2 = puserid2 - loop + 1; fp = fopen("userlist.txt", "r"); while ( !feof(fp) && x == 0) { fscanf(fp, "%s %02d\n", testuserid, &testrights); if (strcmp(puserid2, testuserid) == 0) { x = 1; *pusertype2 = testrights; } } fclose(fp); if ( x == 0 && w >= 1) { printf("You have entered an incorrect user id\n"); printf("Please contact your supervisor for assistance.\n"); printf("Press to exit\n") ; getchar(); exit(1); } if (x == 0 && w < 1) { printf("You have entered an incorrect user id\n"); printf("Please enter your information again.\n"); w += 1; } } return y; } int startprogram(char *puserid, int *pusertype, int *pweekends) { int m, n; char y[80]; printf("Please enter what action you wish to take %s -- %d -- %d\n", puserid, *pusertype, *pweekends); while (m < 1 || m > 4) { switch (*pusertype) { case 1 : printf(" 1 Use Timeclock.\n"); break; case 2 : printf(" 1 Use Timeclock.\n"); printf(" 2 Use Manager functions.\n"); break; case 3 : printf(" 1 Use Timeclock.\n"); printf(" 2 Use Manager functions.\n"); printf(" 3 Use Reporting functions.\n"); break; case 4 : printf(" 1 Use Timeclock.\n"); printf(" 2 Use Manager functions.\n"); printf(" 3 Use Reporting functions.\n"); printf(" 4 Use Administrative functions.\n"); break; default : printf(" 1 Use Timeclock.\n"); break; } printf("\nEnter an item from the list ===> "); fgets(y, 80, stdin); m = atoi(y); /* this if statement checks that an item on the menu was entered */ if (m < 1 || m > 4) { printf("\n"); printf("The number you entered is not valid.\n"); printf("\n"); printf("\n"); printf("the number must be from the list below. \n"); m = 0; } if ( m != 0) { switch (*pusertype) { case 1 : if (m != 1) { m = 99; } break; case 2 : if (m != 1 && m != 2) { m = 99; } break; case 3 : if (m != 1 && m != 2 && m != 3) { m = 99; } break; case 4 : if (m != 1 && m != 2 && m != 3 && m != 4) { m = 99; } break; default : if (m != 1) { m = 99; } break; } } if ( m == 99 ) { printf("\n"); printf("The number you entered is not valid.\n"); printf("That number is not an allowed choice.\n"); printf("\n"); printf("The number must be from the list below. \n"); m = 0; } } switch (m) { case 1 : { n = timecard(puserid, *pusertype, *pweekends); break; } case 2 : { n = manager(puserid, *pusertype, *pweekends); break; } case 3 : { n = reporter(puserid, *pusertype, *pweekends); break; } case 4 : { n = administrator(puserid, *pusertype, *pweekends); break; } default : { n = timecard(puserid, *pusertype, *pweekends); break; } } return 0; } int timecard(char userid[4], int usertype, int weekends) { int j, k, l, n, o, p, loop; /* return and miscellaneous variables */ timecardrecord currentpunch; int itemflag[14] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} ; /* A flag array to hold whether a time card item has been used */ timecardrecord clockpunch[14]; /* an array of structures to hold previous time clock entries */ char weekstring[3]; /* filename portions */ char yearstring[5]; char filename[13]; /* The process works as follows: * * First the user id is obtained from the user * * Next the program gets the current time and gets the filename components * * Next the program generates a filename * * Next the program gets an action, clock in or clock out, from the user * * Finally the timecard record is outputed to a file */ for( loop = 0; loop < 4; loop++) { currentpunch.userid[loop] = userid[loop]; } j = gettimeanddate(¤tpunch, &weekstring[0], &yearstring[0], weekends); k = getfilename(&filename[0], &weekstring[0], &yearstring[0]); o = gettimecarddata(¤tpunch, &clockpunch[0], &itemflag[0], &filename[0]); p = printtimecarddata(¤tpunch, &clockpunch[0]); l = getaction(¤tpunch, &clockpunch[0], &itemflag[0]); n = writerecord(¤tpunch, &filename[0]); return n; } int gettimeanddate(timecardrecord *currentpunch, char *pweekstring, char *pyearstring, int weekends) { time_t now, test; struct tm *timenow, *timetest, *timetemp; int z, adjustfactor; int weekdaynow; int yeartest; char weekstringnow[3], weekstringtest[3]; char yearstringnow[5], yearstringtest[5]; /* get the current time information */ now = time(0); timenow = localtime(&now); /* assigns the time information */ currentpunch->hour = timenow->tm_hour; currentpunch->minute = timenow->tm_min; currentpunch->second = timenow->tm_sec; currentpunch->day = timenow->tm_mday; currentpunch->month = timenow->tm_mon + 1; currentpunch->year = timenow->tm_year + 1900; weekdaynow = timenow->tm_wday; strftime(weekstringnow, 3, "%U", timenow); strftime(yearstringnow, 5, "%Y", timenow); /* Find the adjustment needed to be added to the current time * to return the last day of the pay period */ adjustfactor = ((weekends <= weekdaynow) ? 6 - weekdaynow + weekends : weekends - weekdaynow - 1); /* get the time information of the last day of the payperiod */ timetemp = timenow; timetemp->tm_mday = timetemp->tm_mday + adjustfactor; test = mktime(timetemp); timetest = localtime(&test); yeartest = timetest->tm_year + 1900; strftime(weekstringtest, 3, "%U", timetest); strftime(yearstringtest, 5, "%Y", timetest); /* puts the correct information into the file name components */ strcpy(pweekstring, weekstringtest); if (currentpunch->year == yeartest) { strcpy(pyearstring, yearstringnow); } else { strcpy(pyearstring, yearstringtest); } z = 1; return z; } int getfilename(char *pfilename, char *pweekstring, char *pyearstring) { int z; /* this code generates the complete file name */ sprintf (pfilename, "tc%s%s.tcd", pyearstring, pweekstring); z = 1; return z; } int gettimecarddata(timecardrecord *currentpunch, timecardrecord *clockpunch, int *pitemflag, char *pfilename) { int a, b, c, d, w = 0, z, y; FILE *fp; char testuserid[4]; int testaction, testyear, testmonth, testday, testhour, testminute, testsecond; y = 1; while (w < 14) { strcpy(clockpunch[w].userid, " "); clockpunch[w].action = 0; clockpunch[w].month = 0; clockpunch[w].day = 0; clockpunch[w].year = 0; clockpunch[w].hour = 0; clockpunch[w].minute = 0; clockpunch[w].second = 0; w += 1; } if ((fp = fopen(pfilename, "r")) != NULL) { while ( !feof(fp)) { fscanf(fp, "%s %02d%02d%02d%04d%02d%02d%02d\n", testuserid, &testaction, &testmonth, &testday, &testyear, &testhour, &testminute, &testsecond); a = strcmp(currentpunch->userid, testuserid); b = (currentpunch->month == testmonth ? 0 : 1); c = (currentpunch->day == testday ? 0 : 1); d = (currentpunch->year == testyear ? 0 : 1); y = ((a == 0 && b == 0 && c == 0 && d == 0) ? 0 : 1); if (y == 0) { z = testaction - 1; strcpy(clockpunch[z].userid, testuserid); clockpunch[z].action = testaction; clockpunch[z].month = testmonth; clockpunch[z].day = testday; clockpunch[z].year = testyear; clockpunch[z].hour = testhour; clockpunch[z].minute = testminute; clockpunch[z].second = testsecond; pitemflag[z] = 1; } } fclose(fp); } return 0; } int printtimecarddata(timecardrecord *currentpunch, timecardrecord *clockpunch) { int y = 0, z; clearscreen(); printf("\n\n%s- -%02d-%02d-%04d-%02d-%02d-%02d\n\n", currentpunch->userid, currentpunch->month, currentpunch->day, currentpunch->year, currentpunch->hour, currentpunch->minute, currentpunch->second); while (y < 14) { z = strcmp(clockpunch[y].userid, currentpunch->userid); if (0 == z) { printf("%s-%02d-%02d-%02d-%04d-%02d-%02d-%02d\n", clockpunch[y].userid, clockpunch[y].action, clockpunch[y].month, clockpunch[y].day, clockpunch[y].year, clockpunch[y].hour, clockpunch[y].minute, clockpunch[y].second); } y += 1; } printf("\n"); return 0; } int getaction(timecardrecord *currentpunch, timecardrecord *clockpunch, int *pitemflag) { int u, v = 0, w = 0, x = 0, z; int i = 0; char y[80]; /* This is the action menu */ if (pitemflag[0] == 1) { while (w < 14) { u = (clockpunch[w].hour*10000)+(clockpunch[w].minute*100)+(clockpunch[w].second); if (u >= v) { v = u; x = clockpunch[w].action; } if (clockpunch[w].action == 6) { w = 14; v = 6; } w += 1; } } else { x = 0; } while (i < 1 || i > 14) { printf("Please enter what action you wish to take\n"); switch (x) { case 0 : printf(" 1 Clock in for the day.\n"); break; case 1 : printf(" 2 Clock out for lunch.\n"); printf(" 6 Clock out for the day.\n"); printf(" 7 Clock out for first break.\n"); break; case 2 : printf(" 3 Clock in from lunch.\n"); break; case 3 : printf(" 4 Clock out for dinner.\n"); printf(" 6 Clock out for the day.\n"); if (pitemflag[6] == 0) { printf(" 7 Clock out for first break.\n"); } else if (pitemflag[8] == 0) { printf(" 9 Clock out for second break.\n"); } else if (pitemflag[10] == 0) { printf("11 Clock out for third break.\n"); } else if (pitemflag[12] == 0) { printf("13 Clock out for fourth break.\n"); } break; case 4 : printf(" 5 Clock in from dinner.\n"); break; case 5 : printf(" 6 Clock out for the day.\n"); if (pitemflag[6] == 0) { printf(" 7 Clock out for first break.\n"); } else if (pitemflag[8] == 0) { printf(" 9 Clock out for second break.\n"); } else if (pitemflag[10] == 0) { printf("11 Clock out for third break.\n"); } else if (pitemflag[12] == 0) { printf("13 Clock out for fourth break.\n"); } break; case 6 : printf("\n\nYou have exhausted all of your options for today\n"); printf("Please contact your supervisor if you believe\n"); printf("you have received this message in error or you\n"); printf("are not finished working for today.\n"); printf("Press to exit\n") ; getchar(); exit(1); break; case 7 : printf(" 8 Clock in from first break.\n"); break; case 8 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); printf(" 9 Clock out for second break.\n"); break; case 9 : printf("10 Clock in from second break.\n"); break; case 10 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); printf("11 Clock out for third break.\n"); break; case 11 : printf("12 Clock in from third break.\n"); break; case 12 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); printf("13 Clock out for fourth break.\n"); break; case 13 : printf("14 Clock in from fourth break.\n"); break; case 14 : if (pitemflag[1] == 0) { printf(" 2 Clock out for lunch.\n"); } else if (pitemflag[3] == 0) { printf(" 4 Clock out for dinner.\n"); } printf(" 6 Clock out for the day.\n"); break; } printf("\nEnter an item from the list ===> "); fgets(y, 80, stdin); i = atoi(y); /* this if statement checks that an item on the menu was entered */ if (i < 1 || i > 14) { printf("\n"); printf("The number you entered is not valid.\n"); printf("\n"); printf("\n"); printf("the number must be from the list below. \n"); i = 0; } /* This section of code makes sure that a menu item is only used once */ if ( i != 0) { i = (pitemflag[i-1] == 1 ? 98 : i); if ( i == 98 ) { printf("\n"); printf("The number you entered is not valid.\n"); printf("You have already used that action for today\n"); printf("\n"); printf("the number must be from the list below. \n"); i = 0; } } if ( i != 0) { switch (x) { case 0 : if (i != 1) { i = 99; } break; case 1 : if (i != 2 && i != 6 && i != 7) { i = 99; } break; case 2 : if (i != 3) { i = 99; } break; case 3 : if (pitemflag[6] == 0) { if (i != 4 && i != 6 && i != 7) { i = 99; } } else if (pitemflag[8] == 0) { if (i != 4 && i != 6 && i != 9) { i = 99; } } else if (pitemflag[10] == 0) { if (i != 4 && i != 6 && i != 11) { i = 99; } } else if (pitemflag[12] == 0) { if (i != 4 && i != 6 && i != 13) { i = 99; } } break; case 4 : if (i != 5) { i = 99; } break; case 5 : if (pitemflag[6] == 0) { if (i != 6 && i != 7) { i = 99; } } else if (pitemflag[8] == 0) { if (i != 6 && i != 9) { i = 99; } } else if (pitemflag[10] == 0) { if (i != 6 && i != 11) { i = 99; } } else if (pitemflag[12] == 0) { if (i != 6 && i != 13) { i = 99; } } break; case 6 : printf("You have exhausted all of your options for today\n"); printf("Please contact your supervisor if you believe\n"); printf("you have received this message in error or you\n"); printf("are not finished working for today.\n"); printf("Press to exit\n") ; getchar(); exit(1); break; case 7 : if (i != 8) { i = 99; } break; case 8 : if (pitemflag[1] == 0) { if (i != 2 && i != 6 && i != 9) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6 && i != 9) { i = 99; } } break; case 9 : if (i != 10) { i = 99; } break; case 10 : if (pitemflag[1] == 0) { if (i != 2 && i != 6 && i != 11) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6 && i != 11) { i = 99; } } break; case 11 : if (i != 12) { i = 99; } break; case 12 : if (pitemflag[1] == 0) { if (i != 2 && i != 6 && i != 13) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6 && i != 13) { i = 99; } } break; case 13 : if (i != 14) { i = 99; } break; case 14 : if (pitemflag[1] == 0) { if (i != 2 && i != 6) { i = 99; } } else if (pitemflag[3] == 0) { if (i != 4 && i != 6) { i = 99; } } break; } if ( i == 99 ) { printf("\n"); printf("The number you entered is not valid.\n"); printf("That number is not an allowed choice.\n"); printf("\n"); printf("The number must be from the list below. \n"); i = 0; } } } /* If everything is correct the program assigns the action code to the pointer */ currentpunch->action = i; z = 1; return z; } int writerecord(timecardrecord *currentpunch, char *pfilename) { int a, b, c, d, e, f, g, h, z, y; FILE *fp; char testuserid[4]; int testaction, testyear, testmonth, testday, testhour, testminute, testsecond; /* opens the file and writes the timecard record to it */ fp = fopen(pfilename, "a"); fprintf(fp, "%s %02d%02d%02d%04d%02d%02d%02d\n", currentpunch->userid, currentpunch->action, currentpunch->month, currentpunch->day, currentpunch->year, currentpunch->hour, currentpunch->minute, currentpunch->second); fclose(fp); /* opens the file and reads back in the record just entered */ fp = fopen(pfilename, "r"); y = 1; while ( y != 0) { fscanf(fp, "%s %02d%02d%02d%04d%02d%02d%02d\n", testuserid, &testaction, &testmonth, &testday, &testyear, &testhour, &testminute, &testsecond); a = strcmp(currentpunch->userid, testuserid); b = (currentpunch->action == testaction ? 0 : 1); c = (currentpunch->month == testmonth ? 0 : 1); d = (currentpunch->day == testday ? 0 : 1); e = (currentpunch->year == testyear ? 0 : 1); f = (currentpunch->hour == testhour ? 0 : 1); g = (currentpunch->minute == testminute ? 0 : 1); h = (currentpunch->second == testsecond ? 0 : 1); y = a + b + c + d + e + f + g + h; } fclose(fp); /* prints both copys of the information for verification */ printf("\nprinted to filename %s - %s-%02d-%02d-%02d-%04d-%02d-%02d-%02d\n", pfilename, currentpunch->userid, currentpunch->action, currentpunch->month, currentpunch->day, currentpunch->year, currentpunch->hour, currentpunch->minute, currentpunch->second); printf("read from filename %s - %s-%02d-%02d-%02d-%04d-%02d-%02d-%02d\n", pfilename, testuserid, testaction, testmonth, testday, testyear, testhour, testminute, testsecond); printf("\n\nPress to exit\n") ; getchar(); z = 1; return z; } int manager(char userid[4], int usertype, int weekends) { clearscreen(); printf("\n\nManager Functions"); printf("\n\nPress to exit\n"); getchar(); return 0; } int reporter(char userid[4], int usertype, int weekends) { char usefile[12]; int a, b; a = usefilename(&usefile[0]); if (a != 1) { b = printhoursreport(usefile, weekends); } exit(0); } int usefilename(char *pusefile) { int h = 0, j; char y[80], z[13]; FILE *fp; while (h == 0) { printf("Enter the name of the file you wish to open\n"); printf("\nThe format for the name is \"tc.tcd\"\n"); printf("This means the third week of the year 2000 would be\n"); printf("written tc200003.scd.\n"); printf("Type \"quit\" to quit the program.\n"); printf("Filename : "); fgets(y, 80, stdin); for (j = 0; j < 13; j++) { if (j == 13) { z[j] = '\0'; } else { if (y[j] != '\n') { z[j] = y[j]; } else { z[j] = '\0'; j = 13; } } } if (!strcmp(y , "quit\n")) { printf("quiting\n"); return 1; } if ( (fp = fopen(z, "r")) != NULL) { h = 1; fclose(fp); strcpy(pusefile, z); } else { printf("There was an error opening %s. Please try\n", pusefile); printf("entering the file name again\n"); h = 0; } } return 0; } int printhoursreport(char usefile[12], int weekends) { int e, f; char reportfile[12]; e = reportfilename(usefile, &reportfile[0]); f = writereportdata(usefile, reportfile, weekends); return 0; } int reportfilename(char usefile[12], char *preportfile) { int y; char z[7]; for (y = 2; y <= 8; y++) { if ( y == 8) { z[y - 2] = '\0'; } else { z[y - 2] = usefile[y]; } } sprintf (preportfile, "th%s.tcr", z); return 0; } int writereportdata(char usefile[12], char reportfile[12], int weekends) { int i,j; daterecord filedates[7]; i = getreportdates(usefile, &filedates[0], weekends); j = generatereport(usefile, reportfile, filedates); return 0; } int getreportdates(char usefile[12], daterecord *pfiledates, int weekends) { time_t now, test; struct tm *timenow, *timetest, *timetemp; int a, y, z = 1; int weekfile, weektest; int yearfile; int weekdaynow; char weekstringfile[3], weekstringtest[3]; char yearstringfile[5]; /* get the first of year time information */ for (y = 2; y <= 6; y++) { if (y == 6) { yearstringfile[y - 2] = '\0'; } else { yearstringfile[y - 2] = usefile[y]; } } for (y = 6; y <= 8; y++) { if (y == 8) { weekstringfile[y - 6] = '\0'; } else { weekstringfile[y - 6] = usefile[y]; } } weekfile = atoi(weekstringfile); yearfile = atoi(yearstringfile); now = time(0); timenow = localtime(&now); timetemp = timenow; timetemp->tm_year = yearfile - 1900; timetemp->tm_mon = 0; timetemp->tm_mday = 1; test = mktime(timetemp); timetest = localtime(&test); weekdaynow = timetest->tm_wday; if (weekdaynow <= weekends) { timetemp->tm_mday = timetemp->tm_mday + (6 - weekdaynow + weekends); test = mktime(timetemp); timetest = localtime(&test); timetemp = timetest; strftime(weekstringtest, 3, "%U", timetest); weektest = atoi(weekstringtest); } else { timetemp->tm_mday = timetemp->tm_mday + (weekends - weekdaynow); test = mktime(timetemp); timetest = localtime(&test); timetemp = timetest; strftime(weekstringtest, 3, "%U", timetest); weektest = atoi(weekstringtest); } while (weektest != weekfile) { timetemp->tm_mday = timetemp->tm_mday + 7; test = mktime(timetemp); timetest = localtime(&test); timetemp = timetest; strftime(weekstringtest, 3, "%U", timetest); weektest = atoi(weekstringtest); } timetemp->tm_mday = timenow->tm_mday - 7; test = mktime(timetemp); timetest = localtime(&test); for (z = 0; z < 7; z++) { timetemp->tm_mday = timetemp->tm_mday + 1; test = mktime(timetemp); timetest = localtime(&test); pfiledates[z].day = timetest->tm_mday; pfiledates[z].month = timetest->tm_mon + 1; pfiledates[z].year = timetest->tm_year + 1900; } return 0; } int generatereport(char usefile[12], char reportfile[12], daterecord filedates[7]) { int a, b, c, d, e, f, y; FILE *fp, *fq, *fr; char testuserid1[4], testuserid2[4]; int testaction, testyear, testmonth, testday, testhour, testminute, testsecond, testrights; float worktime, breaktime; float reporttimes[14] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0} ; /* A flag array to hold whether a time card item has been used */ timecardrecord reportpunch[14]; /* an array of structures to hold previous time clock entries */ fp = fopen("userlist.txt", "r"); fr = fopen(reportfile, "w"); while (!feof(fp)) { fscanf(fp, "%s %02d\n", testuserid1, &testrights); fprintf(fr, "%s\n", testuserid1); fprintf(fr, "Date of Work Work Hours Break Hours\n"); for (a = 0; a < 7; a++) { for (b = 0; b < 14; b++) { strcpy(reportpunch[b].userid, " "); reportpunch[b].action = 0; reportpunch[b].month = 0; reportpunch[b].day = 0; reportpunch[b].year = 0; reportpunch[b].hour = 0; reportpunch[b].minute = 0; reportpunch[b].second = 0; reporttimes[b] = 0.0; } if ((fq = fopen(usefile, "r")) != NULL) { while ( !feof(fq)) { fscanf(fq, "%s %02d%02d%02d%04d%02d%02d%02d\n", testuserid2, &testaction, &testmonth, &testday, &testyear, &testhour, &testminute, &testsecond); e = strcmp(testuserid1, testuserid2); f = (filedates[a].month == testmonth ? 0 : 1); c = (filedates[a].day == testday ? 0 : 1); d = (filedates[a].year == testyear ? 0 : 1); y = ((e == 0 && f == 0 && c == 0 && d == 0) ? 0 : 1); if (y == 0) { strcpy(reportpunch[testaction].userid, testuserid2); reportpunch[testaction - 1].action = testaction; reportpunch[testaction - 1].month = testmonth; reportpunch[testaction - 1].day = testday; reportpunch[testaction - 1].year = testyear; reportpunch[testaction - 1].hour = testhour; reportpunch[testaction - 1].minute = testminute; reportpunch[testaction - 1].second = testsecond; reporttimes[testaction - 1] = (float)(testhour) + (float)(testminute/60.0); reporttimes[testaction - 1] = (((int)(reporttimes[testaction - 1]*100) % 1 >= 5) ? (((reporttimes[testaction - 1]*100)+ 1)/100.0) : (((reporttimes[testaction - 1]*100)+ 0)/100.0)); } } fclose(fq); breaktime = (reporttimes[7]-reporttimes[6]) + (reporttimes[9]-reporttimes[8]) + (reporttimes[11]-reporttimes[10]) + (reporttimes[13]-reporttimes[12]); worktime = (reporttimes[5]-reporttimes[0]) - (reporttimes[2]-reporttimes[1]) - (reporttimes[4]-reporttimes[3]); fprintf(fr, " %02d/%02d/%04d %9.2f %10.2f\n", filedates[a].month, filedates[a].day, filedates[a].year, worktime, breaktime); } } } fclose(fr); fclose(fp); return 0; } int administrator(char userid[4], int usertype, int weekends) { clearscreen(); printf("\n\nAdministrator Functions"); printf("\n\nPress to exit\n"); getchar(); return 0; } void clearscreen(void) { int c, d; for (c = 0; c <= 100; c++) { for (d = 0; d <= 200; d++) { printf(" "); } printf("\n"); } } splint-3.1.2.dfsg1/test/tests2.4/ulrich.c0000644021234200000250000000030007121317340015431 0ustar fax#include # define x 23 void * utl_calloc ( const size_t num, const size_t size ) { void *newblock = NULL; newblock = calloc(num, size); # return newblock; } splint-3.1.2.dfsg1/test/tests2.4/forward.h0000644021234200000250000000005107320412015015613 0ustar faxextern int test (); # define test() (3) splint-3.1.2.dfsg1/test/tests2.4/hash.h0000644021234200000250000000116507320412015015101 0ustar fax#ifndef _HASH_H #define _HASH_H 1 typedef enum {CHAR, INT} keytype; typedef struct { void *key; void *val; } bucket; typedef struct { int size; int numkeys; unsigned (*hashfunc)(void *key, int M); int (*compfunc)(void *c1, void *c2); void * (*dupefunc)(void *key); bucket **table; } hashtable; void hashcreate(hashtable *table, keytype typ, int size); void hashinsert(hashtable *table, void *key, void *val); void * hashfind(hashtable *table, void *key); void hashforeach(hashtable *table, void (*func)(void *, void *)); void hashempty(hashtable *table); void hashdelete(hashtable *table, void *key); #endif splint-3.1.2.dfsg1/test/tests2.4/timecard.h0000644021234200000250000000562307320412016015752 0ustar fax /*************************************************************************** timecard.h A small program to collect timecard information ------------------- begin : Thu Feb 24 2000 copyright : (C) 2000 by Stephen Toothman email : stephen.toothman@cicplan.com ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ /*DEFINE list*/ /* User defined variable types */ typedef struct { char userid[4]; /* the user id or employee number */ int hour; /* time portion - hours */ int minute; /* time portion - minutes */ int second; int month; /* date portion - month */ int day; int year; int action; /* holds the action being taken */ }timecardrecord; typedef struct { int month; /* date portion - month */ int day; int year; }daterecord; /* Function List*/ int initializeprogram(char *puserid, int *pusertype, int *pweekends); int getenvironment(int *pweekends); int getuserid(char *puserid, int *pusertype); int startprogram(char *puserid, int *pusertype, int *pweekends); int timecard(char userid[4], int usertype, int weekends); int gettimeanddate(timecardrecord *currentpunch, char *pweekstring, char *pyearstring, int weekends); int getfilename(char *pfilename, char *pweekstring, char *pyearstring); int gettimecarddata(timecardrecord *currentpunch, timecardrecord *clockpunch, int *pitemflag, char *pfilename); int printtimecarddata(timecardrecord *currentpunch, timecardrecord *clockpunch); int getaction(timecardrecord *currentpunch, timecardrecord *clockpunch, int *pitemflag); int writerecord(timecardrecord *currentpunch, char *pfilename); int manager(char userid[4], int usertype, int weekends); int reporter(char userid[4], int usertype, int weekends); int usefilename(char *pusefile); int printhoursreport(char *pusefile, int weekends); int reportfilename(char usefile[13], char *preportfile); int writereportdata(char usefile[13], char reportfile[13], int weekends); int getreportdates(char usefile[13], daterecord *pfiledates, int weekends); int generatereport(char usefile[13], char reportfile[13], daterecord filedates[7]); int administrator(char userid[4], int usertype, int weekends); void clearscreen(void); splint-3.1.2.dfsg1/test/tests2.4/Makefile0000644021234200000250000000317707647356045015500 0ustar fax.PHONY: emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source SPLINT = splint all: check check: emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source emptycase: $(SPLINT) emptycase.c enumtest: $(SPLINT) enumtest.c -expect 2 duffs: $(SPLINT) duffs.c -expect 7 bitfields: $(SPLINT) bitfields.c bugs: $(SPLINT) bug1.c $(SPLINT) bug2.c -expect 5 $(SPLINT) bug3.c -expect 3 tests: $(SPLINT) test0.c $(SPLINT) test1.c $(SPLINT) test2.c hexconstants: $(SPLINT) hexconstants.c -expect 1 $(SPLINT) +checks hexconstants.c -expect 4 innercomment: $(SPLINT) innercomment.c -expect 2 +forcehints $(SPLINT) innercomment.c -nestcomment nothing: $(SPLINT) nothing.c offsetof: $(SPLINT) offsetof.c -expect 2 komazi: $(SPLINT) komazi.c print: $(SPLINT) print.c syslog: $(SPLINT) syslog.c +unixlib error: $(SPLINT) error.c -expect 1 ulrich: $(SPLINT) ulrich.c -expect 1 cpptest: $(SPLINT) cpptest.c '-D__P(x)=x' -expect 1 longlong: $(SPLINT) longlong.c -expect 4 subdir: $(SPLINT) subdir/main.c subdir/main.lcl fink: $(SPLINT) fink.c driverstub: $(SPLINT) driverstub.c -sysdirs "/usr/" alignof: $(SPLINT) alignof.c -expect 2 source: $(SPLINT) -D DBL_MANT_DIG=25 source.c -expect 1 splint-3.1.2.dfsg1/test/tests2.4/Makefile.os20000644021234200000250000000342507730061143016157 0ustar fax.PHONY: emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink driverstub alignof source SPLINT = splint all: check check: emptycase enumtest duffs bitfields bugs tests hexconstants innercomment nothing offsetof komazi print syslog error ulrich cpptest longlong subdir fink alignof source emptycase: $(SPLINT) emptycase.c enumtest: $(SPLINT) enumtest.c -expect 2 duffs: $(SPLINT) duffs.c -expect 7 bitfields: $(SPLINT) bitfields.c bugs: $(SPLINT) bug1.c $(SPLINT) bug2.c -expect 5 $(SPLINT) bug3.c -expect 3 tests: $(SPLINT) test0.c $(SPLINT) test1.c $(SPLINT) test2.c hexconstants: $(SPLINT) hexconstants.c -expect 1 $(SPLINT) +checks hexconstants.c -expect 4 innercomment: $(SPLINT) innercomment.c -expect 2 +forcehints $(SPLINT) innercomment.c -nestcomment nothing: $(SPLINT) nothing.c offsetof: $(SPLINT) offsetof.c -expect 2 komazi: $(SPLINT) komazi.c print: $(SPLINT) print.c syslog: $(SPLINT) syslog.c +unixlib error: $(SPLINT) error.c -expect 1 ulrich: $(SPLINT) ulrich.c -expect 1 cpptest: $(SPLINT) cpptest.c '-D__P(x)=x' -expect 1 longlong: $(SPLINT) longlong.c -expect 4 subdir: $(SPLINT) subdir/main.c subdir/main.lcl fink: $(SPLINT) fink.c # Herbert: don't test this, since splint is installed in /usr on my box driverstub: $(SPLINT) driverstub.c -sysdirs "/usr/" alignof: $(SPLINT) alignof.c -expect 2 source: $(SPLINT) -D DBL_MANT_DIG=25 source.c -expect 1 splint-3.1.2.dfsg1/test/tests2.5/0000755021234200000250000000000010645776271014030 5ustar faxsplint-3.1.2.dfsg1/test/tests2.5/badcomment.c0000644021234200000250000000002607142107155016266 0ustar fax/*@-PRIVATE-CALLS-@*/ splint-3.1.2.dfsg1/test/tests2.5/boolbad.c0000644021234200000250000000025507142107157015565 0ustar faxtypedef /*@abstract@*/ enum {FALSE = 0, TRUE = 1} BOOLEAN; void func (BOOLEAN foo) { foo = FALSE; } int main (void) { BOOLEAN foo; func (foo); return 0; } splint-3.1.2.dfsg1/test/tests2.5/boolt.c0000644021234200000250000000034307142107157015300 0ustar faxtypedef int pan_bool_t; #define PAN_FALSE (0) #define PAN_TRUE ((pan_bool_t) 1) pan_bool_t test (pan_bool_t b) { (void) test (2); (void) test (PAN_FALSE); (void) test (PAN_TRUE); (void) test (b); return PAN_TRUE; } splint-3.1.2.dfsg1/test/tests2.5/booltest.c0000644021234200000250000000040107631564300016007 0ustar fax/* ** Boolean type checking */ // bool is now defined in the standard library #include bool f (int i, bool b) { if (i) { /* error with -boolint -predboolint */ return i; /* error with -boolint */ } else { return b; /* okay */ } } splint-3.1.2.dfsg1/test/tests2.5/dummyfile.c0000644021234200000250000000264007142107160016150 0ustar fax/* * Problem File. * Command Line used to run: * * /extra/msmoot/lclint-2.5m/bin/lclint -dump newlint.lcd dummyfile.c */ #if 1 // This is our normal definition of PRINTF_LIKE - our lclint run normally // does not use this definition because I think I had a problem in a file // if I used this definition (I have to retest with 2.5 though). this // example does not seem to have a problem #define PRINTF_LIKE __attribute__ ((format(printf,1,2))) #else #define PRINTF_LIKE #endif #if 1 // These fail to -dump int /*@alt void@*/ console_printf(const char *__format, ...) PRINTF_LIKE; int /*@alt void@*/ eprintf(const char *__format, ...) PRINTF_LIKE; int /*@alt void@*/ lprintf(const char *__format, ...) PRINTF_LIKE; #endif #if 0 // Even these fail int /*@alt void@*/ console_printf(const char *__format, ...); int /*@alt void@*/ eprintf(const char *__format, ...); int /*@alt void@*/ lprintf(const char *__format, ...); #endif /* But all of these work */ int /* @alt void@ */ console_printf(const char *__format, ...); int /* @alt void@ */ eprintf(const char *__format, ...); int /* @alt void@ */ lprintf(const char *__format, ...); int console_printf(const char *__format, ...) PRINTF_LIKE; int eprintf(const char *__format, ...) PRINTF_LIKE; int lprintf(const char *__format, ...) PRINTF_LIKE; int console_printf(const char *__format, ...); int eprintf(const char *__format, ...); int lprintf(const char *__format, ...); splint-3.1.2.dfsg1/test/tests2.5/hoof.c0000644021234200000250000000064407414547435015131 0ustar fax#include static void test (long int x); static void init_arr(/*@out@*/ float[],/*@out@*/ long int*); int main(void) { int j; long i; float arr[2]; init_arr(arr,&j); test (j); for( i=0; i < j; i++ ) { printf("%ld %d: %.6e\n",i,j,arr[i]); } return(0); } void init_arr(float arr[], long int *j) { long i; *j = 2L; for (i=0; i < 2L; i++) { arr[i] = (float)(i+1); } } splint-3.1.2.dfsg1/test/tests2.5/immutable.c0000644021234200000250000000022707320412023016126 0ustar fax# include "immutable.h" immutable immutable_create (int x) { immutable res = (immutable) malloc (sizeof (*res)); res->x = x; return res; } splint-3.1.2.dfsg1/test/tests2.5/impabsmodule.c0000644021234200000250000000031007320412023016621 0ustar fax/* ** Contributed by Linus Rydberg */ #include "impabsmodule.h" int isTwo(void) { abst_T var; abst2_T var2; if (var==(abst_T)var2) return 1; else return 0; } splint-3.1.2.dfsg1/test/tests2.5/literals.c0000644021234200000250000000011307320412023015760 0ustar faxvoid test () { char a; unsigned int b; a = 15; b = 39; a = b; } splint-3.1.2.dfsg1/test/tests2.5/quals.c0000644021234200000250000000055007142107161015301 0ustar fax#include static void init_arr(/*@out@*/ float[],/*@out@*/ long int*); int main(void) { int j; long i; float arr[2]; init_arr(arr,&j); for( i=0; i < j; i++ ) { printf("%ld %d: %.6e\n",i,j,arr[i]); } return(0); } void init_arr(float arr[], long int *j) { long i; *j = 2L; for( i=0; i < 2L; i++ ) { arr[i] = (float)(i+1); } } splint-3.1.2.dfsg1/test/tests2.5/sort.c0000644021234200000250000000032207320412024015133 0ustar faxunion { unsigned int BCD; struct { unsigned int EINER :4; unsigned int ZEHN :4; unsigned int HUNDERT :4; unsigned int TAUSEND :4; } nibble; } ergebnis; splint-3.1.2.dfsg1/test/tests2.5/testalt.c0000644021234200000250000000010007142107162015624 0ustar faxint /*@alt void@*/ test1 (...); int /*@alt void@*/ test2 (...); splint-3.1.2.dfsg1/test/tests2.5/testimmutable.c0000644021234200000250000000016607320412024017031 0ustar fax# include "immutable.h" void testimmutable (void) { immutable i1 = immutable_create (3); immutable_print (i1); } splint-3.1.2.dfsg1/test/tests2.5/uconstants.c0000644021234200000250000000012307142107163016353 0ustar faxvoid f (void) { unsigned int x0 = 0x9423U; unsigned long int x1 = 0x9423UL; } splint-3.1.2.dfsg1/test/tests2.5/ull.c0000644021234200000250000000024207142107163014750 0ustar faxtypedef unsigned long long pan_unit64_t; void f () { /*@unused@*/ unsigned long long put = 0xFFFFFULL; /*@unused@*/ pan_unit64_t pt = 0xFFFFFFFFFFFFFULL; } splint-3.1.2.dfsg1/test/tests2.5/baz.h0000644021234200000250000000064207142107156014743 0ustar fax/* * baz.h */ #ifndef _BAZ_H_ #define _BAZ_H_ struct pxs { int a; int b; int c[4]; int d; }; typedef struct pxs pxt; struct xstr { pxt a; }; typedef struct xstr pvt; struct pvas { int a; int b[4]; }; typedef struct pvas ppvat; struct pvzas { int a; int c[4]; }; typedef struct pvzas pvzat; struct p4zas { int a; int b[4]; }; struct yabbawabba { pxt a; }; #endif /* !_BAZ_H_ */ splint-3.1.2.dfsg1/test/tests2.5/bimbim.h0000644021234200000250000000014607142107156015425 0ustar fax/* * bimbim.h */ #ifndef _BIMBIM_H_ #define _BIMBIM_H_ #include #endif /* !_BIMBIM_H_ */ splint-3.1.2.dfsg1/test/tests2.5/immutable.h0000644021234200000250000000023707320412023016134 0ustar faxtypedef /*@abstract@*/ /*@immutable@*/ struct __ { int x; } *immutable; extern immutable immutable_create (int) ; extern void immutable_print (immutable) ; splint-3.1.2.dfsg1/test/tests2.5/impabsmodule.h0000644021234200000250000000013007320412023016626 0ustar fax/*module.h*/ typedef /*@abstract@*/long abst_T; typedef long abst2_T; int isTwo(void); splint-3.1.2.dfsg1/test/tests2.5/socket.h0000644021234200000250000002422607142107162015460 0ustar fax/* System-specific socket constants and types. Linux version. Copyright (C) 1991,92,94,95,96,97,98,99 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __BITS_SOCKET_H #define __BITS_SOCKET_H #if !defined _SYS_SOCKET_H && !defined _NETINET_IN_H # error "Never include directly; use instead." #endif #define __need_size_t #define __need_NULL #include #include #include /* Type for length arguments in socket calls. */ typedef unsigned int socklen_t; /* Types of sockets. */ enum __socket_type { SOCK_STREAM = 1, /* Sequenced, reliable, connection-based byte streams. */ #define SOCK_STREAM SOCK_STREAM SOCK_DGRAM = 2, /* Connectionless, unreliable datagrams of fixed maximum length. */ #define SOCK_DGRAM SOCK_DGRAM SOCK_RAW = 3, /* Raw protocol interface. */ #define SOCK_RAW SOCK_RAW SOCK_RDM = 4, /* Reliably-delivered messages. */ #define SOCK_RDM SOCK_RDM SOCK_SEQPACKET = 5, /* Sequenced, reliable, connection-based, datagrams of fixed maximum length. */ #define SOCK_SEQPACKET SOCK_SEQPACKET SOCK_PACKET = 10 /* Linux specific way of getting packets at the dev level. For writing rarp and other similar things on the user level. */ #define SOCK_PACKET SOCK_PACKET }; /* Protocol families. */ #define PF_UNSPEC 0 /* Unspecified. */ #define PF_LOCAL 1 /* Local to host (pipes and file-domain). */ #define PF_UNIX PF_LOCAL /* Old BSD name for PF_LOCAL. */ #define PF_FILE PF_LOCAL /* Another non-standard name for PF_LOCAL. */ #define PF_INET 2 /* IP protocol family. */ #define PF_AX25 3 /* Amateur Radio AX.25. */ #define PF_IPX 4 /* Novell Internet Protocol. */ #define PF_APPLETALK 5 /* Appletalk DDP. */ #define PF_NETROM 6 /* Amateur radio NetROM. */ #define PF_BRIDGE 7 /* Multiprotocol bridge. */ #define PF_ATMPVC 8 /* ATM PVCs. */ #define PF_X25 9 /* Reserved for X.25 project. */ #define PF_INET6 10 /* IP version 6. */ #define PF_ROSE 11 /* Amateur Radio X.25 PLP. */ #define PF_DECnet 12 /* Reserved for DECnet project. */ #define PF_NETBEUI 13 /* Reserved for 802.2LLC project. */ #define PF_SECURITY 14 /* Security callback pseudo AF. */ #define PF_KEY 15 /* PF_KEY key management API. */ #define PF_NETLINK 16 #define PF_ROUTE PF_NETLINK /* Alias to emulate 4.4BSD. */ #define PF_PACKET 17 /* Packet family. */ #define PF_ASH 18 /* Ash. */ #define PF_ECONET 19 /* Acorn Econet. */ #define PF_ATMSVC 20 /* ATM SVCs. */ #define PF_SNA 22 /* Linux SNA Project */ #define PF_IRDA 23 /* IRDA sockets. */ #define PF_MAX 32 /* For now.. */ /* Address families. */ #define AF_UNSPEC PF_UNSPEC #define AF_LOCAL PF_LOCAL #define AF_UNIX PF_UNIX #define AF_FILE PF_FILE #define AF_INET PF_INET #define AF_AX25 PF_AX25 #define AF_IPX PF_IPX #define AF_APPLETALK PF_APPLETALK #define AF_NETROM PF_NETROM #define AF_BRIDGE PF_BRIDGE #define AF_ATMPVC PF_ATMPVC #define AF_X25 PF_X25 #define AF_INET6 PF_INET6 #define AF_ROSE PF_ROSE #define AF_DECnet PF_DECnet #define AF_NETBEUI PF_NETBEUI #define AF_SECURITY PF_SECURITY #define AF_KEY PF_KEY #define AF_NETLINK PF_NETLINK #define AF_ROUTE PF_ROUTE #define AF_PACKET PF_PACKET #define AF_ASH PF_ASH #define AF_ECONET PF_ECONET #define AF_ATMSVC PF_ATMSVC #define AF_SNA PF_SNA #define AF_IRDA PF_IRDA #define AF_MAX PF_MAX /* Socket level values. Others are defined in the appropriate headers. XXX These definitions also should go into the appropriate headers as far as they are available. */ #define SOL_RAW 255 #define SOL_DECNET 261 #define SOL_X25 262 #define SOL_PACKET 263 #define SOL_ATM 264 /* ATM layer (cell level). */ #define SOL_AAL 265 /* ATM Adaption Layer (packet level). */ #define SOL_IRDA 266 /* Maximum queue length specifiable by listen. */ #define SOMAXCONN 128 /* Get the definition of the macro to define the common sockaddr members. */ #include /* Structure describing a generic socket address. */ struct sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ }; /* Structure large enough to hold any socket address (with the historical exception of AF_UNIX). We reserve 128 bytes. */ #if ULONG_MAX > 0xffffffff # define __ss_aligntype __uint64_t #else # define __ss_aligntype __uint32_t #endif #define _SS_SIZE 128 #define _SS_PADSIZE (_SS_SIZE - (2 * sizeof (__ss_aligntype))) struct sockaddr_storage { __SOCKADDR_COMMON (__ss_); /* Address family, etc. */ __ss_aligntype __ss_align; /* Force desired alignment. */ char __ss_padding[_SS_PADSIZE]; }; /* Bits in the FLAGS argument to `send', `recv', et al. */ enum { MSG_OOB = 0x01, /* Process out-of-band data. */ #define MSG_OOB MSG_OOB MSG_PEEK = 0x02, /* Peek at incoming messages. */ #define MSG_PEEK MSG_PEEK MSG_DONTROUTE = 0x04, /* Don't use local routing. */ #define MSG_DONTROUTE MSG_DONTROUTE #ifdef __USE_GNU /* DECnet uses a different name. */ MSG_TRYHARD = MSG_DONTROUTE, # define MSG_TRYHARD MSG_DONTROUTE #endif MSG_CTRUNC = 0x08, /* Control data lost before delivery. */ #define MSG_CTRUNC MSG_CTRUNC MSG_PROXY = 0x10, /* Supply or ask second address. */ #define MSG_PROXY MSG_PROXY MSG_TRUNC = 0x20, #define MSG_TRUNC MSG_TRUNC MSG_DONTWAIT = 0x40, /* Nonblocking IO. */ #define MSG_DONTWAIT MSG_DONTWAIT MSG_EOR = 0x80, /* End of record. */ #define MSG_EOR MSG_EOR MSG_WAITALL = 0x100, /* Wait for a full request. */ #define MSG_WAITALL MSG_WAITALL MSG_FIN = 0x200, #define MSG_FIN MSG_FIN MSG_SYN = 0x400, #define MSG_SYN MSG_SYN MSG_URG = 0x800, #define MSG_URG MSG_URG MSG_RST = 0x1000, #define MSG_RST MSG_RST MSG_ERRQUEUE = 0x2000, /* Fetch message from error queue. */ #define MSG_ERRQUEUE MSG_ERRQUEUE MSG_NOSIGNAL = 0x4000 /* Do not generate SIGPIPE. */ #define MSG_NOSIGNAL MSG_NOSIGNAL }; /* Structure describing messages sent by `sendmsg' and received by `recvmsg'. */ struct msghdr { __ptr_t msg_name; /* Address to send to/receive from. */ socklen_t msg_namelen; /* Length of address data. */ struct iovec *msg_iov; /* Vector of data to send/receive into. */ size_t msg_iovlen; /* Number of elements in the vector. */ __ptr_t msg_control; /* Ancillary data (eg BSD filedesc passing). */ size_t msg_controllen; /* Ancillary data buffer length. */ int msg_flags; /* Flags on received message. */ }; /* Structure used for storage of ancillary data object information. */ struct cmsghdr { size_t cmsg_len; /* Length of data in cmsg_data plus length of cmsghdr structure. */ int cmsg_level; /* Originating protocol. */ int cmsg_type; /* Protocol specific type. */ #if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2 unsigned char __cmsg_data[0]; /* Ancillary data. */ /* XXX Perhaps this should be removed. */ #endif }; /* Ancillary data object manipulation macros. */ #if !defined __STRICT_ANSI__ && defined __GNUC__ && __GNUC__ >= 2 # define CMSG_DATA(cmsg) ((cmsg)->__cmsg_data) #else # define CMSG_DATA(cmsg) ((unsigned char *) ((struct cmsghdr *) (cmsg) + 1)) #endif #define CMSG_NXTHDR(mhdr, cmsg) __cmsg_nxthdr (mhdr, cmsg) #define CMSG_FIRSTHDR(mhdr) \ ((size_t) (mhdr)->msg_controllen >= sizeof (struct cmsghdr) \ ? (struct cmsghdr *) (mhdr)->msg_control : (struct cmsghdr *) NULL) #define CMSG_ALIGN(len) (((len) + sizeof (size_t) - 1) \ & ~(sizeof (size_t) - 1)) #define CMSG_SPACE(len) (CMSG_ALIGN (len) \ + CMSG_ALIGN (sizeof (struct cmsghdr))) #define CMSG_LEN(len) (CMSG_ALIGN (sizeof (struct cmsghdr)) + (len)) extern struct cmsghdr *__cmsg_nxthdr __P ((struct msghdr *__mhdr, struct cmsghdr *__cmsg)); #ifdef __USE_EXTERN_INLINES # ifndef _EXTERN_INLINE # define _EXTERN_INLINE extern __inline # endif _EXTERN_INLINE struct cmsghdr * __cmsg_nxthdr (struct msghdr *__mhdr, struct cmsghdr *__cmsg) __THROW { if ((size_t) __cmsg->cmsg_len < sizeof (struct cmsghdr)) /* The kernel header does this so there may be a reason. */ return 0; __cmsg = (struct cmsghdr *) ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len)); if ((unsigned char *) (__cmsg + 1) >= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen) || ((unsigned char *) __cmsg + CMSG_ALIGN (__cmsg->cmsg_len) >= ((unsigned char *) __mhdr->msg_control + __mhdr->msg_controllen))) /* No more entries. */ return 0; return __cmsg; } #endif /* Use `extern inline'. */ /* Socket level message types. This must match the definitions in . */ enum { SCM_RIGHTS = 0x01, /* Transfer file descriptors. */ #define SCM_RIGHTS SCM_RIGHTS #ifdef __USE_BSD SCM_CREDENTIALS = 0x02, /* Credentials passing. */ # define SCM_CREDENTIALS SCM_CREDENTIALS #endif __SCM_CONNECT = 0x03 /* Data array is `struct scm_connect'. */ }; /* User visible structure for SCM_CREDENTIALS message */ struct ucred { pid_t pid; /* PID of sending process. */ uid_t uid; /* UID of sending process. */ gid_t gid; /* GID of sending process. */ }; /* Get socket manipulation related informations from kernel headers. */ #include /* Structure used to manipulate the SO_LINGER option. */ struct linger { int l_onoff; /* Nonzero to linger on close. */ int l_linger; /* Time to linger. */ }; #endif /* bits/socket.h */ splint-3.1.2.dfsg1/test/tests2.5/Makefile0000644021234200000250000000200010101544330015430 0ustar fax.PHONY: boolt testalt booltest boolbad hoof testalt uconstants ull baz SPLINT = splint # ull and baz added after 2.5q all: testalt boolt uconstants badcomment hoof boolbad booltest ull baz immutable impabsmodule testalt: -${SPLINT} -dump newlint.lcd testalt.c boolt: -${SPLINT} -expect 1 +partial +booltype pan_bool_t +booltrue PAN_TRUE +boolfalse PAN_FALSE boolt.c uconstants: -${SPLINT} uconstants.c -expect 2 badcomment: -${SPLINT} badcomment.c -expect 3 hoof: -${SPLINT} hoof.c -expect 1 -${SPLINT} hoof.c +ignorequals ignorecmd: -${SPLINT} +ignorecommand -we booltest: -${SPLINT} booltest.c -booltype bool -expect 2 -${SPLINT} booltest.c -booltype bool +boolint -${SPLINT} booltest.c -booltype bool -predboolint -expect 1 boolbad: -${SPLINT} -weak -booltype BOOLEAN -booltrue TRUE -boolfalse FALSE boolbad.c ull: -${SPLINT} ull.c baz: -${SPLINT} baz.h bimbim.h -I. immutable: -${SPLINT} immutable.c testimmutable.c -expect 2 impabsmodule: -${SPLINT} +impabstract impabsmodule.c -expect 2 splint-3.1.2.dfsg1/test/tests2.5/badcomment0000644021234200000250000000000007142107155016035 0ustar faxsplint-3.1.2.dfsg1/test/tests2.5/boolbad0000644021234200000250000003233707403314444015351 0ustar faxELF0ƒ4)4 (44€4€ÀÀôô€ô€€€••è``•`•   /lib/ld-linux.so.2GNUbä‚")ô‚¬"PƒÊƒ"A… __gmon_start__libc.so.6__cxa_finalize__deregister_frame_info_IO_stdin_used__libc_start_main__register_frame_infoGLIBC_2.1.3GLIBC_2.0si xii „\•L•P•T•X•U‰åƒìèè3è¾ÉÃÿ5D•ÿ%H•ÿ%L•héàÿÿÿÿ%P•héÐÿÿÿÿ%T•héÀÿÿÿÿ%X•hé°ÿÿÿ1í^‰áƒäðPTRhð„h¼‚QVhp„è³ÿÿÿô‰öU‰åSPè[Ã⋃…ÀtÿЋ]üÉÉöU‰åƒìƒ=–tëR´&¼'¡ •‹‰Eü…Àuëƒ •ÿUüëät&¸…Àtƒì h,•è*|û÷ƒÄÇ–‰ì]Éö¼'U‰åƒì‰ì]öU‰åƒìÇEüèZÂ.‰Ð‰Eø¸…Àtÿuøÿuüh–h,•èÄ{û÷ƒÄ‰ì]ö¼'U‰åƒì‰ì]öU‰åÇE]Ãt&U‰åƒìƒì ÿuüèßÿÿÿƒÄ¸‰ì]ÃvU‰åƒì¸4•ƒè‰Eüë ‹Eüƒ8ÿuë¶‹Eü‹ÿÐEüƒ(ëá‰ì]ö¿U‰åƒì‰ì]öU‰åSRè[ÃFvèwþÿÿ‹]üÉÃ<•ÿÿÿÿÿÿÿÿ`•ê‚ú‚ ƒƒ ¼‚ ð„(ÈX x @• œ‚”‚þÿÿod‚ÿÿÿoðÿÿoV‚¢gdTƒdTƒ+<:€d€~€­€å€"€s€Ä€ï€€H€q€‹€¦€Ç€€#€H€r€›‚µ‚¢¢í‚cV‚ï[0‚F‚]‚¢¢¢q‚ت€Ç¢¾€ Õ€!ì€"€#€%/€&E€1\€2t€3‹€4¤€5¼€6Õ€8í€9€;&€=<€>R€?h€@~€A•€B­€CÀDÚ€Eð€F€G€H8€IM€N³€QË€Rë€S€T€U9€VQ€Xi€[ƒ€^›€e±€hË€lå€qþ€r €u4 €vQ €yl €z‰ €}¡ €€º €ƒÕ €„ñ €‡ €Š$ ‚Ë”X ‚F€ €¢¶ €þ €#: €= €4Y €<¦ €CÞ €Fú €S €ZË €^è €½€lÝ€t1€yR€Ú€†€Œ¢¢q‚ 0€F€8¢[‚n‚bq‚¢€‚¢­€K¢¢0€s€#¸‚Ë‚5Á0Â[Ân‚q€¢qÂÜ€»€ò€G€JK€K|€T¯€Yê€]#€`[€a“€@€é€ß€V€¬¢¢z€5í€7€8€97€:¢Q "dTƒinit.c/usr/src/bs/BUILD/glibc-2.2.2/csu/gcc2_compiled.int:t(0,1)=r(0,1);-2147483648;2147483647;char:t(0,2)=r(0,2);0;127;long int:t(0,3)=r(0,3);-2147483648;2147483647;unsigned int:t(0,4)=r(0,4);0000000000000;0037777777777;long unsigned int:t(0,5)=r(0,5);0000000000000;0037777777777;long long int:t(0,6)=@s64;r(0,6);01000000000000000000000;0777777777777777777777;long long unsigned int:t(0,7)=@s64;r(0,7);0000000000000;01777777777777777777777;short int:t(0,8)=@s16;r(0,8);-32768;32767;short unsigned int:t(0,9)=@s16;r(0,9);0;65535;signed char:t(0,10)=@s8;r(0,10);-128;127;unsigned char:t(0,11)=@s8;r(0,11);0;255;float:t(0,12)=r(0,1);4;0;double:t(0,13)=r(0,1);8;0;long double:t(0,14)=r(0,1);12;0;complex int:t(0,15)=s8real:(0,1),0,32;imag:(0,1),32,32;;complex float:t(0,16)=r(0,16);8;0;complex double:t(0,17)=r(0,17);16;0;complex long double:t(0,18)=r(0,18);24;0;__builtin_va_list:t(0,19)=*(0,20)=(0,20)../include/libc-symbols.h/usr/src/bs/BUILD/glibc-2.2.2/build-i386-linux/config.h../sysdeps/gnu/_G_config.h../sysdeps/unix/sysv/linux/bits/types.h../include/features.h../include/sys/cdefs.h../misc/sys/cdefs.h/usr/lib/gcc-lib/i386-redhat-linux/2.96/include/stddef.hsize_t:t(8,1)=(0,4)__u_char:t(4,1)=(0,11)__u_short:t(4,2)=(0,9)__u_int:t(4,3)=(0,4)__u_long:t(4,4)=(0,5)__u_quad_t:t(4,5)=(0,7)__quad_t:t(4,6)=(0,6)__int8_t:t(4,7)=(0,10)__uint8_t:t(4,8)=(0,11)__int16_t:t(4,9)=(0,8)__uint16_t:t(4,10)=(0,9)__int32_t:t(4,11)=(0,1)__uint32_t:t(4,12)=(0,4)__int64_t:t(4,13)=(0,6)__uint64_t:t(4,14)=(0,7)__qaddr_t:t(4,15)=(4,16)=*(4,6)__dev_t:t(4,17)=(4,5)__uid_t:t(4,18)=(4,3)__gid_t:t(4,19)=(4,3)__ino_t:t(4,20)=(4,4)__mode_t:t(4,21)=(4,3)__nlink_t:t(4,22)=(4,3)__off_t:t(4,23)=(0,3)__loff_t:t(4,24)=(4,6)__pid_t:t(4,25)=(0,1)__ssize_t:t(4,26)=(0,1)__rlim_t:t(4,27)=(4,4)__rlim64_t:t(4,28)=(4,5)__id_t:t(4,29)=(4,3)__fsid_t:t(4,30)=(4,31)=s8__val:(4,32)=ar(4,33)=r(4,33);0000000000000;0037777777777;;0;1;(0,1),0,64;;__daddr_t:t(4,34)=(0,1)__caddr_t:t(4,35)=(4,36)=*(0,2)__time_t:t(4,37)=(0,3)__useconds_t:t(4,38)=(0,4)__suseconds_t:t(4,39)=(0,3)__swblk_t:t(4,40)=(0,3)__clock_t:t(4,41)=(0,3)__clockid_t:t(4,42)=(0,1)__timer_t:t(4,43)=(0,1)__key_t:t(4,44)=(0,1)__ipc_pid_t:t(4,45)=(0,9)__blksize_t:t(4,46)=(0,3)__blkcnt_t:t(4,47)=(0,3)__blkcnt64_t:t(4,48)=(4,6)__fsblkcnt_t:t(4,49)=(4,4)__fsblkcnt64_t:t(4,50)=(4,5)__fsfilcnt_t:t(4,51)=(4,4)__fsfilcnt64_t:t(4,52)=(4,5)__ino64_t:t(4,53)=(4,5)__off64_t:t(4,54)=(4,24)__t_scalar_t:t(4,55)=(0,3)__t_uscalar_t:t(4,56)=(0,5)__intptr_t:t(4,57)=(0,1)__socklen_t:t(4,58)=(0,4)../linuxthreads/sysdeps/pthread/bits/pthreadtypes.h../sysdeps/unix/sysv/linux/bits/sched.h__sched_param:T(10,1)=s4__sched_priority:(0,1),0,32;;_pthread_fastlock:T(9,1)=s8__status:(0,3),0,32;__spinlock:(0,1),32,32;;_pthread_descr:t(9,2)=(9,3)=*(9,4)=xs_pthread_descr_struct:__pthread_attr_s:T(9,5)=s36__detachstate:(0,1),0,32;__schedpolicy:(0,1),32,32;__schedparam:(10,1),64,32;__inheritsched:(0,1),96,32;__scope:(0,1),128,32;__guardsize:(8,1),160,32;__stackaddr_set:(0,1),192,32;__stackaddr:(0,19),224,32;__stacksize:(8,1),256,32;;pthread_attr_t:t(9,6)=(9,5)pthread_cond_t:t(9,7)=(9,8)=s12__c_lock:(9,1),0,64;__c_waiting:(9,2),64,32;;pthread_condattr_t:t(9,9)=(9,10)=s4__dummy:(0,1),0,32;;pthread_key_t:t(9,11)=(0,4)pthread_mutex_t:t(9,12)=(9,13)=s24__m_reserved:(0,1),0,32;__m_count:(0,1),32,32;__m_owner:(9,2),64,32;__m_kind:(0,1),96,32;__m_lock:(9,1),128,64;;pthread_mutexattr_t:t(9,14)=(9,15)=s4__mutexkind:(0,1),0,32;;pthread_once_t:t(9,16)=(0,1)_pthread_rwlock_t:T(9,17)=s32__rw_lock:(9,1),0,64;__rw_readers:(0,1),64,32;__rw_writer:(9,2),96,32;__rw_read_waiting:(9,2),128,32;__rw_write_waiting:(9,2),160,32;__rw_kind:(0,1),192,32;__rw_pshared:(0,1),224,32;;pthread_rwlock_t:t(9,18)=(9,17)pthread_rwlockattr_t:t(9,19)=(9,20)=s8__lockkind:(0,1),0,32;__pshared:(0,1),32,32;;pthread_spinlock_t:t(9,21)=(0,1)pthread_barrier_t:t(9,22)=(9,23)=s20__ba_lock:(9,1),0,64;__ba_required:(0,1),64,32;__ba_present:(0,1),96,32;__ba_waiting:(9,2),128,32;;pthread_barrierattr_t:t(9,24)=(9,25)=s4__pshared:(0,1),0,32;;pthread_t:t(9,26)=(0,5)wchar_t:t(11,1)=(0,3)wint_t:t(11,2)=(0,4)../include/wchar.h../wcsmbs/wchar.h../sysdeps/unix/sysv/linux/i386/bits/wchar.h__mbstate_t:t(13,1)=(13,2)=s8__count:(0,1),0,32;__value:(13,3)=u4__wch:(11,2),0,32;__wchb:(13,4)=ar(4,33);0;3;(0,2),0,32;;,32,32;;_G_fpos_t:t(3,1)=(3,2)=s12__pos:(4,23),0,32;__state:(13,1),32,64;;_G_fpos64_t:t(3,3)=(3,4)=s16__pos:(4,54),0,64;__state:(13,1),64,64;;../include/gconv.h../iconv/gconv.h :T(17,1)=e__GCONV_OK:0,__GCONV_NOCONV:1,__GCONV_NODB:2,__GCONV_NOMEM:3,__GCONV_EMPTY_INPUT:4,__GCONV_FULL_OUTPUT:5,__GCONV_ILLEGAL_INPUT:6,__GCONV_INCOMPLETE_INPUT:7,__GCONV_ILLEGAL_DESCRIPTOR:8,__GCONV_INTERNAL_ERROR:9,; :T(17,2)=e__GCONV_IS_LAST:1,__GCONV_IGNORE_ERRORS:2,;__gconv_fct:t(17,3)=(17,4)=*(17,5)=f(0,1)__gconv_init_fct:t(17,6)=(17,7)=*(17,8)=f(0,1)__gconv_end_fct:t(17,9)=(17,10)=*(17,11)=f(0,20)__gconv_trans_fct:t(17,12)=(17,13)=*(17,14)=f(0,1)__gconv_trans_context_fct:t(17,15)=(17,16)=*(17,17)=f(0,1)__gconv_trans_query_fct:t(17,18)=(17,19)=*(17,20)=f(0,1)__gconv_trans_init_fct:t(17,21)=(17,22)=*(17,23)=f(0,1)__gconv_trans_end_fct:t(17,24)=(17,25)=*(17,26)=f(0,20)__gconv_trans_data:T(17,27)=s20__trans_fct:(17,12),0,32;__trans_context_fct:(17,15),32,32;__trans_end_fct:(17,24),64,32;__data:(0,19),96,32;__next:(17,28)=*(17,27),128,32;;__gconv_step:T(17,29)=s56__shlib_handle:(17,30)=*(17,31)=xs__gconv_loaded_object:,0,32;__modname:(17,32)=*(0,2),32,32;__counter:(0,1),64,32;__from_name:(4,36),96,32;__to_name:(4,36),128,32;__fct:(17,3),160,32;__init_fct:(17,6),192,32;__end_fct:(17,9),224,32;__min_needed_from:(0,1),256,32;__max_needed_from:(0,1),288,32;__min_needed_to:(0,1),320,32;__max_needed_to:(0,1),352,32;__stateful:(0,1),384,32;__data:(0,19),416,32;;__gconv_step_data:T(17,33)=s36__outbuf:(17,34)=*(0,11),0,32;__outbufend:(17,34),32,32;__flags:(0,1),64,32;__invocation_counter:(0,1),96,32;__internal_use:(0,1),128,32;__statep:(17,35)=*(13,1),160,32;__state:(13,1),192,64;__trans:(17,28),256,32;;__gconv_info:T(17,36)=s8__nsteps:(8,1),0,32;__steps:(17,37)=*(17,29),32,32;__data:(17,38)=ar(4,33);0;-1;(17,33),64,0;;__gconv_t:t(17,39)=(17,40)=*(17,36)_G_iconv_t:t(3,5)=(3,6)=u44__cd:(17,36),0,64;__combined:(3,7)=s44__cd:(17,36),0,64;__data:(17,33),64,288;;,0,352;;_G_int16_t:t(3,8)=(0,8)_G_int32_t:t(3,9)=(0,1)_G_uint16_t:t(3,10)=(0,9)_G_uint32_t:t(3,11)=(0,4)_IO_stdin_used:G(0,1)GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-79)GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-79)GCC: (GNU) 3.0GCC: (GNU) 3.0GCC: (GNU) 3.0GCC: (GNU) 2.96 20000731 (Red Hat Linux 7.1 2.96-79)01.0101.0101.01.symtab.strtab.shstrtab.interp.note.ABI-tag.hash.dynsym.dynstr.gnu.version.gnu.version_r.rel.got.rel.plt.init.plt.text.fini.rodata.data.eh_frame.ctors.dtors.got.dynamic.sbss.bss.stab.stabstr.comment.noteô€ô# 1((07 XXp?ÈÈŽGÿÿÿoV‚VTþÿÿod‚d0c ”‚”l œ‚œ  u¼‚¼{Ô‚ÔP€0ƒ0À†ð„ðŒ…”•š,•,¤0•0«8•8²@•@ ·`•` À–Ɩˤ Ѥ gÚ 'ÒãÝ'<(é´-Ð8 „2[ô€(XÈV‚d‚”‚œ‚ ¼‚ Ô‚ 0ƒ ð„ …•,•0•8•@•`•––ñÿ Tƒ Tƒ +ñÿ2ñÿ= •A8•O–[€ƒ q,•„ðƒ –˜„ ¤P„ ¯$•½0•2ñÿË„ á4•¤à„ ¯(•î<•û,•ñÿ ð„ ñÿ`•ä‚"=…D¼‚ J fô‚¬"‰0ƒ  ®–ñÿºp„ ¿ƒÊÜ• çð„ íƒ" `„  –ñÿ@•+–ñÿ0…?•L initfini.cgcc2_compiled.call_gmon_startinit.ccrtstuff.cp.0__DTOR_LIST__completed.1__do_global_dtors_aux__EH_FRAME_BEGIN__fini_dummyobject.2frame_dummyinit_dummyforce_to_data__CTOR_LIST____do_global_ctors_aux__CTOR_END____DTOR_END____FRAME_END__boolbad.c_DYNAMIC__register_frame_info@@GLIBC_2.0_fp_hw_init__register_frame_info_bases__deregister_frame_info@@GLIBC_2.0_start__deregister_frame_info_bases__bss_startmain__libc_start_main@@GLIBC_2.0data_start_fini__cxa_finalize@@GLIBC_2.1.3func_edata_GLOBAL_OFFSET_TABLE__end_IO_stdin_used__data_start__gmon_start__splint-3.1.2.dfsg1/test/tests2.5/booltest0000644021234200000250000000000007142107160015553 0ustar faxsplint-3.1.2.dfsg1/test/tests2.5/uconstants0000644021234200000250000000000007142107162016123 0ustar faxsplint-3.1.2.dfsg1/test/warnuse/0000755021234200000250000000000010645776270014124 5ustar faxsplint-3.1.2.dfsg1/test/warnuse/warnflags.c0000644021234200000250000000020607320412027016231 0ustar faxextern int f (void) /*@warn bufferoverflow|statemerge "g is a very dangerous function!" @*/ ; int wflags () { return f (); } splint-3.1.2.dfsg1/test/warnuse/warngets.c0000644021234200000250000000005407320412030016072 0ustar faxvoid wfunc (char *s) { (void) gets (s); } splint-3.1.2.dfsg1/test/warnuse/warnuse.c0000644021234200000250000000044007320412030015723 0ustar faxextern int f (void) /*@warn wusef "f is a very dangerous function!" @*/ ; extern int g (void) /*@warn bufferoverflow|its4 "g is a very dangerous function!" @*/ ; extern int h (void) /*@warn bufferoverflow|its4|hfuncs@*/ ; int wfunc () { return f () + g () + h (); } splint-3.1.2.dfsg1/test/warnuse/Makefile0000644021234200000250000000043307414547435015563 0ustar fax.PHONY: warnuse SPLINT = splint all: warnuse warngets warnuse: ${SPLINT} warnuse.c -expect 4 ${SPLINT} warnuse.c -warnuse -expect 1 ${SPLINT} warnuse.c -warnuse +bufferoverflow -expect 1 ${SPLINT} warnuse.c -bufferoverflow -expect 2 warngets: ${SPLINT} warngets.c -expect 1 splint-3.1.2.dfsg1/test/Makefile.am0000644021234200000250000014021710000622321014445 0ustar fax## This file currently uses GNU Make features; those should really be replaced ## by configure-time handling. AUTOMAKE_OPTIONS = 1.5 foreign ## Use this to configure diff output DIFFFLAGS = # -u show context #drl 3/27/2002 get the test suit to print a warning when splint is built under /usr/ ## Set up the splint commands #SPLINT = valgrind --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=no $(top_builddir)/src/splint$(EXEEXT) SPLINT = $(top_builddir)/src/splint$(EXEEXT) ### These are shell-specific ## unexport LARCH_PATH ## unexport LCLIMPORTDIR ### This is horrible! Can't we make top_builddir absolute? #SPLINTNEST = valgrind --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=no ../$(top_builddir)/src/splint$(EXEEXT) SPLINTNEST = ../$(top_builddir)/src/splint$(EXEEXT) SPLINTPNEST = @$(SPLINTNEST) -nof SPLINTP = @$(SPLINT) -nof # Make sure .splintrc files are not used so test results do not # depend on local settings. SPLINTRN = $(SPLINTP) -hints -booltype "bool" SPLINTR = $(SPLINTRN) -exportlocal +debugfcnconstraint SPLINTRNNEST = $(SPLINTPNEST) -hints -booltype "bool" SPLINTRNEST = $(SPLINTRNNEST) -exportlocal +debugfcnconstraint ### ### rcfiles not included becuase file names will not match exactly ### UNITTESTS = \ help \ abstptr abstract alias alttypes ansireserved argorder \ args arraydims arrayinit arraylit blocks break cases cast chararraylit charlit clauses commentchar compdestroy \ compoundliterals compoundstmt condifomit constannot controldepth csyntax czechnames czechoslovaknames deadparam \ decl divzero enum enumtag exports external fields flags forbody format freearray \ funcpointer functionmacro glob globals impabstract info init innerarray inparam internal iter keep libs \ linked lintcomments list longint loopexec looptesteffect \ macros macrosef malloc merge mergenull modifies modtest moduncon \ mongoincludes mystrncat noeffect null nullret nullassign numabstract observer oldstyle outglob outparam \ parentype postnotnull preds prefixes printflike rc refcounts release repexpose \ returned russian sharing shifts sizesigns slovaknames \ specclauses \ special stack staticarray strings \ stringliteral \ structassign typequals typeof ud ulstypes union unioninit \ unnamedsu unreachable unsignedcompare \ unused ullint utypes void widestrings UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS)) SUBDIRTESTS = metastate mergestate tainted fileio \ simplebufferConstraintTests moreBufferTests moreBufferTests2 globalbufferannotation \ maxset strchr sizeoftest for manual ### warnuse doesn't work yet! SUBDIRTESTS += tests2.2 SUBDIRTESTS += tests2.4 SUBDIRTESTS += tests2.5 SUBDIRTESTS += db1 db2 db3 SPLINTTESTS = $(UNITTESTS) $(SUBDIRTESTS) QUICKTESTS = db3 .PHONY: all check all check: fulltest .PHONY: version version: -$(SPLINT) -help version .PHONY: help help: -@$(SPLINT) -@$(SPLINT) -help -@$(SPLINTP) -asdf -@$(SPLINTP) +boolint +boolint -@$(SPLINT) -help flags alpha #commenting these out for the release because they will almost always fail #since the default will only fit one system #Don't want to panic the user... # -@$(SPLINT) -help flags all | $(GREP) -v "^larchpath " | $(GREP) -v "^lclimportdir " | $(GREP) -v " Path argument. Default: " | $(GREP) -v " Directory argument. Default: " | $(GREP) -v " lclimportdir " # -@$(SPLINT) -help flags full | $(GREP) -v "^larchpath " | $(GREP) -v "^lclimportdir " | $(GREP) -v " Path argument. Default: " | $(GREP) -v " Directory argument. Default: " | $(GREP) -v " lclimportdir " # -@$(SPLINT) -help flags manual | $(GREP) -v "^larchpath " | $(GREP) -v "^lclimportdir " | $(GREP) -v " Path argument. Default: " | $(GREP) -v " Directory argument. Default: " | $(GREP) -v " lclimportdir " #larch and lclimportdir have different hardcoded default paths so don't include the path in the output.. .PHONY: clean-local clean-local: -rm -f *~ #*# *.o *.lcs a.out -rm -f *.out -rm *.lcd *.lh -cd db1; $(MAKE) clean -cd db2; $(MAKE) clean -cd db3; $(MAKE) clean ## All tests need splint to be built $(SPLINTTESTS): $(SPLINT) $(SPLINT): cd $(top_builddir)/src; $(MAKE) ## This is a kludgey way of processing the output to make it match exactly ## The last matcher is the most annoying, as it can differ (the first two are ## pretty much fixed); usually, you'll have 'make[1]:', but on DOS it is ## 'make.exe[1]:' (it might even be 'c:/path/to/make.exe[1]:', but that's ## not supported). ## The tests should really be re-done as shell-scripts or something... maybe ## autotest could be used once it's finished. CLEANOUTPUT = $(GREP) -v "Splint 3." | $(GREP) -v "$(SPLINT)" | $(GREP) -v "^make.*\[[1-9]*\]:" | $(GREP) -v "^gmake.*\[[1-9]*\]:" | $(GREP) -v "^gmake -e" | $(GREP) -v "^make -e" |$(GREP) -v "config.status: creating test/Makefile" | $(GREP) -v "cd .. && " | $(GREP) -v "CONFIG_HEADERS=" | $(GREP) -v "CONFIG_FILES=" #drl 12/07/2002 These rules for .c and .expect files don't make sense # and they are confusing make dist so I'm taking them out. ## Not real C code #.c.expect: # $(MAKE) $* |& $(CLEANOUTPUT) >$*.expect && cat $*.expect # #.c.diff: # $(MAKE) $* |& $(CLEANOUTPUT) >$*.out && diff $*.expect $*.out #drl temporally take this out. #.PHONY: expects #expects: # @echo "Saving old expects..."; \ # cat *.expect >expects-`date +"%y-%m-%d-%H"` # @for TEST in $(UNITTESTS) $(INTEGTESTS); do \ # echo "Making $$TEST.expect..."; \ # $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.expect; \ # cat $$TEST.expect; \ # done CheckSystemDir = (pwd | grep -q "/usr" && echo "Warning tests which not run correctly when splint is built in /usr or a subdirectory under /usr. Build splint in a different directory or disregard test failures." ) .PHONY: quicktest quicktest: $(CheckSystemDir) @for TEST in $(QUICKTESTS); do \ echo "Checking $$TEST..."; \ $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ echo "*** FAIL ***"; \ done .PHONY: fulltest fulltest: @echo "Testing $(PACKAGE) $(VERSION)..." @echo @echo "Version Info:" @$(SPLINT) -help version @$(SPLINT) -help vars @echo "" @echo "Tests:" @echo "" @for TEST in $(SPLINTTESTS); do \ echo "Checking $$TEST..."; \ $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ echo "*** FAIL ***"; \ done ### Rules for tests start here .PHONY: abstptr abstptr: -$(SPLINTR) abstptr -expect 9 -$(SPLINTR) abstptr +voidabstract -expect 6 .PHONY: abstract abstract: -$(SPLINTR) abst_t.lcl commentcmd.c -expect 15 .PHONY: alias alias: -$(SPLINTR) +lh mut -$(SPLINTR) mut alias +globalias -expect 19 -$(SPLINTR) mut alias2 +globalias -expect 17 -$(SPLINTR) +lh alias3 -expect 14 -$(SPLINTR) +lh alias4 +boolint -$(SPLINTR) alias4 -pred +retalias -expect 6 -$(SPLINTR) +lh alias5 +memchecks -null -specundef -expect 5 .PHONY: alttypes alttypes: -$(SPLINTR) alttypes.c -expect 2 ### ### evans 2001-06-07 - updated nameCheck.c to reflect C9X. ### Reports one new errors for ansireserved.c - wctomb is bad even as a local ### variable (could be a macro?) ### Reports 3 additional errors for +checks; no longer suppresses name errors ### in the presense of other errors. ### .PHONY: ansireserved ansireserved: -$(SPLINTR) ansireserved.c +ansireserved -nolib -expect 9 -$(SPLINTR) ansireserved.c +ansireserved +ansireservedlocal -nolib -expect 11 -$(SPLINTRN) ansireserved.c +checks -exportlocal -exportheadervar -exportheader -expect 12 -$(SPLINTR) ansireserved2.c +ansireserved -expect 1 .PHONY: argorder argorder: -$(SPLINTR) argorder.c -expect 4 -$(SPLINTR) argorder2 -expect 5 -$(SPLINTR) argorder3.c -expect 8 -$(SPLINTR) argorder4 -expect 9 -$(SPLINTR) argorder4 -evalorder -expect 1 -$(SPLINTR) argorder5.c +evalorderuncon -expect 3 .PHONY: args args: -$(SPLINTR) args -noeffect -expect 12 .PHONY: arraydims arraydims: -$(SPLINTR) arraydims.c -varuse -expect 2 -$(SPLINTR) arraydims.c -initsize -varuse .PHONY: arrayinit arrayinit: -$(SPLINTR) arrayinit.c -expect 9 .PHONY: arraylit arraylit: -$(SPLINTR) arraylit.c -expect 2 -$(SPLINTR) arraylit.c +stringliteralsmaller -expect 4 .PHONY: blocks blocks: -$(SPLINTR) blocks.c -expect 4 -$(SPLINTR) blocks.c +ifblock +elseifcomplete -expect 7 -$(SPLINTR) blocks.c -ifempty +whileempty +whileblock -expect 3 -$(SPLINTR) blocks.c -ifempty +forempty +forblock -expect 3 -$(SPLINTR) blocks.c +allempty -expect 6 -$(SPLINTRN) blocks.c +strict -exportlocal +partial -exportheader -expect 11 .PHONY: break break: -$(SPLINTR) break.c -expect 4 -$(SPLINTR) break.c +deepbreak -expect 6 -$(SPLINTR) break.c +deepbreak -looploopbreak -expect 5 .PHONY: cases cases: -$(SPLINTR) cases.c -expect 5 -$(SPLINTR) cases2.c -expect 2 -$(SPLINTRN) cases2.c +checks -exportlocal -exportheader -expect 3 -$(SPLINTRN) cases2.c +checks -exportlocal -exportheader -branchstate -expect 3 .PHONY: cast cast: -$(SPLINTR) cast -accessmodule -expect 20 -$(SPLINTRN) cast2.c +checks -exportlocal -exportheader -expect 3 .PHONY: chararraylit chararraylit: -$(SPLINTR) chararraylit.c -expect 2 ### Two addition errors detected with 2.5 with -numliteral. ### evans 2002-12-15: finds one more but in charlit .PHONY: charlit charlit: -$(SPLINTR) +hints charlit.c -expect 4 -$(SPLINTR) +hints -numliteral charlit.c -expect 6 -$(SPLINTR) +hints charlit.c +charintliteral +ignoresigns -expect 1 .PHONY: clauses clauses: -$(SPLINTR) clauses.c +memchecks -expect 4 -$(SPLINTR) clauses2.c +memchecks -$(SPLINTR) clauses3.c +memchecks -expect 2 -$(SPLINTR) clauses3.c +memchecks +unixlib -expect 3 .PHONY: commentchar commentchar: -$(SPLINTR) commentchar.c -expect 4 -$(SPLINTR) -commentchar '#' commentchar.c -expect 4 .PHONY: controldepth controldepth: -$(SPLINTR) +hints -controlnestdepth 2 controldepth.c -expect 2 -$(SPLINTR) +hints -controlnestdepth 1 controldepth.c -expect 2 ### ### 1 extra warning reported for +strict now because of out-of-bounds read ### .PHONY: compdestroy compdestroy: -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader -expect 1 -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy -expect 2 -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy +strictusereleased -expect 3 -$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 4 .PHONY: compoundliterals compoundliterals: ${SPLINTRN} compoundliterals.c .PHONY: compoundstmt compoundstmt: ${SPLINTRN} compoundstmt.c -expect 3 .PHONY: condifomit condifomit: ${SPLINTRN} -gnuextensions condifomit.c -expect 4 ${SPLINTRN} +gnuextensions condifomit.c -expect 1 .PHONY: constannot constannot: ${SPLINTRN} constannot.c +boundswrite -exportlocal -expect 2 .PHONY: csyntax csyntax: -$(SPLINTR) +quiet -incondefs csyntax.c -expect 1 -$(SPLINTR) +quiet csyntax2.c -expect 2 -$(SPLINTR) +quiet csyntax3.c -expect 1 -$(SPLINTR) +quiet -incondefs csyntax4.c -$(SPLINTR) +quiet csyntax5.c -$(SPLINTR) +quiet csyntax6.c -$(SPLINTR) +quiet csyntax7.c -$(SPLINTR) +quiet csyntax8.c -$(SPLINTR) +quiet csyntax9.c -$(SPLINTR) +quiet csyntax10.c -$(SPLINTR) +quiet csyntax11.c -$(SPLINTR) +quiet csyntax12.c -$(SPLINTR) +quiet csyntax13.c -expect 1 -$(SPLINTR) +quiet csyntax14.c -$(SPLINTR) +quiet csyntax15.c -$(SPLINTR) +quiet csyntax16.c -expect 2 -$(SPLINTR) +quiet csyntax17.c -expect 3 .PHONY: czechnames czechnames: -$(SPLINTR) czechnames.c -$(SPLINTR) +hints +czech czechnames.c -expect 2 -$(SPLINTR) +hints +czech -czechvars czechnames.c -expect 1 -$(SPLINTR) +hints +czech -accessczech czechnames.c -expect 6 .PHONY: czechoslovaknames czechoslovaknames: -$(SPLINTR) +hints +czechoslovak czechnames.c -expect 1 -$(SPLINTR) +hints +czechoslovak slovaknames.c -expect 1 -$(SPLINTR) +hints +czechoslovak +slovakvars slovaknames.c -expect 2 ### ### deadparam added 2001-05-27 ### .PHONY: deadparam deadparam: ${SPLINTR} deadparam.c -expect 3 # # Was expect 3 before 2.4. Earlier versions did not handle implicit # function pointers correctly. # .PHONY: decl decl: -$(SPLINTR) decl.c -expect 2 -$(SPLINTRN) decl.c +strict -exportlocal -expect 6 -$(SPLINTR) decl2 -expect 4 .PHONY: divzero divzero: -$(SPLINTR) divzero.c -varuse -expect 0 .PHONY: enum enum: -$(SPLINTR) enum -expect 16 -$(SPLINTR) enum -misscase -expect 14 .PHONY: enumtag enumtag: -$(SPLINTR) enumtag.c -expect 2 .PHONY: exports exports: -$(SPLINTR) exports.c +exporttype +exportvar +exportfcn +topuse +typeuse -expect 6 -$(SPLINTR) exports.c +exportany -expect 3 -$(SPLINTR) exports.c .PHONY: external external: -$(SPLINTR) external.c +partial -$(SPLINTR) external.c +partial +distinctexternalnames +ansi89limits -expect 2 -$(SPLINTR) external.c -nolib +partial -externalnamelength 3 -expect 3 -$(SPLINTR) external.c -nolib +partial -externalnamelength 3 +externalnamecaseinsensitive -expect 3 -$(SPLINTR) external.c +partial -externalnamelength 3 -expect 4 .PHONY: fields fields: -$(SPLINTR) fields.c +memchecks -expect 6 -$(SPLINTR) fields2.c +memchecks -expect 5 -$(SPLINTR) fields3.c +memchecks .PHONY: flags flags: -$(SPLINTR) flags.c -expect 8 -$(SPLINTR) +nocomments flags.c -expect 2 ### Added 2001-06-02 .PHONY: forbody forbody: ${SPLINTR} forbody.c -expect 2 ### Added 2001-06-03 .PHONY: format format: ${SPLINTR} format.c -expect 3 ${SPLINTR} format.c -formatconst # two new errors (invalid lhs) .PHONY: funcpointer funcpointer: -$(SPLINTR) +memchecks +noparams funcpointer.c -expect 18 .PHONY: functionmacro functionmacro: -$(SPLINTR) functionmacro.c -expect 2 .PHONY: glob glob: -$(SPLINTR) glob -expect 4 -$(SPLINTR) glob -globuse -expect 3 -$(SPLINTR) glob +globunspec -expect 6 .PHONY: globals globals: -$(SPLINTR) -modifies globals.c -expect 5 -$(SPLINTR) -modifies globals.c +allglobals -expect 6 -$(SPLINTR) -modifies globals.c +impcheckedglobals -expect 6 -$(SPLINTR) -modifies globals.c -globals -checkstrictglobals -expect 2 -$(SPLINTR) -modifies globals.c +globunspec -expect 6 -$(SPLINTR) -modifies globals.c +globunspec +allglobals -expect 8 # Was -accessfile .PHONY: impabstract impabstract: -$(SPLINTR) -accessmodule impabstract.c -$(SPLINTR) -accessmodule +hints +impabstract impabstract.c -expect 2 -$(SPLINTR) -accessmodule +hints +impabstract impabstract -expect 4 ### ### evans 2001-12-30: Handle unrecognized pre-processor directives ### (Reported by Pierluigi Sanzani) .PHONY: info info: ${SPLINTR} info.c -expect 4 ### evans 2001-10-14: Expected errors updated .PHONY: init init: -$(SPLINTR) init.c -expect 14 -$(SPLINTRN) init.c +checks -exportlocal -exportheadervar -expect 17 ### evans 2003-09-16 .PHONY: innerarray innerarray: -$(SPLINTR) innerarray.c -expect 10 .PHONY: inparam inparam: -$(SPLINTR) inparam.c -expect 2 -$(SPLINTR) +impouts inparam.c -expect 1 .PHONY: internal internal: -$(SPLINTR) internal.c -expect 1 -$(SPLINTR) internal.c +distinctinternalnames -expect 1 -$(SPLINTR) internal.c +distinctinternalnames +ansi89limits -expect 2 -$(SPLINTR) internal.c -internalnamelen 28 -expect 3 -$(SPLINTR) internal.c +internalnamecaseinsensitive -expect 3 -$(SPLINTR) internal.c +internalnamecaseinsensitive +internalnamelookalike -expect 11 ### ### iter ### 2001-06-06: Error message for iter.lcl:3,6 fixed to iter.lcl:3:6 ### .PHONY: iter iter: -$(SPLINTR) iter -expect 14 -lclexpect 1 -$(SPLINTR) iter2.c -expect 12 .PHONY: keep keep: -$(SPLINTR) keep.c +memchecks -expect 6 ### libs ### 2001-05-22: 2 new errors found (fixed spec of signal) ### 2001-05-30: 3 new errors found (formatconst) ### 2002-07-08: 2 new errors found (getc modifies errno) .PHONY: libs libs: -$(SPLINTR) libs.c +longunsignedunsignedintegral -expect 18 -$(SPLINTR) libs.c -expect 22 -$(SPLINTR) libs.c +globunspec +modunspec -expect 25 -$(SPLINTR) libs.c +strictlib +globunspec +modunspec -expect 44 .PHONY: lintcomments lintcomments: -$(SPLINTR) lintcomments.c -expect 5 -$(SPLINTR) lintcomments.c -warnlintcomments -expect 1 -$(SPLINTR) lintcomments.c -lintcomments -expect 4 .PHONY: list list: -$(SPLINTR) list.c -expect 3 ### ### 2002-12-12: Added test case for +longint and +shortint flags ### .PHONY: longint longint: -$(SPLINTR) longint.c -expect 3 -$(SPLINTR) longint.c +longint -expect 2 -$(SPLINTR) longint.c +shortint -expect 2 -$(SPLINTR) longint.c +shortint +longint -expect 0 ### ### 2002-01-01: Added test case for obvious loop execution. ### .PHONY: loopexec loopexec: -$(SPLINTR) loopexec.c -expect 1 -$(SPLINTR) loopexec.c -obviousloopexec -expect 3 .PHONY: looptesteffect looptesteffect: -$(SPLINTR) looptesteffect.c -expect 1 .PHONY: macros macros: -$(SPLINTR) macros -expect 17 -$(SPLINTR) macros.c +allmacros -expect 34 -$(SPLINTR) macros.c +fcnmacros -expect 31 .PHONY: macrosef macrosef: -$(SPLINTR) macrosef -expect 4 -$(SPLINTR) macrosef.c +allmacros -expect 3 -$(SPLINTR) macrosef.c +allmacros +sefuncon -expect 4 .PHONY: malloc malloc: -$(SPLINTRN) malloc.c +bounds -exportlocal -expect 7 .PHONY: merge merge: -$(SPLINTRN) merge.c +checks -exportlocal -exportheadervar -exportheader -expect 3 .PHONY: mergenull mergenull: -$(SPLINTRN) mergenull.c .PHONY: modifies modifies: -$(SPLINTR) modifies.c modclient.c +impcheckedstatics +mustmod -expect 7 .PHONY: modtest modtest: -$(SPLINTR) modtest -expect 10 -$(SPLINTR) modtest +modunspec -expect 13 -$(SPLINTR) modtest +mustmod -expect 14 .PHONY: moduncon moduncon: -$(SPLINTR) moduncon.c +moduncon -memchecks -expect 4 -$(SPLINTRN) moduncon.c +strict +impboundsconstraints -exportlocal -expect 22 .PHONY: mongoincludes mongoincludes: -$(SPLINTR) mongoincludes.c -includenest 1 -expect 19 -$(SPLINTR) mongoincludes.c -includenest 2 -expect 10 -$(SPLINTR) mongoincludes.c -includenest 3 -expect 4 -$(SPLINTR) mongoincludes.c -includenest 4 -expect 1 -$(SPLINTR) mongoincludes.c -includenest 5 -expect 0 .PHONY: mystrncat mystrncat: -$(SPLINTR) mystrncat.c +boundsread +boundswrite -expect 4 .PHONY: noeffect noeffect: ${SPLINTP} noeffect.c +allmacros +checks -expect 3 ### ### 2002-01-01: null1.c: expect increased to 15 because out must be defined ### checking detects one new error ### .PHONY: null null: -$(SPLINTR) null1.c -expect 15 -$(SPLINTR) null1.c -null -mustdefine -expect 4 -$(SPLINTR) null2.c -expect 11 -$(SPLINTR) null3.c -expect 15 -$(SPLINTR) null3.c +unixlib -expect 16 -$(SPLINTR) null4.c -expect 1 -$(SPLINTR) null5.c -expect 4 -$(SPLINTR) null6 -expect 4 -$(SPLINTR) +quiet null6.lcl -dump null6 -$(SPLINTR) null6.c -load null6 -expect 4 ### Added for 3.0 (bugs reported by Kevin Broady) .PHONY: nullret nullret: -$(SPLINTR) nullret.c -expect 2 -$(SPLINTR) -nullret nullret.c -expect 0 .PHONY: nullassign nullassign: -$(SPLINTR) nullassign.c -expect 2 -$(SPLINTR) -nullassign nullassign.c -expect 1 ### Added for 3.1 - evans 2002-12-14 .PHONY: numabstract numabstract: -$(SPLINTR) numabstract.c -expect 11 -$(SPLINTR) numabstract.c +numabstractlit -expect 9 -$(SPLINTR) numabstract.c -numabstractcast -expect 10 # # Before 2.4, expected one more because error was reported both as # dependent and observer. # .PHONY: observer observer: -$(SPLINTRN) observer +checks -exportlocal -exportheader -expect 9 -$(SPLINTRN) observer.c +checks -exportlocal -exportheader -expect 8 -$(SPLINTR) observer.c -expect 7 .PHONY: oldstyle oldstyle: -$(SPLINTR) oldstyle oldstyle2.c -expect 5 .PHONY: outglob outglob: -$(SPLINTR) outglob -expect 10 .PHONY: outparam outparam: -$(SPLINTR) outparam -expect 12 ### evans 2001-08-26: postnotnull new .PHONY: postnotnull postnotnull: ${SPLINTR} postnotnull.c -expect 1 ### evans 2002-02-09: added parentype.c .PHONY: parentype parentype: ${SPLINTR} parentype.c # # Four new +fcnuse errors for -strict (evans 2001-07-22) # .PHONY: preds preds: -$(SPLINTR) +hints preds.c -expect 6 -$(SPLINTRN) +hints preds.c -weak -expect 1 -$(SPLINTRN) +hints preds.c -strict +impboundsconstraints -exportlocal -exportheader -expect 10 .PHONY: prefixes prefixes: -$(SPLINTR) prefixes.c +partial -$(SPLINTRN) prefixes.c +allmacros +checks -exportlocal +partial -exportheader -exportheadervar -expect 4 -$(SPLINTR) prefixes.c -typeprefix "T" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^" -expect 1 -$(SPLINTR) prefixes.c -typeprefix "^*" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^%*" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^~*" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^" +typeprefixexclude -expect 7 -$(SPLINTR) prefixes.c -filestaticprefix "^^" -expect 4 -$(SPLINTR) prefixes.c -filestaticprefix "^#" -expect 5 -$(SPLINTR) prefixes.c -filestaticprefix "^?&x" -expect 5 -$(SPLINTR) prefixes.c -globalprefix "G" -expect 1 -$(SPLINTR) prefixes.c -globalprefix "&G?_^" -expect 1 -$(SPLINTR) prefixes.c -externalprefix "G" -expect 5 -$(SPLINTR) prefixes.c -typeprefix "T" -externalprefix "G" -expect 4 -$(SPLINTR) prefixes.c -localprefix "?*" +localprefixexclude -expect 13 .PHONY: printflike printflike: -$(SPLINTR) printflike.c -expect 6 -$(SPLINTR) printflike.c -warnlintcomments -expect 5 .PHONY: rc rc: -$(SPLINTR) -DMYSTERY='"a flag\"wicked cool"' rc.c -expect 1 -$(SPLINTR) -DMYSTERY=12 rc.c -expect 1 -$(SPLINTR) -f rc1.splintrc rc.c -expect 1 -$(SPLINTR) -UMYSTERY -f rc1.splintrc rc.c -expect 1 -$(SPLINTR) -f rc3.splintrc rc.c -expect 1 .PHONY: rcfiles rcfiles: cd rcfiles; ${MAKE} SPLINT="-$(SPLINTPNEST)" .PHONY: refcounts refcounts: -$(SPLINTR) refcounts.c -expect 7 .PHONY: release release: -$(SPLINTR) release.c +memchecks -expect 1 .PHONY: repexpose repexpose: -$(SPLINTR) +lh repexpose +memchecks -expect 12 -$(SPLINTR) repexpose +memchecks +retalias -expect 15 -$(SPLINTRN) repexpose +checks -exportlocal -expect 27 ### returned added 2001-05-27 ### (Bug discovered checking splint sources.) .PHONY: returned returned: ${SPLINTR} returned.c -expect 1 ### russian added 2003-06-07: bug reported in pre-processing non-standard characters. .PHONY: russian russian: ${SPLINTR} russian.c .PHONY: sharing sharing: -$(SPLINTR) sharing1.c -expect 21 -$(SPLINTR) sharing3.c -expect 3 -$(SPLINTR) sharing4.c -expect 13 -$(SPLINTR) sharing4.c -paramimptemp -expect 12 -$(SPLINTR) sharing5.c -expect 6 .PHONY: shifts shifts: -$(SPLINTR) shifts.c -expect 4 -$(SPLINTR) shifts.c -shiftimplementation -expect 3 -$(SPLINTR) shifts.c -shiftnegative -expect 1 #drl comment this out until sizesigns is added to cvs ### evans - added 2002-08-17: check warnings with arbitrary integral types sizesigns: -$(SPLINTR) +strict sizesigns.c -expect 5 -$(SPLINTR) +strict +matchanyintegral sizesigns.c -expect 4 .PHONY: slovaknames slovaknames: -$(SPLINTR) +hints slovaknames.c -expect 1 -$(SPLINTR) +hints slovaknames.c +accessslovak -$(SPLINTR) +hints +slovak slovaknames.c -expect 3 -$(SPLINTR) +hints +slovak -slovakvars slovaknames.c -expect 2 -$(SPLINTR) +hints +slovak -accessslovak slovaknames.c -expect 7 ## ## evans 2002-07-22: 1 less warning for specclauses3.c because of NULL result ## .PHONY: specclauses specclauses: -$(SPLINTR) specclauses.c -expect 6 -$(SPLINTR) specclauses2.c -expect 8 -$(SPLINTR) specclauses3.c -expect 5 -$(SPLINTR) specclauses4.c -expect 3 -$(SPLINTR) specclauses5.c -expect 3 .PHONY: specclauses1 specclauses1: -$(SPLINTR) specclauses.c -expect 6 .PHONY: specclauses2 specclauses2: -$(SPLINTR) specclauses2.c -expect 8 .PHONY: specclauses3 specclauses3: -$(SPLINTR) specclauses3.c -expect 6 .PHONY: specclauses4 specclauses4: -$(SPLINTR) specclauses4.c -expect 3 .PHONY: specclauses5 specclauses5: -$(SPLINTR) specclauses5.c -expect 3 .PHONY: special special: -$(SPLINTR) special -expect 20 -$(SPLINTR) special -relaxquals -expect 22 .PHONY: stack stack: -$(SPLINTR) stack.c -expect 5 -$(SPLINTR) stack.c -stackref .PHONY: staticarray staticarray: -$(SPLINTR) staticarray.c -expect 3 ### ### evans 2002-03-16: Default setting of stringliteralnoroomfinalnull changed ### .PHONY: stringliteral stringliteral: -$(SPLINTR) stringliteral.c -stringliteralnoroomfinalnull -expect 3 -$(SPLINTR) stringliteral.c -expect 4 .PHONY: strings strings: -$(SPLINTR) strings.c -expect 3 -$(SPLINTR) -readonlystrings -expect 1 strings.c -$(SPLINTR) +modobserverstrict -maintype -expect 4 strings.c .PHONY: structassign structassign: -$(SPLINTR) structassign.c -expect 4 .PHONY: typeof typeof: -$(SPLINTR) typeof.c -expect 2 .PHONY: typequals typequals: -$(SPLINTR) typequals.c tq.lcl -expect 5 -$(SPLINTR) typequals.c -expect 2 .PHONY: ud ud: -$(SPLINTR) ud.c -expect 9 -$(SPLINTR) ud2 -specundef -expect 3 .PHONY: ulstypes ulstypes: -$(SPLINTR) ulstypes.c -expect 8 -$(SPLINTR) ulstypes.c +ignorequals -$(SPLINTRN) ulstypes.c +strict -exportheader -exportheadervar -expect 28 # 3 more detected with version 2.5 (change in -numliteral setting) .PHONY: union union: -$(SPLINTR) +memchecks union.c -expect 8 ### ### Added 2001-12-30: fixed union initializer checking in response to ### bug report from Jim Zelenka. ### .PHONY: unioninit unioninit: -$(SPLINTR) unioninit.c -expect 2 .PHONY: unnamedsu unnamedsu: -$(SPLINTR) unnamedsu.c -expect 0 .PHONY: unreachable unreachable: -$(SPLINTR) unreachable.c -expect 5 -$(SPLINTR) -unreachable unreachable.c -expect 2 -$(SPLINTR) switch.c -expect 4 .PHONY: unsignedcompare unsignedcompare: ${SPLINTR} +posixlib unsignedcompare.c -expect 4 ### ### 2001-06-08 evans: 2 new errors after fixing ansireserved name checks ### .PHONY: unused unused: -$(SPLINTRN) unused.c +checks -exportlocal -expect 5 -$(SPLINTRN) unused.c +checks -exportlocal +topuse -expect 8 ### ### 2001-06-10: Provided by Jim Zalenka ### .PHONY: ullint ullint: ${SPLINTRN} ullint.c -expect 5 ${SPLINTRN} ullint.c +charint +charintliteral -expect 2 ### ### 2001-12-30: Poor warnings reported by Peter Deutsch ### ### 2002-07-03: removed warnings for datatype/macro definitions ### .PHONY: utypes utypes: ${SPLINTRN} utypes.c -expect 2 ### .PHONY: void void: ${SPLINTRN} void.c -expect 2 ### ### 2001-12-30: Problems with wide character strings reported by Nelson Beebe ### .PHONY: widestrings widestrings: ${SPLINTRN} widestrings.c -expect 2 ### ### New since 2.5q: ### .PHONY: linked linked: ${SPLINTR} linked.c -expect 4 ${SPLINTR} linked2.c -expect 3 ${SPLINTR} linked3.c -expect 5 ${SPLINTR} linked4.c -expect 6 ${SPLINTR} linked5.c -expect 4 ${SPLINTR} linked6.c -expect 4 .PHONY: freearray freearray: ${SPLINTR} freearray.c -expect 1 .PHONY: sizeof sizeof: -$(SPLINTR) +bounds sizeof.c -expect 1 .PHONY: buffertest buffertest: -$(SPLINTR) +bounds buffertest1.c -expect 5 ## Integration Tests ## evans 2000-12-22 ## db2: 2 errors are no longer reported, since eref is immutable. ## Need to clarify what it means for an object to be immutable; ## there should be 2 types with different storage requirements. .PHONY: $(SUBDIRTESTS) $(SUBDIRTESTS): cd $@; $(MAKE) SPLINT="$(SPLINTRNNEST)" #drl 11/29/2001 This is a very ugly hack to get make dist to work EXTRA_DIST = ./abst_t.lcl \ ./abstptr.lcl \ ./alias.lcl \ ./alias2.lcl \ ./alias3.lcl \ ./db1/erc.lcl \ ./db1/bool.lcl \ ./db1/dbase.lcl \ ./db1/employee.lcl \ ./db1/empset.lcl \ ./db1/eref.lcl \ ./db1/ereftab.lcl \ ./alias4.lcl \ ./alias5.lcl \ ./argorder2.lcl \ ./argorder4.lcl \ ./args.lcl \ ./cast.lcl \ ./decl2.lcl \ ./empty.lcl \ ./enum.lcl \ ./glob.lcl \ ./impabstract.lcl \ ./iter.lcl \ ./macros.lcl \ ./macrosef.lcl \ ./modtest.lcl \ ./mut.lcl \ ./mut.lh.expect \ ./db2/dbase.lcl \ ./db2/employee.lcl \ ./db2/empset.lcl \ ./db2/erc.lcl \ ./db2/eref.lcl \ ./db2/ereftab.lcl \ ./db2/etest.lcl \ ./null6.lcl \ ./observer.lcl \ ./oldstyle.lcl \ ./outglob.lcl \ ./outparam.lcl \ ./rc1.splintrc \ ./rc2.splintrc \ ./rc3.splintrc \ ./rc3.splintrc.os2 \ ./repexpose.lcl \ ./repexpose.lh.expect \ ./special.lcl \ ./db3/.splintrc \ ./db3/bool.lcl \ ./db3/check.lcl \ ./db3/dbase.lcl \ ./db3/employee.lcl \ ./db3/empset.lcl \ ./db3/erc.lcl \ ./db3/eref.lcl \ ./db3/ereftab.lcl \ ./db3/README \ ./db3/clean \ ./db3/tidy \ ./tq.lcl \ ./ud2.lcl \ ./for/.splintrc \ ./globalbufferannotation/.splintrc \ ./maxset/.splintrc \ ./strchr/.splintrc \ ./tests2.2/bool.lcl \ ./tests2.4/subdir/main.lcl \ ./abstptr.c \ ./alias.c \ ./alias2.c \ ./alias3.c \ ./db1/dbase.c \ ./db1/drive.c \ ./db1/employee.c \ ./db1/empset.c \ ./db1/erc.c \ ./db1/eref.c \ ./db1/ereftab.c \ ./alias4.c \ ./alias5.c \ ./alttypes.c \ ./ansireserved.c \ ./ansireserved2.c \ ./argorder.c \ ./argorder2.c \ ./argorder3.c \ ./argorder4.c \ ./argorder5.c \ ./args.c \ ./arrayinit.c \ ./arraylit.c \ ./blocks.c \ ./branchstate.c \ ./break.c \ ./cases.c \ ./buffertest1.c \ ./cases2.c \ ./cast.c \ ./cast2.c \ ./chararraylit.c \ ./charlit.c \ ./clauses.c \ ./clauses2.c \ ./clauses3.c \ ./commentchar.c \ ./commentcmd.c \ ./compdestroy.c \ ./compoundliterals.c ./compoundliterals.expect \ ./compoundstmt.c ./compoundstmt.expect \ ./condifomit.c \ ./csyntax.c \ ./constannot.c \ ./controldepth.c \ ./csyntax10.c \ ./csyntax11.c \ ./csyntax12.c \ ./csyntax13.c \ ./csyntax14.c \ ./csyntax15.c \ ./csyntax16.c \ ./csyntax17.c \ ./csyntax2.c \ ./csyntax3.c \ ./csyntax4.c \ ./csyntax5.c \ ./csyntax6.c \ ./csyntax7.c \ ./csyntax8.c \ ./csyntax9.c \ ./czechnames.c \ ./czechoslovaknames.c \ ./deadparam.c \ ./decl.c \ ./decl2.c \ ./dkf5kEnum.c \ ./dkf5kRange.c \ ./dkf5kSprintf.c \ ./ensures.c \ ./enum.c \ ./enumtag.c \ ./exports.c \ ./external.c \ ./fields.c \ ./fields2.c \ ./fields3.c \ ./flags.c \ ./glob.c \ ./forbody.c \ ./format.c \ ./freearray.c \ ./funcpointer.c \ ./globals.c \ ./globals2.c \ ./impabstract.c \ ./init.c \ ./innerfree.c \ ./inparam.c \ ./internal.c \ ./iter.c \ ./iter2.c \ ./keep.c \ ./libs.c \ ./linked.c \ ./linked2.c \ ./linked3.c \ ./linked4.c \ ./linked5.c \ ./linked6.c \ ./lintcomments.c \ ./list.c \ ./longconstants.c \ ./macros.c \ ./macrosef.c \ ./malloc.c \ ./merge.c \ ./modclient.c \ ./modifies.c \ ./modtest.c \ ./moduncon.c \ ./mongoincludes.c \ ./mparen.c \ ./mut.c \ ./mystrncat.c \ ./noeffect.c \ ./null1.c \ ./null2.c \ ./null3.c \ ./null4.c \ ./null5.c \ ./db2/dbase.c \ ./db2/drive.c \ ./db2/employee.c \ ./db2/empset.c \ ./db2/erc.c \ ./db2/eref.c \ ./db2/ereftab.c \ ./db2/etest.c \ ./null6.c \ ./nullassign.c \ ./nullret.c \ ./observer.c \ ./oldstyle.c \ ./outglob.c \ ./outparam.c \ ./postnotnull.c \ ./preds.c \ ./prefixes.c \ ./printflike.c \ ./rc.c \ ./refcounts.c \ ./release.c \ ./repexpose.c \ ./returned.c \ ./sharing1.c \ ./sharing2.c \ ./sharing3.c \ ./sharing4.c \ ./sharing5.c \ ./sizeof.c \ ./slovaknames.c \ ./specclauses.c \ ./specclauses2.c \ ./specclauses3.c \ ./specclauses4.c \ ./specclauses5.c \ ./specclauses6.c \ ./special.c \ ./stack.c \ ./staticarray.c \ ./strings.c \ ./structassign.c \ ./switch.c \ ./t1.c \ ./test.c \ ./db3/dbase.c \ ./db3/drive.c \ ./db3/employee.c \ ./db3/empset.c \ ./db3/erc.c \ ./db3/eref.c \ ./db3/ereftab.c \ ./typequals.c \ ./ud.c \ ./ud2.c \ ./ullint.c \ ./ulstypes.c \ ./union.c \ ./unreachable.c \ ./unsignedcompare.c \ ./unnamedsu.c \ ./unused.c \ ./void.c \ ./conditions/miroslaw.c \ ./conditions/releases.c \ ./fileio/file.c \ ./fileio/filebranch.c \ ./fileio/filerw.c \ ./for/for.c \ ./globalbufferannotation/globalvariable.c \ ./maxset/maxsetannotations.c \ ./maxset/maxsetnoannotations.c \ ./mergestate/taintednm.c \ ./metastate/file.c \ ./metastate/file1.c \ ./metastate/file2.c \ ./metastate/file3.c \ ./metastate/file4.c \ ./metastate/file5.c \ ./metastate/file6.c \ ./metastate/file7.c \ ./metastate/filebad.c \ ./metastate/global.c \ ./metastate/nullbranch.c \ ./metastate/nullbranch2.c \ ./metastate/nullret.c \ ./metastate/osd.c \ ./metastate/sockets.c \ ./metastate/sockets2.c \ ./metastate/struct.c \ ./metastate/test.c \ ./metastate/voidptr.c \ ./moreBufferTests/initialization.c \ ./moreBufferTests/simplifyTest.c \ ./moreBufferTests/strncatNotReallyGood.c \ ./moreBufferTests/strncatReallyGood.c \ ./moreBufferTests/strrchr.c \ ./moreBufferTests/unrecogCall.c \ ./nullterminatedtest/buggy1.c \ ./nullterminatedtest/buggy_support1.c \ ./nullterminatedtest/buggy_support_fmakeword.c \ ./nullterminatedtest/test1.c \ ./nullterminatedtest/test3.c \ ./simplebufferConstraintTests/m.c \ ./simplebufferConstraintTests/sizeof.c \ ./simplebufferConstraintTests/test3.c \ ./simplebufferConstraintTests/test7.c \ ./sizeoftest/sizeof.c \ ./sizeoftest/sizeofConst.c \ ./sizeoftest/Makefile \ ./strchr/strchr.c \ ./suppressfile/test.c \ ./tainted/sprintf.c \ ./tainted/t1.c \ ./tainted/tainted.c \ ./tainted/tainted2.c \ ./tainted/tainted3.c \ ./tainted/tainted4.c \ ./tainted/tainted5.c \ ./tainted/taintedimplicit.c \ ./tainted/taintedmerge.c \ ./tainted/taintedx.c \ ./tainted/test.c \ ./tclauses/globals.c \ ./tclauses/gt.c \ ./tclauses/modifies.c \ ./tclauses/struct.c \ ./tclauses/undef.c \ ./tests2.2/arbints.c \ ./tests2.2/arrayfcn.c \ ./tests2.2/booldef.c \ ./tests2.2/boolenum.c \ ./tests2.2/boolops.c \ ./tests2.2/break.c \ ./tests2.2/bstring.c \ ./tests2.2/decl.c \ ./tests2.2/enumbool.c \ ./tests2.2/extension.c \ ./tests2.2/libraries.c \ ./tests2.2/modarray.c \ ./tests2.2/nestext.c \ ./tests2.2/offsetof.c \ ./tests2.2/posix.c \ ./tests2.2/realloc.c \ ./tests2.2/rex.c \ ./tests2.2/sizeofarray.c \ ./tests2.2/struct.c \ ./tests2.2a/addassign.c \ ./tests2.2a/arrayparam.c \ ./tests2.2a/bitops.c \ ./tests2.2a/boolcomp.c \ ./tests2.2a/boolenum.c \ ./tests2.2a/dobb.c \ ./tests2.2a/duff.c \ ./tests2.2a/erik.c \ ./tests2.2a/floatdouble.c \ ./tests2.2a/florian.c \ ./tests2.2a/fred.c \ ./tests2.2a/isalpha.c \ ./tests2.2a/notreached.c \ ./tests2.2a/obviousloop.c \ ./tests2.2a/popik.c \ ./tests2.2a/sizeof.c \ ./tests2.2a/toralf.c \ ./tests2.4/subdir/main.c \ ./tests2.4/alignof.c \ ./tests2.4/array.c \ ./tests2.4/bitfields.c \ ./tests2.4/bug1.c \ ./tests2.4/bug2.c \ ./tests2.4/bug3.c \ ./tests2.4/chin.c \ ./tests2.4/cpptest.c \ ./tests2.4/driverstub.c \ ./tests2.4/duffs.c \ ./tests2.4/emptycase.c \ ./tests2.4/enumtest.c \ ./tests2.4/error.c \ ./tests2.4/fink.c \ ./tests2.4/flagequal.c \ ./tests2.4/forward.c \ ./tests2.4/hash.c \ ./tests2.4/hexconstants.c \ ./tests2.4/innercomment.c \ ./tests2.4/komazi.c \ ./tests2.4/longlong.c \ ./tests2.4/main.c \ ./tests2.4/nothing.c \ ./tests2.4/offsetof.c \ ./tests2.4/print.c \ ./tests2.4/ric.c \ ./tests2.4/syncomment.c \ ./tests2.4/syslog.c \ ./tests2.4/test0.c \ ./tests2.4/test1.c \ ./tests2.4/test2.c \ ./tests2.4/timecard.c \ ./tests2.4/toothman.c \ ./tests2.4/ulrich.c \ ./tests2.5/badcomment.c \ ./tests2.5/boolbad.c \ ./tests2.5/boolt.c \ ./tests2.5/booltest.c \ ./tests2.5/dummyfile.c \ ./tests2.5/hoof.c \ ./tests2.5/immutable.c \ ./tests2.5/impabsmodule.c \ ./tests2.5/literals.c \ ./tests2.5/quals.c \ ./tests2.5/sort.c \ ./tests2.5/testalt.c \ ./tests2.5/testimmutable.c \ ./tests2.5/uconstants.c \ ./tests2.5/ull.c \ ./warnuse/warnflags.c \ ./warnuse/warngets.c \ ./warnuse/warnuse.c \ ./moreBufferTests2/unknownsize.c \ ./moreBufferTests2/arrayConstExpr.c \ abstptr.expect \ abstract.expect \ alias.expect \ alttypes.expect \ ansireserved.expect \ argorder.expect \ args.expect \ arrayinit.expect \ arraylit.expect \ blocks.expect \ branchstate.expect \ break.expect \ buffertest.expect \ cases.expect \ cast.expect \ chararraylit.expect \ charlit.expect \ clauses.expect \ commentchar.expect \ compdestroy.expect \ constannot.expect \ controldepth.expect \ csyntax.expect \ czechnames.expect \ czechoslovaknames.expect \ db1.expect \ db2.expect \ db3.expect \ deadparam.expect \ decl.expect \ enum.expect \ enumtag.expect \ exports.expect \ external.expect \ fields.expect \ fileio.expect \ flags.expect \ for.expect \ forbody.expect \ format.expect \ freearray.expect \ funcpointer.expect \ glob.expect \ globalbufferannotation.expect \ globals.expect \ help.expect \ impabstract.expect \ init.expect \ inparam.expect \ internal.expect \ iter.expect \ keep.expect \ libs.expect \ linked.expect \ lintcomments.expect \ list.expect \ longconstants.expect \ macros.expect \ macrosef.expect \ maxset.expect \ merge.expect \ mergestate.expect \ metastate.expect \ modifies.expect \ modtest.expect \ moduncon.expect \ mongoincludes.expect \ moreBufferTests.expect \ moreBufferTests2.expect \ mut.lh.expect \ mystrncat.expect \ noeffect.expect \ null.expect \ nullterminatedtest.expect \ observer.expect \ oldstyle.expect \ outglob.expect \ outparam.expect \ postnotnull.expect \ preds.expect \ prefixes.expect \ printflike.expect \ rc.expect \ refcounts.expect \ release.expect \ repexpose.expect \ repexpose.lh.expect \ returned.expect \ sharing.expect \ simplebufferConstraintTests.expect \ sizeof.expect \ sizeoftest.expect \ slovaknames.expect \ specclauses.expect \ special.expect \ stack.expect \ staticarray.expect \ strchr.expect \ strings.expect \ structassign.expect \ tainted.expect \ tests2.2.expect \ tests2.2a.expect \ tests2.3.expect \ tests2.4.expect \ tests2.5.expect \ typequals.expect \ ud.expect \ ullint.expect \ ulstypes.expect \ union.expect \ unnamedsu.expect \ unreachable.expect \ unsignedcompare.expect \ unused.expect \ void.expect \ ./db1/bool.h \ ./db1/dbase.h \ ./db1/employee.h \ ./db1/empset.h \ ./db1/erc.h \ ./db1/eref.h \ ./db1/ereftab.h \ ./bool.h \ ./decl2.h \ ./exports.h \ ./iter.h \ ./iter2.h \ ./minc1.h \ ./minc2.h \ ./minc3.h \ ./minc4.h \ ./minc5.h \ ./modifies.h \ ./mut.h \ ./db2/bool.h \ ./db2/dbase.h \ ./db2/employee.h \ ./db2/empset.h \ ./db2/erc.h \ ./db2/eref.h \ ./db2/ereftab.h \ ./pivo.h \ ./repexpose.h \ ./db3/bool.h \ ./db3/dbase.h \ ./db3/employee.h \ ./db3/empset.h \ ./db3/erc.h \ ./db3/eref.h \ ./db3/ereftab.h \ ./tq.h \ ./metastate/global.h \ ./suppressfile/test.h \ ./tests2.2/mbool.h \ ./tests2.4/forward.h \ ./tests2.4/hash.h \ ./tests2.4/timecard.h \ ./tests2.5/baz.h \ ./tests2.5/bimbim.h \ ./tests2.5/immutable.h \ ./tests2.5/impabsmodule.h \ ./tests2.5/socket.h \ ./Makefile.os2 \ ./db1/Makefile \ ./db2/Makefile \ ./db3/Makefile \ ./conditions/Makefile \ ./fileio/Makefile \ ./for/Makefile \ ./globalbufferannotation/Makefile \ ./maxset/Makefile \ ./mergestate/Makefile \ ./metastate/Makefile \ ./moreBufferTests/Makefile \ ./simplebufferConstraintTests/Makefile \ ./strchr/Makefile \ ./tainted/Makefile \ ./temp/Makefile \ ./tests2.2/Makefile \ ./tests2.2/Makefile-tests2.2.os2 \ ./tests2.4/Makefile \ ./tests2.4/Makefile-tests2.4.os2 \ ./tests2.5/Makefile \ ./warnuse/Makefile \ ./Makefile.am \ ./Makefile.in \ ./moreBufferTests2/Makefile \ ./fileio/eof.mts ./fileio/file.mts ./fileio/filerw.mts ./mergestate/tainted.mts ./mergestate/taintednm.mts ./metastate/file.mts ./metastate/nullterminated.mts ./metastate/sockets.mts ./tainted/tainted-bad.mts ./tainted/tainted.mts ./fileio/file.xh ./fileio/filerw.xh ./mergestate/tainted.xh ./mergestate/taintednm.xh ./metastate/file.xh ./tainted/tainted.xh \ db2.old-expect union.pp warnuse.old-expect \ ./tests2.5/badcomment ./tests2.5/boolbad ./tests2.5/booltest ./tests2.5/uconstants loopexec.expect mergenull.expect shifts.expect looptesteffect.expect \ unioninit.expect unioninit.c utypes.c \ utypes.expect widestrings.expect widestrings.c \ functionmacro.expect functionmacro.c info.c info.expect \ longint.c loopexec.c looptesteffect.c mergenull.c shifts.c \ longint.expect nullret.expect numabstract.expect \ sizesigns.expect typeof.expect \ manual.expect ./manual/Makefile \ ./manual/annotglobs.c ./manual/bool.c ./manual/bool.h ./manual/clauses.c ./manual/employee.h ./manual/exposure.c ./manual/globals.c ./manual/ignore.c ./manual/implicit.c ./manual/intSet.h ./manual/list.c ./manual/loop.c ./manual/macros.c ./manual/modify.c ./manual/mstring.c ./manual/mstring.h ./manual/mstringnn.c ./manual/multiError.c ./manual/names.c ./manual/noeffect.c ./manual/null.c ./manual/only.c ./manual/order.c ./manual/palindrome.c ./manual/palindrome.h ./manual/refs.c ./manual/returned.c ./manual/rgb.c ./manual/rstring.c ./manual/rstring.h ./manual/sample.c ./manual/setChar.c ./manual/setname.c ./manual/setname.h ./manual/special.c ./manual/stack.c ./manual/sumsquares.c ./manual/switch.c ./manual/testpal.c ./manual/types.c ./manual/unique.c ./manual/usedef.c ./manual/bounds.c \ arraydims.expect arraydims.c \ moreBufferTests2/fixedArrayType.c oldstyle2.c \ divzero.expect parentype.expect \ divzero.c parentype.c \ stringliteral.expect stringliteral.c \ numabstract.c sizesigns.c typeof.c nullassign.expect # sizesigns.c sizesigns.expect \ splint-3.1.2.dfsg1/test/Makefile.in0000644021234200000250000015216210645765163014513 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.5 foreign DIFFFLAGS = # -u show context #drl 3/27/2002 get the test suit to print a warning when splint is built under /usr/ #SPLINT = valgrind --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=no $(top_builddir)/src/splint$(EXEEXT) SPLINT = $(top_builddir)/src/splint$(EXEEXT) ### These are shell-specific ### This is horrible! Can't we make top_builddir absolute? #SPLINTNEST = valgrind --leak-resolution=high --num-callers=20 --show-reachable=no --leak-check=no ../$(top_builddir)/src/splint$(EXEEXT) SPLINTNEST = ../$(top_builddir)/src/splint$(EXEEXT) SPLINTPNEST = @$(SPLINTNEST) -nof SPLINTP = @$(SPLINT) -nof # Make sure .splintrc files are not used so test results do not # depend on local settings. SPLINTRN = $(SPLINTP) -hints -booltype "bool" SPLINTR = $(SPLINTRN) -exportlocal +debugfcnconstraint SPLINTRNNEST = $(SPLINTPNEST) -hints -booltype "bool" SPLINTRNEST = $(SPLINTRNNEST) -exportlocal +debugfcnconstraint ### ### rcfiles not included becuase file names will not match exactly ### UNITTESTS = \ help \ abstptr abstract alias alttypes ansireserved argorder \ args arraydims arrayinit arraylit blocks break cases cast chararraylit charlit clauses commentchar compdestroy \ compoundliterals compoundstmt condifomit constannot controldepth csyntax czechnames czechoslovaknames deadparam \ decl divzero enum enumtag exports external fields flags forbody format freearray \ funcpointer functionmacro glob globals impabstract info init innerarray inparam internal iter keep libs \ linked lintcomments list longint loopexec looptesteffect \ macros macrosef malloc merge mergenull modifies modtest moduncon \ mongoincludes mystrncat noeffect null nullret nullassign numabstract observer oldstyle outglob outparam \ parentype postnotnull preds prefixes printflike rc refcounts release repexpose \ returned russian sharing shifts sizesigns slovaknames \ specclauses \ special stack staticarray strings \ stringliteral \ structassign typequals typeof ud ulstypes union unioninit \ unnamedsu unreachable unsignedcompare \ unused ullint utypes void widestrings UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS)) ### warnuse doesn't work yet! SUBDIRTESTS = metastate mergestate tainted fileio \ simplebufferConstraintTests moreBufferTests moreBufferTests2 globalbufferannotation \ maxset strchr sizeoftest for manual\ tests2.2 tests2.4 tests2.5 db1 db2 db3 SPLINTTESTS = $(UNITTESTS) $(SUBDIRTESTS) QUICKTESTS = db3 CLEANOUTPUT = $(GREP) -v "Splint 3." | $(GREP) -v "$(SPLINT)" | $(GREP) -v "^make.*\[[1-9]*\]:" | $(GREP) -v "^gmake.*\[[1-9]*\]:" | $(GREP) -v "^gmake -e" | $(GREP) -v "^make -e" |$(GREP) -v "config.status: creating test/Makefile" | $(GREP) -v "cd .. && " | $(GREP) -v "CONFIG_HEADERS=" | $(GREP) -v "CONFIG_FILES=" #drl 12/07/2002 These rules for .c and .expect files don't make sense # and they are confusing make dist so I'm taking them out. #.c.expect: # $(MAKE) $* |& $(CLEANOUTPUT) >$*.expect && cat $*.expect # #.c.diff: # $(MAKE) $* |& $(CLEANOUTPUT) >$*.out && diff $*.expect $*.out #drl temporally take this out. #.PHONY: expects #expects: # @echo "Saving old expects..."; \ # cat *.expect >expects-`date +"%y-%m-%d-%H"` # @for TEST in $(UNITTESTS) $(INTEGTESTS); do \ # echo "Making $$TEST.expect..."; \ # $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.expect; \ # cat $$TEST.expect; \ # done CheckSystemDir = (pwd | grep -q "/usr" && echo "Warning tests which not run correctly when splint is built in /usr or a subdirectory under /usr. Build splint in a different directory or disregard test failures." ) #drl 11/29/2001 This is a very ugly hack to get make dist to work EXTRA_DIST = ./abst_t.lcl \ ./abstptr.lcl \ ./alias.lcl \ ./alias2.lcl \ ./alias3.lcl \ ./db1/erc.lcl \ ./db1/bool.lcl \ ./db1/dbase.lcl \ ./db1/employee.lcl \ ./db1/empset.lcl \ ./db1/eref.lcl \ ./db1/ereftab.lcl \ ./alias4.lcl \ ./alias5.lcl \ ./argorder2.lcl \ ./argorder4.lcl \ ./args.lcl \ ./cast.lcl \ ./decl2.lcl \ ./empty.lcl \ ./enum.lcl \ ./glob.lcl \ ./impabstract.lcl \ ./iter.lcl \ ./macros.lcl \ ./macrosef.lcl \ ./modtest.lcl \ ./mut.lcl \ ./mut.lh.expect \ ./db2/dbase.lcl \ ./db2/employee.lcl \ ./db2/empset.lcl \ ./db2/erc.lcl \ ./db2/eref.lcl \ ./db2/ereftab.lcl \ ./db2/etest.lcl \ ./null6.lcl \ ./observer.lcl \ ./oldstyle.lcl \ ./outglob.lcl \ ./outparam.lcl \ ./rc1.splintrc \ ./rc2.splintrc \ ./rc3.splintrc \ ./rc3.splintrc.os2 \ ./repexpose.lcl \ ./repexpose.lh.expect \ ./special.lcl \ ./db3/.splintrc \ ./db3/bool.lcl \ ./db3/check.lcl \ ./db3/dbase.lcl \ ./db3/employee.lcl \ ./db3/empset.lcl \ ./db3/erc.lcl \ ./db3/eref.lcl \ ./db3/ereftab.lcl \ ./db3/README \ ./db3/clean \ ./db3/tidy \ ./tq.lcl \ ./ud2.lcl \ ./for/.splintrc \ ./globalbufferannotation/.splintrc \ ./maxset/.splintrc \ ./strchr/.splintrc \ ./tests2.2/bool.lcl \ ./tests2.4/subdir/main.lcl \ ./abstptr.c \ ./alias.c \ ./alias2.c \ ./alias3.c \ ./db1/dbase.c \ ./db1/drive.c \ ./db1/employee.c \ ./db1/empset.c \ ./db1/erc.c \ ./db1/eref.c \ ./db1/ereftab.c \ ./alias4.c \ ./alias5.c \ ./alttypes.c \ ./ansireserved.c \ ./ansireserved2.c \ ./argorder.c \ ./argorder2.c \ ./argorder3.c \ ./argorder4.c \ ./argorder5.c \ ./args.c \ ./arrayinit.c \ ./arraylit.c \ ./blocks.c \ ./branchstate.c \ ./break.c \ ./cases.c \ ./buffertest1.c \ ./cases2.c \ ./cast.c \ ./cast2.c \ ./chararraylit.c \ ./charlit.c \ ./clauses.c \ ./clauses2.c \ ./clauses3.c \ ./commentchar.c \ ./commentcmd.c \ ./compdestroy.c \ ./compoundliterals.c ./compoundliterals.expect \ ./compoundstmt.c ./compoundstmt.expect \ ./condifomit.c \ ./csyntax.c \ ./constannot.c \ ./controldepth.c \ ./csyntax10.c \ ./csyntax11.c \ ./csyntax12.c \ ./csyntax13.c \ ./csyntax14.c \ ./csyntax15.c \ ./csyntax16.c \ ./csyntax17.c \ ./csyntax2.c \ ./csyntax3.c \ ./csyntax4.c \ ./csyntax5.c \ ./csyntax6.c \ ./csyntax7.c \ ./csyntax8.c \ ./csyntax9.c \ ./czechnames.c \ ./czechoslovaknames.c \ ./deadparam.c \ ./decl.c \ ./decl2.c \ ./dkf5kEnum.c \ ./dkf5kRange.c \ ./dkf5kSprintf.c \ ./ensures.c \ ./enum.c \ ./enumtag.c \ ./exports.c \ ./external.c \ ./fields.c \ ./fields2.c \ ./fields3.c \ ./flags.c \ ./glob.c \ ./forbody.c \ ./format.c \ ./freearray.c \ ./funcpointer.c \ ./globals.c \ ./globals2.c \ ./impabstract.c \ ./init.c \ ./innerfree.c \ ./inparam.c \ ./internal.c \ ./iter.c \ ./iter2.c \ ./keep.c \ ./libs.c \ ./linked.c \ ./linked2.c \ ./linked3.c \ ./linked4.c \ ./linked5.c \ ./linked6.c \ ./lintcomments.c \ ./list.c \ ./longconstants.c \ ./macros.c \ ./macrosef.c \ ./malloc.c \ ./merge.c \ ./modclient.c \ ./modifies.c \ ./modtest.c \ ./moduncon.c \ ./mongoincludes.c \ ./mparen.c \ ./mut.c \ ./mystrncat.c \ ./noeffect.c \ ./null1.c \ ./null2.c \ ./null3.c \ ./null4.c \ ./null5.c \ ./db2/dbase.c \ ./db2/drive.c \ ./db2/employee.c \ ./db2/empset.c \ ./db2/erc.c \ ./db2/eref.c \ ./db2/ereftab.c \ ./db2/etest.c \ ./null6.c \ ./nullassign.c \ ./nullret.c \ ./observer.c \ ./oldstyle.c \ ./outglob.c \ ./outparam.c \ ./postnotnull.c \ ./preds.c \ ./prefixes.c \ ./printflike.c \ ./rc.c \ ./refcounts.c \ ./release.c \ ./repexpose.c \ ./returned.c \ ./sharing1.c \ ./sharing2.c \ ./sharing3.c \ ./sharing4.c \ ./sharing5.c \ ./sizeof.c \ ./slovaknames.c \ ./specclauses.c \ ./specclauses2.c \ ./specclauses3.c \ ./specclauses4.c \ ./specclauses5.c \ ./specclauses6.c \ ./special.c \ ./stack.c \ ./staticarray.c \ ./strings.c \ ./structassign.c \ ./switch.c \ ./t1.c \ ./test.c \ ./db3/dbase.c \ ./db3/drive.c \ ./db3/employee.c \ ./db3/empset.c \ ./db3/erc.c \ ./db3/eref.c \ ./db3/ereftab.c \ ./typequals.c \ ./ud.c \ ./ud2.c \ ./ullint.c \ ./ulstypes.c \ ./union.c \ ./unreachable.c \ ./unsignedcompare.c \ ./unnamedsu.c \ ./unused.c \ ./void.c \ ./conditions/miroslaw.c \ ./conditions/releases.c \ ./fileio/file.c \ ./fileio/filebranch.c \ ./fileio/filerw.c \ ./for/for.c \ ./globalbufferannotation/globalvariable.c \ ./maxset/maxsetannotations.c \ ./maxset/maxsetnoannotations.c \ ./mergestate/taintednm.c \ ./metastate/file.c \ ./metastate/file1.c \ ./metastate/file2.c \ ./metastate/file3.c \ ./metastate/file4.c \ ./metastate/file5.c \ ./metastate/file6.c \ ./metastate/file7.c \ ./metastate/filebad.c \ ./metastate/global.c \ ./metastate/nullbranch.c \ ./metastate/nullbranch2.c \ ./metastate/nullret.c \ ./metastate/osd.c \ ./metastate/sockets.c \ ./metastate/sockets2.c \ ./metastate/struct.c \ ./metastate/test.c \ ./metastate/voidptr.c \ ./moreBufferTests/initialization.c \ ./moreBufferTests/simplifyTest.c \ ./moreBufferTests/strncatNotReallyGood.c \ ./moreBufferTests/strncatReallyGood.c \ ./moreBufferTests/strrchr.c \ ./moreBufferTests/unrecogCall.c \ ./nullterminatedtest/buggy1.c \ ./nullterminatedtest/buggy_support1.c \ ./nullterminatedtest/buggy_support_fmakeword.c \ ./nullterminatedtest/test1.c \ ./nullterminatedtest/test3.c \ ./simplebufferConstraintTests/m.c \ ./simplebufferConstraintTests/sizeof.c \ ./simplebufferConstraintTests/test3.c \ ./simplebufferConstraintTests/test7.c \ ./sizeoftest/sizeof.c \ ./sizeoftest/sizeofConst.c \ ./sizeoftest/Makefile \ ./strchr/strchr.c \ ./suppressfile/test.c \ ./tainted/sprintf.c \ ./tainted/t1.c \ ./tainted/tainted.c \ ./tainted/tainted2.c \ ./tainted/tainted3.c \ ./tainted/tainted4.c \ ./tainted/tainted5.c \ ./tainted/taintedimplicit.c \ ./tainted/taintedmerge.c \ ./tainted/taintedx.c \ ./tainted/test.c \ ./tclauses/globals.c \ ./tclauses/gt.c \ ./tclauses/modifies.c \ ./tclauses/struct.c \ ./tclauses/undef.c \ ./tests2.2/arbints.c \ ./tests2.2/arrayfcn.c \ ./tests2.2/booldef.c \ ./tests2.2/boolenum.c \ ./tests2.2/boolops.c \ ./tests2.2/break.c \ ./tests2.2/bstring.c \ ./tests2.2/decl.c \ ./tests2.2/enumbool.c \ ./tests2.2/extension.c \ ./tests2.2/libraries.c \ ./tests2.2/modarray.c \ ./tests2.2/nestext.c \ ./tests2.2/offsetof.c \ ./tests2.2/posix.c \ ./tests2.2/realloc.c \ ./tests2.2/rex.c \ ./tests2.2/sizeofarray.c \ ./tests2.2/struct.c \ ./tests2.2a/addassign.c \ ./tests2.2a/arrayparam.c \ ./tests2.2a/bitops.c \ ./tests2.2a/boolcomp.c \ ./tests2.2a/boolenum.c \ ./tests2.2a/dobb.c \ ./tests2.2a/duff.c \ ./tests2.2a/erik.c \ ./tests2.2a/floatdouble.c \ ./tests2.2a/florian.c \ ./tests2.2a/fred.c \ ./tests2.2a/isalpha.c \ ./tests2.2a/notreached.c \ ./tests2.2a/obviousloop.c \ ./tests2.2a/popik.c \ ./tests2.2a/sizeof.c \ ./tests2.2a/toralf.c \ ./tests2.4/subdir/main.c \ ./tests2.4/alignof.c \ ./tests2.4/array.c \ ./tests2.4/bitfields.c \ ./tests2.4/bug1.c \ ./tests2.4/bug2.c \ ./tests2.4/bug3.c \ ./tests2.4/chin.c \ ./tests2.4/cpptest.c \ ./tests2.4/driverstub.c \ ./tests2.4/duffs.c \ ./tests2.4/emptycase.c \ ./tests2.4/enumtest.c \ ./tests2.4/error.c \ ./tests2.4/fink.c \ ./tests2.4/flagequal.c \ ./tests2.4/forward.c \ ./tests2.4/hash.c \ ./tests2.4/hexconstants.c \ ./tests2.4/innercomment.c \ ./tests2.4/komazi.c \ ./tests2.4/longlong.c \ ./tests2.4/main.c \ ./tests2.4/nothing.c \ ./tests2.4/offsetof.c \ ./tests2.4/print.c \ ./tests2.4/ric.c \ ./tests2.4/syncomment.c \ ./tests2.4/syslog.c \ ./tests2.4/test0.c \ ./tests2.4/test1.c \ ./tests2.4/test2.c \ ./tests2.4/timecard.c \ ./tests2.4/toothman.c \ ./tests2.4/ulrich.c \ ./tests2.5/badcomment.c \ ./tests2.5/boolbad.c \ ./tests2.5/boolt.c \ ./tests2.5/booltest.c \ ./tests2.5/dummyfile.c \ ./tests2.5/hoof.c \ ./tests2.5/immutable.c \ ./tests2.5/impabsmodule.c \ ./tests2.5/literals.c \ ./tests2.5/quals.c \ ./tests2.5/sort.c \ ./tests2.5/testalt.c \ ./tests2.5/testimmutable.c \ ./tests2.5/uconstants.c \ ./tests2.5/ull.c \ ./warnuse/warnflags.c \ ./warnuse/warngets.c \ ./warnuse/warnuse.c \ ./moreBufferTests2/unknownsize.c \ ./moreBufferTests2/arrayConstExpr.c \ abstptr.expect \ abstract.expect \ alias.expect \ alttypes.expect \ ansireserved.expect \ argorder.expect \ args.expect \ arrayinit.expect \ arraylit.expect \ blocks.expect \ branchstate.expect \ break.expect \ buffertest.expect \ cases.expect \ cast.expect \ chararraylit.expect \ charlit.expect \ clauses.expect \ commentchar.expect \ compdestroy.expect \ constannot.expect \ controldepth.expect \ csyntax.expect \ czechnames.expect \ czechoslovaknames.expect \ db1.expect \ db2.expect \ db3.expect \ deadparam.expect \ decl.expect \ enum.expect \ enumtag.expect \ exports.expect \ external.expect \ fields.expect \ fileio.expect \ flags.expect \ for.expect \ forbody.expect \ format.expect \ freearray.expect \ funcpointer.expect \ glob.expect \ globalbufferannotation.expect \ globals.expect \ help.expect \ impabstract.expect \ init.expect \ inparam.expect \ internal.expect \ iter.expect \ keep.expect \ libs.expect \ linked.expect \ lintcomments.expect \ list.expect \ longconstants.expect \ macros.expect \ macrosef.expect \ maxset.expect \ merge.expect \ mergestate.expect \ metastate.expect \ modifies.expect \ modtest.expect \ moduncon.expect \ mongoincludes.expect \ moreBufferTests.expect \ moreBufferTests2.expect \ mut.lh.expect \ mystrncat.expect \ noeffect.expect \ null.expect \ nullterminatedtest.expect \ observer.expect \ oldstyle.expect \ outglob.expect \ outparam.expect \ postnotnull.expect \ preds.expect \ prefixes.expect \ printflike.expect \ rc.expect \ refcounts.expect \ release.expect \ repexpose.expect \ repexpose.lh.expect \ returned.expect \ sharing.expect \ simplebufferConstraintTests.expect \ sizeof.expect \ sizeoftest.expect \ slovaknames.expect \ specclauses.expect \ special.expect \ stack.expect \ staticarray.expect \ strchr.expect \ strings.expect \ structassign.expect \ tainted.expect \ tests2.2.expect \ tests2.2a.expect \ tests2.3.expect \ tests2.4.expect \ tests2.5.expect \ typequals.expect \ ud.expect \ ullint.expect \ ulstypes.expect \ union.expect \ unnamedsu.expect \ unreachable.expect \ unsignedcompare.expect \ unused.expect \ void.expect \ ./db1/bool.h \ ./db1/dbase.h \ ./db1/employee.h \ ./db1/empset.h \ ./db1/erc.h \ ./db1/eref.h \ ./db1/ereftab.h \ ./bool.h \ ./decl2.h \ ./exports.h \ ./iter.h \ ./iter2.h \ ./minc1.h \ ./minc2.h \ ./minc3.h \ ./minc4.h \ ./minc5.h \ ./modifies.h \ ./mut.h \ ./db2/bool.h \ ./db2/dbase.h \ ./db2/employee.h \ ./db2/empset.h \ ./db2/erc.h \ ./db2/eref.h \ ./db2/ereftab.h \ ./pivo.h \ ./repexpose.h \ ./db3/bool.h \ ./db3/dbase.h \ ./db3/employee.h \ ./db3/empset.h \ ./db3/erc.h \ ./db3/eref.h \ ./db3/ereftab.h \ ./tq.h \ ./metastate/global.h \ ./suppressfile/test.h \ ./tests2.2/mbool.h \ ./tests2.4/forward.h \ ./tests2.4/hash.h \ ./tests2.4/timecard.h \ ./tests2.5/baz.h \ ./tests2.5/bimbim.h \ ./tests2.5/immutable.h \ ./tests2.5/impabsmodule.h \ ./tests2.5/socket.h \ ./Makefile.os2 \ ./db1/Makefile \ ./db2/Makefile \ ./db3/Makefile \ ./conditions/Makefile \ ./fileio/Makefile \ ./for/Makefile \ ./globalbufferannotation/Makefile \ ./maxset/Makefile \ ./mergestate/Makefile \ ./metastate/Makefile \ ./moreBufferTests/Makefile \ ./simplebufferConstraintTests/Makefile \ ./strchr/Makefile \ ./tainted/Makefile \ ./temp/Makefile \ ./tests2.2/Makefile \ ./tests2.2/Makefile-tests2.2.os2 \ ./tests2.4/Makefile \ ./tests2.4/Makefile-tests2.4.os2 \ ./tests2.5/Makefile \ ./warnuse/Makefile \ ./Makefile.am \ ./Makefile.in \ ./moreBufferTests2/Makefile \ ./fileio/eof.mts ./fileio/file.mts ./fileio/filerw.mts ./mergestate/tainted.mts ./mergestate/taintednm.mts ./metastate/file.mts ./metastate/nullterminated.mts ./metastate/sockets.mts ./tainted/tainted-bad.mts ./tainted/tainted.mts ./fileio/file.xh ./fileio/filerw.xh ./mergestate/tainted.xh ./mergestate/taintednm.xh ./metastate/file.xh ./tainted/tainted.xh \ db2.old-expect union.pp warnuse.old-expect \ ./tests2.5/badcomment ./tests2.5/boolbad ./tests2.5/booltest ./tests2.5/uconstants loopexec.expect mergenull.expect shifts.expect looptesteffect.expect \ unioninit.expect unioninit.c utypes.c \ utypes.expect widestrings.expect widestrings.c \ functionmacro.expect functionmacro.c info.c info.expect \ longint.c loopexec.c looptesteffect.c mergenull.c shifts.c \ longint.expect nullret.expect numabstract.expect \ sizesigns.expect typeof.expect \ manual.expect ./manual/Makefile \ ./manual/annotglobs.c ./manual/bool.c ./manual/bool.h ./manual/clauses.c ./manual/employee.h ./manual/exposure.c ./manual/globals.c ./manual/ignore.c ./manual/implicit.c ./manual/intSet.h ./manual/list.c ./manual/loop.c ./manual/macros.c ./manual/modify.c ./manual/mstring.c ./manual/mstring.h ./manual/mstringnn.c ./manual/multiError.c ./manual/names.c ./manual/noeffect.c ./manual/null.c ./manual/only.c ./manual/order.c ./manual/palindrome.c ./manual/palindrome.h ./manual/refs.c ./manual/returned.c ./manual/rgb.c ./manual/rstring.c ./manual/rstring.h ./manual/sample.c ./manual/setChar.c ./manual/setname.c ./manual/setname.h ./manual/special.c ./manual/stack.c ./manual/sumsquares.c ./manual/switch.c ./manual/testpal.c ./manual/types.c ./manual/unique.c ./manual/usedef.c ./manual/bounds.c \ arraydims.expect arraydims.c \ moreBufferTests2/fixedArrayType.c oldstyle2.c \ divzero.expect parentype.expect \ divzero.c parentype.c \ stringliteral.expect stringliteral.c \ numabstract.c sizesigns.c typeof.c nullassign.expect subdir = test mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = DIST_COMMON = Makefile.am Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) $(mkinstalldirs) $(distdir)/./conditions $(distdir)/./db1 $(distdir)/./db2 $(distdir)/./db3 $(distdir)/./fileio $(distdir)/./for $(distdir)/./globalbufferannotation $(distdir)/./manual $(distdir)/./maxset $(distdir)/./mergestate $(distdir)/./metastate $(distdir)/./moreBufferTests $(distdir)/./moreBufferTests2 $(distdir)/./nullterminatedtest $(distdir)/./simplebufferConstraintTests $(distdir)/./sizeoftest $(distdir)/./strchr $(distdir)/./suppressfile $(distdir)/./tainted $(distdir)/./tclauses $(distdir)/./temp $(distdir)/./tests2.2 $(distdir)/./tests2.2a $(distdir)/./tests2.4 $(distdir)/./tests2.4/subdir $(distdir)/./tests2.5 $(distdir)/./warnuse $(distdir)/moreBufferTests2 @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-local mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-exec-am: install-info: install-info-am install-man: installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-info-am .PHONY: all all-am check check-am clean clean-generic clean-local \ distclean distclean-generic distdir dvi dvi-am info info-am \ install install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic uninstall uninstall-am uninstall-info-am .PHONY: all check all check: fulltest .PHONY: version version: -$(SPLINT) -help version .PHONY: help help: -@$(SPLINT) -@$(SPLINT) -help -@$(SPLINTP) -asdf -@$(SPLINTP) +boolint +boolint -@$(SPLINT) -help flags alpha #commenting these out for the release because they will almost always fail #since the default will only fit one system #Don't want to panic the user... # -@$(SPLINT) -help flags all | $(GREP) -v "^larchpath " | $(GREP) -v "^lclimportdir " | $(GREP) -v " Path argument. Default: " | $(GREP) -v " Directory argument. Default: " | $(GREP) -v " lclimportdir " # -@$(SPLINT) -help flags full | $(GREP) -v "^larchpath " | $(GREP) -v "^lclimportdir " | $(GREP) -v " Path argument. Default: " | $(GREP) -v " Directory argument. Default: " | $(GREP) -v " lclimportdir " # -@$(SPLINT) -help flags manual | $(GREP) -v "^larchpath " | $(GREP) -v "^lclimportdir " | $(GREP) -v " Path argument. Default: " | $(GREP) -v " Directory argument. Default: " | $(GREP) -v " lclimportdir " #larch and lclimportdir have different hardcoded default paths so don't include the path in the output.. .PHONY: clean-local clean-local: -rm -f *~ #*# *.o *.lcs a.out -rm -f *.out -rm *.lcd *.lh -cd db1; $(MAKE) clean -cd db2; $(MAKE) clean -cd db3; $(MAKE) clean $(SPLINTTESTS): $(SPLINT) $(SPLINT): cd $(top_builddir)/src; $(MAKE) .PHONY: quicktest quicktest: $(CheckSystemDir) @for TEST in $(QUICKTESTS); do \ echo "Checking $$TEST..."; \ $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ echo "*** FAIL ***"; \ done .PHONY: fulltest fulltest: @echo "Testing $(PACKAGE) $(VERSION)..." @echo @echo "Version Info:" @$(SPLINT) -help version @$(SPLINT) -help vars @echo "" @echo "Tests:" @echo "" @for TEST in $(SPLINTTESTS); do \ echo "Checking $$TEST..."; \ $(MAKE) $$TEST 2>&1 | $(CLEANOUTPUT) >$$TEST.out && \ $(DIFF) $(DIFFFLAGS) $$TEST.expect $$TEST.out || \ echo "*** FAIL ***"; \ done ### Rules for tests start here .PHONY: abstptr abstptr: -$(SPLINTR) abstptr -expect 9 -$(SPLINTR) abstptr +voidabstract -expect 6 .PHONY: abstract abstract: -$(SPLINTR) abst_t.lcl commentcmd.c -expect 15 .PHONY: alias alias: -$(SPLINTR) +lh mut -$(SPLINTR) mut alias +globalias -expect 19 -$(SPLINTR) mut alias2 +globalias -expect 17 -$(SPLINTR) +lh alias3 -expect 14 -$(SPLINTR) +lh alias4 +boolint -$(SPLINTR) alias4 -pred +retalias -expect 6 -$(SPLINTR) +lh alias5 +memchecks -null -specundef -expect 5 .PHONY: alttypes alttypes: -$(SPLINTR) alttypes.c -expect 2 ### ### evans 2001-06-07 - updated nameCheck.c to reflect C9X. ### Reports one new errors for ansireserved.c - wctomb is bad even as a local ### variable (could be a macro?) ### Reports 3 additional errors for +checks; no longer suppresses name errors ### in the presense of other errors. ### .PHONY: ansireserved ansireserved: -$(SPLINTR) ansireserved.c +ansireserved -nolib -expect 9 -$(SPLINTR) ansireserved.c +ansireserved +ansireservedlocal -nolib -expect 11 -$(SPLINTRN) ansireserved.c +checks -exportlocal -exportheadervar -exportheader -expect 12 -$(SPLINTR) ansireserved2.c +ansireserved -expect 1 .PHONY: argorder argorder: -$(SPLINTR) argorder.c -expect 4 -$(SPLINTR) argorder2 -expect 5 -$(SPLINTR) argorder3.c -expect 8 -$(SPLINTR) argorder4 -expect 9 -$(SPLINTR) argorder4 -evalorder -expect 1 -$(SPLINTR) argorder5.c +evalorderuncon -expect 3 .PHONY: args args: -$(SPLINTR) args -noeffect -expect 12 .PHONY: arraydims arraydims: -$(SPLINTR) arraydims.c -varuse -expect 2 -$(SPLINTR) arraydims.c -initsize -varuse .PHONY: arrayinit arrayinit: -$(SPLINTR) arrayinit.c -expect 9 .PHONY: arraylit arraylit: -$(SPLINTR) arraylit.c -expect 2 -$(SPLINTR) arraylit.c +stringliteralsmaller -expect 4 .PHONY: blocks blocks: -$(SPLINTR) blocks.c -expect 4 -$(SPLINTR) blocks.c +ifblock +elseifcomplete -expect 7 -$(SPLINTR) blocks.c -ifempty +whileempty +whileblock -expect 3 -$(SPLINTR) blocks.c -ifempty +forempty +forblock -expect 3 -$(SPLINTR) blocks.c +allempty -expect 6 -$(SPLINTRN) blocks.c +strict -exportlocal +partial -exportheader -expect 11 .PHONY: break break: -$(SPLINTR) break.c -expect 4 -$(SPLINTR) break.c +deepbreak -expect 6 -$(SPLINTR) break.c +deepbreak -looploopbreak -expect 5 .PHONY: cases cases: -$(SPLINTR) cases.c -expect 5 -$(SPLINTR) cases2.c -expect 2 -$(SPLINTRN) cases2.c +checks -exportlocal -exportheader -expect 3 -$(SPLINTRN) cases2.c +checks -exportlocal -exportheader -branchstate -expect 3 .PHONY: cast cast: -$(SPLINTR) cast -accessmodule -expect 20 -$(SPLINTRN) cast2.c +checks -exportlocal -exportheader -expect 3 .PHONY: chararraylit chararraylit: -$(SPLINTR) chararraylit.c -expect 2 ### Two addition errors detected with 2.5 with -numliteral. ### evans 2002-12-15: finds one more but in charlit .PHONY: charlit charlit: -$(SPLINTR) +hints charlit.c -expect 4 -$(SPLINTR) +hints -numliteral charlit.c -expect 6 -$(SPLINTR) +hints charlit.c +charintliteral +ignoresigns -expect 1 .PHONY: clauses clauses: -$(SPLINTR) clauses.c +memchecks -expect 4 -$(SPLINTR) clauses2.c +memchecks -$(SPLINTR) clauses3.c +memchecks -expect 2 -$(SPLINTR) clauses3.c +memchecks +unixlib -expect 3 .PHONY: commentchar commentchar: -$(SPLINTR) commentchar.c -expect 4 -$(SPLINTR) -commentchar '#' commentchar.c -expect 4 .PHONY: controldepth controldepth: -$(SPLINTR) +hints -controlnestdepth 2 controldepth.c -expect 2 -$(SPLINTR) +hints -controlnestdepth 1 controldepth.c -expect 2 ### ### 1 extra warning reported for +strict now because of out-of-bounds read ### .PHONY: compdestroy compdestroy: -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader -expect 1 -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy -expect 2 -$(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy +strictusereleased -expect 3 -$(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 4 .PHONY: compoundliterals compoundliterals: ${SPLINTRN} compoundliterals.c .PHONY: compoundstmt compoundstmt: ${SPLINTRN} compoundstmt.c -expect 3 .PHONY: condifomit condifomit: ${SPLINTRN} -gnuextensions condifomit.c -expect 4 ${SPLINTRN} +gnuextensions condifomit.c -expect 1 .PHONY: constannot constannot: ${SPLINTRN} constannot.c +boundswrite -exportlocal -expect 2 .PHONY: csyntax csyntax: -$(SPLINTR) +quiet -incondefs csyntax.c -expect 1 -$(SPLINTR) +quiet csyntax2.c -expect 2 -$(SPLINTR) +quiet csyntax3.c -expect 1 -$(SPLINTR) +quiet -incondefs csyntax4.c -$(SPLINTR) +quiet csyntax5.c -$(SPLINTR) +quiet csyntax6.c -$(SPLINTR) +quiet csyntax7.c -$(SPLINTR) +quiet csyntax8.c -$(SPLINTR) +quiet csyntax9.c -$(SPLINTR) +quiet csyntax10.c -$(SPLINTR) +quiet csyntax11.c -$(SPLINTR) +quiet csyntax12.c -$(SPLINTR) +quiet csyntax13.c -expect 1 -$(SPLINTR) +quiet csyntax14.c -$(SPLINTR) +quiet csyntax15.c -$(SPLINTR) +quiet csyntax16.c -expect 2 -$(SPLINTR) +quiet csyntax17.c -expect 3 .PHONY: czechnames czechnames: -$(SPLINTR) czechnames.c -$(SPLINTR) +hints +czech czechnames.c -expect 2 -$(SPLINTR) +hints +czech -czechvars czechnames.c -expect 1 -$(SPLINTR) +hints +czech -accessczech czechnames.c -expect 6 .PHONY: czechoslovaknames czechoslovaknames: -$(SPLINTR) +hints +czechoslovak czechnames.c -expect 1 -$(SPLINTR) +hints +czechoslovak slovaknames.c -expect 1 -$(SPLINTR) +hints +czechoslovak +slovakvars slovaknames.c -expect 2 ### ### deadparam added 2001-05-27 ### .PHONY: deadparam deadparam: ${SPLINTR} deadparam.c -expect 3 # # Was expect 3 before 2.4. Earlier versions did not handle implicit # function pointers correctly. # .PHONY: decl decl: -$(SPLINTR) decl.c -expect 2 -$(SPLINTRN) decl.c +strict -exportlocal -expect 6 -$(SPLINTR) decl2 -expect 4 .PHONY: divzero divzero: -$(SPLINTR) divzero.c -varuse -expect 0 .PHONY: enum enum: -$(SPLINTR) enum -expect 16 -$(SPLINTR) enum -misscase -expect 14 .PHONY: enumtag enumtag: -$(SPLINTR) enumtag.c -expect 2 .PHONY: exports exports: -$(SPLINTR) exports.c +exporttype +exportvar +exportfcn +topuse +typeuse -expect 6 -$(SPLINTR) exports.c +exportany -expect 3 -$(SPLINTR) exports.c .PHONY: external external: -$(SPLINTR) external.c +partial -$(SPLINTR) external.c +partial +distinctexternalnames +ansi89limits -expect 2 -$(SPLINTR) external.c -nolib +partial -externalnamelength 3 -expect 3 -$(SPLINTR) external.c -nolib +partial -externalnamelength 3 +externalnamecaseinsensitive -expect 3 -$(SPLINTR) external.c +partial -externalnamelength 3 -expect 4 .PHONY: fields fields: -$(SPLINTR) fields.c +memchecks -expect 6 -$(SPLINTR) fields2.c +memchecks -expect 5 -$(SPLINTR) fields3.c +memchecks .PHONY: flags flags: -$(SPLINTR) flags.c -expect 8 -$(SPLINTR) +nocomments flags.c -expect 2 ### Added 2001-06-02 .PHONY: forbody forbody: ${SPLINTR} forbody.c -expect 2 ### Added 2001-06-03 .PHONY: format format: ${SPLINTR} format.c -expect 3 ${SPLINTR} format.c -formatconst # two new errors (invalid lhs) .PHONY: funcpointer funcpointer: -$(SPLINTR) +memchecks +noparams funcpointer.c -expect 18 .PHONY: functionmacro functionmacro: -$(SPLINTR) functionmacro.c -expect 2 .PHONY: glob glob: -$(SPLINTR) glob -expect 4 -$(SPLINTR) glob -globuse -expect 3 -$(SPLINTR) glob +globunspec -expect 6 .PHONY: globals globals: -$(SPLINTR) -modifies globals.c -expect 5 -$(SPLINTR) -modifies globals.c +allglobals -expect 6 -$(SPLINTR) -modifies globals.c +impcheckedglobals -expect 6 -$(SPLINTR) -modifies globals.c -globals -checkstrictglobals -expect 2 -$(SPLINTR) -modifies globals.c +globunspec -expect 6 -$(SPLINTR) -modifies globals.c +globunspec +allglobals -expect 8 # Was -accessfile .PHONY: impabstract impabstract: -$(SPLINTR) -accessmodule impabstract.c -$(SPLINTR) -accessmodule +hints +impabstract impabstract.c -expect 2 -$(SPLINTR) -accessmodule +hints +impabstract impabstract -expect 4 ### ### evans 2001-12-30: Handle unrecognized pre-processor directives ### (Reported by Pierluigi Sanzani) .PHONY: info info: ${SPLINTR} info.c -expect 4 ### evans 2001-10-14: Expected errors updated .PHONY: init init: -$(SPLINTR) init.c -expect 14 -$(SPLINTRN) init.c +checks -exportlocal -exportheadervar -expect 17 ### evans 2003-09-16 .PHONY: innerarray innerarray: -$(SPLINTR) innerarray.c -expect 10 .PHONY: inparam inparam: -$(SPLINTR) inparam.c -expect 2 -$(SPLINTR) +impouts inparam.c -expect 1 .PHONY: internal internal: -$(SPLINTR) internal.c -expect 1 -$(SPLINTR) internal.c +distinctinternalnames -expect 1 -$(SPLINTR) internal.c +distinctinternalnames +ansi89limits -expect 2 -$(SPLINTR) internal.c -internalnamelen 28 -expect 3 -$(SPLINTR) internal.c +internalnamecaseinsensitive -expect 3 -$(SPLINTR) internal.c +internalnamecaseinsensitive +internalnamelookalike -expect 11 ### ### iter ### 2001-06-06: Error message for iter.lcl:3,6 fixed to iter.lcl:3:6 ### .PHONY: iter iter: -$(SPLINTR) iter -expect 14 -lclexpect 1 -$(SPLINTR) iter2.c -expect 12 .PHONY: keep keep: -$(SPLINTR) keep.c +memchecks -expect 6 ### libs ### 2001-05-22: 2 new errors found (fixed spec of signal) ### 2001-05-30: 3 new errors found (formatconst) ### 2002-07-08: 2 new errors found (getc modifies errno) .PHONY: libs libs: -$(SPLINTR) libs.c +longunsignedunsignedintegral -expect 18 -$(SPLINTR) libs.c -expect 22 -$(SPLINTR) libs.c +globunspec +modunspec -expect 25 -$(SPLINTR) libs.c +strictlib +globunspec +modunspec -expect 44 .PHONY: lintcomments lintcomments: -$(SPLINTR) lintcomments.c -expect 5 -$(SPLINTR) lintcomments.c -warnlintcomments -expect 1 -$(SPLINTR) lintcomments.c -lintcomments -expect 4 .PHONY: list list: -$(SPLINTR) list.c -expect 3 ### ### 2002-12-12: Added test case for +longint and +shortint flags ### .PHONY: longint longint: -$(SPLINTR) longint.c -expect 3 -$(SPLINTR) longint.c +longint -expect 2 -$(SPLINTR) longint.c +shortint -expect 2 -$(SPLINTR) longint.c +shortint +longint -expect 0 ### ### 2002-01-01: Added test case for obvious loop execution. ### .PHONY: loopexec loopexec: -$(SPLINTR) loopexec.c -expect 1 -$(SPLINTR) loopexec.c -obviousloopexec -expect 3 .PHONY: looptesteffect looptesteffect: -$(SPLINTR) looptesteffect.c -expect 1 .PHONY: macros macros: -$(SPLINTR) macros -expect 17 -$(SPLINTR) macros.c +allmacros -expect 34 -$(SPLINTR) macros.c +fcnmacros -expect 31 .PHONY: macrosef macrosef: -$(SPLINTR) macrosef -expect 4 -$(SPLINTR) macrosef.c +allmacros -expect 3 -$(SPLINTR) macrosef.c +allmacros +sefuncon -expect 4 .PHONY: malloc malloc: -$(SPLINTRN) malloc.c +bounds -exportlocal -expect 7 .PHONY: merge merge: -$(SPLINTRN) merge.c +checks -exportlocal -exportheadervar -exportheader -expect 3 .PHONY: mergenull mergenull: -$(SPLINTRN) mergenull.c .PHONY: modifies modifies: -$(SPLINTR) modifies.c modclient.c +impcheckedstatics +mustmod -expect 7 .PHONY: modtest modtest: -$(SPLINTR) modtest -expect 10 -$(SPLINTR) modtest +modunspec -expect 13 -$(SPLINTR) modtest +mustmod -expect 14 .PHONY: moduncon moduncon: -$(SPLINTR) moduncon.c +moduncon -memchecks -expect 4 -$(SPLINTRN) moduncon.c +strict +impboundsconstraints -exportlocal -expect 22 .PHONY: mongoincludes mongoincludes: -$(SPLINTR) mongoincludes.c -includenest 1 -expect 19 -$(SPLINTR) mongoincludes.c -includenest 2 -expect 10 -$(SPLINTR) mongoincludes.c -includenest 3 -expect 4 -$(SPLINTR) mongoincludes.c -includenest 4 -expect 1 -$(SPLINTR) mongoincludes.c -includenest 5 -expect 0 .PHONY: mystrncat mystrncat: -$(SPLINTR) mystrncat.c +boundsread +boundswrite -expect 4 .PHONY: noeffect noeffect: ${SPLINTP} noeffect.c +allmacros +checks -expect 3 ### ### 2002-01-01: null1.c: expect increased to 15 because out must be defined ### checking detects one new error ### .PHONY: null null: -$(SPLINTR) null1.c -expect 15 -$(SPLINTR) null1.c -null -mustdefine -expect 4 -$(SPLINTR) null2.c -expect 11 -$(SPLINTR) null3.c -expect 15 -$(SPLINTR) null3.c +unixlib -expect 16 -$(SPLINTR) null4.c -expect 1 -$(SPLINTR) null5.c -expect 4 -$(SPLINTR) null6 -expect 4 -$(SPLINTR) +quiet null6.lcl -dump null6 -$(SPLINTR) null6.c -load null6 -expect 4 ### Added for 3.0 (bugs reported by Kevin Broady) .PHONY: nullret nullret: -$(SPLINTR) nullret.c -expect 2 -$(SPLINTR) -nullret nullret.c -expect 0 .PHONY: nullassign nullassign: -$(SPLINTR) nullassign.c -expect 2 -$(SPLINTR) -nullassign nullassign.c -expect 1 ### Added for 3.1 - evans 2002-12-14 .PHONY: numabstract numabstract: -$(SPLINTR) numabstract.c -expect 11 -$(SPLINTR) numabstract.c +numabstractlit -expect 9 -$(SPLINTR) numabstract.c -numabstractcast -expect 10 # # Before 2.4, expected one more because error was reported both as # dependent and observer. # .PHONY: observer observer: -$(SPLINTRN) observer +checks -exportlocal -exportheader -expect 9 -$(SPLINTRN) observer.c +checks -exportlocal -exportheader -expect 8 -$(SPLINTR) observer.c -expect 7 .PHONY: oldstyle oldstyle: -$(SPLINTR) oldstyle oldstyle2.c -expect 5 .PHONY: outglob outglob: -$(SPLINTR) outglob -expect 10 .PHONY: outparam outparam: -$(SPLINTR) outparam -expect 12 ### evans 2001-08-26: postnotnull new .PHONY: postnotnull postnotnull: ${SPLINTR} postnotnull.c -expect 1 ### evans 2002-02-09: added parentype.c .PHONY: parentype parentype: ${SPLINTR} parentype.c # # Four new +fcnuse errors for -strict (evans 2001-07-22) # .PHONY: preds preds: -$(SPLINTR) +hints preds.c -expect 6 -$(SPLINTRN) +hints preds.c -weak -expect 1 -$(SPLINTRN) +hints preds.c -strict +impboundsconstraints -exportlocal -exportheader -expect 10 .PHONY: prefixes prefixes: -$(SPLINTR) prefixes.c +partial -$(SPLINTRN) prefixes.c +allmacros +checks -exportlocal +partial -exportheader -exportheadervar -expect 4 -$(SPLINTR) prefixes.c -typeprefix "T" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^" -expect 1 -$(SPLINTR) prefixes.c -typeprefix "^*" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^%*" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^~*" -expect 2 -$(SPLINTR) prefixes.c -typeprefix "^" +typeprefixexclude -expect 7 -$(SPLINTR) prefixes.c -filestaticprefix "^^" -expect 4 -$(SPLINTR) prefixes.c -filestaticprefix "^#" -expect 5 -$(SPLINTR) prefixes.c -filestaticprefix "^?&x" -expect 5 -$(SPLINTR) prefixes.c -globalprefix "G" -expect 1 -$(SPLINTR) prefixes.c -globalprefix "&G?_^" -expect 1 -$(SPLINTR) prefixes.c -externalprefix "G" -expect 5 -$(SPLINTR) prefixes.c -typeprefix "T" -externalprefix "G" -expect 4 -$(SPLINTR) prefixes.c -localprefix "?*" +localprefixexclude -expect 13 .PHONY: printflike printflike: -$(SPLINTR) printflike.c -expect 6 -$(SPLINTR) printflike.c -warnlintcomments -expect 5 .PHONY: rc rc: -$(SPLINTR) -DMYSTERY='"a flag\"wicked cool"' rc.c -expect 1 -$(SPLINTR) -DMYSTERY=12 rc.c -expect 1 -$(SPLINTR) -f rc1.splintrc rc.c -expect 1 -$(SPLINTR) -UMYSTERY -f rc1.splintrc rc.c -expect 1 -$(SPLINTR) -f rc3.splintrc rc.c -expect 1 .PHONY: rcfiles rcfiles: cd rcfiles; ${MAKE} SPLINT="-$(SPLINTPNEST)" .PHONY: refcounts refcounts: -$(SPLINTR) refcounts.c -expect 7 .PHONY: release release: -$(SPLINTR) release.c +memchecks -expect 1 .PHONY: repexpose repexpose: -$(SPLINTR) +lh repexpose +memchecks -expect 12 -$(SPLINTR) repexpose +memchecks +retalias -expect 15 -$(SPLINTRN) repexpose +checks -exportlocal -expect 27 ### returned added 2001-05-27 ### (Bug discovered checking splint sources.) .PHONY: returned returned: ${SPLINTR} returned.c -expect 1 ### russian added 2003-06-07: bug reported in pre-processing non-standard characters. .PHONY: russian russian: ${SPLINTR} russian.c .PHONY: sharing sharing: -$(SPLINTR) sharing1.c -expect 21 -$(SPLINTR) sharing3.c -expect 3 -$(SPLINTR) sharing4.c -expect 13 -$(SPLINTR) sharing4.c -paramimptemp -expect 12 -$(SPLINTR) sharing5.c -expect 6 .PHONY: shifts shifts: -$(SPLINTR) shifts.c -expect 4 -$(SPLINTR) shifts.c -shiftimplementation -expect 3 -$(SPLINTR) shifts.c -shiftnegative -expect 1 #drl comment this out until sizesigns is added to cvs ### evans - added 2002-08-17: check warnings with arbitrary integral types sizesigns: -$(SPLINTR) +strict sizesigns.c -expect 5 -$(SPLINTR) +strict +matchanyintegral sizesigns.c -expect 4 .PHONY: slovaknames slovaknames: -$(SPLINTR) +hints slovaknames.c -expect 1 -$(SPLINTR) +hints slovaknames.c +accessslovak -$(SPLINTR) +hints +slovak slovaknames.c -expect 3 -$(SPLINTR) +hints +slovak -slovakvars slovaknames.c -expect 2 -$(SPLINTR) +hints +slovak -accessslovak slovaknames.c -expect 7 .PHONY: specclauses specclauses: -$(SPLINTR) specclauses.c -expect 6 -$(SPLINTR) specclauses2.c -expect 8 -$(SPLINTR) specclauses3.c -expect 5 -$(SPLINTR) specclauses4.c -expect 3 -$(SPLINTR) specclauses5.c -expect 3 .PHONY: specclauses1 specclauses1: -$(SPLINTR) specclauses.c -expect 6 .PHONY: specclauses2 specclauses2: -$(SPLINTR) specclauses2.c -expect 8 .PHONY: specclauses3 specclauses3: -$(SPLINTR) specclauses3.c -expect 6 .PHONY: specclauses4 specclauses4: -$(SPLINTR) specclauses4.c -expect 3 .PHONY: specclauses5 specclauses5: -$(SPLINTR) specclauses5.c -expect 3 .PHONY: special special: -$(SPLINTR) special -expect 20 -$(SPLINTR) special -relaxquals -expect 22 .PHONY: stack stack: -$(SPLINTR) stack.c -expect 5 -$(SPLINTR) stack.c -stackref .PHONY: staticarray staticarray: -$(SPLINTR) staticarray.c -expect 3 ### ### evans 2002-03-16: Default setting of stringliteralnoroomfinalnull changed ### .PHONY: stringliteral stringliteral: -$(SPLINTR) stringliteral.c -stringliteralnoroomfinalnull -expect 3 -$(SPLINTR) stringliteral.c -expect 4 .PHONY: strings strings: -$(SPLINTR) strings.c -expect 3 -$(SPLINTR) -readonlystrings -expect 1 strings.c -$(SPLINTR) +modobserverstrict -maintype -expect 4 strings.c .PHONY: structassign structassign: -$(SPLINTR) structassign.c -expect 4 .PHONY: typeof typeof: -$(SPLINTR) typeof.c -expect 2 .PHONY: typequals typequals: -$(SPLINTR) typequals.c tq.lcl -expect 5 -$(SPLINTR) typequals.c -expect 2 .PHONY: ud ud: -$(SPLINTR) ud.c -expect 9 -$(SPLINTR) ud2 -specundef -expect 3 .PHONY: ulstypes ulstypes: -$(SPLINTR) ulstypes.c -expect 8 -$(SPLINTR) ulstypes.c +ignorequals -$(SPLINTRN) ulstypes.c +strict -exportheader -exportheadervar -expect 28 # 3 more detected with version 2.5 (change in -numliteral setting) .PHONY: union union: -$(SPLINTR) +memchecks union.c -expect 8 ### ### Added 2001-12-30: fixed union initializer checking in response to ### bug report from Jim Zelenka. ### .PHONY: unioninit unioninit: -$(SPLINTR) unioninit.c -expect 2 .PHONY: unnamedsu unnamedsu: -$(SPLINTR) unnamedsu.c -expect 0 .PHONY: unreachable unreachable: -$(SPLINTR) unreachable.c -expect 5 -$(SPLINTR) -unreachable unreachable.c -expect 2 -$(SPLINTR) switch.c -expect 4 .PHONY: unsignedcompare unsignedcompare: ${SPLINTR} +posixlib unsignedcompare.c -expect 4 ### ### 2001-06-08 evans: 2 new errors after fixing ansireserved name checks ### .PHONY: unused unused: -$(SPLINTRN) unused.c +checks -exportlocal -expect 5 -$(SPLINTRN) unused.c +checks -exportlocal +topuse -expect 8 ### ### 2001-06-10: Provided by Jim Zalenka ### .PHONY: ullint ullint: ${SPLINTRN} ullint.c -expect 5 ${SPLINTRN} ullint.c +charint +charintliteral -expect 2 ### ### 2001-12-30: Poor warnings reported by Peter Deutsch ### ### 2002-07-03: removed warnings for datatype/macro definitions ### .PHONY: utypes utypes: ${SPLINTRN} utypes.c -expect 2 ### .PHONY: void void: ${SPLINTRN} void.c -expect 2 ### ### 2001-12-30: Problems with wide character strings reported by Nelson Beebe ### .PHONY: widestrings widestrings: ${SPLINTRN} widestrings.c -expect 2 ### ### New since 2.5q: ### .PHONY: linked linked: ${SPLINTR} linked.c -expect 4 ${SPLINTR} linked2.c -expect 3 ${SPLINTR} linked3.c -expect 5 ${SPLINTR} linked4.c -expect 6 ${SPLINTR} linked5.c -expect 4 ${SPLINTR} linked6.c -expect 4 .PHONY: freearray freearray: ${SPLINTR} freearray.c -expect 1 .PHONY: sizeof sizeof: -$(SPLINTR) +bounds sizeof.c -expect 1 .PHONY: buffertest buffertest: -$(SPLINTR) +bounds buffertest1.c -expect 5 .PHONY: $(SUBDIRTESTS) $(SUBDIRTESTS): cd $@; $(MAKE) SPLINT="$(SPLINTRNNEST)" # sizesigns.c sizesigns.expect \ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/test/abst_t.lcl0000644021234200000250000000007407121317335014375 0ustar faxmutable type abst1; mutable type abst2; mutable type abst3; splint-3.1.2.dfsg1/test/abstptr.lcl0000644021234200000250000000002407121317335014573 0ustar faxmutable type abst ; splint-3.1.2.dfsg1/test/alias.lcl0000644021234200000250000000017007121317330014202 0ustar faximports mut; int glob; int *globp; int f (int *a, int b, int **c) int glob; int *globp; { } int h (mut a, mut b) { } splint-3.1.2.dfsg1/test/alias2.lcl0000644021234200000250000000012107121317330014260 0ustar faxint glob; int *globp; int f (int *a, int b, int **c) int glob; int *globp; { } splint-3.1.2.dfsg1/test/alias3.lcl0000644021234200000250000000046307320411652014275 0ustar faxtypedef struct s_st { int a; int *b; } st; typedef union s_ut { int a; st s; st *t; int **c; } ut; st gst; ut *gu; int f (int ia[], st s1, ut *u1) st gst; ut *gu; { } void model (int ia[]) st gst; ut *gu; { modifies ia[6]; } void modst (st s1) { modifies *s1.b; } void modu (ut *u) { modifies *u; } splint-3.1.2.dfsg1/test/alias4.lcl0000644021234200000250000000031707121317330014271 0ustar faximports mut; int glob; int *globp; struct { int val; int *field; } globs; mut f(mut a, mut b) { } int g (void) int glob; { } int *h (void) int glob; struct { int val; int *field; } globs; int *globp; { }splint-3.1.2.dfsg1/test/alias5.lcl0000644021234200000250000000030707121317330014271 0ustar faxmutable type pair; void incx1 (pair p) { } void incx2 (pair p) { } void incx3 (pair p) { } void incx4 (pair p) { } only pair pair_create (void) { } void pair_free (out only pair p) { modifies p; } splint-3.1.2.dfsg1/test/argorder2.lcl0000644021234200000250000000015707121317330015005 0ustar faxint i; int f (int x, int y) int i; { modifies i; } int g (void) int i; { modifies i; } int h (void) int i; { }splint-3.1.2.dfsg1/test/argorder4.lcl0000644021234200000250000000017507121317330015007 0ustar faxint glob; int f (void) int glob; { } int g (void) int glob; { modifies glob; } int h (void) int glob; { modifies glob; } splint-3.1.2.dfsg1/test/args.lcl0000644021234200000250000000033307121317330014046 0ustar faxint severalargs(int x, char *t) { } int severalargs2(int x, char *t) { } int any(...) { } int many1(int x, char y, ...) { } int many2(int x, char y, ...) { } int many3(int x, char y, ...) { } int voidargs(void) { } splint-3.1.2.dfsg1/test/cast.lcl0000644021234200000250000000004707121317330014046 0ustar faxmutable type abst1; mutable type abst2;splint-3.1.2.dfsg1/test/decl2.lcl0000644021234200000250000000001207121317331014076 0ustar faxint glob; splint-3.1.2.dfsg1/test/empty.lcl0000644021234200000250000000000007121317331014240 0ustar faxsplint-3.1.2.dfsg1/test/enum.lcl0000644021234200000250000000047507121317331014066 0ustar faxtypedef enum { one, two, three } etype; typedef enum { cero, uno, dos } stype; typedef enum _ietag { siete } itype; /* 11. enum _ietag specified but not defined */ typedef struct { int a; int b; } st; typedef struct { int a; int b; int c; } st2; /* (5. Field present in spec...) */ enum { hasta, pasta, yasta } ;splint-3.1.2.dfsg1/test/glob.lcl0000644021234200000250000000025007121317331014034 0ustar faxint x, y, z; int useGlob (int a) int x, y, z; { ensures true; } int dontuseGlob (int a) { ensures true; } int callsUseGlob (int a) int x; { ensures true; } splint-3.1.2.dfsg1/test/impabstract.lcl0000644021234200000250000000004507320411660015425 0ustar faxtypedef int mint; mutable type cint; splint-3.1.2.dfsg1/test/iter.lcl0000644021234200000250000000033607121317331014061 0ustar faxiter intFor (int from, int to, int by, yield int x) ; iter noYield (int from, int to) ; /* 1 . no yield param, 9, 10. noYield, end_noYield not defined */ iter arrayElements (int from, int to, int *a, yield int x) ;splint-3.1.2.dfsg1/test/macros.lcl0000644021234200000250000000104607121317331014401 0ustar faximmutable type twerp { mustard, ketchup } ; int ok (int a, int b) { } int needparen (int a, int b) { } int needuse (int a, int b) { } int multuse (int a, int b) { } int badassign (int a, int b) { } int predok (int a, int b) { } int predbad (int a, int b) { } int predbad2 (int a, int b) { } int badorder (int a, int b) { } int okorder (int a, int b, int c) { } int okorder2 (int a, int b, int c) { } int badval (int a, int b) { } immutable type bool; constant bool badconst; constant bool goodconst; constant int worseconst; int var; int var2;splint-3.1.2.dfsg1/test/macrosef.lcl0000644021234200000250000000007207121317331014712 0ustar faxint f (sef int x, int y); int g (int *x) { modifies *x; }splint-3.1.2.dfsg1/test/modtest.lcl0000644021234200000250000000051707121317331014576 0ustar faxint x, y; int ai[]; int bi[]; typedef struct _ts { int a; int b; } tst; tst ts; tst *tstp ; int f (int i[], int *j) int ai[]; int x, y; tst ts; tst* tstp; { let elt be ai[6]; modifies elt, x, ai[3], ai[3+6], ai[x'], ts.a, tstp'->a, ts; ensures true; } int g (int a[], int *p) int x, y; { modifies x, y; ensures true; } splint-3.1.2.dfsg1/test/mut.lcl0000644021234200000250000000013207121317331013715 0ustar faxmutable type mut; only mut mut_create (void) { } void mut_mod (mut a) { modifies a; } splint-3.1.2.dfsg1/test/mut.lh.expect0000644021234200000250000000020107121317332015033 0ustar fax/* Output from LCLint 2.2c+ */ # include "bool.h" extern /*@only@*/ mut mut_create (void); extern void mut_mod (mut /* a */); splint-3.1.2.dfsg1/test/null6.lcl0000644021234200000250000000002307121317332014150 0ustar faxmutable type mnull;splint-3.1.2.dfsg1/test/observer.lcl0000644021234200000250000000006207121317332014742 0ustar faxmutable type stx; only char *stx_name (stx x) { }splint-3.1.2.dfsg1/test/oldstyle.lcl0000644021234200000250000000010707121317332014752 0ustar faxint f1 (int x, int y); int f2 (int x, char y); int f3 (int x, char *y);splint-3.1.2.dfsg1/test/outglob.lcl0000644021234200000250000000023307121317332014566 0ustar faxint x1, x2, x3; int f (void) undef int x1; undef int x2; undef int x3; { modifies x1, x2, x3; } int g (void) int x1, x2; undef int x3; { modifies x3; } splint-3.1.2.dfsg1/test/outparam.lcl0000644021234200000250000000022707121317332014746 0ustar faxtypedef struct _st { int a; int b; } *st; void f(out int *a, int *b) { modifies *a; } void h(out st s, out st t) { modifies *t; } int g (void) { } splint-3.1.2.dfsg1/test/rc1.splintrc0000644021234200000250000000010307413453477014677 0ustar fax# # rc1.splintrc # -DMYSTERY="a silly\"flag\"\\" -f rc2.splintrc splint-3.1.2.dfsg1/test/rc2.splintrc0000644021234200000250000000002107413453477014677 0ustar fax+boolint +boolintsplint-3.1.2.dfsg1/test/rc3.splintrc0000644021234200000250000000013607413453477014707 0ustar fax-externalnamelen 23 internalnamelen 73 +tmpdir /tmp/ -tmpdir /tmp -dump splint-3.1.2.dfsg1/test/rc3.splintrc.os20000644021234200000250000000014307413453477015407 0ustar fax-externalnamelen 23 internalnamelen 73 +tmpdir \spool\ -tmpdir \spool -dump splint-3.1.2.dfsg1/test/repexpose.lcl0000644021234200000250000000061407121317332015130 0ustar faxmutable type abst ; immutable type immut ; char **globstring; only abst abst_create (dependent abst p, only char *x, int i) char **globstring; { } only char *abst_name (abst a) { } int abst_val (abst a) { } int *abst_aval (abst a) { } only abst abst_parent (only abst a) { } dependent char *immut_name (immut im) { } void abst_setIm (abst a, immut im) { } immut abst_getIm (abst a) { } splint-3.1.2.dfsg1/test/repexpose.lh.expect0000644021234200000250000000103007121317332016241 0ustar fax/* Output from LCLint 2.2c+ */ # include "bool.h" extern char **globstring; extern /*@only@*/ abst abst_create (/*@dependent@*/ abst /* p */, /*@only@*/ char * /* x */, int /* i */); extern /*@only@*/ char *abst_name (abst /* a */); extern int abst_val (abst /* a */); extern int *abst_aval (abst /* a */); extern /*@only@*/ abst abst_parent (/*@only@*/ abst /* a */); extern /*@dependent@*/ char *immut_name (immut /* im */); extern void abst_setIm (abst /* a */, immut /* im */); extern immut abst_getIm (abst /* a */); splint-3.1.2.dfsg1/test/special.lcl0000644021234200000250000000011107121317332014526 0ustar faxchar gc; int gi; char *gs; int f (void) char gc; int gi; char *gs; { }splint-3.1.2.dfsg1/test/tq.lcl0000644021234200000250000000014407121317332013540 0ustar faxmutable type tam; immutable type tai; mutable type tmixm; immutable type tmixi; typedef int *tmixa; splint-3.1.2.dfsg1/test/ud2.lcl0000644021234200000250000000015607121317332013611 0ustar faxvoid f1(out char **x) { modifies *x; } void f2(char **x) { modifies *x; } void f3(out int *y) { modifies *y; }splint-3.1.2.dfsg1/test/abstptr.c0000644021234200000250000000142607121317335014252 0ustar faxtypedef int *abst; /*@noaccess abst*/ int main (void) { abst a; int b = 3; abst *ap = (abst *) NULL; abst *ap2 = NULL; void *vp; int *ip; vp = ap ; /* 1. Assignment of abst * to void *: vp = ap */ ip = ap2; /* 2. Assignment of abst * to int *: ip = ap2 */ ap = ip ; /* 3. Assignment of int * to abst *: ap = ip */ vp = (void *) ap ; /* 4. Cast from underlying abstract type abst *: (void *)ap */ a = *ap ; /* 5. Possible dereference of null pointer: *ap */ *ap = a ; vp = (void *)&a ; /* 6. Cast from underlying abstract type abst *: (void *)&a */ ap = (abst *)&b ; /* 7. Cast to underlying abstract type abst *: (abst *)&b */ ap = &b; /* 8. Assignment of int * to abst *: ap = &b */ *ap = b; /* 9. Assignment of int to abst: *ap = b */ return 12; } splint-3.1.2.dfsg1/test/alias.c0000644021234200000250000000215507121317335013664 0ustar fax# include "mut.h" int glob; int *globp; int f(int *a, int b, int **c) { int *x, *y, *z; x = a; *x = 3; /* 1. modifies *a */ x = a; y = x; *y = 4; /* 2. modifies *a */ globp = a; /* 3. modifies *globp */ if (*x == 3) return 3; /* 4. returns aliasing globp */ if (*x == 4) { globp = z; /* 5, 6. z use before def, modifies globp */ return 4; /* okay */ } *globp = 4; /* 7, 8. modifies *a, *globp */ x = globp; *x = 7; /* 9, 10. modifies *globp, *a */ x = &glob; *x = 4; /* 11. modifies glob */ x = &b; /* okay */ *x = 3; /* okay */ b = 3; /* okay */ *x = b; /* okay */ x = *c; /* okay */ *x = 4; /* 12. modifies **c */ a = *c; /* okay */ *a = 4; /* 13. modifies **c (but not *a) */ *globp = 3; /* 14, 15. modifies *globp, modifies *a */ return 4; /* 16. returns with globp aliasing a */ } int h (mut a, mut b) { mut c = mut_create(); mut_mod (a); /* 17. modifies a */ a = b; mut_mod (a); /* 18. modifies b */ b = c; mut_mod (b); /* okay */ return 3; /* 19. locally allocated storage c not released */ } splint-3.1.2.dfsg1/test/alias2.c0000644021234200000250000000175107121317330013742 0ustar faxint glob; int *globp; int f(int *a, int b, int **c) { int *x, *y, *z; { { int *lx; x = a; lx = a; { /*@-shadow@*/ int *lx; /*@=shadow@*/ *lx = 3; /* 1. use before def */ y = *c; } *lx = 4; /* 2. modifies a */ } x = y; /* x aliases *c */ x = *c; } if (b == *a) { x = a; /* okay - x alias a */ *x = 3; /* 3. modifies *a */ y = &glob; } else { *x = 3; /* 4. modifies **c */ y = globp; } *x = 4; /* 5, 6. bad - may modify *a or **c */ z = a; if ((**c = b) == 3) /* 7. modifies **c */ { *y = 3; /* 8, 9. may modify glob and *globp */ globp = a; /* 10. modifies globp */ a = y; z = globp; } else { a = z; } *a = 3; /* 11, 12. modifies glob, *globp through y and z */ *z = 6; /* 13, 14. modifies *a, *globp */ *globp = 5; /* 15, 16. modifies *globp, *a */ return 3; /* 17. leaves globp aliasing a */ } splint-3.1.2.dfsg1/test/alias3.c0000644021234200000250000000237107121317330013742 0ustar fax/* ** tests aliasing of arrays, structs and unions */ # include "alias3.lh" st gst; ut *gu; void model (int ia[]) { int *ip; ip = &(ia[6]); *ip = 3; gst.a = 3; /* 1. Suspect modification of gst.a */ gu->a = 5; /* 2. Suspect modification of gu->a */ } void modst (st s1) { s1.a = 3; *(s1.b) = 6; } void modu (ut *u) { u->a = 5; } int f (int ia[], st s1, ut *u1) { int *ip; st sl; ut *ul; ip = &(ia[3]); *ip = 7; /* modifies ia[3] */ ip = &(ia[*ip]); *ip = 8; /* modifies ia[?] */ model(ia); /* modifies ia[6] */ ip = ia; model(ip); /* modifies ia[6] */ s1.a = 3; /* okay */ *(s1.b) = 7; /* modifies *(s1.b) */ sl = s1; /* okay (sl is NOT an alias for s1) */ modst(sl); /* was: does not modify anything --- structure is passed by value */ /* NOT TRUE: does modify sl since *s1.b is the same reference */ sl.a = 3; /* okay */ ip = s1.b; /* okay, ip aliases s1.b */ *(s1.b) = 3; /* modifies s1.b */ *ip = 6; /* modifies s1.b */ *(sl.b) = 3; /* okay */ ul = u1; /* ul aliases u1 */ modu(ul); /* okay */ ul->a = 3; /* modifies u1->a */ sl = ul->s; /* okay */ sl.a = 3; /* okay */ *(sl.b) = 6; /* modifies *(u1->s.b) through alias */ return 5; } splint-3.1.2.dfsg1/test/alias4.c0000644021234200000250000000101207121317330013732 0ustar fax# include "alias4.lh" mut f(mut a, mut b) { mut c; if (1 == 3) { c = a; } else { c = b; } return c; /* 2 * bad: may reference parameter a, b */ } int g (void) { return glob; } int *h (void) { if (1 > 3) return &glob; /* returns ref to global glob */ else if (2 > 3) return globp; /* return reference to global globp */ else if (3 > 3) return (globs.field); /* returns reference to globs */ else return (&(globs.val)); /* returns reference to globs */ } splint-3.1.2.dfsg1/test/alias5.c0000644021234200000250000000122207121317330013736 0ustar faxtypedef struct { /*@only@*/ int *x; /*@only@*/ int *y; } *pair; # include "alias5.lh" void incx1 (pair p) { pair p2 = p; p2->x++; /* 1. Suspect modification of p->x through alias p2->x: p2->x++ */ } void incx2 (pair p) { pair p2 = p; p2 = pair_create (); p2->x++; } /* 2. Fresh storage p2 not released before return */ void incx3 (pair p) { pair p2 = pair_create (); p2->x = p->x; /* 3. Only storage p2->x not released before assignment: p2->x = p->x */ *(p2->x) = 3; /* 4. Suspect modification of *(p->x) through alias *(p2->x): */ pair_free (p2); } /* 5. Storage p->x reachable from parameter is kept (should be only) */ splint-3.1.2.dfsg1/test/alttypes.c0000644021234200000250000000040007121317330014422 0ustar fax# include "bool.h" int /*@alt void@*/ f (void) ; int f (void) { return 3; } int g (void) { f (); return 4; } int /*@alt void@*/ f2 (void) ; int /*@alt bool@*/ f2 (void) { return 3; } extern int /*@alt char, bool@*/ x; int /*@alt char@*/ x; splint-3.1.2.dfsg1/test/ansireserved.c0000644021234200000250000000043307320411652015260 0ustar faxint decimal_point; int srand; int labs; int _x; int atan2f (void); typedef int wcst; # define EVANS 72 int isaFish (void) { /*@unused@*/ int powl; /*@unused@*/ float mem; /* okay */ /*@unused@*/ float memory; /*@unused@*/ int wctomb; /* okay as local */ return 3; } splint-3.1.2.dfsg1/test/ansireserved2.c0000644021234200000250000000004507320411653015342 0ustar faxtypedef struct _s1 { int x; } s1; splint-3.1.2.dfsg1/test/argorder.c0000644021234200000250000000047207121317330014373 0ustar faxint i; int j; int f(int x, int y, int z) { printf("%d %d", x, y); printf("%d %d", y++, z++); printf("%d %d", z++, z); /* arg 2 modifies z, used by arg 3 */ return (f((i++, j++), (i = 3), j)); /* arg 1 modifies i, used by 2, arg 1 modifies j, used by 3, arg 2 modifies i, used by 1 */ } splint-3.1.2.dfsg1/test/argorder2.c0000644021234200000250000000061007121317330014447 0ustar faxint i; int h() { return i; } int f(int x, int y) { i = i + x + y; return i; } int g() { (void) f(f(1, 2), f(1, 2)); /* 1, 2. arg1 modifies i, used by arg2, vice versa */ (void) f(f(1, 2), h()); /* 3. arg1 modifies i, used by arg2 */ (void) f(f(1, 2), i); /* 4. arg1 modifies i, used by arg2 */ return (f(i++, i)); /* 5. arg1 modifies i, used by arg2 */ } splint-3.1.2.dfsg1/test/argorder3.c0000644021234200000250000000034207121317330014452 0ustar faxint f (void) { int i = 3; int j; int a[10]; i = i++; /* bad */ a[i] = i++; /* bad */ a[i++] = i; /* bad */ j = i++ * i; /* bad */ j = i * i++; /* bad */ j += --i * ++i; /* bad * 2 */ } splint-3.1.2.dfsg1/test/argorder4.c0000644021234200000250000000074307121317330014460 0ustar faxint glob; int add(int x, int y) { return (x + y); } int f() { return (glob); } int g() { return (++glob); } int h() { if (f() > 3) { return (f() + g()); /* bad --- order of evaluation matters! */ } else { if (g() < 2) { return (f() + (++glob)); /* bad! */ } else { return (g() + h()); /* bad (twice) */ } } /* unreachable code here */ return (add ((printf("hullo"), 3), (printf("goodbye"), 4))); /* bad (wrice) */ } splint-3.1.2.dfsg1/test/argorder5.c0000644021234200000250000000065407121317330014462 0ustar faxvoid test (char *s1, int x); void test3 (int, char *s1); void test2 (/*@only@*/ char *s1, int x); char *copystring (char *s); int f (/*@only@*/ char *name) /*@modifies *name;@*/ { test (name, f(name)); /* 1. Variable name used after being released */ test3 (f(name), name); /* 2. Variable name used after being released */ test2 (copystring(name), f(name)); /* 3. Argument 2 modifies *name, used by ... */ return 3; } splint-3.1.2.dfsg1/test/args.c0000644021234200000250000000206707121317330013524 0ustar fax# include # include "bool.h" int sumn (int x, ...) { int y = 0; void *yaba; va_list args; va_start (args, (void *)x); /* okay (args counts as out param) */ while (x > 0) { x--; y = va_arg (args, int); /* okay */ y = va_arg (args, char *); /* type error */ y = va_arg (yaba, int); /* error */ } return y; } int test (int x, char *s) { x = sumn(); /* bad */ x = sumn(x); /* okay */ x = sumn(s); /* bad */ x = sumn(x, s); /* okay */ x = test (x, s, x); /* bad */ return x; } int missingargs (int x, int y) /* this is okay */ { y = x; return x; } int severalargs (char c, int y, bool b) /* first arg: int, second char *, third extra */ { if (b) { c = 'a'; } return y; } int severalargs2 (int x) /* bad */ { return x; } int voidargs (char c) /* bad */ { c = 'a'; return 3; } int any (...) /* ok */ { return 3; } int many1 (int x, char c, float f) /* bad */ { x; c; f; return x; } int many2 (int x, char c, ...) { c; return x; } int many3 (int x) /* bad */ { return x; } splint-3.1.2.dfsg1/test/arrayinit.c0000644021234200000250000000152607442773302014604 0ustar faxint x[3] = { 1 , 2, 3, 4 } ; /* Initializer block for x has 4 elements, but declared as int[3] */ int a[3] = { 1 , 2 } ; /* Initializer block for a has 2 elements, but declared as int[3] */ int aa[3][3] = { { 1 , 2, 3 }, /* Initializer block for aa has 2 elements, but declared as int[3][3] */ { 4, 5 } } ; /* Initializer block for aa[1] has 2 elements, but declared as int [3] */ int ab[] = { 1, 2, 3 } ; char cc[3] = { 'a', 'b', 'c' } ; char cs[3] = "ab"; char cs1[3] = "abc"; /* gcc doesn't warn for this */ /* stringliteralnoroom */ char cs2[3] = "abcd"; /* gcc warns for this with -Wall */ /* stringliteraltoolong */ char cs3[3] = "a"; /* stringliteral smaller (not on default) */ char csx[3][3] = { { 'a', 'b', 'c' } , "def", "gasdf" } ; /* 2 errors */ int a2[][2] = {{1,2},{3,4},{5,6}}; int a3[][2] = {{1,2},{3,4,5},{5,6}}; splint-3.1.2.dfsg1/test/arraylit.c0000644021234200000250000000105707445010135014417 0ustar fax# include int main (/*@unused@*/ int argc, /*@unused@*/ char **argv) /*@*/ { /*@observer@*/ char *unmodstr = "unmodifiable string"; /*@exposed@*/ char modstr[20] = "modifiable string"; /*@unused@*/ char modstr1[5] = "12345"; /* not enough space */ /*@unused@*/ char modstr2[6] = "12345"; /*@unused@*/ char modstr3[7] = "12345"; /* if +stringliteralsmaller */ modstr1 = modstr; unmodstr[0] = 'U'; /* line 6; not OK */ modstr[0] = 'M'; /* line 7; OK */ fprintf (stderr, "mod: %s mod1: %s", modstr, modstr1); return 0; } splint-3.1.2.dfsg1/test/blocks.c0000644021234200000250000000050407121317330014037 0ustar faxint f (int x) { if (x > 3) ; while (x < 2) ; if (x > 3) x++; while (x < 2) x++; if (x > 3) { x++; } while (x < 2) { x++; } for (; x < 2; x++) ; for (; x < 2; x++) x++; if (x == 0) { x = 3; } else if (x == 1) { x = 4; } if (x == 0) { x = 3; } else x = 4; if (x == 0) ; else ; return x; } splint-3.1.2.dfsg1/test/branchstate.c0000644021234200000250000000042507357501323015072 0ustar faxvoid foo(void) { size_t n; char *p; for (p = ""; (p != (char*) 0 ) && (*p); ) { switch (*p) { case '9': for (n = 0; n < 3; ++n) ; p += n; } } } /* % lclint -nof -boolops -branchstate foo11.c */ splint-3.1.2.dfsg1/test/break.c0000644021234200000250000000133207121317330013646 0ustar faxvoid f (int x) { while (x < 3) /* 3 [5]. Suspected infinite loop: no condition values modified */ { switch (x) { case 1: /*@switchbreak@*/ break; case 2: /*@loopbreak@*/ /* 1. Break preceded by loopbreak is breaking a switch */ break; case 3: break; /* 2. Break statement in switch inside loop */ } while (x > 2) /* 2 [4]. Suspected infinite loop: no condition values modified */ { if (3 > 4) { break; /* 3. Break statement in nested loop */ } else { /*@innerbreak@*/ break; } } } while (x < 2) { x++; /*@innerbreak@*/ break; /* 4 [6]. Break preceded by innerbreak is not in a deep loop */ } } splint-3.1.2.dfsg1/test/cases.c0000644021234200000250000000140107121317330013655 0ustar faxextern int g(int x); int f(int j) { int i; switch (j) { case 3: /* okay */ i = g(j); printf("3"); case 4: /* 2. Fall through case (no preceeding break) */ if (i == 3) /* 1. Variable i used before definition */ { printf("hullo"); return 3; } else { printf("yabba"); break; } case 5: /* okay */ i = g(j++); while (i < 3) { i++; if (j == 4) break; } case 6: /* 3. Fall through case (no preceeding break) */ printf("high"); return 3; case 7: /* okay */ case 8: /* okay */ case 9: printf("nope"); default: /* 4. Fall through case (no preceeding break) */ printf("splat"); } } /* 5. Path with no return in function declared to return int */ splint-3.1.2.dfsg1/test/buffertest1.c0000644021234200000250000000031007362336473015027 0ustar faxvoid t1 (void) { char *g; g[100] = 'f'; { g++; g[0] = '1'; g[67] = g[70]; g[98] = g[99]; g[90] = g[3]; } } void t2 (void) { char *g; g++; g[0] = g[1]; } splint-3.1.2.dfsg1/test/cases2.c0000644021234200000250000000113707121317330013745 0ustar faxextern /*@only@*/ int *g(/*@only@*/ int *y); /*@null@*/ /*@only@*/ int *f(/*@only@*/ int *x) { switch (*x) { case 1: return g(x); case 2: return g(x); case 3: return g(x); default: return g(x); } } /*@null@*/ /*@only@*/ int *f2(/*@only@*/ int *x) { switch (*x) { case 1: return g(x); case 2: return g(x); } /* 1. Variable x is released in one possible execution, but live ... */ return g(x); } /*@null@*/ /*@only@*/ int *f3(/*@only@*/ int *x) { switch (*x) { case 1: return g(x); } return g(x); } splint-3.1.2.dfsg1/test/cast.c0000644021234200000250000000216607121317330013522 0ustar faxtypedef int abst1, abst2; /* 1, 2. declaration errors (mutable types */ typedef char *FILE; int main (void) { abst1 a; abst1 *ap; abst2 b = 3; /* 3. wrong type */ abst2 *bp = (abst2 *) malloc(sizeof(abst2)); /* 4. cast to underlying abstract */ FILE *f; int *ip = (int *)malloc(sizeof(int)); *ip = 3; /* 5. possible null deref */ *bp = 5; /* 6, 7. possible null deref, assignment of int to abst2 */ /* 13 */ a = (abst1)ip; /* 8. cast to abstract */ /* 14 */ ap = (abst1 *)ip; /* 9. cast to underlying abstract */ f = (FILE *)ip; /* 10. cast to underlying abstract */ a = (abst1)a; /* 11. redundant abstract cast */ /* 17 */ ip = (int *)ap; /* 12, 13. cast from underlying abstract, allocated ip not released */ ip = (int *)f; /* 13. cast from underlying abstract */ /* 19 */ ip = (int *)a; /* 14. cast from underlying abstract */ /* 20 */ a = (abst1)b; /* 15, 16. cast from abst2, cast to abst1 */ /* 21 */ ap = (abst1 *)bp; /* 17, 18. cast to abst1 * , cast from abst2 * */ return 0; /* 19, 20. ip and bp not released */ } splint-3.1.2.dfsg1/test/cast2.c0000644021234200000250000000072007121317330013576 0ustar faxtypedef /*@abstract@*/ int *abst1; typedef /*@abstract@*/ int abst2; /*@access abst1@*/ /*@access abst2@*/ abst1 f1 (int *x) { return x; /* 1. Function returns reference to parameter x, 2. Implicitly temp storage x returned as implicitly only: x */ } abst1 f2 (/*@exposed@*/ int *x) { return (abst1) x; /* 3. Implicitly dependent storage x returned as implicitly only */ } abst2 g1 (int x) { return x; } abst2 g2 (int x) { return (abst2) x; } splint-3.1.2.dfsg1/test/chararraylit.c0000644021234200000250000000045407511353463015265 0ustar fax/* ** Character arrays can be initialized using string literals (without becoming observers). */ void f (void) { char s0[] = "abc"; char s1[3] = "abc"; /* warning about no room for nullterminator */ char *p = "abc"; *s0 = 'b'; /* okay */ s1[1] = 'd'; /* okay */ *p = 'c'; /* error */ } splint-3.1.2.dfsg1/test/charlit.c0000644021234200000250000000020107121317330014202 0ustar faxint f (void) { int x = 'a'; double z = 3; x = x + 'c' + 2 + z; return 'a'; } short s[] = { 0, -1 } ; unsigned u = -3; splint-3.1.2.dfsg1/test/clauses.c0000644021234200000250000000107307121317330014223 0ustar faxint f(/*@only@*/ int *x, /*@only@*/ int *y, /*@only@*/ int *z, /*@only@*/ int *z2) { if (3 > 4) { free (x); } /* 1. Variable x is released in true branch, but live in continuation. */ while (3 < 4) { free (y); } /* 2. Variable y is released in while body, but live if loop is not taken. */ if (3 > 4) { free (z); } else { free (z2); } /* 3. Variable z2 is released in false branch, but live in true branch. */ /* 4. Variable z is released in true branch, but live in false branch. */ return 3; } splint-3.1.2.dfsg1/test/clauses2.c0000644021234200000250000000031707121317330014305 0ustar faxextern /*@only@*/ int *new_ip (void); /*@only@*/ int *f(void) { int *x = new_ip (); int *y; if (3 > 4) { y = x; } else { free (x); y = new_ip (); } return y; } splint-3.1.2.dfsg1/test/clauses3.c0000644021234200000250000000145007121317330014305 0ustar faxtypedef struct { /*@null@*/ /*@only@*/ int *x; } *st; void f(/*@only@*/ st x) { if (x->x != NULL) { free (x->x); } ; free (x); } void f2 (/*@only@*/ st x) { if (x->x != NULL) { free (x->x); } else { ; } free (x); } void g (/*@only@*/ st x) { if (x->x == NULL) { } else { free (x->x); } free (x); } void h(/*@only@*/ st x) { if (7 > 3) { if (x->x != NULL) { free (x->x); } } /* 1. Storage x->x is released in one path, but live in another. */ free (x); } void m(/*@only@*/ st x) { if (7 > 3) { } else { free (x->x); /* 2. Possibly null storage passed as non-null param: x->x */ } /* 3. Storage x->x is released in one path, but live in another. */ free (x); } splint-3.1.2.dfsg1/test/commentchar.c0000644021234200000250000000034107121317330015061 0ustar faxint f (void) /*#modifies x#*/; /*#-commentchar %#*/ /*@ignore@*/ int x = 'c'; /* not ignored */ /*@end@*/ /*%ignore%*/ int x = 'c'; /* is ignored */ /*%end%*/ /*%-commentchar @%*/ /*@-commentchar5*/ /*@=commentchar*/ splint-3.1.2.dfsg1/test/commentcmd.c0000644021234200000250000000310107121317330014704 0ustar faxtypedef int abst1, abst2; /* 1, 2. Mutable abstract type abst1 declared without pointer ... */ typedef int abst3; /* 3. Mutable abstract type abst3 declared without pointer ... */ int main (void) { int i = 1; abst1 a1; abst2 a2; abst3 a3; /*@access abst1,abst3*/ /* 10 */ a1 = (abst1)i; /* ok */ a2 = (abst2)i; /* 4. Cast to abstract type abst2: (abst2)i */ a3 = (abst3)i; /* ok */ /*@noaccess abst1,abst3*/ /* 16 */ a1 = (abst1)i; /* 5. Cast to abstract type abst1: (abst1)i */ a2 = (abst2)i; /* 6. Cast to abstract type abst2: (abst2)i */ a3 = (abst3)i; /* 7. Cast to abstract type abst3: (abst3)i */ /*@access abst2*/ /* 22 */ a1 = (abst1)i; /* 8. Cast to abstract type abst1: (abst1)i */ a2 = (abst2)i; /* ok */ a3 = (abst3)i; /* 9. Cast to abstract type abst3: (abst3)i */ /*@access abst1,abst3*/ /* 28 */ a1 = (abst1)i; /* ok */ a2 = (abst2)i; /* ok */ a3 = (abst3)i; /* ok */ /*@noaccess abst1*/ /* 34 */ a1 = (abst1)i; /* 10. Cast to abstract type abst1: (abst1)i */ a2 = (abst2)i; /* ok */ a3 = (abst3)i; /* ok */ /*@noaccess abst2*/ /* 40 */ a1 = (abst1)i; /* 11. Cast to abstract type abst1: (abst1)i */ a2 = (abst2)i; /* 12. Cast to abstract type abst2: (abst2)i */ a3 = (abst3)i; /* ok */ /*@noaccess abst3*/ /* 46 */ a1 = (abst1)i; /* 13. Cast to abstract type abst1: (abst1)i */ a2 = (abst2)i; /* 14. Cast to abstract type abst2: (abst2)i */ a3 = (abst3)i; /* 15. Cast to abstract type abst3: (abst3)i */ return 3; } splint-3.1.2.dfsg1/test/compdestroy.c0000644021234200000250000000061607121317330015136 0ustar faxtypedef /*@only@*/ int *oip; typedef /*@abstract@*/ struct { oip *ips; int size; } *sip; void sip_free (/*@only@*/ sip x) { int i; for (i = 0; i < x->size; i++) { free (x->ips[i]); free (x->ips[i]); } free (x->ips); free (x); } void sip_free2 (/*@only@*/ sip x) { free (x->ips); /* 1. Only storage *(x->ips) (type oip) derived from released */ free (x); } splint-3.1.2.dfsg1/test/compoundliterals.c0000644021234200000250000000101407434450210016145 0ustar fax/* Compound literals, added to C99 */ struct simple { int a; int b; }; typedef struct simple simple_t; int main (/*@unused@*/ int argc, /*@unused@*/ char **argv) { /* This works */ struct simple simple1 = {1,2}; /* These don't */ struct simple simple2 = (struct simple){1,2}; simple_t simple3 = (((((((simple_t){1,2})))))); simple2 = (struct simple) { 1, 2 }; printf("%d, %d\n", simple1.a, simple1.b); printf("%d, %d\n", simple2.a, simple2.b); printf("%d, %d\n", simple3.a, simple3.b); return 1; } splint-3.1.2.dfsg1/test/compoundliterals.expect0000644021234200000250000000004307434450210017214 0ustar fax Finished checking --- no warnings splint-3.1.2.dfsg1/test/compoundstmt.c0000644021234200000250000000043507440260341015324 0ustar fax/* GCC extension: http://gcc.gnu.org/onlinedocs/gcc-3.0.3/gcc_5.html#SEC68 */ extern void fvoid (void) ; int main (int argc, char **argv) { int i, j; j = 1; i = ({ int __tmp; __tmp=(5); __tmp; }); j = ({ int __tmp; __tmp=(5); fvoid (); }); printf("%d\n", i); return 1; } splint-3.1.2.dfsg1/test/compoundstmt.expect0000644021234200000250000000045107440260341016370 0ustar fax compoundstmt.c: (in function main) compoundstmt.c:9:3: Assignment of void value to int: j = ({ int __tmp; __tmp = (5); fvoid(); }) compoundstmt.c:5:15: Parameter argc not used compoundstmt.c:5:28: Parameter argv not used Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/condifomit.c0000644021234200000250000000100210000622321014674 0ustar fax/* Contributed by Peteran, 12 Jan 2004 */ /* GCC extension: Conditionals with Omitted Operands "x ? : y" is same as x ? x : y http://gcc.gnu.org/onlinedocs/gcc-3.3.2/gcc/Conditionals.html#Conditionals */ /*@+boolint -exportlocal@*/ void cond1(void *testme) { int i,j; i = (testme!=0)? : 0; j = (testme!=0)? (testme!=0): 0; } int cond2(void *testme) { return (testme!=0)? : 0; } int cond3(int testme) { return testme? testme: 0; } void test_use_before_definition() { int i; printf("%d\n", i?:0); } splint-3.1.2.dfsg1/test/csyntax.c0000644021234200000250000000101507121317330014251 0ustar faxenum opcode { ONE } ; struct sopcode { int x; } ; union uopcode { int x; } ; int f() { int opcode = 1; int sopcode = 2; int uopcode = 3; return opcode + sopcode + uopcode; } struct stat_desc { short opcode; enum opcode x; } ; int main(register int x) { return x; } extern unsigned x(); extern unsigned int y; typedef char *cstring; extern cstring add_extension(cstring s, const cstring suffix); typedef int filename; extern cstring filename; extern int parseOpLine (cstring filename, cstring line); splint-3.1.2.dfsg1/test/constannot.c0000644021234200000250000000055107327407043014763 0ustar fax/*@constant int MaxLength=20@*/ # define MaxLength 20 void foo (char *str) /*@requires maxSet(str) >= MaxLength@*/ { str[20] = 'a'; } void foo2 (char *str) /*@requires maxSet(str) >= (MaxLength - 1)@*/ { str[20] = 'a'; /* error */ } void foo3 () { char buf[MaxLength]; buf[0] = '\0'; foo (buf); /* error: off by 1 */ foo2 (buf); /* okay */ } splint-3.1.2.dfsg1/test/controldepth.c0000644021234200000250000000053507121317330015273 0ustar faxvoid f (int x, int y) { if (x > y) { /* depth = 1 */ { /* still, depth = 1 */ while (x > 3) /* depth = 2 */ if (y == 2) /* depth = 3 */ x++; if (y == 2) x++; /* depth = 2 */ else { /* depth = 2 */ if (y == 4) /* depth = 3 */ { x++; } else { y++; } } } } } splint-3.1.2.dfsg1/test/csyntax10.c0000644021234200000250000000023607121317330014416 0ustar faxtypedef int tint; int ffunc(tint tint) { tint = 3; return tint; } int gfunc() { tint tint; tint = 3; return tint; } struct x { tint tint; } ; splint-3.1.2.dfsg1/test/csyntax11.c0000644021234200000250000000011107121317330014407 0ustar faxtypedef enum { eone } one; typedef struct { int x; one onet; } emp; splint-3.1.2.dfsg1/test/csyntax12.c0000644021234200000250000000023207121317330014414 0ustar faxtypedef int gender; int f() { static char *gender[] = { "male", "female", "?" }; if (*gender[1] == *gender[2]) return 3; else return 5; } splint-3.1.2.dfsg1/test/csyntax13.c0000644021234200000250000000016407121317330014421 0ustar fax/*@-varuse*/ typedef int isr_t; typedef int isrs; int f() { isr_t isrs; { isr_t isrs[3]; } return 3; } splint-3.1.2.dfsg1/test/csyntax14.c0000644021234200000250000000025307121317330014421 0ustar faxtypedef int atom; typedef struct atomrep { atom atom; struct atomrep *link; } atomrep; int f() { /*@-varuse -noreturn*/ atomrep * x = (atomrep *) 0; } splint-3.1.2.dfsg1/test/csyntax15.c0000644021234200000250000000011207121317330014414 0ustar faxint (f)(int x); int g() { return f(3); } int f(int x) { return x; } splint-3.1.2.dfsg1/test/csyntax16.c0000644021234200000250000000166607121317331014435 0ustar fax/* * lclfoo.c - test lclint */ #include #include int main(int argc, char *argv[]) { int i = 0, num; float pet = 0.0; int (*qfun)(float *); int (*getbuiltout(int))(float *); num = (argc > 1) ? atoi(argv[1]) : 0; qfun = getbuiltout(num); if (qfun != NULL) { i = qfun(&pet); printf("number in float %f and returns %d\n", pet, i); exit(EXIT_SUCCESS); } else exit(EXIT_FAILURE); } /* * should be a function (of one arg - int) returning * a pointer to a function (of one arg - float *) returning int * * From: cdecl * cdecl> declare getbuiltout as function (verbose as int) returning * pointer to function (pobj as pointer to float) returning int * int (*getbuiltout(int verbose))(float *pobj) { } */ int (*getbuiltout(int verbose))(float *) { int qpolygon(float *); switch(verbose) { case 1: return qpolygon; default: return NULL; } } splint-3.1.2.dfsg1/test/csyntax17.c0000644021234200000250000000022407121317331014423 0ustar faxtypedef char SBYTE; typedef SBYTE EID_UNIT_NUM; struct qry_rsp { int rsp[(EID_UNIT_NUM)16]; }; int f (void) { int x = (EID_UNIT_NUM) 3; } splint-3.1.2.dfsg1/test/csyntax2.c0000644021234200000250000000033107121317331014334 0ustar faxtypedef int mapping; typedef int mappair; int smalloc(); mapping * mapping_create (void) { mapping **t; int x; t = (mapping **) smalloc (sizeof (mapping *)); x = sizeof(t); x = sizeof *t; return *t; } splint-3.1.2.dfsg1/test/csyntax3.c0000644021234200000250000000012507121317331014336 0ustar faxtypedef int a1; a1 main() { int x; a1 a1; x = 3; a1 = x; return a1; } splint-3.1.2.dfsg1/test/csyntax4.c0000644021234200000250000000020707121317331014340 0ustar fax/* has parse errors in gcc */ typedef char *cstring; typedef char *filename; int f(cstring filename, int x); cstring filename; splint-3.1.2.dfsg1/test/csyntax5.c0000644021234200000250000000013707121317331014343 0ustar faxtypedef int fd_mask; typedef struct fd_set { fd_mask fds_bits[sizeof(fd_mask)]; } fd_set; splint-3.1.2.dfsg1/test/csyntax6.c0000644021234200000250000000002407121317331014337 0ustar faxint f(char *, int); splint-3.1.2.dfsg1/test/csyntax7.c0000644021234200000250000000005207121317331014341 0ustar faxtypedef int tint; const tint volatile x; splint-3.1.2.dfsg1/test/csyntax8.c0000644021234200000250000000010107121317331014335 0ustar faxint x; char y; short int z; int short w; int f(int x, int y); splint-3.1.2.dfsg1/test/csyntax9.c0000644021234200000250000000014707121317331014350 0ustar faxtypedef char *cstring; extern cstring add_extension(cstring s, const cstring suffix, cstring cstring); splint-3.1.2.dfsg1/test/czechnames.c0000644021234200000250000000074707121317331014714 0ustar fax# include "bool.h" # include "pivo.h" int pivo_pyet; int michelob_light; /* bad */ pivo budlight; /*@constant int pivo_devenast;@*/ # define pivo_devenast 12 bool pivo_yedno (pivo p) { /* pivo is accessible if +accessczech */ return (p == 1); } /* okay, since no types are accessible */ int samAdams (int x) { return x; } /*@access pivo@*/ int budweiser (int x) /* definitely an error! */ { return x; } pivo pivo_budvar (int x) /* that's better! */ { return x; } splint-3.1.2.dfsg1/test/czechoslovaknames.c0000644021234200000250000000074707121317331016313 0ustar fax# include "bool.h" # include "pivo.h" int pivo_pyet; int michelob_light; /* bad */ pivo budlight; /*@constant int pivo_devenast;@*/ # define pivo_devenast 12 bool pivo_yedno (pivo p) { /* pivo is accessible if +accessczech */ return (p == 1); } /* okay, since no types are accessible */ int samAdams (int x) { return x; } /*@access pivo@*/ int budweiser (int x) /* definitely an error! */ { return x; } pivo pivo_budvar (int x) /* that's better! */ { return x; } splint-3.1.2.dfsg1/test/deadparam.c0000644021234200000250000000030307320411654014502 0ustar faxextern void f (/*@out@*/ char *s); extern void g (/*@special@*/ char *s) /*@allocates s@*/ ; void t (/*@only@*/ char *s1, /*@only@*/ char *s2) { free (s1); f (s1); free (s2); g (s2); } splint-3.1.2.dfsg1/test/decl.c0000644021234200000250000000047207631564300013504 0ustar faxint test(int); int main() { int (*y)(int) = &test; int (**x)(int) = &y; x(10); /* called object is not a function */ } static /*@unused@*/ void foo1(void) { int buf[10]; buf[10] = 3; } static /*@unused@*/ void foo(void) { float *array = NULL; size_t /*@unused@*/ size = sizeof(array[0]); } splint-3.1.2.dfsg1/test/decl2.c0000644021234200000250000000012007121317331013546 0ustar fax# include "decl2.h" int *glob2; int glob2[]; char glob3; int glob; int glob; splint-3.1.2.dfsg1/test/dkf5kEnum.c0000644021234200000250000000046107325420442014422 0ustar fax/* dkf5k */ #include int main() { typedef enum { apple, pear, grapefruit } fruits; register int i; int array[grapefruit+1]; array[apple] = 24; array[pear] = 10; for(i=0; i <= 1; i++) { printf("%i\n", array[i]); } return 0; } splint-3.1.2.dfsg1/test/dkf5kRange.c0000644021234200000250000000063407325420442014554 0ustar fax/*dkf5k*/ #include #include int main() { char buffer[12] = "hello world"; int i; printf("Enter the character you want: "); scanf("%i", &i); if ( i >= sizeof(buffer)) { fprintf(stderr, "Error: %i is greater than or equal to the range which is %i", i, sizeof(buffer)); exit(0); } printf("You asked for character %i which is %c", i, buffer[i]); return 0; } splint-3.1.2.dfsg1/test/dkf5kSprintf.c0000644021234200000250000000021707325420442015142 0ustar fax/*dkf5k*/ #include int main() { char na[1000]; sprintf(na, "%s", "hello world"); printf("%s\n", &(na[0])); return 0; } splint-3.1.2.dfsg1/test/ensures.c0000644021234200000250000000141007320411655014251 0ustar faxtypedef /*@null@*/ char *ncp; void notnullname (ncp *name) /*@ensures notnull *name@*/ { **name = 'a'; /* ensures.c:6:4: Dereference of possibly null pointer *name: **name */ } /* Possibly null storage *name corresponds to storage listed in */ void nullname (/*@unused@*/ char **name) /*@ensures isnull *name@*/ { ; } /* ensures.c:13:2: Non-null storage *name corresponds to storage listed in ensures */ void nullname2 (char **name) /*@ensures isnull *name@*/ { *name = NULL; } void callname (void) { char **s; s = (char **) malloc (sizeof (char *)); assert (s != NULL); *s = NULL; notnullname (s); **s = 'a'; /* okay! */ nullname (s); **s = 'a'; /* ensures.c:33:4: Dereference of null pointer *s: **s */ free (*s); free (s); } splint-3.1.2.dfsg1/test/enum.c0000644021234200000250000000256107121317331013534 0ustar faxtypedef enum { one, two, three } etype; typedef enum { cero, uno, dos, tres } stype; typedef enum _mtag { threem, four } mtype; /* 4. Enum three declared with members ... */ typedef enum _itag { siete } itype; /* 5. Enumerator member siete declared with inconsistent type: ... */ typedef struct _st { int a; int b; } st ; typedef struct { int a; int b; } st2 ; /* 5. Structure st2 declared with fields ... */ /* (5. in enum.lcl) */ int f (void) { etype x; mtype m; int y; int a[]; y = a[one]; /* 6. Value a[] used before definition */ x = two; y = one; x = three; /* 7. Assignment of enum _mtag { three, four } to etype: x = three */ switch (x) { case one: break; } /* 8. Missing case in switch: two */ switch (x) { case one: switch (m) { case three: printf("one!"); break; case four: printf("yabba"); break; } break; case one: /* 9. Duplicate case in switch: one */ break; case 5: break; /* case in switch not in enum */ default: break; case two: break; /* okay (unreachable case) */ } } /* 10. Path with no return in function declared to return int */ /* 11. in enum.lcl */ enum { hasta, pasta, yummy } ; enum { e1, e2 = e1, e3 = e2 } ; struct adsf { enum { A, B, C } e; } ; void f5 (struct adsf s) { s.e = B; } splint-3.1.2.dfsg1/test/enumtag.c0000644021234200000250000000046707475757012014253 0ustar faxtypedef struct s_st st; struct s_st { int x; } ; typedef enum e_tag tag; enum e_tag r; enum e_tag { E_X, E_Y, E_Z } ; int f (tag e) { if (e == E_X) { return 3; } else { enum e_tag h = E_Z; if (h == e) { return 7; } } return 12; } enum e_tag { E_M } ; splint-3.1.2.dfsg1/test/exports.c0000644021234200000250000000011407121317331014264 0ustar fax# include "exports.h" int glob; int f(int a, int b) { return (a + b); } splint-3.1.2.dfsg1/test/external.c0000644021234200000250000000035507121317331014411 0ustar faxint func (int x, int y); int Func (int x, int y); int small1 (void); int small2 (void); int longfunction1 (void); int longfunction2 (void); static /*@unused@*/ int slongfunction1 (void); static /*@unused@*/ int slongfunction2 (void); splint-3.1.2.dfsg1/test/fields.c0000644021234200000250000000250707121317331014036 0ustar faxtypedef struct { /*@owned@*/ int *x; /*@owned@*/ int *y; /*@dependent@*/ int *z; } *pair; extern /*@only@*/ /*@out@*/ void *smalloc (size_t); /*@only@*/ pair pair_create (void) { pair p = (pair) smalloc (sizeof (*p)); p->x = smalloc (sizeof (int)); p->y = smalloc (sizeof (int)); p->z = p->y; *(p->x) = 3; *(p->y) = 12; return p; } /*@only@*/ pair pair_create1 (void) { pair p = (pair) smalloc (sizeof (*p)); p->x = smalloc (sizeof (int)); p->y = smalloc (sizeof (int)); p->z = p->y; *(p->y) = 12; *(p->x) = 3; p->y = smalloc (sizeof (int)); *(p->y) = 12; return p; /* 1. Returned storage p->z is only (should be dependant): p */ } void mangle (/*@temp@*/ pair p) { free (p->x); } /* 2. Released storage p->x reachable from parameter */ void mangle2 (/*@temp@*/ pair p) { free (p->x); p->x = p->y; } /* 3. Storage p->y reachable from parameter is dependant */ /*@only@*/ pair mangle3 (/*@only@*/ pair p) { free (p->x); p->x = p->y; return p; /* 4. Storage p->y reachable from return value is dependant (should be */ } int f (pair p) { p->x = NULL; /* 5. Only storage p->x not released before assignment: p->x = NULL */ return *(p->y); } void swap (pair p) { int *tmp = p->x; p->x = p->y; p->y = tmp; } void mangleok (/*@temp@*/ pair p) { int *loc = p->x; *loc = 8; } splint-3.1.2.dfsg1/test/fields2.c0000644021234200000250000000210107121317331014106 0ustar faxtypedef struct { int *x; int *y; /*@dependent@*/ int *z; } *pair; extern void pair_keep (/*@keep@*/ pair p); extern /*@only@*/ /*@out@*/ void *smalloc (size_t); extern /*@partial@*/ pair pair_part (void); /*@only@*/ pair pair_copy (pair p) { pair ret = (pair) smalloc (sizeof (*ret)); ret->x = p->x; ret->y = p->y; ret->z = p->z; return (ret); /* 1. Storage p->x reachable from parameter is kept (should be only) */ } /* 2. Storage p->y reachable from parameter is kept (should be only) */ /*@only@*/ pair pair_create (void) { pair p = (pair) smalloc (sizeof (*p)); p->x = smalloc (sizeof (int)); p->y = smalloc (sizeof (int)); p->z = p->y; /* 3. Only storage p->y assigned to dependent: p->z = p-y */ *(p->x) = 3; *(p->y) = 12; return p; /* 4. Storage p->y reachable from return value is unqualified */ } pair pair_swankle (/*@keep@*/ pair p) { pair ret = pair_part (); ret->x = p->x; pair_keep (p); /* 5. Storage p->x reachable from passed parameter is kept */ p->x = smalloc (sizeof (int)); *p->x = 3; return ret; } splint-3.1.2.dfsg1/test/fields3.c0000644021234200000250000000057607121317331014125 0ustar faxtypedef struct { int *x; int *y; } *pair; void pair_free (/*@only@*/ pair p) { int i = 3; free (p->x); if (i < 2) { *(p->y) = 3; i++; } free (p->y); free (p); } void pair_free2 (/*@only@*/ pair p) { int i = 3; free (p->x); if (i < 2) { *(p->y) = 3; } else { *(p->y) = 12; } free (p->y); free (p); } splint-3.1.2.dfsg1/test/flags.c0000644021234200000250000000034707121317331013664 0ustar faxint x = 'c'; /*@-linelen 25@*/ int y = 'c'; /*@+linelen 13@*/ /*@+internalnamelen 2@*/ int xx1; int xx2; /*@=linelen 25@*/ /*@-linelen 70@*/ /*@-dump asdf@*/ /*@-macrovarprefix@*/ /*@-macrovarprefix @*/ /*@-linelen asdf@*/ splint-3.1.2.dfsg1/test/glob.c0000644021234200000250000000035007121317331013505 0ustar faxint x; int y; int z; int useGlob (int a) { a = x + y; return (a + x + y) ; } int dontuseGlob (int a) { return (x + a); } int unspec (int a) { return (y + z + a); } int callsUseGlob (int a) { return (useGlob(a)); } splint-3.1.2.dfsg1/test/forbody.c0000644021234200000250000000027207320411656014237 0ustar fax/*@iter genericTable_elements (yield int m_el)@*/ # define genericTable_elements(m_el) \ { for (m_ind = 0 ; m_ind < 4; m_ind++) \ { int m_el; m_el = m_ind; m_el = 'a'; } splint-3.1.2.dfsg1/test/format.c0000644021234200000250000000016507320411656014064 0ustar faxvoid fn (FILE *f, char *fmt) { printf (fmt); printf ("%s", fmt); fprintf (f, fmt); fprintf (f, fmt, fmt); } splint-3.1.2.dfsg1/test/freearray.c0000644021234200000250000000060307320411657014552 0ustar faxtypedef /*@only@*/ char *ocp; static /*@only@*/ ocp *stringTable; static int stringTableSize; void destroyMod (void) /*@globals killed stringTable@*/ { int i; for (i = 0; i < stringTableSize; i++) { free (stringTable[i]); } free (stringTable); /* okay */ } void destroyMod2 (void) /*@globals killed stringTable@*/ { free (stringTable); /* error */ } splint-3.1.2.dfsg1/test/funcpointer.c0000644021234200000250000000522307121317331015122 0ustar fax# include typedef int ***(**f1)(void); /* f1 is a pointer to a function taking no args, returning int *** */ typedef int (*f2)(void); /* f2 is a function taking no args, returning an int */ typedef int **(*f3)(void); /* f3 is a function taking no args, returning a pointer to a pointer to an int */ typedef int *(*f4[])(void); /* f4 is an array of functions taking no args, returning pointers to ints */ typedef int *(f5)(int); /* f5 is a function taking an int, returning a pointer to an int */ typedef int *(*f6(int,int))(int); /* f6 is a function taking 2 int args, returns a function taking an int and returning a pointer to an int */ /* gcc complains if the pointer before f6 is omitted. why? */ /*@-paramuse*/ int func1(void) { return 3;} int *func2(void) { return (int *)malloc(sizeof(int));} /* 1. Possibly null storage returned as non-null ** 2. Returned storage not completely defined (allocated only) */ /*@null@*/ int **func3(void) { return (int **)0;} /*@null@*/ int ***func4(void) { return (int ***)0;} int *func5(int i) { return &i; } /* 3. Immediate address &i returned as only: &i */ /* 4. Return value references stack-allocated storage i: &i */ int *(*func6(int x, int y))(int) { return func5; } int main (void) { f1 t1; f2 t2; f3 t3; f3 *t3p; f4 *t4; f6 t6; int x, *xp, ***xppp; t1 = func1; /* 5. Assignment of int () * to f1 */ t1 = func4; /* 6. Assignment of int * * * () * to f1 */ *t1 = func4; t2 = func1; t2 = func2; /* 7. Assignment of int * () * to f2 */ t3 = func3; t3p = func3; /* 8. Assignment of int * * () * to f3 *: t3p = func3 */ t4 = func2; /* 9. Assignment of int * () * to f4 *: t4 = func2 */ xppp = (*t1)(); x = (t1)(); /* 10. Call to non-function (type f1): (t1) */ x = (t2)(); xp = (*t1)(); /* 11. Assignment of int * * * to int *: xp = (*t1)() */ xp = (t4)(); /* 12. Call to non-function (type f4 *): (t4) */ t6 = func1; /* 13. Assignment of int () * to f6: t6 = func1 */ t6 = func6; /* funcpointer.c:43: invalid lvalue in assignment */ (void) (t6)(); /* 14. Function (t6) called with 0 args, expects 2 */ (void) (t6)(3); /* 15. Function (t6) called with 1 args, expects 2 */ (void) ((t6)(3))(); /* 16. Function (t6) called with 1 args, expects 2 */ /* 17. Function ((t6)(3)) called with 0 args, expects 1 */ (void) ((t6)(5, 3))(7); return 3; } /* function pointer bug, provided by Marc Espie */ typedef void (*func)(void); void (*f[10])(void); func g[10]; void a(void) { } void b(void) { func *h; h = f; f[0] = a; g[0] = a; f[1] = g[0]; h[2] = a; } splint-3.1.2.dfsg1/test/globals.c0000644021234200000250000000131307121317331014205 0ustar faxint imp; /*@checked@*/ int check; /*@unchecked@*/ int uncheck; /*@checkedstrict@*/ int checkstrict; /*@checked@*/ /*@checked@*/ int doubled; /* 1. Redundant checked qualifier on doubled */ /*@checked@*/ /*@unchecked@*/ int contradict; /* 2. Contradictory checked and unchecked qualifiers on contradict */ void noglobs (void) { imp++; /* if +globunspec +allglobals */ check++; /* if +globunspec */ uncheck++; checkstrict++; /* 3. Unauthorized use of global checkstrict */ } void specglobs (void) /*@*/ { imp++; /* + if +allglobals, +impcheckedglobals */ check++; /* 4. Unauthorized use of global check */ uncheck++; checkstrict++; /* 5. Unauthorized use of global checkstrict */ } splint-3.1.2.dfsg1/test/globals2.c0000644021234200000250000000022507320411657014277 0ustar faxextern int glob1; int f (void) /*@globals glob1@*/ { return glob1; } int g (void) /*@globals glob2@*/ /*@globals glob1@*/ { return f(); } splint-3.1.2.dfsg1/test/impabstract.c0000644021234200000250000000036407320411660015101 0ustar faxtypedef int mint; /* Concrete in impabstract.lcl */ typedef /*@concrete@*/ int cint; /* Abstract in impabstract.lcl */ int f (mint m, cint c) { if (c > 3) { return c; } if (m < 2) { return m; } return 3; } splint-3.1.2.dfsg1/test/init.c0000644021234200000250000000062007121317331013525 0ustar faxchar c[][] = { NULL, "hullo", { 'a', 'b', 3 }, NULL }; struct { char *name; int x[]; char *uname; int y; } st = { "bob", { 1, 2}, NULL, 1.2 }; struct { char *name; int x[]; char *uname; int y; } st2[] = { { "bob", { 1, 2}, NULL }, { "charly", 3, NULL, 4 } } ; int a[10] = { 1, 2, 3, 4, 3.4, 6, 4 } ; int aa[][] = { { 1, 2, 3} , { 1, 3.2, 3} }; int b[10] = { { 1, 2} , {3, 4} } ; splint-3.1.2.dfsg1/test/innerfree.c0000644021234200000250000000040307320411660014537 0ustar fax/* Contributed by Matthew Yeates. */ int foo (char *b); struct s { char *i; }; static int redir(struct s *s) { s->i = malloc(1 * sizeof(int)); if (!(s->i)) return 1; if (0) { free(s->i); return 1; } free (s->i); return 0; } splint-3.1.2.dfsg1/test/inparam.c0000644021234200000250000000035207337777673014247 0ustar faxextern unknown (int *x); extern inparam (/*@in@*/ int *x); void f (/*@out@*/ int *x) { if (3 > 4) { unknown (x); /* x not completely defined */ } else { inparam (x); /* x not completely defined */ } } splint-3.1.2.dfsg1/test/internal.c0000644021234200000250000000101207121317331014372 0ustar fax/*@-varuse@*/ /*1234567890123456789012345678901XXXXXXXX*/ int iwonderhowmanycharactersaresignificant1 (void); int iwonderhowmanycharactersaresignificant2 (void); int manycharactersaresignificant1 (void); int manycharactersaresignificant2 (void); extern int fl; void f1 (void) { int e1; char *el; int alphabet; int *Alphabet; int alphabet1soup; int *alphabetlsoup; int lcase; { int e1; int a1phabet; char *lcAse; int s52; int sS2; int s5Z; int numO; int num0; } } splint-3.1.2.dfsg1/test/iter.c0000644021234200000250000000132007121317331013523 0ustar fax# include "iter.h" int test (void) { char c; int i; int *a; intFor(2,5,x,z) /* 2. Unrecognized identifier: x */ { printf("%d\n", z); } end_intFor; intFor(2,c,x,i) /* 3. Yield parameter shadows local declaration: i 5. Iter intFor expects arg 2 to be int gets char: c */ { ; } ; /* 4. Iter intFor not balanced with end_intFor */ intFor(2, 12, x, i+3) /* 6, 7. Variable i used before definition Yield parameter is not simple identifier: i + 3 */ { ; } end_arrayElements; /* 8. Iter intFor not balanced with end_intFor: end_arrayElements */ arrayElements(1, 10, a, el) { printf("%d\n", el); } end_arrayElements; return 3; } splint-3.1.2.dfsg1/test/iter2.c0000644021234200000250000000113007121317331013604 0ustar fax# include "iter2.h" int test (void) { char c; int i; int *a; intFor(2,5,x,z) /* 1. unrecognized identifier: x */ { printf("%d\n", z); } end_intFor; intFor(2,c,x,i) /* 2, 3, 5. yield param shadows local, variable i declared but not used, type mismatch c */ { ; } ; /* 4. not balanced with end_intFor */ intFor(2,12,x,i+3) /* 6, 7. use i before def, yield param not simple */ { ; } end_arrayElements; /* 8. not balanced with end_intFor */ arrayElements(1, 10, a, el) { printf("%d\n", el); } end_arrayElements; return 3; } splint-3.1.2.dfsg1/test/keep.c0000644021234200000250000000166507121317331013520 0ustar fax/*@only@*/ int *oglob; /*@keep@*/ int *kglob; void f1 (/*@keep@*/ int *x) { kglob = x; return; } void f2 (/*@keep@*/ int *x) { free (x); /* 1. Keep storage passed as only param: x */ } int f3 (/*@keep@*/ int *x) { int *y = malloc (sizeof (int)); if (y == NULL) return 3; /* 2. Keep storage not transferred before return: x */ *y = 3; f1 (x); f1 (y); return *x; } int f4 (/*@only@*/ int *x) { return (f3 (x)); } void f5 (/*@unused@*/ /*@keep@*/ int *x) { return; /* 3. Keep storage not transferred before return: x */ } void f6 (/*@keep@*/ int *x) { if (*x > 3) { f2 (x); } /* 4. Variable x is kept in true branch, but live in continuation. */ f2 (x); /* 5. Kept storage passed as keep: f2 (x) */ } /*@null@*/ int *f7 (/*@null@*/ /*@keep@*/ int *x) { if (x == NULL) { ; } else { f2 (x); } return x; /* 6. Kept storage x returned as implicitly only: x */ } splint-3.1.2.dfsg1/test/libs.c0000644021234200000250000000210407121317331013512 0ustar fax/* ** test of standard library */ int compare (int x, int y) { x = y; return (3); } char *compare2 (int x, int y) { x = y; return "ok"; } void leave (int i) { exit ("hullo"); /* 1. Function exit expects arg 1 to be int gets char * */ exit (i); /* 2. Unreachable code */ } void print (char *s, FILE *f) { char c; fprintf (f, s); printf(s); fprintf (stderr, s); c = fgetc(f); /* 3. Assignment of int to char: c = fgetc(f) */ c = getc (f); /* 4. Assignment of int to char: c = getc(f) */ } int main (void) { unsigned int x; x = NULL; /*@-null@*/ /* suppress errors for passing NULL's */ /*@-noeffect@*/ (void) bsearch (NULL, NULL, sizeof(int), compare) ; /* 5, 6 */ (void) bsearch (NULL, NULL, sizeof(int), sizeof(int), (int (*) ()) compare) ; /* ok */ bsearch (NULL, NULL, sizeof(int), sizeof(int), (char (*) ()) compare2) ; /* 7, 8 */ /*@=noeffect@*/ qsort (NULL, x, x, (int (*)()) compare); qsort (x, x, x, (char (*)()) compare2); /* 9, 10. */ signal (SIGHUP, compare); /* 11. */ signal (SIGHUP, leave); return 23; } splint-3.1.2.dfsg1/test/linked.c0000644021234200000250000000064607320411661014042 0ustar faxtypedef struct _node *node; struct _node { int val; /*@null@*/ node next; } void node_free1 (/*@only@*/ node n) { free (n); /* error: must free n->next */ } void node_free2 (/*@only@*/ node n) { node nn = n->next; free (n); /* okay */ } /* error: must free nn */ void node_free3 (/*@only@*/ node n) { node nn = n->next; free (n); /* okay */ node_free1 (nn); /* possibly null error */ } /* okay */ splint-3.1.2.dfsg1/test/linked2.c0000644021234200000250000000072707320411662014125 0ustar faxtypedef struct _node *node; struct _node { int val; /*@dependent@*/ /*@null@*/ node next; } void node_free1 (/*@only@*/ node n) { free (n); /* error: must free n->next */ } void node_free2 (/*@only@*/ node n) { node nn = n->next; free (n); /* okay */ } /* okay - no need to free nn since it is dependent */ void node_free3 (/*@only@*/ node n) { node nn = n->next; free (n); /* okay */ node_free1 (nn); /* error: dependent at only */ } /* okay */ splint-3.1.2.dfsg1/test/linked3.c0000644021234200000250000000076707320411662014132 0ustar faxtypedef struct _node *node; struct _node { char *val; /*@null@*/ node next; } void node_free1 (/*@only@*/ node n) { free (n); /* 2 errors: must free n->next, n->val */ } void node_free2 (/*@only@*/ node n) { node nn = n->next; free (n); /* error: must free n->val */ } /* error - nn not released */ void node_free3 (/*@only@*/ node n) { node nn = n->next; free (n->val); free (n); /* okay */ if (nn != NULL) { node_free1 (nn); /* okay (error for null) */ } } /* okay */ splint-3.1.2.dfsg1/test/linked4.c0000644021234200000250000000105107320411662014116 0ustar faxtypedef struct _node *node; typedef struct { char *val; } *item; struct _node { /*@only@*/ item val; /*@null@*/ node next; } void node_free1 (/*@only@*/ node n) { free (n); /* 2 errors: must free n->next, n->val */ } void node_free2 (/*@only@*/ node n) { node nn = n->next; free (n); /* error: must free n->val */ } /* error - nn not released */ void node_free3 (/*@only@*/ node n) { node nn = n->next; free (n->val); free (n); /* okay */ if (nn != NULL) { node_free1 (nn); /* okay (error for null) */ } } /* okay */ splint-3.1.2.dfsg1/test/linked5.c0000644021234200000250000000105507320411662014123 0ustar faxtypedef struct _node *node; typedef struct { char *val; } *item; struct _node { /*@dependent@*/ item val; /*@null@*/ node next; } void node_free1 (/*@only@*/ node n) { free (n); /* errors: must free n->next */ } void node_free2 (/*@only@*/ node n) { node nn = n->next; free (n); /* okay */ } /* error - nn not released */ void node_free3 (/*@only@*/ node n) { node nn = n->next; free (n->val); /* error: free dependent */ free (n); /* okay */ if (nn != NULL) { node_free1 (nn); /* okay (error for null) */ } } /* okay */ splint-3.1.2.dfsg1/test/linked6.c0000644021234200000250000000112507320411662014122 0ustar faxtypedef struct _node *node; typedef struct { char *val; } *item; struct _node { /*@only@*/ item val; /*@null@*/ node next; } extern void keeper (/*@keep@*/ item iv); void node_free1 (/*@only@*/ node n) { free (n); /* 2 errors: must free n->next, n->val */ } void node_free2 (/*@only@*/ node n) { node nn = n->next; keeper (n->val); free (n); /* okay */ } /* error - nn not released */ void node_free3 (/*@only@*/ node n) { node nn = n->next; keeper (n->val); free (n); /* okay */ if (nn != NULL) { node_free1 (nn); /* okay (error for null) */ } } /* okay */ splint-3.1.2.dfsg1/test/lintcomments.c0000644021234200000250000000057407413766632015326 0ustar faxint f (int x) { int i = 0; switch (x) { case 1: i++; /*@fallthrough@*/ /*FALLTHROUGH*/ case 2: i++; /*FALLTHROUGH*/ case 3: i++; /*FALLTHRU*/ case 4: i++; default: i++; } if (i > 2) { return i; /*@notreached@*/ i++; } else { return i; /*NOTREACHED*/ i++; } /*@notreached@*/ return 3; } splint-3.1.2.dfsg1/test/list.c0000644021234200000250000000125207323413233013541 0ustar faxtypedef /*@null@*/ struct _list { /*@only@*/ char *this; /*@null@*/ /*@only@*/ struct _list *next; } *list; extern /*@out@*/ /*@only@*/ void * smalloc (size_t); void list_addh (/*@temp@*/ list l, /*@only@*/ char *e) { if (l != NULL) { while (l->next != NULL) { l = l->next; } l->next = (list) smalloc (sizeof (*l->next)); l->next->this = e; } } /* l->next->next not defined */ void list_addh2 (/*@temp@*/ list l, /*@only@*/ char *e) { list new; assert (l != NULL); assert (l->next == NULL); new = (list) smalloc (sizeof (*l->next)); new->this = e; l->next = new; } /* l->next->next not defined */ splint-3.1.2.dfsg1/test/longconstants.c0000644021234200000250000000013607357756545015511 0ustar faxlong octlong = 07L; long hexlong = 0x34L; long llong = 3594UL; unsigned long ullong = 3594UL; splint-3.1.2.dfsg1/test/macros.c0000644021234200000250000000256707121317331014062 0ustar fax# include "bool.h" # define mustard(a,b) ((a) + b + a) /* 1, 2, 3, 4. no proto, 2 no parens, a used twice */ # define ketchup(a) (a) /* 5. no proto */ # define ok(a, b) ((a) + (b)) #define needparen(a, b) (a + b) /* 6, 7. no parens a and b */ # define needuse(a, b) (a) /* 8. b not used */ # define multuse(a, b) ((a) + (a) + (b)) /* 9. a used twice */ # define badassign(a,b) ((a) = (b)) /* 10. assignment to macro */ # define badassign(a,b) ((a)++, ++(b)) /* 11, 12, 13. badassign already defined, ++ on macro param */ # define predok(a,b) (((a) == 9) ? (b) : -(b)) # define predbad(a,b) (((a) == 8) ? (b) : -3) /* 14. b not used on false */ # define predbad2(a, b) (((a) == 2) ? (a) : (b) + (b)) /* 15, 16, 17. a used twice, b used twice, not in true */ # define badorder(a,b) ((b)+(a)) /* ok */ # define okorder(a,b,c) (((a) == 2) ? (b) + (c) : (b) - (c)) # define okorder2(a,b,c) (((a) == 2) ? (((b) == 3) ? (c) : -(c)) : (b) - (c)) # define badval(a, b) ((a) == (b)) /* 18. return value */ # define badconst 5 /* 19. type */ # define goodconst ((5) == (3)) # define worseconst(a) ((a) == 7) /* 20. constant as parameterized macro */ # define var 5 /* 21. var as macro */ # define var2(x) ((x) + (x)) /* 22, 23. var as parameterized macro, x used twice */ typedef int twerp ; splint-3.1.2.dfsg1/test/macrosef.c0000644021234200000250000000032107121317331014357 0ustar faxint f(/*@sef@*/ int x, int y); # define f(x,y) ((x) + (x) + (y) + (y)) /* 1. */ int g (int *p) { *p++; return *p; } int m (int *p) { int x = f ((printf ("yo\n"), 3), g(p)); return (f (g (p), x)); } splint-3.1.2.dfsg1/test/malloc.c0000644021234200000250000000117007671271606014050 0ustar faxvoid f1 () { int *ip = (int *) malloc (89); /* not divisible */ if (ip != NULL) { ip[88]=23; /* out of range */ free (ip); } } void f2 () { int *ip = (int *) malloc (88); /* divisible okay */ if (ip != NULL) { ip[21]=23; /* okay */ ip[22]=23; /* bad */ free (ip); } } void f3 () { int *ip = (int *) malloc (87 * sizeof (int)); if (ip != NULL) { ip[21]=23; /* okay */ ip[86]=23; /* okay */ ip[87]=23; /* bad */ free (ip); } } void f4 () { int *ip = (int *) malloc (87 * sizeof (short)); /* not divisible */ if (ip != NULL) { ip[86]=23; /* bad */ free (ip); } } splint-3.1.2.dfsg1/test/merge.c0000644021234200000250000000122307121317331013661 0ustar fax/*@null@*/ int *x; void f1 (void) { int *y = x; if (3 > 4) { ; } else { x = NULL; if (y != NULL) free (y); } /* y is unuseable...but no error yet */ } void f2 (void) { int *y = x; if (3 > 4) { ; } else { x = NULL; if (y != NULL) free (y); } *y = 23; /* 1. Variable y used in inconsistent state */ } /* 2. Dereference of possibly null pointer y: *y */ void f3 (void) { int *y = x; if (3 > 4) { ; } else { x = NULL; if (y != NULL) free (y); } y = x; *y = 23; /* 3. Dereference of possibly null pointer y: *y */ } splint-3.1.2.dfsg1/test/modclient.c0000644021234200000250000000016307121317331014542 0ustar faxint mod (int p[]) { (void) f1 (p); /* 6. Statement has no effect: (void)f1(p) */ (void) f2 (p); return 5; } splint-3.1.2.dfsg1/test/modifies.c0000644021234200000250000000136607577032212014400 0ustar fax# include "modifies.h" static int mstat; static /*@unused@*/ int internalState; int f3 (int p[]) /*@modifies internalState, fileSystem;@*/ ; /* 1. Modifies list uses ... */ int f4 (int p[]) /*@modifies p[3];@*/; int f5 (int fileSystem) /*@modifies fileSystem;@*/ ; /* 2. Modifies list uses fileSystem ... */ int f6 (void); int f6 (void) /*@modifies mstat;@*/ /* 3. Implementation modifies list for ... */ { return (mstat++); } int f1 (/*@unused@*/ int p[]) { mstat++; /* 4. Suspect modification of mstat: mstat++ */ return mstat; } int f2 (/*@unused@*/ int p[]) /*@modifies mstat;@*/ { mstat++; return 3; } int g2 (/*@unused@*/ int p[]) { return 3; } /* 5. Function g2 specified to modify internal state but no internal */ splint-3.1.2.dfsg1/test/modtest.c0000644021234200000250000000062007121317331014241 0ustar faxint x, y, ai[], bi[]; typedef struct _ts { int a; int b; } tst; tst ts; tst *tstp; int g (int a[], int *p) { return 7; } int f (int i[], int *j) { i[3] = y; j[2] = x; ai[3] = 5; ai[4] = 8; /* not a modification error ai[x'] */ i = j; x++; y++; ts.a = i[2]; ts.b = tstp->a; tstp->b = 6; g(j, i); return 3; } int h(int a[]) { y++; (void) g(a, &x); return y; } splint-3.1.2.dfsg1/test/moduncon.c0000644021234200000250000000030307121317331014402 0ustar faxint *mmod (int *); int *umod (int *); int f (int *x) { (void) umod (mmod (umod (x))); return *x; } int g (int *x) /*@*/ { (void) umod (x); (void) umod (mmod (umod (x))); return *x; } splint-3.1.2.dfsg1/test/mongoincludes.c0000644021234200000250000000007407121317331015433 0ustar fax# include "minc1.h" # include "minc2.h" # include "minc3.h" splint-3.1.2.dfsg1/test/mparen.c0000644021234200000250000000007407320411664014054 0ustar fax# define FOO 2+1 int fooey (int f) { return (f * FOO); } splint-3.1.2.dfsg1/test/mut.c0000644021234200000250000000031407121317331013367 0ustar fax# include "mut.h" void mut_mod (mut a) { *a = 3; } mut mut_create (void) { int *x = (int *) malloc(sizeof(int)); if (x == NULL) { exit (EXIT_FAILURE); } *x = 3; return x; } splint-3.1.2.dfsg1/test/mystrncat.c0000644021234200000250000000064607577032212014625 0ustar faxvoid mystrncat (/*@unique@*/ /*@returned@*/ char *s1, char *s2, size_t n) /*@modifies *s1@*/ /*@requires MaxSet(s1) >= ( MaxRead(s1) + n); @*/ /*@ensures MaxRead(result) >= (MaxRead(s1) + n); @*/; void func(char *str) { char buffer[256]; char *b; b = malloc(256); assert(b != NULL); mystrncat(buffer, str, sizeof(buffer) - 1); mystrncat(b, str, sizeof(buffer) - 1); free (b); return; } splint-3.1.2.dfsg1/test/noeffect.c0000644021234200000250000000027507650577033014377 0ustar faxtypedef char *exprNode; /*@function void exprNode_swap (sef exprNode, sef exprNode)@*/ # define exprNode_swap(e1,e2) do { exprNode m_tmp = (e1); (e1) = (e2); (e2) = m_tmp; } while (false) splint-3.1.2.dfsg1/test/null1.c0000644021234200000250000000347007414547435013642 0ustar fax# include "bool.h" void g(/*@temp@*/ int *y); /*@truenull@*/ bool ptrpred (/*@out@*/ /*@null@*/ int *x) { return (x == NULL); /* new error detected by out undef */ } /*@only@*/ int *f(/*@null@*/ int *x) { int *y = (int *)malloc (sizeof (int)); int *z; int *z2; int *z3; int *z4; int *z5; if (!x) { return x; /* 1. Unqualified storage returned as only: x, ** 2. Possibly null storage returned as non-null: x ** 3. Fresh storage y not released before return */ } z = (int *) malloc (sizeof (int)); z2 = (int *)malloc (sizeof (int)); z3 = (int *)malloc (sizeof (int)); *x = 7; *y = 3; /* 4. Possible dereference of null pointer: *y */ free (y); g(z); /* 5. Possibly null storage passed as non-null param: z ** 6. Passed storage z not completely defined (allocated only): z */ if (z) { *z = 3; } /* okay */ if (!z) { *z = 3; } /* 7. Possible dereference of null pointer: *z */ else { *z = 4; } /* okay */ z4 = (int *)malloc (sizeof (int)); if (z4 == NULL) { *z4 = 3; } /* 8. Possible dereference of null pointer: *z4 */ else { free (z4); } /* [ not any more: 12. Clauses exit... ] */ if (!(z2 != NULL)) { *z2 = 3; } /* 9. Possible dereference of null pointer: *z2 */ if (z3 != NULL) { *z3 = 5; /* okay */ } else { *z3 = 3; } /* 10. Possible dereference of null pointer: *z3 */ if (z2) free (z2); z2 = (int *)malloc (sizeof (int)); if (z2 != NULL) { *z2 = 5; } ; *z2 = 7; /* 11. Possible dereference of null pointer: *z2 */ z5 = (int *) malloc (sizeof (int)); if (ptrpred(z5)) { *z5 = 3; } /* 12. Possible dereference of null pointer: *z5 */ if (!ptrpred(z5)) { *z5 = 3; } if (ptrpred(z5)) { *z5 = 3; } else { free (z5); } free (z2); return z; /* 13. Fresh storage z3 not released */ } splint-3.1.2.dfsg1/test/null2.c0000644021234200000250000000207707121317331013626 0ustar fax# include "bool.h" void g(int *y); /*@truenull@*/ bool ptrpred (/*@out@*/ /*@null@*/ int *x) { return (x == NULL); } /*@only@*/ int *f(/*@null@*/ int *x1, /*@null@*/ int *x2, /*@null@*/ int *x3, /*@null@*/ int *x4) { bool test; test = x1 && (*x1 == 3); /* okay */ test = !x2 && (*x2 == 3); /* 1. Possible dereference of null pointer: *x2 */ test = x3 || (*x3 == 3); /* 2. Possible dereference of null pointer: *x3 */ test = !x4 || (*x4 == 3); /* okay */ test = ptrpred(x1) && (*x1 == 3); /* 3. Possible dereference of null pointer: *x1 */ test = !ptrpred(x1) && (*x1 == 3); /* okay */ if (x4 && (*x4 == 3)) { *x4 = 6; /* okay */ } if (!x4 || (*x4 == 6)) { *x4 = 12; /* 4. Possible dereference of null pointer: *x4 */ } if (!x1 || (*x1 == 6)) { return (x3); /* 5, 6. Unqualified storage returned as only: (x3), Possibly null storage returned as non-null: (x3) */ } return (x1); /* 7. Unqualified storage returned as only: (x1) not: null as non-null (because of || semantics) */ } splint-3.1.2.dfsg1/test/null3.c0000644021234200000250000000351707121317331013627 0ustar fax# include "bool.h" typedef /*@null@*/ int *nip; /*@only@*/ nip gnip; /*@only@*/ int *gip; void g(int *y); /*@truenull@*/ bool ptrpred (nip x) { return (x == NULL); } void f3 (/*@only@*/ nip x) { *gnip = 3; /* 1. Possible dereference of null pointer: *gnip */ *gip = 3; /* okay */ if (x) free (x); } /*@only@*/ int *f (nip arg0, nip arg1, nip arg2, /*@only@*/ int *aip) { int *y = (int *) malloc (sizeof (int)); int *z = (int *) malloc (sizeof (int)); *arg0 = 3; /* 2. Possible dereference of null pointer: *arg0 */ if (arg1) { *arg1 = 7; /* okay */ } else { free (y); /* 3. Possibly null storage passed as non-null param: y */ *z = 3; /* 4. Possible dereference of null pointer: *z */ return z; /* 5. Only storage not released before return: aip */ } /* arg1 is guarded */ *arg1 = 3; /* okay */ *arg2 = 5; /* 6. Possible dereference of null pointer: *arg2 */ *gip = 6; /* okay */ if (z) { *z = 3; } if (gnip) { free (gnip); } else { ; } /* okay */ gnip = z; /* okay */ *gnip = 3; /* 7. Possible dereference of null pointer: *gnip */ gip = z; /* 8, 9. uses z after release, only z not released */ /* Note: gip is possibly null now +++ kept*/ gnip = aip; /* 10. Only storage gnip not released before assignment: gnip = aip */ *gnip = 3; /* okay */ if (y) { return y; /* 11, 12. Returned storage y not completely defined, Function returns with non-null global gip referencing null */ } else { return y; /* 13, 14, 15. Possibly null storage returned as non-null: y, Returned storage y not completely defined, Function returns with non-null global gip referencing null */ } } void f2 (void) { *gnip = 3; /* 16. Possible dereference of null pointer: *gnip */ *gip = 3; /* okay */ } splint-3.1.2.dfsg1/test/null4.c0000644021234200000250000000121507121317331013621 0ustar fax# include "bool.h" /*@only@*/ /*@null@*/ int *p; extern /*@truenull@*/ bool isNull (/*@null@*/ int *p); void f (void) { if (p != NULL) return; else { p = malloc (24); if (p == NULL) exit (EXIT_FAILURE); *p = 3; } } void f1 (void) { if (p != NULL) return; p = malloc (24); if (p == NULL) exit (EXIT_FAILURE); *p = 3; } int f2 (void) { if (p == NULL) return 0; return *p; } int f3 (void) { if (isNull(p)) return 0; return *p; } void g (void) { if (p == NULL) return; p = malloc (24); /* 1. Only storage p not released before assignment */ if (p == NULL) exit (EXIT_FAILURE); *p = 3; } splint-3.1.2.dfsg1/test/null5.c0000644021234200000250000000105107121317331013620 0ustar fax# include "bool.h" extern /*@truenull@*/ bool isnull(/*@null@*/ int *x); extern /*@falsenull@*/ bool notnull(/*@null@*/ int *x); extern /*@falsenull@*/ char badnull (/*@null@*/ int *x); extern /*@falsenull@*/ bool worsenull (/*@null@*/ int *x, int t); int g1 (/*@null@*/ int *y) { if (isnull (y)) { return 0; } return *y; } int g2 (/*@null@*/ int *y) { if (notnull (y)) { return 0; } else { return *y; } } int g3 (/*@null@*/ int *y) { if (notnull (y)) { return 0; } return *y; } splint-3.1.2.dfsg1/test/null6.c0000644021234200000250000000236707121317331013634 0ustar fax# include "bool.h" typedef /*@null@*/ int *mnull; extern /*@notnull@*/ mnull mnull_create (void); extern int f1 (/*@notnull@*/ mnull x); /* 1. Function f1 declared with notnull ... */ int f (mnull x) { return *x; /* 2. Possible dereference of null pointer: *x */ } static /*@unused@*/ int f2 (/*@notnull@*/ mnull x) { return *x; } extern /*@falsenull@*/ bool isThree (mnull x); static /*@unused@*/ int f3 (/*@notnull@*/ mnull x) { if (isThree (x)) /* the parameter was missing before 2.4! */ { *x = 4; } else { *x = 5; } return (*x); } /*@notnull@*/ mnull f4 (void) { mnull x = NULL; if (x == NULL) { x = mnull_create (); } return x; } /*@notnull@*/ mnull f5 (void) { static /*@only@*/ mnull x = NULL; if (x == NULL) { x = mnull_create (); } return x; } /*@notnull@*/ mnull f6 (void) { static /*@only@*/ mnull x = NULL; if (x != NULL) { x = mnull_create (); } return x; /* 3. Possibly null storage returned as non-null */ } /*@notnull@*/ mnull f7 (void) { static /*@only@*/ mnull x = NULL; if (x == NULL) { x = mnull_create (); } else { x = NULL; } return x; /* 4. Possibly null storage returned as non-null */ } splint-3.1.2.dfsg1/test/nullassign.c0000644021234200000250000000010107320411665014741 0ustar faxint *a = 0; /*@null@*/ int* b = 0; /*@notnull@*/ int *c = 0; splint-3.1.2.dfsg1/test/nullret.c0000644021234200000250000000015207320411665014255 0ustar faxint * f1 () { return 0; } /*@null@*/ int * f2 () { return 0; } /*@notnull@*/ int * f3 () { return 0; } splint-3.1.2.dfsg1/test/observer.c0000644021234200000250000000162707320411665014427 0ustar faxtypedef struct { /*@only@*/ char *name; int val; } *stx; /*@only@*/ char *stx_name (stx x) { return (x->name); /* 1. Function returns reference to parameter x: (x->name) ** [2]. Return value exposes rep of stx: (x->name) ** 3. Released storage x->name reachable from parameter */ } /*@observer@*/ char *stx_observeName (stx x) { return (x->name); } /*@exposed@*/ char *stx_exposeName (stx x) { return (x->name); /* okay */ } char *f (stx x) { char *s; s = stx_name (x); free (s); /* okay */ s = stx_observeName (x); *s = 'x'; /* 4. Modification of observer */ free (s); /* 5. Pass observer as only */ s = stx_exposeName (x); *s = 'x'; /* okay */ free (s); /* 6. Pass exposed as only */ s = stx_observeName (x); return s; /* 7. Observer storage s returned without qualification: s ** 8. Dependent storage s returned as unqualified: s */ } splint-3.1.2.dfsg1/test/oldstyle.c0000644021234200000250000000051207330667152014434 0ustar faxint f1 (x, y) { int z; z = *y; /* 1. Dereference of non-pointer (int): *y */ return z + x; } int f2 (/*@unused@*/ x) /* 2. Function f2 declared with 1 arg, specified with 2 */ { return 3; } int f3 (x, y) int x; /*@unused@*/ char y; /* 3. Parameter 2, y, of function f3 has inconsistent type */ { return x; } splint-3.1.2.dfsg1/test/outglob.c0000644021234200000250000000160107320411666014244 0ustar faxint x1, x2, x3; int g() { return x1 + x2 + x3; /* 1. uses x3 before definition */ } int f() { int loc; if (3 > 4) { loc = 3; return x1; /* 2, 3, 4. bad --- x1 not defined, x2, x3 not defined */ } else { if (4 > 6) { loc = x1; /* 5. x1 not defined */ loc = g(); /* 6. bad --- x1, x2 not defined before call (defines x2 and x3) */ loc = x3; } else if (2 > 3) { loc = x3; /* 7. x3 not defined */ x1 = 6; x2 = 7; return g(); } else { x1 = 6; x2 = 7; return 12; /* 8. returns with x3 not defined */ } } return 12; /* No errors to report. Previously, [9, 10. returns with x2 and x3 undefined (x1 IS defined on all branches!)] but this is not correct; all branches that can reach the return do define x1, x2 and x3. */ } int h (void) { return x1; /* okay */ } splint-3.1.2.dfsg1/test/outparam.c0000644021234200000250000000221507121317332014415 0ustar faxtypedef struct _st { int a; int b; } *st; void h(st s, st t) { int i; st u1, u2; u1->a = 3; /* 1. Variable u1 used before definition */ u2 = u1; i = u2->a; i = (*s).a; /* 2. Field s->a used before definition */ t->a = i; } void f(/*@out@*/ int *a, int *b) { int x; int *y; x = *a; /* 3. Value *a used before definition */ x = *a; /* not reported */ x = *a; /* not reported */ x = *b; y = a; *a = 3; } int g() { int *b; int *c, *d; st s, t, t2, t3, t4; struct _st u; f(c, b); /* 4, 5. Unallocated storage c passed as out parameter: c, Variable b used before definition */ f(d, c); /* 6. Unallocated storage d passed as out parameter: d */ *c = *d; s = t; /* 7. Variable t used before definition */ s = t2->a; /* 8, 9. Variable t2 used before definition, Assignment of int to st: s = t2->a */ t3->a = 3; /* 10. Variable t3 used before definition */ u.a = 3; t4 = (st)malloc(sizeof(struct _st)); t4->a = 3; /* 11. Possible arrow access from null pointer: t4 */ return *b; /* 10. Fresh storage not released before return: t4 */ } splint-3.1.2.dfsg1/test/postnotnull.c0000644021234200000250000000037507414547435015211 0ustar faxtypedef struct { char *x; } T; static void foo(/*@special@*/ T* x) /*@defines x->x@*/ /*@post:notnull x->x@*/ ; static void bar (/*@out@*/ T* x) /*@post:notnull x->x@*/ { foo(x); } void test() { T a; foo(&a); bar(&a); } splint-3.1.2.dfsg1/test/preds.c0000644021234200000250000000060107121317332013677 0ustar fax# include "bool.h" int f (bool b1, bool b2, char c, int *p) { if (!p) { return 3; } if (*p) { return 4; } if (!(*p)) { return 4; } if (b1 = b2) { return 5; } if ((c = 'a')) { return 5; } if (b1 == b2) { return 5; } if (c) { return 2; } return 12; } splint-3.1.2.dfsg1/test/prefixes.c0000644021234200000250000000053007650577033014425 0ustar faxtypedef int Tin_ty; typedef int QINT; typedef int tint; /*@-varuse@*/ static int FSint; static int TYint; static int V3int; static int sint; static int Xqmxt; static int XqmXt; /*@=varuse@*/ extern int Gint; extern int aGb_Xint; /*@external@*/ int f (void); extern int g (void); # define mf() \ do { int m_x; { int y; }} while (false) splint-3.1.2.dfsg1/test/printflike.c0000644021234200000250000000043507121317332014736 0ustar fax/*@printflike@*/ int mprint (int x); /*@printflike@*/ int kprint (int x, char *s); /*@scanflike@*/ int sprint (void); /*@scanflike@*/ int uprint (); /*PRINTFLIKE*/ int qprint (int x, char *s, ...); /*@printflike@*/ /*@messagelike@*/ int qxprint (int x, char *s, int f, ...); splint-3.1.2.dfsg1/test/rc.c0000644021234200000250000000004507121317332013170 0ustar faxchar *f (void) { return MYSTERY; } splint-3.1.2.dfsg1/test/refcounts.c0000644021234200000250000000250107121317332014573 0ustar faxextern /*@out@*/ /*@only@*/ void *smalloc (size_t); typedef /*@refcounted@*/ struct _rp { /*@refs@*/ int refs; /*@only@*/ int *p; } *rp; extern rp rp_create2 (void); void rp_release (/*@killref@*/ rp x) { x->refs--; if (x->refs == 0) { free (x->p); free (x); /* 1. Reference counted storage passed as only param: free (x) */ } } /*@tempref@*/ rp rp_temp (void) { return rp_create2 (); /* 2. New reference returned as temp reference: rp_create2() */ } void rp_f (/*@killref@*/ rp r1, /*@killref@*/ rp r2) { rp rt = rp_temp (); rp_release (r1); r2 = rp_temp (); /* 3. Kill reference parameter r2 not released before assignment */ rp_release (rt); } rp rp_create (/*@only@*/ int *p) { rp r = (rp) smalloc (sizeof(rp)); r->refs = 1; r->p = p; return r; } rp rp_ref (rp x) { return x; /* 4. Reference counted storage returned without modifying ... */ } rp rp_refok (rp x) { x->refs++; return x; } rp rp_waste (/*@only@*/ int *p) { rp z1 = rp_create (p); rp z2 = rp_ref (z1); z2->p++; return z1; /* 5. New reference z2 not released before return */ } rp rp_waste2 (/*@only@*/ int *p) { rp z1 = rp_create (p); rp z2 = rp_ref (z1); z2 = rp_ref (z1); /* 6. New reference z2 not released before assignment */ return z1; /* 7. New reference z2 not released ... */ } splint-3.1.2.dfsg1/test/release.c0000644021234200000250000000044607121317332014211 0ustar fax/*@only@*/ /*@null@*/ int *f(void) { int *x = NULL; int *z; if (3 > 4) { int *y1 = malloc (sizeof (int)); int *y2 = malloc (sizeof (int)); if (y1 != NULL) { *y1 = 3; } if (y2 != NULL) { *y2 = 3; } x = y1; z = y2; } return x; } splint-3.1.2.dfsg1/test/repexpose.c0000644021234200000250000000420407121317332014577 0ustar fax# include "repexpose.h" abst abst_create (/*@dependent@*/ abst p, /*@only@*/ char *x, int i) { abst a = (abst) malloc (sizeof (struct _abst)); abst b = p; a->name = x; /* 1. Arrow access from possibly null pointer a */ a->val = i; a->parent = p; /* [3. exposes rep] */ a->parent = b; /* [4. exposes rep through alias] */ a->parent = p->parent; /* [5, 6. exposes rep] */ a->parent = b->parent; /* 2. Suspect modification of p->parent through alias a->parent */ /* [7, 8. exposes rep through alias] 3. modifies p */ b = a; a->name = *globstring; /* [9, 10.] exposes rep through global */ b->name = *globstring; /* ??? NO? 3. Suspect modification of *globstring through alias a->name */ /* [11, 12.] exposes rep through global and alias */ return a; /* 4. Storage a->name reachable from return value is kept */ /* 5. Returned storage *a contains 1 undefined field: im */ /* 6. Storage *globstring reachable from global is kept */ } /*@only@*/ char *abst_name (abst a) { return a->name; /* 7. Released storage a->name reachable from parameter */ /* [15, 16.] reference to parameter, exposes rep */ } int abst_val (abst a) { return a->val; } int *abst_aval(abst a) { return (&(a->val)); /* 9. [17, 18] reference to parameter, exposes rep */ } abst abst_parent (abst a) { abst b = a; if (TRUE) return b; /* [19] reference to parameter a */ else return b->parent; /* 8. Dependent storage b->parent returned as only */ /* 9. Only storage a not released before return */ } /*@dependent@*/ char *immut_name (immut im) { return (im->name); /* 10. Only storage im->name returned as dependent: (im->name) */ /* [23, 24] exposes rep, reference to parameter */ } void abst_setIm (abst a, immut im) { a->im = im; /* 11. Suspect modification of a->im: a->im = im */ /* 13. [25] modifies a, NO rep exposure since it is immutable! */ } immut abst_getIm (abst a) { return (a->im); /* NO rep exposure since it is immutable */ } splint-3.1.2.dfsg1/test/returned.c0000644021234200000250000000034007320411667014421 0ustar faxextern char *returnme (/*@returned@*/ char *s); /*@only@*/ char *f (void) { char *s = (char *) malloc (sizeof (char)); *s = 'a'; if (3 > 4) { return s; } else { return returnme (s); } } splint-3.1.2.dfsg1/test/sharing1.c0000644021234200000250000000313307320411670014302 0ustar fax/*@-paramuse@*/ /*@only@*/ int *globonly; /*@shared@*/ int *globshared1; /*@shared@*/ int *globshared2; /*@only@*/ int *zonly; void f(/*@only@*/ int *x, /*@temp@*/ int *y, /*@shared@*/ int *z) { *x = 3; if (3 > *x) return; /* 1. bad x not released */ } /* 2. bad x not released */ int f2(/*@temp@*/ int *x, /*@only@*/ int *y) { *x = 3; *y = 6; return 3; /* 3. bad y not released */ } void f3(/*@only@*/ int *x) { globshared1 = x; /* 4. bad shared globshared1 <- only x */ } /* 5. only not released */ void f4(/*@only@*/ int *x) { zonly = x; /* 6. bad - didn't release zonly */ } /* okay */ int g(int *imp) { int x = 3; int *y = malloc(sizeof(int)); int *y2 = malloc(sizeof(int)); int *y3 = malloc(sizeof(int)); if (y2) *y2 = 3; f3 (imp); /* 7. bad if +memimplicit --- unqualified as only */ *imp = 5; /* 8. uses released */ (void) f(&x, /* 9, 10. pass immediate as only, only parameter aliased */ &x, globshared1); (void) f2 (y3, y3); /* 11-15. --- 2 * null passed as nonnull, 2 * not completely def only parameter y3 aliased */ *y3 = 6; /* 16, 17. bad --- y3 was released, null */ (void) f(y, globshared1, globshared1); /* 18, 19. null as non-null, y not completely def */ (void) f(globshared1, /* 20. pass shared as only */ globshared2, globshared2); free (globshared2); /* 21. bad --- free's shared! (pass shared as only) */ free (globonly); return *y; /* 22-25. y used after release, possible null, locally allocated y2 not released, globonly is released */ } splint-3.1.2.dfsg1/test/sharing2.c0000644021234200000250000000146607121317332014311 0ustar faxextern /*@out@*/ /*@only@*/ void *smalloc (unsigned int size); typedef int mint; typedef struct _st { int a; /*@only@*/ int *b; /*@shared@*/ mint *c; int d; } *st; /*@only@*/ st st_create1 () { st res = (st) smalloc (sizeof(struct _st)); int *z; res->a = 3; z = res->b; /* res->b not defined */ z = (*res).c; /* (*res).c not defined */ return res; /* res->d not defined */ } void f1(/*@only@*/ st x) { free (x->b); free (x); } /* correct */ void f2(/*@only@*/ st x) { free (x); } /* bad --- didn't release x->b */ void f3(/*@only@*/ st x) { free (x->c); /* bad --- x->c is shared */ } /* bad --- didn't release x */ /*@only@*/ st st_create () { st res = (st) smalloc(sizeof(struct _st)); res->a = 3; return res; /* 6, 7, 8. res->b, res->c, res->d not defined */ } splint-3.1.2.dfsg1/test/sharing3.c0000644021234200000250000000154207121317332014305 0ustar faxextern /*@only@*/ char *string_copyext (char *s) ; void f (void) { char *s; if (3 < 4) { s = string_copyext ("asdf"); free (s); } } /*@only@*/ char *string_copy (char *s) { return s; /* 1. returns temp as only! */ } /*@only@*/ char *copy_string1 (char *s) { return string_copy (s); /* okay */ } /*@only@*/ char *copy_string2 (char *s) { return string_copyext (s); /* okay */ } void string_free1 (char *s) { free (s); /* 2. unqualified as only */ } void string_free2 (/*@only@*/ char *s) { free (s); } void string_free3 (/*@only@*/ char *s) { char *t = string_copy (s); string_free2 (s); *t = 'a'; } /* 3. bad, t not released */ void string_free4 (/*@only@*/ char *s) { char *t; int i; for (i = 0; i < 3; i++) { t = string_copy (s); *t = 'a'; free (t); } free (s); } /* okay */ splint-3.1.2.dfsg1/test/sharing4.c0000644021234200000250000000330707121317332014307 0ustar fax/*@only@*/ char *globonly1; /*@only@*/ char *globonly2; /*@only@*/ char *globonly3; /*@only@*/ char *globonly4; /*@only@*/ char *globonly5; /*@shared@*/ char *globshared1; /*@shared@*/ char *globshared2; extern void free (/*@out@*/ /*@only@*/ void *s); extern /*@only@*/ char *string_copy (char *s) /*@modifies nothing;@*/ ; int f(/*@only@*/ char *only1, /*@only@*/ char *only2, /*@only@*/ char *only3, char *temp1, /*@temp@*/ char *temp2, /*@shared@*/ char *shared1, /*@shared@*/ char *shared2) { char *local1; globonly1 = only1; /* 1. Only storage globonly1 not released before assignment */ free (globonly2); globonly2 = only2; free (globonly3); /* okay...for now */ globonly4 = shared1; /* 2. Only storage globonly4 not released before assignment 3. Shared storage assigned to only */ globshared1 = shared2; globshared1 = globshared2; globshared1 = globonly5; /* 4. Only storage assigned to shared */ local1 = globonly1; globshared1 = local1; /* 5. Only storage globonly1 assigned to shared (local1 aliases */ /* 6. Kept storage only1 assigned to shared (local1 aliases */ globshared1 = string_copy (local1); /* 7. Only storage assigned to shared */ globshared2 = temp2; /* 8. Temp storage temp2 assigned to shared */ globonly4 = temp1; /* 9. Only storage globonly4 not released before assignment 10. Temp storage temp1 assigned to only: globonly4 = temp1 */ free (shared1); /* 11. Shared storage shared1 passed as only param */ *only3 = 'a'; *shared2 = 'c'; return 3; /* 12. Only storage only3 not released before return */ /* 13. Function returns with global globonly3 referencing released */ } splint-3.1.2.dfsg1/test/sharing5.c0000644021234200000250000000160707121317332014311 0ustar faxextern void free (/*@out@*/ /*@only@*/ void *s); extern /*@only@*/ char *string_copy (char *s); void f(/*@only@*/ char *only1, /*@only@*/ char *only2, /*@only@*/ char *only3, /*@shared@*/ char *shared) { char *local1, *local2, *local4; char **localp; local1 = only1; *only1 = 'c'; /* okay */ free (local1); /* okay --- kills only1 */ *only1 = 'c'; /* 1. bad --- only1 is dead */ if (3 > 4) { local2 = only2; } else { local2 = shared; } /* 2. Clauses exit with local2 referencing dependant storage in true */ free (local2); /* 3. bad --- could free shared2 (may kill only2) */ localp = malloc(sizeof(char *)); *localp = only3; /* 4. possible null deref */ local4 = only3; local4 = NULL; /* okay */ localp = &only3; /* 5. new storage not released */ } /* 6. only3 may not be released [[[ only2 ??? ]]] */ splint-3.1.2.dfsg1/test/sizeof.c0000644021234200000250000000015407362336473014102 0ustar faxint main() { char x[3]; char y[3]; x[(sizeof x)] = 'i'; y[((sizeof y) - 1)] = '0'; return 0; } splint-3.1.2.dfsg1/test/slovaknames.c0000644021234200000250000000111407121317332015105 0ustar fax# include "bool.h" # include "pivo.h" int pivoPyet; int michelobLight; /* bad */ pivo budlight; /*@constant int pivoDevenast;@*/ # define pivoDevenast 12 bool pivoYedno (pivo p) { /* pivo is accessible if +accessczech */ return (p == 1); } /* no types are accessible (error for +slovakfcns) */ int samAdams (int x) { return x; } /* no types are accessible (okay for +slovakfcns) */ int samuel_adams (int x) { return x; } /*@access pivo@*/ int budweiser (int x) /* definitely an error! */ { return x; } pivo pivoBudvar (int x) /* that's better! */ { return x; } splint-3.1.2.dfsg1/test/specclauses.c0000644021234200000250000000162407121317332015102 0ustar faxtypedef struct { char *name; char *id; int year; } record; extern void setName (/*@special@*/ record *r, /*@only@*/ char *name) /*@defines r->name@*/ ; extern /*@observer@*/ char *getName (/*@special@*/ record r) /*@uses r.name@*/ ; extern void freeName (/*@special@*/ record r) /*@releases r.name@*/ ; extern /*@observer@*/ char *f (/*@only@*/ char *name, char *id) { record r; if (0 == 1) { setName (&r, name); return (getName (r)); /* r.name not released */ } else if (1 == 2) { return (getName (r)); /* r.name not defined */ } else if (2 == 3) { r.name = malloc (sizeof (char) * 12); setName (&r, name); /* r.name allocated, memory leak */ return id; /* r.name not released */ } else { setName (&r, name); freeName (r); printf ("%s\n", r.name); /* dead! */ freeName (r); return id; } } splint-3.1.2.dfsg1/test/specclauses2.c0000644021234200000250000000342007121317332015160 0ustar fax/*@-paramuse@*/ typedef struct { char *name; char *id; int year; } record; extern void allocYear (/*@special@*/ record *r) /*@allocates r->year@*/ /* 1. Allocates clause includes *.year of ... */ { r->year = 23; } /* 2. Unallocated storage r->year corresponds to storage listed ... */ extern void setName (/*@special@*/ record *r, /*@only@*/ char *name) /*@defines r->name@*/ { r->name = name; } extern void setName1 (/*@special@*/ record *r, /*@only@*/ char *name) /*@defines r->name@*/ { free (name); } /* 3. Storage r->name listed in defines clause not defined at ... */ extern void setName2 (/*@special@*/ record *r, char *name) /*@sets r->name@*/ { strcpy (r->name, name); } extern void setName3 (/*@special@*/ record *r, char *name) /*@sets r->name@*/ { } /* 4. Storage *(r->name) listed in sets clause not defined at ... */ extern void setName4 (/*@special@*/ record *r, /*@only@*/ char *name) /*@sets r->name@*/ { r->name = name; /* 5. Implicitly only storage r->name not released before ... */ } extern void allocName (/*@special@*/ record *r) /*@allocates r->name@*/ { r->name = (char *) malloc (sizeof (char) * 20); } extern void allocName2 (/*@special@*/ record *r) /*@allocates r->name@*/ { } /* 6. Storage r->name listed in allocates clauses is not ... */ extern void freeName (/*@special@*/ record r) /*@releases r.name@*/ { free (r.name); } extern void freeName2 (/*@special@*/ record r) /*@releases r.name@*/ { } /* 7. Storage r.name listed in releases clause not released */ extern void freeName3 (/*@special@*/ record *r) /*@releases r->name@*/ { free (r->name); } extern void freeName4 (/*@special@*/ record *r) /*@releases r->name@*/ { } /* 8. Storage r->name listed in releases clause not released ... */ splint-3.1.2.dfsg1/test/specclauses3.c0000644021234200000250000000246107121317332015165 0ustar faxtypedef struct { int id; char *name; } *record; int *badResult (void) /* 1. Function result is used in defines clause of badResult but ... 2. Special clause accesses field of non-struct or union result */ /*@defines result->name@*/ { return NULL; /* 3. Null storage returned as non-null: NULL */ } /*@special@*/ record createName (/*@only@*/ char *name) /*@defines result->name@*/ { record res = (record) malloc (sizeof (*res)); assert (res != NULL); res->name = name; return res; } /*@special@*/ record createName2 (void) /*@defines result->name@*/ { record res = (record) malloc (sizeof (*res)); return res; /* 4. Undefined storage res->name corresponds to storage listed ... 5. Possibly null storage res returned as non-null: res */ } /*@special@*/ record createName3 (void) /*@defines result->id@*/ /*@allocates result->name@*/ { record res = (record) malloc (sizeof (*res)); assert (res != NULL); res->name = (char *) malloc (sizeof (char) * 23); res->id = 21; return res; } /*@special@*/ record createName4 (void) /*@defines result->id@*/ /*@allocates result->name@*/ { record res = (record) malloc (sizeof (*res)); assert (res != NULL); res->id = 21; return res; /* 6. Unallocated storage res->name corresponds to storage ... */ } splint-3.1.2.dfsg1/test/stack.c0000644021234200000250000000122207121317332013667 0ustar faxint *glob; void stack1 (int **x) { int sa[3] = { 0, 1, 2 } ; int loc = 3; glob = &loc; *x = &sa[0]; } /* 1. Stack-allocated storage *x reachable from parameter x, 2. Stack-allocated storage glob reachable from global glob */ /*@dependent@*/ int *f (int c) { int x = 3; if (c == 0) { return &x; /* 3. Stack-allocated storage &x reachable from return value */ } else { int sa[10]; sa[0] = 35; sa[2] = 37; if (c == 1) { return sa; /* 4. Stack-allocated storage sa reachable ... */ } else { return &sa[0]; /* 5. Stack-allocated storage sa reachable ... */ } } } splint-3.1.2.dfsg1/test/specclauses4.c0000644021234200000250000000137007121317332015164 0ustar fax/*@-paramuse@*/ typedef struct { int id; char *name; } *record; void usename (/*@special@*/ char **name) /*@uses *name@*/ /*@pre:isnull *name@*/ { **name = 'a'; /* 1. Dereference of null pointer *name: **name */ } void callname (void) { char **s; s = (char **) malloc (sizeof (char *)); assert (s != NULL); *s = (char *) malloc (sizeof (char)); assert (*s != NULL); **s = 'a'; usename (s); /* 2. Non-null storage *s corresponds to storage listed in ... */ free (*s); free (s); } void nullname (/*@special@*/ char **name) /*@post:isnull *name@*/ { *name = NULL; } void nullname2 (/*@special@*/ char **name) /*@post:isnull *name@*/ { ; } /* 3. Non-null storage *name corresponds to storage listed in ... */ splint-3.1.2.dfsg1/test/specclauses5.c0000644021234200000250000000165107121317332015167 0ustar fax/*@-paramuse@*/ typedef struct { int id; char *name; } *record; /*@special@*/ record newrecord (void) /*@defines result@*/ /*@post:isnull result->name@*/ { record r = (record) malloc (sizeof (*r)); assert (r != NULL); r->id = 3; r->name = NULL; return r; } record createrecord (/*@only@*/ char *name) { record r = newrecord (); r->name = name; return r; } record createrecord2 (void) { record r = newrecord (); return r; /* 1. Null storage r->name derivable from return value: r */ } /*@special@*/ record newrecord2 (void) /*@defines *result@*/ /*@post:observer result->name@*/ { record r = (record) malloc (sizeof (*r)); assert (r != NULL); r->id = 3; r->name = NULL; return r; /* 2. Non-observer storage r->name corresponds to storage ... */ } record createrecordx (void) { record r = newrecord2 (); return r; /* 3. Observer storage r->name reachable from observer return */ } splint-3.1.2.dfsg1/test/specclauses6.c0000644021234200000250000000147007320411670015170 0ustar fax/*@-paramuse@*/ typedef struct { int id; char *name; } *record; void usename (/*@special@*/ char **name) /*@uses *name@*/ /*@requires isnull *name@*/ /*@ensures notnull *name@*/ { **name = 'a'; /* 1. Dereference of null pointer *name: **name */ } void callname (void) { char **s; s = (char **) malloc (sizeof (char *)); assert (s != NULL); *s = (char *) malloc (sizeof (char)); assert (*s != NULL); **s = 'a'; usename (s); /* 2. Non-null storage *s corresponds to storage listed in ... */ **s = 'a'; /* 3. null! */ free (*s); free (s); } void nullname (/*@special@*/ char **name) /*@post:isnull *name@*/ { *name = NULL; } void nullname2 (/*@special@*/ char **name) /*@post:isnull *name@*/ { ; } /* 3. Non-null storage *name corresponds to storage listed in ... */ splint-3.1.2.dfsg1/test/special.c0000644021234200000250000000320607121317332014206 0ustar faxchar gc; int gi; char *gs; int f() { char c; unsigned char uc; int i; long int li = 23; short int silly = 3; char *s; printf("hullo this is a %s !", "test"); (void) scanf("hullo, welcome to %d", &i); /* defines i */ printf("even %d %c harder", i, c); /* 1. Variable c used before definition */ uc = 'a'; printf("even %d %c harder", li, uc); /* 2. printf format arg 1 (%d) expects int gets long int: li */ printf("even %ld %d %hd %hd %d harder", i, li, i, silly, silly); /* 3, 4. [5, 6.] * arg1 (expects long), arg2 (expects int), arg3 (expects short), * (okay if +relaxquals) arg5 (expects int) */ (void) scanf("%*d okay"); /* [NO! 5. Statement has no effect] */ printf("%s %s", s, s); /* 5. Variable s used before definition */ printf("a real %+14.3i", c, i); /* 6, 7. printf format arg 1 (%i) expects int gets char: c, extra arg */ fprintf(stdout, "a real %+14.33i", c, i); /* 8, 9. fprintf format arg 1 (%i) expects int gets char: c, extra */ printf("%% %d %f %f", c, i); /* 10, 11, 12. printf format arg 1, arg2, missing arg 3 */ (void) scanf("hullo, welcome to %d", &i); (void) scanf("hullo, welcome to %d", i); /* 13. scanf format arg 1 (%d) expects int * gets int: i */ /* 3 type errors */ (void) fscanf(stdin, "hullo, welcome to %d %c %s", i, c, &s); /* 14, 15, 16. arg1, arg2, arg3 */ /* 3 modification errors */ (void) fscanf(stdin, "hullo, welcome to %23d %c %s", &gi, &gc, gs); /* 17, 18, 19. modifies g1, gc, gs */ /* 1 modification error */ (void) fscanf(stdin, "hullo, welcome to %*23d %*c %s", gs); /* 20. modifies gs */ return 3; } splint-3.1.2.dfsg1/test/staticarray.c0000644021234200000250000000050407121317332015112 0ustar fax#include #include char *foo1(void) { static char buf[1000]; strcpy(buf, "hello"); return buf; } /*@observer@*/ char *foo2(void) { static char buf[1000]; strcpy(buf, "hello"); return buf; } char *f (char outstr[]) { return outstr; } char *g (char *outstr) { return outstr; } splint-3.1.2.dfsg1/test/strings.c0000644021234200000250000000041307121317332014254 0ustar fax/* ** checks read-only strings */ char f1 (char *x) { return *x; } char f2 (char *x) /*@modifies *x;@*/ { *x = 'a'; return *x; } void f3 (/*@only@*/ char *x) { free (x); } void main (void) { (void) f1 ("hullo"); (void) f2 ("hullo"); f3 ("hullo"); } splint-3.1.2.dfsg1/test/structassign.c0000644021234200000250000000144607121317332015323 0ustar fax# include # include # include # include typedef struct { int x; char *name; } record; record copyrecord (record x) { record copy = x; return copy; /* 1. Released storage x.name reachable from parameter at ... */ } record copyrecord2 (record x) { record copy; copy = x; return copy; /* 2. Released storage x.name reachable from parameter at ... */ } record copyrecord3 (record x) { return x; /* 3. Released storage x.name reachable from parameter at ... */ } int main () { record r; record rc; r.x = 3; r.name = (char *) malloc (sizeof (char) * 100); assert (r.name != NULL); strcpy (r.name, "yo"); rc = r; printf ("rc: %s", rc.name); return r.x; /* 4. Only storage rc.name (type char *) derived from variable ... */ } splint-3.1.2.dfsg1/test/switch.c0000644021234200000250000000201507121317332014064 0ustar faxint f1(int x) { switch (x) { case 0: return 3; case 1: return 4; default: return 6; } } typedef enum _et { ONE, TWO, THREE } et; int f2 (et x) { switch (x) { case ONE: return 3; case TWO: return 8; case THREE: return 12; } } int f3 (et x) { switch (x) { case ONE: return 3; case TWO: break; default: return 12; } } /* 1. Path with no return in function declared to return int */ int f4 (et x) { switch (x) { case ONE: return 3; case TWO: return 14; default: return 12; } } int f5 (et x) { switch (x) { case ONE: return 3; case TWO: return 14; } /* 2. Missing case in switch: THREE */ } /* 3. Path with no return in function declared to return int */ int f6 (et x) { switch (x) { case ONE: if (3 > 4) { return 3; } else { return 12; } case TWO: if (3 > 4) break; return 14; default: return 12; } } /* 4. Path with no return in function declared to return int */ splint-3.1.2.dfsg1/test/t1.c0000644021234200000250000000006507142107131013107 0ustar faxvoid f () { int *z; z = (int *) malloc (4); } splint-3.1.2.dfsg1/test/test.c0000644021234200000250000000012207142107132013535 0ustar faxint main (void) { int *ip; *ip = 3; /* 5. possible null deref */ } splint-3.1.2.dfsg1/test/typequals.c0000644021234200000250000000040307121317332014611 0ustar fax# include "tq.h" void f (tam xtam, tai xtai, tm xtm, ti xti) /*@modifies xtam, xtai, xtm, xti@*/ { *xtam = 3; /* 4. Operand of * is abstract type (tam): *xtam */ *xtai = 4; /* 5. Operand of * is abstract type (tai): *xtai */ *xtm = 5; *xti = 8; } splint-3.1.2.dfsg1/test/ud.c0000644021234200000250000000141707121317332013200 0ustar faxint g; int f(int a, int b) { int x, y, z, z2, z3, z4, z5, z6; x = a; /* okay */ x = y; /* bad */ y = b; /* okay */ z = z; /* bad */ z = g; /* okay */ if (z == g) z2 = 3; else z2 = 4; x = z2; /* okay */ if (z == g) z3 = 3; else z4 = 4; x = z3; /* bad */ x = z4; /* bad */ if (z == g) z6 = 4; x = z6; /* bad */ if (z == g) { int i, j; i = x; /* okay */ i = j; /* bad */ z2 = i; /* okay */ z3 = i; /* okay */ } else { int i, j; { int m; j = i; /* bad */ i = z5; /* bad */ z3 = j; /* okay */ m = x; } } x = z5; /* bad */ x = z3; /* okay */ if (x == z3) { z4 = 7; } x = z4; /* < not reported> */ return 5; } splint-3.1.2.dfsg1/test/ud2.c0000644021234200000250000000056407121317332013264 0ustar faxvoid g (void) { char *x; char **y; f1(&x); printf("%s\n", x); f1(y); /* 1. Unallocated storage y passed as out parameter: y */ printf("%s\n", *y); } void h (void) { int z; char *x; char **y; f3 (&z); /* okay! */ f2 (&x); /* 2. Value &x used before definition, */ printf ("%s\n", x); f2 (y); /* 3. Variable y used before definition */ } splint-3.1.2.dfsg1/test/union.c0000644021234200000250000000307707121317332013724 0ustar faxtypedef union _ut { int x; int y; int *ox; /*@dependent@*/ int *dx; struct { int a; int b; int *ip; } st; } *ut; extern /*@only@*/ /*@out@*/ void *smalloc (size_t); ut ut_create1 (/*@unused@*/ int a) { ut u = (ut) smalloc (sizeof (*u)); return u; /* 1. Returned union u contains no defined field */ } ut ut_create2 (int a) { ut u = (ut) smalloc (sizeof (*u)); u->x = a; return u; } ut ut_create3 (int a) { ut u = (ut) smalloc (sizeof (*u)); u->x = a; u->y = a; return u; /* [Not anymore. Returned union u has 2 defined fields: x, y */ } ut ut_create4 (int *t) { ut u = (ut) smalloc (sizeof (*u)); u->ox = t; /* 2. Implicitly temp storage t assigned to implicitly only */ return u; } ut ut_create5 (int *t) { ut u = (ut) smalloc (sizeof (*u)); u->dx = t; /* 3. Implicitly temp storage t assigned to dependent: u->dx = t */ return u; } ut ut_create6 (void) { ut u = (ut) smalloc (sizeof (*u)); u->st.a = 3; return u; /* 4. Returned storage u->st contains 2 undefined fields: b, ip */ } ut ut_create7 (int *p) { ut u = (ut) smalloc (sizeof (*u)); u->st.a = 3; u->st.b = 4; u->st.ip = p; /* 5. Implicitly temp storage p assigned to implicitly only */ return u; } void ut_mangle1 (ut u) { free (u->ox); } /* 6. Released storage u->ox reachable from parameter */ void ut_mangle2 (ut u) { free (u->st.ip); } /* 7. Released storage u->st.ip reachable from parameter */ void ut_mangle3 (ut u) { free (u->st.ip); u->x = 3; /* This one's a toughy... */ } /* 8. Released storage u->st.ip reachable from parameter */ splint-3.1.2.dfsg1/test/ullint.c0000644021234200000250000000147007320411672014101 0ustar fax/* ** This test provided by Jim Zelenka */ typedef unsigned long pan_uint32_t; typedef long long pan_int64_t; typedef unsigned long long pan_uint64_t; struct t_s { pan_uint32_t w; pan_uint32_t x; }; int main (/*@unused@*/ int argc, /*@unused@*/ char **argv) { unsigned char c, *src, _src[6]; pan_uint32_t d, ui32; pan_uint64_t e; struct t_s st2; int i; c = 0x01; /* Error without +charintliteral or +charint */ st2.w = 1; st2.x = 2; for(i=0;i= 0) { printf ("twice loser"); } } splint-3.1.2.dfsg1/test/unnamedsu.c0000644021234200000250000000024007445016162014566 0ustar faxtypedef struct _su { int x1; union { int u1; int u2; } ; int x2; } su; su wtd = { 1, NULL, 2 }; int f (su *s) { return s->u1 + s->x1; } splint-3.1.2.dfsg1/test/unused.c0000644021234200000250000000053707121317332014075 0ustar faxtypedef int *dumbtype; typedef struct _st { int x; int y; int dumb; struct _inner { int l; int m; int silly; } inner; } st; extern int undef (int x); static int r (void); static int f (int x, st stx) { return (x + stx.x + stx.y + stx.inner.l + stx.inner.m + r()); } static int r (void) { return undef (3); } splint-3.1.2.dfsg1/test/void.c0000644021234200000250000000007007320411672013526 0ustar faxtypedef void VOID; int f (VOID) { f(); return 3; } splint-3.1.2.dfsg1/test/abstptr.expect0000644021234200000250000000214607413453477015334 0ustar fax abstptr.c: (in function main) abstptr.c:13:3: Assignment of abst * to void *: vp = ap abstptr.c:14:3: Assignment of abst * to int *: ip = ap2 abstptr.c:15:3: Assignment of int * to abst *: ap = ip abstptr.c:16:17: Cast from underlying abstract type abst *: (void *)ap abstptr.c:17:8: Dereference of null pointer ap: *ap abstptr.c:15:8: Storage ap becomes null abstptr.c:19:16: Cast from underlying abstract type abst *: (void *)&a abstptr.c:20:16: Cast to underlying abstract type abst *: (abst *)&b abstptr.c:21:3: Assignment of int * to abst *: ap = &b abstptr.c:22:3: Assignment of int to abst: *ap = b Finished checking --- 9 code warnings, as expected abstptr.c: (in function main) abstptr.c:14:3: Assignment of abst * to int *: ip = ap2 abstptr.c:15:3: Assignment of int * to abst *: ap = ip abstptr.c:17:8: Dereference of null pointer ap: *ap abstptr.c:15:8: Storage ap becomes null abstptr.c:20:16: Cast to underlying abstract type abst *: (abst *)&b abstptr.c:21:3: Assignment of int * to abst *: ap = &b abstptr.c:22:3: Assignment of int to abst: *ap = b Finished checking --- 6 code warnings, as expected splint-3.1.2.dfsg1/test/abstract.expect0000644021234200000250000000227407413453477015462 0ustar fax commentcmd.c:1:13: Mutable abstract type abst1 declared without pointer indirection: int (violates assignment semantics) commentcmd.c:1:20: Mutable abstract type abst2 declared without pointer indirection: int (violates assignment semantics) commentcmd.c:2:13: Mutable abstract type abst3 declared without pointer indirection: int (violates assignment semantics) commentcmd.c: (in function main) commentcmd.c:11:22: Cast to abstract type abst2: (abst2)i commentcmd.c:16:22: Cast to abstract type abst1: (abst1)i commentcmd.c:17:22: Cast to abstract type abst2: (abst2)i commentcmd.c:18:22: Cast to abstract type abst3: (abst3)i commentcmd.c:22:22: Cast to abstract type abst1: (abst1)i commentcmd.c:24:22: Cast to abstract type abst3: (abst3)i commentcmd.c:34:22: Cast to abstract type abst1: (abst1)i commentcmd.c:40:22: Cast to abstract type abst1: (abst1)i commentcmd.c:41:22: Cast to abstract type abst2: (abst2)i commentcmd.c:46:22: Cast to abstract type abst1: (abst1)i commentcmd.c:47:22: Cast to abstract type abst2: (abst2)i commentcmd.c:48:22: Cast to abstract type abst3: (abst3)i Finished checking --- 15 code warnings, as expected splint-3.1.2.dfsg1/test/alias.expect0000644021234200000250000001375607577744772014773 0ustar fax Finished checking --- no warnings alias.c: (in function f) alias.c:11:3: Possible undocumented modification of *a through alias *x: *x = 3 alias.c:14:3: Possible undocumented modification of *a through alias *y: *y = 4 alias.c:16:3: Undocumented modification of globp: globp = a alias.c:17:25: Function returns with global variable globp aliasing parameter a alias.c:21:7: Undocumented modification of globp: globp = z alias.c:21:15: Variable z used before definition alias.c:25:3: Undocumented modification of *globp: *globp = 4 alias.c:25:3: Possible undocumented modification of *a through alias *globp: *globp = 4 alias.c:28:3: Possible undocumented modification of *globp through alias *x: *x = 7 alias.c:28:3: Possible undocumented modification of *a through alias *x: *x = 7 alias.c:31:3: Possible undocumented modification of glob through alias *x: *x = 4 alias.c:38:3: Possible undocumented modification of **c through alias *x: *x = 4 alias.c:40:3: Possible undocumented modification of **c through alias *a: *a = 4 alias.c:41:3: Undocumented modification of *globp: *globp = 3 alias.c:41:3: Possible undocumented modification of *a through alias *globp: *globp = 3 alias.c:42:12: Function returns with global variable globp aliasing parameter a alias.c: (in function h) alias.c:49:3: Undocumented modification of a possible from call to mut_mod: mut_mod(a) alias.c:51:3: Undocumented modification of b possible from call to mut_mod (through alias a): mut_mod(a) alias.c:55:12: Owned storage b not released before return alias.c:52:3: Storage b becomes owned Finished checking --- 19 code warnings, as expected alias2.c: (in function f) alias2.c:17:3: Variable lx used before definition alias2.c:20:7: Possible undocumented modification of *a through alias *lx: *lx = 4 alias2.c:29:7: Possible undocumented modification of *a through alias *x: *x = 3 alias2.c:34:7: Possible undocumented modification of **c through alias *x: *x = 3 alias2.c:38:3: Possible undocumented modification of *a through alias *x: *x = 4 alias2.c:38:3: Possible undocumented modification of **c through alias *x: *x = 4 alias2.c:41:8: Undocumented modification of **c: **c = b alias2.c:43:7: Possible undocumented modification of glob through alias *y: *y = 3 alias2.c:43:7: Possible undocumented modification of *globp through alias *y: *y = 3 alias2.c:44:7: Undocumented modification of globp: globp = a alias2.c:53:3: Possible undocumented modification of glob through alias *a: *a = 3 alias2.c:53:3: Undocumented modification of *a: *a = 3 alias2.c:54:3: Possible undocumented modification of *globp through alias *z: *z = 6 alias2.c:54:3: Possible undocumented modification of *a through alias *z: *z = 6 alias2.c:55:3: Undocumented modification of *globp: *globp = 5 alias2.c:55:3: Possible undocumented modification of *a through alias *globp: *globp = 5 alias2.c:56:12: Function returns with global variable globp aliasing parameter a Finished checking --- 17 code warnings, as expected alias3.c: (in function model) alias3.c:16:3: Undocumented modification of gst.a: gst.a = 3 alias3.c:17:3: Undocumented modification of gu->a: gu->a = 5 alias3.c: (in function f) alias3.c:38:3: Possible undocumented modification of ia[3] through alias *ip: *ip = 7 alias3.c:42:3: Possible undocumented modification of ia[] through alias *ip: *ip = 8 alias3.c:44:3: Undocumented modification of ia[6] possible from call to model: model(ia) alias3.c:46:3: Undocumented modification of ia[6] possible from call to model (through alias ip[6]): model(ip) alias3.c:49:3: Undocumented modification of *(s1.b): *(s1.b) = 7 alias3.c:52:3: Undocumented modification of *(s1.b) possible from call to modst (through alias *(sl.b)): modst(sl) alias3.c:56:3: Undocumented modification of *(s1.b): *(s1.b) = 3 alias3.c:57:3: Possible undocumented modification of *(s1.b) through alias *ip: *ip = 6 alias3.c:58:3: Possible undocumented modification of *(s1.b) through alias *(sl.b): *(sl.b) = 3 alias3.c:61:3: Undocumented modification of *u1 possible from call to modu (through alias *ul): modu(ul) alias3.c:62:3: Possible undocumented modification of u1->a through alias ul->a: ul->a = 3 alias3.c:65:3: Possible undocumented modification of *(u1->s.b) through alias *(sl.b): *(sl.b) = 6 Finished checking --- 14 code warnings, as expected Finished checking --- no warnings alias4.c: (in function f) alias4.c:15:10: Function may return reference to parameter a through alias c: c alias4.c:15:10: Function may return reference to parameter b through alias c: c alias4.c: (in function h) alias4.c:26:12: Function returns reference to global glob: &glob alias4.c:28:12: Function returns reference to global globp: globp alias4.c:30:12: Function returns reference to global globs: (globs.field) alias4.c:32:12: Function returns reference to global globs: (&(globs.val)) Finished checking --- 6 code warnings, as expected alias5.c: (in function incx1) alias5.c:13:3: Possible undocumented modification of p->x through alias p2->x: p2->x++ alias5.c: (in function incx2) alias5.c:22:2: Fresh storage p2 not released before return alias5.c:20:3: Fresh storage p2 created alias5.c: (in function incx3) alias5.c:27:3: Only storage p2->x (type int *) not released before assignment: p2->x = p->x alias5.c:28:3: Possible undocumented modification of *(p->x) through alias *(p2->x): *(p2->x) = 3 alias5.c:30:2: Storage p->x reachable from parameter is kept (should be only) alias5.c:27:3: Storage p->x becomes kept Finished checking --- 5 code warnings, as expected splint-3.1.2.dfsg1/test/alttypes.expect0000644021234200000250000000102707413453477015517 0ustar fax alttypes.c:19:20: Function f2 inconsistently redeclared to return alternate types int | bool (types match, but alternates are not identical, so checking may not be correct) alttypes.c:17:20: Previous declaration of f2: int | void alttypes.c:25:20: Variable x inconsistently redeclared with alternate types int | char (types match, but alternates are not identical, so checking may not be correct) alttypes.c:24:33: Previous declaration of x: int | char | bool Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/ansireserved.expect0000644021234200000250000001123110101544330016313 0ustar fax ansireserved.c:9: Name EVANS is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) ansireserved.c:1:5: Name decimal_point is reserved for the standard library ansireserved.c:2:5: Name srand is reserved for the standard library ansireserved.c:3:5: Name labs is reserved for the standard library ansireserved.c:4:5: Name _x is in the implementation name space (any identifier beginning with underscore) ansireserved.c:5:5: Name atan2f is reserved for future library extensions. The names of all existing functions in suffixed with 'f' or 'l' may be added to . (ISO:7.26.1) ansireserved.c:7:13: Name wcst is reserved for future library extensions. Functions that begin with "mem" or "wcs" and a lowercase letter may be added to . (ISO:7.26.11) ansireserved.c:11:5: Name isaFish is reserved for future library extensions. Functions beginning with "is" or "to" and a lowercase letter may be added to . (ISO99:7.26.2) ansireserved.c: (in function isaFish) ansireserved.c:16:20: Name wctomb is reserved for the standard library Finished checking --- 9 code warnings, as expected ansireserved.c:9: Name EVANS is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) ansireserved.c:1:5: Name decimal_point is reserved for the standard library ansireserved.c:2:5: Name srand is reserved for the standard library ansireserved.c:3:5: Name labs is reserved for the standard library ansireserved.c:4:5: Name _x is in the implementation name space (any identifier beginning with underscore) ansireserved.c:5:5: Name atan2f is reserved for future library extensions. The names of all existing functions in suffixed with 'f' or 'l' may be added to . (ISO:7.26.1) ansireserved.c:7:13: Name wcst is reserved for future library extensions. Functions that begin with "mem" or "wcs" and a lowercase letter may be added to . (ISO:7.26.11) ansireserved.c:11:5: Name isaFish is reserved for future library extensions. Functions beginning with "is" or "to" and a lowercase letter may be added to . (ISO99:7.26.2) ansireserved.c: (in function isaFish) ansireserved.c:13:20: Name powl is reserved for future library extensions. The names of all existing functions in suffixed with 'f' or 'l' may be added to . (ISO:7.26.1) ansireserved.c:15:22: Name memory is reserved for future library extensions. Functions that begin with "mem" or "wcs" and a lowercase letter may be added to . (ISO:7.26.11) ansireserved.c:16:20: Name wctomb is reserved for the standard library Finished checking --- 11 code warnings, as expected ansireserved.c:9: Name EVANS is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) ansireserved.c:1:5: Name decimal_point is reserved for the standard library ansireserved.c:2:5: Function srand inconsistently declared as variable: int load file standard.lcd: Specification of srand as function: [function (unsigned int) returns void] ansireserved.c:2:5: Name srand is reserved for the standard library ansireserved.c:3:5: Function labs inconsistently declared as variable: int load file standard.lcd: Specification of labs as function: [function (long int) returns long int] ansireserved.c:3:5: Name labs is reserved for the standard library ansireserved.c:4:5: Name _x is in the implementation name space (any identifier beginning with underscore) ansireserved.c:5:5: Name atan2f is reserved for future library extensions. The names of all existing functions in suffixed with 'f' or 'l' may be added to . (ISO:7.26.1) ansireserved.c:7:13: Name wcst is reserved for future library extensions. Functions that begin with "mem" or "wcs" and a lowercase letter may be added to . (ISO:7.26.11) ansireserved.c:11:5: Name isaFish is reserved for future library extensions. Functions beginning with "is" or "to" and a lowercase letter may be added to . (ISO99:7.26.2) ansireserved.c: (in function isaFish) ansireserved.c:16:20: Name wctomb is reserved for the standard library ansireserved.c:5:5: Function atan2f declared but not defined Finished checking --- 12 code warnings, as expected ansireserved2.c:4:2: Name _s1 is in the implementation name space (any identifier beginning with underscore) Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/argorder.expect0000644021234200000250000001100007413453477015447 0ustar fax argorder.c: (in function f) argorder.c:8:20: Argument 2 modifies z, used by argument 3 (order of evaluation of actual parameters is undefined): printf("%d %d", z++, z) argorder.c:10:13: Argument 1 modifies i, used by argument 2 (order of evaluation of actual parameters is undefined): f((i++, j++), (i = 3), j) argorder.c:10:13: Argument 1 modifies j, used by argument 3 (order of evaluation of actual parameters is undefined): f((i++, j++), (i = 3), j) argorder.c:10:25: Argument 2 modifies i, used by argument 1 (order of evaluation of actual parameters is undefined): f((i++, j++), (i = 3), j) Finished checking --- 4 code warnings, as expected argorder2.c: (in function g) argorder2.c:16:12: Argument 1 modifies i, used by argument 2 (order of evaluation of actual parameters is undefined): f(f(1, 2), f(1, 2)) argorder2.c:16:21: Argument 2 modifies i, used by argument 1 (order of evaluation of actual parameters is undefined): f(f(1, 2), f(1, 2)) argorder2.c:17:12: Argument 1 modifies i, used by argument 2 (order of evaluation of actual parameters is undefined): f(f(1, 2), h()) argorder2.c:18:12: Argument 1 modifies i, used by argument 2 (order of evaluation of actual parameters is undefined): f(f(1, 2), i) argorder2.c:19:14: Argument 1 modifies i, used by argument 2 (order of evaluation of actual parameters is undefined): f(i++, i) Finished checking --- 5 code warnings, as expected argorder3.c: (in function f) argorder3.c:7:8: Expression has undefined behavior (value of left operand i is modified by right operand i++): i = i++ argorder3.c:8:11: Expression has undefined behavior (left operand uses i, modified by right operand): a[i] = i++ argorder3.c:9:12: Expression has undefined behavior (value of right operand modified by left operand): a[i++] = i argorder3.c:10:13: Expression has undefined behavior (value of right operand modified by left operand): i++ * i argorder3.c:11:12: Expression has undefined behavior (value of left operand i is modified by right operand i++): i * i++ argorder3.c:12:14: Expression has undefined behavior (left operand uses i, modified by right operand): --i * ++i argorder3.c:12:14: Expression has undefined behavior (left operand modifies i, used by right operand): --i * ++i argorder3.c:13:2: Path with no return in function declared to return int Finished checking --- 8 code warnings, as expected argorder4.c: (in function h) argorder4.c:19:21: Expression has undefined behavior (left operand uses glob, modified by right operand): f() + g() argorder4.c:25:18: Expression has undefined behavior (left operand uses glob, modified by right operand): f() + (++glob) argorder4.c:29:18: Expression has undefined behavior (left operand uses glob, modified by right operand): g() + h() argorder4.c:29:18: Expression has undefined behavior (left operand modifies glob, used by right operand): g() + h() argorder4.c:35:16: Argument 1 modifies file system state, used by argument 2 (order of evaluation of actual parameters is undefined): add((printf("hullo"), 3), (printf("goodbye"), 4)) argorder4.c:35:16: Argument 1 modifies *stdout, set by argument 2 (order of evaluation of actual parameters is undefined): add((printf("hullo"), 3), (printf("goodbye"), 4)) argorder4.c:35:38: Argument 2 modifies file system state, used by argument 1 (order of evaluation of actual parameters is undefined): add((printf("hullo"), 3), (printf("goodbye"), 4)) argorder4.c:35:38: Argument 2 modifies *stdout, set by argument 1 (order of evaluation of actual parameters is undefined): add((printf("hullo"), 3), (printf("goodbye"), 4)) argorder4.c:35:10: Unreachable code: return (add((pri... Finished checking --- 9 code warnings, as expected argorder4.c: (in function h) argorder4.c:35:10: Unreachable code: return (add((pri... Finished checking --- 1 code warning, as expected argorder5.c: (in function f) argorder5.c:8:9: Variable name used after being released argorder5.c:8:17: Storage name released argorder5.c:9:19: Variable name used after being released argorder5.c:9:12: Storage name released argorder5.c:10:28: Argument 2 modifies *name, used by argument 1 (order of evaluation of actual parameters is undefined): test2(copystring(name), f(name)) Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/args.expect0000644021234200000250000000254607413453477014615 0ustar fax args.c: (in function sumn) args.c:14:7: Assignment of char * to int: y = va_arg(args, char *) args.c:15:19: First argument to va_arg is not a va_list (type void *): yaba args.c: (in function test) args.c:22:7: Function sumn called with 0 args, expects at least 1 args.c:24:12: Function sumn expects arg 1 to be int gets char *: s args.c:27:7: Function test called with 3 args, expects 2 args.c:37:5: Function severalargs declared with 3 args, specified with 2 args.lcl:1: Specification of severalargs args.c:37:23: Parameter 1, c, of function severalargs has inconsistent type: declared char, specified int args.lcl:1: Specification of severalargs args.c:37:30: Parameter 2, y, of function severalargs has inconsistent type: declared int, specified char * args.lcl:1: Specification of severalargs args.c:43:5: Function severalargs2 declared with 1 arg, specified with 2 args.lcl:2: Specification of severalargs2 args.c:48:5: Function voidargs declared with 1 arg, specified with 0 args.lcl:7: Specification of voidargs args.c:59:33: Parameter 3, f, of function many1 has inconsistent type: declared float, specified ... args.lcl:4: Specification of many1 args.c:73:5: Function many3 declared with 1 arg, specified with 3 args.lcl:6: Specification of many3 Finished checking --- 12 code warnings, as expected splint-3.1.2.dfsg1/test/arrayinit.expect0000644021234200000250000000226507731476207015660 0ustar fax arrayinit.c:1:12: Initializer block for x has 4 elements, but declared as int [3]: 1, 2, 3, 4 arrayinit.c:2:12: Initializer block for a has 2 elements, but declared as int [3]: 1, 2 arrayinit.c:3:16: Initializer block for aa has 2 elements, but declared as int [3][3]: { 1, 2, 3 }, { 4, 5 } arrayinit.c:4:18: Initializer block for aa[1] has 2 elements, but declared as int [3]: 4, 5 arrayinit.c:10:15: String literal with 4 characters is assigned to char [3] (no room for null terminator): "abc" arrayinit.c:11:15: String literal with 5 characters (counting null terminator) is assigned to char [3] (insufficient storage available): "abcd" arrayinit.c:14:40: String literal with 4 characters is assigned to char [3] (no room for null terminator): "def" arrayinit.c:14:47: String literal with 6 characters (counting null terminator) is assigned to char [3] (insufficient storage available): "gasdf" arrayinit.c:17:22: Initializer block for a3[1] has 3 elements, but declared as int [2]: 3, 4, 5 Finished checking --- 9 code warnings, as expected splint-3.1.2.dfsg1/test/arraylit.expect0000644021234200000250000000200207577744773015510 0ustar fax arraylit.c: (in function main) arraylit.c:7:34: String literal with 6 characters is assigned to char [5] (no room for null terminator): "12345" arraylit.c:13:3: Suspect modification of observer unmodstr[0]: unmodstr[0] = 'U' arraylit.c:5:24: Storage unmodstr[0] becomes observer Finished checking --- 2 code warnings, as expected arraylit.c: (in function main) arraylit.c:6:38: String literal with 18 characters is assigned to char [20] (possible waste of storage): "modifiable string" arraylit.c:7:34: String literal with 6 characters is assigned to char [5] (no room for null terminator): "12345" arraylit.c:9:34: String literal with 6 characters is assigned to char [7] (possible waste of storage): "12345" arraylit.c:13:3: Suspect modification of observer unmodstr[0]: unmodstr[0] = 'U' arraylit.c:5:24: Storage unmodstr[0] becomes observer Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/blocks.expect0000644021234200000250000000545407440260341015121 0ustar fax blocks.c: (in function f) blocks.c:3:15: Body of if statement is empty blocks.c:4:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. blocks.c:21:16: Body of if clause of if statement is empty blocks.c:22:9: Body of else clause of if statement is empty Finished checking --- 4 code warnings, as expected blocks.c: (in function f) blocks.c:3:15: Body of if statement is empty blocks.c:4:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. blocks.c:6:15: Body of if statement is not a block: x++; blocks.c:16:12: Incomplete else if logic (no final else): if (x == 1) { x = 4; } blocks.c:19:8: Body of else clause of if statement is not a block: x = 4; blocks.c:21:16: Body of if clause of if statement is empty blocks.c:22:9: Body of else clause of if statement is empty Finished checking --- 7 code warnings, as expected blocks.c: (in function f) blocks.c:4:18: Body of while statement is empty blocks.c:4:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. blocks.c:7:18: Body of while statement is not a block: x++; Finished checking --- 3 code warnings, as expected blocks.c: (in function f) blocks.c:4:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. blocks.c:12:23: Body of for statement is empty blocks.c:13:23: Body of for statement is not a block: x++; Finished checking --- 3 code warnings, as expected blocks.c: (in function f) blocks.c:3:15: Body of if statement is empty blocks.c:4:18: Body of while statement is empty blocks.c:4:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. blocks.c:12:23: Body of for statement is empty blocks.c:21:16: Body of if clause of if statement is empty blocks.c:22:9: Body of else clause of if statement is empty Finished checking --- 6 code warnings, as expected blocks.c: (in function f) blocks.c:3:15: Body of if statement is empty blocks.c:4:18: Body of while statement is empty blocks.c:4:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. blocks.c:6:15: Body of if statement is not a block: x++; blocks.c:7:18: Body of while statement is not a block: x++; blocks.c:12:23: Body of for statement is empty blocks.c:13:23: Body of for statement is not a block: x++; blocks.c:16:12: Incomplete else if logic (no final else): if (x == 1) { x = 4; } blocks.c:19:8: Body of else clause of if statement is not a block: x = 4; blocks.c:21:16: Body of if clause of if statement is empty blocks.c:22:9: Body of else clause of if statement is empty Finished checking --- 11 code warnings, as expected splint-3.1.2.dfsg1/test/branchstate.expect0000644021234200000250000000031707357501323016140 0ustar fax branchstate.c: (in function foo) branchstate.c:7:37: Right operand of && is non-boolean (char): (p != (char *)0) && (*p) Finished LCLint checking --- 1 code error found, as expected splint-3.1.2.dfsg1/test/break.expect0000644021234200000250000000274407413453477014745 0ustar fax break.c: (in function f) break.c:12:4: Break preceded by loopbreak is breaking a switch break.c:17:14: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. break.c:3:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. break.c:34:24: Break preceded by innerbreak is not in a deep loop Finished checking --- 4 code warnings, as expected break.c: (in function f) break.c:12:4: Break preceded by loopbreak is breaking a switch break.c:14:4: Break statement in switch inside loop break.c:21:8: Break statement in nested loop break.c:17:14: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. break.c:3:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. break.c:34:24: Break preceded by innerbreak is not in a deep loop Finished checking --- 6 code warnings, as expected break.c: (in function f) break.c:12:4: Break preceded by loopbreak is breaking a switch break.c:14:4: Break statement in switch inside loop break.c:17:14: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. break.c:3:10: Suspected infinite loop. No value used in loop test (x) is modified by test or loop body. break.c:34:24: Break preceded by innerbreak is not in a deep loop Finished checking --- 5 code warnings, as expected splint-3.1.2.dfsg1/test/buffertest.expect0000644021234200000250000000156507413453477016032 0ustar fax buffertest1.c: (in function t1) buffertest1.c:5:3: Variable g used before definition buffertest1.c:5:3: Possible out-of-bounds store: Unable to resolve constraint: requires maxSet(g @ buffertest1.c:5:3) >= 100 needed to satisfy precondition: requires maxSet(g @ buffertest1.c:5:3) >= 100 buffertest1.c: (in function t2) buffertest1.c:20:3: Variable g used before definition buffertest1.c:21:3: Possible out-of-bounds store: Unable to resolve constraint: requires maxSet(g @ buffertest1.c:20:3) >= 1 needed to satisfy precondition: requires maxSet(g @ buffertest1.c:21:3) >= 0 buffertest1.c:21:10: Possible out-of-bounds read: Unable to resolve constraint: requires maxRead(g @ buffertest1.c:20:3) >= 2 needed to satisfy precondition: requires maxRead(g @ buffertest1.c:21:10) >= 1 Finished checking --- 5 code warnings, as expected splint-3.1.2.dfsg1/test/cases.expect0000644021234200000250000000336307577744773014772 0ustar fax cases.c: (in function f) cases.c:12:10: Fall through case (no preceding break) cases.c:13:11: Variable i used before definition cases.c:30:10: Fall through case (no preceding break) cases.c:37:13: Fall through case (no preceding break) cases.c:40:2: Path with no return in function declared to return int Finished checking --- 5 code warnings, as expected cases2.c: (in function f2) cases2.c:26:5: Variable x is released in one possible execution, but live in other possible execution. cases2.c:26:5: in one possible execution: cases2.c:23:16: Storage x released cases2.c: (in function f3) cases2.c:37:5: Variable x is released in one possible execution, but live in other possible execution. cases2.c:37:5: in one possible execution: cases2.c:36:16: Storage x released Finished checking --- 2 code warnings, as expected cases2.c: (in function f2) cases2.c:26:5: Variable x is released in one possible execution, but live in other possible execution. cases2.c:26:5: in one possible execution: cases2.c:23:16: Storage x released cases2.c: (in function f3) cases2.c:37:5: Variable x is released in one possible execution, but live in other possible execution. cases2.c:37:5: in one possible execution: cases2.c:36:16: Storage x released cases2.c:1:24: Function g declared but not defined Finished checking --- 3 code warnings, as expected cases2.c: (in function f2) cases2.c:28:12: Variable x used after being released cases2.c:23:16: Storage x released cases2.c: (in function f3) cases2.c:39:12: Variable x used after being released cases2.c:36:16: Storage x released cases2.c:1:24: Function g declared but not defined Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/bool.h0000644021234200000250000000126007650577033013541 0ustar fax#ifndef BOOL_H #define BOOL_H /*@-cppnames@*/ /*@-exporttype@*/ typedef /*@abstract@*/ int bool; /*@=exporttype@*/ /*@=cppnames@*/ #ifndef FALSE /*@constant unused bool FALSE@*/ #define FALSE false #endif #ifndef TRUE /*@constant unused bool TRUE@*/ #define TRUE true #endif /*@-slovakfcns@*/ extern /*@unused@*/ void bool_initMod (void); # define bool_initMod() extern /*@unused@*/ /*@observer@*/ char *bool_unparse (bool); # define bool_unparse(b) ((b) ? "true" : "false" ) extern /*@unused@*/ bool bool_not (bool); # define bool_not(b) ((b) ? FALSE : TRUE) extern /*@unused@*/ bool bool_equal (bool, bool); # define bool_equal(a,b) ((a) ? (b) : !(b)) /*@=slovakfcns@*/ # endif splint-3.1.2.dfsg1/test/cast.expect0000644021234200000250000000374307413453477014613 0ustar fax cast.c:1:13: Mutable abstract type abst1 declared without pointer indirection: int (violates assignment semantics) cast.c:1:20: Mutable abstract type abst2 declared without pointer indirection: int (violates assignment semantics) cast.c: (in function main) cast.c:6:13: Variable b initialized to type int, expects abst2: 3 cast.c:7:25: Cast to underlying abstract type abst2 *: (abst2 *)malloc(sizeof(abst2)) cast.c:11:10: Dereference of possibly null pointer ip: *ip cast.c:9:14: Storage ip may become null cast.c:12:10: Dereference of possibly null pointer bp: *bp cast.c:7:15: Storage bp may become null cast.c:12:9: Assignment of int to abst2: *bp = 5 cast.c:13:21: Cast to abstract type abst1: (abst1)ip cast.c:14:24: Cast to underlying abstract type abst1 *: (abst1 *)ip cast.c:15:22: Cast to underlying abstract type FILE *: (FILE *)ip cast.c:16:21: Redundant cast involving abstract type abst1: (abst1)a cast.c:17:22: Cast from underlying abstract type abst1 *: (int *)ap cast.c:18:22: Cast from underlying abstract type FILE *: (int *)f cast.c:19:22: Cast from underlying abstract type abst1: (int *)a cast.c:20:21: Cast from abstract type abst2: (abst1)b cast.c:20:21: Cast to abstract type abst1: (abst1)b cast.c:21:24: Cast to underlying abstract type abst1 *: (abst1 *)bp cast.c:21:24: Cast from underlying abstract type abst2 *: (abst1 *)bp cast.c:22:19: Owned storage ap not released before return cast.c:21:10: Storage ap becomes owned cast.c:22:19: Last reference ip to owned storage a not released before return cast.c:20:10: Original reference lost Finished checking --- 20 code warnings, as expected cast2.c: (in function f1) cast2.c:9:10: Implicitly temp storage x returned as implicitly only: x cast2.c:9:10: Function returns reference to parameter x: x cast2.c: (in function f2) cast2.c:15:10: Implicitly dependent storage x returned as implicitly only: (abst1)x Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/chararraylit.expect0000644021234200000250000000052607577744773016357 0ustar fax chararraylit.c: (in function f) chararraylit.c:8:16: String literal with 4 characters is assigned to char [3] (no room for null terminator): "abc" chararraylit.c:13:3: Suspect modification of observer p: *p = 'c' chararraylit.c:9:13: Storage *p becomes observer Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/charlit.expect0000644021234200000250000000334107577032212015270 0ustar fax charlit.c: (in function f) charlit.c:3:11: Variable x initialized to type char, expects int: 'a' A character constant is used as an int. Use +charintliteral to allow character constants to be used as ints. (This is safe since the actual type of a char constant is int.) charlit.c:6:7: Incompatible types for + (int, char): x + 'c' charlit.c:8:10: Return value type char does not match declared type int: 'a' charlit.c:12:14: Variable u initialized to type int, expects unsigned int: -3 To ignore signs in type comparisons use +ignoresigns Finished checking --- 4 code warnings, as expected charlit.c: (in function f) charlit.c:3:11: Variable x initialized to type char, expects int: 'a' A character constant is used as an int. Use +charintliteral to allow character constants to be used as ints. (This is safe since the actual type of a char constant is int.) charlit.c:4:14: Variable z initialized to type int, expects double: 3 An int literal is used as any numeric type (including float and long long). Use +numliteral to allow int literals to be used as any numeric type. charlit.c:6:7: Incompatible types for + (int, char): x + 'c' charlit.c:8:10: Return value type char does not match declared type int: 'a' charlit.c:11:18: Initial value of s[1] is type int, expects short int: -1 To ignore type qualifiers in type comparisons use +ignorequals. charlit.c:12:14: Variable u initialized to type int, expects unsigned int: -3 To ignore signs in type comparisons use +ignoresigns Finished checking --- 6 code warnings, as expected charlit.c: (in function f) charlit.c:6:3: Assignment of double to int: x = x + 'c' + 2 + z To allow all numeric types to match, use +relaxtypes. Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/clauses.expect0000644021234200000250000000307107647356045015314 0ustar fax clauses.c: (in function f) clauses.c:6:5: Variable x is released in true branch, but live in continuation. clauses.c:6:5: in true branch: clauses.c:5:13: Storage x released clauses.c:11:5: Variable y is released in while body, but live if loop is not taken. clauses.c:11:5: in while body: clauses.c:10:13: Storage y released clauses.c:20:5: Variable z2 is released in false branch, but live in true branch. clauses.c:20:5: in false branch: clauses.c:19:13: Storage z2 released clauses.c:20:5: Variable z is released in true branch, but live in false branch. clauses.c:20:5: in true branch: clauses.c:15:13: Storage z released Finished checking --- 4 code warnings, as expected Finished checking --- no warnings clauses3.c: (in function h) clauses3.c:48:5: Storage x->x is released in one path, but live in another. clauses3.c:46:10: Storage x->x released clauses3.c: (in function m) clauses3.c:61:5: Storage x->x is released in one path, but live in another. clauses3.c:60:13: Storage x->x released Finished checking --- 2 code warnings, as expected clauses3.c: (in function h) clauses3.c:48:5: Storage x->x is released in one path, but live in another. clauses3.c:46:10: Storage x->x released clauses3.c: (in function m) clauses3.c:60:13: Possibly null storage x->x passed as non-null param: free (x->x) clauses3.c:61:5: Storage x->x is released in one path, but live in another. clauses3.c:60:13: Storage x->x released Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/commentchar.expect0000644021234200000250000000134207413453477016152 0ustar fax commentchar.c:14:1: Syntactic commentchar comment is not followed by a whitespace character: 5 commentchar.c:15:1: Cannot restore commentchar commentchar.c:10:5: Variable x redefined commentchar.c:6:5: Previous definition of x commentchar.c:10:9: Variable x initialized to type char, expects int: 'c' Finished checking --- 4 code warnings, as expected commentchar.c:14:1: Syntactic commentchar comment is not followed by a whitespace character: 5 commentchar.c:15:1: Cannot restore commentchar commentchar.c:1:26: Unrecognized identifier in modifies comment: x commentchar.c:6:9: Variable x initialized to type char, expects int: 'c' Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/compdestroy.expect0000644021234200000250000000407707671271606016230 0ustar fax compdestroy.c: (in function sip_free2) compdestroy.c:25:9: Only storage *(x->ips) (type oip) derived from released storage is not released (memory leak): x->ips Finished checking --- 1 code warning, as expected compdestroy.c: (in function sip_free) compdestroy.c:19:9: Only storage x->ips[] (type oip) derived from released storage may not have been released: x->ips compdestroy.c: (in function sip_free2) compdestroy.c:25:9: Only storage *(x->ips) (type oip) derived from released storage is not released (memory leak): x->ips Finished checking --- 2 code warnings, as expected compdestroy.c: (in function sip_free) compdestroy.c:16:13: Possibly dead storage x->ips[] passed as out parameter: x->ips[i] compdestroy.c:15:13: Storage x->ips[] possibly released compdestroy.c:19:9: Only storage x->ips[] (type oip) derived from released storage may not have been released: x->ips compdestroy.c: (in function sip_free2) compdestroy.c:25:9: Only storage *(x->ips) (type oip) derived from released storage is not released (memory leak): x->ips Finished checking --- 3 code warnings, as expected compdestroy.c: (in function sip_free) compdestroy.c:16:13: Possibly dead storage x->ips[] passed as out parameter: x->ips[i] compdestroy.c:15:13: Storage x->ips[] possibly released compdestroy.c:19:9: Only storage x->ips[] (type oip) derived from released storage may not have been released: x->ips compdestroy.c:15:13: Possible out-of-bounds read: x->ips[i] Unable to resolve constraint: requires maxRead(x->ips @ compdestroy.c:15:13) >= i @ compdestroy.c:15:20 needed to satisfy precondition: requires maxRead(x->ips @ compdestroy.c:15:13) >= i @ compdestroy.c:15:20 compdestroy.c: (in function sip_free2) compdestroy.c:25:9: Only storage *(x->ips) (type oip) derived from released storage is not released (memory leak): x->ips Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/constannot.expect0000644021234200000250000000122607671271606016037 0ustar fax constannot.c: (in function foo2) constannot.c:11:3: Possible out-of-bounds store: str[20] Unable to resolve constraint: requires maxSet(str @ constannot.c:11:3) >= 20 needed to satisfy precondition: requires maxSet(str @ constannot.c:11:3) >= 20 constannot.c: (in function foo3) constannot.c:20:3: Likely out-of-bounds store: foo(buf) Unable to resolve constraint: requires <= 19 needed to satisfy precondition: requires maxSet(buf @ constannot.c:20:8) >= derived from foo precondition: requires maxSet() >= Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/controldepth.expect0000644021234200000250000000114007415132350016335 0ustar fax controldepth.c: (in function f) controldepth.c:8:15: Maximum control nesting depth (2) exceeded Maximum number of control levels exceeded. (Use -controlnestdepth to inhibit warning) controldepth.c:15:17: Maximum control nesting depth (2) exceeded Finished checking --- 2 code warnings, as expected controldepth.c: (in function f) controldepth.c:6:15: Maximum control nesting depth (1) exceeded Maximum number of control levels exceeded. (Use -controlnestdepth to inhibit warning) controldepth.c:11:13: Maximum control nesting depth (1) exceeded Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/csyntax.expect0000644021234200000250000000167207142107126015333 0ustar faxcsyntax.c:20:5: Function main declared with 1 arg, should have 2 (int argc, char *argv[]) csyntax2.c: (in function mapping_create) csyntax2.c:13:3: Assignment of size_t to int: x = sizeof((t)) csyntax2.c:14:3: Assignment of size_t to int: x = sizeof(*t) csyntax3.c:3:4: Function main declared to return a1, should return int csyntax13.c: (in function f) csyntax13.c:9:11: Variable isrs shadows outer declaration csyntax13.c:7:9: Previous definition of isrs: isr_t csyntax16.c: (in function main) csyntax16.c:18:11: Variable getbuiltout used before definition csyntax16.c: (in function getbuiltout) csyntax16.c:43:14: Variable qpolygon used before definition csyntax17.c: (in function f) csyntax17.c:11:11: Variable x initialized to type EID_UNIT_NUM, expects int: (EID_UNIT_NUM)3 csyntax17.c:12:2: Path with no return in function declared to return int csyntax17.c:11:7: Variable x declared but not used splint-3.1.2.dfsg1/test/czechnames.expect0000644021234200000250000000443407415132350015761 0ustar fax Finished checking --- no warnings czechnames.c:5:5: Variable michelob_light name violates Czech naming convention. Czech prefix michelob is not the name of a type. Variable name is not consistent with Czech naming convention. (Use either -czechvars or -namechecks to inhibit warning) czechnames.c:26:5: Function budweiser name is not consistent with Czech naming convention. Accessible types: pivo Function or iterator name is not consistent with Czech naming convention. (Use either -czechfcns or -namechecks to inhibit warning) Finished checking --- 2 code warnings, as expected czechnames.c:26:5: Function budweiser name is not consistent with Czech naming convention. Accessible types: pivo Function or iterator name is not consistent with Czech naming convention. (Use either -czechfcns or -namechecks to inhibit warning) Finished checking --- 1 code warning, as expected czechnames.c:4:5: Variable pivo_pyet name violates Czech naming convention. Czech prefix pivo names an abstract type that is not accessible. Use +accessczech to allow access to type in functions named _. czechnames.c:5:5: Variable michelob_light name violates Czech naming convention. Czech prefix michelob is not the name of a type. Variable name is not consistent with Czech naming convention. (Use either -czechvars or -namechecks to inhibit warning) czechnames.c:8:17: Constant pivo_devenast name violates Czech naming convention. Czech prefix pivo names an abstract type that is not accessible. Use +accessczech to allow access to type in functions named _. czechnames.c:11:6: Function pivo_yedno name violates Czech naming convention. Czech prefix pivo names an abstract type that is not accessible. Use +accessczech to allow access to type in functions named _. czechnames.c: (in function pivo_yedno) czechnames.c:15:11: Left operand of == is abstract type (pivo): p == 1 An abstraction barrier is broken. If necessary, use /*@access @*/ to allow access to an abstract type. (Use -abstract to inhibit warning) czechnames.c:26:5: Function budweiser name is not consistent with Czech naming convention. Accessible types: pivo Finished checking --- 6 code warnings, as expected splint-3.1.2.dfsg1/test/czechoslovaknames.expect0000644021234200000250000000225607415132350017360 0ustar fax czechnames.c:26:5: Function budweiser name is not consistent with Czechoslovak naming convention. Function name is not consistent with Czechoslovak naming convention. (Use either -czechoslovakfcns or -namechecks to inhibit warning) Finished checking --- 1 code warning, as expected slovaknames.c:32:5: Function budweiser name is not consistent with Czechoslovak naming convention. Function name is not consistent with Czechoslovak naming convention. (Use either -czechoslovakfcns or -namechecks to inhibit warning) Finished checking --- 1 code warning, as expected slovaknames.c:5:5: Variable michelobLight name violates Slovak naming convention. Slovak prefix michelob is not the name of a type. Variable name is not consistent with Slovak naming convention. (Use either -slovakvars or -namechecks to inhibit warning) slovaknames.c:32:5: Function budweiser name is not consistent with Czechoslovak naming convention. Function name is not consistent with Czechoslovak naming convention. (Use either -czechoslovakfcns or -namechecks to inhibit warning) Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/db1.expect0000644021234200000250000010776007577744773014350 0ustar fax employee.c: (in function employee_equal) employee.c:25: Function strncmp expects arg 3 to be size_t gets int: maxEmployeeName employee.c: (in function employee_sprint) employee.c:33: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf empset.c: (in function empset_insert) empset.c:28: Variable er declared but not used empset.c: (in function empset_disjointUnion) empset.c:85: Undocumented modification of s1 possible from call to erc_iterStart (through alias s2): erc_iterStart(s2) empset.c:85: Undocumented modification of s2 possible from call to erc_iterStart: erc_iterStart(s2) empset.c: (in function empset_union) empset.c:108: Undocumented modification of s2 possible from call to erc_iterStart (through alias s1): erc_iterStart(s1) empset.c:108: Undocumented modification of s1 possible from call to erc_iterStart: erc_iterStart(s1) empset.c: (in function empset_subset) empset.c:139: Undocumented modification of s1 possible from call to erc_iterStart: erc_iterStart(s1) empset.c:135: Variable e declared but not used ereftab.c: (in function ereftab_lookup) ereftab.c:34: Undocumented modification of t possible from call to erc_iterStart: erc_iterStart(t) erc.c: (in function erc_sprint) erc.c:141: Function malloc expects arg 1 to be size_t gets int: erc_size(c) * (employeePrintSize + 1) + 1 erc.c:151: Undocumented modification of c possible from call to erc_iterStart: erc_iterStart(c) dbase.c: (in function query) dbase.c:210: Variable er declared but not used dbase.c:211: Variable e declared but not used drive.c: (in function main) drive.c:47: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:63: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:81: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:118: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:123: Return value (type db_status) ignored: hire(e) Finished checking --- 19 code warnings, as expected employee.h:2: Name EMPLOYEE_H is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) eref.h:2: Name EREF_H is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) empset.h:2: Name EMPSET_H is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) erc.h:2: Name ERC_H is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) ereftab.h:4: Name EREFTAB_H is reserved for future library extensions. Macros beginning with E and a digit or uppercase letter may be added to . (ISO99:7.26.3) bool.h:20: Modifies list for bool_initMod uses global internal state, not included in globals list. bool.h:20: Declaration of bool_initMod employee.h:12: Declaration parameter has name: p_e employee.c:5: Definition parameter name e does not match name of corresponding parameter in declaration: p_e employee.h:12: Previous declaration of p_e employee.c: (in function employee_setName) employee.c:12: Undefined storage e->name corresponds to storage listed in sets clause This sub-reference is undefined: *(e->name) employee.c:12: Body of if statement is not a block: return FALSE employee.c:15: Parameter 1 (e->name) to function strcpy is declared unique but may be aliased externally by parameter 2 (na) employee.c: (in function employee_equal) employee.c:25: Function strncmp expects arg 3 to be size_t gets int: maxEmployeeName employee.c: (in function employee_sprint) employee.c:30: Read-only string literal storage used as initial value for unqualified storage: gender[0] = "male" employee.c:30: Read-only string literal storage used as initial value for unqualified storage: gender[1] = "female" employee.c:30: Read-only string literal storage used as initial value for unqualified storage: gender[2] = "?" employee.c:31: Read-only string literal storage used as initial value for unqualified storage: jobs[0] = "manager" employee.c:31: Read-only string literal storage used as initial value for unqualified storage: jobs[1] = "non-manager" employee.c:31: Read-only string literal storage used as initial value for unqualified storage: jobs[2] = "?" employee.c:33: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf employee.c:34: Array fetch using non-integer, gender: gender[e.gen] employee.c:34: Array fetch using non-integer, job: jobs[e.j] employee.h: (in macro employee_initMod) employee.h:15: Called procedure bool_initMod may access internal state, but globals list does not include globals internalState employee.h:15: Undocumented modification of internal state possible from call to bool_initMod: bool_initMod() eref.h:9: Constant exported, but not specified: used eref.h:9: Constant exported, but not specified: avail eref.h:9: Type exported, but not specified: eref_status eref.h:14: Type exported, but not specified: eref_ERP eref.h:17: Variable exported, but not specified: eref_Pool eref.c: (in function eref_alloc) eref.c:12: Undocumented use of global eref_Pool eref.c:12: Undocumented use of global eref_Pool eref.c:12: Body of for statement is empty eref.c:12: Undocumented use of global eref_Pool (in post loop test) eref.c:16: Undocumented use of global eref_Pool eref.c:18: Undocumented use of global eref_Pool eref.c:19: Undocumented use of global eref_Pool eref.c:20: Undocumented use of global eref_Pool eref.c:20: Parameter to sizeof is type employee: sizeof(employee) eref.c:19: Undocumented modification of *(eref_Pool.conts) possible from call to realloc: realloc(eref_Pool.conts, 2 * eref_Pool.size * sizeof(employee)) eref.c:18: Undocumented modification of eref_Pool.conts: eref_Pool.conts = (employee *)realloc(eref_Pool.conts, 2 * eref_Pool.size * sizeof(employee)) eref.c:22: Undocumented use of global eref_Pool eref.c:25: Argument to exit has implementation defined behavior: 1 eref.c:28: Undocumented use of global eref_Pool eref.c:29: Undocumented use of global eref_Pool eref.c:30: Undocumented use of global eref_Pool eref.c:30: Parameter to sizeof is type eref_status: sizeof(eref_status) eref.c:29: Undocumented modification of *(eref_Pool.status) possible from call to realloc: realloc(eref_Pool.status, 2 * eref_Pool.size * sizeof(eref_status)) eref.c:28: Undocumented modification of eref_Pool.status: eref_Pool.status = (eref_status *)realloc(eref_Pool.status, 2 * eref_Pool.size * sizeof(eref_status)) eref.c:32: Undocumented use of global eref_Pool eref.c:35: Argument to exit has implementation defined behavior: 1 eref.c:38: Undocumented use of global eref_Pool eref.c:38: Undocumented use of global eref_Pool eref.c:38: Undocumented modification of eref_Pool.size: eref_Pool.size = 2 * eref_Pool.size eref.c:40: Undocumented use of global eref_Pool eref.c:41: Undocumented use of global eref_Pool eref.c:41: Undocumented modification of eref_Pool.status[]: eref_Pool.status[i] = avail eref.c:41: Body of for statement is not a block: eref_Pool.status[i] = avail; eref.c:41: Undocumented use of global eref_Pool (in post loop test) eref.c:44: Undocumented use of global eref_Pool eref.c:44: Undocumented modification of eref_Pool.status[]: eref_Pool.status[res] = used eref.c: (in function eref_initMod) eref.c:53: Undocumented use of file static needsInit eref.c:58: Undocumented use of file static needsInit eref.c:58: Undocumented modification of needsInit: needsInit = FALSE eref.c:60: Statement has no effect: employee_initMod() eref.c:62: Undocumented use of global eref_Pool eref.c:62: Parameter to sizeof is type employee: sizeof(employee) eref.c:62: Undocumented modification of eref_Pool.conts: eref_Pool.conts = (employee *)malloc(size * sizeof(employee)) eref.c:62: Implicitly only storage eref_Pool.conts (type employee *) not released before assignment: eref_Pool.conts = (employee *)malloc(size * sizeof(employee)) eref.c:64: Undocumented use of global eref_Pool eref.c:67: Argument to exit has implementation defined behavior: 1 eref.c:70: Undocumented use of global eref_Pool eref.c:70: Parameter to sizeof is type eref_status: sizeof(eref_status) eref.c:70: Undocumented modification of eref_Pool.status: eref_Pool.status = (eref_status *)malloc(size * sizeof(eref_status)) eref.c:70: Implicitly only storage eref_Pool.status (type eref_status *) not released before assignment: eref_Pool.status = (eref_status *)malloc(size * sizeof(eref_status)) eref.c:72: Undocumented use of global eref_Pool eref.c:75: Argument to exit has implementation defined behavior: 1 eref.c:78: Undocumented use of global eref_Pool eref.c:78: Undocumented modification of eref_Pool.size: eref_Pool.size = size eref.c:82: Undocumented use of global eref_Pool eref.c:82: Undocumented modification of eref_Pool.status[]: eref_Pool.status[i] = avail eref.c:84: Global storage *(eref_Pool.conts) contains 5 undefined fields when call returns: ssNum, name, salary, gen, j eref.c:84: Global storage eref_Pool contains 1 undefined field when call returns: status eref.h: (in macro eref_free) eref.h:23: Undocumented use of global eref_Pool eref.h:23: Undocumented modification of eref_Pool.status[]: eref_Pool.status[er] = avail eref.h: (in macro eref_assign) eref.h:24: Undocumented use of global eref_Pool eref.h:24: Macro parameter used without parentheses: e eref.h:24: Undocumented modification of eref_Pool.conts[]: eref_Pool.conts[er] = e eref.h: (in macro eref_get) eref.h:25: Undocumented use of global eref_Pool eref.h: (in macro eref_equal) eref.h:26: Macro parameter used without parentheses: er1 eref.h:26: Macro parameter used without parentheses: er2 erc.h:6: Name _elem is in the implementation name space (any identifier beginning with underscore) erc.h:6: Type exported, but not specified: ercElem erc.h:7: Type exported, but not specified: ercList erc.h:8: Type exported, but not specified: ercInfo empset.h:10: Variable exported, but not specified: known empset.c:5: Name _empset_get is in the implementation name space (any identifier beginning with underscore) empset.c: (in function _empset_get) empset.c:11: Undocumented modification of s possible from call to erc_iterStart: erc_iterStart(s) empset.c:15: Body of if statement is not a block: do { { erc_iterFinal(it); return er } } while (FALSE); empset.c: (in function empset_insert) empset.c:30: Undetected modification possible from call to unconstrained function _empset_get: _empset_get empset.c:28: Variable er declared but not used empset.c: (in function empset_insertUnique) empset.c:43: Undocumented use of global known empset.c:49: Undocumented use of global known empset.c:49: Undocumented modification of known possible from call to ereftab_insert: ereftab_insert(known, e, er) empset.c: (in function empset_delete) empset.c:59: Undetected modification possible from call to unconstrained function _empset_get: _empset_get empset.c: (in function empset_disjointUnion) empset.c:85: Undocumented modification of s1 possible from call to erc_iterStart (through alias s2): erc_iterStart(s2) empset.c:85: Undocumented modification of s2 possible from call to erc_iterStart: erc_iterStart(s2) empset.c:86: Body of for statement is not a block: empset_insertUnique(result, eref_get(er)); empset.c: (in function empset_union) empset.c:108: Undocumented modification of s2 possible from call to erc_iterStart (through alias s1): erc_iterStart(s1) empset.c:108: Undocumented modification of s1 possible from call to erc_iterStart: erc_iterStart(s1) empset.c:110: Body of if statement is not a block: erc_insert(result, er); empset.c:109: Body of for statement is not a block: if (!empset_member(eref_get(er), s2)) erc_insert(result, er); empset.c: (in function empset_intersect) empset.c:125: Body of if statement is not a block: erc_insert(toDelete, er); empset.c:124: Body of for statement is not a block: if (!empset_member(eref_get(er), s2)) erc_insert(toDelete, er); empset.c:128: Return value (type bool) ignored: erc_delete(s1, er) empset.c:128: Body of for statement is not a block: erc_delete(s1, er); empset.c: (in function empset_subset) empset.c:139: Undocumented modification of s1 possible from call to erc_iterStart: erc_iterStart(s1) empset.c:141: Body of if statement is not a block: do { { erc_iterFinal(it); return FALSE } } while (FALSE); empset.c:140: Body of for statement is not a block: if (!empset_member(eref_get(er), s2)) do { { erc_iterFinal(it); return FALSE } } while (FALSE); empset.c:135: Variable e declared but not used empset.c: (in function empset_initMod) empset.c:148: Undocumented use of file static initDone empset.c:148: Body of if statement is not a block: return empset.c:151: Statement has no effect: employee_initMod() empset.c:153: Statement has no effect: erc_initMod() empset.c:154: Statement has no effect: ereftab_initMod() empset.c:155: Undocumented use of global known empset.c:155: Undocumented modification of known: known = ereftab_create() empset.c:156: Undocumented use of file static initDone empset.c:156: Undocumented modification of initDone: initDone = TRUE empset.h: (in macro empset_member) empset.h:30: Undetected modification possible from call to unconstrained function _empset_get: _empset_get ereftab.c: (in function ereftab_delete) ereftab.c:24: Return value (type bool) ignored: erc_delete(t, er) ereftab.c: (in function ereftab_lookup) ereftab.c:34: Undocumented modification of t possible from call to erc_iterStart: erc_iterStart(t) ereftab.c:37: Body of if statement is not a block: return er ereftab.c: (in function ereftab_initMod) ereftab.c:47: Statement has no effect: erc_initMod() erc.c: (in function erc_create) erc.c:8: Parameter to sizeof is type ercInfo: sizeof(ercInfo) erc.c:13: Argument to exit has implementation defined behavior: 1 erc.c:18: Null storage c->vals derivable from return value: c erc.c:16: Storage c->vals becomes null erc.c:18: Fresh storage returned as unqualified (should be only): c erc.c:8: Fresh storage c created erc.c: (in function erc_clear) erc.c:34: Function returns with null storage derivable from parameter c->vals erc.c:32: Storage c->vals becomes null erc.c: (in function erc_final) erc.c:39: Implicitly temp storage c passed as only param: free (c) erc.c: (in function erc_member) erc.c:47: Object equality comparison (==) on objects of abstract type (eref): tmpc->val == er erc.c:47: Body of if statement is not a block: return TRUE erc.c:47: Body of for statement is not a block: if (tmpc->val == er) return TRUE erc.c: (in function erc_insert) erc.c:55: Parameter to sizeof is type ercElem: sizeof(ercElem) erc.c:60: Argument to exit has implementation defined behavior: 1 erc.c: (in function erc_delete) erc.c:78: Object equality comparison (==) on objects of abstract type (eref): elem->val == er erc.c:83: Implicitly only storage prev->next (type struct _elem *) not released before assignment: prev->next = elem->next erc.c:84: Clauses exit with elem referencing implicitly only storage in true branch, local storage in false branch erc.c:81: Storage elem becomes implicitly only (through alias c->vals) erc.c:87: Released storage c->vals reachable from parameter at return point erc.c:85: Storage c->vals released erc.c: (in function erc_iterStart) erc.c:98: Parameter to sizeof is type ercList: sizeof(ercList) erc.c:103: Argument to exit has implementation defined behavior: 1 erc.c:107: Fresh storage returned as unqualified (should be only): result erc.c:98: Fresh storage result created erc.c:108: Suspect object listed in modifies of erc_iterStart not modified: c erc.lcl:49: Specification of erc_iterStart erc.c: (in function erc_yield) erc.c:117: Implicitly temp storage it passed as only param: free (it) erc.c:117: Unreachable code: free(it) erc.c:118: Variable it is released in true branch, but live in continuation. erc.c:118: in true branch: erc.c:117: Storage it released erc.c:121: Only storage *it->next assigned to unqualified: *(it) = (*it)->next erc.c: (in function erc_join) erc.c:130: Body of for statement is not a block: erc_insert(c1, tmpc->val); erc.c: (in function erc_sprint) erc.c:141: Function malloc expects arg 1 to be size_t gets int: erc_size(c) * (employeePrintSize + 1) + 1 erc.c:146: Argument to exit has implementation defined behavior: 1 erc.c:151: Undocumented modification of c possible from call to erc_iterStart: erc_iterStart(c) erc.c:159: Fresh storage returned as unqualified (should be only): result erc.c:140: Fresh storage result created erc.h: (in macro erc_choose) erc.h:15: Macro parameter used without parentheses: c erc.h: (in macro erc_initMod) erc.h:16: Called procedure bool_initMod may access internal state, but globals list does not include globals internalState erc.h:16: Undocumented modification of internal state possible from call to bool_initMod: bool_initMod() erc.h:16: Statement has no effect: employee_initMod() erc.h: (in macro erc_iterFinal) erc.h:20: Only storage *it->next (type struct _elem *) derived from released storage is not released (memory leak): it erc.h:20: Implicitly temp storage it passed as only param: free (it) dbase.c: (in function db_initMod) dbase.c:21: Undocumented use of global initDone dbase.c:27: Statement has no effect: employee_initMod() dbase.c:29: Statement has no effect: erc_initMod() dbase.c:30: Statement has no effect: empset_initMod() dbase.c:32: Assignment of enum { mMGRS, fMGRS, mNON, fNON } to int: i = mMGRS dbase.c:32: Operands of <= have incompatible types (int, enum { mMGRS, fMGRS, mNON, fNON }): i <= fNON dbase.c:34: Undocumented use of global db dbase.c:34: Undocumented modification of db[]: db[i] = erc_create() dbase.c:32: Incompatible types for <= (int, enum { mMGRS, fMGRS, mNON, fNON }) (in post loop test): i <= fNON dbase.c:37: Undocumented use of global initDone dbase.c:37: Undocumented modification of initDone: initDone = TRUE dbase.c:40: Name _db_ercKeyGet is in the implementation name space (any identifier beginning with underscore) dbase.c: (in function _db_ercKeyGet) dbase.c:45: Undocumented modification of c possible from call to erc_iterStart: erc_iterStart(c) dbase.c:56: Name _db_keyGet is in the implementation name space (any identifier beginning with underscore) dbase.c: (in function _db_keyGet) dbase.c:61: Assignment of enum { mMGRS, fMGRS, mNON, fNON } to int: i = mMGRS dbase.c:61: Operands of <= have incompatible types (int, enum { mMGRS, fMGRS, mNON, fNON }): i <= fNON dbase.c:63: Undocumented use of global db dbase.c:63: Undetected modification possible from call to unconstrained function _db_ercKeyGet: _db_ercKeyGet dbase.c:61: Incompatible types for <= (int, enum { mMGRS, fMGRS, mNON, fNON }) (in post loop test): i <= fNON dbase.c:73: Name _db_addEmpls is in the implementation name space (any identifier beginning with underscore) dbase.c: (in function _db_addEmpls) dbase.c:81: Undocumented modification of c possible from call to erc_iterStart: erc_iterStart(c) dbase.c:86: Undocumented modification of s possible from call to empset_insert: empset_insert(s, e) dbase.c:86: Return value (type bool) ignored: empset_insert(s, e) dbase.c: (in function hire) dbase.c:97: Body of if statement is not a block: return genderERR dbase.c:100: Body of if statement is not a block: return jobERR dbase.c:103: Body of if statement is not a block: return salERR dbase.c:105: Undetected modification possible from call to unconstrained function _db_keyGet: _db_keyGet dbase.c:106: Body of if statement is not a block: return duplERR dbase.c: (in function uncheckedHire) dbase.c:121: Undocumented use of global db dbase.c:121: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mMGRS] dbase.c:121: Undocumented modification of db[] possible from call to erc_insert: erc_insert(db[mMGRS], er) dbase.c:123: Undocumented use of global db dbase.c:123: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mNON] dbase.c:123: Undocumented modification of db[] possible from call to erc_insert: erc_insert(db[mNON], er) dbase.c:121: Body of if clause of if statement is not a block: erc_insert(db[mMGRS], er); dbase.c:123: Body of else clause of if statement is not a block: erc_insert(db[mNON], er); dbase.c:126: Undocumented use of global db dbase.c:126: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fMGRS] dbase.c:126: Undocumented modification of db[] possible from call to erc_insert: erc_insert(db[fMGRS], er) dbase.c:128: Undocumented use of global db dbase.c:128: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fNON] dbase.c:128: Undocumented modification of db[] possible from call to erc_insert: erc_insert(db[fNON], er) dbase.c:126: Body of if clause of if statement is not a block: erc_insert(db[fMGRS], er); dbase.c:128: Body of else clause of if statement is not a block: erc_insert(db[fNON], er); dbase.c:123: Body of if clause of if statement is not a block: if (e.j == MGR) erc_insert(db[mMGRS], er); else erc_insert(db[mNON], er); dbase.c: (in function fire) dbase.c:137: Assignment of enum { mMGRS, fMGRS, mNON, fNON } to int: i = mMGRS dbase.c:137: Operands of <= have incompatible types (int, enum { mMGRS, fMGRS, mNON, fNON }): i <= fNON dbase.c:138: Undocumented use of global db dbase.c:138: Undocumented modification of db[] possible from call to erc_iterStart: erc_iterStart(db[i]) dbase.c:142: Undocumented use of global db dbase.c:142: Undocumented modification of db[] possible from call to erc_delete: erc_delete(db[i], er) dbase.c:142: Return value (type bool) ignored: erc_delete(db[i]... dbase.c:139: Body of for statement is not a block: if (eref_get(er).ssNum == ssNum) { erc_iterFinal(it); erc_delete(db[i], er);; return TRUE } dbase.c:139: Body of for statement is not a block: for (er = erc_yield(it = erc_iterStart(db[i])); !eref_equal(er, erefNIL); er = erc_yield(it)) if (eref_get(er).ssNum == ssNum) { erc_iterFinal(it); erc_delete(db[i], er);; return TRUE } dbase.c:137: Incompatible types for <= (int, enum { mMGRS, fMGRS, mNON, fNON }) (in post loop test): i <= fNON dbase.c: (in function promote) dbase.c:156: Undocumented use of global db dbase.c:156: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mNON] dbase.c:156: Undetected modification possible from call to unconstrained function _db_ercKeyGet: _db_ercKeyGet dbase.c:160: Undocumented use of global db dbase.c:160: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fNON] dbase.c:160: Undetected modification possible from call to unconstrained function _db_ercKeyGet: _db_ercKeyGet dbase.c:162: Body of if statement is not a block: return FALSE dbase.c:172: Undocumented use of global db dbase.c:172: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mNON] dbase.c:172: Undocumented modification of db[] possible from call to erc_delete: erc_delete(db[mNON], er) dbase.c:172: Return value (type bool) ignored: erc_delete(db[mN... dbase.c:173: Undocumented use of global db dbase.c:173: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mMGRS] dbase.c:173: Undocumented modification of db[] possible from call to erc_insert: erc_insert(db[mMGRS], er) dbase.c:177: Undocumented use of global db dbase.c:177: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fNON] dbase.c:177: Undocumented modification of db[] possible from call to erc_delete: erc_delete(db[fNON], er) dbase.c:177: Return value (type bool) ignored: erc_delete(db[fN... dbase.c:178: Undocumented use of global db dbase.c:178: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fMGRS] dbase.c:178: Undocumented modification of db[] possible from call to erc_insert: erc_insert(db[fMGRS], er) dbase.c: (in function setSalary) dbase.c:194: Undetected modification possible from call to unconstrained function _db_keyGet: _db_keyGet dbase.c: (in function query) dbase.c:226: Assignment of enum { mMGRS, fMGRS, mNON, fNON } to int: i = mMGRS dbase.c:226: Operands of <= have incompatible types (int, enum { mMGRS, fMGRS, mNON, fNON }): i <= fNON dbase.c:227: Undocumented use of global db dbase.c:227: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:227: Body of for statement is not a block: numAdded += _db_addEmpls(db[i], l, h, s); dbase.c:226: Incompatible types for <= (int, enum { mMGRS, fMGRS, mNON, fNON }) (in post loop test): i <= fNON dbase.c:230: Undocumented use of global db dbase.c:230: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mMGRS] dbase.c:230: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:231: Undocumented use of global db dbase.c:231: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fMGRS] dbase.c:231: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:234: Undocumented use of global db dbase.c:234: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mNON] dbase.c:234: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:235: Undocumented use of global db dbase.c:235: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fNON] dbase.c:235: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:242: Undocumented use of global db dbase.c:242: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mMGRS] dbase.c:242: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:243: Undocumented use of global db dbase.c:243: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mNON] dbase.c:243: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:246: Undocumented use of global db dbase.c:246: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mMGRS] dbase.c:246: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:248: Undocumented use of global db dbase.c:248: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[mNON] dbase.c:248: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:254: Undocumented use of global db dbase.c:254: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fMGRS] dbase.c:254: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:255: Undocumented use of global db dbase.c:255: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fNON] dbase.c:255: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:258: Undocumented use of global db dbase.c:258: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fMGRS] dbase.c:258: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:260: Undocumented use of global db dbase.c:260: Array fetch using non-integer, enum { mMGRS, fMGRS, mNON, fNON }: db[fNON] dbase.c:260: Undetected modification possible from call to unconstrained function _db_addEmpls: _db_addEmpls dbase.c:210: Variable er declared but not used dbase.c:211: Variable e declared but not used dbase.c:263: Suspect object listed in modifies of query not modified: s dbase.lcl:49: Specification of query dbase.c: (in function db_print) dbase.c:272: Assignment of enum { mMGRS, fMGRS, mNON, fNON } to int: i = mMGRS dbase.c:272: Operands of <= have incompatible types (int, enum { mMGRS, fMGRS, mNON, fNON }): i <= fNON dbase.c:274: Undocumented use of global db dbase.c:272: Incompatible types for <= (int, enum { mMGRS, fMGRS, mNON, fNON }) (in post loop test): i <= fNON drive.c: (in function main) drive.c:22: Statement has no effect: employee_initMod() drive.c:23: Statement has no effect: empset_initMod() drive.c:47: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:48: Return value (type bool) ignored: employee_setName... drive.c:49: Return value (type bool) ignored: empset_insert(em... drive.c:63: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:64: Return value (type bool) ignored: employee_setName... drive.c:65: Return value (type bool) ignored: empset_delete(em... drive.c:81: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:82: Return value (type bool) ignored: employee_setName... drive.c:83: Return value (type bool) ignored: empset_insert(em... drive.c:107: Return value (type bool) ignored: empset_delete(em... drive.c:116: Body of if clause of if statement is not a block: e.gen = MALE; drive.c:116: Body of else clause of if statement is not a block: e.gen = FEMALE; drive.c:117: Body of if clause of if statement is not a block: e.j = NONMGR; drive.c:117: Body of else clause of if statement is not a block: e.j = MGR; drive.c:118: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:119: Return value (type bool) ignored: employee_setName... drive.c:123: Return value (type db_status) ignored: hire(e) drive.c:127: Assignment of db_status to int: j = hire(e) drive.c:131: Variable j used before definition drive.c:134: Return value (type bool) ignored: fire(17) drive.c:158: Return value (type bool) ignored: fire(empset_choo... drive.c:11: Parameter argv not used dbase.c:11: Type employeeKinds declared but not used eref.lh:7: Function exported but not used outside eref: eref_free eref.h:23: Definition of eref_free empset.lh:7: Function exported but not used outside empset: empset_final empset.h:29: Definition of empset_final empset.lh:8: Function exported but not used outside empset: empset_clear empset.c:24: Definition of empset_clear empset.lh:10: Function exported but not used outside empset: empset_insertUnique empset.c:53: Definition of empset_insertUnique empset.lh:16: Function exported but not used outside empset: empset_member empset.h:30: Definition of empset_member empset.lh:17: Function exported but not used outside empset: empset_subset empset.c:144: Definition of empset_subset ereftab.lh:9: Function exported but not used outside ereftab: ereftab_delete ereftab.c:26: Definition of ereftab_delete dbase.c:13: Variable exported but not used outside dbase: db dbase.lh:26: Function exported but not used outside dbase: promote dbase.c:182: Definition of promote dbase.lh:27: Function exported but not used outside dbase: setSalary dbase.c:206: Definition of setSalary empset.h:10: Variable exported but not used outside empset: known dbase.c:15: Variable exported but not used outside dbase: initDone dbase.c:40: Function exported but not used outside dbase: _db_ercKeyGet dbase.c:54: Definition of _db_ercKeyGet dbase.c:56: Function exported but not used outside dbase: _db_keyGet dbase.c:71: Definition of _db_keyGet dbase.c:73: Function exported but not used outside dbase: _db_addEmpls dbase.c:92: Definition of _db_addEmpls dbase.c:13: Variable db exported but not declared in header file empset.c:5: Function _empset_get exported but not declared in header file empset.c:19: Definition of _empset_get dbase.c:15: Variable initDone exported but not declared in header file dbase.c:40: Function _db_ercKeyGet exported but not declared in header file dbase.c:54: Definition of _db_ercKeyGet dbase.c:56: Function _db_keyGet exported but not declared in header file dbase.c:71: Definition of _db_keyGet dbase.c:73: Function _db_addEmpls exported but not declared in header file dbase.c:92: Definition of _db_addEmpls Error Type Reported Suppressed =================== ======== ========= nullret 1 0 nullstate 1 0 usedef 1 0 compdef 3 0 incondefs 0 1 sizeoftype 7 0 formalarray 0 24 abstractcompare 2 0 mustfreeonly 3 0 usereleased 1 0 compdestroy 1 0 branchstate 2 1 onlytrans 1 0 freshtrans 3 0 temptrans 3 2 readonlytrans 6 0 mayaliasunique 1 0 mods 38 0 mustmod 2 0 modfilesys 0 25 modnomods 4 0 moduncon 20 0 modunconnomods 1 0 globs 64 1 internalglobs 2 0 warnmissingglobs 1 6 forempty 1 0 forblock 11 0 ifblock 22 0 unreachable 1 0 noeffect 11 0 retvalother 1 0 retvalbool 16 0 macroparens 4 0 namechecks 11 6 protoparammatch 1 0 exportlocal 15 0 exportheader 4 0 exportheadervar 2 0 paramuse 1 0 typeuse 1 0 varuse 4 0 exitarg 8 0 redecl 0 7 exporttype 5 0 exportvar 2 0 exportconst 2 0 type 1 0 enumindex 24 0 enumint 15 0 matchanyintegral 2 0 bufferoverflowhigh 5 0 ======== ========= Total 338 73 Finished checking --- 338 code warnings, as expected splint-3.1.2.dfsg1/test/db2.expect0000644021234200000250000001353307577744773014343 0ustar fax employee.c: (in function employee_setName) employee.c:17: Parameter 1 (e->name) to function strcpy is declared unique but may be aliased externally by parameter 2 (na) eref.c: (in function eref_alloc) eref.c:19: Unqualified storage eref_Pool.conts passed as only param: realloc (eref_Pool.conts, ...) eref.c:29: Unqualified storage eref_Pool.status passed as only param: realloc (eref_Pool.status, ...) eref.c:45: Storage eref_Pool.status reachable from global is only (should be unqualified) eref.c:29: Storage eref_Pool.status becomes only eref.c:45: Storage eref_Pool.conts reachable from global is only (should be unqualified) eref.c:19: Storage eref_Pool.conts becomes only eref.c: (in function eref_initMod) eref.c:84: Storage eref_Pool.conts reachable from global is fresh (should be unqualified) eref.c:62: Fresh storage eref_Pool.conts created eref.c:84: Global storage *(eref_Pool.conts) contains 5 undefined fields when call returns: ssNum, name, salary, gen, j eref.c:84: Storage eref_Pool.status reachable from global is fresh (should be unqualified) eref.c:70: Fresh storage eref_Pool.status created eref.c:84: Global storage eref_Pool contains 1 undefined field when call returns: status erc.c: (in function erc_create) erc.c:33: Null storage c->vals derivable from return value: c erc.c:31: Storage c->vals becomes null erc.c:33: Fresh storage returned as unqualified (should be only): c erc.c:23: Fresh storage c created erc.c: (in function erc_clear) erc.c:49: Function returns with null storage derivable from parameter c->vals erc.c:47: Storage c->vals becomes null erc.c: (in function erc_final) erc.c:54: Implicitly temp storage c passed as only param: free (c) erc.c: (in function erc_delete) erc.c:102: Released storage c->vals reachable from parameter at return point erc.c:100: Storage c->vals released erc.c: (in function erc_sprint) erc.c:141: Fresh storage returned as unqualified (should be only): result erc.c:122: Fresh storage result created Finished checking --- 15 code warnings, as expected employee.c: (in function employee_setName) employee.c:17: Parameter 1 (e->name) to function strcpy is declared unique but may be aliased externally by parameter 2 (na) eref.c: (in function eref_initMod) eref.c:62: Implicitly only storage eref_Pool.conts (type employee *) not released before assignment: eref_Pool.conts = (employee *)malloc(size * sizeof(employee)) eref.c:70: Implicitly only storage eref_Pool.status (type eref_status *) not released before assignment: eref_Pool.status = (eref_status *)malloc(size * sizeof(eref_status)) eref.c:84: Global storage *(eref_Pool.conts) contains 5 undefined fields when call returns: ssNum, name, salary, gen, j eref.c:84: Global storage eref_Pool contains 1 undefined field when call returns: status empset.c: (in function empset_intersect) empset.c:126: Fresh storage toDelete not released before return empset.c:112: Fresh storage toDelete created erc.c: (in function erc_create) erc.c:33: Null storage c->vals derivable from return value: c erc.c:31: Storage c->vals becomes null erc.c: (in function erc_clear) erc.c:49: Function returns with null storage derivable from parameter c->vals erc.c:47: Storage c->vals becomes null erc.c: (in function erc_final) erc.c:54: Implicitly temp storage c passed as only param: free (c) erc.c: (in function erc_delete) erc.c:98: Implicitly only storage prev->next (type struct _elem *) not released before assignment: prev->next = elem->next erc.c:98: Clauses exit with elem referencing implicitly only storage in true branch, local storage in false branch erc.c:96: Storage elem becomes implicitly only (through alias c->vals) erc.c:102: Released storage c->vals reachable from parameter at return point erc.c:100: Storage c->vals released drive.c: (in function main) drive.c:49: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:65: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:83: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:120: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:124: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:135: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:140: Fresh storage em1 (type empset) not released before assignment: em1 = empset_create() drive.c:35: Fresh storage em1 created drive.c:146: Fresh storage em2 (type empset) not released before assignment: em2 = empset_create() drive.c:74: Fresh storage em2 created drive.c:147: Fresh storage em3 (type empset) not released before assignment: em3 = empset_disjointUnion(em2, em1) drive.c:87: Fresh storage em3 created drive.c:159: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:163: Fresh storage em1 not released before return drive.c:140: Fresh storage em1 created drive.c:163: Fresh storage em2 not released before return drive.c:146: Fresh storage em2 created drive.c:163: Fresh storage em3 not released before return drive.c:147: Fresh storage em3 created Finished checking --- 25 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/db3.expect0000644021234200000250000002241307512352624014314 0ustar fax employee.c: (in function employee_sprint) employee.c:38: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c: (in function main) drive.c:50: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:66: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:84: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:138: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf Error Type Reported Suppressed =================== ======== ========= usedef 0 1 compdef 0 3 incondefs 0 1 formalarray 0 24 modfilesys 0 25 redecl 0 7 exporttype 0 3 bufferoverflowhigh 5 0 ======== ========= Total 5 64 Finished checking --- 5 code warnings, as expected employee.c: (in function employee_sprint) employee.c:38: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf eref.c: (in function eref_alloc) eref.c:36: Called procedure printf may access global stdout eref.c:36: Undocumented modification of *stdout possible from call to printf: printf("Malloc returned null in eref_alloc\n") eref.c:36: Return value (type int) ignored: printf("Malloc r... eref.c:46: Called procedure printf may access global stdout eref.c:46: Undocumented modification of *stdout possible from call to printf: printf("Malloc returned null in eref_alloc\n") eref.c:46: Return value (type int) ignored: printf("Malloc r... eref.c: (in function eref_initMod) eref.c:82: Called procedure printf may access global stdout eref.c:82: Undocumented modification of *stdout possible from call to printf: printf("Malloc returned null in eref_initMod\n") eref.c:82: Return value (type int) ignored: printf("Malloc r... eref.c:90: Called procedure printf may access global stdout eref.c:90: Undocumented modification of *stdout possible from call to printf: printf("Malloc returned null in eref_initMod\n") eref.c:90: Return value (type int) ignored: printf("Malloc r... erc.c: (in function int_toSize) erc.c:11: Undocumented use of global stderr erc.c:11: Undocumented modification of *stderr possible from call to fprintf: fprintf(stderr, "Error: int_toSize failure: %d", x) erc.c:11: Return value (type int) ignored: fprintf(stderr, ... erc.c: (in function erc_create) erc.c:28: Called procedure printf may access global stdout erc.c:28: Undocumented modification of *stdout possible from call to printf: printf("Malloc returned null in erc_create\n") erc.c:28: Return value (type int) ignored: printf("Malloc r... erc.c: (in function erc_insert) erc.c:80: Called procedure printf may access global stdout erc.c:80: Undocumented modification of *stdout possible from call to printf: printf("Malloc returned null in erc_insert\n") erc.c:80: Return value (type int) ignored: printf("Malloc r... erc.c: (in function erc_sprint) erc.c:145: Called procedure printf may access global stdout erc.c:145: Undocumented modification of *stdout possible from call to printf: printf("Malloc returned null in erc_sprint\n") erc.c:145: Return value (type int) ignored: printf("Malloc r... dbase.c: (in function db_print) dbase.c:307: Return value (type int) ignored: printf("Employee... dbase.c:312: Return value (type int) ignored: printf("%s", pri... drive.c: (in function main) drive.c:31: Called procedure printf may access global stdout drive.c:31: Undocumented modification of *stdout possible from call to printf: printf("FormatPos: Wrong number of arguments. Given %d needs 0.\n", argc - 1) drive.c:31: Return value (type int) ignored: printf("FormatPo... drive.c:41: Called procedure printf may access global stdout drive.c:41: Undocumented modification of *stdout possible from call to printf: printf("Size should be 0.\n") drive.c:41: Return value (type int) ignored: printf("Size sho... drive.c:50: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:57: Called procedure printf may access global stdout drive.c:57: Undocumented modification of *stdout possible from call to printf: printf("Size should be 500.\n") drive.c:57: Return value (type int) ignored: printf("Size sho... drive.c:66: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:73: Called procedure printf may access global stdout drive.c:73: Undocumented modification of *stdout possible from call to printf: printf("Size should be 250.\n") drive.c:73: Return value (type int) ignored: printf("Size sho... drive.c:84: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:93: Called procedure printf may access global stdout drive.c:93: Undocumented modification of *stdout possible from call to printf: printf("Size should be 350.\n") drive.c:93: Return value (type int) ignored: printf("Size sho... drive.c:100: Called procedure printf may access global stdout drive.c:100: Undocumented modification of *stdout possible from call to printf: printf("Size should be 350.\n") drive.c:100: Return value (type int) ignored: printf("Size sho... drive.c:103: Called procedure printf may access global stdout drive.c:103: Undocumented modification of *stdout possible from call to printf: printf("Print two different employees:\n") drive.c:103: Return value (type int) ignored: printf("Print tw... drive.c:109: Called procedure printf may access global stdout drive.c:109: Undocumented modification of *stdout possible from call to printf: printf("%s\n", &(na[0])) drive.c:109: Return value (type int) ignored: printf("%s\n", &... drive.c:138: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf drive.c:151: Called procedure printf may access global stdout drive.c:151: Undocumented modification of *stdout possible from call to printf: printf("Should print true: %s\n", bool_unparse(status == DBS_DUPLERR)) drive.c:151: Return value (type int) ignored: printf("Should p... drive.c:154: Called procedure printf may access global stdout drive.c:154: Undocumented modification of *stdout possible from call to printf: printf("Employees 0 - 19\n") drive.c:154: Return value (type int) ignored: printf("Employee... drive.c:155: Called procedure db_print may access global stdout drive.c:155: Undocumented modification of *stdout possible from call to db_print: db_print() drive.c:158: Called procedure printf may access global stdout drive.c:158: Undocumented modification of *stdout possible from call to printf: printf("Employees 0 - 16, 18 - 19\n") drive.c:158: Return value (type int) ignored: printf("Employee... drive.c:159: Called procedure db_print may access global stdout drive.c:159: Undocumented modification of *stdout possible from call to db_print: db_print() drive.c:164: Called procedure printf may access global stdout drive.c:164: Undocumented modification of *stdout possible from call to printf: printf("Should get two females: %d\n%s\n", i, sprintResult) drive.c:164: Return value (type int) ignored: printf("Should g... drive.c:174: Called procedure printf may access global stdout drive.c:174: Undocumented modification of *stdout possible from call to printf: printf("Should get two females and ten males: %d\n%s\n", i, sprintResult) drive.c:174: Return value (type int) ignored: printf("Should g... drive.c:180: Called procedure printf may access global stdout drive.c:180: Undocumented modification of *stdout possible from call to printf: printf("Should get two females: %d\n%s\n", i, sprintResult) drive.c:180: Return value (type int) ignored: printf("Should g... drive.c:184: Called procedure printf may access global stdout drive.c:184: Undocumented modification of *stdout possible from call to printf: printf("Should get 18 employees\n") drive.c:184: Return value (type int) ignored: printf("Should g... drive.c:185: Called procedure db_print may access global stdout drive.c:185: Undocumented modification of *stdout possible from call to db_print: db_print() Error Type Reported Suppressed =================== ======== ========= usedef 0 1 compdef 0 3 incondefs 0 1 formalarray 0 24 mods 26 0 modfilesys 0 25 globs 26 0 retvalint 25 0 redecl 0 7 exporttype 0 3 bufferoverflowhigh 5 0 ======== ========= Total 82 64 Finished checking --- 82 code warnings, as expected splint-3.1.2.dfsg1/test/deadparam.expect0000644021234200000250000000066007577744773015607 0ustar fax deadparam.c: (in function t) deadparam.c:7:6: Dead storage s1 passed as out parameter to f: s1 deadparam.c:6:9: Storage s1 released deadparam.c:10:6: Dead storage s2 passed as special parameter to g: s2 deadparam.c:9:9: Storage s2 released deadparam.c:10:6: Allocated storage s2 corresponds to storage listed in allocates clause of called function: s2 Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/decl.expect0000644021234200000250000000253407671271606014563 0ustar fax decl.c: (in function main) decl.c:7:3: Call to non-function (type [function (int) returns int] **): x decl.c:8:2: Path with no return in function declared to return int Finished checking --- 2 code warnings, as expected decl.c:3:5: Function main declared without parameter list decl.c: (in function main) decl.c:7:3: Call to non-function (type [function (int) returns int] **): x decl.c:8:2: Path with no return in function declared to return int decl.c: (in function foo1) decl.c:13:3: Likely out-of-bounds store: buf[10] Unable to resolve constraint: requires 9 >= 10 needed to satisfy precondition: requires maxSet(buf @ decl.c:13:3) >= 10 decl.c:1:5: Function test declared but not defined decl.c:1:5: Function test exported but not declared in header file Finished checking --- 6 code warnings, as expected decl2.c:3:6: Variable glob2 defined with inconsistent type (arrays and pointers are not identical in variable declarations): int * decl2.h:3:12: Previous declaration of glob2: int [] decl2.c:4:5: Variable glob2 redefined decl2.c:3:6: Previous definition of glob2 decl2.c:6:6: Variable glob3 redeclared with inconsistent type: char decl2.h:4:12: Previous declaration of glob3: int decl2.c:9:5: Variable glob redefined decl2.c:8:5: Previous definition of glob Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/enum.expect0000644021234200000250000000751307413453477014624 0ustar fax enum.c:2:16: Enumerator member cero declared with inconsistent type: enum { cero, uno, dos, tres } enum.lcl:2:16: Specification of cero: enum { cero, uno, dos } enum.c:2:22: Enumerator member uno declared with inconsistent type: enum { cero, uno, dos, tres } enum.lcl:2:22: Specification of uno: enum { cero, uno, dos } enum.c:2:27: Enumerator member dos declared with inconsistent type: enum { cero, uno, dos, tres } enum.lcl:2:27: Specification of dos: enum { cero, uno, dos } enum.c:2:39: Enum stype declared with members { cero, uno, dos, tres } but specified with members { cero, uno, dos } enum.lcl:2:33: Specification of stype enum.c:4:22: Enumerator member siete declared with inconsistent type: enum _itag { siete } enum.lcl:3:23: Specification of siete: enum _ietag { siete } enum.c:6:34: Structure st2 declared with fields { int a; int b; }, specified with fields { int a; int b; int c; } enum.lcl:6:41: Specification of st2 enum.lcl:7:1: Field present in specification, missing in declaration: int c enum.c: (in function f) enum.c:15:7: Value a[] used before definition enum.c:23:6: Missing cases in switch: two, three enum.c:30:12: Case in switch not mtype member: three enum.c:36:8: Missing case in switch: threem enum.c:38:10: Duplicate case in switch: one enum.c:47:2: Path with no return in function declared to return int enum.c:51:8: Enumerator member hasta declared with inconsistent type: enum { hasta, pasta, yummy } enum.lcl:8:8: Specification of hasta: enum { hasta, pasta, yasta } enum.c:51:15: Enumerator member pasta declared with inconsistent type: enum { hasta, pasta, yummy } enum.lcl:8:15: Specification of pasta: enum { hasta, pasta, yasta } enum.lcl:3:9: Enum tag enum _ietag specified but not defined enum.lcl:8:22: Enum member yasta specified but not defined Finished checking --- 16 code warnings, as expected enum.c:2:16: Enumerator member cero declared with inconsistent type: enum { cero, uno, dos, tres } enum.lcl:2:16: Specification of cero: enum { cero, uno, dos } enum.c:2:22: Enumerator member uno declared with inconsistent type: enum { cero, uno, dos, tres } enum.lcl:2:22: Specification of uno: enum { cero, uno, dos } enum.c:2:27: Enumerator member dos declared with inconsistent type: enum { cero, uno, dos, tres } enum.lcl:2:27: Specification of dos: enum { cero, uno, dos } enum.c:2:39: Enum stype declared with members { cero, uno, dos, tres } but specified with members { cero, uno, dos } enum.lcl:2:33: Specification of stype enum.c:4:22: Enumerator member siete declared with inconsistent type: enum _itag { siete } enum.lcl:3:23: Specification of siete: enum _ietag { siete } enum.c:6:34: Structure st2 declared with fields { int a; int b; }, specified with fields { int a; int b; int c; } enum.lcl:6:41: Specification of st2 enum.lcl:7:1: Field present in specification, missing in declaration: int c enum.c: (in function f) enum.c:15:7: Value a[] used before definition enum.c:30:12: Case in switch not mtype member: three enum.c:38:10: Duplicate case in switch: one enum.c:47:2: Path with no return in function declared to return int enum.c:51:8: Enumerator member hasta declared with inconsistent type: enum { hasta, pasta, yummy } enum.lcl:8:8: Specification of hasta: enum { hasta, pasta, yasta } enum.c:51:15: Enumerator member pasta declared with inconsistent type: enum { hasta, pasta, yummy } enum.lcl:8:15: Specification of pasta: enum { hasta, pasta, yasta } enum.lcl:3:9: Enum tag enum _ietag specified but not defined enum.lcl:8:22: Enum member yasta specified but not defined Finished checking --- 14 code warnings, as expected splint-3.1.2.dfsg1/test/enumtag.expect0000644021234200000250000000053207475757012015312 0ustar fax enumtag.c:35:6: Enum tag enum e_tag defined more than once enumtag.c:12:6: Previous definition of enum e_tag enumtag.c:35:6: Enum enum e_tag declared with members { E_M } but previously declared with members { E_X, E_Y, E_Z } enumtag.c:12:6: Declaration of enum e_tag Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/exports.expect0000644021234200000250000000137407475757012015363 0ustar fax Command Line: Setting +typeuse redundant with current value exports.h:1:13: Type exported, but not specified: myint exports.h:3:12: Variable exported, but not specified: glob exports.h:5:12: Function exported, but not specified: f exports.h:1:13: Type myint declared but not used exports.h:3:12: Variable glob declared but not used exports.c:3:5: Definition of glob exports.h:5:12: Function f declared but not used exports.c:8:1: Definition of f Finished checking --- 6 code warnings, as expected exports.h:1:13: Type exported, but not specified: myint exports.h:3:12: Variable exported, but not specified: glob exports.h:5:12: Function exported, but not specified: f Finished checking --- 3 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/external.expect0000644021234200000250000000515707512352624015474 0ustar fax Finished checking --- no warnings external.c:2:5: External identifier Func is not distinguishable from func in the first 6 characters because alphabetical case is ignored external.c:1:5: Declaration of func external.c:8:5: External identifier longfunction2 is not distinguishable from longfunction1 in the first 6 characters (longfu) external.c:7:5: Declaration of longfunction1 Finished checking --- 2 code warnings, as expected external.c:2:5: External identifier Func is not distinguishable from func in the first 3 characters because alphabetical case is ignored external.c:1:5: Declaration of func external.c:5:5: External identifier small2 is not distinguishable from small1 in the first 3 characters (sma) external.c:4:5: Declaration of small1 external.c:8:5: External identifier longfunction2 is not distinguishable from longfunction1 in the first 3 characters (lon) external.c:7:5: Declaration of longfunction1 Finished checking --- 3 code warnings, as expected external.c:2:5: External identifier Func is not distinguishable from func in the first 3 characters because alphabetical case is ignored external.c:1:5: Declaration of func external.c:5:5: External identifier small2 is not distinguishable from small1 in the first 3 characters (sma) external.c:4:5: Declaration of small1 external.c:8:5: External identifier longfunction2 is not distinguishable from longfunction1 in the first 3 characters (lon) external.c:7:5: Declaration of longfunction1 Finished checking --- 3 code warnings, as expected external.c:2:5: External identifier Func is not distinguishable from func in the first 3 characters because alphabetical case is ignored external.c:1:5: Declaration of func external.c:5:5: External identifier small2 is not distinguishable from small1 in the first 3 characters (sma) external.c:4:5: Declaration of small1 external.c:7:5: External identifier longfunction1 is not distinguishable from LONG_MAX in the first 3 characters because alphabetical case is ignored load file standard.lcd: Specification of LONG_MAX One or more additional indistinguishable external names not reported external.c:8:5: External identifier longfunction2 is not distinguishable from LONG_MAX in the first 3 characters because alphabetical case is ignored load file standard.lcd: Specification of LONG_MAX One or more additional indistinguishable external names not reported Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/decl2.h0000644021234200000250000000011007121317331013552 0ustar faxextern int glob; extern int glob; extern int glob2[]; extern int glob3; splint-3.1.2.dfsg1/test/fields.expect0000644021234200000250000000361107577744773015136 0ustar fax fields.c: (in function pair_create1) fields.c:37:10: Storage p->z reachable from return value is owned (should be dependent) fields.c:34:3: Storage p->z becomes owned (through alias p->y) fields.c: (in function mangle) fields.c:43:2: Released storage p->x reachable from parameter at return point fields.c:42:9: Storage p->x released fields.c: (in function mangle2) fields.c:49:2: Storage p->y reachable from parameter is dependent (should be owned) fields.c:48:3: Storage p->y becomes dependent fields.c: (in function mangle3) fields.c:55:10: Storage p->y reachable from return value is dependent (should be owned) fields.c:54:3: Storage p->y becomes dependent fields.c: (in function f) fields.c:60:3: Owned storage p->x (type int *) not released before assignment: p->x = NULL fields.c:62:18: Function returns with null storage derivable from parameter p->x fields.c:60:10: Storage p->x becomes null Finished checking --- 6 code warnings, as expected fields2.c: (in function pair_copy) fields2.c:21:16: Storage p->x reachable from parameter is kept (should be implicitly only) fields2.c:17:3: Storage p->x becomes kept fields2.c:21:16: Storage p->y reachable from parameter is kept (should be implicitly only) fields2.c:18:3: Storage p->y becomes kept fields2.c: (in function pair_create) fields2.c:30:3: Only storage p->y assigned to dependent: p->z = p->y fields2.c:35:10: Storage p->y reachable from return value is unqualified (should be implicitly only) fields2.c: (in function pair_swankle) fields2.c:43:14: Storage p->x reachable from passed parameter is kept (should be implicitly only): p fields2.c:42:3: Storage p->x becomes kept Finished checking --- 5 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/fileio.expect0000644021234200000250000000236007413453477015122 0ustar fax filerw.c: (in function f) filerw.c:6:14: Invalid transfer from rw_write f2 to rw_read (Must reset file between write and read.): fgetc(..., f2, ...) filerw.c:1:72: f2 becomes rw_write filerw.xh:3:38: f1 becomes rw_read filerw.c:8:22: Invalid transfer from rw_read f1 to rw_write (Must reset file between read and write.): fputc(..., f1, ...) filerw.c:1:39: f1 becomes rw_read filerw.xh:4:44: f1 becomes rw_write filerw.c:12:14: Invalid transfer from rw_write f1 to rw_read (Must reset file between write and read.): fgetc(..., f1, ...) filerw.c:10:22: f1 becomes rw_write filerw.xh:3:38: f1 becomes rw_read Finished checking --- 3 code warnings, as expected file.c: (in function f) file.c:14:5: Control branches merge with incompatible states for fout (closed and open) file.c:3:27: fout becomes implicitly open file.c:13:14: fout becomes closed file.c:23:5: Control branches merge with incompatible states for fin (closed and open) file.c:3:16: fin becomes implicitly open file.c:22:14: fin becomes closed file.c:25:10: Variable res used before definition Finished checking --- 3 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/flags.expect0000644021234200000250000000226507475757012014753 0ustar fax flags.c:1:9: Variable x initialized to type char, expects int: 'c' flags.c:5:9: Variable y initialized to type char, expects int: 'c' flags.c:7:18: Value for linelen must be at least 20 (given 13) flags.c:11:5: Internal identifier xx2 is not distinguishable from xx1 in the first 2 characters (xx) flags.c:10:5: Declaration of xx1 flags.c:13:4: Semantic comment attempts to restore flag linelen. A flag for setting a value cannot be restored. flags.c:15:4: Semantic comment attempts to set global flag dump. A global flag cannot be set locally. flags.c:16:22: Flag macrovarprefix (in semantic comment) must be followed by an argument flags.c:17:26: Flag macrovarprefix (in semantic comment) must be followed by an argument flags.c:18:20: Flag linelen must be followed by a positive number number. Followed by asdf Finished checking --- 8 code warnings, as expected flags.c:1:9: Variable x initialized to type char, expects int: 'c' flags.c:5:9: Variable y initialized to type char, expects int: 'c' Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/for.expect0000644021234200000250000000043107671271606014434 0ustar fax for.c: (in function f) for.c:13:5: Possible out-of-bounds store: t[i] Unable to resolve constraint: requires i @ for.c:13:7 <= 10 needed to satisfy precondition: requires maxSet(t @ for.c:13:5) >= i @ for.c:13:7 Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/forbody.expect0000644021234200000250000000033207413453477015314 0ustar fax forbody.c: (in iter genericTable_elements) forbody.c:3:50: Unrecognized identifier in macro definition: m_ind forbody.c:3:115: Assignment of char to int: m_el = 'a' Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/format.expect0000644021234200000250000000064407413453477015146 0ustar fax format.c: (in function fn) format.c:3:3: Format string parameter to printf is not a compile-time constant: fmt format.c:5:3: Format string parameter to fprintf is not a compile-time constant: fmt format.c:6:3: Format string parameter to fprintf is not a compile-time constant: fmt Finished checking --- 3 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/freearray.expect0000644021234200000250000000036007413453477015631 0ustar fax freearray.c: (in function destroyMod2) freearray.c:22:9: Only storage *stringTable (type ocp) derived from released storage is not released (memory leak): stringTable Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/funcpointer.expect0000644021234200000250000000332507413453477016211 0ustar fax funcpointer.c: (in function func2) funcpointer.c:13:27: Possibly null storage returned as non-null: (int *)malloc(sizeof(int)) funcpointer.c:13:27: Returned storage not completely defined (storage pointed to by [result of malloc] is undefined): (int *)malloc(sizeof(int)) funcpointer.c: (in function func5) funcpointer.c:19:28: Immediate address &i returned as implicitly only: &i funcpointer.c: (in function main) funcpointer.c:28:3: Assignment of [function (void) returns int] to f1: t1 = func1 funcpointer.c:29:3: Assignment of [function (void) returns int ***] to f1: t1 = func4 funcpointer.c:33:3: Assignment of [function (void) returns int *] to f2: t2 = func2 funcpointer.c:36:3: Assignment of [function (void) returns int **] to f3 *: t3p = func3 funcpointer.c:38:3: Assignment of [function (void) returns int *] to f4 *: t4 = func2 funcpointer.c:41:7: Call to non-function (type f1): (t1) funcpointer.c:43:3: Assignment of int *** to int *: xp = (*t1)() funcpointer.c:44:8: Call to non-function (type f4 *): (t4) funcpointer.c:46:3: Assignment of [function (void) returns int] to f6: t6 = func1 funcpointer.c:46:3: Invalid left-hand side of assignment (function type f6): t6 funcpointer.c:47:3: Invalid left-hand side of assignment (function type f6): t6 funcpointer.c:48:10: Function (t6) called with 0 args, expects 2 funcpointer.c:49:10: Function (t6) called with 1 args, expects 2 funcpointer.c:50:11: Function (t6) called with 1 args, expects 2 funcpointer.c:50:10: Function ((t6)(3)) called with 0 args, expects 1 Finished checking --- 18 code warnings, as expected splint-3.1.2.dfsg1/test/glob.expect0000644021234200000250000000212207413453477014572 0ustar fax glob.c: (in function useGlob) glob.lcl:3: Global z listed but not used glob.c: (in function dontuseGlob) glob.c:13:11: Undocumented use of global x glob.c: (in function callsUseGlob) glob.c:23:11: Called procedure useGlob may access global y glob.c:23:11: Called procedure useGlob may access global z Finished checking --- 4 code warnings, as expected glob.c: (in function dontuseGlob) glob.c:13:11: Undocumented use of global x glob.c: (in function callsUseGlob) glob.c:23:11: Called procedure useGlob may access global y glob.c:23:11: Called procedure useGlob may access global z Finished checking --- 3 code warnings, as expected glob.c: (in function useGlob) glob.lcl:3: Global z listed but not used glob.c: (in function dontuseGlob) glob.c:13:11: Undocumented use of global x glob.c: (in function unspec) glob.c:18:11: Undocumented use of global y glob.c:18:15: Undocumented use of global z glob.c: (in function callsUseGlob) glob.c:23:11: Called procedure useGlob may access global y glob.c:23:11: Called procedure useGlob may access global z Finished checking --- 6 code warnings, as expected splint-3.1.2.dfsg1/test/globalbufferannotation.expect0000644021234200000250000000004307413453477020374 0ustar fax Finished checking --- no warnings splint-3.1.2.dfsg1/test/globals.expect0000644021234200000250000000474307413453477015305 0ustar fax globals.c:5:41: Redundant checked qualifier on doubled globals.c:6:46: Contradictory checked and unchecked qualifiers on contradict globals.c: (in function noglobs) globals.c:13:3: Undocumented use of global checkstrict globals.c: (in function specglobs) globals.c:19:3: Undocumented use of global check globals.c:21:3: Undocumented use of global checkstrict Finished checking --- 5 code warnings, as expected globals.c:5:41: Redundant checked qualifier on doubled globals.c:6:46: Contradictory checked and unchecked qualifiers on contradict globals.c: (in function noglobs) globals.c:13:3: Undocumented use of global checkstrict globals.c: (in function specglobs) globals.c:18:3: Undocumented use of global imp globals.c:19:3: Undocumented use of global check globals.c:21:3: Undocumented use of global checkstrict Finished checking --- 6 code warnings, as expected globals.c:5:41: Redundant checked qualifier on doubled globals.c:6:46: Contradictory checked and unchecked qualifiers on contradict globals.c: (in function noglobs) globals.c:13:3: Undocumented use of global checkstrict globals.c: (in function specglobs) globals.c:18:3: Undocumented use of global imp globals.c:19:3: Undocumented use of global check globals.c:21:3: Undocumented use of global checkstrict Finished checking --- 6 code warnings, as expected globals.c:5:41: Redundant checked qualifier on doubled globals.c:6:46: Contradictory checked and unchecked qualifiers on contradict Finished checking --- 2 code warnings, as expected globals.c:5:41: Redundant checked qualifier on doubled globals.c:6:46: Contradictory checked and unchecked qualifiers on contradict globals.c: (in function noglobs) globals.c:11:3: Undocumented use of global check globals.c:13:3: Undocumented use of global checkstrict globals.c: (in function specglobs) globals.c:19:3: Undocumented use of global check globals.c:21:3: Undocumented use of global checkstrict Finished checking --- 6 code warnings, as expected globals.c:5:41: Redundant checked qualifier on doubled globals.c:6:46: Contradictory checked and unchecked qualifiers on contradict globals.c: (in function noglobs) globals.c:10:3: Undocumented use of global imp globals.c:11:3: Undocumented use of global check globals.c:13:3: Undocumented use of global checkstrict globals.c: (in function specglobs) globals.c:18:3: Undocumented use of global imp globals.c:19:3: Undocumented use of global check globals.c:21:3: Undocumented use of global checkstrict Finished checking --- 8 code warnings, as expected splint-3.1.2.dfsg1/test/help.expect0000644021234200000250000004207410645762145014605 0ustar fax Source files are .c, .h and .lcl files. If there is no suffix, Splint will look for .c and .lcl. Use splint -help for more information Topics: annotations (describes source-code annotations) comments (describes control comments) flags (describes flag categories) flags (describes flags in category) flags all (short description of all flags) flags alpha (list all flags alphabetically) flags full (full description of all flags) mail (information on mailing lists) modes (show mode settings) parseerrors (help on handling parser errors) prefixcodes (character codes in namespace prefixes) references (sources for more information) vars (environment variables) version (information on compilation, maintainer) Source files are .c, .h and .lcl files. If there is no suffix, Splint will look for .c and .lcl. Use splint -help for more information Topics: annotations (describes source-code annotations) comments (describes control comments) flags (describes flag categories) flags (describes flags in category) flags all (short description of all flags) flags alpha (list all flags alphabetically) flags full (full description of all flags) mail (information on mailing lists) modes (show mode settings) parseerrors (help on handling parser errors) prefixcodes (character codes in namespace prefixes) references (sources for more information) vars (environment variables) version (information on compilation, maintainer) Command Line: Unrecognized option: -asdf A flag is not recognized or used in an incorrect way (Use -badflag to inhibit warning) Finished checking --- no code processed Command Line: Setting +boolint redundant with current value Finished checking --- no code processed D I S U abstract abstractcompare accessall accessczech accessczechoslovak accessfile accessmodule accessslovak aliasunique allblock allempty allglobs allimponly allmacros allocmismatch alwaysexits annotationerror ansi89limits assignexpose badflag bitwisesigned boolcompare boolfalse boolint boolops booltrue booltype bounds boundscompacterrormessages boundsread boundswrite branchstate bufferoverflow bufferoverflowhigh bugslimit casebreak caseinsensitivefilenames castexpose castfcnptr charindex charint charintliteral charunsignedchar checkedglobalias checkmodglobalias checkpost checkstrictglobalias checkstrictglobs codeimponly commentchar commenterror compdef compdestroy compmempass constmacros constprefix constprefixexclude constuse continuecomment controlnestdepth cppnames csv csvoverwrite czech czechconsts czechfcns czechmacros czechoslovak czechoslovakconsts czechoslovakfcns czechoslovakmacros czechoslovaktypes czechoslovakvars czechtypes czechvars debugfcnconstraint declundef deepbreak deparrays dependenttrans distinctexternalnames distinctinternalnames dump duplicatecases duplicatequals elseifcomplete emptyret enumindex enumint enummembers enummemuse enumprefix enumprefixexclude errorstream errorstreamstderr errorstreamstdout evalorder evalorderuncon exitarg expect exportany exportconst exportfcn exportheader exportheadervar exportiter exportlocal exportmacro exporttype exportvar exposetrans externalnamecaseinsensitive externalnamelen externalprefix externalprefixexclude f fcnderef fcnmacros fcnpost fcnuse fielduse fileextensions filestaticprefix filestaticprefixexclude firstcase fixedformalarray floatdouble forblock forcehints forempty forloopexec formalarray formatcode formatconst formattype forwarddecl freshtrans fullinitblock globalias globalprefix globalprefixexclude globimponly globnoglobs globs globsimpmodsnothing globstate globuse gnuextensions grammar hasyield help hints htmlfileformat i ifblock ifempty ignorequals ignoresigns immediatetrans impabstract impboundsconstraints impcheckedglobs impcheckedspecglobs impcheckedstatics impcheckedstrictglobs impcheckedstrictspecglobs impcheckedstrictstatics impcheckmodglobs impcheckmodinternals impcheckmodspecglobs impcheckmodstatics impconj implementationoptional impouts imptype includenest incompletetype incondefs incondefslib indentspaces infloops infloopsuncon initallelements initsize internalglobs internalglobsnoglobs internalnamecaseinsensitive internalnamelen internalnamelookalike iso99limits isolib isoreserved isoreservedinternal iterbalance iterloopexec iterprefix iterprefixexclude iteryield its4low its4moderate its4mostrisky its4risky its4veryrisky keep keeptrans kepttrans larchpath lclexpect lclimportdir lcs legacy lh libmacros likelybool likelybounds likelyboundsread likelyboundswrite limit linelen lintcomments load localprefix localprefixexclude locindentspaces longint longintegral longsignedintegral longunsignedintegral longunsignedunsignedintegral loopexec looploopbreak looploopcontinue loopswitchbreak macroassign macroconstdecl macroconstdistance macrodecl macroempty macrofcndecl macromatchname macroparams macroparens macroredef macroret macrostmt macrounrecog macrovarprefix macrovarprefixexclude maintype matchanyintegral matchfields mayaliasunique memchecks memimp memtrans messagestream messagestreamstderr messagestreamstdout misplacedsharequal misscase modfilesys modglobs modglobsnomods modglobsunchecked modinternalstrict modnomods modobserver modobserveruncon mods modsimpnoglobs modstrictglobsnomods moduncon modunconnomods modunspec mts multithreaded mustdefine mustfree mustfreefresh mustfreeonly mustmod mustnotalias mutrep namechecks needspec nestcomment nestedextern neverinclude newdecl newreftrans nextlinemacros noaccess nocomments noeffect noeffectuncon nof nolib noparams nopp noret null nullassign nullderef nullinit nullpass nullptrarith nullret nullstate nullterminated numabstract numabstractcast numabstractindex numabstractlit numabstractprint numenummembers numliteral numstructfields observertrans obviousloopexec oldstyle onlytrans onlyunqglobaltrans orconstraint overload ownedtrans paramimptemp paramuse parenfileformat partial passunknown portability posixlib posixstrictlib predassign predbool predboolint predboolothers predboolptr preproc protoparammatch protoparamname protoparamprefix protoparamprefixexclude ptrarith ptrcompare ptrnegate quiet readonlystrings readonlytrans realcompare realrelatecompare redecl redef redundantconstraints redundantsharequal refcounttrans relaxquals relaxtypes repeatunrecog repexpose retalias retexpose retimponly retval retvalbool retvalint retvalother sefparams sefuncon shadow sharedtrans shiftimplementation shiftnegative shortint showallconjs showalluses showcolumn showconstraintlocation showconstraintparens showdeephistory showfunc showloadloc showscan showsourceloc showsummary singleinclude sizeofformalarray sizeoftype skipisoheaders skipposixheaders skipsysheaders slashslashcomment slovak slovakconsts slovakfcns slovakmacros slovaktypes slovakvars specglobimponly specimponly specmacros specretimponly specstructimponly specundecl specundef stackref statemerge statetransfer staticinittrans statictrans stats streamoverwrite strictbranchstate strictdestroy strictlib strictops strictusereleased stringliterallen stringliteralnoroom stringliteralnoroomfinalnull stringliteralsmaller stringliteraltoolong structimponly supcounts superuser switchloopbreak switchswitchbreak syntax sysdirerrors sysdirexpandmacros sysdirs sysunrecog tagprefix tagprefixexclude temptrans timedist tmpcomments tmpdir toctou topuse trytorecover type typeprefix typeprefixexclude typeuse uncheckedglobalias uncheckedmacroprefix uncheckedmacroprefixexclude uniondef unixlib unixstandard unixstrictlib unqualifiedinittrans unqualifiedtrans unreachable unrecog unrecogcomments unrecogdirective unrecogflagcomments unsignedcompare unusedspecial usedef usereleased usevarargs varuse voidabstract warnflags warningstream warningstreamstderr warningstreamstdout warnlintcomments warnmissingglobs warnmissingglobsnoglobs warnposixheaders warnrc warnsysfiles warnunixlib warnuse whichlib whileblock whileempty whileloopexec zerobool splint-3.1.2.dfsg1/test/impabstract.expect0000644021234200000250000000326507415132350016153 0ustar fax Finished checking --- no warnings impabstract.c: (in function f) impabstract.c:11:7: Left operand of < is abstract type (mint): m < 2 An abstraction barrier is broken. If necessary, use /*@access @*/ to allow access to an abstract type. (Use -abstract to inhibit warning) impabstract.c:13:14: Return value type mint does not match declared type int: m Underlying types match, but mint is an abstract type that is not accessible here. Finished checking --- 2 code warnings, as expected impabstract.c:2:28: Mutable abstract type cint declared without pointer indirection: int (violates assignment semantics) LCL semantics requires that a mutable type exhibits sharing semantics. In order for objects to be shared a indirection is necessary in the representation. A mutable type may be represented by a pointer or an abstract mutable type. Handles into static data are fine, too, but will generate this error message unless it is suppressed. (Use -mutrep to inhibit warning) impabstract.c:2:28: Datatype cint inconsistently declared as concrete type A function, variable or constant is redefined with a different type. (Use -incondefs to inhibit warning) impabstract.lcl:2:1: Specification of cint impabstract.c: (in function f) impabstract.c:6:7: Left operand of > is abstract type (cint): c > 3 An abstraction barrier is broken. If necessary, use /*@access @*/ to allow access to an abstract type. (Use -abstract to inhibit warning) impabstract.c:8:14: Return value type cint does not match declared type int: c Underlying types match, but cint is an abstract type that is not accessible here. Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/init.expect0000644021234200000250000000541107413453477014616 0ustar fax init.c:1:16: Global c[0] initialized to null value: c[0] = NULL init.c:1:43: Initial value of c[2][2] is type int, expects char: 3 init.c:1:48: Global c[3] initialized to null value: c[3] = NULL init.c:4:23: Global st.uname initialized to null value: st.uname = NULL init.c:4:29: Initial value of st.y is type double, expects int: 1.2 init.c:7:7: Initializer block for st2[0] has 3 fields, but struct { char * name; int [] x; char * uname;, ... } has 4 fields: "bob", { 1, 2 }, NULL init.c:8:19: Initial value of st2[1].x is type int, expects int []: 3 init.c:8:22: Global st2[1].uname initialized to null value: st2[1].uname = NULL init.c:10:13: Initializer block for a has 7 elements, but declared as int [10]: 1, 2, 3, 4, 3.4, 6, 4 init.c:10:27: Initial value of a[4] is type double, expects int: 3.4 init.c:12:34: Initial value of aa[1][1] is type double, expects int: 3.2 init.c:14:13: Initializer block for b has 2 elements, but declared as int [10]: { 1, 2 }, { 3, 4 } init.c:14:15: Initializer block used for b[0] where int is expected: { 1, 2 } init.c:14:25: Initializer block used for b[1] where int is expected: { 3, 4 } Finished checking --- 14 code warnings, as expected init.c:1:16: Global c[0] initialized to null value: c[0] = NULL init.c:1:22: Read-only string literal storage used as initial value for unqualified storage: c[1] = "hullo" init.c:1:43: Initial value of c[2][2] is type int, expects char: 3 init.c:1:48: Global c[3] initialized to null value: c[3] = NULL init.c:4:7: Read-only string literal storage used as initial value for unqualified storage: st.name = "bob" init.c:4:23: Global st.uname initialized to null value: st.uname = NULL init.c:4:29: Initial value of st.y is type double, expects int: 1.2 init.c:7:7: Initializer block for st2[0] has 3 fields, but struct { char * name; int [] x; char * uname;, ... } has 4 fields: "bob", { 1, 2 }, NULL init.c:8:9: Read-only string literal storage used as initial value for unqualified storage: st2[1].name = "charly" init.c:8:19: Initial value of st2[1].x is type int, expects int []: 3 init.c:8:22: Global st2[1].uname initialized to null value: st2[1].uname = NULL init.c:10:13: Initializer block for a has 7 elements, but declared as int [10]: 1, 2, 3, 4, 3.4, 6, 4 init.c:10:27: Initial value of a[4] is type double, expects int: 3.4 init.c:12:34: Initial value of aa[1][1] is type double, expects int: 3.2 init.c:14:13: Initializer block for b has 2 elements, but declared as int [10]: { 1, 2 }, { 3, 4 } init.c:14:15: Initializer block used for b[0] where int is expected: { 1, 2 } init.c:14:25: Initializer block used for b[1] where int is expected: { 3, 4 } Finished checking --- 17 code warnings, as expected splint-3.1.2.dfsg1/test/inparam.expect0000644021234200000250000000074107413453477015303 0ustar fax inparam.c: (in function f) inparam.c:8:16: Passed storage x not completely defined (*x is undefined): unknown (x) inparam.c:12:16: Passed storage x not completely defined (*x is undefined): inparam (x) Finished checking --- 2 code warnings, as expected inparam.c: (in function f) inparam.c:12:16: Passed storage x not completely defined (*x is undefined): inparam (x) Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/internal.expect0000644021234200000250000000760107415256735015472 0ustar fax internal.c: (in function f1) internal.c:21:9: Variable e1 shadows outer declaration internal.c:12:7: Previous definition of e1: int Finished checking --- 1 code warning, as expected internal.c: (in function f1) internal.c:21:9: Variable e1 shadows outer declaration internal.c:12:7: Previous definition of e1: int Finished checking --- 1 code warning, as expected internal.c:4:5: Internal identifier iwonderhowmanycharactersaresignificant2 is not distinguishable from iwonderhowmanycharactersaresignificant1 in the first 31 characters (iwonderhowmanycharactersaresign) internal.c:3:5: Declaration of iwonderhowmanycharactersaresignificant1 internal.c: (in function f1) internal.c:21:9: Variable e1 shadows outer declaration internal.c:12:7: Previous definition of e1: int Finished checking --- 2 code warnings, as expected internal.c:4:5: Internal identifier iwonderhowmanycharactersaresignificant2 is not distinguishable from iwonderhowmanycharactersaresignificant1 in the first 28 characters (iwonderhowmanycharactersares) internal.c:3:5: Declaration of iwonderhowmanycharactersaresignificant1 internal.c:6:5: Internal identifier manycharactersaresignificant2 is not distinguishable from manycharactersaresignificant1 in the first 28 characters (manycharactersaresignificant) internal.c:5:5: Declaration of manycharactersaresignificant1 internal.c: (in function f1) internal.c:21:9: Variable e1 shadows outer declaration internal.c:12:7: Previous definition of e1: int Finished checking --- 3 code warnings, as expected internal.c: (in function f1) internal.c:15:8: Internal identifier Alphabet is not distinguishable from alphabet without case sensitivity internal.c:14:7: Declaration of alphabet internal.c:21:9: Variable e1 shadows outer declaration internal.c:12:7: Previous definition of e1: int internal.c:23:11: Internal identifier lcAse is not distinguishable from lcase without case sensitivity internal.c:18:7: Declaration of lcase Finished checking --- 3 code warnings, as expected internal.c:10:6: Internal identifier f1 is not distinguishable from fl except by lookalike characters internal.c:8:12: Declaration of fl internal.c: (in function f1) internal.c:13:9: Internal identifier el is not distinguishable from e1 except by lookalike characters internal.c:12:7: Declaration of e1 internal.c:15:8: Internal identifier Alphabet is not distinguishable from alphabet without case sensitivity internal.c:14:7: Declaration of alphabet internal.c:17:8: Internal identifier alphabetlsoup is not distinguishable from alphabet1soup except by lookalike characters internal.c:16:7: Declaration of alphabet1soup internal.c:21:9: Variable e1 shadows outer declaration internal.c:12:7: Previous definition of e1: int internal.c:21:9: Internal identifier e1 is not distinguishable from el except by lookalike characters internal.c:13:9: Declaration of el internal.c:22:9: Internal identifier a1phabet is not distinguishable from alphabet except by lookalike characters internal.c:14:7: Declaration of alphabet internal.c:23:11: Internal identifier lcAse is not distinguishable from lcase without case sensitivity internal.c:18:7: Declaration of lcase internal.c:25:9: Internal identifier sS2 is not distinguishable from s52 except by lookalike characters internal.c:24:9: Declaration of s52 internal.c:26:9: Internal identifier s5Z is not distinguishable from s52 except by lookalike characters internal.c:24:9: Declaration of s52 internal.c:28:9: Internal identifier num0 is not distinguishable from numO except by lookalike characters internal.c:27:9: Declaration of numO Finished checking --- 11 code warnings, as expected splint-3.1.2.dfsg1/test/iter.expect0000644021234200000250000000475007413453477014623 0ustar fax iter.lcl:3:6: Iterator has no yield parameters: noYield iter.c: (in function test) iter.c:9:14: Unrecognized identifier: x iter.c:14:16: Yield parameter shadows local declaration: i iter.c:6:7: Declaration of i iter.c:18:8: Iter intFor not balanced with end_intFor iter.c:14:12: Iter intFor expects arg 2 to be int gets char: c iter.c:20:20: Variable i used before definition iter.c:20:20: Yield parameter is not simple identifier: i + 3 iter.c:24:24: Iter intFor not balanced with end_intFor: end_arrayElements iter.h: (in iter intFor) iter.h:1:27: Parameter ___x name is not consistent with macro variable namespace prefix "m_" iter.h: (in iter arrayElements) iter.h:7:31: Parameter ___x name is not consistent with macro variable namespace prefix "m_" iter.h:7:43: Variable ___c name is not consistent with macro variable namespace prefix "m_" iter.h:7:55: Variable ___b name is not consistent with macro variable namespace prefix "m_" iter.h:8:1: Macro parameter j used in conditionally executed code (may or may not be evaluated exactly once) (in post loop test) iter.lcl:3:6: Iterator noYield specified but not defined iter.lcl:3:6: Iterator finalizer end_noYield specified but not defined Finished checking --- 1 spec warning, as expected 14 code warnings, as expected iter2.c: (in function test) iter2.c:9:14: Unrecognized identifier: x iter2.c:14:16: Yield parameter shadows local declaration: i iter2.c:6:7: Declaration of i iter2.c:17:8: Iter intFor not balanced with end_intFor iter2.c:14:12: Iter intFor expects arg 2 to be int gets char: c iter2.c:19:17: Variable i used before definition iter2.c:19:17: Yield parameter is not simple identifier: i + 3 iter2.c:22:24: Iter intFor not balanced with end_intFor: end_arrayElements iter2.h: (in iter intFor) iter2.h:2:27: Parameter ___x name is not consistent with macro variable namespace prefix "m_" iter2.h: (in iter arrayElements) iter2.h:8:31: Parameter ___x name is not consistent with macro variable namespace prefix "m_" iter2.h:8:43: Variable ___c name is not consistent with macro variable namespace prefix "m_" iter2.h:8:55: Variable ___b name is not consistent with macro variable namespace prefix "m_" iter2.h:9:1: Macro parameter j used in conditionally executed code (may or may not be evaluated exactly once) (in post loop test) Finished checking --- 12 code warnings, as expected splint-3.1.2.dfsg1/test/keep.expect0000644021234200000250000000157307577744773014621 0ustar fax keep.c: (in function f2) keep.c:12:9: Keep storage passed as only param: free (x) keep.c:10:26: Storage x becomes keep keep.c: (in function f3) keep.c:19:27: Keep storage x not transferred before return keep.c:15:25: Storage x becomes keep keep.c: (in function f5) keep.c:36:10: Keep storage x not transferred before return keep.c:34:39: Storage x becomes keep keep.c: (in function f6) keep.c:44:5: Variable x is kept in true branch, but not kept in continuation. keep.c:44:5: in true branch: keep.c:43:11: Storage x becomes kept keep.c:44:5: in continuation: keep.c:39:26: Storage x becomes keep keep.c:46:7: Kept storage x passed as keep param: f2 (x) keep.c:44:5: Storage x becomes kept keep.c: (in function f7) keep.c:60:10: Kept storage x returned as implicitly only: x keep.c:58:5: Storage x becomes kept Finished checking --- 6 code warnings, as expected splint-3.1.2.dfsg1/test/libs.expect0000644021234200000250000002460707512352624014604 0ustar fax libs.c: (in function compare2) libs.c:14:10: Observer storage returned without qualification: "ok" libs.c:14:10: Storage becomes observer libs.c: (in function leave) libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo" libs.c:21:3: Unreachable code: exit(i) libs.c: (in function print) libs.c:29:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:30:3: Format string parameter to printf is not a compile-time constant: s libs.c:31:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:33:3: Assignment of int to char: c = fgetc(f) libs.c:34:3: Assignment of int to char: c = getc(f) libs.c: (in function main) libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int, int) returns int]: compare libs.c:46:10: Function bsearch called with 4 args, expects 5 libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU... libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:54:11: Unrecognized identifier: SIGHUP libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void] * gets [function (int, int) returns int]: compare libs.c:54:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, c... libs.c:55:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, l... Finished checking --- 18 code warnings, as expected libs.c: (in function compare2) libs.c:14:10: Observer storage returned without qualification: "ok" libs.c:14:10: Storage becomes observer libs.c: (in function leave) libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo" libs.c:21:3: Unreachable code: exit(i) libs.c: (in function print) libs.c:29:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:30:3: Format string parameter to printf is not a compile-time constant: s libs.c:31:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:33:3: Assignment of int to char: c = fgetc(f) libs.c:34:3: Assignment of int to char: c = getc(f) libs.c: (in function main) libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int, int) returns int]: compare libs.c:46:10: Function bsearch called with 4 args, expects 5 libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU... libs.c:51:16: Function qsort expects arg 2 to be size_t gets unsigned int: x libs.c:51:19: Function qsort expects arg 3 to be size_t gets unsigned int: x libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x libs.c:52:13: Function qsort expects arg 2 to be size_t gets unsigned int: x libs.c:52:16: Function qsort expects arg 3 to be size_t gets unsigned int: x libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:54:11: Unrecognized identifier: SIGHUP libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void] * gets [function (int, int) returns int]: compare libs.c:54:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, c... libs.c:55:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, l... Finished checking --- 22 code warnings, as expected libs.c: (in function compare2) libs.c:14:10: Observer storage returned without qualification: "ok" libs.c:14:10: Storage becomes observer libs.c: (in function leave) libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo" libs.c:21:3: Unreachable code: exit(i) libs.c: (in function print) libs.c:29:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:29:3: Undocumented modification of *f possible from call to fprintf: fprintf(f, s) libs.c:30:3: Format string parameter to printf is not a compile-time constant: s libs.c:31:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:33:7: Undocumented modification of *f possible from call to fgetc: fgetc(f) libs.c:33:3: Assignment of int to char: c = fgetc(f) libs.c:34:7: Undocumented modification of *f possible from call to getc: getc(f) libs.c:34:3: Assignment of int to char: c = getc(f) libs.c: (in function main) libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int, int) returns int]: compare libs.c:46:10: Function bsearch called with 4 args, expects 5 libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU... libs.c:51:16: Function qsort expects arg 2 to be size_t gets unsigned int: x libs.c:51:19: Function qsort expects arg 3 to be size_t gets unsigned int: x libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x libs.c:52:13: Function qsort expects arg 2 to be size_t gets unsigned int: x libs.c:52:16: Function qsort expects arg 3 to be size_t gets unsigned int: x libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:54:11: Unrecognized identifier: SIGHUP libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void] * gets [function (int, int) returns int]: compare libs.c:54:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, c... libs.c:55:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, l... Finished checking --- 25 code warnings, as expected libs.c: (in function compare2) libs.c:14:10: Observer storage returned without qualification: "ok" libs.c:14:10: Storage becomes observer libs.c: (in function leave) libs.c:20:9: Function exit expects arg 1 to be int gets char *: "hullo" libs.c:21:3: Unreachable code: exit(i) libs.c: (in function print) libs.c:29:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:29:3: Undocumented modification of *f possible from call to fprintf: fprintf(f, s) libs.c:29:3: Return value (type int) ignored: fprintf(f, s) libs.c:30:3: Format string parameter to printf is not a compile-time constant: s libs.c:30:3: Called procedure printf may access global stdout libs.c:30:3: Undocumented modification of *stdout possible from call to printf: printf(s) libs.c:30:3: Return value (type int) ignored: printf(s) libs.c:31:12: Undocumented use of global stderr libs.c:31:3: Format string parameter to fprintf is not a compile-time constant: s libs.c:31:3: Undocumented modification of *stderr possible from call to fprintf: fprintf(stderr, s) libs.c:31:3: Return value (type int) ignored: fprintf(stderr, s) libs.c:33:7: Called procedure fgetc may access global errno libs.c:33:7: Undocumented modification of *f possible from call to fgetc: fgetc(f) libs.c:33:7: Undocumented modification of errno possible from call to fgetc: fgetc(f) libs.c:33:3: Assignment of int to char: c = fgetc(f) libs.c:34:7: Called procedure getc may access global errno libs.c:34:7: Undocumented modification of *f possible from call to getc: getc(f) libs.c:34:7: Undocumented modification of errno possible from call to getc: getc(f) libs.c:34:3: Assignment of int to char: c = getc(f) libs.c: (in function main) libs.c:46:44: Function bsearch expects arg 4 to be size_t gets [function (int, int) returns int]: compare libs.c:46:10: Function bsearch called with 4 args, expects 5 libs.c:48:50: Function bsearch expects arg 5 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:48:3: Return value (type void *) ignored: bsearch(NULL, NU... libs.c:51:16: Function qsort expects arg 2 to be size_t gets unsigned int: x libs.c:51:19: Function qsort expects arg 3 to be size_t gets unsigned int: x libs.c:51:3: Called procedure qsort may access global errno libs.c:51:3: Undocumented modification of errno possible from call to qsort: qsort(NULL, x, x, ([function () returns int] *)compare) libs.c:52:10: Function qsort expects arg 1 to be void * gets unsigned int: x libs.c:52:13: Function qsort expects arg 2 to be size_t gets unsigned int: x libs.c:52:16: Function qsort expects arg 3 to be size_t gets unsigned int: x libs.c:52:19: Function qsort expects arg 4 to be [function (void *, void *) returns int] * gets [function () returns char] *: ([function () returns char] *)compare2 libs.c:52:3: Called procedure qsort may access global errno libs.c:52:3: Undocumented modification of errno possible from call to qsort: qsort(x, x, x, ([function () returns char] *)compare2) libs.c:54:11: Unrecognized identifier: SIGHUP libs.c:54:19: Function signal expects arg 2 to be [function (int) returns void] * gets [function (int, int) returns int]: compare libs.c:54:3: Called procedure signal may access global errno libs.c:54:3: Undocumented modification of errno possible from call to signal: signal(SIGHUP, compare) libs.c:54:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, c... libs.c:55:3: Called procedure signal may access global errno libs.c:55:3: Undocumented modification of errno possible from call to signal: signal(SIGHUP, leave) libs.c:55:3: Return value (type [function (int) returns void]) ignored: signal(SIGHUP, l... Finished checking --- 44 code warnings, as expected splint-3.1.2.dfsg1/test/linked.expect0000644021234200000250000000706407577744773015144 0ustar fax linked.c: (in function node_free1) linked.c:10:9: Only storage n->next (type node) derived from released storage is not released (memory leak): n linked.c: (in function node_free2) linked.c:17:2: Only storage nn not released before return linked.c:16:9: Storage nn becomes only linked.c:15:8: Variable nn declared but not used linked.c: (in function node_free3) linked.c:23:15: Possibly null storage nn passed as non-null param: node_free1 (nn) linked.c:21:13: Storage nn may become null Finished checking --- 4 code warnings, as expected linked2.c: (in function node_free2) linked2.c:15:8: Variable nn declared but not used linked2.c: (in function node_free3) linked2.c:23:15: Possibly null storage nn passed as non-null param: node_free1 (nn) linked2.c:21:13: Storage nn may become null linked2.c:23:15: Dependent storage nn passed as only param: node_free1 (nn) linked2.c:23:15: Storage nn becomes dependent (through alias n->next) Finished checking --- 3 code warnings, as expected linked3.c: (in function node_free1) linked3.c:10:9: Only storage n->val (type char *) derived from released storage is not released (memory leak): n linked3.c:10:9: Only storage n->next (type node) derived from released storage is not released (memory leak): n linked3.c: (in function node_free2) linked3.c:16:9: Only storage n->val (type char *) derived from released storage is not released (memory leak): n linked3.c:17:2: Only storage nn not released before return linked3.c:16:9: Storage nn becomes only linked3.c:15:8: Variable nn declared but not used Finished checking --- 5 code warnings, as expected linked4.c: (in function node_free1) linked4.c:14:9: Only storage n->val (type item) derived from released storage is not released (memory leak): n linked4.c:14:9: Only storage n->next (type node) derived from released storage is not released (memory leak): n linked4.c: (in function node_free2) linked4.c:20:9: Only storage n->val (type item) derived from released storage is not released (memory leak): n linked4.c:21:2: Only storage nn not released before return linked4.c:20:9: Storage nn becomes only linked4.c:19:8: Variable nn declared but not used linked4.c: (in function node_free3) linked4.c:26:9: Only storage n->val->val (type char *) derived from released storage is not released (memory leak): n->val Finished checking --- 6 code warnings, as expected linked5.c: (in function node_free1) linked5.c:14:9: Only storage n->next (type node) derived from released storage is not released (memory leak): n linked5.c: (in function node_free2) linked5.c:21:2: Only storage nn not released before return linked5.c:20:9: Storage nn becomes only linked5.c:19:8: Variable nn declared but not used linked5.c: (in function node_free3) linked5.c:26:9: Dependent storage n->val passed as only param: free (n->val) Finished checking --- 4 code warnings, as expected linked6.c: (in function node_free1) linked6.c:16:9: Only storage n->val (type item) derived from released storage is not released (memory leak): n linked6.c:16:9: Only storage n->next (type node) derived from released storage is not released (memory leak): n linked6.c: (in function node_free2) linked6.c:24:2: Only storage nn not released before return linked6.c:23:9: Storage nn becomes only linked6.c:21:8: Variable nn declared but not used Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/lintcomments.expect0000644021234200000250000000265607416123634016367 0ustar fax lintcomments.c: (in function f) lintcomments.c:7:51: Traditional lint comment /*FALLTHROUGH*/ used. Splint interprets this in the same way as most Unix lints, but it is preferable to replace it with the /*@fallthrough@*/ semantic comment lintcomments.c:8:33: Traditional lint comment /*FALLTHROUGH*/ used. Splint interprets this in the same way as most Unix lints, but it is preferable to replace it with the /*@fallthrough@*/ semantic comment lintcomments.c:9:30: Traditional lint comment /*FALLTHRU*/ used. Splint interprets this in the same way as most Unix lints, but it is preferable to replace it with the /*@fallthrough@*/ semantic comment lintcomments.c:11:13: Fall through case (no preceding break) lintcomments.c:23:21: Traditional lint comment /*NOTREACHED*/ used. Splint interprets this in the same way as most Unix lints, but it is preferable to replace it with the /*@notreached@*/ semantic comment. Finished checking --- 5 code warnings, as expected lintcomments.c: (in function f) lintcomments.c:11:13: Fall through case (no preceding break) Finished checking --- 1 code warning, as expected lintcomments.c: (in function f) lintcomments.c:9:10: Fall through case (no preceding break) lintcomments.c:10:10: Fall through case (no preceding break) lintcomments.c:11:13: Fall through case (no preceding break) lintcomments.c:24:8: Unreachable code: i++ Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/list.expect0000644021234200000250000000105007577744773014636 0ustar fax list.c: (in function list_addh) list.c:24:5: Variable e is kept in true branch, but not kept in continuation. list.c:24:5: in true branch: list.c:23:7: Storage e becomes kept list.c:24:5: in continuation: list.c:12:22: Storage e becomes only list.c:25:2: Storage *(l->next) reachable from parameter contains 1 undefined field: next list.c: (in function list_addh2) list.c:39:2: Storage *(l->next) reachable from parameter contains 1 undefined field: next Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/longconstants.expect0000644021234200000250000000027507357756545016563 0ustar fax longconstants.c:3:14: Variable llong initialized to type unsigned long int, expects long int: 3594UL Finished LCLint checking --- 1 code error found, as expected splint-3.1.2.dfsg1/test/macros.expect0000644021234200000250000001521707413453477015144 0ustar fax macros.c: (in macro needparen) macros.c:7:26: Macro parameter used without parentheses: a macros.c:7:30: Macro parameter used without parentheses: b macros.c: (in macro needuse) macros.c:8:21: Macro parameter b not used macros.lcl:6:1: Specification of b macros.c: (in macro multuse) macros.c:9:18: Macro parameter a used more than once macros.c: (in macro badassign) macros.c:10:26: Assignment to macro parameter: a macros.c:11: Macro badassign already defined macros.c:10: Previous definition of badassign macros.c: (in macro badassign) macros.c:11:26: Operand of ++ is macro parameter (non-functional): (a)++ macros.c:11:35: Operand of ++ is macro parameter (non-functional): ++(b) macros.c: (in macro predbad) macros.c:15:20: Macro parameter b used in true clause, but not in false clause macros.c: (in macro predbad2) macros.c:16:19: Macro parameter a used more than once macros.c:16:22: Macro parameter b used more than once macros.c: (in macro badval) macros.c:22:23: Function badval specified to return int, implemented as macro having type bool: ((a) == (b)) macros.lcl:14: Specification of badval macros.c: (in macro badconst) macros.c:23:20: Constant badconst specified as bool, but defined as int: 5 macros.lcl:18:15: Specification of badconst macros.c:25:21: Constant worseconst implemented as parameterized macro macros.lcl:20:14: Specification of worseconst macros.c:27: Variable var implemented by a macro macros.lcl:22:5: Specification of var macros.c:28: Variable var2 implemented as parameterized macro macros.lcl:23:5: Specification of var2 macros.c: (in macro var2) macros.c:28:15: Macro parameter x used more than once Finished checking --- 17 code warnings, as expected macros.c:3: Parameterized macro has no prototype or specification: mustard macros.c: (in macro mustard) macros.c:3:30: Macro parameter used without parentheses: b macros.c:3:18: Macro parameter a used more than once macros.c:3:34: Macro parameter used without parentheses: a macros.c:4: Parameterized macro has no prototype or specification: ketchup macros.c:6: Parameterized macro has no prototype or specification: ok macros.c:7: Parameterized macro has no prototype or specification: needparen macros.c: (in macro needparen) macros.c:7:26: Macro parameter used without parentheses: a macros.c:7:30: Macro parameter used without parentheses: b macros.c:8: Parameterized macro has no prototype or specification: needuse macros.c: (in macro needuse) macros.c:8:21: Macro parameter b not used macros.c:9: Parameterized macro has no prototype or specification: multuse macros.c: (in macro multuse) macros.c:9:18: Macro parameter a used more than once macros.c:10: Parameterized macro has no prototype or specification: badassign macros.c: (in macro badassign) macros.c:10:26: Assignment to macro parameter: a macros.c:11: Macro badassign already defined macros.c:10: Previous definition of badassign macros.c: (in macro badassign) macros.c:11:26: Operand of ++ is macro parameter (non-functional): (a)++ macros.c:11:35: Operand of ++ is macro parameter (non-functional): ++(b) macros.c:14: Parameterized macro has no prototype or specification: predok macros.c:15: Parameterized macro has no prototype or specification: predbad macros.c: (in macro predbad) macros.c:15:20: Macro parameter b used in true clause, but not in false clause macros.c:16: Parameterized macro has no prototype or specification: predbad2 macros.c: (in macro predbad2) macros.c:16:19: Macro parameter a used more than once macros.c:16:22: Macro parameter b used more than once macros.c:18: Parameterized macro has no prototype or specification: badorder macros.c:19: Parameterized macro has no prototype or specification: okorder macros.c:20: Parameterized macro has no prototype or specification: okorder2 macros.c:22: Parameterized macro has no prototype or specification: badval macros.c:23: Macro constant badconst not declared macros.c:24: Macro constant goodconst not declared macros.c:25: Parameterized macro has no prototype or specification: worseconst macros.c:27: Macro constant var not declared macros.c:28: Parameterized macro has no prototype or specification: var2 macros.c: (in macro var2) macros.c:28:15: Macro parameter x used more than once Finished checking --- 34 code warnings, as expected macros.c:3: Parameterized macro has no prototype or specification: mustard macros.c: (in macro mustard) macros.c:3:30: Macro parameter used without parentheses: b macros.c:3:18: Macro parameter a used more than once macros.c:3:34: Macro parameter used without parentheses: a macros.c:4: Parameterized macro has no prototype or specification: ketchup macros.c:6: Parameterized macro has no prototype or specification: ok macros.c:7: Parameterized macro has no prototype or specification: needparen macros.c: (in macro needparen) macros.c:7:26: Macro parameter used without parentheses: a macros.c:7:30: Macro parameter used without parentheses: b macros.c:8: Parameterized macro has no prototype or specification: needuse macros.c: (in macro needuse) macros.c:8:21: Macro parameter b not used macros.c:9: Parameterized macro has no prototype or specification: multuse macros.c: (in macro multuse) macros.c:9:18: Macro parameter a used more than once macros.c:10: Parameterized macro has no prototype or specification: badassign macros.c: (in macro badassign) macros.c:10:26: Assignment to macro parameter: a macros.c:11: Macro badassign already defined macros.c:10: Previous definition of badassign macros.c: (in macro badassign) macros.c:11:26: Operand of ++ is macro parameter (non-functional): (a)++ macros.c:11:35: Operand of ++ is macro parameter (non-functional): ++(b) macros.c:14: Parameterized macro has no prototype or specification: predok macros.c:15: Parameterized macro has no prototype or specification: predbad macros.c: (in macro predbad) macros.c:15:20: Macro parameter b used in true clause, but not in false clause macros.c:16: Parameterized macro has no prototype or specification: predbad2 macros.c: (in macro predbad2) macros.c:16:19: Macro parameter a used more than once macros.c:16:22: Macro parameter b used more than once macros.c:18: Parameterized macro has no prototype or specification: badorder macros.c:19: Parameterized macro has no prototype or specification: okorder macros.c:20: Parameterized macro has no prototype or specification: okorder2 macros.c:22: Parameterized macro has no prototype or specification: badval macros.c:25: Parameterized macro has no prototype or specification: worseconst macros.c:28: Parameterized macro has no prototype or specification: var2 macros.c: (in macro var2) macros.c:28:15: Macro parameter x used more than once Finished checking --- 31 code warnings, as expected splint-3.1.2.dfsg1/test/macrosef.expect0000644021234200000250000000302507413453477015451 0ustar fax macrosef.c: (in macro f) macrosef.c:2:14: Macro parameter y used more than once macrosef.c: (in function m) macrosef.c:12:14: Parameter 1 to f is declared sef, but the argument may modify file system state: (printf("yo\n"), 3) macrosef.c:12:14: Parameter 1 to f is declared sef, but the argument may modify *stdout: (printf("yo\n"), 3) macrosef.c:14:14: Parameter 1 to f is declared sef, but the argument may modify *p: g(p) Finished checking --- 4 code warnings, as expected macrosef.c: (in macro f) macrosef.c:2:14: Macro parameter y used more than once macrosef.c: (in function m) macrosef.c:12:14: Parameter 1 to f is declared sef, but the argument may modify file system state: (printf("yo\n"), 3) macrosef.c:12:14: Parameter 1 to f is declared sef, but the argument may modify *stdout: (printf("yo\n"), 3) Finished checking --- 3 code warnings, as expected macrosef.c: (in macro f) macrosef.c:2:14: Macro parameter y used more than once macrosef.c: (in function m) macrosef.c:12:14: Parameter 1 to f is declared sef, but the argument may modify file system state: (printf("yo\n"), 3) macrosef.c:12:14: Parameter 1 to f is declared sef, but the argument may modify *stdout: (printf("yo\n"), 3) macrosef.c:14:14: Parameter 1 to f is declared sef, but the argument calls unconstrained function g (no guarantee it will not modify something): g(p) Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/maxset.expect0000644021234200000250000000107407671271606015153 0ustar fax Finished checking --- no warnings maxsetnoannotations.c: (in function noancopy) maxsetnoannotations.c:2:3: Possible out-of-bounds store: strcpy(a, b) Unable to resolve constraint: requires maxSet(a @ maxsetnoannotations.c:2:11) >= maxRead(b @ maxsetnoannotations.c:2:13) needed to satisfy precondition: requires maxSet(a @ maxsetnoannotations.c:2:11) >= maxRead(b @ maxsetnoannotations.c:2:13) derived from strcpy precondition: requires maxSet() >= maxRead() Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/merge.expect0000644021234200000250000000066007413453477014753 0ustar fax merge.c: (in function f2) merge.c:33:4: Variable y used in inconsistent state merge.c:30:28: Storage y becomes inconsistent (released on one branch) merge.c:33:4: Dereference of possibly null pointer y: *y merge.c:21:12: Storage y may become null merge.c: (in function f3) merge.c:51:4: Dereference of possibly null pointer y: *y merge.c:50:7: Storage y may become null Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/mergestate.expect0000644021234200000250000000227607413453477016021 0ustar fax taintednm.c: (in function f) taintednm.c:15:7: Attributes merged in ensures clause in states that cannot be combined (t2 is untainted, s is tainted): bogus merge taintednm.c:1:32: s becomes tainted taintednm.c:24:10: Stack-allocated storage t reachable from return value: t Finished checking --- 2 code warnings, as expected taintednm.c: (in function f) taintednm.c:16:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) taintednm.c:15:7: t becomes tainted taintednm.xh:23:55: s becomes untainted taintednm.c:19:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) taintednm.c:18:7: t becomes tainted taintednm.xh:23:55: s becomes untainted taintednm.c:22:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) taintednm.c:18:7: t becomes tainted taintednm.xh:23:55: s becomes untainted taintednm.c:24:10: Stack-allocated storage t reachable from return value: t Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/metastate.expect0000644021234200000250000001350007650577033015636 0ustar fax file1.c: (in function main) file1.c:10:14: Invalid transfer from implicitly unopen fle to open (unopen file passed as open): checkOpen(..., fle, ...) file1.c:6:14: fle becomes implicitly unopen file1.c:1:53: parameter 1 becomes open file1.c:19:16: Invalid transfer from implicitly open fle to unopen (open file passed as unopen): checkClosed(..., fle, ...) file1.c:12:3: fle becomes implicitly open file1.c:2:57: parameter 1 becomes unopen file1.c:23:14: Invalid transfer from unopen fle to open (unopen file passed as open): checkOpen(..., fle, ...) file1.c:22:10: fle becomes unopen file1.c:1:53: parameter 1 becomes open file1.c:7:8: Variable s declared but not used Finished checking --- 4 code warnings, as expected file2.c: (in function main) file2.c:11:6: Scope exit loses reference fle2 in invalid state implicitly open (open file not closed) file2.c:9:41: State becomes implicitly open file2.c:13:12: Return loses reference fle1 in invalid state implicitly open (open file not closed) file2.c:5:37: State becomes implicitly open Finished checking --- 2 code warnings, as expected file3.c: (in function main) file3.c:10:22: Possibly null storage fle1 passed as non-null param: fclose (fle1) file3.c:6:16: Storage fle1 may become null file3.c:11:5: Control branches merge with incompatible states for fle1 (unopen and open): files merge in inconsistent state file3.c:6:37: fle1 becomes implicitly open file3.c:10:14: fle1 becomes unopen Finished checking --- 2 code warnings, as expected file4.c: (in function main) file4.c:15:14: Invalid transfer from implicitly unopen fle to open (unopen file passed as open): checkOpen(..., fle, ...) file4.c:11:14: fle becomes implicitly unopen file4.c:1:53: parameter 1 becomes open Finished checking --- 1 code warning, as expected file5.c: (in function passOpen) file5.c:8:2: Ensures clause not satisfied by f (state is open): ensures closed f file5.c:4:35: f becomes open file5.c: (in function returnOpen) file5.c:16:10: Result state fle does not satisfy ensures clause: ensures open result (state is unopen, should be open): fle file5.c:13:30: Storage fle becomes dependent file5.c: (in function main) file5.c:25:14: Invalid transfer from implicitly unopen fle to open (unopen file passed as open): checkOpen(..., fle, ...) file5.c:21:14: fle becomes implicitly unopen file5.c:1:53: parameter 1 becomes open file5.c:35:18: Invalid transfer from unopen fle to open (unopen file passed as open): fclose(..., fle, ...) file5.c:34:3: fle becomes unopen file.xh:1:44: parameter 1 becomes open Finished checking --- 4 code warnings, as expected file6.c: (in function newOpenBad) file6.c:20:10: Invalid transfer from unopen res to open (unopen file passed as open): return res file6.c:19:10: res becomes unopen file6.c:14:2: becomes open file6.c: (in function main) file6.c:30:12: Return loses reference fle in invalid state implicitly open (open file not closed) file6.c:27:3: State becomes implicitly open Finished checking --- 2 code warnings, as expected filebad.c:1:23: Attribute annotation open used in inconsistent context: int badOpen(FILE *) filebad.c:3:52: Attribute annotation closed used in inconsistent context: int p_x filebad.c:3:12: Attribute annotation open used on inappropriate reference p_x in ensures open clause of badEnsures: ensures open p_x Finished checking --- 3 code warnings, as expected sockets.c: (in function test1) sockets.c:13:3: Requires clause of called function useSockets not satisfied (state is uninitialized): requires sockets_initialized sockets.c: (in function test5) sockets.c:37:3: Requires clause of called function useSockets not satisfied (state is uninitialized): requires sockets_initialized sockets.c: (in function test6) sockets.c:42:3: Requires clause of called function useSockets not satisfied (state is uninitialized): requires sockets_initialized Finished checking --- 3 code warnings, as expected sockets2.c: (in function test1) sockets2.c:15:4: Control branches merge with incompatible global states (initialized and uninitialized): Sockets initialized on true branch, uninitialized on false branch. sockets2.c:11:24: becomes uninitialized sockets2.c:14:5: becomes initialized sockets2.c: (in function test2) sockets2.c:24:3: Control branches merge with incompatible global states (uninitialized and initialized): Sockets uninitialized on false branch, initialized on true branch. sockets2.c:20:24: becomes initialized sockets2.c:23:5: becomes uninitialized Finished checking --- 2 code warnings, as expected struct.c: (in function source_badClose) struct.c:10:2: Function returns with parameter s in inconsistent state (s->file is unopen, should be open): unopen file passed as open struct.c:9:10: s->file becomes unopen Finished checking --- 1 code warning, as expected nullbranch.c: (in function ftest2) nullbranch.c:30:22: Possibly null storage f passed as non-null param: fclose (f) nullbranch.c:22:7: Storage f may become null nullbranch.c:32:2: Return loses reference f in invalid state open (open file not closed) nullbranch.c:22:3: State becomes open Finished checking --- 2 code warnings, as expected osd.c: (in function osd_fileIsReadable) osd.c:9:7: Return value (type int) ignored: fclose(fl) osd.c:10:14: Return value type bool does not match declared type int: true Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/modifies.expect0000644021234200000250000000212307413453477015447 0ustar fax modifies.c:7:29: Modifies list uses internalState which is a variable and has special meaning in a modifies list. (Special meaning assumed.) modifies.c:4:25: Declaration of internalState modifies.c:13:26: Modifies list uses fileSystem which is a parameter and has special meaning in a modifies list. (Special meaning assumed.) modifies.c:17:5: Globals list for f6 includes internal state, mstat, but previously declared without globals internalState. modifies.c:15:5: Declaration of f6 modifies.c:17:5: Modifies list for f6 includes internal state, but previously declared without modifies internal. modifies.c:15:5: Declaration of f6 modifies.c: (in function f1) modifies.c:24:3: Undocumented modification of mstat: mstat++ modifies.c: (in function g2) modifies.c:37:1: Function g2 specified to modify internal state but no internal state is modified modifies.h:3:12: Declaration of g2 modclient.c: (in function mod) modclient.c:3:3: Statement has no effect: (void)f1(p) Finished checking --- 7 code warnings, as expected splint-3.1.2.dfsg1/test/modtest.expect0000644021234200000250000000515407413453477015336 0ustar fax modtest.c: (in function g) modtest.lcl:15: Global x listed but not used modtest.lcl:15: Global y listed but not used modtest.c:9:12: Parameter a not used modtest.c:9:22: Parameter p not used modtest.c: (in function f) modtest.c:16:3: Undocumented modification of i[3]: i[3] = y modtest.c:17:3: Undocumented modification of j[2]: j[2] = x modtest.c:22:3: Undocumented modification of y: y++ modtest.c:25:3: Undocumented modification of tstp->b: tstp->b = 6 modtest.c:26:3: Undocumented modification of y possible from call to g: g(j, i) modtest.c:26:3: Return value (type int) ignored: g(j, i) Finished checking --- 10 code warnings, as expected modtest.c: (in function g) modtest.lcl:15: Global x listed but not used modtest.lcl:15: Global y listed but not used modtest.c:9:12: Parameter a not used modtest.c:9:22: Parameter p not used modtest.c: (in function f) modtest.c:16:3: Undocumented modification of i[3]: i[3] = y modtest.c:17:3: Undocumented modification of j[2]: j[2] = x modtest.c:22:3: Undocumented modification of y: y++ modtest.c:25:3: Undocumented modification of tstp->b: tstp->b = 6 modtest.c:26:3: Undocumented modification of y possible from call to g: g(j, i) modtest.c:26:3: Return value (type int) ignored: g(j, i) modtest.c: (in function h) modtest.c:33:3: Undocumented modification of y: y++ modtest.c:34:10: Undocumented modification of x possible from call to g: g(a, &x) modtest.c:34:10: Undocumented modification of y possible from call to g: g(a, &x) Finished checking --- 13 code warnings, as expected modtest.c: (in function g) modtest.lcl:15: Global x listed but not used modtest.lcl:15: Global y listed but not used modtest.c:12:1: Suspect object listed in modifies of g not modified: x modtest.lcl:15: Specification of g modtest.c:12:1: Suspect object listed in modifies of g not modified: y modtest.lcl:15: Specification of g modtest.c:9:12: Parameter a not used modtest.c:9:22: Parameter p not used modtest.c: (in function f) modtest.c:16:3: Undocumented modification of i[3]: i[3] = y modtest.c:17:3: Undocumented modification of j[2]: j[2] = x modtest.c:22:3: Undocumented modification of y: y++ modtest.c:25:3: Undocumented modification of tstp->b: tstp->b = 6 modtest.c:26:3: Undocumented modification of y possible from call to g: g(j, i) modtest.c:26:3: Return value (type int) ignored: g(j, i) modtest.c:29:1: Suspect object listed in modifies of f not modified: ai[6] modtest.lcl:8: Specification of f modtest.c:29:1: Suspect object listed in modifies of f not modified: tstp->a modtest.lcl:8: Specification of f Finished checking --- 14 code warnings, as expected splint-3.1.2.dfsg1/test/moduncon.expect0000644021234200000250000000577007413453477015505 0ustar fax moduncon.c: (in function g) moduncon.c:12:10: Undetected modification possible from call to unconstrained function umod: umod moduncon.c:13:22: Undetected modification possible from call to unconstrained function umod: umod moduncon.c:13:16: Undetected modification possible from call to unconstrained function mmod: mmod moduncon.c:13:10: Undetected modification possible from call to unconstrained function umod: umod Finished checking --- 4 code warnings, as expected moduncon.c: (in function f) moduncon.c:6:22: Undetected modification possible from call to unconstrained function umod: umod moduncon.c:6:22: New fresh storage (type int *) passed as implicitly temp (not released): umod(x) moduncon.c:6:16: Undetected modification possible from call to unconstrained function mmod: mmod moduncon.c:6:16: New fresh storage (type int *) passed as implicitly temp (not released): mmod(umod(x)) moduncon.c:6:10: Undetected modification possible from call to unconstrained function umod: umod moduncon.c:6:3: Statement has no effect (possible undected modification through call to unconstrained functions umod, mmod): (void)umod(mmod(... moduncon.c: (in function g) moduncon.c:12:10: Undetected modification possible from call to unconstrained function umod: umod moduncon.c:12:3: Statement has no effect (possible undected modification through call to unconstrained function umod): (void)umod(x) moduncon.c:13:22: Undetected modification possible from call to unconstrained function umod: umod moduncon.c:13:22: New fresh storage (type int *) passed as implicitly temp (not released): umod(x) moduncon.c:13:16: Undetected modification possible from call to unconstrained function mmod: mmod moduncon.c:13:16: New fresh storage (type int *) passed as implicitly temp (not released): mmod(umod(x)) moduncon.c:13:10: Undetected modification possible from call to unconstrained function umod: umod moduncon.c:13:3: Statement has no effect (possible undected modification through call to unconstrained functions umod, mmod): (void)umod(mmod(... moduncon.c:1:6: Function mmod declared but not defined moduncon.c:2:6: Function umod declared but not defined moduncon.c:4:5: Function f declared but not used moduncon.c:8:1: Definition of f moduncon.c:10:5: Function g declared but not used moduncon.c:15:1: Definition of g moduncon.c:1:6: Function mmod exported but not declared in header file moduncon.c:2:6: Function umod exported but not declared in header file moduncon.c:4:5: Function f exported but not declared in header file moduncon.c:8:1: Definition of f moduncon.c:10:5: Function g exported but not declared in header file moduncon.c:15:1: Definition of g Finished checking --- 22 code warnings, as expected splint-3.1.2.dfsg1/test/mongoincludes.expect0000644021234200000250000001157207413453477016526 0ustar fax minc1.h:1: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:1: Include site minc4.h:1: Maximum include nesting depth (1, current depth 3) exceeded minc1.h:1: Include site mongoincludes.c:1: Include site minc1.h:2: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:1: Include site minc1.h:3: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:1: Include site minc2.h:1: Maximum include nesting depth (1, current depth 3) exceeded minc1.h:3: Include site mongoincludes.c:1: Include site minc3.h:1: Maximum include nesting depth (1, current depth 4) exceeded minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc4.h:1: Maximum include nesting depth (1, current depth 5) exceeded minc3.h:1: Include site minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc3.h:2: Maximum include nesting depth (1, current depth 4) exceeded minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc2.h:2: Maximum include nesting depth (1, current depth 3) exceeded minc1.h:3: Include site mongoincludes.c:1: Include site minc4.h:1: Maximum include nesting depth (1, current depth 4) exceeded minc2.h:2: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc2.h:3: Maximum include nesting depth (1, current depth 3) exceeded minc1.h:3: Include site mongoincludes.c:1: Include site minc1.h:4: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:1: Include site minc3.h:1: Maximum include nesting depth (1, current depth 3) exceeded minc1.h:4: Include site mongoincludes.c:1: Include site minc3.h:2: Maximum include nesting depth (1, current depth 3) exceeded minc1.h:4: Include site mongoincludes.c:1: Include site minc2.h:1: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:2: Include site minc2.h:2: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:2: Include site minc2.h:3: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:2: Include site minc3.h:1: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:3: Include site minc3.h:2: Maximum include nesting depth (1, current depth 2) exceeded mongoincludes.c:3: Include site Finished checking --- 19 code warnings, as expected minc4.h:1: Maximum include nesting depth (2, current depth 3) exceeded minc1.h:1: Include site mongoincludes.c:1: Include site minc2.h:1: Maximum include nesting depth (2, current depth 3) exceeded minc1.h:3: Include site mongoincludes.c:1: Include site minc3.h:1: Maximum include nesting depth (2, current depth 4) exceeded minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc4.h:1: Maximum include nesting depth (2, current depth 5) exceeded minc3.h:1: Include site minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc3.h:2: Maximum include nesting depth (2, current depth 4) exceeded minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc2.h:2: Maximum include nesting depth (2, current depth 3) exceeded minc1.h:3: Include site mongoincludes.c:1: Include site minc4.h:1: Maximum include nesting depth (2, current depth 4) exceeded minc2.h:2: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc2.h:3: Maximum include nesting depth (2, current depth 3) exceeded minc1.h:3: Include site mongoincludes.c:1: Include site minc3.h:1: Maximum include nesting depth (2, current depth 3) exceeded minc1.h:4: Include site mongoincludes.c:1: Include site minc3.h:2: Maximum include nesting depth (2, current depth 3) exceeded minc1.h:4: Include site mongoincludes.c:1: Include site Finished checking --- 10 code warnings, as expected minc3.h:1: Maximum include nesting depth (3, current depth 4) exceeded minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc4.h:1: Maximum include nesting depth (3, current depth 5) exceeded minc3.h:1: Include site minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc3.h:2: Maximum include nesting depth (3, current depth 4) exceeded minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site minc4.h:1: Maximum include nesting depth (3, current depth 4) exceeded minc2.h:2: Include site minc1.h:3: Include site mongoincludes.c:1: Include site Finished checking --- 4 code warnings, as expected minc4.h:1: Maximum include nesting depth (4, current depth 5) exceeded minc3.h:1: Include site minc2.h:1: Include site minc1.h:3: Include site mongoincludes.c:1: Include site Finished checking --- 1 code warning, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/moreBufferTests.expect0000644021234200000250000000372507671271606016776 0ustar fax unrecogCall.c: (in function foo) unrecogCall.c:8:3: Unrecognized identifier: bar initialization.c: (in function initialization) initialization.c:5:10: Variable g declared but not used initialization.c:5:14: Possible out-of-bounds read: e[22] Unable to resolve constraint: requires maxRead(d @ initialization.c:3:14) >= 22 needed to satisfy precondition: requires maxRead(e @ initialization.c:5:14) >= 22 initialization.c:8:3: Possible out-of-bounds store: f[2] Unable to resolve constraint: requires maxSet(d @ initialization.c:3:14) >= 2 needed to satisfy precondition: requires maxSet(f @ initialization.c:8:3) >= 2 simplifyTest.c: (in function fooSub) simplifyTest.c:3:3: Possible out-of-bounds store: s[i] Unable to resolve constraint: requires maxSet(s @ simplifyTest.c:3:3) >= i @ simplifyTest.c:3:5 needed to satisfy precondition: requires maxSet(s @ simplifyTest.c:3:3) >= i @ simplifyTest.c:3:5 simplifyTest.c: (in function fooAdd) simplifyTest.c:10:3: Possible out-of-bounds store: s[i + 2] Unable to resolve constraint: requires maxSet(s @ simplifyTest.c:10:3) >= i @ simplifyTest.c:10:5 + 2 needed to satisfy precondition: requires maxSet(s @ simplifyTest.c:10:3) >= i @ simplifyTest.c:10:5 + 2 strncatNotReallyGood.c: (in function NotGoodfunc) strncatNotReallyGood.c:4:29: Passed storage buffer not completely defined (*buffer is undefined): strncat (buffer, ...) strncatNotReallyGood.c:4:21: Possible out-of-bounds store: strncat(buffer, str, sizeof((buffer)) - 1) Unable to resolve constraint: requires maxRead(buffer @ strncatNotReallyGood.c:4:29) <= 0 needed to satisfy precondition: requires maxSet(buffer @ strncatNotReallyGood.c:4:29) >= maxRead(buffer @ strncatNotReallyGood.c:4:29) + 255 derived from strncat precondition: requires maxSet() >= maxRead() + Finished checking --- 8 code warnings, as expected splint-3.1.2.dfsg1/test/moreBufferTests2.expect0000644021234200000250000000174307765024014017047 0ustar fax unknownsize.c: (in function uknSize1) unknownsize.c:9:3: Possible out-of-bounds store: c[9] Unable to resolve constraint: requires maxSet(c @ unknownsize.c:9:3) >= 9 needed to satisfy precondition: requires maxSet(c @ unknownsize.c:9:3) >= 9 Finished checking --- 1 code warning, as expected fixedArrayType.c: (in function fixedArrayTouch) fixedArrayType.c:9:3: Possible out-of-bounds store: buffer[sizeof(Array) - 1] Unable to resolve constraint: requires sizeof(Array) @ fixedArrayType.c:9:25 <= 10 needed to satisfy precondition: requires maxSet(buffer @ fixedArrayType.c:9:3) >= sizeof(Array) @ fixedArrayType.c:9:25 - 1 Finished checking --- 1 code warning, as expected initBlock.c: (in function main) initBlock.c:8:3: Likely out-of-bounds store: buf[10] Unable to resolve constraint: requires 9 >= 10 needed to satisfy precondition: requires maxSet(buf @ initBlock.c:8:3) >= 10 Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/mystrncat.expect0000644021234200000250000000233507577744773015716 0ustar fax mystrncat.c: (in function func) mystrncat.c:12:13: Passed storage buffer not completely defined (*buffer is undefined): mystrncat (buffer, ...) mystrncat.c:13:13: Passed storage b not completely defined (*b is undefined): mystrncat (b, ...) mystrncat.c:10:3: Storage *b allocated mystrncat.c:12:3: Possible out-of-bounds store: mystrncat(buffer, str, sizeof((buffer)) - 1) Unable to resolve constraint: requires maxRead(buffer @ mystrncat.c:12:13) <= 0 needed to satisfy precondition: requires maxSet(buffer @ mystrncat.c:12:13) >= maxRead(buffer @ mystrncat.c:12:13) + 255 derived from mystrncat precondition: requires maxSet() >= maxRead() + mystrncat.c:13:3: Possible out-of-bounds store: mystrncat(b, str, sizeof((buffer)) - 1) Unable to resolve constraint: requires maxRead(malloc(256) @ mystrncat.c:10:7) <= 0 needed to satisfy precondition: requires maxSet(b @ mystrncat.c:13:13) >= maxRead(b @ mystrncat.c:13:13) + 255 derived from mystrncat precondition: requires maxSet() >= maxRead() + Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/noeffect.expect0000644021234200000250000000117307415132350015427 0ustar fax noeffect.c: (in macro exprNode_swap) noeffect.c:3:59: Assignment to macro parameter: e1 A macro parameter is used as the left side of an assignment expression. This exhibits behavior that could not be implemented by a function. (Use -macroassign to inhibit warning) noeffect.c:3:72: Assignment to macro parameter: e2 noeffect.c:2:18: File static function exprNode_swap declared but not used A function is declared but not used. Use /*@unused@*/ in front of function header to suppress message. (Use -fcnuse to inhibit warning) noeffect.c:3: Definition of exprNode_swap Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/null.expect0000644021234200000250000002056307627632513014627 0ustar fax null1.c: (in function ptrpred) null1.c:7:22: Out storage x not defined before return null1.c: (in function f) null1.c:19:20: Implicitly temp storage x returned as only: x null1.c:19:20: Possibly null storage x returned as non-null: x null1.c:10:35: Storage x may become null null1.c:19:22: Fresh storage y not released before return null1.c:12:41: Fresh storage y created null1.c:31:4: Dereference of possibly null pointer y: *y null1.c:12:12: Storage y may become null null1.c:34:5: Possibly null storage z passed as non-null param: g (z) null1.c:25:7: Storage z may become null null1.c:34:5: Passed storage z not completely defined (*z is undefined): g (z) null1.c:25:3: Storage *z allocated null1.c:39:14: Dereference of null pointer z: *z null1.c:25:7: Storage z becomes null null1.c:43:22: Dereference of possibly null pointer z4: *z4 null1.c:42:8: Storage z4 may become null null1.c:46:25: Dereference of possibly null pointer z2: *z2 null1.c:26:8: Storage z2 may become null null1.c:49:11: Dereference of possibly null pointer z3: *z3 null1.c:27:8: Storage z3 may become null null1.c:55:4: Dereference of possibly null pointer z2: *z2 null1.c:51:8: Storage z2 may become null null1.c:59:23: Dereference of possibly null pointer z5: *z5 null1.c:57:8: Storage z5 may become null null1.c:67:10: Possibly null storage z returned as non-null: z null1.c:25:7: Storage z may become null null1.c:67:12: Fresh storage z3 not released before return null1.c:27:3: Fresh storage z3 created Finished checking --- 15 code warnings, as expected null1.c: (in function f) null1.c:19:20: Implicitly temp storage x returned as only: x null1.c:19:22: Fresh storage y not released before return null1.c:12:41: Fresh storage y created null1.c:34:5: Passed storage z not completely defined (*z is undefined): g (z) null1.c:25:3: Storage *z allocated null1.c:67:12: Fresh storage z3 not released before return null1.c:27:3: Fresh storage z3 created Finished checking --- 4 code warnings, as expected null2.c: (in function ptrpred) null2.c:7:22: Out storage x not defined before return null2.c: (in function f) null2.c:15:10: Left operand of && is non-boolean (int *): x1 && (*x1 == 3) null2.c:16:19: Dereference of possibly null pointer x2: *x2 null2.c:10:55: Storage x2 may become null null2.c:17:18: Dereference of possibly null pointer x3: *x3 null2.c:11:21: Storage x3 may become null null2.c:17:10: Left operand of || is non-boolean (int *): x3 || (*x3 == 3) null2.c:20:27: Dereference of possibly null pointer x1: *x1 null2.c:10:35: Storage x1 may become null null2.c:23:7: Left operand of && is non-boolean (int *): x4 && (*x4 == 3) null2.c:30:8: Dereference of possibly null pointer x4: *x4 null2.c:11:41: Storage x4 may become null null2.c:35:14: Implicitly temp storage x3 returned as only: (x3) null2.c:35:14: Possibly null storage x3 returned as non-null: (x3) null2.c:11:21: Storage x3 may become null null2.c:39:10: Implicitly temp storage x1 returned as only: (x1) Finished checking --- 11 code warnings, as expected null3.c: (in function f3) null3.c:16:4: Dereference of possibly null pointer gnip: *gnip null3.c:3:25: Storage gnip may become null null3.c: (in function f) null3.c:27:4: Dereference of possibly null pointer arg0: *arg0 null3.c:37:8: Dereference of possibly null pointer z: *z null3.c:25:12: Storage z may become null null3.c:38:16: Only storage aip not released before return null3.c:22:66: Storage aip becomes only null3.c:44:4: Dereference of possibly null pointer arg2: *arg2 null3.c:52:4: Dereference of possibly null pointer gnip: *gnip null3.c:51:10: Storage gnip may become null null3.c:53:9: Variable z used after being released null3.c:51:3: Storage z released null3.c:53:3: Only storage gip (type int *) not released before assignment (z aliases gnip): gip = z null3.c:5:17: Storage gip becomes only null3.c:55:3: Only storage gnip (type nip) not released before assignment: gnip = aip null3.c:53:3: Storage gnip becomes kept null3.c:60:14: Returned storage y not completely defined (*y is undefined): y null3.c:24:42: Storage *y allocated null3.c:60:16: Function returns with non-null global gip referencing null storage null3.c:53:9: Storage gip may become null null3.c:65:14: Possibly null storage y returned as non-null: y null3.c:24:12: Storage y may become null null3.c:65:14: Returned storage y not completely defined (*y is undefined): y null3.c:24:42: Storage *y allocated null3.c:65:16: Function returns with non-null global gip referencing null storage null3.c:53:9: Storage gip may become null null3.c: (in function f2) null3.c:73:4: Dereference of possibly null pointer gnip: *gnip null3.c:55:10: Storage gnip may become null Finished checking --- 15 code warnings, as expected null3.c: (in function f3) null3.c:16:4: Dereference of possibly null pointer gnip: *gnip null3.c:3:25: Storage gnip may become null null3.c: (in function f) null3.c:27:4: Dereference of possibly null pointer arg0: *arg0 null3.c:35:13: Possibly null storage y passed as non-null param: free (y) null3.c:24:12: Storage y may become null null3.c:37:8: Dereference of possibly null pointer z: *z null3.c:25:12: Storage z may become null null3.c:38:16: Only storage aip not released before return null3.c:22:66: Storage aip becomes only null3.c:44:4: Dereference of possibly null pointer arg2: *arg2 null3.c:52:4: Dereference of possibly null pointer gnip: *gnip null3.c:51:10: Storage gnip may become null null3.c:53:9: Variable z used after being released null3.c:51:3: Storage z released null3.c:53:3: Only storage gip (type int *) not released before assignment (z aliases gnip): gip = z null3.c:5:17: Storage gip becomes only null3.c:55:3: Only storage gnip (type nip) not released before assignment: gnip = aip null3.c:53:3: Storage gnip becomes kept null3.c:60:14: Returned storage y not completely defined (*y is undefined): y null3.c:24:42: Storage *y allocated null3.c:60:16: Function returns with non-null global gip referencing null storage null3.c:53:9: Storage gip may become null null3.c:65:14: Possibly null storage y returned as non-null: y null3.c:24:12: Storage y may become null null3.c:65:14: Returned storage y not completely defined (*y is undefined): y null3.c:24:42: Storage *y allocated null3.c:65:16: Function returns with non-null global gip referencing null storage null3.c:53:9: Storage gip may become null null3.c: (in function f2) null3.c:73:4: Dereference of possibly null pointer gnip: *gnip null3.c:55:10: Storage gnip may become null Finished checking --- 16 code warnings, as expected null4.c: (in function g) null4.c:43:3: Only storage p (type int *) not released before assignment: p = malloc(24) null4.c:3:28: Storage p becomes only Finished checking --- 1 code warning, as expected null5.c:5:29: Qualifier falsenull used with function returning char (should return bool) null5.c:6:29: Qualifier falsenull used with function having 2 arguments (should have 1) null5.c: (in function g2) null5.c:26:15: Dereference of possibly null pointer y: *y null5.c:18:25: Storage y may become null null5.c: (in function g3) null5.c:37:11: Dereference of null pointer y: *y null5.c:30:25: Storage y becomes null Finished checking --- 4 code warnings, as expected null6.c:7:36: Function f1 declared with notnull parameter x of abstract type mnull null6.c: (in function f) null6.c:11:11: Dereference of possibly null pointer x: *x null6.c: (in function f6) null6.c:68:10: Possibly null storage x returned as non-null: x null6.c:61:31: Storage x may become null null6.c: (in function f7) null6.c:84:10: Possibly null storage x returned as non-null: x null6.c:81:11: Storage x may become null Finished checking --- 4 code warnings, as expected null6.c:7:36: Function f1 declared with notnull parameter x of abstract type mnull null6.c: (in function f) null6.c:11:11: Dereference of possibly null pointer x: *x null6.c: (in function f6) null6.c:68:10: Possibly null storage x returned as non-null: x null6.c:61:31: Storage x may become null null6.c: (in function f7) null6.c:84:10: Possibly null storage x returned as non-null: x null6.c:81:11: Storage x may become null Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/nullterminatedtest.expect0000644021234200000250000000142507221033277017570 0ustar faxgmake[2]: Entering directory `/a/apollo/af9/drl7x/re/LCLintDev/test' LCLint 2.5q --- 20 May 2000 ****************************NULLTERMINATED ERROR2 test1.c: (in function main) test1.c:11:6: Possibly non-nullterminated storage c passed as nullterminated param: fcn1 (c) SYMBOL REFERENCED IS NOT NULLTERMINATED! *******************************= test1.c:13:6: Variable d used before definition ****************************NULLTERMINATED ERROR2 test1.c:13:6: Possibly non-nullterminated storage d passed as nullterminated param: fcn1 (d) SYMBOL REFERENCED IS NOT NULLTERMINATED! *******************************= LCLint 2.5q --- 20 May 2000 Finished LCLint checking --- no code processed gmake[2]: Leaving directory `/a/apollo/af9/drl7x/re/LCLintDev/test' splint-3.1.2.dfsg1/test/observer.expect0000644021234200000250000000574107577744773015525 0ustar fax observer.c: (in function stx_name) observer.c:9:10: Function returns reference to parameter x: (x->name) observer.c:9:10: Return value exposes rep of stx: (x->name) observer.c:9:20: Released storage x->name reachable from parameter at return point observer.c:9:10: Storage x->name released observer.c: (in function f) observer.c:33:3: Suspect modification of observer s: *s = 'x' observer.c:32:7: Storage *s becomes observer observer.c:34:9: Function call may modify observer s: s observer.c:32:7: Storage s becomes observer observer.c:34:9: Observer storage s passed as only param: free (s) observer.c:32:7: Storage s becomes observer observer.c:38:9: Exposed storage s passed as only param: free (s) observer.c:36:3: Storage s becomes exposed observer.c:41:10: Observer storage *s reachable from unqualified return value observer.c:40:7: Storage *s becomes observer observer.c:41:10: Observer storage s returned without qualification: s observer.c:40:7: Storage s becomes observer Finished checking --- 9 code warnings, as expected observer.c: (in function stx_name) observer.c:9:10: Function returns reference to parameter x: (x->name) observer.c:9:20: Released storage x->name reachable from parameter at return point observer.c:9:10: Storage x->name released observer.c: (in function f) observer.c:33:3: Suspect modification of observer s: *s = 'x' observer.c:32:7: Storage *s becomes observer observer.c:34:9: Function call may modify observer s: s observer.c:32:7: Storage s becomes observer observer.c:34:9: Observer storage s passed as only param: free (s) observer.c:32:7: Storage s becomes observer observer.c:38:9: Exposed storage s passed as only param: free (s) observer.c:36:3: Storage s becomes exposed observer.c:41:10: Observer storage *s reachable from unqualified return value observer.c:40:7: Storage *s becomes observer observer.c:41:10: Observer storage s returned without qualification: s observer.c:40:7: Storage s becomes observer Finished checking --- 8 code warnings, as expected observer.c: (in function stx_name) observer.c:9:20: Released storage x->name reachable from parameter at return point observer.c:9:10: Storage x->name released observer.c: (in function f) observer.c:33:3: Suspect modification of observer s: *s = 'x' observer.c:32:7: Storage *s becomes observer observer.c:34:9: Function call may modify observer s: s observer.c:32:7: Storage s becomes observer observer.c:34:9: Observer storage s passed as only param: free (s) observer.c:32:7: Storage s becomes observer observer.c:38:9: Exposed storage s passed as only param: free (s) observer.c:36:3: Storage s becomes exposed observer.c:41:10: Observer storage *s reachable from unqualified return value observer.c:40:7: Storage *s becomes observer observer.c:41:10: Observer storage s returned without qualification: s observer.c:40:7: Storage s becomes observer Finished checking --- 7 code warnings, as expected splint-3.1.2.dfsg1/test/oldstyle.expect0000644021234200000250000000112607427451047015505 0ustar fax oldstyle.c: (in function f1) oldstyle.c:5:8: Dereference of non-pointer (int): *y oldstyle.c:10:5: Function f2 declared with 1 arg, specified with 2 oldstyle.lcl:2: Specification of f2 oldstyle.c:15:12: Parameter 2, y, of function f3 has inconsistent type: declared char, specified char * oldstyle.lcl:4:1: Specification of y: char * oldstyle2.c: (in function noShadow) oldstyle2.c:15:14: Statement after switch is not a case: int x oldstyle2.c: (in function unrecognized) oldstyle2.c:29:6: Unrecognized identifier: x Finished checking --- 5 code warnings, as expected splint-3.1.2.dfsg1/test/outglob.expect0000644021234200000250000000160707627632513015326 0ustar fax outglob.c: (in function g) outglob.c:5:20: Undef global x3 used before definition outglob.c: (in function f) outglob.c:15:14: Undef global x1 used before definition outglob.c:15:17: Function returns with global x2 undefined outglob.lcl:3: Storage x2 becomes undefined outglob.c:15:17: Function returns with global x3 undefined outglob.lcl:3: Storage x3 becomes undefined outglob.c:21:10: Undef global x1 used before definition outglob.c:22:10: Global x2 used by function undefined before call: g outglob.c:27:10: Undef global x3 used before definition outglob.c:37:14: Function returns with global x3 undefined outglob.c:5:20: Storage x3 defined outglob.c:41:13: Function returns with global x2 undefined outglob.c:1:12: Storage x2 defined outglob.c:41:13: Function returns with global x3 undefined outglob.c:5:20: Storage x3 defined Finished checking --- 10 code warnings, as expected splint-3.1.2.dfsg1/test/outparam.expect0000644021234200000250000000161607577744773015523 0ustar fax outparam.c: (in function h) outparam.c:8:3: Variable u1 used before definition outparam.c:12:7: Field s->a used before definition outparam.c: (in function f) outparam.c:21:7: Value *a used before definition outparam.c: (in function g) outparam.c:37:5: Unallocated storage c passed as out parameter to f: c outparam.c:37:8: Variable b used before definition outparam.c:39:5: Unallocated storage d passed as out parameter to f: d outparam.c:41:7: Variable t used before definition outparam.c:42:7: Variable t2 used before definition outparam.c:42:3: Assignment of int to st: s = t2->a outparam.c:44:3: Variable t3 used before definition outparam.c:47:5: Arrow access from possibly null pointer t4: t4->a outparam.c:46:8: Storage t4 may become null outparam.c:48:13: Fresh storage t4 not released before return outparam.c:46:3: Fresh storage t4 created Finished checking --- 12 code warnings, as expected splint-3.1.2.dfsg1/test/postnotnull.expect0000644021234200000250000000035307413453477016254 0ustar fax postnotnull.c: (in function test) postnotnull.c:20:2: Only storage a.x (type char *) derived from variable declared in this scope is not released (memory leak) Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/preds.expect0000644021234200000250000000723107650621411014756 0ustar fax preds.c: (in function f) preds.c:10:7: Test expression for if not bool, type int: *p Test expression type is not boolean or int. (Use -predboolint to inhibit warning) preds.c:15:8: Operand of ! is non-boolean (int): !(*p) The operand of a boolean operator is not a boolean. Use +ptrnegate to allow ! to be used on pointers. (Use -boolops to inhibit warning) preds.c:20:7: Test expression for if is assignment expression: b1 = b2 The condition test is an assignment expression. Probably, you mean to use == instead of =. If an assignment is intended, add an extra parentheses nesting (e.g., if ((a = b)) ...) to suppress this message. (Use -predassign to inhibit warning) preds.c:25:7: Test expression for if not bool, type char: (c = 'a') Test expression type is not boolean. (Use -predboolothers to inhibit warning) preds.c:30:7: Use of == with bool variables (risks inconsistency because of multiple true values): b1 == b2 Two bool values are compared directly using a C primitive. This may produce unexpected results since all non-zero values are considered true, so different true values may not be equal. The file bool.h (included in splint/lib) provides bool_equal for safe bool comparisons. (Use -boolcompare to inhibit warning) preds.c:35:7: Test expression for if not bool, type char: c Finished checking --- 6 code warnings, as expected preds.c: (in function f) preds.c:20:7: Test expression for if is assignment expression: b1 = b2 The condition test is an assignment expression. Probably, you mean to use == instead of =. If an assignment is intended, add an extra parentheses nesting (e.g., if ((a = b)) ...) to suppress this message. (Use -predassign to inhibit warning) Finished checking --- 1 code warning, as expected bool.h:11:25: Constant exported, but not specified: FALSE A constant is exported, but not specified. (Use -exportconst to inhibit warning) bool.h:16:25: Constant exported, but not specified: TRUE preds.c: (in function f) preds.c:5:8: Operand of ! is non-boolean (int *): !p The operand of ! operator is a pointer. (Use +ptrnegate to inhibit warning) preds.c:10:7: Test expression for if not bool, type int: *p Test expression type is not boolean or int. (Use -predboolint to inhibit warning) preds.c:15:8: Operand of ! is non-boolean (int): !(*p) The operand of a boolean operator is not a boolean. Use +ptrnegate to allow ! to be used on pointers. (Use -boolops to inhibit warning) preds.c:20:7: Test expression for if is assignment expression: b1 = b2 The condition test is an assignment expression. Probably, you mean to use == instead of =. If an assignment is intended, add an extra parentheses nesting (e.g., if ((a = b)) ...) to suppress this message. (Use -predassign to inhibit warning) preds.c:25:7: Test expression for if not bool, type char: (c = 'a') Test expression type is not boolean. (Use -predboolothers to inhibit warning) preds.c:30:7: Use of == with bool variables (risks inconsistency because of multiple true values): b1 == b2 Two bool values are compared directly using a C primitive. This may produce unexpected results since all non-zero values are considered true, so different true values may not be equal. The file bool.h (included in splint/lib) provides bool_equal for safe bool comparisons. (Use -boolcompare to inhibit warning) preds.c:35:7: Test expression for if not bool, type char: c preds.c:3:5: Function f declared but not used A function is declared but not used. Use /*@unused@*/ in front of function header to suppress message. (Use -fcnuse to inhibit warning) preds.c:41:1: Definition of f Finished checking --- 10 code warnings, as expected splint-3.1.2.dfsg1/test/prefixes.expect0000644021234200000250000001742207413453477015505 0ustar fax Finished checking --- no warnings prefixes.c:20: Parameterized macro has no prototype or specification: mf prefixes.c: (in macro mf) prefixes.c:20:37: Variable y name is not consistent with macro variable namespace prefix "m_" prefixes.c:20:37: Variable y declared but not used prefixes.c:20:26: Variable m_x declared but not used Finished checking --- 4 code warnings, as expected prefixes.c:2:13: Datatype QINT name is not consistent with user-defined type namespace prefix "T" prefixes.c:3:13: Datatype tint name is not consistent with user-defined type namespace prefix "T" Finished checking --- 2 code warnings, as expected prefixes.c:3:13: Datatype tint name is not consistent with user-defined type namespace prefix "^" Finished checking --- 1 code warning, as expected prefixes.c:1:13: Datatype Tin_ty name is not consistent with user-defined type namespace prefix "^*" prefixes.c:3:13: Datatype tint name is not consistent with user-defined type namespace prefix "^*" Finished checking --- 2 code warnings, as expected prefixes.c:2:13: Datatype QINT name is not consistent with user-defined type namespace prefix "^%*" prefixes.c:3:13: Datatype tint name is not consistent with user-defined type namespace prefix "^%*" Finished checking --- 2 code warnings, as expected prefixes.c:1:13: Datatype Tin_ty name is not consistent with user-defined type namespace prefix "^~*" prefixes.c:3:13: Datatype tint name is not consistent with user-defined type namespace prefix "^~*" Finished checking --- 2 code warnings, as expected prefixes.c:3:13: Datatype tint name is not consistent with user-defined type namespace prefix "^" prefixes.c:6:12: Variable FSint name is not a user-defined type (it is a file static), but matches the user-defined type namespace prefix "^" prefixes.c:7:12: Variable TYint name is not a user-defined type (it is a file static), but matches the user-defined type namespace prefix "^" prefixes.c:8:12: Variable V3int name is not a user-defined type (it is a file static), but matches the user-defined type namespace prefix "^" prefixes.c:10:12: Variable Xqmxt name is not a user-defined type (it is a file static), but matches the user-defined type namespace prefix "^" prefixes.c:11:12: Variable XqmXt name is not a user-defined type (it is a file static), but matches the user-defined type namespace prefix "^" prefixes.c:14:12: Variable Gint name is not a user-defined type (it is a external), but matches the user-defined type namespace prefix "^" Finished checking --- 7 code warnings, as expected prefixes.c:8:12: Variable V3int name is not consistent with file static namespace prefix "^^" prefixes.c:9:12: Variable sint name is not consistent with file static namespace prefix "^^" prefixes.c:10:12: Variable Xqmxt name is not consistent with file static namespace prefix "^^" prefixes.c:11:12: Variable XqmXt name is not consistent with file static namespace prefix "^^" Finished checking --- 4 code warnings, as expected prefixes.c:6:12: Variable FSint name is not consistent with file static namespace prefix "^#" prefixes.c:7:12: Variable TYint name is not consistent with file static namespace prefix "^#" prefixes.c:9:12: Variable sint name is not consistent with file static namespace prefix "^#" prefixes.c:10:12: Variable Xqmxt name is not consistent with file static namespace prefix "^#" prefixes.c:11:12: Variable XqmXt name is not consistent with file static namespace prefix "^#" Finished checking --- 5 code warnings, as expected prefixes.c:6:12: Variable FSint name is not consistent with file static namespace prefix "^?&x" prefixes.c:7:12: Variable TYint name is not consistent with file static namespace prefix "^?&x" prefixes.c:8:12: Variable V3int name is not consistent with file static namespace prefix "^?&x" prefixes.c:9:12: Variable sint name is not consistent with file static namespace prefix "^?&x" prefixes.c:11:12: Variable XqmXt name is not consistent with file static namespace prefix "^?&x" Finished checking --- 5 code warnings, as expected prefixes.c:15:12: Variable aGb_Xint name is not consistent with global variable namespace prefix "G" Finished checking --- 1 code warning, as expected prefixes.c:14:12: Variable Gint name is not consistent with global variable namespace prefix "&G?_^" Finished checking --- 1 code warning, as expected prefixes.c:1:13: Datatype Tin_ty name is not consistent with external namespace prefix "G" prefixes.c:2:13: Datatype QINT name is not consistent with external namespace prefix "G" prefixes.c:3:13: Datatype tint name is not consistent with external namespace prefix "G" prefixes.c:15:12: Variable aGb_Xint name is not consistent with external namespace prefix "G" prefixes.c:18:12: Function g name is not consistent with external namespace prefix "G" Finished checking --- 5 code warnings, as expected prefixes.c:2:13: Datatype QINT name is not consistent with user-defined type namespace prefix "T" prefixes.c:3:13: Datatype tint name is not consistent with user-defined type namespace prefix "T" prefixes.c:15:12: Variable aGb_Xint name is not consistent with external namespace prefix "G" prefixes.c:18:12: Function g name is not consistent with external namespace prefix "G" Finished checking --- 4 code warnings, as expected prefixes.c:20: Expanded macro mf name is not a local variable (it is a unchecked macro), but matches the local variable namespace prefix "?*" prefixes.c:1:13: Datatype Tin_ty name is not a local variable (it is a external), but matches the local variable namespace prefix "?*" prefixes.c:2:13: Datatype QINT name is not a local variable (it is a external), but matches the local variable namespace prefix "?*" prefixes.c:3:13: Datatype tint name is not a local variable (it is a external), but matches the local variable namespace prefix "?*" prefixes.c:6:12: Variable FSint name is not a local variable (it is a file static), but matches the local variable namespace prefix "?*" prefixes.c:7:12: Variable TYint name is not a local variable (it is a file static), but matches the local variable namespace prefix "?*" prefixes.c:8:12: Variable V3int name is not a local variable (it is a file static), but matches the local variable namespace prefix "?*" prefixes.c:9:12: Variable sint name is not a local variable (it is a file static), but matches the local variable namespace prefix "?*" prefixes.c:10:12: Variable Xqmxt name is not a local variable (it is a file static), but matches the local variable namespace prefix "?*" prefixes.c:11:12: Variable XqmXt name is not a local variable (it is a file static), but matches the local variable namespace prefix "?*" prefixes.c:14:12: Variable Gint name is not a local variable (it is a external), but matches the local variable namespace prefix "?*" prefixes.c:15:12: Variable aGb_Xint name is not a local variable (it is a external), but matches the local variable namespace prefix "?*" prefixes.c:18:12: Function g name is not a local variable (it is a external), but matches the local variable namespace prefix "?*" Finished checking --- 13 code warnings, as expected splint-3.1.2.dfsg1/test/printflike.expect0000644021234200000250000000276607416123634016024 0ustar fax printflike.c:2:5: Function mprint is marked printflike, but has no elipsis parameter printflike.c:5:5: Function kprint is marked printflike, but has no elipsis parameter printflike.c:8:5: Function sprint is marked scanflike, but has no elipsis parameter printflike.c:13:15: Traditional lint comment /*PRINTFLIKE*/ used. Splint interprets this in the same way as most Unix lints, but it is preferable to replace it with either /*@printflike@*/, /*@scanflike@*/ or /*@messagelike@*/. printflike.c:16:35: Multiple special function codes: printflike, messagelike (first code is ignored) printflike.c:17:5: Function qxprint is marked messagelike, but the argument before the elipsis has type int (should be char *) Finished checking --- 6 code warnings, as expected printflike.c:2:5: Function mprint is marked printflike, but has no elipsis parameter printflike.c:5:5: Function kprint is marked printflike, but has no elipsis parameter printflike.c:8:5: Function sprint is marked scanflike, but has no elipsis parameter printflike.c:16:35: Multiple special function codes: printflike, messagelike (first code is ignored) printflike.c:17:5: Function qxprint is marked messagelike, but the argument before the elipsis has type int (should be char *) Finished checking --- 5 code warnings, as expected splint-3.1.2.dfsg1/test/rc.expect0000644021234200000250000000224207475757012014256 0ustar fax rc.c: (in function f) rc.c:3:10: Observer storage returned without qualification: "a flag\"wicked cool" rc.c:3:10: Storage becomes observer Finished checking --- 1 code warning, as expected rc.c: (in function f) rc.c:3:10: Return value type int does not match declared type char *: 12 Finished checking --- 1 code warning, as expected rc2.splintrc:1:18: Setting +boolint redundant with current value rc.c: (in function f) rc.c:3:10: Observer storage returned without qualification: "a silly\"flag\"\\" rc.c:3:10: Storage becomes observer Finished checking --- 1 code warning, as expected rc2.splintrc:1:18: Setting +boolint redundant with current value rc.c: (in function f) rc.c:3:10: Unrecognized identifier: MYSTERY Finished checking --- 1 code warning, as expected rc3.splintrc:6:3: Flag dump must be followed by a string A flag is not recognized or used in an incorrect way (Use -badflag to inhibit warning) rc3.splintrc:6:3: Cannot list files in .splintrc files: internalnamelen, 73 (probable missing + or -) rc.c: (in function f) rc.c:3:10: Unrecognized identifier: MYSTERY Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/refcounts.expect0000644021234200000250000000207407577744773015702 0ustar fax refcounts.c: (in function rp_release) refcounts.c:18:13: Reference counted storage passed as only param: free (x) refcounts.c: (in function rp_temp) refcounts.c:24:10: New reference returned as temp reference: rp_create2() refcounts.c: (in function rp_f) refcounts.c:32:3: Kill reference parameter r2 (type rp) not released before assignment: r2 = rp_temp() refcounts.c:27:50: Storage r2 becomes killref refcounts.c: (in function rp_ref) refcounts.c:48:10: Reference counted storage returned without modifying reference count: x refcounts.c: (in function rp_waste) refcounts.c:63:13: New reference z2 not released before return refcounts.c:60:23: Storage z2 becomes newref refcounts.c: (in function rp_waste2) refcounts.c:71:3: New reference z2 (type rp) not released before assignment: z2 = rp_ref(z1) refcounts.c:69:23: Storage z2 becomes newref refcounts.c:72:13: New reference z2 not released before return refcounts.c:71:3: Storage z2 becomes newref Finished checking --- 7 code warnings, as expected splint-3.1.2.dfsg1/test/release.expect0000644021234200000250000000026607413453477015276 0ustar fax release.c: (in function f) release.c:25:12: Owned storage z not released before return release.c:22:7: Storage z becomes owned Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/repexpose.expect0000644021234200000250000001526507577744773015712 0ustar fax repexpose.c: (in function abst_create) repexpose.c:8:4: Arrow access from possibly null pointer a: a->name repexpose.c:5:12: Storage a may become null repexpose.c:13:3: Possible undocumented modification of p->parent through alias a->parent: a->parent = b->parent repexpose.c:16:3: Unqualified storage *globstring assigned to implicitly only: a->name = *globstring repexpose.c:17:3: Kept storage *globstring assigned to implicitly only: b->name = *globstring repexpose.c:16:3: Storage *globstring becomes kept repexpose.c:19:10: Storage a->name reachable from return value is kept (should be implicitly only) repexpose.c:17:3: Storage a->name becomes kept repexpose.c:19:10: Returned storage *a contains 1 undefined field: im repexpose.c:19:12: Storage *globstring reachable from global is kept (should be unqualified) repexpose.c:16:3: Storage *globstring becomes kept repexpose.c: (in function abst_name) repexpose.c:26:18: Released storage a->name reachable from parameter at return point repexpose.c:26:10: Storage a->name released repexpose.c: (in function abst_parent) repexpose.c:45:15: Dependent storage b->parent returned as only: b->parent repexpose.c:45:25: Only storage a not released before return repexpose.c:40:24: Storage a becomes only repexpose.c: (in function immut_name) repexpose.c:51:10: Only storage im->name returned as dependent: (im->name) repexpose.c: (in function abst_setIm) repexpose.c:57:3: Undocumented modification of a->im: a->im = im Finished checking --- 12 code warnings, as expected repexpose.c: (in function abst_create) repexpose.c:8:4: Arrow access from possibly null pointer a: a->name repexpose.c:5:12: Storage a may become null repexpose.c:13:3: Possible undocumented modification of p->parent through alias a->parent: a->parent = b->parent repexpose.c:16:3: Unqualified storage *globstring assigned to implicitly only: a->name = *globstring repexpose.c:17:3: Kept storage *globstring assigned to implicitly only: b->name = *globstring repexpose.c:16:3: Storage *globstring becomes kept repexpose.c:19:10: Storage a->name reachable from return value is kept (should be implicitly only) repexpose.c:17:3: Storage a->name becomes kept repexpose.c:19:10: Returned storage *a contains 1 undefined field: im repexpose.c:19:12: Storage *globstring reachable from global is kept (should be unqualified) repexpose.c:16:3: Storage *globstring becomes kept repexpose.c: (in function abst_name) repexpose.c:26:10: Function returns reference to parameter a: a->name repexpose.c:26:18: Released storage a->name reachable from parameter at return point repexpose.c:26:10: Storage a->name released repexpose.c: (in function abst_aval) repexpose.c:37:10: Function returns reference to parameter a: (&(a->val)) repexpose.c: (in function abst_parent) repexpose.c:45:15: Dependent storage b->parent returned as only: b->parent repexpose.c:45:25: Only storage a not released before return repexpose.c:40:24: Storage a becomes only repexpose.c: (in function immut_name) repexpose.c:51:10: Only storage im->name returned as dependent: (im->name) repexpose.c:51:10: Function returns reference to parameter im: (im->name) repexpose.c: (in function abst_setIm) repexpose.c:57:3: Undocumented modification of a->im: a->im = im Finished checking --- 15 code warnings, as expected repexpose.c: (in function abst_create) repexpose.c:8:4: Arrow access from possibly null pointer a: a->name repexpose.c:5:12: Storage a may become null repexpose.c:10:3: Assignment of mutable parameter p to component of abstract type abst exposes rep: a->parent = p repexpose.c:11:3: Assignment of mutable parameter p (through alias b) to component of abstract type abst exposes rep: a->parent = b repexpose.c:12:3: Assignment of mutable component of parameter p to component of abstract type abst exposes rep: a->parent = p->parent repexpose.c:13:3: Possible undocumented modification of p->parent through alias a->parent: a->parent = b->parent repexpose.c:13:3: Assignment of mutable component of parameter p (through alias b->parent) to component of abstract type abst exposes rep: a->parent = b->parent repexpose.c:16:3: Assignment of global globstring to component of abstract type abst exposes rep: a->name = *globstring repexpose.c:16:3: Unqualified storage *globstring assigned to implicitly only: a->name = *globstring repexpose.c:17:3: Assignment of global globstring to component of abstract type abst exposes rep: b->name = *globstring repexpose.c:17:3: Kept storage *globstring assigned to implicitly only: b->name = *globstring repexpose.c:16:3: Storage *globstring becomes kept repexpose.c:19:10: Storage a->name reachable from return value is kept (should be implicitly only) repexpose.c:17:3: Storage a->name becomes kept repexpose.c:19:10: Returned storage *a contains 1 undefined field: im repexpose.c:19:12: Storage *globstring reachable from global is kept (should be unqualified) repexpose.c:16:3: Storage *globstring becomes kept repexpose.c: (in function abst_name) repexpose.c:26:10: Function returns reference to parameter a: a->name repexpose.c:26:10: Return value exposes rep of abst: a->name repexpose.c:26:18: Released storage a->name reachable from parameter at return point repexpose.c:26:10: Storage a->name released repexpose.c: (in function abst_aval) repexpose.c:37:10: Function returns reference to parameter a: (&(a->val)) repexpose.c:37:10: Return value exposes rep of abst: (&(a->val)) repexpose.c: (in function abst_parent) repexpose.c:45:15: Dependent storage b->parent returned as only: b->parent repexpose.c:45:15: Return value exposes rep of abst: b->parent repexpose.c:45:15: Return value may expose rep of abst through alias a: b->parent repexpose.c:45:25: Only storage a not released before return repexpose.c:40:24: Storage a becomes only repexpose.c: (in function immut_name) repexpose.c:51:10: Only storage im->name returned as dependent: (im->name) repexpose.c:51:10: Function returns reference to parameter im: (im->name) repexpose.c:51:10: Return value exposes rep of immut: (im->name) repexpose.c: (in function abst_setIm) repexpose.c:57:3: Undocumented modification of a->im: a->im = im repexpose.lh:5:16: Variable globstring declared but not defined Finished checking --- 27 code warnings, as expected splint-3.1.2.dfsg1/test/returned.expect0000644021234200000250000000027107413453477015502 0ustar fax returned.c: (in function f) returned.c:6:4: Dereference of possibly null pointer s: *s returned.c:5:13: Storage s may become null Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/sharing.expect0000644021234200000250000001734407577744773015333 0ustar fax sharing1.c: (in function f) sharing1.c:12:12: Only storage x not released before return sharing1.c:8:24: Storage x becomes only sharing1.c:13:2: Only storage x not released before return sharing1.c:8:24: Storage x becomes only sharing1.c: (in function f2) sharing1.c:19:12: Only storage y not released before return sharing1.c:15:43: Storage y becomes only sharing1.c: (in function f3) sharing1.c:24:3: Only storage x assigned to shared: globshared1 = x sharing1.c:22:25: Storage x becomes only sharing1.c:25:2: Only storage x not released before return sharing1.c:22:25: Storage x becomes only sharing1.c: (in function f4) sharing1.c:29:3: Only storage zonly (type int *) not released before assignment: zonly = x sharing1.c:6:19: Storage zonly becomes only sharing1.c: (in function g) sharing1.c:41:7: Implicitly temp storage imp passed as only param: f3 (imp) sharing1.c:42:4: Variable imp used after being released sharing1.c:41:7: Storage imp released sharing1.c:44:12: Immediate address &x passed as only param: f (&x, ...) sharing1.c:44:12: Parameter 1 (&x) to function f is declared only but is aliased by parameter 2 (&x) sharing1.c:48:14: Possibly null storage y3 passed as non-null param: f2 (y3, ...) sharing1.c:37:13: Storage y3 may become null sharing1.c:48:14: Passed storage y3 not completely defined (*y3 is undefined): f2 (y3, ...) sharing1.c:37:33: Storage *y3 allocated sharing1.c:48:18: Parameter 2 (y3) to function f2 is declared only but is aliased by parameter 1 (y3) sharing1.c:50:4: Variable y3 used after being released sharing1.c:48:18: Storage y3 released sharing1.c:51:12: Possibly null storage y passed as non-null param: f (y, ...) sharing1.c:35:12: Storage y may become null sharing1.c:51:12: Passed storage y not completely defined (*y is undefined): f (y, ...) sharing1.c:35:32: Storage *y allocated sharing1.c:52:12: Shared storage globshared1 passed as only param: f (globshared1, ...) sharing1.c:4:19: Storage globshared1 becomes shared sharing1.c:56:9: Shared storage globshared2 passed as only param: free (globshared2) sharing1.c:5:19: Storage globshared2 becomes shared sharing1.c:59:11: Variable y used after being released sharing1.c:51:12: Storage y released sharing1.c:59:13: Fresh storage y2 not released before return sharing1.c:36:33: Fresh storage y2 created sharing1.c:59:13: Function returns with global globonly referencing released storage sharing1.c:57:9: Storage globonly released Finished checking --- 21 code warnings, as expected sharing3.c: (in function string_copy) sharing3.c:17:10: Implicitly temp storage s returned as only: s sharing3.c: (in function string_free1) sharing3.c:32:9: Implicitly temp storage s passed as only param: free (s) sharing3.c: (in function string_free3) sharing3.c:45:2: Fresh storage t not released before return sharing3.c:42:29: Fresh storage t created Finished checking --- 3 code warnings, as expected sharing4.c: (in function f) sharing4.c:18:3: Only storage globonly1 (type char *) not released before assignment: globonly1 = only1 sharing4.c:1:20: Storage globonly1 becomes only sharing4.c:23:3: Only storage globonly4 (type char *) not released before assignment: globonly4 = shared1 sharing4.c:4:20: Storage globonly4 becomes only sharing4.c:23:3: Shared storage shared1 assigned to only: globonly4 = shared1 sharing4.c:14:26: Storage shared1 becomes shared sharing4.c:27:3: Only storage globonly5 assigned to shared: globshared1 = globonly5 sharing4.c:5:20: Storage globonly5 becomes only sharing4.c:30:3: Only storage globonly1 assigned to shared (local1 aliases globonly1): globshared1 = local1 sharing4.c:1:20: Storage globonly1 becomes only sharing4.c:30:3: Kept storage only1 assigned to shared (local1 aliases only1): globshared1 = local1 sharing4.c:18:3: Storage only1 becomes kept sharing4.c:32:3: Only storage assigned to shared: globshared1 = string_copy(local1) sharing4.c:34:3: Temp storage temp2 assigned to shared: globshared2 = temp2 sharing4.c:13:37: Storage temp2 becomes temp sharing4.c:35:3: Only storage globonly4 (type char *) not released before assignment: globonly4 = temp1 sharing4.c:4:20: Storage globonly4 becomes only sharing4.c:35:3: Implicitly temp storage temp1 assigned to only: globonly4 = temp1 sharing4.c:38:9: Shared storage shared1 passed as only param: free (shared1) sharing4.c:14:26: Storage shared1 becomes shared sharing4.c:42:12: Only storage only3 not released before return sharing4.c:12:72: Storage only3 becomes only sharing4.c:42:12: Function returns with global globonly3 referencing released storage sharing4.c:21:9: Storage globonly3 released Finished checking --- 13 code warnings, as expected sharing4.c: (in function f) sharing4.c:18:3: Only storage globonly1 (type char *) not released before assignment: globonly1 = only1 sharing4.c:1:20: Storage globonly1 becomes only sharing4.c:23:3: Only storage globonly4 (type char *) not released before assignment: globonly4 = shared1 sharing4.c:4:20: Storage globonly4 becomes only sharing4.c:23:3: Shared storage shared1 assigned to only: globonly4 = shared1 sharing4.c:14:26: Storage shared1 becomes shared sharing4.c:27:3: Only storage globonly5 assigned to shared: globshared1 = globonly5 sharing4.c:5:20: Storage globonly5 becomes only sharing4.c:30:3: Only storage globonly1 assigned to shared (local1 aliases globonly1): globshared1 = local1 sharing4.c:1:20: Storage globonly1 becomes only sharing4.c:30:3: Kept storage only1 assigned to shared (local1 aliases only1): globshared1 = local1 sharing4.c:18:3: Storage only1 becomes kept sharing4.c:32:3: Only storage assigned to shared: globshared1 = string_copy(local1) sharing4.c:34:3: Temp storage temp2 assigned to shared: globshared2 = temp2 sharing4.c:13:37: Storage temp2 becomes temp sharing4.c:35:3: Only storage globonly4 (type char *) not released before assignment: globonly4 = temp1 sharing4.c:4:20: Storage globonly4 becomes only sharing4.c:38:9: Shared storage shared1 passed as only param: free (shared1) sharing4.c:14:26: Storage shared1 becomes shared sharing4.c:42:12: Only storage only3 not released before return sharing4.c:12:72: Storage only3 becomes only sharing4.c:42:12: Function returns with global globonly3 referencing released storage sharing4.c:21:9: Storage globonly3 released Finished checking --- 12 code warnings, as expected sharing5.c: (in function f) sharing5.c:13:4: Variable only1 used after being released sharing5.c:12:9: Storage only1 released sharing5.c:22:5: Clauses exit with local2 referencing local storage in true branch, shared storage in false branch sharing5.c:21:7: Storage local2 becomes shared sharing5.c:24:9: Shared storage shared passed as only param (local2 aliases shared): free (local2) sharing5.c:5:27: Storage shared becomes shared sharing5.c:27:4: Dereference of possibly null pointer localp: *localp sharing5.c:26:12: Storage localp may become null sharing5.c:32:3: Fresh storage localp (type char **) not released before assignment: localp = &only3 sharing5.c:26:3: Fresh storage localp created sharing5.c:33:2: Only storage only3 not released before return sharing5.c:4:73: Storage only3 becomes only Finished checking --- 6 code warnings, as expected splint-3.1.2.dfsg1/test/simplebufferConstraintTests.expect0000644021234200000250000000224407671271606021425 0ustar fax m.c: (in function t) m.c:9:1: Index of possibly null pointer f: f m.c:8:5: Storage f may become null sizeof.c: (in function f) sizeof.c:17:1: Likely out-of-bounds store: x[(sizeof(x))] Unable to resolve constraint: requires 2 >= 3 needed to satisfy precondition: requires maxSet(x @ sizeof.c:17:1) >= 3 test3.c:2:6: Function t defined more than once m.c:11:1: Previous definition of t test3.c: (in function t) test3.c:9:3: Likely out-of-bounds store: g[101] Unable to resolve constraint: requires 99 >= 101 needed to satisfy precondition: requires maxSet(g @ test3.c:9:3) >= 101 test7.c:2:6: Function t defined more than once m.c:11:1: Previous definition of t test7.c: (in function t) test7.c:6:3: Possible out-of-bounds store: g[2] Unable to resolve constraint: requires maxSet(g @ test7.c:4:3) >= 4 needed to satisfy precondition: requires maxSet(g @ test7.c:6:3) >= 2 test7.c:8:3: Possible out-of-bounds store: j[0] Unable to resolve constraint: requires maxSet(j @ test7.c:8:3) >= 0 needed to satisfy precondition: requires maxSet(j @ test7.c:8:3) >= 0 Finished checking --- 7 code warnings, as expected splint-3.1.2.dfsg1/test/sizeof.expect0000644021234200000250000000040307413453477015146 0ustar fax sizeof.c: (in function main) sizeof.c:6:3: Possible out-of-bounds store: Unable to resolve constraint: requires 2 >= 3 needed to satisfy precondition: requires maxSet(x @ sizeof.c:6:3) >= 3 Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/sizeoftest.expect0000644021234200000250000000042007671271606016043 0ustar fax sizeof.c: (in function main) sizeof.c:6:2: Likely out-of-bounds store: x[(sizeof(x))] Unable to resolve constraint: requires 2 >= 3 needed to satisfy precondition: requires maxSet(x @ sizeof.c:6:2) >= 3 Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/slovaknames.expect0000644021234200000250000000650007415132350016160 0ustar fax slovaknames.c: (in function pivoYedno) slovaknames.c:15:11: Left operand of == is abstract type (pivo): p == 1 An abstraction barrier is broken. If necessary, use /*@access @*/ to allow access to an abstract type. (Use -abstract to inhibit warning) Finished checking --- 1 code warning, as expected Finished checking --- no warnings slovaknames.c:5:5: Variable michelobLight name violates Slovak naming convention. Slovak prefix michelob is not the name of a type. Variable name is not consistent with Slovak naming convention. (Use either -slovakvars or -namechecks to inhibit warning) slovaknames.c:19:5: Function samAdams name violates Slovak naming convention. Slovak prefix sam is not the name of a type. Function or iterator name is not consistent with Slovak naming convention. (Use either -slovakfcns or -namechecks to inhibit warning) slovaknames.c:32:5: Function budweiser name is not consistent with Slovak naming convention. Accessible types: pivo Function or iterator name is not consistent with Slovak naming convention. (Use either -slovakfcns or -namechecks to inhibit warning) Finished checking --- 3 code warnings, as expected slovaknames.c:19:5: Function samAdams name violates Slovak naming convention. Slovak prefix sam is not the name of a type. Function or iterator name is not consistent with Slovak naming convention. (Use either -slovakfcns or -namechecks to inhibit warning) slovaknames.c:32:5: Function budweiser name is not consistent with Slovak naming convention. Accessible types: pivo Function or iterator name is not consistent with Slovak naming convention. (Use either -slovakfcns or -namechecks to inhibit warning) Finished checking --- 2 code warnings, as expected slovaknames.c:4:5: Variable pivoPyet name violates Slovak naming convention. Slovak prefix pivo names an abstract type that is not accessible. Use +accessslovak to allow access to type in functions named _. slovaknames.c:5:5: Variable michelobLight name violates Slovak naming convention. Slovak prefix michelob is not the name of a type. Variable name is not consistent with Slovak naming convention. (Use either -slovakvars or -namechecks to inhibit warning) slovaknames.c:8:17: Constant pivoDevenast name violates Slovak naming convention. Slovak prefix pivo names an abstract type that is not accessible. Use +accessslovak to allow access to type in functions named _. slovaknames.c:11:6: Function pivoYedno name violates Slovak naming convention. Slovak prefix pivo names an abstract type that is not accessible. Use +accessslovak to allow access to type in functions named _. slovaknames.c: (in function pivoYedno) slovaknames.c:15:11: Left operand of == is abstract type (pivo): p == 1 An abstraction barrier is broken. If necessary, use /*@access @*/ to allow access to an abstract type. (Use -abstract to inhibit warning) slovaknames.c:19:5: Function samAdams name violates Slovak naming convention. Slovak prefix sam is not the name of a type. slovaknames.c:32:5: Function budweiser name is not consistent with Slovak naming convention. Accessible types: pivo Finished checking --- 7 code warnings, as expected splint-3.1.2.dfsg1/test/specclauses.expect0000644021234200000250000001016207536414705016161 0ustar fax specclauses.c: (in function f) specclauses.c:24:28: Only storage r.name (type char *) derived from variable declared in this scope is not released (memory leak) specclauses.c:28:24: Undefined storage r.name corresponds to storage listed in uses clause of called function: r specclauses.c:28:28: Only storage name not released before return specclauses.c:17:49: Storage name becomes only specclauses.c:33:16: Allocated storage r.name corresponds to storage listed in defines clause of called function: &r specclauses.c:34:17: Only storage r.name (type char *) derived from variable declared in this scope is not released (memory leak) specclauses.c:40:23: Field r.name used after being released specclauses.c:39:17: Storage r.name released Finished checking --- 6 code warnings, as expected specclauses2.c:10:13: Allocates clauses includes r->year of non-dynamically allocated type int specclauses2.c: (in function allocYear) specclauses2.c:14:2: Unallocated storage r->year corresponds to storage listed in allocates clause specclauses2.c: (in function setName1) specclauses2.c:26:2: Undefined storage r->name corresponds to storage listed in defines clause specclauses2.c: (in function setName3) specclauses2.c:37:2: Undefined storage r->name corresponds to storage listed in sets clause This sub-reference is undefined: *(r->name) specclauses2.c: (in function setName4) specclauses2.c:42:3: Implicitly only storage r->name (type char *) not released before assignment: r->name = name specclauses2.c: (in function allocName2) specclauses2.c:54:2: Unallocated storage r->name corresponds to storage listed in allocates clause specclauses2.c: (in function freeName2) specclauses2.c:65:2: Unreleased storage r.name corresponds to storage listed in releases clause specclauses2.c: (in function freeName4) specclauses2.c:76:2: Unreleased storage r->name corresponds to storage listed in releases clause Finished checking --- 8 code warnings, as expected specclauses3.c:7:6: Special clause accesses field of non-struct or union result (int): *(result).name specclauses3.c: (in function badResult) specclauses3.c:12:10: Null storage returned as non-null: NULL specclauses3.c: (in function createName2) specclauses3.c:29:10: Undefined storage res->name corresponds to storage result->name listed in defines clause: res specclauses3.c:29:10: Possibly null storage res returned as non-null: res specclauses3.c:28:16: Storage res may become null specclauses3.c: (in function createName4) specclauses3.c:55:10: Unallocated storage res->name corresponds to storage result->name listed in allocates clause: res Finished checking --- 5 code warnings, as expected specclauses4.c: (in function usename) specclauses4.c:13:4: Dereference of null pointer *name: **name specclauses4.c:11:8: Storage *name becomes null specclauses4.c: (in function callname) specclauses4.c:27:12: Non-null storage *s corresponds to storage listed in requires isnull clause of called function: s specclauses4.c: (in function nullname2) specclauses4.c:42:2: Non-null storage *name corresponds to storage listed in ensures isnull clause Finished checking --- 3 code warnings, as expected specclauses5.c: (in function createrecord2) specclauses5.c:31:10: Null storage r->name derivable from return value: r specclauses5.c:30:14: Storage r->name becomes null specclauses5.c: (in function newrecord2) specclauses5.c:43:10: Non-observer storage r->name corresponds to storage result->name listed in ensures observer clause: r specclauses5.c: (in function createrecordx) specclauses5.c:49:10: Observer storage r->name reachable from unqualified return value specclauses5.c:48:14: Storage r->name becomes observer Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/special.expect0000644021234200000250000001227207413453477015276 0ustar fax special.c: (in function f) special.c:17:34: Variable c used before definition special.c:19:31: Format argument 1 to printf (%d) expects int gets long int: li special.c:19:17: Corresponding format code special.c:20:46: Format argument 2 to printf (%d) expects int gets long int: li special.c:20:21: Corresponding format code special.c:20:50: Format argument 3 to printf (%hd) expects short int gets int: i special.c:20:25: Corresponding format code special.c:27:19: Variable s used before definition special.c:29:28: Format argument 1 to printf (%+14.3i) expects int gets char: c special.c:29:24: Corresponding format code special.c:29:3: Format string for printf has 1 arg, given 2 special.c:30:38: Format argument 1 to fprintf (%+14.33i) expects int gets char: c special.c:30:34: Corresponding format code special.c:30:3: Format string for fprintf has 1 arg, given 2 special.c:31:25: Format argument 1 to printf (%d) expects int gets char: c special.c:31:15: Corresponding format code special.c:31:28: Format argument 2 to printf (%f) expects double gets int: i special.c:31:18: Corresponding format code special.c:31:3: No argument corresponding to printf format code 3 (%f): "%% %d %f %f" special.c:31:21: Corresponding format code special.c:34:40: Format argument 1 to scanf (%d) expects int * gets int: i special.c:34:36: Corresponding format code special.c:37:54: Format argument 1 to fscanf (%d) expects int * gets int: i special.c:37:44: Corresponding format code special.c:37:57: Format argument 2 to fscanf (%c) expects char * gets char: c special.c:37:47: Corresponding format code special.c:37:60: Format argument 3 to fscanf (%s) expects char * gets char **: &s special.c:37:50: Corresponding format code special.c:40:10: Undocumented modification of gi possible from call to fscanf: fscanf(stdin, "hullo, welcome to %23d %c %s", &gi, &gc, gs) special.c:40:10: Undocumented modification of gc possible from call to fscanf: fscanf(stdin, "hullo, welcome to %23d %c %s", &gi, &gc, gs) special.c:40:10: Undocumented modification of gs possible from call to fscanf: fscanf(stdin, "hullo, welcome to %23d %c %s", &gi, &gc, gs) special.c:42:10: Undocumented modification of gs possible from call to fscanf: fscanf(stdin, "hullo, welcome to %*23d %*c %s", gs) Finished checking --- 20 code warnings, as expected special.c: (in function f) special.c:17:34: Variable c used before definition special.c:19:31: Format argument 1 to printf (%d) expects int gets long int: li special.c:19:17: Corresponding format code special.c:20:43: Format argument 1 to printf (%ld) expects long int gets int: i special.c:20:18: Corresponding format code special.c:20:46: Format argument 2 to printf (%d) expects int gets long int: li special.c:20:21: Corresponding format code special.c:20:50: Format argument 3 to printf (%hd) expects short int gets int: i special.c:20:25: Corresponding format code special.c:20:60: Format argument 5 to printf (%d) expects int gets short int: silly special.c:20:32: Corresponding format code special.c:27:19: Variable s used before definition special.c:29:28: Format argument 1 to printf (%+14.3i) expects int gets char: c special.c:29:24: Corresponding format code special.c:29:3: Format string for printf has 1 arg, given 2 special.c:30:38: Format argument 1 to fprintf (%+14.33i) expects int gets char: c special.c:30:34: Corresponding format code special.c:30:3: Format string for fprintf has 1 arg, given 2 special.c:31:25: Format argument 1 to printf (%d) expects int gets char: c special.c:31:15: Corresponding format code special.c:31:28: Format argument 2 to printf (%f) expects double gets int: i special.c:31:18: Corresponding format code special.c:31:3: No argument corresponding to printf format code 3 (%f): "%% %d %f %f" special.c:31:21: Corresponding format code special.c:34:40: Format argument 1 to scanf (%d) expects int * gets int: i special.c:34:36: Corresponding format code special.c:37:54: Format argument 1 to fscanf (%d) expects int * gets int: i special.c:37:44: Corresponding format code special.c:37:57: Format argument 2 to fscanf (%c) expects char * gets char: c special.c:37:47: Corresponding format code special.c:37:60: Format argument 3 to fscanf (%s) expects char * gets char **: &s special.c:37:50: Corresponding format code special.c:40:10: Undocumented modification of gi possible from call to fscanf: fscanf(stdin, "hullo, welcome to %23d %c %s", &gi, &gc, gs) special.c:40:10: Undocumented modification of gc possible from call to fscanf: fscanf(stdin, "hullo, welcome to %23d %c %s", &gi, &gc, gs) special.c:40:10: Undocumented modification of gs possible from call to fscanf: fscanf(stdin, "hullo, welcome to %23d %c %s", &gi, &gc, gs) special.c:42:10: Undocumented modification of gs possible from call to fscanf: fscanf(stdin, "hullo, welcome to %*23d %*c %s", gs) Finished checking --- 22 code warnings, as expected splint-3.1.2.dfsg1/test/stack.expect0000644021234200000250000000116307577744773014775 0ustar fax stack.c: (in function stack1) stack.c:10:2: Stack-allocated storage *x reachable from parameter x stack.c:9:3: Storage *x becomes stack-allocated storage stack.c:10:2: Stack-allocated storage glob reachable from global glob stack.c:8:3: Storage glob becomes stack-allocated storage stack.c: (in function f) stack.c:20:14: Stack-allocated storage &x reachable from return value: &x stack.c:31:11: Stack-allocated storage sa reachable from return value: sa stack.c:35:11: Stack-allocated storage sa reachable from return value: &sa[0] Finished checking --- 5 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/staticarray.expect0000644021234200000250000000074007413453477016201 0ustar fax staticarray.c: (in function foo1) staticarray.c:9:10: Unqualified static storage buf returned as implicitly only: buf staticarray.c: (in function f) staticarray.c:22:10: Implicitly temp storage outstr returned as implicitly only: outstr staticarray.c: (in function g) staticarray.c:27:10: Implicitly temp storage outstr returned as implicitly only: outstr Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/strchr.expect0000644021234200000250000000043607577744773015177 0ustar fax strchr.c: (in function func) strchr.c:5:4: Dereference of possibly null pointer c: *c strchr.c:4:7: Storage c may become null strchr.c:5:3: Suspect modification of observer c: *c = 'd' strchr.c:4:7: Storage *c becomes observer Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/strings.expect0000644021234200000250000000202607577744773015360 0ustar fax strings.c:21:6: Function main declared to return void, should return int strings.c: (in function main) strings.c:24:14: Function call may modify observer: "hullo" strings.c:24:14: Storage becomes observer strings.c:25:7: Observer storage passed as only param: f3 ("hullo") strings.c:25:7: Storage becomes observer Finished checking --- 3 code warnings, as expected strings.c:21:6: Function main declared to return void, should return int Finished checking --- 1 code warning, as expected strings.c: (in function main) strings.c:23:14: Call to unconstrained function f1 may modify observer: "hullo" strings.c:23:14: Storage becomes observer strings.c:24:14: Function call may modify observer: "hullo" strings.c:24:14: Storage becomes observer strings.c:25:7: Call to unconstrained function f3 may modify observer: "hullo" strings.c:25:7: Storage becomes observer strings.c:25:7: Observer storage passed as only param: f3 ("hullo") strings.c:25:7: Storage becomes observer Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/structassign.expect0000644021234200000250000000152407577744773016422 0ustar fax structassign.c: (in function copyrecord) structassign.c:15:15: Released storage x.name reachable from parameter at return point structassign.c:14:19: Storage x.name released structassign.c: (in function copyrecord2) structassign.c:23:15: Released storage x.name reachable from parameter at return point structassign.c:22:3: Storage x.name released structassign.c: (in function copyrecord3) structassign.c:28:12: Released storage x.name reachable from parameter at return point structassign.c:28:12: Storage x.name released structassign.c: (in function main) structassign.c:45:14: Only storage rc.name (type char *) derived from variable declared in this scope is not released (memory leak) Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/tainted.expect0000644021234200000250000001246607512352624015303 0ustar fax tainted.c: (in function f) tainted.c:5:20: Invalid transfer from tainted s to untainted (Possibly tainted storage used as untainted.): f(..., s, ...) tainted.c:3:48: s becomes tainted tainted.c:3:74: us becomes untainted tainted.c: (in function test) tainted.c:12:18: Invalid transfer from tainted s to untainted (Possibly tainted storage used as untainted.): system(..., s, ...) tainted.c:9:34: s becomes tainted tainted.xh:26:55: s becomes untainted tainted.c:17:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) tainted.c:15:3: t becomes tainted tainted.xh:26:55: s becomes untainted tainted.c:20:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) tainted.c:19:3: t becomes tainted tainted.xh:26:55: s becomes untainted Finished checking --- 4 code warnings, as expected tainted-bad.mts:18:7: Transfer clause uses unrecognized result state peach: untainted as tainted ==> peach tainted-bad.mts:14:17: Merge clause uses unrecognized second value junky: tainted X junky ==> error "Splat!" tainted-bad.mts:11:7: Annotation declaration uses unrecognized value name blue: maybetainted reference ==> blue tainted-bad.mts:5:21: Defaults declaration uses unrecognized value name stainted: stainted reference tainted-bad.mts:7:21: Duplicate defaults declaration for context parameter: untainted parameter tainted.c: (in function f) tainted.c:5:20: Invalid transfer from tainted s to untainted (Possibly tainted storage used as untainted.): f(..., s, ...) tainted.c:3:48: s becomes tainted tainted.c:3:74: us becomes untainted tainted.c: (in function test) tainted.c:12:18: Invalid transfer from tainted s to untainted (Possibly tainted storage used as untainted.): system(..., s, ...) tainted.c:9:34: s becomes tainted tainted.xh:26:55: s becomes untainted tainted.c:17:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) tainted.c:15:3: t becomes tainted tainted.xh:26:55: s becomes untainted tainted.c:20:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) tainted.c:15:3: t becomes tainted tainted.xh:26:55: s becomes untainted Finished checking --- 9 code warnings, as expected tainted2.c: (in function test) tainted2.c:20:10: Invalid transfer from tainted stk to untainted (Possibly tainted storage used as untainted.): return stk tainted2.c:17:14: stk becomes tainted tainted2.c:4:2: becomes untainted Finished checking --- 1 code warning, as expected tainted3.c: (in function test) tainted3.c:7:19: Invalid transfer from tainted def to untainted (Possibly tainted storage used as untainted.): checkUntainted(..., def, ...) tainted3.c:4:36: def becomes tainted tainted3.c:1:53: def becomes untainted Finished checking --- 1 code warning, as expected tainted4.c: (in function test) tainted4.c:9:19: Invalid transfer from tainted def to untainted (*def): Possibly tainted storage used as untainted. tainted4.c:6:36: def becomes tainted Finished checking --- 1 code warning, as expected Finished checking --- no warnings taintedmerge.c: (in function f) taintedmerge.c:11:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) taintedmerge.c:10:3: t becomes tainted tainted.xh:26:55: s becomes untainted taintedmerge.c:14:18: Invalid transfer from tainted t to untainted (Possibly tainted storage used as untainted.): system(..., t, ...) taintedmerge.c:13:3: t becomes tainted tainted.xh:26:55: s becomes untainted taintedmerge.c:16:10: Stack-allocated storage t reachable from return value: t Finished checking --- 3 code warnings, as expected taintedimplicit.c: (in function dangerouscall) taintedimplicit.c:17:18: Invalid transfer from tainted [result of taintme] to untainted (Possibly tainted storage used as untainted.): system(..., taintme(s), ...) taintedimplicit.c:17:18: becomes tainted tainted.xh:26:55: s becomes untainted Finished checking --- 1 code warning, as expected sprintf.c: (in function sp) sprintf.c:7:3: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf sprintf.c:10:3: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf sprintf.c:11:18: Invalid transfer from tainted s to untainted (Possibly tainted storage used as untainted.): system(..., s, ...) sprintf.c:10:37: s becomes tainted tainted.xh:26:55: s1 becomes untainted sprintf.c:13:3: Buffer overflow possible with sprintf. Recommend using snprintf instead: sprintf sprintf.c:14:18: Invalid transfer from tainted s to untainted (Possibly tainted storage used as untainted.): system(..., s, ...) sprintf.c:13:61: s becomes tainted tainted.xh:26:55: s1 becomes untainted Finished checking --- 5 code warnings, as expected splint-3.1.2.dfsg1/test/tests2.2.expect0000644021234200000250000000701707650577033015241 0ustar fax boolops.c: (in function main) boolops.c:12:3: Assignment of int to Kzam: b = 12 Finished checking --- 1 code warning, as expected mbool.h:1:17: Type implemented as macro: bool Finished checking --- 1 code warning, as expected boolenum.c: (in function main) boolenum.c:11:8: Use of == with BOOLEAN variables (risks inconsistency because of multiple true values): a == TRUE Finished checking --- 1 code warning, as expected break.c: (in function f) break.c:9:4: Dereference of possibly null pointer x: *x break.c:1:24: Storage x may become null Finished checking --- 1 code warning, as expected bstring.c:4:14: Initial value of s4[0] is type char *, expects char: "hullo" bstring.c:4:23: Initial value of s4[1] is type char *, expects char: "g'bye" Finished checking --- 2 code warnings, as expected decl.c:3:21: Structure struct tm declared with fields { int x; }, specified with fields { int tm_sec; int tm_min; int tm_hour;, ... } load file standard.lcd: Specification of struct tm decl.c:3:17: Field tm_sec in specified corresponds to x in declaration load file standard.lcd: Specification of tm_sec Finished checking --- 1 code warning, as expected Finished checking --- no warnings enumbool.c:1:16: Enumerator member false declared with inconsistent type: enum { false, true } load file standard.lcd: Specification of false: bool enumbool.c:1:27: Enumerator member true declared with inconsistent type: enum { false, true } load file standard.lcd: Specification of true: bool enumbool.c:1:34: Member of boolean enumerated type definition does not match name set to represent true or false: false enumbool.c:1:34: Member of boolean enumerated type definition does not match name set to represent true or false: true Finished checking --- 4 code warnings, expected 2 Finished checking --- no warnings extension.c:2:18: Parse Error: New function scope inside function. (For help on parse errors, see splint -help parseerrors.) *** Cannot continue. Finished checking --- no warnings nestext.c: (in function f) nestext.c:3:26: Declaration using extern inside function scope: int test(void) Finished checking --- 1 code warning, as expected sizeofarray.c:1:12: Function parameter x declared as manifest array (size constant is meaningless) sizeofarray.c: (in function f) sizeofarray.c:5:13: Parameter to sizeof is an array-type function parameter: sizeof((x)) sizeofarray.c:10:16: Return value type size_t does not match declared type int: sizeof((a)) Finished checking --- 3 code warnings, as expected rex.c: (in function main) rex.c:19:12: Only storage re.parent (type struct rx_hash *) derived from variable declared in this scope is not released (memory leak) rex.c:19:12: Only storage *(re.children)->parent (type struct rx_hash *) derived from variable declared in this scope is not released (memory leak) rex.c:19:12: Only storage *(*(re.children)->children)->parent (type struct rx_hash *) derived from variable declared in this scope is not released (memory leak) rex.c:19:12: Only storage *(*(*(re.children)->children)->children)->parent (type struct rx_hash *) derived from variable declared in this scope is not released (memory leak) Finished checking --- 4 code warnings, as expected struct.c:13:6: Function main declared to return void, should return int Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/tests2.2a.expect0000644021234200000250000001221007142107132015352 0ustar fax erik.c: (in function main) erik.c:6:4: Return value (type int) ignored: scanf("%lf %f", ... Finished LCLint checking --- 1 code error found, as expected boolcomp.c: (in function f) boolcomp.c:5:7: Use of == with bool variables (risks inconsistency because of multiple true values): a == b boolcomp.c:9:13: Use of == with bool variables (risks inconsistency because of multiple true values): a == b boolcomp.c:11:6: Use of != with bool variables (risks inconsistency because of multiple true values): a != b boolcomp.c:16:6: Use of == with bool variables (risks inconsistency because of multiple true values): b == TRUE boolcomp.c:20:2: Path with no return in function declared to return int Finished LCLint checking --- 5 code errors found, as expected Finished LCLint checking --- no code errors found addassign.c: (in function hash) addassign.c:7:7: Incompatible types for += (int, char): h += *name++ Finished LCLint checking --- 1 code error found, as expected toralf.c: (in function func1) toralf.c:14:3: Incompatible types for += (char *, char): s += 'c' toralf.c:15:3: Variable i1 used before definition toralf.c:15:9: Variable f used before definition toralf.c: (in function func2) toralf.c:23:8: Variable i2 used before definition toralf.c: (in function main) toralf.c:28:10: Null storage passed as non-null param: func1 (NULL) Finished LCLint checking --- 5 code errors found, as expected Finished LCLint checking --- no code errors found Finished LCLint checking --- no code errors found arrayparam.c:1:12: Function parameter x is incomplete type (inner array must have bounds): int [2] [] arrayparam.c:11:12: Function parameter x is incomplete type (inner array must have bounds): int [] [] arrayparam.c:16:12: Function parameter x is incomplete type (inner array must have bounds): int [] [] [2] arrayparam.c:21:12: Function parameter x is incomplete type (inner array must have bounds): int [2] [] [2] arrayparam.c:26:12: Function parameter x declared as manifest array (size constant is meaningless) Finished LCLint checking --- 5 code errors found, as expected Finished LCLint checking --- no code errors found Finished LCLint checking --- no code errors found obviousloop.c: (in function f) obviousloop.c:14:3: Unreachable code: x = 12 obviousloop.c: (in function f1) obviousloop.c:36:2: Path with no return in function declared to return int obviousloop.c: (in function f1b) obviousloop.c:59:3: Unreachable code: x = 12 obviousloop.c: (in function f2) obviousloop.c:75:3: Unreachable code: x = 12 Finished LCLint checking --- 4 code errors found, as expected bitops.c: (in function f) bitops.c:3:11: Left operand of & is not unsigned value (int): i1 & i2 bitops.c:3:11: Variable x initialized to type unsigned int, expects int: i1 & i2 bitops.c:4:21: Right operand of & is not unsigned value (int): u1 & i2 bitops.c:5:13: Left operand of & is not unsigned value (int): i1 & i2 bitops.c:5:13: Variable s initialized to type unsigned int, expects short int: i1 & i2 bitops.c:6:14: Variable s2 initialized to type int, expects short int: i1 + i2 bitops.c:9:7: Left operand of << is not unsigned value (int): i1 << 3 bitops.c:14:7: Left operand of ^ is not unsigned value (int): i1 ^ u1 bitops.c:15:12: Right operand of ^ is not unsigned value (int): u1 ^ i1 bitops.c:5:9: Variable s declared but not used bitops.c:6:9: Variable s2 declared but not used Finished LCLint checking --- 11 code errors found, as expected bitops.c: (in function f) bitops.c:5:13: Variable s initialized to type int, expects short int: i1 & i2 bitops.c:6:14: Variable s2 initialized to type int, expects short int: i1 + i2 bitops.c:9:7: Left operand of << is not unsigned value (int): i1 << 3 bitops.c:5:9: Variable s declared but not used bitops.c:6:9: Variable s2 declared but not used Finished LCLint checking --- 5 code errors found, as expected isalpha.c: (in function f) isalpha.c:5:19: Function isalpha expects arg 1 to be int gets char: c Finished LCLint checking --- 1 code error found, as expected isalpha.c: (in function f) isalpha.c:5:19: Function isalpha expects arg 1 to be int gets char: c Finished LCLint checking --- 1 code error found, as expected Finished LCLint checking --- no code errors found popik.c:7:3: Variable has unknown (implicitly int) type: dummy[0] popik.c:7:3: Variable has unknown (implicitly int) type: dummy[1] popik.c:7:3: Variable has unknown (implicitly int) type: dummy[2] popik.c:7:3: Variable has unknown (implicitly int) type: dummy[3] popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[0] popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[1] popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[2] popik.c:24:3: Variable has unknown (implicitly int) type: dummy3[3] popik.c:1:14: File static variable dummy declared but not used popik.c:10:24: File static variable dummy2 declared but not used popik.c:18:14: File static variable dummy3 declared but not used Finished LCLint checking --- 11 code errors found, as expected splint-3.1.2.dfsg1/test/tests2.3.expect0000644021234200000250000001161007121317333015220 0ustar fax pptest.c:26:21: Preprocessor command #else is not within a conditional pptest.c:28:30: Unbalanced #endif Preprocessing error for file: pptest.c *** Cannot continue. pptest.c:26:21: Preprocessor command #else is not within a conditional pptest.c:28:30: Unbalanced #endif Preprocessing error for file: pptest.c *** Cannot continue. pptest.c:26:21: Preprocessor command #else is not within a conditional pptest.c:28:30: Unbalanced #endif Preprocessing error for file: pptest.c *** Cannot continue. pptest.c:15:15: Parameter list for #define is not parseable pptest.c:22:41: Division by zero in #if pptest.c:26:21: Preprocessor command #else is not within a conditional pptest.c:28:30: Unbalanced #endif Preprocessing error for file: pptest.c *** Cannot continue. pptest2.c:1:21: invalid macro name pptest2.c:1:21: Missing white space after #define pptest2.c:3:13: invalid macro name pptest2.c:5:17: `defined' without an identifier pptest2.c:5:24: Division by zero in #if pptest2.c:5:25: mismatched parentheses in #if pptest2.c:11:1: Macro XFIG already defined pptest2.c:10: Previous definition of XFIG pptest2.c:12:1: Macro XFIG already defined pptest2.c:11: Previous definition of XFIG Preprocessing error for file: pptest2.c *** Cannot continue. Finished LCLint checking --- no code errors found fielduse.c:7:18: Field bit of unnamed structure declared but not used Finished LCLint checking --- 1 code error found, as expected Finished LCLint checking --- no code errors found Finished LCLint checking --- no code errors found Finished LCLint checking --- no code errors found func.c: (in function x) func.c:17:7: Call to non-function (type [function (void) returns int] **): (&pf) func.c:23:7: Call to non-function (type [function (void) returns int] ***): (&ppf) func.c:24:7: Call to non-function (type [function (void) returns int] **): ppf func.c:29:7: Call to non-function (type [function (void) returns int] ****): (&pppf) func.c:30:7: Call to non-function (type [function (void) returns int] ***): pppf func.c:31:7: Call to non-function (type [function (void) returns int] **): (*pppf) func.c:35:3: Invalid left-hand side of assignment (function type [function (void) returns int]): f func.c:37:3: Assignment of [function (void) returns int] * to [function (void) returns int] **: ppf = pf func.c:40:3: Assignment of [function (void) returns int] ** to [function (void) returns int] ***: pppf = ppf Finished LCLint checking --- 9 code errors found, as expected Command Line: Setting mode checks after setting mode flags will override set values of flags: exportlocal func.c: (in function x) func.c:13:9: Dereference of function type ([function (void) returns int]): *f func.c:14:10: Dereference of function type ([function (void) returns int]): *f func.c:14:9: Dereference of function type ([function (void) returns int]): **f func.c:15:11: Dereference of function type ([function (void) returns int]): *f func.c:15:10: Dereference of function type ([function (void) returns int]): **f func.c:15:9: Dereference of function type ([function (void) returns int]): ***f func.c:17:7: Call to non-function (type [function (void) returns int] **): (&pf) func.c:20:9: Dereference of function type ([function (void) returns int]): **pf func.c:21:10: Dereference of function type ([function (void) returns int]): **pf func.c:21:9: Dereference of function type ([function (void) returns int]): ***pf func.c:23:7: Call to non-function (type [function (void) returns int] ***): (&ppf) func.c:24:7: Call to non-function (type [function (void) returns int] **): ppf func.c:27:9: Dereference of function type ([function (void) returns int]): ***ppf func.c:29:7: Call to non-function (type [function (void) returns int] ****): (&pppf) func.c:30:7: Call to non-function (type [function (void) returns int] ***): pppf func.c:31:7: Call to non-function (type [function (void) returns int] **): (*pppf) func.c:35:3: Invalid left-hand side of assignment (function type [function (void) returns int]): f func.c:37:3: Assignment of [function (void) returns int] * to [function (void) returns int] **: ppf = pf func.c:40:3: Assignment of [function (void) returns int] ** to [function (void) returns int] ***: pppf = ppf func.c:3:6: Function x exported but not declared in header file func.c:43:1: Definition of x Finished LCLint checking --- 20 code errors found, as expected Finished LCLint checking --- no code errors found unnamedstruct.c:10:7: Field name reused: x unnamedstruct.c:5:9: Previous use of x Finished LCLint checking --- 1 code error found, as expected Finished LCLint checking --- no code errors found Finished LCLint checking --- no code errors found splint-3.1.2.dfsg1/test/tests2.4.expect0000644021234200000250000001016107747261242015234 0ustar fax Finished checking --- no warnings enumtest.c:1:9: Variable exported but not used outside enumtest: sig_func enumtest.c:2:10: Variable exported but not used outside enumtest: sig_func1 Finished checking --- 2 code warnings, as expected duffs.c: (in function send) duffs.c:7:8: Fall through case (no preceding break) duffs.c:8:8: Fall through case (no preceding break) duffs.c:9:8: Fall through case (no preceding break) duffs.c:10:8: Fall through case (no preceding break) duffs.c:11:8: Fall through case (no preceding break) duffs.c:12:8: Fall through case (no preceding break) duffs.c:13:8: Fall through case (no preceding break) Finished checking --- 7 code warnings, as expected Finished checking --- no warnings Finished checking --- no warnings bug2.c: (in function main) bug2.c:6:8: Fall through case (no preceding break) bug2.c:10:10: Fall through case (no preceding break) bug2.c:16:8: Fall through case (no preceding break) bug2.c:5:5: Statement after switch is not a case: printf("here 1"); bug2.c:20:2: Path with no return in function declared to return int Finished checking --- 5 code warnings, as expected bug3.c: (in function main) bug3.c:8:8: Fall through case (no preceding break) bug3.c:12:21: Variable j used before definition bug3.c:13:2: Path with no return in function declared to return int Finished checking --- 3 code warnings, as expected Finished checking --- no warnings Finished checking --- no warnings Finished checking --- no warnings hexconstants.c: (in function f) hexconstants.c:5:10: Return value type unsigned int does not match declared type int: m1 + m2 Finished checking --- 1 code warning, as expected hexconstants.c: (in function f) hexconstants.c:2:21: Variable m1 initialized to type int, expects unsigned int: 0xFF hexconstants.c:3:21: Variable m2 initialized to type int, expects unsigned int: 0142 hexconstants.c:5:10: Return value type unsigned int does not match declared type int: m1 + m2 hexconstants.c:1:5: Function f exported but not declared in header file hexconstants.c:6:1: Definition of f Finished checking --- 4 code warnings, as expected innercomment.c:1:17: Comment starts inside comment innercomment.c:16:3: Comment starts inside comment Finished checking --- 2 code warnings, as expected Finished checking --- no warnings Finished checking --- no warnings offsetof.c: (in function f) offsetof.c:10:3: Assignment of size_t to int: m = offsetof(S,u) offsetof.c:12:26: Deep field k in offsetof is not the name of a field of struct { int m; }: offsetof(S,u.s.k) Finished checking --- 2 code warnings, as expected Finished checking --- no warnings Finished checking --- no warnings Finished checking --- no warnings error.c:5:9: Variable x initialized to type char, expects int: 'a' Finished checking --- 1 code warning, as expected ulrich.c: (in function utl_calloc) ulrich.c:15:12: Possibly null storage newblock returned as non-null: newblock ulrich.c:12:16: Storage newblock may become null Finished checking --- 1 code warning, as expected cpptest.c: (in function test) cpptest.c:2:11: Variable x initialized to type char, expects int: 'a' Finished checking --- 1 code warning, as expected longlong.c: (in function llf) longlong.c:2:11: Variable m initialized to type long long, expects int: llx longlong.c:3:3: Assignment of long long to int: m = 243LL longlong.c:6:3: Assignment of long long to long int: lx = 5234LL longlong.c:9:3: Assignment of long long to long int: lx = llx Finished checking --- 4 code warnings, as expected Finished checking --- no warnings Finished checking --- no warnings Finished checking --- no warnings alignof.c: (in function f) alignof.c:2:23: Variable m initialized to type size_t, expects int: alignof(x) alignof.c:3:23: Variable n initialized to type size_t, expects int: alignof((x)) Finished checking --- 2 code warnings, as expected Spec file not found: DBL_MANT_DIG=25.lcl Command Line: Malformed option `-D' Cannot open file: DBL_MANT_DIG=25.c Cannot open file: source.c Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/tests2.5.expect0000644021234200000250000000313207577744773015255 0ustar fax Finished checking --- no warnings boolt.c: (in function test) boolt.c:7:16: Function test expects arg 1 to be pan_bool_t gets int: 2 Finished checking --- 1 code warning, as expected uconstants.c: (in function f) uconstants.c:2:16: Variable x0 declared but not used uconstants.c:3:21: Variable x1 declared but not used Finished checking --- 2 code warnings, as expected hoof.c: (in function main) hoof.c:12:16: Function init_arr expects arg 2 to be long int * gets int *: &j Finished checking --- 1 code warning, as expected Finished checking --- no warnings Finished checking --- no warnings booltest.c: (in function f) booltest.c:8:7: Test expression for if not bool, type int: i booltest.c:9:12: Return value type int does not match declared type bool: i Finished checking --- 2 code warnings, as expected Finished checking --- no warnings booltest.c: (in function f) booltest.c:9:12: Return value type int does not match declared type bool: i Finished checking --- 1 code warning, as expected Finished checking --- no warnings Finished checking --- no warnings immutable.c: (in function immutable_create) immutable.c:7:6: Arrow access from possibly null pointer res: res->x immutable.c:5:19: Storage res may become null immutable.c:8:10: Fresh storage returned as unqualified (should be only): res immutable.c:5:54: Fresh storage res created Finished checking --- 2 code warnings, as expected impabsmodule.c: (in function isTwo) impabsmodule.c:10:7: Variable var used before definition impabsmodule.c:10:12: Variable var2 used before definition Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/typequals.expect0000644021234200000250000000130607413453477015701 0ustar fax tq.h:3:45: Datatype tmixm inconsistently declared as immutable tq.lcl:3:1: Specification of tmixm tq.h:4:45: Datatype tmixa inconsistently declared as abstract type tq.lcl:5:14: Specification of tmixa tq.h:5:45: Datatype tmixi inconsistently declared as mutable tq.lcl:4:1: Specification of tmixi typequals.c: (in function f) typequals.c:6:4: Operand of * is abstract type (tam): *xtam typequals.c:7:4: Operand of * is abstract type (tai): *xtai Finished checking --- 5 code warnings, as expected typequals.c: (in function f) typequals.c:6:4: Operand of * is abstract type (tam): *xtam typequals.c:7:4: Operand of * is abstract type (tai): *xtai Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/ud.expect0000644021234200000250000000136607413453477014270 0ustar fax ud.c: (in function f) ud.c:8:7: Variable y used before definition ud.c:10:7: Variable z used before definition ud.c:25:7: Variable z3 used before definition ud.c:26:7: Variable z4 used before definition ud.c:31:7: Variable z6 used before definition ud.c:38:11: Variable j used before definition ud.c:49:6: Variable i used before definition ud.c:50:6: Variable z5 used before definition ud.c:56:7: Variable z5 used before definition Finished checking --- 9 code warnings, as expected ud2.c: (in function g) ud2.c:9:6: Unallocated storage y passed as out parameter to f1: y ud2.c: (in function h) ud2.c:20:7: Passed storage &x not completely defined: f2 (&x) ud2.c:23:7: Variable y used before definition Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/ullint.expect0000644021234200000250000000153407413453477015164 0ustar fax ullint.c: (in function main) ullint.c:24:3: Assignment of int to unsigned char: c = 0x01 ullint.c:29:11: Operands of < have incompatible types (int, size_t): i < sizeof((src)) ullint.c:35:26: Array element src[0] used before definition ullint.c:35:3: Assignment of unsigned char to pan_uint32_t: ui32 = (pan_uint32_t)((src[0] ^ 0xFC) << 30) | ((src[1] ^ 0x80) << 24) | ((src[2] ^ 0x80) << 18) | ((src[3] ^ 0x80) << 12) | ((src[4] ^ 0x80) << 6) | (src[5] ^ 0x80) ullint.c:37:3: Assignment of unsigned char to pan_uint32_t: d = c Finished checking --- 5 code warnings, as expected ullint.c: (in function main) ullint.c:29:11: Operands of < have incompatible types (int, size_t): i < sizeof((src)) ullint.c:35:26: Array element src[0] used before definition Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/ulstypes.expect0000644021234200000250000000536107413453477015547 0ustar fax ulstypes.c:3:23: Contradictory long and short type qualifiers ulstypes.c: (in function f) ulstypes.c:10:12: Function f expects arg 1 to be unsigned int gets long int: li ulstypes.c:10:3: Assignment of long int to int: loc = f(li) ulstypes.c:11:3: Assignment of long int to int: loc = f(ui) ulstypes.c:12:12: Function f expects arg 1 to be unsigned int gets int: loc ulstypes.c:12:3: Assignment of long int to int: loc = f(loc) ulstypes.c:15:10: Return value type unsigned int does not match declared type long int: x ulstypes.c:20:19: Variable x3 initialized to type int, expects unsigned int: -15 Finished checking --- 8 code warnings, as expected Finished checking --- no warnings ulstypes.c:3:23: Contradictory long and short type qualifiers ulstypes.c: (in function f) ulstypes.c:7:19: Variable loli initialized to type int, expects long int: 12 ulstypes.c:10:12: Undocumented use of global li ulstypes.c:10:12: Function f expects arg 1 to be unsigned int gets long int: li ulstypes.c:10:9: Undetected modification possible from call to unconstrained function f: f ulstypes.c:10:3: Assignment of long int to int: loc = f(li) ulstypes.c:11:12: Undocumented use of global ui ulstypes.c:11:9: Undetected modification possible from call to unconstrained function f: f ulstypes.c:11:3: Assignment of long int to int: loc = f(ui) ulstypes.c:12:12: Function f expects arg 1 to be unsigned int gets int: loc ulstypes.c:12:9: Undetected modification possible from call to unconstrained function f: f ulstypes.c:12:3: Assignment of long int to int: loc = f(loc) ulstypes.c:14:3: Assignment of int to long int: loli = loc ulstypes.c:15:10: Return value type unsigned int does not match declared type long int: x ulstypes.c:19:19: Variable x2 initialized to type int, expects unsigned int: 23 ulstypes.c:20:19: Variable x3 initialized to type int, expects unsigned int: -15 ulstypes.c:24:16: Variable x7 initialized to type int, expects short int: 14 ulstypes.c:3:21: Variable si declared but not used ulstypes.c:18:14: Variable x1 declared but not used ulstypes.c:19:14: Variable x2 declared but not used ulstypes.c:20:14: Variable x3 declared but not used ulstypes.c:21:14: Variable x4 declared but not used ulstypes.c:22:10: Variable x5 declared but not used ulstypes.c:23:10: Variable x6 declared but not used ulstypes.c:24:11: Variable x7 declared but not used ulstypes.c:1:14: Variable exported but not used outside ulstypes: ui ulstypes.c:2:10: Variable exported but not used outside ulstypes: li ulstypes.c:5:10: Function exported but not used outside ulstypes: f ulstypes.c:16:1: Definition of f Finished checking --- 28 code warnings, as expected splint-3.1.2.dfsg1/test/union.expect0000644021234200000250000000211707577744773015020 0ustar fax union.c: (in function ut_create1) union.c:16:10: Returned union *u has no defined field union.c: (in function ut_create4) union.c:40:3: Implicitly temp storage t assigned to implicitly only: u->ox = t union.c: (in function ut_create5) union.c:48:3: Implicitly temp storage t assigned to dependent: u->dx = t union.c: (in function ut_create6) union.c:57:10: Returned storage u->st contains 2 undefined fields: b, ip union.c: (in function ut_create7) union.c:66:3: Implicitly temp storage p assigned to implicitly only: u->st.ip = p union.c: (in function ut_mangle1) union.c:73:2: Released storage u->ox reachable from parameter at return point union.c:72:9: Storage u->ox released union.c: (in function ut_mangle2) union.c:78:2: Released storage u->st.ip reachable from parameter at return point union.c:77:9: Storage u->st.ip released union.c: (in function ut_mangle3) union.c:84:2: Released storage u->st.ip reachable from parameter at return point union.c:82:9: Storage u->st.ip released Finished checking --- 8 code warnings, as expected splint-3.1.2.dfsg1/test/unnamedsu.expect0000644021234200000250000000004307445016162015635 0ustar fax Finished checking --- no warnings splint-3.1.2.dfsg1/test/unreachable.expect0000644021234200000250000000173207413453477016126 0ustar fax unreachable.c: (in function f) unreachable.c:6:4: Unreachable code: x++ unreachable.c: (in function tu) unreachable.c:21:7: Unreachable code: return unreachable.c: (in function s) unreachable.c:33:29: Unreachable code: z-- unreachable.c:34:10: Fall through case (no preceding break) unreachable.c:45:4: Unreachable code: z++ Finished checking --- 5 code warnings, as expected unreachable.c: (in function s) unreachable.c:34:10: Fall through case (no preceding break) unreachable.c:46:2: Path with no return in function declared to return int Finished checking --- 2 code warnings, as expected switch.c: (in function f3) switch.c:31:2: Path with no return in function declared to return int switch.c: (in function f5) switch.c:49:6: Missing case in switch: THREE switch.c:50:2: Path with no return in function declared to return int switch.c: (in function f6) switch.c:70:2: Path with no return in function declared to return int Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/unsignedcompare.expect0000644021234200000250000000067507413453477017045 0ustar fax unsignedcompare.c: (in function test) unsignedcompare.c:5:3: Assignment of ssize_t to unsigned long int: res = read(fd, buffer, cnt) unsignedcompare.c:7:7: Comparison of unsigned value involving zero: res <= 0 unsignedcompare.c:12:7: Comparison of unsigned value involving zero: res < 0 unsignedcompare.c:12:18: Comparison of unsigned value involving zero: res >= 0 Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/unused.expect0000644021234200000250000000233107413453477015154 0ustar fax unused.c:13:6: Name _inner is in the implementation name space (any identifier beginning with underscore) unused.c:14:2: Name _st is in the implementation name space (any identifier beginning with underscore) unused.c:19:12: File static function f declared but not used unused.c:22:1: Definition of f unused.c:16:12: Function undef declared but not defined unused.c:16:12: Function undef exported but not declared in header file Finished checking --- 5 code warnings, as expected unused.c:13:6: Name _inner is in the implementation name space (any identifier beginning with underscore) unused.c:14:2: Name _st is in the implementation name space (any identifier beginning with underscore) unused.c:19:12: File static function f declared but not used unused.c:22:1: Definition of f unused.c:16:12: Function undef declared but not defined unused.c:1:14: Type dumbtype declared but not used unused.c:12:11: Field silly of structure struct _inner declared but not used unused.c:7:7: Field dumb of structure struct _st declared but not used unused.c:16:12: Function undef exported but not declared in header file Finished checking --- 8 code warnings, as expected splint-3.1.2.dfsg1/test/void.expect0000644021234200000250000000033007413453477014607 0ustar fax void.c: (in function f) void.c:5:3: Return value (type int) ignored: f() void.c:3:5: Function exported but not used outside void: f void.c:7:1: Definition of f Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/exports.h0000644021234200000250000000010207121317331014266 0ustar faxtypedef int myint; extern int glob; extern int f(int a, int b); splint-3.1.2.dfsg1/test/iter.h0000644021234200000250000000063107121317331013534 0ustar fax# define intFor(i, j, k, ___x) \ { int ___x = (i); while ((___x) <= (j)) { (___x) += (k); # define end_intFor }} # define arrayElements(i,j,a,___x)\ /* 9. Macro parameter j used more than once (in post loop test) */ { int ___c; int *(___b) = a; for (___c = (i); ___c <= (j); ___c++) { int ___x = *(___b); /* 9. j used more than once (in loop test) */ # define end_arrayElements \ (___b)++; }} splint-3.1.2.dfsg1/test/iter2.h0000644021234200000250000000071707121317331013623 0ustar fax/*@iter intFor (int i, int j, int k, yield int val); @*/ # define intFor(i, j, k, ___x) \ { int ___x = (i); while ((___x) <= (j)) { (___x) += (k); # define end_intFor }} /*@iter arrayElements (int i, int j, int *a, yield int el); @*/ # define arrayElements(i,j,a,___x)\ { int ___c; int *(___b) = a; for (___c = (i); ___c <= (j); ___c++) { int ___x = *(___b); /* 9. j used more than once (in loop test) */ # define end_arrayElements \ (___b)++; }} splint-3.1.2.dfsg1/test/minc1.h0000644021234200000250000000012007121317331013571 0ustar fax# include "minc4.h" # include "minc5.h" # include "minc2.h" # include "minc3.h" splint-3.1.2.dfsg1/test/minc2.h0000644021234200000250000000007407121317331013602 0ustar fax# include "minc3.h" # include "minc4.h" # include "minc5.h" splint-3.1.2.dfsg1/test/minc3.h0000644021234200000250000000005007121317331013575 0ustar fax# include "minc4.h" # include "minc5.h" splint-3.1.2.dfsg1/test/minc4.h0000644021234200000250000000002407121317331013577 0ustar fax# include "minc5.h" splint-3.1.2.dfsg1/test/minc5.h0000644021234200000250000000001407121317331013577 0ustar fax/* yabba */ splint-3.1.2.dfsg1/test/modifies.h0000644021234200000250000000024307121317331014367 0ustar faxextern int f1 (int p[]) /*@modifies nothing @*/ ; extern int f2 (int p[]) /*@modifies internalState @*/ ; extern int g2 (int p[]) /*@modifies internalState @*/ ; splint-3.1.2.dfsg1/test/mut.h0000644021234200000250000000004607121317331013376 0ustar faxtypedef int *mut; # include "mut.lh" splint-3.1.2.dfsg1/test/pivo.h0000644021234200000250000000004107121317332013542 0ustar faxtypedef /*@abstract@*/ int pivo; splint-3.1.2.dfsg1/test/repexpose.h0000644021234200000250000000033607320411667014615 0ustar fax# include "bool.h" typedef struct s_abst *abst; typedef struct { char *name; int val; } *immut; struct s_abst { char *name; int val; /*@dependent@*/ abst parent; immut im; } ; # include "repexpose.lh" splint-3.1.2.dfsg1/test/tq.h0000644021234200000250000000070607121317332013221 0ustar faxtypedef /*@abstract@*/ /*@mutable@*/ int *tam; typedef /*@abstract@*/ /*@immutable@*/ int *tai; typedef /*@abstract@*/ /*@immutable@*/ int *tmixm; /* 1. inconsistently declared as immutable */ typedef /*@abstract@*/ /*@immutable@*/ int *tmixa; /* 2. inconsistently declared as abstract type */ typedef /*@abstract@*/ /*@mutable@*/ int *tmixi; /* 3. inconsistently declared as mutable */ typedef /*@mutable@*/ int *tm; typedef /*@immutable@*/ int *ti; splint-3.1.2.dfsg1/test/Makefile.os20000644021234200000250000005566407730061143014605 0ustar fax################################################## ### ### ### Makefile for LCLint testing ### ### ### ### designed for use with GNU make ### ### ### ################################################## SHELL = cmd.exe .SUFFIXES: .out .expect .c .lcl .h .lh .diff # -u show context SPLINT = ../bin/splint.exe ### This is horrible! Can't we make top_builddir absolute? SPLINTNEST = ../../bin/splint.exe SPLINTPNEST = $(SPLINTNEST) -nof SPLINTP = $(SPLINT) -nof # Make sure .splintrc files are not used so test results do not # depend on local settings. SPLINTRN = $(SPLINTP) -hints -booltype "bool" SPLINTR = $(SPLINTRN) -exportlocal +debugfcnconstraint SPLINTRNNEST = $(SPLINTPNEST) -hints -booltype "bool" SPLINTRNEST = $(SPLINTRNNEST) -exportlocal +debugfcnconstraint ### ### rcfiles not included becuase file names will not match exactly ### UNITTESTS = \ help \ abstptr abstract alias alttypes ansireserved argorder \ args arraydims arrayinit arraylit blocks break cases cast chararraylit charlit clauses commentchar compdestroy \ compoundliterals compoundstmt constannot controldepth csyntax czechnames czechoslovaknames deadparam \ decl divzero enum enumtag exports external fields flags forbody format freearray \ funcpointer functionmacro glob globals impabstract info init inparam internal iter keep libs \ linked lintcomments list longint loopexec looptesteffect \ macros macrosef merge mergenull modifies modtest moduncon \ mongoincludes mystrncat noeffect null nullret nullassign numabstract observer oldstyle outglob outparam \ parentype postnotnull preds prefixes printflike rc refcounts release repexpose \ returned sharing shifts sizesigns slovaknames \ specclauses \ special stack staticarray strings \ stringliteral \ structassign typequals typeof ud ulstypes union unioninit \ unnamedsu unreachable unsignedcompare \ unused ullint utypes void widestrings UNITEXPECTS = $(addsuffix .expect, $(UNITTESTS)) ### warnuse doesn't work yet! SUBDIRTESTS1 = metastate mergestate fileio \ simplebufferConstraintTests moreBufferTests moreBufferTests2 globalbufferannotation \ maxset strchr sizeoftest for manual SUBDIRTESTS1 = tests2.5 db1 db2 db3 SUBDIRTESTS2 = tainted tests2.2 tests2.4 SUBDIRTESTS = $(SUBDIRTESTS1) $(SUBDIRTESTS2) SPLINTTESTS = $(UNITTESTS) $(SUBDIRTESTS) QUICKTESTS = db3 all: quicktest DIFF = diff ### not real .c quicktest: $(SPLINTTESTS) .PHONY: help help: -@$(SPLINT) -@$(SPLINT) -help -@$(SPLINTP) -asdf -@$(SPLINTP) +boolint +boolint -@$(SPLINT) -help flags alpha ### Rules for tests start here .PHONY: abstptr abstptr: $(SPLINTR) abstptr -expect 9 $(SPLINTR) abstptr +voidabstract -expect 6 .PHONY: abstract abstract: $(SPLINTR) abst_t.lcl commentcmd.c -expect 15 .PHONY: alias alias: $(SPLINTR) +lh mut $(SPLINTR) mut alias +globalias -expect 19 $(SPLINTR) mut alias2 +globalias -expect 17 $(SPLINTR) +lh alias3 -expect 14 $(SPLINTR) +lh alias4 +boolint $(SPLINTR) alias4 -pred +retalias -expect 6 $(SPLINTR) +lh alias5 +memchecks -null -specundef -expect 5 .PHONY: alttypes alttypes: $(SPLINTR) alttypes.c -expect 2 ### ### evans 2001-06-07 - updated nameCheck.c to reflect C9X. ### Reports one new errors for ansireserved.c - wctomb is bad even as a local ### variable (could be a macro?) ### Reports 3 additional errors for +checks; no longer suppresses name errors ### in the presense of other errors. ### .PHONY: ansireserved ansireserved: $(SPLINTR) ansireserved.c +ansireserved -nolib -expect 9 $(SPLINTR) ansireserved.c +ansireserved +ansireservedlocal -nolib -expect 11 $(SPLINTRN) ansireserved.c +checks -exportlocal -exportheadervar -exportheader -expect 12 $(SPLINTR) ansireserved2.c +ansireserved -expect 1 .PHONY: argorder argorder: $(SPLINTR) argorder.c -expect 4 $(SPLINTR) argorder2 -expect 5 $(SPLINTR) argorder3.c -expect 8 $(SPLINTR) argorder4 -expect 9 $(SPLINTR) argorder4 -evalorder -expect 1 $(SPLINTR) argorder5.c +evalorderuncon -expect 3 .PHONY: args args: $(SPLINTR) args -noeffect -expect 12 .PHONY: arraydims arraydims: $(SPLINTR) arraydims.c -varuse -expect 2 $(SPLINTR) arraydims.c -initsize -varuse .PHONY: arrayinit arrayinit: $(SPLINTR) arrayinit.c -expect 9 .PHONY: arraylit arraylit: $(SPLINTR) arraylit.c -expect 2 $(SPLINTR) arraylit.c +stringliteralsmaller -expect 4 .PHONY: blocks blocks: $(SPLINTR) blocks.c -expect 4 $(SPLINTR) blocks.c +ifblock +elseifcomplete -expect 7 $(SPLINTR) blocks.c -ifempty +whileempty +whileblock -expect 3 $(SPLINTR) blocks.c -ifempty +forempty +forblock -expect 3 $(SPLINTR) blocks.c +allempty -expect 6 $(SPLINTRN) blocks.c +strict -exportlocal +partial -exportheader -expect 11 .PHONY: break break: $(SPLINTR) break.c -expect 4 $(SPLINTR) break.c +deepbreak -expect 6 $(SPLINTR) break.c +deepbreak -looploopbreak -expect 5 .PHONY: cases cases: $(SPLINTR) cases.c -expect 5 $(SPLINTR) cases2.c -expect 2 $(SPLINTRN) cases2.c +checks -exportlocal -exportheader -expect 3 $(SPLINTRN) cases2.c +checks -exportlocal -exportheader -branchstate -expect 3 .PHONY: cast cast: $(SPLINTR) cast -accessmodule -expect 20 $(SPLINTRN) cast2.c +checks -exportlocal -exportheader -expect 3 .PHONY: chararraylit chararraylit: $(SPLINTR) chararraylit.c -expect 2 ### Two addition errors detected with 2.5 with -numliteral. ### evans 2002-12-15: finds one more but in charlit .PHONY: charlit charlit: $(SPLINTR) +hints charlit.c -expect 4 $(SPLINTR) +hints -numliteral charlit.c -expect 6 $(SPLINTR) +hints charlit.c +charintliteral +ignoresigns -expect 1 .PHONY: clauses clauses: $(SPLINTR) clauses.c +memchecks -expect 4 $(SPLINTR) clauses2.c +memchecks $(SPLINTR) clauses3.c +memchecks -expect 2 $(SPLINTR) clauses3.c +memchecks +unixlib -expect 3 .PHONY: commentchar commentchar: $(SPLINTR) commentchar.c -expect 4 $(SPLINTR) -commentchar '#' commentchar.c -expect 4 .PHONY: controldepth controldepth: $(SPLINTR) +hints -controlnestdepth 2 controldepth.c -expect 2 $(SPLINTR) +hints -controlnestdepth 1 controldepth.c -expect 2 .PHONY: compdestroy compdestroy: $(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader -expect 1 $(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy -expect 2 $(SPLINTRN) compdestroy.c +checks -exportlocal -exportheader +strictdestroy +strictusereleased -expect 3 $(SPLINTRN) compdestroy.c +strict +partial -exportheader -expect 3 .PHONY: compoundliterals compoundliterals: ${SPLINTRN} compoundliterals.c .PHONY: compoundstmt compoundstmt: ${SPLINTRN} compoundstmt.c -expect 3 .PHONY: constannot constannot: ${SPLINTRN} constannot.c +boundswrite -exportlocal -expect 2 .PHONY: csyntax csyntax: $(SPLINTR) +quiet -incondefs csyntax.c -expect 1 $(SPLINTR) +quiet csyntax2.c -expect 2 $(SPLINTR) +quiet csyntax3.c -expect 1 $(SPLINTR) +quiet -incondefs csyntax4.c $(SPLINTR) +quiet csyntax5.c $(SPLINTR) +quiet csyntax6.c $(SPLINTR) +quiet csyntax7.c $(SPLINTR) +quiet csyntax8.c $(SPLINTR) +quiet csyntax9.c $(SPLINTR) +quiet csyntax10.c $(SPLINTR) +quiet csyntax11.c $(SPLINTR) +quiet csyntax12.c $(SPLINTR) +quiet csyntax13.c -expect 1 $(SPLINTR) +quiet csyntax14.c $(SPLINTR) +quiet csyntax15.c $(SPLINTR) +quiet csyntax16.c -expect 2 $(SPLINTR) +quiet csyntax17.c -expect 3 .PHONY: czechnames czechnames: $(SPLINTR) czechnames.c $(SPLINTR) +hints +czech czechnames.c -expect 2 $(SPLINTR) +hints +czech -czechvars czechnames.c -expect 1 $(SPLINTR) +hints +czech -accessczech czechnames.c -expect 6 .PHONY: czechoslovaknames czechoslovaknames: $(SPLINTR) +hints +czechoslovak czechnames.c -expect 1 $(SPLINTR) +hints +czechoslovak slovaknames.c -expect 1 $(SPLINTR) +hints +czechoslovak +slovakvars slovaknames.c -expect 2 ### ### deadparam added 2001-05-27 ### .PHONY: deadparam deadparam: ${SPLINTR} deadparam.c -expect 3 # # Was expect 3 before 2.4. Earlier versions did not handle implicit # function pointers correctly. # .PHONY: decl decl: $(SPLINTR) decl.c -expect 2 $(SPLINTRN) decl.c +strict -exportlocal -expect 5 $(SPLINTR) decl2 -expect 4 .PHONY: divzero divzero: $(SPLINTR) divzero.c -varuse -expect 0 .PHONY: enum enum: $(SPLINTR) enum -expect 16 $(SPLINTR) enum -misscase -expect 14 .PHONY: enumtag enumtag: $(SPLINTR) enumtag.c -expect 2 .PHONY: exports exports: $(SPLINTR) exports.c +exporttype +exportvar +exportfcn +topuse +typeuse -expect 6 $(SPLINTR) exports.c +exportany -expect 3 $(SPLINTR) exports.c .PHONY: external external: $(SPLINTR) external.c +partial $(SPLINTR) external.c +partial +distinctexternalnames +ansi89limits -expect 2 $(SPLINTR) external.c -nolib +partial -externalnamelength 3 -expect 3 $(SPLINTR) external.c -nolib +partial -externalnamelength 3 +externalnamecaseinsensitive -expect 3 $(SPLINTR) external.c +partial -externalnamelength 3 -expect 4 .PHONY: fields fields: $(SPLINTR) fields.c +memchecks -expect 6 $(SPLINTR) fields2.c +memchecks -expect 5 $(SPLINTR) fields3.c +memchecks .PHONY: flags flags: $(SPLINTR) flags.c -expect 8 $(SPLINTR) +nocomments flags.c -expect 2 ### Added 2001-06-02 .PHONY: forbody forbody: ${SPLINTR} forbody.c -expect 2 ### Added 2001-06-03 .PHONY: format format: ${SPLINTR} format.c -expect 3 ${SPLINTR} format.c -formatconst # two new errors (invalid lhs) .PHONY: funcpointer funcpointer: $(SPLINTR) +memchecks +noparams funcpointer.c -expect 18 .PHONY: functionmacro functionmacro: $(SPLINTR) functionmacro.c -expect 2 .PHONY: glob glob: $(SPLINTR) glob -expect 4 $(SPLINTR) glob -globuse -expect 3 $(SPLINTR) glob +globunspec -expect 6 .PHONY: globals globals: $(SPLINTR) -modifies globals.c -expect 5 $(SPLINTR) -modifies globals.c +allglobals -expect 6 $(SPLINTR) -modifies globals.c +impcheckedglobals -expect 6 $(SPLINTR) -modifies globals.c -globals -checkstrictglobals -expect 2 $(SPLINTR) -modifies globals.c +globunspec -expect 6 $(SPLINTR) -modifies globals.c +globunspec +allglobals -expect 8 # Was -accessfile .PHONY: impabstract impabstract: $(SPLINTR) -accessmodule impabstract.c $(SPLINTR) -accessmodule +hints +impabstract impabstract.c -expect 2 $(SPLINTR) -accessmodule +hints +impabstract impabstract -expect 4 ### ### evans 2001-12-30: Handle unrecognized pre-processor directives ### (Reported by Pierluigi Sanzani) .PHONY: info info: ${SPLINTR} info.c -expect 4 ### evans 2001-10-14: Expected errors updated .PHONY: init init: $(SPLINTR) init.c -expect 14 $(SPLINTRN) init.c +checks -exportlocal -exportheadervar -expect 17 .PHONY: inparam inparam: $(SPLINTR) inparam.c -expect 2 $(SPLINTR) +impouts inparam.c -expect 1 .PHONY: internal internal: $(SPLINTR) internal.c -expect 1 $(SPLINTR) internal.c +distinctinternalnames -expect 1 $(SPLINTR) internal.c +distinctinternalnames +ansi89limits -expect 2 $(SPLINTR) internal.c -internalnamelen 28 -expect 3 $(SPLINTR) internal.c +internalnamecaseinsensitive -expect 3 $(SPLINTR) internal.c +internalnamecaseinsensitive +internalnamelookalike -expect 11 ### ### iter ### 2001-06-06: Error message for iter.lcl:3,6 fixed to iter.lcl:3:6 ### .PHONY: iter iter: $(SPLINTR) iter -expect 14 -lclexpect 1 $(SPLINTR) iter2.c -expect 12 .PHONY: keep keep: $(SPLINTR) keep.c +memchecks -expect 6 ### libs ### 2001-05-22: 2 new errors found (fixed spec of signal) ### 2001-05-30: 3 new errors found (formatconst) ### 2002-07-08: 2 new errors found (getc modifies errno) .PHONY: libs libs: $(SPLINTR) libs.c +longunsignedunsignedintegral -expect 18 $(SPLINTR) libs.c -expect 22 $(SPLINTR) libs.c +globunspec +modunspec -expect 25 $(SPLINTR) libs.c +strictlib +globunspec +modunspec -expect 44 .PHONY: lintcomments lintcomments: $(SPLINTR) lintcomments.c -expect 5 $(SPLINTR) lintcomments.c -warnlintcomments -expect 1 $(SPLINTR) lintcomments.c -lintcomments -expect 4 .PHONY: list list: $(SPLINTR) list.c -expect 3 ### ### 2002-12-12: Added test case for +longint and +shortint flags ### .PHONY: longint longint: $(SPLINTR) longint.c -expect 3 $(SPLINTR) longint.c +longint -expect 2 $(SPLINTR) longint.c +shortint -expect 2 $(SPLINTR) longint.c +shortint +longint -expect 0 ### ### 2002-01-01: Added test case for obvious loop execution. ### .PHONY: loopexec loopexec: $(SPLINTR) loopexec.c -expect 1 $(SPLINTR) loopexec.c -obviousloopexec -expect 3 .PHONY: looptesteffect looptesteffect: $(SPLINTR) looptesteffect.c -expect 1 .PHONY: macros macros: $(SPLINTR) macros -expect 17 $(SPLINTR) macros.c +allmacros -expect 34 $(SPLINTR) macros.c +fcnmacros -expect 31 .PHONY: macrosef macrosef: $(SPLINTR) macrosef -expect 4 $(SPLINTR) macrosef.c +allmacros -expect 3 $(SPLINTR) macrosef.c +allmacros +sefuncon -expect 4 .PHONY: merge merge: $(SPLINTRN) merge.c +checks -exportlocal -exportheadervar -exportheader -expect 3 .PHONY: mergenull mergenull: $(SPLINTRN) mergenull.c .PHONY: modifies modifies: $(SPLINTR) modifies.c modclient.c +impcheckedstatics +mustmod -expect 7 .PHONY: modtest modtest: $(SPLINTR) modtest -expect 10 $(SPLINTR) modtest +modunspec -expect 13 $(SPLINTR) modtest +mustmod -expect 14 .PHONY: moduncon moduncon: $(SPLINTR) moduncon.c +moduncon -memchecks -expect 4 $(SPLINTRN) moduncon.c +strict -exportlocal -expect 22 .PHONY: mongoincludes mongoincludes: $(SPLINTR) mongoincludes.c -includenest 1 -expect 19 $(SPLINTR) mongoincludes.c -includenest 2 -expect 10 $(SPLINTR) mongoincludes.c -includenest 3 -expect 4 $(SPLINTR) mongoincludes.c -includenest 4 -expect 1 $(SPLINTR) mongoincludes.c -includenest 5 -expect 0 .PHONY: mystrncat mystrncat: $(SPLINTR) mystrncat.c +boundsread +boundswrite -expect 4 .PHONY: noeffect noeffect: ${SPLINTP} noeffect.c +allmacros +checks -expect 3 ### ### 2002-01-01: null1.c: expect increased to 15 because out must be defined ### checking detects one new error ### .PHONY: null null: $(SPLINTR) null1.c -expect 15 $(SPLINTR) null1.c -null -mustdefine -expect 4 $(SPLINTR) null2.c -expect 11 $(SPLINTR) null3.c -expect 15 $(SPLINTR) null3.c +unixlib -expect 16 $(SPLINTR) null4.c -expect 1 $(SPLINTR) null5.c -expect 4 $(SPLINTR) null6 -expect 4 $(SPLINTR) +quiet null6.lcl -dump null6 $(SPLINTR) null6.c -load null6 -expect 4 ### Added for 3.0 (bugs reported by Kevin Broady) .PHONY: nullret nullret: $(SPLINTR) nullret.c -expect 2 $(SPLINTR) -nullret nullret.c -expect 0 .PHONY: nullassign nullassign: $(SPLINTR) nullassign.c -expect 2 $(SPLINTR) -nullassign nullassign.c -expect 1 ### Added for 3.1 - evans 2002-12-14 .PHONY: numabstract numabstract: $(SPLINTR) numabstract.c -expect 11 $(SPLINTR) numabstract.c +numabstractlit -expect 9 $(SPLINTR) numabstract.c -numabstractcast -expect 10 # # Before 2.4, expected one more because error was reported both as # dependent and observer. # .PHONY: observer observer: $(SPLINTRN) observer +checks -exportlocal -exportheader -expect 9 $(SPLINTRN) observer.c +checks -exportlocal -exportheader -expect 8 $(SPLINTR) observer.c -expect 7 .PHONY: oldstyle oldstyle: $(SPLINTR) oldstyle oldstyle2.c -expect 5 .PHONY: outglob outglob: $(SPLINTR) outglob -expect 10 .PHONY: outparam outparam: $(SPLINTR) outparam -expect 12 ### evans 2001-08-26: postnotnull new .PHONY: postnotnull postnotnull: ${SPLINTR} postnotnull.c -expect 1 ### evans 2002-02-09: added parentype.c .PHONY: parentype parentype: ${SPLINTR} parentype.c # # Four new +fcnuse errors for -strict (evans 2001-07-22) # .PHONY: preds preds: $(SPLINTR) +hints preds.c -expect 6 $(SPLINTRN) +hints preds.c -weak -expect 1 $(SPLINTRN) +hints preds.c -strict -exportlocal -exportheader -expect 10 .PHONY: prefixes prefixes: $(SPLINTR) prefixes.c +partial $(SPLINTRN) prefixes.c +allmacros +checks -exportlocal +partial -exportheader -exportheadervar -expect 4 $(SPLINTR) prefixes.c -typeprefix "T" -expect 2 $(SPLINTR) prefixes.c -typeprefix "^" -expect 1 $(SPLINTR) prefixes.c -typeprefix "^*" -expect 2 $(SPLINTR) prefixes.c -typeprefix "^%*" -expect 2 $(SPLINTR) prefixes.c -typeprefix "^~*" -expect 2 $(SPLINTR) prefixes.c -typeprefix "^" +typeprefixexclude -expect 7 $(SPLINTR) prefixes.c -filestaticprefix "^^" -expect 4 $(SPLINTR) prefixes.c -filestaticprefix "^#" -expect 5 $(SPLINTR) prefixes.c -filestaticprefix "^?&x" -expect 5 $(SPLINTR) prefixes.c -globalprefix "G" -expect 1 $(SPLINTR) prefixes.c -globalprefix "&G?_^" -expect 1 $(SPLINTR) prefixes.c -externalprefix "G" -expect 5 $(SPLINTR) prefixes.c -typeprefix "T" -externalprefix "G" -expect 4 # Herbert: this does not work under OS/2 # $(SPLINTR) prefixes.c -localprefix "?*" +localprefixexclude -expect 13 .PHONY: printflike printflike: $(SPLINTR) printflike.c -expect 6 $(SPLINTR) printflike.c -warnlintcomments -expect 5 .PHONY: rc rc: # herbert unsolved problem with quoting here! # $(SPLINTR) -DMYSTERY='"a flag\"wicked cool"' rc.c -expect 1 $(SPLINTR) -DMYSTERY=12 rc.c -expect 1 $(SPLINTR) -f rc1.splintrc rc.c -expect 1 $(SPLINTR) -UMYSTERY -f rc1.splintrc rc.c -expect 1 $(SPLINTR) -f rc3.splintrc.os2 rc.c -expect 1 .PHONY: rcfiles rcfiles: cd rcfiles; ${MAKE} SPLINT="-$(SPLINTPNEST)" .PHONY: refcounts refcounts: $(SPLINTR) refcounts.c -expect 7 .PHONY: release release: $(SPLINTR) release.c +memchecks -expect 1 .PHONY: repexpose repexpose: $(SPLINTR) +lh repexpose +memchecks -expect 12 $(SPLINTR) repexpose +memchecks +retalias -expect 15 $(SPLINTRN) repexpose +checks -exportlocal -expect 27 ### returned added 2001-05-27 ### (Bug discovered checking splint sources.) .PHONY: returned returned: ${SPLINTR} returned.c -expect 1 .PHONY: sharing sharing: $(SPLINTR) sharing1.c -expect 21 $(SPLINTR) sharing3.c -expect 3 $(SPLINTR) sharing4.c -expect 13 $(SPLINTR) sharing4.c -paramimptemp -expect 12 $(SPLINTR) sharing5.c -expect 6 .PHONY: shifts shifts: $(SPLINTR) shifts.c -expect 4 $(SPLINTR) shifts.c -shiftimplementation -expect 3 $(SPLINTR) shifts.c -shiftnegative -expect 1 #drl comment this out until sizesigns is added to cvs ### evans - added 2002-08-17: check warnings with arbitrary integral types sizesigns: $(SPLINTR) +strict sizesigns.c -expect 5 $(SPLINTR) +strict +matchanyintegral sizesigns.c -expect 4 .PHONY: slovaknames slovaknames: $(SPLINTR) +hints slovaknames.c -expect 1 $(SPLINTR) +hints slovaknames.c +accessslovak $(SPLINTR) +hints +slovak slovaknames.c -expect 3 $(SPLINTR) +hints +slovak -slovakvars slovaknames.c -expect 2 $(SPLINTR) +hints +slovak -accessslovak slovaknames.c -expect 7 .PHONY: specclauses specclauses: $(SPLINTR) specclauses.c -expect 6 $(SPLINTR) specclauses2.c -expect 8 $(SPLINTR) specclauses3.c -expect 5 $(SPLINTR) specclauses4.c -expect 3 $(SPLINTR) specclauses5.c -expect 3 .PHONY: specclauses1 specclauses1: $(SPLINTR) specclauses.c -expect 6 .PHONY: specclauses2 specclauses2: $(SPLINTR) specclauses2.c -expect 8 .PHONY: specclauses3 specclauses3: $(SPLINTR) specclauses3.c -expect 6 .PHONY: specclauses4 specclauses4: $(SPLINTR) specclauses4.c -expect 3 .PHONY: specclauses5 specclauses5: $(SPLINTR) specclauses5.c -expect 3 .PHONY: special special: $(SPLINTR) special -expect 20 $(SPLINTR) special -relaxquals -expect 22 .PHONY: stack stack: $(SPLINTR) stack.c -expect 5 $(SPLINTR) stack.c -stackref .PHONY: staticarray staticarray: $(SPLINTR) staticarray.c -expect 3 ### ### evans 2002-03-16: Default setting of stringliteralnoroomfinalnull changed ### .PHONY: stringliteral stringliteral: $(SPLINTR) stringliteral.c -stringliteralnoroomfinalnull -expect 3 $(SPLINTR) stringliteral.c -expect 4 .PHONY: strings strings: $(SPLINTR) strings.c -expect 3 $(SPLINTR) -readonlystrings -expect 1 strings.c $(SPLINTR) +modobserverstrict -maintype -expect 4 strings.c .PHONY: structassign structassign: $(SPLINTR) structassign.c -expect 4 .PHONY: typeof typeof: $(SPLINTR) typeof.c -expect 2 .PHONY: typequals typequals: $(SPLINTR) typequals.c tq.lcl -expect 5 $(SPLINTR) typequals.c -expect 2 .PHONY: ud ud: $(SPLINTR) ud.c -expect 9 $(SPLINTR) ud2 -specundef -expect 3 .PHONY: ulstypes ulstypes: $(SPLINTR) ulstypes.c -expect 8 $(SPLINTR) ulstypes.c +ignorequals $(SPLINTRN) ulstypes.c +strict -exportheader -exportheadervar -expect 28 # 3 more detected with version 2.5 (change in -numliteral setting) .PHONY: union union: $(SPLINTR) +memchecks union.c -expect 8 ### ### Added 2001-12-30: fixed union initializer checking in response to ### bug report from Jim Zelenka. ### .PHONY: unioninit unioninit: $(SPLINTR) unioninit.c -expect 2 .PHONY: unnamedsu unnamedsu: $(SPLINTR) unnamedsu.c -expect 0 .PHONY: unreachable unreachable: $(SPLINTR) unreachable.c -expect 5 $(SPLINTR) -unreachable unreachable.c -expect 2 $(SPLINTR) switch.c -expect 4 .PHONY: unsignedcompare unsignedcompare: ${SPLINTR} +posixlib unsignedcompare.c -expect 4 ### ### 2001-06-08 evans: 2 new errors after fixing ansireserved name checks ### .PHONY: unused unused: $(SPLINTRN) unused.c +checks -exportlocal -expect 5 $(SPLINTRN) unused.c +checks -exportlocal +topuse -expect 8 ### ### 2001-06-10: Provided by Jim Zalenka ### .PHONY: ullint ullint: ${SPLINTRN} ullint.c -expect 5 ${SPLINTRN} ullint.c +charint +charintliteral -expect 2 ### ### 2001-12-30: Poor warnings reported by Peter Deutsch ### ### 2002-07-03: removed warnings for datatype/macro definitions ### .PHONY: utypes utypes: ${SPLINTRN} utypes.c -expect 2 ### .PHONY: void void: ${SPLINTRN} void.c -expect 2 ### ### 2001-12-30: Problems with wide character strings reported by Nelson Beebe ### .PHONY: widestrings widestrings: ${SPLINTRN} widestrings.c -expect 2 ### ### New since 2.5q: ### .PHONY: linked linked: ${SPLINTR} linked.c -expect 4 ${SPLINTR} linked2.c -expect 3 ${SPLINTR} linked3.c -expect 5 ${SPLINTR} linked4.c -expect 6 ${SPLINTR} linked5.c -expect 4 ${SPLINTR} linked6.c -expect 4 .PHONY: freearray freearray: ${SPLINTR} freearray.c -expect 1 .PHONY: sizeof sizeof: $(SPLINTR) +bounds sizeof.c -expect 1 .PHONY: buffertest buffertest: $(SPLINTR) +bounds buffertest1.c -expect 5 .PHONY: $(SUBDIRTESTS1) $(SUBDIRTESTS1): cd $@; $(MAKE) SPLINT="$(SPLINTRNNEST)" .PHONY: $(SUBDIRTESTS2) $(SUBDIRTESTS2): cd $@; $(MAKE) SPLINT="$(SPLINTRNNEST)" -f Makefile.os2 # sizesigns.c sizesigns.expect \ # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/test/db2.old-expect0000644021234200000250000001652107320411654015066 0ustar fax < reading spec employee.lcl > < reading spec eref.lcl > < reading spec empset.lcl > < reading spec ereftab.lcl > < reading spec erc.lcl > < reading spec dbase.lcl > < preprocessing > < checking employee.c > employee.c: (in function employee_setName) employee.c:14: Parameter 1 (e->name) to function strcpy is declared unique but may be aliased externally by parameter 2 (na) < checking eref.c > eref.c: (in function eref_alloc) eref.c:19: Unqualified storage eref_Pool.conts passed as only param: realloc (eref_Pool.conts, ...) eref.c:29: Unqualified storage eref_Pool.status passed as only param: realloc (eref_Pool.status, ...) eref.c:45: Storage eref_Pool.status reachable from global is only (should be unqualified) eref.c:30: Storage eref_Pool.status becomes only eref.c:45: Storage eref_Pool.conts reachable from global is only (should be unqualified) eref.c:20: Storage eref_Pool.conts becomes only eref.c: (in function eref_initMod) eref.c:84: Storage eref_Pool.conts reachable from global is fresh (should be unqualified) eref.c:62: Fresh storage eref_Pool.conts allocated eref.c:84: Global storage *(eref_Pool.conts) contains 4 undefined fields when call returns: ssNum, salary, gen, j eref.c:84: Storage eref_Pool.status reachable from global is fresh (should be unqualified) eref.c:70: Fresh storage eref_Pool.status allocated eref.c:84: Global storage eref_Pool contains 1 undefined field when call returns: status < checking empset.c > < checking ereftab.c > < checking erc.c > erc.c: (in function erc_create) erc.c:33: Null storage c->vals derivable from return value: c erc.c:31: Storage c->vals becomes null erc.c:33: Fresh storage returned as unqualified (should be only): c erc.c:23: Fresh storage c allocated erc.c: (in function erc_clear) erc.c:49: Function returns with null storage derivable from parameter c->vals erc.c:47: Storage c->vals becomes null erc.c: (in function erc_final) erc.c:54: Implicitly temp storage c passed as only param: free (c) erc.c: (in function erc_delete) erc.c:102: Released storage c->vals reachable from parameter at return point erc.c:100: Storage c->vals is released erc.c: (in function erc_sprint) erc.c:141: Fresh storage returned as unqualified (should be only): result erc.c:122: Fresh storage result allocated < checking dbase.c > < checking drive.c > < checking macros bool.h > < global checks > Finished LCLint checking --- 15 code errors found, as expected < reading spec employee.lcl > < reading spec eref.lcl > < reading spec empset.lcl > < reading spec ereftab.lcl > < reading spec erc.lcl > < reading spec dbase.lcl > < preprocessing > < checking employee.c > employee.c: (in function employee_setName) employee.c:14: Parameter 1 (e->name) to function strcpy is declared unique but may be aliased externally by parameter 2 (na) < checking eref.c > eref.c: (in function eref_initMod) eref.c:62: Implicitly only storage eref_Pool.conts not released before assignment: eref_Pool.conts = (employee *)malloc(size * sizeof(employee)) eref.c:70: Implicitly only storage eref_Pool.status not released before assignment: eref_Pool.status = (eref_status *)malloc(size * sizeof(eref_status)) eref.c:84: Global storage *(eref_Pool.conts) contains 4 undefined fields when call returns: ssNum, salary, gen, j eref.c:84: Global storage eref_Pool contains 1 undefined field when call returns: status < checking empset.c > empset.c: (in function empset_insertUnique) empset.c:44: Clauses exit with er referencing fresh storage in true branch, local storage in continuation empset.c:41: Fresh storage er allocated empset.c: (in function empset_intersect) empset.c:126: Fresh storage toDelete not released before return empset.c:112: Fresh storage toDelete allocated < checking ereftab.c > < checking erc.c > erc.c: (in function erc_create) erc.c:33: Null storage c->vals derivable from return value: c erc.c:31: Storage c->vals becomes null erc.c: (in function erc_clear) erc.c:49: Function returns with null storage derivable from parameter c->vals erc.c:47: Storage c->vals becomes null erc.c: (in function erc_final) erc.c:54: Implicitly temp storage c passed as only param: free (c) erc.c: (in function erc_delete) erc.c:98: Implicitly only storage prev->next not released before assignment: prev->next = elem->next erc.c:98: Clauses exit with elem referencing implicitly only storage in true branch, local storage in false branch erc.c:96: Storage elem becomes implicitly only erc.c:98: Storage c->vals->next is kept in one path, but live in another. erc.c:98: Storage c->vals->next becomes kept erc.c:102: Released storage c->vals reachable from parameter at return point erc.c:100: Storage c->vals is released < checking dbase.c > dbase.c: (in function uncheckedHire) dbase.c:121: Fresh storage er not released before return dbase.c:108: Fresh storage er allocated < checking drive.c > drive.c: (in function main) drive.c:49: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:65: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:83: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:120: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:124: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:135: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:140: Fresh storage em1 not released before assignment: em1 = empset_create() drive.c:35: Fresh storage em1 allocated drive.c:146: Fresh storage em2 not released before assignment: em2 = empset_create() drive.c:74: Fresh storage em2 allocated drive.c:147: Fresh storage em3 not released before assignment: em3 = empset_disjointUnion(em2, em1) drive.c:87: Fresh storage em3 allocated drive.c:159: Variable m_res name is not a macro variable (it is a local variable), but matches the macro variable namespace prefix "m_" drive.c:163: Fresh storage em1 not released before return drive.c:140: Fresh storage em1 allocated drive.c:163: Fresh storage em2 not released before return drive.c:146: Fresh storage em2 allocated drive.c:163: Fresh storage em3 not released before return drive.c:147: Fresh storage em3 allocated < checking macros bool.h > < global checks > Finished LCLint checking --- 28 code errors found, as expected < reading spec employee.lcl > < reading spec eref.lcl > < reading spec empset.lcl > < reading spec ereftab.lcl > < reading spec erc.lcl > < reading spec dbase.lcl > < preprocessing > < checking employee.c > < checking eref.c > < checking empset.c > < checking ereftab.c > < checking erc.c > < checking dbase.c > < checking drive.c > < checking macros bool.h > < global checks > Finished LCLint checking --- no code errors found splint-3.1.2.dfsg1/test/union.pp0000644021234200000250000000176007320411672014121 0ustar fax# 1 "union.c" typedef union _ut { int x; int y; int *ox; int *dx; struct { int a; int b; int *ip; } st; } *ut; extern void *smalloc (size_t); ut ut_create1 ( int a) { ut u = (ut) smalloc (sizeof (*u)); return u; } ut ut_create2 (int a) { ut u = (ut) smalloc (sizeof (*u)); u->x = a; return u; } ut ut_create3 (int a) { ut u = (ut) smalloc (sizeof (*u)); u->x = a; u->y = a; return u; } ut ut_create4 (int *t) { ut u = (ut) smalloc (sizeof (*u)); u->ox = t; return u; } ut ut_create5 (int *t) { ut u = (ut) smalloc (sizeof (*u)); u->dx = t; return u; } ut ut_create6 (void) { ut u = (ut) smalloc (sizeof (*u)); u->st.a = 3; return u; } ut ut_create7 (int *p) { ut u = (ut) smalloc (sizeof (*u)); u->st.a = 3; u->st.b = 4; u->st.ip = p; return u; } void ut_mangle1 (ut u) { free (u->ox); } void ut_mangle2 (ut u) { free (u->st.ip); } void ut_mangle3 (ut u) { free (u->st.ip); u->x = 3; } splint-3.1.2.dfsg1/test/warnuse.old-expect0000644021234200000250000000145007320411673016077 0ustar fax warnuse.c:2:10: Warn clause uses unrecognized flag: wusef warnuse.c: (in function wfunc) warnuse.c:9:10: f is a very dangerous function! warnuse.c:9:17: g is a very dangerous function! Finished LCLint checking --- 3 code errors found, as expected warnuse.c:2:10: Warn clause uses unrecognized flag: wusef Finished LCLint checking --- 1 code error found, as expected Warning: setting +bufferoverflow redundant with current value Warning: flag +bufferoverflow is canceled by -warnuse warnuse.c:2:10: Warn clause uses unrecognized flag: wusef Finished LCLint checking --- 1 code error found, as expected warnuse.c:2:10: Warn clause uses unrecognized flag: wusef warnuse.c: (in function wfunc) warnuse.c:9:10: f is a very dangerous function! Finished LCLint checking --- 2 code errors found, as expected splint-3.1.2.dfsg1/test/loopexec.expect0000644021234200000250000000070007414547435015464 0ustar fax loopexec.c: (in function g2) loopexec.c:35:2: Out storage x not defined before return Finished checking --- 1 code warning, as expected loopexec.c: (in function g) loopexec.c:13:2: Out storage x not defined before return loopexec.c: (in function g1) loopexec.c:24:2: Out storage x not defined before return loopexec.c: (in function g2) loopexec.c:35:2: Out storage x not defined before return Finished checking --- 3 code warnings, as expected splint-3.1.2.dfsg1/test/mergenull.expect0000644021234200000250000000004307413673005015630 0ustar fax Finished checking --- no warnings splint-3.1.2.dfsg1/test/shifts.expect0000644021234200000250000000142607414723231015142 0ustar fax shifts.c: (in function f) shifts.c:12:14: Right operand of << may be negative (int): u1 << i1 shifts.c:13:14: Right operand of << may be negative (int): i1 << i1 shifts.c:13:8: Left operand of << may be negative (int): i1 << i1 shifts.c:17:14: Right operand of << may be negative (int): u2 << BAD_CONST Finished checking --- 4 code warnings, as expected shifts.c: (in function f) shifts.c:12:14: Right operand of << may be negative (int): u1 << i1 shifts.c:13:14: Right operand of << may be negative (int): i1 << i1 shifts.c:17:14: Right operand of << may be negative (int): u2 << BAD_CONST Finished checking --- 3 code warnings, as expected shifts.c: (in function f) shifts.c:13:8: Left operand of << may be negative (int): i1 << i1 Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/looptesteffect.expect0000644021234200000250000000041407444513665016677 0ustar fax looptesteffect.c: (in function foo) looptesteffect.c:18:43: Arrow access from possibly null pointer e (in post loop increment): e->next looptesteffect.c:18:43: Storage e may become null Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/unioninit.expect0000644021234200000250000000046207413734525015664 0ustar fax unioninit.c:11:23: Initializer block for union test3 has 2 elements, union initializers should have one element: 0, 1 unioninit.c:13:25: Initial value of test4.test2_s is type long int, expects short int: 23L Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/unioninit.c0000644021234200000250000000035207413734525014614 0ustar faxunion test2_u { short test2_s; struct test2_ius_s { unsigned char a; unsigned char b; } test2_ius; }; union test2_u test2 = { 0 }; union test2_u test3 = { 0, 1 }; /* bad */ union test2_u test4 = { 23L }; /* bad */ splint-3.1.2.dfsg1/test/utypes.c0000644021234200000250000000135407631564300014126 0ustar fax/* Define short names for the unsigned types. */ typedef unsigned char byte; typedef unsigned char uchar; typedef unsigned short ushort; typedef unsigned int uint; typedef unsigned long ulong; /* Since sys/types.h often defines one or more of these (depending on */ /* the platform), we have to take steps to prevent name clashes. */ /*** NOTE: This requires that you include std.h *before* any other ***/ /*** header file that includes sys/types.h. ***/ //#define bool bool_ / * (maybe not needed) * / #define uchar uchar_ #define uint uint_ #define ushort ushort_ #define ulong ulong_ #include #undef bool #undef uchar #undef uint #undef ushort #undef ulong void f (unsigned int width) { uint src_bytes = width >> 3; } splint-3.1.2.dfsg1/test/utypes.expect0000644021234200000250000000057307510677710015204 0ustar fax utypes.c:16: Include file matches the name of a POSIX library, but the POSIX library is not being used. Consider using +posixlib or +posixstrictlib to select the POSIX library, or -warnposix to suppress this message. utypes.c: (in function f) utypes.c:26:8: Variable src_bytes declared but not used Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/widestrings.expect0000644021234200000250000000053707413764205016213 0ustar fax widestrings.c: (in function main) widestrings.c:9:16: Function printf expects arg 1 to be char * gets wchar_t *: L"English: Hello, world!\n" widestrings.c:10:17: Function wprintf expects arg 1 to be wchar_t * gets char *: "English: Hello, world!\n" Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/widestrings.c0000644021234200000250000000153007413764205015137 0ustar fax/* Provided by Nelson Beebe */ #include #include #include int main(void) { (void)wprintf(L"English: Hello, world!\n"); (void)printf(L"English: Hello, world!\n"); /* error */ (void)wprintf("English: Hello, world!\n"); /* error */ (void)wprintf(L"Russian: Ð^×аÑ^ÀегиÑ^ÁÑ^ÂÑ^ÀиÑ^ÀÑ^ÃйÑ^ÂеÑ^ÁÑ^Ì Ñ^ÁейÑ^ÇаÑ^Á на Ð^ÔеÑ^ÁÑ^ÏÑ^ÂÑ^ÃÑ^Î Ð^ÜеждÑ^ÃнаÑ^ÀоднÑ^ÃÑ^Î Ð^ÚонÑ^ÄеÑ^ÀенÑ^ÆÐ¸Ñ^Î...\n"); (void)wprintf(L"Greek: Σὲ γνÏ^ÉÏ^ÁίζÏ^É á¼^ÀÏ^Àὸ Ï^Äὴν κόÏ^Èη...\n"); (void)wprintf(L"Georgian: á^Ã^Òá^Ã^×á^îá^Ã^Ýá^Ã^Õá^Ã^× á^Ã^Ðá^îá^Ã^Úá^Ã^Ðá^Ã^Õá^Ã^Ô á^Ã^Òá^Ã^Ðá^Ã^Øá^Ã^Ðá^àá^Ã^Ýá^Ã^× á^àá^Ã^Ôá^Ã^Òá^Ã^Øá^áá^âá^àá^Ã^Ðá^êá^Ã^Øá^Ã^Ð Unicode-á^Ã^Øá^á á^Ã^Ûá^Ã^Ôá^Ã^Ðá^Ã^×á^Ã^Ô á^áá^Ã^Ðá^Ã^Ôá^àá^Ã^×á^Ã^Ðá^èá^Ã^Ýá^àá^Ã^Øá^áá^Ã^Ý\n"); return (EXIT_SUCCESS); } splint-3.1.2.dfsg1/test/functionmacro.expect0000644021234200000250000000042707413753767016531 0ustar fax functionmacro.c: (in function blah) functionmacro.c:7:3: Assignment of size_t to int: len = strlen(__FUNCTION__) functionmacro.c: (in function main) functionmacro.c:19:2: Path with no return in function declared to return int Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/functionmacro.c0000644021234200000250000000036707413753767015466 0ustar fax#include void blah() { int len; len = strlen(__FUNCTION__); printf("this function (%s) has a name that is %d characters long\n", __FUNCTION__, len); } int main() { printf("hello from %s\n", __FUNCTION__); blah(); } splint-3.1.2.dfsg1/test/info.c0000644021234200000250000000025007413747447013537 0ustar faxstatic void huppy_bug(void) { i = 1; /*Unrecognized identifier: i*/ } #info "LcLint ignores all code that follows this line!" void unhuppy_bug() { i = "Asdf"; } splint-3.1.2.dfsg1/test/info.expect0000644021234200000250000000076707752206142014606 0ustar fax info.c: (in function huppy_bug) info.c:3:3: Unrecognized identifier: i info.c:6:57: Unrecognized pre-processor directive: #info "LcLint ignores all code that follows this line!" info.c: (in function unhuppy_bug) info.c:10:3: Observer storage assigned to unqualified reference: i = "Asdf" info.c:10:7: Storage becomes observer info.c:1:13: File static function huppy_bug declared but not used info.c:4:1: Definition of huppy_bug Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/longint.c0000644021234200000250000000041407576160355014255 0ustar faxvoid f (void) { long int li1 = 3L; int i1 = 7; short int si1 = 3; i1 = li1; /* error unless +longint */ li1 = i1; /* okay */ i1 = si1; /* okay */ si1 = i1; /* error unless +shortint */ li1 = si1; si1 = li1; /* error unless +shortint +longint */ } splint-3.1.2.dfsg1/test/loopexec.c0000644021234200000250000000054407414547435014424 0ustar fax/* ** Some tests for obvious loop exec */ void g (/*@out@*/ int x[]) { int i; for (i = 0; i < 2; i++) { x[i] = i; } } void g1 (/*@out@*/ int x[]) { int i; for (i = 0; i <= 2; i++) { x[i] = i; } } void g2 (/*@out@*/ int x[]) { int i; for (i = 0; i <= 0; i++) /* won't execute */ { x[i] = i; } } splint-3.1.2.dfsg1/test/looptesteffect.c0000644021234200000250000000043007444513665015627 0ustar fax typedef struct elem_ elem; struct elem_ { /*@null@*/ elem *next; int val; }; void foo(/*@null@*/ elem *e) { if ((e != NULL) && (e->val > 2)) { ; } for (; ((e != NULL) && (e->val > 2)); e=e->next) ; for (; ((e == NULL) || (e->val > 2)); e=e->next) ; } splint-3.1.2.dfsg1/test/mergenull.c0000644021234200000250000000037307413673005014570 0ustar fax/* ** Added 2001-12-29 ** Test for branchstate bug reported by Jon Wilson */ typedef /*@null@*/ struct s_foo *foo; struct s_foo { foo p; } ; void f (foo a) { while ( a != NULL ) { foo temp = a->p ; a->p = NULL ; a = temp ; } } splint-3.1.2.dfsg1/test/shifts.c0000644021234200000250000000062107414723231014070 0ustar fax/*@constant int SHIFT_CONST = 5@*/ # define SHIFT_CONST 5 /*@constant int BAD_CONST = -2@*/ # define BAD_CONST -2 int f (int i1, unsigned int u1, unsigned int u2) { int j1; unsigned int v1, v2; v1 = u1 << i1; /* Right operand may be negative */ j1 = i1 << i1; /* Left, right oprands */ v2 = u2 << 5; v2 = u2 << SHIFT_CONST; v2 = u2 << BAD_CONST; /* Right operand */ return 3; } splint-3.1.2.dfsg1/test/longint.expect0000644021234200000250000000126007576160355015323 0ustar fax longint.c: (in function f) longint.c:7:3: Assignment of long int to int: i1 = li1 longint.c:10:3: Assignment of int to short int: si1 = i1 longint.c:13:3: Assignment of long int to short int: si1 = li1 Finished checking --- 3 code warnings, as expected longint.c: (in function f) longint.c:10:3: Assignment of int to short int: si1 = i1 longint.c:13:3: Assignment of long int to short int: si1 = li1 Finished checking --- 2 code warnings, as expected longint.c: (in function f) longint.c:7:3: Assignment of long int to int: i1 = li1 longint.c:13:3: Assignment of long int to short int: si1 = li1 Finished checking --- 2 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/nullret.expect0000644021234200000250000000037207577032212015330 0ustar fax nullret.c: (in function f1) nullret.c:1:22: Null storage returned as non-null: 0 nullret.c: (in function f3) nullret.c:7:22: Null storage returned as non-null: 0 Finished checking --- 2 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/numabstract.expect0000644021234200000250000000526407577744773016221 0ustar fax numabstract.c: (in function adding) numabstract.c:13:3: Assignment of char to apples: a2 = 'a' numabstract.c:14:3: Assignment of char to int: i = 'c' numabstract.c:15:17: Cast from literal to numabstract type apples: (apples)13 numabstract.c:16:8: Incompatible types for + (apples, int): a + 5 numabstract.c:17:3: Assignment of oranges to apples: a2 = o numabstract.c:19:3: Assignment of oranges to int: i = o numabstract.c:20:3: Assignment of apples to int: i = a2 + a numabstract.c:21:10: Operands of + are different numabstract types (apples, oranges): a + o numabstract.c: (in function comparing) numabstract.c:26:7: Operands of < have incompatible types (apples, int): a < 3 numabstract.c:30:7: Operands of < are different numabstract types (apples, oranges): a < o numabstract.c:34:7: Operands of == are different numabstract types (apples, oranges): a == o Finished checking --- 11 code warnings, as expected numabstract.c: (in function adding) numabstract.c:13:3: Assignment of char to apples: a2 = 'a' numabstract.c:14:3: Assignment of char to int: i = 'c' numabstract.c:15:17: Cast from literal to numabstract type apples: (apples)13 numabstract.c:17:3: Assignment of oranges to apples: a2 = o numabstract.c:19:3: Assignment of oranges to int: i = o numabstract.c:20:3: Assignment of apples to int: i = a2 + a numabstract.c:21:10: Operands of + are different numabstract types (apples, oranges): a + o numabstract.c: (in function comparing) numabstract.c:30:7: Operands of < are different numabstract types (apples, oranges): a < o numabstract.c:34:7: Operands of == are different numabstract types (apples, oranges): a == o Finished checking --- 9 code warnings, as expected numabstract.c: (in function adding) numabstract.c:13:3: Assignment of char to apples: a2 = 'a' numabstract.c:14:3: Assignment of char to int: i = 'c' numabstract.c:16:8: Incompatible types for + (apples, int): a + 5 numabstract.c:17:3: Assignment of oranges to apples: a2 = o numabstract.c:19:3: Assignment of oranges to int: i = o numabstract.c:20:3: Assignment of apples to int: i = a2 + a numabstract.c:21:10: Operands of + are different numabstract types (apples, oranges): a + o numabstract.c: (in function comparing) numabstract.c:26:7: Operands of < have incompatible types (apples, int): a < 3 numabstract.c:30:7: Operands of < are different numabstract types (apples, oranges): a < o numabstract.c:34:7: Operands of == are different numabstract types (apples, oranges): a == o Finished checking --- 10 code warnings, as expected splint-3.1.2.dfsg1/test/sizesigns.expect0000644021234200000250000000235707577032212015666 0ustar fax Command Line: Setting mode strict after setting mode flags will override set values of flags: exportlocal sizesigns.c: (in function foo) sizesigns.c:5:7: Operands of == have incompatible types (arbitrary unsigned integral type, int): z / sizeof((z)) == 10 sizesigns.c:6:12: Body of if clause of if statement is not a block: return 1 sizesigns.c:8:12: Body of else clause of if statement is not a block: return 0 sizesigns.c:3:5: Function foo declared but not used sizesigns.c:9:1: Definition of foo sizesigns.c:3:5: Function foo exported but not declared in header file sizesigns.c:9:1: Definition of foo Finished checking --- 5 code warnings, as expected Command Line: Setting mode strict after setting mode flags will override set values of flags: exportlocal sizesigns.c: (in function foo) sizesigns.c:6:12: Body of if clause of if statement is not a block: return 1 sizesigns.c:8:12: Body of else clause of if statement is not a block: return 0 sizesigns.c:3:5: Function foo declared but not used sizesigns.c:9:1: Definition of foo sizesigns.c:3:5: Function foo exported but not declared in header file sizesigns.c:9:1: Definition of foo Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/typeof.expect0000644021234200000250000000027507440260341015146 0ustar fax typeof.c: (in function main) typeof.c:10:4: Variable ip used before definition typeof.c:11:4: Array element y[3] used before definition Finished checking --- 2 code warnings, as expected splint-3.1.2.dfsg1/test/manual.expect0000644021234200000250000001715707671271606015140 0ustar fax sample.c:11: Fresh storage x not released before return sample.c:5: Fresh storage x created sample.c:5: Variable x declared but not used Finished checking --- 2 code warnings, as expected null.c:3: Dereference of possibly null pointer s: *s null.c:1: Storage s may become null Finished checking --- 1 code warning, as expected Finished checking --- no warnings usedef.c:11: Value *x used before definition usedef.c:13: Passed storage x not completely defined (*x is undefined): getVal (x) usedef.c:15: Passed storage x not completely defined (*x is undefined): mysteryVal (x) Finished checking --- 3 code warnings, as expected usedef.c:11: Value *x used before definition usedef.c:13: Passed storage x not completely defined (*x is undefined): getVal (x) Finished checking --- 2 code warnings, as expected bool.c:6: Test expression for if is assignment expression: i = 3 bool.c:6: Test expression for if not bool, type int: i = 3 bool.c:7: Return value type bool does not match declared type int: b1 bool.c:8: Operand of ! is non-boolean (int): !i bool.c:8: Right operand of || is non-boolean (char *): !i || s bool.c:10: Test expression for if not bool, type char *: s bool.c:12: Use of == with bool variables (risks inconsistency because of multiple true values): b1 == b2 Finished checking --- 7 code warnings, as expected palindrome.c:6: Cast from underlying abstract type mstring: (char *)s palindrome.c:7: Function strlen expects arg 1 to be char * gets mstring: s palindrome.c:11: Array fetch from non-array (mstring): s[len - i - 1] palindrome.c:19: Function isPalindrome expects arg 1 to be mstring gets char *: "bob" Finished checking --- 4 code warnings, as expected only.c:11: Only storage glob (type int *) not released before assignment: glob = y only.c:1: Storage glob becomes only only.c:11: Implicitly temp storage y assigned to only: glob = y only.c:13: Dereference of possibly null pointer m: *m only.c:8: Storage m may become null only.c:13: Variable x used after being released only.c:12: Storage x released only.c:14: Implicitly temp storage z returned as only: z only.c:14: Fresh storage m not released before return only.c:9: Fresh storage m created Finished checking --- 6 code warnings, as expected stack.c:12: Stack-allocated storage &loc reachable from return value: &loc stack.c:12: Stack-allocated storage *x reachable from parameter x stack.c:10: Storage *x becomes stack-allocated storage stack.c:12: Stack-allocated storage glob reachable from global glob stack.c:9: Storage glob becomes stack-allocated storage Finished checking --- 3 code warnings, as expected rstring.c:13: Reference counted storage returned without modifying reference count: r1 Finished checking --- 1 code warning, as expected unique.c:7: Parameter 1 (s) to function strcpy is declared unique but may be aliased externally by parameter 2 (t) Finished checking --- 1 code warning, as expected exposure.c:6: Function returns reference to parameter e: e->name exposure.c:6: Return value exposes rep of employee: e->name exposure.c:6: Released storage e->name reachable from parameter at return point exposure.c:6: Storage e->name released exposure.c:23: Suspect modification of observer name: *name = toupper(*name) exposure.c:22: Storage *name becomes observer Finished checking --- 4 code warnings, as expected modify.c:4: Undocumented modification of *y: *y = *x modify.c:5: Suspect object listed in modifies of setx not modified: *x modify.c:1: Declaration of setx Finished checking --- 2 code warnings, as expected globals.c:5: Undocumented use of global glob2 globals.c:3: Global glob1 listed but not used Finished checking --- 2 code warnings, as expected annotglobs.c:13: Undef global globnum used before definition annotglobs.c:15: Global storage globname contains 1 undefined field when call returns: firstname annotglobs.c:21: Only storage globname.firstname (type char *) derived from killed global is not released (memory leak) Finished checking --- 3 code warnings, as expected Finished checking --- no warnings order.c:11: Expression has undefined behavior (value of right operand modified by left operand): x++ * x order.c:13: Expression has undefined behavior (left operand uses i, modified by right operand): y[i] = i++ order.c:14: Expression has undefined behavior (value of right operand modified by left operand): modglob() * glob order.c:15: Expression has undefined behavior (unconstrained function mystery used in left operand may set global variable glob used in right operand): mystery() * glob Finished checking --- 4 code warnings, as expected order.c:11: Expression has undefined behavior (value of right operand modified by left operand): x++ * x order.c:13: Expression has undefined behavior (left operand uses i, modified by right operand): y[i] = i++ order.c:14: Expression has undefined behavior (value of right operand modified by left operand): modglob() * glob Finished checking --- 3 code warnings, as expected loop.c:14: Suspected infinite loop. No value used in loop test (x, glob1) is modified by test or loop body. loop.c:15: Suspected infinite loop. No condition values modified. Modification possible through unconstrained calls: h Finished checking --- 2 code warnings, as expected loop.c:14: Suspected infinite loop. No value used in loop test (x, glob1) is modified by test or loop body. Finished checking --- 1 code warning, as expected switch.c:11: Fall through case (no preceding break) switch.c:14: Missing case in switch: DEFINITELY Finished checking --- 2 code warnings, as expected noeffect.c:6: Statement has no effect: y == *x noeffect.c:7: Statement has no effect: nomodcall(x) noeffect.c:8: Statement has no effect (possible undected modification through call to unconstrained function mysterycall): mysterycall(x) Finished checking --- 3 code warnings, as expected noeffect.c:6: Statement has no effect: y == *x noeffect.c:7: Statement has no effect: nomodcall(x) Finished checking --- 2 code warnings, as expected ignore.c:8: Return value (type int) ignored: fi() ignore.c:10: Return value (type bool) ignored: fb() Finished checking --- 2 code warnings, as expected ignore.c:8: Return value (type int) ignored: fi() Finished checking --- 1 code warning, as expected ignore.c:10: Return value (type bool) ignored: fb() Finished checking --- 1 code warning, as expected setChar.c:5: Likely out-of-bounds store: buf[10] Unable to resolve constraint: requires 9 >= 10 needed to satisfy precondition: requires maxSet(buf @ setChar.c:5) >= 10 Finished checking --- 1 code warning, as expected multiError.c:4: Possible out-of-bounds store: buf[2] Unable to resolve constraint: requires maxSet(buf @ multiError.c:4) >= 2 needed to satisfy precondition: requires maxSet(buf @ multiError.c:4) >= 2 Finished checking --- 1 code warning, as expected bounds.c:9: Possible out-of-bounds store: strcpy(str, tmp) Unable to resolve constraint: requires maxSet(str @ bounds.c:9) >= maxRead(getenv("MYENV") @ bounds.c:7) needed to satisfy precondition: requires maxSet(str @ bounds.c:9) >= maxRead(tmp @ bounds.c:9) derived from strcpy precondition: requires maxSet() >= maxRead() Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/arraydims.expect0000644021234200000250000000061007421453175015634 0ustar fax arraydims.c:3:3: Initializer block for daytab[1] has 14 elements, but declared as int [13]: 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 52 arraydims.c:8:5: Initializer block for daytab2[0][1] has 14 elements, but declared as int [13]: 0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 52 Finished checking --- 2 code warnings, as expected Finished checking --- no warnings splint-3.1.2.dfsg1/test/arraydims.c0000644021234200000250000000106207421453175014570 0ustar faxstatic int daytab[2][13] = { {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 52 } /* error */ }; static int daytab2[3][2][13] = { { {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31, 52 } }, /* error */ { {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } } , { {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 } } }; splint-3.1.2.dfsg1/test/oldstyle2.c0000644021234200000250000000034107427451047014517 0ustar fax void oldDec(x) int x; { x = 5; } void noShadow() { switch (0) { int x; case 0: { x = 0;} } } void unrecognized() { switch (0) { case 0: { x = 0;} } } splint-3.1.2.dfsg1/test/divzero.expect0000644021234200000250000000004307430063411015311 0ustar fax Finished checking --- no warnings splint-3.1.2.dfsg1/test/parentype.expect0000644021234200000250000000004307431554100015637 0ustar fax Finished checking --- no warnings splint-3.1.2.dfsg1/test/divzero.c0000644021234200000250000000007607430063411014251 0ustar faxvoid f (void) { int x = 3 / 0; double d = 3.0 / 0.0; } splint-3.1.2.dfsg1/test/parentype.c0000644021234200000250000000013507431554100014573 0ustar faxint f(void) { double (*y)[3]; double z[3]; y = &z; /* line 6 */ return 0; } splint-3.1.2.dfsg1/test/stringliteral.expect0000644021234200000250000000220507445010135016515 0ustar fax stringliteral.c:3:16: String literal with 9 characters is assigned to char [8] (no room for null terminator): "\000\000\000\000\000\000\000\001" stringliteral.c:4:16: String literal with 5 characters is assigned to char [4] (no room for null terminator): "abcd" stringliteral.c:7:16: String literal with 7 characters (counting null terminator) is assigned to char [4] (insufficient storage available): "abcdef" Finished checking --- 3 code warnings, as expected stringliteral.c:2:15: String literal with 9 characters is assigned to char [8] (no room for final null terminator): "\000\000\000\000\000\000\000\000" stringliteral.c:3:16: String literal with 9 characters is assigned to char [8] (no room for null terminator): "\000\000\000\000\000\000\000\001" stringliteral.c:4:16: String literal with 5 characters is assigned to char [4] (no room for null terminator): "abcd" stringliteral.c:7:16: String literal with 7 characters (counting null terminator) is assigned to char [4] (insufficient storage available): "abcdef" Finished checking --- 4 code warnings, as expected splint-3.1.2.dfsg1/test/stringliteral.c0000644021234200000250000000031407423362765015465 0ustar fax char buf[8] = "\000\000\000\000\000\000\000\000"; char bufa[8] = "\000\000\000\000\000\000\000\001"; char buf2[4] = "abcd"; char buf3[4] = "ab\n"; char buf4[4] = "\034\342\24"; char buf5[4] = "abcdef"; splint-3.1.2.dfsg1/test/numabstract.c0000644021234200000250000000146707577744773015154 0ustar faxtypedef /*@numabstract@*/ int apples; typedef /*@numabstract@*/ int oranges; /*@noaccess apples@*/ /*@noaccess oranges@*/ int adding (apples a, oranges o) { int i; apples a2; a++; /* Okay */ a2 = 13; /* error (unless +numabstractlit) ? */ a2 = 'a'; /* error */ i = 'c'; /* error */ a2 = (apples) 13; /* warning if +numabstractcast */ a2 = a + 5; /* okay */ a2 = o; /* error */ a2 = a2 - a; /* okay */ i = o; /* error */ i = a2 + a; /* error */ return a + o; /* error */ } int comparing (apples a, oranges o, apples a2) { if (a < 3) { /* error unless +numabstractlit */ return 3; } if (a < o) { /* error */ return 5; } if (a == o) { /* error */ return 6; } if (a == a2) { /* okay */ return 23; } --a2; if (a >= a2) { return 523; } return 7; } splint-3.1.2.dfsg1/test/sizesigns.c0000644021234200000250000000015407577032212014611 0ustar fax#include int foo (size_t z) { if (z / sizeof(z) == 10) return 1; else return 0; } splint-3.1.2.dfsg1/test/typeof.c0000644021234200000250000000047707440260341014104 0ustar fax/* gcc extension: http://gcc.gnu.org/onlinedocs/gcc-3.0.3/gcc_5.html#SEC74 */ int main (int /*@unused{*/ argc, char /*@unused@*/ **argv) { int i = 0; typeof (i) j; __typeof__ (int *) ip; typeof (typeof (char *) [4]) y; /* char *y[4] */ j = 10; *ip = j; *y[3] = 'a'; printf("%d\n", *ip); return 1; } splint-3.1.2.dfsg1/test/nullassign.expect0000644021234200000250000000047607577032212016027 0ustar fax nullassign.c:1:10: Global a initialized to null value: int * a = 0 = 0 nullassign.c:5:24: Global c initialized to null value: int * c = 0 = 0 Finished checking --- 2 code warnings, as expected nullassign.c:5:24: Global c initialized to null value: int * c = 0 = 0 Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/condifomit.expect0000644021234200000250000000140310654216640015771 0ustar fax condifomit.c: (in function cond1) condifomit.c:11:6: Conditionals with Omitted Operands is not supported by ISO C99 condifomit.c: (in function cond2) condifomit.c:17:9: Conditionals with Omitted Operands is not supported by ISO C99 condifomit.c: (in function test_use_before_definition) condifomit.c:27:17: Variable i used before definition condifomit.c:27:17: Conditionals with Omitted Operands is not supported by ISO C99 Finished checking --- 4 code warnings, as expected Command Line: Setting +gnuextensions redundant with current value condifomit.c: (in function test_use_before_definition) condifomit.c:27:17: Variable i used before definition Finished checking --- 1 code warning, as expected splint-3.1.2.dfsg1/test/innerarray.c0000644021234200000250000000066410654216651014754 0ustar fax#include #include int fn(int arr[/*7*/][10]) /* better without the 7 */ { return 0; } int fn2(int arr[10][]) /* bad */ { return 0; } int fn3(int arr[][]) /* bad */ { return 0; } int fn4(int arr[][10][7][4]) { return 0; } int fn5(int arr[][10][][4]) /* bad */ { return 0; } int main() { int array[10][]; /* incomplete type bad */ int array2[][10]; /* array size missing */ return fn(array); } splint-3.1.2.dfsg1/test/innerarray.expect0000644021234200000250000000177610654216654016032 0ustar fax innerarray.c: (in function fn) innerarray.c:4:12: Parameter arr not used innerarray.c:9:13: Function parameter arr is incomplete type (inner array must have bounds): int [10][] innerarray.c: (in function fn2) innerarray.c:9:13: Parameter arr not used innerarray.c:14:13: Function parameter arr is incomplete type (inner array must have bounds): int [][] innerarray.c: (in function fn3) innerarray.c:14:13: Parameter arr not used innerarray.c: (in function fn4) innerarray.c:19:13: Parameter arr not used innerarray.c:24:13: Function parameter arr is incomplete type (inner array must have bounds): int [][10][][4] innerarray.c: (in function fn5) innerarray.c:24:13: Parameter arr not used innerarray.c: (in function main) innerarray.c:33:13: Passed storage array not completely defined (*array is undefined): fn (array) innerarray.c:32:7: Variable array2 declared but not used Finished checking --- 10 code warnings, as expected splint-3.1.2.dfsg1/test/malloc.expect0000644021234200000250000000256210654216664015122 0ustar fax malloc.c: (in function f1) malloc.c:3:21: Allocated memory is converted to type int * of (size 32), which is not divisible into original allocation of space for 89 elements of type void * (size 8) malloc.c:5:5: Likely out-of-bounds store: ip[88] Unable to resolve constraint: requires 21 >= 88 needed to satisfy precondition: requires maxSet(ip @ malloc.c:5:5) >= 88 malloc.c: (in function f2) malloc.c:15:5: Likely out-of-bounds store: ip[22] Unable to resolve constraint: requires 21 >= 22 needed to satisfy precondition: requires maxSet(ip @ malloc.c:15:5) >= 22 malloc.c: (in function f3) malloc.c:26:5: Likely out-of-bounds store: ip[87] Unable to resolve constraint: requires 86 >= 87 needed to satisfy precondition: requires maxSet(ip @ malloc.c:26:5) >= 87 malloc.c: (in function f4) malloc.c:33:21: Allocated memory is used as a different type (int) from the sizeof type (short int) malloc.c:33:21: Allocated memory is converted to type int * of (size 32), which is not divisible into original allocation of space for 87 elements of type short int (size 8) malloc.c:35:5: Likely out-of-bounds store: ip[86] Unable to resolve constraint: requires 20 >= 86 needed to satisfy precondition: requires maxSet(ip @ malloc.c:35:5) >= 86 Finished checking --- 7 code warnings, as expected splint-3.1.2.dfsg1/test/russian.c0000644021234200000250000000025010654216743014257 0ustar faxchar *russian[] = { "", "ÏîíåäåëüíèÂê", "Âòîðíèê", "ÑðåäÂà", "×åòâåðã", "Ïÿòíèöà", "Ñóááîòà", "ÂîñêðåñåíüÂå", } ; splint-3.1.2.dfsg1/test/russian.expect0000644021234200000250000000004310654216747015331 0ustar fax Finished checking --- no warnings splint-3.1.2.dfsg1/doc/0000755021234200000250000000000011051265524012211 5ustar faxsplint-3.1.2.dfsg1/doc/html/0000755021234200000250000000000011051265525013156 5ustar faxsplint-3.1.2.dfsg1/doc/html/manual.htm0000644021234200000250000342723107653322601015163 0ustar fax Splint Manual

 

 

 

 

Splint Manual

 

Version 3.1.1

27 April 2003

 

 

 

 

 

 

 

 

Text Box: 
     Secure Programming Group
University of Virginia 
Department of Computer Science

 

 



 

Authors

This manual was written by David Evans, except for Section 9 and Appendix B which were written by David Larochelle and David Evans.

Credits

Splint is developed and maintained by the Secure Programming Group at the University of Virginia Department of Computer Science.  David Evans is the project leader and the primary developer of Splint.  David Larochelle developed the memory bounds checking.  University of Virginia students Chris Barker, David Friedman, Mike Lanouette and Hien Phan all contributed significantly to the development of Splint.

 

Splint is the successor to LCLint, a tool originally developed as a joint research project between the Massachusetts Institute of Technology and Digital Equipment Corporation’s System Research Center.  David Evans was the primary designed and developer of LCLint.  John Guttag and Jim Horning had the original idea for a static checking tool for detecting inconsistencies between LCL specifications and their C implementations.  They provided valuable advice on its functionality and design and were instrumental in its development. 

 

Splint incorporates the original LCL checker developed by Yang Meng Tan.  This was built on the DECspec Project (Joe Wild, Gary Feldman, Steve Garland, and Bill McKeeman).  The LSL checker used by LCLint was developed by Steve Garland.  The original C grammar for LCLint was provided by Nate Osgood.  This work has also benefited greatly from discussions with Mike Burrows, David Friedman, Stephen Garland, Colin Godfrey, Steve Harrison, Yanlin Huang, Daniel Jackson, John Knight, David Larochelle, Angelika Leeb, Ulana Legedza, Gary McGraw, Anya Pogosyants, Avneesh Saxena, Seejo Sebastine, Navneet Singh, Raymie Stata, Yang Meng Tan, and Mark Vandevoorde.  I especially thank Angelika Leeb for many constructive comments on improving an early version of this document, Raymie Stata and Mark Vandevoorde for technical assistance, and Dorothy Curtis, Paco Hope, Scott Ruffner, Christina Jackson, David Ladd, and Jessica Greer for systems assistance.

 

Much of Splint’s development has been driven by feedback from users in academia and industry.  Many more people than I can mention here have made contributions by suggesting improvements, reporting bugs, porting early versions of Splint to other platforms.  Particularly heroic contributions have been made by Nelson Beebe, Eric Bloodworth, Jutta Degener, Rick Farnbach, Chris Flatters, Huver Hu, Alexander Mai, John Gerard Malecki, Thomas G. McWilliams, Michael Meskes, Richard O’Keefe, Jens Schweikhardt, Albert L. Ting and Jim Zelenka. Martin “Herbert” Dietze and Mike Smith performed valiantly in producing the original Win32 and OS2 ports.  Tim Van Holder produced the automake and autoconf distribution. 

 

Splint research at the University of Virginia is currently funded in part by an NSF CAREER Award and an NSF CCLI Award for using analysis to teach software engineering.  Splint has been previously supported by a grant from NASA and David Larochelle was funded by a USENIX student research grant.  


Contents

1      Operation................................................................................................................ 11

1.1     Warnings............................................................................................................. 11

1.2     Flags.................................................................................................................... 12

1.3     Stylized Comments............................................................................................... 12

1.3.1     Annotations................................................................................................... 13

1.3.2     Setting Flags.................................................................................................. 13

2      Null Dereferences................................................................................................... 14

2.1.1     Predicate Functions........................................................................................ 14

2.1.2     Notnull Annotations........................................................................................ 15

2.1.3     Relaxing Null Checking.................................................................................. 15

3      Undefined Values.................................................................................................... 17

3.1.1     Undefined Parameters................................................................................... 17

3.1.2     Relaxing Checking......................................................................................... 18

3.1.3     Partially Defined Structures............................................................................ 18

4      Types....................................................................................................................... 19

4.1     Built in C Types.................................................................................................... 19

4.1.1     Characters.................................................................................................... 19

4.1.2     Enumerators.................................................................................................. 19

4.1.3     Numeric Types.............................................................................................. 19

4.1.4     Arbitrary Integral Types................................................................................. 19

4.2     Boolean Types..................................................................................................... 20

4.3     Abstract Types..................................................................................................... 21

4.3.1     Controlling Access......................................................................................... 22

4.3.2     Mutability...................................................................................................... 23

4.4     Polymorphism....................................................................................................... 24

5      Memory Management............................................................................................ 25

5.1     Storage Model...................................................................................................... 25

5.2     Deallocation Errors............................................................................................... 26

5.2.1     Unshared References.................................................................................... 26

5.2.2     Temporary Parameters.................................................................................. 27

5.2.3     Owned and Dependent References................................................................. 27

5.2.4     Keep Parameters........................................................................................... 28

5.2.5     Shared References........................................................................................ 28

5.2.6     Stack References.......................................................................................... 28

5.2.7     Inner Storage................................................................................................. 28

5.3     Implicit Memory Annotations................................................................................. 29

5.4     Reference Counting.............................................................................................. 30

6      Sharing.................................................................................................................... 31

6.1     Aliasing................................................................................................................ 31

6.1.1     Unique Parameters........................................................................................ 31

6.1.2     Returned Parameters..................................................................................... 31

6.2     Exposure.............................................................................................................. 32

6.2.1     Read-Only Storage........................................................................................ 32

6.2.2     Exposed Storage............................................................................................ 33

7      Function Interfaces................................................................................................. 35

7.1     Modifications........................................................................................................ 35

7.1.1     State Modifications........................................................................................ 36

7.1.2     Missing Modifies Clauses............................................................................... 36

7.2     Global Variables................................................................................................... 37

7.2.1     Controlling Globals Checking.......................................................................... 37

7.2.2     Definition State.............................................................................................. 38

7.3     Declaration Consistency........................................................................................ 38

7.4     State Clauses....................................................................................................... 39

7.5     Requires and Ensures Clauses............................................................................... 41

8      Control Flow........................................................................................................... 43

8.1     Execution............................................................................................................. 43

8.2     Undefined Behavior.............................................................................................. 44

8.3     Problematic Control Structures.............................................................................. 45

8.3.1     Likely Infinite Loops...................................................................................... 45

8.3.2     Switches....................................................................................................... 46

8.3.3     Deep Breaks................................................................................................. 46

8.3.4     Loop and If Bodies........................................................................................ 47

8.3.5     Complete Logic............................................................................................. 47

8.4     Suspicious Statements........................................................................................... 47

8.4.1     Statements with No Effects............................................................................ 47

8.4.2     Ignored Return Values................................................................................... 48

9      Buffer Sizes............................................................................................................. 49

9.1     Checking Accesses.............................................................................................. 49

9.2     Annotating Buffer Sizes........................................................................................ 49

9.3     Warnings............................................................................................................. 50

10      Extensible Checking............................................................................................ 52

10.1       Defining Attributes............................................................................................ 52

10.2       Annotations...................................................................................................... 54

10.3       Example........................................................................................................... 54

11      Macros.................................................................................................................. 55

11.1       Constant Macros............................................................................................... 55

11.2       Function-like Macros......................................................................................... 55

11.2.1       Side Effect Free Parameters....................................................................... 56

11.3       Controlling Macro Checking............................................................................... 57

11.4       Iterators........................................................................................................... 58

11.4.1       Defining Iterators....................................................................................... 58

11.4.2       Using Iterators........................................................................................... 58

12      Naming Conventions............................................................................................ 60

12.1       Type-Based Naming Conventions...................................................................... 60

12.1.1       Czech Names............................................................................................. 60

12.1.2       Slovak Names............................................................................................ 61

12.1.3       Czechoslovak Names.................................................................................. 61

12.2       Namespace Prefixes......................................................................................... 61

12.3       Naming Restrictions.......................................................................................... 63

12.3.1       Reserved Names........................................................................................ 63

12.3.2       Distinct Names........................................................................................... 63

13      Completeness....................................................................................................... 65

13.1       Unused Declarations......................................................................................... 65

13.2       Complete Programs........................................................................................... 65

13.2.1       Unnecessarily External Names.................................................................... 65

13.2.2       Declarations Missing from Headers............................................................. 65

14      Libraries and Header File Inclusion.................................................................... 66

14.1       Standard Libraries............................................................................................. 66

14.1.1       ISO Standard Library.................................................................................. 66

14.1.2       POSIX Library........................................................................................... 66

14.1.3       UNIX Library............................................................................................ 66

14.1.4       Strict Libraries............................................................................................ 66

14.2       Generating Libraries.......................................................................................... 67

14.2.1       Generating the Standard Libraries................................................................ 67

14.3       Header File Inclusion......................................................................................... 68

14.3.1       Preprocessing Constants............................................................................. 68

Appendix A    Availability............................................................................................... 71

Appendix B    Flags........................................................................................................ 72

Global Flags................................................................................................................... 72

Help.......................................................................................................................... 72

Initialization................................................................................................................ 72

Pre-processor............................................................................................................ 73

Libraries.................................................................................................................... 73

Output....................................................................................................................... 74

Expected Errors......................................................................................................... 75

Message Format............................................................................................................ 75

Mode Selector Flags....................................................................................................... 75

Checking Flags............................................................................................................... 76

Key........................................................................................................................... 76

Types........................................................................................................................ 76

Function Interfaces..................................................................................................... 79

Memory Management................................................................................................ 81

Sharing...................................................................................................................... 84

Use Before Definition (Section 3)............................................................................... 85

Null Dereferences (Section 2).................................................................................... 85

Macros (Section 7).................................................................................................... 85

Iterators..................................................................................................................... 86

Naming Conventions................................................................................................... 86

Other Checks............................................................................................................. 90

Flag Name Abbreviations................................................................................................ 95

Appendix C    Annotations............................................................................................. 97

Suppressing Warnings................................................................................................. 97

Syntactic Annotations..................................................................................................... 97

Functions................................................................................................................... 97

Iterators (Section 11.4)............................................................................................... 98

Constants (Section 11.1)............................................................................................. 98

Alternate Types (Section 4.4)...................................................................................... 98

Declarator Annotations............................................................................................... 98

Type Access.............................................................................................................. 98

Macro Expansion...................................................................................................... 101

Arbitrary Integral Types............................................................................................ 102

Traditional Lint Comments........................................................................................ 102

Metastate Definitions.................................................................................................... 103

Appendix D    Specifications......................................................................................... 104

Specification Flags.................................................................................................... 104

Appendix E    Annotated Bibliography........................................................................ 107

 


 

Splint User’s Manual

 

Version 3.1.1

7 27 April 2003

 

Splint[1] is a tool for statically checking C programs for security vulnerabilities and programming mistakes.  Splint does many of the traditional lint checks including unused declarations, type inconsistencies, use before definition, unreachable code, ignored return values, execution paths with no return, likely infinite loops, and fall through cases.  More powerful checks are made possible by additional information given in source code annotations.  Annotations are stylized comments that document assumptions about functions, variables, parameters and types.  In addition to the checks specifically enabled by annotations, many of the traditional lint checks are improved by exploiting this additional information.

 

As more effort is put into annotating programs, better checking results. A representational effort-benefit curve for using Splint is shown in Figure 1.  Splint is designed to be flexible and allow programmers to select appropriate points on the effort-benefit curve for particular projects.  As different checks are turned on and more information is given in code annotations the number of bugs that can be detected increases dramatically.

 

Problems detected by Splint include:

·      Dereferencing a possibly null pointer (Section 2);

·      Using possibly undefined storage or returning storage that is not properly defined (Section 3);

·      Type mismatches, with greater precision and flexibility than provided by C compilers (Section 4.1–4.2);

·      Violations of information hiding (Section 4.3);

·      Memory management errors including uses of dangling references and memory leaks  (Section 5);

·      Dangerous aliasing (Section 6);

·      Modifications and global variable uses that are inconsistent with specified interfaces (Section 7);

·      Problematic control flow such as likely infinite loops (Section 8.3.1), fall through cases or incomplete switches (Section 8.3.2), and suspicious statements (Section 8.4);

·      Buffer overflow vulnerabilities (Section 9);

·      Dangerous macro implementations or invocations (Section 11); and

·      Violations of customized naming conventions.  (Section 12).

 

 



Figure 1.  Typical Effort-Benefit Curve

 

Splint checking can be customized to select what classes of errors are reported using command line flags and stylized comments in the code.  In addition, users can define new annotations and associated checks to extend Splint’s checking or to enforce application specific properties (Section 10).

 

About This Document

This document is a guide to using Splint.  Section 1 explains how to run Splint, interpret messages and control checking.  Sections 2–13 describe particular checks done by Splint.  There are some minor dependencies between sections, but in general they can be read in any order.  Section 14 covers issues involving libraries and header file inclusion important for running Splint on large systems.

 

This document does not describe technical details of the checking.  For technical background and analysis of Splint’s effectiveness in practice, see the papers available at http://www.splint.org

Since human beings themselves are not fully debugged yet, there will be bugs in your code no matter what you do.

Chris Mason,Zero-defects  memo (quoted in Microsoft Secrets, Cusumano and Selby)

1              Operation

Splint is invoked by listing files to be checked.  Initialization files, command line flags, and stylized comments may be used to customize checking globally and locally.

 

The best way to learn to use Splint, of course, is to actually use it (if you don’t already have Splint installed on your system, see Appendix A).  Before you read much further in this document, I recommend finding a small C program.  Then, try running:

splint *.c

For the most C programs, this will produce a large number of warnings.  To turn off reporting for some of the warnings, try:

splint -weak *.c

The -weak flag is a mode flag that sets many checking parameters to select weaker checking than is done in the default mode.  Other Splint flags will be introduced in the following sections; a complete list is given in Appendix B.

1.1            Warnings

A typical warning message is:

sample.c: (in function faucet)

sample.c:11:12 : Fresh storage x not released before return

  A memory leak has been detected. Storage allocated locally is not released

  before the last reference to it is lost. (Use -mustfreefresh to inhibit

  warning)

   sample.c:5:47: Fresh storage x allocated

The first line gives the name of the function in which the error is found.  This is printed before the first message reported for a function.  The second line is the text of the message.  This message reports a memory leak—storage allocated in a function is not deallocated before the function returns.  The file name, line and column number where the error is located precedes the text. 

 

The next line is a hint giving more information about the suspected error, including information on how the warning message may be suppressed.  For this message, using the ‑mustfreefresh flag would prevent this warning from being reported.  This flag can be set at the command line, or more precisely just around the code point in question by using annotations (see Section 1.3.2).

 

The final line of the message gives additional location information.  For this message, it tells where the leaking storage was allocated.

 

The generic message format is (parts enclosed in square brackets are optional):

  [<file>:<line> (in <context>)]

  <file>:<line>[,<column>]: message

     [hint]

      <file>:<line>,<column>: extra location information, if appropriate

Users can customize the format and content of messages printed by Splint.  The function context is not printed if -showfunc is used.  Column numbers are not printed if ‑showcol is used.  The +parenfileformat flag can be used to generate file locations in the format recognized by Microsoft Visual Studio.  If +parenfileformat is set, the line number follows the file name in parentheses (e.g., sample.c(11).)  Messages are split into lines of length less than the value set using -linelen <number>.  The default line length is 80 characters.  Splint attempts to split lines in a sensible place as near to the line length limit as possible. 

 

The ‑hints prevents any hints from being printed.  Normally, a hint is given only the first time a class of error is reported.  To have Splint print a hint for every message regardless, use +forcehints.

1.2            Flags

So that many programming styles can be supported, Splint provides several hundred flags for controlling checking and message reporting.  Some of the flags are introduced in the body of this document.  Appendix B describes every flag.  Modes and shortcut flags are provided for setting many flags at once.  Individual flags can override the mode settings.

 

Flags are preceded by + or -.  When a flag is preceded by + we say it is on; when it is preceded by - it is off. The precise meaning of on and off depends on the type of flag. 

 

The +/- flag settings are used for consistency and clarity, but contradict standard UNIX usage and it is easy to accidentally use the wrong one.  To reduce the likelihood of using the wrong flag, Splint issues warnings when a flag is set in an unusual way.  Warnings are issued when a flag is redundantly set to the value it already had (these errors are not reported if the flag is set using a stylized comment), if a mode flag or special flag is set after a more specific flag that will be set by the general flag was already set, if value flags are given unreasonable values, of if flags are set in an inconsistent way.  The -warnflags flag suppresses these warnings.

 

Default flag settings will be read from ~/.splintrc if it is readable.  If there is a .splintrc file in the working directory, settings in this file will be read next and its settings will override those in ~/.splintrc.  Command-line flags override settings in either file.  The syntax of the .splintrc file is the same as that of command-line flags, except that flags may be on separate lines and the # character may be used to indicate that the remainder of the line is a comment. The -nof flag prevents the ~/.splintrc file from being loaded.  The -f <filename> flag loads options from filename.

 

To make flag names more readable, hyphens (-), underscores (_) and spaces in flags at the command line are ignored.  Hence, warnflags, warn-flags and warn_flags all select the warnflags option.

1.3            Stylized Comments

Stylized comments are used to provide extra information about a type, variable or function interface to improve checking, or to control flag settings locally.

 

All stylized comments begin with /*@ and are closed by the end of the comment.  The role of the @ may be played by any printable character.  Use -commentchar  <char> to select a different stylized comment marker.

1.3.1        Annotations

Annotations are stylized comments that follow a definite syntax.  Although they are comments, they may only be used in fixed grammatical contexts (e.g., like a type qualifier).

 

Sections 2–6­ describe annotations for expressing assumptions about variables, parameters, return values, structure fields and type definitions.  For example, /*@null@*/ is used to express an assumption that a parameter may be NULL.  Section 7 describes annotations for describing function interfaces.  Other annotations are described in later sections and Section 10 describes mechanisms users can employ to define new annotations.  A summary of annotations is found in Appendix C.

 

Some annotations, known as control comments, may appear between any two tokens in a C program (unlike regular C comments, control comments should not be used within a single token as they introduce new separators in the code).  Syntactically, they are no different from standard comments.  Control comments are used to provide source-level control of Splint checking.  They may be used to suppress spurious messages, set flags, and control checking locally in other ways.

1.3.2        Setting Flags

Most flags (all except those characterized as “global” in Appendix B) can be set locally using control comments.  A control comment can set flags locally to override the command line settings.  The original flag settings are restored before processing the next file. The syntax for setting flags in control comments is the same as that of the command line, except that flags may also be preceded by = to restore their setting to the original command-line value.  For instance,

/*@+charint -modifies=showfunc@*/

sets charint on (this makes char and int indistinguishable types), sets modifies off (this prevents reporting of modification errors), and sets showfunc to its original setting (this controls  whether or not the name of a function is displayed before a message).

2              Null Dereferences

A common cause of program failures is when a null pointer is dereferenced.  Splint detects these errors by distinguishing possibly NULL pointers at interface boundaries.

 

The null annotation is used to indicate that a pointer value may be NULL.  A pointer declared with no null annotation, may not be NULL.  If null checking is turned on (controlled by null), Splint will report an error when a possibly null pointer is passed as a parameter, returned as a result, or assigned to an external reference with no null qualifier.

 

If a pointer is declared with the null annotation, the code must check that it is not NULL on all paths leading to a dereference of the pointer (or the pointer being returned or passed as a value with no null annotation).  Dereferences of possibly null pointers may be protected by conditional statements or assertions (to see how assert is declared see Section 8.1) that check the pointer is not NULL.

 

Consider two implementations of firstChar in Figure 2. For firstChar1, Splint reports an error since the pointer that is dereferenced is declared with a null annotation.  For firstChar2, no error is reported since the true branch of the s == NULL if statement returns, so the dereference of s is only reached if s is not NULL.

null.c

Running Splint

 

char firstChar1 (/*@null@*/ char *s)

{
3  return *s;

}

 

char firstChar2 (/*@null@*/ char *s)

{

   if (s == NULL) return ‘\0’;
9  return *s;

}

> splint null.c

Splint 3.0.1

 

null.c: (in function firstChar1)

null.c:3:11: Dereference of possibly null pointer s: *s

   null.c:1:35: Storage s may become null

 

Finished checking --- 1 code warning found

 

Figure 2.  Null Checking

Output from running Splint is displayed in sans-serif font.  The command line is preceded by >, the rest is output from Splint.  Explanations added to the code or splint output are shown in italics. Code shown in the figures in this document is available from the splint web site, http://www.splint.org .  No error is reported for line 9, since the dereference is reached only if s is non-null.  For most of the figures, the options -linelen 55 -hints –showcol were used to produce condensed output, and –exportlocal to inhibit warnings about exported declarations. 

2.1.1        Predicate Functions

Another way to protect null dereference, is to declare a function using nullwhentrue or falsewhennull(these annotations where originally falsenull and truenull, but were renamed to clarify the logical asymmetry; falsenull and truenull may still be used) and call the function in a conditional statement before the null-annotated pointer is dereferenced. 

 

If a function annotated with nullwhentrue returns true it means its first passed parameter is NULL. If it returns false, the parameter is not NULL.  Note that it may return true for a parameter that is not NULL.  A more descriptive name for nullwhentrue would be “if the result is false, the parameter was not null”. For example, if isNull is declared as,

   /*@nullwhentrue@*/ bool isNull (/*@null@*/ char *x);

we could write firstChar2:

   char firstChar2 (/*@null@*/ char *s)

   {

if (isNull (s)) return '\0';
return *s;

   }

No error is reported since the dereference of s is only reached if isNull(s) is false, and since isNull is declared with the nullwhentrue annotation this means s must not be null.

 

The falsewhennull annotation is not quite the logical opposite of nullwhentrue.  If a function declared with falsewhennull returns true, it means its parameter is definitely not NULL.  If it returns false, the parameter may or may not be NULL.  That is a falsewhennull always returns false when passed a NULL parameter; it may sometimes return false when passed a non-NULL parameter.

 

For example, we could define isNonEmpty to return true if its parameter is not NULL and has least one character before the NUL terminator:

   /*@falsewhennull@*/ bool isNonEmpty (/*@null@*/ char *x)

   {

     return (x != NULL && *x != ‘\0’);

   }

Splint does not check that the implementation of a function declared with nullwhentrue or falsewhennull is consistent with its annotation, but assumes the annotation is correct when code that calls the function is checked.

2.1.2        Notnull Annotations

The notnull annotation specifies that a declarator is definitely not NULL.  By default, this is assumed, but it may be necessary to use notnull to override a null in a type definition.  The null annotation may be used in a type definition to indicate that all instances of the type may be NULL.  For declarations of a type declared using null, the null annotation in the type definition may be overridden with notnull. This is particularly useful for parameters to hidden static operations of abstract types (see Section 4.3) where the null test has already been done before the function is called, or function results known to never be NULL.  For an abstract type, notnull may not be used for parameters to external functions, since clients should not be aware of when the concrete representation may by NULL.  Parameters to static functions in the implementation module, however, may be declared using notnull, since they may only be called from places where the representation is accessible.  Return values for static or external functions may be declared using notnull

2.1.3        Relaxing Null Checking

An additional annotation, relnull may be used to relax null checking.  No error is reported when a relnull value is dereferenced, or when a possibly null value is assigned to an identifier declared using relnull.

 

This is generally used for structure fields that may or may not be null depending on some other constraint.  Splint does not report and error when NULL is assigned to a relnull reference, or when a relnull reference is dereferenced.  It is up to the programmer to ensure that this constraint is satisfied before the pointer is dereferenced.

3              Undefined Values

Like many static checkers, Splint detects instances where the value of a location is used before it is defined.  This analysis is done at the procedural level.  If there is a path through the procedure that uses a local variable before it is defined, a use before definition error is reported.  The usedef flag controls use before definition checking.

 

Splint can do more checking than standard checkers though, because the annotations can be used to describe what storage must be defined and what storage may be undefined at interface points. Unannotated references are expected to be completely defined at interface points.  This means all storage reachable from a global variable, parameter to a function, or function return value is defined before and after a function call.

3.1.1        Undefined Parameters

Sometimes, function parameters or return values are expected to reference undefined or partially defined storage.  For example, a pointer parameter may be intended only as an address to store a result, or a memory allocator may return allocated but undefined storage.  The out annotation denotes a pointer to storage that may be undefined.

 

Splint does not report an error when a pointer to allocated but undefined storage is passed as an out parameter.  Within the body of a function, Splint will assume an out parameter is allocated but not necessarily bound to a value, so an error is reported if its value is used before it is defined. 

 

Splint reports an error if storage reachable by the caller after the call is not defined when the function returns.  This can be suppressed by -must-define.  After a call returns, an actual parameter corresponding to an out parameter is assumed to be completely defined.

 

When checking unannotated programs, many spurious use before definition errors may be reported   If impouts is on, no error is reported when an incompletely-defined parameter is passed to a formal parameter with no definition annotation, and the actual parameter is assumed to be defined after the call.  The /*@in@*/ annotation can be used to denote a parameter that must be completely defined, even if imp-outs is on.  If imp-outs is off, there is an implicit in annotation on every parameter with no definition annotation.

 

usedef.c

Running Splint

extern void

  setVal (/*@out@*/ int *x);

extern int

  getVal (/*@in@*/ int *x);

extern int mysteryVal

  (int *x);

 

int dumbfunc

   (/*@out@*/ int *x, int i)

{

  if (i > 3)

11   return *x;

  else if (i > 1)

13   return getVal (x);

  else if (i == 0)

15   return mysteryVal (x);

  else

    {

18    setVal (x);

19    return *x;

    }

}

> splint usedef.c

usedef.c:11: Value *x used before definition

usedef.c:13: Passed storage x not completely defined

                (*x is undefined): getVal (x)

usedef.c:15: Passed storage x not completely defined

                (*x is undefined): mysteryVal (x)

 

Finished checking --- 3 code warnings

 

No error is reported for line 18, since the incompletely defined storage x is passed as an out parameter.  After the call, x may be dereferenced, since setVal is assumed to completely define its out parameter.  The warning for line 15 would not appear if +impouts were used since there is no in annotation on the parameter to mysteryVal.


3.1.2        Relaxing Checking

The reldef annotation relaxes definition checking for a particular declaration.  Storage declared with a reldef annotation is assumed to be defined when it is used, but no error is reported if it is not defined before it is returned or passed as a parameter.

 

It is up to the programmer to check reldef fields are used correctly.   They should be avoided in most cases, but may be useful for fields of structures that may or may not be defined depending on other constraints. 

3.1.3        Partially Defined Structures

The partial annotation can be used to relax checking of structure fields.  A structure with undefined fields may be passed as a partial parameter or returned as a partial result.  Inside a function body, no error is reported when the field of a partial structure is used.  After a call, all fields of a structure that is passed as a partial parameter are assumed to be completely defined.

4              Types

Strong type checking often reveals programming errors.  Splint can check primitive C types more strictly and flexibly than typical compilers (4.1) and provides support a Boolean type (4.2).  In addition, users can define abstract types that provide information hiding (0).

4.1            Built in C Types

Two types have compatible type if their types are the same.

ANSI C, 3.1.2.6.



Splint supports stricter checking of built in C types.  The char and enum types can be checked as distinct types, and the different numeric types can be type-checked strictly.

4.1.1        Characters

The primitive char type can be type-checked as a distinct type.  If char is used as a distinct type, common errors involving assigning ints to chars are detected.

 

The +charint flag can be used for checking legacy programs where char and int are used interchangeably.  If charint is on, char types indistinguishable from ints.  To keep char and int as distinct types, but allow chars to be used to index arrays, use +charindex.

4.1.2        Enumerators

Standard C treats user-declared enum types just like integers.  An arbitrary integral value may be assigned to an enum type, whether or not it was listed as an enumerator member.  Splint checks each user-defined enum type as distinct type.  An error is reported if a value that is not an enumerator member is assigned to the enum type, or if an enum type is used as an operand to an arithmetic operator.  If the enumint flag is on, enum and int types may be used interchangeably.  Like charindex, if the enumindex flag is on, enum types may be used to index arrays.

4.1.3        Numeric Types

Splint reports where numeric types are used in dangerous or inconsistent ways.  With the strictest checking, Splint will report an error anytime numeric types do not match exactly.  If the relax-quals flag is on, only those inconsistencies that may corrupt values are reported.  For example, if an int is assigned to a variable of type long (or passed as a long formal parameter), Splint will not report an error if relax-quals is on since a long must have at least enough bits to store an int without data loss.  On the other hand, an error would be reported if the long were assigned to an int, since the int type may not have enough bits to store the long value.

 

Similarly, if a signed value is assigned to an unsigned, Splint will report an error since an unsigned type cannot represent all signed values correctly.  If the +ignore-signs flag is on, checking is relaxed to ignore all sign qualifiers in type comparisons (this is not recommended, since it will suppress reporting of real bugs, but may be necessary for quickly checking certain legacy code). 

4.1.4        Arbitrary Integral Types

Some types are declared to be integral types, but the concrete type may be implementation dependent.  For example, the standard library declares the types size_t, ptr_diff and wchar_t, but does not constrain their types other than limiting them to integral types.  Programs may rely on them being integral types (e.g., can use + operator on two size_t operands), but should not rely on a particular representation (e.g., long unsigned).   

 

Splint supports three different kinds of arbitrary integral types:

 

/*@integraltype@*/

    An arbitrary integral type.  The actual type may be any one of short, int, long, unsigned short, unsigned, or unsigned long.

/*@unsignedintegraltype@*/

    An arbitrary unsigned integral type.  The actual type may be any one of unsigned short, unsigned, or unsigned long.

/*@signedintegraltype@*/

    An arbitrary signed integral type.  The actual type may be any one of short, int, or long.

 

Splint reports an error if the code depends on the actual representation of a type declared as an arbitrary integral.  The match-any-integral flag relaxes checking and allows an arbitrary integral type is allowed to match any integral type.

 

Other flags set the arbitrary integral types to a concrete type.  These should only be used if portability to platforms that may use different representations is not important.  The long-integral and long-unsigned-integral flags set the type corresponding to /*@integraltype@*/ to be unsigned long and long respectively.  The long-unsigned-unsigned-integral flag sets the type corresponding to /*@unsignedintegraltype@*/ to be unsigned long.  The long-signed-integral flag sets the type corresponding to /*@signedintegraltype@*/ to be long.

4.2            Boolean Types

Pre-ISO99 C had no Boolean representation – the result of a comparison operator was an integer, and no type checking is done for test expressions.  C99 introduced a Boolean type (_Bool and bool, true and false macros in stdbool.h), but did not strengthen the type checking.  Splint supports a Boolean type that can be checked distinctly from integral types.  Many common errors can be detected by introducing a distinct Boolean type and stronger type checking.

 

Splint checks that the test expression in an if, while, or for statement or an operand of a &&, || or !operator is a Boolean.  If the type of a test expression is not a Boolean, Splint will produce a warning depending on the type of the test expression and flag settings.  If the test expression has pointer type, the warning is inhibited by –predboolptr (this can be used to prevent messages for the idiom of testing if a pointer is not null without a comparison).  If it is type int, the warnings is inhibited by -pred-bool-int.  For all other types, Splint warns unless -pred-bool-others is set.   Relations, comparisons and certain standard library functions are declared to return Booleans.

 

Since using = instead of == is such a common bug, reporting of test expressions that are assignments is controlled by the separate pred-assign flag.  The message can be suppressed by adding extra parentheses around the test expression.

 

Use the –booltype <name> flag to select the type name is used to represent Boolean values.  There is no default Boolean type, although bool is used by convention.  The names TRUE and FALSE are assumed to represent true and false Boolean values.  To change the names of true and false, use -booltrue and -boolfalse.  (The Splint distribution includes an implementation of bool, in lib/bool.h.  However, it isn’t necessary to use this implementation to get the benefits of Boolean checking.)

 

Figure 4 illustrates some of the Boolean checking done by Splint. 

 

bool.c

Running Splint

# include "bool.h"

int f (int i, char *s,

     bool b1, bool b2)

{

 6  if (i = 3)

 7    return b1;

 8  if (!i || s)

 9    return i;

10  if (s)

11    return 7;

12  if (b1 == b2)

13    return 3;

14  return 2;

}

> splint bool.c +predboolptr –booltype bool

 

bool.c:6: Test expression for if is assignment expression: i = 3

bool.c:6: Test expression for if not bool, type int: i = 3

bool.c:7: Return value type bool does not match declared type int: b1

bool.c:8: Operand of ! is non-boolean (int): !i

bool.c:8: Right operand of || is non-boolean (char *): !i || s

bool.c:10: Test expression for if not bool, type char *: s

bool.c:12: Use of == with bool variables (risks inconsistency because

              of multiple true values): b1 == b2

 

Finished checking --- 7 code warnings found

Figure 4.  Boolean Checking

4.3            Abstract Types

Information hiding is a technique for handling complexity.  By hiding implementation details, programs can be understood and developed in distinct modules and the effects of a change can be localized.  One technique for information hiding is data abstraction.  An abstract type is used to represent some natural program abstraction.  It provides functions for manipulating instances of the type.  The module that implements these functions is called the implementation module.  We call the functions that are part of the implementation of an abstract type the operations of the type.  Other modules that use the abstract type are called clients.

 

Clients may use the type name and operations, but should not manipulate or rely on the actual representation of the type.  Only the implementation module may manipulate the representation of an abstract type.  This hides information, since implementers and maintainers of client modules should not need to know anything about how the abstract type is implemented. It provides modularity, since the representation of an abstract type can be changed without having to change any client code.

 

Splint supports abstract types by detecting places where client code depends on the concrete representation of an abstract type.  Some examples of abstraction violations detected by Splint are shown in Figure 5.

 

To declare an abstract type, the abstract annotation is added to a typedef.  For example (in mstring.h),

typedef /*@abstract@*/ char *mstring;

declares mstring as an abstract type.  It is implemented using a char *, but clients of the type should not depend on or need to be aware of this.  If it later becomes apparent that a better representation such as a string table should be used, we should be able to change the implementation of mstring without having to change or inspect any client code.

 

In a client module, abstract types are checked by name, not structure.  Splint reports an error if an instance of mstring is passed as a char * (for instance, as an argument to strlen), since the correctness of this call depends on the representation of the abstract type.  Splint also reports errors if any C operator except assignment (=) or sizeof is used on an abstract type.  The assignment operator is allowed since its semantics do not depend on the representation of the type (for abstract types whose instances can change value, a client does need to know if assignment has copy or sharing semantics as discussed in Section 4.3.2).  The use of sizeof is also permitted, since this is the only way for clients to allocate pointers to the abstract type.  Type casting objects to or from abstract types in a client module is an abstraction violation and will generate a warning message.

 

Normally, Splint will assume a type definition is not abstract unless the /*@abstract@*/ qualifier is used.  If instead you want all user-defined types to be abstract types unless they are marked as concrete, the +imp-abstract flag can be used.  This adds an implicit abstract annotation to any typedef that is not marked with /*@concrete@*/.

 

palindrome.c

Running Splint

# include "bool.h"

# include "mstring.h"

 

bool isPalindrome (mstring s)

{

 6 char *current = (char *) s;

 7 int i, len = (int) strlen (s);

 

  for (i = 0; i <= (len+1) / 2; i++)

    {

11    if (current[i] != s[len-i-1])

        return FALSE;

    }

  return TRUE;

}

 

bool callPal (void)

{

19  return (isPalindrome ("bob"));

}

> splint palindrome.c

 

palindrome.c:6: Cast from underlying

    abstract type mstring: (char *)s

palindrome.c:7: Function strlen expects arg

    1 to be char * gets mstring: s

palindrome.c:11: Array fetch from non-array

    (mstring): s[len - i - 1]

palindrome.c:19: Function isPalindrome

    expects arg 1 to be mstring gets char *:

    "bob"

 

Finished checking --- 4 code warnings

 

Figure 5.  Information Hiding Violations

 Traditionally, programming books wax mathematical when they arrive at the topic of abstract data types…
Such books make it seem as if you’d never actually use an abstract data type except as a sleep aid.

            Steve McConnell

 

4.3.1        Controlling Access

Where code may manipulate the representation of an abstract type, we say the code has access to that type.  If code has access to an abstract type, the representation of the type and the abstract type are indistinguishable.  Usually, a single program module that is the only code that has access to the type representation implements an abstract type.  Sometimes, more complicated access control is desired if the implementation of an abstract type is split across program files, or particular client code needs to access the representation.

 

There are a several ways of selecting what code has access the representation of an abstract type:

·      Modules.  An abstract type defined in M .h is accessible in M.c.  Controlled by the accessmodule flag.  This means when accessmodule is on, as it is by default, the module access rule is in effect.  If accessmodule is off (when -access-module is used), the module access rule is not in effect and an abstract type defined in M.h is not necessarily accessible in M .c.

·      File names.  An abstract type named type is accessible in files named type.<extension>.  For example, the representation of mstring is accessible in mstring.h and mstring.c.  Controlled by the access-file flag.

·      Function names.  An abstract type named type may be accessible in a function named type_name or typeName.  For example, mstring_length and mstringLength would have access to the mstring abstract type.  Controlled by accessfunction and the naming convention (see Section 12).

·      Access control comments. The syntax /*@access type,+@*/[2] allows the following code to access the representation of type.  Similarly, /*@noaccess type,+@*/ restricts access to the representation of type.  The type in a noaccess comment must have been declared as an abstract type.

4.3.2        Mutability

We can view types as being mutable or immutable.  A type is mutable if passing it as a parameter to a function call can change the value of an instance of the type.  For example, the primitive type int is immutable.  If i is a local variable of type int and no variables point to the location where i is stored, the value of i must be the same before and after the call f (i).  Structure and union types are also immutable, since they are copied when they are passed as arguments.  On the other hand, pointer types are mutable.  If x is a local variable of type int *, the value of *x (and hence, the value of the object x) can be changed by the function call g(x)

 

The mutability of a concrete type is determined by its type definition. For abstract types, mutability does not depend on the type representation but on what operations the type provides. If an abstract type has operations that may change the value of instances of the type, the type is mutable.  If not, it is immutable.  The value of an instance of an immutable type never changes.  Since object sharing is noticeable only for mutable types, they are checked differently from immutable types.

 

The /*@mutable@*/ and /*@immutable@*/ annotations are used to declare an abstract type as mutable or immutable.  (If neither is used, the abstract type is assumed to be mutable.)  For example,

   typedef /*@abstract@*/ /*@mutable@*/ char *mstring;

   typedef /*@abstract@*/ /*@immutable@*/ int weekDay;

declares mstring as a mutable abstract type and weekDay as an immutable abstract type.

 

Clients of a mutable abstract type need to know the semantics of assignment.  After the assignment expression s = t, do s and t refer to the same object (that is, will changes to the value of s also change the value of t).

 

Splint prescribes that all abstract types have sharing semantics, so s and t would indeed be the same object.  Splint will produce a warning if a mutable type is implemented with a representation (e.g., a struct) that does not provide sharing semantics (controlled by mutrep flag). 

 

The mutability of an abstract type is not necessarily the same as the mutability of its representation. We could use the immutable concrete type int to represent mutable strings using an index into a string table, or declare mstring as immutable as long as no operations are provided that modify the value of an mstring.

4.3.3            Semi-Abstract Types

Sometimes it is useful to have a type that is abstract in some ways, but can be used with the standard numerical operators. Splint supports numabstract types for this purpose. The /*@numabstract@*/ annotation denotes a numabstract type. Splint will report warnings when numabstract types are used inconsistently, but allow binary numeric operators to operate on two values of the same numabstract type. Several flags control the strictness of type checking for numabstract types: numabstract, numabstractcast, numabstractlit, numabstractindex, and numabstractprint .

4.4            Polymorphism

In C, all declarators must be declared to have exactly one type.  This makes it impossible to write functions that operate on more than one type of parameter – for example, we cannot use the same square function for ints and floats.  Because of the stricter type checking made possible by Splint, it is often useful to declare a parameter that has more than one possible type.

 

Splint provides alternate types to indicate that a declaration may be one of several possible types.  The /*@alt type,+@*/ annotation creates a union type.  For example, int /*@altchar, unsigned char@*/c declares c such that either an int, char or unsigned char value may be assigned to it without warning.

 

One use of alternate types is to specify the type of a macro that operates on multiple types of operands (see Section 11.2.1).  Alternate types are also useful for declaring functions for which the return value may be safely ignored (see Section 8.4.2).  A function can be declared to return t /*@altvoid@*/ to indicate that it returns a value of type t, but there should be not warning if that value is ignored.

5              Memory Management

About half the bugs in typical C programs can be attributed to memory management problems.  Memory management bugs are notoriously difficult to detect through traditional techniques.  Often, the symptom of the bug is far removed from its actual source.  Memory management bugs often only appear sporadically and some bugs may only be apparent when compiler optimizations are turned on or the code is compiled on a different platform.  Run-time tools offer some help, but are cumbersome to use and limited to detecting errors that occur when test cases are run.  By detecting these errors statically, we can be confident that certain types of errors will never occur and provide verified documentation on the memory management behavior of a program. 

 

Splint can detect many memory management errors at compile time including using storage that may have been deallocated (Section 5.2), memory leaks (Section 5.2), or returning a pointer to stack-allocated storage (Section 5.2.6).

Yea, from the table of my memory I'll wipe away all trivial fond records, all saws of books,
all forms, all pressures past, that youth and observation copied there.

Hamlet prefers garbage collection (Shakespeare, Hamlet. Act I, Scene v)

Most of these checks depend on annotations added to programs to document assumptions related to memory management and pointer values.  By documenting these assumptions for function interfaces, variables, type definitions and structure fields, memory management bugs can be detected at their source — where an assumption is violated.  In addition, precise documentation about memory management decisions makes it easier to change code.

5.1            Storage Model

This section describes execution-time concepts for describing the state of storage more precisely than can be done using standard C terminology.  Certain uses of storage are likely to indicate program bugs, and are reported as anomalies.[3]

 

Splint assumes a CLU-like object storage model.[4]  An object is a typed region of storage.  Some objects use a fixed amount of storage that is allocated and deallocated automatically by the compiler.  Other objects use dynamic storage that must be managed by the program.

 

Storage is undefined if it has not been assigned a value, and defined after it has been assigned a value.  An object is completely defined if all storage that may be reached from it is defined.  What storage is reachable from an object depends on the type and value of the object.  For example, if p is a pointer to a structure, p is completely defined if the value of p is NULL, or if every field of the structure p points to is completely defined.

 

When an expression is used as the left side of an assignment expression we say it is used as an lvalue.  Its location in memory is used, but not its value.  Undefined storage may be used as an lvalue since only its location is needed.  When storage is used in any other way, such as on the right side of an assignment, as an operand to a primitive operator (including the indirection operator, *),[5] or as a function parameter, we say it is used as an rvalue.  It is an anomaly to use undefined storage as an rvalue.

 

A pointer is a typed memory address.  A pointer is either live or dead.  A live pointer is either NULL or an address within allocated storage.  A pointer that points to an object is an object pointer.  A pointer that points inside an object (e.g., to the third element of an allocated block) is an offset pointer.  A pointer that points to allocated storage that is not defined is an allocated pointer.  The result of dereferencing an allocated pointer is undefined storage.  Hence, it is an anomaly to use it as an rvalue.  A dead (or “dangling”) pointer does not point to allocated storage.  A pointer becomes dead if the storage it points to is deallocated (e.g., the pointer is passed to the free library function.)  It is an anomaly to use a dead pointer as an rvalue.

 

There is a special object null corresponding to the NULLpointer in a C program.  A pointer that may have the value NULL is a possibly-null pointer.  It is an anomaly to use a possibly-null pointer where a non-null pointer is expected (e.g., certain function arguments or the indirection operator).

5.2            Deallocation Errors

There are two kinds of deallocation errors with which we are concerned:  deallocating storage when there are other live references to the same storage, or failing to deallocate storage before the last reference to it is lost.  To handle these deallocation errors, we introduce a concept of an obligation to release storage.  Every time storage is allocated, it creates an obligation to release the storage.  This obligation is attached to the reference to which the storage is assigned.[6]  Before the scope of the reference is exited or it is assigned to a new value, the storage to which it points must be released.  Annotations can be used to indicate that this obligation is transferred through a return value, function parameter or assignment to an external reference.

‘Tis in my memory lock’d, and you yourself shall keep the key of it.
Ophelia prefers explicit deallocation (Hamlet. Act I, Scene iii)

5.2.1        Unshared References

The only annotation is used to indicate a reference is the only pointer to the object it points to.  We can view the reference as having an obligation to release this storage.  This obligation is satisfied by transferring it to some other reference in one of three ways:

·      pass it as an actual parameter corresponding to a formal parameter declared with an only annotation              

·      assign it to an external reference declared with an only annotation

·      return it as a result declared with an only annotation

After the release obligation is transferred, the original reference is a dead pointer and the storage it points to may not be used.

 

All obligations to release storage stem from primitive allocation routines (e.g., malloc), and are ultimately satisfied by calls to free.  The standard library declared the primitive allocation and deallocation routines.

 

The basic memory allocator, malloc, is declared:

/*@only@*/ /*@null@*/ void *malloc (size_t size);

It returns an object that is referenced only by the function return value. 

 

The deallocator, free, is declared:[7]

void free (/*@only@*/ /*@out@*/ /*@null@*/ void *ptr);

only.c

Running Splint

extern /*@only@*/ int *glob;

 

/*@only@*/ int *

f (/*@only@*/ int *x, int *y,

   int *z)

  /*@globals glob;@*/

{

 8 int *m = (int *)

 9     malloc (sizeof (int));

 

11 glob = y;    Memory leak

12 free (x);

13 *m = *x;     Use after free

14 return z;    Memory leak detected 

}

> splint only.c

only.c:11: Only storage glob (type int *) not released

              before assignment: glob = y

   only.c:1: Storage glob becomes only

only.c:11: Implicitly temp storage y assigned to only:

              glob = y

only.c:13: Dereference of possibly null pointer m: *m

   only.c:8: Storage m may become null

only.c:13: Variable x used after being released

   only.c:12: Storage x released

only.c:14: Implicitly temp storage z returned as only: z

only.c:14: Fresh storage m not released before return

   only.c:9: Fresh storage m allocated  

Figure 6.  Memory Management

The parameter to free must reference an unshared object.  Since the parameter is declared using only, the caller may not use the referenced object after the call, and may not pass in a reference to a shared object.  There is nothing special about malloc and free — their behavior can be described entirely in terms of the provided annotations.

5.2.2        Temporary Parameters

The temp annotation is used to declare a function parameter that is used temporarily by the function.  An error is reported if the function releases the storage associated with a temp formal parameter or creates new aliases to it that are visible after the function returns.  Any storage may be passed as a temp parameter, and it satisfies its original memory constraints after the function returns.

5.2.3        Owned and Dependent References

In real programs it is sometimes necessary to have storage that is shared between several possibly references.  The owned and dependent annotations provide a more flexible way of managing storage, at the cost of less checking.  The owned annotation denotes a reference with an obligation to release storage.  Unlike only, however, other external references marked with dependent annotations may share this object.  It is up to the programmer to ensure that the lifetime of a dependent reference is contained within the lifetime of the corresponding owned reference.

5.2.4        Keep Parameters

The keep annotation is similar to only, except the caller may use the reference after the call.  The called function must assign the keep parameter to an only reference, or pass it as a keep parameter to another function.  It is up to the programmer to make sure that the calling function does not use this reference after it is released.  The keep annotation is useful for adding an object to a collection (e.g., a symbol table), where it is known that it will not be deallocated until the collection is.

5.2.5        Shared References

If Splint is used to check a program designed to be used in a garbage-collected environment, there may be storage that is shared by one or more references and never explicitly released.  The shared annotation declares storage that may be shared arbitrarily, but never released.

5.2.6        Stack References

Local variables that are not allocated dynamically are stored on a call stack.  When a function returns, its stack frame is deallocated, destroying the storage associated with the function’s local variables.  A memory error occurs if a pointer into this storage is live after the function returns.  Splint detects errors involving stack references exported from a function through return values or assignments to references reachable from global variables or actual parameters.  No annotations are needed to detect stack reference errors, since it is clear from a declaration if storage is allocated on the function stack.  Figure 7 gives and example of errors reported involving stack-allocated storage.

stack.c

Running Splint

int *glob;

 

/*@dependent@*/ int *

  f (int **x)

{

  int sa[2] = { 0, 1 };

  int loc = 3;

 

 9 glob = &loc;

10 *x = &sa[0];

 

12 return &loc;

> splint stack.c

stack.c:12: Stack-allocated storage &loc reachable

               from return value: &loc

stack.c:12: Stack-allocated storage *x reachable from

               parameter x

   stack.c:10: Storage *x becomes stack

stack.c:12: Stack-allocated storage glob reachable

               from global glob

   stack.c:9: Storage glob becomes stack

 

A dependent annotation is used on the return value.  Without this, other warnings would be reported, since the result would have an implicit only annotation.

Figure 7.  Stack-Allocated Storage

5.2.7        Inner Storage

An annotation always applies to the outermost level of storage.  For example,

/*@only@*/ int **x;

declares x as an unshared pointer to a pointer to an int.  The only annotation applies to x, but not to *x.  To apply annotations to inner storage a type definition may be used:

  typedef /*@only@*/ int *oip;

  /*@only@*/ oip *x;

Now, x is an only pointer to an oip, which is an only pointer to an int.

When annotations are used in type definitions, they may be overridden in instance declarations.  For example,

/*@dependent@*/ oip x;

makes x a dependent pointer to an int.  Another way to apply annotations to inner storage is to use a state clause (see Section 7.4).

5.3            Implicit Memory Annotations

Since it is important that Splint can check unannotated programs effectively, the meaning of declarations with no memory annotations is chosen to minimize the number of annotations needed to get useful checking on an unannotated program.

 

An implicit memory management annotation may be assumed for declarations with no explicit memory management annotation.  Implicit annotations are checked identically to the corresponding explicit annotation, except error messages indicate that they result from an implicit annotation.  Figure 8 illustrates some implicit annotations.

 

Unannotated function parameters are assumed to be temp.  This means if memory checking is turned on for an unannotated program, all functions that release storage referenced by a parameter or assign a global variable to alias the storage will produce error messages.  (Controlled by paramimptemp.)

 

implicit.c

typedef struct {

   only char *name;

   int   val;

} *rec;

 

extern only rec rec_last ;

 

extern only rec

   rec_create (temp char *name,

               int val) ;

Annotations in italics are not present in the code, but may be implied depending on flag settings.

 

Implicit only annotation on mutable structure field if structimponly is on.

 

Implicit only annotation on mutable global variables if globimponly is on.

 

Implicit only annotation on mutable function result if retimponly is set. Implicit temp annotation on mutable parameter if paramimptemp is set.

Figure 8.  Implicit Annotations

Unannotated return values, structure fields and global variables are assumed to be only.  With implicit annotations (on by default), turning on memory checking for an unannotated program will produce errors for any function that does not return unshared storage or assignment of shared storage to a global variable or structure field.  If an exposure qualifier is used (see Section 6.2), the implied dependent annotation is used instead of the more generally implied only annotation.  (Controlled by retimponly, structimponly and globimponly.  The allimponly flag sets all of the implicit only flags.)   

5.4            Reference Counting

Another approach to memory management is to add a field to a type to explicitly keep track of the number of references to that storage.  Every time a reference is added or lost the reference count is adjusted accordingly; if it would become zero, the storage is released.  Reference counting it difficult to do without automatic checking since it is easy to forget to increment or decrement the reference count, and exceedingly difficult to track down these errors.

 

Splint supports reference counting by using annotations to constrain the use of reference counted storage in a manner similar to other memory management annotations.

 

A reference counted type is declared using the refcounted annotation.  Only pointer to struct types may be declared as refcounted, since reference counted storage must have a field to count the references.  One field in the structure (or integral type) is preceded by the refs annotation to indicate that the value of this field is the number of live references to the structure. For example (in rstring.h),

      typedef /*@abstract@*/ /*@refcounted@*/ struct {

        /*@refs@*/ int refs;

        char *contents;

      } *rstring;

declares rstring as an abstract, reference-counted type.  The refs field counts the number of references and the contents field holds the contents of a string.

 

rstring.c

Running Splint

# include "rstring.h"

 

static rstring rstring_ref (rstring r)

{

  r->refs++;

6 return r;

}

 

rstring rstring_first (rstring r1, rstring r2)

{

  if (strcmp (r1->contents, r2->contents) < 0)

12   return r1;

   else

14     return rstring_ref (r2);

}

> splint rstring.c

rstring.c:12: Reference counted 

   storage returned without modifying

   reference count: r1

 

No error is reported for line 6 since the reference count was incremented.  No error is reported for line 14, since rstring_ref returns a new reference.

 

Figure 9.  Reference Counting


All functions that return refcounted storage must increase the reference count before returning.  Splint cannot determine if the reference count was increased, so any function that directly returns a reference to refcounted storage will produce an error.  This is avoided, by using a function to return a new reference (e.g., rstring_ref in Figure 9).

 

A reference counted type may be passed as a temp or dependent parameter.  It may not be passed as an only parameter.  Instead, the killref annotation is used to denote a parameter whose reference is eliminated by the function call.  Like only parameters, an actual parameter corresponding to a killref formal parameter may not be used in the calling function after the call.  Splint checks that the implementation of a function releases all killref parameters, either by passing them as killref parameters, or assigning or returning them without increasing the reference count.

6              Sharing

Errors involving unexpected sharing of storage can cause serious problems.  Undocumented sharing may lead to unpredictable modifications, and some library calls (e.g., strcpy) have undefined behavior if parameters share storage.  Another class of sharing errors occurs when clients of an abstract type may obtain a reference to mutable storage that is part of the abstract representation.  This exposes the representation of the abstract type, since clients may modify an instance of the abstract type indirectly through this shared storage.

6.1            Aliasing

Splint detects errors involving dangerous aliasing of parameters.  Some of these errors are already detected through the standard memory annotations (e.g., only parameters may not be aliases.)   Two additional annotations are provided for constraining aliasing of parameters and return values.

6.1.1        Unique Parameters

The unique annotation denotes a parameter that may not be aliased by any other storage reachable from the function implementation — that is, any storage reachable through the other parameters or global variables used by the function.  The unique annotation places similar constraints on function parameters as the only annotation, but it does not transfer the obligation to release storage.  Splint will report an error if a unique parameter may be aliased by another parameter or global variable.

 

Splint reports an error if a function returns a reference to storage reachable from one of its parameters (if retalias is on) since this may introduce unexpected aliases in the body of the calling function when the result is assigned.

 

Figure 10 illustrated sharing checks.  An error is reported since the first parameter to the library function strcpy is declared with unique.  If a unique qualifier were added to the parameter declaration for s or t, no error would be reported. 

unique.c

Running Splint

# include <string.h>

 

void 

capitalize (/*@out@*/ char *s,

            char *t)

{

 7  strcpy (s, t);

   *s = toupper (*s);

}

> splint unique.c

 

unique.c: (in function capitalize)

unique.c:7: Parameter 1 (s) to function strcpy is

    declared unique but may be aliased externally by

    parameter 2 (t)

 

Figure 10.  Unique parameters

6.1.2        Returned Parameters

The returned annotation denotes a parameter that may be aliased by the return value.  Splint checks the call assuming the result may be an alias to the returned parameter.

 

Consider the following code excerpt:

 

extern intSet intSet_insert (/*@returned@*/ intSet s, int x);

 

intSet intSet_singleton (int x)

{

7  return (intSet_insert (intSet_new (), x));

}

 

Without the returned qualifier on the parameter to intSet_insert, a memory leak error would be reported for line 7, since the only storage returned by intSet_new is not released.  Because of the returned qualifier, Splint assumes the result of intSet_insert is the same storage as its first parameter, in this case the storage returned by intSet_new.  No error is reported, since the only storage is then transferred through the return value (which has an implicit only annotation, see Section 5.3).

6.2            Exposure

Splint detects places where the representation of an abstract type is exposed.  This occurs if a client has a pointer to storage that is part of the representation of an instance of the abstract type.  The client can then modify or examine the storage this points to, and manipulate the value of the abstract type instance without using its operations.

 

There are three ways a representation may be exposed:

1.       Returning (or assigning to a global variable) an object that includes a pointer to a mutable component of an abstract type representation.  (Controlled by ret-expose).

2.       Assigning a mutable component of an abstract object to storage reachable from an actual parameter or a global variable that may be used after the call.   This means the client may manipulate the abstract object using the actual parameter after the call.  Note that if the corresponding formal parameter is declared only, the caller may not use the actual parameter after the call so the representation is not exposed.  (Controlled by assign-expose).

3.       Casting mutable storage to or from an abstract type.  (Controlled by cast-expose).

Annotations may be used to allow exposed storage to be returned safely by restricting how the caller may use the returned storage.

6.2.1        Read-Only Storage

It is often useful for a function to return a pointer to internal storage (or an instance of a mutable abstract type) that is intended only as an observer.  The caller may use the result, but should not modify the storage it points to.  For example, consider a naïve implementation of the employee_getName operation for the abstract employee type:

   typedef /*@abstract@*/ struct {

      char *name;

      int id;

   } *employee;

   …

   char *employee_getName (employee e) { return e->name; }

Splint produces a message to indicate that the return value exposes the representation.  One solution would be to return a fresh copy of e->name.  This is expensive, though, especially if we expect employee_getName is used mainly just to get a string for searching or printing.  Instead, we could change the declaration of employee_getName to:

extern /*@observer@*/ char *employee_getName (employee e);

Now, the original implementation is correct.  The declaration indicates that the caller may not modify the result, so it is acceptable to return shared storage.  (The program must also not use the returned observer storage after any other calls to the abstract type module using the same parameter.  Splint does not attempt to check this, and in practice it is rarely a problem.)  Splint checks that the caller does not modify the return value.  An error is reported if observer storage is modified directly, passed as a function parameter that may be modified, assigned to a global variable or reference derivable from a global variable that is not declared with an observer annotation , or returned as a function result or a reference derivable from the function result that is not annotation with an observer annotation.

String Literals

A program that attempts to modify a string literal has undefined behavior [ISO, 6.4.5]. This is not enforced by most C compilers, and can lead to particularly pernicious bugs that only appear when optimizations are turned on and the compiler attempts to minimize storage for string literals.  Splint can be used to check that string literals are not modified, by treating them as -observer storage.  If +read-only-strings is set (default in standard mode), Splint will report an error if a string literal is modified.

6.2.2        Exposed Storage

Sometimes it is necessary to expose the representation of an abstract type.  This may be evidence of a design flaw, but in some cases is justified for efficiency reasons.  The exposed annotation denotes storage that is exposed.  It may be used on a return value for results that reference storage internal to an abstract representation, on a parameter value to indicate a parameter that may be assigned directly to part of an abstract representation (note that if the parameter is annotated with only, it is not an error to assign it to part of an abstract representation, since the caller may not use the storage after the call returns), or on a field of an abstract representation to indicate that external references to the storage may exist.  An error is reported if exposed storage is released, but unlike an observer, no error is reported if it is modified.  Figure 11 shows examples of exposure problems detected by Splint.

 

exposure.c

Running Splint

# include "employee.h"

 

char *

employee_getName (employee e)

{

6  return e->name;

}

 

/*@observer@*/ char *

employee_obsName (employee e)

{ return e->name; }

 

/*@exposed@*/ char *

employee_exposeName (employee e)

{ return e->name; }

 

void

employee_capName (employee e)

{

  char *name;

 

  name = employee_obsName (e);

23 *name = toupper (*name);

}

> splint exposure.c +checks

 

exposure.c:6: Function returns reference to

                 parameter e: e->name

exposure.c:6: Return value exposes rep of

                 employee: e->name

exposure.c:6: Released storage e->name reachable

                 from parameter at return point

   exposure.c:6: Storage e->name is released

exposure.c:23: Suspect modification of observer

                  name: *name = toupper(*name)

 

Three messages are reported for line 6 where a mutable field of an abstract type is returned with no sharing qualifier (without +checksonly the third one would be reported.)  The error for line 23 reports a modification of an observer.  If the call in line 22 were changed to call employee_exposeName , no error would be reported.

Figure 11.  Exposure

 

7              Function Interfaces

Functions communicate with their calling environment through an interface.  The caller communicates the values of actual parameters and global variables to the function, and the function communicates to the caller through the return value, global variables and storage reachable from the actual parameters.  By keeping interfaces narrow (restricting the amount of information visible across a function interface), we can understand and implement functions independently. 

 

A function prototype documents the interface to a function.  It serves as a contract between the function and its caller.  In early versions of C, the function “prototype” was very limited.  It described the type returned by the function but nothing about its parameters.  ANSI C (1989) provided function prototypes with the ability to add information on the number and types of parameter to a function.  Splint provides the means to express much more about a function interface such as what global variable the function may use and what values visible to the caller it may modify.

 

The extra interface information places constraints on both how the function may be called and how it may be implemented.  Splint reports places where these constraints are not satisfied.  Typically, these indicate bugs in the code or errors in the interface documentation.

 

This section describes annotations that may be added to a function declaration to document what global variables the function implementation may use and what values visible to its caller it may modify.

7.1            Modifications

The modifies clause lists what values visible to the caller may be modified by a function.  Modifies clauses limit what values a function may modify, but they do not require that listed values are always modified.  The declaration,

int f (int *p, int *q) /*@modifies *p@*/;

declares a function f that may modify the value pointed to by its first argument but may not modify the value of its second argument or any global state.

 

Splint checks that a function does not modify any caller-visible value not encompassed by its modifies clause and does modify all values listed in its modifies clause on some possible execution of the function.  Figure 12 shows an example of modifies checking done by Splint.

 

modify.c

Running Splint

void setx (int *x, int *y)

  /*@modifies *x@*/

{

4  *y = *x;

}

 

void sety (int *x, int *y)

  /*@modifies *y@*/

{

   setx (y, x);

}

> splint modify.c +checks

modify.c:4: Undocumented modification of *y: *y = *x

modify.c:5: Suspect object listed in modifies of setx

               not modified: *x

   modify.c:1: Declaration of setx

 

There are no errors for sety– the call to setxmodifies the value
pointed to by its first parameter (
y) as documented by the
modifies clause.  The
checksmode turns on mustmodchecking,
so the second error concerning missing documented
modifications is reported.

Figure 12.  Modification


7.1.1        State Modifications

A few special names are provided for describing function modifications that effect state not identifiable through parameters or global variables:

internalState

The function modifies some internal state (that is, the value of a static variable).  Even though a client cannot access the internal state directly, it is important to know that something may be modified by the function call both for clear documentation and for checking undefined order of evaluation (Section 8.2) and side effect free parameters (Section 11.2.1).

fileSystem

The function modifies the file system.  Any modification that may change the system state is considered a file system modification.  All functions that modify an object of type pointer to FILE also modify the file system.  In addition, functions that do not modify a FILE pointer but modify some state that is visible outside this process also modify the file system (e.g., rename).   The flag mod-file-system controls reporting of undocumented file system modifications.

nothing

The function modifies nothing (i.e., it is side effect free).

 

The annotation, /*@*/ in a function declaration or definition (after the parameter list, before the semi-colon or function body) denotes a function that modifies nothing and does not use any global variables (see Section 7.2).

7.1.2        Missing Modifies Clauses

Splint is designed so programs with many functions that are declared without modifies clauses can be checked effectively.  Unless modnomods is in on, no modification errors are reported checking a function declared with no modifies clause. 

 

A function with no modifies clause is an unconstrained function since there are no documented constraints on what it may modify.  When an unconstrained function is called, it is checked differently from a function declared with a modifies clause.  To prevent spurious errors, no modification error is reported at the call site unless the mod-uncon flag is on.  Flags control whether errors involving unconstrained functions are reported for other checks that depend on modifications (side effect free macro parameters (Section 11.2.1), undefined evaluation order (Section 8.2), and likely infinite loops (Section 8.3.1).)

7.2            Global Variables

Another aspect of a function’s interface, is the global variables it uses.  A globals list in a function declaration lists external variables that may be used in the function body.  Splint checks that global variables used in a procedure match those listed in its globals list. A global is used in a function if it appears in the body directly, or it is in the globals list of a function called in the body. Splint reports if a global that is used in a procedure is not listed in its globals list, and if a listed global is not used in the function implementation.  Figure 13 shows an example function definition with a globals list and associated checking done by Splint.

globals.c

Running Splint

int glob1, glob2;

 

3 int f (void) /*@globals glob1;@*/

{

return glob2;

}

> splint globals.c +checks

 

globals.c:5: Undocumented use of global glob2

globals.c:3: Global glob1 listed but not used

 

 

Figure 13.  Global Variables

7.2.1        Controlling Globals Checking

Whether on not an error is reported for a use of a global variable in a given function depends on the scope of the variable (file static or external), the checking annotation used in the variable declaration or the implicit annotation if no checking annotation is used, whether or not the function is declared with a globals list, and flag settings.

 

A global or file static variable declaration may be preceded by an annotation to indicate how the variable should be checked.  In order of decreasing checks, the annotations are:

/*@checkedstrict@*/

Strictest checking.  Undocumented uses and modifications of the variable are reported in all functions whether or not they have a globals list (unless check-strict-globs is off).

/*@checked@*/

Undocumented use of the variable is reported in a function with a globals list, but not in a function declared with no globals (unless glob-noglobs is on).

/*@checkmod@*/

Undocumented uses of the variable are not reported, but undocumented modifications are reported.   (If mod-globs-nomods is on, errors are reported even in functions declared with no modifies clause or globals list.)

/*@unchecked@*/

No messages are reported for undocumented use or modification of this global variable.

If a variable has none of these annotations, an implicit annotation is determined by the flag settings. 

 

Different flags control the implicit annotation for variables declared with global scope and variables declared with file scope (i.e., using the static storage qualifier). To set the implicit annotation for global variables declared in context (globs for external variables or statics for file static variable) to be annotation (checked, checkmod, checkedstrict) use imp<annotation> <context>.  For example, +imp-checked-strict-statics makes the implicit checking on unqualified file static variables checkedstrict.  See Appendix B for a complete list of globals checking flags.

7.2.2        Definition State

Annotations can be used in the globals list of a function declaration to describe the states of global variables before and after the call.  If a global is preceded by undef, it is assumed to be undefined before the call. Thus, no error is reported if the global is not defined when the function is called, but an error is reported if the global is used in the function body before it is defined.  The killed annotation denotes a global variable that may be undefined when the call returns.  For globals that contain dynamically allocated storage, a killed global variable is similar to an only parameter (Section 5.2).  An error is reported if it contains the only reference to storage that is not released before the call returns.  Figure 14 illustrated killed and undef globals.

            annotglobs.c

Running Splint

int globnum;

 

struct {

  char *firstname, *lastname;

  int id;

} globname;

 

void

initialize (/*@only@*/ char *name)

  /*@globals undef globnum,

             undef globname @*/

{

13 globname.id = globnum;

  globname.lastname = name;

15}

 

void finalize (void)

  /*@globals killed globname@*/

{

  free (globname.lastname);

21 }

> splint annotglobs.c

 

annotglobs.c:13: Undef global globnum used

                    before definition

annotglobs.c:15: Global storage globname

    contains 1 undefined field when call

    returns: firstname

annotglobs.c:21: Only storage

    globname.firstname (type char *) derived

    from killed global is not released

    (memory leak)

Figure 14.  Annotated Globals Lists

7.3            Declaration Consistency

Splint checks that function declarations and definitions are consistent.  The general rule is that the first declaration of a function implies all later declarations and definitions.  If a function is declared in a header file, the first declaration processed is its first declaration (if it is declared in more than one header file an error is reported if redecl is set) (if the same function is declared in more than one header file ???).  Otherwise, the first declaration in the file defining the function is its first declaration.

 

Later declarations may not include variables in the globals list that were not included in the first declaration.  The exception to this is when the first declaration is in a header file and the later declaration or definition includes file static variables.  Since these are not visible in the header file, they can not be included in the header file declaration.  Similarly, the modifies clause of a later declaration may not include objects that are not modifiable in the first declaration.  The later declaration may be more specific.  For example, if the header declaration is:

extern void setName (employee e, char *s) /*@modifies e@*/;

the later declaration could be,

   void setName (employee e, char *) /*@modifies e->name@*/;

If employee is an abstract type, the declaration in the header should not refer to a particular implementation (i.e., it shouldn’t rely on there being a name field), but the implementation declaration can be more specific. 

 

This rule also applies to file static variables.  The header declaration for a function that modifies a file static variable should use modifies internalState since file static variables are not visible to clients.  The implementation declaration should list the actual file static variables that may be modified.

7.4            State Clauses

Sometimes it is necessary to specify function interfaces at a lower level than is possible with the standard annotations.  For example, if a function defines some fields of a returned structure but does not define all the fields.  The /*@special@*/ annotation is used to mark a parameter, global variable, or return value that is described using state clauses. 

 

State clauses may be used to constrain the state of a parameter or return value before or after a call.  One or more state clauses may appear in a function declaration, before the modifies or globals clauses.  State clauses may be listed in any order, but the same state clause should not be used more than once.  In a state clause list, result is used to refer to the return value of the function. 

 

The following state clauses are used to describe the definition state or parameters before and after the function is called and the return value after the function returns:

/*@uses <references>@*/

References in a uses clause must be completely defined before the function is called.  They are assumed to be defined at function entrance when the function is checked.

/*@sets <references>@*/

References in a sets clause must be allocated before the function is called.  They are completely defined after the function returns. They are assumed to be allocated but undefined storage at function entrance and an error is reported if there is a path on which they are not defined before the function returns.

/*@defines <references>@*/

References in a defines clause must not refer to unshared, allocated storage before the function is called.  They are completely defined after the function returns. When the function is checked, they are assumed to be undefined at function entrance and an error is reported if there is a path on which they are not defined before the function returns.

/*@allocates <references>@*/

References in an allocates clause must be unallocated before the function is called.  They are allocated but not necessarily defined after the function returns. An error is reported if there is a path through the function on which they are not allocated before the function returns.

/*@releases <references>@*/

References in the releases clause are deallocated by the function.  They must be storage that could be passed as an only parameter before the function is called, and are dead pointers after the function returns.  They are assumed to be defined at function entrance and an error is reported if they refer to live, allocated storage at any return point.

 

Some examples of state clauses are shown in Figure 15. The defines clause for record_new indicates that the id field of the structure pointed to by the result is defined, but the name field is not.  So, record_create needs to call record_setName to define the name field.  Similarly, the releases clause for record_clearName indicates that no storage is associated with the name field of its parameter after the return, so no failure to deallocate storage message is produced for the call to free in record_free.  The ensures isnull clause is described in the next section.

clauses.c

typedef struct

{

  int id;

  /*@only@*/ char *name;

} *record;

 

static /*@special@*/ record record_new (void)

  /*@defines result->id@*/

{

  record r = (record) malloc (sizeof (*r));

 

  assert (r != NULL);

  r->id = 3;

  return r;

}

 

static void

   record_setName (/*@special@*/ record r, /*@only@*/ char *name)

   /*@defines r->name@*/

{

  r->name = name;

}

 

record record_create (/*@only@*/ char *name)

{

  record r = record_new ();

  record_setName (r, name);

  return r;

}

 

void record_clearName (/*@special@*/ record r)

   /*@releases r->name@*/

   /*@ensures isnull r->name@*/

{

  free (r->name);

  r->name = NULL;

}

 

void record_free (/*@only@*/ record r)

{

  record_clearName (r);

  free (r);

}

 

Figure 15.  State Clauses

 

7.5            Requires and Ensures Clauses

More general assumptions about state of parameters and globals before and after a function is called can be described using requires and ensures clauses.  A requires clause specifies a predicate that must be true at a call site; when checking a function implementation Splint assumes the constraints given in its requires clauses are true at function entry.  An ensures clause specifies a predicate that is true at a call site after the call returns; when checking a function implementation Splint warns if there is an execution path that does not return with a state that satifies the constraints given in its ensures clauses.  A function declaration can have many requires and ensures clauses as long as their meanings are not contradictory.

 

The following constraints can be stated using requires and ensures clauses:

Aliasing Annotations

/*@requires only<references>@*/; /*@ensures only<references>@*/

/*@requires shared<references>@*/; /*@ensures shared<references>@*/

/*@requires owned<references>@*/; /*@ensures owned<references>@*/

/*@requires dependent<references>@*/; /*@ensures dependent<references>@*/

References refer to only, shared, owned or dependent storage before (requires) or after (ensures) the call.

Exposure Annotations

/*@requires observer<references>@*/; /*@ensures observer<references>@*/

/*@requires exposed<references>@*/; /*@ensures exposed <references>@*/

References refer to observer or exposed storage before (requires) or after (ensures) the call.

Null StateAnnotations

/*@requires isnull<references>@*/; /*@ensures isnull<references>@*/

References have the value NULL before (requires) or after (ensures) the call.  Note, this is not the same name or meaning as the null annotation (which means the value may or may not be NULL.)

/*@requires notnull<references>@*/; /*@ensures notnull<references>@*/

References do not have the value NULL before (requires) or after (ensures) the call.

 

8              Control Flow

The section describes checking done by Splint related to control flow.  Many of these checks are significantly improved because of the extra information that is known about the program when annotations are provided.

8.1            Execution

To detect certain errors and avoid spurious errors, it is important to know something about the control flow behavior of called functions. Without additional information, Splint assumes that all functions eventually return and execution continues normally at the call site. 

 

The noreturn annotation is used to denote a function that never returns [8].  For example,

extern /*@noreturn@*/ void fatalerror (/*@observer@*/ char *s);

declares fatalerror to never return.  This enables Splint to correctly analyze code like,

   if (x == NULL) fatalerror ("Yikes!");

   *x = 3;

Other functions may return, but sometimes (or usually) return normally.  The maynotreturn annotation denotes a function that may or may not return.  This may be useful for documentation, but does not help checking much, since Splint must assume that a function declared with maynotreturn returns normally when checking the code.  The alwaysreturns annotation denotes a function that always returns (but Splint does no checking to verify this).

 

To describe non-returning functions more precisely, the noreturnwhentrue and noreturnwhenfalse annotations may be used.  Similar to nullwhentrue and falsewhennull (see Section 2.1.1), noreturnwhentrue and noreturnwhenfalse mean that a function never returns if the value of its first argument is true (noreturnwhentrue) or false (noreturnwhenfalse).  They may be used only on functions whose first argument is a Boolean.  

 

Hence, a function declared with noreturnwhenwfalse must not return if the value of its argument is false.  For example, the standard library declares assert as[9]:

/*@noreturnwhenfalse@*/ void

assert (/*@sef@*/ bool /*@alt int@*/ pred);

This way, code like,

   assert (x != NULL);

   *x = 3;

is checked without reporting a false warning, since the noreturnwhenwfalse annotation on assert means the deference of x is not reached is x != NULL is false.

8.2            Undefined Behavior

The order in which side effects take place in a C program is not entirely defined by the code.  Certain execution points are known as sequence points — a function call (after the arguments have been evaluated), the end of a full expression (an initializer, expression in an expression statement, the control expression of an if, switch, while or do statement, each expression of a for statement, and the expression in a return statement), and after the first operand or a &&, ||, ? or , operand.

 

All side effects before a sequence point must be complete before the sequence point, and no evaluations after the sequence point shall have taken place.  Between sequence points, side effects and evaluations may take place in any order.  Hence, the order in which expressions or arguments are evaluated is not specified.  Compilers are free to evaluate function arguments and parts of expressions (that do not contain sequence points) in any order.  The behavior of code is undefined if it uses a value that is modified by another expression that is not required to be evaluated before or after the other use.

 

Splint detects instances where undetermined order of evaluation produces undefined behavior.  If modifies clauses and globals lists are used, this checking is enabled in expressions involving function calls. Evaluation order checking is controlled by the eval-order flag.

            order.c

Running Splint

extern int glob;

 

extern int mystery (void);

 

extern int modglob (void)

   /*@globals glob@*/

   /*@modifies glob@*/;

 

int f (int x, int y[])

{

11 int i = x++ * x;

 

13 y[i] = i++;

14 i += modglob() * glob;

15 i += mystery() * glob;

16 return i;

}

> splint order.c +evalorderuncon

order.c:11: Expression has undefined behavior (value of

    right operand modified by left operand): x++ * x

order.c:13: Expression has undefined behavior (left operand

    uses i, modified by right operand): y[i] = i++

order.c:14: Expression has undefined behavior (value of

    right operand modified by left operand):

    modglob() * glob

order.c:15: Expression has undefined behavior

    (unconstrained function mystery used in left operand

    may set global variable glob used in right operand):

    mystery() * glob

 

The warning for line 14 is reported because the modifies clause of modglob indicated that it may modify glob.  The behavior is undefined since we don’t  know if glob is evaluated before, after or during the modification.  The line 15 warning would not be reported without +evalorderuncon.

Figure 16.  Evaluation Order

 

When checking systems without modifies and globals information (see Section 7), evaluation order checking may report errors when unconstrained functions are called in procedure arguments.  Since Splint has no annotations to constrain what these functions may modify, it cannot be guaranteed that the evaluation order is defined if another argument calls an unconstrained function or uses a global variable or storage reachable from a parameter to the unconstrained function.  Its best to add modifies and globals clauses to constrain the unconstrained functions in ways that eliminate the possibility of undefined behavior.  For large legacy systems, this may require too much effort.  Instead, the ‑eval-order-uncon flag may be used to prevent reporting of undefined behavior due to the order of evaluation of unconstrained functions.  Figure 16 illustrates detection of undefined behavior.

loop.c

Running Splint

extern int glob1, glob2;

extern int f (void)

  /*@globals glob1@*/

  /*@modifies nothing@*/;

extern void g (void)

  /*@modifies glob2@*/ ;

extern void h (void) ;

 

void upto (int x)

{

14  while (x > f ()) g();

15  while (f () < 3) h();

}

> splint loop.c +infloopsuncon

loop.c:14: Suspected infinite loop.  No value used in

    loop test (x, glob1) is modified by test or loop

    body.

loop.c:15: Suspected infinite loop.  No condition

    values modified.  Modification possible through

    unconstrained calls: h

An error is reported for line 14 since the only value modified by
the loop test or body if
glob2 and the value of the loop test
does not depend on
glob2.  The error for line 15 would not be
reported without
+infloopsuncon.

Figure 17.  Infinite Loops

8.3            Problematic Control Structures

A number of control structures that are syntactically legal may indicate likely bugs in programs.  Splint can detect errors involving likely infinite loops (Section 8.3.1), fall through cases and missing cases in switch statements (Section 8.3.2), break statements within deeply nested loops or switches (Section 8.3.3), clauses of if, while or for statements that are empty statements or unblocked single statements (Section 8.3.4) and incomplete if-else logic (Section 8.3.5).  Although any of these may appear in a correct program, depending on the programming style used they may indicate likely bugs or style violations that should be detected and eliminated.

8.3.1        Likely Infinite Loops

Splint reports an error if it detects a loop that appears to be infinite.  An error is reported for a loop that does not modify any value used in its condition test inside the body of the loop or in the condition test itself.  This checking is enhanced by modifies clauses and globals lists (see Section 7) since they provide more information about what global variable may be used in the condition test and what values may be modified by function calls in the loop body.

 

Figure 17 shows examples of infinite loops detected by Splint. An error is reported for the loop in line 14, since neither of the values used in the loop condition (x directly and glob1 through the call to f) is modified by the body of the loop.  If the declaration of g is changed to include glob1 in the modifies clause no error is reported.  (In this example, if we assume the annotations are correct, then the programmer has probably called the wrong function in the loop body.  This isn’t surprising, given the horrible choices of function and variable names!)

 

If an unconstrained function is called within the loop body, Splint will assume that it modifies a value used in the condition test and not report an infinite loop error, unless infloopsuncon is on.  If infloopsuncon is on, Splint will report infinite loop errors for loops where there is no explicit modification of a value used in the condition test, but where they may be an undetected modification through a call to an unconstrained function (e.g., line 12 in Figure 17).

 

 

 

8.3.2        Switches

The automatic fall through of C switch statements is almost never the intended behavior.[10]  Splint detects case statements with code that may fall through to the next case.  The casebreak flag controls reporting of fall through cases.  A single fall through case may be marked by preceding the case keyword with /*@fallthrough@*/ to indicate explicitly that execution falls through to this case.  See Figure 18 for an example.

 

For switches on enum types, Splint reports an error if a member of the enumerator does not appear as a case in the switch body (and there is no default case).  (Controlled by misscase.)

switch.c

Running Splint

typedef enum {

  YES, NO, DEFINITELY,

  PROBABLY, MAYBE } ynm;

void decide (ynm y)

{

  switch (y)

    {

    case PROBABLY:

    case NO: printf ("No!");

10   case MAYBE: printf ("Maybe");

         /*@fallthrough@*/

    case YES: printf ("Yes!");

13   }

}

> splint switch.c

switch.c:10: Fall through case (no preceding break)

switch.c:13: Missing case in switch: DEFINITELY

 

No fall through error is reported for the NO case,
since there are no statements associated with the
previous case. 

The /*@fallthrough@*/ comment prevents
a message from being produced for the
YES case.

Figure 18.  Switch Cases

8.3.3        Deep Breaks

There is no syntax provided by C (other than goto) for breaking out of a nested loop.  All break and continue statements act only on the innermost surrounding loop or switch.  This can lead to serious problems[11] when a programmer intends to break the outer loop or switch instead.  Splint optionally reports warnings for break and continue statements in nested contexts.

 

Four types of break warnings are reported:

·      break inside a loop (while or for) that is inside a loop.  Controlled by looploopbreak.  To indicate that a break is inside an inner loop, precede the break by /*@innerbreak@*/.

·      break inside a loop that is inside a switch statement.  Controlled by switchloopbreak.  To mark the break as a loop break, precede the break by /*@loopbreak@*/.

·      break inside a switch statement that is inside a loop.  Controlled by loopswitchbreak.  To mark the break as a switch break, precede the break by /*@switchbreak@*/.

·      break inside a switch inside another switch.  Controlled by switchswitchbreak.  To indicate that the break is for the inner switch, use /*@innerbreak@*/.

Since continue only makes sense within loops, a warning (Controlled by looploopcontinue.) is reported only for continue statements within nested loops.  A safe inner continue may be preceded by /*@innercontinue@*/ to suppress error messages locally. The deepbreak flag sets all nested break and continue checking flags.

 

Splint warns if the marker preceding a break is not consistent with its placement.  A warning results if innerbreak precedes a break that is not breaking an inner loop, switchbreak precedes a break that is not breaking a switch, or loopbreak precedes a break that is not breaking a loop.

8.3.4        Loop and If Bodies

An empty statement after an if, while or for often indicates a potential bug.  A single statement (i.e., not a compound block) after an if, while or for is not likely to indicate a bug, but make the code harder to read and edit.  Splint can report errors for if or loop statements with empty bodies or bodies that are not compound statements.  Separate flags control checking for statements following an if, while or for:

·      [if,while, for]empty — report errors for empty bodies (e.g., if (x > 3) ; )

·      [if,while, for]block — report errors for non-block bodies (e.g., if (x > 3) x++;)

 

The if statement checks also apply to the body of the else clause.  No ifblock warning is reported if the body of the else clause is an if statement, to allow conventional else if chains. 

8.3.5        Complete Logic

Although it may be perfectly reasonable in many contexts, an if-else chain with no final else may indicate missing logic or forgetting to check error cases.  If elseif-complete is on, Splint warns when an if statement that is the body of an else clause does not have a matching else clause.  For example, the code,

   if (x == 0) { return "nil"; }

   else if (x == 1) { return "many"; }

results in a warning since the second if has no matching else branch.

8.4            Suspicious Statements

Splint detects errors involving statements with no apparent effects (Section 8.4.1) and statements that ignore the result of a called function (Section 8.4.2).

8.4.1        Statements with No Effects

Splint can report errors for statements that have no effect.  (Controlled by no-effect.)   Because of modifies clauses, Splint can detect more errors than traditional checkers.  Unless the no-effect-uncon flag is on, errors are not reported for statements that involve calls to unconstrained functions since the unconstrained function may cause a modification.  Figure 19 shows examples of Splint’s no effect checking.

noeffect.c

Running Splint

extern void

  nomodcall (int *x) /*@*/;

Recall /*@*/ is shorthand for
modifies nothing and use
no globals.

extern void mysterycall (int *x);

 

int noeffect (int *x, int y)

{

  y == *x;

  nomodcall (x);

  mysterycall (x);

  return *x;

}

> splint noeffect.c +noeffectuncon

noeffect.c:6: Statement has no effect: y == *x

noeffect.c:7: Statement has no effect: nomodcall(x)

noeffect.c:8: Statement has no effect (possible

    undetected modification through call to

    unconstrained function mysterycall):

    mysterycall(x)

 

The warning for line 8 would not be
reported without
+noeffectuncon.

Figure 19.  Statements with No Effect

8.4.2        Ignored Return Values

Splint reports an error when a return value is ignored.  Checking may be controlled based on the type of the return value: ret-val-int controls reporting of ignored return values of type int, and ret-val-bool for return values of type bool, and ret-val-others for all other types.  A function statement may be cast to void to prevent this error from being reported.

 

Alternate types (Section 4.4) can be used to declare functions that return values that may safely be ignored by declaring the result type to alternately be void.  Several functions in the standard library are specified to alternately return void to prevent ignored return value errors for standard library functions (e.g., strcpy) where the result may be safely ignored (see Section 14.1).  Figure 20 shows examples of ignored return value errors reported by Splint.

 

ignore.c

Running Splint

# include “bool.h”

extern int fi (void);

extern bool fb (void);

extern int /*@alt void@*/

  fv (void);

 

int ignore (void)

{

  8  fi ();

  9  (void) fi ();

10  fb ();

11  fv ();

12  return fv ();

}

> splint ignore.c

 

ignore.c:8: Return value (type int) ignored: fi()

ignore.c:10: Return value (type bool) ignored: fb()

 

The message for line 8 would not be reported if ‑retvalint is set;
for line 10, if
‑retvalbool is set.

 

 No message is reported for line 9 because the result is cast to void ,
and no message is reported for line 11 because
fvis declared
to alternately return
void.

 

Figure 20.  Ignored Return Values

 


9                   Buffer Sizes

Buffer overflow errors are a particularly dangerous type of bug in C programs.  They are directly responsible for about half of all security attacks [Larochelle01].  For performance reasons, C does not perform run time bounds checking.  Referencing storage outside allocated regions can cause memory corruption and lead to strange behavior.  Moreover, buffer overflow bugs are particularly insidious because they can go undetected in testing or normal use, but usually result in security critical bugs.  Reads beyond the end of a buffer can cause the program to leak information.  Writes beyond the end a buffer (buffer overflows) can usually be exploited make the program run arbitrary code.  Attackers can exploit these programming bugs to replace the return address on the stack and place arbitrary code in memory thereby gaining full access to the machine.  Splint is able to detect many memory bounds errors. [12] 

9.1            Checking Accesses

Splint models blocks of contiguous memory using two properties: maxSet and maxRead.  Given a buffer b, maxSet(b) denotes the highest address beyond b that can be safely used as an lvalue.  For the declaration char buf[MAXSIZE] we have maxSet(buf) = MAXSIZE - 1.  Similarly, maxRead denotes the highest index of a buffer that can be safely used an rvalue.  It is inappropriate to read an uninitialized element or beyond the NUL terminator of a null terminated buffer.

 

When a buffer is accessed as an lvalue, Splint generates a precondition constraint involving the maxSet property.  When a buffer is accessed as an rvalue, Splint generates a precondition constraint involving the maxRead property.  For the expression *ptr, Splint generates the constraints maxSet(ptr) >= 0 or maxRead(ptr) >= 0 depending on whether ptr is used as an lvalue or rvalue.  Similarly, for accesses of the form ptr[i], splint generates the constraints maxSet(ptr) >= i or maxRead(ptr) >= i.  If +boundswrite is set, Splint warns if it is unable to resolve a constraint involving maxSet. If +boundsread is set, Splint warns about unresolved maxRead constraints also.

 

Splint generates postconditions for statements to help resolve precondition constraints.  When a buffer is written to we know that an element of a buffer is initialized and is safe to read.  We generate the postcondition maxRead(ptr) >= 0 if the buffer is accessed using *ptr or maxRead(ptr) >= i if the buffer is accessed using ptr[i].  Splint generates additional postconditions for a variety of C constructs.  For assignment statements, Splint generates a postcondition equating the two operands.  Splint also generates post condition constraints for the maxSet value of fixed sized arrays.

9.2            Annotating Buffer Sizes

Function declarations may include requires and ensures clauses that specify assumptions about buffer sizes for function preconditions.  They are interpreted like requires and ensures clauses for simple memory states (see Section 7.5) but can be more expressive.  When a function with a requires clause is called, the call site must be checked to satisfy the constraints implied by the requires clause.  Similarly, an ensures clause can be used to specify function post conditions.  If the +checkpost flag is set, Splint warns if it cannot verify that a function implementation satisfies its declared postconditions.

 

Constraints can contain function parameters as well as global variables and integer constants. The unary operators, maxSet and maxRead which correspond to the properties described above are also supported.  Multiple predicates may be conjoined using /\

 

For example, the standard library annotates strcpy:

 

void /*@alt char * @*/strcpy

(/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2)

/*@modifies *s1@*/

/*@requires maxSet(s1) >= maxRead(s2) @*/

      /*@ensures maxRead(s1) == maxRead (s2) @*/;    

 

The requires clause indicates that the buffer passed as s1 must be large enough to hold the string passed as s2.  The ensures clause specifies that maxRead of s1 after the call is equal to maxRead of s2.  In cases where the size of s2 is unknown, programs should use strncpy, annotated as:

 

void /*@alt char * @*/ strncpy

   (/*@unique@*/ /*@out@*/ /*@returned@*/ char *s1, char *s2,

  size_t n)

  /*@modifies *s1@*/     

  /*@requires maxSet(s1) >= ( n - 1 ); @*/

  /*@ensures maxRead (s2) >= maxRead(s1) /\ maxRead (s1) <= n;@*/;

 

The syntax for buffer size constraint clauses is:

 

constraint   Þ (requires | ensures) consExpr relOp consExpr

relOp        Þ == | > | >= | < | <=

consExpr  Þ consExpression binOp consExpr | unaryOp (consExpr ) | term

binOp       Þ + | -

unaryOp   Þ maxSet | maxRead

term          Þ identifier | literal | result

9.3            Less Stringent Checking

For some programs, Splint's standard bounds checking produces an unacceptably high number of warnings. Because of this, Splint now prioritizes warnings using a simple heuristic. The flags likely-bounds, likely-bounds-writes, and likely-bounds-read are similar to bounds,bounds-write, and bounds-read, but they only cause Splint to produce warnings for what it determines are likely bounds errors. Splint classifies an unresolved constraint as a likely bounds error if it can reduce the constraint to a numerical inconsistency such as 5 >= 10. Warnings for these constraints are more likely to be legitimate -- indicating real bugs or the lack of annotations. Additionally, when these warnings are false positives, it is easier for humans to recognize them as spurious. These flags generate significantly fewer errors (an order of magnitude in some cases), and the errors generated are easier to understand. However, this does not come without cost. The checking is significantly less precise and is likely to miss real errors.

9.4            Warnings

Since bounds checking is more complex than other checks done by Splint, memory bounds warnings contain extensive information about the unresolved constraint.  Warning messages for unresolved constraints contain both the original constraints and the simplified form of the constraint which cannot be resolved.  If the constraint was derived from a function precondition, the original precondition is included in the error message.  If the +showconstraintlocation flag is set, the message includes the expression that the constraint is derived from.  The +showconstraintparens flag directs Splint to display fully parenthesized constraints in warnings to remove ambiguity.

 

Consider the code excerpt below containing a trivial out-of-bounds write:

 

int buf[10];

buf[10] = 3;

 

Splint warns:

setChar.c:5:4: Likely out-of-bounds store:
    buf[10] = 3

    Unable to resolve constraint: requires 9 >= 10

    needed to satisfy precondition: requires maxSet(buf @ setChar.c:5:4) >= 10

Splint has simplified the constraint from the requires clause to 9 >= 10 by substituting for the known value of maxSet(buf) and generated a warning because 9(the highest index of buf that may be safely written to) is not greater than or equal to 10.

 

A more realistic example is shown Figure 21.  The function updateEnv is a naïve implementation of a function to copy an environmental variable.  There is no standard restriction on the length of the return value of getenv so this can cause a buffer overflow.  A safe version of updateEnv (such as updateEnvSafe in Figure 21) would ensure that the buffer is large enough to hold the environment variable string before copying.

 

 

The requires clause means Splint will report a warning if a call to updateEnvSafe passed in a buffer as str that is not big enough to hold the value passed as strSize characters.

 

In many cases, functions will have multiple unresolved constraints which are similar.  For example, if a subsequence statement writes to the next element of a buffer.  Usually all these constraints represent all real problems or are all spurious.  If the +redundantconstraints flag is set, Splint reports even apparently redundant warning messages.  Otherwise, if satisfying one unresolved constraint would imply satisfying another, Splint only prints a warning message for the stronger constraint.

 

bounds.c

Running Splint

 

void updateEnv(char * str)

{

   char * tmp;

7   tmp = getenv(“MYENV”);

   if (tmp != NULL)

9      strcpy (str, tmp);

}

 

void updateEnvSafe (char * str,

                size_t strSize)

  /*@requires maxSet(str)

              >= strSize –1@*/

{

   char * tmp;

   tmp = getenv(“MYENV”);

   if (tmp != NULL)

   {

      strncpy (str, tmp,

               strSize -1);

      str[strSize -1] = ‘/0’;

   }

}

> splint bounds.c +bounds +showconstraintlocation

 

bounds.c:9: Possible out-of-bounds store:

    strcpy(str, tmp)

    Unable to resolve constraint:

    requires maxSet(str @ bounds.c:9) >=

    maxRead(getenv("MYENV") @ bounds.c:7)

     needed to satisfy precondition:

    requires maxSet(str @ bounds.c:9) >=

    maxRead(tmp @ bounds.c:9)

     derived from strcpy precondition: requires

    maxSet(<parameter 1>) >=

    maxRead(<parameter 2>)

Figure 21.  Memory Bounds


The +functionpost flag is useful for determining if array bounds warnings are spurious.  If this flag is set, Splint will print the constraints that it established at the end of the function.  If the warnings are spurious, localized control comments can be used to suppress them.

 

 

 

10        Extensible Checking

Splint provides mechanisms for defining new checks and annotations using metastate definitions.  User-defined checks can be used to check and document properties not supported by the provided checks. [13]

 

A large class of useful checks can be described as constraints on attributes associated with program objects or the global execution state. Unlike types, however, the values of these attributes can change along an execution path.  Splint provides a general language that lets users define attributes associated with different kinds of program objects as well as rules that both constrain attributes’ values at interface points and specify how attributes change. 

 

Because user-defined attribute checking is integrated with normal checking, Splint’s analysis of user-defined attributes can take advantage of other analyses, such as alias and nullness analysis.

10.1       Defining Attributes

To define an attribute, create a metastate file (.mts) that defined the possible values and transfer rules of the attribute.  Attributes can either be associated with a particular kind of program object (for example, all char *’s) or with the global state (whether or not the network has been initialized).  The –mts <file> flag is used to direct Splint to read a metastate file (which will be found on the LARCH_PATH with default extension .mts).

 

An example attribute definition is shown in Figure 22.  It defines the taintedness attribute for recording whether or not a char * came from a possibly untrustworthy source.  Knowing whether a value is possibly hostile is useful for preventing several security vulnerabilities including format string bugs.[14]  (A simpler way to detect format vulnerabilities is to warn for any format string that is unknown at compile time. Splint provides this checking, issuing a warning if the +formatconst flag is set and finds any unknown format strings at compile time. This can produce spurious messages, however, because there might be unknown format strings that are not vulnerable to hostile input.)

 

The first three lines of the attribute definition define the taintedness attribute associated with char * objects, which can be in one of two states: untainted or tainted.  The context clause gives a context selector for which objects have the attribute.   In this case, reference char * means that every reference that is a char * has an associated taintedness attribute.  Other contexts include parameter (only parameter declarations), literal (only string or number literals), and null (only known NULL values).  Attribute can also be defined that are not associated with any particular object, but instead are associated with the global state of a program execution.  The global keyword is used before attribute to define a global attribute.

 

The oneof clause introduces two identifiers for representing the taintedness value: untainted for references that are not derived from untrustworthy input, and tainted for references that may contain hostile data. 

 

The annotations clause defines two new annotations that may be used to describe taintedness assumptions.  In this case, the annotations match the names of the value choices, but they may be any identifier.  The clause tainted reference ==> tainted defines the tainted annotation that may be used on a reference to indicate that it has tainted state. 

attribute taintedness

   context reference char *

   oneof untainted, tainted

   annotations

     tainted reference ==> tainted

     untainted reference ==> untainted

   transfers

     tainted as untainted ==> error "Possibly tainted storage used where untainted required."

   merge

      tainted + untainted ==> tainted

   defaults

      reference ==> tainted

      literal ==> untainted

      null ==> untainted

end

Figure 22.  Taintedness Attribute


 

The transfers clause defines rules for state changes and warning when objects are passed as parameters, returned, or assigned to externally visible references.  The rule, tainted as untainted ==> error "Possibly tainted storage used where untainted required.", means it is an error to pass a tainted value as a parameter that has untainted taintedness.  All other transfers are implicitly permitted, and leave the passed storage in the same state as before the transfer.  We may also use a transfers clause to indicate that the reference changes state after a transfer.  A losereference clause (not used in taintedness) is similar to a transfers clause, except it is used to provide rules for when a reference to storage is lost, either by leaving the scope in which it was declared, returning from a function, or assigning it to a new value.

 

The merge clause defined rules for combining state along paths.  The clausemerge tainted + untainted ==> tainted indicates that combining tainted and untainted objects produces a tainted object. Thus, if a reference is tainted along one control path and untainted along another control path, checking assumes that it is taintedafter the two branches merge. It is also used to merge taintedness states in function specifications (see the strcat example in the next section).  We can also define error combinations so that a warning is reported if the states on different paths are incompatible.

 

The defaults clause specifies default values used for declarators without explicit attribute annotations. We choose default values to make it easy to start checking an unannotated program. Here we assume unannotated references are tainted and Splint will report a warning where unannotated references are passed to functions that require untainted parameters. The warnings indicate either a format bug in the code or a place where an untainted annotation should be added. Running Splint again after adding the annotation will propagate the newly documented assumption through the program.

 

The full grammar for metastate definitions is given in Appendix C.

10.2       Annotations

The annotations defined by metastate definitions can be used like normal annotations.  The context specifier for an annotation indicates where it may be used.  For the taintedness example, we can use tainted and untainted as annotations wherever only could be used.  This includes ensures and requires clauses, which allows us to specify functions that modify state associated with metastate definitions.  The syntax <expr> :<attribute> is used to refer to the value of the user-defined attribute for expression <expr>

 

It is often necessary to extend the library specifications with metastate annotations.  We don’t want to have different versions of the library for different metastate annotations, so instead Splint provides a mechanism for adding annotations separately using an .xh file.  For the taintedness example, we do this by providing annotated declarations in the tainted.xh file. Example specifications in this file include:

 

int printf  (/*@untainted@*/ char *fmt, ...);

 

char *fgets (char *s, int n, FILE *stream) /*@ensures tainted s@*/ ;

 

char *strcat (/*@returned@*/ char *s1,  char *s2) 

   /*@ensures s1:taintedness = s1:taintedness | s2:taintedness @*/

 

The strcat specification uses /*@ensures s1:taintedness = s1:taintedness | s2:taintedness @*/ to indicate that the taintedness of s1 after strcat returns is the result of merging the taintedness of s1 and s2 before the call.  Because the parameters lack annotations, they are implicitly tainted according to the default rules and either untainted or tainted references can be passed as parameters to strcat. The ensures clause means that after strcat returns the first parameter (and the result, because of the returned annotation on s1) will be tainted if either passed object was tainted.  Splint merges the two taintedness states using the attribute definition rules—hence, if the s1 parameter is untainted and the s2 parameter is tainted, the result and first parameter will be tainted after strcat returns.

 

11        Macros

Macros are commonly used in C programs to implement constants or to mimic functions without the overhead of a function call.  Macros that are used to implement functions are a persistent source of bugs in C programs, since they may not behave like the intended function when they are invoked with certain parameters or used in certain syntactic contexts. 

 

Splint eliminates most of the potential problems by detecting macros with dangerous implementations and dangerous macro invocations.  Whether or not a macro definition is checked or expanded normally depends on flag settings and control comments (see Section 11.3).  Stylized macros can also be used to define control structures for iterating through many values (see Section 11.4).

11.1       Constant Macros

Macros may be used to implement constants.  To get type-checking for constant macros, use the constant annotation.  For example,

/*@constant null char *mstring_undefined@*/

Declared constants are not expanded and are checked according to the declaration.  A constant with a null annotation may be used as only storage.

11.2       Function-like Macros

Using macros to imitate functions is notoriously dangerous.  Consider this broken macro for squaring a number:

# define square(x) x * x

This works fine for a simple invocation like square(i).  It behaves unexpectedly, though, if it is instantiated with a parameter that has a side effect.  For example, square(i++) expands to i++ * i++.  Not only does this give the incorrect result, it has undefined behavior since the order in which the operands are evaluated is not defined.  (See Section 8.2 for more information on how expressions exhibiting undefined evaluation order behavior are detected by Splint.)  To correct the problem we either need to rewrite the macro so that its parameter is evaluated exactly once, or prevent clients from invoking the macro with a parameter that has a side effect. 

 

Another possible problem with macros is that they may produce unexpected results because of operator precedence rules.  The instantiation, square(i+1) expands to i+1*i+1, which evaluates to i+i+1 instead of the square of i+1.  To ensure the expected behavior, the macro parameter should be enclosed in parentheses where it is used in the macro body.

 

Macros may also behave unexpectedly if they are not syntactically equivalent to an expression.  Consider the macro definition,

# define incCounts()  ntotal++; ncurrent++;

This works fine, unless it is used as a statement.  For example,

if (x < 3) incCounts();

increments ntotal if x < 3 but always increments ncurrent.

 

One solution is to use the comma operator to define the macro:

# define incCounts()  (ntotal++, ncurrent++)

More complicated macros can be written using a do … while construction:

  # define incCounts() \

     do { ntotal++; ncurrent++; } while (FALSE)

Splint detects these pitfalls in macro definitions, and checks that a macro behaves as much like a function as possible.  A client should only be able to tell that a function was implemented by a macro if it attempts to use the macro as a pointer to a function.

 

Splint does these checks on a macro definition corresponding to a function:

·      Each parameter to a macro (except those declared to be side effect free, see Section 11.2.1) must be used exactly once in all possible executions of the macro, so side effecting arguments behave as expected.[15]  (Controlled by macroparams.)

·      A parameter to a macro may not be used as the left-hand side of an assignment expression or as the operand of an increment or decrement operator in the macro text, since this produces non-functional behavior.  (Controlled by macroassign.)

·      Macro parameters must be enclosed in parentheses when they are used in potentially dangerous contexts.  (Controlled by macroparens.)

·      A macro definition must be syntactically equivalent to a statement when it is invoked followed by a semicolon. (Controlled by macrostmt.)

·      The type of the macro body must match the return type of the corresponding function.  If the macro is declared with type void, its body may have any type but the macro value may not be used.

·      All variables declared in the body of a macro definition must be in the macro variable namespace, so they do not conflict with variables in the scope where the macro is invoked (which may be used in the macro parameters).  By default, the macro namespace is all names prefixed by m_.  (See Section 12.2 for information on controlling namespaces.)

At the call site, a macro is checked like any other function call.

11.2.1    Side Effect Free Parameters

Suppose we really do want to implement square as a macro, but want do so in a safe way.  One way to do this is to require that it is never invoked with a parameter that has a side effect.  Splint will check that this constraint holds, if the parameter is annotated to be side effect free.  That is, the expression corresponding to this parameter must not modify any state, so it does not matter how many times it is evaluated.  The sef annotation is used to denote a parameter that may not have any side effects:

   extern int square (/*@sef@*/ int x);

   # define square(x) ((x) *(x))

Now, Splint will not report an error checking the definition of square even though x is used more than once.

 

A message will be reported, however, if square is invoked with a parameter that has a side effect.  For the code fragment,

square (i++)

Splint produces the message:

   Parameter 1 to square is declared sef, but the argument may modify: i++

It is also an error to pass a macro parameter that is not annotated with sef as a sef macro parameter in the body of a macro definition.  For example,

   extern int sumsquares (int x, int y);

   # define sumsquares(x,y) (square(x) + square(y))

Although x only appears once in the definition of sumsquares it will be evaluated twice since square is expanded.

 

A parameter may be passed as a sef parameter without an error being reported, if Splint can determine that evaluating the parameter has no side effects.  For function calls, the modifies clause is used to determine if a side effect is possible.[16]   To prevent many spurious errors, if the called function has no modifies clause, Splint will report an error only if sef-uncon is on.  Justifiably paranoid programmers will insist on setting sef-uncon on, and will add modifies clauses to unconstrained functions that are used in sef macro arguments.

 

One common application of macros is to get around the lack of polymorphism in C.  We can use the /*@alt <type>,+@> syntax  (see Section 4.4) to indicate that an alternate type may be used.  For example,

  extern int /*@alt float@*/ square (/*@sef@*/ int /*@alt float@*/ x);

  # define square(x) ((x) *(x))

declares square for both ints and floats.  Note however, that the return type is either int or float, regardless of the actual parameter type.  This is weaker than what is actually known about the return type.

11.3       Controlling Macro Checking

By default, Splint expands macros normally and checks the resulting code after macros have been expanded.  Flags and control comments may be used to control which macros are expanded and which are checked as functions or constants.

 

If the fcn-macros flag is on, Splint assumes all macros defined with parameter lists implement functions and checks them accordingly.  Parameterized macros are not expanded and are checked as functions with unknown result and parameter types (or using the types in the prototype, if one is given).  The analogous flag for macros that define constants is const-macros.  If it is on, macros with no parameter lists are assumed to be constants, and checked accordingly.  The all-macros flag sets both fcn-macros and const-macros.  If the macro-fcn-decl flag is set, a message reports parameterized macros with no corresponding function prototype.  If the macro-const-decl flag is set, a similar message reports macros with no parameters that have no corresponding constant declaration.

 

The macro checks described in the previous sections make sense only for macros that are intended to replace functions or constants.  When fcnmacros or constmacros is on, more general macros need to be marked so they will not be checked as functions or constants, and will be expanded normally.  Macros that are not meant to behave like functions should be preceded by the /*@notfunction@*/comment.  For example,

   /*@notfunction@*/

   # define forever for(;;)

Macros preceded by notfunction are expanded normally before regular checking is done.  If a macro that is not syntactically equivalent to a statement without a semi-colon (e.g., a macro which enters a new scope) is not preceded by notfunction, parse errors may result when fcn-macros or const-macros is on.

11.4       Iterators

It is often useful to be able to execute the same code for many different values.  For example, we may want to sum all elements in an intSet that represents a set of integers.  If intSet is an abstract type, there is no easy way of doing this in a client module without depending on the concrete representation of the type.  Instead, we could provide such a mechanism as part of the type’s implementation.  We call a mechanism for looping through many values an iterator.

 

The C language provides no mechanism for creating user-defined iterators.  Splint supports a stylized form of iterators declared using syntactic comments and defined using macros.

 

Iterator declarations are similar to function declarations except instead of returning a value, they assign values to their yield parameters in each iteration.  For example, we could add this iterator declaration to intSet.h:

/*@iter intSet_elements (intSet s, yield int el);@*/

The yield annotation means that the variable passed as the second actual argument is declared as a local variable of type int and assigned a value in each loop iteration.

11.4.1    Defining Iterators

An iterator is defined using a macro.  Here’s one (not particularly efficient) way of defining intSet_elements:

   typedef /*@abstract@*/ struct {

      int nelements;

      int *elements;

   } intSet;

   …

   # define intSet_elements(s,m_el) \

     { int m_i; \

       for (m_i = (0); m_i <= ((s)->nelements); m_i++) { \

           int m_el = (s)->elements[(m_i)];

 

   # define end_intSet_elements }}

Each time through the loop, the yield parameter m_el is assigned to the next value.  After each value has been assigned to m_el for one iteration, the loop terminates.  Variables declared by the iterator macro (including the yield parameter) are preceded by the macro variable namespace prefix m_ (see Section 11.2) to avoid conflicts with variables defined in the scope where the iterator is used.

11.4.2    Using Iterators

The general structure for using an iterator is,

iter (<params>) stmt; end_iter

For example, a client could use intSet_elements to sum the elements of an intSet:

   intSet s;

   int sum = 0;

   ...

   intSet_elements (s, el) {

sum += el;

   } end_intSet_elements;

The actual parameter corresponding to a yield parameter, el, is not declared in the function scope.  Instead, it is declared by the iterator and assigned to an appropriate value for each iteration.

 

Splint will do the following checks for uses of stylized iterators:

·      An invocation of the iterator iter must be balanced by a corresponding end, named end_iter.

·      All actual parameters must be defined, except those corresponding to yield parameters.

·      Yield parameters must be new identifiers, not declared in the current scope or any enclosing scope.

Iterators are a bit awkward to implement, but they enable compact, easily understood client code.  For abstract collection types, an iterator can be used to enable clients to operate on elements of the collection without breaking data abstraction.

12        Naming Conventions

Naming conventions tend to be a religious issue. Generally, it doesn't matter too much what naming convention is followed as long as one is chosen and followed religiously.  There are two kinds of naming conventions supported by Splint.  Type-based naming conventions (Section 12.1) constrain identifier names according to the abstract types that are accessible where the identifier is defined.  Prefix naming conventions (Section 12.2) constrain the initial characters of identifier names according to what is being declared and its scope.  Naming conventions may be combined or different conventions may be selected for different kinds of identifiers.  In addition, Splint supports checking that names do not conflict with names reserved for the standard library or implementation (Section 12.3) and are sufficiently distinguishable from other names.

12.1       Type-Based Naming Conventions

Generic naming conventions constrain valid names of identifiers.  By limiting valid names, namespaces may be preserved and programs may be more easily understood since the name gives clues as to how and where the name is defined and how it should be used.

 

Names may be constrained by the scope of the name (external, file static, internal), the file in which the identifier is defined, the type of the identifier, and global constraints.

12.1.1    Czech Names

Czech[17] names denote operations and variables of abstract types by preceding the names by <type>_.  The remainder of the name should begin with a lowercase character, but may use any other character besides the underscore.  Types may be named using any non-underscore characters.

 

The Czech naming convention is selected by the czech flag.  If access-czech is on, a function, variable, constant or iterator named <type>_<name> has access to the abstract type <type>.  Reporting of violations of the Czech naming convention is controlled by different flags depending on what is being declared:

czech-fcns

Functions and iterators.  An error is reported for a function name of the form <prefix> _<name> where <prefix> is not the name of an accessible type.  Note that if accessczech is on, a type named <prefix> would be accessible in a function beginning with <prefix> _.  If access-czech is off, an error is reported instead.  An error is reported for a function name that does not have an underscore if any abstract types are accessible where the function is defined.

czech-vars

czech-constants

czech-macros

Variables, constants and expanded macros.  An error is reported if the identifier name starts with <prefix> _and prefix is not the name of an accessible abstract type, or if an abstract type is accessible and the identifier name does not begin with <type>_ where type is the name of an accessible abstract type.  If access-czech is on, the representation of the type is visible in the constant or variable definition.

czech-types

User-defined types.  An error is reported if a type name includes an underscore character.

12.1.2    Slovak Names

Slovak names are similar to Czech names, except they are spelled differently.  A Slovak name is of the form <type><Name>.  The type prefix may not use uppercase characters.  The remainder of the name starts with the first uppercase character.

 

The slovak flag selects the Slovak naming convention.  Like Czech names, it may be used with access-slovak to control access to abstract representations. The slovak-fcns, slovak-vars, slovak-constants, and slovak-macros flags are analogous to the similar Czech flags.  If slovak-type is on, an error is reported if a type name includes an uppercase letter.

12.1.3    Czechoslovak Names

Czechoslovak names are a combination of Czech names and Slovak names.  Operations may be named either <type>_ followed by any sequence of non-underscore characters, or <type> followed by an uppercase letter and any sequence of characters.  Czechoslovak names have been out of favor since 1993, but may be necessary for checking legacy code. The czechoslovak-fcns, czechoslovak-vars, czechoslovak-macros, and czechoslovak-constants flags are analogous to the similar Czech flags.  If czechoslovak-type is on, an error is reported if a type name contains either an uppercase letter or an underscore character.

12.2       Namespace Prefixes

Another way to restrict names is to constrain the leading character sequences of various kinds of identifiers.  For example, the names of all user-defined types might begin with T followed by an uppercase letter and all file static names begin with an uppercase letter.  This may be useful for enforcing a namespace (e.g., all names exported by the X-windows library should begin with X) or just making programs easier to understand by establishing an enforced convention.  Splint can be used to constrain identifiers in this way to detect identifiers inconsistent with prefixes.

 

All namespace flags are of the form, -<context>prefix <string>.  For example, the macro variable namespace restricting identifiers declared in macro bodies to be preceded by m_ would be selected by -macrovarprefix "m_".  The string may contain regular characters that may appear in a C identifier.  These must match the initial characters of the identifier name.  In addition, special characters (shown in Figure 23) can be used to denote a class of characters.[18]  The * character may be used at the end of a prefix string to specify the rest of the identifier is zero or more characters matching the character immediately before the *.  For example, the prefix string T&* matches T or TWINDOW but not Twin.

 

Different prefixes can be selected for the following identifier contexts:

macro-var-prefix

Any variable declared inside a macro body

unchecked-macro-prefix

Any macro that is not checked as a function or constant (see Section 11.4)

tag-prefix

Tags for struct, union and enum declarations

enum-prefix

Members of enum types

type-prefix

Name of a user-defined type

file-static-prefix

Any identifier with file static scope

glob-var-prefix

Any variable (not of function type) with global scope

const-prefix

Any constant (see Section 11.1)

iter-prefix

An iterator (see Section 11.4)

proto-param-prefix

A parameter in a function declaration prototype

external-prefix

Any exported identifier

If an identifier is in more than one of the namespace contexts, the most specific defined namespace prefix is used (e.g., a global variable is also an exported identifier, so if global-var-prefix is set, it is checked against the variable name; if not, the identifier is checked against the external-prefix.)

 

For each prefix flag, a corresponding flag named <prefixname> exclude controls whether errors are reported if identifiers in a different namespace match the namespace prefix.  For example, if macro-var-prefix-exclude is on, Splint checks that no identifier that is not a variable declared inside a macro body uses the macro variable prefix.

 

Here is a (somewhat draconian) sample naming convention:

-unchecked-macro-prefix "~*"

Unchecked macros have no lowercase letters.

-type-prefix "T^&*"

All type names begin with T followed by an uppercase letter.  The rest of the name is all lowercase letters.

+type-prefix-exclude

No identifier that does not name a user-defined type name begins with the type name prefix.

-file-static-prefix "^&&&"

File static scope variables begin with an uppercase letter and three lowercase letters.

-proto-param-prefix "p_"

All parameters in prototypes must begin with p_.

-glob-var-prefix "G"

All global variables start with G.

+glob-var-prefix-exclude

No identifier that is not a global variable starts with G.

 

The prefix for parameters in function prototypes is useful for making sure parameter names are not in conflict with macros defined before the function prototype.  In most cases, it may be preferable to not name prototype parameters.  If the proto-param-name flag is set, an error is reported for any named parameter in a prototype declaration.  If a proto-param-prefix is set, no error is reported for unnamed parameters.

It may also be useful to check the names of prototype parameters correspond to the names in definitions.  While using header files as documentation is not generally recommended, it is common enough practice that it makes sense to check that parameter names are consistent.  A discrepancy may indicate an error in the parameter order in the function prototype.  If proto-param-match is set, Splint will report an error if the name of a definition parameter does not match the corresponding prototype parameter (after removing the protoparamprefix).

^

Any uppercase letter, A-Z

&

Any lowercase letter, a-z

%

Any character that is not an uppercase letter (allows lowercase letters, digits and underscore)

~

Any character that is not a lowercase letter (allows uppercase letters, digits and underscore)

$

Any letter (a-z, A-Z)

/

Any letter or digit (A-Z, a-z, 0-9)

?

Any character valid in a C identifier

#

Any digit, 0-9

Figure 23.  Prefix Character Codes

12.3       Naming Restrictions

Additional naming restrictions can be used to check that names do no conflict with names reserved for the standard library, and that identifier are sufficiently distinct (either for the compiler and linker, or for the programmer.)  Restrictions may be different for names that are needed by the linker (external names) and names that are only needed during compilations (internal names).  Names of non-static functions and global variables are external; all other names are internal.

12.3.1    Reserved Names

Many names are reserved for the implementation and standard library.  A complete list of reserved names can be found in [vdL, p. 126-128].  Some name prefixes such as str followed by a lowercase character are reserved for future library extensions.  Most C compilers do not detect naming conflicts, and they can lead to unpredictable program behavior.  If ansi-reserved is on, Splint warns about external names that conflict with reserved names.  If ansi-reserved-internal is on, warnings are also produced for internal names.

 

If +cpp-names is set, Splint warns about identifier names that are keywords or reserved words in C++.  This is useful if the code may later be compiled with a C++ compiler (of course, this is not enough to ensure the meaning of the code is not changed when it is compiled as C++.)

12.3.2    Distinct Names

Splint can check that names differ within a given number of characters, optionally ignoring alphabetic case and differences between characters that look similar.  The number of significant characters may be different for external and internal names. 

 

Using +distinct-external-names sets the number of significant characters for external names to six and makes alphabetical case insignificant for external names.  This is the minimum significance acceptable in an ANSI-conforming compiler.  Most modern compilers exceed these minimums (which are particularly hard to follow if one uses the Czech or Slovak naming convention).  The number of significant characters can be changed using the external-name-length <number> flag.  If external-name-case-insensitive is on, alphabetical case is ignored in comparing external names. Splint reports identifiers that differ only in alphabetic case.

For internal identifiers, a conforming compiler must recognize at least 31 characters and treat alphabetical cases distinctly.  Nevertheless, it may still be useful to check that internal names are more distinct then required by the compiler to minimize the likelihood that identifiers are confused in the program.  Analogously to external names, the internal-name-length  <number> flag sets the number of significant characters in an internal name and internal-name-case-insensitive sets the case sensitivity.  The internal-name-look-alike flag further restricts distinctions between identifiers.  When set, similar-looking characters match — the lowercase letter l matches the uppercase letter I and the number 1; the letter O or o matches the number 0; 5 matches S; and 2 matches Z.  Identifiers that are not distinct except for look-alike characters will produce an error message.  External names are also internal names, so they must satisfy both the external and internal distinct identifier checks.  Figure 24 provides some examples of distinct name checking.

names.c

Running Splint

 char *stringrev (char *s);

 

3 int f (int x)

  {

5 int lookalike = 1;

6 int looka1ike = 2;

 

  if (x > 3)

    {

10    int x = lookalike;

      x += looka1ike;

    }

 

  return x;

}                        

> splint names.c +distinctinternalnames                        

           +internalnamelookalike  +isoreserved

 

names.c:1: Name stringreverse is reserved for future

    library extensions.  Functions that begin with

    "str" and a lowercase letter may be added to

    <stdlib.h> or <string.h>. (ISO99:7.26.9)

names.c:6: Internal identifier looka1ike is not

    distinguishable from lookalike except by lookalike

    characters

   names.c:5: Declaration of lookalike

names.c:10: Variable x shadows outer declaration

   names.c:3: Previous declaration of x: int

Figure 24.  Distinct Names

13        Completeness

Splint can report warnings for unused declarations and exported declarations that are not used externally.

13.1       Unused Declarations

Splint detects constants, functions, parameters, variables, types, enumerator members, and structure or union fields that are declared but never used.  The flags constuse, fcnuse, paramuse, varuse, typeuse, enummemuse and fielduse control whether unused declaration errors are reported for each kind of declaration.  Errors for exported declarations are reported only if topuse is on (see Section 13.2).

 

The /*@unused@*/ annotation can be used before a declaration to indicate that the item declared need not be used.  Unused declaration errors are not reported for identifiers declared with unused .

13.2       Complete Programs

Splint can be used on both complete and partial programs.  When checking complete programs, additional checks can be done to ensure that every identifier declared by the program is defined and used, and that functions that do not need to be exported are declared static.

 

Splint checks that all declared variables and functions are defined (controlled by compdef ).  Declarations of functions and variables that are defined in an external library, may be preceded by /*@external@*/ to suppress undefined declaration errors.

 

Splint reports external declarations that are unused (controlled by topuse).  Which declarations are reported also depends on the declaration use flags (Section 13.1).  The +partial flag sets flags for checking a partial system.  Top-level unused declarations, undefined declarations, and unnecessary external names are not reported if +partial is set.

13.2.1    Unnecessarily External Names

Splint can report variables and functions that are declared with global scope (i.e., without using static), that are not used outside the file in which they are defined.  In a stand-alone system, these identifiers should usually be declared using static to limit their scope.  If the export-static flag is on, Splint will report declarations that could have file scope.  It should only be used when all relevant source files are listed on the Splint command line; otherwise, variables and functions may be incorrectly identified as only used in the file scope since Splint did not process the other file in which they are used.

13.2.2    Declarations Missing from Headers

A common practice in C programming styles, is that every function or variable exported by M .c is declared in M .h.  If the export-header flag is on, Splint will report exported declarations in M .c that are not declared in M.h.

14        Libraries and Header File Inclusion

Libraries can be used to record interface information.  A library containing information about the standard C Library is used to enable checking of library calls.  Program libraries can be created to enable fast checking of single modules in a large program.

14.1       Standard Libraries

In order to check calls to library functions, Splint uses an annotated standard library.  This contains more information about function interfaces then is available in the system header files since it uses annotations.  Further, it contains only those functions documented in the ISO C99 standard.  Many systems include extra functions in their system libraries; programs that use these functions cannot be compiled on other systems that do not provide them.  Certain types defined by the library are treated as abstract types (e.g., a program should not rely on how the FILE type is implemented).  When checking source code, Splint does include system headers corresponding to files in the library, but instead uses the library description of the standard library.

 

The Splint distribution includes several different standard libraries: the ANSI standard library, the POSIX standard library[19], and a UNIX library based on the Open Group’s Single Unix Specification.  Each library comes in two versions: the standard version and the strict version.

14.1.1    ISO Standard Library

The default behavior of Splint is to use the ISO standard library (loaded from standard.lcd).  This library is based on the standard library described in the ISO C99 standard.

14.1.2    POSIX Library

The POSIX library is selected by the +posixlib flag.   The POSIX library is based on the IEEE Std 1003.1-1990.  

14.1.3    UNIX Library

The UNIX library is selected by the +unixlib flag.  This library is based on the Open Group’s Single Unix Specification, Version 2.  In the UNIX library, free is declared with a non-null parameter.  ISO specifies that free should handle the argument NULL, but several UNIX platforms crash if NULL is passed to free.

14.1.4    Strict Libraries

Stricter versions of the libraries are used is the -ansi-strict, posix-strict-lib or unix-strict-lib flag is used. These libraries use a stricter interpretation of the library.  They will detect more errors in some programs, but may to produce many spurious errors for typical code.

 

The differences between the standard libraries and the strict libraries are:

·      The standard libraries declare the printing functions (fprintf, printf, and sprintf) that may return error codes to return int or void.  This prevents typical programs from leading to deluge of ignored return value errors, but may mean some relevant errors are not detected.  In the strict library, they are declared to return int, so ignored return value errors will be reported (depending on other flag settings).  Programs should check that this return value is non-negative.

·      The standard libraries declare some parameters and return values to be alternate types (int or bool, or int or char).  The ISO C99 standard specifies these types as int to be compatible with older versions of the library, but logically they make more sense as bool or char.  In the strict library, the stronger type is used.  The parameter to assert is int or bool in the standard library, and bool in the strict library.  The parameter to the character functions isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint, ispunct, isspace, isupper, isxdigit, tolower and toupper is char or unsigned char or int in the standard library and char in the strict library.  The type of the return value of the character classification functions (all of the previous character functions except tolower and toupper) is bool or int in the standard library and bool in the strict library.  The type of the first parameter to ungetc is char or int in the standard library and char in the strict library (EOF should not be passed to ungetc).  The second parameter to strchr and strrchr is char or int in the standard library and char in the strict library.

·      The global variables stdin, stdout and stderr are declared as unchecked variables (see Section 7.2) in the standard libraries.  In the strict libraries, they arechecked.

·      The global variable errno is declared unchecked in the standard libraries, but declared checkedstrict in the strict libraries.

 

If no library flag is used, Splint will load the standard library, standard.lcd.  If +nolib is set, no library is loaded.  The library source files can easily be modified, and new libraries created to better suit a particular application.

14.2       Generating Libraries

To enable running Splint on large systems, mechanisms are provided for creating libraries containing necessary information.  This means source files can be checked independently, after a library has been created. The command line option -dump library stores information in the file library (the default extension .lcd is added). Then, -load library loads the library.  The library contains interface information from the files checked when the library was created.

14.2.1    Generating the Standard Libraries

The standard libraries are generated from header files included in the Splint distribution.  Some libraries are generated from more than one header file.  Since the POSIX library subsumes the standard library, the headers for the standard and POSIX libraries are combined to produce the POSIX library.  Similarly, the UNIX library is composed of the standard, POSIX and UNIX headers.  The header files include some sections that are conditionally selected by defining STRICT.  The commands to generate the standard libraries are:

splint -nolib ansi.h -dump ansi

splint -nolib -DSTRICT ansi.h -dump ansistrict

splint -nolib ansi.h posix.h -dump posix

splint -nolib -DSTRICT ansi.h posix.h -dump posixstrict

splint -nolib ansi.h posix.h unix.h -dump unix

splint -nolib -DSTRICT ansi.h posix.h unix.h -dump unixstrict

14.3       Header File Inclusion

The standard behavior of Splint on encountering

#include <X.h>

is to search for a file named X .h on the include search path (set using –I) and then the system base include path (read from the include environment variable if set or using a default value, usually /usr/include).  If X .h is the name of a header file in a loaded standard library and X .h is found in a directory that is a system directory (as set by the -sysdirs flag; the default is /usr/include), X .h will not be included if +skip-iso-headers or +skip-posix-headers (depending on whether X .h is an ISO or POSIX header file) is on (both are on by default).  To force all headers to be included normally, use ‑skip-iso-headers

 

Sometimes headers in system directories contain non-standard syntax that Splint is unable to parse.  The +skip-sys-headers flag may be used to prevent any include file in a system directory from being included.

 

Splint is fast enough that it can be run on medium-size (10,000 line) programs without performance concerns.  Libraries can be used to enable efficient checking of small modules in large programs.  To further improve performance, header file inclusion can be optimized.

 

When processing a complete system in which many files include the same headers, a large fraction of processing time is wasted re-reading header files unnecessarily.  If you are checking a 100-file program, and every file includes utils.h, Splint will have to process utils.h 100 times (as would most C compilers).  If the +single-include flag is used, each header file is processed only once.  Single header file processing produces a significant efficiency improvement when checking large programs split into many files, but is only safe if the same header file included in different contexts always has the same meaning (i.e., it does not depend on preprocessor variable defined differently at different inclusion sites).

 

When processing a single file in a large system, a large fraction of the time is spent processing included header files.  This can be avoided if the information in the header files is stored in a library instead.  If +never-include is set, inclusion of files ending in .h is prevented.  Files with different suffixes are included normally.  To do this the header files must not include any expanded macros. That is, the header file must be processed with +all-macros, and there must be no /*@notfunction@*/ control comments in the header.  Then, the +never-include flag may be used to prevent inclusion of header files.  Alternately, non-function macros can be moved to a different file with a name that does not end in .h.  Remember, that this file must be included directly from the .c file, since if it is included from an .h file indirectly, that .h file is ignored so the other file is never included.

 

These options can be used for significant performance improvements on large systems.  The performance depends on how the code is structured, but checking a single module in a large program is several times faster if libraries and +noinclude are used.

14.3.1    Preprocessing Constants

Splint defines the preprocessor constant S_SPLINT_S when preprocessing source files.  If you want to include code that is processed only when Splint is used, surround the code with

 

# ifdef S_SPLINT_S

     …

# endif

Appendix A                    Availability

The web home page for Splint is http://www.splint.org.  It includes this guide in HTML format, samples demonstrating Splint, and links to related web sites.  Splint is available as source code and binary executables for several platforms.  Splint may be freely distributed and modified under the GNU General Public License.  The latest development code is available through SourceForge.

 

Splint development is largely driven by suggestions and comments from users.  We are also very interested in hearing about your experiences using Splint in developing or maintaining programs, enforcing coding standards, or teaching courses.  For general information, suggestions, and questions on Splint send mail to splint@cs.virginia.edu.

 

To report a bug in Splint send a message to splint-bug@cs.virginia.edu.

 

There are two mailing lists associated with Splint:

splint-announce@virginia.edu

Reserved for announcements of new releases and bug fixes.  All users should add themselves to this list. 

splint-interest@virginia.edu

Informal discussions on the use and development of Splint. 

 

To subscribe to a mailing list, send a message to majordomo@virginia.edu containing the body

subscribe splint-announceor subscribe splint-interest.

Appendix B                    Flags

There are four different types of flags:

·      Global flags for controlling initializations and global behavior

·      Message format flags for controlling how messages are displayed

·      Mode selectors for coarse control of Splint checking

·      Checking flags that control checking and what classes of messages are reported.

Global flags can be used in initialization files and at the command line; all other flags may also be used in control comments.

Key

To the left of each flag name is a flag descriptor encoding what kind of flag it is and its default value.  The descriptions are:

P: -

A plain flag.  The value after the colon gives the default setting (e.g., this flag is off.) 

 

m:--++

A mode checking flag.  The value of the flag is set by the mode selector.  The four signs give the setting in the weak, standard, checks and strict modes. (e.g., this flag is off in the weak and standard modes, and on in the checks and strict modes.)

 

shortcut

A shortcut flag.  This flag sets other flags, so it has no default value.

Flag Name Abbreviations

Within a flag name, abbreviations may be used.  Figure 25 shows the flag name abbreviations.  The expanded and short forms are interchangeable in flag names.

Expanded Form

Short Form

constant

const

declaration

decl

function

fcn

global

glob

implicit, implied

imp

iterator

iter

length

len

modifies

mods

modify

mod

memory

mem

parameter

param

pointer

ptr

return

ret

variable

var

unconstrained, unconst

uncon

Figure 25.  Flag Name Abbreviations

The expanded and short forms are interchangeable in flag names.

For example, globsimpmodsnothing and globalsimpliesmodifiesnothing denote the same flag.  Abbreviations in flag names allow pronounceable, descriptive names to be used without making flag names excessively long (although one must admit even globsimpmodsnothing is a bit of a mouthful.)

To make flag names more readable, the space, dash (-), and underscore (_) characters may be used inside a flag name.  Hence, globals-implies-modifies-nothing, glob_imps_­mods­nothing and globsimpmodsnothing are equivalent.

Global Flags

Global flags can be set at the command line or in an options file, but cannot be set locally using stylized comments.  These flags control on-line help, initialization files, pre-processor flags, libraries and output.

Help

On-line help provides documentation on Splint operation and flags.  When a help flag is used, no checking is done by Splint.  Help flags may be preceded by - or +.

help

Display general help overview, including list of additional help topics.

help <topic>

Display help on <topic>. Available topics:

annotations

describe annotations

comments

describe control comments

flags

describe flag categories

flags <category>

all flags pertaining to <category> (one of the categories listed by splint -help flags)

flags alpha        

all flags in alphabetical order

flags full

print a full description of all flags

mail

print information on mailing lists

modes

flags settings in modes

prefixcodes

character codes for setting namespace prefixes

references

print references to relevant papers and web sites

vars

describe environment variables

version

print maintainer and version information

 

help <flag>

Describe flag <flag>.  (May list several flags.)

warn-flags

Display a warning when a flag is set in a surprising way.  An error is reported if an obsolete flag is set, a flag is set to its current value (i.e., the + or - may be wrong), or a mode selector flag is set after mode checking flags that will be reset by the mode were set.  By default, +warn-flags is on.  To suppress flag warnings, use ‑warn-flags.

P: +

warn-rc

There was a problem reading an initialization file.

P: +

bad-flag

A flag is not recognized or used in an incorrect way.

P: +

fileextensions

Warn when command line file does not have a recognized extension.

Initialization

These flags control directories and files used by Splint.  They may be used from the command line or in an options file, but may not be used as control comments in the source code.  Except where noted. they have the same meaning preceded by - or +

tmpdir <directory>

Set directory for writing temp files.  Default is /tmp/.

I<directory>

Add directory to path searched for C include files.  Note there is no space after the I, to be consistent with C preprocessor flags.

S<directory>

Add directory to path search for .lcl specification files.

 

larchpath <path>

Set path to search for library files.  Overrides LARCH_PATH environment variable.

lclimportdir <directory>

Set directory to search for LCL import files.  OverridesLCLIMPORTDIR environment variable.

 

f <file>

Load options from <file>.  If this flag is used from the command line, the default ~/.splintrc file is not loaded.  This flag may be used in an options file to include another options file.

i <file>

Set LCL initilization file.

nof

Prevents the default options files (./.splintrcand ~/.splintrc) from being loaded.  (Setting -nof overrides +nof, causing the options files to be loaded normally.)

sys-dirs

Set directories for system files (default is /usr/).  Separate directories with the path separator for your operating system (e.g., semi-colons for Windows or colons for Unix: /usr/include:/usr/local/lib).  Flag settings propagate to files in a system directory.  If -sys-dir-errors is set, no errors are reported for files in system directories.

Pre-processor

These flags are used to define or undefine pre-processor constants.  The -I<directory> flag is also passed to the C pre-processor.

D<initializer>

Passed to the C pre-processor.

U<initializer>

Passed to the C pre-processor.

P: +

unrecogdirective

Preprocessor directive is not recognized.

P: +

preproc

Preprocessing error.

Libraries

These flags control the creation and use of libraries.

dump <file>

Save state in <file> for loading.  The default extension .lcd is added if <file> has no extension.

load <file>

Load state from <file> (created by -dump).  The default extension .lcd is added if <file> has no extension.  Only one library file may be loaded.

By default, the standard library is loaded if the -load flag is not used to load a user library.  If no user library is loaded, one of the following flags may be used to select a different standard library.  Precede the flag by + to load the described library (or to prevent a library from being loaded using no-lib). See Section 14.1 for information on the provided libraries.

no-lib

Do not load any library.  This prevents the standard library from being loaded.

ansi-lib

Use the ANSI standard library (selected by default).

strict-lib

Use strict version of the ANSI standard library.

posix-lib

Use the POSIX standard library.

posix-strict-lib

Use the strict version of the POSIX standard library.

unix-lib

Use UNIX version of standard library.

unix-strict-lib

Use the strict version of the UNIX standard library.

 

which-lib

Print out the standard library filename and creation information.

P: +

newdecl

There is a new declaration that is not declared in a loaded library or earlier file. (Use this flag to check for consistency against a library.)

P: +

impconj

Make all alternate types implicit (useful for making system libraries).

Output

These flags control what additional information Splint prints.  Setting +<flag> causes the described information to be printed; setting -<flag> prevents it.  By default, all these flags are off.

use-stderr

Send error messages to standard error (instead of standard output).

show-summary

Show a summary of all errors reported and suppressed.  Counts of suppressed errors are not necessarily correct since turning a flag off may prevent some checking from being done to save computation, and errors that are not reported may propagate differently from when they are reported.

show-scan

Show file names are they are processed.

show-all-uses

Show list of uses of all external identifiers sorted by number of uses.

stats

Display number of lines processed and checking time.

time-dist

Display distribution of where checking time is spent.

quiet

Suppress herald and error count.  (If quiet is not set, Splint prints out a herald with version information before checking begins, and a line summarizing the total number of errors reported.)

iso-lib

Use library based on the ISO standard library specification.

warn-unix-lib

Warn when the unix library is used. Unix library may not be compatible with all platforms.

which-lib

Print out the standard library filename and creation information.

limit <number>

At most <number> similar errors are reported consecutively.  Further errors are suppressed, and a message showing the number of suppressed messages is printed.

message-stream <file>

Send status messages to <file>.

message-stream-stdout

Send status messages to standard output stream.

message-stream-stderr

Send status messages to standard error stream.

warning-stream <file>

Send warnings to <file>.

warning-stream-stdout

Send warnings to standard output stream.

warning-stream-stderr

Send warnings to standard error stream.

error-stream <file>

Send fatal errors to <file>.

error-stream-stdout

Send fatal errors to standard output stream.

error-stream-stderr

Send fatal errors to standard error stream.

Expected Errors

Normally, Splint will expect to report no errors.  The exit status will be success (0) if no errors are reported, and failure if any errors are reported.  Flags can be used to set the expected number of reported errors.  Because of the provided error suppression mechanisms, these options should probably not be used for final checking real programs but may be useful in developing programs using make.

expect <number>

Exactly <number> code errors are expected.  Splint will exit with failure exit status unless <number> code errors are detected.

Message Format

These flags control how messages are printed.  They may be set at the command line, in options files, or locally in syntactic comments.  The line-len and limit flags may be preceded by + or - with the same meaning; for the other flags, + turns on the describe printing and - turns it off.  The box to the left of each flag gives its default value.

+

show-column

Show column number where error is found.

+

show-func

Show name of function (or macro) definition containing error.  The function name is printed once before the first message detected in that function.

-

show-all-conjs

Show all possible alternate types (see Section 4.4).

-

paren-file-format

Use <file>(<line> ) format in messages.  (Default is + for Win32 for compatibility with Microsoft VisualStudio.)

+

hints

Provide hints describing an error and how a message may be suppressed for the first error reported in each error class.

-

force-hints

Provide hints for all errors reported, even if the hint has already been displayed for the same error class.

80

line-len <number>

Set length of maximum message line to <number> characters.  Splint will split messages longer than <number> characters long into multiple lines.

3

indentspaces <number>

Set the number of spaces to indent sub-messages.

3

locindentspaces <number>

Set number of spaces to indent sub-messages that start with file locations.

-

showdeephistory

Show all available information about storage mentioned in warnings.

-

showloadloc

Show location information for load files.

-

csv

Produce comma-separated values (CSV) warnings output file.

-

csvoverwrite

Overwrite exisiting CVS output file Show location information for load files.

-

htmlfileformat

Show file locations as links.

+

streamoverwrite

Warn and exit if a stream output file would overwrite an existing file.

Mode Selector Flags

Mode selects flags set the mode checking flags to predefined values.  They provide a quick coarse-grain way of controlling what classes of errors are reported. Specific checking flags may be set after a mode flag to override the mode settings.  Mode flags may be used locally, however the mode settings will override specific command line flag settings.  A warning is produced if a mode flag is used after a mode checking flag has been set.

 

These are brief descriptions to give a general idea of what each mode does.  To see the complete flag settings in each mode, use splint -help modes. A mode flag has the same effect when used with either + or -.

weak

Weak checking, intended for typical unannotated C code.  No modifies checking, macro checking, rep exposure, or clean interface checking is done.  Return values of type int may be ignored.  The types bool, int, char and user-defined enum types are all equivalent.  Old style declarations are unreported.

standard

The default mode.  All checking done by weak, plus modifies checking, global, alias checking, use all parameters, using released storage, ignored return values or any type, macro checking, unreachable code, infinite loops, and fall through cases.  The types bool, int and char are distinct.  Old style declarations are reported.

 checks

Moderately strict checking.  All checking done by standard, plus must modification checking, rep exposure, return alias, memory management and complete interfaces.

strict

Absurdly strict checking.  All checking done by checks, plus modifications and global variables used in unspecified functions, strict standard library, and strict typing of C operators. A special reward will be presented to the first person to produce a real program that produces no errors with strict checking.

Checking Flags

These flags control checking done by Splint.  They may be set locally using syntactic comments, from the command line, or in an options file.  Some flags directly control whether a certain class of message is reported.  Preceding the flag by + turns reporting on, and preceding the flag by - turns reporting off.  Other flags control checking less directly by determining default values (what annotations are implicit), making types equivalent (to prevent certain type errors), controlling representation access, etc.  For these flags, the effect of + is described, and the effect of - is the opposite (or explicitly explained if there is no clear opposite).  The organization of this section mirrors Sections 2-14.

Null Dereferences (Section 2)

shortcut

null

A possibly null pointer may be dereferenced, or used somewhere a non-null pointer is expected. (sets nulldref, nullpass, nullassign, and nullstate

m:-+++

nullderef

A possibly null pointer is dereferenced. Value is either the result of a function which may return null (in which case, code should check it is not null), or a global, parameter or structure field declared with the null qualifier.

m:-+++

nullpass

A possibly null pointer is passed as a parameter corresponding to a formal parameter with no /*@null@*/ annotation. If NULL may be used for this parameter, add a /*@null@*/ annotation to the function parameter declaration.

m:-+++

nullret

Function returns a possibly null pointer, but is not declared using /*@null@*/ annotation of result. If function may return NULL, add /*@null@*/ annotation to the return value declaration.

m:-+++

nullstate

A possibly null pointer is reachable from a parameter or global variable that is not declared using a /*@null@*/ annotation.

m:-+++

nullassign

A reference with no null annotation is assigned or initialized to NULL. Use /*@null@*/ to declare the reference as a possibly null pointer.

Use Before Definition (Section 3)

m:-+++

usedef

The value of a location that may not be initialized on some execution path is used.

m:----

impouts

Allow unannotated pointer parameters to functions to be implicit out parameters.

m:-+++

compdef

Storage derivable from a parameter, return value or global variable is not completely defined.

m:-+++

uniondef

No field of a union is defined.  (No error is reported if at least one union field is defined.)

m:-+++

mustdefine

Parameter declared with out is not defined before return or scope exit.

P:+

fullinitblock

Initializer does not set every field in the structure.

P:+

initallelments

Initializer does not define all elements of a declared array.

P:+

initsize

Initializer block contains more elements than the size of a declared array.

m:---

impouts

Pointer parameters to unspecified functions may be implicit out parameters.

Declarations )

m:-+++

incondefs

A function, variable or constant is redefined with a different type.

m:-+++

functionderef

A function type is dereferenced. The ANSI standard allows this because of implicit conversion of function designators, however the dereference is unnecessary.

m:--++

redundantsharequal

A declaration of an immutable object uses a redundant observer qualifier.

m:-+++

misplacedsharequal

A declaration of an unsharable object uses a sharing annotation.

Types (Section 4 )

 

P: +

type

Type mismatch.

P: +

string-literal-too-long

A string literal is assigned to a char array too small to hold it.

m: -+++

string-literal-no-room

A string literal is assigned to a char array that is not big enough to hold the null terminator.

m: ++++

string-literal-no-room-final-null

A string literal is assigned to a char array that is not big enough to hold the final null terminator. This may not be a problem because a null character has been explictedly included in the string literal using an escape sequence.

m: --++

string-literal-smaller

A string literal is assigned to a char array that smaller than the string literal needs.

m: --++

enum-members

Type of initial values for enum members must be int.

Boolean Types (Section 4.2 )

These flags control the type name used to represent Booleans, and whether the Boolean type is abstract.

 

P: -

bool

Boolean type is an abstract type.

P: bool

booltype <name>

Set name of Boolean type to <name>.

P:FALSE

boolfalse <name>

Set name of Boolean false to <name>.

P: TRUE

booltrue <name>

Set name of Boolean true to <name>.

P: +

likelybool

Splint has found a type which appears to be the boolean type. Use the -booltype, -boolfalse and -booltrue flags to change the name of the default boolean type.

Predicates

m:--++

pred-bool-ptr

Type of condition test is a pointer.

m:-+++

pred-bool-int

Type of condition test is an integral type.

m:++++

pred-bool-others

Type of condition test is not a Boolean, pointer or integral type.

shortcut

pred-bool

Sets predboolint, predboolptr and preboolothers.

P: +

pred-assign

The condition test is an assignment expression. If an assignment is intended, add an extra parentheses nesting (e.g., if ((a = b)) ...).

Primitive Operations

m:---+

ptr-arith

Arithmetic involving pointer and integer.

m: --++

nullptrarith

Pointer arithmetic using a possibly null pointer and integer.

m: ++--

boolops

The operand of a boolean operator is not a boolean. Use +ptrnegate to allow ! to be used on pointers.

m:++--

ptr-negate

Allow the operand of the ! operator to be a pointer.

m:---+

bitwise-signed 

An operand to a bitwise operator is not an unsigned value. This may have unexpected results depending on the signed representations.

m: ---+

shiftimplementation

The left operand to a shift operator may be negative (behavior is implementation-defined).

m: -+++

shiftnegative

The right operand to a shift operator may be negative (behavior undefined).

m:-+++

shift-signed

The left operand to a shift operator is not an unsigned value.

m:---+

strict-ops

Primitive operation does not type check strictly.

m:---+

sizeof-type

Operand of sizeof operator is a type.  (Safer to use int *x = sizeof (*x); instead of sizeof (int).)

Array Formal Parameters

These flags control reporting of common errors caused by confusion about the semantics of array formal parameters.

 

P: +

sizeof-formal-array

The sizeof operator is used on a parameter declared as an array.  (In many instances this has unexpected behavior, since the result is the size of a pointer to the element type, not the number of elements in the array.)

 

P: +

fixed-formal-array

An array formal parameter is declared with a fixed size (e.g., int x[20]).  This is likely to be confusing, since the size is ignored.

P: -

formal-array

A formal parameter is declared as an array.  This is probably not a problem, but can be confusing since it is treated as a pointer. 

Format Codes

P: +

format-code

Invalid format code in format string for printflike or scanflike function.

P: +

format-type

Type-mismatch in parameter corresponding to format code in a printflike or scanflike function.

P: +

format-const

Format parameter is not known at compile-time. This can lead to security vulnerabilities because the arguments cannot be type checked.

Main

P: +

main-type

Type of main does not match expected type (function returning an int, taking no parameters or two parameters of type int and char **.)

Comparisons

m:-+++

bool-compare

Comparison between Boolean values.  This is dangerous since there may be multiple true values as any non-zero value is interpreted as true.

m:-+++

real-compare

Comparison involving float or double values.  This is dangerous since it may produce unexpected results because floating point representations are inexact.

m:-+++

ptr-compare

Comparison between pointer and number.

m:-+++

unsigned-compare

An unsigned value is used in a comparison with zero in a way that is either a bug or confusing.

Type Equivalence

m: +---

void-abstract

Allow void * to match pointers to abstract types.  (Casting a pointer to an abstract type to a pointer to void is okay if +void-abstract is set.)

P: +

cast-fcn-ptr

 A pointer to a function is cast to (or used as) a pointer to void (or vice versa).

m:+---

forward-decl

Forward declarations of pointers to abstract representation match abstract type.

m:-+++

imp-type

A variable declaration has no explicit type.  The type is implicitly int.

P: +

incomplete-type

A formal parameter is declared with an incomplete type (e.g., int[][]).

m:+---

char-index

Allow char to index arrays.

m:----

enum-index

Allow members of enumtype to index arrays.

m:+---

bool-int

Make bool and int are equivalent.  (No type errors are reported when a Boolean is used where an integral type is expected and vice versa.)

m:+---

char-int

Make char and int types equivalent

m:+---

charunsignedchar

To allow char and unsigned char types to match use +charunsignedchar

m:++--

enum-int

Make enum and int types equivalent

m:+---

float-double

Make float and double types equivalent

m:----

ignore-quals

Ignore type qualifiers (long, short, unsigned).

m:++--

relax-quals

Report qualifier mismatches only if dangerous (information may be lost since a larger type is assigned to (or passed as) a smaller one or a comparison uses signed and unsigned values.)

m:----

ignore-signs

Ignore signs in type comparisons (unsigned matches signed).

 

P: -

long-integral

Allow long type to match an arbitrary integral type (e.g., dev_t).

m:+---

long-unsigned-integral

Allow unsigned long type to match an arbitrary integral type (e.g., dev_t).

P: -

match-any-integral

Allow any integral type to match an arbitrary

P: -

long-unsigned-unsigned-integral

Allow unsigned long type to match an arbitrary unsigned integral type (e.g., size_t).

m:+---

long-signed-integral

Allow long type to match an arbitrary signed integral type (e.g., ssize_t).

 

P: +

num-literal

Integer literals can be used as floats.

P: -

char-int-literal

A character constant may be used as an int.

P: +

zero-ptr

Literal 0 may be used as a pointer.

P: +

zero-bool

Treat 0 as a boolean.

P: -

relax-types

Allow all numeric types to match.

m: +---

shortint

Make short int and int types equivalent.

Abstract Types (Section 4.3 )

P: +

abstract

A data abstraction barrier is violated

P: -

imp-abstract

Implicit abstract annotation for type declarations that do not use concrete.

m:-+++

mut-rep

Representation of mutable type has sharing semantics.

Access (Section 4.3.1)

P: +

access-module

An abstract type defined in M.h (or specified in M.lcl) is accessible in M.c.

P: +

access-file

An abstract type named type is accessible in files named type.*

P: +

access-czech

An abstract type named type may be accessible in a function named type_name. (Section 12.1.1)

P: -

access-slovak

An abstract type named type may be accessible in a function named typeName.  (Section.12.1.2)

P: -

access-czechoslovak

An abstract type named type may be accessible in a function named type_name or typeName.  (Section 12.1.3)

shortcut

access-all

Sets access-module, access-file and access-czech.

Memory Management (Section 5 )

Reporting of memory management errors is controlled by flags setting checking and implicit annotations and code annotations. 

Deallocation Errors (Section 5.2)

m:-+++

use-released

Storage used after it may have been released.

m:---+

strict-use-released

An array element used after it may have been released.

Inconsistent Branches

m:-+++

branch-state

Storage has inconsistent states of alternate paths through a branch (e.g., it is released in the true branch of an if-statement, but there is no else branch.)

m:---+

strict-branch-state

Storage through array fetch has inconsistent states of alternate paths through a branch.  Since array elements are not checked accurately, this may lead to spurious errors.

m:--++

dep-arrays

Treat array elements as dependent storage.  Checking of array elements cannot be done accurately by Splint.  If dep-arrays is not set, array elements are assumed to be independent, so code that releases the same element more than once will produce no error.  If dep-arrays is set, array elements are assumed to be dependent, so code that releases the same element more that once will produce an error, but code that releases different elements correctly will produce a spurious error.

Memory Leaks

m:-+++

must-free

Allocated storage was not released before return or scope exit.  Errors are reported for only, fresh or owned storage.

m:-+++

mustfreefresh

Allocated storage was not released before return or scope exit. Errors are reported for fresh storage

m:-+++

mustfreeonly

Allocated storage was not released before return or scope exit. Errors are reported for only storage

shortcut

memchecks

Sets all dynamic memory checking flags (memimplicit, mustfree, mustdefine, mustnotalias, null, memtrans ).

m:-+++

comp-destroy

All only references derivable from out only parameter of type void * must be released.  (This is the type of the parameter to free, but may also be used for user-defined deallocation functions.)

m:---+

strict-destroy

Report complete destruction errors for array elements that may have been released.  (If strict-destroy is not set, Splint will assume that if any array element was released, the entire array was correctly released.)

Transfer Errors

A transfer error is reported when storage is transferred (by an assignment, passing a parameter, or returning) in a way that is inconsistent.

shortcut

mem-trans

Sets all memory transfer errors flags.

m:-+++

only-trans

Only storage transferred to non-only reference (memory leak).

m:-+++

ownedtrans

Owned storage transferred to non-owned reference (memory leak).

m:-+++

fresh-trans

Newly-allocated storage transferred to non-only reference (memory leak).

m:-+++

shared-trans

Shared storage transferred to non-shared reference

m:-+++

dependent-trans

Inconsistent dependent transfer. Dependent storage is transferred to a non-dependent reference.

m:-+++

temp-trans

Temporary storage (associated with a temp formal parameter) is transferred to a non-temporary reference.  The storage may be released or new aliases created.

m:-+++

kept-trans

Kept storage (storage what was passed as keep) transferred to non-temporary reference.

m:-+++

keep-trans

Keep storage is transferred in a way that may add a new alias to it, or release it.

m:-+++

refcount-trans

Reference counted storage is transferred in an inconsistent way.

m:-+++

newref-trans

A new reference transferred to a reference counted reference (reference count is not set correctly).

m:-+++

immediate-trans

An immediate address (result of &) is transferred inconsistently.

m:-+++

static-trans

Static storage is transferred in an inconsistent way.

m:-+++

expose-trans

Inconsistent exposure transfer. Exposed storage is transferred to a non-exposed, non-observer reference.

m:-+++

observer-trans

Inconsistent observer transfer. Observer storage is transferred to a non-observer reference.

m:-+++

unqualified-trans

Unqualified storage is transferred in an inconsistent way.

Initializers

m:--++

only-unq-global-trans

Only storage transferred to an unqualified global or static reference. This may lead to a memory leak, since the new reference is not necessarily released.

m:--++

static-init-trans

Static storage is used as an initial value in an inconsistent way.

m:--++

unqualified-init-trans

Unqualified storage is used as an initial value in an inconsistent way.

Derived Storage

m:-+++

comp-mem-pass

Storage derivable from a parameter does not match the alias kind expected for the formal parameter.

Stack References

m:++++

stack-ref

A stack reference is pointed to by an external reference when the function returns.  Since the call frame will be destroyed when the function returns the return value will point to dead storage. (Section 5.2.6)

Implicit Memory Annotations (Section 5.3 )

shortcut

all-imp-only

Sets glob-imp-only, ret-imp-only, struct-imp-only, specglobimponly, specretimponly and specstructimponly .

P: +

glob-imp-only

Assume unannotated global storage is only.

P: +

param-imp-temp

Assume unannotated parameter is temp.

P: +

ret-imp-only

Assume unannotated returned storage is only.

P: +

struct-imp-only

Assume unannotated structure or union field is only.

shortcut

code-imp-only

Sets glob-imp-only, ret-imp-only and struct-imp-only.

m:-+++

mem-imp

Report memory errors for unqualified storage.

m:----

pass-unknown

Passing a value as an unannotated parameter clears its annotation.  This will prevent many spurious errors from being report for unannotated programs, but eliminates the possibility of detecting many errors.

Sharing (Section 6)

Aliasing (Section 6.1 )

m:-+++

alias-unique

An actual parameter that is passed as a unique formal parameter is aliased by another parameter or global variable.

m:-+++

may-alias-unique

An actual parameter that is passed as a unique formal parameter may be aliased by another parameter or global variable.

m:-+++

must-not-alias

An alias has been added to a temp-qualifier parameter or global that is visible externally when the function returns. 

m:--++

ret-alias

A function returns an alias to parameter or global.

Exposure (Section 6.2 )

shortcut

rep-expose

The internal representation of an abstract type is visible to the caller.  This means clients may have access to a pointer into the abstract representation.  (Sets assign-expose, ret-expose, and cast-expose.)

m:--++

assign-expose

Abstract representation is exposed by an assignment or passed parameter.

m:--++

cast-expose

Abstract representation is exposed through a cast.

m:--++

ret-expose

Abstract representation is exposed by a return value.

Observer Modifications

P: +

mod-observer

Possible modification of observer storage.

m:---+

mod-observer-uncon

Storage declared with observer may be modified through a call to an unconstrained function.

String Literals (Section 6.2.1)

m:--++

read-only-trans

Report memory transfer errors for initializations to read-only string literals

m:-+++

read-only-strings

String literals are read-only (ISO semantics).  An error is reported if a string literal may be modified or released.

Function Interfaces (Section 7 )

Modification (Section 7.1)

P: +

modifies

Undocumented modification of caller-visible state.  Without +moduncon, modification errors are only reported in the definitions of functions declared with a modifies clause (or specified).

m:--++

must-mod

Documented modification is not detected.  An object listed in the modifies clause for a function, is not modified by the implementation.

shortcut

mod-uncon

Report modification errors in functions declared without a modifies clause.(Sets mod-nomods, mod-globs-nomods and mod-strict-globs-nomods.)

m:---+

mod-nomods

Report modification errors (not involving global variables) in functions declared without a modifies clause.

m:---+

mod-uncon-nomods

An unconstrained function is called in a function body where modifications are checked.  Since the unconstrained function may modify anything, there may be undetected modifications in the checked function.

m:---+

mod-internal-strict

A function that modifies internalState is called from a function that does not list internalState in its modifies clause.

m:---+

mod-file-sys

A function modifies the file system but does not list fileSystem in its modifies clause.

Global Variables (Section 7.2 )

Errors involving the use and modification of global and file static variables are reported depending on flag settings, annotations where the global variable is declared, and whether or not the function where the global is used was declared with a globals clause.

P: +

globs

Undocumented use of a checked global variable in a function with a globals list.

m:++++

glob-use

A global listed in the globals list is not used in the implementation.

m:---+

glob-noglobs

Use of a checked global in a function with no globals list.

m:---+

internal-globs

Undocumented use of internal state (should have globals internalState).

m:---+

internal-globs-noglobs

        Use of internal state in function with no globals list.

m:-+++

glob-state

A function returns with global in inconsistent state (null or undefined)

m:--++

all-globs

Report use and modification errors for globals not annotated with unchecked.

m:++++

check-strict-globs

Report use and modification errors for checkedstrict globals.

Modification of Global Variables

m:-+++

mod-globs

Undocumented modification of a checked global variable.

m:---+

mod-globs-unchecked

Undocumented modification of an unchecked global variable.

m:---+

mod-globs-nomods

Undocumented modification of a checked global variable in a function with no modifies clause.

m:---+

mod-strict-globs-nomods

Undocumented modification of a checkedstrict global variable in a function declared with no modifies clause.

Globals Lists and Modifies Clauses

m:---+

warn-missing-globs

Global variable used in modifies clause is not listed in globals list.  (The global is added to the globals list.)

m:---+

warn-missing-globs-noglobs

Global variable used in modifies clause of a function with no globals list.

m:--++

globs-imp-mods-nothing

A function declared with a globals list but no modifies clause is assumed to modify nothing.

m:----

mods-imp-noglobs

A function declared with a modifies clause but no globals list is assumed to use no globals.

Implicit Checking Annotations

m:----

imp-checked-globs

Implicit checked annotation on global variables with no checking annotation.

m:----

imp-checked-statics

Implicit checked qualifier file static scope variables with no checking annotation.

m:----

imp-checkmod-globs

Implicit checkmod qualifier on global variables with no checking annotation.

 

m:----

imp-checkmod-statics

Implicit checkmod qualifier file static scope variables with no checking annotation.

m:---+

imp-checkedstrict-globs

Implicit checked qualifier on global variables with no checking annotation.

m:---+

imp-checkedstrict-statics

Implicit checked qualifier file static scope variables with no checking annotation.

m:--++

imp-checkmod-internals

Implicit checkmod qualifier on function scope static variables with no checking annotation.

m:-+++

 

Global Aliasing

shortcut

glob-alias

Function returns with global aliasing external state (sets checkstrict-glob-alias, checked-glob-alias, checkmod-glob-alias and unchecked-glob-alias).

m:-+++

checkstrict-glob-alias

Function returns with a checkedstrict global aliasing external state.

m:-+++

checked-glob-alias

Function returns with a checked global aliasing external state.

m:-+++

checkmod-glob-alias

Function returns with a checkmod global aliasing external state.

m:--++

unchecked-glob-alias

Function returns with an unchecked global aliasing external state.

Declaration Consistency (Section 7.3)

m:-+++

incon-defs

Identifier redeclared or redefined with inconsistent type.

m:-+++

incon-defs-lib

Identifier defined in a library is redefined with inconsistent type.

m:----

overload

Standard library function overloaded.

m:-+++

match-fields

A struct or enum type is redefined with inconsistent fields or members.

Macros (Section 11 )

These flags control expansion and checking of macro definitions and invocations.

Macro Expansion

These flags control which macros are checked as functions or constants, and which are expanded in the pre-processing phase.  Macros preceded by /*@notfunction@*/ are never expanded regardless of these flag settings.  These flags may be used in source-file control comments.

P: -

fcn-macros

Macros defined with parameter lists are not expanded and are checked as functions.

P: -

const-macros

Macros defined without parameter lists are not expanded and are checked as constants.

shortcut

all-macros

Sets fcn-macros and const-macros.

P: -

lib-macros

Macros defining identifiers declared in a loaded library are not expanded and are checked according to the library information. 

Macro Definitions

These flags control what errors are reported in macro definitions.

m:-+++

macro-stmt

Macro definition is not syntactically equivalent to function.  This means if the macro is used as a statement (e.g., if (test) macro();) unexpected behavior may result.  One fix is to surround the macro body with do { … } while (FALSE).

m:-+++

macro-return

The body of a macro declared as a function uses a return statement. This exhibits behavior that could not be implemented by a function.

m:-+++

macro-assign

A macro parameter is used as the left side of an assignment expression.

m:-+++

macro-parens

A macro parameter is used without parentheses (in potentially dangerous context).

m:---+

macro-empty

Macro definition of a function is empty.  

m:-+++

macro-redef

Macro is redefined.  There is another macro defined with the same name.

m:-+++

macro-unrecog 

An unrecognized identifier appears in a macro definition.  Since the identifier may be defined where the macro is used, this could be okay, but Splint will not be able to check the unrecognized identifier appropriately.

Corresponding Declarations

m:++++

macro-match-name

An iter or constant macro is defined using a different name from the one used in the previous syntactic comment

shortcut

macro-decl

A macro definition has no corresponding declaration.  (Sets macrofcndecl and macroconstdecl.)

m:-+++

macro-fcn-decl

Macro definition with parameter list has no corresponding function prototype. Without a prototype, the types of the macro result and parameters are unknown.

m:-+++

macro-const-decl

A macro definition without parameter list has no corresponding constant declaration.   

P: +

next-line-macros

A constant or iter declaration is not immediately followed by a macro definition.

Side Effect Free Parameters (Section 11.2.1 )

These flags control error reporting for parameters with inconsistent side effects in invocations of checked function macros and function calls.

m:-+++

sef-params

An actual parameter with side effects is passed as a formal parameter declared with sef.

m:--++

sef-uncon

An actual parameter involving a call to an unconstrained function (declared without modifies clause) that may modify anything is passed as a sef parameter.

Iterators

P: +

iterbalance

Iter is not balanced with end <iter>.

P: +

iteryield

Iter yield parameter is inappropriate.

P: -

has-yield

An iterator has been declared with no parameters annotated with yield.

Naming Conventions (Section 12)

P: +

name-checks

Turns all name checking on or off without changing other settings.

Type-Based Naming Conventions (Section 12.1)

Czech Naming Convention

shortcut

czech

Selects complete Czech naming convention (sets access-czech, czech-fcns, czech-vars, czech-consts, czech-macros, and czech-types).

P: +

access-czech

Allow access to abstract types following Czech naming convention.  The representation of an abstract type named t is accessible in the definition of a function or constant named t_name.

P: -

czech-fcns

Function or iterator name is not consistent with Czech naming convention.

P: -

czech-vars

 Variable name is not consistent with Czech naming convention.

P: -

czech-macros

 Expanded macro name is not consistent with Czech naming convention.

P: -

czech-consts

Constant name is not consistent with Czech naming convention.

P: -

czech-types

Type name is not consistent with Czech naming convention.  Czech type names must not use the underscore character.

Slovak Naming Convention

shortcut

slovak

Selects complete Slovak naming convention (sets access-slovak, slovak-fcns, slovak-vars, slovak-consts, slovak-macros, and slovak-types).

P: -

access-slovak

Allow access to abstract types following Slovak naming convention. The representation of an abstract type named t is accessible in the definition of a function or constant named tName.

P: -

slovak-fcns

Function or iterator name is not consistent with Slovak naming convention.

P: -

slovak-macros

Expanded macro name is not consistent with Slovak naming convention.

P: -

slovak-vars

 Variable name is not consistent with Slovak naming convention.

P: -

slovak-consts

 Constant name is not consistent with Slovak naming convention.

P: -

slovak-types

Type name is not consistent with Slovak naming convention.  Slovak type names may not include uppercase letters.

Czechoslovak Naming Convention

shortcut

czechoslovak

Selects complete Czechoslovak naming convention (sets access-czechoslovak, czechoslovak-fcns, czechoslovak-vars, czechoslovak-consts, czechoslovak-macros, and czechoslovak-types).

P: -

access-czechoslovak

Allow access to abstract types by Czechoslovak naming convention. The representation of an abstract type named t is accessible in the definition of a function or constant named t_name or tName.

P: -

czechoslovak-fcns

 Function name is not consistent with Czechoslovak naming convention.

P: -

czechoslovak-macros

Expanded macro name is not consistent with Czechoslovak naming convention.

P: -

czechoslovak-vars

Variable name is not consistent with Czechoslovak naming convention.

P: -

czechoslovak-consts

Constant name is not consistent with Czechoslovak naming convention.

P: -

czechoslovak-types

Type name is not consistent with Czechoslovak naming convention. Czechoslovak type names may not include uppercase letters or the underscore character.

Namespace Prefixes (Section 12.2)

macro-var-prefix <prefix string>

Set namespace prefix for variables declared in a macro body.  (Default is m_.)

P: +

macro-var-prefix-exclude

A variable declared outside a macro body starts with the macro-var-prefix.

tag-prefix <prefix string>

Set namespace prefix of struct, union or enum tag identifiers.

P: -

tag-prefix-exclude

An identifier that is not a tag starts with the tagprefix.

enum-prefix <prefix string>

Set namespace prefix for enum members.

P: -

enum-prefix-exclude

An identifier that is not an enum member starts with the enumprefix.

file-static-prefix  <prefix string>

Set namespace prefix for file static declarations.

P: -

file-static-prefix-exclude

An identifier that is not file static starts with the filestaticprefix.

global-prefix <prefix string>

Set namespace prefix for global variables.

P: -

global-prefix-exclude

An identifier that is not a global variable starts with the globalprefix.

type-prefix <prefix string>

Set namespace prefix for user-defined types.

P: -

type-prefix-exclude

An identifier that is not a type name starts with the typeprefix.

external-prefix <prefix string>

Set namespace prefix for external identifiers.

P: -

external-prefix-exclude

An identifier that is not external starts with the externalprefix.

local-prefix <prefix string>

Set namespace prefix for local variables.

P: -

local-prefix-exclude

 An identifier that is not a local variable starts with the localprefix.

unchecked-macro-prefix  <prefix string>

Set namespace prefix for unchecked macros.

P: -

unchecked-macro-prefix-exclude

An identifier that is not the name of an unchecked macro starts with the uncheckedmacroprefix.

const-prefix <prefix string>

Set namespace prefix for constants.

P: -

const-prefix-exclude

An identifier that is not a constant starts with the constantprefix.

iter-prefix <prefix string>

Set namespace prefix for iterators.

P: -

iter-prefix-exclude

An identifier that is not an iter starts with the iterprefix.

proto-param-prefix  <prefix string>

Set namespace prefix for parameters in function prototypes.

P: -

proto-param-prefix-exclude

An identifier that is not a parameter in a function prototype starts with the protoprarmprefix.

m:--++

proto-param-name

A parameter in a function prototype has a name (can interfere with macro definitions).

m:---+

proto-param-match

The name of a parameter in a function definition does not match the corresponding name of the parameter in a function prototype (after removing the protoparamprefix).

Naming Restrictions (Section 12.3)

m:-+++

shadow

Declaration reuses name visible in outer scope.

Reserved Names

m:--++

ansi-reserved

External name conflicts with name reserved for the compiler or standard library.

m:---+

ansi-reserved-internal

 Internal name conflicts with name reserved for the compiler or standard library.

m:--++

iso-reserved

External name is reserved for system use by ISO C99 standard.

m:---+

iso-reserved-internal

Internal name is reserved for system in ISO C99 standard (this should not be necessary unless you are worried about C library implementations that violate the standard and use macros).

m:--++

cpp-names

Internal or external name conflicts with a C++ reserved word.  (Will cause problems if program is compiled with a C++ compiler.)

Distinct External Names

P: -

distinct-external-names

An external name is not distinguishable from another external name using externalnamelen significant characters.

P: 6

external-name-len  <number>

Sets the number of significant characters in an external name (ANSI default minimum is 6).  Sets +distinct-external-names.

P: -

external-name-case-insensitive

Make alphabetic case insignificant in external names.  According to ANSI standard, case need not be significant in an external name.  If +distinct-external-names is not set, sets +distinct-external-names with unlimited external name length.

Distinct Internal Names

m:----

distinct-internal-names

An internal name is not distinguishable from another internal name using internalnamelen significant characters.   (Also effected by internal-name-case-insensitive and internal-name-lookalike.)

P: 31

internal-name-len  <number>

Set the number of significant characters in an internal name. Sets +distinct-internal-names.

P: -

internal-name-case-insensitive

Set whether case is significant an internal names (-internal-name-case-insensitive means case is significant).  If +distinct-internal-names is not set, sets +distinct-internal-names with unlimited internal name length.

P: -

internal-name-lookalike

 Set whether similar looking characters (e.g., “1” and “l”) match in internal names.

Control Flow (Section 8)

Undefined Evaluation Order (Section 8.2 )

m:-+++

eval-order

Behavior of an expression is unspecified or implementation-dependent because sub-expressions contain interfering side effects that may be evaluated in any order.

m:---+

eval-order-uncon

An expression may be undefined because a sub-expression contains a call to an unconstrained function (no modifies clause) that may modify something that may be modified or used by another sub-expression.

Problematic Control Structures (Section 8.3 )

m:-+++

inf-loops

Likely infinite loop is detected (Section 8.3.1).

m:--++

inf-loops-uncon

Likely infinite loop is detected.  Loop test or body calls an unconstrained function that may produce an undetected modification.

m:---+

elseif-complete

There is no finals else following an else if construct (Section 8.3.5).

m:-+++

case-break

There is a non-empty case in a switch not followed by a break(Section 8.3.2 ).

m:-+++

first-case

The first statement after a switch is not a case.

m:-+++

Duplicate-case

Duplicate cases in switch.

m:-+++

miss-case

A switch on an enum type is missing a case for a member of the enumerator.

P+

emptyreturn

Empty return in function declared to return value.

P+

alwaysexits

Loop predicate always exits.

shortcut

loop-exec

Assume all loops execute at least once.  This effects use-before-definition and memory checking.  It should probably not be used globally, but may be used surrounding a particular loop that is known to always execute to prevent spurious messages. (sets for-loop-exec, while-loop-exec and iter-loop-exec

P-

for-loop-exec

Assume all for loops execute at least once. This effects use-before-definition and memory checking. It should probably not be used globally, but may be used surrounding a particular loop that is known to always execute to prevent spurious messages.

P-

while-loop-exec

Assume all while loops execute at least once. This effects use-before-definition and memory checking. It should probably not be used globally, but may be used surrounding a particular loop that is known to always execute to prevent spurious messages.

P-

iter-loop-exec

Assume all iter loops execute at least once. This effects use-before-definition and memory checking. It should probably not be used globally, but may be used surrounding a particular loop that is known to always execute to prevent spurious messages.

P+

obvious-loop-exec

Assume loop that can be determined to always execute always does.

Deep Break (Section 8.3.3 )

shortcut

deep-break

Report errors for break statements inside a nested while, for or switch.  (Sets all nested break and continue flags.)

m:--++

loop-loop-break

There is a break inside a while, for or iterator loop that is inside a while, for or iterator loop. Mark with /*@innerbreak@*/ to suppress the message.

m:--++

switch-loop-break

There is abreak inside a while, for or iterator loop that is inside a switch statement.  Mark with /*@loopbreak@*/.

m:---+

loop-switch-break

There is abreak inside a switch statement that is inside a while, for or iterator loop.  Mark with /*@switchbreak@*/.

m:---+

switch-switch-break

There is abreak inside a switch statement that is inside another switch statement.  Mark with /*@innerbreak@*/.

m:---+

loop-loop-continue

There is a continue inside a while, for or iterator loop that is inside a while, for or iterator loop.  Mark with /*@innercontinue@*/.

Loop and if Bodies (Section 8.3.4)

shortcut

all-empty

An if, while or for statement has no body (sets if-empty, while-empty and for-empty.)

shortcut

all-block

The body of an if, while or for statement is not a block (sets if-block, while-block and for-block.)

m:--++

while-empty

A while statement has no body.

m:---+

while-block

 The body of a while statement is not a block

m:---+

for-empty

A for statement has no body.

m:---+

for-block

The body of a for statement is not a block.

m:++++

if-empty

An if statement has no body.

m:---+

ifblock

The body of an if statement is not a block.

Suspicious Statements (Section 8.4)

m:-+++

unreachable

Code is not reached on any possible execution.

m:-+++

noeffect

Statement has no effect.

m:---+

noeffect-uncon

Statement involving call to unconstrained function may have no effect.

m:-+++

noret

There is a path with no return in a function declared to return a non-void value.

Ignored Return Values (Section 8.4.2 )

These flags control when errors are reported for function calls that do not use the return value.  Casting the function call to void or declaring the called function to return /*@alt void@*/.

m:-+++

ret-val-bool

Return value of type bool ignored.

m:-+++

ret-val-int

Return value of type int ignored.

m:++++

ret-val-other

Return value of type other than bool or int ignored.

shortcut

ret-val

Return value ignored (Sets retvalbool, retvalint, retvalother.)

Memory Bounds (Section 9)

shortcut

bounds

Memory read or write may be out of bounds of allocated storage (sets boundsread and boundswrite

m:----

boundsread

A memory read references memory beyond the allocated storage (also sets likelyboundsread.

m:----

boundswrite

A memory write may write to an address beyond the allocated buffer (also sets likelyboundswrite.

shortcut

likelybounds

Likely memory read or write is likely to be out of bounds of allocated storage (sets likelyboundsread and likelyboundswrite)

m:----

likelyboundsread

A likely memory read references memory beyond the allocated storage (also sets likelyboundsread.

m:----

likelyboundswrite

A memory write is likely to write to an address beyond the allocated buffer.

m:----

fcnpost

Display function post conditions.

m:----

redundantconstraints

Display seemingly redundant conditions.

m:----

checkpost

The functions implementation may not satidfy a post condition given in an ensures clause.

P-

showconstraintparens

Display parentheses around constraint terms.

P+

showconstraintlocation

Display location for every constraint generated.


The following flags are mainly of interest to Splint developers. The default values are adequate in normal use. They are included for completeness.

P-

debugfcnconstraint

Perform buffer overflow checking even if the errors would be inhibited.

P-

implictconstraints

Generate implicit constraints for functions.  This is an experimental option.  Currently this option reduces the number of bounds errors but causes real error to be missed.

P-

orconstraint

This flags affects the internal constraint resolution.  If set, the internal constraint resolution is more accurate.  The performance impact is minimal so there is little reason not to have this flag set.

Extensible Checking (Section 13 )

P-

mts <filename>

Load meta state declaration and corresponding xh file.

m:++++

statetransfer

Transfer violates user-defined state rules.

m:++++

statemerge

Control path merge violates user-defined state merge rules.

Completeness (Section 13 )

Unused Declarations (Section 13.1 )

These flags control when errors are reported for declarations that are never used.  The unused annotation can be used to prevent unused errors from being report for a particular declaration.

m:---+

top-use

An external declaration is not used in any file.

m:-+++

const-use

Constant never used.

m:-+++

enum-mem-use

Member of enumerator never used.

m:++++

var-use

Variable never used.

m:-+++

param-use

Function parameter never used.

m:++++

fcn-use

Function is never used.

m:++++

type-use

Defined type never used.

m:-+++

field-use

Field of structure or union type is never used.

m:---+

unused-special

Declaration in a special file (corresponding to .l or .y file) is unused.

Complete Programs (Section 13.2)

m:--++

decl-undef

Function, variable, iterator or constant declared but never defined.

shortcut

partial

Check as partial system (sets -decl-undef, -export-local and prevents checking of macros in headers without corresponding .c files.)

Exports

m:---+

export-local

A declaration is exported but not used outside this module.  (Declaration can use the static qualifier.)

m:--++

export-header

A declaration (other than a variable) is exported but does not appear in a header file.

m:--++

export-header-var

A variable declaration is exported but does not appear in a header file.

Unrecognized Identifiers

P: +

unrecog

An unrecognized identifier is used.

P: +

sys-unrecog

Report unrecognized identifiers that start with the system prefix, __ (two underscores).

P: -

repeat-unrecog

Report multiple messages for unrecognized identifiers.  If repeatunrecog is not set, an error is reported only the first time a particular unrecognized identifier appears in the file.

Multiple Definition and Declarations

P: +

redef

A function or variable is defined more than once.

m:--++

redecl

An identifier is declared more than once.

m:-+++

nested-extern

An extern declaration is used inside a function body.

ISO Conformance

m:--++

noparams

A function is declared without a parameter list prototype.

m:---+

old-style

Function definition is in old style syntax.  Standard prototype syntax is preferred.

m:-+++

exit-arg

Argument to exit has implementation defined behavior.  The only valid arguments to exit are EXIT_SUCCESS, EXIT_FAILURE and 0.  An error is reported if Splint can determine statically that the argument to exit is not one of these.

P: +

use-varargs

Report if <varargs.h> is used (should use stdarg.h).

Limits

The ANSI Standard includes limits on minimum numbers that a conforming compiler must support.  Whether of not a particular compiler exceeds these limits, it is worth checking that a program does not exceed them so that other compilers may safely compile it.  In addition, exceeding a limit may indicate a problem in the code (e.g., it is too complex if the control nest depth limit is exceeded) that should be fixed regardless of the compiler.  Splint checks the following limits.  For each limit, the maximum value may be set from the command line (or locally using a stylized comment).  The minimum limits were increased for the ISO C99 specification.  If the iso99-limits flag is used, all limits are checked with the minimum values of an ISO C99 conforming compiler.  If the ansi89-limits flag is used, all limits are checked with the minimum values of an ANSI C89 conforming compiler.

shortcut

ansi89-limits

Check for violations of minimum limits prescribed by ANSI C89 standard (sets control-nest-depth, string-literal-len, include-nest, num-struct-fields, and num-enum-members).

shortcut

iso99-limits

Check for violations of minimum limits prescribed by ISO C99 standard (sets control-nest-depth, string-literal-len, include-nest, num-struct-fields, and num-enum-members).

m:---+

control-nest-depth  <number>

Set maximum nesting depth of compound statements, iteration control structures, and selection control structures (ISO C99 minimum is 63; ANSI C89 minimum is 15).

m:---+

string-literal-len  <number>

Set maximum length of string literals (ISO C99 minimum is 4095; ANSI C89 minimum is 509).

m:---+

num-struct-fields  <number>

Set maximum number of fields in a struct or union (ISO C99 minimum is 1023; ANSI minimum is 127).

m:---+

num-enum-members <number>

Set maximum number of members of an enum type (ISO C99 minimum is 1023; ANSI minimum is 127).

m:--++

include-nest <number>

Set maximum number of nested #include files (ISO C99 minimum is 63; ANSI minimum is 8).

Header Inclusion (Section 14.3 )

P: +

skip-ansi-headers

Prevent inclusion of header files in a system directory with names that match standard ANSI headers. The symbolic information in the standard library is used instead.  Flag in effect only if a library that includes the standard library is used.  The ANSI headers are: assert, ctype, errno, float, limits, locale, math, setjmp, signal, stdarg, stddef, stdio, stdlib, strings, string, time, and wchar.

P: +

skip-iso-headers

Prevent inclusion of header files in a system directory with names that match standard ISO C99 headers. The symbolic information in the standard library is used instead.  In effect only if a library that includes the standard library is used.  The ISO C99 headers are: assert, complex, ctype, errno, fenv, float, inttypes, iso646, limits, locale, math, setjmp, signal, stdarg, stdbool, stddef, stdio, stdlib, string, tgmath, time, wchar, and wctype.

P: +

skip-posix-headers

Prevent inclusion of header files in a system directory with names that match standard POSIX headers. The symbolic information in the standard library is used instead.  In effect only if a library that includes the POSIX library is used.  The skipped POSIX headers are: dirent, fcntl, grp, pwd, termios, sys/stat, sys/times, sys/types, sys/utsname, sys/wait, unistd, and utime.

P: +

warn-posix-headers

Report use of a POSIX header when checking a program with a non-POSIX library.

 

P: +

warn-unix-headers

Warn the user that the unix library may not be compatible with all platforms.

P: -

skip-sys-headers

Prevent inclusion of all header files in system directories.

P: +

sys-dir-expand-macros

Expand macros in system directories regardless of other settings, except for macros corresponding to names defined in a load library.

m:---+

sys-dir-errors

Report errors in files in system directories (set by -sys-dirs).  

 

P:+

warn-sys-files

Warn when a system file was listed as a command line file but Splint is not set to report errors for system files. This prevents accidentally missing warnings in system files when Splint is run in a system directory.

global: -

single-include

Optimize header inclusion to only include each header file once.

global: -

never-include

Use library information instead of including header files.

global: -

case-insensitive-filenames

File names are case insensitive (file.h and FILE.H are the same file).

Comments

These flags control how syntactic comments are interpreted.

P: @

comment-char <char>

Set the marker character for syntactic comments.  Comments beginning with /*<char> are interpreted by Splint.

P: -

noaccess

Ignore access comments.

P: -

nocomments

Ignore all stylized comments.

P: +

sup-counts

Actual number of errors does not match number in /*@i<n>@*/

P: +

lint-comments

Interpret traditional lint comments (/*FALLTHROUGH*/, /*NOTREACHED*/, /*PRINTFLIKE*/).

m:-+++

warn-lint-comments

Print a warning and suggest an alternative when a traditional lint comment is used.   

P: +

unrecog-comments

Stylized comment is unrecognized.

P: +

unrecog-flag-comments

Semantic comment attempts to set a flag that is not recognized.

P: +

annotationerror

A declaration uses an invalid annotation.

P: +

commenterror

A syntactic comment is used inconsistently.

Parsing

P: -

continue-comment

A line continuation marker (\) appears inside a comment on the same line as the comment close. Preprocessors should handle this correctly, but it causes problems for some preprocessors.

P: +

nest-comment

A comment open sequence (/*) appears inside a comment.  This usually indicates that an earlier comment was not closed.

P: -

slashslashcomment

A // comment is used.  ISO C99 allows // comments, but earlier standards did not.

P: +

duplicate-quals

Report duplicate type qualifiers (e.g., unsigned unsigned).

P: +

gnu-extensions

Support some GNU and Microsoft language extensions.

P: +

syntax

Parse error.

P: -

try-to-recover

Try to recover from a parse error.  If trytorecover is not set, Splint will abort checking after a parse error is detected.  If it is set, Splint will attempt to recover, but Splint does performs only minimal error recovery.  It is likely that trying to recover after a parse error will lead to an internal assertion failing.

Warn use

m: -+++

bufferoverflow

Use of function that may lead to buffer overflow.

m: ++++

bufferoverflowhigh

Use of function that may lead to buffer overflow.

m: --++

implementationoptional

Use of a declarator that is implementation optional, not required by ISO99.

m: --++

multithreaded

Non-reentrant function should not be used in multithreaded code.

m: --++

portability

Use of function that may have implementation-dependent behavior.

m: --++

superuser

Call to function restricted to superusers.

m: ---+

toctou

Possible time of check, time of use vulnerability.

m: ----

unixstandard

Use of function that need not be provided by UNIX implementations

ITS4 compatibility flags

P: -

its4mostrisky

Security vulnerability classified as most risky in its4 database.

P: -

its4veryrisky

Security vulnerability classified as very risky in its4 database.

P: -

its4risky

Security vulnerability classified as risky in its4 database.

P: -

its4moderate

Security vulnerability classified as moderate risk in its4 database.

P: -

its4low

Security vulnerability classified as risky in its4 database.

Debug flags

P: 3

bugslimit

Set maximum number of bugs detected before giving up.

m: ----

debugfcnconstraint

Perform buffer overflow checking even if the errors would be surpressed.

P: -

grammar

Debug parsing. Prints bison generated debuging information.

P: -

keep

Do not delete temporary files.

P: -

nopp

Do not pre-process input files.

P: -

showsourceloc

Display the source code location where a warning is produced.

Appendix C                    Annotations

Suppressing Warnings

Several annotations are provided for suppressing messages.  In general, it is usually better to use specific flags to suppress a particular error permanently, but the general error suppression flags may be more convenient for quickly suppressing messages for code that will be corrected or documented later.

ignore

end

No errors will be reported in code regions between /*@ignore@*/ and /*@end@*/.  These comments can be used to easily suppress an unlimited number of messages, but are dangerous since if real errors are introduced in the ignoreend region they will not be reported. The ignore and end comments must be matched — a warning is printed if the file ends in an ignore region or if ignore is used inside ignore region.

i

No errors will be reported from an /*@i@*/ comment to the end of the line.

i<n>

No errors will be reported from an /*@i<n>@*/ (e.g., /*@i3@*/) comment to the end of the line.  If there are not exactly n errors suppressed from the comment point to the end of the line, Splint will report an error.  This is more robust than i or ignore since a message is generated if the expected number errors is not present.  Since errors are not necessarily detected until after this file is processed (for example, and unused variable error), suppress count errors are reported after all files have been processed.  The ‑supcounts flag may be used to suppress these errors.  This is useful when a system if being rechecked with different flag settings.

t

t<n>

Like i and i<n>, except controlled by +tmpcomments flag.  These can be used to temporarily suppress certain errors.  Then, -tmpcomments can be set to find them again.

Syntactic Annotations

The grammar below is the C syntax from [K&R,A13] modified to show the syntax of syntactic comments.  Only productions effected by Splint annotations are shown.  In the annotations, the @ represents the comment marker char, set by -commentchar (default is @).

Functions

direct-declarator Þ

   direct-declarator (parameter-type-listopt ) stateClause*opt globalsopt modifiesopt

|  direct-declarator (identifier-listopt ) stateClause*opt globalsopt modifiesopt

 

stateClause Þ /*@ ( uses | sets | defines | allocates | releases) reference,+ ;opt @*/

               | /*@ ( ensures | requires ) stateTag reference,+ ;opt @*/                    (Section 7.4)

 

stateTag Þ only | shared | owned | dependent | observer | exposed | isnull | notnull

     | identifier                           (Annotation defined by metastate definition, Section 10)

           

globals Þ /*@globals globitem,+ ;opt @*/ | /*@globalsdeclaration-listopt  ;opt @*/ 

globitem Þ [ ( undef | killed )* ]    identifier |  internalState fileSystem

 

modifies Þ /*@modifies (nothing | (expression | internalState | fileSystem)+ ;opt) @*/        

     | /*@*/                   (Abbreviation for no globals and modifies nothing.)

Iterators (Section 11.4)

The globals and modifies clauses for an iterator are the same as those for a function, except they are not enclosed by a comment, since the iterator is already a comment.

direct-declarator

Þ /*@iter identifier (parameter-type-listopt ) iterGlobalsopt iterModifiesopt @*/

 

iter-globals Þ globals declaration-listopt ;opt

iter-modifies Þ modifies  moditem,+;opt|  modifies nothing;opt

Constants (Section 11.1)

external-declaration Þ /*@constant declaration  ;opt @*/

Alternate Types (Section 4.4)

Alternate types may be used in the type specification of parameters and return values.

extended-typeÞ type-specifier alt-type opt

alt-type Þ /*@alt basic-type,+ @*/

Declarator Annotations

General annotations appear after storage-class-specifiers and before type-specifiers.  Multiple annotations may be used in any order.  Here, annotations are without the surrounding comment.  In a declaration, the annotation would be surrounded by /*@ and @*/.  In a globals or modifies clause or iterator or constant declaration, no surrounding comments would be used since they are within a comment.

Type Definitions (Section 4.3)

A type definition may use any either abstract or concrete, either mutable or immutable, and refcounted.  Only a pointer to a struct may be declared with refcounted.  Mutability annotations may not be used with concrete types since concrete types inherit their mutability from the actual type.

abstract

Type is abstraction (representation is hidden from clients.)

concrete

Type is concrete (representation is visible to clients.)

immutable

Instances of the type cannot change value.

mutable

Instances of the type can change value.

refcounted

Reference counted (Section 5.4).

Type Access

Control comments may also be used to override type access settings.

 

/*@access <type>,+@*/ 

Allows the following code to access the representation of <type>.  Type access applies from the point of the comment to the end of the file or the next access control comment for this type.

/*@noaccess <type>,+@*/

Restricts access to the representation of <type>.  The type in a noaccess comment must have been declared as an abstract type. 

Global Variables  (Section 7.2 )

One check annotation may be used on a global or file-static variable declaration.

unchecked

Weakest checking for global use.

checkmod

Check modification by not use of global.

checked

Check use and modification of global.

checkedstrict

Check use of global, even in functions with no global list.

Memory Management  (Section 3 )

dependent

A reference to externally-owned storage.  (Section 5.2.2 )

keep

A parameter that is kept by the called function.  The caller may use the storage after the call, but the called function is responsible for making sure it is deallocated.  (Section 5.2.4 )

killref

A refcounted parameter.  This reference is killed by the call. (Section 5.4)

only

An unshared reference.  Associated memory must be released before reference is lost.  (Section 5.2 )

owned

Storage may be shared by dependent references, but associated memory must be released before this reference is lost.  (Section 5.2.2 )

shared

Shared reference that is never deallocated.  (Section 5.2.5 )

temp

A temporary parameter.  May not be released, and new aliases to it may not be created.  (Section 5.2.2)

Aliasing  (Section 6 )

Both alias annotations may be used on a parameter declaration.

unique

Parameter that may not be aliased by any other reference visible to the function. (Section 6.1.1 )

returned

Parameter that may be aliased by the return value.  (Section 6.1.2 )

Exposure  (Section 6.2 )

observer

Reference that cannot be modified.  (Section 6.2.1 )

exposed

Exposed reference to storage in another object. (Section 6.2 )

Definition State (Section 3 )

out

Storage reachable from reference need not be defined.

in

All storage reachable from reference must be defined.

partial

Partially defined.  A structure may have undefined fields.  No errors reported when fields are used.

reldef

Relax definition checking.  No errors when reference is not defined, or when it is used.

Global State (Section 7.2.2)

These annotations may only be used in globals lists.  Both annotations may be used for the same variable, to mean the variable is undefined before and after the call.

 

undef

Variable is undefined before the call.

killed

Variable is undefined after the call.

Null State (Section 2 )

null

Possibly null pointer.

notnull  

Non-null pointer.

relnull

Relax null checking.  No errors when NULLis assigned to it, or when it is used as a non-null pointer.

Null Predicates (Section 2.1.1 )

A null predicate annotation may be used of the return value of a function returning a Boolean type, taking a possibly-null pointer for its first argument.

nullwhentrue

If result is true, first parameter is NULL.

falsewhennull

If result is TRUE, first parameter is not NULL.

Execution  (Section 8.1 )

The noreturn, maynotreturn and alwaysreturn annotations may be used on any function.  The noreturnwhentrue and noreturnwhenfalse annotations may only be used on functions whose first argument is a Boolean.  

noreturn                       

Function never returns.

maynotreturn

Function may or may not return.

noreturnwhentrue

Function does not return if first parameter is TRUE.

noreturnwhenfalse

Function does not return if first parameter if FALSE.

alwaysreturn

Function always returns.

Side Effects (Section 11.2.1)

sef

Corresponding actual parameter has no side effects.

Declarations

These annotations can be used on a declaration to control unused or undefined error reporting.

unused

Identifier need not be used (no unused errors reported.)  (Section 13.1 )

external

Identifier is defined externally (no undefined error reported.) (Section 13.2 )

Switch Statements

fallthrough

Fall through case.  No message is reported if the previous case may fall through into the one immediately after the fallthrough.

Break and Continue Statements (Section 8.3.3)

These annotations are used before a break or continue statement.

innerbreak

Break is breaking an inner loop or switch.

loopbreak

Break is breaking a loop.

switchbreak

Break is breaking a switch.

innercontinue 

Continue is continuing an inner loop.

Unreachable Code

This annotation is used before a statement to prevent unreachable code errors.

notreached

Statement may be unreachable.

Format String Arguments 

These annotations are used immediately before a function declaration.

printflike

Check variable arguments like printf library function.  

scanflike

Check variable arguments like scanf library function.

Use Warnings

These annotations are used immediately before a function, variable or type declaration.

warn <flag-specifier> <message>

Issue a warning (controlled by flag-specifier) where this declarator is used.

Macro Expansion

/*@notfunction@*/

The next macro definition is not intended to be a function, and should be expanded in line instead of checked as a macro function definition.

Arbitrary Integral Types

These annotations are used to represent arbitrary integral types.  Syntactically, they replace the implicit int type.

 

/*@integraltype@*/

An arbitrary integral type.  The actual type may be any one of short, int, long, unsigned short, unsigned, or unsigned long.

/*@unsignedintegraltype@*/

An arbitrary unsigned integral type.  The actual type may be any one of unsigned short, unsigned, or unsigned long.

/*@signedintegraltype@*/

An arbitrary signed integral type.  The actual type may be any one of short, int, or long.

Traditional Lint Comments

Some of the control comments supported by most standard UNIX lints are supported by Splint so legacy systems can be checked more easily.  These comments are not lexically consistent with Splint comments, and their meanings are less precise (and may vary between different lint programs), so we recommend that Splint comments are used instead except for checking legacy systems already containing standard lint comments.

 

These standard lint comments supported by Splint:

/*FALLTHROUGH*/ (alternate misspelling, /*FALLTHRU*/)

Prevents errors for fall through cases.  Same meaning as /*@fallthrough@*/.

/*NOTREACHED*/

Prevents errors about unreachable code (until the end of the function).  Same meaning as /*@notreached@*/.  

/*PRINTFLIKE*/

Arguments similar to the printf library function (there didn’t seem to be much of a consensus among standard lints as to exactly what this means).  Splint supports:

/*@printflike@*/

Function takes zero or more arguments of any type, an unmodified char * format string argument and zero of more arguments of type and number dictated by the format string.  Format codes are interpreted identically to the printf standard library function.  May return a result of any type.  (Splint interprets /*PRINTFLIKE*/ as /*@printflike@*/.)

/*@scanflike@*/

Like printflike, except format codes are interpreted as in the scanf library function.

 

/*ARGSUSED*/

Turns off unused parameter messages for this function.  The control comment, /*@‑paramuse @*/ can be used to the same effect, or /*@unused@*/ can be used in individual parameter declarations.

 

Splint will ignore standard lint comments if -lint-comments is used.  If +warn-lint-comments is used, Splint generates a message for standard lint comments and suggest replacements.

Metastate Definitions

The grammar for .mts files is shown below.

 

metastate    Þ [ global ] attribute identifier clause* end

clause        Þ contextClause | valuesClause | defaultClause | defaultsClause

      | annotationsClause | mergeClause | transfersClause | loserefClause

| preconditionsClause | postconditionsClause

contextClauseÞ context contextSelector

contextSelector Þ ( parameter | reference | result | clause | literal | null ) [ type ]

valuesClauseÞ oneof valueChoice,*

 

defaultClause Þ default valueChoide

defaultsClauseÞ defaults ( contextSelector ==> valueChoice )*

 

annotationsClauseÞ annotations  ( identifier [ contextSelector ] ==> valueChoice )*

 

mergeClauseÞ merge ( mergeItem + mergeItem ==> transferAction )*

mergeItemÞ valueChoice | *

 

transfersClauseÞ transfers ( valueChoice as valueChoice==> transferAction )*

loserefClauseÞ losereference ( valueChoice ==> errorAction )*

 

transferActionÞ valueChoice | errorAction

errorActionÞ error [ stringLiteral ]

 

valueChoiceÞ identifier               

 

Appendix D                    Specifications

Another way of providing more information about programs is to use formal specifications.  Although this document has largely ignored specifications, Splint was originally designed to use the information in LCL specifications instead of source-code annotations.  This document focuses on annotations since it takes less effort to add annotations to source code than to maintain an additional specification file.  Annotations can express everything that can be expressed in LCL specifications that is relevant to Splint checking.  However, LCL specifications can provide more precise documentation on program interfaces than is possible with Splint annotations.  This appendix (extracted from [Evans94]) is a very brief introduction to LCL Specifications.  For more information, consult [GH93].     

 

The Larch family of languages is a two-tiered approach to formal specification. A specification is built using two languages — the Larch Shared Language (LSL), which is independent of the implementation language, and a Larch Interface Language designed for the specific implementation language.  An LSL specification defines sorts, analogous to abstract types in a programming language, and operators, analogous to procedures.  It expresses the underlying semantics of an abstraction.

 

The interface language specifies an interface to an abstraction in a particular programming language.  It captures the details of the interface needed by a client using the abstraction and places constraints on both correct implementations and uses of the module.  The semantics of the interface are described using primitives and sorts and operators defined in LSL specifications.  Interface languages have been designed for several programming languages.

 

LCL [GH93, Tan95] is a Larch interface language for Standard C.  LCL uses a C-like syntax.  Traditionally, a C module M consists of a source file, M .c, and a header file, M .h.  The header file contains prototype declarations for functions, variables and constants exported by M, as well as those macro definitions that implement exported functions or constants, and definitions of exported types. When using LCL, a module includes two additional files — M .lcl, a formal specification of M, and M.lh, which is derived by Splint (if the lh flag is on) from M .lcl.  Clients use M .lcl for documentation, and should not need to look at any implementation file.  The derived file, M .lh, contains include directives (if M depends on other specified modules), prototypes of functions and declarations of variables as specified in M .lcl.  The file M .h should include M .lh and retain the implementation aspects of the old M .h, but is no longer used for client documentation.

Specification Flags

These flags are relevant only when Splint is used with LCL specifications.

Global Flags

lcs

Generate .lcs files containing symbolic state of .lcl files (used for imports).  By default .lcs files are generated for each .lcl file processed.  Use -lcs to prevent generation of .lcs files.

lh

Generate .lh files.  By default, -lh is set and no .lh files are generated.  Use +lh to enable .lh file generation. 

i <file>

Set LCL initialization file to <file>.  The LCL initialization file is read if any .lcl files are listed on the command line.  The default file is lclinit.lci, found on the LARCH_PATH.

lclexpect <number>

Exactly <number> specification errors are expected.  Specification errors are errors detected when checking the specifications.  They do not depend on the source code.

Implicit Globals Checking Qualifiers

m:-++-

imp-checked-spec-globs

Implicit checked qualifier on global variables specified in an LCL file with no checking annotation.

m:----

imp-checkmod-spec-globs

m:---+

Implicit checkmod qualifier on global variables specified in an LCL file with no checking annotation.

imp-checkedstrict-spec-globs

Implicit checked qualifier on global variables specified in an LCL file with no checking annotation.

P: -

Implicit Annotations

spec-glob-imp-only

Implicit only annotation on global variable declaration in an LCL file with no allocation annotation.

P: -

spec-ret-imp-only

Implicit only annotation on return value declaration in an LCL file with no allocation annotation.

P: -

spec-struct-imp-only

Implicit only annotation on structure field declarations in an LCL file with no allocation annotation.

shortcut

spec-imp-only

Sets spec-glob-imp-only, spec-ret-imp-only and spec-struct-imp-only.

Macro Expansion

P: +

spec-macros

Macros defining specified identifiers are not expanded and are checked according to the specification. 

m:-+++

Complete Programs and Specifications

spec-undef

Function, variable, iterator or constant specified but never defined.

P: -

spec-undecl

Function, variable, iterator or constant specified but never declared.

P: -

need-spec

shortcut

There is information in the specification that is not duplicated in syntactic comments.  Normally, this is not an error, but it may be useful to detect it to make sure checking incomplete systems without the specifications will still use this information.

export-any

m:---+

An error is reported for any identifier that is exported but not specified.  (Sets all export flags below.)

export-const

Constant exported but not specified.

m:---+

export-var

Variable exported but not specified.

m:---+

export-fcn

Function exported but not specified.

m:---+

export-iter

Iterator exported but not specified.

m:---+

export-macro

An expanded macro exported but not specified

m:---+

export-type

Type definition exported but not specified

Appendix E                     Annotated Bibliography

Splint

All of these papers are available at http://www.splint.org/publications/.    

 

[Barker01] Chris Barker. Static Error Checking of C Applications Ported from UNIX to WIN32 Systems Using LCLint. Senior Thesis, University of Virginia Deptartment of Computer Science.  May 2001.

 

Describes annotations and checks useful for porting applications.

 

[Evans94] David Evans. Using specifications to check source code.  MIT/LCS/TR 628, Laboratory for Computer Science, MIT, June 1994.

 

MIT SM Thesis.  Describes research behind Splint, focusing on how specifications can be exploited to do lightweight checking.  Includes case studies using LCLint.

 

[EGHT94] David Evans, John Guttag, Jim Horning and Yang Meng Tan.  LCLint: A tool for using specifications to check code.  SIGSOFT Symposium on the Foundations of Software Engineering, December 1994.

 

Somewhat obsolete introduction to LCLint.  Shows how LCLint is used to find errors in a sample program.

 

[Evans96] David Evans.  Static Detection of Dynamic Memory Errors.  SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’96), Philadelphia, PA., May 1996.

 

Describes approach for exploiting annotations added to code to detect a wide class of errors.  Focuses on memory management checks described in Section 5 of this manual. 

 

[Evans00] David Evans.  Annotation-Assisted Lightweight Static Checking.  First International Workshop on Automated Program Analysis, Testing and Verification.  February, 2000.

 

Short position paper describing research agenda behind Splint.

 

[Evans02] David Evans and David Larochelle.  Improving Security Using Extensible Lightweight Static Analysis.  IEEE Software, Jan/Feb 2002.

 

Most security attacks exploit instances of well-known classes of implementations flaws.  This article describes how Splint can be used to detect common security vulnerabilities (including buffer overflows and format string vulnerabilities).

 

[Larochelle01] David Larochelle and David Evans.  Statically Detecting Likely Buffer Overflow Vulnerabilities.  2001 USENIX Security Symposium, Washington, D. C., August 13-17, 2001. 

 

Buffer overflow attacks may be today's single most important security threat. This paper describes how Splint can be used to detect likely vulnerabilities through an analysis of the program source code and presents experience using our approach to detect buffer overflow vulnerabilities in two security-sensitive programs.

 

C

[ISO99] International Standard ISO/IEC 9899.  Programming languages – C.  Second edition.  December 1999.

 

International standard specification for C programming language.  Approved by ANSI May 2000.

 

[KR88] Brian W. Kernighan and Dennis M. Ritchie.  The C Programming Language, second edition.  Prentice Hall, New Jersey, 1988.

 

Standard reference for ANSI C.  If you haven’t heard of this one, you probably didn’t get this far (unless you started at the back).

 

[vdL94] Peter van der Linden.  Expert C Programming:  Deep C Secrets.  SunSoft Press, Prentice Hall, New Jersey, 1994.

 

Filled with useful information on the darker corners of C, as well as lots of industry anecdotes and humor.  Splint’s reserved name checking is loosely based on the list of reserved names in this book.

Methodology

[GH93] John Guttag and James Horning with Stephen J. Garland, Kevin D. Jones, Andrés Modet, and Jeannette M. Wing.  Larch: Languages and Tools for Formal Specification. Springer-Verlag, Texts and Monographs in Computer Science, 1993.

 

Overview of the Larch family of specification languages and related tools.  Includes a chapter on LCL, the Larch C interface language, on which Splint is based.

 

[LG86] Barbara Liskov and John Guttag.  Abstraction and Specification in Program Development, MIT Press, Cambridge, MA, 1986.

 

Describes a programming methodology using abstract types and specified interfaces.  Much of the methodology upon which Splint is based comes from this book.  Uses the CLU programming language. 

 

[Liskov01] Barbara Liskov with John Guttag.  Program Development in Java, Addison Wesley, 2001.

 

An updated version of [LG86] for the Java programming language. 

 

[Tan95] Yang Meng Tan.  Formal Specification Techniques for Engineering Modular C.  Kluwer International Series in Software Engineering, Volume 1, Kluwer Academic Publishers, Boston, 1995.

 

Modified and updated version of MIT Ph D thesis, previously published as MIT/LCS/TR-619, 1994.  Includes presentation of the semantics of LCL and a case study using LCL.

 

Secure Programming

[Hat95] Les Hatton.  Safer C: Developing Software for High-integrity and Safety-critical Systems.  McGraw-Hill International Series in Software Engineering, 1995.

 

A broad work on all aspects of developing safety-critical software, focusing on the C language.  Provides good justification for the use of C in safety-critical systems, and the necessity of tool-supported programming standards.  Splint users will be interested to see how many of the errors listed as only being dynamically detectable can be detected statically by Splint.

 

[VM02] John Viega and Gary McGraw.  Building Secure Software: How to Avoid Security Problems the Right Way.  Addison-Wesley, 2002.

A comprehensive survey of techniques and principles for building secure programs.

 

See also [Evans02] and [Larochelle01].



 



[1] Lint is a common programming tool for detecting anomalies in C programs.  S. C. Johnson developed the original lint in the late seventies, mainly because early versions of C did not support function prototypes.  Splint was originally named LCLint because it was originally intended to check for inconsistencies between LCL specifications and C implementations.  To reflect divergence from LCL and increased focus on detecting security vulnerabilities, the name was changed to Splint, short for “Specification Lint” and “Secure Programming Lint”.

[2] The meta-notation, item,+ is used to denote a comma separated list of items.  For example,                               /*@access mstring, intSet@*/

allows access to the representations of both mstring and intSet.)  

[3] This section is largely based on [Evans96].  It semi-formally defines some of the terms needed to describe memory management checking; if you are satisfied with an intuitive understanding of these terms, this section may be skipped.

[4] This is similar to the LISP storage model, except that objects are typed.

[5] Except sizeof, which does not need the value of its argument.

[6] If the storage is not assigned to a reference, an internal reference is created to track the storage.

[7] The declaration of free has a null annotation on the parameter to indicate that the argument may be NULL.  According to [ISO, 7.20.3.2], NULL may be passed to free without no action.  On some UNIX platforms, passing NULL to free causes a program crash so the UNIX version of the standard library specifies free without the null annotation on its parameter. To check that allocated objects are completely destroyed (e.g., all unshared objects inside a structure are deallocated before the structure is deallocated), Splint checks that any parameter passed as an out only void * does not contain references to live, unshared objects.  This makes sense, since such a parameter could not be used sensibly in any way other than deallocating its storage.

[8] In versions of Splint before 3.0, the noreturn annotation was named exits.  The noreturn annotation means the same thing, but is a more appropriate name.  For legacy code, Splint still supports the exits annotations.  Similarly, maynotreturn replaces mayexit, noreturnwhentrue replaces truexit and noreturnwhenfalse replaces falseexit.

[9]The sef annotation denotes a parameter as side effect free (see Section 11.2.1).  We use bool /*@alt int@*/ as the type of the parameter, to indicate that it may be either a Boolean or an integer.

[10] Peter van der Linden estimates that default fall through is the wrong behavior 97% of the time.  [vdL95, p. 37]

[11] “Software Glitch Cripples AT&T Network”, Telephony, 22 January 1990.

[12] See [Larochelle01] for information on internal aspects of the checking.

[13] This section is largely based on [Evans02].

[14] C. Cowan et al., FormatGuard: Automatic Protection from printf Format String Vulnerabilities.  10th Usenix Security Symposium, 2001.

[15] To be completely correct, all the macro parameters should be evaluated before the macro has any side effects.  Splint does not check this.

[16] Functions that do not produce to the same result each time they are called with the same arguments should be declared to modify internalState so they will lead to errors if they are passed as sef parameters.

[17] The most renowned C naming convention is the Hungarian naming convention, introduced by Charles Simonyi [Simonyi, Charles, and Martin Heller.  “The Hungarian Revolution.”  BYTE, August 1991, p. 131-38].  The names for Splint naming conventions follow the tradition of using Central European nationalities as mnemonics for naming conventions.  The Splint conventions are similar to the Hungarian naming convention in that they encode type information in names, except that the Splint conventions encode the names of accessible abstract types instead of the type of the declaration of return value.  Prefixes used in the Hungarian naming convention are not supported by Splint.

 

[18] Of course, namespace prefixes should really be described by regular expressions.  If there is sufficient interest (that is, someone volunteers to program it), regular expressions will be supported in a future version of Splint.

[19] POSIX library was contributed by Jens Schweikhardt.

splint-3.1.2.dfsg1/doc/html/footer.html0000755021234200000250000000362107637534343015363 0ustar fax
Splint - Secure Programming Lint info@splint.org
Download - Documentation - Manual - Links
Source - Linux - Publications - Talks
Reporting Bugs - Mailing Lists       Sponsors - Credits
splint-3.1.2.dfsg1/doc/html/header.html0000755021234200000250000000311407637534343015312 0ustar fax
Splint - Secure Programming Lint
info@splint.org
Download - Documentation - Manual - Links Reporting Bugs - Mailing Lists      Sponsors - Credits

splint-3.1.2.dfsg1/doc/html/realloc.htm0000755021234200000250000001044607637534563015341 0ustar fax Using Wrapper Functions

Using Wrapper Functions

The propose of this document is to provide an example of how to use wrapper functions to create programs that are more robust and that Splint can check more effectively.  The C standard library function realloc has complex semantics and is easy to use incorrectly.  Still, it is a popular function, and we are frequently asked how to use Splint to check code that uses realloc.  We hope to answer these questions in this section.  Additionally, we hope this example will provide insight into other ways to work around some of the limitations of Splint’s checking, and serve as a template for users wishing to create their own wrapper functions.

Splint cannot currently describe general functions where some of the attributes are dependent on one or more of the possible return values.  Often, functions are defined to modify their outputs, and perhaps allocate storage, but can also return an error indication, in which case none of the modifications or allocations will take place.

One very common example of this is the C standard library function realloc( void *pointer, size_t size).  When realloc succeeds, the pointer passed to it is no longer valid.  The returned pointer points to available storage with the specified size, and the values are copied from the leading portion of the original storage indicated by the pointer passed to the function.  When realloc returns a NULL pointer, and more than zero bytes were supposed to be allocated, no new storage has been allocated.  The original pointer passed in is not deallocated and its contents are still accessible.  (Under ANSI C '89 and later, malloc and realloc may return NULL if asked for zero bytes.  In this case, realloc would release the old storage.)

If you use realloc, -usereleased can be used to suppress warnings.  However, this may result in legitimate warnings for other errors being suppressed as well.  If you don't mind crafting your code to work around Splint's quirks, you can isolate this difficult-to-describe behavior to a single function that's easy to verify by inspection, and use that function elsewhere.  For example:

    /*@-usereleased@*/
    static /*@null@*/ void *
    grow_or_free (/*@only@*/ void *ptr, size_t newsize)
         /*@*/
    {
        void *newptr;
        newptr = realloc (ptr, newsize);
        if (newptr == NULL && newsize != 0) {
            /* Splint would complain,
               but this is correct.  */
            free (ptr);
            return NULL;
        }
        return newptr;
    }
    /*@=usereleased@*/

It would also be possible to use a function that always returns a valid pointer, and separately indicates whether it managed to change the size to that desired by the caller.

splint-3.1.2.dfsg1/doc/html/manual.css0000755021234200000250000000151007637534343015161 0ustar faxbody { font-family: Arial, helvetica, sans-serif } h1 { font-family: Arial, helvetica, sans-serif; color: darkblue } h2 { font-family: Arial, helvetica, sans-serif; color: darkblue } h3 { font-family: Arial, helvetica, sans-serif; color: darkblue } h4 { font-family: Arial, helvetica, sans-serif; color: darkblue; top-padding: .2em } h5 { font-family: Arial, helvetica, sans-serif; color: darkblue; top-padding: .2em } body { background: white } title { font-family: Ariel, helvetica, sans-serif; color: darkblue } A:link { color: blue } A:visited { color: darkblue } A:active { color: green } body { margin-left: 0%; margin-right: 0%; margin-top: 0%; margin-bottom: 0% } h4 { margin-left: 0%; margin-right: 0% } h3 { margin-left: 0%; margin-right: 0% } h2 { margin-left: 0%; margin-right: 0% } h1 { margin-left: 0%; margin-right: 0% } splint-3.1.2.dfsg1/doc/html/manual-301_files/0000755000000000000000000000000011051265520017175 5ustar rootrootsplint-3.1.2.dfsg1/doc/html/manual-301_files/image001.jpg0000644000000000000000000002054407416225434021221 0ustar rootrootÿØÿàJFIF``ÿþSoftware: Microsoft OfficeÿÛC    #%$""!&+7/&)4)!"0A149;>>>%.DIC;ÿÛC  ;("(;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ÿÀÛ½"ÿÄÿÄ;!1"AQaq23R4B‘#¡Á±$CSbÑáðñÿÄÿÄ#!1AQ2"aq‘ÿÝ(ÿÚ ?×înVÚ=MUûžeH߇óNs$ì‘6ƒ÷zCskÕÀûÖ\ÜaÁ'P/¹“°K†%º.7«OMló2cù¯4 ýÃù¬b.e¹:ÌÊUÆÚ}<é‰ù¦T8ÒrzS ·óLXþkÏÍ1ýcù¬$ó|ÊwS^p”‘±¦O¡ì8üw AÏ­F¡‡CXÇ)qI® lÞ"µ®)kU'Ê€ Í)½açó>õ»óGÊocXG9üϽR¯Tj`3Œøšòº€[ÄTÕAÆE"¥Ã›‡MÌD08ñ5” »µ±µ–YçUÔ¤“¶:PKuΦïe@#Iß­3O[’†û¯QáKZØ·ql¾[ÈøtW|2R4(V# ûƒÖ ^q[Ë'ü4WfEIBÝHÕ7—f’H$áÏ¡„ª[s¹Èÿh#YÍo4–³Û¸xƒc×(²kh{7⇠4Ň^öõÑñ«…!Í´.X3&sQŠöîªÈS»÷Ú½FŠE†  3îit6–¼Åz’kЈí©+ÌB`Å¡“'m-üÐÓ*“w·ãËÅp¾5dŸ,”æWà¬|W†aÙvêFw«—°†<™»mJÇqJ¥ÜF· ÚD^ÍU‘:³yúÑ.¢´t’ð4— ín6ú¹ÿæÎëÑùï¹%ÏÃ!Àæ ‡t-,°3ÌÝ[m½¨×3I,ÚåèÇeʈÛÂÿ†RI$‘Ÿ/ ½DÌ­¡Wr¼¥]m¤Yáf è}**I¯S:âNŒíöô¢³ W±sëàh]Ò°H–ý6#_Ä=¼éi[EŸAê 8A‚:øTÙZ6RUþ* È01½=µ.Jøbö­“†~‘}…c|•ðÅí[' ý"û W4|¦ö5„sŸÌûÖïÍ)½açó>ôJººº€'»,êNC+…=TìŠAƒáOÚNö× ë¶ø>¢ºñtÞJ2XELôþ©6*ZV pt횃V.^åž1{p²Gbâ³<ƒHÇÞðÚHÖW©r¡’HÆ6éŒQ Ûô¾µÌò,Wk‚’"O†*Ëcÿçבæ¾DQ³"®¼ýèÊò<ë%À¶œ¨î'‹2vÄp¢K‘#©Ít\>þð‚ÜHàîQAÅhW܆ð†W´µ…œaÂɹÎ|ÍIá²Kxã²·‰F­/Ùºô<ñŸG¡Ûp$Úe¸µEpû3¸¯.yvÚ)“µ¤üEX`û Ò8ÍœpZ9X°ï!ldúU2êÉÚ8e`“¸=éÌñø.6·†ÖÒÕ`¶‹²,;Ò¢÷Ï®³ÓíQ¤ZÎ#YT*\nç}êdÒ‹ÅFê®ú-5-”kqpºÔ" ȣù)ÿ]£EhópãuªV;ž™bCYÄFýÁD-¬Õ9H½žIc“×zëtÆ0F74ðÊïµ\d€Ó[d㡨SðòÝHþhÕÆ sˆèEÜÍfnÍ@êMkº[þ P7ïCÜ${»c#Ò‰Oq=ÐÕ…ì~’>*=ÔÌÁ[N3à)v}4®L]"!é[ ý"û Æù,’±dçjÙ8géØP¹£å7±¬#œþgÞ·~hùMìkç?™÷ *UÕÕê©f I rO Hлž€U£ƒrŠÝ/•â\d"n[ÜøS‡É/étö€eÉ8?j³ðÕ≭ÔgD‘’¥”c Œ¯è¥Ýá¼ „Zª=¯ ‹PØ3.IþjÃLpHÓ ÓVöqªuÅO‰)IouoÿжGa^^IØ[Ѩ‚*J&qLÈïugÒۆυcù5&—ŒÚµ}Ã'’úK‰X…hHE=Nåä‚ !š>ÑX’Îs½=Å"Xb-s/²(s¿¨\»Ã¢ïË# B€6õ®Zоf¹ŽÒeL…—;œ ©¦Ÿ‡ÆÑ@™g íÒ­ÜÂÑÝÝCl–èËŒdäš«Iky$8F¡Û'Ú´ÄYÒ%•Û+öÒ÷µ.œ·Aé3C™¡Á¤n˜À©ÖòÀ²gï‘¥kÉÚâò쵌B6;k;Ÿäô­%F¦†-íùf5ºRºpØHÎÔ20ëVÃà3ÒŽÚDÖ¼¶©+¬¬Ÿ'bsæjºo]ıY«ÌuÒ‘Iõ=~¯S—ˆ—ìUIP0:æ€ÝFHyïDŸ± îÇÿº+y߆3]Ìf* Q¥q‚qµ²â)y1C «iëÔ“Ÿ:ÚôLJä¯ôàÓ«rÍ·ö¨2€¤m¨ç©fèlsšp½áƒãLšG%n±{VÉÃ?H¾Â±¾Jøbö­“†~‘}…J‚¹£å7±¬#œþgÞ·~hùMìkç?™÷ *T¨œÇ"°8 Òk¨ _ âÑÃcPWº}}êÙÃù‚Ø´bâ"Ž›åwjÍ¢]† ¤`ž™£v7+xÙô¶/jÏŒ¬ù\Z팱\IJBáÔŒíֈƵ“Úñt·s4rÍø*§ߥXíy¾ñ[A¸ˆàÌÕrÑÌâü¤znkW¸MHÆ6 â«psL×’âTàûQ»7ÀKÃ"äúÃ-ßZÌ¢¿{,Rñ<Œ»‹ÔãΑ†Ö¼;kß~”TÛÛÍs%ÌkòL¹PûÎ s=¼id1 ÿÚ¤Ic~[/p©Œ•$ j$%™°ém1ƽÂGw>æ˜6ð‡77lê:S=ï ÕÔèv×–B8a3F ÿVbp§;íáïJ¹‰?Ó{ué'Ïÿ:mÝ­îcˆ-ȨŸ:T“Y[YÜ­ÜÉ€±!8$c¨õ4å’›ŠÜÚdR\SÔg ÕS€£¾ž ©²«š=$®ºŽØÕ:ñšß‰ÈèJ²¾G_öé7AÛ:ô¡7}¼êP¿†|)“½Ž˜¦8œFÚtBu«çñS{Â9Ïæ}è •uuuBÝK[„÷d§ÖðëMw1ÌOko¤†Ó±éÿš o©­£W8V+yQ‹X."¶WCºœ¶†ÿ õº~Ö!+öLpe!AòÉëJžÝáºky削±+³Ò—mtѧo%¸•C¡Í°{[»Æiam`–#9Õž Ó…d„ZFªè&á{Ì$Û9>Ø© ÷JŠ'‘ž±¾jSðÛ[›²–³¬:ˆ[ ?ÿi¼"â[·ˆ:»8èqµ;;JZñ‹ø `.‚o‰=<ê]§4_â8åÓàr7Çž)ƒo;ۣʗð;xÿ÷x^ nžÙ£^Í‘‚¸9ê*n‰hŸæi (ÛTlH¹ð¯cæ33ê‘¥ú>•]KApcP̲&@UÎ}*_µšK‹˜å£eÆwÎ6¥0;–SèÉâVצV·`»aÓ›šæÆ×(¶Û©8#qýèEý¼ÊÒGqÙ¬Ûh6ðûÔY±Ä›H§9,wã§µ+†„ü™ÛˆfíÉ;8ÙãO¹ ¼ße<ˆ’ÅãšSÜ\“§ÔR¸Ï‰^¤‘!TA¤jêwª×ùì¼ ’¾½«d៤_aXß%|1{VÉÃ?H¾Â´HW4|¦ö5„sŸÌûÖïÍ)½açó>ôJ¸‚àzê™ø©.â[c–,0Ý ô ±oèi9#VãÊŠ[Á)q$9u=Ný*-­±‰äŠR£A´ù?j™`%Ww„°Ê÷qïQ}Eô@Lée(îøŒ`Š-mØÁ(¶«lÆ¡¶§·sÄzÜ Æ 59£³»Ž5ŠcU ßñ¢R°üVjÊfk„”ÈNù:À94õ´Æ“™ÉiÇŽÔÕ§¸µ—£‚ ñí\†ê U†±ƒ¶i–Žîµ`;ŒãPð©/w:H¤E¸ŒtîIñ§fº•ííä?0ÍšZ/â-gº’B{" ®:“åíF†ôE­ì‰$E­Á¶¢)Ë[è­8ŒŒ±Y˜–:³ÿ÷QZXF—ÒͤçâØü+‹ÙÝÏßãöîÔJ5øÃE{¦U!d jbp648»El† Xœƒµ= G²«™K6¦ðÛ5Õ­¤RŽú;2È6øVí3§ÿÑÅB‡íp½ ¹2Úʦ'Á=à./b”‘œ®Æ„qeÔÉgY@F@ß5ÛÌïrݶH\cò¢6|À³FÑ\6øŠ¯Ç+„DèG‘wrãI,:Ôñ‚ee=Ìœ'‡È¯ÄbqÖ¡Õ*A8$:{Âd²¾ü:¸—¼[áÉ#5&ârÄFú´1b•Åa[Y­8…»jI†¥GßIÿãU.ºk2•{äÅ)Ù« ±¶>úEör…ÃÜvláuØŒš×øgéØU˜W4|¦ö5„sŸÌûÖïÍ)½açó>ôJœ‹Zºº.¬¶iº÷¦}hv·SHÏ€‡JçJ¯¯÷£œ>#4Xµ‘c” àž˜òª÷,/»˜ÖTé÷ò£°"ËpZ,Ç'î\íœÔßQ”{™¢0Ms%e ·C¶Ù¥Á ”£RHc tmÆj¹”º[ÝÆX)“ו?²´0¼qÈÁòtÞ¦TD-«&©îÙèiôüJ2³ÄØ;†ÆÆ†[ðkµRñH¸ñÆhÕåä/Žþ€ l6Ú–»=õ£÷ÊÓ²I!viQu³•Ñ+wIÇ­5mzÒ¢¬°+`«Nõ%¦Ž[f€A¥ ËhÆÕVè¸ì?E¡:L¨H$ç4âØÚÇ(’;ÄÔ7ãÓΤ=„#\vhNœ°ñ¦Ò£¸‰Z ´i39Ú‰K¤¢u ‡È;¡ÍB¾k»=q¾p@ŒÔÛ(®¬/\²ãpÙØœTâ· ò,áe 7(©,ýG8::ê†]!Žõ¤‹&=E”ƒSeŠÝ\IJÎ “Ó4›{¸¥bÃJzïŸj ˜S”/"æGÚš Ð/k¤†ÏA‚1ëRæ‰c8G‰¡—Ÿx™ 6<Æ‹%L78iЪB©tøuÅ–6–ÅåeTèIvôþ1J½¼– q»*•ß:ffˆ…ü9$duóñ©“^5Æi£òWõlœ3ô‹ì+䯆/jÙ8géØVª æ”ÞÆ°Žsù¿zÝù£å7±¬#œþeSb59Ã4¤¤uŒu=)ê’§*Ø4n ª.!µE ¨‘öMHË «Ä>u+xž¹j¯põÍò"kbvÈÛc×5aÒŽ¹Æ¨ÆVLõ&ú™o,†ÚCy®Ä®‚ÛšV÷’+ÚÈRfêÐûU|H;D`¥µŠÁ&ŽNÑ¡lŒŒÒí= áÓ« ýéìÌAHæi¸-n–çñ× "¥OOµâwo v²²iS¼1ãšZ=À罸´¸h‰V®Û›jÖ7J!"Xd—lƒj4w÷—..V%ƒ¿ñO‰,ì/CöMˆÎFû v~Ó2³Äûˆ¬.- ’\,mœ3ŸûPØ8\ðÝÄáãu9Èñ4‡xn¤y`•cÕÞ ô§¥‚g±³kl´ª[VMö ·MßG,7@#§QçAäi'•‡aÚ‘¶EXÑ®Ö2/gFA4çÞ¡º¢d(ìÀñÍ9 Ø8z12Τ0ßFzš\÷ cÆ4…ôÅK,ºÝ¶A“Ÿöª·âšÛ±TnIÒç÷,SÖ’‘yp†7Q vÆp¾T‰]Ët«qÙþu2Ø<ñ°¶’ Úqt\dPk«mo’Äö1I—˶ aœÓÂÚò†ï‡Ý¶º]XÆàmŒxyÔe¿c¿%‡øŸ†ÇD}»¿hÚN#'¦Þ4"n5Âíã”ÜA,’Ç"¨ì›+3å¿…GæE·‹[Ø\+Ëž3³0ú†|½(sXq9mçžX×hÛI#ê#Ö‰n‹ÖÖ+;¨.–ÒM ¤4‘È…IÓÄP+þouÅa™%’{ê¸ÐþõËÃ-ƒÝ°Ðm˜ÆûïNÚñ‹^-l"MÌqçA ÓÚ')°.-ãSY†Òvð3»ßûmAd¶ aÜg/¡À;©£—üB+ëŽÇ¼16 îϦš( ’DG:Oì'õõ§/íÓ…ùQäÊK©\êês×4Þ¨1çÖ½w-)bs¿ZS ÔŒ£p2|üj›µLrý›7R7­†~‘}…c|•ðÅí[' ý"û fÿÒ¿sGÊocXO9Òà ’kvæ”ÞÆ°Žs8—o:¥ïµ9nööò¦úš—aP³± åëA[¤`ì:g®|.)MšÌŒ{VŒW Ù4"ÂæÜ¸"X󅣑Ãrრˆ=hëë<²Žk…»ìØÈ¿JƒíDÕÌð®HVó"ƒŽ/q!†Ù-äŠ6î½ÀÁ$zë[˜ø½ãY§Xäl€ºtjzsö¬æszG(;m„ËýHÚig—qëR¡»’;“kÄÊ9|¸:ñ§ØU:ú gh%”Ãøc©ò7èE&Ñn¯0º»Gˆ³CÚ“¸é±©·u–Ynô±ßKr’-²Ý©Iìä^‡ÐùT{f±e^ †f9I%;á}ù QGy=Ÿk38KyK‡ÛËÃK‡OÄ8‡„=À–F®ó|ÁôŸ?ñUˤgnEqíYmd‘²4ºM²œƒê=}*%“q¾:Y´ºàp{(˜÷ /–Äæ‹q·½¾…R#hÆt²wqä|Ç•@žg·â–òND’B{…ìß>Ý…Mµ¾!ñ)ó(“ˆÅФf4Ø|½h‡âñÛY'³˜Íh„ÆÑï)'b}6þô;š.Œ‘ø$Œƒª)”Kè}é"Îy­òáã{ FJ“’¤H>ž4czV=ÍЋÃÝ@팖&XŠã àqA–KŽr…NC µq¾,hM­¾©[÷/B:æ«7 óë3·õ£îv>Õq¿â¿ø7ĸ½í—j Ý7jyàçÐîhw$bHÑ_þìô¨|8E-Ö‹‡ …J®¡œf¥_ƶp´2àò7 R³¸vI”ÌÑÊÇBh'ëçIgþ¡ 1¬èÎÔ…ï#^¨#9éVèjœ˜C,EP(¶.úEöŽrKkà@­†~‘}…3 æ”ÞÆ°Žs—ï[¿4|¦ö5…ó‹•|cl怬Û@Mèž'^¨íƒZü;$q’$|„džäP8gÔç ~ ^KÔä^„«;k+»t°3p…Ÿð÷rGjÑŒ£Ç‚¬=Ç_½Câ*-eY"¼’X[ Œƒåíþj-ï vDâ‘°žÞBÕw銲ÝCàÙ´ì˜2‰FÚ1×üÒ·¤e5:á|J vCq\NV“âóÉ©BμJBgZ“Þ÷þhBZH‚Ü:ö‰3éFH$Š›ļ6ácR „õ ŽžõÏ\÷v™ÄíîC$rL’%µ(ß>u,]AÇ-–Kø}-ß÷(ñÆ:PÛY®™ ”HĬa´ø4ùQ2-÷i LÛ‡pqâE)|9ªÆ8³YLñC&`ãâßz]e? 3+F´QÄÅdCâÊ|j3É,Ê×)01Èä4Déô§ø-Ù°ŽÚôEÚ Œ£B}=3Š>mZ’m$ß\Ù(š Lj½¨II'Að¢Vwy}ø²Â®²jcß8ëà(TW|Jõ.mTÛ°—C©`NŸüu§æárè'„Þ2«HX)=Ó“¾Ôþv‹5ë¿0ÚKÁÌß„w‘$±•ÈßÇ>T€q§´º¸k[’qøA'ý±JšÞNÆÕ¤ÏbH,lÀõ¨‘ÜÇiÄ',šÐ¾µ+ÐO¼^2Itz{þ!Ã/H²•¦¶Î¨Ã 8øHô¡W÷QÞË5ËGÙLì Pzyš!qwºruŽþ3Ýj}eh— ¦RÆ@ûsW¶˜eûÌ\*.L‚:Ó÷kp±Τ\1#9¥I+E"†= eÈ۩ʶƒ¨ 6Ó}Î4–Éâ”…p9ÈÅ'%r3Œõ¯U‰Ò§ ;Uµj|•ðÇŽ˜­“†~‘}…cœ•c?õ±ðÏÒ/° sGÊocXG9üϽoÎ¤ÄØ°Þm´žy´¢½Q+¨  zÒídC*¤Ò2ÆN1Nÿ¤ÞÓ5ßéŸôÏñKE¡Î‰koˆæIai+n½#ñ÷2\ Ë(ÕFW@k\ï(Iá—åqÙ1à:ÑŽgÄá±Ô!±ƒÔ Æá®Øe“o9~þhæ?Ñíƒ,?rùFx4oow ÁRgs&‚ß==èT|?ˆ[ÎnR6ø²Å_Z)z/H$0¤‘ËŒän£­Eï}3þÞ ~%wkö¬„åçöç”Ã-ÔlHtlcÔzÑ[ĺµüLÑ 0ÐQH?vþt0p$µ2Û†BF^2wFÏÞ»9541ŸrOn¼T˜ˆL,„à`ú Á¦†~"c‰Ì_ó##Ä /oË÷2räÑ,áHuÃ#Œ0 /ޫïíîb[Éo¤î@Á£Î®vS‚÷7Ö)|æ;TŒ™Ô‘¨ì~Ô»Ž!uìv¶âUq2ÉŽéßIþÕìgº±x¤bèpQÈÁë‚?Í3qÂî¯ã´¶ ÑcÜ|÷ÿO;LŸ·¼tþ$Í2Ì2F?ØS|FÙ#°¶ºìð a€c?ïC¯¸EüS²åœgVO\ÑN=‘i 1§Ä'ÃÊžµ6«‡eŠÃ.A9¥;m²Ì2X•2n2<ˆ±9Áî“IÿK¼ˆüC´ö:}ˆ¯˜Èpu¯B&BT+)Á#p<*Jð›ÂqÙéÆá×pbÏÚ h0’NM)‘¬tRûÔ×á7ZŽˆÎ<2+Åá7`ïþ:Õ-£òWõlœ3ô‹ì+ äøœò¤ošØ8`?„_a@+‰Ø‹¨ŽõI¿åNÖ\”?ÅhÔÛF„䨠3?Éãþ™þ+¿' ÿ¥v1ý»²èoù@ŽÌÿì|¤cÎûb´~Ê? W½”H¥¢Ò…oËz[¼¬ xÓr¤K™#Ö¡õ&GCW‘}"½ìÓé¸Äñ‘ÿÓ·]r¼(¢BF8Å!ùN(Ë¢#@ê4@¤ Œ÷5°W)ЕÖh%9¥ ÀB-¤w„0YLHHl7„ÂÐUB84„ ÐÔ@qFX'&1",i#aÀÁ40ÄFD T|D0wç0na¦¤ÉArdž)gšDt è¢ÁT:ÜHzÁ N ¡‡Ú&Älrú p¥M@ÅA«+0@Ä£0ÌyD¸ sXÁÀN0Dð§šᩱ‡‹@«ÂòBŠŽÒTAš#´Úª³j‚£›Vk­‚Eð©ÿÝCt¦„AžvtQÒ‹æÞ²“ª€,i²:¨®CÄné™o.$äµ,†Ò“§,% 5ÙÈ=²’•¤t¥ aËVÆ2‘”¬eTYÉT*Ò”·´d.îèÈ9²ÁD¥*‰JO&˜Á\e3uéLeÞÑ™Ç\å+gILk*3™Ñü&){Ê\¶r–Ó4&7—©Í`³ÍÔc/m9ÍqBS”²,æ1©©ËQ"“žõä§:JÍQÖÒ U2ýùËlÔ§0ºÉyÁœ†lh@ïyNZ4­§AKùP~’3¢-hH Qkú1—ÿíè)SZQ‚ªž E©@=:R‡¦”—&M(@3:Ô•†”Ô©P7êSšfR˜&e¨/‹jSž•£”ã3'ÚT¦þ´«æ´ER:ÓÒ4¬N=ëUŸJÕ¯Ò³§ný(TÉyÑ®šÕ«\«ùO•Úµ l ì[ZUq⤅=l?çJךU§¦Ì¦4!ZVZÒ2™ïÔ'%¯)SÍzö¥Zý&h×yÓm’6³7fX»éRÏâs™á\#a1[6 UŒDDnápÛ0î–¶ú”CoÁJBW¸Œ#gZÞ6wЮt§KÝê.2¹ÖUèsŸ»U3Ò ›µ,h«0Ü º ¦O(ÿïXº^¨†w©N(¯z•ƒ^>Ì— «kvñ™É>Üw ùå~ù{Q[Š×›àLðAK+×Ì"x“¸,«@ KZÇ.¸§ÿMI}C;Z»úT›èŒì^«I`öÚÁgkK âÿõ;õ=ld+Ù`¹ö®y%°H+ϸ޲­2¶d†?cû³Æ9ýí‘ë äîªØÇF¾ª‡%,›"ÇT¤'=nG¡ÜOÁª¿“…27»c‹ù’%3QkkÞm>ô“N.3˜“JXgžˆ•ZQ6±j}²Ž¿<çA3’«jÆižõÜDË95sÑ Yì¾7ÐLöqD©L_;sø%çrÿµ:jo¹µø…°ƒW¬ZÎ:x´¯}Ck8êá·µŽä­k]ïúŽv®¹ìbûØÈN¶²=±h2¢¶ صãòKlÞj¡Ú¾EF£Hn_ÛÛðý1­m n/'·Ù£¸ôÐÞrÃ4ÍsXôŸ‘Þr[Ýñu7¢ o{[˜ï>µD·­Ñ·Ó´®',«-Þïrª7p9­ JIúr® Oø…5®`J<.ÍñÆ'ËbCÄ©…o¥3 `x~:µŸ69VIþJUOœÆÏgÊûÊÌK|üžìºb³ÚÔ+;:Û†+Ÿ‘,gB߸³$¥qÓWÞcŽNâçEŸ´Õq|ÿW /ÝÂ[7/Ø•Þä™3=ìO•¥`O^p!ûXonL·>âÅÊýëGÿ7Ëå²gýîPˆºŽYkq·cînOk׳žôÄ~¼éy×ûØÅLö +£ü}¼º¼wLl–Ö=vú¡¥Èq»Y¬àë:¾/o^Ï<ÿ"O1ï¾áÏžÀQø(ƒ— BÐö8ø0áv¼j½SxÑÀBzÿ”Ú ü˜¬ŠNœXâ?ˆüJdøfK’17†¬ä¤Î‚ühºôi‘ÞÁ‘0c¦t7ó§Ò&é|ZÔAÃ¥KIª¼yÕ%Õ—S“ÖÜú°©S¨PãBXñŽF´M®M;I¢I¸ßtè¥Q²OÆñ‹¯`ÀgÏ1,Xb[Ÿ'^üò_ÇÿHžLypŒErޏŒ93_Ï$Pú=ô!Ô¢›±¶ÐphTÕ^÷j혶¾¢4{>³}wnàÜxSM+Bw#âÂ¥úlü«Ö½žlÞÚzQ/žT§'váÚ…o<¾ùØ!ëu1OŸ³°öÁÞ×®E~q÷ûËÿSk€åØç__zøYÈ`e >a FH¡=Vˆ!~nXà…~xˆ"ª7b‰¢yhbЬ ¨b‹×¹ã@,ÆHc^5Þ¨!Ž:R3ãŽ>öcÆô(d‘Œ‰d,D&ÉdK6 %OFI¥&U^i#–Z2å–^ Ñå—)„é"™b–vfmi®I ›M˜Y#œnÂ6guu"rgræÉ'š}ò°çþI¡ÖjàB*Šh£ý8ú£FJ*&¥“BŠ)ž™>³i~ꃥMŠJ%©Hš%ª "ªêª„¶êãPô¹¬:^#Ÿ„¹ªsWHþ,¤Ü0¶ö1lœº¾e]K7ÿÙ¹¬TkMWkÅÒhÖ]¹År±õz×UÝ84UDaÕô¬ÓFvâ¬ârKg¶%WÏ*ÛÛ¸z5+n>>e¯^ûʘݸmË p÷ ìÝq¾W[öFô/w —ðOåb4ÓYÈu1‘Ì%TtÇûïlÇEu²t‡±ra“–²ÐZÅo¡i$·FÝΫ3·uÙÅ®¯ ”ÑÎté¬îÑžˆpÊ;C´J œ·ÝŠ×·ŸÃ¹5 óÌ €lóŒ-+Bµ'÷þ𮯉Lݰ[vÅUôÍ´brµ„w&-ÁØ1–‡òÝY‡=·ÜŽ&uà‚š³á‡#¾«âýl÷ªY9~(ä_ÿ®÷­´eÎ ç±.íªç7Ê|yè”Ô8S’ŸС«³Î‚èãÉŽ%íäÁÎ+ÔZCj;ޤïÞhïš$üÖ¸GºiñW*?ÚñyXüŸÌ.og¼;¯Ïæü¹m³ê´`/ˆkÔM9øžZb¸ðøŠìø|+b~îÝã«t¸òÊ\îȚƯgêô#ŸžÄ­z²‘ÿä—·MG_ã‹™V†E>-E0QyÆž…¬ïp¬3r:Úû˜/БHwH “¹&˜"ÓˆP=áù ÎÒ>Œx*r!xÊ1kÙ‡µ*™„BCëyèƒa³s™o$UÔ"Ú “C®^Ù„gs"®æ4rÿ{îK¡ïüÇÁß,Ì&YñWhF~Ñ+^5 ¢ebµÃ§qjŒDYÙXG’­ofà}lèÆ¼üí$x;ßÈBvµ;–ŒŽ L$¯(­ºñ°H…£Ð"áD£õL“sád]$"«²Ë‡;ù_ô†'ÃØÏY‚Šc*Kó7Sî-lZå$¡°ݨFXD-_І†F ÚHùʈÛ#þŠ‘ÉÒE”ÆÔO2qY\™q ËQÎöHýué—s[&GÚ¶¶- +Õàý€ò$r–3›\‹XtÔ'”vÞ1¶“<ùT²ÒI©—>“MBÖÃ2‡ 2évMwµ“ÿ•&zhDÓ=ïÈ¢Ôˆ8ÚÑd¸ŽC ©HI(Ë¡Œ&•KQڡظ²¥‚C…Ú±Iš*áŸ?˜é)GÉSÓȧóã£Noà aWЬ êÏ„ïwEúù¸¯ùñÑÄR³TTIfg‹­+fPxÖÅ V{g•bßâ’/Èi‹¡“ÒÞì E¶1U™Á™šõ5°€Å"Lk!û¨Pª*;$ûV2Q¢0¬€r¬Ðy©G5ˆ@‹­›eËÅ¿2l´_Áß²0۵̆õ°¸)i ¹’I=¬ëeBƒmÂäò4§¬4[ e %+ùÕ(¸Ö¥( jžŒÛ7ò w3ÿ"ê–Ü.÷¨4@®X¹ú¾=îŽy›.ukðÒÕB§¨ÃdÙw[qÝ”š`—=(ÄÖZPñîâ¼±f¹y°üV%£Hˆ.öºzËâ"L²j”É=½™ÿþW½é]o#íÈFý‚¶e v^oWÕ}´mmÌíÐVa #¸ª£¯Wœ„xÁÉýiŽ2è]/µ”sYqDmŒQÏVÆmZMŒåû@ËEÍÍ0«#dP!ñfIÄ+$œKM=ñ˜ à,¢€kØÙJögV -ê¨f°$'/¼(ʯ¿ª²})rŸ8k+‰«6å7xÎÏ›Z_ïìN“vcØb”ý™Eâô¤qv±ÿ!ÉHêy@ÞŽ›!1ç€ò7†.t£û§­îj¨îím7á€Æ®7 –ôd£HYv0t­~þñqíª4UêóÁÌÄ–aY廕µ”³.¯Káê¥mÙ¯t,hOÝHËnõx¾¾4'àä©©Ñ)˵¢Ã¿¤©ÚÝ Çº“iBö Üö´ÿR1«ÉÒ¤Pw»Øý¢\¸ÞoVżMlÓYÜû»ÀÅE°éMå‘®hßÔm6Á p9Yß #¯^é†3âõ–x/`mo‹ûÁàJÒ8±èìl!z|ão÷ÈÍfµ“oÃ(WùdËjÑÓå ù{>ËrÒ\<ãµà¸Ñÿ9M‰î¼¾}akvß_ƒ÷’ÿº2mÎÕ£Ot²¢Þ†þ ˜µru¤Ð/‰u/@7æïe T/ØÓÈ5=ìûûÄi(þJŽ»p¡Ü;’ĺóOÛb1$Û´œ1yù3•ü»ßuå3ê’Ž„Lië}T9g'jø\ÞHýÛÌí®Qå8›Ûqòêwäw;¹?>ÏTç|“c—έ€ÍkS¶Cp½¦X„¶ŸºXsIZ¤ÃöØëÎñ°G™HÓjíø6ü¤[ìäã³í÷£×:ôèÔµ]ÍÛ> ·å4^üi%þ´íu–Œ8òúo41ý@ƒ>”nÓþ.ÿ7s穟彃4®DN©7~GTyVÆ(ÍF~X@n¨U„DôguÁâ€MuÒÕsÈ%†b‰·€XK†KEz·Pì7‚eS‚‡s§ ;´‚§c.H Æ` XsÐwƒ¡ÀT8( A/>˜r‘‘-BØq¡a„À†„Ihr…Á„CH1胴$…S…Uh…DhOø ]à\(rN²…`…¨0†d‚……h¸ƒ»p†lTn…‡ÏvL8õ…uÈ%ýåð¥‡G¸^§1xØrm&›gˆ«f‹‘‡Ç²ˆñöD“ø‘Ø —G®¶†YØ?˜ ž&Eyÿƒ–¸tR&x©¨€è LšeŠVçT£&`Þ÷NºSkÉwH|•P¯È)ïf_6E…å{¶¸M^#5i´‰˜ÂÄŒœWƒÆV[è÷†u8v²V‰…³h¶XO&NxÆ‹³ˆ‚›á`…2‡~FW¸[¹ÄaÞ޽x€¶ J÷޾¸{§h ÕȆÄäUõèñHŽþ¸mVÖù KäQ)oùt éo÷˜ ˆ' ùƒEÇt©ÑCÿaŽ …õ¦{‡7Š:è‘–ÀŠ…z¥—Œ¯x’8Ô{áD:/Y’’xƒà×5W52W“‡XqŸ—“ì´“Ôד>É`´UY~J¯qEÿIJä‹Dæ”—Hƒ%å8•&Y•™•<×”øØ•H‘ð–Aƒè¨&`V–f9–"¸–×–ÝSAd£”q V,yNhµNõâ$©—D’}yl¸–E5˜rٖцgˆÙ@&³˜«‘Ó¨e„£N\–—“†sYVvÀ™é™Ù𡹇•Y‘¦ù” É•ª¹rÙ®ùš°™(²¹š¬ –¶I˜[ù‹ºIãÈŒ¾ùqÀÂù›Ä)ÆyœÈ¹8Ê $ø×›Î9ÐIhÒ¹›¤(‹Ö9œÅuÚ9›±˜Þ¹Hftâù¨ æyšuFšê¹žo™]èž'Öx2ŸbîyŸ4–Ÿ Ñ’¨Á¹Ÿì!ŸŠ j Š  ª  Ê  ê  ¡*¡J¡j¡Š¡:ƒº ýÉ¡ ¢!*¢#J¢%j¢'Š¢)ª¢+Ê¢}Q]'7ç^¨YL-j7ŠÅšŒ–o’Ù6z£q•V?§EF” gã[ ÕìÕ^ñWtå£ù¤ÔvkÑHŒeD:´{ö-ø¤ew¥‡éM\Y’‰Z··jü$NÎÔ¥ó¥ŸÅ¥bª£_zZ¦¥áWu6úI2‡ž´ècåv™ö3œVcߣº¦¨¨ôŸ‹ê¨ ©‘*©“;splint-3.1.2.dfsg1/doc/html/faq.html0000644000000000000000000005432511051265522015705 0ustar rootroot Splint FAQ
Splint - Secure Programming Lint
info@splint.org
Download - Documentation - Manual - Links Reporting Bugs - Mailing Lists      Sponsors - Credits

Splint - Frequently Asked Questions

Index

    General Questions About Splint

  1. What is the difference between Splint and LCLint?
  2. What is the Splint logo?
  3. How is Splint pronounced?
  4. Can I include Splint in my software distribution?
  5. Can we use your software in our company? (We are not a GNU organization.)
  6. Which compilers does Splint support?
  7. Does Splint handle C++?
  8. Installation

  9. I downloaded the Splint .tgz file but can't figure out how to extract it. There is no 'z' option on the tar on my system.
  10. I want to use Splint in Windows. How do I do that?
  11. I have installed Splint for Windows 2000. Where should I put the ".splintrc" file?
  12. When I build Splint I get the following errors.... Should I be worried?
  13. I just installed Splint on a new machine. I get a bunch of errors during building when the test suite is run. When I look through the results, it seems like Splint is not reporting any errors in the code it analyzes. What is going on?
  14. Usage

  15. Why am I getting parse errors in system header files?
  16. Is every Splint warning a real error?
  17. How does Splint handle const?
  18. I develop code on an embedded system with a compiler that uses nonstandard key words and data types. I would like to run Splint on my code but these nonstandard keywords cause parse errors. What should I do?
  19. How can I get Splint to recognize directory trees and local source include directories?
  20. I use realloc in my code. How can I get Splint in check this code more effectively?
  21. Warnings and Errors

  22. Why do I get a warning when multiplying different integer types? The C standard says this is ok. Why is this wrong?
  23. Why does splint complain if I ignore the return value of scanf but not printf?
  24. I get parse errors when I try to run Splint on code like #define MACROdebug(...) blahblah . Can I use variadic macros in Splint?
  25. Bugs

  26. I think I've found a bug in Splint. What should I do?
  27. Splint tells me that there is a bug and I should report it. What information should I send?
  28. Additional Information

  29. My question isn't answered here. How can I get more information about Splint?

Questions and Answers

    General Questions About Splint

  1. What is the difference between Splint and LCLint?

    Before 2002, Splint was known as LCLint. LCLint Version 3.0 was renamed Splint Verion 3.0.

    LCLint was originally named for LCL, the Larch C Interface Language and lint, a well-known C program checking tool. Because our tool has diverged from LCL, and our focus now is on secure programming, it was renamed Splint.

  2. What is the Splint logo?

    Thomas Jefferson's Serpentine Walls at the University of Virginia. The walls are one brick thick, but because of their design are both strong and aesthetic. Like a secure program, secure walls depend on sturdy bricks, solid construction, and elegant and principled design.
  3. How is Splint pronounced?

    "Splint" can be pronounced as one word, like the first aid device used to fix broken bones. It is also acceptable (but harder) to pronounce it as "S" "P" "lint".
  4. Can I include Splint in my software distribution?

    Yes. Splint is licensed under the GNU General Public License. You may redistribute it as you wish so long as credits and pointers to www.splint.org are not changed or removed. Splint may be included in commercial distributions, and is included in several Linux and freeware CDs. If you want to redistribute Splint, please let us know by sending a message to splint@cs.virginia.edu.

  5. Can we use your software in our company? (We are not a GNU organization.)

    Yes, Splint is GPL-licensed. Anyone may use it. If you want to redistribute it, check the license for details or contact us.

  6. Which compilers does Splint support?

    Splint is independent from your compiler. It checks standard C code, according to the ISO C99 specification. Splint supports most, but not all, of the C99 extensions to the ANSI C. Splint supports some of the gcc compiler extensions (if +gnuextensions is used).

  7. Does Splint handle C++?

    No, Splint does not check C++ code. We don't have the resources (or the research justification) to build a C++ front end, but if you are interested in building a C++ front end the source code is available, and I will certainly be willing to help.

  8. Installation

  9. I downloaded the Splint .tgz file but can't figure out how to extract it. There is no 'z' option on the tar on my system.

    Check to see if there is GNU tar on your system, it is usually invoked by the command gtar or gnutar. GNU tar supports the -z option.

    You can also unzip the file then untar it. Do: gunzip filename.tar.gz to unzip then tar -xvf filename.tar.

    A single command to do this is: gzip -d < filename.tar.gz | tar -xvf -. [Contributed by Derric Tubbs]

  10. I want to use Splint in Windows. How do I do that?

    See http://splint.org/win32.html for instructions on obtaining and installing Splint on Windows. We do not actively support Windows or do any Windows development.

  11. I have installed Splint for Windows 2000. Where should I put the .splintrc file?

    For Win32, Splint looks for splint.rc instead of .splintrc due to the DOS filename limitations. It will look first in the current directory, then in your home directory.
  12. When I build Splint I get the following error:

              Checking manual...
              cmx > / Checking tests2.2...
              Checking tests2.4...
              Checking tests2.5...
              Checking db1...
              0a1,2
              < /cmx/tools/make -e clean
              > /cmx/tools/make -e check
              *** FAIL ***
              Checking db2...
              0a1,2
              < /tools/make -e clean
              > /cmx/tools/make -e check
              *** FAIL ***
              Checking db3...
    

    Should I be worried?

    Those differences look harmless. It is likely that your make is set up slightly differently than ours.
  13. I just installed Splint on a new machine. I get a bunch of errors during building when the test suite is run. When I look through the results, it seems like Splint is not reporting any errors in the code it analyzes. What is going on?

    One possibility is that the installation directory where the test suite is running is on the system path (hence, splint won't report errors if -sysdirerrors is set, as it is by default). Try adding +sysdirerrors to the command line for the test suite to see if that is the problem, or installing Splint in a different directory not in the system path.



  14. Usage

  15. Why am I getting parse errors in system header files?

    Parse errors usually occur in code written for compilers that use nonstandard keywords or type names. (See the question on providing definitions of these names.)

    If you're getting parse errors make sure that the required libraries are included by using the +posixlib or +unixlib flags. If you're using nonstandard gnu extensions the +gnuextensions flag make be helpful.

    However, Splint doesn't yet support all C99 extensions so there are some legitimate C programs that will need to be modified.



  16. Is every Splint warning a real error?

    No. Many of the program properties that Splint checks are undecidable. This means that any static analysis tool that can be run on real programs will either produce false positives or false negatives. Because of this and to improve efficiency, Splint makes some simplifying assumptions. This means that Splint will occasionally produce spurious warnings or miss real errors.

    However, often spurious errors can be fixed by adding additional annotations.

  17. How does Splint handle const?

    Splint doesn't interpret const (at all). See the manual section on modifies checking (http://www.splint.org/manual/html/sec7.html).



  18. I develop code on an embedded system with a compiler that uses nonstandard key words and data types. I would like to run Splint on my code but these nonstandard keywords cause parse errors. What should I do?

    You can often use -D to solve this problem.

    If you just want to ignore a keyword, you can add -Dnonstandardkeyword= to make the preprocessor eliminate the keyword, where nonstandardkeyword is the name of the keyword. Similarly, you can use -Dspecialtype=int to make a custom type parse as an int.

  19. How can I get Splint to recognize directory trees and local source include directories? I've tried putting them in my path but it doesn't seem to look beyond the current directory.

    You can use -I to set the include path like you would with a compiler.



  20. I use realloc in my code. How can I get Splint in check this code more effectively?

    The semantics of realloc cannot be describe precisely with Splint's annotations since its memory behavior is different depending on its return value. When realloc succeeds, the pointer passed to it is no longer valid.  The returned pointer points to available storage with the specified size, and the values are copied from the leading portion of the original storage indicated by the pointer passed to the function.  When realloc returns a NULL pointer, and more than zero bytes were supposed to be allocated, no new storage has been allocated.  The original pointer passed in is not deallocated and its contents are still accessible.  (Under ANSI C '89 and later, malloc and realloc may return NULL if asked for zero bytes.  In this case, realloc would release the old storage.)

    If you do use realloc, we recommend that you use a wrapper around it.

  21. Warnings and Errors

  22. Why do I get a warning when multiplying different integer types? The C standard says this is ok. Why is this wrong?

    There are lots of things that the C spec allows and defines clearly, that Splint will provide warnings for. It's not a question of it being "wrong", it's a matter of it being likely to reveal a programming mistake.
  23. Why does splint complain if I ignore the return value of scanf but not printf?

    This is just a strategic decision --- we view ignoring the result of a scanf to be more likely to reveal a problem with the code than ignoring the result of a printf, even though strict programmers will want to check the result of printf also.

    If you want stricter checking, use the flags +ansistrictlib, +posixstrictlib, +unixstrictlib to select the strict versions of these libraries.

  24. I get parse errors when I try to run Splint on code like #define MACROdebug(...) blahblah . Can I use variadic macros in Splint?

    Sorry, Splint does not yet support variadic macros. We hope to fix this in a future release.



  25. Bugs

  26. I think I've found a bug in Splint. What should I do?

    See http://www.splint.org/bugs.html for a list of known bugs and instructions on reporting bugs.



  27. Splint tells me that there is a bug and I should report it. What information should I send?

    Ideally we would like enough code to reproduce the problem. Small snippets of code which trigger the bug are the best but more code is also acceptable.

    If we're not able to reproduce the problem, then we are unlikely to be able to patch Splint. However, we would still appreciate hearing about the bug and may be able to at least to offer you advice on working around the problem.

  28. Additional Information

  29. My question isn't answered here. How can I get more information about Splint?

    The Splint manual is available at: http://www.splint.org/manual/

    The mailing list archives are at:

    http://www.splint.org/lists.html/

    If you're still unable to find the information to answer your question, you can try posting the question to the splint-discuss mailing list (see http://www.splint.org/lists.html)

    You can also email us at splint@splint.org.

Splint - Secure Programming Lint info@splint.org
Download - Documentation - Manual - Links
Source - Linux - Publications - Talks
Reporting Bugs - Mailing Lists       Sponsors - Credits
splint-3.1.2.dfsg1/doc/html/splint.css0000644000000000000000000000154007415513756016300 0ustar rootrootbody { font-family: Arial, helvetica, sans-serif } h1 { font-family: Arial, helvetica, sans-serif; color: darkblue } h2 { font-family: Arial, helvetica, sans-serif; color: darkblue } h3 { font-family: Arial, helvetica, sans-serif; color: darkblue; background: lightblue; } h4 { font-family: Arial, helvetica, sans-serif; color: darkblue; top-padding: .2em } h5 { font-family: Arial, helvetica, sans-serif; color: darkblue; top-padding: .2em } body { background: white } title { font-family: Ariel, helvetica, sans-serif; color: darkblue } A:link { color: blue } A:visited { color: darkblue } A:active { color: green } body { margin-left: 0%; margin-right: 0%; margin-top: 0%; margin-bottom: 0% } h4 { margin-left: 0%; margin-right: 0% } h3 { margin-left: 0%; margin-right: 0% } h2 { margin-left: 0%; margin-right: 0% } h1 { margin-left: 0%; margin-right: 0% } splint-3.1.2.dfsg1/doc/Makefile.am0000644021234200000250000000056607653364750014272 0ustar fax## Note: starting comments with ## means they don't end up in Makefile AUTOMAKE_OPTIONS = 1.5 foreign #this is just a hack to get make dist to work. ## Include them in the distribution EXTRA_DIST = splint.1 freebsd.html linux.html sunos.html darwin.html manual.pdf manual.css html/manual.htm html/footer.html html/header.html html/realloc.htm man_MANS = splint.1 all:splint-3.1.2.dfsg1/doc/Makefile.in0000644021234200000250000001635310645765216014301 0ustar fax# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 # Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ sbindir = @sbindir@ libexecdir = @libexecdir@ datadir = @datadir@ sysconfdir = @sysconfdir@ sharedstatedir = @sharedstatedir@ localstatedir = @localstatedir@ libdir = @libdir@ infodir = @infodir@ mandir = @mandir@ includedir = @includedir@ oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = .. ACLOCAL = @ACLOCAL@ AUTOCONF = @AUTOCONF@ AUTOMAKE = @AUTOMAKE@ AUTOHEADER = @AUTOHEADER@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_alias = @build_alias@ build_triplet = @build@ host_alias = @host_alias@ host_triplet = @host@ target_alias = @target_alias@ target_triplet = @target@ EXEEXT = @EXEEXT@ OBJEXT = @OBJEXT@ PATH_SEPARATOR = @PATH_SEPARATOR@ AMTAR = @AMTAR@ AWK = @AWK@ BISON = @BISON@ CAT = @CAT@ CC = @CC@ CP = @CP@ CPP = @CPP@ DEPDIR = @DEPDIR@ DIFF = @DIFF@ GREP = @GREP@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LCLOBJ = @LCLOBJ@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ LN_S = @LN_S@ MV = @MV@ PACKAGE = @PACKAGE@ RM = @RM@ SED = @SED@ STRIP = @STRIP@ VERSION = @VERSION@ am__include = @am__include@ am__quote = @am__quote@ install_sh = @install_sh@ AUTOMAKE_OPTIONS = 1.5 foreign #this is just a hack to get make dist to work. EXTRA_DIST = splint.1 freebsd.html linux.html sunos.html darwin.html manual.pdf manual.css html/manual.htm html/footer.html html/header.html html/realloc.htm man_MANS = splint.1 subdir = doc mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = DIST_SOURCES = NROFF = nroff MANS = $(man_MANS) DIST_COMMON = Makefile.am Makefile.in all: all-am .SUFFIXES: $(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) uninstall-info-am: man1dir = $(mandir)/man1 install-man1: $(man1_MANS) $(man_MANS) @$(NORMAL_INSTALL) $(mkinstalldirs) $(DESTDIR)$(man1dir) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 1*) ;; \ *) ext='1' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst"; \ $(INSTALL_DATA) $$file $(DESTDIR)$(man1dir)/$$inst; \ done uninstall-man1: @$(NORMAL_UNINSTALL) @list='$(man1_MANS) $(dist_man1_MANS) $(nodist_man1_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.1*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f $(DESTDIR)$(man1dir)/$$inst"; \ rm -f $(DESTDIR)$(man1dir)/$$inst; \ done tags: TAGS TAGS: DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) top_distdir = .. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) $(mkinstalldirs) $(distdir)/html @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ if test -d $$d/$$file; then \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(MANS) installdirs: $(mkinstalldirs) $(DESTDIR)$(man1dir) install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: info: info-am info-am: install-data-am: install-man install-exec-am: install-info: install-info-am install-man: install-man1 installcheck-am: maintainer-clean: maintainer-clean-am maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic uninstall-am: uninstall-info-am uninstall-man uninstall-man: uninstall-man1 .PHONY: all all-am check check-am clean clean-generic distclean \ distclean-generic distdir dvi dvi-am info info-am install \ install-am install-data install-data-am install-exec \ install-exec-am install-info install-info-am install-man \ install-man1 install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic uninstall uninstall-am \ uninstall-info-am uninstall-man uninstall-man1 all: # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: splint-3.1.2.dfsg1/doc/splint.10000644021234200000250000002125407642103272013612 0ustar fax .\" $Id: splint.1,v 1.2 2003/03/31 18:19:38 drl7x Exp $ .TH splint 1 "A tool for statically checking C programs" .SH NAME splint \- A tool for statically checking C programs .SH SYNOPSIS .BR splint [options] .SH DESCRIPTION .BR Splint is a tool for statically checking C programs for security vulnerabilities and common programming mistakes. With minimal effort, Splint can be used as a better lint(1).If additional effort is invested adding annotations to programs, Splint can perform stronger checks than can be done by any standard lint. For full documentation, please see http://www.splint.org. This man page only covers a few of the available options. .SH OPTIONS .TP 6 .B \-help Shows help .PP .B Initialization These flags control directories and files used by Splint. They may be used from the command line or in an options file, but may not be used as control comments in the source code. Except where noted. they have the same meaning preceded by \- or +. .TP 6 .BI \-tmpdir " directory" Set directory for writing temp files. Default is /tmp/. .TP 6 .BI \-I " directory" Add directory to path searched for C include files. Note there is no space after the I, to be consistent with C preprocessor flags. .TP 6 .BI \-S " directory" Add directory to path search for .lcl specification files. .TP 6 .BI \-f " file" Load options file . If this flag is used from the command line, the default ~/.splintrc file is not loaded. This flag may be used in an options file to load in another options file. .TP 6 .B \-nof Prevents the default options files (./.splintrc and ~/.splintrc) from being loaded. (Setting -nof overrides +nof, causing the options files to be loaded normally.) .TP 6 .BI \-systemdirs " directories" Set directories for system files (default is "/usr/include"). Separate directories with colons (e.g., "/usr/include:/usr/local/lib"). Flag settings propagate to files in a system directory. If -systemdirerrors is set, no errors are reported for files in system directories. .PP .B Pre-processor These flags are used to define or undefine pre-processor constants. The -I flag is also passed to the C pre-processor. .TP 6 .BI \-D " initializer" Passed to the C pre-processor. .TP 6 .BI \-U " initializer" Passed to the C pre-processor .PP .B Libraries These flags control the creation and use of libraries. .TP 6 .BI \-dump " file" Save state in for loading. The default extension .lcd is added if has no extension. .TP 6 .BI \-load " file" Load state from (created by -dump). The default extension .lcd is added if has no extension. Only one library file may be loaded. By default, the standard library is loaded if the -load flag is not used to load a user library. If no user library is loaded, one of the following flags may be used to select a different standard library. Precede the flag by + to load the described library (or prevent a library from being loaded using nolib). See Apppendix F for information on the provided libraries. .TP 6 .B \-nolib Do not load any library. This prevents the standard library from being loaded. .TP 6 .B \-ansi-lib Use the ANSI standard library (selected by default). .TP 6 .B \-strict-lib Use strict version of the ANSI standard library. .TP 6 .B \-posix-lib Use the POSIX standard library. .TP 6 .B \-posix-strict-lib Use the strict version of the POSIX standard library. .TP 6 .B \-1-lib Use UNIX version of standard library. .TP 6 .B \-1-strict-lib Use the strict version of the UNIX standard library. .PP .B Output These flags control what additional information is printed by Splint. Setting + causes the described information to be printed; setting - prevents it. By default, all these flags are off. .TP 6 .B \-usestderr Send error messages to standard error (instead of standard out). .TP 6 .B \-showsummary Show a summary of all errors reported and suppressed. Counts of suppressed errors are not necessarily correct since turning a flag off may prevent some checking from being done to save computation, and errors that are not reported may propagate differently from when they are reported. .TP 6 .B \-showscan Show file names are they are processed. .TP 6 .B \-showalluses Show list of uses of all external identifiers sorted by number of uses. .TP 6 .B \-stats Display number of lines processed and checking time. .TP 6 .B \-timedist Display distribution of where checking time is spent. .TP 6 .B \-quiet Suppress herald and error count. (If quiet is not set, Splint prints out a herald with version information before checking begins, and a line summarizing the total number of errors reported.) .TP 6 .B \-whichlib Print out the standard library filename and creation information. .TP 6 .BI \-limit " number" At most similar errors are reported consecutively. Further errors are suppressed, and a message showing the number of suppressed messages is printed. .PP .B Expected Errors Normally, Splint will expect to report no errors. The exit status will be success (0) if no errors are reported, and failure if any errors are reported. Flags can be used to set the expected number of reported errors. Because of the provided error suppression mechanisms, these options should probably not be used for final checking real programs but may be useful in developing programs using make. .TP 6 .B \-expect Exactly code errors are expected. Splint will exit with failure exit status unless code errors are detected. .TP 6 .B \-Message Format These flags control how messages are printed. They may be set at the command line, in options files, or locally in syntactic comments. The linelen and limit flags may be preceded by + or - with the same meaning; for the other flags, + turns on the describe printing and - turns it off. The box to the left of each flag gives its default value. .TP 6 .B \-showcolumn Show column number where error is found. Default: + .TP 6 .B \-showfunc Show name of function (or macro) definition containing error. The function name is printed once before the first message detected in that function. Default: + .TP 6 .B \-showallconjs Show all possible alternate types (see Section 8.2.2). Default: - .TP 6 .B \-paren-file-format Use file(line) format in messages. .TP 6 .B \-hints Provide hints describing an error and how a message may be suppressed for the first error reported in each error class. Default: + .TP 6 .B \-forcehints Provide hints for all errors reported, even if the hint has already been displayed for the same error class. Default: - .TP 6 .BI \-linelen " number" Set length of maximum message line to characters. Splint will split messages longer than characters long into multiple lines. Default: 80 .PP .B Mode Selector Flags Mode selects flags set the mode checking flags to predefined values. They provide a quick coarse-grain way of controlling what classes of errors are reported. Specific checking flags may be set after a mode flag to override the mode settings. Mode flags may be used locally, however the mode settings will override specific command line flag settings. A warning is produced if a mode flag is used after a mode checking flag has been set. These are brief descriptions to give a general idea of what each mode does. To see the complete flag settings in each mode, use splint -help modes. A mode flag has the same effect when used with either + or -. .TP 6 .B \-weak Weak checking, intended for typical unannotated C code. No modifies checking, macro checking, rep exposure, or clean interface checking is done. Return values of type int may be ignored. The types bool, int, char and user-defined enum types are all equivalent. Old style declarations are unreported. .TP 6 .B \-standard The default mode. All checking done by weak, plus modifies checking, global alias checking, use all parameters, using released storage, ignored return values or any type, macro checking, unreachable code, infinite loops, and fall-through cases. The types bool, int and char are distinct. Old style declarations are reported. .TP 6 .B \-checks Moderately strict checking. All checking done by standard, plus must modification checking, rep exposure, return alias, memory management and complete interfaces. .TP 6 .B \-strict Absurdly strict checking. All checking done by checks, plus modifications and global variables used in unspecified functions, strict standard library, and strict typing of C operators. A special reward will be presented to the first person to produce a real program that produces no errors with strict checking. .SH AUTHOR If you need to get in contact with the authors send email to .UR mailto:info@splint.org .UE or visit .UR http://www.splint.org .UE .SH "SEE ALSO" lint(1) splint-3.1.2.dfsg1/doc/freebsd.html0000755021234200000250000000410307653327255014527 0ustar fax Splint FreeBSD Installation

FreeBSD Installation

Instructions for installing Splint using the FreeBSD binary installation:

  1. Download http://www.splint.org/downloads/binaries/splint-3.1.1.FreeBSD.tgz

  2. tar -xzf splint-3.1.1.FreeBSD.tgz
    This will create a splint-3.1.1 directory, containing several subdirectories. The file splint-3.1.1/bin/splint is the Splint binary.

To install Splint binaries and libraries in a different directory (optional):
  1. ./configure --prefix=directory
  2. make install
    GNU's make utility is required; it may be named gmake or gnumake on your system.
  3. Set environment variables:
    LARCH_PATH - path to search for splint libraries and initializations files. If you are using the standard directories, this should be ".:base-directory/splint-3.1.1/lib".

    LCLIMPORTDIR - directory containing lcl imports files. If you are using the standard directories, this is base-directory/splint-3.1.1/imports.

    If you followed step 4 above set LARCH_PATH to directory/share/splint/lib and LCLIMPORTDIR to directory/share/splint/import instead.

    Put the commands to set these variables (the actual commands will depend on the shell you are using) in one of your initialization dotfiles (usually ~/.environment).

    Set up your command path to include the directory containing splint-3.1.1/bin/splint, or move the binary to a directory in your command path.

splint-3.1.2.dfsg1/doc/linux.html0000755021234200000250000000407007653327255014257 0ustar fax Splint Linux Installation

Linux Installation

Instructions for installing Splint using the linux binary installation:

  1. Download http://www.splint.org/downloads/binaries/splint-3.1.1.Linux.tgz

  2. tar -xzf splint-3.1.1.Linux.tgz
    This will create a splint-3.1.1 directory, containing several subdirectories. The file splint-3.1.1/bin/splint is the Splint binary.

To install Splint binaries and libraries in a different directory (optional):
  1. ./configure --prefix=directory
  2. make install
    GNU's make utility is required; it may be named gmake or gnumake on your system.
  3. Set environment variables:
    LARCH_PATH - path to search for splint libraries and initializations files. If you are using the standard directories, this should be ".:base-directory/splint-3.1.1/lib".

    LCLIMPORTDIR - directory containing lcl imports files. If you are using the standard directories, this is base-directory/splint-3.1.1/imports.

    If you followed step 4 above set LARCH_PATH to directory/share/splint/lib and LCLIMPORTDIR to directory/share/splint/import instead.

    Put the commands to set these variables (the actual commands will depend on the shell you are using) in one of your initialization dotfiles (usually ~/.environment).

    Set up your command path to include the directory containing splint-3.1.1/bin/splint, or move the binary to a directory in your command path.

splint-3.1.2.dfsg1/doc/sunos.html0000755021234200000250000000407607653327255014275 0ustar fax Splint Solaris Installation

Solaris Installation

Instructions for installing Splint using the Solaris binary installation:

  1. Download http://www.splint.org/downloads/binaries/splint-3.1.1.SunOS.tgz

  2. tar -xzf splint-3.1.1.SunOS.tgz
    This will create a splint-3.1.1 directory, containing several subdirectories. The file splint-3.1.1/bin/splint is the Splint binary.

To install Splint binaries and libraries in a different directory (optional):
  1. ./configure --prefix=directory
  2. make install
    GNU's make utility is required; it may be named gmake or gnumake on your system.
  3. Set environment variables:
    LARCH_PATH - path to search for splint libraries and initializations files. If you are using the standard directories, this should be ".:base-directory/splint-3.1.1/lib".

    LCLIMPORTDIR - directory containing lcl imports files. If you are using the standard directories, this is base-directory/splint-3.1.1/imports.

    If you followed step 4 above set LARCH_PATH to directory/share/splint/lib and LCLIMPORTDIR to directory/share/splint/import instead.

    Put the commands to set these variables (the actual commands will depend on the shell you are using) in one of your initialization dotfiles (usually ~/.environment).

    Set up your command path to include the directory containing splint-3.1.1/bin/splint, or move the binary to a directory in your command path.

splint-3.1.2.dfsg1/doc/darwin.html0000755021234200000250000000407507653334371014406 0ustar fax Splint Mac OSX Installation

Solaris Installation

Instructions for installing Splint using the OSX binary installation:

  1. Download http://www.splint.org/downloads/binaries/splint-3.1.1.darwin.tgz

  2. tar -xzf splint-3.1.1.darwin.tgz
    This will create a splint-3.1.1 directory, containing several subdirectories. The file splint-3.1.1/bin/splint is the Splint binary.

To install Splint binaries and libraries in a different directory (optional):
  1. ./configure --prefix=directory
  2. make install
    GNU's make utility is required; it may be named gmake or gnumake on your system.
  3. Set environment variables:
    LARCH_PATH - path to search for splint libraries and initializations files. If you are using the standard directories, this should be ".:base-directory/splint-3.1.1/lib".

    LCLIMPORTDIR - directory containing lcl imports files. If you are using the standard directories, this is base-directory/splint-3.1.1/imports.

    If you followed step 4 above set LARCH_PATH to directory/share/splint/lib and LCLIMPORTDIR to directory/share/splint/import instead.

    Put the commands to set these variables (the actual commands will depend on the shell you are using) in one of your initialization dotfiles (usually ~/.environment).

    Set up your command path to include the directory containing splint-3.1.1/bin/splint, or move the binary to a directory in your command path.

splint-3.1.2.dfsg1/doc/changes.html0000644000000000000000000006075611051265524015611 0ustar rootroot Splint - Related Links
Splint - Secure Programming Lint
info@splint.org
Download - Documentation - Manual - Links Reporting Bugs - Mailing Lists      Sponsors - Credits

Splint Change Log

This page documents changes to Splint. See CVS repository (http://sourceforge.net/projects/lclint/) for details.

3.1.2 Release (12 July 2007)

Bug Fixes

Declarations of intptr_t and uintptr_t
The standard library declares the intptr_t and uintptr_t types incorrectly. They are declared as int * and unsigned int *, but should be integral types (large enough to hold a pointer) instead.

(Reported by David Sanderson, 25 Sep 2004. Fixed in development standard.h.)

Mode help
Splint crashes when run with -help weak or another mode flag.

(Reported by Clive Bach, 27 July 2004. Fixed in CVS 28 July 2004.)

Missing va_copy
The standard library is missing va_copy.

(Reported by Roland Illig, 21 May 2004. Fixed in CVS, 21 May 2004.)

Shifting in pre-processor expressions
Splint will report an internal error for a preprocessor expression that shifts a negative value. This should produce a warning message instead.

(Reported by Dirk Herrmann, 10 Nov 2003. Fixed in CVS, 18 May 2004, but no warning message added yet.)

gmtime and localtime
The return type is incorrectly specified as /*@null@*/ in the standard library. gmtime and localtime are guaranteed to return non-null values.

(Reported by Terry Colligan, 30 Oct 2003. Fixed in CVS, 2 Nov 2003.)

Redefining __func__
Splint will report an internal bug if built in special definitions like __func__ are redefined.

(Reported by Terry Colligan, 28 Oct 2003. Fixed in CVS, 28 Oct 2003.)

Pragma Line Numbers
Splint does not count
#pragma ...
lines in the line number.

(Reported by Scott Frazer, 27 Oct 2003. Fixed in CVS, 27 Oct 2003.)

Files Unclosed in Win32
Options that involve writing messages to files do not work in Win32. The check that all files are closed was somehow copied to a location it shouldn't be (llmain:830).

(Fixed in CVS 18 Sept 2003.)

Multi-dimensional Arrays
Splint does not interpret declarations of multidimensional arrays correctly. A declaration like int a[][10] is misinterpreted as int a[10][].

(Reported by Bill Leahy, 15 Sept 2003. Fixed in CVS 15 Sept 2003.)

&& and || guards
Splint does not correctly interpret guards for non-boolean expressions in && and || clauses (e.g., if (s && t)).

(Reported by Andrew Bishop. Fixed in CVS 13 August 2003.)

scanf %x
Splint interprets %x in a scanf format string as an int *, but it should be an unsigned int *.

(Reported by Andrew Bishop. Fixed in CVS 13 August 2003.)

+matchanyintegral and unsignedintegrals
When +matchanyintegral is set, splint should allow any int type to match an aribtrary unsigned integral.

(Reported by John Makecki. Fixed in CVS 18 July 2003.)

Shadow updates
When a variable declaration is shadowed, the sRef_updateSref function will find the inner reference when there is an alias to the outer reference.

(Reported by John Makecki. Fixed in CVS 18 July 2003.)

Internal assertion fails for unconventional bounds
An internal assertion will fail for strange array indexes like, i["]<i;++i){--i;}"].

(Reported by Xose Vazquez Perez. Fixed in CVS 12 July 2003.)

Assignments with global structs
Splint does not correctly update state when the rhs of an assignment is a struct with global scope.

(Reported by Steve Brooke. Fixed in CVS, 10 July 2003.)

Defining __STDC__
Splint should define __STDC__. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=171437&msg=7 for details.

(Reported by Vincent Lefevre. Fixed in CVS, 10 July 2003)

Missing signal.h definitions
The posix library is missing some definitions from signal.h.

(Reported by Jerry James. Fixed in CVS, 13 June 2003)

Pre-processing ISO8859-1 characters
Splint does not process ISO8859-1 characters correctly since it is building on a pre-ISO8859-1 version of gcc's pre-processor, and character \377 is indistinguishable from EOF.

(Reported by Kai Hofmann. Fixed in CVS, 6 June 2003)

Printing lltok
Splint prints -> tokens in specifications incorrectly as ".". Reported and fixed by Psanzani.

(Fixed in CVS, 6 June 2003)

3.1.0 Release (21 April 2003)

Enhancements

Added support for numabstract types. A type defined with /*@numabstract@*/ is treated like an abstract type, except the standard C numeric operators (++, --, +, -, <, >, etc.) can be used on it. If +numabstractlit is set, then number literals may be used as numabstract type values. If +numabstractcast is set, casting to a numabstract produces a warning. If +numabstractindex is set, numabstract types may be used to index arrays. If +numabstractprint is set, a warning is produced if a numabstract value is passed as a %d parameter in a printf format string. (Suggested by Simon Hosie)

Changed Boolean support to be more consistent with ISO C99. _Bool is the default boolean type (and bool is defined), and true and false are the default true and false values (instead of TRUE and FALSE).

Added messagestream, warningstream and errorstream control flags so each type of message can be directed to a different standard stream or output file:

     messagestreamstdout, messagestreamstderr, messagestream 
     warningstreamstdout, warningstreamstderr, warningstream 
     errorstreamstdout, errorstreamstderr, errorstream 

Added htmlfileformat flag for producing links around file locations. (Requested by Hien Phan)

Added csv flag to generate comma separated values formatted output file to enable storing and manipulating warings in a database (or Excel). (Suggested by Brian Parrott)

Added support for +longint and +shortint flags, and changed type checking accordingly.

Added flag nullinit to control warnings about initializations that may be missing null annotations.

Add the flags likelybounds, likelybounds-read, and likelybounds-write. These flags cause Splint to produce warnings for potential bounds errors that when there is a high probabity that there is a real problem.

Adding support for the -i <dir> command line include option.

Added the emptyreturn flag to control warnings about missing return values.

Added abstractcompare flag to distinguish warnings about object equality comparisons on abstract types, from uses of other operators.

Added anytype constant to support /*@alt anytype@*/ properly.

Bug Fixes

Fixed bugs causing Splint to report spurious bounds-errors for code involving certain loops.

Fixed bugs Splint to report spurious bounds-errors for certain if-else statements.

Fixed problem with multiple passes on type definitions with /*@alt@*/

Fixed build problem with Mac OS X.

Fixed problem causing crashes if multiple globals clauses are used.

Fixed bug causing Splint to incorrectly display the file name path in error messages when it was given the absolute path name of a file outside of the current directory and the subdirectories below the current directory.

Fixed bug causing Splint to report spurious bounds-errors for code in which sizeof was applied to a string literal.

Fixed bug causing an internal error if a directory was listed on the command line instead a sourcefile.

The getgrgid, getgrnam, and getpwnam functions the Posix and Unix libraries are now declared to return /*@observer@*/ references.

Added snprintf to the standard library. It was added to ISO C99, so should be in the standard library in addition to the Unix library.

Fixed bug causing Splint to misinterpret initializations of char arrays with string literals. In code like char s[] = "abc"; was incorrectly marked as observer. Requested by (Olivier L'Heureux.)

Fixed bug causing the pre-processor to lose necessary whitespace before an identifier that corresponds to the name of a parameterized macro inside a macro expansion. (Reported by Adam Clarke.)

Fixed bugs in which Splint couldnot parse offsetof expressions where the field designator is an array fetch: offsetof(some_struct_t,d[index]). (Reported by Asger Overby.

Updated the declarations of struct iovec and struct msghdr in the unix library to include the /*@dependent@*/ annotations on their pointer fields; the implicit only annotations were incorrect. (Reported by Enrico Scholz.)

Fixed bug causing Splint to report spurious redeclartion warnings for forward enum tags.

Fixed bug causing Splint to report the wrong line number after a multi-line macro instantiation (it only counts as one line). (Reported by Andreas Rasmusson.)

Changed flags.def to make the library setting flags idempotent (doesn't matter if you use - or +). This prevents spurious flag warnings.

Fixed problem with unnamed union definitions within structure definitions. (Reported by Charles Lecklider)

Fixed line and column printing in uses lists (+showalluses) to be consistent with parenfileformat. (Reported by Mat Butler)

Fixed initializations of string literals. An initialization like, char s[] = "test"; copies the literal into the array, so s may be modified. This is different from char *s = "test"; which makes s an observer. (Reported by Ralf Wildenhues)

Fixed problem with resetting null state after error for constants.

Fixed problem with loop guards in loop test effects. New test case looptesteffect. (Reported by Anders Pilegaard)

Added code to fileTable.c for relative paths on systemDir. (Suggested by Jim Zelenka.)

Fixed missing sRef_clearDerived in usymtab_exitScope. This causes dangling references to old sRef's.

Changed pre-processor so multi-line macro parameters do not mess up line numbers.

Added grammar support for compound literals. No checking is done for these yet. (Reported by Peter Anttu.)

Fixed warning message for shiftsigned flag. (Reported by Melson Beebe.)

Fixed skipisoheaders flag. skipansiheaders and skipisoheaders are both supported now. (Reported by Jeroen Ruigrok van der Werven.)

Changed declaration of BUFSIZ to be size_t. (Reported by Walter Briscoe.)

Release 3.0.1.6

Fixed bug with internal error for unrecognized file names in #line pre-processor directives. (Reported by Stefan Allius.)

Extended grammar to support ISO C99 and gcc obsolete extension for initializing structure fields and array elements using explicit designators. The ISO C99 syntax is struct evil_struct s = { .bad_integer = 1 };. An obsolete gcc extension is supported also: struct evil_struct s = { bad_integer: 1 };. The syntax is supported to allow Splint to parse code that uses this, but no checking is done for the initialzer.

Fixed type parsing to interpret parenthesized pointers correctly (e.g., int (*p)[];). (Reported by Ralf Wildenhues)

Relaxed grammar to allow null statements as external declarations. (This appears to not be allowed according to the ISO C99 grammar, but gcc and some other compilers allow it.) (Reported by Mark Baushke.)

Fixed division by zero error in constant value analysis. (Reported by Sami Farin)

Internal bug report for unnamed enum declarations inside structure declarations. (Reported by Thomas Nordin)

Internal bug report for ((a[0][1]) != 0). (Reported by Thomas Nordin)

Both of these were instances of overly cautious internal bug reporting.

Release 3.0.1.5

Enhancements

The flag +show-constraint-location is now set by default. This flags causes Splint to include the expression which caused the error in error messages for potential out of bounds errors.

The flag bounds-compact-error-messages has been added. If this flag is set, new lines are not included in the error messages for bounds errors. This flag is intended for situations in which the difference in format between bounds error messages and other type of splint error messages made parsing difficult. It may also be useful in cases where screen space is limited.

Bug Fixes

Fixed bug in which Splint would crash if there is a typedef involving a fixed size array. This problem occured if the flags bounds, boundsread, or boundswrite were set. (Reported by Jim Francis ) Fixed in CVS, 25 Jan 2002.

Fixed bug in which Splint would erroneously warn that a "string literal is assigned to a char array too small to hold it" if an array is initialized with a string containing escape sequences. (Reported by Jeff Johnson) Fixed in CVS, 22 Jan 2002.

Release 3.0.1.4

Fixed explicit array bounds parsing (reported by Randi J. Relander). C syntax puts array sizes backwards, need to reverse in ctype_makeInnerFixedArray.

Release 3.0.1

Changed name to Splint

.lclintrc changed to .splintrc

Splint will look for .splintrc and .lclintrc files. If both exist, a warning is produced (FLG_WARNRC)

Call showHerald() in llgenerrorreal so herald is displayed before command line warnings.

Fixed sRef's so definitely null references always have alias kind unknown (cannot produce an aliasing error)

Added checking for union initializers (bug reported by Jim Zelenka).

Fixed handling of unrecognized pre-processor directives (bug reported by Pierluigi Sanzani).

Fixed problems with wide character literals (L"string") (bug reported by Nelson Beebe).

Changed grammar to allow multiple /*@fallthrough@*/, /*FALLTHRU*/ and /*FALLTHROUGH*/ comments for one case. (suggested by Nelson Beebe)

Fixed bug in uentry_makeVarFunction for type defined function pointers (bug reported by Alexander Mai)

loopexec is now divided into forloopexec, whileloopexec and iterloopexec flags (all off by default).

Added obviousloopexec (on by default) flag and implemented exprNode_loopMustExec to handle for loops that "obviously" must execute. (This sould be intergrated with the buffer overflow analysis that probably does this more precisely.)

Make /*@special@*/ annotation no longer imply allocated storage. (This was pretty silly. special annotation shouldn't be necessary at all, except for documentation maybe.)

Fixed pre-functions for sets and allocates state clauses to set the state to undefined on entry.

Fixed checking for shift expressions. Replaced shiftsigned with shiftnegative (warns if the right operand of a shift may be negative) and shiftimplementation (warns if left operation of a shift may be negative).

Splint mustfree into mustfreeonly and mustfreefresh to allow more precise control over memory leak checking. mustfree is now a special flag that sets both.

Added call from grammar to check if predicate to report error in before checking body.

Replaced ansilimits with ansi89limits and iso99limits to reflect changes in translation limits between ANSI C89 and ISO C99.

Replaced +control flag with duplicatecases, alwaysexits, emptyreturn and macroreturn (all plain, default +)

Release 3.0.0.19

Build now uses autoconf. The test suite is now run automaticly each time a top level make is done. (We thank Tim Van Holder for producing the automake and autoconf distribution.)

Improved defaults for LARCH_PATH and LCLIMPORTDIR

Various fixes and improvements in the buffer overflow detection code.

Added the flag slashslashcomment which detects c++ sytle // comments which are not supported by some older compilers additional functions added to the unix library.

Release 3.0.0.18

Changed typechecking for NULL values to report warnings for mistyped comparisions involving cast NULL pointers (e.g., char *s = (int *) NULL). (Reported by Nelson Beebe.)

Fixed scanner to allow octal constants with L and UL specifiers. (Reported by Nelson Beebe.)

Fixed problem with path flow in do ... while loops. (Reported by Jim Zelenka.)

Fixed but in aliasing for += assignments. (Reported by Nelson Beebe.)

Fixed %c handling in format strings - its an int converted to unsigned char. (Reported by Nelson Beebe.)

Fixed spelling of "preceeding" ("preceding"). (Suggested by Nelson Beebe.)

Changed char_fromInt assertions to allow non-ASCII character sets. (Suggested by Anthony Giorgio)

Release 3.0.0.17

Expanded the unix library.

The unix library now includes the stdio.h and stdlib.h interfaces as defined by the Single Unix Specification, Version 2. Additionally a number of missing functions were added to the unix library.

Release 3.0.0.16

Added table of open files to deal with unclosed files on fatal exits. This is important since some platforms cannot unlink open files, and hence, temporary files will not be removed.

Fixed parsing of undeclared macros with parameter lists.

Fixed exprNode_arrayFetch so e1 and e2 are not swapped when type of e1 is ctype_unknown. (Avoid errors for a[0] where a is unknown.)

Made sRef_enterFunctionScope cleanup state if in a macro definition

Release 3.0.0.15

Fixed fileloc internal assertions for syntactic comments spanning multiple lines comtaining regular comment opens. Added warnings for likely unclosed syntactic comments (/* inside syntactic comment). (Reported by gcarter)

Incorporated Herbert Dietze's fixed to cstring_getCannonicalPrefix (and moved to osd_getCannonicalPrefix). Added test for empty directory strings in context.c. (Suggested by Herbert Dietze)

Changed include path behavior - added C_INCLUDE_PATH files to sysdirs. Some thought and investigation still needed on the right way to handle include paths and sysdirs. (Suggested by Herbert Dietze)

Remove replace_unixdir_with_windir from cpplib.c, replaced with cstring_replaceAll (Suggested by Herbert Dietze)

Removed

# ifdef WIN32
extern int yywrap (void) /*@*/ ;
# endif
from globals.h (Suggested by Herbert Dietze)

Allowed .pp files on command line when -nopp is used (warning otherwise)

Added warning in README about bison versions

Fixed spelling of "envirnoment" (Suggested by Alexander Mai)

Added sys/types.h from Standard UNIX Spec to unix.h changed ino_t from integraltype to unsignedintegraltype

Added random functions from stdlib.h Standard UNIX Spec to unix.h Added netinet/in.h from Standard UNIX Spec to unix.h

Release 3.0.0.14

Added src/DATE to distribution

Release 3.0.0.13

sRef.c:  removed assertion
      /* evans 2001-08-27 no: can change this - llassert
      (s->info->arrayfetch->arr == arr); */
      this fails for code like:
          addr = &((unsigned char *)chp) [x];
	  addr[0] = 3;
      because setArrayFetchState tries to simplify &a[0] => a[].
      (This may be a bad idea in general!)
osd.c:418
fixed OS -> OS2
# if defined(UNIX) || defined(OS2) || defined(MSDOS) || defined(WIN32)
Added support for -I- to turn on ignore source directory include path searching. Code provided by Robin Watts.

Fixed reflection of post clauses on inner fields derived through aliases. (Didn't use sRef_aliasSetCompleteParam!) (Bug reported by Mikhail Bessonov.)

Added warnuse flags: portability, unixstandard

Fixed unix.h to include isascii, toascii, _toupper and to_lower from ctype.h (Bugs reported by Alexander Mai.)

Fixed unix.h to follow Standard UNIX Specification for sys/stat.h (Bugs reported by Alexander Mai.)

Added check to report warnings for < and <= comparisons of unsigned with 0. Controled by +unsignedcompare (on in standard and higher modes). Test: unsignedcompare (Suggested by Martin Smoot.)

Release 3.0.0.12

Started change log.
Splint - Secure Programming Lint info@splint.org
Download - Documentation - Manual - Links
Source - Linux - Publications - Talks
Reporting Bugs - Mailing Lists       Sponsors - Credits
splint-3.1.2.dfsg1/doc/bugs.html0000644000000000000000000004400311051265525015125 0ustar rootroot Splint - Bugs
Splint - Secure Programming Lint
info@splint.org
Download - Documentation - Manual - Links Reporting Bugs - Mailing Lists      Sponsors - Credits

Splint Bugs

This page documents reported bugs in Splint 3.1.2

Please check this page and make sure you are using the latest release (Splint 3.1.2) before submitting a bug report. If you discover a bug that is not documented here, please report it to splint-bug@cs.virginia.edu. We prefer to receive bug reports by email, but you may also use the web form on the SourceForge project page. Include enough information and relevant files so that the bug may be reproduced. See http://www.splint.org/changes.html for a detailed change log.

Confirmed Bugs

osd.c does not support Apple

Patched osd.c to support Apple.

(Reported by Rob Cas, fixed in cvs code and build 3 distribution, 8 August 2007)

Function Pointers and memory management
Splint reports spurious errors for memory allocation concerning function pointers. Types declared as function pointers should not default to only storage.

(Reported by Brian Quinlan, 26 Oct 2004.)

Unrelease fresh owned storage not reported
Splint does not report memory leaks for freshly allocated owned storage that is not released:
#include 

typedef struct
{
  /*@owned@*/ int *pOwned;                
} TestStruct;

void testSplint(void)
{
  TestStruct myStruct;
  myStruct.pOwned = (int*)malloc(sizeof(int));
} /* No warning: should report memory leak. */

(Reported by Brian Quinlan, 26 Oct 2004.)

Multi-line comments in macros and line numbers
Splint will miscalculate line numbers after multi-line comments in macro definitions. For example,
#define FOO     /* a macro with a multiline comment
                 * gets the linecount wrong
                 */
(Reported by Kevin Broadey, 17 September 2004.)
Definitions in switches
Splint incorrectly misses undefined variables on switch paths involving default cases:
static int foo (int a)
{
  int i, j;
  switch (a) {
    case 0: /* j not set on this path */
      i = 3;
      break;
    default: /* i not set on this path */
      j = 0;
      break;
    }
  return i + j;  /* no error for j */
}
(Reported by Kevin Broadey, 17 September 2004.)
Parsing Syntactic comments
Splint will report an internal error for unbalanced syntactic comments like
void foo(/*@only*/ /*@null@*/ int*) {}

(Reported by Tim Sylvester, 28 Jan 2004.)

--mode flags
Splint will report an internal error if a mode flag is used with -- (e.g., --strict).

(Reported by Toralf Foerster, 18 Dec 2003.)

Parsing Casts
Splint cannot parse the statement (int) x += 18;.

(Reported by Scott Simon, 23 Oct 2003)

Unsigned Promotion
Splint incorrectly types arithmetic expressions involving unsigned and signed expressions (e.g., unsigned + signed is typed as unsigned).

(Reported by Cat Zimmermann, 21 August 2003. Fixed in CVS 24 August 2003.)

Correction: (1 November 2003): This is not a correct interpretation of the ISO standard. The type of unsigned + signed should be unsigned.

Initializations Order
Splint doesn't analyze variable initializations in order. For example, it will report that pointer1 is uninitialized in
 char *pointer1=(char*)malloc(strlen(line)+1), *pointer2=pointer1;

(Reported by Andrew Bishop.)

Spliced Macros
If a string literal is spliced that involves a macro constant (that is not expanded), splint will produce a parse error. e.g., "__" TARGET_CPU.
boolean names with -nolib
Splint reports an internal error if -booltrue or -boolfalse are defined with -nolib. Reported by Anders Bäck.
Unbraced Switch Statements
Splint produces an internal error for unbraced switch statements (which are permitted by ISO C99). For example,
switch(2) 
  case 1: 
  case 3: 
    return(1);
  return(0);
(Reported by Dirk Noss)

Bugs Fixed in 3.1.1

Splint does not build on OS X

Splint 3.0.1.6 does not build on OS X. This should be fixed in CVS.
We believe this was a problem with automake. We are now using a new version of automake and this seems to have fixed the problem. We have successfully compiled the CVS version on SourceForge's compile farm's Mac OS X server.

Multiple passes on type definitions with /*@alt@*/
Splint will produce a parse error if a type definition like,
typedef long /*@alt int@*/ newtype;
is processed twice (for example if it is in a header file included multiple times).

Reorted by Simon Hosie, fixed in CVS (2002-12-12).

Include flag handling
Splint now support -I <dir>, -i <dir> as well as the original -I<dir>.

Changed in CVS (2002-12-12) will be in 3.0.1.7.

Multiple globals clauses
Splint will produce a warning message, but then crash on an internal error if multiple globals clauses are used. Reported by Gayath Ratnayaka.

Fixed in CVS (2002-12-04) will be in 3.0.1.7.

Spurious bounds errors in for loops
A bug caused Splint to spuriously report bounds errors in certain for loops such as:
	int a[12];
	for (i = 0; i < 12; i++)
	  a[i] = 0;
Fixed in CVS (2002-09-05) will be in 3.0.1.7.
Spurious bounds errors in if-else statements
Constraints were not generated correctly from the if statement test for each branch of an if-else statement. This caused spurious bounds erros.
Fixed in CVS (2002-10-10) will be in 3.0.1.7. Reported by Xiaolan Zhang.
Incorrect Path Displayed
Splint incorrectly reported the file name path in error messages when it was given the absolute path name of a file outside of the current directory and the subdirectories below the current directory.
e.g. after cd /home/; splint /tmp/prog.c Splint will report tmp/prog.c instead of /tmp/prog.c
Fixed in CVS (2002-10-14) will be in 3.0.1.7.
Crashes if started with -i instead of -I
Splint crashed if it was started with the -i flags and given an invalid argument. This was problematic because -i is easily confused with -I.
Fixed in CVS (2002-10-21) will be in 3.0.1.7. Bug reported by Jesse Laird.
sizeof
Splint did not correctly handle code in which sizeof is applied to a string literal. e.g. malloc (sizeof ("abcd") ); This caused Splint to report spurious bounds errors.
Fixed in CVS (2002-11-29) will be in 3.0.1.7. Bug was reported by Xiaolan Zhang
Directories in file list
Splint produces an internal bug report when directories are listed as source files (e.g., splint .). Reportes by Ullrich von Bassewitz. Fixed in development code (2002-07-17), not yet in CVS.
emptyreturn flag
The emptyreturn flag doesn't work (it should be "emptyret" in flags.def). Reported by Adam Clarke. Fixed in CVS (2002-07-08), will be in 3.0.1.7. (This is a temporary fix; a better solution to canonicalizing flag names will be incorporated into a later release.)

getgrgid, getgrnam, getpwnam

These functions from grp.h in the Posix and Unix libraries should be declared to return /*@observer@*/ references. Reported by Enrico Scholz. Fixed in CVS (2002-07-08), will be in 3.0.1.7.
sys/resource.h
The sys/resource.h segment of the Unix library was not updated to SUSv3. The type of rlim_t, struct rlimit and struct rusage have been updated. Reported by Enrico Scholz. Fixed in CVS (2002-07-08), will be in 3.0.1.7.
Standard library missing snprintf
snprintf is in the unix library, but not the standard library. It was added to ISO C99, so should be in the standard library. Reported by Olivier L'Heureux. Fixed in CVS (2002-07-08), will be in 3.0.1.7.
Char literal initializers
Splint misinterprets initializations of char arrays with string literals (see ISO 6.7.8, Example 8):
    char s[] = "abc";
    char *p = "abc";
s is modifiable (not an observer); p is an observer. Reported by Olivier L'Heureux. Fixed in CVS (before 2002-07-05), will be in 3.0.1.7.

pre-processor macros

The pre-processor will lose necessary whitespace before an identifier that corresponds to the name of a parameterized macro inside a macro expansion. For example,
   typedef void (*ErrorProc_t)( void ); 
   typedef void (*WriteProc_t)( int, ErrorProc_t);
   #define ErrorProc_t(name) void (name) ( void )
   #define PrintProc_t(name) void (name) ( int Num, ErrorProc_t /*<- this whitespace is lost!->*/ errorProc )
   static PrintProc_t (foo1); 
Fixed in CVS (2002-07-03), will be in 3.0.1.7. Reported by Adam Clarke.

offsetof syntax

Splint cannot parse offsetof expressions where the field designator is an array fetch: offsetof(some_struct_t,d[index]). Fixed in CVS (2002-07-02), will be in 3.0.1.7. Reported by Asger Overby.
struct iovec and struct msghdr declarations
The unix.h library declares the struct iovec and struct msghdr structures without /*@dependent@*/ annotations on their pointer fields; the implicit only annotations are incorrect for these. The library declarations were changed to:
struct iovec {
  /*@dependent@*/ void *iov_base;
  size_t iov_len; /*: maxSet(iov_base) = iov_len */
};

struct msghdr {
  /*@dependent@*/ void *msg_name;		
  socklen_t msg_namelen;	/*: maxSet (msg_name) >= msg_namelen */
  /*@dependent@*/ struct iovec *msg_iov;	/* scatter/gather array */
  int msg_iovlen;		/* # elements in msg_iov */ /*: maxSet (msg_iov) >= msg_iovlen */
  /*@dependent@*/ void *msg_control;		/* ancillary data, see below */
  socklen_t msg_controllen;     /*: maxSet (msg_control) >= msg_controllen */
  int msg_flags;		/* flags on received message */
} ;
Fixed in CVS (2002-07-02), will be in 3.0.1.7. Reported by Enrico Scholz.
forward enum tags
Splint reports spurious redeclartion warnings for forward enum tags. Fixed in CVS, will be in 3.0.1.7.
Line Numbers after multi-line macro instantiations
Splint will report the wrong line number after a multi-line macro instantiation (it only counts as one line). Reported by Andreas Rasmusson. Fixed in CVS, will be in 3.0.1.7.
GCC_INCLUDE_DIR definition
GCC_INCLUDE_DIR is not defined properly by configure on systems where gcc is not found. If you build on such a system, you need to manually edit config.h to include the definition:
/* system include directory */
#define GCC_INCLUDE_DIR "/usr/include"
Fixed in CVS, will be in 3.0.1.7 release.
Array Initializers
Splint does not handle array initializations with missing values correctly, for example int a[][2] = {{1,2},{3,4},{5,6}}. (Reported by Ka-Liong Lau)
Warning message for -shiftsigned
The warning message for shiftsigned flag referse to the shiftsize flag which does not exist. It should be shiftimplementation instead. Reported by Melson Beebe. Fixed in CVS, 13 Feb 2002.
-skipisoheaders
The skipisoheaders flag does not work as documented. (It should be the same as skipansiheaders.) Reported by Jeroen Ruigrok van der Werven. Fixed in CVS, will be in 3.0.1.7.

BUFSIZ

The standard library declares BUFSIZ as int, but it should be size_t. Reported by Walter Briscoe. Fixed in CVS, will be in 3.0.1.7.

Types with fixed sized arrays

Splint may crash if there is a typedef involving a fixed size array. For example: typedef int Buf[5]; This problem will only occur if the flags bounds, boundsread, or boundswrite are set. A message like:
*** Internal Bug at ctype.c:2687: llassert failed: (ctentry_getKind (cte) == CTK_COMPLEX) || (ctentry_getKind (cte) == CTK_ARRAY) [errno: 25]
will be printed before splint crashes. (Reported by Jim Francis ) Fixed in CVS, 25 Jan 2002.

Char array initialized with strings containing escape sequences

Splint may erroneously warn that a "string literal is assigned to a char array too small to hold it" if an array is initialized with a string containing escape sequences. (Reported by Jeff Johnson) Fixed in CVS, 22 Jan 2002.

Double Compilations

On some platforms, if -j is used to do a parallel make, Splint will compile some files more than once. We're not sure why this happens, but recommend not using the -j option to make.

(Reported by Matthias Andree, 14 Jan 2002.)

Splint - Secure Programming Lint info@splint.org
Download - Documentation - Manual - Links
Source - Linux - Publications - Talks
Reporting Bugs - Mailing Lists       Sponsors - Credits