• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
        • Syntax-for-tools
          • Formalized-subset
          • Mapping-to-language-definition
          • Input-files
          • Compilation-database
            • Comp-db-entry
            • Comp-db-arg
            • Json-to-comp-db-entry
            • Json-to-comp-db-entry-list
            • To-preprocess-db
            • To-preprocess-map
            • Comp-db-arguments-absolute-dirs
            • Comp-db-keep-only-preprocessor-args
              • Json-to-comp-db
              • Json-to-comp-db-arguments
              • Comp-db-relativize-keys
              • Json-to-comp-db-get-exec-and-arguments
              • Preprocess-map-from-comp-file
              • Json-to-comp-db-exec-and-arguments
              • Relativize-path
              • Comp-db-arguments-keep-only-preprocessor-args
              • Comp-db-arguments-escape-for-shell
              • Parse-comp-db
              • Json-to-comp-db-get-directory
              • Json-to-comp-db-get-output
              • Json-to-comp-db-get-file
              • Comp-db-drop-shared
              • Comp-db-drop-non-c
              • Comp-db-arg-list-to-string-list
              • Comp-db-absolute-dirs
              • Comp-db-escape-for-shell
              • Json-to-comp-db-try-parse-short-option
              • Preprocess-db-to-map
              • Comp-db-arg-to-string
              • Comp-db
              • Json-to-comp-db-try-parse-equal-arg
              • Defpreprocess-map-fn
              • String-escape-for-shell
              • Comp-db-arg-list
              • Irr-comp-db-arg
              • Show-warnings
              • *cc-options-space-sep*
              • *cc-options-equal-sep*
              • *cc-options-dir*
            • Printer
            • Output-files
            • Abstract-syntax-operations
            • Implementation-environments
            • Abstract-syntax
            • Concrete-syntax
            • Disambiguation
            • Validation
            • Gcc-builtins
            • Preprocessing
            • Parsing
          • Atc
          • Transformation-tools
          • Language
          • Representation
          • Insertion-sort
          • Pack
        • Proof-checker-array
        • Soft
        • Farray
        • Rp-rewriter
        • Instant-runoff-voting
        • Imp-language
        • Sidekick
        • Ethereum
        • Leftist-trees
        • Java
        • Riscv
        • Taspi
        • Bitcoin
        • Zcash
        • Des
        • X86isa
        • Sha-2
        • Yul
        • Proof-checker-itp13
        • Regex
        • ACL2-programming-language
        • Json
        • Jfkr
        • Equational
        • Cryptography
        • Axe
        • Poseidon
        • Where-do-i-place-my-book
        • Aleo
        • Bigmems
        • Builtins
        • Execloader
        • Solidity
        • Paco
        • Concurrent-programs
        • Bls12-377-curves
      • Debugging
      • Community
      • Std
      • Proof-automation
      • Macro-libraries
      • ACL2
      • Interfacing-tools
      • Hardware-verification
      • Software-verification
      • Math
      • Testing-utilities
    • Compilation-database

    Comp-db-keep-only-preprocessor-args

    Filter out compilation-database arguments which are disruptive or irrelevant to preprocessing.

    Signature
    (comp-db-keep-only-preprocessor-args db) → db$
    Arguments
    db — Guard (comp-dbp db).
    Returns
    db$ — Type (comp-dbp db$).

    Generally, it seems easier to blacklist arguments which are disruptive to preprocessing than it is to whitelist the preprocessing-relevant arguments. Most flags do not prevent us from preprocessing, and some are surprisingly relevant to preprocessing (fir instance, the -fPIE flag indicates a code-generation strategy, but it also causes two macros to be defined: __pie__ and __PIE__).

    Definitions and Theorems

    Function: comp-db-keep-only-preprocessor-args

    (defun comp-db-keep-only-preprocessor-args (db)
      (declare (xargs :guard (comp-dbp db)))
      (b* ((db (comp-db-fix db))
           ((when (endp db)) nil)
           (file (car (first db)))
           (entry (cdr (first db)))
           (arguments (comp-db-arguments-keep-only-preprocessor-args
                           (comp-db-entry->arguments entry)))
           (entry (change-comp-db-entry entry
                                        :arguments arguments)))
        (acons file entry
               (comp-db-keep-only-preprocessor-args (rest db)))))

    Theorem: comp-dbp-of-comp-db-keep-only-preprocessor-args

    (defthm comp-dbp-of-comp-db-keep-only-preprocessor-args
      (b* ((db$ (comp-db-keep-only-preprocessor-args db)))
        (comp-dbp db$))
      :rule-classes :rewrite)

    Theorem: comp-db-keep-only-preprocessor-args-of-comp-db-fix-db

    (defthm comp-db-keep-only-preprocessor-args-of-comp-db-fix-db
      (equal (comp-db-keep-only-preprocessor-args (comp-db-fix db))
             (comp-db-keep-only-preprocessor-args db)))

    Theorem: comp-db-keep-only-preprocessor-args-comp-db-equiv-congruence-on-db

    (defthm
     comp-db-keep-only-preprocessor-args-comp-db-equiv-congruence-on-db
     (implies (comp-db-equiv db db-equiv)
              (equal (comp-db-keep-only-preprocessor-args db)
                     (comp-db-keep-only-preprocessor-args db-equiv)))
     :rule-classes :congruence)