[clinfo] 22/30: Cleanups by clang's static analyzer
Andreas Beckmann
anbe at moszumanska.debian.org
Tue Apr 28 12:53:53 UTC 2015
This is an automated email from the git hooks/post-receive script.
anbe pushed a commit to branch master
in repository clinfo.
commit a21c4d8bb8f70709ccc7ca6bcdba642d91c14a09
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date: Wed Mar 25 17:55:28 2015 +0100
Cleanups by clang's static analyzer
---
src/clinfo.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/clinfo.c b/src/clinfo.c
index f831115..221ab17 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -1360,16 +1360,23 @@ int device_info_fpconf(cl_device_id dev, cl_device_info param, const char *pname
const char * const *fpstr = (output_mode == CLINFO_HUMAN ?
fp_conf_str : fp_conf_raw_str);
if (output_mode == CLINFO_HUMAN) {
- const char *why;
+ const char *why = na;
switch (param) {
case CL_DEVICE_HALF_FP_CONFIG:
- why = get_it ? chk->has_half : na;
+ if (get_it)
+ why = chk->has_half;
break;
case CL_DEVICE_SINGLE_FP_CONFIG:
why = core;
break;
case CL_DEVICE_DOUBLE_FP_CONFIG:
- why = get_it ? chk->has_double : na;
+ if (get_it)
+ why = chk->has_double;
+ break;
+ default:
+ /* "this can't happen" (unless OpenCL starts supporting _other_ floating-point formats, maybe) */
+ fprintf(stderr, "unsupported floating-point configuration parameter %s\n", pname);
+
}
/* show 'why' it's being shown */
szval += sprintf(strbuf, "(%s)", why);
@@ -1831,10 +1838,11 @@ printDeviceInfo(const cl_device_id *device, cl_uint d,
}
}
- // and finally the extensions
- printf("%s" I1_STR "%s\n", line_pfx, (output_mode == CLINFO_HUMAN ?
- extensions_traits->pname :
- extensions_traits->sname), extensions);
+ // and finally the extensions, if we retrieved them
+ if (extensions)
+ printf("%s" I1_STR "%s\n", line_pfx, (output_mode == CLINFO_HUMAN ?
+ extensions_traits->pname :
+ extensions_traits->sname), extensions);
free(extensions);
extensions = NULL;
}
@@ -2306,8 +2314,8 @@ void checkNullCtxFromType()
void checkNullBehavior(void)
{
cl_device_id *dev = NULL;
- cl_uint pidx = num_platforms;
cl_uint p = 0;
+ cl_uint pidx;
printf("NULL platform behavior\n");
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git
More information about the Pkg-opencl-commits
mailing list