On Thu, Dec 15, 2016 at 12:49 PM, Gustavo Sverzut Barbieri
<barbi...@gmail.com> wrote:
> I really don't get what does this mean... are these volatile hiding
> something else?

In case of setjmp or thread cancellable use, it seems that the
compiler can generate code that could lead to some value being
modified in one branch of the execution that would differ from the
other branch. Marking it to be volatile force both branch to refetch
the value from its common position on the stack and avoid having
different unsynchronized data between each execution branch. The issue
is that as the function become more and more complex, finding which
branch is causing the warning become increasingly diffficult and
resorting to volatile solve the problem in most case.

> On Thu, Dec 15, 2016 at 5:39 PM, Cedric BAIL <cedric.b...@free.fr> wrote:
>> cedric pushed a commit to branch master.
>>
>> http://git.enlightenment.org/core/efl.git/commit/?id=32da71d65d51e0bebfd0b00560e03451409cba02
>>
>> commit 32da71d65d51e0bebfd0b00560e03451409cba02
>> Author: Cedric BAIL <ced...@osg.samsung.com>
>> Date:   Thu Dec 15 10:31:56 2016 -0800
>>
>>     ecore_con: reduce amount of warning related to clobbered variable.
>> ---
>>  src/lib/ecore_con/ecore_con.c | 14 +++++++-------
>>  1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/lib/ecore_con/ecore_con.c b/src/lib/ecore_con/ecore_con.c
>> index 7aaeb35..53a9bda 100644
>> --- a/src/lib/ecore_con/ecore_con.c
>> +++ b/src/lib/ecore_con/ecore_con.c
>> @@ -939,7 +939,7 @@ static Eina_Error
>>  _efl_net_ip_connect(const struct addrinfo *addr, SOCKET *sockfd)
>>  {
>>     SOCKET fd = INVALID_SOCKET;
>> -   Eina_Error ret = 0;
>> +   volatile Eina_Error ret = 0;
>>
>>     /* always close-on-exec since it's not a point to pass an
>>      * under construction socket to a child process.
>> @@ -985,7 +985,7 @@ _efl_net_ip_resolve_and_connect(const char *host, const 
>> char *port, int type, in
>>       .ai_family = AF_UNSPEC,
>>       .ai_flags = AI_ADDRCONFIG | AI_V4MAPPED,
>>     };
>> -   Eina_Error ret = EFL_NET_DIALER_ERROR_COULDNT_CONNECT;
>> +   volatile Eina_Error ret = EFL_NET_DIALER_ERROR_COULDNT_CONNECT;
>>     int r;
>>
>>     if (strchr(host, ':')) hints.ai_family = AF_INET6;
>> @@ -1108,7 +1108,7 @@ 
>> _efl_net_ip_connect_async_run_socks4_try(Efl_Net_Ip_Connect_Async_Data *d, 
>> const
>>     socklen_t proxy_addrlen;
>>     SOCKET fd;
>>     Eina_Error err;
>> -   Eina_Bool ret = EINA_FALSE;
>> +   volatile Eina_Bool ret = EINA_FALSE;
>>     ssize_t s;
>>
>>     err = _efl_net_ip_resolve_and_connect(proxy_host, proxy_port, 
>> SOCK_STREAM, IPPROTO_TCP, &fd, (struct sockaddr *)&proxy_addr, 
>> &proxy_addrlen);
>> @@ -1565,7 +1565,7 @@ 
>> _efl_net_ip_connect_async_run_socks5_auth_user_pass(SOCKET fd, const char 
>> *user,
>>     uint8_t pass_len = pass ? strlen(pass) : 0;
>>     size_t len = 1 + 1 + user_len + 1 + pass_len;
>>     char *msg;
>> -   Eina_Bool ret = EINA_FALSE;
>> +   volatile Eina_Bool ret = EINA_FALSE;
>>     ssize_t s;
>>
>>     msg = malloc(len);
>> @@ -1630,7 +1630,7 @@ 
>> _efl_net_ip_connect_async_run_socks5_try(Efl_Net_Ip_Connect_Async_Data *d, 
>> const
>>     socklen_t proxy_addrlen;
>>     SOCKET fd;
>>     Eina_Error err;
>> -   Eina_Bool ret = EINA_FALSE;
>> +   volatile Eina_Bool ret = EINA_FALSE;
>>     ssize_t s;
>>
>>     err = _efl_net_ip_resolve_and_connect(proxy_host, proxy_port, 
>> SOCK_STREAM, IPPROTO_TCP, &fd, (struct sockaddr *)&proxy_addr, 
>> &proxy_addrlen);
>> @@ -2053,8 +2053,8 @@ _efl_net_ip_connect_async_run(void *data, Ecore_Thread 
>> *thread EINA_UNUSED)
>>     const char *host, *port, *proxy;
>>     char *addrcopy;
>>     char **proxies = NULL;
>> -   int proxies_idx = 0;
>> -   Eina_Bool is_libproxy = EINA_FALSE;
>> +   volatile int proxies_idx = 0;
>> +   volatile Eina_Bool is_libproxy = EINA_FALSE;
>>
>>     addrcopy = strdup(d->address);
>>     if (!addrcopy)
>>
>> --
>>
>>
>
>
>
> --
> Gustavo Sverzut Barbieri
> --------------------------------------
> Mobile: +55 (16) 99354-9890
>
> ------------------------------------------------------------------------------
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> _______________________________________________
> enlightenment-devel mailing list
> enlightenment-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel



-- 
Cedric BAIL

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to