def _RemoveFlagsPrecedingCompiler( flags ):
  """Assuming that the flag just before the first flag starting with a dash is
  the compiler path, removes all flags preceding it."""

  for index, flag in enumerate( flags ):
    if flag.startswith( '-' ):
      return ( flags[ index - 1: ] if index > 1 else
               flags )
  return flags[ :-1 ]