This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Who controls the definition of NDEBUG? I have the following code snippet:
#if defined NDEBUG DebugTX->print("\rPROD"); #endif
No matter what I do, the code inside the #if defined #endif executes. In Debug build configuration I tried to do the following:
1) Did not Define the NDEBUG - the code inside the #if #endif still rins.
2) Tried to undefine as in the command below:
"/home/sporty/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/bin/cl430" -vmspx --code_model=large --data_model=large --near_data=none -O2 --opt_for_speed=3 --use_hw_mpy=F5 --include_path="/home/sporty/ti/ccsv6/ccs_base/msp430/include" --include_path="/home/sporty/HydroGuardFW/hw_1_5/miwt_os/include" --include_path="/home/sporty/HydroGuardFW/driverlib_msp430f5335" --include_path="/home/sporty/HydroGuardFW/hw_1_5" --include_path="/home/sporty/ti/ccsv6/tools/compiler/msp430_15.12.3.LTS/include" -g --undefine=NDEBUG --define=__MSP430F5335__ --diag_warning=225 --display_error_number --diag_wrap=off --silicon_errata=CPU21 --silicon_errata=CPU22 --silicon_errata=CPU40 --abi=eabi --printf_support=minimal --preproc_with_compile --preproc_dependency="coap_resources/fw.d" --obj_directory="coap_resources" "../coap_resources/fw.cpp"
Is there something really special about the NDEBUG?
There is nothing special about NDEBUG. My guess is some header file is defining it. Preprocessor problems like this are best debugged by using the option --gen_acp_raw, then inspecting the resulting listing file (file extension .rl). Please read about it in the MSP430 compiler manual.
Thanks and regards,
-George
OK, but the problem is you cannot undefine a define in source code.
So no matter what you do, the assert macro is ((void)0), as long as the macro is there. A band-aid is to comment out that line of code, which works, I tried it, but our policy is not to use modified libraries for production code. For this reason, I believe that the NDEBUG definition directive makes the behaviour of NDEBUG as nonstandard.