https://gitlab.gnome.org/GNOME/gtk-doc/-/merge_requests/72 From d20e5befb071e79ee0f23a0a7a1b28cb0755caac Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 18 Apr 2023 12:05:08 +0200 Subject: [PATCH] gtkdocize: don't backslash escape regular characters in grep Grep 3.8 warns about wrongly escaped characters: $ echo | grep '\,' grep: warning: stray \ before , $ echo | grep '\ ' grep: warning: stray \ before white space $ echo | grep ' \-' grep: warning: stray \ before - Note that a '\-' as first character is OK, to not interpret the pattern as command line argument: $ echo | grep '\--Wall' https://gitlab.gnome.org/GNOME/gtk-doc/-/issues/146 --- buildsystems/autotools/gtk-doc.make | 14 +++++++------- buildsystems/autotools/gtk-doc.no-xslt.make | 10 +++++----- buildsystems/autotools/gtkdocize.in | 6 +++--- tests/gtk-doc.make | 4 ++-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/buildsystems/autotools/gtk-doc.make b/buildsystems/autotools/gtk-doc.make index c673175..fb2e7e2 100644 --- a/buildsystems/autotools/gtk-doc.make +++ b/buildsystems/autotools/gtk-doc.make @@ -136,7 +136,7 @@ scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB) gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ scanobj_options=""; \ - gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\--verbose"; \ if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ scanobj_options="--verbose"; \ @@ -198,13 +198,13 @@ GTK_DOC_V_XREF_0=@echo " DOC Fixing cross-references"; html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files) $(GTK_DOC_V_HTML)rm -rf html && mkdir html && \ mkhtml_options=""; \ - gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\--verbose"; \ if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ mkhtml_options="$$mkhtml_options --verbose"; \ fi; \ fi; \ - gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\-\-path"; \ + gtkdoc-mkhtml 2>&1 --help | grep >/dev/null "\--path"; \ if test "$$?" = "0"; then \ mkhtml_options="$$mkhtml_options --path=\"$(abs_srcdir)\""; \ fi; \ @@ -227,7 +227,7 @@ GTK_DOC_V_PDF_0=@echo " DOC Building PDF"; pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files) $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \ mkpdf_options=""; \ - gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\--verbose"; \ if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ mkpdf_options="$$mkpdf_options --verbose"; \ @@ -236,7 +236,7 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_cont if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ - echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ + echo $$mkpdf_options | grep >/dev/null "\--imgdir=$$part "; \ if test $$? != 0; then \ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ @@ -250,10 +250,10 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_cont clean-local: @rm -f *~ *.bak @rm -rf .libs - @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \ + @if echo $(SCAN_OPTIONS) | grep -q "\--rebuild-types" ; then \ rm -f $(DOC_MODULE).types; \ fi - @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \ + @if echo $(SCAN_OPTIONS) | grep -q "\--rebuild-sections" ; then \ rm -f $(DOC_MODULE)-sections.txt; \ fi diff --git a/buildsystems/autotools/gtk-doc.no-xslt.make b/buildsystems/autotools/gtk-doc.no-xslt.make index 1acee5e..5a4b895 100644 --- a/buildsystems/autotools/gtk-doc.no-xslt.make +++ b/buildsystems/autotools/gtk-doc.no-xslt.make @@ -136,7 +136,7 @@ scan-build.stamp: setup-build.stamp $(HFILE_GLOB) $(CFILE_GLOB) gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) $(GTK_DOC_V_INTROSPECT)if grep -l '^..*$$' $(DOC_MODULE).types > /dev/null 2>&1 ; then \ scanobj_options=""; \ - gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + gtkdoc-scangobj 2>&1 --help | grep >/dev/null "\--verbose"; \ if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ scanobj_options="--verbose"; \ @@ -215,7 +215,7 @@ GTK_DOC_V_PDF_0=@echo " DOC Building PDF"; pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_content_files) $(GTK_DOC_V_PDF)rm -f $(DOC_MODULE).pdf && \ mkpdf_options=""; \ - gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\-\-verbose"; \ + gtkdoc-mkpdf 2>&1 --help | grep >/dev/null "\--verbose"; \ if test "$$?" = "0"; then \ if test "x$(V)" = "x1"; then \ mkpdf_options="$$mkpdf_options --verbose"; \ @@ -224,7 +224,7 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_cont if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ - echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ + echo $$mkpdf_options | grep >/dev/null "\--imgdir=$$part "; \ if test $$? != 0; then \ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ @@ -238,10 +238,10 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) $(expand_cont clean-local: @rm -f *~ *.bak @rm -rf .libs - @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \ + @if echo $(SCAN_OPTIONS) | grep -q "\--rebuild-types" ; then \ rm -f $(DOC_MODULE).types; \ fi - @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-sections" ; then \ + @if echo $(SCAN_OPTIONS) | grep -q "\--rebuild-sections" ; then \ rm -f $(DOC_MODULE)-sections.txt; \ fi diff --git a/buildsystems/autotools/gtkdocize.in b/buildsystems/autotools/gtkdocize.in index 83127bf..bf21563 100755 --- a/buildsystems/autotools/gtkdocize.in +++ b/buildsystems/autotools/gtkdocize.in @@ -57,9 +57,9 @@ if test $no_configure_found -eq 0; then macro=`grep '^GTK_DOC_CHECK' $configure 2>/dev/null` if test $? -eq 0; then # GTK_DOC_CHECK([1.14],[--flavour no-tmpl]) - params=`echo $macro | sed -e 's/^GTK_DOC_CHECK(\ *\(.*\)).*$/\1/'` - if echo $params | grep -q '^.*\,\ *\[\{0,1\}'; then - extra_options=`echo $params | sed -e 's/^.*\,\ *\[\{0,1\}\([^]]*\)\]\{0,1\}\ *$/\1/'` + params=`echo $macro | sed -e 's/^GTK_DOC_CHECK( *\(.*\)).*$/\1/'` + if echo $params | grep -q '^.*, *\[\{0,1\}'; then + extra_options=`echo $params | sed -e 's/^.*, *\[\{0,1\}\([^]]*\)\]\{0,1\} *$/\1/'` #echo >&2 "DEBUG: adding extra options [$extra_options] to [$*]" set - $* $GTKDOCIZE_FLAGS $extra_options else diff --git a/tests/gtk-doc.make b/tests/gtk-doc.make index 9235874..60d9853 100644 --- a/tests/gtk-doc.make +++ b/tests/gtk-doc.make @@ -196,7 +196,7 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) if test "x$(HTML_IMAGES)" != "x"; then \ for img in $(HTML_IMAGES); do \ part=`dirname $$img`; \ - echo $$mkpdf_options | grep >/dev/null "\-\-imgdir=$$part "; \ + echo $$mkpdf_options | grep >/dev/null "\--imgdir=$$part "; \ if test $$? != 0; then \ mkpdf_options="$$mkpdf_options --imgdir=$$part"; \ fi; \ @@ -213,7 +213,7 @@ pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) clean-local: @rm -f *~ *.bak ts gtkdoc-*.log @rm -rf .libs - @if echo $(SCAN_OPTIONS) | grep -q "\-\-rebuild-types" ; then \ + @if echo $(SCAN_OPTIONS) | grep -q "\--rebuild-types" ; then \ rm -f $(DOC_MODULE).types; \ fi $(MAKE) distclean-local -- 2.39.3