eclipse Helios sorting - multiline warning description (gcc multiline warnings) - eclipse

I compile my project with gcc compiler. One of example multi line warning is:
../../Source/Ctrl/SCmd.h: In constructor `STCPCommand::STCPCommand(char)':
../../Source/Ctrl/SCmd.h:273: warning: `STCPCommand::m_pGroup' will be initialized after
../../Source/Ctrl/SCmd.h:133: warning: `const char*STCPCommand::m_pcszSourceInfo'
../../Source/Ctrl/SCmd.h:141: warning: when initialized here
But I can't read it correctly in Problems view (Description).
What I get is 3 different warnings. All lines are in different places - according to sort method.
Is there any way to show this output without sorting ?
Maybe there is some gcc flag that will avoid splitting ?

Related

Doxygen warnings in Eigen 3.2.10

Not sure what forum is best for this.
I created a (default) C++-11 tool project in Xcode 8.0 and referenced Eigen/Core using Eigen 3.2.10. I got 47 warnings before writing any code, all related to Doxygen comments, e.g.,
Empty paragraph passed to '\sa' command (in Comments.h, line 52)
Is there a fix for this?
Thanks.
Answered:
Turns out there is a global flag for documentation warnings that can be turned off.

Netbeans didn't catch error for function that should have return something, not having a return statment

I was surprised to find the compiler gave no warnings or errors when compiling source code containing a function that specified a return value in its signature but didn't actually return anything
e.g.
int foo()
{
}
How can Netbeans be beefed up so it caches these things?
According to this question this is undefined behaviour but I would've thought this is something easy for an IDE to check for.
Also, is there a way to have it displays number of warnings at the bottom of the output window after compiling? For example the way it is by default, a warning could be buried in the amount of irrelevant information and easily missed.
How can Netbeans be beefed up so it caches these things?
Right click to project -> C++ Compiler set Warning Level to More Warnings (below Basic Options).
(Same applies to C Compiler settings)
Or:
Add -Wall to compiler flags.
For a maximum of warnings you can add these: -Wall -Wextra -pedantic
Also, is there a way to have it displays number of warnings at the bottom of the output window after compiling?
I guess there's no number yet, but possible this can help you: How to display all compile errors in Netbeans as a task list?

CLOCK_MONOTONIC not found

I am attempting to use clock_gettime( CLOCK_MONOTONIC, ts ). I have included time.h, and linked to librt (I think). I still get the error that CLOCK_MONOTONIC is undefined. (EDIT: error text added)
Symbol 'CLOCK_MONOTONIC' could not be resolved ... Semantic Error
c++ in eclipse. In myrojname->properties->C/C++ Build->GCC C++ Linker->libraries I added "rt". The resulting command line includes -lrt.
I tried a much simpler scratch program and compiled from the command line with g++ -o mytest mytest.cpp -lrt and it works great.
So, what am I missing?
I think that's actually an error message coming out of the CDT static analyser, not something from the compiler itself.
And I think it's complaining about the code itself rather than something missing from the linkage objects, so whether you link with rt or not is not relevant (for this particular issue anyway).
You should go into the C++ settings, specifically the include paths, and ensure that all needed directories are listed there.

Getting the warning " ISO C90 forbids variable-size array" in gcc compiler while compiling C90 code

I am compiling my C90 c code in gcc . I am getting the warningISO C90 forbids variable-size array while making the declaration like
int symbols[nc];
Where nc is integer whose value is read from the input file. The values on the input files are varied so i can't keep a constant value. How can I get rid of it? Is it indeed necessary to resolve this warning or we can simply ignore it?
Thanks in advance.
You get that warning because C90 does not support variable length arrays.
You'll either have to switch gcc to C99 mode (which does support vla) , by using the -std=c99 or std=gnu99 command line flag, or rewrite your code to dynamically allocate memory or use a fixed size array.
The warning just tells you that you're not conforming to C90 in this case, but it's otherwise safe. Ignoring a warning should really not be an option though.

warning: -Wuninitialized is not supported without -O

The compiler complains about this, after I activated all kind of warnings:
For MyApp_Prefix.pch the compiler says:
warning: -Wuninitialized is not
supported without -O
What does that mean?
And for the uninitiated (like me), go to the Build Settings panel and filter the list for "Uninitialized Automatic Variables" then flip the flag to "No" to disable this warning. If your project file is selected this will apply across all build targets, or you can select a specific build target and change it per target.
In plain English, the compiler is complaining that it cannot check for uninitialized variables unless you turn on compiler optimization.
Chances are that it doesn't do quite such an exhaustive code path analysis if the optimizer is turned off and thus doesn't have all the necessary data to work out if a certain variable is uninitialized or not.
Simplest fix for the complaint is to turn off the warning for non-optimized builds and ensure that it's turned on for optimized release builds.
Turn on compiler optimizations.