compile time output

I'm trying to add a to-do list to my compile-time output. (gcc from terminal, linux).
I found 2 good options, #warning and #pragma message ("text")
I tried renaming both to #TODO, but that failed

main.cpp:1:15: error: ‘pragma’ was not declared in this scope; did you mean ‘_Pragma’?
    1 | #define TODO #pragma message
main.cpp:146:2: error: invalid preprocessing directive #TODO
  146 | #TODO "test text"

etc.

Is there a way to edit my preprocessor commands or create new ones?

If all else fails, I could write a simple program to read the cpp file, search for "TODO" and directly replace that with #prama message, and finally add that to the makefile. Call it a kind of a pre-compiler macro expansion/filter thingy...?
Last edited on
I just put // TODO: whatever in the source code. When I want to find the todo list, I just grep for TODO.
That would work fine too.

My problem is that it's a hobby project, so there's always something more interesting that I want to work on and the boilerplate code is being put off. I thought the #warning macro would be too annoying, but on second thought I want the TODOs to stand out and annoy me every time I compile so that I can't ignore them so easily.
I have decided that #warning is simple enough to type out and doesn't clutter things badly, so that is how I will proceed.
I think for things that really can sit for a longer time I'll use your method too, thank you dhayden.

Edit: Have now implemented this on all my empty functions. Have already crossed out half of them. Feels so cathartic to cut through those warnings. I totally recommend for hobby projects.
Last edited on
Topic archived. No new replies allowed.