Closed Bug 716278 Opened 13 years ago Closed 12 years ago

"warning: invoking macro NS_ENSURE_TRUE argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98" compiler warnings in some Mailnews files

Categories

(MailNews Core :: Backend, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 18.0

People

(Reporter: aceman, Assigned: aceman)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file, 1 obsolete file)

Similar GCC warnings are output for several files in mailnews: mailnews/base/src/nsMsgMailSession.cpp:625:32: warning: invoking macro NS_ENSURE_TRUE argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgMailSession.cpp:626:52: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgMailSession.cpp:626:52: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:548:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:548:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:552:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:552:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:555:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO mailnews/base/src/nsMsgContentPolicy.cpp:555:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:596:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:596:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:600:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:600:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:613:27: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/base/src/nsMsgContentPolicy.cpp:613:27: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp:333:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp:333:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/addrbook/src/nsAbAddressCollector.cpp:382:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/addrbook/src/nsAbAddressCollector.cpp:382:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/addrbook/src/nsAbAddressCollector.cpp:385:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/addrbook/src/nsAbAddressCollector.cpp:385:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/addrbook/src/nsAbAddressCollector.cpp:389:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/addrbook/src/nsAbAddressCollector.cpp:389:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:4257:28: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:4257:28: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:4263:30: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:4263:30: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:7388:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:7388:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:7447:29: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsImapMailFolder.cpp:7447:29: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsAutoSyncManager.cpp:361:34: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/imap/src/nsAutoSyncManager.cpp:361:34: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/local/src/nsLocalMailFolder.cpp:2166:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/local/src/nsLocalMailFolder.cpp:2166:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/local/src/nsLocalMailFolder.cpp:2190:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98 mailnews/local/src/nsLocalMailFolder.cpp:2190:25: warning: invoking macro NS_ENSURE_SUCCESS argument 2: empty macro arguments are undefined in ISO C90 and ISO C++98
They are caused by constructs like 'NS_ENSURE_SUCCESS(rv, );' (second argument is empty) inside of void functions. Can this be resolved in some way?
I think NS_ENSURE_SUCCESS(rv, /**/); is enough to shut the compiler up.
Oh nice, I can try that.
That didn't work. Gcc is probably smart enough to remove comments before expanding the macro. But ' (void)0 ' worked for me.
That doesn't work in a constructor. Any ideas?
Attached patch fix for all warnings except in 2 constructors. (obsolete) (deleted) — Splinter Review
Attachment #590459 - Flags: feedback?(mbanner)
Comment on attachment 590459 [details] [diff] [review] fix for all warnings except in 2 constructors. Seems reasonable to me, but I'd like to see what Neil thinks as well.
Attachment #590459 - Flags: feedback?(mbanner) → feedback?(neil)
Comment on attachment 590459 [details] [diff] [review] fix for all warnings except in 2 constructors. Sorry, but my personal preference is not to do this.
Attachment #590459 - Flags: feedback?(neil)
Hmm... I'd accept semicolons, if they work...
(In reply to neil@parkwaycc.co.uk from comment #9) > Hmm... I'd accept semicolons, if they work... That would expand to "return ;;", which might cause a "not reached" warning or whatever. The "only" purpose of NS_ENSURE_SUCCESS() is to print a runtime warning. Then 2 clean solutions should be: *if the warning is not needed, just use "if NS_FAILED() return;" or the like. *if the warning is wanted, add a "#define NS_ENSURE_SUCCESS(res)" etc. *** As well fix mozilla-central too: http://mxr.mozilla.org/comm-central/search?string=NS_ENSURE_SUCCESS(rv%2C+)%3B&case=on
Severity: trivial → minor
Flags: in-testsuite-
Blocks: 609210
Blocks: buildwarning
See bug 609210 comment 11. Bsmedberg does not want the new single argument macros in Core. So either we define them in mailnews only (but would need to be in some header file included everywhere) or we just expand the few occurrences we have and open-code them as he is proposing. Neil, Mark, Serge?
Depends on: 788242
According to bug 788242 this causes build failures in some configs so they were forced to accept the single argument macros into Core. I'll jump on it when it lands!
Attached patch patch v2 (deleted) — Splinter Review
Neil, would you accept it now that they made the same in m-c?
Attachment #590459 - Attachment is obsolete: true
Attachment #662296 - Flags: review?(neil)
Attachment #662296 - Flags: review?(mbanner)
Comment on attachment 662296 [details] [diff] [review] patch v2 Seems reasonable to me.
Attachment #662296 - Flags: review?(neil) → review+
Comment on attachment 662296 [details] [diff] [review] patch v2 Review of attachment 662296 [details] [diff] [review]: ----------------------------------------------------------------- As Neil's reviewed this, I don't need to.
Attachment #662296 - Flags: review?(mbanner)
Keywords: checkin-needed
OS: Linux → All
Hardware: x86 → All
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 18.0
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: