diff: yet another fix for linkage mismatch problem
Fergus Henderson
fjh at cs.mu.OZ.AU
Fri Sep 4 21:20:12 AEST 1998
Yet another fix to my change to ensure that the declarations and definitions
for data constants specify the same linkage (extern or static).
This one is needed to make it work with --split-c-files.
runtime/mercury_goto.h:
Add an `MR_' prefix to the MODULE_STATIC_OR_EXTERN macro.
library/array.m:
library/builtin.m:
library/std_util.m:
extras/clpr/cfloat.m:
Use MR_MODULE_STATIC_OR_EXTERN instead of `static' on the hand-coded
definitions of the base_type_functors and base_type_layouts for
builtin types.
Index: extras/clpr/cfloat.m
===================================================================
RCS file: /home/mercury1/repository/clpr/cfloat.m,v
retrieving revision 1.19
diff -u -r1.19 cfloat.m
--- cfloat.m 1998/09/04 05:54:52 1.19
+++ cfloat.m 1998/09/04 11:16:53
@@ -871,7 +871,8 @@
/* base_type_functors for `cfloat' */
-static const struct mercury_data_cfloat__base_type_functors_cfloat_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_cfloat__base_type_functors_cfloat_0_struct {
Integer f1;
} mercury_data_cfloat__base_type_functors_cfloat_0 = {
MR_TYPEFUNCTORS_SPECIAL
@@ -879,7 +880,8 @@
/* base_type_layout for `cfloat' */
-static const struct mercury_data_cfloat__base_type_layout_cfloat_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_cfloat__base_type_layout_cfloat_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data_cfloat__base_type_layout_cfloat_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
Index: library/array.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/array.m,v
retrieving revision 1.48
diff -u -r1.48 array.m
--- array.m 1998/09/03 11:13:51 1.48
+++ array.m 1998/09/04 11:14:37
@@ -269,14 +269,16 @@
#ifdef USE_TYPE_LAYOUT
-static const struct mercury_data_array__base_type_layout_array_1_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_array__base_type_layout_array_1_struct {
TYPE_LAYOUT_FIELDS
} mercury_data_array__base_type_layout_array_1 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
mkbody(TYPELAYOUT_ARRAY_VALUE))
};
-static const struct mercury_data_array__base_type_functors_array_1_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_array__base_type_functors_array_1_struct {
Integer f1;
} mercury_data_array__base_type_functors_array_1 = {
MR_TYPEFUNCTORS_SPECIAL
Index: library/builtin.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/builtin.m,v
retrieving revision 1.5
diff -u -r1.5 builtin.m
--- builtin.m 1998/09/03 11:13:51 1.5
+++ builtin.m 1998/09/04 11:16:27
@@ -201,7 +201,8 @@
/* base_type_layout for `int' */
-static const struct mercury_data___base_type_layout_int_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_layout_int_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data___base_type_layout_int_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
@@ -210,7 +211,8 @@
/* base_type_layout for `character' */
-static const struct mercury_data___base_type_layout_character_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_layout_character_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data___base_type_layout_character_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
@@ -219,7 +221,8 @@
/* base_type_layout for `string' */
-static const struct mercury_data___base_type_layout_string_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_layout_string_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data___base_type_layout_string_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
@@ -228,7 +231,8 @@
/* base_type_layout for `float' */
-static const struct mercury_data___base_type_layout_float_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_layout_float_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data___base_type_layout_float_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
@@ -237,7 +241,8 @@
/* base_type_layout for `void' */
-static const struct mercury_data___base_type_layout_void_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_layout_void_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data___base_type_layout_void_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
@@ -248,7 +253,8 @@
/* base_type_functors for `int' */
-static const struct mercury_data___base_type_functors_int_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_functors_int_0_struct {
Integer f1;
} mercury_data___base_type_functors_int_0 = {
MR_TYPEFUNCTORS_SPECIAL
@@ -256,7 +262,8 @@
/* base_type_functors for `character' */
-static const struct mercury_data___base_type_functors_character_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_functors_character_0_struct {
Integer f1;
} mercury_data___base_type_functors_character_0 = {
MR_TYPEFUNCTORS_SPECIAL
@@ -264,7 +271,8 @@
/* base_type_functors for `string' */
-static const struct mercury_data___base_type_functors_string_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_functors_string_0_struct {
Integer f1;
} mercury_data___base_type_functors_string_0 = {
MR_TYPEFUNCTORS_SPECIAL
@@ -272,7 +280,8 @@
/* base_type_functors for `float' */
-static const struct mercury_data___base_type_functors_float_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_functors_float_0_struct {
Integer f1;
} mercury_data___base_type_functors_float_0 = {
MR_TYPEFUNCTORS_SPECIAL
@@ -280,7 +289,8 @@
/* base_type_functors for `void' */
-static const struct mercury_data___base_type_functors_void_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data___base_type_functors_void_0_struct {
Integer f1;
} mercury_data___base_type_functors_void_0 = {
MR_TYPEFUNCTORS_SPECIAL
@@ -571,14 +581,16 @@
#ifdef USE_TYPE_LAYOUT
-static const struct mercury_data_builtin__base_type_layout_c_pointer_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_builtin__base_type_layout_c_pointer_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data_builtin__base_type_layout_c_pointer_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
mkbody(TYPELAYOUT_C_POINTER_VALUE))
};
-static const struct
+MR_MODULE_STATIC_OR_EXTERN
+const struct
mercury_data_builtin__base_type_functors_c_pointer_0_struct {
Integer f1;
} mercury_data_builtin__base_type_functors_c_pointer_0 = {
Index: library/std_util.m
===================================================================
RCS file: /home/mercury1/repository/mercury/library/std_util.m,v
retrieving revision 1.128
diff -u -r1.128 std_util.m
--- std_util.m 1998/09/03 11:13:53 1.128
+++ std_util.m 1998/09/04 11:16:41
@@ -1046,20 +1046,23 @@
#ifdef USE_TYPE_LAYOUT
-static const struct mercury_data_std_util__base_type_layout_univ_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_std_util__base_type_layout_univ_0_struct {
TYPE_LAYOUT_FIELDS
} mercury_data_std_util__base_type_layout_univ_0 = {
make_typelayout_for_all_tags(TYPELAYOUT_CONST_TAG,
mkbody(TYPELAYOUT_UNIV_VALUE))
};
-static const struct mercury_data_std_util__base_type_functors_univ_0_struct {
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_std_util__base_type_functors_univ_0_struct {
Integer f1;
} mercury_data_std_util__base_type_functors_univ_0 = {
MR_TYPEFUNCTORS_UNIV
};
-static const struct mercury_data_std_util__base_type_layout_type_info_0_struct
+MR_MODULE_STATIC_OR_EXTERN
+const struct mercury_data_std_util__base_type_layout_type_info_0_struct
{
TYPE_LAYOUT_FIELDS
} mercury_data_std_util__base_type_layout_type_info_0 = {
@@ -1067,7 +1070,8 @@
mkbody(TYPELAYOUT_TYPEINFO_VALUE))
};
-static const struct
+MR_MODULE_STATIC_OR_EXTERN
+const struct
mercury_data_std_util__base_type_functors_type_info_0_struct {
Integer f1;
} mercury_data_std_util__base_type_functors_type_info_0 = {
Index: runtime/mercury_goto.h
===================================================================
RCS file: /home/mercury1/repository/mercury/runtime/mercury_goto.h,v
retrieving revision 1.13
diff -u -r1.13 mercury_goto.h
--- mercury_goto.h 1998/07/13 22:44:07 1.13
+++ mercury_goto.h 1998/09/04 11:17:25
@@ -70,9 +70,9 @@
#endif
#ifdef SPLIT_C_FILES
-#define MODULE_STATIC_OR_EXTERN extern
+ #define MR_MODULE_STATIC_OR_EXTERN extern
#else
-#define MODULE_STATIC_OR_EXTERN static
+ #define MR_MODULE_STATIC_OR_EXTERN static
#endif
/*---------------------------------------------------------------------------*/
@@ -448,8 +448,8 @@
** macro are for.
*/
#define BEGIN_MODULE(module_name) \
- MODULE_STATIC_OR_EXTERN void module_name(void); \
- MODULE_STATIC_OR_EXTERN void module_name(void) { \
+ MR_MODULE_STATIC_OR_EXTERN void module_name(void); \
+ MR_MODULE_STATIC_OR_EXTERN void module_name(void) { \
PRETEND_ADDRESS_IS_USED(module_name); \
PRETEND_ADDRESS_IS_USED(&& paste(module_name, _dummy_label)); \
paste(module_name,_dummy_label): \
@@ -568,8 +568,8 @@
typedef Code * ModuleFunc(void);
#define BEGIN_MODULE(module_name) \
- MODULE_STATIC_OR_EXTERN Code* module_name(void); \
- MODULE_STATIC_OR_EXTERN Code* module_name(void) {
+ MR_MODULE_STATIC_OR_EXTERN Code* module_name(void); \
+ MR_MODULE_STATIC_OR_EXTERN Code* module_name(void) {
#define BEGIN_CODE return 0;
#define END_MODULE }
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
More information about the developers
mailing list