Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defined macro CT in blitz/tau.h causes trouble when compiling project that uses Qt5/QColor.h #173

Open
Iceman9 opened this issue Mar 15, 2021 · 2 comments

Comments

@Iceman9
Copy link

Iceman9 commented Mar 15, 2021

#define CT(obj)

This defined macro causes an issue of compiling projects that include blitz and Qt5, specifically QColor.h as shown in the following link:

https://github.com/qt/qtbase/blob/40143c189b7c1bf3c2058b77d00ea5c4e3be8b28/src/gui/painting/qcolor.h#L266

The error output doesn't help much. as the compiler only complains that the there is a mismatch in the number of arguments provided to the macro. It took as a while to hunt through the army of headers.

The solution was simple. I #undef the macro before including the Qt headers. We just wanted to know where was the origin.

I don't think something should be done, but I just want to mark it if someone else gets into this situation in the future.

Best regards

@denisri
Copy link

denisri commented Dec 3, 2021

I run into the exact same problem compiling existing code on a prerelease of Ubuntu 22.04.
Defining a two-letter maco is prone to ambiguity and, thus, is dangerous, isn't it ? Isnt't there a way to change this CT maco name (for, say, BLITZ_CT for instance), or is it a public API ?

@slayoo
Copy link
Member

slayoo commented Dec 3, 2021

Thanks @Iceman9 for reporting and @denisri following up.
The origin of the problem seems to be outside of Blitz, it is the tau profiler that defines the CT macro: https://www.cs.uoregon.edu/research/tau/docs/newguide/bk03rn01re146.html

In Blitz code, this definition is within an "#else" block of an "#ifdef BZ_TAU_PROFILING".

I guess, the best solution is to include this #ifdef BZ_TAU_PROFILING wherever the CT macro is used, i.e.:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants