ceedling 1.2.2 → 1.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/GIT_COMMIT_SHA +1 -1
- data/README.md +1 -1
- data/assets/fixtures/tests_with_partials_coverage/src/private_macro.c +7 -0
- data/assets/fixtures/tests_with_partials_coverage/src/private_macro.h +5 -0
- data/assets/fixtures/tests_with_partials_coverage/src/tally.c +13 -0
- data/assets/fixtures/tests_with_partials_coverage/src/tally.h +4 -0
- data/assets/fixtures/tests_with_partials_coverage/test/test_private_macro.c +10 -0
- data/assets/fixtures/tests_with_partials_coverage/test/test_tally.c +9 -0
- data/docs/BreakingChanges.md +16 -0
- data/docs/Changelog.md +71 -0
- data/docs/KnownIssues.md +91 -4
- data/examples/wondrous_forest/README.md +29 -1
- data/examples/wondrous_forest/src/ForestUnits.h +23 -0
- data/examples/wondrous_forest/src/RainGauge.c +59 -0
- data/examples/wondrous_forest/src/RainGauge.h +39 -0
- data/examples/wondrous_forest/src/RainTipIsr.c +17 -0
- data/examples/wondrous_forest/src/RainTipIsr.h +14 -0
- data/examples/wondrous_forest/test/TestRainGauge.c +126 -0
- data/lib/ceedling/c_extractor/README.md +15 -7
- data/lib/ceedling/c_extractor/c_extractor.rb +25 -14
- data/lib/ceedling/c_extractor/c_extractor_code_text.rb +84 -54
- data/lib/ceedling/c_extractor/c_extractor_constants.rb +18 -7
- data/lib/ceedling/c_extractor/c_extractor_declarations.rb +319 -283
- data/lib/ceedling/c_extractor/c_extractor_declarator.rb +285 -0
- data/lib/ceedling/c_extractor/c_extractor_defined_type.rb +111 -0
- data/lib/ceedling/c_extractor/c_extractor_definitions.rb +174 -121
- data/lib/ceedling/c_extractor/c_extractor_functions.rb +191 -162
- data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +46 -55
- data/lib/ceedling/c_extractor/c_extractor_statement.rb +30 -0
- data/lib/ceedling/c_extractor/c_extractor_types.rb +63 -41
- data/lib/ceedling/c_extractor/c_module_edits.rb +48 -0
- data/lib/ceedling/c_identifier.rb +21 -0
- data/lib/ceedling/ceedling.h +8 -0
- data/lib/ceedling/config/configurator.rb +4 -3
- data/lib/ceedling/config/configurator_builder.rb +17 -0
- data/lib/ceedling/config/configurator_setup.rb +29 -5
- data/lib/ceedling/constants.rb +5 -1
- data/lib/ceedling/defaults.rb +31 -1
- data/lib/ceedling/dependencies/CACHE_SCHEMA.md +118 -0
- data/lib/ceedling/dependencies/README.md +1 -1
- data/lib/ceedling/dependencies/dependency_cache_store.rb +30 -25
- data/lib/ceedling/dependencies/dependency_tracker.rb +9 -3
- data/lib/ceedling/dependencies/dependinator.rb +13 -1
- data/lib/ceedling/diagnostics/DOCTOR.md +142 -0
- data/lib/ceedling/diagnostics/README.md +5 -0
- data/lib/ceedling/diagnostics/build_step_doctor.rb +110 -0
- data/lib/ceedling/diagnostics/duplicate_symbol_specialist.rb +108 -0
- data/lib/ceedling/diagnostics/guidance_phrases.rb +30 -0
- data/lib/ceedling/diagnostics/header_collision_guidance.rb +56 -0
- data/lib/ceedling/diagnostics/header_collision_specialist.rb +152 -0
- data/lib/ceedling/diagnostics/include_depth_specialist.rb +132 -0
- data/lib/ceedling/diagnostics/missing_symbol_specialist.rb +111 -0
- data/lib/ceedling/diagnostics/partial_name_specialist.rb +134 -0
- data/lib/ceedling/diagnostics/toolchain_output.rb +44 -0
- data/lib/ceedling/filesystem/PATH_HANDLING.md +83 -27
- data/lib/ceedling/filesystem/README.md +6 -1
- data/lib/ceedling/filesystem/build_roots.rb +105 -0
- data/lib/ceedling/filesystem/build_subpath.rb +110 -25
- data/lib/ceedling/filesystem/file_finder.rb +76 -110
- data/lib/ceedling/filesystem/file_finder_helper.rb +33 -11
- data/lib/ceedling/filesystem/file_path_utils.rb +113 -91
- data/lib/ceedling/filesystem/file_wrapper.rb +105 -28
- data/lib/ceedling/filesystem/path_matcher.rb +21 -0
- data/lib/ceedling/filesystem/test_build_layout.rb +114 -0
- data/lib/ceedling/filesystem/win_long_paths.rb +153 -0
- data/lib/ceedling/filesystem/win_path_limit.rb +83 -0
- data/lib/ceedling/filesystem/win_path_prober.rb +52 -0
- data/lib/ceedling/generators/generator.rb +27 -64
- data/lib/ceedling/generators/generator_helper.rb +0 -44
- data/lib/ceedling/generators/generator_mocks.rb +5 -0
- data/lib/ceedling/generators/generator_partials.rb +305 -243
- data/lib/ceedling/generators/generator_test_runner.rb +5 -8
- data/lib/ceedling/generators/partial_header_writer.rb +95 -0
- data/lib/ceedling/generators/partial_source_writer.rb +137 -0
- data/lib/ceedling/includes/header_search.rb +225 -0
- data/lib/ceedling/includes/include_factory.rb +9 -12
- data/lib/ceedling/includes/include_pathinator.rb +53 -31
- data/lib/ceedling/includes/includes.rb +149 -37
- data/lib/ceedling/objects.yml +89 -4
- data/lib/ceedling/partials/README.md +110 -16
- data/lib/ceedling/partials/carry_plan.rb +71 -0
- data/lib/ceedling/partials/definition_head.rb +74 -0
- data/lib/ceedling/partials/include_groups.rb +37 -0
- data/lib/ceedling/partials/interface_extras.rb +25 -0
- data/lib/ceedling/partials/partializer.rb +599 -120
- data/lib/ceedling/partials/partializer_config.rb +5 -0
- data/lib/ceedling/partials/partializer_helper.rb +851 -145
- data/lib/ceedling/partials/partializer_reconciler.rb +174 -0
- data/lib/ceedling/partials/partializer_utils.rb +89 -109
- data/lib/ceedling/partials/partials.rb +153 -10
- data/lib/ceedling/partials/type_macros.rb +126 -0
- data/lib/ceedling/preprocess/README.md +43 -33
- data/lib/ceedling/preprocess/preprocessinator.rb +100 -186
- data/lib/ceedling/preprocess/preprocessinator_code_finder.rb +65 -72
- data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +31 -75
- data/lib/ceedling/preprocess/preprocessinator_reconstructor.rb +51 -14
- data/lib/ceedling/setupinator.rb +16 -3
- data/lib/ceedling/test_invoker/HEADER_COLLISIONS.md +21 -7
- data/lib/ceedling/test_invoker/PIPELINE.md +57 -16
- data/lib/ceedling/test_invoker/README.md +1 -1
- data/lib/ceedling/test_invoker/derived_search_path_notices.rb +45 -0
- data/lib/ceedling/test_invoker/mock_locator.rb +116 -9
- data/lib/ceedling/test_invoker/partial_files_preprocessinator.rb +181 -0
- data/lib/ceedling/test_invoker/partials_manager.rb +265 -308
- data/lib/ceedling/test_invoker/standin_headerinator.rb +8 -15
- data/lib/ceedling/test_invoker/test_bare_includes_extractinator.rb +26 -3
- data/lib/ceedling/test_invoker/test_build_executor.rb +338 -198
- data/lib/ceedling/test_invoker/test_build_planner.rb +13 -19
- data/lib/ceedling/test_invoker/test_build_setup.rb +26 -6
- data/lib/ceedling/test_invoker/test_build_validations.rb +23 -20
- data/lib/ceedling/test_invoker/test_derived_search_paths.rb +189 -0
- data/lib/ceedling/test_invoker/test_file_preprocessinator.rb +1 -2
- data/lib/ceedling/test_invoker/test_includes_reconcilinator.rb +1 -1
- data/lib/ceedling/test_invoker/test_invoker_types.rb +28 -20
- data/lib/ceedling/test_invoker/test_pipeline_helpers.rb +5 -3
- data/lib/ceedling/test_invoker/test_pipeline_manager.rb +25 -8
- data/lib/ceedling/test_invoker/test_runner_generatinator.rb +31 -3
- data/lib/ceedling/test_invoker/test_search_paths.rb +30 -8
- data/lib/ceedling/test_invoker/test_substitutions.rb +72 -0
- data/lib/ceedling/tools/shell_quoting.rb +45 -0
- data/lib/ceedling/tools/tool_quoting.rb +79 -0
- data/lib/ceedling/{tool_validator.rb → tools/tool_validator.rb} +18 -7
- data/lib/version.rb +1 -1
- data/plugins/bullseye/bullseye.rake +1 -3
- data/plugins/bullseye/lib/bullseye.rb +15 -2
- data/plugins/command_hooks/lib/command_hooks.rb +1 -1
- data/plugins/fff/lib/fff.rb +42 -15
- data/plugins/fff/lib/fff_mock_generator.rb +12 -9
- data/plugins/fff/spec/fff_cmock_wrapper_spec.rb +134 -0
- data/plugins/fff/spec/fff_mock_header_generator_spec.rb +9 -0
- data/plugins/fff/spec/fff_mock_source_generator_spec.rb +20 -0
- data/plugins/gcov/lib/console_reportinator.rb +25 -19
- data/plugins/gcov/lib/reportgenerator_reportinator.rb +2 -1
- data/site-local/404.html +2 -2
- data/site-local/assets/javascripts/{bundle.c21346df.min.js → bundle.a5f9d56c.min.js} +1 -1
- data/site-local/assets/javascripts/{bundle.c21346df.min.js.map → bundle.a5f9d56c.min.js.map} +2 -2
- data/site-local/configuration/environment-vars.html +2 -2
- data/site-local/configuration/global-collections.html +3 -3
- data/site-local/configuration/index.html +2 -2
- data/site-local/configuration/loading.html +2 -2
- data/site-local/configuration/mixins.html +2 -2
- data/site-local/configuration/parallel-builds.html +2 -2
- data/site-local/configuration/project-file.html +2 -2
- data/site-local/configuration/reference/cexception.html +2 -2
- data/site-local/configuration/reference/cmock.html +5 -2
- data/site-local/configuration/reference/defines.html +2 -2
- data/site-local/configuration/reference/environment.html +2 -2
- data/site-local/configuration/reference/extension.html +2 -2
- data/site-local/configuration/reference/files.html +56 -9
- data/site-local/configuration/reference/flags.html +2 -2
- data/site-local/configuration/reference/index.html +2 -2
- data/site-local/configuration/reference/libraries.html +2 -2
- data/site-local/configuration/reference/mixins.html +2 -2
- data/site-local/configuration/reference/partials.html +84 -2
- data/site-local/configuration/reference/paths.html +7 -2
- data/site-local/configuration/reference/plugins.html +2 -2
- data/site-local/configuration/reference/project.html +247 -5
- data/site-local/configuration/reference/release-build.html +2 -2
- data/site-local/configuration/reference/test-build.html +2 -2
- data/site-local/configuration/reference/test-runner.html +2 -2
- data/site-local/configuration/reference/tools.html +49 -4
- data/site-local/configuration/reference/unity.html +2 -2
- data/site-local/configuration/which-ceedling.html +2 -2
- data/site-local/development/index.html +2 -2
- data/site-local/development/plugins/configuration.html +2 -2
- data/site-local/development/plugins/index.html +2 -2
- data/site-local/development/plugins/plugin-subclass.html +5 -4
- data/site-local/development/plugins/rake-tasks.html +2 -2
- data/site-local/development/releases.html +2 -2
- data/site-local/development/workflow.html +2 -2
- data/site-local/getting-started/builds.html +2 -2
- data/site-local/getting-started/command-line.html +2 -2
- data/site-local/getting-started/example-projects/cipher-quest.html +2 -2
- data/site-local/getting-started/example-projects/index.html +2 -2
- data/site-local/getting-started/example-projects/temp-sensor.html +2 -2
- data/site-local/getting-started/example-projects/wondrous-forest.html +10 -2
- data/site-local/getting-started/index.html +2 -2
- data/site-local/getting-started/installation.html +2 -2
- data/site-local/getting-started/quick-start.html +2 -2
- data/site-local/help.html +2 -2
- data/site-local/index.html +2 -2
- data/site-local/overview/build-system.html +2 -2
- data/site-local/overview/index.html +2 -2
- data/site-local/overview/test-environments.html +2 -2
- data/site-local/overview/tools-and-frameworks.html +2 -2
- data/site-local/plugins/beep.html +2 -2
- data/site-local/plugins/bullseye/index.html +45 -38
- data/site-local/plugins/bullseye/licensing.html +2 -2
- data/site-local/plugins/command-hooks.html +4 -4
- data/site-local/plugins/compile-commands-json-db.html +2 -2
- data/site-local/plugins/cppcheck.html +2 -2
- data/site-local/plugins/dependencies.html +2 -2
- data/site-local/plugins/fff.html +16 -2
- data/site-local/plugins/gcov/examples.html +2 -2
- data/site-local/plugins/gcov/gcovr.html +8 -2
- data/site-local/plugins/gcov/index.html +2 -2
- data/site-local/plugins/gcov/overview.html +2 -2
- data/site-local/plugins/gcov/reportgenerator.html +18 -14
- data/site-local/plugins/gcov/reporting.html +2 -2
- data/site-local/plugins/gcov/setup.html +2 -2
- data/site-local/plugins/gcov/tool-versions.html +2 -2
- data/site-local/plugins/gcov/troubleshooting.html +2 -2
- data/site-local/plugins/index.html +2 -2
- data/site-local/plugins/module-generator.html +2 -2
- data/site-local/plugins/report-build-warnings-log.html +2 -2
- data/site-local/plugins/report-tests-gtestlike-stdout.html +2 -2
- data/site-local/plugins/report-tests-ide-stdout.html +2 -2
- data/site-local/plugins/report-tests-log-factory.html +2 -2
- data/site-local/plugins/report-tests-pretty-stdout.html +2 -2
- data/site-local/plugins/report-tests-raw-output-log.html +2 -2
- data/site-local/plugins/report-tests-teamcity-stdout.html +2 -2
- data/site-local/plugins/sanitize.html +2 -2
- data/site-local/plugins/valgrind.html +2 -2
- data/site-local/project/index.html +2 -2
- data/site-local/project/release-history.html +2 -2
- data/site-local/project/sbom.html +2 -2
- data/site-local/project/upgrade.html +2 -2
- data/site-local/reference/build-directives.html +2 -2
- data/site-local/reference/command-line.html +2 -2
- data/site-local/reference/environment-vars.html +2 -2
- data/site-local/reference/gcov-plugin.html +2 -2
- data/site-local/reference/global-collections.html +12 -12
- data/site-local/reference/index.html +2 -2
- data/site-local/reference/partials-macros.html +47 -2
- data/site-local/reference/project-configuration.html +2 -2
- data/site-local/sitemap.xml.gz +0 -0
- data/site-local/snapshot/examples/cipher_quest/index.html +2 -2
- data/site-local/snapshot/examples/temp_sensor/index.html +2 -2
- data/site-local/snapshot/examples/wondrous_forest/index.html +72 -15
- data/site-local/testing-guide/build-directives.html +2 -2
- data/site-local/testing-guide/conventions.html +67 -22
- data/site-local/testing-guide/frameworks.html +2 -2
- data/site-local/testing-guide/index.html +2 -2
- data/site-local/testing-guide/partials/configuration.html +31 -4
- data/site-local/testing-guide/partials/conventions.html +509 -8
- data/site-local/testing-guide/partials/directives.html +4 -3
- data/site-local/testing-guide/partials/example.html +2 -2
- data/site-local/testing-guide/partials/index.html +2 -2
- data/site-local/testing-guide/partials/overview.html +30 -12
- data/site-local/testing-guide/partials/variables.html +169 -4
- data/site-local/testing-guide/test-cases.html +2 -2
- data/site-local/testing-guide/test-sample.html +2 -2
- data/site-local/testing-guide/test-suite-anatomy.html +2 -2
- data/spec/integration/build_step_doctor_spec.rb +270 -0
- data/spec/integration/c_extractor_composition_spec.rb +254 -4
- data/spec/integration/includes_extraction_spec.rb +27 -14
- data/spec/integration/nested_test_artifacts_spec.rb +1 -1
- data/spec/integration/partial_files_preprocessing_spec.rb +128 -0
- data/spec/integration/partials_carry_spec.rb +520 -0
- data/spec/integration/partials_declarations_spec.rb +655 -0
- data/spec/integration/partials_fallback_preprocessing_spec.rb +65 -0
- data/spec/integration/partials_function_pointers_spec.rb +277 -0
- data/spec/integration/partials_header_composition_spec.rb +268 -35
- data/spec/integration/partials_macro_decorators_spec.rb +267 -0
- data/spec/integration/partials_module_resolution_spec.rb +26 -19
- data/spec/integration/partials_symbol_linkage_spec.rb +13 -0
- data/spec/integration/path_length_reporting_spec.rb +64 -0
- data/spec/integration/path_scenarios_spec.rb +80 -3
- data/spec/integration/quote_include_isolator_spec.rb +56 -0
- data/spec/integration/test_build_parallel_barrier_spec.rb +1 -1
- data/spec/integration/test_includes_extractinator_spec.rb +70 -5
- data/spec/integration/test_naming_spec.rb +6 -3
- data/spec/integration/test_source_file_checks_spec.rb +5 -3
- data/spec/integration/tool_executor_spec.rb +1 -1
- data/spec/integration/tool_validator_spec.rb +2 -2
- data/spec/integration/win_long_paths_probe_spec.rb +46 -0
- data/spec/integration/win_path_limit_spec.rb +53 -0
- data/spec/integration/windows_registry_query_tool_spec.rb +41 -0
- data/spec/support/integration/configurator_integration_helper.rb +8 -3
- data/spec/support/integration/partial_files_harness.rb +181 -0
- data/spec/support/integration/partials_generation_integration_helper.rb +237 -141
- data/spec/support/integration/path_scenario_harness.rb +4 -2
- data/spec/support/integration/spec_integration_helper.rb +8 -3
- data/spec/support/integration/test_includes_harness.rb +56 -35
- data/spec/support/integration/tool_executor_integration_helper.rb +14 -2
- data/spec/system/bullseye_deployment_spec.rb +2 -0
- data/spec/system/delta_builds_spec.rb +26 -12
- data/spec/system/encoding_stress_spec.rb +4 -4
- data/spec/system/example_wondrous_forest_spec.rb +2 -2
- data/spec/system/gcov_deployment_spec.rb +2 -0
- data/spec/system/header_include_path_validation_spec.rb +4 -4
- data/spec/system/header_search_paths_spec.rb +1083 -0
- data/spec/system/mock_include_folders_spec.rb +121 -0
- data/spec/system/mockable_header_reassembly_spec.rb +184 -0
- data/spec/system/partials_carry_spec.rb +581 -0
- data/spec/system/partials_delta_builds_spec.rb +280 -0
- data/spec/system/partials_function_pointers_spec.rb +106 -0
- data/spec/system/partials_macro_decorators_spec.rb +127 -0
- data/spec/system/partials_module_disambiguation_spec.rb +125 -0
- data/spec/system/path_handling_probes_spec.rb +16 -12
- data/spec/system/pinned_thread_count_spec.rb +4 -4
- data/spec/system/preprocessing_fallback_conditionals_spec.rb +1 -1
- data/spec/system/short_build_paths_spec.rb +87 -0
- data/spec/system/sibling_header_collision_spec.rb +30 -6
- data/spec/system/support/bullseye_common_test_cases.rb +42 -0
- data/spec/system/support/common_test_cases.rb +2 -2
- data/spec/system/support/gcov_partials_test_cases.rb +48 -0
- data/spec/system/test_build_layout_spec.rb +209 -0
- data/spec/system/test_source_file_directive_spec.rb +35 -5
- data/spec/units/c_extractor/c_extractor_code_text_spec.rb +67 -10
- data/spec/units/c_extractor/c_extractor_declarations_spec.rb +501 -4
- data/spec/units/c_extractor/c_extractor_declarator_spec.rb +245 -0
- data/spec/units/c_extractor/c_extractor_defined_type_spec.rb +45 -0
- data/spec/units/c_extractor/c_extractor_definitions_spec.rb +163 -3
- data/spec/units/c_extractor/c_extractor_functions_spec.rb +462 -21
- data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +39 -0
- data/spec/units/c_extractor/c_extractor_spec.rb +4 -4
- data/spec/units/c_extractor/c_extractor_types_spec.rb +163 -0
- data/spec/units/c_identifier_spec.rb +35 -0
- data/spec/units/config/configurator_builder_spec.rb +24 -0
- data/spec/units/config/configurator_setup_spec.rb +72 -4
- data/spec/units/config/configurator_spec.rb +27 -1
- data/spec/units/dependencies/dependency_cache_store_spec.rb +68 -3
- data/spec/units/dependencies/dependency_tracker_spec.rb +25 -0
- data/spec/units/dependencies/dependinator_spec.rb +17 -2
- data/spec/units/diagnostics/build_step_doctor_spec.rb +170 -0
- data/spec/units/diagnostics/duplicate_symbol_specialist_spec.rb +117 -0
- data/spec/units/diagnostics/header_collision_specialist_spec.rb +267 -0
- data/spec/units/diagnostics/include_depth_specialist_spec.rb +137 -0
- data/spec/units/diagnostics/missing_symbol_specialist_spec.rb +154 -0
- data/spec/units/diagnostics/partial_name_specialist_spec.rb +129 -0
- data/spec/units/diagnostics/toolchain_output_spec.rb +86 -0
- data/spec/units/encodinator_spec.rb +3 -4
- data/spec/units/filesystem/build_roots_spec.rb +131 -0
- data/spec/units/filesystem/build_subpath_spec.rb +113 -0
- data/spec/units/filesystem/file_finder_helper_spec.rb +80 -0
- data/spec/units/filesystem/file_finder_spec.rb +242 -58
- data/spec/units/filesystem/file_path_utils_spec.rb +251 -118
- data/spec/units/filesystem/file_wrapper_spec.rb +191 -6
- data/spec/units/filesystem/path_matcher_spec.rb +36 -0
- data/spec/units/filesystem/test_build_layout_spec.rb +216 -0
- data/spec/units/filesystem/win_long_paths_spec.rb +204 -0
- data/spec/units/filesystem/win_path_prober_spec.rb +158 -0
- data/spec/units/generators/generator_helper_spec.rb +0 -60
- data/spec/units/generators/generator_mocks_spec.rb +13 -0
- data/spec/units/generators/generator_partials_spec.rb +656 -55
- data/spec/units/generators/generator_spec.rb +26 -0
- data/spec/units/generators/generator_test_runner_spec.rb +9 -5
- data/spec/units/generators/partial_source_writer_spec.rb +129 -0
- data/spec/units/includes/header_search_spec.rb +406 -0
- data/spec/units/includes/include_factory_spec.rb +22 -5
- data/spec/units/includes/include_pathinator_spec.rb +77 -13
- data/spec/units/includes/include_spec.rb +14 -0
- data/spec/units/includes/includes_spec.rb +176 -19
- data/spec/units/loginator_spec.rb +31 -0
- data/spec/units/mock_locator_spec.rb +199 -5
- data/spec/units/partials/include_groups_spec.rb +42 -0
- data/spec/units/partials/partializer_config_spec.rb +25 -0
- data/spec/units/partials/partializer_helper_carry_spec.rb +661 -0
- data/spec/units/partials/partializer_helper_interface_extras_spec.rb +396 -0
- data/spec/units/partials/partializer_helper_spec.rb +529 -277
- data/spec/units/partials/partializer_reconciler_spec.rb +661 -0
- data/spec/units/partials/partializer_spec.rb +1578 -270
- data/spec/units/partials/partializer_utils_spec.rb +269 -232
- data/spec/units/partials/partials_rename_spec.rb +160 -0
- data/spec/units/partials_manager_spec.rb +554 -261
- data/spec/units/plugins/bullseye_spec.rb +34 -0
- data/spec/units/plugins/console_reportinator_spec.rb +58 -9
- data/spec/units/plugins/report_tests_teamcity_stdout_spec.rb +1 -1
- data/spec/units/plugins/reportgenerator_reportinator_spec.rb +51 -3
- data/spec/units/preprocess/preprocessinator_code_finder_spec.rb +73 -10
- data/spec/units/preprocess/preprocessinator_file_assembler_spec.rb +125 -37
- data/spec/units/preprocess/preprocessinator_includes_handler_spec.rb +15 -0
- data/spec/units/preprocess/preprocessinator_reconstructor_spec.rb +197 -0
- data/spec/units/preprocess/preprocessinator_spec.rb +153 -95
- data/spec/units/setupinator_spec.rb +51 -0
- data/spec/units/standin_headerinator_spec.rb +27 -11
- data/spec/units/test_build_executor_spec.rb +780 -166
- data/spec/units/test_build_planner_spec.rb +116 -28
- data/spec/units/test_build_setup_spec.rb +83 -18
- data/spec/units/test_context_extractor_spec.rb +11 -2
- data/spec/units/test_derived_search_paths_spec.rb +259 -0
- data/spec/units/test_includes_extractinator_spec.rb +56 -8
- data/spec/units/test_invoker/objects_wiring_spec.rb +20 -3
- data/spec/units/test_invoker/partial_files_preprocessinator_spec.rb +264 -0
- data/spec/units/test_invoker/test_substitutions_spec.rb +122 -0
- data/spec/units/test_invoker_types_spec.rb +8 -7
- data/spec/units/test_pipeline_manager_spec.rb +54 -13
- data/spec/units/test_runner_generatinator_spec.rb +93 -1
- data/spec/units/test_search_paths_spec.rb +73 -5
- data/spec/units/{default_tools_quoting_spec.rb → tools/default_tools_quoting_spec.rb} +39 -5
- data/spec/units/tools/shell_quoting_spec.rb +76 -0
- data/spec/units/{tool_executor_helper_spec.rb → tools/tool_executor_helper_spec.rb} +1 -1
- data/spec/units/{tool_executor_spec.rb → tools/tool_executor_spec.rb} +1 -1
- data/spec/units/{tool_validator_spec.rb → tools/tool_validator_spec.rb} +110 -1
- data/spec/units/windows_registry_query_tool_spec.rb +53 -0
- metadata +161 -16
- /data/lib/ceedling/{tool_executor.rb → tools/tool_executor.rb} +0 -0
- /data/lib/ceedling/{tool_executor_helper.rb → tools/tool_executor_helper.rb} +0 -0
|
@@ -0,0 +1,655 @@
|
|
|
1
|
+
# =========================================================================
|
|
2
|
+
# Ceedling - Test-Centered Build System for C
|
|
3
|
+
# ThrowTheSwitch.org
|
|
4
|
+
# Copyright (c) 2010-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
6
|
+
# =========================================================================
|
|
7
|
+
|
|
8
|
+
# Declaration spellings in a Partial, proven with a real compiler.
|
|
9
|
+
#
|
|
10
|
+
# A Partial reads each of a module's declarations and writes it again. It must tell a type from a
|
|
11
|
+
# variable or a function, split a compound declaration, and read each name and type whole. Each
|
|
12
|
+
# case below is a spelling real modules use, and each must generate, compile and link. A case
|
|
13
|
+
# that defines a type also compiles the types header alone, since every generated file
|
|
14
|
+
# includes it.
|
|
15
|
+
#
|
|
16
|
+
# Generation runs through spec/support/integration/partials_generation_integration_helper.rb.
|
|
17
|
+
|
|
18
|
+
require 'spec_helper'
|
|
19
|
+
require 'spec_integration_helper'
|
|
20
|
+
require 'partials_generation_integration_helper'
|
|
21
|
+
require 'tempfile'
|
|
22
|
+
|
|
23
|
+
describe 'Declarations in a Partial' do
|
|
24
|
+
|
|
25
|
+
include_context 'requires gcc'
|
|
26
|
+
before { skip 'directives-only preprocessing is unavailable' unless directives_only_supported? }
|
|
27
|
+
|
|
28
|
+
after(:each) { cleanup_partial( @result ) }
|
|
29
|
+
|
|
30
|
+
def guarded(body)
|
|
31
|
+
"#ifndef TICKER_H\n#define TICKER_H\n#{body}#endif\n"
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def ticker(header:, source:)
|
|
35
|
+
generate_partial(
|
|
36
|
+
module_name: 'ticker', header: guarded( header ), source: "#include \"ticker.h\"\n#{source}",
|
|
37
|
+
source_includes: ['ticker.h'], tests_expose: PartializerConfig::PUBLIC
|
|
38
|
+
)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# `stubs` is C the stand-in test file holds after the headers, such as code reading a member
|
|
42
|
+
def expect_link(result, references, stubs: '', flags: '')
|
|
43
|
+
link = link_partial( result, references: references, stubs: stubs, flags: flags )
|
|
44
|
+
expect( link.ok ).to be(true), "expected a clean link, got: #{link.first_error}"
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def expect_types_header_compiles(result)
|
|
48
|
+
compile = compile_types_header_alone( result )
|
|
49
|
+
expect( compile.ok ).to be(true), "expected the types header to compile alone, got: #{compile.first_error}"
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# ---------------------------------------------------------------------------
|
|
53
|
+
context 'a struct, union or enum keyword leading a statement' do
|
|
54
|
+
# ---------------------------------------------------------------------------
|
|
55
|
+
|
|
56
|
+
# An initialized definition is never a common symbol, so a copy in the types header
|
|
57
|
+
# collides in every translation unit that includes it
|
|
58
|
+
it 'defines an initialized struct variable once, in the implementation source' do
|
|
59
|
+
@result = ticker(
|
|
60
|
+
header: "struct ops { int a; };\nint ticker_get(void);\n",
|
|
61
|
+
source: "struct ops g_ops = { 1 };\nint ticker_get(void) { return g_ops.a; }\n"
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
expect( @result.types_h ).not_to include( 'g_ops' )
|
|
65
|
+
expect( @result.impl_h ).to include( 'extern struct ops g_ops;' )
|
|
66
|
+
expect_types_header_compiles( @result )
|
|
67
|
+
expect_link( @result, ['g_ops', 'ticker_get'], stubs: "int read_ops(void) { return g_ops.a; }\n" )
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it 'defines an initialized union variable once' do
|
|
71
|
+
@result = ticker(
|
|
72
|
+
header: "union u { int i; float f; };\nint ticker_get(void);\n",
|
|
73
|
+
source: "union u g_u = { 0 };\nint ticker_get(void) { return g_u.i; }\n"
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
expect( @result.types_h ).not_to include( 'g_u' )
|
|
77
|
+
expect_link( @result, ['g_u'] )
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it 'defines an initialized array of struct pointers once' do
|
|
81
|
+
@result = ticker(
|
|
82
|
+
header: "struct ops { int a; };\nint ticker_get(void);\n",
|
|
83
|
+
source: "struct ops a1 = { 1 };\nstruct ops b1 = { 2 };\nstruct ops *tbl[] = { &a1, &b1 };\n" \
|
|
84
|
+
"int ticker_get(void) { return tbl[1]->a; }\n"
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
expect( @result.types_h ).not_to include( 'tbl' )
|
|
88
|
+
expect( @result.impl_h ).to include( 'extern struct ops * tbl[];' )
|
|
89
|
+
expect_link( @result, ['tbl', 'a1', 'b1'] )
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
# The usual way to write a driver's table of operations
|
|
93
|
+
it 'defines a table of designated function pointers once' do
|
|
94
|
+
@result = ticker(
|
|
95
|
+
header: "struct drv_ops { int (*init)(void); int (*read)(void); };\nint drv_init(void);\nint drv_read(void);\n",
|
|
96
|
+
source: "int drv_init(void) { return 1; }\nint drv_read(void) { return 2; }\n" \
|
|
97
|
+
"struct drv_ops g_drv = { .init = drv_init, .read = drv_read };\n"
|
|
98
|
+
)
|
|
99
|
+
|
|
100
|
+
expect( @result.types_h ).not_to include( 'g_drv' )
|
|
101
|
+
expect_types_header_compiles( @result )
|
|
102
|
+
expect_link( @result, ['g_drv'], stubs: "int read_drv(void) { return g_drv.read(); }\n" )
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
it 'defines an initialized array of structs once' do
|
|
106
|
+
@result = ticker(
|
|
107
|
+
header: "struct ops { int a; };\nint ticker_get(void);\n",
|
|
108
|
+
source: "struct ops g_arr[2] = { {1}, {2} };\nint ticker_get(void) { return g_arr[1].a; }\n"
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
expect( @result.impl_h ).to include( 'extern struct ops g_arr[2];' )
|
|
112
|
+
expect_link( @result, ['g_arr'] )
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
# A ';' after a function's body is legal at file scope, and some generated code writes one
|
|
116
|
+
it 'selects a function returning a struct pointer with a stray semicolon after its body' do
|
|
117
|
+
@result = ticker(
|
|
118
|
+
header: "struct ops { int a; };\nstruct ops *make_ops(void);\n",
|
|
119
|
+
source: "static struct ops k = { 1 };\nstruct ops *make_ops(void) { return &k; };\n"
|
|
120
|
+
)
|
|
121
|
+
|
|
122
|
+
expect( @result.types_h ).not_to include( 'make_ops' )
|
|
123
|
+
expect( @result.impl_h ).to include( 'struct ops *make_ops(void);' )
|
|
124
|
+
expect_link( @result, ['make_ops'] )
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'selects a function returning a struct with a stray semicolon after its body' do
|
|
128
|
+
@result = ticker(
|
|
129
|
+
header: "struct ops { int a; };\nstruct ops make_v(void);\n",
|
|
130
|
+
source: "struct ops make_v(void) { struct ops o = { 1 }; return o; };\n"
|
|
131
|
+
)
|
|
132
|
+
|
|
133
|
+
expect( @result.types_h ).not_to include( 'make_v' )
|
|
134
|
+
expect_link( @result, ['make_v'] )
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
# GCC accepts a type's attributes after its closing brace, as packed structs often have them
|
|
138
|
+
it 'carries a type with an attribute after its body into the types header' do
|
|
139
|
+
@result = ticker(
|
|
140
|
+
header: "struct pk { char c; int i; } __attribute__((packed));\nint ticker_size(void);\n",
|
|
141
|
+
source: "struct pk g_pk;\nint ticker_size(void) { return (int)sizeof(struct pk); }\n"
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
expect( @result.types_h ).to include( 'struct pk { char c; int i; } __attribute__((packed));' )
|
|
145
|
+
expect_types_header_compiles( @result )
|
|
146
|
+
expect_link( @result, ['g_pk', 'ticker_size'], stubs: "int read_pk(void) { return g_pk.c; }\n" )
|
|
147
|
+
end
|
|
148
|
+
|
|
149
|
+
# Zephyr and Linux spell the attribute through a macro their toolchain header defines
|
|
150
|
+
it 'carries a type with an attribute macro after its body into the types header' do
|
|
151
|
+
@result = generate_partial(
|
|
152
|
+
module_name: 'ticker',
|
|
153
|
+
header: guarded( "#include \"toolchain.h\"\nstruct pk { char c; int i; } __packed;\nint ticker_size(void);\n" ),
|
|
154
|
+
source: "#include \"ticker.h\"\nstruct pk g_pk;\nint ticker_size(void) { return (int)sizeof(struct pk); }\n",
|
|
155
|
+
header_includes: ['toolchain.h'], source_includes: ['ticker.h'], tests_expose: PartializerConfig::PUBLIC,
|
|
156
|
+
extra: { 'toolchain.h' => "#ifndef TOOLCHAIN_H\n#define TOOLCHAIN_H\n#define __packed __attribute__((packed))\n#endif\n" }
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
expect( @result.types_h ).to include( 'struct pk { char c; int i; } __packed;' )
|
|
160
|
+
expect_types_header_compiles( @result )
|
|
161
|
+
expect_link( @result, ['g_pk', 'ticker_size'], stubs: "int read_pk(void) { return g_pk.c; }\n" )
|
|
162
|
+
end
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# ---------------------------------------------------------------------------
|
|
166
|
+
context 'type specifiers and keywords' do
|
|
167
|
+
# ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
# An extern repeats a variable's type, which a specifier or keyword may spell. Every case
|
|
170
|
+
# here compiles in GCC 13's default dialect, which CI's Linux job uses.
|
|
171
|
+
it 'declares variables whose types a specifier taking parentheses spells' do
|
|
172
|
+
@result = ticker(
|
|
173
|
+
header: "int ticker_get(void);\n",
|
|
174
|
+
source: "int *g_pp;\ntypeof(int) g_t;\n_Atomic(int) g_a;\n_Alignas(8) int g_al;\ntypeof(*g_pp) g_q;\n__typeof__(int) g_u;\n" \
|
|
175
|
+
"_Alignas(8) static int s_as;\nint ticker_get(void) { return g_t + g_a + g_al + g_q + g_u + s_as; }\n"
|
|
176
|
+
)
|
|
177
|
+
|
|
178
|
+
expect( @result.impl_h ).to include( 'extern typeof(int) g_t;', 'extern _Atomic(int) g_a;', 'extern typeof(*g_pp) g_q;' )
|
|
179
|
+
expect( @result.impl_h ).to include( 'extern _Alignas(8) int s_as;' )
|
|
180
|
+
expect_link( @result, ['g_t', 'g_a', 'g_al', 'g_q', 'g_u', 's_as'] )
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
it 'declares variables whose types a keyword spells' do
|
|
184
|
+
@result = ticker(
|
|
185
|
+
header: "int ticker_get(void);\n",
|
|
186
|
+
source: "_Bool g_f;\n_Atomic int g_ai;\n_Thread_local int g_tl;\n_Complex double g_c;\n" \
|
|
187
|
+
"int ticker_get(void) { return g_f + g_ai + g_tl + (int)__real__ g_c; }\n"
|
|
188
|
+
)
|
|
189
|
+
|
|
190
|
+
expect( @result.impl_h ).to include( 'extern _Bool g_f;', 'extern _Atomic int g_ai;', 'extern _Thread_local int g_tl;', 'extern _Complex double g_c;' )
|
|
191
|
+
expect_link( @result, ['g_f', 'g_ai', 'g_c'] )
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# A weak definition of a struct never completed can't compile, whatever keyword leads its type.
|
|
195
|
+
# Clang rejects `_Atomic` on an incomplete struct, so only a unit spec covers that keyword.
|
|
196
|
+
it 'writes no weak definition for a thread-local extern of a struct never completed' do
|
|
197
|
+
@result = ticker(
|
|
198
|
+
header: "struct opaque;\nextern _Thread_local struct opaque g_o;\n" \
|
|
199
|
+
"typedef struct opaque opaque_t;\nextern _Thread_local opaque_t g_t;\nint ticker_get(void);\n",
|
|
200
|
+
source: "int ticker_get(void) { return 1; }\n"
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
expect( @result.impl_c ).not_to include( 'g_o', 'g_t' )
|
|
204
|
+
compile = compile_objects( @result )
|
|
205
|
+
expect( compile.ok ).to be(true), "expected a clean compile, got: #{compile.first_error}"
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
it 'selects a function whose return type a specifier spells' do
|
|
209
|
+
@result = ticker(
|
|
210
|
+
header: "typeof(int) tf(void);\n",
|
|
211
|
+
source: "typeof(int) tf(void) { return 0; }\n"
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
expect( @result.impl_h ).to include( 'typeof(int) tf(void);' )
|
|
215
|
+
expect_link( @result, ['tf'] )
|
|
216
|
+
end
|
|
217
|
+
end
|
|
218
|
+
|
|
219
|
+
# ---------------------------------------------------------------------------
|
|
220
|
+
context "names holding '$'" do
|
|
221
|
+
# ---------------------------------------------------------------------------
|
|
222
|
+
|
|
223
|
+
# GCC and Clang accept '$' in an identifier on most targets, and a case needs a compiler that does
|
|
224
|
+
before do
|
|
225
|
+
probe = Tempfile.new( ['dollar', '.c'] )
|
|
226
|
+
probe.write( "int a$b;\n" ) && probe.close
|
|
227
|
+
_out, _err, status = Open3.capture3( "#{partials_compiler} -fsyntax-only #{probe.path}" )
|
|
228
|
+
probe.unlink
|
|
229
|
+
skip "#{partials_compiler} rejects '$' in identifiers" unless status.success?
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
it "declares a variable and selects a function whose names hold '$'" do
|
|
233
|
+
@result = ticker(
|
|
234
|
+
header: "int f$1(void);\n",
|
|
235
|
+
source: "static int hook$2;\nint g$v[2];\nint f$1(void) { return hook$2 + g$v[1]; }\n"
|
|
236
|
+
)
|
|
237
|
+
|
|
238
|
+
expect( @result.impl_h ).to include( 'extern int hook$2;', 'extern int g$v[2];', 'int f$1(void);' )
|
|
239
|
+
expect_link( @result, ['hook$2', 'g$v', 'f$1'] )
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
it "promotes a function-scope static whose name holds '$'" do
|
|
243
|
+
@result = ticker(
|
|
244
|
+
header: "int ticker_get(void);\n",
|
|
245
|
+
source: "int ticker_get(void) { static int c$1 = 0; c$1++; return c$1; }\n"
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
expect( @result.impl_h ).to include( 'extern int partial_ticker_get_c$1;' )
|
|
249
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_c$1'] )
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
# The source's prototype gives an inline function another header defines its external
|
|
253
|
+
# definition, so the Partial must carry that prototype
|
|
254
|
+
it "carries the prototype of an inline function another header defines, named with '$'" do
|
|
255
|
+
@result = generate_partial(
|
|
256
|
+
module_name: 'ticker', header: guarded( "int ticker_get(void);\n" ),
|
|
257
|
+
source: "#include \"ticker.h\"\n#include \"engine_api.h\"\nextern int eng$twice(void);\nint ticker_get(void) { return 1; }\n",
|
|
258
|
+
source_includes: ['ticker.h', 'engine_api.h'], tests_expose: PartializerConfig::PUBLIC,
|
|
259
|
+
extra: { 'engine_api.h' => "#ifndef ENGINE_API_H\n#define ENGINE_API_H\ninline int eng$twice(void) { return 42; }\n#endif\n" }
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
expect( @result.impl_c ).to include( 'extern int eng$twice(void);' )
|
|
263
|
+
link = link_partial( @result, references: ['eng$twice'], flags: '-O0' )
|
|
264
|
+
expect( link.ok ).to be(true), "expected a clean link, got: #{link.first_error}"
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
# A weak definition of a struct never completed can't compile, so none is written
|
|
268
|
+
it "writes no weak definition for an extern whose struct type, named with '$', is never completed" do
|
|
269
|
+
@result = ticker(
|
|
270
|
+
header: "struct h$s;\nextern struct h$s the$h;\ntypedef struct h$t h$t_t;\nextern h$t_t the$t;\nint ticker_get(void);\n",
|
|
271
|
+
source: "int ticker_get(void) { return 1; }\n"
|
|
272
|
+
)
|
|
273
|
+
|
|
274
|
+
expect( @result.impl_c ).not_to include( 'the$h', 'the$t' )
|
|
275
|
+
compile = compile_objects( @result )
|
|
276
|
+
expect( compile.ok ).to be(true), "expected a clean compile, got: #{compile.first_error}"
|
|
277
|
+
end
|
|
278
|
+
end
|
|
279
|
+
|
|
280
|
+
# ---------------------------------------------------------------------------
|
|
281
|
+
context 'asm labels' do
|
|
282
|
+
# ---------------------------------------------------------------------------
|
|
283
|
+
|
|
284
|
+
# An asm label names a variable's symbol, so the test's extern must carry it to reach the definition
|
|
285
|
+
it 'keeps each spelling of an asm label on a variable extern' do
|
|
286
|
+
@result = ticker(
|
|
287
|
+
header: "int ticker_get(void);\n",
|
|
288
|
+
source: "int g_s __asm__(\"ticker_s_symbol\") = 1;\nint g_arr[2] __asm(\"ticker_arr_symbol\");\n" \
|
|
289
|
+
"int g_b asm(\"ticker_b_symbol\");\nint ticker_get(void) { return g_s + g_arr[1] + g_b; }\n"
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
expect( @result.impl_h ).to include( 'extern int g_s __asm__("ticker_s_symbol");', 'extern int g_arr[2] __asm("ticker_arr_symbol");',
|
|
293
|
+
'extern int g_b asm("ticker_b_symbol");' )
|
|
294
|
+
expect_link( @result, ['g_s', 'g_arr', 'g_b', 'ticker_get'] )
|
|
295
|
+
end
|
|
296
|
+
|
|
297
|
+
# A compiler applies the label of a variable's first declaration to its definition
|
|
298
|
+
it 'keeps an asm label the module header gives a variable' do
|
|
299
|
+
@result = ticker(
|
|
300
|
+
header: "extern int g_h __asm__(\"ticker_h_symbol\");\nint ticker_get(void);\n",
|
|
301
|
+
source: "int g_h = 3;\nint ticker_get(void) { return g_h; }\n"
|
|
302
|
+
)
|
|
303
|
+
|
|
304
|
+
expect( @result.impl_h ).to include( 'extern int g_h __asm__("ticker_h_symbol");' )
|
|
305
|
+
expect_link( @result, ['g_h', 'ticker_get'] )
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
# A weak definition stands in for a variable the module only declares, under the same symbol
|
|
309
|
+
it 'keeps an asm label on the weak definition of a variable the module only declares' do
|
|
310
|
+
@result = ticker(
|
|
311
|
+
header: "extern int g_w asm(\"ticker_w_symbol\");\nint ticker_get(void);\n",
|
|
312
|
+
source: "int ticker_get(void) { return g_w; }\n"
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
expect( @result.impl_h ).to include( 'extern int g_w asm("ticker_w_symbol");' )
|
|
316
|
+
expect( @result.impl_c ).to include( 'int g_w asm("ticker_w_symbol");' )
|
|
317
|
+
expect_link( @result, ['g_w', 'ticker_get'] )
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
it 'keeps an asm label on a promoted static' do
|
|
321
|
+
@result = ticker(
|
|
322
|
+
header: "int ticker_get(void);\n",
|
|
323
|
+
source: "int ticker_get(void) { static int s asm(\"ticker_static_symbol\") = 2; return s; }\n"
|
|
324
|
+
)
|
|
325
|
+
|
|
326
|
+
expect( @result.impl_h ).to include( 'extern int partial_ticker_get_s asm("ticker_static_symbol");' )
|
|
327
|
+
expect_link( @result, ['partial_ticker_get_s', 'ticker_get'] )
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# ---------------------------------------------------------------------------
|
|
332
|
+
context 'compound declarations' do
|
|
333
|
+
# ---------------------------------------------------------------------------
|
|
334
|
+
|
|
335
|
+
# Every variable of a compound declaration needs its own extern, wherever the initializers sit
|
|
336
|
+
it 'declares each variable when the first one has an initializer' do
|
|
337
|
+
@result = ticker(
|
|
338
|
+
header: "int ticker_get(void);\n",
|
|
339
|
+
source: "int g_x = 0, g_y;\nint ticker_get(void) { return g_x + g_y; }\n"
|
|
340
|
+
)
|
|
341
|
+
|
|
342
|
+
expect( @result.impl_h ).to include( 'extern int g_x;', 'extern int g_y;' )
|
|
343
|
+
expect_link( @result, ['g_x', 'g_y'] )
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
it 'declares each variable past commas inside initializers' do
|
|
347
|
+
@result = ticker(
|
|
348
|
+
header: "struct ops { int a; };\nint ticker_get(void);\n",
|
|
349
|
+
source: "char *g_s = \"a,b\", *g_t;\nint g_a[2] = {1, 2}, g_b;\nstruct ops g_o = { 1 }, g_n = { 2 };\n" \
|
|
350
|
+
"int ticker_get(void) { return g_a[1] + g_b + g_o.a + g_n.a + (g_t == g_s); }\n"
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
expect( @result.impl_h ).to include( 'extern int g_b;', 'extern struct ops g_n;' )
|
|
354
|
+
expect_link( @result, ['g_s', 'g_t', 'g_a', 'g_b', 'g_o', 'g_n'] )
|
|
355
|
+
end
|
|
356
|
+
|
|
357
|
+
# A later variable takes only the base type. A qualifier after a star, an attribute after
|
|
358
|
+
# the name and a line break belong to the first declarator.
|
|
359
|
+
it 'gives each later variable only the base type' do
|
|
360
|
+
@result = ticker(
|
|
361
|
+
header: "int ticker_get(void);\n",
|
|
362
|
+
source: "int *const g_a = 0, g_b;\nconst unsigned char\n g_tbl[] = {1, 2}, g_after = 3;\n" \
|
|
363
|
+
"int g_c __attribute__((aligned(4))) = 1, g_d;\n" \
|
|
364
|
+
"int ticker_get(void) { g_b++; return g_b + g_after + g_d + (g_a == 0); }\n"
|
|
365
|
+
)
|
|
366
|
+
|
|
367
|
+
expect( @result.impl_h ).to include( 'extern int g_b;', 'extern const unsigned char g_after;', 'extern int g_d;' )
|
|
368
|
+
expect_link( @result, ['g_a', 'g_b', 'g_tbl', 'g_after', 'g_c', 'g_d'], stubs: "int read_after(void) { return sizeof(g_after) == 1; }\n" )
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
# Partials promote a function's statics to file scope, renamed, so each one needs its own definition
|
|
372
|
+
it 'promotes each static of a compound statement in a function' do
|
|
373
|
+
@result = ticker(
|
|
374
|
+
header: "int ticker_get(void);\n",
|
|
375
|
+
source: "int ticker_get(void) { static int x = 0, y; static int a = 1, *p = &a; y++; return x + y + *p; }\n"
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
expect( @result.impl_h ).to include( 'extern int partial_ticker_get_y;', 'extern int * partial_ticker_get_p;' )
|
|
379
|
+
expect( @result.impl_c ).to include( 'int *partial_ticker_get_p = &partial_ticker_get_a;' )
|
|
380
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_x', 'partial_ticker_get_y', 'partial_ticker_get_p'] )
|
|
381
|
+
end
|
|
382
|
+
|
|
383
|
+
# A qualifier macro between the type and the name is part of the base type
|
|
384
|
+
it 'promotes each static of a compound statement whose type holds a qualifier macro' do
|
|
385
|
+
@result = ticker(
|
|
386
|
+
header: "int f1(void);\nint f2(void);\n",
|
|
387
|
+
source: "#define MYQ\nint f1(void) { static int MYQ cnt, other; return cnt + other; }\n" \
|
|
388
|
+
"int f2(void) { static int MYQ cnt, other; return cnt + other; }\n"
|
|
389
|
+
)
|
|
390
|
+
|
|
391
|
+
expect( @result.impl_h ).to include( 'extern int MYQ partial_f1_other;', 'extern int MYQ partial_f2_cnt;' )
|
|
392
|
+
expect_link( @result, ['partial_f1_cnt', 'partial_f1_other', 'partial_f2_cnt', 'partial_f2_other'] )
|
|
393
|
+
end
|
|
394
|
+
|
|
395
|
+
# A local struct's member that a promoted static shares a name with is renamed alike, where declared and used
|
|
396
|
+
it 'promotes a static that shares its name with a local struct member' do
|
|
397
|
+
@result = ticker(
|
|
398
|
+
header: "int ticker_get(void);\n",
|
|
399
|
+
source: "int ticker_get(void) { static int count; struct { int count; } s = {0}; s.count = ++count; return s.count; }\n"
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
expect( @result.impl_c ).to include( 'struct { int partial_ticker_get_count; } s = {0}; s.partial_ticker_get_count = ++partial_ticker_get_count;' )
|
|
403
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_count'] )
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
# A name a local struct's body uses is still the promoted static's
|
|
407
|
+
it 'promotes a static that a local struct body names' do
|
|
408
|
+
@result = ticker(
|
|
409
|
+
header: "int ticker_get(void);\n",
|
|
410
|
+
source: "int ticker_get(void) { static int hist[4]; struct { char c[sizeof(hist)]; /* { */ } s; return (int)sizeof(s.c) + hist[0]; }\n"
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
expect( @result.impl_c ).to include( 'char c[sizeof(partial_ticker_get_hist)];' )
|
|
414
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_hist'] )
|
|
415
|
+
end
|
|
416
|
+
|
|
417
|
+
it 'promotes statics that local struct bodies hold past attributes and function-pointer members' do
|
|
418
|
+
@result = ticker(
|
|
419
|
+
header: "void tick(void);\nint f1(void);\nint f2(void);\n",
|
|
420
|
+
source: "void tick(void) { }\n" \
|
|
421
|
+
"int f1(void) { static int hist[4]; struct __attribute__((packed)) { char c[sizeof(hist[0])]; int hist; } s = {{0}, 1}; return s.hist + hist[0]; }\n" \
|
|
422
|
+
"int f2(void) { static void (*handler)(void) = tick; struct { void (*handler)(void); } s = { handler }; s.handler(); return 0; }\n"
|
|
423
|
+
)
|
|
424
|
+
|
|
425
|
+
expect_link( @result, ['f1', 'f2', 'partial_f1_hist', 'partial_f2_handler'] )
|
|
426
|
+
end
|
|
427
|
+
|
|
428
|
+
it 'promotes statics that name one another across statements and in array sizes' do
|
|
429
|
+
@result = ticker(
|
|
430
|
+
header: "int ticker_get(void);\n",
|
|
431
|
+
source: "int ticker_get(void) { static int n = 4, m[sizeof(n)]; static int *q = &n; " \
|
|
432
|
+
"static const char *s = \"n and m\"; return m[0] + *q + s[0]; }\n"
|
|
433
|
+
)
|
|
434
|
+
|
|
435
|
+
expect( @result.impl_h ).to include( 'extern int partial_ticker_get_m[sizeof(partial_ticker_get_n)];' )
|
|
436
|
+
expect( @result.impl_c ).to include( 'int *partial_ticker_get_q = &partial_ticker_get_n;', '"n and m"' )
|
|
437
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_m', 'partial_ticker_get_q', 'partial_ticker_get_s'] )
|
|
438
|
+
end
|
|
439
|
+
end
|
|
440
|
+
|
|
441
|
+
# ---------------------------------------------------------------------------
|
|
442
|
+
context 'C23 attributes' do
|
|
443
|
+
# ---------------------------------------------------------------------------
|
|
444
|
+
|
|
445
|
+
# The oldest spelling of the standard that GCC and Clang accept with these attributes
|
|
446
|
+
def c23 = '-std=c2x'
|
|
447
|
+
|
|
448
|
+
before do
|
|
449
|
+
probe = Tempfile.new( ['c23', '.c'] ).tap { |file| file.write( "[[maybe_unused]] static int probe;\n" ) }.tap( &:close )
|
|
450
|
+
_out, _err, status = Open3.capture3( "#{partials_compiler} #{c23} -fsyntax-only #{probe.path}" )
|
|
451
|
+
skip "#{partials_compiler} does not accept C23 attributes" unless status.success?
|
|
452
|
+
end
|
|
453
|
+
|
|
454
|
+
it 'declares a variable an attribute leads without its storage class' do
|
|
455
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "[[maybe_unused]] static int count;\nint ticker_get(void) { return count; }\n" )
|
|
456
|
+
|
|
457
|
+
expect( @result.impl_h ).to include( 'extern int count;' )
|
|
458
|
+
expect_link( @result, ['count', 'ticker_get'], flags: c23 )
|
|
459
|
+
end
|
|
460
|
+
|
|
461
|
+
it 'declares each variable of a compound declaration an attribute leads' do
|
|
462
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "[[maybe_unused]] static int a, b;\nint ticker_get(void) { return a + b; }\n" )
|
|
463
|
+
|
|
464
|
+
expect( @result.impl_h ).to include( 'extern int a;', 'extern int b;' )
|
|
465
|
+
expect_link( @result, ['a', 'b', 'ticker_get'], flags: c23 )
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
it 'declares a variable whose name an attribute follows' do
|
|
469
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "static int buf [[maybe_unused]] [4];\nint ticker_get(void) { return buf[0]; }\n" )
|
|
470
|
+
|
|
471
|
+
expect( @result.impl_h ).to include( 'extern int buf[4];' )
|
|
472
|
+
expect_link( @result, ['buf', 'ticker_get'], flags: c23 )
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
it 'reads a function an attribute leads, and the functions after it' do
|
|
476
|
+
@result = ticker(
|
|
477
|
+
header: "int ticker_peek(void);\nint ticker_get(void);\n",
|
|
478
|
+
source: "[[nodiscard]] int ticker_peek(void) { return 1; }\nint ticker_get(void) { return ticker_peek(); }\n"
|
|
479
|
+
)
|
|
480
|
+
|
|
481
|
+
expect_link( @result, ['ticker_peek', 'ticker_get'], flags: c23 )
|
|
482
|
+
end
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
# ---------------------------------------------------------------------------
|
|
486
|
+
context 'a declaration that defines its type' do
|
|
487
|
+
# ---------------------------------------------------------------------------
|
|
488
|
+
|
|
489
|
+
# The type is written once, in the types header, and each variable names it. Two copies of
|
|
490
|
+
# one tagged body are a redefinition, and two anonymous bodies are two different types.
|
|
491
|
+
it 'declares a static of an anonymous struct by the name the Partial gives its type' do
|
|
492
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "static struct { int count; } s_ctx;\nint ticker_get(void) { return s_ctx.count; }\n" )
|
|
493
|
+
|
|
494
|
+
expect( @result.types_h ).to include( 'typedef struct { int count; } ceedling_partial_ticker_s_ctx_t;' )
|
|
495
|
+
expect( @result.impl_h ).to include( 'extern ceedling_partial_ticker_s_ctx_t s_ctx;' )
|
|
496
|
+
expect_types_header_compiles( @result )
|
|
497
|
+
expect_link( @result, ['s_ctx', 'ticker_get'], stubs: "void reset(void) { s_ctx.count = 0; }\n" )
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
# The test sees an anonymous enum's values, since the types header defines them
|
|
501
|
+
it 'declares a static of an anonymous enum whose values the test can name' do
|
|
502
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "static enum { IDLE, RUN } s_state;\nint ticker_get(void) { return s_state == RUN; }\n" )
|
|
503
|
+
|
|
504
|
+
expect_link( @result, ['s_state', 'ticker_get'], stubs: "void start(void) { s_state = RUN; }\n" )
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
it 'defines a tagged type once for a variable with an initializer' do
|
|
508
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "struct ops { int a; } g_ops = { 1 };\nint ticker_get(void) { return g_ops.a; }\n" )
|
|
509
|
+
|
|
510
|
+
expect( @result.impl_c ).to include( 'ceedling_partial_ticker_g_ops_t g_ops = { 1 };' )
|
|
511
|
+
expect_link( @result, ['g_ops', 'ticker_get'], stubs: "int copy(void) { struct ops o = g_ops; return o.a; }\n" )
|
|
512
|
+
end
|
|
513
|
+
|
|
514
|
+
# A member's array size belongs to the type, and every variable of the statement shares it
|
|
515
|
+
it 'shares one type among the variables of a compound declaration' do
|
|
516
|
+
@result = ticker(
|
|
517
|
+
header: "int ticker_get(void);\n",
|
|
518
|
+
source: "struct pair { int a[2]; } g_p1, g_p2;\nint ticker_get(void) { return g_p1.a[1] + g_p2.a[0]; }\n"
|
|
519
|
+
)
|
|
520
|
+
|
|
521
|
+
expect( @result.impl_h ).to include( 'extern ceedling_partial_ticker_g_p1_t g_p1;', 'extern ceedling_partial_ticker_g_p1_t g_p2;' )
|
|
522
|
+
expect_link( @result, ['g_p1', 'g_p2'], stubs: "_Static_assert( sizeof( g_p2.a ) == 2 * sizeof( int ), \"member size\" );\n" )
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
# An attribute after the body belongs to the type, so the layout stays the module's
|
|
526
|
+
it 'keeps an attribute after the body on the type' do
|
|
527
|
+
@result = ticker(
|
|
528
|
+
header: "int ticker_get(void);\n",
|
|
529
|
+
source: "static struct { char c; int i; } __attribute__((packed)) s_pk;\nint ticker_get(void) { return s_pk.i; }\n"
|
|
530
|
+
)
|
|
531
|
+
|
|
532
|
+
expect_link( @result, ['s_pk'], stubs: "_Static_assert( sizeof( s_pk ) == 5, \"packed\" );\n" )
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
it 'declares a const variable and a pointer of one type' do
|
|
536
|
+
@result = ticker(
|
|
537
|
+
header: "int ticker_get(void);\n",
|
|
538
|
+
source: "static const struct { int a; } k = { 3 }, *kp = &k;\nint ticker_get(void) { return kp->a; }\n"
|
|
539
|
+
)
|
|
540
|
+
|
|
541
|
+
expect( @result.impl_h ).to include( 'extern const ceedling_partial_ticker_k_t k;', 'extern const ceedling_partial_ticker_k_t * kp;' )
|
|
542
|
+
expect_link( @result, ['k', 'kp', 'ticker_get'] )
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
# A header's extern of an anonymous type matches its definition in another module, since a
|
|
546
|
+
# typedef leaves the type anonymous. The weak definition yields to it.
|
|
547
|
+
it 'links a header extern of an anonymous struct against its definition in another module' do
|
|
548
|
+
@result = ticker( header: "extern struct { int a; } g_x;\nint ticker_get(void);\n", source: "int ticker_get(void) { return g_x.a; }\n" )
|
|
549
|
+
board = File.join( @result.dir, 'board.c' )
|
|
550
|
+
File.write( board, "struct { int a; } g_x = { 5 };\n" )
|
|
551
|
+
|
|
552
|
+
expect( @result.impl_c ).to include( '__attribute__((weak)) ceedling_partial_ticker_g_x_t g_x;' )
|
|
553
|
+
expect_link( @result, ['g_x', 'ticker_get'], flags: board )
|
|
554
|
+
end
|
|
555
|
+
|
|
556
|
+
it 'writes a forward declaration to the types header as written' do
|
|
557
|
+
@result = ticker(
|
|
558
|
+
header: "struct node;\ntypedef struct node *node_ref_t;\nint ticker_get(void);\n",
|
|
559
|
+
source: "struct node { int value; };\nstatic node_ref_t head;\nint ticker_get(void) { return head ? head->value : 0; }\n"
|
|
560
|
+
)
|
|
561
|
+
|
|
562
|
+
expect( @result.types_h ).to include( "struct node;\n" )
|
|
563
|
+
expect( @result.impl_h ).not_to include( 'extern struct node;' )
|
|
564
|
+
expect_link( @result, ['head', 'ticker_get'] )
|
|
565
|
+
end
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
# ---------------------------------------------------------------------------
|
|
569
|
+
context 'a function-scope static that defines its type' do
|
|
570
|
+
# ---------------------------------------------------------------------------
|
|
571
|
+
|
|
572
|
+
# Promotion moves the static to module scope, so its type moves too, named for the function
|
|
573
|
+
# and the variable
|
|
574
|
+
it 'promotes a static of an anonymous struct with its type' do
|
|
575
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "int ticker_get(void) { static struct { int n; } st; return ++st.n; }\n" )
|
|
576
|
+
|
|
577
|
+
expect( @result.types_h ).to include( 'typedef struct { int n; } ceedling_partial_ticker_ticker_get_st_t;' )
|
|
578
|
+
expect( @result.impl_h ).to include( 'extern ceedling_partial_ticker_ticker_get_st_t partial_ticker_get_st;' )
|
|
579
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_st'], stubs: "void reset(void) { partial_ticker_get_st.n = 0; }\n" )
|
|
580
|
+
end
|
|
581
|
+
|
|
582
|
+
it 'promotes a static of an anonymous enum whose values the test can name' do
|
|
583
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "int ticker_get(void) { static enum { IDLE, RUN } mode; mode = RUN; return mode; }\n" )
|
|
584
|
+
|
|
585
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_mode'], stubs: "int idle(void) { return partial_ticker_get_mode == IDLE; }\n" )
|
|
586
|
+
end
|
|
587
|
+
|
|
588
|
+
# A tag local to a function may shadow a file-scope tag, so the promoted type takes the name
|
|
589
|
+
# the Partial gives it, and the function's later uses of the tag follow
|
|
590
|
+
it 'renames a local tag that shadows a file-scope one' do
|
|
591
|
+
@result = ticker(
|
|
592
|
+
header: "struct st { int a; };\nint ticker_get(void);\n",
|
|
593
|
+
source: "int ticker_get(void) { static struct st { int n; } s; struct st *p = &s; return p->n; }\n"
|
|
594
|
+
)
|
|
595
|
+
|
|
596
|
+
expect( @result.types_h ).to include( 'struct st { int a; };', 'typedef struct ceedling_partial_ticker_ticker_get_s_t { int n; } ceedling_partial_ticker_ticker_get_s_t;' )
|
|
597
|
+
expect( @result.impl_c ).to include( 'struct ceedling_partial_ticker_ticker_get_s_t *p = &partial_ticker_get_s;' )
|
|
598
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_s'] )
|
|
599
|
+
end
|
|
600
|
+
|
|
601
|
+
it 'renames the same local tag in two functions apart' do
|
|
602
|
+
@result = ticker(
|
|
603
|
+
header: "int f1(void);\nint f2(void);\n",
|
|
604
|
+
source: "int f1(void) { static struct state { int a; } s; return s.a; }\nint f2(void) { static struct state { char c; } s; return s.c; }\n"
|
|
605
|
+
)
|
|
606
|
+
|
|
607
|
+
expect_link( @result, ['f1', 'f2', 'partial_f1_s', 'partial_f2_s'] )
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
# A member sharing a promoted static's name is renamed alike in the type and in its uses
|
|
611
|
+
it 'promotes a static whose type has a member sharing another static name' do
|
|
612
|
+
@result = ticker(
|
|
613
|
+
header: "int ticker_get(void);\n",
|
|
614
|
+
source: "int ticker_get(void) {\n static int count;\n static struct st { int count; } s;\n s.count++;\n return count + s.count;\n}\n"
|
|
615
|
+
)
|
|
616
|
+
|
|
617
|
+
expect_link( @result, ['ticker_get', 'partial_ticker_get_count', 'partial_ticker_get_s'] )
|
|
618
|
+
end
|
|
619
|
+
|
|
620
|
+
# Each no-op stands on the line its statement did, and a statement over several lines keeps
|
|
621
|
+
# them. A CRLF source is the one a Windows checkout gives.
|
|
622
|
+
{ 'LF' => "\n", 'CRLF' => "\r\n" }.each do |ending, newline|
|
|
623
|
+
it "keeps the function to its line count with #{ending} endings" do
|
|
624
|
+
source = "int ticker_get(void) {\n static struct {\n int n;\n } st;\n return st.n;\n}\n".gsub( "\n", newline )
|
|
625
|
+
@result = ticker( header: "int ticker_get(void);\n", source: source )
|
|
626
|
+
|
|
627
|
+
body = @result.impl_c[/int ticker_get\(void\) \{.*?\n\}/m]
|
|
628
|
+
expect( body.count( "\n" ) ).to eq( source.count( "\n" ) - 1 ), "the function as generated: #{body.inspect}"
|
|
629
|
+
end
|
|
630
|
+
end
|
|
631
|
+
end
|
|
632
|
+
|
|
633
|
+
# ---------------------------------------------------------------------------
|
|
634
|
+
context "ceedling.h's names for a Partial's types" do
|
|
635
|
+
# ---------------------------------------------------------------------------
|
|
636
|
+
|
|
637
|
+
# The macros need ceedling.h and the prefix a test build defines with Partials enabled
|
|
638
|
+
let(:ceedling_h) { "-I#{File.expand_path( '../../lib/ceedling', __dir__ )} -DCEEDLING_PARTIALS_PREFIX=ceedling_partial_" }
|
|
639
|
+
|
|
640
|
+
it 'names the type of a variable declared together with its type' do
|
|
641
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "static struct { int count; } s_ctx;\nint ticker_get(void) { return s_ctx.count; }\n" )
|
|
642
|
+
|
|
643
|
+
expect_link( @result, ['s_ctx'], flags: ceedling_h,
|
|
644
|
+
stubs: "#include \"ceedling.h\"\nint saved(void) { PARTIAL_TYPE(ticker, s_ctx) copy = s_ctx; return copy.count; }\n" )
|
|
645
|
+
end
|
|
646
|
+
|
|
647
|
+
it 'names the type of a promoted static declared together with its type' do
|
|
648
|
+
@result = ticker( header: "int ticker_get(void);\n", source: "int ticker_get(void) { static struct st { int n; } st; return st.n; }\n" )
|
|
649
|
+
|
|
650
|
+
expect_link( @result, ['partial_ticker_get_st'], flags: ceedling_h,
|
|
651
|
+
stubs: "#include \"ceedling.h\"\nint saved(void) { PARTIAL_LOCAL_TYPE(ticker, ticker_get, st) copy = PARTIAL_LOCAL_VAR(ticker_get, st); return copy.n; }\n" )
|
|
652
|
+
end
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
end
|