[DPDK/core Bug 1925] parameters of macros in lib/eal/include/rte_test.h are not parenthesized

bugzilla at dpdk.org bugzilla at dpdk.org
Fri Apr 3 10:55:53 CEST 2026


http://bugs.dpdk.org/show_bug.cgi?id=1925

            Bug ID: 1925
           Summary: parameters of macros in lib/eal/include/rte_test.h are
                    not parenthesized
           Product: DPDK
           Version: 26.03
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: Normal
         Component: core
          Assignee: dev at dpdk.org
          Reporter: marat.khalili at huawei.com
  Target Milestone: ---

Parameters of macros like RTE_TEST_ASSERT_EQUAL defined in
lib/eal/include/rte_test.h are not enclosed in parentheses, which potentially
may result in unintended operator precedence after substitution and in the
worst case scenario false negatives in library and user tests. E.g. the
following statement:
```c
RTE_TEST_ASSERT_EQUAL(port_status & FLAG_UP, FLAG_UP, "Port is not UP!");
```
will check bit 1 (FLAG_UP == FLAG_UP) of port_status, not FLAG_UP.

See https://gcc.gnu.org/onlinedocs/cpp/Operator-Precedence-Problems.html

Same problem in app/test/test.h

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


More information about the dev mailing list