[m-rev.] for review: fix MSVC LLDS code compilation

Zoltan Somogyi zs at csse.unimelb.edu.au
Mon May 28 10:50:05 AEST 2007


On 28-May-2007, Peter Ross <pro at missioncriticalit.com> wrote:
> Could you just check the following.
> It doesn't give any warnings under gcc.
> 
> compiler/llds_out.m:
> 	MSVC treats declarations such as
> 		"static const struct s a[];"
> 	as definitions.  As a definition it doesn't know the size
> 	of the definition, so aborts.
> 	Thus we now output
> 		"extern const struct s a[];"
> 	which both gcc and msvc seem to handle.

I am surprised this doesn't get a warning from gcc. "extern" indicates
the symbol is visible outside the module; "static" indicates it is not
visible. Having a declaration use one and the definition use the other
is definitely something that at least *some* versions of gcc generate
warnings about, at least with *some* options that we use.

It seems that MSVC is broken in this respect. Is there no flag to make
it work properly?

> runtime/mercury_stack_layout.h:
> 	The MSVC C pre-processor aborts on comments inside C
> 	pre-processor #defines, eg
> 		#define P(X) Q(/* extern */, X)
> 	It seems to treat strip the comment and then complain
> 	about the missing argument.
> 	The comment is no replaced with a pre-processor simple
> 	which evaluates to the empty string.

This is fine.

Zoltan.
--------------------------------------------------------------------------
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