Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,11 @@ the relevant build mode is active. All are enabled by default except where noted
requires static system archives (unavailable on some toolchains, e.g. AutoSD).

## Warnings
Opt-in / disabled by default unless noted otherwise.
- **`minimal_warnings`** (both) — Baseline warning set (includes `-Wall`).
Enabled by default on QNX; opt-in (disabled by default) on Linux.
- **`strict_warnings`** (both) — Stricter warnings; implies `minimal_warnings`.
- **`all_wall_warnings`** (Linux) — Broadest warning set; implies `strict_warnings`.
- **`warnings_as_errors`** (both) — Adds `-Werror`.
**Note:** Warning-level features (`minimal_warnings`, `strict_warnings`, `all_wall_warnings`, `warnings_as_errors`)
have been migrated to [`score_cpp_policies`](https://github.com/eclipse-score/score_cpp_policies).

These features are no longer defined by this toolchain but can be provided through *feature injection* via
the `extra_known_features` / `extra_enabled_features` attributes on `gcc.toolchain(...)`.

## Sanitizers (Linux, opt-in)
Sanitizers are **not** defined by this toolchain. They are provided as
Expand Down
43 changes: 15 additions & 28 deletions docs/test_suite.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,59 +43,48 @@ These tests verify that specific toolchain features are correctly implemented an
- Tests `-iquote` quote search paths
- Verifies `-isystem` system include paths

3. **`warnings_test`** - Warning level configuration
- Tests strict_warnings, minimal_warnings, warnings_as_errors features
- Includes code patterns that trigger specific warnings

4. **`warning_override_test`** - Warning feature override via user flags
- Regression test verifying user flags (copts) can override enabled warning features
- Enables both `strict_warnings` and `warnings_as_errors` features (making warnings into errors)
- Provides conflicting `-Wno-shadow` via copts to override the warning
- Validates that the flag ordering is correct: user_compile_flags comes after warning features,
ensuring user flags take precedence. If ordering regresses, compilation will fail with an error.

5. **`coverage_test`** - Code coverage instrumentation
3. **`coverage_test`** - Code coverage instrumentation
- Verifies code coverage instrumentation flags are applied
- Provides multiple code paths for coverage analysis
- Can be analyzed with: `bazel coverage --combined_report=lcov //feature_verification:coverage_test`

6. **`pic_test`** - Position-Independent Code (`-fPIC`)
4. **`pic_test`** - Position-Independent Code (`-fPIC`)
- Tests -fPIC flag is correctly applied
- Validates position-independent code patterns
- Tests polymorphism, static variables, and C linkage with PIC

7. **`pthread_test`** - POSIX threading support
5. **`pthread_test`** - POSIX threading support
- Verifies `-lpthread` correctly links pthread library
- Tests thread creation, synchronization, and joining
- Validates multiple threads can safely access shared state

8. **`multifile_test`** - Multi-file compilation and archiving
6. **`multifile_test`** - Multi-file compilation and archiving
- Tests multiple source files compile into separate object files
- Validates object files are combined by archiver into static libraries
- Complex operations across multiple object files link correctly

9. **`whole_archive_test`** - Whole-archive linking (`-Wl,--whole-archive`)
7. **`whole_archive_test`** - Whole-archive linking (`-Wl,--whole-archive`)
- Verifies `-Wl,--whole-archive` and `-Wl,--no-whole-archive` work
- Tests unused library symbols are linked when using whole-archive

10. **`preprocessor_defines_test`** - `preprocessor_defines` feature
8. **`preprocessor_defines_test`** - `preprocessor_defines` feature
- Injects defines via the `local_defines` attribute (routed through the
`preprocessor_defines` feature), unlike `defines_test` which uses `copts`
(routed through `user_compile_flags`)

11. **`include_dir_test`** - `include_paths` via the `includes` attribute
9. **`include_dir_test`** - `include_paths` via the `includes` attribute
- Includes a header exposed through a library's `includes` attribute,
exercising the `-I`/`-isystem` search paths

12. **`user_link_flags_test`** - `user_link_flags` feature
10. **`user_link_flags_test`** - `user_link_flags` feature
- Passes a linker flag through `linkopts` (`-Wl,--defsym=...`) and checks the
injected symbol's address at runtime

13. **`random_seed_test`** - `random_seed` feature
11. **`random_seed_test`** - `random_seed` feature
- Build-and-run smoke test exercising internal-linkage symbols governed by
the reproducible-build random seed

14. **`fully_static_link_test`** - `fully_static_link` feature (`-static`)
12. **`fully_static_link_test`** - `fully_static_link` feature (`-static`)
- Verifies no shared objects are mapped at runtime (fully static binary)
- Marked incompatible with toolchains lacking static system archives (AutoSD)

Expand Down Expand Up @@ -286,16 +275,16 @@ when the host equals the target).

