ExportXMLWordPrintableJSON

    • Storage Engines - Persistence
    • 175.07
    • None
    • None

      The C Coding Conventions section of AGENTS.md covers comment prose but not flag macros. Agents and new contributors keep writing flags |= mask and ternary forms like:

      flags = dump_all_data ? WT_DEBUG_UNREDACT_ALL : 0;
      flags |= dump_key_data ? WT_DEBUG_UNREDACT_KEYS : 0;
      

      House style is the F_ / FLD_ / LF_* family in src/include/misc.h. For a local flags variable:

      if (dump_all_data)
          LF_SET(WT_DEBUG_UNREDACT_ALL);
      if (dump_key_data)
          LF_SET(WT_DEBUG_UNREDACT_KEYS);
      

      There is no LF_SET_IF. Conditional sets wrap LF_SET in if. Use F_SET/F_CLR/F_ISSET on structure fields, FLD_ on a named field, and the ATOMIC variants when the field is concurrently accessed. Do not write flags |= mask.

      CONTRIBUTING.rst does not spell this out either. Adding a short note under C Coding Conventions in AGENTS.md puts it in every agent session and gives reviewers a written rubric. __wti_debug_page in src/btree/bt_debug.c is a local example of the preferred form.

      Motivation was PR 14740 (WT-17155), which used the ternary form next to an existing LF_SET call in the same file.

            Assignee:
            Sean Watt
            Reporter:
            Sean Watt
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: