Skip to content

[cling,tcling] Allow reporting cling diagnostics via the ROOT error handler#8737

Merged
jalopezg-git merged 2 commits intoroot-project:masterfrom
jalopezg-git:cling-custom-diagnosticconsumer
Sep 9, 2021
Merged

[cling,tcling] Allow reporting cling diagnostics via the ROOT error handler#8737
jalopezg-git merged 2 commits intoroot-project:masterfrom
jalopezg-git:cling-custom-diagnosticconsumer

Conversation

@jalopezg-git
Copy link
Copy Markdown
Contributor

@jalopezg-git jalopezg-git commented Jul 26, 2021

This PR enables cling diagnostics to be reported via the ROOT error handler, as required by the experiments. Independently, this error handler may be changed by the user (see TError.h), e.g.

root [0] int f() { return; }
ROOT_prompt_0:1:11: non-void function 'f' should return a value [-Wreturn-type]
int f() { return; }
          ^

root [1] gInterpreter->ReportDiagnosticsToErrorHandler();
root [2] int f() { return; }
Error in <cling>: ROOT_prompt_2:1:11: non-void function 'f' should return a value [-Wreturn-type]
int f() { return; }
          ^
root [3] // Note the previous error is reported through the default ROOT error handler.

Changes in this PR

  • Required changes to FilteringDiagConsumer (in IncrementalParser.cpp).
  • Two member functions have been added to the Interpreter class:
    • void replaceDiagnosticConsumer(clang::DiagnosticConsumer* Consumer, bool Own): replaces the default CIFactory-provided diagnostic consumer.
    • bool hasReplacedDiagnosticConsumer(): returns whether the default diagnostic consumer has been replaced.
  • Added void TCling::ReportDiagnosticsToErrorHandler(bool enable) member function.

This PR closes JIRA issue ROOT-7587.

Link to sibling PR in roottest repository: root-project/roottest#761.

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-26T21:03:31.578Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory

Failing tests:

@phsft-bot
Copy link
Copy Markdown

@jalopezg-git jalopezg-git force-pushed the cling-custom-diagnosticconsumer branch from 4739633 to 492d42e Compare July 28, 2021 13:28
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@jalopezg-git
Copy link
Copy Markdown
Contributor Author

@Axel-Naumann, @vgvassilev, given that I will be off in August, feel free to merge this PR and the sibling PR in roottest if the code doesn't need changes after the review.

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft11.dyndns.cern.ch:/home/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@jalopezg-git jalopezg-git force-pushed the cling-custom-diagnosticconsumer branch from 492d42e to faf1ace Compare July 29, 2021 09:54
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-29T09:56:35.012Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory
  • [2021-07-29T09:56:37.910Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory
  • [2021-07-29T09:56:38.489Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1084 (message):

@jalopezg-git
Copy link
Copy Markdown
Contributor Author

@phsft-bot build just on ROOT-debian10-i386/cxx14

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-29T15:17:14.616Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory
  • [2021-07-29T15:17:18.426Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory
  • [2021-07-29T15:17:18.684Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1084 (message):

Copy link
Copy Markdown
Member

@hahnjo hahnjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool that you made the restoring work naturally, good job 👍

@jalopezg-git jalopezg-git force-pushed the cling-custom-diagnosticconsumer branch from faf1ace to 13e08bc Compare July 30, 2021 09:37
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-07-30T09:40:23.739Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory
  • [2021-07-30T09:40:26.554Z] stderr: error: could not read '.git/rebase-apply/head-name': No such file or directory
  • [2021-07-30T09:40:27.076Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1084 (message):

Copy link
Copy Markdown
Member

@Axel-Naumann Axel-Naumann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! But I have a question! :-)

@jalopezg-git
Copy link
Copy Markdown
Contributor Author

@phsft-bot build

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

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

Errors:

  • [2021-09-08T11:01:57.698Z] CMake Error at cmake/modules/RootBuildOptions.cmake:407 (message):
  • [2021-09-08T11:01:57.698Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1117 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-09-08T11:08:25.953Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1084 (message):

@jalopezg-git jalopezg-git force-pushed the cling-custom-diagnosticconsumer branch from 13e08bc to 3fa0d5b Compare September 8, 2021 13:19
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

These changes enable the replacement of the default DiagnosticConsumer provided
by CIFactory.  Concretely, two member functions have been added to the
Interpreter class:

- replaceDiagnosticConsumer(): replaces the default CIFactory-provided DiagnosticConsumer.

- hasReplacedDiagnosticConsumer(): returns whether the default diagnostic
consumer has been replaced.
This function allows users to route clang diagnostics to the ROOT error handler.
Closes issue ROOT-7587.
@jalopezg-git jalopezg-git force-pushed the cling-custom-diagnosticconsumer branch from 3fa0d5b to 63caf67 Compare September 8, 2021 13:22
@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14, ROOT-performance-centos8-multicore/default, ROOT-ubuntu16/nortcxxmod, mac1014/python3, mac11.0/cxx17, windows10/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

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

Errors:

  • [2021-09-08T13:33:21.526Z] CMake Error at cmake/modules/RootBuildOptions.cmake:407 (message):
  • [2021-09-08T13:33:21.526Z] CMake Error at C:/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1117 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-09-08T15:54:27.775Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1084 (message):

@phsft-bot
Copy link
Copy Markdown

Build failed on mac11.0/cxx17.
Running on macphsft20.dyndns.cern.ch:/Users/sftnight/build/workspace/root-pullrequests-build
See console output.

Failing tests:

@jalopezg-git
Copy link
Copy Markdown
Contributor Author

@phsft-bot build just on ROOT-debian10-i386/cxx14

@phsft-bot
Copy link
Copy Markdown

Starting build on ROOT-debian10-i386/cxx14
How to customize builds

@phsft-bot
Copy link
Copy Markdown

Build failed on ROOT-debian10-i386/cxx14.
Running on pcepsft10.dyndns.cern.ch:/build/workspace/root-pullrequests-build
See console output.

Errors:

  • [2021-09-08T22:00:20.178Z] CMake Error at /home/sftnight/build/workspace/root-pullrequests-build/rootspi/jenkins/root-build.cmake:1084 (message):

@jalopezg-git jalopezg-git merged commit c0cbfe1 into root-project:master Sep 9, 2021
@jalopezg-git jalopezg-git deleted the cling-custom-diagnosticconsumer branch September 9, 2021 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants