[hwloc-users] One more silly warning squash
Folks, We are seeing some warnings with the Intel compiler with hwloc (listed below). The warnings seem to be somewhat silly because there already is a cast to "char *" from the string literal, but it seems to expect a cast to "const char *" before casting to "char *". We are maintaining the below patch to workaround it. Can you either integrate this or a better fix for the warning? https://github.com/pmodels/hwloc/commit/fb27dc6e21bac14754d1b50b57f752e37d475704 This is with icc 19.0.3.199. Regards, -- Pavan 8< In directory: /var/lib/jenkins-slave/workspace/balaji-wip-mpich-warnings/compiler/intel/config/ch3-nemesis-tcp/label/centos64_review/modules/hwloc/hwloc CC topology-linux.lo topology-xml-nolibxml.c(228): warning #3179: deprecated conversion of string literal to char* (should be const char*) *beginp = (char *) ""; ^ topology-xml-nolibxml.c(304): warning #3179: deprecated conversion of string literal to char* (should be const char*) nstate->tagname = (char *) "topology"; ^ topology-xml.c(707): warning #3179: deprecated conversion of string literal to char* (should be const char*) char *buffer = (char *) ""; ^ topology-xml-libxml.c(158): warning #3179: deprecated conversion of string literal to char* (should be const char*) *beginp = (char *) ""; ^ CC topology-hardwired.lo traversal.c(598): warning #3179: deprecated conversion of string literal to char* (should be const char*) const char *quote = strchr(info->value, ' ') ? "\"" : ""; ^ CC topology-x86.lo topology-linux.c(4764): warning #3179: deprecated conversion of string literal to char* (should be const char*) data->dumped_hwdata_dirname = (char *) RUNSTATEDIR "/hwloc/"; 8< ___ hwloc-users mailing list hwloc-users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/hwloc-users
Re: [hwloc-users] One more silly warning squash
Hello, Balaji, Pavan via hwloc-users, le lun. 01 juin 2020 03:39:02 +, a ecrit: > We are seeing some warnings with the Intel compiler with hwloc (listed > below). The warnings seem to be somewhat silly because there already is a > cast to "char *" from the string literal, Well, I'd agree with icc that casting a string literal to (char*) is in general a bad idea :) > but it seems to expect a cast to "const char *" before casting to "char *". > We are maintaining the below patch to workaround it. Can you either > integrate this or a better fix for the warning? > > https://github.com/pmodels/hwloc/commit/fb27dc6e21bac14754d1b50b57f752e37d475704 I fixed them except: > CC topology-hardwired.lo > traversal.c(598): warning #3179: deprecated conversion of string literal to > char* (should be const char*) > const char *quote = strchr(info->value, ' ') ? "\"" : ""; > ^ Which is more silly (these are already const char* in essence) and just seems to me like icc's limited analysis. Our version of icc doesn't get these, could you check whether the attached patch avoids the warning? (we should really not need a cast to const char*) Samuel diff --git a/hwloc/traversal.c b/hwloc/traversal.c index 4062a19d..14549422 100644 --- a/hwloc/traversal.c +++ b/hwloc/traversal.c @@ -654,7 +654,11 @@ hwloc_obj_attr_snprintf(char * __hwloc_restrict string, size_t size, hwloc_obj_t unsigned i; for(i=0; iinfos_count; i++) { struct hwloc_info_s *info = &obj->infos[i]; - const char *quote = strchr(info->value, ' ') ? "\"" : ""; + const char *quote; + if (strchr(info->value, ' ')) +quote = "\""; + else +quote = ""; res = hwloc_snprintf(tmp, tmplen, "%s%s=%s%s%s", prefix, info->name, ___ hwloc-users mailing list hwloc-users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/hwloc-users
Re: [hwloc-users] One more silly warning squash
Hi Samuel, > On Jun 1, 2020, at 4:06 AM, Samuel Thibault wrote: > could you check whether the attached patch avoids the warning? > (we should really not need a cast to const char*) The attached patch is basically the same as what we are using, isn't it? It does avoid the warning. -- Pavan ___ hwloc-users mailing list hwloc-users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/hwloc-users
Re: [hwloc-users] One more silly warning squash
> On Jun 1, 2020, at 4:10 AM, Balaji, Pavan wrote: >> On Jun 1, 2020, at 4:06 AM, Samuel Thibault wrote: >> could you check whether the attached patch avoids the warning? >> (we should really not need a cast to const char*) > > The attached patch is basically the same as what we are using, isn't it? It > does avoid the warning. Oh, sorry, I see now that you skipped the extra cast in that case. Let me try it out and get back to you. -- Pavan ___ hwloc-users mailing list hwloc-users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/hwloc-users
Re: [hwloc-users] One more silly warning squash
Balaji, Pavan, le lun. 01 juin 2020 09:10:21 +, a ecrit: > > On Jun 1, 2020, at 4:06 AM, Samuel Thibault > > wrote: > > could you check whether the attached patch avoids the warning? > > (we should really not need a cast to const char*) > > The attached patch is basically the same as what we are using, isn't it? Yes, but without the cast, which a compiler should really not require :) > It does avoid the warning. Ok, thanks. Samuel ___ hwloc-users mailing list hwloc-users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/hwloc-users
Re: [hwloc-users] One more silly warning squash
> On Jun 1, 2020, at 4:11 AM, Balaji, Pavan via hwloc-users > wrote: >> On Jun 1, 2020, at 4:10 AM, Balaji, Pavan wrote: >>> On Jun 1, 2020, at 4:06 AM, Samuel Thibault >>> wrote: >>> could you check whether the attached patch avoids the warning? >>> (we should really not need a cast to const char*) >> >> The attached patch is basically the same as what we are using, isn't it? It >> does avoid the warning. > > Oh, sorry, I see now that you skipped the extra cast in that case. Let me > try it out and get back to you. I've verified that the patch works. Thanks, -- Pavan ___ hwloc-users mailing list hwloc-users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/hwloc-users
Re: [hwloc-users] One more silly warning squash
Balaji, Pavan, le mar. 02 juin 2020 09:31:29 +, a ecrit: > > On Jun 1, 2020, at 4:11 AM, Balaji, Pavan via hwloc-users > > wrote: > >> On Jun 1, 2020, at 4:10 AM, Balaji, Pavan wrote: > >>> On Jun 1, 2020, at 4:06 AM, Samuel Thibault > >>> wrote: > >>> could you check whether the attached patch avoids the warning? > >>> (we should really not need a cast to const char*) > >> > >> The attached patch is basically the same as what we are using, isn't it? > >> It does avoid the warning. > > > > Oh, sorry, I see now that you skipped the extra cast in that case. Let me > > try it out and get back to you. > > I've verified that the patch works. Ok, I pushed the fix to master, thanks! Samuel ___ hwloc-users mailing list hwloc-users@lists.open-mpi.org https://lists.open-mpi.org/mailman/listinfo/hwloc-users