util/test: Do not use nested functions
Nested functions only work with gcc, not llvm. Define a static function
instead.
BUG=b:232122437
TEST=compile when FEATURES=test is set.
Change-Id: I93847ac953565aa83bec169feb32118ac27eb7a4
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/upstart/+/3647452
Reviewed-by: Allen Webb <allenwebb@google.com>
Tested-by: Gwendal Grignou <gwendal@chromium.org>
Commit-Queue: Gwendal Grignou <gwendal@chromium.org>
Reviewed-by: Fergus Dall <sidereal@google.com>
diff --git a/util/tests/test_initctl.c b/util/tests/test_initctl.c
index 7933185..6f9eceb 100644
--- a/util/tests/test_initctl.c
+++ b/util/tests/test_initctl.c
@@ -266,6 +266,8 @@
return TRUE;
}
+static void hup_handler_empty (int signum) { _exit (0); }
+
void
test_upstart_open (void)
{
@@ -3513,8 +3515,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -3843,8 +3844,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -4175,8 +4175,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -4535,8 +4534,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -5314,8 +5312,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -5560,8 +5557,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -5806,8 +5802,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -6051,8 +6046,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -6870,8 +6864,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -7200,8 +7193,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -7532,8 +7524,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.
@@ -7892,8 +7883,7 @@
* of memory cases.
*/
for (;;) {
- void hup_handler (int signum) { _exit (0); }
- signal (SIGHUP, hup_handler);
+ signal (SIGHUP, hup_handler_empty);
/* Expect the Get call for the job name, reply with
* the name.