After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 629007 - Handle casing better for constants
Handle casing better for constants
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2010-09-07 23:41 UTC by Owen Taylor
Modified: 2015-02-07 16:45 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Handle casing better for constants (6.38 KB, patch)
2010-09-07 23:41 UTC, Owen Taylor
committed Details | Review
Add on fixes to squash (2.72 KB, patch)
2010-09-07 23:54 UTC, Owen Taylor
committed Details | Review

Description Owen Taylor 2010-09-07 23:41:21 UTC
Instead of handling constants by lower-casing them, stripping the
lower-case prefix and upper-casing them again, leave them in the
original case and check against upper-cased versions of
namespace.symbol_prefixes.

Wwe detect what version to test against by looking at the first character
of the identifier, so we assume that --symbol-prefix options are always
in lowercase. If that needs to be relaxed, then we'll have to check all
symbols against both sets of prefixes.

Add tests for constants to Regress.h and fix tests/warn/unresolved-type.h
for a warning message that improved with this change.
Comment 1 Owen Taylor 2010-09-07 23:41:23 UTC
Created attachment 169718 [details] [review]
Handle casing better for constants
Comment 2 Colin Walters 2010-09-07 23:48:17 UTC
Review of attachment 169718 [details] [review]:

Two minor comments, otherwise good to commit

::: giscanner/ast.py
@@ +312,3 @@
             ps = self.identifier_prefixes
             self.symbol_prefixes = [to_underscores(p).lower() for p in ps]
+        self.ucase_symbol_prefixes = [p.upper() for p in self.symbol_prefixes]

Can you add an # Internal cache comment here or something?  Maybe prefix with _, even though it's accessed from transformer.py it's not really "public" either.

::: giscanner/transformer.py
@@ +205,3 @@
             else:
+                if name[0].isupper():
+                    prefixes = ns.ucase_symbol_prefixes

Could flatten this to elif:
Comment 3 Owen Taylor 2010-09-07 23:54:06 UTC
Created attachment 169722 [details] [review]
Add on fixes to squash

- What you asked for
- Add check on --symbol-prefixes
- remove left-over re import as caught by 'make check'
Comment 4 Colin Walters 2010-09-07 23:57:42 UTC
Review of attachment 169722 [details] [review]:

Looks good, thanks for the extra check on symbol-prefixes.
Comment 5 Owen Taylor 2010-09-08 00:04:59 UTC
Attachment 169718 [details] pushed as da89c09 - Handle casing better for constants
Comment 6 André Klapper 2015-02-07 16:45:27 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]