Menu

cppcheck 2.10: false positive interaction between [shadowFunction] and Q_EMIT

2023-02-09
2023-02-17
  • Sylvain Joubert

    Sylvain Joubert - 2023-02-09

    In Qt code, any (if not all) lines using the Q_EMIT macro:

    Q_EMIT mySignal(42);
    

    now trigger a shadowFunction warning like:

    warning: Local variable 'mySignal' shadows outer function [shadowFunction]
      Q_EMIT mySignal(42);
    

    I see a specific line to define the emit macro in qt.cfg (which I'm using) but nothing about Q_EMIT. I've been able to fix the issue locally by using a custom config file with the following content:

    <?xml version="1.0" encoding="UTF-8"?>
    <def format="2">
      <define name="Q_EMIT" value=""/>
    </def>
    

    This should probably be added to the qt.cfg

     
    • Oliver Stöneberg

      How do you load the library? Which command-line do you use?

      Could you also provide a full code sample which triggers the warning?

      Thanks.

       
  • CHR

    CHR - 2023-02-10
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.