Fixes the issue left after 0002 patch. This patch does the following things.
1. Change completion_charp from const char * to PQExpBuffer.
2. Chnage COMPLETE_WITH_QUERY and COMPLETE_WITH_ATTR to accept an expression instead of string literal.
3. Replace all additional keyword lists in psql_copmletion with ADDLISTn() expression.
At Fri, 01 Apr 2016 11:52:03 +0900 (Tokyo Standard Time), Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp> wrote in <20160401.115203.98896697.horiguchi.kyotaro@lab.ntt.co.jp> > > > > I found new warning > > > > > > > > tab-complete.c:1438:87: warning: right-hand operand of comma expression > > > > has no effect [-Wunused-value] > > > > > > Mmm. Google said me that gcc 4.9 does so. I'm using 4.8.5 so I > > > haven't see the warning. > > > > > > https://gcc.gnu.org/gcc-4.9/porting_to.html > > > > > > 1436: else if (HeadMatches2("CREATE", "SCHEMA") && > > > 1437: SHIFT_TO_LAST1("CREATE") && > > > 1438: false) {} /* FALL THROUGH */ ... > > > But the right hand value (true) is actually "used" in the > > > expression (even though not effective). Perhaps (true && false) > > > was potimized as false and the true is regarded to be unused? > > > That's stupid.. Using functions instead of macros seems to solve > > > this but they needed to be wraped by macros as > > > additional_kw_query(). That's a pain.. ... > This needs to use gcc 4.9 to address, but CentOS7 doesn't have > devtools-2 repo so now I'm building CentOS6 environment for this > purpose. Please wait for a while.
Finally I settled it by replacing comma expression with logical OR or AND expresssion. gcc 4.9 compains for some unused variables in flex output but it is the another issue.
I forgot to address COMPLETE_WITH_ATTTR but it needed an overhaul of some macros and changing the type of completion_charp. The third patch does it but it might be unacceptable..
something is wrong, autocomplete for CREATE TABLE IF NOT EXISTS doesn't work
Regards
Pavel
regards,
-- Kyotaro Horiguchi NTT Open Source Software Center