+2022-05-19 Gaius Mulley <gaius.mulley@southwales.ac.uk>
+
+ * gm2-gcc/m2builtins.cc: Corrected comments (specifically
+ those referring to .c files).
+ * gm2-gcc/m2convert.cc: Corrected comments (specifically
+ those referring to .c files).
+ * gm2-gcc/m2expr.cc: Corrected comments (specifically
+ those referring to .c files).
+ * gm2-gcc/m2statement.cc: Corrected comments (specifically
+ those referring to .c files).
+ * gm2-gcc/m2treelib.cc: Corrected comments (specifically
+ those referring to .c files).
+ * gm2-gcc/m2type.cc: Corrected comments (specifically
+ those referring to .c files).
+ * gm2-gcc/rtegraph.cc: Corrected comments (specifically
+ those referring to .c files).
+ * gm2-lang.cc: Corrected comments (specifically
+ those referring to .c files).
+ * plugin/m2rte.cc: Reformatted comments.
+ * lang-options.h: (Removed).
+
2022-05-16 Gaius Mulley <gaius.mulley@southwales.ac.uk>
* plugin/m2rte.cc (alias.h, predict.h, tm.h)
{
if (TREE_CODE (type) == REAL_TYPE)
{
- /* taken from c-family/c-cppbuiltin.c. */
+ /* Taken from c-family/c-cppbuiltin.cc. */
/* The number of decimal digits, q, such that any floating-point
number with q decimal digits can be rounded into a
floating-point number with p radix b digits and back again
REAL_VALUE_TYPE real;
char buf[128];
- /* shamelessly taken from c-cppbuiltin.c:builtin_define_float_constants. */
+ /* Shamelessly taken from c-cppbuiltin.cc:builtin_define_float_constants. */
/* Since, for the supported formats, B is always a power of 2, we
construct the following numbers directly as a hexadecimal constants. */
}
-/* (taken from c-common.c and trimmed for Modula-2)
+/* (Taken from c-common.cc and trimmed for Modula-2)
Checks if expression EXPR of real/integer type cannot be converted to
the real/integer type TYPE. Function returns non-zero when:
return give_warning;
}
-/* (taken from c-common.c and trimmed for Modula-2)
+/* (Taken from c-common.cc and trimmed for Modula-2)
Warns if the conversion of EXPR to TYPE may alter a value. This is a
helper function for warnings_for_convert_and_check. */
}
}
-/* (taken from c-common.c and trimmed for Modula-2)
+/* (Taken from c-common.cc and trimmed for Modula-2)
Produce warnings after a conversion. RESULT is the result of
converting EXPR to TYPE. This is a helper function for
conversion_warning (loc, type, expr);
}
-/* (taken from c-common.c and trimmed for Modula-2)
+/* (Taken from c-common.cc and trimmed for Modula-2)
Convert EXPR to TYPE, warning about conversion problems with
constants. Invoke this function on every expression that is
}
/* build_binary_op is a heavily pruned version of the one found in
- c-typeck.c. The Modula-2 expression rules are much more restricted
+ c-typeck.cc. The Modula-2 expression rules are much more restricted
than C. */
tree
return (m2expr_FoldAndStrip (t) == m2type_GetBooleanFalse ());
}
-/* AreConstantsEqual - maps onto tree.c (tree_int_cst_equal). It
+/* AreConstantsEqual - maps onto tree.cc (tree_int_cst_equal). It
returns TRUE if the value of e1 is the same as e2. */
int
}
/* interpret_integer convert an integer constant into two integer
- constants. Heavily borrowed from gcc/cppexp.c. */
+ constants. Heavily borrowed from gcc/cppexp.cc. */
int
m2expr_interpret_integer (const char *str, unsigned int base,
}
/* interpret_m2_integer convert an integer constant into two integer
- constants. Heavily borrowed from gcc/cppexp.c. Note that this is a
+ constants. Heavily borrowed from gcc/cppexp.cc. Note that this is a
copy of the above code except that it uses `int' rather than
HOST_WIDE_INT to allow gm2 to determine what Modula-2 base type to
use for this constant. */
return m2decl_BuildIntegerConstant (TYPE_PRECISION (type));
}
-/* GetSizeOf taken from c-typeck.c (c_sizeof). */
+/* GetSizeOf taken from c-typeck.cc (c_sizeof). */
tree
m2expr_GetSizeOf (location_t location, tree type)
}
/* BuildPushFunctionContext - pushes the current function context.
- Maps onto push_function_context in ../function.c */
+ Maps onto push_function_context in ../function.cc. */
void
m2statement_BuildPushFunctionContext (void)
}
/* BuildPopFunctionContext - pops the current function context. Maps
- onto pop_function_context in ../function.c */
+ onto pop_function_context in ../function.cc. */
void
m2statement_BuildPopFunctionContext (void)
NULL, label);
}
-/* build_modify_expr - taken from c-typeck.c and heavily pruned.
+/* build_modify_expr - taken from c-typeck.cc and heavily pruned.
Build an assignment expression of lvalue LHS from value RHS. If
LHS_ORIGTYPE is not NULL, it is the original type of LHS, which
return m2block_add_stmt (location, t);
}
-/* taken from gcc/c-semantics.c. */
+/* taken from gcc/c-semantics.cc. */
/* Build a generic statement based on the given type of node and
arguments. Similar to `build_nt', except that we set EXPR_LOCATION
/* finish_build_pointer_type - finish building a POINTER_TYPE node.
necessary to solve self references in procedure types. */
-/* code taken from tree.c:build_pointer_type_for_mode. */
+/* Code taken from tree.cc:build_pointer_type_for_mode. */
static tree
finish_build_pointer_type (tree t, tree to_type, enum machine_mode mode,
declaration. Otherwise it declares the type. In Modula-2 this is
equivalent to:
-TYPE name = type ;
+ TYPE name = type ;
-We need this function as the initialization to gccgm2.c will declare
- C default types and _some_ M2 default types. */
+ We need this function during gm2 initialization as it allows
+ gm2 to access default types before creating Modula-2 types. */
tree
m2type_GetDefaultType (location_t location, char *name, tree type)
Create a fake NULL-named TYPE_DECL node whose TREE_TYPE will be the
tagged type we just added to the current scope. This fake NULL-named
- TYPE_DECL node helps dwarfout.c to know when it needs to output a
+ TYPE_DECL node helps dwarfout.cc to know when it needs to output a
representation of a tagged type, and it also gives us a convenient
place to record the "scope start" address for the tagged type. */
return field;
}
-/* BuildEndRecord - a heavily pruned finish_struct from c-decl.c. It
+/* BuildEndRecord - a heavily pruned finish_struct from c-decl.cc. It
sets the context for each field to, t, propagates isPacked
throughout the fields in the structure. */
struct GTY (()) rtenode
{
- bool constructor_reachable; /* is this guarenteed to be reachable by a constructor? */
- bool export_reachable; /* is this reachable via exported functions? */
- bool exception_routine; /* is this an exception routine? */
- bool constructor_final; /* have we walked this rtenode during constructor testing? */
- bool export_final; /* walked this rtenode during exported testing? */
- bool is_call; /* is this a function call? */
+ bool constructor_reachable; /* Is this guarenteed to be reachable by a constructor? */
+ bool export_reachable; /* Is this reachable via exported functions? */
+ bool exception_routine; /* Is this an exception routine? */
+ bool constructor_final; /* Have we walked this rtenode during constructor testing? */
+ bool export_final; /* Walked this rtenode during exported testing? */
+ bool is_call; /* Is this a function call? */
gimple *grtenode;
tree func;
- rtenode *reachable_src; /* if this is reachable which src function will call us? */
+ rtenode *reachable_src; /* If this is reachable which src function will call us? */
vec<rtenode *, va_gc> *function_call;
vec<rtenode *, va_gc> *rts_call;
}
-/* rtegraph_discover performs the main work, called by m2rte.c analyse_graph.
+/* rtegraph_discover performs the main work, called by m2rte.cc analyse_graph.
It determines which function calls a reachable and then issues any warning
message if a reachable function is a call to a runtime exception handler. */
&& access_string (s1, &scope)
&& access_string (s2, &message))
{
- /* continue to use scope as this will survive any
+ /* Continue to use scope as this will survive any
optimization transforms. */
location_t location = gimple_location (stmt);
rte_error_at (location, kind, "In %s\n%s, %s",
(*rts_call)[i]->propagate_constructor_reachable (src);
}
-/* propagate_export_reachable for every function which is reachable from
- rtenode call the callee rtenode and mark it as reachable from an exported
- function. */
+/* propagate_export_reachable for every function which is reachable
+ from rtenode call the callee rtenode and mark it as reachable from
+ an exported function. */
void rtenode::propagate_export_reachable (rtenode *src)
{
(*rts_call)[i]->propagate_export_reachable (src);
}
-/* rtegraph_init initialize the data structures (vec arrays) in this file. */
+/* rtegraph_init initialize the data structures (vec arrays) in this
+ file. */
void rtegraph_init (void)
{
gm2_gc_root = tree_cons (NULL_TREE, t, gm2_gc_root);
}
-/* Return a decl for the exception personality function. The
- function itself is implemented in libgo/runtime/go-unwind.c. */
+/* Return a decl for the exception personality function. */
static tree
gm2_langhook_eh_personality (void)
+++ /dev/null
-/* Definitions for switches for Modula-2.
-
-Copyright (C) 2001-2022 Free Software Foundation, Inc.
-Contributed by Gaius Mulley <gaius@glam.ac.uk>.
-
-This file is part of GNU Modula-2.
-
-GNU Modula-2 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, or (at your option)
-any later version.
-
-GNU Modula-2 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 GNU Modula-2; see the file COPYING. If not,
-see <https://www.gnu.org/licenses/>. */
-
-#define LINK_COMMAND_SPEC ""
-
-/* These options are used in toplev.cc via the auto-generated options.cc for
- the driver program gm2. */
-
-DEFINE_LANG_NAME ("Modula-2")
-
- { "-I",
- N_("specifies a library path (C syntax)") },
- { "-fiso",
- N_("use ISO dialect of Modula-2") },
- { "-fpim",
- N_("use PIM [234] dialect of Modula-2") },
- { "-fpim2",
- N_("use PIM 2 dialect of Modula-2") },
- { "-fpim3",
- N_("use PIM 3 dialect of Modula-2") },
- { "-fpim4",
- N_("use PIM 4 dialect of Modula-2") },
- { "-fpositive-mod-floor-div",
- N_("force positive result from MOD and DIV result floor") },
- { "-flibs=ulm",
- N_("use the University of Ulm libraries and PIM dialect of Modula-2") },
- { "-flibs=min",
- N_("use a minimal SYSTEM, M2RTS and libc and no other system libraries") },
- { "-flibs=logitech",
- N_("use the Logitech compatible (PIM dialect) set of libraries") },
- { "-flibs=pim-coroutine",
- N_("use the PIM dialect libraries which include coroutine support") },
- { "-fnil",
- N_("turns on runtime checking to detect accessing data through a NIL value pointer") },
- { "-fno-nil",
- N_("turns off runtime checking to detect accessing data through a NIL value pointer") },
- { "-fwholediv",
- N_("generate code to detect whole number division by zero or modulus by zero") },
- { "-fno-wholediv",
- N_("do not generate code to detect whole number division by zero or modulus by zero") },
- { "-findex",
- N_("generate code to check whether array index values are out of bounds") },
- { "-fno-index",
- N_("do not generate code to check whether array index values are out of bounds") },
- { "-frange",
- N_("generate code to check the assignment range, return value range, set range and constructor range") },
- { "-fno-range",
- N_("do not generate code to check the assignment range, return value range, set range and constructor range") },
- { "-freturn",
- N_("turns on runtime checking for functions which finish without executing a RETURN statement") },
- { "-fno-return",
- N_("turns off runtime checking for functions which finish without executing a RETURN statement") },
- { "-fcase",
- N_("turns on runtime checking to check whether a CASE statement requires an ELSE clause when one was not specified") },
- { "-fno-case",
- N_("turns off runtime checking to check whether a CASE statement requires an ELSE clause when on was not specified") },
- { "-fsoft-check-all",
- N_("turns on all runtime checking (an abbreviation for -fnil -frange -findex -fwholediv -fcase -freturn-ffloatvalue)") },
- { "-fno-soft-check-all",
- N_("turns off all runtime checking (an abbreviation for -fno-nil -fno-range -fno-index -fno-wholediv -fno-case -fno-return -fno-floatvalue)") },
- { "-fexceptions",
- N_("turns on all exception generating code (this is on by default)") },
- { "-fno-exceptions",
- N_("turns off all exception generating code, this flag should be used with -flibs=min") },
- { "-fauto-init",
- N_("automatically initializes all pointers to NIL") },
- { "-Wstudents",
- N_("extra compile time semantic checking, typically tries to catch bad style") },
- { "-Wpedantic",
- N_("compiler checks nested WITH statements (referencing same type) and multiple identical imports") },
- { "-Wpedantic-param-names",
- N_("compiler checks to force definition module procedure parameter names with their implementation module counterpart") },
- { "-Wpedantic-cast",
- N_("compiler warns if a cast is being used on types of differing sizes") },
- { "-fextended-opaque",
- N_("allows opaque types to be implemented as any type (a GNU Modula-2 extension)") },
- { "-Wverbose-unbounded",
- N_("inform user which parameters will be passed by reference") },
- { "-Wunused-variable",
- N_("compiler warns if a variable is declared and not used") },
- { "-Wno-unused-variable",
- N_("turns off compiler warning if a variable is declared and not used") },
- { "-Wunused-parameter",
- N_("compiler warns if a parameter is declared and not used") },
- { "-Wno-unused-parameter",
- N_("turns off compiler warning if a parameter is declared and not used") },
- { "-fxcode",
- N_("issue all errors and warnings in the Xcode format") },
- { "-fuselist",
- N_("use ordered list of modules when linking") },
- { "-fmakelist",
- N_("created ordered list of modules") },
- { "-fm2-whole-program",
- N_("compile all implementation and program modules as a single unit") },
- { "-fm2-statistics",
- N_("display statistics about the amount of source lines compiled and symbols used") },
- { "-fm2-g",
- N_("generate extra nops to improve debugging, producing an instruction for every code related keyword") },
- { "-fm2-lower-case",
- N_("generate error messages which render keywords in lower case") },
- { "-fmodules",
- N_("display list of modules and location") },
- { "-fno-pthread",
- N_("do not link against -lpthread") },
- { "-fruntime-modules=",
- N_("specify the list of runtime modules and their initialization order") },
- { "-fclean",
- N_("cleans all the project objects in the current directory using make") },
- { "-fmakeall",
- N_("build a project using make") },
- { "-fmakeall0",
- N_("do not build a project using make (internal)") },
- { "-fmake-I=",
- N_("build project path (internal)") },
- { "-ftarget-ar=",
- N_("full path to target archiver") },
- { "-ftarget-ranlib=",
- N_("full path to target ranlib") },
- { "-fcpp",
- N_("use cpp to preprocess the module") },
- { "-fq",
- N_("debugging information - dump the list of quadruples") },
- { "-fsources",
- N_("display the location of module source files as they are compiled") },
- { "-funbounded-by-reference",
- N_("optimize non var unbounded parameters by passing it by reference, providing it is not written to within the callee procedure.") },
- { "-fdef=",
- N_("recognise the specified suffix as a definition module filename") },
- { "-fmod=",
- N_("recognise the specified suffix as implementation and module filenames") },
- { "-fdump-system-exports",
- N_("display all inbuilt system items") },
- { "-fswig",
- N_("generate a swig interface file") },
- { "-fshared",
- N_("generate a shared library from the module") },
- { "-fmakeinit",
- N_("generate the start up C code for the module, a file _m2_modulename.c is created") },
- { "-fobject-path=",
- N_("set the object path") },
- { "-fonlylink",
- N_("only link the module and do not compile module (internal)"),
- { "--version",
- N_("display the GNU Modula-2 version") },
- { "-fversion",
- N_("display the GNU Modula-2 version") },
- { "-fm2-version",
- N_("display the GNU Modula-2 version") },
- { "-O",
- N_("optimize code") },
- { "-flocation=",
- N_("set all location values to unknown,builtin,integer value (internal debugging)") },
- { "-x",
- N_("specify the language") },
- { "-fdebug-function-line-numbers",
- N_("turn on the Modula-2 function line number generation (internal switch)") },
- { "-ffloatvalue",
- N_("generate code to detect floating point overflow and underflow") },
- { "-fno-floatvalue",
- N_("do not generate code to detect floating point overflow and underflow") },
- { "-fwholevalue",
- N_("generate code to detect whole number overflow and underflow") },
- { "-fno-wholevalue",
- N_("do not generate code to detect whole number overflow and underflow") },
- { "-fm2-plugin",
- N_("insert semantic plugin to detect runtime errors at compile time") },
- { "-fno-m2-plugin",
- N_("do not insert semantic plugin to detect runtime errors at compile time") },
- { "-fsave-temps",
- N_("save temporary files after the preprocessor phase") },
- { "-fsave-temps=",
- N_("save temporary files and place them in the directory specified") },
debug (gsi_stmt (gsi));
#endif
}
- /* we only care about the first basic block in each function.
+ /* We only care about the first basic block in each function.
We could continue to search if this edge falls though (top
of a loop for example) but for now this is cautiously safe.
--fixme-- */
{
struct register_pass_info pass_info;
const char *plugin_name = plugin_info->base_name;
- // return 0; // --fixme-- just testing!
if (!plugin_default_version_check (version, &gcc_version))
{