Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:24
erlang
0567-Fix-function-declaration-mismatch-warning-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0567-Fix-function-declaration-mismatch-warning-with-gcc-1.patch of Package erlang
From 9bb8038e91f3dd3f0c311a0877fd5443bfcaf2c7 Mon Sep 17 00:00:00 2001 From: Mikael Pettersson <mikpelinux@gmail.com> Date: Sat, 2 Dec 2023 14:51:44 +0100 Subject: [PATCH] Fix function declaration mismatch warning with gcc-13/14: beam/erl_nif.c:1476:8: warning: conflicting types for 'enif_binary_to_term' due to enum/integer mismatch; have 'size_t(ErlNifEnv *, const unsigned char *, size_t, ERL_NIF_TERM *, ErlNifBinaryToTerm)' {aka 'long unsigned int(struct enif_environment_t *, const unsigned char *, long unsigned int, long unsigned int *, ErlNifBinaryToTerm)'} [-Wenum-int-mismatch] 1476 | size_t enif_binary_to_term(ErlNifEnv *dst_env, | ^~~~~~~~~~~~~~~~~~~ In file included from beam/erl_nif.c:44: beam/erl_nif_api_funcs.h:174:31: note: previous declaration of 'enif_binary_to_term' with type 'size_t(ErlNifEnv *, const unsigned char *, size_t, ERL_NIF_TERM *, unsigned int)' {aka 'long unsigned int(struct enif_environment_t *, const unsigned char *, long unsigned int, long unsigned int *, unsigned int)'} 174 | ERL_NIF_API_FUNC_DECL(size_t, enif_binary_to_term, (ErlNifEnv *env, const unsigned char* data, size_t sz, ERL_NIF_TERM *term, unsigned int opts)); | ^~~~~~~~~~~~~~~~~~~ beam/erl_nif.h:369:71: note: in definition of macro 'ERL_NIF_API_FUNC_DECL' 369 | # define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) extern RET_TYPE NAME ARGS | ^~~~ 0 is a valid parameter but is not in the enum, so the extern declaration is the correct one. Changed the function definition, documentation, and a test case to match. --- erts/doc/src/erl_nif.xml | 2 +- erts/emulator/beam/erl_nif.c | 2 +- erts/emulator/test/nif_SUITE_data/nif_SUITE.c | 3 +-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/erts/doc/src/erl_nif.xml b/erts/doc/src/erl_nif.xml index 4d31879c6a..e182374753 100644 --- a/erts/doc/src/erl_nif.xml +++ b/erts/doc/src/erl_nif.xml @@ -1112,7 +1112,7 @@ typedef struct { <func> <name since="OTP 19.0"><ret>size_t</ret><nametext>enif_binary_to_term(ErlNifEnv *env, const unsigned char* data, size_t size, ERL_NIF_TERM *term, - ErlNifBinaryToTerm opts)</nametext></name> + unsigned int opts)</nametext></name> <fsummary>Create a term from the external format.</fsummary> <desc> <p>Creates a term that is the result of decoding the binary data at diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index a9661dc780..3150881cc4 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1477,7 +1477,7 @@ size_t enif_binary_to_term(ErlNifEnv *dst_env, const unsigned char* data, size_t data_sz, ERL_NIF_TERM *term, - ErlNifBinaryToTerm opts) + unsigned int opts) { Sint size; ErtsHeapFactory factory; diff --git a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c index 5ae97e529d..fb7fe70dfe 100644 --- a/erts/emulator/test/nif_SUITE_data/nif_SUITE.c +++ b/erts/emulator/test/nif_SUITE_data/nif_SUITE.c @@ -2558,8 +2558,7 @@ static ERL_NIF_TERM binary_to_term(ErlNifEnv* env, int argc, const ERL_NIF_TERM /* build dummy heap term first to provoke OTP-15080 */ dummy = enif_make_list_cell(msg_env, atom_true, atom_false); - ret = enif_binary_to_term(msg_env, bin.data, bin.size, &term, - (ErlNifBinaryToTerm)opts); + ret = enif_binary_to_term(msg_env, bin.data, bin.size, &term, opts); if (!ret) return atom_false; -- 2.35.3
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor