/root/doris/be/src/gutil/macros.h
| Line | Count | Source (jump to first uncovered line) | 
| 1 |  | // Copyright 2008 Google Inc. All Rights Reserved. | 
| 2 |  | // | 
| 3 |  | // Various Google-specific macros. | 
| 4 |  | // | 
| 5 |  | // This code is compiled directly on many platforms, including client | 
| 6 |  | // platforms like Windows, Mac, and embedded systems.  Before making | 
| 7 |  | // any changes here, make sure that you're not breaking any platforms. | 
| 8 |  | // | 
| 9 |  |  | 
| 10 |  | #pragma once | 
| 11 |  |  | 
| 12 |  | #include <stddef.h> // For size_t | 
| 13 |  |  | 
| 14 |  | #include "butil/macros.h" | 
| 15 |  | #include "gutil/port.h" | 
| 16 |  |  | 
| 17 |  | // Macro that allows definition of a variable appended with the current line | 
| 18 |  | // number in the source file. Typically for use by other macros to allow the | 
| 19 |  | // user to declare multiple variables with the same "base" name inside the same | 
| 20 |  | // lexical block. | 
| 21 |  | #define VARNAME_LINENUM(varname) VARNAME_LINENUM_INTERNAL(varname##_L, __LINE__) | 
| 22 |  | #define VARNAME_LINENUM_INTERNAL(v, line) VARNAME_LINENUM_INTERNAL2(v, line) | 
| 23 |  | #define VARNAME_LINENUM_INTERNAL2(v, line) v##line | 
| 24 |  |  | 
| 25 |  | // Retry on EINTR for functions like read() that return -1 on error. | 
| 26 |  | #define RETRY_ON_EINTR(err, expr)                                                              \ | 
| 27 | 240k |     do {                                                                                       \ | 
| 28 | 240k |         static_assert(std::is_signed<decltype(err)>::value, #err " must be a signed integer"); \ | 
| 29 | 240k |         (err) = (expr);                                                                        \ | 
| 30 | 240k |     } while ((err) == -1 && errno == EINTR) |