Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
radistmorse authored Dec 17, 2024
2 parents 818f8ad + a474d71 commit a96d40e
Show file tree
Hide file tree
Showing 39 changed files with 212 additions and 157 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ 'macos-12', 'macos-13', 'macos-14', 'macos-15' ]
os: [ 'macos-13', 'macos-14', 'macos-15' ]
compiler: [ 'gcc', 'clang' ]
sanitizer: [ 'address', 'undefined', 'none' ]
tls: [ 'true', 'false' ]
Expand Down
39 changes: 39 additions & 0 deletions bldscripts/nfbmesbuild.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

#
# SPDX-FileCopyrightText: 2024 Duncan Greatwood
#
# SPDX-License-Identifier: Apache-2.0
#

# Execute this script from the parent directory by invoking:
# bldscripts/nfbmesbuild.sh

# Does the same as mesbuild.sh except with the --wrap-mode=nofallback
# option set

MY_SCRIPT_DIR="$(cd -P "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

source $MY_SCRIPT_DIR/helpers/messetdirvars.sh
source $MY_SCRIPT_DIR/helpers/adjbuilddirformesbuild.sh

MESON_BUILD_DIR="$MESON_BUILD_DIR.nfb"

if [ -e "${MESON_BUILD_DIR}" ]
then
echo "Using existing build dir ${MESON_BUILD_DIR}"
else
meson setup ${MESON_BUILD_DIR} \
--wrap-mode=nofallback \
--buildtype=release \
-DPISTACHE_USE_SSL=true \
-DPISTACHE_BUILD_EXAMPLES=true \
-DPISTACHE_BUILD_TESTS=true \
-DPISTACHE_BUILD_DOCS=false \
-DPISTACHE_USE_CONTENT_ENCODING_DEFLATE=true \
-DPISTACHE_USE_CONTENT_ENCODING_BROTLI=true \
-DPISTACHE_USE_CONTENT_ENCODING_ZSTD=true \
--prefix="${MESON_PREFIX_DIR}"
fi

meson compile -C ${MESON_BUILD_DIR}
7 changes: 3 additions & 4 deletions include/pistache/async.h
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ namespace Pistache::Async

if (allocated)
{
reinterpret_cast<T*>(mem)->~T();
std::destroy_at(reinterpret_cast<T*>(mem));
allocated = false;
}

Expand All @@ -274,7 +274,7 @@ namespace Pistache::Async
{
if (allocated)
{
reinterpret_cast<T*>(&storage)->~T();
std::destroy_at(reinterpret_cast<T*>(storage));
allocated = false;
}
}
Expand All @@ -299,8 +299,7 @@ namespace Pistache::Async
void* memory() override { return &storage; }

private:
typedef typename std::aligned_storage<sizeof(T), alignof(T)>::type Storage;
Storage storage;
alignas(T) std::byte storage[sizeof(T)];
};

template <>
Expand Down
6 changes: 3 additions & 3 deletions include/pistache/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@

#include <pistache/winornix.h>

#include PIST_QUOTE(PST_STRERROR_R_HDR)
#include PST_STRERROR_R_HDR

#include PIST_QUOTE(PST_NETDB_HDR)
#include PIST_QUOTE(PST_SOCKET_HDR)
#include PST_NETDB_HDR
#include PST_SOCKET_HDR

#include <sys/types.h>

Expand Down
2 changes: 1 addition & 1 deletion include/pistache/eventmeth.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ namespace Pistache
#include <map>
#include <condition_variable>

#include PIST_QUOTE(PST_FCNTL_HDR) // For FD_CLOEXEC and O_NONBLOCK
#include PST_FCNTL_HDR // For FD_CLOEXEC and O_NONBLOCK

/* ------------------------------------------------------------------------- */

Expand Down
2 changes: 1 addition & 1 deletion include/pistache/listener.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include <pistache/ssl_wrappers.h>
#include <pistache/tcp.h>

#include PIST_QUOTE(PST_SYS_RESOURCE_HDR)
#include PST_SYS_RESOURCE_HDR

#include <memory>
#include <thread>
Expand Down
13 changes: 6 additions & 7 deletions include/pistache/mailbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

#include <pistache/winornix.h>

#include PIST_QUOTE(PST_STRERROR_R_HDR)
#include PST_STRERROR_R_HDR

#include <pistache/eventmeth.h>
#include <pistache/pist_quote.h>

#include PIST_QUOTE(PIST_SOCKFNS_HDR)
#include PIST_SOCKFNS_HDR

#include <pistache/common.h>
#include <pistache/os.h>
Expand Down Expand Up @@ -213,8 +213,7 @@ namespace Pistache
T& data() { return *reinterpret_cast<T*>(&storage); }

