From 1536da3105541257feca627e52ec896a33b4d136 Mon Sep 17 00:00:00 2001 From: Andre Maroneze <andre.oliveiramaroneze@cea.fr> Date: Mon, 8 Jun 2020 14:58:36 +0200 Subject: [PATCH] [Libc] remove definition from .h (use .c instead) --- headers/header_spec.txt | 1 + share/libc/__fc_inet.h | 7 ++----- share/libc/__fc_runtime.c | 1 + share/libc/netinet/in.c | 29 +++++++++++++++++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 share/libc/netinet/in.c diff --git a/headers/header_spec.txt b/headers/header_spec.txt index 7a5d5138ee1..4c33aba539b 100644 --- a/headers/header_spec.txt +++ b/headers/header_spec.txt @@ -252,6 +252,7 @@ share/libc/n1362.pdf: .ignore share/libc/net/if.h: CEA_LGPL share/libc/netdb.c: CEA_LGPL share/libc/netdb.h: CEA_LGPL +share/libc/netinet/in.c: CEA_LGPL share/libc/netinet/in.h: CEA_LGPL share/libc/netinet/ip.h: CEA_LGPL share/libc/netinet/tcp.h: CEA_LGPL diff --git a/share/libc/__fc_inet.h b/share/libc/__fc_inet.h index 5904cd5fff1..a3d3a750b63 100644 --- a/share/libc/__fc_inet.h +++ b/share/libc/__fc_inet.h @@ -83,11 +83,8 @@ struct sockaddr_in6 { // Not required by POSIX #define INADDR_LOOPBACK (uint32_t)0x7F000001 -const struct in6_addr in6addr_any={{0}}; -const struct in6_addr in6addr_loopback= - {{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, - 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}} - ; +extern const struct in6_addr in6addr_any; +extern const struct in6_addr in6addr_loopback; struct ipv6_mreq { struct in6_addr ipv6mr_multiaddr; diff --git a/share/libc/__fc_runtime.c b/share/libc/__fc_runtime.c index 6c9dff3a432..fc29185b4ed 100644 --- a/share/libc/__fc_runtime.c +++ b/share/libc/__fc_runtime.c @@ -31,6 +31,7 @@ #include "locale.c" #include "math.c" #include "netdb.c" +#include "netinet/in.c" #include "signal.c" #include "stdio.c" #include "stdlib.c" diff --git a/share/libc/netinet/in.c b/share/libc/netinet/in.c new file mode 100644 index 00000000000..cc893c285e3 --- /dev/null +++ b/share/libc/netinet/in.c @@ -0,0 +1,29 @@ +/**************************************************************************/ +/* */ +/* This file is part of Frama-C. */ +/* */ +/* Copyright (C) 2007-2021 */ +/* CEA (Commissariat à l'énergie atomique et aux énergies */ +/* alternatives) */ +/* */ +/* you can redistribute it and/or modify it under the terms of the GNU */ +/* Lesser General Public License as published by the Free Software */ +/* Foundation, version 2.1. */ +/* */ +/* It is distributed in the hope that it will be useful, */ +/* but WITHOUT ANY WARRANTY; without even the implied warranty of */ +/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */ +/* GNU Lesser General Public License for more details. */ +/* */ +/* See the GNU Lesser General Public License version 2.1 */ +/* for more details (enclosed in the file licenses/LGPLv2.1). */ +/* */ +/**************************************************************************/ + +#include "in.h" + +const struct in6_addr in6addr_any={{0}}; +const struct in6_addr in6addr_loopback= + {{0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, + 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF}} + ; -- GitLab