Updates to warnhist script, along with a few cleanups, and add some comments

to warning cleanups that are a bit obscure.
This commit is contained in:
Quincey Koziol 2019-07-09 22:15:36 -05:00
parent 78e13fe8b0
commit db7c43d375
19 changed files with 156 additions and 37 deletions

View File

@ -252,8 +252,18 @@ while (<>) {
print "Line is a null string! Input line #$. is: '$_'";
next
}
# Check for non-GCC warning (Solaris/Oracle?)
} elsif($_ =~ /^\".*, line [0-9]+: *[Ww]arning:.*/) {
($name, $toss, $warning, $extra, $extra2) = split /\:/, $_;
($name, $line) = split /\,/, $name;
$name =~ s/^\"//g;
$name =~ s/\"$//g;
$line =~ s/^\s*line\s*//g;
# print "name:'", $name, "'-'", $line, "'\n";
# print "warning:'", $warning, "'\n";
} else {
# Check for 'character offset' field appended to file & line #
# (This is probably specific to GCC)
if($_ =~ /^.*[0-9]+\:[0-9]+\:/) {
($name, $line, $offset, $toss, $warning, $extra, $extra2) = split /\:/, $_;
} else {
@ -339,9 +349,10 @@ while (<>) {
$warning =~ s/\s(\{|\()aka '?[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'?(\}|\))//g;
}
# Genericize C/C++ '<some type>' and printf format '%<some format>' into '-'
if($warning =~ /'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/) {
$warning =~ s/'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\ ]*'/'-'/g;
# Genericize C/C++ '<some type>', printf format '%<some format>', and
# "unknown warning group" into '-'
if($warning =~ /'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=\ ]*'/) {
$warning =~ s/'[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=]+[A-Za-z_0-9\(\)\*\,\[\]\.\<\>\&\:\+\#\-\=\ ]*'/'-'/g;
}
if($warning =~ /'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/) {
$warning =~ s/'%[\#0\-\ \+]*[,;\:_]?[0-9\*]*\.?[0-9\*]*[hjltzL]*[aAcdeEfFgGinosuxX]'/'-'/g;
@ -370,8 +381,8 @@ while (<>) {
}
# Genericize standalone numbers in warnings
if($warning =~ /\s-?[0-9]+\s/) {
$warning =~ s/\s-?[0-9]+\s/\ -\ /g;
if($warning =~ /(\s|')-?[0-9]+(\s|')/) {
$warning =~ s/-?[0-9]+/-/g;
}
# Genericize unusual GCC/G++/GFORTRAN warnings that aren't handled above
@ -442,7 +453,7 @@ for my $x (sort {$warn_count{$b} <=> $warn_count{$a}} keys(%warn_count)) {
for my $y (sort {$warn_file{$x}{$b} <=> $warn_file{$x}{$a}} keys(%{$warn_file{$x}})) {
printf ("\t%4d - %s\n", $warn_file{$x}{$y}, $y);
if(exists $options{l}) {
my $lines = join ", ", sort {$a <=> $b} keys $warn_file_line{$x}{$y};
my $lines = join ", ", sort {$a <=> $b} keys %{$warn_file_line{$x}{$y}};
printf("\t\tLines: $lines \n");
}
}
@ -480,7 +491,7 @@ for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) {
for my $y (sort {$file_warn{$x}{$b} <=> $file_warn{$x}{$a}} keys(%{$file_warn{$x}})) {
printf ("\t%4d - %s\n", $file_warn{$x}{$y}, $y);
if(exists $options{l}) {
my $lines = join ", ", sort {$a <=> $b} keys $file_warn_line{$x}{$y};
my $lines = join ", ", sort {$a <=> $b} keys %{$file_warn_line{$x}{$y}};
printf("\t\tLines: $lines \n");
}
}

View File

@ -613,6 +613,14 @@ done:
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* memb_name & temp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static H5FD_t *
H5FD_family_open(const char *name, unsigned flags, hid_t fapl_id,
haddr_t maxaddr)
@ -763,6 +771,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD_family_open() */
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
@ -942,6 +951,14 @@ H5FD_family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() call with
* memb_name in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
H5FD_family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
{
@ -1008,6 +1025,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------

View File

@ -771,7 +771,7 @@ H5FD_multi_sb_decode(H5FD_t *_file, const char *name, const unsigned char *buf)
buf += nseen*2*8;
if (H5Tconvert(H5T_STD_U64LE, H5T_NATIVE_HADDR, nseen*2, x, NULL, H5P_DEFAULT)<0)
H5Epush_ret(func, H5E_ERR_CLS, H5E_DATATYPE, H5E_CANTCONVERT, "can't convert superblock info", -1)
ap = (haddr_t*)((void *)x);
ap = (haddr_t*)((void *)x); /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
UNIQUE_MEMBERS(map, mt) {
memb_addr[_unmapped] = *ap++;
memb_eoa[_unmapped] = *ap++;

View File

@ -572,11 +572,11 @@ H5F__build_name(const char *prefix, const char *file_name, char **full_name/*out
fname_len = HDstrlen(file_name);
/* Allocate a buffer to hold the filename + prefix + possibly the delimiter + terminating null byte */
if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 4)))
if(NULL == (*full_name = (char *)H5MM_malloc(prefix_len + fname_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate filename buffer")
/* Compose the full file name */
HDsnprintf(*full_name, (prefix_len + fname_len + 4), "%s%s%s", prefix,
HDsnprintf(*full_name, (prefix_len + fname_len + 2 + 2), "%s%s%s", prefix, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
((prefix_len == 0 || H5_CHECK_DELIMITER(prefix[prefix_len - 1])) ? "" : H5_DIR_SEPS), file_name);
done:

View File

@ -673,7 +673,7 @@ H5PL__find_plugin_in_path(const H5PL_search_params_t *search_params, hbool_t *fo
size_t len;
/* Allocate & initialize the path name */
len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 5 /*\0*/;
len = HDstrlen(dir) + HDstrlen(H5PL_PATH_SEPARATOR) + HDstrlen(dp->d_name) + 1 /*\0*/ + 4; /* Extra "+4" to quiet GCC warning - 2019/07/05, QAK */
if (NULL == (path = (char *)H5MM_calloc(len)))
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTALLOC, FAIL, "can't allocate memory for path")

View File

@ -5235,7 +5235,7 @@ H5P__get_class_path(H5P_genclass_t *pclass)
/* Allocate enough space for the parent class's path, plus the '/'
* separator, this class's name and the string terminator
*/
ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 3 + 1;
ret_str_len = HDstrlen(par_path) + HDstrlen(pclass->name) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */
if(NULL == (ret_value = (char *)H5MM_malloc(ret_str_len)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for class name")

View File

@ -1301,11 +1301,11 @@ H5_combine_path(const char* path1, const char* path2, char **full_name /*out*/)
* Allocate a buffer to hold path1 + path2 + possibly the delimiter
* + terminating null byte
*/
if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 4)))
if(NULL == (*full_name = (char *)H5MM_malloc(path1_len + path2_len + 2 + 2))) /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate filename buffer")
/* Compose the full file name */
HDsnprintf(*full_name, (path1_len + path2_len + 4), "%s%s%s", path1,
HDsnprintf(*full_name, (path1_len + path2_len + 2 + 2), "%s%s%s", path1, /* Extra "+2" to quiet GCC warning - 2019/07/05, QAK */
(H5_CHECK_DELIMITER(path1[path1_len - 1]) ? "" : H5_DIR_SEPS), path2);
} /* end else */

View File

@ -275,6 +275,14 @@ error:
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* 'name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
enough_room(hid_t fapl)
{
@ -315,6 +323,7 @@ done:
return ret_value;
}
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------

View File

@ -320,6 +320,14 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* 'full_desc' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_long_desc(void)
{
@ -374,6 +382,7 @@ error:
return -1;
} /* end test_long_desc() */
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------

View File

@ -539,6 +539,14 @@ get_fill_size(const fheap_test_param_t *tparam)
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* test_desc in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
begin_test(fheap_test_param_t *tparam, const char *base_desc,
fheap_heap_ids_t *keep_ids, size_t *fill_size)
@ -567,6 +575,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc,
/* Success */
return(0);
} /* end begin_test() */
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------

View File

@ -672,6 +672,14 @@ error:
*
******************************************************************************
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* 'member_file_name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
test_get_file_image(const char * test_banner,
const int file_name_num,
@ -938,6 +946,7 @@ test_get_file_image(const char * test_banner,
error:
return 1;
} /* end test_get_file_image() */
#pragma GCC diagnostic pop
/******************************************************************************

View File

@ -190,6 +190,14 @@ h5_clean_files(const char *base_name[], hid_t fapl)
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* sub_filename in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
void
h5_delete_test_file(const char *base_name, hid_t fapl)
{
@ -239,6 +247,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl)
return;
} /* end h5_delete_test_file() */
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
@ -1344,6 +1353,14 @@ h5_dump_info_object(MPI_Info info)
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* temp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
h5_stat_size_t
h5_get_file_size(const char *filename, hid_t fapl)
{
@ -1445,12 +1462,14 @@ h5_get_file_size(const char *filename, hid_t fapl)
return(-1);
} /* end get_file_size() */
#pragma GCC diagnostic pop
/*
* This routine is designed to provide equivalent functionality to 'printf'
* and allow easy replacement for environments which don't have stdin/stdout
* available. (i.e. Windows & the Mac)
*/
H5_ATTR_FORMAT(printf, 1, 2)
int
print_func(const char *format, ...)
{
@ -2016,7 +2035,7 @@ error:
*
*-------------------------------------------------------------------------
*/
const char *
H5_ATTR_PURE const char *
h5_get_version_string(H5F_libver_t libver)
{
return(LIBVER_NAMES[libver]);

View File

@ -108,28 +108,28 @@ parse_option(int argc, char * const argv[])
filename_g = optarg;
break;
case 'n': /* number of planes to write/read */
if ((nplanes_g = atoi(optarg)) <= 0){
if ((nplanes_g = HDatoi(optarg)) <= 0){
fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
};
break;
case 's': /* use swmr file open mode */
if ((use_swmr_g = atoi(optarg)) < 0){
if ((use_swmr_g = HDatoi(optarg)) < 0){
fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
usage(progname_g);
Hgoto_error(-1);
};
break;
case 'y': /* Number of planes per chunk */
if ((chunkplanes_g = atoi(optarg)) <= 0){
if ((chunkplanes_g = HDatoi(optarg)) <= 0){
fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
};
break;
case 'z': /* size of chunk=(z,z) */
if ((chunksize_g = atoi(optarg)) <= 0){
if ((chunksize_g = HDatoi(optarg)) <= 0){
fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);

View File

@ -769,6 +769,14 @@ error:
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* 'first_name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
@ -825,6 +833,7 @@ test_family_opens(char *fname, hid_t fa_pl)
error:
return -1;
} /* end test_family_opens() */
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
@ -1027,6 +1036,14 @@ error:
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* 'newname_individual', etc. in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_family_compat(void)
{
@ -1110,6 +1127,7 @@ error:
return -1;
} /* end test_family_compat() */
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
@ -1125,6 +1143,14 @@ error:
*
*-------------------------------------------------------------------------
*/
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* 'sf_name' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_multi_opens(char *fname)
{
@ -1142,6 +1168,7 @@ test_multi_opens(char *fname)
return(fid >= 0 ? FAIL : SUCCEED);
} /* end test_multi_opens() */
#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------

View File

@ -831,7 +831,7 @@ static hsize_t diff_datum(
nelmts = ((hvl_t *)((void *)mem1))->len;
for (j = 0; j < nelmts; j++)
nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index,
nfound += diff_datum(((char *) (((hvl_t *)((void *)mem1))->p)) + j * size, ((char *) (((hvl_t *)((void *)mem2))->p)) + j * size, memb_type, index, /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
rank, dims, acc, pos, opts, obj1, obj2, container1_id, container2_id, ph, members);
H5Tclose(memb_type);

View File

@ -184,7 +184,7 @@ traverse_cb(hid_t loc_id, const char *path, const H5L_info_t *linfo,
if(udata->is_absolute) {
size_t base_len = HDstrlen(udata->base_grp_name);
size_t add_slash = base_len ? ((udata->base_grp_name)[base_len - 1] != '/') : 1;
size_t new_name_len = base_len + add_slash + HDstrlen(path) + 4;
size_t new_name_len = base_len + add_slash + HDstrlen(path) + 1 + 3; /* Extra "+3" to quiet GCC warning - 2019/07/05, QAK */
if(NULL == (new_name = (char*)HDmalloc(new_name_len)))
return(H5_ITER_ERROR);

View File

@ -692,7 +692,7 @@ static int copy_refs_attr(hid_t loc_in,
size_t idx = (i * msize) + H5Tget_member_offset(mtype_id, ref_comp_index[j]);
hobj_ref_t ref_out;
if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt)<0)
if (update_ref_value(attr_id, H5R_OBJECT, (hobj_ref_t *)((void *)(((char *)buf)+idx)), fidout, &ref_out, travt) < 0) /* Extra (void *) cast to quiet "cast to create alignment" warning - 2019/07/05, QAK */
continue;
HDmemcpy(((char *)buf)+idx, &ref_out, ref_comp_size[j]);
} /* if */

View File

@ -318,7 +318,6 @@ do_pio(parameters param)
set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTART);
hrc = do_write(&res, &fd, &param, ndsets, nbytes, buf_size, buffer);
hrc == SUCCESS;
set_time(res.timers, HDF5_FINE_WRITE_FIXED_DIMS, TSTOP);
VRFY((hrc == SUCCESS), "do_write failed");

View File

@ -1262,7 +1262,15 @@ done:
* Programmer: Albert Cheng 2001/12/12
* Modifications: Support for file drivers. Christian Chilan, April, 2008
*/
static void
/* Disable warning for "format not a string literal" here -QAK */
/*
* This pragma only needs to surround the snprintf() calls with
* 'temp' in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static void
do_cleanupfile(iotype iot, char *filename)
{
char temp[2048];
@ -1275,12 +1283,12 @@ do_cleanupfile(iotype iot, char *filename)
if (clean_file_g){
switch (iot) {
case POSIXIO:
HDremove(filename);
break;
case POSIXIO:
HDremove(filename);
break;
case HDF5:
driver = H5Pget_driver(fapl);
case HDF5:
driver = H5Pget_driver(fapl);
if (driver == H5FD_FAMILY) {
for (j = 0; /*void*/; j++) {
@ -1313,14 +1321,15 @@ do_cleanupfile(iotype iot, char *filename)
HDremove(filename);
}
H5Pclose(fapl);
break;
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
HDassert(0 && "Unknown IO type");
break;
}
break;
default:
/* unknown request */
HDfprintf(stderr, "Unknown IO type request (%d)\n", (int)iot);
HDassert(0 && "Unknown IO type");
break;
}
}
}
#pragma GCC diagnostic pop