message: cxx: Merge warnings when adding configurations.
diff: @@ -389,26 +389,50 @@ class Config:
  Traceback (most recent call last):
  ...
  Exception: redefinition of B from 0 to 1
  +
  + Likewise, warnings are merged:
  +
  + >>> cfg1 = drake.cxx.Config()
  + >>> cfg1.warnings.parentheses = False
  + >>> cfg2 = drake.cxx.Config()
  + >>> cfg2.warnings.return_type = True
  + >>> sum = cfg1 + cfg2
  + >>> sum.warnings.parentheses
  + False
  + >>> sum.warnings.return_type
  + True
  + >>> cfg1.warnings.return_type = False
  + >>> cfg1 + cfg2
  + Traceback (most recent call last):
  + ...
  + Exception: incompatible C++ configuration for warning 'return-type'
  """
  - def merge_bool(attr):
  - mine = getattr(self, attr, None)
  - hers = getattr(rhs, attr, None)
  - if mine is None:
  - return hers
  - elif hers is None:
  - return mine
  + def merge(name, l, r):
  + if l is None:
  + return r
  + elif r is None:
  + return l
  else:
  - if mine is hers:
  - return hers
  + if l is r:
  + return l
  else:
  raise Exception('incompatible C++ configuration '
  - 'for attribute %s' % attr)
  + 'for %s' % name)
  + def merge_bool(attr):
  + mine = getattr(self, attr, None)
  + hers = getattr(rhs, attr, None)
  + return merge('attribute %s'.format(attr), mine, hers)
  res = Config(self)
  res.__debug = self.__debug or rhs.__debug
  res.__export_dynamic = merge_bool('export_dynamic')
  res.__use_local_libcxx = merge_bool('_Config__use_local_libcxx')
  + for w in chain(self.__warnings._Warnings__warnings,
  + rhs.__warnings._Warnings__warnings):
  + res.__warnings._Warnings__warnings[w] = merge(
  + 'warning {!r}'.format(w), self.__warnings._Warnings__warnings.get(w), rhs.__warnings._Warnings__warnings.get(w))
  +
  for key, value in rhs.__defines.items():
  if key in res.__defines:
  old = res.__defines[key]
  