• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
      • Gl
      • Esim
      • Vl2014
      • Sv
      • Fgl
      • Vwsim
      • Vl
        • Syntax
        • Loader
          • Preprocessor
            • Vl-iframe
            • Preprocessor-ifdef-minutia
            • Vl-preprocess
            • Vl-preprocess-loop
            • Vl-includeskips
            • Vl-read-until-end-of-define
            • Vl-define-formallist->defaults
            • Vl-define
            • Vl-expand-define
            • Vl-read-include
            • Vl-substitute-into-macro-text
            • Vl-process-ifdef
            • Ppst
            • Vl-read-define-default-text
            • Vl-process-define
            • Preprocessor-include-minutia
            • Vl-trim-for-preproc
            • Vl-line-up-define-formals-and-actuals
            • Vl-process-undef
            • Vl-split-define-text
            • Vl-def-context
            • Vl-process-endif
              • Scan-backward-for-non-whitespace
              • Vl-ifdef-context
              • Scan-backward-for-whitespace
              • Vl-atvl-atts-text
              • Scan-for-non-whitespace
              • Vl-check-remaining-formals-all-have-defaults
              • Vl-process-else
              • Vl-is-compiler-directive-p
              • Vl-includeskips-controller-lookup
              • Vl-ifdef-use-map
              • Vl-defines
              • Vl-def-use-map
              • Vl-nice-bytes
              • Vl-safe-previous-n
              • Vl-safe-next-n
              • Vl-ppst-pad
              • Vl-filename-to-string-literal
              • Vl-maybe-update-filemap
              • *vl-preprocess-clock*
              • Vl-ppst->warnings
              • Vl-ppst->iskips
              • Vl-ppst->ifdefmap
              • Vl-ppst->idcache
              • Vl-istack
              • Vl-ppst->istack
              • Vl-ppst->includes
              • Vl-ppst->filemap
              • Vl-ppst->defmap
              • Vl-ppst->defines
              • Vl-ppst->config
              • Vl-ppst->bytes
              • Vl-ppst->activep
              • Vl-ppst->acc
              • Vl-ppst-record-ifdef-use
              • Vl-ppst-record-def-use
              • Vl-ifdef-context-list
              • Vl-def-context-list
              • Vl-ppst-update-warnings
              • Vl-ppst-update-istack
              • Vl-ppst-update-iskips
              • Vl-ppst-update-includes
              • Vl-ppst-update-ifdefmap
              • Vl-ppst-update-idcache
              • Vl-ppst-update-filemap
              • Vl-ppst-update-defmap
              • Vl-ppst-update-defines
              • Vl-ppst-update-config
              • Vl-ppst-update-activep
              • Vl-ppst-update-bytes
              • Vl-ppst-update-acc
              • Vl-ppst-unsound-nreverse-acc
            • Vl-loadconfig
            • Vl-loadstate
            • Lexer
            • Parser
            • Vl-load-merge-descriptions
            • Vl-find-basename/extension
            • Vl-load-file
            • Vl-loadresult
            • Scope-of-defines
            • Vl-find-file
            • Vl-flush-out-descriptions
            • Vl-description
            • Vl-read-file
            • Vl-includeskips-report-gather
            • Vl-load-main
            • Extended-characters
            • Vl-load
            • Vl-load-description
            • Vl-descriptions-left-to-load
            • Inject-warnings
            • Vl-preprocess-debug
            • Vl-write-preprocessor-debug-file
            • Vl-read-file-report-gather
            • Vl-load-descriptions
            • Vl-load-files
            • Translate-off
            • Vl-load-read-file-hook
            • Vl-read-file-report
            • Vl-loadstate-pad
            • Vl-load-summary
            • Vl-collect-modules-from-descriptions
            • Vl-loadstate->warnings
            • Vl-iskips-report
            • Vl-descriptionlist
          • Warnings
          • Getting-started
          • Utilities
          • Printer
          • Kit
          • Mlib
          • Transforms
        • X86isa
        • Svl
        • Rtl
      • Software-verification
      • Math
      • Testing-utilities
    • Preprocessor

    Vl-process-endif

    Handler for endif directives.

    Signature
    (vl-process-endif loc echars ppst) → (mv successp ppst)
    Arguments
    loc — Guard (vl-location-p loc).
    echars — Characters that come after the `endif, which are used only for multiple-include optimization.
        Guard (vl-echarlist-p echars).
    Returns
    successp — Type (booleanp successp).

    Definitions and Theorems

    Function: vl-process-endif

    (defun vl-process-endif (loc echars ppst)
     (declare (xargs :stobjs (ppst)))
     (declare (xargs :guard (and (vl-location-p loc)
                                 (vl-echarlist-p echars))))
     (let ((__function__ 'vl-process-endif))
      (declare (ignorable __function__))
      (b*
       ((istack (vl-ppst->istack))
        ((when (atom istack))
         (let
           ((ppst (vl-ppst-fatal
                       :msg "~a0: found `endif, but no `ifdef is open."
                       :args (list loc))))
           (mv nil ppst)))
        ((vl-iframe iframe) (car istack))
        (new-istack (cdr istack))
        (new-activep iframe.initially-activep)
        (ppst (vl-ppst-update-istack new-istack))
        (ppst (vl-ppst-update-activep new-activep))
        ((unless iframe.mi-controller)
         (mv t ppst))
        ((unless iframe.mi-filename)
         (raise
          "Programming error: iframe has mi controller but no filename? ~x0"
          iframe)
         (mv t ppst))
        ((unless (equal iframe.mi-filename
                        (vl-location->filename loc)))
         (let
          ((ppst
            (vl-ppst-warn
             :type :vl-warn-include-guard
             :msg
             "~a0: disabling multiple-include optimization ~
                               because the corresponding include guard was found ~
                               in a different file, ~s1.  If this isn't expected, ~
                               there may be a problem with your `ifdef tree."
             :args (list loc iframe.mi-filename))))
          (mv t ppst)))
        (post-ws (vl-skip-whitespace/comments echars))
        ((unless (atom post-ws))
         (let
          ((ppst
            (vl-ppst-warn
             :type :vl-warn-include-guard
             :msg
             "~a0: disabling multiple-include optimization ~
                               because there's content after the `else for ~
                               ~s1."
             :args (list loc iframe.mi-controller))))
          (mv t ppst)))
        (- (cw-unformatted (cat (vl-ppst-pad)
                                " (multi-include confirmed)" *nls*)))
        (iskips (vl-includeskips-install-controller
                     iframe.mi-filename
                     iframe.mi-controller (vl-ppst->iskips)))
        (ppst (vl-ppst-update-iskips iskips)))
       (mv t ppst))))

    Theorem: booleanp-of-vl-process-endif.successp

    (defthm booleanp-of-vl-process-endif.successp
      (b* (((mv ?successp ?ppst)
            (vl-process-endif loc echars ppst)))
        (booleanp successp))
      :rule-classes :type-prescription)