Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libvisual + libvisual-plugins: Fix compilation for GCC 12 and Clang 16 #121

Merged
merged 17 commits into from
Nov 30, 2022

Conversation

hartwork
Copy link
Member

Similar to #116 but for master (0.5.0)

> In file included from /home/runner/work/libvisual/libvisual/libvisual/libvisual/lv_actor.cpp:26:
> In file included from /home/runner/work/libvisual/libvisual/libvisual/libvisual/lv_plugin_registry.h:9:
> /home/runner/work/libvisual/libvisual/libvisual/libvisual/lv_singleton.hpp:28:18: error: instantiation of variable 'LV::Singleton<LV::PluginRegistry>::m_instance' required here, but no definition is available [-Werror,-Wundefined-var-template]
>           return m_instance;
>                  ^
> /home/runner/work/libvisual/libvisual/libvisual/libvisual/lv_actor.cpp:92:32: note: in instantiation of member function 'LV::Singleton<LV::PluginRegistry>::instance' requested here
>       if (!LV::PluginRegistry::instance()->has_plugin (VISUAL_PLUGIN_TYPE_ACTOR, name)) {
>                                ^
> /home/runner/work/libvisual/libvisual/libvisual/libvisual/lv_singleton.hpp:40:17: note: forward declaration of template entity is here
>       static T* m_instance;
>                 ^
> /home/runner/work/libvisual/libvisual/libvisual/libvisual/lv_singleton.hpp:28:18: note: add an explicit instantiation declaration to suppress this warning if 'LV::Singleton<LV::PluginRegistry>::m_instance' is explicitly instantiated in another translation unit
>           return m_instance;
>                  ^
> 1 error generated.
> make[2]: *** [libvisual/CMakeFiles/libvisual.dir/build.make:224: libvisual/CMakeFiles/libvisual.dir/lv_actor.cpp.o] Error 1
> [..]/libvisual/libvisual/lv_random.cpp:127:29: error: implicit conversion from 'std::linear_congruential_engine<unsigned long, 48271, 0, 2147483647>::result_type' (aka 'unsigned long') to 'float' changes value from 2147483646 to 2147483648 [-Werror,-Wimplicit-const-int-float-conversion]
>       return float (irnd) / Generator::max ();
>                           ~ ^~~~~~~~~~~~~~~~~
> [..]/libvisual/libvisual/lv_libvisual_c.cpp:9:14: error: returning address of local temporary object [-Werror,-Wreturn-stack-address]
>       return LV::System::instance()->get_version ().c_str ();
>              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> [..]/libvisual-plugins/plugins/actor/blursk/blursk.c:341:35: error: the comparison will always evaluate as ‘true’ for the address of ‘lenstr’ will never be NULL [-Werror=address]
>   341 |                         if(lenstr != NULL)
>       |                                   ^~
> [..]/libvisual-plugins/plugins/actor/blursk/blursk.c:318:22: note: ‘lenstr’ declared here
>   318 |     char posstr[32], lenstr[32];
>       |                      ^~~~~~
> [..]/libvisual-plugins/plugins/actor/blursk/blur.c:1235:5: error: a function definition without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
> int blur(priv, beat, quiet)
>     ^
> [..]/libvisual-plugins/plugins/actor/blursk/img.c:512:55: error: taking the absolute value of unsigned type 'unsigned long' has no effect [-Werror,-Wabsolute-value]
>         tbl[i] = i + (uint8_t)((double)((QTY(tbl)/2 - abs(QTY(tbl)/2 - i)) >> 1) * sin((double)(i + img_rippleshift) / 10.0));
>                                                       ^
> [..]/libvisual-plugins/plugins/actor/blursk/img.c:512:55: note: remove the call to 'abs' since unsigned values cannot be negative
>         tbl[i] = i + (uint8_t)((double)((QTY(tbl)/2 - abs(QTY(tbl)/2 - i)) >> 1) * sin((double)(i + img_rippleshift) / 10.0));
>                                                       ^~~
.. to fix -Wnarrowing compile errors:

> make[7]: Entering directory '/home/sping/__playground/libvisual-libvisual-GIT/libvisual-plugins/build2/plugins/actor/G-Force/Common/UI'
> /bin/sh ../../../../../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I../../../../../../plugins/actor/G-Force/Common/UI -I../../../../.. -I../../../../../../plugins/actor/G-Force/unix/Headers -I../../../../../../plugins/actor/G-Force/Common -I../../../../../../plugins/actor/G-Force/Common/GeneralTools/Headers -I../../../../../../plugins/actor/G-Force/Common/UI/Headers -I../../../../../../plugins/actor/G-Force/Common/math/Headers -I../../../../../../plugins/actor/G-Force/Common/io/Headers -I../../../../../../plugins/actor/G-Force/unix/libxpce -I../../../../../../plugins/actor/G-Force/unix/libmfl -I../../../../../../plugins/actor/G-Force/unix/libvisual   -DDATADIR="\"/usr/local/share/libvisual-plugins-0.4\"" -g -O2   -DUNIX_X -D_REENTRANT   -DUNIX_X -D_REENTRANT -MT EgOSUtils.lo -MD -MP -MF .deps/EgOSUtils.Tpo -c -o EgOSUtils.lo ../../../../../../plugins/actor/G-Force/Common/UI/EgOSUtils.cpp
> libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I../../../../../../plugins/actor/G-Force/Common/UI -I../../../../.. -I../../../../../../plugins/actor/G-Force/unix/Headers -I../../../../../../plugins/actor/G-Force/Common -I../../../../../../plugins/actor/G-Force/Common/GeneralTools/Headers -I../../../../../../plugins/actor/G-Force/Common/UI/Headers -I../../../../../../plugins/actor/G-Force/Common/math/Headers -I../../../../../../plugins/actor/G-Force/Common/io/Headers -I../../../../../../plugins/actor/G-Force/unix/libxpce -I../../../../../../plugins/actor/G-Force/unix/libmfl -I../../../../../../plugins/actor/G-Force/unix/libvisual -DDATADIR=\"/usr/local/share/libvisual-plugins-0.4\" -g -O2 -DUNIX_X -D_REENTRANT -DUNIX_X -D_REENTRANT -MT EgOSUtils.lo -MD -MP -MF .deps/EgOSUtils.Tpo -c ../../../../../../plugins/actor/G-Force/Common/UI/EgOSUtils.cpp  -fPIC -DPIC -o .libs/EgOSUtils.o
> [..]
> In file included from /usr/include/features.h:490,
>                  from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu/bits/os_defines.h:39,
>                  from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/x86_64-pc-linux-gnu/bits/c++config.h:655,
>                  from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/cstdlib:41,
>                  from /usr/lib/gcc/x86_64-pc-linux-gnu/12/include/g++-v12/stdlib.h:36,
>                  from ../../../../../../plugins/actor/G-Force/Common/UI/EgOSUtils.cpp:7:
> /usr/include/stdlib.h:98:45: error: narrowing conversion of '-1' from 'int' to 'bool' [-Wnarrowing]
>    98 | extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
>       |                                             ^~~~~~~
> /usr/include/stdlib.h:103:6: error: narrowing conversion of '-1' from 'int' to 'bool' [-Wnarrowing]
>   103 |      __THROW __attribute_pure__ __nonnull ((1)) __wur;
>       |      ^~~~~~~
> /usr/include/stdlib.h:106:6: error: narrowing conversion of '-1' from 'int' to 'bool' [-Wnarrowing]
>   106 |      __THROW __attribute_pure__ __nonnull ((1)) __wur;
>       |      ^~~~~~~

(cherry picked from commit aa27110)
> [..]/libvisual-plugins/plugins/actor/gforce/GForceCommon/G-Force.cpp: In constructor ‘GForce::GForce(void*)’:
> [..]/libvisual-plugins/plugins/actor/gforce/GForceCommon/G-Force.cpp:52:17: error: member ‘GForce::mT’ is used uninitialized [-Werror=uninitialized]
>    52 |         mWave1( mT ),
>       |                 ^~
> [..]/libvisual-plugins/plugins/actor/gforce/GForceCommon/G-Force.cpp:53:17: error: member ‘GForce::mT’ is used uninitialized [-Werror=uninitialized]
>    53 |         mWave2( mT )
>       |                 ^~
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:214:6: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>         if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot+2.0*M_PI))) {
>             ^
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:214:6: note: use function 'fabsf' instead
>         if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot+2.0*M_PI))) {
>             ^~~
>             fabsf
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:214:30: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>         if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot+2.0*M_PI))) {
>                                     ^
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:214:30: note: use function 'fabs' instead
>         if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot+2.0*M_PI))) {
>                                     ^~~
>                                     fabs
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:220:11: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>         else if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot-2.0*M_PI))) {
>                  ^
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:220:11: note: use function 'fabsf' instead
>         else if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot-2.0*M_PI))) {
>                  ^~~
>                  fabsf
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:220:35: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>         else if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot-2.0*M_PI))) {
>                                          ^
> [..]/libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c:220:35: note: use function 'fabs' instead
>         else if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot-2.0*M_PI))) {
>                                          ^~~
>                                          fabs
> [..]/libvisual-plugins/plugins/actor/jakdaw/feedback.c:244:9: error: variable 'dist' set but not used [-Werror,-Wunused-but-set-variable]
>         double dist;
>                ^
…onversion

> [..]/libvisual-plugins/plugins/actor/jess/draw.c:127:58: error: implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296 [-Werror,-Wimplicit-const-int-float-conversion]
>                                         (1-(float)visual_random_context_int(priv->rcontext)/UINT32_MAX) );
>                                                                                            ~^~~~~~~~~~
> /usr/include/stdint.h:129:23: note: expanded from macro 'UINT32_MAX'
> # define UINT32_MAX             (4294967295U)
>                                  ^~~~~~~~~~~
> [..]/libvisual-plugins/plugins/actor/jess/def.h:38:41: note: expanded from macro 'RESFACTXF'
> #define RESFACTXF(par1) ( (float) resx*(par1)/RESX_D )
>                                         ^~~~
> [..]/libvisual-plugins/plugins/actor/jess/draw.c:193:55: error: implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296 [-Werror,-Wimplicit-const-int-float-conversion]
>                                         (float)visual_random_context_int(priv->rcontext)/UINT32_MAX*60 );
>                                                                                         ~^~~~~~~~~~
> /usr/include/stdint.h:129:23: note: expanded from macro 'UINT32_MAX'
> # define UINT32_MAX             (4294967295U)
>                                  ^~~~~~~~~~~
> [..]/libvisual-plugins/plugins/actor/jess/def.h:38:41: note: expanded from macro 'RESFACTXF'
> #define RESFACTXF(par1) ( (float) resx*(par1)/RESX_D )
>                                         ^~~~
> [..]/libvisual-plugins/plugins/actor/jess/draw.c:194:89: error: implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296 [-Werror,-Wimplicit-const-int-float-conversion]
>                         priv->ssvy[i][j] = 0*RESFACTYF( 64 +(float)visual_random_context_int(priv->rcontext)/UINT32_MAX*64);
>                                                                                                             ~^~~~~~~~~~
> /usr/include/stdint.h:129:23: note: expanded from macro 'UINT32_MAX'
> # define UINT32_MAX             (4294967295U)
>                                  ^~~~~~~~~~~
> [..]/libvisual-plugins/plugins/actor/jess/def.h:39:41: note: expanded from macro 'RESFACTYF'
> #define RESFACTYF(par1) ( (float) resy*(par1)/RESY_D )
>                                         ^~~~
> [..]/libvisual-plugins/plugins/actor/jess/draw.c:517:68: error: implicit conversion from 'unsigned int' to 'float' changes value from 4294967295 to 4294967296 [-Werror,-Wimplicit-const-int-float-conversion]
>                                         pos[j][i] = ((float)visual_random_context_int(priv->rcontext)/UINT32_MAX-0.5);
>                                                                                                      ~^~~~~~~~~~
> /usr/include/stdint.h:129:23: note: expanded from macro 'UINT32_MAX'
> # define UINT32_MAX             (4294967295U)
>                                  ^~~~~~~~~~~
> [..]/libvisual-plugins/plugins/actor/jess/draw.c:323:8: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>                         z = abs(RESFACTXF ((float) (data[1][i + nb_x * j]) * 256));
>                             ^
> [..]/libvisual-plugins/plugins/actor/jess/draw.c:323:8: note: use function 'fabsf' instead
>                         z = abs(RESFACTXF ((float) (data[1][i + nb_x * j]) * 256));
>                             ^~~
>                             fabsf
> [..]/libvisual-plugins/plugins/actor/nebulus/glthreads.c:26:35: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>         (point_general->WIDTH/8)-(abs(sin(xval)*4)*2)+(sin(xabs)/1.5f);
>                                   ^
> [..]/libvisual-plugins/plugins/actor/nebulus/glthreads.c:26:35: note: use function 'fabs' instead
>         (point_general->WIDTH/8)-(abs(sin(xval)*4)*2)+(sin(xabs)/1.5f);
>                                   ^~~
>                                   fabs
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:69:47: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                             ^
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:69:47: note: use function 'fabsf' instead
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                             ^~~
>                                                             fabsf
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:69:47: note: include the header <math.h> or explicitly provide a declaration for 'fabsf'
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:69:69: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                                                   ^
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:69:69: note: use function 'fabsf' instead
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                                                   ^~~
>                                                                                   fabsf
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:69:69: note: include the header <math.h> or explicitly provide a declaration for 'fabsf'
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:71:47: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                             ^
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:71:47: note: use function 'fabsf' instead
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                             ^~~
>                                                             fabsf
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:71:47: note: include the header <math.h> or explicitly provide a declaration for 'fabsf'
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:71:69: error: using integer absolute value function 'abs' when argument is of floating point type [-Werror,-Wabsolute-value]
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                                                   ^
> [..]/libvisual-plugins/plugins/actor/oinksie/gfx-background.c:71:69: note: use function 'fabsf' instead
>                 _oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
>                                                                                   ^~~
>                                                                                   fabsf
@hartwork hartwork changed the title libvisual + libvisual-plugins: Fix compilation for GCC 12 and Clang 15 libvisual + libvisual-plugins: Fix compilation for GCC 12 and Clang 16 Nov 30, 2022
@hartwork hartwork merged commit 98533c2 into master Nov 30, 2022
@hartwork hartwork deleted the compiler-matrix branch November 30, 2022 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant