Skip to content

Commit 35067a6

Browse files
committed
Also build launcher with -std=c11
Fixes #8642
1 parent e015ebe commit 35067a6

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

kitty/launcher/cmdline.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* Distributed under terms of the GPL3 license.
66
*/
77

8+
#define _POSIX_C_SOURCE 200809L
89
#include "shlex.h"
910
#include "utils.h"
1011
#include "launcher.h"

kitty/launcher/utils.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <errno.h>
1818
#include <sys/stat.h>
1919
#include <fcntl.h>
20+
#include <limits.h>
2021

2122

2223
static const char* home = NULL;

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def check_version_info() -> None:
6767
is_dragonflybsd = 'dragonfly' in _plat
6868
is_bsd = is_freebsd or is_netbsd or is_dragonflybsd or is_openbsd
6969
is_arm = platform.processor() == 'arm' or platform.machine() in ('arm64', 'aarch64')
70+
c_std = '' if is_openbsd else '-std=c11'
7071
Env = glfw.Env
7172
env = Env()
7273
PKGCONFIG = os.environ.get('PKGCONFIG_EXE', 'pkg-config')
@@ -498,7 +499,6 @@ def init_env(
498499
cppflags.append('-DDEBUG_{}'.format(el.upper().replace('-', '_')))
499500
has_copy_file_range = test_compile(cc, src='#define _GNU_SOURCE 1\n#include <unistd.h>\nint main() { copy_file_range(1, NULL, 2, NULL, 0, 0); return 0; }')
500501
werror = '' if ignore_compiler_warnings else '-pedantic-errors -Werror'
501-
std = '' if is_openbsd else '-std=c11'
502502
sanitize_flag = ' '.join(sanitize_args)
503503
env_cflags = shlex.split(os.environ.get('CFLAGS', ''))
504504
env_cppflags = shlex.split(os.environ.get('CPPFLAGS', ''))
@@ -508,7 +508,7 @@ def init_env(
508508

509509
cflags_ = os.environ.get(
510510
'OVERRIDE_CFLAGS', (
511-
f'-Wextra {float_conversion} -Wno-missing-field-initializers -Wall -Wstrict-prototypes {std}'
511+
f'-Wextra {float_conversion} -Wno-missing-field-initializers -Wall -Wstrict-prototypes {c_std}'
512512
f' {werror} {optimize} {sanitize_flag} -fwrapv {stack_protector} {missing_braces}'
513513
f' -pipe -fvisibility=hidden {no_plt}'
514514
)
@@ -1297,7 +1297,7 @@ def read_bool_options(path: str = 'kitty/cli.py') -> Tuple[str, ...]:
12971297

12981298
def build_launcher(args: Options, launcher_dir: str = '.', bundle_type: str = 'source') -> str:
12991299
werror = '' if args.ignore_compiler_warnings else '-pedantic-errors -Werror'
1300-
cflags = f'-Wall {werror} -fpie'.split()
1300+
cflags = f'-Wall {werror} -fpie {c_std}'.strip().split()
13011301
cppflags = [define(f'WRAPPED_KITTENS=" {wrapped_kittens()} "')]
13021302
ldflags = shlex.split(os.environ.get('LDFLAGS', ''))
13031303
xxhash = xxhash_flags()

0 commit comments

Comments
 (0)