Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ TheIDE » U++ TheIDE: Packages » Add/Remove flags disfunction [BUG?]
Add/Remove flags disfunction [BUG?] [message #36414] Thu, 24 May 2012 22:05 Go to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Hi,

I hit a weird behavior of the "Add/Remove flags" feature of the Package organizer. It seems totally broken to me Smile

I vaguely remember it used to work well, but now I wasn't able to add any flag no matter how many ways I tried. I even tried to look in the code of theide, tracked down all functions that manipulate with the flag variable after reading it from upp file, but I couldn't spot any place where it would be applied. Am I missing something really badly, or did this just quietly disappear from theide?

Simplistic testcase: Let's have a file
#test.cpp
#ifndef flagGUI
	#error "GUI is undefined"
#endif
#ifndef flagPOSIX
	#error "POSIX is undefined"
#endif
#ifndef flagTEST_GUI
	#error "TEST_GUI is undefined"
#endif
#ifndef flagTEST_POSIX
	#error "TEST_POSIX is undefined"
#endif
int main(){}

in a package defined by
flags(GUI) TEST_GUI;

flags(POSIX) TEST_POSIX;

file
	test.cpp;

mainconfig
	"" = "GUI";
I would expect it to pass the compilation, but what I get is
Quote:

----- flagtest ( GUI MAIN GCC DEBUG SHARED DEBUG_FULL BLITZ LINUX POSIX )
cd /home/h/MyApps/flagtest
test.cpp
c++ -c -I"/home/h/MyApps" -I"/home/h/upp.sandbox" -I"/home/h/upp-production/uppsrc" -I"/usr/include/freetype2" -I"
/usr/include/gtk-2.0" -I"/usr/include/glib-2.0" -I"/usr/lib/glib-2.0/include" -I"/usr/lib/gtk-2.0/include" -I"/
usr/include/cairo" -I"/usr/include/pango-1.0" -I"/usr/include/atk-1.0" -I"/usr/X11R6/include" -I"/usr/X11R6/inc
lude/freetype2" -I"/usr/X11R6/include/gtk-2.0" -I"/usr/X11R6/include/glib-2.0" -I"/usr/X11R6/lib/glib-2.0/inclu
de" -I"/usr/X11R6/lib/gtk-2.0/include" -I"/usr/X11R6/include/cairo" -I"/usr/X11R6/include/pango-1.0" -I"/usr/X1
1R6/include/atk-1.0" -I"/usr/include/c++/4.6.1" -I"/usr/include/c++/4.6.1/i686-pc-linux-gnu" -I"/usr/include/we
bkit-1.0" -I"/usr/include/libsoup-2.4" -I"/usr/include/libxml2" -I"/usr/include/gdk-pixbuf-2.0" -I"/usr/include
/webkit-1.0" -I"/usr/include/opencv" -DflagGUI -DflagMAIN -DflagGCC -DflagDEBUG -DflagSHARED -DflagDEBUG_FULL -
DflagBLITZ -DflagLINUX -DflagPOSIX -DbmYEAR=2012 -DbmMONTH=5 -DbmDAY=24 -DbmHOUR=21 -DbmMINUTE=59 -DbmSECOND=45
-ggdb -g2 -fexceptions -D_DEBUG -O0 -fno-PIC -x c++ "/home/h/MyApps/flagtest/test.cpp" -o "/home/h/.upp/_ou
t/MyApps/flagtest/GCC.Debug.Debug_Full.Gui.Main.Shared/test. o "
compiled in (0:00.08)
/home/h/MyApps/flagtest/test.cpp:8:3: error: #error "TEST_GUI is undefined"
/home/h/MyApps/flagtest/test.cpp:11:3: error: #error "TEST_POSIX is undefined"

I see the same problem on both Linux with gcc and windows with MSC. For windows of course use WIN32 instead of POSIX Wink

Best regards,
Honza
Re: Add/Remove flags disfunction [BUG?] [message #36455 is a reply to message #36414] Mon, 28 May 2012 18:36 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
RM patch applied...
Re: Add/Remove flags disfunction [BUG?] [message #42497 is a reply to message #36414] Wed, 19 March 2014 20:24 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
Still doesn't seem to work........
or again (6813)

[Updated on: Wed, 19 March 2014 20:25]

Report message to a moderator

Re: Add/Remove flags disfunction [BUG?] [message #42499 is a reply to message #42497] Thu, 20 March 2014 00:46 Go to previous messageGo to next message
omari is currently offline  omari
Messages: 264
Registered: March 2010
Experienced Member
Hi,

there is a set of flags added in "ide/Core/Host.cpp"
this flags is defined at theide compile time, regardless of the current configuration.

void LocalHost::AddFlags(Index<String>& cfg)
{
#if   defined(PLATFORM_WIN32)
	cfg.Add("WIN32");
#endif

#ifdef PLATFORM_LINUX
	cfg.Add("LINUX");
#endif

#ifdef PLATFORM_POSIX
	cfg.Add("POSIX");
#endif

...


if theide is compiled under Linux, then the flags LINUX and POSIX are always defined, even with a build method that define WIN32 only (for example).

this methode is called in "ide/Builders/Build.cpp",

Index<String> MakeBuild::PackageConfig(const Workspace& wspc, int package,
                                 const VectorMap<String, String>& bm, String mainparam,
                                 Host& host, Builder& b, String *target)
{

...
	host.AddFlags(cfg);
	b.AddFlags(cfg);
...



Hope it helps!

best regards

omari.


regards
omari.
Re: Add/Remove flags disfunction [BUG?] [message #42508 is a reply to message #36414] Thu, 20 March 2014 09:52 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
That is expected behaviour, but today I see (again?) what Honza described in this thread in may 2012 and what was reported to be fixed.
Re: Add/Remove flags disfunction [BUG?] [message #42511 is a reply to message #36414] Thu, 20 March 2014 18:00 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
Ok, I narrowed it down a bit.
There seems to be a problem when more than 1 flag is added in the same line. I added the portaudio package to a random project and hit compile without adding any extra flags to the main configuration.
On windows with msc9 this gives a warning "unrecognized sourfile type WASAPI" because the second flag WASAPI is passed directly to the compiler. On linux it generates an error, not a warning.

See attached picture.
  • Attachment: portaudio.PNG
    (Size: 196.07KB, Downloaded 321 times)
Re: Add/Remove flags disfunction [BUG?] [message #42512 is a reply to message #36414] Thu, 20 March 2014 18:19 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
Also putting a dot before a flag in the main package doesn't work properly.

it results in " -Dflag.WMME" for example
Re: Add/Remove flags disfunction [BUG?] [message #42513 is a reply to message #42511] Thu, 20 March 2014 19:13 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Alboni wrote on Thu, 20 March 2014 18:00

Ok, I narrowed it down a bit.
There seems to be a problem when more than 1 flag is added in the same line. I added the portaudio package to a random project and hit compile without adding any extra flags to the main configuration.

Hi Alboni,

It seems that this particular thing was never supported by TheIDE Smile I must have overlook it, when I was writing the portaudio plugin... But it is I think it is a good feature to have, so I'll try to create a patch.

I haven't yet looked at the other issue with dotted flags, but I'm sure that it used to work. So I'll try to fix that as well, if it is broken.

Best regards,
Honza
Re: Add/Remove flags disfunction [BUG?] [message #42514 is a reply to message #42513] Thu, 20 March 2014 19:27 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Ok,I'm blind... Rolling Eyes

Multiple flags (and other options) are supported, but there must be a comma, not space. I will fix it in portaudio, and perhaps other packages where I might have made this mistake...

Honza

PS: Actually, there is a small bug, it doesn't work with comma either, because theide quotes the string... But I guess it doesn't really matter, as it is splitted into two lines when the .upp file is saved after being edited. So it is probably easier and more consistent to write it on separate lines right away..

[Updated on: Thu, 20 March 2014 19:40]

Report message to a moderator

Re: Add/Remove flags disfunction [BUG?] [message #42515 is a reply to message #36414] Thu, 20 March 2014 20:16 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

The flags in portaudio are fixed now.

I can't reproduce the problem with dotted flags (using latest nightly version of theide). Alboni, can you please describe your actions in greater detail or post example package?

Honza
Re: Add/Remove flags disfunction [BUG?] [message #42516 is a reply to message #36414] Thu, 20 March 2014 20:32 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
Ok. I'll update to the newest first. No sense in debugging older version.
Re: Add/Remove flags disfunction [BUG?] [message #42517 is a reply to message #36414] Thu, 20 March 2014 21:26 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
ok, here a test with a dot
  • Attachment: flagtest1.PNG
    (Size: 143.67KB, Downloaded 284 times)
Re: Add/Remove flags disfunction [BUG?] [message #42518 is a reply to message #36414] Thu, 20 March 2014 21:33 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
And here with 2 flags seperated by a comma

(TheIde 7063)
  • Attachment: flagtest2.PNG
    (Size: 170.96KB, Downloaded 297 times)
Re: Add/Remove flags disfunction [BUG?] [message #42519 is a reply to message #36414] Thu, 20 March 2014 21:36 Go to previous messageGo to next message
Alboni is currently offline  Alboni
Messages: 214
Registered: January 2012
Location: Deventer, Netherlands
Experienced Member
example package here
  • Attachment: flagtest.zip
    (Size: 1.13KB, Downloaded 273 times)
Re: Add/Remove flags disfunction [BUG?] [message #42520 is a reply to message #42517] Thu, 20 March 2014 21:56 Go to previous messageGo to next message
dolik.rce is currently offline  dolik.rce
Messages: 1789
Registered: August 2008
Location: Czech Republic
Ultimate Contributor

Alboni wrote on Thu, 20 March 2014 21:26

ok, here a test with a dot

Ok, I see it now Smile I mistakenly thought that you were adding it in to the 'mainconf', but you try to make it work in Add/Remove flags... That is not supported at the moment, but thinking about it, it would be good. It doesn't look trivial to implement, though, so it'll probably take me some time.

Regarding the issue with two flags separated by comma: TheIDE eagerly quotes the string, saving it as
flags(WHEN) "FLAG1,FLAG2"
If you manually edit it to remove the quotes, like:
flags(WHEN) FLAG1,FLAG2
then the code actually works Smile Unfortunately, the code that writes and reads this is used across multiple other options (link flags, uses, targets etc.) where the quoting is necessary. Another issue with this is that the code that saves the additional flags breaks it apart and saves it into two separate lines as soon as you do any changes in the .upp file. So it is probably easier to just add multiple lines... But I'll try to think of some simple way to make it work anyways, perhaps it'll be possible without duplicating too much code.

Honza
Re: Add/Remove flags disfunction [BUG?] [message #42910 is a reply to message #36414] Mon, 14 April 2014 10:37 Go to previous messageGo to next message
piotr5 is currently offline  piotr5
Messages: 107
Registered: November 2005
Experienced Member
imho the ide interface should parse the user-input and actually split comma-seperated flags into multiple entries, automatically.
Re: Add/Remove flags disfunction [BUG?] [message #43727 is a reply to message #42910] Sat, 27 September 2014 18:11 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
ide now does not allow ',' in the Add/Remove flags, you can separate flags by space (which is now supported). You can now also use prefix '-' to remove the flag (for some reason, Remove flags never worked before...)
Previous Topic: howto delete/remove main package?
Next Topic: Project folders recognized & listed in U++ startup list, stay organized
Goto Forum:
  


Current Time: Thu Mar 28 11:31:56 CET 2024

Total time taken to generate the page: 0.01231 seconds