c++compiler-construction

How to add keyword to a C++ compiler


I need to simply add a compile-time check to a compiler in the form of a keyword. (similiar to const)

It would change nothing about how the compiler function, only give compile-time errors when keyword is misused or omitted.

How would I do this for MSVC / Clang / GCC


Solution

  • I propose to do the following steps to achieve what I think you want:

    That way you do not need to maintain your own compiler, get compiler errors (with useful context) in case of misuse and normally built results in case of correct use. Also the actual compiler does not get to see anything weird which could confuse it.