Skip to content

Commit

Permalink
CONFIG/TEST: Fix compilation on gcc11
Browse files Browse the repository at this point in the history
- Check if linker also supports -diag-error NNNN flag, since passing
  such flag to the gcc in compile mode just produces sime warnings but
  does not cause it to fail. On other hand, the GNU linker does fail
  when passed such (unsupported) flag.
- Make pgtable comparator a const function
  • Loading branch information
yosefe committed Feb 3, 2021
1 parent f979fdb commit 12b0ba4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
20 changes: 10 additions & 10 deletions config/m4/compiler.m4
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ AC_DEFUN([DETECT_UARCH],
# CHECK_COMPILER_FLAG
# Usage: CHECK_COMPILER_FLAG([name], [flag], [program], [if-true], [if-false])
#
# The macro checks if program may be compiled using specified flag
# The macro checks if program may be compiled and linked using specified flag
#
AC_DEFUN([CHECK_COMPILER_FLAG],
[
Expand All @@ -214,15 +214,15 @@ AC_DEFUN([CHECK_COMPILER_FLAG],
SAVE_CXXFLAGS="$CFLAGS"
CFLAGS="$BASE_CFLAGS $CFLAGS $2"
CXXFLAGS="$BASE_CXXFLAGS $CXXFLAGS $2"
AC_COMPILE_IFELSE([$3],
[AC_MSG_RESULT([yes])
CFLAGS="$SAVE_CFLAGS"
CXXFLAGS="$SAVE_CXXFLAGS"
$4],
[AC_MSG_RESULT([no])
CFLAGS="$SAVE_CFLAGS"
CXXFLAGS="$SAVE_CXXFLAGS"
$5])
AC_LINK_IFELSE([$3],
[AC_MSG_RESULT([yes])
CFLAGS="$SAVE_CFLAGS"
CXXFLAGS="$SAVE_CXXFLAGS"
$4],
[AC_MSG_RESULT([no])
CFLAGS="$SAVE_CFLAGS"
CXXFLAGS="$SAVE_CXXFLAGS"
$5])
])


Expand Down
4 changes: 3 additions & 1 deletion test/gtest/ucs/test_pgtable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,9 @@ class test_pgtable_perf : public test_pgtable {

private:
struct region_comparator {
bool operator()(ucs_pgt_region_t* region1, ucs_pgt_region_t* region2) {
bool
operator()(ucs_pgt_region_t *region1, ucs_pgt_region_t *region2) const
{
return region1->end <= region2->start;
}
};
Expand Down

0 comments on commit 12b0ba4

Please sign in to comment.