(do_include): Correctly report the directive name
authorRichard Stallman <rms@gnu.org>
Fri, 26 Feb 1993 23:56:02 +0000 (23:56 +0000)
committerRichard Stallman <rms@gnu.org>
Fri, 26 Feb 1993 23:56:02 +0000 (23:56 +0000)
when any kind of include directive has no argument or null argument.

From-SVN: r3546

gcc/cccp.c

index 0ec5770532045df6bb0bfdeff6f501485c3689dd..5e0d2f8f963afa3a80ed065a365614141d728094 100644 (file)
@@ -3844,11 +3844,8 @@ get_filename:
   default:
   fail:
     if (retried) {
-      if (importing)
-        error ("`#import' expects \"fname\" or <fname>");
-      else
-        error ("`#include' expects \"fname\" or <fname>");
-      return 0;
+      fend = fbeg;
+      break;
     } else {
       trybuf = expand_to_temp_buffer (buf, limit, 0, 0);
       buf = (U_CHAR *) alloca (trybuf.bufp - trybuf.buf + 1);
@@ -3875,6 +3872,13 @@ get_filename:
   }
 
   flen = fend - fbeg;
+
+  if (flen == 0)
+    {
+      error ("`#%s' expects \"fname\" or <fname>", keyword->name);
+      return 0;
+    }
+
   /* Allocate this permanently, because it gets stored in the definitions
      of macros.  */
   fname = (char *) xmalloc (max_include_len + flen + 2);