Skip to content

Commit 4c06886

Browse files
authored
make it possible to explicitly disable the legacy TokenList constructors (#621)
1 parent 814942b commit 4c06886

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright (C) 2016-2023 simplecpp team
44
*/
55

6+
#define SIMPLECPP_TOKENLIST_ALLOW_PTR 0
67
#include "simplecpp.h"
78

89
#include <cstdlib>

simplecpp.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,9 @@
5757
#ifndef SIMPLECPP_TOKENLIST_ALLOW_PTR
5858
// still provide the legacy API in case we lack the performant wrappers
5959
# if !defined(__cpp_lib_string_view) && !defined(__cpp_lib_span)
60-
# define SIMPLECPP_TOKENLIST_ALLOW_PTR
60+
# define SIMPLECPP_TOKENLIST_ALLOW_PTR 1
61+
# else
62+
# define SIMPLECPP_TOKENLIST_ALLOW_PTR 0
6163
# endif
6264
#endif
6365

@@ -267,7 +269,7 @@ namespace simplecpp {
267269
TokenList(const unsigned char (&data)[size], std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = nullptr)
268270
: TokenList(data, size-1, filenames, filename, outputList, 0)
269271
{}
270-
#ifdef SIMPLECPP_TOKENLIST_ALLOW_PTR
272+
#if SIMPLECPP_TOKENLIST_ALLOW_PTR
271273
/** generates a token list from the given buffer */
272274
TokenList(const unsigned char* data, std::size_t size, std::vector<std::string> &filenames, const std::string &filename=std::string(), OutputList *outputList = nullptr)
273275
: TokenList(data, size, filenames, filename, outputList, 0)

0 commit comments

Comments
 (0)