Skip to content
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

add define to force freestanding build #4

Merged
merged 2 commits into from
Aug 9, 2022
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
13 changes: 10 additions & 3 deletions include/smarter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,19 @@

#include <frg/manual_box.hpp>

#if __STDC_HOSTED__
// Allow the user to override __STDC_HOSTED__. This is useful when building mlibc.
#if __STDC_HOSTED__ && !defined(LIBSMARTER_FORCE_FREESTANDING)
#define LIBSMARTER_HOSTED 1
#else
#define LIBSMARTER_HOSTED 0
#endif

#if LIBSMARTER_HOSTED
#include <cassert>
#include <iostream>
#else
#ifndef assert
#define assert(c) do { } while(0)
#define assert(c) do { (void)(c); } while(0)
#endif
#endif

Expand Down Expand Up @@ -275,7 +282,7 @@ struct shared_ptr : ptr_access_crtp<T, shared_ptr<T, H>> {
return _object;
}

#if __STDC_HOSTED__
#if LIBSMARTER_HOSTED
std::pair<T *, counter *> release() {
return std::make_pair(std::exchange(_object, nullptr),
std::exchange(_ctr, nullptr));
Expand Down
5 changes: 0 additions & 5 deletions library.makefile

This file was deleted.