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

Numerous warnings when compiling CMOR #602

Open
mauzey1 opened this issue May 14, 2020 · 2 comments
Open

Numerous warnings when compiling CMOR #602

mauzey1 opened this issue May 14, 2020 · 2 comments
Milestone

Comments

@mauzey1
Copy link
Collaborator

mauzey1 commented May 14, 2020

When CMOR is built using make, the C compiler will output many warnings. A lot of them are related to snprintf, which is due to the destination string potentially being not long enough to store the entire string being generated.

Src/cmor_CV.c: In function 'cmor_CV_checkExperiment':
Src/cmor_CV.c:1473:58: warning: '%s' directive output may be truncated writing up to 1023 bytes into a region of size 1002 [-Wformat-truncation=]
                                  "Your input attribute \"%s\" with value \n! \"%s\" "
                                                          ^~

Some are due to comparisons between different data types.

Src/cmor.c: In function 'cmor_pop_traceback':
Src/cmor.c:434:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (i = 0; i < strlen(cmor_traceback_info); i++) {
                   ^

Some are due to function declarations that should be prototypes in the header files. Functions that don't have parameters should be declared with (void) instead of ().

In file included from ./include/cmor.h:578:0,
                 from Src/cmor_variables.c:4:
./include/cmor_func_def.h:15:1: warning: function declaration isn't a prototype [-Wstrict-prototypes]
 extern void cmor_set_terminate_signal_to_sigint();
 ^~~~~~

Although we could suppress these warning messages, it would be better to fix these issues in the code.

@taylor13
Copy link
Collaborator

Yes, I agree it would be best to "fix" these, but suggest this might not be a high priority. Thanks for opening the issue.

@durack1 durack1 added this to the 3.9.0 milestone Apr 7, 2024
@durack1
Copy link
Contributor

durack1 commented Apr 7, 2024

@mauzey1 it would be useful to gauge what "easy" fixes can be incorporated for the CMOR 3.9.0 planned release

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

No branches or pull requests

3 participants