Subject: bug#45303: #45303 [feature/native-comp] building error on Windows

From: Andy Moreton <[email-masked]>
Date: Mon, 21 Dec 2020 00:53:40 +0000

On Sun 20 Dec 2020, Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of text editors" wrote:

> Andrea Corallo via "Bug reports for GNU Emacs, the Swiss army knife of
> text editors" <[email-masked]> writes:
>
> [...]
>
>> Thanks, hope 18ca9ea08a fix it.
>                ^^^^^
>                3bb2fd0c58

Thanks Andrea, that problem is fixed. There are still some warnings from
comp.c that indicate other troubles:

C:/emacs/git/emacs/native/src/comp.c: In function 'Fcomp__compile_ctxt_to_file':
C:/emacs/git/emacs/native/src/comp.c:4461:12: warning: unused variable 'oldset' [-Wunused-variable]
 4461 |   sigset_t oldset;
      |            ^~~~~~
C:/emacs/git/emacs/native/src/comp.c: In function 'eln_load_path_final_clean_up':
C:/emacs/git/emacs/native/src/comp.c:4626:12: warning: passing argument 7 of 'internal_condition_case_5' from incompatible pointer type [-Wincompatible-pointer-types]
 4626 |        Qt, return_nil, Qnil);
      |            ^~~~~~~~~~
      |            |
      |            struct Lisp_X * (*)(struct Lisp_X *)
In file included from C:/emacs/git/emacs/native/src/comp.c:23:
C:/emacs/git/emacs/native/src/lisp.h:4161:195: note: expected 'Lisp_Object' {aka 'struct Lisp_X *'} but argument is of type 'struct Lisp_X * (*)(struct Lisp_X *)'
 4161 | extern Lisp_Object internal_condition_case_5 (Lisp_Object (*) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
      |                                                                                                                                                                                                   ^~~~~~~~~~~
In file included from C:/emacs/git/emacs/native/src/lisp.h:944,
                 from C:/emacs/git/emacs/native/src/comp.c:23:
./globals.h:6980:14: warning: passing argument 8 of 'internal_condition_case_5' from incompatible pointer type [-Wincompatible-pointer-types]
 6980 | #define Qnil builtin_lisp_symbol (0)
      |              ^~~~~~~~~~~~~~~~~~~~~~~
      |              |
      |              Lisp_Object {aka struct Lisp_X *}
C:/emacs/git/emacs/native/src/comp.c:4626:24: note: in expansion of macro 'Qnil'
 4626 |        Qt, return_nil, Qnil);
      |                        ^~~~
In file included from C:/emacs/git/emacs/native/src/comp.c:23:
C:/emacs/git/emacs/native/src/lisp.h:4161:208: note: expected 'struct Lisp_X * (*)(struct Lisp_X *)' but argument is of type 'Lisp_Object' {aka 'struct Lisp_X *'}
 4161 | extern Lisp_Object internal_condition_case_5 (Lisp_Object (*) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
      |                                                                                                                                                                                                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

The internal_condition_case_5 usage looks like the last two arguments
might be swapped.

The return_nil function is also declared as a nested function: that is a
gcc extension, so it is more portable to define it as an ordinary static
function.

    AndyM