brintos

brintos / llvm-project-archived public Read only

0
0
Text · 733 B · 965d144 Raw
34 lines · cpp
1//===----------------------------------------------------------------------===//2//3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.4// See https://llvm.org/LICENSE.txt for license information.5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception6//7//===----------------------------------------------------------------------===//8 9// UNSUPPORTED: no-threads10 11// <mutex>12 13// GCC doesn't have thread safety attributes14// UNSUPPORTED: gcc15 16// ADDITIONAL_COMPILE_FLAGS: -Wthread-safety17 18// XFAIL: FROZEN-CXX03-HEADERS-FIXME19 20#include <mutex>21 22#include "test_macros.h"23 24std::mutex m;25int foo __attribute__((guarded_by(m)));26 27int main(int, char**) {28  m.lock();29  foo++;30  m.unlock();31 32  return 0;33}34