[Ada] Consistently use explicit Entity_Id type instead of alias
[gcc.git] / libcpp / identifiers.c
index 41f32a2bbaec9ac0e2643e5ff8f6490dd2f3697b..9627e1bf4b0f0851ac86dae24734008b9cf838b1 100644 (file)
@@ -1,13 +1,12 @@
 /* Hash tables for the CPP library.
-   Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
    Written by Per Bothner, 1994.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
+Free Software Foundation; either version 3, or (at your option) any
 later version.
 
 This program is distributed in the hope that it will be useful,
@@ -16,8 +15,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+along with this program; see the file COPYING3.  If not see
+<http://www.gnu.org/licenses/>.
 
  In other words, you are welcome to use, share and improve this program.
  You are forbidden to forbid anyone else to use, share and improve
@@ -28,12 +27,12 @@ Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 #include "cpplib.h"
 #include "internal.h"
 
-static hashnode alloc_node (hash_table *);
+static hashnode alloc_node (cpp_hash_table *);
 
 /* Return an identifier node for hashtable.c.  Used by cpplib except
    when integrated with the C front ends.  */
 static hashnode
-alloc_node (hash_table *table)
+alloc_node (cpp_hash_table *table)
 {
   cpp_hashnode *node;
 
@@ -45,7 +44,7 @@ alloc_node (hash_table *table)
 /* Set up the identifier hash table.  Use TABLE if non-null, otherwise
    create our own.  */
 void
-_cpp_init_hashtable (cpp_reader *pfile, hash_table *table)
+_cpp_init_hashtable (cpp_reader *pfile, cpp_hash_table *table)
 {
   struct spec_nodes *s;
 
@@ -55,9 +54,7 @@ _cpp_init_hashtable (cpp_reader *pfile, hash_table *table)
       table = ht_create (13);  /* 8K (=2^13) entries.  */
       table->alloc_node = alloc_node;
 
-      _obstack_begin (&pfile->hash_ob, 0, 0,
-                     (void *(*) (long)) xmalloc,
-                     (void (*) (void *)) free);
+      obstack_specify_allocation (&pfile->hash_ob, 0, 0, xmalloc, free);
     }
 
   table->pfile = pfile;
@@ -73,6 +70,9 @@ _cpp_init_hashtable (cpp_reader *pfile, hash_table *table)
   s->n_false           = cpp_lookup (pfile, DSC("false"));
   s->n__VA_ARGS__       = cpp_lookup (pfile, DSC("__VA_ARGS__"));
   s->n__VA_ARGS__->flags |= NODE_DIAGNOSTIC;
+  s->n__VA_OPT__        = cpp_lookup (pfile, DSC("__VA_OPT__"));
+  s->n__VA_OPT__->flags |= NODE_DIAGNOSTIC;
+  /* __has_include{,_next} are inited in cpp_init_builtins.  */
 }
 
 /* Tear down the identifier hash table.  */
@@ -103,8 +103,8 @@ cpp_defined (cpp_reader *pfile, const unsigned char *str, int len)
 
   node = CPP_HASHNODE (ht_lookup (pfile->hash_table, str, len, HT_NO_INSERT));
 
-  /* If it's of type NT_MACRO, it cannot be poisoned.  */
-  return node && node->type == NT_MACRO;
+  /* If it's a macro, it cannot have been poisoned.  */
+  return node && cpp_macro_p (node);
 }
 
 /* We don't need a proxy since the hash table's identifier comes first