[libcxx] r351027 - [libcxx] Mark do_open, do_get and do_close parameters unused when catopen is missing

Petr Hosek phosek at chromium.org
Sun Jan 13 14:15:37 PST 2019


Author: phosek
Date: Sun Jan 13 14:15:37 2019
New Revision: 351027

URL: http://llvm.org/viewvc/llvm-project?rev=351027&view=rev
Log:
[libcxx] Mark do_open, do_get and do_close parameters unused when catopen is missing

When catopen is missing, do_open, do_get and do_close end up being
no-op, and as such their parameters will be unused which triggers a
warning/error when building with -Wunused-parameter.

Differential Revision: https://reviews.llvm.org/D56023

Modified:
    libcxx/trunk/include/__config
    libcxx/trunk/include/locale

Modified: libcxx/trunk/include/__config
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=351027&r1=351026&r2=351027&view=diff
==============================================================================
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Sun Jan 13 14:15:37 2019
@@ -1424,6 +1424,8 @@ _LIBCPP_FUNC_VIS extern "C" void __sanit
 #  endif // defined(_LIBCPP_ABI_MICROSOFT) && !defined(_LIBCPP_BUILDING_LIBRARY)
 #endif // _LIBCPP_NO_AUTO_LINK
 
+#define _LIBCPP_UNUSED_VAR(x) ((void)(x))
+
 #endif // __cplusplus
 
 #endif // _LIBCPP_CONFIG

Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=351027&r1=351026&r2=351027&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Sun Jan 13 14:15:37 2019
@@ -3568,6 +3568,7 @@ messages<_CharT>::do_open(const basic_st
         __cat = static_cast<catalog>((static_cast<size_t>(__cat) >> 1));
     return __cat;
 #else // !_LIBCPP_HAS_CATOPEN
+    _LIBCPP_UNUSED_VAR(__nm);
     return -1;
 #endif // _LIBCPP_HAS_CATOPEN
 }
@@ -3591,6 +3592,9 @@ messages<_CharT>::do_get(catalog __c, in
                                                         __n, __n + strlen(__n));
     return __w;
 #else // !_LIBCPP_HAS_CATOPEN
+    _LIBCPP_UNUSED_VAR(__c);
+    _LIBCPP_UNUSED_VAR(__set);
+    _LIBCPP_UNUSED_VAR(__msgid);
     return __dflt;
 #endif // _LIBCPP_HAS_CATOPEN
 }
@@ -3604,6 +3608,8 @@ messages<_CharT>::do_close(catalog __c)
         __c <<= 1;
     nl_catd __cat = (nl_catd)__c;
     catclose(__cat);
+#else // !_LIBCPP_HAS_CATOPEN
+    _LIBCPP_UNUSED_VAR(__c);
 #endif // _LIBCPP_HAS_CATOPEN
 }
 




More information about the libcxx-commits mailing list