|Anonymous | Login | Signup for a new account||2017-05-23 09:57 BST|
|My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0000832||OMNeT++||IDE / C++ development||public||2015-08-12 20:09||2017-02-13 12:30|
|Platform||Windows and Linux||OS||OS Version|
|Target Version||Fixed in Version||5.1pre3|
|Summary||0000832: Adding -pedantic compiler option triggers warnings in OMNeT++ headers|
|Description||I wanted to use the compiler option -pedantic in one of my projects.|
But compiling the project with this options overflows to console window with lots of warnings generated by some OMNeT++ headers.
All of these warnings are of the same type (warning: extra ‘;’) and are triggered by only 2 places in the code:
Place 1: nedsupport.h
This file contains the definition of the namespace 'NEDSupport', which ends at the end of the file, and is terminated with a semicolon. This semicolon is not necessary, triggers a warning, and can be safely removed.
Place 2: onstartup.h
This is more difficult. I can describe why the warning triggers, but I don't know how to fix it.
Suppose you have a message file name MyMessages.msg with a message type called MyMessage. Compiling this file creates a C++ file called MyMessages_m.cc.
This file will contain the lines
These macros are defined in 'regmacros.h' and both contain as their last statement the macro EXECUTE_ON_STARTUP which is defined in 'onstartup.h'.
The code in EXECUTE_ON_STARTUP defines a namespace which is again followed by a semicolon. Again, this semicolon is not necessary and can be removed.
However, this time this is not enough: When the Register_Class macro is expanded, the semicolon after Register_Class in the original C++ File (MyMessage_m.cc) will follow right after the namespace definition, where it triggers the same warning.
I don't know how to fix this. As a very dirty workaround, I have added the following statement at the end of EXECUTE_ON_STARTUP:
This gets rid of the warning, and I can compile my code with -pedantic without a single warning. However, the intention of adding -pedantic is to write clean code, so adding dirty hacks is probably not a good way to shut down a warning :)
It hasn't triggered a warning with my code, but the macro EXECUTE_ON_SHUTDOWN has the same structure as EXECUTE_ON_STARTUP, so I guess changes for one should also be applied to the other.
|Additional Information||To add the compiler option -pedantic, I added the following text in project settings->OMNeT++->Makemake->Options->Custom->Makefrag:|
CXXFLAGS += -pedantic
|Tags||No tags attached.|
|Pragmas were added to mute expected warnings in OMNeT++ code.|
|2015-08-12 20:09||woife||New Issue|
|2015-10-12 10:28||ammmar1988||Issue cloned: 0000842|
|2017-02-13 12:30||rhornig||Note Added: 0001316|
|2017-02-13 12:30||rhornig||Status||new => resolved|
|2017-02-13 12:30||rhornig||Fixed in Version||=> 5.1pre3|
|2017-02-13 12:30||rhornig||Resolution||open => fixed|
|2017-02-13 12:30||rhornig||Assigned To||=> rhornig|
|Copyright © 2000 - 2017 MantisBT Team|