generate_code: add #line directives
When generating .c files from .function files, add #line directives so
that errors in the generated files are reported with the correct line
number. Also add #line directives to the template .function files, for
the same reason.
This is a backport of things that got added later than 2.1 in several stages.
diff --git a/tests/suites/helpers.function b/tests/suites/helpers.function
index cad7072..4c3a235 100644
--- a/tests/suites/helpers.function
+++ b/tests/suites/helpers.function
@@ -1,3 +1,4 @@
+#line 1 "helpers.function"
/*----------------------------------------------------------------------------*/
/* Headers */
diff --git a/tests/suites/main_test.function b/tests/suites/main_test.function
index 7fee3d8..948f72e 100644
--- a/tests/suites/main_test.function
+++ b/tests/suites/main_test.function
@@ -1,4 +1,5 @@
SUITE_PRE_DEP
+#line !LINE_NO! "main_test.function"
#define TEST_SUITE_ACTIVE
int verify_string( char **str )
@@ -69,6 +70,7 @@
FUNCTION_CODE
SUITE_POST_DEP
+#line !LINE_NO! "main_test.function"
/*----------------------------------------------------------------------------*/
@@ -80,6 +82,7 @@
return( 1 );
DEP_CHECK_CODE
+#line !LINE_NO! "main_test.function"
return( 1 );
}
@@ -93,6 +96,7 @@
#if defined(TEST_SUITE_ACTIVE)
DISPATCH_FUNCTION
{
+#line !LINE_NO! "main_test.function"
mbedtls_fprintf( stdout, "FAILED\nSkipping unknown test function '%s'\n", params[0] );
fflush( stdout );
return( 1 );