// ok no namespace fl
#pragma once

// IWYU pragma: private
// IWYU pragma: no_include "new"
#include "teensy/is_teensy.h"  // IWYU pragma: keep

// ARM placement new operator - in global namespace
// Most ARM platforms have <new> header available

// Teensy 3.x/LC compatibility: Include new.h early to declare __cxa_guard_* functions
// before any function-local statics are seen by the compiler
#if defined(FL_IS_TEENSY_3X) || defined(FL_IS_TEENSY_LC)
    #include <new.h>  // ok include // IWYU pragma: export // IWYU pragma: keep
#endif

#include "fl/stl/has_include.h"  // IWYU pragma: keep

#if FL_HAS_INCLUDE(<new>)
    // Modern ARM platforms with standard library support (includes STM32F1 with modern toolchains)
    #include <new>  // ok include // IWYU pragma: export // IWYU pragma: keep
#elif FL_HAS_INCLUDE(<new.h>)
    // Alternative standard header location
    #include <new.h> // ok include // IWYU pragma: export // IWYU pragma: keep
#else
    // Fallback to manual definition for platforms without <new> header
    #include "fl/stl/stdint.h"
    #include "fl/stl/int.h"
#include "fl/stl/noexcept.h"
    inline void *operator new(fl::size, void *ptr) FL_NOEXCEPT { return ptr; }
#endif
