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

ggml : do not use _GNU_SOURCE gratuitously #1992

Closed
wants to merge 1 commit into from
Closed
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
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ CFLAGS = -I. $(OPT) -std=c11 -fPIC
CXXFLAGS = -I. -I./examples $(OPT) -std=c++11 -fPIC
LDFLAGS =

# 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)
# ref: https://github.com/ggerganov/whisper.cpp/pull/1027
CFLAGS += -D_XOPEN_SOURCE=600
CXXFLAGS += -D_XOPEN_SOURCE=600

ifdef LLAMA_DEBUG
CFLAGS += -O0 -g
CXXFLAGS += -O0 -g
Expand Down
4 changes: 1 addition & 3 deletions 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 Expand Up @@ -13387,8 +13386,7 @@ static void ggml_compute_forward_conv_2d_sk_p0_f16_f32(
const int nk1 = ne01;

// size of the convolution row - the kernel size unrolled across all channels
// round-up so it is more suitable for SIMD
const int ew0 = ggml_up32(nk0*nk1*ne02);
const int ew0 = nk0*nk1*ne02;

GGML_ASSERT(nb00 == sizeof(ggml_fp16_t));
GGML_ASSERT(nb10 == sizeof(float));
Expand Down
1 change: 1 addition & 0 deletions llama-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ __attribute__((format(gnu_printf, 1, 2)))
__attribute__((format(printf, 1, 2)))
#endif
#endif

static std::string format(const char * fmt, ...) {
va_list ap, ap2;
va_start(ap, fmt);
Expand Down
8 changes: 0 additions & 8 deletions 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