Skip to content

Formatting of multiple ClassImp() definitions #3

@tdealtry

Description

@tdealtry

Running the current clang-format file on a file with

ClassImp(RooTrackerVtxBase)
ClassImp(JNuBeamFlux)

produces a line like

ClassImp(RooTrackerVtxBase) ClassImp(JNuBeamFlux)

which brings up a weird compilation error

I'm guessing (unconfirmed) that we can get around this using semi-colons

ClassImp(RooTrackerVtxBase);
ClassImp(JNuBeamFlux);

But that has its own issues...

/opt/hk-ToolApp/UserTools/ImportedTools/GHOST-WCSim/OriginalWCSim/src/TJNuBeamFlux.cc:108:28: warning: extra ‘;’ -Wpedantic]
 ClassImp(RooTrackerVtxBase);
                            ^
/opt/hk-ToolApp/UserTools/ImportedTools/GHOST-WCSim/OriginalWCSim/src/TJNuBeamFlux.cc:109:22: warning: extra ‘;’ -Wpedantic]
 ClassImp(JNuBeamFlux);

For reference, here is the definition from ROOTs Rtypes.h, which explains why the semicolon is not a good idea

#define ClassImpUnique(name,key) \
   namespace ROOT { \
      TGenericClassInfo *GenerateInitInstance(const name*); \
      namespace { \
         static int _R__UNIQUE_(_NAME2_(R__dummyint,key)) __attribute__((unused)) = \
            GenerateInitInstance((name*)0x0)->SetImplFile(__FILE__, __LINE__); \
         R__UseDummy(_R__UNIQUE_(_NAME2_(R__dummyint,key))); \
      } \
   }
#define ClassImp(name) ClassImpUnique(name,default)

Any ideas on how to stop clang-format mangling this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions