kern/176051: [kernel] [patch] uipc: Simplify and correct debug printing of flags.

Christian Brueffer brueffer at FreeBSD.org
Wed Mar 5 23:28:12 UTC 2014


On 3/4/14 8:29 AM, Christoph Mallon wrote:
> On 27.02.2014 11:02, brueffer at FreeBSD.org wrote:
>> The patch in the PR doesn't compile (latest HEAD).
> 
> 
> "doesn't compile" is not helpful feedback.
> Please state at least the error message.
> 

[...]
cc  -c -O2 -pipe -fno-strict-aliasing  -std=c99 -gdwarf-2 -Wall
-Wredundant-decls -Wnested-externs -Wstrict-prototypes
-Wmissing-prototypes -Wpointer-arith -Winline -Wcast-qual  -Wundef
-Wno-pointer-sign -fformat-extensions  -Wmissing-include-dirs
-fdiagnostics-show-option  -Wno-error-tautological-compare
-Wno-error-empty-body  -Wno-error-parentheses-equality
-Wno-unused-function   -nostdinc  -I. -I/usr/src/sys
-I/usr/src/sys/contrib/altq -I/usr/src/sys/contrib/libfdt -D_KERNEL
-DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
-fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -mno-aes -mno-avx
-mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float
-fno-asynchronous-unwind-tables -ffreestanding -fstack-protector -Werror
 /usr/src/sys/kern/uipc_debug.c
/usr/src/sys/kern/uipc_debug.c:87:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_DEBUG);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:87:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:87:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_DEBUG);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:88:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_ACCEPTCONN);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:88:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:88:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_ACCEPTCONN);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:89:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_REUSEADDR);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:89:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:89:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_REUSEADDR);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:90:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_KEEPALIVE);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:90:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:90:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_KEEPALIVE);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:91:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_DONTROUTE);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:91:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:91:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_DONTROUTE);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:92:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_BROADCAST);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:92:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:92:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_BROADCAST);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:93:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_USELOOPBACK);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:93:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:93:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_USELOOPBACK);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:94:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_LINGER);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:94:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:94:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_LINGER);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:95:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_OOBINLINE);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:95:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
/usr/src/sys/kern/uipc_debug.c:95:2: error: format string is not a
string literal (potentially insecure) [-Werror,-Wformat-security]
        PRINT_FLAG(so_options, SO_OOBINLINE);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:33: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ^~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:96:2: error: adding 'int' to a string
does not append to the string [-Werror,-Wstring-plus-int]
        PRINT_FLAG(so_options, SO_REUSEPORT);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                ~~~~~~~~~~~^~~~~
/usr/src/sys/kern/uipc_debug.c:96:2: note: use array indexing to silence
this warning
/usr/src/sys/kern/uipc_debug.c:49:44: note: expanded from macro 'PRINT_FLAG'
    ((var) & (flag) ? db_printf(", " #flag + sep), (void)(sep = 0) :
(void)0)
                                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
*** Error code 1


# cc -v
FreeBSD clang version 3.4 (tags/RELEASE_34/final 197956) 20140216
Target: x86_64-unknown-freebsd11.0
Thread model: posix
Selected GCC installation:


Christian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1036 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-bugs/attachments/20140306/2bab53eb/attachment.sig>


More information about the freebsd-bugs mailing list