Ticket #446: warnings_nci_example.patch
| File warnings_nci_example.patch, 16.5 KB (added by ujwal, 4 years ago) |
|---|
-
src/embed.c
1293 1293 * before compiling a string 1294 1294 */ 1295 1295 if (! interp->initial_pf) { 1296 PackFile *pf =PackFile_new_dummy(interp, "compile_string");1296 /*PackFile *pf =*/ PackFile_new_dummy(interp, "compile_string"); 1297 1297 /* Assumption: there is no valid reason to fail to create it. 1298 1298 * If the assumption changes, replace the assertio with a 1299 1299 * runtime check -
src/oo.c
503 503 "Unrecognized class name PMC type"); 504 504 break; 505 505 } 506 return 0;506 /* return 0; */ /* warning C4702: unreachable code */ 507 507 } 508 508 509 509 -
src/ops/core.ops
917 917 _exit($2); 918 918 else { 919 919 opcode_t * const ret = expr NEXT(); 920 PMC *resume = new_ret_continuation_pmc(interp, ret); 921 PMC *exception = Parrot_ex_build_exception(interp, $1, 920 PMC *exception; 921 new_ret_continuation_pmc(interp, ret); 922 exception = Parrot_ex_build_exception(interp, $1, 922 923 $2, NULL); 924 { 923 925 opcode_t * const dest = Parrot_ex_throw_from_op(interp, 924 926 exception, ret); 925 927 goto ADDRESS(dest); 928 } 926 929 } 927 930 } 928 931 … … 1448 1451 else { 1449 1452 $1 = pmc_new(interp, enum_class_Hash); 1450 1453 } 1451 goto NEXT(); 1454 /* goto NEXT(); */ /* for non :flow ops this "goto NEXT()" macro is added at Parrot::OpsFile.pm in line 491-493 */ 1455 /* which is causing "warning C4702: unreachable code" */ 1452 1456 } 1453 1457 1454 1458 =item B<annotations>(out PMC, in STR) … … 1467 1471 else { 1468 1472 $1 = PMCNULL; 1469 1473 } 1470 goto NEXT(); 1474 /* goto NEXT(); */ /* for non :flow ops this "goto NEXT()" macro is added at Parrot::OpsFile.pm in line 491-493 */ 1475 /* which is causing "warning C4702: unreachable code" */ 1471 1476 } 1472 1477 1473 1478 =back -
src/string/encoding/fixed_8.c
149 149 __attribute__nonnull__(5) 150 150 FUNC_MODIFIES(*new_codepoints); 151 151 152 PARROT_DOES_NOT_RETURN 152 #ifndef _MSC_VER 153 PARROT_DOES_NOT_RETURN 154 #endif 153 155 PARROT_CANNOT_RETURN_NULL 154 156 static STRING * to_encoding(PARROT_INTERP, 155 157 SHIM(STRING *src), … … 229 231 230 232 */ 231 233 232 PARROT_DOES_NOT_RETURN 234 #ifndef _MSC_VER 235 PARROT_DOES_NOT_RETURN 236 #endif 233 237 PARROT_CANNOT_RETURN_NULL 234 238 static STRING * 235 239 to_encoding(PARROT_INTERP, SHIM(STRING *src), SHIM(STRING *dest)) -
src/string/encoding.c
148 148 */ 149 149 150 150 PARROT_EXPORT 151 PARROT_DOES_NOT_RETURN 151 152 #ifndef _MSC_VER 153 PARROT_DOES_NOT_RETURN 154 #endif 155 PARROT_WARN_UNUSED_RESULT /* mentioned in the above comment */ 152 156 PARROT_CANNOT_RETURN_NULL 153 157 const ENCODING * 154 158 Parrot_load_encoding(PARROT_INTERP, ARGIN(const char *encodingname)) … … 438 442 */ 439 443 440 444 PARROT_EXPORT 441 PARROT_DOES_NOT_RETURN 445 #ifndef _MSC_VER 446 PARROT_DOES_NOT_RETURN 447 #endif 442 448 encoding_converter_t 443 449 Parrot_find_encoding_converter(PARROT_INTERP, ARGIN(ENCODING *lhs), ARGIN(ENCODING *rhs)) 444 450 { -
src/thread.c
500 500 PMC *sub_arg; 501 501 PMC * const self = (PMC*) arg; 502 502 PMC *ret_val = NULL; 503 Parrot_Interp interp = (Parrot_Interp)VTABLE_get_pointer(interp, self); 503 Parrot_Interp interp = NULL; 504 505 interp = (Parrot_Interp)VTABLE_get_pointer(interp, self); 504 506 505 507 Parrot_block_GC_mark(interp); 506 508 Parrot_block_GC_sweep(interp); … … 628 630 629 631 if (PMC_IS_NULL(dval)) { 630 632 PMC * const copy = make_local_copy(d, s, val); 631 Parrot_sub *val_sub ;633 Parrot_sub *val_sub = NULL; 632 634 633 635 if (val->vtable->base_type == enum_class_Sub) 634 636 PMC_get_sub(interp, val, val_sub); -
src/packfile.c
865 865 ASSERT_ARGS(do_sub_pragmas) 866 866 PackFile_FixupTable * const ft = self->fixups; 867 867 PackFile_ConstTable * const ct = self->const_table; 868 PackFile * const pf = self->base.pf;868 /*PackFile * const pf = self->base.pf;*/ 869 869 opcode_t i; 870 870 871 871 TRACE_PRINTF(("PackFile: do_sub_pragmas (action=%d)\n", action)); -
src/spf_render.c
110 110 * around for us. 111 111 */ 112 112 #ifdef _MSC_VER 113 #pragma warning(push) 114 #pragma warning(disable:4005) 113 115 # define snprintf _snprintf 116 #pragma warning(pop) 114 117 #endif 115 118 116 119 /* -
CREDITS
901 901 U: ujwalic 902 902 E: ujwalic@gmail.com 903 903 D: OpenGL/GLUT include file order with MSVS 904 D: Fixed and updated Qt/NCI example for Windows 905 D: Cleaned up warnings on Windows 904 906 905 907 N: Uri Guttman 906 908 D: Lot of general Parrot design hints -
include/parrot/encoding.h
111 111 __attribute__nonnull__(2); 112 112 113 113 PARROT_EXPORT 114 PARROT_DOES_NOT_RETURN 114 #ifndef _MSC_VER 115 PARROT_DOES_NOT_RETURN 116 #endif 115 117 encoding_converter_t Parrot_find_encoding_converter(PARROT_INTERP, 116 118 ARGIN(ENCODING *lhs), 117 119 ARGIN(ENCODING *rhs)) … … 125 127 const ENCODING* Parrot_get_encoding(SHIM_INTERP, INTVAL number_of_encoding); 126 128 127 129 PARROT_EXPORT 128 PARROT_DOES_NOT_RETURN 130 #ifndef _MSC_VER 131 PARROT_DOES_NOT_RETURN 132 #endif 129 133 PARROT_CANNOT_RETURN_NULL 130 134 const ENCODING * Parrot_load_encoding(PARROT_INTERP, 131 135 ARGIN(const char *encodingname)) -
config/gen/platform/win32/exec.c
213 213 { 214 214 /* Allocate space for another pointer in **argv. */ 215 215 argc++; 216 #pragma warning(push) 217 #pragma warning(disable:4090) 216 218 argv = mem_sys_realloc(argv, (argc + 1) * sizeof (int)); 219 #pragma warning(pop) 217 220 *(argv + (argc - 1)) = tmp; 218 221 *(argv + argc) = NULL; 219 222 } -
config/gen/platform/win32/stat.c
110 110 result = -1; 111 111 break; 112 112 case STAT_ACCESSTIME: 113 #pragma warning(push) 114 #pragma warning(disable:4244) 113 115 result = statbuf->st_atime; 114 116 break; 115 117 case STAT_MODIFYTIME: … … 117 119 break; 118 120 case STAT_CHANGETIME: 119 121 result = statbuf->st_ctime; 122 #pragma warning(pop) 120 123 break; 121 124 case STAT_BACKUPTIME: 122 125 result = -1; -
examples/nci/QtHelloWorld.pasm
11 11 12 12 =head1 DESCRIPTION 13 13 14 Sample "Hello World" with Qt, via Parrot Native Call Interface ( nci). See14 Sample "Hello World" with Qt, via Parrot Native Call Interface (NCI). See 15 15 F<docs/pdds/pdd03_calling_conventions.pod>. 16 16 17 Qt is a multiplatform C++ GUI applicationframework18 (L http://doc.trolltech.com/3.1/aboutqt.html>). You'll need to build19 F<libPQt.so> and install it in F<runtime/parrot/dynext> for this to17 Qt - A cross-platform application and UI framework 18 (L<http://www.qtsoftware.com/about/news/lgpl-license-option-added-to-qt>). You'll need to build 19 F<libPQt.so> or F<PQt.dll> and install it in F<runtime/parrot/dynext> for this to 20 20 work, see F<examples/nci/PQt.C> for more information. 21 21 22 22 Note that this will either need JIT for building the NCI-functions on … … 35 35 set P2, P5 # remember pApp 36 36 37 37 # get and invoke QLabel_new 38 set S5, "Hello, world!"39 38 dlfunc P0, P1, "QLabel_new", "pt" 40 39 # if you need more labels, save P0 = QLabel_new() function 40 set_args "0", "Hello, world!" 41 get_results "0", P5 41 42 invokecc P0 42 43 set P6, P5 # save pLabel 43 44 44 45 # size the QLabel 45 set I5, 30 # y46 set I6, 120 # x47 46 dlfunc P0, P1, "QLabel_resize", "vpii" 47 set_args "0,0,0", P6, 120, 30 48 48 invokecc P0 49 49 50 # register the label51 dlfunc P0, P1, "QApplication_setMainWidget", "vpp"52 set P5, P6 # pLabel53 set P6, P2 # pApp54 invokecc P055 # P5 = label56 50 dlfunc P0, P1, "QLabel_show", "vp" 57 51 invokecc P0 58 52 59 53 # and go 60 54 dlfunc P0, P1,"QApplication_exec", "vp" 61 set P5, P2 # app55 set_args "0", P2 62 56 invokecc P0 63 57 end 64 58 -
examples/nci/PQt.C
1 /*2 3 # Copyright (C) 2001-2003, Parrot Foundation.4 # $Id$5 6 =head1 NAME7 8 examples/nci/PQt.C - Qt/Parrot Library9 10 =head1 SYNOPSIS11 12 Compile with:13 14 g++ -fPIC -I$QTDIR/include -L$QTDIR -c PQt.C15 16 gcc -shared -o libPQt.so PQt.o $QTDIR/lib/libqt.so17 18 Or something like that...19 20 =head1 DESCRIPTION21 22 Qt Native interface for Parrot. See F<examples/nci/QtHelloWorld.pasm>23 for more information.24 25 =cut26 27 */28 29 #include <qapplication.h>30 #include <qlabel.h>31 extern "C" {32 #include <stdio.h>33 #include <dlfcn.h>34 35 QApplication * pApp;36 37 /*38 39 =head2 QApplication bindings40 41 =over 442 43 =item C<QApplication *QApplication_new(void)>44 45 =cut46 47 */48 QApplication *QApplication_new(void) {49 int PQtargc = 0;50 char *PQtargv[2];51 PQtargv[0] = "";52 PQtargv[1] = NULL;53 pApp = new QApplication(PQtargc, PQtargv);54 return pApp;55 }56 57 /*58 59 =item C<void QApplication_exec(QApplication *app)>60 61 =cut62 63 */64 65 void QApplication_exec(QApplication *app)66 {67 app->exec();68 }69 70 /*71 72 =item C<void QApplication_setMainWidget(QApplication *app, QWidget *w)>73 74 =cut75 76 */77 78 void QApplication_setMainWidget(QApplication *app, QWidget *w)79 {80 app->setMainWidget(w);81 }82 83 /*84 85 =back86 87 =head2 QLabel bindings88 89 =over 490 91 =item C<QLabel * QLabel_new(const char *txt)>92 93 =cut94 95 */96 97 QLabel * QLabel_new(const char *txt)98 {99 QLabel * pLabel = new QLabel(txt, 0);100 return pLabel;101 }102 103 /*104 105 =item C<void QLabel_show(QLabel *label)>106 107 =cut108 109 */110 111 void QLabel_show(QLabel *label)112 {113 label->show();114 }115 116 /*117 118 =item C<void QLabel_resize(QLabel *label, int x, int y)>119 120 =cut121 122 */123 124 void QLabel_resize(QLabel *label, int x, int y)125 {126 label->resize(x, y);127 }128 129 }130 131 /*132 133 =back134 135 =head1 SEE ALSO136 137 F<examples/nci/QtHelloWorld.pasm>,138 F<docs/pdds/pdd03_calling_conventions.pod>.139 140 =cut141 142 */143 144 /*145 * Local variables:146 * c-file-style: "parrot"147 * End:148 * vim: expandtab shiftwidth=4:149 */ -
examples/nci/PQt.cpp
1 /* 2 3 # Copyright (C) 2001-2003, Parrot Foundation. 4 # $Id: PQt.C 37201 2009-03-08 12:07:48Z fperrad $ 5 6 =head1 NAME 7 8 examples/nci/PQt.cpp - Qt/Parrot Library 9 10 =head1 SYNOPSIS 11 12 Compile with: 13 14 *NIX: 15 16 $ g++ -fPIC -I$QTDIR/include -I$QTDIR/include/QtGui -L$QTDIR -c PQt.cpp 17 18 $ gcc -shared -o libPQt.so PQt.o $QTDIR/lib/libQtCore4.so $QTDIR/lib/libQtGui4.so 19 20 Windows: 21 22 > "%VS90COMNTOOLS%\vsvars32.bat" 23 24 > set INCLUDE=%QTDIR%\include;%QTDIR%\include\QtGui;%INCLUDE% 25 26 > set LIB=%QTDIR%\lib;%LIB% 27 28 > cl /LD PQt.cpp QtGui4.lib QtCore4.lib 29 30 Or something like that... 31 32 =head1 DESCRIPTION 33 34 Qt Native interface for Parrot. See F<examples/nci/QtHelloWorld.pir> 35 for more information. 36 37 =cut 38 39 */ 40 41 #ifdef _WIN32 42 #define PQT_API __declspec(dllexport) 43 #else 44 #define PQT_API 45 #endif 46 47 #include <QtGui> 48 extern "C" { 49 50 PQT_API QApplication * pApp; 51 52 /* 53 54 =head2 QApplication bindings 55 56 =over 4 57 58 =item C<QApplication *QApplication_new(void)> 59 60 =cut 61 62 */ 63 PQT_API QApplication *QApplication_new(void) { 64 int PQtargc = 0; 65 char *PQtargv[2]; 66 PQtargv[0] = ""; 67 PQtargv[1] = NULL; 68 pApp = new QApplication(PQtargc, PQtargv); 69 return pApp; 70 } 71 72 /* 73 74 =item C<void QApplication_exec(QApplication *app)> 75 76 =cut 77 78 */ 79 80 PQT_API void QApplication_exec(QApplication *app) 81 { 82 app->exec(); 83 } 84 85 /* 86 87 =back 88 89 =head2 QLabel bindings 90 91 =over 4 92 93 =item C<QLabel * QLabel_new(const char *txt)> 94 95 =cut 96 97 */ 98 99 PQT_API QLabel * QLabel_new(const char *txt) 100 { 101 QLabel * pLabel = new QLabel(txt, 0); 102 return pLabel; 103 } 104 105 /* 106 107 =item C<void QLabel_show(QLabel *label)> 108 109 =cut 110 111 */ 112 113 PQT_API void QLabel_show(QLabel *label) 114 { 115 label->show(); 116 } 117 118 /* 119 120 =item C<void QLabel_resize(QLabel *label, int x, int y)> 121 122 =cut 123 124 */ 125 126 PQT_API void QLabel_resize(QLabel *label, int x, int y) 127 { 128 label->resize(x, y); 129 } 130 131 } 132 133 /* 134 135 =back 136 137 =head1 SEE ALSO 138 139 F<examples/nci/QtHelloWorld.pir>, 140 F<docs/pdds/pdd03_calling_conventions.pod>. 141 142 =cut 143 144 */ 145 146 /* 147 * Local variables: 148 * c-file-style: "parrot" 149 * End: 150 * vim: expandtab shiftwidth=4: 151 */ -
examples/nci/QtHelloWorld.pir
1 # Copyright (C) 2001-2003, Parrot Foundation. 2 # $Id: QtHelloWorld.pasm 37201 2009-03-08 12:07:48Z fperrad $ 3 4 =head1 NAME 5 6 examples/nci/QtHelloWorld.pir - Qt Example 7 8 =head1 SYNOPSIS 9 10 % ./parrot examples/nci/QtHelloWorld.pir 11 12 =head1 DESCRIPTION 13 14 Sample "Hello World" with Qt, via Parrot Native Call Interface (NCI). See 15 F<docs/pdds/pdd03_calling_conventions.pod>. 16 17 Qt - A cross-platform application and UI framework 18 (L<http://www.qtsoftware.com/about/news/lgpl-license-option-added-to-qt>). You'll need to build 19 F<libPQt.so> or F<PQt.dll> and install it in F<runtime/parrot/dynext> for this to 20 work, see F<examples/nci/PQt.C> for more information. 21 22 Note that this will either need JIT for building the NCI-functions on 23 the fly. If this is not available try adding missing signatures to 24 F<src/call_list.txt> and rebuilding Parrot. 25 26 =cut 27 .sub main 28 29 .local pmc libpqt 30 loadlib libpqt, "libPQt" 31 if libpqt goto loaded 32 33 failed: 34 .local string message 35 message = 'Install PQt.dll or libPQt.so into runtime/parrot/dynext' 36 die message 37 38 loaded: 39 print "Loaded\n" 40 41 .local pmc QApplication_new, pApp 42 dlfunc QApplication_new, libpqt, "QApplication_new", "pv" 43 pApp = QApplication_new() 44 45 .local pmc QLabel_new, pLabel 46 .local string caption 47 caption = "Hello, world!" 48 dlfunc QLabel_new, libpqt, "QLabel_new", "pt" 49 pLabel = QLabel_new(caption) 50 51 .local pmc QLabel_resize 52 dlfunc QLabel_resize, libpqt, "QLabel_resize", "vpii" 53 QLabel_resize(pLabel, 120, 30) 54 55 .local pmc QLabel_show 56 dlfunc QLabel_show, libpqt, "QLabel_show", "vp" 57 QLabel_show(pLabel) 58 59 .local pmc QApplication_exec 60 dlfunc QApplication_exec, libpqt,"QApplication_exec", "vp" 61 QApplication_exec(pApp) 62 63 .end 64 65 =head1 SEE ALSO 66 67 F<examples/nci/PQt.C>, F<docs/pdds/pdd03_calling_conventions.pod>. 68 69 =cut
