Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failures with gcc 9 / Fedora 32: cgraph_node not defined as a type #11

Open
TC01 opened this issue Nov 4, 2019 · 3 comments
Open

Comments

@TC01
Copy link
Contributor

TC01 commented Nov 4, 2019

It looks like there's a problem building the old version of gcc with gcc 9.1+, currently the version in Fedora Rawhide:

../../../download/gcc.ti/gcc/pretty-print.h: At top level:
../../../download/gcc.ti/gcc/pretty-print.h:310:6: error: 'cgraph_node' is not defined as a type
  310 |      ATTRIBUTE_GCC_PPDIAG(2,3);
      |      ^~~~~~~~~~~~~~~~~~~~
../../../download/gcc.ti/gcc/pretty-print.h:313:6: error: 'cgraph_node' is not defined as a type
  313 |      ATTRIBUTE_GCC_PPDIAG(2,3);
      |      ^~~~~~~~~~~~~~~~~~~~

This was reported upstream here.

@TC01
Copy link
Contributor Author

TC01 commented Nov 4, 2019

It looks like this is also a problem in gcc/toplev.h since the macro is redefined there, too.

@TC01
Copy link
Contributor Author

TC01 commented Nov 4, 2019

And gcc/c-tree.h.

After some trial and error I got things to build with the following patch, applied after (or part of, I guess) Install_step_1.

--- a/gcc/pretty-print.h
+++ b/gcc/pretty-print.h
@@ -305,7 +305,7 @@ extern void pp_base_append_text (pretty_printer *, const char *, const char *);

 /* This header may be included before diagnostics-core.h, hence the duplicate
    definitions to allow for GCC-specific formats.  */
-#if GCC_VERSION >= 3005
+#if (GCC_VERSION >= 3005) && (GCC_VERSION < 9001) /* 9.1.0 and 9.2.0 are buggy: https://gcc.gnu.org/PR90677  */
 #define ATTRIBUTE_GCC_PPDIAG(m, n) __attribute__ ((__format__ (__gcc_diag__, m ,n))) ATTRIBUTE_NONNULL(m)
 #else
 #define ATTRIBUTE_GCC_PPDIAG(m, n) ATTRIBUTE_NONNULL(m)
--- a/gcc/toplev.h
+++ b/gcc/toplev.h
@@ -49,7 +49,7 @@ extern void _fatal_insn (const char *, r
 /* None of these functions are suitable for ATTRIBUTE_PRINTF, because
    each language front end can extend them with its own set of format
    specifiers.  We must use custom format checks.  */
-#if GCC_VERSION >= 4001
+#if GCC_VERSION >= 4001 && (GCC_VERSION < 9001)
 #define ATTRIBUTE_GCC_DIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m, n))) ATTRIBUTE_NONNULL(m)
 #else
 #define ATTRIBUTE_GCC_DIAG(m, n) ATTRIBUTE_NONNULL(m)
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -613,7 +613,7 @@ extern void c_write_global_declarations
 /* In order for the format checking to accept the C frontend
    diagnostic framework extensions, you must include this file before
    toplev.h, not after.  */
-#if GCC_VERSION >= 4001
+#if GCC_VERSION >= 4001 && (GCC_VERSION < 9001)
 #define ATTRIBUTE_GCC_CDIAG(m, n) __attribute__ ((__format__ (GCC_DIAG_STYLE, m ,n))) ATTRIBUTE_NONNULL(m)
 #else
 #define ATTRIBUTE_GCC_CDIAG(m, n) ATTRIBUTE_NONNULL(m)

@debrouxl
Copy link
Owner

Given that GCC 9.3 and 10 contain fixes for the GCC bugs, (GCC_VERSION < 9001) should read something long the lines of ((GCC_VERSION < 9001) || (GCC_VERSION >= 9003)). However, given that fixed 9.x versions are available, people shouldn't be using the buggy versions anyway... so let's just do nothing ? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants