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

Remove warnings with gcc 7+ #201

Open
wants to merge 5 commits into
base: master
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ the installation:
sudo apt-get install cmake libglew-dev xorg-dev libcurl4-openssl-dev
sudo apt-get build-dep glfw

#### Linux (Fedora)

sudo dnf install cmake glew-devel xorg-x11-proto-devel libcurl-devel openssl-devel
sudo dnf builddep glfw

#### Windows

Download and install [CMake](http://www.cmake.org/cmake/resources/software.html)
Expand Down
18 changes: 16 additions & 2 deletions deps/glfw/src/linux_joystick.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
//
//========================================================================

#define _GNU_SOURCE
#ifdef __GNUC__
#define _POSIX_C_SOURCE 200809L
#endif

#include "internal.h"

#if defined(__linux__)
Expand Down Expand Up @@ -230,14 +235,23 @@ int _glfwInitJoysticks(void)

while ((entry = readdir(dir)))
{
char path[20];
char* path = NULL;
regmatch_t match;

if (regexec(&_glfw.linux_js.regex, entry->d_name, 1, &match, 0) != 0)
continue;

snprintf(path, sizeof(path), "%s/%s", dirname, entry->d_name);
if (asprintf(&path, "%s/%s", dirname, entry->d_name) < 0)
{
_glfwInputError(GLFW_PLATFORM_ERROR,
"Linux: Failed to construct device path: %s",
strerror(errno));
continue;

}

openJoystickDevice(path);
free(path);
}

closedir(dir);
Expand Down
4 changes: 4 additions & 0 deletions deps/glfw/src/monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
//
//========================================================================

#ifdef __GNUC__
#define _POSIX_C_SOURCE 200809L
#endif

#include "internal.h"

#include <math.h>
Expand Down
4 changes: 4 additions & 0 deletions deps/glfw/src/x11_window.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
//
//========================================================================

#ifdef __GNUC__
#define _POSIX_C_SOURCE 200809L
#endif

#include "internal.h"

#include <X11/cursorfont.h>
Expand Down
3 changes: 3 additions & 0 deletions deps/glfw/tests/glfwinfo.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#ifdef __GNUC__
#include <strings.h>
#endif

#include "getopt.h"

Expand Down
4 changes: 4 additions & 0 deletions deps/glfw/tests/joysticks.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@
//
//========================================================================

#ifdef __GNUC__
#define _POSIX_C_SOURCE 200809L
#endif

#include <GLFW/glfw3.h>

#include <stdio.h>
Expand Down