Skip to content

Cling does not report failed compilation (on MacOS) #22235

@vepadulano

Description

@vepadulano

Check duplicate issues.

  • Checked for duplicates

Description

Cling does not provide a way to programmatically check for a compilation failure, see the reproducer. I tried ProcessLine, Calc and Evaluate but no API works. Run the reproducer below with any of the three functions I see the assertion being triggered.

Expected behaviour

There should be a way to query the interpreter to know whether the last compilation was successful or failed.

Reproducer

#include <TInterpreter.h>
#include <cassert>

void processline(){
    TInterpreter::EErrorCode error = TInterpreter::kNoError;
    gInterpreter->ProcessLine("rndm_stuff", &error);
    assert(error != TInterpreter::kNoError);
}

void calc(){
    TInterpreter::EErrorCode error = TInterpreter::kNoError;
    gInterpreter->Calc("rndm_stuff", &error);
    assert(error != TInterpreter::kNoError);
}

void evaluate(){
    std::unique_ptr<TInterpreterValue> v = gInterpreter->MakeInterpreterValue();
    auto ret = gInterpreter->Evaluate("rndm_stuff", *v);
    assert(ret == 0);
}

int main(){
    processline();
    calc();
    evaluate();
}

ROOT version

master

Installation method

Build from source

Operating system

MacOS

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions