Some time ago I ran into problems with conflicts because the LLVM DEBUG macro and macros defined by our internal software here. I worked around it but it is ugly. This just came up again today. The fundamental problem is that two pieces of software both use the generic name "DEBUG." This is just problems waiting to happen. We need some kind of namespace. Would the LLVM community be open to changing DEBUG to something like LLVM_DEBUG? I am pushing to have our code be changed in a similar way. It's just not good design to use a generic name like DEBUG that isn't qualified by some prefix/namespace. -Dave
On Jul 7, 2008, at 11:31 AM, Chris Lattner wrote:> On Mon, 7 Jul 2008, David Greene wrote: >> Some time ago I ran into problems with conflicts because the LLVM >> DEBUG macro >> and macros defined by our internal software here. I worked around >> it but it >> is ugly. >> >> This just came up again today. The fundamental problem is that two >> pieces of >> software both use the generic name "DEBUG." This is just problems >> waiting >> to happen. We need some kind of namespace. >> >> Would the LLVM community be open to changing DEBUG to something like >> LLVM_DEBUG? I am pushing to have our code be changed in a similar >> way. > > Debug.h should only be #included by .cpp files, not .h files. Are you > seeing a case where you need to use both debug macros in a .cpp file?I just checked, and Debug.h was included in a few .h files, which I've now fixed. Dan
On Mon, 7 Jul 2008, David Greene wrote:> Some time ago I ran into problems with conflicts because the LLVM DEBUG macro > and macros defined by our internal software here. I worked around it but it > is ugly. > > This just came up again today. The fundamental problem is that two pieces of > software both use the generic name "DEBUG." This is just problems waiting > to happen. We need some kind of namespace. > > Would the LLVM community be open to changing DEBUG to something like > LLVM_DEBUG? I am pushing to have our code be changed in a similar way.Debug.h should only be #included by .cpp files, not .h files. Are you seeing a case where you need to use both debug macros in a .cpp file? -Chris -- http://nondot.org/sabre/ http://llvm.org/
On Monday 07 July 2008 13:31, Chris Lattner wrote:> On Mon, 7 Jul 2008, David Greene wrote: > > Some time ago I ran into problems with conflicts because the LLVM DEBUG > > macro and macros defined by our internal software here. I worked around > > it but it is ugly. > > > > This just came up again today. The fundamental problem is that two > > pieces of software both use the generic name "DEBUG." This is just > > problems waiting to happen. We need some kind of namespace. > > > > Would the LLVM community be open to changing DEBUG to something like > > LLVM_DEBUG? I am pushing to have our code be changed in a similar way. > > Debug.h should only be #included by .cpp files, not .h files. Are you > seeing a case where you need to use both debug macros in a .cpp file?That's not the issue. We have some interface (.cpp) files that convert from our IR to LLVM IR. Those files need to include headers from both LLVM and our compiler components. That is where the DEBUG conflict happens. -Dave