mirror of
https://github.com/zeek/zeek.git
synced 2025-10-06 08:38:20 +00:00
Deprecate ptr_compat_uint and ptr_compat_int in util.h
This commit is contained in:
parent
289c03d386
commit
8862b585fa
6 changed files with 14 additions and 15 deletions
|
@ -31,7 +31,7 @@ void CCL::Negate()
|
||||||
|
|
||||||
void CCL::Add(int sym)
|
void CCL::Add(int sym)
|
||||||
{
|
{
|
||||||
ptr_compat_int sym_p = ptr_compat_int(sym);
|
auto sym_p = static_cast<std::intptr_t>(sym);
|
||||||
|
|
||||||
// Check to see if the character is already in the ccl.
|
// Check to see if the character is already in the ccl.
|
||||||
for ( auto sym : *syms )
|
for ( auto sym : *syms )
|
||||||
|
|
|
@ -2,12 +2,12 @@
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "util.h" // for ptr_compat_int
|
|
||||||
|
|
||||||
namespace zeek::detail {
|
namespace zeek::detail {
|
||||||
|
|
||||||
using int_list = std::vector<ptr_compat_int>;
|
using int_list = std::vector<std::intptr_t>;
|
||||||
|
|
||||||
class CCL {
|
class CCL {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
#include "EquivClass.h"
|
#include "EquivClass.h"
|
||||||
#include "CCL.h"
|
#include "CCL.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
namespace zeek::detail {
|
namespace zeek::detail {
|
||||||
|
|
||||||
|
|
|
@ -46,7 +46,7 @@ extern YYLTYPE yylloc; // holds start line and column of token
|
||||||
extern zeek::EnumType* cur_enum_type;
|
extern zeek::EnumType* cur_enum_type;
|
||||||
|
|
||||||
// Track the @if... depth.
|
// Track the @if... depth.
|
||||||
ptr_compat_int current_depth = 0;
|
std::intptr_t current_depth = 0;
|
||||||
|
|
||||||
zeek::detail::int_list if_stack;
|
zeek::detail::int_list if_stack;
|
||||||
|
|
||||||
|
|
|
@ -1253,8 +1253,8 @@ uint64_t rand64bit()
|
||||||
|
|
||||||
int int_list_cmp(const void* v1, const void* v2)
|
int int_list_cmp(const void* v1, const void* v2)
|
||||||
{
|
{
|
||||||
ptr_compat_int i1 = *(ptr_compat_int*) v1;
|
std::intptr_t i1 = *(std::intptr_t*) v1;
|
||||||
ptr_compat_int i2 = *(ptr_compat_int*) v2;
|
std::intptr_t i2 = *(std::intptr_t*) v2;
|
||||||
|
|
||||||
if ( i1 < i2 )
|
if ( i1 < i2 )
|
||||||
return -1;
|
return -1;
|
||||||
|
|
16
src/util.h
16
src/util.h
|
@ -86,16 +86,14 @@ typedef uint64_t bro_uint_t;
|
||||||
// pointer size. They can be cast safely to a pointer, e.g. in Lists,
|
// pointer size. They can be cast safely to a pointer, e.g. in Lists,
|
||||||
// which represent their entities as void* pointers.
|
// which represent their entities as void* pointers.
|
||||||
//
|
//
|
||||||
|
#define PRI_PTR_COMPAT_INT PRIdPTR // Format to use with printf.
|
||||||
|
#define PRI_PTR_COMPAT_UINT PRIuPTR
|
||||||
#if SIZEOF_VOID_P == 8
|
#if SIZEOF_VOID_P == 8
|
||||||
typedef uint64_t ptr_compat_uint;
|
typedef uint64_t ptr_compat_uint [[deprecated("Remove in v4.1. Use std::uintptr_t.")]];
|
||||||
typedef int64_t ptr_compat_int;
|
typedef int64_t ptr_compat_int [[deprecated("Remove in v4.1. Use std::intptr_t.")]];
|
||||||
#define PRI_PTR_COMPAT_INT PRId64 // Format to use with printf.
|
|
||||||
#define PRI_PTR_COMPAT_UINT PRIu64
|
|
||||||
#elif SIZEOF_VOID_P == 4
|
#elif SIZEOF_VOID_P == 4
|
||||||
typedef uint32_t ptr_compat_uint;
|
typedef uint32_t ptr_compat_uint [[deprecated("Remove in v4.1. Use std::uintptr_t")]];
|
||||||
typedef int32_t ptr_compat_int;
|
typedef int32_t ptr_compat_int [[deprecated("Remove in v4.1. Use std::iintptr_t")]];
|
||||||
#define PRI_PTR_COMPAT_INT PRId32
|
|
||||||
#define PRI_PTR_COMPAT_UINT PRIu32
|
|
||||||
#else
|
#else
|
||||||
# error "Unsupported pointer size."
|
# error "Unsupported pointer size."
|
||||||
#endif
|
#endif
|
||||||
|
@ -243,7 +241,7 @@ extern uint64_t rand64bit();
|
||||||
// Unfortunately, it introduces circular dependencies when defined in one of
|
// Unfortunately, it introduces circular dependencies when defined in one of
|
||||||
// the obvious places (like Event.h or RemoteSerializer.h)
|
// the obvious places (like Event.h or RemoteSerializer.h)
|
||||||
|
|
||||||
typedef ptr_compat_uint SourceID;
|
using SourceID = std::uintptr_t;
|
||||||
#define PRI_SOURCE_ID PRI_PTR_COMPAT_UINT
|
#define PRI_SOURCE_ID PRI_PTR_COMPAT_UINT
|
||||||
static const SourceID SOURCE_LOCAL = 0;
|
static const SourceID SOURCE_LOCAL = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue