Ruby  3.4.0dev (2024-11-22 revision 0989400a925cd201defdca9eb28eb87200b30785)
Macros
warning_push.h File Reference

(0989400a925cd201defdca9eb28eb87200b30785)

Defines RBIMPL_WARNING_PUSH. More...

#include "ruby/internal/compiler_is.h"
#include "ruby/internal/compiler_since.h"
Include dependency graph for warning_push.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RBIMPL_WARNING_PUSH()   __pragma(warning(push))
 Pushes compiler warning state. More...
 
#define RBIMPL_WARNING_POP()   __pragma(warning(pop))
 Pops compiler warning state. More...
 
#define RBIMPL_WARNING_ERROR(flag)   __pragma(warning(error: flag))
 Turns a warning into a fatal error. More...
 
#define RBIMPL_WARNING_IGNORED(flag)   __pragma(warning(disable: flag))
 Suppresses a warning. More...
 

Detailed Description

Defines RBIMPL_WARNING_PUSH.

Author
Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org
Warning
Symbols prefixed with either RBIMPL or rbimpl are implementation details. Don't take them as canon. They could rapidly appear then vanish. The name (path) of this header file is also an implementation detail. Do not expect it to persist at the place it is now. Developers are free to move it anywhere anytime at will.
Note
To ruby-core: remember that this header can be possibly recursively included from extension libraries written in C++. Do not expect for instance __VA_ARGS__ is always available. We assume C99 for ruby itself but we don't assume languages of extension libraries. They could be written in C++98.

Q&A

Q: Why all the macros defined in this file are function-like macros?

A: Sigh. This is because of Doxygen. Its SKIP_FUNCTION_MACROS = YES configuration setting requests us that if we want it to ignore these macros, then we have to do two things: (1) let them be defined as function-like macros, and (2) place them separately in their own line, like below:

// NG -- foo's type considered something like `unsigned int`.
int foo(void);
// OK -- the macros are ignored by Doxygen.
int foo(void);
#define RBIMPL_WARNING_PUSH()
Pushes compiler warning state.
Definition: warning_push.h:55
#define RBIMPL_WARNING_POP()
Pops compiler warning state.
Definition: warning_push.h:62

Definition in file warning_push.h.

Macro Definition Documentation

◆ RBIMPL_WARNING_ERROR

#define RBIMPL_WARNING_ERROR (   flag)    __pragma(warning(error: flag))

Turns a warning into a fatal error.

Parameters
flagA flag that represents the kind of warnings.

Definition at line 71 of file warning_push.h.

◆ RBIMPL_WARNING_IGNORED

#define RBIMPL_WARNING_IGNORED (   flag)    __pragma(warning(disable: flag))

Suppresses a warning.

Parameters
flagA flag that represents the kind of warnings.

Definition at line 80 of file warning_push.h.

◆ RBIMPL_WARNING_POP

#define RBIMPL_WARNING_POP ( )    __pragma(warning(pop))

Pops compiler warning state.

Definition at line 62 of file warning_push.h.

◆ RBIMPL_WARNING_PUSH

#define RBIMPL_WARNING_PUSH ( )    __pragma(warning(push))

Pushes compiler warning state.

Definition at line 55 of file warning_push.h.