145
145
# FIXME: don't allow `#include .strings\.h' anywhere
147
# By default, _prohibit_regexp does not ignore case.
149
# This macro searches for a given construct in the selected files and
150
# then takes some action.
152
# Parameters (shell variables):
156
# Regular expression (ERE) denoting either a forbidden construct
157
# or a required construct. Those arguments are exclusive.
159
# in_vc_files | in_files
161
# grep-E-style regexp denoting the files to check. If no files
162
# are specified the default are all the files that are under
165
# containing | non_containing
167
# Select the files (non) containing strings matching this regexp.
168
# If both arguments are specified then CONTAINING takes
173
# Extra options for grep.
181
# Message to display before to halting execution.
183
# By default, _sc_search_regexp does not ignore case.
148
184
export ignore_case =
149
185
_ignore_case = $$(test -n "$$ignore_case" && echo -i || :)
151
# There are many rules below that prohibit constructs in this package.
152
# If the offending construct can be matched with a grep-E-style regexp,
153
# use this macro. The shell variables "re" and "msg" must be defined.
154
define _prohibit_regexp
155
dummy=; : so we do not need a semicolon before each use; \
156
test "x$$re" != x || { echo '$(ME): re not defined' 1>&2; exit 1; }; \
157
test "x$$msg" != x || { echo '$(ME): msg not defined' 1>&2; exit 1; };\
158
grep $(_ignore_case) -nE "$$re" $$($(VC_LIST_EXCEPT)) && \
159
{ echo '$(ME): '"$$msg" 1>&2; exit 1; } || :
187
define _sc_say_and_exit
188
dummy=; : so we do not need a semicolon before each use; \
189
{ echo -e "$(ME): $$msg" 1>&2; exit 1; };
192
define _sc_search_regexp
193
dummy=; : so we do not need a semicolon before each use; \
196
test -n "$$prohibit" && test -n "$$require" \
197
&& { msg='Cannot specify both prohibit and require' \
198
$(_sc_say_and_exit) } || :; \
199
test -z "$$prohibit" && test -z "$$require" \
200
&& { msg='Should specify either prohibit or require' \
201
$(_sc_say_and_exit) } || :; \
202
test -n "$$in_vc_files" && test -n "$$in_files" \
203
&& { msg='Cannot specify both in_vc_files and in_files' \
204
$(_sc_say_and_exit) } || :; \
205
test "x$$halt" != x \
206
|| { msg='halt not defined' $(_sc_say_and_exit) }; \
208
: Filter by file name; \
209
if test -n "$$in_files"; then \
210
files=$$(find $(srcdir) | grep -E "$$in_files"); \
212
files=$$($(VC_LIST_EXCEPT)); \
213
if test -n "$$in_vc_files"; then \
214
files=$$(echo "$$files" | grep -E "$$in_vc_files"); \
218
: Filter by content; \
219
test -n "$$files" && test -n "$$containing" \
220
&& { files=$$(grep -l "$$containing" $$files); } || :; \
221
test -n "$$files" && test -n "$$non_containing" \
222
&& { files=$$(grep -vl "$$non_containing" $$files); } || :; \
224
: Check for the construct; \
225
if test -n "$$files"; then \
226
if test -n "$$prohibit"; then \
227
grep $$with_grep_options $(_ignore_case) -nE "$$prohibit" $$files \
228
&& { msg="$$halt" $(_sc_say_and_exit) } || :; \
230
grep $$with_grep_options $(_ignore_case) -LE "$$require" $$files \
232
&& { msg="$$halt" $(_sc_say_and_exit) } || :; \
162
238
sc_avoid_if_before_free:
169
245
sc_cast_of_argument_to_free:
170
@re='\<free *\( *\(' msg='don'\''t cast free argument' \
246
@prohibit='\<free *\( *\(' halt='don'\''t cast free argument' \
173
249
sc_cast_of_x_alloc_return_value:
174
@re='\*\) *x(m|c|re)alloc\>' \
175
msg='don'\''t cast x*alloc return value' \
250
@prohibit='\*\) *x(m|c|re)alloc\>' \
251
halt='don'\''t cast x*alloc return value' \
178
254
sc_cast_of_alloca_return_value:
179
@re='\*\) *alloca\>' msg='don'\''t cast alloca return value' \
255
@prohibit='\*\) *alloca\>' \
256
halt='don'\''t cast alloca return value' \
183
@re='[ ] ' msg='found SPACE-TAB sequence; remove the SPACE' \
261
halt='found SPACE-TAB sequence; remove the SPACE' \
186
264
# Don't use *scanf or the old ato* functions in `real' code.
187
265
# They provide no error checking mechanism.
188
266
# Instead, use strto* functions.
189
267
sc_prohibit_atoi_atof:
190
@re='\<([fs]?scanf|ato([filq]|ll)) *\(' \
191
msg='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
268
@prohibit='\<([fs]?scanf|ato([filq]|ll)) *\(' \
269
halt='do not use *scan''f, ato''f, ato''i, ato''l, ato''ll or ato''q' \
194
272
# Use STREQ rather than comparing strcmp == 0, or != 0.
195
273
sc_prohibit_strcmp:
210
288
# | xargs --no-run-if-empty \
211
289
# perl -pi -e 's/(^|[^.])\b(exit ?)\(0\)/$1$2(EXIT_SUCCESS)/'
212
290
sc_prohibit_magic_number_exit:
213
@re='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \
214
msg='use EXIT_* values rather than magic number' \
291
@prohibit='(^|[^.])\<(usage|exit) ?\([0-9]|\<error ?\([1-9][0-9]*,' \
292
halt='use EXIT_* values rather than magic number' \
217
295
# Using EXIT_SUCCESS as the first argument to error is misleading,
218
296
# since when that parameter is 0, error does not exit. Use `0' instead.
219
297
sc_error_exit_success:
220
@grep -nE 'error \(EXIT_SUCCESS,' \
221
$$($(VC_LIST_EXCEPT) | grep -E '\.[chly]$$') && \
222
{ echo '$(ME): found error (EXIT_SUCCESS' 1>&2; exit 1; } || :
298
@prohibit='error *\(EXIT_SUCCESS,' \
299
in_vc_files='\.[chly]$$' \
300
halt='found error (EXIT_SUCCESS' \
224
303
# `FATAL:' should be fully upper-cased in error messages
225
304
# `WARNING:' should be fully upper-cased, or fully lower-cased
226
305
sc_error_message_warn_fatal:
227
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
306
@grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
228
307
| grep -E '"Warning|"Fatal|"fatal' && \
229
308
{ echo '$(ME): use FATAL, WARNING or warning' 1>&2; \
232
311
# Error messages should not start with a capital letter
233
312
sc_error_message_uppercase:
234
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
313
@grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
235
314
| grep -E '"[A-Z]' \
236
315
| grep -vE '"FATAL|"WARNING|"Java|"C#|PRIuMAX' && \
237
316
{ echo '$(ME): found capitalized error message' 1>&2; \
240
319
# Error messages should not end with a period
241
320
sc_error_message_period:
242
@grep -nEA2 '[^rp]error \(' $$($(VC_LIST_EXCEPT)) \
321
@grep -nEA2 '[^rp]error *\(' $$($(VC_LIST_EXCEPT)) \
243
322
| grep -E '[^."]\."' && \
244
323
{ echo '$(ME): found error message ending in period' 1>&2; \
248
@re=file''system ignore_case=1 \
249
msg='found use of "file''system"; spell it "file system"' \
327
@prohibit=file''system \
329
halt='found use of "file''system"; spell it "file system"' \
252
332
# Don't use cpp tests of this symbol. All code assumes config.h is included.
253
333
sc_prohibit_have_config_h:
254
@grep -n '^# *if.*HAVE''_CONFIG_H' $$($(VC_LIST_EXCEPT)) && \
255
{ echo '$(ME): found use of HAVE''_CONFIG_H; remove' \
334
@prohibit='^# *if.*HAVE''_CONFIG_H' \
335
halt='found use of HAVE''_CONFIG_H; remove' \
258
338
# Nearly all .c files must include <config.h>. However, we also permit this
259
339
# via inclusion of a package-specific header, if cfg.mk specified one.
260
340
# config_h_header must be suitable for grep -E.
261
341
config_h_header ?= <config\.h>
262
342
sc_require_config_h:
263
@if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \
264
grep -EL '^# *include $(config_h_header)' \
265
$$($(VC_LIST_EXCEPT) | grep '\.c$$') \
267
{ echo '$(ME): the above files do not include <config.h>' \
268
1>&2; exit 1; } || :; \
343
@require='^# *include $(config_h_header)' \
344
in_vc_files='\.c$$' \
345
halt='the above files do not include <config.h>' \
272
348
# You must include <config.h> before including any other header file.
273
349
# This can possibly be via a package-specific header, if given by cfg.mk.
288
364
sc_prohibit_HAVE_MBRTOWC:
289
@re='\bHAVE_MBRTOWC\b' msg="do not use $$re; it is always defined" \
365
@prohibit='\bHAVE_MBRTOWC\b' \
366
halt="do not use $$re; it is always defined" \
292
369
# To use this "command" macro, you must first define two shell variables:
293
370
# h: the header, enclosed in <> or ""
294
371
# re: a regular expression that matches IFF something provided by $h is used.
295
define _header_without_use
372
define _sc_header_without_use
296
373
dummy=; : so we do not need a semicolon before each use; \
297
374
h_esc=`echo "$$h"|sed 's/\./\\\\./g'`; \
298
375
if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \
308
385
# Prohibit the inclusion of assert.h without an actual use of assert.
309
386
sc_prohibit_assert_without_use:
310
@h='<assert.h>' re='\<assert *\(' $(_header_without_use)
387
@h='<assert.h>' re='\<assert *\(' $(_sc_header_without_use)
312
389
# Prohibit the inclusion of close-stream.h without an actual use.
313
390
sc_prohibit_close_stream_without_use:
314
@h='"close-stream.h"' re='\<close_stream *\(' $(_header_without_use)
391
@h='"close-stream.h"' re='\<close_stream *\(' $(_sc_header_without_use)
316
393
# Prohibit the inclusion of getopt.h without an actual use.
317
394
sc_prohibit_getopt_without_use:
318
@h='<getopt.h>' re='\<getopt(_long)? *\(' $(_header_without_use)
395
@h='<getopt.h>' re='\<getopt(_long)? *\(' $(_sc_header_without_use)
320
397
# Don't include quotearg.h unless you use one of its functions.
321
398
sc_prohibit_quotearg_without_use:
322
@h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_header_without_use)
399
@h='"quotearg.h"' re='\<quotearg(_[^ ]+)? *\(' $(_sc_header_without_use)
324
401
# Don't include quote.h unless you use one of its functions.
325
402
sc_prohibit_quote_without_use:
326
@h='"quote.h"' re='\<quote(_n)? *\(' $(_header_without_use)
403
@h='"quote.h"' re='\<quote(_n)? *\(' $(_sc_header_without_use)
328
405
# Don't include this header unless you use one of its functions.
329
406
sc_prohibit_long_options_without_use:
330
407
@h='"long-options.h"' re='\<parse_long_options *\(' \
331
$(_header_without_use)
408
$(_sc_header_without_use)
333
410
# Don't include this header unless you use one of its functions.
334
411
sc_prohibit_inttostr_without_use:
335
412
@h='"inttostr.h"' re='\<(off|[iu]max|uint)tostr *\(' \
336
$(_header_without_use)
413
$(_sc_header_without_use)
338
415
# Don't include this header unless you use one of its functions.
339
416
sc_prohibit_ignore_value_without_use:
340
417
@h='"ignore-value.h"' re='\<ignore_(value|ptr) *\(' \
341
$(_header_without_use)
418
$(_sc_header_without_use)
343
420
# Don't include this header unless you use one of its functions.
344
421
sc_prohibit_error_without_use:
346
423
re='\<error(_at_line|_print_progname|_one_per_line|_message_count)? *\('\
347
$(_header_without_use)
424
$(_sc_header_without_use)
349
426
# Don't include xalloc.h unless you use one of its functions.
350
427
# Consider these symbols:
351
428
# perl -lne '/^# *define (\w+)\(/ and print $1' lib/xalloc.h|grep -v '^__';
352
# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' lib/xalloc.h
429
# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/xalloc.h
353
430
# Divide into two sets on case, and filter each through this:
354
431
# | sort | perl -MRegexp::Assemble -le \
355
432
# 'print Regexp::Assemble->new(file => "/dev/stdin")->as_string'|sed 's/\?://g'
367
444
sc_prohibit_xalloc_without_use:
368
445
@h='"xalloc.h"' \
369
446
re='\<($(_xa1)|$(_xa2)) *\('\
370
$(_header_without_use)
447
$(_sc_header_without_use)
372
449
# Extract function names:
373
# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) \(/ and print $1' lib/hash.h
450
# perl -lne '/^(?:extern )?(?:void|char) \*?(\w+) *\(/ and print $1' lib/hash.h
375
452
clear|delete|free|get_(first|next)|insert|lookup|print_statistics|reset_tuning
376
453
_hash_fn = \<($(_hash_re)) *\(
378
455
sc_prohibit_hash_without_use:
380
457
re='$(_hash_fn)|$(_hash_struct)'\
381
$(_header_without_use)
458
$(_sc_header_without_use)
383
460
sc_prohibit_hash_pjw_without_use:
384
461
@h='"hash-pjw.h"' \
385
462
re='\<hash_pjw *\(' \
386
$(_header_without_use)
463
$(_sc_header_without_use)
388
465
sc_prohibit_safe_read_without_use:
389
466
@h='"safe-read.h"' re='(\<SAFE_READ_ERROR\>|\<safe_read *\()' \
390
$(_header_without_use)
467
$(_sc_header_without_use)
392
469
sc_prohibit_argmatch_without_use:
393
470
@h='"argmatch.h"' \
394
471
re='(\<(ARRAY_CARDINALITY|X?ARGMATCH(|_TO_ARGUMENT|_VERIFY))\>|\<argmatch(_exit_fn|_(in)?valid) *\()' \
395
$(_header_without_use)
472
$(_sc_header_without_use)
397
474
sc_prohibit_canonicalize_without_use:
398
475
@h='"canonicalize.h"' \
399
476
re='CAN_(EXISTING|ALL_BUT_LAST|MISSING)|canonicalize_(mode_t|filename_mode)' \
400
$(_header_without_use)
477
$(_sc_header_without_use)
402
479
sc_prohibit_root_dev_ino_without_use:
403
480
@h='"root-dev-ino.h"' \
404
481
re='(\<ROOT_DEV_INO_(CHECK|WARN)\>|\<get_root_dev_ino *\()' \
405
$(_header_without_use)
482
$(_sc_header_without_use)
407
484
sc_prohibit_openat_without_use:
408
485
@h='"openat.h"' \
409
486
re='\<(openat_(permissive|needs_fchdir|(save|restore)_fail)|l?(stat|ch(own|mod))at|(euid)?accessat)\>' \
410
$(_header_without_use)
487
$(_sc_header_without_use)
412
489
# Prohibit the inclusion of c-ctype.h without an actual use.
413
490
ctype_re = isalnum|isalpha|isascii|isblank|iscntrl|isdigit|isgraph|islower\
414
491
|isprint|ispunct|isspace|isupper|isxdigit|tolower|toupper
415
492
sc_prohibit_c_ctype_without_use:
416
@h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' $(_header_without_use)
493
@h='[<"]c-ctype.h[">]' re='\<c_($(ctype_re)) *\(' \
494
$(_sc_header_without_use)
419
497
_sp = $(_empty) $(_empty)
450
528
sc_prohibit_signal_without_use:
451
529
@h='<signal.h>' \
452
530
re='\<($(_sig_function_re)) *\(|\<($(_sig_syms_re))\>' \
453
$(_header_without_use)
531
$(_sc_header_without_use)
533
# Get the list of symbol names with this:
534
# perl -lne '/^# *define (\w+)\(/ and print $1' lib/intprops.h|grep -v '^s'|fmt
536
TYPE_IS_INTEGER TYPE_TWOS_COMPLEMENT TYPE_ONES_COMPLEMENT \
537
TYPE_SIGNED_MAGNITUDE TYPE_SIGNED TYPE_MINIMUM TYPE_MAXIMUM \
538
INT_STRLEN_BOUND INT_BUFSIZE_BOUND
539
_intprops_syms_re = $(subst $(_sp),|,$(strip $(_intprops_names)))
540
# Prohibit the inclusion of intprops.h without an actual use.
541
sc_prohibit_intprops_without_use:
543
re='\<($(_intprops_syms_re)) *\(' \
544
$(_sc_header_without_use)
455
546
sc_obsolete_symbols:
456
@re='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
457
msg='do not use HAVE''_FCNTL_H or O'_NDELAY \
547
@prohibit='\<(HAVE''_FCNTL_H|O''_NDELAY)\>' \
548
halt='do not use HAVE''_FCNTL_H or O'_NDELAY \
460
551
# FIXME: warn about definitions of EXIT_FAILURE, EXIT_SUCCESS, STREQ
462
553
# Each nonempty ChangeLog line must start with a year number, or a TAB.
464
@if $(VC_LIST_EXCEPT) | grep -l '^ChangeLog$$' >/dev/null; then \
466
$$($(VC_LIST_EXCEPT) | grep '^ChangeLog$$') && \
467
{ echo '$(ME): found unexpected prefix in a ChangeLog' 1>&2; \
555
@prohibit='^[^12 ]' \
556
in_vc_files='^ChangeLog$$' \
557
halt='found unexpected prefix in a ChangeLog' \
471
560
# Ensure that each .c file containing a "main" function also
472
561
# calls set_program_name.
474
@if $(VC_LIST_EXCEPT) | grep -l '\.c$$' > /dev/null; then \
475
files=$$(grep -l '^main *(' $$($(VC_LIST_EXCEPT) | grep '\.c$$')); \
476
grep -LE 'set_program_name *\(m?argv\[0\]\);' $$files \
478
{ echo '$(ME): the above files do not call set_program_name' \
479
1>&2; exit 1; } || :; \
563
@require='set_program_name *\(m?argv\[0\]\);' \
564
in_vc_files='\.c$$' \
565
containing='^main *(' \
566
halt='the above files do not call set_program_name' \
483
569
# Require that the final line of each test-lib.sh-using test be this one:
503
@re='\<the ''the\>' \
504
ignore_case=1 msg='found use of "the ''the";' \
589
@prohibit='\<the ''the\>' \
591
halt='found use of "the ''the";' \
507
594
sc_trailing_blank:
509
msg='found trailing blank(s)' \
596
halt='found trailing blank(s)' \
512
599
# Match lines like the following, but where there is only one space
513
600
# between the options and the description:
514
601
# -D, --all-repeated[=delimit-method] print all duplicate lines\n
515
602
longopt_re = --[a-z][0-9A-Za-z-]*(\[?=[0-9A-Za-z-]*\]?)?
516
603
sc_two_space_separator_in_usage:
517
@grep -nE '^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
518
$$($(VC_LIST_EXCEPT)) && \
519
{ echo "$(ME): help2man requires at least two spaces between"; \
520
echo "$(ME): an option and its description"; \
604
@prohibit='^ *(-[A-Za-z],)? $(longopt_re) [^ ].*\\$$' \
605
halt='help2man requires at least two spaces between an option and its description'\
523
608
# Look for diagnostics that aren't marked for translation.
524
609
# This won't find any for which error's format string is on a separate line.
525
610
sc_unmarked_diagnostics:
527
'\<error \([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
612
'\<error *\([^"]*"[^"]*[a-z]{3}' $$($(VC_LIST_EXCEPT)) \
528
613
| grep -v '_''(' && \
529
614
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
532
617
# Avoid useless parentheses like those in this example:
533
618
# #if defined (SYMBOL) || defined (SYM2)
534
619
sc_useless_cpp_parens:
535
@grep -n '^# *if .*defined *(' $$($(VC_LIST_EXCEPT)) && \
536
{ echo '$(ME): found useless parentheses in cpp directive' \
620
@prohibit='^# *if .*defined *\(' \
621
halt='found useless parentheses in cpp directive' \
539
624
# Require the latest GPL.
541
@re='either ''version [^3]' msg='GPL vN, N!=3' \
626
@prohibit='either ''version [^3]' \
627
halt='GPL vN, N!=3' \
544
630
# Require the latest GFDL. Two regexp, since some .texi files end up
545
631
# line wrapping between 'Free Documentation License,' and 'Version'.
546
632
_GFDL_regexp = (Free ''Documentation.*Version 1\.[^3]|Version 1\.[^3] or any)
548
@re='$(_GFDL_regexp)' msg='GFDL vN, N!=3' \
634
@prohibit='$(_GFDL_regexp)' \
635
halt='GFDL vN, N!=3' \
638
# Don't use Texinfo @acronym{} as it is not a good idea.
640
@prohibit='@acronym{' \
641
in_vc_files='\.texi$$' \
642
halt='found use of Texinfo @acronym{}' \
552
646
Author|Date|Header|Id|Name|Locker|Log|RCSfile|Revision|Source|State
554
648
sc_prohibit_cvs_keyword:
555
@re='\$$($(cvs_keywords))\$$' \
556
msg='do not use CVS keyword expansion' \
649
@prohibit='\$$($(cvs_keywords))\$$' \
650
halt='do not use CVS keyword expansion' \
559
653
# Make sure we don't use st_blocks. Use ST_NBLOCKS instead.
560
654
# This is a bit of a kludge, since it prevents use of the string
561
655
# even in comments, but for now it does the job with no false positives.
562
656
sc_prohibit_stat_st_blocks:
563
@re='[.>]st_blocks' msg='do not use st_blocks; use ST_NBLOCKS' \
657
@prohibit='[.>]st_blocks' \
658
halt='do not use st_blocks; use ST_NBLOCKS' \
566
661
# Make sure we don't define any S_IS* macros in src/*.c files.
567
662
# They're already defined via gnulib's sys/stat.h replacement.
568
663
sc_prohibit_S_IS_definition:
569
@re='^ *# *define *S_IS' \
570
msg='do not define S_IS* macros; include <sys/stat.h>' \
664
@prohibit='^ *# *define *S_IS' \
665
halt='do not define S_IS* macros; include <sys/stat.h>' \
668
_ptm1 = use "test C1 && test C2", not "test C1 -''a C2"
669
_ptm2 = use "test C1 || test C2", not "test C1 -''o C2"
670
# Using test's -a and -o operators is not portable.
671
# We prefer test over [, since the latter is spelled [[ in configure.ac.
672
sc_prohibit_test_minus_ao:
673
@prohibit='(\<test| \[+) .+ -[ao] ' \
674
halt='$(_ptm1); $(_ptm2)' \
573
677
# Each program that uses proper_name_utf8 must link with one of the
574
678
# ICONV libraries. Otherwise, some ICONV library must appear in LDADD.
596
700
# Warn about "c0nst struct Foo const foo[]",
597
701
# but not about "char const *const foo" or "#define const const".
598
702
sc_redundant_const:
599
@re='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
600
msg='redundant "const" in declarations' \
703
@prohibit='\bconst\b[[:space:][:alnum:]]{2,}\bconst\b' \
704
halt='redundant "const" in declarations' \
603
707
sc_const_long_option:
604
708
@grep '^ *static.*struct option ' $$($(VC_LIST_EXCEPT)) \
654
758
sc_makefile_TAB_only_indentation:
655
@grep -nE '^ [ ]{8}' \
656
$$($(VC_LIST_EXCEPT) | grep -E 'akefile|\.mk$$') \
657
&& { echo '$(ME): found TAB-8-space indentation' 1>&2; \
759
@prohibit='^ [ ]{8}' \
760
in_vc_files='akefile|\.mk$$' \
761
halt='found TAB-8-space indentation' \
660
764
sc_m4_quote_check:
661
@grep -nE '(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
662
$$($(VC_LIST_EXCEPT) | grep -E '(^configure\.ac|\.m4)$$') \
663
&& { echo '$(ME): quote the first arg to AC_DEF*' 1>&2; \
765
@prohibit='(AC_DEFINE(_UNQUOTED)?|AC_DEFUN)\([^[]' \
766
in_vc_files='(^configure\.ac|\.m4)$$' \
767
halt='quote the first arg to AC_DEF*' \
666
770
fix_po_file_diag = \
667
771
'you have changed the set of files with translatable diagnostics;\n\
722
827
# Make sure that the copyright date in $(v_etc_file) is up to date.
723
828
# Do the same for the $(sample-test) and the main doc/.texi file.
724
829
sc_copyright_check:
725
@if test -f $(v_etc_file); then \
726
grep 'enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' $(v_etc_file) \
728
|| { echo 'out of date copyright in $(v_etc_file); update it' 1>&2; \
731
@if test -f $(sample-test); then \
732
grep '# Copyright (C) '$$(date +%Y)' Free' $(sample-test) \
734
|| { echo 'out of date copyright in $(sample-test); update it' 1>&2; \
737
@if test -f $(texi); then \
738
grep 'Copyright @copyright{} .*'$$(date +%Y)' Free' $(texi) \
740
|| { echo 'out of date copyright in $(texi); update it' 1>&2; \
830
@require='enum { COPYRIGHT_YEAR = '$$(date +%Y)' };' \
831
in_files=$(v_etc_file) \
832
halt='out of date copyright in $(v_etc_file); update it' \
834
@require='# Copyright \(C\) '$$(date +%Y)' Free' \
835
in_vc_files=$(sample-test) \
836
halt='out of date copyright in $(sample-test); update it' \
838
@require='Copyright @copyright\{\} .*'$$(date +%Y)' Free' \
839
in_vc_files=$(texi) \
840
halt='out of date copyright in $(texi); update it' \
744
843
# #if HAVE_... will evaluate to false for any non numeric string.
745
844
# That would be flagged by using -Wundef, however gnulib currently
746
845
# tests many undefined macros, and so we can't enable that option.
747
846
# So at least preclude common boolean strings as macro values.
748
847
sc_Wundef_boolean:
749
@grep -Ei '^#define.*(yes|no|true|false)$$' '$(CONFIG_INCLUDE)' && \
750
{ echo 'Use 0 or 1 for macro values' 1>&2; exit 1; } || :
848
@prohibit='^#define.*(yes|no|true|false)$$' \
849
in_files='$(CONFIG_INCLUDE)' \
850
halt='Use 0 or 1 for macro values' \
752
853
sc_vulnerable_makefile_CVE-2009-4029:
753
@files=$$(find $(srcdir) -name Makefile.in); \
754
if test -n "$$files"; then \
756
'perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \
758
{ echo '$(ME): the above files are vulnerable; beware of' \
759
'running "make dist*" rules, and upgrade to fixed automake' \
760
'see http://bugzilla.redhat.com/542609 for details' \
761
1>&2; exit 1; } || :; \
854
@prohibit='perm -777 -exec chmod a\+rwx|chmod 777 \$$\(distdir\)' \
855
in_files=$$(find $(srcdir) -name Makefile.in) \
856
halt='the above files are vulnerable; beware of running\n'\
857
'"make dist*" rules, and upgrade to fixed automake\n'\
858
'see http://bugzilla.redhat.com/542609 for details' \
766
862
(unset CDPATH; cd $(srcdir) && $(VC) diff) > vc-diffs || :