Skip to content
This repository has been archived by the owner on Jul 27, 2020. It is now read-only.

Warnings need eradication #378

Closed
keith923 opened this issue Nov 2, 2015 · 3 comments
Closed

Warnings need eradication #378

keith923 opened this issue Nov 2, 2015 · 3 comments
Assignees
Labels

Comments

@keith923
Copy link
Contributor

keith923 commented Nov 2, 2015

From a user:

Hello there,

BUILD/apbs/tools/mesh/smooth.c:86]: (warning) scanf without field width limits can crash with huge input data.

Source code is

if (sscanf(argv[i], "--input=%s", inPath) == 1) gotInPath = 1;

Suggest add field inside %s

Some duplicates:

apbs/tools/mesh/uhbd_asc2bin.c:30]: (warning) scanf without field width limits can crash with huge input data.
apbs/tools/mesh/uhbd_asc2bin.c:42]: (warning) scanf without field width limits can crash with huge input data.
apbs/tools/mesh/uhbd_asc2bin.c:54]: (warning) scanf without field width limits can crash with huge input data.

Regards

David Binderman

@keith923 keith923 added the apbs label Nov 2, 2015
@keith923 keith923 self-assigned this Nov 2, 2015
@keith923 keith923 added this to the APBS 1.4.2 release milestone Nov 2, 2015
@keith923
Copy link
Contributor Author

While we are at it...
There are several warnings for

Odds are that the clang and gcc errors are similar for each platform, but not guaranteed to be thus.

@keith923 keith923 assigned kozlac and unassigned keith923 Dec 8, 2015
@kozlac
Copy link
Contributor

kozlac commented Dec 14, 2015

@keith923 I think I got all the warnings when building either with gcc or clang.

  1. For gcc & clang errors were mainly format errors when printing to the terminal using printf() or the maloc variation. I did make changes to CMakefiles.txt in maloc to kill a warning about double declaration of variables.
  2. For clang I made the following changes:
    • bemparm.h added the function declaration to the header file since c99 does not allowed for implicit declarations.
    • vgrid.c:230 & merge2dx.c:372 there was a check to see if variables of type size_t were greater than or equal to zero. Since type size_t is always non-negative the checks seem unnecesary (correct me if I'm wrong).
    • vpmg.c:2927,3080,3658 clang was complaining that some enum types where not being taken care of in switch statements. This was because this enums were wrap in a #if and are only consider if Tinker is enabled. Added a #else with some print statements.
    • vyacc.c:217 clang was complaining some enums were not being taken care of in the switch statement. I added this cases with no effect as other cases in the same switch.

I think these are all the warnings. I'll wait to hear from @keith923 before closing this issue.

@kozlac
Copy link
Contributor

kozlac commented Dec 15, 2015

I think all the warnings have been eradicated. I build with gcc and clang and with and without enabling Tinker (since one of the changes involved Tinker) and everything seems to be working just fine.

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

No branches or pull requests

2 participants