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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
8585057
Address Clang 15 compile warning -Wundefined-var-template
hartwork Nov 28, 2022
0fef336
Address Clang 15 warning -Wimplicit-const-int-float-conversion
hartwork Nov 28, 2022
e59ac11
Address Clang 15 warning -Wreturn-stack-address
hartwork Nov 28, 2022
e6d3053
Plugins (blursk): Address GCC 12 warning -Waddress
hartwork Nov 28, 2022
bfd401e
Plugins (blursk): Address Clang 15 warning -Wdeprecated-non-prototype
hartwork Nov 28, 2022
e273892
Plugins (blursk): Address Clang 15 warning -Wabsolute-value
hartwork Nov 28, 2022
b68c273
Plugins (gforce): Stop redefining "true" and "false" for GCC 12
hartwork Nov 27, 2022
511db3f
Plugins (gforce): Address GCC 12 warning -Wuninitialized
hartwork Nov 28, 2022
4297741
Plugins (goom2k4): Address Clang 15 warning -Wabsolute-value
hartwork Nov 28, 2022
6ac41bf
Plugins (jakdaw): Address Clang 15 warning -Wunused-but-set-variable
hartwork Nov 28, 2022
39b2d05
Plugins (jess): Address Clang 15 warning -Wimplicit-const-int-float-c…
hartwork Nov 28, 2022
33b9745
Plugins (jess): Address Clang 15 warning -Wabsolute-value
hartwork Nov 28, 2022
953c8c6
Plugins (nebulus): Addess Clang 15 warning -Wabsolute-value
hartwork Nov 28, 2022
40ca5a2
Plugins (oinksie): Address Clang 15 warning -Wabsolute-value
hartwork Nov 28, 2022
28476a4
Actions (Linux): Detect and deny underlinking plugins
hartwork Nov 27, 2022
ac21249
Actions (Linux): Drop superflouos "set -e"
hartwork Nov 30, 2022
52b1689
Actions (Linux): Build with GCC 11/12 + Clang 15/16
hartwork Nov 27, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 43 additions & 4 deletions .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,37 @@ jobs:
linux:
name: Build and test (Linux)
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- cc: gcc-11
cxx: g++-11
clang_major_version: null
clang_repo_suffix: null
- cc: gcc-12
cxx: g++-12
clang_major_version: null
clang_repo_suffix: null
- cc: clang-15
cxx: clang++-15
clang_major_version: 15
clang_repo_suffix: -15
- cc: clang-16
cxx: clang++-16
clang_major_version: 16
clang_repo_suffix:
steps:
- name: Add Clang/LLVM repositories
if: "${{ contains(matrix.cxx, 'clang') }}"
run: |-
set -x
source /etc/os-release
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
sudo add-apt-repository "deb http://apt.llvm.org/${UBUNTU_CODENAME}/ llvm-toolchain-${UBUNTU_CODENAME}${{ matrix.clang_repo_suffix }} main"

- name: Install build dependencies
run: |-
set -e
sudo apt-get update
# Note: This additional step's sole purpuse is to workaround symptom:
# > The following packages have unmet dependencies:
Expand All @@ -41,15 +68,22 @@ jobs:
libgl1-mesa-dev \
pkg-config

- name: Install build dependency Clang ${{ matrix.clang_major_version }}
if: "${{ contains(matrix.cxx, 'clang') }}"
run: |-
sudo apt-get install --yes --no-install-recommends -V \
clang-${{ matrix.clang_major_version }}

- name: Checkout Git branch
uses: actions/checkout@v3

