Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Strange warnings when compiling CVS...
rickg22:
--- Code: ---sdk\as\bindings\scriptbindings.cpp: In function `void Register_ProjectFile(asIScriptEngine*)':
sdk\as\bindings\scriptbindings.cpp:262: warning: invalid access to non-static data member `ProjectFile::project' of NULL object
sdk\as\bindings\scriptbindings.cpp:262: warning: (perhaps the `offsetof' macro was used incorrectly)
--- End code ---
This goes from lines 262 to 270 of the same file.
--- Code: ---In file included from plugins\astyle\/formattersettings.h:4,
from plugins\astyle\formattersettings.cpp:2:
plugins\astyle\/./astyle/astyle.h:68:2: warning: #warning Compiling DEBUG version (which will print lots of TRACE information to cerr)!
--- End code ---
How to get rid of these? And I mean "fix", not just "hide" :P
sethjackson:
It seems that ProjectFile::project is NULL???
I looked at the source file and I don't get what it is doing. LOL
All the stuff in quotes...... I guess I'm dumb or something.
Also does the forward slash have anything to do with it?
And is it compiling debug version or something??? I haven't compiled from CVS in awhile so I'm sorta lost. :)
Urxae:
I looked into this when I first saw those warnings, and the offsetof macro is indeed used incorrectly. It should only be used on POD types, and ProjectFile doesn't qualify.
Wouldn't know how to actually fix this, other than rewrite that part of the AngelScript engine to use member data pointers. That might require some template magic akin to boost::function to work for multiple types though, unless you only need it to work for ProjectFile.
--- Quote from: Seth Jackson on November 21, 2005, 03:04:30 am ---It seems that ProjectFile::project is NULL???
--- End quote ---
No, it uses the offsetof macro, which basically casts a pointer to a member of a dereferenced null pointer to an unsigned integer to get the member's offset into the structure.
--- Quote ---And is it compiling debug version or something??? I haven't compiled from CVS in awhile so I'm sorta lost. :)
--- End quote ---
This is a fairly recent addition to CVS (at least, to the HEAD branch).
rickg22:
I read more about it.
-Wno-invalid-offsetof (C++ only)
Suppress warnings from applying the offsetof macro to a non-POD type. According to the 1998 ISO C++ standard, applying offsetof to a non-POD type is undefined. In existing C++ implementations, however, offsetof typically gives meaningful results even when applied to certain kinds of non-POD types. (Such as a simple struct that fails to be a POD type only by virtue of having a constructor.) This flag is for users who are aware that they are writing nonportable code and who have deliberately chosen to ignore the warning about it.
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.
Also, I added a definition of NDEBUG inside the astyle.h file, to rebuild the astyle plugin ito release mode.
Yiannis, is it ok to commit?
mandrav:
Rick, this flag works only for GCC-4.0 and up. Don't commit it...
Navigation
[0] Message Index
[#] Next page
Go to full version