Sadly, I think the missing #ifndef is merely a symptom of laziness. If you wanted to send a pull request, I don't think anyone would object to merging it in :)

On Monday, February 20, 2012 at 10:37 AM, Marc Abramowitz wrote:

I might be missing something obvious here.

I want to be able to build MacRuby with debug information by tweaking the command-line instead of the code itself (which is what I had been doing until now). Something like:

[last: 41] marca@SCML-MarcA:~/dev/git-repos/MacRuby$ CFLAGS="-DROXOR_VM_DEBUG" rake
(in /Users/marca/dev/git-repos/MacRuby)
/usr/bin/g++ -I. -I./include -fblocks -g -Wall -Wno-deprecated-declarations -Werror -arch x86_64 -DROXOR_VM_DEBUG -I/usr/local/include  -D_DEBUG -D_GNU_SOURCE -D__STDC_LIMIT_MACROS -D__STDC_CONSTANT_MACROS -O3   -fno-rtti -fno-common -Woverloaded-virtual -I./icu-1060 -c vm.cpp -o .objs/vm.o
vm.cpp:9:1: error: "ROXOR_VM_DEBUG" redefined
<command-line>: error: this is the location of the previous definition
rake aborted!
Command failed with status (1): [/usr/bin/g++ -I. -I./include -fblocks -g -...]

(See full trace by running task with --trace)

This fails because vm.cpp has:

#define ROXOR_VM_DEBUG 0

I could fix this by changing that to:

#ifndef ROXOR_VM_DEBUG
#define ROXOR_VM_DEBUG 0
#endif

but the fact that it's not already there makes me think that people have another, easier way to switch compile flags.

If there's an easier way, please let me know what it is and if there's not, should I send a pull request that wraps all the #defines in #ifndefs?

Marc

_______________________________________________
MacRuby-devel mailing list
MacRuby-devel@lists.macosforge.org
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel