Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AP_Scripting: ensure that all pass by reference values are initialized #26222

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions libraries/AP_Scripting/generator/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1386,41 +1386,41 @@ void emit_checker(const struct type t, int arg_number, int skipped, const char *
arg_number = arg_number + NULLABLE_ARG_COUNT_BASE;
switch (t.type) {
case TYPE_BOOLEAN:
fprintf(source, "%sbool data_%d;\n", indentation, arg_number);
fprintf(source, "%sbool data_%d {};\n", indentation, arg_number);
break;
case TYPE_FLOAT:
fprintf(source, "%sfloat data_%d;\n", indentation, arg_number);
fprintf(source, "%sfloat data_%d {};\n", indentation, arg_number);
break;
case TYPE_INT8_T:
fprintf(source, "%sint8_t data_%d;\n", indentation, arg_number);
fprintf(source, "%sint8_t data_%d {};\n", indentation, arg_number);
break;
case TYPE_INT16_T:
fprintf(source, "%sint16_t data_%d;\n", indentation, arg_number);
fprintf(source, "%sint16_t data_%d {};\n", indentation, arg_number);
break;
case TYPE_INT32_T:
fprintf(source, "%sint32_t data_%d;\n", indentation, arg_number);
fprintf(source, "%sint32_t data_%d {};\n", indentation, arg_number);
break;
case TYPE_UINT8_T:
fprintf(source, "%suint8_t data_%d;\n", indentation, arg_number);
fprintf(source, "%suint8_t data_%d {};\n", indentation, arg_number);
break;
case TYPE_UINT16_T:
fprintf(source, "%suint16_t data_%d;\n", indentation, arg_number);
fprintf(source, "%suint16_t data_%d {};\n", indentation, arg_number);
break;
case TYPE_UINT32_T:
fprintf(source, "%suint32_t data_%d;\n", indentation, arg_number);
fprintf(source, "%suint32_t data_%d {};\n", indentation, arg_number);
break;
case TYPE_AP_OBJECT:
case TYPE_NONE:
case TYPE_LITERAL:
return; // nothing to do here, this should potentially be checked outside of this, but it makes an easier implementation to accept it
case TYPE_STRING:
fprintf(source, "%schar * data_%d = {};\n", indentation, arg_number);
fprintf(source, "%schar * data_%d {};\n", indentation, arg_number);
break;
case TYPE_ENUM:
fprintf(source, "%suint32_t data_%d;\n", indentation, arg_number);
fprintf(source, "%suint32_t data_%d {};\n", indentation, arg_number);
break;
case TYPE_USERDATA:
fprintf(source, "%s%s data_%d = {};\n", indentation, t.data.ud.name, arg_number);
fprintf(source, "%s%s data_%d {};\n", indentation, t.data.ud.name, arg_number);
break;
}
} else {
Expand Down
Loading