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 648330 - Vala silently ignores marking field as volatile
Vala silently ignores marking field as volatile
Status: RESOLVED WONTFIX
Product: vala
Classification: Core
Component: Parser
unspecified
Other Linux
: Normal major
: ---
Assigned To: Vala maintainers
Vala maintainers
Depends on:
Blocks: 622338
 
 
Reported: 2011-04-20 17:25 UTC by Maciej (Matthew) Piechotka
Modified: 2011-08-12 10:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-Fix-parsing-volatile-fields.patch (1.15 KB, patch)
2011-04-20 17:25 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Fix-parsing-volatile-fields.patch (2.09 KB, patch)
2011-04-20 18:11 UTC, Maciej (Matthew) Piechotka
rejected Details | Review
0001-Fix-handling-volatile-fields.patch (12.01 KB, patch)
2011-04-20 19:35 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Fix-handling-volatile-fields.patch (12.01 KB, patch)
2011-04-20 19:40 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Fix-handling-volatile-fields.patch (11.95 KB, patch)
2011-04-20 19:41 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Implement-more-advanced-handling-of-volatile.patch (11.27 KB, patch)
2011-04-24 07:29 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Implement-more-advanced-handling-of-volatile.patch (11.50 KB, patch)
2011-04-24 07:38 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Implement-more-advanced-handling-of-volatile.patch (11.50 KB, patch)
2011-04-24 08:37 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Implement-more-advanced-handling-of-volatile.patch (12.96 KB, patch)
2011-05-22 17:14 UTC, Maciej (Matthew) Piechotka
none Details | Review
0001-Implement-more-advanced-handling-of-volatile.patch (12.90 KB, patch)
2011-06-11 10:26 UTC, Maciej (Matthew) Piechotka
none Details | Review

Description Maciej (Matthew) Piechotka 2011-04-20 17:25:46 UTC
Created attachment 186380 [details] [review]
0001-Fix-parsing-volatile-fields.patch

Vala silently ignores marking field as volatile and it does not go to the code generation. This patch fixes the problem.
Comment 1 Maciej (Matthew) Piechotka 2011-04-20 18:11:14 UTC
Created attachment 186384 [details] [review]
0001-Fix-parsing-volatile-fields.patch
Comment 2 Maciej (Matthew) Piechotka 2011-04-20 18:26:22 UTC
Comment on attachment 186384 [details] [review]
0001-Fix-parsing-volatile-fields.patch

Ups. Sorry - I forgot to state what are the changes - I interpreted the following:

   volatile void *x = 0;

As volatile pointer x (i.e. bracketing is volatile (void *) not as in C (volatile void)* and previous patch.

it also emits the volatile in any case not only

I belive it is more consistend and what would people expect.

PS. Patch is broken and I'm working on it.
Comment 3 Maciej (Matthew) Piechotka 2011-04-20 19:35:04 UTC
Created attachment 186386 [details] [review]
0001-Fix-handling-volatile-fields.patch
Comment 4 Maciej (Matthew) Piechotka 2011-04-20 19:40:18 UTC
Created attachment 186388 [details] [review]
0001-Fix-handling-volatile-fields.patch
Comment 5 Maciej (Matthew) Piechotka 2011-04-20 19:41:21 UTC
Created attachment 186389 [details] [review]
0001-Fix-handling-volatile-fields.patch

Sorry for spamming but I keep attaching wrong patches...
Comment 6 Maciej (Matthew) Piechotka 2011-04-20 19:43:32 UTC
Sight. glib-2.0.vapi shouldn't  be modified.
Comment 7 Maciej (Matthew) Piechotka 2011-04-24 07:29:20 UTC
Created attachment 186544 [details] [review]
0001-Implement-more-advanced-handling-of-volatile.patch

A patch implementing more advanced handling of volatile.

It makes it property of type (ones derived from VolatileType) - currently they are ValueType and PointerType.

Bracekting is as follows:
 - volatile referes to LHS of it as in C (int volatile * is pointer to volatile int while int * volatile is volatile pointer to int)
 - if on LHS there is no type *unlike* C it referes to the whole type. However it have highier precedence then array so (volatile int * is volatile pointer to int while volatile int[] is array of volatile ints).

Rationale:
 - Keep more or less compatibility with C
 - Make it less confusing what volatile int * is
 - Don't worry what precise semantic is of:
         volatile Gtk.Lable l = new Gtk.Label (null);
   As the copy of value and incrementing the reference count is not atomic on many platforms and with volatile you probably want to hand-manage memory anyway
Comment 8 Maciej (Matthew) Piechotka 2011-04-24 07:38:32 UTC
Created attachment 186545 [details] [review]
0001-Implement-more-advanced-handling-of-volatile.patch

After thought - due to way it is parsed it is unfortunatly ambigous is "int volatile" a variable volatile with type int or int that is volatile. The patch was altered to disallow volatile as identifier.
Comment 9 Maciej (Matthew) Piechotka 2011-04-24 08:37:40 UTC
Created attachment 186546 [details] [review]
0001-Implement-more-advanced-handling-of-volatile.patch

Sorry for amount of patches but I'm still beginner in vala sourcecode and I've found a few cornercases.
Comment 10 Maciej (Matthew) Piechotka 2011-05-22 17:14:29 UTC
Created attachment 188344 [details] [review]
0001-Implement-more-advanced-handling-of-volatile.patch

Hopefully working rebase against newer vala (I hadn't tested it yet).
Comment 11 Maciej (Matthew) Piechotka 2011-06-11 10:26:12 UTC
Created attachment 189714 [details] [review]
0001-Implement-more-advanced-handling-of-volatile.patch
Comment 12 Maciej (Matthew) Piechotka 2011-08-12 10:17:09 UTC
After talk with Jürg on Desktop Summit: he found much cleaner workaround for atomics.