vedgy created this revision. Herald added a subscriber: arphaman. Herald added a project: All. vedgy requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits.
Document one more alternative way to initialize struct CXIndexOptions, which is used in LibclangSetPreambleStoragePathTest since df8f8f76207df40dca11c9c0c2328d6b3dfba9ca <https://reviews.llvm.org/rGdf8f8f76207df40dca11c9c0c2328d6b3dfba9ca> because the previous initialization approach causes compiler warnings. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D145775 Files: clang/include/clang-c/Index.h Index: clang/include/clang-c/Index.h =================================================================== --- clang/include/clang-c/Index.h +++ clang/include/clang-c/Index.h @@ -329,8 +329,8 @@ * Index initialization options. * * 0 is the default value of each member of this struct except for Size. - * Initialize the struct in one of the following two ways to avoid adapting code - * each time a new member is added to it: + * Initialize the struct in one of the following three ways to avoid adapting + * code each time a new member is added to it: * \code * CXIndexOptions Opts; * memset(&Opts, 0, sizeof(Opts)); @@ -340,6 +340,11 @@ * \code * CXIndexOptions Opts = { sizeof(CXIndexOptions) }; * \endcode + * or to prevent the -Wmissing-field-initializers warning for the above version: + * \code + * CXIndexOptions Opts{}; + * Opts.Size = sizeof(CXIndexOptions); + * \endcode */ typedef struct CXIndexOptions { /**
Index: clang/include/clang-c/Index.h =================================================================== --- clang/include/clang-c/Index.h +++ clang/include/clang-c/Index.h @@ -329,8 +329,8 @@ * Index initialization options. * * 0 is the default value of each member of this struct except for Size. - * Initialize the struct in one of the following two ways to avoid adapting code - * each time a new member is added to it: + * Initialize the struct in one of the following three ways to avoid adapting + * code each time a new member is added to it: * \code * CXIndexOptions Opts; * memset(&Opts, 0, sizeof(Opts)); @@ -340,6 +340,11 @@ * \code * CXIndexOptions Opts = { sizeof(CXIndexOptions) }; * \endcode + * or to prevent the -Wmissing-field-initializers warning for the above version: + * \code + * CXIndexOptions Opts{}; + * Opts.Size = sizeof(CXIndexOptions); + * \endcode */ typedef struct CXIndexOptions { /**
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits