Skip to content

QNX: C compiles default to -std=c11 without -D_QNX_SOURCE #168

Closed

Description

@ANegm-ETAS

Description

Summary

The QNX toolchain sets -D_QNX_SOURCE only for C++ compiles. C compiles get -std=c11 alone. The QNX allow-list pairs them as -std=c11 -D_QNX_SOURCE, so the C default is not the listed combination. Not yet known whether this breaks any build or changes behaviour.

Where the flags are set

  • templates/qnx/cc_toolchain_flags.bzl.template (v1.0.3, lines 50-58):
    • DEFAULT_C_COMPILE_FLAGS = ["-std=c11"]
    • DEFAULT_CXX_COMPILE_FLAGS = ["-D_QNX_SOURCE", "-std=c++17"]

Affected C sources

  • score_baselibs: score/language/futurecpp/src/math.c, in the math target.
  • vsps_ids: src/cpp/libqsev/qsev.c.

Why it may matter

QNX headers gate declarations on feature macros. In sys/platform.h, _QNX_SOURCE controls which POSIX and QNX extensions are exposed. Without it, __STRICT_ANSI__ is set under -std=c11, and headers such as yvals.h and assert.h take their strict branches. We have not checked which declarations used by math.c or qsev.c become invisible.

Questions

  1. Was the split between C and C++ deliberate?
  2. Should -D_QNX_SOURCE be added to the C default, matching the allow-list?
  3. If not, can it be recorded as a deviation with a rationale?

Acceptance

  • Either -D_QNX_SOURCE is added to the C default and the affected builds pass, or a documented deviation is recorded.

Problem notifications

No response

Analysis results

No response

Solution

No response

Error Occurrence Rate

None

How to reproduce

No response

Supporting Information

No response

Classification

Minor

First Affected Release

not released (main)

Last Affected Release

not released (main)

Expected Fixed Release

before release (main)

Category

  • Safety Relevant
  • Security Relevant

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions