Skip to content

Commit

Permalink
Fix build failure due to libc++ using libc functions
Browse files Browse the repository at this point in the history
Include the "alloc-private.h" header after the C++ standard library
headers. This sidesteps build failures caused by implementations of
std::map and std::string which use libc memory allocation functions
in expanded templates after they have been marked with the "poison"
pragma.

Fixes #115
  • Loading branch information
aperezdc committed Aug 4, 2022
1 parent 7bdecb9 commit 3298cd1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/pasteboard-generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@

#include "pasteboard-private.h"

#include "alloc-private.h"
#include <cstdlib>
#include <cstring>
#include <map>
#include <string>

// We need to include this header last, in order to avoid template expansions
// from the C++ standard library happening after it forbids usage of the libc
// memory functions.
#include "alloc-private.h"
#include <cstring>

namespace Generic {
using Pasteboard = std::map<std::string, std::string>;
}
Expand Down

0 comments on commit 3298cd1

Please sign in to comment.