1 /*
   2  * This file and its contents are supplied under the terms of the
   3  * Common Development and Distribution License ("CDDL"), version 1.0.
   4  * You may only use this file in accordance with the terms of version
   5  * 1.0 of the CDDL.
   6  *
   7  * A full copy of the text of the CDDL should have accompanied this
   8  * source.  A copy of the CDDL is also available via the Internet at
   9  * http://www.illumos.org/license/CDDL.
  10  */
  11 
  12 /*
  13  * Copyright 2020 Joyent, Inc.
  14  */
  15 
  16 #include <stdint.h>
  17 
  18 /*
  19  * Basic sanity checking of enumerations, using specific numbers and arbitrary
  20  * numbers.
  21  */
  22 
  23 enum ff6 {
  24         TERRA,
  25         LOCKE,
  26         EDGAR,
  27         SABIN,
  28         CELES,
  29         CYAN,
  30         SHADOW,
  31         GAU,
  32         SETZER,
  33         STRAGO,
  34         RELM,
  35         MOG,
  36         GOGO,
  37         UMARO,
  38         LEO,
  39         KEFKA
  40 };
  41 
  42 typedef enum ff10 {
  43         TIDUS = -10,
  44         YUNA = 23,
  45         AURON = -34,
  46         WAKA = 52,
  47         LULU = INT32_MAX,
  48         RIKKU = INT32_MIN,
  49         KHIMARI = 0
  50 } ff10_t;
  51 
  52 /*
  53  * The following enum is copy of the ddi_hp_cn_state_t enumeration which was
  54  * previously incorrectly converted by the tools. Notably, we always assumed
  55  * that the DWARF enum values were signed; however, in this case we needed to
  56  * check for an unsigned version before a signed version, otherwise some of the
  57  * entries below will have the wrong values.
  58  */
  59 typedef enum chrono {
  60         CRONO = 0x1000,
  61         LUCCA = 0x2000,
  62         MARLE = 0x3000,
  63         FROG = 0x4000,
  64         ROBO = 0x5000,
  65         AYLA = 0x6000,
  66         MAGUS = 0x7000,
  67         SCHALA = 0x8000,
  68         LAVOS = 0x9000,
  69         BALTHAZAR = 0xa000
  70 } chrono_t;
  71 
  72 enum ff6 ff6;
  73 ff10_t ff10;
  74 chrono_t trigger;
  75 
  76 /*
  77  * Normally enums are integer-sized, but a packed enum is a counter-example, as
  78  * is something like trace_alloc_type_t which can't fit in an int.
  79  */
  80 
  81 enum char_enum {
  82         CE1,
  83         CE2
  84 } __attribute__((packed)) ce;
  85 
  86 enum short_enum {
  87         SE1,
  88         SE2,
  89         SE3 = 255,
  90         SE4 = 256,
  91         SE5 = 257
  92 } __attribute__((packed)) se;
  93 
  94 enum int_enum {
  95         IE1,
  96         IE2,
  97         IE3 = 256,
  98         IE4 = 257
  99 } ie;
 100 
 101 enum ll_enum {
 102         LLE1 = -1ULL,
 103         LLE2 = -2ULL,
 104 } lle;