test/hotspot/gtest/metaprogramming/test_isArray.cpp
author manc
Mon, 14 Oct 2019 18:48:10 -0700
changeset 58652 9b67dd88a931
parent 54092 48a02303574e
permissions -rw-r--r--
8232232: G1RemSetSummary::_rs_threads_vtimes is not initialized to zero Summary: Fix error in "Concurrent refinement threads times" in GC log and cleanup. Reviewed-by: tschatzl, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
54092
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     1
/*
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     2
 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     4
 *
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     7
 * published by the Free Software Foundation.
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     8
 *
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    13
 * accompanied this code).
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    14
 *
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    18
 *
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    21
 * questions.
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    22
 *
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    23
 */
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    24
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    25
#include "precompiled.hpp"
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    26
#include "memory/allocation.hpp"
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    27
#include "metaprogramming/isArray.hpp"
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    28
#include "utilities/debug.hpp"
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    29
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    30
class IsArrayTest: AllStatic {
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    31
  class A: AllStatic {};
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    32
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    33
  static const bool ia_A = IsArray<A>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    34
  STATIC_ASSERT(!ia_A);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    35
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    36
  static const bool ia_Aptr = IsArray<A*>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    37
  STATIC_ASSERT(!ia_Aptr);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    38
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    39
  static const bool ia_Aarr = IsArray<A[]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    40
  STATIC_ASSERT(ia_Aarr);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    41
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    42
  static const bool ia_Aarr10 = IsArray<A[10]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    43
  STATIC_ASSERT(ia_Aarr10);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    44
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    45
  static const bool ia_Aptrarr10 = IsArray<A*[10]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    46
  STATIC_ASSERT(ia_Aptrarr10);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    47
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    48
  static const bool ia_Aarr10arr10 = IsArray<A[10][10]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    49
  STATIC_ASSERT(ia_Aarr10arr10);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    50
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    51
  static const bool ia_cAarr = IsArray<const A[]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    52
  STATIC_ASSERT(ia_cAarr);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    53
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    54
  static const bool ia_vAarr = IsArray<volatile A[]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    55
  STATIC_ASSERT(ia_vAarr);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    56
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    57
  static const bool ia_cAarr10 = IsArray<const A[10]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    58
  STATIC_ASSERT(ia_cAarr10);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    59
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    60
  static const bool ia_vAarr10 = IsArray<volatile A[10]>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    61
  STATIC_ASSERT(ia_vAarr10);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    62
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    63
  static const bool ia_voidptr = IsArray<void*>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    64
  STATIC_ASSERT(!ia_voidptr);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    65
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    66
  static const bool ia_intptrt = IsArray<intptr_t>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    67
  STATIC_ASSERT(!ia_intptrt);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    68
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    69
  static const bool ia_char = IsArray<char>::value;
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    70
  STATIC_ASSERT(!ia_char);
48a02303574e 8219816: Add IsArray/RemoveExtent type traits utilities
pliden
parents:
diff changeset
    71
};