Skip to content

fix: OpenMP flags incorrectly applied to C/C++ compilers that don't s… #1161

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

krystophny
Copy link
Contributor

…… (#2)

  • fix: OpenMP flags incorrectly applied to C/C++ compilers that don't support them
  • Add C and C++ compiler capability testing functions to fpm_compiler.F90
  • Modify OpenMP metapackage to test OpenMP support per language individually
  • Only apply OpenMP flags to languages where the compiler actually supports them
  • Fixes issue where clang C compiler fails with unsupported -fopenmp flag

Resolves #1159

🤖 Generated with Claude Code

  • fix: Add missing temporary file cleanup in C/C++ compiler testing functions
  • Add cleanup code to check_c_source_runs() and check_cxx_source_runs()
  • Matches the cleanup pattern used in check_fortran_source_runs()
  • Prevents accumulation of temporary files during OpenMP capability testing

Addresses review feedback from qodo-merge-pro

🤖 Generated with Claude Code

  • test: Add comprehensive test coverage for C/C++ compiler capability functions
  • Add test_check_c_source_runs() with tests for:

    • Valid C hello world program
    • Program that returns error code 1
    • Invalid compile flags
    • check_c_flags_supported() wrapper
  • Add test_check_cxx_source_runs() with tests for:

    • Valid C++ hello world program
    • Program that returns error code 1
    • Invalid compile flags
    • check_cxx_flags_supported() wrapper
  • Both test suites mirror the existing Fortran tests structure

  • Tests verify error detection and temporary file cleanup

🤖 Generated with Claude Code

  • test: Improve C/C++ test robustness and fix potential escaping issues
  • Skip C/C++ tests if compiler is not available
  • Use simpler test programs to avoid iostream complexities
  • Use cstdio instead of iostream for better compatibility
  • Gracefully handle missing or misconfigured C++ compilers

These changes make the tests more robust across different environments where C/C++ compilers may not be properly configured.

🤖 Generated with Claude Code


krystophny and others added 3 commits July 21, 2025 18:28
#2)

* fix: OpenMP flags incorrectly applied to C/C++ compilers that don't support them

- Add C and C++ compiler capability testing functions to fpm_compiler.F90
- Modify OpenMP metapackage to test OpenMP support per language individually
- Only apply OpenMP flags to languages where the compiler actually supports them
- Fixes issue where clang C compiler fails with unsupported -fopenmp flag

Resolves fortran-lang#1159

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: Add missing temporary file cleanup in C/C++ compiler testing functions

- Add cleanup code to check_c_source_runs() and check_cxx_source_runs()
- Matches the cleanup pattern used in check_fortran_source_runs()
- Prevents accumulation of temporary files during OpenMP capability testing

Addresses review feedback from qodo-merge-pro

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: Add comprehensive test coverage for C/C++ compiler capability functions

- Add test_check_c_source_runs() with tests for:
  - Valid C hello world program
  - Program that returns error code 1
  - Invalid compile flags
  - check_c_flags_supported() wrapper

- Add test_check_cxx_source_runs() with tests for:
  - Valid C++ hello world program
  - Program that returns error code 1
  - Invalid compile flags
  - check_cxx_flags_supported() wrapper

- Both test suites mirror the existing Fortran tests structure
- Tests verify error detection and temporary file cleanup

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: Improve C/C++ test robustness and fix potential escaping issues

- Skip C/C++ tests if compiler is not available
- Use simpler test programs to avoid iostream complexities
- Use cstdio instead of iostream for better compatibility
- Gracefully handle missing or misconfigured C++ compilers

These changes make the tests more robust across different environments
where C/C++ compilers may not be properly configured.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: Claude <noreply@anthropic.com>
Ensure the linker always receives OpenMP flags when OpenMP is requested,
even if individual C/C++ compilers don't support OpenMP. The linker needs
these flags to properly link OpenMP runtime libraries when any compiled
objects contain OpenMP code.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Shared libraries were missing model%link_flags which include metapackage
flags like OpenMP. This caused OpenMP shared libraries to fail linking
as they didn't get the necessary OpenMP runtime library flags.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
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

Successfully merging this pull request may close these issues.

OpenMP flags incorrectly applied to C files when using clang
1 participant