]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Objective-C/C++: Ensure sufficient setup for the preprocessor.
authorIain Sandoe <iain@sandoe.co.uk>
Tue, 9 Jan 2024 17:31:41 +0000 (17:31 +0000)
committerIain Sandoe <iain@sandoe.co.uk>
Sat, 20 Apr 2024 14:42:28 +0000 (15:42 +0100)
The tokenizer makes use of functions that determine if identifiers
are interface or class names, and those functions need a hash map
to be set up.

This ensures that these are initialized before pre-process-only
jobs are run.

gcc/objc/ChangeLog:

* objc-act.cc (objc_init): Initialize interface and class
name hash maps before the preprocessor uses them.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
(cherry picked from commit 60f58d0630805e8dce79f5489658fd83e42fa8f1)

gcc/objc/objc-act.cc

index 252274c8f5d458e60a1cb4f51db9e7c77f36d600..4820c5dbac35821bd86f06500b5c7c3f6d8fc184 100644 (file)
@@ -347,6 +347,11 @@ bool
 objc_init (void)
 {
   bool ok;
+
+  /* Set up stuff used by the preprocessor as well as FE parser.  */
+  interface_hash_init ();
+  hash_init ();
+
 #ifdef OBJCPLUS
   if (cxx_init () == false)
 #else
@@ -376,8 +381,6 @@ objc_init (void)
 
   /* Set up stuff used by FE parser and all runtimes.  */
   errbuf = XNEWVEC (char, 1024 * 10);
-  interface_hash_init ();
-  hash_init ();
   objc_encoding_init ();
   /* ... and then check flags and set-up for the selected runtime ... */
   if (flag_next_runtime && flag_objc_abi >= 2)