include asn1/asn1c/Makefile.include
fort_SOURCES += $(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS)
-fort_CFLAGS = -Wall -Wno-cpp -Wpedantic
+fort_CFLAGS = -Wall -Wpedantic
# Feel free to temporarily remove this one if you're not using gcc 7.3.0.
#fort_CFLAGS += $(GCC_WARNS)
-fort_CFLAGS += -std=gnu11 -O2 -g $(FORT_FLAGS) ${XML2_CFLAGS}
+fort_CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809 -D_XOPEN_SOURCE=700
+fort_CFLAGS += -O2 -g $(FORT_FLAGS) ${XML2_CFLAGS}
if BACKTRACE_ENABLED
fort_CFLAGS += -DBACKTRACE_ENABLED
endif
-#define _XOPEN_SOURCE 500 /* strdup() */
-
#include "alloc.h"
#include "log.h"
* Redistribution and modifications are permitted subject to BSD license.
*/
-#define _XOPEN_SOURCE 500 /* snprintf() */
-
#include <assert.h>
#include "asn1/asn1c/asn_internal.h"
#define _REENTRANT /* for Sun */
#define __EXTENSIONS__ /* for Sun */
-#define _XOPEN_SOURCE 600 /* snprintf(), timezone */
-#define _POSIX_C_SOURCE 200112L /* gmtime_r(), localtime_r(), tzset() */
-
#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/GeneralizedTime.h"
* Redistribution and modifications are permitted subject to BSD license.
*/
-#define _XOPEN_SOURCE 500 /* snprintf() */
-
#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/INTEGER.h"
#include "asn1/asn1c/OBJECT_IDENTIFIER.h"
* Redistribution and modifications are permitted subject to BSD license.
*/
-#define _XOPEN_SOURCE 500 /* snprintf() */
-
#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/UTCTime.h"
#include "asn1/asn1c/GeneralizedTime.h"
* Redistribution and modifications are permitted subject to BSD license.
*/
-#define _XOPEN_SOURCE 500 /* snprintf() */
-
#include <assert.h>
#include "asn1/asn1c/asn_system.h"
-#define _XOPEN_SOURCE 500 /* vsnprintf() */
-
#include "asn1/asn1c/asn_internal.h"
#include <stdarg.h>
* Redistribution and modifications are permitted subject to BSD license.
*/
-#define _XOPEN_SOURCE 500 /* snprintf() */
-
#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/ber_tlv_tag.h"
#include <errno.h>
-#define _XOPEN_SOURCE 500 /* vsnprintf() */
-
#include "asn1/asn1c/asn_internal.h"
#include "asn1/asn1c/constraints.h"
#include <stdarg.h>
-#define _XOPEN_SOURCE 600 /* strptime() */
-#define _POSIX_C_SOURCE 200112L /* localtime_r(), strtok_r() */
-
#include "cache/local_cache.h"
#include <time.h>
-#define _GNU_SOURCE /* getopt_long() */
-
#include "config.h"
#include <getopt.h>
-#define _XOPEN_SOURCE 500 /* snprintf() */
-
#include "data_structure/path_builder.h"
#include <errno.h>
-#define _XOPEN_SOURCE 600 /* nftw() */
-#define _POSIX_C_SOURCE 200112L /* fileno() */
-
#include "file.h"
#include <ftw.h>
-#define _POSIX_C_SOURCE 200112L /* strtok_r() */
-
#include "json_handler.h"
#include <errno.h>
* because getline is normally meant to be used repeatedly with a
* recycled buffer. (free() is a no-op if its argument is NULL so go
* nuts.)
+ *
+ * Update: If you remove getline(), consider downgrading _POSIX_C_SOURCE
+ * to 200112L. (And _XOPEN_SOURCE to 600.)
*/
string = NULL;
-#define _XOPEN_SOURCE 600 /* vsnprintf() */
-#define _POSIX_C_SOURCE 200112L /* localtime_r() */
-
#include "log.h"
#ifdef BACKTRACE_ENABLED
-#define _POSIX_C_SOURCE 200112L /* localtime_r() */
-
#include "object/manifest.h"
#include "algorithm.h"
-/* getaddrinfo(), freeaddrinfo(), gai_strerror() */
-#define _POSIX_C_SOURCE 200112L
-
#include "rtr/rtr.h"
#include <errno.h>
}
}
+bool
+addr6_equals(struct in6_addr const *a, struct in6_addr const *b)
+{
+ unsigned int i;
+ for (i = 0; i < INET_ADDRSTRLEN; i++) {
+ if (a->s6_addr[i] != b->s6_addr[i])
+ return false;
+ }
+ return true;
+}
+
bool
prefix4_equals(struct ipv4_prefix const *a, struct ipv4_prefix const *b)
{
bool
prefix6_equals(struct ipv6_prefix const *a, struct ipv6_prefix const *b)
{
- return (a->len == b->len) && IN6_ARE_ADDR_EQUAL(&a->addr, &b->addr);
+ return (a->len == b->len) && addr6_equals(&a->addr, &b->addr);
}
/**
uint32_t u32_suffix_mask(unsigned int);
void ipv6_suffix_mask(unsigned int, struct in6_addr *);
+bool addr6_equals(struct in6_addr const *, struct in6_addr const *);
+
bool prefix4_equals(struct ipv4_prefix const *, struct ipv4_prefix const *);
bool prefix6_equals(struct ipv6_prefix const *, struct ipv6_prefix const *);
case AF_INET:
return a->prefix.v4.s_addr == b->prefix.v4.s_addr;
case AF_INET6:
- return IN6_ARE_ADDR_EQUAL(&a->prefix.v6, &b->prefix.v6);
+ return addr6_equals(&a->prefix.v6, &b->prefix.v6);
}
pr_crit("Unknown address family: %u", a->addr_fam);
-#define _XOPEN_SOURCE 500 /* vsnprintf() */
-
#include "xml/relax_ng.h"
#include <stdarg.h>
# <mumble>_CFLAGS is not defined.
# Otherwise it must be included manually:
# mumble_mumble_CFLAGS = ${AM_CFLAGS} flag1 flag2 flag3 ...
-AM_CFLAGS = -pedantic -Wall -std=gnu11 -I../src -DUNIT_TESTING ${CHECK_CFLAGS} ${XML2_CFLAGS}
+AM_CFLAGS = -pedantic -Wall
+AM_CFLAGS += -std=c99 -D_POSIX_C_SOURCE=200809 -D_XOPEN_SOURCE=700
+AM_CFLAGS += -I../src -DUNIT_TESTING ${CHECK_CFLAGS} ${XML2_CFLAGS}
# Reminder: As opposed to AM_CFLAGS, "AM_LDADD" is not idiomatic automake, and
# autotools will even reprehend us if we declare it. Therefore, I came up with
# "my" own "ldadd". Unlike AM_CFLAGS, it needs to be manually added to every
/* This test will create temporal directory "tmp/". Needs permissions. */
-#define _XOPEN_SOURCE 500 /* snprintf() */
-
#include "cache/local_cache.c"
#include <check.h>
-#define _XOPEN_SOURCE 500
-
#include <check.h>
#include <errno.h>
#include <stdlib.h>
#include <errno.h>
#include <arpa/inet.h>
#include "state.h"
+#include "config/filename_format.h"
+#include "config/mode.h"
#include "incidence/incidence.h"
/**
return (AF_INET6 == vrp->addr_fam)
&& (as == vrp->asn)
- && IN6_ARE_ADDR_EQUAL(&tmp, &vrp->prefix.v6)
+ && addr6_equals(&tmp, &vrp->prefix.v6)
&& (prefix_len == vrp->prefix_length)
&& (max_prefix_len == vrp->max_prefix_length);
}
-#define _XOPEN_SOURCE 500 /* nftw() */
-
#include <check.h>
#include <stdbool.h>
#include <stdlib.h>
unsigned int deltas_lifetime = 5;
MOCK_UINT(config_get_deltas_lifetime, deltas_lifetime, void)
-MOCK_VOID(cache_prepare, void)
+MOCK_INT(cache_prepare, 0, void)
/* Test functions */
case AF_INET6:
in6_addr_init(&tmp, 0x20010DB8u, 0, 0, 0);
- ck_assert(IN6_ARE_ADDR_EQUAL(&tmp, &vrp->prefix.v6));
+ ck_assert(addr6_equals(&tmp, &vrp->prefix.v6));
ck_assert_uint_eq(96, vrp->prefix_length);
ck_assert_uint_eq(120, vrp->max_prefix_length);
family_bit = 1;
-#define _XOPEN_SOURCE 500
-
#include <check.h>
#include <stdlib.h>
#include <unistd.h>
MOCK_ABORT_INT(read_int32, struct pdu_reader *reader, uint32_t *result)
MOCK_ABORT_INT(read_int8, struct pdu_reader *reader, uint8_t *result)
-MOCK_VOID(cache_prepare, void)
+MOCK_INT(cache_prepare, 0, void)
MOCK_INT(slurm_apply, 0, struct db_table *base, struct db_slurm **slurm)
MOCK_ABORT_VOID(db_slurm_destroy, struct db_slurm *db)
ck_assert_uint_eq(pdu.max_length, 35);
ck_assert_uint_eq(pdu.zero, 36);
in6_addr_init(&tmp, 0x25262728, 0x292a2b2c, 0x2d2e2f30, 0x31323334);
- ck_assert(IN6_ARE_ADDR_EQUAL(&tmp, &pdu.ipv6_prefix));
+ ck_assert(addr6_equals(&tmp, &pdu.ipv6_prefix));
ck_assert_uint_eq(pdu.asn, 0x35363738);
}
END_TEST
-#define _XOPEN_SOURCE 500 /* nftw() */
-
#include "object/tal.c"
#include <check.h>