Repository: conan-io/conan

Issue:
compiler_args generator produced incorrect setting
I'm using `compiler_args` generator in one of my projects and suddenly found this at the end of `conanbuildinfo.args`:

```
-D_GLIBCXX_USE_CXX11_ABI=1 - s t d = c + + 1 z
```

This only occured after updating to 1.2 and setting `cppstd`. Some kind of UTF-16 mismatch?


Discussion:
Actually this seems a bug, not a mistmatch. Could you please help us reproducing it? Which is the ``package_info()`` method that is defining the ``std=c++1z``?  Thanks!
I use `cppstd=17` and all my packages have `cppstd` option in `conanfile.py`. I currently use only Conan packages that I've created myself.

Resolving patch:
diff --git a/conans/client/generators/compiler_args.py b/conans/client/generators/compiler_args.py
--- a/conans/client/generators/compiler_args.py
+++ b/conans/client/generators/compiler_args.py
@@ -52,15 +52,15 @@ def content(self):
             # Necessary in the "cl" invocation before specify the rest of linker flags
             flags.append(visual_linker_option_separator)
 
-        the_os = self.conanfile.settings.get_safe("os_build") or \
-                 self.conanfile.settings.get_safe("os")
+        the_os = (self.conanfile.settings.get_safe("os_build") or
+                  self.conanfile.settings.get_safe("os"))
         flags.extend(rpath_flags(the_os, self.compiler, self._deps_build_info.lib_paths))
         flags.extend(format_library_paths(self._deps_build_info.lib_paths, compiler=self.compiler))
         flags.extend(format_libraries(self._deps_build_info.libs, compiler=self.compiler))
         flags.extend(self._deps_build_info.sharedlinkflags)
         flags.extend(self._deps_build_info.exelinkflags)
         flags.extend(self._libcxx_flags())
-        flags.extend(cppstd_flag(self.conanfile.settings.get_safe("compiler"),
+        flags.append(cppstd_flag(self.conanfile.settings.get_safe("compiler"),
                                  self.conanfile.settings.get_safe("compiler.version"),
                                  self.conanfile.settings.get_safe("cppstd")))
         sysrf = sysroot_flag(self._deps_build_info.sysroot, compiler=self.compiler)


Test patch:
diff --git a/conans/test/generators/compiler_args_test.py b/conans/test/generators/compiler_args_test.py
--- a/conans/test/generators/compiler_args_test.py
+++ b/conans/test/generators/compiler_args_test.py
@@ -33,7 +33,6 @@ def _get_conanfile(self, settings):
         conan_file.env_info = EnvInfo()
         return conan_file
 
-
     def gcc_test(self):
         settings = Settings.loads(default_settings_yml)
         settings.os = "Linux"
@@ -41,12 +40,13 @@ def gcc_test(self):
         settings.compiler.version = "6.3"
         settings.arch = "x86"
         settings.build_type = "Release"
+        settings.cppstd = "gnu17"
 
         conan_file = self._get_conanfile(settings)
         gcc = GCCGenerator(conan_file)
         self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -s -DNDEBUG '
                           '-Wl,-rpath="path/to/lib1" '
-                          '-Lpath/to/lib1 -lmylib', gcc.content)
+                          '-Lpath/to/lib1 -lmylib -std=gnu++1z', gcc.content)
 
         settings.arch = "x86_64"
         settings.build_type = "Debug"
@@ -55,14 +55,14 @@ def gcc_test(self):
         gcc = GCCGenerator(conan_file)
         self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m64 -g '
                           '-Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib '
-                          '-D_GLIBCXX_USE_CXX11_ABI=1',
+                          '-D_GLIBCXX_USE_CXX11_ABI=1 -std=gnu++1z',
                           gcc.content)
 
         settings.compiler.libcxx = "libstdc++"
         gcc = GCCGenerator(conan_file)
         self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m64 -g '
                           '-Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib '
-                          '-D_GLIBCXX_USE_CXX11_ABI=0',
+                          '-D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++1z',
                           gcc.content)
 
         settings.os = "Windows"
@@ -73,7 +73,8 @@ def gcc_test(self):
         gcc = GCCGenerator(conan_file)
         # GCC generator ignores the compiler setting, it is always gcc
         self.assertEquals('-Dmydefine1 -Ipath/to/include1 cxx_flag1 c_flag1 -m32 -s '
-                          '-DNDEBUG -Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib', gcc.content)
+                          '-DNDEBUG -Wl,-rpath="path/to/lib1" -Lpath/to/lib1 -lmylib',
+                          gcc.content)
 
     def compiler_args_test(self):
         settings = Settings.loads(default_settings_yml)