From bb1937aaec76471a39babf6efed7019ac12d5b1f Mon Sep 17 00:00:00 2001 From: Mark Andrews Date: Tue, 10 Jul 2018 20:49:40 -0400 Subject: [PATCH] Resolve "run xmllint on *.xml and *.docbook in precheck" --- .gitlab-ci.yml | 2 ++ doc/dev/coding.html | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a27d1475ff..22913988c5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -144,6 +144,8 @@ precheck:debian:sid:amd64: - perl -w util/merge_copyrights - diff -urNap util/copyrights util/newcopyrights - rm util/newcopyrights + - xmllint --noout --nonet `git ls-files '*.xml' '*.docbook'` + - xmllint --noout --nonet --html `git ls-files '*.html'` artifacts: paths: - util/newcopyrights diff --git a/doc/dev/coding.html b/doc/dev/coding.html index cd1a78c75b..60add3dc6b 100644 --- a/doc/dev/coding.html +++ b/doc/dev/coding.html @@ -92,10 +92,10 @@ The following lint and lint-like comments should be used where appropriate: files should prevent multiple inclusion. The OS is assumed to prevent multiple inclusion of its .h files.

.h files that define modules should have a structure like the -following. Note that should be included by any public +following. Note that <isc/lang.h> should be included by any public header file to get the ISC_LANG_BEGINDECLS and ISC_LANG_ENDDECLS macros used so the correct name-mangling happens for function -declarations when C++ programs include the file. should +declarations when C++ programs include the file. <isc/lang.h> should be included for private header files or for public files that do not declare any functions.


@@ -238,7 +238,7 @@ Bad:


 void f(int i)
   {
-    if(i<0){i=0;printf("was negative\n");}
+    if(i<0){i=0;printf("was negative\n");}
     if (i > 0)
       {
         printf("yes\n");
@@ -296,7 +296,7 @@ Good:
 	os_descriptor_t		s;
 	os_result_t		result;
 
-	result = os_socket_create(AF_INET, SOCK_STREAM, 0, &s);
+	result = os_socket_create(AF_INET, SOCK_STREAM, 0, &s);
 	if (result != OS_R_SUCCESS) {
 		/* Do something about the error. */
 		return;
@@ -312,7 +312,7 @@ Not so good:
 	 * point is not to write more interfaces like them.
 	 */
 	s = socket(AF_INET, SOCK_STREAM, 0);
-	if (s < 0) {
+	if (s < 0) {
 		/* Do something about the error using errno. */
 		return;
 	}
@@ -350,26 +350,26 @@ Bit testing should be as follows:

Good:


 	/* Test if flag set. */
-	if ((flags & FOO) != 0) {
+	if ((flags & FOO) != 0) {
 
 	}
 	/* Test if flag clear. */
-	if ((flags & BAR) == 0) {
+	if ((flags & BAR) == 0) {
 
 	}
 	/* Test if both flags set. */
-	if ((flags & (FOO|BAR)) == (FOO|BAR)) {
+	if ((flags & (FOO|BAR)) == (FOO|BAR)) {
 
 	}
 
Bad:

 	/* Test if flag set. */
-	if (flags & FOO) {
+	if (flags & FOO) {
 
 	}
 	/* Test if flag clear. */
-	if (! (flags & BAR)) {
+	if (! (flags & BAR)) {
 
 	}
 
@@ -438,8 +438,8 @@ verboten.

Good:


 	printf("%c is%s a number.\n", c, isdigit(c) ? "" " NOT");
-        l = (l1 < l2) ? l1 : l2;
-        if (gp.length + (go < 16384 ? 2 : 3) >= name->length) {
+        l = (l1 < l2) ? l1 : l2;
+        if (gp.length + (go < 16384 ? 2 : 3) >= name->length) {
            ...
         }
 
@@ -497,7 +497,7 @@ in a file named redblack.c (in lieu of any other dns_redblack_* interfaces in the file).

The one notable exception to this naming rule is the interfaces -provided by . There's a large caveat associated with the +provided by <isc/util.h>. There's a large caveat associated with the public description of this file that it is hazardous to use because it pollutes the general namespace.