Re: wxWidgets 2.9 build

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: Guillaume Lelarge <guillaume(at)lelarge(dot)info>, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: wxWidgets 2.9 build
Date: 2011-01-16 18:47:54
Message-ID: AANLkTi=Sdyxhc8u+Ggms5h=QsEtC+srm-w7wTg0DtYrr@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

On 15 January 2011 21:26, Dave Page <dpage(at)pgadmin(dot)org> wrote:
> The switch from carbon to cocoa shouldn't require any effort - thats
> the work the wxWidgets guys have done.

Sure, but I would have imagined that there might be one or two small
things to clean up.

I've whittled down the amount of output from make to a mere 250kb.
Now, most translation units compile:

[peter(at)localhost pgadmin]$ ls *.o
ctlCheckTreeView.o dlgRule.o gqbView.o
pgFunction.o pgsNegate.o
ctlCodeWindow.o dlgSchedule.o
gqbViewPanels.o pgGroup.o pgsNot.o
ctlColourPicker.o dlgSchema.o keywords.o
pgIndexConstraint.o pgsNumberGen.o
ctlComboBox.o dlgSelectDatabase.o lex.pgs.o
pgLanguage.o pgsNumber.o
ctlDefaultSecurityPanel.o dlgSequence.o macros.o
pgOperatorClass.o pgsObjectGen.o
ctlMenuToolbar.o dlgServer.o mapm5sin.o
pgOperatorFamily.o pgsOperation.o
ctlMessageWindow.o dlgStep.o mapm_add.o
pgOperator.o pgsOr.o
ctlResultGrid.o dlgSynonym.o mapmasin.o
pgRule.o pgsOver.o
ctlSecurityPanel.o dlgTable.o mapmasn0.o
pgsAlloc.o pgsParameterException.o
ctlSQLGrid.o dlgTablespace.o mapmcbrt.o
pgsAnd.o pgsParenthesis.o
ctlSQLResult.o dlgTextSearchConfiguration.o mapmcnst.o
pgsArithmeticException.o pgsPlus.o
ctlStackWindow.o dlgTextSearchDictionary.o mapm_cpi.o
pgsAssertException.o pgsPrintStmt.o
ctlTabWindow.o dlgTextSearchParser.o mapm_div.o
pgsAssertStmt.o pgsProgram.o
ctlTree.o dlgTextSearchTemplate.o mapm_exp.o
pgsAssign.o pgsRealGen.o
ctlVarWindow.o dlgTrigger.o mapmfact.o
pgsAssignToRecord.o pgsRecord.o
dbgBreakPoint.o dlgType.o mapm_fam.o
pgsBreakException.o pgsRemoveLine.o
dbgDbResult.o dlgUser.o mapm_fft.o
pgsBreakStmt.o pgsStmtList.o
dbgPgThread.o edbPackageFunction.o mapm_flr.o
pgsCastException.o pgsStmt.o
dbgResultset.o edbPackage.o mapmfmul.o
pgsCast.o pgsStringGen.o
dbgTargetInfo.o edbPackageVariable.o mapm_fpf.o
pgSchema.o pgsString.o
debugger.o edbPrivateSynonym.o mapm_gcd.o
pgsColumns.o pgsThread.o
dlgAddFavourite.o edbSynonym.o mapmgues.o
pgsContinueException.o pgsTimeGen.o
dlgAggregate.o events.o mapmhasn.o
pgsContinueStmt.o pgsTimes.o
dlgCast.o factory.o mapmhsin.o
pgsDateGen.o pgsTrim.o
dlgCheck.o favourites.o mapmipwr.o
pgsDateTimeGen.o pgsUtilities.o
dlgClasses.o frmAbout.o mapmistr.o
pgsDeclareRecordStmt.o pgsVariable.o
dlgColumn.o frmBackupGlobals.o mapm_lg2.o
pgsDifferent.o pgsWhileStmt.o
dlgConnect.o frmBackup.o mapm_lg3.o
pgsDriver.o pgTable.o
dlgConversion.o frmBackupServer.o mapm_lg4.o
pgsEqual.o pgTablespace.o
dlgDatabase.o frmConfig.o mapm_log.o
pgSequence.o pgTextSearchConfiguration.o
dlgDirectDbg.o frmDebugger.o mapm_mul.o
pgServer.o pgTextSearchDictionary.o
dlgDomain.o frmExport.o mapm_pow.o
pgSet.o pgTextSearchParser.o
dlgEditGridOptions.o frmGrantWizard.o mapmpwr2.o
pgsException.o pgTextSearchTemplate.o
dlgFindReplace.o frmMain.o mapm_rcp.o
pgsExecute.o pgTrigger.o
dlgForeignKey.o frmMaintenance.o mapm_rnd.o
pgsExpression.o pgType.o
dlgFunction.o frmOptions.o mapmrsin.o
pgsExpressionStmt.o pgUser.o
dlgGroup.o frmPassword.o mapm_set.o
pgsGenDate.o pgView.o
dlgHbaConfig.o frmRestore.o mapm_sin.o
pgsGenDateTime.o plugins.o
dlgIndexConstraint.o frmSplash.o mapmsqrt.o
pgsGenDictionary.o registry.o
dlgIndex.o gpExtTable.o mapmstck.o
pgsGenerator.o slCluster.o
dlgJob.o gpPartition.o mapmutil.o
pgsGenInt.o slListen.o
dlgLanguage.o gpResQueue.o mapmutl1.o
pgsGenReal.o slNode.o
dlgMainConfig.o gqbArrayCollection.o mapmutl2.o
pgsGenReference.o slPath.o
dlgManageFavourites.o gqbBrowser.o misc.o
pgsGenRegex.o slSequence.o
dlgManageMacros.o gqbCollection.o pgAggregate.o
pgsGenString.o slSubscription.o
dlgOperator.o gqbColumn.o pgaJob.o
pgsGenTime.o slTable.o
dlgPackage.o gqbController.o pgaSchedule.o
pgsGreaterEqual.o sysLogger.o
dlgPgpassConfig.o gqbDatabase.o pgaStep.o
pgsGreater.o sysProcess.o
dlgProperty.o gqbGraphSimple.o pgCast.o
pgsIdent.o sysSettings.o
dlgReassignDropOwned.o gqbGridJoinTable.o
pgCatalogObject.o pgsIdentRecord.o tabcomplete.o
dlgRepListen.o gqbGridOrderTable.o pgCheck.o
pgsIfStmt.o utffile.o
dlgRepNode.o gqbGridProjTable.o
pgCollection.o pgsIntegerGen.o xh_calb.o
dlgRepPath.o gqbGridRestTable.o pgColumn.o
pgsInterruptException.o xh_ctlchecktreeview.o
dlgRepProperty.o gqbModel.o
pgConstraints.o pgsLines.o xh_ctlcolourpicker.o
dlgRepSequence.o gqbObjectCollection.o
pgConversion.o pgsLowerEqual.o xh_ctlcombo.o
dlgRepSet.o gqbObject.o pgDatabase.o
pgsLower.o xh_ctltree.o
dlgRepSubscription.o gqbQueryObjs.o pgDatatype.o
pgsMapm.o xh_sqlbox.o
dlgRepTable.o gqbSchema.o pgDomain.o
pgsMinus.o xh_timespin.o
dlgRole.o gqbTable.o
pgForeignKey.o pgsModulo.o xrcDialogs.o

