mirror of
https://github.com/matrix-construct/construct
synced 2024-12-27 07:54:05 +01:00
Remove s_assert definition from ircd_defs.h and add it to its own header.
s_assert requires some higher-level functionality that shouldn't be present in ircd_defs.h. ircd_defs.h is used by ssld, which has no notion of logging or sending IRC messages. Additionally, some of the headers s_assert depends on result in conflicting definitions in ssld.c. This change also fixes the compile when using --enable-assert=soft.
This commit is contained in:
parent
d8c3d5fe97
commit
77d3d2dbaf
48 changed files with 120 additions and 31 deletions
|
@ -18,6 +18,7 @@
|
|||
#include "s_newconf.h"
|
||||
#include "hash.h"
|
||||
#include "messages.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
/* {{{ Structures */
|
||||
#define HURT_CUTOFF (10) /* protocol messages. */
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "s_conf.h"
|
||||
#include "modules.h"
|
||||
#include "messages.h"
|
||||
#include "send.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "s_conf.h"
|
||||
#include "s_serv.h"
|
||||
#include "messages.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int mo_okick(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "modules.h"
|
||||
#include "packet.h"
|
||||
#include "messages.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int mo_omode(struct Client *, struct Client *, int, const char **);
|
||||
|
||||
|
|
|
@ -59,37 +59,6 @@
|
|||
#define IRC_DEPRECATED
|
||||
#endif
|
||||
|
||||
#include "logger.h"
|
||||
#include "send.h"
|
||||
|
||||
#ifdef SOFT_ASSERT
|
||||
#ifdef __GNUC__
|
||||
#define s_assert(expr) do \
|
||||
if(!(expr)) { \
|
||||
ilog(L_MAIN, \
|
||||
"file: %s line: %d (%s): Assertion failed: (%s)", \
|
||||
__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, \
|
||||
"file: %s line: %d (%s): Assertion failed: (%s)", \
|
||||
__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
|
||||
} \
|
||||
while(0)
|
||||
#else
|
||||
#define s_assert(expr) do \
|
||||
if(!(expr)) { \
|
||||
ilog(L_MAIN, \
|
||||
"file: %s line: %d: Assertion failed: (%s)", \
|
||||
__FILE__, __LINE__, #expr); \
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, \
|
||||
"file: %s line: %d: Assertion failed: (%s)" \
|
||||
__FILE__, __LINE__, #expr); \
|
||||
} \
|
||||
while(0)
|
||||
#endif
|
||||
#else
|
||||
#define s_assert(expr) assert(expr)
|
||||
#endif
|
||||
|
||||
#if !defined(CONFIG_RATBOX_LEVEL_1)
|
||||
# error Incorrect config.h for this revision of ircd.
|
||||
#endif
|
||||
|
|
64
include/s_assert.h
Normal file
64
include/s_assert.h
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* charybdis: An advanced IRCd.
|
||||
* s_assert.h: Definition of the soft assert (s_assert) macro.
|
||||
*
|
||||
* Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center
|
||||
* Copyright (C) 1996-2002 Hybrid Development Team
|
||||
* Copyright (C) 2002-2004 ircd-ratbox development team
|
||||
* Copyright (C) 2005-2013 Charybdis development team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
||||
* USA
|
||||
*/
|
||||
|
||||
#ifndef INCLUDED_s_assert_h
|
||||
#define INCLUDED_s_assert_h
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef SOFT_ASSERT
|
||||
|
||||
#include "logger.h"
|
||||
#include "send.h"
|
||||
#include "snomask.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define s_assert(expr) do \
|
||||
if(!(expr)) { \
|
||||
ilog(L_MAIN, \
|
||||
"file: %s line: %d (%s): Assertion failed: (%s)", \
|
||||
__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, \
|
||||
"file: %s line: %d (%s): Assertion failed: (%s)", \
|
||||
__FILE__, __LINE__, __PRETTY_FUNCTION__, #expr); \
|
||||
} \
|
||||
while(0)
|
||||
#else
|
||||
#define s_assert(expr) do \
|
||||
if(!(expr)) { \
|
||||
ilog(L_MAIN, \
|
||||
"file: %s line: %d: Assertion failed: (%s)", \
|
||||
__FILE__, __LINE__, #expr); \
|
||||
sendto_realops_snomask(SNO_GENERAL, L_ALL, \
|
||||
"file: %s line: %d: Assertion failed: (%s)" \
|
||||
__FILE__, __LINE__, #expr); \
|
||||
} \
|
||||
while(0)
|
||||
#endif
|
||||
#else
|
||||
#define s_assert(expr) assert(expr)
|
||||
#endif
|
||||
|
||||
#endif /* INCLUDED_s_assert_h */
|
|
@ -25,6 +25,8 @@
|
|||
#define INCLUDED_tgchange_h
|
||||
|
||||
#include "ircd_defs.h"
|
||||
#include "client.h"
|
||||
#include "channel.h"
|
||||
|
||||
/* finds a channel where source_p has op or voice and target_p is a member */
|
||||
struct Channel *find_allowing_channel(struct Client *source_p, struct Client *target_p);
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "operhash.h"
|
||||
#include "reject.h"
|
||||
#include "hostmask.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int m_ban(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||
static int ms_ban(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "packet.h"
|
||||
#include "chmode.h"
|
||||
#include "ratelimit.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static int m_join(struct Client *, struct Client *, int, const char **);
|
||||
static int ms_join(struct Client *, struct Client *, int, const char **);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "scache.h"
|
||||
#include "s_newconf.h"
|
||||
#include "monitor.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
/* Give all UID nicks the same TS. This ensures nick TS is always the same on
|
||||
* all servers for each nick-user pair, also if a user with a UID nick changes
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "modules.h"
|
||||
#include "s_serv.h"
|
||||
#include "s_user.h"
|
||||
#include "send.h"
|
||||
|
||||
typedef int (*bqcmp)(const void *, const void *);
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "msg.h"
|
||||
#include "parse.h"
|
||||
#include "modules.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int mo_etrace(struct Client *, struct Client *, int, const char **);
|
||||
static int me_etrace(struct Client *, struct Client *, int, const char **);
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "modules.h"
|
||||
#include "hook.h"
|
||||
#include "scache.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static int m_links(struct Client *, struct Client *, int, const char **);
|
||||
static int mo_links(struct Client *, struct Client *, int, const char **);
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
#include "parse.h"
|
||||
#include "modules.h"
|
||||
#include "inline/stringops.h"
|
||||
#include "s_assert.h"
|
||||
#include "logger.h"
|
||||
|
||||
static rb_dlink_list safelisting_clients = { NULL, NULL, 0 };
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "monitor.h"
|
||||
#include "numeric.h"
|
||||
#include "s_conf.h"
|
||||
#include "send.h"
|
||||
|
||||
static int m_monitor(struct Client *, struct Client *, int, const char **);
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "msg.h"
|
||||
#include "parse.h"
|
||||
#include "modules.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int ms_operspy(struct Client *client_p, struct Client *source_p,
|
||||
int parc, const char *parv[]);
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "msg.h"
|
||||
#include "parse.h"
|
||||
#include "modules.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int mo_scan(struct Client *, struct Client *, int, const char **);
|
||||
static int scan_umodes(struct Client *, struct Client *, int, const char **);
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include "msg.h"
|
||||
#include "modules.h"
|
||||
#include "sslproc.h"
|
||||
#include "s_assert.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int mr_starttls(struct Client *, struct Client *, int, const char **);
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "modules.h"
|
||||
#include "packet.h"
|
||||
#include "tgchange.h"
|
||||
#include "logger.h"
|
||||
|
||||
static int m_topic(struct Client *, struct Client *, int, const char **);
|
||||
static int ms_topic(struct Client *, struct Client *, int, const char **);
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "parse.h"
|
||||
#include "modules.h"
|
||||
#include "blacklist.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static int mr_user(struct Client *, struct Client *, int, const char **);
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "s_newconf.h"
|
||||
#include "ipv4_from_ipv6.h"
|
||||
#include "ratelimit.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static void do_whois(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]);
|
||||
static void single_whois(struct Client *source_p, struct Client *target_p, int operspy);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "s_conf.h"
|
||||
#include "s_user.h"
|
||||
#include "blacklist.h"
|
||||
#include "send.h"
|
||||
|
||||
rb_dlink_list blacklist_list = { NULL, NULL, 0 };
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "cache.h"
|
||||
#include "irc_dictionary.h"
|
||||
#include "numeric.h"
|
||||
#include "send.h"
|
||||
|
||||
struct cachefile *user_motd = NULL;
|
||||
struct cachefile *oper_motd = NULL;
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "stdinc.h"
|
||||
#include "capability.h"
|
||||
#include "irc_dictionary.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static rb_dlink_list capability_indexes = { NULL, NULL, 0 };
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "s_newconf.h"
|
||||
#include "logger.h"
|
||||
#include "ipv4_from_ipv6.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
struct config_channel_entry ConfigChannel;
|
||||
rb_dlink_list global_channel_list;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "s_newconf.h"
|
||||
#include "logger.h"
|
||||
#include "chmode.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
/* bitmasks for error returns, so we send once per call */
|
||||
#define SM_ERR_NOTS 0x00000001 /* No TS on channel */
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "scache.h"
|
||||
#include "irc_dictionary.h"
|
||||
#include "sslproc.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
#define DEBUG_EXITED_CLIENTS
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "msg.h"
|
||||
#include "cache.h"
|
||||
#include "s_newconf.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
#define hash_cli_fd(x) (x % CLI_FD_MAX)
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include "client.h"
|
||||
#include "setup.h"
|
||||
#include "irc_dictionary.h"
|
||||
#include "s_assert.h"
|
||||
#include "logger.h"
|
||||
|
||||
static rb_bh *elem_heap = NULL;
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#include "hostmask.h"
|
||||
#include "sslproc.h"
|
||||
#include "hash.h"
|
||||
#include "s_assert.h"
|
||||
#include "logger.h"
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE ((unsigned int) 0xffffffff)
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "client.h"
|
||||
#include "ircd.h"
|
||||
#include "match.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
/*
|
||||
* Compare if a given string (name) matches the given
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "monitor.h"
|
||||
#include "hash.h"
|
||||
#include "numeric.h"
|
||||
#include "send.h"
|
||||
|
||||
struct monitor *monitorTable[MONITOR_HASH_SIZE];
|
||||
static rb_bh *monitor_heap;
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "match.h"
|
||||
#include "hook.h"
|
||||
#include "send.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static char readBuf[READBUF_SIZE];
|
||||
static void client_dopacket(struct Client *client_p, char *buffer, size_t length);
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "s_conf.h"
|
||||
#include "s_serv.h"
|
||||
#include "packet.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static struct Dictionary *cmd_dict = NULL;
|
||||
struct Dictionary *alias_dict = NULL;
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
#include "s_conf.h"
|
||||
#include "privilege.h"
|
||||
#include "numeric.h"
|
||||
#include "s_assert.h"
|
||||
#include "logger.h"
|
||||
#include "send.h"
|
||||
|
||||
static rb_dlink_list privilegeset_list = {};
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "s_conf.h"
|
||||
#include "s_stats.h"
|
||||
#include "ratelimit.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
/*
|
||||
* ratelimit_client(struct Client *client_p, int penalty)
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
#include "match.h"
|
||||
#include "numeric.h"
|
||||
#include "client.h" /* SNO_* */
|
||||
#include "s_assert.h"
|
||||
#include "logger.h"
|
||||
#include "send.h"
|
||||
|
||||
#if (CHAR_BIT != 8)
|
||||
#error this code needs to be able to address individual octets
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
#include "res.h"
|
||||
#include "reslib.h"
|
||||
#include "match.h"
|
||||
#include "logger.h"
|
||||
|
||||
#define NS_TYPE_ELT 0x40 /* EDNS0 extended label type */
|
||||
#define DNS_LABELTYPE_BITSTRING 0x41
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "send.h"
|
||||
#include "hook.h"
|
||||
#include "blacklist.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
struct AuthRequest
|
||||
{
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "operhash.h"
|
||||
#include "chmode.h"
|
||||
#include "hook.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
struct config_server_hide ConfigServerHide;
|
||||
|
||||
|
|
|
@ -44,6 +44,8 @@
|
|||
#include "newconf.h"
|
||||
#include "hash.h"
|
||||
#include "irc_dictionary.h"
|
||||
#include "s_assert.h"
|
||||
#include "logger.h"
|
||||
|
||||
rb_dlink_list shared_conf_list;
|
||||
rb_dlink_list cluster_conf_list;
|
||||
|
|
|
@ -55,6 +55,7 @@
|
|||
#include "reject.h"
|
||||
#include "sslproc.h"
|
||||
#include "capability.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
#ifndef INADDR_NONE
|
||||
#define INADDR_NONE ((unsigned int) 0xffffffff)
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "blacklist.h"
|
||||
#include "substitution.h"
|
||||
#include "chmode.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
static void report_and_set_user_flags(struct Client *, struct ConfItem *);
|
||||
void user_welcome(struct Client *source_p);
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
#include "send.h"
|
||||
#include "scache.h"
|
||||
#include "s_conf.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
|
||||
/*
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include "snomask.h"
|
||||
#include "match.h"
|
||||
#include "substitution.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
/*
|
||||
* Simple mappings for $foo -> 'bar'.
|
||||
|
|
|
@ -81,6 +81,7 @@
|
|||
#include "s_user.h"
|
||||
#include "supported.h"
|
||||
#include "chmode.h"
|
||||
#include "send.h"
|
||||
|
||||
rb_dlink_list isupportlist;
|
||||
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "hash.h"
|
||||
#include "s_newconf.h"
|
||||
#include "s_serv.h"
|
||||
#include "send.h"
|
||||
|
||||
static int add_hashed_target(struct Client *source_p, uint32_t hashv);
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "send.h"
|
||||
#include "s_conf.h"
|
||||
#include "scache.h"
|
||||
#include "s_assert.h"
|
||||
|
||||
/* internally defined function */
|
||||
static void add_whowas_to_clist(struct Whowas **, struct Whowas *);
|
||||
|
|
Loading…
Reference in a new issue