HAVE_CPP_ATTRIBUTE_NODISCARD is always true now
...but for safety, leave the configure.ac check in for some longer. Also, save removing now-redundant SAL_WARN_UNUSED_RESULT in internal code for a follow-up commit. Change-Id: Ibe30b51c5cc4abc270f955c7c40b59f268986672 Reviewed-on: https://gerrit.libreoffice.org/64771 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
parent
5f8b6b0987
commit
a061abd394
@ -21,9 +21,6 @@ Any change in this header will cause a rebuild of almost everything.
|
|||||||
/* Compiler supports __attribute__((warn_unused)). */
|
/* Compiler supports __attribute__((warn_unused)). */
|
||||||
#define HAVE_GCC_ATTRIBUTE_WARN_UNUSED 0
|
#define HAVE_GCC_ATTRIBUTE_WARN_UNUSED 0
|
||||||
|
|
||||||
/* [[nodiscard]] (C++17), __has_cpp_attribute(nodiscard) (C++2a): */
|
|
||||||
#define HAVE_CPP_ATTRIBUTE_NODISCARD 0
|
|
||||||
|
|
||||||
/* Guaranteed copy elision (C++17), __cpp_guaranteed_copy_elision (C++2a): */
|
/* Guaranteed copy elision (C++17), __cpp_guaranteed_copy_elision (C++2a): */
|
||||||
#define HAVE_CPP_GUARANTEED_COPY_ELISION 0
|
#define HAVE_CPP_GUARANTEED_COPY_ELISION 0
|
||||||
|
|
||||||
|
@ -6447,7 +6447,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|||||||
CXXFLAGS=$save_CXXFLAGS
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
|
|
||||||
AC_MSG_CHECKING([[whether $CXX supports [[nodiscard]]]])
|
dnl This check can eventually be removed completely (e.g., after libreoffice-6-3 branch off):
|
||||||
|
AC_MSG_CHECKING([[that $CXX supports [[nodiscard]]]])
|
||||||
AC_LANG_PUSH([C++])
|
AC_LANG_PUSH([C++])
|
||||||
save_CXXFLAGS=$CXXFLAGS
|
save_CXXFLAGS=$CXXFLAGS
|
||||||
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
|
CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11"
|
||||||
@ -6467,10 +6468,8 @@ AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
|||||||
#else
|
#else
|
||||||
[[nodiscard]] int f();
|
[[nodiscard]] int f();
|
||||||
#endif
|
#endif
|
||||||
]])], [
|
]])],
|
||||||
AC_DEFINE([HAVE_CPP_ATTRIBUTE_NODISCARD],[1])
|
AC_MSG_RESULT([yes]), AC_MSG_ERROR([$CXX lacks required [[nodiscard]] support]))
|
||||||
AC_MSG_RESULT([yes])
|
|
||||||
], [AC_MSG_RESULT([no])])
|
|
||||||
CXXFLAGS=$save_CXXFLAGS
|
CXXFLAGS=$save_CXXFLAGS
|
||||||
AC_LANG_POP([C++])
|
AC_LANG_POP([C++])
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ typedef void * sal_Handle;
|
|||||||
Compilers that support a construct of this nature will emit a compile
|
Compilers that support a construct of this nature will emit a compile
|
||||||
time warning on unchecked return value.
|
time warning on unchecked return value.
|
||||||
*/
|
*/
|
||||||
#if defined __cplusplus && HAVE_CPP_ATTRIBUTE_NODISCARD
|
#if defined LIBO_INTERNAL_ONLY && defined __cplusplus
|
||||||
#define SAL_WARN_UNUSED_RESULT [[nodiscard]]
|
#define SAL_WARN_UNUSED_RESULT [[nodiscard]]
|
||||||
#elif (defined __GNUC__ \
|
#elif (defined __GNUC__ \
|
||||||
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))) \
|
&& (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))) \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user