cmark

My personal build of CMark ✏️

Commit
4e587e8be5300d80e23ffeec5b11ba3eedf61276
Parent
517174da8618a46f6ac23eb03e29922ce0283634
Author
John MacFarlane <jgm@berkeley.edu>
Date

Added targets to regenerate html_unescape.h and case_fold_switch.inc.

For now these are just in the regular Makefile, not in CMakeLists.txt, since the generated files are in the repo and shouldn't ordinarily be regenerated.

Note that html_unescape.h is a bit different on regeneration, and this removes error messages we were getting with Clang.

Diffstat

2 files changed, 14 insertions, 12 deletions

Status File Name N° Changes Insertions Deletions
Modified Makefile 10 9 1
Modified src/html/html_unescape.h 16 5 11
diff --git a/Makefile b/Makefile
@@ -23,7 +23,7 @@ all: $(BUILDDIR)
 check:
 	@cmake --version > /dev/null || (echo "You need cmake to build this program: http://www.cmake.org/download/" && exit 1)
 
-$(BUILDDIR): check
+$(BUILDDIR): check $(SRCDIR)/html/html_unescape.h $(SRCDIR)/case_fold_switch.inc
 	mkdir -p $(BUILDDIR); \
 	cd $(BUILDDIR); \
 	cmake .. -DCMAKE_BUILD_TYPE=$(BUILD_TYPE)
@@ -66,6 +66,14 @@ clean:
 
 $(PROG): all
 
+# We include html_unescape.h in the repository, so this shouldn't
+# normally need to be generated.
+$(SRCDIR)/html/html_unescape.h: $(SRCDIR)/html/html_unescape.gperf
+	gperf -L ANSI-C -I -t -N find_entity -H hash_entity -K entity -C -l \
+		--null-strings -m5 $< > $@
+
+# We include case_fold_switch.inc in the repository, so this shouldn't
+# normally need to be generated.
 $(SRCDIR)/case_fold_switch.inc: $(DATADIR)/CaseFolding-3.2.0.txt
 	perl mkcasefold.pl < $< > $@
 
diff --git a/src/html/html_unescape.h b/src/html/html_unescape.h
@@ -1,5 +1,5 @@
-/* ANSI-C code produced by gperf version 3.0.4 */
-/* Command-line: gperf -L ANSI-C -I -t -N find_entity -H hash_entity -K entity -C -l --null-strings -m5 src/html/html_unescape.gperf  */
+/* ANSI-C code produced by gperf version 3.0.3 */
+/* Command-line: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/gperf -L ANSI-C -I -t -N find_entity -H hash_entity -K entity -C -l --null-strings -m5 src/html/html_unescape.gperf  */
 /* Computed positions: -k'1-7,10,12,$' */
 
 #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \
@@ -83,7 +83,7 @@ hash_entity (register const char *str, register unsigned int len)
       16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001,
       16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001, 16001
     };
-  register int hval = len;
+  register unsigned int hval = len;
 
   switch (hval)
     {
@@ -121,12 +121,6 @@ hash_entity (register const char *str, register unsigned int len)
   return hval + asso_values[(unsigned char)str[len - 1]];
 }
 
-#ifdef __GNUC__
-__inline
-#if defined __GNUC_STDC_INLINE__ || defined __GNUC_GNU_INLINE__
-__attribute__ ((__gnu_inline__))
-#endif
-#endif
 const struct html_ent *
 find_entity (register const char *str, register unsigned int len)
 {
@@ -9727,9 +9721,9 @@ find_entity (register const char *str, register unsigned int len)
 
   if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)
     {
-      register int key = hash_entity (str, len);
+      unsigned int key = hash_entity (str, len);
 
-      if (key <= MAX_HASH_VALUE && key >= 0)
+      if (key <= MAX_HASH_VALUE)
         if (len == lengthtable[key])
           {
             register const char *s = wordlist[key].entity;