Closed Schala closed 2 years ago
I forgot to mention, my custom profile has these compiler switches. The value of __MWERKS__
corresponds to CodeWarrior version 8.0.
-D__MWERKS__=0x3000
-Dmacintosh
-Dpowerc
-DTARGET_CARBON
What is in the MacTypes.h file around line 21? Does it look like normal Preprocessor macros, or C? If the file is C++, the current CParser cannot parse it.
Can you post the CParserPlugin.out lines up to about 150?
It's all C code, aside from a few files that have a few C++ class wrappers behind #ifdef __cplusplus
clauses. I did take a look at ConditionalMacros.h though, which is used by MacTypes.h, and it has a few weird custom directives such as #system
and #cpu
as well as various occurrences of #pragma import
or #pagma align(mac68k)
. Apparently the parser doesn't seem to ignore code in #ifdef
s when the symbol is absent. I think that's the biggest issue.
From CParserPlugin.out, lines 329-335:
/// #if 1 ===true
#pragma options align=mac68k
/// #else if 0 ===false
/// #else if 0 ===false
/// #endif ===false
So a simple quick fix is to make a copy of the header files and edit out the offending line, probably the "#pragma" line above and other compiler specific lines. You "might" be able to -D define things in the parser that will null out some lines. Sometimes even defining certain keywords can help, but not always.
The ifdefs are evaluated. The code in between would be ignored it the macro surrounding that line evaluated to 0, or was not defined. Any value other than zero in a macro evaluates to true.
I'll give that a try and edit this as I see fit
Describe the bug I'm trying to parse the headers of Apple's old Universal Interfaces version 3.4. Using Ghidra's supplied objc_mac_carbon.prf, it chokes on MacTypes.h with the following in application.log. The same error occurs when attempting to parse this with a custom profile set to Mac OS 9's Metrowerks CodeWarrior.
To Reproduce Steps to reproduce the behavior: With a copy of Apple Universal Interfaces version 3.4 (terms of use prohibit redistribution, but a copy came with my old CodeWarrior purchase), add the include path to objc_mac_carbon.prf and save it.
Expected behavior See the application.log output above
Attachments License of the offending file prohibits redistribution.
Environment (please complete the following information):