]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
codegen: Include "string.h" for strcmp() (POSIX)
authorRico Tzschichholz <ricotz@ubuntu.com>
Fri, 26 Feb 2021 18:19:54 +0000 (19:19 +0100)
committerRico Tzschichholz <ricotz@ubuntu.com>
Sat, 27 Feb 2021 19:26:43 +0000 (20:26 +0100)
codegen/valaccodebasemodule.vala

index 38313f8a55194c04a03f5c234af253161829650a..c2cecb2b07038551a1717dcf88ad38267ca2a4e0 100644 (file)
@@ -1949,6 +1949,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                                                ccode.add_assignment (new CCodeIdentifier ("old_value"), get_call);
                                                CCodeFunctionCall ccall;
                                                if (context.profile == Profile.POSIX) {
+                                                       cfile.add_include ("string.h");
                                                        ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp"))));
                                                } else {
                                                        ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0"));
@@ -3047,6 +3048,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        if (!(f.variable_type is NullType) && f.variable_type.compatible (string_type)) {
                                CCodeFunctionCall ccall;
                                if (context.profile == Profile.POSIX) {
+                                       cfile.add_include ("string.h");
                                        ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp"))));
                                } else {
                                        ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0"));
@@ -5716,6 +5718,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                        case BinaryOperator.GREATER_THAN_OR_EQUAL:
                                CCodeFunctionCall ccall;
                                if (context.profile == Profile.POSIX) {
+                                       cfile.add_include ("string.h");
                                        ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp"))));
                                } else {
                                        ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0"));
@@ -5800,6 +5803,7 @@ public abstract class Vala.CCodeBaseModule : CodeGenerator {
                if (array_type.element_type.compatible (string_type)) {
                        CCodeFunctionCall ccall;
                        if (context.profile == Profile.POSIX) {
+                               cfile.add_include ("string.h");
                                ccall = new CCodeFunctionCall (new CCodeIdentifier (generate_cmp_wrapper (new CCodeIdentifier ("strcmp"))));
                        } else {
                                ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_strcmp0"));