From eef2e5498d8cb0fc3f791ffafca437c4f5740028 Mon Sep 17 00:00:00 2001 From: stevenknight Date: Sat, 16 Aug 2003 04:28:52 +0000 Subject: [PATCH] Fix a yacc regression. git-svn-id: http://scons.tigris.org/svn/scons/trunk@770 fdb21ef1-2011-0410-befe-b5e4ea1792b1 --- src/CHANGES.txt | 5 +++++ src/engine/SCons/Tool/yacc.py | 1 + test/YACC.py | 28 ++++++++++++++++++++++------ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/CHANGES.txt b/src/CHANGES.txt index db8ac76f..3b4fcab6 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -12,6 +12,11 @@ RELEASE X.XX - XXX, XX XXX XXXX XX:XX:XX XXXXX From Steven Knight + From Gerard Patel + + - When the yacc -d flag is used, take the .h file base name from the + target .c file, not the source (matching what yacc does). + RELEASE 0.91 - Thu, 14 Aug 2003 13:00:44 -0500 diff --git a/src/engine/SCons/Tool/yacc.py b/src/engine/SCons/Tool/yacc.py index e46ecdd2..c0274ce1 100644 --- a/src/engine/SCons/Tool/yacc.py +++ b/src/engine/SCons/Tool/yacc.py @@ -46,6 +46,7 @@ def _yaccEmitter(target, source, env, ysuf, hsuf): if len(source) and '-d' in string.split(env.subst("$YACCFLAGS")): base, ext = os.path.splitext(SCons.Util.to_String(source[0])) if ext == ysuf: + base, ext = os.path.splitext(SCons.Util.to_String(target[0])) target.append(base + hsuf) return (target, source) diff --git a/test/YACC.py b/test/YACC.py index a93b9688..13203ff1 100644 --- a/test/YACC.py +++ b/test/YACC.py @@ -105,6 +105,7 @@ foo.Program(target = 'foo', source = 'foo.y') bar.Program(target = 'bar', source = 'bar.y') foo.Program(target = 'hello', source = ['hello.cpp']) foo.CXXFile(target = 'file.cpp', source = ['file.yy'], YACCFLAGS='-d') +foo.CFile(target = 'not_foo', source = 'foo.y') """ % python) yacc = r""" @@ -161,6 +162,7 @@ int main() test.write('bar.y', yacc % 'bar.y') + # Build the foo program test.run(arguments = 'foo' + _exe, stderr = None) test.up_to_date(arguments = 'foo' + _exe) @@ -169,20 +171,34 @@ int main() test.run(program = test.workpath('foo'), stdin = "a\n", stdout = "foo.y\n") - test.run(arguments = 'bar' + _exe) + test.fail_test(not os.path.exists(test.workpath('foo.h'))) - test.up_to_date(arguments = 'bar' + _exe) + test.run(arguments = '-c .') - test.fail_test(test.read('wrapper.out') != "wrapper.py\n") + test.fail_test(os.path.exists(test.workpath('foo.h'))) - test.run(program = test.workpath('bar'), stdin = "b\n", stdout = "bar.y\n") + # + test.run(arguments = 'not_foo.c') - test.fail_test(not os.path.exists(test.workpath('foo.h'))) + test.up_to_date(arguments = 'not_foo.c') + + test.fail_test(os.path.exists(test.workpath('foo.h'))) + test.fail_test(not os.path.exists(test.workpath('not_foo.h'))) test.run(arguments = '-c .') - test.fail_test(os.path.exists(test.workpath('foo.h'))) + test.fail_test(os.path.exists(test.workpath('not_foo.h'))) + + # + test.run(arguments = 'bar' + _exe) + + test.up_to_date(arguments = 'bar' + _exe) + + test.fail_test(test.read('wrapper.out') != "wrapper.py\n") + + test.run(program = test.workpath('bar'), stdin = "b\n", stdout = "bar.y\n") + # test.run(arguments = '.') test.up_to_date(arguments = '.') -- 2.26.2