aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaius Mulley <gaiusmod2@gmail.com>2024-04-09 02:35:11 +0100
committerGaius Mulley <gaiusmod2@gmail.com>2024-04-09 02:35:11 +0100
commit600bf396799a022e65938de572ad1a79a951b95a (patch)
treed6a993ca3e967e7a046c295bf7caf469921a5d16
parent45532e3a929d2893b3efd26beefb1162e50cb51b (diff)
downloadgcc-600bf396799a022e65938de572ad1a79a951b95a.zip
gcc-600bf396799a022e65938de572ad1a79a951b95a.tar.gz
gcc-600bf396799a022e65938de572ad1a79a951b95a.tar.bz2
PR modula2/114648 cc1gm2 by default does not handle C pre-processor file and line directives
This patch fixes the default behavior of cc1gm2 to the description in the documentation. By default cc1gm2 will allow C preprocessor directives (they can be turned off via -fno-cpp). gcc/m2/ChangeLog: PR modula2/114648 * gm2-compiler/M2Options.mod (LineDirectives): Initially set to true. gcc/testsuite/ChangeLog: PR modula2/114648 * gm2/cpp/default/pass/AdvParse.def: New test. * gm2/cpp/default/pass/AdvParse.mod: New test. * gm2/cpp/default/pass/cpp-default-pass.exp: New test. Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
-rw-r--r--gcc/m2/gm2-compiler/M2Options.mod2
-rw-r--r--gcc/testsuite/gm2/cpp/default/pass/AdvParse.def5
-rw-r--r--gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod8
-rw-r--r--gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp36
4 files changed, 50 insertions, 1 deletions
diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod
index 09d62cb..d04cded 100644
--- a/gcc/m2/gm2-compiler/M2Options.mod
+++ b/gcc/m2/gm2-compiler/M2Options.mod
@@ -1944,7 +1944,7 @@ BEGIN
ReturnChecking := FALSE ;
CaseElseChecking := FALSE ;
CPreProcessor := FALSE ;
- LineDirectives := FALSE ;
+ LineDirectives := TRUE ;
ExtendedOpaque := FALSE ;
UnboundedByReference := FALSE ;
VerboseUnbounded := FALSE ;
diff --git a/gcc/testsuite/gm2/cpp/default/pass/AdvParse.def b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.def
new file mode 100644
index 0000000..391a803
--- /dev/null
+++ b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.def
@@ -0,0 +1,5 @@
+DEFINITION MODULE AdvParse ;
+
+PROCEDURE foo ;
+
+END AdvParse.
diff --git a/gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod
new file mode 100644
index 0000000..ed3727c
--- /dev/null
+++ b/gcc/testsuite/gm2/cpp/default/pass/AdvParse.mod
@@ -0,0 +1,8 @@
+# 2 "AdvParse.bnf"
+IMPLEMENTATION MODULE AdvParse ;
+
+PROCEDURE foo ;
+BEGIN
+END foo ;
+
+END AdvParse. \ No newline at end of file
diff --git a/gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp b/gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp
new file mode 100644
index 0000000..0b373cf
--- /dev/null
+++ b/gcc/testsuite/gm2/cpp/default/pass/cpp-default-pass.exp
@@ -0,0 +1,36 @@
+# Copyright (C) 2024 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3. If not see
+# <http://www.gnu.org/licenses/>.
+
+# This file was written by Gaius Mulley (gaiusmod2@gmail.com)
+# for GNU Modula-2.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+# load support procs
+load_lib gm2-torture.exp
+
+gm2_init_pim "${srcdir}/gm2/cpp/default/pass/"
+
+foreach testcase [lsort [glob -nocomplain $srcdir/$subdir/*.mod]] {
+ # If we're only testing specific files and this isn't one of them, skip it.
+ if ![runtest_file_p $runtests $testcase] then {
+ continue
+ }
+
+ gm2-torture $testcase
+}