]> andersk Git - splint.git/blobdiff - src/cpplib.c
*** empty log message ***
[splint.git] / src / cpplib.c
index f4f84631bc9168ae5908c9859199efcad5d4d9d3..c523479663a51eb8c583e1c1f382eb1e11806a3a 100644 (file)
@@ -130,7 +130,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 # include "lclintMacros.nf"
 # include "llbasic.h"
 # include "lcllib.h"
-# include "cpp.h"
 # include "cpplib.h"
 # include "cpperror.h"
 # include "cpphash.h"
@@ -184,7 +183,7 @@ static void cpp_setLocation (cppReader *p_pfile)
 
 static enum cpp_token cpp_handleComment (cppReader *p_pfile,
                                         struct parse_marker *p_smark)
-     /*@modifies *p_pfile, *p_smark@*/;
+     /*@modifies p_pfile, p_smark@*/;
 
 static bool cpp_shouldCheckMacro (cppReader *p_pfile, char *p_p) /*@*/ ;
 
@@ -821,6 +820,29 @@ cppReader_showIncludeChain (cppReader *pfile)
     }
 }
 
+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 ("<no include path>");
+    }
+
+  return res;
+}
+
 void
 cppReader_addIncludeChain (cppReader *pfile, struct file_name_list *dir)
 {
@@ -946,7 +968,6 @@ cppOptions_init (cppOptions *opts)
   opts->for_lint = 0;
   opts->chill = 0;
   opts->pedantic_errors = 0;
-  opts->inhibit_warnings = 0;
   opts->warn_comments = 0;
   opts->warnings_are_errors = 0;
 
@@ -1531,7 +1552,7 @@ collect_expansion (cppReader *pfile, char *buf, char *limit,
 
   if (limit - p >= 2 && p[0] == '#' && p[1] == '#') {
     cppReader_errorLit (pfile,
-                 cstring_makeLiteralTemp ("`##' at start of macro definition"));
+                       cstring_makeLiteralTemp ("`##' at start of macro definition"));
     p += 2;
   }
 
@@ -6467,7 +6488,7 @@ parseMoveMark (struct parse_marker *pmark, cppReader *pfile)
 void cppReader_initializeReader (cppReader *pfile) /* Must be done after library is loaded. */
 {
   struct cppOptions *opts = CPPOPTIONS (pfile);
-  char *xp;
+  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
@@ -6482,11 +6503,11 @@ void cppReader_initializeReader (cppReader *pfile) /* Must be done after library
      but that seems pointless: it comes before them, so it overrides them
      anyway.  */
 
-  xp = (char *) getenv ("CPATH");
+  xp = osd_getEnvironmentVariable (INCLUDEPATH_VAR);
 
-  if (xp != 0 && ! opts->no_standard_includes)
+  if (cstring_isDefined (xp) && !opts->no_standard_includes)
     {
-      path_include (pfile, xp);
+      path_include (pfile, cstring_toCharsSafe (xp));
     }
 
   /* Now that dollars_in_ident is known, initialize is_idchar.  */
@@ -7453,13 +7474,9 @@ cpp_handleComment (cppReader *pfile, struct parse_marker *smark)
                if (start[i] == '/'
                    && i < len - 1
                    && start[i + 1] == '*') {
-                 /*@i32 make vgenopterror work in cpp... @*/
-                 if (context_getFlag (FLG_NESTCOMMENT)) 
-                   {
-                     cppReader_warning 
-                       (pfile,
-                        message ("Comment starts inside comment"));
-                   }
+                 (void) cppoptgenerror (FLG_NESTCOMMENT,
+                                        message ("Comment starts inside comment"),
+                                        pfile);
                }
                
                if (start[i] != '\n')
This page took 0.031369 seconds and 4 git commands to generate.