• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • C
          • Syntax-for-tools
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Compilation-database
            • Printer
            • Output-files
            • Abstract-syntax-operations
            • Implementation-environments
            • Abstract-syntax
              • Abstract-syntax-trees
                • Expr
                • Type-spec
                • Exprs/decls/stmts
                  • Expr
                  • Type-spec
                  • Stmt
                  • Amb-expr/tyname
                  • Dirdeclor
                  • Asm-stmt
                  • Attrib
                  • Amb-decl/stmt
                  • Dirabsdeclor
                  • Decl-spec
                  • Struct-declon
                  • Amb-declor/absdeclor
                  • Struni-spec
                  • Param-declor
                  • Declor
                  • Initdeclor
                  • Absdeclor
                  • Tyname
                  • Label
                  • Align-spec
                    • Align-spec-case
                      • Align-specp
                      • Align-spec-equiv
                      • Align-spec-alignas-type
                      • Align-spec-alignas-expr
                      • Align-spec-alignas-ambig
                      • Align-spec-kind
                      • Align-spec-fix
                      • Align-spec-count
                    • Expr-option
                    • Spec/qual
                    • Desiniter
                    • Param-declon
                    • Dirabsdeclor-option
                    • Comp-stmt
                    • Const-expr-option
                    • Attrib-spec
                    • Struct-declor
                    • Decl
                    • Initer
                    • Absdeclor-option
                    • Statassert
                    • Member-designor
                    • Initer-option
                    • Enum-spec
                    • Declor-option
                    • Block-item
                    • Const-expr
                    • Genassoc
                    • Asm-output
                    • Asm-input
                    • Designor
                    • Enumer
                    • Typequal/attribspec
                    • Typequal/attribspec-list
                    • Decl-spec-list
                    • Spec/qual-list
                    • Desiniter-list
                    • Attrib-spec-list
                    • Param-declon-list
                    • Decl-list
                    • Typequal/attribspec-list-list
                    • Struct-declor-list
                    • Struct-declon-list
                    • Initdeclor-list
                    • Genassoc-list
                    • Block-item-list
                    • Enumer-list
                    • Expr-list
                    • Asm-output-list
                    • Asm-input-list
                    • Designor-list
                    • Attrib-list
                  • Binop
                  • Stmt
                  • Unop
                  • Amb-expr/tyname
                  • Dirdeclor
                  • Asm-stmt
                  • Dec/oct/hex-const
                  • Simple-escape
                  • Fsuffix
                  • Attrib
                  • Ident
                  • Amb-decl/stmt
                  • Dirabsdeclor
                  • Type-qual
                  • Decl-spec
                  • Fundef
                  • Struct-declon
                  • Asm-name-spec
                  • Amb-declor/absdeclor
                  • Struni-spec
                  • Param-declor
                  • Declor
                  • Stor-spec
                  • Transunit-ensemble
                  • Initdeclor
                  • Absdeclor
                  • Tyname
                  • Keyword-uscores
                  • Label
                  • Align-spec
                    • Align-spec-case
                      • Align-specp
                      • Align-spec-equiv
                      • Align-spec-alignas-type
                      • Align-spec-alignas-expr
                      • Align-spec-alignas-ambig
                      • Align-spec-kind
                      • Align-spec-fix
                      • Align-spec-count
                    • Expr-option
                    • Spec/qual
                    • Lsuffix
                    • Hex-frac-const
                    • Desiniter
                    • Param-declon
                    • Iconst
                    • Dirabsdeclor-option
                    • Dec-frac-const
                    • Dec-core-fconst
                    • Comp-stmt
                    • Extdecl
                    • Const-expr-option
                    • Amb?-declor/absdeclor
                    • Isuffix
                    • Hex-core-fconst
                    • Attrib-spec
                    • Struct-declor
                    • Escape
                    • Decl
                    • Amb?-expr/tyname
                    • Initer
                    • Ident-option
                    • Bin-expo
                    • Absdeclor-option
                    • Statassert
                    • Member-designor
                    • Initer-option
                    • Enum-spec
                    • Declor-option
                    • Const
                    • Block-item
                    • Hex-quad
                    • Eprefix
                    • Const-expr
                    • Oct-escape
                    • Inc/dec-op
                    • Fun-spec
                    • Dec-expo
                    • Cprefix-option
                    • Asm-name-spec-option
                    • Amb?-decl/stmt
                    • S-char
                    • Isuffix-option
                    • Genassoc
                    • Fsuffix-option
                    • Fconst
                    • Eprefix-option
                    • Dec-expo-option
                    • Cprefix
                    • C-char
                    • Type-spec-option
                    • Sign-option
                    • Sign
                    • Q-char
                    • Iconst-option
                    • H-char
                    • Fundef-option
                    • Asm-output
                    • Asm-input
                    • Designor
                    • Const-option
                    • Usuffix
                    • Univ-char-name
                    • Hprefix
                    • Enumer
                    • Attrib-name
                    • Transunit
                    • Asm-qual
                    • Typequal/attribspec
                    • Stringlit
                    • Dec-expo-prefix
                    • Bin-expo-prefix
                    • Header-name
                    • Cconst
                    • Expr/tyname
                    • Decl/stmt
                    • Declor/absdeclor
                    • Asm-clobber
                    • Typequal/attribspec-list
                    • Decl-spec-list
                    • Stringlit-list
                    • Spec/qual-list
                    • Inc/dec-op-list
                    • Desiniter-list
                    • Attrib-spec-list
                    • S-char-list
                    • Q-char-list
                    • Param-declon-list
                    • H-char-list
                    • Decl-list
                    • C-char-list
                    • Typequal/attribspec-list-list
                    • Struct-declor-list
                    • Struct-declon-list
                    • Initdeclor-list
                    • Genassoc-list
                    • Extdecl-list
                    • Block-item-list
                    • Enumer-list
                    • Ident-list
                    • Filepath-transunit-map
                    • Expr-list
                    • Asm-qual-list
                    • Asm-output-list
                    • Asm-input-list
                    • Asm-clobber-list
                    • Type-spec-list
                    • Stor-spec-list
                    • Ident-set
                    • Ident-option-set
                    • Ident-list-list
                    • Eprefix-option-list
                    • Designor-list
                    • Attrib-list
                  • Abstract-syntax-irrelevants
                  • Type-specifier-lists
                  • Ascii-identifiers
                  • Abstraction-mapping
                  • Standard
                  • Storage-specifier-lists
                  • Code-ensembles
                  • Purity
                  • Make-self-code-ensemble
                • Concrete-syntax
                • Disambiguation
                • Validation
                • Gcc-builtins
                • Preprocessing
                • Parsing
              • Atc
              • Transformation-tools
              • Language
              • Representation
              • Insertion-sort
              • Pack
            • Soft
            • Bv
            • Imp-language
            • Ethereum
            • Event-macros
            • Java
            • Riscv
            • Bitcoin
            • Zcash
            • Yul
            • ACL2-programming-language
            • Prime-fields
            • Json
            • Syntheto
            • File-io-light
            • Cryptography
            • Number-theory
            • Axe
            • Lists-light
            • Builtins
            • Solidity
            • Helpers
            • Htclient
            • Typed-lists-light
            • Arithmetic-light
          • X86isa
          • Axe
          • Execloader
        • Math
        • Testing-utilities
      • Align-spec

      Align-spec-case

      Case macro for the different kinds of align-spec structures.

      This is an ACL2::fty sum-type case macro, typically introduced by fty::defflexsum or fty::deftagsum. It allows you to safely check the type of a align-spec structure, or to split into cases based on its type.

      Short Form

      In its short form, align-spec-case allows you to safely check the type of a align-spec structure. For example:

      (align-spec-case x :alignas-type)

      is essentially just a safer alternative to writing:

      (equal (align-spec-kind x) :alignas-type)

      Why is using align-spec-case safer? When we directly inspect the kind with equal, there is no static checking being done to ensure that, e.g., :alignas-type is a valid kind of align-spec structure. That means there is nothing to save you if, later, you change the kind keyword for this type from :alignas-type to something else. It also means you get no help if you just make a typo when writing the :alignas-type symbol. Over the course of developing VL, we found that such issues were very frequent sources of errors!

      Long Form

      In its longer form, align-spec-case allows you to split into cases based on the kind of structure you are looking at. A typical example would be:

      (align-spec-case x
        :alignas-type ...
        :alignas-expr ...
        :alignas-ambig ...)

      It is also possible to consolidate ``uninteresting'' cases using :otherwise.

      For convenience, the case macro automatically binds the fields of x for you, as appropriate for each case. That is, in the :alignas-type case, you can use fty::defprod-style foo.bar style accessors for x without having to explicitly add a alignas-type b* binder.