Subject: bug#43190: feature/native-comp; failure to compile json-mode leaves Emacs broken

From: Andrea Corallo <[email-masked]>
Date: Fri, 18 Sep 2020 19:23:52 +0000

Hi Tom,

Tom Gillespie <[email-masked]> writes:

> Hi Andrea,
>     Having poked about a bit more I agree. I don't think it has
> anything to do with the native compilation directly. I suspect that it
> has to do with how or exactly when the native compiled code is swapped
> in. When byte compiling on the command line I get an error at the same
> place that I get one when native compiling stating that json-snatcher
> could not be required.

As I mentioned what you have seen is 99% due to the fact that the
compiled package is missing to require some feature explicitly.  For
some reason this feature in a interactive session in loaded and the
byte-compiler is able to compile without complaining of this missing
definition.  The native compiler is picky as the byte compiler invoked
in the command line (actually because the byte-compiler is its
front-end).

If for example the native compiler compiles a file using a macro but
this is not defined it will assume this is a function.  As a result the
produced code is wrong and once loaded will not behave correctly.

If a require is missing the code is not correct and we cannot garantee
to compile such a code correctly, as the package has been fixed and
there's no evidence of a native compiler bug I'd be for closing this bug
:)

  Andrea