🔨 Prevent build attribute define conflicts

This commit is contained in:
Scott Lahteine 2022-05-05 18:55:43 -05:00
parent 6112277f9b
commit ceb99e89a0
7 changed files with 26 additions and 26 deletions

View File

@ -70,11 +70,11 @@
#define FORCE_INLINE __attribute__((always_inline)) inline
#define NO_INLINE __attribute__((noinline))
#define _UNUSED __attribute__((unused))
#define _O0 __attribute__((optimize("O0")))
#define _Os __attribute__((optimize("Os")))
#define _O1 __attribute__((optimize("O1")))
#define _O2 __attribute__((optimize("O2")))
#define _O3 __attribute__((optimize("O3")))
#define __O0 __attribute__((optimize("O0")))
#define __Os __attribute__((optimize("Os")))
#define __O1 __attribute__((optimize("O1")))
#define __O2 __attribute__((optimize("O2")))
#define __O3 __attribute__((optimize("O3")))
#define IS_CONSTEXPR(...) __builtin_constant_p(__VA_ARGS__) // Only valid solution with C++14. Should use std::is_constant_evaluated() in C++20 instead

View File

@ -70,13 +70,13 @@ private:
static void move_z_with_encoder(const_float_t multiplier);
static float measure_point_with_encoder();
static float measure_business_card_thickness();
static void manually_probe_remaining_mesh(const xy_pos_t&, const_float_t , const_float_t , const bool) _O0;
static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) _O0;
static void manually_probe_remaining_mesh(const xy_pos_t&, const_float_t , const_float_t , const bool) __O0;
static void fine_tune_mesh(const xy_pos_t &pos, const bool do_ubl_mesh_map) __O0;
#endif
static bool G29_parse_parameters() _O0;
static bool G29_parse_parameters() __O0;
static void shift_mesh_height();
static void probe_entire_mesh(const xy_pos_t &near, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) _O0;
static void probe_entire_mesh(const xy_pos_t &near, const bool do_ubl_mesh_map, const bool stow_probe, const bool do_furthest) __O0;
static void tilt_mesh_based_on_3pts(const_float_t z1, const_float_t z2, const_float_t z3);
static void tilt_mesh_based_on_probed_grid(const bool do_ubl_mesh_map);
static bool smart_fill_one(const uint8_t x, const uint8_t y, const int8_t xdir, const int8_t ydir);
@ -98,17 +98,17 @@ public:
static void report_state();
static void save_ubl_active_state_and_disable();
static void restore_ubl_active_state_and_leave();
static void display_map(const uint8_t) _O0;
static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const xy_pos_t&, const bool=false, MeshFlags *done_flags=nullptr) _O0;
static mesh_index_pair find_furthest_invalid_mesh_point() _O0;
static void display_map(const uint8_t) __O0;
static mesh_index_pair find_closest_mesh_point_of_type(const MeshPointType, const xy_pos_t&, const bool=false, MeshFlags *done_flags=nullptr) __O0;
static mesh_index_pair find_furthest_invalid_mesh_point() __O0;
static void reset();
static void invalidate();
static void set_all_mesh_points_to_value(const_float_t value);
static void adjust_mesh_to_mean(const bool cflag, const_float_t value);
static bool sanity_check();
static void G29() _O0; // O0 for no optimization
static void smart_fill_wlsf(const_float_t ) _O2; // O2 gives smaller code than Os on A2560
static void G29() __O0; // O0 for no optimization
static void smart_fill_wlsf(const_float_t ) __O2; // O2 gives smaller code than Os on A2560
static int8_t storage_slot;

View File

@ -340,7 +340,7 @@
* Returns true if did NOT move, false if moved (requires current_position update).
*/
bool _O2 unified_bed_leveling::line_to_destination_segmented(const_feedRate_t scaled_fr_mm_s) {
bool __O2 unified_bed_leveling::line_to_destination_segmented(const_feedRate_t scaled_fr_mm_s) {
if (!position_is_reachable(destination)) // fail if moving outside reachable boundary
return true; // did not move, so current_position still accurate

View File

@ -30,7 +30,7 @@
*/
#define FORCE_INLINE __attribute__((always_inline)) inline
#define _O3 __attribute__((optimize("O3")))
#define __O3 __attribute__((optimize("O3")))
template <uint8_t uid, uint8_t size>
struct BresenhamCfg { static constexpr uint8_t UID = uid, SIZE = size; };
@ -114,9 +114,9 @@ public:
if (tick1(index)) { value[index] += dir[index]; back(index); }
}
FORCE_INLINE static void tick1() _O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick1(i); }
FORCE_INLINE static void tick1() __O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick1(i); }
FORCE_INLINE static void tick() _O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick(i); }
FORCE_INLINE static void tick() __O3 { for (uint8_t i = 0; i < Cfg::SIZE; i++) (void)tick(i); }
static void report(const uint8_t index) {
if (index < Cfg::SIZE) {

View File

@ -41,7 +41,7 @@ class Nozzle {
* @param end xyz_pos_t defining the ending point
* @param strokes number of strokes to execute
*/
static void stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) _Os;
static void stroke(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes) __Os;
/**
* @brief Zig-zag clean pattern
@ -52,7 +52,7 @@ class Nozzle {
* @param strokes number of strokes to execute
* @param objects number of objects to create
*/
static void zigzag(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes, const uint8_t &objects) _Os;
static void zigzag(const xyz_pos_t &start, const xyz_pos_t &end, const uint8_t &strokes, const uint8_t &objects) __Os;
/**
* @brief Circular clean pattern
@ -62,7 +62,7 @@ class Nozzle {
* @param strokes number of strokes to execute
* @param radius radius of circle
*/
static void circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const_float_t radius) _Os;
static void circle(const xyz_pos_t &start, const xyz_pos_t &middle, const uint8_t &strokes, const_float_t radius) __Os;
#endif // NOZZLE_CLEAN_FEATURE
@ -77,14 +77,14 @@ class Nozzle {
* @param pattern one of the available patterns
* @param argument depends on the cleaning pattern
*/
static void clean(const uint8_t &pattern, const uint8_t &strokes, const_float_t radius, const uint8_t &objects, const uint8_t cleans) _Os;
static void clean(const uint8_t &pattern, const uint8_t &strokes, const_float_t radius, const uint8_t &objects, const uint8_t cleans) __Os;
#endif // NOZZLE_CLEAN_FEATURE
#if ENABLED(NOZZLE_PARK_FEATURE)
static float park_mode_0_height(const_float_t park_z) _Os;
static void park(const uint8_t z_action, const xyz_pos_t &park=NOZZLE_PARK_POINT) _Os;
static float park_mode_0_height(const_float_t park_z) __Os;
static void park(const uint8_t z_action, const xyz_pos_t &park=NOZZLE_PARK_POINT) __Os;
#endif
};

View File

@ -494,7 +494,7 @@ static void print_es_state(const bool is_hit, FSTR_P const flabel=nullptr) {
#pragma GCC diagnostic pop
void _O2 Endstops::report_states() {
void __O2 Endstops::report_states() {
TERN_(BLTOUCH, bltouch._set_SW_mode());
SERIAL_ECHOLNPGM(STR_M119_REPORT);
#define ES_REPORT(S) print_es_state(READ(S##_PIN) != S##_ENDSTOP_INVERTING, F(STR_##S))

View File

@ -677,7 +677,7 @@ class Temperature {
/**
* Call periodically to manage heaters
*/
static void manage_heater() _O2; // Added _O2 to work around a compiler error
static void manage_heater() __O2; // __O2 added to work around a compiler error
/**
* Preheating hotends