Discussion:
crypto/*: verify that the header file is self-contained
Add Reply
Bruno Haible
2017-10-29 08:38:14 UTC
Reply
Permalink
Raw Message
This patch verifies that the header files don't accidentally require
<stdio.h> or <string.h>.


2017-10-29 Bruno Haible <***@clisp.org>

crypto/*: Verify that the header file is self-contained.
* tests/test-gc-*.c: Include the module's header file immediately after
<config.h>.
* tests/test-hmac-*.c: Likewise.
* tests/test-arcfour.c: Likewise.
* tests/test-arctwo.c: Likewise.
* tests/test-des.c: Likewise.
* tests/test-md2.c: Likewise.
* tests/test-md4.c: Likewise.
* tests/test-md5.c: Likewise.
* tests/test-rijndael.c: Likewise.
* tests/test-sha1.c: Likewise.
* tests/test-sm3.c: Likewise.

diff --git a/tests/test-arcfour.c b/tests/test-arcfour.c
index 75f979d..101094a 100644
--- a/tests/test-arcfour.c
+++ b/tests/test-arcfour.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "arcfour.h"
+
#include <stdio.h>
#include <string.h>
-#include "arcfour.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-arctwo.c b/tests/test-arctwo.c
index d01ce3a..376ec86 100644
--- a/tests/test-arctwo.c
+++ b/tests/test-arctwo.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "arctwo.h"
+
#include <stdio.h>
#include <string.h>
-#include "arctwo.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-des.c b/tests/test-des.c
index 4fe2958..666e466 100644
--- a/tests/test-des.c
+++ b/tests/test-des.c
@@ -19,11 +19,11 @@

#include <config.h>

+#include "des.h"
+
#include <stdio.h>
#include <string.h>

-#include "des.h"
-
int
main (int argc, char *argv[])
{
diff --git a/tests/test-gc-arcfour.c b/tests/test-gc-arcfour.c
index 75a5712..0900a2d 100644
--- a/tests/test-gc-arcfour.c
+++ b/tests/test-gc-arcfour.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-arctwo.c b/tests/test-gc-arctwo.c
index f41d107..9ad27e1 100644
--- a/tests/test-gc-arctwo.c
+++ b/tests/test-gc-arctwo.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-des.c b/tests/test-gc-des.c
index 9c49f93..f6d302c 100644
--- a/tests/test-gc-des.c
+++ b/tests/test-gc-des.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-hmac-md5.c b/tests/test-gc-hmac-md5.c
index 5b03713..71b0cde 100644
--- a/tests/test-gc-hmac-md5.c
+++ b/tests/test-gc-hmac-md5.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-hmac-sha1.c b/tests/test-gc-hmac-sha1.c
index 16e0d10..a4a47cc 100644
--- a/tests/test-gc-hmac-sha1.c
+++ b/tests/test-gc-hmac-sha1.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-hmac-sha256.c b/tests/test-gc-hmac-sha256.c
index e61c50e..86d9f64 100644
--- a/tests/test-gc-hmac-sha256.c
+++ b/tests/test-gc-hmac-sha256.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-hmac-sha512.c b/tests/test-gc-hmac-sha512.c
index 5121233..97624f3 100644
--- a/tests/test-gc-hmac-sha512.c
+++ b/tests/test-gc-hmac-sha512.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-md2.c b/tests/test-gc-md2.c
index 3dd9c3d..9b9f9a1 100644
--- a/tests/test-gc-md2.c
+++ b/tests/test-gc-md2.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-md4.c b/tests/test-gc-md4.c
index 5830b30..51bd8a3 100644
--- a/tests/test-gc-md4.c
+++ b/tests/test-gc-md4.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-md5.c b/tests/test-gc-md5.c
index ca277af..66ac94b 100644
--- a/tests/test-gc-md5.c
+++ b/tests/test-gc-md5.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-rijndael.c b/tests/test-gc-rijndael.c
index dc60513..2c1796e 100644
--- a/tests/test-gc-rijndael.c
+++ b/tests/test-gc-rijndael.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-sha1.c b/tests/test-gc-sha1.c
index 75c0e02..2b5b615 100644
--- a/tests/test-gc-sha1.c
+++ b/tests/test-gc-sha1.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc-sm3.c b/tests/test-gc-sm3.c
index 608725d..9252224 100644
--- a/tests/test-gc-sm3.c
+++ b/tests/test-gc-sm3.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-gc.c b/tests/test-gc.c
index e679a88..000ba01 100644
--- a/tests/test-gc.c
+++ b/tests/test-gc.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "gc.h"
+
#include <stdio.h>
#include <string.h>
-#include "gc.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-hmac-md5.c b/tests/test-hmac-md5.c
index 246fcd4..55f2c7e 100644
--- a/tests/test-hmac-md5.c
+++ b/tests/test-hmac-md5.c
@@ -18,9 +18,10 @@

#include <config.h>

+#include "hmac.h"
+
#include <stdio.h>
#include <string.h>
-#include "hmac.h"

/* Test vectors from RFC 2104. */

