File: 0004-Compile-without-debug-code.patch

package info (click to toggle)
cyclonedds 0.10.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 23,420 kB
  • sloc: ansic: 223,506; perl: 1,904; xml: 1,895; yacc: 1,018; sh: 882; python: 106; makefile: 94
file content (1275 lines) | stat: -rw-r--r-- 49,999 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
From: =?utf-8?q?Timo_R=C3=B6hling?= <roehling@debian.org>
Date: Thu, 28 Oct 2021 10:29:29 +0200
Subject: Compile without debug code

The struct bwhc_iter will be larger than the maximum allocated size on
some architectures if debug members are compiled into the it, so we
disable all debug code unconditionally.

We also rename NDEBUG to DDS_NDEBUG to prevent unintentional
interactions with assert.h
---
 PkgConfig.pc.in                                    |  2 +-
 src/core/CMakeLists.txt                            |  1 +
 src/core/ddsc/src/dds_entity.c                     |  2 +-
 src/core/ddsc/src/dds_handles.c                    | 10 ++++----
 src/core/ddsc/src/dds_rhc_default.c                | 10 ++++----
 src/core/ddsc/src/dds_sertype_builtintopic.c       |  2 +-
 src/core/ddsc/src/dds_topic.c                      |  2 +-
 src/core/ddsc/src/dds_whc.c                        | 10 ++++----
 src/core/ddsi/include/dds/ddsi/ddsi_entity_index.h |  2 +-
 src/core/ddsi/include/dds/ddsi/ddsi_list_tmpl.h    |  2 +-
 .../ddsi/include/dds/ddsi/ddsi_serdata_default.h   |  2 +-
 src/core/ddsi/include/dds/ddsi/q_radmin.h          |  4 +--
 src/core/ddsi/include/dds/ddsi/q_unused.h          |  2 +-
 src/core/ddsi/src/ddsi_cdrstream.c                 | 10 ++++----
 src/core/ddsi/src/ddsi_config.c                    |  4 +--
 src/core/ddsi/src/ddsi_entity_index.c              |  2 +-
 src/core/ddsi/src/ddsi_ownip.c                     |  2 +-
 src/core/ddsi/src/ddsi_plist.c                     | 18 ++++++-------
 src/core/ddsi/src/ddsi_serdata_default.c           |  6 ++---
 src/core/ddsi/src/ddsi_serdata_plist.c             |  2 +-
 src/core/ddsi/src/ddsi_sertype.c                   |  2 +-
 src/core/ddsi/src/ddsi_sertype_default.c           |  2 +-
 src/core/ddsi/src/ddsi_sertype_plist.c             |  2 +-
 src/core/ddsi/src/ddsi_sertype_pserop.c            |  2 +-
 src/core/ddsi/src/ddsi_threadmon.c                 |  2 +-
 src/core/ddsi/src/ddsi_tkmap.c                     |  2 +-
 src/core/ddsi/src/ddsi_topic.c                     |  2 +-
 src/core/ddsi/src/ddsi_typelib.c                   |  4 +--
 src/core/ddsi/src/ddsi_wraddrset.c                 |  4 +--
 src/core/ddsi/src/q_ddsi_discovery.c               |  6 ++---
 src/core/ddsi/src/q_gc.c                           |  2 +-
 src/core/ddsi/src/q_init.c                         |  8 +++---
 src/core/ddsi/src/q_inverse_uint32_set.c           |  2 +-
 src/core/ddsi/src/q_qosmatch.c                     |  2 +-
 src/core/ddsi/src/q_radmin.c                       | 30 +++++++++++-----------
 src/core/ddsi/src/q_thread.c                       |  2 +-
 src/core/ddsi/src/q_transmit.c                     |  2 +-
 src/core/ddsi/src/q_xevent.c                       |  4 +--
 src/core/ddsi/src/q_xmsg.c                         |  4 +--
 src/core/xtests/rhc_torture/rhc_torture.c          |  4 +--
 src/ddsrt/CMakeLists.txt                           |  3 +++
 src/ddsrt/src/circlist.c                           |  4 +--
 src/ddsrt/src/heap/vxworks/heap.c                  |  4 +--
 src/ddsrt/src/sync/freertos/tasklist.c             |  4 +--
 src/idl/src/expression.c                           |  2 +-
 src/idl/src/tree.c                                 | 10 ++++----
 .../access_control/src/access_control.c            |  4 +--
 .../authentication/src/authentication.c            |  2 +-
 .../cryptographic/src/crypto_cipher.c              |  2 +-
 .../cryptographic/src/crypto_objects.h             |  2 +-
 src/security/core/src/dds_security_utils.c         |  2 +-
 src/tools/idlc/src/descriptor_type_meta.c          |  2 +-
 52 files changed, 114 insertions(+), 110 deletions(-)

diff --git a/PkgConfig.pc.in b/PkgConfig.pc.in
index 381e234..5aaa337 100644
--- a/PkgConfig.pc.in
+++ b/PkgConfig.pc.in
@@ -6,4 +6,4 @@ Name: @PROJECT_NAME@
 Description: Eclipse Cyclone DDS library
 Version: @PROJECT_VERSION@
 Libs: -L${libdir} -lddsc
