]> andersk Git - splint.git/blobdiff - src/cpplib.c
Updated copyright date.
[splint.git] / src / cpplib.c
index ba7dada7782e6c6aa274e6d75188ecdb0ab9dd78..e80b4224c2520a5599741636f3f93f6a0990ac09 100644 (file)
@@ -1,41 +1,6 @@
 /*
-See
-http://src.openresources.com/debian/src/devel/HTML/S/altgcc_2.7.2.2.orig%20altgcc-2.7.2.2.orig%20protoize.c.html
-static char *
-abspath (cwd, rel_filename)
-
-*/
-
-/*!!!!
-*** cpplib.c.old Tue Nov 28 2000 09:04:09 AM
---- cpplib.c Tue Nov 28 2000 08:55:18 AM
-***************
-*** 5715,5722 ****
-     c2 = cppReader_peekC (pfile)
-     if (c2 != '\n'
-       goto randomchar
-!    token = CPP_HSPACE
-!    goto op2any
---- 5714,5723 ----
-          case '\\'
-     c2 = cppReader_peekC (pfile)
-     if (c2 != '\n'
-       goto randomchar
-!    cppReader_forward (pfile, 1)
-!    pfile->lineno++
-!    return CPP_HSPACE
-  
-   case '\n'
-     cppReader_putChar (pfile, c)
-
-
-Carl J. Appellof ( mailto:cappello@legato.com <mailto:cappello@legato.com> )
-*/ /*@i8@*/
-
-/*
-** LCLint - annotation-assisted static program checker
-** Copyright (C) 1994-2001 University of Virginia,
+** Splint - annotation-assisted static program checker
+** Copyright (C) 1994-2002 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
@@ -54,7 +19,7 @@ Carl J. Appellof ( mailto:cappello@legato.com <mailto:cappello@legato.com> )
 **
 ** For information on lclint: lclint-request@cs.virginia.edu
 ** To report a bug: lclint-bug@cs.virginia.edu
-** For more information: http://lclint.cs.virginia.edu
+** For more information: http://www.splint.org
 */
 /*
 ** cpplib.c
@@ -532,7 +497,7 @@ static struct directive directive_table[] = {
   {  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, 0, "", T_UNUSED, FALSE, FALSE, FALSE },
+  {  -1, NULL, "", T_UNUSED, FALSE, FALSE, FALSE },
 };
 /*@noaccess cstring@*/
 
@@ -1078,6 +1043,13 @@ skip_comment (cppReader *pfile, /*@null@*/ long *linep)
   else if (cppReader_peekC (pfile) == '/' 
           && CPPOPTIONS (pfile)->cplusplus_comments)
     {
+      
+      (void) cppoptgenerror 
+       (FLG_SLASHSLASHCOMMENT,
+        message ("C++ style // comment" 
+                ),
+        pfile);
+      
       cppReader_forward (pfile, 1);
 
       for (;;)
@@ -1635,7 +1607,7 @@ collect_expansion (cppReader *pfile, char *buf, char *limit,
          exp_p--;
          SKIP_WHITE_SPACE (p);
          if (p == limit || ! is_idstart[(int) *p]
-             || (*p == 'L' && p + 1 < limit && (p[1] == '\'' || p[1] == '"')))
+             || (*p == 'L' && p + 1 < limit && (p[1] == '\'' || p[1] == '\"')))
            cppReader_errorLit (pfile,
                          cstring_makeLiteralTemp ("`#' operator is not followed by a macro argument name"));
          else
@@ -1702,7 +1674,7 @@ collect_expansion (cppReader *pfile, char *buf, char *limit,
       id_len = p - id_beg;
 
       if (is_idstart[(int) c]
-         && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '"'))) {
+         && ! (id_len == 1 && c == 'L' && (*p == '\'' || *p == '\"'))) {
        register struct arglist *arg;
 
        for (arg = arglist; arg != NULL; arg = arg->next) {
@@ -1992,7 +1964,7 @@ create_definition (/*@exposed@*/ char *buf, char *limit,
          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 '\\': case ']':  case '^':  case '{':
@@ -2057,7 +2029,7 @@ int cppReader_checkMacroName (cppReader *pfile,
   sym_length = size_fromInt (p - symname);
 
   if (sym_length == 0
-      || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '"')))
+      || (sym_length == 1 && *symname == 'L' && (*p == '\'' || *p == '\"')))
     cppReader_error (pfile, message ("invalid %s name", usage));
   else if (!is_idstart[(int) *symname])
     {
@@ -2933,7 +2905,7 @@ special_symbol (hashNode hp, cppReader *pfile)
 
       if (!is_idstart[(int) *ip->cur])
        goto oops;
-      if (ip->cur[0] == 'L' && (ip->cur[1] == '\'' || ip->cur[1] == '"'))
+      if (ip->cur[0] == 'L' && (ip->cur[1] == '\'' || ip->cur[1] == '\"'))
        goto oops;
 
       if ((hp = cppReader_lookup (ip->cur, -1, -1)) != 0)
@@ -7516,8 +7488,20 @@ static int cpp_openIncludeFile (char *filename)
       if (!fileTable_exists (context_fileTable (),
                             cstring_fromChars (filename)))
        {
-         (void) fileTable_addHeaderFile (context_fileTable (),
+         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
        {
This page took 1.853272 seconds and 4 git commands to generate.