[m-rev.] diff: fix library/exception.m and gcc 4 in .profdeep grades

Ben Schmidt b.schmidt at ugrad.unimelb.edu.au
Thu Dec 28 20:36:24 AEDT 2006


Don't know if it's really my place to say so, but since nobody else 
seems to be around it seems logical enough to speak up. I've looked 
through the diff and it looks fine to me.

Ben.



Julien Fischer wrote:
> 
> Estimated hours taken: 1
> Branches: main, release
> 
> Fix a bug that breaks compiling library/exception.m in deep profiling
> grades with gcc 4.1.  This has been reported by several people on
> Mercury users.
> 
> library/exception.m:
>     Make sure that the proc_layout structure for builtin_throw is
>     externally visible.  If we declare it to have static linkage then the
>     definition will conflict with the compiler generated declaration for
>     it.  Versions of gcc less than 4 didn't seem to care about this; with
>     gcc 4 and above it is reported as an error.  (Note: we have always
>     treated builtin_catch this way, the incorrect handling of
>     builtin_throw seems to have been an oversight.)
> 
>     Add a couple of comments: a pointer from the proc_layout for
>     builtin_throw to comment above those for builtin_catch explaining
>     the reasons making these definitions external and a mention
>     of gcc 4 being a bit more picky about these matters.
> 
> Julien.
> 
> Index: exception.m
> ===================================================================
> RCS file: /home/mercury/mercury1/repository/mercury/library/exception.m,v
> retrieving revision 1.119
> diff -u -r1.119 exception.m
> --- exception.m    21 Dec 2006 03:00:48 -0000    1.119
> +++ exception.m    26 Dec 2006 05:56:44 -0000
> @@ -1842,8 +1842,12 @@
>  ** (e.g. browser/declarative_debugger.m), and deep profiling may therefore
>  ** need the address of the proc_layout structure for the call's
>  ** call_site_static structure.
> +**
> +** Additionally, the compiler generated declaration for the proc_layout
> +** structure will be declared extern if the address is required in other
> +** modules.  GCC 4 and above consider a static definition and a non-static
> +** declaration to be an error.
>  */
> -
>  MR_EXTERN_USER_PROC_STATIC_PROC_LAYOUT(
>      MR_DETISM_NON, MR_PROC_NO_SLOT_COUNT, -1,
>      MR_PREDICATE, exception, builtin_catch, 3, 0);
> @@ -1916,7 +1920,13 @@
> 
>  MR_proc_static_user_no_site(exception, builtin_throw, 1, 0,
>      ""exception.m"", MR_DUMMY_LINE, MR_TRUE);
> -MR_STATIC_USER_PROC_STATIC_PROC_LAYOUT(
> +
> +/*
> +** See the above comments regarding builtin_catch for the reason we
> +** must use MR_EXTERN_USER_PROC_STATIC_PROC_LAYOUT instead of +** 
> MR_STATIC_USER_PROC_STATIC_PROC_LAYOUT here.
> +*/
> +MR_EXTERN_USER_PROC_STATIC_PROC_LAYOUT(
>          MR_DETISM_DET, 1, MR_LONG_LVAL_STACKVAR_INT(1),
>          MR_PREDICATE, exception, builtin_throw, 1, 0);
>  MR_MAKE_USER_INTERNAL_LAYOUT(exception, builtin_throw, 1, 0, 1);
> 
> --------------------------------------------------------------------------
> 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
> --------------------------------------------------------------------------
> 
--------------------------------------------------------------------------
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