-Cflags: -I${includedir}
+Cflags: -I${includedir} -DDDS_NDEBUG
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 148fb3f..efb58bc 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -60,6 +60,7 @@ add_coverage(ddsc)
 target_link_libraries(ddsc PRIVATE "$<BUILD_INTERFACE:ddsrt>")
 target_compile_definitions(
   ddsc PUBLIC
+  DDS_NDEBUG
   $<BUILD_INTERFACE:$<TARGET_PROPERTY:ddsrt,INTERFACE_COMPILE_DEFINITIONS>>)
 target_include_directories(
   ddsc PUBLIC
diff --git a/src/core/ddsc/src/dds_entity.c b/src/core/ddsc/src/dds_entity.c
index 16c99e8..4632264 100644
--- a/src/core/ddsc/src/dds_entity.c
+++ b/src/core/ddsc/src/dds_entity.c
@@ -184,7 +184,7 @@ static bool entity_may_have_children (const dds_entity *e)
   return true;
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static bool entity_kind_has_qos (dds_entity_kind_t kind)
 {
   switch (kind)
diff --git a/src/core/ddsc/src/dds_handles.c b/src/core/ddsc/src/dds_handles.c
index b5ae85c..c7ffc41 100644
--- a/src/core/ddsc/src/dds_handles.c
+++ b/src/core/ddsc/src/dds_handles.c
@@ -98,7 +98,7 @@ void dds_handle_server_fini (void)
   /* called with ddsrt's singleton mutex held (see dds_init/fini) */
   if (handles.ht != NULL)
   {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     struct ddsrt_hh_iter it;
     for (struct dds_handle_link *link = ddsrt_hh_iter_first (handles.ht, &it); link != NULL; link = ddsrt_hh_iter_next (&it))
     {
@@ -181,7 +181,7 @@ dds_return_t dds_handle_register_special (struct dds_handle_link *link, bool imp
 
 void dds_handle_unpend (struct dds_handle_link *link)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   uint32_t cf = ddsrt_atomic_ld32 (&link->cnt_flags);
   assert ((cf & HDL_FLAG_PENDING));
   assert (!(cf & HDL_FLAG_DELETE_DEFERRED));
@@ -195,7 +195,7 @@ void dds_handle_unpend (struct dds_handle_link *link)
 
 int32_t dds_handle_delete (struct dds_handle_link *link)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   uint32_t cf = ddsrt_atomic_ld32 (&link->cnt_flags);
   if (!(cf & HDL_FLAG_PENDING))
   {
@@ -450,7 +450,7 @@ void dds_handle_repin (struct dds_handle_link *link)
 
 void dds_handle_unpin (struct dds_handle_link *link)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   uint32_t cf = ddsrt_atomic_ld32 (&link->cnt_flags);
   if (cf & HDL_FLAG_CLOSING)
     assert ((cf & HDL_PINCOUNT_MASK) > 1u);
@@ -513,7 +513,7 @@ bool dds_handle_close (struct dds_handle_link *link)
 
 void dds_handle_close_wait (struct dds_handle_link *link)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   uint32_t cf = ddsrt_atomic_ld32 (&link->cnt_flags);
   assert ((cf & HDL_FLAG_CLOSING));
   assert ((cf & HDL_PINCOUNT_MASK) >= 1u);
diff --git a/src/core/ddsc/src/dds_rhc_default.c b/src/core/ddsc/src/dds_rhc_default.c
index 1dc01e9..eb58d59 100644
--- a/src/core/ddsc/src/dds_rhc_default.c
+++ b/src/core/ddsc/src/dds_rhc_default.c
@@ -13,7 +13,7 @@
 #include <string.h>
 #include <limits.h>
 
-#if HAVE_VALGRIND && ! defined (NDEBUG)
+#if HAVE_VALGRIND && ! defined (DDS_NDEBUG)
 #include <memcheck.h>
 #define USE_VALGRIND 1
 #else
@@ -417,7 +417,7 @@ static void init_trigger_info_qcond (struct trigger_info_qcond *qc);
 static void drop_instance_noupdate_no_writers (struct dds_rhc_default * __restrict rhc, struct rhc_instance * __restrict * __restrict instptr);
 static bool update_conditions_locked (struct dds_rhc_default *rhc, bool called_from_insert, const struct trigger_info_pre *pre, const struct trigger_info_post *post, const struct trigger_info_qcond *trig_qc, const struct rhc_instance *inst);
 static void account_for_nonempty_to_empty_transition (struct dds_rhc_default * __restrict rhc, struct rhc_instance * __restrict * __restrict instptr, const char *__restrict traceprefix);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static int rhc_check_counts_locked (struct dds_rhc_default *rhc, bool check_conds, bool check_qcmask);
 #endif
 
@@ -740,7 +740,7 @@ static void free_instance_rhc_free (struct rhc_instance *inst, struct dds_rhc_de
     inst->nvsamples = 0;
     inst->nvread = 0;
   }
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   memset (&dummy_trig_qc, 0, sizeof (dummy_trig_qc));
 #endif
   inst_clear_invsample_if_exists (rhc, inst, &dummy_trig_qc);
@@ -2163,7 +2163,7 @@ static int32_t take_w_qminv_inst (struct dds_rhc_default * const __restrict rhc,
   if (inst->inv_exists && n < max_samples && (qmask_of_invsample (inst) & qminv) == 0 && (qcmask == 0 || (inst->conds & qcmask) != 0))
   {
     struct trigger_info_qcond dummy_trig_qc;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     init_trigger_info_qcond (&dummy_trig_qc);
 #endif
     take_sample_update_conditions (rhc, &pre, &post, &trig_qc, inst, inst->conds, inst->inv_isread);
@@ -2726,7 +2726,7 @@ static int32_t dds_rhc_default_takecdr (struct dds_rhc *rhc_common, bool lock, s
  ******    CHECK    ******
  *************************/
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define CHECK_MAX_CONDS 64
 static int rhc_check_counts_locked (struct dds_rhc_default *rhc, bool check_conds, bool check_qcmask)
 {
diff --git a/src/core/ddsc/src/dds_sertype_builtintopic.c b/src/core/ddsc/src/dds_sertype_builtintopic.c
index d0d2398..ea08a85 100644
--- a/src/core/ddsc/src/dds_sertype_builtintopic.c
+++ b/src/core/ddsc/src/dds_sertype_builtintopic.c
@@ -144,7 +144,7 @@ static void sertype_builtin_free_samples (const struct ddsi_sertype *sertype_com
   {
     const struct ddsi_sertype_builtintopic *tp = (const struct ddsi_sertype_builtintopic *)sertype_common;
     const size_t size = get_size (tp->entity_kind);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     for (size_t i = 0, off = 0; i < count; i++, off += size)
       assert ((char *)ptrs[i] == (char *)ptrs[0] + off);
 #endif
diff --git a/src/core/ddsc/src/dds_topic.c b/src/core/ddsc/src/dds_topic.c
index 1d7359f..4c32f3a 100644
--- a/src/core/ddsc/src/dds_topic.c
+++ b/src/core/ddsc/src/dds_topic.c
@@ -800,7 +800,7 @@ static dds_entity_t find_local_topic_pp (dds_participant *pp, const char *name,
       ddsi_sertype_unref (sertype);
     dds_delete_qos (qos);
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     if (hdl > 0)
     {
       dds_topic *new_topic;
diff --git a/src/core/ddsc/src/dds_whc.c b/src/core/ddsc/src/dds_whc.c
index b8031ce..ea3ac58 100644
--- a/src/core/ddsc/src/dds_whc.c
+++ b/src/core/ddsc/src/dds_whc.c
@@ -296,7 +296,7 @@ static void check_whc (const struct whc_impl *whc)
   }
   assert (whc->maxseq_node == whc_findmax_procedurally (whc));
 
-#if !defined (NDEBUG)
+#if !defined (DDS_NDEBUG)
   if (whc->xchecks)
   {
     struct whc_intvnode *firstintv;
@@ -599,7 +599,7 @@ static struct whc_node *find_nextseq_intv (struct whc_intvnode **p_intv, const s
     /* don't know seq => lookup interval with min > seq (intervals are
      contiguous, so if we don't know seq, an interval [X,Y) with X <
      SEQ < Y can't exist */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     {
       struct whc_intvnode *predintv = ddsrt_avl_lookup_pred_eq (&whc_seq_treedef, &whc->seq, &seq);
       assert (predintv == NULL || predintv->maxp1 <= seq);
@@ -923,7 +923,7 @@ static uint32_t whc_default_remove_acked_messages_noidx (struct whc_impl *whc, s
 
   /* If simple, we have always dropped everything up to whc->max_drop_seq,
    and there can only be a single interval */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   whcn = find_nextseq_intv (&intv, whc, whc->max_drop_seq);
   assert (whcn == NULL || whcn->prev_seq == NULL);
   assert (ddsrt_avl_is_singleton (&whc->seq));
@@ -1098,14 +1098,14 @@ static uint32_t whc_default_remove_acked_messages_full (struct whc_impl *whc, se
         {
           /* Delete it - but this may not result in deleting the index node as
            there must still be a more recent one available */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
           struct whc_idxnode template;
           template.iid = idxn->iid;
           assert (oldn->seq < whcn->seq);
 #endif
           TRACE (" del %p %"PRIu64, (void *) oldn, oldn->seq);
           whc_delete_one (whc, oldn);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
           assert (ddsrt_hh_lookup (whc->idx_hash, &template) == idxn);
 #endif
         }
diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_entity_index.h b/src/core/ddsi/include/dds/ddsi/ddsi_entity_index.h
index d85663e..438af03 100644
--- a/src/core/ddsi/include/dds/ddsi/ddsi_entity_index.h
+++ b/src/core/ddsi/include/dds/ddsi/ddsi_entity_index.h
@@ -48,7 +48,7 @@ struct entidx_enum
   struct entity_index *entidx;
   enum ddsi_entity_kind kind;
   struct ddsi_entity_common *cur;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   vtime_t vtime;
 #endif
 };
diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_list_tmpl.h b/src/core/ddsi/include/dds/ddsi/ddsi_list_tmpl.h
index 0c44cd7..43218ed 100644
--- a/src/core/ddsi/include/dds/ddsi/ddsi_list_tmpl.h
+++ b/src/core/ddsi/include/dds/ddsi/ddsi_list_tmpl.h
@@ -40,7 +40,7 @@ struct prefix_##_iter_d {                                         \
                                                                   \
 typedef int (*prefix_##_eq_fn)(const elemT_, const elemT_);
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define DDSI_LIST_TMPL_POISON(x) do { x = (void *)1; } while (0)
 #else
 #define DDSI_LIST_TMPL_POISON(x) do {} while (0)
diff --git a/src/core/ddsi/include/dds/ddsi/ddsi_serdata_default.h b/src/core/ddsi/include/dds/ddsi/ddsi_serdata_default.h
index 1eaaa51..23e17f2 100644
--- a/src/core/ddsi/include/dds/ddsi/ddsi_serdata_default.h
+++ b/src/core/ddsi/include/dds/ddsi/ddsi_serdata_default.h
@@ -53,7 +53,7 @@ struct ddsi_serdata_default_key {
 };
 
 /* Debug builds may want to keep some additional state */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define DDSI_SERDATA_DEFAULT_DEBUG_FIELDS \
   bool fixed;
 #else
diff --git a/src/core/ddsi/include/dds/ddsi/q_radmin.h b/src/core/ddsi/include/dds/ddsi/q_radmin.h
index 693cbab..d4766a1 100644
--- a/src/core/ddsi/include/dds/ddsi/q_radmin.h
+++ b/src/core/ddsi/include/dds/ddsi/q_radmin.h
@@ -145,7 +145,7 @@ struct nn_rdata {
   uint16_t submsg_zoff;         /* offset to submessage from packet start, or 0 */
   uint16_t payload_zoff;        /* offset to payload from packet start */
   uint16_t keyhash_zoff;        /* offset to keyhash from packet start, or 0 */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   ddsrt_atomic_uint32_t refcount_bias_added;
 #endif
 };
@@ -160,7 +160,7 @@ struct nn_rdata {
    offset relative to the submessage header so that it is limited by
    the maximum size of the inline QoS ...  Defining the macros now, so
    we have the option to do wild things. */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define NN_ZOFF_TO_OFF(zoff) ((unsigned) (zoff))
 #define NN_OFF_TO_ZOFF(off) (assert ((off) < 65536), ((unsigned short) (off)))
 #else
diff --git a/src/core/ddsi/include/dds/ddsi/q_unused.h b/src/core/ddsi/include/dds/ddsi/q_unused.h
index 3c1f389..dcfad7b 100644
--- a/src/core/ddsi/include/dds/ddsi/q_unused.h
+++ b/src/core/ddsi/include/dds/ddsi/q_unused.h
@@ -18,7 +18,7 @@
 #define UNUSED_ARG(x) x
 #endif
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define UNUSED_ARG_NDEBUG(x) x
 #else
 #define UNUSED_ARG_NDEBUG(x) UNUSED_ARG (x)
diff --git a/src/core/ddsi/src/ddsi_cdrstream.c b/src/core/ddsi/src/ddsi_cdrstream.c
index 361b887..b8e57bf 100644
--- a/src/core/ddsi/src/ddsi_cdrstream.c
+++ b/src/core/ddsi/src/ddsi_cdrstream.c
@@ -96,7 +96,7 @@
 #define dds_stream_extract_keyBO_from_data_pl_member  NAME2_BYTE_ORDER(dds_stream_extract_key, _from_data_pl_member)
 #define dds_stream_extract_keyBO_from_key             NAME2_BYTE_ORDER(dds_stream_extract_key, _from_key)
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 typedef struct align { uint32_t a; } align_t;
 #define ALIGN(n) ((n).a)
 #else
@@ -221,7 +221,7 @@ static uint32_t dds_cdr_alignto_clear_and_resizeBE (dds_ostreamBE_t * __restrict
 
 static inline align_t get_align (uint32_t xcdr_version, uint32_t size)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define MK_ALIGN(n) (struct align){(n)}
 #else
 #define MK_ALIGN(n) (n)
@@ -389,7 +389,7 @@ static inline bool is_primitive_type (enum dds_stream_typecode type)
   return type <= DDS_OP_VAL_8BY || type == DDS_OP_VAL_BLN;
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static inline bool is_primitive_or_enum_type (enum dds_stream_typecode type)
 {
   return is_primitive_type (type) || type == DDS_OP_VAL_ENU;
@@ -902,7 +902,7 @@ static void dds_stream_skip_string (dds_istream_t * __restrict is)
   dds_stream_skip_forward (is, length, 1);
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static bool insn_key_ok_p (uint32_t insn)
 {
   return (DDS_OP (insn) == DDS_OP_ADR && (insn & DDS_OP_FLAG_KEY) &&
@@ -944,7 +944,7 @@ static const uint32_t *find_union_case (const uint32_t * __restrict union_ops, u
   /* Find union case; default case is always the last one */
   assert (numcases > 0);
   uint32_t ci;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   size_t idx = 0;
   for (ci = 0; ci < numcases; ci++)
   {
diff --git a/src/core/ddsi/src/ddsi_config.c b/src/core/ddsi/src/ddsi_config.c
index 8db46fa..eeb95a3 100644
--- a/src/core/ddsi/src/ddsi_config.c
+++ b/src/core/ddsi/src/ddsi_config.c
@@ -821,7 +821,7 @@ static void do_print_uint32_bitset (struct cfgst *cfgst, uint32_t mask, size_t n
 {
   char res[256] = "", *resp = res;
   const char *prefix = "";
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     size_t max = 0;
     for (size_t i = 0; i < ncodes; i++)
@@ -1061,7 +1061,7 @@ static enum update_result uf_xcheck (struct cfgst *cfgst, void *parent, struct c
 static void pf_xcheck (struct cfgst *cfgst, void *parent, struct cfgelem const * const cfgelem, uint32_t sources)
 {
   const uint32_t * const p = cfg_address (cfgst, parent, cfgelem);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   const char *suffix = "";
 #else
   const char *suffix = " [ignored]";
diff --git a/src/core/ddsi/src/ddsi_entity_index.c b/src/core/ddsi/src/ddsi_entity_index.c
index 7503cea..9df37f2 100644
--- a/src/core/ddsi/src/ddsi_entity_index.c
+++ b/src/core/ddsi/src/ddsi_entity_index.c
@@ -425,7 +425,7 @@ static void entidx_enum_init_minmax_int (struct entidx_enum *st, const struct en
      remain valid for looking up the next entity.  With a bit of additional effort it would
      be possible to allow the GC to reclaim any entities already visited, but I don't think
      that additional effort is worth it. */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   assert (thread_is_awake ());
   st->vtime = ddsrt_atomic_ld32 (&lookup_thread_state ()->vtime);
 #endif
diff --git a/src/core/ddsi/src/ddsi_ownip.c b/src/core/ddsi/src/ddsi_ownip.c
index 3cfdcaa..0d68e0a 100644
--- a/src/core/ddsi/src/ddsi_ownip.c
+++ b/src/core/ddsi/src/ddsi_ownip.c
@@ -418,7 +418,7 @@ int find_own_ip (struct ddsi_domaingv *gv)
   struct nn_interface *interfaces;
   if (!gather_interfaces (gv, &n_interfaces, &interfaces, &maxq_count, &maxq_list))
     return 0;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   // assert that we can identify all interfaces with an `int`, so we can
   // then just cast the size_t's to int's
   assert (n_interfaces <= (size_t) INT_MAX);
diff --git a/src/core/ddsi/src/ddsi_plist.c b/src/core/ddsi/src/ddsi_plist.c
index b26b72c..521f5da 100644
--- a/src/core/ddsi/src/ddsi_plist.c
+++ b/src/core/ddsi/src/ddsi_plist.c
@@ -2142,7 +2142,7 @@ static void ddsi_plist_init_tables_real (void)
     if (table == NULL)
       continue;
     struct piddesc const **index = piddesc_vendor_index[i].index;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     size_t maxpididx = 0;
     bool only_qos_seen = true;
 #endif
@@ -2150,7 +2150,7 @@ static void ddsi_plist_init_tables_real (void)
     {
       nn_parameterid_t pid = table[j].pid;
       size_t pididx = pid_to_index(pid);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
       /* Table must first list QoS, then other parameters */
       assert (only_qos_seen || !(table[j].flags & PDF_QOS));
       if (!(table[j].flags & PDF_QOS))
@@ -2212,7 +2212,7 @@ static void ddsi_plist_init_tables_real (void)
           fini_index == sizeof (piddesc_fini) / sizeof (piddesc_fini[0]));
   qsort ((void *) piddesc_unalias, unalias_index, sizeof (piddesc_unalias[0]), piddesc_cmp_qos_addr);
   qsort ((void *) piddesc_fini, fini_index, sizeof (piddesc_fini[0]), piddesc_cmp_qos_addr);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     size_t i;
     for (i = 0; i < unalias_index; i++)
@@ -2327,7 +2327,7 @@ static void plist_or_xqos_mergein_missing (void * __restrict dst, const void * _
   /* shift == 0: plist, shift > 0: just qos */
   struct flagset pfs_src, qfs_src;
   struct flagset pfs_dst, qfs_dst;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   const uint64_t aliased_dst_inp = (shift == 0) ? ((ddsi_plist_t *) dst)->aliased : 0;
   const uint64_t aliased_dst_inq = (shift == 0) ? ((ddsi_plist_t *) dst)->qos.aliased : ((dds_qos_t *) dst)->aliased;
 #endif
@@ -2433,7 +2433,7 @@ static void plist_or_xqos_addtomsg (struct nn_xmsg *xmsg, const void * __restric
 void ddsi_plist_fini (ddsi_plist_t *plist)
 {
   plist_or_xqos_fini (plist, 0, ~(uint64_t)0, ~(uint64_t)0);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   memset (plist, 0x55, sizeof (*plist));
   plist->present = plist->aliased = ~(uint64_t)0;
   plist->qos.present = plist->qos.aliased = ~(uint64_t)0;
@@ -3065,7 +3065,7 @@ ddsi_plist_t *ddsi_plist_dup (const ddsi_plist_t *src)
 
 void ddsi_plist_init_empty (ddsi_plist_t *dest)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   memset (dest, 0x55, sizeof (*dest));
 #endif
   dest->present = dest->aliased = 0;
@@ -3160,7 +3160,7 @@ dds_return_t ddsi_plist_init_frommsg (ddsi_plist_t *dest, char **nextafterplist,
   struct dd dd;
   nn_ipaddress_params_tmp_t dest_tmp;
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   memset (dest, 0, sizeof (*dest));
 #endif
 
@@ -3418,7 +3418,7 @@ unsigned char *ddsi_plist_quickscan (struct nn_rsample_info *dest, const ddsi_ke
 
 void ddsi_xqos_init_empty (dds_qos_t *dest)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   memset (dest, 0x55, sizeof (*dest));
 #endif
   dest->present = dest->aliased = 0;
@@ -3586,7 +3586,7 @@ void ddsi_xqos_copy (dds_qos_t *dst, const dds_qos_t *src)
 void ddsi_xqos_fini (dds_qos_t *xqos)
 {
   plist_or_xqos_fini (xqos, offsetof (ddsi_plist_t, qos), ~(uint64_t)0, ~(uint64_t)0);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   memset (xqos, 0x55, sizeof (*xqos));
   xqos->present = xqos->aliased = ~(uint64_t)0;
 #endif
diff --git a/src/core/ddsi/src/ddsi_serdata_default.c b/src/core/ddsi/src/ddsi_serdata_default.c
index 702ed84..4efb7e8 100644
--- a/src/core/ddsi/src/ddsi_serdata_default.c
+++ b/src/core/ddsi/src/ddsi_serdata_default.c
@@ -41,7 +41,7 @@
 #define DEFAULT_NEW_SIZE 128
 #define CHUNK_SIZE 128
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static int ispowerof2_size (size_t x)
 {
   return x > 0 && !(x & (x-1));
@@ -60,7 +60,7 @@ struct serdatapool * ddsi_serdatapool_new (void)
 
 static void serdata_free_wrap (void *elem)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   struct ddsi_serdata_default *d = elem;
   assert(ddsrt_atomic_ld32(&d->c.refc) == 0);
 #endif
@@ -160,7 +160,7 @@ static void serdata_default_init(struct ddsi_serdata_default *d, const struct dd
 {
   ddsi_serdata_init (&d->c, &tp->c, kind);
   d->pos = 0;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   d->fixed = false;
 #endif
   if (xcdr_version != CDR_ENC_VERSION_UNDEF)
diff --git a/src/core/ddsi/src/ddsi_serdata_plist.c b/src/core/ddsi/src/ddsi_serdata_plist.c
index 9a97e5f..bd1e3ca 100644
--- a/src/core/ddsi/src/ddsi_serdata_plist.c
+++ b/src/core/ddsi/src/ddsi_serdata_plist.c
@@ -225,7 +225,7 @@ static struct ddsi_serdata *serdata_plist_from_sample (const struct ddsi_sertype
 
   size_t sz;
   unsigned char *blob = nn_xmsg_payload (&sz, mpayload);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   void *needle;
   size_t needlesz;
   assert (ddsi_plist_findparam_checking (blob + 4, sz, header.identifier, tp->keyparam, &needle, &needlesz) == DDS_RETCODE_OK);
diff --git a/src/core/ddsi/src/ddsi_sertype.c b/src/core/ddsi/src/ddsi_sertype.c
index 84b057f..4377ff9 100644
--- a/src/core/ddsi/src/ddsi_sertype.c
+++ b/src/core/ddsi/src/ddsi_sertype.c
@@ -70,7 +70,7 @@ struct ddsi_sertype *ddsi_sertype_ref (const struct ddsi_sertype *sertype_const)
 struct ddsi_sertype *ddsi_sertype_lookup_locked (struct ddsi_domaingv *gv, const struct ddsi_sertype *sertype_template)
 {
   struct ddsi_sertype *sertype = ddsrt_hh_lookup (gv->sertypes, sertype_template);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   if (sertype != NULL)
     assert ((ddsrt_atomic_ld32 (&sertype->flags_refc) & DDSI_SERTYPE_REFC_MASK) > 0);
 #endif
diff --git a/src/core/ddsi/src/ddsi_sertype_default.c b/src/core/ddsi/src/ddsi_sertype_default.c
index a5af5b8..d55e2b4 100644
--- a/src/core/ddsi/src/ddsi_sertype_default.c
+++ b/src/core/ddsi/src/ddsi_sertype_default.c
@@ -166,7 +166,7 @@ static void sertype_default_free_samples (const struct ddsi_sertype *sertype_com
     const struct ddsi_sertype_default *tp = (const struct ddsi_sertype_default *)sertype_common;
     const struct ddsi_sertype_default_desc *type = &tp->type;
     const size_t size = type->size;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     for (size_t i = 0, off = 0; i < count; i++, off += size)
       assert ((char *)ptrs[i] == (char *)ptrs[0] + off);
 #endif
diff --git a/src/core/ddsi/src/ddsi_sertype_plist.c b/src/core/ddsi/src/ddsi_sertype_plist.c
index 72b9237..ce85b5f 100644
--- a/src/core/ddsi/src/ddsi_sertype_plist.c
+++ b/src/core/ddsi/src/ddsi_sertype_plist.c
@@ -78,7 +78,7 @@ static void sertype_plist_free_samples (const struct ddsi_sertype *sertype_commo
   (void) sertype_common;
   if (count > 0)
   {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     for (size_t i = 0, off = 0; i < count; i++, off += sizeof (ddsi_plist_t))
       assert ((char *)ptrs[i] == (char *)ptrs[0] + off);
 #endif
diff --git a/src/core/ddsi/src/ddsi_sertype_pserop.c b/src/core/ddsi/src/ddsi_sertype_pserop.c
index ff52360..8a10817 100644
--- a/src/core/ddsi/src/ddsi_sertype_pserop.c
+++ b/src/core/ddsi/src/ddsi_sertype_pserop.c
@@ -97,7 +97,7 @@ static void sertype_pserop_free_samples (const struct ddsi_sertype *sertype_comm
   {
     const struct ddsi_sertype_pserop *tp = (const struct ddsi_sertype_pserop *)sertype_common;
     const size_t size = tp->memsize;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     for (size_t i = 0, off = 0; i < count; i++, off += size)
       assert ((char *)ptrs[i] == (char *)ptrs[0] + off);
 #endif
diff --git a/src/core/ddsi/src/ddsi_threadmon.c b/src/core/ddsi/src/ddsi_threadmon.c
index 59c5949..6793375 100644
--- a/src/core/ddsi/src/ddsi_threadmon.c
+++ b/src/core/ddsi/src/ddsi_threadmon.c
@@ -305,7 +305,7 @@ void ddsi_threadmon_stop (struct ddsi_threadmon *sl)
 
 void ddsi_threadmon_free (struct ddsi_threadmon *sl)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   struct ddsrt_hh_iter it;
   assert (ddsrt_hh_iter_first (sl->domains, &it) == NULL);
 #endif
diff --git a/src/core/ddsi/src/ddsi_tkmap.c b/src/core/ddsi/src/ddsi_tkmap.c
index 7f5c638..b398b76 100644
--- a/src/core/ddsi/src/ddsi_tkmap.c
+++ b/src/core/ddsi/src/ddsi_tkmap.c
@@ -145,7 +145,7 @@ struct ddsi_tkmap_instance *ddsi_tkmap_find_by_id (struct ddsi_tkmap *map, uint6
 
 /* Debug keyhash generation for debug and coverage builds */
 
-#ifdef NDEBUG
+#ifdef DDS_NDEBUG
 #if VL_BUILD_LCOV
 #define DDS_DEBUG_KEYHASH 1
 #else
diff --git a/src/core/ddsi/src/ddsi_topic.c b/src/core/ddsi/src/ddsi_topic.c
index e190229..d6720c6 100644
--- a/src/core/ddsi/src/ddsi_topic.c
+++ b/src/core/ddsi/src/ddsi_topic.c
@@ -437,7 +437,7 @@ dds_return_t ddsi_new_proxy_topic (struct ddsi_proxy_participant *proxypp, seqno
     tpd = ref_topic_definition (gv, NULL, type_id_minimal, qos, &new_tpd);
   if (tpd == NULL)
     return DDS_RETCODE_BAD_PARAMETER;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   bool found_proxytp = ddsi_lookup_proxy_topic (proxypp, guid);
   assert (!found_proxytp);
 #endif
diff --git a/src/core/ddsi/src/ddsi_typelib.c b/src/core/ddsi/src/ddsi_typelib.c
index 8a49535..3e71fd2 100644
--- a/src/core/ddsi/src/ddsi_typelib.c
+++ b/src/core/ddsi/src/ddsi_typelib.c
@@ -312,7 +312,7 @@ static void ddsi_type_fini (struct ddsi_domaingv *gv, struct ddsi_type *type)
     ddsi_typeid_fini (&dep->dep_type_id);
     ddsrt_free (dep);
   }
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   assert (!ddsi_type_proxy_guid_list_count (&type->proxy_guids));
 #endif
   ddsi_typeid_fini (&key.src_type_id);
@@ -797,7 +797,7 @@ static dds_return_t ddsi_type_get_typeinfo_toplevel (struct ddsi_domaingv *gv, c
   if ((ret = ddsi_typeobj_get_hash_id (&to_m, &ti_m)))
     goto err_typeid;
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     ddsi_typeid_t ti_c;
     if (ddsi_typeobj_get_hash_id (&to_c, &ti_c) != 0)
diff --git a/src/core/ddsi/src/ddsi_wraddrset.c b/src/core/ddsi/src/ddsi_wraddrset.c
index 08b72fa..4c70df2 100644
--- a/src/core/ddsi/src/ddsi_wraddrset.c
+++ b/src/core/ddsi/src/ddsi_wraddrset.c
@@ -215,7 +215,7 @@ static struct addrset *wras_collect_all_locs (const struct ddsi_writer *wr)
 struct rebuild_flatten_locs_helper_arg {
   ddsi_xlocator_t *locs;
   int idx;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   int size;
 #endif
 };
@@ -232,7 +232,7 @@ static void wras_flatten_locs_prealloc (struct locset *ls, struct addrset *addrs
   struct rebuild_flatten_locs_helper_arg flarg;
   flarg.locs = ls->locs;
   flarg.idx = 0;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   flarg.size = ls->nlocs;
 #endif
   addrset_forall (addrs, wras_flatten_locs_helper, &flarg);
diff --git a/src/core/ddsi/src/q_ddsi_discovery.c b/src/core/ddsi/src/q_ddsi_discovery.c
index 2c438cc..00451db 100644
--- a/src/core/ddsi/src/q_ddsi_discovery.c
+++ b/src/core/ddsi/src/q_ddsi_discovery.c
@@ -411,13 +411,13 @@ void get_participant_builtin_topic_data (const struct ddsi_participant *pp, ddsi
         // as a reasonablish way of not advertising iceoryx locators here
         continue;
       }
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
       int32_t kind;
 #endif
       uint32_t data_port, meta_port;
       if (pp->e.gv->config.many_sockets_mode != DDSI_MSM_MANY_UNICAST)
       {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
         kind = pp->e.gv->loc_default_uc.kind;
 #endif
         assert (kind == pp->e.gv->loc_meta_uc.kind);
@@ -426,7 +426,7 @@ void get_participant_builtin_topic_data (const struct ddsi_participant *pp, ddsi
       }
       else
       {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
         kind = pp->m_locator.kind;
 #endif
         data_port = meta_port = pp->m_locator.port;
diff --git a/src/core/ddsi/src/q_gc.c b/src/core/ddsi/src/q_gc.c
index 59dc4bf..bb3b093 100644
--- a/src/core/ddsi/src/q_gc.c
+++ b/src/core/ddsi/src/q_gc.c
@@ -40,7 +40,7 @@ struct gcreq_queue {
 static void threads_vtime_gather_for_wait (const struct ddsi_domaingv *gv, uint32_t *nivs, struct idx_vtime *ivs, struct thread_states_list *cur)
 {
   /* copy vtimes of threads, skipping those that are sleeping */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   const uint32_t nthreads = cur->nthreads;
 #endif
   uint32_t dstidx;
diff --git a/src/core/ddsi/src/q_init.c b/src/core/ddsi/src/q_init.c
index c72931d..0c0efce 100644
--- a/src/core/ddsi/src/q_init.c
+++ b/src/core/ddsi/src/q_init.c
@@ -1908,7 +1908,7 @@ err_unicast_sockets:
   ddsrt_cond_destroy (&gv->participant_set_cond);
   ddsrt_mutex_destroy (&gv->participant_set_lock);
   free_special_types (gv);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     struct ddsrt_hh_iter it;
     assert (ddsrt_hh_iter_first (gv->sertypes, &it) == NULL);
@@ -2306,7 +2306,7 @@ void rtps_fini (struct ddsi_domaingv *gv)
   ddsrt_mutex_destroy(&gv->naming_lock);
 
 #ifdef DDS_HAS_TOPIC_DISCOVERY
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     struct ddsrt_hh_iter it;
     assert (ddsrt_hh_iter_first (gv->topic_defs, &it) == NULL);
@@ -2316,7 +2316,7 @@ void rtps_fini (struct ddsi_domaingv *gv)
   ddsrt_mutex_destroy (&gv->topic_defs_lock);
 #endif /* DDS_HAS_TOPIC_DISCOVERY */
 #ifdef DDS_HAS_TYPE_DISCOVERY
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     assert(ddsrt_avl_is_empty(&gv->typelib));
     assert(ddsrt_avl_is_empty(&gv->typedeps));
@@ -2328,7 +2328,7 @@ void rtps_fini (struct ddsi_domaingv *gv)
   ddsrt_avl_free (&ddsi_typedeps_reverse_treedef, &gv->typedeps_reverse, 0);
   ddsrt_mutex_destroy (&gv->typelib_lock);
 #endif /* DDS_HAS_TYPE_DISCOVERY */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     struct ddsrt_hh_iter it;
     assert (ddsrt_hh_iter_first (gv->sertypes, &it) == NULL);
diff --git a/src/core/ddsi/src/q_inverse_uint32_set.c b/src/core/ddsi/src/q_inverse_uint32_set.c
index 012face..be8daa3 100644
--- a/src/core/ddsi/src/q_inverse_uint32_set.c
+++ b/src/core/ddsi/src/q_inverse_uint32_set.c
@@ -30,7 +30,7 @@ static int uint32_t_cmp(const void *va, const void *vb)
 
 static void check(const struct inverse_uint32_set *set)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   ddsrt_avl_iter_t it;
   struct inverse_uint32_set_node *pn = NULL, *n;
   assert(set->min <= set->max);
diff --git a/src/core/ddsi/src/q_qosmatch.c b/src/core/ddsi/src/q_qosmatch.c
index a1c8746..8c1306d 100644
--- a/src/core/ddsi/src/q_qosmatch.c
+++ b/src/core/ddsi/src/q_qosmatch.c
@@ -142,7 +142,7 @@ bool qos_match_mask_p (
 )
 {
   DDSRT_UNUSED_ARG (gv);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   uint64_t musthave = (QP_RXO_MASK | QP_PARTITION | QP_TOPIC_NAME | QP_TYPE_NAME | QP_DATA_REPRESENTATION) & mask;
   assert ((rd_qos->present & musthave) == musthave);
   assert ((wr_qos->present & musthave) == musthave);
diff --git a/src/core/ddsi/src/q_radmin.c b/src/core/ddsi/src/q_radmin.c
index dfaf395..1d4835d 100644
--- a/src/core/ddsi/src/q_radmin.c
+++ b/src/core/ddsi/src/q_radmin.c
@@ -15,7 +15,7 @@
 #include <stdlib.h>
 #include <limits.h>
 
-#if HAVE_VALGRIND && ! defined (NDEBUG)
+#if HAVE_VALGRIND && ! defined (DDS_NDEBUG)
 #include <memcheck.h>
 #define USE_VALGRIND 1
 #else
@@ -286,7 +286,7 @@ struct nn_rbufpool {
   uint32_t max_rmsg_size;
   const struct ddsrt_log_cfg *logcfg;
   bool trace;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   /* Thread that owns this pool, so we can check that no other thread
      is calling functions only the owner may use. */
   ddsrt_thread_t owner_tid;
@@ -310,7 +310,7 @@ static uint32_t align_rmsg (uint32_t x)
   return x;
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define ASSERT_RBUFPOOL_OWNER(rbp) (assert (ddsrt_thread_equal (ddsrt_thread_self (), (rbp)->owner_tid)))
 #else
 #define ASSERT_RBUFPOOL_OWNER(rbp) ((void) (0))
@@ -351,7 +351,7 @@ struct nn_rbufpool *nn_rbufpool_new (const struct ddsrt_log_cfg *logcfg, uint32_
 
   if ((rbp = ddsrt_malloc (sizeof (*rbp))) == NULL)
     goto fail_rbp;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   rbp->owner_tid = ddsrt_thread_self ();
 #endif
 
@@ -382,7 +382,7 @@ struct nn_rbufpool *nn_rbufpool_new (const struct ddsrt_log_cfg *logcfg, uint32_
 
 void nn_rbufpool_setowner (UNUSED_ARG_NDEBUG (struct nn_rbufpool *rbp), UNUSED_ARG_NDEBUG (ddsrt_thread_t tid))
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   rbp->owner_tid = tid;
 #endif
 }
@@ -488,7 +488,7 @@ static void nn_rbuf_release (struct nn_rbuf *rbuf)
    one node to one topic/partition ... */
 #define RMSG_REFCOUNT_UNCOMMITTED_BIAS (1u << 31)
 #define RMSG_REFCOUNT_RDATA_BIAS (1u << 20)
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define ASSERT_RMSG_UNCOMMITTED(rmsg) (assert (ddsrt_atomic_ld32 (&(rmsg)->refcount) >= RMSG_REFCOUNT_UNCOMMITTED_BIAS))
 #else
 #define ASSERT_RMSG_UNCOMMITTED(rmsg) ((void) 0)
@@ -731,7 +731,7 @@ struct nn_rdata *nn_rdata_new (struct nn_rmsg *rmsg, uint32_t start, uint32_t en
   d->submsg_zoff = (uint16_t) NN_OFF_TO_ZOFF (submsg_offset);
   d->payload_zoff = (uint16_t) NN_OFF_TO_ZOFF (payload_offset);
   d->keyhash_zoff = (uint16_t) NN_OFF_TO_ZOFF (keyhash_offset);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   ddsrt_atomic_st32 (&d->refcount_bias_added, 0);
 #endif
   RMSGTRACE ("rdata_new(%p, bytes [%"PRIu32",%"PRIu32"), submsg @ %u, payload @ %u) = %p\n",
@@ -743,7 +743,7 @@ static void nn_rdata_addbias (struct nn_rdata *rdata)
 {
   struct nn_rmsg *rmsg = rdata->rmsg;
   RMSGTRACE ("rdata_addbias(%p)\n", (void *) rdata);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   ASSERT_RBUFPOOL_OWNER (rmsg->chunk.rbuf->rbufpool);
   if (ddsrt_atomic_inc32_nv (&rdata->refcount_bias_added) != 1)
     abort ();
@@ -755,7 +755,7 @@ static void nn_rdata_rmbias_and_adjust (struct nn_rdata *rdata, int adjust)
 {
   struct nn_rmsg *rmsg = rdata->rmsg;
   RMSGTRACE ("rdata_rmbias_and_adjust(%p, %d)\n", (void *) rdata, adjust);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   if (ddsrt_atomic_dec32_ov (&rdata->refcount_bias_added) != 1)
     abort ();
 #endif
@@ -1735,7 +1735,7 @@ static void reorder_add_rsampleiv (struct nn_reorder *reorder, struct nn_rsample
   ddsrt_avl_insert_ipath (&reorder_sampleivtree_treedef, &reorder->sampleivtree, rsample, &path);
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static int rsample_is_singleton (const struct nn_rsample_reorder *s)
 {
   assert (s->min < s->maxp1);
@@ -1805,7 +1805,7 @@ struct nn_rsample *nn_reorder_rsample_dup_first (struct nn_rmsg *rmsg, struct nn
      rsampleiv. */
   struct nn_rsample *rsampleiv_new;
   struct nn_rsample_chain_elem *sce;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     struct nn_rdata *d = rsampleiv->u.reorder.sc.first->fragchain;
     while (d && d->rmsg != rmsg)
@@ -1918,7 +1918,7 @@ nn_reorder_result_t nn_reorder_rsample (struct nn_rsample_chain *sc, struct nn_r
 
   /* Reorder must not contain samples with sequence numbers <= next
      seq; max must be set iff the reorder is non-empty. */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     struct nn_rsample *min = ddsrt_avl_find_min (&reorder_sampleivtree_treedef, &reorder->sampleivtree);
     if (min)
@@ -2159,7 +2159,7 @@ static struct nn_rsample *coalesce_intervals_touching_range (struct nn_reorder *
   if (s && s->u.reorder.maxp1 >= min)
   {
     /* m <= min && n >= min (note: pred of s [m',n') necessarily has n' < m) */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     struct nn_rsample *q = ddsrt_avl_find_pred (&reorder_sampleivtree_treedef, &reorder->sampleivtree, s);
     assert (q == NULL || q->u.reorder.maxp1 < min);
 #endif
@@ -2351,7 +2351,7 @@ void nn_reorder_drop_upto (struct nn_reorder *reorder, seqno_t maxp1)
   // nn_reorder_gap
   struct nn_rdata gap = {
     .rmsg = NULL, .nextfrag = NULL, .min = 0, .maxp1 = 0, .submsg_zoff = 0, .payload_zoff = 0
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     , .refcount_bias_added = DDSRT_ATOMIC_UINT32_INIT (0)
 #endif
   };
@@ -2550,7 +2550,7 @@ static uint32_t dqueue_thread (struct nn_dqueue *q)
       {
         case DQEK_DATA:
           ret = q->handler (e->sampleinfo, e->fragchain, prdguid, q->handler_arg);
-          (void) ret; /* eliminate set-but-not-used in NDEBUG case */
+          (void) ret; /* eliminate set-but-not-used in DDS_NDEBUG case */
           assert (ret == 0); /* so every handler will return 0 */
           /* FALLS THROUGH */
         case DQEK_GAP:
diff --git a/src/core/ddsi/src/q_thread.c b/src/core/ddsi/src/q_thread.c
index 331ae70..489a63b 100644
--- a/src/core/ddsi/src/q_thread.c
+++ b/src/core/ddsi/src/q_thread.c
@@ -111,7 +111,7 @@ void thread_states_init (void)
      in the past.  Also, allocate a slot for this thread if it didn't have one yet
      (not strictly required, but it'll get one eventually anyway, and this makes
      it rather more clear). */
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   struct thread_state * const ts0 = tsd_thread_state;
 #endif
   struct thread_state * const thrst = lookup_thread_state_real ();
diff --git a/src/core/ddsi/src/q_transmit.c b/src/core/ddsi/src/q_transmit.c
index 2af7fd4..7a24c0d 100644
--- a/src/core/ddsi/src/q_transmit.c
+++ b/src/core/ddsi/src/q_transmit.c
@@ -993,7 +993,7 @@ static int insert_sample_in_whc (struct ddsi_writer *wr, seqno_t seq, struct dds
 #endif
   }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   if (((wr->e.guid.entityid.u == NN_ENTITYID_SPDP_BUILTIN_PARTICIPANT_WRITER) ||
        (wr->e.guid.entityid.u == NN_ENTITYID_SPDP_RELIABLE_BUILTIN_PARTICIPANT_SECURE_WRITER)) &&
        !ddsi_is_local_orphan_endpoint (&wr->e))
diff --git a/src/core/ddsi/src/q_xevent.c b/src/core/ddsi/src/q_xevent.c
index edf2605..6848711 100644
--- a/src/core/ddsi/src/q_xevent.c
+++ b/src/core/ddsi/src/q_xevent.c
@@ -298,7 +298,7 @@ static int compute_non_timed_xmit_list_size (struct xeventq *evq)
   return i;
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static int nontimed_xevent_in_queue (struct xeventq *evq, struct xevent_nt *ev)
 {
   if (!(evq->gv->config.enabled_xchecks & DDSI_XCHECK_XEV))
@@ -993,7 +993,7 @@ static void handle_xevk_spdp (UNUSED_ARG (struct nn_xpack *xp), struct xevent *e
 
   if (do_write && !resend_spdp_sample_by_guid_key (spdp_wr, &ev->u.spdp.pp_guid, prd))
   {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     /* If undirected, it is pp->spdp_xevent, and that one must never
        run into an empty WHC unless it is already marked for deletion.
 
diff --git a/src/core/ddsi/src/q_xmsg.c b/src/core/ddsi/src/q_xmsg.c
index 79be924..e3827f9 100644
--- a/src/core/ddsi/src/q_xmsg.c
+++ b/src/core/ddsi/src/q_xmsg.c
@@ -352,7 +352,7 @@ void nn_xmsg_free (struct nn_xmsg *m)
 
 /************************************************/
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static int submsg_is_compatible (const struct nn_xmsg *msg, SubmessageKind_t smkind)
 {
   switch (msg->kind)
@@ -1235,7 +1235,7 @@ static ssize_t nn_xpack_send1 (const ddsi_xlocator_t *loc, void * varg)
   {
     nbytes = nn_xpack_send_rtps(xp, loc);
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     {
       size_t i, len;
       for (i = 0, len = 0; i < xp->niov; i++) {
diff --git a/src/core/xtests/rhc_torture/rhc_torture.c b/src/core/xtests/rhc_torture/rhc_torture.c
index afe9b2c..5a80cc1 100644
--- a/src/core/xtests/rhc_torture/rhc_torture.c
+++ b/src/core/xtests/rhc_torture/rhc_torture.c
@@ -271,7 +271,7 @@ struct check {
 
 static void docheck (int n, const dds_sample_info_t *iseq, const RhcTypes_T *mseq, const struct check *chk)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   int i;
 
   for (i = 0; i < n; i++)
@@ -513,7 +513,7 @@ static void wait_gc_cycle (struct gcreq_queue *gcreq_queue)
 {
   /* only single-threaded for now */
   struct gcreq *gcreq = gcreq_new (gcreq_queue, wait_gc_cycle_impl);
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   ddsrt_mutex_lock (&wait_gc_cycle_lock);
   assert (wait_gc_cycle_trig == 0);
   ddsrt_mutex_unlock (&wait_gc_cycle_lock);
diff --git a/src/ddsrt/CMakeLists.txt b/src/ddsrt/CMakeLists.txt
index 7f5983d..3bc0e91 100644
--- a/src/ddsrt/CMakeLists.txt
+++ b/src/ddsrt/CMakeLists.txt
@@ -316,6 +316,9 @@ if(DDS_PLUGINS_DIR)
   target_compile_definitions(ddsrt-internal INTERFACE "DDS_PLUGINS_DIR=\"${CMAKE_INSTALL_PREFIX}/${DDS_PLUGINS_DIR}\"")
 endif()
 
+target_compile_definitions(ddsrt INTERFACE DDS_NDEBUG)
+target_compile_definitions(ddsrt-internal INTERFACE DDS_NDEBUG)
+
 if(BUILD_TESTING)
   add_subdirectory(tests)
 endif()
diff --git a/src/ddsrt/src/circlist.c b/src/ddsrt/src/circlist.c
index 68307d7..9096bdf 100644
--- a/src/ddsrt/src/circlist.c
+++ b/src/ddsrt/src/circlist.c
@@ -32,7 +32,7 @@ void ddsrt_circlist_append (struct ddsrt_circlist *list, struct ddsrt_circlist_e
   else
   {
     struct ddsrt_circlist_elem * const hd = list->latest;
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
     {
       const struct ddsrt_circlist_elem *x = hd;
       do { assert (x != elem); x = x->next; } while (x != hd);
@@ -48,7 +48,7 @@ void ddsrt_circlist_append (struct ddsrt_circlist *list, struct ddsrt_circlist_e
 
 void ddsrt_circlist_remove (struct ddsrt_circlist *list, struct ddsrt_circlist_elem *elem)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   {
     const struct ddsrt_circlist_elem *x = list->latest;
     assert (x);
diff --git a/src/ddsrt/src/heap/vxworks/heap.c b/src/ddsrt/src/heap/vxworks/heap.c
index 61f2ddd..488909d 100644
--- a/src/ddsrt/src/heap/vxworks/heap.c
+++ b/src/ddsrt/src/heap/vxworks/heap.c
@@ -19,7 +19,7 @@
  * by including the common implementation
  */
 #if defined(OS_USE_ALLIGNED_MALLOC)
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #include "os/os.h"
 atomic_t os__reallocdoublecopycount = 0;
 #endif
@@ -115,7 +115,7 @@ void *ddsrt_realloc(
         /* realloc returned memory with different alignment */
         assert (  ((char *)newdata)+4 == ((char *)olddata)
              ||((char *)olddata)+4 == ((char *)newdata));
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
         vxAtomicInc( &os__reallocdoublecopycount);
 #endif
         memmove(newdata, olddata, origsize < size ? origsize : size);
diff --git a/src/ddsrt/src/sync/freertos/tasklist.c b/src/ddsrt/src/sync/freertos/tasklist.c
index d290734..6fd6d82 100644
--- a/src/ddsrt/src/sync/freertos/tasklist.c
+++ b/src/ddsrt/src/sync/freertos/tasklist.c
@@ -55,7 +55,7 @@
        1st     nth
 */
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 
 static void tasklist_assert(ddsrt_tasklist_t *list)
 {
@@ -76,7 +76,7 @@ static void tasklist_assert(ddsrt_tasklist_t *list)
 }
 #else
 #define tasklist_assert(...)
-#endif /* NDEBUG */
+#endif /* DDS_NDEBUG */
 
 int ddsrt_tasklist_init(ddsrt_tasklist_t *list)
 {
diff --git a/src/idl/src/expression.c b/src/idl/src/expression.c
index 5facf8f..67cf13f 100644
--- a/src/idl/src/expression.c
+++ b/src/idl/src/expression.c
@@ -321,7 +321,7 @@ int_modulo(idl_intval_t *a, idl_intval_t *b, idl_intval_t *r)
   return IDL_RETCODE_OK;
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static bool is_arith_return_type (idl_type_t t)
 {
   return (t == IDL_LONG || t == IDL_ULONG || t == IDL_LLONG || t == IDL_ULLONG);
diff --git a/src/idl/src/tree.c b/src/idl/src/tree.c
index 88d191a..67ab959 100644
--- a/src/idl/src/tree.c
+++ b/src/idl/src/tree.c
@@ -386,7 +386,7 @@ bool idl_is_declaration(const void *ptr)
 
 bool idl_is_module(const void *ptr)
 {
-#if !defined NDEBUG
+#if !defined DDS_NDEBUG
   static const idl_mask_t mask =
     IDL_MODULE | IDL_CONST | IDL_STRUCT | IDL_UNION | IDL_ENUM | IDL_BITMASK |
     IDL_TYPEDEF | IDL_ANNOTATION;
@@ -504,7 +504,7 @@ err_node:
 
 bool idl_is_const(const void *ptr)
 {
-#if !defined(NDEBUG)
+#if !defined(DDS_NDEBUG)
   static const idl_mask_t mask =
     IDL_BASE_TYPE | IDL_STRING | IDL_ENUMERATOR;
 #endif
@@ -942,7 +942,7 @@ err_node:
 
 bool idl_is_string(const void *ptr)
 {
-#if !defined(NDEBUG)
+#if !defined(DDS_NDEBUG)
   static const idl_mask_t mask = IDL_CONST | IDL_TYPEDEF | IDL_MEMBER |
                                  IDL_CASE | IDL_SEQUENCE | IDL_ANNOTATION_APPL_PARAM |
                                  IDL_SWITCH_TYPE_SPEC;
@@ -2365,7 +2365,7 @@ err_node:
 
 bool idl_is_case_label(const void *ptr)
 {
-#if !defined(NDEBUG)
+#if !defined(DDS_NDEBUG)
   static const idl_mask_t mask = IDL_LITERAL | IDL_ENUMERATOR;
 #endif
   const idl_case_label_t *node = ptr;
@@ -3373,7 +3373,7 @@ idl_create_annotation_appl_param(
 
 bool idl_is_annotation_appl(const void *ptr)
 {
-#if !defined(NDEBUG)
+#if !defined(DDS_NDEBUG)
   static const idl_mask_t mask = IDL_MODULE |
                                  IDL_ENUM |
                                  IDL_STRUCT | IDL_MEMBER |
diff --git a/src/security/builtin_plugins/access_control/src/access_control.c b/src/security/builtin_plugins/access_control/src/access_control.c
index e6d97cb..7c131bc 100644
--- a/src/security/builtin_plugins/access_control/src/access_control.c
+++ b/src/security/builtin_plugins/access_control/src/access_control.c
@@ -1655,7 +1655,7 @@ static void
 sanity_check_local_access_rights(
     local_participant_access_rights *rights)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   if (rights)
   {
     assert(rights->permissions_document);
@@ -1677,7 +1677,7 @@ static void
 sanity_check_remote_access_rights(
     remote_participant_access_rights *rights)
 {
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   /* Just some sanity checks. */
   if (rights)
   {
diff --git a/src/security/builtin_plugins/authentication/src/authentication.c b/src/security/builtin_plugins/authentication/src/authentication.c
index 685e476..f2f2767 100644
--- a/src/security/builtin_plugins/authentication/src/authentication.c
+++ b/src/security/builtin_plugins/authentication/src/authentication.c
@@ -73,7 +73,7 @@ struct SecurityObject
   SecurityObjectDestructor destructor;
 };
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define CHECK_OBJECT_KIND(o, k) assert(security_object_valid((SecurityObject *)(o), k))
 #else
 #define CHECK_OBJECT_KIND(o, k)
diff --git a/src/security/builtin_plugins/cryptographic/src/crypto_cipher.c b/src/security/builtin_plugins/cryptographic/src/crypto_cipher.c
index 3a5d53a..2c5569a 100644
--- a/src/security/builtin_plugins/cryptographic/src/crypto_cipher.c
+++ b/src/security/builtin_plugins/cryptographic/src/crypto_cipher.c
@@ -25,7 +25,7 @@
   goto lab_; \
 } while (0)
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 static bool check_buffer_sizes (const size_t num, const const_tainted_crypto_data_t *inp, const tainted_crypto_data_t *outp)
   ddsrt_nonnull((2)) ddsrt_attribute_warn_unused_result;
 
diff --git a/src/security/builtin_plugins/cryptographic/src/crypto_objects.h b/src/security/builtin_plugins/cryptographic/src/crypto_objects.h
index 72b18c5..1b6f47f 100644
--- a/src/security/builtin_plugins/cryptographic/src/crypto_objects.h
+++ b/src/security/builtin_plugins/cryptographic/src/crypto_objects.h
@@ -22,7 +22,7 @@
 #include "dds/security/core/dds_security_utils.h"
 #include "crypto_defs.h"
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 #define CHECK_CRYPTO_OBJECT_KIND(o, k) assert(crypto_object_valid((CryptoObject *)(o), k))
 #else
 #define CHECK_CRYPTO_OBJECT_KIND(o, k)
diff --git a/src/security/core/src/dds_security_utils.c b/src/security/core/src/dds_security_utils.c
index d859b21..40321fa 100644
--- a/src/security/core/src/dds_security_utils.c
+++ b/src/security/core/src/dds_security_utils.c
@@ -922,7 +922,7 @@ DDS_Security_protectionkind2transformationkind(
     }
 }
 
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
 void
 print_binary_debug(
      char* name,
diff --git a/src/tools/idlc/src/descriptor_type_meta.c b/src/tools/idlc/src/descriptor_type_meta.c
index bb90100..d079714 100644
--- a/src/tools/idlc/src/descriptor_type_meta.c
+++ b/src/tools/idlc/src/descriptor_type_meta.c
@@ -576,7 +576,7 @@ get_check_type_spec_typeid(
     if ((ret = get_typeid (pstate, dtm, type_spec, alias_related_type, ti, kind, false)) < 0)
       return ret;
   }
-#ifndef NDEBUG
+#ifndef DDS_NDEBUG
   else {
     DDS_XTypes_TypeIdentifier ti_tmp;
     memset (&ti_tmp, 0, sizeof (ti_tmp));