- Get DSO visibility check right in configure.ac. Now it should
work correctly with GCC >= 4.0, while doing nothing for GCC < 4.0 - Add class sgpem::schedulable to test for DSO visibility export. Methods may need to be reordered to conform to coding style guidelines git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@244 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
50c64762ef
commit
4cad356657
46
configure.ac
46
configure.ac
|
@ -91,48 +91,36 @@ PKG_CHECK_MODULES([GTKMM],
|
|||
dnl use DSO visibility tags for systems that supports it correctly
|
||||
dnl (for example, GCC 4.0 and above)
|
||||
dnl see http://gcc.gnu.org/wiki/Visibility for more informations
|
||||
AC_MSG_CHECKING([whether the compiler supports DSO visibility attributes])
|
||||
AH_TEMPLATE([DLLEXPORT],[Attribute for objects to be exported from DSOs])
|
||||
AH_TEMPLATE([DLLIMPORT],[Attribute for objects to be imported from DSOs])
|
||||
AH_TEMPLATE([DLLLOCAL], [Attribute for objects local to current DSO])
|
||||
AH_TEMPLATE([DLLPUBLIC],[Attribute for DSO public objects])
|
||||
|
||||
dnl for now it works only with GCC >= 4.0.0
|
||||
AC_MSG_CHECKING([whether GCC supports DSO visibility attributes])
|
||||
AC_LANG_PUSH([C++])
|
||||
AC_COMPILE_IFELSE(
|
||||
AC_LANG_PROGRAM([], [
|
||||
#if defined (GCC_HASCLASSVISIBILITY) || defined (WIN32)
|
||||
#if defined __GNUC__ && (__GNUC__) >= 4
|
||||
return 0;
|
||||
#else
|
||||
bails out with a compilation error.
|
||||
#endif
|
||||
]),[
|
||||
AC_MSG_RESULT([yes])
|
||||
AH_VERBATIM([DLLEXPORT],[
|
||||
// DSO visibility support enabled by configure
|
||||
#ifdef WIN32
|
||||
#define DLLIMPORT __declspec(dllimport)
|
||||
#define DLLEXPORT __declspec(dllexport)
|
||||
#define DLLLOCAL
|
||||
#define DLLPUBLIC
|
||||
#else
|
||||
#define DLLIMPORT
|
||||
#ifdef GCC_HASCLASSVISIBILITY
|
||||
#define DLLEXPORT __attribute__ ((visibility("default")))
|
||||
#define DLLLOCAL __attribute__ ((visibility("hidden")))
|
||||
#define DLLPUBLIC __attribute__ ((visibility("default")))
|
||||
#else
|
||||
#define DLLEXPORT
|
||||
#define DLLLOCAL
|
||||
#define DLLPUBLIC
|
||||
#endif
|
||||
#endif
|
||||
])
|
||||
AC_DEFINE([DLLIMPORT],[/* intentionally left with no value */])
|
||||
AC_DEFINE([DLLEXPORT],[__attribute__ ((visibility("default")))])
|
||||
AC_DEFINE([DLLLOCAL],[__attribute__ ((visibility("hidden")))])
|
||||
AC_DEFINE([DLLPUBLIC],[__attribute__ ((visibility("default")))])
|
||||
|
||||
AC_CHECK_CXXFLAG([fvisibility=hidden])
|
||||
AC_CHECK_CXXFLAG([fvisibility-inlines-hidden])
|
||||
],[
|
||||
AC_MSG_RESULT([no])
|
||||
AH_VERBATIM([DLLEXPORT],[
|
||||
// Proper DSO visibility is unsupported
|
||||
#define DLLIMPORT
|
||||
#define DLLEXPORT
|
||||
#define DLLLOCAL
|
||||
#define DLLPUBLIC
|
||||
])
|
||||
AC_DEFINE([DLLIMPORT],[/* unsupported */])
|
||||
AC_DEFINE([DLLEXPORT],[/* unsupported */])
|
||||
AC_DEFINE([DLLLOCAL],[/* unsupported */])
|
||||
AC_DEFINE([DLLPUBLIC],[/* unsupported */])
|
||||
])
|
||||
AC_LANG_POP
|
||||
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# Copyright 1999-2006 Gentoo Foundation
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
# $Header: $
|
||||
|
||||
DESCRIPTION=""
|
||||
HOMEPAGE=""
|
||||
SRC_URI=""
|
||||
|
||||
LICENSE=""
|
||||
SLOT="0"
|
||||
KEYWORDS="~x86"
|
||||
IUSE=""
|
||||
|
||||
DEPEND=""
|
||||
RDEPEND=""
|
||||
|
|
@ -44,12 +44,8 @@ libbackend_la_LIBADD = $(PYTHON_LDFLAGS) \
|
|||
libbackend_la_LDFLAGS = $(PYTHON_EXTRA_LDFLAGS)
|
||||
|
||||
# Please keep this in sorted order:
|
||||
libbackend_la_SOURCES = empty.cc
|
||||
|
||||
noinst_HEADERS =
|
||||
|
||||
# !! temp file for debug, will be deleted as soon as
|
||||
# !! source's in place
|
||||
empty.cc :
|
||||
echo "int main() {}" > @builddir@/$@
|
||||
libbackend_la_SOURCES = \
|
||||
schedulable.cc
|
||||
|
||||
noinst_HEADERS = \
|
||||
schedulable.hh
|
||||
|
|
|
@ -0,0 +1,55 @@
|
|||
// src/backend/schedulable.cc - Copyright 2005, 2006, University
|
||||
// of Padova, dept. of Pure and Applied
|
||||
// Mathematics
|
||||
//
|
||||
// This file is part of SGPEMv2.
|
||||
//
|
||||
// This is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// SGPEMv2 is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with SGPEMv2; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#include "schedulable.hh"
|
||||
using namespace sgpem;
|
||||
|
||||
|
||||
Schedulable::Schedulable(unsigned int arrival,
|
||||
unsigned int total,
|
||||
int priority) :
|
||||
_arrival_time(arrival), _total_time(total), _priority(priority)
|
||||
{}
|
||||
|
||||
|
||||
Schedulable::~Schedulable()
|
||||
{}
|
||||
|
||||
|
||||
unsigned int
|
||||
Schedulable::getArrivalTime() const
|
||||
{
|
||||
return _arrival_time;
|
||||
}
|
||||
|
||||
|
||||
unsigned int
|
||||
Schedulable::getTotalCPUTime() const
|
||||
{
|
||||
return _total_time;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
Schedulable::getPriority() const
|
||||
{
|
||||
return _priority;
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
// src/backend/schedulable.hh - Copyright 2005, 2006, University
|
||||
// of Padova, dept. of Pure and Applied
|
||||
// Mathematics
|
||||
//
|
||||
// This file is part of SGPEMv2.
|
||||
//
|
||||
// This is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 2 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// SGPEMv2 is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with SGPEMv2; if not, write to the Free Software
|
||||
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
#ifndef SCHEDULABLE_HH
|
||||
#define SCHEDULABLE_HH 1
|
||||
|
||||
#include "config.h"
|
||||
|
||||
namespace sgpem
|
||||
{
|
||||
class Schedulable;
|
||||
|
||||
/** \brief An entity that can use the processor
|
||||
* This abstract class describes an entity that can use the
|
||||
* processor. It describes the parameters that don't change
|
||||
* during a simulation.
|
||||
* All subclasses are ... (FIXME: teach Luca and Marco what's
|
||||
* the Italian language for, damn them! -- they must have
|
||||
* *smoked* mushrooms! :-) ) */
|
||||
class DLLEXPORT Schedulable
|
||||
{
|
||||
public:
|
||||
Schedulable(unsigned int arrival, unsigned int total, int priority);
|
||||
virtual ~Schedulable() = 0;
|
||||
|
||||
virtual unsigned int getArrivalTime() const;
|
||||
unsigned int getTotalCPUTime() const;
|
||||
int getPriority() const;
|
||||
|
||||
private:
|
||||
unsigned int _arrival_time;
|
||||
unsigned int _total_time;
|
||||
int _priority;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,4 +1,4 @@
|
|||
// src/main.cc - Copyright 2005, 2006, University
|
||||
// src/main.hh - Copyright 2005, 2006, University
|
||||
// of Padova, dept. of Pure and Applied
|
||||
// Mathematics
|
||||
//
|
||||
|
@ -21,7 +21,4 @@
|
|||
#ifndef MAIN_HH
|
||||
#define MAIN_HH 1
|
||||
|
||||
// found in mainwindow.hh
|
||||
extern void build_gui(int argc, char** argv);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -26,11 +26,10 @@
|
|||
|
||||
#include <gtkmm/main.h>
|
||||
|
||||
void DLLEXPORT
|
||||
void
|
||||
start_gui(int argc, char** argv)
|
||||
{
|
||||
Gtk::Main gtk_main(argc,argv);
|
||||
MainWindow main_window;
|
||||
Gtk::Main::run(main_window);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue