[Ada] Consistently use explicit Entity_Id type instead of alias
[gcc.git] / libcpp / traditional.c
index a5383375cf1557a42d0acdb8e9ffc4d0f07b7106..225e3c2c2f2127d22030963ac40ab8a9006a4552 100644 (file)
@@ -1,5 +1,5 @@
 /* CPP Library - traditional lexical analysis and macro expansion.
-   Copyright (C) 2002-2018 Free Software Foundation, Inc.
+   Copyright (C) 2002-2020 Free Software Foundation, Inc.
    Contributed by Neil Booth, May 2002
 
 This program is free software; you can redistribute it and/or modify it
@@ -77,9 +77,8 @@ enum ls {ls_none = 0,         /* Normal state.  */
         ls_defined_close,      /* Looking for ')' of defined().  */
         ls_hash,               /* After # in preprocessor conditional.  */
         ls_predicate,          /* After the predicate, maybe paren?  */
-        ls_answer,             /* In answer to predicate.  */
-        ls_has_include,        /* After __has_include__.  */
-        ls_has_include_close}; /* Looking for ')' of __has_include__.  */
+        ls_answer              /* In answer to predicate.  */
+};
 
 /* Lexing TODO: Maybe handle space in escaped newlines.  Stop lex.c
    from recognizing comments and directives during its lexing pass.  */
@@ -313,7 +312,11 @@ _cpp_read_logical_line_trad (cpp_reader *pfile)
   do
     {
       if (pfile->buffer->need_line && !_cpp_get_fresh_line (pfile))
-       return false;
+       {
+         /* Now pop the buffer that _cpp_get_fresh_line did not.  */
+         _cpp_pop_buffer (pfile);
+         return false;
+       }
     }
   while (!_cpp_scan_out_logical_line (pfile, NULL, false)
         || pfile->state.skipping);
@@ -326,9 +329,12 @@ static inline bool
 fun_like_macro (cpp_hashnode *node)
 {
   if (cpp_builtin_macro_p (node))
-    return node->value.builtin == BT_HAS_ATTRIBUTE;
-  else
-    return node->value.macro->fun_like;
+    return (node->value.builtin == BT_HAS_ATTRIBUTE
+           || node->value.builtin == BT_HAS_STD_ATTRIBUTE
+           || node->value.builtin == BT_HAS_BUILTIN
+           || node->value.builtin == BT_HAS_INCLUDE
+           || node->value.builtin == BT_HAS_INCLUDE_NEXT);
+  return node->value.macro->fun_like;
 }
 
 /* Set up state for finding the opening '(' of a function-like
@@ -564,13 +570,6 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
                  lex_state = ls_defined;
                  continue;
                }
-             else if (pfile->state.in_expression
-                      && (node == pfile->spec_nodes.n__has_include__
-                       || node == pfile->spec_nodes.n__has_include_next__))
-               {
-                 lex_state = ls_has_include;
-                 continue;
-               }
            }
          break;
 
@@ -594,8 +593,6 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
                lex_state = ls_answer;
              else if (lex_state == ls_defined)
                lex_state = ls_defined_close;
-             else if (lex_state == ls_has_include)
-               lex_state = ls_has_include_close;
            }
          break;
 
@@ -729,8 +726,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
                      goto new_context;
                    }
                }
-             else if (lex_state == ls_answer || lex_state == ls_defined_close
-                       || lex_state == ls_has_include_close)
+             else if (lex_state == ls_answer || lex_state == ls_defined_close)
                lex_state = ls_none;
            }
          break;
@@ -811,8 +807,7 @@ _cpp_scan_out_logical_line (cpp_reader *pfile, cpp_macro *macro,
        lex_state = ls_none;
       else if (lex_state == ls_hash
               || lex_state == ls_predicate
-              || lex_state == ls_defined
-              || lex_state == ls_has_include)
+              || lex_state == ls_defined)
        lex_state = ls_none;
 
       /* ls_answer and ls_defined_close keep going until ')'.  */