Opened 13 years ago

Closed 13 years ago

#2986 closed Patches (fixed)

Boost.Filesystem warnings when wchar_t is 16-bit are a problem when warnings are treated as errors

Reported by: spencer@… Owned by: Beman Dawes
Milestone: Boost 1.40.0 Component: filesystem
Version: Boost 1.38.0 Severity: Cosmetic
Keywords: warnings wchar_t UCS2 Cc:

Description

When wchar_t is 16-bit, some code in Boost.Filesystem can trigger range comparison warnings:

src/libs/detail/utf8_codecvt_facet.cpp:245: warning: comparison is always true due to limited range of data type src/libs/detail/utf8_codecvt_facet.cpp:248: warning: comparison is always true due to limited range of data type src/libs/detail/utf8_codecvt_facet.cpp:251: warning: comparison is always true due to limited range of data type

There is a note near this code that says to ignore these warnings if wchar_t is UCS2 (16-bit), but if the compiler is treating (all) warnings as errors, this is difficult to do automatically.

Something along the lines of the attached patch should allow the code to work properly in both cases. An alternative solution would be to completely remove the specialization if wchar_t is 16-bit (i.e. wrap the whole function in the #ifdef guards).

Attachments (1)

52-fix-wchar_t-ucs2.diff (1.3 KB ) - added by spencer@… 13 years ago.
Patch showing one way to remove the warnings

Download all attachments as: .zip

Change History (2)

by spencer@…, 13 years ago

Attachment: 52-fix-wchar_t-ucs2.diff added

Patch showing one way to remove the warnings

comment:1 by Beman Dawes, 13 years ago

Milestone: Boost 1.39.0Boost 1.40.0
Resolution: fixed
Status: newclosed

Patch applied. Thanks!

--Beman

Note: See TracTickets for help on using tickets.