Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: testing/generate_gmock_mutant.py

Issue 402086: Functor for functions with STDCALL calling conventions. Allows invoking Windo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | testing/gmock_mutant.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2009 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2009 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import string 6 import string
7 7
8 HEADER = """\ 8 HEADER = """\
9 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 9 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
10 // Use of this source code is governed by a BSD-style license that can be 10 // Use of this source code is governed by a BSD-style license that can be
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 print "\n", FixCode(CREATE_FUNCTION_FUNCTOR_TEMPLATE % args) 408 print "\n", FixCode(CREATE_FUNCTION_FUNCTOR_TEMPLATE % args)
409 409
410 # Functor with pointer to a pointer of the object. 410 # Functor with pointer to a pointer of the object.
411 print "\n#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" 411 print "\n#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING"
412 mutant2 = mutant.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") 412 mutant2 = mutant.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,")
413 mutant2 = mutant2.replace("new Mutant", "new MutantLateObjectBind") 413 mutant2 = mutant2.replace("new Mutant", "new MutantLateObjectBind")
414 mutant2 = mutant2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") 414 mutant2 = mutant2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple")
415 print mutant2 415 print mutant2
416 print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING\n" 416 print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING\n"
417 417
418 # OS_WIN specific. Same functors but with stdcall calling conventions.
418 # Functor for method with __stdcall calling conventions. 419 # Functor for method with __stdcall calling conventions.
419 print "#if defined (OS_WIN)" 420 print "#if defined (OS_WIN)"
420 stdcall = CREATE_METHOD_FUNCTOR_TEMPLATE.replace("U::", "__stdcall U::") 421 stdcall_method = CREATE_METHOD_FUNCTOR_TEMPLATE
421 stdcall = FixCode(stdcall % args) 422 stdcall_method = stdcall_method.replace("U::", "__stdcall U::")
422 print stdcall 423 stdcall_method = FixCode(stdcall_method % args)
424 print stdcall_method
425 # Functor for free function with __stdcall calling conventions.
426 stdcall_function = CREATE_FUNCTION_FUNCTOR_TEMPLATE
427 stdcall_function = stdcall_function.replace("R (*", "R (__stdcall *");
428 print "\n", FixCode(stdcall_function % args)
429
423 print "#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" 430 print "#ifdef GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING"
424 stdcall2 = stdcall.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,") 431 stdcall2 = stdcall_method;
432 stdcall2 = stdcall2.replace("CreateFunctor(T* obj,", "CreateFunctor(T** obj,")
425 stdcall2 = stdcall2.replace("new Mutant", "new MutantLateObjectBind") 433 stdcall2 = stdcall2.replace("new Mutant", "new MutantLateObjectBind")
426 stdcall2 = stdcall2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple") 434 stdcall2 = stdcall2.replace(" " * 17 + "Tuple", " " * 31 + "Tuple")
427 print stdcall2 435 print stdcall2
428 print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING" 436 print "#endif // GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING"
429 print "#endif // OS_WIN\n" 437 print "#endif // OS_WIN\n"
430 438
431 439
432 def main(): 440 def main():
433 print HEADER 441 print HEADER
434 for prebound in xrange(0, 4 + 1): 442 for prebound in xrange(0, 4 + 1):
435 for args in xrange(0, 4 + 1): 443 for args in xrange(0, 4 + 1):
436 GenerateDispatch(prebound, args) 444 GenerateDispatch(prebound, args)
437 print MUTANT 445 print MUTANT
438 for prebound in xrange(0, 4 + 1): 446 for prebound in xrange(0, 4 + 1):
439 for args in xrange(0, 4 + 1): 447 for args in xrange(0, 4 + 1):
440 GenerateCreateFunctor(prebound, args) 448 GenerateCreateFunctor(prebound, args)
441 print FOOTER 449 print FOOTER
442 450
443 if __name__ == "__main__": 451 if __name__ == "__main__":
444 main() 452 main()
OLDNEW
« no previous file with comments | « no previous file | testing/gmock_mutant.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698