[OpenWrt-Devel] [PATCH uci 2/2] build: Add -Wclobbered to detect problems with longjmp

Petr Štetiar ynezz at true.cz
Mon Nov 4 19:27:07 EST 2019


Hi,

Hauke Mehrtens <hauke at hauke-m.de> [2019-11-01 17:06:34]:

> +ADD_DEFINITIONS(-Os -Wall -Werror -Wclobbered --std=gnu99 -g3 -I. -DUCI_PREFIX="${CMAKE_INSTALL_PREFIX}")

is there any reason to not use -Wextra directly?

 list.c:140:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 file.c:572:51: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 file.c:850:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 file.c:865:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 delta.c:199:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
 parse.c:80:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
 parse.c:81:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
 file.c:572:51: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 file.c:850:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 file.c:865:15: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 delta.c:199:6: error: this statement may fall through [-Werror=implicit-fallthrough=]
 parse.c:80:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
 parse.c:81:12: error: this statement may fall through [-Werror=implicit-fallthrough=]
 ucimap.c:146:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:151:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:243:34: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:247:9: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:254:39: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:258:9: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:285:34: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:363:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:563:12: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:753:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
 ucimap.c:879:17: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]

Yousong Zhou <yszhou4tech at gmail.com> [2019-11-04 11:29:05]:

> The -Wclobber check can produce false-positives right?

I didn't looked deeper, but GCC 6,7,8,9 on x86/64 reports following:

 list.c:626:21: error: variable ‘prev’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
  626 |  struct uci_option *prev = NULL;
      |                     ^~~~

 list.c:627:14: error: variable ‘value2’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered]
  627 |  const char *value2 = NULL;
      |              ^~~~~~

but clang 9,10 on x86/64 doesn't.

-- ynezz

_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list