patchThe GNU Hurd - Patches: patch #3346, GNUMach: ifdef DEBUG -> ifndef...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #3346: GNUMach: ifdef DEBUG -> ifndef NDEBUG

Submitter:  Neal H. Walfield <neal>
Submitted:  Tue 07 Sep 2004 02:29:43 PM UTC
   
 
Category:  GNU Mach Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Planned Release:  None
Wiki-like text discussion box: 


Tue 07 Sep 2004 02:29:43 PM UTC, original submission:  

I think it would be useful to turn asserts on when building GNU Mach.
One way to go about doing this would be to define DEBUG when
building.  I think it might be useful, however, to be more like the
posix interface and only disable asserts when NDEBUG is defined.

This also helps get rid of some of the warnings:

        warning: extra tokens at end of #endif directive

It also includes a small patch which fixes a bad assert (basically
suggesting that no one has compiled GNU Mach with asserts turned on
for the past few years).

I used the attached shell script to automate the changes, however, I
have verified all of the changes by hand and I have compiled the code
(at least using my configuration which does not include all of the
changed files).

This patch has already proved useful for uncovering one bug and
several potential more.  (Patches and full explanations to follow as I
get to them.)

Thanks.

for i in $(find . -type f -name '*.[chS]' -print0 \
| xargs -0 grep -E -l -e '\bDEBUG\b')
do
  sed \
    -e 's/^\(#[[:blank:]]*if[[:blank:]]*!\?[[:blank:]]*\)\(DEBUG[[:blank:]]*\)$/\1!N\2/g' \
    -e 's/^\(#[[:blank:]]*if[[:blank:]]*!\?[[:blank:]]*defined[[:blank:]]*([[:blank:]]*\)DEBUG)/\1!NDEBUG)/g' \
    -e 's/^\(#[[:blank:]]*if\)\(def[[:blank:]]*!\?\)\(DEBUG[[:blank:]]*\)$/\1n\2N\3/g' \
    -e 's/^\(#[[:blank:]]*\(endif\|else\)[[:blank:]]\+\)\(\/\*\)\?\([[:blank:]]*!\?\)DEBUG\([[:blank:]]*\*\/\)\?[[:blank:]]*$/\1 \/* NDEBUG *\//g' < $i > $i.tmp && mv $i.tmp $i
done

Neal H. Walfield <neal>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #7841:  debug.diff added by neal (31KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

CC list is empty

 

There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

 

Follow 3 latest changes.

Date Changed by Updated Field Previous Value => Replaced by
2004-12-03 neal StatusNone Done
    Open/ClosedOpen Closed
2004-09-07 neal Attached File- Added debug.diff, #3646

Back to the top

Powered by Savane 3.13-caa5.
Corresponding source code