https://gcc.gnu.org/g:56455edc6572f11c68e1a079dba9ba910c334d1e

commit r13-8539-g56455edc6572f11c68e1a079dba9ba910c334d1e
Author: Iain Sandoe <i...@sandoe.co.uk>
Date:   Tue Jan 9 17:31:41 2024 +0000

    Objective-C/C++: Ensure sufficient setup for the preprocessor.
    
    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 <i...@sandoe.co.uk>
    (cherry picked from commit 60f58d0630805e8dce79f5489658fd83e42fa8f1)

Diff:
---
 gcc/objc/objc-act.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/objc/objc-act.cc b/gcc/objc/objc-act.cc
index 08201749207..fe2d2b595b4 100644
--- a/gcc/objc/objc-act.cc
+++ b/gcc/objc/objc-act.cc
@@ -345,6 +345,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
@@ -374,8 +379,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)

Reply via email to