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

🚨 Make things work with GCC 8.3 #155

Merged
merged 3 commits into from
Aug 18, 2019
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
2 changes: 1 addition & 1 deletion src/system/cpp_support.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern "C" void task_fn_wrapper(task_fn_t fn, void* args) {
#endif
fn(args);
#ifdef __cpp_exceptions
} catch (std::runtime_error re) {
} catch (std::runtime_error& re) {
vexDisplayString(7, "caught runtime error: %s", re.what());
} catch (...) {
vexDisplayString(7, "caught an unknown error");
Expand Down
24 changes: 24 additions & 0 deletions src/system/mlock.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/**
* \file system/mlock.c
*
* memory lock newlib stubs
*
* Contains implementations of memory-locking functions for newlib.
*
* Copyright (c) 2017-2019, Purdue University ACM SIGBots.
* All rights reserved.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

#include "rtos/task.h"

void __malloc_lock(void) {
rtos_suspend_all();
}

void __malloc_unlock(void) {
rtos_resume_all();
}
14 changes: 6 additions & 8 deletions src/system/newlib_stubs.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,16 @@ void _exit(int status) {
}
}

void __malloc_lock(void) {
rtos_suspend_all();
}

void __malloc_unlock(void) {
rtos_resume_all();
}

void __env_lock(void) {
rtos_suspend_all();
}

void __env_unlock(void) {
rtos_resume_all();
}

// HACK: this helps confused libc++ functions call the right instruction. for
// info see https://github.com/purduesigbots/pros/issues/153#issuecomment-519335375
void __sync_synchronize(void) {
__sync_synchronize();
}