- name: '[LV] Run CMake'
run: |-
set -e
mkdir build_lv
cd build_lv
cmake \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_BUILD_TYPE=${LV_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX:PATH=${LV_INSTALL_PREFIX} \
\
Expand All @@ -70,11 +104,12 @@ jobs:
- name: '[Plugins] Run CMake'
# TODO Make gstreamer plugin work with GStreamer 1.x
run: |-
set -e
mkdir build_plugins
cd build_plugins
PKG_CONFIG_PATH=${LV_INSTALL_PREFIX}/lib/pkgconfig/ \
cmake \
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
-DCMAKE_BUILD_TYPE=${LV_BUILD_TYPE} \
-DCMAKE_INSTALL_PREFIX:PATH=${LV_INSTALL_PREFIX} \
\
Expand All @@ -84,11 +119,15 @@ jobs:

- name: '[Plugins] Run "make"'
run: |-
set -x -o pipefail

make -C build_plugins -j2 VERBOSE=1

# Detect and deny underlinking
! find -name \*.so | sort | xargs ldd -r | grep -F 'undefined symbol'

- name: '[Plugins] Run "make install"'
run: |-
set -e
make -C build_plugins install DESTDIR="${PWD}"/ROOT_PLUGINS
find ROOT_PLUGINS/ | sort

Expand Down
7 changes: 3 additions & 4 deletions libvisual-plugins/plugins/actor/blursk/blur.c
Original file line number Diff line number Diff line change
Expand Up @@ -1232,10 +1232,9 @@ static struct styles {
* groups of 8. For example, if the window is 256x128 then the image should
* have size 258x130, and img should store ((258*130+7)&~7)=33544 pixels.
*/
int blur(priv, beat, quiet)
BlurskPrivate *priv;
int beat; /* Boolean: is this a beat? */
int quiet; /* Boolean: is this the start of a quiet period? */
int blur(BlurskPrivate *priv,
int beat /* Boolean: is this a beat? */,
int quiet /* Boolean: is this the start of a quiet period? */)
{
int i, j, k;
int transition, transfrom;
Expand Down
5 changes: 1 addition & 4 deletions libvisual-plugins/plugins/actor/blursk/blursk.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,10 +338,7 @@ static unsigned char *show_info(unsigned char *img, int height, int bpl)
case VISUAL_SONGINFO_TYPE_SIMPLE:
if(config.show_timestamp)
{
if(lenstr != NULL)
sprintf(buf, "{%s/%s} %s", posstr, lenstr, visual_songinfo_get_simple_name(songinfo));
else
sprintf(buf, "(%s) %s", posstr, visual_songinfo_get_simple_name(songinfo));
sprintf(buf, "{%s/%s} %s", posstr, lenstr, visual_songinfo_get_simple_name(songinfo));
break;
}
else
Expand Down
2 changes: 1 addition & 1 deletion libvisual-plugins/plugins/actor/blursk/img.c
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ uint8_t *img_ripple(int *widthref, int *heightref, int *bplref)
/* Compute the mapping table */
for (i = QTY(tbl); --i >= 0; )
{
tbl[i] = i + (uint8_t)((double)((QTY(tbl)/2 - abs(QTY(tbl)/2 - i)) >> 1) * sin((double)(i + img_rippleshift) / 10.0));
tbl[i] = i + (uint8_t)((double)((QTY(tbl)/2 - abs((int)QTY(tbl)/2 - i)) >> 1) * sin((double)(i + img_rippleshift) / 10.0));
}

/* Copy the image, expanding it for lower CPU speeds */
Expand Down
5 changes: 0 additions & 5 deletions libvisual-plugins/plugins/actor/gforce/Common/EgCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@

#include <libmfl.h>

#ifndef true
#define true -1
#define false 0
#endif

struct Rect {
short left, top, right, bottom;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ GForce::GForce( void* inRefCon ) :
#endif
mConsoleLines( cDuplicatesAllowed, cOrderImportant ),
mLineExpireTimes( cOrderImportant ),
mT( 0 ),
mPal1( mT, mIntensityParam ),
mPal2( mT, mIntensityParam ),
mDeltaFields ( cNoDuplicates_CaseInsensitive, cSortLowToHigh ),
Expand All @@ -63,8 +64,7 @@ GForce::GForce( void* inRefCon ) :
mLastGetKeys =
mT_MS = 0;
mFrameCountStart =
mNextPaletteUpdate =
mT = 0;
mNextPaletteUpdate = 0;
mNextShapeChange = mT + 10;
mNextFieldChange = mT + 10;
mNextColorChange = mT + 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ class GForce {
void Print( UtilStr* inStr ) { if ( inStr ) Print( inStr -> getCStr() ); }
void Println( const char* inStr );
void Println( UtilStr* inStr ) { Println( inStr ? inStr -> getCStr() : 0 ); }


// Linked dict vars/addressed data spaces
float mT;

// Palette stuff
PixPalEntry mPalette[ 256 ];
GF_Palette mPal1, mPal2, *mGF_Palette, *mNextPal;
Expand Down Expand Up @@ -197,10 +200,6 @@ class GForce {
Expression mFieldInterval, mColorInterval, mShapeInterval;
#define TRANSITION_ALPHA 1.45


// Linked dict vars/addressed data spaces
float mT;

// Field stuff
DeltaField* mField, *mNextField;
DeltaField mField1, mField2;
Expand Down
5 changes: 3 additions & 2 deletions libvisual-plugins/plugins/actor/goom2k4/tentacle3d.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include <math.h>
#include <stdlib.h>

#include "v3d.h"
Expand Down Expand Up @@ -211,13 +212,13 @@ static void pretty_move (PluginInfo *goomInfo, float cycle, float *dist, float *
tmp = cycle - (M_PI*2.0) * floor(cycle/(M_PI*2.0));
}

if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot+2.0*M_PI))) {
if (fabs(tmp-fx_data->rot) > fabs(tmp-(fx_data->rot+2.0*M_PI))) {
fx_data->rot = (tmp + 15.0f*(fx_data->rot+2*M_PI)) / 16.0f;
if (fx_data->rot>2.0*M_PI)
fx_data->rot -= 2.0*M_PI;
*rotangle = fx_data->rot;
}
else if (abs(tmp-fx_data->rot) > abs(tmp-(fx_data->rot-2.0*M_PI))) {
else if (fabs(tmp-fx_data->rot) > fabs(tmp-(fx_data->rot-2.0*M_PI))) {
fx_data->rot = (tmp + 15.0f*(fx_data->rot-2.0*M_PI)) / 16.0f;
if (fx_data->rot<0.0f)
fx_data->rot += 2.0*M_PI;
Expand Down
3 changes: 2 additions & 1 deletion libvisual-plugins/plugins/actor/jakdaw/feedback.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ static uint32_t zoom_ripplenew(JakdawPrivate *priv, int x, int y)
dist*=3.14*priv->zoom_ripplesize/sqrt((priv->xres*priv->xres)+(priv->yres*priv->yres));

// FIXME - implement the rest of this!

(void)dist; // just for -Wunused-but-set-variable

nx=x;
ny=y;

Expand Down
10 changes: 5 additions & 5 deletions libvisual-plugins/plugins/actor/jess/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ void super_spectral_balls(JessPrivate *priv, uint8_t * buffer)
/* initialisation de la ligne */
priv->lifev[i][j] = LINE_VIE;
priv->vx[i][j] = RESFACTXF( 0.025*((float) i - 128.0) * 32 +0*
(1-(float)visual_random_context_int(priv->rcontext)/UINT32_MAX) );
(1-visual_random_context_int(priv->rcontext)/(float)UINT32_MAX) );
priv->vy[i][j] = RESFACTYF( (10+i)*i*priv->lys.Ed_moyen[i]*5000*( (float)j+1)/4);
priv->x[i][j] = RESFACTXF( 2*(i - 128) ) +((float)j*(i-128))/2;
priv->y[i][j] = 0*RESFACTXF( yres2/2-(float)((i-128)*(i-128))/256) -20*j ;
Expand Down Expand Up @@ -190,8 +190,8 @@ void super_spectral(JessPrivate *priv, uint8_t * buffer)
/* initialisation de la ligne */
priv->lifet[i][j] = LINE_VIE;
priv->ssvx[i][j] = 0*RESFACTXF( 0.025*((float) i - 128.0) * 32 +
(float)visual_random_context_int(priv->rcontext)/UINT32_MAX*60 );
priv->ssvy[i][j] = 0*RESFACTYF( 64 +(float)visual_random_context_int(priv->rcontext)/UINT32_MAX*64);
visual_random_context_int(priv->rcontext)/(float)UINT32_MAX*60 );
priv->ssvy[i][j] = 0*RESFACTYF( 64 +visual_random_context_int(priv->rcontext)/(float)UINT32_MAX*64);
priv->ssx[i][j] = RESFACTXF( 2*(i - 128) ) +((float)j*(i-128))/2;
priv->ssy[i][j] = 0*RESFACTXF( yres2/2-(float)((i-128)*(i-128))/256) -20*j+60 ;
priv->sstheta[i][j] = 0;
Expand Down Expand Up @@ -320,7 +320,7 @@ void l2_grilles_3d (JessPrivate *priv, uint8_t * buffer, float data[2][512], flo
{
y = RESFACTYF ((j - ((float) nb_y / 2)) * 15);

z = abs(RESFACTXF ((float) (data[1][i + nb_x * j]) * 256));
z = fabs(RESFACTXF ((float) (data[1][i + nb_x * j]) * 256));
color[i][j] = data[1][i + nb_x * j] * 64 + 100;

rotation_3d (&x, &y, &z, alpha, beta, gamma);
Expand Down Expand Up @@ -514,7 +514,7 @@ void stars_create_state(JessPrivate *priv, float pos[3][STARS_MAX], int mode)
{
for(j=0; j<3 ; j++)
{
pos[j][i] = ((float)visual_random_context_int(priv->rcontext)/UINT32_MAX-0.5);
pos[j][i] = (visual_random_context_int(priv->rcontext)/(float)UINT32_MAX-0.5);

}
}
Expand Down
2 changes: 1 addition & 1 deletion libvisual-plugins/plugins/actor/nebulus/glthreads.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ createglthreads(void)
xval += speed_xval;
xabs += speed_xabs;
p.x = ((GLfloat)point_general->WIDTH/2)/(GLfloat)
(point_general->WIDTH/8)-(abs(sin(xval)*4)*2)+(sin(xabs)/1.5f);
(point_general->WIDTH/8)-(fabs(sin(xval)*4)*2)+(sin(xabs)/1.5f);
p.y = -2.0f;
p.z = (GLfloat)((point_general->HEIGHT/2)+((GLfloat)val_pcm
*(0.11f*point_general->HEIGHT)/1800))/(GLfloat)
Expand Down
5 changes: 3 additions & 2 deletions libvisual-plugins/plugins/actor/oinksie/gfx-background.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/

#include <math.h>
#include <string.h>

#include "common.h"
Expand Down Expand Up @@ -66,9 +67,9 @@ void _oink_gfx_background_circles_sine (OinksiePrivate *priv,
_oink_pixel_rotate (&x, &y, rotate);
_oink_pixel_rotate (&x1, &y1, rotate);

_oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
_oink_gfx_circle_filled (priv, buf, color - fabs (sden * 20), 15 - fabs (sden * 10),
x + priv->screen_halfwidth, y + priv->screen_halfheight);
_oink_gfx_circle_filled (priv, buf, color - abs (sden * 20), 15 - abs (sden * 10),
_oink_gfx_circle_filled (priv, buf, color - fabs (sden * 20), 15 - fabs (sden * 10),
x1 + priv->screen_halfwidth, y1 + priv->screen_halfheight);

tab += stretch;
Expand Down
4 changes: 4 additions & 0 deletions libvisual/libvisual/lv_libvisual.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@
//! Libvisual namespace
namespace LV {

class LV_API System;
template <>
LV_API System* Singleton<System>::m_instance;

class LV_API System
: public Singleton<System>
{
Expand Down
3 changes: 2 additions & 1 deletion libvisual/libvisual/lv_libvisual_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ extern "C" {

const char *visual_get_version ()
{
return LV::System::instance()->get_version ().c_str ();
static std::string version = LV::System::instance()->get_version ();
return version.c_str ();
}

int visual_get_api_version ()
Expand Down
4 changes: 4 additions & 0 deletions libvisual/libvisual/lv_plugin_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ namespace LV {

typedef ::VisPluginType PluginType;

class LV_API PluginRegistry;
template<>
LV_API PluginRegistry* Singleton<PluginRegistry>::m_instance;

//! Manages the registry of plugins
//!
//! @note This is a singleton class. Its only instance must
Expand Down
2 changes: 1 addition & 1 deletion libvisual/libvisual/lv_random.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ namespace LV {
value.i = 0x3f800000 | (t >> 9);
return value.f - 1.0f;
#else
return float (irnd) / Generator::max ();
return float (irnd) / float(Generator::max ());
#endif
}

Expand Down