Re: Proposal: readable and writable attributes on variables

2016-09-07 Thread Jeff Law
On 09/01/2016 09:04 AM, Martin Sebor wrote: Understood. I think a write-only attribute or type qualifier would make sense. Until/unless it's implemented I would recommend to work around its absence by hiding access to the registers behind a read- only and write-only functional API. As you

Re: Proposal: readable and writable attributes on variables

2016-09-02 Thread Jens Bauer
Hi Martin (and all other list members). On Thu, 1 Sep 2016 09:04:10 -0600, Martin Sebor wrote: > On 08/31/2016 04:56 AM, Jens Bauer wrote: >>>__attribute__ ((not_readable)) int write_only; >>>int *preadwrite = _only; >> >> Would it not be possible to bring a warning in such cases ? >>

Re: Proposal: readable and writable attributes on variables

2016-09-01 Thread Martin Sebor
On 08/31/2016 04:56 AM, Jens Bauer wrote: Hi Martin (and everyone else on the gcc list). I appreciate your input and kind reply to my proposal. :) On Tue, 30 Aug 2016 20:44:35 -0600, Martin Sebor wrote: This sounds reasonable and useful to me but to be fully integrated into the language,

Re: Proposal: readable and writable attributes on variables

2016-09-01 Thread Jens Bauer
Hi Florian. On Thu, 1 Sep 2016 15:21:27 +0200, Florian Weimer wrote: >> So I'd like to propose the following two attributes, which is 'off' >> by default (eg. read access + write access): >> __attribute__((not_readable)) >> __attribute__((not_writable)) > > You can already do this: > > “ > int

Re: Proposal: readable and writable attributes on variables

2016-09-01 Thread Florian Weimer
On 08/30/2016 02:22 PM, Jens Bauer wrote: Hi all. I know it's possible to declare a variable 'read-only' by using 'const'. When working with microcontrollers (small ICs, which often requires you to write your code at driver-level), you need to be able to declare a structure member

Re: Proposal: readable and writable attributes on variables

2016-08-31 Thread Jens Bauer
Hi Martin (and everyone else on the gcc list). I appreciate your input and kind reply to my proposal. :) On Tue, 30 Aug 2016 20:44:35 -0600, Martin Sebor wrote: > This sounds reasonable and useful to me but to be fully integrated > into the language, attribute not_readable would need to be

Re: Proposal: readable and writable attributes on variables

2016-08-30 Thread Martin Sebor
On 08/30/2016 06:22 AM, Jens Bauer wrote: Hi all. I know it's possible to declare a variable 'read-only' by using 'const'. When working with microcontrollers (small ICs, which often requires you to write your code at driver-level), you need to be able to declare a structure member

Proposal: readable and writable attributes on variables

2016-08-30 Thread Jens Bauer
Hi all. I know it's possible to declare a variable 'read-only' by using 'const'. When working with microcontrollers (small ICs, which often requires you to write your code at driver-level), you need to be able to declare a structure member 'read-only', 'write-only' or 'read+write'. In addition