* lib/bugreports.c (explain_how_to_report_bugs): Avoid continued strings by using multi-part strings, one per line. * cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): Add SC rule. --- cfg.mk | 19 +++++++++++++++++++ lib/bugreports.c | 12 ++++++------ 2 files changed, 25 insertions(+), 6 deletions(-)
diff --git a/cfg.mk b/cfg.mk index 1522f7ac..b251270e 100644 --- a/cfg.mk +++ b/cfg.mk @@ -102,6 +102,25 @@ sc_die_EXIT_FAILURE: exit 1; } \ || : +# Exempt the contents of any usage function from the following. +_continued_string_col_1 = \ +s/^usage .*?\n}//ms;/\\\n\w/ and print ("$$ARGV\n"),$$e=1;END{$$e||=0;exit $$e} +# Ding any source file that has a continued string with an alphabetic in the +# first column of the following line. We prohibit them because they usually +# trigger false positives in tools that try to map an arbitrary line number +# to the enclosing function name. Of course, very many strings do precisely +# this, *when they are part of the usage function*. That is why we exempt +# the contents of any function named "usage". +sc_prohibit_continued_string_alpha_in_column_1: + @perl -0777 -ne '$(_continued_string_col_1)' \ + $$($(VC_LIST_EXCEPT) | grep '\.[ch]$$') \ + || { echo '$(ME): continued string with word in first column' \ + 1>&2; exit 1; } || : +# Use this to list offending lines: +# git ls-files |grep '\.[ch]$' | xargs \ +# perl -n -0777 -e 's/^usage.*?\n}//ms;/\\\n\w/ and print "$ARGV\n"' \ +# | xargs grep -A1 '\\$'|grep '\.[ch][:-][_a-zA-Z]' + # Enforce recommended preprocessor indentation style. sc_preprocessor_indentation: @if cppi --version >/dev/null 2>&1; then \ diff --git a/lib/bugreports.c b/lib/bugreports.c index e52e9202..7490a479 100644 --- a/lib/bugreports.c +++ b/lib/bugreports.c @@ -25,12 +25,12 @@ int explain_how_to_report_bugs (FILE *f, const char *program_name) { - return fprintf (f,_("\ -Please see also the documentation at %s.\n\ -You can report (and track progress on fixing) bugs in the \"%s\"\n\ -program via the %s bug-reporting page at\n\ -%s or, if\n\ -you have no web access, by sending email to <%s>.\n"), + return fprintf (f,_("" +"Please see also the documentation at %s.\n" +"You can report (and track progress on fixing) bugs in the \"%s\"\n" +"program via the %s bug-reporting page at\n" +"%s or, if\n" +"you have no web access, by sending email to <%s>.\n"), PACKAGE_URL, program_name, PACKAGE_NAME, -- 2.19.2