### All tests on the host (`//...`)
```
Executed 20 tests: 20 passed
Executed 18 tests: 18 passed
```

### Feature Verification Tests
- The `feature_verification_tests` suite aggregates 13 tests. `warnings_test`
is defined separately and is picked up by wildcard targets such as
`//feature_verification/...`.
- The `feature_verification_tests` suite aggregates 12 tests.
**Note:** Warning-level tests (`warnings_test`, `warning_override_test`) have been migrated to
[`score_cpp_policies`](https://github.com/eclipse-score/score_cpp_policies).
- Expected output for the suite:
```
Executed 13 tests: 13 passed
Executed 12 tests: 12 passed
```

### Language and Standards Tests
Expand Down Expand Up @@ -324,8 +313,6 @@ tests/
│ ├── user_link_flags_test.cpp
│ ├── random_seed_test.cpp
│ ├── fully_static_link_test.cpp
│ ├── warnings_test.cpp
│ ├── warning_override_test.cpp
│ ├── coverage_test.cpp
│ ├── pic_test_lib.h/cpp, pic_test.cpp
│ ├── multifile_lib.h and multifile_lib_*.cpp
Expand Down
90 changes: 3 additions & 87 deletions templates/linux/cc_toolchain_config.bzl.template
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@ load(":flags.bzl",
"DEFAULT_LINK_FLAGS",
"DBG_COMPILE_FLAGS",
"OPT_COMPILE_FLAGS",
"MINIMAL_WARNINGS_FLAGS",
"MINIMAL_C_WARNINGS_FLAGS",
"MINIMAL_CXX_WARNINGS_FLAGS",
"STRICT_WARNINGS_FLAGS",
"STRICT_C_WARNINGS_FLAGS",
"STRICT_CXX_WARNINGS_FLAGS",
"ALL_WALL_WARNINGS",
"ALL_WALL_C_WARNINGS",
"ALL_WALL_CXX_WARNINGS",
"WARNINGS_AS_ERRORS",
)

all_cpp_compile_actions = [
Expand Down Expand Up @@ -292,76 +282,6 @@ def _impl(ctx):
],
)

minimal_warnings_feature = feature(
name = "minimal_warnings",
enabled = False,
flag_sets = [
flag_set(
actions = all_compile_actions,
flag_groups = MINIMAL_WARNINGS_FLAGS,
),
flag_set(
actions = all_c_compile_actions,
flag_groups = MINIMAL_C_WARNINGS_FLAGS,
),
flag_set(
actions = all_cpp_compile_actions,
flag_groups = MINIMAL_CXX_WARNINGS_FLAGS,
),
],
)

strict_warnings_feature = feature(
name = "strict_warnings",
implies = ["minimal_warnings"],
enabled = False,
flag_sets = [
flag_set(
actions = all_compile_actions,
flag_groups = STRICT_WARNINGS_FLAGS,
),
flag_set(
actions = all_cpp_compile_actions,
flag_groups = STRICT_CXX_WARNINGS_FLAGS,
),
flag_set(
actions = all_c_compile_actions,
flag_groups = STRICT_C_WARNINGS_FLAGS,
),
],
)

all_wall_warnings_feature = feature(
name = "all_wall_warnings",
implies = ["strict_warnings"],
enabled = False,
flag_sets = [
flag_set(
actions = all_compile_actions,
flag_groups = ALL_WALL_WARNINGS,
),
flag_set(
actions = all_c_compile_actions,
flag_groups = ALL_WALL_C_WARNINGS,
),
flag_set(
actions = all_cpp_compile_actions,
flag_groups = ALL_WALL_CXX_WARNINGS,
),
],
)

warnings_as_errors_feature = feature(
name = "warnings_as_errors",
enabled = False,
flag_sets = [
flag_set(
actions = all_compile_actions,
flag_groups = WARNINGS_AS_ERRORS,
),
],
)

extra_compile_flags = %{extra_compile_flags}
extra_compile_flags_feature = feature(
name = "extra_compile_flags",
Comment thread
nradakovic marked this conversation as resolved.
Expand Down Expand Up @@ -1024,10 +944,9 @@ def _impl(ctx):
random_seed_feature,
include_paths_feature,
preprocessor_defines_feature,
minimal_warnings_feature,
strict_warnings_feature,
all_wall_warnings_feature,
warnings_as_errors_feature,
extra_compile_flags_feature,
extra_c_compile_flags_feature,
extra_cxx_compile_flags_feature,
user_compile_flags_feature,
compiler_input_flags_feature,
compiler_output_flags_feature,
Expand All @@ -1051,9 +970,6 @@ def _impl(ctx):
fully_static_link_feature,
sysroot_link_flags_feature,
pthread_feature,
extra_compile_flags_feature,
extra_c_compile_flags_feature,
extra_cxx_compile_flags_feature,
extra_link_flags_feature,
opt_feature,
supports_dynamic_linker_feature,
Expand Down
Loading
Loading