Testsuite automatically adds check_function_bodies options
GCC's testsuite now automatically includes the necessary `check_function_bodies` option when a test uses the `check-function-bodies` directive, simplifying tes…
GCC test cases using check-function-bodies directives previously required an explicit dg-add-options check_function_bodies to function correctly. This often overlooked requirement has been automated. The testsuite’s dg-final now automatically adds the check_function_bodies option, streamlining the process of writing new tests that inspect function bodies and reducing common errors.
In Details
The gcc-dg.exp file in the GCC testsuite defines the behavior of various dg- directives. dg-final is a directive that executes Tcl code after the compilation and execution of a test case. The check_function_bodies option enables specific backend analysis, particularly for targets like i386, to verify the generated assembly or internal representations of function bodies. The improvement resides in lib/gcc-dg.exp, specifically how dg-final processes the check-function-bodies directive. By integrating the dg-add-options call directly into the dg-final handler, it eliminates a r…
For Context
When developers write changes for a large project like GCC (the GNU Compiler Collection), they also write many tests to make sure their changes work correctly and don't break existing functionality. The GCC testsuite has special directives, like dg-final, that tell it how to run and verify tests. One such verification is check-function-bodies, which inspects the internal representation or generated assembly of a function. Previously, to use this check, test writers also had to manually add another directive, dg-add-options check_function_bodies. This was easy to forget and led to tests not running as intended. This change automates that step, so if a test uses check-function-bodies, the necessary option is automatically enabled, making test writing simpler and less error-prone.