Skip to contentSkip to conversation

parameters of macros in lib/eal/include/rte_test.h are not parenthesized

DPDK/core Bug 1925 [email protected] 1 participant 2 messages Apr 3 – Jun 16

lore
Share & tools
lore
#0 lore raw

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: [email protected]
          Reporter: [email protected]

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

Signature · 2 lines
You are receiving this mail because:
You are the assignee for the bug.