Bug 34694 - [Qt] Fix QtLauncher compile on Windows
Summary: [Qt] Fix QtLauncher compile on Windows
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Qt (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Windows 7
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-07 17:55 PST by Ismail Donmez
Modified: 2010-02-09 16:23 PST (History)
3 users (show)

See Also:


Attachments
Use __attribute__ only with gcc (1.02 KB, patch)
2010-02-07 17:55 PST, Ismail Donmez
no flags Details | Formatted Diff | Diff
Use Q_CC_GNU instead of __GNUC__ (1.02 KB, patch)
2010-02-07 22:05 PST, Ismail Donmez
no flags Details | Formatted Diff | Diff
Simplify the ifdef, handle the non-gcc case only (999 bytes, patch)
2010-02-07 22:16 PST, Ismail Donmez
kenneth: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ismail Donmez 2010-02-07 17:55:37 PST
Created attachment 48308 [details]
Use __attribute__ only with gcc

__attribute__ only works with gcc, fix attached.
Comment 1 WebKit Review Bot 2010-02-07 17:58:55 PST
Attachment 48308 [details] did not pass style-queue:

Failed to run "['git', 'reset', '--hard', 'HEAD']" exit_code: 128
fatal: Unable to create '.git/index.lock': File exists.

If no other git process is currently running, this probably means a
git process crashed in this repository earlier. Make sure no other git
process is running and remove the file manually to continue.
fatal: Could not reset index file to revision 'HEAD'.


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 2 Ariya Hidayat 2010-02-07 22:01:29 PST
Comment on attachment 48308 [details]
Use __attribute__ only with gcc

> +#ifdef __GNUC__
> +#define __attribute__(x) __attribute__(x)
> +#else
> +#define __attribute__(x)
> +#endif

Since this is Qt code, how about using Q_CC_GNU?
Comment 3 Ismail Donmez 2010-02-07 22:05:52 PST
Created attachment 48314 [details]
Use Q_CC_GNU instead of __GNUC__
Comment 4 Ismail Donmez 2010-02-07 22:06:36 PST
(In reply to comment #2)
> (From update of attachment 48308 [details])
> > +#ifdef __GNUC__
> > +#define __attribute__(x) __attribute__(x)
> > +#else
> > +#define __attribute__(x)
> > +#endif
> 
> Since this is Qt code, how about using Q_CC_GNU?

Done :)
Comment 5 Shinichiro Hamaji 2010-02-07 22:13:14 PST
I guess we don't need #define for GCC? I think

#ifndef Q_CC_GNU
#define __attribute__(x)
#endif

should work.
Comment 6 Ismail Donmez 2010-02-07 22:16:13 PST
Created attachment 48315 [details]
Simplify the ifdef, handle the non-gcc case only
Comment 7 Ismail Donmez 2010-02-07 22:16:51 PST
(In reply to comment #5)
> I guess we don't need #define for GCC? I think
> 
> #ifndef Q_CC_GNU
> #define __attribute__(x)
> #endif
> 
> should work.

Good catch, done. Thanks.
Comment 8 Laszlo Gombos 2010-02-08 14:33:15 PST
This LGTM as a build-fix. Few minor comments:

noreturn attribute can be defined for other compilers as well not just for GCC - the syntax for MSVC is "__declspec(noreturn)". A better solution would be:

#if defined(__GNUC__) // or Q_CC_GNU
#define NO_RETURN __attribute__ ((noreturn))
#elif defined(_MSC_VER) // or the Q_ equivalent
#define NO_RETURN __declspec(noreturn)
#else
#define NO_RETURN
#endif

I would also put this section in the beginning of utils.h right after the #include statement.
Comment 9 Kenneth Rohde Christiansen 2010-02-08 14:37:44 PST
Comment on attachment 48315 [details]
Simplify the ifdef, handle the non-gcc case only

Already fixed by Tor Arne in yrunk
Comment 10 Ismail Donmez 2010-02-09 16:23:58 PST
Already fixed by someone else on trunk.