The main culprit that breaks compatibility here seems to be multiple
conversion operators in wxString, in particular the addition of a new
operator const void*(). This is apparently used as a hack to get
greater type safety by creating an ambiguity that prevents code from
compiling that relies on questionable implicit casts. If I came up
with this, I definitely would have called it "the three stooges
idiom". Conversion operators are a bit frowned upon, and it seems a
bit strange that wxString has both a conversion operator and a
std::string style c_str() (in fact, multiple variants of both), but I
guess it's a legacy thing.

Why does sysSettings::Write(const wxString&, const wxChar*) take a
const wxChar* as its second argument rather than just a wxString? I'm
inclined to just use a const wxString&, and avoid c strings if at all
possible, which resolves the ambiguity in various places. Obviously we
can't have null references, so I'm going to write workarounds where
that was possible before, where there might have been different
codepaths for NULL and so on.

I'm changing our use of wxCalendarCtrl to wxGenericCalendarCtrl where
required but not where unavailable. We won't get 2.9's new native GTK
calendar controls on that platform, but I don't suppose it matters too
much. Nothing changes, and nothing is broken. If we could afford to
have the GTK calendar, it wouldn't have broken our code, because its
interface is a subset of the old wxCalendarCtrl/current
wxGenericCalendarCtrl interface. I'll write a typedef called
wxCompatCalendar for either wxCalendarCtrl or wxGenericCalendarCtrl,
depending on a preprocessor macro wxCHECK_VERSION(2, 9, 0) that
indicates Wx version is 2.9+. This is sort of like WxChar (which can
be char or wchar_t, depending on whether or not we're doing a unicode
build or an ANSI build). I'm still working on this.

in pgsDictionaryGen.cpp, why do we do this?:

wxString line;
while ((line = text.ReadLine()) && !input.Eof())
{
++result;
}

We used to implicitly cast to WxChar*, but the ambiguity now occurs.
It looks like the three stooges idiom has worked in our favour here.
This piece of code looks broken, like someone has made the classic
mistake of using an assignment operator in place of a comparison
operator . Please comment.

I saw see lots and lots of errors like this:

../pgadmin/include/utils/sysLogger.h:52:1: error: expected initializer
before ‘ATTRIBUTE_PRINTF_1’

ATTRIBUTE_PRINTF_1 isn't #define'd. It's called WX_ATTRIBUTE_PRINTF_1
is 2.9, so I've written a new macro called COMPAT_ATTRIBUTE_PRINTF_1
that is conditionally #define'd as either variant.

I'm going to go out now. I'll take another look tomorrow. It looks
like supporting both 2.8 and 2.9 is quite possible.

--
Regards,
Peter Geoghegan

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2011-01-16 22:39:39 Re: wxWidgets 2.9 build
Previous Message Dave Page 2011-01-15 21:26:57 Re: wxWidgets 2.9 build