Re: wxWidgets 2.9 build

Поиск
Список
Период
Сортировка
От Peter Geoghegan
Тема Re: wxWidgets 2.9 build
Дата
Msg-id AANLkTikqkszdv+KN62R-uN4yeRUZ8i_O1b8j9NDs9jOo@mail.gmail.com
обсуждение исходный текст
Ответ на Re: wxWidgets 2.9 build  (Peter Geoghegan <peter.geoghegan86@gmail.com>)
Ответы Re: wxWidgets 2.9 build  (Dave Page <dpage@pgadmin.org>)
Список pgadmin-hackers
I now use c_str() for logging variadics without casting, extending wx
logging in a way that provides the same interface as the existing 2.8
code.

There are still two areas where we still cast for variadics, where I
didn't want to copy the black magic that wx does to make the proxy
passable. Here's one:

            report->XmlAddSectionTableRow(section,
                            column->GetColNumber(),
                            6,
                            (const wxChar*) colName,
                            (const wxChar*) column->GetVarTypename(),
                            (const wxChar*) BoolToYesNo(column->GetNotNull()),
                            (const wxChar*) BoolToYesNo(column->GetIsPK()),
                            (const wxChar*) column->GetDefault(),
                            (const wxChar*) column->GetComment());

I think that to copy the wx technique verbatim would be a net gain in
ugliness, because we're currently simply naive clients of it.

I've performed the changes to overloads of sysSettings::Write() and
ctlListView::AppendItem() already discussed.

Now, sysLogger.h looks like this:

#define wxLOG_Notice (wxLOG_User+1)
#define wxLOG_Sql (wxLOG_User+2)
#define wxLOG_QuietError (wxLOG_User+3)
#define wxLOG_Script (wxLOG_User+4)
#define wxLOG_ScriptVerbose (wxLOG_User+5)

#if wxCHECK_VERSION(2, 9, 0)

#define wxLogNotice wxDO_LOG(Notice)
#define wxLogSql wxDO_LOG(Sql)
#define wxLogQuietError wxDO_LOG(QuietError)
#define wxLogScript wxDO_LOG(Script)
#define wxLogScriptVerbose wxDO_LOG(ScriptVerbose)

#else
#define DECLARE_INT_LOG_FUNCTION(level)                                  \
extern void wxVLog##level(const wxChar *szFormat, va_list argptr);       \
extern void wxLog##level(const wxChar *szFormat, ...) ATTRIBUTE_PRINTF_1

DECLARE_INT_LOG_FUNCTION(Notice);
*** SNIP*** // same as before
#endif

This works fine for client TUs. However, sysLogger.cpp doesn't compile
on 2.9 . I don't know why we've provided implementations of various
logger functions there. What do you think? I've attached a patch of my
latest revisions so you can take a look yourself.

By the way, reading 2.9 log.h I learned something about the "ambiguous
else" warnings:

//       work as expected, without it the second "else" would match the "if"
//       inside wxLogError(). Unfortunately code like
//
//          if ( cond )
//              wxLogError("!!!");
//
//       now provokes "suggest explicit braces to avoid ambiguous 'else'"
//       warnings from g++ 4.3 and later with -Wparentheses on but they can be
//       easily fixed by adding curly braces around wxLogError() and at least
//       the code still does do the right thing.

I'm not sure that your suggestion about the cstr() macro is a win, but
if we do it I feel that it should be an inline function.

--
Regards,
Peter Geoghegan

Вложения

В списке pgadmin-hackers по дате отправления:

Предыдущее
От: Dave Page
Дата:
Сообщение: Re: wxWidgets 2.9 build
Следующее
От: Dave Page
Дата:
Сообщение: pgAdmin III commit: Phase 1 of our wxWidgets 2.9 compatibility. For mor