mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-28 04:34:54 -04:00
The Windows support has been completely removed from the source tree and BIND 9 now no longer supports native compilation on Windows. We might consider reviewing mingw-w64 port if contributed by external party, but no development efforts will be put into making BIND 9 compile and run on Windows again.
78 lines
2.8 KiB
C
78 lines
2.8 KiB
C
/*
|
|
* Copyright (C) Internet Systems Consortium, Inc. ("ISC")
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, you can obtain one at https://mozilla.org/MPL/2.0/.
|
|
*
|
|
* See the COPYRIGHT file distributed with this work for additional
|
|
* information regarding copyright ownership.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#if HAVE_FUNC_ATTRIBUTE_NORETURN
|
|
#define ISC_NORETURN __attribute__((noreturn))
|
|
#else
|
|
#define ISC_NORETURN
|
|
#endif
|
|
|
|
#if HAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL
|
|
#define ISC_ATTR_RETURNS_NONNULL __attribute__((returns_nonnull))
|
|
#else
|
|
#define ISC_ATTR_RETURNS_NONNULL
|
|
#endif
|
|
|
|
#ifdef HAVE_FUNC_ATTRIBUTE_MALLOC
|
|
/*
|
|
* Indicates that a function is malloc-like, i.e., that the
|
|
* pointer P returned by the function cannot alias any other
|
|
* pointer valid when the function returns.
|
|
*/
|
|
#define ISC_ATTR_MALLOC __attribute__((malloc))
|
|
#if HAVE_MALLOC_EXT_ATTR
|
|
/*
|
|
* Associates deallocator as a suitable deallocation function
|
|
* for pointers returned from the function marked with the attribute.
|
|
*/
|
|
#define ISC_ATTR_DEALLOCATOR(deallocator) __attribute__((malloc(deallocator)))
|
|
/*
|
|
* Similar to ISC_ATTR_DEALLOCATOR, but allows to speficy an index "idx",
|
|
* which denotes the positional argument to which when the pointer is passed
|
|
* in calls to deallocator has the effect of deallocating it.
|
|
*/
|
|
#define ISC_ATTR_DEALLOCATOR_IDX(deallocator, idx) \
|
|
__attribute__((malloc(deallocator, idx)))
|
|
/*
|
|
* Combines both ISC_ATTR_MALLOC and ISC_ATTR_DEALLOCATOR attributes.
|
|
*/
|
|
#define ISC_ATTR_MALLOC_DEALLOCATOR(deallocator) \
|
|
__attribute__((malloc, malloc(deallocator)))
|
|
/*
|
|
* Similar to ISC_ATTR_MALLOC_DEALLOCATOR, but allows to speficy an index "idx",
|
|
* which denotes the positional argument to which when the pointer is passed
|
|
* in calls to deallocator has the effect of deallocating it.
|
|
*/
|
|
#define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx) \
|
|
__attribute__((malloc, malloc(deallocator, idx)))
|
|
#else /* #ifdef HAVE_MALLOC_EXT_ATTR */
|
|
/*
|
|
* There is support for malloc attribute but not for
|
|
* extended attributes, so macros that combine attribute malloc
|
|
* with a deallocator will only expand to malloc attribute.
|
|
*/
|
|
#define ISC_ATTR_DEALLOCATOR(deallocator)
|
|
#define ISC_ATTR_DEALLOCATOR_IDX(deallocator, idx)
|
|
#define ISC_ATTR_MALLOC_DEALLOCATOR(deallocator) ISC_ATTR_MALLOC
|
|
#define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx) ISC_ATTR_MALLOC
|
|
#endif
|
|
#else /* #ifdef HAVE_FUNC_ATTRIBUTE_MALLOC */
|
|
/*
|
|
* There is no support for malloc attribute.
|
|
*/
|
|
#define ISC_ATTR_MALLOC
|
|
#define ISC_ATTR_DEALLOCATOR(deallocator)
|
|
#define ISC_ATTR_DEALLOCATOR_IDX(deallocator, idx)
|
|
#define ISC_ATTR_MALLOC_DEALLOCATOR(deallocator)
|
|
#define ISC_ATTR_MALLOC_DEALLOCATOR_IDX(deallocator, idx)
|
|
#endif /* HAVE_FUNC_ATTRIBUTE_MALLOC */
|