diff --git a/tests/test-hmac-sha1.c b/tests/test-hmac-sha1.c
index 149aa33..a27bea7 100644
--- a/tests/test-hmac-sha1.c
+++ b/tests/test-hmac-sha1.c
@@ -18,9 +18,10 @@

#include <config.h>

+#include "hmac.h"
+
#include <stdio.h>
#include <string.h>
-#include "hmac.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-hmac-sha256.c b/tests/test-hmac-sha256.c
index aeaa7cc..c0ec4fe 100644
--- a/tests/test-hmac-sha256.c
+++ b/tests/test-hmac-sha256.c
@@ -18,9 +18,10 @@

#include <config.h>

+#include "hmac.h"
+
#include <stdio.h>
#include <string.h>
-#include "hmac.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-hmac-sha512.c b/tests/test-hmac-sha512.c
index 88efb4c..c09620d 100644
--- a/tests/test-hmac-sha512.c
+++ b/tests/test-hmac-sha512.c
@@ -18,9 +18,10 @@

#include <config.h>

+#include "hmac.h"
+
#include <stdio.h>
#include <string.h>
-#include "hmac.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-md2.c b/tests/test-md2.c
index 9cdf4db..e874939 100644
--- a/tests/test-md2.c
+++ b/tests/test-md2.c
@@ -18,11 +18,11 @@

#include <config.h>

+#include "md2.h"
+
#include <stdio.h>
#include <string.h>

-#include "md2.h"
-
int
main (int argc, char *argv[])
{
diff --git a/tests/test-md4.c b/tests/test-md4.c
index 67d1ed2..d078720 100644
--- a/tests/test-md4.c
+++ b/tests/test-md4.c
@@ -19,11 +19,11 @@

#include <config.h>

+#include "md4.h"
+
#include <stdio.h>
#include <string.h>

-#include "md4.h"
-
int
main (int argc, char *argv[])
{
diff --git a/tests/test-md5.c b/tests/test-md5.c
index 19bb6a3..9d2d697 100644
--- a/tests/test-md5.c
+++ b/tests/test-md5.c
@@ -19,11 +19,11 @@

#include <config.h>

+#include "md5.h"
+
#include <stdio.h>
#include <string.h>

-#include "md5.h"
-
int
main (void)
{
diff --git a/tests/test-rijndael.c b/tests/test-rijndael.c
index 4f64927..cd95533 100644
--- a/tests/test-rijndael.c
+++ b/tests/test-rijndael.c
@@ -17,9 +17,10 @@

#include <config.h>

+#include "rijndael-api-fst.h"
+
#include <stdio.h>
#include <string.h>
-#include "rijndael-api-fst.h"

int
main (int argc, char *argv[])
diff --git a/tests/test-sha1.c b/tests/test-sha1.c
index 6f10482..4e7b352 100644
--- a/tests/test-sha1.c
+++ b/tests/test-sha1.c
@@ -17,11 +17,11 @@

#include <config.h>

+#include "sha1.h"
+
#include <stdio.h>
#include <string.h>

-#include "sha1.h"
-
int
main (void)
{
diff --git a/tests/test-sm3.c b/tests/test-sm3.c
index 99c1945..179d72b 100644
--- a/tests/test-sm3.c
+++ b/tests/test-sm3.c
@@ -17,11 +17,11 @@

#include <config.h>

+#include "sm3.h"
+
#include <stdio.h>
#include <string.h>

-#include "sm3.h"
-
static int
test (const char *in, const char *out)
{

Loading...