[m-rev.] diff: avoid warnings with MSVC
Julien Fischer
juliensf at csse.unimelb.edu.au
Tue Sep 13 02:29:23 AEST 2011
Branches: main, 11.07
Avoid warnings about functions that don't return in the runtime
with MSVC.
Avoid a warning in the configure script with MSVC.
configure.in:
The cygpath tool is only required with MSVC when using
Cygwin as the build environment; don't emit an error message
about this on other systems, e.g. MingGW.
runtime/mercury_std.h:
Redefine MR_NO_RETURN so that it works with both GCC/Clang
and Visual C.
runtime/mercury_misc.h:
runtime/mercury_engine.c:
Conform to the above change to MR_NO_RETURN.
runtime/mercury_bootstrap.h:
Delete the redefinition of NO_RETURN; any code that still
uses is not going to work for a variety of other reasons.
Julien.
Index: configure.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/configure.in,v
retrieving revision 1.587
diff -u -r1.587 configure.in
--- configure.in 9 Sep 2011 19:29:43 -0000 1.587
+++ configure.in 12 Sep 2011 14:49:52 -0000
@@ -1045,12 +1045,6 @@
LD_STRIP_FLAG=
USING_MICROSOFT_CL_COMPILER="yes"
-
- case "$CYGPATH" in
- "echo")
- AC_MSG_WARN(cygpath required with Microsoft Visual C++)
- ;;
- esac
FIX_PATH_FOR_CC="$CYGPATH"
# MS doesn't use a ranlib.
Index: runtime/mercury_bootstrap.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_bootstrap.h,v
retrieving revision 1.45
diff -u -r1.45 mercury_bootstrap.h
--- runtime/mercury_bootstrap.h 20 May 2011 04:16:54 -0000 1.45
+++ runtime/mercury_bootstrap.h 12 Sep 2011 14:53:56 -0000
@@ -105,10 +105,6 @@
#define min(a, b) MR_min(a, b)
#endif
-#ifndef NO_RETURN
-#define NO_RETURN MR_NO_RETURN
-#endif
-
#define MR_saved_reg(save_area, n) \
MR_LVALUE_COND((n) > MR_MAX_REAL_R_REG, \
(save_area)[(n) + MR_NUM_SPECIAL_REG - 1], \
Index: runtime/mercury_engine.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_engine.c,v
retrieving revision 1.66
diff -u -r1.66 mercury_engine.c
--- runtime/mercury_engine.c 20 May 2011 04:16:54 -0000 1.66
+++ runtime/mercury_engine.c 12 Sep 2011 14:57:17 -0000
@@ -39,7 +39,7 @@
#endif /* MR_USE_GCC_NONLOCAL_GOTOS */
- static void call_engine_inner(MR_Code *entry_point) MR_NO_RETURN;
+ MR_NO_RETURN(static void call_engine_inner(MR_Code *entry_point));
#ifndef MR_USE_GCC_NONLOCAL_GOTOS
static MR_Code *engine_done(void);
Index: runtime/mercury_misc.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_misc.h,v
retrieving revision 1.32
diff -u -r1.32 mercury_misc.h
--- runtime/mercury_misc.h 20 May 2011 04:16:55 -0000 1.32
+++ runtime/mercury_misc.h 12 Sep 2011 15:01:44 -0000
@@ -40,8 +40,8 @@
** Output a message to standard error and abort.
** This function is for fatal errors in the Mercury runtime.
*/
-extern void
-MR_fatal_error(const char *msg, ...) MR_NO_RETURN;
+MR_NO_RETURN(extern void \
+MR_fatal_error(const char *msg, ...));
/*
** Output a message to standard error and abort.
@@ -49,8 +49,8 @@
** error.
** This is intended to be called from library bindings etc.
*/
-extern void
-MR_external_fatal_error(const char *locn, const char *msg, ...) MR_NO_RETURN;
+MR_NO_RETURN(extern void \
+MR_external_fatal_error(const char *locn, const char *msg, ...));
/*
** Register a function to be called (as func(data)) when the program is
Index: runtime/mercury_std.h
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_std.h,v
retrieving revision 1.35
diff -u -r1.35 mercury_std.h
--- runtime/mercury_std.h 29 Aug 2011 05:45:52 -0000 1.35
+++ runtime/mercury_std.h 12 Sep 2011 15:05:55 -0000
@@ -195,9 +195,11 @@
/* A macro for declaring functions that never return */
#if defined(MR_GNUC) || defined(MR_CLANG)
- #define MR_NO_RETURN __attribute__((noreturn))
+ #define MR_NO_RETURN(x) x __attribute__((noreturn))
+#elif defined(MR_MSVC)
+ #define MR_NO_RETURN(x) __declspec(noreturn) x
#else
- #define MR_NO_RETURN
+ #define MR_NO_RETURN(x) x
#endif
/*---------------------------------------------------------------------------*/
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list