mbox series

[0/3] fix diff-parseopt regressions

Message ID 20190524092442.701-1-pclouds@gmail.com (mailing list archive)
Headers show
Series fix diff-parseopt regressions | expand

Message

Duy Nguyen May 24, 2019, 9:24 a.m. UTC
This should fix the diff tests failure on s360x. It's a serious problem
and I plan to do something to prevent it from happening again.

The second patch should bring '-U' (no argument) back. Whether it makes
sense to accept this behavior is not part of this conversion. We can
deal with that later.

The third patch also brings back a corner case behavior of
--inter-hunk-context and as a result strengthens OPT_INTEGER() error
handling a bit.

Nguyễn Thái Ngọc Duy (3):
  diff-parseopt: correct variable types that are used by parseopt
  diff-parseopt: restore -U (no argument) behavior
  parse-options: check empty value in OPT_INTEGER and OPT_ABBREV

 diff.c                                    | 10 ++--
 diff.h                                    | 70 +++++++++++------------
 parse-options-cb.c                        |  3 +
 parse-options.c                           |  3 +
 t/t4013-diff-various.sh                   |  2 +
 t/t4013/diff.diff_-U1_initial..side (new) | 29 ++++++++++
 t/t4013/diff.diff_-U2_initial..side (new) | 31 ++++++++++
 t/t4013/diff.diff_-U_initial..side (new)  | 32 +++++++++++
 8 files changed, 141 insertions(+), 39 deletions(-)
 create mode 100644 t/t4013/diff.diff_-U1_initial..side
 create mode 100644 t/t4013/diff.diff_-U2_initial..side
 create mode 100644 t/t4013/diff.diff_-U_initial..side

Comments

Todd Zullinger May 24, 2019, 5:36 p.m. UTC | #1
Hi,

Nguyễn Thái Ngọc Duy wrote:
> This should fix the diff tests failure on s360x. It's a serious problem
> and I plan to do something to prevent it from happening again.

Thanks for looking at this!

I applied this on top of master/2.22.0-rc1 and see a number
of compiler errors using gcc-9.1.1 with fedora's standard
compiler options for rpm builds.

Below are the compiler errors.  This was from an s390x
build, but other arches had the same errors.  The complete
build log is available here for a few weeks:
https://kojipkgs.fedoraproject.org//work/tasks/3166/35033166/build.log

cc -o credential-store.o -c -MF ./.depend/credential-store.o.d -MQ credential-store.o -MMD -MP   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"s390x\"" -DUSE_LIBPCRE2 -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"'  credential-store.c
In file included from credential-store.c:5:
credential-store.c: In function 'cmd_main':
credential-store.c:156:25: warning: passing argument 1 of '_opt_string' from incompatible pointer type [-Wincompatible-pointer-types]
  156 |   OPT_STRING(0, "file", &file, "path",
      |                         ^~~~~
      |                         |
      |                         char **
parse-options.h:152:82: note: in definition of macro 'OPT_STRING_F'
  152 | #define OPT_STRING_F(s, l, v, a, h, f)   { OPTION_STRING,  (s), (l), _opt_string(v), (a), (h), (f) }
      |                                                                                  ^
credential-store.c:156:3: note: in expansion of macro 'OPT_STRING'
  156 |   OPT_STRING(0, "file", &file, "path",
      |   ^~~~~~~~~~
parse-options.h:132:42: note: expected 'const char **' but argument is of type 'char **'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:139:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  139 | DEFINE_OPT_TYPE_CHECK(string, const char *)
      | ^~~~~~~~~~~~~~~~~~~~~
    * new link flags


cc -o apply.o -c -MF ./.depend/apply.o.d -MQ apply.o -MMD -MP   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"s390x\"" -DUSE_LIBPCRE2 -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"'  apply.c
In file included from apply.c:20:
apply.c: In function 'apply_parse_options':
apply.c:5002:26: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5002 |   OPT_INTEGER('C', NULL, &state->p_context,
      |                          ^~~~~~~~~~~~~~~~~
      |                          |
      |                          unsigned int *
parse-options.h:153:79: note: in definition of macro 'OPT_INTEGER_F'
  153 | #define OPT_INTEGER_F(s, l, v, h, f)     { OPTION_INTEGER, (s), (l), _opt_int(v), N_("n"), (h), (f) }
      |                                                                               ^
apply.c:5002:3: note: in expansion of macro 'OPT_INTEGER'
 5002 |   OPT_INTEGER('C', NULL, &state->p_context,
      |   ^~~~~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~


cc -o diff.o -c -MF ./.depend/diff.o.d -MQ diff.o -MMD -MP   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"s390x\"" -DUSE_LIBPCRE2 -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"'  diff.c
In file included from diff.c:26:
diff.c: In function 'prep_parse_options':
diff.c:5278:37: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5278 |   OPT_BOOL('W', "function-context", &options->flags.funccontext,
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     |
      |                                     unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5278:3: note: in expansion of macro 'OPT_BOOL'
 5278 |   OPT_BOOL('W', "function-context", &options->flags.funccontext,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5342:29: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5342 |   OPT_BOOL(0, "full-index", &options->flags.full_index,
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             |
      |                             unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5342:3: note: in expansion of macro 'OPT_BOOL'
 5342 |   OPT_BOOL(0, "full-index", &options->flags.full_index,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5400:37: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5400 |   OPT_BOOL(0, "find-copies-harder", &options->flags.find_copies_harder,
      |                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                     |
      |                                     unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5400:3: note: in expansion of macro 'OPT_BOOL'
 5400 |   OPT_BOOL(0, "find-copies-harder", &options->flags.find_copies_harder,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5405:31: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5405 |   OPT_BOOL(0, "rename-empty", &options->flags.rename_empty,
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                               |
      |                               unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5405:3: note: in expansion of macro 'OPT_BOOL'
 5405 |   OPT_BOOL(0, "rename-empty", &options->flags.rename_empty,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5469:25: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5469 |   OPT_BOOL('a', "text", &options->flags.text,
      |                         ^~~~~~~~~~~~~~~~~~~~
      |                         |
      |                         unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5469:3: note: in expansion of macro 'OPT_BOOL'
 5469 |   OPT_BOOL('a', "text", &options->flags.text,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5471:23: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5471 |   OPT_BOOL('R', NULL, &options->flags.reverse_diff,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                       |
      |                       unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5471:3: note: in expansion of macro 'OPT_BOOL'
 5471 |   OPT_BOOL('R', NULL, &options->flags.reverse_diff,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5473:28: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5473 |   OPT_BOOL(0, "exit-code", &options->flags.exit_with_status,
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                            |
      |                            unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5473:3: note: in expansion of macro 'OPT_BOOL'
 5473 |   OPT_BOOL(0, "exit-code", &options->flags.exit_with_status,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5475:24: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5475 |   OPT_BOOL(0, "quiet", &options->flags.quick,
      |                        ^~~~~~~~~~~~~~~~~~~~~
      |                        |
      |                        unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5475:3: note: in expansion of macro 'OPT_BOOL'
 5475 |   OPT_BOOL(0, "quiet", &options->flags.quick,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5477:27: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5477 |   OPT_BOOL(0, "ext-diff", &options->flags.allow_external,
      |                           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                           |
      |                           unsigned int *
parse-options.h:147:78: note: in definition of macro 'OPT_SET_INT_F'
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                              ^
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
diff.c:5477:3: note: in expansion of macro 'OPT_BOOL'
 5477 |   OPT_BOOL(0, "ext-diff", &options->flags.allow_external,
      |   ^~~~~~~~
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5502:31: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5502 |   OPT_BIT_F(0, "pickaxe-all", &options->pickaxe_opts,
      |                               ^~~~~~~~~~~~~~~~~~~~~~
      |                               |
      |                               unsigned int *
parse-options.h:143:70: note: in definition of macro 'OPT_BIT_F'
  143 | #define OPT_BIT_F(s, l, v, h, b, f) { OPTION_BIT, (s), (l), _opt_int(v), NULL, (h), \
      |                                                                      ^
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~
diff.c:5505:33: warning: pointer targets in passing argument 1 of '_opt_int' differ in signedness [-Wpointer-sign]
 5505 |   OPT_BIT_F(0, "pickaxe-regex", &options->pickaxe_opts,
      |                                 ^~~~~~~~~~~~~~~~~~~~~~
      |                                 |
      |                                 unsigned int *
parse-options.h:143:70: note: in definition of macro 'OPT_BIT_F'
  143 | #define OPT_BIT_F(s, l, v, h, b, f) { OPTION_BIT, (s), (l), _opt_int(v), NULL, (h), \
      |                                                                      ^
parse-options.h:132:42: note: expected 'int *' but argument is of type 'unsigned int *'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                          ^
parse-options.h:137:1: note: in expansion of macro 'DEFINE_OPT_TYPE_CHECK'
  137 | DEFINE_OPT_TYPE_CHECK(int, int)
      | ^~~~~~~~~~~~~~~~~~~~~


cc -o parse-options.o -c -MF ./.depend/parse-options.o.d -MQ parse-options.o -MMD -MP   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"s390x\"" -DUSE_LIBPCRE2 -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"'  parse-options.c
In file included from parse-options.c:2:
parse-options.h:140:43: warning: 'struct string_list' declared inside parameter list will not be visible outside of this definition or declaration
  140 | DEFINE_OPT_TYPE_CHECK(string_list, struct string_list)
      |                                           ^~~~~~~~~~~
parse-options.h:132:36: note: in definition of macro 'DEFINE_OPT_TYPE_CHECK'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                    ^~~~

cc -o parse-options-cb.o -c -MF ./.depend/parse-options-cb.o.d -MQ parse-options-cb.o -MMD -MP   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"s390x\"" -DUSE_LIBPCRE2 -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"'  parse-options-cb.c
In file included from parse-options-cb.c:2:
parse-options.h:140:43: warning: 'struct string_list' declared inside parameter list will not be visible outside of this definition or declaration
  140 | DEFINE_OPT_TYPE_CHECK(string_list, struct string_list)
      |                                           ^~~~~~~~~~~
parse-options.h:132:36: note: in definition of macro 'DEFINE_OPT_TYPE_CHECK'
  132 |  static inline void *_opt_ ## name(type *p) \
      |                                    ^~~~


cc -o imap-send.o -c -MF ./.depend/imap-send.o.d -MQ imap-send.o -MMD -MP   -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=zEC12 -mtune=z13 -fasynchronous-unwind-tables -fstack-clash-protection -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"s390x\"" -DUSE_LIBPCRE2 -DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DSHA1_DC -DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0 -DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\"" -DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK  -DHAVE_PATHS_H -DHAVE_DEV_TTY -DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM '-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES -DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"'  imap-send.c
In file included from imap-send.c:29:
parse-options.h:316:37: error: initializer element is not constant
  316 |  { OPTION_CALLBACK, 'v', "verbose", _opt_int(var), NULL, N_("be more verbose"), \
      |                                     ^~~~~~~~
imap-send.c:51:2: note: in expansion of macro 'OPT__VERBOSITY'
   51 |  OPT__VERBOSITY(&verbosity),
      |  ^~~~~~~~~~~~~~
parse-options.h:316:37: note: (near initialization for 'imap_send_options[0].value')
  316 |  { OPTION_CALLBACK, 'v', "verbose", _opt_int(var), NULL, N_("be more verbose"), \
      |                                     ^~~~~~~~
imap-send.c:51:2: note: in expansion of macro 'OPT__VERBOSITY'
   51 |  OPT__VERBOSITY(&verbosity),
      |  ^~~~~~~~~~~~~~
parse-options.h:318:35: error: initializer element is not constant
  318 |  { OPTION_CALLBACK, 'q', "quiet", _opt_int(var), NULL, N_("be more quiet"), \
      |                                   ^~~~~~~~
imap-send.c:51:2: note: in expansion of macro 'OPT__VERBOSITY'
   51 |  OPT__VERBOSITY(&verbosity),
      |  ^~~~~~~~~~~~~~
parse-options.h:318:35: note: (near initialization for 'imap_send_options[1].value')
  318 |  { OPTION_CALLBACK, 'q', "quiet", _opt_int(var), NULL, N_("be more quiet"), \
      |                                   ^~~~~~~~
imap-send.c:51:2: note: in expansion of macro 'OPT__VERBOSITY'
   51 |  OPT__VERBOSITY(&verbosity),
      |  ^~~~~~~~~~~~~~
parse-options.h:147:69: error: initializer element is not constant
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                     ^~~~~~~~
parse-options.h:149:37: note: in expansion of macro 'OPT_SET_INT_F'
  149 | #define OPT_BOOL_F(s, l, v, h, f)   OPT_SET_INT_F(s, l, v, h, 1, f)
      |                                     ^~~~~~~~~~~~~
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
imap-send.c:52:2: note: in expansion of macro 'OPT_BOOL'
   52 |  OPT_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"),
      |  ^~~~~~~~
parse-options.h:147:69: note: (near initialization for 'imap_send_options[2].value')
  147 | #define OPT_SET_INT_F(s, l, v, h, i, f) { OPTION_SET_INT, (s), (l), _opt_int(v), NULL, \
      |                                                                     ^~~~~~~~
parse-options.h:149:37: note: in expansion of macro 'OPT_SET_INT_F'
  149 | #define OPT_BOOL_F(s, l, v, h, f)   OPT_SET_INT_F(s, l, v, h, 1, f)
      |                                     ^~~~~~~~~~~~~
parse-options.h:167:37: note: in expansion of macro 'OPT_BOOL_F'
  167 | #define OPT_BOOL(s, l, v, h)        OPT_BOOL_F(s, l, v, h, 0)
      |                                     ^~~~~~~~~~
imap-send.c:52:2: note: in expansion of macro 'OPT_BOOL'
   52 |  OPT_BOOL(0, "curl", &use_curl, "use libcurl to communicate with the IMAP server"),
      |  ^~~~~~~~

Thanks,
Todd Zullinger May 24, 2019, 8:58 p.m. UTC | #2
I wrote:
> Below are the compiler errors.

Well, to be precise, all but imap-send are warnings rather
than errors.
Duy Nguyen May 25, 2019, 10:22 a.m. UTC | #3
On Sat, May 25, 2019 at 12:36 AM Todd Zullinger <tmz@pobox.com> wrote:
>
> Hi,
>
> Nguyễn Thái Ngọc Duy wrote:
> > This should fix the diff tests failure on s360x. It's a serious problem
> > and I plan to do something to prevent it from happening again.
>
> Thanks for looking at this!
>
> I applied this on top of master/2.22.0-rc1 and see a number
> of compiler errors using gcc-9.1.1 with fedora's standard
> compiler options for rpm builds.

That last patch 4/3 is not meant to be applied. Yes I've seen similar
compiler errors too. We have some cleaning up to do in order to build
with the last one. But I think there are no other serious errors
spotted by the last patch (there's one in builtin/column.c, but I
think nobody uses it much, so we can fix it alter)
Todd Zullinger May 25, 2019, 8:48 p.m. UTC | #4
Duy Nguyen wrote:
> On Sat, May 25, 2019 at 12:36 AM Todd Zullinger <tmz@pobox.com> wrote:
>> I applied this on top of master/2.22.0-rc1 and see a number
>> of compiler errors using gcc-9.1.1 with fedora's standard
>> compiler options for rpm builds.
> 
> That last patch 4/3 is not meant to be applied. Yes I've seen similar
> compiler errors too. We have some cleaning up to do in order to build
> with the last one.

D'oh!  Sorry for missing that rather obvious part of your
previous message.  The tests do indeed all pass on all the
architectures in the Fedora build system.

I'll go dig out my dunce cap from back in grade school. ;)

Thanks again,