ltfs icon indicating copy to clipboard operation
ltfs copied to clipboard

Linux compilation warnings(4)

Open xosevp opened this issue 4 years ago • 3 comments

Fedora 34 x86_64 - kernel-5.11.20 - glibc-2.33 - gcc-11.1.1

BTW, if "-W and -Wall" are added to OPT_FLAGS= , it generates a lot of warnings(929)

tape.c: In function ‘set_tape_attribute’:
tape.c:2946:9: warning: ‘strncpy’ output truncated copying 8 bytes from a string of length 16 [-Wstringop-truncation]
 2946 |         strncpy(t_attr->app_ver, PACKAGE_VERSION, TC_MAM_APP_VERSION_SIZE);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

pathname.c: In function ‘_unorm_quickCheck’:
pathname.c:674:9: warning: ‘unorm_quickCheck_67’ is deprecated [-Wdeprecated-declarations]
  674 |         return unorm_quickCheck(src, -1, nfc ? UNORM_NFC : UNORM_NFD, err);
      |         ^~~~~~
In file included from /usr/include/unicode/platform.h:25,
                 from /usr/include/unicode/ptypes.h:52,
                 from /usr/include/unicode/umachine.h:46,
                 from /usr/include/unicode/utypes.h:38,
                 from /usr/include/unicode/uchar.h:28,
                 from pathname.c:66:
/usr/include/unicode/unorm.h:244:1: note: declared here
  244 | unorm_quickCheck(const UChar *source, int32_t sourcelength,
      | ^~~~~~~~~~~~~~~~

pathname.c: In function ‘_unorm_normalize’:
pathname.c:686:9: warning: ‘unorm_normalize_67’ is deprecated [-Wdeprecated-declarations]
  686 |         return unorm_normalize(src, -1, nfc ? UNORM_NFC : UNORM_NFD, 0, dest ? *dest : NULL, len, err);
      |         ^~~~~~
In file included from /usr/include/unicode/platform.h:25,
                 from /usr/include/unicode/ptypes.h:52,
                 from /usr/include/unicode/umachine.h:46,
                 from /usr/include/unicode/utypes.h:38,
                 from /usr/include/unicode/uchar.h:28,
                 from pathname.c:66:
/usr/include/unicode/unorm.h:218:1: note: declared here
  218 | unorm_normalize(const UChar *source, int32_t sourceLength,
      | ^~~~~~~~~~~~~~~

ltfstrace.c: In function ‘ltfs_header_init’:
ltfstrace.c:489:9: warning: ‘strncpy’ output truncated before terminating nul copying 8 bytes from a string of the same length [-Wstringop-truncation]
  489 |         strncpy(trc_header->signature, LTFS_TRACE_SIGNATURE, strlen(LTFS_TRACE_SIGNATURE));
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

xosevp avatar May 14 '21 14:05 xosevp

The 4 warnings are expected at this time. These are unchecked in the compilers on RHEL7/8.

Need to improve in the future.

piste-jp avatar May 20 '21 01:05 piste-jp

BTW, if "-W and -Wall" are added to OPT_FLAGS= , it generates a lot of warnings(929)

Hmm, it is little bit strange to me. In RHEL7/8, -W and -Wall is already specified. I don't know why it doesn't set in Fedora 34.

piste-jp avatar May 20 '21 01:05 piste-jp

Hmm, it is little bit strange to me. In RHEL7/8, -W and -Wall is already specified. I don't know why it doesn't set in Fedora 34.

You and I are almost right: -Wall is included. -W aka -Wextra is not. It is -Werror that is included:

$ grep "\-W" ltfs/configure.ac 
AM_INIT_AUTOMAKE([-Wall -Werror foreign subdir-objects])
AM_CFLAGS="-Wall -Wsign-compare -fsigned-char ${FUSE_MODULE_CFLAGS} ${UUID_MODULE_CFLAGS} ${LIBXML2_MODULE_CFLAGS} ${ICU_MODULE_CFLAGS} ${SNMP_ENABLE} ${SNMP_MODULE_CFLAGS}"
    AM_CFLAGS="${AM_CFLAGS} -Werror -Wno-deprecated-declarations"
        AM_CFLAGS="${AM_CFLAGS} -Wno-stringop-truncation"
    MODULE_CHECK_LD='-Wl,--no-undefined,--as-needed'

xosevp avatar May 20 '21 22:05 xosevp