Compiler warnings: NVHPC 24.1.0

This commit is contained in:
shahramn 2024-03-15 17:22:12 +00:00
parent 416242b863
commit a97e76c847
16 changed files with 13 additions and 49 deletions

View File

@ -160,10 +160,10 @@ static grib_action* reparse(grib_action* a, grib_accessor* acc, int* doit)
{
grib_action_list* self = (grib_action_list*)a;
int ret = 0;
long val = 0;
if ((ret = grib_expression_evaluate_long(grib_handle_of_accessor(acc), self->expression, &val)) != GRIB_SUCCESS) {
int ret = grib_expression_evaluate_long(grib_handle_of_accessor(acc), self->expression, &val);
if (ret != GRIB_SUCCESS) {
grib_context_log(acc->context, GRIB_LOG_ERROR,
"List %s creating %ld values: Unable to evaluate long", acc->name, val);
}

View File

@ -290,7 +290,6 @@ static int concept_conditions_expression_apply(grib_handle* h, grib_concept_cond
break;
default:
return GRIB_NOT_IMPLEMENTED;
break;
}
(*n)++;
return err;

View File

@ -245,7 +245,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len)
ret = grib_buffer_replace(a, NULL, 0, 1, 1);
if (ret != GRIB_SUCCESS) return ret;
return GRIB_SUCCESS;
break;
case GRIB_NO_VALUES:
ret = grib_get_long(grib_handle_of_accessor(a), "constantFieldHalfByte", &constantFieldHalfByte);
if (ret)
@ -262,7 +262,7 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len)
ret = grib_buffer_replace(a, NULL, 0, 1, 1);
if (ret != GRIB_SUCCESS) return ret;
return GRIB_SUCCESS;
break;
case GRIB_INVALID_BPV:
grib_context_log(a->context, GRIB_LOG_ERROR, "Unable to compute packing parameters. Invalid bits per value");
return ret;

View File

@ -389,7 +389,6 @@ static int pack_double(grib_accessor* a, const double* cval, size_t* len)
grib_buffer_replace(a, NULL, 0, 1, 1);
err = grib_set_long_internal(grib_handle_of_accessor(a), self->number_of_values, *len);
return err;
break;
case GRIB_SUCCESS:
break;
default:

View File

@ -164,7 +164,6 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
break;
default:
return GRIB_NOT_IMPLEMENTED;
break;
}
nvals = inlen / bytes;
@ -218,7 +217,6 @@ static int pack_double(grib_accessor* a, const double* val, size_t* len)
default:
code = GRIB_NOT_IMPLEMENTED;
goto clean_up;
break;
}
bufsize = bytes * inlen;
@ -282,7 +280,6 @@ static int unpack_double_element(grib_accessor* a, size_t idx, double* val)
default:
return GRIB_NOT_IMPLEMENTED;
break;
}
pos = bytes * idx;

View File

@ -786,7 +786,6 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
break;
case 2:
return GRIB_INVALID_TYPE;
break;
case 3:
for (i = 0; i < *len; i++)
val[i] = self->expanded->v[i]->width;

View File

@ -165,7 +165,6 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"invalid first argument of g2_mars_labeling in %s", a->name);
return GRIB_INTERNAL_ERROR;
break;
}
return grib_get_long(grib_handle_of_accessor(a), key, val);
@ -190,7 +189,6 @@ static int unpack_string(grib_accessor* a, char* val, size_t* len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"invalid first argument of g2_mars_labeling in %s", a->name);
return GRIB_INTERNAL_ERROR;
break;
}
return grib_get_string(grib_handle_of_accessor(a), key, val, len);
@ -226,7 +224,6 @@ static int extra_set(grib_accessor* a, long val)
case 0:
/* class */
return ret;
break;
case 1:
/* type */
switch (val) {
@ -400,7 +397,6 @@ static int extra_set(grib_accessor* a, long val)
grib_context_log(a->context, GRIB_LOG_ERROR,
"invalid first argument of g2_mars_labeling in %s", a->name);
return GRIB_INTERNAL_ERROR;
break;
}
if (productDefinitionTemplateNumberNew >= 0) {
@ -442,7 +438,6 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"invalid first argument of g2_mars_labeling in %s", a->name);
return GRIB_INTERNAL_ERROR;
break;
}
ret = grib_set_string(grib_handle_of_accessor(a), key, val, len);
@ -476,7 +471,6 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
grib_context_log(a->context, GRIB_LOG_ERROR,
"invalid first argument of g2_mars_labeling in %s", a->name);
return GRIB_INTERNAL_ERROR;
break;
}
ret = grib_set_long(grib_handle_of_accessor(a), key, *val);
@ -513,7 +507,6 @@ static int get_native_type(grib_accessor* a)
grib_context_log(a->context, GRIB_LOG_ERROR,
"invalid first argument of g2_mars_labeling in %s", a->name);
return GRIB_INTERNAL_ERROR;
break;
}
ret = grib_get_native_type(grib_handle_of_accessor(a), key, &type);

View File

@ -460,19 +460,17 @@ static int unpack_long(grib_accessor* a, long* val, size_t* len)
try {
if (numberOfTimeRange == 1) {
ret = unpack_one_time_range_long_(a, val, len);
return ret;
}
else {
ret = unpack_multiple_time_ranges_long_(a, val, len);
return ret;
}
}
catch (std::exception& e) {
grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step::unpack_long: %s", e.what());
return GRIB_DECODING_ERROR;
ret = GRIB_DECODING_ERROR;
}
return GRIB_SUCCESS;
return ret;
}
static int unpack_double(grib_accessor* a, double* val, size_t* len)
@ -500,19 +498,17 @@ static int unpack_double(grib_accessor* a, double* val, size_t* len)
try {
if (numberOfTimeRange == 1) {
ret = unpack_one_time_range_double_(a, val, len);
return ret;
}
else {
ret = unpack_multiple_time_ranges_double_(a, val, len);
return ret;
}
}
catch (std::exception& e) {
grib_context_log(h->context, GRIB_LOG_ERROR, "grib_accessor_g2end_step::unpack_double: %s", e.what());
return GRIB_DECODING_ERROR;
ret = GRIB_DECODING_ERROR;
}
return GRIB_SUCCESS;
return ret;
}
static int pack_long_(grib_accessor* a, const long end_step_value, const long end_step_unit)

View File

@ -116,18 +116,15 @@ static void dump(grib_accessor* a, grib_dumper* dumper)
static int unpack_string(grib_accessor* a, char* v, size_t* len)
{
int err = 0;
long val = 0;
size_t l = 1;
char repres[1024];
char format[32] = "%ld";
grib_handle* h = grib_handle_of_accessor(a);
err = grib_unpack_long(a, &val, &l);
grib_unpack_long(a, &val, &l);
/* TODO: We should catch all errors but in this case the test ERA_Gen.sh will fail
* as the output from grib_ls will be different */
/* if (err) return err; */
(void)err;
if ((val == GRIB_MISSING_LONG) && ((a->flags & GRIB_ACCESSOR_FLAG_CAN_BE_MISSING) != 0)) {
snprintf(repres, sizeof(repres), "MISSING");

View File

@ -92,7 +92,6 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result)
char mybuf[1024] = {0,};
size_t size = 1024;
char* p = 0;
long val = 0;
char* start = 0;
if ((err = grib_get_string_internal(h, e->name, mybuf, &size)) != GRIB_SUCCESS)
@ -103,14 +102,13 @@ static int evaluate_long(grib_expression* g, grib_handle* h, long* result)
if (e->length > 0)
start[e->length] = 0;
val = strtol(start, &p, 10);
strtol(start, &p, 10);
if (*p != 0)
*result = 0;
else
*result = 1;
(void)val;
return err;
}

View File

@ -1232,12 +1232,12 @@ int wmo_read_bufr_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset)
int wmo_read_gts_from_file_fast(FILE* f, size_t* msg_len, off_t* msg_offset)
{
//TODO(masn): Needs proper implementation; no malloc
unsigned char buffer[1024] = {0,};
//unsigned char buffer[1024] = {0,};
void* mesg = NULL;
int err = GRIB_SUCCESS;
grib_context* c = grib_context_get_default();
*msg_len = sizeof(buffer);
*msg_len = 1024; // sizeof(buffer)
mesg = wmo_read_gts_from_file_malloc(f, 0, msg_len, msg_offset, &err);
grib_context_free(c, mesg);
return err;
@ -1339,7 +1339,7 @@ static size_t stream_read(void* data, void* buffer, size_t len, int* err)
if (len > LONG_MAX) {
/* size_t cannot be coded into long */
*err = GRIB_INTERNAL_ERROR;
return -1;
return 0;
}
n = s->stream_proc(s->stream_data, buffer, len);

View File

@ -24,16 +24,13 @@ static int copy_values(grib_handle* h, grib_accessor* ga)
switch (h->values[j][i].type) {
case GRIB_TYPE_LONG:
return grib_pack_long(ga, &h->values[j][i].long_value, &len);
break;
case GRIB_TYPE_DOUBLE:
return grib_pack_double(ga, &h->values[j][i].double_value, &len);
break;
case GRIB_TYPE_STRING:
len = strlen(h->values[j][i].string_value);
return grib_pack_string(ga, h->values[j][i].string_value, &len);
break;
}
}
}

View File

@ -872,19 +872,14 @@ int grib_type_to_int(char id)
switch (id) {
case 'd':
return GRIB_TYPE_DOUBLE;
break;
case 'f':
return GRIB_TYPE_DOUBLE;
break;
case 'l':
return GRIB_TYPE_LONG;
break;
case 'i':
return GRIB_TYPE_LONG;
break;
case 's':
return GRIB_TYPE_STRING;
break;
}
return GRIB_TYPE_UNDEFINED;
}

View File

@ -84,7 +84,6 @@ static int compare_attribute(grib_handle* handle1, grib_handle* handle2, grib_ru
static int error = 0;
static int count = 0;
static int lastPrint = 0;
static int force = 0;
/* ECC-651: Boolean 'two_way' set to 1 when '-2' option used */
@ -379,7 +378,6 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
static void printInfo(grib_handle* h)
{
printf("== %d == DIFFERENCE == ", count);
lastPrint = count;
}
static void print_index_key_values(grib_index* index, int icounter, const char* error_message)

View File

@ -74,7 +74,6 @@ static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_option
int error = 0;
int count = 0;
int lastPrint = 0;
int force = 0;
double maxAbsoluteError = 1e-19;
int onlyListed = 1;
@ -245,7 +244,6 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
static void printInfo(grib_handle* h)
{
printf("== %d == DIFFERENCE == ", count);
lastPrint = count;
}
static grib_handle* gts_handle_new_from_file_x(

View File

@ -74,7 +74,6 @@ static int compareAbsolute = 1;
static int compare_handles(grib_handle* h1, grib_handle* h2, grib_runtime_options* options);
static int error = 0;
static int count = 0;
static int lastPrint = 0;
static int force = 0;
static double maxAbsoluteError = 1e-19;
static int onlyListed = 1;
@ -306,7 +305,6 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi
static void printInfo(grib_handle* h)
{
printf("== %d == DIFFERENCE == ", count);
lastPrint = count;
}
static grib_handle* metar_handle_new_from_file_x(grib_context* c, FILE* f, int mode, int headers_only, int* err)