Ansel 0.0
A darktable fork - bloat + design vision
Loading...
Searching...
No Matches
poison.h
Go to the documentation of this file.
1/*
2 This file is part of darktable,
3 Copyright (C) 2014, 2016 Roman Lebedev.
4 Copyright (C) 2014, 2016-2017 Tobias Ellinghaus.
5 Copyright (C) 2016-2017 Peter Budai.
6 Copyright (C) 2018 luzpaz.
7 Copyright (C) 2020 Pascal Obry.
8 Copyright (C) 2022 Aurélien PIERRE.
9 Copyright (C) 2022 Martin Bařinka.
10
11 darktable is free software: you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
15
16 darktable is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with darktable. If not, see <http://www.gnu.org/licenses/>.
23*/
24#pragma once
25
26#if !defined(_RELEASE) && !defined(__cplusplus) && !defined(_WIN32)
27
28//
29// We needed to poison certain functions in order to disallow their usage
30// but not in bundled libs
31//
32
33// this is ugly, but needed, because else compilation will fail with:
34// ansel/src/common/poison.h:16:20: error: poisoning existing macro "strncat" [-Werror]
35// #pragma GCC poison strncat // use g_strncat
36#pragma GCC system_header
37
38//#pragma GCC poison sprintf // use snprintf
39#pragma GCC poison vsprintf // use vsnprintf
40#pragma GCC poison strcpy // use g_strlcpy
41//#pragma GCC poison strncpy // use g_strlcpy
42#pragma GCC poison strcat // use g_strncat
43#pragma GCC poison strncat // use g_strncat
44#pragma GCC poison pthread_create // use dt_pthread_create, musl issues
45#pragma GCC poison fopen // use g_fopen
46// #pragma GCC poison open // use g_open -- this one doesn't work
47#pragma GCC poison unlink // use g_unlink
48
49#endif
50
51// clang-format off
52// modelines: These editor modelines have been set for all relevant files by tools/update_modelines.py
53// vim: shiftwidth=2 expandtab tabstop=2 cindent
54// kate: tab-indents: off; indent-width 2; replace-tabs on; indent-mode cstyle; remove-trailing-spaces modified;
55// clang-format on