]> git.draconx.ca Git - cdecl99.git/blobdiff - src/parse.y
libcdecl: Remove error code argument from cdecl__err.
[cdecl99.git] / src / parse.y
index c66a803a9e57d66512d186f9f3aa97f2a6b51464..03fa1395a6df02fa27f7ec864998c6251c143388 100644 (file)
@@ -1,7 +1,7 @@
 %code top {
 /*
  *  Parser for C declarations.
- *  Copyright © 2011-2012, 2021, 2023 Nick Bowler
+ *  Copyright © 2011-2012, 2021, 2023-2024 Nick Bowler
  *
  *  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
@@ -618,11 +618,16 @@ const char *cdecl__token_name(unsigned token)
        return yytname[YYTRANSLATE(token)];
 }
 
-static void
+/*
+ * Current versions of GCC (up to 13) want to inline this function into the
+ * parser even when optimizing for size and the results are not great, so
+ * try to prevent such inlining.
+ */
+CDECL__NOINLINE static void
 yyerror(YYLTYPE *loc, yyscan_t scanner, struct cdecl **out, const char *err)
 {
        if (strstr(err, yytname[YYTRANSLATE(T_LEX_ERROR)]))
                return;
 
-       cdecl__err(CDECL_ENOPARSE, "%s", err);
+       cdecl__err("%s", err);
 }