diff --git a/core/rootcling_stage1/src/rootcling_stage1.cxx b/core/rootcling_stage1/src/rootcling_stage1.cxx index 44f83c0d315563..ffb5a7ef3ae4d1 100644 --- a/core/rootcling_stage1/src/rootcling_stage1.cxx +++ b/core/rootcling_stage1/src/rootcling_stage1.cxx @@ -17,6 +17,8 @@ extern "C" { R__DLLEXPORT void usedToIdentifyRootClingByDlSym() {} } +// force compiler to emit symbol for function above +static void (*dlsymaddr)() = &usedToIdentifyRootClingByDlSym; ROOT::Internal::RootCling::TROOTSYSSetter gROOTSYSSetter; @@ -32,12 +34,7 @@ static const char *GetEtcDir() { int main(int argc, char **argv) { - // Force the emission of the symbol - the compiler cannot know that argv - // is always set. - if (!argv) { - auto dummyVal = (int)(long)&usedToIdentifyRootClingByDlSym; - return dummyVal; - } + (void) dlsymaddr; // avoid unused variable warning ROOT::Internal::RootCling::DriverConfig config{}; diff --git a/main/src/rootcling.cxx b/main/src/rootcling.cxx index d06fdb32dc8145..8165ce2e1293aa 100644 --- a/main/src/rootcling.cxx +++ b/main/src/rootcling.cxx @@ -19,14 +19,12 @@ extern "C" { R__DLLEXPORT void usedToIdentifyRootClingByDlSym() {} } +// force compiler to emit symbol for function above +static void (*dlsymaddr)() = &usedToIdentifyRootClingByDlSym; + int main(int argc, char **argv) { - // Force the emission of the symbol - the compiler cannot know that argv - // is always set. - if (!argv) { - auto dummyVal = (int)(long)&usedToIdentifyRootClingByDlSym; - return dummyVal; - } + (void) dlsymaddr; // avoid unused variable warning ROOT::Internal::RootCling::DriverConfig config{};