apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Saxon Druce" <sa...@blocksoftware.com>
Subject Borland C++ Builder signals
Date Tue, 13 May 2003 08:42:47 GMT
Hi,

When compiling APR using Borland C++ Builder 6.0 (bcc32 5.6), I get about 37
of these warnings:

[C++ Warning] signal.h(65): W8017 Redefinition of 'SIGUSR1' is not identical
[C++ Warning] signal.h(66): W8017 Redefinition of 'SIGUSR2' is not identical

And about 14 of these:

[C++ Warning] apr_private.h(132): W8017 Redefinition of 'SIGUSR1' is not
identical
[C++ Warning] apr_private.h(134): W8017 Redefinition of 'SIGUSR2' is not
identical

The reason is that include\arch\win32\apr_private.h has this:

#define SIGHUP     1
/* 2 is used for SIGINT on windows */
#define SIGQUIT    3
/* 4 is used for SIGILL on windows */
#define SIGTRAP    5
#define SIGIOT     6
#define SIGBUS     7
/* 8 is used for SIGFPE on windows */
#define SIGKILL    9
#define SIGUSR1    10
/* 11 is used for SIGSEGV on windows */
#define SIGUSR2    12
#define SIGPIPE    13
#define SIGALRM    14
/* 15 is used for SIGTERM on windows */
#define SIGSTKFLT  16
#define SIGCHLD    17
#define SIGCONT    18
#define SIGSTOP    19
#define SIGTSTP    20
/* 21 is used for SIGBREAK on windows */
/* 22 is used for SIGABRT on windows */
#define SIGTTIN    23
#define SIGTTOU    24
#define SIGURG     25
#define SIGXCPU    26
#define SIGXFSZ    27
#define SIGVTALRM  28
#define SIGPROF    29
#define SIGWINCH   30
#define SIGIO      31

This is consistent with Microsoft Visual C++'s signal.h, which has this:

#define SIGINT          2
#define SIGILL          4
#define SIGFPE          8
#define SIGSEGV         11
#define SIGTERM         15
#define SIGBREAK        21
#define SIGABRT         22

But it *isn't* consistent with Borland C++ Builder's signal.h, which has
this:

#define SIGABRT         22
#define SIGFPE           8
#define SIGILL           4
#define SIGINT           2
#define SIGSEGV         11
#define SIGTERM         15
#define SIGUSR1         16
#define SIGUSR2         17
#define SIGUSR3         20
#define SIGBREAK        21

About a year ago I submitted a patch for apr_private.h, which swapped
SIGSTKFLT with SIGUSR1 and SIGCHLD with SIGUSR2, then wrapped the SIGUSR1
and SIGUSR2 in a #ifndef __BORLANDC__, ie like this:

[snip]
#define SIGKILL    9
#define SIGSTKFLT  10
/* 11 is used for SIGSEGV on windows */
#define SIGCHLD    12
#define SIGPIPE    13
#define SIGALRM    14
/* 15 is used for SIGTERM on windows */
#ifndef __BORLANDC__
/* SIGUSR1 and SIGUSR2 are 16 and 17 for Borland C */
#define SIGUSR1    16
#define SIGUSR2    17
#endif
#define SIGCONT    18
[snip]

At the time I received a response from Branko Cibej, suggesting that I
should use a conditional test on a symbol, not a tool (ie not on Borland's
__BORLANDC__ define). I replied asking if he meant this:

[snip]
#define SIGKILL    9
#define SIGSTKFLT  10
/* 11 is used for SIGSEGV on windows */
#define SIGCHLD    12
#define SIGPIPE    13
#define SIGALRM    14
/* 15 is used for SIGTERM on windows */
/* SIGUSR1 and SIGUSR2 are 16 and 17 for Borland C */
#ifndef SIGUSR1
#define SIGUSR1    16
#endif
#ifndef SIGUSR2
#define SIGUSR2    17
#endif
#define SIGCONT    18
[snip]

Although that would only work for the warnings where apr_private.h is
included after signal.h, ie these ones:

[C++ Warning] apr_private.h(132): W8017 Redefinition of 'SIGUSR1' is not
identical
[C++ Warning] apr_private.h(134): W8017 Redefinition of 'SIGUSR2' is not
identical

And not these ones:

[C++ Warning] signal.h(65): W8017 Redefinition of 'SIGUSR1' is not identical
[C++ Warning] signal.h(66): W8017 Redefinition of 'SIGUSR2' is not identical

Unless apr_private.h was made to include signal.h itself before making the
definitions.

I haven't had a chance until now to follow this up any further.

Another approach would be to define them unconditionally, eg:

[snip]
#define SIGKILL    9
#define SIGSTKFLT  10
/* 11 is used for SIGSEGV on windows */
#define SIGCHLD    12
#define SIGPIPE    13
#define SIGALRM    14
/* 15 is used for SIGTERM on windows */
/* SIGUSR1 and SIGUSR2 are 16 and 17 for Borland C */
#define SIGUSR1    16
#define SIGUSR2    17
#define SIGCONT    18
[snip]

Since Borland doesn't seem to mind having them re-defined to the same value.

If someone could let me know which way this should be solved, I'll supply a
proper 'diff -u' patch.

Thanks,
Saxon


Mime
View raw message