[m-dev.] for review: ANSI C fixes for none.x grades
Peter Ross
petdr at cs.mu.OZ.AU
Thu Nov 25 01:47:28 AEDT 1999
Hi,
For Fergus to review.
===================================================================
Estimated hours taken: 24
Ensure that the none.gc and none grades compile using a compiler
other than gcc. This is not completely tested as lcc on linux can't
generate code for boehm_gc, and 'cc -std1' on the alpha runs out of
memory while trying to link the compiler. However the compiler does
bootstrap using just gcc and also with lcc with boehm_gc compiled by
gcc.
configure.in:
-Wl,opt1,opt2 syntax is not supported by lcc instead use -Wlopt1
-Wopt2.
compiler/export.m:
Remove a duplicate label definition.
library/io.m:
compiler/stack_layout.m:
Replace escape sequence \x with \\x in pragma c code.
library/array.m:
library/std_util.m:
Define what the struct is before using so the correct size for the
struct can be calculated.
library/private_builtin.m:
Replace escape sequence \x with \\x in pragma c code.
Ensure that there is at least one local variable so that the
structure definition for holding the local vars contains something.
runtime/mercury_faultaddr.h:
Remove an unnecessary cast.
runtime/mercury_reg_workarounds.h:
#include sys/time.h for FD_ZERO().
runtime/mercury_stack_trace.h:
Remove an extraneous ',' which was causing warnings.
Index: configure.in
===================================================================
RCS file: /home/staff/zs/imp/mercury/configure.in,v
retrieving revision 1.193
diff -u -r1.193 configure.in
--- configure.in 1999/11/24 04:04:07 1.193
+++ configure.in 1999/11/24 07:14:18
@@ -1841,10 +1841,10 @@
LINK_SHARED_OBJ="$CC -shared"
LINK_SHARED_OBJ_SH="$CC -shared"
SHARED_LIBS='`gcc -print-libgcc-file-name` -lm -lc'
-EXE_RPATH_OPT="-Wl,-rpath,"
-EXE_RPATH_SEP=" -Wl,-rpath,"
-SHLIB_RPATH_OPT="-Wl,-rpath,"
-SHLIB_RPATH_SEP=" -Wl,-rpath,"
+EXE_RPATH_OPT="-Wl-rpath,"
+EXE_RPATH_SEP=" -Wl-rpath,"
+SHLIB_RPATH_OPT="-Wl-rpath,"
+SHLIB_RPATH_SEP=" -Wl-rpath,"
CFLAGS_FOR_PIC="-fpic -DPIC"
EXT_FOR_PIC_OBJECTS=pic_o
EXT_FOR_SHARED_LIB=a
@@ -1880,7 +1880,7 @@
SHARED_LIBS="-lm -lc" # don't link in libgcc.a
LINK_SHARED_OBJ="$CC -G"
LINK_SHARED_OBJ_SH="$CC -G"
- ERROR_UNDEFINED="-Wl,-z,defs"
+ ERROR_UNDEFINED="-Wl-z -Wldefs"
EXE_RPATH_OPT="-R"
EXE_RPATH_SEP=" -R"
SHLIB_RPATH_OPT="-R"
@@ -1920,14 +1920,14 @@
;;
alpha-dec-osf*)
AC_MSG_RESULT(yes)
- LINK_SHARED_OBJ='gcc -shared \
- -Wl,-O3,-update_registry,$(SO_LOCATIONS_DIR)so_locations'
- LINK_SHARED_OBJ_SH='gcc -shared \
- -Wl,-O3,-update_registry,${SO_LOCATIONS_DIR}so_locations'
- ERROR_UNDEFINED="-Wl,-error_unresolved"
- EXE_RPATH_OPT="-Wl,-rpath,"
+ LINK_SHARED_OBJ="gcc -shared \
+ -Wl-O3 -Wl-update_registry -Wl$(SO_LOCATIONS_DIR)so_locations"
+ LINK_SHARED_OBJ_SH="gcc -shared \
+ -Wl-O3 -Wl-update_registry -Wl$(SO_LOCATIONS_DIR)so_locations"
+ ERROR_UNDEFINED="-Wl-error_unresolved"
+ EXE_RPATH_OPT="-Wl-rpath,"
EXE_RPATH_SEP=":"
- SHLIB_RPATH_OPT="-Wl,-rpath,"
+ SHLIB_RPATH_OPT="-Wl-rpath,"
SHLIB_RPATH_SEP=":"
EXT_FOR_SHARED_LIB=so
# -fpic not needed on Alpha/OSF, since it is the default
@@ -1942,7 +1942,7 @@
-update_registry ${SO_LOCATIONS_DIR}so_locations \
-quickstart_info -rdata_shared'
ERROR_UNDEFINED="-no_unresolved"
- EXE_RPATH_OPT="-Wl,-rpath,"
+ EXE_RPATH_OPT="-Wl-rpath,"
EXE_RPATH_SEP=":"
SHLIB_RPATH_OPT="-rpath "
SHLIB_RPATH_SEP=":"
Index: compiler/export.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/export.m,v
retrieving revision 1.29
diff -u -r1.29 export.m
--- export.m 1999/11/15 02:04:14 1.29
+++ export.m 1999/11/24 14:37:33
@@ -134,7 +134,6 @@
% /* by the C function call MR_call_engine(). */
% save_transient_registers();
% {
- % Declare_entry(<label of called proc>);
% (void) MR_call_engine(ENTRY(<label of called proc>), FALSE);
% }
% /* restore the registers which may have been */
@@ -164,7 +163,7 @@
export__to_c(_Preds, [], _Module, []).
export__to_c(Preds, [E|ExportedProcs], Module, ExportedProcsCode) :-
E = pragma_exported_proc(PredId, ProcId, C_Function),
- get_export_info(Preds, PredId, ProcId, Exported,
+ get_export_info(Preds, PredId, ProcId, _Exported,
C_RetType, MaybeDeclareRetval, MaybeFail, MaybeSucceed,
ArgInfoTypes),
get_argument_declarations(ArgInfoTypes, yes, ArgDecls),
@@ -177,12 +176,6 @@
code_util__make_proc_label(Module, PredId, ProcId, ProcLabel),
llds_out__get_proc_label(ProcLabel, yes, ProcLabelString),
- ( Exported = yes ->
- DeclareString = "Declare_entry"
- ;
- DeclareString = "Declare_static"
- ),
-
string__append_list([ "\n",
C_RetType, "\n",
C_Function, "(", ArgDecls, ")\n{\n",
@@ -195,9 +188,7 @@
"\trestore_registers();\n",
InputArgs,
"\tsave_transient_registers();\n",
- "\t{\n\t", DeclareString, "(",
- ProcLabelString,
- ");\n",
+ "\t{\n\t",
"\t(void) MR_call_engine(ENTRY(",
ProcLabelString,
"), FALSE);\n\t}\n",
Index: compiler/stack_layout.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/compiler/stack_layout.m,v
retrieving revision 1.38
diff -u -r1.38 stack_layout.m
--- stack_layout.m 1999/11/15 10:16:50 1.38
+++ stack_layout.m 1999/11/23 03:24:30
@@ -356,8 +356,8 @@
if (cur_offset != ArenaSize) {
char msg[256];
- sprintf(msg, ""internal error in creating string table;\n""
- ""cur_offset = %ld, ArenaSize = %ld\n"",
+ sprintf(msg, ""internal error in creating string table;\\n""
+ ""cur_offset = %ld, ArenaSize = %ld\\n"",
(long) cur_offset, (long) ArenaSize);
fatal_error(msg);
}
Index: library/array.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/array.m,v
retrieving revision 1.65
diff -u -r1.65 array.m
--- array.m 1999/11/15 10:12:02 1.65
+++ array.m 1999/11/23 03:24:30
@@ -276,11 +276,20 @@
Define_extern_entry(mercury____Compare___array__array_1_0);
MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_array__type_ctor_functors_array_1_struct
- mercury_data_array__type_ctor_functors_array_1;
+const struct mercury_data_array__type_ctor_layout_array_1_struct {
+ TYPE_LAYOUT_FIELDS
+} mercury_data_array__type_ctor_layout_array_1 = {
+ make_typelayout_for_all_tags(TYPE_CTOR_LAYOUT_CONST_TAG,
+ MR_mkbody(MR_TYPE_CTOR_LAYOUT_ARRAY_VALUE))
+};
+
MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_array__type_ctor_layout_array_1_struct
- mercury_data_array__type_ctor_layout_array_1;
+const struct mercury_data_array__type_ctor_functors_array_1_struct {
+ Integer f1;
+} mercury_data_array__type_ctor_functors_array_1 = {
+ MR_TYPE_CTOR_FUNCTORS_SPECIAL
+};
+
MR_STATIC_CODE_CONST struct MR_TypeCtorInfo_struct
mercury_data_array__type_ctor_info_array_1 = {
(Integer) 1,
@@ -295,20 +304,6 @@
MR_RTTI_VERSION
};
-MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_array__type_ctor_layout_array_1_struct {
- TYPE_LAYOUT_FIELDS
-} mercury_data_array__type_ctor_layout_array_1 = {
- make_typelayout_for_all_tags(TYPE_CTOR_LAYOUT_CONST_TAG,
- MR_mkbody(MR_TYPE_CTOR_LAYOUT_ARRAY_VALUE))
-};
-
-MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_array__type_ctor_functors_array_1_struct {
- Integer f1;
-} mercury_data_array__type_ctor_functors_array_1 = {
- MR_TYPE_CTOR_FUNCTORS_SPECIAL
-};
Declare_entry(mercury__array__array_equal_2_0);
Declare_entry(mercury__array__array_compare_3_0);
Index: library/io.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/io.m,v
retrieving revision 1.189
diff -u -r1.189 io.m
--- io.m 1999/11/22 04:25:56 1.189
+++ io.m 1999/11/23 03:24:31
@@ -2658,13 +2658,13 @@
mercury_stdin_binary.file = fdopen(fileno(stdin), ""rb"");
if (mercury_stdin_binary.file == NULL) {
fatal_error(""error opening standard input stream in ""
- ""binary mode:\n\tfdopen() failed: %s"",
+ ""binary mode:\\n\\tfdopen() failed: %s"",
strerror(errno));
}
mercury_stdout_binary.file = fdopen(fileno(stdout), ""wb"");
if (mercury_stdout_binary.file == NULL) {
fatal_error(""error opening standard output stream in ""
- ""binary mode:\n\tfdopen() failed: %s"",
+ ""binary mode:\\n\\tfdopen() failed: %s"",
strerror(errno));
}
#else
Index: library/private_builtin.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/private_builtin.m,v
retrieving revision 1.33
diff -u -r1.33 private_builtin.m
--- private_builtin.m 1999/11/15 10:12:10 1.33
+++ private_builtin.m 1999/11/23 03:40:39
@@ -868,7 +868,7 @@
table_allocate_bytes(sizeof(MR_Subgoal));
#ifdef MR_TABLE_DEBUG
if (MR_tabledebug) {
- printf(""setting up table %p -> %p\n"",
+ printf(""setting up table %p -> %p\\n"",
(MR_Subgoal **) T0, subgoal);
}
#endif
@@ -886,7 +886,7 @@
subgoal->consumer_list_tail = &subgoal->consumer_list;
#ifdef MR_TABLE_DEBUG
if (MR_maxfr != MR_curfr) {
- fatal_error(""MR_maxfr != MR_curfr at table setup\n"");
+ fatal_error(""MR_maxfr != MR_curfr at table setup\\n"");
}
#endif
subgoal->generator_maxfr = MR_prevfr_slot(MR_maxfr);
@@ -999,6 +999,9 @@
local_vars("
#ifdef MR_USE_MINIMAL_MODEL
MR_AnswerList cur_node;
+#else
+ /* ensure local var struct is non-empty */
+ char bogus;
#endif
"),
first_code("
Index: library/std_util.m
===================================================================
RCS file: /home/staff/zs/imp/mercury/library/std_util.m,v
retrieving revision 1.173
diff -u -r1.173 std_util.m
--- std_util.m 1999/11/16 12:18:19 1.173
+++ std_util.m 1999/11/23 03:24:31
@@ -1004,12 +1004,19 @@
Declare_entry(mercury____Compare___std_util__univ_0_0);
MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_std_util__type_ctor_functors_univ_0_struct
- mercury_data_std_util__type_ctor_functors_univ_0;
+const struct mercury_data_std_util__type_ctor_functors_univ_0_struct {
+ Integer f1;
+} mercury_data_std_util__type_ctor_functors_univ_0 = {
+ MR_TYPE_CTOR_FUNCTORS_UNIV
+};
MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_std_util__type_ctor_layout_univ_0_struct
- mercury_data_std_util__type_ctor_layout_univ_0;
+const struct mercury_data_std_util__type_ctor_layout_univ_0_struct {
+ TYPE_LAYOUT_FIELDS
+} mercury_data_std_util__type_ctor_layout_univ_0 = {
+ make_typelayout_for_all_tags(TYPE_CTOR_LAYOUT_CONST_TAG,
+ MR_mkbody(MR_TYPE_CTOR_LAYOUT_UNIV_VALUE))
+};
MR_STATIC_CODE_CONST struct MR_TypeCtorInfo_struct
mercury_data_std_util__type_ctor_info_univ_0 = {
@@ -1023,22 +1030,6 @@
MR_string_const(""std_util"", 8),
MR_string_const(""univ"", 4),
MR_RTTI_VERSION
-};
-
-
-MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_std_util__type_ctor_layout_univ_0_struct {
- TYPE_LAYOUT_FIELDS
-} mercury_data_std_util__type_ctor_layout_univ_0 = {
- make_typelayout_for_all_tags(TYPE_CTOR_LAYOUT_CONST_TAG,
- MR_mkbody(MR_TYPE_CTOR_LAYOUT_UNIV_VALUE))
-};
-
-MR_MODULE_STATIC_OR_EXTERN
-const struct mercury_data_std_util__type_ctor_functors_univ_0_struct {
- Integer f1;
-} mercury_data_std_util__type_ctor_functors_univ_0 = {
- MR_TYPE_CTOR_FUNCTORS_UNIV
};
MR_MODULE_STATIC_OR_EXTERN
Index: runtime/mercury_faultaddr.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_faultaddr.h,v
retrieving revision 1.2
diff -u -r1.2 mercury_faultaddr.h
--- mercury_faultaddr.h 1999/03/22 03:02:19 1.2
+++ mercury_faultaddr.h 1999/11/23 03:24:31
@@ -20,7 +20,7 @@
#if defined(__i386__)
#define MR_GET_FAULT_ADDR(sc) \
- ((void *)(((struct sigcontext_struct)(sc)).cr2))
+ ((void *)(((sc)).cr2))
#elif defined(__mc68000__)
Index: runtime/mercury_reg_workarounds.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_reg_workarounds.h,v
retrieving revision 1.1
diff -u -r1.1 mercury_reg_workarounds.h
--- mercury_reg_workarounds.h 1998/12/15 15:08:37 1.1
+++ mercury_reg_workarounds.h 1999/11/23 03:24:31
@@ -13,6 +13,7 @@
#ifdef MR_CAN_DO_PENDING_IO
#include <sys/types.h> /* for fd_set */
+ #include <sys/time.h> /* for FD_ZERO() */
#endif
/*
Index: runtime/mercury_stack_trace.h
===================================================================
RCS file: /home/staff/zs/imp/mercury/runtime/mercury_stack_trace.h,v
retrieving revision 1.19
diff -u -r1.19 mercury_stack_trace.h
--- mercury_stack_trace.h 1999/11/15 00:43:39 1.19
+++ mercury_stack_trace.h 1999/11/23 03:22:28
@@ -196,7 +196,7 @@
MR_CONTEXT_BEFORE,
MR_CONTEXT_AFTER,
MR_CONTEXT_PREVLINE,
- MR_CONTEXT_NEXTLINE,
+ MR_CONTEXT_NEXTLINE
} MR_Context_Position;
extern void MR_print_proc_id_trace_and_context(FILE *fp,
Index: scripts/ml.in
===================================================================
RCS file: /home/staff/zs/imp/mercury/scripts/ml.in,v
retrieving revision 1.73
diff -u -r1.73 ml.in
--- ml.in 1999/11/23 07:24:05 1.73
+++ ml.in 1999/11/24 07:08:32
@@ -337,7 +337,7 @@
# boehm_gc/dyn_load.c.
# (We might eventually need similar treatment
# for other OSs too)
- MAYBE_STATIC_OPT="-static -Wl,-defsym,_DYNAMIC=0"
+ MAYBE_STATIC_OPT="-static -Wl-defsym -Wl_DYNAMIC=0"
;;
*)
MAYBE_STATIC_OPT=-static
----
+----------------------------------------------------------------------+
| Peter Ross M Sci/Eng Melbourne Uni |
| petdr at cs.mu.oz.au WWW: www.cs.mu.oz.au/~petdr/ ph: +61 3 9344 9158 |
+----------------------------------------------------------------------+
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list