Here's the patch I applied locally. hth... don
diff --git a/src/DwarfParser.hpp b/src/DwarfParser.hpp index 518101e..ac4f1c4 100644 --- a/src/DwarfParser.hpp +++ b/src/DwarfParser.hpp @@ -540,7 +540,7 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions, results->cfaRegister = 0; results->cfaExpression = (int64_t)p; length = addressSpace.getULEB128(p, instructionsEnd); - assert(length < std::numeric_limits<pint_t>::max() && "pointer overflow"); + assert(length < static_cast<pint_t>(~0) && "pointer overflow"); p += static_cast<pint_t>(length); _LIBUNWIND_TRACE_DWARF("DW_CFA_def_cfa_expression(expression=0x%" PRIx64 ", length=%" PRIu64 ")\n", @@ -556,7 +556,7 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions, results->savedRegisters[reg].location = kRegisterAtExpression; results->savedRegisters[reg].value = (int64_t)p; length = addressSpace.getULEB128(p, instructionsEnd); - assert(length < std::numeric_limits<pint_t>::max() && "pointer overflow"); + assert(length < static_cast<pint_t>(~0) && "pointer overflow"); p += static_cast<pint_t>(length); _LIBUNWIND_TRACE_DWARF("DW_CFA_expression(reg=%" PRIu64 ", " "expression=0x%" PRIx64 ", " @@ -642,7 +642,7 @@ bool CFI_Parser<A>::parseInstructions(A &addressSpace, pint_t instructions, results->savedRegisters[reg].location = kRegisterIsExpression; results->savedRegisters[reg].value = (int64_t)p; length = addressSpace.getULEB128(p, instructionsEnd); - assert(length < std::numeric_limits<pint_t>::max() && "pointer overflow"); + assert(length < static_cast<pint_t>(~0) && "pointer overflow"); p += static_cast<pint_t>(length); _LIBUNWIND_TRACE_DWARF("DW_CFA_val_expression(reg=%" PRIu64 ", " "expression=0x%" PRIx64 ", length=%" PRIu64 ")\n", On Mon, Dec 25, 2017 at 11:26 AM, Don Hinton <hinto...@gmail.com> wrote: > > On Mon, Dec 25, 2017 at 11:09 AM, whitequark <whitequ...@whitequark.org> > wrote: > >> On 2017-12-25 19:04, Don Hinton wrote: >> >>> Hi: >>> >>> This change breaks in a local debug build, e.g.,: >>> >>> /Users/dhinton/projects/llvm_project/libunwind/src/DwarfPars >>> er.hpp:559:28: >>> error: no member named 'numeric_limits' in namespace 'std' >>> assert(length < std::numeric_limits<pint_t>::max() && "pointer >>> overflow"); >>> ~~~~~^ >>> >> >> Sorry, I missed this. Any idea on reformulating the assert in a way >> that does not require libcxx headers? Not having them significantly >> simplifies bare-metal builds... >> > > Well, assuming pint_t is some unsigned integer type, the max can be found > like this: > > pint_t max_pint_t = ~0; > > So, that could be used in a pinch. > > >> >> >>> thanks... >>> don >>> >>> On Mon, Dec 25, 2017 at 5:06 AM, whitequark via cfe-commits >>> <cfe-commits@lists.llvm.org> wrote: >>> >>> Author: whitequark >>>> Date: Mon Dec 25 05:06:09 2017 >>>> New Revision: 321440 >>>> >>>> URL: http://llvm.org/viewvc/llvm-project?rev=321440&view=rev [1] >>>> Log: >>>> [libunwind] Avoid using C++ headers. >>>> >>>> This is useful for building libunwind on libcxx-free systems. >>>> >>>> Modified: >>>> libunwind/trunk/src/DwarfParser.hpp >>>> >>>> Modified: libunwind/trunk/src/DwarfParser.hpp >>>> URL: >>>> >>>> http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Dwar >>> fParser.hpp?rev=321440&r1=321439&r2=321440&view=diff >>> >>>> [2] >>>> >>>> ============================================================ >>> ================== >>> >>>> --- libunwind/trunk/src/DwarfParser.hpp (original) >>>> +++ libunwind/trunk/src/DwarfParser.hpp Mon Dec 25 05:06:09 2017 >>>> @@ -17,7 +17,7 @@ >>>> #include <stdint.h> >>>> #include <stdio.h> >>>> #include <stdlib.h> >>>> -#include <limits> >>>> +#include <limits.h> >>>> >>>> #include "libunwind.h" >>>> #include "dwarf2.h" >>>> >>>> _______________________________________________ >>>> cfe-commits mailing list >>>> cfe-commits@lists.llvm.org >>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits [3] >>>> >>> >>> >>> >>> Links: >>> ------ >>> [1] http://llvm.org/viewvc/llvm-project?rev=321440&view=rev >>> [2] >>> http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Dwar >>> fParser.hpp?rev=321440&r1=321439&r2=321440&view=diff >>> [3] http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits >>> >> >> -- >> whitequark >> > >
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits