Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Strange warnings when compiling CVS...
Urxae:
--- Quote from: rickg22 on November 21, 2005, 04:45:45 am ---I modified the codeblocks-NewBuild.cbp to include this flag, but I'd like to know if I can commit. It might throw errors using other compilers.
--- End quote ---
I thought you wanted to
--- Quote ---"fix", not just "hide"
--- End quote ---
this? :p
--- Quote from: mandrav on November 21, 2005, 08:39:50 am ---Rick, this flag works only for GCC-4.0 and up. Don't commit it...
--- End quote ---
According to this gcc mailing list post it would be added in 3.4. And I can confirm it's available in mingw 3.4.2:
--- Code: ---D:\Temp> cat test.cpp
#include <cstdio>
struct data
{
data() : x(0) {}
int x;
};
int main()
{
std::printf("hello world\n");
std::printf("offsetof x: %i\n", offsetof(data, x));
}
D:\Temp> g++ test.cpp -o test.exe
test.cpp: In function `int main()':
test.cpp:12: warning: invalid access to non-static data member `data::x' of NULL object
test.cpp:12: warning: (perhaps the `offsetof' macro was used incorrectly)
D:\Temp> g++ -Wno-invalid-offsetoff test.cpp -o test.exe
D:\Temp> test
hello world
offsetof x: 0
D:\Temp> g++ --version
g++ (GCC) 3.4.2 (mingw-special)
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--- End code ---
mandrav:
--- Quote from: Urxae ---According to this gcc mailing list post it would be added in 3.4. And I can confirm it's available in mingw 3.4.2:
--- End quote ---
Thanks for the correction, but it still doesn't matter. There's no rule to require a specific gcc version to build C::B. In other words, it still can't go in the project file as an option.
Many users (esp. linux users) use older versions like gcc 3.3.5...
thomas:
It actually works fine under certain conditions, but there are caveats.
First, it works with C++ files, but not with C files. This is an issue when setting it for the Code::Blocks project, but you would not want to do that anyway.
You will want to set it for the smallest possible subset, which is the SDK target in this case.
This, however, means that the major part of Code::Blocks (over 400 files) is compiled without this warning, which is bad. If the build system allowed us to pass custom compiler flags to individual files, that might be acceptable, but compiling the whole SDK this way is dangerous - it may hide actual errors in other places.
Lastly and most importantly, when using older compiler versions, you would expect it to produce additional warnings about unknown command line options in addition to the existing ones.
However, reality is still worse. gcc will actually bail out with an error, so the build is broken.
rickg22:
Alright then :) Oh, about the Astyle plugin, that I can commit, right?
mandrav:
--- Quote from: rickg22 on November 21, 2005, 04:47:21 pm ---Alright then :) Oh, about the Astyle plugin, that I can commit, right?
--- End quote ---
Sure :)
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version