Commit d108e33053 for aom

commit d108e33053018529cec5ac6084109660b10f39d8
Author: Wan-Teh Chang <wtc@google.com>
Date:   Sun Mar 29 19:30:33 2026 -0700

    Enable the ISO C11 standard

    C11 allows us to use static_assert().

    The public headers should remain C99.

    Change-Id: I6f30741a9ff6bef694529792dbe3eb85caf58273

diff --git a/apps/aomenc.c b/apps/aomenc.c
index d176812043..c2b7d95f40 100644
--- a/apps/aomenc.c
+++ b/apps/aomenc.c
@@ -959,13 +959,9 @@ static int parse_stream_params(struct AvxEncoderConfig *global,
   } else if (strcmp(get_short_name_by_aom_encoder(global->codec), "av1") == 0) {
     // TODO(jingning): Reuse AV1 specific encoder configuration parameters.
     // Consider to expand this set for AV1 encoder control.
-#if __STDC_VERSION__ >= 201112L
-    _Static_assert(NELEMENTS(av1_ctrl_args) == NELEMENTS(av1_arg_ctrl_map),
-                   "The av1_ctrl_args and av1_arg_ctrl_map arrays must be of "
-                   "the same size.");
-#else
-    assert(NELEMENTS(av1_ctrl_args) == NELEMENTS(av1_arg_ctrl_map));
-#endif
+    static_assert(NELEMENTS(av1_ctrl_args) == NELEMENTS(av1_arg_ctrl_map),
+                  "The av1_ctrl_args and av1_arg_ctrl_map arrays must be of "
+                  "the same size.");
     ctrl_args = av1_ctrl_args;
     ctrl_args_map = av1_arg_ctrl_map;
     key_val_args = av1_key_val_args;
diff --git a/av1/av1_cx_iface.c b/av1/av1_cx_iface.c
index 6c7e1f6fac..f9adad4099 100644
--- a/av1/av1_cx_iface.c
+++ b/av1/av1_cx_iface.c
@@ -4335,16 +4335,9 @@ static aom_codec_err_t encoder_set_option(aom_codec_alg_priv_t *ctx,
   size_t len = strlen(name) + strlen(value) + 4;
   char *const err_string = ctx->ppi->error.detail;

-#if __STDC_VERSION__ >= 201112L
-  // We use the keyword _Static_assert because clang-cl does not allow the
-  // convenience macro static_assert to be used in function scope. See
-  // https://bugs.llvm.org/show_bug.cgi?id=48904.
-  _Static_assert(sizeof(ctx->ppi->error.detail) >= ARG_ERR_MSG_MAX_LEN,
-                 "The size of the err_msg buffer for arg_match_helper must be "
-                 "at least ARG_ERR_MSG_MAX_LEN");
-#else
-  assert(sizeof(ctx->ppi->error.detail) >= ARG_ERR_MSG_MAX_LEN);
-#endif
+  static_assert(sizeof(ctx->ppi->error.detail) >= ARG_ERR_MSG_MAX_LEN,
+                "The size of the err_msg buffer for arg_match_helper must be "
+                "at least ARG_ERR_MSG_MAX_LEN");

   argv[0] = aom_malloc(len * sizeof(argv[1][0]));
   if (!argv[0]) return AOM_CODEC_MEM_ERROR;
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index b34748d335..8ab58f1794 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -311,7 +311,8 @@ endif()

 # Test compiler flags.
 if(MSVC)
-  # It isn't possible to specify C99 conformance for MSVC.
+  # C11 conformance is available starting in Visual Studio 2019 version 16.8.
+  require_c_flag("/std:c11" YES)
   add_cxx_flag_if_supported("/std:c++17")
   add_compiler_flag_if_supported("/W3")

@@ -324,7 +325,7 @@ if(MSVC)
   # Compile source files in parallel
   add_compiler_flag_if_supported("/MP")
 else()
-  require_c_flag("-std=c99" YES)
+  require_c_flag("-std=c11" YES)
   if(CYGWIN AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
     # The GNU C++ compiler in Cygwin needs the -std=gnu++* flag to make the
     # POSIX function declarations visible in the Standard C Library headers.