0

I am looking for the equivalent C macro that emits warnings.

i.e. in C along the lines of:

#pragma message ( "Some message here" )
// OR
#error "Some message here"
// OR
#warning "Some message here"

My use case is that I want to make sure I don't forget to patch something in the future and I want to alert team members of this open issue:

example:

#[warning ("Do not forget to fix this when you have the missing data")] // I want this to be printed during compilation
let pbj = MyObject { is_something: false } ; // TODO: fix this with the correct value when we get the data

I have looked over the rust doc

todo() doesn't seem to fit the case (I don't want the code to panic)

https://doc.rust-lang.org/std/macro.todo.html

and the diagnostic attributes don't seem to help (or I am not using correctly?)

https://doc.rust-lang.org/reference/attributes/diagnostics.html

Any help appreciated

Avba
  • 14,822
  • 20
  • 92
  • 192

0 Answers0