Skip to content

Need a CI check with --std=c99 set #7599

Open

Description

@aitap

As mentioned by @MichaelChirico in #7517 (comment), we need a check that hides by default all the non-standard extensions that the code may be using (because they may be hidden by default on e.g. FreeBSD). Then our code will not pass the check without explicitly asking for them (e.g. by #define-ing _POSIX_C_SOURCE). We have hit this problem before when a change that used a C23 feature passed CI but failed with cc() (which now uses -std=c11).

Activity

  1. added theissue type on Jan 15, 2026
  2. akshhkaushik commented on Jan 20, 2026

    @akshhkaushik

    I think a practical way to address this would be to add a dedicated CI job that enforces strict C99 compliance by default, explicitly disabling non-standard extensions.

    Proposed approach

    • Add an additional CI configuration that builds data.table with:

      • -std=c99
      • -pedantic
      • -Werror
      • and without defining feature-test macros like _POSIX_C_SOURCE, _GNU_SOURCE, etc.
    • This job would be separate from existing CI (so it doesn’t replace current checks), but would act as a guardrail to catch accidental reliance on platform-specific or compiler-enabled extensions.

    Why this helps

    • Some platforms (e.g. FreeBSD or certain libc setups) expose non-standard features by default, which can mask portability issues.
    • A strict C99 build ensures we only rely on features explicitly allowed by the standard unless we consciously opt into extensions.
    • This mirrors the earlier issue mentioned where code passed CI under one compiler mode but failed under another (cc vs gcc / different -std flags).

    Implementation details

    • The CI job could live alongside existing ones (e.g. GitHub Actions or CI scripts) and simply fail fast if non-standard features are used.
    • If certain files require extensions, those can be handled explicitly via localized macros or documented exceptions, instead of relying on implicit defaults.

    This should give early visibility into portability regressions while keeping current CI behavior unchanged for users and contributors.

  3. aitap commented on Jan 20, 2026

    @aitap
    MemberAuthor

    We have something like that, see

    data.table/.gitlab-ci.yml

    Lines 166 to 182 in e13ea60

    test-lin-dev-gcc-strict-cran:
    <<: *test-lin
    image: registry.gitlab.com/rdatatable/dockerfiles/r-devel-gcc-strict
    variables:
    _R_CHECK_COMPILATION_FLAGS_KNOWN_: "-Wvla"
    _R_CHECK_CRAN_INCOMING_: "TRUE"
    _R_CHECK_CRAN_INCOMING_REMOTE_: "FALSE"
    _R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_: "FALSE" ## detects S3 method lookup found on search path #4777
    _R_S3_METHOD_LOOKUP_REPORT_SEARCH_PATH_USES_: "TRUE"
    script:
    - echo 'CFLAGS=-g -O2 -flto=auto -fno-common -fopenmp -Wall -Wvla -pedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2' > ~/.R/Makevars
    - echo 'CXXFLAGS=-g -O2 -flto=auto -fno-common -fopenmp -Wall -Wvla -pedantic -fstack-protector-strong -D_FORTIFY_SOURCE=2' >> ~/.R/Makevars
    - *install-deps
    - R CMD check --as-cran $(ls -1t data.table_*.tar.gz | head -n 1)
    - (! grep "warning:" data.table.Rcheck/00install.out)
    - >-
    Rscript -e 'l=tail(readLines("data.table.Rcheck/00check.log"), 1L); notes<-"Status: 1 NOTE"; if (!identical(l, notes)) stop("Last line of ", shQuote("00check.log"), " is not ", shQuote(notes), " (V8 package) but ", shQuote(l)) else q("no")'
    and https://gitlab.com/Rdatatable/data.table/-/commit/f02dcb783903727cbc043620f764b9d7f25c7af9/pipelines?ref=stricter_c99.

    It just needs to be carefully done to avoid unintended warnings from R using C23 features while C99 mode is enabled. Also, CI is broken (website stuck at December 26) until #7534 is fixed.

  4. akshhkaushik commented on Jan 21, 2026

    @akshhkaushik

    Please correct if i am wrong ,

    The stricter_c99 branch and commit f02dcb7 already seem to implement the core requirement of #7599 — enforcing strict C99 in CI to catch accidental reliance on extensions.

    From what I can tell, the remaining blockers are not conceptual but practical:

    warnings triggered by R itself using newer (C23) constructs under C99

    current CI / website breakage until #7534 is resolved

    It sounds like the right next step is to treat this as “implemented but not yet mergeable”, and revisit once CI is unblocked, possibly tightening or scoping the checks to avoid noise from R internals.

    I’m happy to help investigate or minimize the remaining warnings once CI is back in a good state, if that would be useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions