Skip to content

[flang] Add missing #include to fix build #139371

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

Merged
merged 1 commit into from
May 10, 2025
Merged

[flang] Add missing #include to fix build #139371

merged 1 commit into from
May 10, 2025

Conversation

mgorny
Copy link
Member

@mgorny mgorny commented May 10, 2025

Add missing #include to lib/Semantics/unparse-with-symbols.cpp, in order to fix the build failure introduced in a68f35a:

FAILED: lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o
/usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DFLANG_INCLUDE_TESTS=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang_build/lib/Semantics -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/include -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang_build/include -isystem /usr/lib/llvm/21/include  -O2 -pipe -march=native -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-ctad-maybe-unsupported -fno-strict-aliasing -fno-semantic-interposition -std=c++17   -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -UNDEBUG -MD -MT lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o -MF lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o.d -o lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o -c /var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp: In function ‘void Fortran::semantics::UnparseWithModules(llvm::raw_ostream&, SemanticsContext&, const Fortran::parser::Program&, Fortran::parser::Encoding)’:
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp:153:33: error: invalid use of incomplete type ‘class Fortran::semantics::SemanticsContext’
  153 |   parser::Unparse(out, program, context.langOptions(), encoding, false, true);
      |                                 ^~~~~~~
In file included from /var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp:9:
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/include/flang/Semantics/unparse-with-symbols.h:28:7: note: forward declaration of ‘class Fortran::semantics::SemanticsContext’
   28 | class SemanticsContext;
      |       ^~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-unnecessary-virtual-specifier’ may have been intended to silence earlier diagnostics

Add missing `#include` to `lib/Semantics/unparse-with-symbols.cpp`,
in order to fix the build failure introduced
in a68f35a:

```
FAILED: lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o
/usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DFLANG_INCLUDE_TESTS=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang_build/lib/Semantics -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/include -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang_build/include -isystem /usr/lib/llvm/21/include  -O2 -pipe -march=native -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-ctad-maybe-unsupported -fno-strict-aliasing -fno-semantic-interposition -std=c++17   -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -UNDEBUG -MD -MT lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o -MF lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o.d -o lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o -c /var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp: In function ‘void Fortran::semantics::UnparseWithModules(llvm::raw_ostream&, SemanticsContext&, const Fortran::parser::Program&, Fortran::parser::Encoding)’:
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp:153:33: error: invalid use of incomplete type ‘class Fortran::semantics::SemanticsContext’
  153 |   parser::Unparse(out, program, context.langOptions(), encoding, false, true);
      |                                 ^~~~~~~
In file included from /var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp:9:
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/include/flang/Semantics/unparse-with-symbols.h:28:7: note: forward declaration of ‘class Fortran::semantics::SemanticsContext’
   28 | class SemanticsContext;
      |       ^~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-unnecessary-virtual-specifier’ may have been intended to silence earlier diagnostics
```
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:semantics labels May 10, 2025
@llvmbot
Copy link
Member

llvmbot commented May 10, 2025

@llvm/pr-subscribers-flang-semantics

Author: Michał Górny (mgorny)

Changes

Add missing #include to lib/Semantics/unparse-with-symbols.cpp, in order to fix the build failure introduced in a68f35a:

FAILED: lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o
/usr/lib/ccache/bin/x86_64-pc-linux-gnu-g++ -DFLANG_INCLUDE_TESTS=1 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang_build/lib/Semantics -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/include -I/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang_build/include -isystem /usr/lib/llvm/21/include  -O2 -pipe -march=native -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wno-maybe-uninitialized -Wno-nonnull -Wno-class-memaccess -Wno-redundant-move -Wno-pessimizing-move -Wno-noexcept-type -Wno-unnecessary-virtual-specifier -Wdelete-non-virtual-dtor -Wsuggest-override -Wno-comment -Wno-misleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-deprecated-copy -Wno-ctad-maybe-unsupported -fno-strict-aliasing -fno-semantic-interposition -std=c++17   -D_GNU_SOURCE -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -UNDEBUG -MD -MT lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o -MF lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o.d -o lib/Semantics/CMakeFiles/FortranSemantics.dir/unparse-with-symbols.cpp.o -c /var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp: In function ‘void Fortran::semantics::UnparseWithModules(llvm::raw_ostream&, SemanticsContext&, const Fortran::parser::Program&, Fortran::parser::Encoding)’:
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp:153:33: error: invalid use of incomplete type ‘class Fortran::semantics::SemanticsContext’
  153 |   parser::Unparse(out, program, context.langOptions(), encoding, false, true);
      |                                 ^~~~~~~
In file included from /var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/lib/Semantics/unparse-with-symbols.cpp:9:
/var/tmp/portage/llvm-core/flang-21.0.0.9999/work/flang/include/flang/Semantics/unparse-with-symbols.h:28:7: note: forward declaration of ‘class Fortran::semantics::SemanticsContext’
   28 | class SemanticsContext;
      |       ^~~~~~~~~~~~~~~~
At global scope:
cc1plus: note: unrecognized command-line option ‘-Wno-unnecessary-virtual-specifier’ may have been intended to silence earlier diagnostics

Full diff: https://github.com/llvm/llvm-project/pull/139371.diff

1 Files Affected:

  • (modified) flang/lib/Semantics/unparse-with-symbols.cpp (+1)
diff --git a/flang/lib/Semantics/unparse-with-symbols.cpp b/flang/lib/Semantics/unparse-with-symbols.cpp
index 634d46b8ccf40..f1e2e4ea7f119 100644
--- a/flang/lib/Semantics/unparse-with-symbols.cpp
+++ b/flang/lib/Semantics/unparse-with-symbols.cpp
@@ -11,6 +11,7 @@
 #include "flang/Parser/parse-tree-visitor.h"
 #include "flang/Parser/parse-tree.h"
 #include "flang/Parser/unparse.h"
+#include "flang/Semantics/semantics.h"
 #include "flang/Semantics/symbol.h"
 #include "llvm/Support/raw_ostream.h"
 #include <map>

@mgorny mgorny merged commit fcb4bda into llvm:main May 10, 2025
11 of 14 checks passed
@mgorny mgorny deleted the flang-inc branch May 10, 2025 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:semantics flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants