mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
capture: add versioning macros
This commit is contained in:
@ -5,6 +5,7 @@ libsysprof_capture_headers = [
|
||||
'sp-capture-types.h',
|
||||
'sp-capture-writer.h',
|
||||
'sysprof-capture.h',
|
||||
'sysprof-version-macros.h',
|
||||
]
|
||||
|
||||
libsysprof_capture_sources = [
|
||||
|
||||
@ -34,6 +34,7 @@ G_BEGIN_DECLS
|
||||
# include "sp-clock.h"
|
||||
# include "sp-error.h"
|
||||
# include "sysprof-version.h"
|
||||
# include "sysprof-version-macros.h"
|
||||
|
||||
#undef SYSPROF_CAPTURE_INSIDE
|
||||
|
||||
|
||||
130
src/libsysprof-capture/sysprof-version-macros.h
Normal file
130
src/libsysprof-capture/sysprof-version-macros.h
Normal file
@ -0,0 +1,130 @@
|
||||
/* sp-version-macros.h
|
||||
*
|
||||
* Copyright 2018-2019 Christian Hergert <chergert@redhat.com>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#if !defined (SYSPROF_CAPTURE_INSIDE) && !defined (SYSPROF_CAPTURE_COMPILATION)
|
||||
# error "Only <sysprof-capture.h> can be included directly."
|
||||
#endif
|
||||
|
||||
#include <glib.h>
|
||||
|
||||
#include "sysprof-version.h"
|
||||
|
||||
#ifndef _SYSPROF_EXTERN
|
||||
#define _SYSPROF_EXTERN extern
|
||||
#endif
|
||||
|
||||
#ifdef SYSPROF_DISABLE_DEPRECATION_WARNINGS
|
||||
#define SYSPROF_DEPRECATED _SYSPROF_EXTERN
|
||||
#define SYSPROF_DEPRECATED_FOR(f) _SYSPROF_EXTERN
|
||||
#define SYSPROF_UNAVAILABLE(maj,min) _SYSPROF_EXTERN
|
||||
#else
|
||||
#define SYSPROF_DEPRECATED G_DEPRECATED _SYSPROF_EXTERN
|
||||
#define SYSPROF_DEPRECATED_FOR(f) G_DEPRECATED_FOR(f) _SYSPROF_EXTERN
|
||||
#define SYSPROF_UNAVAILABLE(maj,min) G_UNAVAILABLE(maj,min) _SYSPROF_EXTERN
|
||||
#endif
|
||||
|
||||
#define SYSPROF_VERSION_3_34 (G_ENCODE_VERSION (3, 34))
|
||||
|
||||
#if (SYSPROF_MINOR_VERSION == 99)
|
||||
# define SYSPROF_VERSION_CUR_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0))
|
||||
#elif (SYSPROF_MINOR_VERSION % 2)
|
||||
# define SYSPROF_VERSION_CUR_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION + 1))
|
||||
#else
|
||||
# define SYSPROF_VERSION_CUR_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION))
|
||||
#endif
|
||||
|
||||
#if (SYSPROF_MINOR_VERSION == 99)
|
||||
# define SYSPROF_VERSION_PREV_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION + 1, 0))
|
||||
#elif (SYSPROF_MINOR_VERSION % 2)
|
||||
# define SYSPROF_VERSION_PREV_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION - 1))
|
||||
#else
|
||||
# define SYSPROF_VERSION_PREV_STABLE (G_ENCODE_VERSION (SYSPROF_MAJOR_VERSION, SYSPROF_MINOR_VERSION - 2))
|
||||
#endif
|
||||
|
||||
/**
|
||||
* SYSPROF_VERSION_MIN_REQUIRED:
|
||||
*
|
||||
* A macro that should be defined by the user prior to including
|
||||
* the ide.h header.
|
||||
*
|
||||
* The definition should be one of the predefined IDE version
|
||||
* macros: %SYSPROF_VERSION_3_34, ...
|
||||
*
|
||||
* This macro defines the lower bound for the Builder API to use.
|
||||
*
|
||||
* If a function has been deprecated in a newer version of Builder,
|
||||
* it is possible to use this symbol to avoid the compiler warnings
|
||||
* without disabling warning for every deprecated function.
|
||||
*
|
||||
* Since: 3.34
|
||||
*/
|
||||
#ifndef SYSPROF_VERSION_MIN_REQUIRED
|
||||
# define SYSPROF_VERSION_MIN_REQUIRED (SYSPROF_VERSION_CUR_STABLE)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* SYSPROF_VERSION_MAX_ALLOWED:
|
||||
*
|
||||
* A macro that should be defined by the user prior to including
|
||||
* the ide.h header.
|
||||
|
||||
* The definition should be one of the predefined Builder version
|
||||
* macros: %SYSPROF_VERSION_1_0, %SYSPROF_VERSION_1_2,...
|
||||
*
|
||||
* This macro defines the upper bound for the IDE API to use.
|
||||
*
|
||||
* If a function has been introduced in a newer version of Builder,
|
||||
* it is possible to use this symbol to get compiler warnings when
|
||||
* trying to use that function.
|
||||
*
|
||||
* Since: 3.34
|
||||
*/
|
||||
#ifndef SYSPROF_VERSION_MAX_ALLOWED
|
||||
# if SYSPROF_VERSION_MIN_REQUIRED > SYSPROF_VERSION_PREV_STABLE
|
||||
# define SYSPROF_VERSION_MAX_ALLOWED (SYSPROF_VERSION_MIN_REQUIRED)
|
||||
# else
|
||||
# define SYSPROF_VERSION_MAX_ALLOWED (SYSPROF_VERSION_CUR_STABLE)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_MIN_REQUIRED
|
||||
#error "SYSPROF_VERSION_MAX_ALLOWED must be >= SYSPROF_VERSION_MIN_REQUIRED"
|
||||
#endif
|
||||
#if SYSPROF_VERSION_MIN_REQUIRED < SYSPROF_VERSION_3_34
|
||||
#error "SYSPROF_VERSION_MIN_REQUIRED must be >= SYSPROF_VERSION_3_34"
|
||||
#endif
|
||||
|
||||
#define SYSPROF_AVAILABLE_IN_ALL _SYSPROF_EXTERN
|
||||
|
||||
#if SYSPROF_VERSION_MIN_REQUIRED >= SYSPROF_VERSION_3_34
|
||||
# define SYSPROF_DEPRECATED_IN_3_34 SYSPROF_DEPRECATED
|
||||
# define SYSPROF_DEPRECATED_IN_3_34_FOR(f) SYSPROF_DEPRECATED_FOR(f)
|
||||
#else
|
||||
# define SYSPROF_DEPRECATED_IN_3_34 _SYSPROF_EXTERN
|
||||
# define SYSPROF_DEPRECATED_IN_3_34_FOR(f) _SYSPROF_EXTERN
|
||||
#endif
|
||||
|
||||
#if SYSPROF_VERSION_MAX_ALLOWED < SYSPROF_VERSION_3_34
|
||||
# define SYSPROF_AVAILABLE_IN_3_34 SYSPROF_UNAVAILABLE(3, 34)
|
||||
#else
|
||||
# define SYSPROF_AVAILABLE_IN_3_34 _SYSPROF_EXTERN
|
||||
#endif
|
||||
Reference in New Issue
Block a user