Skip to content

Commit

Permalink
Merge pull request #44 from jasp00/clang-warnings
Browse files Browse the repository at this point in the history
Fix Clang 3.8.1 warnings
  • Loading branch information
swh authored Jan 5, 2017
2 parents 165b3dc + 06433e3 commit 2c50807
Show file tree
Hide file tree
Showing 21 changed files with 44 additions and 29 deletions.
4 changes: 1 addition & 3 deletions analogue_osc_1416.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
blo_h_free(plugin_data->osc);
]]></callback>

<callback event="run"><![CDATA[
<callback event="run" unused-vars="tables"><![CDATA[
unsigned long pos;
LADSPA_Data x, y;
const float q = warm - 0.999f;
Expand All @@ -49,8 +49,6 @@
osc->nyquist = fs * (0.47f - f_clamp(warm, 0.0f, 1.0f) * 0.41f);
blo_hd_set_freq(osc, freq);
tables = tables; // So gcc doesn't think it's unused
for (pos = 0; pos < sample_count; pos++) {
x = blo_hd_run_cub(osc);
rnda += 432577;
Expand Down
14 changes: 13 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,24 @@ AC_ARG_ENABLE(darwin, [ --enable-darwin Builds plugins that will be shared obje

CFLAGS="$lrintf_save_CFLAGS -I@top_srcdir@/intl -I@top_srcdir@"

check_cc_flag() {
echo "int main(void){return 0;}" | $CC $CFLAGS $1 -o /dev/null -x c - 2> /dev/null
}

if [ echo ${CFLAGS} | grep "\-march=" ]; then
AC_MSG_WARN([CFLAGS appears to allready contain architecture specifaction, using exiting one])
else
AC_MSG_WARN([Can't find architecture specifaction in CFLAGS])

CFLAGS="$CFLAGS -Wall -O3 -fomit-frame-pointer -fstrength-reduce -funroll-loops -ffast-math -fPIC -DPIC ${USE_SSE} ${DARWIN_CFLAGS}"
CFLAGS="$CFLAGS -Wall -O3 -fomit-frame-pointer -funroll-loops -ffast-math -fPIC -DPIC ${USE_SSE} ${DARWIN_CFLAGS}"

printf %s "checking if $CC supports -fstrength-reduce... "
if check_cc_flag -fstrength-reduce; then
echo yes
CFLAGS="$CFLAGS -fstrength-reduce"
else
echo no
fi

dnl For Intel's C compiler use:
dnl CC="icc"
Expand Down
1 change: 0 additions & 1 deletion fad_delay_1192.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
phase = 0;
last_phase = 0;
last_in = 0.0f;
sample_rate = sample_rate;
</callback>

<callback event="cleanup">
Expand Down
2 changes: 1 addition & 1 deletion flanger_1191.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ for (pos = 0; pos < sample_count; pos++) {
// Calculate position in delay table
d_base = LIN_INTERP(frac, old_d_base, new_d_base);
n_ph = (float)(law_p - abs(next_law_pos - count))/(float)law_p;
n_ph = (float)(law_p - labs(next_law_pos - count))/(float)law_p;
p_ph = n_ph + 0.5f;
while (p_ph > 1.0f) {
p_ph -= 1.0f;
Expand Down
4 changes: 1 addition & 3 deletions fm_osc_1415.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@
osc = blo_h_new(tables, BLO_SINE, (float)s_rate);
]]></callback>

<callback event="run"><![CDATA[
<callback event="run" unused-vars="tables"><![CDATA[
unsigned long pos;
osc->wave = LIMIT(f_round(wave) - 1, 0, BLO_N_WAVES-1);
tables = tables; // So gcc doesn't think it's unused
for (pos = 0; pos < sample_count; pos++) {
blo_hd_set_freq(osc, fm[pos]);
buffer_write(output[pos], blo_hd_run_cub(osc));
Expand Down
2 changes: 0 additions & 2 deletions gsm/gsm_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
* details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE.
*/

static char const ident[] = "$Header: /home/cvs/giga/ladspa-swh/gsm/gsm_create.c,v 1.1 2001/06/10 21:36:51 swh Exp $";

#include "config.h"

#ifdef HAS_STRING_H
Expand Down
2 changes: 1 addition & 1 deletion gsm/short_term.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ static void Decoding_of_the_coded_Log_Area_Ratios P2((LARc,LARpp),
#undef STEP
#define STEP( B, MIC, INVA ) \
temp1 = GSM_ADD( *LARc++, MIC ) << 10; \
temp1 = GSM_SUB( temp1, B << 1 ); \
temp1 = GSM_SUB( temp1, B * 2 ); \
temp1 = GSM_MULT_R( INVA, temp1 ); \
*LARpp++ = GSM_ADD( temp1, temp1 );

Expand Down
4 changes: 1 addition & 3 deletions gsm_1215.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,14 @@
}
]]></callback>

<callback event="run"><![CDATA[
<callback event="run" unused-vars="fs"><![CDATA[
unsigned long pos;
gsm_frame frame;
int samp;
float part;
int error_rate = f_round(error);
int num_passes = f_round(passes);
fs = fs; // So gcc doesn't think it's unused
for (pos = 0; pos < sample_count; pos++) {
// oversample into buffer down to aprox 8kHz, 13bit
Expand Down
4 changes: 1 addition & 3 deletions hermes_filter_1200.xml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ blo_h_free(plugin_data->lfo2_d);
blo_h_tables_free(plugin_data->tables);
</callback>

<callback event="run"><![CDATA[
<callback event="run" unused-vars="tables"><![CDATA[
unsigned long pos;
int i;
Expand Down Expand Up @@ -333,8 +333,6 @@ dela_fb[0] = dela1_fb;
dela_fb[1] = dela2_fb;
dela_fb[2] = dela3_fb;
tables = tables; // To shut up gcc
for (pos = 0; pos < sample_count; pos++) {
count++; // Count of number of samples processed
Expand Down
4 changes: 4 additions & 0 deletions ladspa-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ static inline float f_sin_sq(float angle)

#define f_round(f) lrintf(f)

#define f_abs(j) labs(j)

#else

// Round float to int using IEEE int* hack
Expand All @@ -176,6 +178,8 @@ static inline int f_round(float f)
return p.i - 0x4b400000;
}

#define f_abs(j) abs(j)

#endif

// Truncate float to int
Expand Down
13 changes: 11 additions & 2 deletions makestub.pl
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/perl -w

use List::Util qw(any);
use XML::Parser;

$xml_line = 1;
Expand Down Expand Up @@ -205,6 +206,7 @@ sub process_plugin {
if ($foo eq "callback") {
push(@callbacks, $tree->[$i+1]->[0]->{'event'});
$callback_code{$label.'_'.$tree->[$i+1]->[0]->{'event'}} = $tree->[$i+1]->[2];
$callback_unused_vars{$label.'_'.$tree->[$i+1]->[0]->{'event'}} = $tree->[$i+1]->[0]->{'unused-vars'};
}
if ($foo eq "port") {
push(@ports, &process_port($tree->[$i+1]));
Expand Down Expand Up @@ -326,7 +328,11 @@ sub process_plugin {

if ($call eq "cleanup") {
if ($callback_code{"${label}_cleanup"}) {
$c = $cc_marker."\t\u$label *plugin_data = (\u$label *)instance;\n";
@unused_vars = split(/[ ,]+/, $callback_unused_vars{"${label}_cleanup"});
$c = $cc_marker;
unless (any { $_ eq 'plugin_data' } @unused_vars) {
$c .= "\t\u$label *plugin_data = (\u$label *)instance;\n";
}
$c .= reindent_callback($callback_code{"${label}_cleanup"})."\n";
} else {
$c = "";
Expand Down Expand Up @@ -355,8 +361,11 @@ sub process_plugin {
$run_code .= " const LADSPA_Data ".$port->{'label'}." = *(plugin_data->".$port->{'label'}.");\n";
}
}
@unused_vars = split(/[ ,]+/, $callback_unused_vars{"${label}_run"});
for $var (sort keys %i_data) {
$run_code .= " $i_data{$var} $var = plugin_data->$var;\n";
unless (any { $_ eq $var } @unused_vars) {
$run_code .= " $i_data{$var} $var = plugin_data->$var;\n";
}
}
if ($callback_code{"${label}_run"}) {
$cb_code = $callback_code{"${label}_run"};
Expand Down
2 changes: 1 addition & 1 deletion multivoice_chorus_1201.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ for (pos = 0; pos < sample_count; pos++) {
if (count % 16 < laws) {
unsigned int t = count % 16;
// Calculate sinus phases
float n_ph = (float)(law_p - abs(next_peak_pos[t] - count))/law_p;
float n_ph = (float)(law_p - labs(next_peak_pos[t] - count))/law_p;
float p_ph = n_ph + 0.5f;
if (p_ph > 1.0f) {
p_ph -= 1.0f;
Expand Down
1 change: 0 additions & 1 deletion pitch_scale_1193.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
memset(buffers->gAnaFreq, 0, FRAME_LENGTH*sizeof(float));
memset(buffers->gAnaMagn, 0, FRAME_LENGTH*sizeof(float));
buffers->gRover = 0;
sample_rate = sample_rate;

/* do one run to make sure the plans are set up */
pitch_scale(buffers, 1.0, FRAME_LENGTH, 4, FRAME_LENGTH, sample_rate, buffers->gInFIFO, buffers->gOutFIFO, 0, 0.0f);
Expand Down
2 changes: 1 addition & 1 deletion retro_flange_1208.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ for (pos = 0; pos < sample_count; pos++) {
prev_law_pos = count + law_p;
}
n_ph = (float)(law_p - abs(next_law_pos - count))/(float)law_p;
n_ph = (float)(law_p - labs(next_law_pos - count))/(float)law_p;
p_ph = n_ph + 0.5f;
if (p_ph > 1.0f) {
p_ph -= 1.0f;
Expand Down
3 changes: 1 addition & 2 deletions ringmod_1188.xml
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,7 @@
offset = 0;
</callback>

<callback event="cleanup">
plugin_data = plugin_data;
<callback event="cleanup" unused-vars="plugin_data">
if (--refcount == 0) {
free(sin_tbl);
free(tri_tbl);
Expand Down
1 change: 0 additions & 1 deletion step_muxer_1212.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
}
current_ch = 0;
last_clock = 0.0f;
sample_rate = sample_rate;
]]></callback>

<callback event="cleanup"><![CDATA[
Expand Down
1 change: 0 additions & 1 deletion tape_delay_1211.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
last_in = 0.0f;
last2_in = 0.0f;
last3_in = 0.0f;
sample_rate = sample_rate;
z0 = 0.0f;
z1 = 0.0f;
z2 = 0.0f;
Expand Down
1 change: 0 additions & 1 deletion transient_1206.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ fast_track = 0.1;
medi_track = 0.1;
slow_track = 0.1;
count = 0;
sample_rate = sample_rate;
</callback>

<callback event="cleanup"><![CDATA[
Expand Down
2 changes: 1 addition & 1 deletion util/blo.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ static inline void blo_hd_set_freq(blo_h_osc *this, const float f)
const float ff = fabs(f) + 0.00001f; // Prevent div by zero

this->om.all = f_round(f * this->ph_coef);
tab_num = abs(f_round(this->nyquist / ff - 0.5f));
tab_num = f_abs(f_round(this->nyquist / ff - 0.5f));
if (tab_num >= BLO_N_HARMONICS) {
tab_num = BLO_N_HARMONICS - 1;
} else if (tab_num < 0) {
Expand Down
4 changes: 4 additions & 0 deletions vocoder_1337.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
]]></p>

<callback event="instantiate"><![CDATA[
memset(&bands_carrier, 0, sizeof bands_carrier);
memset(&bands_formant, 0, sizeof bands_formant);
memset(&bands_out, 0, sizeof bands_out);
sample_rate = s_rate;
main_vol = 1.0 * AMPLIFIER;
Expand Down
2 changes: 2 additions & 0 deletions vynil_1905.xml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@
buffer_s = malloc(sizeof(LADSPA_Data) * buffer_size);
buffer_mask = buffer_size - 1;
buffer_pos = 0;
click_buffer_omega.all = 0;
click_buffer_pos.all = 0;
click_gain = 0;
phi = 0.0f; /* Angular phase */
Expand Down

0 comments on commit 2c50807

Please sign in to comment.