emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compiling (development) Emacs with MSVC


From: Eli Zaretskii
Subject: Re: Compiling (development) Emacs with MSVC
Date: Sat, 18 Dec 2010 13:05:58 +0200

> From: Fabrice Popineau <address@hidden>
> Date: Mon, 13 Dec 2010 23:40:56 +0100
> Cc: address@hidden
> 
> Patch attached.

Thanks.  I finally found time to review it, and I have a few comments
and questions:

> Apparently the ANSI C spec says that bit fields are unsigned, and enum are
> signed, hence the patch in lisp.h for various bit fields.
> Anyway, the MS compiler did extend sign and that was the main failure.

The problem and the solution you suggest are clear, but I'd like to
try to find a cleaner solution, if possible, one that doesn't require
so many #ifdef's.  Can you think of some change in one or two places
that would resolve this?  Can MSVC be forced in some way to use an
unsigned type for enumerations, for example?  If not, since the
problem is only with a single enumeration, would it work to use
something like this:

enum Lisp_Misc_Type
  {
    Lisp_Misc_Free = 0x5eab,
    Lisp_Misc_Marker = 0x5eac,
    Lisp_Misc_Intfwd = 0x5ead,

etc.?  Or maybe use 0x5eabU etc., with an explicitly unsigned value?

A few other issues with the rest of the patch:

> -#   define DECL_ALIGN(type, var) \
> +#   define DECL_ALIGN(type, var)                                \
>       type __attribute__ ((__aligned__ (1 << GCTYPEBITS))) var

Is this just some inadvertent reformatting, or is there some deeper
problem here?

>  TAGS-gmake:
> -     ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
> -       address@hidden/nt/emacs-src.tags \
> -       $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
> -     ../lib-src/$(BLD)/etags.exe -a address@hidden/nt/emacs-src.tags \
> -       $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
> -     ../lib-src/$(BLD)/etags.exe -a address@hidden/nt/emacs-src.tags \
> -       $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \
> -       $(CURDIR)/*.h
> +# ../lib-src/$(BLD)/etags.exe --include=TAGS-LISP --include=../nt/TAGS \
> +#   address@hidden/nt/emacs-src.tags \
> +#   $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ0))
> +# ../lib-src/$(BLD)/etags.exe -a address@hidden/nt/emacs-src.tags \
> +#   $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ1))
> +# ../lib-src/$(BLD)/etags.exe -a address@hidden/nt/emacs-src.tags \
> +#   $(patsubst $(BLD)%.$(O),$(CURDIR)%.c,$(OBJ2)) \
> +#   $(CURDIR)/*.h

Why did you comment out these commands?  They are not supposed to be
invoked under nmake, only under GNU Make.

> -       memset (bloc->new_data + old_size, 0, size - old_size);
> +       memset ((char *) bloc->new_data + old_size, 0, size - old_size);

Is this a real problem, or just a left-over from some attempt to debug
memory allocation problems, resolved by "-dynamicbase:no"?  If this is
a real problem, can you tell what it is?

> +#define fstat(a, b)   sys_fstat(a, b)
> +#define stat(a, b)   sys_stat(a, b)
> +#define utime   sys_utime

Why did you need to do this?  What happens if you don't?

> -      if (tmp && _access (tmp, D_OK) == 0)
> +      if (tmp && sys_access (tmp, D_OK) == 0)

What's wrong with calling _access from the MS runtime?

> -    " --cflags", USER_CFLAGS,
> +    " --cflags", stringer(USER_CFLAGS),

Why did you need to stringify here?  USER_CFLAGS is supposed to be
defined to a quoted string, like " -DFOO".  Can you tell why this
didn't work for you?

> +rem set SDK environment
> +if (%noopt%) == (Y) (
> +   call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 
> /win7 /Debug
> +   set nodebug=N
> +)
> +
> +if (%nodebug%) == (Y) (
> +   call "c:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x86 
> /win7 /Release
> +   set noopt=N
> +)

Is there a less system-dependent way of doing this?  E.g., is there an
environment variable to replace the path to SetEnv.cmd?  Also, how to
set the /win7 switch portably, so that it works on non-Windows 7
platforms as well?  For that matter, is it at all necessary to call
SetEnv.cmd, in addition to using appropriate compiler/linker switches?

Thanks.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]