private:
typedef typename std::aligned_storage<sizeof(T), alignof(T)>::type Storage;
Storage storage;
alignas(T) std::byte storage[sizeof(T)];
std::atomic<Entry*> next;
};

Expand All @@ -233,7 +232,7 @@ namespace Pistache
while (!empty())
{
Entry* e = pop();
e->data().~T();
std::destroy_at(&e->data());
delete e;
}
delete tail;
Expand All @@ -258,7 +257,7 @@ namespace Pistache
// Since it's Single-Consumer, the store does not need to be atomic
tail = next;
new (&res->storage) T(std::move(next->data()));
next->data().~T();
std::destroy_at(&next->data());
return res;
}
return nullptr;
Expand All @@ -275,7 +274,7 @@ namespace Pistache
if (entry)
{
object.reset(new T(std::move(entry->data())));
entry->data().~T();
std::destroy_at(&entry->data());
}

return object;
Expand Down
10 changes: 5 additions & 5 deletions include/pistache/net.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@

#include <pistache/winornix.h>

#include PIST_QUOTE(PST_NETDB_HDR)
#include PST_NETDB_HDR

// netinet/in.h defines in_port_t, in_addr_t, in_addr, sockaddr_in,
// sockaddr_in6, IPPROTO_IP, INADDR_ANY, etc.
#include PIST_QUOTE(PST_NETINET_IN_HDR)
#include PST_NETINET_IN_HDR

#include PIST_QUOTE(PST_SOCKET_HDR)
#include PIST_QUOTE(PST_SYS_UN_HDR)
#include PST_SOCKET_HDR
#include PST_SYS_UN_HDR

#include PIST_QUOTE(PIST_SOCKFNS_HDR)
#include PIST_SOCKFNS_HDR

#ifndef _KERNEL_FASTOPEN
#define _KERNEL_FASTOPEN
Expand Down
2 changes: 1 addition & 1 deletion include/pistache/pist_check.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define INCLUDED_PSCHECK_H

#include <mutex>

#include <pistache/pist_quote.h>
#include "pist_syslog.h"

// If DEBUG is enabled, PS_LOGDBG_STACK_TRACE logs a stack trace
Expand Down
2 changes: 1 addition & 1 deletion include/pistache/pist_timelog.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <pistache/winornix.h>
#include <pistache/emosandlibevdefs.h> // For _IS_BSD

#include PIST_QUOTE(PST_CLOCK_GETTIME_HDR) // for clock_gettime and asctime
#include PST_CLOCK_GETTIME_HDR // for clock_gettime and asctime
#include <stdio.h> // snprintf
#include <stdarg.h> // for vsnprintf

Expand Down
2 changes: 1 addition & 1 deletion include/pistache/ps_basename.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

#include <pistache/winornix.h>

#include PIST_QUOTE(PST_MAXPATH_HDR) // for PST_MAXPATHLEN
#include PST_MAXPATH_HDR // for PST_MAXPATHLEN
/* ------------------------------------------------------------------------- */

#ifdef __APPLE__
Expand Down
2 changes: 1 addition & 1 deletion include/pistache/pst_errno.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
//
// Note that we use this intermediate include, rather than just relying solely
// on defining PST_ERRNO_HDR to be 'errno.h' for Windows, because of mingw
// gcc's treatment of errno as a macro - 'include PIST_QUOTE(PST_ERRNO_HDR)',
// gcc's treatment of errno as a macro - 'include PST_ERRNO_HDR',
// with PST_ERRNO_HDR defined as 'errno.h', can translate to "(*_errno()).h",
// which is not what we want.
//
Expand Down
2 changes: 1 addition & 1 deletion include/pistache/timer_pool.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include <vector>

#include <cassert>
#include PIST_QUOTE(PST_MISC_IO_HDR) // e.g. unistd.h
#include PST_MISC_IO_HDR // e.g. unistd.h

namespace Pistache
{
Expand Down
4 changes: 1 addition & 3 deletions include/pistache/transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@

#include <pistache/winornix.h>

#include PIST_QUOTE(PST_SYS_RESOURCE_HDR) // for PST_RUSAGE + PST_GETRUSAGE
#include PST_SYS_RESOURCE_HDR // for PST_RUSAGE + PST_GETRUSAGE

#include <pistache/pist_timelog.h>
#include <pistache/pist_quote.h>
#include <pistache/async.h>
#include <pistache/mailbox.h>
#include <pistache/pist_quote.h>
Expand Down
Loading

0 comments on commit a96d40e

Please sign in to comment.