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

Fix pvode warnings #2684

Merged
merged 2 commits into from
Mar 23, 2023
Merged

Fix pvode warnings #2684

merged 2 commits into from
Mar 23, 2023

Conversation

dschwoerer
Copy link
Contributor

Resolves: #2654

@ZedThree
Copy link
Member

This is almost certainly fine, though I worry the format string change will just give a warning in a different place. Do we still test with clang any more?

@dschwoerer
Copy link
Contributor Author

The string is only used once - so it would only trigger if the int type is changed

@dschwoerer
Copy link
Contributor Author

And g++ also warns about this:

/builddir/build/BUILD/BOUT-dev-5.0.0/externalpackages/PVODE/source/cvode.cpp: In function 'void* pvode::CVodeMalloc(integer, RhsFn, real, N_Vector, int, int, int, real*, void*, void*, FILE*, int, long int*, real*, void*)':
/builddir/build/BUILD/BOUT-dev-5.0.0/externalpackages/PVODE/source/cvode.cpp:178:25: warning: format '%ld' expects argument of type 'long int', but argument 3 has type 'pvode::integer' {aka 'int'} [-Wformat=]
  178 | #define CVM             "CVodeMalloc-- "
      |                         ^
/builddir/build/BUILD/BOUT-dev-5.0.0/externalpackages/PVODE/source/cvode.cpp:182:25: note: in expansion of macro 'CVM'
  182 | #define MSG_BAD_N       CVM "N=%ld < 1 illegal.\n\n"
      |                         ^~~
/builddir/build/BUILD/BOUT-dev-5.0.0/externalpackages/PVODE/source/cvode.cpp:496:17: note: in expansion of macro 'MSG_BAD_N'
  496 |     fprintf(fp, MSG_BAD_N, N);
      |                 ^~~~~~~~~
/builddir/build/BUILD/BOUT-dev-5.0.0/externalpackages/PVODE/source/cvode.cpp:182:34: note: format string is defined here
  182 | #define MSG_BAD_N       CVM "N=%ld < 1 illegal.\n\n"
      |                                ~~^
      |                                  |
      |                                  long int
      |                                %d

@ZedThree
Copy link
Member

Ah, just looked myself too, only used in a single place with an int so %d is always correct, ok happy to merge now.

@ZedThree ZedThree merged commit 2bc8713 into master Mar 23, 2023
@ZedThree ZedThree deleted the pvode-warnings branch March 23, 2023 09:31
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.

warning: format specifies type 'long' but the argument has type 'pvode::integer' and other warnings
2 participants