Blame ares_rules.h

Packit 514978
#ifndef __CARES_RULES_H
Packit 514978
#define __CARES_RULES_H
Packit 514978
Packit 514978
Packit 514978
/* Copyright (C) 2009 by Daniel Stenberg et al
Packit 514978
 *
Packit 514978
 * Permission to use, copy, modify, and distribute this software and its
Packit 514978
 * documentation for any purpose and without fee is hereby granted, provided
Packit 514978
 * that the above copyright notice appear in all copies and that both that
Packit 514978
 * copyright notice and this permission notice appear in supporting
Packit 514978
 * documentation, and that the name of M.I.T. not be used in advertising or
Packit 514978
 * publicity pertaining to distribution of the software without specific,
Packit 514978
 * written prior permission.  M.I.T. makes no representations about the
Packit 514978
 * suitability of this software for any purpose.  It is provided "as is"
Packit 514978
 * without express or implied warranty.
Packit 514978
 */
Packit 514978
Packit 514978
/* ================================================================ */
Packit 514978
/*                    COMPILE TIME SANITY CHECKS                    */
Packit 514978
/* ================================================================ */
Packit 514978
Packit 514978
/*
Packit 514978
 * NOTE 1:
Packit 514978
 * -------
Packit 514978
 *
Packit 514978
 * All checks done in this file are intentionally placed in a public
Packit 514978
 * header file which is pulled by ares.h when an application is
Packit 514978
 * being built using an already built c-ares library. Additionally
Packit 514978
 * this file is also included and used when building the library.
Packit 514978
 *
Packit 514978
 * If compilation fails on this file it is certainly sure that the
Packit 514978
 * problem is elsewhere. It could be a problem in the ares_build.h
Packit 514978
 * header file, or simply that you are using different compilation
Packit 514978
 * settings than those used to build the library.
Packit 514978
 *
Packit 514978
 * Nothing in this file is intended to be modified or adjusted by the
Packit 514978
 * c-ares library user nor by the c-ares library builder.
Packit 514978
 *
Packit 514978
 * Do not deactivate any check, these are done to make sure that the
Packit 514978
 * library is properly built and used.
Packit 514978
 *
Packit 514978
 * You can find further help on the c-ares development mailing list:
Packit 514978
 * http://cool.haxx.se/mailman/listinfo/c-ares/
Packit 514978
 *
Packit 514978
 * NOTE 2
Packit 514978
 * ------
Packit 514978
 *
Packit 514978
 * Some of the following compile time checks are based on the fact
Packit 514978
 * that the dimension of a constant array can not be a negative one.
Packit 514978
 * In this way if the compile time verification fails, the compilation
Packit 514978
 * will fail issuing an error. The error description wording is compiler
Packit 514978
 * dependent but it will be quite similar to one of the following:
Packit 514978
 *
Packit 514978
 *   "negative subscript or subscript is too large"
Packit 514978
 *   "array must have at least one element"
Packit 514978
 *   "-1 is an illegal array size"
Packit 514978
 *   "size of array is negative"
Packit 514978
 *
Packit 514978
 * If you are building an application which tries to use an already
Packit 514978
 * built c-ares library and you are getting this kind of errors on
Packit 514978
 * this file, it is a clear indication that there is a mismatch between
Packit 514978
 * how the library was built and how you are trying to use it for your
Packit 514978
 * application. Your already compiled or binary library provider is the
Packit 514978
 * only one who can give you the details you need to properly use it.
Packit 514978
 */
Packit 514978
Packit 514978
/*
Packit 514978
 * Verify that some macros are actually defined.
Packit 514978
 */
Packit 514978
Packit 514978
#ifndef CARES_TYPEOF_ARES_SOCKLEN_T
Packit 514978
#  error "CARES_TYPEOF_ARES_SOCKLEN_T definition is missing!"
Packit 514978
   Error Compilation_aborted_CARES_TYPEOF_ARES_SOCKLEN_T_is_missing
Packit 514978
#endif
Packit 514978
Packit 514978
/*
Packit 514978
 * Macros private to this header file.
Packit 514978
 */
Packit 514978
Packit 514978
#define CareschkszEQ(t, s) sizeof(t) == s ? 1 : -1
Packit 514978
Packit 514978
#define CareschkszGE(t1, t2) sizeof(t1) >= sizeof(t2) ? 1 : -1
Packit 514978
Packit 514978
/*
Packit 514978
 * Verify that the size previously defined and expected for
Packit 514978
 * ares_socklen_t is actually the the same as the one reported
Packit 514978
 * by sizeof() at compile time.
Packit 514978
 */
Packit 514978
Packit 514978
typedef char
Packit 514978
  __cares_rule_02__
Packit 514978
    [CareschkszEQ(ares_socklen_t, sizeof(CARES_TYPEOF_ARES_SOCKLEN_T))];
Packit 514978
Packit 514978
/*
Packit 514978
 * Verify at compile time that the size of ares_socklen_t as reported
Packit 514978
 * by sizeof() is greater or equal than the one reported for int for
Packit 514978
 * the current compilation.
Packit 514978
 */
Packit 514978
Packit 514978
typedef char
Packit 514978
  __cares_rule_03__
Packit 514978
    [CareschkszGE(ares_socklen_t, int)];
Packit 514978
Packit 514978
/* ================================================================ */
Packit 514978
/*          EXTERNALLY AND INTERNALLY VISIBLE DEFINITIONS           */
Packit 514978
/* ================================================================ */
Packit 514978
Packit 514978
/*
Packit 514978
 * Get rid of macros private to this header file.
Packit 514978
 */
Packit 514978
Packit 514978
#undef CareschkszEQ
Packit 514978
#undef CareschkszGE
Packit 514978
Packit 514978
/*
Packit 514978
 * Get rid of macros not intended to exist beyond this point.
Packit 514978
 */
Packit 514978
Packit 514978
#undef CARES_PULL_WS2TCPIP_H
Packit 514978
#undef CARES_PULL_SYS_TYPES_H
Packit 514978
#undef CARES_PULL_SYS_SOCKET_H
Packit 514978
Packit 514978
#undef CARES_TYPEOF_ARES_SOCKLEN_T
Packit 514978
Packit 514978
#endif /* __CARES_RULES_H */