Ruby: include/ruby/internal/warning_push.h File Reference

Ruby 3.2.5p208 (2024-07-26 revision 31d0f1a2e7dbfb60731d1f05b868e1d578cda493)

Macros
warning_push.h File Reference

Defines RBIMPL_WARNING_PUSH. More...

`#include "ruby/internal/compiler_is.h"`
`#include "ruby/internal/compiler_since.h"`

Go to the source code of this file.

## Macros
#define | RBIMPL_WARNING_PUSH()
| Pushes compiler warning state.
#define | RBIMPL_WARNING_POP()
| Pops compiler warning state.
#define | RBIMPL_WARNING_ERROR(flag)
| Turns a warning into a fatal error.
#define | RBIMPL_WARNING_IGNORED(flag)
| Suppresses a warning.

## Detailed Description

Defines RBIMPL_WARNING_PUSH.

Author
  Ruby developers ruby-.nosp@m.core.nosp@m.@ruby.nosp@m.-lan.nosp@m.g.org

Copyright
  This file is a part of the programming language Ruby. Permission is hereby granted, to either redistribute and/or modify this file, provided that the conditions mentioned in the file COPYING are met. Consult the file for details.

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`.
RBIMPL_WARNING_PUSH
int foo(void);
RBIMPL_WARNING_POP
// OK -- the macros are ignored by Doxygen.
RBIMPL_WARNING_PUSH()
int foo(void);
RBIMPL_WARNING_POP()
RBIMPL_WARNING_PUSH
#define RBIMPL_WARNING_PUSH()
Pushes compiler warning state.
Definition warning_push.h:55
RBIMPL_WARNING_POP
#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 | ) |

Value:
__pragma(warning(error: flag))

Turns a warning into a fatal error.

Parameters

  flag | A flag that represents the kind of warnings.

Definition at line 71 of file warning_push.h.

## ◆ RBIMPL_WARNING_IGNORED

#define RBIMPL_WARNING_IGNORED | ( |  | flag | ) |

Value:
__pragma(warning(disable: flag))

Suppresses a warning.

Parameters

  flag | A flag that represents the kind of warnings.

Definition at line 80 of file warning_push.h.

## ◆ RBIMPL_WARNING_POP

#define RBIMPL_WARNING_POP | ( |  | ) |

Value:
__pragma(warning(pop))

Pops compiler warning state.

Definition at line 62 of file warning_push.h.

## ◆ RBIMPL_WARNING_PUSH

#define RBIMPL_WARNING_PUSH | ( |  | ) |

Value:
__pragma(warning(push))

Pushes compiler warning state.

Definition at line 55 of file warning_push.h.