-
Notifications
You must be signed in to change notification settings - Fork 47
[BUILD] Reduce compiler warnings #22
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
Conversation
Calls tmpnam(3), which is deprecated.
tmpnam(3) is deprecated and triggers compiler warnings.
The #warning directives create a lot of output spam that makes it hard to see "real" warnings. Adds an option (SHOW_EXPLICIT_WARNINGS) to enable them (default off), otherwise suppresses them via -Wno-cpp.
tuplex/codegen/src/Pipe.cc
Outdated
| ofs<<file_input; | ||
| ofs.close(); | ||
| cmd += " " + tmppath + ".py"; | ||
| char tmpname[22]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should prob. reuse the scratchDir from Tuplex. Per default it's set to /tmp/tuplex-<user>. This will avoid cluttering /tmp with a ton of temp files and has the other advantage that there is a single scratch dir (per user) on which files are stored on. I.e., I would introduce a default parameter scratchDir="/tmp" and then create the file template via
scratchDir + "/pipe-XXXXXX.tmp". (some name without .py because the Pipe class is not python bound).
Also would strongly urge to use snprintf instead of sprintf to avoid buffer overflow/security risk.
Error handling for std::FILE* tmp and fd is further missing (check for NULL/https://man7.org/linux/man-pages/man3/mkstemp.3.html). mkstemps does not always succeed, these scenarios should be covered. Is this function working under Mac?
|
|
||
| # suppress "#warning" directive otuput | ||
| option(SHOW_EXPLICIT_WARNINGS "Show the output of #warning directives in the code (lots of output)" OFF) | ||
| if(SHOW_EXPLICIT_WARNINGS) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe add message(STATUS "Disabled output of #warning directives in the code, use SHOW_EXPLICIT_WARNINGS to turn all warnings on") or so?
LeonhardFS
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should make the replacement code for tempname a bit safer, less prone to errors.
Removes many compiler warnings to make it easier to spot important warnings and errors in the output.
tmpnam(3)where used (one piece of dead code, one actual implementation in Pipe.cc).#warningdirective output (which gets repeated every time a header is included) by default. UseSHOW_EXPLICIT_WARNINGSto turn it back on. Most of this relates to unimplemented features, so doesn't need to be shown by default.