]> andersk Git - splint.git/commitdiff
Fixed -help <mode> bug.
authorevans1629 <evans1629>
Tue, 27 Jul 2004 21:27:51 +0000 (21:27 +0000)
committerevans1629 <evans1629>
Tue, 27 Jul 2004 21:27:51 +0000 (21:27 +0000)
src/Headers/flags.h
src/flags.c
src/help.c
src/nameChecks.c
test/ansireserved.expect
test/tests2.5/Makefile

index dcf4e269fc69c7eaeb2337dca9fd6f8173fa66f5..d4e0160bb419422728d9a4adb3427b8d7b4bd11e 100644 (file)
@@ -95,6 +95,7 @@ extern bool flagcode_hasArgument (flagcode p_f) /*@*/ ;
 
 extern bool flags_isModeName (cstring p_s) /*@*/ ;
 extern /*@only@*/ cstring describeModes (void) /*@modifies g_messagestream@*/ ;
+extern /*@only@*/ cstring describeMode (/*@observer@*/ cstring mode) /*@*/ ;
 extern void summarizeErrors (void) /*@modifies g_messagestream@*/ ;
 
 extern bool flagcode_isNameChecksFlag (flagcode p_f) /*@*/ ;
index bc1597faf1950d66b478f9fa2fd7837ba96636d0..c26a6c63816193ae44c70706830db9dffa947ba8 100644 (file)
@@ -705,6 +705,40 @@ printFlagManual (bool html)
   } 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)
 {
@@ -716,6 +750,11 @@ describeFlagCode (flagcode flag)
       return (cstring_makeLiteral ("<invalid>"));
     }
 
+  if (flagcode_isModeName (flag)) 
+    {
+      return (cstring_makeLiteral ("<mode flag>"));
+    }
+
   context_resetAllFlags ();
   
   f = flags[flag];
@@ -850,10 +889,7 @@ describeFlag (cstring flagname)
       if (flags_isModeName (flagname))
        {
          cstring_free (oflagname);
-
-         return
-           (message ("%s: predefined mode (see Manual for information)",
-                     flagname));
+         return describeMode (flagname);
        }
       else
        {
index 4f4deb784f9e96d4f2078577ab8dc4ccf8ccec6d..443f50c5f0158a5134ee9a68c96cf7afe6337951 100644 (file)
@@ -524,6 +524,10 @@ void help_processFlags (int argc, char **argv)
        {
          printMaintainer ();
        }
+      else if (flags_isModeName (thisarg)) 
+       {
+         llmsg (describeMode (thisarg));
+       }
       else if (mstring_equal (thisarg, "flags"))
        {
          if (i + 1 < argc)
index 20e8fa5245eb9c978dce80829dbcf04ca5472f3f..5566114803eb3ba85eeaceb0f791d6d06b157585 100644 (file)
@@ -1487,7 +1487,7 @@ checkAnsiName (uentry ue)
             message
             ("Name %s is reserved for future library extensions.  "
              "Functions that begin with \"mem\" or \"wcs\" and a "
-             "lowercase letter letter may be added to <string.h>. (ISO:7.26.11)",
+             "lowercase letter may be added to <string.h>. (ISO:7.26.11)",
              name),
             uentry_whereLast (ue));
        }
index 283e89ad626091a5e4090b39a630ac50370221bc..6154b15d327e4c4e0c6fb0279de0418e7010f617 100644 (file)
@@ -11,8 +11,8 @@ ansireserved.c:5:5: Name atan2f is reserved for future library extensions.  The
     names of all existing functions in <math.h> suffixed with 'f' or 'l' may be
     added to <math.h>. (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 letter may
-    be added to <string.h>. (ISO:7.26.11)
+    Functions that begin with "mem" or "wcs" and a lowercase letter may be
+    added to <string.h>. (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 <ctype.h>. (ISO99:7.26.2)
@@ -33,8 +33,8 @@ ansireserved.c:5:5: Name atan2f is reserved for future library extensions.  The
     names of all existing functions in <math.h> suffixed with 'f' or 'l' may be
     added to <math.h>. (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 letter may
-    be added to <string.h>. (ISO:7.26.11)
+    Functions that begin with "mem" or "wcs" and a lowercase letter may be
+    added to <string.h>. (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 <ctype.h>. (ISO99:7.26.2)
@@ -43,8 +43,8 @@ ansireserved.c:13:20: Name powl is reserved for future library extensions.  The
     names of all existing functions in <math.h> suffixed with 'f' or 'l' may be
     added to <math.h>. (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 letter may
-    be added to <string.h>. (ISO:7.26.11)
+    Functions that begin with "mem" or "wcs" and a lowercase letter may be
+    added to <string.h>. (ISO:7.26.11)
 ansireserved.c:16:20: Name wctomb is reserved for the standard library
 
 Finished checking --- 11 code warnings, as expected
@@ -67,8 +67,8 @@ ansireserved.c:5:5: Name atan2f is reserved for future library extensions.  The
     names of all existing functions in <math.h> suffixed with 'f' or 'l' may be
     added to <math.h>. (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 letter may
-    be added to <string.h>. (ISO:7.26.11)
+    Functions that begin with "mem" or "wcs" and a lowercase letter may be
+    added to <string.h>. (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 <ctype.h>. (ISO99:7.26.2)
index b2b6d1e0278f53af2dcd82f15b484abb6b19333a..cc2de359d953d1f9cda665d02e1a0e5896cac922 100644 (file)
@@ -6,41 +6,41 @@ SPLINT = splint
 all: testalt boolt uconstants badcomment hoof boolbad booltest ull baz immutable impabsmodule
 
 testalt:
-       ${SPLINT} -dump newlint.lcd testalt.c
+       -${SPLINT} -dump newlint.lcd testalt.c
 
 boolt:
-       ${SPLINT} -expect 1 +partial +booltype pan_bool_t +booltrue PAN_TRUE +boolfalse PAN_FALSE boolt.c
+       -${SPLINT} -expect 1 +partial +booltype pan_bool_t +booltrue PAN_TRUE +boolfalse PAN_FALSE boolt.c
 
 uconstants:
-       ${SPLINT} uconstants.c -expect 2
+       -${SPLINT} uconstants.c -expect 2
 
 badcomment:
-       ${SPLINT} badcomment.c -expect 3
+       -${SPLINT} badcomment.c -expect 3
 
 hoof:
-       ${SPLINT} hoof.c -expect 1
-       ${SPLINT} hoof.c +ignorequals
+       -${SPLINT} hoof.c -expect 1
+       -${SPLINT} hoof.c +ignorequals
 
 ignorecmd:
-       ${SPLINT} +ignorecommand -we
+       -${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
+       -${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
+       -${SPLINT} -weak -booltype BOOLEAN  -booltrue TRUE -boolfalse FALSE boolbad.c
 
 
 ull:
-       ${SPLINT} ull.c
+       -${SPLINT} ull.c
 
 baz:
-       ${SPLINT} baz.h bimbim.h -I.
+       -${SPLINT} baz.h bimbim.h -I.
 
 immutable:
-       ${SPLINT} immutable.c testimmutable.c -expect 2
+       -${SPLINT} immutable.c testimmutable.c -expect 2
 
 impabsmodule:
-       ${SPLINT} +impabstract impabsmodule.c -expect 2
+       -${SPLINT} +impabstract impabsmodule.c -expect 2
This page took 0.08498 seconds and 5 git commands to generate.