sbc100 updated this revision to Diff 328538.
sbc100 added a comment.

add tests


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D46443/new/

https://reviews.llvm.org/D46443

Files:
  libcxx/include/CMakeLists.txt
  libcxx/include/cstdalign
  libcxx/include/module.modulemap
  libcxx/test/libcxx/double_include.sh.cpp
  libcxx/test/libcxx/language.support/cstdalign/version.pass.cpp
  libcxx/test/libcxx/min_max_macros.compile.pass.cpp
  libcxx/test/libcxx/no_assert_include.compile.pass.cpp
  libcxx/test/std/language.support/cstdalign/cstdalign.pass.cpp

Index: libcxx/test/std/language.support/cstdalign/cstdalign.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/std/language.support/cstdalign/cstdalign.pass.cpp
@@ -0,0 +1,31 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// test <cstdalign>
+
+#include <cstdalign>
+
+int main(int, char**) {
+#ifdef alignas
+#error alignas should not be a macro in C++
+#endif
+
+#ifdef alignof
+#error alignof should not be a macro in C++
+#endif
+
+#ifndef __alignas_is_defined
+#error __alignas_is_defined not defined
+#endif
+
+#ifndef __alignof_is_defined
+#error __alignof_is_defined not defined
+#endif
+
+  return 0;
+}
Index: libcxx/test/libcxx/no_assert_include.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/no_assert_include.compile.pass.cpp
+++ libcxx/test/libcxx/no_assert_include.compile.pass.cpp
@@ -63,6 +63,7 @@
 #include <condition_variable>
 #include <csetjmp>
 #include <csignal>
+#include <cstdalign>
 #include <cstdarg>
 #include <cstdbool>
 #include <cstddef>
Index: libcxx/test/libcxx/min_max_macros.compile.pass.cpp
===================================================================
--- libcxx/test/libcxx/min_max_macros.compile.pass.cpp
+++ libcxx/test/libcxx/min_max_macros.compile.pass.cpp
@@ -96,6 +96,8 @@
 TEST_MACROS();
 #include <csignal>
 TEST_MACROS();
+#include <cstdalign>
+TEST_MACROS();
 #include <cstdarg>
 TEST_MACROS();
 #include <cstdbool>
Index: libcxx/test/libcxx/language.support/cstdalign/version.pass.cpp
===================================================================
--- /dev/null
+++ libcxx/test/libcxx/language.support/cstdalign/version.pass.cpp
@@ -0,0 +1,23 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+// <cstdalign>
+
+#include <cstdalign>
+
+#include "test_macros.h"
+
+#ifndef _LIBCPP_VERSION
+#error _LIBCPP_VERSION not defined
+#endif
+
+int main(int, char**)
+{
+
+  return 0;
+}
Index: libcxx/test/libcxx/double_include.sh.cpp
===================================================================
--- libcxx/test/libcxx/double_include.sh.cpp
+++ libcxx/test/libcxx/double_include.sh.cpp
@@ -70,6 +70,7 @@
 #include <condition_variable>
 #include <csetjmp>
 #include <csignal>
+#include <cstdalign>
 #include <cstdarg>
 #include <cstdbool>
 #include <cstddef>
Index: libcxx/include/module.modulemap
===================================================================
--- libcxx/include/module.modulemap
+++ libcxx/include/module.modulemap
@@ -161,7 +161,10 @@
       header "csignal"
       export *
     }
-    // FIXME: <cstdalign> is missing.
+    module cstdalign {
+      header "cstdalign"
+      export *
+    }
     module cstdarg {
       header "cstdarg"
       export *
Index: libcxx/include/cstdalign
===================================================================
--- /dev/null
+++ libcxx/include/cstdalign
@@ -0,0 +1,33 @@
+// -*- C++ -*-
+//===--------------------------- cstdalign --------------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef _LIBCPP_CSTDALIGN
+#define _LIBCPP_CSTDALIGN
+
+/*
+    cstdalign synopsis
+
+Macros:
+
+   alignof
+   alignas
+    __alignof_is_defined
+    __alignas_is_defined
+
+*/
+
+#include <__config>
+#include <stdalign.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#pragma GCC system_header
+#endif
+
+#endif  // _LIBCPP_CSTDALIGN
Index: libcxx/include/CMakeLists.txt
===================================================================
--- libcxx/include/CMakeLists.txt
+++ libcxx/include/CMakeLists.txt
@@ -55,6 +55,7 @@
   condition_variable
   csetjmp
   csignal
+  cstdalign
   cstdarg
   cstdbool
   cstddef
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to