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

Use static declaration for undeclared variable #163

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# later 1.3.1.9000

* Set file-level variables as `static` to avoid triggering `-Wmissing-variable-declarations` (@MichaelChirico, #163)

* Fixed `unused varfiable` compiler warning. (@MichaelChirico, #176)

# later 1.3.1
Expand Down
6 changes: 3 additions & 3 deletions src/callback_registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include "callback_registry.h"
#include "debug.h"

std::atomic<uint64_t> nextCallbackId(1);
static std::atomic<uint64_t> nextCallbackId(1);

// ============================================================================
// Invoke functions
Expand All @@ -21,8 +21,8 @@ enum InvokeResult {
};

// This is set by invoke_c(). I
InvokeResult last_invoke_result;
std::string last_invoke_message;
static InvokeResult last_invoke_result;
static std::string last_invoke_message;

// A wrapper for calling R_CheckUserInterrupt via R_ToplevelExec.
void checkInterruptFn(void*) {
Expand Down
12 changes: 6 additions & 6 deletions src/later_posix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ extern void* R_GlobalContext;
extern void* R_TopLevelContext;

// Whether we have initialized the input handler.
int initialized = 0;
static int initialized = 0;

// The handles to the read and write ends of a pipe. We use this pipe
// to signal R's input handler callback mechanism that we want to be
// called back.
int pipe_in = -1;
int pipe_out = -1;
static int pipe_in = -1;
static int pipe_out = -1;

int dummy_pipe_in = -1;
int dummy_pipe_out = -1;
static int dummy_pipe_in = -1;
static int dummy_pipe_out = -1;

// Whether the file descriptor is ready for reading, i.e., whether
// the input handler callback is scheduled to be called. We use this
// to avoid unnecessarily writing to the pipe.
bool hot = false;
static bool hot = false;
// This mutex protects reading/writing of `hot` and of reading from/writing to
// the pipe.
Mutex m(tct_mtx_plain);
Expand Down
Loading