Reimar Döffinger wrote on Tue, 22 May 2012 20:06:38 +0200:

> On Tue, May 22, 2012 at 11:11:13AM +0200, Ingo Brückl wrote:
>> Reimar Döffinger wrote on Tue, 22 May 2012 09:14:02 +0200:
>>
>> > If someone has a good idea for testing all these headers without having
>> > to compile for each language it might be worth implementing it.
>>
>> Here you go.

> I don't think that actually detects that issue.

It does.

> The problem is that you'd actually have to use all the defines in a
> context that only allows strings to check them properly.

I have no clue how to easily check the formats of the defines (if that is
what you mean), but we can at least check for a string itself (which already
detected a few errors).

Ingo
Index: Makefile
===================================================================
--- Makefile	(revision 34962)
+++ Makefile	(working copy)
@@ -766,8 +766,10 @@
 
 ###### generic rules #######
 
-all: $(ALL_PRG-yes)
+export CC
 
+all: help/help_checked $(ALL_PRG-yes)
+
 %.o: %.S
 	$(CC) $(CC_DEPFLAGS) $(CFLAGS) -c -o $@ $<
 
@@ -811,6 +813,9 @@
 	@echo "####### Please run ./configure again - it's changed! #######"
 	@echo "############################################################"
 
+help/help_checked: help/help_mp*.h
+	help/help_check.sh $?
+
 help_mp.h: help/help_mp-en.h $(HELP_FILE)
 	help/help_create.sh $(HELP_FILE) $(CHARSET)
 
@@ -971,6 +976,7 @@
 	-rm -f $(call ADD_ALL_DIRS,/*.o /*.a /*.ho /*~)
 	-rm -f $(call ADD_ALL_EXESUFS,mplayer mencoder)
 	-rm -rf DOCS/tech/doxygen DOCS/HTML
+	-rm -f help/help_checked
 
 distclean: clean testsclean toolsclean driversclean dhahelperclean
 	-$(MAKE) -C ffmpeg $@
@@ -979,6 +985,7 @@
 	-rm -f config.* codecs.conf.h help_mp.h version.h TAGS tags
 	-rm -f $(VIDIX_PCI_FILES)
 	-rm -f $(call ADD_ALL_EXESUFS,codec-cfg cpuinfo)
+	-rm -f help/help_checked
 
 doxygen:
 	doxygen DOCS/tech/Doxyfile

Property changes on: help
___________________________________________________________________
Added: svn:ignore
   + help_checked


Index: help/help_check.sh
===================================================================
--- help/help_check.sh	(revision 0)
+++ help/help_check.sh	(revision 0)
@@ -0,0 +1,25 @@
+#!/bin/sh
+# Check help message header files.
+
+RC=1
+CHECK=help_check
+
+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:^#define \([0-9A-Za-z_]\+\) .*:strcmp(\1, \1);:p" "$h" >> ${CHECK}.c
+  echo "}" >> ${CHECK}.c
+  $CC -Werror -c ${CHECK}.c
+  RC=$?
+  rm -f ${CHECK}.c ${CHECK}.o
+  test $RC -ne 0 && break
+done
+
+test $RC -eq 0 && touch help/help_checked
+
+exit $RC

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