Closed Bug 564402 Opened 14 years ago Closed 14 years ago

slots #define in Qt, prevents Qt builds on trunk

Categories

(Core Graveyard :: Widget: Qt, defect)

All
Linux
defect
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: MikeK, Assigned: dougt)

References

Details

Attachments

(1 file, 3 obsolete files)

Due to a #define of "slots" Qt builds are failing, as "slots" are used as a local variable name in nsINode.h
Attached patch Undefines the "slots" #define (obsolete) — Splinter Review
Attachment #444062 - Flags: review?(dougt)
Patch looks like not a patch... ;)

I think bug 564291 and this bug are duplicating each other
Attached patch The real patch (obsolete) — Splinter Review
I must have clicked the wrong file in the previous attachment...
Attachment #444062 - Attachment is obsolete: true
Attachment #444062 - Flags: review?(dougt)
Attachment #444065 - Attachment is obsolete: true
Comment on attachment 444065 [details] [diff] [review]
The real patch

Wrong file
My FF attach file function seems to be seriously broken, The file I click, in the "open file" dialog is not the one that gets selected...

For anyone interested the patch can be found at: http://pastebin.mozilla.org/721855  (can anyone attach it for me, until I figure out what is wrong with my system)

I'll reboot my computer when it finishes the builds its running, to see if that solves the issue....
Attached patch Fix (obsolete) — Splinter Review
Attachment #444068 - Flags: review?(dougt)
> It's not the nsSlots that is the problem, its a macro definition of "slots"

hrrr.. I was searching for nsSlots in headers...

We had similar problem before... but that was fixed by renaming variable name from slots->slotss or something like that ;)
Yes, I also had kind of a dejavu when I saw this... an unfortunate design decision in the Qt headers...
(In reply to comment #8)

> We had similar problem before... but that was fixed by renaming variable name
> from slots->slotss or something like that ;)

btw - I opted for an undefine of slots this time, as I don't think our "generic" code should "suffer" from an old fashioned #define in the Qt headers - we wouldn't even be able to solve this issue with namespaces as #defines are a pure text substitutions...
(In reply to comment #7)
> Created an attachment (id=444068) [details]
> Fix

Thank you - seems like I needed a reboot of my PC for the attachment function to work as intended again.
Attachment #444068 - Flags: review?(dougt) → review+
Keywords: checkin-needed
Assignee: nobody → romaxa
Assignee: romaxa → mkristoffersen
http://hg.mozilla.org/mozilla-central/rev/6c56e83f9599
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Keywords: checkin-needed
hmm.  on second thought, i am not sure I like this.  we should just rename the variables in nsINode.h.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Or start complain about ugly Qt headers... and ask them use namespace
Attached patch patch v.2Splinter Review
Assignee: mkristoffersen → dougt
Attachment #444068 - Attachment is obsolete: true
Attachment #444752 - Flags: superreview?(jst)
Attachment #444752 - Flags: review?(jst)
(In reply to comment #14)
> Or start complain about ugly Qt headers... and ask them use namespace

namespace doesn't help for #defines (at least not in the C++ sense), if they didn't use #define we would not have a problem... but I agree the headers are ugly
(In reply to comment #13)
> hmm.  on second thought, i am not sure I like this.  we should just rename the
> variables in nsINode.h.

Why should our code "suffer" from purely designed headers?
we can complain all we want, but the Qt ugly is already out in the world.  We have sucked it up elsewhere (http://mxr.mozilla.org/mozilla-central/source/netwerk/base/public/nsIURI.idl#73, and a bunch of other places)

Lets move on.
Comment on attachment 444752 [details] [diff] [review]
patch v.2

Bastards.
Attachment #444752 - Flags: superreview?(jst)
Attachment #444752 - Flags: superreview+
Attachment #444752 - Flags: review?(jst)
Attachment #444752 - Flags: review+
(In reply to comment #17)
> (In reply to comment #13)
> > hmm.  on second thought, i am not sure I like this.  we should just rename the
> > variables in nsINode.h.
> 
> Why should our code "suffer" from purely designed headers?

Let me rephrase this question:

Why should our non-Qt related code suffer from a mistake in a Qt header, when that mistake can be contained to our own Qt specific files?
With your patch, there were other files that stilled failed to compile for the same reason.  Instead of fixing those in a similar manner, I felt it was just easier to rename the local variables used in the public dom interface.
(In reply to comment #21)
> With your patch, there were other files that stilled failed to compile for the
> same reason.  Instead of fixing those in a similar manner, I felt it was just
> easier to rename the local variables used in the public dom interface.

Strange it compiled fine for me... - sometimes its better to take the easy solution than the right one - in this case I'm not sure - it is definitively not the first time we have problems with a #define form Qt, and it is probably not the last time either.

Would it be an idea if I create a new header file that gets included in all of our files that includes Qt headers where we can deal with this kind of things?  

We already have an unwritten rule that states that the Qt files needs to be first in the file, I don't think it would be too bad to have a rule that it must be terminated by a specific file too.

First of all when we get these errors it is not obvious what happens by looking at the compiler errors, which makes it more difficult for the poor person who happens to declare a local slots variable.

Secondary it is against all common coding practice to use a #define that way - it will continue to haunt us forever if we don't try to contain it to our Qt files.

And finally we don't have any Qt builds on the FireFox tinderbox, which means that most people don't discover when they break Qt in the first place - we might want to fix that issue in another way thou...

That being said, this is not one of the battles that I'm going to invest much more time in, this is just a minor thing compared to other problems in our codebase.
if you would like to create a new mozilla/qt header file that we include that undefs slots, and then find all places where we #include Qt stuff, go for it.  (separate bug, very low priority)
http://hg.mozilla.org/mozilla-central/rev/fb38d987711f
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: