You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Dave Watson (Created) (JIRA)" <ji...@apache.org> on 2011/12/07 23:18:40 UTC
[jira] [Created] (THRIFT-1452) generate a swap() method for all
generated structs
generate a swap() method for all generated structs
---------------------------------------------------
Key: THRIFT-1452
URL: https://issues.apache.org/jira/browse/THRIFT-1452
Project: Thrift
Issue Type: Improvement
Components: C++ - Library
Reporter: Dave Watson
Priority: Minor
Attachments: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
>From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
From: Adam Simpkins <si...@fb.com>
Date: Mon, 21 Jun 2010 20:24:50 +0000
Subject: [PATCH 3/5] generate a swap() method for all generated structs
Summary:
Andrei mentioned it would be convenient if thrift generated swap()
methods for all C++ thrift types. Apparently the ads team manually
writes swap() functions for many of their thrift data types, but have to
keep updating them by hand when new fields are added to the thrift
interface.
This updates the thrift compiler to emit swap() methods for user-defined
types. For now, I decided not to emit swap() methods for the internal
XXX_args, XXX_pargs, XXX_result, and XXX_presult types.
Test Plan:
Tested compiling serveral internal projects.
I didn't actually test the generated swap() functions, but they look
okay.
DiffCamp Revision: 124773
Reviewed By: aalexandre
Commenters: dreiss, edhall
CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
thrift-team@lists
Revert Plan:
OK
git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
---
compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
1 files changed, 67 insertions(+), 3 deletions(-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1452) generate a swap() method for all
generated structs
Posted by "Dave Watson (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13165366#comment-13165366 ]
Dave Watson commented on THRIFT-1452:
-------------------------------------
Nope no reason it looks unused in our codebase as well.
{code}
diff --git a/compiler/cpp/src/generate/t_cpp_generator.cc b/compiler/cpp/src/generate/t_cpp_generator.cc
index 0354a5f..1f542d2 100755
--- a/compiler/cpp/src/generate/t_cpp_generator.cc
+++ b/compiler/cpp/src/generate/t_cpp_generator.cc
@@ -1511,7 +1511,6 @@ void t_cpp_generator::generate_struct_swap(ofstream& out, t_struct* tstruct) {
f_iter != fields.end();
++f_iter) {
t_field *tfield = *f_iter;
- t_type *ttype = get_true_type(tfield->get_type());
if (tfield->get_req() != t_field::T_REQUIRED) {
has_nonrequired_fields = true;
{code}
> generate a swap() method for all generated structs
> ---------------------------------------------------
>
> Key: THRIFT-1452
> URL: https://issues.apache.org/jira/browse/THRIFT-1452
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Reporter: Dave Watson
> Priority: Minor
> Attachments: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
>
>
> From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
> From: Adam Simpkins <si...@fb.com>
> Date: Mon, 21 Jun 2010 20:24:50 +0000
> Subject: [PATCH 3/5] generate a swap() method for all generated structs
> Summary:
> Andrei mentioned it would be convenient if thrift generated swap()
> methods for all C++ thrift types. Apparently the ads team manually
> writes swap() functions for many of their thrift data types, but have to
> keep updating them by hand when new fields are added to the thrift
> interface.
> This updates the thrift compiler to emit swap() methods for user-defined
> types. For now, I decided not to emit swap() methods for the internal
> XXX_args, XXX_pargs, XXX_result, and XXX_presult types.
> Test Plan:
> Tested compiling serveral internal projects.
> I didn't actually test the generated swap() functions, but they look
> okay.
> DiffCamp Revision: 124773
> Reviewed By: aalexandre
> Commenters: dreiss, edhall
> CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
> thrift-team@lists
> Revert Plan:
> OK
> git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
> ---
> compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
> 1 files changed, 67 insertions(+), 3 deletions(-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1452) generate a swap() method for all
generated structs
Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166579#comment-13166579 ]
Hudson commented on THRIFT-1452:
--------------------------------
Integrated in Thrift #358 (See [https://builds.apache.org/job/Thrift/358/])
THRIFT-1452 generate a swap() method for all generated structs
fix compiler warnings, when having empty structs
roger : http://svn.apache.org/viewvc/?view=rev&rev=1212593
Files :
* /thrift/trunk/compiler/cpp/src/generate/t_cpp_generator.cc
> generate a swap() method for all generated structs
> ---------------------------------------------------
>
> Key: THRIFT-1452
> URL: https://issues.apache.org/jira/browse/THRIFT-1452
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Reporter: Dave Watson
> Assignee: Dave Watson
> Priority: Minor
> Fix For: 0.9
>
> Attachments: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
>
>
> From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
> From: Adam Simpkins <si...@fb.com>
> Date: Mon, 21 Jun 2010 20:24:50 +0000
> Subject: [PATCH 3/5] generate a swap() method for all generated structs
> Summary:
> Andrei mentioned it would be convenient if thrift generated swap()
> methods for all C++ thrift types. Apparently the ads team manually
> writes swap() functions for many of their thrift data types, but have to
> keep updating them by hand when new fields are added to the thrift
> interface.
> This updates the thrift compiler to emit swap() methods for user-defined
> types. For now, I decided not to emit swap() methods for the internal
> XXX_args, XXX_pargs, XXX_result, and XXX_presult types.
> Test Plan:
> Tested compiling serveral internal projects.
> I didn't actually test the generated swap() functions, but they look
> okay.
> DiffCamp Revision: 124773
> Reviewed By: aalexandre
> Commenters: dreiss, edhall
> CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
> thrift-team@lists
> Revert Plan:
> OK
> git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
> ---
> compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
> 1 files changed, 67 insertions(+), 3 deletions(-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1452) generate a swap() method for all
generated structs
Posted by "Jake Farrell (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13164937#comment-13164937 ]
Jake Farrell commented on THRIFT-1452:
--------------------------------------
Line 1514 of t_cpp_generator.cc in the generate_struct_swap function has an unused variable ‘ttype’, any reason for this or can it be removed?
t_type *ttype = get_true_type(tfield->get_type());
> generate a swap() method for all generated structs
> ---------------------------------------------------
>
> Key: THRIFT-1452
> URL: https://issues.apache.org/jira/browse/THRIFT-1452
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Reporter: Dave Watson
> Priority: Minor
> Attachments: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
>
>
> From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
> From: Adam Simpkins <si...@fb.com>
> Date: Mon, 21 Jun 2010 20:24:50 +0000
> Subject: [PATCH 3/5] generate a swap() method for all generated structs
> Summary:
> Andrei mentioned it would be convenient if thrift generated swap()
> methods for all C++ thrift types. Apparently the ads team manually
> writes swap() functions for many of their thrift data types, but have to
> keep updating them by hand when new fields are added to the thrift
> interface.
> This updates the thrift compiler to emit swap() methods for user-defined
> types. For now, I decided not to emit swap() methods for the internal
> XXX_args, XXX_pargs, XXX_result, and XXX_presult types.
> Test Plan:
> Tested compiling serveral internal projects.
> I didn't actually test the generated swap() functions, but they look
> okay.
> DiffCamp Revision: 124773
> Reviewed By: aalexandre
> Commenters: dreiss, edhall
> CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
> thrift-team@lists
> Revert Plan:
> OK
> git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
> ---
> compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
> 1 files changed, 67 insertions(+), 3 deletions(-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (THRIFT-1452) generate a swap() method for all
generated structs
Posted by "Jake Farrell (Closed) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jake Farrell closed THRIFT-1452.
--------------------------------
Resolution: Fixed
Fix Version/s: 0.9
Assignee: Dave Watson
Thanks Dave, committed
> generate a swap() method for all generated structs
> ---------------------------------------------------
>
> Key: THRIFT-1452
> URL: https://issues.apache.org/jira/browse/THRIFT-1452
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Reporter: Dave Watson
> Assignee: Dave Watson
> Priority: Minor
> Fix For: 0.9
>
> Attachments: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
>
>
> From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
> From: Adam Simpkins <si...@fb.com>
> Date: Mon, 21 Jun 2010 20:24:50 +0000
> Subject: [PATCH 3/5] generate a swap() method for all generated structs
> Summary:
> Andrei mentioned it would be convenient if thrift generated swap()
> methods for all C++ thrift types. Apparently the ads team manually
> writes swap() functions for many of their thrift data types, but have to
> keep updating them by hand when new fields are added to the thrift
> interface.
> This updates the thrift compiler to emit swap() methods for user-defined
> types. For now, I decided not to emit swap() methods for the internal
> XXX_args, XXX_pargs, XXX_result, and XXX_presult types.
> Test Plan:
> Tested compiling serveral internal projects.
> I didn't actually test the generated swap() functions, but they look
> okay.
> DiffCamp Revision: 124773
> Reviewed By: aalexandre
> Commenters: dreiss, edhall
> CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
> thrift-team@lists
> Revert Plan:
> OK
> git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
> ---
> compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
> 1 files changed, 67 insertions(+), 3 deletions(-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (THRIFT-1452) generate a swap() method for all
generated structs
Posted by "Dave Watson (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1452?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Dave Watson updated THRIFT-1452:
--------------------------------
Attachment: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
> generate a swap() method for all generated structs
> ---------------------------------------------------
>
> Key: THRIFT-1452
> URL: https://issues.apache.org/jira/browse/THRIFT-1452
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Reporter: Dave Watson
> Priority: Minor
> Attachments: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
>
>
> From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
> From: Adam Simpkins <si...@fb.com>
> Date: Mon, 21 Jun 2010 20:24:50 +0000
> Subject: [PATCH 3/5] generate a swap() method for all generated structs
> Summary:
> Andrei mentioned it would be convenient if thrift generated swap()
> methods for all C++ thrift types. Apparently the ads team manually
> writes swap() functions for many of their thrift data types, but have to
> keep updating them by hand when new fields are added to the thrift
> interface.
> This updates the thrift compiler to emit swap() methods for user-defined
> types. For now, I decided not to emit swap() methods for the internal
> XXX_args, XXX_pargs, XXX_result, and XXX_presult types.
> Test Plan:
> Tested compiling serveral internal projects.
> I didn't actually test the generated swap() functions, but they look
> okay.
> DiffCamp Revision: 124773
> Reviewed By: aalexandre
> Commenters: dreiss, edhall
> CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
> thrift-team@lists
> Revert Plan:
> OK
> git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
> ---
> compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
> 1 files changed, 67 insertions(+), 3 deletions(-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (THRIFT-1452) generate a swap() method for all
generated structs
Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/THRIFT-1452?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13165688#comment-13165688 ]
Hudson commented on THRIFT-1452:
--------------------------------
Integrated in Thrift #355 (See [https://builds.apache.org/job/Thrift/355/])
Thrift-1452: generate a swap() method for all generated structs
Client: cpp
Patch: Dave Watson
Convenience method for all C++ thrift types to add swap() function
> generate a swap() method for all generated structs
> ---------------------------------------------------
>
> Key: THRIFT-1452
> URL: https://issues.apache.org/jira/browse/THRIFT-1452
> Project: Thrift
> Issue Type: Improvement
> Components: C++ - Library
> Reporter: Dave Watson
> Assignee: Dave Watson
> Priority: Minor
> Fix For: 0.9
>
> Attachments: 0003-thrift-generate-a-swap-method-for-all-generated-stru.patch
>
>
> From baa275da65e023af50930a75f9a7ef2a991cdaef Mon Sep 17 00:00:00 2001
> From: Adam Simpkins <si...@fb.com>
> Date: Mon, 21 Jun 2010 20:24:50 +0000
> Subject: [PATCH 3/5] generate a swap() method for all generated structs
> Summary:
> Andrei mentioned it would be convenient if thrift generated swap()
> methods for all C++ thrift types. Apparently the ads team manually
> writes swap() functions for many of their thrift data types, but have to
> keep updating them by hand when new fields are added to the thrift
> interface.
> This updates the thrift compiler to emit swap() methods for user-defined
> types. For now, I decided not to emit swap() methods for the internal
> XXX_args, XXX_pargs, XXX_result, and XXX_presult types.
> Test Plan:
> Tested compiling serveral internal projects.
> I didn't actually test the generated swap() functions, but they look
> okay.
> DiffCamp Revision: 124773
> Reviewed By: aalexandre
> Commenters: dreiss, edhall
> CC: davidrecordon, achao, dreiss, kholst, aalexandre, simpkins, edhall,
> thrift-team@lists
> Revert Plan:
> OK
> git-svn-id: svn+ssh://tubbs/svnapps/fbomb/trunk/[internal fb thing]@30392 2248de34-8caa-4a3c-bc55-5e52d9d7b73a
> ---
> compiler/cpp/src/generate/t_cpp_generator.cc | 70 ++++++++++++++++++++++++-
> 1 files changed, 67 insertions(+), 3 deletions(-)
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira