[LON-CAPA-cvs] cvs: loncom /homework/caparesponse caparesponse.c
raeburn
raeburn at source.lon-capa.org
Sun Apr 28 21:29:26 EDT 2024
raeburn Mon Apr 29 01:29:26 2024 EDT
Modified files:
/loncom/homework/caparesponse caparesponse.c
Log:
- Suppress "warning: âresultâ may be used uninitialized" warning in function:
caparesponse_get_real_response when compiling caparesponse.c on Fedora 40.
Index: loncom/homework/caparesponse/caparesponse.c
diff -u loncom/homework/caparesponse/caparesponse.c:1.23 loncom/homework/caparesponse/caparesponse.c:1.24
--- loncom/homework/caparesponse/caparesponse.c:1.23 Mon Apr 29 00:34:55 2024
+++ loncom/homework/caparesponse/caparesponse.c Mon Apr 29 01:29:26 2024
@@ -1,6 +1,6 @@
/* The LearningOnline Network with CAPA
* CAPA wrapper code
- * $Id: caparesponse.c,v 1.23 2024/04/29 00:34:55 raeburn Exp $
+ * $Id: caparesponse.c,v 1.24 2024/04/29 01:29:26 raeburn Exp $
*
* Copyright Michigan State University Board of Trustees
*
@@ -135,7 +135,11 @@
int caparesponse_get_real_response (char* unit_str, char* answer,
double* scaled) {
//double caparesponse_get_real_response (char* unit_str, char* answer) {
- int input_len,all_alphabet,idx,outcome=-1,result;
+ int input_len,all_alphabet,idx,outcome=-1;
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+ int result;
+ #pragma GCC diagnostic pop
ouble n_part,scale=1.0,given;
char input[ANSWER_STRING_LENG],filename[FILE_NAME_LENGTH],
tmp_unit_str[ANSWER_STRING_LENG];
@@ -179,6 +183,8 @@
result = NO_UNIT;
}
}
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
if( (result != NO_UNIT) && (!check_for_unit_fail(result)) && ( result != UNIT_NOTNEEDED) ) {
given = n_part * scale;
*scaled=given;
@@ -186,7 +192,8 @@
} /* end if unit check */
} else { /* user entered alphabet, but no number */
result = WANTED_NUMERIC;
- }
+ }
+#pragma GCC diagnostic pop
return result;
}
More information about the LON-CAPA-cvs
mailing list