-
Notifications
You must be signed in to change notification settings - Fork 1
Replace Header Guards With #pragma once #371
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR aims to modernize the codebase by replacing traditional header guards (#ifndef/#define/#endif) with #pragma once directives across all header files in the repository.
Changes:
- Replace header guards with
#pragma oncein all header files acrosslaunch_core_classic,f_core, sample applications, payload applications, ground applications, and backplane modules - Remove closing
#endifdirectives that were part of the old header guard system - Standardize header protection mechanism across the entire codebase
Reviewed changes
Copilot reviewed 104 out of 104 changed files in this pull request and generated 25 comments.
Show a summary per file
| File | Description |
|---|---|
| include/launch_core_classic/utils/event_monitor.h | Replaced header guard with #pragma once |
| include/launch_core_classic/types.h | Replaced header guard with #pragma once, inadvertently removed FLOAT_ERROR_VALUE macro |
| include/launch_core_classic/os/time.h | Incomplete: removed closing #endif but missing #pragma once addition |
| include/launch_core_classic/os/fs.h | Replaced header guard, inadvertently removed ENOTINIT and L_FS_CREATE_FILE macros |
| include/launch_core_classic/net/udp.h | Incomplete: removed closing #endif but missing #pragma once addition |
| include/launch_core_classic/net/tftp.h | Replaced header guard with #pragma once |
| include/launch_core_classic/net/sntp.h | Replaced header guard, inadvertently removed SNTP_CLIENT_STACK_SIZE macro |
| include/launch_core_classic/net/net_common.h | Incomplete: removed closing #endif but missing #pragma once addition |
| include/launch_core_classic/net/lora.h | Incomplete: removed closing #endif but missing #pragma once addition |
| include/launch_core_classic/extension_boards.h | Incomplete: only removed #define, left orphaned #ifndef |
| include/launch_core_classic/dev/uart.h | Replaced header guard with #pragma once |
| include/launch_core_classic/dev/sensor.h | Incomplete: removed closing #endif but missing #pragma once addition |
| include/launch_core_classic/dev/gnss.h | Incomplete: only removed #define, left orphaned #ifndef |
| include/launch_core_classic/dev/dev_common.h | Incomplete: removed closing #endif but missing #pragma once addition |
| include/launch_core_classic/dev/adc.h | Incomplete: removed closing #endif but missing #pragma once addition |
| include/launch_core_classic/conversions.h | Incomplete: only removed #define, left orphaned #ifndef and closing #endif |
| include/launch_core_classic/backplane_defs.h | Incomplete: only removed #define, left orphaned #ifndef |
| include/f_core/utils/n_time_utils.h | Replaced header guard but has orphaned #endif on line 32 |
| include/f_core/utils/n_gnss_utils.h | Replaced header guard with #pragma once |
| include/f_core/utils/debouncer.hpp | Replaced header guard with #pragma once |
| include/f_core/utils/circular_buffer.hpp | Replaced header guard with #pragma once |
| include/f_core/utils/c_soft_timer.h | Replaced header guard with #pragma once |
| include/f_core/utils/c_observer.h | Replaced header guard with #pragma once |
| include/f_core/utils/c_hashmap.h | Replaced header guard with #pragma once |
| include/f_core/state_machine/c_pad_flight_landing_state_machine.h | Replaced header guard with #pragma once |
| include/f_core/radio/protocols/horus/horus.h | Has orphaned #endif directives from incomplete header guard removal |
| include/f_core/radio/frame_handlers/c_lora_freq_request_tenant.h | Replaced header guard with #pragma once |
| include/f_core/radio/frame_handlers/c_lora_frame_to_udp_handler.h | Replaced header guard with #pragma once |
| include/f_core/radio/frame_handlers/c_frequency_change_handler.h | Replaced header guard with #pragma once |
| include/f_core/radio/c_lora_router.h | Replaced header guard with #pragma once |
| include/f_core/radio/c_lora_link.h | Replaced header guard with #pragma once |
| include/f_core/radio/c_lora_frame_handler.h | Replaced header guard with #pragma once |
| include/f_core/radio/c_lora.h | Replaced header guard with #pragma once |
| include/f_core/radio/application/c_lora_tenant.h | Replaced header guard with #pragma once |
| include/f_core/os/tenants/c_datalogger_tenant.h | Replaced header guard with #pragma once |
| include/f_core/os/n_rtos.h | Replaced header guard with #pragma once |
| include/f_core/os/flight_log.hpp | Replaced header guard with #pragma once |
| include/f_core/os/c_tenant.h | Replaced header guard with #pragma once |
| include/f_core/os/c_task.h | Replaced header guard with #pragma once |
| include/f_core/os/c_runnable_tenant.h | Replaced header guard with #pragma once |
| include/f_core/os/c_latest_mailbox.h | Replaced header guard with #pragma once |
| include/f_core/os/c_file.h | Replaced header guard with #pragma once |
| include/f_core/os/c_datalogger.h | Replaced header guard with #pragma once |
| include/f_core/os/c_callback_tenant.h | Replaced header guard with #pragma once |
| include/f_core/net/transport/c_udp_socket.h | Replaced header guard with #pragma once |
| include/f_core/net/network/c_ipv4.h | Replaced header guard with #pragma once |
| include/f_core/net/device/c_rs485.h | Replaced header guard with #pragma once |
| include/f_core/net/c_transciever.h | Replaced header guard with #pragma once |
| include/f_core/net/application/c_udp_receiver_tenant.h | Replaced header guard with #pragma once |
| include/f_core/net/application/c_udp_broadcast_tenant.h | Replaced header guard with #pragma once |
| include/f_core/net/application/c_udp_alert_tenant.h | Replaced header guard with #pragma once |
| include/f_core/net/application/c_tftp_server_tenant.h | Replaced header guard with #pragma once |
| include/f_core/net/application/c_sntp_server_tenant.h | Replaced header guard with #pragma once |
| include/f_core/n_alerts.h | Replaced header guard with #pragma once |
| include/f_core/messaging/c_msgq_message_port.h | Replaced header guard with #pragma once |
| include/f_core/messaging/c_message_port.h | Replaced header guard with #pragma once |
| include/f_core/messaging/c_latest_message_port.h | Replaced header guard with #pragma once |
| include/f_core/flight/c_phase_controller.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/n_sensor_calibrators.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/c_temperature_sensor.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/c_shunt.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/c_sensor_device.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/c_magnetometer.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/c_gyroscope.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/c_barometer.h | Replaced header guard with #pragma once |
| include/f_core/device/sensor/c_accelerometer.h | Replaced header guard with #pragma once |
| include/f_core/device/c_rtc.h | Replaced header guard with #pragma once |
| include/f_core/device/c_gpio.h | Replaced header guard with #pragma once |
| include/f_core/c_project_configuration.h | Replaced header guard with #pragma once |
| app/samples/tftp_server/include/message.h | Replaced header guard with #pragma once |
| app/samples/tenants_and_tasks/include/c_print_count.h | Incomplete: added #pragma once but did not remove header guard closing #endif |
| app/samples/tenants_and_tasks/include/c_hello_tenant.h | Replaced header guard with #pragma once |
| app/samples/phase_detection/src/flight.h | Replaced header guard with #pragma once |
| app/samples/message_passing/include/message.h | Replaced header guard with #pragma once |
| app/samples/message_passing/include/c_receiver.h | Replaced header guard with #pragma once |
| app/samples/message_passing/include/c_publisher.h | Incomplete: added #pragma once but did not remove header guard closing #endif |
| app/payload/control_freak/flight-software/src/pump.h | Inadvertently removed multiple functional macros |
| app/payload/control_freak/flight-software/src/gps.h | Replaced header guard with #pragma once |
| app/payload/control_freak/flight-software/src/flight.h | Replaced header guard with #pragma once |
| app/payload/control_freak/flight-software/src/data.h | Replaced header guard, inadvertently removed IMU_SAMPLES_PER_PACKET macro |
| app/payload/control_freak/flight-software/src/common.h | Replaced header guard with #pragma once |
| app/payload/control_freak/flight-software/src/buzzer.h | Replaced header guard with #pragma once |
| app/payload/control_freak/flight-software/src/boost.h | Replaced header guard with #pragma once |
| app/payload/.retired/app_grim_reefer/src/data_storage.h | Replaced header guard with #pragma once |
| app/payload/.retired/app_grim_reefer/src/data_reading.h | Replaced header guard with #pragma once |
| app/payload/.retired/app_grim_reefer/src/config.h | Replaced header guard, inadvertently removed BUZZER_USE_LED and SHORT_FLIGHT macros |
| app/payload/.retired/app_grim_reefer/src/buzzer.h | Replaced header guard with #pragma once |
| app/payload/.retired/app_grim_reefer/src/boost_detect.h | Replaced header guard with #pragma once |
| app/other/.retired/app_potato/include/potato.h | Replaced header guard with #pragma once |
| app/ground/receiver_module/include/c_udp_listener_tenant.h | Replaced header guard with #pragma once |
| app/ground/receiver_module/include/c_receiver_module.h | Replaced header guard with #pragma once |
| app/backplane/sensor_module/include/c_sensor_module.h | Replaced header guard with #pragma once |
| app/backplane/sensor_module/include/c_sensing_tenant.h | Replaced header guard with #pragma once, has trailing whitespace |
| app/backplane/sensor_module/include/c_detection_handler.h | Added #pragma once (file previously had no header guard) |
| app/backplane/radio_module/include/c_udp_listener_tenant.h | Replaced header guard with #pragma once |
| app/backplane/radio_module/include/c_state_machine_updater.h | Replaced header guard with #pragma once |
| app/backplane/radio_module/include/c_remote_gpio_handler.h | Replaced header guard with #pragma once |
| app/backplane/radio_module/include/c_radio_module.h | Replaced header guard with #pragma once |
| app/backplane/radio_module/include/c_gnss_tenant.h | Replaced header guard with #pragma once |
| app/backplane/radio_module/include/c_downlink_scheduler_tenant.h | Replaced header guard with #pragma once |
| app/backplane/power_module/include/c_sensing_tenant.h | Replaced header guard with #pragma once |
| app/backplane/power_module/include/c_power_module.h | Replaced header guard with #pragma once |
| app/backplane/deployment_module/include/c_pyro_control_observer.h | Replaced header guard with #pragma once |
| app/backplane/deployment_module/include/c_deployment_module.h | Replaced header guard with #pragma once |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Description
Replace header guards with the more modern pragma once which we already use in our other codebases.
Type of change
How Has This Been Tested?
Local compiles and CI
Checklist: