-
Eclipse with Ubuntu
Hi I m doing a work with Ubuntu using Eclipse for my thesis' project. I need to insure the compiler is generating the maximum number of warnings, that I fix all warnings and stop using any compiler specific "feature", such as VLAs. Do you know how can I?
-
That all depends on which compiler you are using. Eclipse is just an IDE (basically a code editor with an interface to a compiler and debugger). You would have to check the Eclipse settings to find out what compiler you are using, I think the default is GCC, but I'm not sure. Once you know the that, you look up the documentation for that compiler, to find out how to turn the warnings up to the max, and how to enable/disable certain features, such as adherence to a particular standard.
For GCC, some useful flags are
-Wall enable all warnings
-Werror treat warnings as errors, i.e. a warning will cause compilation to fail, instead of merely outputting a message
-std=c89|c99 use the 1989 or 1999 version of the C standard (yes, there's a C11 standard from 2011, but I'm not sure how much support GCC has for it)
-pedantic be very picky about adhering to the standard, no compiler-specific extensions
-pedantic-errors same as -pedantic, but generates errors (compilation fails) instead of warnings (messages only). Not sure if you need this when using -Werror
That being said, VLAs are not a "compiler specific feature". They were added to the C standard in 1999 (find a copy of the standard here: http://cboard.cprogramming.com/c-pro...standards.html).
This just came up in another thread recently, but VLAs were broken in GCC through version 4.4. They are working in 4.6+ however. You can find which C99 features are supported in GCC 4.6 here (modify the URL as needed for your version): Status of C99 features in GCC 4.6 - GNU Project - Free Software Foundation (FSF). Note, if you're using an version older than 4.6, consider upgrading (4.6 is already 2 years old).
-
If you create a "makefile" project, then all the compiler rules go in the makefile, and you can control all the flags to your own requirements.