root icon indicating copy to clipboard operation
root copied to clipboard

[cling] Add deprecation warning for declarations without `auto`

Open devajithvs opened this issue 1 year ago • 31 comments

Declarations without the auto keyword are not part of standard C++. Even though it is a nice feature to have, it requires a patch on top of clang and is one of the hurdles preventing us from using the upstream clang.

Implicit auto injection is currently only supported at the prompt (and only in the top-most function-level scope). So it should ideally not break other features.

There are a few GitHub and JIRA issues related to this feature that can also be closed if we completely remove it.

For the warning messages, I'm reusing one of the existing clang warning message (to not introduce more patches on top of the clang with custom error messages).

EDIT: Glancing through JIRA issues, these are the issues that can be closed (list might not be exhaustive):

https://its.cern.ch/jira/browse/ROOT-10309 https://its.cern.ch/jira/browse/ROOT-10593 https://its.cern.ch/jira/browse/ROOT-10284 https://its.cern.ch/jira/browse/ROOT-8828 https://its.cern.ch/jira/browse/ROOT-8538 https://its.cern.ch/jira/browse/ROOT-7970

This Pull request:

Requires https://github.com/root-project/roottest/pull/1056 to be merged for tests to pass

Changes or fixes:

Checklist:

  • [ ] tested changes locally
  • [ ] updated the docs (if necessary)

This PR fixes #

devajithvs avatar Feb 09 '24 12:02 devajithvs

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default How to customize builds

phsft-bot avatar Feb 09 '24 12:02 phsft-bot

New warning message (for reference): Screenshot from 2024-02-09 11-19-18

devajithvs avatar Feb 09 '24 12:02 devajithvs

Test Results

    12 files      12 suites   2d 2h 47m 24s :stopwatch:  2 586 tests  2 586 :white_check_mark: 0 :zzz: 0 :x: 29 057 runs  29 057 :white_check_mark: 0 :zzz: 0 :x:

Results for commit c36e2fd6.

:recycle: This comment has been updated with latest results.

github-actions[bot] avatar Feb 09 '24 12:02 github-actions[bot]

There are a few GitHub and JIRA issues related to this feature that can also be closed if we completely remove it.

Please list those here. Thanks.

pcanal avatar Feb 09 '24 16:02 pcanal

For the warning messages, I'm reusing one of the existing clang warning message (to not introduce more patches on top of the clang with custom error messages).

Can you be more explicit of what it looks like? (I.e. clarifying whether this result is an ambiguous message or not).

pcanal avatar Feb 09 '24 16:02 pcanal

New warning message (for reference): Screenshot from 2024-02-09 11-19-18

@pcanal: This is how the warning message looks like. The warning (-Wdeprecated-declarations) I think make sense for deprecating this feature.

devajithvs avatar Feb 09 '24 16:02 devajithvs

Added JIRA issues in the PR description. Couldn't find any open GitHub issues.

devajithvs avatar Feb 10 '24 04:02 devajithvs

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default How to customize builds

phsft-bot avatar Feb 12 '24 09:02 phsft-bot

In principle LGTM; is it possible to test this in our infrastructure, to make sure the warning pops up where we expect it and that the "feature" continues to work for the time being? After removing the instances from roottest, we would otherwise lack coverage...

Is this test sufficient?

https://github.com/devajithvs/root/blob/master/core/metacling/test/TClingTests.cxx#L91

Or should the test go in roottest repository.?

devajithvs avatar Feb 19 '24 10:02 devajithvs

Maybe add the most common pattern that gets removed from roottest: /* no auto */ t = new TTree("tree","tree"); Ideally it would be nice if we check that the warning is correctly triggered...

hahnjo avatar Feb 20 '24 07:02 hahnjo

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default How to customize builds

phsft-bot avatar Feb 20 '24 12:02 phsft-bot

Build failed on windows10/default. Running on null:C:\build\workspace\root-pullrequests-build See console output.

Errors:

  • [2024-02-20T12:20:57.605Z] LINK : fatal error LNK1104: cannot open file 'C:\build\workspace\root-pullrequests-build\build\bin\libCore.dll' [C:\build\workspace\root-pullrequests-build\build\core\Core.vcxproj]

phsft-bot avatar Feb 20 '24 12:02 phsft-bot

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default How to customize builds

phsft-bot avatar Feb 20 '24 12:02 phsft-bot

Build failed on windows10/default. Running on null:C:\build\workspace\root-pullrequests-build See console output.

Errors:

  • [2024-02-20T12:28:27.695Z] LINK : fatal error LNK1104: cannot open file 'C:\build\workspace\root-pullrequests-build\build\bin\libCore.dll' [C:\build\workspace\root-pullrequests-build\build\core\Core.vcxproj]

phsft-bot avatar Feb 20 '24 12:02 phsft-bot

Build failed on ROOT-performance-centos8-multicore/soversion. Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Feb 20 '24 16:02 phsft-bot

Build failed on mac12arm/cxx20. Running on 194.12.161.128:/Users/sftnight/build/workspace/root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Feb 20 '24 17:02 phsft-bot

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default How to customize builds

phsft-bot avatar Feb 20 '24 19:02 phsft-bot

Build failed on ROOT-ubuntu2004/python3. Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Feb 20 '24 20:02 phsft-bot

Build failed on windows10/default. Running on null:C:\build\workspace\root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Feb 20 '24 21:02 phsft-bot

Build failed on ROOT-performance-centos8-multicore/soversion. Running on olbdw-01.cern.ch:/data/sftnight/workspace/root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Feb 20 '24 22:02 phsft-bot

Windows is not happy with the new test. I'm not sure how windows handles errors/warnings.

Here's how the warning message looks now: image

devajithvs avatar Feb 21 '24 07:02 devajithvs

Starting build on ROOT-performance-centos8-multicore/soversion, ROOT-ubuntu2204/nortcxxmod, ROOT-ubuntu2004/python3, mac12arm/cxx20, windows10/default How to customize builds

phsft-bot avatar Feb 21 '24 15:02 phsft-bot

Build failed on ROOT-ubuntu2004/python3. Running on root-ubuntu-2004-1.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build See console output.

Failing tests:

phsft-bot avatar Feb 21 '24 15:02 phsft-bot