Bug 367971 - New Q_ENUM check also warns about Q_ENUMS for enums outside a class
Summary: New Q_ENUM check also warns about Q_ENUMS for enums outside a class
Status: RESOLVED NOT A BUG
Alias: None
Product: clazy
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Other
: NOR normal
Target Milestone: ---
Assignee: Sergio Martins
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-08-29 18:45 UTC by Christian Ehrlicher
Modified: 2016-09-03 11:31 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Ehrlicher 2016-08-29 18:45:00 UTC
-----------------------------------
#include <QObject>

//class Foo 
namespace Foo 
{
//  Q_OBJECT
  enum Bar {
  };

  Q_ENUM ( Bar )
}
//;
-----------------------------------
Within this code, clazy warns about Q_ENUM usage but Q_ENUMS does not work here since there's no parent class which is derived from QObject and so no QMetaObject ...

Did not find a simple solution for this problem so I had to write a bug report :)

Reproducible: Always

Steps to Reproduce:
see details
Comment 1 Christian Ehrlicher 2016-08-29 19:32:04 UTC
Ok, the question is - why someone would add Q_ENUM for a enum defined in a namespace. I currently can't see a reason for it but moc does not complain either ... :)
Comment 2 Sergio Martins 2016-09-03 11:31:32 UTC
Yeah, there's no reason. clazy could give a different warning for this case but the fix isn't trivial since the macro processor isn't connected to the AST, so I'll just close this