]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
remove -Wno-cast-align
authorAlan T. DeKok <aland@freeradius.org>
Sat, 25 Oct 2025 15:37:37 +0000 (11:37 -0400)
committerAlan T. DeKok <aland@freeradius.org>
Sat, 25 Oct 2025 15:37:37 +0000 (11:37 -0400)
Some configure output had both -Wcast-align and -Wno-cast-align,
which doesn't make any sense.

The -Wno-cast-align is there to quiet issues with sbuff.h and
dbuff.h.  Those header files define macros which use two _Generic
statements, one for each function argument.  However, such use of
_Generic isn't limited to treating each case independently.

Instead, all possible combinations of _Generics must be valid,
even ones which don't make sense (and aren't chosen).  This results
in the compiler complaining.

Since we don't understand what's going on there, we just disable
-Wcast-align for those two header files, and leave it globally
enabled for everything else.

configure
configure.ac
src/lib/util/dbuff.h
src/lib/util/sbuff.h

index 6b283eb9f66d7c958875a0a4102009c79dce35d4..501dde98a898ddf83452710b12f6fb486d108759 100755 (executable)
--- a/configure
+++ b/configure
@@ -13690,7 +13690,6 @@ printf "%s\n" "$ax_cv_cc_weverything_flag" >&6; }
        -Wno-date-time \
        -Wno-disabled-macro-expansion \
        -Wno-format-pedantic \
-       -Wno-cast-align \
        -Wno-conversion \
        -Wno-covered-switch-default \
        -Wno-documentation-unknown-command \
@@ -13722,7 +13721,6 @@ printf "%s\n" "$ax_cv_cc_weverything_flag" >&6; }
        -Wmissing-declarations \
        -Wmissing-prototypes \
        -Wnested-externs \
-       -Wno-cast-align \
        -Wno-format-extra-args \
        -Wno-format-zero-length \
        -Wpointer-arith \
index b6fe7a9b84a2ba7126dc0137a8bd2fe28806fe91..365459dfb938200c246aec2a93addd258d4b0fa9 100644 (file)
@@ -2000,7 +2000,6 @@ if test "x$developer" = "xyes"; then
        -Wmissing-declarations \
        -Wmissing-prototypes \
        -Wnested-externs \
-       -Wno-cast-align \
        -Wno-format-extra-args \
        -Wno-format-zero-length \
        -Wpointer-arith \
index 348a481e9e6eb2b98cfb3ff3847db2339c8f392a..f613c11bd1cf7f12b7c883e81b37568639df5491 100644 (file)
@@ -38,6 +38,8 @@ extern "C" {
 #include <stdint.h>
 #include <sys/types.h>
 
+DIAG_OFF(cast-align)
+
 /** A dbuff
  *
  * dbuffs wrap an underlying buffer, maintaining 'start', 'current', and 'end'
@@ -1059,6 +1061,7 @@ _fr_dbuff_set_end(\
        ) \
 )
 
+
 /** Advance 'current' position in dbuff or marker by _len bytes
  *
  * @param[in] _dbuff_or_marker to advance.
@@ -1898,7 +1901,6 @@ static inline ssize_t _fr_dbuff_out_int64v(int64_t *num, uint8_t **pos_p, fr_dbu
 #define FR_DBUFF_OUT_INT64V_RETURN(_num, _dbuff_or_marker, _len) FR_DBUFF_RETURN(fr_dbuff_out_int64v, _num, _dbuff_or_marker, _len)
 
 /** @} */
-
 #ifdef __cplusplus
 }
 #endif
index 0f226f9915e15ff2e43ca49e8ef79d8a4f58b168..ed6def0746f3e5441c9e0270701b483786f9b1d7 100644 (file)
@@ -61,6 +61,7 @@ typedef struct fr_sbuff_ptr_s fr_sbuff_marker_t;
  *
  */
 DIAG_OFF(attributes)
+DIAG_OFF(cast-align)
 typedef enum CC_HINT(flag_enum) {
        FR_SBUFF_FLAG_EXTENDED                  = 0x01,         //!< The last call to extend function actually extended the buffer.
        FR_SBUFF_FLAG_EXTEND_ERROR              = 0x02          //!< The last call to an extend function resulted in an error.
@@ -843,7 +844,7 @@ static inline fr_sbuff_t *fr_sbuff_init_talloc(TALLOC_CTX *ctx,
 /** Return a pointer to the 'end' position of an sbuff or one of its markers
  *
  * @param[in] _sbuff_or_marker to return the end position of.
- * @return A pointer to the end position of the buffer or marker.
+< * @return A pointer to the end position of the buffer or marker.
  */
 #define fr_sbuff_end(_sbuff_or_marker) \
        (_Generic((_sbuff_or_marker), \