Skip to content
Snippets Groups Projects

Supress warnings about nodiscard in dictionary generation with ROOT 6.22

Merged Christoph Hasse requested to merge suppress_cling_nodiscard_warning into master
All threads resolved!

Introduce small change to gaudi_add_dictionary

  • if ROOT 6.22 then add -Wno-unknown-attributes to suppress warning about nodiscard attribute in c++ library headers

for example of warning see e.g. here

cc @rmatev @clemenci

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
    • Resolved by Christoph Hasse

      I recently ran into a similar problem (see the discussion lhcb/LHCb!2932 (merged)) where I added [[nodiscard]] which clang does recognise, but the dictionary generating code then caused clang to emit the following diagnositic:

      input_line_182:10:7: warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]
            ((const LHCb::RawEvent*)obj)->banks(*(LHCb::RawBank::BankType*)args[0]);
      

      i.e. the dictionary code seems to generate function calls which have 'no effect' -- and I removed the [[nodiscard]] again. It would be much nicer if the generated code actively would avoid such warnings (as presumably it has good reasons to call this code, eg. make sure that the relevant symbol is linked into the library) and be changed to cast the result to void, i.e.:

             (void)((const LHCb::RawEvent*)obj)->banks(*(LHCb::RawBank::BankType*)args[0]);
      

      as shown eg here Unfortunately, I never found out where the code is that generates this code....

      Edited by Gerhard Raven
  • Christoph Hasse added 19 commits

    added 19 commits

    • b94384b7...f79f7a2c - 18 commits from branch master
    • d53edcc3 - gaudi_add_dictionary: if ROOT 6.22 then add -Wno-unknown-attributes to...

    Compare with previous version

  • Edited by Software for LHCb
  • Marco Clemencic resolved all threads

    resolved all threads

  • Marco Clemencic changed milestone to %v35r2

    changed milestone to %v35r2

  • Marco Clemencic mentioned in merge request !1183 (merged)

    mentioned in merge request !1183 (merged)

  • Marco Clemencic approved this merge request

    approved this merge request

  • Marco Clemencic mentioned in commit 30ea297c

    mentioned in commit 30ea297c

  • Please register or sign in to reply
    Loading