Skip to content

Commit 5f89157

Browse files
committed
Remove HAVE_SIGNAL_H
The `<signal.h>` header file is part of the standard C89 headers [1] and on current systems can be included unconditionally. Since file requires at least C89 or greater, the `HAVE_SIGNAL_H` symbol defined by Autoconf in Zend.m4 [2] can be ommitted and simplifed. The bundled libmagic (file) also ommits the usage of HAVE_SIGNAL_H since 5.35 however current version in PHP is very modified 5.34 version and will be refactored separately. Check for HAVE_SIGNAL_H is therefore still done in the configure.ac. Refs: [1] https://port70.net/~nsz/c/c89/c89-draft.html#4.1.2 [2] https://git.savannah.gnu.org/cgit/autoconf.git/tree/lib/autoconf/headers.m4
1 parent fd1ad1e commit 5f89157

File tree

16 files changed

+11
-52
lines changed

16 files changed

+11
-52
lines changed

TSRM/TSRM.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,7 @@ typedef int ts_rsrc_id;
8282
# define MUTEX_T st_mutex_t
8383
#endif
8484

85-
#ifdef HAVE_SIGNAL_H
8685
#include <signal.h>
87-
#endif
8886

8987
typedef void (*ts_allocate_ctor)(void *);
9088
typedef void (*ts_allocate_dtor)(void *);

Zend/Zend.m4

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ malloc.h \
1212
unistd.h \
1313
sys/types.h \
1414
sys/time.h \
15-
signal.h \
1615
unix.h \
1716
cpuid.h \
1817
dlfcn.h)

Zend/zend_alloc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,8 @@
5757
#include "zend_operators.h"
5858
#include "zend_multiply.h"
5959
#include "zend_bitset.h"
60+
#include <signal.h>
6061

61-
#ifdef HAVE_SIGNAL_H
62-
# include <signal.h>
63-
#endif
6462
#ifdef HAVE_UNISTD_H
6563
# include <unistd.h>
6664
#endif

Zend/zend_signal.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@
3030

3131
#include "zend.h"
3232
#include "zend_globals.h"
33-
34-
#ifdef HAVE_SIGNAL_H
3533
#include <signal.h>
36-
#endif
3734

3835
#ifdef HAVE_UNISTD_H
3936
#include <unistd.h>

Zend/zend_signal.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323

2424
#ifdef ZEND_SIGNALS
2525

26-
# ifdef HAVE_SIGNAL_H
27-
# include <signal.h>
28-
# endif
26+
#include <signal.h>
2927

3028
#ifndef NSIG
3129
#define NSIG 65

ext/standard/exec.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131
#if HAVE_SYS_WAIT_H
3232
#include <sys/wait.h>
3333
#endif
34-
#if HAVE_SIGNAL_H
34+
3535
#include <signal.h>
36-
#endif
3736

3837
#if HAVE_SYS_TYPES_H
3938
#include <sys/types.h>

ext/standard/mail.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,8 @@
3535
#endif
3636

3737
#if PHP_SIGCHILD
38-
#if HAVE_SIGNAL_H
3938
#include <signal.h>
4039
#endif
41-
#endif
4240

4341
#include "php_syslog.h"
4442
#include "php_mail.h"

ext/standard/proc_open.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
#if HAVE_SYS_WAIT_H
3939
#include <sys/wait.h>
4040
#endif
41-
#if HAVE_SIGNAL_H
4241
#include <signal.h>
43-
#endif
4442

4543
#if HAVE_SYS_STAT_H
4644
#include <sys/stat.h>

main/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
#if HAVE_UNISTD_H
4040
#include <unistd.h>
4141
#endif
42-
#if HAVE_SIGNAL_H
42+
4343
#include <signal.h>
44-
#endif
44+
4545
#if HAVE_SETLOCALE
4646
#include <locale.h>
4747
#endif

sapi/cgi/cgi_main.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,7 @@
4545
# include <unistd.h>
4646
#endif
4747

48-
#if HAVE_SIGNAL_H
49-
# include <signal.h>
50-
#endif
48+
#include <signal.h>
5149

5250
#if HAVE_SETLOCALE
5351
# include <locale.h>
@@ -1779,7 +1777,6 @@ int main(int argc, char *argv[])
17791777
char *decoded_query_string;
17801778
int skip_getopt = 0;
17811779

1782-
#ifdef HAVE_SIGNAL_H
17831780
#if defined(SIGPIPE) && defined(SIG_IGN)
17841781
signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
17851782
that sockets created via fsockopen()
@@ -1788,7 +1785,6 @@ int main(int argc, char *argv[])
17881785
does that for us! thies@thieso.net
17891786
20000419 */
17901787
#endif
1791-
#endif
17921788

17931789
#ifdef ZTS
17941790
php_tsrm_startup();

