Compiler warnings: Intel

This commit is contained in:
Shahram Najm 2017-09-01 17:36:16 +01:00
parent 18640bcd47
commit 7495c14869
6 changed files with 1311 additions and 1309 deletions

View File

@ -11,7 +11,7 @@
#include "eccodes.h" #include "eccodes.h"
#include <assert.h> #include <assert.h>
void usage(const char* prog) static void usage(const char* prog)
{ {
printf("usage: %s [-a|-d] infile\n",prog); printf("usage: %s [-a|-d] infile\n",prog);
exit(1); exit(1);

View File

@ -16,7 +16,7 @@
#include <assert.h> #include <assert.h>
#include "grib_api_internal.h" #include "grib_api_internal.h"
void usage(char* prog) { static void usage(const char* prog) {
printf("usage: %s filename\n",prog); printf("usage: %s filename\n",prog);
exit(1); exit(1);
} }

View File

@ -14,7 +14,7 @@
#define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0) #define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0)
int get_packing_type_code(const char* packingType) static int get_packing_type_code(const char* packingType)
{ {
int result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE; int result = GRIB_UTIL_PACKING_TYPE_GRID_SIMPLE;
if (packingType==NULL) if (packingType==NULL)
@ -30,7 +30,7 @@ int get_packing_type_code(const char* packingType)
return result; return result;
} }
void test_reduced_gg(int remove_local_def, int edition, const char* packingType, static void test_reduced_gg(int remove_local_def, int edition, const char* packingType,
const char* input_filename, const char* output_filename) const char* input_filename, const char* output_filename)
{ {
/* based on copy_spec_from_ksec */ /* based on copy_spec_from_ksec */
@ -106,7 +106,7 @@ void test_reduced_gg(int remove_local_def, int edition, const char* packingType,
fclose(out); fclose(out);
} }
void test_regular_ll(int remove_local_def, int edition, const char* packingType, static void test_regular_ll(int remove_local_def, int edition, const char* packingType,
const char* input_filename, const char* output_filename) const char* input_filename, const char* output_filename)
{ {
/* based on copy_spec_from_ksec */ /* based on copy_spec_from_ksec */
@ -186,7 +186,8 @@ void test_regular_ll(int remove_local_def, int edition, const char* packingType,
fclose(out); fclose(out);
} }
void test_grid_complex_spatial_differencing(int remove_local_def, int edition, const char* packingType, #if 0
static void test_grid_complex_spatial_differencing(int remove_local_def, int edition, const char* packingType,
const char* input_filename, const char* output_filename) const char* input_filename, const char* output_filename)
{ {
/* based on copy_spec_from_ksec */ /* based on copy_spec_from_ksec */
@ -224,7 +225,7 @@ void test_grid_complex_spatial_differencing(int remove_local_def, int edition, c
CODES_CHECK(codes_get_double(handle, "max", &theMax),0); CODES_CHECK(codes_get_double(handle, "max", &theMax),0);
CODES_CHECK(codes_get_double(handle, "min", &theMin),0); CODES_CHECK(codes_get_double(handle, "min", &theMin),0);
CODES_CHECK(codes_get_double(handle, "average",&theAverage),0); CODES_CHECK(codes_get_double(handle, "average",&theAverage),0);
printf("inlen=%ld \t max=%g \t min=%g \t avg=%g\n", inlen, theMax, theMin, theAverage); printf("inlen=%lu \t max=%g \t min=%g \t avg=%g\n", inlen, theMax, theMin, theAverage);
spec.grid_type = GRIB_UTIL_GRID_SPEC_REGULAR_LL; spec.grid_type = GRIB_UTIL_GRID_SPEC_REGULAR_LL;
spec.Nj = 721; spec.Nj = 721;
@ -272,8 +273,9 @@ void test_grid_complex_spatial_differencing(int remove_local_def, int edition, c
fclose(in); fclose(in);
fclose(out); fclose(out);
} }
#endif
void usage(const char *prog) static void usage(const char *prog)
{ {
fprintf(stderr, "%s: [-p packingType] [-r] [-e edition] in.grib out.grib\n", prog); fprintf(stderr, "%s: [-p packingType] [-r] [-e edition] in.grib out.grib\n", prog);
fprintf(stderr, "-p packingType: one of grid_jpeg, grid_second_order or grid_simple\n"); fprintf(stderr, "-p packingType: one of grid_jpeg, grid_second_order or grid_simple\n");

View File

@ -10,9 +10,6 @@
/* /*
* test: reading multi fields messages from memory * test: reading multi fields messages from memory
*
*
*
*/ */
#include "grib_api.h" #include "grib_api.h"
@ -20,7 +17,10 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <unistd.h> #include <unistd.h>
void usage(char* prog) {printf("usage: %s [-m] file.grib\n",prog);exit(1);} static void usage(const char* prog) {
printf("usage: %s [-m] file.grib\n",prog);
exit(1);
}
int main(int argc,char* argv[]) { int main(int argc,char* argv[]) {
struct stat finfo; struct stat finfo;

View File

@ -10,7 +10,7 @@
#include "grib_api.h" #include "grib_api.h"
void usage(char* prog) { static void usage(char* prog) {
printf("usage: %s infile\n",prog); printf("usage: %s infile\n",prog);
exit(1); exit(1);
} }

View File

@ -15,12 +15,12 @@ int assertion_caught = 0;
typedef enum {IBM_FLOAT, IEEE_FLOAT} FloatRep; typedef enum {IBM_FLOAT, IEEE_FLOAT} FloatRep;
void compare_doubles(const double d1, const double d2, const double epsilon) static void compare_doubles(const double d1, const double d2, const double epsilon)
{ {
assert(fabs(d1 - d2) < epsilon); assert(fabs(d1 - d2) < epsilon);
} }
void check_float_representation(const double val, const double expected, const FloatRep rep) static void check_float_representation(const double val, const double expected, const FloatRep rep)
{ {
double out = 0; double out = 0;
const double tolerance = 1e-9; const double tolerance = 1e-9;
@ -34,7 +34,7 @@ void check_float_representation(const double val, const double expected, const F
compare_doubles(out, expected, tolerance); compare_doubles(out, expected, tolerance);
} }
void test_grib_nearest_smaller_ibmfloat() static void test_grib_nearest_smaller_ibmfloat()
{ {
check_float_representation(-1.0, -1.0, IBM_FLOAT); check_float_representation(-1.0, -1.0, IBM_FLOAT);
check_float_representation(0.0, 0.0, IBM_FLOAT); check_float_representation(0.0, 0.0, IBM_FLOAT);
@ -44,7 +44,7 @@ void test_grib_nearest_smaller_ibmfloat()
check_float_representation(7.85, 7.8499994277954, IBM_FLOAT); check_float_representation(7.85, 7.8499994277954, IBM_FLOAT);
} }
void test_grib_nearest_smaller_ieeefloat() static void test_grib_nearest_smaller_ieeefloat()
{ {
check_float_representation(-1.0, -1.0, IEEE_FLOAT); check_float_representation(-1.0, -1.0, IEEE_FLOAT);
check_float_representation(0.0, 0.0, IEEE_FLOAT); check_float_representation(0.0, 0.0, IEEE_FLOAT);
@ -54,7 +54,7 @@ void test_grib_nearest_smaller_ieeefloat()
check_float_representation(7.85, 7.8499999046325, IEEE_FLOAT); check_float_representation(7.85, 7.8499999046325, IEEE_FLOAT);
} }
void test_gaussian_latitudes(int order) static void test_gaussian_latitudes(int order)
{ {
int ret = 0; int ret = 0;
const int num = 2 * order; const int num = 2 * order;
@ -73,7 +73,7 @@ void test_gaussian_latitudes(int order)
free(lats); free(lats);
} }
void test_gaussian_latitude_640() static void test_gaussian_latitude_640()
{ {
/* Test all latitudes for one specific Gaussian number */ /* Test all latitudes for one specific Gaussian number */
const int order = 640; const int order = 640;
@ -1368,7 +1368,7 @@ void test_gaussian_latitude_640()
free(lats); free(lats);
} }
void test_string_splitting() static void test_string_splitting()
{ {
int i=0; int i=0;
char input[80] = "Born|To|Be|Wild"; char input[80] = "Born|To|Be|Wild";
@ -1406,7 +1406,7 @@ static void my_assertion_proc(const char* message)
assertion_caught = 1; assertion_caught = 1;
} }
void test_assertion_catching() static void test_assertion_catching()
{ {
assert(assertion_caught == 0); assert(assertion_caught == 0);
codes_set_codes_assertion_failed_proc(&my_assertion_proc); codes_set_codes_assertion_failed_proc(&my_assertion_proc);