[flang-commits] [flang] [flang] Ignore empty keyword macros before directives (PR #130333)

Andre Kuhlenschmidt via flang-commits flang-commits at lists.llvm.org
Fri Mar 7 12:06:01 PST 2025


================
@@ -597,6 +595,30 @@ const char *Prescanner::SkipWhiteSpace(const char *p) {
   return p;
 }
 
+const char *Prescanner::SkipWhiteSpaceIncludingEmptyMacros(
+    const char *p) const {
+  while (true) {
+    if (int n{IsSpaceOrTab(p)}) {
+      p += n;
+    } else if (preprocessor_.AnyDefinitions() && IsLegalIdentifierStart(*p)) {
+      // Skip keyword macros with empty definitions
+      const char *q{p + 1};
+      while (IsLegalInIdentifier(*q)) {
----------------
akuhlens wrote:

Can't identifiers contain numbers but not start with them? Will this code hold up to that?

https://github.com/llvm/llvm-project/pull/130333


More information about the flang-commits mailing list