sapi/cli/php_cli.c

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
#if HAVE_UNISTD_H
4747
#include <unistd.h>
4848
#endif
49-
#if HAVE_SIGNAL_H
49+
5050
#include <signal.h>
51-
#endif
51+
5252
#if HAVE_SETLOCALE
5353
#include <locale.h>
5454
#endif
@@ -66,10 +66,6 @@
6666
#include "win32/php_registry.h"
6767
#endif
6868

69-
#if HAVE_SIGNAL_H
70-
#include <signal.h>
71-
#endif
72-
7369
#ifdef __riscos__
7470
#include <unixlib/local.h>
7571
#endif
@@ -1233,7 +1229,6 @@ int main(int argc, char *argv[])
12331229
}
12341230
#endif
12351231

1236-
#ifdef HAVE_SIGNAL_H
12371232
#if defined(SIGPIPE) && defined(SIG_IGN)
12381233
signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
12391234
that sockets created via fsockopen()
@@ -1242,8 +1237,6 @@ int main(int argc, char *argv[])
12421237
does that for us! thies@thieso.net
12431238
20000419 */
12441239
#endif
1245-
#endif
1246-
12471240

12481241
#ifdef ZTS
12491242
php_tsrm_startup();

sapi/cli/php_cli_server.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@
4343
#if HAVE_UNISTD_H
4444
#include <unistd.h>
4545
#endif
46-
#if HAVE_SIGNAL_H
4746
#include <signal.h>
48-
#endif
4947
#if HAVE_SETLOCALE
5048
#include <locale.h>
5149
#endif
@@ -2601,7 +2599,7 @@ int do_cli_server(int argc, char **argv) /* {{{ */
26012599
PHP_VERSION, buf, server_bind_address, document_root);
26022600
}
26032601

2604-
#if defined(HAVE_SIGNAL_H) && defined(SIGINT)
2602+
#if defined(SIGINT)
26052603
signal(SIGINT, php_cli_server_sigint_handler);
26062604
zend_signal_init();
26072605
#endif

sapi/embed/php_embed.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ EMBED_SAPI_API int php_embed_init(int argc, char **argv)
159159
{
160160
zend_llist global_vars;
161161

162-
#ifdef HAVE_SIGNAL_H
163162
#if defined(SIGPIPE) && defined(SIG_IGN)
164163
signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
165164
that sockets created via fsockopen()
@@ -168,7 +167,6 @@ EMBED_SAPI_API int php_embed_init(int argc, char **argv)
168167
does that for us! thies@thieso.net
169168
20000419 */
170169
#endif
171-
#endif
172170

173171
#ifdef ZTS
174172
php_tsrm_startup();

sapi/fpm/fpm/fpm_main.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@
4343
# include <unistd.h>
4444
#endif
4545

46-
#if HAVE_SIGNAL_H
47-
# include <signal.h>
48-
#endif
46+
#include <signal.h>
4947

5048
#if HAVE_SETLOCALE
5149
# include <locale.h>
@@ -1567,7 +1565,6 @@ int main(int argc, char *argv[])
15671565
zend_bool old_rc_debug;
15681566
#endif
15691567

1570-
#ifdef HAVE_SIGNAL_H
15711568
#if defined(SIGPIPE) && defined(SIG_IGN)
15721569
signal(SIGPIPE, SIG_IGN); /* ignore SIGPIPE in standalone mode so
15731570
that sockets created via fsockopen()
@@ -1576,7 +1573,6 @@ int main(int argc, char *argv[])
15761573
does that for us! thies@thieso.net
15771574
20000419 */
15781575
#endif
1579-
#endif
15801576

15811577
#ifdef ZTS
15821578
php_tsrm_startup();

sapi/litespeed/lsapi_main.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,7 @@
4343

4444
#endif
4545

46-
#if HAVE_SIGNAL_H
47-
4846
#include <signal.h>
49-
50-
#endif
51-
5247
#include <sys/socket.h>
5348
#include <arpa/inet.h>
5449
#include <netinet/in.h>
@@ -1228,11 +1223,9 @@ int main( int argc, char * argv[] )
12281223
int slow_script_msec = 0;
12291224
char time_buf[40];
12301225

1231-
#ifdef HAVE_SIGNAL_H
12321226
#if defined(SIGPIPE) && defined(SIG_IGN)
12331227
signal(SIGPIPE, SIG_IGN);
12341228
#endif
1235-
#endif
12361229

12371230
#ifdef ZTS
12381231
php_tsrm_startup();

sapi/phpdbg/phpdbg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
#include "zend_ini_scanner.h"
4747
#include "zend_stream.h"
4848
#include "zend_signal.h"
49-
#if !defined(_WIN32) && !defined(ZEND_SIGNALS) && defined(HAVE_SIGNAL_H)
49+
#if !defined(_WIN32) && !defined(ZEND_SIGNALS)
5050
# include <signal.h>
5151
#elif defined(PHP_WIN32)
5252
# include "win32/signal.h"

0 commit comments

Comments
 (0)