Bug 119932 - WebCore fails to build with trunk clang: error: 'register' storage class specifier is deprecated [-Werror,-Wdeprecated-register]
Summary: WebCore fails to build with trunk clang: error: 'register' storage class spec...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: David Kilzer (:ddkilzer)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2013-08-16 21:43 PDT by David Kilzer (:ddkilzer)
Modified: 2013-08-18 20:04 PDT (History)
14 users (show)

See Also:


Attachments
Patch v1 (3.02 KB, patch)
2013-08-16 21:54 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v2 (3.28 KB, patch)
2013-08-16 23:29 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff
Patch v3 (4.17 KB, patch)
2013-08-17 09:12 PDT, David Kilzer (:ddkilzer)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description David Kilzer (:ddkilzer) 2013-08-16 21:43:41 PDT
WebCore fails to build with trunk clang.  Errors are due to the 'register' keyword being deprecated.  The output of gperf uses 'register' keyword.
Comment 1 David Kilzer (:ddkilzer) 2013-08-16 21:51:49 PDT
<rdar://problem/14764085>
Comment 2 David Kilzer (:ddkilzer) 2013-08-16 21:54:28 PDT
Created attachment 208975 [details]
Patch v1
Comment 3 Build Bot 2013-08-16 22:21:56 PDT
Comment on attachment 208975 [details]
Patch v1

Attachment 208975 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/1345336
Comment 4 Benjamin Poulain 2013-08-16 22:30:51 PDT
Can't we just remove the "register" specifier in all 3 files?
Comment 5 Build Bot 2013-08-16 22:34:46 PDT
Comment on attachment 208975 [details]
Patch v1

Attachment 208975 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/1486009
Comment 6 David Kilzer (:ddkilzer) 2013-08-16 22:45:38 PDT
(In reply to comment #4)
> Can't we just remove the "register" specifier in all 3 files?

No, it's generated from the gperf command.
Comment 7 David Kilzer (:ddkilzer) 2013-08-16 22:49:12 PDT
(In reply to comment #5)
> (From update of attachment 208975 [details])
> Attachment 208975 [details] did not pass mac-ews (mac):
> Output: http://webkit-queues.appspot.com/results/1486009

WebCore/platform/ColorData.gperf:7:34: error: unknown warning group '-Wdeprecated-register', ignored [-Werror,-Wunknown-pragmas]
#pragma clang diagnostic ignored "-Wdeprecated-register"
                                 ^
1 error generated.
Comment 8 David Kilzer (:ddkilzer) 2013-08-16 23:29:37 PDT
Created attachment 208981 [details]
Patch v2
Comment 9 Darin Adler 2013-08-17 05:15:32 PDT
Comment on attachment 208981 [details]
Patch v2

View in context: https://bugs.webkit.org/attachment.cgi?id=208981&action=review

> Source/WebCore/css/makeprop.pl:81
> +#if defined(__clang__)
> +#pragma clang diagnostic push
> +#pragma clang diagnostic ignored \"-Wunknown-pragmas\"
> +#pragma clang diagnostic ignored \"-Wdeprecated-register\"
> +#endif

This is the wrong way to fix it. We should remove the "register" keywords instead. They are doing no good.
Comment 10 Darin Adler 2013-08-17 05:17:04 PDT
Comment on attachment 208981 [details]
Patch v2

Are you sure the register are generated by gperf? I see "register" in these source files, and we should definitely remove those even if we also turn off the diagnostic. If gperf adds additional "register" then I suppose it's OK to ignore the warning.
Comment 11 David Kilzer (:ddkilzer) 2013-08-17 07:11:59 PDT
Comment on attachment 208981 [details]
Patch v2

Marking patch obsolete to remove other instances of 'register' in function parameters.
Comment 12 David Kilzer (:ddkilzer) 2013-08-17 07:30:03 PDT
(In reply to comment #10)
> (From update of attachment 208981 [details])
> Are you sure the register are generated by gperf?

Yes, I am sure.  Here are the error messages; the code below doesn't appear in the source *.gperf files (this is from a single file, but the errors are all the same):

WebCore/platform/ColorData.gperf:57:3: error: 'register' storage class specifier is deprecated [-Werror,-Wdeprecated-register]
  register int hval = (int)len;
  ^~~~~~~~~
WebCore/platform/ColorData.gperf:250:7: error: 'register' storage class specifier is deprecated [-Werror,-Wdeprecated-register]
      register int key = colordata_hash_function (str, len);
      ^~~~~~~~~
WebCore/platform/ColorData.gperf:254:11: error: 'register' storage class specifier is deprecated [-Werror,-Wdeprecated-register]
          register int index = lookup[key];
          ^~~~~~~~~
WebCore/platform/ColorData.gperf:258:15: error: 'register' storage class specifier is deprecated [-Werror,-Wdeprecated-register]
              register const char *s = wordlist[index].name;
              ^~~~~~~~~
4 errors generated.

> I see "register" in these source files, and we should definitely remove those even if we also turn off the diagnostic. If gperf adds additional "register" then I suppose it's OK to ignore the warning.

Thanks for catching the additional 'register' keyword use.  It wasn't flagged as an error when building with trunk clang.
Comment 13 David Kilzer (:ddkilzer) 2013-08-17 08:00:49 PDT
(In reply to comment #12)
> (In reply to comment #10)
> > (From update of attachment 208981 [details] [details])
> > I see "register" in these source files, and we should definitely remove those even if we also turn off the diagnostic. If gperf adds additional "register" then I suppose it's OK to ignore the warning.
> 
> Thanks for catching the additional 'register' keyword use.  It wasn't flagged as an error when building with trunk clang.

To follow up, the non-generated code that used 'register' keyword was doing it to match the generated code it called.  For ColorData.gperf, here is the manual code:

const struct NamedColor* findColor(register const char* str, register unsigned int len)
{
    return ColorDataHash::findColorImpl(str, len);
}

The method it called was defined thusly:

const struct NamedColor *
ColorDataHash::findColorImpl (register const char *str, register unsigned int len)
Comment 14 David Kilzer (:ddkilzer) 2013-08-17 09:12:45 PDT
Created attachment 208999 [details]
Patch v3
Comment 15 WebKit Commit Bot 2013-08-18 20:04:19 PDT
Comment on attachment 208999 [details]
Patch v3

Clearing flags on attachment: 208999

Committed r154259: <http://trac.webkit.org/changeset/154259>
Comment 16 WebKit Commit Bot 2013-08-18 20:04:23 PDT
All reviewed patches have been landed.  Closing bug.