aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/doc/gm2.texi14
-rw-r--r--gcc/m2/gm2-compiler/M2Options.mod2
-rw-r--r--gcc/m2/gm2-gcc/m2type.cc8
-rw-r--r--gcc/testsuite/gm2/pim/run/pass/printtypesize.mod15
4 files changed, 31 insertions, 8 deletions
diff --git a/gcc/doc/gm2.texi b/gcc/doc/gm2.texi
index 5af8b22..f8ae148 100644
--- a/gcc/doc/gm2.texi
+++ b/gcc/doc/gm2.texi
@@ -502,7 +502,8 @@ the previous forms could be:
@item -fm2-file-offset-bits=
force the type @code{SYSTEM.COFF_T} to be built using the specified
-number of bits. If this option is not used then default is 64 bits.
+number of bits. If this option is not used then default is
+@code{CSSIZE_T} bits.
@item -fm2-g
improve the debugging experience for new programmers at the expense
@@ -2895,10 +2896,13 @@ base module). PIM-2 defined @code{SIZE} in the @code{SYSTEM} module
GNU Modula-2 allows users to specify the dialect of Modula-2 by using
the @code{-fiso} and @code{-fpim2} command line switches.
-The data types @code{CSIZE_T} and @code{CSSIZE_T} are also exported from
-the @code{SYSTEM} module. The type @code{CSIZE_T} is unsigned and is
-mapped onto the target C data type @code{size_t} whereas the type
-@code{CSSIZE_T} is mapped onto the signed C data type @code{ssize_t}.
+The data types @code{CSIZE_T}, @code{CSSIZE_T} and @code{COFF_T} are
+also exported from the @code{SYSTEM} module. The type @code{CSIZE_T}
+is unsigned and is mapped onto the target C data type @code{size_t}
+whereas the type @code{CSSIZE_T} is mapped onto the signed C data type
+@code{ssize_t}. The default size for the signed type @code{COFF_T} is
+the same as @code{CSSIZE_T} and this can be overridden by the
+@code{-fm2-file-offset-bits=} command line option.
It is anticipated that these should only be used to provide cross
platform definition modules for C libraries.
diff --git a/gcc/m2/gm2-compiler/M2Options.mod b/gcc/m2/gm2-compiler/M2Options.mod
index 4c03dfe..39f0b2a 100644
--- a/gcc/m2/gm2-compiler/M2Options.mod
+++ b/gcc/m2/gm2-compiler/M2Options.mod
@@ -2147,5 +2147,5 @@ BEGIN
M2Dump := NIL ;
M2DumpFilter := NIL ;
EnableForward := TRUE ;
- OffTBits := 64 ; (* Default to 64bit OFF_T. *)
+ OffTBits := 0 ; (* Default to CSSIZE_T. *)
END M2Options.
diff --git a/gcc/m2/gm2-gcc/m2type.cc b/gcc/m2/gm2-gcc/m2type.cc
index 9f7a433..a946509 100644
--- a/gcc/m2/gm2-gcc/m2type.cc
+++ b/gcc/m2/gm2-gcc/m2type.cc
@@ -1077,7 +1077,6 @@ build_m2_specific_size_type (location_t location, enum tree_code base,
{
if (!float_mode_for_size (TYPE_PRECISION (c)).exists ())
return NULL;
- layout_type (c);
}
else if (base == SET_TYPE)
return build_m2_size_set_type (location, precision);
@@ -1096,6 +1095,7 @@ build_m2_specific_size_type (location_t location, enum tree_code base,
TYPE_UNSIGNED (c) = true;
}
}
+ layout_type (c);
return c;
}
@@ -1385,8 +1385,12 @@ static tree
build_m2_offt_type_node (location_t location)
{
m2assert_AssertLocation (location);
+ int offt_size = M2Options_GetFileOffsetBits ();
+
+ if (offt_size == 0)
+ offt_size = TREE_INT_CST_LOW (TYPE_SIZE (ssizetype));
return build_m2_specific_size_type (location, INTEGER_TYPE,
- M2Options_GetFileOffsetBits (), true);
+ offt_size, true);
}
/* m2type_InitSystemTypes initialise loc and word derivatives. */
diff --git a/gcc/testsuite/gm2/pim/run/pass/printtypesize.mod b/gcc/testsuite/gm2/pim/run/pass/printtypesize.mod
new file mode 100644
index 0000000..690c4c1
--- /dev/null
+++ b/gcc/testsuite/gm2/pim/run/pass/printtypesize.mod
@@ -0,0 +1,15 @@
+MODULE printtypesize ;
+
+FROM libc IMPORT printf ;
+FROM SYSTEM IMPORT SIZE, CSIZE_T, COFF_T ;
+
+BEGIN
+ printf ("SIZE (CHAR) = %d bytes\n", SIZE (CHAR));
+ printf ("SIZE (INTEGER) = %d bytes\n", SIZE (INTEGER));
+ printf ("SIZE (CARDINAL) = %d bytes\n", SIZE (CARDINAL));
+ printf ("SIZE (BITSET) = %d bytes\n", SIZE (BITSET));
+ printf ("SIZE (LONGINT) = %d bytes\n", SIZE (LONGINT));
+ printf ("SIZE (LONGCARD) = %d bytes\n", SIZE (LONGCARD));
+ printf ("SIZE (CSIZE_T) = %d bytes\n", SIZE (CSIZE_T));
+ printf ("SIZE (COFF_T) = %d bytes\n", SIZE (COFF_T));
+END printtypesize.