Advertisement

Compiler warnings with latest stable version

Started by October 30, 2014 02:27 PM
9 comments, last by WitchLord 10 years ago

Hey there, smile.png

I'm proudly representing the OpenDungeons Team and I first wanted to say that we're still using and planning to use AngelScript in our project. smile.png

Oln, aka oyvindln on github has recently updated the AS version used to the current stable one and we have seen a few compilation warnings that might be of interest. smile.png

Note that we're aware of the strict aliasing limitation there is concerning AS, and we won't bother you with such compiler warnings unless told.

(I'll copy them here shortly)

Best regards and thanks a lot for this project!

Bertram

Here are the compilation warnings, except for strict-aliasing ones:


[ 24%] Building CXX object CMakeFiles/angelscript.dir/dependencies/angelscript/add_on/scriptarray/scriptarray.cpp.o
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptarray/scriptarray.cpp: In function ‘void RegisterScriptArray(asIScriptEngine*, bool)’:
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptarray/scriptarray.cpp:242:7: attention : unused variable ‘r’ [-Wunused-variable]
   int r = engine->RegisterDefaultArrayType("array<T>"); assert( r >= 0 );
       ^
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptarray/scriptarray.cpp: In function ‘void RegisterScriptArray_Native(asIScriptEngine*)’:
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptarray/scriptarray.cpp:248:6: attention : variable ‘r’ set but not used [-Wunused-but-set-variable]
  int r;
      ^
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptarray/scriptarray.cpp: In function ‘void RegisterScriptArray_Generic(asIScriptEngine*)’:
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptarray/scriptarray.cpp:1869:6: attention : variable ‘r’ set but not used [-Wunused-but-set-variable]
  int r;
      ^
[ 27%] Building CXX object CMakeFiles/angelscript.dir/dependencies/angelscript/add_on/scriptstdstring/scriptstdstring.cpp.o
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scripthelper/scripthelper.cpp: In function ‘int ConfigEngineFromStream(asIScriptEngine*, std::istream&, const char*)’:
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scripthelper/scripthelper.cpp:596:10: attention : enumeration value ‘asEP_ALTER_SYNTAX_NAMED_ARGS’ not handled in switch [-Wswitch]
    switch( ep )
          ^
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scripthelper/scripthelper.cpp:596:10: attention : enumeration value ‘asEP_DISABLE_INTEGER_DIVISION’ not handled in switch [-Wswitch]
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scripthelper/scripthelper.cpp:596:10: attention : enumeration value ‘asEP_LAST_PROPERTY’ not handled in switch [-Wswitch]
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scripthelper/scripthelper.cpp:785:95: attention : transtypage vers un pointeur depuis un entier de taille différente [-Wint-to-pointer-cast]
    r = engine->RegisterGlobalProperty(decl.c_str(), (void*)(engine->GetGlobalPropertyCount()+1));
                                                                                               ^
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptbuilder/scriptbuilder.cpp: In function ‘std::string GetCurrentDir()’:
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptbuilder/scriptbuilder.cpp:925:7: attention : unused variable ‘buffer’ [-Wunused-variable]
  char buffer[1024];
       ^
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptstdstring/scriptstdstring.cpp: In function ‘void RegisterStdString_Native(asIScriptEngine*)’:
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptstdstring/scriptstdstring.cpp:533:6: attention : variable ‘r’ set but not used [-Wunused-but-set-variable]
  int r;
      ^
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptstdstring/scriptstdstring.cpp: In function ‘void RegisterStdString_Generic(asIScriptEngine*)’:
Projects/opendungeons/OpenDungeons/dependencies/angelscript/add_on/scriptstdstring/scriptstdstring.cpp:969:6: attention : variable ‘r’ set but not used [-Wunused-but-set-variable]
  int r;
      ^

Advertisement
Hi Bertram,

Glad to see you're still using AngelScript. I visit the OpenDungeons page once in a while to check on the progress. smile.png

I'll look into the compiler warnings, thanks for letting me know. None of them are any cause of errors though.

Regards,
Andreas

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks :)

Btw, we've made much more progress than publicly told, and are working toward the stable 0.4.9 release atm.

