3rd attempt.

Reimar Döffinger wrote Fri, 25 May 2012 23:07:53 +0200:

>> +  sed -n "s:^#define \([0-9A-Za-z_]\+\) .*:strcmp(\1, \1);:p" "$h" >> 
>> ${CHECK}.c

> I admit I have no idea about what :p means or whether it is
> required by POSIX sed.

It prints the suppressed (by -n) pattern space (which BTW is improved a bit
in this patch).

Ingo
Index: Makefile
===================================================================
--- Makefile	(revision 34969)
+++ Makefile	(working copy)
@@ -811,6 +811,9 @@
 	@echo "####### Please run ./configure again - it's changed! #######"
 	@echo "############################################################"
 
+checkhelp: help/help_mp*.h
+	help/help_check.sh $(CC) $^
+
 help_mp.h: help/help_mp-en.h $(HELP_FILE)
 	help/help_create.sh $(HELP_FILE) $(CHARSET)
 
@@ -1171,7 +1174,7 @@
 -include $(DEP_FILES) $(DRIVER_DEP_FILES) $(TESTS_DEP_FILES) $(TOOLS_DEP_FILES) $(DHAHELPER_DEP_FILES)
 
 .PHONY: all doxygen *install* *tools drivers dhahelper*
-.PHONY: checkheaders *clean tests check_checksums fatetest
+.PHONY: checkheaders *clean tests check_checksums fatetest checkhelp
 .PHONY: doc html-chunked* html-single* xmllint*
 
 # Disable suffix rules.  Most of the builtin rules are suffix rules,
Index: help/help_check.sh
===================================================================
--- help/help_check.sh	(revision 0)
+++ help/help_check.sh	(revision 0)
@@ -0,0 +1,22 @@
+#!/bin/sh
+# Check help message header files.
+
+CHECK=checkhelp
+
+trap "rm -f ${CHECK}.c ${CHECK}.o" EXIT
+
+CC=$1
+shift
+
+for h in "$@"; do
+  cat <<EOF > ${CHECK}.c
+#include <inttypes.h>
+#include <string.h>
+#include "config.h"
+#include "$h"
+void $CHECK () {
+EOF
+  sed -n "s:^[ \t]*#define[ \t]\+\([0-9A-Za-z_]\+\)[ \t].*:strdup(\1);:p" "$h" >> ${CHECK}.c
+  echo "}" >> ${CHECK}.c
+  $CC -Werror -c -o ${CHECK}.o ${CHECK}.c || exit
+done

Property changes on: help/help_check.sh
___________________________________________________________________
Added: svn:executable
   + *

_______________________________________________
MPlayer-DOCS mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/mplayer-docs

Reply via email to