This patch corrects the function declaration of a builtin
(using the libname rather than the source name).
gcc/m2/ChangeLog:
PR modula2/115823
* gm2-gcc/m2builtins.cc (define_builtin): Build
the function decl using the libname.
gcc/testsuite/ChangeLog:
PR modula2/115823
* gm2/builtins/run/pass/testisnormal.mod: Change to an
implementation module.
* gm2/builtins/run/pass/testisnormal.def: New test.
* gm2/builtins/run/pass/testsinl.def: New test.
* gm2/builtins/run/pass/testsinl.mod: New test.
Signed-off-by: Gaius Mulley <gaiusmod2@gmail.com>
tree decl;
builtin_macro_definition bmd;
- decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL, get_identifier (name),
- prototype);
+ decl = build_decl (BUILTINS_LOCATION, FUNCTION_DECL,
+ get_identifier (libname), prototype);
DECL_EXTERNAL (decl) = 1;
TREE_PUBLIC (decl) = 1;
SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
--- /dev/null
+DEFINITION MODULE testisnormal ;
+
+PROCEDURE test ;
+
+END testisnormal.
-MODULE testisnormal ;
+IMPLEMENTATION MODULE testisnormal ;
FROM libc IMPORT printf, exit ;
FROM Builtins IMPORT isnormal ;
--- /dev/null
+DEFINITION MODULE testsinl ;
+
+PROCEDURE test ;
+
+END testsinl.
--- /dev/null
+IMPLEMENTATION MODULE testsinl ;
+
+FROM libc IMPORT printf ;
+FROM Builtins IMPORT sinl ;
+
+
+(*
+ test -
+*)
+
+PROCEDURE test ;
+VAR
+ result: LONGREAL ;
+BEGIN
+ result := sinl (3.14) ;
+ printf ("sinl (3.14) = %lg\n", result) ;
+END test ;
+
+
+BEGIN
+ test ;
+ printf ("all tests pass\n")
+END testsinl.