You can see much more up-to-date news here: http://forum.freegamedev.net/viewtopic.php?f=45&t=4765

(I try to put the latest rolling release used here to help our artist (among others) to test, try new models, balance the game, and have fun. ;])

And the commit log here: https://github.com/OpenDungeons/OpenDungeons/commits/development

Hopefully, we should be able to release this year, as the strongest desired features are now coded and we're more focusing on configurability and stability, and soon the AI.

The actual and larger use of AS in OD will likely come with the next version, though.

Best regards,

Hi again, smile.png

There is another issue I'd like to discuss with you as Akien pointed out there: https://github.com/OpenDungeons/OpenDungeons/issues/2#issuecomment-61463719

It seems the Angel Script library hasn't got any version handling in its soname, making it difficult to build and handle as a system shared library.

(See details in the github thorough comments from Akien)

We were wondering whether you would be open to do or accept modifications to AS so that the major version/or major.minor version parts are used and changed when some ABI change are done, at least when compiling using CMake?

Also, Akien is planning to create a FindLibAngelScript.cmake module and we wondered whether you already have one or know whether such a module with an open-source license is existing. Would you then accept to take it in your source for general purpose?

Best regards,

Sure, I'm interested in any improvement that is for the greater good of the community. I don't know much about Linux distributions so I wouldn't know how to set up the make files correctly.

If the library version should be included in the shared file name, then that has to be done automatically by reading the version from the angelscript.h file. I do not want to have to remember updating version numbers in multiple different files for every new release. I'm already having difficulty remembering to update the version number in the manual wink.png.

All 3 numbers would have to be included in the file name. The first number (2.x.x) is the script language version. This will change when I implement something that completely breaks backwards compatibility with previous scripts. The second number (2.29.x) is C++ interface version, this changes everytime I make any change to the interface that may require a modification in the application code. The 3rd number (2.29.2) is the closest thing to the ABI version, I change this number whenever I implement new features but do not change the C++ interface. The application has to be recompiled whenever a new version is used, but it shouldn't be necessary to modify any code if only the last number is changed. When I'm only making bug fixes to an existing library I add a letter to the version string, e.g. 2.24.0a, 2.5.0c, etc.

I don't know anything about any existing FindLibAngelScript. How would it work?

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Advertisement

Hey there,

I don't know anything about any existing FindLibAngelScript. How would it work?

Akien has started working on the matter. See here for how it would be working:

https://github.com/OpenDungeons/OpenDungeons/issues/2#issuecomment-61789318

It is based on kitWare's doc on how find modules are working in general.

Akien has got a question abotu add-ons, though:

The addons directory contains source code but no evident way to turn it into a shared library + headers, so I wonder if using a system-wide AS (with addons) is even possible?

Have you got any doc/piece of advice about this?

Best regards,

The add-ons are not included in any library. The applications developers are supposed to include the code directly in their applications. Although I try to make them as generic as possible, more often than not the application developers will want to do some adjustments to the add-ons (include extra functionality, remove undesired functions, change memory management, etc).

The add-ons that I include in the SDK are mostly meant to show application developers how to implement their own interface. That's why there are so few of them.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

I've fixed the compiler warnings you mentioned in revision 2059.

AngelCode.com - game development and more - Reference DB - game developer references
AngelScript - free scripting library - BMFont - free bitmap font generator - Tower - free puzzle game

Thanks Andreas, smile.png

I'll make sure to test all that once we've updated AS again.


As for the CMake module. It is working, as long as you're not using add-ons, which are to be added to the code, as you said.
If you're willing to share a cmake module with the community, the code displayed there is yours and can be named FindAngelScript.cmake for instance:
https://github.com/OpenDungeons/OpenDungeons/issues/2#issuecomment-61789318

In projects, people can use it by adding a cmake/module folder along their CMakeLists.txt file and copy the module file there.

Then, they can request to find the needed source and object like this:


find_package(AngelScript REQUIRED)


The following variables will retain the list of object and needed include folder once invoked:


${ANGELSCRIPT_LIBRARY} ${ANGELSCRIPT_INCLUDE_DIR}


Best regards, smile.png

This topic is closed to new replies.

Advertisement