#include <signal.h>#include "lclintMacros.nf"#include "llbasic.h"#include "osd.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 "version.h"#include "herald.h"#include "fileIdList.h"#include "lcllib.h"#include "cgrammar.h"#include "llmain.h"#include "portab.h"#include "cpp.h"#include <time.h>Go to the source code of this file.
Functions | |
| void | showHerald (void) |
| int | main (int argc, char *argv[]) |
| void | llexit (int status) |
|
|
Definition at line 2007 of file llmain.c. Referenced by cppProcess(), importCTrait(), lclfatalbug(), lclfatalerror(), lclplainfatalerror(), llbugaux(), llfatalbug(), llfatalerror(), llfatalerrorLoc(), and main(). 02008 {
02009 DPRINTF (("llexit: %d", status));
02010
02011 # ifdef WIN32
02012 if (status == LLFAILURE)
02013 {
02014 _fcloseall ();
02015 }
02016 # endif
02017
02018 cleanupFiles ();
02019
02020 if (status != LLFAILURE)
02021 {
02022 context_destroyMod ();
02023 exprNode_destroyMod ();
02024
02025 sRef_destroyMod ();
02026 uentry_destroyMod ();
02027 typeIdSet_destroyMod ();
02028
02029 # ifdef USEDMALLOC
02030 dmalloc_shutdown ();
02031 # endif
02032 }
02033
02034 exit ((status == LLSUCCESS) ? EXIT_SUCCESS : EXIT_FAILURE);
02035 }
|
|
|
Definition at line 536 of file llmain.c. 00559 {
00560 bool first_time = TRUE;
00561 bool showhelp = FALSE;
00562 bool allhelp = TRUE;
00563 bool expsuccess;
00564 tsource *sourceFile = (tsource *) 0;
00565
00566 fileIdList dercfiles;
00567 cstringSList fl = cstringSList_undefined;
00568 cstringSList passThroughArgs = cstringSList_undefined;
00569 fileIdList cfiles;
00570 fileIdList lclfiles;
00571 clock_t before, lcltime, libtime, pptime, cptime, rstime;
00572 int i = 0;
00573
00574 g_msgstream = stdout;
00575
00576 (void) signal (SIGINT, interrupt);
00577 (void) signal (SIGSEGV, interrupt);
00578
00579 cfiles = fileIdList_create ();
00580 lclfiles = fileIdList_create ();
00581
00582 flags_initMod ();
00583 typeIdSet_initMod ();
00584 cppReader_initMod ();
00585
00586 setCodePoint ();
00587
00588 g_currentloc = fileloc_createBuiltin ();
00589
00590 before = clock ();
00591 context_initMod ();
00592 context_setInCommandLine ();
00593
00594 if (argc <= 1)
00595 {
00596 showHelp ();
00597 llexit (LLGIVEUP);
00598 }
00599
00600 setCodePoint ();
00601 yydebug = 0;
00602
00603 /*
00604 ** Add include directories from environment.
00605 */
00606
00607 {
00608 char *incval = mstring_copy (osd_getEnvironmentVariable (INCLUDE_VAR));
00609
00610 if (incval != NULL)
00611 {
00612 /*
00613 ** Each directory on the include path is a system include directory.
00614 */
00615
00616 DPRINTF (("include: %s", incval));
00617 context_setString (FLG_SYSTEMDIRS, cstring_fromCharsNew (incval));
00618
00619 while (incval != NULL)
00620 {
00621 char *nextsep = strchr (incval, SEPCHAR);
00622
00623 if (nextsep != NULL)
00624 {
00625 cstring dir;
00626 *nextsep = '\0';
00627 dir = cstring_fromCharsNew (incval);
00628
00629 if (cstring_length (dir) == 0
00630 || !isalpha ((int) cstring_firstChar (dir)))
00631 {
00632 /*
00633 ** win32 environment values can have special values,
00634 ** ignore them
00635 */
00636 }
00637 else
00638 {
00639 DPRINTF (("Add include: %s", dir));
00640 cppAddIncludeDir (dir);
00641 }
00642
00643 *nextsep = SEPCHAR;
00644 incval = nextsep + 1;
00645 cstring_free (dir);
00646 }
00647 else
00648 {
00649 break;
00650 }
00651 }
00652 }
00653 }
00654
00655 /*
00656 ** check RCFILE for default flags
00657 */
00658
00659 {
00660 cstring home = cstring_fromChars (osd_getHomeDir ());
00661 char *fname = NULL;
00662 FILE *rcfile;
00663 bool defaultf = TRUE;
00664 bool nof = FALSE;
00665
00666 for (i = 1; i < argc; i++)
00667 {
00668 char *thisarg;
00669 thisarg = argv[i];
00670
00671 if (*thisarg == '-' || *thisarg == '+')
00672 {
00673 thisarg++;
00674
00675 if (mstring_equal (thisarg, "nof"))
00676 {
00677 nof = TRUE;
00678 }
00679 else if (mstring_equal (thisarg, "f"))
00680 {
00681 if (++i < argc)
00682 {
00683 defaultf = FALSE;
00684 fname = argv[i];
00685 rcfile = fopen (fname, "r");
00686
00687 if (rcfile != NULL)
00688 {
00689 fileloc oloc = g_currentloc;
00690
00691 g_currentloc = fileloc_createRc (cstring_fromChars (fname));
00692 loadrc (rcfile, &passThroughArgs);
00693 fileloc_reallyFree (g_currentloc);
00694 g_currentloc = oloc;
00695 }
00696 else
00697 {
00698 showHerald ();
00699 lldiagmsg (message ("Options file not found: %s",
00700 cstring_fromChars (fname)));
00701 }
00702 }
00703 else
00704 llfatalerror
00705 (cstring_makeLiteral ("Flag f to select options file "
00706 "requires an argument"));
00707 }
00708 else
00709 {
00710 ; /* wait to process later */
00711 }
00712 }
00713 }
00714
00715 if (fname == NULL)
00716 {
00717 if (!cstring_isEmpty (home)) {
00718 fname = cstring_toCharsSafe (message ("%s%h%s", home, CONNECTCHAR,
00719 cstring_fromChars (RCFILE)));
00720 mstring_markFree (fname);
00721 }
00722 }
00723
00724 setCodePoint ();
00725
00726 if (!nof && defaultf)
00727 {
00728 if (!mstring_isEmpty (fname)) {
00729 rcfile = fopen (fname, "r");
00730
00731 if (rcfile != NULL)
00732 {
00733 fileloc oloc = g_currentloc;
00734
00735 g_currentloc = fileloc_createRc (cstring_fromChars (fname));
00736 loadrc (rcfile, &passThroughArgs);
00737 fileloc_reallyFree (g_currentloc);
00738 g_currentloc = oloc;
00739 }
00740 }
00741
00742 # if defined(MSDOS) || defined(OS2)
00743 fname = cstring_toCharsSafe (message ("%s",
00744 cstring_fromChars (RCFILE)));
00745 # else
00746 fname = cstring_toCharsSafe (message ("./%s",
00747 cstring_fromChars (RCFILE)));
00748 # endif
00749
00750 rcfile = fopen (fname, "r");
00751
00752 if (rcfile != NULL)
00753 {
00754 fileloc oloc = g_currentloc;
00755
00756 g_currentloc = fileloc_createRc (cstring_fromChars (fname));
00757 loadrc (rcfile, &passThroughArgs);
00758 fileloc_reallyFree (g_currentloc);
00759 g_currentloc = oloc;
00760 }
00761
00762 sfree (fname);
00763 }
00764 }
00765
00766 setCodePoint ();
00767
00768 for (i = 1; i < argc; i++)
00769 {
00770 char *thisarg;
00771 flagcode opt;
00772
00773 thisarg = argv[i];
00774
00775 if (showhelp)
00776 {
00777 if (allhelp)
00778 {
00779 showHerald ();
00780 }
00781
00782 allhelp = FALSE;
00783
00784 if (*thisarg == '-' || *thisarg == '+')
00785 {
00786 thisarg++; /* skip '-' */
00787 }
00788 if (mstring_equal (thisarg, "modes"))
00789 {
00790 llmsg (describeModes ());
00791 }
00792 else if (mstring_equal (thisarg, "vars")
00793 || mstring_equal (thisarg, "env"))
00794 {
00795 describeVars ();
00796 }
00797 else if (mstring_equal (thisarg, "annotations"))
00798 {
00799 printAnnotations ();
00800 }
00801 else if (mstring_equal (thisarg, "parseerrors"))
00802 {
00803 printParseErrors ();
00804 }
00805 else if (mstring_equal (thisarg, "comments"))
00806 {
00807 printComments ();
00808 }
00809 else if (mstring_equal (thisarg, "prefixcodes"))
00810 {
00811 describePrefixCodes ();
00812 }
00813 else if (mstring_equal (thisarg, "references")
00814 || mstring_equal (thisarg, "refs"))
00815 {
00816 printReferences ();
00817 }
00818 else if (mstring_equal (thisarg, "mail"))
00819 {
00820 printMail ();
00821 }
00822 else if (mstring_equal (thisarg, "maintainer")
00823 || mstring_equal (thisarg, "version"))
00824 {
00825 printMaintainer ();
00826 }
00827 else if (mstring_equal (thisarg, "flags"))
00828 {
00829 if (i + 1 < argc)
00830 {
00831 char *next = argv[i + 1];
00832
00833 if (specialFlagsHelp (next))
00834 {
00835 i++;
00836 }
00837 else
00838 {
00839 flagkind k = identifyCategory (cstring_fromChars (next));
00840
00841 if (k != FK_NONE)
00842 {
00843 printCategory (k);
00844 i++;
00845 }
00846 }
00847 }
00848 else
00849 {
00850 printFlags ();
00851 }
00852 }
00853 else
00854 {
00855 cstring s = describeFlag (cstring_fromChars (thisarg));
00856
00857 if (cstring_isDefined (s))
00858 {
00859 llmsg (s);
00860 }
00861 }
00862 }
00863 else
00864 {
00865 if (*thisarg == '-' || *thisarg == '+')
00866 {
00867 bool set = (*thisarg == '+');
00868 cstring flagname;
00869
00870 thisarg++; /* skip '-' */
00871 flagname = cstring_fromChars (thisarg);
00872
00873 opt = identifyFlag (flagname);
00874
00875 if (flagcode_isSkip (opt))
00876 {
00877 ;
00878 }
00879 else if (flagcode_isInvalid (opt))
00880 {
00881 if (isMode (flagname))
00882 {
00883 context_setMode (flagname);
00884 }
00885 else
00886 {
00887 llgloberror (message ("Unrecognized option: %s",
00888 cstring_fromChars (thisarg)));
00889 }
00890 }
00891 else
00892 {
00893 context_userSetFlag (opt, set);
00894
00895 if (flagcode_hasArgument (opt))
00896 {
00897 if (opt == FLG_HELP)
00898 {
00899 showhelp = TRUE;
00900 }
00901 else if (flagcode_isPassThrough (opt)) /* -D or -U */
00902 {
00903 passThroughArgs = cstringSList_add
00904 (passThroughArgs, cstring_fromChars (thisarg));
00905 }
00906 else if (flagcode_hasValue (opt))
00907 {
00908 if (++i < argc)
00909 {
00910 setValueFlag (opt, cstring_fromChars (argv[i]));
00911 }
00912 else
00913 {
00914 llfatalerror
00915 (message
00916 ("Flag %s must be followed by a number",
00917 flagcode_unparse (opt)));
00918 }
00919 }
00920 else if (opt == FLG_INCLUDEPATH || opt == FLG_SPECPATH)
00921 {
00922 cstring dir = cstring_suffix (cstring_fromChars (thisarg), 1); /* skip over I */
00923
00924 switch (opt)
00925 {
00926 case FLG_INCLUDEPATH:
00927 cppAddIncludeDir (dir);
00928 /*@switchbreak@*/ break;
00929 case FLG_SPECPATH:
00930 /*@-mustfree@*/
00931 g_localSpecPath = cstring_toCharsSafe
00932 (message ("%s%h%s",
00933 cstring_fromChars (g_localSpecPath),
00934 SEPCHAR,
00935 dir));
00936 /*@=mustfree@*/
00937 /*@switchbreak@*/ break;
00938 BADDEFAULT;
00939 }
00940 }
00941 else if (flagcode_hasString (opt)
00942 || opt == FLG_INIT || opt == FLG_OPTF)
00943 {
00944 if (++i < argc)
00945 {
00946 cstring arg = cstring_fromChars (argv[i]);
00947
00948 if (opt == FLG_OPTF)
00949 {
00950 ; /* -f already processed */
00951 }
00952 else if (opt == FLG_INIT)
00953 {
00954 # ifndef NOLCL
00955 initFile = tsource_create
00956 (cstring_toCharsSafe (arg),
00957 LCLINIT_SUFFIX, FALSE);
00958 # endif
00959 break;
00960 }
00961 else
00962 {
00963 setStringFlag (opt, arg);
00964 }
00965 }
00966 else
00967 {
00968 llfatalerror
00969 (message
00970 ("Flag %s must be followed by a string",
00971 flagcode_unparse (opt)));
00972 }
00973 }
00974 else
00975 {
00976 /* no argument */
00977 }
00978 }
00979 }
00980 }
00981 else /* its a filename */
00982 {
00983 fl = cstringSList_add (fl, cstring_fromChars (thisarg));
00984 }
00985 }
00986 }
00987
00988 setCodePoint ();
00989
00990 /*
00991 ** create lists of C and LCL files
00992 */
00993
00994 cstringSList_elements (fl, current)
00995 {
00996 char *fname = cstring_toCharsSafe (current);
00997 char *ext = strrchr (fname, '.');
00998
00999 if (ext == NULL)
01000 {
01001 /* no extension --- both C and LCL with default extensions */
01002
01003 addFile (cfiles, message ("%s.c", cstring_fromChars (fname)));
01004 addFile (lclfiles, message ("%s.lcl", cstring_fromChars (fname)));
01005 }
01006 else if (isCext (ext))
01007 {
01008 addFile (cfiles, cstring_fromCharsNew (fname));
01009 }
01010 else
01011 {
01012 if (!mstring_equal (ext, ".lcl"))
01013 {
01014 lldiagmsg (message ("Unrecognized file extension: %s (assuming lcl)",
01015 cstring_fromChars (ext)));
01016 }
01017
01018 addFile (lclfiles, cstring_fromCharsNew (fname));
01019 }
01020 } end_cstringSList_elements;
01021
01022
01023 showHerald ();
01024
01025
01026 if (showhelp)
01027 {
01028 if (allhelp)
01029 {
01030 showHelp ();
01031 }
01032 fprintf (g_msgstream, "\n");
01033
01034 fileIdList_free (cfiles);
01035 fileIdList_free (lclfiles);
01036
01037 llexit (LLSUCCESS);
01038 }
01039
01040 # ifdef DOANNOTS
01041 initAnnots ();
01042 # endif
01043
01044 inittime = clock ();
01045
01046 context_resetErrors ();
01047 context_clearInCommandLine ();
01048
01049 anylcl = !fileIdList_isEmpty (lclfiles);
01050
01051 if (context_doMerge ())
01052 {
01053 cstring m = context_getMerge ();
01054
01055 if (context_getFlag (FLG_SHOWSCAN))
01056 {
01057 fprintf (g_msgstream, "< loading %s ", cstring_toCharsSafe (m));
01058 }
01059
01060 loadState (m);
01061
01062 if (context_getFlag (FLG_SHOWSCAN))
01063 {
01064 fprintf (g_msgstream, " >\n");
01065 }
01066
01067 if (!usymtab_existsType (context_getBoolName ()))
01068 {
01069 usymtab_initBool ();
01070 }
01071 }
01072 else
01073 {
01074 if (!context_getFlag (FLG_NOLIB) && loadStandardState ())
01075 {
01076 ;
01077 }
01078 else
01079 {
01080 ctype_initTable ();
01081 }
01082
01083 /* setup bool type and constants */
01084 usymtab_initBool ();
01085 }
01086
01087 fileloc_free (g_currentloc);
01088 g_currentloc = fileloc_createBuiltin ();
01089
01090 libtime = clock ();
01091
01092 if (anylcl)
01093 {
01094 # ifdef NOLCL
01095 llfatalerror (cstring_makeLiteral ("This version of LCLint does not handle LCL files."));
01096 # else
01097 lslProcess (lclfiles);
01098 # endif
01099 }
01100
01101 /*
01102 ** pre-processing
01103 **
01104 ** call the pre-preprocessor and /lib/cpp to generate appropriate
01105 ** files
01106 **
01107 */
01108
01109 context_setInCommandLine ();
01110
01111 cppReader_initialize ();
01112
01113 DPRINTF (("Pass through: %s", cstringSList_unparse (passThroughArgs)));
01114
01115 cstringSList_elements (passThroughArgs, thisarg) {
01116 handlePassThroughFlag (cstring_toCharsSafe (thisarg));
01117 } end_cstringSList_elements;
01118
01119 cstringSList_free (passThroughArgs);
01120
01121 cleanupMessages ();
01122
01123 cppReader_saveDefinitions ();
01124
01125 context_clearInCommandLine ();
01126
01127 if (!context_getFlag (FLG_NOPP))
01128 {
01129 llflush ();
01130
01131 if (context_getFlag (FLG_SHOWSCAN))
01132 {
01133 fprintf (stderr, "< preprocessing");
01134 }
01135
01136 lcltime = clock ();
01137
01138 context_setPreprocessing ();
01139 dercfiles = preprocessFiles (cfiles);
01140 context_clearPreprocessing ();
01141
01142 fileIdList_free (cfiles);
01143
01144 if (context_getFlag (FLG_SHOWSCAN))
01145 {
01146 fprintf (stderr, " >\n");
01147 }
01148
01149 pptime = clock ();
01150 }
01151 else
01152 {
01153 lcltime = clock ();
01154 dercfiles = cfiles;
01155 pptime = clock ();
01156 }
01157
01158 /*
01159 ** now, check all the corresponding C files
01160 **
01161 ** (for now these are just <file>.c, but after pre-processing
01162 ** will be <tmpprefix>.<file>.c)
01163 */
01164
01165 {
01166 # ifdef WIN32
01167 int nfiles = /*@-unrecog@*/ _fcloseall (); /*@=unrecog@*/
01168
01169 if (nfiles != 0)
01170 {
01171 llbug (message ("Files unclosed: %d", nfiles));
01172 }
01173 # endif
01174 }
01175
01176 exprNode_initMod ();
01177
01178 fileIdList_elements (dercfiles, fid)
01179 {
01180 sourceFile = tsource_create (cstring_toCharsSafe (fileName (fid)),
01181 C_SUFFIX, TRUE);
01182 context_setFileId (fid);
01183
01184 /* Open source file */
01185
01186 if (sourceFile == (tsource *) 0 || (!tsource_open (sourceFile)))
01187 {
01188 /* previously, this was ignored ?! */
01189 llbug (message ("Could not open temp file: %s", fileName (fid)));
01190 }
01191 else
01192 {
01193 yyin = sourceFile->file; /*< shared <- only */
01194
01195 llassert (yyin != NULL);
01196
01197 if (context_getFlag (FLG_SHOWSCAN))
01198 {
01199 lldiagmsg (message ("< checking %s >", rootFileName (fid)));
01200 }
01201
01202 /*
01203 ** Every time, except the first time, through the loop,
01204 ** need to call yyrestart to clean up the parse buffer.
01205 */
01206
01207 if (!first_time)
01208 {
01209 (void) yyrestart (yyin);
01210 }
01211 else
01212 {
01213 first_time = FALSE;
01214 }
01215
01216 context_enterFile ();
01217 (void) yyparse ();
01218 context_exitFile ();
01219
01220 (void) tsource_close (sourceFile);
01221 }
01222
01223 } end_fileIdList_elements;
01224
01225 cptime = clock ();
01226
01227 /* process any leftover macros */
01228
01229 context_processAllMacros ();
01230
01231 /* check everything that was specified was defined */
01232
01233 /* don't check if no c files were processed ?
01234 ** is this correct behaviour?
01235 */
01236
01237 if (context_getFlag (FLG_SHOWSCAN))
01238 {
01239 lldiagmsg (cstring_makeLiteral ("< global checks >"));
01240 }
01241
01242 cleanupMessages ();
01243
01244 if (context_getLinesProcessed () > 0)
01245 {
01246 usymtab_allDefined ();
01247 }
01248
01249 if (context_maybeSet (FLG_TOPUNUSED))
01250 {
01251 uentry ue = usymtab_lookupSafe (cstring_makeLiteralTemp ("main"));
01252
01253 if (uentry_isValid (ue))
01254 {
01255 uentry_setUsed (ue, fileloc_observeBuiltin ());
01256 }
01257
01258 usymtab_allUsed ();
01259 }
01260
01261 if (context_maybeSet (FLG_EXPORTLOCAL))
01262 {
01263 usymtab_exportLocal ();
01264 }
01265
01266
01267 if (context_maybeSet (FLG_EXPORTHEADER))
01268 {
01269 usymtab_exportHeader ();
01270 }
01271
01272 if (context_getFlag (FLG_SHOWUSES))
01273 {
01274 usymtab_displayAllUses ();
01275 }
01276
01277 context_checkSuppressCounts ();
01278
01279 if (context_doDump ())
01280 {
01281 cstring dump = context_getDump ();
01282
01283 dumpState (dump);
01284 }
01285
01286 # ifdef DOANNOTS
01287 printAnnots ();
01288 # endif
01289
01290 cleanupFiles ();
01291
01292 if (context_getFlag (FLG_SHOWSUMMARY))
01293 {
01294 summarizeErrors ();
01295 }
01296
01297
01298 {
01299 bool isQuiet = context_getFlag (FLG_QUIET);
01300 cstring specErrors = cstring_undefined;
01301 # ifndef NOLCL
01302 int nspecErrors = lclNumberErrors ();
01303 # endif
01304
01305 expsuccess = TRUE;
01306
01307 if (context_neednl ())
01308 fprintf (g_msgstream, "\n");
01309
01310 # ifndef NOLCL
01311 if (nspecErrors > 0)
01312 {
01313 if (nspecErrors == context_getLCLExpect ())
01314 {
01315 specErrors =
01316 message ("%d spec error%p found, as expected\n ",
01317 nspecErrors);
01318 }
01319 else
01320 {
01321 if (context_getLCLExpect () > 0)
01322 {
01323 specErrors =
01324 message ("%d spec error%p found, expected %d\n ",
01325 nspecErrors,
01326 (int) context_getLCLExpect ());
01327 }
01328 else
01329 {
01330 specErrors = message ("%d spec error%p found\n ",
01331 nspecErrors);
01332 expsuccess = FALSE;
01333 }
01334 }
01335 }
01336 else
01337 {
01338 if (context_getLCLExpect () > 0)
01339 {
01340 specErrors = message ("No spec errors found, expected %d\n ",
01341 (int) context_getLCLExpect ());
01342 expsuccess = FALSE;
01343 }
01344 }
01345 # endif
01346
01347 if (context_anyErrors ())
01348 {
01349 if (context_numErrors () == context_getExpect ())
01350 {
01351 if (!isQuiet) {
01352 llmsg (message ("Finished LCLint checking --- "
01353 "%s%d code error%p found, as expected",
01354 specErrors, context_numErrors ()));
01355 }
01356 }
01357 else
01358 {
01359 if (context_getExpect () > 0)
01360 {
01361 if (!isQuiet) {
01362 llmsg (message
01363 ("Finished LCLint checking --- "
01364 "%s%d code error%p found, expected %d",
01365 specErrors, context_numErrors (),
01366 (int) context_getExpect ()));
01367 }
01368
01369 expsuccess = FALSE;
01370 }
01371 else
01372 {
01373
01374 if (!isQuiet) {
01375 llmsg (message ("Finished LCLint checking --- "
01376 "%s%d code error%p found",
01377 specErrors, context_numErrors ()));
01378 }
01379
01380 expsuccess = FALSE;
01381 }
01382 }
01383 }
01384 else
01385 {
01386 if (context_getExpect () > 0)
01387 {
01388 if (!isQuiet) {
01389 llmsg (message
01390 ("Finished LCLint checking --- "
01391 "%sno code errors found, expected %d",
01392 specErrors,
01393 (int) context_getExpect ()));
01394 }
01395
01396 expsuccess = FALSE;
01397 }
01398 else
01399 {
01400 if (context_getLinesProcessed () > 0)
01401 {
01402 if (!isQuiet) {
01403 llmsg (message ("Finished LCLint checking --- %sno code errors found",
01404 specErrors));
01405 }
01406 }
01407 else
01408 {
01409 if (!isQuiet) {
01410 llmsg (message ("Finished LCLint checking --- %sno code processed",
01411 specErrors));
01412 }
01413 }
01414 }
01415 }
01416
01417 cstring_free (specErrors);
01418 }
01419
01420 if (context_getFlag (FLG_STATS))
01421 {
01422 clock_t ttime = clock () - before;
01423 int specLines = context_getSpecLinesProcessed ();
01424
01425 rstime = clock ();
01426
01427 if (specLines > 0)
01428 {
01429 fprintf (g_msgstream, "%d spec, ", specLines);
01430 }
01431
01432 # ifndef CLOCKS_PER_SEC
01433 fprintf (g_msgstream, "%d source lines in %ld time steps (steps/sec unknown)\n",
01434 context_getLinesProcessed (),
01435 (long) ttime);
01436 # else
01437 fprintf (g_msgstream, "%d source lines in %.2f s.\n",
01438 context_getLinesProcessed (),
01439 (double) ttime / CLOCKS_PER_SEC);
01440 # endif
01441 }
01442 else
01443 {
01444 rstime = clock ();
01445 }
01446
01447 if (context_getFlag (FLG_TIMEDIST))
01448 {
01449 clock_t ttime = clock () - before;
01450
01451 if (ttime > 0)
01452 {
01453 char *msg = (char *) dmalloc (256 * sizeof (*msg));
01454
01455 if (anylcl)
01456 {
01457 sprintf (msg,
01458 "Time distribution (percent): initialize %.2f / lcl %.2f / "
01459 "pre-process %.2f / c check %.2f / finalize %.2f \n",
01460 (100.0 * (double) (libtime - before) / ttime),
01461 (100.0 * (double) (lcltime - libtime) / ttime),
01462 (100.0 * (double) (pptime - lcltime) / ttime),
01463 (100.0 * (double) (cptime - pptime) / ttime),
01464 (100.0 * (double) (rstime - cptime) / ttime));
01465 }
01466 else
01467 {
01468 sprintf (msg,
01469 "Time distribution (percent): initialize %.2f / "
01470 "pre-process %.2f / c check %.2f / finalize %.2f \n",
01471 (100.0 * (double) (libtime - before) / ttime),
01472 (100.0 * (double) (pptime - libtime) / ttime),
01473 (100.0 * (double) (cptime - pptime) / ttime),
01474 (100.0 * (double) (rstime - cptime) / ttime));
01475 }
01476
01477 llgenindentmsgnoloc (cstring_fromCharsO (msg));
01478 }
01479 }
01480
01481 llexit (expsuccess ? LLSUCCESS : LLFAILURE);
01482 }
|
|
|
Definition at line 501 of file llmain.c. Referenced by flagWarning(), and main(). 00502 {
00503 if (hasShownHerald || context_getFlag (FLG_QUIET)) return;
00504
00505 else
00506 {
00507 fprintf (g_msgstream, "%s\n\n", LCL_VERSION);
00508 hasShownHerald = TRUE;
00509 llflush ();
00510 }
00511 }
|
1.2.3 written by Dimitri van Heesch,
© 1997-2000