1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-07-26 18:48:55 +02:00

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.
This commit is contained in:
Jim Meyering
2008-06-02 17:48:11 +02:00
parent 434258ca73
commit 77b1bfc85c
3 changed files with 17 additions and 1 deletions
+2
View File
@@ -0,0 +1,2 @@
gl/lib/randint.c
lib/euidaccess-stat.c
+3 -1
View File
@@ -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 \
+12
View File
@@ -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.