File: UTILS_Portability.h

package info (click to toggle)
cubew 4.7-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 9,396 kB
  • sloc: ansic: 17,952; sh: 4,818; cpp: 814; makefile: 244; awk: 50; xml: 6
file content (58 lines) | stat: -rw-r--r-- 1,741 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/*
 * This file is part of the Score-P software (http://www.score-p.org)
 *
 * Copyright (c) 2016,
 * Forschungszentrum Juelich GmbH, Germany
 *
 * Copyright (c) 2017,
 * Technische Universitaet Dresden, Germany
 *
 * This software may be modified and distributed under the terms of
 * a BSD-style license.  See the COPYING file in the package base
 * directory for details.
 *
 */

#ifndef UTILS_PORTABILITY_H
#define UTILS_PORTABILITY_H

/**
 * @file
 * @ingroup  UTILS_Exception_module
 * @brief    Platform portability abstractions for the common utils
 *
 * This header file provides preprocessor macros to abstract from platform- or
 * compiler-dependent code.
 */

/**
 * @def   UTILS_FUNCTION_NAME
 * @brief Portable macro to retrieve the current function name
 *
 * While C99 specifies the predefined identifier <tt>__func__</tt> to retrieve
 * the current function name, it is not part of the C++98 standard.  However,
 * many compilers support it also in C++98 mode or provide compiler-specific
 * alternatives.  This preprocessor macro addresses this issue by providing a
 * mapping to the corresponding predefined identifier.
 */
#if defined( __cplusplus ) && defined( __FUJITSU )
    #define UTILS_FUNCTION_NAME __FUNCTION__
#else
    #define UTILS_FUNCTION_NAME __func__
#endif

/**
 * @def   UTILS_DECLSPEC_NORETURN
 * @def   UTILS_ATTRIBUTE_NORETURN
 * @brief Portable macros to mark a function that it will not return to the caller.
 *
 */
#if defined( _WIN32 )
    #define UTILS_DECLSPEC_NORETURN __declspec( noreturn )
    #define UTILS_ATTRIBUTE_NORETURN /*  */
#else
    #define UTILS_DECLSPEC_NORETURN  /*  */
    #define UTILS_ATTRIBUTE_NORETURN __attribute__( ( noreturn ) )
#endif

#endif /* UTILS_PORTABILITY_H */