1

I'm working with a system that uses special macros a lot. For instance: class UDSSLib : public UFunctionLibrary { GENERATED_BODY() void foo(); int i; }

The problem is the GENERATED_BODY() line. It's not supposed to have a semicolon after it (I guess the macro expansion has that) and I'd like to stick to that style, but as is, everything after it gets indented too far -- as statement-cont syntax rather than statement. Can I either convince the C syntax analyzer that the specific string GENERATED_BODY() is a complete statement, or else cause the line after it to be indented normally?

2

1 Answer 1

2

I had the same problem with GENERATED_BODY() from UnrealEngine and so found your question.

What works for me is to add to the buffer-local variable c-macro-names-with-semicolon and then call the function c-make-macro-with-semi-re.

For example:

(defun add-c++-macro-names-with-semicolon ()
  (add-to-list 'c-macro-names-with-semicolon "GENERATED_BODY")
  (c-make-macro-with-semi-re))
(add-hook 'c++-mode-hook 'add-c++-macro-names-with-semicolon)

Additional search terms:
CompilerResultsLog: Error:
Extra ';' before semicolon

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.