Subject: Compilation issues with g++ on some files

From: Alex <[email-masked]>
Date: Wed, 13 Mar 2019 15:12:37 -0600

I'm currently working on a prototype for a feature that requires the
introduction of C++ files, and I am having some issues compiling certain
files with g++. Any chance the below (particularly #3) could be easily
fixed?

1. Invalid conversions to pvec_type. Compiling with the -fpermissive
flag demotes these to warnings, but it would be nice to avoid using
that.

--8<---------------cut here---------------start------------->8---
./src/lisp.h: In function ‘pvec_type PSEUDOVECTOR_TYPE(const Lisp_Vector*)’:
./src/lisp.h:1683:11: error: invalid conversion from ‘long int’ to ‘pvec_type’ [-fpermissive]
   return (size & PSEUDOVECTOR_FLAG
          ~~~~~~~~~~~~~~~~~~~~~~~~~
           ? (size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS
           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
           : PVEC_NORMAL_VECTOR);
           ~~~~~~~~~~~~~~~~~~~~~
./src/lisp.h: In function ‘bool PSEUDOVECTORP(Lisp_Object, int)’:
./src/lisp.h:1708:6: error: invalid conversion from ‘int’ to ‘pvec_type’ [-fpermissive]
      code);
      ^~~~
--8<---------------cut here---------------end--------------->8---

2. This one just needs a new (not new) variable name.

--8<---------------cut here---------------start------------->8---
./src/lisp.h:1585:58: error: expected ‘,’ or ‘...’ before ‘new’
 SSET (Lisp_Object string, ptrdiff_t index, unsigned char new)
                                                          ^~~
./src/lisp.h: In function ‘void SSET(Lisp_Object, ptrdiff_t, unsigned char)’:
./src/lisp.h:1587:30: error: expected type-specifier before ‘;’ token
   SDATA (string)[index] = new;
                              ^
--8<---------------cut here---------------end--------------->8---

3. I'm not sure what to do for the next one, which is unfortunately
included by other files.

--8<---------------cut here---------------start------------->8---
./lib/time.h:769:1: error: expected ‘,’ or ‘...’ before ‘__timer’
 _GL_FUNCDECL_SYS (localtime_rz, struct tm *,
 ^~~~~~~~~~~~~~~~
./lib/time.h:771:50: error: nonnull argument with out-of-range operand number (argument 2, operand 3)
                    struct tm *restrict __result) _GL_ARG_NONNULL ((2, 3)));
                                                  ^~~~~~~~~~~~~~~
./lib/time.h:775:1: error: expected ‘,’ or ‘...’ before ‘__result’
 _GL_FUNCDECL_SYS (mktime_z, time_t,
 ^~~~~~~~~~~~~~~~
--8<---------------cut here---------------end--------------->8---