]> mj.ucw.cz Git - pciutils.git/commit
setpci: Fix discards const from pointer target
authorRudi Heitbaum <rudi@heitbaum.com>
Sun, 22 Feb 2026 00:47:15 +0000 (00:47 +0000)
committerMartin Mareš <mj@ucw.cz>
Sun, 5 Apr 2026 16:42:27 +0000 (18:42 +0200)
commitf029c3ccc0389ad14136a1727eec8f93fdb4f9cb
tree6c7c9aadfb00adbe440d3194175a5b5e12d03076
parentb76e572e68d97a9ac175c01df341aa0ee9bc0024
setpci: Fix discards const from pointer target

Since glibc-2.43, and for ISO C23, the function strchr that return
pointer into their input arrays now have definitions as macros that
return a pointer to a const-qualified type when the input argument is
a pointer to a const-qualified type.

The char *e is only used as a pointer to const char **opts, and only
used for comparisons, so declare *e as const to address warning.

Fixes:
    setpci.c: In function 'parse_options':
    setpci.c:513:19: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
      513 |             if (e = strchr(opts, *c))
          |                   ^

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
setpci.c