bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rebased timeout patch


From: Jim Meyering
Subject: Re: rebased timeout patch
Date: Mon, 02 Jun 2008 23:11:47 +0200

Eric Blake <address@hidden> wrote:
> Jim Meyering <jim <at> meyering.net> writes:
>
>> >>>
>> >>> http://www.pixelbeat.org/patches/coreutils-timeout.diff
>>
>> Thanks again!
>> I've tweaked the log message and pushed the result.
>
> This needs a patch before it can build on cygwin and other non-glibc 
> platforms:
>
> gcc -std=gnu99  -gdwarf-2 -Wall -Werror  -Wl,--as-needed -o timeout.exe
> timeout.o operand2sig.o ../lib/libcoreutils.a /usr/local/lib/libintl.dll.a -
> liconv -L/usr/local/lib ../lib/libcoreutils.a
> ../lib/libcoreutils.a(error.o): In function `error':
> /home/eblake/coreutils/lib/error.c:250: undefined reference to `_program_name'
>
> Sounds like a 'make syntax-check' rule on top of this patch would be
> worthwhile, although I didn't tackle that...

I did it with this, after normalizing all existing uses:

>From 77b1bfc85cdf4ec01094ee31c8c85e2a83dea466 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 2 Jun 2008 17:48:11 +0200
Subject: [PATCH] each file with a "main" must also declare program_name

* maint.mk (sc_program_name): New rule.
* .x-sc_program_name: New file.
* Makefile.am (EXTRA_DIST): Add .x-sc_program_name.
---
 .x-sc_program_name |    2 ++
 Makefile.am        |    4 +++-
 maint.mk           |   12 ++++++++++++
 3 files changed, 17 insertions(+), 1 deletions(-)
 create mode 100644 .x-sc_program_name

diff --git a/.x-sc_program_name b/.x-sc_program_name
new file mode 100644
index 0000000..eb4855f
--- /dev/null
+++ b/.x-sc_program_name
@@ -0,0 +1,2 @@
+gl/lib/randint.c
+lib/euidaccess-stat.c
diff --git a/Makefile.am b/Makefile.am
index 14f777e..8c99923 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -22,7 +22,9 @@ EXTRA_DIST = cfg.mk maint.mk \
   .vg-suppressions \
   .x-po-check \
   .x-sc_GPL_version \
-  .x-sc_file_system .x-sc_obsolete_symbols \
+  .x-sc_file_system \
+  .x-sc_obsolete_symbols \
+  .x-sc_program_name \
   .x-sc_prohibit_atoi_atof \
   .x-sc_prohibit_strcmp \
   .x-sc_require_config_h \
diff --git a/maint.mk b/maint.mk
index 91e26a4..25551a8 100644
--- a/maint.mk
+++ b/maint.mk
@@ -341,6 +341,18 @@ sc_system_h_headers: .re-list
                  1>&2;  exit 1; } || :;                                \
        fi

+# Ensure that each .c file containing a "main" function also
+# declares "char *program_name", with or without "const".
+sc_program_name:
+       @if $(VC_LIST_EXCEPT) | grep '\.c$$' > /dev/null; then          \
+         files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
+         grep -EL '^(char const|(const )?char) \*program_name;' $$files \
+             | grep . &&                                               \
+         { echo '$(ME): the above files do not declare program_name'   \
+               1>&2; exit 1; } || :;                                   \
+       else :;                                                         \
+       fi
+
 # Require that the final line of each test-lib.sh-using test be this one:
 # (exit $fail); exit $fail
 # Note: this test requires GNU grep's --label= option.
--
1.5.6.rc0.54.gf71a2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]