Bug 196137 - Fix net/dpdk build with clang 3.5.0
Summary: Fix net/dpdk build with clang 3.5.0
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks: 195480
  Show dependency treegraph
 
Reported: 2014-12-19 17:10 UTC by Dimitry Andric
Modified: 2014-12-22 13:02 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (bruce.richardson)


Attachments
Fix net/dpdk build with clang 3.5.0 (1.48 KB, patch)
2014-12-19 17:10 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2014-12-19 17:10:46 UTC
Created attachment 150783 [details]
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 Bugzilla Automation freebsd_committer freebsd_triage 2014-12-19 17:10:46 UTC
Maintainer CC'd
Comment 2 Bruce Richardson 2014-12-19 17:17:13 UTC
(In reply to Bugzilla Automation from comment #1)
> Maintainer CC'd

This issue has been fixed in the latest DPDK codebase, with a new release (v1.8) due within days. Once the release is done, the DPDK port can be updated to that to get compilation support with clang 3.5
Comment 3 Vanilla I. Shu freebsd_committer freebsd_triage 2014-12-22 13:02:22 UTC
Bruce submitted dpdk 1.8.0 to me, and it's on ports tree now,

You can update your ports tree, and try it later,

thanks.