1
/***************************************************************************
2
* Copyright (C) 2000-2001 by Bernd Gehrmann *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 2 of the License, or *
8
* (at your option) any later version. *
10
***************************************************************************/
12
#include <qapplication.h>
14
#include <qvbuttongroup.h>
15
#include <qradiobutton.h>
16
#include <qvaluelist.h>
17
#include <qtabwidget.h>
22
#include <kgenericfactory.h>
24
#include "flagboxes.h"
25
#include "gccoptionsplugin.h"
27
K_EXPORT_COMPONENT_FACTORY( libkdevgccoptions, KGenericFactory<GccOptionsPlugin>( "kdevgccoptions" ) )
29
class GeneralTab : public QWidget
32
GeneralTab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 );
35
void readFlags( QStringList *str );
36
void writeFlags( QStringList *str );
39
FlagCheckBoxController *controller;
43
class OptimizationTab : public QWidget
46
OptimizationTab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 );
49
void readFlags( QStringList *str );
50
void writeFlags( QStringList *str );
53
QRadioButton *Odefault, *O0, *O1, *O2;
58
class G77Tab : public QWidget
61
G77Tab( QWidget *parent = 0, const char *name = 0 );
64
void readFlags( QStringList *str );
65
void writeFlags( QStringList *str );
68
FlagCheckBoxController *controller;
72
class Warnings1Tab : public QWidget
75
Warnings1Tab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 );
78
void readFlags( QStringList *str );
79
void writeFlags( QStringList *str );
82
FlagCheckBoxController *controller;
87
class Warnings2Tab : public QWidget
90
Warnings2Tab( GccOptionsPlugin::Type type, QWidget *parent = 0, const char *name = 0 );
93
void readFlags( QStringList *str );
94
void writeFlags( QStringList *str );
97
FlagListBox *wrestBox;
101
GeneralTab::GeneralTab( GccOptionsPlugin::Type type, QWidget *parent, const char *name )
102
: QWidget( parent, name ), controller( new FlagCheckBoxController )
104
QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
105
layout->setAutoAdd( true );
106
layout->addSpacing( 10 );
108
QVButtonGroup *output_group = new QVButtonGroup( i18n( "Output" ), this );
109
new FlagCheckBox( output_group, controller,
110
"-fsyntax-only", i18n( "Only check the code for syntax errors, do not produce object code" ) );
111
new FlagCheckBox( output_group, controller,
112
"-pg", i18n( "Generate extra code to write profile information for gprof" ) );
113
new FlagCheckBox( output_group, controller,
114
"-save-temps", i18n( "Do not delete intermediate output like assembler files" ) );
116
QApplication::sendPostedEvents( this, QEvent::ChildInserted );
117
layout->addSpacing( 10 );
119
QVButtonGroup *codegen_group = new QVButtonGroup( i18n( "Code Generation" ), this );
120
if ( type != GccOptionsPlugin::GPP )
122
new FlagCheckBox( codegen_group, controller,
123
"-fexceptions", i18n( "Enable exception handling" ),
128
new FlagCheckBox( codegen_group, controller,
129
"-fno-exceptions", i18n( "Disable exception handling" ),
132
// The following two are somehow mutually exclusive, but the default is
133
// platform-dependent, so if we would leave out one of them, we wouldn't
134
// know how to set the remaining one.
135
new FlagCheckBox( codegen_group, controller,
136
"-fpcc-struct-return", i18n( "Return certain struct and union values in memory rather than in registers" ) );
137
new FlagCheckBox( codegen_group, controller,
138
"-freg-struct-return", i18n( "Return certain struct and union values in registers when possible" ) );
139
new FlagCheckBox( codegen_group, controller,
140
"-short-enums", i18n( "For an enum, choose the smallest possible integer type" ) );
141
new FlagCheckBox( codegen_group, controller,
142
"-short-double", i18n( "Make 'double' the same as 'float'" ) );
144
QApplication::sendPostedEvents( this, QEvent::ChildInserted );
145
layout->addStretch();
149
GeneralTab::~GeneralTab()
155
void GeneralTab::readFlags( QStringList *list )
157
controller->readFlags( list );
161
void GeneralTab::writeFlags( QStringList *list )
163
controller->writeFlags( list );
167
OptimizationTab::OptimizationTab( GccOptionsPlugin::Type type, QWidget *parent, const char *name )
168
: QWidget( parent, name )
170
QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
171
layout->setAutoAdd( true );
173
QVButtonGroup *group = new QVButtonGroup( i18n( "Optimization Level" ), this );
174
Odefault = new QRadioButton( i18n( "Default" ), group );
175
Odefault->setChecked( true );
176
O0 = new QRadioButton( i18n( "No optimization" ), group );
177
O1 = new QRadioButton( i18n( "Level 1" ), group );
178
O2 = new QRadioButton( i18n( "Level 2" ), group );
180
optBox = new FlagListBox( this );
182
new FlagListItem( optBox,
183
"-ffloat-store", i18n( "<qt>Do not store floating point variables in registers</qt>" ),
184
"-fno-float-store" );
185
new FlagListItem( optBox,
186
"-fno-defer-pop", i18n( "<qt>Pop the arguments to each function call directly "
187
"after the function returns</qt>" ),
189
new FlagListItem( optBox,
190
"-fforce-mem", i18n( "<qt>Force memory operands to be copied into registers before "
191
"doing arithmetic on them</qt>" ),
193
new FlagListItem( optBox,
194
"-fforce-addr", i18n( "<qt>Force memory address constants to be copied into registers before "
195
"doing arithmetic on them</qt>" ),
197
new FlagListItem( optBox,
198
"-fomit-frame-pointer", i18n( "<qt>Do not keep the frame pointer in a register for functions that "
199
"do not need one</qt>" ),
200
"-fno-omit-frame-pointer" );
201
new FlagListItem( optBox,
202
"-fno-inline", i18n( "<qt>Ignore the <i>inline</i> keyword</qt>" ),
205
if ( type == GccOptionsPlugin::GPP )
207
new FlagListItem( optBox,
208
"-fno-default-inline", i18n( "<qt>Do not make member functions inline merely because they "
209
"are defined inside the class scope</qt>" ),
210
"-fdefault-inline" );
213
QApplication::sendPostedEvents( this, QEvent::ChildInserted );
214
layout->addStretch();
218
OptimizationTab::~OptimizationTab()
222
void OptimizationTab::readFlags( QStringList *list )
224
optBox->readFlags( list );
226
QStringList::Iterator sli;
227
sli = list->find( "-O0" );
228
if ( sli != list->end() )
230
O0->setChecked( true );
234
sli = list->find( "-O1" );
235
if ( sli != list->end() )
237
O1->setChecked( true );
241
sli = list->find( "-O2" );
242
if ( sli != list->end() )
244
O2->setChecked( true );
251
void OptimizationTab::writeFlags( QStringList *list )
253
optBox->writeFlags( list );
255
if ( O0->isChecked() )
257
else if ( O1->isChecked() )
259
else if ( O2->isChecked() )
264
G77Tab::G77Tab( QWidget *parent, const char *name )
265
: QWidget( parent, name ), controller( new FlagCheckBoxController )
267
QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
268
layout->setAutoAdd( true );
269
layout->addSpacing( 10 );
271
QVButtonGroup *dialect_group = new QVButtonGroup( i18n( "Dialect" ), this );
272
new FlagCheckBox( dialect_group, controller,
273
"-ffree-form", i18n( "Interpret source code as Fortran 90 free form" ),
275
new FlagCheckBox( dialect_group, controller,
276
"-ff90", i18n( "Allow certain Fortran 90 constructs" ) );
277
new FlagCheckBox( dialect_group, controller,
278
"-fdollar-ok", i18n( "Allow '$' in symbol names" ) );
279
new FlagCheckBox( dialect_group, controller,
280
"-fbackslash", i18n( "Allow '\' in character constants to escape special characters" ),
282
new FlagCheckBox( dialect_group, controller,
283
"-fonetrip", i18n( "DO loops are executed at least once" ) );
285
QApplication::sendPostedEvents( this, QEvent::ChildInserted );
286
layout->addSpacing( 10 );
288
QVButtonGroup *codegen_group = new QVButtonGroup( i18n( "Code Generation" ), this );
289
new FlagCheckBox( codegen_group, controller,
290
"-fno-automatic", i18n( "Treat local variables as if SAVE statement had been specified" ) );
291
new FlagCheckBox( codegen_group, controller,
292
"-finit-local-zero", i18n( "Init local variables to zero" ) );
293
new FlagCheckBox( codegen_group, controller,
294
"-fbounds-check", i18n( "Generate run-time checks for array subscripts" ) );
296
QApplication::sendPostedEvents( this, QEvent::ChildInserted );
297
layout->addStretch();
307
void G77Tab::readFlags( QStringList *list )
309
controller->readFlags( list );
313
void G77Tab::writeFlags( QStringList *list )
315
controller->writeFlags( list );
319
Warnings1Tab::Warnings1Tab( GccOptionsPlugin::Type type, QWidget *parent, const char *name )
320
: QWidget( parent, name ), controller( new FlagCheckBoxController )
322
QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
323
layout->setAutoAdd( true );
325
new FlagCheckBox( this, controller,
326
"-w", i18n( "Inhibit all warnings" ) );
327
new FlagCheckBox( this, controller,
328
"-Wno-import", i18n( "Inhibit warnings about the use of #import" ) );
329
new FlagCheckBox( this, controller,
330
"-Werror", i18n( "Make all warnings into errors" ) );
331
new FlagCheckBox( this, controller,
332
"-pedantic", i18n( "Issue all warnings demanded by strict ANSI C or ISO C++" ) );
333
new FlagCheckBox( this, controller,
334
"-pedantic-errors", i18n( "Like -pedantic, but errors are produced instead of warnings" ) );
335
new FlagCheckBox( this, controller,
336
"-Wall", i18n( "All warnings below, combined (-Wall):" ) );
338
wallBox = new FlagListBox( this );
340
new FlagListItem( wallBox,
341
"-Wchar-subscripts", i18n( "<qt>Warn if an array subscript has type <i>char</i></qt>" ) );
342
new FlagListItem( wallBox,
343
"-Wcomment", i18n( "<qt>Warn when a comment-start sequence /* appears inside a comment</qt>" ) );
344
new FlagListItem( wallBox,
345
"-Wformat", i18n( "<qt>Check calls to <i>printf()</i>, <i>scanf()</i> etc\n"
346
"to make sure that the arguments supplied have types appropriate\n"
347
"to the format string specified, and that the conversions specified\n"
348
"in the format string make sense</qt>" ) );
349
new FlagListItem( wallBox,
350
"-Wformat=2", i18n( "<qt>Enable -Wformat plus format checks not \n"
351
"included in -Wformat. Currently equivalent to \n"
352
"`-Wformat -Wformat-nonliteral -Wformat-security \n"
353
"-Wformat-y2k'.</qt>" ) );
354
new FlagListItem( wallBox,
355
"-Wimplicit-int", i18n( "<qt>Warn when a declaration does not specify a type</qt>" ) );
356
new FlagListItem( wallBox,
357
"-Wimplicit-funtion-declaration",
358
i18n( "<qt>Issue a warning when a non-declared function is used</qt>" ) );
359
new FlagListItem( wallBox,
360
"-Werror-implicit-function-declaration",
361
i18n( "<qt>Issue an error when a non-declared function is used</qt>" ) );
362
new FlagListItem( wallBox,
363
"-Wmain", i18n( "<qt>Warn if the type of <i>main()</i> is suspicious</qt>" ) );
364
new FlagListItem( wallBox,
365
"-Wmultichar", i18n( "<qt>Warn when multicharacter constants are encountered</qt>" ) );
366
new FlagListItem( wallBox,
367
"-Wmissing-braces", i18n( "<qt>Warn if an aggregate or union initializer is not fully bracketed</qt>" ) );
368
new FlagListItem( wallBox,
369
"-Wparentheses", i18n( "<qt>Warn when parentheses are omitted in certain contexts</qt>" ) );
370
new FlagListItem( wallBox,
371
"-Wsequence-point", i18n( "<qt>Warn about code that may have undefined semantics because of\n"
372
"violations of sequence point rules in the C standard</qt>" ) );
373
new FlagListItem( wallBox,
374
"-Wreturn-type", i18n( "<qt>Warn when a function without explicit return type is defined</qt>" ) );
375
new FlagListItem( wallBox,
376
"-Wswitch", i18n( "<qt>Warn whenever a <i>switch</i> statement has an index of enumeral type\n"
377
"and lacks a <i>case</i> for one or more of the named codes of that enumeration</qt>" ) );
378
new FlagListItem( wallBox,
379
"-Wtrigraphs", i18n( "<qt>Warn when trigraphs are encountered</qt>" ) );
380
new FlagListItem( wallBox,
381
"-Wunused", i18n( "<qt>Warn when a variable is declared but not used</qt>" ) );
382
new FlagListItem( wallBox,
383
"-Wuninitialized", i18n( "<qt>Warn when a variable is used without being initialized first</qt>" ) );
384
new FlagListItem( wallBox,
385
"-Wunknown-pragmas", i18n( "<qt>Warn when an unknown #pragma statement is encountered</qt>" ) );
386
new FlagListItem( wallBox,
387
"-Wdiv-by-zero", i18n( "<qt>Warn when a division by zero occurs.</qt>" ) );
388
if ( type == GccOptionsPlugin::GPP )
390
new FlagListItem( wallBox,
391
"-Wreorder", i18n( "<qt>Warn when the order of member initializers is different from\n"
392
"the order in the class declaration</qt>" ) );
397
Warnings1Tab::~Warnings1Tab()
403
void Warnings1Tab::readFlags( QStringList *list )
405
controller->readFlags( list );
406
wallBox->readFlags( list );
410
void Warnings1Tab::writeFlags( QStringList *list )
412
controller->writeFlags( list );
413
wallBox->writeFlags( list );
417
Warnings2Tab::Warnings2Tab( GccOptionsPlugin::Type type, QWidget *parent, const char *name )
418
: QWidget( parent, name )
420
QBoxLayout * layout = new QVBoxLayout( this, KDialog::marginHint(), KDialog::spacingHint() );
421
layout->setAutoAdd( true );
423
wrestBox = new FlagListBox( this );
425
new FlagListItem( wrestBox,
426
"-W", i18n( "<qt>Set options not included in -Wall which are very specific</qt>" ) );
427
new FlagListItem( wrestBox,
428
"-Wfloat-equal", i18n( "<qt>Warn if floating point values are used in equality comparisons</qt>" ) );
429
new FlagListItem( wrestBox,
430
"-Wundef", i18n( "<qt>Warn if an undefined identifier is evaluated in an <i>#if</i> directive</qt>" ) );
431
new FlagListItem( wrestBox,
432
"-Wshadow", i18n( "<qt>Warn whenever a local variable shadows another local variable</qt>" ) );
433
new FlagListItem( wrestBox,
434
"-Wpointer-arith", i18n( "<qt>Warn about anything that depends on the <i>sizeof</i> a\n"
435
"function type or of <i>void</i></qt>" ) );
436
new FlagListItem( wrestBox,
437
"-Wcast-qual", i18n( "<qt>Warn whenever a pointer is cast so as to remove a type\n"
438
"qualifier from the target type</qt>" ) );
439
new FlagListItem( wrestBox,
440
"-Wcast-align", i18n( "<qt>Warn whenever a pointer is cast such that the required\n"
441
"alignment of the target is increased</qt>" ) );
442
new FlagListItem( wrestBox,
443
"-Wwrite-strings", i18n( "<qt>Warn when the address of a string constant is cast\n"
444
"into a non-const <i>char *</i> pointer</qt>" ) );
445
new FlagListItem( wrestBox,
446
"-Wconversion", i18n( "<qt>Warn if a prototype causes a type conversion that is different\n"
447
"from what would happen to the same argument in the absence\n"
448
"of a prototype</qt>" ) );
449
new FlagListItem( wrestBox,
450
"-Wsign-compare", i18n( "<qt>Warn when a comparison between signed and unsigned values\n"
451
"could produce an incorrect result when the signed value\n"
452
"is converted to unsigned</qt>" ) );
453
new FlagListItem( wrestBox,
454
"-Wmissing-noreturn", i18n( "<qt>Warn about functions which might be candidates for attribute 'noreturn'</qt>" ) );
455
new FlagListItem( wrestBox,
456
"-Waggregate-return", i18n( "<qt>Warn if any functions that return structures or unions are\n"
457
"defined or called</qt>" ) );
458
new FlagListItem( wrestBox,
459
"-Wmissing-declarations", i18n( "<qt>Warn if a global function is defined without a previous declaration</qt>" ) );
460
new FlagListItem( wrestBox,
461
"-Wno-deprecated-declarations",
462
i18n( "<qt>Do not warn about uses of functions, variables, and types marked as\n"
463
"deprecated by using the 'deprecated' attribute</qt>" ) );
464
new FlagListItem( wrestBox,
465
"-Wpacked", i18n( "<qt>Warn if a structure is given the packed attribute, but the packed\n"
466
"attribute has no effect on the layout or size of the structure</qt>" ) );
467
new FlagListItem( wrestBox,
468
"-Wpadded", i18n( "<qt>Warn if padding is included in a structure, either to align an\n"
469
"element of the structure or to align the whole structure</qt>" ) );
470
new FlagListItem( wrestBox,
471
"-Wredundant-decls", i18n( "<qt>Warn if anything is declared more than once in the same scope</qt>" ) );
472
new FlagListItem( wrestBox,
473
"-Wunreachable-code", i18n( "<qt>Warn if the compiler detects that code will never be executed</qt>" ) );
474
new FlagListItem( wrestBox,
475
"-Winline", i18n( "<qt>Warn if an <i>inline</i> function cannot be inlined</qt>" ) );
476
new FlagListItem( wrestBox,
477
"-Wlong-long", i18n( "<qt>Warn if the <i>long long</i> type is used</qt>" ) );
478
new FlagListItem( wrestBox,
479
"-Wdisabled-optimization", i18n( "<qt>Warn if a requested optimization pass is disabled</qt>" ) );
480
new FlagListItem( wrestBox,
481
"-Wno-div-by-zero", i18n( "<qt>Do not warn if there is a division by zero</qt>" ) );
483
if ( type == GccOptionsPlugin::GCC )
485
new FlagListItem( wrestBox,
486
"-Wtraditional", i18n( "<qt>Warn about certain constructs that behave differently\n"
487
"in traditional and ANSI C</qt>" ) );
488
new FlagListItem( wrestBox,
489
"-Wbad-function-cast", i18n( "<qt>Warn whenever a function call is cast to a non-matching type</qt>" ) );
490
new FlagListItem( wrestBox,
491
"-Wstrict-prototypes", i18n( "<qt>Warn if a function is declared or defined without specifying\n"
492
"the argument types</qt>" ) );
493
new FlagListItem( wrestBox,
494
"-Wmissing-prototypes", i18n( "<qt>Warn if a global function is defined without a previous prototype declaration</qt>" ) );
495
new FlagListItem( wrestBox,
496
"-Wnested-externs", i18n( "<qt>Warn if an <i>extern</i> declaration is encountered within a function</qt>" ) );
500
if ( type == GccOptionsPlugin::GPP )
502
new FlagListItem( wrestBox,
503
"-Woverloaded-virtual", i18n( "<qt>Warn when a function declaration hides virtual\n"
504
"functions from a base class</qt>" ) );
505
new FlagListItem( wrestBox,
506
"-Wsynth", i18n( "<qt>Warn when g++'s synthesis behavior does\n"
507
"not match that of cfront</qt>" ) );
508
new FlagListItem( wrestBox,
509
"-Wctor-dtor-privacy", i18n( "<qt>Warn when a class seems unusable, because all the constructors or\n"
510
"destructors in a class are private and the class has no friends or\n"
511
"public static member functions</qt>" ) );
512
new FlagListItem( wrestBox,
513
"-Wnon-virtual-dtor", i18n( "<qt>Warn when a class declares a non-virtual destructor that should\n"
514
"probably be virtual, because it looks like the class will be used\n"
515
"polymorphically</qt>" ) );
516
new FlagListItem( wrestBox,
517
"-Wsign-promo", i18n( "<qt>Warn when overload resolution chooses a promotion from unsigned or\n"
518
"enumeral type to a signed type over a conversion to an unsigned\n"
519
"type of the same size. Previous versions of G++ would try to\n"
520
"preserve unsignedness, but the standard mandates the current behavior</qt>" ) );
521
new FlagListItem( wrestBox,
522
"-Wabi", i18n( "<qt>Warn when G++ generates code that is probably not compatible with\n"
523
"the vendor-neutral C++ ABI</qt>" ) );
524
/* new FlagListItem(wrestBox,
525
"-Wreorder", i18n("<qt>Warn when the order of member initializers given in the code does\n"
526
"not match the order in which they must be executed.</qt>"));*/
527
new FlagListItem( wrestBox,
528
"-Weffc++", i18n( "<qt>Warn about violations of the following style guidelines from Scott\n"
529
"Meyers' 'Effective C++' book:\n"
530
"* Item 11: Define a copy constructor and an assignment\n"
531
" operator for classes with dynamically allocated memory;\n"
532
"* Item 12: Prefer initialization to assignment in constructors;\n"
533
"* Item 14: Make destructors virtual in base classes;\n"
534
"* Item 15: Have `operator=' return a reference to `*this';\n"
535
"* Item 23: Do not try to return a reference when you must\n"
536
" return an object\n"
538
"and about violations of the following style guidelines from Scott\n"
539
"Meyers' 'More Effective C++' book:\n"
540
"* Item 6: Distinguish between prefix and postfix forms of\n"
541
" increment and decrement operators;\n"
542
"* Item 7: Never overload '&&', '||', or ','</qt>" ) );
543
new FlagListItem( wrestBox,
544
"-Wno-deprecated", i18n( "<qt>Do not warn about usage of deprecated features</qt>" ) );
545
new FlagListItem( wrestBox,
546
"-Wno-non-template-friend", i18n( "<qt>Disable warnings when non-templatized friend functions are declared\n"
547
"within a template</qt>" ) );
548
new FlagListItem( wrestBox,
549
"-Wold-style-cast", i18n( "<qt>Warn if an old-style (C-style) cast to a non-void type is used\n"
550
"within a C++ program</qt>" ) );
551
new FlagListItem( wrestBox,
552
"-Wno-pmf-conversions", i18n( "<qt>Disable the diagnostic for converting a bound pointer to member\n"
553
"function to a plain pointer</qt>" ) );
558
Warnings2Tab::~Warnings2Tab()
562
void Warnings2Tab::readFlags( QStringList *list )
564
wrestBox->readFlags( list );
568
void Warnings2Tab::writeFlags( QStringList *list )
570
wrestBox->writeFlags( list );
574
// Last but not least... :-)
575
GccOptionsDialog::GccOptionsDialog( GccOptionsPlugin::Type type, QWidget *parent, const char *name )
576
: KDialogBase( Tabbed, GccOptionsPlugin::captionForType( type ), Ok | Cancel, Ok, parent, name, true )
580
vbox = addVBoxPage( i18n( "General" ) );
581
general = new GeneralTab( type, vbox, "general tab" );
583
vbox = addVBoxPage( i18n( "Optimization" ) );
584
optimization = new OptimizationTab( type, vbox, "optimization tab" );
586
if ( type == GccOptionsPlugin::G77 )
588
vbox = addVBoxPage( i18n( "Fortran Specifics" ) );
589
g77 = new G77Tab( vbox, "g77 tab" );
594
vbox = addVBoxPage( i18n( "Warnings (safe)" ) );
595
warnings1 = new Warnings1Tab( type, vbox, "warnings1 tab" );
597
vbox = addVBoxPage( i18n( "Warnings (unsafe)" ) );
598
warnings2 = new Warnings2Tab( type, vbox, "warnings2 tab" );
602
GccOptionsDialog::~GccOptionsDialog()
606
void GccOptionsDialog::setFlags( const QString &flags )
608
QStringList flaglist = QStringList::split( " ", flags );
610
// Hand them to 'general' at last, so it can make a line edit
611
// with the unprocessed items
613
g77->readFlags( &flaglist );
614
optimization->readFlags( &flaglist );
615
warnings1->readFlags( &flaglist );
616
warnings2->readFlags( &flaglist );
617
general->readFlags( &flaglist );
618
unrecognizedFlags = flaglist;
622
QString GccOptionsDialog::flags() const
624
QStringList flaglist;
627
g77->writeFlags( &flaglist );
628
optimization->writeFlags( &flaglist );
629
warnings1->writeFlags( &flaglist );
630
warnings2->writeFlags( &flaglist );
631
general->writeFlags( &flaglist );
634
QStringList::ConstIterator li;
635
for ( li = flaglist.begin(); li != flaglist.end(); ++li )
641
for ( li = unrecognizedFlags.begin(); li != unrecognizedFlags.end(); ++li )
647
flags.truncate( flags.length() - 1 );
652
GccOptionsPlugin::GccOptionsPlugin( QObject *parent, const char *name, const QStringList &args )
653
: KDevCompilerOptions( parent, name )
657
if ( args.count() == 0 )
660
QString typeStr = args[ 0 ];
662
if ( typeStr == "gcc" )
663
gcctype = GccOptionsPlugin::GCC;
664
else if ( typeStr == "g++" )
665
gcctype = GccOptionsPlugin::GPP;
666
else if ( typeStr == "g77" )
667
gcctype = GccOptionsPlugin::G77;
671
GccOptionsPlugin::~GccOptionsPlugin()
675
QString GccOptionsPlugin::captionForType( Type type )
680
return i18n( "GNU C Compiler Options" );
682
return i18n( "GNU C++ Compiler Options" );
684
return i18n( "GNU Fortran 77 Compiler Options" );
686
return QString::null;
691
QString GccOptionsPlugin::exec( QWidget *parent, const QString &flags )
693
if ( gcctype == Unknown )
694
return QString::null;
695
GccOptionsDialog *dlg = new GccOptionsDialog( gcctype, parent, "gcc options dialog" );
696
QString newFlags = flags;
697
dlg->setFlags( flags );
698
if ( dlg->exec() == QDialog::Accepted )
699
newFlags = dlg->flags();
704
#include "gccoptionsplugin.moc"
705
//kate: indent-mode csands; tab-width 4; space-indent off;