[gjs: 1/2] build: Prefer signal.h to sys/signal.h
- From: Philip Chimento <pchimento src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gjs: 1/2] build: Prefer signal.h to sys/signal.h
- Date: Mon, 13 Jan 2020 23:04:45 +0000 (UTC)
commit 590d09b0ffc3d1f8901ee825c6cab715be2a301b
Author: Philip Chimento <philip chimento gmail com>
Date: Tue Jan 7 23:52:00 2020 -0500
build: Prefer signal.h to sys/signal.h
It seems that signal.h is the correct header to include. It's not clear
whether that's the case on win32, but in that case we do already have a
typedef for siginfo_t, so it's OK not to include any header.
Closes: #295
gjs/context.h | 2 +-
gjs/profiler.cpp | 7 +++----
meson.build | 3 ++-
tools/gjs-private-iwyu.imp | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gjs/context.h b/gjs/context.h
index b173c32c..13be25b9 100644
--- a/gjs/context.h
+++ b/gjs/context.h
@@ -31,7 +31,7 @@
#include <stdbool.h> /* IWYU pragma: keep */
#ifndef _WIN32
-# include <sys/signal.h> /* for siginfo_t */
+# include <signal.h> /* for siginfo_t */
#endif
#include <glib-object.h>
diff --git a/gjs/profiler.cpp b/gjs/profiler.cpp
index 74c99f07..c8b94f8a 100644
--- a/gjs/profiler.cpp
+++ b/gjs/profiler.cpp
@@ -21,10 +21,10 @@
* IN THE SOFTWARE.
*/
-#include <config.h> // for ENABLE_PROFILER, HAVE_SYS_SYSCALL_H, HAVE_UNISTD_H, HAVE_SYS_SIGNAL_H
+#include <config.h> // for ENABLE_PROFILER, HAVE_SYS_SYSCALL_H, HAVE_UNISTD_H
-#ifdef HAVE_SYS_SIGNAL_H
-# include <sys/signal.h> // for siginfo_t, sigevent, ...
+#ifndef HAVE_SIGNAL_H
+# include <signal.h> // for siginfo_t, sigevent, sigaction, SIGPROF, ...
#endif
#include <glib-object.h>
@@ -33,7 +33,6 @@
#ifdef ENABLE_PROFILER
# include <alloca.h>
# include <errno.h>
-# include <signal.h> // for sigaction, SIGPROF, sigemptyset
# include <stddef.h> // for size_t
# include <stdint.h>
# include <stdio.h> // for sscanf
diff --git a/meson.build b/meson.build
index 072a3e1d..6fe940bc 100644
--- a/meson.build
+++ b/meson.build
@@ -283,7 +283,8 @@ if build_readline
endif
header_conf.set('HAVE_SYS_SYSCALL_H', cxx.check_header('sys/syscall.h'))
header_conf.set('HAVE_UNISTD_H', cxx.check_header('unistd.h'))
-header_conf.set('HAVE_SYS_SIGNAL_H', cxx.check_header('sys/signal.h'))
+header_conf.set('HAVE_SIGNAL_H', cxx.check_header('signal.h',
+ required: build_profiler))
# enable GNU extensions on systems that have them
header_conf.set('_GNU_SOURCE', 1)
diff --git a/tools/gjs-private-iwyu.imp b/tools/gjs-private-iwyu.imp
index 43fe827c..19ffbcbd 100644
--- a/tools/gjs-private-iwyu.imp
+++ b/tools/gjs-private-iwyu.imp
@@ -3,8 +3,8 @@
{"include": ["<bits/std_abs.h>", "private", "<stdlib.h>", "public"]},
{"include": ["<bits/std_function.h>", "private", "<functional>", "public"]},
{"include": ["@<bits/stdint-.*>", "private", "<stdint.h>", "public"]},
- {"include": ["<bits/types/sigevent_t.h>", "private", "<sys/signal.h>", "public"]},
- {"include": ["<bits/types/siginfo_t.h>", "private", "<sys/signal.h>", "public"]},
+ {"include": ["<bits/types/sigevent_t.h>", "private", "<signal.h>", "public"]},
+ {"include": ["<bits/types/siginfo_t.h>", "private", "<signal.h>", "public"]},
{"include": ["<bits/types/struct_itimerspec.h>", "private", "<time.h>", "public"]},
{"include": ["<bits/types/struct_timespec.h>", "private", "<time.h>", "public"]},
{"include": ["<bits/types/timer_t.h>", "private", "<sys/types.h>", "public"]},
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]