summaryrefslogtreecommitdiff
path: root/regress
diff options
context:
space:
mode:
authorrillig <rillig>2007-03-08 14:31:06 +0000
committerrillig <rillig>2007-03-08 14:31:06 +0000
commit9286355bf2a1ca60dc6aa1aec057588a7ed67b74 (patch)
treeebcb6586d53271e08d5cd58945b3967c5574bd15 /regress
parentce1baa211b9e6df439e969c7d5a11725f60a7313 (diff)
downloadpkgsrc-9286355bf2a1ca60dc6aa1aec057588a7ed67b74.tar.gz
Added a testcase for offsetof. Reorganized the rest.
Diffstat (limited to 'regress')
-rw-r--r--regress/compiler/Makefile23
-rw-r--r--regress/compiler/files/Makefile29
-rw-r--r--regress/compiler/files/checklen.c2
-rw-r--r--regress/compiler/files/checktype.c2
-rw-r--r--regress/compiler/files/language.c7
-rw-r--r--regress/compiler/files/offsetof.c9
6 files changed, 54 insertions, 18 deletions
diff --git a/regress/compiler/Makefile b/regress/compiler/Makefile
index 2d0c8a38360..e3cd81452df 100644
--- a/regress/compiler/Makefile
+++ b/regress/compiler/Makefile
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.3 2007/02/22 19:01:24 wiz Exp $
+# $NetBSD: Makefile,v 1.4 2007/03/08 14:31:06 rillig Exp $
#
DISTNAME= compiler-1.1
@@ -11,25 +11,12 @@ COMMENT= Tests whether the pkgsrc compilers work as expected
NO_CHECKSUM= yes
WRKSRC= ${WRKDIR}
-USE_TOOLS+= printf
-
-SRC_CMD= ${PRINTF} '\#if defined(__cplusplus)\nLANG: Cplus\n\#else\nLANG: Cplain\n\#endif\n'
+USE_LANGUAGES= c c++
do-extract:
- cd ${FILESDIR} && cp *.c ${WRKSRC}
+ cd ${FILESDIR} && cp Makefile *.c ${WRKSRC}
+ cd ${WRKSRC} && for i in *.c; do ln $$i $${i}c; done
-do-build:
- # Test whether CPP is a C preprocessor.
- ${SRC_CMD} | cpp -DLANG=Cplain
- # Test whether CXXCPP is a C++ preprocessor.
- # CXXCPP is not (yet)? defined.
- #${SRC_CMD} | cxxcpp -DLANG=Cplus
- # Test whether white-space is preserved in macro definitions.
- cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES=\"\ \ \ \ \" && ./checklen
- cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES=\"" \"" && ./checklen
- cd ${WRKSRC} && cc checklen.c -o checklen -DLEN=4 -DSPACES='" "' && ./checklen
- # Test whether backslashes are preserved in macro definitions.
- cd ${WRKSRC} && cc -c checktype.c -DTYPE="unsigned long"
- cd ${WRKSRC} && cc -c checktype.c -DTYPE=unsigned\ long
+do-wrksrc-build:
.include "../../mk/bsd.pkg.mk"
diff --git a/regress/compiler/files/Makefile b/regress/compiler/files/Makefile
new file mode 100644
index 00000000000..a84217e4e58
--- /dev/null
+++ b/regress/compiler/files/Makefile
@@ -0,0 +1,29 @@
+# $NetBSD: Makefile,v 1.1 2007/03/08 14:31:06 rillig Exp $
+#
+
+all: \
+ test-preprocessor \
+ test-offsetof \
+ test-wrapper
+
+test-preprocessor:
+ # Test whether CPP is a C preprocessor.
+ ${CPP} language.c | grep Cplain
+.if defined(CXXCPP)
+ # Test whether CXXCPP is a C++ preprocessor.
+ ${CXXCPP} language.cc | grep Cplus
+.endif
+
+test-wrapper:
+ # Test whether white-space is preserved in macro definitions.
+ ${CC} checklen.c -o checklen -DLEN=4 -DSPACES=\"\ \ \ \ \" && ./checklen
+ ${CC} checklen.c -o checklen -DLEN=4 -DSPACES=\"" \"" && ./checklen
+ ${CC} checklen.c -o checklen -DLEN=4 -DSPACES='" "' && ./checklen
+ # Test whether backslashes are preserved in macro definitions.
+ ${CC} -c checktype.c -DTYPE="unsigned long"
+ ${CC} -c checktype.c -DTYPE=unsigned\ long
+
+test-offsetof:
+ # Test whether offsetof is available in both C and C++
+ ${CC} -c offsetof.c
+ ${CXX} -c offsetof.c
diff --git a/regress/compiler/files/checklen.c b/regress/compiler/files/checklen.c
index 92b91acafd4..2bc78216a37 100644
--- a/regress/compiler/files/checklen.c
+++ b/regress/compiler/files/checklen.c
@@ -1,3 +1,5 @@
+/* $NetBSD: checklen.c,v 1.2 2007/03/08 14:31:06 rillig Exp $ */
+
#include <assert.h>
#include <string.h>
diff --git a/regress/compiler/files/checktype.c b/regress/compiler/files/checktype.c
index 5c13fc7de61..1d18b908677 100644
--- a/regress/compiler/files/checktype.c
+++ b/regress/compiler/files/checktype.c
@@ -1 +1,3 @@
+/* $NetBSD: checktype.c,v 1.2 2007/03/08 14:31:06 rillig Exp $ */
+
typedef TYPE t;
diff --git a/regress/compiler/files/language.c b/regress/compiler/files/language.c
new file mode 100644
index 00000000000..de171220b78
--- /dev/null
+++ b/regress/compiler/files/language.c
@@ -0,0 +1,7 @@
+/* $NetBSD: language.c,v 1.1 2007/03/08 14:31:07 rillig Exp $ */
+
+#if defined(__cplusplus)
+Cplus
+#else
+Cplain
+#endif
diff --git a/regress/compiler/files/offsetof.c b/regress/compiler/files/offsetof.c
new file mode 100644
index 00000000000..de8ac7f4c75
--- /dev/null
+++ b/regress/compiler/files/offsetof.c
@@ -0,0 +1,9 @@
+/* $NetBSD: offsetof.c,v 1.1 2007/03/08 14:31:07 rillig Exp $ */
+
+#include <stddef.h>
+
+#if !defined(offsetof)
+"force a syntax error" = 1;
+#else
+typedef int dummy;
+#endif