[Bug 196137] New: Fix net/dpdk build with clang 3.5.0

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Dec 19 17:10:47 UTC 2014


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=196137

            Bug ID: 196137
           Summary: Fix net/dpdk build with clang 3.5.0
           Product: Ports Tree
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Many People
          Priority: ---
         Component: Individual Port(s)
          Assignee: freebsd-ports-bugs at FreeBSD.org
          Reporter: dim at FreeBSD.org
                CC: bruce.richardson at intel.com
             Flags: maintainer-feedback?(bruce.richardson at intel.com)
                CC: bruce.richardson at intel.com

Created attachment 150783
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=150783&action=edit
Fix net/dpdk build with clang 3.5.0

The net/dpdk port fails to compile with clang 3.5.0, due to the following
-Werror warnings:

/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:93:38:
error: size argument in 'strncmp' call is a comparison
[-Werror,-Wmemsize-comparison]
                        sizeof(devargs->virtual.drv_name) != 0))
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:92:6: note:
did you mean to compare the result of 'strncmp' instead?
        if (strncmp(devargs->virtual.drv_name, "eth_ring1",
            ^
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:93:4: note:
explicitly cast the argument to size_t to silence this warning
                        sizeof(devargs->virtual.drv_name) != 0))
                        ^
                        (size_t)(                             )
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:95:69:
error: size argument in 'strncmp' call is a comparison
[-Werror,-Wmemsize-comparison]
        if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args) !=
0))
                                                     ~~~~~~~~~~~~~~~~~~~~~~^~~~
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:95:6: note:
did you mean to compare the result of 'strncmp' instead?
        if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args) !=
0))
            ^                                                                 
~
                                                                          )
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:95:47:
note: explicitly cast the argument to size_t to silence this warning
        if (strncmp(devargs->args, "k1=val,k2=val2", sizeof(devargs->args) !=
0))
                                                     ^
                                                     (size_t)(                
)
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:108:55:
error: size argument in 'strncmp' call is a comparison
[-Werror,-Wmemsize-comparison]
        if (strncmp(devargs->args, "", sizeof(devargs->args) != 0))
                                       ~~~~~~~~~~~~~~~~~~~~~~^~~~
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:108:6:
note: did you mean to compare the result of 'strncmp' instead?
        if (strncmp(devargs->args, "", sizeof(devargs->args) != 0))
            ^                                                    ~
                                                            )
/wrkdirs/usr/ports/net/dpdk/work/dpdk-1.7.1/app/test/test_devargs.c:108:33:
note: explicitly cast the argument to size_t to silence this warning
        if (strncmp(devargs->args, "", sizeof(devargs->args) != 0))
                                       ^
                                       (size_t)(                 )
3 errors generated.

Clang has found a bug in this code: the parentheses for the strncmp() call are
incorrectly placed.  Fix this by moving the parentheses to before the !=
operator.

--- Comment #1 from Bugzilla Automation <bugzilla at FreeBSD.org> ---
Maintainer CC'd

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-ports-bugs mailing list