Results 1 to 5 of 5

Thread: disabeling unused parameter warnings

  1. #1
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default disabeling unused parameter warnings

    Hello!

    Can anyone tell me please how I can disable "unused parameter" compiler warnings?

    Thank
    Cruz

  2. #2
    Join Date
    Aug 2008
    Posts
    132
    Thanks
    23
    Thanked 3 Times in 3 Posts

    Default Re: disabeling unused parameter warnings

    Check out the Q_UNUSED macro.

  3. #3
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: disabeling unused parameter warnings

    Thanks, but it's not what I'm looking for. With the Q_UNUSED macro I have to manually specify every single unused parameter and that would be very tiresome. Isn't there a simple way, say in the .pro file, to disable all unused parameter warnings?

  4. #4
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: disabeling unused parameter warnings

    Sure, you need to modify the gcc parameters: http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

    Typically however, you want those warnings, so you use the Q_UNUSED macro to state which are actually unused.

  5. The following user says thank you to squidge for this useful post:

    Cruz (20th August 2010)

  6. #5
    Join Date
    Jan 2009
    Location
    Germany
    Posts
    387
    Thanks
    101
    Thanked 15 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: disabeling unused parameter warnings

    To save some research time for the next guy who would ask the same question, put this in your .pro file:

    QMAKE_CXXFLAGS_WARN_OFF -= -Wunused-parameter

  7. The following user says thank you to Cruz for this useful post:

    Anton (13th December 2013)

Similar Threads

  1. Remove unused points from a QPainterPath
    By JaV0 in forum Qt Programming
    Replies: 0
    Last Post: 4th March 2010, 08:35
  2. Where are my compiler warnings?
    By drhex in forum General Programming
    Replies: 5
    Last Post: 18th February 2009, 21:28
  3. It seems that Qt does not release unused memory
    By iw2nhl in forum Qt Programming
    Replies: 31
    Last Post: 25th November 2007, 20:02
  4. Problem with unused parameter
    By devilj in forum Qt Programming
    Replies: 5
    Last Post: 4th July 2007, 18:48
  5. Unused parameters in slots
    By ePharaoh in forum Qt Programming
    Replies: 3
    Last Post: 22nd March 2006, 08:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.