Bug 1372

Summary: [LLVM] error: using the result of an assignment as a condition without parentheses
Product: ns-3 Reporter: Gustavo J. A. M. Carneiro <gjcarneiro>
Component: applicationsAssignee: George Riley <riley>
Status: RESOLVED FIXED    
Severity: normal CC: daniel.camara, ns-bugs
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   
Bug Depends on:    
Bug Blocks: 1345    
Attachments: patch to add parenthesis

Description Gustavo J. A. M. Carneiro 2012-02-22 06:30:52 UTC
[ 931/1334] cxx: src/applications/model/udp-echo-client.cc -> build/src/applications/model/udp-echo-client.cc.1.o
../src/applications/model/udp-echo-client.cc:331:17: error: using the result of an assignment as a condition without parentheses
      [-Werror,-Wparentheses]
  while (packet = socket->RecvFrom (from))
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
../src/applications/model/udp-echo-client.cc:331:17: note: use '==' to turn this assignment into an equality comparison
  while (packet = socket->RecvFrom (from))
                ^
                ==
../src/applications/model/udp-echo-client.cc:331:17: note: place parentheses around the assignment to silence this warning
  while (packet = socket->RecvFrom (from))
                ^
         (                               )
1 error generated.
Comment 1 Gustavo J. A. M. Carneiro 2012-02-22 06:34:55 UTC
More of the same:


../src/applications/model/ping6.cc:234:17: error: using the result of an assignment as a condition without parentheses
      [-Werror,-Wparentheses]
  while (packet = socket->RecvFrom (from))
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
../src/applications/model/ping6.cc:234:17: note: use '==' to turn this assignment into an equality comparison
  while (packet = socket->RecvFrom (from))
                ^
                ==
../src/applications/model/ping6.cc:234:17: note: place parentheses around the assignment to silence this warning
  while (packet = socket->RecvFrom (from))
                ^
         (                               )
1 error generated.

and:

../src/applications/model/packet-sink.cc:171:17: error: using the result of an assignment as a condition without parentheses
      [-Werror,-Wparentheses]
  while (packet = socket->RecvFrom (from))
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
../src/applications/model/packet-sink.cc:171:17: note: use '==' to turn this assignment into an equality comparison
  while (packet = socket->RecvFrom (from))
                ^
                ==
../src/applications/model/packet-sink.cc:171:17: note: place parentheses around the assignment to silence this warning
  while (packet = socket->RecvFrom (from))
                ^
         (                               )
1 error generated.
Comment 2 Gustavo J. A. M. Carneiro 2012-02-22 06:36:00 UTC
../src/applications/model/radvd.cc:238:17: error: using the result of an assignment as a condition without parentheses
      [-Werror,-Wparentheses]
  while (packet = socket->RecvFrom (from))
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
../src/applications/model/radvd.cc:238:17: note: use '==' to turn this assignment into an equality comparison
  while (packet = socket->RecvFrom (from))
                ^
                ==
../src/applications/model/radvd.cc:238:17: note: place parentheses around the assignment to silence this warning
  while (packet = socket->RecvFrom (from))
                ^
         (                               )
1 error generated.
Comment 3 Gustavo J. A. M. Carneiro 2012-02-22 06:37:36 UTC
../src/applications/model/udp-server.cc:155:17: error: using the result of an assignment as a condition without parentheses
      [-Werror,-Wparentheses]
  while (packet = socket->RecvFrom (from))
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
../src/applications/model/udp-server.cc:155:17: note: use '==' to turn this assignment into an equality comparison
  while (packet = socket->RecvFrom (from))
                ^
                ==
../src/applications/model/udp-server.cc:155:17: note: place parentheses around the assignment to silence this warning
  while (packet = socket->RecvFrom (from))
                ^
         (                               )
1 error generated.


../src/applications/model/udp-echo-server.cc:146:17: error: using the result of an assignment as a condition without parentheses
      [-Werror,-Wparentheses]
  while (packet = socket->RecvFrom (from))
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
../src/applications/model/udp-echo-server.cc:146:17: note: use '==' to turn this assignment into an equality comparison
  while (packet = socket->RecvFrom (from))
                ^
                ==
../src/applications/model/udp-echo-server.cc:146:17: note: place parentheses around the assignment to silence this warning
  while (packet = socket->RecvFrom (from))
                ^
         (                               )
1 error generated.
Comment 4 Gustavo J. A. M. Carneiro 2012-02-22 06:39:25 UTC
Created attachment 1336 [details]
patch to add parenthesis
Comment 5 Daniel Camara 2012-03-09 11:22:11 UTC
The patch worked for me :)
Comment 6 Daniel Camara 2012-03-12 07:33:32 UTC
Path applied
mercurial changeset: 7760:e98d9c028d7f