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

Suppress declared_but_not_referenced warning for NVHPC #2637

Merged
merged 1 commit into from Feb 8, 2023

Conversation

jbadwaik
Copy link
Contributor

@jbadwaik jbadwaik commented Feb 7, 2023

Description

Catch2 suppresses unusued variable and equivalent warnings in a couple of places, but most importantly, in the declaration of autoRegistrar here. This warning gets triggered by NVHPC compiler. The current patch adds three macros, namely:

  1. CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
  2. CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS
  3. CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION

for the NVHPC Compiler which in particular prevents that warning from occurring. The compiler is detected completely separately from the other compilers in this patch, because from what I found out, NVHPC defines __GNUC__ as well for some reason. (I suspect because it advertises itself as GNU compatible.

In any case, I can try to find out a more optimal way of adding this combination if you want.

@jbadwaik jbadwaik force-pushed the nvhpc_unused_warning branch 2 times, most recently from fcd48e8 to 37ed84a Compare February 8, 2023 07:00
@codecov
Copy link

codecov bot commented Feb 8, 2023

Codecov Report

Merging #2637 (644294d) into devel (f3c0a3c) will increase coverage by 0.06%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##            devel    #2637      +/-   ##
==========================================
+ Coverage   91.20%   91.25%   +0.06%     
==========================================
  Files         188      189       +1     
  Lines        7757     7810      +53     
==========================================
+ Hits         7074     7127      +53     
  Misses        683      683              

  Catch2 suppresses unused variable and equivalent warnings in a couple
  of places, but most importantly, in the declaration of autoRegistrar
  in test registry. This warning gets triggered by NVHPC compiler. The
  current patch adds three macros, namely:

      CATCH_INTERNAL_START_WARNINGS_SUPPRESSION
      CATCH_INTERNAL_SUPPRESS_UNUSED_VARIABLE_WARNINGS
      CATCH_INTERNAL_STOP_WARNINGS_SUPPRESSION

  for the NVHPC Compiler which in particular prevents that warning from
  occurring. The compiler is detected completely separately from the
  other compilers in this patch, because from what I found out, NVHPC
  defines __GNUC__ as well for some reason. (I suspect because it
  advertises itself as GNU compatible.)

  We also add a condition to make sure that the `__GNUC__` path is not
  taken by the NVHPC compiler.
@horenmar horenmar merged commit 76cdaa3 into catchorg:devel Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants