Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce ddsrt_abort and ddsrt_exit #1877

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
183 changes: 92 additions & 91 deletions src/core/cdr/src/dds_cdrstream.c

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions src/core/ddsc/src/dds_builtin.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <assert.h>
#include <string.h>
#include "dds/ddsrt/string.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_topic.h"
#include "dds/ddsi/ddsi_endpoint.h"
Expand Down Expand Up @@ -282,7 +283,7 @@ struct ddsi_serdata *dds__builtin_make_sample_endpoint (const struct ddsi_entity
type = dom->builtin_reader_type;
break;
default:
abort ();
ddsrt_abort();
break;
}
assert (type != NULL);
Expand Down Expand Up @@ -344,7 +345,7 @@ static void dds__builtin_write_endpoint (const struct ddsi_entity_common *e, dds
bwr = dom->builtintopic_writer_subscriptions;
break;
default:
abort ();
ddsrt_abort();
break;
}
dds_writecdr_local_orphan_impl (bwr, serdata);
Expand Down
7 changes: 4 additions & 3 deletions src/core/ddsc/src/dds_entity.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/log.h"
#include "dds/ddsrt/process.h"
#include "dds__entity.h"
#include "dds__write.h"
#include "dds__writer.h"
Expand Down Expand Up @@ -162,7 +163,7 @@ static bool entity_has_status (const dds_entity *e)
case DDS_KIND_CYCLONEDDS:
break;
case DDS_KIND_DONTCARE:
abort ();
ddsrt_abort();
break;
}
return false;
Expand All @@ -187,7 +188,7 @@ static bool entity_may_have_children (const dds_entity *e)
case DDS_KIND_CYCLONEDDS:
break;
case DDS_KIND_DONTCARE:
abort ();
ddsrt_abort();
break;
}
return true;
Expand All @@ -213,7 +214,7 @@ static bool entity_kind_has_qos (dds_entity_kind_t kind)
case DDS_KIND_CYCLONEDDS:
break;
case DDS_KIND_DONTCARE:
abort ();
ddsrt_abort();
break;
}
return false;
Expand Down
3 changes: 2 additions & 1 deletion src/core/ddsc/src/dds_readcond.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "dds/ddsi/ddsi_entity_index.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_thread.h"
#include "dds/ddsrt/process.h"

static void dds_readcond_close (dds_entity *e) ddsrt_nonnull_all;

Expand Down Expand Up @@ -60,7 +61,7 @@ dds_readcond *dds_create_readcond_impl (dds_reader *rd, dds_entity_kind_t kind,
{
/* FIXME: current entity management code can't deal with an error late in the creation of the
entity because it doesn't allow deleting it again ... */
abort();
ddsrt_abort();
}
return cond;
}
Expand Down
3 changes: 2 additions & 1 deletion src/core/ddsc/src/dds_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "dds/ddsrt/static_assert.h"
#include "dds/ddsrt/io.h"
#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_endpoint.h"
#include "dds/ddsi/ddsi_thread.h"
Expand Down Expand Up @@ -632,7 +633,7 @@ static dds_entity_t dds_create_reader_int (dds_entity_t participant_or_subscribe
if (dds_rhc_associate (rd->m_rhc, rd, tp->m_stype, rd->m_entity.m_domain->gv.m_tkmap) < 0)
{
/* FIXME: see also create_querycond, need to be able to undo entity_init */
abort ();
ddsrt_abort();
}
dds_entity_add_ref_locked (&tp->m_entity);

Expand Down
7 changes: 4 additions & 3 deletions src/core/ddsc/src/dds_serdata_builtintopic.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "dds/ddsrt/string.h"
#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/hopscotch.h"

#include "dds/ddsi/ddsi_xqos.h"
Expand Down Expand Up @@ -97,7 +98,7 @@ static size_t serdata_builtin_sizeof(enum ddsi_sertype_builtintopic_entity_kind
case DSBT_WRITER:
return sizeof (struct ddsi_serdata_builtintopic_endpoint);
}
abort ();
ddsrt_abort();
return 0;
}

Expand Down Expand Up @@ -244,7 +245,7 @@ struct ddsi_serdata *dds_serdata_builtin_from_endpoint (const struct ddsi_sertyp
from_entity_proxy_wr ((struct ddsi_serdata_builtintopic_endpoint *) d, (const struct ddsi_proxy_writer *) entity);
break;
case DDSI_EK_TOPIC:
abort ();
ddsrt_abort();
break;
}
ddsrt_mutex_unlock (&entity->qos_lock);
Expand Down Expand Up @@ -375,7 +376,7 @@ static bool serdata_builtin_untyped_to_sample (const struct ddsi_sertype *type,
{
const struct ddsi_serdata_builtintopic *d = (const struct ddsi_serdata_builtintopic *)serdata_common;
const struct ddsi_sertype_builtintopic *tp = (const struct ddsi_sertype_builtintopic *)type;
if (bufptr) abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (bufptr) ddsrt_abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
/* FIXME: completing builtin topic support along these lines requires subscribers, publishers and topics to also become DDSI entities - which is probably a good thing anyway */
switch (tp->entity_kind)
{
Expand Down
5 changes: 3 additions & 2 deletions src/core/ddsc/src/dds_serdata_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "dds/ddsrt/log.h"
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/mh3.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsi/ddsi_freelist.h"
#include "dds/ddsi/ddsi_tkmap.h"
#include "dds/cdr/dds_cdrstream.h"
Expand Down Expand Up @@ -713,7 +714,7 @@ static bool serdata_default_to_sample_cdr (const struct ddsi_serdata *serdata_co
const struct dds_serdata_default *d = (const struct dds_serdata_default *)serdata_common;
const struct dds_sertype_default *tp = (const struct dds_sertype_default *) d->c.type;
dds_istream_t is;
if (bufptr) abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (bufptr) ddsrt_abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (d->c.loan != NULL &&
(d->c.loan->metadata->sample_state == DDS_LOANED_SAMPLE_STATE_RAW_DATA ||
d->c.loan->metadata->sample_state == DDS_LOANED_SAMPLE_STATE_RAW_KEY))
Expand Down Expand Up @@ -742,7 +743,7 @@ static bool serdata_default_untyped_to_sample_cdr (const struct ddsi_sertype *se
assert (d->c.kind == SDK_KEY);
assert (d->c.ops == sertype_common->serdata_ops);
assert (DDSI_RTPS_CDR_ENC_IS_NATIVE (d->hdr.identifier));
if (bufptr) abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (bufptr) ddsrt_abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
dds_istream_init (&is, d->key.keysize, serdata_default_keybuf (d), DDSI_RTPS_CDR_ENC_VERSION_2);
dds_stream_read_key (&is, sample, &dds_cdrstream_default_allocator, &tp->type);
return true; /* FIXME: can't conversion to sample fail? */
Expand Down
5 changes: 3 additions & 2 deletions src/core/ddsc/src/dds_sertype_default.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/mh3.h"
#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/string.h"
#include "dds/ddsi/ddsi_domaingv.h"
#include "dds/ddsi/ddsi_freelist.h"
Expand Down Expand Up @@ -197,7 +198,7 @@ static struct ddsi_sertype * sertype_default_derive_sertype (const struct ddsi_s
else if (data_representation == DDS_DATA_REPRESENTATION_XCDR2)
required_ops = base_sertype->has_key ? &dds_serdata_ops_xcdr2 : &dds_serdata_ops_xcdr2_nokey;
else
abort ();
ddsrt_abort();

if (base_sertype->serdata_ops == required_ops)
derived_sertype = (struct dds_sertype_default *) base_sertype_default;
Expand Down Expand Up @@ -285,7 +286,7 @@ dds_return_t dds_sertype_default_init (const struct dds_domain *domain, struct d
serdata_ops = desc->m_nkeys ? &dds_serdata_ops_xcdr2 : &dds_serdata_ops_xcdr2_nokey;
break;
default:
abort ();
ddsrt_abort();
}

/* Get the extensility of the outermost object in the type used for the topic. Note that the
Expand Down
7 changes: 4 additions & 3 deletions src/core/ddsi/src/ddsi_dynamic_type.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "dds/dds.h"
#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/string.h"
#include "dds/ddsi/ddsi_entity.h"
#include "dds/ddsi/ddsi_typelib.h"
Expand Down Expand Up @@ -357,7 +358,7 @@ static dds_return_t set_type_flags (struct ddsi_type *type, uint16_t flag, uint1
type->xt._u.union_type.flags = (type->xt._u.union_type.flags & (uint16_t) ~mask) | flag;
break;
default:
abort ();
ddsrt_abort();
}
return ret;
}
Expand All @@ -376,7 +377,7 @@ dds_return_t ddsi_dynamic_type_set_extensibility (struct ddsi_type *type, enum d
else if (extensibility == DDS_DYNAMIC_TYPE_EXT_MUTABLE)
flag = DDS_XTypes_IS_MUTABLE;
else
abort ();
ddsrt_abort();
return set_type_flags (type, flag, DDS_DYNAMIC_TYPE_EXT_FINAL | DDS_DYNAMIC_TYPE_EXT_APPENDABLE | DDS_DYNAMIC_TYPE_EXT_MUTABLE);
}

Expand Down Expand Up @@ -421,7 +422,7 @@ dds_return_t ddsi_dynamic_type_set_bitbound (struct ddsi_type *type, uint16_t bi
}
break;
default:
abort ();
ddsrt_abort();
}
return ret;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/ddsi/src/ddsi_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ static void wait_for_receive_threads_helper (struct ddsi_domaingv *gv, struct dd
struct wait_for_receive_threads_helper_arg * const arg = varg;
(void) xp;
if (arg->count++ == gv->config.recv_thread_stop_maxretries)
abort ();
ddsrt_abort();
ddsi_trigger_recv_threads (gv);
(void) ddsi_resched_xevent_if_earlier (xev, ddsrt_mtime_add_duration (tnow, DDS_SECS (1)));
}
Expand Down
3 changes: 2 additions & 1 deletion src/core/ddsi/src/ddsi_ipaddr.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/log.h"
#include "dds/ddsrt/bits.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/sockets.h"
#include "dds/ddsrt/string.h"
#include "dds/ddsi/ddsi_domaingv.h"
Expand Down Expand Up @@ -255,7 +256,7 @@ enum ddsi_locator_from_string_result ddsi_ipaddr_from_string (ddsi_locator_t *lo
struct sockaddr_in6 *x = (struct sockaddr_in6 *) &tmpaddr;
x->sin6_port = htons (port);
#else
abort ();
ddsrt_abort();
#endif
}
ddsi_ipaddr_to_loc (loc, (struct sockaddr *)&tmpaddr, kind);
Expand Down
7 changes: 4 additions & 3 deletions src/core/ddsi/src/ddsi_radmin.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#endif

#include "dds/ddsrt/heap.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/threads.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/string.h"
Expand Down Expand Up @@ -740,7 +741,7 @@ static void ddsi_rdata_addbias (struct ddsi_rdata *rdata)
#ifndef NDEBUG
ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
if (ddsrt_atomic_inc32_nv (&rdata->refcount_bias_added) != 1)
abort ();
ddsrt_abort();
#endif
ddsi_rmsg_addbias (rmsg);
}
Expand All @@ -751,7 +752,7 @@ static void ddsi_rdata_rmbias_and_adjust (struct ddsi_rdata *rdata, int adjust)
RMSGTRACE ("rdata_rmbias_and_adjust(%p, %d)\n", (void *) rdata, adjust);
#ifndef NDEBUG
if (ddsrt_atomic_dec32_ov (&rdata->refcount_bias_added) != 1)
abort ();
ddsrt_abort();
#endif
ddsi_rmsg_rmbias_and_adjust (rmsg, adjust);
}
Expand Down Expand Up @@ -2574,7 +2575,7 @@ static uint32_t dqueue_thread (struct ddsi_dqueue *q)
switch (b->kind)
{
case DDSI_DQBK_STOP:
abort ();
ddsrt_abort();
case DDSI_DQBK_CALLBACK:
b->u.cb.cb (b->u.cb.arg);
break;
Expand Down
3 changes: 2 additions & 1 deletion src/core/ddsi/src/ddsi_security_omg.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include "dds/ddsrt/string.h"
#include "dds/ddsrt/misc.h"
#include "dds/ddsrt/avl.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/sync.h"
#include "dds/ddsrt/hopscotch.h"
#include "dds/ddsi/ddsi_domaingv.h"
Expand Down Expand Up @@ -1727,7 +1728,7 @@ unsigned ddsi_determine_publication_writer (const struct ddsi_writer *wr)
unsigned ddsi_determine_topic_writer (const struct ddsi_topic *tp)
{
if (ddsi_omg_participant_is_discovery_protected (tp->pp))
abort (); /* FIXME: not implemented */
ddsrt_abort(); /* FIXME: not implemented */
return DDSI_ENTITYID_SEDP_BUILTIN_TOPIC_WRITER;
}
#endif
Expand Down
5 changes: 3 additions & 2 deletions src/core/ddsi/src/ddsi_serdata_cdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "dds/ddsrt/log.h"
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/mh3.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsi/ddsi_freelist.h"
#include "dds/ddsi/ddsi_tkmap.h"
#include "dds/ddsi/ddsi_domaingv.h"
Expand Down Expand Up @@ -250,7 +251,7 @@ static struct ddsi_serdata_cdr *serdata_cdr_from_sample_cdr_common (const struct
ostream_add_to_serdata_cdr (&os, &d);
break;
case SDK_KEY:
abort ();
ddsrt_abort();
break;
case SDK_DATA:
if (!dds_stream_write_sample (&os, &dds_cdrstream_default_allocator, sample, &tp->type))
Expand Down Expand Up @@ -314,7 +315,7 @@ static bool serdata_cdr_to_sample_cdr (const struct ddsi_serdata *serdata_common
const struct ddsi_serdata_cdr *d = (const struct ddsi_serdata_cdr *)serdata_common;
const struct ddsi_sertype_cdr *tp = (const struct ddsi_sertype_cdr *) d->c.type;
dds_istream_t is;
if (bufptr) abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (bufptr) ddsrt_abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
assert (DDSI_RTPS_CDR_ENC_IS_NATIVE (d->hdr.identifier));
istream_from_serdata_cdr(&is, d);
dds_stream_read_sample (&is, sample, &dds_cdrstream_default_allocator, &tp->type);
Expand Down
3 changes: 2 additions & 1 deletion src/core/ddsi/src/ddsi_serdata_plist.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "dds/ddsrt/log.h"
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/mh3.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsi/ddsi_freelist.h"
#include "dds/ddsi/ddsi_tkmap.h"
#include "dds/ddsi/ddsi_domaingv.h"
Expand Down Expand Up @@ -184,7 +185,7 @@ static bool serdata_plist_untyped_to_sample (const struct ddsi_sertype *tpcmn, c
const struct ddsi_serdata_plist *d = (const struct ddsi_serdata_plist *)serdata_common;
const struct ddsi_sertype_plist *tp = (const struct ddsi_sertype_plist *)tpcmn;
struct ddsi_domaingv * const gv = ddsrt_atomic_ldvoidp (&tp->c.gv);
if (bufptr) abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (bufptr) ddsrt_abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
ddsi_plist_src_t src = {
.buf = (const unsigned char *) d->data,
.bufsz = d->pos,
Expand Down
5 changes: 3 additions & 2 deletions src/core/ddsi/src/ddsi_serdata_pserop.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "dds/ddsrt/log.h"
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/mh3.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsi/ddsi_freelist.h"
#include "dds/ddsi/ddsi_tkmap.h"
#include "dds/ddsi/ddsi_domaingv.h"
Expand Down Expand Up @@ -169,7 +170,7 @@ static bool serdata_pserop_to_sample (const struct ddsi_serdata *serdata_common,
{
const struct ddsi_serdata_pserop *d = (const struct ddsi_serdata_pserop *)serdata_common;
const struct ddsi_sertype_pserop *tp = (const struct ddsi_sertype_pserop *) d->c.type;
if (bufptr) abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (bufptr) ddsrt_abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (d->c.kind == SDK_KEY)
memcpy (sample, d->sample, 16);
else
Expand Down Expand Up @@ -251,7 +252,7 @@ static bool serdata_pserop_untyped_to_sample (const struct ddsi_sertype *type_co
{
const struct ddsi_serdata_pserop *d = (const struct ddsi_serdata_pserop *)serdata_common;
const struct ddsi_sertype_pserop *tp = (const struct ddsi_sertype_pserop *)type_common;
if (bufptr) abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (bufptr) ddsrt_abort(); else { (void)buflim; } /* FIXME: haven't implemented that bit yet! */
if (tp->ops_key)
memcpy (sample, d->sample, 16);
return true;
Expand Down
7 changes: 4 additions & 3 deletions src/core/ddsi/src/ddsi_sertype.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "dds/ddsrt/md5.h"
#include "dds/ddsrt/mh3.h"
#include "dds/ddsrt/hopscotch.h"
#include "dds/ddsrt/process.h"
#include "dds/ddsrt/string.h"
#include "dds/ddsi/ddsi_freelist.h"
#include "dds/ddsi/ddsi_iid.h"
Expand Down Expand Up @@ -244,7 +245,7 @@ uint16_t ddsi_sertype_get_native_enc_identifier (uint32_t enc_version, uint32_t
return CONCAT(DDSI_RTPS_D_CDR2, SUFFIX);
return CONCAT(DDSI_RTPS_CDR2, SUFFIX);
default:
abort (); /* unsupported */
ddsrt_abort(); /* unsupported */
}
#undef SUFFIX
#undef CONCAT
Expand All @@ -262,7 +263,7 @@ uint16_t ddsi_sertype_extensibility_enc_format (enum dds_cdr_type_extensibility
case DDS_CDR_TYPE_EXT_MUTABLE:
return DDSI_RTPS_CDR_ENC_FORMAT_PL;
default:
abort ();
ddsrt_abort();
}
}

Expand Down Expand Up @@ -293,7 +294,7 @@ uint32_t ddsi_sertype_enc_id_enc_format (uint16_t cdr_identifier)
case DDSI_RTPS_PL_CDR2_LE: case DDSI_RTPS_PL_CDR2_BE:
return DDSI_RTPS_CDR_ENC_FORMAT_PL;
default:
abort ();
ddsrt_abort();
}
}

Expand Down
Loading
Loading