Skip to content

Do not use _GNU_SOURCE gratuitously. #1027

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

Merged
merged 2 commits into from
Jun 25, 2023
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
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@ CFLAGS = -I. -O3 -DNDEBUG -std=c11 -fPIC
CXXFLAGS = -I. -I./examples -O3 -DNDEBUG -std=c++11 -fPIC
LDFLAGS =

# ref: https://github.com/ggerganov/whisper.cpp/issues/37
ifneq ($(wildcard /usr/include/musl/*),)
CFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
CXXFLAGS += -D_POSIX_SOURCE -D_GNU_SOURCE
endif
# clock_gettime came in POSIX.1b (1993)
# CLOCK_MONOTONIC came in POSIX.1-2001 / SUSv3 as optional
# posix_memalign came in POSIX.1-2001 / SUSv3
# M_PI is an XSI extension since POSIX.1-2001 / SUSv3, came in XPG1 (1985)
CFLAGS += -D_XOPEN_SOURCE=600
CXXFLAGS += -D_XOPEN_SOURCE=600

# OS specific
# TODO: support Windows
Expand Down
2 changes: 1 addition & 1 deletion examples/command/command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
// ref: https://github.com/ggerganov/whisper.cpp/issues/171
//

#include "common.h"
#include "common-sdl.h"
#include "common.h"
#include "whisper.h"

#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion examples/stream/stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// A very quick-n-dirty implementation serving mainly as a proof of concept.
//

#include "common.h"
#include "common-sdl.h"
#include "common.h"
#include "whisper.h"

#include <cassert>
Expand Down
8 changes: 0 additions & 8 deletions examples/talk-llama/llama.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
// Defines fileno on msys:
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#include <cstddef>
#include <cstdint>
#include <cstdio>
#endif

#include "llama-util.h"
#include "llama.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/talk-llama/talk-llama.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Talk with AI
//

#include "common.h"
#include "common-sdl.h"
#include "common.h"
#include "whisper.h"
#include "llama.h"

Expand Down
2 changes: 1 addition & 1 deletion examples/talk/talk.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Talk with AI
//

#include "common.h"
#include "common-sdl.h"
#include "common.h"
#include "whisper.h"
#include "gpt-2.h"

Expand Down
1 change: 0 additions & 1 deletion ggml.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define _GNU_SOURCE // Defines CLOCK_MONOTONIC on Linux
#define _CRT_SECURE_NO_DEPRECATE // Disables ridiculous "unsafe" warnigns on Windows

#include "ggml.h"
Expand Down