This patch checks whether "_GNU_SOURCE" has been defined earlier in the file.
Change-Id: I884a6e7598e40e9127737ed4a9eb95c5c1518669
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
}
void CGeneratorBase::GenGNUSourceDefinition(std::ofstream& stream) {
- const char format[] = "#define _GNU_SOURCE\n";
-
stream << NLine(1);
- stream << std::string(format);
+ stream << CB_GNU_SOURCE;
}
bool CGeneratorBase::StructureExist(const Structure& st) {
*/
)__c_cb";
+const char CB_GNU_SOURCE[] =
+R"__c_cb(
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE
+#endif
+)__c_cb";
+
const char CB_HEADER[] =
R"__c_cb(
#include <stdbool.h>