Fix a yacc regression.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 16 Aug 2003 04:28:52 +0000 (04:28 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Sat, 16 Aug 2003 04:28:52 +0000 (04:28 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@770 fdb21ef1-2011-0410-befe-b5e4ea1792b1

src/CHANGES.txt
src/engine/SCons/Tool/yacc.py
test/YACC.py

index db8ac76f5532396752a5cdda7e399bd413b4cbc3..3b4fcab6f83f5759f6cad84d95a4474ff985eb3c 100644 (file)
@@ -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
index e46ecdd2ec6cda36324191b2c102c871c519683b..c0274ce1dc73dd73ba2875c4900c2031681809fc 100644 (file)
@@ -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)
 
index a93b9688affad69caddd8fb013deca4ec666b681..13203ff1c2a769c8a2f290ae0a6ebe93ec207ee9 100644 (file)
@@ -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 = '.')