Skip to content

Commit 844e1fd

Browse files
rpoyner-tripixar-oss
authored andcommitted
pegtl: fix namespace problems
- Fix preprocessor-time composition of PXR_PEGTL_NAMESPACE -- the prior solution failed to do name expansion, always yielding a not-configurable `PXR_INTERNAL_NS_pegtl` - Put the "workaround" symbol into the namespace Partial fix for #3279. Closes #3282 (Internal change: 2387714)
1 parent def0202 commit 844e1fd

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

pxr/base/pegtl/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,9 @@ This file defines the namespace name that PEGTL uses:
3939
#include "pxr/pxr.h"
4040
4141
#if PXR_USE_NAMESPACES
42-
#define PXR_PEGTL_NAMESPACE PXR_INTERNAL_NS ## _pegtl
42+
#define PXR_PEGTL_impl_PASTE2(x, y) x ## y
43+
#define PXR_PEGTL_impl_PASTE(x, y) PXR_PEGTL_impl_PASTE2(x, y)
44+
#define PXR_PEGTL_NAMESPACE PXR_PEGTL_impl_PASTE(PXR_INTERNAL_NS, _pegtl)
4345
#else
4446
#define PXR_PEGTL_NAMESPACE pxr_pegtl
4547
#endif

pxr/base/pegtl/build-workaround.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,8 @@
1010
// adding this, an "empty" .so gets built and other libs can link it.
1111

1212
#include "pxr/base/arch/export.h"
13+
#include "pxr/base/pegtl/pegtl/config.hpp"
1314

15+
namespace PXR_PEGTL_NAMESPACE {
1416
ARCH_EXPORT int __pxr_pegtl_workaround__;
17+
}

pxr/base/pegtl/pegtl/config.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
#include "pxr/pxr.h"
1010

1111
#if PXR_USE_NAMESPACES
12-
#define PXR_PEGTL_NAMESPACE PXR_INTERNAL_NS ## _pegtl
12+
#define PXR_PEGTL_impl_PASTE2(x, y) x ## y
13+
#define PXR_PEGTL_impl_PASTE(x, y) PXR_PEGTL_impl_PASTE2(x, y)
14+
#define PXR_PEGTL_NAMESPACE PXR_PEGTL_impl_PASTE(PXR_INTERNAL_NS, _pegtl)
1315
#else
1416
#define PXR_PEGTL_NAMESPACE pxr_pegtl
1517
#endif

0 commit comments

Comments
 (0)