Commit 69947311 authored by Paul Eggert's avatar Paul Eggert

Port to Oracle Developer Studio 12.6

This compiler is a bit pickier about checking conformance to
the C standard, ranging from syntax trivia (no extra ";" at
the top level) to portability trivia (warnings re conversion
between function and data pointers) to more-important stuff
like lack of support for some __attribute__ usages.
* src/dynlib.c (dynlib_addr): First argument is a function
pointer, not a data pointer.  All callers changed.
* src/emacs-module.c (module_function_address):
Return module_funcptr, not void *.  All uses changed.
* src/lisp.h (module_funcptr) [HAVE_MODULES]: New type.
* src/lread.c (union ieee754_double): Don’t assume the usual
semantics for converting signed to unsigned int when initializing
a bitfield, as the Oracle compiler complains and the C standard
is unclear.
* src/pdumper.c (ALLOW_IMPLICIT_CONVERSION): Make it clearer
that -Wsign-conversion is disabled everywhere in this file.
(dump_trace, dump_tailq_prepend, dump_tailq_append):
Don’t assume __attribute__.
(dump_object_self_representing_p): Don’t disable conversion
warnings; it’s not needed here.
(DEFINE_FROMLISP_FUNC): Avoid possible signal in integer
conversion from unsigned to signed.
(DEFINE_FROMLISP_FUNC, finish_dump_pvec): Avoid warning about
unreachable statements on platforms not supporting the
__attribute__.
(intmax_t_from_lisp, intmax_t_to_lisp, dump_off_from_lisp)
(dump_off_to_lisp, dump_emacs_reloc_immediate_lv)
(dump_emacs_reloc_immediate_ptrdiff_t)
(dump_emacs_reloc_immediate_intmax_t)
(dump_emacs_reloc_immediate_int, dump_emacs_reloc_immediate_bool):
Omit stray semicolon that violates C standard.
(dump_metadata_for_pdumper): Add cast to pacify compiler complaining
about conversion from function pointer to data pointer.
(Fdump_emacs_portable): Do not use CALLN to call a function
with zero arguments, as C99 prohibits empty initializers.
* src/xdisp.c (syms_of_xdisp): Do not nest calls to pure_list,
to work around a bug in Oracle Developer Studio 12.6.
parent ca99c00f
Pipeline #1461 failed with stage
in 69 minutes and 51 seconds
......@@ -123,7 +123,7 @@ dynlib_sym (dynlib_handle_ptr h, const char *sym)
}
void
dynlib_addr (void *addr, const char **fname, const char **symname)
dynlib_addr (void (*addr) (void), const char **fname, const char **symname)
{
static char dll_filename[MAX_UTF8_PATH];
static GetModuleHandleExA_Proc s_pfn_Get_Module_HandleExA = NULL;
......@@ -279,11 +279,12 @@ dynlib_sym (dynlib_handle_ptr h, const char *sym)
}
void
dynlib_addr (void *ptr, const char **path, const char **sym)
dynlib_addr (void (*funcptr) (void), const char **path, const char **sym)
{
*path = NULL;
*sym = NULL;
#ifdef HAVE_DLADDR
void *ptr = (void *) funcptr;
Dl_info info;
if (dladdr (ptr, &info) && info.dli_fname && info.dli_sname)
{
......
......@@ -35,6 +35,6 @@ dynlib_function_ptr dynlib_func (dynlib_handle_ptr h, const char *sym);
/* Sets *FILE to the file name from which PTR was loaded, and *SYM to
its symbol name. If the file or symbol name could not be
determined, set the corresponding argument to NULL. */
void dynlib_addr (void *ptr, const char **file, const char **sym);
void dynlib_addr (void (*ptr) (void), const char **file, const char **sym);
#endif /* DYNLIB_H */
......@@ -934,10 +934,10 @@ module_function_documentation (const struct Lisp_Module_Function *function)
return function->documentation;
}
void *
module_funcptr
module_function_address (const struct Lisp_Module_Function *function)
{
return function->subr;
return (module_funcptr) function->subr;
}
......
......@@ -3069,7 +3069,9 @@ enum maxargs
/* Call a function F that accepts many args, passing it the remaining args,
E.g., 'return CALLN (Fformat, fmt, text);' is less error-prone than
'{ Lisp_Object a[2]; a[0] = fmt; a[1] = text; return Fformat (2, a); }'.
CALLN is overkill for simple usages like 'Finsert (1, &text);'. */
CALLN requires at least one function argument (as C99 prohibits
empty initializers), and is overkill for simple usages like
'Finsert (1, &text);'. */
#define CALLN(f, ...) CALLMANY (f, ((Lisp_Object []) {__VA_ARGS__}))
extern void defvar_lisp (struct Lisp_Objfwd const *, char const *);
......@@ -4168,14 +4170,21 @@ XMODULE_FUNCTION (Lisp_Object o)
}
#ifdef HAVE_MODULES
/* A function pointer type good enough for lisp.h. Actual module
function pointers are of a different type that relies on details
internal to emacs-module.c. */
typedef void (*module_funcptr) (void);
/* Defined in alloc.c. */
extern Lisp_Object make_user_ptr (void (*finalizer) (void *), void *p);
/* Defined in emacs-module.c. */
extern Lisp_Object funcall_module (Lisp_Object, ptrdiff_t, Lisp_Object *);
extern Lisp_Object module_function_arity (const struct Lisp_Module_Function *);
extern Lisp_Object module_function_documentation (const struct Lisp_Module_Function *);
extern void *module_function_address (const struct Lisp_Module_Function *);
extern Lisp_Object module_function_documentation
(struct Lisp_Module_Function const *);
extern module_funcptr module_function_address
(struct Lisp_Module_Function const *);
extern void mark_modules (void);
extern void init_module_assertions (bool);
extern void syms_of_module (void);
......
......@@ -3782,7 +3782,7 @@ string_to_number (char const *string, int base, ptrdiff_t *plen)
state |= E_EXP;
cp += 3;
union ieee754_double u
= { .ieee_nan = { .exponent = -1, .quiet_nan = 1,
= { .ieee_nan = { .exponent = 0x7ff, .quiet_nan = 1,
.mantissa0 = n >> 31 >> 1, .mantissa1 = n }};
value = u.d;
}
......
......@@ -70,18 +70,18 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
#ifdef HAVE_PDUMPER
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)
#if GNUC_PREREQ (4, 7, 0)
# pragma GCC diagnostic error "-Wconversion"
# pragma GCC diagnostic ignored "-Wsign-conversion"
# pragma GCC diagnostic error "-Wshadow"
# define ALLOW_IMPLICIT_CONVERSION \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wconversion\"")
_Pragma ("GCC diagnostic ignored \"-Wsign-conversion\"")
# define DISALLOW_IMPLICIT_CONVERSION \
_Pragma ("GCC diagnostic pop")
#else
# define ALLOW_IMPLICIT_CONVERSION ((void)0)
# define DISALLOW_IMPLICIT_CONVERSION ((void)0)
# define ALLOW_IMPLICIT_CONVERSION ((void) 0)
# define DISALLOW_IMPLICIT_CONVERSION ((void) 0)
#endif
#define VM_POSIX 1
......@@ -124,7 +124,7 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
general-purpose computer made after 1990. */
verify (sizeof (ptrdiff_t) == sizeof (void *));
verify (sizeof (intptr_t) == sizeof (ptrdiff_t));
verify (sizeof (void (*)(void)) == sizeof (void *));
verify (sizeof (void (*) (void)) == sizeof (void *));
verify (sizeof (ptrdiff_t) <= sizeof (Lisp_Object));
verify (sizeof (ptrdiff_t) <= sizeof (EMACS_INT));
verify (CHAR_BIT == 8);
......@@ -151,8 +151,7 @@ typedef int_least32_t dump_off;
#define DUMP_OFF_MIN INT_LEAST32_MIN
#define DUMP_OFF_MAX INT_LEAST32_MAX
__attribute__((format (printf,1,2)))
static void
static void ATTRIBUTE_FORMAT ((printf, 1, 2))
dump_trace (const char *fmt, ...)
{
if (0)
......@@ -734,11 +733,7 @@ dump_builtin_symbol_p (Lisp_Object object)
static bool
dump_object_self_representing_p (Lisp_Object object)
{
bool result;
ALLOW_IMPLICIT_CONVERSION;
result = FIXNUMP (object) || dump_builtin_symbol_p (object);
DISALLOW_IMPLICIT_CONVERSION;
return result;
return FIXNUMP (object) || dump_builtin_symbol_p (object);
}
#define DEFINE_FROMLISP_FUNC(fn, type) \
......@@ -749,10 +744,13 @@ dump_object_self_representing_p (Lisp_Object object)
if (FIXNUMP (value)) \
return XFIXNUM (value); \
eassert (BIGNUMP (value)); \
return TYPE_SIGNED (type) \
? bignum_to_intmax (value) \
: bignum_to_uintmax (value); \
type result; \
if (TYPE_SIGNED (type)) \
result = bignum_to_intmax (value); \
else \
result = bignum_to_uintmax (value); \
DISALLOW_IMPLICIT_CONVERSION; \
return result; \
}
#define DEFINE_TOLISP_FUNC(fn, type) \
......@@ -762,10 +760,10 @@ dump_object_self_representing_p (Lisp_Object object)
return INT_TO_INTEGER (value); \
}
DEFINE_FROMLISP_FUNC (intmax_t_from_lisp, intmax_t);
DEFINE_TOLISP_FUNC (intmax_t_to_lisp, intmax_t);
DEFINE_FROMLISP_FUNC (dump_off_from_lisp, dump_off);
DEFINE_TOLISP_FUNC (dump_off_to_lisp, dump_off);
DEFINE_FROMLISP_FUNC (intmax_t_from_lisp, intmax_t)
DEFINE_TOLISP_FUNC (intmax_t_to_lisp, intmax_t)
DEFINE_FROMLISP_FUNC (dump_off_from_lisp, dump_off)
DEFINE_TOLISP_FUNC (dump_off_to_lisp, dump_off)
static void
dump_write (struct dump_context *ctx, const void *buf, dump_off nbyte)
......@@ -797,8 +795,7 @@ dump_tailq_length (const struct dump_tailq *tailq)
return tailq->length;
}
__attribute__((unused))
static void
static void ATTRIBUTE_UNUSED
dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value)
{
Lisp_Object link = Fcons (value, tailq->head);
......@@ -808,8 +805,7 @@ dump_tailq_prepend (struct dump_tailq *tailq, Lisp_Object value)
tailq->length += 1;
}
__attribute__((unused))
static void
static void ATTRIBUTE_UNUSED
dump_tailq_append (struct dump_tailq *tailq, Lisp_Object value)
{
Lisp_Object link = Fcons (value, Qnil);
......@@ -1593,11 +1589,11 @@ dump_emacs_reloc_immediate (struct dump_context *ctx,
ctx, emacs_ptr, &value, sizeof (value)); \
}
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_lv, Lisp_Object);
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_ptrdiff_t, ptrdiff_t);
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_intmax_t, intmax_t);
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_int, int);
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_bool, bool);
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_lv, Lisp_Object)
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_ptrdiff_t, ptrdiff_t)
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_intmax_t, intmax_t)
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_int, int)
DEFINE_EMACS_IMMEDIATE_FN (dump_emacs_reloc_immediate_bool, bool)
/* Add an emacs relocation that makes a raw pointer in Emacs point
into the dump. */
......@@ -2011,8 +2007,10 @@ finish_dump_pvec (struct dump_context *ctx,
union vectorlike_header *out_hdr)
{
ALLOW_IMPLICIT_CONVERSION;
return dump_object_finish (ctx, out_hdr, vectorlike_nbytes (out_hdr));
dump_off result = dump_object_finish (ctx, out_hdr,
vectorlike_nbytes (out_hdr));
DISALLOW_IMPLICIT_CONVERSION;
return result;
}
static void
......@@ -3237,7 +3235,8 @@ static void
dump_metadata_for_pdumper (struct dump_context *ctx)
{
for (int i = 0; i < nr_dump_hooks; ++i)
dump_emacs_reloc_to_emacs_ptr_raw (ctx, &dump_hooks[i], dump_hooks[i]);
dump_emacs_reloc_to_emacs_ptr_raw (ctx, &dump_hooks[i],
(void const *) dump_hooks[i]);
dump_emacs_reloc_immediate_int (ctx, &nr_dump_hooks, nr_dump_hooks);
for (int i = 0; i < nr_remembered_data; ++i)
......@@ -3801,8 +3800,8 @@ dump_merge_emacs_relocs (Lisp_Object lreloc_a, Lisp_Object lreloc_b)
dump_off_to_lisp (reloc_a.length));
}
typedef void (*drain_reloc_handler)(struct dump_context *, Lisp_Object);
typedef Lisp_Object (*drain_reloc_merger)(Lisp_Object a, Lisp_Object b);
typedef void (*drain_reloc_handler) (struct dump_context *, Lisp_Object);
typedef Lisp_Object (*drain_reloc_merger) (Lisp_Object a, Lisp_Object b);
static void
drain_reloc_list (struct dump_context *ctx,
......@@ -4040,7 +4039,7 @@ types. */)
ctx->deferred_symbols = Qnil;
ctx->fixups = Qnil;
ctx->staticpro_table = CALLN (Fmake_hash_table);
ctx->staticpro_table = Fmake_hash_table (0, NULL);
ctx->symbol_aux = Qnil;
ctx->copied_queue = Qnil;
ctx->cold_queue = Qnil;
......@@ -4587,7 +4586,7 @@ struct dump_memory_map
{
struct dump_memory_map_spec spec;
void *mapping; /* Actual mapped memory. */
void (*release)(struct dump_memory_map *);
void (*release) (struct dump_memory_map *);
void *private;
};
......
......@@ -1787,7 +1787,7 @@ print_vectorlike (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag,
case PVEC_MODULE_FUNCTION:
{
print_c_string ("#<module function ", printcharfun);
void *ptr = module_function_address (XMODULE_FUNCTION (obj));
module_funcptr ptr = module_function_address (XMODULE_FUNCTION (obj));
const char *file = NULL;
const char *symbol = NULL;
dynlib_addr (ptr, &file, &symbol);
......
......@@ -32910,14 +32910,18 @@ which no explicit name has been set (see `modify-frame-parameters'). */);
This variable has the same structure as `mode-line-format' (which see),
and is used only on frames for which no explicit name has been set
\(see `modify-frame-parameters'). */);
/* Do not nest calls to pure_list. This works around a bug in
Oracle Developer Studio 12.6. */
Lisp_Object icon_title_name_format
= pure_list (empty_unibyte_string,
intern_c_string ("invocation-name"),
build_pure_c_string ("@"),
intern_c_string ("system-name"));
Vicon_title_format
= Vframe_title_format
= pure_list (intern_c_string ("multiple-frames"),
build_pure_c_string ("%b"),
pure_list (empty_unibyte_string,
intern_c_string ("invocation-name"),
build_pure_c_string ("@"),
intern_c_string ("system-name")));
icon_title_name_format);
DEFVAR_LISP ("message-log-max", Vmessage_log_max,
doc: /* Maximum number of lines to keep in the message log buffer.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment