Skip to content

warnings generated by retain attribute in sel4test library header #97

@kent-mcleod

Description

@kent-mcleod

When support for lld was added in #75, this retain attribute was added. However this is causing warnings now when compiling with gcc-12:

/tmp/tmp.BhrhA5NZPe/projects/seL4_libs/libsel4test/include/sel4test/test.h:145:12: error: 'retain' attribute ignored [-Werror=attributes]
  145 |     struct testcase TEST_ ## _name = { \
      |            ^~~~~~~~
/tmp/tmp.BhrhA5NZPe/projects/seL4_libs/libsel4test/include/sel4test/test.h:155:73: note: in expansion of macro 'DEFINE_TEST_WITH_TYPE'
  155 | #define DEFINE_TEST_BOOTSTRAP(_name, _description, _function, _enabled) DEFINE_TEST_WITH_TYPE(_name, _description, _function, BOOTSTRAP, _enabled)
      |                                                                         ^~~~~~~~~~~~~~~~~~~~~
/tmp/tmp.BhrhA5NZPe/projects/sel4test/apps/sel4test-driver/src/tests/syscall.c:237:5: note: in expansion of macro 'DEFINE_TEST_BOOTSTRAP'
  237 |     DEFINE_TEST_BOOTSTRAP(_test, "Basic " #_syscall "() testing", test_ ## _syscall, _enabled)
      |     ^~~~~~~~~~~~~~~~~~~~~
/tmp/tmp.BhrhA5NZPe/projects/sel4test/apps/sel4test-driver/src/tests/syscall.c:239:5: note: in expansion of macro 'GENERATE_SYSCALL_TEST_MAYBE'
  239 |     GENERATE_SYSCALL_TEST_MAYBE(_test, _syscall, _code, true)
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
/tmp/tmp.BhrhA5NZPe/projects/sel4test/apps/sel4test-driver/src/tests/syscall.c:245:1: note: in expansion of macro 'GENERATE_SYSCALL_TEST'
  245 | GENERATE_SYSCALL_TEST(SYSCALL0000, seL4_Yield,
      | ^~~~~~~~~~~~~~~~~~~~~
/tmp/tmp.BhrhA5NZPe/projects/seL4_libs/libsel4test/include/sel4test/test.h:145:12: error: 'retain' attribute ignored [-Werror=attributes]
  145 |     struct testcase TEST_ ## _name = { \
      |            ^~~~~~~~

There doesn't seem to be a way to reliably test if gcc supports the retain attribute as __has_attribute(retain) returns 1 anyway.
Is there an alternative approach here? (ping @heshamelmatary)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions