Skip to content

Commit

Permalink
Fix -Wvla-cxx-extension warning (#1084)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnskvlnk authored Oct 25, 2024
1 parent 03a9bb3 commit 652522d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
8 changes: 4 additions & 4 deletions src/backend/gpopt/translate/CTranslatorUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,8 @@ CTranslatorUtils::ResolvePolymorphicTypes(CMemoryPool *mp,
const ULONG num_args = std::min(num_arg_types, num_args_from_query);
const ULONG total_args = num_args + num_return_args;

OID arg_types[total_args];
char arg_modes[total_args];
std::vector<OID> arg_types(total_args);
std::vector<char> arg_modes(total_args);

// copy the first 'num_args' function argument types
ListCell *arg_type = nullptr;
Expand All @@ -410,8 +410,8 @@ CTranslatorUtils::ResolvePolymorphicTypes(CMemoryPool *mp,
arg_modes[arg_index++] = PROARGMODE_TABLE;
}

if (!gpdb::ResolvePolymorphicArgType(total_args, arg_types, arg_modes,
funcexpr))
if (!gpdb::ResolvePolymorphicArgType(total_args, arg_types.data(),
arg_modes.data(), funcexpr))
{
GPOS_RAISE(
gpdxl::ExmaDXL, gpdxl::ExmiDXLUnrecognizedType,
Expand Down
15 changes: 8 additions & 7 deletions src/backend/gpopt/utils/COptTasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -987,14 +987,15 @@ COptTasks::PrintMissingStatsWarning(CMemoryPool *mp, CMDAccessor *md_accessor,

if (0 < rel_stats->Size())
{
int length = NAMEDATALEN * rel_stats->Size() + 200;
char msgbuf[length];
snprintf(
msgbuf, sizeof(msgbuf),
"One or more columns in the following table(s) do not have statistics: %s",
CreateMultiByteCharStringFromWCString(wcstr.GetBuffer()));
CWStringDynamic msgbuf(mp);
msgbuf.AppendFormat(
GPOS_WSZ_LIT(
"One or more columns in the following table(s) do not have statistics: %ls"),
wcstr.GetBuffer());

GpdbEreport(
ERRCODE_SUCCESSFUL_COMPLETION, NOTICE, msgbuf,
ERRCODE_SUCCESSFUL_COMPLETION, NOTICE,
CreateMultiByteCharStringFromWCString(msgbuf.GetBuffer()),
"For non-partitioned tables, run analyze <table_name>(<column_list>)."
" For partitioned tables, run analyze rootpartition <table_name>(<column_list>)."
" See log for columns missing statistics.");
Expand Down

0 comments on commit 652522d

Please sign in to comment.