clang -Wparentheses warnings on gdb-7.9

Jack Howarth <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CADtEn-2qAExER=UF2u-99AhNkgjjWWWj-D3nffDV-CzLEAoQsg@mail.gmail.com>
    We have quite a few warnings reported in the build of gdb-7.9
reported from clang on -Wparentheses.

complete.c:1002:23: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
      while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
             ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
complete.c:1002:23: note: place parentheses around the assignment to
silence this warning
      while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
                      ^
             (                                                             )
complete.c:1002:23: note: use '==' to turn this assignment into an
equality comparison
      while (rl_point = MB_PREVCHAR (rl_line_buffer, rl_point, MB_FIND_ANY))
                      ^
                      ==
complete.c:2010:17: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
  while (string = (*entry_function) (text, matches))
         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
complete.c:2010:17: note: place parentheses around the assignment to
silence this warning
  while (string = (*entry_function) (text, matches))
                ^
         (                                         )
complete.c:2063:16: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
  while (entry = getpwent ())
         ~~~~~~^~~~~~~~~~~~~
complete.c:2063:16: note: place parentheses around the assignment to
silence this warning
  while (entry = getpwent ())
               ^
         (                  )
complete.c:2063:16: note: use '==' to turn this assignment into an
equality comparison
  while (entry = getpwent ())
               ^
               ==
bind.c:451:21: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
  for (i = l = 0; c = seq[i]; i++)
                  ~~^~~~~~~~
bind.c:451:21: note: place parentheses around the assignment to
silence this warning
  for (i = l = 0; c = seq[i]; i++)
                    ^
                  (         )
bind.c:451:21: note: use '==' to turn this assignment into an equality
comparison
  for (i = l = 0; c = seq[i]; i++)
                    ^
                    ==
bind.c:1197:21: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
      for (i = 1; c = string[i]; i++)
                  ~~^~~~~~~~~~~
bind.c:1197:21: note: place parentheses around the assignment to
silence this warning
      for (i = 1; c = string[i]; i++)
                    ^
                  (            )
bind.c:1197:21: note: use '==' to turn this assignment into an
equality comparison
      for (i = 1; c = string[i]; i++)
                    ^
                    ==
bind.c:1288:25: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
      for (passc = 0; c = string[i]; i++)
                      ~~^~~~~~~~~~~
bind.c:1288:25: note: place parentheses around the assignment to
silence this warning
      for (passc = 0; c = string[i]; i++)
                        ^
                      (            )
bind.c:1288:25: note: use '==' to turn this assignment into an
equality comparison
      for (passc = 0; c = string[i]; i++)
                        ^
                        ==
bind.c:2117:20: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
  for (i = 0; name = names[i]; i++)
              ~~~~~^~~~~~~~~~
bind.c:2117:20: note: place parentheses around the assignment to
silence this warning
  for (i = 0; name = names[i]; i++)
                   ^
              (              )
bind.c:2117:20: note: use '==' to turn this assignment into an
equality comparison
  for (i = 0; name = names[i]; i++)
                   ^
                   ==
nput.c:424:13: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
      if (c = _rl_next_macro_key ())
          ~~^~~~~~~~~~~~~~~~~~~~~~~
input.c:424:13: note: place parentheses around the assignment to
silence this warning
      if (c = _rl_next_macro_key ())
            ^
          (                        )
input.c:424:13: note: use '==' to turn this assignment into an
equality comparison
      if (c = _rl_next_macro_key ())
            ^
            ==
misc.c:456:14: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
      if (ul = (UNDO_LIST *)entry->data)
          ~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
misc.c:456:14: note: place parentheses around the assignment to
silence this warning
      if (ul = (UNDO_LIST *)entry->data)
             ^
          (                            )
misc.c:456:14: note: use '==' to turn this assignment into an equality
comparison
      if (ul = (UNDO_LIST *)entry->data)
             ^
             ==
histexpand.c:207:27: warning: using the result of an assignment as a
condition without parentheses [-Wparentheses]
  for (local_index = i; c = string[i]; i++)
                        ~~^~~~~~~~~~~
histexpand.c:207:27: note: place parentheses around the assignment to
silence this warning
  for (local_index = i; c = string[i]; i++)
                          ^
                        (            )
histexpand.c:207:27: note: use '==' to turn this assignment into an
equality comparison
  for (local_index = i; c = string[i]; i++)
                          ^
                          ==
./tilde.c:199:14: note: place parentheses around the assignment to
silence this warning
  if (result = strchr (string, '~'))
             ^
      (                            )
./tilde.c:199:14: note: use '==' to turn this assignment into an
equality comparison
  if (result = strchr (string, '~'))
             ^
             ==
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.