Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-37283

Compile with "qCDebug(cat ) <<" and undefined Q_COMPILER_VARIADIC_MACROS

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • Not Evaluated
    • None
    • 5.3.0 Alpha
    • Core: I/O
    • None
    • gcc 4.8.1

    Description

      Commit b8a38a6737acd670d92197ca5b009590d9fd8a9c breaks compilation of the following code if Q_COMPILER_VARIADIC_MACROS is not defined:

      Q_DECLARE_LOGGING_CATEGORY(testlog)
      Q_LOGGING_CATEGORY(testlog, "HelloWorld")
      
      int main()
      {
          qCDebug(testlog) << "Hello";
      
          return 0;
      }
      

      The two macros are resolved to:

      	extern const QLoggingCategory &testlog();
      	const QLoggingCategory &testlog()
      	{ static const QLoggingCategory 	category("HelloWorld"); return category; }
      

      and the

      	qCDebug(testlog) << "Hello";
      

      call is resolved to

             QMessageLogger("main.cpp", 12, __PRETTY_FUNCTION__).debug(testlog)
      

      because of the new

      	#define qCDebug qDebug
      

      in qloggingcategory.h

      This code however doesn't compile, because you'd have to pass 'testlog()' and
      not 'testlog' as parameter to 'debug()'.

      Attachments

        For Gerrit Dashboard: QTBUG-37283
        # Subject Branch Project Status CR V

        Activity

          People

            kkohne Kai Köhne
            kkohne Kai Köhne
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes