diff --git a/Jenkinsfile-dynamatrix b/Jenkinsfile-dynamatrix index 0092ff7607..a72509d127 100644 --- a/Jenkinsfile-dynamatrix +++ b/Jenkinsfile-dynamatrix @@ -214,7 +214,7 @@ import org.nut.dynamatrix.*; if ( env?.BRANCH_NAME ==~ dynacfgPipeline.branchStableRegex ) { // For our main branches we want all builds in full, // to keep reference for warnings-ng up to date, so do - // not limit ny appliesToChangedFilesRegex categories + // not limit any appliesToChangedFilesRegex categories // Be sure to not make noise in long-lived branches' // overview pages by enabling quick analysis publishing diff --git a/configure.ac b/configure.ac index fa2021ba58..dae626551c 100644 --- a/configure.ac +++ b/configure.ac @@ -5236,6 +5236,10 @@ dnl # some clang versions sanity-check Doxygen style comments, but do not dnl # recognize "\retval" key word. These options try to both ignore the dnl # problematic area, and to add it as recognized (TODO: scripted check dnl # for abilities of the current build's compiler instead) +dnl # -Wno-missing-include-dirs -- do not break on missing include directories, +dnl # whether from user-provided config options, or pkg-config, or our own +dnl # ci_build.sh preparations (e.g. -I${top_srcdir}/tmp/include when it +dnl # is not populated yet) dnl ### Special exclusion picks for clang-medium (same as hard, plus...): dnl # -Wno-global-constructors -- using "const something" out of method context dnl # potentially impacts start-up time and may be prone to race conditions @@ -5281,12 +5285,12 @@ AS_CASE(["${nut_enable_warnings}"], CXXFLAGS="${CXXFLAGS} -Wall" ], [clang-hard], [ - CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage" + CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage" + CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage" ], [clang-medium], [ - CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types-strict -Wno-nullable-to-nonnull-conversion" - CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-global-constructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-nullable-to-nonnull-conversion" + CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types-strict -Wno-nullable-to-nonnull-conversion" + CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-global-constructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-nullable-to-nonnull-conversion" ], [clang-minimal], [ CFLAGS="${CFLAGS} -ferror-limit=0 -Wall -Wextra -Wno-documentation -Wno-documentation-unknown-command -fcomment-block-commands=retval" diff --git a/docs/config-prereqs.txt b/docs/config-prereqs.txt index 7d83e6dae6..91b54d4d5a 100644 --- a/docs/config-prereqs.txt +++ b/docs/config-prereqs.txt @@ -1206,6 +1206,12 @@ For extra compiler coverage, we can install a large selection of versions, although to meet NUT CI farm expectations we also need to expose "numbered" filenames, as automated below: ------ +# NOTE: not all compiler versions may be served, some are obsoleted over time. +# Check current distro repository offers with: +:; pkg info -r '*clang*' '*gcc*' +:; pkg search -r '*bin/g++*' +:; pkg search -r '*bin/clang++*' + :; pkg install \ gcc-48 gcc-49 gcc-5 gcc-6 gcc-7 gcc-9 gcc-10 gcc-11 \ clang-80 clang-90 \ @@ -1213,17 +1219,18 @@ filenames, as automated below: # As of this writing, clang-13 refused to link (claiming issues with # --fuse-ld which was never specified) on OI; maybe later it will: -:; pkg install \ - developer/clang-13 runtime/clang-13 +#:; pkg install \ +# developer/clang-13 runtime/clang-13 -# With OI 2024.04 there's also clang-18 available in the mix: +# With OI 2024.04 there's also clang-18 available in the mix, and as of +# 2025 packaging, clang-19 as well: :; pkg install \ - developer/clang-18 runtime/clang-18 + developer/clang-19 runtime/clang-19 # Get clang-cpp-X visible in standard PATH (for CI to reference the right one), # and make sure other frontends are exposed with versions (not all OI distro # releases have such symlinks packaged right), e.g.: -:; (cd /usr/bin && for X in 8 9 13 18 ; do for T in "" "++" "-cpp"; do \ +:; (cd /usr/bin && for X in 8 9 19 ; do for T in "" "++" "-cpp"; do \ ln -fs "../clang/$X.0/bin/clang$T" "clang${T}-${X}" ; \ done; done) @@ -1286,14 +1293,22 @@ site for setup details. # Optionally, make the environment comfortable, e.g.: :; pkg install sudo bash application/mc wget rsync pigz pbzip2 p7zip top -# NOTE: OmniOS currently does not deliver clang in its Core/Extra repositories +# NOTE: not all compiler versions may be served, some are obsoleted over time. +# While OmniOS LTS 151046 offers a range of clang 13 to 17, current stable +# includes also 18 and 19. OmniOS does not provide implicit (not numbered) +# packages for clang or gcc. Check your distro repository offers with: +:; pkg info -r '*clang*' '*gcc*' +:; pkg search -r '*bin/g++*' +:; pkg search -r '*bin/clang++*' + :; pkg install \ developer/build/autoconf developer/build/automake \ developer/build/libtool library/libtool/libltdl \ build-essential ccache git developer/pkg-config \ runtime/perl \ asciidoc \ - libgd + libgd \ + developer/clang-17 :; pkg install \ net-snmp diff --git a/drivers/libusb1.c b/drivers/libusb1.c index be7ebf72a7..8b2459c09e 100644 --- a/drivers/libusb1.c +++ b/drivers/libusb1.c @@ -730,8 +730,8 @@ static int nut_libusb_open(libusb_device_handle **udevp, #if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) ) # pragma GCC diagnostic pop #endif - upsdebugx(2, "HID descriptor too long %d (max %d)", - rdlen, UINT16_MAX); + upsdebugx(2, "HID descriptor too long %d (max %" PRIuMAX ")", + rdlen, (uintmax_t)UINT16_MAX); goto next_device; } diff --git a/drivers/nut-libfreeipmi.c b/drivers/nut-libfreeipmi.c index 02f87b090c..8e37414772 100644 --- a/drivers/nut-libfreeipmi.c +++ b/drivers/nut-libfreeipmi.c @@ -230,7 +230,7 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev) if (area_length > (int)UINT8_MAX) { libfreeipmi_cleanup(); fatal_with_errno(EXIT_FAILURE, - "nut_ipmi_open: got area_length %d is too large for libfreeipmi", + "nut_ipmi_open: got area_length %u is too large for libfreeipmi", area_length); } @@ -794,7 +794,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) if (tmp_entity_id == entity_id && tmp_entity_instance == entity_instance) { - upsdebugx (1, "Found record id = %u for device id %u", + upsdebugx (1, "Found record id = %u for device id %i", record_id, ipmi_dev->ipmi_id); /* Add it to the tracked list */ @@ -817,7 +817,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev) #endif /* HAVE_FREEIPMI_11X_12X */ if (ipmi_dev->sensors_count > INT_MAX) { - upsdebugx(1, "%s: Found %i sensors which is too many", + upsdebugx(1, "%s: Found %u sensors which is too many", __func__, ipmi_dev->sensors_count); } return (int)ipmi_dev->sensors_count; diff --git a/drivers/optiups.c b/drivers/optiups.c index 4fe2cbb1ec..f1fbb79efe 100644 --- a/drivers/optiups.c +++ b/drivers/optiups.c @@ -28,7 +28,7 @@ #include "nut_stdint.h" #define DRIVER_NAME "Opti-UPS driver" -#define DRIVER_VERSION "1.06" +#define DRIVER_VERSION "1.07" /* driver description structure */ upsdrv_info_t upsdrv_info = { @@ -77,7 +77,7 @@ upsdrv_info_t upsdrv_info = { #define OPTI_POWERUP "powerup" /* All serial commands put their response in the same buffer space */ -static char _buf[256]; +static char opti_buf[256]; /* Model */ static int optimodel = 0; @@ -108,14 +108,14 @@ typedef struct ezfill_s { /* These can be polled right into a string usable by NUT. * Others such as "AG" and "BV" require some transformation of the return value */ -static ezfill_t _pollv[] = { +static ezfill_t opti_pollv[] = { { "NV", "input.voltage", 0 }, { "OL", "ups.load", 1.0 }, { "OV", "output.voltage", 0 }, { "FF", "input.frequency", 0.1 }, { "BT", "ups.temperature", 0 }, }; -static ezfill_t _pollv_zinto[] = { +static ezfill_t opti_pollv_zinto[] = { { "NV", "input.voltage", 2.0 }, { "OL", "ups.load", 1.0 }, { "OV", "output.voltage", 2.0 }, @@ -131,14 +131,14 @@ static ezfill_t _pollv_zinto[] = { * I suspect this will be the case for other Opti-UPS models, but as I can only * test with a PS-1440RM at 230V the change is only applied to PowerSeries models. */ -static ezfill_t _pollv_ps[] = { +static ezfill_t opti_pollv_ps[] = { { "OL", "ups.load", 1.0 }, { "FF", "input.frequency", 0.1 }, { "BT", "ups.temperature", 0 }, }; /* model "IO" is parsed differently in upsdrv_initinfo() */ -static ezfill_t _initv[] = { +static ezfill_t opti_initv[] = { { "IM", "ups.mfr", 0 }, { "IZ", "ups.serial", 0 }, { "IS", "ups.firmware", 0 }, @@ -151,24 +151,24 @@ static inline ssize_t optireadline(void) { ssize_t r; usleep(150000); - r = ser_get_line(upsfd, _buf, sizeof(_buf), ENDCHAR, IGNCHARS, 0, 500000 ); - _buf[sizeof(_buf)-1] = 0; + r = ser_get_line(upsfd, opti_buf, sizeof(opti_buf), ENDCHAR, IGNCHARS, 0, 500000 ); + opti_buf[sizeof(opti_buf)-1] = 0; if ( r > 0 ) { - if ( r < (int)sizeof(_buf) ) - _buf[r] = 0; - if ( _buf[0] == 0x15 ) + if ( r < (int)sizeof(opti_buf) ) + opti_buf[r] = 0; + if ( opti_buf[0] == 0x15 ) { r=-2; upsdebugx(1, "READ: "); } - if ( _buf[0] == 0x06 ) + if ( opti_buf[0] == 0x06 ) { upsdebugx(2, "READ: "); } else { - upsdebugx(2, "READ: \"%s\"", _buf ); + upsdebugx(2, "READ: \"%s\"", opti_buf ); } } else @@ -176,7 +176,7 @@ static inline ssize_t optireadline(void) return r; } -/* Send a command and read the response. Command response is in global _buf. +/* Send a command and read the response. Command response is in global opti_buf. * Return * > 0 implies success. * -1 serial timeout @@ -221,12 +221,12 @@ static void optifill( ezfill_t *a, size_t len ) } if ( a[i].scale > 1e-20 ) { - float f = strtol( _buf, NULL, 10 ) * a[i].scale; + float f = strtol( opti_buf, NULL, 10 ) * a[i].scale; dstate_setinfo( a[i].var, "%.1f", f ); } else { - dstate_setinfo( a[i].var, "%s", _buf); + dstate_setinfo( a[i].var, "%s", opti_buf); } } } @@ -340,8 +340,8 @@ void upsdrv_initinfo(void) if ( testvar(OPTI_POWERUP) && optiquery( "AG" ) < 1 ) { ser_send( upsfd, "AG\r\n" ); - r = ser_get_char(upsfd, &_buf[0], 1, 0); - if ( r == 1 && _buf[0] == '2' ) + r = ser_get_char(upsfd, &opti_buf[0], 1, 0); + if ( r == 1 && opti_buf[0] == '2' ) { upslogx( LOG_WARNING, "ups was off, switching it on" ); optiquery( "Ct1" ); @@ -353,7 +353,7 @@ void upsdrv_initinfo(void) /* Autodetect an Online-USV (only Zinto D is known to work) */ r = optiquery( "IM" ); - if ( r > 0 && !strcasecmp(_buf, "ONLINE") ) + if ( r > 0 && !strcasecmp(opti_buf, "ONLINE") ) { optimodel = OPTIMODEL_ZINTO; optiquery( "Om11" ); @@ -363,12 +363,12 @@ void upsdrv_initinfo(void) /* Autodetect an Opti-UPS PS series */ r = optiquery( "IO" ); - if ( r > 0 && !strncasecmp(_buf, "PS-", 3) ) + if ( r > 0 && !strncasecmp(opti_buf, "PS-", 3) ) { optimodel = OPTIMODEL_PS; } - optifill( _initv, SIZEOF_ARRAY(_initv) ); + optifill( opti_initv, SIZEOF_ARRAY(opti_initv) ); /* Parse out model into longer string -- is this really USEFUL??? */ r = optiquery( "IO" ); @@ -376,34 +376,34 @@ void upsdrv_initinfo(void) fatal_with_errno(EXIT_FAILURE, "can't retrieve model" ); else { - switch ( _buf[r-1] ) + switch ( opti_buf[r-1] ) { case 'E': case 'P': case 'V': - dstate_setinfo("ups.model", "Power%cS %s", _buf[r-1], _buf ); + dstate_setinfo("ups.model", "Power%cS %s", opti_buf[r-1], opti_buf ); break; default: - dstate_setinfo("ups.model", "%s", _buf ); + dstate_setinfo("ups.model", "%s", opti_buf ); break; } } /* Parse out model into longer string */ r = optiquery( "IM" ); - if ( r > 0 && !strcasecmp(_buf, "ONLINE") ) + if ( r > 0 && !strcasecmp(opti_buf, "ONLINE") ) { dstate_setinfo("ups.mfr", "ONLINE USV-Systeme AG"); r = optiquery( "IO" ); if ( r < 1 ) fatal_with_errno(EXIT_FAILURE, "can't retrieve model" ); - switch ( _buf[0] ) + switch ( opti_buf[0] ) { case 'D': - dstate_setinfo("ups.model", "Zinto %s", _buf ); + dstate_setinfo("ups.model", "Zinto %s", opti_buf ); break; default: - dstate_setinfo("ups.model", "%s", _buf ); + dstate_setinfo("ups.model", "%s", opti_buf ); break; } } @@ -440,8 +440,8 @@ void upsdrv_updateinfo(void) if ( r < 1 && optimodel == OPTIMODEL_ZINTO ) { ser_send( upsfd, "AG\r\n" ); - r = ser_get_char(upsfd, &_buf[0], 1, 0); - if ( r == 1 && _buf[0] == '2' ) + r = ser_get_char(upsfd, &opti_buf[0], 1, 0); + if ( r == 1 && opti_buf[0] == '2' ) { status_init(); status_set("OFF"); @@ -457,7 +457,7 @@ void upsdrv_updateinfo(void) } else { - long s = strtol( _buf, NULL, 16 ); + long s = strtol( opti_buf, NULL, 16 ); status_init(); if ( s & OPTISBIT_OVERLOAD ) status_set("OVER"); @@ -483,21 +483,21 @@ void upsdrv_updateinfo(void) /* read some easy settings */ if ( optimodel == OPTIMODEL_ZINTO ) - optifill( _pollv_zinto, SIZEOF_ARRAY(_pollv_zinto) ); + optifill( opti_pollv_zinto, SIZEOF_ARRAY(opti_pollv_zinto) ); else if ( optimodel == OPTIMODEL_PS ) { short inV, outV, fV; - optifill( _pollv_ps, SIZEOF_ARRAY(_pollv_ps) ); + optifill( opti_pollv_ps, SIZEOF_ARRAY(opti_pollv_ps) ); r = optiquery( "NV" ); - str_to_short ( _buf, &inV, 10 ); + str_to_short ( opti_buf, &inV, 10 ); r = optiquery( "OV" ); - str_to_short ( _buf, &outV, 10 ); + str_to_short ( opti_buf, &outV, 10 ); r = optiquery( "FV" ); if ( r >= 1 ) { - str_to_short ( _buf, &fV, 10 ); + str_to_short ( opti_buf, &fV, 10 ); if ( fV > 180 ) { inV = inV * 2; @@ -508,7 +508,7 @@ void upsdrv_updateinfo(void) dstate_setinfo( "output.voltage", "%d", outV ); } else - optifill( _pollv, SIZEOF_ARRAY(_pollv) ); + optifill( opti_pollv, SIZEOF_ARRAY(opti_pollv) ); /* Battery voltage is harder */ r = optiquery( "BV" ); @@ -516,7 +516,7 @@ void upsdrv_updateinfo(void) upslogx( LOG_WARNING, "cannot retrieve battery voltage" ); else { - float p, v = strtol( _buf, NULL, 10 ) / 10.0; + float p, v = strtol( opti_buf, NULL, 10 ) / 10.0; dstate_setinfo("battery.voltage", "%.1f", v ); if (v > 20) @@ -553,7 +553,7 @@ void upsdrv_shutdown(void) } else { - s = strtol( _buf, NULL, 16 ); + s = strtol( opti_buf, NULL, 16 ); } /* Turn output stage back on if power returns - but really means diff --git a/drivers/powerman-pdu.c b/drivers/powerman-pdu.c index 348c67a20c..db6bee3f5b 100644 --- a/drivers/powerman-pdu.c +++ b/drivers/powerman-pdu.c @@ -75,19 +75,19 @@ static int instcmd(const char *cmdname, const char *extra) /* Power on the outlet */ if (!strcasecmp(cmdsuffix, "on")) { rv = pm_node_on(pm, outletname); - return (rv==PM_ESUCCESS)?STAT_INSTCMD_HANDLED:STAT_SET_INVALID; + return (rv==PM_ESUCCESS)?STAT_INSTCMD_HANDLED:STAT_INSTCMD_INVALID; } /* Power off the outlet */ if (!strcasecmp(cmdsuffix, "off")) { rv = pm_node_off(pm, outletname); - return (rv==PM_ESUCCESS)?STAT_INSTCMD_HANDLED:STAT_SET_INVALID; + return (rv==PM_ESUCCESS)?STAT_INSTCMD_HANDLED:STAT_INSTCMD_INVALID; } /* Cycle the outlet */ if (!strcasecmp(cmdsuffix, "cycle")) { rv = pm_node_cycle(pm, outletname); - return (rv==PM_ESUCCESS)?STAT_INSTCMD_HANDLED:STAT_SET_INVALID; + return (rv==PM_ESUCCESS)?STAT_INSTCMD_HANDLED:STAT_INSTCMD_INVALID; } upslogx(LOG_NOTICE, "instcmd: unknown command [%s] [%s]", cmdname, extra); diff --git a/m4/nut_check_libopenssl.m4 b/m4/nut_check_libopenssl.m4 index 0eeaa13260..a39a3c6246 100644 --- a/m4/nut_check_libopenssl.m4 +++ b/m4/nut_check_libopenssl.m4 @@ -88,6 +88,34 @@ if test -z "${nut_have_libopenssl_seen}"; then nut_ssl_lib="(OpenSSL)" AC_DEFINE(WITH_SSL, 1, [Define to enable SSL support]) AC_DEFINE(WITH_OPENSSL, 1, [Define to enable SSL support using OpenSSL]) + + dnl # Repeat some tricks from nut_compiler_family.m4 + AS_IF([test "x$cross_compiling" != xyes], [ + AS_IF([test "x$CLANGCC" = xyes -o "x$GCC" = xyes], [ + dnl # This was hit on OmniOS Extra packaging repo + dnl /usr/ssl-3/include/openssl/safestack.h:205:1: + dnl error: cast from 'sk_OPENSSL_STRING_freefunc' + dnl (aka 'void (*)(char *)') to 'OPENSSL_sk_freefunc' + dnl (aka 'void (*)(void *)') converts to incompatible + dnl function type [-Werror,-Wcast-function-type-strict] + dnl # Below: Pick out -I... args of the depCFLAGS + dnl # to check locations that actually matter for + dnl # the build + addCFLAGS="" + for TOKEN in ${depCFLAGS} ; do + case "${TOKEN}" in + -I*) TOKENDIR="`echo "$TOKEN" | sed 's,^-I,,'`" + case " ${CFLAGS} ${addCFLAGS} " in + *" -isystem $TOKENDIR "*) ;; + *) addCFLAGS="${addCFLAGS} -isystem $TOKENDIR" ;; + esac ;; + esac + done + test -z "${addCFLAGS}" || depCFLAGS="${depCFLAGS} ${addCFLAGS}" + unset addCFLAGS + ]) + ]) + LIBSSL_CFLAGS="${depCFLAGS}" LIBSSL_LIBS="${depLIBS}" LIBSSL_REQUIRES="${depREQUIRES}" diff --git a/m4/nut_compiler_family.m4 b/m4/nut_compiler_family.m4 index b6e5f06fc3..cfa3523e1a 100644 --- a/m4/nut_compiler_family.m4 +++ b/m4/nut_compiler_family.m4 @@ -101,28 +101,52 @@ dnl so seemingly try to parse the method without args: dnl Note: per https://stackoverflow.com/questions/52557417/how-to-check-support-compile-flag-in-autoconf-for-clang dnl the -Werror below is needed to detect "warnings" about unsupported options +dnl NOTE: this option should not be passed via the fourth argument of the macro, +dnl or it ends up in the flags too, possibly during the "pop"; have to use the +dnl GOOD_FLAG instead :\ COMPILERFLAG="$1" dnl We also try to run an actual build since tools called from that might dnl complain if they are forwarded unknown flags accepted by the front-end. - SAVED_CFLAGS="$CFLAGS" - SAVED_CXXFLAGS="$CXXFLAGS" + NUT_SAVED_CFLAGS="$CFLAGS" + NUT_SAVED_CXXFLAGS="$CXXFLAGS" + AC_MSG_NOTICE([Starting check compile flag for '${COMPILERFLAG}'; now CFLAGS='${CFLAGS}' and CXXFLAGS='${CXXFLAGS}']) AC_LANG_PUSH([C]) + GOOD_FLAG=no AX_CHECK_COMPILE_FLAG([${COMPILERFLAG}], - [CFLAGS="$CFLAGS ${COMPILERFLAG}" + [CFLAGS="-Werror $NUT_SAVED_CFLAGS ${COMPILERFLAG}" + AC_MSG_CHECKING([whether the flag '${COMPILERFLAG}' is still supported in CC linker mode]) AX_RUN_OR_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [], [CFLAGS="$SAVED_CFLAGS"]) - ], [], [-Werror]) + [GOOD_FLAG=yes],[]) + AC_MSG_RESULT([${GOOD_FLAG}]) + ], [], []) AC_LANG_POP([C]) + AS_IF([test x"${GOOD_FLAG}" = xyes], + [CFLAGS="$NUT_SAVED_CFLAGS ${COMPILERFLAG}"], + [CFLAGS="$NUT_SAVED_CFLAGS"] + ) + AC_MSG_NOTICE([${GOOD_FLAG} for C '${COMPILERFLAG}'; now CFLAGS=${CFLAGS}]) AC_LANG_PUSH([C++]) + GOOD_FLAG=no AX_CHECK_COMPILE_FLAG([${COMPILERFLAG}], - [CXXFLAGS="$CXXFLAGS ${COMPILERFLAG}" + [CXXFLAGS="-Werror $NUT_SAVED_CXXFLAGS ${COMPILERFLAG}" + AC_MSG_CHECKING([whether the flag '${COMPILERFLAG}' is still supported in CXX linker mode]) AX_RUN_OR_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [], [CXXFLAGS="$SAVED_CXXFLAGS"]) - ], [], [-Werror]) + [GOOD_FLAG=yes],[]) + AC_MSG_RESULT([${GOOD_FLAG}]) + ], [], []) AC_LANG_POP([C++]) + AS_IF([test x"${GOOD_FLAG}" = xyes], + [CXXFLAGS="$NUT_SAVED_CXXFLAGS ${COMPILERFLAG}"], + [CXXFLAGS="$NUT_SAVED_CXXFLAGS"] + ) + AC_MSG_NOTICE([${GOOD_FLAG} for C++ '${COMPILERFLAG}'; now CXXFLAGS=${CXXFLAGS}]) + + unset NUT_SAVED_CXXFLAGS + unset NUT_SAVED_CFLAGS + unset GOOD_FLAG ]) AC_DEFUN([NUT_COMPILER_FAMILY_FLAGS], @@ -179,9 +203,10 @@ dnl AS_IF([test "x$GXX" = xyes], [CXXFLAGS="$CXXFLAGS -Wno-unknown-warning"]) dnl # There should be no need to include standard system paths (and possibly dnl # confuse the compiler assumptions - along with its provided headers)... -dnl # ideally; in practice however cppunit, net-snmp and some system include -dnl # files do cause grief to picky compiler settings (more so from third -dnl # party packages shipped via /usr/local/... namespace): +dnl # ideally; in practice however cppunit, net-snmp, openssl-3 and some +dnl # system include files do cause grief to picky compiler settings (more +dnl # so from third party packages shipped via /usr/local/... namespace); +dnl # see also e.g. nut_check_libopenssl.m4 for component-specific locations: AS_IF([test "x$cross_compiling" != xyes], [ AS_IF([test "x$CLANGCC" = xyes -o "x$GCC" = xyes], [ dnl # CFLAGS="-isystem /usr/include $CFLAGS" diff --git a/scripts/Windows/build-mingw-prereqs.sh b/scripts/Windows/build-mingw-prereqs.sh index a7f7987169..ed36811734 100755 --- a/scripts/Windows/build-mingw-prereqs.sh +++ b/scripts/Windows/build-mingw-prereqs.sh @@ -206,11 +206,11 @@ provide_libmodbus_git() ( # Provide the libmodbus version with RTU USB support PKGCFG_NAME="libmodbus" DEP_PRJNAME="libmodbus-git" - #DEP_GITREPO="https://github.com/networkupstools/libmodbus" - #DEP_VERSION="rtu_usb" # Git branch/tag/commit point + DEP_GITREPO="https://github.com/networkupstools/libmodbus" + DEP_VERSION="rtu_usb" # Git branch/tag/commit point # Use PR #3 temporarily: - DEP_GITREPO="https://github.com/jimklimov/libmodbus" # TEMP - DEP_VERSION="fix-mingw-build" # TEMP + #DEP_GITREPO="https://github.com/jimklimov/libmodbus" # TEMP + #DEP_VERSION="fix-mingw-build" # TEMP DEP_DIRNAME="${DEP_PRJNAME}-${DEP_VERSION}" FORCE=false @@ -234,15 +234,15 @@ provide_libmodbus_git() ( git checkout "${DEP_VERSION}" && \ _GITDIFF="`git diff "origin/${DEP_VERSION}"`" && \ if [ -n "${_GITDIFF}" ] ; then - FORCE=true # Ensure rebase etc. or fail - git pull || exit - ./autogen.sh || exit + git pull && \ + ./autogen.sh && \ + FORCE=true else echo "Current content in '`pwd`' matches current '${DEP_VERSION}' in '${DEP_GITREPO}'" >&2 fi fi - } || { chmod -R +w "${DEP_DIRNAME}" || echo "" ; rm -rf "${DEP_DIRNAME}" ; } + } || { cd "${DLDIR}" ; chmod -R +w "${DEP_DIRNAME}" || echo "" ; rm -rf "${DEP_DIRNAME}" ; } fi cd "${DLDIR}" diff --git a/tools/nut-scanner/scan_ipmi.c b/tools/nut-scanner/scan_ipmi.c index 0d40bfa63f..fb566480d9 100644 --- a/tools/nut-scanner/scan_ipmi.c +++ b/tools/nut-scanner/scan_ipmi.c @@ -617,13 +617,13 @@ nutscan_device_t * nutscan_scan_ipmi_device(const char * IPaddr, nutscan_ipmi_t nut_dev->type = TYPE_IPMI; nut_dev->driver = strdup(NUT_IPMI_DRV_NAME); if (IPaddr == NULL) { - sprintf(port_id, "id%x", ipmi_id); + sprintf(port_id, "id%x", (unsigned int)ipmi_id); } else { /* FIXME: also check against "localhost" and its IPv{4,6} */ /* FIXME: Should the IPv6 address here be bracketed? * Does our driver support the notation? */ - sprintf(port_id, "id%x@%s", ipmi_id, IPaddr); + sprintf(port_id, "id%x@%s", (unsigned int)ipmi_id, IPaddr); } nut_dev->port = strdup(port_id); /* FIXME: also dump device.serial? @@ -845,7 +845,7 @@ nutscan_device_t * nutscan_scan_ip_range_ipmi(nutscan_ip_range_list_t * irl, nut upsdebugx(4, "%s: max_threads_scantype=%" PRIuSIZE " curr_threads=%" PRIuSIZE " thread_count=%" PRIuSIZE - " stwST=%d stwS=%d pass=%d", + " stwST=%d stwS=%d pass=%u", __func__, max_threads_scantype, curr_threads, thread_count, stwST, stwS, pass